2013-10-25 17:19:00 +02:00
|
|
|
/*
|
2019-01-23 18:03:33 +01:00
|
|
|
* This is the source code of Telegram for Android v. 5.x.x.
|
2013-10-25 17:19:00 +02:00
|
|
|
* It is licensed under GNU GPL v. 2 or later.
|
|
|
|
* You should have received a copy of the license in this archive (see LICENSE).
|
|
|
|
*
|
2019-01-23 18:03:33 +01:00
|
|
|
* Copyright Nikolai Kudashov, 2013-2018.
|
2013-10-25 17:19:00 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
package org.telegram.ui;
|
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
import android.Manifest;
|
2017-12-08 18:35:59 +01:00
|
|
|
import android.animation.Animator;
|
|
|
|
import android.animation.AnimatorListenerAdapter;
|
|
|
|
import android.animation.AnimatorSet;
|
2015-02-01 19:51:02 +01:00
|
|
|
import android.animation.ObjectAnimator;
|
|
|
|
import android.animation.StateListAnimator;
|
2019-12-31 14:08:08 +01:00
|
|
|
import android.animation.ValueAnimator;
|
2015-05-21 23:27:27 +02:00
|
|
|
import android.annotation.SuppressLint;
|
2015-10-29 18:10:07 +01:00
|
|
|
import android.annotation.TargetApi;
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.app.Dialog;
|
2015-04-09 20:00:14 +02:00
|
|
|
import android.content.Context;
|
2019-05-14 14:08:05 +02:00
|
|
|
import android.content.DialogInterface;
|
2019-01-23 18:03:33 +01:00
|
|
|
import android.content.Intent;
|
2018-07-30 04:07:02 +02:00
|
|
|
import android.content.SharedPreferences;
|
2015-10-29 18:10:07 +01:00
|
|
|
import android.content.pm.PackageManager;
|
2014-11-06 22:34:47 +01:00
|
|
|
import android.content.res.Configuration;
|
2019-05-14 14:08:05 +02:00
|
|
|
import android.graphics.Canvas;
|
2015-02-01 19:51:02 +01:00
|
|
|
import android.graphics.Outline;
|
2019-06-04 12:14:50 +02:00
|
|
|
import android.graphics.Paint;
|
2017-03-31 01:58:05 +02:00
|
|
|
import android.graphics.PorterDuff;
|
|
|
|
import android.graphics.PorterDuffColorFilter;
|
2019-05-14 14:08:05 +02:00
|
|
|
import android.graphics.RectF;
|
2017-03-31 01:58:05 +02:00
|
|
|
import android.graphics.drawable.Drawable;
|
2019-01-23 18:03:33 +01:00
|
|
|
import android.net.Uri;
|
2014-10-31 20:02:29 +01:00
|
|
|
import android.os.Build;
|
2013-10-25 17:19:00 +02:00
|
|
|
import android.os.Bundle;
|
2019-05-14 14:08:05 +02:00
|
|
|
import android.os.Vibrator;
|
|
|
|
|
|
|
|
import androidx.recyclerview.widget.ItemTouchHelper;
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
2020-02-13 19:26:53 +01:00
|
|
|
import androidx.recyclerview.widget.LinearSmoothScrollerCustom;
|
2019-05-14 14:08:05 +02:00
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
|
2017-12-08 18:35:59 +01:00
|
|
|
import android.text.TextUtils;
|
2014-11-06 22:34:47 +01:00
|
|
|
import android.view.Gravity;
|
2019-05-14 14:08:05 +02:00
|
|
|
import android.view.HapticFeedbackConstants;
|
|
|
|
import android.view.MotionEvent;
|
2013-10-25 17:19:00 +02:00
|
|
|
import android.view.View;
|
2019-12-31 14:08:08 +01:00
|
|
|
import android.view.ViewGroup;
|
2015-02-01 19:51:02 +01:00
|
|
|
import android.view.ViewOutlineProvider;
|
2014-11-06 22:34:47 +01:00
|
|
|
import android.view.ViewTreeObserver;
|
|
|
|
import android.view.animation.AccelerateDecelerateInterpolator;
|
2017-12-08 18:35:59 +01:00
|
|
|
import android.view.animation.DecelerateInterpolator;
|
2014-06-04 01:31:48 +02:00
|
|
|
import android.widget.EditText;
|
2018-07-30 04:07:02 +02:00
|
|
|
import android.widget.FrameLayout;
|
2014-11-06 22:34:47 +01:00
|
|
|
import android.widget.ImageView;
|
2019-05-14 14:08:05 +02:00
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
import org.telegram.messenger.AccountInstance;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.AndroidUtilities;
|
2018-07-30 04:07:02 +02:00
|
|
|
import org.telegram.messenger.ApplicationLoader;
|
2016-03-06 02:49:31 +01:00
|
|
|
import org.telegram.messenger.BuildVars;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.ChatObject;
|
2019-07-18 15:01:39 +02:00
|
|
|
import org.telegram.messenger.MediaDataController;
|
2016-06-24 12:27:15 +02:00
|
|
|
import org.telegram.messenger.DialogObject;
|
2015-10-29 18:10:07 +01:00
|
|
|
import org.telegram.messenger.ImageLoader;
|
2019-05-14 14:08:05 +02:00
|
|
|
import org.telegram.messenger.ImageLocation;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.LocaleController;
|
|
|
|
import org.telegram.messenger.MessageObject;
|
2019-05-14 14:08:05 +02:00
|
|
|
import org.telegram.messenger.NotificationsController;
|
2018-07-30 04:07:02 +02:00
|
|
|
import org.telegram.messenger.SharedConfig;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.UserObject;
|
2019-05-14 14:08:05 +02:00
|
|
|
import org.telegram.messenger.Utilities;
|
2019-01-23 18:03:33 +01:00
|
|
|
import org.telegram.messenger.XiaomiUtilities;
|
2014-11-21 11:59:05 +01:00
|
|
|
import org.telegram.messenger.FileLog;
|
2018-07-30 04:07:02 +02:00
|
|
|
import org.telegram.tgnet.ConnectionsManager;
|
2017-12-08 18:35:59 +01:00
|
|
|
import org.telegram.tgnet.TLObject;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.tgnet.TLRPC;
|
|
|
|
import org.telegram.messenger.ContactsController;
|
|
|
|
import org.telegram.messenger.MessagesController;
|
|
|
|
import org.telegram.messenger.NotificationCenter;
|
2013-10-25 17:19:00 +02:00
|
|
|
import org.telegram.messenger.R;
|
|
|
|
import org.telegram.messenger.UserConfig;
|
2019-05-14 14:08:05 +02:00
|
|
|
import org.telegram.ui.ActionBar.ActionBarMenuSubItem;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.ActionBar.AlertDialog;
|
2019-05-14 14:08:05 +02:00
|
|
|
import org.telegram.ui.ActionBar.BackDrawable;
|
2019-12-31 14:08:08 +01:00
|
|
|
import org.telegram.ui.ActionBar.BottomSheet;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.ActionBar.ThemeDescription;
|
2014-11-13 21:10:14 +01:00
|
|
|
import org.telegram.ui.Adapters.DialogsAdapter;
|
|
|
|
import org.telegram.ui.Adapters.DialogsSearchAdapter;
|
2018-07-30 04:07:02 +02:00
|
|
|
import org.telegram.ui.Cells.AccountSelectCell;
|
2019-05-14 14:08:05 +02:00
|
|
|
import org.telegram.ui.Cells.ArchiveHintInnerCell;
|
2017-12-08 18:35:59 +01:00
|
|
|
import org.telegram.ui.Cells.DialogsEmptyCell;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.Cells.DividerCell;
|
|
|
|
import org.telegram.ui.Cells.DrawerActionCell;
|
2018-07-30 04:07:02 +02:00
|
|
|
import org.telegram.ui.Cells.DrawerAddCell;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.Cells.DrawerProfileCell;
|
2018-07-30 04:07:02 +02:00
|
|
|
import org.telegram.ui.Cells.DrawerUserCell;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.Cells.GraySectionCell;
|
|
|
|
import org.telegram.ui.Cells.HashtagSearchCell;
|
2016-05-25 23:49:47 +02:00
|
|
|
import org.telegram.ui.Cells.HintDialogCell;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.Cells.LoadingCell;
|
2015-08-13 11:23:31 +02:00
|
|
|
import org.telegram.ui.Cells.ProfileSearchCell;
|
2019-05-14 14:08:05 +02:00
|
|
|
import org.telegram.ui.Cells.ShadowSectionCell;
|
2019-07-18 15:01:39 +02:00
|
|
|
import org.telegram.ui.Cells.TextCell;
|
2014-11-10 12:05:22 +01:00
|
|
|
import org.telegram.ui.Cells.UserCell;
|
2014-02-04 19:36:55 +01:00
|
|
|
import org.telegram.ui.Cells.DialogCell;
|
2014-11-13 21:10:14 +01:00
|
|
|
import org.telegram.ui.ActionBar.ActionBar;
|
|
|
|
import org.telegram.ui.ActionBar.ActionBarMenu;
|
|
|
|
import org.telegram.ui.ActionBar.ActionBarMenuItem;
|
|
|
|
import org.telegram.ui.ActionBar.BaseFragment;
|
|
|
|
import org.telegram.ui.ActionBar.MenuDrawable;
|
2018-07-30 04:07:02 +02:00
|
|
|
import org.telegram.ui.Components.AlertsCreator;
|
|
|
|
import org.telegram.ui.Components.AnimatedArrowDrawable;
|
2019-12-31 14:08:08 +01:00
|
|
|
import org.telegram.ui.Components.PullForegroundDrawable;
|
2018-07-30 04:07:02 +02:00
|
|
|
import org.telegram.ui.Components.AvatarDrawable;
|
|
|
|
import org.telegram.ui.Components.BackupImageView;
|
2017-12-08 18:35:59 +01:00
|
|
|
import org.telegram.ui.Components.ChatActivityEnterView;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.Components.CombinedDrawable;
|
2019-05-14 14:08:05 +02:00
|
|
|
import org.telegram.ui.Components.CubicBezierInterpolator;
|
|
|
|
import org.telegram.ui.Components.DialogsItemAnimator;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.Components.FragmentContextView;
|
2015-05-21 23:27:27 +02:00
|
|
|
import org.telegram.ui.Components.EmptyTextProgressView;
|
2017-12-08 18:35:59 +01:00
|
|
|
import org.telegram.ui.Components.JoinGroupAlert;
|
2015-05-21 23:27:27 +02:00
|
|
|
import org.telegram.ui.Components.LayoutHelper;
|
2019-05-14 14:08:05 +02:00
|
|
|
import org.telegram.ui.Components.NumberTextView;
|
|
|
|
import org.telegram.ui.Components.PacmanAnimation;
|
2018-07-30 04:07:02 +02:00
|
|
|
import org.telegram.ui.Components.ProxyDrawable;
|
2019-07-18 15:01:39 +02:00
|
|
|
import org.telegram.ui.Components.RLottieDrawable;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.Components.RadialProgressView;
|
2019-12-31 14:08:08 +01:00
|
|
|
import org.telegram.ui.Components.RecyclerAnimationScrollHelper;
|
2015-05-21 23:27:27 +02:00
|
|
|
import org.telegram.ui.Components.RecyclerListView;
|
2016-04-22 15:49:00 +02:00
|
|
|
import org.telegram.ui.ActionBar.Theme;
|
2017-12-08 18:35:59 +01:00
|
|
|
import org.telegram.ui.Components.SizeNotifierFrameLayout;
|
|
|
|
import org.telegram.ui.Components.StickersAlert;
|
2019-01-23 18:03:33 +01:00
|
|
|
import org.telegram.ui.Components.UndoView;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
|
|
|
import java.util.ArrayList;
|
2019-06-16 17:06:55 +02:00
|
|
|
import java.util.Date;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2019-06-11 10:40:16 +02:00
|
|
|
import tw.nekomimi.nekogram.FilterPopup;
|
2019-06-16 17:06:55 +02:00
|
|
|
import tw.nekomimi.nekogram.MessageHelper;
|
2019-09-05 19:23:29 +02:00
|
|
|
import tw.nekomimi.nekogram.NekoConfig;
|
2019-06-11 10:40:16 +02:00
|
|
|
|
2015-07-22 20:56:37 +02:00
|
|
|
public class DialogsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
2015-05-21 23:27:27 +02:00
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
private DialogsRecyclerView listView;
|
|
|
|
private RecyclerListView searchListView;
|
2015-05-21 23:27:27 +02:00
|
|
|
private LinearLayoutManager layoutManager;
|
2019-12-31 14:08:08 +01:00
|
|
|
private LinearLayoutManager searchlayoutManager;
|
2014-11-13 21:10:14 +01:00
|
|
|
private DialogsAdapter dialogsAdapter;
|
|
|
|
private DialogsSearchAdapter dialogsSearchAdapter;
|
2015-05-21 23:27:27 +02:00
|
|
|
private EmptyTextProgressView searchEmptyView;
|
2017-03-31 01:58:05 +02:00
|
|
|
private RadialProgressView progressView;
|
2015-02-26 02:32:51 +01:00
|
|
|
private ActionBarMenuItem passcodeItem;
|
2018-07-30 04:07:02 +02:00
|
|
|
private ActionBarMenuItem proxyItem;
|
|
|
|
private ProxyDrawable proxyDrawable;
|
2014-11-06 22:34:47 +01:00
|
|
|
private ImageView floatingButton;
|
2019-01-23 18:03:33 +01:00
|
|
|
private FrameLayout floatingButtonContainer;
|
2019-05-14 14:08:05 +02:00
|
|
|
private UndoView[] undoView = new UndoView[2];
|
|
|
|
private SwipeController swipeController;
|
|
|
|
private ItemTouchHelper itemTouchhelper;
|
|
|
|
|
|
|
|
private int lastItemsCount;
|
|
|
|
|
2019-08-22 01:53:26 +02:00
|
|
|
private int messagesCount;
|
2020-01-23 07:15:40 +01:00
|
|
|
private int hasPoll;
|
2019-08-22 01:53:26 +02:00
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
private PacmanAnimation pacmanAnimation;
|
|
|
|
|
|
|
|
private DialogCell slidingView;
|
|
|
|
private DialogCell movingView;
|
|
|
|
private boolean allowMoving;
|
|
|
|
private boolean movingWas;
|
|
|
|
private boolean waitingForScrollFinished;
|
|
|
|
private boolean allowSwipeDuringCurrentTouch;
|
2019-12-31 14:08:08 +01:00
|
|
|
private boolean updatePullAfterScroll;
|
2019-05-14 14:08:05 +02:00
|
|
|
|
|
|
|
private MenuDrawable menuDrawable;
|
|
|
|
private BackDrawable backDrawable;
|
|
|
|
|
|
|
|
private NumberTextView selectedDialogsCountTextView;
|
|
|
|
private ArrayList<View> actionModeViews = new ArrayList<>();
|
|
|
|
private ActionBarMenuItem deleteItem;
|
|
|
|
private ActionBarMenuItem pinItem;
|
2019-09-10 12:56:11 +02:00
|
|
|
private ActionBarMenuItem muteItem;
|
|
|
|
private ActionBarMenuSubItem archiveItem;
|
2019-05-14 14:08:05 +02:00
|
|
|
private ActionBarMenuSubItem clearItem;
|
|
|
|
private ActionBarMenuSubItem readItem;
|
2020-02-13 19:26:53 +01:00
|
|
|
private ActionBarMenuSubItem blockItem;
|
2018-07-30 04:07:02 +02:00
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
private float additionalFloatingTranslation;
|
2019-12-31 14:08:08 +01:00
|
|
|
private float floatingButtonTranslation;
|
|
|
|
private float floatingButtonHideProgress;
|
|
|
|
|
|
|
|
private AnimatorSet searchAnimator;
|
|
|
|
private boolean lastSearchScrolledToTop;
|
2019-01-23 18:03:33 +01:00
|
|
|
|
|
|
|
//private ImageView unreadFloatingButton;
|
|
|
|
//private FrameLayout unreadFloatingButtonContainer;
|
|
|
|
//private TextView unreadFloatingButtonCounter;
|
|
|
|
//private int currentUnreadCount;
|
2018-07-30 04:07:02 +02:00
|
|
|
|
|
|
|
private AnimatedArrowDrawable arrowDrawable;
|
2017-03-31 01:58:05 +02:00
|
|
|
private RecyclerView sideMenu;
|
2017-12-08 18:35:59 +01:00
|
|
|
private ChatActivityEnterView commentView;
|
2018-07-30 04:07:02 +02:00
|
|
|
private ActionBarMenuItem switchItem;
|
2015-05-21 23:27:27 +02:00
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
private static ArrayList<TLRPC.Dialog> frozenDialogsList;
|
|
|
|
private boolean dialogsListFrozen;
|
|
|
|
private int dialogRemoveFinished;
|
|
|
|
private int dialogInsertFinished;
|
|
|
|
private int dialogChangeFinished;
|
|
|
|
private DialogsItemAnimator dialogsItemAnimator;
|
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
private AlertDialog permissionDialog;
|
2018-07-30 04:07:02 +02:00
|
|
|
private boolean askAboutContacts = true;
|
|
|
|
|
|
|
|
private boolean proxyItemVisisble;
|
2019-01-23 18:03:33 +01:00
|
|
|
private boolean closeSearchFieldOnHide;
|
|
|
|
private long searchDialogId;
|
|
|
|
private TLObject searchObject;
|
2015-10-29 18:10:07 +01:00
|
|
|
|
2014-11-06 22:34:47 +01:00
|
|
|
private int prevPosition;
|
|
|
|
private int prevTop;
|
|
|
|
private boolean scrollUpdated;
|
|
|
|
private boolean floatingHidden;
|
|
|
|
private final AccelerateDecelerateInterpolator floatingInterpolator = new AccelerateDecelerateInterpolator();
|
2014-10-31 20:02:29 +01:00
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
private boolean checkPermission = true;
|
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
private int currentConnectionState;
|
|
|
|
|
2014-06-04 01:31:48 +02:00
|
|
|
private String selectAlertString;
|
2014-10-04 17:56:09 +02:00
|
|
|
private String selectAlertStringGroup;
|
2015-06-29 19:12:11 +02:00
|
|
|
private String addToGroupAlertString;
|
2019-07-18 15:01:39 +02:00
|
|
|
private boolean resetDelegate = true;
|
2015-06-29 19:12:11 +02:00
|
|
|
private int dialogsType;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
public static boolean[] dialogsLoaded = new boolean[UserConfig.MAX_ACCOUNT_COUNT];
|
2015-05-21 23:27:27 +02:00
|
|
|
private boolean searching;
|
|
|
|
private boolean searchWas;
|
|
|
|
private boolean onlySelect;
|
2015-03-19 00:09:45 +01:00
|
|
|
private String searchString;
|
2015-05-21 23:27:27 +02:00
|
|
|
private long openedDialogId;
|
2016-10-11 13:57:01 +02:00
|
|
|
private boolean cantSendToChannels;
|
2018-07-30 04:07:02 +02:00
|
|
|
private boolean allowSwitchAccount;
|
2019-03-03 21:40:48 +01:00
|
|
|
private boolean checkCanWrite;
|
2019-12-31 14:08:08 +01:00
|
|
|
private boolean afterSignup;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2016-04-22 15:49:00 +02:00
|
|
|
private DialogsActivityDelegate delegate;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
private int canReadCount;
|
|
|
|
private int canPinCount;
|
|
|
|
private int canMuteCount;
|
|
|
|
private int canUnmuteCount;
|
|
|
|
private int canClearCacheCount;
|
2020-02-13 19:26:53 +01:00
|
|
|
private int canReportSpamCount;
|
2019-05-14 14:08:05 +02:00
|
|
|
|
|
|
|
private int folderId;
|
|
|
|
|
|
|
|
private final static int pin = 100;
|
|
|
|
private final static int read = 101;
|
|
|
|
private final static int delete = 102;
|
|
|
|
private final static int clear = 103;
|
|
|
|
private final static int mute = 104;
|
|
|
|
private final static int archive = 105;
|
2020-02-13 19:26:53 +01:00
|
|
|
private final static int block = 106;
|
2019-05-14 14:08:05 +02:00
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
private final static int ARCHIVE_ITEM_STATE_PINNED = 0;
|
|
|
|
private final static int ARCHIVE_ITEM_STATE_SHOWED = 1;
|
|
|
|
private final static int ARCHIVE_ITEM_STATE_HIDDEN = 2;
|
|
|
|
|
|
|
|
private int archivePullViewState;
|
|
|
|
private long startArchivePullingTime;
|
2019-06-04 12:14:50 +02:00
|
|
|
private boolean scrollingManually;
|
2019-12-31 14:08:08 +01:00
|
|
|
private boolean canShowHiddenArchive;
|
|
|
|
|
|
|
|
public PullForegroundDrawable pullForegroundDrawable;
|
|
|
|
private RecyclerAnimationScrollHelper scrollHelper;
|
2019-05-14 14:08:05 +02:00
|
|
|
|
2019-06-04 12:14:50 +02:00
|
|
|
private class ContentView extends SizeNotifierFrameLayout {
|
2019-05-14 14:08:05 +02:00
|
|
|
|
|
|
|
private int inputFieldHeight;
|
|
|
|
|
|
|
|
public ContentView(Context context) {
|
2020-02-13 19:26:53 +01:00
|
|
|
super(context, SharedConfig.smoothKeyboard);
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
|
|
int widthSize = View.MeasureSpec.getSize(widthMeasureSpec);
|
|
|
|
int heightSize = View.MeasureSpec.getSize(heightMeasureSpec);
|
|
|
|
|
|
|
|
setMeasuredDimension(widthSize, heightSize);
|
|
|
|
heightSize -= getPaddingTop();
|
|
|
|
|
|
|
|
measureChildWithMargins(actionBar, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
|
|
|
|
2020-02-13 19:26:53 +01:00
|
|
|
int keyboardSize = SharedConfig.smoothKeyboard ? 0 : getKeyboardHeight();
|
2019-05-14 14:08:05 +02:00
|
|
|
int childCount = getChildCount();
|
|
|
|
|
|
|
|
if (commentView != null) {
|
|
|
|
measureChildWithMargins(commentView, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
|
|
|
Object tag = commentView.getTag();
|
|
|
|
if (tag != null && tag.equals(2)) {
|
|
|
|
if (keyboardSize <= AndroidUtilities.dp(20) && !AndroidUtilities.isInMultiwindow) {
|
|
|
|
heightSize -= commentView.getEmojiPadding();
|
|
|
|
}
|
|
|
|
inputFieldHeight = commentView.getMeasuredHeight();
|
|
|
|
} else {
|
|
|
|
inputFieldHeight = 0;
|
|
|
|
}
|
2020-02-13 19:26:53 +01:00
|
|
|
|
|
|
|
if (SharedConfig.smoothKeyboard && commentView.isPopupShowing()) {
|
|
|
|
fragmentView.setTranslationY(getCurrentPanTranslationY());
|
|
|
|
listView.setTranslationY(0);
|
|
|
|
searchListView.setTranslationY(0);
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < childCount; i++) {
|
|
|
|
View child = getChildAt(i);
|
|
|
|
if (child == null || child.getVisibility() == GONE || child == commentView || child == actionBar) {
|
|
|
|
continue;
|
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
if (child == listView || child == searchListView || child == progressView || child == searchEmptyView) {
|
2019-05-14 14:08:05 +02:00
|
|
|
int contentWidthSpec = View.MeasureSpec.makeMeasureSpec(widthSize, View.MeasureSpec.EXACTLY);
|
|
|
|
int contentHeightSpec = View.MeasureSpec.makeMeasureSpec(Math.max(AndroidUtilities.dp(10), heightSize - inputFieldHeight + AndroidUtilities.dp(2)), View.MeasureSpec.EXACTLY);
|
|
|
|
child.measure(contentWidthSpec, contentHeightSpec);
|
2019-12-31 14:08:08 +01:00
|
|
|
child.setPivotX(child.getMeasuredWidth() / 2);
|
2019-05-14 14:08:05 +02:00
|
|
|
} else if (commentView != null && commentView.isPopupView(child)) {
|
|
|
|
if (AndroidUtilities.isInMultiwindow) {
|
|
|
|
if (AndroidUtilities.isTablet()) {
|
|
|
|
child.measure(View.MeasureSpec.makeMeasureSpec(widthSize, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(Math.min(AndroidUtilities.dp(320), heightSize - inputFieldHeight - AndroidUtilities.statusBarHeight + getPaddingTop()), View.MeasureSpec.EXACTLY));
|
|
|
|
} else {
|
|
|
|
child.measure(View.MeasureSpec.makeMeasureSpec(widthSize, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(heightSize - inputFieldHeight - AndroidUtilities.statusBarHeight + getPaddingTop(), View.MeasureSpec.EXACTLY));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
child.measure(View.MeasureSpec.makeMeasureSpec(widthSize, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(child.getLayoutParams().height, View.MeasureSpec.EXACTLY));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
|
|
|
final int count = getChildCount();
|
|
|
|
|
|
|
|
int paddingBottom;
|
|
|
|
Object tag = commentView != null ? commentView.getTag() : null;
|
2020-02-13 19:26:53 +01:00
|
|
|
int keyboardSize = SharedConfig.smoothKeyboard ? 0 : getKeyboardHeight();
|
2019-05-14 14:08:05 +02:00
|
|
|
if (tag != null && tag.equals(2)) {
|
2020-02-13 19:26:53 +01:00
|
|
|
paddingBottom = keyboardSize <= AndroidUtilities.dp(20) && !AndroidUtilities.isInMultiwindow ? commentView.getEmojiPadding() : 0;
|
2019-05-14 14:08:05 +02:00
|
|
|
} else {
|
|
|
|
paddingBottom = 0;
|
|
|
|
}
|
|
|
|
setBottomClip(paddingBottom);
|
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
final View child = getChildAt(i);
|
|
|
|
if (child.getVisibility() == GONE) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
final FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) child.getLayoutParams();
|
|
|
|
|
|
|
|
final int width = child.getMeasuredWidth();
|
|
|
|
final int height = child.getMeasuredHeight();
|
|
|
|
|
|
|
|
int childLeft;
|
|
|
|
int childTop;
|
|
|
|
|
|
|
|
int gravity = lp.gravity;
|
|
|
|
if (gravity == -1) {
|
|
|
|
gravity = Gravity.TOP | Gravity.LEFT;
|
|
|
|
}
|
|
|
|
|
|
|
|
final int absoluteGravity = gravity & Gravity.HORIZONTAL_GRAVITY_MASK;
|
|
|
|
final int verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;
|
|
|
|
|
|
|
|
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
|
|
|
case Gravity.CENTER_HORIZONTAL:
|
|
|
|
childLeft = (r - l - width) / 2 + lp.leftMargin - lp.rightMargin;
|
|
|
|
break;
|
|
|
|
case Gravity.RIGHT:
|
|
|
|
childLeft = r - width - lp.rightMargin;
|
|
|
|
break;
|
|
|
|
case Gravity.LEFT:
|
|
|
|
default:
|
|
|
|
childLeft = lp.leftMargin;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (verticalGravity) {
|
|
|
|
case Gravity.TOP:
|
|
|
|
childTop = lp.topMargin + getPaddingTop();
|
|
|
|
break;
|
|
|
|
case Gravity.CENTER_VERTICAL:
|
|
|
|
childTop = ((b - paddingBottom) - t - height) / 2 + lp.topMargin - lp.bottomMargin;
|
|
|
|
break;
|
|
|
|
case Gravity.BOTTOM:
|
|
|
|
childTop = ((b - paddingBottom) - t) - height - lp.bottomMargin;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
childTop = lp.topMargin;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (commentView != null && commentView.isPopupView(child)) {
|
|
|
|
if (AndroidUtilities.isInMultiwindow) {
|
|
|
|
childTop = commentView.getTop() - child.getMeasuredHeight() + AndroidUtilities.dp(1);
|
|
|
|
} else {
|
|
|
|
childTop = commentView.getBottom();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
child.layout(childLeft, childTop, childLeft + width, childTop + height);
|
|
|
|
}
|
|
|
|
|
|
|
|
notifyHeightChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
|
|
|
int action = ev.getActionMasked();
|
2019-12-31 14:08:08 +01:00
|
|
|
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
|
|
|
|
if (actionBar.isActionModeShowed()) {
|
|
|
|
allowMoving = true;
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return super.onInterceptTouchEvent(ev);
|
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean hasOverlappingRendering() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static float viewOffset = 0.0f;
|
|
|
|
|
|
|
|
public class DialogsRecyclerView extends RecyclerListView {
|
|
|
|
|
|
|
|
private boolean firstLayout = true;
|
|
|
|
private boolean ignoreLayout;
|
|
|
|
|
|
|
|
public DialogsRecyclerView(Context context) {
|
|
|
|
super(context);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setViewsOffset(float viewOffset) {
|
|
|
|
DialogsActivity.viewOffset = viewOffset;
|
|
|
|
int n = getChildCount();
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
getChildAt(i).setTranslationY(viewOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (selectorPosition != NO_POSITION) {
|
|
|
|
View v = layoutManager.findViewByPosition(selectorPosition);
|
|
|
|
if (v != null) {
|
|
|
|
selectorRect.set(v.getLeft(), (int) (v.getTop() + viewOffset), v.getRight(), (int) (v.getBottom() + viewOffset));
|
|
|
|
selectorDrawable.setBounds(selectorRect);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
public float getViewOffset() {
|
|
|
|
return viewOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void addView(View child, int index, ViewGroup.LayoutParams params) {
|
|
|
|
super.addView(child, index, params);
|
|
|
|
child.setTranslationY(viewOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void removeView(View view) {
|
|
|
|
super.removeView(view);
|
|
|
|
view.setTranslationY(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onDraw(Canvas canvas) {
|
|
|
|
if (pullForegroundDrawable != null && viewOffset != 0) {
|
|
|
|
pullForegroundDrawable.drawOverScroll(canvas);
|
|
|
|
}
|
|
|
|
super.onDraw(canvas);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void dispatchDraw(Canvas canvas) {
|
|
|
|
super.dispatchDraw(canvas);
|
|
|
|
if (slidingView != null && pacmanAnimation != null) {
|
|
|
|
pacmanAnimation.draw(canvas, slidingView.getTop() + slidingView.getMeasuredHeight() / 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setAdapter(RecyclerView.Adapter adapter) {
|
|
|
|
super.setAdapter(adapter);
|
|
|
|
firstLayout = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void checkIfAdapterValid() {
|
|
|
|
if (listView != null && dialogsAdapter != null && listView.getAdapter() == dialogsAdapter && lastItemsCount != dialogsAdapter.getItemCount()) {
|
|
|
|
ignoreLayout = true;
|
|
|
|
dialogsAdapter.notifyDataSetChanged();
|
|
|
|
ignoreLayout = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setPadding(int left, int top, int right, int bottom) {
|
|
|
|
super.setPadding(left, top, right, bottom);
|
|
|
|
if (searchEmptyView != null) {
|
|
|
|
searchEmptyView.setPadding(left, top, right, bottom);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onMeasure(int widthSpec, int heightSpec) {
|
|
|
|
if (firstLayout && getMessagesController().dialogsLoaded) {
|
|
|
|
if (hasHiddenArchive()) {
|
|
|
|
ignoreLayout = true;
|
|
|
|
layoutManager.scrollToPositionWithOffset(1, 0);
|
|
|
|
ignoreLayout = false;
|
|
|
|
}
|
|
|
|
firstLayout = false;
|
|
|
|
}
|
|
|
|
checkIfAdapterValid();
|
|
|
|
super.onMeasure(widthSpec, heightSpec);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
|
|
|
super.onLayout(changed, l, t, r, b);
|
|
|
|
if ((dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0) && !dialogsItemAnimator.isRunning()) {
|
|
|
|
onDialogAnimationFinished();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void requestLayout() {
|
|
|
|
if (ignoreLayout) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
super.requestLayout();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void toggleArchiveHidden(boolean action, DialogCell dialogCell) {
|
|
|
|
SharedConfig.toggleArchiveHidden();
|
|
|
|
if (SharedConfig.archiveHidden) {
|
|
|
|
waitingForScrollFinished = true;
|
|
|
|
if (dialogCell != null) {
|
|
|
|
listView.smoothScrollBy(0, (dialogCell.getMeasuredHeight() + dialogCell.getTop()), CubicBezierInterpolator.EASE_OUT);
|
|
|
|
if (action) {
|
|
|
|
updatePullAfterScroll = true;
|
|
|
|
} else {
|
|
|
|
updatePullState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
getUndoView().showWithAction(0, UndoView.ACTION_ARCHIVE_HIDDEN, null, null);
|
|
|
|
} else {
|
|
|
|
getUndoView().showWithAction(0, UndoView.ACTION_ARCHIVE_PINNED, null, null);
|
|
|
|
updatePullState();
|
|
|
|
if (action && dialogCell != null) {
|
|
|
|
dialogCell.resetPinnedArchiveState();
|
|
|
|
dialogCell.invalidate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void updatePullState() {
|
|
|
|
archivePullViewState = SharedConfig.archiveHidden ? ARCHIVE_ITEM_STATE_HIDDEN : ARCHIVE_ITEM_STATE_PINNED;
|
|
|
|
if (pullForegroundDrawable != null) {
|
|
|
|
pullForegroundDrawable.setWillDraw(archivePullViewState != ARCHIVE_ITEM_STATE_PINNED);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onTouchEvent(MotionEvent e) {
|
|
|
|
if (animationRunning || waitingForScrollFinished || dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
int action = e.getAction();
|
|
|
|
if (action == MotionEvent.ACTION_DOWN) {
|
|
|
|
listView.setOverScrollMode(View.OVER_SCROLL_ALWAYS);
|
|
|
|
}
|
|
|
|
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
|
|
|
|
if (!itemTouchhelper.isIdle() && swipeController.swipingFolder) {
|
|
|
|
swipeController.swipeFolderBack = true;
|
|
|
|
if (itemTouchhelper.checkHorizontalSwipe(null, ItemTouchHelper.LEFT) != 0) {
|
|
|
|
toggleArchiveHidden(false, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
boolean result = super.onTouchEvent(e);
|
|
|
|
if ((action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) && archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN && hasHiddenArchive()) {
|
|
|
|
int currentPosition = layoutManager.findFirstVisibleItemPosition();
|
|
|
|
if (currentPosition == 0) {
|
|
|
|
View view = layoutManager.findViewByPosition(currentPosition);
|
|
|
|
int height = (int) (AndroidUtilities.dp(SharedConfig.useThreeLinesLayout ? 78 : 72) * PullForegroundDrawable.SNAP_HEIGHT);
|
|
|
|
int diff = view.getTop() + view.getMeasuredHeight();
|
|
|
|
if (view != null) {
|
|
|
|
long pullingTime = System.currentTimeMillis() - startArchivePullingTime;
|
|
|
|
if (diff < height || pullingTime < PullForegroundDrawable.minPullingTime) {
|
|
|
|
listView.smoothScrollBy(0, diff, CubicBezierInterpolator.EASE_OUT_QUINT);
|
|
|
|
archivePullViewState = ARCHIVE_ITEM_STATE_HIDDEN;
|
|
|
|
} else {
|
|
|
|
if (archivePullViewState != ARCHIVE_ITEM_STATE_SHOWED) {
|
|
|
|
if (listView.getViewOffset() == 0) {
|
|
|
|
listView.smoothScrollBy(0, view.getTop(), CubicBezierInterpolator.EASE_OUT_QUINT);
|
|
|
|
}
|
|
|
|
if (!canShowHiddenArchive) {
|
|
|
|
canShowHiddenArchive = true;
|
|
|
|
listView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
|
|
|
if (pullForegroundDrawable != null) {
|
|
|
|
pullForegroundDrawable.colorize(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
((DialogCell) view).startOutAnimation();
|
|
|
|
archivePullViewState = ARCHIVE_ITEM_STATE_SHOWED;
|
2020-02-20 13:35:34 +01:00
|
|
|
|
|
|
|
if (NekoConfig.openArchiveOnPull) {
|
|
|
|
AndroidUtilities.runOnUIThread(() -> {
|
|
|
|
// Open the folder.
|
|
|
|
// Delay was taken from PullForegroundDrawable::startOutAnimation().
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("folderId", 1); // 1 is the ID of the archive folder.
|
|
|
|
args.putInt("dialogsType", dialogsType);
|
|
|
|
args.putBoolean("onlySelect", onlySelect);
|
|
|
|
DialogsActivity dialogsActivity = new DialogsActivity(args);
|
|
|
|
dialogsActivity.setDelegate(delegate);
|
|
|
|
presentFragment(dialogsActivity, onlySelect);
|
|
|
|
}, 200);
|
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (listView.getViewOffset() != 0) {
|
|
|
|
ValueAnimator valueAnimator = ValueAnimator.ofFloat(listView.getViewOffset(), 0f);
|
|
|
|
valueAnimator.addUpdateListener(animation -> listView.setViewsOffset((float) animation.getAnimatedValue()));
|
|
|
|
|
|
|
|
valueAnimator.setDuration((long) (350f - 120f * (listView.getViewOffset() / PullForegroundDrawable.getMaxOverscroll())));
|
|
|
|
valueAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
|
|
|
|
listView.setScrollEnabled(false);
|
|
|
|
valueAnimator.addListener(new AnimatorListenerAdapter() {
|
|
|
|
@Override
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
|
|
super.onAnimationEnd(animation);
|
|
|
|
listView.setScrollEnabled(true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
valueAnimator.start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onInterceptTouchEvent(MotionEvent e) {
|
|
|
|
if (animationRunning || waitingForScrollFinished || dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (e.getAction() == MotionEvent.ACTION_DOWN) {
|
|
|
|
allowSwipeDuringCurrentTouch = !actionBar.isActionModeShowed();
|
|
|
|
checkIfAdapterValid();
|
|
|
|
}
|
|
|
|
return super.onInterceptTouchEvent(e);
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
class SwipeController extends ItemTouchHelper.Callback {
|
|
|
|
|
|
|
|
private RectF buttonInstance;
|
|
|
|
private RecyclerView.ViewHolder currentItemViewHolder;
|
|
|
|
private boolean swipingFolder;
|
|
|
|
private boolean swipeFolderBack;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
|
|
|
|
if (waitingForDialogsAnimationEnd() || parentLayout != null && parentLayout.isInPreviewMode()) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (swipingFolder && swipeFolderBack) {
|
|
|
|
swipingFolder = false;
|
|
|
|
return 0;
|
|
|
|
}
|
2019-10-30 07:29:52 +01:00
|
|
|
if (!onlySelect && (dialogsType == 0 || (dialogsType >= 7 && dialogsType <= 12)) && slidingView == null && recyclerView.getAdapter() == dialogsAdapter && viewHolder.itemView instanceof DialogCell) {
|
2019-05-14 14:08:05 +02:00
|
|
|
DialogCell dialogCell = (DialogCell) viewHolder.itemView;
|
|
|
|
long dialogId = dialogCell.getDialogId();
|
|
|
|
if (actionBar.isActionModeShowed()) {
|
|
|
|
TLRPC.Dialog dialog = getMessagesController().dialogs_dict.get(dialogId);
|
|
|
|
if (!allowMoving || dialog == null || !dialog.pinned || DialogObject.isFolderDialogId(dialogId)) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
movingView = (DialogCell) viewHolder.itemView;
|
|
|
|
movingView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
|
|
|
return makeMovementFlags(ItemTouchHelper.UP | ItemTouchHelper.DOWN, 0);
|
|
|
|
} else {
|
2019-06-04 12:14:50 +02:00
|
|
|
if (!allowSwipeDuringCurrentTouch || dialogId == getUserConfig().clientUserId || dialogId == 777000 || getMessagesController().isProxyDialog(dialogId, false)) {
|
2019-05-14 14:08:05 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
swipeFolderBack = false;
|
|
|
|
swipingFolder = SharedConfig.archiveHidden && DialogObject.isFolderDialogId(dialogCell.getDialogId());
|
|
|
|
dialogCell.setSliding(true);
|
|
|
|
return makeMovementFlags(0, ItemTouchHelper.LEFT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder source, RecyclerView.ViewHolder target) {
|
|
|
|
if (!(target.itemView instanceof DialogCell)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
DialogCell dialogCell = (DialogCell) target.itemView;
|
|
|
|
long dialogId = dialogCell.getDialogId();
|
|
|
|
TLRPC.Dialog dialog = getMessagesController().dialogs_dict.get(dialogId);
|
|
|
|
if (dialog == null || !dialog.pinned || DialogObject.isFolderDialogId(dialogId)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
int fromIndex = source.getAdapterPosition();
|
|
|
|
int toIndex = target.getAdapterPosition();
|
|
|
|
dialogsAdapter.notifyItemMoved(fromIndex, toIndex);
|
|
|
|
updateDialogIndices();
|
|
|
|
movingWas = true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int convertToAbsoluteDirection(int flags, int layoutDirection) {
|
|
|
|
if (swipeFolderBack) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return super.convertToAbsoluteDirection(flags, layoutDirection);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
|
|
|
|
if (viewHolder != null) {
|
|
|
|
DialogCell dialogCell = (DialogCell) viewHolder.itemView;
|
|
|
|
long dialogId = dialogCell.getDialogId();
|
|
|
|
if (DialogObject.isFolderDialogId(dialogId)) {
|
2019-12-31 14:08:08 +01:00
|
|
|
listView.toggleArchiveHidden(false, dialogCell);
|
2019-05-14 14:08:05 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
slidingView = dialogCell;
|
|
|
|
int position = viewHolder.getAdapterPosition();
|
|
|
|
int dialogIndex = dialogsAdapter.fixPosition(position);
|
|
|
|
int count = dialogsAdapter.getItemCount();
|
|
|
|
Runnable finishRunnable = () -> {
|
2019-12-31 20:46:59 +01:00
|
|
|
if (frozenDialogsList == null) {
|
|
|
|
return;
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
TLRPC.Dialog dialog = frozenDialogsList.remove(dialogIndex);
|
|
|
|
int pinnedNum = dialog.pinnedNum;
|
|
|
|
slidingView = null;
|
|
|
|
listView.invalidate();
|
|
|
|
int added = getMessagesController().addDialogToFolder(dialog.id, folderId == 0 ? 1 : 0, -1, 0);
|
2019-12-31 14:08:08 +01:00
|
|
|
int lastItemPosition = layoutManager.findLastVisibleItemPosition();
|
|
|
|
if (lastItemPosition == count - 1) {
|
|
|
|
layoutManager.findViewByPosition(lastItemPosition).requestLayout();
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
|
|
|
if (added != 2 || position != 0) {
|
|
|
|
dialogsItemAnimator.prepareForRemove();
|
|
|
|
lastItemsCount--;
|
|
|
|
dialogsAdapter.notifyItemRemoved(position);
|
|
|
|
dialogRemoveFinished = 2;
|
|
|
|
}
|
|
|
|
if (folderId == 0) {
|
|
|
|
if (added == 2) {
|
|
|
|
dialogsItemAnimator.prepareForRemove();
|
|
|
|
if (position == 0) {
|
|
|
|
dialogChangeFinished = 2;
|
|
|
|
setDialogsListFrozen(true);
|
|
|
|
dialogsAdapter.notifyItemChanged(0);
|
|
|
|
} else {
|
|
|
|
lastItemsCount++;
|
|
|
|
dialogsAdapter.notifyItemInserted(0);
|
2019-07-18 15:01:39 +02:00
|
|
|
if (!SharedConfig.archiveHidden && layoutManager.findFirstVisibleItemPosition() == 0) {
|
|
|
|
listView.smoothScrollBy(0, -AndroidUtilities.dp(SharedConfig.useThreeLinesLayout ? 78 : 72));
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
|
|
|
ArrayList<TLRPC.Dialog> dialogs = getDialogsArray(currentAccount, dialogsType, folderId, false);
|
|
|
|
frozenDialogsList.add(0, dialogs.get(0));
|
|
|
|
} else if (added == 1) {
|
|
|
|
RecyclerView.ViewHolder holder = listView.findViewHolderForAdapterPosition(0);
|
|
|
|
if (holder != null && holder.itemView instanceof DialogCell) {
|
|
|
|
DialogCell cell = (DialogCell) holder.itemView;
|
|
|
|
cell.checkCurrentDialogIndex(true);
|
|
|
|
cell.animateArchiveAvatar();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
2019-08-22 01:53:26 +02:00
|
|
|
boolean hintShowed = preferences.getBoolean("archivehint_l", false) || SharedConfig.archiveHidden;
|
|
|
|
if (!hintShowed) {
|
|
|
|
preferences.edit().putBoolean("archivehint_l", true).commit();
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
getUndoView().showWithAction(dialog.id, hintShowed ? UndoView.ACTION_ARCHIVE : UndoView.ACTION_ARCHIVE_HINT, null, () -> {
|
|
|
|
dialogsListFrozen = true;
|
|
|
|
getMessagesController().addDialogToFolder(dialog.id, 0, pinnedNum, 0);
|
|
|
|
dialogsListFrozen = false;
|
|
|
|
ArrayList<TLRPC.Dialog> dialogs = getMessagesController().getDialogs(0);
|
|
|
|
int index = dialogs.indexOf(dialog);
|
|
|
|
if (index >= 0) {
|
|
|
|
ArrayList<TLRPC.Dialog> archivedDialogs = getMessagesController().getDialogs(1);
|
|
|
|
if (!archivedDialogs.isEmpty() || index != 1) {
|
|
|
|
dialogInsertFinished = 2;
|
|
|
|
setDialogsListFrozen(true);
|
|
|
|
dialogsItemAnimator.prepareForRemove();
|
|
|
|
lastItemsCount++;
|
|
|
|
dialogsAdapter.notifyItemInserted(index);
|
|
|
|
}
|
|
|
|
if (archivedDialogs.isEmpty()) {
|
|
|
|
dialogs.remove(0);
|
|
|
|
if (index == 1) {
|
|
|
|
dialogChangeFinished = 2;
|
|
|
|
setDialogsListFrozen(true);
|
|
|
|
dialogsAdapter.notifyItemChanged(0);
|
|
|
|
} else {
|
|
|
|
frozenDialogsList.remove(0);
|
|
|
|
dialogsItemAnimator.prepareForRemove();
|
|
|
|
lastItemsCount--;
|
|
|
|
dialogsAdapter.notifyItemRemoved(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
dialogsAdapter.notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (folderId != 0 && frozenDialogsList.isEmpty()) {
|
|
|
|
listView.setEmptyView(null);
|
|
|
|
progressView.setVisibility(View.INVISIBLE);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
setDialogsListFrozen(true);
|
|
|
|
if (Utilities.random.nextInt(1000) == 1) {
|
|
|
|
if (pacmanAnimation == null) {
|
|
|
|
pacmanAnimation = new PacmanAnimation(listView);
|
|
|
|
}
|
|
|
|
pacmanAnimation.setFinishRunnable(finishRunnable);
|
|
|
|
pacmanAnimation.start();
|
|
|
|
} else {
|
|
|
|
finishRunnable.run();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
slidingView = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
|
|
|
|
if (viewHolder != null) {
|
2019-12-31 14:08:08 +01:00
|
|
|
listView.hideSelector(false);
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
|
|
|
super.onSelectedChanged(viewHolder, actionState);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public long getAnimationDuration(RecyclerView recyclerView, int animationType, float animateDx, float animateDy) {
|
|
|
|
if (animationType == ItemTouchHelper.ANIMATION_TYPE_SWIPE_CANCEL) {
|
|
|
|
return 200;
|
|
|
|
} else if (animationType == ItemTouchHelper.ANIMATION_TYPE_DRAG) {
|
|
|
|
if (movingView != null) {
|
|
|
|
View view = movingView;
|
|
|
|
AndroidUtilities.runOnUIThread(() -> view.setBackgroundDrawable(null), dialogsItemAnimator.getMoveDuration());
|
|
|
|
movingView = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return super.getAnimationDuration(recyclerView, animationType, animateDx, animateDy);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public float getSwipeThreshold(RecyclerView.ViewHolder viewHolder) {
|
|
|
|
return 0.3f;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public float getSwipeEscapeVelocity(float defaultValue) {
|
|
|
|
return 3500;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public float getSwipeVelocityThreshold(float defaultValue) {
|
|
|
|
return Float.MAX_VALUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-22 15:49:00 +02:00
|
|
|
public interface DialogsActivityDelegate {
|
2017-12-08 18:35:59 +01:00
|
|
|
void didSelectDialogs(DialogsActivity fragment, ArrayList<Long> dids, CharSequence message, boolean param);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
2015-07-22 20:56:37 +02:00
|
|
|
public DialogsActivity(Bundle args) {
|
2014-06-04 01:31:48 +02:00
|
|
|
super(args);
|
|
|
|
}
|
|
|
|
|
2019-06-11 10:40:16 +02:00
|
|
|
public void updateDialogsType(int type) {
|
2020-01-14 15:13:18 +01:00
|
|
|
int dialogsTypeOld = dialogsType;
|
2019-06-11 10:40:16 +02:00
|
|
|
dialogsType = type;
|
|
|
|
if (dialogsAdapter != null) {
|
|
|
|
dialogsAdapter.setDialogsType(type);
|
|
|
|
dialogsAdapter.notifyDataSetChanged();
|
|
|
|
}
|
2020-01-14 15:13:18 +01:00
|
|
|
hideFloatingButton(false);
|
|
|
|
if (dialogsTypeOld == dialogsType) {
|
|
|
|
scrollToTop();
|
2020-01-01 17:19:10 +01:00
|
|
|
} else {
|
2020-01-14 15:13:18 +01:00
|
|
|
if (archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN && hasHiddenArchive()) {
|
|
|
|
layoutManager.scrollToPositionWithOffset(1, 0);
|
|
|
|
} else {
|
|
|
|
layoutManager.scrollToPositionWithOffset(0, 0);
|
|
|
|
}
|
2020-01-01 17:19:10 +01:00
|
|
|
}
|
2019-06-16 17:06:55 +02:00
|
|
|
actionBar.setTitle(getNekoTitle());
|
2019-06-11 10:40:16 +02:00
|
|
|
}
|
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
@Override
|
|
|
|
public boolean onFragmentCreate() {
|
|
|
|
super.onFragmentCreate();
|
2015-02-01 19:51:02 +01:00
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
if (getArguments() != null) {
|
2014-06-04 01:31:48 +02:00
|
|
|
onlySelect = arguments.getBoolean("onlySelect", false);
|
2016-10-11 13:57:01 +02:00
|
|
|
cantSendToChannels = arguments.getBoolean("cantSendToChannels", false);
|
2015-06-29 19:12:11 +02:00
|
|
|
dialogsType = arguments.getInt("dialogsType", 0);
|
2014-06-04 01:31:48 +02:00
|
|
|
selectAlertString = arguments.getString("selectAlertString");
|
2014-10-04 17:56:09 +02:00
|
|
|
selectAlertStringGroup = arguments.getString("selectAlertStringGroup");
|
2015-06-29 19:12:11 +02:00
|
|
|
addToGroupAlertString = arguments.getString("addToGroupAlertString");
|
2018-07-30 04:07:02 +02:00
|
|
|
allowSwitchAccount = arguments.getBoolean("allowSwitchAccount");
|
2019-03-03 21:40:48 +01:00
|
|
|
checkCanWrite = arguments.getBoolean("checkCanWrite", true);
|
2019-12-31 14:08:08 +01:00
|
|
|
afterSignup = arguments.getBoolean("afterSignup", false);
|
2019-05-14 14:08:05 +02:00
|
|
|
folderId = arguments.getInt("folderId", 0);
|
2019-07-18 15:01:39 +02:00
|
|
|
resetDelegate = arguments.getBoolean("resetDelegate", true);
|
2019-08-22 01:53:26 +02:00
|
|
|
messagesCount = arguments.getInt("messagesCount", 0);
|
2020-01-23 07:15:40 +01:00
|
|
|
hasPoll = arguments.getInt("hasPoll", 0);
|
2018-07-30 04:07:02 +02:00
|
|
|
}
|
|
|
|
|
2019-10-30 07:29:52 +01:00
|
|
|
if (FilterPopup.DialogType.isDialogsType(dialogsType)) {
|
2018-07-30 04:07:02 +02:00
|
|
|
askAboutContacts = MessagesController.getGlobalNotificationsSettings().getBoolean("askAboutContacts", true);
|
|
|
|
SharedConfig.loadProxyList();
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2015-03-19 00:09:45 +01:00
|
|
|
|
|
|
|
if (searchString == null) {
|
2019-05-14 14:08:05 +02:00
|
|
|
currentConnectionState = getConnectionsManager().getConnectionState();
|
2018-07-30 04:07:02 +02:00
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.dialogsNeedReload);
|
2019-01-23 18:03:33 +01:00
|
|
|
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiDidLoad);
|
2018-07-30 04:07:02 +02:00
|
|
|
if (!onlySelect) {
|
|
|
|
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.closeSearchByActiveAction);
|
|
|
|
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.proxySettingsChanged);
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.updateInterfaces);
|
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.encryptedChatUpdated);
|
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.contactsDidLoad);
|
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.appDidLogout);
|
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.openedChatChanged);
|
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.notificationsSettingsUpdated);
|
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.messageReceivedByAck);
|
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.messageReceivedByServer);
|
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.messageSendError);
|
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.needReloadRecentDialogsSearch);
|
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.replyMessagesDidLoad);
|
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.reloadHints);
|
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.didUpdateConnectionState);
|
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.dialogsUnreadCounterChanged);
|
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.needDeleteDialog);
|
|
|
|
getNotificationCenter().addObserver(this, NotificationCenter.folderBecomeEmpty);
|
2018-07-30 04:07:02 +02:00
|
|
|
|
|
|
|
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetPasscode);
|
2015-03-19 00:09:45 +01:00
|
|
|
}
|
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
if (!dialogsLoaded[currentAccount]) {
|
2019-05-14 14:08:05 +02:00
|
|
|
getMessagesController().loadGlobalNotificationsSettings();
|
|
|
|
getMessagesController().loadDialogs(folderId, 0, 100, true);
|
|
|
|
getMessagesController().loadHintDialogs();
|
2019-12-31 14:08:08 +01:00
|
|
|
getMessagesController().loadUserInfo(UserConfig.getInstance(currentAccount).getCurrentUser(), false, classGuid);
|
2019-05-14 14:08:05 +02:00
|
|
|
getContactsController().checkInviteText();
|
2019-07-18 15:01:39 +02:00
|
|
|
getMediaDataController().loadRecents(MediaDataController.TYPE_FAVE, false, true, false);
|
|
|
|
getMediaDataController().checkFeaturedStickers();
|
2018-07-30 04:07:02 +02:00
|
|
|
dialogsLoaded[currentAccount] = true;
|
2013-12-20 20:25:49 +01:00
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
getMessagesController().loadPinnedDialogs(folderId, 0, null);
|
2013-10-25 17:19:00 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFragmentDestroy() {
|
|
|
|
super.onFragmentDestroy();
|
2015-03-19 00:09:45 +01:00
|
|
|
if (searchString == null) {
|
2019-05-14 14:08:05 +02:00
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.dialogsNeedReload);
|
2019-01-23 18:03:33 +01:00
|
|
|
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiDidLoad);
|
2018-07-30 04:07:02 +02:00
|
|
|
if (!onlySelect) {
|
|
|
|
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.closeSearchByActiveAction);
|
|
|
|
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.proxySettingsChanged);
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.updateInterfaces);
|
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.encryptedChatUpdated);
|
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.contactsDidLoad);
|
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.appDidLogout);
|
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.openedChatChanged);
|
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.notificationsSettingsUpdated);
|
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.messageReceivedByAck);
|
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.messageReceivedByServer);
|
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.messageSendError);
|
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.needReloadRecentDialogsSearch);
|
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.replyMessagesDidLoad);
|
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.reloadHints);
|
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.didUpdateConnectionState);
|
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.dialogsUnreadCounterChanged);
|
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.needDeleteDialog);
|
|
|
|
getNotificationCenter().removeObserver(this, NotificationCenter.folderBecomeEmpty);
|
2018-07-30 04:07:02 +02:00
|
|
|
|
|
|
|
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didSetPasscode);
|
2015-03-19 00:09:45 +01:00
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
if (commentView != null) {
|
|
|
|
commentView.onDestroy();
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
if (undoView[0] != null) {
|
|
|
|
undoView[0].hide(true, 0);
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
delegate = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-07-22 20:56:37 +02:00
|
|
|
public View createView(final Context context) {
|
2015-04-09 20:00:14 +02:00
|
|
|
searching = false;
|
|
|
|
searchWas = false;
|
2019-05-14 14:08:05 +02:00
|
|
|
pacmanAnimation = null;
|
2015-04-09 20:00:14 +02:00
|
|
|
|
2018-08-27 10:33:11 +02:00
|
|
|
AndroidUtilities.runOnUIThread(() -> Theme.createChatResources(context, false));
|
2015-05-03 13:48:36 +02:00
|
|
|
|
2015-04-09 20:00:14 +02:00
|
|
|
ActionBarMenu menu = actionBar.createMenu();
|
2019-05-14 14:08:05 +02:00
|
|
|
if (!onlySelect && searchString == null && folderId == 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
proxyDrawable = new ProxyDrawable(context);
|
|
|
|
proxyItem = menu.addItem(2, proxyDrawable);
|
2019-05-14 14:08:05 +02:00
|
|
|
proxyItem.setContentDescription(LocaleController.getString("ProxySettings", R.string.ProxySettings));
|
2015-05-21 23:27:27 +02:00
|
|
|
passcodeItem = menu.addItem(1, R.drawable.lock_close);
|
2015-04-09 20:00:14 +02:00
|
|
|
updatePasscodeButton();
|
2018-07-30 04:07:02 +02:00
|
|
|
updateProxyButton(false);
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
2015-11-26 22:04:02 +01:00
|
|
|
final ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
|
2015-04-09 20:00:14 +02:00
|
|
|
@Override
|
|
|
|
public void onSearchExpand() {
|
|
|
|
searching = true;
|
2018-07-30 04:07:02 +02:00
|
|
|
if (switchItem != null) {
|
|
|
|
switchItem.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
if (proxyItem != null && proxyItemVisisble) {
|
|
|
|
proxyItem.setVisibility(View.GONE);
|
|
|
|
}
|
2015-05-21 23:27:27 +02:00
|
|
|
if (listView != null) {
|
2015-03-19 00:09:45 +01:00
|
|
|
if (searchString != null) {
|
2019-12-31 14:08:08 +01:00
|
|
|
listView.hide();
|
|
|
|
searchListView.show();
|
2014-06-04 01:31:48 +02:00
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
if (!onlySelect) {
|
2019-01-23 18:03:33 +01:00
|
|
|
floatingButtonContainer.setVisibility(View.GONE);
|
|
|
|
//unreadFloatingButtonContainer.setVisibility(View.GONE);
|
2014-06-04 01:31:48 +02:00
|
|
|
}
|
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
updatePasscodeButton();
|
2019-05-14 14:08:05 +02:00
|
|
|
actionBar.setBackButtonContentDescription(LocaleController.getString("AccDescrGoBack", R.string.AccDescrGoBack));
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
2014-06-04 01:31:48 +02:00
|
|
|
|
2015-04-09 20:00:14 +02:00
|
|
|
@Override
|
2015-06-29 19:12:11 +02:00
|
|
|
public boolean canCollapseSearch() {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (switchItem != null) {
|
|
|
|
switchItem.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
if (proxyItem != null && proxyItemVisisble) {
|
|
|
|
proxyItem.setVisibility(View.VISIBLE);
|
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
if (searchString != null) {
|
|
|
|
finishFragment();
|
|
|
|
return false;
|
|
|
|
}
|
2015-06-29 19:12:11 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSearchCollapse() {
|
2015-04-09 20:00:14 +02:00
|
|
|
searching = false;
|
|
|
|
searchWas = false;
|
2015-05-21 23:27:27 +02:00
|
|
|
if (listView != null) {
|
2019-05-14 14:08:05 +02:00
|
|
|
listView.setEmptyView(folderId == 0 ? progressView : null);
|
2015-04-09 20:00:14 +02:00
|
|
|
if (!onlySelect) {
|
2019-01-23 18:03:33 +01:00
|
|
|
floatingButtonContainer.setVisibility(View.VISIBLE);
|
|
|
|
/*if (currentUnreadCount != 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
unreadFloatingButtonContainer.setVisibility(View.VISIBLE);
|
|
|
|
unreadFloatingButtonContainer.setTranslationY(AndroidUtilities.dp(74));
|
2019-01-23 18:03:33 +01:00
|
|
|
}*/
|
2015-04-09 20:00:14 +02:00
|
|
|
floatingHidden = true;
|
2019-12-31 14:08:08 +01:00
|
|
|
floatingButtonTranslation = AndroidUtilities.dp(100);
|
|
|
|
floatingButtonHideProgress = 1f;
|
|
|
|
updateFloatingButtonOffset();
|
2014-06-04 01:31:48 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
showSearch(false, true);
|
2015-03-19 00:09:45 +01:00
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
updatePasscodeButton();
|
2019-05-14 14:08:05 +02:00
|
|
|
if (menuDrawable != null) {
|
|
|
|
actionBar.setBackButtonContentDescription(LocaleController.getString("AccDescrOpenMenu", R.string.AccDescrOpenMenu));
|
|
|
|
}
|
2014-06-04 01:31:48 +02:00
|
|
|
}
|
|
|
|
|
2015-04-09 20:00:14 +02:00
|
|
|
@Override
|
|
|
|
public void onTextChanged(EditText editText) {
|
|
|
|
String text = editText.getText().toString();
|
2015-08-13 11:23:31 +02:00
|
|
|
if (text.length() != 0 || dialogsSearchAdapter != null && dialogsSearchAdapter.hasRecentRearch()) {
|
2015-04-09 20:00:14 +02:00
|
|
|
searchWas = true;
|
2019-12-31 14:08:08 +01:00
|
|
|
if (listView.getVisibility() == View.VISIBLE) {
|
|
|
|
showSearch(true, true);
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
2014-06-04 01:31:48 +02:00
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
if (dialogsSearchAdapter != null) {
|
2019-12-31 14:08:08 +01:00
|
|
|
lastSearchScrolledToTop = false;
|
2015-08-13 11:23:31 +02:00
|
|
|
dialogsSearchAdapter.searchDialogs(text);
|
2015-03-19 00:09:45 +01:00
|
|
|
}
|
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
});
|
2019-12-31 14:08:08 +01:00
|
|
|
item.setClearsTextOnSearchCollapse(false);
|
2019-01-23 18:03:33 +01:00
|
|
|
item.setSearchFieldHint(LocaleController.getString("Search", R.string.Search));
|
2019-05-14 14:08:05 +02:00
|
|
|
item.setContentDescription(LocaleController.getString("Search", R.string.Search));
|
2015-04-09 20:00:14 +02:00
|
|
|
if (onlySelect) {
|
|
|
|
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
2017-12-08 18:35:59 +01:00
|
|
|
if (dialogsType == 3 && selectAlertString == null) {
|
|
|
|
actionBar.setTitle(LocaleController.getString("ForwardTo", R.string.ForwardTo));
|
|
|
|
} else {
|
|
|
|
actionBar.setTitle(LocaleController.getString("SelectChat", R.string.SelectChat));
|
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
} else {
|
2019-05-14 14:08:05 +02:00
|
|
|
if (searchString != null || folderId != 0) {
|
|
|
|
actionBar.setBackButtonDrawable(backDrawable = new BackDrawable(false));
|
2015-04-09 20:00:14 +02:00
|
|
|
} else {
|
2019-05-14 14:08:05 +02:00
|
|
|
actionBar.setBackButtonDrawable(menuDrawable = new MenuDrawable());
|
|
|
|
actionBar.setBackButtonContentDescription(LocaleController.getString("AccDescrOpenMenu", R.string.AccDescrOpenMenu));
|
2014-11-19 11:32:27 +01:00
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
if (folderId != 0) {
|
2019-12-30 12:51:47 +01:00
|
|
|
actionBar.setTitle(getNekoTitle());
|
2016-03-06 02:49:31 +01:00
|
|
|
} else {
|
2019-05-14 14:08:05 +02:00
|
|
|
if (BuildVars.DEBUG_VERSION) {
|
2019-12-31 14:08:08 +01:00
|
|
|
actionBar.setTitle("Telegram Beta");
|
2019-05-14 14:08:05 +02:00
|
|
|
} else {
|
2019-06-16 17:06:55 +02:00
|
|
|
actionBar.setTitle(getNekoTitle());
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
2016-03-06 02:49:31 +01:00
|
|
|
}
|
2019-12-31 20:46:59 +01:00
|
|
|
if (folderId == 0) {
|
|
|
|
actionBar.setSupportsHolidayImage(true);
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
}
|
2019-06-11 10:40:16 +02:00
|
|
|
actionBar.setOnTouchListener((v, event) -> {
|
|
|
|
int x = (int) event.getX();
|
|
|
|
int y = (int) event.getY();
|
2020-02-21 04:11:15 +01:00
|
|
|
if (event.getAction() == MotionEvent.ACTION_DOWN && NekoConfig.openFilterByActionBar) {
|
|
|
|
FilterPopup.getInstance(currentAccount).createMenu(this, x, y, folderId, false);
|
2019-06-11 10:40:16 +02:00
|
|
|
}
|
2020-02-21 04:11:15 +01:00
|
|
|
return NekoConfig.openFilterByActionBar;
|
2019-06-11 10:40:16 +02:00
|
|
|
});
|
2018-08-27 10:33:11 +02:00
|
|
|
actionBar.setTitleActionRunnable(() -> {
|
|
|
|
hideFloatingButton(false);
|
2019-12-31 14:08:08 +01:00
|
|
|
scrollToTop();
|
2018-07-30 04:07:02 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
if (allowSwitchAccount && UserConfig.getActivatedAccountsCount() > 1) {
|
|
|
|
switchItem = menu.addItemWithWidth(1, 0, AndroidUtilities.dp(56));
|
|
|
|
AvatarDrawable avatarDrawable = new AvatarDrawable();
|
|
|
|
avatarDrawable.setTextSize(AndroidUtilities.dp(12));
|
|
|
|
|
|
|
|
BackupImageView imageView = new BackupImageView(context);
|
|
|
|
imageView.setRoundRadius(AndroidUtilities.dp(18));
|
|
|
|
switchItem.addView(imageView, LayoutHelper.createFrame(36, 36, Gravity.CENTER));
|
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
TLRPC.User user = getUserConfig().getCurrentUser();
|
2018-07-30 04:07:02 +02:00
|
|
|
avatarDrawable.setInfo(user);
|
|
|
|
imageView.getImageReceiver().setCurrentAccount(currentAccount);
|
2019-05-14 14:08:05 +02:00
|
|
|
imageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable, user);
|
2018-07-30 04:07:02 +02:00
|
|
|
|
|
|
|
for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
|
2019-05-14 14:08:05 +02:00
|
|
|
TLRPC.User u = AccountInstance.getInstance(a).getUserConfig().getCurrentUser();
|
2018-07-30 04:07:02 +02:00
|
|
|
if (u != null) {
|
|
|
|
AccountSelectCell cell = new AccountSelectCell(context);
|
|
|
|
cell.setAccount(a, true);
|
|
|
|
switchItem.addSubItem(10 + a, cell, AndroidUtilities.dp(230), AndroidUtilities.dp(48));
|
|
|
|
}
|
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
|
|
|
actionBar.setAllowOverlayTitle(true);
|
|
|
|
|
|
|
|
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
|
|
|
@Override
|
|
|
|
public void onItemClick(int id) {
|
|
|
|
if (id == -1) {
|
2019-05-14 14:08:05 +02:00
|
|
|
if (actionBar.isActionModeShowed()) {
|
|
|
|
hideActionMode(true);
|
|
|
|
} else if (onlySelect || folderId != 0) {
|
2015-04-09 20:00:14 +02:00
|
|
|
finishFragment();
|
|
|
|
} else if (parentLayout != null) {
|
|
|
|
parentLayout.getDrawerLayoutContainer().openDrawer(false);
|
2014-10-31 20:02:29 +01:00
|
|
|
}
|
2015-05-21 23:27:27 +02:00
|
|
|
} else if (id == 1) {
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedConfig.appLocked = !SharedConfig.appLocked;
|
|
|
|
SharedConfig.saveConfig();
|
2015-04-09 20:00:14 +02:00
|
|
|
updatePasscodeButton();
|
2018-07-30 04:07:02 +02:00
|
|
|
} else if (id == 2) {
|
|
|
|
presentFragment(new ProxyListActivity());
|
|
|
|
} else if (id >= 10 && id < 10 + UserConfig.MAX_ACCOUNT_COUNT) {
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
DialogsActivityDelegate oldDelegate = delegate;
|
|
|
|
LaunchActivity launchActivity = (LaunchActivity) getParentActivity();
|
|
|
|
launchActivity.switchToAccount(id - 10, true);
|
|
|
|
|
|
|
|
DialogsActivity dialogsActivity = new DialogsActivity(arguments);
|
|
|
|
dialogsActivity.setDelegate(oldDelegate);
|
|
|
|
launchActivity.presentFragment(dialogsActivity, false, true);
|
2020-02-13 19:26:53 +01:00
|
|
|
} else if (id == pin || id == read || id == delete || id == clear || id == mute || id == archive || id == block) {
|
2019-05-14 14:08:05 +02:00
|
|
|
perfromSelectedDialogsAction(id, true);
|
2014-10-31 20:02:29 +01:00
|
|
|
}
|
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
});
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2017-03-31 01:58:05 +02:00
|
|
|
if (sideMenu != null) {
|
|
|
|
sideMenu.setBackgroundColor(Theme.getColor(Theme.key_chats_menuBackground));
|
|
|
|
sideMenu.setGlowColor(Theme.getColor(Theme.key_chats_menuBackground));
|
|
|
|
sideMenu.getAdapter().notifyDataSetChanged();
|
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
final ActionBarMenu actionMode = actionBar.createActionMode();
|
|
|
|
|
|
|
|
selectedDialogsCountTextView = new NumberTextView(actionMode.getContext());
|
|
|
|
selectedDialogsCountTextView.setTextSize(18);
|
|
|
|
selectedDialogsCountTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
|
|
|
selectedDialogsCountTextView.setTextColor(Theme.getColor(Theme.key_actionBarActionModeDefaultIcon));
|
|
|
|
actionMode.addView(selectedDialogsCountTextView, LayoutHelper.createLinear(0, LayoutHelper.MATCH_PARENT, 1.0f, 72, 0, 0, 0));
|
|
|
|
selectedDialogsCountTextView.setOnTouchListener((v, event) -> true);
|
|
|
|
|
|
|
|
pinItem = actionMode.addItemWithWidth(pin, R.drawable.msg_pin, AndroidUtilities.dp(54));
|
2019-09-10 12:56:11 +02:00
|
|
|
muteItem = actionMode.addItemWithWidth(mute, R.drawable.msg_archive, AndroidUtilities.dp(54));
|
2019-05-14 14:08:05 +02:00
|
|
|
deleteItem = actionMode.addItemWithWidth(delete, R.drawable.msg_delete, AndroidUtilities.dp(54), LocaleController.getString("Delete", R.string.Delete));
|
|
|
|
ActionBarMenuItem otherItem = actionMode.addItemWithWidth(0, R.drawable.ic_ab_other, AndroidUtilities.dp(54), LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
|
2019-09-10 12:56:11 +02:00
|
|
|
archiveItem = otherItem.addSubItem(archive, R.drawable.msg_archive, LocaleController.getString("Archive", R.string.Archive));
|
2019-05-14 14:08:05 +02:00
|
|
|
readItem = otherItem.addSubItem(read, R.drawable.msg_markread, LocaleController.getString("MarkAsRead", R.string.MarkAsRead));
|
|
|
|
clearItem = otherItem.addSubItem(clear, R.drawable.msg_clear, LocaleController.getString("ClearHistory", R.string.ClearHistory));
|
2020-02-13 19:26:53 +01:00
|
|
|
blockItem = otherItem.addSubItem(block, R.drawable.msg_block, LocaleController.getString("BlockUser", R.string.BlockUser));
|
2019-05-14 14:08:05 +02:00
|
|
|
|
|
|
|
actionModeViews.add(pinItem);
|
2019-09-10 12:56:11 +02:00
|
|
|
actionModeViews.add(muteItem);
|
2019-05-14 14:08:05 +02:00
|
|
|
actionModeViews.add(deleteItem);
|
|
|
|
actionModeViews.add(otherItem);
|
|
|
|
|
|
|
|
ContentView contentView = new ContentView(context);
|
|
|
|
fragmentView = contentView;
|
2017-12-08 18:35:59 +01:00
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
listView = new DialogsRecyclerView(context);
|
|
|
|
listView.setPivotY(0);
|
|
|
|
dialogsItemAnimator = new DialogsItemAnimator() {
|
2019-05-14 14:08:05 +02:00
|
|
|
@Override
|
2019-12-31 14:08:08 +01:00
|
|
|
public void onRemoveStarting(RecyclerView.ViewHolder item) {
|
|
|
|
super.onRemoveStarting(item);
|
|
|
|
if (layoutManager.findFirstVisibleItemPosition() == 0) {
|
|
|
|
View v = layoutManager.findViewByPosition(0);
|
|
|
|
if (v != null) {
|
|
|
|
v.invalidate();
|
2017-12-08 18:35:59 +01:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
if (archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN) {
|
|
|
|
archivePullViewState = ARCHIVE_ITEM_STATE_SHOWED;
|
2019-06-04 12:14:50 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
if (pullForegroundDrawable != null) {
|
|
|
|
pullForegroundDrawable.doNotShow();
|
2017-12-08 18:35:59 +01:00
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
@Override
|
|
|
|
public void onRemoveFinished(RecyclerView.ViewHolder item) {
|
|
|
|
if (dialogRemoveFinished == 2) {
|
|
|
|
dialogRemoveFinished = 1;
|
|
|
|
}
|
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
@Override
|
|
|
|
public void onAddFinished(RecyclerView.ViewHolder item) {
|
|
|
|
if (dialogInsertFinished == 2) {
|
|
|
|
dialogInsertFinished = 1;
|
|
|
|
}
|
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
@Override
|
|
|
|
public void onChangeFinished(RecyclerView.ViewHolder item, boolean oldItem) {
|
|
|
|
if (dialogChangeFinished == 2) {
|
|
|
|
dialogChangeFinished = 1;
|
2017-12-08 18:35:59 +01:00
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
@Override
|
|
|
|
protected void onAllAnimationsDone() {
|
|
|
|
if (dialogRemoveFinished == 1 || dialogInsertFinished == 1 || dialogChangeFinished == 1) {
|
|
|
|
onDialogAnimationFinished();
|
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
}
|
|
|
|
};
|
2019-05-14 14:08:05 +02:00
|
|
|
listView.setItemAnimator(dialogsItemAnimator);
|
2015-05-21 23:27:27 +02:00
|
|
|
listView.setVerticalScrollBarEnabled(true);
|
|
|
|
listView.setInstantClick(true);
|
|
|
|
layoutManager = new LinearLayoutManager(context) {
|
2019-12-31 14:08:08 +01:00
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
@Override
|
|
|
|
public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int position) {
|
2019-05-14 14:08:05 +02:00
|
|
|
if (hasHiddenArchive() && position == 1) {
|
|
|
|
super.smoothScrollToPosition(recyclerView, state, position);
|
|
|
|
} else {
|
2020-02-13 19:26:53 +01:00
|
|
|
LinearSmoothScrollerCustom linearSmoothScroller = new LinearSmoothScrollerCustom(recyclerView.getContext(), LinearSmoothScrollerCustom.POSITION_MIDDLE);
|
2019-05-14 14:08:05 +02:00
|
|
|
linearSmoothScroller.setTargetPosition(position);
|
|
|
|
startSmoothScroll(linearSmoothScroller);
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
}
|
2019-06-04 12:14:50 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) {
|
2019-12-31 14:08:08 +01:00
|
|
|
boolean isDragging = listView.getScrollState() == RecyclerView.SCROLL_STATE_DRAGGING;
|
|
|
|
|
|
|
|
int measuredDy = dy;
|
2020-01-01 13:10:52 +01:00
|
|
|
if (dy < 0 && hasHiddenArchive() && archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN) {
|
2019-12-31 14:08:08 +01:00
|
|
|
listView.setOverScrollMode(View.OVER_SCROLL_ALWAYS);
|
2019-06-04 12:14:50 +02:00
|
|
|
int currentPosition = layoutManager.findFirstVisibleItemPosition();
|
|
|
|
if (currentPosition == 0) {
|
|
|
|
View view = layoutManager.findViewByPosition(currentPosition);
|
|
|
|
if (view != null && view.getBottom() <= AndroidUtilities.dp(1)) {
|
|
|
|
currentPosition = 1;
|
|
|
|
}
|
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
if (!isDragging) {
|
2019-06-04 12:14:50 +02:00
|
|
|
View view = layoutManager.findViewByPosition(currentPosition);
|
2019-12-31 14:08:08 +01:00
|
|
|
int dialogHeight = AndroidUtilities.dp(SharedConfig.useThreeLinesLayout ? 78 : 72) + 1;
|
|
|
|
int canScrollDy = -view.getTop() + (currentPosition - 1) * dialogHeight;
|
|
|
|
int positiveDy = Math.abs(dy);
|
|
|
|
if (canScrollDy < positiveDy) {
|
|
|
|
measuredDy = -canScrollDy;
|
|
|
|
}
|
|
|
|
} else if (currentPosition == 0) {
|
|
|
|
View v = layoutManager.findViewByPosition(currentPosition);
|
|
|
|
float k = 1f + (v.getTop() / (float) v.getMeasuredHeight());
|
|
|
|
if (k > 1f) {
|
|
|
|
k = 1f;
|
|
|
|
}
|
|
|
|
listView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
|
|
|
measuredDy *= PullForegroundDrawable.startPullParallax - PullForegroundDrawable.endPullParallax * k;
|
|
|
|
if (measuredDy > -1) {
|
|
|
|
measuredDy = -1;
|
|
|
|
}
|
|
|
|
if (undoView[0].getVisibility() == View.VISIBLE) {
|
|
|
|
undoView[0].hide(true, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-06-04 12:14:50 +02:00
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
if (listView.getViewOffset() != 0 && dy > 0 && isDragging) {
|
|
|
|
float ty = (int) listView.getViewOffset();
|
|
|
|
ty -= dy;
|
|
|
|
if (ty < 0) {
|
|
|
|
measuredDy = (int) ty;
|
|
|
|
ty = 0;
|
|
|
|
} else {
|
|
|
|
measuredDy = 0;
|
|
|
|
}
|
|
|
|
listView.setViewsOffset(ty);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (archivePullViewState != ARCHIVE_ITEM_STATE_PINNED && hasHiddenArchive()) {
|
|
|
|
int usedDy = super.scrollVerticallyBy(measuredDy, recycler, state);
|
|
|
|
if (pullForegroundDrawable != null) {
|
|
|
|
pullForegroundDrawable.scrollDy = usedDy;
|
|
|
|
}
|
|
|
|
int currentPosition = layoutManager.findFirstVisibleItemPosition();
|
|
|
|
View firstView = null;
|
|
|
|
if (currentPosition == 0) {
|
|
|
|
firstView = layoutManager.findViewByPosition(currentPosition);
|
|
|
|
}
|
|
|
|
if (currentPosition == 0 && firstView != null && firstView.getBottom() >= AndroidUtilities.dp(4)) {
|
|
|
|
if (startArchivePullingTime == 0) {
|
|
|
|
startArchivePullingTime = System.currentTimeMillis();
|
|
|
|
}
|
|
|
|
if (archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN) {
|
|
|
|
if (pullForegroundDrawable != null) {
|
|
|
|
pullForegroundDrawable.showHidden();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
float k = 1f + (firstView.getTop() / (float) firstView.getMeasuredHeight());
|
|
|
|
if (k > 1f) {
|
|
|
|
k = 1f;
|
|
|
|
}
|
|
|
|
long pullingTime = System.currentTimeMillis() - startArchivePullingTime;
|
|
|
|
boolean canShowInternal = k > PullForegroundDrawable.SNAP_HEIGHT && pullingTime > PullForegroundDrawable.minPullingTime + 20;
|
|
|
|
if (canShowHiddenArchive != canShowInternal) {
|
|
|
|
canShowHiddenArchive = canShowInternal;
|
|
|
|
if (archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN) {
|
|
|
|
listView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
|
|
|
if (pullForegroundDrawable != null) {
|
|
|
|
pullForegroundDrawable.colorize(canShowInternal);
|
2019-06-04 12:14:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
if (archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN && measuredDy - usedDy != 0 && dy < 0 && isDragging) {
|
|
|
|
float ty;
|
|
|
|
float tk = (listView.getViewOffset() / PullForegroundDrawable.getMaxOverscroll());
|
|
|
|
tk = 1f - tk;
|
|
|
|
ty = (listView.getViewOffset() - dy * PullForegroundDrawable.startPullOverScroll * tk);
|
|
|
|
listView.setViewsOffset(ty);
|
|
|
|
}
|
|
|
|
if (pullForegroundDrawable != null) {
|
|
|
|
pullForegroundDrawable.pullProgress = k;
|
|
|
|
pullForegroundDrawable.setListView(listView);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
startArchivePullingTime = 0;
|
|
|
|
canShowHiddenArchive = false;
|
|
|
|
archivePullViewState = ARCHIVE_ITEM_STATE_HIDDEN;
|
|
|
|
if (pullForegroundDrawable != null) {
|
|
|
|
pullForegroundDrawable.resetText();
|
|
|
|
pullForegroundDrawable.pullProgress = 0f;
|
|
|
|
pullForegroundDrawable.setListView(listView);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (firstView != null) {
|
|
|
|
firstView.invalidate();
|
2019-06-04 12:14:50 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
return usedDy;
|
2019-06-04 12:14:50 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
return super.scrollVerticallyBy(measuredDy, recycler, state);
|
2019-06-04 12:14:50 +02:00
|
|
|
}
|
2015-05-21 23:27:27 +02:00
|
|
|
};
|
|
|
|
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
|
|
|
listView.setLayoutManager(layoutManager);
|
2017-03-31 01:58:05 +02:00
|
|
|
listView.setVerticalScrollbarPosition(LocaleController.isRTL ? RecyclerListView.SCROLLBAR_POSITION_LEFT : RecyclerListView.SCROLLBAR_POSITION_RIGHT);
|
2017-12-08 18:35:59 +01:00
|
|
|
contentView.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
2019-12-31 14:08:08 +01:00
|
|
|
listView.setOnItemClickListener((view, position) -> onItemClick(view, position, dialogsAdapter));
|
|
|
|
listView.setOnItemLongClickListener(new RecyclerListView.OnItemLongClickListenerExtended() {
|
|
|
|
@Override
|
|
|
|
public boolean onItemClick(View view, int position, float x, float y) {
|
|
|
|
return onItemLongClick(view, position, x, y, dialogsAdapter);
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
@Override
|
|
|
|
public void onLongClickRelease() {
|
|
|
|
finishPreviewFragment();
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
@Override
|
|
|
|
public void onMove(float dx, float dy) {
|
|
|
|
movePreviewFragment(dy);
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
});
|
|
|
|
swipeController = new SwipeController();
|
2018-08-27 10:33:11 +02:00
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
progressView = new RadialProgressView(context);
|
|
|
|
progressView.setPivotY(0);
|
|
|
|
progressView.setVisibility(View.GONE);
|
|
|
|
contentView.addView(progressView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER));
|
|
|
|
|
|
|
|
itemTouchhelper = new ItemTouchHelper(swipeController);
|
|
|
|
itemTouchhelper.attachToRecyclerView(listView);
|
|
|
|
|
|
|
|
int type = 0;
|
|
|
|
if (searchString != null) {
|
|
|
|
type = 2;
|
|
|
|
} else if (!onlySelect) {
|
|
|
|
type = 1;
|
|
|
|
}
|
|
|
|
dialogsSearchAdapter = new DialogsSearchAdapter(context, type, dialogsType) {
|
|
|
|
@Override
|
|
|
|
public void notifyDataSetChanged() {
|
|
|
|
super.notifyDataSetChanged();
|
|
|
|
if (!lastSearchScrolledToTop && searchListView != null) {
|
|
|
|
searchListView.scrollToPosition(0);
|
|
|
|
lastSearchScrolledToTop = true;
|
2019-08-22 01:53:26 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
dialogsSearchAdapter.setDelegate(new DialogsSearchAdapter.DialogsSearchAdapterDelegate() {
|
|
|
|
@Override
|
|
|
|
public void searchStateChanged(boolean search) {
|
|
|
|
if (searching && searchWas && searchEmptyView != null) {
|
|
|
|
if (search) {
|
|
|
|
searchEmptyView.showProgress();
|
|
|
|
} else {
|
|
|
|
searchEmptyView.showTextView();
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void didPressedOnSubDialog(long did) {
|
|
|
|
if (onlySelect) {
|
|
|
|
if (!validateSlowModeDialog(did)) {
|
2019-05-14 14:08:05 +02:00
|
|
|
return;
|
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
if (dialogsAdapter.hasSelectedDialogs()) {
|
2020-01-03 16:45:22 +01:00
|
|
|
boolean checked = dialogsAdapter.addOrRemoveSelectedDialog(did, null);
|
|
|
|
findAndUpdateCheckBox(did, checked);
|
2019-12-31 14:08:08 +01:00
|
|
|
updateSelectedCount();
|
2020-01-03 16:45:22 +01:00
|
|
|
actionBar.closeSearchField();
|
2017-12-08 18:35:59 +01:00
|
|
|
} else {
|
2019-12-31 14:08:08 +01:00
|
|
|
didSelectResult(did, true, false);
|
2014-10-31 20:02:29 +01:00
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
} else {
|
2019-12-31 14:08:08 +01:00
|
|
|
int lower_id = (int) did;
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
if (lower_id > 0) {
|
|
|
|
args.putInt("user_id", lower_id);
|
|
|
|
} else {
|
|
|
|
args.putInt("chat_id", -lower_id);
|
2017-12-08 18:35:59 +01:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
closeSearch();
|
|
|
|
if (AndroidUtilities.isTablet()) {
|
|
|
|
if (dialogsAdapter != null) {
|
|
|
|
dialogsAdapter.setOpenedDialogId(openedDialogId = did);
|
|
|
|
updateVisibleRows(MessagesController.UPDATE_MASK_SELECT_DIALOG);
|
2018-07-30 04:07:02 +02:00
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
if (searchString != null) {
|
|
|
|
if (getMessagesController().checkCanOpenChat(args, DialogsActivity.this)) {
|
|
|
|
getNotificationCenter().postNotificationName(NotificationCenter.closeChats);
|
|
|
|
presentFragment(new ChatActivity(args));
|
2018-07-30 04:07:02 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
} else {
|
|
|
|
if (getMessagesController().checkCanOpenChat(args, DialogsActivity.this)) {
|
|
|
|
presentFragment(new ChatActivity(args));
|
2018-07-30 04:07:02 +02:00
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
@Override
|
|
|
|
public void needRemoveHint(final int did) {
|
|
|
|
if (getParentActivity() == null) {
|
2019-08-22 01:53:26 +02:00
|
|
|
return;
|
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
TLRPC.User user = getMessagesController().getUser(did);
|
|
|
|
if (user == null) {
|
|
|
|
return;
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
builder.setTitle(LocaleController.getString("ChatHintsDeleteAlertTitle", R.string.ChatHintsDeleteAlertTitle));
|
|
|
|
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("ChatHintsDeleteAlert", R.string.ChatHintsDeleteAlert, ContactsController.formatName(user.first_name, user.last_name))));
|
|
|
|
builder.setPositiveButton(LocaleController.getString("StickersRemove", R.string.StickersRemove), (dialogInterface, i) -> getMediaDataController().removePeer(did));
|
|
|
|
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
|
|
|
AlertDialog dialog = builder.create();
|
|
|
|
showDialog(dialog);
|
|
|
|
TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE);
|
|
|
|
if (button != null) {
|
|
|
|
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void needClearList() {
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
builder.setTitle(LocaleController.getString("ClearSearchAlertTitle", R.string.ClearSearchAlertTitle));
|
|
|
|
builder.setMessage(LocaleController.getString("ClearSearchAlert", R.string.ClearSearchAlert));
|
|
|
|
builder.setPositiveButton(LocaleController.getString("ClearButton", R.string.ClearButton).toUpperCase(), (dialogInterface, i) -> {
|
|
|
|
if (dialogsSearchAdapter.isRecentSearchDisplayed()) {
|
|
|
|
dialogsSearchAdapter.clearRecentSearch();
|
|
|
|
} else {
|
|
|
|
dialogsSearchAdapter.clearRecentHashtags();
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
});
|
|
|
|
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
|
|
|
AlertDialog dialog = builder.create();
|
|
|
|
showDialog(dialog);
|
|
|
|
TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE);
|
|
|
|
if (button != null) {
|
|
|
|
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
|
|
|
});
|
2019-12-31 14:08:08 +01:00
|
|
|
|
|
|
|
searchListView = new RecyclerListView(context);
|
|
|
|
searchListView.setPivotY(0);
|
|
|
|
searchListView.setAdapter(dialogsSearchAdapter);
|
|
|
|
searchListView.setVerticalScrollBarEnabled(true);
|
|
|
|
searchListView.setInstantClick(true);
|
|
|
|
searchListView.setVerticalScrollbarPosition(LocaleController.isRTL ? RecyclerListView.SCROLLBAR_POSITION_LEFT : RecyclerListView.SCROLLBAR_POSITION_RIGHT);
|
|
|
|
searchListView.setLayoutManager(searchlayoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
|
|
|
|
contentView.addView(searchListView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
|
|
|
searchListView.setOnItemClickListener((view, position) -> onItemClick(view, position, dialogsSearchAdapter));
|
|
|
|
searchListView.setOnItemLongClickListener(new RecyclerListView.OnItemLongClickListenerExtended() {
|
2015-04-09 20:00:14 +02:00
|
|
|
@Override
|
2018-07-30 04:07:02 +02:00
|
|
|
public boolean onItemClick(View view, int position, float x, float y) {
|
2019-12-31 14:08:08 +01:00
|
|
|
return onItemLongClick(view, position, x, y, dialogsSearchAdapter);
|
2015-05-21 23:27:27 +02:00
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onLongClickRelease() {
|
|
|
|
finishPreviewFragment();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onMove(float dx, float dy) {
|
|
|
|
movePreviewFragment(dy);
|
|
|
|
}
|
2015-05-21 23:27:27 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
searchEmptyView = new EmptyTextProgressView(context);
|
2019-12-31 14:08:08 +01:00
|
|
|
searchEmptyView.setPivotY(0);
|
2015-05-21 23:27:27 +02:00
|
|
|
searchEmptyView.setShowAtCenter(true);
|
2019-06-04 12:14:50 +02:00
|
|
|
searchEmptyView.setTopImage(R.drawable.settings_noresults);
|
|
|
|
searchEmptyView.setText(LocaleController.getString("SettingsNoResults", R.string.SettingsNoResults));
|
2017-12-08 18:35:59 +01:00
|
|
|
contentView.addView(searchEmptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
2019-12-31 14:08:08 +01:00
|
|
|
searchListView.setEmptyView(searchEmptyView);
|
2015-05-21 23:27:27 +02:00
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
floatingButtonContainer = new FrameLayout(context);
|
2019-05-14 14:08:05 +02:00
|
|
|
floatingButtonContainer.setVisibility(onlySelect || folderId != 0 ? View.GONE : View.VISIBLE);
|
2019-01-23 18:03:33 +01:00
|
|
|
contentView.addView(floatingButtonContainer, LayoutHelper.createFrame((Build.VERSION.SDK_INT >= 21 ? 56 : 60) + 20, (Build.VERSION.SDK_INT >= 21 ? 56 : 60) + 14, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.BOTTOM, LocaleController.isRTL ? 4 : 0, 0, LocaleController.isRTL ? 0 : 4, 0));
|
|
|
|
floatingButtonContainer.setOnClickListener(v -> {
|
2020-02-21 04:11:15 +01:00
|
|
|
if (!NekoConfig.openFilterByFab) {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putBoolean("destroyAfterSelect", true);
|
|
|
|
presentFragment(new ContactsActivity(args));
|
|
|
|
} else {
|
|
|
|
FilterPopup.getInstance(currentAccount).createMenu(this, floatingButtonContainer.getRight(), floatingButtonContainer.getTop() + actionBar.getHeight(), folderId, true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
floatingButtonContainer.setOnLongClickListener(v -> {
|
|
|
|
if (NekoConfig.openFilterByFab) {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putBoolean("destroyAfterSelect", true);
|
|
|
|
presentFragment(new ContactsActivity(args));
|
|
|
|
}
|
|
|
|
return NekoConfig.openFilterByFab;
|
2019-01-23 18:03:33 +01:00
|
|
|
});
|
|
|
|
|
2015-05-21 23:27:27 +02:00
|
|
|
floatingButton = new ImageView(context);
|
|
|
|
floatingButton.setScaleType(ImageView.ScaleType.CENTER);
|
2017-03-31 01:58:05 +02:00
|
|
|
Drawable drawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), Theme.getColor(Theme.key_chats_actionBackground), Theme.getColor(Theme.key_chats_actionPressedBackground));
|
|
|
|
if (Build.VERSION.SDK_INT < 21) {
|
|
|
|
Drawable shadowDrawable = context.getResources().getDrawable(R.drawable.floating_shadow).mutate();
|
|
|
|
shadowDrawable.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY));
|
|
|
|
CombinedDrawable combinedDrawable = new CombinedDrawable(shadowDrawable, drawable, 0, 0);
|
|
|
|
combinedDrawable.setIconSize(AndroidUtilities.dp(56), AndroidUtilities.dp(56));
|
|
|
|
drawable = combinedDrawable;
|
|
|
|
}
|
|
|
|
floatingButton.setBackgroundDrawable(drawable);
|
|
|
|
floatingButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionIcon), PorterDuff.Mode.MULTIPLY));
|
2015-05-21 23:27:27 +02:00
|
|
|
floatingButton.setImageResource(R.drawable.floating_pencil);
|
|
|
|
if (Build.VERSION.SDK_INT >= 21) {
|
|
|
|
StateListAnimator animator = new StateListAnimator();
|
2019-01-23 18:03:33 +01:00
|
|
|
animator.addState(new int[]{android.R.attr.state_pressed}, ObjectAnimator.ofFloat(floatingButton, View.TRANSLATION_Z, AndroidUtilities.dp(2), AndroidUtilities.dp(4)).setDuration(200));
|
|
|
|
animator.addState(new int[]{}, ObjectAnimator.ofFloat(floatingButton, View.TRANSLATION_Z, AndroidUtilities.dp(4), AndroidUtilities.dp(2)).setDuration(200));
|
2015-05-21 23:27:27 +02:00
|
|
|
floatingButton.setStateListAnimator(animator);
|
|
|
|
floatingButton.setOutlineProvider(new ViewOutlineProvider() {
|
|
|
|
@SuppressLint("NewApi")
|
|
|
|
@Override
|
|
|
|
public void getOutline(View view, Outline outline) {
|
|
|
|
outline.setOval(0, 0, AndroidUtilities.dp(56), AndroidUtilities.dp(56));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
floatingButtonContainer.setContentDescription(LocaleController.getString("NewMessageTitle", R.string.NewMessageTitle));
|
2019-01-23 18:03:33 +01:00
|
|
|
floatingButtonContainer.addView(floatingButton, LayoutHelper.createFrame((Build.VERSION.SDK_INT >= 21 ? 56 : 60), (Build.VERSION.SDK_INT >= 21 ? 56 : 60), Gravity.LEFT | Gravity.TOP, 10, 0, 10, 0));
|
2015-05-21 23:27:27 +02:00
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
/*unreadFloatingButtonContainer = new FrameLayout(context);
|
2018-07-30 04:07:02 +02:00
|
|
|
if (onlySelect) {
|
|
|
|
unreadFloatingButtonContainer.setVisibility(View.GONE);
|
|
|
|
} else {
|
|
|
|
unreadFloatingButtonContainer.setVisibility(currentUnreadCount != 0 ? View.VISIBLE : View.INVISIBLE);
|
|
|
|
unreadFloatingButtonContainer.setTag(currentUnreadCount != 0 ? 1 : null);
|
|
|
|
}
|
|
|
|
contentView.addView(unreadFloatingButtonContainer, LayoutHelper.createFrame((Build.VERSION.SDK_INT >= 21 ? 56 : 60) + 20, (Build.VERSION.SDK_INT >= 21 ? 56 : 60) + 20, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.BOTTOM, LocaleController.isRTL ? 4 : 0, 0, LocaleController.isRTL ? 0 : 4, 14 + 60 + 7));
|
2018-08-27 10:33:11 +02:00
|
|
|
unreadFloatingButtonContainer.setOnClickListener(view -> {
|
|
|
|
if (listView.getAdapter() == dialogsAdapter) {
|
|
|
|
int firstVisibleItem = layoutManager.findFirstVisibleItemPosition();
|
|
|
|
if (firstVisibleItem == 0) {
|
2019-05-14 14:08:05 +02:00
|
|
|
ArrayList<TLRPC.Dialog> array = getDialogsArray();
|
2018-08-27 10:33:11 +02:00
|
|
|
for (int a = array.size() - 1; a >= 0; a--) {
|
2019-05-14 14:08:05 +02:00
|
|
|
TLRPC.Dialog dialog = array.get(a);
|
|
|
|
if ((dialog.unread_count != 0 || dialog.unread_mark) && !getMessagesController().isDialogMuted(dialog.id)) {
|
2018-08-27 10:33:11 +02:00
|
|
|
listView.smoothScrollToPosition(a);
|
|
|
|
break;
|
2018-07-30 04:07:02 +02:00
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
int middle = listView.getMeasuredHeight() / 2;
|
|
|
|
boolean found = false;
|
|
|
|
for (int b = 0, count = listView.getChildCount(); b < count; b++) {
|
|
|
|
View child = listView.getChildAt(b);
|
|
|
|
if (child instanceof DialogCell) {
|
|
|
|
if (child.getTop() <= middle && child.getBottom() >= middle) {
|
|
|
|
RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.findContainingViewHolder(child);
|
|
|
|
if (holder != null) {
|
2019-05-14 14:08:05 +02:00
|
|
|
ArrayList<TLRPC.Dialog> array = getDialogsArray();
|
2018-08-27 10:33:11 +02:00
|
|
|
for (int a = Math.min(holder.getAdapterPosition(), array.size()) - 1; a >= 0; a--) {
|
2019-05-14 14:08:05 +02:00
|
|
|
TLRPC.Dialog dialog = array.get(a);
|
|
|
|
if ((dialog.unread_count != 0 || dialog.unread_mark) && !getMessagesController().isDialogMuted(dialog.id)) {
|
2018-08-27 10:33:11 +02:00
|
|
|
found = true;
|
|
|
|
listView.smoothScrollToPosition(a);
|
|
|
|
break;
|
2018-07-30 04:07:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
break;
|
2018-07-30 04:07:02 +02:00
|
|
|
}
|
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
|
|
|
if (!found) {
|
|
|
|
hideFloatingButton(false);
|
|
|
|
listView.smoothScrollToPosition(0);
|
2018-07-30 04:07:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
unreadFloatingButton = new ImageView(context);
|
|
|
|
unreadFloatingButton.setScaleType(ImageView.ScaleType.CENTER);
|
|
|
|
|
|
|
|
drawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), Theme.getColor(Theme.key_chats_actionUnreadBackground), Theme.getColor(Theme.key_chats_actionUnreadPressedBackground));
|
|
|
|
if (Build.VERSION.SDK_INT < 21) {
|
|
|
|
Drawable shadowDrawable = context.getResources().getDrawable(R.drawable.floating_shadow_profile).mutate();
|
|
|
|
shadowDrawable.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY));
|
|
|
|
CombinedDrawable combinedDrawable = new CombinedDrawable(shadowDrawable, drawable, 0, 0);
|
|
|
|
combinedDrawable.setIconSize(AndroidUtilities.dp(56), AndroidUtilities.dp(56));
|
|
|
|
drawable = combinedDrawable;
|
|
|
|
}
|
|
|
|
unreadFloatingButton.setBackgroundDrawable(drawable);
|
2019-01-23 18:03:33 +01:00
|
|
|
unreadFloatingButton.setImageDrawable(arrowDrawable = new AnimatedArrowDrawable(0xffffffff, false));
|
2018-07-30 04:07:02 +02:00
|
|
|
unreadFloatingButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionUnreadIcon), PorterDuff.Mode.MULTIPLY));
|
|
|
|
unreadFloatingButton.setPadding(0, AndroidUtilities.dp(4), 0, 0);
|
|
|
|
arrowDrawable.setAnimationProgress(1.0f);
|
|
|
|
if (Build.VERSION.SDK_INT >= 21) {
|
|
|
|
StateListAnimator animator = new StateListAnimator();
|
2019-01-23 18:03:33 +01:00
|
|
|
animator.addState(new int[]{android.R.attr.state_pressed}, ObjectAnimator.ofFloat(unreadFloatingButton, View.TRANSLATION_Z, AndroidUtilities.dp(2), AndroidUtilities.dp(4)).setDuration(200));
|
|
|
|
animator.addState(new int[]{}, ObjectAnimator.ofFloat(unreadFloatingButton, View.TRANSLATION_Z, AndroidUtilities.dp(4), AndroidUtilities.dp(2)).setDuration(200));
|
2018-07-30 04:07:02 +02:00
|
|
|
unreadFloatingButton.setStateListAnimator(animator);
|
|
|
|
unreadFloatingButton.setOutlineProvider(new ViewOutlineProvider() {
|
|
|
|
@SuppressLint("NewApi")
|
|
|
|
@Override
|
|
|
|
public void getOutline(View view, Outline outline) {
|
|
|
|
outline.setOval(0, 0, AndroidUtilities.dp(56), AndroidUtilities.dp(56));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
unreadFloatingButtonContainer.addView(unreadFloatingButton, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56 : 60, Build.VERSION.SDK_INT >= 21 ? 56 : 60, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.TOP, 10, 13, 10, 0));
|
|
|
|
|
|
|
|
unreadFloatingButtonCounter = new TextView(context);
|
|
|
|
unreadFloatingButtonCounter.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
|
|
|
unreadFloatingButtonCounter.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
|
|
|
|
if (currentUnreadCount > 0) {
|
|
|
|
unreadFloatingButtonCounter.setText(String.format("%d", currentUnreadCount));
|
|
|
|
}
|
|
|
|
if (Build.VERSION.SDK_INT >= 21) {
|
|
|
|
unreadFloatingButtonCounter.setElevation(AndroidUtilities.dp(5));
|
|
|
|
unreadFloatingButtonCounter.setOutlineProvider(new ViewOutlineProvider() {
|
|
|
|
@SuppressLint("NewApi")
|
|
|
|
@Override
|
|
|
|
public void getOutline(View view, Outline outline) {
|
|
|
|
outline.setEmpty();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-03-03 21:40:48 +01:00
|
|
|
unreadFloatingButtonCounter.setColors(Theme.getColor(Theme.key_chat_goDownButtonCounter));
|
2018-07-30 04:07:02 +02:00
|
|
|
unreadFloatingButtonCounter.setGravity(Gravity.CENTER);
|
|
|
|
unreadFloatingButtonCounter.setBackgroundDrawable(Theme.createRoundRectDrawable(AndroidUtilities.dp(11.5f), Theme.getColor(Theme.key_chat_goDownButtonCounterBackground)));
|
|
|
|
unreadFloatingButtonCounter.setMinWidth(AndroidUtilities.dp(23));
|
|
|
|
unreadFloatingButtonCounter.setPadding(AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8), AndroidUtilities.dp(1));
|
2019-01-23 18:03:33 +01:00
|
|
|
unreadFloatingButtonContainer.addView(unreadFloatingButtonCounter, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 23, Gravity.TOP | Gravity.CENTER_HORIZONTAL));*/
|
2018-07-30 04:07:02 +02:00
|
|
|
|
2015-05-21 23:27:27 +02:00
|
|
|
listView.setOnScrollListener(new RecyclerView.OnScrollListener() {
|
2018-07-30 04:07:02 +02:00
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
private boolean wasManualScroll;
|
|
|
|
|
2015-04-09 20:00:14 +02:00
|
|
|
@Override
|
2015-05-21 23:27:27 +02:00
|
|
|
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
|
2019-12-31 14:08:08 +01:00
|
|
|
wasManualScroll = true;
|
2018-07-30 04:07:02 +02:00
|
|
|
scrollingManually = true;
|
|
|
|
} else {
|
|
|
|
scrollingManually = false;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
|
|
|
wasManualScroll = false;
|
|
|
|
if (waitingForScrollFinished) {
|
|
|
|
waitingForScrollFinished = false;
|
|
|
|
if (updatePullAfterScroll) {
|
|
|
|
listView.updatePullState();
|
|
|
|
updatePullAfterScroll = false;
|
|
|
|
}
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2015-04-09 20:00:14 +02:00
|
|
|
@Override
|
2015-05-21 23:27:27 +02:00
|
|
|
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
|
|
|
int firstVisibleItem = layoutManager.findFirstVisibleItemPosition();
|
|
|
|
int visibleItemCount = Math.abs(layoutManager.findLastVisibleItemPosition() - firstVisibleItem) + 1;
|
2019-07-18 15:01:39 +02:00
|
|
|
dialogsItemAnimator.onListScroll(-dy);
|
2015-05-21 23:27:27 +02:00
|
|
|
|
2015-04-09 20:00:14 +02:00
|
|
|
if (visibleItemCount > 0) {
|
2019-05-14 14:08:05 +02:00
|
|
|
if (layoutManager.findLastVisibleItemPosition() >= getDialogsArray(currentAccount, dialogsType, folderId, dialogsListFrozen).size() - 10) {
|
|
|
|
boolean fromCache = !getMessagesController().isDialogsEndReached(folderId);
|
|
|
|
if (fromCache || !getMessagesController().isServerDialogsEndReached(folderId)) {
|
|
|
|
AndroidUtilities.runOnUIThread(() -> getMessagesController().loadDialogs(folderId, -1, 100, fromCache));
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
2014-05-25 00:47:05 +02:00
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
//checkUnreadButton(true);
|
2018-07-30 04:07:02 +02:00
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
if (wasManualScroll && floatingButtonContainer.getVisibility() != View.GONE && recyclerView.getChildCount() > 0) {
|
2015-05-21 23:27:27 +02:00
|
|
|
final View topChild = recyclerView.getChildAt(0);
|
2019-12-31 14:08:08 +01:00
|
|
|
RecyclerView.ViewHolder holder = recyclerView.findContainingViewHolder(topChild);
|
|
|
|
if (!hasHiddenArchive() || holder != null && holder.getAdapterPosition() != 0) {
|
|
|
|
int firstViewTop = 0;
|
|
|
|
if (topChild != null) {
|
|
|
|
firstViewTop = topChild.getTop();
|
2016-05-25 23:49:47 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
boolean goingDown;
|
|
|
|
boolean changed = true;
|
|
|
|
if (prevPosition == firstVisibleItem) {
|
|
|
|
final int topDelta = prevTop - firstViewTop;
|
|
|
|
goingDown = firstViewTop < prevTop;
|
|
|
|
changed = Math.abs(topDelta) > 1;
|
|
|
|
} else {
|
|
|
|
goingDown = firstVisibleItem > prevPosition;
|
2016-05-25 23:49:47 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
if (changed && scrollUpdated && (goingDown || !goingDown && scrollingManually)) {
|
|
|
|
hideFloatingButton(goingDown);
|
2016-05-25 23:49:47 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
prevPosition = firstVisibleItem;
|
|
|
|
prevTop = firstViewTop;
|
|
|
|
scrollUpdated = true;
|
2016-05-25 23:49:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
});
|
2016-05-25 23:49:47 +02:00
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
searchListView.setOnScrollListener(new RecyclerView.OnScrollListener() {
|
2016-05-25 23:49:47 +02:00
|
|
|
@Override
|
2019-12-31 14:08:08 +01:00
|
|
|
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
|
|
|
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
|
|
|
|
if (searching && searchWas) {
|
|
|
|
AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus());
|
|
|
|
}
|
2019-06-04 12:14:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-12-31 14:08:08 +01:00
|
|
|
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
|
|
|
int firstVisibleItem = searchlayoutManager.findFirstVisibleItemPosition();
|
|
|
|
int visibleItemCount = Math.abs(searchlayoutManager.findLastVisibleItemPosition() - firstVisibleItem) + 1;
|
|
|
|
int totalItemCount = recyclerView.getAdapter().getItemCount();
|
|
|
|
if (searching && searchWas) {
|
|
|
|
if (visibleItemCount > 0 && searchlayoutManager.findLastVisibleItemPosition() == totalItemCount - 1 && !dialogsSearchAdapter.isMessagesSearchEndReached()) {
|
|
|
|
dialogsSearchAdapter.loadMoreSearchMessages();
|
2019-06-04 12:14:50 +02:00
|
|
|
}
|
|
|
|
}
|
2016-05-25 23:49:47 +02:00
|
|
|
}
|
2015-05-21 23:27:27 +02:00
|
|
|
});
|
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
archivePullViewState = SharedConfig.archiveHidden ? ARCHIVE_ITEM_STATE_HIDDEN : ARCHIVE_ITEM_STATE_PINNED;
|
|
|
|
if (pullForegroundDrawable == null && folderId == 0) {
|
|
|
|
pullForegroundDrawable = new PullForegroundDrawable(LocaleController.getString("AccSwipeForArchive", R.string.AccSwipeForArchive), LocaleController.getString("AccReleaseForArchive", R.string.AccReleaseForArchive)) {
|
|
|
|
@Override
|
|
|
|
protected float getViewOffset() {
|
|
|
|
return listView.getViewOffset();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
if (hasHiddenArchive()) {
|
|
|
|
pullForegroundDrawable.showHidden();
|
|
|
|
} else {
|
|
|
|
pullForegroundDrawable.doNotShow();
|
|
|
|
}
|
|
|
|
pullForegroundDrawable.setWillDraw(archivePullViewState != ARCHIVE_ITEM_STATE_PINNED);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (searchString == null) {
|
|
|
|
dialogsAdapter = new DialogsAdapter(context, dialogsType, folderId, onlySelect) {
|
|
|
|
@Override
|
|
|
|
public void notifyDataSetChanged() {
|
|
|
|
lastItemsCount = getItemCount();
|
|
|
|
super.notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
if (AndroidUtilities.isTablet() && openedDialogId != 0) {
|
|
|
|
dialogsAdapter.setOpenedDialogId(openedDialogId);
|
|
|
|
}
|
|
|
|
dialogsAdapter.setArchivedPullDrawable(pullForegroundDrawable);
|
|
|
|
listView.setAdapter(dialogsAdapter);
|
|
|
|
}
|
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
listView.setEmptyView(folderId == 0 ? progressView : null);
|
2015-04-09 20:00:14 +02:00
|
|
|
if (searchString != null) {
|
2019-12-31 14:08:08 +01:00
|
|
|
showSearch(true, false);
|
2019-01-23 18:03:33 +01:00
|
|
|
actionBar.openSearchField(searchString, false);
|
2019-12-31 14:08:08 +01:00
|
|
|
} else {
|
|
|
|
showSearch(false, false);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
|
2019-10-30 07:29:52 +01:00
|
|
|
if (!onlySelect && FilterPopup.DialogType.isDialogsType(dialogsType)) {
|
2018-07-30 04:07:02 +02:00
|
|
|
FragmentContextView fragmentLocationContextView = new FragmentContextView(context, this, true);
|
|
|
|
contentView.addView(fragmentLocationContextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 39, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0));
|
|
|
|
|
|
|
|
FragmentContextView fragmentContextView = new FragmentContextView(context, this, false);
|
|
|
|
contentView.addView(fragmentContextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 39, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0));
|
|
|
|
|
2017-12-08 18:35:59 +01:00
|
|
|
fragmentContextView.setAdditionalContextView(fragmentLocationContextView);
|
|
|
|
fragmentLocationContextView.setAdditionalContextView(fragmentContextView);
|
2019-12-31 14:08:08 +01:00
|
|
|
} else if (dialogsType == 3/* && selectAlertString == null*/) {
|
2017-12-08 18:35:59 +01:00
|
|
|
if (commentView != null) {
|
|
|
|
commentView.onDestroy();
|
|
|
|
}
|
|
|
|
commentView = new ChatActivityEnterView(getParentActivity(), contentView, null, false);
|
|
|
|
commentView.setAllowStickersAndGifs(false, false);
|
|
|
|
commentView.setForceShowSendButton(true, false);
|
|
|
|
commentView.setVisibility(View.GONE);
|
|
|
|
contentView.addView(commentView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.BOTTOM));
|
|
|
|
commentView.setDelegate(new ChatActivityEnterView.ChatActivityEnterViewDelegate() {
|
|
|
|
@Override
|
2019-09-10 12:56:11 +02:00
|
|
|
public void onMessageSend(CharSequence message, boolean notify, int scheduleDate) {
|
2017-12-08 18:35:59 +01:00
|
|
|
if (delegate == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ArrayList<Long> selectedDialogs = dialogsAdapter.getSelectedDialogs();
|
|
|
|
if (selectedDialogs.isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
delegate.didSelectDialogs(DialogsActivity.this, selectedDialogs, message, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSwitchRecordMode(boolean video) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
@Override
|
|
|
|
public void onTextSelectionChanged(int start, int end) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onStickersExpandedChange() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-12-08 18:35:59 +01:00
|
|
|
@Override
|
|
|
|
public void onPreAudioVideoRecord() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onTextChanged(final CharSequence text, boolean bigChange) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
@Override
|
|
|
|
public void onTextSpansChanged(CharSequence text) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-12-08 18:35:59 +01:00
|
|
|
@Override
|
|
|
|
public void needSendTyping() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onAttachButtonHidden() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onAttachButtonShow() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onMessageEditEnd(boolean loading) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onWindowSizeChanged(int size) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onStickersTab(boolean opened) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void didPressedAttachButton() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-09-10 12:56:11 +02:00
|
|
|
public void needStartRecordVideo(int state, boolean notify, int scheduleDate) {
|
2017-12-08 18:35:59 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void needChangeVideoPreviewState(int state, float seekProgress) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void needStartRecordAudio(int state) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void needShowMediaBanHint() {
|
|
|
|
|
|
|
|
}
|
2019-08-22 01:53:26 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onUpdateSlowModeButton(View button, boolean show, CharSequence time) {
|
|
|
|
|
|
|
|
}
|
2020-01-23 07:15:40 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onSendLongClick() {
|
|
|
|
|
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
});
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
for (int a = 0; a < 2; a++) {
|
|
|
|
undoView[a] = new UndoView(context) {
|
|
|
|
@Override
|
|
|
|
public void setTranslationY(float translationY) {
|
|
|
|
super.setTranslationY(translationY);
|
|
|
|
if (this == undoView[0] && undoView[1].getVisibility() != VISIBLE) {
|
|
|
|
float diff = getMeasuredHeight() + AndroidUtilities.dp(8) - translationY;
|
|
|
|
if (!floatingHidden) {
|
2019-12-31 14:08:08 +01:00
|
|
|
updateFloatingButtonOffset();
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
|
|
|
additionalFloatingTranslation = diff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected boolean canUndo() {
|
|
|
|
return !dialogsItemAnimator.isRunning();
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
};
|
|
|
|
contentView.addView(undoView[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8));
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
|
|
|
|
/*if (!onlySelect) {
|
2018-07-30 04:07:02 +02:00
|
|
|
checkUnreadCount(false);
|
2019-01-23 18:03:33 +01:00
|
|
|
}*/
|
2018-07-30 04:07:02 +02:00
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
if (folderId != 0) {
|
|
|
|
actionBar.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultArchived));
|
|
|
|
listView.setGlowColor(Theme.getColor(Theme.key_actionBarDefaultArchived));
|
|
|
|
actionBar.setTitleColor(Theme.getColor(Theme.key_actionBarDefaultArchivedTitle));
|
|
|
|
actionBar.setItemsColor(Theme.getColor(Theme.key_actionBarDefaultArchivedIcon), false);
|
|
|
|
actionBar.setItemsBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultArchivedSelector), false);
|
|
|
|
actionBar.setSearchTextColor(Theme.getColor(Theme.key_actionBarDefaultArchivedSearch), false);
|
|
|
|
actionBar.setSearchTextColor(Theme.getColor(Theme.key_actionBarDefaultArchivedSearchPlaceholder), true);
|
|
|
|
}
|
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
scrollHelper = new RecyclerAnimationScrollHelper(listView, layoutManager);
|
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
return fragmentView;
|
|
|
|
}
|
|
|
|
|
2020-02-13 19:26:53 +01:00
|
|
|
@Override
|
|
|
|
protected void onPanTranslationUpdate(int y) {
|
|
|
|
if (listView == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (commentView != null && commentView.isPopupShowing()) {
|
|
|
|
fragmentView.setTranslationY(y);
|
|
|
|
listView.setTranslationY(0);
|
|
|
|
searchListView.setTranslationY(0);
|
|
|
|
} else {
|
|
|
|
listView.setTranslationY(y);
|
|
|
|
searchListView.setTranslationY(y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
@Override
|
|
|
|
public void onResume() {
|
2014-06-04 18:00:42 +02:00
|
|
|
super.onResume();
|
2019-05-14 14:08:05 +02:00
|
|
|
if (dialogsAdapter != null && !dialogsListFrozen) {
|
2014-11-13 21:10:14 +01:00
|
|
|
dialogsAdapter.notifyDataSetChanged();
|
2014-10-31 20:02:29 +01:00
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
if (commentView != null) {
|
|
|
|
commentView.onResume();
|
|
|
|
}
|
2019-09-10 12:56:11 +02:00
|
|
|
if (!onlySelect && folderId == 0) {
|
|
|
|
getMediaDataController().checkStickers(MediaDataController.TYPE_EMOJI);
|
|
|
|
}
|
2014-11-13 21:10:14 +01:00
|
|
|
if (dialogsSearchAdapter != null) {
|
|
|
|
dialogsSearchAdapter.notifyDataSetChanged();
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
final boolean tosAccepted;
|
|
|
|
if (!afterSignup) {
|
|
|
|
tosAccepted = UserConfig.getInstance(UserConfig.selectedAccount).unacceptedTermsOfService == null;
|
|
|
|
} else {
|
|
|
|
tosAccepted = false;
|
|
|
|
afterSignup = false;
|
|
|
|
}
|
|
|
|
if (tosAccepted && checkPermission && !onlySelect && Build.VERSION.SDK_INT >= 23) {
|
2015-10-29 18:10:07 +01:00
|
|
|
Activity activity = getParentActivity();
|
|
|
|
if (activity != null) {
|
|
|
|
checkPermission = false;
|
2019-05-14 14:08:05 +02:00
|
|
|
boolean hasNotContactsPermission = activity.checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED;
|
|
|
|
boolean hasNotStoragePermission = activity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED;
|
|
|
|
if (hasNotContactsPermission || hasNotStoragePermission) {
|
|
|
|
if (hasNotContactsPermission && askAboutContacts && getUserConfig().syncContacts && activity.shouldShowRequestPermissionRationale(Manifest.permission.READ_CONTACTS)) {
|
2018-08-27 10:33:11 +02:00
|
|
|
AlertDialog.Builder builder = AlertsCreator.createContactsPermissionDialog(activity, param -> {
|
|
|
|
askAboutContacts = param != 0;
|
|
|
|
MessagesController.getGlobalNotificationsSettings().edit().putBoolean("askAboutContacts", askAboutContacts).commit();
|
|
|
|
askForPermissons(false);
|
2018-07-30 04:07:02 +02:00
|
|
|
});
|
2015-10-29 18:10:07 +01:00
|
|
|
showDialog(permissionDialog = builder.create());
|
2019-05-14 14:08:05 +02:00
|
|
|
} else if (hasNotStoragePermission && activity.shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
|
2015-10-29 18:10:07 +01:00
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
|
|
|
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
|
|
|
builder.setMessage(LocaleController.getString("PermissionStorage", R.string.PermissionStorage));
|
|
|
|
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
|
|
|
|
showDialog(permissionDialog = builder.create());
|
|
|
|
} else {
|
2018-07-30 04:07:02 +02:00
|
|
|
askForPermissons(true);
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (!onlySelect && XiaomiUtilities.isMIUI() && Build.VERSION.SDK_INT >= 19 && !XiaomiUtilities.isCustomPermissionGranted(XiaomiUtilities.OP_SHOW_WHEN_LOCKED)) {
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (MessagesController.getGlobalNotificationsSettings().getBoolean("askedAboutMiuiLockscreen", false)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
showDialog(new AlertDialog.Builder(getParentActivity())
|
|
|
|
.setTitle(LocaleController.getString("AppName", R.string.AppName))
|
|
|
|
.setMessage(LocaleController.getString("PermissionXiaomiLockscreen", R.string.PermissionXiaomiLockscreen))
|
|
|
|
.setPositiveButton(LocaleController.getString("PermissionOpenSettings", R.string.PermissionOpenSettings), (dialog, which) -> {
|
|
|
|
Intent intent = XiaomiUtilities.getPermissionManagerIntent();
|
|
|
|
if (intent != null) {
|
|
|
|
try {
|
|
|
|
getParentActivity().startActivity(intent);
|
|
|
|
} catch (Exception x) {
|
|
|
|
try {
|
|
|
|
intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
|
|
|
intent.setData(Uri.parse("package:" + ApplicationLoader.applicationContext.getPackageName()));
|
|
|
|
getParentActivity().startActivity(intent);
|
|
|
|
} catch (Exception xx) {
|
|
|
|
FileLog.e(xx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.setNegativeButton(LocaleController.getString("ContactsPermissionAlertNotNow", R.string.ContactsPermissionAlertNotNow), (dialog, which) -> MessagesController.getGlobalNotificationsSettings().edit().putBoolean("askedAboutMiuiLockscreen", true).commit())
|
|
|
|
.create());
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
|
|
|
|
if (archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN && layoutManager.findFirstVisibleItemPosition() == 0 && hasHiddenArchive()) {
|
|
|
|
layoutManager.scrollToPositionWithOffset(1, 0);
|
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
|
|
|
|
2017-12-08 18:35:59 +01:00
|
|
|
@Override
|
|
|
|
public void onPause() {
|
|
|
|
super.onPause();
|
|
|
|
if (commentView != null) {
|
|
|
|
commentView.onResume();
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
if (undoView[0] != null) {
|
|
|
|
undoView[0].hide(true, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onBackPressed() {
|
|
|
|
if (actionBar != null && actionBar.isActionModeShowed()) {
|
|
|
|
hideActionMode(true);
|
|
|
|
return false;
|
|
|
|
} else if (commentView != null && commentView.isPopupShowing()) {
|
|
|
|
commentView.hidePopup(true);
|
|
|
|
return false;
|
2019-02-08 03:30:32 +01:00
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
return super.onBackPressed();
|
2017-12-08 18:35:59 +01:00
|
|
|
}
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
@Override
|
|
|
|
protected void onBecomeFullyHidden() {
|
|
|
|
if (closeSearchFieldOnHide) {
|
|
|
|
if (actionBar != null) {
|
|
|
|
actionBar.closeSearchField();
|
|
|
|
}
|
|
|
|
if (searchObject != null) {
|
|
|
|
dialogsSearchAdapter.putRecentSearch(searchDialogId, searchObject);
|
|
|
|
searchObject = null;
|
|
|
|
}
|
|
|
|
closeSearchFieldOnHide = false;
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
if (undoView[0] != null) {
|
|
|
|
undoView[0].hide(true, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
private void showSearch(boolean show, boolean animated) {
|
|
|
|
if (dialogsType != 0) {
|
|
|
|
animated = false;
|
|
|
|
}
|
|
|
|
if (searchAnimator != null) {
|
|
|
|
searchAnimator.cancel();
|
|
|
|
searchAnimator = null;
|
|
|
|
}
|
|
|
|
if (animated) {
|
|
|
|
if (show) {
|
|
|
|
searchListView.setVisibility(View.VISIBLE);
|
|
|
|
} else {
|
|
|
|
listView.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
setDialogsListFrozen(true);
|
|
|
|
listView.setVerticalScrollBarEnabled(false);
|
|
|
|
searchListView.setVerticalScrollBarEnabled(false);
|
|
|
|
searchListView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
|
|
|
searchAnimator = new AnimatorSet();
|
|
|
|
searchAnimator.playTogether(
|
|
|
|
ObjectAnimator.ofFloat(listView, View.ALPHA, show ? 0.0f : 1.0f),
|
|
|
|
ObjectAnimator.ofFloat(listView, View.SCALE_X, show ? 0.9f : 1.0f),
|
|
|
|
ObjectAnimator.ofFloat(listView, View.SCALE_Y, show ? 0.9f : 1.0f),
|
|
|
|
ObjectAnimator.ofFloat(progressView, View.ALPHA, show ? 0.0f : 1.0f),
|
|
|
|
ObjectAnimator.ofFloat(progressView, View.SCALE_X, show ? 0.9f : 1.0f),
|
|
|
|
ObjectAnimator.ofFloat(progressView, View.SCALE_Y, show ? 0.9f : 1.0f),
|
|
|
|
ObjectAnimator.ofFloat(searchListView, View.ALPHA, show ? 1.0f : 0.0f),
|
|
|
|
ObjectAnimator.ofFloat(searchListView, View.SCALE_X, show ? 1.0f : 1.05f),
|
|
|
|
ObjectAnimator.ofFloat(searchListView, View.SCALE_Y, show ? 1.0f : 1.05f),
|
|
|
|
ObjectAnimator.ofFloat(searchEmptyView, View.ALPHA, show ? 1.0f : 0.0f),
|
|
|
|
ObjectAnimator.ofFloat(searchEmptyView, View.SCALE_X, show ? 1.0f : 1.05f),
|
|
|
|
ObjectAnimator.ofFloat(searchEmptyView, View.SCALE_Y, show ? 1.0f : 1.05f));
|
|
|
|
searchAnimator.setDuration(show ? 200 : 180);
|
|
|
|
searchAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT);
|
|
|
|
if (!show) {
|
|
|
|
searchAnimator.setStartDelay(20);
|
|
|
|
}
|
|
|
|
searchAnimator.addListener(new AnimatorListenerAdapter() {
|
|
|
|
@Override
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
|
|
if (searchAnimator != animation) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
setDialogsListFrozen(false);
|
|
|
|
if (show) {
|
|
|
|
listView.hide();
|
|
|
|
searchListView.show();
|
|
|
|
} else {
|
|
|
|
searchEmptyView.setScaleX(1.1f);
|
|
|
|
searchEmptyView.setScaleY(1.1f);
|
|
|
|
searchListView.hide();
|
|
|
|
listView.show();
|
|
|
|
dialogsSearchAdapter.searchDialogs(null);
|
|
|
|
if (!onlySelect) {
|
|
|
|
hideFloatingButton(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
listView.setVerticalScrollBarEnabled(true);
|
|
|
|
searchListView.setVerticalScrollBarEnabled(true);
|
|
|
|
searchListView.setBackground(null);
|
|
|
|
searchAnimator = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onAnimationCancel(Animator animation) {
|
|
|
|
if (searchAnimator == animation) {
|
|
|
|
if (show) {
|
|
|
|
listView.hide();
|
|
|
|
searchListView.show();
|
|
|
|
} else {
|
|
|
|
searchListView.hide();
|
|
|
|
listView.show();
|
|
|
|
}
|
|
|
|
searchAnimator = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
searchAnimator.start();
|
|
|
|
} else {
|
|
|
|
setDialogsListFrozen(false);
|
|
|
|
if (show) {
|
|
|
|
listView.hide();
|
|
|
|
searchListView.show();
|
|
|
|
} else {
|
|
|
|
listView.show();
|
|
|
|
searchListView.hide();
|
|
|
|
}
|
|
|
|
listView.setAlpha(show ? 0.0f : 1.0f);
|
|
|
|
listView.setScaleX(show ? 0.9f : 1.0f);
|
|
|
|
listView.setScaleY(show ? 0.9f : 1.0f);
|
|
|
|
progressView.setAlpha(show ? 0.0f : 1.0f);
|
|
|
|
progressView.setScaleX(show ? 0.9f : 1.0f);
|
|
|
|
progressView.setScaleY(show ? 0.9f : 1.0f);
|
|
|
|
searchListView.setAlpha(show ? 1.0f : 0.0f);
|
|
|
|
searchListView.setScaleX(show ? 1.0f : 1.1f);
|
|
|
|
searchListView.setScaleY(show ? 1.0f : 1.1f);
|
|
|
|
searchEmptyView.setAlpha(show ? 1.0f : 0.0f);
|
|
|
|
searchEmptyView.setScaleX(show ? 1.0f : 1.1f);
|
|
|
|
searchEmptyView.setScaleY(show ? 1.0f : 1.1f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-03 16:45:22 +01:00
|
|
|
private void findAndUpdateCheckBox(long dialogId, boolean checked) {
|
|
|
|
int count = listView.getChildCount();
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
View child = listView.getChildAt(a);
|
|
|
|
if (child instanceof DialogCell) {
|
|
|
|
DialogCell dialogCell = (DialogCell) child;
|
|
|
|
if (dialogCell.getDialogId() == dialogId) {
|
|
|
|
dialogCell.setChecked(checked, true);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
private void onItemClick(View view, int position, RecyclerListView.Adapter adapter) {
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
2020-01-03 16:45:22 +01:00
|
|
|
long dialogId = 0;
|
2019-12-31 14:08:08 +01:00
|
|
|
int message_id = 0;
|
|
|
|
boolean isGlobalSearch = false;
|
|
|
|
if (adapter == dialogsAdapter) {
|
|
|
|
TLObject object = dialogsAdapter.getItem(position);
|
|
|
|
if (object instanceof TLRPC.User) {
|
2020-01-03 16:45:22 +01:00
|
|
|
dialogId = ((TLRPC.User) object).id;
|
2019-12-31 14:08:08 +01:00
|
|
|
} else if (object instanceof TLRPC.Dialog) {
|
|
|
|
TLRPC.Dialog dialog = (TLRPC.Dialog) object;
|
|
|
|
if (dialog instanceof TLRPC.TL_dialogFolder) {
|
|
|
|
if (actionBar.isActionModeShowed()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
TLRPC.TL_dialogFolder dialogFolder = (TLRPC.TL_dialogFolder) dialog;
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("folderId", dialogFolder.folder.id);
|
2020-01-01 13:10:52 +01:00
|
|
|
args.putInt("dialogsType", dialogsType);
|
|
|
|
args.putBoolean("onlySelect", onlySelect);
|
|
|
|
DialogsActivity dialogsActivity = new DialogsActivity(args);
|
|
|
|
dialogsActivity.setDelegate(delegate);
|
|
|
|
presentFragment(dialogsActivity, onlySelect);
|
2019-12-31 14:08:08 +01:00
|
|
|
return;
|
|
|
|
}
|
2020-01-03 16:45:22 +01:00
|
|
|
dialogId = dialog.id;
|
2019-12-31 14:08:08 +01:00
|
|
|
if (actionBar.isActionModeShowed()) {
|
|
|
|
showOrUpdateActionMode(dialog, view);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else if (object instanceof TLRPC.TL_recentMeUrlChat) {
|
2020-01-03 16:45:22 +01:00
|
|
|
dialogId = -((TLRPC.TL_recentMeUrlChat) object).chat_id;
|
2019-12-31 14:08:08 +01:00
|
|
|
} else if (object instanceof TLRPC.TL_recentMeUrlUser) {
|
2020-01-03 16:45:22 +01:00
|
|
|
dialogId = ((TLRPC.TL_recentMeUrlUser) object).user_id;
|
2019-12-31 14:08:08 +01:00
|
|
|
} else if (object instanceof TLRPC.TL_recentMeUrlChatInvite) {
|
|
|
|
TLRPC.TL_recentMeUrlChatInvite chatInvite = (TLRPC.TL_recentMeUrlChatInvite) object;
|
|
|
|
TLRPC.ChatInvite invite = chatInvite.chat_invite;
|
|
|
|
if (invite.chat == null && (!invite.channel || invite.megagroup) || invite.chat != null && (!ChatObject.isChannel(invite.chat) || invite.chat.megagroup)) {
|
|
|
|
String hash = chatInvite.url;
|
|
|
|
int index = hash.indexOf('/');
|
|
|
|
if (index > 0) {
|
|
|
|
hash = hash.substring(index + 1);
|
|
|
|
}
|
|
|
|
showDialog(new JoinGroupAlert(getParentActivity(), invite, hash, DialogsActivity.this));
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
if (invite.chat != null) {
|
2020-01-03 16:45:22 +01:00
|
|
|
dialogId = -invite.chat.id;
|
2019-12-31 14:08:08 +01:00
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (object instanceof TLRPC.TL_recentMeUrlStickerSet) {
|
|
|
|
TLRPC.StickerSet stickerSet = ((TLRPC.TL_recentMeUrlStickerSet) object).set.set;
|
|
|
|
TLRPC.TL_inputStickerSetID set = new TLRPC.TL_inputStickerSetID();
|
|
|
|
set.id = stickerSet.id;
|
|
|
|
set.access_hash = stickerSet.access_hash;
|
|
|
|
showDialog(new StickersAlert(getParentActivity(), DialogsActivity.this, set, null, null));
|
|
|
|
return;
|
|
|
|
} else if (object instanceof TLRPC.TL_recentMeUrlUnknown) {
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else if (adapter == dialogsSearchAdapter) {
|
|
|
|
Object obj = dialogsSearchAdapter.getItem(position);
|
|
|
|
isGlobalSearch = dialogsSearchAdapter.isGlobalSearch(position);
|
|
|
|
if (obj instanceof TLRPC.User) {
|
2020-01-03 16:45:22 +01:00
|
|
|
dialogId = ((TLRPC.User) obj).id;
|
2019-12-31 14:08:08 +01:00
|
|
|
if (!onlySelect) {
|
2020-01-03 16:45:22 +01:00
|
|
|
searchDialogId = dialogId;
|
2019-12-31 14:08:08 +01:00
|
|
|
searchObject = (TLRPC.User) obj;
|
|
|
|
}
|
|
|
|
} else if (obj instanceof TLRPC.Chat) {
|
2020-01-03 16:45:22 +01:00
|
|
|
dialogId = -((TLRPC.Chat) obj).id;
|
2019-12-31 14:08:08 +01:00
|
|
|
if (!onlySelect) {
|
2020-01-03 16:45:22 +01:00
|
|
|
searchDialogId = dialogId;
|
2019-12-31 14:08:08 +01:00
|
|
|
searchObject = (TLRPC.Chat) obj;
|
|
|
|
}
|
|
|
|
} else if (obj instanceof TLRPC.EncryptedChat) {
|
2020-01-03 16:45:22 +01:00
|
|
|
dialogId = ((long) ((TLRPC.EncryptedChat) obj).id) << 32;
|
2019-12-31 14:08:08 +01:00
|
|
|
if (!onlySelect) {
|
2020-01-03 16:45:22 +01:00
|
|
|
searchDialogId = dialogId;
|
2019-12-31 14:08:08 +01:00
|
|
|
searchObject = (TLRPC.EncryptedChat) obj;
|
|
|
|
}
|
|
|
|
} else if (obj instanceof MessageObject) {
|
|
|
|
MessageObject messageObject = (MessageObject) obj;
|
2020-01-03 16:45:22 +01:00
|
|
|
dialogId = messageObject.getDialogId();
|
2019-12-31 14:08:08 +01:00
|
|
|
message_id = messageObject.getId();
|
|
|
|
dialogsSearchAdapter.addHashtagsFromMessage(dialogsSearchAdapter.getLastSearchString());
|
|
|
|
} else if (obj instanceof String) {
|
|
|
|
String str = (String) obj;
|
|
|
|
if (dialogsSearchAdapter.isHashtagSearch()) {
|
|
|
|
actionBar.openSearchField(str, false);
|
|
|
|
} else if (!str.equals("section")) {
|
|
|
|
NewContactActivity activity = new NewContactActivity();
|
|
|
|
activity.setInitialPhoneNumber(str);
|
|
|
|
presentFragment(activity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-03 16:45:22 +01:00
|
|
|
if (dialogId == 0) {
|
2019-12-31 14:08:08 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (onlySelect) {
|
2020-01-03 16:45:22 +01:00
|
|
|
if (!validateSlowModeDialog(dialogId)) {
|
2019-12-31 14:08:08 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (dialogsAdapter.hasSelectedDialogs()) {
|
2020-01-03 16:45:22 +01:00
|
|
|
boolean checked = dialogsAdapter.addOrRemoveSelectedDialog(dialogId, view);
|
|
|
|
if (adapter == dialogsSearchAdapter) {
|
|
|
|
actionBar.closeSearchField();
|
|
|
|
findAndUpdateCheckBox(dialogId, checked);
|
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
updateSelectedCount();
|
|
|
|
} else {
|
2020-01-03 16:45:22 +01:00
|
|
|
didSelectResult(dialogId, true, false);
|
2019-12-31 14:08:08 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Bundle args = new Bundle();
|
2020-01-03 16:45:22 +01:00
|
|
|
int lower_part = (int) dialogId;
|
|
|
|
int high_id = (int) (dialogId >> 32);
|
2019-12-31 14:08:08 +01:00
|
|
|
if (lower_part != 0) {
|
|
|
|
if (lower_part > 0) {
|
|
|
|
args.putInt("user_id", lower_part);
|
|
|
|
} else if (lower_part < 0) {
|
|
|
|
if (message_id != 0) {
|
|
|
|
TLRPC.Chat chat = getMessagesController().getChat(-lower_part);
|
|
|
|
if (chat != null && chat.migrated_to != null) {
|
|
|
|
args.putInt("migrated_to", lower_part);
|
|
|
|
lower_part = -chat.migrated_to.channel_id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
args.putInt("chat_id", -lower_part);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
args.putInt("enc_id", high_id);
|
|
|
|
}
|
|
|
|
if (message_id != 0) {
|
|
|
|
args.putInt("message_id", message_id);
|
|
|
|
} else if (!isGlobalSearch) {
|
|
|
|
closeSearch();
|
|
|
|
} else {
|
|
|
|
if (searchObject != null) {
|
|
|
|
dialogsSearchAdapter.putRecentSearch(searchDialogId, searchObject);
|
|
|
|
searchObject = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (AndroidUtilities.isTablet()) {
|
2020-01-03 16:45:22 +01:00
|
|
|
if (openedDialogId == dialogId && adapter != dialogsSearchAdapter) {
|
2019-12-31 14:08:08 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (dialogsAdapter != null) {
|
2020-01-03 16:45:22 +01:00
|
|
|
dialogsAdapter.setOpenedDialogId(openedDialogId = dialogId);
|
2019-12-31 14:08:08 +01:00
|
|
|
updateVisibleRows(MessagesController.UPDATE_MASK_SELECT_DIALOG);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (searchString != null) {
|
|
|
|
if (getMessagesController().checkCanOpenChat(args, DialogsActivity.this)) {
|
|
|
|
getNotificationCenter().postNotificationName(NotificationCenter.closeChats);
|
|
|
|
presentFragment(new ChatActivity(args));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (getMessagesController().checkCanOpenChat(args, DialogsActivity.this)) {
|
|
|
|
presentFragment(new ChatActivity(args));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private boolean onItemLongClick(View view, int position, float x, float y, RecyclerListView.Adapter adapter) {
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!actionBar.isActionModeShowed() && !AndroidUtilities.isTablet() && !onlySelect && view instanceof DialogCell) {
|
|
|
|
DialogCell cell = (DialogCell) view;
|
|
|
|
if (cell.isPointInsideAvatar(x, y)) {
|
|
|
|
long dialog_id = cell.getDialogId();
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
int lower_part = (int) dialog_id;
|
|
|
|
int high_id = (int) (dialog_id >> 32);
|
|
|
|
int message_id = cell.getMessageId();
|
|
|
|
if (lower_part != 0) {
|
|
|
|
if (lower_part > 0) {
|
|
|
|
args.putInt("user_id", lower_part);
|
|
|
|
} else if (lower_part < 0) {
|
|
|
|
if (message_id != 0) {
|
|
|
|
TLRPC.Chat chat = getMessagesController().getChat(-lower_part);
|
|
|
|
if (chat != null && chat.migrated_to != null) {
|
|
|
|
args.putInt("migrated_to", lower_part);
|
|
|
|
lower_part = -chat.migrated_to.channel_id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
args.putInt("chat_id", -lower_part);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (message_id != 0) {
|
|
|
|
args.putInt("message_id", message_id);
|
|
|
|
}
|
|
|
|
if (searchString != null) {
|
|
|
|
if (getMessagesController().checkCanOpenChat(args, DialogsActivity.this)) {
|
|
|
|
getNotificationCenter().postNotificationName(NotificationCenter.closeChats);
|
|
|
|
presentFragmentAsPreview(new ChatActivity(args));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (getMessagesController().checkCanOpenChat(args, DialogsActivity.this)) {
|
|
|
|
presentFragmentAsPreview(new ChatActivity(args));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (adapter == dialogsSearchAdapter) {
|
|
|
|
Object item = dialogsSearchAdapter.getItem(position);
|
|
|
|
/*if (item instanceof String || dialogsSearchAdapter.isRecentSearchDisplayed()) {
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
|
|
|
builder.setMessage(LocaleController.getString("ClearSearch", R.string.ClearSearch));
|
|
|
|
builder.setPositiveButton(LocaleController.getString("ClearButton", R.string.ClearButton).toUpperCase(), (dialogInterface, i) -> {
|
|
|
|
if (dialogsSearchAdapter.isRecentSearchDisplayed()) {
|
|
|
|
dialogsSearchAdapter.clearRecentSearch();
|
|
|
|
} else {
|
|
|
|
dialogsSearchAdapter.clearRecentHashtags();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
|
|
|
showDialog(builder.create());
|
|
|
|
return true;
|
|
|
|
}*/
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
final TLRPC.Dialog dialog;
|
|
|
|
ArrayList<TLRPC.Dialog> dialogs = getDialogsArray(currentAccount, dialogsType, folderId, dialogsListFrozen);
|
|
|
|
position = dialogsAdapter.fixPosition(position);
|
|
|
|
if (position < 0 || position >= dialogs.size()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
dialog = dialogs.get(position);
|
|
|
|
if (onlySelect) {
|
|
|
|
if (dialogsType != 3/* || selectAlertString != null*/) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!validateSlowModeDialog(dialog.id)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
dialogsAdapter.addOrRemoveSelectedDialog(dialog.id, view);
|
|
|
|
updateSelectedCount();
|
|
|
|
} else {
|
|
|
|
if (dialog instanceof TLRPC.TL_dialogFolder) {
|
|
|
|
BottomSheet.Builder builder = new BottomSheet.Builder(getParentActivity());
|
|
|
|
final boolean hasUnread = dialog.unread_count != 0;
|
|
|
|
|
|
|
|
int[] icons = new int[]{
|
|
|
|
hasUnread ? R.drawable.menu_read : 0,
|
|
|
|
SharedConfig.archiveHidden ? R.drawable.chats_pin : R.drawable.chats_unpin,
|
|
|
|
};
|
|
|
|
CharSequence[] items = new CharSequence[]{
|
|
|
|
hasUnread ? LocaleController.getString("MarkAllAsRead", R.string.MarkAllAsRead) : null,
|
|
|
|
SharedConfig.archiveHidden ? LocaleController.getString("PinInTheList", R.string.PinInTheList) : LocaleController.getString("HideAboveTheList", R.string.HideAboveTheList)
|
|
|
|
};
|
|
|
|
builder.setItems(items, icons, (d, which) -> {
|
|
|
|
if (which == 0) {
|
|
|
|
getMessagesStorage().readAllDialogs(1);
|
|
|
|
} else if (which == 1) {
|
|
|
|
View child = listView.getChildAt(0);
|
|
|
|
DialogCell dialogCell = null;
|
|
|
|
if (child instanceof DialogCell && ((DialogCell) child).isFolderCell()) {
|
|
|
|
dialogCell = (DialogCell) child;
|
|
|
|
}
|
|
|
|
listView.toggleArchiveHidden(true, dialogCell);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
showDialog(builder.create());
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (actionBar.isActionModeShowed() && dialog.pinned) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
showOrUpdateActionMode(dialog, view);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void updateFloatingButtonOffset() {
|
|
|
|
floatingButtonContainer.setTranslationY(floatingButtonTranslation - additionalFloatingTranslation * (1f - floatingButtonHideProgress));
|
|
|
|
}
|
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
private boolean hasHiddenArchive() {
|
2019-06-17 05:38:14 +02:00
|
|
|
return listView.getAdapter() == dialogsAdapter && !onlySelect
|
2019-10-30 07:29:52 +01:00
|
|
|
&& FilterPopup.DialogType.isDialogsType(dialogsType)
|
2019-06-17 05:38:14 +02:00
|
|
|
&& folderId == 0
|
|
|
|
&& FilterPopup.getInstance(currentAccount).hasHiddenArchive(dialogsType);
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private boolean waitingForDialogsAnimationEnd() {
|
|
|
|
return dialogsItemAnimator.isRunning() || dialogRemoveFinished != 0 || dialogInsertFinished != 0 || dialogChangeFinished != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void onDialogAnimationFinished() {
|
|
|
|
dialogRemoveFinished = 0;
|
|
|
|
dialogInsertFinished = 0;
|
|
|
|
dialogChangeFinished = 0;
|
|
|
|
AndroidUtilities.runOnUIThread(() -> {
|
2020-01-05 12:50:11 +01:00
|
|
|
if (folderId != 0 && (frozenDialogsList == null || frozenDialogsList.isEmpty())) {
|
2019-05-14 14:08:05 +02:00
|
|
|
listView.setEmptyView(null);
|
|
|
|
progressView.setVisibility(View.INVISIBLE);
|
|
|
|
finishFragment();
|
|
|
|
}
|
|
|
|
setDialogsListFrozen(false);
|
|
|
|
updateDialogIndices();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
private void hideActionMode(boolean animateCheck) {
|
|
|
|
actionBar.hideActionMode();
|
|
|
|
if (menuDrawable != null) {
|
|
|
|
actionBar.setBackButtonContentDescription(LocaleController.getString("AccDescrOpenMenu", R.string.AccDescrOpenMenu));
|
|
|
|
}
|
|
|
|
dialogsAdapter.getSelectedDialogs().clear();
|
|
|
|
if (menuDrawable != null) {
|
|
|
|
menuDrawable.setRotation(0, true);
|
|
|
|
} else if (backDrawable != null) {
|
|
|
|
backDrawable.setRotation(0, true);
|
|
|
|
}
|
|
|
|
allowMoving = false;
|
|
|
|
if (movingWas) {
|
|
|
|
getMessagesController().reorderPinnedDialogs(folderId, null, 0);
|
|
|
|
movingWas = false;
|
|
|
|
}
|
|
|
|
updateCounters(true);
|
|
|
|
dialogsAdapter.onReorderStateChanged(false);
|
|
|
|
updateVisibleRows(MessagesController.UPDATE_MASK_REORDER | MessagesController.UPDATE_MASK_CHECK | (animateCheck ? MessagesController.UPDATE_MASK_CHAT : 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
private int getPinnedCount() {
|
|
|
|
int pinnedCount = 0;
|
|
|
|
ArrayList<TLRPC.Dialog> dialogs = getMessagesController().getDialogs(folderId);
|
|
|
|
for (int a = 0, N = dialogs.size(); a < N; a++) {
|
|
|
|
TLRPC.Dialog dialog = dialogs.get(a);
|
|
|
|
if (dialog instanceof TLRPC.TL_dialogFolder) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
int lower_id = (int) dialog.id;
|
|
|
|
if (dialog.pinned) {
|
|
|
|
pinnedCount++;
|
2020-01-02 16:08:53 +01:00
|
|
|
} else if (!getMessagesController().isProxyDialog(dialog.id, false)) {
|
2019-05-14 14:08:05 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return pinnedCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void perfromSelectedDialogsAction(int action, boolean alert) {
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ArrayList<Long> selectedDialogs = dialogsAdapter.getSelectedDialogs();
|
|
|
|
int count = selectedDialogs.size();
|
|
|
|
if (action == archive) {
|
|
|
|
ArrayList<Long> copy = new ArrayList<>(selectedDialogs);
|
|
|
|
getMessagesController().addDialogToFolder(copy, folderId == 0 ? 1 : 0, -1, null, 0);
|
|
|
|
hideActionMode(false);
|
|
|
|
if (folderId == 0) {
|
|
|
|
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
2019-08-22 01:53:26 +02:00
|
|
|
boolean hintShowed = preferences.getBoolean("archivehint_l", false) || SharedConfig.archiveHidden;
|
|
|
|
if (!hintShowed) {
|
|
|
|
preferences.edit().putBoolean("archivehint_l", true).commit();
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
int undoAction;
|
|
|
|
if (hintShowed) {
|
|
|
|
undoAction = copy.size() > 1 ? UndoView.ACTION_ARCHIVE_FEW : UndoView.ACTION_ARCHIVE;
|
|
|
|
} else {
|
|
|
|
undoAction = copy.size() > 1 ? UndoView.ACTION_ARCHIVE_FEW_HINT : UndoView.ACTION_ARCHIVE_HINT;
|
|
|
|
}
|
|
|
|
getUndoView().showWithAction(0, undoAction, null, () -> getMessagesController().addDialogToFolder(copy, folderId == 0 ? 0 : 1, -1, null, 0));
|
|
|
|
} else {
|
|
|
|
ArrayList<TLRPC.Dialog> dialogs = getMessagesController().getDialogs(folderId);
|
|
|
|
if (dialogs.isEmpty()) {
|
|
|
|
listView.setEmptyView(null);
|
|
|
|
progressView.setVisibility(View.INVISIBLE);
|
|
|
|
finishFragment();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
} else if (action == pin && canPinCount != 0) {
|
|
|
|
int pinnedCount = 0;
|
|
|
|
int pinnedSecretCount = 0;
|
|
|
|
int newPinnedCount = 0;
|
|
|
|
int newPinnedSecretCount = 0;
|
|
|
|
ArrayList<TLRPC.Dialog> dialogs = getMessagesController().getDialogs(folderId);
|
|
|
|
for (int a = 0, N = dialogs.size(); a < N; a++) {
|
|
|
|
TLRPC.Dialog dialog = dialogs.get(a);
|
|
|
|
if (dialog instanceof TLRPC.TL_dialogFolder) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
int lower_id = (int) dialog.id;
|
|
|
|
if (dialog.pinned) {
|
|
|
|
if (lower_id == 0) {
|
|
|
|
pinnedSecretCount++;
|
|
|
|
} else {
|
|
|
|
pinnedCount++;
|
|
|
|
}
|
2020-01-02 16:08:53 +01:00
|
|
|
} else if (!getMessagesController().isProxyDialog(dialog.id, false)) {
|
2019-05-14 14:08:05 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
long selectedDialog = selectedDialogs.get(a);
|
|
|
|
TLRPC.Dialog dialog = getMessagesController().dialogs_dict.get(selectedDialog);
|
|
|
|
if (dialog == null || dialog.pinned) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
int lower_id = (int) selectedDialog;
|
|
|
|
if (lower_id == 0) {
|
|
|
|
newPinnedSecretCount++;
|
|
|
|
} else {
|
|
|
|
newPinnedCount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int maxPinnedCount;
|
2019-09-05 19:23:29 +02:00
|
|
|
if (folderId != 0 || NekoConfig.unlimitedPinnedDialogs) {
|
2019-05-14 14:08:05 +02:00
|
|
|
maxPinnedCount = getMessagesController().maxFolderPinnedDialogsCount;
|
|
|
|
} else {
|
|
|
|
maxPinnedCount = getMessagesController().maxPinnedDialogsCount;
|
|
|
|
}
|
|
|
|
if (newPinnedSecretCount + pinnedSecretCount > maxPinnedCount || newPinnedCount + pinnedCount > maxPinnedCount) {
|
2019-08-22 01:53:26 +02:00
|
|
|
AlertsCreator.showSimpleAlert(DialogsActivity.this, LocaleController.formatString("PinToTopLimitReached", R.string.PinToTopLimitReached, LocaleController.formatPluralString("Chats", maxPinnedCount)));
|
2019-05-14 14:08:05 +02:00
|
|
|
AndroidUtilities.shakeView(pinItem, 2, 0);
|
|
|
|
Vibrator v = (Vibrator) getParentActivity().getSystemService(Context.VIBRATOR_SERVICE);
|
|
|
|
if (v != null) {
|
|
|
|
v.vibrate(200);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else if ((action == delete || action == clear) && count > 1 && alert) {
|
2020-02-13 19:26:53 +01:00
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
if (action == delete) {
|
|
|
|
builder.setTitle(LocaleController.formatString("DeleteFewChatsTitle", R.string.DeleteFewChatsTitle, LocaleController.formatPluralString("ChatsSelected", count)));
|
|
|
|
builder.setMessage(LocaleController.getString("AreYouSureDeleteFewChats", R.string.AreYouSureDeleteFewChats));
|
|
|
|
builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), (dialog1, which) -> {
|
|
|
|
getMessagesController().setDialogsInTransaction(true);
|
|
|
|
perfromSelectedDialogsAction(action, false);
|
|
|
|
getMessagesController().setDialogsInTransaction(false);
|
|
|
|
MessagesController.getInstance(currentAccount).checkIfFolderEmpty(folderId);
|
|
|
|
if (folderId != 0 && getDialogsArray(currentAccount, dialogsType, folderId, false).size() == 0) {
|
|
|
|
listView.setEmptyView(null);
|
|
|
|
progressView.setVisibility(View.INVISIBLE);
|
|
|
|
finishFragment();
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
2020-02-13 19:26:53 +01:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
if (canClearCacheCount != 0) {
|
|
|
|
builder.setTitle(LocaleController.formatString("ClearCacheFewChatsTitle", R.string.ClearCacheFewChatsTitle, LocaleController.formatPluralString("ChatsSelectedClearCache", count)));
|
|
|
|
builder.setMessage(LocaleController.getString("AreYouSureClearHistoryCacheFewChats", R.string.AreYouSureClearHistoryCacheFewChats));
|
|
|
|
builder.setPositiveButton(LocaleController.getString("ClearHistoryCache", R.string.ClearHistoryCache), (dialog1, which) -> perfromSelectedDialogsAction(action, false));
|
|
|
|
} else {
|
|
|
|
builder.setTitle(LocaleController.formatString("ClearFewChatsTitle", R.string.ClearFewChatsTitle, LocaleController.formatPluralString("ChatsSelectedClear", count)));
|
|
|
|
builder.setMessage(LocaleController.getString("AreYouSureClearHistoryFewChats", R.string.AreYouSureClearHistoryFewChats));
|
|
|
|
builder.setPositiveButton(LocaleController.getString("ClearHistory", R.string.ClearHistory), (dialog1, which) -> perfromSelectedDialogsAction(action, false));
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
|
|
|
}
|
2020-02-13 19:26:53 +01:00
|
|
|
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
|
|
|
AlertDialog alertDialog = builder.create();
|
|
|
|
showDialog(alertDialog);
|
|
|
|
TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
|
|
|
|
if (button != null) {
|
|
|
|
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
} else if (action == block && alert) {
|
|
|
|
TLRPC.User user;
|
|
|
|
if (count == 1) {
|
|
|
|
long did = selectedDialogs.get(0);
|
|
|
|
user = getMessagesController().getUser((int) did);
|
|
|
|
} else {
|
|
|
|
user = null;
|
|
|
|
}
|
|
|
|
AlertsCreator.createBlockDialogAlert(DialogsActivity.this, count, canReportSpamCount != 0, user, (report, delete) -> {
|
|
|
|
for (int a = 0, N = selectedDialogs.size(); a < N; a++) {
|
|
|
|
long did = selectedDialogs.get(a);
|
|
|
|
int lowerId = (int) did;
|
|
|
|
if (report) {
|
|
|
|
TLRPC.User u = getMessagesController().getUser(lowerId);
|
|
|
|
getMessagesController().reportSpam(did, u, null, null, false);
|
|
|
|
}
|
|
|
|
if (delete) {
|
|
|
|
getMessagesController().deleteDialog(did, 0, true);
|
|
|
|
}
|
|
|
|
getMessagesController().blockUser(lowerId);
|
|
|
|
}
|
|
|
|
hideActionMode(false);
|
|
|
|
});
|
|
|
|
return;
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
|
|
|
boolean scrollToTop = false;
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
long selectedDialog = selectedDialogs.get(a);
|
|
|
|
TLRPC.Dialog dialog = getMessagesController().dialogs_dict.get(selectedDialog);
|
|
|
|
if (dialog == null) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
TLRPC.Chat chat;
|
|
|
|
TLRPC.User user = null;
|
|
|
|
int lower_id = (int) selectedDialog;
|
|
|
|
int high_id = (int) (selectedDialog >> 32);
|
|
|
|
if (lower_id != 0) {
|
|
|
|
if (lower_id > 0) {
|
|
|
|
user = getMessagesController().getUser(lower_id);
|
|
|
|
chat = null;
|
|
|
|
} else {
|
|
|
|
chat = getMessagesController().getChat(-lower_id);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
TLRPC.EncryptedChat encryptedChat = getMessagesController().getEncryptedChat(high_id);
|
|
|
|
chat = null;
|
|
|
|
if (encryptedChat != null) {
|
|
|
|
user = getMessagesController().getUser(encryptedChat.user_id);
|
|
|
|
} else {
|
|
|
|
user = new TLRPC.TL_userEmpty();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (chat == null && user == null) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
boolean isBot = user != null && user.bot && !MessagesController.isSupportUser(user);
|
|
|
|
if (action == pin) {
|
|
|
|
if (canPinCount != 0) {
|
|
|
|
if (dialog.pinned) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (getMessagesController().pinDialog(selectedDialog, true, null, -1)) {
|
|
|
|
scrollToTop = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!dialog.pinned) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (getMessagesController().pinDialog(selectedDialog, false, null, -1)) {
|
|
|
|
scrollToTop = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (action == read) {
|
|
|
|
if (canReadCount != 0) {
|
|
|
|
getMessagesController().markMentionsAsRead(selectedDialog);
|
2019-09-10 12:56:11 +02:00
|
|
|
getMessagesController().markDialogAsRead(selectedDialog, dialog.top_message, dialog.top_message, dialog.last_message_date, false, 0, true, 0);
|
2019-05-14 14:08:05 +02:00
|
|
|
} else {
|
|
|
|
getMessagesController().markDialogAsUnread(selectedDialog, null, 0);
|
|
|
|
}
|
|
|
|
} else if (action == delete || action == clear) {
|
|
|
|
if (count == 1) {
|
|
|
|
AlertsCreator.createClearOrDeleteDialogAlert(DialogsActivity.this, action == clear, chat, user, lower_id == 0, (param) -> {
|
|
|
|
hideActionMode(false);
|
|
|
|
if (action == clear && ChatObject.isChannel(chat) && (!chat.megagroup || !TextUtils.isEmpty(chat.username))) {
|
|
|
|
getMessagesController().deleteDialog(selectedDialog, 2, param);
|
|
|
|
} else {
|
|
|
|
if (action == delete && folderId != 0 && getDialogsArray(currentAccount, dialogsType, folderId, false).size() == 1) {
|
|
|
|
progressView.setVisibility(View.INVISIBLE);
|
|
|
|
}
|
|
|
|
getUndoView().showWithAction(selectedDialog, action == clear ? UndoView.ACTION_CLEAR : UndoView.ACTION_DELETE, () -> {
|
|
|
|
if (action == clear) {
|
|
|
|
getMessagesController().deleteDialog(selectedDialog, 1, param);
|
|
|
|
} else {
|
|
|
|
if (chat != null) {
|
|
|
|
if (ChatObject.isNotInChat(chat)) {
|
|
|
|
getMessagesController().deleteDialog(selectedDialog, 0, param);
|
|
|
|
} else {
|
|
|
|
TLRPC.User currentUser = getMessagesController().getUser(getUserConfig().getClientUserId());
|
|
|
|
getMessagesController().deleteUserFromChat((int) -selectedDialog, currentUser, null);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
getMessagesController().deleteDialog(selectedDialog, 0, param);
|
|
|
|
if (isBot) {
|
|
|
|
getMessagesController().blockUser((int) selectedDialog);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (AndroidUtilities.isTablet()) {
|
|
|
|
getNotificationCenter().postNotificationName(NotificationCenter.closeChats, selectedDialog);
|
|
|
|
}
|
|
|
|
MessagesController.getInstance(currentAccount).checkIfFolderEmpty(folderId);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
if (action == clear && canClearCacheCount != 0) {
|
|
|
|
getMessagesController().deleteDialog(selectedDialog, 2, false);
|
|
|
|
} else {
|
|
|
|
if (action == clear) {
|
|
|
|
getMessagesController().deleteDialog(selectedDialog, 1, false);
|
|
|
|
} else {
|
|
|
|
if (chat != null) {
|
|
|
|
if (ChatObject.isNotInChat(chat)) {
|
|
|
|
getMessagesController().deleteDialog(selectedDialog, 0, false);
|
|
|
|
} else {
|
|
|
|
TLRPC.User currentUser = getMessagesController().getUser(getUserConfig().getClientUserId());
|
|
|
|
getMessagesController().deleteUserFromChat((int) -selectedDialog, currentUser, null);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
getMessagesController().deleteDialog(selectedDialog, 0, false);
|
|
|
|
if (isBot) {
|
|
|
|
getMessagesController().blockUser((int) selectedDialog);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (AndroidUtilities.isTablet()) {
|
|
|
|
getNotificationCenter().postNotificationName(NotificationCenter.closeChats, selectedDialog);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (action == mute) {
|
|
|
|
if (count == 1 && canMuteCount == 1) {
|
|
|
|
showDialog(AlertsCreator.createMuteAlert(getParentActivity(), selectedDialog), dialog12 -> hideActionMode(true));
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
if (canUnmuteCount != 0) {
|
|
|
|
if (!getMessagesController().isDialogMuted(selectedDialog)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
getNotificationsController().setDialogNotificationsSettings(selectedDialog, NotificationsController.SETTING_MUTE_UNMUTE);
|
|
|
|
} else {
|
|
|
|
if (getMessagesController().isDialogMuted(selectedDialog)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
getNotificationsController().setDialogNotificationsSettings(selectedDialog, NotificationsController.SETTING_MUTE_FOREVER);
|
|
|
|
}
|
|
|
|
}
|
2020-02-13 19:26:53 +01:00
|
|
|
} else if (action == block) {
|
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (action == pin) {
|
|
|
|
getMessagesController().reorderPinnedDialogs(folderId, null, 0);
|
|
|
|
}
|
|
|
|
if (scrollToTop) {
|
|
|
|
hideFloatingButton(false);
|
2019-12-31 14:08:08 +01:00
|
|
|
scrollToTop();
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
|
|
|
hideActionMode(action != pin && action != delete);
|
|
|
|
}
|
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
private void scrollToTop() {
|
|
|
|
int scrollDistance = layoutManager.findFirstVisibleItemPosition() * AndroidUtilities.dp(SharedConfig.useThreeLinesLayout ? 78 : 72);
|
|
|
|
int position = hasHiddenArchive() ? 1 : 0;
|
|
|
|
if (scrollDistance >= listView.getMeasuredHeight() * 1.2f) {
|
|
|
|
scrollHelper.setScrollDirection(RecyclerAnimationScrollHelper.SCROLL_DIRECTION_UP);
|
|
|
|
scrollHelper.scrollToPosition(position, 0, false, true);
|
|
|
|
} else {
|
|
|
|
listView.smoothScrollToPosition(position);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
private void updateCounters(boolean hide) {
|
|
|
|
int canClearHistoryCount = 0;
|
|
|
|
int canDeleteCount = 0;
|
|
|
|
int canUnpinCount = 0;
|
|
|
|
int canArchiveCount = 0;
|
|
|
|
int canUnarchiveCount = 0;
|
|
|
|
canUnmuteCount = 0;
|
|
|
|
canMuteCount = 0;
|
|
|
|
canPinCount = 0;
|
|
|
|
canReadCount = 0;
|
|
|
|
canClearCacheCount = 0;
|
2020-02-13 19:26:53 +01:00
|
|
|
int cantBlockCount = 0;
|
|
|
|
canReportSpamCount = 0;
|
2019-05-14 14:08:05 +02:00
|
|
|
if (hide) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ArrayList<Long> selectedDialogs = dialogsAdapter.getSelectedDialogs();
|
|
|
|
int count = selectedDialogs.size();
|
2020-02-13 19:26:53 +01:00
|
|
|
int selfUserId = getUserConfig().getClientUserId();
|
|
|
|
SharedPreferences preferences = getNotificationsSettings();
|
2019-05-14 14:08:05 +02:00
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
TLRPC.Dialog dialog = getMessagesController().dialogs_dict.get(selectedDialogs.get(a));
|
|
|
|
if (dialog == null) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
long selectedDialog = dialog.id;
|
|
|
|
boolean pinned = dialog.pinned;
|
|
|
|
boolean hasUnread = dialog.unread_count != 0 || dialog.unread_mark;
|
|
|
|
if (getMessagesController().isDialogMuted(selectedDialog)) {
|
|
|
|
canUnmuteCount++;
|
|
|
|
} else {
|
|
|
|
canMuteCount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hasUnread) {
|
|
|
|
canReadCount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (folderId == 1) {
|
|
|
|
canUnarchiveCount++;
|
2020-02-13 19:26:53 +01:00
|
|
|
} else if (selectedDialog != selfUserId && selectedDialog != 777000 && !getMessagesController().isProxyDialog(selectedDialog, false)) {
|
2019-05-14 14:08:05 +02:00
|
|
|
canArchiveCount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
int lower_id = (int) selectedDialog;
|
|
|
|
int high_id = (int) (selectedDialog >> 32);
|
|
|
|
|
2020-02-13 19:26:53 +01:00
|
|
|
if (lower_id <= 0 || lower_id == selfUserId) {
|
|
|
|
cantBlockCount++;
|
|
|
|
} else {
|
|
|
|
TLRPC.User user = getMessagesController().getUser(lower_id);
|
|
|
|
if (MessagesController.isSupportUser(user)) {
|
|
|
|
cantBlockCount++;
|
|
|
|
} else {
|
|
|
|
if (lower_id == 0 || preferences.getBoolean("dialog_bar_report" + selectedDialog, true)) {
|
|
|
|
canReportSpamCount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
if (DialogObject.isChannel(dialog)) {
|
|
|
|
final TLRPC.Chat chat = getMessagesController().getChat(-lower_id);
|
|
|
|
CharSequence[] items;
|
2019-06-04 12:14:50 +02:00
|
|
|
if (getMessagesController().isProxyDialog(dialog.id, true)) {
|
2019-05-14 14:08:05 +02:00
|
|
|
canClearCacheCount++;
|
|
|
|
} else {
|
|
|
|
if (pinned) {
|
|
|
|
canUnpinCount++;
|
|
|
|
} else {
|
|
|
|
canPinCount++;
|
|
|
|
}
|
|
|
|
if (chat != null && chat.megagroup) {
|
|
|
|
if (TextUtils.isEmpty(chat.username)) {
|
|
|
|
canClearHistoryCount++;
|
|
|
|
} else {
|
|
|
|
canClearCacheCount++;
|
|
|
|
}
|
|
|
|
canDeleteCount++;
|
|
|
|
} else {
|
|
|
|
canClearCacheCount++;
|
|
|
|
canDeleteCount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
final boolean isChat = lower_id < 0 && high_id != 1;
|
|
|
|
TLRPC.User user;
|
|
|
|
TLRPC.Chat chat = isChat ? getMessagesController().getChat(-lower_id) : null;
|
|
|
|
if (lower_id == 0) {
|
|
|
|
TLRPC.EncryptedChat encryptedChat = getMessagesController().getEncryptedChat(high_id);
|
|
|
|
if (encryptedChat != null) {
|
|
|
|
user = getMessagesController().getUser(encryptedChat.user_id);
|
|
|
|
} else {
|
|
|
|
user = new TLRPC.TL_userEmpty();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
user = !isChat && lower_id > 0 && high_id != 1 ? getMessagesController().getUser(lower_id) : null;
|
|
|
|
}
|
|
|
|
final boolean isBot = user != null && user.bot && !MessagesController.isSupportUser(user);
|
|
|
|
|
|
|
|
if (pinned) {
|
|
|
|
canUnpinCount++;
|
|
|
|
} else {
|
|
|
|
canPinCount++;
|
|
|
|
}
|
|
|
|
canClearHistoryCount++;
|
|
|
|
canDeleteCount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (canDeleteCount != count) {
|
|
|
|
deleteItem.setVisibility(View.GONE);
|
|
|
|
} else {
|
|
|
|
deleteItem.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
if (canClearCacheCount != 0 && canClearCacheCount != count || canClearHistoryCount != 0 && canClearHistoryCount != count) {
|
|
|
|
clearItem.setVisibility(View.GONE);
|
|
|
|
} else {
|
|
|
|
clearItem.setVisibility(View.VISIBLE);
|
|
|
|
if (canClearCacheCount != 0) {
|
|
|
|
clearItem.setText(LocaleController.getString("ClearHistoryCache", R.string.ClearHistoryCache));
|
|
|
|
} else {
|
|
|
|
clearItem.setText(LocaleController.getString("ClearHistory", R.string.ClearHistory));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (canUnarchiveCount != 0) {
|
2019-09-10 12:56:11 +02:00
|
|
|
archiveItem.setTextAndIcon(LocaleController.getString("Unarchive", R.string.Unarchive), R.drawable.msg_unarchive);
|
|
|
|
archiveItem.setVisibility(View.VISIBLE);
|
|
|
|
} else if (canArchiveCount != 0) {
|
|
|
|
archiveItem.setTextAndIcon(LocaleController.getString("Archive", R.string.Archive), R.drawable.msg_archive);
|
|
|
|
archiveItem.setVisibility(View.VISIBLE);
|
2019-05-14 14:08:05 +02:00
|
|
|
} else {
|
2019-09-10 12:56:11 +02:00
|
|
|
archiveItem.setVisibility(View.GONE);
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
|
|
|
if (canPinCount + canUnpinCount != count) {
|
|
|
|
pinItem.setVisibility(View.GONE);
|
|
|
|
} else {
|
|
|
|
pinItem.setVisibility(View.VISIBLE);
|
|
|
|
}
|
2020-02-13 19:26:53 +01:00
|
|
|
if (cantBlockCount != 0) {
|
|
|
|
blockItem.setVisibility(View.GONE);
|
|
|
|
} else {
|
|
|
|
blockItem.setVisibility(View.VISIBLE);
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
if (canUnmuteCount != 0) {
|
2019-09-10 12:56:11 +02:00
|
|
|
muteItem.setIcon(R.drawable.msg_unmute);
|
|
|
|
muteItem.setContentDescription(LocaleController.getString("ChatsUnmute", R.string.ChatsUnmute));
|
2019-05-14 14:08:05 +02:00
|
|
|
} else {
|
2019-09-10 12:56:11 +02:00
|
|
|
muteItem.setIcon(R.drawable.msg_mute);
|
|
|
|
muteItem.setContentDescription(LocaleController.getString("ChatsMute", R.string.ChatsMute));
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
|
|
|
if (canReadCount != 0) {
|
|
|
|
readItem.setTextAndIcon(LocaleController.getString("MarkAsRead", R.string.MarkAsRead), R.drawable.msg_markread);
|
|
|
|
} else {
|
|
|
|
readItem.setTextAndIcon(LocaleController.getString("MarkAsUnread", R.string.MarkAsUnread), R.drawable.msg_markunread);
|
|
|
|
}
|
|
|
|
if (canPinCount != 0) {
|
|
|
|
pinItem.setIcon(R.drawable.msg_pin);
|
|
|
|
pinItem.setContentDescription(LocaleController.getString("PinToTop", R.string.PinToTop));
|
|
|
|
} else {
|
|
|
|
pinItem.setIcon(R.drawable.msg_unpin);
|
|
|
|
pinItem.setContentDescription(LocaleController.getString("UnpinFromTop", R.string.UnpinFromTop));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-22 01:53:26 +02:00
|
|
|
private boolean validateSlowModeDialog(long dialogId) {
|
|
|
|
if (messagesCount <= 1 && (commentView == null || commentView.getVisibility() != View.VISIBLE || TextUtils.isEmpty(commentView.getFieldText()))) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
int lowerId = (int) dialogId;
|
|
|
|
if (lowerId >= 0) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
TLRPC.Chat chat = getMessagesController().getChat(-lowerId);
|
|
|
|
if (chat != null && !ChatObject.hasAdminRights(chat) && chat.slowmode_enabled) {
|
|
|
|
AlertsCreator.showSimpleAlert(DialogsActivity.this, LocaleController.getString("Slowmode", R.string.Slowmode), LocaleController.getString("SlowmodeSendError", R.string.SlowmodeSendError));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
private void showOrUpdateActionMode(TLRPC.Dialog dialog, View cell) {
|
|
|
|
dialogsAdapter.addOrRemoveSelectedDialog(dialog.id, cell);
|
|
|
|
ArrayList<Long> selectedDialogs = dialogsAdapter.getSelectedDialogs();
|
|
|
|
boolean updateAnimated = false;
|
|
|
|
if (actionBar.isActionModeShowed()) {
|
|
|
|
if (selectedDialogs.isEmpty()) {
|
|
|
|
hideActionMode(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
updateAnimated = true;
|
|
|
|
} else {
|
|
|
|
final ActionBarMenu actionMode = actionBar.createActionMode();
|
|
|
|
actionBar.showActionMode();
|
|
|
|
if (menuDrawable != null) {
|
|
|
|
actionBar.setBackButtonContentDescription(LocaleController.getString("AccDescrGoBack", R.string.AccDescrGoBack));
|
|
|
|
}
|
|
|
|
if (getPinnedCount() > 1) {
|
|
|
|
dialogsAdapter.onReorderStateChanged(true);
|
|
|
|
updateVisibleRows(MessagesController.UPDATE_MASK_REORDER);
|
|
|
|
}
|
|
|
|
|
|
|
|
AnimatorSet animatorSet = new AnimatorSet();
|
|
|
|
ArrayList<Animator> animators = new ArrayList<>();
|
|
|
|
for (int a = 0; a < actionModeViews.size(); a++) {
|
|
|
|
View view = actionModeViews.get(a);
|
|
|
|
view.setPivotY(ActionBar.getCurrentActionBarHeight() / 2);
|
|
|
|
AndroidUtilities.clearDrawableAnimation(view);
|
|
|
|
animators.add(ObjectAnimator.ofFloat(view, View.SCALE_Y, 0.1f, 1.0f));
|
|
|
|
}
|
|
|
|
animatorSet.playTogether(animators);
|
2019-12-31 14:08:08 +01:00
|
|
|
animatorSet.setDuration(200);
|
2019-05-14 14:08:05 +02:00
|
|
|
animatorSet.start();
|
|
|
|
if (menuDrawable != null) {
|
|
|
|
menuDrawable.setRotateToBack(false);
|
|
|
|
menuDrawable.setRotation(1, true);
|
|
|
|
} else if (backDrawable != null) {
|
|
|
|
backDrawable.setRotation(1, true);
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
updateCounters(false);
|
|
|
|
selectedDialogsCountTextView.setNumber(selectedDialogs.size(), updateAnimated);
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private void closeSearch() {
|
|
|
|
if (AndroidUtilities.isTablet()) {
|
|
|
|
if (actionBar != null) {
|
|
|
|
actionBar.closeSearchField();
|
|
|
|
}
|
|
|
|
if (searchObject != null) {
|
|
|
|
dialogsSearchAdapter.putRecentSearch(searchDialogId, searchObject);
|
|
|
|
searchObject = null;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
closeSearchFieldOnHide = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*private void checkUnreadCount(boolean animated) {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (!BuildVars.DEBUG_PRIVATE_VERSION) {
|
|
|
|
return;
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
int newCount = getMessagesController().unreadUnmutedDialogs;
|
2018-07-30 04:07:02 +02:00
|
|
|
if (newCount != currentUnreadCount) {
|
|
|
|
currentUnreadCount = newCount;
|
|
|
|
if (unreadFloatingButtonContainer != null) {
|
|
|
|
if (currentUnreadCount > 0) {
|
|
|
|
unreadFloatingButtonCounter.setText(String.format("%d", currentUnreadCount));
|
|
|
|
}
|
|
|
|
checkUnreadButton(animated);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void checkUnreadButton(boolean animated) {
|
|
|
|
if (!onlySelect && listView.getAdapter() == dialogsAdapter) {
|
|
|
|
boolean found = false;
|
|
|
|
if (currentUnreadCount > 0) {
|
|
|
|
int middle = listView.getMeasuredHeight() / 2;
|
|
|
|
int firstVisibleItem = layoutManager.findFirstVisibleItemPosition();
|
|
|
|
int count = listView.getChildCount();
|
|
|
|
int unreadOnScreen = 0;
|
|
|
|
for (int b = 0; b < count; b++) {
|
|
|
|
View child = listView.getChildAt(b);
|
|
|
|
if (child instanceof DialogCell) {
|
|
|
|
if (((DialogCell) child).isUnread()) {
|
|
|
|
unreadOnScreen++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int b = 0; b < count; b++) {
|
|
|
|
View child = listView.getChildAt(b);
|
|
|
|
if (child instanceof DialogCell) {
|
|
|
|
if (child.getTop() <= middle && child.getBottom() >= middle) {
|
|
|
|
RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.findContainingViewHolder(child);
|
|
|
|
if (holder != null) {
|
2019-05-14 14:08:05 +02:00
|
|
|
ArrayList<TLRPC.Dialog> array = getDialogsArray();
|
2018-07-30 04:07:02 +02:00
|
|
|
if (firstVisibleItem == 0) {
|
|
|
|
if (unreadOnScreen != currentUnreadCount) {
|
|
|
|
for (int a = holder.getAdapterPosition() + 1, size = array.size(); a < size; a++) {
|
2019-05-14 14:08:05 +02:00
|
|
|
TLRPC.Dialog dialog = array.get(a);
|
|
|
|
if ((dialog.unread_count != 0 || dialog.unread_mark) && !getMessagesController().isDialogMuted(dialog.id)) {
|
2018-07-30 04:07:02 +02:00
|
|
|
arrowDrawable.setAnimationProgressAnimated(1.0f);
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
found = true;
|
|
|
|
arrowDrawable.setAnimationProgressAnimated(0.0f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (found) {
|
|
|
|
if (unreadFloatingButtonContainer.getTag() == null) {
|
|
|
|
unreadFloatingButtonContainer.setTag(1);
|
|
|
|
unreadFloatingButtonContainer.setVisibility(View.VISIBLE);
|
|
|
|
if (animated) {
|
2019-05-14 14:08:05 +02:00
|
|
|
unreadFloatingButtonContainer.animate().alpha(1.0f).setDuration(200).setInterpolator(new DecelerateInterpolator()).setDelegate(null).start();
|
2018-07-30 04:07:02 +02:00
|
|
|
} else {
|
|
|
|
unreadFloatingButtonContainer.setAlpha(1.0f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (unreadFloatingButtonContainer.getTag() != null) {
|
|
|
|
unreadFloatingButtonContainer.setTag(null);
|
|
|
|
if (animated) {
|
2019-05-14 14:08:05 +02:00
|
|
|
unreadFloatingButtonContainer.animate().alpha(0.0f).setDuration(200).setInterpolator(new DecelerateInterpolator()).setDelegate(new AnimatorListenerAdapter() {
|
2018-07-30 04:07:02 +02:00
|
|
|
@Override
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
|
|
unreadFloatingButtonContainer.setVisibility(View.INVISIBLE);
|
|
|
|
}
|
|
|
|
}).start();
|
|
|
|
} else {
|
|
|
|
unreadFloatingButtonContainer.setAlpha(0.0f);
|
|
|
|
unreadFloatingButtonContainer.setVisibility(View.INVISIBLE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
}*/
|
2018-07-30 04:07:02 +02:00
|
|
|
|
2019-07-18 15:01:39 +02:00
|
|
|
protected RecyclerListView getListView() {
|
|
|
|
return listView;
|
|
|
|
}
|
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
protected RecyclerListView getSearchListView() {
|
|
|
|
return searchListView;
|
|
|
|
}
|
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
private UndoView getUndoView() {
|
|
|
|
if (undoView[0].getVisibility() == View.VISIBLE) {
|
|
|
|
UndoView old = undoView[0];
|
|
|
|
undoView[0] = undoView[1];
|
|
|
|
undoView[1] = old;
|
|
|
|
old.hide(true, 2);
|
|
|
|
ContentView contentView = (ContentView) fragmentView;
|
|
|
|
contentView.removeView(undoView[0]);
|
|
|
|
contentView.addView(undoView[0]);
|
|
|
|
}
|
|
|
|
return undoView[0];
|
|
|
|
}
|
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
private void updateProxyButton(boolean animated) {
|
|
|
|
if (proxyDrawable == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
|
|
|
String proxyAddress = preferences.getString("proxy_ip", "");
|
|
|
|
boolean proxyEnabled;
|
2019-05-14 14:08:05 +02:00
|
|
|
if ((proxyEnabled = preferences.getBoolean("proxy_enabled", false) && !TextUtils.isEmpty(proxyAddress)) || getMessagesController().blockedCountry && !SharedConfig.proxyList.isEmpty()) {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (!actionBar.isSearchFieldVisible()) {
|
|
|
|
proxyItem.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
proxyDrawable.setConnected(proxyEnabled, currentConnectionState == ConnectionsManager.ConnectionStateConnected || currentConnectionState == ConnectionsManager.ConnectionStateUpdating, animated);
|
|
|
|
proxyItemVisisble = true;
|
|
|
|
} else {
|
|
|
|
proxyItem.setVisibility(View.GONE);
|
|
|
|
proxyItemVisisble = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-08 18:35:59 +01:00
|
|
|
private void updateSelectedCount() {
|
|
|
|
if (commentView == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!dialogsAdapter.hasSelectedDialogs()) {
|
|
|
|
if (dialogsType == 3 && selectAlertString == null) {
|
|
|
|
actionBar.setTitle(LocaleController.getString("ForwardTo", R.string.ForwardTo));
|
|
|
|
} else {
|
|
|
|
actionBar.setTitle(LocaleController.getString("SelectChat", R.string.SelectChat));
|
|
|
|
}
|
|
|
|
if (commentView.getTag() != null) {
|
|
|
|
commentView.hidePopup(false);
|
|
|
|
commentView.closeKeyboard();
|
|
|
|
AnimatorSet animatorSet = new AnimatorSet();
|
2019-01-23 18:03:33 +01:00
|
|
|
animatorSet.playTogether(ObjectAnimator.ofFloat(commentView, View.TRANSLATION_Y, 0, commentView.getMeasuredHeight()));
|
2017-12-08 18:35:59 +01:00
|
|
|
animatorSet.setDuration(180);
|
|
|
|
animatorSet.setInterpolator(new DecelerateInterpolator());
|
|
|
|
animatorSet.addListener(new AnimatorListenerAdapter() {
|
|
|
|
@Override
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
|
|
commentView.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
animatorSet.start();
|
|
|
|
commentView.setTag(null);
|
|
|
|
listView.requestLayout();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (commentView.getTag() == null) {
|
|
|
|
commentView.setFieldText("");
|
|
|
|
commentView.setVisibility(View.VISIBLE);
|
|
|
|
AnimatorSet animatorSet = new AnimatorSet();
|
2019-01-23 18:03:33 +01:00
|
|
|
animatorSet.playTogether(ObjectAnimator.ofFloat(commentView, View.TRANSLATION_Y, commentView.getMeasuredHeight(), 0));
|
2017-12-08 18:35:59 +01:00
|
|
|
animatorSet.setDuration(180);
|
|
|
|
animatorSet.setInterpolator(new DecelerateInterpolator());
|
|
|
|
animatorSet.addListener(new AnimatorListenerAdapter() {
|
|
|
|
@Override
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
|
|
commentView.setTag(2);
|
2019-05-14 14:08:05 +02:00
|
|
|
commentView.requestLayout();
|
2017-12-08 18:35:59 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
animatorSet.start();
|
|
|
|
commentView.setTag(1);
|
|
|
|
}
|
|
|
|
actionBar.setTitle(LocaleController.formatPluralString("Recipient", dialogsAdapter.getSelectedDialogs().size()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
@TargetApi(Build.VERSION_CODES.M)
|
2018-07-30 04:07:02 +02:00
|
|
|
private void askForPermissons(boolean alert) {
|
2015-10-29 18:10:07 +01:00
|
|
|
Activity activity = getParentActivity();
|
|
|
|
if (activity == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ArrayList<String> permissons = new ArrayList<>();
|
2019-05-14 14:08:05 +02:00
|
|
|
if (getUserConfig().syncContacts && askAboutContacts && activity.checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (alert) {
|
2018-08-27 10:33:11 +02:00
|
|
|
AlertDialog.Builder builder = AlertsCreator.createContactsPermissionDialog(activity, param -> {
|
|
|
|
askAboutContacts = param != 0;
|
|
|
|
MessagesController.getGlobalNotificationsSettings().edit().putBoolean("askAboutContacts", askAboutContacts).commit();
|
|
|
|
askForPermissons(false);
|
2018-07-30 04:07:02 +02:00
|
|
|
});
|
|
|
|
showDialog(permissionDialog = builder.create());
|
|
|
|
return;
|
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
permissons.add(Manifest.permission.READ_CONTACTS);
|
|
|
|
permissons.add(Manifest.permission.WRITE_CONTACTS);
|
|
|
|
permissons.add(Manifest.permission.GET_ACCOUNTS);
|
|
|
|
}
|
|
|
|
if (activity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
|
|
|
permissons.add(Manifest.permission.READ_EXTERNAL_STORAGE);
|
|
|
|
permissons.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
if (permissons.isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
String[] items = permissons.toArray(new String[0]);
|
2017-07-23 19:29:17 +02:00
|
|
|
try {
|
|
|
|
activity.requestPermissions(items, 1);
|
|
|
|
} catch (Exception ignore) {
|
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onDialogDismiss(Dialog dialog) {
|
|
|
|
super.onDialogDismiss(dialog);
|
2019-05-14 14:08:05 +02:00
|
|
|
if (permissionDialog != null && dialog == permissionDialog && getParentActivity() != null) {
|
2018-07-30 04:07:02 +02:00
|
|
|
askForPermissons(false);
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
2014-11-06 22:34:47 +01:00
|
|
|
@Override
|
|
|
|
public void onConfigurationChanged(Configuration newConfig) {
|
|
|
|
super.onConfigurationChanged(newConfig);
|
2019-01-23 18:03:33 +01:00
|
|
|
if (!onlySelect && floatingButtonContainer != null) {
|
|
|
|
floatingButtonContainer.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
2014-11-06 22:34:47 +01:00
|
|
|
@Override
|
|
|
|
public void onGlobalLayout() {
|
2019-12-31 14:08:08 +01:00
|
|
|
floatingButtonTranslation = floatingHidden ? AndroidUtilities.dp(100) : 0;
|
|
|
|
updateFloatingButtonOffset();
|
2019-01-23 18:03:33 +01:00
|
|
|
//unreadFloatingButtonContainer.setTranslationY(floatingHidden ? AndroidUtilities.dp(74) : 0);
|
|
|
|
floatingButtonContainer.setClickable(!floatingHidden);
|
|
|
|
if (floatingButtonContainer != null) {
|
|
|
|
floatingButtonContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
2014-11-06 22:34:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
@Override
|
|
|
|
public void onRequestPermissionsResultFragment(int requestCode, String[] permissions, int[] grantResults) {
|
|
|
|
if (requestCode == 1) {
|
|
|
|
for (int a = 0; a < permissions.length; a++) {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (grantResults.length <= a) {
|
2015-10-29 18:10:07 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
switch (permissions[a]) {
|
|
|
|
case Manifest.permission.READ_CONTACTS:
|
2018-07-30 04:07:02 +02:00
|
|
|
if (grantResults[a] == PackageManager.PERMISSION_GRANTED) {
|
2019-05-14 14:08:05 +02:00
|
|
|
getContactsController().forceImportContacts();
|
2018-07-30 04:07:02 +02:00
|
|
|
} else {
|
|
|
|
MessagesController.getGlobalNotificationsSettings().edit().putBoolean("askAboutContacts", askAboutContacts = false).commit();
|
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
break;
|
|
|
|
case Manifest.permission.WRITE_EXTERNAL_STORAGE:
|
2018-07-30 04:07:02 +02:00
|
|
|
if (grantResults[a] == PackageManager.PERMISSION_GRANTED) {
|
|
|
|
ImageLoader.getInstance().checkMediaPaths();
|
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-16 17:06:55 +02:00
|
|
|
private String getNekoTitle() {
|
|
|
|
String title;
|
|
|
|
switch (dialogsType) {
|
|
|
|
case FilterPopup.DialogType.Users:
|
|
|
|
title = LocaleController.getString("Users", R.string.Users);
|
|
|
|
break;
|
|
|
|
case FilterPopup.DialogType.Groups:
|
|
|
|
title = LocaleController.getString("Groups", R.string.Groups);
|
|
|
|
break;
|
|
|
|
case FilterPopup.DialogType.Bots:
|
|
|
|
title = LocaleController.getString("Bots", R.string.Bots);
|
|
|
|
break;
|
|
|
|
case FilterPopup.DialogType.Channels:
|
|
|
|
title = LocaleController.getString("Channels", R.string.Channels);
|
|
|
|
break;
|
|
|
|
case FilterPopup.DialogType.Admin:
|
|
|
|
title = LocaleController.getString("Admins", R.string.Admins);
|
|
|
|
break;
|
2019-10-30 06:51:56 +01:00
|
|
|
case FilterPopup.DialogType.Unmuted:
|
|
|
|
title = LocaleController.getString("NotificationsUnmuted", R.string.NotificationsUnmuted);
|
|
|
|
break;
|
2019-06-16 17:06:55 +02:00
|
|
|
default:
|
|
|
|
if (folderId != 0) {
|
|
|
|
title = LocaleController.getString("ArchivedChats", R.string.ArchivedChats);
|
|
|
|
} else {
|
2020-01-08 18:08:16 +01:00
|
|
|
title = LocaleController.getString("Nekogram", R.string.Nekogram);
|
2019-06-16 17:06:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (FilterPopup.getInstance(currentAccount).getTotalUnreadCount() == 0) {
|
2020-01-08 18:08:16 +01:00
|
|
|
return LocaleController.getString("NekogramEmojiDialogs", R.string.NekogramEmojiDialogs) + " " + title;
|
2019-06-16 17:06:55 +02:00
|
|
|
}
|
2020-01-08 18:08:16 +01:00
|
|
|
return LocaleController.getString("NekogramEmojiDialogsUnread", R.string.NekogramEmojiDialogsUnread) + " " + title;
|
2019-06-16 17:06:55 +02:00
|
|
|
}
|
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
@Override
|
2018-07-30 04:07:02 +02:00
|
|
|
public void didReceivedNotification(int id, int account, Object... args) {
|
2020-02-16 04:11:17 +01:00
|
|
|
if (actionBar != null && id != NotificationCenter.didUpdateConnectionState) {
|
2019-06-16 17:06:55 +02:00
|
|
|
actionBar.setTitle(getNekoTitle());
|
2020-02-16 04:11:17 +01:00
|
|
|
}
|
2019-06-16 17:06:55 +02:00
|
|
|
|
2014-08-22 16:24:33 +02:00
|
|
|
if (id == NotificationCenter.dialogsNeedReload) {
|
2019-05-14 14:08:05 +02:00
|
|
|
if (dialogsListFrozen) {
|
|
|
|
return;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
//checkUnreadCount(true);
|
2014-11-20 15:45:33 +01:00
|
|
|
if (dialogsAdapter != null) {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (dialogsAdapter.isDataSetChanged() || args.length > 0) {
|
2015-02-26 02:32:51 +01:00
|
|
|
dialogsAdapter.notifyDataSetChanged();
|
|
|
|
} else {
|
|
|
|
updateVisibleRows(MessagesController.UPDATE_MASK_NEW_MESSAGE);
|
|
|
|
}
|
2014-11-20 15:45:33 +01:00
|
|
|
}
|
2015-05-21 23:27:27 +02:00
|
|
|
if (listView != null) {
|
2014-11-21 11:59:05 +01:00
|
|
|
try {
|
2019-12-31 14:08:08 +01:00
|
|
|
listView.setEmptyView(folderId == 0 ? progressView : null);
|
2014-11-21 11:59:05 +01:00
|
|
|
} catch (Exception e) {
|
2017-12-08 18:35:59 +01:00
|
|
|
FileLog.e(e);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (id == NotificationCenter.emojiDidLoad) {
|
2016-03-16 13:26:32 +01:00
|
|
|
updateVisibleRows(0);
|
2018-07-30 04:07:02 +02:00
|
|
|
} else if (id == NotificationCenter.closeSearchByActiveAction) {
|
|
|
|
if (actionBar != null) {
|
|
|
|
actionBar.closeSearchField();
|
|
|
|
}
|
|
|
|
} else if (id == NotificationCenter.proxySettingsChanged) {
|
|
|
|
updateProxyButton(false);
|
2014-08-22 16:24:33 +02:00
|
|
|
} else if (id == NotificationCenter.updateInterfaces) {
|
2018-07-30 04:07:02 +02:00
|
|
|
Integer mask = (Integer) args[0];
|
|
|
|
updateVisibleRows(mask);
|
2019-07-18 15:01:39 +02:00
|
|
|
if ((mask & MessagesController.UPDATE_MASK_STATUS) != 0 && dialogsAdapter != null) {
|
|
|
|
dialogsAdapter.sortOnlineContacts(true);
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
/*if ((mask & MessagesController.UPDATE_MASK_NEW_MESSAGE) != 0 || (mask & MessagesController.UPDATE_MASK_READ_DIALOG_MESSAGE) != 0) {
|
|
|
|
checkUnreadCount(true);
|
|
|
|
}*/
|
2014-08-22 16:24:33 +02:00
|
|
|
} else if (id == NotificationCenter.appDidLogout) {
|
2018-07-30 04:07:02 +02:00
|
|
|
dialogsLoaded[currentAccount] = false;
|
2014-08-22 16:24:33 +02:00
|
|
|
} else if (id == NotificationCenter.encryptedChatUpdated) {
|
2014-02-04 19:36:55 +01:00
|
|
|
updateVisibleRows(0);
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (id == NotificationCenter.contactsDidLoad) {
|
2019-05-14 14:08:05 +02:00
|
|
|
if (dialogsListFrozen) {
|
|
|
|
return;
|
|
|
|
}
|
2019-10-30 07:29:52 +01:00
|
|
|
if (FilterPopup.DialogType.isDialogsType(dialogsType) && getMessagesController().getDialogs(folderId).isEmpty()) {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (dialogsAdapter != null) {
|
|
|
|
dialogsAdapter.notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
updateVisibleRows(0);
|
|
|
|
}
|
2014-09-24 04:17:27 +02:00
|
|
|
} else if (id == NotificationCenter.openedChatChanged) {
|
2019-10-30 07:29:52 +01:00
|
|
|
if (FilterPopup.DialogType.isDialogsType(dialogsType) && AndroidUtilities.isTablet()) {
|
2015-05-21 23:27:27 +02:00
|
|
|
boolean close = (Boolean) args[1];
|
|
|
|
long dialog_id = (Long) args[0];
|
2014-09-30 00:48:11 +02:00
|
|
|
if (close) {
|
|
|
|
if (dialog_id == openedDialogId) {
|
|
|
|
openedDialogId = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
openedDialogId = dialog_id;
|
|
|
|
}
|
2014-11-19 11:32:27 +01:00
|
|
|
if (dialogsAdapter != null) {
|
|
|
|
dialogsAdapter.setOpenedDialogId(openedDialogId);
|
|
|
|
}
|
2014-11-11 23:16:17 +01:00
|
|
|
updateVisibleRows(MessagesController.UPDATE_MASK_SELECT_DIALOG);
|
2014-09-24 04:17:27 +02:00
|
|
|
}
|
2015-02-01 19:51:02 +01:00
|
|
|
} else if (id == NotificationCenter.notificationsSettingsUpdated) {
|
2015-02-26 02:32:51 +01:00
|
|
|
updateVisibleRows(0);
|
|
|
|
} else if (id == NotificationCenter.messageReceivedByAck || id == NotificationCenter.messageReceivedByServer || id == NotificationCenter.messageSendError) {
|
|
|
|
updateVisibleRows(MessagesController.UPDATE_MASK_SEND_STATE);
|
|
|
|
} else if (id == NotificationCenter.didSetPasscode) {
|
|
|
|
updatePasscodeButton();
|
2017-03-31 01:58:05 +02:00
|
|
|
} else if (id == NotificationCenter.needReloadRecentDialogsSearch) {
|
2015-09-24 22:52:02 +02:00
|
|
|
if (dialogsSearchAdapter != null) {
|
|
|
|
dialogsSearchAdapter.loadRecentSearch();
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (id == NotificationCenter.replyMessagesDidLoad) {
|
2018-07-30 04:07:02 +02:00
|
|
|
updateVisibleRows(MessagesController.UPDATE_MASK_MESSAGE_TEXT);
|
2016-05-25 23:49:47 +02:00
|
|
|
} else if (id == NotificationCenter.reloadHints) {
|
|
|
|
if (dialogsSearchAdapter != null) {
|
|
|
|
dialogsSearchAdapter.notifyDataSetChanged();
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (id == NotificationCenter.didUpdateConnectionState) {
|
2019-05-14 14:08:05 +02:00
|
|
|
int state = AccountInstance.getInstance(account).getConnectionsManager().getConnectionState();
|
2018-07-30 04:07:02 +02:00
|
|
|
if (currentConnectionState != state) {
|
|
|
|
currentConnectionState = state;
|
|
|
|
updateProxyButton(true);
|
|
|
|
}
|
|
|
|
} else if (id == NotificationCenter.dialogsUnreadCounterChanged) {
|
|
|
|
/*if (!onlySelect) {
|
|
|
|
int count = (Integer) args[0];
|
|
|
|
currentUnreadCount = count;
|
|
|
|
if (count != 0) {
|
|
|
|
unreadFloatingButtonCounter.setText(String.format("%d", count));
|
|
|
|
unreadFloatingButtonContainer.setVisibility(View.VISIBLE);
|
|
|
|
unreadFloatingButtonContainer.setTag(1);
|
2019-05-14 14:08:05 +02:00
|
|
|
unreadFloatingButtonContainer.animate().alpha(1.0f).setDuration(200).setInterpolator(new DecelerateInterpolator()).setDelegate(null).start();
|
2018-07-30 04:07:02 +02:00
|
|
|
} else {
|
|
|
|
unreadFloatingButtonContainer.setTag(null);
|
2019-05-14 14:08:05 +02:00
|
|
|
unreadFloatingButtonContainer.animate().alpha(0.0f).setDuration(200).setInterpolator(new DecelerateInterpolator()).setDelegate(new AnimatorListenerAdapter() {
|
2018-07-30 04:07:02 +02:00
|
|
|
@Override
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
|
|
unreadFloatingButtonContainer.setVisibility(View.INVISIBLE);
|
|
|
|
}
|
|
|
|
}).start();
|
|
|
|
}
|
|
|
|
}*/
|
2019-01-23 18:03:33 +01:00
|
|
|
} else if (id == NotificationCenter.needDeleteDialog) {
|
2019-07-18 15:01:39 +02:00
|
|
|
if (fragmentView == null || isPaused) {
|
2019-06-04 12:14:50 +02:00
|
|
|
return;
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
long dialogId = (Long) args[0];
|
|
|
|
TLRPC.User user = (TLRPC.User) args[1];
|
|
|
|
TLRPC.Chat chat = (TLRPC.Chat) args[2];
|
|
|
|
boolean revoke = (Boolean) args[3];
|
|
|
|
Runnable deleteRunnable = () -> {
|
|
|
|
if (chat != null) {
|
|
|
|
if (ChatObject.isNotInChat(chat)) {
|
|
|
|
getMessagesController().deleteDialog(dialogId, 0, revoke);
|
2019-01-23 18:03:33 +01:00
|
|
|
} else {
|
2019-05-14 14:08:05 +02:00
|
|
|
getMessagesController().deleteUserFromChat((int) -dialogId, getMessagesController().getUser(getUserConfig().getClientUserId()), null, false, revoke);
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
} else {
|
|
|
|
getMessagesController().deleteDialog(dialogId, 0, revoke);
|
|
|
|
}
|
2019-09-10 12:56:11 +02:00
|
|
|
MessagesController.getInstance(currentAccount).checkIfFolderEmpty(folderId);
|
2019-05-14 14:08:05 +02:00
|
|
|
};
|
|
|
|
if (undoView[0] != null) {
|
|
|
|
getUndoView().showWithAction(dialogId, UndoView.ACTION_DELETE, deleteRunnable);
|
|
|
|
} else {
|
|
|
|
deleteRunnable.run();
|
|
|
|
}
|
|
|
|
} else if (id == NotificationCenter.folderBecomeEmpty) {
|
|
|
|
int fid = (Integer) args[0];
|
|
|
|
if (folderId == fid && folderId != 0) {
|
|
|
|
finishFragment();
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
2015-02-26 02:32:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
private void setDialogsListFrozen(boolean frozen) {
|
|
|
|
if (dialogsListFrozen == frozen) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (frozen) {
|
|
|
|
frozenDialogsList = new ArrayList<>(getDialogsArray(currentAccount, dialogsType, folderId, false));
|
|
|
|
} else {
|
|
|
|
frozenDialogsList = null;
|
|
|
|
}
|
|
|
|
dialogsListFrozen = frozen;
|
|
|
|
dialogsAdapter.setDialogsListFrozen(frozen);
|
|
|
|
if (!frozen) {
|
|
|
|
dialogsAdapter.notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static ArrayList<TLRPC.Dialog> getDialogsArray(int currentAccount, int dialogsType, int folderId, boolean frozen) {
|
|
|
|
if (frozen && frozenDialogsList != null) {
|
|
|
|
return frozenDialogsList;
|
|
|
|
}
|
2019-06-15 12:28:23 +02:00
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
MessagesController messagesController = AccountInstance.getInstance(currentAccount).getMessagesController();
|
2015-06-29 19:12:11 +02:00
|
|
|
if (dialogsType == 0) {
|
2019-05-14 14:08:05 +02:00
|
|
|
return messagesController.getDialogs(folderId);
|
2015-06-29 19:12:11 +02:00
|
|
|
} else if (dialogsType == 1) {
|
2019-05-14 14:08:05 +02:00
|
|
|
return messagesController.dialogsServerOnly;
|
2015-06-29 19:12:11 +02:00
|
|
|
} else if (dialogsType == 2) {
|
2019-05-14 14:08:05 +02:00
|
|
|
return messagesController.dialogsCanAddUsers;
|
2017-12-08 18:35:59 +01:00
|
|
|
} else if (dialogsType == 3) {
|
2019-05-14 14:08:05 +02:00
|
|
|
return messagesController.dialogsForward;
|
2019-02-08 03:30:32 +01:00
|
|
|
} else if (dialogsType == 4) {
|
2019-05-14 14:08:05 +02:00
|
|
|
return messagesController.dialogsUsersOnly;
|
2019-02-08 03:30:32 +01:00
|
|
|
} else if (dialogsType == 5) {
|
2019-05-14 14:08:05 +02:00
|
|
|
return messagesController.dialogsChannelsOnly;
|
2019-03-03 21:40:48 +01:00
|
|
|
} else if (dialogsType == 6) {
|
2019-05-14 14:08:05 +02:00
|
|
|
return messagesController.dialogsGroupsOnly;
|
2019-06-11 10:40:16 +02:00
|
|
|
} else {
|
2019-06-15 12:28:23 +02:00
|
|
|
return FilterPopup.getInstance(currentAccount).getDialogs(dialogsType, folderId);
|
2015-06-29 19:12:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-31 01:58:05 +02:00
|
|
|
public void setSideMenu(RecyclerView recyclerView) {
|
|
|
|
sideMenu = recyclerView;
|
|
|
|
sideMenu.setBackgroundColor(Theme.getColor(Theme.key_chats_menuBackground));
|
|
|
|
sideMenu.setGlowColor(Theme.getColor(Theme.key_chats_menuBackground));
|
|
|
|
}
|
|
|
|
|
2015-02-26 02:32:51 +01:00
|
|
|
private void updatePasscodeButton() {
|
|
|
|
if (passcodeItem == null) {
|
|
|
|
return;
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
if (SharedConfig.passcodeHash.length() != 0 && !searching) {
|
2015-02-26 02:32:51 +01:00
|
|
|
passcodeItem.setVisibility(View.VISIBLE);
|
2018-07-30 04:07:02 +02:00
|
|
|
if (SharedConfig.appLocked) {
|
2015-02-26 02:32:51 +01:00
|
|
|
passcodeItem.setIcon(R.drawable.lock_close);
|
2019-05-14 14:08:05 +02:00
|
|
|
passcodeItem.setContentDescription(LocaleController.getString("AccDescrPasscodeUnlock", R.string.AccDescrPasscodeUnlock));
|
2015-02-26 02:32:51 +01:00
|
|
|
} else {
|
|
|
|
passcodeItem.setIcon(R.drawable.lock_open);
|
2019-05-14 14:08:05 +02:00
|
|
|
passcodeItem.setContentDescription(LocaleController.getString("AccDescrPasscodeLock", R.string.AccDescrPasscodeLock));
|
2015-02-01 19:51:02 +01:00
|
|
|
}
|
2015-02-26 02:32:51 +01:00
|
|
|
} else {
|
|
|
|
passcodeItem.setVisibility(View.GONE);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-06 22:34:47 +01:00
|
|
|
private void hideFloatingButton(boolean hide) {
|
|
|
|
if (floatingHidden == hide) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
floatingHidden = hide;
|
2018-07-30 04:07:02 +02:00
|
|
|
AnimatorSet animatorSet = new AnimatorSet();
|
2019-12-31 14:08:08 +01:00
|
|
|
ValueAnimator valueAnimator = ValueAnimator.ofFloat(floatingButtonHideProgress,floatingHidden ? 1f : 0f);
|
|
|
|
valueAnimator.addUpdateListener(animation -> {
|
|
|
|
floatingButtonHideProgress = (float) animation.getAnimatedValue();
|
|
|
|
floatingButtonTranslation = AndroidUtilities.dp(100) * floatingButtonHideProgress;
|
|
|
|
updateFloatingButtonOffset();
|
|
|
|
});
|
|
|
|
animatorSet.playTogether(
|
|
|
|
valueAnimator/*,
|
2019-01-23 18:03:33 +01:00
|
|
|
ObjectAnimator.ofFloat(unreadFloatingButtonContainer, View.TRANSLATION_Y, floatingHidden ? AndroidUtilities.dp(74) : 0)*/);
|
2018-07-30 04:07:02 +02:00
|
|
|
animatorSet.setDuration(300);
|
|
|
|
animatorSet.setInterpolator(floatingInterpolator);
|
2019-01-23 18:03:33 +01:00
|
|
|
floatingButtonContainer.setClickable(!hide);
|
2018-07-30 04:07:02 +02:00
|
|
|
animatorSet.start();
|
2014-11-06 22:34:47 +01:00
|
|
|
}
|
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
private void updateDialogIndices() {
|
|
|
|
if (listView == null || listView.getAdapter() != dialogsAdapter) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ArrayList<TLRPC.Dialog> dialogs = getDialogsArray(currentAccount, dialogsType, folderId, false);
|
|
|
|
int count = listView.getChildCount();
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
View child = listView.getChildAt(a);
|
|
|
|
if (child instanceof DialogCell) {
|
|
|
|
DialogCell dialogCell = (DialogCell) child;
|
|
|
|
TLRPC.Dialog dialog = getMessagesController().dialogs_dict.get(dialogCell.getDialogId());
|
|
|
|
if (dialog == null) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
int index = dialogs.indexOf(dialog);
|
|
|
|
if (index < 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
dialogCell.setDialogIndex(index);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-04 19:36:55 +01:00
|
|
|
private void updateVisibleRows(int mask) {
|
2019-05-14 14:08:05 +02:00
|
|
|
if (listView == null || dialogsListFrozen) {
|
2014-02-04 19:36:55 +01:00
|
|
|
return;
|
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
for (int c = 0; c < 2; c++) {
|
|
|
|
RecyclerListView list = c == 0 ? listView : searchListView;
|
|
|
|
int count = list.getChildCount();
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
View child = list.getChildAt(a);
|
|
|
|
if (child instanceof DialogCell) {
|
|
|
|
if (list.getAdapter() != dialogsSearchAdapter) {
|
|
|
|
DialogCell cell = (DialogCell) child;
|
|
|
|
if ((mask & MessagesController.UPDATE_MASK_REORDER) != 0) {
|
|
|
|
cell.onReorderStateChanged(actionBar.isActionModeShowed(), true);
|
|
|
|
}
|
|
|
|
if ((mask & MessagesController.UPDATE_MASK_CHECK) != 0) {
|
|
|
|
cell.setChecked(false, (mask & MessagesController.UPDATE_MASK_CHAT) != 0);
|
|
|
|
} else {
|
|
|
|
if ((mask & MessagesController.UPDATE_MASK_NEW_MESSAGE) != 0) {
|
|
|
|
cell.checkCurrentDialogIndex(dialogsListFrozen);
|
2020-01-01 13:10:52 +01:00
|
|
|
if (FilterPopup.DialogType.isDialogsType(dialogsType) && AndroidUtilities.isTablet()) {
|
2019-12-31 14:08:08 +01:00
|
|
|
cell.setDialogSelected(cell.getDialogId() == openedDialogId);
|
|
|
|
}
|
|
|
|
} else if ((mask & MessagesController.UPDATE_MASK_SELECT_DIALOG) != 0) {
|
2020-01-01 13:10:52 +01:00
|
|
|
if (FilterPopup.DialogType.isDialogsType(dialogsType) && AndroidUtilities.isTablet()) {
|
2019-12-31 14:08:08 +01:00
|
|
|
cell.setDialogSelected(cell.getDialogId() == openedDialogId);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
cell.update(mask);
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
ArrayList<Long> selectedDialogs = dialogsAdapter.getSelectedDialogs();
|
|
|
|
if (selectedDialogs != null) {
|
|
|
|
cell.setChecked(selectedDialogs.contains(cell.getDialogId()), false);
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
2015-06-29 19:12:11 +02:00
|
|
|
}
|
2014-09-24 04:17:27 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
} else if (child instanceof UserCell) {
|
|
|
|
((UserCell) child).update(mask);
|
|
|
|
} else if (child instanceof ProfileSearchCell) {
|
|
|
|
((ProfileSearchCell) child).update(mask);
|
|
|
|
} else if (child instanceof RecyclerListView) {
|
|
|
|
RecyclerListView innerListView = (RecyclerListView) child;
|
|
|
|
int count2 = innerListView.getChildCount();
|
|
|
|
for (int b = 0; b < count2; b++) {
|
|
|
|
View child2 = innerListView.getChildAt(b);
|
|
|
|
if (child2 instanceof HintDialogCell) {
|
|
|
|
((HintDialogCell) child2).update(mask);
|
|
|
|
}
|
2016-05-25 23:49:47 +02:00
|
|
|
}
|
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-25 23:49:47 +02:00
|
|
|
public void setDelegate(DialogsActivityDelegate dialogsActivityDelegate) {
|
|
|
|
delegate = dialogsActivityDelegate;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
2015-03-19 00:09:45 +01:00
|
|
|
public void setSearchString(String string) {
|
|
|
|
searchString = string;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isMainDialogList() {
|
|
|
|
return delegate == null && searchString == null;
|
2014-09-24 04:17:27 +02:00
|
|
|
}
|
|
|
|
|
2014-07-10 23:15:39 +02:00
|
|
|
private void didSelectResult(final long dialog_id, boolean useAlert, final boolean param) {
|
2019-03-03 21:40:48 +01:00
|
|
|
if (addToGroupAlertString == null && checkCanWrite) {
|
2020-01-23 07:15:40 +01:00
|
|
|
int lowerId = (int) dialog_id;
|
|
|
|
if (lowerId < 0) {
|
|
|
|
TLRPC.Chat chat = getMessagesController().getChat(-lowerId);
|
|
|
|
if (ChatObject.isChannel(chat) && !chat.megagroup && ((cantSendToChannels || !ChatObject.isCanWriteToChannel(-lowerId, currentAccount)) || hasPoll == 2)) {
|
2017-03-31 01:58:05 +02:00
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
2019-12-31 14:08:08 +01:00
|
|
|
builder.setTitle(LocaleController.getString("SendMessageTitle", R.string.SendMessageTitle));
|
2020-01-23 07:15:40 +01:00
|
|
|
if (hasPoll == 2) {
|
|
|
|
builder.setMessage(LocaleController.getString("PublicPollCantForward", R.string.PublicPollCantForward));
|
|
|
|
} else {
|
|
|
|
builder.setMessage(LocaleController.getString("ChannelCantSendMessage", R.string.ChannelCantSendMessage));
|
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
builder.setNegativeButton(LocaleController.getString("OK", R.string.OK), null);
|
|
|
|
showDialog(builder.create());
|
|
|
|
return;
|
|
|
|
}
|
2020-01-23 07:15:40 +01:00
|
|
|
} else if (lowerId == 0 && hasPoll != 0) {
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
builder.setTitle(LocaleController.getString("SendMessageTitle", R.string.SendMessageTitle));
|
|
|
|
builder.setMessage(LocaleController.getString("PollCantForwardSecretChat", R.string.PollCantForwardSecretChat));
|
|
|
|
builder.setNegativeButton(LocaleController.getString("OK", R.string.OK), null);
|
|
|
|
showDialog(builder.create());
|
|
|
|
return;
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
}
|
2015-06-29 19:12:11 +02:00
|
|
|
if (useAlert && (selectAlertString != null && selectAlertStringGroup != null || addToGroupAlertString != null)) {
|
2014-06-14 10:36:01 +02:00
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
2014-06-04 01:31:48 +02:00
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
2015-05-21 23:27:27 +02:00
|
|
|
int lower_part = (int) dialog_id;
|
|
|
|
int high_id = (int) (dialog_id >> 32);
|
2019-12-31 14:08:08 +01:00
|
|
|
String title;
|
|
|
|
String message;
|
|
|
|
String buttonText;
|
2013-10-25 17:19:00 +02:00
|
|
|
if (lower_part != 0) {
|
2019-09-10 12:56:11 +02:00
|
|
|
if (lower_part == getUserConfig().getClientUserId()) {
|
2019-12-31 14:08:08 +01:00
|
|
|
title = LocaleController.getString("SendMessageTitle", R.string.SendMessageTitle);
|
|
|
|
message = LocaleController.formatStringSimple(selectAlertStringGroup, LocaleController.getString("SavedMessages", R.string.SavedMessages));
|
|
|
|
buttonText = LocaleController.getString("Send", R.string.Send);
|
2019-09-10 12:56:11 +02:00
|
|
|
} else if (lower_part > 0) {
|
|
|
|
TLRPC.User user = getMessagesController().getUser(lower_part);
|
2020-01-23 07:15:40 +01:00
|
|
|
if (user == null || selectAlertString == null) {
|
2019-09-10 12:56:11 +02:00
|
|
|
return;
|
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
title = LocaleController.getString("SendMessageTitle", R.string.SendMessageTitle);
|
|
|
|
message = LocaleController.formatStringSimple(selectAlertString, UserObject.getUserName(user));
|
|
|
|
buttonText = LocaleController.getString("Send", R.string.Send);
|
|
|
|
} else {
|
2019-09-10 12:56:11 +02:00
|
|
|
TLRPC.Chat chat = getMessagesController().getChat(-lower_part);
|
2014-02-04 19:36:55 +01:00
|
|
|
if (chat == null) {
|
|
|
|
return;
|
|
|
|
}
|
2019-09-10 12:56:11 +02:00
|
|
|
if (addToGroupAlertString != null) {
|
2019-12-31 14:08:08 +01:00
|
|
|
title = LocaleController.getString("AddToTheGroupAlertTitle", R.string.AddToTheGroupAlertTitle);
|
|
|
|
message = LocaleController.formatStringSimple(addToGroupAlertString, chat.title);
|
|
|
|
buttonText = LocaleController.getString("Add", R.string.Add);
|
2019-09-10 12:56:11 +02:00
|
|
|
} else {
|
2019-12-31 14:08:08 +01:00
|
|
|
title = LocaleController.getString("SendMessageTitle", R.string.SendMessageTitle);
|
|
|
|
message = LocaleController.formatStringSimple(selectAlertStringGroup, chat.title);
|
|
|
|
buttonText = LocaleController.getString("Send", R.string.Send);
|
2014-07-27 00:28:33 +02:00
|
|
|
}
|
2014-02-04 19:36:55 +01:00
|
|
|
}
|
2014-07-27 12:53:00 +02:00
|
|
|
} else {
|
2019-05-14 14:08:05 +02:00
|
|
|
TLRPC.EncryptedChat chat = getMessagesController().getEncryptedChat(high_id);
|
|
|
|
TLRPC.User user = getMessagesController().getUser(chat.user_id);
|
2014-07-27 12:53:00 +02:00
|
|
|
if (user == null) {
|
|
|
|
return;
|
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
title = LocaleController.getString("SendMessageTitle", R.string.SendMessageTitle);
|
|
|
|
message = LocaleController.formatStringSimple(selectAlertString, UserObject.getUserName(user));
|
|
|
|
buttonText = LocaleController.getString("Send", R.string.Send);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
builder.setTitle(title);
|
|
|
|
builder.setMessage(AndroidUtilities.replaceTags(message));
|
|
|
|
builder.setPositiveButton(buttonText, (dialogInterface, i) -> didSelectResult(dialog_id, false, false));
|
2015-03-19 00:09:45 +01:00
|
|
|
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
2015-05-21 23:27:27 +02:00
|
|
|
showDialog(builder.create());
|
2013-10-25 17:19:00 +02:00
|
|
|
} else {
|
|
|
|
if (delegate != null) {
|
2017-12-08 18:35:59 +01:00
|
|
|
ArrayList<Long> dids = new ArrayList<>();
|
|
|
|
dids.add(dialog_id);
|
|
|
|
delegate.didSelectDialogs(DialogsActivity.this, dids, null, param);
|
2019-07-18 15:01:39 +02:00
|
|
|
if (resetDelegate) {
|
|
|
|
delegate = null;
|
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
} else {
|
|
|
|
finishFragment();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public ThemeDescription[] getThemeDescriptions() {
|
2018-08-27 10:33:11 +02:00
|
|
|
ThemeDescription.ThemeDescriptionDelegate cellDelegate = () -> {
|
2019-12-31 14:08:08 +01:00
|
|
|
for (int b = 0; b < 2; b++) {
|
|
|
|
RecyclerListView view = b == 0 ? listView : searchListView;
|
|
|
|
if (view != null) {
|
|
|
|
int count = view.getChildCount();
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
View child = view.getChildAt(a);
|
|
|
|
if (child instanceof ProfileSearchCell) {
|
|
|
|
((ProfileSearchCell) child).update(0);
|
|
|
|
} else if (child instanceof DialogCell) {
|
|
|
|
((DialogCell) child).update(0);
|
|
|
|
} else if (child instanceof UserCell) {
|
|
|
|
((UserCell) child).update(0);
|
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
|
|
|
}
|
2018-08-27 10:33:11 +02:00
|
|
|
}
|
|
|
|
if (dialogsSearchAdapter != null) {
|
|
|
|
RecyclerListView recyclerListView = dialogsSearchAdapter.getInnerListView();
|
|
|
|
if (recyclerListView != null) {
|
|
|
|
int count = recyclerListView.getChildCount();
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
View child = recyclerListView.getChildAt(a);
|
|
|
|
if (child instanceof HintDialogCell) {
|
|
|
|
((HintDialogCell) child).update();
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-06-04 12:14:50 +02:00
|
|
|
if (sideMenu != null) {
|
|
|
|
View child = sideMenu.getChildAt(0);
|
|
|
|
if (child instanceof DrawerProfileCell) {
|
|
|
|
DrawerProfileCell profileCell = (DrawerProfileCell) child;
|
2019-07-18 15:01:39 +02:00
|
|
|
profileCell.applyBackground(true);
|
2019-12-31 14:08:08 +01:00
|
|
|
profileCell.updateColors();
|
2019-06-04 12:14:50 +02:00
|
|
|
}
|
|
|
|
}
|
2019-12-31 14:08:08 +01:00
|
|
|
if (pullForegroundDrawable != null) {
|
|
|
|
pullForegroundDrawable.updateColors();
|
|
|
|
}
|
|
|
|
if (actionBar != null) {
|
|
|
|
actionBar.setPopupBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground), true);
|
|
|
|
actionBar.setPopupItemsColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem), false, true);
|
|
|
|
actionBar.setPopupItemsColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItemIcon), true, true);
|
|
|
|
actionBar.setPopupItemsSelectorColor(Theme.getColor(Theme.key_dialogButtonSelector), true);
|
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
};
|
2019-05-14 14:08:05 +02:00
|
|
|
|
|
|
|
ArrayList<ThemeDescription> arrayList = new ArrayList<>();
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
|
|
|
|
|
|
|
|
if (movingView != null) {
|
|
|
|
arrayList.add(new ThemeDescription(movingView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (folderId == 0) {
|
|
|
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault));
|
|
|
|
arrayList.add(new ThemeDescription(listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
|
2019-12-31 14:08:08 +01:00
|
|
|
arrayList.add(new ThemeDescription(searchListView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
|
2019-05-14 14:08:05 +02:00
|
|
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon));
|
|
|
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, new Drawable[]{Theme.dialogs_holidayDrawable}, null, Theme.key_actionBarDefaultTitle));
|
|
|
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector));
|
|
|
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCH, null, null, null, null, Theme.key_actionBarDefaultSearch));
|
|
|
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCHPLACEHOLDER, null, null, null, null, Theme.key_actionBarDefaultSearchPlaceholder));
|
|
|
|
} else {
|
|
|
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefaultArchived));
|
|
|
|
arrayList.add(new ThemeDescription(listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefaultArchived));
|
2019-12-31 14:08:08 +01:00
|
|
|
arrayList.add(new ThemeDescription(searchListView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefaultArchived));
|
2019-05-14 14:08:05 +02:00
|
|
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultArchivedIcon));
|
|
|
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, new Drawable[]{Theme.dialogs_holidayDrawable}, null, Theme.key_actionBarDefaultArchivedTitle));
|
|
|
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultArchivedSelector));
|
|
|
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCH, null, null, null, null, Theme.key_actionBarDefaultArchivedSearch));
|
|
|
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCHPLACEHOLDER, null, null, null, null, Theme.key_actionBarDefaultArchivedSearchPlaceholder));
|
|
|
|
}
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_AM_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarActionModeDefaultIcon));
|
|
|
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_AM_BACKGROUND, null, null, null, null, Theme.key_actionBarActionModeDefault));
|
|
|
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_AM_TOPBACKGROUND, null, null, null, null, Theme.key_actionBarActionModeDefaultTop));
|
|
|
|
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_AM_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarActionModeDefaultSelector));
|
|
|
|
arrayList.add(new ThemeDescription(selectedDialogsCountTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_actionBarActionModeDefaultIcon));
|
2019-12-31 14:08:08 +01:00
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_actionBarDefaultSubmenuBackground));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_actionBarDefaultSubmenuItem));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_actionBarDefaultSubmenuItemIcon));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_dialogButtonSelector));
|
2019-05-14 14:08:05 +02:00
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(searchEmptyView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_emptyListPlaceholder));
|
|
|
|
arrayList.add(new ThemeDescription(searchEmptyView, ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_progressCircle));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(floatingButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionIcon));
|
|
|
|
arrayList.add(new ThemeDescription(floatingButton, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chats_actionBackground));
|
|
|
|
arrayList.add(new ThemeDescription(floatingButton, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_chats_actionPressedBackground));
|
|
|
|
|
|
|
|
/*new ThemeDescription(unreadFloatingButtonCounter, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_goDownButtonCounterBackground));
|
|
|
|
new ThemeDescription(unreadFloatingButtonCounter, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_goDownButtonCounter));
|
|
|
|
new ThemeDescription(unreadFloatingButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionUnreadIcon));
|
|
|
|
new ThemeDescription(unreadFloatingButton, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chats_actionUnreadBackground));
|
|
|
|
new ThemeDescription(unreadFloatingButton, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_chats_actionUnreadPressedBackground));*/
|
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
for (int a = 0; a < 2; a++) {
|
|
|
|
RecyclerListView list = a == 0 ? listView : searchListView;
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{View.class}, Theme.dividerPaint, null, null, Theme.key_divider));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class, ProfileSearchCell.class}, null, new Drawable[]{Theme.avatar_savedDrawable}, null, Theme.key_avatar_text));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, Theme.dialogs_countPaint, null, null, Theme.key_chats_unreadCounter));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, Theme.dialogs_countGrayPaint, null, null, Theme.key_chats_unreadCounterMuted));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, Theme.dialogs_countTextPaint, null, null, Theme.key_chats_unreadCounterText));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class, ProfileSearchCell.class}, null, new Drawable[]{Theme.dialogs_lockDrawable}, null, Theme.key_chats_secretIcon));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class, ProfileSearchCell.class}, null, new Drawable[]{Theme.dialogs_groupDrawable, Theme.dialogs_broadcastDrawable, Theme.dialogs_botDrawable}, null, Theme.key_chats_nameIcon));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class, ProfileSearchCell.class}, null, new Drawable[]{Theme.dialogs_scamDrawable}, null, Theme.key_chats_draft));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, null, new Drawable[]{Theme.dialogs_pinnedDrawable, Theme.dialogs_reorderDrawable}, null, Theme.key_chats_pinnedIcon));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class, ProfileSearchCell.class}, null, new Paint[]{Theme.dialogs_namePaint[0], Theme.dialogs_namePaint[1], Theme.dialogs_searchNamePaint}, null, null, Theme.key_chats_name));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class, ProfileSearchCell.class}, null, new Paint[]{Theme.dialogs_nameEncryptedPaint[0], Theme.dialogs_nameEncryptedPaint[1], Theme.dialogs_searchNameEncryptedPaint}, null, null, Theme.key_chats_secretName));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, Theme.dialogs_messagePaint[1], null, null, Theme.key_chats_message_threeLines));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, Theme.dialogs_messagePaint[0], null, null, Theme.key_chats_message));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, Theme.dialogs_messageNamePaint, null, null, Theme.key_chats_nameMessage_threeLines));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, null, null, null, Theme.key_chats_draft));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, null, Theme.dialogs_messagePrintingPaint, null, null, Theme.key_chats_actionMessage));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, Theme.dialogs_timePaint, null, null, Theme.key_chats_date));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, Theme.dialogs_pinnedPaint, null, null, Theme.key_chats_pinnedOverlay));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, Theme.dialogs_tabletSeletedPaint, null, null, Theme.key_chats_tabletSelectedOverlay));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, null, new Drawable[]{Theme.dialogs_checkDrawable}, null, Theme.key_chats_sentCheck));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, null, new Drawable[]{Theme.dialogs_checkReadDrawable, Theme.dialogs_halfCheckDrawable}, null, Theme.key_chats_sentReadCheck));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, null, new Drawable[]{Theme.dialogs_clockDrawable}, null, Theme.key_chats_sentClock));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, Theme.dialogs_errorPaint, null, null, Theme.key_chats_sentError));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, null, new Drawable[]{Theme.dialogs_errorDrawable}, null, Theme.key_chats_sentErrorIcon));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class, ProfileSearchCell.class}, null, new Drawable[]{Theme.dialogs_verifiedCheckDrawable}, null, Theme.key_chats_verifiedCheck));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class, ProfileSearchCell.class}, null, new Drawable[]{Theme.dialogs_verifiedDrawable}, null, Theme.key_chats_verifiedBackground));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, null, new Drawable[]{Theme.dialogs_muteDrawable}, null, Theme.key_chats_muteIcon));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, null, new Drawable[]{Theme.dialogs_mentionDrawable}, null, Theme.key_chats_mentionIcon));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, null, null, null, Theme.key_chats_archivePinBackground));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, null, null, null, Theme.key_chats_archiveBackground));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, null, null, null, Theme.key_chats_onlineCircle));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{DialogCell.class}, null, null, null, Theme.key_windowBackgroundWhite));
|
|
|
|
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_CHECKBOX, new Class[]{DialogCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_windowBackgroundWhite));
|
|
|
|
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_CHECKBOXCHECK, new Class[]{DialogCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_checkboxCheck));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{LoadingCell.class}, new String[]{"progressBar"}, null, null, null, Theme.key_progressCircle));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{ProfileSearchCell.class}, Theme.dialogs_offlinePaint, null, null, Theme.key_windowBackgroundWhiteGrayText3));
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{ProfileSearchCell.class}, Theme.dialogs_onlinePaint, null, null, Theme.key_windowBackgroundWhiteBlueText3));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(list, 0, new Class[]{GraySectionCell.class}, new String[]{"textView"}, null, null, null, Theme.key_graySectionText));
|
|
|
|
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{GraySectionCell.class}, null, null, null, Theme.key_graySection));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{HashtagSearchCell.class}, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ShadowSectionCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow));
|
|
|
|
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{ShadowSectionCell.class}, null, null, null, Theme.key_windowBackgroundGray));
|
|
|
|
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{TextCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlueText2));
|
|
|
|
}
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{DialogsEmptyCell.class}, new String[]{"emptyTextView1"}, null, null, null, Theme.key_chats_nameMessage_threeLines));
|
|
|
|
arrayList.add(new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{DialogsEmptyCell.class}, new String[]{"emptyTextView2"}, null, null, null, Theme.key_chats_message));
|
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundRed));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundOrange));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundViolet));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundGreen));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundCyan));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundBlue));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundPink));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundSaved));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundArchived));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundArchivedHidden));
|
2019-12-31 14:08:08 +01:00
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_nameMessage));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_draft));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_attachMessage));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_nameArchived));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_nameMessageArchived));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_nameMessageArchived_threeLines));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_messageArchived));
|
|
|
|
|
|
|
|
if (SharedConfig.archiveHidden) {
|
2019-07-18 15:01:39 +02:00
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_archiveAvatarDrawable}, "Arrow1", Theme.key_avatar_backgroundArchivedHidden));
|
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_archiveAvatarDrawable}, "Arrow2", Theme.key_avatar_backgroundArchivedHidden));
|
2019-05-14 14:08:05 +02:00
|
|
|
} else {
|
2019-07-18 15:01:39 +02:00
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_archiveAvatarDrawable}, "Arrow1", Theme.key_avatar_backgroundArchived));
|
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_archiveAvatarDrawable}, "Arrow2", Theme.key_avatar_backgroundArchived));
|
2019-05-14 14:08:05 +02:00
|
|
|
}
|
2019-07-18 15:01:39 +02:00
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_archiveAvatarDrawable}, "Box2", Theme.key_avatar_text));
|
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_archiveAvatarDrawable}, "Box1", Theme.key_avatar_text));
|
2019-05-14 14:08:05 +02:00
|
|
|
|
2019-07-18 15:01:39 +02:00
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_pinArchiveDrawable}, "Arrow", Theme.key_chats_archiveIcon));
|
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_pinArchiveDrawable}, "Line", Theme.key_chats_archiveIcon));
|
2019-05-14 14:08:05 +02:00
|
|
|
|
2019-07-18 15:01:39 +02:00
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_unpinArchiveDrawable}, "Arrow", Theme.key_chats_archiveIcon));
|
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_unpinArchiveDrawable}, "Line", Theme.key_chats_archiveIcon));
|
2019-05-14 14:08:05 +02:00
|
|
|
|
2019-07-18 15:01:39 +02:00
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_archiveDrawable}, "Arrow", Theme.key_chats_archiveBackground));
|
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_archiveDrawable}, "Box2", Theme.key_chats_archiveIcon));
|
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_archiveDrawable}, "Box1", Theme.key_chats_archiveIcon));
|
2019-05-14 14:08:05 +02:00
|
|
|
|
2019-07-18 15:01:39 +02:00
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_unarchiveDrawable}, "Arrow1", Theme.key_chats_archiveIcon));
|
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_unarchiveDrawable}, "Arrow2", Theme.key_chats_archivePinBackground));
|
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_unarchiveDrawable}, "Box2", Theme.key_chats_archiveIcon));
|
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{DialogCell.class}, new RLottieDrawable[]{Theme.dialogs_unarchiveDrawable}, "Box1", Theme.key_chats_archiveIcon));
|
2019-05-14 14:08:05 +02:00
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_archivePullDownBackground));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_archivePullDownBackgroundActive));
|
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_chats_menuBackground));
|
|
|
|
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[]{DrawerProfileCell.class}, null, null, null, Theme.key_chats_menuName));
|
|
|
|
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[]{DrawerProfileCell.class}, null, null, null, Theme.key_chats_menuPhone));
|
|
|
|
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[]{DrawerProfileCell.class}, null, null, null, Theme.key_chats_menuPhoneCats));
|
|
|
|
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[]{DrawerProfileCell.class}, null, null, null, Theme.key_chats_menuCloudBackgroundCats));
|
|
|
|
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[]{DrawerProfileCell.class}, null, null, null, Theme.key_chat_serviceBackground));
|
|
|
|
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[]{DrawerProfileCell.class}, null, null, null, Theme.key_chats_menuTopShadow));
|
2019-06-04 12:14:50 +02:00
|
|
|
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[]{DrawerProfileCell.class}, null, null, null, Theme.key_chats_menuTopShadowCats));
|
2019-12-31 14:08:08 +01:00
|
|
|
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, new Class[]{DrawerProfileCell.class}, new String[]{"darkThemeView"}, null, null, null, Theme.key_listSelector));
|
|
|
|
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{DrawerProfileCell.class}, new String[]{"darkThemeView"}, null, null, null, Theme.key_chats_menuName));
|
2019-06-04 12:14:50 +02:00
|
|
|
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[]{DrawerProfileCell.class}, null, null, cellDelegate, Theme.key_chats_menuTopBackgroundCats));
|
|
|
|
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[]{DrawerProfileCell.class}, null, null, cellDelegate, Theme.key_chats_menuTopBackground));
|
2019-05-14 14:08:05 +02:00
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{DrawerActionCell.class}, new String[]{"textView"}, null, null, null, Theme.key_chats_menuItemIcon));
|
|
|
|
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[]{DrawerActionCell.class}, new String[]{"textView"}, null, null, null, Theme.key_chats_menuItemText));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[]{DrawerUserCell.class}, new String[]{"textView"}, null, null, null, Theme.key_chats_menuItemText));
|
|
|
|
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{DrawerUserCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_chats_unreadCounterText));
|
|
|
|
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{DrawerUserCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_chats_unreadCounter));
|
|
|
|
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{DrawerUserCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_chats_menuBackground));
|
|
|
|
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{DrawerAddCell.class}, new String[]{"textView"}, null, null, null, Theme.key_chats_menuItemIcon));
|
|
|
|
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[]{DrawerAddCell.class}, new String[]{"textView"}, null, null, null, Theme.key_chats_menuItemText));
|
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{UserCell.class}, new String[]{"nameTextView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{UserCell.class}, new String[]{"statusColor"}, null, null, cellDelegate, Theme.key_windowBackgroundWhiteGrayText));
|
|
|
|
arrayList.add(new ThemeDescription(listView, 0, new Class[]{UserCell.class}, new String[]{"statusOnlineColor"}, null, null, cellDelegate, Theme.key_windowBackgroundWhiteBlueText));
|
2019-05-14 14:08:05 +02:00
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[]{DividerCell.class}, Theme.dividerPaint, null, null, Theme.key_divider));
|
2019-05-14 14:08:05 +02:00
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(progressView, ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_progressCircle));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(dialogsAdapter != null ? dialogsAdapter.getArchiveHintCellPager() : null, 0, new Class[]{ArchiveHintInnerCell.class}, new String[]{"imageView"}, null, null, null, Theme.key_chats_nameMessage_threeLines));
|
|
|
|
arrayList.add(new ThemeDescription(dialogsAdapter != null ? dialogsAdapter.getArchiveHintCellPager() : null, 0, new Class[]{ArchiveHintInnerCell.class}, new String[]{"imageView2"}, null, null, null, Theme.key_chats_unreadCounter));
|
|
|
|
arrayList.add(new ThemeDescription(dialogsAdapter != null ? dialogsAdapter.getArchiveHintCellPager() : null, 0, new Class[]{ArchiveHintInnerCell.class}, new String[]{"headerTextView"}, null, null, null, Theme.key_chats_nameMessage_threeLines));
|
|
|
|
arrayList.add(new ThemeDescription(dialogsAdapter != null ? dialogsAdapter.getArchiveHintCellPager() : null, 0, new Class[]{ArchiveHintInnerCell.class}, new String[]{"messageTextView"}, null, null, null, Theme.key_chats_message));
|
|
|
|
arrayList.add(new ThemeDescription(dialogsAdapter != null ? dialogsAdapter.getArchiveHintCellPager() : null, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefaultArchived));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(dialogsSearchAdapter != null ? dialogsSearchAdapter.getInnerListView() : null, 0, new Class[]{HintDialogCell.class}, Theme.dialogs_countPaint, null, null, Theme.key_chats_unreadCounter));
|
|
|
|
arrayList.add(new ThemeDescription(dialogsSearchAdapter != null ? dialogsSearchAdapter.getInnerListView() : null, 0, new Class[]{HintDialogCell.class}, Theme.dialogs_countGrayPaint, null, null, Theme.key_chats_unreadCounterMuted));
|
|
|
|
arrayList.add(new ThemeDescription(dialogsSearchAdapter != null ? dialogsSearchAdapter.getInnerListView() : null, 0, new Class[]{HintDialogCell.class}, Theme.dialogs_countTextPaint, null, null, Theme.key_chats_unreadCounterText));
|
|
|
|
arrayList.add(new ThemeDescription(dialogsSearchAdapter != null ? dialogsSearchAdapter.getInnerListView() : null, 0, new Class[]{HintDialogCell.class}, Theme.dialogs_archiveTextPaint, null, null, Theme.key_chats_archiveText));
|
|
|
|
arrayList.add(new ThemeDescription(dialogsSearchAdapter != null ? dialogsSearchAdapter.getInnerListView() : null, 0, new Class[]{HintDialogCell.class}, new String[]{"nameTextView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
arrayList.add(new ThemeDescription(dialogsSearchAdapter != null ? dialogsSearchAdapter.getInnerListView() : null, 0, new Class[]{HintDialogCell.class}, null, null, null, Theme.key_chats_onlineCircle));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND | ThemeDescription.FLAG_CHECKTAG, new Class[]{FragmentContextView.class}, new String[]{"frameLayout"}, null, null, null, Theme.key_inappPlayerBackground));
|
|
|
|
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{FragmentContextView.class}, new String[]{"playButton"}, null, null, null, Theme.key_inappPlayerPlayPause));
|
|
|
|
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[]{FragmentContextView.class}, new String[]{"titleTextView"}, null, null, null, Theme.key_inappPlayerTitle));
|
|
|
|
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_FASTSCROLL, new Class[]{FragmentContextView.class}, new String[]{"titleTextView"}, null, null, null, Theme.key_inappPlayerPerformer));
|
|
|
|
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{FragmentContextView.class}, new String[]{"closeButton"}, null, null, null, Theme.key_inappPlayerClose));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND | ThemeDescription.FLAG_CHECKTAG, new Class[]{FragmentContextView.class}, new String[]{"frameLayout"}, null, null, null, Theme.key_returnToCallBackground));
|
|
|
|
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[]{FragmentContextView.class}, new String[]{"titleTextView"}, null, null, null, Theme.key_returnToCallText));
|
|
|
|
|
|
|
|
for (int a = 0; a < undoView.length; a++) {
|
2019-12-31 14:08:08 +01:00
|
|
|
arrayList.add(new ThemeDescription(undoView[a], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_undo_background));
|
2019-05-14 14:08:05 +02:00
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"undoImageView"}, null, null, null, Theme.key_undo_cancelColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"undoTextView"}, null, null, null, Theme.key_undo_cancelColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"infoTextView"}, null, null, null, Theme.key_undo_infoColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"subinfoTextView"}, null, null, null, Theme.key_undo_infoColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"textPaint"}, null, null, null, Theme.key_undo_infoColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"progressPaint"}, null, null, null, Theme.key_undo_infoColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "info1", Theme.key_undo_background));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "info2", Theme.key_undo_background));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "luc12", Theme.key_undo_infoColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "luc11", Theme.key_undo_infoColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "luc10", Theme.key_undo_infoColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "luc9", Theme.key_undo_infoColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "luc8", Theme.key_undo_infoColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "luc7", Theme.key_undo_infoColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "luc6", Theme.key_undo_infoColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "luc5", Theme.key_undo_infoColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "luc4", Theme.key_undo_infoColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "luc3", Theme.key_undo_infoColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "luc2", Theme.key_undo_infoColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "luc1", Theme.key_undo_infoColor));
|
|
|
|
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[]{UndoView.class}, new String[]{"leftImageView"}, "Oval", Theme.key_undo_infoColor));
|
|
|
|
}
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogBackground));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogBackgroundGray));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextBlack));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextLink));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogLinkSelection));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextBlue));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextBlue2));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextBlue3));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextBlue4));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextRed));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextRed2));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextGray));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextGray2));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextGray3));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextGray4));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogIcon));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogRedIcon));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextHint));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogInputField));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogInputFieldActivated));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogCheckboxSquareBackground));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogCheckboxSquareCheck));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogCheckboxSquareUnchecked));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogCheckboxSquareDisabled));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogRadioBackground));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogRadioBackgroundChecked));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogProgressCircle));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogButton));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogButtonSelector));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogScrollGlow));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogRoundCheckBox));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogRoundCheckBoxCheck));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogBadgeBackground));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogBadgeText));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogLineProgress));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogLineProgressBackground));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogGrayLine));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialog_inlineProgressBackground));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialog_inlineProgress));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogSearchBackground));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogSearchHint));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogSearchIcon));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogSearchText));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogFloatingButton));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogFloatingIcon));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogShadowLine));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_sheet_scrollUp));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_sheet_other));
|
|
|
|
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBar));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBarSelector));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBarTitle));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBarTop));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBarSubtitle));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBarItems));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_background));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_time));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_progressBackground));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_progressCachedBackground));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_progress));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_placeholder));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_placeholderBackground));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_button));
|
|
|
|
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_buttonActive));
|
|
|
|
|
|
|
|
return arrayList.toArray(new ThemeDescription[0]);
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|