歌尔基办 v2.7.0版本的 MD5 值为:921fd7c85ec097e8cab7f049269b36e4
以下内容为反编译后的 ChatActivity.java 源代码,内容仅作参考
package im.ovithmjoec.ui;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.media.ThumbnailUtils;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.text.Layout;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.style.CharacterStyle;
import android.text.style.ClickableSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.URLSpan;
import android.util.Base64;
import android.util.Log;
import android.util.LongSparseArray;
import android.util.Property;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.util.SparseIntArray;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.view.ViewTreeObserver;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.DecelerateInterpolator;
import android.webkit.URLUtil;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.Space;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.core.content.FileProvider;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.GridLayoutManagerFixed;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScrollerMiddle;
import androidx.recyclerview.widget.RecyclerView;
import com.bjz.comm.net.bean.ResponseAccessTokenBean;
import com.bjz.comm.net.bean.ResponseBaiduTranslateBean;
import com.bjz.comm.net.factory.ApiTranslateAudioFactory;
import com.bjz.comm.net.premission.PermissionUtils;
import com.bjz.comm.net.utils.RxHelper;
import com.blankj.utilcode.util.GsonUtils;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.DefaultRenderersFactory;
import com.google.android.exoplayer2.text.ttml.TtmlNode;
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.util.MimeTypes;
import com.google.gson.Gson;
import com.king.zxing.util.CodeUtils;
import im.ovithmjoec.javaBean.ChatFCAttentionBean;
import im.ovithmjoec.javaBean.PayBillOverBean;
import im.ovithmjoec.javaBean.hongbao.RedTransOperation;
import im.ovithmjoec.javaBean.hongbao.UnifyBean;
import im.ovithmjoec.messenger.AndroidUtilities;
import im.ovithmjoec.messenger.ApplicationLoader;
import im.ovithmjoec.messenger.BuildVars;
import im.ovithmjoec.messenger.ChatObject;
import im.ovithmjoec.messenger.ContactsController;
import im.ovithmjoec.messenger.Emoji;
import im.ovithmjoec.messenger.FileLoader;
import im.ovithmjoec.messenger.FileLog;
import im.ovithmjoec.messenger.ImageLocation;
import im.ovithmjoec.messenger.ImageReceiver;
import im.ovithmjoec.messenger.LocaleController;
import im.ovithmjoec.messenger.MediaController;
import im.ovithmjoec.messenger.MediaDataController;
import im.ovithmjoec.messenger.MessageObject;
import im.ovithmjoec.messenger.MessagesController;
import im.ovithmjoec.messenger.MessagesStorage;
import im.ovithmjoec.messenger.NotificationCenter;
import im.ovithmjoec.messenger.NotificationsController;
import im.ovithmjoec.messenger.R;
import im.ovithmjoec.messenger.SendMessagesHelper;
import im.ovithmjoec.messenger.SharedConfig;
import im.ovithmjoec.messenger.UserConfig;
import im.ovithmjoec.messenger.UserObject;
import im.ovithmjoec.messenger.Utilities;
import im.ovithmjoec.messenger.VideoEditedInfo;
import im.ovithmjoec.messenger.browser.Browser;
import im.ovithmjoec.messenger.support.SparseLongArray;
import im.ovithmjoec.phoneformat.PhoneFormat;
import im.ovithmjoec.sqlite.SQLiteException;
import im.ovithmjoec.sqlite.SQLitePreparedStatement;
import im.ovithmjoec.tgnet.ConnectionsManager;
import im.ovithmjoec.tgnet.ParamsUtil;
import im.ovithmjoec.tgnet.RequestDelegate;
import im.ovithmjoec.tgnet.SerializedData;
import im.ovithmjoec.tgnet.TLApiModel;
import im.ovithmjoec.tgnet.TLJsonResolve;
import im.ovithmjoec.tgnet.TLObject;
import im.ovithmjoec.tgnet.TLRPC;
import im.ovithmjoec.tgnet.TLRPCContacts;
import im.ovithmjoec.tgnet.TLRPCRedpacket;
import im.ovithmjoec.tgnet.TLRPCWallet;
import im.ovithmjoec.ui.AudioSelectActivity;
import im.ovithmjoec.ui.ChatActivity;
import im.ovithmjoec.ui.ContentPreviewViewer;
import im.ovithmjoec.ui.DialogsActivity;
import im.ovithmjoec.ui.DocumentSelectActivity;
import im.ovithmjoec.ui.NewLocationActivity;
import im.ovithmjoec.ui.PhoneBookSelectActivity;
import im.ovithmjoec.ui.PhotoAlbumPickerActivity;
import im.ovithmjoec.ui.PhotoViewer;
import im.ovithmjoec.ui.PollCreateActivity;
import im.ovithmjoec.ui.actionbar.ActionBar;
import im.ovithmjoec.ui.actionbar.ActionBarLayout;
import im.ovithmjoec.ui.actionbar.ActionBarMenu;
import im.ovithmjoec.ui.actionbar.ActionBarMenuItem;
import im.ovithmjoec.ui.actionbar.ActionBarMenuSubItem;
import im.ovithmjoec.ui.actionbar.ActionBarPopupWindow;
import im.ovithmjoec.ui.actionbar.AlertDialog;
import im.ovithmjoec.ui.actionbar.BaseFragment;
import im.ovithmjoec.ui.actionbar.BottomSheet;
import im.ovithmjoec.ui.actionbar.ChatActionBarMenuPopupWindow;
import im.ovithmjoec.ui.actionbar.ChatActionBarMenuSubItem;
import im.ovithmjoec.ui.actionbar.SimpleTextView;
import im.ovithmjoec.ui.actionbar.Theme;
import im.ovithmjoec.ui.actionbar.ThemeDescription;
import im.ovithmjoec.ui.actionbar.XAlertDialog;
import im.ovithmjoec.ui.adapters.MentionsAdapter;
import im.ovithmjoec.ui.adapters.StickersAdapter;
import im.ovithmjoec.ui.cells.BotHelpCell;
import im.ovithmjoec.ui.cells.BotSwitchCell;
import im.ovithmjoec.ui.cells.ChatActionCell;
import im.ovithmjoec.ui.cells.ChatLoadingCell;
import im.ovithmjoec.ui.cells.ChatMessageCell;
import im.ovithmjoec.ui.cells.ChatUnreadCell;
import im.ovithmjoec.ui.cells.CheckBoxCell;
import im.ovithmjoec.ui.cells.ContextLinkCell;
import im.ovithmjoec.ui.cells.MentionCell;
import im.ovithmjoec.ui.cells.StickerCell;
import im.ovithmjoec.ui.components.AlertsCreator;
import im.ovithmjoec.ui.components.AnimatedFileDrawable;
import im.ovithmjoec.ui.components.AnimationProperties;
import im.ovithmjoec.ui.components.AvatarDrawable;
import im.ovithmjoec.ui.components.BackupImageView;
import im.ovithmjoec.ui.components.ChatActivityEnterView;
import im.ovithmjoec.ui.components.ChatAttachAlert;
import im.ovithmjoec.ui.components.ChatAvatarContainer;
import im.ovithmjoec.ui.components.ChatBigEmptyView;
import im.ovithmjoec.ui.components.CombinedDrawable;
import im.ovithmjoec.ui.components.CorrectlyMeasuringTextView;
import im.ovithmjoec.ui.components.EditTextCaption;
import im.ovithmjoec.ui.components.EmbedBottomSheet;
import im.ovithmjoec.ui.components.EmojiView;
import im.ovithmjoec.ui.components.ExtendedGridLayoutManager;
import im.ovithmjoec.ui.components.FragmentContextView;
import im.ovithmjoec.ui.components.HintView;
import im.ovithmjoec.ui.components.InstantCameraView;
import im.ovithmjoec.ui.components.LayoutHelper;
import im.ovithmjoec.ui.components.NumberTextView;
import im.ovithmjoec.ui.components.PipRoundVideoView;
import im.ovithmjoec.ui.components.RLottieDrawable;
import im.ovithmjoec.ui.components.RadialProgressView;
import im.ovithmjoec.ui.components.RecyclerListView;
import im.ovithmjoec.ui.components.ShareAlert;
import im.ovithmjoec.ui.components.Size;
import im.ovithmjoec.ui.components.SizeNotifierFrameLayout;
import im.ovithmjoec.ui.components.StickersAlert;
import im.ovithmjoec.ui.components.TextStyleSpan;
import im.ovithmjoec.ui.components.TypefaceSpan;
import im.ovithmjoec.ui.components.URLSpanBotCommand;
import im.ovithmjoec.ui.components.URLSpanMono;
import im.ovithmjoec.ui.components.URLSpanNoUnderline;
import im.ovithmjoec.ui.components.URLSpanReplacement;
import im.ovithmjoec.ui.components.URLSpanUserMention;
import im.ovithmjoec.ui.components.UndoView;
import im.ovithmjoec.ui.components.toast.ToastUtils;
import im.ovithmjoec.ui.components.voip.VoIPHelper;
import im.ovithmjoec.ui.constants.ChatEnterMenuType;
import im.ovithmjoec.ui.constants.Constants;
import im.ovithmjoec.ui.dialogs.BottomDialog;
import im.ovithmjoec.ui.dialogs.WalletDialog;
import im.ovithmjoec.ui.hui.CameraViewActivity;
import im.ovithmjoec.ui.hui.chats.NewProfileActivity;
import im.ovithmjoec.ui.hui.contacts.AddContactsInfoActivity;
import im.ovithmjoec.ui.hui.discovery.QrScanResultActivity;
import im.ovithmjoec.ui.hui.friendscircle_v1.ui.FcPageDetailActivity;
import im.ovithmjoec.ui.hui.friendscircle_v1.ui.FcPageOthersActivity;
import im.ovithmjoec.ui.hui.mine.AboutAppActivity;
import im.ovithmjoec.ui.hui.packet.BillDetailsActivity;
import im.ovithmjoec.ui.hui.packet.RedpktDetailActivity;
import im.ovithmjoec.ui.hui.packet.RedpktDetailReceiverActivity;
import im.ovithmjoec.ui.hui.packet.RedpktGroupDetailActivity;
import im.ovithmjoec.ui.hui.packet.RedpktGroupSendActivity;
import im.ovithmjoec.ui.hui.packet.RedpktSendActivity;
import im.ovithmjoec.ui.hui.packet.bean.RedpacketBean;
import im.ovithmjoec.ui.hui.packet.bean.RedpacketResponse;
import im.ovithmjoec.ui.hui.packet.pop.DialogRedpkg;
import im.ovithmjoec.ui.hui.packet.pop.OnRedPacketDialogClickListener;
import im.ovithmjoec.ui.hui.packet.pop.RedPacketViewHolder;
import im.ovithmjoec.ui.hui.transfer.TransferSendActivity;
import im.ovithmjoec.ui.hui.transfer.TransferStatusActivity;
import im.ovithmjoec.ui.hui.transfer.bean.TransferResponse;
import im.ovithmjoec.ui.hui.wallet_public.bean.WalletAccountInfo;
import im.ovithmjoec.ui.hui.wallet_public.bean.WalletConfigBean;
import im.ovithmjoec.ui.hui.wallet_public.utils.WalletDialogUtil;
import im.ovithmjoec.ui.hui.wallet_public.utils.WalletErrorUtil;
import im.ovithmjoec.ui.hviews.dialogs.XDialog;
import im.ovithmjoec.ui.utils.ChatActionBarHelper;
import im.ovithmjoec.ui.utils.GpsUtils;
import im.ovithmjoec.ui.utils.QrCodeParseUtil;
import im.ovithmjoec.ui.utils.number.MoneyUtil;
import im.ovithmjoec.ui.utils.number.NumberUtil;
import im.ovithmjoec.ui.utils.number.StringUtils;
import im.ovithmjoec.ui.utils.translate.DecodeEngine;
import im.ovithmjoec.ui.utils.translate.callback.DecodeOperateInterface;
import im.ovithmjoec.ui.utils.translate.common.AudioEditConstant;
import im.ovithmjoec.ui.utils.translate.utils.AudioFileUtils;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
import java.io.File;
import java.math.BigDecimal;
import java.net.URLConnection;
import java.net.URLDecoder;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.regex.Matcher;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import org.slf4j.Marker;
public class ChatActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, DialogsActivity.DialogsActivityDelegate, NewLocationActivity.LocationActivityDelegate {
private static final String PREFIX_VIDEO = "video/";
private static final int add_shortcut = 24;
private static final int attach_audio = 3;
private static final int attach_contact = 5;
private static final int attach_document = 4;
private static final int attach_gallery = 1;
private static final int attach_group_live = 1012;
private static final int attach_location = 6;
private static final int attach_photo = 0;
private static final int attach_poll = 9;
private static final int attach_video = 2;
private static final int attach_video_call = 1011;
private static final int attach_voice_call = 1010;
private static final int bot_help = 30;
private static final int bot_settings = 31;
private static final int call = 32;
private static final int chat_enc_timer = 13;
private static final int chat_menu_attach = 14;
private static final int clear_history = 15;
private static final int copy = 10;
private static final int delete = 12;
private static final int delete_chat = 16;
private static final int edit = 23;
private static final int forward = 11;
private static final int id_chat_compose_panel = 1000;
private static final int live = 33;
private static final int more = 0;
private static final int mute = 18;
private static final int report = 21;
private static final int search = 40;
private static final int share_contact = 17;
private static final int star = 22;
private static final int text_bold = 50;
private static final int text_italic = 51;
private static final int text_link = 53;
private static final int text_mono = 52;
private static final int text_regular = 54;
private static final int text_strike = 55;
private static final int text_underline = 56;
private String TAG;
private ChatActionBarHelper actionBarHelper;
private ArrayList<View> actionModeViews;
private ChatActionBarMenuSubItem addContactItem;
private TextView addToContactsButton;
private TextView alertNameTextView;
private TextView alertTextView;
private FrameLayout alertView;
private AnimatorSet alertViewAnimator;
private boolean allowContextBotPanel;
private boolean allowContextBotPanelSecond;
private boolean allowStickersPanel;
private HashMap<MessageObject, Boolean> alredyPlayedStickers;
private ArrayList<MessageObject> animatingMessageObjects;
private Paint aspectPaint;
private Path aspectPath;
private AspectRatioFrameLayout aspectRatioFrameLayout;
private ActionBarMenuItem attachItem;
private ChatAvatarContainer avatarContainer;
private ChatBigEmptyView bigEmptyView;
private MessageObject botButtons;
private PhotoViewer.PhotoViewerProvider botContextProvider;
private ArrayList<Object> botContextResults;
private SparseArray<TLRPC.BotInfo> botInfo;
private MessageObject botReplyButtons;
private String botUser;
private int botsCount;
private FrameLayout bottomMessagesActionContainer;
private FrameLayout bottomOverlay;
private AnimatorSet bottomOverlayAnimation;
private FrameLayout bottomOverlayChat;
private TextView bottomOverlayChatText;
private UnreadCounterTextView bottomOverlayChatText2;
private RadialProgressView bottomOverlayProgress;
private TextView bottomOverlayText;
private boolean[] cacheEndReached;
private ActionBarMenuItem callItem;
private int canEditMessagesCount;
private int canForwardMessagesCount;
private int cantCopyMessageCount;
private int cantDeleteMessagesCount;
private int cantForwardMessagesCount;
private ChatActionBarMenuPopupWindow chatActionBarMenuPop;
private ChatActivityDelegate chatActivityDelegate;
public ChatActivityEnterView chatActivityEnterView;
private ChatActivityAdapter chatAdapter;
private ChatAttachAlert chatAttachAlert;
private long chatEnterTime;
protected TLRPC.ChatFull chatInfo;
private GridLayoutManagerFixed chatLayoutManager;
private long chatLeaveTime;
private RecyclerListView chatListView;
private int chatListViewClipTop;
private ArrayList<ChatMessageCell> chatMessageCellsCache;
private boolean checkTextureViewPosition;
private boolean clearingHistory;
private Dialog closeChatDialog;
private ImageView closeLivePinned;
private ImageView closePinned;
private ImageView closeReportSpam;
private SizeNotifierFrameLayout contentView;
private int createUnreadMessageAfterId;
private boolean createUnreadMessageAfterIdLoading;
protected TLRPC.Chat currentChat;
protected TLRPC.EncryptedChat currentEncryptedChat;
private boolean currentFloatingDateOnScreen;
private boolean currentFloatingTopIsNotMessage;
private String currentPicturePath;
protected TLRPC.User currentUser;
private AlertDialog dialogEnterRoomLoading;
private long dialog_id;
private ChatMessageCell drawLaterRoundProgressCell;
private AnimatorSet editButtonAnimation;
private int editTextEnd;
private ActionBarMenuItem editTextItem;
private int editTextStart;
private MessageObject editingMessageObject;
private int editingMessageObjectReqId;
private View emojiButtonRed;
private TextView emptyView;
private FrameLayout emptyViewContainer;
private boolean[] endReached;
private boolean first;
private boolean firstLoading;
boolean firstOpen;
private boolean firstUnreadSent;
private int first_unread_id;
private boolean fixPaddingsInLayout;
private AnimatorSet floatingDateAnimation;
private ChatActionCell floatingDateView;
private boolean forceScrollToTop;
private TextView forwardButton;
private AnimatorSet forwardButtonAnimation;
private boolean[] forwardEndReached;
private HintView forwardHintView;
private MessageObject forwardingMessage;
private MessageObject.GroupedMessages forwardingMessageGroup;
private ArrayList<MessageObject> forwardingMessages;
private ArrayList<CharSequence> foundUrls;
private TLRPC.WebPage foundWebPage;
private FragmentContextView fragmentContextView;
private TextView gifHintTextView;
private boolean globalIgnoreLayout;
private LongSparseArray<MessageObject.GroupedMessages> groupedMessagesMap;
private boolean hasAllMentionsLocal;
private boolean hasBotsCommands;
private boolean hasUnfavedSelected;
private ActionBarMenuItem headerItem;
private Runnable hideAlertViewRunnable;
private int hideDateDelay;
private int highlightMessageId;
private boolean ignoreAttachOnPause;
private boolean inScheduleMode;
private long inlineReturn;
private InstantCameraView instantCameraView;
private int lastLoadIndex;
private int last_message_id;
private int linkSearchRequestId;
private boolean loading;
private boolean loadingForward;
private boolean loadingFromOldPosition;
private int loadingPinnedMessage;
private int loadsCount;
private boolean locationAlertShown;
private DialogRedpkg mRedPacketDialog;
View mRedPacketDialogView;
private RedPacketViewHolder mRedPacketViewHolder;
private HashMap<String, CompositeDisposable> mTaskDisposable;
private int[] maxDate;
private int[] maxMessageId;
private TextView mediaBanTooltip;
private FrameLayout mentionContainer;
private ExtendedGridLayoutManager mentionGridLayoutManager;
private LinearLayoutManager mentionLayoutManager;
private AnimatorSet mentionListAnimation;
private RecyclerListView mentionListView;
private boolean mentionListViewIgnoreLayout;
private boolean mentionListViewIsScrolling;
private int mentionListViewLastViewPosition;
private int mentionListViewLastViewTop;
private int mentionListViewScrollOffsetY;
private FrameLayout mentiondownButton;
private ObjectAnimator mentiondownButtonAnimation;
private TextView mentiondownButtonCounter;
private ImageView mentiondownButtonImage;
private MentionsAdapter mentionsAdapter;
private RecyclerListView.OnItemClickListener mentionsOnItemClickListener;
private long mergeDialogId;
protected ArrayList<MessageObject> messages;
private HashMap<String, ArrayList<MessageObject>> messagesByDays;
private SparseArray<MessageObject>[] messagesDict;
private int[] minDate;
private int[] minMessageId;
private ChatActionBarMenuSubItem muteItem;
private MessageObject needAnimateToMessage;
private boolean needSelectFromMessageId;
private int newMentionsCount;
private int newUnreadMessageCount;
private HintView noSoundHintView;
RecyclerListView.OnItemClickListenerExtended onItemClickListener;
RecyclerListView.OnItemLongClickListenerExtended onItemLongClickListener;
private boolean openAnimationEnded;
private boolean openKeyboardOnAttachMenuClose;
private boolean openSearchKeyboard;
private View overlayView;
private FrameLayout pagedownButton;
private AnimatorSet pagedownButtonAnimation;
private TextView pagedownButtonCounter;
private ImageView pagedownButtonImage;
private boolean pagedownButtonShowedByScroll;
private boolean paused;
private boolean pausedOnLastMessage;
private String pendingLinkSearchString;
private Runnable pendingWebPageTimeoutRunnable;
private PhotoViewer.PhotoViewerProvider photoViewerProvider;
private int pinnedImageCacheType;
private TLRPC.PhotoSize pinnedImageLocation;
private TLObject pinnedImageLocationObject;
private int pinnedImageSize;
private TLRPC.PhotoSize pinnedImageThumbLocation;
private View pinnedLineView;
private MessageObject pinnedLiveMessage;
private SimpleTextView pinnedLiveMessageNameTextView;
private SimpleTextView pinnedLiveMessageTextView;
private FrameLayout pinnedLiveMessageView;
private BackupImageView pinnedLiveUserImageView;
private BackupImageView pinnedMessageImageView;
private SimpleTextView pinnedMessageNameTextView;
private MessageObject pinnedMessageObject;
private SimpleTextView pinnedMessageTextView;
private FrameLayout pinnedMessageView;
private AnimatorSet pinnedMessageViewAnimator;
private LongSparseArray<ArrayList<MessageObject>> polls;
ArrayList<MessageObject> pollsToCheck;
private int prevSetUnreadCount;
private RadialProgressView progressBar;
private FrameLayout progressView;
private View progressView2;
private XAlertDialog redTransAlert;
private TextView replyButton;
private AnimatorSet replyButtonAnimation;
private ImageView replyCloseImageView;
private ImageView replyIconImageView;
private int replyImageCacheType;
private TLRPC.PhotoSize replyImageLocation;
private TLObject replyImageLocationObject;
private int replyImageSize;
private TLRPC.PhotoSize replyImageThumbLocation;
private BackupImageView replyImageView;
private View replyLineView;
private SimpleTextView replyNameTextView;
private SimpleTextView replyObjectTextView;
private MessageObject replyingMessageObject;
private TextView reportSpamButton;
private AnimatorSet reportSpamViewAnimator;
private int reqId;
private int returnToLoadIndex;
private int returnToMessageId;
private AnimatorSet runningAnimation;
private int scheduledMessagesCount;
private AnimatorSet scrimAnimatorSet;
private Paint scrimPaint;
private ActionBarPopupWindow scrimPopupWindow;
private View scrimView;
private MessageObject scrollToMessage;
private int scrollToMessagePosition;
private int scrollToOffsetOnRecreate;
private int scrollToPositionOnRecreate;
private boolean scrollToTopOnResume;
private boolean scrollToTopUnReadOnResume;
private boolean scrollToVideo;
private boolean scrollingChatListView;
private boolean scrollingFloatingDate;
private ImageView searchCalendarButton;
private FrameLayout searchContainer;
private SimpleTextView searchCountText;
private ImageView searchDownButton;
private ActionBarMenuItem searchItem;
private ImageView searchUpButton;
private ImageView searchUserButton;
private boolean searchingForUser;
private TLRPC.User searchingUserMessages;
private SparseArray<MessageObject>[] selectedMessagesCanCopyIds;
private SparseArray<MessageObject>[] selectedMessagesCanStarIds;
private NumberTextView selectedMessagesCountTextView;
private SparseArray<MessageObject>[] selectedMessagesIds;
private MessageObject selectedObject;
private MessageObject.GroupedMessages selectedObjectGroup;
private MessageObject selectedObjectToEditCaption;
private boolean showScrollToMessageError;
private HintView slowModeHint;
private int startLoadFromMessageId;
private int startLoadFromMessageIdSaved;
private int startLoadFromMessageOffset;
private String startVideoEdit;
private StickersAdapter stickersAdapter;
private RecyclerListView stickersListView;
private RecyclerListView.OnItemClickListener stickersOnItemClickListener;
private FrameLayout stickersPanel;
private ImageView stickersPanelArrow;
private View timeItem2;
private FrameLayout topChatPanelView;
private int topViewWasVisible;
private UndoView undoView;
private MessageObject unreadMessageObject;
private Runnable unselectRunnable;
private boolean userBlocked;
protected TLRPC.UserFull userInfo;
private FrameLayout videoPlayerContainer;
private TextureView videoTextureView;
private AnimatorSet voiceHintAnimation;
private Runnable voiceHintHideRunnable;
private TextView voiceHintTextView;
private Runnable waitingForCharaterEnterRunnable;
private ArrayList<Integer> waitingForLoad;
private boolean waitingForReplyMessageLoad;
private boolean wasManualScroll;
private boolean wasPaused;
public interface ChatActivityDelegate {
void openReplyMessage(int i);
}
private void fixLayout() {
}
public static boolean lambda$createView$25(View view, MotionEvent motionEvent) {
return true;
}
public static boolean lambda$createView$29(View view, MotionEvent motionEvent) {
return true;
}
public static boolean lambda$createView$4(View view, MotionEvent motionEvent) {
return true;
}
public static boolean lambda$createView$5(View view, MotionEvent motionEvent) {
return true;
}
public static void lambda$createView$8(View view) {
}
public static void lambda$null$114(DialogInterface dialogInterface, int i) {
}
public static void lambda$null$116(DialogInterface dialogInterface, int i) {
}
public static void lambda$null$117(DialogInterface dialogInterface, int i) {
}
public static void lambda$null$118(DialogInterface dialogInterface, int i) {
}
public static void lambda$null$128() {
}
public static void lambda$null$132() {
}
public static void lambda$null$134() {
}
public static void lambda$null$140() {
}
public static void lambda$null$144() {
}
public static void lambda$null$146() {
}
public static void lambda$null$153() {
}
public static void lambda$null$157() {
}
public static void lambda$null$159() {
}
public static void lambda$null$34(DialogInterface dialogInterface, int i) {
}
private void setItemAnimationsEnabled(boolean z) {
}
public void translateCancel(MessageObject messageObject) {
}
private void translateStart(MessageObject messageObject) {
}
@Deprecated
private void updateTitle() {
}
static int access$16110(ChatActivity chatActivity) {
int i = chatActivity.newMentionsCount;
chatActivity.newMentionsCount = i - 1;
return i;
}
static int access$17708(ChatActivity chatActivity) {
int i = chatActivity.scheduledMessagesCount;
chatActivity.scheduledMessagesCount = i + 1;
return i;
}
public class UnreadCounterTextView extends AppCompatTextView {
private int circleWidth;
private int currentCounter;
private String currentCounterString;
private Paint paint;
private RectF rect;
private TextPaint textPaint;
private int textWidth;
public UnreadCounterTextView(Context context) {
super(context);
this.textPaint = new TextPaint(1);
this.paint = new Paint(1);
this.rect = new RectF();
this.textPaint.setTextSize(AndroidUtilities.dp(13.0f));
this.textPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
}
@Override
public void setTextColor(int i) {
super.setTextColor(i);
this.textPaint.setColor(Theme.getColor(Theme.key_chat_messagePanelBackground));
this.paint.setColor(Theme.getColor(Theme.key_chat_goDownButtonCounterBackground));
}
public void updateCounter() {
TLRPC.Dialog dialog;
int i = (!ChatObject.isChannel(ChatActivity.this.currentChat) || ChatActivity.this.currentChat.megagroup || ChatActivity.this.chatInfo == null || ChatActivity.this.chatInfo.linked_chat_id == 0 || (dialog = ChatActivity.this.getMessagesController().dialogs_dict.get((long) (-ChatActivity.this.chatInfo.linked_chat_id))) == null) ? 0 : dialog.unread_count;
if (this.currentCounter != i) {
this.currentCounter = i;
if (i == 0) {
this.currentCounterString = null;
this.circleWidth = 0;
setPadding(0, 0, 0, 0);
} else {
String format = String.format("%d", Integer.valueOf(i));
this.currentCounterString = format;
this.textWidth = (int) Math.ceil(this.textPaint.measureText(format));
int max = Math.max(AndroidUtilities.dp(20.0f), AndroidUtilities.dp(12.0f) + this.textWidth);
if (this.circleWidth != max) {
this.circleWidth = max;
setPadding(0, 0, (max / 2) + AndroidUtilities.dp(7.0f), 0);
}
}
invalidate();
}
}
@Override
protected void onDraw(Canvas canvas) {
Layout layout;
super.onDraw(canvas);
if (this.currentCounterString == null || (layout = getLayout()) == null || getLineCount() <= 0) {
return;
}
int measuredWidth = ((getMeasuredWidth() + (((int) Math.ceil(layout.getLineWidth(0))) - this.circleWidth)) / 2) + AndroidUtilities.dp(8.0f);
this.rect.set(measuredWidth, (getMeasuredHeight() / 2) - AndroidUtilities.dp(10.0f), measuredWidth + this.circleWidth, (getMeasuredHeight() / 2) + AndroidUtilities.dp(10.0f));
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(10.0f), AndroidUtilities.dp(10.0f), this.paint);
canvas.drawText(this.currentCounterString, this.rect.centerX() - (this.textWidth / 2.0f), this.rect.top + AndroidUtilities.dp(14.5f), this.textPaint);
}
}
public Boolean isSysNotifyMessage() {
if (Constants.DialogsFragmentTopMenuConfig.isSystemCode(this.dialog_id)) {
return true;
}
return false;
}
public ChatActivity(Bundle bundle) {
super(bundle);
this.chatMessageCellsCache = new ArrayList<>();
this.alredyPlayedStickers = new HashMap<>();
this.actionModeViews = new ArrayList<>();
this.hideDateDelay = 500;
this.scheduledMessagesCount = -1;
this.animatingMessageObjects = new ArrayList<>();
this.scrollToPositionOnRecreate = -1;
this.scrollToOffsetOnRecreate = 0;
this.pollsToCheck = new ArrayList<>(10);
this.allowContextBotPanelSecond = true;
this.paused = true;
this.firstOpen = true;
this.selectedMessagesIds = new SparseArray[]{new SparseArray<>(), new SparseArray<>()};
this.selectedMessagesCanCopyIds = new SparseArray[]{new SparseArray<>(), new SparseArray<>()};
this.selectedMessagesCanStarIds = new SparseArray[]{new SparseArray<>(), new SparseArray<>()};
this.waitingForLoad = new ArrayList<>();
this.prevSetUnreadCount = Integer.MIN_VALUE;
this.messagesDict = new SparseArray[]{new SparseArray<>(), new SparseArray<>()};
this.messagesByDays = new HashMap<>();
this.messages = new ArrayList<>();
this.polls = new LongSparseArray<>();
this.groupedMessagesMap = new LongSparseArray<>();
this.maxMessageId = new int[]{Integer.MAX_VALUE, Integer.MAX_VALUE};
this.minMessageId = new int[]{Integer.MIN_VALUE, Integer.MIN_VALUE};
this.maxDate = new int[]{Integer.MIN_VALUE, Integer.MIN_VALUE};
this.minDate = new int[2];
this.endReached = new boolean[2];
this.cacheEndReached = new boolean[2];
this.forwardEndReached = new boolean[]{true, true};
this.firstLoading = true;
this.firstUnreadSent = false;
this.last_message_id = 0;
this.startLoadFromMessageOffset = Integer.MAX_VALUE;
this.first = true;
this.highlightMessageId = Integer.MAX_VALUE;
this.scrollToMessagePosition = -10000;
this.botInfo = new SparseArray<>();
this.TAG = ChatActivity.class.getSimpleName();
this.photoViewerProvider = new PhotoViewer.EmptyPhotoViewerProvider() {
@Override
public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int i, boolean z) {
ChatActionCell chatActionCell;
MessageObject messageObject2;
ChatMessageCell chatMessageCell;
MessageObject messageObject3;
int childCount = ChatActivity.this.chatListView.getChildCount();
int i2 = 0;
while (true) {
ImageReceiver imageReceiver = null;
if (i2 >= childCount) {
return null;
}
View childAt = ChatActivity.this.chatListView.getChildAt(i2);
if (childAt instanceof ChatMessageCell) {
if (messageObject != null && messageObject.type == 105) {
ChatMessageCell chatMessageCell2 = (ChatMessageCell) childAt;
int clickSysNotifyPhotoImageViewIndex = chatMessageCell2.getClickSysNotifyPhotoImageViewIndex();
if (clickSysNotifyPhotoImageViewIndex == 1) {
imageReceiver = chatMessageCell2.photoImage1;
} else if (clickSysNotifyPhotoImageViewIndex == 2) {
imageReceiver = chatMessageCell2.photoImage2;
} else if (clickSysNotifyPhotoImageViewIndex == 3) {
imageReceiver = chatMessageCell2.photoImage3;
} else if (clickSysNotifyPhotoImageViewIndex == 4) {
imageReceiver = chatMessageCell2.photoImage4;
} else if (clickSysNotifyPhotoImageViewIndex == 5) {
imageReceiver = chatMessageCell2.photoImage5;
}
} else if (messageObject != null && (messageObject3 = (chatMessageCell = (ChatMessageCell) childAt).getMessageObject()) != null && messageObject3.getId() == messageObject.getId()) {
imageReceiver = chatMessageCell.getPhotoImage();
}
} else if ((childAt instanceof ChatActionCell) && (messageObject2 = (chatActionCell = (ChatActionCell) childAt).getMessageObject()) != null) {
if (messageObject != null) {
if (messageObject2.getId() == messageObject.getId()) {
imageReceiver = chatActionCell.getPhotoImage();
}
} else if (fileLocation != null && messageObject2.photoThumbs != null) {
int i3 = 0;
while (true) {
if (i3 >= messageObject2.photoThumbs.size()) {
break;
}
TLRPC.PhotoSize photoSize = messageObject2.photoThumbs.get(i3);
MessageObject messageObject4 = messageObject2;
if (photoSize.location.volume_id == fileLocation.volume_id && photoSize.location.local_id == fileLocation.local_id) {
imageReceiver = chatActionCell.getPhotoImage();
break;
}
i3++;
messageObject2 = messageObject4;
}
}
}
if (imageReceiver != null) {
int[] iArr = new int[2];
childAt.getLocationInWindow(iArr);
PhotoViewer.PlaceProviderObject placeProviderObject = new PhotoViewer.PlaceProviderObject();
placeProviderObject.viewX = iArr[0];
placeProviderObject.viewY = iArr[1] - (Build.VERSION.SDK_INT < 21 ? AndroidUtilities.statusBarHeight : 0);
placeProviderObject.parentView = ChatActivity.this.chatListView;
placeProviderObject.imageReceiver = imageReceiver;
if (z) {
placeProviderObject.thumb = imageReceiver.getBitmapSafe();
}
placeProviderObject.radius = imageReceiver.getRoundRadius();
if ((childAt instanceof ChatActionCell) && ChatActivity.this.currentChat != null) {
placeProviderObject.dialogId = -ChatActivity.this.currentChat.id;
}
if ((ChatActivity.this.pinnedMessageView != null && ChatActivity.this.pinnedMessageView.getTag() == null) || (ChatActivity.this.topChatPanelView != null && ChatActivity.this.topChatPanelView.getTag() == null)) {
placeProviderObject.clipTopAddition = AndroidUtilities.dp(48.0f);
}
placeProviderObject.clipTopAddition += ChatActivity.this.chatListViewClipTop;
return placeProviderObject;
}
i2++;
}
}
};
this.botContextProvider = new PhotoViewer.EmptyPhotoViewerProvider() {
@Override
public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int i, boolean z) {
ImageReceiver imageReceiver;
if (i >= 0 && i < ChatActivity.this.botContextResults.size()) {
int childCount = ChatActivity.this.mentionListView.getChildCount();
Object obj = ChatActivity.this.botContextResults.get(i);
for (int i2 = 0; i2 < childCount; i2++) {
View childAt = ChatActivity.this.mentionListView.getChildAt(i2);
if (childAt instanceof ContextLinkCell) {
ContextLinkCell contextLinkCell = (ContextLinkCell) childAt;
if (contextLinkCell.getResult() == obj) {
imageReceiver = contextLinkCell.getPhotoImage();
if (imageReceiver == null) {
int[] iArr = new int[2];
childAt.getLocationInWindow(iArr);
PhotoViewer.PlaceProviderObject placeProviderObject = new PhotoViewer.PlaceProviderObject();
placeProviderObject.viewX = iArr[0];
placeProviderObject.viewY = iArr[1] - (Build.VERSION.SDK_INT < 21 ? AndroidUtilities.statusBarHeight : 0);
placeProviderObject.parentView = ChatActivity.this.mentionListView;
placeProviderObject.imageReceiver = imageReceiver;
placeProviderObject.thumb = imageReceiver.getBitmapSafe();
placeProviderObject.radius = imageReceiver.getRoundRadius();
return placeProviderObject;
}
}
}
imageReceiver = null;
if (imageReceiver == null) {
}
}
}
return null;
}
@Override
public void sendButtonPressed(int i, VideoEditedInfo videoEditedInfo, boolean z, int i2) {
if (i < 0 || i >= ChatActivity.this.botContextResults.size()) {
return;
}
ChatActivity chatActivity = ChatActivity.this;
chatActivity.lambda$null$20$ChatActivity((TLRPC.BotInlineResult) chatActivity.botContextResults.get(i), z, i2);
}
};
this.onItemLongClickListener = new RecyclerListView.OnItemLongClickListenerExtended() {
@Override
public void onLongClickRelease() {
}
@Override
public void onMove(float f, float f2) {
}
@Override
public boolean onItemClick(View view, int i, float f, float f2) {
ChatActivity.this.wasManualScroll = true;
if (!ChatActivity.this.actionBar.isActionModeShowed()) {
ChatActivity.this.createMenu(view, false, true, f, f2);
} else {
ChatActivity.this.processRowSelect(view, view instanceof ChatMessageCell ? !((ChatMessageCell) view).isInsideBackground(f, f2) : false, f, f2);
}
return true;
}
};
this.onItemClickListener = new RecyclerListView.OnItemClickListenerExtended() {
@Override
public void onItemClick(View view, int i, float f, float f2) {
ChatActivity.this.wasManualScroll = true;
if (ChatActivity.this.actionBar.isActionModeShowed()) {
ChatActivity.this.processRowSelect(view, view instanceof ChatMessageCell ? !((ChatMessageCell) view).isInsideBackground(f, f2) : false, f, f2);
} else {
ChatActivity.this.createMenu(view, true, false, f, f2);
}
}
};
this.mTaskDisposable = new HashMap<>();
this.reqId = -1;
}
@Override
public boolean onFragmentCreate() {
int i;
int i2;
final int i3 = this.arguments.getInt("chat_id", 0);
final int i4 = this.arguments.getInt("user_id", 0);
final int i5 = this.arguments.getInt("enc_id", 0);
this.inScheduleMode = this.arguments.getBoolean("scheduled", false);
this.inlineReturn = this.arguments.getLong("inline_return", 0L);
String string = this.arguments.getString("inline_query");
this.startLoadFromMessageId = this.arguments.getInt("message_id", 0);
int i6 = this.arguments.getInt("migrated_to", 0);
this.scrollToTopOnResume = this.arguments.getBoolean("scrollToTopOnResume", false);
if (i3 != 0) {
TLRPC.Chat chat = getMessagesController().getChat(Integer.valueOf(i3));
this.currentChat = chat;
if (chat == null) {
final CountDownLatch countDownLatch = new CountDownLatch(1);
final MessagesStorage messagesStorage = getMessagesStorage();
messagesStorage.getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$onFragmentCreate$0$ChatActivity(messagesStorage, i3, countDownLatch);
}
});
try {
countDownLatch.await();
} catch (Exception e) {
FileLog.e(e);
}
if (this.currentChat == null) {
return false;
}
getMessagesController().putChat(this.currentChat, true);
}
this.dialog_id = -i3;
if (ChatObject.isChannel(this.currentChat)) {
getMessagesController().startShortPoll(this.currentChat, false);
}
} else if (i4 != 0) {
TLRPC.User user = getMessagesController().getUser(Integer.valueOf(i4));
this.currentUser = user;
if (user == null) {
final MessagesStorage messagesStorage2 = getMessagesStorage();
final CountDownLatch countDownLatch2 = new CountDownLatch(1);
messagesStorage2.getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$onFragmentCreate$1$ChatActivity(messagesStorage2, i4, countDownLatch2);
}
});
try {
countDownLatch2.await();
} catch (Exception e2) {
FileLog.e(e2);
}
if (this.currentUser == null) {
return false;
}
getMessagesController().putUser(this.currentUser, true);
}
this.dialog_id = i4;
this.botUser = this.arguments.getString("botUser");
if (string != null) {
getMessagesController().sendBotStart(this.currentUser, string);
}
} else if (i5 == 0) {
return false;
} else {
this.currentEncryptedChat = getMessagesController().getEncryptedChat(Integer.valueOf(i5));
final MessagesStorage messagesStorage3 = getMessagesStorage();
if (this.currentEncryptedChat == null) {
final CountDownLatch countDownLatch3 = new CountDownLatch(1);
messagesStorage3.getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$onFragmentCreate$2$ChatActivity(messagesStorage3, i5, countDownLatch3);
}
});
try {
countDownLatch3.await();
} catch (Exception e3) {
FileLog.e(e3);
}
if (this.currentEncryptedChat == null) {
return false;
}
getMessagesController().putEncryptedChat(this.currentEncryptedChat, true);
}
TLRPC.User user2 = getMessagesController().getUser(Integer.valueOf(this.currentEncryptedChat.user_id));
this.currentUser = user2;
if (user2 == null) {
final CountDownLatch countDownLatch4 = new CountDownLatch(1);
messagesStorage3.getStorageQueue().postRunnable(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$onFragmentCreate$3$ChatActivity(messagesStorage3, countDownLatch4);
}
});
try {
countDownLatch4.await();
} catch (Exception e4) {
FileLog.e(e4);
}
if (this.currentUser == null) {
return false;
}
getMessagesController().putUser(this.currentUser, true);
}
this.dialog_id = i5 << 32;
int[] iArr = this.maxMessageId;
iArr[1] = Integer.MIN_VALUE;
iArr[0] = Integer.MIN_VALUE;
int[] iArr2 = this.minMessageId;
iArr2[1] = Integer.MAX_VALUE;
iArr2[0] = Integer.MAX_VALUE;
}
if (this.currentUser != null) {
MediaController.getInstance().startMediaObserver();
}
if (!this.inScheduleMode) {
getNotificationCenter().addObserver(this, NotificationCenter.messagesRead);
getNotificationCenter().addObserver(this, NotificationCenter.screenshotTook);
getNotificationCenter().addObserver(this, NotificationCenter.encryptedChatUpdated);
getNotificationCenter().addObserver(this, NotificationCenter.messagesReadEncrypted);
getNotificationCenter().addObserver(this, NotificationCenter.removeAllMessagesFromDialog);
getNotificationCenter().addObserver(this, NotificationCenter.messagesReadContent);
getNotificationCenter().addObserver(this, NotificationCenter.botKeyboardDidLoad);
getNotificationCenter().addObserver(this, NotificationCenter.chatSearchResultsAvailable);
getNotificationCenter().addObserver(this, NotificationCenter.chatSearchResultsLoading);
getNotificationCenter().addObserver(this, NotificationCenter.didUpdatedMessagesViews);
getNotificationCenter().addObserver(this, NotificationCenter.pinnedMessageDidLoad);
getNotificationCenter().addObserver(this, NotificationCenter.peerSettingsDidLoad);
getNotificationCenter().addObserver(this, NotificationCenter.newDraftReceived);
getNotificationCenter().addObserver(this, NotificationCenter.updateMentionsCount);
getNotificationCenter().addObserver(this, NotificationCenter.didUpdatePollResults);
getNotificationCenter().addObserver(this, NotificationCenter.chatOnlineCountDidLoad);
}
getNotificationCenter().addObserver(this, NotificationCenter.messagesDidLoad);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiDidLoad);
getNotificationCenter().addObserver(this, NotificationCenter.didUpdateConnectionState);
getNotificationCenter().addObserver(this, NotificationCenter.updateInterfaces);
getNotificationCenter().addObserver(this, NotificationCenter.didReceiveNewMessages);
getNotificationCenter().addObserver(this, NotificationCenter.closeChats);
getNotificationCenter().addObserver(this, NotificationCenter.messagesDeleted);
getNotificationCenter().addObserver(this, NotificationCenter.historyCleared);
getNotificationCenter().addObserver(this, NotificationCenter.messageReceivedByServer);
getNotificationCenter().addObserver(this, NotificationCenter.messageReceivedByAck);
getNotificationCenter().addObserver(this, NotificationCenter.messageSendError);
getNotificationCenter().addObserver(this, NotificationCenter.chatInfoDidLoad);
getNotificationCenter().addObserver(this, NotificationCenter.contactsDidLoad);
getNotificationCenter().addObserver(this, NotificationCenter.messagePlayingProgressDidChanged);
getNotificationCenter().addObserver(this, NotificationCenter.messagePlayingDidReset);
getNotificationCenter().addObserver(this, NotificationCenter.messagePlayingGoingToStop);
getNotificationCenter().addObserver(this, NotificationCenter.messagePlayingPlayStateChanged);
getNotificationCenter().addObserver(this, NotificationCenter.blockedUsersDidLoad);
getNotificationCenter().addObserver(this, NotificationCenter.fileNewChunkAvailable);
getNotificationCenter().addObserver(this, NotificationCenter.didCreatedNewDeleteTask);
getNotificationCenter().addObserver(this, NotificationCenter.messagePlayingDidStart);
getNotificationCenter().addObserver(this, NotificationCenter.updateMessageMedia);
getNotificationCenter().addObserver(this, NotificationCenter.replaceMessagesObjects);
getNotificationCenter().addObserver(this, NotificationCenter.notificationsSettingsUpdated);
getNotificationCenter().addObserver(this, NotificationCenter.replyMessagesDidLoad);
getNotificationCenter().addObserver(this, NotificationCenter.didReceivedWebpages);
getNotificationCenter().addObserver(this, NotificationCenter.didReceivedWebpagesInUpdates);
getNotificationCenter().addObserver(this, NotificationCenter.botInfoDidLoad);
getNotificationCenter().addObserver(this, NotificationCenter.chatInfoCantLoad);
getNotificationCenter().addObserver(this, NotificationCenter.pinnedLiveMessage);
getNotificationCenter().addObserver(this, NotificationCenter.userInfoDidLoad);
getNotificationCenter().addObserver(this, NotificationCenter.userFullInfoDidLoad);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetNewWallpapper);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.goingToPreviewTheme);
getNotificationCenter().addObserver(this, NotificationCenter.channelRightsUpdated);
getNotificationCenter().addObserver(this, NotificationCenter.audioRecordTooShort);
getNotificationCenter().addObserver(this, NotificationCenter.didUpdateReactions);
getNotificationCenter().addObserver(this, NotificationCenter.videoLoadingStateChanged);
getNotificationCenter().addObserver(this, NotificationCenter.scheduledMessagesUpdated);
getNotificationCenter().addObserver(this, NotificationCenter.livestatechange);
getNotificationCenter().addObserver(this, NotificationCenter.contactRelationShip);
getNotificationCenter().addObserver(this, NotificationCenter.updateChatNewmsgMentionText);
getNotificationCenter().addObserver(this, NotificationCenter.liverestartnotify);
super.onFragmentCreate();
this.loading = true;
if (!this.inScheduleMode) {
if (this.currentEncryptedChat == null) {
getMediaDataController().loadBotKeyboard(this.dialog_id);
}
getMessagesController().loadPeerSettings(this.currentUser, this.currentChat);
getMessagesController().setLastCreatedDialogId(this.dialog_id, this.inScheduleMode, true);
if (this.startLoadFromMessageId == 0) {
SharedPreferences notificationsSettings = MessagesController.getNotificationsSettings(this.currentAccount);
int i7 = notificationsSettings.getInt("diditem" + this.dialog_id, 0);
if (i7 != 0) {
this.wasManualScroll = true;
this.loadingFromOldPosition = true;
this.startLoadFromMessageOffset = notificationsSettings.getInt("diditemo" + this.dialog_id, 0);
this.startLoadFromMessageId = i7;
}
} else {
this.showScrollToMessageError = true;
this.needSelectFromMessageId = true;
}
}
this.waitingForLoad.add(Integer.valueOf(this.lastLoadIndex));
int i8 = this.startLoadFromMessageId;
if (i8 != 0) {
this.startLoadFromMessageIdSaved = i8;
if (i6 != 0) {
this.mergeDialogId = i6;
MessagesController messagesController = getMessagesController();
long j = this.mergeDialogId;
if (this.loadingFromOldPosition) {
i2 = 50;
} else {
i2 = AndroidUtilities.isTablet() ? 30 : 20;
}
int i9 = this.startLoadFromMessageId;
int i10 = this.classGuid;
boolean isChannel = ChatObject.isChannel(this.currentChat);
boolean z = this.inScheduleMode;
int i11 = this.lastLoadIndex;
this.lastLoadIndex = i11 + 1;
messagesController.loadMessages(j, i2, i9, 0, true, 0, i10, 3, 0, isChannel, z, i11);
} else {
MessagesController messagesController2 = getMessagesController();
long j2 = this.dialog_id;
if (this.loadingFromOldPosition) {
i = 50;
} else {
i = AndroidUtilities.isTablet() ? 30 : 20;
}
int i12 = this.startLoadFromMessageId;
int i13 = this.classGuid;
boolean isChannel2 = ChatObject.isChannel(this.currentChat);
boolean z2 = this.inScheduleMode;
int i14 = this.lastLoadIndex;
this.lastLoadIndex = i14 + 1;
messagesController2.loadMessages(j2, i, i12, 0, true, 0, i13, 3, 0, isChannel2, z2, i14);
}
} else {
MessagesController messagesController3 = getMessagesController();
long j3 = this.dialog_id;
int i15 = AndroidUtilities.isTablet() ? 30 : 20;
int i16 = this.classGuid;
boolean isChannel3 = ChatObject.isChannel(this.currentChat);
int i17 = this.lastLoadIndex;
this.lastLoadIndex = i17 + 1;
messagesController3.loadMessages(j3, i15, 0, 0, true, 0, i16, 2, 0, isChannel3, false, i17);
}
if (this.currentChat != null) {
this.chatInfo = getMessagesController().getChatFull(this.currentChat.id);
if (this.currentChat.megagroup && !getMessagesController().isChannelAdminsLoaded(this.currentChat.id)) {
getMessagesController().loadChannelAdmins(this.currentChat.id, true);
}
TLRPC.ChatFull loadChatInfo = getMessagesStorage().loadChatInfo(this.currentChat.id, null, true, false);
if (this.chatInfo == null) {
this.chatInfo = loadChatInfo;
}
if (!this.inScheduleMode && this.chatInfo != null && ChatObject.isChannel(this.currentChat) && this.chatInfo.migrated_from_chat_id != 0) {
this.mergeDialogId = -this.chatInfo.migrated_from_chat_id;
this.maxMessageId[1] = this.chatInfo.migrated_from_max_id;
}
} else if (this.currentUser != null) {
getMessagesController().loadUserInfo(this.currentUser, true, this.classGuid);
}
if (!this.inScheduleMode) {
if (i4 != 0 && this.currentUser.bot) {
getMediaDataController().loadBotInfo(i4, true, this.classGuid);
} else if (this.chatInfo instanceof TLRPC.TL_chatFull) {
for (int i18 = 0; i18 < this.chatInfo.participants.participants.size(); i18++) {
TLRPC.User user3 = getMessagesController().getUser(Integer.valueOf(this.chatInfo.participants.participants.get(i18).user_id));
if (user3 != null && user3.bot) {
getMediaDataController().loadBotInfo(user3.id, true, this.classGuid);
}
}
}
if (AndroidUtilities.isTablet()) {
getNotificationCenter().postNotificationName(NotificationCenter.openedChatChanged, Long.valueOf(this.dialog_id), false);
}
if (this.currentUser != null) {
this.userBlocked = getMessagesController().blockedUsers.indexOfKey(this.currentUser.id) >= 0;
}
TLRPC.EncryptedChat encryptedChat = this.currentEncryptedChat;
if (encryptedChat != null && AndroidUtilities.getMyLayerVersion(encryptedChat.layer) != 101) {
getSecretChatHelper().sendNotifyLayerMessage(this.currentEncryptedChat, null);
}
}
return true;
}
public void lambda$onFragmentCreate$0$ChatActivity(MessagesStorage messagesStorage, int i, CountDownLatch countDownLatch) {
this.currentChat = messagesStorage.getChat(i);
countDownLatch.countDown();
}
public void lambda$onFragmentCreate$1$ChatActivity(MessagesStorage messagesStorage, int i, CountDownLatch countDownLatch) {
this.currentUser = messagesStorage.getUser(i);
countDownLatch.countDown();
}
public void lambda$onFragmentCreate$2$ChatActivity(MessagesStorage messagesStorage, int i, CountDownLatch countDownLatch) {
this.currentEncryptedChat = messagesStorage.getEncryptedChat(i);
countDownLatch.countDown();
}
public void lambda$onFragmentCreate$3$ChatActivity(MessagesStorage messagesStorage, CountDownLatch countDownLatch) {
this.currentUser = messagesStorage.getUser(this.currentEncryptedChat.user_id);
countDownLatch.countDown();
}
@Override
public void onFragmentDestroy() {
super.onFragmentDestroy();
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null) {
chatActivityEnterView.onDestroy();
}
MentionsAdapter mentionsAdapter = this.mentionsAdapter;
if (mentionsAdapter != null) {
mentionsAdapter.onDestroy();
}
ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
if (chatAttachAlert != null) {
chatAttachAlert.dismissInternal();
}
UndoView undoView = this.undoView;
if (undoView != null) {
undoView.hide(true, 0);
}
getMessagesController().setLastCreatedDialogId(this.dialog_id, this.inScheduleMode, false);
getNotificationCenter().removeObserver(this, NotificationCenter.messagesDidLoad);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiDidLoad);
getNotificationCenter().removeObserver(this, NotificationCenter.didUpdateConnectionState);
getNotificationCenter().removeObserver(this, NotificationCenter.updateInterfaces);
getNotificationCenter().removeObserver(this, NotificationCenter.didReceiveNewMessages);
getNotificationCenter().removeObserver(this, NotificationCenter.closeChats);
getNotificationCenter().removeObserver(this, NotificationCenter.messagesRead);
getNotificationCenter().removeObserver(this, NotificationCenter.messagesDeleted);
getNotificationCenter().removeObserver(this, NotificationCenter.historyCleared);
getNotificationCenter().removeObserver(this, NotificationCenter.messageReceivedByServer);
getNotificationCenter().removeObserver(this, NotificationCenter.messageReceivedByAck);
getNotificationCenter().removeObserver(this, NotificationCenter.messageSendError);
getNotificationCenter().removeObserver(this, NotificationCenter.chatInfoDidLoad);
getNotificationCenter().removeObserver(this, NotificationCenter.encryptedChatUpdated);
getNotificationCenter().removeObserver(this, NotificationCenter.messagesReadEncrypted);
getNotificationCenter().removeObserver(this, NotificationCenter.removeAllMessagesFromDialog);
getNotificationCenter().removeObserver(this, NotificationCenter.contactsDidLoad);
getNotificationCenter().removeObserver(this, NotificationCenter.messagePlayingProgressDidChanged);
getNotificationCenter().removeObserver(this, NotificationCenter.messagePlayingDidReset);
getNotificationCenter().removeObserver(this, NotificationCenter.screenshotTook);
getNotificationCenter().removeObserver(this, NotificationCenter.blockedUsersDidLoad);
getNotificationCenter().removeObserver(this, NotificationCenter.fileNewChunkAvailable);
getNotificationCenter().removeObserver(this, NotificationCenter.didCreatedNewDeleteTask);
getNotificationCenter().removeObserver(this, NotificationCenter.messagePlayingDidStart);
getNotificationCenter().removeObserver(this, NotificationCenter.messagePlayingGoingToStop);
getNotificationCenter().removeObserver(this, NotificationCenter.updateMessageMedia);
getNotificationCenter().removeObserver(this, NotificationCenter.replaceMessagesObjects);
getNotificationCenter().removeObserver(this, NotificationCenter.notificationsSettingsUpdated);
getNotificationCenter().removeObserver(this, NotificationCenter.replyMessagesDidLoad);
getNotificationCenter().removeObserver(this, NotificationCenter.didReceivedWebpages);
getNotificationCenter().removeObserver(this, NotificationCenter.didReceivedWebpagesInUpdates);
getNotificationCenter().removeObserver(this, NotificationCenter.messagesReadContent);
getNotificationCenter().removeObserver(this, NotificationCenter.botInfoDidLoad);
getNotificationCenter().removeObserver(this, NotificationCenter.botKeyboardDidLoad);
getNotificationCenter().removeObserver(this, NotificationCenter.chatSearchResultsAvailable);
getNotificationCenter().removeObserver(this, NotificationCenter.chatSearchResultsLoading);
getNotificationCenter().removeObserver(this, NotificationCenter.messagePlayingPlayStateChanged);
getNotificationCenter().removeObserver(this, NotificationCenter.didUpdatedMessagesViews);
getNotificationCenter().removeObserver(this, NotificationCenter.chatInfoCantLoad);
getNotificationCenter().removeObserver(this, NotificationCenter.pinnedLiveMessage);
getNotificationCenter().removeObserver(this, NotificationCenter.pinnedMessageDidLoad);
getNotificationCenter().removeObserver(this, NotificationCenter.peerSettingsDidLoad);
getNotificationCenter().removeObserver(this, NotificationCenter.newDraftReceived);
getNotificationCenter().removeObserver(this, NotificationCenter.userFullInfoDidLoad);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didSetNewWallpapper);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.goingToPreviewTheme);
getNotificationCenter().removeObserver(this, NotificationCenter.channelRightsUpdated);
getNotificationCenter().removeObserver(this, NotificationCenter.updateMentionsCount);
getNotificationCenter().removeObserver(this, NotificationCenter.audioRecordTooShort);
getNotificationCenter().removeObserver(this, NotificationCenter.didUpdatePollResults);
getNotificationCenter().removeObserver(this, NotificationCenter.didUpdateReactions);
getNotificationCenter().removeObserver(this, NotificationCenter.chatOnlineCountDidLoad);
getNotificationCenter().removeObserver(this, NotificationCenter.videoLoadingStateChanged);
getNotificationCenter().removeObserver(this, NotificationCenter.scheduledMessagesUpdated);
getNotificationCenter().removeObserver(this, NotificationCenter.livestatechange);
getNotificationCenter().removeObserver(this, NotificationCenter.contactRelationShip);
getNotificationCenter().removeObserver(this, NotificationCenter.updateChatNewmsgMentionText);
getNotificationCenter().removeObserver(this, NotificationCenter.liverestartnotify);
if (!this.inScheduleMode && AndroidUtilities.isTablet()) {
getNotificationCenter().postNotificationName(NotificationCenter.openedChatChanged, Long.valueOf(this.dialog_id), true);
}
if (this.currentUser != null) {
MediaController.getInstance().stopMediaObserver();
}
if (this.currentEncryptedChat != null) {
try {
if (Build.VERSION.SDK_INT >= 23 && (SharedConfig.passcodeHash.length() == 0 || SharedConfig.allowScreenCapture)) {
MediaController.getInstance().setFlagSecure(this, false);
}
} catch (Throwable th) {
FileLog.e(th);
}
}
if (this.currentUser != null) {
getMessagesController().cancelLoadFullUser(this.currentUser.id);
}
AndroidUtilities.removeAdjustResize(getParentActivity(), this.classGuid);
StickersAdapter stickersAdapter = this.stickersAdapter;
if (stickersAdapter != null) {
stickersAdapter.onDestroy();
}
ChatAttachAlert chatAttachAlert2 = this.chatAttachAlert;
if (chatAttachAlert2 != null) {
chatAttachAlert2.onDestroy();
}
AndroidUtilities.unlockOrientation(getParentActivity());
if (ChatObject.isChannel(this.currentChat)) {
getMessagesController().startShortPoll(this.currentChat, true);
}
translateUnSubscribeAllAudioTask();
}
private void animLivePinClose(final View view) {
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration(1000L);
animatorSet.playTogether(ObjectAnimator.ofFloat(view, "alpha", 1.0f, 0.0f), ObjectAnimator.ofFloat(view, "scaleX", 1.0f, 0.01f), ObjectAnimator.ofFloat(view, "scaleY", 1.0f, 0.01f), ObjectAnimator.ofFloat(view, "translationX", (AndroidUtilities.getRealScreenSize().y - AndroidUtilities.dp(100.0f)) - view.getLeft()), ObjectAnimator.ofFloat(view, "translationY", -AndroidUtilities.dp(80.0f)));
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
view.setVisibility(4);
ChatActivity.this.resetLivePinClose(view);
}
});
animatorSet.start();
}
public void resetLivePinClose(View view) {
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration(100L);
animatorSet.playTogether(ObjectAnimator.ofFloat(view, "alpha", 0.0f, 1.0f), ObjectAnimator.ofFloat(view, "scaleX", 0.01f, 1.0f), ObjectAnimator.ofFloat(view, "scaleY", 0.01f, 1.0f), ObjectAnimator.ofFloat(view, "translationX", 0.0f), ObjectAnimator.ofFloat(view, "translationY", 0.0f));
animatorSet.start();
}
@Override
public View createView(Context context) {
CharSequence charSequence;
MentionsAdapter mentionsAdapter;
CharSequence charSequence2;
TLRPC.ChatFull chatFull;
TLRPC.Chat chat;
boolean z;
TLRPC.Chat chat2;
TLRPC.User user;
TLRPC.Chat chat3;
TLRPC.Chat chat4;
if (this.chatMessageCellsCache.isEmpty()) {
for (int i = 0; i < 8; i++) {
this.chatMessageCellsCache.add(new ChatMessageCell(context, this));
}
}
for (int i2 = 1; i2 >= 0; i2--) {
this.selectedMessagesIds[i2].clear();
this.selectedMessagesCanCopyIds[i2].clear();
this.selectedMessagesCanStarIds[i2].clear();
}
this.cantDeleteMessagesCount = 0;
this.canEditMessagesCount = 0;
this.cantForwardMessagesCount = 0;
this.canForwardMessagesCount = 0;
this.cantCopyMessageCount = 0;
this.videoPlayerContainer = null;
this.voiceHintTextView = null;
this.hasOwnBackground = true;
ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
if (chatAttachAlert != null) {
try {
if (chatAttachAlert.isShowing()) {
this.chatAttachAlert.dismiss();
}
} catch (Exception unused) {
}
this.chatAttachAlert.onDestroy();
this.chatAttachAlert = null;
}
StickersAdapter stickersAdapter = this.stickersAdapter;
if (stickersAdapter != null) {
stickersAdapter.onDestroy();
this.stickersAdapter = null;
}
Theme.createChatResources(context, false);
this.actionBar.setAddToContainer(false);
if (this.inPreviewMode) {
this.actionBar.setBackButtonImage(0);
} else {
this.actionBar.setBackButtonImage(R.mipmap.ic_back);
}
this.actionBar.setActionBarMenuOnItemClick(new AnonymousClass6());
this.actionBarHelper = new ChatActionBarHelper(this, this.actionBar, this.currentEncryptedChat != null, this.inPreviewMode);
TLRPC.Chat chat5 = this.currentChat;
if (chat5 != null && !ChatObject.isChannel(chat5)) {
int i3 = this.currentChat.participants_count;
TLRPC.ChatFull chatFull2 = this.chatInfo;
if (chatFull2 != null) {
chatFull2.participants.participants.size();
}
}
ActionBarMenu createMenu = this.actionBar.createMenu();
if (this.currentEncryptedChat == null && !this.inScheduleMode) {
ActionBarMenuItem actionBarMenuItemSearchListener = createMenu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true).setActionBarMenuItemSearchListener(new AnonymousClass7());
this.searchItem = actionBarMenuItemSearchListener;
actionBarMenuItemSearchListener.setSearchFieldHint(LocaleController.getString("Search", R.string.Search));
this.searchItem.setVisibility(8);
}
if (!this.inScheduleMode) {
TLRPC.User user2 = this.currentUser;
if (isSysNotifyMessage().booleanValue()) {
this.headerItem = createMenu.addItem(18, R.mipmap.iv_chat_sys_notify_msg_unmute);
} else {
ActionBarMenuItem addItem = createMenu.addItem(0, R.drawable.bar_right_menu);
this.headerItem = addItem;
addItem.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
}
createActionBarMenuPop();
ActionBarMenuItem addItem2 = createMenu.addItem(0, R.drawable.ic_ab_other);
this.editTextItem = addItem2;
addItem2.setTag(null);
this.editTextItem.setVisibility(8);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(LocaleController.getString("Bold", R.string.Bold));
spannableStringBuilder.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface("fonts/rmedium.ttf")), 0, spannableStringBuilder.length(), 33);
this.editTextItem.addSubItem(50, spannableStringBuilder);
SpannableStringBuilder spannableStringBuilder2 = new SpannableStringBuilder(LocaleController.getString("Italic", R.string.Italic));
spannableStringBuilder2.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface("fonts/ritalic.ttf")), 0, spannableStringBuilder2.length(), 33);
this.editTextItem.addSubItem(51, spannableStringBuilder2);
SpannableStringBuilder spannableStringBuilder3 = new SpannableStringBuilder(LocaleController.getString("Mono", R.string.Mono));
spannableStringBuilder3.setSpan(new TypefaceSpan(Typeface.MONOSPACE), 0, spannableStringBuilder3.length(), 33);
this.editTextItem.addSubItem(52, spannableStringBuilder3);
TLRPC.EncryptedChat encryptedChat = this.currentEncryptedChat;
if (encryptedChat == null || (encryptedChat != null && AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 101)) {
SpannableStringBuilder spannableStringBuilder4 = new SpannableStringBuilder(LocaleController.getString("Strike", R.string.Strike));
TextStyleSpan.TextStyleRun textStyleRun = new TextStyleSpan.TextStyleRun();
textStyleRun.flags |= 8;
spannableStringBuilder4.setSpan(new TextStyleSpan(textStyleRun), 0, spannableStringBuilder4.length(), 33);
this.editTextItem.addSubItem(55, spannableStringBuilder4);
SpannableStringBuilder spannableStringBuilder5 = new SpannableStringBuilder(LocaleController.getString("Underline", R.string.Underline));
TextStyleSpan.TextStyleRun textStyleRun2 = new TextStyleSpan.TextStyleRun();
textStyleRun2.flags |= 16;
spannableStringBuilder5.setSpan(new TextStyleSpan(textStyleRun2), 0, spannableStringBuilder5.length(), 33);
this.editTextItem.addSubItem(56, spannableStringBuilder5);
}
this.editTextItem.addSubItem(53, LocaleController.getString("CreateLink", R.string.CreateLink));
this.editTextItem.addSubItem(54, LocaleController.getString("Regular", R.string.Regular));
if (this.searchItem != null) {
this.chatActionBarMenuPop.addSubItem(40, R.drawable.msg_search, LocaleController.getString("Search", R.string.Search));
}
TLRPC.Chat chat6 = this.currentChat;
if (chat6 != null && !chat6.creator) {
this.chatActionBarMenuPop.addSubItem(21, R.drawable.msg_report, LocaleController.getString("ReportChat", R.string.ReportChat));
}
if (this.currentUser != null) {
this.addContactItem = this.chatActionBarMenuPop.addSubItem(17, R.drawable.msg_addcontact, "");
}
if (this.currentEncryptedChat != null) {
this.timeItem2 = this.chatActionBarMenuPop.addSubItem(13, R.drawable.msg_timer, LocaleController.getString("SetTimer", R.string.SetTimer));
}
if (!ChatObject.isChannel(this.currentChat) || ((chat4 = this.currentChat) != null && chat4.megagroup && TextUtils.isEmpty(this.currentChat.username))) {
this.chatActionBarMenuPop.addSubItem(15, R.drawable.msg_clear, LocaleController.getString("ClearHistory", R.string.ClearHistory));
}
TLRPC.User user3 = this.currentUser;
if (user3 == null || !user3.self) {
this.muteItem = this.chatActionBarMenuPop.addSubItem(18, R.drawable.msg_mute, null);
}
if (ChatObject.isChannel(this.currentChat) && !this.currentChat.creator) {
if (!ChatObject.isNotInChat(this.currentChat)) {
if (this.currentChat.megagroup) {
this.chatActionBarMenuPop.addSubItem(16, R.drawable.msg_leave, LocaleController.getString("DeleteAndExit", R.string.DeleteAndExit));
} else {
this.chatActionBarMenuPop.addSubItem(16, R.drawable.msg_leave, LocaleController.getString("LeaveChannelMenu", R.string.LeaveChannelMenu));
}
}
} else if (!ChatObject.isChannel(this.currentChat)) {
if (this.currentChat != null) {
this.chatActionBarMenuPop.addSubItem(16, R.drawable.msg_leave, LocaleController.getString("DeleteAndExit", R.string.DeleteAndExit));
} else {
this.chatActionBarMenuPop.addSubItem(16, R.drawable.msg_delete, LocaleController.getString("DeleteChatUser", R.string.DeleteChatUser));
}
}
TLRPC.User user4 = this.currentUser;
if (user4 != null && user4.self) {
this.chatActionBarMenuPop.addSubItem(24, R.drawable.msg_home, LocaleController.getString("AddShortcut", R.string.AddShortcut));
}
TLRPC.User user5 = this.currentUser;
if (user5 != null && this.currentEncryptedChat == null && user5.bot) {
this.chatActionBarMenuPop.addSubItem(31, R.drawable.menu_settings, LocaleController.getString("BotSettings", R.string.BotSettings));
this.chatActionBarMenuPop.addSubItem(30, R.drawable.menu_help, LocaleController.getString("BotHelp", R.string.BotHelp));
updateBotButtons();
}
}
this.actionBarHelper.update();
updateTitleIcons();
if (!this.inScheduleMode) {
ActionBarMenuItem allowCloseAnimation = createMenu.addItem(14, R.drawable.ic_ab_other).setOverrideMenuClick(true).setAllowCloseAnimation(false);
this.attachItem = allowCloseAnimation;
allowCloseAnimation.setVisibility(8);
}
this.actionModeViews.clear();
if (this.inPreviewMode) {
this.headerItem.setAlpha(0.0f);
this.attachItem.setAlpha(0.0f);
}
ActionBarMenu createActionMode = this.actionBar.createActionMode();
NumberTextView numberTextView = new NumberTextView(createActionMode.getContext());
this.selectedMessagesCountTextView = numberTextView;
numberTextView.setTextSize(18);
this.selectedMessagesCountTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.selectedMessagesCountTextView.setTextColor(Theme.getColor(Theme.key_actionBarActionModeDefaultIcon));
createActionMode.addView(this.selectedMessagesCountTextView, LayoutHelper.createLinear(0, -1, 1.0f, 65, 0, 0, 0));
this.selectedMessagesCountTextView.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view, MotionEvent motionEvent) {
return ChatActivity.lambda$createView$4(view, motionEvent);
}
});
if (this.currentEncryptedChat == null) {
if (isSysNotifyMessage().booleanValue()) {
this.actionModeViews.add(createActionMode.addItemWithWidth(23, R.drawable.msg_edit, AndroidUtilities.dp(54.0f), LocaleController.getString("Edit", R.string.Edit)));
this.actionModeViews.add(createActionMode.addItemWithWidth(22, R.drawable.msg_fave, AndroidUtilities.dp(54.0f), LocaleController.getString("AddToFavorites", R.string.AddToFavorites)));
this.actionModeViews.add(createActionMode.addItemWithWidth(10, R.drawable.msg_copy, AndroidUtilities.dp(54.0f), LocaleController.getString("Copy", R.string.Copy)));
this.actionModeViews.add(createActionMode.addItemWithWidth(12, R.drawable.msg_delete, AndroidUtilities.dp(54.0f), LocaleController.getString("Delete", R.string.Delete)));
} else {
this.actionModeViews.add(createActionMode.addItemWithWidth(23, R.drawable.msg_edit, AndroidUtilities.dp(54.0f), LocaleController.getString("Edit", R.string.Edit)));
this.actionModeViews.add(createActionMode.addItemWithWidth(22, R.drawable.msg_fave, AndroidUtilities.dp(54.0f), LocaleController.getString("AddToFavorites", R.string.AddToFavorites)));
this.actionModeViews.add(createActionMode.addItemWithWidth(10, R.drawable.msg_copy, AndroidUtilities.dp(54.0f), LocaleController.getString("Copy", R.string.Copy)));
this.actionModeViews.add(createActionMode.addItemWithWidth(11, R.drawable.msg_forward, AndroidUtilities.dp(54.0f), LocaleController.getString("Forward", R.string.Forward)));
this.actionModeViews.add(createActionMode.addItemWithWidth(12, R.drawable.msg_delete, AndroidUtilities.dp(54.0f), LocaleController.getString("Delete", R.string.Delete)));
}
} else {
this.actionModeViews.add(createActionMode.addItemWithWidth(23, R.drawable.msg_edit, AndroidUtilities.dp(54.0f), LocaleController.getString("Edit", R.string.Edit)));
this.actionModeViews.add(createActionMode.addItemWithWidth(22, R.drawable.msg_fave, AndroidUtilities.dp(54.0f), LocaleController.getString("AddToFavorites", R.string.AddToFavorites)));
this.actionModeViews.add(createActionMode.addItemWithWidth(10, R.drawable.msg_copy, AndroidUtilities.dp(54.0f), LocaleController.getString("Copy", R.string.Copy)));
this.actionModeViews.add(createActionMode.addItemWithWidth(12, R.drawable.msg_delete, AndroidUtilities.dp(54.0f), LocaleController.getString("Delete", R.string.Delete)));
}
createActionMode.getItem(23).setVisibility((this.canEditMessagesCount == 1 && this.selectedMessagesIds[0].size() + this.selectedMessagesIds[1].size() == 1) ? 0 : 8);
createActionMode.getItem(10).setVisibility((this.currentEncryptedChat == null || this.selectedMessagesCanCopyIds[0].size() + this.selectedMessagesCanCopyIds[1].size() == 0) ? 8 : 0);
createActionMode.getItem(22).setVisibility(this.selectedMessagesCanStarIds[0].size() + this.selectedMessagesCanStarIds[1].size() != 0 ? 0 : 8);
createActionMode.getItem(12).setVisibility(this.cantDeleteMessagesCount == 0 ? 0 : 8);
checkActionBarMenu();
this.scrimPaint = new Paint() {
@Override
public void setAlpha(int i4) {
super.setAlpha(i4);
if (ChatActivity.this.fragmentView != null) {
ChatActivity.this.fragmentView.invalidate();
}
}
};
this.fragmentView = new AnonymousClass9(context);
SizeNotifierFrameLayout sizeNotifierFrameLayout = (SizeNotifierFrameLayout) this.fragmentView;
this.contentView = sizeNotifierFrameLayout;
sizeNotifierFrameLayout.setBackgroundImage(Theme.getCachedWallpaper(), Theme.isWallpaperMotion());
FrameLayout frameLayout = new FrameLayout(context);
this.emptyViewContainer = frameLayout;
frameLayout.setVisibility(4);
this.contentView.addView(this.emptyViewContainer, LayoutHelper.createFrame(-1, -2, 17));
this.emptyViewContainer.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view, MotionEvent motionEvent) {
return ChatActivity.lambda$createView$5(view, motionEvent);
}
});
if (this.currentEncryptedChat == null) {
if (!this.inScheduleMode && (((user = this.currentUser) != null && user.self) || ((chat3 = this.currentChat) != null && chat3.creator))) {
ChatBigEmptyView chatBigEmptyView = new ChatBigEmptyView(context, this.currentChat != null ? 1 : 2);
this.bigEmptyView = chatBigEmptyView;
this.emptyViewContainer.addView(chatBigEmptyView, new FrameLayout.LayoutParams(-2, -2, 17));
if (this.currentChat != null) {
this.bigEmptyView.setStatusText(AndroidUtilities.replaceTags(LocaleController.getString("GroupEmptyTitle1", R.string.GroupEmptyTitle1)));
}
} else {
TextView textView = new TextView(context);
this.emptyView = textView;
if (this.inScheduleMode) {
textView.setText(LocaleController.getString("NoScheduledMessages", R.string.NoScheduledMessages));
} else {
TLRPC.User user6 = this.currentUser;
if (user6 != null && user6.id != 777000 && this.currentUser.id != 429000 && this.currentUser.id != 4244000 && MessagesController.isSupportUser(this.currentUser)) {
this.emptyView.setText(LocaleController.getString("GotAQuestion", R.string.GotAQuestion));
} else {
this.emptyView.setText(LocaleController.getString("NoMessages", R.string.NoMessages));
}
}
this.emptyView.setTextSize(1, 14.0f);
this.emptyView.setGravity(17);
this.emptyView.setTextColor(Theme.getColor(Theme.key_chat_serviceText));
this.emptyView.setBackgroundResource(R.drawable.system);
this.emptyView.getBackground().setColorFilter(Theme.colorFilter);
this.emptyView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.emptyView.setPadding(AndroidUtilities.dp(10.0f), AndroidUtilities.dp(2.0f), AndroidUtilities.dp(10.0f), AndroidUtilities.dp(3.0f));
this.emptyViewContainer.addView(this.emptyView, new FrameLayout.LayoutParams(-2, -2, 17));
}
} else {
this.bigEmptyView = new ChatBigEmptyView(context, 0);
if (this.currentEncryptedChat.admin_id == getUserConfig().getClientUserId()) {
this.bigEmptyView.setStatusText(LocaleController.formatString("EncryptedPlaceholderTitleOutgoing", R.string.EncryptedPlaceholderTitleOutgoing, UserObject.getFirstName(this.currentUser)));
} else {
this.bigEmptyView.setStatusText(LocaleController.formatString("EncryptedPlaceholderTitleIncoming", R.string.EncryptedPlaceholderTitleIncoming, UserObject.getFirstName(this.currentUser)));
}
this.emptyViewContainer.addView(this.bigEmptyView, new FrameLayout.LayoutParams(-2, -2, 17));
}
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null) {
chatActivityEnterView.onDestroy();
if (!this.chatActivityEnterView.isEditingMessage()) {
charSequence = this.chatActivityEnterView.getFieldText();
mentionsAdapter = this.mentionsAdapter;
if (mentionsAdapter != null) {
mentionsAdapter.onDestroy();
}
this.chatListView = new RecyclerListView(context) {
private float endedTrackingX;
private long lastReplyButtonAnimationTime;
private long lastTrackingAnimationTime;
private int lastWidth;
private boolean maybeStartTracking;
private float replyButtonProgress;
private boolean slideAnimationInProgress;
private ChatMessageCell slidingView;
private boolean startedTracking;
private int startedTrackingPointerId;
private int startedTrackingX;
private int startedTrackingY;
private float trackAnimationProgress;
private boolean wasTrackingVibrate;
ArrayList<ChatMessageCell> drawTimeAfter = new ArrayList<>();
ArrayList<ChatMessageCell> drawNamesAfter = new ArrayList<>();
ArrayList<ChatMessageCell> drawCaptionAfter = new ArrayList<>();
@Override
public void onLayout(boolean z2, int i4, int i5, int i6, int i7) {
super.onLayout(z2, i4, i5, i6, i7);
int i8 = i6 - i4;
if (this.lastWidth != i8) {
this.lastWidth = i8;
if (ChatActivity.this.noSoundHintView != null) {
ChatActivity.this.noSoundHintView.hide();
}
if (ChatActivity.this.forwardHintView != null) {
ChatActivity.this.forwardHintView.hide();
}
if (ChatActivity.this.slowModeHint != null) {
ChatActivity.this.slowModeHint.hide();
}
}
ChatActivity.this.forceScrollToTop = false;
if (ChatActivity.this.chatAdapter.isBot) {
int childCount = getChildCount();
for (int i9 = 0; i9 < childCount; i9++) {
View childAt = getChildAt(i9);
if (childAt instanceof BotHelpCell) {
int measuredHeight = ((i7 - i5) / 2) - (childAt.getMeasuredHeight() / 2);
if (childAt.getTop() > measuredHeight) {
childAt.layout(0, measuredHeight, i8, childAt.getMeasuredHeight() + measuredHeight);
return;
}
return;
}
}
}
}
private void setGroupTranslationX(ChatMessageCell chatMessageCell, float f) {
MessageObject.GroupedMessages currentMessagesGroup = chatMessageCell.getCurrentMessagesGroup();
if (currentMessagesGroup == null) {
return;
}
int childCount = getChildCount();
for (int i4 = 0; i4 < childCount; i4++) {
View childAt = getChildAt(i4);
if (childAt != this && (childAt instanceof ChatMessageCell)) {
ChatMessageCell chatMessageCell2 = (ChatMessageCell) childAt;
if (chatMessageCell2.getCurrentMessagesGroup() == currentMessagesGroup) {
chatMessageCell2.setTranslationX(f);
chatMessageCell2.invalidate();
}
}
}
invalidate();
}
@Override
public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z2) {
if (ChatActivity.this.scrimPopupWindow != null) {
return false;
}
return super.requestChildRectangleOnScreen(view, rect, z2);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
boolean onInterceptTouchEvent = super.onInterceptTouchEvent(motionEvent);
if (ChatActivity.this.actionBar.isActionModeShowed()) {
return onInterceptTouchEvent;
}
processTouchEvent(motionEvent);
return onInterceptTouchEvent;
}
private void drawReplyButton(Canvas canvas) {
float f;
float min;
ChatMessageCell chatMessageCell = this.slidingView;
if (chatMessageCell == null) {
return;
}
float translationX = chatMessageCell.getTranslationX();
long currentTimeMillis = System.currentTimeMillis();
long min2 = Math.min(17L, currentTimeMillis - this.lastReplyButtonAnimationTime);
this.lastReplyButtonAnimationTime = currentTimeMillis;
boolean z2 = translationX <= ((float) (-AndroidUtilities.dp(50.0f)));
if (z2) {
float f2 = this.replyButtonProgress;
if (f2 < 1.0f) {
float f3 = f2 + (((float) min2) / 180.0f);
this.replyButtonProgress = f3;
if (f3 > 1.0f) {
this.replyButtonProgress = 1.0f;
} else {
invalidate();
}
}
} else {
float f4 = this.replyButtonProgress;
if (f4 > 0.0f) {
float f5 = f4 - (((float) min2) / 180.0f);
this.replyButtonProgress = f5;
if (f5 < 0.0f) {
this.replyButtonProgress = 0.0f;
} else {
invalidate();
}
}
}
if (z2) {
float f6 = this.replyButtonProgress;
f = f6 <= 0.8f ? (f6 / 0.8f) * 1.2f : 1.2f - (((f6 - 0.8f) / 0.2f) * 0.2f);
min = Math.min(255.0f, (this.replyButtonProgress / 0.8f) * 255.0f);
} else {
f = this.replyButtonProgress;
min = Math.min(255.0f, f * 255.0f);
}
int i4 = (int) min;
Theme.chat_shareDrawable.setAlpha(i4);
Theme.chat_replyIconDrawable.setAlpha(i4);
float measuredWidth = getMeasuredWidth() + (this.slidingView.getTranslationX() / 2.0f);
float top = this.slidingView.getTop() + (this.slidingView.getMeasuredHeight() / 2);
if (!Theme.isCustomTheme() || Theme.hasThemeKey(Theme.key_chat_shareBackground)) {
Theme.chat_shareDrawable.setColorFilter(Theme.getShareColorFilter(Theme.getColor(Theme.key_chat_shareBackground), false));
} else {
Theme.chat_shareDrawable.setColorFilter(Theme.colorFilter2);
}
Theme.chat_shareDrawable.setBounds((int) (measuredWidth - (AndroidUtilities.dp(14.0f) * f)), (int) (top - (AndroidUtilities.dp(14.0f) * f)), (int) ((AndroidUtilities.dp(14.0f) * f) + measuredWidth), (int) ((AndroidUtilities.dp(14.0f) * f) + top));
Theme.chat_shareDrawable.draw(canvas);
Theme.chat_replyIconDrawable.setBounds((int) (measuredWidth - (AndroidUtilities.dp(7.0f) * f)), (int) (top - (AndroidUtilities.dp(6.0f) * f)), (int) (measuredWidth + (AndroidUtilities.dp(7.0f) * f)), (int) (top + (AndroidUtilities.dp(5.0f) * f)));
Theme.chat_replyIconDrawable.draw(canvas);
Theme.chat_shareDrawable.setAlpha(255);
Theme.chat_replyIconDrawable.setAlpha(255);
}
private void processTouchEvent(MotionEvent motionEvent) {
ChatActivity.this.wasManualScroll = true;
if (motionEvent.getAction() == 0 && !this.startedTracking && !this.maybeStartTracking) {
View pressedChildView = getPressedChildView();
if (pressedChildView instanceof ChatMessageCell) {
ChatMessageCell chatMessageCell = (ChatMessageCell) pressedChildView;
this.slidingView = chatMessageCell;
MessageObject messageObject = chatMessageCell.getMessageObject();
if (ChatActivity.this.inScheduleMode || ((ChatActivity.this.currentEncryptedChat != null && AndroidUtilities.getPeerLayerVersion(ChatActivity.this.currentEncryptedChat.layer) < 46) || ((ChatActivity.this.getMessageType(messageObject) == 1 && (messageObject.getDialogId() == ChatActivity.this.mergeDialogId || messageObject.needDrawBluredPreview())) || ((ChatActivity.this.currentEncryptedChat == null && messageObject.getId() < 0) || messageObject.type == 101 || messageObject.type == 102 || messageObject.type == 105 || ((ChatActivity.this.bottomOverlayChat != null && ChatActivity.this.bottomOverlayChat.getVisibility() == 0) || (ChatActivity.this.currentChat != null && (ChatObject.isNotInChat(ChatActivity.this.currentChat) || ((ChatObject.isChannel(ChatActivity.this.currentChat) && !ChatObject.canPost(ChatActivity.this.currentChat) && !ChatActivity.this.currentChat.megagroup) || !ChatObject.canSendMessages(ChatActivity.this.currentChat))))))))) {
this.slidingView = null;
return;
}
this.startedTrackingPointerId = motionEvent.getPointerId(0);
this.maybeStartTracking = true;
this.startedTrackingX = (int) motionEvent.getX();
this.startedTrackingY = (int) motionEvent.getY();
}
} else if (this.slidingView != null && motionEvent.getAction() == 2 && motionEvent.getPointerId(0) == this.startedTrackingPointerId) {
int max = Math.max(AndroidUtilities.dp(-80.0f), Math.min(0, (int) (motionEvent.getX() - this.startedTrackingX)));
int abs = Math.abs(((int) motionEvent.getY()) - this.startedTrackingY);
if (getScrollState() == 0 && this.maybeStartTracking && !this.startedTracking && max <= (-AndroidUtilities.getPixelsInCM(0.4f, true)) && Math.abs(max) / 3 > abs) {
MotionEvent obtain = MotionEvent.obtain(0L, 0L, 3, 0.0f, 0.0f, 0);
this.slidingView.onTouchEvent(obtain);
super.onInterceptTouchEvent(obtain);
obtain.recycle();
ChatActivity.this.chatLayoutManager.setCanScrollVertically(false);
this.maybeStartTracking = false;
this.startedTracking = true;
this.startedTrackingX = (int) motionEvent.getX();
if (getParent() != null) {
getParent().requestDisallowInterceptTouchEvent(true);
}
} else if (this.startedTracking) {
if (Math.abs(max) >= AndroidUtilities.dp(50.0f)) {
if (!this.wasTrackingVibrate) {
try {
performHapticFeedback(3, 2);
} catch (Exception unused2) {
}
this.wasTrackingVibrate = true;
}
} else {
this.wasTrackingVibrate = false;
}
float f = max;
this.slidingView.setTranslationX(f);
MessageObject messageObject2 = this.slidingView.getMessageObject();
if (messageObject2.isRoundVideo() || messageObject2.isVideo()) {
ChatActivity.this.updateTextureViewPosition(false);
}
setGroupTranslationX(this.slidingView, f);
invalidate();
}
} else if (this.slidingView == null || motionEvent.getPointerId(0) != this.startedTrackingPointerId) {
} else {
if (motionEvent.getAction() == 3 || motionEvent.getAction() == 1 || motionEvent.getAction() == 6) {
if (Math.abs(this.slidingView.getTranslationX()) >= AndroidUtilities.dp(50.0f)) {
ChatActivity.this.showFieldPanelForReply(this.slidingView.getMessageObject());
}
this.endedTrackingX = this.slidingView.getTranslationX();
this.lastTrackingAnimationTime = System.currentTimeMillis();
this.trackAnimationProgress = 0.0f;
invalidate();
this.maybeStartTracking = false;
this.startedTracking = false;
ChatActivity.this.chatLayoutManager.setCanScrollVertically(true);
}
}
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
boolean onTouchEvent = super.onTouchEvent(motionEvent);
if (ChatActivity.this.actionBar.isActionModeShowed()) {
return onTouchEvent;
}
processTouchEvent(motionEvent);
return this.startedTracking || onTouchEvent;
}
@Override
public void requestDisallowInterceptTouchEvent(boolean z2) {
super.requestDisallowInterceptTouchEvent(z2);
ChatMessageCell chatMessageCell = this.slidingView;
if (chatMessageCell != null) {
this.endedTrackingX = chatMessageCell.getTranslationX();
this.lastTrackingAnimationTime = System.currentTimeMillis();
this.trackAnimationProgress = 0.0f;
invalidate();
this.maybeStartTracking = false;
this.startedTracking = false;
ChatActivity.this.chatLayoutManager.setCanScrollVertically(true);
}
}
@Override
public void onChildPressed(View view, boolean z2) {
MessageObject.GroupedMessages currentMessagesGroup;
super.onChildPressed(view, z2);
if (!(view instanceof ChatMessageCell) || (currentMessagesGroup = ((ChatMessageCell) view).getCurrentMessagesGroup()) == null) {
return;
}
int childCount = getChildCount();
for (int i4 = 0; i4 < childCount; i4++) {
View childAt = getChildAt(i4);
if (childAt != view && (childAt instanceof ChatMessageCell)) {
ChatMessageCell chatMessageCell = (ChatMessageCell) childAt;
if (chatMessageCell.getCurrentMessagesGroup() == currentMessagesGroup) {
chatMessageCell.setPressed(z2);
}
}
}
}
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
ChatMessageCell chatMessageCell = this.slidingView;
if (chatMessageCell != null) {
float translationX = chatMessageCell.getTranslationX();
if (!this.maybeStartTracking && !this.startedTracking && this.endedTrackingX != 0.0f && translationX != 0.0f) {
long currentTimeMillis = System.currentTimeMillis();
float f = this.trackAnimationProgress + (((float) (currentTimeMillis - this.lastTrackingAnimationTime)) / 180.0f);
this.trackAnimationProgress = f;
if (f > 1.0f) {
this.trackAnimationProgress = 1.0f;
}
this.lastTrackingAnimationTime = currentTimeMillis;
float interpolation = this.endedTrackingX * (1.0f - AndroidUtilities.decelerateInterpolator.getInterpolation(this.trackAnimationProgress));
if (interpolation == 0.0f) {
this.endedTrackingX = 0.0f;
}
setGroupTranslationX(this.slidingView, interpolation);
this.slidingView.setTranslationX(interpolation);
MessageObject messageObject = this.slidingView.getMessageObject();
if (messageObject.isRoundVideo() || messageObject.isVideo()) {
ChatActivity.this.updateTextureViewPosition(false);
}
invalidate();
}
drawReplyButton(canvas);
}
}
@Override
public void dispatchDraw(Canvas canvas) {
ChatActivity.this.drawLaterRoundProgressCell = null;
int childCount = getChildCount();
for (int i4 = 0; i4 < childCount; i4++) {
View childAt = getChildAt(i4);
if (childAt instanceof ChatMessageCell) {
ChatMessageCell chatMessageCell = (ChatMessageCell) childAt;
MessageObject.GroupedMessagePosition currentPosition = chatMessageCell.getCurrentPosition();
if (chatMessageCell.isDrawingSelectionBackground() && (currentPosition == null || (currentPosition.flags & 2) != 0)) {
int alpha = Color.alpha(Theme.getColor(Theme.key_chat_selectedBackground));
Theme.chat_replyLinePaint.setColor(Theme.getColor(Theme.key_chat_selectedBackground));
Theme.chat_replyLinePaint.setAlpha((int) (alpha * chatMessageCell.getHightlightAlpha()));
canvas.drawRect(0.0f, chatMessageCell.getTop(), getMeasuredWidth(), chatMessageCell.getBottom(), Theme.chat_replyLinePaint);
}
}
}
super.dispatchDraw(canvas);
}
@Override
public boolean drawChild(Canvas canvas, View view, long j) {
ChatMessageCell chatMessageCell;
int i4;
int i5;
RecyclerView.ViewHolder childViewHolder;
int i6;
ChatMessageCell chatMessageCell2;
int i7 = 0;
int i8 = 1;
boolean z2 = view == ChatActivity.this.scrimView;
boolean z3 = view instanceof ChatMessageCell;
if (z3) {
chatMessageCell = (ChatMessageCell) view;
MessageObject.GroupedMessagePosition currentPosition = chatMessageCell.getCurrentPosition();
MessageObject.GroupedMessages currentMessagesGroup = chatMessageCell.getCurrentMessagesGroup();
if (currentPosition != null) {
if (currentPosition.pw != currentPosition.spanSize && currentPosition.spanSize == 1000 && currentPosition.siblingHeights == null && currentMessagesGroup.hasSibling) {
i4 = chatMessageCell.getBackgroundDrawableLeft();
i5 = 0;
if (chatMessageCell.needDelayRoundProgressDraw()) {
}
if (!z2) {
chatMessageCell2 = (ChatMessageCell) ChatActivity.this.scrimView;
if (chatMessageCell2.getCurrentMessagesGroup() != null) {
z2 = true;
}
}
} else if (currentPosition.siblingHeights != null) {
i5 = view.getBottom() - AndroidUtilities.dp((chatMessageCell.isPinnedBottom() ? 1 : 0) + 1);
i4 = 0;
if (chatMessageCell.needDelayRoundProgressDraw()) {
ChatActivity.this.drawLaterRoundProgressCell = chatMessageCell;
}
if (!z2 && (ChatActivity.this.scrimView instanceof ChatMessageCell)) {
chatMessageCell2 = (ChatMessageCell) ChatActivity.this.scrimView;
if (chatMessageCell2.getCurrentMessagesGroup() != null && chatMessageCell2.getCurrentMessagesGroup() == currentMessagesGroup) {
z2 = true;
}
}
}
}
i4 = 0;
i5 = 0;
if (chatMessageCell.needDelayRoundProgressDraw()) {
}
if (!z2) {
}
} else {
chatMessageCell = null;
i4 = 0;
i5 = 0;
}
if (i4 != 0) {
canvas.save();
} else if (i5 != 0) {
canvas.save();
}
boolean drawChild = !z2 ? super.drawChild(canvas, view, j) : false;
if (i4 != 0 || i5 != 0) {
canvas.restore();
}
if (chatMessageCell != null) {
chatMessageCell.drawCheckBox(canvas);
}
int childCount = getChildCount();
int i9 = 0;
while (true) {
if (i9 >= childCount) {
i9 = 0;
break;
} else if (getChildAt(i9) == view) {
break;
} else {
i9++;
}
}
int i10 = childCount - 1;
if (i9 == i10) {
int size = this.drawTimeAfter.size();
if (size > 0) {
for (int i11 = 0; i11 < size; i11++) {
ChatMessageCell chatMessageCell3 = this.drawTimeAfter.get(i11);
canvas.save();
canvas.translate(chatMessageCell3.getLeft() + chatMessageCell3.getTranslationX(), chatMessageCell3.getTop());
chatMessageCell3.drawTime(canvas);
canvas.restore();
}
this.drawTimeAfter.clear();
}
int size2 = this.drawNamesAfter.size();
if (size2 > 0) {
for (int i12 = 0; i12 < size2; i12++) {
ChatMessageCell chatMessageCell4 = this.drawNamesAfter.get(i12);
canvas.save();
canvas.translate(chatMessageCell4.getLeft() + chatMessageCell4.getTranslationX(), chatMessageCell4.getTop());
chatMessageCell4.drawNamesLayout(canvas);
canvas.restore();
}
this.drawNamesAfter.clear();
}
int size3 = this.drawCaptionAfter.size();
if (size3 > 0) {
for (int i13 = 0; i13 < size3; i13++) {
ChatMessageCell chatMessageCell5 = this.drawCaptionAfter.get(i13);
if (chatMessageCell5.getCurrentPosition() != null) {
canvas.save();
canvas.translate(chatMessageCell5.getLeft() + chatMessageCell5.getTranslationX(), chatMessageCell5.getTop());
chatMessageCell5.drawCaptionLayout(canvas, (chatMessageCell5.getCurrentPosition().flags & 1) == 0);
canvas.restore();
}
}
this.drawCaptionAfter.clear();
}
}
if (z3) {
ChatMessageCell chatMessageCell6 = (ChatMessageCell) view;
MessageObject.GroupedMessagePosition currentPosition2 = chatMessageCell6.getCurrentPosition();
if (currentPosition2 != null) {
if (currentPosition2.last || (currentPosition2.minX == 0 && currentPosition2.minY == 0)) {
if (i9 == i10) {
canvas.save();
canvas.translate(chatMessageCell6.getLeft() + chatMessageCell6.getTranslationX(), chatMessageCell6.getTop());
if (currentPosition2.last) {
chatMessageCell6.drawTime(canvas);
}
if (currentPosition2.minX == 0 && currentPosition2.minY == 0) {
chatMessageCell6.drawNamesLayout(canvas);
}
canvas.restore();
} else {
if (currentPosition2.last) {
this.drawTimeAfter.add(chatMessageCell6);
}
if (currentPosition2.minX == 0 && currentPosition2.minY == 0 && chatMessageCell6.hasNameLayout()) {
this.drawNamesAfter.add(chatMessageCell6);
}
}
}
if (i9 == i10) {
canvas.save();
canvas.translate(chatMessageCell6.getLeft() + chatMessageCell6.getTranslationX(), chatMessageCell6.getTop());
if (chatMessageCell6.hasCaptionLayout() && (currentPosition2.flags & 8) != 0) {
chatMessageCell6.drawCaptionLayout(canvas, (currentPosition2.flags & 1) == 0);
}
canvas.restore();
} else if (chatMessageCell6.hasCaptionLayout() && (currentPosition2.flags & 8) != 0) {
this.drawCaptionAfter.add(chatMessageCell6);
}
}
MessageObject messageObject = chatMessageCell6.getMessageObject();
if (ChatActivity.this.videoPlayerContainer != null && ((messageObject.isRoundVideo() || messageObject.isVideo()) && MediaController.getInstance().isPlayingMessage(messageObject))) {
ImageReceiver photoImage = chatMessageCell6.getPhotoImage();
float imageX = photoImage.getImageX() + chatMessageCell6.getX();
float paddingTop = (((ChatActivity.this.fragmentView.getPaddingTop() + chatMessageCell6.getTop()) + photoImage.getImageY()) - ChatActivity.this.chatListViewClipTop) + ChatActivity.this.chatListView.getTranslationY() + (ChatActivity.this.inPreviewMode ? AndroidUtilities.statusBarHeight : 0);
if (ChatActivity.this.videoPlayerContainer.getTranslationX() != imageX || ChatActivity.this.videoPlayerContainer.getTranslationY() != paddingTop) {
ChatActivity.this.videoPlayerContainer.setTranslationX(imageX);
ChatActivity.this.videoPlayerContainer.setTranslationY(paddingTop);
ChatActivity.this.fragmentView.invalidate();
ChatActivity.this.videoPlayerContainer.invalidate();
}
}
ImageReceiver avatarImage = chatMessageCell6.getAvatarImage();
if (avatarImage != null) {
MessageObject.GroupedMessages validGroupedMessage = ChatActivity.this.getValidGroupedMessage(messageObject);
int top = view.getTop();
float translationX = chatMessageCell6.getTranslationX();
int top2 = view.getTop() + chatMessageCell6.getLayoutHeight();
int measuredHeight = ChatActivity.this.chatListView.getMeasuredHeight() - ChatActivity.this.chatListView.getPaddingBottom();
if (top2 > measuredHeight) {
top2 = measuredHeight;
}
if (chatMessageCell6.isPinnedTop() && (childViewHolder = ChatActivity.this.chatListView.getChildViewHolder(view)) != null) {
while (i7 < 20) {
i7++;
int adapterPosition = childViewHolder.getAdapterPosition();
if (validGroupedMessage == null || currentPosition2 == null) {
i6 = adapterPosition + 1;
} else {
int indexOf = validGroupedMessage.posArray.indexOf(currentPosition2);
if (indexOf < 0) {
break;
}
validGroupedMessage.posArray.size();
if ((currentPosition2.flags & 4) != 0) {
i6 = adapterPosition + indexOf + i8;
} else {
i6 = adapterPosition + 1;
for (int i14 = indexOf - 1; i14 >= 0 && validGroupedMessage.posArray.get(i14).maxY >= currentPosition2.minY; i14--) {
i6++;
}
}
}
childViewHolder = ChatActivity.this.chatListView.findViewHolderForAdapterPosition(i6);
if (childViewHolder == null) {
break;
}
top = childViewHolder.itemView.getTop();
if (top2 - AndroidUtilities.dp(48.0f) < childViewHolder.itemView.getBottom()) {
translationX = Math.min(childViewHolder.itemView.getTranslationX(), translationX);
}
if (!(childViewHolder.itemView instanceof ChatMessageCell) || !((ChatMessageCell) childViewHolder.itemView).isPinnedTop()) {
break;
}
i8 = 1;
}
}
if (top2 - AndroidUtilities.dp(48.0f) < top) {
AndroidUtilities.dp(48.0f);
}
if (translationX != 0.0f) {
canvas.save();
canvas.translate(translationX, 0.0f);
}
avatarImage.setImageY(view.getTop() + AndroidUtilities.dp(7.0f));
avatarImage.draw(canvas);
if (translationX != 0.0f) {
canvas.restore();
}
}
}
return drawChild;
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
AccessibilityNodeInfo.CollectionInfo collectionInfo;
if (ChatActivity.this.currentEncryptedChat != null) {
return;
}
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
if (Build.VERSION.SDK_INT < 19 || (collectionInfo = accessibilityNodeInfo.getCollectionInfo()) == null) {
return;
}
accessibilityNodeInfo.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain(collectionInfo.getRowCount(), 1, false));
}
@Override
public AccessibilityNodeInfo createAccessibilityNodeInfo() {
if (ChatActivity.this.currentEncryptedChat != null) {
return null;
}
return super.createAccessibilityNodeInfo();
}
};
if (this.currentEncryptedChat != null && Build.VERSION.SDK_INT >= 19) {
this.chatListView.setImportantForAccessibility(4);
}
this.chatListView.setInstantClick(true);
this.chatListView.setDisableHighlightState(true);
this.chatListView.setTag(1);
this.chatListView.setVerticalScrollBarEnabled(true);
RecyclerListView recyclerListView = this.chatListView;
ChatActivityAdapter chatActivityAdapter = new ChatActivityAdapter(context);
this.chatAdapter = chatActivityAdapter;
recyclerListView.setAdapter(chatActivityAdapter);
this.chatListView.setClipToPadding(false);
this.chatListView.setPadding(0, AndroidUtilities.dp(4.0f), 0, AndroidUtilities.dp(3.0f));
this.chatListView.setItemAnimator(null);
this.chatListView.setLayoutAnimation(null);
charSequence2 = charSequence;
GridLayoutManagerFixed gridLayoutManagerFixed = new GridLayoutManagerFixed(context, 1000, 1, true) {
@Override
public boolean supportsPredictiveItemAnimations() {
return false;
}
@Override
public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int i4) {
LinearSmoothScrollerMiddle linearSmoothScrollerMiddle = new LinearSmoothScrollerMiddle(recyclerView.getContext());
linearSmoothScrollerMiddle.setTargetPosition(i4);
startSmoothScroll(linearSmoothScrollerMiddle);
}
@Override
public boolean shouldLayoutChildFromOpositeSide(View view) {
if (view instanceof ChatMessageCell) {
return !((ChatMessageCell) view).getMessageObject().isOutOwner();
}
return false;
}
@Override
protected boolean hasSiblingChild(int i4) {
int i5;
if (i4 >= ChatActivity.this.chatAdapter.messagesStartRow && i4 < ChatActivity.this.chatAdapter.messagesEndRow && (i5 = i4 - ChatActivity.this.chatAdapter.messagesStartRow) >= 0 && i5 < ChatActivity.this.messages.size()) {
MessageObject messageObject = ChatActivity.this.messages.get(i5);
MessageObject.GroupedMessages validGroupedMessage = ChatActivity.this.getValidGroupedMessage(messageObject);
if (validGroupedMessage != null) {
MessageObject.GroupedMessagePosition groupedMessagePosition = validGroupedMessage.positions.get(messageObject);
if (groupedMessagePosition.minX != groupedMessagePosition.maxX && groupedMessagePosition.minY == groupedMessagePosition.maxY && groupedMessagePosition.minY != 0) {
int size = validGroupedMessage.posArray.size();
for (int i6 = 0; i6 < size; i6++) {
MessageObject.GroupedMessagePosition groupedMessagePosition2 = validGroupedMessage.posArray.get(i6);
if (groupedMessagePosition2 != groupedMessagePosition && groupedMessagePosition2.minY <= groupedMessagePosition.minY && groupedMessagePosition2.maxY >= groupedMessagePosition.minY) {
return true;
}
}
}
}
}
return false;
}
};
this.chatLayoutManager = gridLayoutManagerFixed;
gridLayoutManagerFixed.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int i4) {
int i5;
if (i4 < ChatActivity.this.chatAdapter.messagesStartRow || i4 >= ChatActivity.this.chatAdapter.messagesEndRow || (i5 = i4 - ChatActivity.this.chatAdapter.messagesStartRow) < 0 || i5 >= ChatActivity.this.messages.size()) {
return 1000;
}
MessageObject messageObject = ChatActivity.this.messages.get(i5);
MessageObject.GroupedMessages validGroupedMessage = ChatActivity.this.getValidGroupedMessage(messageObject);
if (validGroupedMessage != null) {
return validGroupedMessage.positions.get(messageObject).spanSize;
}
return 1000;
}
});
this.chatListView.setLayoutManager(this.chatLayoutManager);
this.chatListView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(Rect rect, View view, RecyclerView recyclerView, RecyclerView.State state) {
ChatMessageCell chatMessageCell;
MessageObject.GroupedMessages currentMessagesGroup;
MessageObject.GroupedMessagePosition currentPosition;
int i4 = 0;
rect.bottom = 0;
if (!(view instanceof ChatMessageCell) || (currentMessagesGroup = (chatMessageCell = (ChatMessageCell) view).getCurrentMessagesGroup()) == null || (currentPosition = chatMessageCell.getCurrentPosition()) == null || currentPosition.siblingHeights == null) {
return;
}
float max = Math.max(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) * 0.5f;
int captionHeight = chatMessageCell.getCaptionHeight();
for (int i5 = 0; i5 < currentPosition.siblingHeights.length; i5++) {
captionHeight += (int) Math.ceil(currentPosition.siblingHeights[i5] * max);
}
int round = captionHeight + ((currentPosition.maxY - currentPosition.minY) * Math.round(AndroidUtilities.density * 7.0f));
int size = currentMessagesGroup.posArray.size();
while (true) {
if (i4 >= size) {
break;
}
MessageObject.GroupedMessagePosition groupedMessagePosition = currentMessagesGroup.posArray.get(i4);
if (groupedMessagePosition.minY == currentPosition.minY && ((groupedMessagePosition.minX != currentPosition.minX || groupedMessagePosition.maxX != currentPosition.maxX || groupedMessagePosition.minY != currentPosition.minY || groupedMessagePosition.maxY != currentPosition.maxY) && groupedMessagePosition.minY == currentPosition.minY)) {
round -= ((int) Math.ceil(max * groupedMessagePosition.ph)) - AndroidUtilities.dp(4.0f);
break;
}
i4++;
}
rect.bottom = -round;
}
});
this.contentView.addView(this.chatListView, LayoutHelper.createFrame(-1, -1.0f));
this.chatListView.setOnItemLongClickListener(this.onItemLongClickListener);
this.chatListView.setOnItemClickListener(this.onItemClickListener);
this.chatListView.setOnScrollListener(new RecyclerView.OnScrollListener() {
private boolean scrollUp;
private float totalDy = 0.0f;
private final int scrollValue = AndroidUtilities.dp(100.0f);
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int i4) {
if (i4 == 0) {
ChatActivity.this.scrollingFloatingDate = false;
ChatActivity.this.scrollingChatListView = false;
ChatActivity.this.checkTextureViewPosition = false;
ChatActivity.this.hideFloatingDateView(true);
ChatActivity.this.checkAutoDownloadMessages(this.scrollUp);
if (SharedConfig.getDevicePerfomanceClass() == 0) {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.startAllHeavyOperations, 512);
return;
}
return;
}
if (i4 == 2) {
ChatActivity.this.wasManualScroll = true;
ChatActivity.this.scrollingChatListView = true;
} else if (i4 == 1) {
ChatActivity.this.wasManualScroll = true;
ChatActivity.this.scrollingFloatingDate = true;
ChatActivity.this.checkTextureViewPosition = true;
ChatActivity.this.scrollingChatListView = true;
}
if (SharedConfig.getDevicePerfomanceClass() == 0) {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.stopAllHeavyOperations, 512);
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int i4, int i5) {
ChatActivity.this.chatListView.invalidate();
this.scrollUp = i5 < 0;
if (!ChatActivity.this.wasManualScroll && i5 != 0) {
ChatActivity.this.wasManualScroll = true;
}
if (i5 != 0) {
if (ChatActivity.this.noSoundHintView != null) {
ChatActivity.this.noSoundHintView.hide();
}
if (ChatActivity.this.forwardHintView != null) {
ChatActivity.this.forwardHintView.hide();
}
}
if (i5 != 0 && ChatActivity.this.scrollingFloatingDate && !ChatActivity.this.currentFloatingTopIsNotMessage) {
if (ChatActivity.this.highlightMessageId != Integer.MAX_VALUE) {
ChatActivity.this.removeSelectedMessageHighlight();
ChatActivity.this.updateVisibleRows();
}
ChatActivity.this.showFloatingDateView(true);
}
ChatActivity.this.checkScrollForLoad(true);
int findFirstVisibleItemPosition = ChatActivity.this.chatLayoutManager.findFirstVisibleItemPosition();
if (findFirstVisibleItemPosition != -1) {
ChatActivity.this.chatAdapter.getItemCount();
if (findFirstVisibleItemPosition == 0 && ChatActivity.this.forwardEndReached[0]) {
ChatActivity.this.showPagedownButton(false, true);
} else if (i5 > 0) {
if (ChatActivity.this.pagedownButton.getTag() == null) {
float f = this.totalDy + i5;
this.totalDy = f;
if (f > this.scrollValue) {
this.totalDy = 0.0f;
ChatActivity.this.showPagedownButton(true, true);
ChatActivity.this.pagedownButtonShowedByScroll = true;
}
}
} else if (ChatActivity.this.pagedownButtonShowedByScroll && ChatActivity.this.pagedownButton.getTag() != null) {
float f2 = this.totalDy + i5;
this.totalDy = f2;
if (f2 < (-this.scrollValue)) {
ChatActivity.this.showPagedownButton(false, true);
this.totalDy = 0.0f;
}
}
}
ChatActivity.this.updateMessagesVisiblePart(true);
}
});
FrameLayout frameLayout2 = new FrameLayout(context);
this.progressView = frameLayout2;
frameLayout2.setVisibility(4);
this.contentView.addView(this.progressView, LayoutHelper.createFrame(-1, -1, 51));
View view = new View(context);
this.progressView2 = view;
view.setBackgroundResource(R.drawable.system_loader);
this.progressView2.getBackground().setColorFilter(Theme.colorFilter);
this.progressView.addView(this.progressView2, LayoutHelper.createFrame(36, 36, 17));
RadialProgressView radialProgressView = new RadialProgressView(context);
this.progressBar = radialProgressView;
radialProgressView.setSize(AndroidUtilities.dp(28.0f));
this.progressBar.setProgressColor(Theme.getColor(Theme.key_chat_serviceText));
this.progressView.addView(this.progressBar, LayoutHelper.createFrame(32, 32, 17));
ChatActionCell chatActionCell = new ChatActionCell(context) {
@Override
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
if (getAlpha() == 0.0f || ChatActivity.this.actionBar.isActionModeShowed()) {
return false;
}
return super.onInterceptTouchEvent(motionEvent);
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
if (getAlpha() == 0.0f || ChatActivity.this.actionBar.isActionModeShowed()) {
return false;
}
return super.onTouchEvent(motionEvent);
}
};
this.floatingDateView = chatActionCell;
chatActionCell.setAlpha(0.0f);
this.contentView.addView(this.floatingDateView, LayoutHelper.createFrame(-2.0f, -2.0f, 49, 0.0f, 4.0f, 0.0f, 0.0f));
this.floatingDateView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
ChatActivity.this.lambda$createView$6$ChatActivity(view2);
}
});
if (this.currentEncryptedChat == null) {
FrameLayout frameLayout3 = new FrameLayout(context);
this.pinnedMessageView = frameLayout3;
frameLayout3.setTag(1);
this.pinnedMessageView.setTranslationY(-AndroidUtilities.dp(50.0f));
this.pinnedMessageView.setVisibility(8);
this.pinnedMessageView.setBackgroundResource(R.drawable.blockpanel);
this.pinnedMessageView.getBackground().setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_topPanelBackground), PorterDuff.Mode.MULTIPLY));
this.contentView.addView(this.pinnedMessageView, LayoutHelper.createFrame(-1, 50, 51));
this.pinnedMessageView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
ChatActivity.this.lambda$createView$7$ChatActivity(view2);
}
});
FrameLayout frameLayout4 = new FrameLayout(context);
this.pinnedLiveMessageView = frameLayout4;
frameLayout4.setTag(2);
this.pinnedLiveMessageView.setTranslationY(-AndroidUtilities.dp(50.0f));
this.pinnedLiveMessageView.setVisibility(8);
this.pinnedLiveMessageView.setBackgroundResource(R.drawable.blockpanel);
TextView textView2 = new TextView(context);
textView2.setBackgroundColor(Color.parseColor("#CFD0D1"));
this.pinnedLiveMessageView.addView(textView2, LayoutHelper.createFrame(-1.0f, 0.5f, 51));
this.pinnedLiveMessageView.getBackground().setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_topPanelBackground), PorterDuff.Mode.MULTIPLY));
this.contentView.addView(this.pinnedLiveMessageView, LayoutHelper.createFrame(-1, 50, 51));
this.pinnedLiveMessageView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
ChatActivity.lambda$createView$8(view2);
}
});
View view2 = new View(context);
this.pinnedLineView = view2;
view2.setBackgroundColor(Theme.getColor(Theme.key_chat_topPanelLine));
this.pinnedMessageView.addView(this.pinnedLineView, LayoutHelper.createFrame(2.0f, 32.0f, 51, 8.0f, 8.0f, 0.0f, 0.0f));
BackupImageView backupImageView = new BackupImageView(context);
this.pinnedMessageImageView = backupImageView;
this.pinnedMessageView.addView(backupImageView, LayoutHelper.createFrame(32.0f, 32.0f, 51, 17.0f, 8.0f, 0.0f, 0.0f));
SimpleTextView simpleTextView = new SimpleTextView(context);
this.pinnedMessageNameTextView = simpleTextView;
simpleTextView.setTextSize(14);
this.pinnedMessageNameTextView.setTextColor(Theme.getColor(Theme.key_chat_topPanelTitle));
this.pinnedMessageNameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.pinnedMessageView.addView(this.pinnedMessageNameTextView, LayoutHelper.createFrame(-1.0f, AndroidUtilities.dp(18.0f), 51, 18.0f, 7.3f, 40.0f, 0.0f));
SimpleTextView simpleTextView2 = new SimpleTextView(context);
this.pinnedLiveMessageNameTextView = simpleTextView2;
simpleTextView2.setTextSize(14);
this.pinnedLiveMessageNameTextView.setTextColor(Theme.getColor(Theme.key_chat_topPanelTitle));
this.pinnedLiveMessageNameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.pinnedLiveMessageView.addView(this.pinnedLiveMessageNameTextView, LayoutHelper.createFrame(-1.0f, AndroidUtilities.dp(18.0f), 51, 18.0f, 7.3f, 40.0f, 0.0f));
SimpleTextView simpleTextView3 = new SimpleTextView(context);
this.pinnedMessageTextView = simpleTextView3;
simpleTextView3.setTextSize(14);
this.pinnedMessageTextView.setTextColor(Theme.getColor(Theme.key_chat_topPanelMessage));
this.pinnedMessageView.addView(this.pinnedMessageTextView, LayoutHelper.createFrame(-1.0f, AndroidUtilities.dp(18.0f), 51, 18.0f, 25.3f, 40.0f, 0.0f));
SimpleTextView simpleTextView4 = new SimpleTextView(context);
this.pinnedLiveMessageTextView = simpleTextView4;
simpleTextView4.setTextSize(14);
this.pinnedLiveMessageTextView.setTextColor(Theme.getColor(Theme.key_chat_topPanelMessage));
this.pinnedLiveMessageView.addView(this.pinnedLiveMessageTextView, LayoutHelper.createFrame(-1.0f, AndroidUtilities.dp(18.0f), 51, 18.0f, 25.3f, 40.0f, 0.0f));
ImageView imageView = new ImageView(context);
this.closePinned = imageView;
imageView.setImageResource(R.drawable.miniplayer_close);
this.closePinned.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_topPanelClose), PorterDuff.Mode.MULTIPLY));
this.closePinned.setScaleType(ImageView.ScaleType.CENTER);
this.closePinned.setContentDescription(LocaleController.getString("Close", R.string.Close));
this.pinnedMessageView.addView(this.closePinned, LayoutHelper.createFrame(36, 48, 53));
this.closePinned.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view3) {
ChatActivity.this.lambda$createView$10$ChatActivity(view3);
}
});
ImageView imageView2 = new ImageView(context);
this.closeLivePinned = imageView2;
imageView2.setImageResource(R.drawable.miniplayer_close);
this.closeLivePinned.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_topPanelClose), PorterDuff.Mode.MULTIPLY));
this.closeLivePinned.setScaleType(ImageView.ScaleType.CENTER);
this.closeLivePinned.setContentDescription(LocaleController.getString("Close", R.string.Close));
this.pinnedLiveMessageView.addView(this.closeLivePinned, LayoutHelper.createFrame(36, 48, 53));
this.closeLivePinned.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view3) {
ChatActivity.this.lambda$createView$11$ChatActivity(view3);
}
});
}
FrameLayout frameLayout5 = new FrameLayout(context) {
private boolean ignoreLayout;
@Override
protected void onMeasure(int i4, int i5) {
int size = View.MeasureSpec.getSize(i4);
if (ChatActivity.this.addToContactsButton != null && ChatActivity.this.addToContactsButton.getVisibility() == 0 && ChatActivity.this.reportSpamButton != null && ChatActivity.this.reportSpamButton.getVisibility() == 0) {
size = (size - AndroidUtilities.dp(31.0f)) / 2;
}
this.ignoreLayout = true;
if (ChatActivity.this.reportSpamButton != null && ChatActivity.this.reportSpamButton.getVisibility() == 0) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) ChatActivity.this.reportSpamButton.getLayoutParams();
layoutParams.width = size;
if (ChatActivity.this.addToContactsButton == null || ChatActivity.this.addToContactsButton.getVisibility() != 0) {
ChatActivity.this.reportSpamButton.setPadding(AndroidUtilities.dp(48.0f), 0, AndroidUtilities.dp(48.0f), 0);
layoutParams.leftMargin = 0;
} else {
ChatActivity.this.reportSpamButton.setPadding(AndroidUtilities.dp(4.0f), 0, AndroidUtilities.dp(19.0f), 0);
layoutParams.leftMargin = size;
}
}
if (ChatActivity.this.addToContactsButton != null && ChatActivity.this.addToContactsButton.getVisibility() == 0) {
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) ChatActivity.this.addToContactsButton.getLayoutParams();
layoutParams2.width = size;
if (ChatActivity.this.reportSpamButton == null || ChatActivity.this.reportSpamButton.getVisibility() != 0) {
ChatActivity.this.addToContactsButton.setPadding(AndroidUtilities.dp(48.0f), 0, AndroidUtilities.dp(48.0f), 0);
layoutParams2.leftMargin = 0;
} else {
ChatActivity.this.addToContactsButton.setPadding(AndroidUtilities.dp(11.0f), 0, AndroidUtilities.dp(4.0f), 0);
}
}
this.ignoreLayout = false;
super.onMeasure(i4, i5);
}
@Override
public void requestLayout() {
if (this.ignoreLayout) {
return;
}
super.requestLayout();
}
};
this.topChatPanelView = frameLayout5;
frameLayout5.setTag(1);
this.topChatPanelView.setTranslationY(-AndroidUtilities.dp(50.0f));
this.topChatPanelView.setVisibility(8);
this.topChatPanelView.setBackgroundResource(R.drawable.blockpanel);
this.topChatPanelView.getBackground().setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_topPanelBackground), PorterDuff.Mode.MULTIPLY));
this.contentView.addView(this.topChatPanelView, LayoutHelper.createFrame(-1, 50, 51));
TextView textView3 = new TextView(context);
this.reportSpamButton = textView3;
textView3.setTextColor(Theme.getColor(Theme.key_chat_reportSpam));
this.reportSpamButton.setTag(Theme.key_chat_reportSpam);
this.reportSpamButton.setTextSize(1, 14.0f);
this.reportSpamButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.reportSpamButton.setSingleLine(true);
this.reportSpamButton.setMaxLines(1);
this.reportSpamButton.setGravity(17);
this.topChatPanelView.addView(this.reportSpamButton, LayoutHelper.createFrame(-1.0f, -1.0f, 51, 0.0f, 0.0f, 0.0f, AndroidUtilities.dp(1.0f)));
this.reportSpamButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view3) {
ChatActivity.this.lambda$createView$13$ChatActivity(view3);
}
});
TextView textView4 = new TextView(context);
this.addToContactsButton = textView4;
textView4.setTextColor(Theme.getColor(Theme.key_chat_addContact));
this.addToContactsButton.setVisibility(8);
this.addToContactsButton.setTextSize(1, 14.0f);
this.addToContactsButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.addToContactsButton.setSingleLine(true);
this.addToContactsButton.setMaxLines(1);
this.addToContactsButton.setPadding(AndroidUtilities.dp(4.0f), 0, AndroidUtilities.dp(4.0f), 0);
this.addToContactsButton.setGravity(17);
this.topChatPanelView.addView(this.addToContactsButton, LayoutHelper.createFrame(-1.0f, -1.0f, 51, 0.0f, 0.0f, 0.0f, AndroidUtilities.dp(1.0f)));
this.addToContactsButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view3) {
ChatActivity.this.lambda$createView$14$ChatActivity(view3);
}
});
ImageView imageView3 = new ImageView(context);
this.closeReportSpam = imageView3;
imageView3.setImageResource(R.drawable.miniplayer_close);
this.closeReportSpam.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_topPanelClose), PorterDuff.Mode.MULTIPLY));
this.closeReportSpam.setScaleType(ImageView.ScaleType.CENTER);
this.topChatPanelView.addView(this.closeReportSpam, LayoutHelper.createFrame(48, 48, 53));
this.closeReportSpam.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view3) {
ChatActivity.this.lambda$createView$15$ChatActivity(view3);
}
});
FrameLayout frameLayout6 = new FrameLayout(context);
this.alertView = frameLayout6;
frameLayout6.setTag(1);
this.alertView.setTranslationY(-AndroidUtilities.dp(50.0f));
this.alertView.setVisibility(8);
this.alertView.setBackgroundResource(R.drawable.blockpanel);
this.alertView.getBackground().setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_topPanelBackground), PorterDuff.Mode.MULTIPLY));
this.contentView.addView(this.alertView, LayoutHelper.createFrame(-1, 50, 51));
TextView textView5 = new TextView(context);
this.alertNameTextView = textView5;
textView5.setTextSize(1, 14.0f);
this.alertNameTextView.setTextColor(Theme.getColor(Theme.key_chat_topPanelTitle));
this.alertNameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.alertNameTextView.setSingleLine(true);
this.alertNameTextView.setEllipsize(TextUtils.TruncateAt.END);
this.alertNameTextView.setMaxLines(1);
this.alertView.addView(this.alertNameTextView, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 8.0f, 5.0f, 8.0f, 0.0f));
TextView textView6 = new TextView(context);
this.alertTextView = textView6;
textView6.setTextSize(1, 14.0f);
this.alertTextView.setTextColor(Theme.getColor(Theme.key_chat_topPanelMessage));
this.alertTextView.setSingleLine(true);
this.alertTextView.setEllipsize(TextUtils.TruncateAt.END);
this.alertTextView.setMaxLines(1);
this.alertView.addView(this.alertTextView, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 8.0f, 23.0f, 8.0f, 0.0f));
FrameLayout frameLayout7 = new FrameLayout(context);
this.pagedownButton = frameLayout7;
frameLayout7.setVisibility(4);
this.contentView.addView(this.pagedownButton, LayoutHelper.createFrame(66.0f, 59.0f, 85, 0.0f, 0.0f, -3.0f, 5.0f));
this.pagedownButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view3) {
ChatActivity.this.lambda$createView$16$ChatActivity(view3);
}
});
FrameLayout frameLayout8 = new FrameLayout(context);
this.mentiondownButton = frameLayout8;
frameLayout8.setVisibility(4);
this.contentView.addView(this.mentiondownButton, LayoutHelper.createFrame(46.0f, 59.0f, 85, 0.0f, 0.0f, 7.0f, 5.0f));
this.mentiondownButton.setOnClickListener(new AnonymousClass17());
this.mentiondownButton.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public final boolean onLongClick(View view3) {
return ChatActivity.this.lambda$createView$17$ChatActivity(view3);
}
});
FrameLayout frameLayout9 = new FrameLayout(context) {
@Override
public void onDraw(Canvas canvas) {
int i4;
int dp;
if (ChatActivity.this.mentionListView.getChildCount() <= 0) {
return;
}
if (ChatActivity.this.mentionLayoutManager.getReverseLayout()) {
int dp2 = ChatActivity.this.mentionListViewScrollOffsetY + AndroidUtilities.dp(2.0f);
Theme.chat_composeShadowDrawable.setBounds(0, Theme.chat_composeShadowDrawable.getIntrinsicHeight() + dp2, getMeasuredWidth(), dp2);
Theme.chat_composeShadowDrawable.draw(canvas);
canvas.drawRect(0.0f, 0.0f, getMeasuredWidth(), dp2, Theme.chat_composeBackgroundPaint);
return;
}
if (!ChatActivity.this.mentionsAdapter.isBotContext() || !ChatActivity.this.mentionsAdapter.isMediaLayout() || ChatActivity.this.mentionsAdapter.getBotContextSwitch() != null) {
i4 = ChatActivity.this.mentionListViewScrollOffsetY;
dp = AndroidUtilities.dp(2.0f);
} else {
i4 = ChatActivity.this.mentionListViewScrollOffsetY;
dp = AndroidUtilities.dp(4.0f);
}
int i5 = i4 - dp;
int intrinsicHeight = Theme.chat_composeShadowDrawable.getIntrinsicHeight() + i5;
Theme.chat_composeShadowDrawable.setBounds(0, i5, getMeasuredWidth(), intrinsicHeight);
Theme.chat_composeShadowDrawable.draw(canvas);
canvas.drawRect(0.0f, intrinsicHeight, getMeasuredWidth(), getMeasuredHeight(), Theme.chat_composeBackgroundPaint);
}
@Override
public void requestLayout() {
if (ChatActivity.this.mentionListViewIgnoreLayout) {
return;
}
super.requestLayout();
}
};
this.mentionContainer = frameLayout9;
frameLayout9.setVisibility(8);
updateMessageListAccessibilityVisibility();
this.mentionContainer.setWillNotDraw(false);
this.contentView.addView(this.mentionContainer, LayoutHelper.createFrame(-1, 110, 83));
RecyclerListView recyclerListView2 = new RecyclerListView(context) {
private int lastHeight;
private int lastWidth;
@Override
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
if (ChatActivity.this.mentionLayoutManager.getReverseLayout()) {
if (!ChatActivity.this.mentionListViewIsScrolling && ChatActivity.this.mentionListViewScrollOffsetY != 0 && motionEvent.getY() > ChatActivity.this.mentionListViewScrollOffsetY) {
return false;
}
} else if (!ChatActivity.this.mentionListViewIsScrolling && ChatActivity.this.mentionListViewScrollOffsetY != 0 && motionEvent.getY() < ChatActivity.this.mentionListViewScrollOffsetY) {
return false;
}
return super.onInterceptTouchEvent(motionEvent) || ContentPreviewViewer.getInstance().onInterceptTouchEvent(motionEvent, ChatActivity.this.mentionListView, 0, null);
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
if (ChatActivity.this.mentionLayoutManager.getReverseLayout()) {
if (!ChatActivity.this.mentionListViewIsScrolling && ChatActivity.this.mentionListViewScrollOffsetY != 0 && motionEvent.getY() > ChatActivity.this.mentionListViewScrollOffsetY) {
return false;
}
} else if (!ChatActivity.this.mentionListViewIsScrolling && ChatActivity.this.mentionListViewScrollOffsetY != 0 && motionEvent.getY() < ChatActivity.this.mentionListViewScrollOffsetY) {
return false;
}
return super.onTouchEvent(motionEvent);
}
@Override
public void requestLayout() {
if (ChatActivity.this.mentionListViewIgnoreLayout) {
return;
}
super.requestLayout();
}
@Override
public void onLayout(boolean z2, int i4, int i5, int i6, int i7) {
int i8;
int i9;
int i10 = i6 - i4;
int i11 = i7 - i5;
if (ChatActivity.this.mentionLayoutManager.getReverseLayout() || ChatActivity.this.mentionListView == null || ChatActivity.this.mentionListViewLastViewPosition < 0 || i10 != this.lastWidth || i11 - this.lastHeight == 0) {
i8 = -1;
i9 = 0;
} else {
i8 = ChatActivity.this.mentionListViewLastViewPosition;
i9 = ((ChatActivity.this.mentionListViewLastViewTop + i11) - this.lastHeight) - getPaddingTop();
}
super.onLayout(z2, i4, i5, i6, i7);
if (i8 != -1) {
ChatActivity.this.mentionListViewIgnoreLayout = true;
if (!ChatActivity.this.mentionsAdapter.isBotContext() || !ChatActivity.this.mentionsAdapter.isMediaLayout()) {
ChatActivity.this.mentionLayoutManager.scrollToPositionWithOffset(i8, i9);
} else {
ChatActivity.this.mentionGridLayoutManager.scrollToPositionWithOffset(i8, i9);
}
super.onLayout(false, i4, i5, i6, i7);
ChatActivity.this.mentionListViewIgnoreLayout = false;
}
this.lastHeight = i11;
this.lastWidth = i10;
ChatActivity.this.mentionListViewUpdateLayout();
}
};
this.mentionListView = recyclerListView2;
recyclerListView2.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view3, MotionEvent motionEvent) {
return ChatActivity.this.lambda$createView$18$ChatActivity(view3, motionEvent);
}
});
this.mentionListView.setTag(2);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context) {
@Override
public boolean supportsPredictiveItemAnimations() {
return false;
}
};
this.mentionLayoutManager = linearLayoutManager;
linearLayoutManager.setOrientation(1);
ExtendedGridLayoutManager extendedGridLayoutManager = new ExtendedGridLayoutManager(context, 100) {
private Size size = new Size();
@Override
protected Size getSizeForItem(int i4) {
TLRPC.PhotoSize closestPhotoSizeWithSize;
if (ChatActivity.this.mentionsAdapter.getBotContextSwitch() != null) {
i4++;
}
this.size.width = 0.0f;
this.size.height = 0.0f;
Object item = ChatActivity.this.mentionsAdapter.getItem(i4);
if (item instanceof TLRPC.BotInlineResult) {
TLRPC.BotInlineResult botInlineResult = (TLRPC.BotInlineResult) item;
int i5 = 0;
if (botInlineResult.document != null) {
TLRPC.PhotoSize closestPhotoSizeWithSize2 = FileLoader.getClosestPhotoSizeWithSize(botInlineResult.document.thumbs, 90);
this.size.width = closestPhotoSizeWithSize2 != null ? closestPhotoSizeWithSize2.w : 100.0f;
this.size.height = closestPhotoSizeWithSize2 != null ? closestPhotoSizeWithSize2.h : 100.0f;
while (i5 < botInlineResult.document.attributes.size()) {
TLRPC.DocumentAttribute documentAttribute = botInlineResult.document.attributes.get(i5);
if ((documentAttribute instanceof TLRPC.TL_documentAttributeImageSize) || (documentAttribute instanceof TLRPC.TL_documentAttributeVideo)) {
this.size.width = documentAttribute.w;
this.size.height = documentAttribute.h;
break;
}
i5++;
}
} else if (botInlineResult.content != null) {
while (i5 < botInlineResult.content.attributes.size()) {
TLRPC.DocumentAttribute documentAttribute2 = botInlineResult.content.attributes.get(i5);
if ((documentAttribute2 instanceof TLRPC.TL_documentAttributeImageSize) || (documentAttribute2 instanceof TLRPC.TL_documentAttributeVideo)) {
this.size.width = documentAttribute2.w;
this.size.height = documentAttribute2.h;
break;
}
i5++;
}
} else if (botInlineResult.thumb != null) {
while (i5 < botInlineResult.thumb.attributes.size()) {
TLRPC.DocumentAttribute documentAttribute3 = botInlineResult.thumb.attributes.get(i5);
if ((documentAttribute3 instanceof TLRPC.TL_documentAttributeImageSize) || (documentAttribute3 instanceof TLRPC.TL_documentAttributeVideo)) {
this.size.width = documentAttribute3.w;
this.size.height = documentAttribute3.h;
break;
}
i5++;
}
} else if (botInlineResult.photo != null && (closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(botInlineResult.photo.sizes, AndroidUtilities.photoSize.intValue())) != null) {
this.size.width = closestPhotoSizeWithSize.w;
this.size.height = closestPhotoSizeWithSize.h;
}
}
return this.size;
}
@Override
public int getFlowItemCount() {
if (ChatActivity.this.mentionsAdapter.getBotContextSwitch() != null) {
return getItemCount() - 1;
}
return super.getFlowItemCount();
}
};
this.mentionGridLayoutManager = extendedGridLayoutManager;
extendedGridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int i4) {
if (ChatActivity.this.mentionsAdapter.getItem(i4) instanceof TLRPC.TL_inlineBotSwitchPM) {
return 100;
}
if (ChatActivity.this.mentionsAdapter.getBotContextSwitch() != null) {
i4--;
}
return ChatActivity.this.mentionGridLayoutManager.getSpanSizeForItem(i4);
}
});
this.mentionListView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(Rect rect, View view3, RecyclerView recyclerView, RecyclerView.State state) {
rect.left = 0;
rect.right = 0;
rect.top = 0;
rect.bottom = 0;
if (recyclerView.getLayoutManager() == ChatActivity.this.mentionGridLayoutManager) {
int childAdapterPosition = recyclerView.getChildAdapterPosition(view3);
if (ChatActivity.this.mentionsAdapter.getBotContextSwitch() == null) {
rect.top = AndroidUtilities.dp(2.0f);
} else if (childAdapterPosition == 0) {
return;
} else {
childAdapterPosition--;
if (!ChatActivity.this.mentionGridLayoutManager.isFirstRow(childAdapterPosition)) {
rect.top = AndroidUtilities.dp(2.0f);
}
}
rect.right = ChatActivity.this.mentionGridLayoutManager.isLastInRow(childAdapterPosition) ? 0 : AndroidUtilities.dp(2.0f);
}
}
});
this.mentionListView.setItemAnimator(null);
this.mentionListView.setLayoutAnimation(null);
this.mentionListView.setClipToPadding(false);
this.mentionListView.setLayoutManager(this.mentionLayoutManager);
this.mentionListView.setOverScrollMode(2);
this.mentionContainer.addView(this.mentionListView, LayoutHelper.createFrame(-1, -1.0f));
RecyclerListView recyclerListView3 = this.mentionListView;
MentionsAdapter mentionsAdapter2 = new MentionsAdapter(context, false, this.dialog_id, new MentionsAdapter.MentionsAdapterDelegate() {
@Override
public void needChangePanelVisibility(boolean z2) {
if (!ChatActivity.this.mentionsAdapter.isBotContext() || !ChatActivity.this.mentionsAdapter.isMediaLayout()) {
ChatActivity.this.mentionListView.setLayoutManager(ChatActivity.this.mentionLayoutManager);
} else {
ChatActivity.this.mentionListView.setLayoutManager(ChatActivity.this.mentionGridLayoutManager);
}
if (z2 && ChatActivity.this.bottomOverlay.getVisibility() == 0) {
z2 = false;
}
if (z2) {
if (ChatActivity.this.mentionListAnimation != null) {
ChatActivity.this.mentionListAnimation.cancel();
ChatActivity.this.mentionListAnimation = null;
}
if (ChatActivity.this.mentionContainer.getVisibility() == 0) {
ChatActivity.this.mentionContainer.setAlpha(1.0f);
return;
}
if (!ChatActivity.this.mentionsAdapter.isBotContext() || !ChatActivity.this.mentionsAdapter.isMediaLayout()) {
if (!ChatActivity.this.mentionLayoutManager.getReverseLayout()) {
ChatActivity.this.mentionLayoutManager.scrollToPositionWithOffset(0, ChatActivity.this.mentionLayoutManager.getReverseLayout() ? -10000 : 10000);
}
} else {
ChatActivity.this.mentionGridLayoutManager.scrollToPositionWithOffset(0, 10000);
}
if (!ChatActivity.this.allowStickersPanel || (ChatActivity.this.mentionsAdapter.isBotContext() && !ChatActivity.this.allowContextBotPanel && !ChatActivity.this.allowContextBotPanelSecond)) {
ChatActivity.this.mentionContainer.setAlpha(1.0f);
ChatActivity.this.mentionContainer.setVisibility(4);
ChatActivity.this.updateMessageListAccessibilityVisibility();
return;
}
if (ChatActivity.this.currentEncryptedChat != null && ChatActivity.this.mentionsAdapter.isBotContext()) {
SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
if (!globalMainSettings.getBoolean("secretbot", false)) {
AlertDialog.Builder builder = new AlertDialog.Builder(ChatActivity.this.getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("SecretChatContextBotAlert", R.string.SecretChatContextBotAlert));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
ChatActivity.this.showDialog(builder.create());
globalMainSettings.edit().putBoolean("secretbot", true).commit();
}
}
ChatActivity.this.mentionContainer.setVisibility(0);
ChatActivity.this.updateMessageListAccessibilityVisibility();
ChatActivity.this.mentionContainer.setTag(null);
ChatActivity.this.mentionListAnimation = new AnimatorSet();
ChatActivity.this.mentionListAnimation.playTogether(ObjectAnimator.ofFloat(ChatActivity.this.mentionContainer, View.ALPHA, 0.0f, 1.0f));
ChatActivity.this.mentionListAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.mentionListAnimation == null || !ChatActivity.this.mentionListAnimation.equals(animator)) {
return;
}
ChatActivity.this.mentionListAnimation = null;
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.mentionListAnimation == null || !ChatActivity.this.mentionListAnimation.equals(animator)) {
return;
}
ChatActivity.this.mentionListAnimation = null;
}
});
ChatActivity.this.mentionListAnimation.setDuration(200L);
ChatActivity.this.mentionListAnimation.start();
return;
}
if (ChatActivity.this.mentionListAnimation != null) {
ChatActivity.this.mentionListAnimation.cancel();
ChatActivity.this.mentionListAnimation = null;
}
if (ChatActivity.this.mentionContainer.getVisibility() == 8) {
return;
}
if (ChatActivity.this.allowStickersPanel) {
ChatActivity.this.mentionListAnimation = new AnimatorSet();
ChatActivity.this.mentionListAnimation.playTogether(ObjectAnimator.ofFloat(ChatActivity.this.mentionContainer, View.ALPHA, 0.0f));
ChatActivity.this.mentionListAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.mentionListAnimation == null || !ChatActivity.this.mentionListAnimation.equals(animator)) {
return;
}
ChatActivity.this.mentionContainer.setVisibility(8);
ChatActivity.this.mentionContainer.setTag(null);
ChatActivity.this.updateMessageListAccessibilityVisibility();
ChatActivity.this.mentionListAnimation = null;
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.mentionListAnimation == null || !ChatActivity.this.mentionListAnimation.equals(animator)) {
return;
}
ChatActivity.this.mentionListAnimation = null;
}
});
ChatActivity.this.mentionListAnimation.setDuration(200L);
ChatActivity.this.mentionListAnimation.start();
return;
}
ChatActivity.this.mentionContainer.setTag(null);
ChatActivity.this.mentionContainer.setVisibility(8);
ChatActivity.this.updateMessageListAccessibilityVisibility();
}
@Override
public void onContextSearch(boolean z2) {
if (ChatActivity.this.chatActivityEnterView != null) {
ChatActivity.this.chatActivityEnterView.setCaption(ChatActivity.this.mentionsAdapter.getBotCaption());
ChatActivity.this.chatActivityEnterView.showContextProgress(z2);
}
}
@Override
public void onContextClick(TLRPC.BotInlineResult botInlineResult) {
if (ChatActivity.this.getParentActivity() == null || botInlineResult.content == null) {
return;
}
if (botInlineResult.type.equals(MimeTypes.BASE_TYPE_VIDEO) || botInlineResult.type.equals("web_player_video")) {
int[] inlineResultWidthAndHeight = MessageObject.getInlineResultWidthAndHeight(botInlineResult);
EmbedBottomSheet.show(ChatActivity.this.getParentActivity(), botInlineResult.title != null ? botInlineResult.title : "", botInlineResult.description, botInlineResult.content.url, botInlineResult.content.url, inlineResultWidthAndHeight[0], inlineResultWidthAndHeight[1]);
return;
}
Browser.openUrl(ChatActivity.this.getParentActivity(), botInlineResult.content.url);
}
});
this.mentionsAdapter = mentionsAdapter2;
recyclerListView3.setAdapter(mentionsAdapter2);
if (ChatObject.isChannel(this.currentChat) || ((chat2 = this.currentChat) != null && chat2.megagroup)) {
this.mentionsAdapter.setBotInfo(this.botInfo);
}
this.mentionsAdapter.setParentFragment(this);
this.mentionsAdapter.setChatInfo(this.chatInfo);
this.mentionsAdapter.setNeedUsernames(this.currentChat == null);
MentionsAdapter mentionsAdapter3 = this.mentionsAdapter;
TLRPC.EncryptedChat encryptedChat2 = this.currentEncryptedChat;
mentionsAdapter3.setNeedBotContext(encryptedChat2 != null || AndroidUtilities.getPeerLayerVersion(encryptedChat2.layer) >= 46);
this.mentionsAdapter.setBotsCount(this.currentChat == null ? this.botsCount : 1);
RecyclerListView recyclerListView4 = this.mentionListView;
RecyclerListView.OnItemClickListener onItemClickListener = new RecyclerListView.OnItemClickListener() {
@Override
public final void onItemClick(View view3, int i4) {
ChatActivity.this.lambda$createView$21$ChatActivity(view3, i4);
}
};
this.mentionsOnItemClickListener = onItemClickListener;
recyclerListView4.setOnItemClickListener(onItemClickListener);
this.mentionListView.setOnItemLongClickListener(new RecyclerListView.OnItemLongClickListener() {
@Override
public final boolean onItemClick(View view3, int i4) {
return ChatActivity.this.lambda$createView$23$ChatActivity(view3, i4);
}
});
this.mentionListView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int i4) {
ChatActivity.this.mentionListViewIsScrolling = i4 == 1;
}
@Override
public void onScrolled(RecyclerView recyclerView, int i4, int i5) {
int findLastVisibleItemPosition = (ChatActivity.this.mentionsAdapter.isBotContext() && ChatActivity.this.mentionsAdapter.isMediaLayout()) ? ChatActivity.this.mentionGridLayoutManager.findLastVisibleItemPosition() : ChatActivity.this.mentionLayoutManager.findLastVisibleItemPosition();
if ((findLastVisibleItemPosition == -1 ? 0 : findLastVisibleItemPosition) > 0 && findLastVisibleItemPosition > ChatActivity.this.mentionsAdapter.getItemCount() - 5) {
ChatActivity.this.mentionsAdapter.searchForContextBotForNextOffset();
}
ChatActivity.this.mentionListViewUpdateLayout();
}
});
ImageView imageView4 = new ImageView(context);
this.pagedownButtonImage = imageView4;
imageView4.setImageResource(R.drawable.pagedown);
this.pagedownButtonImage.setScaleType(ImageView.ScaleType.CENTER);
this.pagedownButtonImage.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_goDownButtonIcon), PorterDuff.Mode.MULTIPLY));
this.pagedownButtonImage.setPadding(0, AndroidUtilities.dp(2.0f), 0, 0);
Drawable createCircleDrawable = Theme.createCircleDrawable(AndroidUtilities.dp(42.0f), Theme.getColor(Theme.key_chat_goDownButton));
Drawable mutate = context.getResources().getDrawable(R.drawable.pagedown_shadow).mutate();
mutate.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_goDownButtonShadow), PorterDuff.Mode.MULTIPLY));
CombinedDrawable combinedDrawable = new CombinedDrawable(mutate, createCircleDrawable, 0, 0);
combinedDrawable.setIconSize(AndroidUtilities.dp(42.0f), AndroidUtilities.dp(42.0f));
this.pagedownButtonImage.setBackgroundDrawable(combinedDrawable);
this.pagedownButton.addView(this.pagedownButtonImage, LayoutHelper.createFrame(46, 46, 81));
this.pagedownButton.setContentDescription(LocaleController.getString("AccDescrPageDown", R.string.AccDescrPageDown));
TextView textView7 = new TextView(context);
this.pagedownButtonCounter = textView7;
textView7.setVisibility(4);
this.pagedownButtonCounter.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.pagedownButtonCounter.setTextSize(1, 13.0f);
this.pagedownButtonCounter.setTextColor(Theme.getColor(Theme.key_chat_goDownButtonCounter));
this.pagedownButtonCounter.setGravity(17);
this.pagedownButtonCounter.setBackgroundDrawable(Theme.createRoundRectDrawable(AndroidUtilities.dp(11.5f), Theme.getColor(Theme.key_chat_goDownButtonCounterBackground)));
this.pagedownButtonCounter.setMinWidth(AndroidUtilities.dp(23.0f));
this.pagedownButtonCounter.setPadding(AndroidUtilities.dp(8.0f), 0, AndroidUtilities.dp(8.0f), AndroidUtilities.dp(1.0f));
this.pagedownButton.addView(this.pagedownButtonCounter, LayoutHelper.createFrame(-2, 23, 49));
ImageView imageView5 = new ImageView(context);
this.mentiondownButtonImage = imageView5;
imageView5.setImageResource(R.drawable.mentionbutton);
this.mentiondownButtonImage.setScaleType(ImageView.ScaleType.CENTER);
this.mentiondownButtonImage.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_goDownButtonIcon), PorterDuff.Mode.MULTIPLY));
this.mentiondownButtonImage.setPadding(0, AndroidUtilities.dp(2.0f), 0, 0);
Drawable createCircleDrawable2 = Theme.createCircleDrawable(AndroidUtilities.dp(42.0f), Theme.getColor(Theme.key_chat_goDownButton));
Drawable mutate2 = context.getResources().getDrawable(R.drawable.pagedown_shadow).mutate();
mutate2.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_goDownButtonShadow), PorterDuff.Mode.MULTIPLY));
CombinedDrawable combinedDrawable2 = new CombinedDrawable(mutate2, createCircleDrawable2, 0, 0);
combinedDrawable2.setIconSize(AndroidUtilities.dp(42.0f), AndroidUtilities.dp(42.0f));
this.mentiondownButtonImage.setBackgroundDrawable(combinedDrawable2);
this.mentiondownButton.addView(this.mentiondownButtonImage, LayoutHelper.createFrame(46, 46, 83));
TextView textView8 = new TextView(context);
this.mentiondownButtonCounter = textView8;
textView8.setVisibility(4);
this.mentiondownButtonCounter.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.mentiondownButtonCounter.setTextSize(1, 13.0f);
this.mentiondownButtonCounter.setTextColor(Theme.getColor(Theme.key_chat_goDownButtonCounter));
this.mentiondownButtonCounter.setGravity(17);
this.mentiondownButtonCounter.setBackgroundDrawable(Theme.createRoundRectDrawable(AndroidUtilities.dp(11.5f), Theme.getColor(Theme.key_chat_goDownButtonCounterBackground)));
this.mentiondownButtonCounter.setMinWidth(AndroidUtilities.dp(23.0f));
this.mentiondownButtonCounter.setPadding(AndroidUtilities.dp(8.0f), 0, AndroidUtilities.dp(8.0f), AndroidUtilities.dp(1.0f));
this.mentiondownButton.addView(this.mentiondownButtonCounter, LayoutHelper.createFrame(-2, 23, 49));
this.mentiondownButton.setContentDescription(LocaleController.getString("AccDescrMentionDown", R.string.AccDescrMentionDown));
if (AndroidUtilities.isTablet() || AndroidUtilities.isSmallTablet()) {
FragmentContextView fragmentContextView = new FragmentContextView(context, this, true);
this.contentView.addView(fragmentContextView, LayoutHelper.createFrame(-1.0f, 39.0f, 51, 0.0f, -36.0f, 0.0f, 0.0f));
SizeNotifierFrameLayout sizeNotifierFrameLayout2 = this.contentView;
FragmentContextView fragmentContextView2 = new FragmentContextView(context, this, false);
this.fragmentContextView = fragmentContextView2;
sizeNotifierFrameLayout2.addView(fragmentContextView2, LayoutHelper.createFrame(-1.0f, 39.0f, 51, 0.0f, -36.0f, 0.0f, 0.0f));
this.fragmentContextView.setAdditionalContextView(fragmentContextView);
fragmentContextView.setAdditionalContextView(this.fragmentContextView);
}
this.contentView.addView(this.actionBar);
this.pinnedLiveUserImageView = new BackupImageView(context);
TLRPC.User currentUser = getUserConfig().getCurrentUser();
AvatarDrawable avatarDrawable = new AvatarDrawable();
avatarDrawable.setInfo(currentUser);
this.pinnedLiveUserImageView.setVisibility(8);
this.pinnedLiveUserImageView.setRoundRadius(AndroidUtilities.dp(5.0f));
this.pinnedLiveUserImageView.setImage(ImageLocation.getForUser(currentUser, false), "50_50", avatarDrawable, currentUser);
this.contentView.addView(this.pinnedLiveUserImageView, LayoutHelper.createFrame(32.0f, 32.0f, 51, 17.0f, 8.0f, 0.0f, 0.0f));
View view3 = new View(context);
this.overlayView = view3;
view3.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view4, MotionEvent motionEvent) {
return ChatActivity.this.lambda$createView$24$ChatActivity(view4, motionEvent);
}
});
this.contentView.addView(this.overlayView, LayoutHelper.createFrame(-1, -1, 51));
this.overlayView.setVisibility(8);
InstantCameraView instantCameraView = new InstantCameraView(context, this);
this.instantCameraView = instantCameraView;
this.contentView.addView(instantCameraView, LayoutHelper.createFrame(-1, -1, 51));
FrameLayout frameLayout10 = new FrameLayout(context) {
@Override
public void onDraw(Canvas canvas) {
int intrinsicHeight = Theme.chat_composeShadowDrawable.getIntrinsicHeight();
Theme.chat_composeShadowDrawable.setBounds(0, 0, getMeasuredWidth(), intrinsicHeight);
Theme.chat_composeShadowDrawable.draw(canvas);
canvas.drawRect(0.0f, intrinsicHeight, getMeasuredWidth(), getMeasuredHeight(), Theme.chat_composeBackgroundPaint);
}
};
this.bottomMessagesActionContainer = frameLayout10;
frameLayout10.setVisibility(4);
this.bottomMessagesActionContainer.setWillNotDraw(false);
this.bottomMessagesActionContainer.setPadding(0, AndroidUtilities.dp(2.0f), 0, 0);
this.contentView.addView(this.bottomMessagesActionContainer, LayoutHelper.createFrame(-1, 51, 80));
this.bottomMessagesActionContainer.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view4, MotionEvent motionEvent) {
return ChatActivity.lambda$createView$25(view4, motionEvent);
}
});
ChatActivityEnterView chatActivityEnterView2 = new ChatActivityEnterView(getParentActivity(), this.contentView, this, true) {
@Override
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
if (getAlpha() != 1.0f) {
return false;
}
return super.onInterceptTouchEvent(motionEvent);
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
if (getAlpha() != 1.0f) {
return false;
}
return super.onTouchEvent(motionEvent);
}
@Override
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
if (getAlpha() != 1.0f) {
return false;
}
return super.dispatchTouchEvent(motionEvent);
}
};
this.chatActivityEnterView = chatActivityEnterView2;
chatActivityEnterView2.setDelegate(new ChatActivityEnterView.ChatActivityEnterViewDelegate() {
@Override
public void onMessageSend(CharSequence charSequence3, boolean z2, int i4) {
if (!ChatActivity.this.inScheduleMode) {
ChatActivity.this.moveScrollToLastMessage();
}
if (ChatActivity.this.mentionsAdapter != null) {
ChatActivity.this.mentionsAdapter.addHashtagsFromMessage(charSequence3);
}
if (i4 != 0) {
if (ChatActivity.this.scheduledMessagesCount == -1) {
ChatActivity.this.scheduledMessagesCount = 0;
}
if (charSequence3 != null) {
ChatActivity.access$17708(ChatActivity.this);
}
if (ChatActivity.this.forwardingMessages != null && !ChatActivity.this.forwardingMessages.isEmpty()) {
ChatActivity.this.scheduledMessagesCount += ChatActivity.this.forwardingMessages.size();
}
ChatActivity.this.updateScheduledInterface(false);
}
ChatActivity.this.hideFieldPanel(z2, i4, false);
}
@Override
public void onSwitchRecordMode(boolean z2) {
ChatActivity.this.showVoiceHint(false, z2);
}
@Override
public void onPreAudioVideoRecord() {
ChatActivity.this.showVoiceHint(true, false);
}
@Override
public void onUpdateSlowModeButton(View view4, boolean z2, CharSequence charSequence3) {
ChatActivity.this.showSlowModeHint(view4, z2, charSequence3);
}
@Override
public void onTextSelectionChanged(int i4, int i5) {
if (ChatActivity.this.editTextItem == null) {
return;
}
if (i5 - i4 > 0) {
if (ChatActivity.this.editTextItem.getTag() == null) {
ChatActivity.this.editTextItem.setTag(1);
ChatActivity.this.editTextItem.setVisibility(0);
ChatActivity.this.headerItem.setVisibility(8);
ChatActivity.this.attachItem.setVisibility(8);
}
ChatActivity.this.editTextStart = i4;
ChatActivity.this.editTextEnd = i5;
} else if (ChatActivity.this.editTextItem.getTag() != null) {
ChatActivity.this.editTextItem.setTag(null);
ChatActivity.this.editTextItem.setVisibility(8);
if (ChatActivity.this.chatActivityEnterView.hasText()) {
ChatActivity.this.headerItem.setVisibility(8);
ChatActivity.this.attachItem.setVisibility(0);
return;
}
ChatActivity.this.headerItem.setVisibility(0);
ChatActivity.this.attachItem.setVisibility(8);
}
}
@Override
public void onTextChanged(final CharSequence charSequence3, boolean z2) {
MediaController.getInstance().setInputFieldHasText(!TextUtils.isEmpty(charSequence3) || ChatActivity.this.chatActivityEnterView.isEditingMessage());
if (ChatActivity.this.stickersAdapter != null && ChatActivity.this.chatActivityEnterView != null && ChatActivity.this.chatActivityEnterView.getVisibility() == 0 && (ChatActivity.this.bottomOverlay == null || ChatActivity.this.bottomOverlay.getVisibility() != 0)) {
ChatActivity.this.stickersAdapter.loadStikersForEmoji(charSequence3, !(ChatActivity.this.currentChat == null || ChatObject.canSendStickers(ChatActivity.this.currentChat)) || ChatActivity.this.chatActivityEnterView.isEditingMessage());
}
if (ChatActivity.this.mentionsAdapter != null) {
ChatActivity.this.mentionsAdapter.searchUsernameOrHashtag(charSequence3.toString(), ChatActivity.this.chatActivityEnterView.getCursorPosition(), ChatActivity.this.messages, false);
}
if (ChatActivity.this.waitingForCharaterEnterRunnable != null) {
AndroidUtilities.cancelRunOnUIThread(ChatActivity.this.waitingForCharaterEnterRunnable);
ChatActivity.this.waitingForCharaterEnterRunnable = null;
}
if ((ChatActivity.this.currentChat == null || ChatObject.canSendEmbed(ChatActivity.this.currentChat)) && ChatActivity.this.chatActivityEnterView.isMessageWebPageSearchEnabled()) {
if (ChatActivity.this.chatActivityEnterView.isEditingMessage() && ChatActivity.this.chatActivityEnterView.isEditingCaption()) {
return;
}
if (z2) {
ChatActivity.this.searchLinks(charSequence3, true);
return;
}
ChatActivity.this.waitingForCharaterEnterRunnable = new Runnable() {
@Override
public void run() {
if (this == ChatActivity.this.waitingForCharaterEnterRunnable) {
ChatActivity.this.searchLinks(charSequence3, false);
ChatActivity.this.waitingForCharaterEnterRunnable = null;
}
}
};
AndroidUtilities.runOnUIThread(ChatActivity.this.waitingForCharaterEnterRunnable, AndroidUtilities.WEB_URL == null ? 3000L : 1000L);
}
}
@Override
public void onTextSpansChanged(CharSequence charSequence3) {
ChatActivity.this.searchLinks(charSequence3, true);
}
@Override
public void needSendTyping() {
ChatActivity.this.getMessagesController().sendTyping(ChatActivity.this.dialog_id, 0, ChatActivity.this.classGuid);
}
@Override
public void onAttachButtonHidden() {
if (ChatActivity.this.actionBar.isSearchFieldVisible()) {
return;
}
if (ChatActivity.this.headerItem != null) {
ChatActivity.this.headerItem.setVisibility(8);
}
if (ChatActivity.this.editTextItem != null) {
ChatActivity.this.editTextItem.setVisibility(8);
}
if (ChatActivity.this.attachItem != null) {
ChatActivity.this.attachItem.setVisibility(0);
}
}
@Override
public void onAttachButtonShow() {
if (ChatActivity.this.actionBar.isSearchFieldVisible()) {
return;
}
if (ChatActivity.this.headerItem != null) {
ChatActivity.this.headerItem.setVisibility(0);
}
if (ChatActivity.this.editTextItem != null) {
ChatActivity.this.editTextItem.setVisibility(8);
}
if (ChatActivity.this.attachItem != null) {
ChatActivity.this.attachItem.setVisibility(8);
}
}
@Override
public void onMessageEditEnd(boolean z2) {
if (z2) {
return;
}
ChatActivity.this.mentionsAdapter.setNeedBotContext(ChatActivity.this.currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(ChatActivity.this.currentEncryptedChat.layer) >= 46);
if (ChatActivity.this.editingMessageObject != null) {
ChatActivity.this.hideFieldPanel(false);
}
ChatActivity.this.chatActivityEnterView.setAllowStickersAndGifs(ChatActivity.this.currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(ChatActivity.this.currentEncryptedChat.layer) >= 23, ChatActivity.this.currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(ChatActivity.this.currentEncryptedChat.layer) >= 46);
if (ChatActivity.this.editingMessageObjectReqId != 0) {
ChatActivity.this.getConnectionsManager().cancelRequest(ChatActivity.this.editingMessageObjectReqId, true);
ChatActivity.this.editingMessageObjectReqId = 0;
}
ChatActivity.this.updatePinnedMessageView(true);
ChatActivity.this.updateBottomOverlay();
ChatActivity.this.updateVisibleRows();
}
@Override
public void onWindowSizeChanged(int i4) {
if (i4 < AndroidUtilities.dp(72.0f) + ActionBar.getCurrentActionBarHeight()) {
ChatActivity.this.allowStickersPanel = false;
if (ChatActivity.this.stickersPanel.getVisibility() == 0) {
ChatActivity.this.stickersPanel.setVisibility(4);
}
if (ChatActivity.this.mentionContainer != null && ChatActivity.this.mentionContainer.getVisibility() == 0) {
ChatActivity.this.mentionContainer.setVisibility(4);
ChatActivity.this.updateMessageListAccessibilityVisibility();
}
} else {
ChatActivity.this.allowStickersPanel = true;
if (ChatActivity.this.stickersPanel.getVisibility() == 4) {
ChatActivity.this.stickersPanel.setVisibility(0);
}
if (ChatActivity.this.mentionContainer != null && ChatActivity.this.mentionContainer.getVisibility() == 4 && (!ChatActivity.this.mentionsAdapter.isBotContext() || ChatActivity.this.allowContextBotPanel || ChatActivity.this.allowContextBotPanelSecond)) {
ChatActivity.this.mentionContainer.setVisibility(0);
ChatActivity.this.mentionContainer.setTag(null);
ChatActivity.this.updateMessageListAccessibilityVisibility();
}
}
ChatActivity chatActivity = ChatActivity.this;
chatActivity.allowContextBotPanel = !chatActivity.chatActivityEnterView.isPopupShowing();
ChatActivity.this.checkContextBotPanel();
}
@Override
public void onStickersTab(boolean z2) {
if (ChatActivity.this.emojiButtonRed != null) {
ChatActivity.this.emojiButtonRed.setVisibility(8);
}
ChatActivity.this.allowContextBotPanelSecond = !z2;
ChatActivity.this.checkContextBotPanel();
}
@Override
public void didPressedAttachButton(int i4, ChatEnterMenuType chatEnterMenuType) {
if (i4 == 100) {
return;
}
int i5 = 1012;
if (ChatActivity.this.currentUser != null) {
if (chatEnterMenuType != ChatEnterMenuType.ALBUM) {
if (chatEnterMenuType == ChatEnterMenuType.CAMERA) {
if (SharedConfig.inappCamera) {
ChatActivity.this.openCameraView();
return;
}
} else {
if (chatEnterMenuType != ChatEnterMenuType.DOCUMENT) {
if (chatEnterMenuType != ChatEnterMenuType.LOCATION) {
if (chatEnterMenuType != ChatEnterMenuType.CONTACTS) {
if (chatEnterMenuType != ChatEnterMenuType.MUSIC) {
if (chatEnterMenuType == ChatEnterMenuType.TRANSFER) {
ChatActivity.this.getAccountInfo(false);
return;
} else if (chatEnterMenuType == ChatEnterMenuType.REDPACKET) {
ChatActivity.this.getAccountInfo(true);
return;
} else if (chatEnterMenuType == ChatEnterMenuType.FAVORITE) {
ToastUtils.show((CharSequence) "devoping....");
return;
} else if (i4 != 7) {
if (chatEnterMenuType != ChatEnterMenuType.VOICECALL) {
if (chatEnterMenuType != ChatEnterMenuType.VIDEOCALL) {
}
i5 = 1011;
}
i5 = 1010;
}
}
i5 = 3;
}
i5 = 5;
}
i5 = 6;
}
i5 = 4;
}
i5 = 0;
}
i5 = 1;
} else {
if (chatEnterMenuType != ChatEnterMenuType.ALBUM) {
if (chatEnterMenuType != ChatEnterMenuType.CAMERA) {
if (chatEnterMenuType != ChatEnterMenuType.DOCUMENT) {
if (chatEnterMenuType != ChatEnterMenuType.LOCATION) {
if (chatEnterMenuType != ChatEnterMenuType.CONTACTS) {
if (chatEnterMenuType == ChatEnterMenuType.POLL) {
i5 = 9;
} else {
if (chatEnterMenuType != ChatEnterMenuType.MUSIC) {
if (chatEnterMenuType == ChatEnterMenuType.REDPACKET) {
ChatActivity.this.getAccountInfo(true);
return;
} else if (chatEnterMenuType == ChatEnterMenuType.FAVORITE) {
ToastUtils.show((CharSequence) "devoping....");
return;
} else {
if (chatEnterMenuType != ChatEnterMenuType.VOICECALL) {
if (chatEnterMenuType != ChatEnterMenuType.VIDEOCALL) {
}
i5 = 1011;
}
i5 = 1010;
}
}
i5 = 3;
}
}
i5 = 5;
}
i5 = 6;
}
i5 = 4;
}
i5 = 0;
}
i5 = 1;
}
ChatActivity.this.processSelectedAttach(i5);
}
@Override
public void needStartRecordVideo(int i4, boolean z2, int i5) {
if (ChatActivity.this.instantCameraView != null) {
if (i4 == 0) {
ChatActivity.this.instantCameraView.showCamera();
} else if (i4 == 1 || i4 == 3 || i4 == 4) {
ChatActivity.this.instantCameraView.send(i4, z2, i5);
} else if (i4 == 2) {
ChatActivity.this.instantCameraView.cancel();
}
}
}
@Override
public void needChangeVideoPreviewState(int i4, float f) {
if (ChatActivity.this.instantCameraView != null) {
ChatActivity.this.instantCameraView.changeVideoPreviewState(i4, f);
}
}
@Override
public void needStartRecordAudio(int i4) {
int i5 = i4 == 0 ? 8 : 0;
if (ChatActivity.this.overlayView.getVisibility() != i5) {
ChatActivity.this.overlayView.setVisibility(i5);
}
}
@Override
public void needShowMediaBanHint() {
ChatActivity.this.showMediaBannedHint();
}
@Override
public void onStickersExpandedChange() {
ChatActivity.this.checkRaiseSensors();
}
@Override
public void scrollToSendingMessage() {
int sendingMessageId = ChatActivity.this.getSendMessagesHelper().getSendingMessageId(ChatActivity.this.dialog_id);
if (sendingMessageId != 0) {
ChatActivity.this.scrollToMessageId(sendingMessageId, 0, true, 0, false);
}
}
@Override
public boolean hasScheduledMessages() {
return ChatActivity.this.scheduledMessagesCount > 0 && !ChatActivity.this.inScheduleMode;
}
@Override
public void openScheduledMessages() {
ChatActivity.this.openScheduledMessages();
}
});
this.chatActivityEnterView.setDialogId(this.dialog_id, this.currentAccount);
chatFull = this.chatInfo;
if (chatFull != null) {
this.chatActivityEnterView.setChatInfo(chatFull);
}
this.chatActivityEnterView.setId(1000);
this.chatActivityEnterView.setBotsCount(this.botsCount, this.hasBotsCommands);
this.chatActivityEnterView.setMinimumHeight(AndroidUtilities.dp(51.0f));
ChatActivityEnterView chatActivityEnterView3 = this.chatActivityEnterView;
TLRPC.EncryptedChat encryptedChat3 = this.currentEncryptedChat;
boolean z2 = encryptedChat3 != null || AndroidUtilities.getPeerLayerVersion(encryptedChat3.layer) >= 23;
TLRPC.EncryptedChat encryptedChat4 = this.currentEncryptedChat;
chatActivityEnterView3.setAllowStickersAndGifs(z2, encryptedChat4 != null || AndroidUtilities.getPeerLayerVersion(encryptedChat4.layer) >= 46);
if (this.inPreviewMode) {
this.chatActivityEnterView.setVisibility(4);
}
SizeNotifierFrameLayout sizeNotifierFrameLayout3 = this.contentView;
sizeNotifierFrameLayout3.addView(this.chatActivityEnterView, sizeNotifierFrameLayout3.getChildCount() - 1, LayoutHelper.createFrame(-1, -2, 83));
FrameLayout frameLayout11 = new FrameLayout(context) {
@Override
public boolean hasOverlappingRendering() {
return false;
}
@Override
public void setTranslationY(float f) {
super.setTranslationY(f);
if (ChatActivity.this.chatActivityEnterView != null) {
ChatActivity.this.chatActivityEnterView.invalidate();
}
if (getVisibility() != 8) {
if (ChatActivity.this.chatListView != null) {
ChatActivity.this.chatListView.setTranslationY(f);
}
if (ChatActivity.this.progressView != null) {
ChatActivity.this.progressView.setTranslationY(f);
}
if (ChatActivity.this.mentionContainer != null) {
ChatActivity.this.mentionContainer.setTranslationY(f);
}
if (ChatActivity.this.pagedownButton != null) {
ChatActivity.this.pagedownButton.setTranslationY(f);
}
if (ChatActivity.this.mentiondownButton != null) {
FrameLayout frameLayout12 = ChatActivity.this.mentiondownButton;
if (ChatActivity.this.pagedownButton.getVisibility() == 0) {
f -= AndroidUtilities.dp(72.0f);
}
frameLayout12.setTranslationY(f);
}
ChatActivity.this.updateMessagesVisiblePart(false);
if (ChatActivity.this.fragmentView != null) {
ChatActivity.this.fragmentView.invalidate();
}
}
}
@Override
public void setVisibility(int i4) {
int i5;
super.setVisibility(i4);
if (i4 == 8) {
if (ChatActivity.this.chatListView != null) {
ChatActivity.this.chatListView.setTranslationY(0.0f);
}
if (ChatActivity.this.progressView != null) {
ChatActivity.this.progressView.setTranslationY(0.0f);
}
if (ChatActivity.this.mentionContainer != null) {
ChatActivity.this.mentionContainer.setTranslationY(0.0f);
}
if (ChatActivity.this.pagedownButton != null) {
ChatActivity.this.pagedownButton.setTranslationY(ChatActivity.this.pagedownButton.getTag() == null ? AndroidUtilities.dp(100.0f) : 0.0f);
}
if (ChatActivity.this.mentiondownButton != null) {
FrameLayout frameLayout12 = ChatActivity.this.mentiondownButton;
if (ChatActivity.this.mentiondownButton.getTag() == null) {
i5 = AndroidUtilities.dp(100.0f);
} else {
i5 = ChatActivity.this.pagedownButton.getVisibility() == 0 ? -AndroidUtilities.dp(72.0f) : 0;
}
frameLayout12.setTranslationY(i5);
}
}
}
};
View view4 = new View(context);
this.replyLineView = view4;
view4.setBackgroundColor(Theme.getColor(Theme.key_chat_replyPanelLine));
this.chatActivityEnterView.addTopView(frameLayout11, this.replyLineView, 48);
frameLayout11.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view5) {
ChatActivity.this.lambda$createView$26$ChatActivity(view5);
}
});
ImageView imageView6 = new ImageView(context);
this.replyIconImageView = imageView6;
imageView6.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_replyPanelIcons), PorterDuff.Mode.MULTIPLY));
this.replyIconImageView.setScaleType(ImageView.ScaleType.CENTER);
frameLayout11.addView(this.replyIconImageView, LayoutHelper.createFrame(52, 46, 51));
ImageView imageView7 = new ImageView(context);
this.replyCloseImageView = imageView7;
imageView7.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_replyPanelClose), PorterDuff.Mode.MULTIPLY));
this.replyCloseImageView.setImageResource(R.drawable.input_clear);
this.replyCloseImageView.setScaleType(ImageView.ScaleType.CENTER);
frameLayout11.addView(this.replyCloseImageView, LayoutHelper.createFrame(52.0f, 46.0f, 53, 0.0f, 0.5f, 0.0f, 0.0f));
this.replyCloseImageView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view5) {
ChatActivity.this.lambda$createView$27$ChatActivity(view5);
}
});
SimpleTextView simpleTextView5 = new SimpleTextView(context);
this.replyNameTextView = simpleTextView5;
simpleTextView5.setTextSize(14);
this.replyNameTextView.setTextColor(Theme.getColor(Theme.key_chat_replyPanelName));
this.replyNameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
frameLayout11.addView(this.replyNameTextView, LayoutHelper.createFrame(-1.0f, 18.0f, 51, 52.0f, 6.0f, 52.0f, 0.0f));
SimpleTextView simpleTextView6 = new SimpleTextView(context);
this.replyObjectTextView = simpleTextView6;
simpleTextView6.setTextSize(14);
this.replyObjectTextView.setTextColor(Theme.getColor(Theme.key_chat_replyPanelMessage));
frameLayout11.addView(this.replyObjectTextView, LayoutHelper.createFrame(-1.0f, 18.0f, 51, 52.0f, 24.0f, 52.0f, 0.0f));
BackupImageView backupImageView2 = new BackupImageView(context);
this.replyImageView = backupImageView2;
frameLayout11.addView(backupImageView2, LayoutHelper.createFrame(34.0f, 34.0f, 51, 52.0f, 6.0f, 0.0f, 0.0f));
FrameLayout frameLayout12 = new FrameLayout(context);
this.stickersPanel = frameLayout12;
frameLayout12.setVisibility(8);
this.contentView.addView(this.stickersPanel, LayoutHelper.createFrame(-2.0f, 81.5f, 83, 0.0f, 0.0f, 0.0f, 38.0f));
final ContentPreviewViewer.ContentPreviewViewerDelegate contentPreviewViewerDelegate = new ContentPreviewViewer.ContentPreviewViewerDelegate() {
@Override
public void gifAddedOrDeleted() {
ContentPreviewViewer.ContentPreviewViewerDelegate.CC.$default$gifAddedOrDeleted(this);
}
@Override
public boolean needOpen() {
return ContentPreviewViewer.ContentPreviewViewerDelegate.CC.$default$needOpen(this);
}
@Override
public boolean needSend() {
return false;
}
@Override
public void sendGif(Object obj, boolean z3, int i4) {
ContentPreviewViewer.ContentPreviewViewerDelegate.CC.$default$sendGif(this, obj, z3, i4);
}
@Override
public void sendSticker(TLRPC.Document document, Object obj, boolean z3, int i4) {
ChatActivity.this.chatActivityEnterView.lambda$onStickerSelected$28$ChatActivityEnterView(document, obj, true, z3, i4);
}
@Override
public boolean canSchedule() {
return ChatActivity.this.canScheduleMessage();
}
@Override
public boolean isInScheduleMode() {
return ChatActivity.this.inScheduleMode;
}
@Override
public void openSet(TLRPC.InputStickerSet inputStickerSet, boolean z3) {
if (inputStickerSet == null || ChatActivity.this.getParentActivity() == null) {
return;
}
TLRPC.TL_inputStickerSetID tL_inputStickerSetID = new TLRPC.TL_inputStickerSetID();
tL_inputStickerSetID.access_hash = inputStickerSet.access_hash;
tL_inputStickerSetID.id = inputStickerSet.id;
FragmentActivity parentActivity = ChatActivity.this.getParentActivity();
ChatActivity chatActivity = ChatActivity.this;
StickersAlert stickersAlert = new StickersAlert(parentActivity, chatActivity, tL_inputStickerSetID, null, chatActivity.chatActivityEnterView);
stickersAlert.setClearsInputField(z3);
ChatActivity.this.showDialog(stickersAlert);
}
};
RecyclerListView recyclerListView5 = new RecyclerListView(context) {
@Override
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
return super.onInterceptTouchEvent(motionEvent) || ContentPreviewViewer.getInstance().onInterceptTouchEvent(motionEvent, ChatActivity.this.stickersListView, 0, contentPreviewViewerDelegate);
}
};
this.stickersListView = recyclerListView5;
recyclerListView5.setTag(3);
this.stickersListView.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view5, MotionEvent motionEvent) {
return ChatActivity.this.lambda$createView$28$ChatActivity(contentPreviewViewerDelegate, view5, motionEvent);
}
});
this.stickersListView.setDisallowInterceptTouchEvents(true);
LinearLayoutManager linearLayoutManager2 = new LinearLayoutManager(context);
linearLayoutManager2.setOrientation(0);
this.stickersListView.setLayoutManager(linearLayoutManager2);
this.stickersListView.setClipToPadding(false);
this.stickersListView.setOverScrollMode(2);
this.stickersPanel.addView(this.stickersListView, LayoutHelper.createFrame(-1, 78.0f));
initStickers();
ImageView imageView8 = new ImageView(context);
this.stickersPanelArrow = imageView8;
imageView8.setImageResource(R.drawable.stickers_back_arrow);
this.stickersPanelArrow.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_stickersHintPanel), PorterDuff.Mode.MULTIPLY));
this.stickersPanel.addView(this.stickersPanelArrow, LayoutHelper.createFrame(-2.0f, -2.0f, 83, 53.0f, 0.0f, 53.0f, 0.0f));
FrameLayout frameLayout13 = new FrameLayout(context) {
@Override
public void onDraw(Canvas canvas) {
int intrinsicHeight = Theme.chat_composeShadowDrawable.getIntrinsicHeight();
Theme.chat_composeShadowDrawable.setBounds(0, 0, getMeasuredWidth(), intrinsicHeight);
Theme.chat_composeShadowDrawable.draw(canvas);
canvas.drawRect(0.0f, intrinsicHeight, getMeasuredWidth(), getMeasuredHeight(), Theme.chat_composeBackgroundPaint);
}
};
this.searchContainer = frameLayout13;
frameLayout13.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view5, MotionEvent motionEvent) {
return ChatActivity.lambda$createView$29(view5, motionEvent);
}
});
this.searchContainer.setWillNotDraw(false);
this.searchContainer.setVisibility(4);
this.searchContainer.setFocusable(true);
this.searchContainer.setFocusableInTouchMode(true);
this.searchContainer.setClickable(true);
this.searchContainer.setPadding(0, AndroidUtilities.dp(3.0f), 0, 0);
ImageView imageView9 = new ImageView(context);
this.searchUpButton = imageView9;
imageView9.setScaleType(ImageView.ScaleType.CENTER);
this.searchUpButton.setImageResource(R.drawable.msg_go_up);
this.searchUpButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_searchPanelIcons), PorterDuff.Mode.MULTIPLY));
this.searchUpButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), 1));
this.searchContainer.addView(this.searchUpButton, LayoutHelper.createFrame(48.0f, 48.0f, 53, 0.0f, 0.0f, 48.0f, 0.0f));
this.searchUpButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view5) {
ChatActivity.this.lambda$createView$30$ChatActivity(view5);
}
});
this.searchUpButton.setContentDescription(LocaleController.getString("AccDescrSearchNext", R.string.AccDescrSearchNext));
ImageView imageView10 = new ImageView(context);
this.searchDownButton = imageView10;
imageView10.setScaleType(ImageView.ScaleType.CENTER);
this.searchDownButton.setImageResource(R.drawable.msg_go_down);
this.searchDownButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_searchPanelIcons), PorterDuff.Mode.MULTIPLY));
this.searchDownButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), 1));
this.searchContainer.addView(this.searchDownButton, LayoutHelper.createFrame(48.0f, 48.0f, 53, 0.0f, 0.0f, 0.0f, 0.0f));
this.searchDownButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view5) {
ChatActivity.this.lambda$createView$31$ChatActivity(view5);
}
});
this.searchDownButton.setContentDescription(LocaleController.getString("AccDescrSearchPrev", R.string.AccDescrSearchPrev));
chat = this.currentChat;
if (chat != null && (!ChatObject.isChannel(chat) || this.currentChat.megagroup)) {
ImageView imageView11 = new ImageView(context);
this.searchUserButton = imageView11;
imageView11.setScaleType(ImageView.ScaleType.CENTER);
this.searchUserButton.setImageResource(R.drawable.msg_usersearch);
this.searchUserButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_searchPanelIcons), PorterDuff.Mode.MULTIPLY));
this.searchUserButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), 1));
this.searchContainer.addView(this.searchUserButton, LayoutHelper.createFrame(48.0f, 48.0f, 51, 48.0f, 0.0f, 0.0f, 0.0f));
this.searchUserButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view5) {
ChatActivity.this.lambda$createView$32$ChatActivity(view5);
}
});
this.searchUserButton.setContentDescription(LocaleController.getString("AccDescrSearchByUser", R.string.AccDescrSearchByUser));
}
ImageView imageView12 = new ImageView(context);
this.searchCalendarButton = imageView12;
imageView12.setScaleType(ImageView.ScaleType.CENTER);
this.searchCalendarButton.setImageResource(R.drawable.msg_calendar);
this.searchCalendarButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_searchPanelIcons), PorterDuff.Mode.MULTIPLY));
this.searchCalendarButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), 1));
this.searchContainer.addView(this.searchCalendarButton, LayoutHelper.createFrame(48, 48, 51));
this.searchCalendarButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view5) {
ChatActivity.this.lambda$createView$36$ChatActivity(view5);
}
});
this.searchCalendarButton.setContentDescription(LocaleController.getString("JumpToDate", R.string.JumpToDate));
SimpleTextView simpleTextView7 = new SimpleTextView(context);
this.searchCountText = simpleTextView7;
simpleTextView7.setTextColor(Theme.getColor(Theme.key_chat_searchPanelText));
this.searchCountText.setTextSize(15);
this.searchCountText.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.searchCountText.setGravity(5);
this.searchContainer.addView(this.searchCountText, LayoutHelper.createFrame(-2.0f, -2.0f, 21, 0.0f, 0.0f, 108.0f, 0.0f));
FrameLayout frameLayout14 = new FrameLayout(context) {
@Override
public void onDraw(Canvas canvas) {
int intrinsicHeight = Theme.chat_composeShadowDrawable.getIntrinsicHeight();
Theme.chat_composeShadowDrawable.setBounds(0, 0, getMeasuredWidth(), intrinsicHeight);
Theme.chat_composeShadowDrawable.draw(canvas);
canvas.drawRect(0.0f, intrinsicHeight, getMeasuredWidth(), getMeasuredHeight(), Theme.chat_composeBackgroundPaint);
}
};
this.bottomOverlay = frameLayout14;
frameLayout14.setWillNotDraw(false);
this.bottomOverlay.setVisibility(4);
this.bottomOverlay.setFocusable(true);
this.bottomOverlay.setFocusableInTouchMode(true);
this.bottomOverlay.setClickable(true);
this.bottomOverlay.setPadding(0, AndroidUtilities.dp(2.0f), 0, 0);
this.contentView.addView(this.bottomOverlay, LayoutHelper.createFrame(-1, 51, 80));
TextView textView9 = new TextView(context);
this.bottomOverlayText = textView9;
textView9.setTextSize(1, 14.0f);
this.bottomOverlayText.setGravity(17);
this.bottomOverlayText.setMaxLines(2);
this.bottomOverlayText.setEllipsize(TextUtils.TruncateAt.END);
this.bottomOverlayText.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.bottomOverlayText.setTextColor(Theme.getColor(Theme.key_chat_secretChatStatusText));
this.bottomOverlay.addView(this.bottomOverlayText, LayoutHelper.createFrame(-2.0f, -2.0f, 17, 14.0f, 0.0f, 14.0f, 0.0f));
FrameLayout frameLayout15 = new FrameLayout(context) {
@Override
protected void onMeasure(int i4, int i5) {
int size = View.MeasureSpec.getSize(i4);
if (ChatActivity.this.bottomOverlayChatText.getVisibility() == 0 && ChatActivity.this.bottomOverlayChatText2.getVisibility() == 0) {
int i6 = size / 2;
((FrameLayout.LayoutParams) ChatActivity.this.bottomOverlayChatText.getLayoutParams()).width = i6;
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) ChatActivity.this.bottomOverlayChatText2.getLayoutParams();
layoutParams.width = i6;
layoutParams.leftMargin = i6;
} else {
((FrameLayout.LayoutParams) ChatActivity.this.bottomOverlayChatText.getLayoutParams()).width = size;
}
super.onMeasure(i4, i5);
}
@Override
public void onDraw(Canvas canvas) {
int intrinsicHeight = Theme.chat_composeShadowDrawable.getIntrinsicHeight();
Theme.chat_composeShadowDrawable.setBounds(0, 0, getMeasuredWidth(), intrinsicHeight);
Theme.chat_composeShadowDrawable.draw(canvas);
canvas.drawRect(0.0f, intrinsicHeight, getMeasuredWidth(), getMeasuredHeight(), Theme.chat_composeBackgroundPaint);
}
};
this.bottomOverlayChat = frameLayout15;
frameLayout15.setWillNotDraw(false);
this.bottomOverlayChat.setPadding(0, AndroidUtilities.dp(3.0f), 0, 0);
this.bottomOverlayChat.setVisibility(4);
this.contentView.addView(this.bottomOverlayChat, LayoutHelper.createFrame(-1, 51, 80));
TextView textView10 = new TextView(context);
this.bottomOverlayChatText = textView10;
textView10.setTextSize(1, 15.0f);
this.bottomOverlayChatText.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.bottomOverlayChatText.setTextColor(Theme.getColor(Theme.key_chat_fieldOverlayText));
this.bottomOverlayChatText.setGravity(17);
this.bottomOverlayChat.addView(this.bottomOverlayChatText, LayoutHelper.createFrame(-1, -1.0f));
this.bottomOverlayChatText.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view5) {
ChatActivity.this.lambda$createView$39$ChatActivity(view5);
}
});
UnreadCounterTextView unreadCounterTextView = new UnreadCounterTextView(context);
this.bottomOverlayChatText2 = unreadCounterTextView;
unreadCounterTextView.setTextSize(1, 15.0f);
this.bottomOverlayChatText2.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.bottomOverlayChatText2.setTextColor(Theme.getColor(Theme.key_chat_fieldOverlayText));
this.bottomOverlayChatText2.setGravity(17);
this.bottomOverlayChatText2.setVisibility(8);
this.bottomOverlayChat.addView(this.bottomOverlayChatText2, LayoutHelper.createFrame(-1, -1.0f));
this.bottomOverlayChatText2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view5) {
ChatActivity.this.lambda$createView$40$ChatActivity(view5);
}
});
RadialProgressView radialProgressView2 = new RadialProgressView(context);
this.bottomOverlayProgress = radialProgressView2;
radialProgressView2.setSize(AndroidUtilities.dp(22.0f));
this.bottomOverlayProgress.setProgressColor(Theme.getColor(Theme.key_chat_fieldOverlayText));
this.bottomOverlayProgress.setVisibility(4);
this.bottomOverlayProgress.setScaleX(0.1f);
this.bottomOverlayProgress.setScaleY(0.1f);
this.bottomOverlayProgress.setAlpha(1.0f);
this.bottomOverlayChat.addView(this.bottomOverlayProgress, LayoutHelper.createFrame(30, 30, 17));
TextView textView11 = new TextView(context);
this.replyButton = textView11;
textView11.setText(LocaleController.getString("Reply", R.string.Reply));
this.replyButton.setGravity(16);
this.replyButton.setTextSize(1, 15.0f);
this.replyButton.setPadding(AndroidUtilities.dp(14.0f), 0, AndroidUtilities.dp(21.0f), 0);
this.replyButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), 3));
this.replyButton.setTextColor(Theme.getColor(Theme.key_actionBarActionModeDefaultIcon));
this.replyButton.setCompoundDrawablePadding(AndroidUtilities.dp(7.0f));
this.replyButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
Drawable mutate3 = context.getResources().getDrawable(R.drawable.input_reply).mutate();
mutate3.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarActionModeDefaultIcon), PorterDuff.Mode.MULTIPLY));
this.replyButton.setCompoundDrawablesWithIntrinsicBounds(mutate3, (Drawable) null, (Drawable) null, (Drawable) null);
this.replyButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view5) {
ChatActivity.this.lambda$createView$41$ChatActivity(view5);
}
});
this.bottomMessagesActionContainer.addView(this.replyButton, LayoutHelper.createFrame(-2, -1, 51));
TextView textView12 = new TextView(context);
this.forwardButton = textView12;
textView12.setText(LocaleController.getString("Forward", R.string.Forward));
this.forwardButton.setGravity(16);
this.forwardButton.setTextSize(1, 15.0f);
this.forwardButton.setPadding(AndroidUtilities.dp(21.0f), 0, AndroidUtilities.dp(21.0f), 0);
this.forwardButton.setCompoundDrawablePadding(AndroidUtilities.dp(6.0f));
this.forwardButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), 3));
this.forwardButton.setTextColor(Theme.getColor(Theme.key_actionBarActionModeDefaultIcon));
this.forwardButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
Drawable mutate4 = context.getResources().getDrawable(R.drawable.input_forward).mutate();
mutate4.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarActionModeDefaultIcon), PorterDuff.Mode.MULTIPLY));
this.forwardButton.setCompoundDrawablesWithIntrinsicBounds(mutate4, (Drawable) null, (Drawable) null, (Drawable) null);
this.forwardButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view5) {
ChatActivity.this.lambda$createView$42$ChatActivity(view5);
}
});
this.bottomMessagesActionContainer.addView(this.forwardButton, LayoutHelper.createFrame(-2, -1, 53));
this.contentView.addView(this.searchContainer, LayoutHelper.createFrame(-1, 51, 80));
UndoView undoView = new UndoView(context);
this.undoView = undoView;
this.contentView.addView(undoView, LayoutHelper.createFrame(-1.0f, -2.0f, 83, 8.0f, 0.0f, 8.0f, 8.0f));
if (this.currentChat != null) {
HintView hintView = new HintView(getParentActivity(), 2);
this.slowModeHint = hintView;
hintView.setAlpha(0.0f);
this.slowModeHint.setVisibility(4);
this.contentView.addView(this.slowModeHint, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 19.0f, 0.0f, 19.0f, 0.0f));
}
this.chatAdapter.updateRows();
if (this.loading || !this.messages.isEmpty()) {
z = false;
listViewShowEmptyView(false, false);
} else {
listViewShowEmptyView(true, this.chatAdapter.botInfoRow == -1);
z = false;
}
checkBotKeyboard();
updateBottomOverlay();
updateSecretStatus();
updateTopPanel(z);
updatePinnedMessageView(true);
if (this.currentEncryptedChat != null && Build.VERSION.SDK_INT >= 23 && (SharedConfig.passcodeHash.length() == 0 || SharedConfig.allowScreenCapture)) {
MediaController.getInstance().setFlagSecure(this, true);
}
if (charSequence2 != null) {
this.chatActivityEnterView.setFieldText(charSequence2);
}
fixLayoutInternal();
if (isSysNotifyMessage().booleanValue()) {
int i4 = this.createUnreadMessageAfterId;
if (i4 != 0) {
scrollToMessageId(i4, 0, false, this.returnToLoadIndex, false);
} else {
int i5 = this.returnToMessageId;
if (i5 > 0) {
scrollToMessageId(i5, 0, true, this.returnToLoadIndex, false);
} else {
scrollToLastMessage(true);
}
}
}
return this.fragmentView;
}
}
charSequence = null;
mentionsAdapter = this.mentionsAdapter;
if (mentionsAdapter != null) {
}
this.chatListView = new RecyclerListView(context) {
private float endedTrackingX;
private long lastReplyButtonAnimationTime;
private long lastTrackingAnimationTime;
private int lastWidth;
private boolean maybeStartTracking;
private float replyButtonProgress;
private boolean slideAnimationInProgress;
private ChatMessageCell slidingView;
private boolean startedTracking;
private int startedTrackingPointerId;
private int startedTrackingX;
private int startedTrackingY;
private float trackAnimationProgress;
private boolean wasTrackingVibrate;
ArrayList<ChatMessageCell> drawTimeAfter = new ArrayList<>();
ArrayList<ChatMessageCell> drawNamesAfter = new ArrayList<>();
ArrayList<ChatMessageCell> drawCaptionAfter = new ArrayList<>();
@Override
public void onLayout(boolean z22, int i42, int i52, int i6, int i7) {
super.onLayout(z22, i42, i52, i6, i7);
int i8 = i6 - i42;
if (this.lastWidth != i8) {
this.lastWidth = i8;
if (ChatActivity.this.noSoundHintView != null) {
ChatActivity.this.noSoundHintView.hide();
}
if (ChatActivity.this.forwardHintView != null) {
ChatActivity.this.forwardHintView.hide();
}
if (ChatActivity.this.slowModeHint != null) {
ChatActivity.this.slowModeHint.hide();
}
}
ChatActivity.this.forceScrollToTop = false;
if (ChatActivity.this.chatAdapter.isBot) {
int childCount = getChildCount();
for (int i9 = 0; i9 < childCount; i9++) {
View childAt = getChildAt(i9);
if (childAt instanceof BotHelpCell) {
int measuredHeight = ((i7 - i52) / 2) - (childAt.getMeasuredHeight() / 2);
if (childAt.getTop() > measuredHeight) {
childAt.layout(0, measuredHeight, i8, childAt.getMeasuredHeight() + measuredHeight);
return;
}
return;
}
}
}
}
private void setGroupTranslationX(ChatMessageCell chatMessageCell, float f) {
MessageObject.GroupedMessages currentMessagesGroup = chatMessageCell.getCurrentMessagesGroup();
if (currentMessagesGroup == null) {
return;
}
int childCount = getChildCount();
for (int i42 = 0; i42 < childCount; i42++) {
View childAt = getChildAt(i42);
if (childAt != this && (childAt instanceof ChatMessageCell)) {
ChatMessageCell chatMessageCell2 = (ChatMessageCell) childAt;
if (chatMessageCell2.getCurrentMessagesGroup() == currentMessagesGroup) {
chatMessageCell2.setTranslationX(f);
chatMessageCell2.invalidate();
}
}
}
invalidate();
}
@Override
public boolean requestChildRectangleOnScreen(View view5, Rect rect, boolean z22) {
if (ChatActivity.this.scrimPopupWindow != null) {
return false;
}
return super.requestChildRectangleOnScreen(view5, rect, z22);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
boolean onInterceptTouchEvent = super.onInterceptTouchEvent(motionEvent);
if (ChatActivity.this.actionBar.isActionModeShowed()) {
return onInterceptTouchEvent;
}
processTouchEvent(motionEvent);
return onInterceptTouchEvent;
}
private void drawReplyButton(Canvas canvas) {
float f;
float min;
ChatMessageCell chatMessageCell = this.slidingView;
if (chatMessageCell == null) {
return;
}
float translationX = chatMessageCell.getTranslationX();
long currentTimeMillis = System.currentTimeMillis();
long min2 = Math.min(17L, currentTimeMillis - this.lastReplyButtonAnimationTime);
this.lastReplyButtonAnimationTime = currentTimeMillis;
boolean z22 = translationX <= ((float) (-AndroidUtilities.dp(50.0f)));
if (z22) {
float f2 = this.replyButtonProgress;
if (f2 < 1.0f) {
float f3 = f2 + (((float) min2) / 180.0f);
this.replyButtonProgress = f3;
if (f3 > 1.0f) {
this.replyButtonProgress = 1.0f;
} else {
invalidate();
}
}
} else {
float f4 = this.replyButtonProgress;
if (f4 > 0.0f) {
float f5 = f4 - (((float) min2) / 180.0f);
this.replyButtonProgress = f5;
if (f5 < 0.0f) {
this.replyButtonProgress = 0.0f;
} else {
invalidate();
}
}
}
if (z22) {
float f6 = this.replyButtonProgress;
f = f6 <= 0.8f ? (f6 / 0.8f) * 1.2f : 1.2f - (((f6 - 0.8f) / 0.2f) * 0.2f);
min = Math.min(255.0f, (this.replyButtonProgress / 0.8f) * 255.0f);
} else {
f = this.replyButtonProgress;
min = Math.min(255.0f, f * 255.0f);
}
int i42 = (int) min;
Theme.chat_shareDrawable.setAlpha(i42);
Theme.chat_replyIconDrawable.setAlpha(i42);
float measuredWidth = getMeasuredWidth() + (this.slidingView.getTranslationX() / 2.0f);
float top = this.slidingView.getTop() + (this.slidingView.getMeasuredHeight() / 2);
if (!Theme.isCustomTheme() || Theme.hasThemeKey(Theme.key_chat_shareBackground)) {
Theme.chat_shareDrawable.setColorFilter(Theme.getShareColorFilter(Theme.getColor(Theme.key_chat_shareBackground), false));
} else {
Theme.chat_shareDrawable.setColorFilter(Theme.colorFilter2);
}
Theme.chat_shareDrawable.setBounds((int) (measuredWidth - (AndroidUtilities.dp(14.0f) * f)), (int) (top - (AndroidUtilities.dp(14.0f) * f)), (int) ((AndroidUtilities.dp(14.0f) * f) + measuredWidth), (int) ((AndroidUtilities.dp(14.0f) * f) + top));
Theme.chat_shareDrawable.draw(canvas);
Theme.chat_replyIconDrawable.setBounds((int) (measuredWidth - (AndroidUtilities.dp(7.0f) * f)), (int) (top - (AndroidUtilities.dp(6.0f) * f)), (int) (measuredWidth + (AndroidUtilities.dp(7.0f) * f)), (int) (top + (AndroidUtilities.dp(5.0f) * f)));
Theme.chat_replyIconDrawable.draw(canvas);
Theme.chat_shareDrawable.setAlpha(255);
Theme.chat_replyIconDrawable.setAlpha(255);
}
private void processTouchEvent(MotionEvent motionEvent) {
ChatActivity.this.wasManualScroll = true;
if (motionEvent.getAction() == 0 && !this.startedTracking && !this.maybeStartTracking) {
View pressedChildView = getPressedChildView();
if (pressedChildView instanceof ChatMessageCell) {
ChatMessageCell chatMessageCell = (ChatMessageCell) pressedChildView;
this.slidingView = chatMessageCell;
MessageObject messageObject = chatMessageCell.getMessageObject();
if (ChatActivity.this.inScheduleMode || ((ChatActivity.this.currentEncryptedChat != null && AndroidUtilities.getPeerLayerVersion(ChatActivity.this.currentEncryptedChat.layer) < 46) || ((ChatActivity.this.getMessageType(messageObject) == 1 && (messageObject.getDialogId() == ChatActivity.this.mergeDialogId || messageObject.needDrawBluredPreview())) || ((ChatActivity.this.currentEncryptedChat == null && messageObject.getId() < 0) || messageObject.type == 101 || messageObject.type == 102 || messageObject.type == 105 || ((ChatActivity.this.bottomOverlayChat != null && ChatActivity.this.bottomOverlayChat.getVisibility() == 0) || (ChatActivity.this.currentChat != null && (ChatObject.isNotInChat(ChatActivity.this.currentChat) || ((ChatObject.isChannel(ChatActivity.this.currentChat) && !ChatObject.canPost(ChatActivity.this.currentChat) && !ChatActivity.this.currentChat.megagroup) || !ChatObject.canSendMessages(ChatActivity.this.currentChat))))))))) {
this.slidingView = null;
return;
}
this.startedTrackingPointerId = motionEvent.getPointerId(0);
this.maybeStartTracking = true;
this.startedTrackingX = (int) motionEvent.getX();
this.startedTrackingY = (int) motionEvent.getY();
}
} else if (this.slidingView != null && motionEvent.getAction() == 2 && motionEvent.getPointerId(0) == this.startedTrackingPointerId) {
int max = Math.max(AndroidUtilities.dp(-80.0f), Math.min(0, (int) (motionEvent.getX() - this.startedTrackingX)));
int abs = Math.abs(((int) motionEvent.getY()) - this.startedTrackingY);
if (getScrollState() == 0 && this.maybeStartTracking && !this.startedTracking && max <= (-AndroidUtilities.getPixelsInCM(0.4f, true)) && Math.abs(max) / 3 > abs) {
MotionEvent obtain = MotionEvent.obtain(0L, 0L, 3, 0.0f, 0.0f, 0);
this.slidingView.onTouchEvent(obtain);
super.onInterceptTouchEvent(obtain);
obtain.recycle();
ChatActivity.this.chatLayoutManager.setCanScrollVertically(false);
this.maybeStartTracking = false;
this.startedTracking = true;
this.startedTrackingX = (int) motionEvent.getX();
if (getParent() != null) {
getParent().requestDisallowInterceptTouchEvent(true);
}
} else if (this.startedTracking) {
if (Math.abs(max) >= AndroidUtilities.dp(50.0f)) {
if (!this.wasTrackingVibrate) {
try {
performHapticFeedback(3, 2);
} catch (Exception unused2) {
}
this.wasTrackingVibrate = true;
}
} else {
this.wasTrackingVibrate = false;
}
float f = max;
this.slidingView.setTranslationX(f);
MessageObject messageObject2 = this.slidingView.getMessageObject();
if (messageObject2.isRoundVideo() || messageObject2.isVideo()) {
ChatActivity.this.updateTextureViewPosition(false);
}
setGroupTranslationX(this.slidingView, f);
invalidate();
}
} else if (this.slidingView == null || motionEvent.getPointerId(0) != this.startedTrackingPointerId) {
} else {
if (motionEvent.getAction() == 3 || motionEvent.getAction() == 1 || motionEvent.getAction() == 6) {
if (Math.abs(this.slidingView.getTranslationX()) >= AndroidUtilities.dp(50.0f)) {
ChatActivity.this.showFieldPanelForReply(this.slidingView.getMessageObject());
}
this.endedTrackingX = this.slidingView.getTranslationX();
this.lastTrackingAnimationTime = System.currentTimeMillis();
this.trackAnimationProgress = 0.0f;
invalidate();
this.maybeStartTracking = false;
this.startedTracking = false;
ChatActivity.this.chatLayoutManager.setCanScrollVertically(true);
}
}
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
boolean onTouchEvent = super.onTouchEvent(motionEvent);
if (ChatActivity.this.actionBar.isActionModeShowed()) {
return onTouchEvent;
}
processTouchEvent(motionEvent);
return this.startedTracking || onTouchEvent;
}
@Override
public void requestDisallowInterceptTouchEvent(boolean z22) {
super.requestDisallowInterceptTouchEvent(z22);
ChatMessageCell chatMessageCell = this.slidingView;
if (chatMessageCell != null) {
this.endedTrackingX = chatMessageCell.getTranslationX();
this.lastTrackingAnimationTime = System.currentTimeMillis();
this.trackAnimationProgress = 0.0f;
invalidate();
this.maybeStartTracking = false;
this.startedTracking = false;
ChatActivity.this.chatLayoutManager.setCanScrollVertically(true);
}
}
@Override
public void onChildPressed(View view5, boolean z22) {
MessageObject.GroupedMessages currentMessagesGroup;
super.onChildPressed(view5, z22);
if (!(view5 instanceof ChatMessageCell) || (currentMessagesGroup = ((ChatMessageCell) view5).getCurrentMessagesGroup()) == null) {
return;
}
int childCount = getChildCount();
for (int i42 = 0; i42 < childCount; i42++) {
View childAt = getChildAt(i42);
if (childAt != view5 && (childAt instanceof ChatMessageCell)) {
ChatMessageCell chatMessageCell = (ChatMessageCell) childAt;
if (chatMessageCell.getCurrentMessagesGroup() == currentMessagesGroup) {
chatMessageCell.setPressed(z22);
}
}
}
}
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
ChatMessageCell chatMessageCell = this.slidingView;
if (chatMessageCell != null) {
float translationX = chatMessageCell.getTranslationX();
if (!this.maybeStartTracking && !this.startedTracking && this.endedTrackingX != 0.0f && translationX != 0.0f) {
long currentTimeMillis = System.currentTimeMillis();
float f = this.trackAnimationProgress + (((float) (currentTimeMillis - this.lastTrackingAnimationTime)) / 180.0f);
this.trackAnimationProgress = f;
if (f > 1.0f) {
this.trackAnimationProgress = 1.0f;
}
this.lastTrackingAnimationTime = currentTimeMillis;
float interpolation = this.endedTrackingX * (1.0f - AndroidUtilities.decelerateInterpolator.getInterpolation(this.trackAnimationProgress));
if (interpolation == 0.0f) {
this.endedTrackingX = 0.0f;
}
setGroupTranslationX(this.slidingView, interpolation);
this.slidingView.setTranslationX(interpolation);
MessageObject messageObject = this.slidingView.getMessageObject();
if (messageObject.isRoundVideo() || messageObject.isVideo()) {
ChatActivity.this.updateTextureViewPosition(false);
}
invalidate();
}
drawReplyButton(canvas);
}
}
@Override
public void dispatchDraw(Canvas canvas) {
ChatActivity.this.drawLaterRoundProgressCell = null;
int childCount = getChildCount();
for (int i42 = 0; i42 < childCount; i42++) {
View childAt = getChildAt(i42);
if (childAt instanceof ChatMessageCell) {
ChatMessageCell chatMessageCell = (ChatMessageCell) childAt;
MessageObject.GroupedMessagePosition currentPosition = chatMessageCell.getCurrentPosition();
if (chatMessageCell.isDrawingSelectionBackground() && (currentPosition == null || (currentPosition.flags & 2) != 0)) {
int alpha = Color.alpha(Theme.getColor(Theme.key_chat_selectedBackground));
Theme.chat_replyLinePaint.setColor(Theme.getColor(Theme.key_chat_selectedBackground));
Theme.chat_replyLinePaint.setAlpha((int) (alpha * chatMessageCell.getHightlightAlpha()));
canvas.drawRect(0.0f, chatMessageCell.getTop(), getMeasuredWidth(), chatMessageCell.getBottom(), Theme.chat_replyLinePaint);
}
}
}
super.dispatchDraw(canvas);
}
@Override
public boolean drawChild(Canvas canvas, View view5, long j) {
ChatMessageCell chatMessageCell;
int i42;
int i52;
RecyclerView.ViewHolder childViewHolder;
int i6;
ChatMessageCell chatMessageCell2;
int i7 = 0;
int i8 = 1;
boolean z22 = view5 == ChatActivity.this.scrimView;
boolean z3 = view5 instanceof ChatMessageCell;
if (z3) {
chatMessageCell = (ChatMessageCell) view5;
MessageObject.GroupedMessagePosition currentPosition = chatMessageCell.getCurrentPosition();
MessageObject.GroupedMessages currentMessagesGroup = chatMessageCell.getCurrentMessagesGroup();
if (currentPosition != null) {
if (currentPosition.pw != currentPosition.spanSize && currentPosition.spanSize == 1000 && currentPosition.siblingHeights == null && currentMessagesGroup.hasSibling) {
i42 = chatMessageCell.getBackgroundDrawableLeft();
i52 = 0;
if (chatMessageCell.needDelayRoundProgressDraw()) {
}
if (!z22) {
chatMessageCell2 = (ChatMessageCell) ChatActivity.this.scrimView;
if (chatMessageCell2.getCurrentMessagesGroup() != null) {
z22 = true;
}
}
} else if (currentPosition.siblingHeights != null) {
i52 = view5.getBottom() - AndroidUtilities.dp((chatMessageCell.isPinnedBottom() ? 1 : 0) + 1);
i42 = 0;
if (chatMessageCell.needDelayRoundProgressDraw()) {
ChatActivity.this.drawLaterRoundProgressCell = chatMessageCell;
}
if (!z22 && (ChatActivity.this.scrimView instanceof ChatMessageCell)) {
chatMessageCell2 = (ChatMessageCell) ChatActivity.this.scrimView;
if (chatMessageCell2.getCurrentMessagesGroup() != null && chatMessageCell2.getCurrentMessagesGroup() == currentMessagesGroup) {
z22 = true;
}
}
}
}
i42 = 0;
i52 = 0;
if (chatMessageCell.needDelayRoundProgressDraw()) {
}
if (!z22) {
}
} else {
chatMessageCell = null;
i42 = 0;
i52 = 0;
}
if (i42 != 0) {
canvas.save();
} else if (i52 != 0) {
canvas.save();
}
boolean drawChild = !z22 ? super.drawChild(canvas, view5, j) : false;
if (i42 != 0 || i52 != 0) {
canvas.restore();
}
if (chatMessageCell != null) {
chatMessageCell.drawCheckBox(canvas);
}
int childCount = getChildCount();
int i9 = 0;
while (true) {
if (i9 >= childCount) {
i9 = 0;
break;
} else if (getChildAt(i9) == view5) {
break;
} else {
i9++;
}
}
int i10 = childCount - 1;
if (i9 == i10) {
int size = this.drawTimeAfter.size();
if (size > 0) {
for (int i11 = 0; i11 < size; i11++) {
ChatMessageCell chatMessageCell3 = this.drawTimeAfter.get(i11);
canvas.save();
canvas.translate(chatMessageCell3.getLeft() + chatMessageCell3.getTranslationX(), chatMessageCell3.getTop());
chatMessageCell3.drawTime(canvas);
canvas.restore();
}
this.drawTimeAfter.clear();
}
int size2 = this.drawNamesAfter.size();
if (size2 > 0) {
for (int i12 = 0; i12 < size2; i12++) {
ChatMessageCell chatMessageCell4 = this.drawNamesAfter.get(i12);
canvas.save();
canvas.translate(chatMessageCell4.getLeft() + chatMessageCell4.getTranslationX(), chatMessageCell4.getTop());
chatMessageCell4.drawNamesLayout(canvas);
canvas.restore();
}
this.drawNamesAfter.clear();
}
int size3 = this.drawCaptionAfter.size();
if (size3 > 0) {
for (int i13 = 0; i13 < size3; i13++) {
ChatMessageCell chatMessageCell5 = this.drawCaptionAfter.get(i13);
if (chatMessageCell5.getCurrentPosition() != null) {
canvas.save();
canvas.translate(chatMessageCell5.getLeft() + chatMessageCell5.getTranslationX(), chatMessageCell5.getTop());
chatMessageCell5.drawCaptionLayout(canvas, (chatMessageCell5.getCurrentPosition().flags & 1) == 0);
canvas.restore();
}
}
this.drawCaptionAfter.clear();
}
}
if (z3) {
ChatMessageCell chatMessageCell6 = (ChatMessageCell) view5;
MessageObject.GroupedMessagePosition currentPosition2 = chatMessageCell6.getCurrentPosition();
if (currentPosition2 != null) {
if (currentPosition2.last || (currentPosition2.minX == 0 && currentPosition2.minY == 0)) {
if (i9 == i10) {
canvas.save();
canvas.translate(chatMessageCell6.getLeft() + chatMessageCell6.getTranslationX(), chatMessageCell6.getTop());
if (currentPosition2.last) {
chatMessageCell6.drawTime(canvas);
}
if (currentPosition2.minX == 0 && currentPosition2.minY == 0) {
chatMessageCell6.drawNamesLayout(canvas);
}
canvas.restore();
} else {
if (currentPosition2.last) {
this.drawTimeAfter.add(chatMessageCell6);
}
if (currentPosition2.minX == 0 && currentPosition2.minY == 0 && chatMessageCell6.hasNameLayout()) {
this.drawNamesAfter.add(chatMessageCell6);
}
}
}
if (i9 == i10) {
canvas.save();
canvas.translate(chatMessageCell6.getLeft() + chatMessageCell6.getTranslationX(), chatMessageCell6.getTop());
if (chatMessageCell6.hasCaptionLayout() && (currentPosition2.flags & 8) != 0) {
chatMessageCell6.drawCaptionLayout(canvas, (currentPosition2.flags & 1) == 0);
}
canvas.restore();
} else if (chatMessageCell6.hasCaptionLayout() && (currentPosition2.flags & 8) != 0) {
this.drawCaptionAfter.add(chatMessageCell6);
}
}
MessageObject messageObject = chatMessageCell6.getMessageObject();
if (ChatActivity.this.videoPlayerContainer != null && ((messageObject.isRoundVideo() || messageObject.isVideo()) && MediaController.getInstance().isPlayingMessage(messageObject))) {
ImageReceiver photoImage = chatMessageCell6.getPhotoImage();
float imageX = photoImage.getImageX() + chatMessageCell6.getX();
float paddingTop = (((ChatActivity.this.fragmentView.getPaddingTop() + chatMessageCell6.getTop()) + photoImage.getImageY()) - ChatActivity.this.chatListViewClipTop) + ChatActivity.this.chatListView.getTranslationY() + (ChatActivity.this.inPreviewMode ? AndroidUtilities.statusBarHeight : 0);
if (ChatActivity.this.videoPlayerContainer.getTranslationX() != imageX || ChatActivity.this.videoPlayerContainer.getTranslationY() != paddingTop) {
ChatActivity.this.videoPlayerContainer.setTranslationX(imageX);
ChatActivity.this.videoPlayerContainer.setTranslationY(paddingTop);
ChatActivity.this.fragmentView.invalidate();
ChatActivity.this.videoPlayerContainer.invalidate();
}
}
ImageReceiver avatarImage = chatMessageCell6.getAvatarImage();
if (avatarImage != null) {
MessageObject.GroupedMessages validGroupedMessage = ChatActivity.this.getValidGroupedMessage(messageObject);
int top = view5.getTop();
float translationX = chatMessageCell6.getTranslationX();
int top2 = view5.getTop() + chatMessageCell6.getLayoutHeight();
int measuredHeight = ChatActivity.this.chatListView.getMeasuredHeight() - ChatActivity.this.chatListView.getPaddingBottom();
if (top2 > measuredHeight) {
top2 = measuredHeight;
}
if (chatMessageCell6.isPinnedTop() && (childViewHolder = ChatActivity.this.chatListView.getChildViewHolder(view5)) != null) {
while (i7 < 20) {
i7++;
int adapterPosition = childViewHolder.getAdapterPosition();
if (validGroupedMessage == null || currentPosition2 == null) {
i6 = adapterPosition + 1;
} else {
int indexOf = validGroupedMessage.posArray.indexOf(currentPosition2);
if (indexOf < 0) {
break;
}
validGroupedMessage.posArray.size();
if ((currentPosition2.flags & 4) != 0) {
i6 = adapterPosition + indexOf + i8;
} else {
i6 = adapterPosition + 1;
for (int i14 = indexOf - 1; i14 >= 0 && validGroupedMessage.posArray.get(i14).maxY >= currentPosition2.minY; i14--) {
i6++;
}
}
}
childViewHolder = ChatActivity.this.chatListView.findViewHolderForAdapterPosition(i6);
if (childViewHolder == null) {
break;
}
top = childViewHolder.itemView.getTop();
if (top2 - AndroidUtilities.dp(48.0f) < childViewHolder.itemView.getBottom()) {
translationX = Math.min(childViewHolder.itemView.getTranslationX(), translationX);
}
if (!(childViewHolder.itemView instanceof ChatMessageCell) || !((ChatMessageCell) childViewHolder.itemView).isPinnedTop()) {
break;
}
i8 = 1;
}
}
if (top2 - AndroidUtilities.dp(48.0f) < top) {
AndroidUtilities.dp(48.0f);
}
if (translationX != 0.0f) {
canvas.save();
canvas.translate(translationX, 0.0f);
}
avatarImage.setImageY(view5.getTop() + AndroidUtilities.dp(7.0f));
avatarImage.draw(canvas);
if (translationX != 0.0f) {
canvas.restore();
}
}
}
return drawChild;
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
AccessibilityNodeInfo.CollectionInfo collectionInfo;
if (ChatActivity.this.currentEncryptedChat != null) {
return;
}
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
if (Build.VERSION.SDK_INT < 19 || (collectionInfo = accessibilityNodeInfo.getCollectionInfo()) == null) {
return;
}
accessibilityNodeInfo.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain(collectionInfo.getRowCount(), 1, false));
}
@Override
public AccessibilityNodeInfo createAccessibilityNodeInfo() {
if (ChatActivity.this.currentEncryptedChat != null) {
return null;
}
return super.createAccessibilityNodeInfo();
}
};
if (this.currentEncryptedChat != null) {
this.chatListView.setImportantForAccessibility(4);
}
this.chatListView.setInstantClick(true);
this.chatListView.setDisableHighlightState(true);
this.chatListView.setTag(1);
this.chatListView.setVerticalScrollBarEnabled(true);
RecyclerListView recyclerListView6 = this.chatListView;
ChatActivityAdapter chatActivityAdapter2 = new ChatActivityAdapter(context);
this.chatAdapter = chatActivityAdapter2;
recyclerListView6.setAdapter(chatActivityAdapter2);
this.chatListView.setClipToPadding(false);
this.chatListView.setPadding(0, AndroidUtilities.dp(4.0f), 0, AndroidUtilities.dp(3.0f));
this.chatListView.setItemAnimator(null);
this.chatListView.setLayoutAnimation(null);
charSequence2 = charSequence;
GridLayoutManagerFixed gridLayoutManagerFixed2 = new GridLayoutManagerFixed(context, 1000, 1, true) {
@Override
public boolean supportsPredictiveItemAnimations() {
return false;
}
@Override
public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int i42) {
LinearSmoothScrollerMiddle linearSmoothScrollerMiddle = new LinearSmoothScrollerMiddle(recyclerView.getContext());
linearSmoothScrollerMiddle.setTargetPosition(i42);
startSmoothScroll(linearSmoothScrollerMiddle);
}
@Override
public boolean shouldLayoutChildFromOpositeSide(View view5) {
if (view5 instanceof ChatMessageCell) {
return !((ChatMessageCell) view5).getMessageObject().isOutOwner();
}
return false;
}
@Override
protected boolean hasSiblingChild(int i42) {
int i52;
if (i42 >= ChatActivity.this.chatAdapter.messagesStartRow && i42 < ChatActivity.this.chatAdapter.messagesEndRow && (i52 = i42 - ChatActivity.this.chatAdapter.messagesStartRow) >= 0 && i52 < ChatActivity.this.messages.size()) {
MessageObject messageObject = ChatActivity.this.messages.get(i52);
MessageObject.GroupedMessages validGroupedMessage = ChatActivity.this.getValidGroupedMessage(messageObject);
if (validGroupedMessage != null) {
MessageObject.GroupedMessagePosition groupedMessagePosition = validGroupedMessage.positions.get(messageObject);
if (groupedMessagePosition.minX != groupedMessagePosition.maxX && groupedMessagePosition.minY == groupedMessagePosition.maxY && groupedMessagePosition.minY != 0) {
int size = validGroupedMessage.posArray.size();
for (int i6 = 0; i6 < size; i6++) {
MessageObject.GroupedMessagePosition groupedMessagePosition2 = validGroupedMessage.posArray.get(i6);
if (groupedMessagePosition2 != groupedMessagePosition && groupedMessagePosition2.minY <= groupedMessagePosition.minY && groupedMessagePosition2.maxY >= groupedMessagePosition.minY) {
return true;
}
}
}
}
}
return false;
}
};
this.chatLayoutManager = gridLayoutManagerFixed2;
gridLayoutManagerFixed2.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int i42) {
int i52;
if (i42 < ChatActivity.this.chatAdapter.messagesStartRow || i42 >= ChatActivity.this.chatAdapter.messagesEndRow || (i52 = i42 - ChatActivity.this.chatAdapter.messagesStartRow) < 0 || i52 >= ChatActivity.this.messages.size()) {
return 1000;
}
MessageObject messageObject = ChatActivity.this.messages.get(i52);
MessageObject.GroupedMessages validGroupedMessage = ChatActivity.this.getValidGroupedMessage(messageObject);
if (validGroupedMessage != null) {
return validGroupedMessage.positions.get(messageObject).spanSize;
}
return 1000;
}
});
this.chatListView.setLayoutManager(this.chatLayoutManager);
this.chatListView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(Rect rect, View view5, RecyclerView recyclerView, RecyclerView.State state) {
ChatMessageCell chatMessageCell;
MessageObject.GroupedMessages currentMessagesGroup;
MessageObject.GroupedMessagePosition currentPosition;
int i42 = 0;
rect.bottom = 0;
if (!(view5 instanceof ChatMessageCell) || (currentMessagesGroup = (chatMessageCell = (ChatMessageCell) view5).getCurrentMessagesGroup()) == null || (currentPosition = chatMessageCell.getCurrentPosition()) == null || currentPosition.siblingHeights == null) {
return;
}
float max = Math.max(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) * 0.5f;
int captionHeight = chatMessageCell.getCaptionHeight();
for (int i52 = 0; i52 < currentPosition.siblingHeights.length; i52++) {
captionHeight += (int) Math.ceil(currentPosition.siblingHeights[i52] * max);
}
int round = captionHeight + ((currentPosition.maxY - currentPosition.minY) * Math.round(AndroidUtilities.density * 7.0f));
int size = currentMessagesGroup.posArray.size();
while (true) {
if (i42 >= size) {
break;
}
MessageObject.GroupedMessagePosition groupedMessagePosition = currentMessagesGroup.posArray.get(i42);
if (groupedMessagePosition.minY == currentPosition.minY && ((groupedMessagePosition.minX != currentPosition.minX || groupedMessagePosition.maxX != currentPosition.maxX || groupedMessagePosition.minY != currentPosition.minY || groupedMessagePosition.maxY != currentPosition.maxY) && groupedMessagePosition.minY == currentPosition.minY)) {
round -= ((int) Math.ceil(max * groupedMessagePosition.ph)) - AndroidUtilities.dp(4.0f);
break;
}
i42++;
}
rect.bottom = -round;
}
});
this.contentView.addView(this.chatListView, LayoutHelper.createFrame(-1, -1.0f));
this.chatListView.setOnItemLongClickListener(this.onItemLongClickListener);
this.chatListView.setOnItemClickListener(this.onItemClickListener);
this.chatListView.setOnScrollListener(new RecyclerView.OnScrollListener() {
private boolean scrollUp;
private float totalDy = 0.0f;
private final int scrollValue = AndroidUtilities.dp(100.0f);
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int i42) {
if (i42 == 0) {
ChatActivity.this.scrollingFloatingDate = false;
ChatActivity.this.scrollingChatListView = false;
ChatActivity.this.checkTextureViewPosition = false;
ChatActivity.this.hideFloatingDateView(true);
ChatActivity.this.checkAutoDownloadMessages(this.scrollUp);
if (SharedConfig.getDevicePerfomanceClass() == 0) {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.startAllHeavyOperations, 512);
return;
}
return;
}
if (i42 == 2) {
ChatActivity.this.wasManualScroll = true;
ChatActivity.this.scrollingChatListView = true;
} else if (i42 == 1) {
ChatActivity.this.wasManualScroll = true;
ChatActivity.this.scrollingFloatingDate = true;
ChatActivity.this.checkTextureViewPosition = true;
ChatActivity.this.scrollingChatListView = true;
}
if (SharedConfig.getDevicePerfomanceClass() == 0) {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.stopAllHeavyOperations, 512);
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int i42, int i52) {
ChatActivity.this.chatListView.invalidate();
this.scrollUp = i52 < 0;
if (!ChatActivity.this.wasManualScroll && i52 != 0) {
ChatActivity.this.wasManualScroll = true;
}
if (i52 != 0) {
if (ChatActivity.this.noSoundHintView != null) {
ChatActivity.this.noSoundHintView.hide();
}
if (ChatActivity.this.forwardHintView != null) {
ChatActivity.this.forwardHintView.hide();
}
}
if (i52 != 0 && ChatActivity.this.scrollingFloatingDate && !ChatActivity.this.currentFloatingTopIsNotMessage) {
if (ChatActivity.this.highlightMessageId != Integer.MAX_VALUE) {
ChatActivity.this.removeSelectedMessageHighlight();
ChatActivity.this.updateVisibleRows();
}
ChatActivity.this.showFloatingDateView(true);
}
ChatActivity.this.checkScrollForLoad(true);
int findFirstVisibleItemPosition = ChatActivity.this.chatLayoutManager.findFirstVisibleItemPosition();
if (findFirstVisibleItemPosition != -1) {
ChatActivity.this.chatAdapter.getItemCount();
if (findFirstVisibleItemPosition == 0 && ChatActivity.this.forwardEndReached[0]) {
ChatActivity.this.showPagedownButton(false, true);
} else if (i52 > 0) {
if (ChatActivity.this.pagedownButton.getTag() == null) {
float f = this.totalDy + i52;
this.totalDy = f;
if (f > this.scrollValue) {
this.totalDy = 0.0f;
ChatActivity.this.showPagedownButton(true, true);
ChatActivity.this.pagedownButtonShowedByScroll = true;
}
}
} else if (ChatActivity.this.pagedownButtonShowedByScroll && ChatActivity.this.pagedownButton.getTag() != null) {
float f2 = this.totalDy + i52;
this.totalDy = f2;
if (f2 < (-this.scrollValue)) {
ChatActivity.this.showPagedownButton(false, true);
this.totalDy = 0.0f;
}
}
}
ChatActivity.this.updateMessagesVisiblePart(true);
}
});
FrameLayout frameLayout22 = new FrameLayout(context);
this.progressView = frameLayout22;
frameLayout22.setVisibility(4);
this.contentView.addView(this.progressView, LayoutHelper.createFrame(-1, -1, 51));
View view5 = new View(context);
this.progressView2 = view5;
view5.setBackgroundResource(R.drawable.system_loader);
this.progressView2.getBackground().setColorFilter(Theme.colorFilter);
this.progressView.addView(this.progressView2, LayoutHelper.createFrame(36, 36, 17));
RadialProgressView radialProgressView3 = new RadialProgressView(context);
this.progressBar = radialProgressView3;
radialProgressView3.setSize(AndroidUtilities.dp(28.0f));
this.progressBar.setProgressColor(Theme.getColor(Theme.key_chat_serviceText));
this.progressView.addView(this.progressBar, LayoutHelper.createFrame(32, 32, 17));
ChatActionCell chatActionCell2 = new ChatActionCell(context) {
@Override
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
if (getAlpha() == 0.0f || ChatActivity.this.actionBar.isActionModeShowed()) {
return false;
}
return super.onInterceptTouchEvent(motionEvent);
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
if (getAlpha() == 0.0f || ChatActivity.this.actionBar.isActionModeShowed()) {
return false;
}
return super.onTouchEvent(motionEvent);
}
};
this.floatingDateView = chatActionCell2;
chatActionCell2.setAlpha(0.0f);
this.contentView.addView(this.floatingDateView, LayoutHelper.createFrame(-2.0f, -2.0f, 49, 0.0f, 4.0f, 0.0f, 0.0f));
this.floatingDateView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view22) {
ChatActivity.this.lambda$createView$6$ChatActivity(view22);
}
});
if (this.currentEncryptedChat == null) {
}
FrameLayout frameLayout52 = new FrameLayout(context) {
private boolean ignoreLayout;
@Override
protected void onMeasure(int i42, int i52) {
int size = View.MeasureSpec.getSize(i42);
if (ChatActivity.this.addToContactsButton != null && ChatActivity.this.addToContactsButton.getVisibility() == 0 && ChatActivity.this.reportSpamButton != null && ChatActivity.this.reportSpamButton.getVisibility() == 0) {
size = (size - AndroidUtilities.dp(31.0f)) / 2;
}
this.ignoreLayout = true;
if (ChatActivity.this.reportSpamButton != null && ChatActivity.this.reportSpamButton.getVisibility() == 0) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) ChatActivity.this.reportSpamButton.getLayoutParams();
layoutParams.width = size;
if (ChatActivity.this.addToContactsButton == null || ChatActivity.this.addToContactsButton.getVisibility() != 0) {
ChatActivity.this.reportSpamButton.setPadding(AndroidUtilities.dp(48.0f), 0, AndroidUtilities.dp(48.0f), 0);
layoutParams.leftMargin = 0;
} else {
ChatActivity.this.reportSpamButton.setPadding(AndroidUtilities.dp(4.0f), 0, AndroidUtilities.dp(19.0f), 0);
layoutParams.leftMargin = size;
}
}
if (ChatActivity.this.addToContactsButton != null && ChatActivity.this.addToContactsButton.getVisibility() == 0) {
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) ChatActivity.this.addToContactsButton.getLayoutParams();
layoutParams2.width = size;
if (ChatActivity.this.reportSpamButton == null || ChatActivity.this.reportSpamButton.getVisibility() != 0) {
ChatActivity.this.addToContactsButton.setPadding(AndroidUtilities.dp(48.0f), 0, AndroidUtilities.dp(48.0f), 0);
layoutParams2.leftMargin = 0;
} else {
ChatActivity.this.addToContactsButton.setPadding(AndroidUtilities.dp(11.0f), 0, AndroidUtilities.dp(4.0f), 0);
}
}
this.ignoreLayout = false;
super.onMeasure(i42, i52);
}
@Override
public void requestLayout() {
if (this.ignoreLayout) {
return;
}
super.requestLayout();
}
};
this.topChatPanelView = frameLayout52;
frameLayout52.setTag(1);
this.topChatPanelView.setTranslationY(-AndroidUtilities.dp(50.0f));
this.topChatPanelView.setVisibility(8);
this.topChatPanelView.setBackgroundResource(R.drawable.blockpanel);
this.topChatPanelView.getBackground().setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_topPanelBackground), PorterDuff.Mode.MULTIPLY));
this.contentView.addView(this.topChatPanelView, LayoutHelper.createFrame(-1, 50, 51));
TextView textView32 = new TextView(context);
this.reportSpamButton = textView32;
textView32.setTextColor(Theme.getColor(Theme.key_chat_reportSpam));
this.reportSpamButton.setTag(Theme.key_chat_reportSpam);
this.reportSpamButton.setTextSize(1, 14.0f);
this.reportSpamButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.reportSpamButton.setSingleLine(true);
this.reportSpamButton.setMaxLines(1);
this.reportSpamButton.setGravity(17);
this.topChatPanelView.addView(this.reportSpamButton, LayoutHelper.createFrame(-1.0f, -1.0f, 51, 0.0f, 0.0f, 0.0f, AndroidUtilities.dp(1.0f)));
this.reportSpamButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view32) {
ChatActivity.this.lambda$createView$13$ChatActivity(view32);
}
});
TextView textView42 = new TextView(context);
this.addToContactsButton = textView42;
textView42.setTextColor(Theme.getColor(Theme.key_chat_addContact));
this.addToContactsButton.setVisibility(8);
this.addToContactsButton.setTextSize(1, 14.0f);
this.addToContactsButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.addToContactsButton.setSingleLine(true);
this.addToContactsButton.setMaxLines(1);
this.addToContactsButton.setPadding(AndroidUtilities.dp(4.0f), 0, AndroidUtilities.dp(4.0f), 0);
this.addToContactsButton.setGravity(17);
this.topChatPanelView.addView(this.addToContactsButton, LayoutHelper.createFrame(-1.0f, -1.0f, 51, 0.0f, 0.0f, 0.0f, AndroidUtilities.dp(1.0f)));
this.addToContactsButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view32) {
ChatActivity.this.lambda$createView$14$ChatActivity(view32);
}
});
ImageView imageView32 = new ImageView(context);
this.closeReportSpam = imageView32;
imageView32.setImageResource(R.drawable.miniplayer_close);
this.closeReportSpam.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_topPanelClose), PorterDuff.Mode.MULTIPLY));
this.closeReportSpam.setScaleType(ImageView.ScaleType.CENTER);
this.topChatPanelView.addView(this.closeReportSpam, LayoutHelper.createFrame(48, 48, 53));
this.closeReportSpam.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view32) {
ChatActivity.this.lambda$createView$15$ChatActivity(view32);
}
});
FrameLayout frameLayout62 = new FrameLayout(context);
this.alertView = frameLayout62;
frameLayout62.setTag(1);
this.alertView.setTranslationY(-AndroidUtilities.dp(50.0f));
this.alertView.setVisibility(8);
this.alertView.setBackgroundResource(R.drawable.blockpanel);
this.alertView.getBackground().setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_topPanelBackground), PorterDuff.Mode.MULTIPLY));
this.contentView.addView(this.alertView, LayoutHelper.createFrame(-1, 50, 51));
TextView textView52 = new TextView(context);
this.alertNameTextView = textView52;
textView52.setTextSize(1, 14.0f);
this.alertNameTextView.setTextColor(Theme.getColor(Theme.key_chat_topPanelTitle));
this.alertNameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.alertNameTextView.setSingleLine(true);
this.alertNameTextView.setEllipsize(TextUtils.TruncateAt.END);
this.alertNameTextView.setMaxLines(1);
this.alertView.addView(this.alertNameTextView, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 8.0f, 5.0f, 8.0f, 0.0f));
TextView textView62 = new TextView(context);
this.alertTextView = textView62;
textView62.setTextSize(1, 14.0f);
this.alertTextView.setTextColor(Theme.getColor(Theme.key_chat_topPanelMessage));
this.alertTextView.setSingleLine(true);
this.alertTextView.setEllipsize(TextUtils.TruncateAt.END);
this.alertTextView.setMaxLines(1);
this.alertView.addView(this.alertTextView, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 8.0f, 23.0f, 8.0f, 0.0f));
FrameLayout frameLayout72 = new FrameLayout(context);
this.pagedownButton = frameLayout72;
frameLayout72.setVisibility(4);
this.contentView.addView(this.pagedownButton, LayoutHelper.createFrame(66.0f, 59.0f, 85, 0.0f, 0.0f, -3.0f, 5.0f));
this.pagedownButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view32) {
ChatActivity.this.lambda$createView$16$ChatActivity(view32);
}
});
FrameLayout frameLayout82 = new FrameLayout(context);
this.mentiondownButton = frameLayout82;
frameLayout82.setVisibility(4);
this.contentView.addView(this.mentiondownButton, LayoutHelper.createFrame(46.0f, 59.0f, 85, 0.0f, 0.0f, 7.0f, 5.0f));
this.mentiondownButton.setOnClickListener(new AnonymousClass17());
this.mentiondownButton.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public final boolean onLongClick(View view32) {
return ChatActivity.this.lambda$createView$17$ChatActivity(view32);
}
});
FrameLayout frameLayout92 = new FrameLayout(context) {
@Override
public void onDraw(Canvas canvas) {
int i42;
int dp;
if (ChatActivity.this.mentionListView.getChildCount() <= 0) {
return;
}
if (ChatActivity.this.mentionLayoutManager.getReverseLayout()) {
int dp2 = ChatActivity.this.mentionListViewScrollOffsetY + AndroidUtilities.dp(2.0f);
Theme.chat_composeShadowDrawable.setBounds(0, Theme.chat_composeShadowDrawable.getIntrinsicHeight() + dp2, getMeasuredWidth(), dp2);
Theme.chat_composeShadowDrawable.draw(canvas);
canvas.drawRect(0.0f, 0.0f, getMeasuredWidth(), dp2, Theme.chat_composeBackgroundPaint);
return;
}
if (!ChatActivity.this.mentionsAdapter.isBotContext() || !ChatActivity.this.mentionsAdapter.isMediaLayout() || ChatActivity.this.mentionsAdapter.getBotContextSwitch() != null) {
i42 = ChatActivity.this.mentionListViewScrollOffsetY;
dp = AndroidUtilities.dp(2.0f);
} else {
i42 = ChatActivity.this.mentionListViewScrollOffsetY;
dp = AndroidUtilities.dp(4.0f);
}
int i52 = i42 - dp;
int intrinsicHeight = Theme.chat_composeShadowDrawable.getIntrinsicHeight() + i52;
Theme.chat_composeShadowDrawable.setBounds(0, i52, getMeasuredWidth(), intrinsicHeight);
Theme.chat_composeShadowDrawable.draw(canvas);
canvas.drawRect(0.0f, intrinsicHeight, getMeasuredWidth(), getMeasuredHeight(), Theme.chat_composeBackgroundPaint);
}
@Override
public void requestLayout() {
if (ChatActivity.this.mentionListViewIgnoreLayout) {
return;
}
super.requestLayout();
}
};
this.mentionContainer = frameLayout92;
frameLayout92.setVisibility(8);
updateMessageListAccessibilityVisibility();
this.mentionContainer.setWillNotDraw(false);
this.contentView.addView(this.mentionContainer, LayoutHelper.createFrame(-1, 110, 83));
RecyclerListView recyclerListView22 = new RecyclerListView(context) {
private int lastHeight;
private int lastWidth;
@Override
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
if (ChatActivity.this.mentionLayoutManager.getReverseLayout()) {
if (!ChatActivity.this.mentionListViewIsScrolling && ChatActivity.this.mentionListViewScrollOffsetY != 0 && motionEvent.getY() > ChatActivity.this.mentionListViewScrollOffsetY) {
return false;
}
} else if (!ChatActivity.this.mentionListViewIsScrolling && ChatActivity.this.mentionListViewScrollOffsetY != 0 && motionEvent.getY() < ChatActivity.this.mentionListViewScrollOffsetY) {
return false;
}
return super.onInterceptTouchEvent(motionEvent) || ContentPreviewViewer.getInstance().onInterceptTouchEvent(motionEvent, ChatActivity.this.mentionListView, 0, null);
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
if (ChatActivity.this.mentionLayoutManager.getReverseLayout()) {
if (!ChatActivity.this.mentionListViewIsScrolling && ChatActivity.this.mentionListViewScrollOffsetY != 0 && motionEvent.getY() > ChatActivity.this.mentionListViewScrollOffsetY) {
return false;
}
} else if (!ChatActivity.this.mentionListViewIsScrolling && ChatActivity.this.mentionListViewScrollOffsetY != 0 && motionEvent.getY() < ChatActivity.this.mentionListViewScrollOffsetY) {
return false;
}
return super.onTouchEvent(motionEvent);
}
@Override
public void requestLayout() {
if (ChatActivity.this.mentionListViewIgnoreLayout) {
return;
}
super.requestLayout();
}
@Override
public void onLayout(boolean z22, int i42, int i52, int i6, int i7) {
int i8;
int i9;
int i10 = i6 - i42;
int i11 = i7 - i52;
if (ChatActivity.this.mentionLayoutManager.getReverseLayout() || ChatActivity.this.mentionListView == null || ChatActivity.this.mentionListViewLastViewPosition < 0 || i10 != this.lastWidth || i11 - this.lastHeight == 0) {
i8 = -1;
i9 = 0;
} else {
i8 = ChatActivity.this.mentionListViewLastViewPosition;
i9 = ((ChatActivity.this.mentionListViewLastViewTop + i11) - this.lastHeight) - getPaddingTop();
}
super.onLayout(z22, i42, i52, i6, i7);
if (i8 != -1) {
ChatActivity.this.mentionListViewIgnoreLayout = true;
if (!ChatActivity.this.mentionsAdapter.isBotContext() || !ChatActivity.this.mentionsAdapter.isMediaLayout()) {
ChatActivity.this.mentionLayoutManager.scrollToPositionWithOffset(i8, i9);
} else {
ChatActivity.this.mentionGridLayoutManager.scrollToPositionWithOffset(i8, i9);
}
super.onLayout(false, i42, i52, i6, i7);
ChatActivity.this.mentionListViewIgnoreLayout = false;
}
this.lastHeight = i11;
this.lastWidth = i10;
ChatActivity.this.mentionListViewUpdateLayout();
}
};
this.mentionListView = recyclerListView22;
recyclerListView22.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view32, MotionEvent motionEvent) {
return ChatActivity.this.lambda$createView$18$ChatActivity(view32, motionEvent);
}
});
this.mentionListView.setTag(2);
LinearLayoutManager linearLayoutManager3 = new LinearLayoutManager(context) {
@Override
public boolean supportsPredictiveItemAnimations() {
return false;
}
};
this.mentionLayoutManager = linearLayoutManager3;
linearLayoutManager3.setOrientation(1);
ExtendedGridLayoutManager extendedGridLayoutManager2 = new ExtendedGridLayoutManager(context, 100) {
private Size size = new Size();
@Override
protected Size getSizeForItem(int i42) {
TLRPC.PhotoSize closestPhotoSizeWithSize;
if (ChatActivity.this.mentionsAdapter.getBotContextSwitch() != null) {
i42++;
}
this.size.width = 0.0f;
this.size.height = 0.0f;
Object item = ChatActivity.this.mentionsAdapter.getItem(i42);
if (item instanceof TLRPC.BotInlineResult) {
TLRPC.BotInlineResult botInlineResult = (TLRPC.BotInlineResult) item;
int i52 = 0;
if (botInlineResult.document != null) {
TLRPC.PhotoSize closestPhotoSizeWithSize2 = FileLoader.getClosestPhotoSizeWithSize(botInlineResult.document.thumbs, 90);
this.size.width = closestPhotoSizeWithSize2 != null ? closestPhotoSizeWithSize2.w : 100.0f;
this.size.height = closestPhotoSizeWithSize2 != null ? closestPhotoSizeWithSize2.h : 100.0f;
while (i52 < botInlineResult.document.attributes.size()) {
TLRPC.DocumentAttribute documentAttribute = botInlineResult.document.attributes.get(i52);
if ((documentAttribute instanceof TLRPC.TL_documentAttributeImageSize) || (documentAttribute instanceof TLRPC.TL_documentAttributeVideo)) {
this.size.width = documentAttribute.w;
this.size.height = documentAttribute.h;
break;
}
i52++;
}
} else if (botInlineResult.content != null) {
while (i52 < botInlineResult.content.attributes.size()) {
TLRPC.DocumentAttribute documentAttribute2 = botInlineResult.content.attributes.get(i52);
if ((documentAttribute2 instanceof TLRPC.TL_documentAttributeImageSize) || (documentAttribute2 instanceof TLRPC.TL_documentAttributeVideo)) {
this.size.width = documentAttribute2.w;
this.size.height = documentAttribute2.h;
break;
}
i52++;
}
} else if (botInlineResult.thumb != null) {
while (i52 < botInlineResult.thumb.attributes.size()) {
TLRPC.DocumentAttribute documentAttribute3 = botInlineResult.thumb.attributes.get(i52);
if ((documentAttribute3 instanceof TLRPC.TL_documentAttributeImageSize) || (documentAttribute3 instanceof TLRPC.TL_documentAttributeVideo)) {
this.size.width = documentAttribute3.w;
this.size.height = documentAttribute3.h;
break;
}
i52++;
}
} else if (botInlineResult.photo != null && (closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(botInlineResult.photo.sizes, AndroidUtilities.photoSize.intValue())) != null) {
this.size.width = closestPhotoSizeWithSize.w;
this.size.height = closestPhotoSizeWithSize.h;
}
}
return this.size;
}
@Override
public int getFlowItemCount() {
if (ChatActivity.this.mentionsAdapter.getBotContextSwitch() != null) {
return getItemCount() - 1;
}
return super.getFlowItemCount();
}
};
this.mentionGridLayoutManager = extendedGridLayoutManager2;
extendedGridLayoutManager2.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int i42) {
if (ChatActivity.this.mentionsAdapter.getItem(i42) instanceof TLRPC.TL_inlineBotSwitchPM) {
return 100;
}
if (ChatActivity.this.mentionsAdapter.getBotContextSwitch() != null) {
i42--;
}
return ChatActivity.this.mentionGridLayoutManager.getSpanSizeForItem(i42);
}
});
this.mentionListView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(Rect rect, View view32, RecyclerView recyclerView, RecyclerView.State state) {
rect.left = 0;
rect.right = 0;
rect.top = 0;
rect.bottom = 0;
if (recyclerView.getLayoutManager() == ChatActivity.this.mentionGridLayoutManager) {
int childAdapterPosition = recyclerView.getChildAdapterPosition(view32);
if (ChatActivity.this.mentionsAdapter.getBotContextSwitch() == null) {
rect.top = AndroidUtilities.dp(2.0f);
} else if (childAdapterPosition == 0) {
return;
} else {
childAdapterPosition--;
if (!ChatActivity.this.mentionGridLayoutManager.isFirstRow(childAdapterPosition)) {
rect.top = AndroidUtilities.dp(2.0f);
}
}
rect.right = ChatActivity.this.mentionGridLayoutManager.isLastInRow(childAdapterPosition) ? 0 : AndroidUtilities.dp(2.0f);
}
}
});
this.mentionListView.setItemAnimator(null);
this.mentionListView.setLayoutAnimation(null);
this.mentionListView.setClipToPadding(false);
this.mentionListView.setLayoutManager(this.mentionLayoutManager);
this.mentionListView.setOverScrollMode(2);
this.mentionContainer.addView(this.mentionListView, LayoutHelper.createFrame(-1, -1.0f));
RecyclerListView recyclerListView32 = this.mentionListView;
MentionsAdapter mentionsAdapter22 = new MentionsAdapter(context, false, this.dialog_id, new MentionsAdapter.MentionsAdapterDelegate() {
@Override
public void needChangePanelVisibility(boolean z22) {
if (!ChatActivity.this.mentionsAdapter.isBotContext() || !ChatActivity.this.mentionsAdapter.isMediaLayout()) {
ChatActivity.this.mentionListView.setLayoutManager(ChatActivity.this.mentionLayoutManager);
} else {
ChatActivity.this.mentionListView.setLayoutManager(ChatActivity.this.mentionGridLayoutManager);
}
if (z22 && ChatActivity.this.bottomOverlay.getVisibility() == 0) {
z22 = false;
}
if (z22) {
if (ChatActivity.this.mentionListAnimation != null) {
ChatActivity.this.mentionListAnimation.cancel();
ChatActivity.this.mentionListAnimation = null;
}
if (ChatActivity.this.mentionContainer.getVisibility() == 0) {
ChatActivity.this.mentionContainer.setAlpha(1.0f);
return;
}
if (!ChatActivity.this.mentionsAdapter.isBotContext() || !ChatActivity.this.mentionsAdapter.isMediaLayout()) {
if (!ChatActivity.this.mentionLayoutManager.getReverseLayout()) {
ChatActivity.this.mentionLayoutManager.scrollToPositionWithOffset(0, ChatActivity.this.mentionLayoutManager.getReverseLayout() ? -10000 : 10000);
}
} else {
ChatActivity.this.mentionGridLayoutManager.scrollToPositionWithOffset(0, 10000);
}
if (!ChatActivity.this.allowStickersPanel || (ChatActivity.this.mentionsAdapter.isBotContext() && !ChatActivity.this.allowContextBotPanel && !ChatActivity.this.allowContextBotPanelSecond)) {
ChatActivity.this.mentionContainer.setAlpha(1.0f);
ChatActivity.this.mentionContainer.setVisibility(4);
ChatActivity.this.updateMessageListAccessibilityVisibility();
return;
}
if (ChatActivity.this.currentEncryptedChat != null && ChatActivity.this.mentionsAdapter.isBotContext()) {
SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
if (!globalMainSettings.getBoolean("secretbot", false)) {
AlertDialog.Builder builder = new AlertDialog.Builder(ChatActivity.this.getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("SecretChatContextBotAlert", R.string.SecretChatContextBotAlert));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
ChatActivity.this.showDialog(builder.create());
globalMainSettings.edit().putBoolean("secretbot", true).commit();
}
}
ChatActivity.this.mentionContainer.setVisibility(0);
ChatActivity.this.updateMessageListAccessibilityVisibility();
ChatActivity.this.mentionContainer.setTag(null);
ChatActivity.this.mentionListAnimation = new AnimatorSet();
ChatActivity.this.mentionListAnimation.playTogether(ObjectAnimator.ofFloat(ChatActivity.this.mentionContainer, View.ALPHA, 0.0f, 1.0f));
ChatActivity.this.mentionListAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.mentionListAnimation == null || !ChatActivity.this.mentionListAnimation.equals(animator)) {
return;
}
ChatActivity.this.mentionListAnimation = null;
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.mentionListAnimation == null || !ChatActivity.this.mentionListAnimation.equals(animator)) {
return;
}
ChatActivity.this.mentionListAnimation = null;
}
});
ChatActivity.this.mentionListAnimation.setDuration(200L);
ChatActivity.this.mentionListAnimation.start();
return;
}
if (ChatActivity.this.mentionListAnimation != null) {
ChatActivity.this.mentionListAnimation.cancel();
ChatActivity.this.mentionListAnimation = null;
}
if (ChatActivity.this.mentionContainer.getVisibility() == 8) {
return;
}
if (ChatActivity.this.allowStickersPanel) {
ChatActivity.this.mentionListAnimation = new AnimatorSet();
ChatActivity.this.mentionListAnimation.playTogether(ObjectAnimator.ofFloat(ChatActivity.this.mentionContainer, View.ALPHA, 0.0f));
ChatActivity.this.mentionListAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.mentionListAnimation == null || !ChatActivity.this.mentionListAnimation.equals(animator)) {
return;
}
ChatActivity.this.mentionContainer.setVisibility(8);
ChatActivity.this.mentionContainer.setTag(null);
ChatActivity.this.updateMessageListAccessibilityVisibility();
ChatActivity.this.mentionListAnimation = null;
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.mentionListAnimation == null || !ChatActivity.this.mentionListAnimation.equals(animator)) {
return;
}
ChatActivity.this.mentionListAnimation = null;
}
});
ChatActivity.this.mentionListAnimation.setDuration(200L);
ChatActivity.this.mentionListAnimation.start();
return;
}
ChatActivity.this.mentionContainer.setTag(null);
ChatActivity.this.mentionContainer.setVisibility(8);
ChatActivity.this.updateMessageListAccessibilityVisibility();
}
@Override
public void onContextSearch(boolean z22) {
if (ChatActivity.this.chatActivityEnterView != null) {
ChatActivity.this.chatActivityEnterView.setCaption(ChatActivity.this.mentionsAdapter.getBotCaption());
ChatActivity.this.chatActivityEnterView.showContextProgress(z22);
}
}
@Override
public void onContextClick(TLRPC.BotInlineResult botInlineResult) {
if (ChatActivity.this.getParentActivity() == null || botInlineResult.content == null) {
return;
}
if (botInlineResult.type.equals(MimeTypes.BASE_TYPE_VIDEO) || botInlineResult.type.equals("web_player_video")) {
int[] inlineResultWidthAndHeight = MessageObject.getInlineResultWidthAndHeight(botInlineResult);
EmbedBottomSheet.show(ChatActivity.this.getParentActivity(), botInlineResult.title != null ? botInlineResult.title : "", botInlineResult.description, botInlineResult.content.url, botInlineResult.content.url, inlineResultWidthAndHeight[0], inlineResultWidthAndHeight[1]);
return;
}
Browser.openUrl(ChatActivity.this.getParentActivity(), botInlineResult.content.url);
}
});
this.mentionsAdapter = mentionsAdapter22;
recyclerListView32.setAdapter(mentionsAdapter22);
if (ChatObject.isChannel(this.currentChat)) {
}
this.mentionsAdapter.setBotInfo(this.botInfo);
this.mentionsAdapter.setParentFragment(this);
this.mentionsAdapter.setChatInfo(this.chatInfo);
this.mentionsAdapter.setNeedUsernames(this.currentChat == null);
MentionsAdapter mentionsAdapter32 = this.mentionsAdapter;
TLRPC.EncryptedChat encryptedChat22 = this.currentEncryptedChat;
mentionsAdapter32.setNeedBotContext(encryptedChat22 != null || AndroidUtilities.getPeerLayerVersion(encryptedChat22.layer) >= 46);
this.mentionsAdapter.setBotsCount(this.currentChat == null ? this.botsCount : 1);
RecyclerListView recyclerListView42 = this.mentionListView;
RecyclerListView.OnItemClickListener onItemClickListener2 = new RecyclerListView.OnItemClickListener() {
@Override
public final void onItemClick(View view32, int i42) {
ChatActivity.this.lambda$createView$21$ChatActivity(view32, i42);
}
};
this.mentionsOnItemClickListener = onItemClickListener2;
recyclerListView42.setOnItemClickListener(onItemClickListener2);
this.mentionListView.setOnItemLongClickListener(new RecyclerListView.OnItemLongClickListener() {
@Override
public final boolean onItemClick(View view32, int i42) {
return ChatActivity.this.lambda$createView$23$ChatActivity(view32, i42);
}
});
this.mentionListView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int i42) {
ChatActivity.this.mentionListViewIsScrolling = i42 == 1;
}
@Override
public void onScrolled(RecyclerView recyclerView, int i42, int i52) {
int findLastVisibleItemPosition = (ChatActivity.this.mentionsAdapter.isBotContext() && ChatActivity.this.mentionsAdapter.isMediaLayout()) ? ChatActivity.this.mentionGridLayoutManager.findLastVisibleItemPosition() : ChatActivity.this.mentionLayoutManager.findLastVisibleItemPosition();
if ((findLastVisibleItemPosition == -1 ? 0 : findLastVisibleItemPosition) > 0 && findLastVisibleItemPosition > ChatActivity.this.mentionsAdapter.getItemCount() - 5) {
ChatActivity.this.mentionsAdapter.searchForContextBotForNextOffset();
}
ChatActivity.this.mentionListViewUpdateLayout();
}
});
ImageView imageView42 = new ImageView(context);
this.pagedownButtonImage = imageView42;
imageView42.setImageResource(R.drawable.pagedown);
this.pagedownButtonImage.setScaleType(ImageView.ScaleType.CENTER);
this.pagedownButtonImage.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_goDownButtonIcon), PorterDuff.Mode.MULTIPLY));
this.pagedownButtonImage.setPadding(0, AndroidUtilities.dp(2.0f), 0, 0);
Drawable createCircleDrawable3 = Theme.createCircleDrawable(AndroidUtilities.dp(42.0f), Theme.getColor(Theme.key_chat_goDownButton));
Drawable mutate5 = context.getResources().getDrawable(R.drawable.pagedown_shadow).mutate();
mutate5.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_goDownButtonShadow), PorterDuff.Mode.MULTIPLY));
CombinedDrawable combinedDrawable3 = new CombinedDrawable(mutate5, createCircleDrawable3, 0, 0);
combinedDrawable3.setIconSize(AndroidUtilities.dp(42.0f), AndroidUtilities.dp(42.0f));
this.pagedownButtonImage.setBackgroundDrawable(combinedDrawable3);
this.pagedownButton.addView(this.pagedownButtonImage, LayoutHelper.createFrame(46, 46, 81));
this.pagedownButton.setContentDescription(LocaleController.getString("AccDescrPageDown", R.string.AccDescrPageDown));
TextView textView72 = new TextView(context);
this.pagedownButtonCounter = textView72;
textView72.setVisibility(4);
this.pagedownButtonCounter.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.pagedownButtonCounter.setTextSize(1, 13.0f);
this.pagedownButtonCounter.setTextColor(Theme.getColor(Theme.key_chat_goDownButtonCounter));
this.pagedownButtonCounter.setGravity(17);
this.pagedownButtonCounter.setBackgroundDrawable(Theme.createRoundRectDrawable(AndroidUtilities.dp(11.5f), Theme.getColor(Theme.key_chat_goDownButtonCounterBackground)));
this.pagedownButtonCounter.setMinWidth(AndroidUtilities.dp(23.0f));
this.pagedownButtonCounter.setPadding(AndroidUtilities.dp(8.0f), 0, AndroidUtilities.dp(8.0f), AndroidUtilities.dp(1.0f));
this.pagedownButton.addView(this.pagedownButtonCounter, LayoutHelper.createFrame(-2, 23, 49));
ImageView imageView52 = new ImageView(context);
this.mentiondownButtonImage = imageView52;
imageView52.setImageResource(R.drawable.mentionbutton);
this.mentiondownButtonImage.setScaleType(ImageView.ScaleType.CENTER);
this.mentiondownButtonImage.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_goDownButtonIcon), PorterDuff.Mode.MULTIPLY));
this.mentiondownButtonImage.setPadding(0, AndroidUtilities.dp(2.0f), 0, 0);
Drawable createCircleDrawable22 = Theme.createCircleDrawable(AndroidUtilities.dp(42.0f), Theme.getColor(Theme.key_chat_goDownButton));
Drawable mutate22 = context.getResources().getDrawable(R.drawable.pagedown_shadow).mutate();
mutate22.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_goDownButtonShadow), PorterDuff.Mode.MULTIPLY));
CombinedDrawable combinedDrawable22 = new CombinedDrawable(mutate22, createCircleDrawable22, 0, 0);
combinedDrawable22.setIconSize(AndroidUtilities.dp(42.0f), AndroidUtilities.dp(42.0f));
this.mentiondownButtonImage.setBackgroundDrawable(combinedDrawable22);
this.mentiondownButton.addView(this.mentiondownButtonImage, LayoutHelper.createFrame(46, 46, 83));
TextView textView82 = new TextView(context);
this.mentiondownButtonCounter = textView82;
textView82.setVisibility(4);
this.mentiondownButtonCounter.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.mentiondownButtonCounter.setTextSize(1, 13.0f);
this.mentiondownButtonCounter.setTextColor(Theme.getColor(Theme.key_chat_goDownButtonCounter));
this.mentiondownButtonCounter.setGravity(17);
this.mentiondownButtonCounter.setBackgroundDrawable(Theme.createRoundRectDrawable(AndroidUtilities.dp(11.5f), Theme.getColor(Theme.key_chat_goDownButtonCounterBackground)));
this.mentiondownButtonCounter.setMinWidth(AndroidUtilities.dp(23.0f));
this.mentiondownButtonCounter.setPadding(AndroidUtilities.dp(8.0f), 0, AndroidUtilities.dp(8.0f), AndroidUtilities.dp(1.0f));
this.mentiondownButton.addView(this.mentiondownButtonCounter, LayoutHelper.createFrame(-2, 23, 49));
this.mentiondownButton.setContentDescription(LocaleController.getString("AccDescrMentionDown", R.string.AccDescrMentionDown));
if (AndroidUtilities.isTablet()) {
}
FragmentContextView fragmentContextView3 = new FragmentContextView(context, this, true);
this.contentView.addView(fragmentContextView3, LayoutHelper.createFrame(-1.0f, 39.0f, 51, 0.0f, -36.0f, 0.0f, 0.0f));
SizeNotifierFrameLayout sizeNotifierFrameLayout22 = this.contentView;
FragmentContextView fragmentContextView22 = new FragmentContextView(context, this, false);
this.fragmentContextView = fragmentContextView22;
sizeNotifierFrameLayout22.addView(fragmentContextView22, LayoutHelper.createFrame(-1.0f, 39.0f, 51, 0.0f, -36.0f, 0.0f, 0.0f));
this.fragmentContextView.setAdditionalContextView(fragmentContextView3);
fragmentContextView3.setAdditionalContextView(this.fragmentContextView);
this.contentView.addView(this.actionBar);
this.pinnedLiveUserImageView = new BackupImageView(context);
TLRPC.User currentUser2 = getUserConfig().getCurrentUser();
AvatarDrawable avatarDrawable2 = new AvatarDrawable();
avatarDrawable2.setInfo(currentUser2);
this.pinnedLiveUserImageView.setVisibility(8);
this.pinnedLiveUserImageView.setRoundRadius(AndroidUtilities.dp(5.0f));
this.pinnedLiveUserImageView.setImage(ImageLocation.getForUser(currentUser2, false), "50_50", avatarDrawable2, currentUser2);
this.contentView.addView(this.pinnedLiveUserImageView, LayoutHelper.createFrame(32.0f, 32.0f, 51, 17.0f, 8.0f, 0.0f, 0.0f));
View view32 = new View(context);
this.overlayView = view32;
view32.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view42, MotionEvent motionEvent) {
return ChatActivity.this.lambda$createView$24$ChatActivity(view42, motionEvent);
}
});
this.contentView.addView(this.overlayView, LayoutHelper.createFrame(-1, -1, 51));
this.overlayView.setVisibility(8);
InstantCameraView instantCameraView2 = new InstantCameraView(context, this);
this.instantCameraView = instantCameraView2;
this.contentView.addView(instantCameraView2, LayoutHelper.createFrame(-1, -1, 51));
FrameLayout frameLayout102 = new FrameLayout(context) {
@Override
public void onDraw(Canvas canvas) {
int intrinsicHeight = Theme.chat_composeShadowDrawable.getIntrinsicHeight();
Theme.chat_composeShadowDrawable.setBounds(0, 0, getMeasuredWidth(), intrinsicHeight);
Theme.chat_composeShadowDrawable.draw(canvas);
canvas.drawRect(0.0f, intrinsicHeight, getMeasuredWidth(), getMeasuredHeight(), Theme.chat_composeBackgroundPaint);
}
};
this.bottomMessagesActionContainer = frameLayout102;
frameLayout102.setVisibility(4);
this.bottomMessagesActionContainer.setWillNotDraw(false);
this.bottomMessagesActionContainer.setPadding(0, AndroidUtilities.dp(2.0f), 0, 0);
this.contentView.addView(this.bottomMessagesActionContainer, LayoutHelper.createFrame(-1, 51, 80));
this.bottomMessagesActionContainer.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view42, MotionEvent motionEvent) {
return ChatActivity.lambda$createView$25(view42, motionEvent);
}
});
ChatActivityEnterView chatActivityEnterView22 = new ChatActivityEnterView(getParentActivity(), this.contentView, this, true) {
@Override
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
if (getAlpha() != 1.0f) {
return false;
}
return super.onInterceptTouchEvent(motionEvent);
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
if (getAlpha() != 1.0f) {
return false;
}
return super.onTouchEvent(motionEvent);
}
@Override
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
if (getAlpha() != 1.0f) {
return false;
}
return super.dispatchTouchEvent(motionEvent);
}
};
this.chatActivityEnterView = chatActivityEnterView22;
chatActivityEnterView22.setDelegate(new ChatActivityEnterView.ChatActivityEnterViewDelegate() {
@Override
public void onMessageSend(CharSequence charSequence3, boolean z22, int i42) {
if (!ChatActivity.this.inScheduleMode) {
ChatActivity.this.moveScrollToLastMessage();
}
if (ChatActivity.this.mentionsAdapter != null) {
ChatActivity.this.mentionsAdapter.addHashtagsFromMessage(charSequence3);
}
if (i42 != 0) {
if (ChatActivity.this.scheduledMessagesCount == -1) {
ChatActivity.this.scheduledMessagesCount = 0;
}
if (charSequence3 != null) {
ChatActivity.access$17708(ChatActivity.this);
}
if (ChatActivity.this.forwardingMessages != null && !ChatActivity.this.forwardingMessages.isEmpty()) {
ChatActivity.this.scheduledMessagesCount += ChatActivity.this.forwardingMessages.size();
}
ChatActivity.this.updateScheduledInterface(false);
}
ChatActivity.this.hideFieldPanel(z22, i42, false);
}
@Override
public void onSwitchRecordMode(boolean z22) {
ChatActivity.this.showVoiceHint(false, z22);
}
@Override
public void onPreAudioVideoRecord() {
ChatActivity.this.showVoiceHint(true, false);
}
@Override
public void onUpdateSlowModeButton(View view42, boolean z22, CharSequence charSequence3) {
ChatActivity.this.showSlowModeHint(view42, z22, charSequence3);
}
@Override
public void onTextSelectionChanged(int i42, int i52) {
if (ChatActivity.this.editTextItem == null) {
return;
}
if (i52 - i42 > 0) {
if (ChatActivity.this.editTextItem.getTag() == null) {
ChatActivity.this.editTextItem.setTag(1);
ChatActivity.this.editTextItem.setVisibility(0);
ChatActivity.this.headerItem.setVisibility(8);
ChatActivity.this.attachItem.setVisibility(8);
}
ChatActivity.this.editTextStart = i42;
ChatActivity.this.editTextEnd = i52;
} else if (ChatActivity.this.editTextItem.getTag() != null) {
ChatActivity.this.editTextItem.setTag(null);
ChatActivity.this.editTextItem.setVisibility(8);
if (ChatActivity.this.chatActivityEnterView.hasText()) {
ChatActivity.this.headerItem.setVisibility(8);
ChatActivity.this.attachItem.setVisibility(0);
return;
}
ChatActivity.this.headerItem.setVisibility(0);
ChatActivity.this.attachItem.setVisibility(8);
}
}
@Override
public void onTextChanged(final CharSequence charSequence3, boolean z22) {
MediaController.getInstance().setInputFieldHasText(!TextUtils.isEmpty(charSequence3) || ChatActivity.this.chatActivityEnterView.isEditingMessage());
if (ChatActivity.this.stickersAdapter != null && ChatActivity.this.chatActivityEnterView != null && ChatActivity.this.chatActivityEnterView.getVisibility() == 0 && (ChatActivity.this.bottomOverlay == null || ChatActivity.this.bottomOverlay.getVisibility() != 0)) {
ChatActivity.this.stickersAdapter.loadStikersForEmoji(charSequence3, !(ChatActivity.this.currentChat == null || ChatObject.canSendStickers(ChatActivity.this.currentChat)) || ChatActivity.this.chatActivityEnterView.isEditingMessage());
}
if (ChatActivity.this.mentionsAdapter != null) {
ChatActivity.this.mentionsAdapter.searchUsernameOrHashtag(charSequence3.toString(), ChatActivity.this.chatActivityEnterView.getCursorPosition(), ChatActivity.this.messages, false);
}
if (ChatActivity.this.waitingForCharaterEnterRunnable != null) {
AndroidUtilities.cancelRunOnUIThread(ChatActivity.this.waitingForCharaterEnterRunnable);
ChatActivity.this.waitingForCharaterEnterRunnable = null;
}
if ((ChatActivity.this.currentChat == null || ChatObject.canSendEmbed(ChatActivity.this.currentChat)) && ChatActivity.this.chatActivityEnterView.isMessageWebPageSearchEnabled()) {
if (ChatActivity.this.chatActivityEnterView.isEditingMessage() && ChatActivity.this.chatActivityEnterView.isEditingCaption()) {
return;
}
if (z22) {
ChatActivity.this.searchLinks(charSequence3, true);
return;
}
ChatActivity.this.waitingForCharaterEnterRunnable = new Runnable() {
@Override
public void run() {
if (this == ChatActivity.this.waitingForCharaterEnterRunnable) {
ChatActivity.this.searchLinks(charSequence3, false);
ChatActivity.this.waitingForCharaterEnterRunnable = null;
}
}
};
AndroidUtilities.runOnUIThread(ChatActivity.this.waitingForCharaterEnterRunnable, AndroidUtilities.WEB_URL == null ? 3000L : 1000L);
}
}
@Override
public void onTextSpansChanged(CharSequence charSequence3) {
ChatActivity.this.searchLinks(charSequence3, true);
}
@Override
public void needSendTyping() {
ChatActivity.this.getMessagesController().sendTyping(ChatActivity.this.dialog_id, 0, ChatActivity.this.classGuid);
}
@Override
public void onAttachButtonHidden() {
if (ChatActivity.this.actionBar.isSearchFieldVisible()) {
return;
}
if (ChatActivity.this.headerItem != null) {
ChatActivity.this.headerItem.setVisibility(8);
}
if (ChatActivity.this.editTextItem != null) {
ChatActivity.this.editTextItem.setVisibility(8);
}
if (ChatActivity.this.attachItem != null) {
ChatActivity.this.attachItem.setVisibility(0);
}
}
@Override
public void onAttachButtonShow() {
if (ChatActivity.this.actionBar.isSearchFieldVisible()) {
return;
}
if (ChatActivity.this.headerItem != null) {
ChatActivity.this.headerItem.setVisibility(0);
}
if (ChatActivity.this.editTextItem != null) {
ChatActivity.this.editTextItem.setVisibility(8);
}
if (ChatActivity.this.attachItem != null) {
ChatActivity.this.attachItem.setVisibility(8);
}
}
@Override
public void onMessageEditEnd(boolean z22) {
if (z22) {
return;
}
ChatActivity.this.mentionsAdapter.setNeedBotContext(ChatActivity.this.currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(ChatActivity.this.currentEncryptedChat.layer) >= 46);
if (ChatActivity.this.editingMessageObject != null) {
ChatActivity.this.hideFieldPanel(false);
}
ChatActivity.this.chatActivityEnterView.setAllowStickersAndGifs(ChatActivity.this.currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(ChatActivity.this.currentEncryptedChat.layer) >= 23, ChatActivity.this.currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(ChatActivity.this.currentEncryptedChat.layer) >= 46);
if (ChatActivity.this.editingMessageObjectReqId != 0) {
ChatActivity.this.getConnectionsManager().cancelRequest(ChatActivity.this.editingMessageObjectReqId, true);
ChatActivity.this.editingMessageObjectReqId = 0;
}
ChatActivity.this.updatePinnedMessageView(true);
ChatActivity.this.updateBottomOverlay();
ChatActivity.this.updateVisibleRows();
}
@Override
public void onWindowSizeChanged(int i42) {
if (i42 < AndroidUtilities.dp(72.0f) + ActionBar.getCurrentActionBarHeight()) {
ChatActivity.this.allowStickersPanel = false;
if (ChatActivity.this.stickersPanel.getVisibility() == 0) {
ChatActivity.this.stickersPanel.setVisibility(4);
}
if (ChatActivity.this.mentionContainer != null && ChatActivity.this.mentionContainer.getVisibility() == 0) {
ChatActivity.this.mentionContainer.setVisibility(4);
ChatActivity.this.updateMessageListAccessibilityVisibility();
}
} else {
ChatActivity.this.allowStickersPanel = true;
if (ChatActivity.this.stickersPanel.getVisibility() == 4) {
ChatActivity.this.stickersPanel.setVisibility(0);
}
if (ChatActivity.this.mentionContainer != null && ChatActivity.this.mentionContainer.getVisibility() == 4 && (!ChatActivity.this.mentionsAdapter.isBotContext() || ChatActivity.this.allowContextBotPanel || ChatActivity.this.allowContextBotPanelSecond)) {
ChatActivity.this.mentionContainer.setVisibility(0);
ChatActivity.this.mentionContainer.setTag(null);
ChatActivity.this.updateMessageListAccessibilityVisibility();
}
}
ChatActivity chatActivity = ChatActivity.this;
chatActivity.allowContextBotPanel = !chatActivity.chatActivityEnterView.isPopupShowing();
ChatActivity.this.checkContextBotPanel();
}
@Override
public void onStickersTab(boolean z22) {
if (ChatActivity.this.emojiButtonRed != null) {
ChatActivity.this.emojiButtonRed.setVisibility(8);
}
ChatActivity.this.allowContextBotPanelSecond = !z22;
ChatActivity.this.checkContextBotPanel();
}
@Override
public void didPressedAttachButton(int i42, ChatEnterMenuType chatEnterMenuType) {
if (i42 == 100) {
return;
}
int i52 = 1012;
if (ChatActivity.this.currentUser != null) {
if (chatEnterMenuType != ChatEnterMenuType.ALBUM) {
if (chatEnterMenuType == ChatEnterMenuType.CAMERA) {
if (SharedConfig.inappCamera) {
ChatActivity.this.openCameraView();
return;
}
} else {
if (chatEnterMenuType != ChatEnterMenuType.DOCUMENT) {
if (chatEnterMenuType != ChatEnterMenuType.LOCATION) {
if (chatEnterMenuType != ChatEnterMenuType.CONTACTS) {
if (chatEnterMenuType != ChatEnterMenuType.MUSIC) {
if (chatEnterMenuType == ChatEnterMenuType.TRANSFER) {
ChatActivity.this.getAccountInfo(false);
return;
} else if (chatEnterMenuType == ChatEnterMenuType.REDPACKET) {
ChatActivity.this.getAccountInfo(true);
return;
} else if (chatEnterMenuType == ChatEnterMenuType.FAVORITE) {
ToastUtils.show((CharSequence) "devoping....");
return;
} else if (i42 != 7) {
if (chatEnterMenuType != ChatEnterMenuType.VOICECALL) {
if (chatEnterMenuType != ChatEnterMenuType.VIDEOCALL) {
}
i52 = 1011;
}
i52 = 1010;
}
}
i52 = 3;
}
i52 = 5;
}
i52 = 6;
}
i52 = 4;
}
i52 = 0;
}
i52 = 1;
} else {
if (chatEnterMenuType != ChatEnterMenuType.ALBUM) {
if (chatEnterMenuType != ChatEnterMenuType.CAMERA) {
if (chatEnterMenuType != ChatEnterMenuType.DOCUMENT) {
if (chatEnterMenuType != ChatEnterMenuType.LOCATION) {
if (chatEnterMenuType != ChatEnterMenuType.CONTACTS) {
if (chatEnterMenuType == ChatEnterMenuType.POLL) {
i52 = 9;
} else {
if (chatEnterMenuType != ChatEnterMenuType.MUSIC) {
if (chatEnterMenuType == ChatEnterMenuType.REDPACKET) {
ChatActivity.this.getAccountInfo(true);
return;
} else if (chatEnterMenuType == ChatEnterMenuType.FAVORITE) {
ToastUtils.show((CharSequence) "devoping....");
return;
} else {
if (chatEnterMenuType != ChatEnterMenuType.VOICECALL) {
if (chatEnterMenuType != ChatEnterMenuType.VIDEOCALL) {
}
i52 = 1011;
}
i52 = 1010;
}
}
i52 = 3;
}
}
i52 = 5;
}
i52 = 6;
}
i52 = 4;
}
i52 = 0;
}
i52 = 1;
}
ChatActivity.this.processSelectedAttach(i52);
}
@Override
public void needStartRecordVideo(int i42, boolean z22, int i52) {
if (ChatActivity.this.instantCameraView != null) {
if (i42 == 0) {
ChatActivity.this.instantCameraView.showCamera();
} else if (i42 == 1 || i42 == 3 || i42 == 4) {
ChatActivity.this.instantCameraView.send(i42, z22, i52);
} else if (i42 == 2) {
ChatActivity.this.instantCameraView.cancel();
}
}
}
@Override
public void needChangeVideoPreviewState(int i42, float f) {
if (ChatActivity.this.instantCameraView != null) {
ChatActivity.this.instantCameraView.changeVideoPreviewState(i42, f);
}
}
@Override
public void needStartRecordAudio(int i42) {
int i52 = i42 == 0 ? 8 : 0;
if (ChatActivity.this.overlayView.getVisibility() != i52) {
ChatActivity.this.overlayView.setVisibility(i52);
}
}
@Override
public void needShowMediaBanHint() {
ChatActivity.this.showMediaBannedHint();
}
@Override
public void onStickersExpandedChange() {
ChatActivity.this.checkRaiseSensors();
}
@Override
public void scrollToSendingMessage() {
int sendingMessageId = ChatActivity.this.getSendMessagesHelper().getSendingMessageId(ChatActivity.this.dialog_id);
if (sendingMessageId != 0) {
ChatActivity.this.scrollToMessageId(sendingMessageId, 0, true, 0, false);
}
}
@Override
public boolean hasScheduledMessages() {
return ChatActivity.this.scheduledMessagesCount > 0 && !ChatActivity.this.inScheduleMode;
}
@Override
public void openScheduledMessages() {
ChatActivity.this.openScheduledMessages();
}
});
this.chatActivityEnterView.setDialogId(this.dialog_id, this.currentAccount);
chatFull = this.chatInfo;
if (chatFull != null) {
}
this.chatActivityEnterView.setId(1000);
this.chatActivityEnterView.setBotsCount(this.botsCount, this.hasBotsCommands);
this.chatActivityEnterView.setMinimumHeight(AndroidUtilities.dp(51.0f));
ChatActivityEnterView chatActivityEnterView32 = this.chatActivityEnterView;
TLRPC.EncryptedChat encryptedChat32 = this.currentEncryptedChat;
if (encryptedChat32 != null) {
}
TLRPC.EncryptedChat encryptedChat42 = this.currentEncryptedChat;
chatActivityEnterView32.setAllowStickersAndGifs(z2, encryptedChat42 != null || AndroidUtilities.getPeerLayerVersion(encryptedChat42.layer) >= 46);
if (this.inPreviewMode) {
}
SizeNotifierFrameLayout sizeNotifierFrameLayout32 = this.contentView;
sizeNotifierFrameLayout32.addView(this.chatActivityEnterView, sizeNotifierFrameLayout32.getChildCount() - 1, LayoutHelper.createFrame(-1, -2, 83));
FrameLayout frameLayout112 = new FrameLayout(context) {
@Override
public boolean hasOverlappingRendering() {
return false;
}
@Override
public void setTranslationY(float f) {
super.setTranslationY(f);
if (ChatActivity.this.chatActivityEnterView != null) {
ChatActivity.this.chatActivityEnterView.invalidate();
}
if (getVisibility() != 8) {
if (ChatActivity.this.chatListView != null) {
ChatActivity.this.chatListView.setTranslationY(f);
}
if (ChatActivity.this.progressView != null) {
ChatActivity.this.progressView.setTranslationY(f);
}
if (ChatActivity.this.mentionContainer != null) {
ChatActivity.this.mentionContainer.setTranslationY(f);
}
if (ChatActivity.this.pagedownButton != null) {
ChatActivity.this.pagedownButton.setTranslationY(f);
}
if (ChatActivity.this.mentiondownButton != null) {
FrameLayout frameLayout122 = ChatActivity.this.mentiondownButton;
if (ChatActivity.this.pagedownButton.getVisibility() == 0) {
f -= AndroidUtilities.dp(72.0f);
}
frameLayout122.setTranslationY(f);
}
ChatActivity.this.updateMessagesVisiblePart(false);
if (ChatActivity.this.fragmentView != null) {
ChatActivity.this.fragmentView.invalidate();
}
}
}
@Override
public void setVisibility(int i42) {
int i52;
super.setVisibility(i42);
if (i42 == 8) {
if (ChatActivity.this.chatListView != null) {
ChatActivity.this.chatListView.setTranslationY(0.0f);
}
if (ChatActivity.this.progressView != null) {
ChatActivity.this.progressView.setTranslationY(0.0f);
}
if (ChatActivity.this.mentionContainer != null) {
ChatActivity.this.mentionContainer.setTranslationY(0.0f);
}
if (ChatActivity.this.pagedownButton != null) {
ChatActivity.this.pagedownButton.setTranslationY(ChatActivity.this.pagedownButton.getTag() == null ? AndroidUtilities.dp(100.0f) : 0.0f);
}
if (ChatActivity.this.mentiondownButton != null) {
FrameLayout frameLayout122 = ChatActivity.this.mentiondownButton;
if (ChatActivity.this.mentiondownButton.getTag() == null) {
i52 = AndroidUtilities.dp(100.0f);
} else {
i52 = ChatActivity.this.pagedownButton.getVisibility() == 0 ? -AndroidUtilities.dp(72.0f) : 0;
}
frameLayout122.setTranslationY(i52);
}
}
}
};
View view42 = new View(context);
this.replyLineView = view42;
view42.setBackgroundColor(Theme.getColor(Theme.key_chat_replyPanelLine));
this.chatActivityEnterView.addTopView(frameLayout112, this.replyLineView, 48);
frameLayout112.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view52) {
ChatActivity.this.lambda$createView$26$ChatActivity(view52);
}
});
ImageView imageView62 = new ImageView(context);
this.replyIconImageView = imageView62;
imageView62.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_replyPanelIcons), PorterDuff.Mode.MULTIPLY));
this.replyIconImageView.setScaleType(ImageView.ScaleType.CENTER);
frameLayout112.addView(this.replyIconImageView, LayoutHelper.createFrame(52, 46, 51));
ImageView imageView72 = new ImageView(context);
this.replyCloseImageView = imageView72;
imageView72.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_replyPanelClose), PorterDuff.Mode.MULTIPLY));
this.replyCloseImageView.setImageResource(R.drawable.input_clear);
this.replyCloseImageView.setScaleType(ImageView.ScaleType.CENTER);
frameLayout112.addView(this.replyCloseImageView, LayoutHelper.createFrame(52.0f, 46.0f, 53, 0.0f, 0.5f, 0.0f, 0.0f));
this.replyCloseImageView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view52) {
ChatActivity.this.lambda$createView$27$ChatActivity(view52);
}
});
SimpleTextView simpleTextView52 = new SimpleTextView(context);
this.replyNameTextView = simpleTextView52;
simpleTextView52.setTextSize(14);
this.replyNameTextView.setTextColor(Theme.getColor(Theme.key_chat_replyPanelName));
this.replyNameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
frameLayout112.addView(this.replyNameTextView, LayoutHelper.createFrame(-1.0f, 18.0f, 51, 52.0f, 6.0f, 52.0f, 0.0f));
SimpleTextView simpleTextView62 = new SimpleTextView(context);
this.replyObjectTextView = simpleTextView62;
simpleTextView62.setTextSize(14);
this.replyObjectTextView.setTextColor(Theme.getColor(Theme.key_chat_replyPanelMessage));
frameLayout112.addView(this.replyObjectTextView, LayoutHelper.createFrame(-1.0f, 18.0f, 51, 52.0f, 24.0f, 52.0f, 0.0f));
BackupImageView backupImageView22 = new BackupImageView(context);
this.replyImageView = backupImageView22;
frameLayout112.addView(backupImageView22, LayoutHelper.createFrame(34.0f, 34.0f, 51, 52.0f, 6.0f, 0.0f, 0.0f));
FrameLayout frameLayout122 = new FrameLayout(context);
this.stickersPanel = frameLayout122;
frameLayout122.setVisibility(8);
this.contentView.addView(this.stickersPanel, LayoutHelper.createFrame(-2.0f, 81.5f, 83, 0.0f, 0.0f, 0.0f, 38.0f));
final ContentPreviewViewer.ContentPreviewViewerDelegate contentPreviewViewerDelegate2 = new ContentPreviewViewer.ContentPreviewViewerDelegate() {
@Override
public void gifAddedOrDeleted() {
ContentPreviewViewer.ContentPreviewViewerDelegate.CC.$default$gifAddedOrDeleted(this);
}
@Override
public boolean needOpen() {
return ContentPreviewViewer.ContentPreviewViewerDelegate.CC.$default$needOpen(this);
}
@Override
public boolean needSend() {
return false;
}
@Override
public void sendGif(Object obj, boolean z3, int i42) {
ContentPreviewViewer.ContentPreviewViewerDelegate.CC.$default$sendGif(this, obj, z3, i42);
}
@Override
public void sendSticker(TLRPC.Document document, Object obj, boolean z3, int i42) {
ChatActivity.this.chatActivityEnterView.lambda$onStickerSelected$28$ChatActivityEnterView(document, obj, true, z3, i42);
}
@Override
public boolean canSchedule() {
return ChatActivity.this.canScheduleMessage();
}
@Override
public boolean isInScheduleMode() {
return ChatActivity.this.inScheduleMode;
}
@Override
public void openSet(TLRPC.InputStickerSet inputStickerSet, boolean z3) {
if (inputStickerSet == null || ChatActivity.this.getParentActivity() == null) {
return;
}
TLRPC.TL_inputStickerSetID tL_inputStickerSetID = new TLRPC.TL_inputStickerSetID();
tL_inputStickerSetID.access_hash = inputStickerSet.access_hash;
tL_inputStickerSetID.id = inputStickerSet.id;
FragmentActivity parentActivity = ChatActivity.this.getParentActivity();
ChatActivity chatActivity = ChatActivity.this;
StickersAlert stickersAlert = new StickersAlert(parentActivity, chatActivity, tL_inputStickerSetID, null, chatActivity.chatActivityEnterView);
stickersAlert.setClearsInputField(z3);
ChatActivity.this.showDialog(stickersAlert);
}
};
RecyclerListView recyclerListView52 = new RecyclerListView(context) {
@Override
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
return super.onInterceptTouchEvent(motionEvent) || ContentPreviewViewer.getInstance().onInterceptTouchEvent(motionEvent, ChatActivity.this.stickersListView, 0, contentPreviewViewerDelegate2);
}
};
this.stickersListView = recyclerListView52;
recyclerListView52.setTag(3);
this.stickersListView.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view52, MotionEvent motionEvent) {
return ChatActivity.this.lambda$createView$28$ChatActivity(contentPreviewViewerDelegate2, view52, motionEvent);
}
});
this.stickersListView.setDisallowInterceptTouchEvents(true);
LinearLayoutManager linearLayoutManager22 = new LinearLayoutManager(context);
linearLayoutManager22.setOrientation(0);
this.stickersListView.setLayoutManager(linearLayoutManager22);
this.stickersListView.setClipToPadding(false);
this.stickersListView.setOverScrollMode(2);
this.stickersPanel.addView(this.stickersListView, LayoutHelper.createFrame(-1, 78.0f));
initStickers();
ImageView imageView82 = new ImageView(context);
this.stickersPanelArrow = imageView82;
imageView82.setImageResource(R.drawable.stickers_back_arrow);
this.stickersPanelArrow.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_stickersHintPanel), PorterDuff.Mode.MULTIPLY));
this.stickersPanel.addView(this.stickersPanelArrow, LayoutHelper.createFrame(-2.0f, -2.0f, 83, 53.0f, 0.0f, 53.0f, 0.0f));
FrameLayout frameLayout132 = new FrameLayout(context) {
@Override
public void onDraw(Canvas canvas) {
int intrinsicHeight = Theme.chat_composeShadowDrawable.getIntrinsicHeight();
Theme.chat_composeShadowDrawable.setBounds(0, 0, getMeasuredWidth(), intrinsicHeight);
Theme.chat_composeShadowDrawable.draw(canvas);
canvas.drawRect(0.0f, intrinsicHeight, getMeasuredWidth(), getMeasuredHeight(), Theme.chat_composeBackgroundPaint);
}
};
this.searchContainer = frameLayout132;
frameLayout132.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view52, MotionEvent motionEvent) {
return ChatActivity.lambda$createView$29(view52, motionEvent);
}
});
this.searchContainer.setWillNotDraw(false);
this.searchContainer.setVisibility(4);
this.searchContainer.setFocusable(true);
this.searchContainer.setFocusableInTouchMode(true);
this.searchContainer.setClickable(true);
this.searchContainer.setPadding(0, AndroidUtilities.dp(3.0f), 0, 0);
ImageView imageView92 = new ImageView(context);
this.searchUpButton = imageView92;
imageView92.setScaleType(ImageView.ScaleType.CENTER);
this.searchUpButton.setImageResource(R.drawable.msg_go_up);
this.searchUpButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_searchPanelIcons), PorterDuff.Mode.MULTIPLY));
this.searchUpButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), 1));
this.searchContainer.addView(this.searchUpButton, LayoutHelper.createFrame(48.0f, 48.0f, 53, 0.0f, 0.0f, 48.0f, 0.0f));
this.searchUpButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view52) {
ChatActivity.this.lambda$createView$30$ChatActivity(view52);
}
});
this.searchUpButton.setContentDescription(LocaleController.getString("AccDescrSearchNext", R.string.AccDescrSearchNext));
ImageView imageView102 = new ImageView(context);
this.searchDownButton = imageView102;
imageView102.setScaleType(ImageView.ScaleType.CENTER);
this.searchDownButton.setImageResource(R.drawable.msg_go_down);
this.searchDownButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_searchPanelIcons), PorterDuff.Mode.MULTIPLY));
this.searchDownButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), 1));
this.searchContainer.addView(this.searchDownButton, LayoutHelper.createFrame(48.0f, 48.0f, 53, 0.0f, 0.0f, 0.0f, 0.0f));
this.searchDownButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view52) {
ChatActivity.this.lambda$createView$31$ChatActivity(view52);
}
});
this.searchDownButton.setContentDescription(LocaleController.getString("AccDescrSearchPrev", R.string.AccDescrSearchPrev));
chat = this.currentChat;
if (chat != null) {
ImageView imageView112 = new ImageView(context);
this.searchUserButton = imageView112;
imageView112.setScaleType(ImageView.ScaleType.CENTER);
this.searchUserButton.setImageResource(R.drawable.msg_usersearch);
this.searchUserButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_searchPanelIcons), PorterDuff.Mode.MULTIPLY));
this.searchUserButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), 1));
this.searchContainer.addView(this.searchUserButton, LayoutHelper.createFrame(48.0f, 48.0f, 51, 48.0f, 0.0f, 0.0f, 0.0f));
this.searchUserButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view52) {
ChatActivity.this.lambda$createView$32$ChatActivity(view52);
}
});
this.searchUserButton.setContentDescription(LocaleController.getString("AccDescrSearchByUser", R.string.AccDescrSearchByUser));
}
ImageView imageView122 = new ImageView(context);
this.searchCalendarButton = imageView122;
imageView122.setScaleType(ImageView.ScaleType.CENTER);
this.searchCalendarButton.setImageResource(R.drawable.msg_calendar);
this.searchCalendarButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_searchPanelIcons), PorterDuff.Mode.MULTIPLY));
this.searchCalendarButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), 1));
this.searchContainer.addView(this.searchCalendarButton, LayoutHelper.createFrame(48, 48, 51));
this.searchCalendarButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view52) {
ChatActivity.this.lambda$createView$36$ChatActivity(view52);
}
});
this.searchCalendarButton.setContentDescription(LocaleController.getString("JumpToDate", R.string.JumpToDate));
SimpleTextView simpleTextView72 = new SimpleTextView(context);
this.searchCountText = simpleTextView72;
simpleTextView72.setTextColor(Theme.getColor(Theme.key_chat_searchPanelText));
this.searchCountText.setTextSize(15);
this.searchCountText.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.searchCountText.setGravity(5);
this.searchContainer.addView(this.searchCountText, LayoutHelper.createFrame(-2.0f, -2.0f, 21, 0.0f, 0.0f, 108.0f, 0.0f));
FrameLayout frameLayout142 = new FrameLayout(context) {
@Override
public void onDraw(Canvas canvas) {
int intrinsicHeight = Theme.chat_composeShadowDrawable.getIntrinsicHeight();
Theme.chat_composeShadowDrawable.setBounds(0, 0, getMeasuredWidth(), intrinsicHeight);
Theme.chat_composeShadowDrawable.draw(canvas);
canvas.drawRect(0.0f, intrinsicHeight, getMeasuredWidth(), getMeasuredHeight(), Theme.chat_composeBackgroundPaint);
}
};
this.bottomOverlay = frameLayout142;
frameLayout142.setWillNotDraw(false);
this.bottomOverlay.setVisibility(4);
this.bottomOverlay.setFocusable(true);
this.bottomOverlay.setFocusableInTouchMode(true);
this.bottomOverlay.setClickable(true);
this.bottomOverlay.setPadding(0, AndroidUtilities.dp(2.0f), 0, 0);
this.contentView.addView(this.bottomOverlay, LayoutHelper.createFrame(-1, 51, 80));
TextView textView92 = new TextView(context);
this.bottomOverlayText = textView92;
textView92.setTextSize(1, 14.0f);
this.bottomOverlayText.setGravity(17);
this.bottomOverlayText.setMaxLines(2);
this.bottomOverlayText.setEllipsize(TextUtils.TruncateAt.END);
this.bottomOverlayText.setLineSpacing(AndroidUtilities.dp(2.0f), 1.0f);
this.bottomOverlayText.setTextColor(Theme.getColor(Theme.key_chat_secretChatStatusText));
this.bottomOverlay.addView(this.bottomOverlayText, LayoutHelper.createFrame(-2.0f, -2.0f, 17, 14.0f, 0.0f, 14.0f, 0.0f));
FrameLayout frameLayout152 = new FrameLayout(context) {
@Override
protected void onMeasure(int i42, int i52) {
int size = View.MeasureSpec.getSize(i42);
if (ChatActivity.this.bottomOverlayChatText.getVisibility() == 0 && ChatActivity.this.bottomOverlayChatText2.getVisibility() == 0) {
int i6 = size / 2;
((FrameLayout.LayoutParams) ChatActivity.this.bottomOverlayChatText.getLayoutParams()).width = i6;
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) ChatActivity.this.bottomOverlayChatText2.getLayoutParams();
layoutParams.width = i6;
layoutParams.leftMargin = i6;
} else {
((FrameLayout.LayoutParams) ChatActivity.this.bottomOverlayChatText.getLayoutParams()).width = size;
}
super.onMeasure(i42, i52);
}
@Override
public void onDraw(Canvas canvas) {
int intrinsicHeight = Theme.chat_composeShadowDrawable.getIntrinsicHeight();
Theme.chat_composeShadowDrawable.setBounds(0, 0, getMeasuredWidth(), intrinsicHeight);
Theme.chat_composeShadowDrawable.draw(canvas);
canvas.drawRect(0.0f, intrinsicHeight, getMeasuredWidth(), getMeasuredHeight(), Theme.chat_composeBackgroundPaint);
}
};
this.bottomOverlayChat = frameLayout152;
frameLayout152.setWillNotDraw(false);
this.bottomOverlayChat.setPadding(0, AndroidUtilities.dp(3.0f), 0, 0);
this.bottomOverlayChat.setVisibility(4);
this.contentView.addView(this.bottomOverlayChat, LayoutHelper.createFrame(-1, 51, 80));
TextView textView102 = new TextView(context);
this.bottomOverlayChatText = textView102;
textView102.setTextSize(1, 15.0f);
this.bottomOverlayChatText.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.bottomOverlayChatText.setTextColor(Theme.getColor(Theme.key_chat_fieldOverlayText));
this.bottomOverlayChatText.setGravity(17);
this.bottomOverlayChat.addView(this.bottomOverlayChatText, LayoutHelper.createFrame(-1, -1.0f));
this.bottomOverlayChatText.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view52) {
ChatActivity.this.lambda$createView$39$ChatActivity(view52);
}
});
UnreadCounterTextView unreadCounterTextView2 = new UnreadCounterTextView(context);
this.bottomOverlayChatText2 = unreadCounterTextView2;
unreadCounterTextView2.setTextSize(1, 15.0f);
this.bottomOverlayChatText2.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
this.bottomOverlayChatText2.setTextColor(Theme.getColor(Theme.key_chat_fieldOverlayText));
this.bottomOverlayChatText2.setGravity(17);
this.bottomOverlayChatText2.setVisibility(8);
this.bottomOverlayChat.addView(this.bottomOverlayChatText2, LayoutHelper.createFrame(-1, -1.0f));
this.bottomOverlayChatText2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view52) {
ChatActivity.this.lambda$createView$40$ChatActivity(view52);
}
});
RadialProgressView radialProgressView22 = new RadialProgressView(context);
this.bottomOverlayProgress = radialProgressView22;
radialProgressView22.setSize(AndroidUtilities.dp(22.0f));
this.bottomOverlayProgress.setProgressColor(Theme.getColor(Theme.key_chat_fieldOverlayText));
this.bottomOverlayProgress.setVisibility(4);
this.bottomOverlayProgress.setScaleX(0.1f);
this.bottomOverlayProgress.setScaleY(0.1f);
this.bottomOverlayProgress.setAlpha(1.0f);
this.bottomOverlayChat.addView(this.bottomOverlayProgress, LayoutHelper.createFrame(30, 30, 17));
TextView textView112 = new TextView(context);
this.replyButton = textView112;
textView112.setText(LocaleController.getString("Reply", R.string.Reply));
this.replyButton.setGravity(16);
this.replyButton.setTextSize(1, 15.0f);
this.replyButton.setPadding(AndroidUtilities.dp(14.0f), 0, AndroidUtilities.dp(21.0f), 0);
this.replyButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), 3));
this.replyButton.setTextColor(Theme.getColor(Theme.key_actionBarActionModeDefaultIcon));
this.replyButton.setCompoundDrawablePadding(AndroidUtilities.dp(7.0f));
this.replyButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
Drawable mutate32 = context.getResources().getDrawable(R.drawable.input_reply).mutate();
mutate32.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarActionModeDefaultIcon), PorterDuff.Mode.MULTIPLY));
this.replyButton.setCompoundDrawablesWithIntrinsicBounds(mutate32, (Drawable) null, (Drawable) null, (Drawable) null);
this.replyButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view52) {
ChatActivity.this.lambda$createView$41$ChatActivity(view52);
}
});
this.bottomMessagesActionContainer.addView(this.replyButton, LayoutHelper.createFrame(-2, -1, 51));
TextView textView122 = new TextView(context);
this.forwardButton = textView122;
textView122.setText(LocaleController.getString("Forward", R.string.Forward));
this.forwardButton.setGravity(16);
this.forwardButton.setTextSize(1, 15.0f);
this.forwardButton.setPadding(AndroidUtilities.dp(21.0f), 0, AndroidUtilities.dp(21.0f), 0);
this.forwardButton.setCompoundDrawablePadding(AndroidUtilities.dp(6.0f));
this.forwardButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), 3));
this.forwardButton.setTextColor(Theme.getColor(Theme.key_actionBarActionModeDefaultIcon));
this.forwardButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
Drawable mutate42 = context.getResources().getDrawable(R.drawable.input_forward).mutate();
mutate42.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarActionModeDefaultIcon), PorterDuff.Mode.MULTIPLY));
this.forwardButton.setCompoundDrawablesWithIntrinsicBounds(mutate42, (Drawable) null, (Drawable) null, (Drawable) null);
this.forwardButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view52) {
ChatActivity.this.lambda$createView$42$ChatActivity(view52);
}
});
this.bottomMessagesActionContainer.addView(this.forwardButton, LayoutHelper.createFrame(-2, -1, 53));
this.contentView.addView(this.searchContainer, LayoutHelper.createFrame(-1, 51, 80));
UndoView undoView2 = new UndoView(context);
this.undoView = undoView2;
this.contentView.addView(undoView2, LayoutHelper.createFrame(-1.0f, -2.0f, 83, 8.0f, 0.0f, 8.0f, 8.0f));
if (this.currentChat != null) {
}
this.chatAdapter.updateRows();
if (this.loading) {
}
z = false;
listViewShowEmptyView(false, false);
checkBotKeyboard();
updateBottomOverlay();
updateSecretStatus();
updateTopPanel(z);
updatePinnedMessageView(true);
if (this.currentEncryptedChat != null) {
MediaController.getInstance().setFlagSecure(this, true);
}
if (charSequence2 != null) {
}
fixLayoutInternal();
if (isSysNotifyMessage().booleanValue()) {
}
return this.fragmentView;
}
public class AnonymousClass6 extends ActionBar.ActionBarMenuOnItemClick {
AnonymousClass6() {
}
@Override
public void onItemClick(final int i) {
if (i == -1) {
if (ChatActivity.this.actionBar.isActionModeShowed()) {
for (int i2 = 1; i2 >= 0; i2--) {
ChatActivity.this.selectedMessagesIds[i2].clear();
ChatActivity.this.selectedMessagesCanCopyIds[i2].clear();
ChatActivity.this.selectedMessagesCanStarIds[i2].clear();
}
ChatActivity.this.hideActionMode();
ChatActivity.this.updatePinnedMessageView(true);
ChatActivity.this.updateVisibleRows();
return;
}
ChatActivity.this.finishFragment();
} else if (i == 0) {
ChatActivity.this.showOrUpdateActionBarMenuPop();
} else if (i == 10) {
String str = "";
int i3 = 0;
for (int i4 = 1; i4 >= 0; i4--) {
ArrayList arrayList = new ArrayList();
for (int i5 = 0; i5 < ChatActivity.this.selectedMessagesCanCopyIds[i4].size(); i5++) {
arrayList.add(Integer.valueOf(ChatActivity.this.selectedMessagesCanCopyIds[i4].keyAt(i5)));
}
if (ChatActivity.this.currentEncryptedChat == null) {
Collections.sort(arrayList);
} else {
Collections.sort(arrayList, Collections.reverseOrder());
}
for (int i6 = 0; i6 < arrayList.size(); i6++) {
MessageObject messageObject = (MessageObject) ChatActivity.this.selectedMessagesCanCopyIds[i4].get(((Integer) arrayList.get(i6)).intValue());
if (str.length() != 0) {
str = str + "\n\n";
}
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append(ChatActivity.this.getMessageContent(messageObject, i3, arrayList.size() != 1 && (ChatActivity.this.currentUser == null || !ChatActivity.this.currentUser.self)));
str = sb.toString();
i3 = messageObject.messageOwner.from_id;
}
}
if (str.length() != 0) {
AndroidUtilities.addToClipboard(str);
}
for (int i7 = 1; i7 >= 0; i7--) {
ChatActivity.this.selectedMessagesIds[i7].clear();
ChatActivity.this.selectedMessagesCanCopyIds[i7].clear();
ChatActivity.this.selectedMessagesCanStarIds[i7].clear();
}
ChatActivity.this.hideActionMode();
ChatActivity.this.updatePinnedMessageView(true);
ChatActivity.this.updateVisibleRows();
} else {
MessageObject messageObject2 = null;
if (i == 12) {
if (ChatActivity.this.getParentActivity() == null) {
return;
}
ChatActivity.this.createDeleteMessagesAlert(null, null);
} else if (i == 11) {
ChatActivity.this.openForward();
} else if (i == 13) {
if (ChatActivity.this.getParentActivity() == null) {
return;
}
ChatActivity chatActivity = ChatActivity.this;
chatActivity.showDialog(AlertsCreator.createTTLAlert(chatActivity.getParentActivity(), ChatActivity.this.currentEncryptedChat).create());
} else if (i == 15 || i == 16) {
if (ChatActivity.this.getParentActivity() == null) {
return;
}
final boolean z = ((int) ChatActivity.this.dialog_id) < 0 && ((int) (ChatActivity.this.dialog_id >> 32)) != 1;
AlertsCreator.createClearOrDeleteDialogAlert(ChatActivity.this, i == 15, ChatActivity.this.currentChat, ChatActivity.this.currentUser, ChatActivity.this.currentEncryptedChat != null, new MessagesStorage.BooleanCallback() {
@Override
public final void run(boolean z2) {
ChatActivity.AnonymousClass6.this.lambda$onItemClick$2$ChatActivity$6(i, z, z2);
}
});
} else if (i == 17) {
if (ChatActivity.this.currentUser == null || ChatActivity.this.getParentActivity() == null) {
return;
}
if (ChatActivity.this.addToContactsButton.getTag() != null) {
ChatActivity chatActivity2 = ChatActivity.this;
chatActivity2.shareMyContact(((Integer) chatActivity2.addToContactsButton.getTag()).intValue(), null);
} else if (ChatActivity.this.currentUser != null) {
ChatActivity chatActivity3 = ChatActivity.this;
chatActivity3.presentFragment(new AddContactsInfoActivity(null, chatActivity3.currentUser));
}
} else if (i == 18) {
ChatActivity.this.toggleMute(false);
} else if (i == 24) {
try {
ChatActivity.this.getMediaDataController().installShortcut(ChatActivity.this.currentUser.id);
} catch (Exception e) {
FileLog.e(e);
}
} else if (i == 21) {
AlertsCreator.createReportAlert(ChatActivity.this.getParentActivity(), ChatActivity.this.dialog_id, 0, ChatActivity.this);
} else if (i == 22) {
for (int i8 = 0; i8 < 2; i8++) {
for (int i9 = 0; i9 < ChatActivity.this.selectedMessagesCanStarIds[i8].size(); i9++) {
MessageObject messageObject3 = (MessageObject) ChatActivity.this.selectedMessagesCanStarIds[i8].valueAt(i9);
ChatActivity.this.getMediaDataController().addRecentSticker(2, messageObject3, messageObject3.getDocument(), (int) (System.currentTimeMillis() / 1000), !ChatActivity.this.hasUnfavedSelected);
}
}
for (int i10 = 1; i10 >= 0; i10--) {
ChatActivity.this.selectedMessagesIds[i10].clear();
ChatActivity.this.selectedMessagesCanCopyIds[i10].clear();
ChatActivity.this.selectedMessagesCanStarIds[i10].clear();
}
ChatActivity.this.hideActionMode();
ChatActivity.this.updatePinnedMessageView(true);
ChatActivity.this.updateVisibleRows();
} else if (i == 23) {
for (int i11 = 1; i11 >= 0; i11--) {
if (messageObject2 == null && ChatActivity.this.selectedMessagesIds[i11].size() == 1) {
ArrayList arrayList2 = new ArrayList();
for (int i12 = 0; i12 < ChatActivity.this.selectedMessagesIds[i11].size(); i12++) {
arrayList2.add(Integer.valueOf(ChatActivity.this.selectedMessagesIds[i11].keyAt(i12)));
}
messageObject2 = (MessageObject) ChatActivity.this.messagesDict[i11].get(((Integer) arrayList2.get(0)).intValue());
}
ChatActivity.this.selectedMessagesIds[i11].clear();
ChatActivity.this.selectedMessagesCanCopyIds[i11].clear();
ChatActivity.this.selectedMessagesCanStarIds[i11].clear();
}
ChatActivity.this.startEditingMessageObject(messageObject2);
ChatActivity.this.hideActionMode();
ChatActivity.this.updatePinnedMessageView(true);
ChatActivity.this.updateVisibleRows();
} else if (i == 14) {
if (ChatActivity.this.chatAttachAlert != null) {
ChatActivity.this.chatAttachAlert.setEditingMessageObject(null);
}
ChatActivity.this.openAttachMenu();
} else if (i == 30) {
ChatActivity.this.getSendMessagesHelper().sendMessage("/help", ChatActivity.this.dialog_id, null, null, false, null, null, null, true, 0);
} else if (i == 31) {
ChatActivity.this.getSendMessagesHelper().sendMessage("/settings", ChatActivity.this.dialog_id, null, null, false, null, null, null, true, 0);
} else if (i == 40) {
ChatActivity.this.openSearchWithText(null);
} else if (i == 32) {
if (ChatActivity.this.currentUser == null || ChatActivity.this.actionBarHelper == null) {
return;
}
ChatActivity.this.actionBarHelper.startCall(ChatActivity.this.currentUser);
} else if (i == 50) {
if (ChatActivity.this.chatActivityEnterView != null) {
ChatActivity.this.chatActivityEnterView.getEditField().setSelectionOverride(ChatActivity.this.editTextStart, ChatActivity.this.editTextEnd);
ChatActivity.this.chatActivityEnterView.getEditField().makeSelectedBold();
}
} else if (i == 51) {
if (ChatActivity.this.chatActivityEnterView != null) {
ChatActivity.this.chatActivityEnterView.getEditField().setSelectionOverride(ChatActivity.this.editTextStart, ChatActivity.this.editTextEnd);
ChatActivity.this.chatActivityEnterView.getEditField().makeSelectedItalic();
}
} else if (i == 52) {
if (ChatActivity.this.chatActivityEnterView != null) {
ChatActivity.this.chatActivityEnterView.getEditField().setSelectionOverride(ChatActivity.this.editTextStart, ChatActivity.this.editTextEnd);
ChatActivity.this.chatActivityEnterView.getEditField().makeSelectedMono();
}
} else if (i == 55) {
if (ChatActivity.this.chatActivityEnterView != null) {
ChatActivity.this.chatActivityEnterView.getEditField().setSelectionOverride(ChatActivity.this.editTextStart, ChatActivity.this.editTextEnd);
ChatActivity.this.chatActivityEnterView.getEditField().makeSelectedStrike();
}
} else if (i == 56) {
if (ChatActivity.this.chatActivityEnterView != null) {
ChatActivity.this.chatActivityEnterView.getEditField().setSelectionOverride(ChatActivity.this.editTextStart, ChatActivity.this.editTextEnd);
ChatActivity.this.chatActivityEnterView.getEditField().makeSelectedUnderline();
}
} else if (i == 53) {
if (ChatActivity.this.chatActivityEnterView != null) {
ChatActivity.this.chatActivityEnterView.getEditField().setSelectionOverride(ChatActivity.this.editTextStart, ChatActivity.this.editTextEnd);
ChatActivity.this.chatActivityEnterView.getEditField().makeSelectedUrl();
}
} else if (i == 54 && ChatActivity.this.chatActivityEnterView != null) {
ChatActivity.this.chatActivityEnterView.getEditField().setSelectionOverride(ChatActivity.this.editTextStart, ChatActivity.this.editTextEnd);
ChatActivity.this.chatActivityEnterView.getEditField().makeSelectedRegular();
}
}
}
public void lambda$onItemClick$2$ChatActivity$6(final int i, final boolean z, final boolean z2) {
if (i == 15 && ChatObject.isChannel(ChatActivity.this.currentChat) && (!ChatActivity.this.currentChat.megagroup || !TextUtils.isEmpty(ChatActivity.this.currentChat.username))) {
ChatActivity.this.getMessagesController().deleteDialog(ChatActivity.this.dialog_id, 2, z2);
} else if (i == 15) {
ChatActivity.this.clearingHistory = true;
ChatActivity.this.undoView.setAdditionalTranslationY(0.0f);
ChatActivity.this.undoView.showWithAction(ChatActivity.this.dialog_id, i == 15 ? 0 : 1, new Runnable() {
@Override
public final void run() {
ChatActivity.AnonymousClass6.this.lambda$null$0$ChatActivity$6(i, z2, z);
}
}, new Runnable() {
@Override
public final void run() {
ChatActivity.AnonymousClass6.this.lambda$null$1$ChatActivity$6();
}
});
ChatActivity.this.chatAdapter.notifyDataSetChanged();
} else {
ChatActivity.this.getNotificationCenter().removeObserver(ChatActivity.this, NotificationCenter.closeChats);
ChatActivity.this.getNotificationCenter().postNotificationName(NotificationCenter.closeChats, new Object[0]);
ChatActivity.this.finishFragment();
ChatActivity.this.getNotificationCenter().postNotificationName(NotificationCenter.needDeleteDialog, Long.valueOf(ChatActivity.this.dialog_id), ChatActivity.this.currentUser, ChatActivity.this.currentChat, Boolean.valueOf(z2));
}
}
public void lambda$null$0$ChatActivity$6(int i, boolean z, boolean z2) {
if (i == 15) {
if (ChatActivity.this.chatInfo != null && ChatActivity.this.chatInfo.pinned_msg_id != 0) {
SharedPreferences.Editor edit = MessagesController.getNotificationsSettings(ChatActivity.this.currentAccount).edit();
edit.putInt("pin_" + ChatActivity.this.dialog_id, ChatActivity.this.chatInfo.pinned_msg_id).commit();
ChatActivity.this.updatePinnedMessageView(true);
} else if (ChatActivity.this.userInfo != null && ChatActivity.this.userInfo.pinned_msg_id != 0) {
SharedPreferences.Editor edit2 = MessagesController.getNotificationsSettings(ChatActivity.this.currentAccount).edit();
edit2.putInt("pin_" + ChatActivity.this.dialog_id, ChatActivity.this.userInfo.pinned_msg_id).commit();
ChatActivity.this.updatePinnedMessageView(true);
}
ChatActivity.this.getMessagesController().deleteDialog(ChatActivity.this.dialog_id, 1, z);
ChatActivity.this.clearingHistory = false;
ChatActivity.this.clearHistory(false);
ChatActivity.this.chatAdapter.notifyDataSetChanged();
return;
}
if (!z2) {
ChatActivity.this.getMessagesController().deleteDialog(ChatActivity.this.dialog_id, 0, z);
} else if (ChatObject.isNotInChat(ChatActivity.this.currentChat)) {
ChatActivity.this.getMessagesController().deleteDialog(ChatActivity.this.dialog_id, 0, z);
} else {
ChatActivity.this.getMessagesController().deleteUserFromChat((int) (-ChatActivity.this.dialog_id), ChatActivity.this.getMessagesController().getUser(Integer.valueOf(ChatActivity.this.getUserConfig().getClientUserId())), null);
}
ChatActivity.this.finishFragment();
}
public void lambda$null$1$ChatActivity$6() {
ChatActivity.this.clearingHistory = false;
ChatActivity.this.chatAdapter.notifyDataSetChanged();
}
}
public class AnonymousClass7 extends ActionBarMenuItem.ActionBarMenuItemSearchListener {
boolean searchWas;
AnonymousClass7() {
}
@Override
public void onSearchCollapse() {
ChatActivity.this.searchCalendarButton.setVisibility(0);
if (ChatActivity.this.searchUserButton != null) {
ChatActivity.this.searchUserButton.setVisibility(0);
}
if (ChatActivity.this.searchingForUser) {
ChatActivity.this.mentionsAdapter.searchUsernameOrHashtag(null, 0, null, false);
ChatActivity.this.searchingForUser = false;
}
ChatActivity.this.mentionLayoutManager.setReverseLayout(false);
ChatActivity.this.mentionsAdapter.setSearchingMentions(false);
ChatActivity.this.searchingUserMessages = null;
ChatActivity.this.searchItem.setSearchFieldHint(LocaleController.getString("Search", R.string.Search));
ChatActivity.this.searchItem.setSearchFieldCaption(null);
if (ChatActivity.this.editTextItem.getTag() != null) {
if (ChatActivity.this.headerItem != null) {
ChatActivity.this.headerItem.setVisibility(8);
}
if (ChatActivity.this.editTextItem != null) {
ChatActivity.this.editTextItem.setVisibility(0);
}
if (ChatActivity.this.attachItem != null) {
ChatActivity.this.attachItem.setVisibility(8);
}
} else if (ChatActivity.this.chatActivityEnterView.hasText()) {
if (ChatActivity.this.headerItem != null) {
ChatActivity.this.headerItem.setVisibility(8);
}
if (ChatActivity.this.editTextItem != null) {
ChatActivity.this.editTextItem.setVisibility(8);
}
if (ChatActivity.this.attachItem != null) {
ChatActivity.this.attachItem.setVisibility(0);
}
} else {
if (ChatActivity.this.headerItem != null) {
ChatActivity.this.headerItem.setVisibility(0);
}
if (ChatActivity.this.editTextItem != null) {
ChatActivity.this.editTextItem.setVisibility(8);
}
if (ChatActivity.this.attachItem != null) {
ChatActivity.this.attachItem.setVisibility(8);
}
}
ChatActivity.this.searchItem.setVisibility(8);
ChatActivity.this.removeSelectedMessageHighlight();
ChatActivity.this.updateBottomOverlay();
ChatActivity.this.updatePinnedMessageView(true);
ChatActivity.this.updateVisibleRows();
}
@Override
public void onSearchExpand() {
if (ChatActivity.this.openSearchKeyboard) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.AnonymousClass7.this.lambda$onSearchExpand$0$ChatActivity$7();
}
}, 300L);
}
}
public void lambda$onSearchExpand$0$ChatActivity$7() {
this.searchWas = false;
ChatActivity.this.searchItem.getSearchField().requestFocus();
AndroidUtilities.showKeyboard(ChatActivity.this.searchItem.getSearchField());
}
@Override
public void onSearchPressed(EditText editText) {
this.searchWas = true;
ChatActivity.this.updateSearchButtons(0, 0, -1);
ChatActivity.this.getMediaDataController().searchMessagesInChat(editText.getText().toString(), ChatActivity.this.dialog_id, ChatActivity.this.mergeDialogId, ChatActivity.this.classGuid, 0, ChatActivity.this.searchingUserMessages);
}
@Override
public void onTextChanged(EditText editText) {
if (ChatActivity.this.searchingForUser) {
MentionsAdapter mentionsAdapter = ChatActivity.this.mentionsAdapter;
mentionsAdapter.searchUsernameOrHashtag("@" + editText.getText().toString(), 0, ChatActivity.this.messages, true);
} else if (ChatActivity.this.searchingForUser || ChatActivity.this.searchingUserMessages != null || ChatActivity.this.searchUserButton == null || !TextUtils.equals(editText.getText(), LocaleController.getString("SearchFrom", R.string.SearchFrom))) {
} else {
ChatActivity.this.searchUserButton.callOnClick();
}
}
@Override
public void onCaptionCleared() {
if (ChatActivity.this.searchingUserMessages != null) {
ChatActivity.this.searchUserButton.callOnClick();
return;
}
if (ChatActivity.this.searchingForUser) {
ChatActivity.this.mentionsAdapter.searchUsernameOrHashtag(null, 0, null, false);
ChatActivity.this.searchingForUser = false;
ChatActivity.this.searchItem.setSearchFieldText("", true);
}
ChatActivity.this.searchItem.setSearchFieldHint(LocaleController.getString("Search", R.string.Search));
ChatActivity.this.searchCalendarButton.setVisibility(0);
ChatActivity.this.searchUserButton.setVisibility(0);
ChatActivity.this.searchingUserMessages = null;
}
@Override
public boolean forceShowClear() {
return ChatActivity.this.searchingForUser;
}
}
public class AnonymousClass9 extends SizeNotifierFrameLayout {
ArrayList<ChatMessageCell> drawCaptionAfter;
ArrayList<ChatMessageCell> drawNamesAfter;
ArrayList<ChatMessageCell> drawTimeAfter;
int inputFieldHeight;
AnonymousClass9(Context context) {
super(context);
this.inputFieldHeight = 0;
this.drawTimeAfter = new ArrayList<>();
this.drawNamesAfter = new ArrayList<>();
this.drawCaptionAfter = new ArrayList<>();
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
MessageObject playingMessageObject = MediaController.getInstance().getPlayingMessageObject();
if (playingMessageObject != null) {
if ((playingMessageObject.isRoundVideo() || playingMessageObject.isVideo()) && playingMessageObject.eventId == 0 && playingMessageObject.getDialogId() == ChatActivity.this.dialog_id) {
MediaController.getInstance().setTextureView(ChatActivity.this.createTextureView(false), ChatActivity.this.aspectRatioFrameLayout, ChatActivity.this.videoPlayerContainer, true);
}
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
if (ChatActivity.this.scrimView == null) {
if (ChatActivity.this.chatActivityEnterView == null || !ChatActivity.this.chatActivityEnterView.isStickersExpanded() || motionEvent.getY() >= ChatActivity.this.chatActivityEnterView.getY()) {
return super.dispatchTouchEvent(motionEvent);
}
return false;
}
return false;
}
@Override
protected boolean drawChild(Canvas canvas, View view, long j) {
boolean z;
boolean z2;
boolean z3;
int i = 0;
if (ChatActivity.this.scrimView == null || !(view == ChatActivity.this.pagedownButton || view == ChatActivity.this.mentiondownButton || view == ChatActivity.this.floatingDateView)) {
MessageObject playingMessageObject = MediaController.getInstance().getPlayingMessageObject();
if (playingMessageObject == null || playingMessageObject.eventId != 0) {
z = false;
} else {
z = playingMessageObject.isRoundVideo();
if (z || playingMessageObject.isVideo()) {
z2 = true;
if (view != ChatActivity.this.videoPlayerContainer) {
if (playingMessageObject != null && playingMessageObject.type == 5) {
if (Theme.chat_roundVideoShadow != null && ChatActivity.this.aspectRatioFrameLayout.isDrawingReady()) {
int x = ((int) view.getX()) - AndroidUtilities.dp(3.0f);
int y = ((int) view.getY()) - AndroidUtilities.dp(2.0f);
Theme.chat_roundVideoShadow.setAlpha(255);
Theme.chat_roundVideoShadow.setBounds(x, y, AndroidUtilities.roundMessageSize + x + AndroidUtilities.dp(6.0f), AndroidUtilities.roundMessageSize + y + AndroidUtilities.dp(6.0f));
Theme.chat_roundVideoShadow.draw(canvas);
}
z3 = super.drawChild(canvas, view, j);
} else if (view.getTag() == null) {
float translationY = view.getTranslationY();
view.setTranslationY(-AndroidUtilities.dp(1000.0f));
z3 = super.drawChild(canvas, view, j);
view.setTranslationY(translationY);
} else {
z3 = false;
}
} else {
boolean drawChild = super.drawChild(canvas, view, j);
if (z2 && view == ChatActivity.this.chatListView && playingMessageObject.type != 5 && ChatActivity.this.videoPlayerContainer != null && ChatActivity.this.videoPlayerContainer.getTag() != null) {
super.drawChild(canvas, ChatActivity.this.videoPlayerContainer, j);
if (ChatActivity.this.drawLaterRoundProgressCell != null) {
canvas.save();
canvas.translate(ChatActivity.this.drawLaterRoundProgressCell.getX(), ChatActivity.this.drawLaterRoundProgressCell.getTop() + ChatActivity.this.chatListView.getY());
if (z) {
ChatActivity.this.drawLaterRoundProgressCell.drawRoundProgress(canvas);
ChatActivity.this.drawLaterRoundProgressCell.drawOverlays(canvas);
} else {
ChatActivity.this.drawLaterRoundProgressCell.drawOverlays(canvas);
if (ChatActivity.this.drawLaterRoundProgressCell.needDrawTime()) {
ChatActivity.this.drawLaterRoundProgressCell.drawTime(canvas);
}
}
canvas.restore();
}
}
z3 = drawChild;
}
if (view == ChatActivity.this.actionBar && ChatActivity.this.parentLayout != null) {
ActionBarLayout actionBarLayout = ChatActivity.this.parentLayout;
if (ChatActivity.this.actionBar.getVisibility() == 0) {
int measuredHeight = ChatActivity.this.actionBar.getMeasuredHeight();
if (ChatActivity.this.inPreviewMode && Build.VERSION.SDK_INT >= 21) {
i = AndroidUtilities.statusBarHeight;
}
i += measuredHeight;
}
actionBarLayout.drawHeaderShadow(canvas, i);
}
return z3;
}
}
z2 = false;
if (view != ChatActivity.this.videoPlayerContainer) {
}
if (view == ChatActivity.this.actionBar) {
ActionBarLayout actionBarLayout2 = ChatActivity.this.parentLayout;
if (ChatActivity.this.actionBar.getVisibility() == 0) {
}
actionBarLayout2.drawHeaderShadow(canvas, i);
}
return z3;
}
return false;
}
@Override
protected boolean isActionBarVisible() {
return ChatActivity.this.actionBar.getVisibility() == 0;
}
private void drawChildElement(Canvas canvas, float f, ChatMessageCell chatMessageCell, int i) {
canvas.save();
canvas.clipRect(ChatActivity.this.chatListView.getLeft(), f, ChatActivity.this.chatListView.getRight(), ChatActivity.this.chatListView.getY() + ChatActivity.this.chatListView.getMeasuredHeight());
canvas.translate(ChatActivity.this.chatListView.getLeft() + chatMessageCell.getLeft(), ChatActivity.this.chatListView.getY() + chatMessageCell.getTop());
if (i == 0) {
chatMessageCell.drawTime(canvas);
} else {
if (i == 1) {
chatMessageCell.drawNamesLayout(canvas);
} else {
chatMessageCell.drawCaptionLayout(canvas, (chatMessageCell.getCurrentPosition().flags & 1) == 0);
}
}
canvas.restore();
}
@Override
protected void dispatchDraw(Canvas canvas) {
ChatMessageCell chatMessageCell;
MessageObject.GroupedMessages groupedMessages;
MessageObject.GroupedMessagePosition groupedMessagePosition;
int i;
int i2;
float max;
float max2;
float min;
float min2;
super.dispatchDraw(canvas);
if (ChatActivity.this.scrimView != null) {
canvas.drawRect(0.0f, 0.0f, getMeasuredWidth(), getMeasuredHeight(), ChatActivity.this.scrimPaint);
ChatActivity.this.chatListView.getY();
ChatActivity.this.chatListView.getMeasuredHeight();
int top = ((ChatActivity.this.chatListView.getTop() + ChatActivity.this.chatListView.getPaddingTop()) - AndroidUtilities.dp(4.0f)) + (ChatActivity.this.chatActivityEnterView.getMeasuredHeight() - AndroidUtilities.dp(51.0f));
MessageObject.GroupedMessages currentMessagesGroup = ChatActivity.this.scrimView instanceof ChatMessageCell ? ((ChatMessageCell) ChatActivity.this.scrimView).getCurrentMessagesGroup() : null;
int childCount = ChatActivity.this.chatListView.getChildCount();
for (int i3 = 0; i3 < childCount; i3++) {
View childAt = ChatActivity.this.chatListView.getChildAt(i3);
if (childAt instanceof ChatMessageCell) {
chatMessageCell = (ChatMessageCell) childAt;
groupedMessages = chatMessageCell.getCurrentMessagesGroup();
groupedMessagePosition = chatMessageCell.getCurrentPosition();
} else {
chatMessageCell = null;
groupedMessages = null;
groupedMessagePosition = null;
}
if (childAt == ChatActivity.this.scrimView || (currentMessagesGroup != null && currentMessagesGroup == groupedMessages)) {
if (groupedMessagePosition != null) {
if (groupedMessagePosition.pw != groupedMessagePosition.spanSize && groupedMessagePosition.spanSize == 1000 && groupedMessagePosition.siblingHeights == null && groupedMessages.hasSibling) {
i = chatMessageCell.getBackgroundDrawableLeft();
i2 = 0;
if (i != 0) {
}
if (max2 < min2) {
}
if (groupedMessagePosition != null) {
}
} else if (groupedMessagePosition.siblingHeights != null) {
i2 = childAt.getBottom() - AndroidUtilities.dp((chatMessageCell.isPinnedBottom() ? 1 : 0) + 1);
i = 0;
if (i != 0) {
float left = ChatActivity.this.chatListView.getLeft() + i + childAt.getTranslationX();
max = Math.max(ChatActivity.this.chatListView.getLeft(), left);
max2 = Math.max(top, ChatActivity.this.chatListView.getTop() + childAt.getTop());
min = Math.min(ChatActivity.this.chatListView.getRight(), left + childAt.getMeasuredWidth());
min2 = Math.min(ChatActivity.this.chatListView.getY() + ChatActivity.this.chatListView.getMeasuredHeight(), ChatActivity.this.chatListView.getY() + childAt.getTop() + childAt.getMeasuredHeight());
} else if (i2 != 0) {
float left2 = ChatActivity.this.chatListView.getLeft() + childAt.getTranslationX();
max = Math.max(ChatActivity.this.chatListView.getLeft(), left2);
float max3 = Math.max(top, ChatActivity.this.chatListView.getTop() + childAt.getTop());
min = Math.min(ChatActivity.this.chatListView.getRight(), left2 + childAt.getMeasuredWidth());
min2 = Math.min(ChatActivity.this.chatListView.getY() + ChatActivity.this.chatListView.getMeasuredHeight(), ChatActivity.this.chatListView.getY() + i2);
max2 = max3;
} else {
max = Math.max(ChatActivity.this.chatListView.getLeft(), ChatActivity.this.chatListView.getLeft() + childAt.getX());
max2 = Math.max(top, ChatActivity.this.chatListView.getTop() + childAt.getY());
min = Math.min(ChatActivity.this.chatListView.getRight(), ChatActivity.this.chatListView.getLeft() + childAt.getX() + childAt.getMeasuredWidth());
min2 = Math.min(ChatActivity.this.chatListView.getY() + ChatActivity.this.chatListView.getMeasuredHeight(), ChatActivity.this.chatListView.getY() + childAt.getY() + childAt.getMeasuredHeight());
}
if (max2 < min2) {
canvas.save();
canvas.clipRect(max, max2, min, min2);
canvas.translate(ChatActivity.this.chatListView.getLeft() + childAt.getLeft(), ChatActivity.this.chatListView.getY() + childAt.getTop());
childAt.draw(canvas);
canvas.restore();
}
if (groupedMessagePosition != null) {
if (groupedMessagePosition.last || (groupedMessagePosition.minX == 0 && groupedMessagePosition.minY == 0)) {
if (groupedMessagePosition.last) {
this.drawTimeAfter.add(chatMessageCell);
}
if (groupedMessagePosition.minX == 0 && groupedMessagePosition.minY == 0 && chatMessageCell.hasNameLayout()) {
this.drawNamesAfter.add(chatMessageCell);
}
}
if (chatMessageCell.hasCaptionLayout() && (groupedMessagePosition.flags & 8) != 0) {
this.drawCaptionAfter.add(chatMessageCell);
}
}
}
}
i = 0;
i2 = 0;
if (i != 0) {
}
if (max2 < min2) {
}
if (groupedMessagePosition != null) {
}
}
}
int size = this.drawTimeAfter.size();
if (size > 0) {
for (int i4 = 0; i4 < size; i4++) {
drawChildElement(canvas, top, this.drawTimeAfter.get(i4), 0);
}
this.drawTimeAfter.clear();
}
int size2 = this.drawNamesAfter.size();
if (size2 > 0) {
for (int i5 = 0; i5 < size2; i5++) {
drawChildElement(canvas, top, this.drawNamesAfter.get(i5), 1);
}
this.drawNamesAfter.clear();
}
int size3 = this.drawCaptionAfter.size();
if (size3 > 0) {
for (int i6 = 0; i6 < size3; i6++) {
ChatMessageCell chatMessageCell2 = this.drawCaptionAfter.get(i6);
if (chatMessageCell2.getCurrentPosition() != null) {
drawChildElement(canvas, top, chatMessageCell2, 2);
}
}
this.drawCaptionAfter.clear();
}
if (ChatActivity.this.pagedownButton != null && ChatActivity.this.pagedownButton.getTag() != null) {
super.drawChild(canvas, ChatActivity.this.pagedownButton, SystemClock.uptimeMillis());
}
if (ChatActivity.this.mentiondownButton != null && ChatActivity.this.mentiondownButton.getTag() != null) {
super.drawChild(canvas, ChatActivity.this.mentiondownButton, SystemClock.uptimeMillis());
}
if (ChatActivity.this.floatingDateView == null || ChatActivity.this.floatingDateView.getTag() == null) {
return;
}
super.drawChild(canvas, ChatActivity.this.floatingDateView, SystemClock.uptimeMillis());
}
}
@Override
protected void onMeasure(int i, int i2) {
int dp;
int i3;
int i4;
?? r5;
int i5;
int i6;
int size = View.MeasureSpec.getSize(i);
int size2 = View.MeasureSpec.getSize(i2);
setMeasuredDimension(size, size2);
int paddingTop = size2 - getPaddingTop();
measureChildWithMargins(ChatActivity.this.actionBar, i, 0, i2, 0);
int measuredHeight = ChatActivity.this.actionBar.getMeasuredHeight();
if (ChatActivity.this.actionBar.getVisibility() == 0) {
paddingTop -= measuredHeight;
}
if (getKeyboardHeight() > AndroidUtilities.dp(20.0f)) {
ChatActivity.this.globalIgnoreLayout = true;
ChatActivity.this.chatActivityEnterView.hideEmojiView();
ChatActivity.this.globalIgnoreLayout = false;
} else if (!AndroidUtilities.isInMultiwindow) {
paddingTop -= ChatActivity.this.chatActivityEnterView.getEmojiPadding();
size2 -= ChatActivity.this.chatActivityEnterView.getEmojiPadding();
}
int childCount = getChildCount();
measureChildWithMargins(ChatActivity.this.chatActivityEnterView, i, 0, i2, 0);
if (!ChatActivity.this.isSysNotifyMessage().booleanValue()) {
if (ChatActivity.this.inPreviewMode) {
this.inputFieldHeight = 0;
} else {
this.inputFieldHeight = ChatActivity.this.chatActivityEnterView.getMeasuredHeight();
dp = AndroidUtilities.dp(49.0f);
for (i3 = 0; i3 < childCount; i3++) {
View childAt = getChildAt(i3);
if (childAt != null && childAt.getVisibility() != 8 && childAt != ChatActivity.this.chatActivityEnterView && childAt != ChatActivity.this.actionBar) {
if (childAt != ChatActivity.this.chatListView) {
if (childAt != ChatActivity.this.progressView) {
if (childAt != ChatActivity.this.instantCameraView && childAt != ChatActivity.this.overlayView) {
if (childAt == ChatActivity.this.emptyViewContainer) {
childAt.measure(View.MeasureSpec.makeMeasureSpec(size, 1073741824), View.MeasureSpec.makeMeasureSpec(paddingTop, 1073741824));
} else if (!ChatActivity.this.chatActivityEnterView.isPopupView(childAt)) {
if (childAt == ChatActivity.this.mentionContainer) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) ChatActivity.this.mentionContainer.getLayoutParams();
if (!ChatActivity.this.mentionsAdapter.isBannedInline()) {
ChatActivity.this.mentionListViewIgnoreLayout = true;
if (!ChatActivity.this.mentionsAdapter.isBotContext() || !ChatActivity.this.mentionsAdapter.isMediaLayout()) {
int itemCount = ChatActivity.this.mentionsAdapter.getItemCount();
if (ChatActivity.this.mentionsAdapter.isBotContext()) {
if (ChatActivity.this.mentionsAdapter.getBotContextSwitch() != null) {
itemCount--;
i6 = 36;
} else {
i6 = 0;
}
i4 = i6 + (itemCount * 68);
} else {
i4 = (itemCount * 36) + 0;
}
int measuredHeight2 = (paddingTop - ChatActivity.this.chatActivityEnterView.getMeasuredHeight()) + (i4 != 0 ? AndroidUtilities.dp(2.0f) : 0);
r5 = 0;
int max = Math.max(0, measuredHeight2 - AndroidUtilities.dp(Math.min(i4, 122.399994f)));
if (ChatActivity.this.mentionLayoutManager.getReverseLayout()) {
ChatActivity.this.mentionListView.setPadding(0, 0, 0, max);
} else {
ChatActivity.this.mentionListView.setPadding(0, max, 0, 0);
}
i5 = measuredHeight2;
} else {
int rowsCount = ChatActivity.this.mentionGridLayoutManager.getRowsCount(size) * 102;
if (ChatActivity.this.mentionsAdapter.isBotContext() && ChatActivity.this.mentionsAdapter.getBotContextSwitch() != null) {
rowsCount += 34;
}
i5 = (paddingTop - ChatActivity.this.chatActivityEnterView.getMeasuredHeight()) + (rowsCount != 0 ? AndroidUtilities.dp(2.0f) : 0);
int max2 = Math.max(0, i5 - AndroidUtilities.dp(Math.min(rowsCount, 122.399994f)));
if (ChatActivity.this.mentionLayoutManager.getReverseLayout()) {
ChatActivity.this.mentionListView.setPadding(0, 0, 0, max2);
} else {
ChatActivity.this.mentionListView.setPadding(0, max2, 0, 0);
}
r5 = 0;
}
layoutParams.height = i5;
layoutParams.topMargin = r5;
ChatActivity.this.mentionListViewIgnoreLayout = r5;
childAt.measure(View.MeasureSpec.makeMeasureSpec(size, 1073741824), View.MeasureSpec.makeMeasureSpec(layoutParams.height, 1073741824));
} else {
childAt.measure(View.MeasureSpec.makeMeasureSpec(size, 1073741824), View.MeasureSpec.makeMeasureSpec(paddingTop, Integer.MIN_VALUE));
}
} else {
measureChildWithMargins(childAt, i, 0, i2, 0);
}
} else if (AndroidUtilities.isInMultiwindow) {
if (AndroidUtilities.isTablet()) {
childAt.measure(View.MeasureSpec.makeMeasureSpec(size, 1073741824), View.MeasureSpec.makeMeasureSpec(Math.min(AndroidUtilities.dp(320.0f), (((paddingTop - this.inputFieldHeight) + measuredHeight) - AndroidUtilities.statusBarHeight) + getPaddingTop()), 1073741824));
} else {
childAt.measure(View.MeasureSpec.makeMeasureSpec(size, 1073741824), View.MeasureSpec.makeMeasureSpec((((paddingTop - this.inputFieldHeight) + measuredHeight) - AndroidUtilities.statusBarHeight) + getPaddingTop(), 1073741824));
}
} else {
int i7 = childAt.getLayoutParams().height;
childAt.measure(View.MeasureSpec.makeMeasureSpec(size, 1073741824), View.MeasureSpec.makeMeasureSpec(childAt.getLayoutParams().height, 1073741824));
}
} else {
childAt.measure(View.MeasureSpec.makeMeasureSpec(size, 1073741824), View.MeasureSpec.makeMeasureSpec((size2 - this.inputFieldHeight) + AndroidUtilities.dp(3.0f), 1073741824));
}
} else {
childAt.measure(View.MeasureSpec.makeMeasureSpec(size, 1073741824), View.MeasureSpec.makeMeasureSpec(Math.max(AndroidUtilities.dp(10.0f), ((paddingTop - this.inputFieldHeight) - ((!ChatActivity.this.inPreviewMode || Build.VERSION.SDK_INT < 21) ? 0 : AndroidUtilities.statusBarHeight)) + AndroidUtilities.dp((ChatActivity.this.chatActivityEnterView.isTopViewVisible() ? 48 : 0) + 2)), 1073741824));
}
} else {
if (ChatActivity.this.chatActivityEnterView.getAlpha() != 1.0f) {
ChatActivity.this.chatListView.setTranslationY(this.inputFieldHeight - AndroidUtilities.dp(51.0f));
}
ChatActivity chatActivity = ChatActivity.this;
chatActivity.chatListViewClipTop = chatActivity.inPreviewMode ? 0 : this.inputFieldHeight - AndroidUtilities.dp(51.0f);
childAt.measure(View.MeasureSpec.makeMeasureSpec(size, 1073741824), View.MeasureSpec.makeMeasureSpec(Math.max(AndroidUtilities.dp(10.0f), (paddingTop - dp) - ((!ChatActivity.this.inPreviewMode || Build.VERSION.SDK_INT < 21) ? 0 : AndroidUtilities.statusBarHeight)), 1073741824));
}
}
}
if (ChatActivity.this.fixPaddingsInLayout) {
ChatActivity.this.globalIgnoreLayout = true;
ChatActivity.this.checkListViewPaddingsInternal();
ChatActivity.this.fixPaddingsInLayout = false;
ChatActivity.this.chatListView.measure(View.MeasureSpec.makeMeasureSpec(ChatActivity.this.chatListView.getMeasuredWidth(), 1073741824), View.MeasureSpec.makeMeasureSpec(ChatActivity.this.chatListView.getMeasuredHeight(), 1073741824));
ChatActivity.this.globalIgnoreLayout = false;
}
if (ChatActivity.this.scrollToPositionOnRecreate == -1) {
final int i8 = ChatActivity.this.scrollToPositionOnRecreate;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.AnonymousClass9.this.lambda$onMeasure$0$ChatActivity$9(i8);
}
});
ChatActivity.this.scrollToPositionOnRecreate = -1;
return;
}
return;
}
} else {
this.inputFieldHeight = ChatActivity.this.chatActivityEnterView.getMeasuredHeight();
}
dp = 0;
while (i3 < childCount) {
}
if (ChatActivity.this.fixPaddingsInLayout) {
}
if (ChatActivity.this.scrollToPositionOnRecreate == -1) {
}
}
public void lambda$onMeasure$0$ChatActivity$9(int i) {
ChatActivity.this.chatLayoutManager.scrollToPositionWithOffset(i, ChatActivity.this.scrollToOffsetOnRecreate);
}
@Override
public void requestLayout() {
if (ChatActivity.this.globalIgnoreLayout) {
return;
}
super.requestLayout();
}
@Override
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
int i5;
int i6;
int i7;
int i8;
int i9;
int i10;
int i11;
int i12;
int dp;
int childCount = getChildCount();
int emojiPadding = (getKeyboardHeight() > AndroidUtilities.dp(20.0f) || AndroidUtilities.isInMultiwindow) ? 0 : ChatActivity.this.chatActivityEnterView.getEmojiPadding();
setBottomClip(emojiPadding);
for (int i13 = 0; i13 < childCount; i13++) {
View childAt = getChildAt(i13);
if (childAt != null && childAt.getVisibility() != 8) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
int measuredWidth = childAt.getMeasuredWidth();
int measuredHeight = childAt.getMeasuredHeight();
int i14 = layoutParams.gravity;
if (i14 == -1) {
i14 = 51;
}
int i15 = i14 & 7;
int i16 = i14 & 112;
int i17 = i15 & 7;
if (i17 == 1) {
i5 = (((i3 - i) - measuredWidth) / 2) + layoutParams.leftMargin;
i6 = layoutParams.rightMargin;
} else if (i17 == 5) {
i5 = i3 - measuredWidth;
i6 = layoutParams.rightMargin;
} else {
i7 = layoutParams.leftMargin;
if (i16 == 16) {
if (i16 == 48) {
i10 = layoutParams.topMargin + getPaddingTop();
if (childAt != ChatActivity.this.actionBar && ChatActivity.this.actionBar.getVisibility() == 0) {
i10 += ChatActivity.this.actionBar.getMeasuredHeight();
if (ChatActivity.this.inPreviewMode && Build.VERSION.SDK_INT >= 21) {
i10 += AndroidUtilities.statusBarHeight;
}
}
} else if (i16 == 80) {
i8 = ((i4 - emojiPadding) - i2) - measuredHeight;
i9 = layoutParams.bottomMargin;
} else {
i10 = layoutParams.topMargin;
}
if (childAt != ChatActivity.this.mentionContainer) {
if (childAt == ChatActivity.this.pagedownButton) {
if (!ChatActivity.this.inPreviewMode) {
i11 = ChatActivity.this.chatActivityEnterView.getMeasuredHeight();
i10 -= i11;
}
childAt.layout(i7, i10, measuredWidth + i7, measuredHeight + i10);
} else if (childAt == ChatActivity.this.mentiondownButton) {
if (!ChatActivity.this.inPreviewMode) {
i11 = ChatActivity.this.chatActivityEnterView.getMeasuredHeight();
i10 -= i11;
}
childAt.layout(i7, i10, measuredWidth + i7, measuredHeight + i10);
} else if (childAt == ChatActivity.this.emptyViewContainer) {
i12 = this.inputFieldHeight / 2;
dp = ChatActivity.this.actionBar.getVisibility() == 0 ? ChatActivity.this.actionBar.getMeasuredHeight() / 2 : 0;
} else {
if (!ChatActivity.this.chatActivityEnterView.isPopupView(childAt)) {
if (childAt != ChatActivity.this.gifHintTextView && childAt != ChatActivity.this.voiceHintTextView && childAt != ChatActivity.this.mediaBanTooltip) {
if (childAt == ChatActivity.this.chatListView) {
if (!ChatActivity.this.inPreviewMode) {
i12 = this.inputFieldHeight;
dp = AndroidUtilities.dp(51.0f);
}
} else if (childAt != ChatActivity.this.progressView) {
if (childAt == ChatActivity.this.actionBar) {
if (ChatActivity.this.inPreviewMode && Build.VERSION.SDK_INT >= 21) {
i10 += AndroidUtilities.statusBarHeight;
}
i11 = getPaddingTop();
} else if (childAt == ChatActivity.this.videoPlayerContainer) {
i10 = ChatActivity.this.actionBar.getMeasuredHeight();
} else if (childAt == ChatActivity.this.instantCameraView || childAt == ChatActivity.this.overlayView) {
i10 = 0;
}
} else if (ChatActivity.this.chatActivityEnterView.isTopViewVisible()) {
i11 = AndroidUtilities.dp(48.0f);
}
} else {
i11 = this.inputFieldHeight;
}
i10 -= i11;
} else if (AndroidUtilities.isInMultiwindow) {
i10 = (ChatActivity.this.chatActivityEnterView.getTop() - childAt.getMeasuredHeight()) + AndroidUtilities.dp(1.0f);
} else {
i10 = ChatActivity.this.chatActivityEnterView.getBottom();
}
childAt.layout(i7, i10, measuredWidth + i7, measuredHeight + i10);
}
} else {
i12 = ChatActivity.this.chatActivityEnterView.getMeasuredHeight();
dp = AndroidUtilities.dp(2.0f);
}
i11 = i12 - dp;
i10 -= i11;
childAt.layout(i7, i10, measuredWidth + i7, measuredHeight + i10);
} else {
i8 = ((((i4 - emojiPadding) - i2) - measuredHeight) / 2) + layoutParams.topMargin;
i9 = layoutParams.bottomMargin;
}
i10 = i8 - i9;
if (childAt != ChatActivity.this.mentionContainer) {
}
i11 = i12 - dp;
i10 -= i11;
childAt.layout(i7, i10, measuredWidth + i7, measuredHeight + i10);
}
i7 = i5 - i6;
if (i16 == 16) {
}
i10 = i8 - i9;
if (childAt != ChatActivity.this.mentionContainer) {
}
i11 = i12 - dp;
i10 -= i11;
childAt.layout(i7, i10, measuredWidth + i7, measuredHeight + i10);
}
}
ChatActivity.this.updateMessagesVisiblePart(true);
ChatActivity.this.updateTextureViewPosition(false);
if (!ChatActivity.this.scrollingChatListView) {
ChatActivity.this.checkAutoDownloadMessages(false);
}
notifyHeightChanged();
}
}
public void lambda$createView$6$ChatActivity(View view) {
if (this.floatingDateView.getAlpha() == 0.0f || this.actionBar.isActionModeShowed()) {
return;
}
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(this.floatingDateView.getCustomDate() * 1000);
int i = calendar.get(1);
int i2 = calendar.get(2);
int i3 = calendar.get(5);
calendar.clear();
calendar.set(i, i2, i3);
jumpToDate((int) (calendar.getTime().getTime() / 1000));
}
public void lambda$createView$7$ChatActivity(View view) {
this.wasManualScroll = true;
TLRPC.ChatFull chatFull = this.chatInfo;
if (chatFull != null) {
scrollToMessageId(chatFull.pinned_msg_id, 0, true, 0, false);
return;
}
TLRPC.UserFull userFull = this.userInfo;
if (userFull != null) {
scrollToMessageId(userFull.pinned_msg_id, 0, true, 0, false);
}
}
public void lambda$createView$10$ChatActivity(View view) {
TLRPC.UserFull userFull;
if (getParentActivity() == null) {
return;
}
TLRPC.Chat chat = this.currentChat;
boolean z = false;
if (chat != null) {
boolean canPinMessages = ChatObject.canPinMessages(chat);
if (this.pinnedMessageObject.type != 207) {
z = canPinMessages;
}
} else if (this.currentEncryptedChat == null && (userFull = this.userInfo) != null) {
z = userFull.can_pin_message;
}
if (z) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("UnpinMessageAlertTitle", R.string.UnpinMessageAlertTitle));
builder.setMessage(LocaleController.getString("UnpinMessageAlert", R.string.UnpinMessageAlert));
builder.setPositiveButton(LocaleController.getString("UnpinMessage", R.string.UnpinMessage), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatActivity.this.lambda$null$9$ChatActivity(dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
return;
}
SharedPreferences notificationsSettings = MessagesController.getNotificationsSettings(this.currentAccount);
if (this.chatInfo != null) {
SharedPreferences.Editor edit2 = notificationsSettings.edit();
edit2.putInt("pin_" + this.dialog_id, this.chatInfo.pinned_msg_id).commit();
} else if (this.userInfo != null) {
SharedPreferences.Editor edit3 = notificationsSettings.edit();
edit3.putInt("pin_" + this.dialog_id, this.userInfo.pinned_msg_id).commit();
}
updatePinnedMessageView(true);
}
public void lambda$null$9$ChatActivity(DialogInterface dialogInterface, int i) {
getMessagesController().pinMessage(this.currentChat, this.currentUser, 0, false);
}
public void lambda$createView$11$ChatActivity(View view) {
if (getParentActivity() == null) {
return;
}
updatePinnedLiveMessageView(false, 0, false);
animLivePinClose(this.pinnedLiveUserImageView);
}
public void lambda$createView$13$ChatActivity(View view) {
AlertsCreator.showBlockReportSpamAlert(this, this.dialog_id, this.currentUser, this.currentChat, this.currentEncryptedChat, this.reportSpamButton.getTag(R.id.object_tag) != null, this.chatInfo, new MessagesStorage.IntCallback() {
@Override
public final void run(int i) {
ChatActivity.this.lambda$null$12$ChatActivity(i);
}
});
}
public void lambda$null$12$ChatActivity(int i) {
if (i == 0) {
updateTopPanel(true);
} else {
finishFragment();
}
}
public void lambda$createView$14$ChatActivity(View view) {
if (this.addToContactsButton.getTag() != null) {
shareMyContact(1, null);
return;
}
TLRPC.User user = this.currentUser;
if (user != null) {
presentFragment(new AddContactsInfoActivity(null, user));
}
}
public void lambda$createView$15$ChatActivity(View view) {
getMessagesController().hidePeerSettingsBar(this.dialog_id, this.currentUser, this.currentChat);
updateTopPanel(true);
}
public void lambda$createView$16$ChatActivity(View view) {
this.wasManualScroll = true;
this.checkTextureViewPosition = true;
int i = this.createUnreadMessageAfterId;
if (i != 0) {
scrollToMessageId(i, 0, false, this.returnToLoadIndex, false);
return;
}
int i2 = this.returnToMessageId;
if (i2 > 0) {
scrollToMessageId(i2, 0, true, this.returnToLoadIndex, false);
} else {
scrollToLastMessage(true);
}
}
public class AnonymousClass17 implements View.OnClickListener {
AnonymousClass17() {
}
private void loadLastUnreadMention() {
ChatActivity.this.wasManualScroll = true;
if (ChatActivity.this.hasAllMentionsLocal) {
ChatActivity.this.getMessagesStorage().getUnreadMention(ChatActivity.this.dialog_id, new MessagesStorage.IntCallback() {
@Override
public final void run(int i) {
ChatActivity.AnonymousClass17.this.lambda$loadLastUnreadMention$0$ChatActivity$17(i);
}
});
return;
}
final MessagesStorage messagesStorage = ChatActivity.this.getMessagesStorage();
TLRPC.TL_messages_getUnreadMentions tL_messages_getUnreadMentions = new TLRPC.TL_messages_getUnreadMentions();
tL_messages_getUnreadMentions.peer = ChatActivity.this.getMessagesController().getInputPeer((int) ChatActivity.this.dialog_id);
tL_messages_getUnreadMentions.limit = 1;
tL_messages_getUnreadMentions.add_offset = ChatActivity.this.newMentionsCount - 1;
ChatActivity.this.getConnectionsManager().sendRequest(tL_messages_getUnreadMentions, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChatActivity.AnonymousClass17.this.lambda$loadLastUnreadMention$2$ChatActivity$17(messagesStorage, tLObject, tL_error);
}
});
}
public void lambda$loadLastUnreadMention$0$ChatActivity$17(int i) {
if (i == 0) {
ChatActivity.this.hasAllMentionsLocal = false;
loadLastUnreadMention();
return;
}
ChatActivity.this.scrollToMessageId(i, 0, false, 0, false);
}
public void lambda$loadLastUnreadMention$2$ChatActivity$17(final MessagesStorage messagesStorage, final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.AnonymousClass17.this.lambda$null$1$ChatActivity$17(tLObject, tL_error, messagesStorage);
}
});
}
public void lambda$null$1$ChatActivity$17(TLObject tLObject, TLRPC.TL_error tL_error, MessagesStorage messagesStorage) {
TLRPC.messages_Messages messages_messages = (TLRPC.messages_Messages) tLObject;
if (tL_error != null || messages_messages.messages.isEmpty()) {
if (messages_messages != null) {
ChatActivity.this.newMentionsCount = messages_messages.count;
} else {
ChatActivity.this.newMentionsCount = 0;
}
messagesStorage.resetMentionsCount(ChatActivity.this.dialog_id, ChatActivity.this.newMentionsCount);
if (ChatActivity.this.newMentionsCount == 0) {
ChatActivity.this.hasAllMentionsLocal = true;
ChatActivity.this.showMentionDownButton(false, true);
return;
}
ChatActivity.this.mentiondownButtonCounter.setText(String.format("%d", Integer.valueOf(ChatActivity.this.newMentionsCount)));
loadLastUnreadMention();
return;
}
int i = messages_messages.messages.get(0).id;
long j = i;
if (ChatObject.isChannel(ChatActivity.this.currentChat)) {
j |= ChatActivity.this.currentChat.id << 32;
}
MessageObject messageObject = (MessageObject) ChatActivity.this.messagesDict[0].get(i);
messagesStorage.markMessageAsMention(j);
if (messageObject != null) {
messageObject.messageOwner.media_unread = true;
messageObject.messageOwner.mentioned = true;
}
ChatActivity.this.scrollToMessageId(i, 0, false, 0, false);
}
@Override
public void onClick(View view) {
loadLastUnreadMention();
}
}
public boolean lambda$createView$17$ChatActivity(View view) {
for (int i = 0; i < this.messages.size(); i++) {
MessageObject messageObject = this.messages.get(i);
if (messageObject.messageOwner.mentioned && !messageObject.isContentUnread()) {
messageObject.setContentIsRead();
}
}
this.newMentionsCount = 0;
getMessagesController().markMentionsAsRead(this.dialog_id);
this.hasAllMentionsLocal = true;
showMentionDownButton(false, true);
return true;
}
public boolean lambda$createView$18$ChatActivity(View view, MotionEvent motionEvent) {
return ContentPreviewViewer.getInstance().onTouch(motionEvent, this.mentionListView, 0, this.mentionsOnItemClickListener, null);
}
public void lambda$createView$21$ChatActivity(View view, int i) {
if (this.mentionsAdapter.isBannedInline()) {
return;
}
final Object item = this.mentionsAdapter.getItem(i);
int resultStartPosition = this.mentionsAdapter.getResultStartPosition();
int resultLength = this.mentionsAdapter.getResultLength();
if (item instanceof TLRPC.User) {
if (this.searchingForUser && this.searchContainer.getVisibility() == 0) {
TLRPC.User user = (TLRPC.User) item;
this.searchingUserMessages = user;
if (user == null) {
return;
}
String str = user.first_name;
if (TextUtils.isEmpty(str)) {
str = this.searchingUserMessages.last_name;
}
this.searchingForUser = false;
String string = LocaleController.getString("SearchFrom", R.string.SearchFrom);
SpannableString spannableString = new SpannableString(string + " " + str);
spannableString.setSpan(new ForegroundColorSpan(Theme.getColor(Theme.key_chat_messagePanelMetionText)), string.length() + 1, spannableString.length(), 33);
this.searchItem.setSearchFieldCaption(spannableString);
this.mentionsAdapter.searchUsernameOrHashtag(null, 0, null, false);
this.searchItem.setSearchFieldHint(null);
this.searchItem.clearSearchText();
getMediaDataController().searchMessagesInChat("", this.dialog_id, this.mergeDialogId, this.classGuid, 0, this.searchingUserMessages);
return;
}
TLRPC.User user2 = (TLRPC.User) item;
if (user2 != null) {
String str2 = UserObject.getName(user2) + " ";
if ("all".equals(str2.trim()) && user2.id == -1) {
SpannableString spannableString2 = new SpannableString("@" + str2);
spannableString2.setSpan(new URLSpanUserMention("-1", 1), 0, spannableString2.length(), 33);
spannableString2.setSpan(new ForegroundColorSpan(Theme.getColor(Theme.key_chat_messagePanelMetionText)), 0, spannableString2.length(), 33);
this.chatActivityEnterView.addMentionText1(resultStartPosition, resultLength, spannableString2, false);
return;
}
SpannableString spannableString3 = new SpannableString("@" + str2);
spannableString3.setSpan(new URLSpanUserMention("" + user2.id, 1), 0, spannableString3.length(), 33);
spannableString3.setSpan(new ForegroundColorSpan(Theme.getColor(Theme.key_chat_messagePanelMetionText)), 0, spannableString3.length(), 33);
this.chatActivityEnterView.addMentionText1(resultStartPosition, resultLength, spannableString3, false);
}
} else if (item instanceof String) {
if (this.mentionsAdapter.isBotCommands()) {
if (this.inScheduleMode) {
AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), UserObject.isUserSelf(this.currentUser), new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public final void didSelectDate(boolean z, int i2) {
ChatActivity.this.lambda$null$19$ChatActivity(item, z, i2);
}
});
return;
} else if (checkSlowMode(view)) {
return;
} else {
getSendMessagesHelper().sendMessage((String) item, this.dialog_id, this.replyingMessageObject, null, false, null, null, null, true, 0);
this.chatActivityEnterView.setFieldText("");
hideFieldPanel(false);
return;
}
}
this.chatActivityEnterView.replaceWithText(resultStartPosition, resultLength, item + " ", false);
} else if (item instanceof TLRPC.BotInlineResult) {
if (this.chatActivityEnterView.getFieldText() != null) {
if (this.inScheduleMode || !checkSlowMode(view)) {
final TLRPC.BotInlineResult botInlineResult = (TLRPC.BotInlineResult) item;
if ((botInlineResult.type.equals("photo") && (botInlineResult.photo != null || botInlineResult.content != null)) || ((botInlineResult.type.equals("gif") && (botInlineResult.document != null || botInlineResult.content != null)) || (botInlineResult.type.equals(MimeTypes.BASE_TYPE_VIDEO) && botInlineResult.document != null))) {
ArrayList<Object> arrayList = new ArrayList<>(this.mentionsAdapter.getSearchResultBotContext());
this.botContextResults = arrayList;
PhotoViewer.getInstance().setParentActivity(getParentActivity());
PhotoViewer.getInstance().openPhotoForSelect(arrayList, this.mentionsAdapter.getItemPosition(i), 3, this.botContextProvider, this);
} else if (this.inScheduleMode) {
AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), UserObject.isUserSelf(this.currentUser), new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public final void didSelectDate(boolean z, int i2) {
ChatActivity.this.lambda$null$20$ChatActivity(botInlineResult, z, i2);
}
});
} else {
lambda$null$20$ChatActivity(botInlineResult, true, 0);
}
}
}
} else if (item instanceof TLRPC.TL_inlineBotSwitchPM) {
processInlineBotContextPM((TLRPC.TL_inlineBotSwitchPM) item);
} else if (item instanceof MediaDataController.KeywordResult) {
String str3 = ((MediaDataController.KeywordResult) item).emoji;
this.chatActivityEnterView.addEmojiToRecent(str3);
this.chatActivityEnterView.replaceWithText(resultStartPosition, resultLength, str3, true);
}
}
public void lambda$null$19$ChatActivity(Object obj, boolean z, int i) {
getSendMessagesHelper().sendMessage((String) obj, this.dialog_id, this.replyingMessageObject, null, false, null, null, null, z, i);
this.chatActivityEnterView.setFieldText("");
hideFieldPanel(false);
}
public boolean lambda$createView$23$ChatActivity(View view, int i) {
boolean z = false;
if (getParentActivity() != null && this.mentionsAdapter.isLongClickEnabled()) {
Object item = this.mentionsAdapter.getItem(i);
if (item instanceof String) {
if (this.mentionsAdapter.isBotCommands()) {
if (URLSpanBotCommand.enabled) {
this.chatActivityEnterView.setFieldText("");
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
String str = (String) item;
TLRPC.Chat chat = this.currentChat;
if (chat != null && chat.megagroup) {
z = true;
}
chatActivityEnterView.setCommand(null, str, true, z);
return true;
}
return false;
}
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(), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
ChatActivity.this.lambda$null$22$ChatActivity(dialogInterface, i2);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
return true;
}
}
return false;
}
public void lambda$null$22$ChatActivity(DialogInterface dialogInterface, int i) {
this.mentionsAdapter.clearRecentHashtags();
}
public boolean lambda$createView$24$ChatActivity(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == 0) {
checkRecordLocked();
}
this.overlayView.getParent().requestDisallowInterceptTouchEvent(true);
return true;
}
public void lambda$createView$26$ChatActivity(View view) {
ArrayList<MessageObject> arrayList = this.forwardingMessages;
if (arrayList != null && !arrayList.isEmpty()) {
int size = this.forwardingMessages.size();
for (int i = 0; i < size; i++) {
MessageObject messageObject = this.forwardingMessages.get(i);
this.selectedMessagesIds[0].put(messageObject.getId(), messageObject);
}
Bundle bundle = new Bundle();
bundle.putBoolean("onlySelect", true);
bundle.putInt("dialogsType", 3);
bundle.putInt("messagesCount", this.forwardingMessages.size());
DialogsActivity dialogsActivity = new DialogsActivity(bundle);
dialogsActivity.setDelegate(this);
presentFragment(dialogsActivity);
return;
}
MessageObject messageObject2 = this.replyingMessageObject;
if (messageObject2 != null) {
scrollToMessageId(messageObject2.getId(), 0, true, 0, false);
return;
}
MessageObject messageObject3 = this.editingMessageObject;
if (messageObject3 != null && messageObject3.canEditMedia() && this.editingMessageObjectReqId == 0) {
if (this.chatAttachAlert == null) {
createChatAttachView();
}
this.chatAttachAlert.setEditingMessageObject(this.editingMessageObject);
openAttachMenu();
}
}
public void lambda$createView$27$ChatActivity(View view) {
ArrayList<MessageObject> arrayList = this.forwardingMessages;
if (arrayList != null) {
arrayList.clear();
}
showFieldPanel(false, null, null, null, this.foundWebPage, true, 0, true, true);
}
public boolean lambda$createView$28$ChatActivity(ContentPreviewViewer.ContentPreviewViewerDelegate contentPreviewViewerDelegate, View view, MotionEvent motionEvent) {
return ContentPreviewViewer.getInstance().onTouch(motionEvent, this.stickersListView, 0, this.stickersOnItemClickListener, contentPreviewViewerDelegate);
}
public void lambda$createView$30$ChatActivity(View view) {
getMediaDataController().searchMessagesInChat(null, this.dialog_id, this.mergeDialogId, this.classGuid, 1, this.searchingUserMessages);
}
public void lambda$createView$31$ChatActivity(View view) {
getMediaDataController().searchMessagesInChat(null, this.dialog_id, this.mergeDialogId, this.classGuid, 2, this.searchingUserMessages);
}
public void lambda$createView$32$ChatActivity(View view) {
this.mentionLayoutManager.setReverseLayout(true);
this.mentionsAdapter.setSearchingMentions(true);
this.searchCalendarButton.setVisibility(8);
this.searchUserButton.setVisibility(8);
this.searchingForUser = true;
this.searchingUserMessages = null;
this.searchItem.setSearchFieldHint(LocaleController.getString("SearchMembers", R.string.SearchMembers));
this.searchItem.setSearchFieldCaption(LocaleController.getString("SearchFrom", R.string.SearchFrom));
AndroidUtilities.showKeyboard(this.searchItem.getSearchField());
this.searchItem.clearSearchText();
}
public void lambda$createView$36$ChatActivity(View view) {
if (getParentActivity() == null) {
return;
}
AndroidUtilities.hideKeyboard(this.searchItem.getSearchField());
Calendar calendar = Calendar.getInstance();
try {
DatePickerDialog datePickerDialog = new DatePickerDialog(getParentActivity(), new DatePickerDialog.OnDateSetListener() {
@Override
public final void onDateSet(DatePicker datePicker, int i, int i2, int i3) {
ChatActivity.this.lambda$null$33$ChatActivity(datePicker, i, i2, i3);
}
}, calendar.get(1), calendar.get(2), calendar.get(5));
final DatePicker datePicker = datePickerDialog.getDatePicker();
datePicker.setMinDate(1375315200000L);
datePicker.setMaxDate(System.currentTimeMillis());
datePickerDialog.setButton(-1, LocaleController.getString("JumpToDate", R.string.JumpToDate), datePickerDialog);
datePickerDialog.setButton(-2, LocaleController.getString("Cancel", R.string.Cancel), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatActivity.lambda$null$34(dialogInterface, i);
}
});
if (Build.VERSION.SDK_INT >= 21) {
datePickerDialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public final void onShow(DialogInterface dialogInterface) {
ChatActivity.lambda$null$35(datePicker, dialogInterface);
}
});
}
showDialog(datePickerDialog);
} catch (Exception e) {
FileLog.e(e);
}
}
public void lambda$null$33$ChatActivity(DatePicker datePicker, int i, int i2, int i3) {
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(i, i2, i3);
int time = (int) (calendar.getTime().getTime() / 1000);
clearChatData();
this.waitingForLoad.add(Integer.valueOf(this.lastLoadIndex));
MessagesController messagesController = getMessagesController();
long j = this.dialog_id;
int i4 = this.classGuid;
boolean isChannel = ChatObject.isChannel(this.currentChat);
boolean z = this.inScheduleMode;
int i5 = this.lastLoadIndex;
this.lastLoadIndex = i5 + 1;
messagesController.loadMessages(j, 30, 0, time, true, 0, i4, 4, 0, isChannel, z, i5);
}
public static void lambda$null$35(DatePicker datePicker, DialogInterface dialogInterface) {
int childCount = datePicker.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = datePicker.getChildAt(i);
ViewGroup.LayoutParams layoutParams = childAt.getLayoutParams();
layoutParams.width = -1;
childAt.setLayoutParams(layoutParams);
}
}
public void lambda$createView$39$ChatActivity(View view) {
String str;
if (getParentActivity() == null) {
return;
}
TLRPC.User user = this.currentUser;
if (user != null && this.userBlocked) {
if (user.bot) {
String str2 = this.botUser;
this.botUser = null;
getMessagesController().unblockUser(this.currentUser.id);
if (str2 != null && str2.length() != 0) {
getMessagesController().sendBotStart(this.currentUser, str2);
return;
} else {
getSendMessagesHelper().sendMessage("/start", this.dialog_id, null, null, false, null, null, null, true, 0);
return;
}
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(LocaleController.getString("AreYouSureUnblockContact", R.string.AreYouSureUnblockContact));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatActivity.this.lambda$null$37$ChatActivity(dialogInterface, i);
}
});
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
return;
}
TLRPC.User user2 = this.currentUser;
if (user2 != null && user2.bot && (str = this.botUser) != null) {
if (str.length() != 0) {
getMessagesController().sendBotStart(this.currentUser, this.botUser);
} else {
getSendMessagesHelper().sendMessage("/start", this.dialog_id, null, null, false, null, null, null, true, 0);
}
this.botUser = null;
updateBottomOverlay();
return;
}
if (ChatObject.isChannel(this.currentChat)) {
TLRPC.Chat chat = this.currentChat;
if (!(chat instanceof TLRPC.TL_channelForbidden)) {
if (ChatObject.isNotInChat(chat)) {
showBottomOverlayProgress(true, true);
getMessagesController().addUserToChat(this.currentChat.id, getUserConfig().getCurrentUser(), null, 0, null, this, null);
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.closeSearchByActiveAction, new Object[0]);
if (!hasReportSpam() || this.reportSpamButton.getTag(R.id.object_tag) == null) {
return;
}
SharedPreferences.Editor edit2 = MessagesController.getNotificationsSettings(this.currentAccount).edit();
edit2.putInt("dialog_bar_vis3" + this.dialog_id, 3).commit();
getNotificationCenter().postNotificationName(NotificationCenter.peerSettingsDidLoad, Long.valueOf(this.dialog_id));
return;
}
toggleMute(true);
return;
}
}
AlertsCreator.createClearOrDeleteDialogAlert(this, false, this.currentChat, this.currentUser, this.currentEncryptedChat != null, new MessagesStorage.BooleanCallback() {
@Override
public final void run(boolean z) {
ChatActivity.this.lambda$null$38$ChatActivity(z);
}
});
}
public void lambda$null$37$ChatActivity(DialogInterface dialogInterface, int i) {
getMessagesController().unblockUser(this.currentUser.id);
}
public void lambda$null$38$ChatActivity(boolean z) {
getNotificationCenter().removeObserver(this, NotificationCenter.closeChats);
getNotificationCenter().postNotificationName(NotificationCenter.closeChats, new Object[0]);
finishFragment();
getNotificationCenter().postNotificationName(NotificationCenter.needDeleteDialog, Long.valueOf(this.dialog_id), this.currentUser, this.currentChat, Boolean.valueOf(z));
}
public void lambda$createView$40$ChatActivity(View view) {
if (this.chatInfo == null) {
return;
}
Bundle bundle = new Bundle();
bundle.putInt("chat_id", this.chatInfo.linked_chat_id);
if (getMessagesController().checkCanOpenChat(bundle, this)) {
presentFragment(new ChatActivity(bundle));
}
}
public void lambda$createView$41$ChatActivity(View view) {
MessageObject messageObject = null;
for (int i = 1; i >= 0; i--) {
if (messageObject == null && this.selectedMessagesIds[i].size() != 0) {
messageObject = this.messagesDict[i].get(this.selectedMessagesIds[i].keyAt(0));
}
this.selectedMessagesIds[i].clear();
this.selectedMessagesCanCopyIds[i].clear();
this.selectedMessagesCanStarIds[i].clear();
}
hideActionMode();
if (messageObject != null && (messageObject.messageOwner.id > 0 || (messageObject.messageOwner.id < 0 && this.currentEncryptedChat != null))) {
showFieldPanelForReply(messageObject);
}
updatePinnedMessageView(true);
updateVisibleRows();
}
public void lambda$createView$42$ChatActivity(View view) {
openForward();
}
private void createActionBarMenuPop() {
ChatActionBarMenuPopupWindow chatActionBarMenuPopupWindow = new ChatActionBarMenuPopupWindow(getParentActivity());
this.chatActionBarMenuPop = chatActionBarMenuPopupWindow;
chatActionBarMenuPopupWindow.setBackgroundDrawable(new ColorDrawable());
this.chatActionBarMenuPop.setOutsideTouchable(true);
this.chatActionBarMenuPop.setFocusable(true);
this.chatActionBarMenuPop.setInputMethodMode(1);
this.chatActionBarMenuPop.setSoftInputMode(48);
this.chatActionBarMenuPop.setOnSubItemClickListener(new ChatActionBarMenuPopupWindow.OnSubItemClickListener() {
@Override
public final void onClick(int i) {
ChatActivity.this.lambda$createActionBarMenuPop$46$ChatActivity(i);
}
});
}
public void lambda$createActionBarMenuPop$46$ChatActivity(final int i) {
if (i == 40) {
openSearchWithText(null);
} else if (i == 21) {
AlertsCreator.createReportAlert(getParentActivity(), this.dialog_id, 0, this);
} else if (i == 17) {
if (this.currentUser == null || getParentActivity() == null) {
return;
}
if (this.addToContactsButton.getTag() != null) {
shareMyContact(((Integer) this.addToContactsButton.getTag()).intValue(), null);
} else {
TLRPC.User user = this.currentUser;
if (user != null) {
presentFragment(new AddContactsInfoActivity(null, user));
}
}
} else if (i == 18) {
toggleMute(false);
} else if (i == 13) {
if (getParentActivity() == null) {
return;
}
showDialog(AlertsCreator.createTTLAlert(getParentActivity(), this.currentEncryptedChat).create());
} else if (i == 15 || i == 16) {
if (getParentActivity() == null) {
return;
}
long j = this.dialog_id;
final boolean z = ((int) j) < 0 && ((int) (j >> 32)) != 1;
AlertsCreator.createClearOrDeleteDialogAlert(this, i == 15, this.currentChat, this.currentUser, this.currentEncryptedChat != null, new MessagesStorage.BooleanCallback() {
@Override
public final void run(boolean z2) {
ChatActivity.this.lambda$null$45$ChatActivity(i, z, z2);
}
});
} else if (i == 30) {
getSendMessagesHelper().sendMessage("/help", this.dialog_id, null, null, false, null, null, null, true, 0);
} else if (i == 31) {
getSendMessagesHelper().sendMessage("/settings", this.dialog_id, null, null, false, null, null, null, true, 0);
} else if (i == 24) {
try {
getMediaDataController().installShortcut(this.currentUser.id);
} catch (Exception e) {
FileLog.e(e);
}
}
this.chatActionBarMenuPop.dismiss();
}
public void lambda$null$45$ChatActivity(final int i, final boolean z, final boolean z2) {
if (i == 15 && ChatObject.isChannel(this.currentChat) && (!this.currentChat.megagroup || !TextUtils.isEmpty(this.currentChat.username))) {
getMessagesController().deleteDialog(this.dialog_id, 2, z2);
} else if (i != 15) {
getNotificationCenter().removeObserver(this, NotificationCenter.closeChats);
getNotificationCenter().postNotificationName(NotificationCenter.closeChats, new Object[0]);
finishFragment();
getNotificationCenter().postNotificationName(NotificationCenter.needDeleteDialog, Long.valueOf(this.dialog_id), this.currentUser, this.currentChat, Boolean.valueOf(z2));
} else {
this.clearingHistory = true;
this.undoView.setAdditionalTranslationY(0.0f);
this.undoView.showWithAction(this.dialog_id, i == 15 ? 0 : 1, new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$43$ChatActivity(i, z2, z);
}
}, new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$44$ChatActivity();
}
});
this.chatAdapter.notifyDataSetChanged();
}
}
public void lambda$null$43$ChatActivity(int i, boolean z, boolean z2) {
if (i == 15) {
TLRPC.ChatFull chatFull = this.chatInfo;
if (chatFull != null && chatFull.pinned_msg_id != 0) {
SharedPreferences.Editor edit2 = MessagesController.getNotificationsSettings(this.currentAccount).edit();
edit2.putInt("pin_" + this.dialog_id, this.chatInfo.pinned_msg_id).commit();
updatePinnedMessageView(true);
} else {
TLRPC.UserFull userFull = this.userInfo;
if (userFull != null && userFull.pinned_msg_id != 0) {
SharedPreferences.Editor edit3 = MessagesController.getNotificationsSettings(this.currentAccount).edit();
edit3.putInt("pin_" + this.dialog_id, this.userInfo.pinned_msg_id).commit();
updatePinnedMessageView(true);
}
}
getMessagesController().deleteDialog(this.dialog_id, 1, z);
this.clearingHistory = false;
clearHistory(false);
this.chatAdapter.notifyDataSetChanged();
return;
}
if (z2) {
if (ChatObject.isNotInChat(this.currentChat)) {
getMessagesController().deleteDialog(this.dialog_id, 0, z);
} else {
getMessagesController().deleteUserFromChat((int) (-this.dialog_id), getMessagesController().getUser(Integer.valueOf(getUserConfig().getClientUserId())), null);
}
} else {
getMessagesController().deleteDialog(this.dialog_id, 0, z);
}
finishFragment();
}
public void lambda$null$44$ChatActivity() {
this.clearingHistory = false;
this.chatAdapter.notifyDataSetChanged();
}
public void showOrUpdateActionBarMenuPop() {
ChatActionBarMenuPopupWindow chatActionBarMenuPopupWindow = this.chatActionBarMenuPop;
if (chatActionBarMenuPopupWindow != null) {
if (!chatActionBarMenuPopupWindow.isShowing()) {
this.chatActionBarMenuPop.showAsDropDown(this.actionBar);
} else {
this.chatActionBarMenuPop.update();
}
}
}
public TextureView createTextureView(boolean z) {
if (this.parentLayout == null) {
return null;
}
if (this.videoPlayerContainer == null) {
if (Build.VERSION.SDK_INT >= 21) {
FrameLayout frameLayout = new FrameLayout(getParentActivity()) {
@Override
public void setTranslationY(float f) {
super.setTranslationY(f);
ChatActivity.this.contentView.invalidate();
}
};
this.videoPlayerContainer = frameLayout;
frameLayout.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
if (view.getTag(R.id.parent_tag) != null) {
outline.setRoundRect(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight(), AndroidUtilities.dp(4.0f));
} else {
outline.setOval(0, 0, AndroidUtilities.roundMessageSize, AndroidUtilities.roundMessageSize);
}
}
});
this.videoPlayerContainer.setClipToOutline(true);
} else {
this.videoPlayerContainer = new FrameLayout(getParentActivity()) {
RectF rect = new RectF();
@Override
protected void onSizeChanged(int i, int i2, int i3, int i4) {
super.onSizeChanged(i, i2, i3, i4);
ChatActivity.this.aspectPath.reset();
if (getTag(R.id.parent_tag) == null) {
float f = i / 2;
ChatActivity.this.aspectPath.addCircle(f, i2 / 2, f, Path.Direction.CW);
} else {
this.rect.set(0.0f, 0.0f, i, i2);
ChatActivity.this.aspectPath.addRoundRect(this.rect, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(4.0f), Path.Direction.CW);
}
ChatActivity.this.aspectPath.toggleInverseFillType();
}
@Override
public void setTranslationY(float f) {
super.setTranslationY(f);
ChatActivity.this.contentView.invalidate();
}
@Override
public void setVisibility(int i) {
super.setVisibility(i);
if (i == 0) {
setLayerType(2, null);
}
}
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
if (getTag() == null) {
canvas.drawPath(ChatActivity.this.aspectPath, ChatActivity.this.aspectPaint);
}
}
};
this.aspectPath = new Path();
Paint paint = new Paint(1);
this.aspectPaint = paint;
paint.setColor(-16777216);
this.aspectPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
}
this.videoPlayerContainer.setWillNotDraw(false);
AspectRatioFrameLayout aspectRatioFrameLayout = new AspectRatioFrameLayout(getParentActivity());
this.aspectRatioFrameLayout = aspectRatioFrameLayout;
aspectRatioFrameLayout.setBackgroundColor(0);
if (z) {
this.videoPlayerContainer.addView(this.aspectRatioFrameLayout, LayoutHelper.createFrame(-1, -1, 17));
}
TextureView textureView = new TextureView(getParentActivity());
this.videoTextureView = textureView;
textureView.setOpaque(false);
this.aspectRatioFrameLayout.addView(this.videoTextureView, LayoutHelper.createFrame(-1, -1.0f));
}
ViewGroup viewGroup = (ViewGroup) this.videoPlayerContainer.getParent();
if (viewGroup != null && viewGroup != this.contentView) {
viewGroup.removeView(this.videoPlayerContainer);
viewGroup = null;
}
if (viewGroup == null) {
this.contentView.addView(this.videoPlayerContainer, 1, new FrameLayout.LayoutParams(AndroidUtilities.roundMessageSize, AndroidUtilities.roundMessageSize));
}
this.videoPlayerContainer.setTag(null);
this.aspectRatioFrameLayout.setDrawingReady(false);
return this.videoTextureView;
}
private void destroyTextureView() {
FrameLayout frameLayout = this.videoPlayerContainer;
if (frameLayout == null || frameLayout.getParent() == null) {
return;
}
this.contentView.removeView(this.videoPlayerContainer);
this.aspectRatioFrameLayout.setDrawingReady(false);
this.videoPlayerContainer.setTag(null);
if (Build.VERSION.SDK_INT < 21) {
this.videoPlayerContainer.setLayerType(0, null);
}
}
public void openForward() {
SparseArray<MessageObject>[] sparseArrayArr;
Bundle bundle = new Bundle();
bundle.putBoolean("onlySelect", true);
int i = 3;
for (SparseArray<MessageObject> sparseArray : this.selectedMessagesIds) {
int i2 = 0;
while (true) {
if (i2 >= sparseArray.size()) {
break;
}
MessageObject valueAt = sparseArray.valueAt(i2);
if (valueAt != null && (valueAt.messageOwner.media instanceof TLRPC.TL_messageMediaShareContact)) {
i = 7;
break;
}
i2++;
}
if (i == 7) {
break;
}
}
bundle.putInt("dialogsType", i);
bundle.putInt("messagesCount", this.canForwardMessagesCount);
DialogsActivity dialogsActivity = new DialogsActivity(bundle);
dialogsActivity.setDelegate(this);
presentFragment(dialogsActivity);
}
private void showBottomOverlayProgress(final boolean z, boolean z2) {
if (!z || this.bottomOverlayProgress.getTag() == null) {
if (z || this.bottomOverlayProgress.getTag() != null) {
AnimatorSet animatorSet = this.bottomOverlayAnimation;
if (animatorSet != null) {
animatorSet.cancel();
this.bottomOverlayAnimation = null;
}
this.bottomOverlayProgress.setTag(z ? 1 : null);
if (z2) {
this.bottomOverlayAnimation = new AnimatorSet();
if (z) {
this.bottomOverlayProgress.setVisibility(0);
this.bottomOverlayAnimation.playTogether(ObjectAnimator.ofFloat(this.bottomOverlayChatText, View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.bottomOverlayChatText, View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.bottomOverlayChatText, View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.bottomOverlayChatText2, View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.bottomOverlayChatText2, View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.bottomOverlayChatText2, View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.bottomOverlayProgress, View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.bottomOverlayProgress, View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.bottomOverlayProgress, View.ALPHA, 1.0f));
} else {
this.bottomOverlayChatText.setVisibility(0);
this.bottomOverlayAnimation.playTogether(ObjectAnimator.ofFloat(this.bottomOverlayProgress, View.SCALE_X, 0.1f), ObjectAnimator.ofFloat(this.bottomOverlayProgress, View.SCALE_Y, 0.1f), ObjectAnimator.ofFloat(this.bottomOverlayProgress, View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.bottomOverlayChatText, View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.bottomOverlayChatText, View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.bottomOverlayChatText, View.ALPHA, 1.0f), ObjectAnimator.ofFloat(this.bottomOverlayChatText2, View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.bottomOverlayChatText2, View.SCALE_Y, 1.0f), ObjectAnimator.ofFloat(this.bottomOverlayChatText2, View.ALPHA, 1.0f));
}
this.bottomOverlayAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.bottomOverlayAnimation == null || !ChatActivity.this.bottomOverlayAnimation.equals(animator)) {
return;
}
if (!z) {
ChatActivity.this.bottomOverlayProgress.setVisibility(4);
} else {
ChatActivity.this.bottomOverlayChatText.setVisibility(4);
}
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.bottomOverlayAnimation == null || !ChatActivity.this.bottomOverlayAnimation.equals(animator)) {
return;
}
ChatActivity.this.bottomOverlayAnimation = null;
}
});
this.bottomOverlayAnimation.setDuration(150L);
this.bottomOverlayAnimation.start();
return;
}
this.bottomOverlayProgress.setVisibility(z ? 0 : 4);
this.bottomOverlayProgress.setScaleX(z ? 1.0f : 0.1f);
this.bottomOverlayProgress.setScaleY(z ? 1.0f : 0.1f);
this.bottomOverlayProgress.setAlpha(1.0f);
this.bottomOverlayChatText.setVisibility(z ? 4 : 0);
this.bottomOverlayChatText.setScaleX(z ? 0.1f : 1.0f);
this.bottomOverlayChatText.setScaleY(z ? 0.1f : 1.0f);
this.bottomOverlayChatText.setAlpha(z ? 0.0f : 1.0f);
this.bottomOverlayChatText2.setScaleX(z ? 0.1f : 1.0f);
this.bottomOverlayChatText2.setScaleY(z ? 0.1f : 1.0f);
this.bottomOverlayChatText2.setAlpha(z ? 0.0f : 1.0f);
}
}
}
public void lambda$null$20$ChatActivity(TLRPC.BotInlineResult botInlineResult, boolean z, int i) {
int contextBotId = this.mentionsAdapter.getContextBotId();
HashMap hashMap = new HashMap();
hashMap.put(TtmlNode.ATTR_ID, botInlineResult.id);
hashMap.put("query_id", "" + botInlineResult.query_id);
hashMap.put("bot", "" + contextBotId);
hashMap.put("bot_name", this.mentionsAdapter.getContextBotName());
SendMessagesHelper.prepareSendingBotContextResult(getAccountInstance(), botInlineResult, hashMap, this.dialog_id, this.replyingMessageObject, z, i);
this.chatActivityEnterView.setFieldText("");
hideFieldPanel(false);
getMediaDataController().increaseInlineRaiting(contextBotId);
}
public void mentionListViewUpdateLayout() {
if (this.mentionListView.getChildCount() <= 0) {
this.mentionListViewScrollOffsetY = 0;
this.mentionListViewLastViewPosition = -1;
return;
}
RecyclerListView recyclerListView = this.mentionListView;
View childAt = recyclerListView.getChildAt(recyclerListView.getChildCount() - 1);
RecyclerListView.Holder holder = (RecyclerListView.Holder) this.mentionListView.findContainingViewHolder(childAt);
if (this.mentionLayoutManager.getReverseLayout()) {
if (holder != null) {
this.mentionListViewLastViewPosition = holder.getAdapterPosition();
this.mentionListViewLastViewTop = childAt.getBottom();
} else {
this.mentionListViewLastViewPosition = -1;
}
View childAt2 = this.mentionListView.getChildAt(0);
RecyclerListView.Holder holder2 = (RecyclerListView.Holder) this.mentionListView.findContainingViewHolder(childAt2);
int measuredHeight = (childAt2.getBottom() >= this.mentionListView.getMeasuredHeight() || holder2 == null || holder2.getAdapterPosition() != 0) ? this.mentionListView.getMeasuredHeight() : childAt2.getBottom();
if (this.mentionListViewScrollOffsetY != measuredHeight) {
RecyclerListView recyclerListView2 = this.mentionListView;
this.mentionListViewScrollOffsetY = measuredHeight;
recyclerListView2.setBottomGlowOffset(measuredHeight);
this.mentionListView.setTopGlowOffset(0);
this.mentionListView.invalidate();
this.mentionContainer.invalidate();
return;
}
return;
}
if (holder != null) {
this.mentionListViewLastViewPosition = holder.getAdapterPosition();
this.mentionListViewLastViewTop = childAt.getTop();
} else {
this.mentionListViewLastViewPosition = -1;
}
View childAt3 = this.mentionListView.getChildAt(0);
RecyclerListView.Holder holder3 = (RecyclerListView.Holder) this.mentionListView.findContainingViewHolder(childAt3);
int top = (childAt3.getTop() <= 0 || holder3 == null || holder3.getAdapterPosition() != 0) ? 0 : childAt3.getTop();
if (this.mentionListViewScrollOffsetY != top) {
RecyclerListView recyclerListView3 = this.mentionListView;
this.mentionListViewScrollOffsetY = top;
recyclerListView3.setTopGlowOffset(top);
this.mentionListView.setBottomGlowOffset(0);
this.mentionListView.invalidate();
this.mentionContainer.invalidate();
}
}
private void checkBotCommands() {
TLRPC.Chat chat;
r0 = false;
r0 = false;
boolean z = false;
URLSpanBotCommand.enabled = false;
TLRPC.User user = this.currentUser;
if (user != null && user.bot) {
URLSpanBotCommand.enabled = true;
return;
}
TLRPC.ChatFull chatFull = this.chatInfo;
if (chatFull instanceof TLRPC.TL_chatFull) {
for (int i = 0; i < this.chatInfo.participants.participants.size(); i++) {
TLRPC.User user2 = getMessagesController().getUser(Integer.valueOf(this.chatInfo.participants.participants.get(i).user_id));
if (user2 != null && user2.bot) {
URLSpanBotCommand.enabled = true;
return;
}
}
} else if (chatFull instanceof TLRPC.TL_channelFull) {
if (!chatFull.bot_info.isEmpty() && (chat = this.currentChat) != null && chat.megagroup) {
z = true;
}
URLSpanBotCommand.enabled = z;
}
}
public MessageObject.GroupedMessages getValidGroupedMessage(MessageObject messageObject) {
if (messageObject.getGroupId() != 0) {
MessageObject.GroupedMessages groupedMessages = this.groupedMessagesMap.get(messageObject.getGroupId());
if (groupedMessages == null || (groupedMessages.messages.size() > 1 && groupedMessages.positions.get(messageObject) != null)) {
return groupedMessages;
}
return null;
}
return null;
}
private void jumpToDate(int i) {
if (this.messages.isEmpty()) {
return;
}
ArrayList<MessageObject> arrayList = this.messages;
MessageObject messageObject = arrayList.get(arrayList.size() - 1);
if (this.messages.get(0).messageOwner.date >= i && messageObject.messageOwner.date <= i) {
for (int size = this.messages.size() - 1; size >= 0; size--) {
MessageObject messageObject2 = this.messages.get(size);
if (messageObject2.messageOwner.date >= i && messageObject2.getId() != 0) {
scrollToMessageId(messageObject2.getId(), 0, false, messageObject2.getDialogId() != this.mergeDialogId ? 0 : 1, false);
return;
}
}
} else if (((int) this.dialog_id) != 0) {
clearChatData();
this.waitingForLoad.add(Integer.valueOf(this.lastLoadIndex));
MessagesController messagesController = getMessagesController();
long j = this.dialog_id;
int i2 = this.classGuid;
boolean isChannel = ChatObject.isChannel(this.currentChat);
boolean z = this.inScheduleMode;
int i3 = this.lastLoadIndex;
this.lastLoadIndex = i3 + 1;
messagesController.loadMessages(j, 30, 0, i, true, 0, i2, 4, 0, isChannel, z, i3);
this.floatingDateView.setAlpha(0.0f);
this.floatingDateView.setTag(null);
}
}
public void processInlineBotContextPM(TLRPC.TL_inlineBotSwitchPM tL_inlineBotSwitchPM) {
TLRPC.User contextBotUser;
if (tL_inlineBotSwitchPM == null || (contextBotUser = this.mentionsAdapter.getContextBotUser()) == null) {
return;
}
this.chatActivityEnterView.setFieldText("");
if (this.dialog_id == contextBotUser.id) {
this.inlineReturn = this.dialog_id;
getMessagesController().sendBotStart(this.currentUser, tL_inlineBotSwitchPM.start_param);
return;
}
Bundle bundle = new Bundle();
bundle.putInt("user_id", contextBotUser.id);
bundle.putString("inline_query", tL_inlineBotSwitchPM.start_param);
bundle.putLong("inline_return", this.dialog_id);
if (getMessagesController().checkCanOpenChat(bundle, this)) {
presentFragment(new ChatActivity(bundle));
}
}
private void createChatAttachView() {
if (getParentActivity() != null && this.chatAttachAlert == null) {
AnonymousClass39 anonymousClass39 = new AnonymousClass39(getParentActivity(), this);
this.chatAttachAlert = anonymousClass39;
anonymousClass39.setDelegate(new ChatAttachAlert.ChatAttachViewDelegate() {
@Override
public void didPressedButton(int i, boolean z, boolean z2, int i2) {
if (ChatActivity.this.getParentActivity() == null || ChatActivity.this.chatAttachAlert == null) {
return;
}
if (ChatActivity.this.chatAttachAlert == null) {
ChatActivity.this.editingMessageObject = null;
} else {
ChatActivity chatActivity = ChatActivity.this;
chatActivity.editingMessageObject = chatActivity.chatAttachAlert.getEditingMessageObject();
}
if (i == 8 || i == 7 || (i == 4 && !ChatActivity.this.chatAttachAlert.getSelectedPhotos().isEmpty())) {
if (i != 8) {
ChatActivity.this.chatAttachAlert.dismiss();
}
HashMap<Object, Object> selectedPhotos = ChatActivity.this.chatAttachAlert.getSelectedPhotos();
ArrayList<Object> selectedPhotosOrder = ChatActivity.this.chatAttachAlert.getSelectedPhotosOrder();
if (!selectedPhotos.isEmpty()) {
ArrayList arrayList = new ArrayList();
for (int i3 = 0; i3 < selectedPhotosOrder.size(); i3++) {
MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) selectedPhotos.get(selectedPhotosOrder.get(i3));
SendMessagesHelper.SendingMediaInfo sendingMediaInfo = new SendMessagesHelper.SendingMediaInfo();
if (photoEntry.imagePath != null) {
sendingMediaInfo.path = photoEntry.imagePath;
} else if (photoEntry.path != null) {
sendingMediaInfo.path = photoEntry.path;
}
sendingMediaInfo.isVideo = photoEntry.isVideo;
sendingMediaInfo.caption = photoEntry.caption != null ? photoEntry.caption.toString() : null;
sendingMediaInfo.entities = photoEntry.entities;
sendingMediaInfo.masks = !photoEntry.stickers.isEmpty() ? new ArrayList<>(photoEntry.stickers) : null;
sendingMediaInfo.ttl = photoEntry.ttl;
sendingMediaInfo.videoEditedInfo = photoEntry.editedInfo;
sendingMediaInfo.canDeleteAfter = photoEntry.canDeleteAfter;
arrayList.add(sendingMediaInfo);
photoEntry.reset();
}
ChatActivity.this.fillEditingMediaWithCaption(((SendMessagesHelper.SendingMediaInfo) arrayList.get(0)).caption, ((SendMessagesHelper.SendingMediaInfo) arrayList.get(0)).entities);
SendMessagesHelper.prepareSendingMedia(ChatActivity.this.getAccountInstance(), arrayList, ChatActivity.this.dialog_id, ChatActivity.this.replyingMessageObject, null, i == 4, z, ChatActivity.this.editingMessageObject, z2, i2, false);
ChatActivity.this.afterMessageSend();
}
if (i2 != 0) {
if (ChatActivity.this.scheduledMessagesCount == -1) {
ChatActivity.this.scheduledMessagesCount = 0;
}
ChatActivity.this.scheduledMessagesCount += selectedPhotos.size();
ChatActivity.this.updateScheduledInterface(true);
return;
}
return;
}
if (ChatActivity.this.chatAttachAlert != null) {
ChatActivity.this.chatAttachAlert.dismissWithButtonClick(i);
}
ChatActivity.this.processSelectedAttach(i);
}
@Override
public View getRevealView() {
return ChatActivity.this.chatActivityEnterView.getAttachButton();
}
@Override
public void didSelectBot(TLRPC.User user) {
if (ChatActivity.this.chatActivityEnterView == null || TextUtils.isEmpty(user.username)) {
return;
}
ChatActivityEnterView chatActivityEnterView = ChatActivity.this.chatActivityEnterView;
chatActivityEnterView.setFieldText("@" + user.username + " ");
ChatActivity.this.chatActivityEnterView.openKeyboard();
}
@Override
public void onCameraOpened() {
ChatActivity.this.chatActivityEnterView.closeKeyboard();
}
@Override
public void needEnterComment() {
if (ChatActivity.this.chatActivityEnterView.isKeyboardVisible()) {
ChatActivity.this.chatActivityEnterView.showEmojiView();
ChatActivity.this.openKeyboardOnAttachMenuClose = true;
}
AndroidUtilities.setAdjustResizeToNothing(ChatActivity.this.getParentActivity(), ChatActivity.this.classGuid);
ChatActivity.this.fragmentView.requestLayout();
}
});
}
}
public class AnonymousClass39 extends ChatAttachAlert {
AnonymousClass39(Context context, BaseFragment baseFragment) {
super(context, baseFragment);
}
@Override
public void dismissInternal() {
if (ChatActivity.this.chatAttachAlert.isShowing()) {
AndroidUtilities.requestAdjustResize(ChatActivity.this.getParentActivity(), ChatActivity.this.classGuid);
if (ChatActivity.this.chatActivityEnterView.getVisibility() == 0 && ChatActivity.this.fragmentView != null) {
ChatActivity.this.fragmentView.requestLayout();
}
}
super.dismissInternal();
if (ChatActivity.this.openKeyboardOnAttachMenuClose) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.AnonymousClass39.this.lambda$dismissInternal$0$ChatActivity$39();
}
}, 50L);
ChatActivity.this.openKeyboardOnAttachMenuClose = false;
}
}
public void lambda$dismissInternal$0$ChatActivity$39() {
ChatActivity.this.chatActivityEnterView.openKeyboard();
}
}
public long getDialogId() {
return this.dialog_id;
}
public boolean hasReportSpam() {
FrameLayout frameLayout = this.topChatPanelView;
return (frameLayout == null || frameLayout.getTag() != null || this.reportSpamButton.getVisibility() == 8) ? false : true;
}
public void setBotUser(String str) {
if (this.inlineReturn != 0) {
getMessagesController().sendBotStart(this.currentUser, str);
return;
}
this.botUser = str;
updateBottomOverlay();
}
public void afterMessageSend() {
hideFieldPanel(false);
if (this.inScheduleMode) {
return;
}
getMediaDataController().cleanDraft(this.dialog_id, true);
}
public boolean playFirstUnreadVoiceMessage() {
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView == null || !chatActivityEnterView.isRecordingAudioVideo()) {
for (int size = this.messages.size() - 1; size >= 0; size--) {
MessageObject messageObject = this.messages.get(size);
if ((messageObject.isVoice() || messageObject.isRoundVideo()) && messageObject.isContentUnread() && !messageObject.isOut()) {
MediaController.getInstance().setVoiceMessagesPlaylist(MediaController.getInstance().playMessage(messageObject) ? createVoiceMessagesPlaylist(messageObject, true) : null, true);
return true;
}
}
if (Build.VERSION.SDK_INT < 23 || getParentActivity() == null || getParentActivity().checkSelfPermission(PermissionUtils.RECORD_AUDIO) == 0) {
return false;
}
getParentActivity().requestPermissions(new String[]{PermissionUtils.RECORD_AUDIO}, 3);
return true;
}
return true;
}
public void openScheduledMessages() {
if (this.parentLayout == null || this.parentLayout.getLastFragment() != this) {
return;
}
Bundle bundle = new Bundle();
TLRPC.EncryptedChat encryptedChat = this.currentEncryptedChat;
if (encryptedChat != null) {
bundle.putInt("enc_id", encryptedChat.id);
} else {
TLRPC.Chat chat = this.currentChat;
if (chat != null) {
bundle.putInt("chat_id", chat.id);
} else {
bundle.putInt("user_id", this.currentUser.id);
}
}
bundle.putBoolean("scheduled", true);
ChatActivity chatActivity = new ChatActivity(bundle);
chatActivity.chatActivityDelegate = new ChatActivityDelegate() {
@Override
public final void openReplyMessage(int i) {
ChatActivity.this.lambda$openScheduledMessages$47$ChatActivity(i);
}
};
presentFragment(chatActivity, false);
}
public void lambda$openScheduledMessages$47$ChatActivity(int i) {
scrollToMessageId(i, 0, true, 0, false);
}
private void initStickers() {
if (this.chatActivityEnterView == null || getParentActivity() == null || this.stickersAdapter != null) {
return;
}
TLRPC.EncryptedChat encryptedChat = this.currentEncryptedChat;
if (encryptedChat == null || AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 23) {
this.stickersListView.setPadding(AndroidUtilities.dp(18.0f), 0, AndroidUtilities.dp(18.0f), 0);
RecyclerListView recyclerListView = this.stickersListView;
StickersAdapter stickersAdapter = new StickersAdapter(getParentActivity(), new StickersAdapter.StickersAdapterDelegate() {
@Override
public final void needChangePanelVisibility(boolean z) {
ChatActivity.this.lambda$initStickers$48$ChatActivity(z);
}
});
this.stickersAdapter = stickersAdapter;
recyclerListView.setAdapter(stickersAdapter);
RecyclerListView recyclerListView2 = this.stickersListView;
RecyclerListView.OnItemClickListener onItemClickListener = new RecyclerListView.OnItemClickListener() {
@Override
public final void onItemClick(View view, int i) {
ChatActivity.this.lambda$initStickers$50$ChatActivity(view, i);
}
};
this.stickersOnItemClickListener = onItemClickListener;
recyclerListView2.setOnItemClickListener(onItemClickListener);
}
}
public void lambda$initStickers$48$ChatActivity(final boolean z) {
if (z) {
int dp = this.stickersAdapter.isShowingKeywords() ? AndroidUtilities.dp(24.0f) : 0;
if (dp != this.stickersListView.getPaddingTop() || this.stickersPanel.getTag() == null) {
this.stickersListView.setPadding(AndroidUtilities.dp(18.0f), dp, AndroidUtilities.dp(18.0f), 0);
this.stickersListView.scrollToPosition(0);
((FrameLayout.LayoutParams) this.stickersPanelArrow.getLayoutParams()).gravity = (this.chatActivityEnterView.isRtlText() ? 5 : 3) | 80;
this.stickersPanelArrow.requestLayout();
}
}
if (!z || this.stickersPanel.getTag() == null) {
if (z || this.stickersPanel.getTag() != null) {
if (z) {
this.stickersPanel.setVisibility(this.allowStickersPanel ? 0 : 4);
this.stickersPanel.setTag(1);
} else {
this.stickersPanel.setTag(null);
}
AnimatorSet animatorSet = this.runningAnimation;
if (animatorSet != null) {
animatorSet.cancel();
this.runningAnimation = null;
}
if (this.stickersPanel.getVisibility() == 4) {
if (z) {
return;
}
this.stickersPanel.setVisibility(8);
return;
}
AnimatorSet animatorSet2 = new AnimatorSet();
this.runningAnimation = animatorSet2;
Animator[] animatorArr = new Animator[1];
FrameLayout frameLayout = this.stickersPanel;
Property property = View.ALPHA;
float[] fArr = new float[2];
fArr[0] = z ? 0.0f : 1.0f;
fArr[1] = z ? 1.0f : 0.0f;
animatorArr[0] = ObjectAnimator.ofFloat(frameLayout, property, fArr);
animatorSet2.playTogether(animatorArr);
this.runningAnimation.setDuration(150L);
this.runningAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.runningAnimation == null || !ChatActivity.this.runningAnimation.equals(animator)) {
return;
}
if (!z) {
ChatActivity.this.stickersAdapter.clearStickers();
ChatActivity.this.stickersPanel.setVisibility(8);
if (ContentPreviewViewer.getInstance().isVisible()) {
ContentPreviewViewer.getInstance().close();
}
ContentPreviewViewer.getInstance().reset();
}
ChatActivity.this.runningAnimation = null;
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.runningAnimation == null || !ChatActivity.this.runningAnimation.equals(animator)) {
return;
}
ChatActivity.this.runningAnimation = null;
}
});
this.runningAnimation.start();
}
}
}
public void lambda$initStickers$50$ChatActivity(View view, int i) {
Object item = this.stickersAdapter.getItem(i);
final Object itemParent = this.stickersAdapter.getItemParent(i);
if (item instanceof TLRPC.TL_document) {
if (this.inScheduleMode || !checkSlowMode(view)) {
final TLRPC.TL_document tL_document = (TLRPC.TL_document) item;
if (this.inScheduleMode) {
AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), UserObject.isUserSelf(this.currentUser), new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public final void didSelectDate(boolean z, int i2) {
ChatActivity.this.lambda$null$49$ChatActivity(tL_document, itemParent, z, i2);
}
});
} else {
getSendMessagesHelper().sendSticker(tL_document, this.dialog_id, this.replyingMessageObject, itemParent, true, 0);
}
hideFieldPanel(false);
this.chatActivityEnterView.addStickerToRecent(tL_document);
this.chatActivityEnterView.setFieldText("");
}
} else if (item instanceof String) {
SpannableString spannableString = new SpannableString((String) item);
Emoji.replaceEmoji(spannableString, this.chatActivityEnterView.getEditField().getPaint().getFontMetricsInt(), AndroidUtilities.dp(20.0f), false);
this.chatActivityEnterView.setFieldText(spannableString, false);
}
}
public void lambda$null$49$ChatActivity(TLRPC.TL_document tL_document, Object obj, boolean z, int i) {
SendMessagesHelper.getInstance(this.currentAccount).sendSticker(tL_document, this.dialog_id, this.replyingMessageObject, obj, z, i);
}
public void shareMyContact(final int i, final MessageObject messageObject) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("ShareYouPhoneNumberTitle", R.string.ShareYouPhoneNumberTitle));
TLRPC.User user = this.currentUser;
if (user != null) {
if (user.bot) {
builder.setMessage(LocaleController.getString("AreYouSureShareMyContactInfoBot", R.string.AreYouSureShareMyContactInfoBot));
} else {
PhoneFormat phoneFormat = PhoneFormat.getInstance();
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("AreYouSureShareMyContactInfoUser", R.string.AreYouSureShareMyContactInfoUser, phoneFormat.format(Marker.ANY_NON_NULL_MARKER + getUserConfig().getCurrentUser().phone), ContactsController.formatName(this.currentUser.first_name, this.currentUser.last_name))));
}
} else {
builder.setMessage(LocaleController.getString("AreYouSureShareMyContactInfo", R.string.AreYouSureShareMyContactInfo));
}
builder.setPositiveButton(LocaleController.getString("ShareContact", R.string.ShareContact), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
ChatActivity.this.lambda$shareMyContact$52$ChatActivity(i, messageObject, dialogInterface, i2);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
}
public void lambda$shareMyContact$52$ChatActivity(int i, MessageObject messageObject, DialogInterface dialogInterface, int i2) {
if (i == 1) {
TLRPC.TL_contacts_acceptContact tL_contacts_acceptContact = new TLRPC.TL_contacts_acceptContact();
tL_contacts_acceptContact.id = getMessagesController().getInputUser(this.currentUser);
getConnectionsManager().sendRequest(tL_contacts_acceptContact, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChatActivity.this.lambda$null$51$ChatActivity(tLObject, tL_error);
}
});
return;
}
SendMessagesHelper.getInstance(this.currentAccount).sendMessage(getUserConfig().getCurrentUser(), this.dialog_id, messageObject, (TLRPC.ReplyMarkup) null, (HashMap<String, String>) null, true, 0);
if (!this.inScheduleMode) {
moveScrollToLastMessage();
}
hideFieldPanel(false);
}
public void lambda$null$51$ChatActivity(TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error != null) {
return;
}
getMessagesController().processUpdates((TLRPC.Updates) tLObject, false);
}
public void hideVoiceHint() {
if (this.voiceHintTextView == null) {
return;
}
AnimatorSet animatorSet = new AnimatorSet();
this.voiceHintAnimation = animatorSet;
animatorSet.playTogether(ObjectAnimator.ofFloat(this.voiceHintTextView, View.ALPHA, 0.0f));
this.voiceHintAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (animator.equals(ChatActivity.this.voiceHintAnimation)) {
ChatActivity.this.voiceHintAnimation = null;
ChatActivity.this.voiceHintHideRunnable = null;
if (ChatActivity.this.voiceHintTextView != null) {
ChatActivity.this.voiceHintTextView.setVisibility(8);
}
}
}
@Override
public void onAnimationCancel(Animator animator) {
if (animator.equals(ChatActivity.this.voiceHintAnimation)) {
ChatActivity.this.voiceHintAnimation = null;
ChatActivity.this.voiceHintHideRunnable = null;
}
}
});
this.voiceHintAnimation.setDuration(300L);
this.voiceHintAnimation.start();
}
public void showVoiceHint(boolean z, boolean z2) {
int i;
String str;
if (getParentActivity() == null || this.fragmentView == null) {
return;
}
if ((z && this.voiceHintTextView == null) || this.inScheduleMode) {
return;
}
if (this.voiceHintTextView == null) {
SizeNotifierFrameLayout sizeNotifierFrameLayout = (SizeNotifierFrameLayout) this.fragmentView;
int indexOfChild = sizeNotifierFrameLayout.indexOfChild(this.chatActivityEnterView);
if (indexOfChild == -1) {
return;
}
TextView textView = new TextView(getParentActivity());
this.voiceHintTextView = textView;
textView.setBackgroundDrawable(Theme.createRoundRectDrawable(AndroidUtilities.dp(3.0f), Theme.getColor(Theme.key_chat_gifSaveHintBackground)));
this.voiceHintTextView.setTextColor(Theme.getColor(Theme.key_chat_gifSaveHintText));
this.voiceHintTextView.setTextSize(1, 14.0f);
this.voiceHintTextView.setPadding(AndroidUtilities.dp(8.0f), AndroidUtilities.dp(7.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(7.0f));
this.voiceHintTextView.setGravity(16);
this.voiceHintTextView.setAlpha(0.0f);
sizeNotifierFrameLayout.addView(this.voiceHintTextView, indexOfChild + 1, LayoutHelper.createFrame(-2.0f, -2.0f, 85, 5.0f, 0.0f, 5.0f, 3.0f));
}
if (z) {
AnimatorSet animatorSet = this.voiceHintAnimation;
if (animatorSet != null) {
animatorSet.cancel();
this.voiceHintAnimation = null;
}
AndroidUtilities.cancelRunOnUIThread(this.voiceHintHideRunnable);
this.voiceHintHideRunnable = null;
if (this.voiceHintTextView.getVisibility() == 0) {
hideVoiceHint();
return;
}
return;
}
TextView textView2 = this.voiceHintTextView;
if (z2) {
i = R.string.HoldToVideo;
str = "HoldToVideo";
} else {
i = R.string.HoldToAudio;
str = "HoldToAudio";
}
textView2.setText(LocaleController.getString(str, i));
Runnable runnable = this.voiceHintHideRunnable;
if (runnable != null) {
AnimatorSet animatorSet2 = this.voiceHintAnimation;
if (animatorSet2 != null) {
animatorSet2.cancel();
this.voiceHintAnimation = null;
} else {
AndroidUtilities.cancelRunOnUIThread(runnable);
Runnable runnable2 = new Runnable() {
@Override
public final void run() {
ChatActivity.this.hideVoiceHint();
}
};
this.voiceHintHideRunnable = runnable2;
AndroidUtilities.runOnUIThread(runnable2, AdaptiveTrackSelection.DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS);
return;
}
} else if (this.voiceHintAnimation != null) {
return;
}
this.voiceHintTextView.setVisibility(0);
AnimatorSet animatorSet3 = new AnimatorSet();
this.voiceHintAnimation = animatorSet3;
animatorSet3.playTogether(ObjectAnimator.ofFloat(this.voiceHintTextView, View.ALPHA, 1.0f));
this.voiceHintAnimation.addListener(new AnonymousClass43());
this.voiceHintAnimation.setDuration(300L);
this.voiceHintAnimation.start();
}
public class AnonymousClass43 extends AnimatorListenerAdapter {
AnonymousClass43() {
}
@Override
public void onAnimationEnd(Animator animator) {
if (animator.equals(ChatActivity.this.voiceHintAnimation)) {
ChatActivity.this.voiceHintAnimation = null;
AndroidUtilities.runOnUIThread(ChatActivity.this.voiceHintHideRunnable = new Runnable() {
@Override
public final void run() {
ChatActivity.AnonymousClass43.this.lambda$onAnimationEnd$0$ChatActivity$43();
}
}, AdaptiveTrackSelection.DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS);
}
}
public void lambda$onAnimationEnd$0$ChatActivity$43() {
ChatActivity.this.hideVoiceHint();
}
@Override
public void onAnimationCancel(Animator animator) {
if (animator.equals(ChatActivity.this.voiceHintAnimation)) {
ChatActivity.this.voiceHintAnimation = null;
}
}
}
private boolean checkSlowMode(View view) {
CharSequence slowModeTimer = this.chatActivityEnterView.getSlowModeTimer();
if (slowModeTimer != null) {
showSlowModeHint(view, true, slowModeTimer);
return true;
}
return false;
}
public void showSlowModeHint(View view, boolean z, CharSequence charSequence) {
HintView hintView;
if (getParentActivity() == null || this.fragmentView == null) {
return;
}
if (z || ((hintView = this.slowModeHint) != null && hintView.getVisibility() == 0)) {
this.slowModeHint.setText(AndroidUtilities.replaceTags(LocaleController.formatString("SlowModeHint", R.string.SlowModeHint, charSequence)));
if (z) {
this.slowModeHint.showForView(view, true);
}
}
}
public void showMediaBannedHint() {
SizeNotifierFrameLayout sizeNotifierFrameLayout;
int indexOfChild;
if (getParentActivity() == null || this.currentChat == null || this.fragmentView == null) {
return;
}
TextView textView = this.mediaBanTooltip;
if ((textView == null || textView.getVisibility() != 0) && (indexOfChild = (sizeNotifierFrameLayout = (SizeNotifierFrameLayout) this.fragmentView).indexOfChild(this.chatActivityEnterView)) != -1) {
if (this.mediaBanTooltip == null) {
CorrectlyMeasuringTextView correctlyMeasuringTextView = new CorrectlyMeasuringTextView(getParentActivity());
this.mediaBanTooltip = correctlyMeasuringTextView;
correctlyMeasuringTextView.setBackgroundDrawable(Theme.createRoundRectDrawable(AndroidUtilities.dp(3.0f), Theme.getColor(Theme.key_chat_gifSaveHintBackground)));
this.mediaBanTooltip.setTextColor(Theme.getColor(Theme.key_chat_gifSaveHintText));
this.mediaBanTooltip.setPadding(AndroidUtilities.dp(8.0f), AndroidUtilities.dp(7.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(7.0f));
this.mediaBanTooltip.setGravity(16);
this.mediaBanTooltip.setTextSize(1, 14.0f);
this.mediaBanTooltip.setVisibility(8);
sizeNotifierFrameLayout.addView(this.mediaBanTooltip, indexOfChild + 1, LayoutHelper.createFrame(-2.0f, -2.0f, 85, 30.0f, 0.0f, 5.0f, 3.0f));
}
if (ChatObject.isActionBannedByDefault(this.currentChat, 7)) {
this.mediaBanTooltip.setText(LocaleController.getString("GlobalAttachMediaRestricted", R.string.GlobalAttachMediaRestricted));
} else if (this.currentChat.banned_rights == null) {
return;
} else {
if (AndroidUtilities.isBannedForever(this.currentChat.banned_rights)) {
this.mediaBanTooltip.setText(LocaleController.getString("AttachMediaRestrictedForever", R.string.AttachMediaRestrictedForever));
} else {
this.mediaBanTooltip.setText(LocaleController.formatString("AttachMediaRestricted", R.string.AttachMediaRestricted, LocaleController.formatDateForBan(this.currentChat.banned_rights.until_date)));
}
}
this.mediaBanTooltip.setVisibility(0);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(this.mediaBanTooltip, View.ALPHA, 0.0f, 1.0f));
animatorSet.addListener(new AnonymousClass44());
animatorSet.setDuration(300L);
animatorSet.start();
}
}
public class AnonymousClass44 extends AnimatorListenerAdapter {
AnonymousClass44() {
}
@Override
public void onAnimationEnd(Animator animator) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.AnonymousClass44.this.lambda$onAnimationEnd$0$ChatActivity$44();
}
}, DefaultRenderersFactory.DEFAULT_ALLOWED_VIDEO_JOINING_TIME_MS);
}
public void lambda$onAnimationEnd$0$ChatActivity$44() {
if (ChatActivity.this.mediaBanTooltip == null) {
return;
}
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(ChatActivity.this.mediaBanTooltip, View.ALPHA, 0.0f));
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.mediaBanTooltip != null) {
ChatActivity.this.mediaBanTooltip.setVisibility(8);
}
}
});
animatorSet.setDuration(300L);
animatorSet.start();
}
}
public void showNoSoundHint() {
ChatMessageCell chatMessageCell;
MessageObject messageObject;
AnimatedFileDrawable animation;
if (this.scrollingChatListView || SharedConfig.noSoundHintShowed || this.chatListView == null || getParentActivity() == null || this.fragmentView == null) {
return;
}
HintView hintView = this.noSoundHintView;
if (hintView == null || hintView.getTag() == null) {
if (this.noSoundHintView == null) {
SizeNotifierFrameLayout sizeNotifierFrameLayout = (SizeNotifierFrameLayout) this.fragmentView;
int indexOfChild = sizeNotifierFrameLayout.indexOfChild(this.chatActivityEnterView);
if (indexOfChild == -1) {
return;
}
HintView hintView2 = new HintView(getParentActivity(), 0);
this.noSoundHintView = hintView2;
sizeNotifierFrameLayout.addView(hintView2, indexOfChild + 1, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 19.0f, 0.0f, 19.0f, 0.0f));
this.noSoundHintView.setAlpha(0.0f);
this.noSoundHintView.setVisibility(4);
}
int childCount = this.chatListView.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = this.chatListView.getChildAt(i);
if ((childAt instanceof ChatMessageCell) && (messageObject = (chatMessageCell = (ChatMessageCell) childAt).getMessageObject()) != null && messageObject.isVideo() && (animation = chatMessageCell.getPhotoImage().getAnimation()) != null && animation.getCurrentProgressMs() >= 3000 && this.noSoundHintView.showForMessageCell(chatMessageCell, true)) {
SharedConfig.setNoSoundHintShowed(true);
return;
}
}
}
}
public void showForwardHint(ChatMessageCell chatMessageCell) {
if (this.scrollingChatListView || this.chatListView == null || getParentActivity() == null || this.fragmentView == null) {
return;
}
if (this.forwardHintView == null) {
SizeNotifierFrameLayout sizeNotifierFrameLayout = (SizeNotifierFrameLayout) this.fragmentView;
int indexOfChild = sizeNotifierFrameLayout.indexOfChild(this.chatActivityEnterView);
if (indexOfChild == -1) {
return;
}
HintView hintView = new HintView(getParentActivity(), 1);
this.forwardHintView = hintView;
sizeNotifierFrameLayout.addView(hintView, indexOfChild + 1, LayoutHelper.createFrame(-2.0f, -2.0f, 51, 19.0f, 0.0f, 19.0f, 0.0f));
this.forwardHintView.setAlpha(0.0f);
this.forwardHintView.setVisibility(4);
}
this.forwardHintView.showForMessageCell(chatMessageCell, true);
}
private void showGifHint() {
SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
if (globalMainSettings.getBoolean("gifhint", false)) {
return;
}
globalMainSettings.edit().putBoolean("gifhint", true).commit();
if (getParentActivity() == null || this.fragmentView == null || this.gifHintTextView != null) {
return;
}
if (!this.allowContextBotPanelSecond) {
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null) {
chatActivityEnterView.setOpenGifsTabFirst();
return;
}
return;
}
SizeNotifierFrameLayout sizeNotifierFrameLayout = (SizeNotifierFrameLayout) this.fragmentView;
int indexOfChild = sizeNotifierFrameLayout.indexOfChild(this.chatActivityEnterView);
if (indexOfChild == -1) {
return;
}
this.chatActivityEnterView.setOpenGifsTabFirst();
View view = new View(getParentActivity());
this.emojiButtonRed = view;
view.setBackgroundResource(R.drawable.redcircle);
int i = indexOfChild + 1;
sizeNotifierFrameLayout.addView(this.emojiButtonRed, i, LayoutHelper.createFrame(10.0f, 10.0f, 83, 30.0f, 0.0f, 0.0f, 27.0f));
TextView textView = new TextView(getParentActivity());
this.gifHintTextView = textView;
textView.setBackgroundDrawable(Theme.createRoundRectDrawable(AndroidUtilities.dp(3.0f), Theme.getColor(Theme.key_chat_gifSaveHintBackground)));
this.gifHintTextView.setTextColor(Theme.getColor(Theme.key_chat_gifSaveHintText));
this.gifHintTextView.setTextSize(1, 14.0f);
this.gifHintTextView.setPadding(AndroidUtilities.dp(8.0f), AndroidUtilities.dp(7.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(7.0f));
this.gifHintTextView.setText(LocaleController.getString("TapHereGifs", R.string.TapHereGifs));
this.gifHintTextView.setGravity(16);
sizeNotifierFrameLayout.addView(this.gifHintTextView, i, LayoutHelper.createFrame(-2.0f, -2.0f, 83, 5.0f, 0.0f, 5.0f, 3.0f));
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(this.gifHintTextView, View.ALPHA, 0.0f, 1.0f), ObjectAnimator.ofFloat(this.emojiButtonRed, View.ALPHA, 0.0f, 1.0f));
animatorSet.addListener(new AnonymousClass45());
animatorSet.setDuration(300L);
animatorSet.start();
}
public class AnonymousClass45 extends AnimatorListenerAdapter {
AnonymousClass45() {
}
@Override
public void onAnimationEnd(Animator animator) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.AnonymousClass45.this.lambda$onAnimationEnd$0$ChatActivity$45();
}
}, AdaptiveTrackSelection.DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS);
}
public void lambda$onAnimationEnd$0$ChatActivity$45() {
if (ChatActivity.this.gifHintTextView == null) {
return;
}
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(ChatActivity.this.gifHintTextView, View.ALPHA, 0.0f));
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.gifHintTextView != null) {
ChatActivity.this.gifHintTextView.setVisibility(8);
}
}
});
animatorSet.setDuration(300L);
animatorSet.start();
}
}
public void openAttachMenu() {
if (getParentActivity() == null) {
return;
}
createChatAttachView();
this.chatAttachAlert.loadGalleryPhotos();
if (Build.VERSION.SDK_INT == 21 || Build.VERSION.SDK_INT == 22) {
this.chatActivityEnterView.closeKeyboard();
}
TLRPC.Chat chat = this.currentChat;
if (chat != null && !ChatObject.hasAdminRights(chat) && this.currentChat.slowmode_enabled) {
this.chatAttachAlert.setMaxSelectedPhotos(10, true);
} else {
this.chatAttachAlert.setMaxSelectedPhotos(-1, true);
}
this.chatAttachAlert.init();
showDialog(this.chatAttachAlert);
}
public void openCameraView() {
if (getParentActivity() == null) {
return;
}
final CameraViewActivity cameraViewActivity = new CameraViewActivity(getParentActivity(), this);
cameraViewActivity.setDelegate(new CameraViewActivity.ChatAttachViewDelegate() {
@Override
public void didSelectBot(TLRPC.User user) {
}
@Override
public View getRevealView() {
return null;
}
@Override
public void needEnterComment() {
}
@Override
public void didPressedButton(int i, boolean z, boolean z2, int i2) {
HashMap<Object, Object> selectedPhotos = cameraViewActivity.getSelectedPhotos();
ArrayList<Object> selectedPhotosOrder = cameraViewActivity.getSelectedPhotosOrder();
if (!selectedPhotos.isEmpty()) {
ArrayList arrayList = new ArrayList();
for (int i3 = 0; i3 < selectedPhotosOrder.size(); i3++) {
MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) selectedPhotos.get(selectedPhotosOrder.get(i3));
SendMessagesHelper.SendingMediaInfo sendingMediaInfo = new SendMessagesHelper.SendingMediaInfo();
if (photoEntry.imagePath != null) {
sendingMediaInfo.path = photoEntry.imagePath;
} else if (photoEntry.path != null) {
sendingMediaInfo.path = photoEntry.path;
}
sendingMediaInfo.isVideo = photoEntry.isVideo;
ArrayList<TLRPC.InputDocument> arrayList2 = null;
sendingMediaInfo.caption = photoEntry.caption != null ? photoEntry.caption.toString() : null;
sendingMediaInfo.entities = photoEntry.entities;
if (!photoEntry.stickers.isEmpty()) {
arrayList2 = new ArrayList<>(photoEntry.stickers);
}
sendingMediaInfo.masks = arrayList2;
sendingMediaInfo.ttl = photoEntry.ttl;
sendingMediaInfo.videoEditedInfo = photoEntry.editedInfo;
sendingMediaInfo.canDeleteAfter = photoEntry.canDeleteAfter;
arrayList.add(sendingMediaInfo);
photoEntry.reset();
}
ChatActivity.this.fillEditingMediaWithCaption(((SendMessagesHelper.SendingMediaInfo) arrayList.get(0)).caption, ((SendMessagesHelper.SendingMediaInfo) arrayList.get(0)).entities);
SendMessagesHelper.prepareSendingMedia(ChatActivity.this.getAccountInstance(), arrayList, ChatActivity.this.dialog_id, ChatActivity.this.replyingMessageObject, null, i == 4, z, ChatActivity.this.editingMessageObject, z2, i2, false);
ChatActivity.this.afterMessageSend();
}
if (i2 != 0) {
if (ChatActivity.this.scheduledMessagesCount == -1) {
ChatActivity.this.scheduledMessagesCount = 0;
}
ChatActivity.this.scheduledMessagesCount += selectedPhotos.size();
ChatActivity.this.updateScheduledInterface(true);
}
}
@Override
public void onCameraOpened() {
ChatActivity.this.chatActivityEnterView.hidePopup(true);
}
});
showDialog(cameraViewActivity);
}
public void checkContextBotPanel() {
MentionsAdapter mentionsAdapter;
if (this.allowStickersPanel && (mentionsAdapter = this.mentionsAdapter) != null && mentionsAdapter.isBotContext()) {
if (!this.allowContextBotPanel && !this.allowContextBotPanelSecond) {
if (this.mentionContainer.getVisibility() == 0 && this.mentionContainer.getTag() == null) {
AnimatorSet animatorSet = this.mentionListAnimation;
if (animatorSet != null) {
animatorSet.cancel();
}
this.mentionContainer.setTag(1);
AnimatorSet animatorSet2 = new AnimatorSet();
this.mentionListAnimation = animatorSet2;
animatorSet2.playTogether(ObjectAnimator.ofFloat(this.mentionContainer, View.ALPHA, 0.0f));
this.mentionListAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.mentionListAnimation == null || !ChatActivity.this.mentionListAnimation.equals(animator)) {
return;
}
ChatActivity.this.mentionContainer.setVisibility(4);
ChatActivity.this.mentionListAnimation = null;
ChatActivity.this.updateMessageListAccessibilityVisibility();
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.mentionListAnimation == null || !ChatActivity.this.mentionListAnimation.equals(animator)) {
return;
}
ChatActivity.this.mentionListAnimation = null;
}
});
this.mentionListAnimation.setDuration(200L);
this.mentionListAnimation.start();
}
} else if (this.mentionContainer.getVisibility() == 4 || this.mentionContainer.getTag() != null) {
AnimatorSet animatorSet3 = this.mentionListAnimation;
if (animatorSet3 != null) {
animatorSet3.cancel();
}
this.mentionContainer.setTag(null);
this.mentionContainer.setVisibility(0);
updateMessageListAccessibilityVisibility();
AnimatorSet animatorSet4 = new AnimatorSet();
this.mentionListAnimation = animatorSet4;
animatorSet4.playTogether(ObjectAnimator.ofFloat(this.mentionContainer, View.ALPHA, 0.0f, 1.0f));
this.mentionListAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.mentionListAnimation == null || !ChatActivity.this.mentionListAnimation.equals(animator)) {
return;
}
ChatActivity.this.mentionListAnimation = null;
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.mentionListAnimation == null || !ChatActivity.this.mentionListAnimation.equals(animator)) {
return;
}
ChatActivity.this.mentionListAnimation = null;
}
});
this.mentionListAnimation.setDuration(200L);
this.mentionListAnimation.start();
}
}
}
public void checkAutoDownloadMessages(boolean z) {
TLRPC.Document document;
int canDownloadMedia;
RecyclerListView recyclerListView = this.chatListView;
if (recyclerListView == null) {
return;
}
int childCount = recyclerListView.getChildCount();
int i = -1;
int i2 = -1;
for (int i3 = 0; i3 < childCount; i3++) {
View childAt = this.chatListView.getChildAt(i3);
if (childAt instanceof ChatMessageCell) {
RecyclerView.ViewHolder findContainingViewHolder = this.chatListView.findContainingViewHolder(childAt);
if (findContainingViewHolder != null) {
i2 = findContainingViewHolder.getAdapterPosition();
if (i == -1) {
i = i2;
}
}
ChatMessageCell chatMessageCell = (ChatMessageCell) childAt;
MessageObject messageObject = chatMessageCell.getMessageObject();
if (messageObject != null && !messageObject.mediaExists && messageObject.isSent() && (document = messageObject.getDocument()) != null && !MessageObject.isStickerDocument(document) && !MessageObject.isAnimatedStickerDocument(document) && !MessageObject.isGifDocument(document) && !MessageObject.isRoundVideoDocument(document) && (canDownloadMedia = getDownloadController().canDownloadMedia(messageObject.messageOwner)) != 0) {
int i4 = 2;
if (canDownloadMedia == 2) {
if (this.currentEncryptedChat == null && !messageObject.shouldEncryptPhotoOrVideo() && messageObject.canStreamVideo()) {
getFileLoader().loadFile(document, messageObject, 0, 10);
}
} else {
getFileLoader().loadFile(document, messageObject, 0, (MessageObject.isVideoDocument(document) && messageObject.shouldEncryptPhotoOrVideo()) ? 0 : 0);
chatMessageCell.updateButtonState(false, true, false);
}
}
}
}
if (i != -1) {
if (z) {
int i5 = i2 + 10;
if (i5 >= this.chatAdapter.messagesEndRow) {
i5 = this.chatAdapter.messagesEndRow;
}
int size = this.messages.size();
while (i2 < i5) {
int i6 = i2 - this.chatAdapter.messagesStartRow;
if (i6 >= 0 && i6 < size) {
checkAutoDownloadMessage(this.messages.get(i6));
}
i2++;
}
} else {
int i7 = i - 20;
if (i7 <= this.chatAdapter.messagesStartRow) {
i7 = this.chatAdapter.messagesStartRow;
}
int size2 = this.messages.size();
for (int i8 = i - 1; i8 >= i7; i8--) {
int i9 = i8 - this.chatAdapter.messagesStartRow;
if (i9 >= 0 && i9 < size2) {
checkAutoDownloadMessage(this.messages.get(i9));
}
}
}
}
showNoSoundHint();
}
private void checkAutoDownloadMessage(MessageObject messageObject) {
if (messageObject.mediaExists) {
return;
}
int canDownloadMedia = getDownloadController().canDownloadMedia(messageObject.messageOwner);
if (canDownloadMedia == 0) {
return;
}
TLRPC.Document document = messageObject.getDocument();
TLRPC.PhotoSize closestPhotoSizeWithSize = document == null ? FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, AndroidUtilities.getPhotoSize()) : null;
if (document == null && closestPhotoSizeWithSize == null) {
return;
}
int i = 2;
if (canDownloadMedia != 2 && (canDownloadMedia != 1 || !messageObject.isVideo())) {
if (document != null) {
getFileLoader().loadFile(document, messageObject, 0, (MessageObject.isVideoDocument(document) && messageObject.shouldEncryptPhotoOrVideo()) ? 0 : 0);
} else {
getFileLoader().loadFile(ImageLocation.getForObject(closestPhotoSizeWithSize, messageObject.photoThumbsObject), messageObject, null, 0, messageObject.shouldEncryptPhotoOrVideo() ? 2 : 0);
}
} else if (document == null || this.currentEncryptedChat != null || messageObject.shouldEncryptPhotoOrVideo() || !messageObject.canStreamVideo()) {
} else {
getFileLoader().loadFile(document, messageObject, 0, 10);
}
}
public void showFloatingDateView(boolean z) {
if (this.floatingDateView.getTag() == null) {
AnimatorSet animatorSet = this.floatingDateAnimation;
if (animatorSet != null) {
animatorSet.cancel();
}
this.floatingDateView.setTag(1);
AnimatorSet animatorSet2 = new AnimatorSet();
this.floatingDateAnimation = animatorSet2;
animatorSet2.setDuration(150L);
this.floatingDateAnimation.playTogether(ObjectAnimator.ofFloat(this.floatingDateView, View.ALPHA, 1.0f));
this.floatingDateAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (animator.equals(ChatActivity.this.floatingDateAnimation)) {
ChatActivity.this.floatingDateAnimation = null;
}
}
});
this.floatingDateAnimation.start();
}
if (z) {
return;
}
updateMessagesVisiblePart(false);
this.hideDateDelay = 1000;
}
public void hideFloatingDateView(boolean z) {
if (this.floatingDateView.getTag() == null || this.currentFloatingDateOnScreen) {
return;
}
if (!this.scrollingFloatingDate || this.currentFloatingTopIsNotMessage) {
this.floatingDateView.setTag(null);
if (z) {
AnimatorSet animatorSet = new AnimatorSet();
this.floatingDateAnimation = animatorSet;
animatorSet.setDuration(150L);
this.floatingDateAnimation.playTogether(ObjectAnimator.ofFloat(this.floatingDateView, View.ALPHA, 0.0f));
this.floatingDateAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (animator.equals(ChatActivity.this.floatingDateAnimation)) {
ChatActivity.this.floatingDateAnimation = null;
}
}
});
this.floatingDateAnimation.setStartDelay(this.hideDateDelay);
this.floatingDateAnimation.start();
} else {
AnimatorSet animatorSet2 = this.floatingDateAnimation;
if (animatorSet2 != null) {
animatorSet2.cancel();
this.floatingDateAnimation = null;
}
this.floatingDateView.setAlpha(0.0f);
}
this.hideDateDelay = 500;
}
}
@Override
public void onRemoveFromParent() {
MessageObject playingMessageObject = MediaController.getInstance().getPlayingMessageObject();
if (playingMessageObject != null && playingMessageObject.isVideo()) {
MediaController.getInstance().cleanupPlayer(true, true);
} else {
MediaController.getInstance().setTextureView(this.videoTextureView, null, null, false);
}
}
public void setIgnoreAttachOnPause(boolean z) {
this.ignoreAttachOnPause = z;
}
public void checkScrollForLoad(boolean z) {
GridLayoutManagerFixed gridLayoutManagerFixed = this.chatLayoutManager;
if (gridLayoutManagerFixed == null || this.paused) {
return;
}
int findFirstVisibleItemPosition = gridLayoutManagerFixed.findFirstVisibleItemPosition();
int abs = findFirstVisibleItemPosition == -1 ? 0 : Math.abs(this.chatLayoutManager.findLastVisibleItemPosition() - findFirstVisibleItemPosition) + 1;
if ((this.chatAdapter.getItemCount() - findFirstVisibleItemPosition) - abs <= (z ? 25 : 5) && !this.loading) {
boolean[] zArr = this.endReached;
if (!zArr[0]) {
this.loading = true;
this.waitingForLoad.add(Integer.valueOf(this.lastLoadIndex));
if (this.messagesByDays.size() != 0) {
MessagesController messagesController = getMessagesController();
long j = this.dialog_id;
int i = this.maxMessageId[0];
boolean z2 = !this.cacheEndReached[0];
int i2 = this.minDate[0];
int i3 = this.classGuid;
boolean isChannel = ChatObject.isChannel(this.currentChat);
boolean z3 = this.inScheduleMode;
int i4 = this.lastLoadIndex;
this.lastLoadIndex = i4 + 1;
messagesController.loadMessages(j, 50, i, 0, z2, i2, i3, 0, 0, isChannel, z3, i4);
} else {
MessagesController messagesController2 = getMessagesController();
long j2 = this.dialog_id;
boolean z4 = !this.cacheEndReached[0];
int i5 = this.minDate[0];
int i6 = this.classGuid;
boolean isChannel2 = ChatObject.isChannel(this.currentChat);
boolean z5 = this.inScheduleMode;
int i7 = this.lastLoadIndex;
this.lastLoadIndex = i7 + 1;
messagesController2.loadMessages(j2, 50, 0, 0, z4, i5, i6, 0, 0, isChannel2, z5, i7);
}
} else if (this.mergeDialogId != 0 && !zArr[1]) {
this.loading = true;
this.waitingForLoad.add(Integer.valueOf(this.lastLoadIndex));
MessagesController messagesController3 = getMessagesController();
long j3 = this.mergeDialogId;
int i8 = this.maxMessageId[1];
boolean z6 = !this.cacheEndReached[1];
int i9 = this.minDate[1];
int i10 = this.classGuid;
boolean z7 = this.inScheduleMode;
int i11 = this.lastLoadIndex;
this.lastLoadIndex = i11 + 1;
messagesController3.loadMessages(j3, 50, i8, 0, z6, i9, i10, 0, 0, false, z7, i11);
}
}
if (abs <= 0 || this.loadingForward || findFirstVisibleItemPosition > 10) {
return;
}
if (this.mergeDialogId != 0 && !this.forwardEndReached[1]) {
this.waitingForLoad.add(Integer.valueOf(this.lastLoadIndex));
MessagesController messagesController4 = getMessagesController();
long j4 = this.mergeDialogId;
int i12 = this.minMessageId[1];
int i13 = this.maxDate[1];
int i14 = this.classGuid;
boolean z8 = this.inScheduleMode;
int i15 = this.lastLoadIndex;
this.lastLoadIndex = i15 + 1;
messagesController4.loadMessages(j4, 50, i12, 0, true, i13, i14, 1, 0, false, z8, i15);
this.loadingForward = true;
} else if (this.forwardEndReached[0]) {
} else {
this.waitingForLoad.add(Integer.valueOf(this.lastLoadIndex));
MessagesController messagesController5 = getMessagesController();
long j5 = this.dialog_id;
int i16 = this.minMessageId[0];
int i17 = this.maxDate[0];
int i18 = this.classGuid;
boolean isChannel3 = ChatObject.isChannel(this.currentChat);
boolean z9 = this.inScheduleMode;
int i19 = this.lastLoadIndex;
this.lastLoadIndex = i19 + 1;
messagesController5.loadMessages(j5, 50, i16, 0, true, i17, i18, 1, 0, isChannel3, z9, i19);
this.loadingForward = true;
}
}
public void processSelectedAttach(int i) {
TLRPC.Chat chat;
TLRPC.EncryptedChat encryptedChat;
int i2 = 1;
i2 = 1;
if ((i == 4 || i == 1 || i == 3 || i == 2 || i == 0) && (chat = this.currentChat) != null) {
if (!ChatObject.hasAdminRights(chat) && this.currentChat.default_banned_rights != null && this.currentChat.default_banned_rights.send_media) {
AlertsCreator.showSendMediaAlert(5, this);
return;
} else if (!ChatObject.canSendMedia(this.currentChat)) {
AlertsCreator.showSendMediaAlert(2, this);
return;
}
}
if (i == 0) {
if (SharedConfig.inappCamera) {
openCameraView();
} else if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(PermissionUtils.CAMERA) != 0) {
getParentActivity().requestPermissions(new String[]{PermissionUtils.CAMERA}, 19);
} else {
try {
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
File generatePicturePath = AndroidUtilities.generatePicturePath();
if (generatePicturePath != null) {
if (Build.VERSION.SDK_INT >= 24) {
intent.putExtra("output", FileProvider.getUriForFile(getParentActivity(), "im.ovithmjoec.messenger.provider", generatePicturePath));
intent.addFlags(2);
intent.addFlags(1);
} else {
intent.putExtra("output", Uri.fromFile(generatePicturePath));
}
this.currentPicturePath = generatePicturePath.getAbsolutePath();
}
startActivityForResult(intent, 0);
} catch (Exception e) {
FileLog.e(e);
}
}
} else if (i == 1) {
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission("android.permission.READ_EXTERNAL_STORAGE") != 0) {
try {
getParentActivity().requestPermissions(new String[]{"android.permission.READ_EXTERNAL_STORAGE"}, 4);
return;
} catch (Throwable unused) {
return;
}
}
PhotoAlbumPickerActivity photoAlbumPickerActivity = new PhotoAlbumPickerActivity(0, !(ChatObject.isChannel(this.currentChat) && this.currentChat.banned_rights != null && this.currentChat.banned_rights.send_gifs) && ((encryptedChat = this.currentEncryptedChat) == null || AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 46), true, this);
TLRPC.Chat chat2 = this.currentChat;
if (chat2 != null && !ChatObject.hasAdminRights(chat2) && this.currentChat.slowmode_enabled) {
photoAlbumPickerActivity.setMaxSelectedPhotos(10, true);
} else {
photoAlbumPickerActivity.setMaxSelectedPhotos(this.editingMessageObject != null ? 1 : 0, this.editingMessageObject == null);
}
photoAlbumPickerActivity.setDelegate(new PhotoAlbumPickerActivity.PhotoAlbumPickerActivityDelegate() {
@Override
public void didSelectPhotos(ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList, boolean z, int i3, boolean z2) {
boolean z3;
if (arrayList.isEmpty()) {
return;
}
int i4 = 0;
while (true) {
if (i4 >= arrayList.size()) {
z3 = false;
break;
} else if (arrayList.get(i4).inlineResult == null) {
z3 = true;
break;
} else {
i4++;
}
}
if (!z3 && !TextUtils.isEmpty(arrayList.get(0).caption)) {
SendMessagesHelper.getInstance(ChatActivity.this.currentAccount).sendMessage(arrayList.get(0).caption, ChatActivity.this.dialog_id, ChatActivity.this.replyingMessageObject, null, false, arrayList.get(0).entities, null, null, z, i3);
}
int i5 = 0;
while (i5 < arrayList.size()) {
SendMessagesHelper.SendingMediaInfo sendingMediaInfo = arrayList.get(i5);
if (sendingMediaInfo.inlineResult != null) {
SendMessagesHelper.prepareSendingBotContextResult(ChatActivity.this.getAccountInstance(), sendingMediaInfo.inlineResult, sendingMediaInfo.params, ChatActivity.this.dialog_id, ChatActivity.this.replyingMessageObject, z, i3);
arrayList.remove(i5);
i5--;
}
i5++;
}
if (arrayList.isEmpty()) {
return;
}
ChatActivity.this.fillEditingMediaWithCaption(arrayList.get(0).caption, arrayList.get(0).entities);
if (!z2) {
SendMessagesHelper.prepareSendingMedia(ChatActivity.this.getAccountInstance(), arrayList, ChatActivity.this.dialog_id, ChatActivity.this.replyingMessageObject, null, false, true, ChatActivity.this.editingMessageObject, z, i3, z2);
} else {
int size = arrayList.size();
for (int i6 = 0; i6 < size; i6++) {
SendMessagesHelper.SendingMediaInfo sendingMediaInfo2 = arrayList.get(i6);
if (sendingMediaInfo2.searchImage == null && !sendingMediaInfo2.isVideo) {
SendMessagesHelper.prepareSendingDocument(ChatActivity.this.getAccountInstance(), sendingMediaInfo2.path, sendingMediaInfo2.path, null, null, null, ChatActivity.this.dialog_id, ChatActivity.this.replyingMessageObject, null, ChatActivity.this.editingMessageObject, true, 0);
}
}
}
ChatActivity.this.afterMessageSend();
if (i3 != 0) {
if (ChatActivity.this.scheduledMessagesCount == -1) {
ChatActivity.this.scheduledMessagesCount = 0;
}
ChatActivity.this.scheduledMessagesCount += arrayList.size();
ChatActivity.this.updateScheduledInterface(true);
}
}
@Override
public void startPhotoSelectActivity() {
try {
Intent intent2 = new Intent();
intent2.setType("video/*");
intent2.setAction("android.intent.action.GET_CONTENT");
intent2.putExtra("android.intent.extra.sizeLimit", 1610612736L);
Intent intent3 = new Intent("android.intent.action.PICK");
intent3.setType("image/*");
Intent createChooser = Intent.createChooser(intent3, null);
createChooser.putExtra("android.intent.extra.INITIAL_INTENTS", new Intent[]{intent2});
ChatActivity.this.startActivityForResult(createChooser, 1);
} catch (Exception e2) {
FileLog.e(e2);
}
}
});
presentFragment(photoAlbumPickerActivity);
} else if (i == 2) {
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(PermissionUtils.CAMERA) != 0) {
try {
getParentActivity().requestPermissions(new String[]{PermissionUtils.CAMERA}, 20);
return;
} catch (Throwable unused2) {
return;
}
}
try {
Intent intent2 = new Intent("android.media.action.VIDEO_CAPTURE");
File generateVideoPath = AndroidUtilities.generateVideoPath();
if (generateVideoPath != null) {
if (Build.VERSION.SDK_INT >= 24) {
intent2.putExtra("output", FileProvider.getUriForFile(getParentActivity(), "im.ovithmjoec.messenger.provider", generateVideoPath));
intent2.addFlags(2);
intent2.addFlags(1);
} else if (Build.VERSION.SDK_INT >= 18) {
intent2.putExtra("output", Uri.fromFile(generateVideoPath));
}
intent2.putExtra("android.intent.extra.sizeLimit", 1610612736L);
this.currentPicturePath = generateVideoPath.getAbsolutePath();
}
startActivityForResult(intent2, 2);
} catch (Exception e2) {
FileLog.e(e2);
}
} else if (i == 6) {
if (isSecretChat() || getLocationController().isSharingLocation(this.dialog_id)) {
NewLocationActivity newLocationActivity = new NewLocationActivity(0);
newLocationActivity.setDelegate(this);
presentFragment(newLocationActivity);
return;
}
BottomDialog bottomDialog = new BottomDialog(getParentActivity());
bottomDialog.addDialogItem(new BottomDialog.NormalTextItem(0, LocaleController.getString(R.string.SendLocationItem), true));
bottomDialog.addDialogItem(new BottomDialog.NormalTextItem(1, LocaleController.getString(R.string.ShareLocationItem), false));
bottomDialog.setOnItemClickListener(new BottomDialog.OnItemClickListener() {
@Override
public final void onItemClick(int i3, View view) {
ChatActivity.this.lambda$processSelectedAttach$54$ChatActivity(i3, view);
}
});
showDialog(bottomDialog);
} else if (i == 4) {
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission("android.permission.READ_EXTERNAL_STORAGE") != 0) {
try {
getParentActivity().requestPermissions(new String[]{"android.permission.READ_EXTERNAL_STORAGE"}, 4);
return;
} catch (Throwable unused3) {
return;
}
}
DocumentSelectActivity documentSelectActivity = new DocumentSelectActivity(true);
documentSelectActivity.setChatActivity(this);
TLRPC.Chat chat3 = this.currentChat;
if ((chat3 == null || ChatObject.hasAdminRights(chat3) || !this.currentChat.slowmode_enabled) && this.editingMessageObject == null) {
i2 = -1;
}
documentSelectActivity.setMaxSelectedFiles(i2);
documentSelectActivity.setDelegate(new AnonymousClass52());
presentFragment(documentSelectActivity);
} else if (i == 3) {
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission("android.permission.READ_EXTERNAL_STORAGE") != 0) {
getParentActivity().requestPermissions(new String[]{"android.permission.READ_EXTERNAL_STORAGE"}, 4);
return;
}
AudioSelectActivity audioSelectActivity = new AudioSelectActivity(this);
audioSelectActivity.setDelegate(new AudioSelectActivity.AudioSelectActivityDelegate() {
@Override
public final void didSelectAudio(ArrayList arrayList, boolean z, int i3) {
ChatActivity.this.lambda$processSelectedAttach$55$ChatActivity(arrayList, z, i3);
}
});
presentFragment(audioSelectActivity);
} else if (i == 5) {
PhoneBookSelectActivity phoneBookSelectActivity = new PhoneBookSelectActivity(this);
phoneBookSelectActivity.setDelegate(new PhoneBookSelectActivity.PhoneBookSelectActivityDelegate() {
@Override
public final void didSelectContact(TLRPC.User user, boolean z, int i3) {
ChatActivity.this.lambda$processSelectedAttach$56$ChatActivity(user, z, i3);
}
});
presentFragment(phoneBookSelectActivity);
} else if (i == 9) {
TLRPC.Chat chat4 = this.currentChat;
if (chat4 == null) {
AlertsCreator.showSendMediaAlert(3, this);
} else if (!ChatObject.hasAdminRights(chat4) && this.currentChat.default_banned_rights != null && this.currentChat.default_banned_rights.send_polls) {
AlertsCreator.showSendMediaAlert(6, this);
} else if (!ChatObject.canSendPolls(this.currentChat)) {
AlertsCreator.showSendMediaAlert(3, this);
} else {
PollCreateActivity pollCreateActivity = new PollCreateActivity(this);
pollCreateActivity.setDelegate(new PollCreateActivity.PollCreateActivityDelegate() {
@Override
public final void sendPoll(TLRPC.TL_messageMediaPoll tL_messageMediaPoll, boolean z, int i3) {
ChatActivity.this.lambda$processSelectedAttach$57$ChatActivity(tL_messageMediaPoll, z, i3);
}
});
presentFragment(pollCreateActivity);
}
} else if (i == 1010 || i != 1011 || ApplicationLoader.mbytAVideoCallBusy == 0) {
} else {
if (ApplicationLoader.mbytAVideoCallBusy == 3 || ApplicationLoader.mbytAVideoCallBusy == 4) {
ToastUtils.show((CharSequence) LocaleController.getString("visual_call_busing_tip", R.string.visual_call_busing_tip));
}
}
}
public void lambda$processSelectedAttach$54$ChatActivity(int i, View view) {
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") != 0) {
getParentActivity().requestPermissions(new String[]{"android.permission.ACCESS_COARSE_LOCATION", PermissionUtils.FINE_LOCATION}, 2);
} else if (!GpsUtils.isOpen(getParentActivity())) {
WalletDialogUtil.showWalletDialog(this, "", LocaleController.getString("GpsNotOpenTips", R.string.GpsNotOpenTips), LocaleController.getString("Cancel", R.string.Cancel), LocaleController.getString("GoOpen", R.string.GoOpen), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
ChatActivity.this.lambda$null$53$ChatActivity(dialogInterface, i2);
}
}, null);
} else {
NewLocationActivity newLocationActivity = null;
if (i == 0) {
newLocationActivity = new NewLocationActivity(0);
} else if (i == 1) {
newLocationActivity = new NewLocationActivity(2, this.dialog_id);
}
newLocationActivity.setDelegate(this);
presentFragment(newLocationActivity);
}
}
public void lambda$null$53$ChatActivity(DialogInterface dialogInterface, int i) {
GpsUtils.toGpsSettingActivity(getParentActivity());
}
public class AnonymousClass52 implements DocumentSelectActivity.DocumentSelectActivityDelegate {
AnonymousClass52() {
}
@Override
public void didSelectFiles(DocumentSelectActivity documentSelectActivity, ArrayList<String> arrayList, boolean z, int i) {
documentSelectActivity.finishFragment();
ChatActivity.this.fillEditingMediaWithCaption(null, null);
SendMessagesHelper.prepareSendingDocuments(ChatActivity.this.getAccountInstance(), arrayList, arrayList, null, null, null, ChatActivity.this.dialog_id, ChatActivity.this.replyingMessageObject, null, ChatActivity.this.editingMessageObject, z, i);
ChatActivity.this.afterMessageSend();
}
@Override
public void startDocumentSelectActivity() {
try {
Intent intent = new Intent("android.intent.action.GET_CONTENT");
if (Build.VERSION.SDK_INT >= 18) {
intent.putExtra("android.intent.extra.ALLOW_MULTIPLE", true);
}
intent.setType("*/*");
ChatActivity.this.startActivityForResult(intent, 21);
} catch (Exception e) {
FileLog.e(e);
}
}
@Override
public void startMusicSelectActivity(final BaseFragment baseFragment) {
AudioSelectActivity audioSelectActivity = new AudioSelectActivity(ChatActivity.this);
audioSelectActivity.setDelegate(new AudioSelectActivity.AudioSelectActivityDelegate() {
@Override
public final void didSelectAudio(ArrayList arrayList, boolean z, int i) {
ChatActivity.AnonymousClass52.this.lambda$startMusicSelectActivity$0$ChatActivity$52(baseFragment, arrayList, z, i);
}
});
ChatActivity.this.presentFragment(audioSelectActivity);
}
public void lambda$startMusicSelectActivity$0$ChatActivity$52(BaseFragment baseFragment, ArrayList arrayList, boolean z, int i) {
baseFragment.removeSelfFromStack();
ChatActivity.this.fillEditingMediaWithCaption(null, null);
SendMessagesHelper.prepareSendingAudioDocuments(ChatActivity.this.getAccountInstance(), arrayList, ChatActivity.this.dialog_id, ChatActivity.this.replyingMessageObject, ChatActivity.this.editingMessageObject, z, i);
ChatActivity.this.afterMessageSend();
}
}
public void lambda$processSelectedAttach$55$ChatActivity(ArrayList arrayList, boolean z, int i) {
fillEditingMediaWithCaption(null, null);
SendMessagesHelper.prepareSendingAudioDocuments(getAccountInstance(), arrayList, this.dialog_id, this.replyingMessageObject, this.editingMessageObject, z, i);
afterMessageSend();
}
public void lambda$processSelectedAttach$56$ChatActivity(TLRPC.User user, boolean z, int i) {
getSendMessagesHelper().sendMessage(user, this.dialog_id, this.replyingMessageObject, (TLRPC.ReplyMarkup) null, (HashMap<String, String>) null, z, i);
afterMessageSend();
}
public void lambda$processSelectedAttach$57$ChatActivity(TLRPC.TL_messageMediaPoll tL_messageMediaPoll, boolean z, int i) {
getSendMessagesHelper().sendMessage(tL_messageMediaPoll, this.dialog_id, this.replyingMessageObject, (TLRPC.ReplyMarkup) null, (HashMap<String, String>) null, z, i);
afterMessageSend();
}
@Override
public boolean dismissDialogOnPause(Dialog dialog) {
return dialog != this.chatAttachAlert && super.dismissDialogOnPause(dialog);
}
public void searchLinks(final CharSequence charSequence, final boolean z) {
TLRPC.WebPage webPage;
boolean z2;
char charAt;
if (this.currentEncryptedChat == null || (getMessagesController().secretWebpagePreview != 0 && AndroidUtilities.getPeerLayerVersion(this.currentEncryptedChat.layer) >= 46)) {
if (z && (webPage = this.foundWebPage) != null) {
if (webPage.url != null) {
int indexOf = TextUtils.indexOf(charSequence, this.foundWebPage.url);
if (indexOf == -1) {
if (this.foundWebPage.display_url != null) {
indexOf = TextUtils.indexOf(charSequence, this.foundWebPage.display_url);
z2 = (indexOf == -1 || this.foundWebPage.display_url.length() + indexOf != charSequence.length()) ? false : false;
if (indexOf != -1 && !z2) {
charAt = charSequence.charAt(this.foundWebPage.display_url.length() + indexOf);
if (indexOf != -1 && (z2 || charAt == ' ' || charAt == ',' || charAt == '.' || charAt == '!' || charAt == '/')) {
return;
}
}
} else {
z2 = false;
}
charAt = 0;
if (indexOf != -1) {
return;
}
} else {
z2 = this.foundWebPage.url.length() + indexOf == charSequence.length();
if (!z2) {
charAt = charSequence.charAt(this.foundWebPage.url.length() + indexOf);
if (indexOf != -1) {
}
}
charAt = 0;
if (indexOf != -1) {
}
}
}
this.pendingLinkSearchString = null;
this.foundUrls = null;
showFieldPanelForWebPage(false, this.foundWebPage, false);
}
final MessagesController messagesController = getMessagesController();
Utilities.searchQueue.postRunnable(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$searchLinks$64$ChatActivity(charSequence, messagesController, z);
}
});
}
}
public void lambda$searchLinks$64$ChatActivity(final CharSequence charSequence, final MessagesController messagesController, final boolean z) {
CharSequence charSequence2;
URLSpanReplacement[] uRLSpanReplacementArr;
boolean z2 = true;
if (this.linkSearchRequestId != 0) {
getConnectionsManager().cancelRequest(this.linkSearchRequestId, true);
this.linkSearchRequestId = 0;
}
ArrayList<CharSequence> arrayList = null;
try {
Matcher matcher = AndroidUtilities.WEB_URL.matcher(charSequence);
while (matcher.find()) {
if (matcher.start() <= 0 || charSequence.charAt(matcher.start() - 1) != '@') {
if (arrayList == null) {
arrayList = new ArrayList<>();
}
arrayList.add(charSequence.subSequence(matcher.start(), matcher.end()));
}
}
if ((charSequence instanceof Spannable) && (uRLSpanReplacementArr = (URLSpanReplacement[]) ((Spannable) charSequence).getSpans(0, charSequence.length(), URLSpanReplacement.class)) != null && uRLSpanReplacementArr.length > 0) {
if (arrayList == null) {
arrayList = new ArrayList<>();
}
for (URLSpanReplacement uRLSpanReplacement : uRLSpanReplacementArr) {
arrayList.add(uRLSpanReplacement.getURL());
}
}
if (arrayList != null && this.foundUrls != null && arrayList.size() == this.foundUrls.size()) {
for (int i = 0; i < arrayList.size(); i++) {
if (!TextUtils.equals(arrayList.get(i), this.foundUrls.get(i))) {
z2 = false;
}
}
if (z2) {
return;
}
}
this.foundUrls = arrayList;
} catch (Exception e) {
FileLog.e(e);
String lowerCase = charSequence.toString().toLowerCase();
if (charSequence.length() < 13 || !(lowerCase.contains("http://") || lowerCase.contains("https://"))) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$59$ChatActivity();
}
});
return;
}
charSequence2 = charSequence;
}
if (arrayList == null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$58$ChatActivity();
}
});
return;
}
charSequence2 = TextUtils.join(" ", arrayList);
if (this.currentEncryptedChat != null && messagesController.secretWebpagePreview == 2) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$61$ChatActivity(messagesController, charSequence, z);
}
});
return;
}
final TLRPC.TL_messages_getWebPagePreview tL_messages_getWebPagePreview = new TLRPC.TL_messages_getWebPagePreview();
if (charSequence2 instanceof String) {
tL_messages_getWebPagePreview.message = (String) charSequence2;
} else {
tL_messages_getWebPagePreview.message = charSequence2.toString();
}
this.linkSearchRequestId = getConnectionsManager().sendRequest(tL_messages_getWebPagePreview, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChatActivity.this.lambda$null$63$ChatActivity(tL_messages_getWebPagePreview, tLObject, tL_error);
}
});
getConnectionsManager().bindRequestToGuid(this.linkSearchRequestId, this.classGuid);
}
public void lambda$null$58$ChatActivity() {
TLRPC.WebPage webPage = this.foundWebPage;
if (webPage != null) {
showFieldPanelForWebPage(false, webPage, false);
this.foundWebPage = null;
}
}
public void lambda$null$59$ChatActivity() {
TLRPC.WebPage webPage = this.foundWebPage;
if (webPage != null) {
showFieldPanelForWebPage(false, webPage, false);
this.foundWebPage = null;
}
}
public void lambda$null$61$ChatActivity(final MessagesController messagesController, final CharSequence charSequence, final boolean z) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatActivity.this.lambda$null$60$ChatActivity(messagesController, charSequence, z, dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.setMessage(LocaleController.getString("SecretLinkPreviewAlert", R.string.SecretLinkPreviewAlert));
showDialog(builder.create());
messagesController.secretWebpagePreview = 0;
MessagesController.getGlobalMainSettings().edit().putInt("secretWebpage2", messagesController.secretWebpagePreview).commit();
}
public void lambda$null$60$ChatActivity(MessagesController messagesController, CharSequence charSequence, boolean z, DialogInterface dialogInterface, int i) {
messagesController.secretWebpagePreview = 1;
MessagesController.getGlobalMainSettings().edit().putInt("secretWebpage2", getMessagesController().secretWebpagePreview).commit();
this.foundUrls = null;
searchLinks(charSequence, z);
}
public void lambda$null$63$ChatActivity(final TLRPC.TL_messages_getWebPagePreview tL_messages_getWebPagePreview, final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$62$ChatActivity(tL_error, tLObject, tL_messages_getWebPagePreview);
}
});
}
public void lambda$null$62$ChatActivity(TLRPC.TL_error tL_error, TLObject tLObject, TLRPC.TL_messages_getWebPagePreview tL_messages_getWebPagePreview) {
this.linkSearchRequestId = 0;
if (tL_error == null) {
if (tLObject instanceof TLRPC.TL_messageMediaWebPage) {
TLRPC.WebPage webPage = ((TLRPC.TL_messageMediaWebPage) tLObject).webpage;
this.foundWebPage = webPage;
if (!(webPage instanceof TLRPC.TL_webPage) && !(webPage instanceof TLRPC.TL_webPagePending)) {
if (webPage != null) {
showFieldPanelForWebPage(false, webPage, false);
this.foundWebPage = null;
return;
}
return;
}
if (this.foundWebPage instanceof TLRPC.TL_webPagePending) {
this.pendingLinkSearchString = tL_messages_getWebPagePreview.message;
}
if (this.currentEncryptedChat != null) {
TLRPC.WebPage webPage2 = this.foundWebPage;
if (webPage2 instanceof TLRPC.TL_webPagePending) {
webPage2.url = tL_messages_getWebPagePreview.message;
}
}
showFieldPanelForWebPage(true, this.foundWebPage, false);
return;
}
TLRPC.WebPage webPage3 = this.foundWebPage;
if (webPage3 != null) {
showFieldPanelForWebPage(false, webPage3, false);
this.foundWebPage = null;
}
}
}
private void forwardMessages(ArrayList<MessageObject> arrayList, boolean z, boolean z2, int i) {
if (arrayList == null || arrayList.isEmpty()) {
return;
}
if (!z) {
AlertsCreator.showSendMediaAlert(getSendMessagesHelper().sendMessage(arrayList, this.dialog_id, z2, i), this);
return;
}
Iterator<MessageObject> it = arrayList.iterator();
while (it.hasNext()) {
getSendMessagesHelper().processForwardFromMyName(it.next(), this.dialog_id);
}
}
private void checkBotKeyboard() {
MessageObject messageObject;
if (this.chatActivityEnterView == null || (messageObject = this.botButtons) == null || this.userBlocked) {
return;
}
if (messageObject.messageOwner.reply_markup instanceof TLRPC.TL_replyKeyboardForceReply) {
SharedPreferences mainSettings = MessagesController.getMainSettings(this.currentAccount);
if (mainSettings.getInt("answered_" + this.dialog_id, 0) != this.botButtons.getId()) {
if (this.replyingMessageObject == null || this.chatActivityEnterView.getFieldText() == null) {
MessageObject messageObject2 = this.botButtons;
this.botReplyButtons = messageObject2;
this.chatActivityEnterView.setButtons(messageObject2);
showFieldPanelForReply(this.botButtons);
return;
}
return;
}
return;
}
MessageObject messageObject3 = this.replyingMessageObject;
if (messageObject3 != null && this.botReplyButtons == messageObject3) {
this.botReplyButtons = null;
hideFieldPanel(true);
}
this.chatActivityEnterView.setButtons(this.botButtons);
}
public void hideFieldPanel(boolean z) {
showFieldPanel(false, null, null, null, null, true, 0, false, z);
}
public void hideFieldPanel(boolean z, int i, boolean z2) {
showFieldPanel(false, null, null, null, null, z, i, false, z2);
}
public void showFieldPanelForWebPage(boolean z, TLRPC.WebPage webPage, boolean z2) {
showFieldPanel(z, null, null, null, webPage, true, 0, z2, true);
}
public void showFieldPanelForForward(boolean z, ArrayList<MessageObject> arrayList) {
showFieldPanel(z, null, null, arrayList, null, true, 0, false, true);
}
public void showFieldPanelForReply(MessageObject messageObject) {
showFieldPanel(true, messageObject, null, null, null, true, 0, false, true);
}
public void showFieldPanelForEdit(boolean z, MessageObject messageObject) {
showFieldPanel(z, null, messageObject, null, null, true, 0, false, true);
}
public void showFieldPanel(boolean z, MessageObject messageObject, MessageObject messageObject2, ArrayList<MessageObject> arrayList, TLRPC.WebPage webPage, boolean z2, int i, boolean z3, boolean z4) {
?? r3;
boolean z5;
int i2;
ArrayList<MessageObject> arrayList2;
boolean z6;
TLRPC.Chat chat;
TLRPC.User user;
int i3;
int i4;
TLRPC.Chat chat2;
String str;
TLRPC.PhotoSize photoSize;
int i5;
TLRPC.PhotoSize photoSize2;
int i6;
TLObject tLObject;
MessageObject messageObject3;
int i7;
int i8;
MessageObject messageObject4 = messageObject;
if (this.chatActivityEnterView == null) {
return;
}
if (!z) {
if (this.replyingMessageObject == null && this.forwardingMessages == null && this.foundWebPage == null && this.editingMessageObject == null) {
return;
}
MessageObject messageObject5 = this.replyingMessageObject;
if (messageObject5 != null && (messageObject5.messageOwner.reply_markup instanceof TLRPC.TL_replyKeyboardForceReply)) {
MessagesController.getMainSettings(this.currentAccount).edit().putInt("answered_" + this.dialog_id, this.replyingMessageObject.getId()).commit();
}
if (this.foundWebPage != null) {
this.foundWebPage = null;
this.chatActivityEnterView.setWebPage(null, !z3);
if (webPage != null && (this.replyingMessageObject != null || this.forwardingMessages != null || this.editingMessageObject != null)) {
showFieldPanel(true, this.replyingMessageObject, this.editingMessageObject, this.forwardingMessages, null, z2, i, false, true);
return;
}
}
ArrayList<MessageObject> arrayList3 = this.forwardingMessages;
if (arrayList3 != null) {
this.forwardingMessages = null;
if (i != 0) {
i2 = i + 1;
z5 = z2;
} else {
z5 = z2;
i2 = 0;
}
r3 = 0;
forwardMessages(arrayList3, false, z5, i2);
} else {
r3 = 0;
}
this.chatActivityEnterView.setForceShowSendButton(r3, r3);
this.chatActivityEnterView.hideTopView(z4);
this.chatActivityEnterView.setReplyingMessageObject(null);
this.chatActivityEnterView.setEditingMessageObject(null, r3);
this.topViewWasVisible = r3;
this.replyingMessageObject = null;
this.editingMessageObject = null;
this.replyImageLocation = null;
this.replyImageLocationObject = null;
} else if (messageObject4 != null || arrayList != null || messageObject2 != null || webPage != null) {
HintView hintView = this.noSoundHintView;
if (hintView != null) {
hintView.hide();
}
HintView hintView2 = this.forwardHintView;
if (hintView2 != null) {
hintView2.hide();
}
HintView hintView3 = this.slowModeHint;
if (hintView3 != null) {
hintView3.hide();
}
if (this.searchItem != null && this.actionBar.isSearchFieldVisible()) {
this.actionBar.closeSearchField(false);
this.chatActivityEnterView.setFieldFocused();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$showFieldPanel$65$ChatActivity();
}
}, 100L);
}
if (messageObject4 == null || messageObject.getDialogId() == this.dialog_id) {
arrayList2 = arrayList;
z6 = false;
} else {
arrayList2 = new ArrayList<>();
arrayList2.add(messageObject4);
messageObject4 = null;
z6 = true;
}
if (messageObject2 != null) {
this.forwardingMessages = null;
this.replyingMessageObject = null;
this.editingMessageObject = messageObject2;
this.chatActivityEnterView.setReplyingMessageObject(null);
this.chatActivityEnterView.setEditingMessageObject(messageObject2, !messageObject2.isMediaEmpty());
if (this.foundWebPage != null) {
return;
}
this.chatActivityEnterView.setForceShowSendButton(false, false);
this.replyIconImageView.setImageResource(R.drawable.group_edit);
this.replyIconImageView.setContentDescription(LocaleController.getString("AccDescrEditing", R.string.AccDescrEditing));
this.replyCloseImageView.setContentDescription(LocaleController.getString("AccDescrCancelEdit", R.string.AccDescrCancelEdit));
if (messageObject2.isMediaEmpty()) {
this.replyNameTextView.setText(LocaleController.getString("EditMessage", R.string.EditMessage));
} else {
this.replyNameTextView.setText(LocaleController.getString("EditCaption", R.string.EditCaption));
}
if (messageObject2.canEditMedia()) {
this.replyObjectTextView.setText(LocaleController.getString("EditMessageMedia", R.string.EditMessageMedia));
} else if (messageObject2.messageText != null) {
String charSequence = messageObject2.messageText.toString();
if (charSequence.length() > 150) {
charSequence = charSequence.substring(0, 150);
}
String replace = charSequence.replace('\n', ' ');
SimpleTextView simpleTextView = this.replyObjectTextView;
simpleTextView.setText(Emoji.replaceEmoji(replace, simpleTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14.0f), false));
}
} else if (messageObject4 != null) {
this.forwardingMessages = null;
this.editingMessageObject = null;
this.replyingMessageObject = messageObject4;
this.chatActivityEnterView.setReplyingMessageObject(messageObject4);
this.chatActivityEnterView.setEditingMessageObject(null, false);
if (this.foundWebPage != null) {
return;
}
this.chatActivityEnterView.setForceShowSendButton(false, false);
if (messageObject4.isFromUser()) {
TLRPC.User user2 = getMessagesController().getUser(Integer.valueOf(messageObject4.messageOwner.from_id));
if (user2 == null) {
return;
}
str = UserObject.getName(user2);
} else {
if (ChatObject.isChannel(this.currentChat) && this.currentChat.megagroup && messageObject4.isForwardedChannelPost()) {
chat2 = getMessagesController().getChat(Integer.valueOf(messageObject4.messageOwner.fwd_from.channel_id));
} else {
chat2 = getMessagesController().getChat(Integer.valueOf(messageObject4.messageOwner.to_id.channel_id));
}
if (chat2 == null) {
return;
}
str = chat2.title;
}
this.replyIconImageView.setImageResource(R.drawable.msg_panel_reply);
this.replyNameTextView.setText(str);
this.replyIconImageView.setContentDescription(LocaleController.getString("AccDescrReplying", R.string.AccDescrReplying));
this.replyCloseImageView.setContentDescription(LocaleController.getString("AccDescrCancelReply", R.string.AccDescrCancelReply));
if (messageObject4.messageOwner.media instanceof TLRPC.TL_messageMediaGame) {
this.replyObjectTextView.setText(Emoji.replaceEmoji(messageObject4.messageOwner.media.game.title, this.replyObjectTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14.0f), false));
} else if (messageObject4.messageText != null) {
String charSequence2 = messageObject4.messageText.toString();
if (charSequence2.length() > 150) {
charSequence2 = charSequence2.substring(0, 150);
}
String replace2 = charSequence2.replace('\n', ' ');
SimpleTextView simpleTextView2 = this.replyObjectTextView;
simpleTextView2.setText(Emoji.replaceEmoji(replace2, simpleTextView2.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14.0f), false));
}
} else if (arrayList2 != null) {
if (arrayList2.isEmpty()) {
return;
}
this.replyingMessageObject = null;
this.editingMessageObject = null;
this.chatActivityEnterView.setReplyingMessageObject(null);
this.chatActivityEnterView.setEditingMessageObject(null, false);
this.forwardingMessages = arrayList2;
if (this.foundWebPage != null) {
return;
}
this.chatActivityEnterView.setForceShowSendButton(true, false);
ArrayList arrayList4 = new ArrayList();
this.replyIconImageView.setImageResource(R.drawable.msg_panel_forward);
this.replyIconImageView.setContentDescription(LocaleController.getString("AccDescrForwarding", R.string.AccDescrForwarding));
this.replyCloseImageView.setContentDescription(LocaleController.getString("AccDescrCancelForward", R.string.AccDescrCancelForward));
MessageObject messageObject6 = arrayList2.get(0);
if (messageObject6.isFromUser()) {
arrayList4.add(Integer.valueOf(messageObject6.messageOwner.from_id));
} else {
TLRPC.Chat chat3 = getMessagesController().getChat(Integer.valueOf(messageObject6.messageOwner.to_id.channel_id));
if (ChatObject.isChannel(chat3) && chat3.megagroup && messageObject6.isForwardedChannelPost()) {
arrayList4.add(Integer.valueOf(-messageObject6.messageOwner.fwd_from.channel_id));
} else {
arrayList4.add(Integer.valueOf(-messageObject6.messageOwner.to_id.channel_id));
}
}
int i9 = messageObject6.isAnimatedEmoji() ? 0 : messageObject6.type;
for (int i10 = 1; i10 < arrayList2.size(); i10++) {
MessageObject messageObject7 = arrayList2.get(i10);
if (messageObject7.isFromUser()) {
i4 = messageObject7.messageOwner.from_id;
} else {
TLRPC.Chat chat4 = getMessagesController().getChat(Integer.valueOf(messageObject7.messageOwner.to_id.channel_id));
if (ChatObject.isChannel(chat4) && chat4.megagroup && messageObject7.isForwardedChannelPost()) {
i3 = messageObject7.messageOwner.fwd_from.channel_id;
} else {
i3 = messageObject7.messageOwner.to_id.channel_id;
}
i4 = -i3;
}
if (!arrayList4.contains(Integer.valueOf(i4))) {
arrayList4.add(Integer.valueOf(i4));
}
if (arrayList2.get(i10).type != i9) {
i9 = -1;
}
}
StringBuilder sb = new StringBuilder();
int i11 = 0;
while (true) {
if (i11 >= arrayList4.size()) {
break;
}
Integer num = (Integer) arrayList4.get(i11);
if (num.intValue() > 0) {
user = getMessagesController().getUser(num);
chat = null;
} else {
chat = getMessagesController().getChat(Integer.valueOf(-num.intValue()));
user = null;
}
if (user != null || chat != null) {
if (arrayList4.size() != 1) {
if (arrayList4.size() == 2 || sb.length() == 0) {
if (sb.length() > 0) {
sb.append(", ");
}
if (user != null) {
if (!TextUtils.isEmpty(user.first_name)) {
sb.append(user.first_name);
} else if (!TextUtils.isEmpty(user.last_name)) {
sb.append(user.last_name);
} else {
sb.append(" ");
}
} else {
sb.append(chat.title);
}
} else {
sb.append(" ");
sb.append(LocaleController.formatPluralString("AndOther", arrayList4.size() - 1));
break;
}
} else if (user != null) {
sb.append(UserObject.getName(user));
} else {
sb.append(chat.title);
}
}
i11++;
}
this.replyNameTextView.setText(sb);
if (i9 == -1 || i9 == 0 || i9 == 10 || i9 == 11) {
if (arrayList2.size() == 1 && arrayList2.get(0).messageText != null) {
MessageObject messageObject8 = arrayList2.get(0);
if (messageObject8.messageOwner.media instanceof TLRPC.TL_messageMediaGame) {
this.replyObjectTextView.setText(Emoji.replaceEmoji(messageObject8.messageOwner.media.game.title, this.replyObjectTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14.0f), false));
} else {
String charSequence3 = messageObject8.messageText.toString();
if (charSequence3.length() > 150) {
charSequence3 = charSequence3.substring(0, 150);
}
String replace3 = charSequence3.replace('\n', ' ');
SimpleTextView simpleTextView3 = this.replyObjectTextView;
simpleTextView3.setText(Emoji.replaceEmoji(replace3, simpleTextView3.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14.0f), false));
}
} else {
this.replyObjectTextView.setText(LocaleController.formatPluralString("ForwardedMessageCount", arrayList2.size()));
}
} else if (i9 == 1) {
this.replyObjectTextView.setText(LocaleController.formatPluralString("ForwardedPhoto", arrayList2.size()));
if (arrayList2.size() == 1) {
messageObject4 = arrayList2.get(0);
}
} else if (i9 == 4) {
this.replyObjectTextView.setText(LocaleController.formatPluralString("ForwardedLocation", arrayList2.size()));
} else if (i9 == 3) {
this.replyObjectTextView.setText(LocaleController.formatPluralString("ForwardedVideo", arrayList2.size()));
if (arrayList2.size() == 1) {
messageObject4 = arrayList2.get(0);
}
} else if (i9 == 12) {
this.replyObjectTextView.setText(LocaleController.formatPluralString("ForwardedContact", arrayList2.size()));
} else if (i9 == 2) {
this.replyObjectTextView.setText(LocaleController.formatPluralString("ForwardedAudio", arrayList2.size()));
} else if (i9 == 5) {
this.replyObjectTextView.setText(LocaleController.formatPluralString("ForwardedRound", arrayList2.size()));
} else if (i9 == 14) {
this.replyObjectTextView.setText(LocaleController.formatPluralString("ForwardedMusic", arrayList2.size()));
} else if (i9 == 13 || i9 == 15) {
this.replyObjectTextView.setText(LocaleController.formatPluralString("ForwardedSticker", arrayList2.size()));
} else if (i9 == 17) {
this.replyObjectTextView.setText(LocaleController.formatPluralString("ForwardedPoll", arrayList2.size()));
} else if (i9 == 8 || i9 == 9) {
if (arrayList2.size() != 1) {
this.replyObjectTextView.setText(LocaleController.formatPluralString("ForwardedFile", arrayList2.size()));
} else if (i9 == 8) {
this.replyObjectTextView.setText(LocaleController.getString("AttachGif", R.string.AttachGif));
} else {
String documentFileName = FileLoader.getDocumentFileName(arrayList2.get(0).getDocument());
if (documentFileName.length() != 0) {
this.replyObjectTextView.setText(documentFileName);
}
messageObject4 = arrayList2.get(0);
}
}
} else {
this.replyIconImageView.setImageResource(R.drawable.msg_link);
if (webPage instanceof TLRPC.TL_webPagePending) {
this.replyNameTextView.setText(LocaleController.getString("GettingLinkInfo", R.string.GettingLinkInfo));
this.replyObjectTextView.setText(this.pendingLinkSearchString);
} else {
if (webPage.site_name != null) {
this.replyNameTextView.setText(webPage.site_name);
} else if (webPage.title != null) {
this.replyNameTextView.setText(webPage.title);
} else {
this.replyNameTextView.setText(LocaleController.getString("LinkPreview", R.string.LinkPreview));
}
if (webPage.title != null) {
this.replyObjectTextView.setText(webPage.title);
} else if (webPage.description != null) {
this.replyObjectTextView.setText(webPage.description);
} else if (webPage.author != null) {
this.replyObjectTextView.setText(webPage.author);
} else {
this.replyObjectTextView.setText(webPage.display_url);
}
this.chatActivityEnterView.setWebPage(webPage, true);
}
}
if (messageObject4 == null) {
messageObject4 = messageObject2 != null ? messageObject2 : null;
}
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.replyNameTextView.getLayoutParams();
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) this.replyObjectTextView.getLayoutParams();
if (messageObject4 != null) {
photoSize = FileLoader.getClosestPhotoSizeWithSize(messageObject4.photoThumbs2, 320);
photoSize2 = FileLoader.getClosestPhotoSizeWithSize(messageObject4.photoThumbs2, AndroidUtilities.dp(40.0f));
tLObject = messageObject4.photoThumbsObject2;
if (photoSize == null) {
if (messageObject4.mediaExists) {
if (messageObject4.type == 1) {
TLRPC.Document document = messageObject4.getDocument();
int photoSize3 = AndroidUtilities.getPhotoSize();
if (document != null) {
if (MessageObject.isVoiceDocument(document) || MessageObject.isMusicDocument(document) || ((document.mime_type != null && document.mime_type.toLowerCase().startsWith(PREFIX_VIDEO)) || MessageObject.isGifDocument(document))) {
photoSize3 = AndroidUtilities.getPhotoSize();
} else if ((document.mime_type != null && document.mime_type.toLowerCase().startsWith("image/")) || MessageObject.isDocumentHasThumb(document)) {
photoSize3 = 80000;
}
}
photoSize = FileLoader.getClosestPhotoSizeWithSize(messageObject4.photoThumbs, photoSize3);
} else {
photoSize = FileLoader.getClosestPhotoSizeWithSize(messageObject4.photoThumbs, AndroidUtilities.getPhotoSize());
}
i8 = photoSize != null ? photoSize.size : 0;
i7 = 0;
} else {
photoSize = FileLoader.getClosestPhotoSizeWithSize(messageObject4.photoThumbs, 320);
i7 = 1;
i8 = 0;
}
TLRPC.PhotoSize closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(messageObject4.photoThumbs, AndroidUtilities.dp(40.0f));
tLObject = messageObject4.photoThumbsObject;
i6 = i7;
i5 = i8;
photoSize2 = closestPhotoSizeWithSize;
} else {
i5 = 0;
i6 = 1;
}
} else {
photoSize = null;
i5 = 0;
photoSize2 = null;
i6 = 1;
tLObject = null;
}
if (photoSize == photoSize2) {
photoSize2 = null;
}
if (photoSize == null || (photoSize instanceof TLRPC.TL_photoSizeEmpty) || (photoSize.location instanceof TLRPC.TL_fileLocationUnavailable) || messageObject4.isAnyKindOfSticker() || (messageObject4 != null && messageObject4.isSecretMedia())) {
this.replyImageView.setImageBitmap(null);
this.replyImageLocation = null;
this.replyImageLocationObject = null;
if (!((arrayList2 == null || (messageObject3 = arrayList2.get(0)) == null || messageObject3.type != 207) ? false : true)) {
this.replyImageView.setVisibility(4);
int dp = AndroidUtilities.dp(52.0f);
layoutParams2.leftMargin = dp;
layoutParams.leftMargin = dp;
}
} else {
if (messageObject4 != null && messageObject4.isRoundVideo()) {
this.replyImageView.setRoundRadius(AndroidUtilities.dp(17.0f));
} else {
this.replyImageView.setRoundRadius(0);
}
this.replyImageSize = i5;
this.replyImageCacheType = i6;
this.replyImageLocation = photoSize;
this.replyImageThumbLocation = photoSize2;
this.replyImageLocationObject = tLObject;
this.replyImageView.setImage(ImageLocation.getForObject(photoSize, tLObject), "50_50", ImageLocation.getForObject(photoSize2, tLObject), "50_50_b", null, i5, i6, messageObject4);
this.replyImageView.setVisibility(0);
int dp2 = AndroidUtilities.dp(96.0f);
layoutParams2.leftMargin = dp2;
layoutParams.leftMargin = dp2;
}
this.replyNameTextView.setLayoutParams(layoutParams);
this.replyObjectTextView.setLayoutParams(layoutParams2);
this.chatActivityEnterView.showTopView(true, z6);
}
}
public void lambda$showFieldPanel$65$ChatActivity() {
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null) {
chatActivityEnterView.openKeyboard();
}
}
public void moveScrollToLastMessage() {
if (this.chatListView == null || this.messages.isEmpty()) {
return;
}
this.chatLayoutManager.scrollToPositionWithOffset(0, 0);
}
public boolean sendSecretMessageRead(MessageObject messageObject) {
if (messageObject == null || messageObject.isOut() || !messageObject.isSecretMedia() || messageObject.messageOwner.destroyTime != 0 || messageObject.messageOwner.ttl <= 0) {
return false;
}
if (this.currentEncryptedChat != null) {
getMessagesController().markMessageAsRead(this.dialog_id, messageObject.messageOwner.random_id, messageObject.messageOwner.ttl);
} else {
getMessagesController().markMessageAsRead(messageObject.getId(), ChatObject.isChannel(this.currentChat) ? this.currentChat.id : 0, null, messageObject.messageOwner.ttl, 0L);
}
messageObject.messageOwner.destroyTime = messageObject.messageOwner.ttl + getConnectionsManager().getCurrentTime();
return true;
}
private void clearChatData() {
this.messages.clear();
this.messagesByDays.clear();
this.waitingForLoad.clear();
this.groupedMessagesMap.clear();
listViewShowEmptyView(true, this.chatAdapter.botInfoRow == -1);
for (int i = 0; i < 2; i++) {
this.messagesDict[i].clear();
if (this.currentEncryptedChat == null) {
this.maxMessageId[i] = Integer.MAX_VALUE;
this.minMessageId[i] = Integer.MIN_VALUE;
} else {
this.maxMessageId[i] = Integer.MIN_VALUE;
this.minMessageId[i] = Integer.MAX_VALUE;
}
this.maxDate[i] = Integer.MIN_VALUE;
this.minDate[i] = 0;
this.endReached[i] = false;
this.cacheEndReached[i] = false;
this.forwardEndReached[i] = true;
}
this.first = true;
this.firstLoading = true;
this.loading = true;
this.loadingForward = false;
this.waitingForReplyMessageLoad = false;
this.startLoadFromMessageId = 0;
this.showScrollToMessageError = false;
this.last_message_id = 0;
this.unreadMessageObject = null;
this.createUnreadMessageAfterId = 0;
this.createUnreadMessageAfterIdLoading = false;
this.needSelectFromMessageId = false;
this.chatAdapter.notifyDataSetChanged();
}
private void scrollToLastMessage(boolean z) {
if (this.forwardEndReached[0] && this.first_unread_id == 0 && this.startLoadFromMessageId == 0) {
if (z && this.chatLayoutManager.findFirstCompletelyVisibleItemPosition() == 0) {
showPagedownButton(false, true);
removeSelectedMessageHighlight();
updateVisibleRows();
return;
}
this.chatLayoutManager.scrollToPositionWithOffset(0, 0);
return;
}
clearChatData();
this.waitingForLoad.add(Integer.valueOf(this.lastLoadIndex));
MessagesController messagesController = getMessagesController();
long j = this.dialog_id;
int i = this.classGuid;
boolean isChannel = ChatObject.isChannel(this.currentChat);
boolean z2 = this.inScheduleMode;
int i2 = this.lastLoadIndex;
this.lastLoadIndex = i2 + 1;
messagesController.loadMessages(j, 30, 0, 0, true, 0, i, 0, 0, isChannel, z2, i2);
}
public void updateTextureViewPosition(boolean z) {
boolean z2;
MessageObject playingMessageObject;
if (this.fragmentView == null || this.paused) {
return;
}
int childCount = this.chatListView.getChildCount();
int i = 0;
while (true) {
if (i >= childCount) {
z2 = false;
break;
}
View childAt = this.chatListView.getChildAt(i);
if (childAt instanceof ChatMessageCell) {
ChatMessageCell chatMessageCell = (ChatMessageCell) childAt;
MessageObject messageObject = chatMessageCell.getMessageObject();
if (this.videoPlayerContainer != null && ((messageObject.isRoundVideo() || messageObject.isVideo()) && MediaController.getInstance().isPlayingMessage(messageObject))) {
ImageReceiver photoImage = chatMessageCell.getPhotoImage();
this.videoPlayerContainer.setTranslationX(photoImage.getImageX() + chatMessageCell.getX());
this.videoPlayerContainer.setTranslationY((((this.fragmentView.getPaddingTop() + chatMessageCell.getTop()) + photoImage.getImageY()) - this.chatListViewClipTop) + this.chatListView.getTranslationY() + (this.inPreviewMode ? AndroidUtilities.statusBarHeight : 0));
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.videoPlayerContainer.getLayoutParams();
if (messageObject.isRoundVideo()) {
this.videoPlayerContainer.setTag(R.id.parent_tag, null);
if (layoutParams.width != AndroidUtilities.roundMessageSize || layoutParams.height != AndroidUtilities.roundMessageSize) {
int i2 = AndroidUtilities.roundMessageSize;
layoutParams.height = i2;
layoutParams.width = i2;
this.aspectRatioFrameLayout.setResizeMode(0);
this.videoPlayerContainer.setLayoutParams(layoutParams);
}
} else {
this.videoPlayerContainer.setTag(R.id.parent_tag, 1);
if (layoutParams.width != photoImage.getImageWidth() || layoutParams.height != photoImage.getImageHeight()) {
this.aspectRatioFrameLayout.setResizeMode(3);
layoutParams.width = photoImage.getImageWidth();
layoutParams.height = photoImage.getImageHeight();
this.videoPlayerContainer.setLayoutParams(layoutParams);
}
}
this.fragmentView.invalidate();
this.videoPlayerContainer.invalidate();
z2 = true;
}
}
i++;
}
if (!z || this.videoPlayerContainer == null || (playingMessageObject = MediaController.getInstance().getPlayingMessageObject()) == null || playingMessageObject.eventId != 0) {
return;
}
if (!z2) {
if (this.checkTextureViewPosition && playingMessageObject.isVideo()) {
MediaController.getInstance().cleanupPlayer(true, true);
return;
}
this.videoPlayerContainer.setTranslationY((-AndroidUtilities.roundMessageSize) - 100);
this.fragmentView.invalidate();
if (playingMessageObject != null) {
if (playingMessageObject.isRoundVideo() || playingMessageObject.isVideo()) {
if (this.checkTextureViewPosition || PipRoundVideoView.getInstance() != null) {
MediaController.getInstance().setCurrentVideoVisible(false);
return;
} else {
scrollToMessageId(playingMessageObject.getId(), 0, false, 0, true);
return;
}
}
return;
}
return;
}
MediaController.getInstance().setCurrentVideoVisible(true);
if (playingMessageObject.isRoundVideo() || this.scrollToVideo) {
scrollToMessageId(playingMessageObject.getId(), 0, false, 0, true);
} else {
this.chatListView.invalidate();
}
}
public void updateMessagesVisiblePart(boolean z) {
int i;
boolean z2;
View view;
ChatActionCell chatActionCell;
MessageObject messageObject;
int i2;
int i3;
ChatMessageCell chatMessageCell;
View view2;
View view3;
MessageObject messageObject2;
int i4;
RecyclerListView recyclerListView = this.chatListView;
if (recyclerListView == null) {
return;
}
int childCount = recyclerListView.getChildCount();
int measuredHeight = this.chatListView.getMeasuredHeight();
Integer num = getMessagesController().dialogs_read_inbox_max.get(Long.valueOf(this.dialog_id));
if (num == null) {
num = 0;
}
TLRPC.EncryptedChat encryptedChat = this.currentEncryptedChat;
this.pollsToCheck.clear();
int i5 = Integer.MAX_VALUE;
int i6 = Integer.MIN_VALUE;
int i7 = 0;
boolean z3 = false;
ChatMessageCell chatMessageCell2 = null;
View view4 = null;
View view5 = null;
int i8 = Integer.MAX_VALUE;
int i9 = Integer.MAX_VALUE;
int i10 = Integer.MIN_VALUE;
while (i7 < childCount) {
View childAt = this.chatListView.getChildAt(i7);
boolean z4 = childAt instanceof ChatMessageCell;
if (z4) {
i2 = childCount;
ChatMessageCell chatMessageCell3 = (ChatMessageCell) childAt;
view2 = view4;
int top = chatMessageCell3.getTop();
chatMessageCell3.getBottom();
if (top >= 0) {
chatMessageCell = chatMessageCell2;
view3 = view5;
i4 = 0;
} else {
view3 = view5;
i4 = -top;
chatMessageCell = chatMessageCell2;
}
int measuredHeight2 = chatMessageCell3.getMeasuredHeight();
if (measuredHeight2 > measuredHeight) {
measuredHeight2 = i4 + measuredHeight;
}
chatMessageCell3.setVisiblePart(i4, measuredHeight2 - i4);
messageObject2 = chatMessageCell3.getMessageObject();
if (this.videoPlayerContainer != null) {
boolean z5 = messageObject2.isVideo() || messageObject2.isRoundVideo();
if (z5) {
i3 = measuredHeight;
if (MediaController.getInstance().isPlayingMessage(messageObject2)) {
ImageReceiver photoImage = chatMessageCell3.getPhotoImage();
if (!z5 || photoImage.getImageY2() + top >= 0) {
this.videoPlayerContainer.setTranslationX(photoImage.getImageX() + chatMessageCell3.getX());
this.videoPlayerContainer.setTranslationY((((this.fragmentView.getPaddingTop() + top) + photoImage.getImageY()) - this.chatListViewClipTop) + this.chatListView.getTranslationY() + (this.inPreviewMode ? AndroidUtilities.statusBarHeight : 0));
this.fragmentView.invalidate();
this.videoPlayerContainer.invalidate();
z3 = true;
} else {
z3 = false;
}
}
}
}
i3 = measuredHeight;
} else {
i2 = childCount;
i3 = measuredHeight;
chatMessageCell = chatMessageCell2;
view2 = view4;
view3 = view5;
messageObject2 = childAt instanceof ChatActionCell ? ((ChatActionCell) childAt).getMessageObject() : null;
}
if (!this.inScheduleMode && messageObject2 != null) {
if ((!messageObject2.isOut() && messageObject2.isUnread()) || (messageObject2.messageOwner.from_scheduled && messageObject2.getId() > num.intValue())) {
int id = messageObject2.getId();
if (id > 0) {
i10 = Math.max(i10, messageObject2.getId());
}
if (id < 0) {
i9 = Math.min(i9, messageObject2.getId());
}
i6 = Math.max(i6, messageObject2.messageOwner.date);
}
if (messageObject2.type == 17) {
this.pollsToCheck.add(messageObject2);
}
}
if (childAt.getBottom() <= this.chatListView.getPaddingTop() + AndroidUtilities.dp(1.0f) + this.chatListViewClipTop) {
view4 = view2;
view5 = view3;
} else {
int bottom = childAt.getBottom();
if (bottom < i8) {
if (z4 || (childAt instanceof ChatActionCell)) {
chatMessageCell = childAt;
}
i8 = bottom;
view5 = childAt;
} else {
view5 = view3;
}
if ((childAt instanceof ChatActionCell) && messageObject2.isDateObject) {
if (childAt.getAlpha() != 1.0f) {
childAt.setAlpha(1.0f);
}
if (bottom < i5) {
i5 = bottom;
view4 = childAt;
}
}
view4 = view2;
}
chatMessageCell2 = chatMessageCell;
i7++;
childCount = i2;
measuredHeight = i3;
}
ChatMessageCell chatMessageCell4 = chatMessageCell2;
View view6 = view4;
View view7 = view5;
getMessagesController().addToPollsQueue(this.dialog_id, this.pollsToCheck);
if (this.videoPlayerContainer != null) {
if (!z3) {
MessageObject playingMessageObject = MediaController.getInstance().getPlayingMessageObject();
if (playingMessageObject != null) {
if (this.checkTextureViewPosition && playingMessageObject.isVideo()) {
MediaController.getInstance().cleanupPlayer(true, true);
} else {
this.videoPlayerContainer.setTranslationY((-AndroidUtilities.roundMessageSize) - 100);
this.fragmentView.invalidate();
if ((playingMessageObject.isRoundVideo() || playingMessageObject.isVideo()) && playingMessageObject.eventId == 0 && this.checkTextureViewPosition) {
MediaController.getInstance().setCurrentVideoVisible(false);
}
}
}
} else {
MediaController.getInstance().setCurrentVideoVisible(true);
}
}
if (chatMessageCell4 != null) {
if (chatMessageCell4 instanceof ChatMessageCell) {
messageObject = chatMessageCell4.getMessageObject();
} else {
messageObject = ((ChatActionCell) chatMessageCell4).getMessageObject();
}
this.floatingDateView.setCustomDate(messageObject.messageOwner.date, this.inScheduleMode);
}
this.currentFloatingDateOnScreen = false;
this.currentFloatingTopIsNotMessage = ((view7 instanceof ChatMessageCell) || (view7 instanceof ChatActionCell)) ? false : true;
if (view6 != null) {
if (view6.getTop() - this.chatListViewClipTop > this.chatListView.getPaddingTop() || this.currentFloatingTopIsNotMessage) {
view = view6;
if (view.getAlpha() != 1.0f) {
view.setAlpha(1.0f);
}
hideFloatingDateView(!this.currentFloatingTopIsNotMessage);
} else {
view = view6;
if (view6.getAlpha() != 0.0f) {
view.setAlpha(0.0f);
}
AnimatorSet animatorSet = this.floatingDateAnimation;
if (animatorSet != null) {
animatorSet.cancel();
this.floatingDateAnimation = null;
}
if (this.floatingDateView.getTag() == null) {
this.floatingDateView.setTag(1);
}
if (this.floatingDateView.getAlpha() != 1.0f) {
this.floatingDateView.setAlpha(1.0f);
}
this.currentFloatingDateOnScreen = true;
}
float bottom2 = (view.getBottom() - this.chatListView.getPaddingTop()) - this.chatListViewClipTop;
if (bottom2 > this.floatingDateView.getMeasuredHeight() && bottom2 < this.floatingDateView.getMeasuredHeight() * 2) {
this.floatingDateView.setTranslationY(((-chatActionCell.getMeasuredHeight()) * 2) + bottom2);
} else {
this.floatingDateView.setTranslationY(0.0f);
}
} else {
hideFloatingDateView(true);
this.floatingDateView.setTranslationY(0.0f);
}
if (this.firstLoading || this.paused || this.inPreviewMode || this.inScheduleMode) {
return;
}
if (i10 != Integer.MIN_VALUE || i9 != Integer.MAX_VALUE) {
int i11 = 0;
int i12 = 0;
for (int i13 = 0; i13 < this.messages.size(); i13++) {
MessageObject messageObject3 = this.messages.get(i13);
int id2 = messageObject3.getId();
if (i10 != Integer.MIN_VALUE && id2 > 0 && id2 <= i10 && !messageObject3.isUnread() && ((messageObject3.messageOwner.from_scheduled && id2 > num.intValue()) || messageObject3.isUnread())) {
if (messageObject3.messageOwner.from_scheduled) {
i12++;
} else {
messageObject3.setIsRead();
}
i11++;
}
if (i9 != Integer.MAX_VALUE && id2 < 0 && id2 >= i9 && messageObject3.isUnread()) {
messageObject3.setIsRead();
i11++;
}
}
if ((this.forwardEndReached[0] && i10 == this.minMessageId[0]) || i9 == this.minMessageId[0]) {
this.newUnreadMessageCount = 0;
} else {
int i14 = this.newUnreadMessageCount - i11;
this.newUnreadMessageCount = i14;
if (i14 < 0) {
this.newUnreadMessageCount = 0;
}
}
if (z) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.inlineUpdate1();
}
});
} else {
inlineUpdate1();
}
MessagesController messagesController = getMessagesController();
long j = this.dialog_id;
int[] iArr = this.minMessageId;
if (i10 == iArr[0] || i9 == iArr[0]) {
i = i9;
z2 = true;
} else {
i = i9;
z2 = false;
}
messagesController.markDialogAsRead(j, i10, i, i6, false, i11, z2, i12);
this.firstUnreadSent = true;
} else if (!this.firstUnreadSent && this.chatLayoutManager.findFirstVisibleItemPosition() == 0) {
this.newUnreadMessageCount = 0;
if (z) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.inlineUpdate2();
}
});
} else {
inlineUpdate2();
}
MessagesController messagesController2 = getMessagesController();
long j2 = this.dialog_id;
int[] iArr2 = this.minMessageId;
messagesController2.markDialogAsRead(j2, iArr2[0], iArr2[0], this.maxDate[0], false, 0, true, 0);
this.firstUnreadSent = true;
}
}
public void inlineUpdate1() {
int i = this.prevSetUnreadCount;
int i2 = this.newUnreadMessageCount;
if (i != i2) {
this.prevSetUnreadCount = i2;
this.pagedownButtonCounter.setText(String.format("%d", Integer.valueOf(i2)));
}
if (this.newUnreadMessageCount <= 0) {
if (this.pagedownButtonCounter.getVisibility() != 4) {
this.pagedownButtonCounter.setVisibility(4);
}
} else if (this.pagedownButtonCounter.getVisibility() != 0) {
this.pagedownButtonCounter.setVisibility(0);
}
}
public void inlineUpdate2() {
int i = this.prevSetUnreadCount;
int i2 = this.newUnreadMessageCount;
if (i != i2) {
this.prevSetUnreadCount = i2;
this.pagedownButtonCounter.setText(String.format("%d", Integer.valueOf(i2)));
}
if (this.pagedownButtonCounter.getVisibility() != 4) {
this.pagedownButtonCounter.setVisibility(4);
}
}
public void toggleMute(boolean z) {
if (getMessagesController().isDialogMuted(this.dialog_id)) {
SharedPreferences.Editor edit2 = MessagesController.getNotificationsSettings(this.currentAccount).edit();
edit2.putInt("notify2_" + this.dialog_id, 0);
getMessagesStorage().setDialogFlags(this.dialog_id, 0L);
edit2.commit();
TLRPC.Dialog dialog = getMessagesController().dialogs_dict.get(this.dialog_id);
if (dialog != null) {
dialog.notify_settings = new TLRPC.TL_peerNotifySettings();
}
getNotificationsController().updateServerNotificationsSettings(this.dialog_id);
} else if (z) {
SharedPreferences.Editor edit3 = MessagesController.getNotificationsSettings(this.currentAccount).edit();
edit3.putInt("notify2_" + this.dialog_id, 2);
getMessagesStorage().setDialogFlags(this.dialog_id, 1L);
edit3.commit();
TLRPC.Dialog dialog2 = getMessagesController().dialogs_dict.get(this.dialog_id);
if (dialog2 != null) {
dialog2.notify_settings = new TLRPC.TL_peerNotifySettings();
dialog2.notify_settings.mute_until = Integer.MAX_VALUE;
}
getNotificationsController().updateServerNotificationsSettings(this.dialog_id);
getNotificationsController().removeNotificationsForDialog(this.dialog_id);
} else if (isSysNotifyMessage().booleanValue()) {
NotificationsController.getInstance(UserConfig.selectedAccount).setDialogNotificationsSettings(this.dialog_id, 3);
} else {
showDialog(AlertsCreator.createMuteAlert(getParentActivity(), this.dialog_id));
}
}
private int getScrollOffsetForMessage(MessageObject messageObject) {
int i;
float f;
int measuredHeight;
int dp;
MessageObject.GroupedMessages validGroupedMessage = getValidGroupedMessage(messageObject);
if (validGroupedMessage != null) {
MessageObject.GroupedMessagePosition groupedMessagePosition = validGroupedMessage.positions.get(messageObject);
float max = Math.max(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) * 0.5f;
if (groupedMessagePosition.siblingHeights != null) {
f = groupedMessagePosition.siblingHeights[0];
} else {
f = groupedMessagePosition.ph;
}
SparseBooleanArray sparseBooleanArray = new SparseBooleanArray();
float f2 = 0.0f;
float f3 = 0.0f;
for (int i2 = 0; i2 < validGroupedMessage.posArray.size(); i2++) {
MessageObject.GroupedMessagePosition groupedMessagePosition2 = validGroupedMessage.posArray.get(i2);
if (sparseBooleanArray.indexOfKey(groupedMessagePosition2.minY) < 0 && groupedMessagePosition2.siblingHeights == null) {
sparseBooleanArray.put(groupedMessagePosition2.minY, true);
if (groupedMessagePosition2.minY < groupedMessagePosition.minY) {
f3 -= groupedMessagePosition2.ph;
} else if (groupedMessagePosition2.minY > groupedMessagePosition.minY) {
f3 += groupedMessagePosition2.ph;
}
f2 += groupedMessagePosition2.ph;
}
}
if (Math.abs(f2 - f) < 0.02f) {
measuredHeight = (((int) (this.chatListView.getMeasuredHeight() - (f2 * max))) / 2) - this.chatListView.getPaddingTop();
dp = AndroidUtilities.dp(7.0f);
} else {
measuredHeight = (((int) (this.chatListView.getMeasuredHeight() - ((f + f3) * max))) / 2) - this.chatListView.getPaddingTop();
dp = AndroidUtilities.dp(7.0f);
}
i = measuredHeight - dp;
} else {
i = Integer.MAX_VALUE;
}
if (i == Integer.MAX_VALUE) {
i = (this.chatListView.getMeasuredHeight() - messageObject.getApproximateHeight()) / 2;
}
return Math.max(0, i);
}
public void startMessageUnselect() {
Runnable runnable = this.unselectRunnable;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
}
Runnable runnable2 = new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$startMessageUnselect$66$ChatActivity();
}
};
this.unselectRunnable = runnable2;
AndroidUtilities.runOnUIThread(runnable2, 1000L);
}
public void lambda$startMessageUnselect$66$ChatActivity() {
this.highlightMessageId = Integer.MAX_VALUE;
updateVisibleRows();
this.unselectRunnable = null;
}
public void removeSelectedMessageHighlight() {
Runnable runnable = this.unselectRunnable;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
this.unselectRunnable = null;
}
this.highlightMessageId = Integer.MAX_VALUE;
}
public void scrollToMessageId(int i, int i2, boolean z, int i3, boolean z2) {
boolean z3;
boolean z4;
MessageObject messageObject;
this.wasManualScroll = true;
MessageObject messageObject2 = this.messagesDict[i3].get(i);
if (messageObject2 == null || this.messages.indexOf(messageObject2) == -1) {
z3 = true;
} else {
removeSelectedMessageHighlight();
if (z) {
this.highlightMessageId = i;
}
int scrollOffsetForMessage = getScrollOffsetForMessage(messageObject2);
if (z2) {
ArrayList<MessageObject> arrayList = this.messages;
if (arrayList.get(arrayList.size() - 1) == messageObject2) {
this.chatListView.smoothScrollToPosition(this.chatAdapter.getItemCount() - 1);
} else {
this.chatListView.smoothScrollToPosition(this.chatAdapter.messagesStartRow + this.messages.indexOf(messageObject2));
}
} else {
ArrayList<MessageObject> arrayList2 = this.messages;
if (arrayList2.get(arrayList2.size() - 1) == messageObject2) {
this.chatLayoutManager.scrollToPositionWithOffset(this.chatAdapter.getItemCount() - 1, scrollOffsetForMessage, false);
} else {
this.chatLayoutManager.scrollToPositionWithOffset(this.chatAdapter.messagesStartRow + this.messages.indexOf(messageObject2), scrollOffsetForMessage, false);
}
}
updateVisibleRows();
int childCount = this.chatListView.getChildCount();
for (int i4 = 0; i4 < childCount; i4++) {
View childAt = this.chatListView.getChildAt(i4);
if (childAt instanceof ChatMessageCell) {
MessageObject messageObject3 = ((ChatMessageCell) childAt).getMessageObject();
if (messageObject3 != null && messageObject3.getId() == messageObject2.getId()) {
childAt.sendAccessibilityEvent(8);
z4 = true;
break;
}
} else {
if ((childAt instanceof ChatActionCell) && (messageObject = ((ChatActionCell) childAt).getMessageObject()) != null && messageObject.getId() == messageObject2.getId()) {
childAt.sendAccessibilityEvent(8);
z4 = true;
break;
}
}
}
z4 = false;
if (!z4) {
showPagedownButton(true, true);
}
z3 = false;
}
if (z3) {
if (this.currentEncryptedChat != null && !getMessagesStorage().checkMessageId(this.dialog_id, this.startLoadFromMessageId)) {
return;
}
this.waitingForLoad.clear();
this.waitingForReplyMessageLoad = true;
removeSelectedMessageHighlight();
this.scrollToMessagePosition = -10000;
this.startLoadFromMessageId = i;
this.showScrollToMessageError = true;
if (i == this.createUnreadMessageAfterId) {
this.createUnreadMessageAfterIdLoading = true;
}
this.waitingForLoad.add(Integer.valueOf(this.lastLoadIndex));
MessagesController messagesController = getMessagesController();
long j = i3 == 0 ? this.dialog_id : this.mergeDialogId;
int i5 = AndroidUtilities.isTablet() ? 30 : 20;
int i6 = this.startLoadFromMessageId;
int i7 = this.classGuid;
boolean isChannel = ChatObject.isChannel(this.currentChat);
boolean z5 = this.inScheduleMode;
int i8 = this.lastLoadIndex;
this.lastLoadIndex = i8 + 1;
messagesController.loadMessages(j, i5, i6, 0, true, 0, i7, 3, 0, isChannel, z5, i8);
} else {
View childAt2 = this.chatListView.getChildAt(0);
if (childAt2 != null && childAt2.getTop() <= 0) {
showFloatingDateView(false);
}
}
this.returnToMessageId = i2;
this.returnToLoadIndex = i3;
this.needSelectFromMessageId = z;
}
public void showPagedownButton(boolean z, boolean z2) {
FrameLayout frameLayout = this.pagedownButton;
if (frameLayout == null) {
return;
}
if (z) {
this.pagedownButtonShowedByScroll = false;
if (frameLayout.getTag() == null) {
AnimatorSet animatorSet = this.pagedownButtonAnimation;
if (animatorSet != null) {
animatorSet.cancel();
this.pagedownButtonAnimation = null;
}
if (z2) {
if (this.pagedownButton.getTranslationY() == 0.0f) {
this.pagedownButton.setTranslationY(AndroidUtilities.dp(100.0f));
}
if (isSysNotifyMessage().booleanValue() && this.dialog_id == 773000) {
this.pagedownButton.setVisibility(4);
} else {
this.pagedownButton.setVisibility(0);
}
this.pagedownButton.setTag(1);
this.pagedownButtonAnimation = new AnimatorSet();
if (this.mentiondownButton.getVisibility() == 0) {
this.pagedownButtonAnimation.playTogether(ObjectAnimator.ofFloat(this.pagedownButton, View.TRANSLATION_Y, 0.0f), ObjectAnimator.ofFloat(this.mentiondownButton, View.TRANSLATION_Y, -AndroidUtilities.dp(72.0f)));
} else {
this.pagedownButtonAnimation.playTogether(ObjectAnimator.ofFloat(this.pagedownButton, View.TRANSLATION_Y, 0.0f));
}
this.pagedownButtonAnimation.setDuration(200L);
this.pagedownButtonAnimation.start();
return;
}
this.pagedownButton.setVisibility(0);
return;
}
return;
}
this.returnToMessageId = 0;
this.newUnreadMessageCount = 0;
if (frameLayout.getTag() != null) {
this.pagedownButton.setTag(null);
AnimatorSet animatorSet2 = this.pagedownButtonAnimation;
if (animatorSet2 != null) {
animatorSet2.cancel();
this.pagedownButtonAnimation = null;
}
if (z2) {
this.pagedownButtonAnimation = new AnimatorSet();
if (this.mentiondownButton.getVisibility() == 0) {
this.pagedownButtonAnimation.playTogether(ObjectAnimator.ofFloat(this.pagedownButton, View.TRANSLATION_Y, AndroidUtilities.dp(100.0f)), ObjectAnimator.ofFloat(this.mentiondownButton, View.TRANSLATION_Y, 0.0f));
} else {
this.pagedownButtonAnimation.playTogether(ObjectAnimator.ofFloat(this.pagedownButton, View.TRANSLATION_Y, AndroidUtilities.dp(100.0f)));
}
this.pagedownButtonAnimation.setDuration(200L);
this.pagedownButtonAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
ChatActivity.this.pagedownButtonCounter.setVisibility(4);
ChatActivity.this.pagedownButton.setVisibility(4);
}
});
this.pagedownButtonAnimation.start();
return;
}
this.pagedownButton.setVisibility(4);
}
}
public void showMentionDownButton(boolean z, boolean z2) {
FrameLayout frameLayout = this.mentiondownButton;
if (frameLayout == null) {
return;
}
if (z) {
if (frameLayout.getTag() == null) {
ObjectAnimator objectAnimator = this.mentiondownButtonAnimation;
if (objectAnimator != null) {
objectAnimator.cancel();
this.mentiondownButtonAnimation = null;
}
if (z2) {
this.mentiondownButton.setVisibility(0);
this.mentiondownButton.setTag(1);
if (this.pagedownButton.getVisibility() == 0) {
this.mentiondownButton.setTranslationY(-AndroidUtilities.dp(72.0f));
this.mentiondownButtonAnimation = ObjectAnimator.ofFloat(this.mentiondownButton, View.ALPHA, 0.0f, 1.0f).setDuration(200L);
} else {
if (this.mentiondownButton.getTranslationY() == 0.0f) {
this.mentiondownButton.setTranslationY(AndroidUtilities.dp(100.0f));
}
this.mentiondownButtonAnimation = ObjectAnimator.ofFloat(this.mentiondownButton, View.TRANSLATION_Y, 0.0f).setDuration(200L);
}
this.mentiondownButtonAnimation.start();
return;
}
this.mentiondownButton.setVisibility(0);
return;
}
return;
}
this.returnToMessageId = 0;
if (frameLayout.getTag() != null) {
this.mentiondownButton.setTag(null);
ObjectAnimator objectAnimator2 = this.mentiondownButtonAnimation;
if (objectAnimator2 != null) {
objectAnimator2.cancel();
this.mentiondownButtonAnimation = null;
}
if (z2) {
if (this.pagedownButton.getVisibility() == 0) {
this.mentiondownButtonAnimation = ObjectAnimator.ofFloat(this.mentiondownButton, View.ALPHA, 1.0f, 0.0f).setDuration(200L);
} else {
this.mentiondownButtonAnimation = ObjectAnimator.ofFloat(this.mentiondownButton, View.TRANSLATION_Y, AndroidUtilities.dp(100.0f)).setDuration(200L);
}
this.mentiondownButtonAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
ChatActivity.this.mentiondownButtonCounter.setVisibility(4);
ChatActivity.this.mentiondownButton.setVisibility(4);
}
});
this.mentiondownButtonAnimation.start();
return;
}
this.mentiondownButton.setVisibility(4);
}
}
private void updateSecretStatus() {
ChatActivityEnterView chatActivityEnterView;
if (this.bottomOverlay == null) {
return;
}
TLRPC.Chat chat = this.currentChat;
boolean z = true;
if (chat != null && !ChatObject.canSendMessages(chat) && (!ChatObject.isChannel(this.currentChat) || this.currentChat.megagroup)) {
if (this.currentChat.default_banned_rights != null && this.currentChat.default_banned_rights.send_messages) {
this.bottomOverlayText.setText(LocaleController.getString("GlobalSendMessageRestricted", R.string.GlobalSendMessageRestricted));
} else if (AndroidUtilities.isBannedForever(this.currentChat.banned_rights)) {
this.bottomOverlayText.setText(LocaleController.getString("SendMessageRestrictedForever", R.string.SendMessageRestrictedForever));
} else {
this.bottomOverlayText.setText(LocaleController.formatString("SendMessageRestricted", R.string.SendMessageRestricted, LocaleController.formatDateForBan(this.currentChat.banned_rights.until_date)));
}
this.bottomOverlay.setVisibility(0);
AnimatorSet animatorSet = this.mentionListAnimation;
if (animatorSet != null) {
animatorSet.cancel();
this.mentionListAnimation = null;
}
this.mentionContainer.setVisibility(8);
this.mentionContainer.setTag(null);
updateMessageListAccessibilityVisibility();
StickersAdapter stickersAdapter = this.stickersAdapter;
if (stickersAdapter != null) {
stickersAdapter.hide();
}
} else {
TLRPC.EncryptedChat encryptedChat = this.currentEncryptedChat;
if (encryptedChat == null || this.bigEmptyView == null) {
this.bottomOverlay.setVisibility(4);
if (this.stickersAdapter != null && (chatActivityEnterView = this.chatActivityEnterView) != null && chatActivityEnterView.hasText()) {
this.stickersAdapter.loadStikersForEmoji(this.chatActivityEnterView.getFieldText(), false);
}
ChatActivityEnterView chatActivityEnterView2 = this.chatActivityEnterView;
if (chatActivityEnterView2 != null) {
chatActivityEnterView2.updateMenuViewStatus();
return;
}
return;
}
if (encryptedChat instanceof TLRPC.TL_encryptedChatRequested) {
this.bottomOverlayText.setText(LocaleController.getString("EncryptionProcessing", R.string.EncryptionProcessing));
this.bottomOverlay.setVisibility(0);
} else if (encryptedChat instanceof TLRPC.TL_encryptedChatWaiting) {
TextView textView = this.bottomOverlayText;
textView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("AwaitingEncryption", R.string.AwaitingEncryption, "<b>" + this.currentUser.first_name + "</b>")));
this.bottomOverlay.setVisibility(0);
} else if (encryptedChat instanceof TLRPC.TL_encryptedChatDiscarded) {
this.bottomOverlayText.setText(LocaleController.getString("EncryptionRejected", R.string.EncryptionRejected));
this.bottomOverlay.setVisibility(0);
this.chatActivityEnterView.setFieldText("");
getMediaDataController().cleanDraft(this.dialog_id, false);
} else {
if (encryptedChat instanceof TLRPC.TL_encryptedChat) {
this.bottomOverlay.setVisibility(4);
}
z = false;
}
checkRaiseSensors();
checkActionBarMenu();
}
if (this.inPreviewMode) {
this.bottomOverlay.setVisibility(4);
}
if (z) {
this.chatActivityEnterView.hidePopup(false);
if (getParentActivity() != null) {
AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus());
}
}
ChatActivityEnterView chatActivityEnterView3 = this.chatActivityEnterView;
if (chatActivityEnterView3 != null) {
chatActivityEnterView3.updateMenuViewStatus();
}
}
@Override
public void onRequestPermissionsResultFragment(int i, String[] strArr, int[] iArr) {
ChatAttachAlert chatAttachAlert;
TLRPC.User user;
ChatAttachAlert chatAttachAlert2;
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null) {
chatActivityEnterView.onRequestPermissionsResultFragment(i, strArr, iArr);
}
MentionsAdapter mentionsAdapter = this.mentionsAdapter;
if (mentionsAdapter != null) {
mentionsAdapter.onRequestPermissionsResultFragment(i, strArr, iArr);
}
if (i == 4 && (chatAttachAlert2 = this.chatAttachAlert) != null) {
chatAttachAlert2.checkStorage();
return;
}
boolean z = false;
if ((i == 17 || i == 18) && (chatAttachAlert = this.chatAttachAlert) != null) {
if (iArr.length > 0 && iArr[0] == 0) {
z = true;
}
chatAttachAlert.checkCamera(z);
} else if (i == 21) {
if (getParentActivity() == null || iArr == null || iArr.length == 0 || iArr[0] == 0) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("PermissionNoAudioVideo", R.string.PermissionNoAudioVideo));
builder.setNegativeButton(LocaleController.getString("PermissionOpenSettings", R.string.PermissionOpenSettings), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
ChatActivity.this.lambda$onRequestPermissionsResultFragment$67$ChatActivity(dialogInterface, i2);
}
});
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
builder.show();
} else if (i == 19 && iArr != null && iArr.length > 0 && iArr[0] == 0) {
processSelectedAttach(0);
} else if (i == 20 && iArr != null && iArr.length > 0 && iArr[0] == 0) {
processSelectedAttach(2);
} else if (i != 101 || (user = this.currentUser) == null) {
} else {
if (iArr.length > 0 && iArr[0] == 0) {
VoIPHelper.startCall(user, getParentActivity(), getMessagesController().getUserFull(this.currentUser.id));
} else {
VoIPHelper.permissionDenied(getParentActivity(), null);
}
}
}
public void lambda$onRequestPermissionsResultFragment$67$ChatActivity(DialogInterface dialogInterface, int i) {
try {
Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
intent.setData(Uri.parse("package:" + ApplicationLoader.applicationContext.getPackageName()));
getParentActivity().startActivity(intent);
} catch (Exception e) {
FileLog.e(e);
}
}
private void checkActionBarMenu() {
TLRPC.Chat chat;
TLRPC.User user;
TLRPC.EncryptedChat encryptedChat = this.currentEncryptedChat;
if ((encryptedChat != null && !(encryptedChat instanceof TLRPC.TL_encryptedChat)) || (((chat = this.currentChat) != null && ChatObject.isNotInChat(chat)) || ((user = this.currentUser) != null && UserObject.isDeleted(user)))) {
View view = this.timeItem2;
if (view != null) {
view.setVisibility(8);
}
} else {
View view2 = this.timeItem2;
if (view2 != null) {
view2.setVisibility(0);
}
}
checkAndUpdateAvatar();
}
public int getMessageType(MessageObject messageObject) {
String str;
String str2;
if (messageObject == null) {
return -1;
}
boolean z = false;
boolean z2 = true;
if (this.currentEncryptedChat == null) {
if (messageObject.isEditing()) {
return -1;
}
if (messageObject.getId() <= 0 && messageObject.isOut()) {
if (messageObject.isSendError()) {
return !messageObject.isMediaEmpty() ? 0 : 20;
}
return -1;
} else if (messageObject.isAnimatedEmoji()) {
return 2;
} else {
if (messageObject.type == 6) {
return -1;
}
if (messageObject.type == 10 || messageObject.type == 11) {
return messageObject.getId() == 0 ? -1 : 1;
} else if (messageObject.isVoice()) {
return 2;
} else {
if (messageObject.isSticker() || messageObject.isAnimatedSticker()) {
TLRPC.InputStickerSet inputStickerSet = messageObject.getInputStickerSet();
return inputStickerSet instanceof TLRPC.TL_inputStickerSetID ? !getMediaDataController().isStickerPackInstalled(inputStickerSet.id) ? 7 : 9 : (!(inputStickerSet instanceof TLRPC.TL_inputStickerSetShortName) || getMediaDataController().isStickerPackInstalled(inputStickerSet.short_name)) ? 9 : 7;
}
if (!messageObject.isRoundVideo() && ((messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) || messageObject.getDocument() != null || messageObject.isMusic() || messageObject.isVideo())) {
if (!TextUtils.isEmpty(messageObject.messageOwner.attachPath) && new File(messageObject.messageOwner.attachPath).exists()) {
z = true;
}
if (z || !FileLoader.getPathToMessage(messageObject.messageOwner).exists()) {
z2 = z;
}
if (z2) {
if (messageObject.getDocument() != null && (str2 = messageObject.getDocument().mime_type) != null) {
if (messageObject.getDocumentName().toLowerCase().endsWith("attheme")) {
return 10;
}
if (str2.endsWith("/xml")) {
return 5;
}
if (str2.endsWith("/png") || str2.endsWith("/jpg") || str2.endsWith("/jpeg")) {
return 6;
}
}
return 4;
}
} else if (messageObject.type == 12) {
return 8;
} else {
if (messageObject.isMediaEmpty()) {
return 3;
}
}
return 2;
}
}
} else if (messageObject.isSending()) {
return -1;
} else {
if (messageObject.isAnimatedEmoji()) {
return 2;
}
if (messageObject.type == 6) {
return -1;
}
if (messageObject.isSendError()) {
return !messageObject.isMediaEmpty() ? 0 : 20;
} else if (messageObject.type == 10 || messageObject.type == 11) {
return (messageObject.getId() == 0 || messageObject.isSending()) ? -1 : 1;
} else if (messageObject.isVoice()) {
return 2;
} else {
if (!messageObject.isAnimatedEmoji() && (messageObject.isSticker() || messageObject.isAnimatedSticker())) {
TLRPC.InputStickerSet inputStickerSet2 = messageObject.getInputStickerSet();
if ((inputStickerSet2 instanceof TLRPC.TL_inputStickerSetShortName) && !getMediaDataController().isStickerPackInstalled(inputStickerSet2.short_name)) {
return 7;
}
} else if (!messageObject.isRoundVideo() && ((messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) || messageObject.getDocument() != null || messageObject.isMusic() || messageObject.isVideo())) {
if (!TextUtils.isEmpty(messageObject.messageOwner.attachPath) && new File(messageObject.messageOwner.attachPath).exists()) {
z = true;
}
if (z || !FileLoader.getPathToMessage(messageObject.messageOwner).exists()) {
z2 = z;
}
if (z2) {
if (messageObject.getDocument() != null && (str = messageObject.getDocument().mime_type) != null && str.endsWith("text/xml")) {
return 5;
}
if (messageObject.messageOwner.ttl <= 0) {
return 4;
}
}
} else if (messageObject.type == 12) {
return 8;
} else {
if (messageObject.isMediaEmpty()) {
return 3;
}
}
return 2;
}
}
}
private void addToSelectedMessages(MessageObject messageObject, boolean z) {
addToSelectedMessages(messageObject, z, true);
}
private void addToSelectedMessages(MessageObject messageObject, boolean z, boolean z2) {
int i;
FrameLayout frameLayout;
TLRPC.Chat chat;
final int i2;
int i3;
int i4 = this.cantForwardMessagesCount;
if (messageObject != null) {
char c = messageObject.getDialogId() == this.dialog_id ? (char) 0 : (char) 1;
if (z && messageObject.getGroupId() != 0) {
MessageObject.GroupedMessages groupedMessages = this.groupedMessagesMap.get(messageObject.getGroupId());
if (groupedMessages != null) {
boolean z3 = false;
int i5 = 0;
for (int i6 = 0; i6 < groupedMessages.messages.size(); i6++) {
if (this.selectedMessagesIds[c].indexOfKey(groupedMessages.messages.get(i6).getId()) < 0) {
i5 = i6;
z3 = true;
}
}
int i7 = 0;
while (i7 < groupedMessages.messages.size()) {
MessageObject messageObject2 = groupedMessages.messages.get(i7);
if (z3) {
if (this.selectedMessagesIds[c].indexOfKey(messageObject2.getId()) < 0) {
addToSelectedMessages(messageObject2, false, i7 == i5);
}
} else {
addToSelectedMessages(messageObject2, false, i7 == groupedMessages.messages.size() - 1);
}
i7++;
}
return;
}
return;
} else if (this.selectedMessagesIds[c].indexOfKey(messageObject.getId()) >= 0) {
this.selectedMessagesIds[c].remove(messageObject.getId());
if (messageObject.type == 0 || messageObject.isAnimatedEmoji() || messageObject.caption != null) {
this.selectedMessagesCanCopyIds[c].remove(messageObject.getId());
}
if (!messageObject.isAnimatedEmoji() && (messageObject.isSticker() || messageObject.isAnimatedSticker())) {
this.selectedMessagesCanStarIds[c].remove(messageObject.getId());
}
if (messageObject.type == 101 || messageObject.type == 102) {
this.cantCopyMessageCount--;
}
if (messageObject.canEditMessage(this.currentChat)) {
this.canEditMessagesCount--;
}
if (!messageObject.canDeleteMessage(this.inScheduleMode, this.currentChat)) {
this.cantDeleteMessagesCount--;
}
if (this.inScheduleMode || !messageObject.canForwardMessage()) {
this.cantForwardMessagesCount--;
} else {
this.canForwardMessagesCount--;
}
} else if (this.selectedMessagesIds[0].size() + this.selectedMessagesIds[1].size() >= 100) {
return;
} else {
this.selectedMessagesIds[c].put(messageObject.getId(), messageObject);
if (messageObject.type == 0 || messageObject.isAnimatedEmoji() || messageObject.caption != null) {
this.selectedMessagesCanCopyIds[c].put(messageObject.getId(), messageObject);
}
if (!messageObject.isAnimatedEmoji() && (messageObject.isSticker() || messageObject.isAnimatedSticker())) {
this.selectedMessagesCanStarIds[c].put(messageObject.getId(), messageObject);
}
if (messageObject.type == 101 || messageObject.type == 102) {
this.cantCopyMessageCount++;
}
if (messageObject.canEditMessage(this.currentChat)) {
this.canEditMessagesCount++;
}
if (!messageObject.canDeleteMessage(this.inScheduleMode, this.currentChat)) {
this.cantDeleteMessagesCount++;
}
if (this.inScheduleMode || !messageObject.canForwardMessage()) {
this.cantForwardMessagesCount++;
} else {
this.canForwardMessagesCount++;
}
}
}
AnimatorSet animatorSet = this.forwardButtonAnimation;
if (animatorSet != null) {
animatorSet.cancel();
this.forwardButtonAnimation = null;
}
if (z2 && this.actionBar.isActionModeShowed()) {
int size = this.selectedMessagesIds[0].size() + this.selectedMessagesIds[1].size();
if (size == 0) {
hideActionMode();
updatePinnedMessageView(true);
return;
}
ActionBarMenuItem item = this.actionBar.createActionMode().getItem(10);
ActionBarMenuItem item2 = this.actionBar.createActionMode().getItem(22);
final ActionBarMenuItem item3 = this.actionBar.createActionMode().getItem(23);
ActionBarMenuItem item4 = this.actionBar.createActionMode().getItem(11);
TLRPC.Chat chat2 = this.currentChat;
boolean z4 = chat2 == null || !chat2.megagroup || (this.currentChat.flags & ConnectionsManager.FileTypeVideo) == 0 || ChatObject.hasAdminRights(this.currentChat);
float f = 0.5f;
if ((i4 == 0 && this.cantForwardMessagesCount != 0) || (i4 != 0 && this.cantForwardMessagesCount == 0)) {
this.forwardButtonAnimation = new AnimatorSet();
ArrayList arrayList = new ArrayList();
if (item4 != null) {
item4.setEnabled(this.cantForwardMessagesCount == 0 && z4);
Property property = View.ALPHA;
float[] fArr = new float[1];
fArr[0] = (this.cantForwardMessagesCount == 0 && z4) ? 1.0f : 0.5f;
arrayList.add(ObjectAnimator.ofFloat(item4, property, fArr));
}
TextView textView = this.forwardButton;
if (textView != null) {
textView.setEnabled(this.cantForwardMessagesCount == 0 && z4);
TextView textView2 = this.forwardButton;
Property property2 = View.ALPHA;
float[] fArr2 = new float[1];
if (this.cantForwardMessagesCount == 0 && z4) {
f = 1.0f;
}
fArr2[0] = f;
arrayList.add(ObjectAnimator.ofFloat(textView2, property2, fArr2));
}
this.forwardButtonAnimation.playTogether(arrayList);
this.forwardButtonAnimation.setDuration(100L);
this.forwardButtonAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
ChatActivity.this.forwardButtonAnimation = null;
}
});
this.forwardButtonAnimation.start();
} else {
if (item4 != null) {
item4.setEnabled(this.cantForwardMessagesCount == 0 && z4);
item4.setAlpha((this.cantForwardMessagesCount == 0 && z4) ? 1.0f : 0.5f);
}
TextView textView3 = this.forwardButton;
if (textView3 != null) {
textView3.setVisibility(0);
this.forwardButton.setEnabled(this.cantForwardMessagesCount == 0 && z4);
this.forwardButton.setAlpha((this.cantForwardMessagesCount == 0 && z4) ? 1.0f : 0.5f);
if (messageObject != null && messageObject.type == 207) {
this.selectedMessagesIds[0].size();
}
}
}
int visibility = item.getVisibility();
int visibility2 = item2.getVisibility();
item.setVisibility((this.currentEncryptedChat == null && this.cantCopyMessageCount == 0 && this.selectedMessagesCanCopyIds[0].size() + this.selectedMessagesCanCopyIds[1].size() != 0) ? 0 : 8);
item2.setVisibility((getMediaDataController().canAddStickerToFavorites() && this.selectedMessagesCanStarIds[0].size() + this.selectedMessagesCanStarIds[1].size() == size) ? 0 : 8);
int visibility3 = item.getVisibility();
int visibility4 = item2.getVisibility();
this.actionBar.createActionMode().getItem(12).setVisibility(this.cantDeleteMessagesCount == 0 ? 0 : 8);
this.hasUnfavedSelected = false;
int i8 = 0;
while (true) {
if (i8 >= 2) {
break;
}
int i9 = 0;
while (true) {
if (i9 >= this.selectedMessagesCanStarIds[i8].size()) {
break;
} else if (!getMediaDataController().isStickerInFavorites(this.selectedMessagesCanStarIds[i8].valueAt(i9).getDocument())) {
this.hasUnfavedSelected = true;
break;
} else {
i9++;
}
}
if (this.hasUnfavedSelected) {
break;
}
i8++;
}
item2.setIcon(this.hasUnfavedSelected ? R.drawable.msg_fave : R.drawable.msg_unfave);
final int i10 = (this.canEditMessagesCount == 1 && size == 1) ? 0 : 8;
if (this.replyButton != null) {
TLRPC.EncryptedChat encryptedChat = this.currentEncryptedChat;
boolean z5 = (encryptedChat == null || AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 46) && ((frameLayout = this.bottomOverlayChat) == null || frameLayout.getVisibility() != 0) && ((chat = this.currentChat) == null || (!ChatObject.isNotInChat(chat) && ((!ChatObject.isChannel(this.currentChat) || ChatObject.canPost(this.currentChat) || this.currentChat.megagroup) && ChatObject.canSendMessages(this.currentChat))));
if (this.inScheduleMode || !z5 || size == 0 || !(this.selectedMessagesIds[0].size() == 0 || this.selectedMessagesIds[1].size() == 0)) {
i2 = 8;
} else {
if (size != 1 || messageObject == null) {
int i11 = 0;
i3 = 0;
long j = 0;
for (i = 2; i11 < i; i = 2) {
int size2 = this.selectedMessagesIds[i11].size();
int i12 = 0;
while (i12 < size2) {
MessageObject valueAt = this.selectedMessagesIds[i11].valueAt(i12);
if (valueAt.type != 101 && valueAt.type != 102) {
long groupId = valueAt.getGroupId();
if (groupId != 0 && (j == 0 || j == groupId)) {
i12++;
j = groupId;
}
i3 = 8;
break;
}
i3 = 8;
break;
}
if (i3 == 8) {
break;
}
i11++;
}
} else {
i3 = 0;
for (int i13 = 0; i13 < 2; i13++) {
int size3 = this.selectedMessagesIds[i13].size();
for (int i14 = 0; i14 < size3; i14++) {
MessageObject valueAt2 = this.selectedMessagesIds[i13].valueAt(i14);
if (valueAt2.type == 101 || valueAt2.type == 102) {
i3 = 8;
break;
}
}
}
}
i2 = i3;
}
if (this.replyButton.getVisibility() != i2) {
AnimatorSet animatorSet2 = this.replyButtonAnimation;
if (animatorSet2 != null) {
animatorSet2.cancel();
}
AnimatorSet animatorSet3 = new AnimatorSet();
this.replyButtonAnimation = animatorSet3;
if (i2 == 0) {
this.replyButton.setVisibility(i2);
this.replyButtonAnimation.playTogether(ObjectAnimator.ofFloat(this.replyButton, View.ALPHA, 1.0f), ObjectAnimator.ofFloat(this.replyButton, View.SCALE_Y, 1.0f));
} else {
animatorSet3.playTogether(ObjectAnimator.ofFloat(this.replyButton, View.ALPHA, 0.0f), ObjectAnimator.ofFloat(this.replyButton, View.SCALE_Y, 0.0f));
}
this.replyButtonAnimation.setDuration(100L);
this.replyButtonAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.replyButtonAnimation != null && ChatActivity.this.replyButtonAnimation.equals(animator) && i2 == 8) {
ChatActivity.this.replyButton.setVisibility(8);
}
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.replyButtonAnimation == null || !ChatActivity.this.replyButtonAnimation.equals(animator)) {
return;
}
ChatActivity.this.replyButtonAnimation = null;
}
});
this.replyButtonAnimation.start();
}
}
if (item3 != null) {
if (visibility != visibility3 || visibility2 != visibility4) {
if (i10 == 0) {
item3.setAlpha(1.0f);
item3.setScaleX(1.0f);
} else {
item3.setAlpha(0.0f);
item3.setScaleX(0.0f);
}
item3.setVisibility(i10);
} else if (item3.getVisibility() != i10) {
AnimatorSet animatorSet4 = this.editButtonAnimation;
if (animatorSet4 != null) {
animatorSet4.cancel();
}
this.editButtonAnimation = new AnimatorSet();
item3.setPivotX(AndroidUtilities.dp(54.0f));
item3.setPivotX(AndroidUtilities.dp(54.0f));
if (i10 == 0) {
item3.setVisibility(i10);
this.editButtonAnimation.playTogether(ObjectAnimator.ofFloat(item3, View.ALPHA, 1.0f), ObjectAnimator.ofFloat(item3, View.SCALE_X, 1.0f));
} else {
this.editButtonAnimation.playTogether(ObjectAnimator.ofFloat(item3, View.ALPHA, 0.0f), ObjectAnimator.ofFloat(item3, View.SCALE_X, 0.0f));
}
this.editButtonAnimation.setDuration(100L);
this.editButtonAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.editButtonAnimation != null && ChatActivity.this.editButtonAnimation.equals(animator) && i10 == 8) {
item3.setVisibility(8);
}
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.editButtonAnimation == null || !ChatActivity.this.editButtonAnimation.equals(animator)) {
return;
}
ChatActivity.this.editButtonAnimation = null;
}
});
this.editButtonAnimation.start();
}
}
}
}
public void processRowSelect(View view, boolean z, float f, float f2) {
MessageObject messageObject;
if (view instanceof ChatMessageCell) {
messageObject = ((ChatMessageCell) view).getMessageObject();
} else {
messageObject = view instanceof ChatActionCell ? ((ChatActionCell) view).getMessageObject() : null;
}
int messageType = getMessageType(messageObject);
if (messageType < 2 || messageType == 20) {
return;
}
addToSelectedMessages(messageObject, z);
updateActionModeTitle();
updateVisibleRows();
}
private void updateActionModeTitle() {
if (this.actionBar.isActionModeShowed()) {
if (this.selectedMessagesIds[0].size() == 0 && this.selectedMessagesIds[1].size() == 0) {
return;
}
this.selectedMessagesCountTextView.setNumber(this.selectedMessagesIds[0].size() + this.selectedMessagesIds[1].size(), true);
}
}
private void updateBotButtons() {
TLRPC.User user;
boolean z;
int i;
if (this.headerItem == null || (user = this.currentUser) == null || this.currentEncryptedChat != null || !user.bot) {
return;
}
boolean z2 = false;
if (this.botInfo.size() != 0) {
boolean z3 = false;
z = false;
for (int i2 = 0; i2 < this.botInfo.size(); i2++) {
TLRPC.BotInfo valueAt = this.botInfo.valueAt(i2);
while (i < valueAt.commands.size()) {
TLRPC.TL_botCommand tL_botCommand = valueAt.commands.get(i);
if (tL_botCommand.command.toLowerCase().equals("help")) {
z3 = true;
} else if (tL_botCommand.command.toLowerCase().equals("settings")) {
z = true;
}
i = (z && z3) ? 0 : i + 1;
}
}
z2 = z3;
} else {
z = false;
}
if (z2) {
this.headerItem.showSubItem(30);
} else {
this.headerItem.hideSubItem(30);
}
if (z) {
this.headerItem.showSubItem(31);
} else {
this.headerItem.hideSubItem(31);
}
}
private void updateTitleIcons() {
if (this.inScheduleMode) {
return;
}
boolean isDialogMuted = getMessagesController().isDialogMuted(this.dialog_id);
Drawable drawable = getMessagesController().isDialogMuted(this.dialog_id) ? Theme.chat_muteIconDrawable : null;
Drawable themedDrawable = this.currentEncryptedChat != null ? Theme.getThemedDrawable(getParentActivity(), (int) R.drawable.ic_lock_header, Theme.key_actionBarDefaultTitle) : null;
if (isSysNotifyMessage().booleanValue()) {
ActionBarMenuItem actionBarMenuItem = this.headerItem;
if (actionBarMenuItem instanceof ActionBarMenuItem) {
if (isDialogMuted) {
actionBarMenuItem.setIcon(R.mipmap.iv_chat_sys_notify_msg_mute);
return;
} else {
actionBarMenuItem.setIcon(R.mipmap.iv_chat_sys_notify_msg_unmute);
return;
}
}
return;
}
this.actionBarHelper.setTitleIcons(themedDrawable, drawable);
ChatActionBarMenuSubItem chatActionBarMenuSubItem = this.muteItem;
if (chatActionBarMenuSubItem != null) {
if (drawable != null) {
chatActionBarMenuSubItem.setTextAndIcon(LocaleController.getString("UnmuteNotifications", R.string.UnmuteNotifications), R.drawable.msg_unmute);
} else {
chatActionBarMenuSubItem.setTextAndIcon(LocaleController.getString("MuteNotifications", R.string.MuteNotifications), R.drawable.msg_mute);
}
}
}
private void checkAndUpdateAvatar() {
TLRPC.Chat chat;
if (this.currentUser != null) {
TLRPC.User user = getMessagesController().getUser(Integer.valueOf(this.currentUser.id));
if (user == null) {
return;
}
this.currentUser = user;
} else if (this.currentChat == null || (chat = getMessagesController().getChat(Integer.valueOf(this.currentChat.id))) == null) {
} else {
this.currentChat = chat;
}
}
public void openVideoEditor(String str, String str2) {
if (getParentActivity() != null) {
final Bitmap createVideoThumbnail = ThumbnailUtils.createVideoThumbnail(str, 1);
PhotoViewer.getInstance().setParentActivity(getParentActivity());
final ArrayList<Object> arrayList = new ArrayList<>();
MediaController.PhotoEntry photoEntry = new MediaController.PhotoEntry(0, 0, 0L, str, 0, true);
photoEntry.caption = str2;
arrayList.add(photoEntry);
PhotoViewer.getInstance().openPhotoForSelect(arrayList, 0, 2, new PhotoViewer.EmptyPhotoViewerProvider() {
@Override
public boolean canScrollAway() {
return false;
}
@Override
public ImageReceiver.BitmapHolder getThumbForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int i) {
return new ImageReceiver.BitmapHolder(createVideoThumbnail, null);
}
@Override
public void sendButtonPressed(int i, VideoEditedInfo videoEditedInfo, boolean z, int i2) {
ChatActivity.this.sendMedia((MediaController.PhotoEntry) arrayList.get(0), videoEditedInfo, z, i2);
}
}, this);
return;
}
fillEditingMediaWithCaption(str2, null);
SendMessagesHelper.prepareSendingVideo(getAccountInstance(), str, 0L, 0L, 0, 0, null, this.dialog_id, this.replyingMessageObject, null, null, 0, this.editingMessageObject, true, 0);
afterMessageSend();
}
private void showAttachmentError() {
if (getParentActivity() == null) {
return;
}
ToastUtils.show((int) R.string.UnsupportedAttachment);
}
public void fillEditingMediaWithCaption(CharSequence charSequence, ArrayList<TLRPC.MessageEntity> arrayList) {
if (this.editingMessageObject == null) {
return;
}
if (!TextUtils.isEmpty(charSequence)) {
this.editingMessageObject.editingMessage = charSequence;
this.editingMessageObject.editingMessageEntities = arrayList;
return;
}
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null) {
this.editingMessageObject.editingMessage = chatActivityEnterView.getFieldText();
if (this.editingMessageObject.editingMessage != null || TextUtils.isEmpty(this.editingMessageObject.messageOwner.message)) {
return;
}
this.editingMessageObject.editingMessage = "";
}
}
private void sendUriAsDocument(Uri uri) {
String str;
int indexOf;
Uri parse;
String path;
String str2;
String str3;
if (uri == null) {
return;
}
String uri2 = uri.toString();
if (uri2.contains("com.google.android.apps.photos.contentprovider")) {
try {
str = uri2.split("/1/")[1];
indexOf = str.indexOf("/ACTUAL");
} catch (Exception e) {
FileLog.e(e);
}
if (indexOf != -1) {
parse = Uri.parse(URLDecoder.decode(str.substring(0, indexOf), "UTF-8"));
path = AndroidUtilities.getPath(parse);
if (path != null) {
String uri3 = parse.toString();
str2 = MediaController.copyFileToCache(parse, "file");
str3 = uri3;
} else {
str2 = path;
str3 = str2;
}
if (str2 != null) {
showAttachmentError();
return;
}
fillEditingMediaWithCaption(null, null);
isVedioFile(str2);
SendMessagesHelper.prepareSendingDocument(getAccountInstance(), str2, str3, null, null, null, this.dialog_id, this.replyingMessageObject, null, this.editingMessageObject, true, 0);
hideFieldPanel(false);
return;
}
}
parse = uri;
path = AndroidUtilities.getPath(parse);
if (path != null) {
}
if (str2 != null) {
}
}
private String getMimeType(String str) {
return URLConnection.getFileNameMap().getContentTypeFor(str);
}
public boolean isVedioFile(String str) {
return !TextUtils.isEmpty(str) && getMimeType(str).contains(PREFIX_VIDEO);
}
@Override
public void onActivityResultFragment(int i, int i2, Intent intent) {
String str;
if (i2 == -1) {
if (i == 0 || i == 2) {
createChatAttachView();
ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
if (chatAttachAlert != null) {
chatAttachAlert.onActivityResultFragment(i, intent, this.currentPicturePath);
}
this.currentPicturePath = null;
} else if (i != 1) {
if (i == 21) {
if (intent == null) {
showAttachmentError();
return;
}
if (intent.getData() != null) {
sendUriAsDocument(intent.getData());
} else if (intent.getClipData() != null) {
ClipData clipData = intent.getClipData();
for (int i3 = 0; i3 < clipData.getItemCount(); i3++) {
sendUriAsDocument(clipData.getItemAt(i3).getUri());
}
} else {
showAttachmentError();
}
afterMessageSend();
}
} else if (intent == null || intent.getData() == null) {
showAttachmentError();
} else {
final Uri data = intent.getData();
if (data.toString().contains(MimeTypes.BASE_TYPE_VIDEO)) {
try {
str = AndroidUtilities.getPath(data);
} catch (Exception e) {
FileLog.e(e);
str = null;
}
if (str == null) {
showAttachmentError();
}
if (this.paused) {
this.startVideoEdit = str;
} else {
openVideoEditor(str, null);
}
} else if (this.editingMessageObject == null && this.inScheduleMode) {
AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), UserObject.isUserSelf(this.currentUser), new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public final void didSelectDate(boolean z, int i4) {
ChatActivity.this.lambda$onActivityResultFragment$68$ChatActivity(data, z, i4);
}
});
} else {
fillEditingMediaWithCaption(null, null);
SendMessagesHelper.prepareSendingPhoto(getAccountInstance(), null, data, this.dialog_id, this.replyingMessageObject, null, null, null, null, 0, this.editingMessageObject, true, 0);
}
afterMessageSend();
}
}
}
public void lambda$onActivityResultFragment$68$ChatActivity(Uri uri, boolean z, int i) {
fillEditingMediaWithCaption(null, null);
SendMessagesHelper.prepareSendingPhoto(getAccountInstance(), null, uri, this.dialog_id, this.replyingMessageObject, null, null, null, null, 0, this.editingMessageObject, z, i);
}
@Override
public void saveSelfArgs(Bundle bundle) {
String str = this.currentPicturePath;
if (str != null) {
bundle.putString("path", str);
}
}
@Override
public void restoreSelfArgs(Bundle bundle) {
this.currentPicturePath = bundle.getString("path");
}
private void removeUnreadPlane(boolean z) {
if (this.unreadMessageObject != null) {
if (z) {
boolean[] zArr = this.forwardEndReached;
zArr[1] = true;
zArr[0] = true;
this.first_unread_id = 0;
this.last_message_id = 0;
}
this.createUnreadMessageAfterId = 0;
this.createUnreadMessageAfterIdLoading = false;
removeMessageObject(this.unreadMessageObject);
this.unreadMessageObject = null;
}
}
@Override
public void didReceivedNotification(int i, int i2, Object... objArr) {
ContextLinkCell contextLinkCell;
MessageObject messageObject;
ChatMessageCell chatMessageCell;
MessageObject messageObject2;
AnimatedFileDrawable animation;
ChatMessageCell chatMessageCell2;
TLRPC.Document streamingMedia;
int intValue;
ChatActivityEnterView chatActivityEnterView;
TLRPC.User user;
int i3;
ActionBarMenuItem actionBarMenuItem;
char c;
char c2;
TLRPC.Chat chat;
MessageObject messageObject3;
TLRPC.UserFull userFull;
MessageObject.GroupedMessages groupedMessages;
int indexOf;
MessageObject messageObject4;
ChatActivityAdapter chatActivityAdapter;
ChatMessageCell chatMessageCell3;
MessageObject messageObject5;
FrameLayout frameLayout;
ContextLinkCell contextLinkCell2;
MessageObject messageObject6;
ChatMessageCell chatMessageCell4;
MessageObject messageObject7;
AnimatedFileDrawable animation2;
MessageObject messageObject8;
TLRPC.EncryptedChat encryptedChat;
TLRPC.Chat chat2;
TLRPC.Chat chat3;
TLRPC.Chat chat4;
TLRPC.ChatFull chatFull;
int i4;
long j;
boolean z;
boolean z2;
TLRPC.MessageFwdHeader messageFwdHeader;
MessageObject.GroupedMessages groupedMessages2;
ChatActivityAdapter chatActivityAdapter2;
GridLayoutManagerFixed gridLayoutManagerFixed;
char c3;
int size;
LongSparseArray longSparseArray;
int i5;
boolean z3;
boolean z4;
int i6;
int i7;
MessageObject messageObject9;
int indexOf2;
boolean z5;
TLRPC.User user2;
int i8;
ChatActivityAdapter chatActivityAdapter3;
boolean z6;
ArrayList arrayList;
int i9;
boolean z7;
TLRPC.ChatFull chatFull2;
TLRPC.UserFull userFull2;
int i10;
boolean z8;
TLRPC.User user3;
int i11;
char c4;
int i12;
boolean z9;
char c5;
boolean z10;
boolean z11;
boolean z12;
TextView textView;
int i13;
TextView textView2;
int indexOf3;
boolean z13;
int i14;
TLRPC.Chat chat5;
int i15;
MessageObject.GroupedMessages groupedMessages3;
int i16;
boolean z14;
int i17;
char c6;
HashMap<String, ArrayList<MessageObject>> hashMap;
LongSparseArray longSparseArray2;
MessageObject messageObject10;
ChatActivityAdapter chatActivityAdapter4;
int i18;
boolean z15;
boolean z16;
?? r3;
ArrayList<MessageObject> arrayList2;
MessageObject.GroupedMessages groupedMessages4;
TLRPC.User user4;
String str;
int id;
int i19;
TextView textView3;
TextView textView4;
TLRPC.Chat chat6;
int i20;
TLRPC.User user5;
TLRPC.Chat chat7;
TLRPC.User user6;
boolean z17;
TLRPC.Chat chat8;
boolean z18;
int i21;
int i22;
int i23;
String str2;
boolean z19;
int i24;
boolean z20;
int i25;
TextView textView5;
int i26;
int findFirstVisibleItemPosition;
View findViewByPosition;
ChatActionBarHelper chatActionBarHelper;
boolean z21;
TLRPC.User user7;
int indexOf4;
int i27;
boolean z22;
int i28;
int i29;
int i30;
int i31;
int i32;
TLRPC.Chat chat9;
int i33;
MediaController mediaController;
TLRPC.MessageAction messageAction;
int i34;
MessageObject messageObject11;
int i35;
int i36;
int i37;
MessageObject messageObject12;
ArrayList<MessageObject> arrayList3;
?? r2;
int i38;
boolean z23;
String str3 = "";
if (i == NotificationCenter.messagesDidLoad) {
if (((Integer) objArr[10]).intValue() != this.classGuid) {
return;
}
setItemAnimationsEnabled(false);
if (!this.openAnimationEnded) {
getNotificationCenter().setAllowedNotificationsDutingAnimation(new int[]{NotificationCenter.chatInfoDidLoad, NotificationCenter.dialogsNeedReload, NotificationCenter.scheduledMessagesUpdated, NotificationCenter.closeChats, NotificationCenter.botKeyboardDidLoad, NotificationCenter.userFullInfoDidLoad, NotificationCenter.needDeleteDialog});
}
int indexOf5 = this.waitingForLoad.indexOf(Integer.valueOf(((Integer) objArr[11]).intValue()));
int clientUserId = getUserConfig().getClientUserId();
boolean booleanValue = ((Boolean) objArr[14]).booleanValue();
boolean booleanValue2 = ((Boolean) objArr[3]).booleanValue();
if (indexOf5 == -1) {
if (this.inScheduleMode && booleanValue && !booleanValue2) {
this.waitingForReplyMessageLoad = true;
this.waitingForLoad.add(Integer.valueOf(this.lastLoadIndex));
MessagesController messagesController = getMessagesController();
long j2 = this.dialog_id;
int i39 = AndroidUtilities.isTablet() ? 30 : 20;
int i40 = this.classGuid;
boolean isChannel = ChatObject.isChannel(this.currentChat);
boolean z24 = this.inScheduleMode;
int i41 = this.lastLoadIndex;
this.lastLoadIndex = i41 + 1;
messagesController.loadMessages(j2, i39, 0, 0, true, 0, i40, 2, 0, isChannel, z24, i41);
return;
}
return;
}
this.waitingForLoad.remove(indexOf5);
ArrayList<MessageObject> arrayList4 = (ArrayList) objArr[2];
boolean z25 = this.inScheduleMode;
if (z25 != booleanValue) {
if (!z25) {
this.scheduledMessagesCount = arrayList4.size();
updateScheduledInterface(true);
}
listViewShowEmptyView(false, false);
return;
}
boolean z26 = this.waitingForReplyMessageLoad;
if (z26) {
if (!z25 && !this.createUnreadMessageAfterIdLoading) {
int i42 = 0;
while (i42 < arrayList4.size()) {
MessageObject messageObject13 = arrayList4.get(i42);
if (messageObject13.getId() != this.startLoadFromMessageId) {
i42++;
if (i42 < arrayList4.size()) {
MessageObject messageObject14 = arrayList4.get(i42);
if (messageObject13.getId() >= this.startLoadFromMessageId && messageObject14.getId() < this.startLoadFromMessageId) {
this.startLoadFromMessageId = messageObject13.getId();
}
}
}
z23 = true;
}
z23 = false;
if (!z23) {
this.startLoadFromMessageId = 0;
return;
}
}
int i43 = this.startLoadFromMessageId;
boolean z27 = this.needSelectFromMessageId;
int i44 = this.createUnreadMessageAfterId;
z18 = this.createUnreadMessageAfterIdLoading;
clearChatData();
if (!this.inScheduleMode) {
this.createUnreadMessageAfterId = i44;
this.startLoadFromMessageId = i43;
this.needSelectFromMessageId = z27;
}
} else {
z18 = false;
}
this.loadsCount++;
boolean z28 = z18;
int i45 = ((Long) objArr[0]).longValue() == this.dialog_id ? 0 : 1;
int intValue2 = ((Integer) objArr[1]).intValue();
int intValue3 = ((Integer) objArr[4]).intValue();
((Integer) objArr[7]).intValue();
int intValue4 = ((Integer) objArr[8]).intValue();
boolean booleanValue3 = ((Boolean) objArr[9]).booleanValue();
int intValue5 = ((Integer) objArr[12]).intValue();
int intValue6 = ((Integer) objArr[13]).intValue();
if (intValue6 < 0) {
intValue6 *= -1;
this.hasAllMentionsLocal = false;
} else if (this.first) {
this.hasAllMentionsLocal = true;
}
int i46 = intValue6;
if (intValue4 == 4) {
this.startLoadFromMessageId = intValue5;
int size2 = arrayList4.size() - 1;
while (true) {
if (size2 <= 0) {
break;
}
MessageObject messageObject15 = arrayList4.get(size2);
if (messageObject15.type < 0 && messageObject15.getId() == this.startLoadFromMessageId) {
this.startLoadFromMessageId = arrayList4.get(size2 - 1).getId();
break;
}
size2--;
}
}
if (intValue3 != 0) {
this.last_message_id = ((Integer) objArr[5]).intValue();
if (intValue4 == 3) {
if (this.loadingFromOldPosition) {
i21 = ((Integer) objArr[6]).intValue();
if (i21 != 0) {
this.createUnreadMessageAfterId = intValue3;
}
this.loadingFromOldPosition = false;
} else {
i21 = 0;
}
this.first_unread_id = 0;
} else {
this.first_unread_id = intValue3;
i21 = ((Integer) objArr[6]).intValue();
}
} else {
if (this.startLoadFromMessageId != 0 && (intValue4 == 3 || intValue4 == 4)) {
this.last_message_id = ((Integer) objArr[5]).intValue();
}
i21 = 0;
}
if (intValue4 != 0 && (this.startLoadFromMessageId != 0 || this.last_message_id != 0)) {
this.forwardEndReached[i45] = false;
}
if ((intValue4 == 1 || intValue4 == 3) && i45 == 1) {
boolean[] zArr = this.endReached;
this.cacheEndReached[0] = true;
zArr[0] = true;
this.forwardEndReached[0] = false;
this.minMessageId[0] = 0;
}
if (this.inScheduleMode) {
boolean[] zArr2 = this.endReached;
this.cacheEndReached[0] = true;
zArr2[0] = true;
boolean[] zArr3 = this.forwardEndReached;
zArr3[0] = true;
zArr3[0] = true;
}
if (this.loadsCount == 1 && arrayList4.size() > 20) {
this.loadsCount++;
}
if (this.firstLoading) {
if (!this.forwardEndReached[i45]) {
this.messages.clear();
this.messagesByDays.clear();
this.groupedMessagesMap.clear();
for (int i47 = 0; i47 < 2; i47++) {
this.messagesDict[i47].clear();
if (this.currentEncryptedChat == null) {
this.maxMessageId[i47] = Integer.MAX_VALUE;
i38 = Integer.MIN_VALUE;
this.minMessageId[i47] = Integer.MIN_VALUE;
} else {
i38 = Integer.MIN_VALUE;
this.maxMessageId[i47] = Integer.MIN_VALUE;
this.minMessageId[i47] = Integer.MAX_VALUE;
}
this.maxDate[i47] = i38;
this.minDate[i47] = 0;
}
}
this.firstLoading = false;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$didReceivedNotification$69$ChatActivity();
}
});
}
if (intValue4 == 1) {
Collections.reverse(arrayList4);
}
if (this.currentEncryptedChat == null) {
getMediaDataController().loadReplyMessagesForMessages(arrayList4, this.dialog_id, this.inScheduleMode);
}
if ((intValue4 == 2 || intValue4 == 1) && arrayList4.isEmpty() && !booleanValue2) {
this.forwardEndReached[0] = true;
}
MediaController mediaController2 = MediaController.getInstance();
int size3 = arrayList4.size();
TLRPC.MessageAction messageAction2 = null;
boolean z29 = false;
for (int i48 = 0; i48 < size3; i48++) {
TLRPC.MessageAction messageAction3 = arrayList4.get((size3 - i48) - 1).messageOwner.action;
if (i48 == 0 && (messageAction3 instanceof TLRPC.TL_messageActionChatCreate)) {
z29 = true;
} else if (!z29) {
break;
} else if (i48 < 2 && (messageAction3 instanceof TLRPC.TL_messageActionChatEditPhoto)) {
messageAction2 = messageAction3;
}
}
int i49 = 0;
LongSparseArray longSparseArray3 = null;
LongSparseArray longSparseArray4 = null;
int i50 = 0;
int i51 = 0;
while (true) {
i22 = i21;
if (i51 >= arrayList4.size()) {
break;
}
MessageObject messageObject16 = arrayList4.get(i51);
int id2 = messageObject16.getId();
int approximateHeight = i50 + messageObject16.getApproximateHeight();
TLRPC.User user8 = this.currentUser;
if (user8 != null) {
if (user8.self) {
i29 = intValue2;
messageObject16.messageOwner.out = true;
} else {
i29 = intValue2;
}
if (!this.inScheduleMode && ((this.currentUser.bot && messageObject16.isOut()) || this.currentUser.id == clientUserId)) {
messageObject16.setIsRead();
}
} else {
i29 = intValue2;
}
if (this.messagesDict[i45].indexOfKey(id2) >= 0) {
i32 = i45;
i30 = clientUserId;
} else {
addToPolls(messageObject16, null);
if (isSecretChat()) {
checkSecretMessageForLocation(messageObject16);
}
if (mediaController2.isPlayingMessage(messageObject16)) {
MessageObject playingMessageObject = mediaController2.getPlayingMessageObject();
messageObject16.audioProgress = playingMessageObject.audioProgress;
messageObject16.audioProgressSec = playingMessageObject.audioProgressSec;
messageObject16.audioPlayerDuration = playingMessageObject.audioPlayerDuration;
}
if (i45 == 0 && ChatObject.isChannel(this.currentChat) && id2 == 1) {
this.endReached[i45] = true;
this.cacheEndReached[i45] = true;
}
if (id2 > 0) {
int[] iArr = this.maxMessageId;
iArr[i45] = Math.min(id2, iArr[i45]);
int[] iArr2 = this.minMessageId;
iArr2[i45] = Math.max(id2, iArr2[i45]);
} else if (this.currentEncryptedChat != null) {
int[] iArr3 = this.maxMessageId;
iArr3[i45] = Math.max(id2, iArr3[i45]);
int[] iArr4 = this.minMessageId;
iArr4[i45] = Math.min(id2, iArr4[i45]);
}
if (messageObject16.messageOwner.date != 0) {
int[] iArr5 = this.maxDate;
i30 = clientUserId;
iArr5[i45] = Math.max(iArr5[i45], messageObject16.messageOwner.date);
if (this.minDate[i45] == 0 || messageObject16.messageOwner.date < this.minDate[i45]) {
this.minDate[i45] = messageObject16.messageOwner.date;
}
} else {
i30 = clientUserId;
}
if (id2 == this.last_message_id) {
i31 = 1;
this.forwardEndReached[i45] = true;
} else {
i31 = 1;
}
TLRPC.MessageAction messageAction4 = messageObject16.messageOwner.action;
if (messageObject16.type < 0 || ((i45 == i31 && (messageAction4 instanceof TLRPC.TL_messageActionChatMigrateTo)) || (((chat9 = this.currentChat) != null && chat9.creator && ((messageAction4 instanceof TLRPC.TL_messageActionChatCreate) || (messageAction2 != null && messageAction4 == messageAction2))) || (messageObject16.messageOwner.action instanceof TLRPC.TL_messageActionChannelMigrateFrom)))) {
i32 = i45;
} else {
MessageObject messageObject17 = this.needAnimateToMessage;
if (messageObject17 == null || messageObject17.getId() != id2 || id2 >= 0 || messageObject16.type != 5) {
i33 = approximateHeight;
} else {
i33 = approximateHeight;
if (!this.inScheduleMode) {
messageObject16 = this.needAnimateToMessage;
this.animatingMessageObjects.add(messageObject16);
this.needAnimateToMessage = null;
}
}
this.messagesDict[i45].put(id2, messageObject16);
ArrayList<MessageObject> arrayList5 = this.messagesByDays.get(messageObject16.dateKey);
if (arrayList5 == null) {
ArrayList<MessageObject> arrayList6 = new ArrayList<>();
mediaController = mediaController2;
this.messagesByDays.put(messageObject16.dateKey, arrayList6);
TLRPC.TL_message tL_message = new TLRPC.TL_message();
if (this.inScheduleMode) {
arrayList3 = arrayList6;
messageAction = messageAction2;
i32 = i45;
r2 = 0;
tL_message.message = LocaleController.formatString("MessageScheduledOn", R.string.MessageScheduledOn, LocaleController.formatDateChat(messageObject16.messageOwner.date, true));
} else {
i32 = i45;
arrayList3 = arrayList6;
messageAction = messageAction2;
r2 = 0;
tL_message.message = LocaleController.formatDateChat(messageObject16.messageOwner.date);
}
tL_message.id = r2;
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(messageObject16.messageOwner.date * 1000);
calendar.set(11, r2);
calendar.set(12, r2);
tL_message.date = (int) (calendar.getTimeInMillis() / 1000);
MessageObject messageObject18 = new MessageObject(this.currentAccount, tL_message, r2);
messageObject18.type = 10;
messageObject18.contentType = 1;
messageObject18.isDateObject = true;
if (intValue4 == 1) {
this.messages.add(r2, messageObject18);
} else {
this.messages.add(messageObject18);
}
i49++;
arrayList5 = arrayList3;
} else {
i32 = i45;
mediaController = mediaController2;
messageAction = messageAction2;
}
if (messageObject16.hasValidGroupId()) {
MessageObject.GroupedMessages groupedMessages5 = this.groupedMessagesMap.get(messageObject16.getGroupIdForUse());
if (groupedMessages5 != null && this.messages.size() > 1) {
if (intValue4 == 1) {
messageObject12 = this.messages.get(0);
} else {
ArrayList<MessageObject> arrayList7 = this.messages;
messageObject12 = arrayList7.get(arrayList7.size() - 2);
}
if (messageObject12.getGroupIdForUse() == messageObject16.getGroupIdForUse()) {
if (messageObject12.localGroupId != 0) {
messageObject16.localGroupId = messageObject12.localGroupId;
groupedMessages5 = this.groupedMessagesMap.get(messageObject12.localGroupId);
}
} else if (messageObject12.getGroupIdForUse() != messageObject16.getGroupIdForUse()) {
messageObject16.localGroupId = Utilities.random.nextLong();
groupedMessages5 = null;
}
}
if (groupedMessages5 == null) {
groupedMessages5 = new MessageObject.GroupedMessages();
groupedMessages5.groupId = messageObject16.getGroupId();
this.groupedMessagesMap.put(groupedMessages5.groupId, groupedMessages5);
} else if (longSparseArray3 == null || longSparseArray3.indexOfKey(messageObject16.getGroupId()) < 0) {
if (longSparseArray4 == null) {
longSparseArray4 = new LongSparseArray();
}
longSparseArray4.put(messageObject16.getGroupId(), groupedMessages5);
}
if (longSparseArray3 == null) {
longSparseArray3 = new LongSparseArray();
}
longSparseArray3.put(groupedMessages5.groupId, groupedMessages5);
if (intValue4 == 1) {
groupedMessages5.messages.add(messageObject16);
} else {
groupedMessages5.messages.add(0, messageObject16);
}
} else {
LongSparseArray longSparseArray5 = longSparseArray3;
LongSparseArray longSparseArray6 = longSparseArray4;
if (messageObject16.getGroupIdForUse() != 0) {
messageObject16.messageOwner.grouped_id = 0L;
messageObject16.localSentGroupId = 0L;
}
longSparseArray4 = longSparseArray6;
longSparseArray3 = longSparseArray5;
}
i49++;
arrayList5.add(messageObject16);
if (intValue4 == 1) {
this.messages.add(0, messageObject16);
} else {
ArrayList<MessageObject> arrayList8 = this.messages;
arrayList8.add(arrayList8.size() - 1, messageObject16);
}
if (this.currentEncryptedChat == null) {
if (this.createUnreadMessageAfterId != 0 && intValue4 != 1 && (i37 = i51 + 1) < arrayList4.size()) {
messageObject11 = arrayList4.get(i37);
if (messageObject16.isOut()) {
}
}
messageObject11 = null;
if (intValue4 != 2 && id2 == this.first_unread_id) {
?? r7 = i33 <= AndroidUtilities.displaySize.y / 2 ? 0 : 0;
TLRPC.TL_message tL_message2 = new TLRPC.TL_message();
tL_message2.message = "";
tL_message2.id = r7;
MessageObject messageObject19 = new MessageObject(this.currentAccount, tL_message2, r7);
messageObject19.type = 6;
messageObject19.contentType = 2;
ArrayList<MessageObject> arrayList9 = this.messages;
arrayList9.add(arrayList9.size() - 1, messageObject19);
this.unreadMessageObject = messageObject19;
this.scrollToMessage = messageObject19;
this.scrollToMessagePosition = -10000;
i49++;
} else if ((intValue4 != 3 || intValue4 == 4) && (((i35 = this.startLoadFromMessageId) < 0 && id2 == i35) || ((i36 = this.startLoadFromMessageId) > 0 && id2 > 0 && id2 <= i36))) {
removeSelectedMessageHighlight();
if (this.needSelectFromMessageId && id2 == this.startLoadFromMessageId) {
this.highlightMessageId = id2;
}
if (this.showScrollToMessageError && id2 != this.startLoadFromMessageId) {
AlertsCreator.showSimpleToast(this, LocaleController.getString("MessageNotFound", R.string.MessageNotFound));
}
this.scrollToMessage = messageObject16;
this.startLoadFromMessageId = 0;
if (this.scrollToMessagePosition == -10000) {
this.scrollToMessagePosition = -9000;
}
}
if (intValue4 != 2 && this.unreadMessageObject == null && this.createUnreadMessageAfterId != 0 && (((this.currentEncryptedChat == null && ((!messageObject16.isOut() || messageObject16.messageOwner.from_scheduled) && id2 >= this.createUnreadMessageAfterId)) || (this.currentEncryptedChat != null && ((!messageObject16.isOut() || messageObject16.messageOwner.from_scheduled) && id2 <= this.createUnreadMessageAfterId))) && (intValue4 == 1 || messageObject11 != null || (messageObject11 == null && z28 && i51 == arrayList4.size() - 1)))) {
TLRPC.TL_message tL_message3 = new TLRPC.TL_message();
tL_message3.message = "";
tL_message3.id = 0;
MessageObject messageObject20 = new MessageObject(this.currentAccount, tL_message3, false);
messageObject20.type = 6;
messageObject20.contentType = 2;
if (intValue4 != 1) {
this.messages.add(1, messageObject20);
} else {
ArrayList<MessageObject> arrayList10 = this.messages;
arrayList10.add(arrayList10.size() - 1, messageObject20);
}
this.unreadMessageObject = messageObject20;
if (intValue4 == 3) {
this.scrollToMessage = messageObject20;
this.startLoadFromMessageId = 0;
this.scrollToMessagePosition = -9000;
}
i49++;
}
} else {
if (this.createUnreadMessageAfterId != 0 && intValue4 != 1 && i51 - 1 >= 0) {
messageObject11 = arrayList4.get(i34);
if (messageObject16.isOut()) {
}
}
messageObject11 = null;
if (intValue4 != 2) {
}
if (intValue4 != 3) {
}
removeSelectedMessageHighlight();
if (this.needSelectFromMessageId) {
this.highlightMessageId = id2;
}
if (this.showScrollToMessageError) {
AlertsCreator.showSimpleToast(this, LocaleController.getString("MessageNotFound", R.string.MessageNotFound));
}
this.scrollToMessage = messageObject16;
this.startLoadFromMessageId = 0;
if (this.scrollToMessagePosition == -10000) {
}
if (intValue4 != 2) {
TLRPC.TL_message tL_message32 = new TLRPC.TL_message();
tL_message32.message = "";
tL_message32.id = 0;
MessageObject messageObject202 = new MessageObject(this.currentAccount, tL_message32, false);
messageObject202.type = 6;
messageObject202.contentType = 2;
if (intValue4 != 1) {
}
this.unreadMessageObject = messageObject202;
if (intValue4 == 3) {
}
i49++;
}
}
i51++;
i21 = i22;
i50 = i33;
mediaController2 = mediaController;
intValue2 = i29;
clientUserId = i30;
messageAction2 = messageAction;
i45 = i32;
}
}
messageAction = messageAction2;
i33 = approximateHeight;
mediaController = mediaController2;
longSparseArray4 = longSparseArray4;
longSparseArray3 = longSparseArray3;
i51++;
i21 = i22;
i50 = i33;
mediaController2 = mediaController;
intValue2 = i29;
clientUserId = i30;
messageAction2 = messageAction;
i45 = i32;
}
int i52 = i45;
int i53 = intValue2;
LongSparseArray longSparseArray7 = longSparseArray3;
LongSparseArray longSparseArray8 = longSparseArray4;
if (z28) {
this.createUnreadMessageAfterId = 0;
}
if (intValue4 == 0 && i49 == 0) {
i23 = 1;
this.loadsCount--;
} else {
i23 = 1;
}
if (this.forwardEndReached[i52] && i52 != i23) {
this.first_unread_id = 0;
this.last_message_id = 0;
this.createUnreadMessageAfterId = 0;
}
if (intValue4 == i23) {
if (arrayList4.size() >= i53 || (booleanValue2 && this.currentEncryptedChat == null && !this.forwardEndReached[i52])) {
i27 = 0;
} else {
this.forwardEndReached[i52] = true;
if (i52 != 1) {
i28 = 0;
this.first_unread_id = 0;
this.last_message_id = 0;
this.createUnreadMessageAfterId = 0;
ChatActivityAdapter chatActivityAdapter5 = this.chatAdapter;
chatActivityAdapter5.notifyItemRemoved(chatActivityAdapter5.loadingDownRow);
i27 = 1;
} else {
i28 = 0;
i27 = 0;
}
this.startLoadFromMessageId = i28;
}
if (i49 > 0) {
int findFirstVisibleItemPosition2 = this.chatLayoutManager.findFirstVisibleItemPosition();
if (findFirstVisibleItemPosition2 == 0) {
findFirstVisibleItemPosition2++;
}
View findViewByPosition2 = this.chatLayoutManager.findViewByPosition(findFirstVisibleItemPosition2);
if (findViewByPosition2 != null) {
int i54 = findFirstVisibleItemPosition2;
View view = findViewByPosition2;
while ((view instanceof ChatMessageCell) && ((ChatMessageCell) view).getMessageObject().hasValidGroupId()) {
i54++;
view = this.chatLayoutManager.findViewByPosition(i54);
if (view == null) {
break;
}
}
findViewByPosition2 = view;
findFirstVisibleItemPosition2 = i54;
} else {
findFirstVisibleItemPosition2 = -1;
findViewByPosition2 = null;
}
int measuredHeight = findViewByPosition2 == null ? 0 : (this.chatListView.getMeasuredHeight() - findViewByPosition2.getBottom()) - this.chatListView.getPaddingBottom();
z22 = false;
this.chatAdapter.notifyItemRangeInserted(0, i49);
if (findFirstVisibleItemPosition2 != -1) {
this.chatLayoutManager.scrollToPositionWithOffset((findFirstVisibleItemPosition2 + i49) - i27, measuredHeight);
}
} else {
z22 = false;
}
this.loadingForward = z22;
} else {
if (arrayList4.size() < i53 && intValue4 != 3 && intValue4 != 4) {
if (booleanValue2) {
if (this.currentEncryptedChat != null || (i52 == 1 && this.mergeDialogId != 0 && booleanValue3)) {
this.endReached[i52] = true;
}
if (intValue4 != 2) {
this.cacheEndReached[i52] = true;
}
} else if (intValue4 != 2 || (arrayList4.size() == 0 && this.messages.isEmpty())) {
this.endReached[i52] = true;
}
}
this.loading = false;
if (this.chatListView != null) {
if (this.first || this.scrollToTopOnResume || this.forceScrollToTop) {
this.forceScrollToTop = false;
this.chatAdapter.notifyDataSetChanged();
MessageObject messageObject21 = this.scrollToMessage;
if (messageObject21 != null) {
int i55 = this.startLoadFromMessageOffset;
if (i55 != Integer.MAX_VALUE) {
i24 = (-i55) - this.chatListView.getPaddingBottom();
this.startLoadFromMessageOffset = Integer.MAX_VALUE;
} else {
int i56 = this.scrollToMessagePosition;
if (i56 == -9000) {
i24 = getScrollOffsetForMessage(messageObject21);
} else if (i56 == -10000) {
i24 = -AndroidUtilities.dp(11.0f);
} else {
i24 = i56;
}
z20 = false;
if (!this.messages.isEmpty()) {
if (this.chatAdapter.loadingUpRow != -1 && !this.messages.isEmpty()) {
ArrayList<MessageObject> arrayList11 = this.messages;
if (arrayList11.get(arrayList11.size() - 1) != this.scrollToMessage) {
ArrayList<MessageObject> arrayList12 = this.messages;
}
this.chatLayoutManager.scrollToPositionWithOffset(this.chatAdapter.loadingUpRow, i24, z20);
}
this.chatLayoutManager.scrollToPositionWithOffset(this.chatAdapter.messagesStartRow + this.messages.indexOf(this.scrollToMessage), i24, z20);
}
this.chatListView.invalidate();
i25 = this.scrollToMessagePosition;
if (i25 != -10000 || i25 == -9000) {
showPagedownButton(true, true);
if (i22 != 0 && (textView5 = this.pagedownButtonCounter) != null) {
textView5.setVisibility(0);
if (this.prevSetUnreadCount != this.newUnreadMessageCount) {
TextView textView6 = this.pagedownButtonCounter;
this.newUnreadMessageCount = i22;
str2 = "%d";
textView6.setText(String.format(str2, Integer.valueOf(i22)));
this.prevSetUnreadCount = this.newUnreadMessageCount;
this.scrollToMessagePosition = -10000;
this.scrollToMessage = null;
}
}
}
str2 = "%d";
this.scrollToMessagePosition = -10000;
this.scrollToMessage = null;
}
z20 = true;
if (!this.messages.isEmpty()) {
}
this.chatListView.invalidate();
i25 = this.scrollToMessagePosition;
if (i25 != -10000) {
}
showPagedownButton(true, true);
if (i22 != 0) {
textView5.setVisibility(0);
if (this.prevSetUnreadCount != this.newUnreadMessageCount) {
}
}
str2 = "%d";
this.scrollToMessagePosition = -10000;
this.scrollToMessage = null;
} else {
str2 = "%d";
moveScrollToLastMessage();
}
if (i46 != 0) {
z19 = true;
showMentionDownButton(true, true);
TextView textView7 = this.mentiondownButtonCounter;
if (textView7 != null) {
textView7.setVisibility(0);
TextView textView8 = this.mentiondownButtonCounter;
this.newMentionsCount = i46;
textView8.setText(String.format(str2, Integer.valueOf(i46)));
}
if (this.paused) {
this.scrollToTopOnResume = z19;
if (this.scrollToMessage != null) {
this.scrollToTopUnReadOnResume = z19;
}
}
listViewShowEmptyView(z19, false);
}
} else if (i49 != 0) {
if (this.endReached[i52]) {
int i57 = (i52 == 0 && this.mergeDialogId == 0) ? 1 : 1;
ChatActivityAdapter chatActivityAdapter6 = this.chatAdapter;
chatActivityAdapter6.notifyItemRangeChanged(chatActivityAdapter6.loadingUpRow - i57, 2);
this.chatAdapter.updateRows();
i26 = 1;
findFirstVisibleItemPosition = this.chatLayoutManager.findFirstVisibleItemPosition();
findViewByPosition = this.chatLayoutManager.findViewByPosition(findFirstVisibleItemPosition);
if (findViewByPosition == null) {
int i58 = findFirstVisibleItemPosition;
View view2 = findViewByPosition;
while ((view2 instanceof ChatMessageCell) && ((ChatMessageCell) view2).getMessageObject().hasValidGroupId()) {
i58++;
view2 = this.chatLayoutManager.findViewByPosition(i58);
if (view2 == null) {
break;
}
}
findViewByPosition = view2;
findFirstVisibleItemPosition = i58;
} else {
findFirstVisibleItemPosition = -1;
findViewByPosition = null;
}
int measuredHeight2 = findViewByPosition != null ? 0 : (this.chatListView.getMeasuredHeight() - findViewByPosition.getBottom()) - this.chatListView.getPaddingBottom();
if (i49 - i26 > 0) {
int i59 = this.chatAdapter.messagesEndRow;
ChatActivityAdapter chatActivityAdapter7 = this.chatAdapter;
chatActivityAdapter7.notifyItemChanged(chatActivityAdapter7.loadingUpRow);
this.chatAdapter.notifyItemRangeInserted(i59, i49 - i26);
}
if (findFirstVisibleItemPosition != -1) {
this.chatLayoutManager.scrollToPositionWithOffset(findFirstVisibleItemPosition, measuredHeight2);
}
}
i26 = 0;
findFirstVisibleItemPosition = this.chatLayoutManager.findFirstVisibleItemPosition();
findViewByPosition = this.chatLayoutManager.findViewByPosition(findFirstVisibleItemPosition);
if (findViewByPosition == null) {
}
if (findViewByPosition != null) {
}
if (i49 - i26 > 0) {
}
if (findFirstVisibleItemPosition != -1) {
}
} else if (this.endReached[i52] && ((i52 == 0 && this.mergeDialogId == 0) || i52 == 1)) {
ChatActivityAdapter chatActivityAdapter8 = this.chatAdapter;
chatActivityAdapter8.notifyItemRemoved(chatActivityAdapter8.loadingUpRow);
}
z19 = true;
if (this.paused) {
}
listViewShowEmptyView(z19, false);
} else {
this.scrollToTopOnResume = true;
if (this.scrollToMessage != null) {
this.scrollToTopUnReadOnResume = true;
}
}
}
if (longSparseArray7 != null) {
for (int i60 = 0; i60 < longSparseArray7.size(); i60++) {
MessageObject.GroupedMessages groupedMessages6 = (MessageObject.GroupedMessages) longSparseArray7.valueAt(i60);
groupedMessages6.calculate();
if (this.chatAdapter != null && longSparseArray8 != null && longSparseArray8.indexOfKey(longSparseArray7.keyAt(i60)) >= 0 && (indexOf4 = this.messages.indexOf(groupedMessages6.messages.get(groupedMessages6.messages.size() - 1))) >= 0) {
ChatActivityAdapter chatActivityAdapter9 = this.chatAdapter;
chatActivityAdapter9.notifyItemRangeChanged(indexOf4 + chatActivityAdapter9.messagesStartRow, groupedMessages6.messages.size());
}
}
}
if (this.first && this.messages.size() > 0) {
this.first = false;
}
if (this.messages.isEmpty() && this.currentEncryptedChat == null && (user7 = this.currentUser) != null && user7.bot && this.botUser == null) {
this.botUser = "";
updateBottomOverlay();
}
if (i49 == 0) {
if (this.mergeDialogId == 0 || i52 != 0) {
z21 = this.currentEncryptedChat != null ? false : false;
} else {
z21 = false;
}
this.first = true;
listViewShowEmptyView(true, z21);
if (i49 == 0 && this.mergeDialogId != 0 && i52 == 0) {
getNotificationCenter().setAllowedNotificationsDutingAnimation(new int[]{NotificationCenter.chatInfoDidLoad, NotificationCenter.dialogsNeedReload, NotificationCenter.scheduledMessagesUpdated, NotificationCenter.closeChats, NotificationCenter.messagesDidLoad, NotificationCenter.botKeyboardDidLoad, NotificationCenter.userFullInfoDidLoad, NotificationCenter.needDeleteDialog});
}
if (z26) {
showFloatingDateView(false);
}
checkScrollForLoad(false);
setItemAnimationsEnabled(true);
chatActionBarHelper = this.actionBarHelper;
if (chatActionBarHelper == null) {
chatActionBarHelper.updateUnreadMessageCount();
return;
}
return;
}
FrameLayout frameLayout2 = this.progressView;
if (frameLayout2 != null) {
frameLayout2.setVisibility(4);
}
if (i49 == 0) {
getNotificationCenter().setAllowedNotificationsDutingAnimation(new int[]{NotificationCenter.chatInfoDidLoad, NotificationCenter.dialogsNeedReload, NotificationCenter.scheduledMessagesUpdated, NotificationCenter.closeChats, NotificationCenter.messagesDidLoad, NotificationCenter.botKeyboardDidLoad, NotificationCenter.userFullInfoDidLoad, NotificationCenter.needDeleteDialog});
}
if (z26) {
}
checkScrollForLoad(false);
setItemAnimationsEnabled(true);
chatActionBarHelper = this.actionBarHelper;
if (chatActionBarHelper == null) {
}
} else if (i == NotificationCenter.emojiDidLoad) {
RecyclerListView recyclerListView = this.chatListView;
if (recyclerListView != null) {
recyclerListView.invalidateViews();
}
SimpleTextView simpleTextView = this.replyObjectTextView;
if (simpleTextView != null) {
simpleTextView.invalidate();
}
TextView textView9 = this.alertTextView;
if (textView9 != null) {
textView9.invalidate();
}
SimpleTextView simpleTextView2 = this.pinnedMessageTextView;
if (simpleTextView2 != null) {
simpleTextView2.invalidate();
}
RecyclerListView recyclerListView2 = this.mentionListView;
if (recyclerListView2 != null) {
recyclerListView2.invalidateViews();
}
RecyclerListView recyclerListView3 = this.stickersListView;
if (recyclerListView3 != null) {
recyclerListView3.invalidateViews();
}
} else if (i == NotificationCenter.didUpdateConnectionState) {
int connectionState = ConnectionsManager.getInstance(i2).getConnectionState();
if (connectionState == 3) {
checkAutoDownloadMessages(false);
}
ChatActionBarHelper chatActionBarHelper2 = this.actionBarHelper;
if (chatActionBarHelper2 != null) {
chatActionBarHelper2.updateUnreadMessageCount();
this.actionBarHelper.updateCurrentConnectionState(connectionState);
}
} else if (i == NotificationCenter.chatOnlineCountDidLoad) {
Integer num = (Integer) objArr[0];
if (this.chatInfo == null || (chat8 = this.currentChat) == null || chat8.id != num.intValue()) {
return;
}
this.chatInfo.online_count = ((Integer) objArr[1]).intValue();
ChatActionBarHelper chatActionBarHelper3 = this.actionBarHelper;
if (chatActionBarHelper3 != null) {
chatActionBarHelper3.updateOnlineCount();
this.actionBarHelper.updateSubtitle();
}
} else if (i == NotificationCenter.updateInterfaces) {
int intValue7 = ((Integer) objArr[0]).intValue();
int i61 = intValue7 & 1;
if (i61 != 0 || (intValue7 & 16) != 0) {
if (this.currentChat != null) {
TLRPC.Chat chat10 = getMessagesController().getChat(Integer.valueOf(this.currentChat.id));
if (chat10 != null) {
this.currentChat = chat10;
}
} else if (this.currentUser != null && (user6 = getMessagesController().getUser(Integer.valueOf(this.currentUser.id))) != null) {
this.currentUser = user6;
}
ChatActionBarHelper chatActionBarHelper4 = this.actionBarHelper;
if (chatActionBarHelper4 != null) {
chatActionBarHelper4.updateTitle();
}
}
if ((intValue7 & 32) == 0 && (intValue7 & 4) == 0) {
z17 = false;
} else {
ChatActionBarHelper chatActionBarHelper5 = this.actionBarHelper;
if (chatActionBarHelper5 != null && this.currentChat != null) {
chatActionBarHelper5.updateOnlineCount();
}
z17 = true;
}
if ((intValue7 & 2) != 0 || (intValue7 & 8) != 0 || i61 != 0) {
checkAndUpdateAvatar();
updateVisibleRows();
}
if ((intValue7 & 64) != 0) {
z17 = true;
}
if ((intValue7 & 8192) != 0 && this.currentChat != null) {
TLRPC.Chat chat11 = getMessagesController().getChat(Integer.valueOf(this.currentChat.id));
if (chat11 == null) {
return;
}
this.currentChat = chat11;
updateBottomOverlay();
ChatActivityEnterView chatActivityEnterView2 = this.chatActivityEnterView;
if (chatActivityEnterView2 != null) {
chatActivityEnterView2.setDialogId(this.dialog_id, this.currentAccount);
}
z17 = true;
}
if ((intValue7 & 256) != 0 && this.bottomOverlayChatText2 != null && this.chatInfo != null && ChatObject.isChannel(this.currentChat) && !this.currentChat.megagroup && (-this.chatInfo.linked_chat_id) != 0) {
this.bottomOverlayChatText2.updateCounter();
}
ChatActionBarHelper chatActionBarHelper6 = this.actionBarHelper;
if (chatActionBarHelper6 != null && z17) {
chatActionBarHelper6.updateSubtitle();
}
if ((intValue7 & 128) != 0) {
updateTopPanel(true);
}
} else if (i == NotificationCenter.didReceiveNewMessages) {
if (((Long) objArr[0]).longValue() == this.dialog_id) {
boolean booleanValue4 = ((Boolean) objArr[2]).booleanValue();
boolean z30 = this.inScheduleMode;
if (booleanValue4 != z30) {
if (z30 || this.isPaused || this.forwardingMessages != null) {
return;
}
ArrayList arrayList13 = (ArrayList) objArr[1];
if (arrayList13.isEmpty() || ((MessageObject) arrayList13.get(0)).getId() >= 0) {
return;
}
openScheduledMessages();
return;
}
int clientUserId2 = getUserConfig().getClientUserId();
ArrayList<MessageObject> arrayList14 = (ArrayList) objArr[1];
if (this.currentEncryptedChat != null && arrayList14.size() == 1) {
MessageObject messageObject22 = arrayList14.get(0);
if (this.currentEncryptedChat != null && messageObject22.isOut() && (messageObject22.messageOwner.action instanceof TLRPC.TL_messageEncryptedAction) && (messageObject22.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionSetMessageTTL) && getParentActivity() != null && AndroidUtilities.getPeerLayerVersion(this.currentEncryptedChat.layer) < 17 && this.currentEncryptedChat.ttl > 0 && this.currentEncryptedChat.ttl <= 60) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
builder.setMessage(LocaleController.formatString("CompatibilityChat", R.string.CompatibilityChat, this.currentUser.first_name, this.currentUser.first_name));
showDialog(builder.create());
}
}
boolean z31 = false;
for (int i62 = 0; i62 < arrayList14.size(); i62++) {
MessageObject messageObject23 = arrayList14.get(i62);
if (messageObject23.isOut()) {
if (!z31) {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.closeSearchByActiveAction, new Object[0]);
z31 = true;
}
TLRPC.Chat chat12 = this.currentChat;
if (chat12 != null && chat12.slowmode_enabled && messageObject23.isSent() && !this.inScheduleMode) {
if (this.chatInfo != null) {
int i63 = messageObject23.messageOwner.date + this.chatInfo.slowmode_seconds;
int currentTime = getConnectionsManager().getCurrentTime();
if (i63 > getConnectionsManager().getCurrentTime()) {
TLRPC.ChatFull chatFull3 = this.chatInfo;
chatFull3.slowmode_next_send_date = Math.max(chatFull3.slowmode_next_send_date, Math.min(currentTime + this.chatInfo.slowmode_seconds, i63));
ChatActivityEnterView chatActivityEnterView3 = this.chatActivityEnterView;
if (chatActivityEnterView3 != null) {
chatActivityEnterView3.setSlowModeTimer(this.chatInfo.slowmode_next_send_date);
}
}
}
getMessagesController().loadFullChat(this.currentChat.id, 0, true);
}
}
if (this.currentChat != null) {
if ((((messageObject23.messageOwner.action instanceof TLRPC.TL_messageActionChatDeleteUser) && messageObject23.messageOwner.action.user_id == clientUserId2) || ((messageObject23.messageOwner.action instanceof TLRPC.TL_messageActionChatAddUser) && messageObject23.messageOwner.action.users.contains(Integer.valueOf(clientUserId2)))) && (chat7 = getMessagesController().getChat(Integer.valueOf(this.currentChat.id))) != null) {
this.currentChat = chat7;
checkActionBarMenu();
updateBottomOverlay();
ChatActionBarHelper chatActionBarHelper7 = this.actionBarHelper;
if (chatActionBarHelper7 != null) {
chatActionBarHelper7.updateSubtitle();
}
}
} else if (this.inlineReturn != 0 && messageObject23.messageOwner.reply_markup != null) {
for (int i64 = 0; i64 < messageObject23.messageOwner.reply_markup.rows.size(); i64++) {
TLRPC.TL_keyboardButtonRow tL_keyboardButtonRow = messageObject23.messageOwner.reply_markup.rows.get(i64);
int i65 = 0;
while (true) {
if (i65 < tL_keyboardButtonRow.buttons.size()) {
TLRPC.KeyboardButton keyboardButton = tL_keyboardButtonRow.buttons.get(i65);
if (keyboardButton instanceof TLRPC.TL_keyboardButtonSwitchInline) {
processSwitchButton((TLRPC.TL_keyboardButtonSwitchInline) keyboardButton);
break;
}
i65++;
}
}
}
}
if (messageObject23.messageOwner.reply_to_msg_id != 0 && messageObject23.replyMessageObject == null) {
messageObject23.replyMessageObject = this.messagesDict[0].get(messageObject23.messageOwner.reply_to_msg_id);
if (messageObject23.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage) {
messageObject23.generatePinMessageText(null, null);
} else if (messageObject23.messageOwner.action instanceof TLRPC.TL_messageActionGameScore) {
messageObject23.generateGameMessageText(null);
} else if (messageObject23.messageOwner.action instanceof TLRPC.TL_messageActionPaymentSent) {
messageObject23.generatePaymentSentMessageText(null);
}
if (messageObject23.isMegagroup() && messageObject23.replyMessageObject != null && messageObject23.replyMessageObject.messageOwner != null) {
messageObject23.replyMessageObject.messageOwner.flags |= Integer.MIN_VALUE;
}
}
}
if (!this.inScheduleMode || arrayList14.isEmpty()) {
c5 = 0;
} else {
c5 = 0;
replaceMessageObjects(arrayList14, 0, true);
}
if (!this.forwardEndReached[c5]) {
int i66 = this.currentEncryptedChat != null ? Integer.MAX_VALUE : Integer.MIN_VALUE;
boolean z32 = false;
boolean z33 = false;
int i67 = Integer.MIN_VALUE;
for (int i68 = 0; i68 < arrayList14.size(); i68++) {
MessageObject messageObject24 = arrayList14.get(i68);
int id3 = messageObject24.getId();
if (!this.inScheduleMode && (user5 = this.currentUser) != null && ((user5.bot && messageObject24.isOut()) || this.currentUser.id == clientUserId2)) {
messageObject24.setIsRead();
}
TLRPC.MessageAction messageAction5 = messageObject24.messageOwner.action;
if (messageAction5 instanceof TLRPC.TL_messageActionChatMigrateTo) {
migrateToNewChat(messageObject24);
return;
}
TLRPC.Chat chat13 = this.currentChat;
if (chat13 != null && chat13.megagroup && ((messageAction5 instanceof TLRPC.TL_messageActionChatAddUser) || (messageAction5 instanceof TLRPC.TL_messageActionChatDeleteUser))) {
z33 = true;
}
if (i68 == 0 && messageObject24.messageOwner.id < 0 && messageObject24.type == 5 && !this.inScheduleMode) {
this.needAnimateToMessage = messageObject24;
}
if (messageObject24.isOut() && messageObject24.isSending()) {
scrollToLastMessage(false);
return;
}
if (messageObject24.type >= 0 && this.messagesDict[0].indexOfKey(id3) < 0 && (((chat6 = this.currentChat) == null || !chat6.creator || (!(messageAction5 instanceof TLRPC.TL_messageActionChatCreate) && (!(messageAction5 instanceof TLRPC.TL_messageActionChatEditPhoto) || this.messages.size() >= 4))) && !(messageAction5 instanceof TLRPC.TL_messageActionChannelMigrateFrom))) {
addToPolls(messageObject24, null);
messageObject24.checkLayout();
int max = Math.max(i67, messageObject24.messageOwner.date);
if (id3 > 0) {
i66 = Math.max(id3, i66);
this.last_message_id = Math.max(this.last_message_id, id3);
} else if (this.currentEncryptedChat != null) {
i66 = Math.min(id3, i66);
this.last_message_id = Math.min(this.last_message_id, id3);
}
if (messageObject24.messageOwner.mentioned && messageObject24.isContentUnread()) {
i20 = 1;
this.newMentionsCount++;
} else {
i20 = 1;
}
this.newUnreadMessageCount += i20;
if (messageObject24.type == 10 || messageObject24.type == 11) {
i67 = max;
z32 = true;
} else {
i67 = max;
}
}
}
if (this.newUnreadMessageCount == 0 || (textView4 = this.pagedownButtonCounter) == null) {
i19 = 0;
} else {
i19 = 0;
textView4.setVisibility(0);
int i69 = this.prevSetUnreadCount;
int i70 = this.newUnreadMessageCount;
if (i69 != i70) {
this.prevSetUnreadCount = i70;
this.pagedownButtonCounter.setText(String.format("%d", Integer.valueOf(i70)));
}
}
if (this.newMentionsCount != 0 && (textView3 = this.mentiondownButtonCounter) != null) {
textView3.setVisibility(i19);
TextView textView10 = this.mentiondownButtonCounter;
Object[] objArr2 = new Object[1];
objArr2[i19] = Integer.valueOf(this.newMentionsCount);
textView10.setText(String.format("%d", objArr2));
showMentionDownButton(true, true);
}
updateVisibleRows();
z10 = z32;
z11 = z33;
} else {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("received new messages " + arrayList14.size() + " in dialog " + this.dialog_id);
}
HashMap<String, ArrayList<MessageObject>> hashMap2 = null;
LongSparseArray longSparseArray9 = null;
int i71 = 0;
boolean z34 = false;
boolean z35 = false;
boolean z36 = false;
while (i71 < arrayList14.size()) {
MessageObject messageObject25 = arrayList14.get(i71);
if (messageObject25.scheduled != this.inScheduleMode) {
i14 = clientUserId2;
z13 = z35;
} else {
int id4 = messageObject25.getId();
if (this.inScheduleMode && this.messagesDict[0].indexOfKey(id4) >= 0) {
MessageObject messageObject26 = this.messagesDict[0].get(id4);
this.messagesDict[0].remove(id4);
if (messageObject26 != null) {
int indexOf6 = this.messages.indexOf(messageObject26);
this.messages.remove(indexOf6);
z13 = z35;
ArrayList<MessageObject> arrayList15 = this.messagesByDays.get(messageObject26.dateKey);
arrayList15.remove(messageObject26);
if (arrayList15.isEmpty()) {
this.messagesByDays.remove(messageObject26.dateKey);
if (indexOf6 >= 0 && indexOf6 < this.messages.size()) {
this.messages.remove(indexOf6);
}
}
ChatActivityAdapter chatActivityAdapter10 = this.chatAdapter;
if (chatActivityAdapter10 != null) {
chatActivityAdapter10.notifyDataSetChanged();
}
if (isSecretChat()) {
checkSecretMessageForLocation(messageObject25);
}
if (!this.inScheduleMode && (user4 = this.currentUser) != null && ((user4.bot && messageObject25.isOut()) || this.currentUser.id == clientUserId2)) {
messageObject25.setIsRead();
}
TLRPC.MessageAction messageAction6 = messageObject25.messageOwner.action;
if (messageObject25.type >= 0 || this.messagesDict[0].indexOfKey(id4) >= 0 || (((chat5 = this.currentChat) != null && chat5.creator && ((messageAction6 instanceof TLRPC.TL_messageActionChatCreate) || ((messageAction6 instanceof TLRPC.TL_messageActionChatEditPhoto) && this.messages.size() < 4))) || (messageAction6 instanceof TLRPC.TL_messageActionChannelMigrateFrom))) {
i14 = clientUserId2;
} else {
addToPolls(messageObject25, null);
if (i71 == 0 && messageObject25.messageOwner.id < 0 && messageObject25.type == 5 && !this.inScheduleMode) {
this.animatingMessageObjects.add(messageObject25);
}
if (messageObject25.hasValidGroupId()) {
i15 = id4;
groupedMessages3 = this.groupedMessagesMap.get(messageObject25.getGroupId());
if (groupedMessages3 == null) {
groupedMessages3 = new MessageObject.GroupedMessages();
groupedMessages3.groupId = messageObject25.getGroupId();
this.groupedMessagesMap.put(groupedMessages3.groupId, groupedMessages3);
}
if (longSparseArray9 == null) {
longSparseArray9 = new LongSparseArray();
}
longSparseArray9.put(groupedMessages3.groupId, groupedMessages3);
groupedMessages3.messages.add(messageObject25);
} else {
i15 = id4;
groupedMessages3 = null;
}
if (groupedMessages3 != null) {
MessageObject messageObject27 = groupedMessages3.messages.size() > 1 ? groupedMessages3.messages.get(groupedMessages3.messages.size() - 2) : null;
if (messageObject27 != null) {
i16 = this.messages.indexOf(messageObject27);
if (i16 == -1) {
i14 = clientUserId2;
z14 = z36;
} else if ((messageObject25.scheduled || messageObject25.messageOwner.id >= 0) && !this.messages.isEmpty()) {
int size4 = this.messages.size();
int i72 = 0;
while (i72 < size4) {
MessageObject messageObject28 = this.messages.get(i72);
i14 = clientUserId2;
if (messageObject28.type < 0 || messageObject28.messageOwner.date <= 0) {
z14 = z36;
} else {
if (this.inScheduleMode || messageObject28.messageOwner.id <= 0 || messageObject25.messageOwner.id <= 0) {
z14 = z36;
} else {
z14 = z36;
if (messageObject28.messageOwner.id < messageObject25.messageOwner.id) {
if (messageObject28.getGroupId() != 0 || ((groupedMessages4 = this.groupedMessagesMap.get(messageObject28.getGroupId())) != null && groupedMessages4.messages.size() == 0)) {
groupedMessages4 = null;
}
i16 = groupedMessages4 != null ? i72 : this.messages.indexOf(groupedMessages4.messages.get(groupedMessages4.messages.size() - 1));
if (i16 != -1 || i16 > this.messages.size()) {
i16 = this.messages.size();
}
}
}
if (messageObject28.messageOwner.date <= messageObject25.messageOwner.date) {
if (messageObject28.getGroupId() != 0) {
}
groupedMessages4 = null;
if (groupedMessages4 != null) {
}
if (i16 != -1) {
}
i16 = this.messages.size();
}
}
i72++;
z36 = z14;
clientUserId2 = i14;
}
i14 = clientUserId2;
z14 = z36;
if (i16 != -1) {
}
i16 = this.messages.size();
} else {
i14 = clientUserId2;
z14 = z36;
i16 = 0;
}
if (this.currentEncryptedChat != null && (messageObject25.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage) && (messageObject25.messageOwner.media.webpage instanceof TLRPC.TL_webPageUrlPending)) {
if (hashMap2 == null) {
hashMap2 = new HashMap<>();
}
arrayList2 = hashMap2.get(messageObject25.messageOwner.media.webpage.url);
if (arrayList2 == null) {
arrayList2 = new ArrayList<>();
hashMap2.put(messageObject25.messageOwner.media.webpage.url, arrayList2);
}
arrayList2.add(messageObject25);
}
messageObject25.checkLayout();
if (!(messageAction6 instanceof TLRPC.TL_messageActionChatMigrateTo)) {
migrateToNewChat(messageObject25);
if (longSparseArray9 != null) {
for (int i73 = 0; i73 < longSparseArray9.size(); i73++) {
((MessageObject.GroupedMessages) longSparseArray9.valueAt(i73)).calculate();
}
return;
}
return;
}
TLRPC.Chat chat14 = this.currentChat;
boolean z37 = (chat14 != null && chat14.megagroup && ((messageAction6 instanceof TLRPC.TL_messageActionChatAddUser) || (messageAction6 instanceof TLRPC.TL_messageActionChatDeleteUser))) ? true : z14;
if (this.minDate[0] == 0 || messageObject25.messageOwner.date < this.minDate[0]) {
this.minDate[0] = messageObject25.messageOwner.date;
}
if (messageObject25.isOut() && !messageObject25.messageOwner.from_scheduled) {
removeUnreadPlane(true);
z34 = true;
}
if (i15 > 0) {
int[] iArr6 = this.maxMessageId;
c6 = 0;
i17 = i15;
iArr6[0] = Math.min(i17, iArr6[0]);
int[] iArr7 = this.minMessageId;
iArr7[0] = Math.max(i17, iArr7[0]);
} else {
i17 = i15;
c6 = 0;
if (this.currentEncryptedChat != null) {
int[] iArr8 = this.maxMessageId;
iArr8[0] = Math.max(i17, iArr8[0]);
int[] iArr9 = this.minMessageId;
iArr9[0] = Math.min(i17, iArr9[0]);
}
}
int[] iArr10 = this.maxDate;
iArr10[c6] = Math.max(iArr10[c6], messageObject25.messageOwner.date);
this.messagesDict[c6].put(i17, messageObject25);
ArrayList<MessageObject> arrayList16 = this.messagesByDays.get(messageObject25.dateKey);
if (i16 > this.messages.size()) {
i16 = this.messages.size();
}
if (arrayList16 == null) {
arrayList16 = new ArrayList<>();
this.messagesByDays.put(messageObject25.dateKey, arrayList16);
TLRPC.TL_message tL_message4 = new TLRPC.TL_message();
if (this.inScheduleMode) {
hashMap = hashMap2;
longSparseArray2 = longSparseArray9;
r3 = 0;
tL_message4.message = LocaleController.formatString("MessageScheduledOn", R.string.MessageScheduledOn, LocaleController.formatDateChat(messageObject25.messageOwner.date, true));
} else {
hashMap = hashMap2;
longSparseArray2 = longSparseArray9;
r3 = 0;
tL_message4.message = LocaleController.formatDateChat(messageObject25.messageOwner.date);
}
tL_message4.id = r3;
Calendar calendar2 = Calendar.getInstance();
calendar2.setTimeInMillis(messageObject25.messageOwner.date * 1000);
calendar2.set(11, r3);
calendar2.set(12, r3);
tL_message4.date = (int) (calendar2.getTimeInMillis() / 1000);
MessageObject messageObject29 = new MessageObject(this.currentAccount, tL_message4, r3);
messageObject29.type = 10;
messageObject29.contentType = 1;
messageObject29.isDateObject = true;
this.messages.add(i16, messageObject29);
ChatActivityAdapter chatActivityAdapter11 = this.chatAdapter;
if (chatActivityAdapter11 != null) {
chatActivityAdapter11.notifyItemInserted(i16);
}
} else {
hashMap = hashMap2;
longSparseArray2 = longSparseArray9;
}
if ((!messageObject25.isOut() || messageObject25.messageOwner.from_scheduled) && this.paused && i16 == 0) {
if (!this.scrollToTopUnReadOnResume && (messageObject10 = this.unreadMessageObject) != null) {
removeMessageObject(messageObject10);
if (i16 > 0) {
i16--;
}
this.unreadMessageObject = null;
}
if (this.unreadMessageObject == null) {
TLRPC.TL_message tL_message5 = new TLRPC.TL_message();
tL_message5.message = "";
tL_message5.id = 0;
MessageObject messageObject30 = new MessageObject(this.currentAccount, tL_message5, false);
messageObject30.type = 6;
messageObject30.contentType = 2;
this.messages.add(0, messageObject30);
ChatActivityAdapter chatActivityAdapter12 = this.chatAdapter;
if (chatActivityAdapter12 != null) {
chatActivityAdapter12.notifyItemInserted(0);
}
this.unreadMessageObject = messageObject30;
this.scrollToMessage = messageObject30;
this.scrollToMessagePosition = -10000;
this.scrollToTopUnReadOnResume = true;
arrayList16.add(0, messageObject25);
this.messages.add(i16, messageObject25);
chatActivityAdapter4 = this.chatAdapter;
if (chatActivityAdapter4 != null) {
chatActivityAdapter4.notifyItemChanged(i16);
this.chatAdapter.notifyItemInserted(i16);
}
if (messageObject25.isOut() && messageObject25.messageOwner.mentioned && messageObject25.isContentUnread()) {
i18 = 1;
this.newMentionsCount++;
} else {
i18 = 1;
}
this.newUnreadMessageCount += i18;
if (messageObject25.type != 10 && messageObject25.type != 11) {
z15 = z37;
longSparseArray9 = longSparseArray2;
hashMap2 = hashMap;
z16 = z13;
i71++;
z35 = z16;
z36 = z15;
clientUserId2 = i14;
}
z15 = z37;
longSparseArray9 = longSparseArray2;
hashMap2 = hashMap;
z16 = true;
i71++;
z35 = z16;
z36 = z15;
clientUserId2 = i14;
}
}
arrayList16.add(0, messageObject25);
this.messages.add(i16, messageObject25);
chatActivityAdapter4 = this.chatAdapter;
if (chatActivityAdapter4 != null) {
}
if (messageObject25.isOut()) {
}
i18 = 1;
this.newUnreadMessageCount += i18;
if (messageObject25.type != 10) {
z15 = z37;
longSparseArray9 = longSparseArray2;
hashMap2 = hashMap;
z16 = z13;
i71++;
z35 = z16;
z36 = z15;
clientUserId2 = i14;
}
z15 = z37;
longSparseArray9 = longSparseArray2;
hashMap2 = hashMap;
z16 = true;
i71++;
z35 = z16;
z36 = z15;
clientUserId2 = i14;
}
}
i16 = -1;
if (i16 == -1) {
}
if (this.currentEncryptedChat != null) {
if (hashMap2 == null) {
}
arrayList2 = hashMap2.get(messageObject25.messageOwner.media.webpage.url);
if (arrayList2 == null) {
}
arrayList2.add(messageObject25);
}
messageObject25.checkLayout();
if (!(messageAction6 instanceof TLRPC.TL_messageActionChatMigrateTo)) {
}
}
}
}
z13 = z35;
if (isSecretChat()) {
}
if (!this.inScheduleMode) {
messageObject25.setIsRead();
}
TLRPC.MessageAction messageAction62 = messageObject25.messageOwner.action;
if (messageObject25.type >= 0) {
}
i14 = clientUserId2;
}
z16 = z13;
z15 = z36;
i71++;
z35 = z16;
z36 = z15;
clientUserId2 = i14;
}
boolean z38 = z35;
boolean z39 = z36;
if (hashMap2 != null) {
getMessagesController().reloadWebPages(this.dialog_id, hashMap2, this.inScheduleMode);
}
if (longSparseArray9 != null) {
for (int i74 = 0; i74 < longSparseArray9.size(); i74++) {
MessageObject.GroupedMessages groupedMessages7 = (MessageObject.GroupedMessages) longSparseArray9.valueAt(i74);
int size5 = groupedMessages7.posArray.size();
groupedMessages7.calculate();
int size6 = groupedMessages7.posArray.size();
if (size6 - size5 > 0 && this.chatAdapter != null && (indexOf3 = this.messages.indexOf(groupedMessages7.messages.get(groupedMessages7.messages.size() - 1))) >= 0) {
this.chatAdapter.notifyItemRangeChanged(indexOf3, size6);
}
}
}
FrameLayout frameLayout3 = this.progressView;
if (frameLayout3 != null) {
frameLayout3.setVisibility(4);
}
if (this.chatAdapter == null) {
this.scrollToTopOnResume = true;
}
if (this.chatListView != null && this.chatAdapter != null) {
int findFirstVisibleItemPosition3 = this.chatLayoutManager.findFirstVisibleItemPosition();
if (findFirstVisibleItemPosition3 == -1) {
findFirstVisibleItemPosition3 = 0;
}
View findViewByPosition3 = this.chatLayoutManager.findViewByPosition(findFirstVisibleItemPosition3);
int bottom = findViewByPosition3 != null ? findViewByPosition3.getBottom() - this.chatListView.getMeasuredHeight() : 0;
if ((findFirstVisibleItemPosition3 == 0 && bottom <= AndroidUtilities.dp(5.0f)) || z34) {
this.newUnreadMessageCount = 0;
if (!this.firstLoading && !this.inScheduleMode) {
if (this.paused) {
this.scrollToTopOnResume = true;
} else {
this.forceScrollToTop = true;
moveScrollToLastMessage();
}
}
i13 = 1;
} else {
if (this.newUnreadMessageCount != 0 && (textView = this.pagedownButtonCounter) != null) {
textView.setVisibility(0);
int i75 = this.prevSetUnreadCount;
int i76 = this.newUnreadMessageCount;
if (i75 != i76) {
this.prevSetUnreadCount = i76;
z12 = true;
this.pagedownButtonCounter.setText(String.format("%d", Integer.valueOf(i76)));
showPagedownButton(z12, z12);
i13 = z12;
}
}
z12 = true;
showPagedownButton(z12, z12);
i13 = z12;
}
if (this.newMentionsCount != 0 && (textView2 = this.mentiondownButtonCounter) != null) {
textView2.setVisibility(0);
TextView textView11 = this.mentiondownButtonCounter;
Object[] objArr3 = new Object[i13];
objArr3[0] = Integer.valueOf(this.newMentionsCount);
textView11.setText(String.format("%d", objArr3));
showMentionDownButton(i13, i13);
}
} else {
this.scrollToTopOnResume = true;
}
z10 = z38;
z11 = z39;
}
if (this.inScheduleMode && !arrayList14.isEmpty() && (id = arrayList14.get(0).getId()) < 0) {
scrollToMessageId(id, 0, false, 0, true);
}
if (!this.messages.isEmpty() && (str = this.botUser) != null && str.length() == 0) {
this.botUser = null;
updateBottomOverlay();
}
if (z10) {
checkAndUpdateAvatar();
ChatActionBarHelper chatActionBarHelper8 = this.actionBarHelper;
if (chatActionBarHelper8 != null) {
chatActionBarHelper8.updateTitle();
}
}
if (z11) {
getMessagesController().loadFullChat(this.currentChat.id, 0, true);
return;
}
return;
}
ChatActionBarHelper chatActionBarHelper9 = this.actionBarHelper;
if (chatActionBarHelper9 != null) {
chatActionBarHelper9.updateUnreadMessageCount();
}
} else if (i == NotificationCenter.closeChats) {
if (objArr != null && objArr.length > 0) {
if (((Long) objArr[0]).longValue() == this.dialog_id) {
finishFragment();
return;
}
return;
}
removeSelfFromStack();
} else if (i == NotificationCenter.messagesRead) {
if (this.inScheduleMode) {
return;
}
SparseLongArray sparseLongArray = (SparseLongArray) objArr[0];
SparseLongArray sparseLongArray2 = (SparseLongArray) objArr[1];
if (sparseLongArray != null) {
if (this.bottomOverlayChatText2 != null && this.chatInfo != null && ChatObject.isChannel(this.currentChat) && !this.currentChat.megagroup && (-this.chatInfo.linked_chat_id) != 0) {
this.bottomOverlayChatText2.updateCounter();
}
int size7 = sparseLongArray.size();
for (int i77 = 0; i77 < size7; i77++) {
int keyAt = sparseLongArray.keyAt(i77);
long j3 = sparseLongArray.get(keyAt);
if (keyAt == this.dialog_id) {
int size8 = this.messages.size();
z9 = false;
for (int i78 = 0; i78 < size8; i78++) {
MessageObject messageObject31 = this.messages.get(i78);
if (!messageObject31.isOut() && messageObject31.getId() > 0 && messageObject31.getId() <= ((int) j3)) {
if (!messageObject31.isUnread()) {
break;
}
messageObject31.setIsRead();
this.newUnreadMessageCount--;
z9 = true;
}
}
i12 = 0;
removeUnreadPlane(false);
if (z9) {
if (this.newUnreadMessageCount < 0) {
this.newUnreadMessageCount = i12;
}
TextView textView12 = this.pagedownButtonCounter;
if (textView12 != null) {
int i79 = this.prevSetUnreadCount;
int i80 = this.newUnreadMessageCount;
if (i79 != i80) {
this.prevSetUnreadCount = i80;
Object[] objArr4 = new Object[1];
objArr4[i12] = Integer.valueOf(i80);
textView12.setText(String.format("%d", objArr4));
}
if (this.newUnreadMessageCount <= 0) {
if (this.pagedownButtonCounter.getVisibility() != 4) {
this.pagedownButtonCounter.setVisibility(4);
}
} else if (this.pagedownButtonCounter.getVisibility() != 0) {
this.pagedownButtonCounter.setVisibility(0);
}
}
}
if (sparseLongArray2 != null) {
int size9 = sparseLongArray2.size();
int i81 = 0;
while (true) {
if (i81 >= size9) {
break;
}
int keyAt2 = sparseLongArray2.keyAt(i81);
int i82 = (int) sparseLongArray2.get(keyAt2);
if (keyAt2 != this.dialog_id) {
i81++;
} else {
int size10 = this.messages.size();
for (int i83 = 0; i83 < size10; i83++) {
MessageObject messageObject32 = this.messages.get(i83);
if (messageObject32.isOut() && messageObject32.getId() > 0 && messageObject32.getId() <= i82) {
if (!messageObject32.isUnread()) {
break;
}
messageObject32.setIsRead();
z9 = true;
}
}
}
}
}
if (z9) {
return;
}
updateVisibleRows();
return;
}
}
}
i12 = 0;
z9 = false;
if (z9) {
}
if (sparseLongArray2 != null) {
}
if (z9) {
}
} else if (i == NotificationCenter.historyCleared) {
if (((Long) objArr[0]).longValue() != this.dialog_id) {
return;
}
int intValue8 = ((Integer) objArr[1]).intValue();
int i84 = 0;
boolean z40 = false;
while (i84 < this.messages.size()) {
MessageObject messageObject33 = this.messages.get(i84);
int id5 = messageObject33.getId();
if (id5 > 0 && id5 <= intValue8) {
TLRPC.ChatFull chatFull4 = this.chatInfo;
if (chatFull4 != null && chatFull4.pinned_msg_id == id5) {
this.pinnedMessageObject = null;
c4 = 0;
this.chatInfo.pinned_msg_id = 0;
getMessagesStorage().updateChatPinnedMessage(this.chatInfo.id, 0);
updatePinnedMessageView(true);
} else {
c4 = 0;
TLRPC.UserFull userFull3 = this.userInfo;
if (userFull3 != null && userFull3.pinned_msg_id == id5) {
this.pinnedMessageObject = null;
this.userInfo.pinned_msg_id = 0;
getMessagesStorage().updateUserPinnedMessage(this.chatInfo.id, 0);
updatePinnedMessageView(true);
}
}
this.messages.remove(i84);
i84--;
this.messagesDict[c4].remove(id5);
ArrayList<MessageObject> arrayList17 = this.messagesByDays.get(messageObject33.dateKey);
if (arrayList17 != null) {
arrayList17.remove(messageObject33);
if (arrayList17.isEmpty()) {
this.messagesByDays.remove(messageObject33.dateKey);
if (i84 >= 0 && i84 < this.messages.size()) {
this.messages.remove(i84);
i84--;
}
}
}
z40 = true;
}
i84++;
}
if (this.messages.isEmpty()) {
if (!this.endReached[0] && !this.loading) {
listViewShowEmptyView(true, false);
if (this.currentEncryptedChat == null) {
int[] iArr11 = this.maxMessageId;
iArr11[1] = Integer.MAX_VALUE;
iArr11[0] = Integer.MAX_VALUE;
int[] iArr12 = this.minMessageId;
i11 = Integer.MIN_VALUE;
iArr12[1] = Integer.MIN_VALUE;
iArr12[0] = Integer.MIN_VALUE;
} else {
i11 = Integer.MIN_VALUE;
int[] iArr13 = this.maxMessageId;
iArr13[1] = Integer.MIN_VALUE;
iArr13[0] = Integer.MIN_VALUE;
int[] iArr14 = this.minMessageId;
iArr14[1] = Integer.MAX_VALUE;
iArr14[0] = Integer.MAX_VALUE;
}
int[] iArr15 = this.maxDate;
iArr15[1] = i11;
iArr15[0] = i11;
int[] iArr16 = this.minDate;
iArr16[1] = 0;
iArr16[0] = 0;
this.waitingForLoad.add(Integer.valueOf(this.lastLoadIndex));
MessagesController messagesController2 = getMessagesController();
long j4 = this.dialog_id;
boolean z41 = !this.cacheEndReached[0];
int i85 = this.minDate[0];
int i86 = this.classGuid;
boolean isChannel2 = ChatObject.isChannel(this.currentChat);
boolean z42 = this.inScheduleMode;
int i87 = this.lastLoadIndex;
this.lastLoadIndex = i87 + 1;
messagesController2.loadMessages(j4, 30, 0, 0, z41, i85, i86, 0, 0, isChannel2, z42, i87);
z8 = true;
this.loading = true;
showPagedownButton(false, z8);
showMentionDownButton(false, z8);
if (z40 || this.chatAdapter == null) {
}
removeUnreadPlane(z8);
this.chatAdapter.notifyDataSetChanged();
return;
}
if (this.botButtons != null) {
this.botButtons = null;
ChatActivityEnterView chatActivityEnterView4 = this.chatActivityEnterView;
if (chatActivityEnterView4 != null) {
chatActivityEnterView4.setButtons(null, false);
}
}
if (this.currentEncryptedChat == null && (user3 = this.currentUser) != null && user3.bot && this.botUser == null) {
this.botUser = "";
updateBottomOverlay();
}
}
z8 = true;
showPagedownButton(false, z8);
showMentionDownButton(false, z8);
if (z40) {
}
} else if (i == NotificationCenter.messagesDeleted) {
if (((Boolean) objArr[2]).booleanValue() != this.inScheduleMode) {
return;
}
ArrayList arrayList18 = (ArrayList) objArr[0];
int intValue9 = ((Integer) objArr[1]).intValue();
if (ChatObject.isChannel(this.currentChat)) {
if (intValue9 != 0 || this.mergeDialogId == 0) {
if (intValue9 != this.currentChat.id) {
return;
}
} else {
c3 = 1;
size = arrayList18.size();
longSparseArray = null;
i5 = 0;
z3 = false;
boolean z43 = false;
boolean z44 = false;
z4 = false;
while (i5 < size) {
Integer num2 = (Integer) arrayList18.get(i5);
MessageObject messageObject34 = this.messagesDict[c3].get(num2.intValue());
if (c3 != 0 || (((chatFull2 = this.chatInfo) == null || chatFull2.pinned_msg_id != num2.intValue()) && ((userFull2 = this.userInfo) == null || userFull2.pinned_msg_id != num2.intValue()))) {
z6 = true;
} else {
this.pinnedMessageObject = null;
TLRPC.ChatFull chatFull5 = this.chatInfo;
if (chatFull5 != null) {
i10 = 0;
chatFull5.pinned_msg_id = 0;
} else {
i10 = 0;
TLRPC.UserFull userFull4 = this.userInfo;
if (userFull4 != null) {
userFull4.pinned_msg_id = 0;
}
}
getMessagesStorage().updateChatPinnedMessage(intValue9, i10);
z6 = true;
updatePinnedMessageView(true);
}
if (messageObject34 != null) {
if (this.editingMessageObject == messageObject34) {
hideFieldPanel(z6);
}
int indexOf7 = this.messages.indexOf(messageObject34);
if (indexOf7 != -1) {
if (messageObject34.scheduled) {
this.scheduledMessagesCount--;
z7 = false;
z4 = true;
} else {
z7 = false;
}
removeUnreadPlane(z7);
if (this.selectedMessagesIds[c3].indexOfKey(num2.intValue()) >= 0) {
boolean z45 = i5 == size + (-1);
addToSelectedMessages(messageObject34, false, z45);
z43 = z45;
z3 = true;
}
MessageObject remove = this.messages.remove(indexOf7);
if (remove.getGroupId() != 0) {
arrayList = arrayList18;
i9 = intValue9;
MessageObject.GroupedMessages groupedMessages8 = this.groupedMessagesMap.get(remove.getGroupId());
if (groupedMessages8 != null) {
if (longSparseArray == null) {
longSparseArray = new LongSparseArray();
}
longSparseArray.put(groupedMessages8.groupId, groupedMessages8);
groupedMessages8.messages.remove(messageObject34);
}
} else {
arrayList = arrayList18;
i9 = intValue9;
}
this.messagesDict[c3].remove(num2.intValue());
ArrayList<MessageObject> arrayList19 = this.messagesByDays.get(messageObject34.dateKey);
if (arrayList19 != null) {
arrayList19.remove(messageObject34);
if (arrayList19.isEmpty()) {
this.messagesByDays.remove(messageObject34.dateKey);
if (indexOf7 >= 0 && indexOf7 < this.messages.size()) {
this.messages.remove(indexOf7);
}
}
}
z44 = true;
i5++;
arrayList18 = arrayList;
intValue9 = i9;
}
}
arrayList = arrayList18;
i9 = intValue9;
i5++;
arrayList18 = arrayList;
intValue9 = i9;
}
if (z3) {
if (!z43) {
addToSelectedMessages(null, false, true);
}
updateActionModeTitle();
}
if (longSparseArray != null) {
for (int i88 = 0; i88 < longSparseArray.size(); i88++) {
MessageObject.GroupedMessages groupedMessages9 = (MessageObject.GroupedMessages) longSparseArray.valueAt(i88);
if (groupedMessages9.messages.isEmpty()) {
this.groupedMessagesMap.remove(groupedMessages9.groupId);
} else {
groupedMessages9.calculate();
int indexOf8 = this.messages.indexOf(groupedMessages9.messages.get(groupedMessages9.messages.size() - 1));
if (indexOf8 >= 0 && (chatActivityAdapter3 = this.chatAdapter) != null) {
chatActivityAdapter3.notifyItemRangeChanged(indexOf8 + chatActivityAdapter3.messagesStartRow, groupedMessages9.messages.size());
}
}
}
}
if (this.messages.isEmpty()) {
if (!this.endReached[0] && !this.loading) {
listViewShowEmptyView(true, false);
if (this.currentEncryptedChat == null) {
int[] iArr17 = this.maxMessageId;
iArr17[1] = Integer.MAX_VALUE;
iArr17[0] = Integer.MAX_VALUE;
int[] iArr18 = this.minMessageId;
i8 = Integer.MIN_VALUE;
iArr18[1] = Integer.MIN_VALUE;
iArr18[0] = Integer.MIN_VALUE;
} else {
i8 = Integer.MIN_VALUE;
int[] iArr19 = this.maxMessageId;
iArr19[1] = Integer.MIN_VALUE;
iArr19[0] = Integer.MIN_VALUE;
int[] iArr20 = this.minMessageId;
iArr20[1] = Integer.MAX_VALUE;
iArr20[0] = Integer.MAX_VALUE;
}
int[] iArr21 = this.maxDate;
iArr21[1] = i8;
iArr21[0] = i8;
int[] iArr22 = this.minDate;
iArr22[1] = 0;
iArr22[0] = 0;
this.waitingForLoad.add(Integer.valueOf(this.lastLoadIndex));
MessagesController messagesController3 = getMessagesController();
long j5 = this.dialog_id;
boolean z46 = !this.cacheEndReached[0];
int i89 = this.minDate[0];
int i90 = this.classGuid;
boolean isChannel3 = ChatObject.isChannel(this.currentChat);
boolean z47 = this.inScheduleMode;
int i91 = this.lastLoadIndex;
this.lastLoadIndex = i91 + 1;
messagesController3.loadMessages(j5, 30, 0, 0, z46, i89, i90, 0, 0, isChannel3, z47, i91);
z5 = true;
this.loading = true;
} else {
if (this.botButtons != null) {
this.botButtons = null;
ChatActivityEnterView chatActivityEnterView5 = this.chatActivityEnterView;
if (chatActivityEnterView5 != null) {
chatActivityEnterView5.setButtons(null, false);
}
}
if (this.currentEncryptedChat == null && (user2 = this.currentUser) != null && user2.bot && this.botUser == null) {
this.botUser = "";
updateBottomOverlay();
}
z5 = true;
}
showPagedownButton(false, z5);
showMentionDownButton(false, z5);
}
if (this.chatAdapter != null) {
if (z44) {
int childCount = this.chatListView.getChildCount();
int i92 = 0;
while (true) {
if (i92 >= childCount) {
i6 = -1;
i7 = 0;
break;
}
View childAt = this.chatListView.getChildAt(i92);
if (childAt instanceof ChatMessageCell) {
messageObject9 = ((ChatMessageCell) childAt).getMessageObject();
} else {
messageObject9 = childAt instanceof ChatActionCell ? ((ChatActionCell) childAt).getMessageObject() : null;
}
if (messageObject9 != null && (indexOf2 = this.messages.indexOf(messageObject9)) >= 0) {
i6 = this.chatAdapter.messagesStartRow + indexOf2;
i7 = childAt.getBottom();
break;
}
i92++;
}
this.chatAdapter.notifyDataSetChanged();
if (i6 != -1) {
this.chatLayoutManager.scrollToPositionWithOffset(i6, (this.chatListView.getMeasuredHeight() - i7) - this.chatListView.getPaddingBottom());
}
} else {
this.first_unread_id = 0;
this.last_message_id = 0;
this.createUnreadMessageAfterId = 0;
removeMessageObject(this.unreadMessageObject);
this.unreadMessageObject = null;
TextView textView13 = this.pagedownButtonCounter;
if (textView13 != null) {
textView13.setVisibility(4);
}
}
}
if (z4) {
return;
}
updateScheduledInterface(true);
return;
}
} else if (intValue9 != 0) {
return;
}
c3 = 0;
size = arrayList18.size();
longSparseArray = null;
i5 = 0;
z3 = false;
boolean z432 = false;
boolean z442 = false;
z4 = false;
while (i5 < size) {
}
if (z3) {
}
if (longSparseArray != null) {
}
if (this.messages.isEmpty()) {
}
if (this.chatAdapter != null) {
}
if (z4) {
}
} else if (i == NotificationCenter.messageReceivedByServer) {
if (((Boolean) objArr[6]).booleanValue() != this.inScheduleMode) {
return;
}
Integer num3 = (Integer) objArr[0];
MessageObject messageObject35 = this.messagesDict[0].get(num3.intValue());
if (messageObject35 != null) {
Integer num4 = (Integer) objArr[1];
if (!num4.equals(num3) && this.messagesDict[0].indexOfKey(num4.intValue()) >= 0) {
MessageObject messageObject36 = this.messagesDict[0].get(num3.intValue());
this.messagesDict[0].remove(num3.intValue());
if (messageObject36 != null) {
int indexOf9 = this.messages.indexOf(messageObject36);
this.messages.remove(indexOf9);
ArrayList<MessageObject> arrayList20 = this.messagesByDays.get(messageObject36.dateKey);
arrayList20.remove(messageObject35);
if (arrayList20.isEmpty()) {
this.messagesByDays.remove(messageObject35.dateKey);
if (indexOf9 >= 0 && indexOf9 < this.messages.size()) {
this.messages.remove(indexOf9);
}
}
ChatActivityAdapter chatActivityAdapter13 = this.chatAdapter;
if (chatActivityAdapter13 != null) {
chatActivityAdapter13.notifyDataSetChanged();
return;
}
return;
}
return;
}
TLRPC.Message message = (TLRPC.Message) objArr[2];
if (objArr.length >= 4) {
j = (Long) objArr[4];
} else {
j = 0L;
}
Long l = j;
if (message != null) {
try {
} catch (Exception e) {
e = e;
z = false;
}
if (messageObject35.isForwarded()) {
if (messageObject35.messageOwner.reply_markup != null || message.reply_markup == null) {
}
z = true;
if (!z) {
try {
} catch (Exception e2) {
e = e2;
FileLog.e(e);
z2 = false;
if (messageObject35.getGroupId() != 0) {
}
messageFwdHeader = messageObject35.messageOwner.fwd_from;
messageObject35.messageOwner = message;
if (messageFwdHeader != null) {
}
messageObject35.generateThumbs(true);
messageObject35.setType();
if (message.media instanceof TLRPC.TL_messageMediaGame) {
}
if (z) {
}
this.messagesDict[0].remove(num3.intValue());
this.messagesDict[0].put(num4.intValue(), messageObject35);
messageObject35.messageOwner.id = num4.intValue();
messageObject35.messageOwner.send_state = 0;
messageObject35.forceUpdate = z2;
if (objArr.length >= 6) {
}
addToPolls(messageObject35, null);
ArrayList<MessageObject> arrayList21 = new ArrayList<>();
arrayList21.add(messageObject35);
if (this.currentEncryptedChat == null) {
}
chatActivityAdapter2 = this.chatAdapter;
if (chatActivityAdapter2 != null) {
}
gridLayoutManagerFixed = this.chatLayoutManager;
if (gridLayoutManagerFixed != null) {
moveScrollToLastMessage();
}
getNotificationsController().playOutChatSound();
}
if (messageObject35.messageOwner.params == null || !messageObject35.messageOwner.params.containsKey("query_id")) {
if (message.media != null && messageObject35.messageOwner.media != null) {
}
z2 = false;
if (messageObject35.getGroupId() != 0 && message.grouped_id != 0) {
groupedMessages2 = this.groupedMessagesMap.get(messageObject35.getGroupId());
if (groupedMessages2 != null) {
this.groupedMessagesMap.put(message.grouped_id, groupedMessages2);
}
messageObject35.localSentGroupId = messageObject35.messageOwner.grouped_id;
messageObject35.messageOwner.grouped_id = l.longValue();
}
messageFwdHeader = messageObject35.messageOwner.fwd_from;
messageObject35.messageOwner = message;
if (messageFwdHeader != null && message.fwd_from != null && !TextUtils.isEmpty(message.fwd_from.from_name)) {
messageObject35.messageOwner.fwd_from = messageFwdHeader;
}
messageObject35.generateThumbs(true);
messageObject35.setType();
if (message.media instanceof TLRPC.TL_messageMediaGame) {
messageObject35.applyNewText();
}
}
}
z2 = true;
if (messageObject35.getGroupId() != 0) {
groupedMessages2 = this.groupedMessagesMap.get(messageObject35.getGroupId());
if (groupedMessages2 != null) {
}
messageObject35.localSentGroupId = messageObject35.messageOwner.grouped_id;
messageObject35.messageOwner.grouped_id = l.longValue();
}
messageFwdHeader = messageObject35.messageOwner.fwd_from;
messageObject35.messageOwner = message;
if (messageFwdHeader != null) {
messageObject35.messageOwner.fwd_from = messageFwdHeader;
}
messageObject35.generateThumbs(true);
messageObject35.setType();
if (message.media instanceof TLRPC.TL_messageMediaGame) {
}
}
z = false;
if (!z) {
}
z2 = true;
if (messageObject35.getGroupId() != 0) {
}
messageFwdHeader = messageObject35.messageOwner.fwd_from;
messageObject35.messageOwner = message;
if (messageFwdHeader != null) {
}
messageObject35.generateThumbs(true);
messageObject35.setType();
if (message.media instanceof TLRPC.TL_messageMediaGame) {
}
} else {
z2 = false;
z = false;
}
if (z) {
messageObject35.measureInlineBotButtons();
}
this.messagesDict[0].remove(num3.intValue());
this.messagesDict[0].put(num4.intValue(), messageObject35);
messageObject35.messageOwner.id = num4.intValue();
messageObject35.messageOwner.send_state = 0;
messageObject35.forceUpdate = z2;
if (objArr.length >= 6) {
messageObject35.applyMediaExistanceFlags(((Integer) objArr[5]).intValue());
}
addToPolls(messageObject35, null);
ArrayList<MessageObject> arrayList212 = new ArrayList<>();
arrayList212.add(messageObject35);
if (this.currentEncryptedChat == null) {
getMediaDataController().loadReplyMessagesForMessages(arrayList212, this.dialog_id, this.inScheduleMode);
}
chatActivityAdapter2 = this.chatAdapter;
if (chatActivityAdapter2 != null) {
chatActivityAdapter2.updateRowWithMessageObject(messageObject35, true);
}
gridLayoutManagerFixed = this.chatLayoutManager;
if (gridLayoutManagerFixed != null && z2 && gridLayoutManagerFixed.findFirstVisibleItemPosition() == 0) {
moveScrollToLastMessage();
}
getNotificationsController().playOutChatSound();
}
} else if (i == NotificationCenter.updateChatNewmsgMentionText) {
TLRPC.Message message2 = (TLRPC.Message) objArr[0];
MessageObject messageObject37 = new MessageObject(this.currentAccount, message2, true);
MessageObject messageObject38 = this.messagesDict[0].get(message2.id);
if (messageObject38 != null) {
messageObject38.messageOwner = message2;
messageObject38.messageText = messageObject37.messageText;
messageObject38.generateLayout(null);
messageObject38.renderText();
ChatActivityAdapter chatActivityAdapter14 = this.chatAdapter;
if (chatActivityAdapter14 != null) {
chatActivityAdapter14.updateRowWithMessageObject(messageObject38, true);
}
}
} else if (i == NotificationCenter.messageReceivedByAck) {
MessageObject messageObject39 = this.messagesDict[0].get(((Integer) objArr[0]).intValue());
if (messageObject39 != null) {
messageObject39.messageOwner.send_state = 0;
ChatActivityAdapter chatActivityAdapter15 = this.chatAdapter;
if (chatActivityAdapter15 != null) {
chatActivityAdapter15.updateRowWithMessageObject(messageObject39, true);
}
}
} else if (i == NotificationCenter.messageSendError) {
MessageObject messageObject40 = this.messagesDict[0].get(((Integer) objArr[0]).intValue());
if (messageObject40 != null) {
messageObject40.messageOwner.send_state = 2;
updateVisibleRows();
}
} else if (i == NotificationCenter.contactRelationShip) {
if (((Integer) objArr[0]).intValue() == 101) {
WalletDialogUtil.showWalletDialog(this, "", LocaleController.getString("AddContactsTip", R.string.AddContactsTip), LocaleController.getString("GoVerify", R.string.GoVerify), LocaleController.getString("OK", R.string.GoodSure), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i93) {
ChatActivity.this.lambda$didReceivedNotification$70$ChatActivity(dialogInterface, i93);
}
}, null, null).getNegativeButton().setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText));
}
} else if (i == NotificationCenter.chatInfoDidLoad) {
TLRPC.ChatFull chatFull6 = (TLRPC.ChatFull) objArr[0];
if (this.currentChat == null || chatFull6.id != this.currentChat.id) {
return;
}
if (chatFull6 instanceof TLRPC.TL_channelFull) {
if (this.currentChat.megagroup) {
if (chatFull6.participants != null) {
i4 = 0;
for (int i93 = 0; i93 < chatFull6.participants.participants.size(); i93++) {
i4 = Math.max(chatFull6.participants.participants.get(i93).date, i4);
}
} else {
i4 = 0;
}
if (i4 == 0 || Math.abs((System.currentTimeMillis() / 1000) - i4) > 3600) {
getMessagesController().loadChannelParticipants(Integer.valueOf(this.currentChat.id));
}
}
if (chatFull6.participants == null && (chatFull = this.chatInfo) != null) {
chatFull6.participants = chatFull.participants;
}
}
TLRPC.ChatFull chatFull7 = this.chatInfo;
this.chatInfo = chatFull6;
if (this.chatActivityEnterView != null) {
if (chatFull6.slowmode_seconds != 0 && !ChatObject.hasAdminRights(this.currentChat)) {
if (chatFull7 == null || chatFull7.slowmode_seconds == this.chatInfo.slowmode_seconds) {
int i94 = 0;
while (true) {
if (i94 >= this.messages.size()) {
break;
}
MessageObject messageObject41 = this.messages.get(i94);
if (messageObject41.isOutOwner() && !messageObject41.isDateObject) {
this.chatInfo.slowmode_next_send_date = messageObject41.messageOwner.date + this.chatInfo.slowmode_seconds;
this.chatInfo.flags |= 262144;
break;
}
i94++;
}
} else {
TLRPC.ChatFull chatFull8 = this.chatInfo;
chatFull8.slowmode_next_send_date = (chatFull8.slowmode_seconds - chatFull7.slowmode_seconds) + chatFull7.slowmode_next_send_date;
this.chatInfo.flags |= 262144;
}
}
this.chatActivityEnterView.setChatInfo(this.chatInfo);
}
MentionsAdapter mentionsAdapter = this.mentionsAdapter;
if (mentionsAdapter != null) {
mentionsAdapter.setChatInfo(this.chatInfo);
}
if (objArr[3] instanceof MessageObject) {
this.pinnedMessageObject = (MessageObject) objArr[3];
updatePinnedMessageView(false);
} else {
updatePinnedMessageView(true);
}
ChatActionBarHelper chatActionBarHelper10 = this.actionBarHelper;
if (chatActionBarHelper10 != null) {
chatActionBarHelper10.updateOnlineCount();
this.actionBarHelper.updateSubtitle();
}
TLRPC.ChatFull chatFull9 = this.chatInfo;
if (chatFull9 instanceof TLRPC.TL_chatFull) {
this.hasBotsCommands = false;
this.botInfo.clear();
this.botsCount = 0;
URLSpanBotCommand.enabled = false;
for (int i95 = 0; i95 < this.chatInfo.participants.participants.size(); i95++) {
TLRPC.User user9 = getMessagesController().getUser(Integer.valueOf(this.chatInfo.participants.participants.get(i95).user_id));
if (user9 != null && user9.bot) {
URLSpanBotCommand.enabled = true;
this.botsCount++;
getMediaDataController().loadBotInfo(user9.id, true, this.classGuid);
}
}
RecyclerListView recyclerListView4 = this.chatListView;
if (recyclerListView4 != null) {
recyclerListView4.invalidateViews();
}
} else if (chatFull9 instanceof TLRPC.TL_channelFull) {
this.hasBotsCommands = false;
this.botInfo.clear();
this.botsCount = 0;
URLSpanBotCommand.enabled = (this.chatInfo.bot_info.isEmpty() || (chat4 = this.currentChat) == null || !chat4.megagroup) ? false : true;
this.botsCount = this.chatInfo.bot_info.size();
for (int i96 = 0; i96 < this.chatInfo.bot_info.size(); i96++) {
TLRPC.BotInfo botInfo = this.chatInfo.bot_info.get(i96);
if (!botInfo.commands.isEmpty() && (!ChatObject.isChannel(this.currentChat) || ((chat3 = this.currentChat) != null && chat3.megagroup))) {
this.hasBotsCommands = true;
}
this.botInfo.put(botInfo.user_id, botInfo);
}
RecyclerListView recyclerListView5 = this.chatListView;
if (recyclerListView5 != null) {
recyclerListView5.invalidateViews();
}
if (this.mentionsAdapter != null && (!ChatObject.isChannel(this.currentChat) || ((chat2 = this.currentChat) != null && chat2.megagroup))) {
this.mentionsAdapter.setBotInfo(this.botInfo);
}
if (this.bottomOverlayChatText2 != null && ChatObject.isChannel(this.currentChat) && !this.currentChat.megagroup && (-this.chatInfo.linked_chat_id) != 0) {
this.bottomOverlayChatText2.updateCounter();
}
}
ChatActivityEnterView chatActivityEnterView6 = this.chatActivityEnterView;
if (chatActivityEnterView6 != null) {
chatActivityEnterView6.setBotsCount(this.botsCount, this.hasBotsCommands);
}
MentionsAdapter mentionsAdapter2 = this.mentionsAdapter;
if (mentionsAdapter2 != null) {
mentionsAdapter2.setBotsCount(this.botsCount);
}
if (this.inScheduleMode || !ChatObject.isChannel(this.currentChat) || this.mergeDialogId != 0 || this.chatInfo.migrated_from_chat_id == 0) {
return;
}
this.mergeDialogId = -this.chatInfo.migrated_from_chat_id;
this.maxMessageId[1] = this.chatInfo.migrated_from_max_id;
ChatActivityAdapter chatActivityAdapter16 = this.chatAdapter;
if (chatActivityAdapter16 != null) {
chatActivityAdapter16.notifyDataSetChanged();
}
if (this.mergeDialogId == 0 || !this.endReached[0]) {
return;
}
checkScrollForLoad(false);
} else if (i == NotificationCenter.pinnedLiveMessage) {
TLRPC.ChatFull chatFull10 = (TLRPC.ChatFull) objArr[0];
if (this.currentChat == null || chatFull10.id != this.currentChat.id) {
return;
}
updatePinnedLiveMessageView(false, chatFull10.pinned_msg_id, true);
this.chatActionBarMenuPop.addLiveSubItem(33, R.mipmap.ic_live_chat_top, "直播中");
ChatActionBarHelper chatActionBarHelper11 = this.actionBarHelper;
if (chatActionBarHelper11 != null) {
chatActionBarHelper11.updateOnlineCount();
this.actionBarHelper.updateSubtitle();
}
} else if (i == NotificationCenter.chatInfoCantLoad) {
int intValue10 = ((Integer) objArr[0]).intValue();
TLRPC.Chat chat15 = this.currentChat;
if (chat15 == null || chat15.id != intValue10) {
return;
}
int intValue11 = ((Integer) objArr[1]).intValue();
if (getParentActivity() == null || this.closeChatDialog != null) {
return;
}
if (intValue11 == 0) {
str3 = LocaleController.getString("ChannelCantOpenPrivate", R.string.ChannelCantOpenPrivate);
} else if (intValue11 == 1) {
str3 = LocaleController.getString("ChannelCantOpenNa", R.string.ChannelCantOpenNa);
} else if (intValue11 == 2) {
str3 = LocaleController.getString("ChannelCantOpenBanned", R.string.ChannelCantOpenBanned);
}
WalletDialog showWalletDialog = WalletDialogUtil.showWalletDialog(this, str3, LocaleController.getString("OK", R.string.OK), null);
this.closeChatDialog = showWalletDialog;
showDialog(showWalletDialog);
this.loading = false;
FrameLayout frameLayout4 = this.progressView;
if (frameLayout4 != null) {
frameLayout4.setVisibility(4);
}
ChatActivityAdapter chatActivityAdapter17 = this.chatAdapter;
if (chatActivityAdapter17 != null) {
chatActivityAdapter17.notifyDataSetChanged();
}
} else if (i == NotificationCenter.contactsDidLoad) {
updateTopPanel(true);
ChatActionBarHelper chatActionBarHelper12 = this.actionBarHelper;
if (chatActionBarHelper12 != null) {
chatActionBarHelper12.updateSubtitle();
}
} else if (i == NotificationCenter.encryptedChatUpdated) {
TLRPC.EncryptedChat encryptedChat2 = (TLRPC.EncryptedChat) objArr[0];
if (this.currentEncryptedChat == null || encryptedChat2.id != this.currentEncryptedChat.id) {
return;
}
this.currentEncryptedChat = encryptedChat2;
updateTopPanel(true);
updateSecretStatus();
initStickers();
ChatActivityEnterView chatActivityEnterView7 = this.chatActivityEnterView;
if (chatActivityEnterView7 != null) {
TLRPC.EncryptedChat encryptedChat3 = this.currentEncryptedChat;
boolean z48 = encryptedChat3 == null || AndroidUtilities.getPeerLayerVersion(encryptedChat3.layer) >= 23;
TLRPC.EncryptedChat encryptedChat4 = this.currentEncryptedChat;
chatActivityEnterView7.setAllowStickersAndGifs(z48, encryptedChat4 == null || AndroidUtilities.getPeerLayerVersion(encryptedChat4.layer) >= 46);
this.chatActivityEnterView.checkRoundVideo();
}
MentionsAdapter mentionsAdapter3 = this.mentionsAdapter;
if (mentionsAdapter3 != null) {
mentionsAdapter3.setNeedBotContext(!this.chatActivityEnterView.isEditingMessage() && ((encryptedChat = this.currentEncryptedChat) == null || AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 46));
}
} else if (i == NotificationCenter.messagesReadEncrypted) {
int intValue12 = ((Integer) objArr[0]).intValue();
TLRPC.EncryptedChat encryptedChat5 = this.currentEncryptedChat;
if (encryptedChat5 == null || encryptedChat5.id != intValue12) {
return;
}
int intValue13 = ((Integer) objArr[1]).intValue();
Iterator<MessageObject> it = this.messages.iterator();
while (it.hasNext()) {
MessageObject next = it.next();
if (next.isOut()) {
if (next.isOut() && !next.isUnread()) {
break;
} else if (next.messageOwner.date - 1 <= intValue13) {
next.setIsRead();
}
}
}
updateVisibleRows();
} else if (i == NotificationCenter.removeAllMessagesFromDialog) {
if (this.dialog_id == ((Long) objArr[0]).longValue()) {
clearHistory(((Boolean) objArr[1]).booleanValue());
}
} else if (i == NotificationCenter.screenshotTook) {
updateInformationForScreenshotDetector();
} else if (i == NotificationCenter.blockedUsersDidLoad) {
if (this.currentUser != null) {
boolean z49 = this.userBlocked;
boolean z50 = getMessagesController().blockedUsers.indexOfKey(this.currentUser.id) >= 0;
this.userBlocked = z50;
if (z49 != z50) {
updateBottomOverlay();
}
}
} else if (i == NotificationCenter.fileNewChunkAvailable) {
MessageObject messageObject42 = (MessageObject) objArr[0];
long longValue = ((Long) objArr[3]).longValue();
if (longValue == 0 || this.dialog_id != messageObject42.getDialogId() || (messageObject8 = this.messagesDict[0].get(messageObject42.getId())) == null || messageObject8.messageOwner.media.document == null) {
return;
}
messageObject8.messageOwner.media.document.size = (int) longValue;
updateVisibleRows();
} else if (i == NotificationCenter.didCreatedNewDeleteTask) {
SparseArray sparseArray = (SparseArray) objArr[0];
boolean z51 = false;
for (int i97 = 0; i97 < sparseArray.size(); i97++) {
int keyAt3 = sparseArray.keyAt(i97);
ArrayList arrayList22 = (ArrayList) sparseArray.get(keyAt3);
for (int i98 = 0; i98 < arrayList22.size(); i98++) {
long longValue2 = ((Long) arrayList22.get(i98)).longValue();
if (i98 == 0) {
int i99 = (int) (longValue2 >> 32);
if (i99 < 0) {
i99 = 0;
}
if (i99 != (ChatObject.isChannel(this.currentChat) ? this.currentChat.id : 0)) {
return;
}
}
MessageObject messageObject43 = this.messagesDict[0].get((int) longValue2);
if (messageObject43 != null) {
messageObject43.messageOwner.destroyTime = keyAt3;
z51 = true;
}
}
}
if (z51) {
updateVisibleRows();
}
} else if (i == NotificationCenter.messagePlayingDidStart) {
MessageObject messageObject44 = (MessageObject) objArr[0];
if (messageObject44.eventId != 0) {
return;
}
sendSecretMessageRead(messageObject44);
if ((messageObject44.isRoundVideo() || messageObject44.isVideo()) && this.fragmentView != null && this.fragmentView.getParent() != null) {
MediaController.getInstance().setTextureView(createTextureView(true), this.aspectRatioFrameLayout, this.videoPlayerContainer, true);
updateTextureViewPosition(true);
}
RecyclerListView recyclerListView6 = this.chatListView;
if (recyclerListView6 != null) {
int childCount2 = recyclerListView6.getChildCount();
for (int i100 = 0; i100 < childCount2; i100++) {
View childAt2 = this.chatListView.getChildAt(i100);
if ((childAt2 instanceof ChatMessageCell) && (messageObject7 = (chatMessageCell4 = (ChatMessageCell) childAt2).getMessageObject()) != null) {
boolean isVideo = messageObject7.isVideo();
if (messageObject7.isRoundVideo() || isVideo) {
chatMessageCell4.checkVideoPlayback(false);
if (!MediaController.getInstance().isPlayingMessage(messageObject7)) {
if (isVideo && !MediaController.getInstance().isGoingToShowMessageObject(messageObject7) && (animation2 = chatMessageCell4.getPhotoImage().getAnimation()) != null) {
animation2.start();
}
if (messageObject7.audioProgress != 0.0f) {
messageObject7.resetPlayingProgress();
chatMessageCell4.invalidate();
}
} else if (isVideo) {
chatMessageCell4.updateButtonState(false, true, false);
}
} else if (messageObject7.isVoice() || messageObject7.isMusic()) {
chatMessageCell4.updateButtonState(false, true, false);
}
}
}
int childCount3 = this.mentionListView.getChildCount();
for (int i101 = 0; i101 < childCount3; i101++) {
View childAt3 = this.mentionListView.getChildAt(i101);
if ((childAt3 instanceof ContextLinkCell) && (messageObject6 = (contextLinkCell2 = (ContextLinkCell) childAt3).getMessageObject()) != null && (messageObject6.isVoice() || messageObject6.isMusic())) {
contextLinkCell2.updateButtonState(false, true);
}
}
}
} else if (i == NotificationCenter.messagePlayingGoingToStop) {
if (((Boolean) objArr[1]).booleanValue()) {
this.contentView.removeView(this.videoPlayerContainer);
this.videoPlayerContainer = null;
this.videoTextureView = null;
this.aspectRatioFrameLayout = null;
} else if (this.chatListView != null && (frameLayout = this.videoPlayerContainer) != null && frameLayout.getTag() != null) {
MessageObject messageObject45 = (MessageObject) objArr[0];
int childCount4 = this.chatListView.getChildCount();
for (int i102 = 0; i102 < childCount4; i102++) {
View childAt4 = this.chatListView.getChildAt(i102);
if (childAt4 instanceof ChatMessageCell) {
ChatMessageCell chatMessageCell5 = (ChatMessageCell) childAt4;
if (messageObject45 == chatMessageCell5.getMessageObject()) {
AnimatedFileDrawable animation3 = chatMessageCell5.getPhotoImage().getAnimation();
if (animation3 != null) {
Bitmap animatedBitmap = animation3.getAnimatedBitmap();
if (animatedBitmap != null) {
try {
Bitmap bitmap = this.videoTextureView.getBitmap(animatedBitmap.getWidth(), animatedBitmap.getHeight());
new Canvas(animatedBitmap).drawBitmap(bitmap, 0.0f, 0.0f, (Paint) null);
bitmap.recycle();
} catch (Throwable th) {
FileLog.e(th);
}
}
animation3.seekTo(messageObject45.audioProgressMs, !getFileLoader().isLoadingVideo(messageObject45.getDocument(), true));
return;
}
return;
}
}
}
}
} else if (i == NotificationCenter.messagePlayingDidReset || i == NotificationCenter.messagePlayingPlayStateChanged) {
if (i == NotificationCenter.messagePlayingDidReset) {
destroyTextureView();
}
RecyclerListView recyclerListView7 = this.chatListView;
if (recyclerListView7 != null) {
int childCount5 = recyclerListView7.getChildCount();
for (int i103 = 0; i103 < childCount5; i103++) {
View childAt5 = this.chatListView.getChildAt(i103);
if ((childAt5 instanceof ChatMessageCell) && (messageObject2 = (chatMessageCell = (ChatMessageCell) childAt5).getMessageObject()) != null) {
if (messageObject2.isVoice() || messageObject2.isMusic()) {
chatMessageCell.updateButtonState(false, true, false);
} else if (messageObject2.isVideo()) {
chatMessageCell.updateButtonState(false, true, false);
if (!MediaController.getInstance().isPlayingMessage(messageObject2) && !MediaController.getInstance().isGoingToShowMessageObject(messageObject2) && (animation = chatMessageCell.getPhotoImage().getAnimation()) != null) {
animation.start();
}
} else if (messageObject2.isRoundVideo() && !MediaController.getInstance().isPlayingMessage(messageObject2)) {
chatMessageCell.checkVideoPlayback(true);
}
}
}
int childCount6 = this.mentionListView.getChildCount();
for (int i104 = 0; i104 < childCount6; i104++) {
View childAt6 = this.mentionListView.getChildAt(i104);
if ((childAt6 instanceof ContextLinkCell) && (messageObject = (contextLinkCell = (ContextLinkCell) childAt6).getMessageObject()) != null && (messageObject.isVoice() || messageObject.isMusic())) {
contextLinkCell.updateButtonState(false, true);
}
}
}
} else if (i == NotificationCenter.messagePlayingProgressDidChanged) {
Integer num5 = (Integer) objArr[0];
RecyclerListView recyclerListView8 = this.chatListView;
if (recyclerListView8 != null) {
int childCount7 = recyclerListView8.getChildCount();
for (int i105 = 0; i105 < childCount7; i105++) {
View childAt7 = this.chatListView.getChildAt(i105);
if ((childAt7 instanceof ChatMessageCell) && (messageObject5 = (chatMessageCell3 = (ChatMessageCell) childAt7).getMessageObject()) != null && messageObject5.getId() == num5.intValue()) {
MessageObject playingMessageObject2 = MediaController.getInstance().getPlayingMessageObject();
if (playingMessageObject2 != null) {
messageObject5.audioProgress = playingMessageObject2.audioProgress;
messageObject5.audioProgressSec = playingMessageObject2.audioProgressSec;
messageObject5.audioPlayerDuration = playingMessageObject2.audioPlayerDuration;
chatMessageCell3.updatePlayingMessageProgress();
if (this.drawLaterRoundProgressCell == chatMessageCell3) {
this.fragmentView.invalidate();
return;
}
return;
}
return;
}
}
}
} else if (i == NotificationCenter.didUpdatePollResults) {
ArrayList<MessageObject> arrayList23 = this.polls.get(((Long) objArr[0]).longValue());
if (arrayList23 != null) {
TLRPC.TL_poll tL_poll = (TLRPC.TL_poll) objArr[1];
TLRPC.TL_pollResults tL_pollResults = (TLRPC.TL_pollResults) objArr[2];
int size11 = arrayList23.size();
for (int i106 = 0; i106 < size11; i106++) {
MessageObject messageObject46 = arrayList23.get(i106);
TLRPC.TL_messageMediaPoll tL_messageMediaPoll = (TLRPC.TL_messageMediaPoll) messageObject46.messageOwner.media;
if (tL_poll != null) {
tL_messageMediaPoll.poll = tL_poll;
}
MessageObject.updatePollResults(tL_messageMediaPoll, tL_pollResults);
ChatActivityAdapter chatActivityAdapter18 = this.chatAdapter;
if (chatActivityAdapter18 != null) {
chatActivityAdapter18.updateRowWithMessageObject(messageObject46, true);
}
}
}
} else if (i == NotificationCenter.didUpdateReactions) {
long longValue3 = ((Long) objArr[0]).longValue();
if (longValue3 == this.dialog_id || longValue3 == this.mergeDialogId) {
MessageObject messageObject47 = this.messagesDict[longValue3 == this.dialog_id ? (char) 0 : (char) 1].get(((Integer) objArr[1]).intValue());
if (messageObject47 != null) {
MessageObject.updateReactions(messageObject47.messageOwner, (TLRPC.TL_messageReactions) objArr[2]);
messageObject47.measureInlineBotButtons();
this.chatAdapter.updateRowWithMessageObject(messageObject47, true);
}
}
} else if (i == NotificationCenter.updateMessageMedia) {
TLRPC.Message message3 = (TLRPC.Message) objArr[0];
MessageObject messageObject48 = this.messagesDict[0].get(message3.id);
if (messageObject48 != null) {
messageObject48.messageOwner.media = message3.media;
messageObject48.messageOwner.attachPath = message3.attachPath;
messageObject48.generateThumbs(false);
if (messageObject48.getGroupId() != 0 && ((messageObject48.photoThumbs == null || messageObject48.photoThumbs.isEmpty()) && (groupedMessages = this.groupedMessagesMap.get(messageObject48.getGroupId())) != null && (indexOf = groupedMessages.messages.indexOf(messageObject48)) >= 0)) {
int size12 = groupedMessages.messages.size();
if (indexOf <= 0 || indexOf >= groupedMessages.messages.size() - 1) {
messageObject4 = null;
} else {
MessageObject.GroupedMessages groupedMessages10 = new MessageObject.GroupedMessages();
groupedMessages10.groupId = Utilities.random.nextLong();
int i107 = indexOf + 1;
groupedMessages10.messages.addAll(groupedMessages.messages.subList(i107, groupedMessages.messages.size()));
for (int i108 = 0; i108 < groupedMessages10.messages.size(); i108++) {
groupedMessages10.messages.get(i108).localGroupId = groupedMessages10.groupId;
groupedMessages.messages.remove(i107);
}
this.groupedMessagesMap.put(groupedMessages10.groupId, groupedMessages10);
messageObject4 = groupedMessages10.messages.get(groupedMessages10.messages.size() - 1);
groupedMessages10.calculate();
}
groupedMessages.messages.remove(indexOf);
if (groupedMessages.messages.isEmpty()) {
this.groupedMessagesMap.remove(groupedMessages.groupId);
} else {
if (messageObject4 == null) {
messageObject4 = groupedMessages.messages.get(groupedMessages.messages.size() - 1);
}
groupedMessages.calculate();
int indexOf10 = this.messages.indexOf(messageObject4);
if (indexOf10 >= 0 && (chatActivityAdapter = this.chatAdapter) != null) {
chatActivityAdapter.notifyItemRangeChanged(indexOf10 + chatActivityAdapter.messagesStartRow, size12);
}
}
}
if (message3.media.ttl_seconds != 0 && ((message3.media.photo instanceof TLRPC.TL_photoEmpty) || (message3.media.document instanceof TLRPC.TL_documentEmpty))) {
messageObject48.setType();
ChatActivityAdapter chatActivityAdapter19 = this.chatAdapter;
if (chatActivityAdapter19 != null) {
chatActivityAdapter19.updateRowWithMessageObject(messageObject48, false);
return;
}
return;
}
updateVisibleRows();
}
} else if (i == NotificationCenter.replaceMessagesObjects) {
long longValue4 = ((Long) objArr[0]).longValue();
if (longValue4 == this.dialog_id || longValue4 == this.mergeDialogId) {
replaceMessageObjects((ArrayList) objArr[1], longValue4 == this.dialog_id ? 0 : 1, false);
}
} else if (i == NotificationCenter.notificationsSettingsUpdated) {
updateTitleIcons();
if (ChatObject.isChannel(this.currentChat)) {
updateBottomOverlay();
}
} else if (i == NotificationCenter.replyMessagesDidLoad) {
if (((Long) objArr[0]).longValue() == this.dialog_id) {
updateVisibleRows();
}
} else if (i == NotificationCenter.pinnedMessageDidLoad) {
MessageObject messageObject49 = (MessageObject) objArr[0];
if (messageObject49.getDialogId() == this.dialog_id) {
TLRPC.ChatFull chatFull11 = this.chatInfo;
if ((chatFull11 == null || chatFull11.pinned_msg_id != messageObject49.getId()) && ((userFull = this.userInfo) == null || userFull.pinned_msg_id != messageObject49.getId())) {
return;
}
this.pinnedMessageObject = messageObject49;
this.loadingPinnedMessage = 0;
updatePinnedMessageView(true);
}
} else if (i == NotificationCenter.didReceivedWebpages) {
ArrayList arrayList24 = (ArrayList) objArr[0];
boolean z52 = false;
for (int i109 = 0; i109 < arrayList24.size(); i109++) {
TLRPC.Message message4 = (TLRPC.Message) arrayList24.get(i109);
long dialogId = MessageObject.getDialogId(message4);
if (dialogId == this.dialog_id || dialogId == this.mergeDialogId) {
MessageObject messageObject50 = this.messagesDict[dialogId == this.dialog_id ? (char) 0 : (char) 1].get(message4.id);
if (messageObject50 != null) {
messageObject50.messageOwner.media = new TLRPC.TL_messageMediaWebPage();
messageObject50.messageOwner.media.webpage = message4.media.webpage;
messageObject50.generateThumbs(true);
z52 = true;
}
}
}
if (z52) {
updateVisibleRows();
}
} else if (i == NotificationCenter.didReceivedWebpagesInUpdates) {
if (this.foundWebPage != null) {
LongSparseArray longSparseArray10 = (LongSparseArray) objArr[0];
for (int i110 = 0; i110 < longSparseArray10.size(); i110++) {
TLRPC.WebPage webPage = (TLRPC.WebPage) longSparseArray10.valueAt(i110);
if (webPage.id == this.foundWebPage.id) {
showFieldPanelForWebPage(!(webPage instanceof TLRPC.TL_webPageEmpty), webPage, false);
return;
}
}
}
} else if (i == NotificationCenter.messagesReadContent) {
ArrayList arrayList25 = (ArrayList) objArr[0];
int i111 = ChatObject.isChannel(this.currentChat) ? this.currentChat.id : 0;
boolean z53 = false;
for (int i112 = 0; i112 < arrayList25.size(); i112++) {
long longValue5 = ((Long) arrayList25.get(i112)).longValue();
int i113 = (int) (longValue5 >> 32);
if (i113 < 0) {
i113 = 0;
}
if (i113 == i111 && (messageObject3 = this.messagesDict[0].get((int) longValue5)) != null) {
messageObject3.setContentIsRead();
if (messageObject3.messageOwner.mentioned) {
int i114 = this.newMentionsCount - 1;
this.newMentionsCount = i114;
if (i114 <= 0) {
this.newMentionsCount = 0;
this.hasAllMentionsLocal = true;
showMentionDownButton(false, true);
} else {
TextView textView14 = this.mentiondownButtonCounter;
if (textView14 != null) {
textView14.setText(String.format("%d", Integer.valueOf(i114)));
}
}
}
z53 = true;
}
}
if (z53) {
updateVisibleRows();
}
} else if (i == NotificationCenter.botInfoDidLoad) {
if (this.classGuid == ((Integer) objArr[1]).intValue()) {
TLRPC.BotInfo botInfo2 = (TLRPC.BotInfo) objArr[0];
if (this.currentEncryptedChat == null) {
if (!botInfo2.commands.isEmpty() && !ChatObject.isChannel(this.currentChat)) {
this.hasBotsCommands = true;
}
this.botInfo.put(botInfo2.user_id, botInfo2);
ChatActivityAdapter chatActivityAdapter20 = this.chatAdapter;
if (chatActivityAdapter20 != null) {
chatActivityAdapter20.notifyItemChanged(chatActivityAdapter20.botInfoRow);
}
if (this.mentionsAdapter != null && (!ChatObject.isChannel(this.currentChat) || ((chat = this.currentChat) != null && chat.megagroup))) {
this.mentionsAdapter.setBotInfo(this.botInfo);
}
ChatActivityEnterView chatActivityEnterView8 = this.chatActivityEnterView;
if (chatActivityEnterView8 != null) {
chatActivityEnterView8.setBotsCount(this.botsCount, this.hasBotsCommands);
}
}
updateBotButtons();
}
} else if (i == NotificationCenter.botKeyboardDidLoad) {
if (this.dialog_id == ((Long) objArr[1]).longValue()) {
TLRPC.Message message5 = (TLRPC.Message) objArr[0];
if (message5 != null && !this.userBlocked) {
this.botButtons = new MessageObject(this.currentAccount, message5, false);
checkBotKeyboard();
return;
}
this.botButtons = null;
if (this.chatActivityEnterView != null) {
MessageObject messageObject51 = this.replyingMessageObject;
if (messageObject51 != null && this.botReplyButtons == messageObject51) {
this.botReplyButtons = null;
hideFieldPanel(true);
}
this.chatActivityEnterView.setButtons(this.botButtons);
}
}
} else if (i == NotificationCenter.chatSearchResultsAvailable) {
if (this.classGuid == ((Integer) objArr[0]).intValue()) {
int intValue14 = ((Integer) objArr[1]).intValue();
long longValue6 = ((Long) objArr[3]).longValue();
if (intValue14 != 0) {
c = 2;
c2 = 4;
scrollToMessageId(intValue14, 0, true, longValue6 == this.dialog_id ? 0 : 1, false);
} else {
c = 2;
c2 = 4;
updateVisibleRows();
}
updateSearchButtons(((Integer) objArr[c]).intValue(), ((Integer) objArr[c2]).intValue(), ((Integer) objArr[5]).intValue());
ActionBarMenuItem actionBarMenuItem2 = this.searchItem;
if (actionBarMenuItem2 != null) {
actionBarMenuItem2.setShowSearchProgress(false);
}
}
} else if (i == NotificationCenter.chatSearchResultsLoading) {
if (this.classGuid != ((Integer) objArr[0]).intValue() || (actionBarMenuItem = this.searchItem) == null) {
return;
}
actionBarMenuItem.setShowSearchProgress(true);
} else if (i == NotificationCenter.didUpdatedMessagesViews) {
SparseIntArray sparseIntArray = (SparseIntArray) ((SparseArray) objArr[0]).get((int) this.dialog_id);
if (sparseIntArray != null) {
boolean z54 = false;
for (int i115 = 0; i115 < sparseIntArray.size(); i115++) {
int keyAt4 = sparseIntArray.keyAt(i115);
MessageObject messageObject52 = this.messagesDict[0].get(keyAt4);
if (messageObject52 != null && (i3 = sparseIntArray.get(keyAt4)) > messageObject52.messageOwner.views) {
messageObject52.messageOwner.views = i3;
z54 = true;
}
}
if (z54) {
updateVisibleRows();
}
}
} else if (i == NotificationCenter.peerSettingsDidLoad) {
long longValue7 = ((Long) objArr[0]).longValue();
if (longValue7 == this.dialog_id || ((user = this.currentUser) != null && user.id == longValue7)) {
updateTopPanel(!this.paused);
}
} else if (i == NotificationCenter.newDraftReceived) {
if (((Long) objArr[0]).longValue() == this.dialog_id) {
applyDraftMaybe(true);
}
} else if (i == NotificationCenter.userFullInfoDidLoad) {
Integer num6 = (Integer) objArr[0];
TLRPC.User user10 = this.currentUser;
if (user10 == null || user10.id != num6.intValue()) {
return;
}
TLRPC.UserFull userFull5 = (TLRPC.UserFull) objArr[1];
this.userInfo = userFull5;
if (userFull5 != null && !userFull5.phone_calls_available) {
this.actionBar.createMenu().removeView(this.callItem);
}
if (objArr[2] instanceof MessageObject) {
this.pinnedMessageObject = (MessageObject) objArr[2];
updatePinnedMessageView(false);
return;
}
updatePinnedMessageView(true);
} else if (i == NotificationCenter.didSetNewWallpapper) {
if (this.fragmentView != null) {
this.contentView.setBackgroundImage(Theme.getCachedWallpaper(), Theme.isWallpaperMotion());
this.progressView2.getBackground().setColorFilter(Theme.colorFilter);
TextView textView15 = this.emptyView;
if (textView15 != null) {
textView15.getBackground().setColorFilter(Theme.colorFilter);
}
ChatBigEmptyView chatBigEmptyView = this.bigEmptyView;
if (chatBigEmptyView != null) {
chatBigEmptyView.getBackground().setColorFilter(Theme.colorFilter);
}
this.chatListView.invalidateViews();
}
} else if (i == NotificationCenter.goingToPreviewTheme) {
GridLayoutManagerFixed gridLayoutManagerFixed2 = this.chatLayoutManager;
if (gridLayoutManagerFixed2 != null) {
int findFirstVisibleItemPosition4 = gridLayoutManagerFixed2.findFirstVisibleItemPosition();
if (findFirstVisibleItemPosition4 != 0) {
this.scrollToPositionOnRecreate = findFirstVisibleItemPosition4;
RecyclerListView.Holder holder = (RecyclerListView.Holder) this.chatListView.findViewHolderForAdapterPosition(findFirstVisibleItemPosition4);
if (holder != null) {
this.scrollToOffsetOnRecreate = (this.chatListView.getMeasuredHeight() - holder.itemView.getBottom()) - this.chatListView.getPaddingBottom();
return;
} else {
this.scrollToPositionOnRecreate = -1;
return;
}
}
this.scrollToPositionOnRecreate = -1;
}
} else if (i == NotificationCenter.channelRightsUpdated) {
TLRPC.Chat chat16 = (TLRPC.Chat) objArr[0];
if (this.currentChat == null || chat16.id != this.currentChat.id || (chatActivityEnterView = this.chatActivityEnterView) == null) {
return;
}
this.currentChat = chat16;
chatActivityEnterView.checkChannelRights();
checkRaiseSensors();
updateSecretStatus();
} else if (i == NotificationCenter.updateMentionsCount) {
if (this.dialog_id != ((Long) objArr[0]).longValue() || this.newMentionsCount <= (intValue = ((Integer) objArr[1]).intValue())) {
return;
}
this.newMentionsCount = intValue;
if (intValue <= 0) {
this.newMentionsCount = 0;
this.hasAllMentionsLocal = true;
showMentionDownButton(false, true);
return;
}
this.mentiondownButtonCounter.setText(String.format("%d", Integer.valueOf(intValue)));
} else if (i == NotificationCenter.audioRecordTooShort) {
if (((Integer) objArr[0]).intValue() != this.classGuid) {
return;
}
showVoiceHint(false, ((Boolean) objArr[1]).booleanValue());
} else if (i == NotificationCenter.videoLoadingStateChanged) {
RecyclerListView recyclerListView9 = this.chatListView;
if (recyclerListView9 != null) {
String str4 = (String) objArr[0];
int childCount8 = recyclerListView9.getChildCount();
for (int i116 = 0; i116 < childCount8; i116++) {
View childAt8 = this.chatListView.getChildAt(i116);
if ((childAt8 instanceof ChatMessageCell) && (streamingMedia = (chatMessageCell2 = (ChatMessageCell) childAt8).getStreamingMedia()) != null && FileLoader.getAttachFileName(streamingMedia).equals(str4)) {
chatMessageCell2.updateButtonState(false, true, false);
}
}
}
} else if (i == NotificationCenter.scheduledMessagesUpdated) {
if (this.dialog_id == ((Long) objArr[0]).longValue()) {
this.scheduledMessagesCount = ((Integer) objArr[1]).intValue();
updateScheduledInterface(this.openAnimationEnded);
}
} else if (i == NotificationCenter.livestatechange) {
TLRPC.TL_messageMediaShare tL_messageMediaShare = (TLRPC.TL_messageMediaShare) objArr[0];
} else {
int i117 = NotificationCenter.liverestartnotify;
}
}
public void lambda$didReceivedNotification$69$ChatActivity() {
if (this.parentLayout != null) {
this.parentLayout.resumeDelayedFragmentAnimation();
}
}
public void lambda$didReceivedNotification$70$ChatActivity(DialogInterface dialogInterface, int i) {
TLRPC.User user = this.currentUser;
if (user != null) {
presentFragment(new AddContactsInfoActivity(null, user));
}
}
private void listViewShowEmptyView(boolean z, boolean z2) {
RecyclerListView recyclerListView = this.chatListView;
if (recyclerListView != null) {
if (z) {
recyclerListView.setEmptyView(null);
} else {
ArrayList<MessageObject> arrayList = this.messages;
if (arrayList == null || arrayList.isEmpty()) {
if (this.emptyViewContainer != null) {
if (this.chatListView.getEmptyView() != null) {
View emptyView = this.chatListView.getEmptyView();
FrameLayout frameLayout = this.emptyViewContainer;
if (emptyView == frameLayout) {
frameLayout.setVisibility(0);
}
}
this.chatListView.setEmptyView(this.emptyViewContainer);
}
} else {
this.chatListView.setEmptyView(null);
}
}
}
FrameLayout frameLayout2 = this.progressView;
if (frameLayout2 != null) {
frameLayout2.setVisibility(z2 ? 0 : 4);
}
}
private void checkSecretMessageForLocation(MessageObject messageObject) {
if (messageObject.type != 4 || this.locationAlertShown || SharedConfig.isSecretMapPreviewSet()) {
return;
}
this.locationAlertShown = true;
AlertsCreator.showSecretLocationAlert(getParentActivity(), this.currentAccount, new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$checkSecretMessageForLocation$71$ChatActivity();
}
}, true);
}
public void lambda$checkSecretMessageForLocation$71$ChatActivity() {
int childCount = this.chatListView.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = this.chatListView.getChildAt(i);
if (childAt instanceof ChatMessageCell) {
ChatMessageCell chatMessageCell = (ChatMessageCell) childAt;
if (chatMessageCell.getMessageObject().type == 4) {
chatMessageCell.forceResetMessageObject();
}
}
}
}
public void clearHistory(boolean z) {
TLRPC.User user;
this.messages.clear();
this.waitingForLoad.clear();
this.messagesByDays.clear();
this.groupedMessagesMap.clear();
for (int i = 1; i >= 0; i--) {
this.messagesDict[i].clear();
if (this.currentEncryptedChat == null) {
this.maxMessageId[i] = Integer.MAX_VALUE;
this.minMessageId[i] = Integer.MIN_VALUE;
} else {
this.maxMessageId[i] = Integer.MIN_VALUE;
this.minMessageId[i] = Integer.MAX_VALUE;
}
this.maxDate[i] = Integer.MIN_VALUE;
this.minDate[i] = 0;
this.selectedMessagesIds[i].clear();
this.selectedMessagesCanCopyIds[i].clear();
this.selectedMessagesCanStarIds[i].clear();
}
hideActionMode();
updatePinnedMessageView(true);
if (this.botButtons != null) {
this.botButtons = null;
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null) {
chatActivityEnterView.setButtons(null, false);
}
}
if (z) {
ChatActivityAdapter chatActivityAdapter = this.chatAdapter;
if (chatActivityAdapter != null) {
listViewShowEmptyView(true, chatActivityAdapter.botInfoRow == -1);
}
for (int i2 = 0; i2 < 2; i2++) {
this.endReached[i2] = false;
this.cacheEndReached[i2] = false;
this.forwardEndReached[i2] = true;
}
this.first = true;
this.firstLoading = true;
this.loading = true;
this.startLoadFromMessageId = 0;
this.needSelectFromMessageId = false;
this.waitingForLoad.add(Integer.valueOf(this.lastLoadIndex));
int i3 = this.startLoadFromMessageIdSaved;
if (i3 != 0) {
this.startLoadFromMessageId = i3;
this.startLoadFromMessageIdSaved = 0;
MessagesController messagesController = getMessagesController();
long j = this.dialog_id;
int i4 = AndroidUtilities.isTablet() ? 30 : 20;
int i5 = this.startLoadFromMessageId;
int i6 = this.classGuid;
boolean isChannel = ChatObject.isChannel(this.currentChat);
boolean z2 = this.inScheduleMode;
int i7 = this.lastLoadIndex;
this.lastLoadIndex = i7 + 1;
messagesController.loadMessages(j, i4, i5, 0, true, 0, i6, 3, 0, isChannel, z2, i7);
} else {
MessagesController messagesController2 = getMessagesController();
long j2 = this.dialog_id;
int i8 = AndroidUtilities.isTablet() ? 30 : 20;
int i9 = this.classGuid;
boolean isChannel2 = ChatObject.isChannel(this.currentChat);
boolean z3 = this.inScheduleMode;
int i10 = this.lastLoadIndex;
this.lastLoadIndex = i10 + 1;
messagesController2.loadMessages(j2, i8, 0, 0, true, 0, i9, 2, 0, isChannel2, z3, i10);
}
} else {
listViewShowEmptyView(false, false);
}
ChatActivityAdapter chatActivityAdapter2 = this.chatAdapter;
if (chatActivityAdapter2 != null) {
chatActivityAdapter2.notifyDataSetChanged();
}
if (this.currentEncryptedChat == null && (user = this.currentUser) != null && user.bot && this.botUser == null) {
this.botUser = "";
updateBottomOverlay();
}
}
public boolean processSwitchButton(TLRPC.TL_keyboardButtonSwitchInline tL_keyboardButtonSwitchInline) {
if (this.inlineReturn == 0 || tL_keyboardButtonSwitchInline.same_peer || this.parentLayout == null) {
return false;
}
String str = "@" + this.currentUser.username + " " + tL_keyboardButtonSwitchInline.query;
if (this.inlineReturn == this.dialog_id) {
this.inlineReturn = 0L;
this.chatActivityEnterView.setFieldText(str);
} else {
getMediaDataController().saveDraft(this.inlineReturn, str, null, null, false);
if (this.parentLayout.fragmentsStack.size() > 1) {
BaseFragment baseFragment = this.parentLayout.fragmentsStack.get(this.parentLayout.fragmentsStack.size() - 2);
if ((baseFragment instanceof ChatActivity) && ((ChatActivity) baseFragment).dialog_id == this.inlineReturn) {
finishFragment();
} else {
Bundle bundle = new Bundle();
long j = this.inlineReturn;
int i = (int) j;
int i2 = (int) (j >> 32);
if (i == 0) {
bundle.putInt("enc_id", i2);
} else if (i > 0) {
bundle.putInt("user_id", i);
} else if (i < 0) {
bundle.putInt("chat_id", -i);
}
presentFragment(new ChatActivity(bundle), true);
}
}
}
return true;
}
private void replaceMessageObjects(ArrayList<MessageObject> arrayList, int i, boolean z) {
ChatActivityAdapter chatActivityAdapter;
MessageObject messageObject;
MessageObject.GroupedMessages groupedMessages;
int indexOf;
TLRPC.User user = null;
LongSparseArray longSparseArray = null;
int i2 = 0;
while (i2 < arrayList.size()) {
MessageObject messageObject2 = arrayList.get(i2);
MessageObject messageObject3 = this.messagesDict[i].get(messageObject2.getId());
MessageObject messageObject4 = this.pinnedMessageObject;
if (messageObject4 != null && messageObject4.getId() == messageObject2.getId()) {
this.pinnedMessageObject = messageObject2;
updatePinnedMessageView(true);
}
if (messageObject3 != null && (!z || messageObject3.messageOwner.date == messageObject2.messageOwner.date)) {
if (z) {
arrayList.remove(i2);
i2--;
}
addToPolls(messageObject2, messageObject3);
if (messageObject2.type >= 0) {
if (messageObject3.replyMessageObject != null) {
messageObject2.replyMessageObject = messageObject3.replyMessageObject;
if (messageObject2.messageOwner.action instanceof TLRPC.TL_messageActionGameScore) {
messageObject2.generateGameMessageText(user);
} else if (messageObject2.messageOwner.action instanceof TLRPC.TL_messageActionPaymentSent) {
messageObject2.generatePaymentSentMessageText(user);
}
}
if (!messageObject3.isEditing()) {
if (messageObject3.getFileName().equals(messageObject2.getFileName())) {
messageObject2.messageOwner.attachPath = messageObject3.messageOwner.attachPath;
messageObject2.attachPathExists = messageObject3.attachPathExists;
messageObject2.mediaExists = messageObject3.mediaExists;
} else {
messageObject2.checkMediaExistance();
}
}
this.messagesDict[i].put(messageObject3.getId(), messageObject2);
} else {
this.messagesDict[i].remove(messageObject3.getId());
}
int indexOf2 = this.messages.indexOf(messageObject3);
if (indexOf2 >= 0) {
ArrayList<MessageObject> arrayList2 = this.messagesByDays.get(messageObject3.dateKey);
int indexOf3 = arrayList2 != null ? arrayList2.indexOf(messageObject3) : -1;
if (messageObject3.getGroupId() != 0 && (groupedMessages = this.groupedMessagesMap.get(messageObject3.getGroupId())) != null && (indexOf = groupedMessages.messages.indexOf(messageObject3)) >= 0) {
if (messageObject3.getGroupId() != messageObject2.getGroupId()) {
this.groupedMessagesMap.put(messageObject2.getGroupId(), groupedMessages);
}
if (messageObject2.photoThumbs == null || messageObject2.photoThumbs.isEmpty()) {
if (longSparseArray == null) {
longSparseArray = new LongSparseArray();
}
longSparseArray.put(groupedMessages.groupId, groupedMessages);
if (indexOf <= 0 || indexOf >= groupedMessages.messages.size() - 1) {
messageObject = messageObject3;
} else {
MessageObject.GroupedMessages groupedMessages2 = new MessageObject.GroupedMessages();
messageObject = messageObject3;
groupedMessages2.groupId = Utilities.random.nextLong();
int i3 = indexOf + 1;
groupedMessages2.messages.addAll(groupedMessages.messages.subList(i3, groupedMessages.messages.size()));
for (int i4 = 0; i4 < groupedMessages2.messages.size(); i4++) {
groupedMessages2.messages.get(i4).localGroupId = groupedMessages2.groupId;
groupedMessages.messages.remove(i3);
}
longSparseArray.put(groupedMessages2.groupId, groupedMessages2);
this.groupedMessagesMap.put(groupedMessages2.groupId, groupedMessages2);
}
groupedMessages.messages.remove(indexOf);
if (messageObject2.type < 0) {
this.messages.set(indexOf2, messageObject2);
ChatActivityAdapter chatActivityAdapter2 = this.chatAdapter;
if (chatActivityAdapter2 != null) {
chatActivityAdapter2.updateRowAtPosition(chatActivityAdapter2.messagesStartRow + indexOf2);
}
if (indexOf3 >= 0) {
arrayList2.set(indexOf3, messageObject2);
}
} else {
this.messages.remove(indexOf2);
ChatActivityAdapter chatActivityAdapter3 = this.chatAdapter;
if (chatActivityAdapter3 != null) {
chatActivityAdapter3.notifyItemRemoved(chatActivityAdapter3.messagesStartRow + indexOf2);
}
if (indexOf3 >= 0) {
arrayList2.remove(indexOf3);
if (arrayList2.isEmpty()) {
this.messagesByDays.remove(messageObject.dateKey);
this.messages.remove(indexOf2);
ChatActivityAdapter chatActivityAdapter4 = this.chatAdapter;
chatActivityAdapter4.notifyItemRemoved(chatActivityAdapter4.messagesStartRow);
}
}
}
} else {
groupedMessages.messages.set(indexOf, messageObject2);
MessageObject.GroupedMessagePosition remove = groupedMessages.positions.remove(messageObject3);
if (remove != null) {
groupedMessages.positions.put(messageObject2, remove);
}
if (longSparseArray == null) {
longSparseArray = new LongSparseArray();
}
longSparseArray.put(groupedMessages.groupId, groupedMessages);
}
}
messageObject = messageObject3;
if (messageObject2.type < 0) {
}
}
}
i2++;
user = null;
}
if (longSparseArray != null) {
for (int i5 = 0; i5 < longSparseArray.size(); i5++) {
MessageObject.GroupedMessages groupedMessages3 = (MessageObject.GroupedMessages) longSparseArray.valueAt(i5);
if (groupedMessages3.messages.isEmpty()) {
this.groupedMessagesMap.remove(groupedMessages3.groupId);
} else {
groupedMessages3.calculate();
int indexOf4 = this.messages.indexOf(groupedMessages3.messages.get(groupedMessages3.messages.size() - 1));
if (indexOf4 >= 0 && (chatActivityAdapter = this.chatAdapter) != null) {
chatActivityAdapter.notifyItemRangeChanged(indexOf4 + chatActivityAdapter.messagesStartRow, groupedMessages3.messages.size());
}
}
}
}
}
private void migrateToNewChat(final MessageObject messageObject) {
if (this.parentLayout == null) {
return;
}
final int i = messageObject.messageOwner.action.channel_id;
final BaseFragment baseFragment = this.parentLayout.fragmentsStack.size() > 0 ? this.parentLayout.fragmentsStack.get(this.parentLayout.fragmentsStack.size() - 1) : null;
int indexOf = this.parentLayout.fragmentsStack.indexOf(this);
final ActionBarLayout actionBarLayout = this.parentLayout;
if (indexOf > 0 && !(baseFragment instanceof ChatActivity) && !(baseFragment instanceof ProfileActivity) && this.currentChat.creator) {
int size = actionBarLayout.fragmentsStack.size() - 1;
while (indexOf < size) {
BaseFragment baseFragment2 = actionBarLayout.fragmentsStack.get(indexOf);
if (baseFragment2 instanceof ChatActivity) {
Bundle bundle = new Bundle();
bundle.putInt("chat_id", i);
actionBarLayout.addFragmentToStack(new ChatActivity(bundle), indexOf);
baseFragment2.removeSelfFromStack();
} else if (baseFragment2 instanceof ProfileActivity) {
Bundle bundle2 = new Bundle();
bundle2.putInt("chat_id", i);
actionBarLayout.addFragmentToStack(new ProfileActivity(bundle2), indexOf);
baseFragment2.removeSelfFromStack();
} else if (baseFragment2 instanceof ChatEditActivity) {
Bundle bundle3 = new Bundle();
bundle3.putInt("chat_id", i);
actionBarLayout.addFragmentToStack(new ChatEditActivity(bundle3), indexOf);
baseFragment2.removeSelfFromStack();
} else if (baseFragment2 instanceof ChatUsersActivity) {
if (!((ChatUsersActivity) baseFragment2).hasSelectType()) {
Bundle arguments = baseFragment2.getArguments();
arguments.putInt("chat_id", i);
actionBarLayout.addFragmentToStack(new ChatUsersActivity(arguments), indexOf);
}
baseFragment2.removeSelfFromStack();
}
indexOf++;
}
} else {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$migrateToNewChat$72$ChatActivity(baseFragment, messageObject, actionBarLayout);
}
});
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$migrateToNewChat$73$ChatActivity(i);
}
}, 1000L);
}
public void lambda$migrateToNewChat$72$ChatActivity(BaseFragment baseFragment, MessageObject messageObject, ActionBarLayout actionBarLayout) {
if (baseFragment != null) {
getNotificationCenter().removeObserver(baseFragment, NotificationCenter.closeChats);
}
getNotificationCenter().postNotificationName(NotificationCenter.closeChats, new Object[0]);
Bundle bundle = new Bundle();
bundle.putInt("chat_id", messageObject.messageOwner.action.channel_id);
actionBarLayout.presentFragment(new ChatActivity(bundle), true);
}
public void lambda$migrateToNewChat$73$ChatActivity(int i) {
getMessagesController().loadFullChat(i, 0, true);
}
private void addToPolls(MessageObject messageObject, MessageObject messageObject2) {
long pollId = messageObject.getPollId();
if (pollId != 0) {
ArrayList<MessageObject> arrayList = this.polls.get(pollId);
if (arrayList == null) {
arrayList = new ArrayList<>();
this.polls.put(pollId, arrayList);
}
arrayList.add(messageObject);
if (messageObject2 != null) {
arrayList.remove(messageObject2);
}
}
}
public void updateSearchButtons(int i, int i2, int i3) {
ImageView imageView = this.searchUpButton;
if (imageView != null) {
imageView.setEnabled((i & 1) != 0);
this.searchDownButton.setEnabled((i & 2) != 0);
ImageView imageView2 = this.searchUpButton;
imageView2.setAlpha(imageView2.isEnabled() ? 1.0f : 0.5f);
ImageView imageView3 = this.searchDownButton;
imageView3.setAlpha(imageView3.isEnabled() ? 1.0f : 0.5f);
if (i3 < 0) {
this.searchCountText.setText("");
} else if (i3 == 0) {
this.searchCountText.setText(LocaleController.getString("NoResult", R.string.NoResult));
} else {
this.searchCountText.setText(LocaleController.formatString("Of", R.string.Of, Integer.valueOf(i2 + 1), Integer.valueOf(i3)));
}
}
}
@Override
public boolean needDelayOpenAnimation() {
return this.firstLoading;
}
@Override
public void onBecomeFullyHidden() {
UndoView undoView = this.undoView;
if (undoView != null) {
undoView.hide(true, 0);
}
}
@Override
public void onTransitionAnimationStart(boolean z, boolean z2) {
if (z) {
getNotificationCenter().setAllowedNotificationsDutingAnimation(new int[]{NotificationCenter.chatInfoDidLoad, NotificationCenter.dialogsNeedReload, NotificationCenter.scheduledMessagesUpdated, NotificationCenter.closeChats, NotificationCenter.messagesDidLoad, NotificationCenter.botKeyboardDidLoad, NotificationCenter.userFullInfoDidLoad, NotificationCenter.needDeleteDialog});
this.openAnimationEnded = false;
} else {
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null) {
chatActivityEnterView.onBeginHide();
}
}
getNotificationCenter().setAnimationInProgress(true);
}
@Override
public void onTransitionAnimationEnd(boolean z, boolean z2) {
int i = 0;
getNotificationCenter().setAnimationInProgress(false);
if (z) {
this.openAnimationEnded = true;
if (Build.VERSION.SDK_INT >= 21) {
createChatAttachView();
}
if (this.chatActivityEnterView.hasRecordVideo() && !this.chatActivityEnterView.isSendButtonVisible()) {
TLRPC.Chat chat = this.currentChat;
boolean z3 = (chat == null || !ChatObject.isChannel(chat) || this.currentChat.megagroup) ? false : true;
SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
String str = z3 ? "needShowRoundHintChannel" : "needShowRoundHint";
if (globalMainSettings.getBoolean(str, true) && Utilities.random.nextFloat() < 0.2f) {
showVoiceHint(false, this.chatActivityEnterView.isInVideoMode());
globalMainSettings.edit().putBoolean(str, false).commit();
}
}
if (!z2 && this.parentLayout != null) {
int size = this.parentLayout.fragmentsStack.size() - 1;
while (true) {
if (i >= size) {
break;
}
BaseFragment baseFragment = this.parentLayout.fragmentsStack.get(i);
if (baseFragment != this && (baseFragment instanceof ChatActivity)) {
ChatActivity chatActivity = (ChatActivity) baseFragment;
if (chatActivity.dialog_id == this.dialog_id && chatActivity.inScheduleMode == this.inScheduleMode) {
baseFragment.removeSelfFromStack();
break;
}
}
i++;
}
}
if (isFinishing() || getParentActivity() == null || this.parentLayout == null || this.parentLayout.fragmentsStack.isEmpty() || this.parentLayout.fragmentsStack.get(this.parentLayout.fragmentsStack.size() - 1) != this) {
return;
}
TLRPC.Chat chat2 = this.currentChat;
if ((chat2 instanceof TLRPC.TL_channelForbidden) || (chat2 instanceof TLRPC.TL_chatForbidden)) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("ChannelCantOpenNa", R.string.ChannelCantOpenNa));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
AlertDialog create = builder.create();
this.closeChatDialog = create;
showDialog(create);
}
}
}
@Override
public void onDialogDismiss(Dialog dialog) {
Dialog dialog2 = this.closeChatDialog;
if (dialog2 == null || dialog != dialog2) {
return;
}
getMessagesController().deleteDialog(this.dialog_id, 0);
if (this.parentLayout != null && !this.parentLayout.fragmentsStack.isEmpty() && this.parentLayout.fragmentsStack.get(this.parentLayout.fragmentsStack.size() - 1) != this) {
removeSelfFromStack();
this.parentLayout.fragmentsStack.get(this.parentLayout.fragmentsStack.size() - 1).finishFragment();
return;
}
finishFragment();
}
@Override
public boolean extendActionMode(Menu menu) {
if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) {
if (PhotoViewer.getInstance().getSelectiongLength() == 0 || menu.findItem(16908321) == null) {
return true;
}
} else {
if (this.chatActivityEnterView.getSelectionLength() != 0) {
}
return true;
}
if (Build.VERSION.SDK_INT >= 23) {
menu.removeItem(16908341);
}
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(LocaleController.getString("Bold", R.string.Bold));
spannableStringBuilder.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface("fonts/rmedium.ttf")), 0, spannableStringBuilder.length(), 33);
menu.add(R.id.menu_groupbolditalic, R.id.menu_bold, 6, spannableStringBuilder);
SpannableStringBuilder spannableStringBuilder2 = new SpannableStringBuilder(LocaleController.getString("Italic", R.string.Italic));
spannableStringBuilder2.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface("fonts/ritalic.ttf")), 0, spannableStringBuilder2.length(), 33);
menu.add(R.id.menu_groupbolditalic, R.id.menu_italic, 7, spannableStringBuilder2);
SpannableStringBuilder spannableStringBuilder3 = new SpannableStringBuilder(LocaleController.getString("Mono", R.string.Mono));
spannableStringBuilder3.setSpan(new TypefaceSpan(Typeface.MONOSPACE), 0, spannableStringBuilder3.length(), 33);
menu.add(R.id.menu_groupbolditalic, R.id.menu_mono, 8, spannableStringBuilder3);
TLRPC.EncryptedChat encryptedChat = this.currentEncryptedChat;
if (encryptedChat == null || (encryptedChat != null && AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 101)) {
SpannableStringBuilder spannableStringBuilder4 = new SpannableStringBuilder(LocaleController.getString("Strike", R.string.Strike));
TextStyleSpan.TextStyleRun textStyleRun = new TextStyleSpan.TextStyleRun();
textStyleRun.flags = 8 | textStyleRun.flags;
spannableStringBuilder4.setSpan(new TextStyleSpan(textStyleRun), 0, spannableStringBuilder4.length(), 33);
menu.add(R.id.menu_groupbolditalic, R.id.menu_strike, 9, spannableStringBuilder4);
SpannableStringBuilder spannableStringBuilder5 = new SpannableStringBuilder(LocaleController.getString("Underline", R.string.Underline));
TextStyleSpan.TextStyleRun textStyleRun2 = new TextStyleSpan.TextStyleRun();
textStyleRun2.flags |= 16;
spannableStringBuilder5.setSpan(new TextStyleSpan(textStyleRun2), 0, spannableStringBuilder5.length(), 33);
menu.add(R.id.menu_groupbolditalic, R.id.menu_underline, 10, spannableStringBuilder5);
}
menu.add(R.id.menu_groupbolditalic, R.id.menu_link, 11, LocaleController.getString("CreateLink", R.string.CreateLink));
menu.add(R.id.menu_groupbolditalic, R.id.menu_regular, 12, LocaleController.getString("Regular", R.string.Regular));
return true;
}
public void updateScheduledInterface(boolean z) {
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null) {
chatActivityEnterView.updateScheduleButton(z);
}
}
public void updateBottomOverlay() {
TLRPC.User user;
TLRPC.ChatFull chatFull;
if (this.bottomOverlayChatText == null || this.inScheduleMode) {
return;
}
TLRPC.Chat chat = this.currentChat;
if (chat != null) {
if (ChatObject.isChannel(chat)) {
TLRPC.Chat chat2 = this.currentChat;
if (!(chat2 instanceof TLRPC.TL_channelForbidden)) {
if (ChatObject.isNotInChat(chat2)) {
if (getMessagesController().isJoiningChannel(this.currentChat.id)) {
showBottomOverlayProgress(true, false);
} else {
this.bottomOverlayChatText.setText(LocaleController.getString("ChannelJoin", R.string.ChannelJoin));
showBottomOverlayProgress(false, false);
}
} else {
if (!getMessagesController().isDialogMuted(this.dialog_id)) {
this.bottomOverlayChatText.setText(LocaleController.getString("ChannelMute", R.string.ChannelMute));
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null && chatActivityEnterView.isPopupShowing()) {
this.chatActivityEnterView.hidePopup(false);
}
} else {
this.bottomOverlayChatText.setText(LocaleController.getString("ChannelUnmute", R.string.ChannelUnmute));
}
showBottomOverlayProgress(false, this.bottomOverlayProgress.getTag() != null);
}
if (!ChatObject.isNotInChat(this.currentChat) && !this.currentChat.megagroup && (this.currentChat.has_link || ((chatFull = this.chatInfo) != null && chatFull.linked_chat_id != 0))) {
this.bottomOverlayChatText2.setText(LocaleController.getString("ChannelDiscuss", R.string.ChannelDiscuss));
this.bottomOverlayChatText2.setVisibility(0);
this.bottomOverlayChatText2.updateCounter();
} else {
this.bottomOverlayChatText2.setVisibility(8);
}
}
}
TextView textView = this.bottomOverlayChatText;
if (textView != null) {
textView.setText(LocaleController.getString("DeleteThisGroup", R.string.DeleteThisGroup));
}
if (!isFinishing() && getParentActivity() != null && this.parentLayout != null && !this.parentLayout.fragmentsStack.isEmpty() && this.parentLayout.fragmentsStack.get(this.parentLayout.fragmentsStack.size() - 1) == this) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("DeleteThisGroup", R.string.DeleteThisGroup));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
AlertDialog create = builder.create();
this.closeChatDialog = create;
showDialog(create);
}
} else {
showBottomOverlayProgress(false, false);
if (this.userBlocked) {
if (this.currentUser.bot) {
this.bottomOverlayChatText.setText(LocaleController.getString("BotUnblock", R.string.BotUnblock));
} else {
this.bottomOverlayChatText.setText(LocaleController.getString("Unblock", R.string.Unblock));
}
if (this.botButtons != null) {
this.botButtons = null;
if (this.chatActivityEnterView != null) {
MessageObject messageObject = this.replyingMessageObject;
if (messageObject != null && this.botReplyButtons == messageObject) {
this.botReplyButtons = null;
hideFieldPanel(false);
}
this.chatActivityEnterView.setButtons(this.botButtons, false);
}
}
} else if (this.botUser != null && this.currentUser.bot) {
this.bottomOverlayChatText.setText(LocaleController.getString("BotStart", R.string.BotStart));
this.chatActivityEnterView.hidePopup(false);
if (getParentActivity() != null) {
AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus());
}
} else {
this.bottomOverlayChatText.setText(LocaleController.getString("DeleteThisChat", R.string.DeleteThisChat));
}
}
if (this.inPreviewMode) {
this.searchContainer.setVisibility(4);
this.bottomOverlayChat.setVisibility(4);
this.chatActivityEnterView.setFieldFocused(false);
this.chatActivityEnterView.setVisibility(4);
} else {
ActionBarMenuItem actionBarMenuItem = this.searchItem;
if (actionBarMenuItem != null && actionBarMenuItem.getVisibility() == 0) {
this.searchContainer.setVisibility(0);
this.bottomOverlayChat.setVisibility(4);
this.chatActivityEnterView.setFieldFocused(false);
this.chatActivityEnterView.setVisibility(4);
if (this.chatActivityEnterView.isTopViewVisible()) {
this.topViewWasVisible = 1;
this.chatActivityEnterView.hideTopView(false);
} else {
this.topViewWasVisible = 2;
}
} else {
this.searchContainer.setVisibility(4);
if (this.muteItem != null) {
TLRPC.Chat chat3 = this.currentChat;
if (chat3 != null && ChatObject.isNotInChat(chat3)) {
this.muteItem.setVisibility(8);
} else {
this.muteItem.setVisibility(0);
}
}
TLRPC.Chat chat4 = this.currentChat;
if ((chat4 != null && (ChatObject.isNotInChat(chat4) || !ChatObject.canWriteToChat(this.currentChat))) || ((user = this.currentUser) != null && (UserObject.isDeleted(user) || this.userBlocked))) {
if (this.chatActivityEnterView.isEditingMessage()) {
this.chatActivityEnterView.setVisibility(0);
this.bottomOverlayChat.setVisibility(4);
this.chatActivityEnterView.setFieldFocused();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$updateBottomOverlay$74$ChatActivity();
}
}, 100L);
} else {
this.bottomOverlayChat.setVisibility(0);
this.chatActivityEnterView.setFieldFocused(false);
this.chatActivityEnterView.setVisibility(4);
this.chatActivityEnterView.closeKeyboard();
StickersAdapter stickersAdapter = this.stickersAdapter;
if (stickersAdapter != null) {
stickersAdapter.hide();
}
}
ActionBarMenuItem actionBarMenuItem2 = this.attachItem;
if (actionBarMenuItem2 != null) {
actionBarMenuItem2.setVisibility(8);
}
ActionBarMenuItem actionBarMenuItem3 = this.editTextItem;
if (actionBarMenuItem3 != null) {
actionBarMenuItem3.setVisibility(8);
}
ActionBarMenuItem actionBarMenuItem4 = this.headerItem;
if (actionBarMenuItem4 != null) {
actionBarMenuItem4.setVisibility(0);
}
} else if (this.botUser != null && this.currentUser.bot) {
this.bottomOverlayChat.setVisibility(0);
this.chatActivityEnterView.setVisibility(4);
} else {
if (this.currentUser != null && isSysNotifyMessage().booleanValue()) {
this.chatActivityEnterView.setVisibility(8);
} else {
this.chatActivityEnterView.setVisibility(0);
}
this.bottomOverlayChat.setVisibility(4);
}
if (this.topViewWasVisible == 1) {
this.chatActivityEnterView.showTopView(false, false);
this.topViewWasVisible = 0;
}
}
}
checkRaiseSensors();
}
public void lambda$updateBottomOverlay$74$ChatActivity() {
this.chatActivityEnterView.openKeyboard();
}
public void showAlert(String str, String str2) {
FrameLayout frameLayout = this.alertView;
if (frameLayout == null || str == null || str2 == null) {
return;
}
if (frameLayout.getTag() != null) {
this.alertView.setTag(null);
AnimatorSet animatorSet = this.alertViewAnimator;
if (animatorSet != null) {
animatorSet.cancel();
this.alertViewAnimator = null;
}
this.alertView.setVisibility(0);
AnimatorSet animatorSet2 = new AnimatorSet();
this.alertViewAnimator = animatorSet2;
animatorSet2.playTogether(ObjectAnimator.ofFloat(this.alertView, View.TRANSLATION_Y, 0.0f));
this.alertViewAnimator.setDuration(200L);
this.alertViewAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.alertViewAnimator == null || !ChatActivity.this.alertViewAnimator.equals(animator)) {
return;
}
ChatActivity.this.alertViewAnimator = null;
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.alertViewAnimator == null || !ChatActivity.this.alertViewAnimator.equals(animator)) {
return;
}
ChatActivity.this.alertViewAnimator = null;
}
});
this.alertViewAnimator.start();
}
this.alertNameTextView.setText(str);
this.alertTextView.setText(Emoji.replaceEmoji(str2.replace('\n', ' '), this.alertTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14.0f), false));
Runnable runnable = this.hideAlertViewRunnable;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
}
Runnable runnable2 = new Runnable() {
@Override
public void run() {
if (ChatActivity.this.hideAlertViewRunnable == this && ChatActivity.this.alertView.getTag() == null) {
ChatActivity.this.alertView.setTag(1);
if (ChatActivity.this.alertViewAnimator != null) {
ChatActivity.this.alertViewAnimator.cancel();
ChatActivity.this.alertViewAnimator = null;
}
ChatActivity.this.alertViewAnimator = new AnimatorSet();
ChatActivity.this.alertViewAnimator.playTogether(ObjectAnimator.ofFloat(ChatActivity.this.alertView, View.TRANSLATION_Y, -AndroidUtilities.dp(50.0f)));
ChatActivity.this.alertViewAnimator.setDuration(200L);
ChatActivity.this.alertViewAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.alertViewAnimator == null || !ChatActivity.this.alertViewAnimator.equals(animator)) {
return;
}
ChatActivity.this.alertView.setVisibility(8);
ChatActivity.this.alertViewAnimator = null;
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.alertViewAnimator == null || !ChatActivity.this.alertViewAnimator.equals(animator)) {
return;
}
ChatActivity.this.alertViewAnimator = null;
}
});
ChatActivity.this.alertViewAnimator.start();
}
}
};
this.hideAlertViewRunnable = runnable2;
AndroidUtilities.runOnUIThread(runnable2, 3000L);
}
private void hidePinnedMessageView(boolean z) {
if (this.pinnedMessageView.getTag() == null) {
this.pinnedMessageView.setTag(1);
AnimatorSet animatorSet = this.pinnedMessageViewAnimator;
if (animatorSet != null) {
animatorSet.cancel();
this.pinnedMessageViewAnimator = null;
}
if (z) {
AnimatorSet animatorSet2 = new AnimatorSet();
this.pinnedMessageViewAnimator = animatorSet2;
animatorSet2.playTogether(ObjectAnimator.ofFloat(this.pinnedMessageView, View.TRANSLATION_Y, -AndroidUtilities.dp(50.0f)));
this.pinnedMessageViewAnimator.setDuration(200L);
this.pinnedMessageViewAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.pinnedMessageViewAnimator == null || !ChatActivity.this.pinnedMessageViewAnimator.equals(animator)) {
return;
}
ChatActivity.this.pinnedMessageView.setVisibility(8);
if (ChatActivity.this.pinnedLiveMessage != null) {
ChatActivity.this.pinnedLiveMessageView.setTranslationY(0.0f);
ChatActivity.this.pinnedLiveUserImageView.setTranslationY(0.0f);
}
ChatActivity.this.pinnedMessageViewAnimator = null;
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.pinnedMessageViewAnimator == null || !ChatActivity.this.pinnedMessageViewAnimator.equals(animator)) {
return;
}
ChatActivity.this.pinnedMessageViewAnimator = null;
}
});
this.pinnedMessageViewAnimator.start();
return;
}
this.pinnedMessageView.setTranslationY(-AndroidUtilities.dp(50.0f));
this.pinnedMessageView.setVisibility(8);
if (this.pinnedLiveMessage != null) {
this.pinnedLiveMessageView.setTranslationY(0.0f);
this.pinnedLiveUserImageView.setTranslationY(0.0f);
}
}
}
private void hidePinnedLiveMessageView(boolean z) {
this.pinnedLiveMessage = null;
if (this.pinnedLiveMessageView.getTag() == null) {
this.pinnedLiveMessageView.setTag(2);
AnimatorSet animatorSet = this.pinnedMessageViewAnimator;
if (animatorSet != null) {
animatorSet.cancel();
this.pinnedMessageViewAnimator = null;
}
if (z) {
AnimatorSet animatorSet2 = new AnimatorSet();
this.pinnedMessageViewAnimator = animatorSet2;
animatorSet2.playTogether(ObjectAnimator.ofFloat(this.pinnedLiveMessageView, View.TRANSLATION_Y, -AndroidUtilities.dp(50.0f)));
this.pinnedMessageViewAnimator.setDuration(200L);
this.pinnedMessageViewAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.pinnedMessageViewAnimator == null || !ChatActivity.this.pinnedMessageViewAnimator.equals(animator)) {
return;
}
ChatActivity.this.pinnedLiveMessageView.setVisibility(8);
ChatActivity.this.pinnedMessageViewAnimator = null;
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.pinnedMessageViewAnimator == null || !ChatActivity.this.pinnedMessageViewAnimator.equals(animator)) {
return;
}
ChatActivity.this.pinnedMessageViewAnimator = null;
}
});
this.pinnedMessageViewAnimator.start();
return;
}
this.pinnedLiveMessageView.setTranslationY(-AndroidUtilities.dp(50.0f));
this.pinnedLiveMessageView.setVisibility(8);
}
}
public void updatePinnedMessageView(boolean z) {
int i;
int i2;
SharedPreferences notificationsSettings;
int i3;
int i4;
int i5;
int i6;
if (this.pinnedMessageView == null || this.inScheduleMode) {
return;
}
TLRPC.ChatFull chatFull = this.chatInfo;
if (chatFull != null) {
if (this.pinnedMessageObject != null && chatFull.pinned_msg_id != this.pinnedMessageObject.getId()) {
this.pinnedMessageObject = null;
}
if (this.chatInfo.pinned_msg_id != 0 && this.pinnedMessageObject == null) {
this.pinnedMessageObject = this.messagesDict[0].get(this.chatInfo.pinned_msg_id);
}
i2 = this.chatInfo.pinned_msg_id;
} else {
TLRPC.UserFull userFull = this.userInfo;
if (userFull != null) {
if (this.pinnedMessageObject != null && userFull.pinned_msg_id != this.pinnedMessageObject.getId()) {
this.pinnedMessageObject = null;
}
if (this.userInfo.pinned_msg_id != 0 && this.pinnedMessageObject == null) {
this.pinnedMessageObject = this.messagesDict[0].get(this.userInfo.pinned_msg_id);
}
i2 = this.userInfo.pinned_msg_id;
} else {
i = 0;
notificationsSettings = MessagesController.getNotificationsSettings(this.currentAccount);
if ((this.chatInfo == null || this.userInfo != null) && i != 0) {
if (i != notificationsSettings.getInt("pin_" + this.dialog_id, 0) && (this.actionBar == null || (!this.actionBar.isActionModeShowed() && !this.actionBar.isSearchFieldVisible()))) {
if (this.pinnedMessageObject == null) {
if (this.pinnedMessageView.getTag() != null) {
this.pinnedMessageView.setTag(null);
AnimatorSet animatorSet = this.pinnedMessageViewAnimator;
if (animatorSet != null) {
animatorSet.cancel();
this.pinnedMessageViewAnimator = null;
}
if (z) {
this.pinnedMessageView.setVisibility(0);
AnimatorSet animatorSet2 = new AnimatorSet();
this.pinnedMessageViewAnimator = animatorSet2;
animatorSet2.playTogether(ObjectAnimator.ofFloat(this.pinnedMessageView, View.TRANSLATION_Y, 0.0f));
this.pinnedMessageViewAnimator.setDuration(200L);
this.pinnedMessageViewAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.pinnedMessageViewAnimator == null || !ChatActivity.this.pinnedMessageViewAnimator.equals(animator)) {
return;
}
ChatActivity.this.pinnedMessageViewAnimator = null;
if (ChatActivity.this.pinnedLiveMessage == null || ChatActivity.this.pinnedLiveMessageView.getTranslationY() == AndroidUtilities.dp(48.0f)) {
return;
}
ChatActivity.this.pinnedLiveMessageView.setTranslationY(AndroidUtilities.dp(48.0f));
ChatActivity.this.pinnedLiveUserImageView.setTranslationY(AndroidUtilities.dp(48.0f));
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.pinnedMessageViewAnimator == null || !ChatActivity.this.pinnedMessageViewAnimator.equals(animator)) {
return;
}
ChatActivity.this.pinnedMessageViewAnimator = null;
}
});
this.pinnedMessageViewAnimator.start();
} else {
this.pinnedMessageView.setTranslationY(0.0f);
this.pinnedMessageView.setVisibility(0);
if (this.pinnedLiveMessage != null && this.pinnedLiveMessageView.getTranslationY() != AndroidUtilities.dp(48.0f)) {
this.pinnedLiveMessageView.setTranslationY(AndroidUtilities.dp(48.0f));
this.pinnedLiveUserImageView.setTranslationY(AndroidUtilities.dp(48.0f));
}
}
}
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.pinnedMessageNameTextView.getLayoutParams();
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) this.pinnedMessageTextView.getLayoutParams();
TLRPC.PhotoSize closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(this.pinnedMessageObject.photoThumbs2, AndroidUtilities.dp(320.0f));
TLRPC.PhotoSize closestPhotoSizeWithSize2 = FileLoader.getClosestPhotoSizeWithSize(this.pinnedMessageObject.photoThumbs2, AndroidUtilities.dp(40.0f));
TLObject tLObject = this.pinnedMessageObject.photoThumbsObject2;
if (closestPhotoSizeWithSize == null) {
if (this.pinnedMessageObject.mediaExists) {
closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(this.pinnedMessageObject.photoThumbs, AndroidUtilities.getPhotoSize());
i5 = closestPhotoSizeWithSize != null ? closestPhotoSizeWithSize.size : 0;
i6 = 0;
} else {
closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(this.pinnedMessageObject.photoThumbs, AndroidUtilities.dp(320.0f));
i5 = 0;
i6 = 1;
}
TLRPC.PhotoSize closestPhotoSizeWithSize3 = FileLoader.getClosestPhotoSizeWithSize(this.pinnedMessageObject.photoThumbs, AndroidUtilities.dp(40.0f));
tLObject = this.pinnedMessageObject.photoThumbsObject;
i3 = i5;
i4 = i6;
closestPhotoSizeWithSize2 = closestPhotoSizeWithSize3;
} else {
i3 = 0;
i4 = 1;
}
if (closestPhotoSizeWithSize == closestPhotoSizeWithSize2) {
closestPhotoSizeWithSize2 = null;
}
if (closestPhotoSizeWithSize == null || (closestPhotoSizeWithSize instanceof TLRPC.TL_photoSizeEmpty) || (closestPhotoSizeWithSize.location instanceof TLRPC.TL_fileLocationUnavailable) || this.pinnedMessageObject.isAnyKindOfSticker()) {
this.pinnedMessageImageView.setImageBitmap(null);
this.pinnedImageLocation = null;
this.pinnedImageLocationObject = null;
this.pinnedMessageImageView.setVisibility(4);
int dp = AndroidUtilities.dp(18.0f);
layoutParams2.leftMargin = dp;
layoutParams.leftMargin = dp;
} else {
if (this.pinnedMessageObject.isRoundVideo()) {
this.pinnedMessageImageView.setRoundRadius(AndroidUtilities.dp(16.0f));
} else {
this.pinnedMessageImageView.setRoundRadius(0);
}
this.pinnedImageSize = i3;
this.pinnedImageCacheType = i4;
this.pinnedImageLocation = closestPhotoSizeWithSize;
this.pinnedImageThumbLocation = closestPhotoSizeWithSize2;
this.pinnedImageLocationObject = tLObject;
this.pinnedMessageImageView.setImage(ImageLocation.getForObject(closestPhotoSizeWithSize, tLObject), "50_50", ImageLocation.getForObject(closestPhotoSizeWithSize2, tLObject), "50_50_b", null, i3, i4, this.pinnedMessageObject);
this.pinnedMessageImageView.setVisibility(0);
int dp2 = AndroidUtilities.dp(55.0f);
layoutParams2.leftMargin = dp2;
layoutParams.leftMargin = dp2;
}
this.pinnedMessageNameTextView.setLayoutParams(layoutParams);
this.pinnedMessageTextView.setLayoutParams(layoutParams2);
if (this.pinnedMessageObject.type == 17) {
this.pinnedMessageNameTextView.setText(LocaleController.getString("PinnedPoll", R.string.PinnedPoll));
} else {
this.pinnedMessageNameTextView.setText(LocaleController.getString("PinnedMessage", R.string.PinnedMessage));
}
if (this.pinnedMessageObject.type == 14) {
this.pinnedMessageTextView.setText(String.format("%s - %s", this.pinnedMessageObject.getMusicAuthor(), this.pinnedMessageObject.getMusicTitle()));
} else if (this.pinnedMessageObject.type == 207) {
this.pinnedLineView.setVisibility(8);
TLRPC.TL_dataJSON tL_dataJSON = ((TLRPC.TL_messageMediaShare) this.pinnedMessageObject.messageOwner.media).data;
} else if (this.pinnedMessageObject.type == 17) {
String str = ((TLRPC.TL_messageMediaPoll) this.pinnedMessageObject.messageOwner.media).poll.question;
if (str.length() > 150) {
str = str.substring(0, 150);
}
this.pinnedMessageTextView.setText(str.replace('\n', ' '));
} else if (this.pinnedMessageObject.messageOwner.media instanceof TLRPC.TL_messageMediaGame) {
this.pinnedMessageTextView.setText(Emoji.replaceEmoji(this.pinnedMessageObject.messageOwner.media.game.title, this.pinnedMessageTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14.0f), false));
} else if (!TextUtils.isEmpty(this.pinnedMessageObject.caption)) {
String charSequence = this.pinnedMessageObject.caption.toString();
if (charSequence.length() > 150) {
charSequence = charSequence.substring(0, 150);
}
String replace = charSequence.replace('\n', ' ');
SimpleTextView simpleTextView = this.pinnedMessageTextView;
simpleTextView.setText(Emoji.replaceEmoji(replace, simpleTextView.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14.0f), false));
} else if (this.pinnedMessageObject.messageText != null) {
String charSequence2 = this.pinnedMessageObject.messageText.toString();
if (charSequence2.length() > 150) {
charSequence2 = charSequence2.substring(0, 150);
}
String replace2 = charSequence2.replace('\n', ' ');
SimpleTextView simpleTextView2 = this.pinnedMessageTextView;
simpleTextView2.setText(Emoji.replaceEmoji(replace2, simpleTextView2.getPaint().getFontMetricsInt(), AndroidUtilities.dp(14.0f), false));
}
} else {
this.pinnedImageLocation = null;
this.pinnedImageLocationObject = null;
hidePinnedMessageView(z);
if (this.loadingPinnedMessage != i) {
this.loadingPinnedMessage = i;
getMediaDataController().loadPinnedMessage(this.dialog_id, ChatObject.isChannel(this.currentChat) ? this.currentChat.id : 0, i, true);
}
}
checkListViewPaddings();
}
}
hidePinnedMessageView(z);
checkListViewPaddings();
}
}
i = i2;
notificationsSettings = MessagesController.getNotificationsSettings(this.currentAccount);
if (this.chatInfo == null) {
}
if (i != notificationsSettings.getInt("pin_" + this.dialog_id, 0)) {
if (this.pinnedMessageObject == null) {
}
checkListViewPaddings();
}
hidePinnedMessageView(z);
checkListViewPaddings();
}
private void updatePinnedLiveMessageView(boolean z, int i, boolean z2) {
if (this.pinnedLiveMessageView == null || this.inScheduleMode) {
return;
}
if (this.pinnedLiveMessage == null) {
this.pinnedLiveMessage = this.messagesDict[0].get(i);
}
if (!z2) {
hidePinnedLiveMessageView(z);
} else if (this.pinnedLiveMessage != null) {
if (this.pinnedLiveMessageView.getTag() != null) {
this.pinnedLiveMessageView.setTag(null);
AnimatorSet animatorSet = this.pinnedMessageViewAnimator;
if (animatorSet != null) {
animatorSet.cancel();
this.pinnedMessageViewAnimator = null;
}
if (z) {
this.pinnedLiveMessageView.setVisibility(0);
AnimatorSet animatorSet2 = new AnimatorSet();
this.pinnedMessageViewAnimator = animatorSet2;
animatorSet2.playTogether(ObjectAnimator.ofFloat(this.pinnedLiveMessageView, View.TRANSLATION_Y, 48.0f));
this.pinnedMessageViewAnimator.setDuration(200L);
this.pinnedMessageViewAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.pinnedMessageViewAnimator == null || !ChatActivity.this.pinnedMessageViewAnimator.equals(animator)) {
return;
}
ChatActivity.this.pinnedMessageViewAnimator = null;
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.pinnedMessageViewAnimator == null || !ChatActivity.this.pinnedMessageViewAnimator.equals(animator)) {
return;
}
ChatActivity.this.pinnedMessageViewAnimator = null;
}
});
this.pinnedMessageViewAnimator.start();
} else {
SharedPreferences notificationsSettings = MessagesController.getNotificationsSettings(this.currentAccount);
if (this.pinnedMessageObject != null) {
if (notificationsSettings.getInt("pin_" + this.dialog_id, 0) != this.pinnedMessageObject.messageOwner.id) {
this.pinnedLiveMessageView.setTranslationY(AndroidUtilities.dp(48.0f));
this.pinnedLiveMessageView.setVisibility(0);
}
}
this.pinnedLiveMessageView.setTranslationY(AndroidUtilities.dp(0.0f));
this.pinnedLiveMessageView.setVisibility(0);
}
}
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.pinnedLiveMessageNameTextView.getLayoutParams();
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) this.pinnedLiveMessageTextView.getLayoutParams();
int dp = AndroidUtilities.dp(55.0f);
layoutParams2.leftMargin = dp;
layoutParams.leftMargin = dp;
this.pinnedLiveMessageNameTextView.setLayoutParams(layoutParams);
this.pinnedLiveMessageTextView.setLayoutParams(layoutParams2);
if (this.pinnedLiveMessage.type == 207) {
TLRPC.TL_dataJSON tL_dataJSON = ((TLRPC.TL_messageMediaShare) this.pinnedLiveMessage.messageOwner.media).data;
}
} else {
hidePinnedLiveMessageView(z);
}
checkListViewPaddings();
}
private void updateTopPanel(boolean z) {
boolean z2;
if (this.topChatPanelView == null || this.inScheduleMode) {
return;
}
SharedPreferences notificationsSettings = MessagesController.getNotificationsSettings(this.currentAccount);
long j = this.dialog_id;
TLRPC.EncryptedChat encryptedChat = this.currentEncryptedChat;
if (encryptedChat != null) {
boolean z3 = (encryptedChat.admin_id == getUserConfig().getClientUserId() || getContactsController().isLoadingContacts() || getContactsController().contactsDict.get(Integer.valueOf(this.currentUser.id)) != null) ? false : true;
long j2 = this.currentUser.id;
int i = notificationsSettings.getInt("dialog_bar_vis3" + j2, 0);
if (z3 && (i == 1 || i == 3)) {
z3 = false;
}
z2 = z3;
j = j2;
} else {
StringBuilder sb = new StringBuilder();
sb.append("dialog_bar_vis3");
sb.append(j);
z2 = notificationsSettings.getInt(sb.toString(), 0) == 2;
}
boolean z4 = notificationsSettings.getBoolean("dialog_bar_share" + j, false);
boolean z5 = notificationsSettings.getBoolean("dialog_bar_report" + j, false);
boolean z6 = notificationsSettings.getBoolean("dialog_bar_block" + j, false);
boolean z7 = notificationsSettings.getBoolean("dialog_bar_add" + j, false);
boolean z8 = notificationsSettings.getBoolean("dialog_bar_location" + j, false);
if (z5 || z6 || z8) {
this.reportSpamButton.setVisibility(0);
} else {
this.reportSpamButton.setVisibility(8);
}
TLRPC.User user = this.currentUser != null ? getMessagesController().getUser(Integer.valueOf(this.currentUser.id)) : null;
if (user != null) {
if (!user.contact && z7) {
this.addContactItem.setVisibility(0);
this.addToContactsButton.setVisibility(0);
this.addContactItem.setText(LocaleController.getString("AddToContacts", R.string.AddToContacts));
if (this.reportSpamButton.getVisibility() == 0) {
this.addToContactsButton.setText(LocaleController.getString("AddContactChat", R.string.AddContactChat));
} else {
this.addToContactsButton.setText(LocaleController.formatString("AddContactFullChat", R.string.AddContactFullChat, UserObject.getFirstName(user)).toUpperCase());
}
this.addToContactsButton.setTag(null);
this.addToContactsButton.setVisibility(0);
} else if (z4) {
this.addContactItem.setVisibility(0);
this.addToContactsButton.setVisibility(0);
this.addContactItem.setText(LocaleController.getString("ShareMyContactInfo", R.string.ShareMyContactInfo));
this.addToContactsButton.setText(LocaleController.getString("ShareMyPhone", R.string.ShareMyPhone).toUpperCase());
this.addToContactsButton.setTag(1);
this.addToContactsButton.setVisibility(0);
} else {
if (!user.contact && !z2) {
this.addContactItem.setVisibility(0);
this.addContactItem.setText(LocaleController.getString("ShareMyContactInfo", R.string.ShareMyContactInfo));
this.addToContactsButton.setTag(2);
} else {
this.addContactItem.setVisibility(8);
}
this.addToContactsButton.setVisibility(8);
}
this.reportSpamButton.setText(LocaleController.getString("ReportSpamUser", R.string.ReportSpamUser));
} else {
if (z8) {
this.reportSpamButton.setText(LocaleController.getString("ReportSpamLocation", R.string.ReportSpamLocation));
this.reportSpamButton.setTag(R.id.object_tag, 1);
this.reportSpamButton.setTextColor(Theme.getColor(Theme.key_chat_addContact));
this.reportSpamButton.setTag(Theme.key_chat_addContact);
} else {
this.reportSpamButton.setText(LocaleController.getString("ReportSpamAndLeave", R.string.ReportSpamAndLeave));
this.reportSpamButton.setTag(R.id.object_tag, null);
this.reportSpamButton.setTextColor(Theme.getColor(Theme.key_chat_reportSpam));
this.reportSpamButton.setTag(Theme.key_chat_reportSpam);
}
ChatActionBarMenuSubItem chatActionBarMenuSubItem = this.addContactItem;
if (chatActionBarMenuSubItem != null) {
chatActionBarMenuSubItem.setVisibility(8);
}
this.addToContactsButton.setVisibility(8);
}
if (this.userBlocked || (this.addToContactsButton.getVisibility() == 8 && this.reportSpamButton.getVisibility() == 8)) {
z2 = false;
}
if (z2) {
if (this.topChatPanelView.getTag() != null) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("show spam button");
}
this.topChatPanelView.setTag(null);
this.topChatPanelView.setVisibility(0);
AnimatorSet animatorSet = this.reportSpamViewAnimator;
if (animatorSet != null) {
animatorSet.cancel();
this.reportSpamViewAnimator = null;
}
if (z) {
AnimatorSet animatorSet2 = new AnimatorSet();
this.reportSpamViewAnimator = animatorSet2;
animatorSet2.playTogether(ObjectAnimator.ofFloat(this.topChatPanelView, View.TRANSLATION_Y, 0.0f));
this.reportSpamViewAnimator.setDuration(200L);
this.reportSpamViewAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.reportSpamViewAnimator == null || !ChatActivity.this.reportSpamViewAnimator.equals(animator)) {
return;
}
ChatActivity.this.reportSpamViewAnimator = null;
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.reportSpamViewAnimator == null || !ChatActivity.this.reportSpamViewAnimator.equals(animator)) {
return;
}
ChatActivity.this.reportSpamViewAnimator = null;
}
});
this.reportSpamViewAnimator.start();
} else {
this.topChatPanelView.setTranslationY(0.0f);
}
}
} else if (this.topChatPanelView.getTag() == null) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("hide spam button");
}
this.topChatPanelView.setTag(1);
AnimatorSet animatorSet3 = this.reportSpamViewAnimator;
if (animatorSet3 != null) {
animatorSet3.cancel();
this.reportSpamViewAnimator = null;
}
if (z) {
AnimatorSet animatorSet4 = new AnimatorSet();
this.reportSpamViewAnimator = animatorSet4;
animatorSet4.playTogether(ObjectAnimator.ofFloat(this.topChatPanelView, View.TRANSLATION_Y, -AndroidUtilities.dp(50.0f)));
this.reportSpamViewAnimator.setDuration(200L);
this.reportSpamViewAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
if (ChatActivity.this.reportSpamViewAnimator == null || !ChatActivity.this.reportSpamViewAnimator.equals(animator)) {
return;
}
ChatActivity.this.topChatPanelView.setVisibility(8);
ChatActivity.this.reportSpamViewAnimator = null;
}
@Override
public void onAnimationCancel(Animator animator) {
if (ChatActivity.this.reportSpamViewAnimator == null || !ChatActivity.this.reportSpamViewAnimator.equals(animator)) {
return;
}
ChatActivity.this.reportSpamViewAnimator = null;
}
});
this.reportSpamViewAnimator.start();
} else {
this.topChatPanelView.setTranslationY(-AndroidUtilities.dp(50.0f));
}
}
checkListViewPaddings();
}
public void checkListViewPaddingsInternal() {
int i;
int i2;
View findViewByPosition;
int indexOf;
GridLayoutManagerFixed gridLayoutManagerFixed = this.chatLayoutManager;
if (gridLayoutManagerFixed == null) {
return;
}
try {
int findFirstVisibleItemPosition = gridLayoutManagerFixed.findFirstVisibleItemPosition();
if (this.wasManualScroll || this.unreadMessageObject == null || (indexOf = this.messages.indexOf(this.unreadMessageObject)) < 0) {
i = -1;
} else {
i = indexOf + this.chatAdapter.messagesStartRow;
findFirstVisibleItemPosition = -1;
}
if (findFirstVisibleItemPosition != -1 && (findViewByPosition = this.chatLayoutManager.findViewByPosition(findFirstVisibleItemPosition)) != null) {
i2 = (this.chatListView.getMeasuredHeight() - findViewByPosition.getBottom()) - this.chatListView.getPaddingBottom();
if (this.chatListView.getPaddingTop() == AndroidUtilities.dp(52.0f) && ((this.pinnedMessageView != null && this.pinnedMessageView.getTag() == null) || (this.topChatPanelView != null && this.topChatPanelView.getTag() == null))) {
this.chatListView.setPadding(0, AndroidUtilities.dp(52.0f), 0, AndroidUtilities.dp(3.0f));
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.floatingDateView.getLayoutParams();
layoutParams.topMargin = AndroidUtilities.dp(52.0f);
this.floatingDateView.setLayoutParams(layoutParams);
this.chatListView.setTopGlowOffset(AndroidUtilities.dp(48.0f));
} else if (this.chatListView.getPaddingTop() != AndroidUtilities.dp(4.0f) || ((this.pinnedMessageView != null && this.pinnedMessageView.getTag() == null) || (this.topChatPanelView != null && this.topChatPanelView.getTag() == null))) {
findFirstVisibleItemPosition = -1;
} else {
this.chatListView.setPadding(0, AndroidUtilities.dp(4.0f), 0, AndroidUtilities.dp(3.0f));
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) this.floatingDateView.getLayoutParams();
layoutParams2.topMargin = AndroidUtilities.dp(4.0f);
this.floatingDateView.setLayoutParams(layoutParams2);
this.chatListView.setTopGlowOffset(0);
}
if (findFirstVisibleItemPosition == -1) {
this.chatLayoutManager.scrollToPositionWithOffset(findFirstVisibleItemPosition, i2);
return;
} else if (i != -1) {
this.chatLayoutManager.scrollToPositionWithOffset(i, ((this.chatListView.getMeasuredHeight() - this.chatListView.getPaddingBottom()) - this.chatListView.getPaddingTop()) - AndroidUtilities.dp(29.0f));
return;
} else {
return;
}
}
i2 = 0;
if (this.chatListView.getPaddingTop() == AndroidUtilities.dp(52.0f)) {
}
if (this.chatListView.getPaddingTop() != AndroidUtilities.dp(4.0f)) {
}
findFirstVisibleItemPosition = -1;
if (findFirstVisibleItemPosition == -1) {
}
} catch (Exception e) {
FileLog.e(e);
}
}
private void checkListViewPaddings() {
MessageObject messageObject;
if (!this.wasManualScroll && (messageObject = this.unreadMessageObject) != null) {
if (this.messages.indexOf(messageObject) >= 0) {
this.fixPaddingsInLayout = true;
if (this.fragmentView != null) {
this.fragmentView.requestLayout();
return;
}
return;
}
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.checkListViewPaddingsInternal();
}
});
}
public void checkRaiseSensors() {
FrameLayout frameLayout;
FrameLayout frameLayout2;
FrameLayout frameLayout3;
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null && chatActivityEnterView.isStickersExpanded()) {
MediaController.getInstance().setAllowStartRecord(false);
return;
}
TLRPC.Chat chat = this.currentChat;
if (chat != null && !ChatObject.canSendMedia(chat)) {
MediaController.getInstance().setAllowStartRecord(false);
} else if (!ApplicationLoader.mainInterfacePaused && (((frameLayout = this.bottomOverlayChat) == null || frameLayout.getVisibility() != 0) && (((frameLayout2 = this.bottomOverlay) == null || frameLayout2.getVisibility() != 0) && ((frameLayout3 = this.searchContainer) == null || frameLayout3.getVisibility() != 0)))) {
MediaController.getInstance().setAllowStartRecord(true);
} else {
MediaController.getInstance().setAllowStartRecord(false);
}
}
@Override
public void dismissCurrentDialog() {
if (this.chatAttachAlert != null) {
Dialog dialog = this.visibleDialog;
ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
if (dialog == chatAttachAlert) {
chatAttachAlert.closeCamera(false);
this.chatAttachAlert.dismissInternal();
this.chatAttachAlert.hideCamera(true);
return;
}
}
super.dismissCurrentDialog();
}
@Override
public void setInPreviewMode(boolean z) {
super.setInPreviewMode(z);
ChatActionBarHelper chatActionBarHelper = this.actionBarHelper;
if (chatActionBarHelper != null) {
chatActionBarHelper.setInPreviewMode(z);
}
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null) {
chatActivityEnterView.setVisibility(!z ? 0 : 4);
}
if (this.actionBar != null) {
this.actionBar.setBackButtonImage(!z ? R.mipmap.ic_back : 0);
this.headerItem.setAlpha(!z ? 1.0f : 0.0f);
this.attachItem.setAlpha(z ? 0.0f : 1.0f);
}
RecyclerListView recyclerListView = this.chatListView;
if (recyclerListView != null) {
int childCount = recyclerListView.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = this.chatListView.getChildAt(i);
MessageObject messageObject = null;
boolean z2 = childAt instanceof ChatMessageCell;
if (z2) {
messageObject = ((ChatMessageCell) childAt).getMessageObject();
} else if (childAt instanceof ChatActionCell) {
messageObject = ((ChatActionCell) childAt).getMessageObject();
}
if (messageObject != null && messageObject.messageOwner != null && messageObject.messageOwner.media_unread && messageObject.messageOwner.mentioned) {
if (!messageObject.isVoice() && !messageObject.isRoundVideo()) {
int i2 = this.newMentionsCount - 1;
this.newMentionsCount = i2;
if (i2 <= 0) {
this.newMentionsCount = 0;
this.hasAllMentionsLocal = true;
showMentionDownButton(false, true);
} else {
this.mentiondownButtonCounter.setText(String.format("%d", Integer.valueOf(i2)));
}
getMessagesController().markMentionMessageAsRead(messageObject.getId(), ChatObject.isChannel(this.currentChat) ? this.currentChat.id : 0, this.dialog_id);
messageObject.setContentIsRead();
}
if (z2) {
ChatMessageCell chatMessageCell = (ChatMessageCell) childAt;
chatMessageCell.setHighlighted(false);
chatMessageCell.setHighlightedAnimated();
}
}
}
}
updateBottomOverlay();
updateSecretStatus();
}
@Override
public void onResume() {
ChatActivityEnterView chatActivityEnterView;
MessageObject messageObject;
boolean z;
BackupImageView backupImageView;
BackupImageView backupImageView2;
super.onResume();
AndroidUtilities.requestAdjustResize(getParentActivity(), this.classGuid);
MediaController.getInstance().startRaiseToEarSensors(this);
checkRaiseSensors();
ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
if (chatAttachAlert != null) {
chatAttachAlert.onResume();
}
SizeNotifierFrameLayout sizeNotifierFrameLayout = this.contentView;
if (sizeNotifierFrameLayout != null) {
sizeNotifierFrameLayout.onResume();
}
if (this.firstOpen && getMessagesController().isProxyDialog(this.dialog_id, true)) {
SharedPreferences globalNotificationsSettings = MessagesController.getGlobalNotificationsSettings();
if (globalNotificationsSettings.getLong("proxychannel", 0L) != this.dialog_id) {
globalNotificationsSettings.edit().putLong("proxychannel", this.dialog_id).commit();
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("UseProxySponsorInfo", R.string.UseProxySponsorInfo));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
showDialog(builder.create());
}
}
checkActionBarMenu();
TLRPC.PhotoSize photoSize = this.replyImageLocation;
if (photoSize != null && (backupImageView2 = this.replyImageView) != null) {
backupImageView2.setImage(ImageLocation.getForObject(photoSize, this.replyImageLocationObject), "50_50", ImageLocation.getForObject(this.replyImageThumbLocation, this.replyImageLocationObject), "50_50_b", null, this.replyImageSize, this.replyImageCacheType, this.replyingMessageObject);
}
TLRPC.PhotoSize photoSize2 = this.pinnedImageLocation;
if (photoSize2 != null && (backupImageView = this.pinnedMessageImageView) != null) {
backupImageView.setImage(ImageLocation.getForObject(photoSize2, this.pinnedImageLocationObject), "50_50", ImageLocation.getForObject(this.pinnedImageThumbLocation, this.pinnedImageLocationObject), "50_50_b", null, this.pinnedImageSize, this.pinnedImageCacheType, this.pinnedMessageObject);
}
if (!this.inScheduleMode) {
getNotificationsController().setOpenedDialogId(this.dialog_id);
}
getMessagesController().setLastVisibleDialogId(this.dialog_id, this.inScheduleMode, true);
if (this.scrollToTopOnResume) {
if (this.scrollToTopUnReadOnResume && (messageObject = this.scrollToMessage) != null) {
if (this.chatListView != null) {
int i = this.scrollToMessagePosition;
if (i == -9000) {
i = getScrollOffsetForMessage(messageObject);
} else if (i == -10000) {
i = -AndroidUtilities.dp(11.0f);
} else {
z = true;
this.chatLayoutManager.scrollToPositionWithOffset(this.chatAdapter.messagesStartRow + this.messages.indexOf(this.scrollToMessage), i, z);
}
z = false;
this.chatLayoutManager.scrollToPositionWithOffset(this.chatAdapter.messagesStartRow + this.messages.indexOf(this.scrollToMessage), i, z);
}
} else {
moveScrollToLastMessage();
}
this.scrollToTopUnReadOnResume = false;
this.scrollToTopOnResume = false;
this.scrollToMessage = null;
}
this.paused = false;
this.pausedOnLastMessage = false;
checkScrollForLoad(false);
if (this.wasPaused) {
this.wasPaused = false;
ChatActivityAdapter chatActivityAdapter = this.chatAdapter;
if (chatActivityAdapter != null) {
chatActivityAdapter.notifyDataSetChanged();
}
}
applyDraftMaybe(false);
FrameLayout frameLayout = this.bottomOverlayChat;
if (frameLayout != null && frameLayout.getVisibility() != 0 && !this.actionBar.isSearchFieldVisible()) {
this.chatActivityEnterView.setFieldFocused(true);
}
ChatActivityEnterView chatActivityEnterView2 = this.chatActivityEnterView;
if (chatActivityEnterView2 != null) {
chatActivityEnterView2.onResume();
}
if (this.currentUser != null) {
this.chatEnterTime = System.currentTimeMillis();
this.chatLeaveTime = 0L;
}
if (this.startVideoEdit != null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$onResume$75$ChatActivity();
}
});
}
if (this.chatListView != null && ((chatActivityEnterView = this.chatActivityEnterView) == null || !chatActivityEnterView.isEditingMessage())) {
this.chatListView.setOnItemLongClickListener(this.onItemLongClickListener);
this.chatListView.setOnItemClickListener(this.onItemClickListener);
this.chatListView.setLongClickable(true);
}
checkBotCommands();
ChatActionBarHelper chatActionBarHelper = this.actionBarHelper;
if (chatActionBarHelper != null) {
chatActionBarHelper.updateTitle();
}
}
public void lambda$onResume$75$ChatActivity() {
openVideoEditor(this.startVideoEdit, null);
this.startVideoEdit = null;
}
@Override
public void finishFragment() {
super.finishFragment();
ActionBarPopupWindow actionBarPopupWindow = this.scrimPopupWindow;
if (actionBarPopupWindow != null) {
actionBarPopupWindow.dismiss();
}
}
@Override
public void onPause() {
MessageObject messageObject;
SpannableStringBuilder spannableStringBuilder;
boolean z;
int i;
int i2;
int findFirstVisibleItemPosition;
RecyclerListView.Holder holder;
int id;
SpannableStringBuilder spannableStringBuilder2;
super.onPause();
ActionBarPopupWindow actionBarPopupWindow = this.scrimPopupWindow;
if (actionBarPopupWindow != null) {
actionBarPopupWindow.dismiss();
}
getMessagesController().markDialogAsReadNow(this.dialog_id);
MediaController.getInstance().stopRaiseToEarSensors(this, true);
this.paused = true;
this.wasPaused = true;
if (!this.inScheduleMode) {
getNotificationsController().setOpenedDialogId(0L);
}
getMessagesController().setLastVisibleDialogId(this.dialog_id, this.inScheduleMode, false);
if (this.ignoreAttachOnPause || this.chatActivityEnterView == null || this.bottomOverlayChat.getVisibility() == 0) {
messageObject = null;
spannableStringBuilder = null;
z = true;
} else {
this.chatActivityEnterView.onPause();
messageObject = this.replyingMessageObject;
if (!this.chatActivityEnterView.isEditingMessage()) {
CharSequence fieldText = this.chatActivityEnterView.getFieldText();
if (!TextUtils.isEmpty(fieldText)) {
if (fieldText.toString().endsWith(" ")) {
SpannableStringBuilder spannableStringBuilder3 = new SpannableStringBuilder(AndroidUtilities.getTrimmedString(fieldText));
spannableStringBuilder3.append((CharSequence) " ");
spannableStringBuilder2 = spannableStringBuilder3;
} else {
spannableStringBuilder2 = AndroidUtilities.getTrimmedString(this.chatActivityEnterView.getFieldText());
}
z = this.chatActivityEnterView.isMessageWebPageSearchEnabled();
this.chatActivityEnterView.setFieldFocused(false);
spannableStringBuilder = spannableStringBuilder2;
}
}
spannableStringBuilder2 = null;
z = this.chatActivityEnterView.isMessageWebPageSearchEnabled();
this.chatActivityEnterView.setFieldFocused(false);
spannableStringBuilder = spannableStringBuilder2;
}
ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
if (chatAttachAlert != null) {
if (!this.ignoreAttachOnPause) {
chatAttachAlert.onPause();
} else {
this.ignoreAttachOnPause = false;
}
}
SizeNotifierFrameLayout sizeNotifierFrameLayout = this.contentView;
if (sizeNotifierFrameLayout != null) {
sizeNotifierFrameLayout.onPause();
}
if (this.inScheduleMode) {
return;
}
CharSequence[] charSequenceArr = {spannableStringBuilder};
getMediaDataController().saveDraft(this.dialog_id, charSequenceArr[0], getMediaDataController().getEntities(charSequenceArr), messageObject != null ? messageObject.messageOwner : null, !z);
getMessagesController().cancelTyping(0, this.dialog_id);
if (!this.pausedOnLastMessage) {
SharedPreferences.Editor edit2 = MessagesController.getNotificationsSettings(this.currentAccount).edit();
GridLayoutManagerFixed gridLayoutManagerFixed = this.chatLayoutManager;
if (gridLayoutManagerFixed != null && (findFirstVisibleItemPosition = gridLayoutManagerFixed.findFirstVisibleItemPosition()) != 0 && (holder = (RecyclerListView.Holder) this.chatListView.findViewHolderForAdapterPosition(findFirstVisibleItemPosition)) != null) {
if (holder.itemView instanceof ChatMessageCell) {
id = ((ChatMessageCell) holder.itemView).getMessageObject().getId();
} else {
id = holder.itemView instanceof ChatActionCell ? ((ChatActionCell) holder.itemView).getMessageObject().getId() : 0;
}
if (id == 0) {
holder = (RecyclerListView.Holder) this.chatListView.findViewHolderForAdapterPosition(findFirstVisibleItemPosition + 1);
}
int i3 = 0;
boolean z2 = false;
for (int i4 = findFirstVisibleItemPosition - 1; i4 >= this.chatAdapter.messagesStartRow; i4--) {
int i5 = i4 - this.chatAdapter.messagesStartRow;
if (i5 >= 0 && i5 < this.messages.size()) {
MessageObject messageObject2 = this.messages.get(i5);
if (messageObject2.getId() != 0) {
if ((!messageObject2.isOut() || messageObject2.messageOwner.from_scheduled) && messageObject2.isUnread()) {
z2 = true;
}
if (i3 > 2) {
break;
}
i3++;
} else {
continue;
}
}
}
if (holder != null && !z2) {
if (holder.itemView instanceof ChatMessageCell) {
i = ((ChatMessageCell) holder.itemView).getMessageObject().getId();
} else {
i = holder.itemView instanceof ChatActionCell ? ((ChatActionCell) holder.itemView).getMessageObject().getId() : 0;
}
if ((i > 0 && this.currentEncryptedChat == null) || (i < 0 && this.currentEncryptedChat != null)) {
i2 = holder.itemView.getBottom() - this.chatListView.getMeasuredHeight();
if (BuildVars.LOGS_ENABLED) {
FileLog.d("save offset = " + i2 + " for mid " + i);
}
if (i == 0) {
edit2.putInt("diditem" + this.dialog_id, i);
edit2.putInt("diditemo" + this.dialog_id, i2);
} else {
this.pausedOnLastMessage = true;
edit2.remove("diditem" + this.dialog_id);
edit2.remove("diditemo" + this.dialog_id);
}
edit2.commit();
}
}
}
i = 0;
i2 = 0;
if (i == 0) {
}
edit2.commit();
}
if (this.currentUser != null) {
this.chatLeaveTime = System.currentTimeMillis();
updateInformationForScreenshotDetector();
}
UndoView undoView = this.undoView;
if (undoView != null) {
undoView.hide(true, 0);
}
}
private void applyDraftMaybe(boolean z) {
?? r12;
int i;
if (this.chatActivityEnterView == null || this.inScheduleMode) {
return;
}
TLRPC.DraftMessage draft = getMediaDataController().getDraft(this.dialog_id);
TLRPC.Message draftMessage = (draft == null || draft.reply_to_msg_id == 0) ? null : getMediaDataController().getDraftMessage(this.dialog_id);
if (this.chatActivityEnterView.getFieldText() == null) {
if (draft != null) {
this.chatActivityEnterView.setWebPage(null, !draft.no_webpage);
if (!draft.entities.isEmpty()) {
r12 = SpannableStringBuilder.valueOf(draft.message);
MediaDataController.sortEntities(draft.entities);
for (int i2 = 0; i2 < draft.entities.size(); i2++) {
TLRPC.MessageEntity messageEntity = draft.entities.get(i2);
boolean z2 = messageEntity instanceof TLRPC.TL_inputMessageEntityMentionName;
if (z2 || (messageEntity instanceof TLRPC.TL_messageEntityMentionName)) {
if (z2) {
i = ((TLRPC.TL_inputMessageEntityMentionName) messageEntity).user_id.user_id;
} else {
i = ((TLRPC.TL_messageEntityMentionName) messageEntity).user_id;
}
if (messageEntity.offset + messageEntity.length < r12.length() && r12.charAt(messageEntity.offset + messageEntity.length) == ' ') {
messageEntity.length++;
}
r12.setSpan(new URLSpanUserMention("" + i, 1), messageEntity.offset, messageEntity.offset + messageEntity.length, 33);
} else if ((messageEntity instanceof TLRPC.TL_messageEntityCode) || (messageEntity instanceof TLRPC.TL_messageEntityPre)) {
TextStyleSpan.TextStyleRun textStyleRun = new TextStyleSpan.TextStyleRun();
textStyleRun.flags |= 4;
MediaDataController.addStyleToText(new TextStyleSpan(textStyleRun), messageEntity.offset, messageEntity.offset + messageEntity.length, r12, true);
} else if (messageEntity instanceof TLRPC.TL_messageEntityBold) {
TextStyleSpan.TextStyleRun textStyleRun2 = new TextStyleSpan.TextStyleRun();
textStyleRun2.flags |= 1;
MediaDataController.addStyleToText(new TextStyleSpan(textStyleRun2), messageEntity.offset, messageEntity.offset + messageEntity.length, r12, true);
} else if (messageEntity instanceof TLRPC.TL_messageEntityItalic) {
TextStyleSpan.TextStyleRun textStyleRun3 = new TextStyleSpan.TextStyleRun();
textStyleRun3.flags |= 2;
MediaDataController.addStyleToText(new TextStyleSpan(textStyleRun3), messageEntity.offset, messageEntity.offset + messageEntity.length, r12, true);
} else if (messageEntity instanceof TLRPC.TL_messageEntityStrike) {
TextStyleSpan.TextStyleRun textStyleRun4 = new TextStyleSpan.TextStyleRun();
textStyleRun4.flags |= 8;
MediaDataController.addStyleToText(new TextStyleSpan(textStyleRun4), messageEntity.offset, messageEntity.offset + messageEntity.length, r12, true);
} else if (messageEntity instanceof TLRPC.TL_messageEntityUnderline) {
TextStyleSpan.TextStyleRun textStyleRun5 = new TextStyleSpan.TextStyleRun();
textStyleRun5.flags |= 16;
MediaDataController.addStyleToText(new TextStyleSpan(textStyleRun5), messageEntity.offset, messageEntity.offset + messageEntity.length, r12, true);
} else if (messageEntity instanceof TLRPC.TL_messageEntityTextUrl) {
r12.setSpan(new URLSpanReplacement(messageEntity.url), messageEntity.offset, messageEntity.offset + messageEntity.length, 33);
}
}
} else {
r12 = draft.message;
}
this.chatActivityEnterView.setFieldText(r12);
if (getArguments().getBoolean("hasUrl", false)) {
this.chatActivityEnterView.setSelection(draft.message.indexOf(10) + 1);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$applyDraftMaybe$76$ChatActivity();
}
}, 700L);
}
}
} else if (z && draft == null) {
this.chatActivityEnterView.setFieldText("");
hideFieldPanel(true);
}
if (this.replyingMessageObject != null || draftMessage == null) {
return;
}
MessageObject messageObject = new MessageObject(this.currentAccount, draftMessage, (AbstractMap<Integer, TLRPC.User>) getMessagesController().getUsers(), false);
this.replyingMessageObject = messageObject;
showFieldPanelForReply(messageObject);
}
public void lambda$applyDraftMaybe$76$ChatActivity() {
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null) {
chatActivityEnterView.setFieldFocused(true);
this.chatActivityEnterView.openKeyboard();
}
}
private void updateInformationForScreenshotDetector() {
if (this.currentUser == null) {
return;
}
if (this.currentEncryptedChat != null) {
ArrayList<Long> arrayList = new ArrayList<>();
RecyclerListView recyclerListView = this.chatListView;
if (recyclerListView != null) {
int childCount = recyclerListView.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = this.chatListView.getChildAt(i);
MessageObject messageObject = childAt instanceof ChatMessageCell ? ((ChatMessageCell) childAt).getMessageObject() : null;
if (messageObject != null && messageObject.getId() < 0 && messageObject.messageOwner.random_id != 0) {
arrayList.add(Long.valueOf(messageObject.messageOwner.random_id));
}
}
}
MediaController.getInstance().setLastVisibleMessageIds(this.currentAccount, this.chatEnterTime, this.chatLeaveTime, this.currentUser, this.currentEncryptedChat, arrayList, 0);
return;
}
SecretMediaViewer secretMediaViewer = SecretMediaViewer.getInstance();
MessageObject currentMessageObject = secretMediaViewer.getCurrentMessageObject();
if (currentMessageObject == null || currentMessageObject.isOut()) {
return;
}
MediaController.getInstance().setLastVisibleMessageIds(this.currentAccount, secretMediaViewer.getOpenTime(), secretMediaViewer.getCloseTime(), this.currentUser, null, null, currentMessageObject.getId());
}
private boolean fixLayoutInternal() {
MessageObject.GroupedMessages currentMessagesGroup;
if (!AndroidUtilities.isTablet() && ApplicationLoader.applicationContext.getResources().getConfiguration().orientation == 2) {
this.selectedMessagesCountTextView.setTextSize(18);
} else {
this.selectedMessagesCountTextView.setTextSize(20);
}
HashMap hashMap = null;
int childCount = this.chatListView.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = this.chatListView.getChildAt(i);
if ((childAt instanceof ChatMessageCell) && (currentMessagesGroup = ((ChatMessageCell) childAt).getCurrentMessagesGroup()) != null && currentMessagesGroup.hasSibling) {
if (hashMap == null) {
hashMap = new HashMap();
}
if (!hashMap.containsKey(Long.valueOf(currentMessagesGroup.groupId))) {
hashMap.put(Long.valueOf(currentMessagesGroup.groupId), currentMessagesGroup);
int indexOf = this.messages.indexOf(currentMessagesGroup.messages.get(currentMessagesGroup.messages.size() - 1));
if (indexOf >= 0) {
ChatActivityAdapter chatActivityAdapter = this.chatAdapter;
chatActivityAdapter.notifyItemRangeChanged(indexOf + chatActivityAdapter.messagesStartRow, currentMessagesGroup.messages.size());
}
}
}
}
if (AndroidUtilities.isTablet()) {
if (AndroidUtilities.isSmallTablet() && ApplicationLoader.applicationContext.getResources().getConfiguration().orientation == 1) {
this.actionBar.setBackButtonImage(R.mipmap.ic_back);
FragmentContextView fragmentContextView = this.fragmentContextView;
if (fragmentContextView != null && fragmentContextView.getParent() == null) {
((ViewGroup) this.fragmentView).addView(this.fragmentContextView, LayoutHelper.createFrame(-1.0f, 39.0f, 51, 0.0f, -36.0f, 0.0f, 0.0f));
}
} else {
this.actionBar.setBackButtonImage(R.mipmap.ic_back);
FragmentContextView fragmentContextView2 = this.fragmentContextView;
if (fragmentContextView2 != null && fragmentContextView2.getParent() != null) {
this.fragmentView.setPadding(0, 0, 0, 0);
((ViewGroup) this.fragmentView).removeView(this.fragmentContextView);
}
}
return false;
}
return true;
}
public boolean maybePlayVisibleVideo() {
AnimatedFileDrawable animatedFileDrawable;
MessageObject messageObject;
ImageReceiver photoImage;
AnimatedFileDrawable animation;
int top;
int imageHeight;
if (this.chatListView == null) {
return false;
}
MessageObject playingMessageObject = MediaController.getInstance().getPlayingMessageObject();
if (playingMessageObject == null || playingMessageObject.isVideo()) {
HintView hintView = this.noSoundHintView;
if (hintView == null || hintView.getTag() == null) {
animatedFileDrawable = null;
messageObject = null;
} else {
ChatMessageCell messageCell = this.noSoundHintView.getMessageCell();
ImageReceiver photoImage2 = messageCell.getPhotoImage();
animatedFileDrawable = photoImage2.getAnimation();
if (animatedFileDrawable != null) {
messageObject = messageCell.getMessageObject();
this.scrollToVideo = messageCell.getTop() + photoImage2.getImageY2() > this.chatListView.getMeasuredHeight();
} else {
messageObject = null;
}
}
if (messageObject == null) {
int childCount = this.chatListView.getChildCount();
int i = 0;
while (true) {
if (i >= childCount) {
break;
}
View childAt = this.chatListView.getChildAt(i);
if (childAt instanceof ChatMessageCell) {
ChatMessageCell chatMessageCell = (ChatMessageCell) childAt;
MessageObject messageObject2 = chatMessageCell.getMessageObject();
boolean isRoundVideo = messageObject2.isRoundVideo();
if ((messageObject2.isVideo() || isRoundVideo) && (animation = (photoImage = chatMessageCell.getPhotoImage()).getAnimation()) != null && (imageHeight = photoImage.getImageHeight() + (top = childAt.getTop() + photoImage.getImageY())) >= 0 && top <= this.chatListView.getMeasuredHeight()) {
if (messageObject != null && top < 0) {
break;
}
this.scrollToVideo = top < 0 || imageHeight > this.chatListView.getMeasuredHeight();
if (top >= 0 && imageHeight <= this.chatListView.getMeasuredHeight()) {
messageObject = messageObject2;
animatedFileDrawable = animation;
break;
}
messageObject = messageObject2;
animatedFileDrawable = animation;
}
}
i++;
}
}
if (messageObject == null || MediaController.getInstance().isPlayingMessage(messageObject)) {
return false;
}
HintView hintView2 = this.noSoundHintView;
if (hintView2 != null) {
hintView2.hide();
}
HintView hintView3 = this.forwardHintView;
if (hintView3 != null) {
hintView3.hide();
}
if (messageObject.isRoundVideo()) {
boolean playMessage = MediaController.getInstance().playMessage(messageObject);
MediaController.getInstance().setVoiceMessagesPlaylist(playMessage ? createVoiceMessagesPlaylist(messageObject, false) : null, false);
return playMessage;
}
SharedConfig.setNoSoundHintShowed(true);
messageObject.audioProgress = animatedFileDrawable.getCurrentProgress();
messageObject.audioProgressMs = animatedFileDrawable.getCurrentProgressMs();
animatedFileDrawable.stop();
if (PhotoViewer.isPlayingMessageInPip(messageObject)) {
PhotoViewer.getPipInstance().destroyPhotoViewer();
}
return MediaController.getInstance().playMessage(messageObject);
}
return false;
}
@Override
public void onConfigurationChanged(Configuration configuration) {
MessageObject playingMessageObject;
if (this.visibleDialog instanceof DatePickerDialog) {
this.visibleDialog.dismiss();
}
ActionBarPopupWindow actionBarPopupWindow = this.scrimPopupWindow;
if (actionBarPopupWindow != null) {
actionBarPopupWindow.dismiss();
}
if (AndroidUtilities.isTablet()) {
return;
}
if (configuration.orientation == 2) {
if ((PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) || (playingMessageObject = MediaController.getInstance().getPlayingMessageObject()) == null || !playingMessageObject.isVideo()) {
return;
}
PhotoViewer.getInstance().setParentActivity(getParentActivity());
getFileLoader().setLoadingVideoForPlayer(playingMessageObject.getDocument(), false);
MediaController.getInstance().cleanupPlayer(true, true, false, true);
if (PhotoViewer.getInstance().openPhoto(playingMessageObject, playingMessageObject.type != 0 ? this.dialog_id : 0L, playingMessageObject.type != 0 ? this.mergeDialogId : 0L, this.photoViewerProvider, false)) {
PhotoViewer.getInstance().setParentChatActivity(this);
}
HintView hintView = this.noSoundHintView;
if (hintView != null) {
hintView.hide();
}
HintView hintView2 = this.forwardHintView;
if (hintView2 != null) {
hintView2.hide();
}
HintView hintView3 = this.slowModeHint;
if (hintView3 != null) {
hintView3.hide();
}
MediaController.getInstance().resetGoingToShowMessageObject();
} else if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isOpenedFullScreenVideo()) {
PhotoViewer.getInstance().injectVideoPlayerToMediaController();
PhotoViewer.getInstance().closePhoto(false, true);
}
}
public void createDeleteMessagesAlert(MessageObject messageObject, MessageObject.GroupedMessages groupedMessages) {
createDeleteMessagesAlert(messageObject, groupedMessages, 1);
}
private void createDeleteMessagesAlert(MessageObject messageObject, MessageObject.GroupedMessages groupedMessages, int i) {
AlertsCreator.createDeleteMessagesAlert(this, this.currentUser, this.currentChat, this.currentEncryptedChat, this.chatInfo, this.mergeDialogId, messageObject, this.selectedMessagesIds, groupedMessages, this.inScheduleMode, i, new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$createDeleteMessagesAlert$77$ChatActivity();
}
});
}
public void lambda$createDeleteMessagesAlert$77$ChatActivity() {
hideActionMode();
updatePinnedMessageView(true);
}
public void hideActionMode() {
if (this.actionBar.isActionModeShowed()) {
if (this.actionBar != null) {
this.actionBar.hideActionMode();
this.actionBar.setBackButtonImage(R.mipmap.ic_back);
}
this.cantDeleteMessagesCount = 0;
this.canEditMessagesCount = 0;
this.cantForwardMessagesCount = 0;
this.cantCopyMessageCount = 0;
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null) {
EditTextCaption editField = chatActivityEnterView.getEditField();
editField.requestFocus();
editField.setAllowDrawCursor(true);
}
}
}
public void createMenu(View view, boolean z, boolean z2, float f, float f2) {
createMenu(view, z, z2, f, f2, true);
}
private CharSequence getMessageCaption(MessageObject messageObject, MessageObject.GroupedMessages groupedMessages) {
if (messageObject.caption != null) {
return messageObject.caption;
}
if (groupedMessages == null) {
return null;
}
int size = groupedMessages.messages.size();
CharSequence charSequence = null;
for (int i = 0; i < size; i++) {
MessageObject messageObject2 = groupedMessages.messages.get(i);
if (messageObject2.caption != null) {
if (charSequence != null) {
return null;
}
charSequence = messageObject2.caption;
}
}
return charSequence;
}
public void createMenu(final View view, boolean z, boolean z2, float f, float f2, boolean z3) {
MessageObject messageObject;
TLRPC.UserFull userFull;
boolean z4;
boolean z5;
boolean z6;
boolean z7;
TLRPC.User user;
String string;
TLRPC.User user2;
ScrollView scrollView;
int i;
TLRPC.EncryptedChat encryptedChat;
FrameLayout frameLayout;
TLRPC.Chat chat;
int size;
int i2;
TLRPC.ChatFull chatFull;
TLRPC.UserFull userFull2;
if (this.actionBar.isActionModeShowed()) {
return;
}
if (view instanceof ChatMessageCell) {
messageObject = ((ChatMessageCell) view).getMessageObject();
} else {
messageObject = view instanceof ChatActionCell ? ((ChatActionCell) view).getMessageObject() : null;
}
if (messageObject == null) {
return;
}
if (messageObject.messageOwner != null && messageObject.messageOwner.action != null && (messageObject.messageOwner.action instanceof TLRPCRedpacket.CL_messagesActionReceivedRpkTransfer)) {
return;
}
int messageType = getMessageType(messageObject);
if (z && (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage)) {
scrollToMessageId(messageObject.messageOwner.reply_to_msg_id, messageObject.messageOwner.id, true, 0, false);
return;
}
this.selectedObject = null;
this.selectedObjectGroup = null;
this.forwardingMessage = null;
this.forwardingMessageGroup = null;
this.selectedObjectToEditCaption = null;
for (int i3 = 1; i3 >= 0; i3--) {
this.selectedMessagesCanCopyIds[i3].clear();
this.selectedMessagesCanStarIds[i3].clear();
this.selectedMessagesIds[i3].clear();
}
hideActionMode();
updatePinnedMessageView(true);
MessageObject.GroupedMessages validGroupedMessage = z3 ? getValidGroupedMessage(messageObject) : null;
if (!this.inScheduleMode) {
if (this.currentChat != null) {
if (messageObject.getDialogId() != this.mergeDialogId && ChatObject.canPinMessages(this.currentChat)) {
z4 = true;
boolean z8 = !z4 && messageObject.getId() > 0 && (messageObject.messageOwner.action == null || (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionEmpty));
boolean z9 = messageObject.getDialogId() == this.mergeDialogId && z8 && (((chatFull = this.chatInfo) != null && chatFull.pinned_msg_id == messageObject.getId()) || ((userFull2 = this.userInfo) != null && userFull2.pinned_msg_id == messageObject.getId()));
z5 = (messageObject.canEditMessage(this.currentChat) || this.chatActivityEnterView.hasAudioToSend() || messageObject.getDialogId() == this.mergeDialogId) ? false : true;
if (z5 && validGroupedMessage != null) {
size = validGroupedMessage.messages.size();
int i4 = 0;
for (i2 = 0; i2 < size; i2++) {
MessageObject messageObject2 = validGroupedMessage.messages.get(i2);
if (i2 == 0 || !TextUtils.isEmpty(messageObject2.caption)) {
this.selectedObjectToEditCaption = messageObject2;
if (!TextUtils.isEmpty(messageObject2.caption)) {
i4++;
}
}
}
z5 = i4 >= 2;
}
boolean z10 = this.inScheduleMode && ((encryptedChat = this.currentEncryptedChat) == null || AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 46) && !((messageType == 1 && (messageObject.getDialogId() == this.mergeDialogId || messageObject.needDrawBluredPreview())) || (messageObject.messageOwner.action instanceof TLRPC.TL_messageActionSecureValuesSent) || ((this.currentEncryptedChat == null && messageObject.getId() < 0) || (((frameLayout = this.bottomOverlayChat) != null && frameLayout.getVisibility() == 0) || ((chat = this.currentChat) != null && (ChatObject.isNotInChat(chat) || ((ChatObject.isChannel(this.currentChat) && !ChatObject.canPost(this.currentChat) && !this.currentChat.megagroup) || !ChatObject.canSendMessages(this.currentChat)))))));
if (!z || messageType < 2 || messageType == 20) {
if (getParentActivity() == null) {
return;
}
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
final ArrayList arrayList3 = new ArrayList();
if (messageType >= 0 || (messageType == -1 && z && ((messageObject.isSending() || messageObject.isEditing()) && this.currentEncryptedChat == null))) {
this.selectedObject = messageObject;
this.selectedObjectGroup = validGroupedMessage;
if (messageType == -1) {
if (messageObject.type == 0 || this.selectedObject.isAnimatedEmoji() || getMessageCaption(this.selectedObject, this.selectedObjectGroup) != null) {
arrayList2.add(LocaleController.getString("Copy", R.string.Copy));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_COPY1);
arrayList.add(Integer.valueOf((int) R.drawable.msg_copy));
}
arrayList2.add(LocaleController.getString("CancelSending", R.string.CancelSending));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_CANCEL_SENDING);
arrayList.add(Integer.valueOf((int) R.drawable.msg_delete));
} else if (messageType == 0) {
arrayList2.add(LocaleController.getString("Retry", R.string.Retry));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SEND_RETRY);
arrayList.add(Integer.valueOf((int) R.drawable.msg_retry));
arrayList2.add(LocaleController.getString("Delete", R.string.Delete));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_DELETE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_delete));
} else if (messageType == 1) {
if (this.currentChat != null) {
if (z10) {
arrayList2.add(LocaleController.getString("Reply", R.string.Reply));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_REPLAY);
arrayList.add(Integer.valueOf((int) R.drawable.msg_reply));
}
if (z9) {
arrayList2.add(LocaleController.getString("UnpinMessage", R.string.UnpinMessage));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_UNPIN);
arrayList.add(Integer.valueOf((int) R.drawable.msg_unpin));
} else if (z8) {
arrayList2.add(LocaleController.getString("PinMessage", R.string.PinMessage));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_PIN);
arrayList.add(Integer.valueOf((int) R.drawable.msg_pin));
}
if (messageObject.canEditMessage(this.currentChat)) {
arrayList2.add(LocaleController.getString("Edit", R.string.Edit));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_EDIT);
arrayList.add(Integer.valueOf((int) R.drawable.msg_edit));
}
if (this.selectedObject.contentType == 0 && !this.selectedObject.isMediaEmptyWebpage() && this.selectedObject.getId() > 0 && !this.selectedObject.isOut() && (this.currentChat != null || ((user2 = this.currentUser) != null && user2.bot))) {
arrayList2.add(LocaleController.getString("ReportChat", R.string.ReportChat));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_REPORT);
arrayList.add(Integer.valueOf((int) R.drawable.msg_report));
}
if (messageObject.canDeleteMessage(this.inScheduleMode, this.currentChat)) {
arrayList2.add(LocaleController.getString("Delete", R.string.Delete));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_DELETE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_delete));
}
} else {
if (messageObject.getId() > 0 && z10 && !isSysNotifyMessage().booleanValue()) {
arrayList2.add(LocaleController.getString("Reply", R.string.Reply));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_REPLAY);
arrayList.add(Integer.valueOf((int) R.drawable.msg_reply));
}
if (messageObject.canDeleteMessage(this.inScheduleMode, this.currentChat)) {
arrayList2.add(LocaleController.getString("Delete", R.string.Delete));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_DELETE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_delete));
}
}
} else if (messageType == 20) {
arrayList2.add(LocaleController.getString("Retry", R.string.Retry));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SEND_RETRY);
arrayList.add(Integer.valueOf((int) R.drawable.msg_retry));
arrayList2.add(LocaleController.getString("Copy", R.string.Copy));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_COPY1);
arrayList.add(Integer.valueOf((int) R.drawable.msg_copy));
arrayList2.add(LocaleController.getString("Delete", R.string.Delete));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_DELETE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_delete));
} else if (this.currentEncryptedChat == null) {
if (this.inScheduleMode) {
z6 = z5;
arrayList2.add(LocaleController.getString("MessageScheduleSend", R.string.MessageScheduleSend));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SEND_NOW);
arrayList.add(Integer.valueOf((int) R.drawable.outline_send));
} else {
z6 = z5;
}
if (this.selectedObject.messageOwner.action instanceof TLRPC.TL_messageActionPhoneCall) {
TLRPC.TL_messageActionPhoneCall tL_messageActionPhoneCall = (TLRPC.TL_messageActionPhoneCall) messageObject.messageOwner.action;
if (((tL_messageActionPhoneCall.reason instanceof TLRPC.TL_phoneCallDiscardReasonMissed) || (tL_messageActionPhoneCall.reason instanceof TLRPC.TL_phoneCallDiscardReasonBusy)) && !messageObject.isOutOwner()) {
z7 = z8;
string = LocaleController.getString("CallBack", R.string.CallBack);
} else {
z7 = z8;
string = LocaleController.getString("CallAgain", R.string.CallAgain);
}
arrayList2.add(string);
arrayList3.add(Constants.ChatSelectionPopMenuEnum.CALL_BACK_OR_CALL_AGAIN);
arrayList.add(Integer.valueOf((int) R.drawable.msg_callback));
if (VoIPHelper.canRateCall(tL_messageActionPhoneCall)) {
arrayList2.add(LocaleController.getString("CallMessageReportProblem", R.string.CallMessageReportProblem));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.CALL1);
arrayList.add(Integer.valueOf((int) R.drawable.msg_callback));
}
} else {
z7 = z8;
}
if (z10 && messageObject.type != 101 && messageObject.type != 102) {
arrayList2.add(LocaleController.getString("Reply", R.string.Reply));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_REPLAY);
arrayList.add(Integer.valueOf((int) R.drawable.msg_reply));
}
if (this.selectedObject.type == 0 || this.selectedObject.isAnimatedEmoji() || getMessageCaption(this.selectedObject, this.selectedObjectGroup) != null) {
arrayList2.add(LocaleController.getString("Copy", R.string.Copy));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_COPY1);
arrayList.add(Integer.valueOf((int) R.drawable.msg_copy));
}
if (!this.inScheduleMode && ChatObject.isChannel(this.currentChat)) {
this.selectedObject.getDialogId();
}
if (messageType == 2) {
if (!this.inScheduleMode && this.selectedObject.type == 17 && !messageObject.isPollClosed()) {
if (messageObject.isVoted()) {
arrayList2.add(LocaleController.getString("Unvote", R.string.Unvote));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.POLL_CANCEL);
arrayList.add(Integer.valueOf((int) R.drawable.msg_unvote));
}
if (!messageObject.isForwarded() && ((messageObject.isOut() && (!ChatObject.isChannel(this.currentChat) || this.currentChat.megagroup)) || (ChatObject.isChannel(this.currentChat) && !this.currentChat.megagroup && (this.currentChat.creator || (this.currentChat.admin_rights != null && this.currentChat.admin_rights.edit_messages))))) {
arrayList2.add(LocaleController.getString("StopPoll", R.string.StopPoll));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.POLL_STOP);
arrayList.add(Integer.valueOf((int) R.drawable.msg_pollstop));
}
}
} else if (messageType == 3) {
if ((this.selectedObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage) && MessageObject.isNewGifDocument(this.selectedObject.messageOwner.media.webpage.document)) {
arrayList2.add(LocaleController.getString("SaveToGIFs", R.string.SaveToGIFs));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.GIF_SAVE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_gif));
}
} else if (messageType == 4) {
if (this.selectedObject.isVideo()) {
if (!this.selectedObject.needDrawBluredPreview()) {
arrayList2.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.PIC_SAVE_TO_GALLERY1);
arrayList.add(Integer.valueOf((int) R.drawable.msg_gallery));
TLRPC.Chat chat2 = this.currentChat;
if (chat2 != null && chat2.megagroup) {
if ((this.currentChat.flags & ConnectionsManager.FileTypeVideo) != 0) {
if (ChatObject.hasAdminRights(this.currentChat)) {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
}
} else if (this.selectedObject.isMusic()) {
arrayList2.add(LocaleController.getString("SaveToMusic", R.string.SaveToMusic));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_DOWNLOAD);
arrayList.add(Integer.valueOf((int) R.drawable.msg_download));
TLRPC.Chat chat3 = this.currentChat;
if (chat3 != null && chat3.megagroup) {
if ((this.currentChat.flags & ConnectionsManager.FileTypeVideo) != 0) {
if (ChatObject.hasAdminRights(this.currentChat)) {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else if (this.selectedObject.getDocument() != null) {
if (MessageObject.isNewGifDocument(this.selectedObject.getDocument())) {
if (getMediaDataController().hasRecentGifNoChangeINdex(this.selectedObject.getDocument())) {
arrayList2.add(LocaleController.getString("RemoveFromGIFs", R.string.RemoveFromGIFs));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.GIF_REMOVE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_gif));
} else {
arrayList2.add(LocaleController.getString("SaveToGIFs", R.string.SaveToGIFs));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.GIF_SAVE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_gif));
}
}
arrayList2.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_DOWNLOAD);
arrayList.add(Integer.valueOf((int) R.drawable.msg_download));
TLRPC.Chat chat4 = this.currentChat;
if (chat4 != null && chat4.megagroup) {
if ((this.currentChat.flags & ConnectionsManager.FileTypeVideo) != 0) {
if (ChatObject.hasAdminRights(this.currentChat)) {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
if (!this.selectedObject.needDrawBluredPreview()) {
arrayList2.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.PIC_SAVE_TO_GALLERY1);
arrayList.add(Integer.valueOf((int) R.drawable.msg_gallery));
}
if (CodeUtils.parseCode(FileLoader.getPathToMessage(messageObject.messageOwner).toString()) != null) {
arrayList2.add(LocaleController.getString("ParseQRCode", R.string.ParseQRCode));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.QR_CODE_PARSE);
arrayList.add(Integer.valueOf((int) R.mipmap.fmt_me_qrcode));
}
}
} else if (messageType == 5) {
arrayList2.add(LocaleController.getString("ApplyLocalizationFile", R.string.ApplyLocalizationFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.LANGUAGE_OR_THEME);
arrayList.add(Integer.valueOf((int) R.drawable.msg_language));
arrayList2.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_DOWNLOAD);
arrayList.add(Integer.valueOf((int) R.drawable.msg_download));
TLRPC.Chat chat5 = this.currentChat;
if (chat5 != null && chat5.megagroup) {
if ((this.currentChat.flags & ConnectionsManager.FileTypeVideo) != 0) {
if (ChatObject.hasAdminRights(this.currentChat)) {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else if (messageType == 10) {
arrayList2.add(LocaleController.getString("ApplyThemeFile", R.string.ApplyThemeFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.LANGUAGE_OR_THEME);
arrayList.add(Integer.valueOf((int) R.drawable.msg_theme));
arrayList2.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_DOWNLOAD);
arrayList.add(Integer.valueOf((int) R.drawable.msg_download));
TLRPC.Chat chat6 = this.currentChat;
if (chat6 != null && chat6.megagroup) {
if ((this.currentChat.flags & ConnectionsManager.FileTypeVideo) != 0) {
if (ChatObject.hasAdminRights(this.currentChat)) {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else if (messageType == 6) {
arrayList2.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.PIC_SAVE_TO_GALLERY2);
arrayList.add(Integer.valueOf((int) R.drawable.msg_gallery));
arrayList2.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_DOWNLOAD);
arrayList.add(Integer.valueOf((int) R.drawable.msg_download));
TLRPC.Chat chat7 = this.currentChat;
if (chat7 != null && chat7.megagroup) {
if ((this.currentChat.flags & ConnectionsManager.FileTypeVideo) != 0) {
if (ChatObject.hasAdminRights(this.currentChat)) {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else if (messageType == 7) {
if (this.selectedObject.isMask()) {
arrayList2.add(LocaleController.getString("AddToMasks", R.string.AddToMasks));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.STICKER_OR_MASKS);
arrayList.add(Integer.valueOf((int) R.drawable.msg_sticker));
} else {
arrayList2.add(LocaleController.getString("AddToStickers", R.string.AddToStickers));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.STICKER_OR_MASKS);
arrayList.add(Integer.valueOf((int) R.drawable.msg_sticker));
if (!getMediaDataController().isStickerInFavorites(this.selectedObject.getDocument())) {
if (getMediaDataController().canAddStickerToFavorites()) {
arrayList2.add(LocaleController.getString("AddToFavorites", R.string.AddToFavorites));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_FAVE_ADD);
arrayList.add(Integer.valueOf((int) R.drawable.msg_fave));
}
} else {
arrayList2.add(LocaleController.getString("DeleteFromFavorites", R.string.DeleteFromFavorites));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_FAVE_REMOVE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_unfave));
}
}
} else if (messageType == 8) {
TLRPC.User user3 = getMessagesController().getUser(Integer.valueOf(this.selectedObject.messageOwner.media.user_id));
if (user3 != null && user3.id != getUserConfig().getClientUserId() && getContactsController().contactsDict.get(Integer.valueOf(user3.id)) == null) {
arrayList2.add(LocaleController.getString("AddContactTitle", R.string.AddContactTitle));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.CONTACT_ADD);
arrayList.add(Integer.valueOf((int) R.drawable.msg_addcontact));
}
if (!TextUtils.isEmpty(this.selectedObject.messageOwner.media.phone_number)) {
arrayList2.add(LocaleController.getString("Copy", R.string.Copy));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_COPY2);
arrayList.add(Integer.valueOf((int) R.drawable.msg_copy));
arrayList2.add(LocaleController.getString("Call", R.string.Call));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.CALL2);
arrayList.add(Integer.valueOf((int) R.drawable.msg_callback));
}
} else if (messageType == 9) {
if (!getMediaDataController().isStickerInFavorites(this.selectedObject.getDocument())) {
arrayList2.add(LocaleController.getString("AddToFavorites", R.string.AddToFavorites));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_FAVE_ADD);
arrayList.add(Integer.valueOf((int) R.drawable.msg_fave));
} else {
arrayList2.add(LocaleController.getString("DeleteFromFavorites", R.string.DeleteFromFavorites));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_FAVE_REMOVE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_unfave));
}
}
if (!this.inScheduleMode && !this.selectedObject.needDrawBluredPreview() && !this.selectedObject.isLiveLocation() && this.selectedObject.type != 16 && this.selectedObject.type != 101 && this.selectedObject.type != 102) {
TLRPC.Chat chat8 = this.currentChat;
if (chat8 != null && chat8.megagroup) {
if ((this.currentChat.flags & ConnectionsManager.FileTypeVideo) != 0) {
if (ChatObject.hasAdminRights(this.currentChat)) {
arrayList2.add(LocaleController.getString("Forward", R.string.Forward));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_FORWARD);
arrayList.add(Integer.valueOf((int) R.drawable.msg_forward));
}
} else {
arrayList2.add(LocaleController.getString("Forward", R.string.Forward));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_FORWARD);
arrayList.add(Integer.valueOf((int) R.drawable.msg_forward));
}
} else {
arrayList2.add(LocaleController.getString("Forward", R.string.Forward));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_FORWARD);
arrayList.add(Integer.valueOf((int) R.drawable.msg_forward));
}
}
if (z9) {
arrayList2.add(LocaleController.getString("UnpinMessage", R.string.UnpinMessage));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_UNPIN);
arrayList.add(Integer.valueOf((int) R.drawable.msg_unpin));
} else if (z7) {
arrayList2.add(LocaleController.getString("PinMessage", R.string.PinMessage));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_PIN);
arrayList.add(Integer.valueOf((int) R.drawable.msg_pin));
}
if (z6) {
arrayList2.add(LocaleController.getString("Edit", R.string.Edit));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_EDIT);
arrayList.add(Integer.valueOf((int) R.drawable.msg_edit));
}
if (this.inScheduleMode && this.selectedObject.canEditMessageScheduleTime(this.currentChat)) {
arrayList2.add(LocaleController.getString("MessageScheduleEditTime", R.string.MessageScheduleEditTime));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SCHEDULE_EDIT_TIME);
arrayList.add(Integer.valueOf((int) R.drawable.msg_schedule));
}
if (!this.inScheduleMode && this.selectedObject.contentType == 0 && this.selectedObject.getId() > 0 && !this.selectedObject.isOut() && (this.currentChat != null || ((user = this.currentUser) != null && user.bot))) {
arrayList2.add(LocaleController.getString("ReportChat", R.string.ReportChat));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_REPORT);
arrayList.add(Integer.valueOf((int) R.drawable.msg_report));
}
if (messageObject.canDeleteMessage(this.inScheduleMode, this.currentChat)) {
arrayList2.add(LocaleController.getString("Delete", R.string.Delete));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_DELETE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_delete));
}
} else {
if (z10) {
arrayList2.add(LocaleController.getString("Reply", R.string.Reply));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_REPLAY);
arrayList.add(Integer.valueOf((int) R.drawable.msg_reply));
}
if (messageType == 4) {
if (this.selectedObject.isVideo()) {
arrayList2.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.PIC_SAVE_TO_GALLERY1);
arrayList.add(Integer.valueOf((int) R.drawable.msg_gallery));
TLRPC.Chat chat9 = this.currentChat;
if (chat9 != null && chat9.megagroup) {
if ((this.currentChat.flags & ConnectionsManager.FileTypeVideo) != 0) {
if (ChatObject.hasAdminRights(this.currentChat)) {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else if (this.selectedObject.isMusic()) {
arrayList2.add(LocaleController.getString("SaveToMusic", R.string.SaveToMusic));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_DOWNLOAD);
arrayList.add(Integer.valueOf((int) R.drawable.msg_download));
TLRPC.Chat chat10 = this.currentChat;
if (chat10 != null && chat10.megagroup) {
if ((this.currentChat.flags & ConnectionsManager.FileTypeVideo) != 0) {
if (ChatObject.hasAdminRights(this.currentChat)) {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else if (!this.selectedObject.isVideo() && this.selectedObject.getDocument() != null) {
arrayList2.add(LocaleController.getString("SaveToDownloads", R.string.SaveToDownloads));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_DOWNLOAD);
arrayList.add(Integer.valueOf((int) R.drawable.msg_download));
TLRPC.Chat chat11 = this.currentChat;
if (chat11 != null && chat11.megagroup) {
if ((this.currentChat.flags & ConnectionsManager.FileTypeVideo) != 0) {
if (ChatObject.hasAdminRights(this.currentChat)) {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("ShareFile", R.string.ShareFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_SHARE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_shareout));
}
} else {
arrayList2.add(LocaleController.getString("SaveToGallery", R.string.SaveToGallery));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.PIC_SAVE_TO_GALLERY1);
arrayList.add(Integer.valueOf((int) R.drawable.msg_gallery));
}
} else if (messageType == 5) {
arrayList2.add(LocaleController.getString("ApplyLocalizationFile", R.string.ApplyLocalizationFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.LANGUAGE_OR_THEME);
arrayList.add(Integer.valueOf((int) R.drawable.msg_language));
} else if (messageType == 10) {
arrayList2.add(LocaleController.getString("ApplyThemeFile", R.string.ApplyThemeFile));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.LANGUAGE_OR_THEME);
arrayList.add(Integer.valueOf((int) R.drawable.msg_theme));
} else if (messageType == 7) {
arrayList2.add(LocaleController.getString("AddToStickers", R.string.AddToStickers));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.STICKER_OR_MASKS);
arrayList.add(Integer.valueOf((int) R.drawable.msg_sticker));
} else if (messageType == 8) {
TLRPC.User user4 = getMessagesController().getUser(Integer.valueOf(this.selectedObject.messageOwner.media.user_id));
if (user4 != null && user4.id != getUserConfig().getClientUserId() && getContactsController().contactsDict.get(Integer.valueOf(user4.id)) == null) {
arrayList2.add(LocaleController.getString("AddContactTitle", R.string.AddContactTitle));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.CONTACT_ADD);
arrayList.add(Integer.valueOf((int) R.drawable.msg_addcontact));
}
if (!TextUtils.isEmpty(this.selectedObject.messageOwner.media.phone_number)) {
arrayList2.add(LocaleController.getString("Copy", R.string.Copy));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_COPY2);
arrayList.add(Integer.valueOf((int) R.drawable.msg_copy));
arrayList2.add(LocaleController.getString("Call", R.string.Call));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.CALL2);
arrayList.add(Integer.valueOf((int) R.drawable.msg_callback));
}
}
arrayList2.add(LocaleController.getString("Delete", R.string.Delete));
arrayList3.add(Constants.ChatSelectionPopMenuEnum.MSG_DELETE);
arrayList.add(Integer.valueOf((int) R.drawable.msg_delete));
}
}
if (arrayList3.isEmpty()) {
return;
}
ActionBarPopupWindow actionBarPopupWindow = this.scrimPopupWindow;
if (actionBarPopupWindow != null) {
actionBarPopupWindow.dismiss();
this.scrimPopupWindow = null;
return;
}
final Rect rect = new Rect();
ActionBarPopupWindow.ActionBarPopupWindowLayout actionBarPopupWindowLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getParentActivity());
actionBarPopupWindowLayout.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view2, MotionEvent motionEvent) {
return ChatActivity.this.lambda$createMenu$78$ChatActivity(view, rect, view2, motionEvent);
}
});
actionBarPopupWindowLayout.setDispatchKeyEventListener(new ActionBarPopupWindow.OnDispatchKeyEventListener() {
@Override
public final void onDispatchKeyEvent(KeyEvent keyEvent) {
ChatActivity.this.lambda$createMenu$79$ChatActivity(keyEvent);
}
});
Rect rect2 = new Rect();
Drawable mutate = getParentActivity().getResources().getDrawable(R.drawable.popup_fixed_alert).mutate();
mutate.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogBackground), PorterDuff.Mode.MULTIPLY));
mutate.getPadding(rect2);
actionBarPopupWindowLayout.setBackgroundDrawable(mutate);
final LinearLayout linearLayout = new LinearLayout(getParentActivity());
if (Build.VERSION.SDK_INT >= 21) {
scrollView = new ScrollView(getParentActivity(), null, 0, R.style.scrollbarShapeStyle) {
@Override
protected void onMeasure(int i5, int i6) {
super.onMeasure(i5, i6);
setMeasuredDimension(linearLayout.getMeasuredWidth(), getMeasuredHeight());
}
};
} else {
scrollView = new ScrollView(getParentActivity());
}
scrollView.setClipToPadding(false);
actionBarPopupWindowLayout.addView(scrollView, LayoutHelper.createFrame(-2, -2.0f));
linearLayout.setMinimumWidth(AndroidUtilities.dp(200.0f));
linearLayout.setOrientation(1);
int size2 = arrayList2.size();
for (final int i5 = 0; i5 < size2; i5++) {
ActionBarMenuSubItem actionBarMenuSubItem = new ActionBarMenuSubItem(getParentActivity());
actionBarMenuSubItem.setTextAndIcon((CharSequence) arrayList2.get(i5), ((Integer) arrayList.get(i5)).intValue());
linearLayout.addView(actionBarMenuSubItem);
actionBarMenuSubItem.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
ChatActivity.this.lambda$createMenu$80$ChatActivity(i5, arrayList3, view2);
}
});
}
scrollView.addView(linearLayout, LayoutHelper.createScroll(-2, -2, 51));
ActionBarPopupWindow actionBarPopupWindow2 = new ActionBarPopupWindow(actionBarPopupWindowLayout, -2, -2) {
@Override
public void dismiss() {
super.dismiss();
if (ChatActivity.this.scrimPopupWindow != this) {
return;
}
ChatActivity.this.scrimPopupWindow = null;
if (ChatActivity.this.scrimAnimatorSet != null) {
ChatActivity.this.scrimAnimatorSet.cancel();
ChatActivity.this.scrimAnimatorSet = null;
}
if (ChatActivity.this.scrimView instanceof ChatMessageCell) {
((ChatMessageCell) ChatActivity.this.scrimView).setInvalidatesParent(false);
}
ChatActivity.this.chatLayoutManager.setCanScrollVertically(true);
ChatActivity.this.scrimAnimatorSet = new AnimatorSet();
ArrayList arrayList4 = new ArrayList();
arrayList4.add(ObjectAnimator.ofInt(ChatActivity.this.scrimPaint, AnimationProperties.PAINT_ALPHA, 0));
if (ChatActivity.this.pagedownButton.getTag() != null) {
arrayList4.add(ObjectAnimator.ofFloat(ChatActivity.this.pagedownButton, View.ALPHA, 1.0f));
}
if (ChatActivity.this.mentiondownButton.getTag() != null) {
arrayList4.add(ObjectAnimator.ofFloat(ChatActivity.this.mentiondownButton, View.ALPHA, 1.0f));
}
ChatActivity.this.scrimAnimatorSet.playTogether(arrayList4);
ChatActivity.this.scrimAnimatorSet.setDuration(220L);
ChatActivity.this.scrimAnimatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
ChatActivity.this.scrimView = null;
ChatActivity.this.contentView.invalidate();
ChatActivity.this.chatListView.invalidate();
}
});
ChatActivity.this.scrimAnimatorSet.start();
if (ChatActivity.this.chatActivityEnterView != null) {
ChatActivity.this.chatActivityEnterView.getEditField().setAllowDrawCursor(true);
}
if (Build.VERSION.SDK_INT >= 19) {
ChatActivity.this.getParentActivity().getWindow().getDecorView().setImportantForAccessibility(0);
}
}
};
this.scrimPopupWindow = actionBarPopupWindow2;
actionBarPopupWindow2.setDismissAnimationDuration(220);
this.scrimPopupWindow.setOutsideTouchable(true);
this.scrimPopupWindow.setClippingEnabled(true);
this.scrimPopupWindow.setAnimationStyle(R.style.PopupContextAnimation);
this.scrimPopupWindow.setFocusable(true);
actionBarPopupWindowLayout.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000.0f), Integer.MIN_VALUE), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000.0f), Integer.MIN_VALUE));
this.scrimPopupWindow.setInputMethodMode(2);
this.scrimPopupWindow.setSoftInputMode(0);
this.scrimPopupWindow.getContentView().setFocusableInTouchMode(true);
int left = (((view.getLeft() + ((int) f)) - actionBarPopupWindowLayout.getMeasuredWidth()) + rect2.left) - AndroidUtilities.dp(28.0f);
if (left < AndroidUtilities.dp(6.0f)) {
left = AndroidUtilities.dp(6.0f);
} else if (left > (this.chatListView.getMeasuredWidth() - AndroidUtilities.dp(6.0f)) - actionBarPopupWindowLayout.getMeasuredWidth()) {
left = (this.chatListView.getMeasuredWidth() - AndroidUtilities.dp(6.0f)) - actionBarPopupWindowLayout.getMeasuredWidth();
}
if (AndroidUtilities.isTablet()) {
int[] iArr = new int[2];
this.fragmentView.getLocationInWindow(iArr);
left += iArr[0];
}
int height = this.contentView.getHeight();
int measuredHeight = actionBarPopupWindowLayout.getMeasuredHeight();
int keyboardHeight = this.contentView.getKeyboardHeight();
if (keyboardHeight > AndroidUtilities.dp(20.0f)) {
height += keyboardHeight;
}
if (measuredHeight < height) {
i = (int) (this.chatListView.getY() + view.getTop() + f2);
if ((measuredHeight - rect2.top) - rect2.bottom > AndroidUtilities.dp(240.0f)) {
i += AndroidUtilities.dp(240.0f) - measuredHeight;
}
if (i < this.chatListView.getY() + AndroidUtilities.dp(24.0f)) {
i = (int) (this.chatListView.getY() + AndroidUtilities.dp(24.0f));
} else {
int i6 = height - measuredHeight;
if (i > i6 - AndroidUtilities.dp(8.0f)) {
i = i6 - AndroidUtilities.dp(8.0f);
}
}
} else {
i = AndroidUtilities.statusBarHeight;
}
this.scrimPopupWindow.showAtLocation(this.chatListView, 51, left, i);
this.chatListView.stopScroll();
this.chatLayoutManager.setCanScrollVertically(false);
this.scrimView = view;
if (view instanceof ChatMessageCell) {
ChatMessageCell chatMessageCell = (ChatMessageCell) view;
chatMessageCell.setInvalidatesParent(true);
restartSticker(chatMessageCell);
}
this.contentView.invalidate();
this.chatListView.invalidate();
AnimatorSet animatorSet = this.scrimAnimatorSet;
if (animatorSet != null) {
animatorSet.cancel();
}
this.scrimAnimatorSet = new AnimatorSet();
ArrayList arrayList4 = new ArrayList();
arrayList4.add(ObjectAnimator.ofInt(this.scrimPaint, AnimationProperties.PAINT_ALPHA, 0, 50));
if (this.pagedownButton.getTag() != null) {
arrayList4.add(ObjectAnimator.ofFloat(this.pagedownButton, View.ALPHA, 0.0f));
}
if (this.mentiondownButton.getTag() != null) {
arrayList4.add(ObjectAnimator.ofFloat(this.mentiondownButton, View.ALPHA, 0.0f));
}
this.scrimAnimatorSet.playTogether(arrayList4);
this.scrimAnimatorSet.setDuration(150L);
this.scrimAnimatorSet.start();
HintView hintView = this.forwardHintView;
if (hintView != null) {
hintView.hide();
}
HintView hintView2 = this.noSoundHintView;
if (hintView2 != null) {
hintView2.hide();
}
HintView hintView3 = this.slowModeHint;
if (hintView3 != null) {
hintView3.hide();
}
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null) {
chatActivityEnterView.getEditField().setAllowDrawCursor(false);
}
if (Build.VERSION.SDK_INT >= 19) {
getParentActivity().getWindow().getDecorView().setImportantForAccessibility(4);
return;
}
return;
}
ChatActivityEnterView chatActivityEnterView2 = this.chatActivityEnterView;
if (chatActivityEnterView2 == null || !(chatActivityEnterView2.isRecordingAudioVideo() || this.chatActivityEnterView.isRecordLocked())) {
ActionBarMenuItem item = this.actionBar.createActionMode().getItem(12);
if (item != null) {
item.setVisibility(0);
}
if (isSysNotifyMessage().booleanValue()) {
this.bottomMessagesActionContainer.setVisibility(8);
} else {
this.bottomMessagesActionContainer.setVisibility(0);
}
int measuredHeight2 = this.chatActivityEnterView.getMeasuredHeight() - AndroidUtilities.dp(51.0f);
if (this.chatActivityEnterView.getVisibility() == 0) {
ArrayList arrayList5 = new ArrayList();
arrayList5.add(this.chatActivityEnterView);
FrameLayout frameLayout2 = this.mentionContainer;
if (frameLayout2 != null && frameLayout2.getVisibility() == 0) {
arrayList5.add(this.mentionContainer);
}
FrameLayout frameLayout3 = this.stickersPanel;
if (frameLayout3 != null && frameLayout3.getVisibility() == 0) {
arrayList5.add(this.stickersPanel);
}
this.actionBar.showActionMode(this.bottomMessagesActionContainer, null, (View[]) arrayList5.toArray(new View[0]), new boolean[]{false, true, true}, this.chatListView, measuredHeight2);
if (!Theme.getCurrentTheme().isDark()) {
this.actionBar.setBackButtonImage(R.drawable.back_black);
}
if (getParentActivity() != null) {
((LaunchActivity) getParentActivity()).hideVisibleActionMode();
}
this.chatActivityEnterView.getEditField().setAllowDrawCursor(false);
} else if (this.bottomOverlayChat.getVisibility() == 0) {
this.actionBar.showActionMode(this.bottomMessagesActionContainer, null, new View[]{this.bottomOverlayChat}, new boolean[]{true}, this.chatListView, measuredHeight2);
if (!Theme.getCurrentTheme().isDark()) {
this.actionBar.setBackButtonImage(R.drawable.back_black);
}
} else if (this.searchContainer.getVisibility() == 0) {
this.actionBar.showActionMode(this.bottomMessagesActionContainer, null, new View[]{this.searchContainer}, new boolean[]{true}, this.chatListView, measuredHeight2);
if (!Theme.getCurrentTheme().isDark()) {
this.actionBar.setBackButtonImage(R.drawable.back_black);
}
} else {
this.actionBar.showActionMode(this.bottomMessagesActionContainer, null, null, null, this.chatListView, measuredHeight2);
if (!Theme.getCurrentTheme().isDark()) {
this.actionBar.setBackButtonImage(R.drawable.back_black);
}
}
ActionBarPopupWindow actionBarPopupWindow3 = this.scrimPopupWindow;
if (actionBarPopupWindow3 != null) {
actionBarPopupWindow3.dismiss();
}
this.chatLayoutManager.setCanScrollVertically(true);
updatePinnedMessageView(true);
AnimatorSet animatorSet2 = new AnimatorSet();
ArrayList arrayList6 = new ArrayList();
for (int i7 = 0; i7 < this.actionModeViews.size(); i7++) {
View view2 = this.actionModeViews.get(i7);
view2.setPivotY(ActionBar.getCurrentActionBarHeight() / 2);
AndroidUtilities.clearDrawableAnimation(view2);
arrayList6.add(ObjectAnimator.ofFloat(view2, View.SCALE_Y, 0.1f, 1.0f));
}
animatorSet2.playTogether(arrayList6);
animatorSet2.setDuration(250L);
animatorSet2.start();
addToSelectedMessages(messageObject, z2);
this.selectedMessagesCountTextView.setNumber(this.selectedMessagesIds[0].size() + this.selectedMessagesIds[1].size(), false);
updateVisibleRows();
return;
}
return;
}
} else if (this.currentEncryptedChat == null && (userFull = this.userInfo) != null) {
z4 = userFull.can_pin_message;
if (z4) {
}
if (messageObject.getDialogId() == this.mergeDialogId) {
}
if (messageObject.canEditMessage(this.currentChat)) {
}
if (z5) {
size = validGroupedMessage.messages.size();
int i42 = 0;
while (i2 < size) {
}
if (i42 >= 2) {
}
}
if (this.inScheduleMode) {
}
if (!z) {
}
if (getParentActivity() == null) {
}
}
}
z4 = false;
if (z4) {
}
if (messageObject.getDialogId() == this.mergeDialogId) {
}
if (messageObject.canEditMessage(this.currentChat)) {
}
if (z5) {
}
if (this.inScheduleMode) {
}
if (!z) {
}
if (getParentActivity() == null) {
}
}
public boolean lambda$createMenu$78$ChatActivity(View view, Rect rect, View view2, MotionEvent motionEvent) {
ActionBarPopupWindow actionBarPopupWindow;
if (motionEvent.getActionMasked() == 0) {
ActionBarPopupWindow actionBarPopupWindow2 = this.scrimPopupWindow;
if (actionBarPopupWindow2 == null || !actionBarPopupWindow2.isShowing()) {
return false;
}
view.getHitRect(rect);
if (rect.contains((int) motionEvent.getX(), (int) motionEvent.getY())) {
return false;
}
this.scrimPopupWindow.dismiss();
return false;
} else if (motionEvent.getActionMasked() == 4 && (actionBarPopupWindow = this.scrimPopupWindow) != null && actionBarPopupWindow.isShowing()) {
this.scrimPopupWindow.dismiss();
return false;
} else {
return false;
}
}
public void lambda$createMenu$79$ChatActivity(KeyEvent keyEvent) {
ActionBarPopupWindow actionBarPopupWindow;
if (keyEvent.getKeyCode() == 4 && keyEvent.getRepeatCount() == 0 && (actionBarPopupWindow = this.scrimPopupWindow) != null && actionBarPopupWindow.isShowing()) {
this.scrimPopupWindow.dismiss();
}
}
public void lambda$createMenu$80$ChatActivity(int i, ArrayList arrayList, View view) {
if (this.selectedObject == null || i < 0 || i >= arrayList.size()) {
return;
}
processSelectedOption((Constants.ChatSelectionPopMenuEnum) arrayList.get(i));
ActionBarPopupWindow actionBarPopupWindow = this.scrimPopupWindow;
if (actionBarPopupWindow != null) {
actionBarPopupWindow.dismiss();
}
}
public void startEditingMessageObject(MessageObject messageObject) {
if (messageObject == null || getParentActivity() == null) {
return;
}
if (this.searchItem != null && this.actionBar.isSearchFieldVisible()) {
this.actionBar.closeSearchField();
this.chatActivityEnterView.setFieldFocused();
}
this.mentionsAdapter.setNeedBotContext(false);
this.chatActivityEnterView.setVisibility(0);
showFieldPanelForEdit(true, messageObject);
updateBottomOverlay();
checkEditTimer();
this.chatActivityEnterView.setAllowStickersAndGifs(false, false);
updatePinnedMessageView(true);
updateVisibleRows();
if (!messageObject.scheduled) {
TLRPC.TL_messages_getMessageEditData tL_messages_getMessageEditData = new TLRPC.TL_messages_getMessageEditData();
tL_messages_getMessageEditData.peer = getMessagesController().getInputPeer((int) this.dialog_id);
tL_messages_getMessageEditData.id = messageObject.getId();
this.editingMessageObjectReqId = getConnectionsManager().sendRequest(tL_messages_getMessageEditData, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChatActivity.this.lambda$startEditingMessageObject$82$ChatActivity(tLObject, tL_error);
}
});
return;
}
this.chatActivityEnterView.showEditDoneProgress(false, true);
}
public void lambda$startEditingMessageObject$82$ChatActivity(final TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$81$ChatActivity(tLObject);
}
});
}
public void lambda$null$81$ChatActivity(TLObject tLObject) {
this.editingMessageObjectReqId = 0;
if (tLObject == null) {
if (getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("EditMessageError", R.string.EditMessageError));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
showDialog(builder.create());
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null) {
chatActivityEnterView.setEditingMessageObject(null, false);
hideFieldPanel(true);
return;
}
return;
}
ChatActivityEnterView chatActivityEnterView2 = this.chatActivityEnterView;
if (chatActivityEnterView2 != null) {
chatActivityEnterView2.showEditDoneProgress(false, true);
}
}
public void restartSticker(ChatMessageCell chatMessageCell) {
RLottieDrawable lottieAnimation;
MessageObject messageObject = chatMessageCell.getMessageObject();
TLRPC.Document document = messageObject.getDocument();
if ((messageObject.isAnimatedEmoji() || (MessageObject.isAnimatedStickerDocument(document) && !SharedConfig.loopStickers)) && (lottieAnimation = chatMessageCell.getPhotoImage().getLottieAnimation()) != null) {
lottieAnimation.restart();
if (messageObject.isAnimatedEmoji() && "❤".equals(messageObject.getStickerEmoji())) {
HashMap<Integer, Integer> hashMap = new HashMap<>();
hashMap.put(1, 1);
hashMap.put(13, 0);
hashMap.put(59, 1);
hashMap.put(71, 0);
hashMap.put(128, 1);
hashMap.put(140, 0);
lottieAnimation.setVibrationPattern(hashMap);
}
}
}
public String getMessageContent(MessageObject messageObject, int i, boolean z) {
TLRPC.Chat chat;
TLRPC.User user;
String str = "";
if (z && i != messageObject.messageOwner.from_id) {
if (messageObject.messageOwner.from_id > 0) {
if (getMessagesController().getUser(Integer.valueOf(messageObject.messageOwner.from_id)) != null) {
str = ContactsController.formatName(user.first_name, user.last_name) + ":\n";
}
} else if (messageObject.messageOwner.from_id < 0 && (chat = getMessagesController().getChat(Integer.valueOf(-messageObject.messageOwner.from_id))) != null) {
str = chat.title + ":\n";
}
}
if ((messageObject.type == 0 || messageObject.isAnimatedEmoji()) && messageObject.messageOwner.message != null) {
return str + ((Object) messageObject.messageText);
} else if (messageObject.messageOwner.media != null && messageObject.messageOwner.message != null) {
return str + ((Object) messageObject.messageText);
} else {
return str + ((Object) messageObject.messageText);
}
}
private void saveMessageToGallery(MessageObject messageObject) {
String str = messageObject.messageOwner.attachPath;
if (!TextUtils.isEmpty(str) && !new File(str).exists()) {
str = null;
}
if (TextUtils.isEmpty(str)) {
str = FileLoader.getPathToMessage(messageObject.messageOwner).toString();
}
MediaController.saveFile(str, getParentActivity(), messageObject.isVideo() ? 1 : 0, null, null);
}
public void parseQRCodeResult(String str, boolean z) {
String substring;
if (str == null) {
str = "";
}
String str2 = getMessagesController().sharePrefix + "&Key=";
if (str.startsWith(str2) || str.startsWith("https://m12345.cc") || str.startsWith("http://m12345.cc") || str.startsWith("m12345.cc") || str.startsWith("m12345.cc")) {
if (str.startsWith(str2)) {
String str3 = new String(Base64.decode(str.substring(str2.length()).replace("%3D", "="), 0));
String[] split = str3.split("#");
String str4 = split[0].split("=")[1];
String str5 = split[1].split("=")[1];
if (str3.contains("Uname")) {
getMessagesController().openByUserName(split[2].split("=")[1], (BaseFragment) this, 1, true);
return;
}
TLRPC.TL_user tL_user = new TLRPC.TL_user();
try {
tL_user.id = Integer.parseInt(str4);
tL_user.access_hash = Long.parseLong(str5);
getUserInfo(tL_user);
return;
} catch (NumberFormatException e) {
FileLog.e("parse qr code err:" + e);
return;
}
}
if (str.startsWith("http://m12345.cc")) {
substring = str.substring(16);
} else if (str.startsWith("https://m12345.cc")) {
substring = str.substring(17);
} else if (str.startsWith("m12345.cc")) {
substring = str.substring(9);
} else {
substring = str.substring(9);
}
boolean startsWith = substring.startsWith("/g/");
boolean startsWith2 = substring.startsWith("/u/");
if (startsWith || startsWith2) {
String str6 = new String(Base64.decode(substring.substring(substring.lastIndexOf("/") + 1), 0));
if (startsWith) {
getMessagesController().openByUserName(str6.substring(str6.lastIndexOf("/") + 1), (BaseFragment) this, 1, true);
return;
}
String[] split2 = str6.substring(0, str6.length() - 4).split("&", 2);
String str7 = split2[0];
String str8 = split2[1];
TLRPC.TL_user tL_user2 = new TLRPC.TL_user();
try {
tL_user2.id = Integer.parseInt(str7);
tL_user2.access_hash = Long.parseLong(str8);
getUserInfo(tL_user2);
return;
} catch (NumberFormatException e2) {
FileLog.e("parse qr code err:" + e2);
return;
}
}
if (substring.contains("joinchat/")) {
startsWith = true;
}
String substring2 = substring.substring(substring.lastIndexOf("/") + 1);
if (!startsWith) {
getMessagesController().openByUserName(substring2, (BaseFragment) this, 1, true);
} else {
Browser.openUrl(getParentActivity(), str, this.inlineReturn == 0);
}
} else if (str.startsWith("https://m12345.cc/authtoken/")) {
} else {
if (URLUtil.isNetworkUrl(str)) {
if (SharedConfig.customTabs) {
presentFragment(new WebviewActivity(str, (String) null));
return;
} else {
Browser.openUrl(getParentActivity(), str, this.inlineReturn == 0);
return;
}
}
presentFragment(new QrScanResultActivity(str), true);
}
}
private void getUserInfo(TLRPC.User user) {
TLRPC.TL_users_getFullUser tL_users_getFullUser = new TLRPC.TL_users_getFullUser();
tL_users_getFullUser.id = getMessagesController().getInputUser(user);
getConnectionsManager().bindRequestToGuid(getConnectionsManager().sendRequest(tL_users_getFullUser, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChatActivity.this.lambda$getUserInfo$84$ChatActivity(tLObject, tL_error);
}
}), this.classGuid);
}
public void lambda$getUserInfo$84$ChatActivity(final TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$83$ChatActivity(tLObject);
}
});
}
}
public void lambda$null$83$ChatActivity(TLObject tLObject) {
TLRPC.UserFull userFull = (TLRPC.UserFull) tLObject;
getMessagesController().putUser(userFull.user, false);
if (userFull.user.self || userFull.user.contact) {
Bundle bundle = new Bundle();
bundle.putInt("user_id", userFull.user.id);
presentFragment(new NewProfileActivity(bundle));
return;
}
Bundle bundle2 = new Bundle();
bundle2.putInt("from_type", 1);
presentFragment(new AddContactsInfoActivity(bundle2, userFull.user));
}
private void processSelectedOption(Constants.ChatSelectionPopMenuEnum chatSelectionPopMenuEnum) {
?? r1;
File file;
TLRPC.Chat chat;
Object obj;
TLRPC.Chat chat2;
final boolean[] zArr;
if (this.selectedObject == null || getParentActivity() == null) {
return;
}
int i = 0;
switch (AnonymousClass76.$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[chatSelectionPopMenuEnum.ordinal()]) {
case 1:
if (this.selectedObjectGroup != null) {
for (int i2 = 0; i2 < this.selectedObjectGroup.messages.size(); i2++) {
if (!getSendMessagesHelper().retrySendMessage(this.selectedObjectGroup.messages.get(i2), false)) {
r15 = 0;
}
}
if (r15 != 0 && !this.inScheduleMode) {
moveScrollToLastMessage();
}
} else if (getSendMessagesHelper().retrySendMessage(this.selectedObject, false)) {
updateVisibleRows();
if (!this.inScheduleMode) {
moveScrollToLastMessage();
}
}
r1 = 0;
break;
case 2:
if (getParentActivity() == null) {
this.selectedObject = null;
this.selectedObjectToEditCaption = null;
this.selectedObjectGroup = null;
return;
}
createDeleteMessagesAlert(this.selectedObject, this.selectedObjectGroup);
r1 = 0;
break;
case 3:
this.forwardingMessage = this.selectedObject;
this.forwardingMessageGroup = this.selectedObjectGroup;
Bundle bundle = new Bundle();
bundle.putBoolean("onlySelect", true);
bundle.putInt("dialogsType", 3);
MessageObject.GroupedMessages groupedMessages = this.forwardingMessageGroup;
bundle.putInt("messagesCount", groupedMessages != null ? groupedMessages.messages.size() : 1);
DialogsActivity dialogsActivity = new DialogsActivity(bundle);
DialogsActivity.setTempForwardMessageObject(this.selectedObject);
dialogsActivity.setDelegate(this);
presentFragment(dialogsActivity);
r1 = 0;
break;
case 4:
CharSequence messageCaption = getMessageCaption(this.selectedObject, this.selectedObjectGroup);
if (messageCaption != null) {
AndroidUtilities.addToClipboard(messageCaption);
} else {
AndroidUtilities.addToClipboard(getMessageContent(this.selectedObject, 0, false));
}
r1 = 0;
break;
case 5:
AndroidUtilities.addToClipboard(this.selectedObject.messageOwner.media.phone_number);
r1 = 0;
break;
case 6:
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(PermissionUtils.EXTERNAL_STORAGE) != 0) {
getParentActivity().requestPermissions(new String[]{PermissionUtils.EXTERNAL_STORAGE}, 4);
this.selectedObject = null;
this.selectedObjectGroup = null;
this.selectedObjectToEditCaption = null;
return;
}
if (this.selectedObjectGroup != null) {
while (i < this.selectedObjectGroup.messages.size()) {
saveMessageToGallery(this.selectedObjectGroup.messages.get(i));
i++;
}
} else {
saveMessageToGallery(this.selectedObject);
}
r1 = 0;
break;
break;
case 7:
String str = this.selectedObject.messageOwner.attachPath;
if (str != null && str.length() > 0 && !new File(str).exists()) {
str = null;
}
if (str == null || str.length() == 0) {
str = FileLoader.getPathToMessage(this.selectedObject.messageOwner).toString();
}
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(PermissionUtils.EXTERNAL_STORAGE) != 0) {
getParentActivity().requestPermissions(new String[]{PermissionUtils.EXTERNAL_STORAGE}, 4);
this.selectedObject = null;
this.selectedObjectGroup = null;
this.selectedObjectToEditCaption = null;
return;
}
r1 = 0;
MediaController.saveFile(str, getParentActivity(), 0, null, null);
break;
break;
case 8:
if (!TextUtils.isEmpty(this.selectedObject.messageOwner.attachPath)) {
file = new File(this.selectedObject.messageOwner.attachPath);
break;
}
file = null;
if (file == null) {
File pathToMessage = FileLoader.getPathToMessage(this.selectedObject.messageOwner);
if (pathToMessage.exists()) {
file = pathToMessage;
}
}
if (file != null) {
if (file.getName().toLowerCase().endsWith("attheme")) {
Theme.ThemeInfo applyThemeFile = Theme.applyThemeFile(file, this.selectedObject.getDocumentName(), null, true);
if (applyThemeFile != null) {
presentFragment(new ThemePreviewActivity(applyThemeFile));
} else {
this.scrollToPositionOnRecreate = -1;
if (getParentActivity() == null) {
this.selectedObject = null;
this.selectedObjectGroup = null;
this.selectedObjectToEditCaption = null;
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("IncorrectTheme", R.string.IncorrectTheme));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
showDialog(builder.create());
}
} else if (LocaleController.getInstance().applyLanguageFile(file, this.currentAccount)) {
presentFragment(new LanguageSelectActivity());
} else if (getParentActivity() == null) {
this.selectedObject = null;
this.selectedObjectGroup = null;
this.selectedObjectToEditCaption = null;
return;
} else {
AlertDialog.Builder builder2 = new AlertDialog.Builder(getParentActivity());
builder2.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder2.setMessage(LocaleController.getString("IncorrectLocalization", R.string.IncorrectLocalization));
builder2.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
showDialog(builder2.create());
}
}
r1 = 0;
break;
case 9:
String str2 = this.selectedObject.messageOwner.attachPath;
if (str2 != null && str2.length() > 0 && !new File(str2).exists()) {
str2 = null;
}
if (str2 == null || str2.length() == 0) {
str2 = FileLoader.getPathToMessage(this.selectedObject.messageOwner).toString();
}
Intent intent = new Intent("android.intent.action.SEND");
intent.setType(this.selectedObject.getDocument().mime_type);
File file2 = new File(str2);
if (Build.VERSION.SDK_INT >= 24) {
try {
intent.putExtra("android.intent.extra.STREAM", FileProvider.getUriForFile(getParentActivity(), "im.ovithmjoec.messenger.provider", file2));
intent.setFlags(1);
} catch (Exception unused) {
intent.putExtra("android.intent.extra.STREAM", Uri.fromFile(file2));
}
} else {
intent.putExtra("android.intent.extra.STREAM", Uri.fromFile(file2));
}
try {
getParentActivity().startActivityForResult(Intent.createChooser(intent, LocaleController.getString("ShareFile", R.string.ShareFile)), 500);
} catch (Throwable unused2) {
break;
}
break;
case 10:
showFieldPanelForReply(this.selectedObject);
r1 = 0;
break;
case 11:
showDialog(new StickersAlert(getParentActivity(), this, this.selectedObject.getInputStickerSet(), null, (this.bottomOverlayChat.getVisibility() == 0 || !((chat = this.currentChat) == null || ChatObject.canSendStickers(chat))) ? null : this.chatActivityEnterView));
r1 = 0;
break;
case 12:
if (Build.VERSION.SDK_INT >= 23 && getParentActivity().checkSelfPermission(PermissionUtils.EXTERNAL_STORAGE) != 0) {
getParentActivity().requestPermissions(new String[]{PermissionUtils.EXTERNAL_STORAGE}, 4);
this.selectedObject = null;
this.selectedObjectGroup = null;
this.selectedObjectToEditCaption = null;
return;
}
String documentFileName = FileLoader.getDocumentFileName(this.selectedObject.getDocument());
if (TextUtils.isEmpty(documentFileName)) {
documentFileName = this.selectedObject.getFileName();
}
String str3 = this.selectedObject.messageOwner.attachPath;
if (str3 != null && str3.length() > 0 && !new File(str3).exists()) {
str3 = null;
}
if (str3 == null || str3.length() == 0) {
str3 = FileLoader.getPathToMessage(this.selectedObject.messageOwner).toString();
}
MediaController.saveFile(str3, getParentActivity(), this.selectedObject.isMusic() ? 3 : 2, documentFileName, this.selectedObject.getDocument() != null ? this.selectedObject.getDocument().mime_type : "");
r1 = 0;
break;
break;
case 13:
TLRPC.Document document = this.selectedObject.getDocument();
getMessagesController().saveGif(this.selectedObject, document);
showGifHint();
this.chatActivityEnterView.addRecentGif(document);
r1 = 0;
break;
case 14:
this.chatActivityEnterView.removeRecentGif(this.selectedObject.getDocument());
r1 = 0;
break;
case 15:
obj = null;
MessageObject messageObject = this.selectedObjectToEditCaption;
if (messageObject != null) {
startEditingMessageObject(messageObject);
} else {
startEditingMessageObject(this.selectedObject);
}
this.selectedObject = null;
this.selectedObjectGroup = null;
this.selectedObjectToEditCaption = null;
r1 = obj;
break;
case 16:
final int id = this.selectedObject.getId();
AlertDialog.Builder builder3 = new AlertDialog.Builder(getParentActivity());
builder3.setTitle(LocaleController.getString("PinMessageAlertTitle", R.string.PinMessageAlertTitle));
if (this.currentUser != null) {
builder3.setMessage(LocaleController.getString("PinMessageAlertChat", R.string.PinMessageAlertChat));
zArr = new boolean[]{false};
} else if ((ChatObject.isChannel(this.currentChat) && this.currentChat.megagroup) || ((chat2 = this.currentChat) != null && !ChatObject.isChannel(chat2))) {
builder3.setMessage(LocaleController.getString("PinMessageAlert", R.string.PinMessageAlert));
final boolean[] zArr2 = {true};
FrameLayout frameLayout = new FrameLayout(getParentActivity());
CheckBoxCell checkBoxCell = new CheckBoxCell(getParentActivity(), 1);
checkBoxCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
checkBoxCell.setText(LocaleController.formatString("PinNotify", R.string.PinNotify, new Object[0]), "", true, false);
checkBoxCell.setPadding(LocaleController.isRTL ? AndroidUtilities.dp(8.0f) : 0, 0, LocaleController.isRTL ? 0 : AndroidUtilities.dp(8.0f), 0);
frameLayout.addView(checkBoxCell, LayoutHelper.createFrame(-1.0f, 48.0f, 51, 8.0f, 0.0f, 8.0f, 0.0f));
checkBoxCell.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivity.lambda$processSelectedOption$85(zArr2, view);
}
});
builder3.setView(frameLayout);
zArr = zArr2;
} else {
builder3.setMessage(LocaleController.getString("PinMessageAlertChannel", R.string.PinMessageAlertChannel));
zArr = new boolean[]{false};
}
builder3.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i3) {
ChatActivity.this.lambda$processSelectedOption$86$ChatActivity(id, zArr, dialogInterface, i3);
}
});
obj = null;
builder3.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder3.create());
r1 = obj;
break;
case 17:
AlertDialog.Builder builder4 = new AlertDialog.Builder(getParentActivity());
builder4.setTitle(LocaleController.getString("UnpinMessageAlertTitle", R.string.UnpinMessageAlertTitle));
builder4.setMessage(LocaleController.getString("UnpinMessageAlert", R.string.UnpinMessageAlert));
builder4.setPositiveButton(LocaleController.getString("UnpinMessage", R.string.UnpinMessage), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i3) {
ChatActivity.this.lambda$processSelectedOption$87$ChatActivity(dialogInterface, i3);
}
});
builder4.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder4.create());
r1 = 0;
break;
case 18:
TLRPC.User user = getMessagesController().getUser(Integer.valueOf(this.selectedObject.messageOwner.media.user_id));
if (user != null) {
presentFragment(new AddContactsInfoActivity(null, user));
}
r1 = 0;
break;
case 19:
if (this.currentUser != null && (this.selectedObject.messageOwner.action instanceof TLRPC.TL_messageActionPhoneCall)) {
int i3 = ((TLRPC.TL_messageActionPhoneCall) this.selectedObject.messageOwner.action).flags & 4;
if (ApplicationLoader.mbytAVideoCallBusy == 0) {
if (MessagesController.getInstance(this.currentAccount).getUser(Integer.valueOf(this.arguments.getInt("user_id", 0))).mutual_contact) {
int connectionState = ConnectionsManager.getInstance(this.currentAccount).getConnectionState();
if (connectionState == 2 || connectionState == 1) {
ToastUtils.show((CharSequence) LocaleController.getString("visual_call_no_network", R.string.visual_call_no_network));
}
} else {
ToastUtils.show((CharSequence) LocaleController.getString("visual_call_no_friend_tip", R.string.visual_call_no_friend_tip));
}
} else if (ApplicationLoader.mbytAVideoCallBusy == 3 || ApplicationLoader.mbytAVideoCallBusy == 4) {
ToastUtils.show((CharSequence) LocaleController.getString("visual_call_busing_tip", R.string.visual_call_busing_tip));
}
}
r1 = 0;
break;
case 20:
try {
Intent intent2 = new Intent("android.intent.action.DIAL", Uri.parse("tel:" + this.selectedObject.messageOwner.media.phone_number));
intent2.addFlags(C.ENCODING_PCM_MU_LAW);
getParentActivity().startActivityForResult(intent2, 500);
} catch (Exception e) {
FileLog.e(e);
}
r1 = 0;
break;
case 21:
VoIPHelper.showRateAlert(getParentActivity(), (TLRPC.TL_messageActionPhoneCall) this.selectedObject.messageOwner.action);
r1 = 0;
break;
case 22:
MediaDataController mediaDataController = getMediaDataController();
MessageObject messageObject2 = this.selectedObject;
mediaDataController.addRecentSticker(2, messageObject2, messageObject2.getDocument(), (int) (System.currentTimeMillis() / 1000), false);
r1 = 0;
break;
case 23:
MediaDataController mediaDataController2 = getMediaDataController();
MessageObject messageObject3 = this.selectedObject;
mediaDataController2.addRecentSticker(2, messageObject3, messageObject3.getDocument(), (int) (System.currentTimeMillis() / 1000), true);
r1 = 0;
break;
case 24:
TLRPC.TL_channels_exportMessageLinkV2 tL_channels_exportMessageLinkV2 = new TLRPC.TL_channels_exportMessageLinkV2();
tL_channels_exportMessageLinkV2.id = this.selectedObject.getId();
tL_channels_exportMessageLinkV2.channel = MessagesController.getInputChannel(this.currentChat);
tL_channels_exportMessageLinkV2.isGroup = this.currentChat.megagroup;
getConnectionsManager().sendRequest(tL_channels_exportMessageLinkV2, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.lambda$null$88(TLObject.this);
}
});
}
});
r1 = 0;
break;
case 25:
AlertsCreator.createReportAlert(getParentActivity(), this.dialog_id, this.selectedObject.getId(), this);
r1 = 0;
break;
case 26:
if (this.selectedObject.isEditing() || (this.selectedObject.isSending() && this.selectedObjectGroup == null)) {
getSendMessagesHelper().cancelSendingMessage(this.selectedObject);
} else if (this.selectedObject.isSending() && this.selectedObjectGroup != null) {
while (i < this.selectedObjectGroup.messages.size()) {
getSendMessagesHelper().cancelSendingMessage(new ArrayList<>(this.selectedObjectGroup.messages));
i++;
}
}
r1 = 0;
break;
case 27:
final AlertDialog[] alertDialogArr = {new AlertDialog(getParentActivity(), 3)};
final int sendVote = getSendMessagesHelper().sendVote(this.selectedObject, null, new Runnable() {
@Override
public final void run() {
ChatActivity.lambda$processSelectedOption$90(alertDialogArr);
}
});
if (sendVote != 0) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$processSelectedOption$92$ChatActivity(alertDialogArr, sendVote);
}
}, 500L);
}
r1 = 0;
break;
case 28:
final MessageObject messageObject4 = this.selectedObject;
AlertDialog.Builder builder5 = new AlertDialog.Builder(getParentActivity());
builder5.setTitle(LocaleController.getString("StopPollAlertTitle", R.string.StopPollAlertTitle));
builder5.setMessage(LocaleController.getString("StopPollAlertText", R.string.StopPollAlertText));
builder5.setPositiveButton(LocaleController.getString("Stop", R.string.Stop), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i4) {
ChatActivity.this.lambda$processSelectedOption$98$ChatActivity(messageObject4, dialogInterface, i4);
}
});
builder5.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder5.create());
r1 = 0;
break;
case 29:
QrCodeParseUtil.tryParseQrCode(this, this.currentAccount, CodeUtils.parseQRCode(FileLoader.getPathToMessage(this.selectedObject.messageOwner).toString()), false, false, false, this.inlineReturn == 0);
r1 = 0;
break;
case 30:
if (!checkSlowMode(this.chatActivityEnterView.getSendButton())) {
if (getMediaController().isPlayingMessage(this.selectedObject)) {
getMediaController().cleanupPlayer(true, true);
}
final TLRPC.TL_messages_sendScheduledMessages tL_messages_sendScheduledMessages = new TLRPC.TL_messages_sendScheduledMessages();
tL_messages_sendScheduledMessages.peer = MessagesController.getInstance(this.currentAccount).getInputPeer((int) this.dialog_id);
if (this.selectedObjectGroup != null) {
while (i < this.selectedObjectGroup.messages.size()) {
tL_messages_sendScheduledMessages.id.add(Integer.valueOf(this.selectedObjectGroup.messages.get(i).getId()));
i++;
}
} else {
tL_messages_sendScheduledMessages.id.add(Integer.valueOf(this.selectedObject.getId()));
}
ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_messages_sendScheduledMessages, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChatActivity.this.lambda$processSelectedOption$101$ChatActivity(tL_messages_sendScheduledMessages, tLObject, tL_error);
}
});
r1 = 0;
break;
}
final MessageObject messageObject5 = this.selectedObject;
final MessageObject.GroupedMessages groupedMessages2 = this.selectedObjectGroup;
AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), UserObject.isUserSelf(this.currentUser), messageObject5.messageOwner.date, new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public final void didSelectDate(boolean z, int i4) {
ChatActivity.this.lambda$processSelectedOption$102$ChatActivity(groupedMessages2, messageObject5, z, i4);
}
}, null);
r1 = 0;
case 31:
final MessageObject messageObject52 = this.selectedObject;
final MessageObject.GroupedMessages groupedMessages22 = this.selectedObjectGroup;
AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), UserObject.isUserSelf(this.currentUser), messageObject52.messageOwner.date, new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public final void didSelectDate(boolean z, int i4) {
ChatActivity.this.lambda$processSelectedOption$102$ChatActivity(groupedMessages22, messageObject52, z, i4);
}
}, null);
r1 = 0;
break;
case 32:
MessageObject messageObject6 = this.selectedObject;
if (messageObject6.type == 2) {
convertAudioFile(messageObject6);
} else {
translateStart(messageObject6);
}
r1 = 0;
break;
case 33:
translateCancel(this.selectedObject);
r1 = 0;
break;
default:
r1 = 0;
break;
}
this.selectedObject = r1;
this.selectedObjectGroup = r1;
this.selectedObjectToEditCaption = r1;
}
public static class AnonymousClass76 {
static final int[] $SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum;
static {
int[] iArr = new int[Constants.ChatSelectionPopMenuEnum.values().length];
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum = iArr;
try {
iArr[Constants.ChatSelectionPopMenuEnum.MSG_SEND_RETRY.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_DELETE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_FORWARD.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_COPY1.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_COPY2.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.PIC_SAVE_TO_GALLERY1.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.PIC_SAVE_TO_GALLERY2.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.LANGUAGE_OR_THEME.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_SHARE.ordinal()] = 9;
} catch (NoSuchFieldError unused9) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_REPLAY.ordinal()] = 10;
} catch (NoSuchFieldError unused10) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.STICKER_OR_MASKS.ordinal()] = 11;
} catch (NoSuchFieldError unused11) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_DOWNLOAD.ordinal()] = 12;
} catch (NoSuchFieldError unused12) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.GIF_SAVE.ordinal()] = 13;
} catch (NoSuchFieldError unused13) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.GIF_REMOVE.ordinal()] = 14;
} catch (NoSuchFieldError unused14) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_EDIT.ordinal()] = 15;
} catch (NoSuchFieldError unused15) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_PIN.ordinal()] = 16;
} catch (NoSuchFieldError unused16) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_UNPIN.ordinal()] = 17;
} catch (NoSuchFieldError unused17) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.CONTACT_ADD.ordinal()] = 18;
} catch (NoSuchFieldError unused18) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.CALL_BACK_OR_CALL_AGAIN.ordinal()] = 19;
} catch (NoSuchFieldError unused19) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.CALL2.ordinal()] = 20;
} catch (NoSuchFieldError unused20) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.CALL1.ordinal()] = 21;
} catch (NoSuchFieldError unused21) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_FAVE_ADD.ordinal()] = 22;
} catch (NoSuchFieldError unused22) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_FAVE_REMOVE.ordinal()] = 23;
} catch (NoSuchFieldError unused23) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_COPY_LINK.ordinal()] = 24;
} catch (NoSuchFieldError unused24) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_REPORT.ordinal()] = 25;
} catch (NoSuchFieldError unused25) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_CANCEL_SENDING.ordinal()] = 26;
} catch (NoSuchFieldError unused26) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.POLL_CANCEL.ordinal()] = 27;
} catch (NoSuchFieldError unused27) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.POLL_STOP.ordinal()] = 28;
} catch (NoSuchFieldError unused28) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.QR_CODE_PARSE.ordinal()] = 29;
} catch (NoSuchFieldError unused29) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_SEND_NOW.ordinal()] = 30;
} catch (NoSuchFieldError unused30) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.MSG_SCHEDULE_EDIT_TIME.ordinal()] = 31;
} catch (NoSuchFieldError unused31) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.TRANSLATE.ordinal()] = 32;
} catch (NoSuchFieldError unused32) {
}
try {
$SwitchMap$im$ovithmjoec$ui$constants$Constants$ChatSelectionPopMenuEnum[Constants.ChatSelectionPopMenuEnum.TRANSLATE_CANCEL.ordinal()] = 33;
} catch (NoSuchFieldError unused33) {
}
}
}
public static void lambda$processSelectedOption$85(boolean[] zArr, View view) {
zArr[0] = !zArr[0];
((CheckBoxCell) view).setChecked(zArr[0], true);
}
public void lambda$processSelectedOption$86$ChatActivity(int i, boolean[] zArr, DialogInterface dialogInterface, int i2) {
getMessagesController().pinMessage(this.currentChat, this.currentUser, i, zArr[0]);
}
public void lambda$processSelectedOption$87$ChatActivity(DialogInterface dialogInterface, int i) {
getMessagesController().pinMessage(this.currentChat, this.currentUser, 0, false);
}
public static void lambda$null$88(TLObject tLObject) {
if (tLObject != null) {
TLRPC.TL_exportedMessageLink tL_exportedMessageLink = (TLRPC.TL_exportedMessageLink) tLObject;
try {
((ClipboardManager) ApplicationLoader.applicationContext.getSystemService("clipboard")).setPrimaryClip(ClipData.newPlainText("label", tL_exportedMessageLink.link));
if (tL_exportedMessageLink.link.contains("/c/")) {
ToastUtils.show((int) R.string.LinkCopiedPrivate);
} else {
ToastUtils.show((int) R.string.LinkCopied);
}
} catch (Exception e) {
FileLog.e(e);
}
}
}
public static void lambda$processSelectedOption$90(AlertDialog[] alertDialogArr) {
try {
alertDialogArr[0].dismiss();
} catch (Throwable unused) {
}
alertDialogArr[0] = null;
}
public void lambda$processSelectedOption$92$ChatActivity(AlertDialog[] alertDialogArr, final int i) {
if (alertDialogArr[0] == null) {
return;
}
alertDialogArr[0].setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public final void onCancel(DialogInterface dialogInterface) {
ChatActivity.this.lambda$null$91$ChatActivity(i, dialogInterface);
}
});
showDialog(alertDialogArr[0]);
}
public void lambda$null$91$ChatActivity(int i, DialogInterface dialogInterface) {
getConnectionsManager().cancelRequest(i, true);
}
public void lambda$processSelectedOption$98$ChatActivity(MessageObject messageObject, DialogInterface dialogInterface, int i) {
final AlertDialog[] alertDialogArr = {new AlertDialog(getParentActivity(), 3)};
final TLRPC.TL_messages_editMessage tL_messages_editMessage = new TLRPC.TL_messages_editMessage();
TLRPC.TL_messageMediaPoll tL_messageMediaPoll = (TLRPC.TL_messageMediaPoll) messageObject.messageOwner.media;
TLRPC.TL_inputMediaPoll tL_inputMediaPoll = new TLRPC.TL_inputMediaPoll();
tL_inputMediaPoll.poll = new TLRPC.TL_poll();
tL_inputMediaPoll.poll.id = tL_messageMediaPoll.poll.id;
tL_inputMediaPoll.poll.question = tL_messageMediaPoll.poll.question;
tL_inputMediaPoll.poll.answers = tL_messageMediaPoll.poll.answers;
tL_inputMediaPoll.poll.closed = true;
tL_messages_editMessage.media = tL_inputMediaPoll;
tL_messages_editMessage.peer = getMessagesController().getInputPeer((int) this.dialog_id);
tL_messages_editMessage.id = messageObject.getId();
tL_messages_editMessage.flags |= 16384;
final int sendRequest = getConnectionsManager().sendRequest(tL_messages_editMessage, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChatActivity.this.lambda$null$95$ChatActivity(alertDialogArr, tL_messages_editMessage, tLObject, tL_error);
}
});
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$97$ChatActivity(alertDialogArr, sendRequest);
}
}, 500L);
}
public void lambda$null$95$ChatActivity(final AlertDialog[] alertDialogArr, final TLRPC.TL_messages_editMessage tL_messages_editMessage, TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.lambda$null$93(alertDialogArr);
}
});
if (tL_error == null) {
getMessagesController().processUpdates((TLRPC.Updates) tLObject, false);
} else {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$94$ChatActivity(tL_error, tL_messages_editMessage);
}
});
}
}
public static void lambda$null$93(AlertDialog[] alertDialogArr) {
try {
alertDialogArr[0].dismiss();
} catch (Throwable unused) {
}
alertDialogArr[0] = null;
}
public void lambda$null$94$ChatActivity(TLRPC.TL_error tL_error, TLRPC.TL_messages_editMessage tL_messages_editMessage) {
AlertsCreator.processError(this.currentAccount, tL_error, this, tL_messages_editMessage, new Object[0]);
}
public void lambda$null$97$ChatActivity(AlertDialog[] alertDialogArr, final int i) {
if (alertDialogArr[0] == null) {
return;
}
alertDialogArr[0].setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public final void onCancel(DialogInterface dialogInterface) {
ChatActivity.this.lambda$null$96$ChatActivity(i, dialogInterface);
}
});
showDialog(alertDialogArr[0]);
}
public void lambda$null$96$ChatActivity(int i, DialogInterface dialogInterface) {
getConnectionsManager().cancelRequest(i, true);
}
public void lambda$processSelectedOption$101$ChatActivity(final TLRPC.TL_messages_sendScheduledMessages tL_messages_sendScheduledMessages, TLObject tLObject, final TLRPC.TL_error tL_error) {
if (tL_error == null) {
MessagesController.getInstance(this.currentAccount).processUpdates((TLRPC.Updates) tLObject, false);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$99$ChatActivity(tL_messages_sendScheduledMessages);
}
});
} else if (tL_error.text != null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$100$ChatActivity(tL_error);
}
});
}
}
public void lambda$null$99$ChatActivity(TLRPC.TL_messages_sendScheduledMessages tL_messages_sendScheduledMessages) {
NotificationCenter.getInstance(this.currentAccount).postNotificationName(NotificationCenter.messagesDeleted, tL_messages_sendScheduledMessages.id, Integer.valueOf((int) (-this.dialog_id)), true);
}
public void lambda$null$100$ChatActivity(TLRPC.TL_error tL_error) {
if (tL_error.text.startsWith("SLOWMODE_WAIT_")) {
AlertsCreator.showSimpleToast(this, LocaleController.getString("SlowmodeSendError", R.string.SlowmodeSendError));
} else if (tL_error.text.equals("CHAT_SEND_MEDIA_FORBIDDEN")) {
AlertsCreator.showSimpleToast(this, LocaleController.getString("AttachMediaRestrictedForever", R.string.AttachMediaRestrictedForever));
} else {
AlertsCreator.showSimpleToast(this, tL_error.text);
}
}
public void lambda$processSelectedOption$102$ChatActivity(MessageObject.GroupedMessages groupedMessages, MessageObject messageObject, boolean z, int i) {
if (groupedMessages != null) {
SendMessagesHelper.getInstance(this.currentAccount).editMessage(groupedMessages.messages.get(0), null, false, this, null, i, null);
} else {
SendMessagesHelper.getInstance(this.currentAccount).editMessage(messageObject, null, false, this, null, i, null);
}
}
private void convertAudioFile(final MessageObject messageObject) {
messageObject.messageOwner.trans = " ";
messageObject.messageOwner.istransing = true;
updateVisibleRows();
Disposable subscribe = Observable.create(new ObservableOnSubscribe<String>() {
@Override
public void subscribe(final ObservableEmitter<String> observableEmitter) throws Exception {
File pathToMessage = FileLoader.getPathToMessage(messageObject.messageOwner);
String name = pathToMessage.getName();
String path = pathToMessage.getPath();
final String str = AudioFileUtils.getAudioEditStorageDirectory() + File.separator + (name.substring(0, name.lastIndexOf(46)) + AudioEditConstant.SUFFIX_PCM);
if (AudioFileUtils.checkFileExist(str)) {
observableEmitter.onNext(str);
return;
}
AudioFileUtils.confirmFolderExist(new File(str).getParent());
DecodeEngine.getInstance().convertMusicFileToPcmFile(path, str, new DecodeOperateInterface() {
@Override
public void updateDecodeProgress(int i) {
}
@Override
public void decodeSuccess() {
Log.e("TAG", "解碼完成 Path == " + str);
observableEmitter.onNext(str);
}
@Override
public void decodeFail() {
Log.e("TAG", "文件解析失败 Path == " + str);
observableEmitter.onError(new Throwable("文件解析失败"));
}
});
}
}).subscribeOn(Schedulers.io()).subscribe(new Consumer() {
@Override
public final void accept(Object obj) {
ChatActivity.this.lambda$convertAudioFile$103$ChatActivity(messageObject, (String) obj);
}
}, new Consumer() {
@Override
public final void accept(Object obj) {
ToastUtils.show((CharSequence) ((Throwable) obj).getMessage());
}
});
if (subscribe != null) {
translateAddTaskDisposable(String.valueOf(messageObject.getId()), subscribe);
}
}
public void lambda$convertAudioFile$103$ChatActivity(MessageObject messageObject, String str) throws Exception {
if (TextUtils.isEmpty(str) || !AudioFileUtils.checkFileExist(str)) {
return;
}
translateAccessToken(messageObject, str);
}
private void translateAddTaskDisposable(String str, Disposable disposable) {
if (this.mTaskDisposable.get(str) != null) {
this.mTaskDisposable.get(str).add(disposable);
return;
}
CompositeDisposable compositeDisposable = new CompositeDisposable();
compositeDisposable.add(disposable);
this.mTaskDisposable.put(str, compositeDisposable);
}
private void translateUnSubscribeAllAudioTask() {
RxHelper.getInstance().lambda$sendSimpleRequest$0$RxHelper(this.TAG);
this.mTaskDisposable.clear();
HashMap<String, CompositeDisposable> hashMap = this.mTaskDisposable;
if (hashMap == null || hashMap.size() <= 0) {
return;
}
Iterator<Map.Entry<String, CompositeDisposable>> it = this.mTaskDisposable.entrySet().iterator();
while (it.hasNext()) {
CompositeDisposable value = it.next().getValue();
if (value != null) {
value.clear();
it.remove();
}
}
this.mTaskDisposable.clear();
this.mTaskDisposable = null;
}
private void translateAccessToken(final MessageObject messageObject, final String str) {
RxHelper.getInstance().sendSimpleRequest(this.TAG, ApiTranslateAudioFactory.getInstance().getApiTranslate().accessToken("https://openapi.baidu.com/oauth/2.0/token", "client_credentials", "5elX69KjdF5FkuwcYSOdNTYs", "pE5eNoBQIFVcd9IEuyIhvopfgS1RSj5C"), new Consumer<ResponseAccessTokenBean>() {
@Override
public void accept(ResponseAccessTokenBean responseAccessTokenBean) throws Exception {
if (responseAccessTokenBean == null || TextUtils.isEmpty(responseAccessTokenBean.getAccess_token())) {
return;
}
ChatActivity.this.translateAudio(messageObject, responseAccessTokenBean.getAccess_token(), str);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable th) throws Exception {
ToastUtils.show((CharSequence) "翻译失败");
}
});
}
public void translateAudio(final MessageObject messageObject, String str, String str2) {
final File file = new File(str2);
RxHelper.getInstance().sendSimpleRequest(this.TAG, ApiTranslateAudioFactory.getInstance().getApiTranslate().translate("https://vop.baidu.com/pro_api", RequestBody.create(MediaType.parse("audio/pcm;rate=16000"), file), "baidu_workshop", str, 80001, file.length()), new Consumer<ResponseBaiduTranslateBean>() {
@Override
public void accept(ResponseBaiduTranslateBean responseBaiduTranslateBean) throws Exception {
if (responseBaiduTranslateBean == null || responseBaiduTranslateBean.getResult() == null || responseBaiduTranslateBean.getResult().length <= 0) {
return;
}
AudioFileUtils.deleteFileSafely(file);
try {
long id = messageObject.getId();
int channelId = messageObject.getChannelId();
if (messageObject.getChannelId() != 0) {
id |= channelId << 32;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < responseBaiduTranslateBean.getResult().length; i++) {
sb.append(responseBaiduTranslateBean.getResult()[i]);
}
if (!TextUtils.isEmpty(sb.toString())) {
SQLitePreparedStatement executeFast = ChatActivity.this.getMessagesStorage().getDatabase().executeFast("UPDATE messages SET trans_dst = ? WHERE mid = ? ");
executeFast.bindString(1, sb.toString());
executeFast.bindLong(2, id);
executeFast.step();
executeFast.dispose();
messageObject.messageOwner.trans = sb.toString();
messageObject.messageOwner.istransing = false;
} else {
ToastUtils.show((CharSequence) "翻译失败");
ChatActivity.this.translateCancel(messageObject);
}
} catch (SQLiteException e) {
e.printStackTrace();
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
ChatActivity.this.updateVisibleRows();
}
});
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable th) throws Exception {
ToastUtils.show((CharSequence) th.getMessage());
}
});
}
@Override
public void didSelectDialogs(DialogsActivity dialogsActivity, ArrayList<Long> arrayList, CharSequence charSequence, boolean z) {
if (this.forwardingMessage == null && this.selectedMessagesIds[0].size() == 0 && this.selectedMessagesIds[1].size() == 0) {
return;
}
ArrayList<MessageObject> arrayList2 = new ArrayList<>();
MessageObject messageObject = this.forwardingMessage;
if (messageObject != null) {
MessageObject.GroupedMessages groupedMessages = this.forwardingMessageGroup;
if (groupedMessages != null) {
arrayList2.addAll(groupedMessages.messages);
} else {
arrayList2.add(messageObject);
}
this.forwardingMessage = null;
this.forwardingMessageGroup = null;
} else {
for (int i = 1; i >= 0; i--) {
ArrayList arrayList3 = new ArrayList();
for (int i2 = 0; i2 < this.selectedMessagesIds[i].size(); i2++) {
arrayList3.add(Integer.valueOf(this.selectedMessagesIds[i].keyAt(i2)));
}
Collections.sort(arrayList3);
for (int i3 = 0; i3 < arrayList3.size(); i3++) {
MessageObject messageObject2 = this.selectedMessagesIds[i].get(((Integer) arrayList3.get(i3)).intValue());
if (messageObject2 != null) {
if (messageObject2.messageOwner.media instanceof TLRPC.TL_messageMediaShare) {
TLRPC.TL_messageMediaShare tL_messageMediaShare = (TLRPC.TL_messageMediaShare) messageObject2.messageOwner.media;
}
arrayList2.add(messageObject2);
}
}
this.selectedMessagesCanCopyIds[i].clear();
this.selectedMessagesCanStarIds[i].clear();
this.selectedMessagesIds[i].clear();
}
hideActionMode();
updatePinnedMessageView(true);
}
if (arrayList.size() > 1 || arrayList.get(0).longValue() == getUserConfig().getClientUserId() || charSequence != null) {
for (int i4 = 0; i4 < arrayList.size(); i4++) {
long longValue = arrayList.get(i4).longValue();
if (charSequence != null) {
getSendMessagesHelper().sendMessage(charSequence.toString(), longValue, null, null, true, null, null, null, true, 0);
}
getSendMessagesHelper().sendMessage(arrayList2, longValue, true, 0);
}
dialogsActivity.finishFragment();
return;
}
long longValue2 = arrayList.get(0).longValue();
if (longValue2 != this.dialog_id) {
int i5 = (int) longValue2;
int i6 = (int) (longValue2 >> 32);
Bundle bundle = new Bundle();
bundle.putBoolean("scrollToTopOnResume", this.scrollToTopOnResume);
if (i5 == 0) {
bundle.putInt("enc_id", i6);
} else if (i5 > 0) {
bundle.putInt("user_id", i5);
} else if (i5 < 0) {
bundle.putInt("chat_id", -i5);
}
if (i5 != 0 && !getMessagesController().checkCanOpenChat(bundle, dialogsActivity)) {
return;
}
ChatActivity chatActivity = new ChatActivity(bundle);
if (presentFragment(chatActivity, true)) {
chatActivity.showFieldPanelForForward(true, arrayList2);
if (AndroidUtilities.isTablet()) {
return;
}
removeSelfFromStack();
return;
}
dialogsActivity.finishFragment();
return;
}
dialogsActivity.finishFragment();
moveScrollToLastMessage();
showFieldPanelForForward(true, arrayList2);
if (AndroidUtilities.isTablet()) {
hideActionMode();
updatePinnedMessageView(true);
}
updateVisibleRows();
}
public boolean checkRecordLocked() {
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView == null || !chatActivityEnterView.isRecordLocked()) {
return false;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
if (this.chatActivityEnterView.isInVideoMode()) {
builder.setTitle(LocaleController.getString("DiscardVideoMessageTitle", R.string.DiscardVideoMessageTitle));
builder.setMessage(LocaleController.getString("DiscardVideoMessageDescription", R.string.DiscardVideoMessageDescription));
} else {
builder.setTitle(LocaleController.getString("DiscardVoiceMessageTitle", R.string.DiscardVoiceMessageTitle));
builder.setMessage(LocaleController.getString("DiscardVoiceMessageDescription", R.string.DiscardVoiceMessageDescription));
}
builder.setPositiveButton(LocaleController.getString("DiscardVoiceMessageAction", R.string.DiscardVoiceMessageAction), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatActivity.this.lambda$checkRecordLocked$105$ChatActivity(dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Continue", R.string.Continue), null);
showDialog(builder.create());
return true;
}
public void lambda$checkRecordLocked$105$ChatActivity(DialogInterface dialogInterface, int i) {
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null) {
chatActivityEnterView.cancelRecordingAudioVideo();
}
}
@Override
public boolean onBackPressed() {
ActionBarPopupWindow actionBarPopupWindow = this.scrimPopupWindow;
if (actionBarPopupWindow != null) {
actionBarPopupWindow.dismiss();
return false;
} else if (checkRecordLocked()) {
return false;
} else {
if (this.actionBar != null && this.actionBar.isActionModeShowed()) {
for (int i = 1; i >= 0; i--) {
this.selectedMessagesIds[i].clear();
this.selectedMessagesCanCopyIds[i].clear();
this.selectedMessagesCanStarIds[i].clear();
}
hideActionMode();
updatePinnedMessageView(true);
updateVisibleRows();
return false;
}
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView == null || !chatActivityEnterView.isPopupShowing()) {
return true;
}
this.chatActivityEnterView.hidePopup(true);
return false;
}
}
public void updateVisibleRows() {
boolean z;
boolean z2;
int indexOf;
RecyclerListView recyclerListView = this.chatListView;
if (recyclerListView == null) {
return;
}
int i = (this.wasManualScroll || this.unreadMessageObject == null || recyclerListView.getMeasuredHeight() == 0 || (indexOf = this.messages.indexOf(this.unreadMessageObject)) < 0) ? -1 : this.chatAdapter.messagesStartRow + indexOf;
int childCount = this.chatListView.getChildCount();
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
MessageObject editingMessageObject = chatActivityEnterView != null ? chatActivityEnterView.getEditingMessageObject() : null;
boolean z3 = false;
int i2 = 0;
while (i2 < childCount) {
View childAt = this.chatListView.getChildAt(i2);
if (childAt instanceof ChatMessageCell) {
ChatMessageCell chatMessageCell = (ChatMessageCell) childAt;
MessageObject messageObject = chatMessageCell.getMessageObject();
if (this.actionBar.isActionModeShowed()) {
chatMessageCell.setCheckBoxVisible(true, true);
int i3 = messageObject.getDialogId() == this.dialog_id ? 0 : 1;
if (messageObject == editingMessageObject || this.selectedMessagesIds[i3].indexOfKey(messageObject.getId()) >= 0) {
setCellSelectionBackground(messageObject, chatMessageCell, i3, true);
z = true;
} else {
chatMessageCell.setDrawSelectionBackground(z3);
chatMessageCell.setChecked(z3, z3, true);
z = false;
}
z2 = true;
} else {
chatMessageCell.setDrawSelectionBackground(z3);
chatMessageCell.setCheckBoxVisible(z3, true);
chatMessageCell.setChecked(z3, z3, true);
z = false;
z2 = false;
}
chatMessageCell.setMessageObject(chatMessageCell.getMessageObject(), chatMessageCell.getCurrentMessagesGroup(), chatMessageCell.isPinnedBottom(), chatMessageCell.isPinnedTop());
if (chatMessageCell != this.scrimView) {
chatMessageCell.setCheckPressed(!z2, z2 && z);
}
chatMessageCell.setHighlighted((this.highlightMessageId == Integer.MAX_VALUE || messageObject == null || messageObject.getId() != this.highlightMessageId) ? false : true);
if (this.highlightMessageId != Integer.MAX_VALUE) {
startMessageUnselect();
}
FrameLayout frameLayout = this.searchContainer;
if (frameLayout != null && frameLayout.getVisibility() == 0) {
if (getMediaDataController().isMessageFound(messageObject.getId(), messageObject.getDialogId() == this.mergeDialogId) && getMediaDataController().getLastSearchQuery() != null) {
chatMessageCell.setHighlightedText(getMediaDataController().getLastSearchQuery());
}
}
chatMessageCell.setHighlightedText(null);
} else if (childAt instanceof ChatActionCell) {
ChatActionCell chatActionCell = (ChatActionCell) childAt;
chatActionCell.setMessageObject(chatActionCell.getMessageObject());
}
i2++;
z3 = false;
}
this.chatListView.invalidate();
if (i != -1) {
this.chatLayoutManager.scrollToPositionWithOffset(i, ((this.chatListView.getMeasuredHeight() - this.chatListView.getPaddingBottom()) - this.chatListView.getPaddingTop()) - AndroidUtilities.dp(29.0f));
}
}
public void checkEditTimer() {
MessageObject editingMessageObject;
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView == null || (editingMessageObject = chatActivityEnterView.getEditingMessageObject()) == null || editingMessageObject.scheduled) {
return;
}
TLRPC.User user = this.currentUser;
if (user == null || !user.self) {
int abs = editingMessageObject.canEditMessageAnytime(this.currentChat) ? 360 : (getMessagesController().maxEditTime + 300) - Math.abs(getConnectionsManager().getCurrentTime() - editingMessageObject.messageOwner.date);
if (abs > 0) {
if (abs <= 300) {
this.replyObjectTextView.setText(LocaleController.formatString("TimeToEdit", R.string.TimeToEdit, String.format("%d:%02d", Integer.valueOf(abs / 60), Integer.valueOf(abs % 60))));
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.checkEditTimer();
}
}, 1000L);
return;
}
this.chatActivityEnterView.onEditTimeExpired();
this.replyObjectTextView.setText(LocaleController.formatString("TimeToEditExpired", R.string.TimeToEditExpired, new Object[0]));
}
}
public ArrayList<MessageObject> createVoiceMessagesPlaylist(MessageObject messageObject, boolean z) {
ArrayList<MessageObject> arrayList = new ArrayList<>();
arrayList.add(messageObject);
int id = messageObject.getId();
messageObject.getDialogId();
if (id != 0) {
for (int size = this.messages.size() - 1; size >= 0; size--) {
MessageObject messageObject2 = this.messages.get(size);
if ((messageObject2.getDialogId() != this.mergeDialogId || messageObject.getDialogId() == this.mergeDialogId) && (((this.currentEncryptedChat == null && messageObject2.getId() > id) || (this.currentEncryptedChat != null && messageObject2.getId() < id)) && ((messageObject2.isVoice() || messageObject2.isRoundVideo()) && (!z || (messageObject2.isContentUnread() && !messageObject2.isOut()))))) {
arrayList.add(messageObject2);
}
}
}
return arrayList;
}
public void alertUserOpenError(MessageObject messageObject) {
if (getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
if (messageObject.type == 3) {
builder.setMessage(LocaleController.getString("NoPlayerInstalled", R.string.NoPlayerInstalled));
} else {
builder.setMessage(LocaleController.formatString("NoHandleAppInstalled", R.string.NoHandleAppInstalled, messageObject.getDocument().mime_type));
}
showDialog(builder.create());
}
public void openSearchWithText(String str) {
if (!this.actionBar.isSearchFieldVisible()) {
this.headerItem.setVisibility(8);
this.attachItem.setVisibility(8);
this.editTextItem.setVisibility(8);
this.searchItem.setVisibility(0);
updateSearchButtons(0, 0, -1);
updateBottomOverlay();
}
boolean z = str == null;
this.openSearchKeyboard = z;
this.searchItem.openSearch(z);
if (str != null) {
this.searchItem.setSearchFieldText(str, false);
getMediaDataController().searchMessagesInChat(str, this.dialog_id, this.mergeDialogId, this.classGuid, 0, this.searchingUserMessages);
}
updatePinnedMessageView(true);
}
@Override
public void didSelectLocation(TLRPC.MessageMedia messageMedia, int i, boolean z, int i2) {
getSendMessagesHelper().sendMessage(messageMedia, this.dialog_id, this.replyingMessageObject, (TLRPC.ReplyMarkup) null, (HashMap<String, String>) null, z, i2);
if (!this.inScheduleMode) {
moveScrollToLastMessage();
}
afterMessageSend();
if (this.paused) {
this.scrollToTopOnResume = true;
}
}
public boolean isEditingMessageMedia() {
ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
return (chatAttachAlert == null || chatAttachAlert.getEditingMessageObject() == null) ? false : true;
}
public boolean isSecretChat() {
return this.currentEncryptedChat != null;
}
public boolean canScheduleMessage() {
FrameLayout frameLayout;
return this.currentEncryptedChat == null && ((frameLayout = this.bottomOverlayChat) == null || frameLayout.getVisibility() != 0);
}
public boolean isInScheduleMode() {
return this.inScheduleMode;
}
public TLRPC.User getCurrentUser() {
return this.currentUser;
}
public TLRPC.Chat getCurrentChat() {
return this.currentChat;
}
public boolean allowGroupPhotos() {
TLRPC.EncryptedChat encryptedChat;
return !isEditingMessageMedia() && ((encryptedChat = this.currentEncryptedChat) == null || AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 73);
}
public TLRPC.EncryptedChat getCurrentEncryptedChat() {
return this.currentEncryptedChat;
}
public TLRPC.ChatFull getCurrentChatInfo() {
return this.chatInfo;
}
public TLRPC.UserFull getCurrentUserInfo() {
return this.userInfo;
}
public void sendMedia(MediaController.PhotoEntry photoEntry, VideoEditedInfo videoEditedInfo, boolean z, int i) {
if (photoEntry == null) {
return;
}
fillEditingMediaWithCaption(photoEntry.caption, photoEntry.entities);
if (photoEntry.isVideo) {
if (videoEditedInfo != null) {
SendMessagesHelper.prepareSendingVideo(getAccountInstance(), photoEntry.path, videoEditedInfo.estimatedSize, videoEditedInfo.estimatedDuration, videoEditedInfo.resultWidth, videoEditedInfo.resultHeight, videoEditedInfo, this.dialog_id, this.replyingMessageObject, photoEntry.caption, photoEntry.entities, photoEntry.ttl, this.editingMessageObject, z, i);
} else {
SendMessagesHelper.prepareSendingVideo(getAccountInstance(), photoEntry.path, 0L, 0L, 0, 0, null, this.dialog_id, this.replyingMessageObject, photoEntry.caption, photoEntry.entities, photoEntry.ttl, this.editingMessageObject, z, i);
}
afterMessageSend();
} else if (photoEntry.imagePath != null) {
SendMessagesHelper.prepareSendingPhoto(getAccountInstance(), photoEntry.imagePath, null, this.dialog_id, this.replyingMessageObject, photoEntry.caption, photoEntry.entities, photoEntry.stickers, null, photoEntry.ttl, this.editingMessageObject, z, i);
afterMessageSend();
} else if (photoEntry.path != null) {
SendMessagesHelper.prepareSendingPhoto(getAccountInstance(), photoEntry.path, null, this.dialog_id, this.replyingMessageObject, photoEntry.caption, photoEntry.entities, photoEntry.stickers, null, photoEntry.ttl, this.editingMessageObject, z, i);
afterMessageSend();
}
}
public void showOpenGameAlert(final TLRPC.TL_game tL_game, final MessageObject messageObject, final String str, boolean z, final int i) {
String str2;
TLRPC.User user = getMessagesController().getUser(Integer.valueOf(i));
str2 = "";
if (z) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.formatString("BotPermissionGameAlert", R.string.BotPermissionGameAlert, user != null ? ContactsController.formatName(user.first_name, user.last_name) : ""));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
ChatActivity.this.lambda$showOpenGameAlert$106$ChatActivity(tL_game, messageObject, str, i, dialogInterface, i2);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
} else if (Build.VERSION.SDK_INT >= 21 && !AndroidUtilities.isTablet() && WebviewActivity.supportWebview()) {
if (this.parentLayout.fragmentsStack.get(this.parentLayout.fragmentsStack.size() - 1) == this) {
if (user != null && !TextUtils.isEmpty(user.username)) {
str2 = user.username;
}
presentFragment(new WebviewActivity(str, str2, tL_game.title, tL_game.short_name, messageObject));
}
} else {
FragmentActivity parentActivity = getParentActivity();
String str3 = tL_game.short_name;
if (user != null && user.username != null) {
str2 = user.username;
}
WebviewActivity.openGameInBrowser(str, messageObject, parentActivity, str3, str2);
}
}
public void lambda$showOpenGameAlert$106$ChatActivity(TLRPC.TL_game tL_game, MessageObject messageObject, String str, int i, DialogInterface dialogInterface, int i2) {
showOpenGameAlert(tL_game, messageObject, str, false, i);
SharedPreferences.Editor edit2 = MessagesController.getNotificationsSettings(this.currentAccount).edit();
edit2.putBoolean("askgame_" + i, false).commit();
}
public void showOpenUrlAlert(final String str, boolean z) {
if (Browser.isInternalUrl(str, null) || !z) {
Browser.openUrl(getParentActivity(), str, this.inlineReturn == 0);
} else if (getParentActivity() == null) {
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("OpenUrlTitle", R.string.OpenUrlTitle));
String string = LocaleController.getString("OpenUrlAlert2", R.string.OpenUrlAlert2);
int indexOf = string.indexOf("%");
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(String.format(string, str));
if (indexOf >= 0) {
spannableStringBuilder.setSpan(new URLSpan(str), indexOf, str.length() + indexOf, 33);
}
builder.setMessage(spannableStringBuilder);
builder.setMessageTextViewClickable(false);
builder.setPositiveButton(LocaleController.getString("Open", R.string.Open), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatActivity.this.lambda$showOpenUrlAlert$107$ChatActivity(str, dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
}
}
public void lambda$showOpenUrlAlert$107$ChatActivity(String str, DialogInterface dialogInterface, int i) {
Browser.openUrl(getParentActivity(), str, this.inlineReturn == 0);
}
public void showRequestUrlAlert(final TLRPC.TL_urlAuthResultRequest tL_urlAuthResultRequest, final TLRPC.TL_messages_requestUrlAuth tL_messages_requestUrlAuth, final String str) {
if (getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("OpenUrlTitle", R.string.OpenUrlTitle));
String string = LocaleController.getString("OpenUrlAlert2", R.string.OpenUrlAlert2);
int indexOf = string.indexOf("%");
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(String.format(string, str));
if (indexOf >= 0) {
spannableStringBuilder.setSpan(new URLSpan(str), indexOf, str.length() + indexOf, 33);
}
builder.setMessage(spannableStringBuilder);
builder.setMessageTextViewClickable(false);
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
final CheckBoxCell[] checkBoxCellArr = new CheckBoxCell[2];
LinearLayout linearLayout = new LinearLayout(getParentActivity());
linearLayout.setOrientation(1);
TLRPC.User currentUser = getUserConfig().getCurrentUser();
int i = 0;
while (true) {
if (i < (tL_urlAuthResultRequest.request_write_access ? 2 : 1)) {
checkBoxCellArr[i] = new CheckBoxCell(getParentActivity(), 1);
checkBoxCellArr[i].setBackgroundDrawable(Theme.getSelectorDrawable(false));
checkBoxCellArr[i].setMultiline(true);
checkBoxCellArr[i].setTag(Integer.valueOf(i));
if (i == 0) {
SpannableStringBuilder replaceTags = AndroidUtilities.replaceTags(LocaleController.formatString("OpenUrlOption1", R.string.OpenUrlOption1, tL_urlAuthResultRequest.domain, ContactsController.formatName(currentUser.first_name, currentUser.last_name)));
int indexOf2 = TextUtils.indexOf(replaceTags, tL_urlAuthResultRequest.domain);
if (indexOf2 >= 0) {
replaceTags.setSpan(new URLSpan(""), indexOf2, tL_urlAuthResultRequest.domain.length() + indexOf2, 33);
}
checkBoxCellArr[i].setText(replaceTags, "", true, false);
} else if (i == 1) {
checkBoxCellArr[i].setText(AndroidUtilities.replaceTags(LocaleController.formatString("OpenUrlOption2", R.string.OpenUrlOption2, UserObject.getFirstName(tL_urlAuthResultRequest.bot))), "", true, false);
}
checkBoxCellArr[i].setPadding(LocaleController.isRTL ? AndroidUtilities.dp(16.0f) : AndroidUtilities.dp(8.0f), 0, LocaleController.isRTL ? AndroidUtilities.dp(8.0f) : AndroidUtilities.dp(16.0f), 0);
linearLayout.addView(checkBoxCellArr[i], LayoutHelper.createLinear(-1, -2));
checkBoxCellArr[i].setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivity.lambda$showRequestUrlAlert$108(checkBoxCellArr, view);
}
});
i++;
} else {
builder.setCustomViewOffset(12);
builder.setView(linearLayout);
builder.setPositiveButton(LocaleController.getString("Open", R.string.Open), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
ChatActivity.this.lambda$showRequestUrlAlert$113$ChatActivity(checkBoxCellArr, str, tL_messages_requestUrlAuth, tL_urlAuthResultRequest, dialogInterface, i2);
}
});
showDialog(builder.create());
return;
}
}
}
public static void lambda$showRequestUrlAlert$108(CheckBoxCell[] checkBoxCellArr, View view) {
if (view.isEnabled()) {
Integer num = (Integer) view.getTag();
checkBoxCellArr[num.intValue()].setChecked(!checkBoxCellArr[num.intValue()].isChecked(), true);
if (num.intValue() != 0 || checkBoxCellArr[1] == null) {
return;
}
if (checkBoxCellArr[num.intValue()].isChecked()) {
checkBoxCellArr[1].setEnabled(true);
return;
}
checkBoxCellArr[1].setChecked(false, true);
checkBoxCellArr[1].setEnabled(false);
}
}
public void lambda$showRequestUrlAlert$113$ChatActivity(CheckBoxCell[] checkBoxCellArr, final String str, TLRPC.TL_messages_requestUrlAuth tL_messages_requestUrlAuth, TLRPC.TL_urlAuthResultRequest tL_urlAuthResultRequest, DialogInterface dialogInterface, int i) {
if (!checkBoxCellArr[0].isChecked()) {
Browser.openUrl((Context) getParentActivity(), str, false);
return;
}
final AlertDialog[] alertDialogArr = {new AlertDialog(getParentActivity(), 3)};
TLRPC.TL_messages_acceptUrlAuth tL_messages_acceptUrlAuth = new TLRPC.TL_messages_acceptUrlAuth();
tL_messages_acceptUrlAuth.button_id = tL_messages_requestUrlAuth.button_id;
tL_messages_acceptUrlAuth.msg_id = tL_messages_requestUrlAuth.msg_id;
tL_messages_acceptUrlAuth.peer = tL_messages_requestUrlAuth.peer;
if (tL_urlAuthResultRequest.request_write_access) {
tL_messages_acceptUrlAuth.write_allowed = checkBoxCellArr[1].isChecked();
}
try {
alertDialogArr[0].dismiss();
} catch (Throwable unused) {
}
alertDialogArr[0] = null;
final int sendRequest = getConnectionsManager().sendRequest(tL_messages_acceptUrlAuth, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChatActivity.this.lambda$null$110$ChatActivity(str, tLObject, tL_error);
}
});
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$112$ChatActivity(alertDialogArr, sendRequest);
}
}, 500L);
}
public void lambda$null$110$ChatActivity(final String str, final TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$109$ChatActivity(tLObject, str);
}
});
}
public void lambda$null$109$ChatActivity(TLObject tLObject, String str) {
if (tLObject instanceof TLRPC.TL_urlAuthResultAccepted) {
Browser.openUrl((Context) getParentActivity(), ((TLRPC.TL_urlAuthResultAccepted) tLObject).url, false);
} else if (tLObject instanceof TLRPC.TL_urlAuthResultDefault) {
Browser.openUrl((Context) getParentActivity(), str, false);
}
}
public void lambda$null$112$ChatActivity(AlertDialog[] alertDialogArr, final int i) {
if (alertDialogArr[0] == null) {
return;
}
alertDialogArr[0].setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public final void onCancel(DialogInterface dialogInterface) {
ChatActivity.this.lambda$null$111$ChatActivity(i, dialogInterface);
}
});
showDialog(alertDialogArr[0]);
}
public void lambda$null$111$ChatActivity(int i, DialogInterface dialogInterface) {
getConnectionsManager().cancelRequest(i, true);
}
private void removeMessageObject(MessageObject messageObject) {
int indexOf = this.messages.indexOf(messageObject);
if (indexOf == -1) {
return;
}
this.messages.remove(indexOf);
ChatActivityAdapter chatActivityAdapter = this.chatAdapter;
if (chatActivityAdapter != null) {
chatActivityAdapter.notifyItemRemoved(chatActivityAdapter.messagesStartRow + indexOf);
}
}
public void viewContacts(int i) {
TLRPC.User user;
if (i == 0 || (user = getMessagesController().getUser(Integer.valueOf(i))) == null) {
return;
}
if (user.self || user.contact) {
Bundle bundle = new Bundle();
bundle.putInt("user_id", user.id);
presentFragment(new NewProfileActivity(bundle));
return;
}
Bundle bundle2 = new Bundle();
bundle2.putInt("from_type", 6);
presentFragment(new AddContactsInfoActivity(bundle2, user));
}
public void setCellSelectionBackground(MessageObject messageObject, ChatMessageCell chatMessageCell, int i, boolean z) {
boolean z2;
MessageObject.GroupedMessages validGroupedMessage = getValidGroupedMessage(messageObject);
if (validGroupedMessage != null) {
int i2 = 0;
while (true) {
if (i2 >= validGroupedMessage.messages.size()) {
z2 = false;
break;
} else if (this.selectedMessagesIds[i].indexOfKey(validGroupedMessage.messages.get(i2).getId()) < 0) {
z2 = true;
break;
} else {
i2++;
}
}
if (!z2) {
validGroupedMessage = null;
}
}
chatMessageCell.setDrawSelectionBackground(validGroupedMessage == null);
chatMessageCell.setChecked(true, validGroupedMessage == null, z);
}
public void updateMessageListAccessibilityVisibility() {
ActionBarPopupWindow actionBarPopupWindow;
if (this.currentEncryptedChat == null && Build.VERSION.SDK_INT >= 19) {
this.chatListView.setImportantForAccessibility((this.mentionContainer.getVisibility() == 0 || ((actionBarPopupWindow = this.scrimPopupWindow) != null && actionBarPopupWindow.isShowing())) ? 4 : 0);
}
}
public void getAccountInfo(final boolean z) {
TLRPCWallet.TL_getPaymentAccountInfo tL_getPaymentAccountInfo = new TLRPCWallet.TL_getPaymentAccountInfo();
final XAlertDialog xAlertDialog = new XAlertDialog(getParentActivity(), 5);
final int sendRequest = getConnectionsManager().sendRequest(tL_getPaymentAccountInfo, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChatActivity.this.lambda$getAccountInfo$120$ChatActivity(xAlertDialog, z, tLObject, tL_error);
}
});
getConnectionsManager().bindRequestToGuid(sendRequest, this.classGuid);
xAlertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public final void onCancel(DialogInterface dialogInterface) {
ChatActivity.this.lambda$getAccountInfo$121$ChatActivity(sendRequest, dialogInterface);
}
});
xAlertDialog.show();
}
public void lambda$getAccountInfo$120$ChatActivity(final XAlertDialog xAlertDialog, final boolean z, final TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$119$ChatActivity(tL_error, xAlertDialog, tLObject, z);
}
});
}
public void lambda$null$119$ChatActivity(TLRPC.TL_error tL_error, XAlertDialog xAlertDialog, TLObject tLObject, boolean z) {
if (tL_error != null) {
xAlertDialog.dismiss();
WalletDialogUtil.showConfirmBtnWalletDialog(this, WalletErrorUtil.getErrorDescription(tL_error.text));
} else if (tLObject instanceof TLRPCWallet.TL_paymentAccountInfoNotExist) {
xAlertDialog.dismiss();
String string = LocaleController.getString("AccountInfoNotCompleted", R.string.AccountInfoNotCompleted);
Object[] objArr = new Object[2];
objArr[0] = z ? LocaleController.getString("ReceiveRedPacket", R.string.ReceiveRedPacket) : LocaleController.getString("Transfer", R.string.Transfer);
objArr[1] = z ? LocaleController.getString("ReceiveRedPacket", R.string.ReceiveRedPacket) : LocaleController.getString("Transfer", R.string.Transfer);
WalletDialogUtil.showWalletDialog(this, "", String.format(string, objArr), LocaleController.getString("Close", R.string.Close), LocaleController.getString("GoToWalletCenter", R.string.GoToWalletCenter), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatActivity.lambda$null$114(dialogInterface, i);
}
}, null);
} else {
TLApiModel parse = TLJsonResolve.parse(tLObject, WalletAccountInfo.class);
if (parse.isSuccess()) {
WalletAccountInfo walletAccountInfo = (WalletAccountInfo) parse.model;
WalletConfigBean.setWalletAccountInfo(walletAccountInfo);
WalletConfigBean.setConfigValue(((WalletAccountInfo) parse.model).getRiskList());
if (walletAccountInfo.isLocked()) {
xAlertDialog.dismiss();
WalletDialogUtil.showWalletDialog(this, "", LocaleController.getString("PleaseContractServerToFindPayPasswordOrTryIt24HoursLater", R.string.PleaseContractServerToFindPayPasswordOrTryIt24HoursLater), LocaleController.getString("Close", R.string.Close), LocaleController.getString("ContactCustomerService", R.string.ContactCustomerService), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatActivity.this.lambda$null$115$ChatActivity(dialogInterface, i);
}
}, null);
return;
} else if (!walletAccountInfo.hasNormalAuth()) {
xAlertDialog.dismiss();
String string2 = LocaleController.getString(R.string.BankCardNotBindTips);
Object[] objArr2 = new Object[1];
objArr2[0] = z ? LocaleController.getString(R.string.redpacket_send) : LocaleController.getString("Transfer", R.string.Transfer);
WalletDialogUtil.showWalletDialog(this, "", String.format(string2, objArr2), LocaleController.getString("Close", R.string.Close), LocaleController.getString("GoToBind", R.string.GoToBind), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatActivity.lambda$null$116(dialogInterface, i);
}
}, null);
return;
} else if (!walletAccountInfo.hasBindBank()) {
xAlertDialog.dismiss();
String string3 = LocaleController.getString(R.string.BankCardNotBindTips);
Object[] objArr3 = new Object[1];
objArr3[0] = z ? LocaleController.getString(R.string.redpacket_send) : LocaleController.getString("Transfer", R.string.Transfer);
WalletDialogUtil.showWalletDialog(this, "", String.format(string3, objArr3), LocaleController.getString("Close", R.string.Close), LocaleController.getString("GoToBind", R.string.GoToBind), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatActivity.lambda$null$117(dialogInterface, i);
}
}, null);
return;
} else if (!walletAccountInfo.hasPaypassword()) {
xAlertDialog.dismiss();
String string4 = LocaleController.getString(R.string.PayPasswordNotSetTips);
Object[] objArr4 = new Object[1];
objArr4[0] = z ? LocaleController.getString(R.string.redpacket_send) : LocaleController.getString("Transfer", R.string.Transfer);
WalletDialogUtil.showWalletDialog(this, "", String.format(string4, objArr4), LocaleController.getString("Close", R.string.Close), LocaleController.getString("redpacket_goto_set", R.string.redpacket_goto_set), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatActivity.lambda$null$118(dialogInterface, i);
}
}, null);
return;
} else {
xAlertDialog.dismiss();
if (z) {
if (this.currentUser != null) {
Bundle bundle = new Bundle();
bundle.putInt("user_id", this.currentUser.id);
RedpktSendActivity redpktSendActivity = new RedpktSendActivity(bundle);
redpktSendActivity.setAccountInfo(walletAccountInfo);
presentFragment(redpktSendActivity);
return;
} else if (this.currentChat != null) {
RedpktGroupSendActivity redpktGroupSendActivity = new RedpktGroupSendActivity(null);
redpktGroupSendActivity.setToChat(this.currentChat);
redpktGroupSendActivity.setParticipants(this.chatInfo);
redpktGroupSendActivity.setAccountInfo(walletAccountInfo);
presentFragment(redpktGroupSendActivity);
return;
} else {
return;
}
}
Bundle bundle2 = new Bundle();
bundle2.putInt("user_id", this.currentUser.id);
TransferSendActivity transferSendActivity = new TransferSendActivity(bundle2);
transferSendActivity.setAccountInfo(walletAccountInfo);
presentFragment(transferSendActivity);
return;
}
}
xAlertDialog.dismiss();
WalletDialogUtil.showConfirmBtnWalletDialog(this, WalletErrorUtil.getErrorDescription(parse.message));
}
}
public void lambda$null$115$ChatActivity(DialogInterface dialogInterface, int i) {
presentFragment(new AboutAppActivity());
}
public void lambda$getAccountInfo$121$ChatActivity(int i, DialogInterface dialogInterface) {
getConnectionsManager().cancelRequest(i, true);
}
public void performService(final BaseFragment baseFragment) {
String string;
final int currentAccount = baseFragment.getCurrentAccount();
final SharedPreferences mainSettings = MessagesController.getMainSettings(currentAccount);
int i = mainSettings.getInt("support_id", 0);
TLRPC.User user = null;
if (i != 0) {
TLRPC.User user2 = MessagesController.getInstance(currentAccount).getUser(Integer.valueOf(i));
if (user2 == null && (string = mainSettings.getString("support_user", null)) != null) {
try {
byte[] decode = Base64.decode(string, 0);
if (decode != null) {
SerializedData serializedData = new SerializedData(decode);
TLRPC.User TLdeserialize = TLRPC.User.TLdeserialize(serializedData, serializedData.readInt32(false), false);
if (TLdeserialize != null && TLdeserialize.id == 333000) {
TLdeserialize = null;
}
serializedData.cleanup();
user = TLdeserialize;
}
} catch (Exception e) {
FileLog.e(e);
}
}
user = user2;
}
if (user == null) {
final XAlertDialog xAlertDialog = new XAlertDialog(getParentActivity(), 4);
xAlertDialog.show();
ConnectionsManager.getInstance(currentAccount).sendRequest(new TLRPC.TL_help_getSupport(), new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChatActivity.lambda$performService$124(mainSettings, xAlertDialog, currentAccount, baseFragment, tLObject, tL_error);
}
});
return;
}
MessagesController.getInstance(currentAccount).putUser(user, true);
Bundle bundle = new Bundle();
bundle.putInt("user_id", user.id);
baseFragment.presentFragment(new ChatActivity(bundle));
}
public static void lambda$performService$124(final SharedPreferences sharedPreferences, final XAlertDialog xAlertDialog, final int i, final BaseFragment baseFragment, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error == null) {
final TLRPC.TL_help_support tL_help_support = (TLRPC.TL_help_support) tLObject;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.lambda$null$122(sharedPreferences, tL_help_support, xAlertDialog, i, baseFragment);
}
});
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.lambda$null$123(XAlertDialog.this);
}
});
}
public static void lambda$null$122(SharedPreferences sharedPreferences, TLRPC.TL_help_support tL_help_support, XAlertDialog xAlertDialog, int i, BaseFragment baseFragment) {
SharedPreferences.Editor edit2 = sharedPreferences.edit();
edit2.putInt("support_id", tL_help_support.user.id);
SerializedData serializedData = new SerializedData();
tL_help_support.user.serializeToStream(serializedData);
edit2.putString("support_user", Base64.encodeToString(serializedData.toByteArray(), 0));
edit2.commit();
serializedData.cleanup();
try {
xAlertDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
ArrayList<TLRPC.User> arrayList = new ArrayList<>();
arrayList.add(tL_help_support.user);
MessagesStorage.getInstance(i).putUsersAndChats(arrayList, null, true, true);
MessagesController.getInstance(i).putUser(tL_help_support.user, false);
Bundle bundle = new Bundle();
bundle.putInt("user_id", tL_help_support.user.id);
baseFragment.presentFragment(new ChatActivity(bundle));
}
public static void lambda$null$123(XAlertDialog xAlertDialog) {
try {
xAlertDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
}
public void onRedpkgTransferClick(ChatMessageCell chatMessageCell, MessageObject messageObject) {
TLRPCRedpacket.CL_messagesRpkTransferMedia cL_messagesRpkTransferMedia = (TLRPCRedpacket.CL_messagesRpkTransferMedia) messageObject.messageOwner.media;
if (cL_messagesRpkTransferMedia.trans == 0) {
RedpacketResponse redpacketResponse = (RedpacketResponse) TLJsonResolve.parse(cL_messagesRpkTransferMedia.data, RedpacketResponse.class).model;
if (this.currentUser != null) {
if (messageObject.isOutOwner()) {
int parseInt = Integer.parseInt(redpacketResponse.getRed().getStatus());
if (parseInt == 1 || parseInt == 2) {
RedpktDetailActivity redpktDetailActivity = new RedpktDetailActivity();
redpktDetailActivity.setBean(redpacketResponse);
presentFragment(redpktDetailActivity);
return;
}
checkUserRedpkgDetail(messageObject, redpacketResponse);
return;
}
int parseInt2 = Integer.parseInt(redpacketResponse.getRed().getStatus());
if (parseInt2 == 0) {
checkUserRedpkgDetail(messageObject, redpacketResponse);
} else if (parseInt2 == 1) {
RedpktDetailReceiverActivity redpktDetailReceiverActivity = new RedpktDetailReceiverActivity();
redpktDetailReceiverActivity.setBean(redpacketResponse);
presentFragment(redpktDetailReceiverActivity);
} else {
showRedPacketDialog(this.currentUser, messageObject, redpacketResponse, false);
}
} else if (this.currentChat != null) {
RedpacketBean red = redpacketResponse.getRed();
boolean isReceived = redpacketResponse.isReceived();
int parseInt3 = Integer.parseInt(red.getStatus());
if (messageObject.isOut()) {
if (parseInt3 == 0) {
if (isReceived) {
RedpktGroupDetailActivity redpktGroupDetailActivity = new RedpktGroupDetailActivity();
redpktGroupDetailActivity.setBean(redpacketResponse.getRed());
redpktGroupDetailActivity.setChat(this.currentChat);
redpktGroupDetailActivity.setMessageId(messageObject.messageOwner.id);
presentFragment(redpktGroupDetailActivity);
return;
}
checkGroupRedpkgDetail(messageObject, redpacketResponse);
} else if (parseInt3 == 1 || parseInt3 == 2) {
if (isReceived || "2".equals(red.getRedType())) {
RedpktGroupDetailActivity redpktGroupDetailActivity2 = new RedpktGroupDetailActivity();
redpktGroupDetailActivity2.setBean(redpacketResponse.getRed());
redpktGroupDetailActivity2.setChat(this.currentChat);
redpktGroupDetailActivity2.setMessageId(messageObject.messageOwner.id);
presentFragment(redpktGroupDetailActivity2);
return;
}
showRedPacketDialog(getUserConfig().getCurrentUser(), messageObject, redpacketResponse, true);
}
} else if (parseInt3 == 0) {
if (isReceived) {
RedpktGroupDetailActivity redpktGroupDetailActivity3 = new RedpktGroupDetailActivity();
redpktGroupDetailActivity3.setBean(redpacketResponse.getRed());
redpktGroupDetailActivity3.setChat(this.currentChat);
redpktGroupDetailActivity3.setMessageId(messageObject.messageOwner.id);
presentFragment(redpktGroupDetailActivity3);
return;
}
checkGroupRedpkgDetail(messageObject, redpacketResponse);
} else if (parseInt3 == 1) {
if (isReceived) {
RedpktGroupDetailActivity redpktGroupDetailActivity4 = new RedpktGroupDetailActivity();
redpktGroupDetailActivity4.setBean(redpacketResponse.getRed());
redpktGroupDetailActivity4.setChat(this.currentChat);
redpktGroupDetailActivity4.setMessageId(messageObject.messageOwner.id);
presentFragment(redpktGroupDetailActivity4);
return;
}
showRedPacketDialog(MessagesController.getInstance(this.currentAccount).getUser(Integer.valueOf(Integer.parseInt(red.getInitiatorUserId()))), messageObject, redpacketResponse, true);
} else if (parseInt3 == 2) {
if (isReceived) {
RedpktGroupDetailActivity redpktGroupDetailActivity5 = new RedpktGroupDetailActivity();
redpktGroupDetailActivity5.setBean(redpacketResponse.getRed());
redpktGroupDetailActivity5.setChat(this.currentChat);
redpktGroupDetailActivity5.setMessageId(messageObject.messageOwner.id);
presentFragment(redpktGroupDetailActivity5);
return;
}
showRedPacketDialog(MessagesController.getInstance(this.currentAccount).getUser(Integer.valueOf(Integer.parseInt(red.getInitiatorUserId()))), messageObject, redpacketResponse, true);
}
}
} else if (cL_messagesRpkTransferMedia.trans == 1 || cL_messagesRpkTransferMedia.trans == 2) {
TransferResponse transferResponse = (TransferResponse) TLJsonResolve.parse(cL_messagesRpkTransferMedia.data, TransferResponse.class).model;
if (transferResponse.getState() == TransferResponse.Status.RECEIVED || transferResponse.getState() == TransferResponse.Status.REFUSED || transferResponse.getState() == TransferResponse.Status.TIMEOUT) {
TransferStatusActivity transferStatusActivity = new TransferStatusActivity();
transferStatusActivity.setMessage(messageObject.messageOwner);
transferStatusActivity.setTargetUser(this.currentUser);
transferStatusActivity.setSender(messageObject.isOutOwner());
presentFragment(transferStatusActivity);
return;
}
checkUserTransferDetail(messageObject, transferResponse);
}
}
public void showRedPacketDialog(final TLRPC.User user, final MessageObject messageObject, final RedpacketResponse redpacketResponse, final boolean z) {
if (this.mRedPacketDialogView == null) {
this.mRedPacketDialogView = View.inflate(getParentActivity(), R.layout.dialog_red_packet_layout, null);
this.mRedPacketViewHolder = new RedPacketViewHolder(getParentActivity(), this.mRedPacketDialogView);
DialogRedpkg dialogRedpkg = new DialogRedpkg(getParentActivity(), this.mRedPacketDialogView, R.style.red_pkg_dialog);
this.mRedPacketDialog = dialogRedpkg;
dialogRedpkg.setCancelable(false);
}
this.mRedPacketViewHolder.setData(user, redpacketResponse, z);
this.mRedPacketViewHolder.setOnRedPacketDialogClickListener(new OnRedPacketDialogClickListener() {
@Override
public void onCloseClick() {
ChatActivity.this.mRedPacketViewHolder.stopAnim();
ChatActivity.this.mRedPacketDialog.dismiss();
}
@Override
public void onOpenClick() {
ChatActivity.this.getRedpacket(user, messageObject, redpacketResponse, z);
}
@Override
public void toDetail(RedpacketResponse redpacketResponse2) {
if (ChatActivity.this.currentUser != null) {
RedpktDetailReceiverActivity redpktDetailReceiverActivity = new RedpktDetailReceiverActivity();
if (redpacketResponse2 != null) {
redpktDetailReceiverActivity.setBean(redpacketResponse2);
} else {
redpktDetailReceiverActivity.setBean(redpacketResponse);
}
ChatActivity.this.presentFragment(redpktDetailReceiverActivity);
} else {
RedpktGroupDetailActivity redpktGroupDetailActivity = new RedpktGroupDetailActivity();
if (redpacketResponse2 != null) {
redpktGroupDetailActivity.setBean(redpacketResponse2.getRed());
} else {
redpktGroupDetailActivity.setBean(redpacketResponse.getRed());
}
redpktGroupDetailActivity.setChat(ChatActivity.this.currentChat);
redpktGroupDetailActivity.setMessageId(messageObject.messageOwner.id);
ChatActivity.this.presentFragment(redpktGroupDetailActivity);
}
ChatActivity.this.mRedPacketViewHolder.stopAnim();
ChatActivity.this.mRedPacketDialog.dismiss();
}
});
this.mRedPacketDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
ChatActivity.this.lambda$showRedPacketDialog$125$ChatActivity(dialogInterface);
}
});
this.mRedPacketDialog.show();
}
public void lambda$showRedPacketDialog$125$ChatActivity(DialogInterface dialogInterface) {
this.mRedPacketViewHolder.clear();
}
public void getRedpacket(TLRPC.User user, MessageObject messageObject, RedpacketResponse redpacketResponse, boolean z) {
if (!BuildVars.WALLET_ENABLE) {
WalletDialogUtil.showConfirmBtnWalletDialog(this, LocaleController.getString("NoFeaturesTips", R.string.NoFeaturesTips));
return;
}
TLRPCRedpacket.CL_messages_rpkTransferReceive cL_messages_rpkTransferReceive = new TLRPCRedpacket.CL_messages_rpkTransferReceive();
cL_messages_rpkTransferReceive.trans = 0;
if (z) {
TLRPC.TL_inputPeerChannel tL_inputPeerChannel = new TLRPC.TL_inputPeerChannel();
tL_inputPeerChannel.channel_id = this.currentChat.id;
tL_inputPeerChannel.access_hash = this.currentChat.access_hash;
cL_messages_rpkTransferReceive.peer = tL_inputPeerChannel;
} else {
cL_messages_rpkTransferReceive.peer = getMessagesController().getInputPeer(user.id);
}
cL_messages_rpkTransferReceive.id = messageObject.messageOwner.id;
cL_messages_rpkTransferReceive.flags = 3;
if (z) {
RedpacketBean red = redpacketResponse.getRed();
int redTypeInt = red.getRedTypeInt();
if (redTypeInt == 1) {
int grantTypeInt = red.getGrantTypeInt();
if (grantTypeInt == 0) {
cL_messages_rpkTransferReceive.type = 2;
} else if (grantTypeInt == 1) {
cL_messages_rpkTransferReceive.type = 1;
}
} else if (redTypeInt == 2) {
cL_messages_rpkTransferReceive.type = 3;
}
} else {
cL_messages_rpkTransferReceive.type = 0;
}
RedTransOperation redTransOperation = new RedTransOperation(redpacketResponse.getRed().getSerialCode(), String.valueOf(getUserConfig().getClientUserId()), StringUtils.getNonceStr(getConnectionsManager().getCurrentTime()), UnifyBean.BUSINESS_KEY_REDPACKET_RECEIVE, "2.0.1");
TLRPC.Chat chat = this.currentChat;
if (chat != null) {
redTransOperation.setGroups(String.valueOf(chat.id));
}
TLRPC.TL_dataJSON tL_dataJSON = new TLRPC.TL_dataJSON();
tL_dataJSON.data = new Gson().toJson(redTransOperation);
cL_messages_rpkTransferReceive.data = tL_dataJSON;
new Handler().postDelayed(new AnonymousClass75(cL_messages_rpkTransferReceive, redpacketResponse, messageObject), 800L);
}
public class AnonymousClass75 implements Runnable {
final RedpacketResponse val$bean;
final MessageObject val$messageObject;
final TLRPCRedpacket.CL_messages_rpkTransferReceive val$req;
AnonymousClass75(TLRPCRedpacket.CL_messages_rpkTransferReceive cL_messages_rpkTransferReceive, RedpacketResponse redpacketResponse, MessageObject messageObject) {
this.val$req = cL_messages_rpkTransferReceive;
this.val$bean = redpacketResponse;
this.val$messageObject = messageObject;
}
@Override
public void run() {
ConnectionsManager connectionsManager = ChatActivity.this.getConnectionsManager();
TLRPCRedpacket.CL_messages_rpkTransferReceive cL_messages_rpkTransferReceive = this.val$req;
final RedpacketResponse redpacketResponse = this.val$bean;
final MessageObject messageObject = this.val$messageObject;
connectionsManager.sendRequest(cL_messages_rpkTransferReceive, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChatActivity.AnonymousClass75.this.lambda$run$1$ChatActivity$75(redpacketResponse, messageObject, tLObject, tL_error);
}
});
}
public void lambda$run$1$ChatActivity$75(final RedpacketResponse redpacketResponse, final MessageObject messageObject, TLObject tLObject, TLRPC.TL_error tL_error) {
if (tL_error != null) {
if ("RED_MSG_NOT_EXIST".equals(tL_error.text)) {
WalletDialogUtil.showSingleBtnWalletDialog(ChatActivity.this, "红包已撤回,不能领取了", null);
} else if ("REPEATED_REQUESTS".equals(tL_error.text)) {
WalletDialogUtil.showConfirmBtnWalletDialog(ChatActivity.this, "您的其它设备正在领取红包!");
} else if ("CHANNEL_NOT_EXIST".equals(tL_error.text)) {
WalletDialogUtil.showConfirmBtnWalletDialog(ChatActivity.this, "该群已解散,不能领取红包!");
} else {
AlertsCreator.showSimpleToast(ChatActivity.this, LocaleController.getString("SystemIsBusyAndTryAgainLater", R.string.SystemIsBusyAndTryAgainLater));
}
ChatActivity.this.mRedPacketViewHolder.stopAnim();
ChatActivity.this.mRedPacketDialog.dismiss();
} else if (tLObject instanceof TLRPC.TL_updates) {
TLRPC.TL_updates tL_updates = (TLRPC.TL_updates) tLObject;
ChatActivity.this.getMessagesController().processUpdates(tL_updates, false);
if (tL_updates.updates.size() > 0) {
TLRPC.Update update = tL_updates.updates.get(0);
if (update instanceof TLRPCRedpacket.CL_updateRpkTransfer) {
TLApiModel parse = TLJsonResolve.parse(((TLRPCRedpacket.CL_updateRpkTransfer) update).data, RedpacketResponse.class);
final RedpacketResponse redpacketResponse2 = (RedpacketResponse) parse.model;
if ("20004".equals(parse.code)) {
ChatActivity.this.mRedPacketViewHolder.setPromtText(LocaleController.getString("RedpacketIsGone", R.string.RedpacketIsGone), true);
ChatActivity.this.mRedPacketViewHolder.setRet(redpacketResponse2);
} else if ("20005".equals(parse.code)) {
ChatActivity.this.mRedPacketViewHolder.setPromtText(LocaleController.getString("RedpacketHadExpired", R.string.RedpacketHadExpired));
} else if ("20008".equals(parse.code)) {
ChatActivity.this.mRedPacketViewHolder.setPromtText(LocaleController.getString("YouCantReceivedRedpacket", R.string.YouCantReceivedRedpacket));
} else if ("50000".equals(parse.code)) {
ChatActivity.this.mRedPacketViewHolder.setPromtText(LocaleController.getString("SystemIsBusyAndTryAgainLater", R.string.SystemIsBusyAndTryAgainLater));
} else if ("20003".equals(parse.code)) {
ChatActivity.this.mRedPacketViewHolder.setPromtText(LocaleController.getString("YouHadAlreadyReceived", R.string.YouHadAlreadyReceived), true);
ChatActivity.this.mRedPacketViewHolder.setRet(redpacketResponse2);
} else if ("50001".equals(parse.code)) {
ChatActivity.this.mRedPacketViewHolder.setPromtText("您的其它设备正在领取红包");
} else if ("0".equals(parse.code)) {
redpacketResponse2.getRed().getStatus();
int isReceived = redpacketResponse2.getRed().getIsReceived();
boolean isReceived2 = redpacketResponse2.isReceived();
if (isReceived == 1 || isReceived2) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.AnonymousClass75.this.lambda$null$0$ChatActivity$75(redpacketResponse, messageObject, redpacketResponse2);
}
});
}
} else {
ToastUtils.show((CharSequence) WalletErrorUtil.getErrorDescription(parse.message));
}
}
}
}
}
public void lambda$null$0$ChatActivity$75(RedpacketResponse redpacketResponse, MessageObject messageObject, RedpacketResponse redpacketResponse2) {
if (ChatActivity.this.currentChat != null) {
RedpktGroupDetailActivity redpktGroupDetailActivity = new RedpktGroupDetailActivity();
redpktGroupDetailActivity.setBean(redpacketResponse.getRed());
redpktGroupDetailActivity.setChat(ChatActivity.this.currentChat);
redpktGroupDetailActivity.setMessageId(messageObject.messageOwner.id);
ChatActivity.this.presentFragment(redpktGroupDetailActivity);
} else {
RedpktDetailReceiverActivity redpktDetailReceiverActivity = new RedpktDetailReceiverActivity();
redpktDetailReceiverActivity.setBean(redpacketResponse2);
ChatActivity.this.presentFragment(redpktDetailReceiverActivity);
}
ChatActivity.this.mRedPacketViewHolder.stopAnim();
ChatActivity.this.mRedPacketViewHolder.setRet(redpacketResponse2);
ChatActivity.this.mRedPacketDialog.dismiss();
}
}
private void checkGroupRedpkgDetail(final MessageObject messageObject, RedpacketResponse redpacketResponse) {
if (!BuildVars.WALLET_ENABLE) {
WalletDialogUtil.showConfirmBtnWalletDialog(this, LocaleController.getString("NoFeaturesTips", R.string.NoFeaturesTips));
return;
}
TLRPCRedpacket.CL_message_rpkTransferCheck cL_message_rpkTransferCheck = new TLRPCRedpacket.CL_message_rpkTransferCheck();
cL_message_rpkTransferCheck.trans = 0;
if (this.currentChat != null) {
RedpacketBean red = redpacketResponse.getRed();
int redTypeInt = red.getRedTypeInt();
if (redTypeInt == 1) {
int grantTypeInt = red.getGrantTypeInt();
if (grantTypeInt == 0) {
cL_message_rpkTransferCheck.type = 2;
} else if (grantTypeInt == 1) {
cL_message_rpkTransferCheck.type = 1;
}
} else if (redTypeInt == 2) {
cL_message_rpkTransferCheck.type = 3;
}
} else {
cL_message_rpkTransferCheck.type = 0;
}
cL_message_rpkTransferCheck.flags = 2;
TLRPC.TL_inputPeerChannel tL_inputPeerChannel = new TLRPC.TL_inputPeerChannel();
tL_inputPeerChannel.channel_id = this.currentChat.id;
tL_inputPeerChannel.access_hash = this.currentChat.access_hash;
cL_message_rpkTransferCheck.peer = tL_inputPeerChannel;
cL_message_rpkTransferCheck.id = messageObject.messageOwner.id;
String serialCode = redpacketResponse.getRed().getSerialCode();
String str = getUserConfig().clientUserId + "";
TLRPC.Chat chat = this.currentChat;
RedTransOperation redTransOperation = new RedTransOperation(serialCode, str, chat == null ? "" : String.valueOf(chat.id), "android_" + getUserConfig().clientUserId + getConnectionsManager().getCurrentTime(), UnifyBean.BUSINESS_KEY_REDPACKET_CHECK, "2.0.1");
TLRPC.TL_dataJSON tL_dataJSON = new TLRPC.TL_dataJSON();
tL_dataJSON.data = new Gson().toJson(redTransOperation);
cL_message_rpkTransferCheck.data = tL_dataJSON;
this.redTransAlert = new XAlertDialog(getParentActivity(), 5);
this.reqId = getConnectionsManager().sendRequest(cL_message_rpkTransferCheck, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChatActivity.this.lambda$checkGroupRedpkgDetail$136$ChatActivity(messageObject, tLObject, tL_error);
}
});
getConnectionsManager().bindRequestToGuid(this.reqId, this.classGuid);
this.redTransAlert.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public final void onCancel(DialogInterface dialogInterface) {
ChatActivity.this.lambda$checkGroupRedpkgDetail$137$ChatActivity(dialogInterface);
}
});
this.redTransAlert.show();
}
public void lambda$checkGroupRedpkgDetail$136$ChatActivity(final MessageObject messageObject, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$126$ChatActivity();
}
});
if (tL_error != null) {
WalletDialogUtil.showConfirmBtnWalletDialog(this, WalletErrorUtil.getErrorDescription(tL_error.text));
} else if (tLObject instanceof TLRPC.TL_updates) {
TLRPC.TL_updates tL_updates = (TLRPC.TL_updates) tLObject;
Iterator<TLRPC.Update> it = tL_updates.updates.iterator();
while (it.hasNext()) {
TLRPC.Update next = it.next();
if (next instanceof TLRPCRedpacket.CL_updateRpkTransfer) {
TLApiModel parse = TLJsonResolve.parse(((TLRPCRedpacket.CL_updateRpkTransfer) next).data, RedpacketResponse.class);
if (parse.isSuccess() || "20004".equals(parse.code) || "20013".equals(parse.code) || "20008".equals(parse.code)) {
final RedpacketResponse redpacketResponse = (RedpacketResponse) parse.model;
RedpacketBean red = redpacketResponse.getRed();
if (red != null) {
getMessagesController().processUpdates(tL_updates, false);
if (red.getStatus() == null || TextUtils.isEmpty(red.getStatus())) {
return;
}
final TLRPC.User user = MessagesController.getInstance(this.currentAccount).getUser(Integer.valueOf(Integer.parseInt(red.getInitiatorUserId())));
final int isReceived = red.getIsReceived();
final boolean isReceived2 = redpacketResponse.isReceived();
final int parseInt = Integer.parseInt(red.getRedType());
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$127$ChatActivity(isReceived, isReceived2, parseInt, messageObject, redpacketResponse, user);
}
});
return;
}
return;
} else if ("USER_INFONNOT_CODE".equals(parse.message) || "SYSTEM_ERROR_ACCOUNT_EXCEPTION_CODE".equals(parse.message)) {
WalletDialogUtil.showWalletDialog(this, "", LocaleController.formatString("AccountInfoNotCompleted", R.string.AccountInfoNotCompleted, LocaleController.getString("ReceiveRedPacket", R.string.ReceiveRedPacket), LocaleController.getString("ReceiveRedPacket", R.string.ReceiveRedPacket)), LocaleController.getString(R.string.Close), LocaleController.getString(R.string.GoToWalletCenter), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.lambda$null$128();
}
});
}
}, null);
return;
} else if ("ACCOUNT_HAS_BEEN_FROZEN_CODE".equals(parse.message)) {
WalletDialogUtil.showWalletDialog(this, "", LocaleController.getString(R.string.PleaseContractServerToFindPayPasswordOrTryIt24HoursLater), LocaleController.getString(R.string.Close), LocaleController.getString(R.string.ContactCustomerService), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatActivity.this.lambda$null$131$ChatActivity(dialogInterface, i);
}
}, null);
return;
} else if ("ACCOUNT_UNCERTIFIED_CODE".equals(parse.message) || "EXCLUSIVE_PLEASE_BIND_FIRST_BANKINFO".equals(parse.message)) {
WalletDialogUtil.showWalletDialog(this, "", String.format(LocaleController.getString("BankCardNotBindTips", R.string.BankCardNotBindTips), LocaleController.getString("ReceiveRedPacket", R.string.ReceiveRedPacket)), LocaleController.getString(R.string.Close), LocaleController.getString("GoToBind", R.string.GoToBind), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.lambda$null$132();
}
});
}
}, null);
return;
} else if ("SYSTEM_ERROR_NOT_SET_PAYWORD_COCE".equals(parse.message)) {
WalletDialogUtil.showWalletDialog(this, "", String.format(LocaleController.getString("PayPasswordNotSetTips", R.string.PayPasswordNotSetTips), LocaleController.getString("ReceiveRedPacket", R.string.ReceiveRedPacket)), LocaleController.getString(R.string.Close), LocaleController.getString(R.string.redpacket_goto_set), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.lambda$null$134();
}
});
}
}, null);
return;
} else if (BuildVars.RELEASE_VERSION) {
WalletErrorUtil.parseErrorDialog(this, LocaleController.getString(R.string.SystemIsBusyAndTryAgainLater));
return;
} else {
WalletErrorUtil.parseErrorDialog(this, parse.code, parse.message);
return;
}
}
}
}
}
public void lambda$null$126$ChatActivity() {
this.redTransAlert.dismiss();
}
public void lambda$null$127$ChatActivity(int i, boolean z, int i2, MessageObject messageObject, RedpacketResponse redpacketResponse, TLRPC.User user) {
if (i == 1 || z || (i2 == 2 && messageObject.isOutOwner())) {
RedpktGroupDetailActivity redpktGroupDetailActivity = new RedpktGroupDetailActivity();
redpktGroupDetailActivity.setBean(redpacketResponse.getRed());
redpktGroupDetailActivity.setChat(this.currentChat);
redpktGroupDetailActivity.setMessageId(messageObject.messageOwner.id);
presentFragment(redpktGroupDetailActivity);
return;
}
showRedPacketDialog(user, messageObject, redpacketResponse, true);
}
public void lambda$null$130$ChatActivity() {
presentFragment(new AboutAppActivity());
}
public void lambda$null$131$ChatActivity(DialogInterface dialogInterface, int i) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$130$ChatActivity();
}
});
}
public void lambda$checkGroupRedpkgDetail$137$ChatActivity(DialogInterface dialogInterface) {
getConnectionsManager().cancelRequest(this.reqId, true);
}
private void checkUserRedpkgDetail(final MessageObject messageObject, RedpacketResponse redpacketResponse) {
if (!BuildVars.WALLET_ENABLE) {
WalletDialogUtil.showConfirmBtnWalletDialog(this, LocaleController.getString("NoFeaturesTips", R.string.NoFeaturesTips));
return;
}
TLRPCRedpacket.CL_message_rpkTransferCheck cL_message_rpkTransferCheck = new TLRPCRedpacket.CL_message_rpkTransferCheck();
cL_message_rpkTransferCheck.trans = 0;
cL_message_rpkTransferCheck.type = 0;
cL_message_rpkTransferCheck.flags = 2;
cL_message_rpkTransferCheck.id = messageObject.messageOwner.id;
TLRPC.TL_inputPeerUser tL_inputPeerUser = new TLRPC.TL_inputPeerUser();
tL_inputPeerUser.user_id = this.currentUser.id;
tL_inputPeerUser.access_hash = this.currentUser.access_hash;
cL_message_rpkTransferCheck.peer = tL_inputPeerUser;
this.redTransAlert = new XAlertDialog(getParentActivity(), 5);
String serialCode = redpacketResponse.getRed().getSerialCode();
String str = getUserConfig().clientUserId + "";
TLRPC.User user = this.currentUser;
RedTransOperation redTransOperation = new RedTransOperation(serialCode, str, user == null ? "" : String.valueOf(user.id), StringUtils.getRandomString(20) + getConnectionsManager().getCurrentTime(), UnifyBean.BUSINESS_KEY_REDPACKET_CHECK, "2.0.1");
TLRPC.TL_dataJSON tL_dataJSON = new TLRPC.TL_dataJSON();
tL_dataJSON.data = new Gson().toJson(redTransOperation);
cL_message_rpkTransferCheck.data = tL_dataJSON;
this.reqId = getConnectionsManager().sendRequest(cL_message_rpkTransferCheck, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChatActivity.this.lambda$checkUserRedpkgDetail$148$ChatActivity(messageObject, tLObject, tL_error);
}
});
getConnectionsManager().bindRequestToGuid(this.reqId, this.classGuid);
this.redTransAlert.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public final void onCancel(DialogInterface dialogInterface) {
ChatActivity.this.lambda$checkUserRedpkgDetail$149$ChatActivity(dialogInterface);
}
});
this.redTransAlert.show();
}
public void lambda$checkUserRedpkgDetail$148$ChatActivity(final MessageObject messageObject, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$138$ChatActivity();
}
});
if (tL_error != null) {
AlertsCreator.showSimpleToast(this, LocaleController.getString("SystemIsBusyAndTryAgainLater", R.string.SystemIsBusyAndTryAgainLater));
} else if (tLObject instanceof TLRPC.TL_updates) {
TLRPC.TL_updates tL_updates = (TLRPC.TL_updates) tLObject;
Iterator<TLRPC.Update> it = tL_updates.updates.iterator();
while (it.hasNext()) {
TLRPC.Update next = it.next();
if (next instanceof TLRPCRedpacket.CL_updateRpkTransfer) {
TLApiModel parse = TLJsonResolve.parse(((TLRPCRedpacket.CL_updateRpkTransfer) next).data, RedpacketResponse.class);
if (parse.isSuccess() || "20004".equals(parse.code) || "20013".equals(parse.code) || "20008".equals(parse.code)) {
final RedpacketResponse redpacketResponse = (RedpacketResponse) parse.model;
final RedpacketBean red = redpacketResponse.getRed();
if (red != null) {
getMessagesController().processUpdates(tL_updates, false);
if (red.getStatus() == null || TextUtils.isEmpty(red.getStatus())) {
return;
}
final TLRPC.User user = MessagesController.getInstance(this.currentAccount).getUser(Integer.valueOf(Integer.parseInt(red.getInitiatorUserId())));
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$139$ChatActivity(red, messageObject, redpacketResponse, user);
}
});
return;
}
return;
} else if ("USER_INFONNOT_CODE".equals(parse.message) || "SYSTEM_ERROR_ACCOUNT_EXCEPTION_CODE".equals(parse.message)) {
WalletDialogUtil.showWalletDialog(this, "", LocaleController.formatString("AccountInfoNotCompleted", R.string.AccountInfoNotCompleted, LocaleController.getString("ReceiveRedPacket", R.string.ReceiveRedPacket), LocaleController.getString("ReceiveRedPacket", R.string.ReceiveRedPacket)), LocaleController.getString(R.string.Close), LocaleController.getString(R.string.GoToWalletCenter), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.lambda$null$140();
}
});
}
}, null);
return;
} else if ("ACCOUNT_HAS_BEEN_FROZEN_CODE".equals(parse.message)) {
WalletDialogUtil.showWalletDialog(this, "", LocaleController.getString(R.string.PleaseContractServerToFindPayPasswordOrTryIt24HoursLater), LocaleController.getString(R.string.Close), LocaleController.getString(R.string.ContactCustomerService), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatActivity.this.lambda$null$143$ChatActivity(dialogInterface, i);
}
}, null);
return;
} else if ("ACCOUNT_UNCERTIFIED_CODE".equals(parse.message) || "EXCLUSIVE_PLEASE_BIND_FIRST_BANKINFO".equals(parse.message)) {
WalletDialogUtil.showWalletDialog(this, "", String.format(LocaleController.getString("BankCardNotBindTips", R.string.BankCardNotBindTips), LocaleController.getString("ReceiveRedPacket", R.string.ReceiveRedPacket)), LocaleController.getString(R.string.Close), LocaleController.getString("GoToBind", R.string.GoToBind), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.lambda$null$144();
}
});
}
}, null);
return;
} else if ("SYSTEM_ERROR_NOT_SET_PAYWORD_COCE".equals(parse.message)) {
WalletDialogUtil.showWalletDialog(this, "", String.format(LocaleController.getString("PayPasswordNotSetTips", R.string.PayPasswordNotSetTips), LocaleController.getString("ReceiveRedPacket", R.string.ReceiveRedPacket)), LocaleController.getString(R.string.Close), LocaleController.getString(R.string.redpacket_goto_set), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.lambda$null$146();
}
});
}
}, null);
return;
} else if (BuildVars.RELEASE_VERSION) {
WalletErrorUtil.parseErrorDialog(this, LocaleController.getString(R.string.SystemIsBusyAndTryAgainLater));
return;
} else {
WalletErrorUtil.parseErrorDialog(this, parse.code, parse.message);
return;
}
}
}
}
}
public void lambda$null$138$ChatActivity() {
this.redTransAlert.dismiss();
}
public void lambda$null$139$ChatActivity(RedpacketBean redpacketBean, MessageObject messageObject, RedpacketResponse redpacketResponse, TLRPC.User user) {
int parseInt = Integer.parseInt(redpacketBean.getStatus());
if (messageObject.isOut()) {
RedpktDetailActivity redpktDetailActivity = new RedpktDetailActivity();
redpktDetailActivity.setBean(redpacketResponse);
presentFragment(redpktDetailActivity);
} else if (parseInt == 1) {
RedpktDetailReceiverActivity redpktDetailReceiverActivity = new RedpktDetailReceiverActivity();
redpktDetailReceiverActivity.setBean(redpacketResponse);
presentFragment(redpktDetailReceiverActivity);
} else {
showRedPacketDialog(user, messageObject, redpacketResponse, false);
}
}
public void lambda$null$142$ChatActivity() {
presentFragment(new AboutAppActivity());
}
public void lambda$null$143$ChatActivity(DialogInterface dialogInterface, int i) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$142$ChatActivity();
}
});
}
public void lambda$checkUserRedpkgDetail$149$ChatActivity(DialogInterface dialogInterface) {
getConnectionsManager().cancelRequest(this.reqId, true);
}
private void checkUserTransferDetail(final MessageObject messageObject, TransferResponse transferResponse) {
if (!BuildVars.WALLET_ENABLE) {
WalletDialogUtil.showConfirmBtnWalletDialog(this, LocaleController.getString("NoFeaturesTips", R.string.NoFeaturesTips));
return;
}
TLRPCRedpacket.CL_message_rpkTransferCheck cL_message_rpkTransferCheck = new TLRPCRedpacket.CL_message_rpkTransferCheck();
cL_message_rpkTransferCheck.trans = 1;
cL_message_rpkTransferCheck.type = 0;
cL_message_rpkTransferCheck.flags = 2;
cL_message_rpkTransferCheck.id = messageObject.messageOwner.id;
TLRPC.TL_inputPeerUser tL_inputPeerUser = new TLRPC.TL_inputPeerUser();
tL_inputPeerUser.user_id = this.currentUser.id;
tL_inputPeerUser.access_hash = this.currentUser.access_hash;
cL_message_rpkTransferCheck.peer = tL_inputPeerUser;
String userIdJson = ParamsUtil.toUserIdJson(UnifyBean.BUSINESS_KEY_TRANSFER_CHECK, new String[]{"serialCode", "nonceStr"}, transferResponse.getSerialCode(), StringUtils.getRandomString(20) + getConnectionsManager().getCurrentTime());
TLRPC.TL_dataJSON tL_dataJSON = new TLRPC.TL_dataJSON();
tL_dataJSON.data = userIdJson;
cL_message_rpkTransferCheck.data = tL_dataJSON;
this.redTransAlert = new XAlertDialog(getParentActivity(), 5);
this.reqId = getConnectionsManager().sendRequest(cL_message_rpkTransferCheck, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChatActivity.this.lambda$checkUserTransferDetail$161$ChatActivity(messageObject, tLObject, tL_error);
}
});
getConnectionsManager().bindRequestToGuid(this.reqId, this.classGuid);
this.redTransAlert.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public final void onCancel(DialogInterface dialogInterface) {
ChatActivity.this.lambda$checkUserTransferDetail$162$ChatActivity(dialogInterface);
}
});
this.redTransAlert.show();
}
public void lambda$checkUserTransferDetail$161$ChatActivity(final MessageObject messageObject, TLObject tLObject, TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$150$ChatActivity();
}
});
if (tL_error != null) {
AlertsCreator.showSimpleToast(this, LocaleController.getString("SystemIsBusyAndTryAgainLater", R.string.SystemIsBusyAndTryAgainLater));
} else if (tLObject instanceof TLRPC.TL_updates) {
TLRPC.TL_updates tL_updates = (TLRPC.TL_updates) tLObject;
Iterator<TLRPC.Update> it = tL_updates.updates.iterator();
while (it.hasNext()) {
TLRPC.Update next = it.next();
if (next instanceof TLRPCRedpacket.CL_updateRpkTransfer) {
TLApiModel parse = TLJsonResolve.parse(((TLRPCRedpacket.CL_updateRpkTransfer) next).data, TransferResponse.class);
final TransferResponse transferResponse = (TransferResponse) parse.model;
if (parse.isSuccess()) {
getMessagesController().processUpdates(tL_updates, false);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$151$ChatActivity(transferResponse, messageObject);
}
});
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$152$ChatActivity();
}
});
if ("USER_INFONNOT_CODE".equals(parse.message) || "SYSTEM_ERROR_ACCOUNT_EXCEPTION_CODE".equals(parse.message)) {
WalletDialogUtil.showWalletDialog(this, "", LocaleController.formatString("AccountInfoNotCompleted", R.string.AccountInfoNotCompleted, LocaleController.getString("ReceiveTransfer", R.string.ReceiveTransfer), LocaleController.getString("ReceiveTransfer", R.string.ReceiveTransfer)), LocaleController.getString(R.string.Close), LocaleController.getString(R.string.GoToWalletCenter), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.lambda$null$153();
}
});
}
}, null);
return;
} else if ("ACCOUNT_HAS_BEEN_FROZEN_CODE".equals(parse.message)) {
WalletDialogUtil.showWalletDialog(this, "", LocaleController.getString(R.string.PleaseContractServerToFindPayPasswordOrTryIt24HoursLater), LocaleController.getString(R.string.Close), LocaleController.getString(R.string.ContactCustomerService), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatActivity.this.lambda$null$156$ChatActivity(dialogInterface, i);
}
}, null);
return;
} else if ("ACCOUNT_UNCERTIFIED_CODE".equals(parse.message) || "EXCLUSIVE_PLEASE_BIND_FIRST_BANKINFO".equals(parse.message)) {
WalletDialogUtil.showWalletDialog(this, "", String.format(LocaleController.getString("BankCardNotBindTips", R.string.BankCardNotBindTips), LocaleController.getString("ReceiveTransfer", R.string.ReceiveTransfer)), LocaleController.getString(R.string.Close), LocaleController.getString("GoToBind", R.string.GoToBind), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.lambda$null$157();
}
});
}
}, null);
return;
} else if ("SYSTEM_ERROR_NOT_SET_PAYWORD_COCE".equals(parse.message)) {
WalletDialogUtil.showWalletDialog(this, "", String.format(LocaleController.getString("PayPasswordNotSetTips", R.string.PayPasswordNotSetTips), LocaleController.getString("ReceiveTransfer", R.string.ReceiveTransfer)), LocaleController.getString(R.string.Close), LocaleController.getString(R.string.redpacket_goto_set), null, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.lambda$null$159();
}
});
}
}, null);
return;
} else if (BuildVars.RELEASE_VERSION) {
WalletErrorUtil.parseErrorDialog(this, LocaleController.getString("SystemIsBusyAndTryAgainLater", R.string.SystemIsBusyAndTryAgainLater));
return;
} else {
WalletErrorUtil.parseErrorDialog(this, parse.code, parse.message);
return;
}
}
}
}
}
public void lambda$null$150$ChatActivity() {
this.redTransAlert.dismiss();
}
public void lambda$null$151$ChatActivity(TransferResponse transferResponse, MessageObject messageObject) {
TransferStatusActivity transferStatusActivity = new TransferStatusActivity();
transferStatusActivity.setTransResponse(transferResponse);
transferStatusActivity.setMessage(messageObject.messageOwner);
transferStatusActivity.setTargetUser(this.currentUser);
transferStatusActivity.setSender(messageObject.isOutOwner());
presentFragment(transferStatusActivity);
}
public void lambda$null$152$ChatActivity() {
this.redTransAlert.dismiss();
}
public void lambda$null$155$ChatActivity() {
presentFragment(new AboutAppActivity());
}
public void lambda$null$156$ChatActivity(DialogInterface dialogInterface, int i) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivity.this.lambda$null$155$ChatActivity();
}
});
}
public void lambda$checkUserTransferDetail$162$ChatActivity(DialogInterface dialogInterface) {
getConnectionsManager().cancelRequest(this.reqId, true);
}
public String setMoneyFormat(String str) {
if (NumberUtil.isNumber(str)) {
if (str.contains(".")) {
String[] split = str.split("\\.");
String str2 = split[0];
String str3 = split[1];
String formatToString = MoneyUtil.formatToString(new BigDecimal(String.valueOf(str2)).multiply(new BigDecimal("1")).toString(), 0);
if (str3.length() > 8) {
str3 = str3.substring(0, 8);
}
return formatToString + "." + str3;
}
return MoneyUtil.formatToString(new BigDecimal(String.valueOf(str)).multiply(new BigDecimal("1")).toString(), 0);
}
return "";
}
public void sendEditMessageMedia(MessageObject messageObject) {
TLRPC.TL_inputPeerUser tL_inputPeerUser = new TLRPC.TL_inputPeerUser();
TLRPC.User currentUser = getUserConfig().getCurrentUser();
tL_inputPeerUser.user_id = currentUser.id;
tL_inputPeerUser.access_hash = currentUser.access_hash;
getSendMessagesHelper().sendEditMessageMedia(tL_inputPeerUser, messageObject.messageOwner.id, new TLRPC.TL_inputMediaEmpty());
}
public class ChatActivityAdapter extends RecyclerView.Adapter {
private int botInfoRow = -1;
private boolean isBot;
private int loadingDownRow;
private int loadingUpRow;
private Context mContext;
private int messagesEndRow;
private int messagesStartRow;
private int rowCount;
@Override
public long getItemId(int i) {
return -1L;
}
public ChatActivityAdapter(Context context) {
this.mContext = context;
this.isBot = ChatActivity.this.currentUser != null && ChatActivity.this.currentUser.bot;
}
public void updateRows() {
this.rowCount = 0;
if (!ChatActivity.this.messages.isEmpty()) {
if (!ChatActivity.this.forwardEndReached[0] || (ChatActivity.this.mergeDialogId != 0 && !ChatActivity.this.forwardEndReached[1])) {
int i = this.rowCount;
this.rowCount = i + 1;
this.loadingDownRow = i;
} else {
this.loadingDownRow = -1;
}
int i2 = this.rowCount;
this.messagesStartRow = i2;
int size = i2 + ChatActivity.this.messages.size();
this.rowCount = size;
this.messagesEndRow = size;
if (ChatActivity.this.currentUser != null && ChatActivity.this.currentUser.bot && !ChatActivity.this.inScheduleMode) {
int i3 = this.rowCount;
this.rowCount = i3 + 1;
this.botInfoRow = i3;
} else {
this.botInfoRow = -1;
}
if (!ChatActivity.this.endReached[0] || (ChatActivity.this.mergeDialogId != 0 && !ChatActivity.this.endReached[1])) {
int i4 = this.rowCount;
this.rowCount = i4 + 1;
this.loadingUpRow = i4;
return;
}
this.loadingUpRow = -1;
return;
}
this.loadingUpRow = -1;
this.loadingDownRow = -1;
this.messagesStartRow = -1;
this.messagesEndRow = -1;
if (ChatActivity.this.currentUser != null && ChatActivity.this.currentUser.bot && !MessagesController.isSupportUser(ChatActivity.this.currentUser) && !ChatActivity.this.inScheduleMode) {
int i5 = this.rowCount;
this.rowCount = i5 + 1;
this.botInfoRow = i5;
return;
}
this.botInfoRow = -1;
}
@Override
public int getItemCount() {
if (ChatActivity.this.clearingHistory) {
return 0;
}
return this.rowCount;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View inflate;
if (i == 0) {
if (!ChatActivity.this.chatMessageCellsCache.isEmpty()) {
inflate = (View) ChatActivity.this.chatMessageCellsCache.get(0);
ChatActivity.this.chatMessageCellsCache.remove(0);
} else {
inflate = new ChatMessageCell(this.mContext, ChatActivity.this);
}
ChatMessageCell chatMessageCell = (ChatMessageCell) inflate;
chatMessageCell.setDelegate(new AnonymousClass1());
if (ChatActivity.this.currentEncryptedChat == null) {
chatMessageCell.setAllowAssistant(true);
}
} else if (i == 1) {
inflate = new ChatActionCell(this.mContext);
((ChatActionCell) inflate).setDelegate(new ChatActionCell.ChatActionCellDelegate() {
@Override
public void didClickImage(ChatActionCell chatActionCell) {
MessageObject messageObject = chatActionCell.getMessageObject();
PhotoViewer.getInstance().setParentActivity(ChatActivity.this.getParentActivity());
TLRPC.PhotoSize closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 640);
if (closestPhotoSizeWithSize == null) {
PhotoViewer.getInstance().openPhoto(messageObject, 0L, 0L, ChatActivity.this.photoViewerProvider);
return;
}
PhotoViewer.getInstance().openPhoto(closestPhotoSizeWithSize.location, ImageLocation.getForPhoto(closestPhotoSizeWithSize, messageObject.messageOwner.action.photo), ChatActivity.this.photoViewerProvider);
}
@Override
public void didRedUrl(MessageObject messageObject) {
TLRPCRedpacket.CL_messagesActionReceivedRpkTransfer cL_messagesActionReceivedRpkTransfer = (TLRPCRedpacket.CL_messagesActionReceivedRpkTransfer) messageObject.messageOwner.action;
if (cL_messagesActionReceivedRpkTransfer.trans == 0) {
RedpacketResponse redpacketResponse = (RedpacketResponse) TLJsonResolve.parse(cL_messagesActionReceivedRpkTransfer.data, RedpacketResponse.class).model;
if (ChatActivity.this.currentUser != null) {
if (Integer.parseInt(redpacketResponse.getRed().getInitiatorUserId()) == ChatActivity.this.getUserConfig().clientUserId) {
RedpktDetailActivity redpktDetailActivity = new RedpktDetailActivity();
redpktDetailActivity.setBean(redpacketResponse);
ChatActivity.this.presentFragment(redpktDetailActivity);
return;
}
RedpktDetailReceiverActivity redpktDetailReceiverActivity = new RedpktDetailReceiverActivity();
redpktDetailReceiverActivity.setBean(redpacketResponse);
ChatActivity.this.presentFragment(redpktDetailReceiverActivity);
} else if (ChatActivity.this.currentChat != null) {
RedpktGroupDetailActivity redpktGroupDetailActivity = new RedpktGroupDetailActivity();
redpktGroupDetailActivity.setBean(redpacketResponse.getRed());
redpktGroupDetailActivity.setChat(ChatActivity.this.currentChat);
redpktGroupDetailActivity.setMessageId(messageObject.messageOwner.id);
ChatActivity.this.presentFragment(redpktGroupDetailActivity);
}
}
}
@Override
public void didLongPress(ChatActionCell chatActionCell, float f, float f2) {
ChatActivity.this.createMenu(chatActionCell, false, false, f, f2);
}
@Override
public void needOpenUserProfile(int i2) {
if (i2 < 0) {
Bundle bundle = new Bundle();
bundle.putInt("chat_id", -i2);
if (ChatActivity.this.getMessagesController().checkCanOpenChat(bundle, ChatActivity.this)) {
ChatActivity.this.presentFragment(new ChatActivity(bundle));
}
} else if (i2 != ChatActivity.this.getUserConfig().getClientUserId()) {
TLRPC.User user = ChatActivity.this.getMessagesController().getUser(Integer.valueOf(i2));
if (!user.self && ChatActivity.this.currentChat != null && !ChatObject.hasAdminRights(ChatActivity.this.currentChat)) {
if (ChatActivity.this.currentChat.megagroup && (ChatActivity.this.currentChat.flags & ConnectionsManager.FileTypeVideo) != 0 && !user.mutual_contact) {
ToastUtils.show((int) R.string.ForbidViewUserInfoTips);
return;
} else if (!ChatObject.canSendEmbed(ChatActivity.this.currentChat)) {
ToastUtils.show((int) R.string.ForbidViewUserAndGroupInfoTips);
return;
}
}
Bundle bundle2 = new Bundle();
bundle2.putInt("user_id", i2);
if (ChatActivity.this.currentEncryptedChat != null && i2 == ChatActivity.this.currentUser.id) {
bundle2.putLong("dialog_id", ChatActivity.this.dialog_id);
}
if (ChatActivity.this.currentChat != null) {
bundle2.putBoolean("forbid_add_contact", ChatActivity.this.currentChat.megagroup && (ChatActivity.this.currentChat.flags & ConnectionsManager.FileTypeVideo) != 0);
bundle2.putBoolean("has_admin_right", ChatObject.hasAdminRights(ChatActivity.this.currentChat));
}
bundle2.putInt("from_type", 2);
ChatActivity.this.presentFragment(new NewProfileActivity(bundle2));
}
}
@Override
public void didPressReplyMessage(ChatActionCell chatActionCell, int i2) {
MessageObject messageObject = chatActionCell.getMessageObject();
ChatActivity.this.scrollToMessageId(i2, messageObject.getId(), true, messageObject.getDialogId() == ChatActivity.this.mergeDialogId ? 1 : 0, false);
}
@Override
public void didPressBotButton(MessageObject messageObject, TLRPC.KeyboardButton keyboardButton) {
if (ChatActivity.this.getParentActivity() != null) {
if (ChatActivity.this.bottomOverlayChat.getVisibility() != 0 || (keyboardButton instanceof TLRPC.TL_keyboardButtonSwitchInline) || (keyboardButton instanceof TLRPC.TL_keyboardButtonCallback) || (keyboardButton instanceof TLRPC.TL_keyboardButtonGame) || (keyboardButton instanceof TLRPC.TL_keyboardButtonUrl) || (keyboardButton instanceof TLRPC.TL_keyboardButtonBuy) || (keyboardButton instanceof TLRPC.TL_keyboardButtonUrlAuth)) {
ChatActivity.this.chatActivityEnterView.didPressedBotButton(keyboardButton, messageObject, messageObject);
}
}
}
});
} else if (i == 2) {
inflate = new ChatUnreadCell(this.mContext);
} else if (i == 3) {
inflate = new BotHelpCell(this.mContext);
((BotHelpCell) inflate).setDelegate(new BotHelpCell.BotHelpCellDelegate() {
@Override
public final void didPressUrl(String str) {
ChatActivity.ChatActivityAdapter.this.lambda$onCreateViewHolder$0$ChatActivity$ChatActivityAdapter(str);
}
});
} else if (i == 4) {
inflate = new ChatLoadingCell(this.mContext);
} else {
inflate = i == 5 ? LayoutInflater.from(this.mContext).inflate(R.layout.item_chat_pay_bill_over_message, viewGroup, false) : null;
}
inflate.setLayoutParams(new RecyclerView.LayoutParams(-1, -2));
return new RecyclerListView.Holder(inflate);
}
public class AnonymousClass1 implements ChatMessageCell.ChatMessageCellDelegate {
@Override
public void didPressSysNotifyVideoFullPlayer(ChatMessageCell chatMessageCell) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressSysNotifyVideoFullPlayer(this, chatMessageCell);
}
AnonymousClass1() {
}
@Override
public void didPressRedpkgTransfer(ChatMessageCell chatMessageCell, MessageObject messageObject) {
ChatActivity.this.onRedpkgTransferClick(chatMessageCell, messageObject);
}
@Override
public void didPressShare(ChatMessageCell chatMessageCell) {
MessageObject.GroupedMessages groupedMessages;
if (ChatActivity.this.getParentActivity() == null) {
return;
}
if (ChatActivity.this.chatActivityEnterView != null) {
ChatActivity.this.chatActivityEnterView.closeKeyboard();
}
MessageObject messageObject = chatMessageCell.getMessageObject();
if (UserObject.isUserSelf(ChatActivity.this.currentUser) && messageObject.messageOwner.fwd_from.saved_from_peer != null) {
Bundle bundle = new Bundle();
if (messageObject.messageOwner.fwd_from.saved_from_peer.channel_id != 0) {
bundle.putInt("chat_id", messageObject.messageOwner.fwd_from.saved_from_peer.channel_id);
} else if (messageObject.messageOwner.fwd_from.saved_from_peer.chat_id != 0) {
bundle.putInt("chat_id", messageObject.messageOwner.fwd_from.saved_from_peer.chat_id);
} else if (messageObject.messageOwner.fwd_from.saved_from_peer.user_id != 0) {
bundle.putInt("user_id", messageObject.messageOwner.fwd_from.saved_from_peer.user_id);
}
bundle.putInt("message_id", messageObject.messageOwner.fwd_from.saved_from_msg_id);
if (ChatActivity.this.getMessagesController().checkCanOpenChat(bundle, ChatActivity.this)) {
ChatActivity.this.presentFragment(new ChatActivity(bundle));
return;
}
return;
}
ArrayList<MessageObject> arrayList = null;
if (messageObject.getGroupId() != 0 && (groupedMessages = (MessageObject.GroupedMessages) ChatActivity.this.groupedMessagesMap.get(messageObject.getGroupId())) != null) {
arrayList = groupedMessages.messages;
}
if (arrayList == null) {
arrayList = new ArrayList<>();
arrayList.add(messageObject);
}
ChatActivity.this.showDialog(new ShareAlert(ChatActivityAdapter.this.mContext, arrayList, null, ChatObject.isChannel(ChatActivity.this.currentChat), null, false) {
@Override
public void dismissInternal() {
super.dismissInternal();
AndroidUtilities.requestAdjustResize(ChatActivity.this.getParentActivity(), ChatActivity.this.classGuid);
if (ChatActivity.this.chatActivityEnterView.getVisibility() == 0) {
ChatActivity.this.fragmentView.requestLayout();
}
}
});
AndroidUtilities.setAdjustResizeToNothing(ChatActivity.this.getParentActivity(), ChatActivity.this.classGuid);
ChatActivity.this.fragmentView.requestLayout();
}
@Override
public boolean needPlayMessage(MessageObject messageObject) {
if (messageObject.isVoice() || messageObject.isRoundVideo()) {
boolean playMessage = MediaController.getInstance().playMessage(messageObject);
MediaController.getInstance().setVoiceMessagesPlaylist(playMessage ? ChatActivity.this.createVoiceMessagesPlaylist(messageObject, false) : null, false);
return playMessage;
} else if (messageObject.isMusic()) {
return MediaController.getInstance().setPlaylist(ChatActivity.this.messages, messageObject);
} else {
return false;
}
}
@Override
public void videoTimerReached() {
ChatActivity.this.showNoSoundHint();
}
@Override
public void didPressChannelAvatar(ChatMessageCell chatMessageCell, TLRPC.Chat chat, int i, float f, float f2) {
if (ChatActivity.this.actionBar.isActionModeShowed()) {
ChatActivity.this.processRowSelect(chatMessageCell, true, f, f2);
} else if (chat == null || chat == ChatActivity.this.currentChat) {
} else {
Bundle bundle = new Bundle();
bundle.putInt("chat_id", chat.id);
if (i != 0) {
bundle.putInt("message_id", i);
}
if (ChatActivity.this.getMessagesController().checkCanOpenChat(bundle, ChatActivity.this, chatMessageCell.getMessageObject())) {
ChatActivity.this.presentFragment(new ChatActivity(bundle));
}
}
}
@Override
public void didPressHiddenForward(ChatMessageCell chatMessageCell) {
ChatActivity.this.showForwardHint(chatMessageCell);
}
@Override
public void didPressOther(ChatMessageCell chatMessageCell, float f, float f2) {
boolean z = true;
if (chatMessageCell.getMessageObject().type == 16) {
if (ChatActivity.this.currentUser == null || !(chatMessageCell.getMessageObject().messageOwner.action instanceof TLRPC.TL_messageActionPhoneCall)) {
return;
}
int i = ((TLRPC.TL_messageActionPhoneCall) chatMessageCell.getMessageObject().messageOwner.action).flags & 4;
if (ApplicationLoader.mbytAVideoCallBusy == 0) {
if (MessagesController.getInstance(ChatActivity.this.currentAccount).getUser(Integer.valueOf(ChatActivity.this.arguments.getInt("user_id", 0))).mutual_contact) {
int connectionState = ConnectionsManager.getInstance(ChatActivity.this.currentAccount).getConnectionState();
if (connectionState == 2 || connectionState == 1) {
ToastUtils.show((CharSequence) LocaleController.getString("visual_call_no_network", R.string.visual_call_no_network));
return;
}
return;
}
ToastUtils.show((CharSequence) LocaleController.getString("visual_call_no_friend_tip", R.string.visual_call_no_friend_tip));
} else if (ApplicationLoader.mbytAVideoCallBusy == 3 || ApplicationLoader.mbytAVideoCallBusy == 4) {
ToastUtils.show((CharSequence) LocaleController.getString("visual_call_busing_tip", R.string.visual_call_busing_tip));
}
} else if (chatMessageCell.getMessageObject().type == 103) {
if (chatMessageCell.getMessageObject().messageOwner.media instanceof TLRPC.TL_messageMediaShareContact) {
TLRPC.User user = MessagesController.getInstance(ChatActivity.this.currentAccount).getUser(Integer.valueOf(((TLRPC.TL_messageMediaShareContact) chatMessageCell.getMessageObject().messageOwner.media).user_id));
if (user != null) {
if (!user.self && ChatActivity.this.currentChat != null && !ChatObject.hasAdminRights(ChatActivity.this.currentChat)) {
if (ChatActivity.this.currentChat.megagroup && (ChatActivity.this.currentChat.flags & ConnectionsManager.FileTypeVideo) != 0 && !user.mutual_contact) {
ToastUtils.show((int) R.string.ForbidViewUserInfoTips);
return;
} else if (!ChatObject.canSendEmbed(ChatActivity.this.currentChat)) {
ToastUtils.show((int) R.string.ForbidViewUserAndGroupInfoTips);
return;
}
}
if (user.mutual_contact || user.id == UserConfig.getInstance(ChatActivity.this.currentAccount).getCurrentUser().id) {
Bundle bundle = new Bundle();
bundle.putInt("user_id", user.id);
if (ChatActivity.this.currentChat != null) {
bundle.putBoolean("forbid_add_contact", (!ChatActivity.this.currentChat.megagroup || (ChatActivity.this.currentChat.flags & ConnectionsManager.FileTypeVideo) == 0) ? false : false);
bundle.putBoolean("has_admin_right", ChatObject.hasAdminRights(ChatActivity.this.currentChat));
}
ChatActivity.this.presentFragment(new NewProfileActivity(bundle));
return;
}
Bundle bundle2 = new Bundle();
bundle2.putInt("from_type", 4);
ChatActivity.this.presentFragment(new AddContactsInfoActivity(bundle2, user));
return;
}
XDialog.Builder builder = new XDialog.Builder(ChatActivity.this.getParentActivity());
builder.setTitle(LocaleController.getString(R.string.Tips));
builder.setMessage(LocaleController.getString(R.string.share_contact_card_info_error));
builder.setNegativeButton(LocaleController.getString("OK", R.string.OK), null);
ChatActivity.this.showDialog(builder.create());
}
} else if (chatMessageCell.getMessageObject().type == 105) {
MessageObject messageObject = chatMessageCell.getMessageObject();
boolean isClickSysNotifyItem = chatMessageCell.isClickSysNotifyItem();
TLRPCContacts.TL_messageMediaSysNotify tL_messageMediaSysNotify = (TLRPCContacts.TL_messageMediaSysNotify) messageObject.messageOwner.media;
if (tL_messageMediaSysNotify.business_code < 4 || tL_messageMediaSysNotify.business_code == 10) {
return;
}
if (tL_messageMediaSysNotify.business_code == 8 && !isClickSysNotifyItem) {
ChatActivity.this.sendEditMessageMedia(messageObject);
} else if (!isClickSysNotifyItem || tL_messageMediaSysNotify.business_code == 8) {
} else {
ChatActivity.this.presentFragment(new FcPageDetailActivity(((ChatFCAttentionBean) GsonUtils.fromJson(TLJsonResolve.getData(tL_messageMediaSysNotify.data), (Class<Object>) ChatFCAttentionBean.class)).interact_msg.forum_id));
}
} else if (chatMessageCell.getMessageObject().type == 207) {
} else {
ChatActivity.this.createMenu(chatMessageCell, true, false, f, f2, false);
}
}
@Override
public void didPressUserAvatar(ChatMessageCell chatMessageCell, TLRPC.User user, float f, float f2) {
boolean z = true;
if (ChatActivity.this.actionBar.isActionModeShowed()) {
ChatActivity.this.processRowSelect(chatMessageCell, true, f, f2);
} else if (user != null) {
if (!user.self && ChatActivity.this.currentChat != null && !ChatObject.hasAdminRights(ChatActivity.this.currentChat) && ChatActivity.this.currentChat.megagroup && (ChatActivity.this.currentChat.flags & ConnectionsManager.FileTypeVideo) != 0 && !user.mutual_contact) {
ToastUtils.show((int) R.string.ForbidViewUserInfoTips);
return;
}
Bundle bundle = new Bundle();
bundle.putInt("user_id", user.id);
if (ChatActivity.this.currentChat != null) {
bundle.putBoolean("forbid_add_contact", (!ChatActivity.this.currentChat.megagroup || (ChatActivity.this.currentChat.flags & ConnectionsManager.FileTypeVideo) == 0) ? false : false);
bundle.putBoolean("has_admin_right", ChatObject.hasAdminRights(ChatActivity.this.currentChat));
bundle.putInt("from_type", 2);
}
ChatActivity.this.presentFragment(new NewProfileActivity(bundle));
}
}
@Override
public void didLongPressUserAvatar(ChatMessageCell chatMessageCell, TLRPC.User user, float f, float f2) {
if (user != null) {
SpannableString spannableString = new SpannableString("@" + (UserObject.getName(user) + " ") + " ");
StringBuilder sb = new StringBuilder();
sb.append("");
sb.append(user.id);
spannableString.setSpan(new URLSpanUserMention(sb.toString(), 1), 0, spannableString.length(), 33);
spannableString.setSpan(new ForegroundColorSpan(Theme.getColor(Theme.key_chat_messagePanelMetionText)), 0, spannableString.length(), 33);
if ((ChatActivity.this.currentChat == null || !(ChatActivity.this.currentChat == null || ChatObject.canSendMessages(ChatActivity.this.currentChat) || (ChatObject.isChannel(ChatActivity.this.currentChat) && !ChatActivity.this.currentChat.megagroup))) || user.self) {
return;
}
ChatActivity.this.chatActivityEnterView.addMentionText(ChatActivity.this.chatActivityEnterView.getCursorPosition(), 1, spannableString, false);
}
}
@Override
public void didPressBotButton(ChatMessageCell chatMessageCell, TLRPC.KeyboardButton keyboardButton) {
if (ChatActivity.this.getParentActivity() != null) {
if (ChatActivity.this.bottomOverlayChat.getVisibility() != 0 || (keyboardButton instanceof TLRPC.TL_keyboardButtonSwitchInline) || (keyboardButton instanceof TLRPC.TL_keyboardButtonCallback) || (keyboardButton instanceof TLRPC.TL_keyboardButtonGame) || (keyboardButton instanceof TLRPC.TL_keyboardButtonUrl) || (keyboardButton instanceof TLRPC.TL_keyboardButtonBuy) || (keyboardButton instanceof TLRPC.TL_keyboardButtonUrlAuth)) {
ChatActivity.this.chatActivityEnterView.didPressedBotButton(keyboardButton, chatMessageCell.getMessageObject(), chatMessageCell.getMessageObject());
}
}
}
@Override
public void didPressReaction(ChatMessageCell chatMessageCell, TLRPC.TL_reactionCount tL_reactionCount) {
ChatActivity.this.getSendMessagesHelper().sendReaction(chatMessageCell.getMessageObject(), tL_reactionCount.reaction, ChatActivity.this);
}
@Override
public void didPressVoteButton(ChatMessageCell chatMessageCell, TLRPC.TL_pollAnswer tL_pollAnswer) {
ChatActivity.this.getSendMessagesHelper().sendVote(chatMessageCell.getMessageObject(), tL_pollAnswer, null);
}
@Override
public void didPressCancelSendButton(ChatMessageCell chatMessageCell) {
MessageObject messageObject = chatMessageCell.getMessageObject();
if (messageObject.messageOwner.send_state != 0) {
ChatActivity.this.getSendMessagesHelper().cancelSendingMessage(messageObject);
}
}
@Override
public void didLongPress(ChatMessageCell chatMessageCell, float f, float f2) {
ChatActivity.this.createMenu(chatMessageCell, false, false, f, f2);
}
@Override
public boolean canPerformActions() {
return (ChatActivity.this.actionBar == null || ChatActivity.this.actionBar.isActionModeShowed()) ? false : true;
}
@Override
public void didPressUrl(ChatMessageCell chatMessageCell, CharacterStyle characterStyle, boolean z) {
TLRPC.WebPage webPage;
if (characterStyle == null || ChatActivity.this.getParentActivity() == null) {
return;
}
MessageObject messageObject = chatMessageCell.getMessageObject();
if (characterStyle instanceof URLSpanMono) {
((URLSpanMono) characterStyle).copyToClipboard();
ToastUtils.show((int) R.string.TextCopied);
return;
}
ChatMessageCell chatMessageCell2 = null;
boolean z2 = true;
boolean z3 = true;
if (characterStyle instanceof URLSpanUserMention) {
TLRPC.User user = ChatActivity.this.getMessagesController().getUser(Utilities.parseInt(((URLSpanUserMention) characterStyle).getURL()));
if (user != null) {
if (!user.self && ChatActivity.this.currentChat != null && !ChatObject.hasAdminRights(ChatActivity.this.currentChat)) {
if (ChatActivity.this.currentChat.megagroup && (ChatActivity.this.currentChat.flags & ConnectionsManager.FileTypeVideo) != 0 && !user.mutual_contact) {
ToastUtils.show((int) R.string.ForbidViewUserInfoTips);
return;
} else if (!ChatObject.canSendEmbed(ChatActivity.this.currentChat)) {
ToastUtils.show((int) R.string.ForbidViewUserAndGroupInfoTips);
return;
}
}
Bundle bundle = new Bundle();
bundle.putInt("user_id", user.id);
if (ChatActivity.this.currentChat != null) {
bundle.putBoolean("forbid_add_contact", (!ChatActivity.this.currentChat.megagroup || (33554432 & ChatActivity.this.currentChat.flags) == 0) ? false : false);
bundle.putBoolean("has_admin_right", ChatObject.hasAdminRights(ChatActivity.this.currentChat));
}
bundle.putInt("from_type", 2);
if (user.bot) {
MessagesController.openChatOrProfileWith(user, null, ChatActivity.this, 0, false);
} else {
ChatActivity.this.presentFragment(new NewProfileActivity(bundle));
}
}
} else if (characterStyle instanceof URLSpanNoUnderline) {
String url = ((URLSpanNoUnderline) characterStyle).getURL();
if (url.startsWith("@")) {
String lowerCase = url.substring(1).toLowerCase();
if ("all".equals(lowerCase)) {
return;
}
if ((ChatActivity.this.currentChat == null || TextUtils.isEmpty(ChatActivity.this.currentChat.username) || !lowerCase.equals(ChatActivity.this.currentChat.username.toLowerCase())) && (ChatActivity.this.currentUser == null || TextUtils.isEmpty(ChatActivity.this.currentUser.username) || !lowerCase.equals(ChatActivity.this.currentUser.username.toLowerCase()))) {
ChatActivity.this.getMessagesController().openByUserName(lowerCase, (BaseFragment) ChatActivity.this, ChatActivity.this.currentChat, false);
return;
}
Bundle bundle2 = new Bundle();
if (ChatActivity.this.currentChat != null) {
bundle2.putInt("chat_id", ChatActivity.this.currentChat.id);
} else if (ChatActivity.this.currentUser != null) {
bundle2.putInt("user_id", ChatActivity.this.currentUser.id);
if (ChatActivity.this.currentEncryptedChat != null) {
bundle2.putLong("dialog_id", ChatActivity.this.dialog_id);
}
}
if (ChatActivity.this.currentUser != null) {
ChatActivity.this.presentFragment(new NewProfileActivity(bundle2));
return;
}
ProfileActivity profileActivity = new ProfileActivity(bundle2);
profileActivity.setPlayProfileAnimation(true);
profileActivity.setChatInfo(ChatActivity.this.chatInfo);
profileActivity.setUserInfo(ChatActivity.this.userInfo);
ChatActivity.this.presentFragment(profileActivity);
} else if (url.startsWith("#") || url.startsWith("$")) {
if (ChatObject.isChannel(ChatActivity.this.currentChat)) {
ChatActivity.this.openSearchWithText(url);
return;
}
DialogsActivity dialogsActivity = new DialogsActivity(null);
dialogsActivity.setSearchString(url);
ChatActivity.this.presentFragment(dialogsActivity);
} else if (url.startsWith("/")) {
if (URLSpanBotCommand.enabled) {
ChatActivity.this.chatActivityEnterView.setCommand(messageObject, url, z, (ChatActivity.this.currentChat == null || !ChatActivity.this.currentChat.megagroup) ? false : false);
if (z || ChatActivity.this.chatActivityEnterView.getFieldText() != null) {
return;
}
ChatActivity.this.hideFieldPanel(false);
}
} else if (url.startsWith(MimeTypes.BASE_TYPE_VIDEO)) {
int intValue = Utilities.parseInt(url).intValue();
if (messageObject.isYouTubeVideo()) {
webPage = messageObject.messageOwner.media.webpage;
} else {
webPage = (messageObject.replyMessageObject == null || !messageObject.replyMessageObject.isYouTubeVideo()) ? null : messageObject.replyMessageObject.messageOwner.media.webpage;
}
if (webPage != null) {
EmbedBottomSheet.show(ChatActivityAdapter.this.mContext, webPage.site_name, webPage.title, webPage.url, webPage.embed_url, webPage.embed_width, webPage.embed_height, intValue);
return;
}
if (messageObject.isVideo() || messageObject.replyMessageObject == null) {
chatMessageCell2 = chatMessageCell;
} else {
messageObject = (MessageObject) ChatActivity.this.messagesDict[messageObject.replyMessageObject.getDialogId() == ChatActivity.this.dialog_id ? (char) 0 : (char) 1].get(messageObject.replyMessageObject.getId());
}
messageObject.forceSeekTo = intValue / messageObject.getDuration();
openPhotoViewerForMessage(chatMessageCell2, messageObject);
}
} else {
final String url2 = ((URLSpan) characterStyle).getURL();
if (z) {
BottomSheet.Builder builder = new BottomSheet.Builder(ChatActivity.this.getParentActivity());
builder.setTitle(url2);
builder.setItems(new CharSequence[]{LocaleController.getString("Open", R.string.Open), LocaleController.getString("Copy", R.string.Copy)}, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatActivity.ChatActivityAdapter.AnonymousClass1.this.lambda$didPressUrl$0$ChatActivity$ChatActivityAdapter$1(url2, dialogInterface, i);
}
});
ChatActivity.this.showDialog(builder.create());
} else if ((characterStyle instanceof URLSpanReplacement) && (url2 == null || !url2.startsWith("mailto:"))) {
ChatActivity.this.showOpenUrlAlert(url2, true);
} else if (characterStyle instanceof URLSpan) {
if ((messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage) && messageObject.messageOwner.media.webpage != null && messageObject.messageOwner.media.webpage.cached_page != null) {
String lowerCase2 = url2.toLowerCase();
String lowerCase3 = messageObject.messageOwner.media.webpage.url.toLowerCase();
if ((lowerCase2.contains("m12345.cc/blog") || lowerCase2.contains("telegra.ph") || lowerCase2.contains("m12345.cc/iv")) && (lowerCase2.contains(lowerCase3) || lowerCase3.contains(lowerCase2))) {
ArticleViewer.getInstance().setParentActivity(ChatActivity.this.getParentActivity(), ChatActivity.this);
ArticleViewer.getInstance().open(messageObject);
return;
}
}
if (ChatObject.canSendEmbed(ChatActivity.this.currentChat)) {
QrCodeParseUtil.tryParseQrCode(ChatActivity.this, ChatActivity.this.currentAccount, url2, false, false, true, ChatActivity.this.inlineReturn == 0);
} else {
ToastUtils.show((int) R.string.ForbidClickLink);
}
} else if (characterStyle instanceof ClickableSpan) {
((ClickableSpan) characterStyle).onClick(ChatActivity.this.fragmentView);
}
}
}
public void lambda$didPressUrl$0$ChatActivity$ChatActivityAdapter$1(String str, DialogInterface dialogInterface, int i) {
if (i == 0) {
if (ChatObject.canSendEmbed(ChatActivity.this.currentChat)) {
Browser.openUrl((Context) ChatActivity.this.getParentActivity(), str, ChatActivity.this.inlineReturn == 0, false);
} else {
ToastUtils.show((int) R.string.ForbidClickLink);
}
} else if (i == 1) {
if (str.startsWith("mailto:")) {
str = str.substring(7);
} else if (str.startsWith("tel:")) {
str = str.substring(4);
}
AndroidUtilities.addToClipboard(str);
}
}
@Override
public void needOpenWebView(String str, String str2, String str3, String str4, int i, int i2) {
try {
EmbedBottomSheet.show(ChatActivityAdapter.this.mContext, str2, str3, str4, str, i, i2);
} catch (Throwable th) {
FileLog.e(th);
}
}
@Override
public void didPressReplyMessage(ChatMessageCell chatMessageCell, int i) {
MessageObject messageObject = chatMessageCell.getMessageObject();
if (ChatActivity.this.inScheduleMode) {
ChatActivity.this.chatActivityDelegate.openReplyMessage(i);
ChatActivity.this.finishFragment();
return;
}
ChatActivity.this.scrollToMessageId(i, messageObject.getId(), true, messageObject.getDialogId() == ChatActivity.this.mergeDialogId ? 1 : 0, false);
}
@Override
public void didPressViaBot(ChatMessageCell chatMessageCell, String str) {
if (ChatActivity.this.bottomOverlayChat == null || ChatActivity.this.bottomOverlayChat.getVisibility() != 0) {
if ((ChatActivity.this.bottomOverlay == null || ChatActivity.this.bottomOverlay.getVisibility() != 0) && ChatActivity.this.chatActivityEnterView != null && str != null && str.length() > 0) {
ChatActivityEnterView chatActivityEnterView = ChatActivity.this.chatActivityEnterView;
chatActivityEnterView.setFieldText("@" + str + " ");
ChatActivity.this.chatActivityEnterView.openKeyboard();
}
}
}
@Override
public void didStartVideoStream(MessageObject messageObject) {
if (messageObject.isVideo()) {
ChatActivity.this.sendSecretMessageRead(messageObject);
}
}
void openPhotoViewerForMessage(ChatMessageCell chatMessageCell, MessageObject messageObject) {
ChatMessageCell chatMessageCell2;
AnimatedFileDrawable animation;
Bitmap animatedBitmap;
if (chatMessageCell == null) {
int childCount = ChatActivity.this.chatListView.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = ChatActivity.this.chatListView.getChildAt(i);
if (childAt instanceof ChatMessageCell) {
chatMessageCell2 = (ChatMessageCell) childAt;
if (chatMessageCell2.getMessageObject().equals(messageObject)) {
break;
}
}
}
}
chatMessageCell2 = chatMessageCell;
if (messageObject.isVideo()) {
ChatActivity.this.sendSecretMessageRead(messageObject);
}
PhotoViewer.getInstance().setParentActivity(ChatActivity.this.getParentActivity());
MessageObject playingMessageObject = MediaController.getInstance().getPlayingMessageObject();
if (chatMessageCell2 != null && playingMessageObject != null && playingMessageObject.isVideo()) {
ChatActivity.this.getFileLoader().setLoadingVideoForPlayer(playingMessageObject.getDocument(), false);
if (playingMessageObject.equals(messageObject) && (animation = chatMessageCell2.getPhotoImage().getAnimation()) != null && ChatActivity.this.videoTextureView != null && ChatActivity.this.videoPlayerContainer.getTag() != null && (animatedBitmap = animation.getAnimatedBitmap()) != null) {
try {
Bitmap bitmap = ChatActivity.this.videoTextureView.getBitmap(animatedBitmap.getWidth(), animatedBitmap.getHeight());
new Canvas(animatedBitmap).drawBitmap(bitmap, 0.0f, 0.0f, (Paint) null);
bitmap.recycle();
} catch (Throwable th) {
FileLog.e(th);
}
}
MediaController.getInstance().cleanupPlayer(true, true, false, playingMessageObject.equals(messageObject));
}
if (!ChatActivity.this.inScheduleMode || (!messageObject.isVideo() && messageObject.type != 1)) {
if (PhotoViewer.getInstance().openPhoto(messageObject, messageObject.type != 0 ? ChatActivity.this.dialog_id : 0L, messageObject.type != 0 ? ChatActivity.this.mergeDialogId : 0L, ChatActivity.this.photoViewerProvider)) {
PhotoViewer.getInstance().setParentChatActivity(ChatActivity.this);
}
} else {
PhotoViewer.getInstance().setParentChatActivity(ChatActivity.this);
ArrayList<MessageObject> arrayList = new ArrayList<>();
int size = ChatActivity.this.messages.size();
for (int i2 = 0; i2 < size; i2++) {
MessageObject messageObject2 = ChatActivity.this.messages.get(i2);
if (messageObject2.isVideo() || messageObject2.type == 1) {
arrayList.add(0, messageObject2);
}
}
PhotoViewer.getInstance().openPhoto(arrayList, arrayList.indexOf(messageObject), ChatActivity.this.dialog_id, 0L, ChatActivity.this.photoViewerProvider);
}
if (ChatActivity.this.noSoundHintView != null) {
ChatActivity.this.noSoundHintView.hide();
}
if (ChatActivity.this.forwardHintView != null) {
ChatActivity.this.forwardHintView.hide();
}
if (ChatActivity.this.slowModeHint != null) {
ChatActivity.this.slowModeHint.hide();
}
MediaController.getInstance().resetGoingToShowMessageObject();
}
@Override
public void didPressImage(ChatMessageCell chatMessageCell, float f, float f2) {
boolean z;
TLRPC.Document document;
File file;
MessageObject messageObject = chatMessageCell.getMessageObject();
if (messageObject.isSendError()) {
ChatActivity.this.createMenu(chatMessageCell, false, false, f, f2);
} else if (messageObject.isSending()) {
} else {
if (messageObject.isAnimatedEmoji()) {
ChatActivity.this.restartSticker(chatMessageCell);
} else if (messageObject.needDrawBluredPreview()) {
if (ChatActivity.this.sendSecretMessageRead(messageObject)) {
chatMessageCell.invalidate();
}
SecretMediaViewer.getInstance().setParentActivity(ChatActivity.this.getParentActivity());
SecretMediaViewer.getInstance().openMedia(messageObject, ChatActivity.this.photoViewerProvider);
} else {
ChatActivityEnterView chatActivityEnterView = null;
r0 = null;
File file2 = null;
chatActivityEnterView = null;
if (messageObject.type == 13 || messageObject.type == 15) {
ChatActivity chatActivity = ChatActivity.this;
FragmentActivity parentActivity = ChatActivity.this.getParentActivity();
ChatActivity chatActivity2 = ChatActivity.this;
TLRPC.InputStickerSet inputStickerSet = messageObject.getInputStickerSet();
if (ChatActivity.this.bottomOverlayChat.getVisibility() != 0 && (ChatActivity.this.currentChat == null || ChatObject.canSendStickers(ChatActivity.this.currentChat))) {
chatActivityEnterView = ChatActivity.this.chatActivityEnterView;
}
chatActivity.showDialog(new StickersAlert(parentActivity, chatActivity2, inputStickerSet, null, chatActivityEnterView));
return;
}
boolean z2 = false;
if (messageObject.isVideo() || messageObject.type == 1 || ((messageObject.type == 0 && !messageObject.isWebpageDocument()) || messageObject.isGif())) {
if (messageObject.type == 1) {
if (messageObject.type == 0) {
document = messageObject.messageOwner.media.webpage.document;
} else {
document = messageObject.getDocument();
}
if (document != null && !MessageObject.isVoiceDocument(document) && !MessageObject.isMusicDocument(document) && !MessageObject.isVideoDocument(document) && !MessageObject.isGifDocument(document) && ((document.mime_type != null && document.mime_type.toLowerCase().startsWith("image/")) || MessageObject.isDocumentHasThumb(document))) {
z = true;
if (!z) {
if (messageObject.canPreviewDocument()) {
PhotoViewer.getInstance().setParentActivity(ChatActivity.this.getParentActivity());
PhotoViewer.getInstance().openPhoto(messageObject, messageObject.type != 0 ? ChatActivity.this.dialog_id : 0L, messageObject.type != 0 ? ChatActivity.this.mergeDialogId : 0L, ChatActivity.this.photoViewerProvider);
z2 = true;
}
if (z2) {
return;
}
try {
AndroidUtilities.openForView(messageObject, ChatActivity.this.getParentActivity());
return;
} catch (Exception e) {
FileLog.e(e);
ChatActivity.this.alertUserOpenError(messageObject);
return;
}
}
openPhotoViewerForMessage(chatMessageCell, messageObject);
return;
}
}
z = false;
if (!z) {
}
} else if (messageObject.type == 3) {
ChatActivity.this.sendSecretMessageRead(messageObject);
try {
if (messageObject.messageOwner.attachPath != null && messageObject.messageOwner.attachPath.length() != 0) {
file2 = new File(messageObject.messageOwner.attachPath);
}
if (file2 == null || !file2.exists()) {
file2 = FileLoader.getPathToMessage(messageObject.messageOwner);
}
Intent intent = new Intent("android.intent.action.VIEW");
if (Build.VERSION.SDK_INT >= 24) {
intent.setFlags(1);
intent.setDataAndType(FileProvider.getUriForFile(ChatActivity.this.getParentActivity(), "im.ovithmjoec.messenger.provider", file2), MimeTypes.VIDEO_MP4);
} else {
intent.setDataAndType(Uri.fromFile(file2), MimeTypes.VIDEO_MP4);
}
ChatActivity.this.getParentActivity().startActivityForResult(intent, 500);
} catch (Exception e2) {
FileLog.e(e2);
ChatActivity.this.alertUserOpenError(messageObject);
}
} else if (messageObject.type == 4) {
if (Build.VERSION.SDK_INT >= 23 && ChatActivity.this.getParentActivity().checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") != 0) {
ChatActivity.this.getParentActivity().requestPermissions(new String[]{"android.permission.ACCESS_COARSE_LOCATION", PermissionUtils.FINE_LOCATION}, 2);
} else if (messageObject.isLiveLocation()) {
NewLocationActivity newLocationActivity = new NewLocationActivity(3, messageObject);
newLocationActivity.setDelegate(ChatActivity.this);
ChatActivity.this.presentFragment(newLocationActivity);
} else {
ChatActivity.this.presentFragment(new NewLocationActivity(1, messageObject));
}
} else if (messageObject.type == 9 || messageObject.type == 0) {
if (messageObject.getDocumentName().toLowerCase().endsWith("attheme")) {
if (messageObject.messageOwner.attachPath != null && messageObject.messageOwner.attachPath.length() != 0) {
file = new File(messageObject.messageOwner.attachPath);
}
file = null;
if (file == null) {
File pathToMessage = FileLoader.getPathToMessage(messageObject.messageOwner);
if (pathToMessage.exists()) {
file = pathToMessage;
}
}
Theme.ThemeInfo applyThemeFile = Theme.applyThemeFile(file, messageObject.getDocumentName(), null, true);
if (applyThemeFile == null) {
ChatActivity.this.scrollToPositionOnRecreate = -1;
} else {
ChatActivity.this.presentFragment(new ThemePreviewActivity(applyThemeFile));
return;
}
}
if (messageObject.canPreviewDocument()) {
PhotoViewer.getInstance().setParentActivity(ChatActivity.this.getParentActivity());
PhotoViewer.getInstance().openPhoto(messageObject, messageObject.type != 0 ? ChatActivity.this.dialog_id : 0L, messageObject.type != 0 ? ChatActivity.this.mergeDialogId : 0L, ChatActivity.this.photoViewerProvider);
z2 = true;
}
if (z2) {
return;
}
try {
AndroidUtilities.openForView(messageObject, ChatActivity.this.getParentActivity());
} catch (Exception e3) {
FileLog.e(e3);
ChatActivity.this.alertUserOpenError(messageObject);
}
} else if (messageObject.type == 105) {
ChatActivity.this.presentFragment(new FcPageOthersActivity(((ChatFCAttentionBean) GsonUtils.fromJson(TLJsonResolve.getData(((TLRPCContacts.TL_messageMediaSysNotify) chatMessageCell.getMessageObject().messageOwner.media).data), (Class<Object>) ChatFCAttentionBean.class)).interact_msg.with_id));
}
}
}
}
@Override
public void didPressInstantButton(ChatMessageCell chatMessageCell, int i) {
MessageObject messageObject = chatMessageCell.getMessageObject();
if (i == 0) {
if (messageObject.messageOwner.media == null || messageObject.messageOwner.media.webpage == null || messageObject.messageOwner.media.webpage.cached_page == null) {
return;
}
ArticleViewer.getInstance().setParentActivity(ChatActivity.this.getParentActivity(), ChatActivity.this);
ArticleViewer.getInstance().open(messageObject);
} else if (i == 5) {
ChatActivity.this.viewContacts(messageObject.messageOwner.media.user_id);
} else if (messageObject.messageOwner.media == null || messageObject.messageOwner.media.webpage == null) {
} else {
Browser.openUrl(ChatActivity.this.getParentActivity(), messageObject.messageOwner.media.webpage.url);
}
}
@Override
public String getAdminRank(int i) {
if (ChatObject.isChannel(ChatActivity.this.currentChat) && ChatActivity.this.currentChat.megagroup) {
return ChatActivity.this.getMessagesController().getAdminRank(ChatActivity.this.currentChat.id, i);
}
return null;
}
@Override
public boolean shouldRepeatSticker(MessageObject messageObject) {
return !ChatActivity.this.alredyPlayedStickers.containsKey(messageObject);
}
@Override
public void setShouldNotRepeatSticker(MessageObject messageObject) {
ChatActivity.this.alredyPlayedStickers.put(messageObject, true);
}
}
public void lambda$onCreateViewHolder$0$ChatActivity$ChatActivityAdapter(String str) {
if (str.startsWith("@")) {
ChatActivity.this.getMessagesController().openByUserName(str.substring(1), ChatActivity.this, 0);
} else if (str.startsWith("#") || str.startsWith("$")) {
DialogsActivity dialogsActivity = new DialogsActivity(null);
dialogsActivity.setSearchString(str);
ChatActivity.this.presentFragment(dialogsActivity);
} else if (str.startsWith("/")) {
ChatActivity.this.chatActivityEnterView.setCommand(null, str, false, false);
if (ChatActivity.this.chatActivityEnterView.getFieldText() == null) {
ChatActivity.this.hideFieldPanel(false);
}
}
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
MessageObject messageObject;
String str;
String str2;
char c;
String str3;
char c2;
char c3;
char c4;
int i2;
String str4;
TextView textView;
char c5;
int i3;
String str5;
TextView textView2;
char c6;
int i4;
int i5;
boolean z;
boolean z2;
if (i == this.botInfoRow) {
((BotHelpCell) viewHolder.itemView).setText(ChatActivity.this.botInfo.size() != 0 ? ((TLRPC.BotInfo) ChatActivity.this.botInfo.get(ChatActivity.this.currentUser.id)).description : null);
return;
}
boolean z3 = true;
if (i == this.loadingDownRow || i == this.loadingUpRow) {
((ChatLoadingCell) viewHolder.itemView).setProgressVisible(ChatActivity.this.loadsCount > 1);
} else if (i < this.messagesStartRow || i >= this.messagesEndRow) {
} else {
MessageObject messageObject2 = ChatActivity.this.messages.get(i - this.messagesStartRow);
View view = viewHolder.itemView;
int itemViewType = getItemViewType(i);
if (view instanceof ChatMessageCell) {
ChatMessageCell chatMessageCell = (ChatMessageCell) view;
chatMessageCell.isChat = ChatActivity.this.currentChat != null || UserObject.isUserSelf(ChatActivity.this.currentUser);
chatMessageCell.isMegagroup = ChatObject.isChannel(ChatActivity.this.currentChat) && ChatActivity.this.currentChat.megagroup;
MessageObject.GroupedMessages validGroupedMessage = ChatActivity.this.getValidGroupedMessage(messageObject2);
if (validGroupedMessage != null) {
MessageObject.GroupedMessagePosition groupedMessagePosition = validGroupedMessage.positions.get(messageObject2);
i4 = -100;
if (groupedMessagePosition != null) {
int indexOf = (groupedMessagePosition.flags & 4) != 0 ? validGroupedMessage.posArray.indexOf(groupedMessagePosition) + i + 1 : -100;
if ((8 & groupedMessagePosition.flags) != 0) {
i5 = (i - validGroupedMessage.posArray.size()) + validGroupedMessage.posArray.indexOf(groupedMessagePosition);
i4 = indexOf;
} else {
i4 = indexOf;
}
}
i5 = -100;
} else {
i4 = i + 1;
i5 = i - 1;
}
int itemViewType2 = getItemViewType(i5);
int itemViewType3 = getItemViewType(i4);
if (messageObject2.hasReactions() || (messageObject2.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) || itemViewType2 != viewHolder.getItemViewType()) {
z = true;
} else {
MessageObject messageObject3 = ChatActivity.this.messages.get(i5 - this.messagesStartRow);
if (messageObject3.isOutOwner() == messageObject2.isOutOwner() && Math.abs(messageObject3.messageOwner.date - messageObject2.messageOwner.date) <= 300) {
if (ChatActivity.this.currentChat != null) {
int i6 = messageObject3.messageOwner.from_id;
int i7 = messageObject2.messageOwner.from_id;
} else if (UserObject.isUserSelf(ChatActivity.this.currentUser)) {
messageObject3.getFromId();
messageObject2.getFromId();
}
}
z = false;
}
if (itemViewType3 == viewHolder.getItemViewType()) {
MessageObject messageObject4 = ChatActivity.this.messages.get(i4 - this.messagesStartRow);
if (!messageObject4.hasReactions() && !(messageObject4.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) && messageObject4.isOutOwner() == messageObject2.isOutOwner() && Math.abs(messageObject4.messageOwner.date - messageObject2.messageOwner.date) <= 300) {
if (ChatActivity.this.currentChat != null) {
int i8 = messageObject4.messageOwner.from_id;
int i9 = messageObject2.messageOwner.from_id;
} else if (UserObject.isUserSelf(ChatActivity.this.currentUser)) {
messageObject4.getFromId();
messageObject2.getFromId();
}
}
z2 = false;
} else {
z2 = true;
}
if (ChatObject.isChannel(ChatActivity.this.currentChat) && ChatActivity.this.currentChat.megagroup && messageObject2.messageOwner.from_id <= 0 && messageObject2.messageOwner.fwd_from != null) {
int i10 = messageObject2.messageOwner.fwd_from.channel_post;
}
chatMessageCell.setMessageObject(messageObject2, validGroupedMessage, false, false);
chatMessageCell.setIsFirstOrLast(z2, z);
chatMessageCell.setHighlighted((ChatActivity.this.highlightMessageId == Integer.MAX_VALUE || messageObject2.getId() != ChatActivity.this.highlightMessageId) ? false : false);
if (ChatActivity.this.highlightMessageId != Integer.MAX_VALUE) {
ChatActivity.this.startMessageUnselect();
}
int indexOf2 = ChatActivity.this.animatingMessageObjects.indexOf(messageObject2);
if (indexOf2 != -1) {
ChatActivity.this.animatingMessageObjects.remove(indexOf2);
chatMessageCell.getViewTreeObserver().addOnPreDrawListener(new AnonymousClass3(chatMessageCell));
}
} else if (view instanceof ChatActionCell) {
ChatActionCell chatActionCell = (ChatActionCell) view;
chatActionCell.setMessageObject(messageObject2);
chatActionCell.setAlpha(1.0f);
} else if (view instanceof ChatUnreadCell) {
((ChatUnreadCell) view).setText(LocaleController.getString("UnreadMessages", R.string.UnreadMessages));
if (ChatActivity.this.createUnreadMessageAfterId != 0) {
ChatActivity.this.createUnreadMessageAfterId = 0;
}
} else if (itemViewType == 5) {
TextView textView3 = (TextView) view.findViewById(R.id.tvRemind);
TextView textView4 = (TextView) view.findViewById(R.id.tvTime);
ImageView imageView = (ImageView) view.findViewById(R.id.ivSmallIconBig);
TextView textView5 = (TextView) view.findViewById(R.id.tvAmount);
RelativeLayout relativeLayout = (RelativeLayout) view.findViewById(R.id.rlAmount2);
ImageView imageView2 = (ImageView) view.findViewById(R.id.ivSmallIconBig2);
TextView textView6 = (TextView) view.findViewById(R.id.tvAmount2);
Space space = (Space) view.findViewById(R.id.space);
TextView textView7 = (TextView) view.findViewById(R.id.tvRow1Name);
TextView textView8 = (TextView) view.findViewById(R.id.tvRow1Info);
TextView textView9 = (TextView) view.findViewById(R.id.tvRow2Name);
TextView textView10 = (TextView) view.findViewById(R.id.tvRow2Info);
RelativeLayout relativeLayout2 = (RelativeLayout) view.findViewById(R.id.rlRow3);
TextView textView11 = (TextView) view.findViewById(R.id.tvRow3Name);
TextView textView12 = (TextView) view.findViewById(R.id.tvRow3Info);
RelativeLayout relativeLayout3 = (RelativeLayout) view.findViewById(R.id.rlSeeDetails);
TextView textView13 = (TextView) view.findViewById(R.id.tvSeeDetails);
((RelativeLayout) view.findViewById(R.id.rlTitle)).setBackground(Theme.createRoundRectDrawable(AndroidUtilities.dp(10.0f), AndroidUtilities.dp(10.0f), 0.0f, 0.0f, Theme.getColor(Theme.key_windowBackgroundGray)));
((LinearLayout) view.findViewById(R.id.llBody)).setBackground(Theme.createRoundRectDrawable(0.0f, 0.0f, AndroidUtilities.dp(10.0f), AndroidUtilities.dp(10.0f), Theme.getColor(Theme.key_windowBackgroundWhite)));
if (messageObject2.type == 104) {
TLRPCRedpacket.CL_messagesPayBillOverMedia cL_messagesPayBillOverMedia = (TLRPCRedpacket.CL_messagesPayBillOverMedia) messageObject2.messageOwner.media;
PayBillOverBean payBillOverBean = (PayBillOverBean) GsonUtils.fromJson(TLJsonResolve.getData(cL_messagesPayBillOverMedia.data), (Class<Object>) PayBillOverBean.class);
textView4.setText(payBillOverBean.getCreate12HEndTimeFormat());
textView13.setText(LocaleController.getString("PayBillWithdrawInfo", R.string.PayBillWithdrawInfo));
if (payBillOverBean.coin_code.contains("-")) {
String[] split = payBillOverBean.coin_code.split("-");
str = split[0];
str2 = split[1];
} else {
str = payBillOverBean.coin_code;
str2 = "";
}
messageObject = messageObject2;
switch (str.hashCode()) {
case 66097:
if (str.equals("BTC")) {
c = 0;
break;
}
c = 65535;
break;
case 68985:
if (str.equals("ETH")) {
c = 1;
break;
}
c = 65535;
break;
case 75707:
if (str.equals("LTC")) {
c = 3;
break;
}
c = 65535;
break;
case 2614190:
if (str.equals("USDT")) {
c = 2;
break;
}
c = 65535;
break;
default:
c = 65535;
break;
}
if (c != 0) {
str3 = str;
if (c == 1) {
imageView.setImageResource(R.mipmap.icon_paybill_eth_big);
} else if (c == 2) {
imageView.setImageResource(R.mipmap.icon_paybill_usdt_big);
} else if (c == 3) {
imageView.setImageResource(R.mipmap.icon_paybill_ltc_big);
}
} else {
str3 = str;
imageView.setImageResource(R.mipmap.icon_paybill_big);
}
switch (str2.hashCode()) {
case 66097:
if (str2.equals("BTC")) {
c2 = 0;
break;
}
c2 = 65535;
break;
case 68985:
if (str2.equals("ETH")) {
c2 = 1;
break;
}
c2 = 65535;
break;
case 75707:
if (str2.equals("LTC")) {
c2 = 3;
break;
}
c2 = 65535;
break;
case 2614190:
if (str2.equals("USDT")) {
c2 = 2;
break;
}
c2 = 65535;
break;
default:
c2 = 65535;
break;
}
if (c2 == 0) {
imageView2.setImageResource(R.mipmap.icon_paybill_big);
} else if (c2 == 1) {
imageView2.setImageResource(R.mipmap.icon_paybill_eth_big);
} else if (c2 == 2) {
imageView2.setImageResource(R.mipmap.icon_paybill_usdt_big);
} else if (c2 == 3) {
imageView2.setImageResource(R.mipmap.icon_paybill_ltc_big);
}
switch (cL_messagesPayBillOverMedia.deal_code) {
case 1:
case 3:
case 4:
case 6:
String str6 = str3;
StringBuilder sb = new StringBuilder();
sb.append("-");
sb.append(ChatActivity.this.setMoneyFormat(TextUtils.isEmpty(payBillOverBean.deal_amount) ? "0" : payBillOverBean.deal_amount));
textView5.setText(sb.toString());
textView3.setText(LocaleController.getString("PayBillTransferOutReminder", R.string.PayBillTransferOutReminder));
textView7.setText(LocaleController.getString("PayBillTargetType", R.string.PayBillTargetType));
textView8.setText(LocaleController.getString("PayBillWithdraw", R.string.PayBillWithdraw));
textView9.setText(LocaleController.getString("PayBillCurrencyType", R.string.PayBillCurrencyType));
textView10.setText(str6);
space.setVisibility(0);
relativeLayout.setVisibility(8);
relativeLayout2.setVisibility(8);
break;
case 2:
case 7:
String str7 = str3;
StringBuilder sb2 = new StringBuilder();
sb2.append(Marker.ANY_NON_NULL_MARKER);
sb2.append(ChatActivity.this.setMoneyFormat(TextUtils.isEmpty(payBillOverBean.deal_amount) ? "0" : payBillOverBean.deal_amount));
textView5.setText(sb2.toString());
textView3.setText(LocaleController.getString("PayBillTransferInReminder", R.string.PayBillTransferInReminder));
textView7.setText(LocaleController.getString("PayBillTransferType", R.string.PayBillTransferType));
textView8.setText(LocaleController.getString("PayBillRechargeTransferIn", R.string.PayBillRechargeTransferIn));
textView9.setText(LocaleController.getString("PayBillCurrencyType", R.string.PayBillCurrencyType));
textView10.setText(str7);
space.setVisibility(0);
relativeLayout.setVisibility(8);
relativeLayout2.setVisibility(8);
break;
case 5:
String str8 = str3;
StringBuilder sb3 = new StringBuilder();
sb3.append(Marker.ANY_NON_NULL_MARKER);
sb3.append(ChatActivity.this.setMoneyFormat(TextUtils.isEmpty(payBillOverBean.deal_amount) ? "0" : payBillOverBean.deal_amount));
textView5.setText(sb3.toString());
textView3.setText(LocaleController.getString("PayBillBounceReminder", R.string.PayBillBounceReminder));
textView7.setText(LocaleController.getString("PayBillReturnMethod", R.string.PayBillReturnMethod));
textView8.setText(LocaleController.getString("PayBillReturnToAssets", R.string.PayBillReturnToAssets));
textView9.setText(LocaleController.getString("PayBillCurrencyType", R.string.PayBillCurrencyType));
textView10.setText(str8);
space.setVisibility(0);
relativeLayout.setVisibility(8);
relativeLayout2.setVisibility(8);
break;
case 8:
String str9 = str2;
String str10 = str3;
textView3.setText(LocaleController.getString("PayBillEntrustedBuyReminder", R.string.PayBillEntrustedBuyReminder));
StringBuilder sb4 = new StringBuilder();
sb4.append(Marker.ANY_NON_NULL_MARKER);
sb4.append(ChatActivity.this.setMoneyFormat(TextUtils.isEmpty(payBillOverBean.gain_amount) ? "0" : payBillOverBean.gain_amount));
textView5.setText(sb4.toString());
textView7.setText(LocaleController.getString("PayBillTransactionType", R.string.PayBillTransactionType));
if (!TextUtils.isEmpty(payBillOverBean.deal_type)) {
String str11 = payBillOverBean.deal_type;
int hashCode = str11.hashCode();
if (hashCode != 49) {
if (hashCode == 50 && str11.equals("2")) {
c3 = 1;
if (c3 != 0) {
StringBuilder sb5 = new StringBuilder();
sb5.append("-");
sb5.append(ChatActivity.this.setMoneyFormat(TextUtils.isEmpty(payBillOverBean.deal_num) ? "0" : payBillOverBean.deal_num));
textView6.setText(sb5.toString());
textView8.setText(LocaleController.getString("PayBillMarketBuy", R.string.PayBillMarketBuy));
} else if (c3 == 1) {
StringBuilder sb6 = new StringBuilder();
sb6.append("-");
sb6.append(ChatActivity.this.setMoneyFormat(TextUtils.isEmpty(payBillOverBean.deal_amount) ? "0" : payBillOverBean.deal_amount));
textView6.setText(sb6.toString());
textView8.setText(LocaleController.getString("PayBillLimitBuy", R.string.PayBillLimitBuy));
}
}
c3 = 65535;
if (c3 != 0) {
}
} else {
if (str11.equals("1")) {
c3 = 0;
if (c3 != 0) {
}
}
c3 = 65535;
if (c3 != 0) {
}
}
}
textView9.setText(LocaleController.getString("PayBillEntryCurrency", R.string.PayBillEntryCurrency));
textView10.setText(str10);
textView11.setText(LocaleController.getString("PayBillPaymentCurrency", R.string.PayBillPaymentCurrency));
textView12.setText(str9);
space.setVisibility(8);
relativeLayout.setVisibility(0);
relativeLayout2.setVisibility(0);
break;
case 9:
textView3.setText(LocaleController.getString("PayBillEntrustedToBuyOut", R.string.PayBillEntrustedToBuyOut));
StringBuilder sb7 = new StringBuilder();
sb7.append("-");
sb7.append(ChatActivity.this.setMoneyFormat(TextUtils.isEmpty(payBillOverBean.deal_num) ? "0" : payBillOverBean.deal_num));
textView5.setText(sb7.toString());
StringBuilder sb8 = new StringBuilder();
sb8.append(Marker.ANY_NON_NULL_MARKER);
sb8.append(ChatActivity.this.setMoneyFormat(TextUtils.isEmpty(payBillOverBean.gain_amount) ? "0" : payBillOverBean.gain_amount));
textView6.setText(sb8.toString());
textView7.setText(LocaleController.getString("PayBillTransactionType", R.string.PayBillTransactionType));
if (!TextUtils.isEmpty(payBillOverBean.deal_type)) {
String str12 = payBillOverBean.deal_type;
int hashCode2 = str12.hashCode();
if (hashCode2 != 49) {
if (hashCode2 == 50 && str12.equals("2")) {
c4 = 1;
if (c4 != 0) {
textView8.setText(LocaleController.getString("PayBillSellAtMarketPrice", R.string.PayBillSellAtMarketPrice));
} else if (c4 == 1) {
textView8.setText(LocaleController.getString("PayBillSellLimit", R.string.PayBillSellLimit));
}
}
c4 = 65535;
if (c4 != 0) {
}
} else {
if (str12.equals("1")) {
c4 = 0;
if (c4 != 0) {
}
}
c4 = 65535;
if (c4 != 0) {
}
}
}
textView9.setText(LocaleController.getString("PayBillEntryCurrency", R.string.PayBillEntryCurrency));
textView10.setText(str2);
textView11.setText(LocaleController.getString("PayBillPaymentCurrency", R.string.PayBillPaymentCurrency));
textView12.setText(str3);
space.setVisibility(8);
relativeLayout.setVisibility(0);
relativeLayout2.setVisibility(0);
break;
case 10:
textView3.setText(LocaleController.getString("PayBillCommissionedReturnReminder", R.string.PayBillCommissionedReturnReminder));
StringBuilder sb9 = new StringBuilder();
sb9.append(Marker.ANY_NON_NULL_MARKER);
sb9.append(ChatActivity.this.setMoneyFormat(TextUtils.isEmpty(payBillOverBean.deal_amount) ? "0" : payBillOverBean.deal_amount));
textView5.setText(sb9.toString());
textView7.setText(LocaleController.getString("PayBillReturnMethod", R.string.PayBillReturnMethod));
textView8.setText(LocaleController.getString("PayBillReturnToAssets", R.string.PayBillReturnToAssets));
textView9.setText(LocaleController.getString("PayBillReasonForReturn", R.string.PayBillReasonForReturn));
textView10.setText(LocaleController.getString("PayBillOrderCancellation", R.string.PayBillOrderCancellation));
space.setVisibility(0);
relativeLayout.setVisibility(8);
relativeLayout2.setVisibility(8);
break;
case 11:
String str13 = str3;
textView3.setText(LocaleController.getString("PayBillFiatCurrencyBuyReminder", R.string.PayBillFiatCurrencyBuyReminder));
StringBuilder sb10 = new StringBuilder();
sb10.append(Marker.ANY_NON_NULL_MARKER);
sb10.append(ChatActivity.this.setMoneyFormat(TextUtils.isEmpty(payBillOverBean.deal_num) ? "0" : payBillOverBean.deal_num));
textView5.setText(sb10.toString());
textView7.setText(LocaleController.getString("PayBillTransactionType", R.string.PayBillTransactionType));
if (!TextUtils.isEmpty(payBillOverBean.deal_type)) {
String str14 = payBillOverBean.deal_type;
int hashCode3 = str14.hashCode();
if (hashCode3 != 49) {
if (hashCode3 == 50 && str14.equals("2")) {
c5 = 1;
if (c5 != 0) {
textView8.setText(LocaleController.getString("PayBillMarketBuy", R.string.PayBillMarketBuy));
} else if (c5 == 1) {
textView8.setText(LocaleController.getString("PayBillLimitBuy", R.string.PayBillLimitBuy));
}
}
c5 = 65535;
if (c5 != 0) {
}
} else {
if (str14.equals("1")) {
c5 = 0;
if (c5 != 0) {
}
}
c5 = 65535;
if (c5 != 0) {
}
}
}
textView9.setText(LocaleController.getString("PayBillCurrencyType", R.string.PayBillCurrencyType));
textView10.setText(str13);
textView11.setText(LocaleController.getString("PayBillTransactionParty", R.string.PayBillTransactionParty));
if (TextUtils.isEmpty(payBillOverBean.deal_from)) {
str4 = LocaleController.getString("PayBillTheStrongestCurrencyMerchant", R.string.PayBillTheStrongestCurrencyMerchant);
textView = textView12;
i2 = 0;
} else {
if (payBillOverBean.deal_from.length() > 13) {
StringBuilder sb11 = new StringBuilder();
i2 = 0;
sb11.append(payBillOverBean.deal_from.substring(0, 12));
sb11.append("...");
str4 = sb11.toString();
} else {
i2 = 0;
str4 = payBillOverBean.deal_from;
}
textView = textView12;
}
textView.setText(str4);
space.setVisibility(i2);
relativeLayout.setVisibility(8);
relativeLayout2.setVisibility(i2);
break;
case 12:
textView3.setText(LocaleController.getString("PayBillFiatCurrencySellReminder", R.string.PayBillFiatCurrencySellReminder));
StringBuilder sb12 = new StringBuilder();
sb12.append("-");
sb12.append(ChatActivity.this.setMoneyFormat(TextUtils.isEmpty(payBillOverBean.deal_num) ? "0" : payBillOverBean.deal_num));
textView5.setText(sb12.toString());
textView7.setText(LocaleController.getString("PayBillTransactionType", R.string.PayBillTransactionType));
if (!TextUtils.isEmpty(payBillOverBean.deal_type)) {
String str15 = payBillOverBean.deal_type;
int hashCode4 = str15.hashCode();
if (hashCode4 != 49) {
if (hashCode4 == 50 && str15.equals("2")) {
c6 = 1;
if (c6 != 0) {
textView8.setText(LocaleController.getString("PayBillSellAtMarketPrice", R.string.PayBillSellAtMarketPrice));
} else if (c6 == 1) {
textView8.setText(LocaleController.getString("PayBillSellLimit", R.string.PayBillSellLimit));
}
}
c6 = 65535;
if (c6 != 0) {
}
} else {
if (str15.equals("1")) {
c6 = 0;
if (c6 != 0) {
}
}
c6 = 65535;
if (c6 != 0) {
}
}
}
textView9.setText(LocaleController.getString("PayBillCurrencyType", R.string.PayBillCurrencyType));
textView10.setText(str3);
textView11.setText(LocaleController.getString("PayBillTransactionParty", R.string.PayBillTransactionParty));
if (TextUtils.isEmpty(payBillOverBean.deal_from)) {
str5 = LocaleController.getString("PayBillTheStrongestCurrencyMerchant", R.string.PayBillTheStrongestCurrencyMerchant);
textView2 = textView12;
i3 = 0;
} else {
if (payBillOverBean.deal_from.length() > 13) {
StringBuilder sb13 = new StringBuilder();
i3 = 0;
sb13.append(payBillOverBean.deal_from.substring(0, 12));
sb13.append("...");
str5 = sb13.toString();
} else {
i3 = 0;
str5 = payBillOverBean.deal_from;
}
textView2 = textView12;
}
textView2.setText(str5);
space.setVisibility(i3);
relativeLayout.setVisibility(8);
relativeLayout2.setVisibility(i3);
break;
}
} else {
messageObject = messageObject2;
}
final MessageObject messageObject5 = messageObject;
relativeLayout3.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
ChatActivity.ChatActivityAdapter.this.lambda$onBindViewHolder$1$ChatActivity$ChatActivityAdapter(messageObject5, view2);
}
});
}
}
}
class AnonymousClass3 implements ViewTreeObserver.OnPreDrawListener {
final ChatMessageCell val$messageCell;
AnonymousClass3(ChatMessageCell chatMessageCell) {
this.val$messageCell = chatMessageCell;
}
@Override
public boolean onPreDraw() {
PipRoundVideoView pipRoundVideoView = PipRoundVideoView.getInstance();
if (pipRoundVideoView != null) {
pipRoundVideoView.showTemporary(true);
}
this.val$messageCell.getViewTreeObserver().removeOnPreDrawListener(this);
ImageReceiver photoImage = this.val$messageCell.getPhotoImage();
int imageWidth = photoImage.getImageWidth();
im.ovithmjoec.ui.components.Rect cameraRect = ChatActivity.this.instantCameraView.getCameraRect();
float f = imageWidth / cameraRect.width;
this.val$messageCell.setAlpha(0.0f);
this.val$messageCell.setTimeAlpha(0.0f);
this.val$messageCell.getLocationOnScreen(r5);
int[] iArr = {iArr[0] + photoImage.getImageX(), iArr[1] + photoImage.getImageY()};
final FrameLayout cameraContainer = ChatActivity.this.instantCameraView.getCameraContainer();
cameraContainer.setPivotX(0.0f);
cameraContainer.setPivotY(0.0f);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(ChatActivity.this.instantCameraView, View.ALPHA, 0.0f), ObjectAnimator.ofFloat(cameraContainer, View.SCALE_X, f), ObjectAnimator.ofFloat(cameraContainer, View.SCALE_Y, f), ObjectAnimator.ofFloat(cameraContainer, View.TRANSLATION_X, iArr[0] - cameraRect.x), ObjectAnimator.ofFloat(cameraContainer, View.TRANSLATION_Y, iArr[1] - cameraRect.y), ObjectAnimator.ofFloat(ChatActivity.this.instantCameraView.getSwitchButtonView(), View.ALPHA, 0.0f), ObjectAnimator.ofInt(ChatActivity.this.instantCameraView.getPaint(), AnimationProperties.PAINT_ALPHA, 0), ObjectAnimator.ofFloat(ChatActivity.this.instantCameraView.getMuteImageView(), View.ALPHA, 0.0f));
animatorSet.setDuration(180L);
animatorSet.setInterpolator(new DecelerateInterpolator());
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
AnonymousClass3.this.val$messageCell.setAlpha(1.0f);
AnimationProperties.FloatProperty<ChatMessageCell> floatProperty = new AnimationProperties.FloatProperty<ChatMessageCell>("alpha") {
@Override
public void setValue(ChatMessageCell chatMessageCell, float f2) {
chatMessageCell.setTimeAlpha(f2);
}
@Override
public Float get(ChatMessageCell chatMessageCell) {
return Float.valueOf(chatMessageCell.getTimeAlpha());
}
};
AnimatorSet animatorSet2 = new AnimatorSet();
animatorSet2.playTogether(ObjectAnimator.ofFloat(cameraContainer, View.ALPHA, 0.0f), ObjectAnimator.ofFloat(AnonymousClass3.this.val$messageCell, floatProperty, 1.0f));
animatorSet2.setDuration(100L);
animatorSet2.setInterpolator(new DecelerateInterpolator());
animatorSet2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator2) {
ChatActivity.this.instantCameraView.hideCamera(true);
ChatActivity.this.instantCameraView.setVisibility(4);
}
});
animatorSet2.start();
}
});
animatorSet.start();
return true;
}
}
public void lambda$onBindViewHolder$1$ChatActivity$ChatActivityAdapter(MessageObject messageObject, View view) {
ChatActivity.this.presentFragment(new BillDetailsActivity(messageObject));
}
@Override
public int getItemViewType(int i) {
if (i < this.messagesStartRow || i >= this.messagesEndRow) {
return i == this.botInfoRow ? 3 : 4;
}
return ChatActivity.this.messages.get(i - this.messagesStartRow).contentType;
}
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder viewHolder) {
boolean z;
boolean z2;
if (viewHolder.itemView instanceof ChatMessageCell) {
final ChatMessageCell chatMessageCell = (ChatMessageCell) viewHolder.itemView;
MessageObject messageObject = chatMessageCell.getMessageObject();
if (ChatActivity.this.actionBar.isActionModeShowed()) {
chatMessageCell.setCheckBoxVisible(true, false);
MessageObject editingMessageObject = ChatActivity.this.chatActivityEnterView != null ? ChatActivity.this.chatActivityEnterView.getEditingMessageObject() : null;
int i = messageObject.getDialogId() == ChatActivity.this.dialog_id ? 0 : 1;
if (editingMessageObject == messageObject || ChatActivity.this.selectedMessagesIds[i].indexOfKey(messageObject.getId()) >= 0) {
ChatActivity.this.setCellSelectionBackground(messageObject, chatMessageCell, i, false);
z = true;
} else {
chatMessageCell.setDrawSelectionBackground(false);
chatMessageCell.setChecked(false, false, false);
z = false;
}
z2 = true;
} else {
chatMessageCell.setDrawSelectionBackground(false);
chatMessageCell.setChecked(false, false, false);
chatMessageCell.setCheckBoxVisible(false, false);
z = false;
z2 = false;
}
chatMessageCell.setCheckPressed(!z2, z2 && z);
if (ChatActivity.this.searchContainer != null && ChatActivity.this.searchContainer.getVisibility() == 0) {
if (ChatActivity.this.getMediaDataController().isMessageFound(messageObject.getId(), messageObject.getDialogId() == ChatActivity.this.mergeDialogId) && ChatActivity.this.getMediaDataController().getLastSearchQuery() != null) {
chatMessageCell.setHighlightedText(ChatActivity.this.getMediaDataController().getLastSearchQuery());
chatMessageCell.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
chatMessageCell.getViewTreeObserver().removeOnPreDrawListener(this);
int measuredHeight = ChatActivity.this.chatListView.getMeasuredHeight();
int top = chatMessageCell.getTop();
chatMessageCell.getBottom();
int i2 = top >= 0 ? 0 : -top;
int measuredHeight2 = chatMessageCell.getMeasuredHeight();
if (measuredHeight2 > measuredHeight) {
measuredHeight2 = i2 + measuredHeight;
}
chatMessageCell.setVisiblePart(i2, measuredHeight2 - i2);
return true;
}
});
if (ChatActivity.this.inPreviewMode || !chatMessageCell.isHighlighted()) {
chatMessageCell.setHighlighted(ChatActivity.this.highlightMessageId == Integer.MAX_VALUE && chatMessageCell.getMessageObject().getId() == ChatActivity.this.highlightMessageId);
if (ChatActivity.this.highlightMessageId != Integer.MAX_VALUE) {
ChatActivity.this.startMessageUnselect();
}
}
}
}
chatMessageCell.setHighlightedText(null);
chatMessageCell.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
chatMessageCell.getViewTreeObserver().removeOnPreDrawListener(this);
int measuredHeight = ChatActivity.this.chatListView.getMeasuredHeight();
int top = chatMessageCell.getTop();
chatMessageCell.getBottom();
int i2 = top >= 0 ? 0 : -top;
int measuredHeight2 = chatMessageCell.getMeasuredHeight();
if (measuredHeight2 > measuredHeight) {
measuredHeight2 = i2 + measuredHeight;
}
chatMessageCell.setVisiblePart(i2, measuredHeight2 - i2);
return true;
}
});
if (ChatActivity.this.inPreviewMode) {
}
chatMessageCell.setHighlighted(ChatActivity.this.highlightMessageId == Integer.MAX_VALUE && chatMessageCell.getMessageObject().getId() == ChatActivity.this.highlightMessageId);
if (ChatActivity.this.highlightMessageId != Integer.MAX_VALUE) {
}
}
int adapterPosition = viewHolder.getAdapterPosition();
if (adapterPosition < this.messagesStartRow || adapterPosition >= this.messagesEndRow) {
return;
}
MessageObject messageObject2 = ChatActivity.this.messages.get(adapterPosition - this.messagesStartRow);
View view = viewHolder.itemView;
if (messageObject2 == null || messageObject2.messageOwner == null || !messageObject2.messageOwner.media_unread || !messageObject2.messageOwner.mentioned) {
return;
}
if (!ChatActivity.this.inPreviewMode && !ChatActivity.this.inScheduleMode && !messageObject2.isVoice() && !messageObject2.isRoundVideo()) {
ChatActivity.access$16110(ChatActivity.this);
if (ChatActivity.this.newMentionsCount <= 0) {
ChatActivity.this.newMentionsCount = 0;
ChatActivity.this.hasAllMentionsLocal = true;
ChatActivity.this.showMentionDownButton(false, true);
} else {
ChatActivity.this.mentiondownButtonCounter.setText(String.format("%d", Integer.valueOf(ChatActivity.this.newMentionsCount)));
}
ChatActivity.this.getMessagesController().markMentionMessageAsRead(messageObject2.getId(), ChatObject.isChannel(ChatActivity.this.currentChat) ? ChatActivity.this.currentChat.id : 0, ChatActivity.this.dialog_id);
messageObject2.setContentIsRead();
}
if (view instanceof ChatMessageCell) {
ChatMessageCell chatMessageCell2 = (ChatMessageCell) view;
if (ChatActivity.this.inPreviewMode) {
chatMessageCell2.setHighlighted(true);
} else {
chatMessageCell2.setHighlightedAnimated();
}
}
}
public void updateRowAtPosition(int i) {
int indexOf;
if (ChatActivity.this.chatLayoutManager == null) {
return;
}
int i2 = (ChatActivity.this.wasManualScroll || ChatActivity.this.unreadMessageObject == null || (indexOf = ChatActivity.this.messages.indexOf(ChatActivity.this.unreadMessageObject)) < 0) ? -1 : this.messagesStartRow + indexOf;
notifyItemChanged(i);
if (i2 != -1) {
ChatActivity.this.chatLayoutManager.scrollToPositionWithOffset(i2, ((ChatActivity.this.chatListView.getMeasuredHeight() - ChatActivity.this.chatListView.getPaddingBottom()) - ChatActivity.this.chatListView.getPaddingTop()) - AndroidUtilities.dp(29.0f));
}
}
public void updateRowWithMessageObject(MessageObject messageObject, boolean z) {
if (z) {
int childCount = ChatActivity.this.chatListView.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = ChatActivity.this.chatListView.getChildAt(i);
if (childAt instanceof ChatMessageCell) {
ChatMessageCell chatMessageCell = (ChatMessageCell) childAt;
if (chatMessageCell.getMessageObject() == messageObject) {
chatMessageCell.setMessageObject(messageObject, chatMessageCell.getCurrentMessagesGroup(), chatMessageCell.isPinnedBottom(), chatMessageCell.isPinnedTop());
return;
}
}
}
}
int indexOf = ChatActivity.this.messages.indexOf(messageObject);
if (indexOf == -1) {
return;
}
updateRowAtPosition(indexOf + this.messagesStartRow);
}
@Override
public void notifyDataSetChanged() {
updateRows();
try {
super.notifyDataSetChanged();
} catch (Exception e) {
FileLog.e(e);
}
}
@Override
public void notifyItemChanged(int i) {
updateRows();
try {
super.notifyItemChanged(i);
} catch (Exception e) {
FileLog.e(e);
}
}
@Override
public void notifyItemRangeChanged(int i, int i2) {
updateRows();
try {
super.notifyItemRangeChanged(i, i2);
} catch (Exception e) {
FileLog.e(e);
}
}
@Override
public void notifyItemInserted(int i) {
updateRows();
try {
super.notifyItemInserted(i);
} catch (Exception e) {
FileLog.e(e);
}
}
@Override
public void notifyItemMoved(int i, int i2) {
updateRows();
try {
super.notifyItemMoved(i, i2);
} catch (Exception e) {
FileLog.e(e);
}
}
@Override
public void notifyItemRangeInserted(int i, int i2) {
updateRows();
try {
super.notifyItemRangeInserted(i, i2);
} catch (Exception e) {
FileLog.e(e);
}
}
@Override
public void notifyItemRemoved(int i) {
updateRows();
try {
super.notifyItemRemoved(i);
} catch (Exception e) {
FileLog.e(e);
}
}
@Override
public void notifyItemRangeRemoved(int i, int i2) {
updateRows();
try {
super.notifyItemRangeRemoved(i, i2);
} catch (Exception e) {
FileLog.e(e);
}
}
}
@Override
public ThemeDescription[] getThemeDescriptions() {
ThemeDescription.ThemeDescriptionDelegate themeDescriptionDelegate = new ThemeDescription.ThemeDescriptionDelegate() {
@Override
public final void didSetColor() {
ChatActivity.this.lambda$getThemeDescriptions$163$ChatActivity();
}
};
ThemeDescription[] themeDescriptionArr = new ThemeDescription[392];
themeDescriptionArr[0] = new ThemeDescription(this.fragmentView, 0, null, null, null, null, Theme.key_chat_wallpaper);
themeDescriptionArr[1] = new ThemeDescription(this.fragmentView, 0, null, null, null, null, Theme.key_chat_wallpaper_gradient_to);
themeDescriptionArr[2] = new ThemeDescription(this.actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault);
themeDescriptionArr[3] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault);
themeDescriptionArr[4] = new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon);
themeDescriptionArr[5] = new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector);
themeDescriptionArr[6] = new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SUBMENUBACKGROUND, null, null, null, null, Theme.key_actionBarDefaultSubmenuBackground);
themeDescriptionArr[7] = new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM, null, null, null, null, Theme.key_actionBarDefaultSubmenuItem);
themeDescriptionArr[8] = new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM | ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_actionBarDefaultSubmenuItemIcon);
themeDescriptionArr[9] = new ThemeDescription(this.actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault);
themeDescriptionArr[10] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault);
themeDescriptionArr[11] = new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon);
themeDescriptionArr[12] = new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector);
themeDescriptionArr[13] = new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SEARCH, null, null, null, null, Theme.key_actionBarDefaultSearch);
themeDescriptionArr[14] = new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_SEARCHPLACEHOLDER, null, null, null, null, Theme.key_actionBarDefaultSearchPlaceholder);
themeDescriptionArr[15] = new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_AM_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarActionModeDefaultIcon);
themeDescriptionArr[16] = new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_AM_BACKGROUND, null, null, null, null, Theme.key_actionBarActionModeDefault);
themeDescriptionArr[17] = new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_AM_TOPBACKGROUND, null, null, null, null, Theme.key_actionBarActionModeDefaultTop);
themeDescriptionArr[18] = new ThemeDescription(this.actionBar, ThemeDescription.FLAG_AB_AM_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarActionModeDefaultSelector);
themeDescriptionArr[19] = new ThemeDescription(this.selectedMessagesCountTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_actionBarActionModeDefaultIcon);
themeDescriptionArr[20] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.avatar_savedDrawable}, null, Theme.key_avatar_text);
themeDescriptionArr[21] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_backgroundRed);
themeDescriptionArr[22] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_backgroundOrange);
themeDescriptionArr[23] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_backgroundViolet);
themeDescriptionArr[24] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_backgroundGreen);
themeDescriptionArr[25] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_backgroundCyan);
themeDescriptionArr[26] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_backgroundBlue);
themeDescriptionArr[27] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_backgroundPink);
themeDescriptionArr[28] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_nameInMessageRed);
themeDescriptionArr[29] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_nameInMessageOrange);
themeDescriptionArr[30] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_nameInMessageViolet);
themeDescriptionArr[31] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_nameInMessageGreen);
themeDescriptionArr[32] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_nameInMessageCyan);
themeDescriptionArr[33] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_nameInMessageBlue);
themeDescriptionArr[34] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_avatar_nameInMessagePink);
themeDescriptionArr[35] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class, BotHelpCell.class}, null, new Drawable[]{Theme.chat_msgInDrawable, Theme.chat_msgInMediaDrawable}, null, Theme.key_chat_inBubble);
themeDescriptionArr[36] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInSelectedDrawable, Theme.chat_msgInMediaSelectedDrawable}, null, Theme.key_chat_inBubbleSelected);
themeDescriptionArr[37] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class, BotHelpCell.class}, null, new Drawable[]{Theme.chat_msgInShadowDrawable, Theme.chat_msgInMediaShadowDrawable}, null, Theme.key_chat_inBubbleShadow);
themeDescriptionArr[38] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutDrawable, Theme.chat_msgOutMediaDrawable}, null, Theme.key_chat_outBubble);
themeDescriptionArr[39] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutSelectedDrawable, Theme.chat_msgOutMediaSelectedDrawable}, null, Theme.key_chat_outBubbleSelected);
themeDescriptionArr[40] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutShadowDrawable, Theme.chat_msgOutMediaShadowDrawable}, null, Theme.key_chat_outBubbleShadow);
themeDescriptionArr[41] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{ChatActionCell.class}, Theme.chat_actionTextPaint, null, null, Theme.key_chat_serviceText);
themeDescriptionArr[42] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_LINKCOLOR, new Class[]{ChatActionCell.class}, Theme.chat_actionTextPaint, null, null, Theme.key_chat_serviceLink);
themeDescriptionArr[43] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_shareIconDrawable, Theme.chat_replyIconDrawable, Theme.chat_botInlineDrawable, Theme.chat_botLinkDrawalbe, Theme.chat_goIconDrawable}, null, Theme.key_chat_serviceIcon);
themeDescriptionArr[44] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class, ChatActionCell.class}, null, null, null, Theme.key_chat_serviceBackground);
themeDescriptionArr[45] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class, ChatActionCell.class}, null, null, null, Theme.key_chat_serviceBackgroundSelected);
themeDescriptionArr[46] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class, BotHelpCell.class}, null, null, null, Theme.key_chat_messageTextIn);
themeDescriptionArr[47] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_messageTextOut);
themeDescriptionArr[48] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_LINKCOLOR, new Class[]{ChatMessageCell.class, BotHelpCell.class}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messageLinkIn, (Object) null);
themeDescriptionArr[49] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_LINKCOLOR, new Class[]{ChatMessageCell.class}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messageLinkOut, (Object) null);
themeDescriptionArr[50] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgNoSoundDrawable}, null, Theme.key_chat_mediaTimeText);
themeDescriptionArr[51] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutCheckDrawable}, null, Theme.key_chat_outSentCheck);
themeDescriptionArr[52] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutCheckSelectedDrawable}, null, Theme.key_chat_outSentCheckSelected);
themeDescriptionArr[53] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutCheckReadDrawable, Theme.chat_msgOutHalfCheckDrawable}, null, Theme.key_chat_outSentCheckRead);
themeDescriptionArr[54] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutCheckReadSelectedDrawable, Theme.chat_msgOutHalfCheckSelectedDrawable}, null, Theme.key_chat_outSentCheckReadSelected);
themeDescriptionArr[55] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutClockDrawable}, null, Theme.key_chat_outSentClock);
themeDescriptionArr[56] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutSelectedClockDrawable}, null, Theme.key_chat_outSentClockSelected);
themeDescriptionArr[57] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInClockDrawable}, null, Theme.key_chat_inSentClock);
themeDescriptionArr[58] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInSelectedClockDrawable}, null, Theme.key_chat_inSentClockSelected);
themeDescriptionArr[59] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgMediaCheckDrawable, Theme.chat_msgMediaHalfCheckDrawable}, null, Theme.key_chat_mediaSentCheck);
themeDescriptionArr[60] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgStickerHalfCheckDrawable, Theme.chat_msgStickerCheckDrawable, Theme.chat_msgStickerClockDrawable, Theme.chat_msgStickerViewsDrawable}, null, Theme.key_chat_serviceText);
themeDescriptionArr[61] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgMediaClockDrawable}, null, Theme.key_chat_mediaSentClock);
themeDescriptionArr[62] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutViewsDrawable}, null, Theme.key_chat_outViews);
themeDescriptionArr[63] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutViewsSelectedDrawable}, null, Theme.key_chat_outViewsSelected);
themeDescriptionArr[64] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInViewsDrawable}, null, Theme.key_chat_inViews);
themeDescriptionArr[65] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInViewsSelectedDrawable}, null, Theme.key_chat_inViewsSelected);
themeDescriptionArr[66] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgMediaViewsDrawable}, null, Theme.key_chat_mediaViews);
themeDescriptionArr[67] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutMenuDrawable}, null, Theme.key_chat_outMenu);
themeDescriptionArr[68] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutMenuSelectedDrawable}, null, Theme.key_chat_outMenuSelected);
themeDescriptionArr[69] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInMenuDrawable}, null, Theme.key_chat_inMenu);
themeDescriptionArr[70] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInMenuSelectedDrawable}, null, Theme.key_chat_inMenuSelected);
themeDescriptionArr[71] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgMediaMenuDrawable}, null, Theme.key_chat_mediaMenu);
themeDescriptionArr[72] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutInstantDrawable, Theme.chat_msgOutCallDrawable}, null, Theme.key_chat_outInstant);
themeDescriptionArr[73] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgOutCallSelectedDrawable}, null, Theme.key_chat_outInstantSelected);
themeDescriptionArr[74] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInInstantDrawable, Theme.chat_msgInCallDrawable}, null, Theme.key_chat_inInstant);
themeDescriptionArr[75] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgInCallSelectedDrawable}, null, Theme.key_chat_inInstantSelected);
themeDescriptionArr[76] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgCallUpGreenDrawable}, null, Theme.key_chat_outGreenCall);
themeDescriptionArr[77] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgCallDownRedDrawable}, null, Theme.key_chat_inRedCall);
themeDescriptionArr[78] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgCallDownGreenDrawable}, null, Theme.key_chat_inGreenCall);
themeDescriptionArr[79] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_msgErrorPaint, null, null, Theme.key_chat_sentError);
themeDescriptionArr[80] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_msgErrorDrawable}, null, Theme.key_chat_sentErrorIcon);
themeDescriptionArr[81] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, themeDescriptionDelegate, Theme.key_chat_selectedBackground);
themeDescriptionArr[82] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_durationPaint, null, null, Theme.key_chat_previewDurationText);
themeDescriptionArr[83] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_gamePaint, null, null, Theme.key_chat_previewGameText);
themeDescriptionArr[84] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inPreviewInstantText);
themeDescriptionArr[85] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPreviewInstantText);
themeDescriptionArr[86] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inPreviewInstantSelectedText);
themeDescriptionArr[87] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPreviewInstantSelectedText);
themeDescriptionArr[88] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_deleteProgressPaint, null, null, Theme.key_chat_secretTimeText);
themeDescriptionArr[89] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_stickerNameText);
themeDescriptionArr[90] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_botButtonPaint, null, null, Theme.key_chat_botButtonText);
themeDescriptionArr[91] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_botProgressPaint, null, null, Theme.key_chat_botProgress);
themeDescriptionArr[92] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_timeBackgroundPaint, null, null, Theme.key_chat_mediaTimeBackground);
themeDescriptionArr[93] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inForwardedNameText);
themeDescriptionArr[94] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outForwardedNameText);
themeDescriptionArr[95] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inViaBotNameText);
themeDescriptionArr[96] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outViaBotNameText);
themeDescriptionArr[97] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_stickerViaBotNameText);
themeDescriptionArr[98] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inReplyLine);
themeDescriptionArr[99] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outReplyLine);
themeDescriptionArr[100] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_stickerReplyLine);
themeDescriptionArr[101] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inReplyNameText);
themeDescriptionArr[102] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outReplyNameText);
themeDescriptionArr[103] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_stickerReplyNameText);
themeDescriptionArr[104] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inReplyMessageText);
themeDescriptionArr[105] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outReplyMessageText);
themeDescriptionArr[106] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inReplyMediaMessageText);
themeDescriptionArr[107] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outReplyMediaMessageText);
themeDescriptionArr[108] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inReplyMediaMessageSelectedText);
themeDescriptionArr[109] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outReplyMediaMessageSelectedText);
themeDescriptionArr[110] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_stickerReplyMessageText);
themeDescriptionArr[111] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inPreviewLine);
themeDescriptionArr[112] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPreviewLine);
themeDescriptionArr[113] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inSiteNameText);
themeDescriptionArr[114] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outSiteNameText);
themeDescriptionArr[115] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inContactNameText);
themeDescriptionArr[116] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outContactNameText);
themeDescriptionArr[117] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inContactPhoneText);
themeDescriptionArr[118] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inContactPhoneSelectedText);
themeDescriptionArr[119] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outContactPhoneText);
themeDescriptionArr[120] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outContactPhoneSelectedText);
themeDescriptionArr[121] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_mediaProgress);
themeDescriptionArr[122] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioProgress);
themeDescriptionArr[123] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioProgress);
themeDescriptionArr[124] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioSelectedProgress);
themeDescriptionArr[125] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioSelectedProgress);
themeDescriptionArr[126] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_mediaTimeText);
themeDescriptionArr[127] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inTimeText);
themeDescriptionArr[128] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outTimeText);
themeDescriptionArr[129] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inTimeSelectedText);
themeDescriptionArr[130] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_adminText);
themeDescriptionArr[131] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_adminSelectedText);
themeDescriptionArr[132] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outTimeSelectedText);
themeDescriptionArr[133] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioPerformerText);
themeDescriptionArr[134] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioPerformerSelectedText);
themeDescriptionArr[135] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioPerformerText);
themeDescriptionArr[136] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioPerformerSelectedText);
themeDescriptionArr[137] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioTitleText);
themeDescriptionArr[138] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioTitleText);
themeDescriptionArr[139] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioDurationText);
themeDescriptionArr[140] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioDurationText);
themeDescriptionArr[141] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioDurationSelectedText);
themeDescriptionArr[142] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioDurationSelectedText);
themeDescriptionArr[143] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioSeekbar);
themeDescriptionArr[144] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioSeekbar);
themeDescriptionArr[145] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioSeekbarSelected);
themeDescriptionArr[146] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioSeekbarSelected);
themeDescriptionArr[147] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioSeekbarFill);
themeDescriptionArr[148] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inAudioCacheSeekbar);
themeDescriptionArr[149] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioSeekbarFill);
themeDescriptionArr[150] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outAudioCacheSeekbar);
themeDescriptionArr[151] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inVoiceSeekbar);
themeDescriptionArr[152] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outVoiceSeekbar);
themeDescriptionArr[153] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inVoiceSeekbarSelected);
themeDescriptionArr[154] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outVoiceSeekbarSelected);
themeDescriptionArr[155] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inVoiceSeekbarFill);
themeDescriptionArr[156] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outVoiceSeekbarFill);
themeDescriptionArr[157] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inFileProgress);
themeDescriptionArr[158] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outFileProgress);
themeDescriptionArr[159] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inFileProgressSelected);
themeDescriptionArr[160] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outFileProgressSelected);
themeDescriptionArr[161] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inFileNameText);
themeDescriptionArr[162] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outFileNameText);
themeDescriptionArr[163] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inFileInfoText);
themeDescriptionArr[164] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outFileInfoText);
themeDescriptionArr[165] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inFileInfoSelectedText);
themeDescriptionArr[166] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outFileInfoSelectedText);
themeDescriptionArr[167] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inFileBackground);
themeDescriptionArr[168] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outFileBackground);
themeDescriptionArr[169] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inFileBackgroundSelected);
themeDescriptionArr[170] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outFileBackgroundSelected);
themeDescriptionArr[171] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inVenueInfoText);
themeDescriptionArr[172] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outVenueInfoText);
themeDescriptionArr[173] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inVenueInfoSelectedText);
themeDescriptionArr[174] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outVenueInfoSelectedText);
themeDescriptionArr[175] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_mediaInfoText);
themeDescriptionArr[176] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_urlPaint, null, null, Theme.key_chat_linkSelectBackground);
themeDescriptionArr[177] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_textSearchSelectionPaint, null, null, Theme.key_chat_textSelectBackground);
themeDescriptionArr[178] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outLoader);
themeDescriptionArr[179] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outMediaIcon);
themeDescriptionArr[180] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outLoaderSelected);
themeDescriptionArr[181] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outMediaIconSelected);
themeDescriptionArr[182] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inLoader);
themeDescriptionArr[183] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inMediaIcon);
themeDescriptionArr[184] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inLoaderSelected);
themeDescriptionArr[185] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inMediaIconSelected);
themeDescriptionArr[186] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[0][0], Theme.chat_photoStatesDrawables[1][0], Theme.chat_photoStatesDrawables[2][0], Theme.chat_photoStatesDrawables[3][0]}, null, Theme.key_chat_mediaLoaderPhoto);
themeDescriptionArr[187] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[0][0], Theme.chat_photoStatesDrawables[1][0], Theme.chat_photoStatesDrawables[2][0], Theme.chat_photoStatesDrawables[3][0]}, null, Theme.key_chat_mediaLoaderPhotoIcon);
themeDescriptionArr[188] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[0][1], Theme.chat_photoStatesDrawables[1][1], Theme.chat_photoStatesDrawables[2][1], Theme.chat_photoStatesDrawables[3][1]}, null, Theme.key_chat_mediaLoaderPhotoSelected);
themeDescriptionArr[189] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[0][1], Theme.chat_photoStatesDrawables[1][1], Theme.chat_photoStatesDrawables[2][1], Theme.chat_photoStatesDrawables[3][1]}, null, Theme.key_chat_mediaLoaderPhotoIconSelected);
themeDescriptionArr[190] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[7][0], Theme.chat_photoStatesDrawables[8][0]}, null, Theme.key_chat_outLoaderPhoto);
themeDescriptionArr[191] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[7][0], Theme.chat_photoStatesDrawables[8][0]}, null, Theme.key_chat_outLoaderPhotoIcon);
themeDescriptionArr[192] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[7][1], Theme.chat_photoStatesDrawables[8][1]}, null, Theme.key_chat_outLoaderPhotoSelected);
themeDescriptionArr[193] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[7][1], Theme.chat_photoStatesDrawables[8][1]}, null, Theme.key_chat_outLoaderPhotoIconSelected);
themeDescriptionArr[194] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[10][0], Theme.chat_photoStatesDrawables[11][0]}, null, Theme.key_chat_inLoaderPhoto);
themeDescriptionArr[195] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[10][0], Theme.chat_photoStatesDrawables[11][0]}, null, Theme.key_chat_inLoaderPhotoIcon);
themeDescriptionArr[196] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[10][1], Theme.chat_photoStatesDrawables[11][1]}, null, Theme.key_chat_inLoaderPhotoSelected);
themeDescriptionArr[197] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[10][1], Theme.chat_photoStatesDrawables[11][1]}, null, Theme.key_chat_inLoaderPhotoIconSelected);
themeDescriptionArr[198] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[9][0]}, null, Theme.key_chat_outFileIcon);
themeDescriptionArr[199] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[9][1]}, null, Theme.key_chat_outFileSelectedIcon);
themeDescriptionArr[200] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[12][0]}, null, Theme.key_chat_inFileIcon);
themeDescriptionArr[201] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[12][1]}, null, Theme.key_chat_inFileSelectedIcon);
themeDescriptionArr[202] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_contactDrawable[0]}, null, Theme.key_chat_inContactBackground);
themeDescriptionArr[203] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_contactDrawable[0]}, null, Theme.key_chat_inContactIcon);
themeDescriptionArr[204] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_contactDrawable[1]}, null, Theme.key_chat_outContactBackground);
themeDescriptionArr[205] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_contactDrawable[1]}, null, Theme.key_chat_outContactIcon);
themeDescriptionArr[206] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_locationDrawable[0]}, null, Theme.key_chat_inLocationBackground);
themeDescriptionArr[207] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_locationDrawable[0]}, null, Theme.key_chat_inLocationIcon);
themeDescriptionArr[208] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_locationDrawable[1]}, null, Theme.key_chat_outLocationBackground);
themeDescriptionArr[209] = new ThemeDescription(this.chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_locationDrawable[1]}, null, Theme.key_chat_outLocationIcon);
themeDescriptionArr[210] = new ThemeDescription(this.mentionContainer, 0, null, Theme.chat_composeBackgroundPaint, null, null, Theme.key_chat_messagePanelBackground);
themeDescriptionArr[211] = new ThemeDescription(this.mentionContainer, 0, null, null, new Drawable[]{Theme.chat_composeShadowDrawable}, null, Theme.key_chat_messagePanelShadow);
themeDescriptionArr[212] = new ThemeDescription(this.searchContainer, 0, null, Theme.chat_composeBackgroundPaint, null, null, Theme.key_chat_messagePanelBackground);
themeDescriptionArr[213] = new ThemeDescription(this.searchContainer, 0, null, null, new Drawable[]{Theme.chat_composeShadowDrawable}, null, Theme.key_chat_messagePanelShadow);
themeDescriptionArr[214] = new ThemeDescription(this.bottomOverlay, 0, null, Theme.chat_composeBackgroundPaint, null, null, Theme.key_chat_messagePanelBackground);
themeDescriptionArr[215] = new ThemeDescription(this.bottomOverlay, 0, null, null, new Drawable[]{Theme.chat_composeShadowDrawable}, null, Theme.key_chat_messagePanelShadow);
themeDescriptionArr[216] = new ThemeDescription(this.bottomOverlayChat, 0, null, Theme.chat_composeBackgroundPaint, null, null, Theme.key_chat_messagePanelBackground);
themeDescriptionArr[217] = new ThemeDescription(this.bottomOverlayChat, 0, null, null, new Drawable[]{Theme.chat_composeShadowDrawable}, null, Theme.key_chat_messagePanelShadow);
themeDescriptionArr[218] = new ThemeDescription(this.bottomMessagesActionContainer, 0, null, Theme.chat_composeBackgroundPaint, null, null, Theme.key_chat_messagePanelBackground);
themeDescriptionArr[219] = new ThemeDescription(this.bottomMessagesActionContainer, 0, null, null, new Drawable[]{Theme.chat_composeShadowDrawable}, null, Theme.key_chat_messagePanelShadow);
themeDescriptionArr[220] = new ThemeDescription(this.chatActivityEnterView, 0, null, Theme.chat_composeBackgroundPaint, null, null, Theme.key_chat_messagePanelBackground);
themeDescriptionArr[221] = new ThemeDescription(this.chatActivityEnterView, 0, null, null, new Drawable[]{Theme.chat_composeShadowDrawable}, null, Theme.key_chat_messagePanelShadow);
themeDescriptionArr[222] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_BACKGROUND, new Class[]{ChatActivityEnterView.class}, new String[]{"audioVideoButtonContainer"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelBackground);
themeDescriptionArr[223] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"messageEditText"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelText);
themeDescriptionArr[224] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_CURSORCOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"messageEditText"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelCursor);
themeDescriptionArr[225] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"recordSendText"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_fieldOverlayText);
themeDescriptionArr[226] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_HINTTEXTCOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"messageEditText"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelHint);
themeDescriptionArr[227] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"sendButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelSend);
themeDescriptionArr[228] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"sendButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelSendPressed);
themeDescriptionArr[229] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatActivityEnterView.class}, new String[]{"sendButton"}, null, null, 24, null, Theme.key_chat_messagePanelSend);
themeDescriptionArr[230] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"emojiButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelIcons);
themeDescriptionArr[231] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"botButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelIcons);
themeDescriptionArr[232] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"notifyButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelIcons);
themeDescriptionArr[233] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_IMAGECOLOR | ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatActivityEnterView.class}, new String[]{"scheduledButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelIcons);
themeDescriptionArr[234] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"scheduledButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_recordedVoiceDot);
themeDescriptionArr[235] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"attachButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelIcons);
themeDescriptionArr[236] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"audioSendButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelIcons);
themeDescriptionArr[237] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"videoSendButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelIcons);
themeDescriptionArr[238] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"notifyButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelVideoFrame);
themeDescriptionArr[239] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"videoTimelineView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelSend);
themeDescriptionArr[240] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"doneButtonImage"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelBackground);
themeDescriptionArr[241] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_BACKGROUND, new Class[]{ChatActivityEnterView.class}, new String[]{"recordedAudioPanel"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelBackground);
themeDescriptionArr[242] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"micDrawable"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelVoicePressed);
themeDescriptionArr[243] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"cameraDrawable"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelVoicePressed);
themeDescriptionArr[244] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"sendDrawable"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelVoicePressed);
themeDescriptionArr[245] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"lockDrawable"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelVoiceLock);
themeDescriptionArr[246] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"lockTopDrawable"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelVoiceLock);
themeDescriptionArr[247] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"lockArrowDrawable"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelVoiceLock);
themeDescriptionArr[248] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"lockBackgroundDrawable"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelVoiceLockBackground);
themeDescriptionArr[249] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"lockShadowDrawable"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelVoiceLockShadow);
themeDescriptionArr[250] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"recordDeleteImageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelVoiceDelete);
themeDescriptionArr[251] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatActivityEnterView.class}, new String[]{"recordedAudioBackground"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_recordedVoiceBackground);
themeDescriptionArr[252] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"recordTimeText"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_recordTime);
themeDescriptionArr[253] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_BACKGROUND, new Class[]{ChatActivityEnterView.class}, new String[]{"recordTimeContainer"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelBackground);
themeDescriptionArr[254] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"recordCancelText"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_recordVoiceCancel);
themeDescriptionArr[255] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_BACKGROUND, new Class[]{ChatActivityEnterView.class}, new String[]{"recordPanel"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelBackground);
themeDescriptionArr[256] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"recordedAudioTimeTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelVoiceDuration);
themeDescriptionArr[257] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"recordCancelImage"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_recordVoiceCancel);
themeDescriptionArr[258] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"doneButtonProgress"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_contextProgressInner1);
themeDescriptionArr[259] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"doneButtonProgress"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_contextProgressOuter1);
themeDescriptionArr[260] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"cancelBotButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelCancelInlineBot);
themeDescriptionArr[261] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"redDotPaint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_recordedVoiceDot);
themeDescriptionArr[262] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"paint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelVoiceBackground);
themeDescriptionArr[263] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"paintRecord"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_messagePanelVoiceShadow);
themeDescriptionArr[264] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"seekBarWaveform"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_recordedVoiceProgress);
themeDescriptionArr[265] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"seekBarWaveform"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_recordedVoiceProgressInner);
themeDescriptionArr[266] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"playDrawable"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_recordedVoicePlayPause);
themeDescriptionArr[267] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"pauseDrawable"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_recordedVoicePlayPause);
themeDescriptionArr[268] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, new Class[]{ChatActivityEnterView.class}, new String[]{"playDrawable"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_recordedVoicePlayPausePressed);
themeDescriptionArr[269] = new ThemeDescription(this.chatActivityEnterView, ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, new Class[]{ChatActivityEnterView.class}, new String[]{"pauseDrawable"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_recordedVoicePlayPausePressed);
themeDescriptionArr[270] = new ThemeDescription(this.chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"dotPaint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_emojiPanelNewTrending);
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
EmojiView emojiView = chatActivityEnterView;
if (chatActivityEnterView != null) {
emojiView = chatActivityEnterView.getEmojiView();
}
themeDescriptionArr[271] = new ThemeDescription(emojiView, 0, new Class[]{EmojiView.class}, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_chat_emojiPanelBackground);
ChatActivityEnterView chatActivityEnterView2 = this.chatActivityEnterView;
EmojiView emojiView2 = chatActivityEnterView2;
if (chatActivityEnterView2 != null) {
emojiView2 = chatActivityEnterView2.getEmojiView();
}
themeDescriptionArr[272] = new ThemeDescription(emojiView2, 0, new Class[]{EmojiView.class}, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_chat_emojiPanelShadowLine);
ChatActivityEnterView chatActivityEnterView3 = this.chatActivityEnterView;
EmojiView emojiView3 = chatActivityEnterView3;
if (chatActivityEnterView3 != null) {
emojiView3 = chatActivityEnterView3.getEmojiView();
}
themeDescriptionArr[273] = new ThemeDescription(emojiView3, 0, new Class[]{EmojiView.class}, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_chat_emojiPanelEmptyText);
ChatActivityEnterView chatActivityEnterView4 = this.chatActivityEnterView;
EmojiView emojiView4 = chatActivityEnterView4;
if (chatActivityEnterView4 != null) {
emojiView4 = chatActivityEnterView4.getEmojiView();
}
themeDescriptionArr[274] = new ThemeDescription(emojiView4, 0, new Class[]{EmojiView.class}, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_chat_emojiPanelIcon);
ChatActivityEnterView chatActivityEnterView5 = this.chatActivityEnterView;
EmojiView emojiView5 = chatActivityEnterView5;
if (chatActivityEnterView5 != null) {
emojiView5 = chatActivityEnterView5.getEmojiView();
}
themeDescriptionArr[275] = new ThemeDescription(emojiView5, 0, new Class[]{EmojiView.class}, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_chat_emojiPanelIconSelected);
ChatActivityEnterView chatActivityEnterView6 = this.chatActivityEnterView;
EmojiView emojiView6 = chatActivityEnterView6;
if (chatActivityEnterView6 != null) {
emojiView6 = chatActivityEnterView6.getEmojiView();
}
themeDescriptionArr[276] = new ThemeDescription(emojiView6, 0, new Class[]{EmojiView.class}, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_chat_emojiPanelStickerPackSelector);
ChatActivityEnterView chatActivityEnterView7 = this.chatActivityEnterView;
EmojiView emojiView7 = chatActivityEnterView7;
if (chatActivityEnterView7 != null) {
emojiView7 = chatActivityEnterView7.getEmojiView();
}
themeDescriptionArr[277] = new ThemeDescription(emojiView7, 0, new Class[]{EmojiView.class}, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_chat_emojiPanelBackspace);
ChatActivityEnterView chatActivityEnterView8 = this.chatActivityEnterView;
EmojiView emojiView8 = chatActivityEnterView8;
if (chatActivityEnterView8 != null) {
emojiView8 = chatActivityEnterView8.getEmojiView();
}
themeDescriptionArr[278] = new ThemeDescription(emojiView8, 0, new Class[]{EmojiView.class}, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_chat_emojiPanelTrendingTitle);
ChatActivityEnterView chatActivityEnterView9 = this.chatActivityEnterView;
EmojiView emojiView9 = chatActivityEnterView9;
if (chatActivityEnterView9 != null) {
emojiView9 = chatActivityEnterView9.getEmojiView();
}
themeDescriptionArr[279] = new ThemeDescription(emojiView9, 0, new Class[]{EmojiView.class}, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_chat_emojiPanelTrendingDescription);
ChatActivityEnterView chatActivityEnterView10 = this.chatActivityEnterView;
EmojiView emojiView10 = chatActivityEnterView10;
if (chatActivityEnterView10 != null) {
emojiView10 = chatActivityEnterView10.getEmojiView();
}
themeDescriptionArr[280] = new ThemeDescription(emojiView10, 0, new Class[]{EmojiView.class}, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_chat_emojiPanelBadgeText);
ChatActivityEnterView chatActivityEnterView11 = this.chatActivityEnterView;
EmojiView emojiView11 = chatActivityEnterView11;
if (chatActivityEnterView11 != null) {
emojiView11 = chatActivityEnterView11.getEmojiView();
}
themeDescriptionArr[281] = new ThemeDescription(emojiView11, 0, new Class[]{EmojiView.class}, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_chat_emojiPanelBadgeBackground);
ChatActivityEnterView chatActivityEnterView12 = this.chatActivityEnterView;
EmojiView emojiView12 = chatActivityEnterView12;
if (chatActivityEnterView12 != null) {
emojiView12 = chatActivityEnterView12.getEmojiView();
}
themeDescriptionArr[282] = new ThemeDescription(emojiView12, 0, new Class[]{EmojiView.class}, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_chat_emojiBottomPanelIcon);
ChatActivityEnterView chatActivityEnterView13 = this.chatActivityEnterView;
EmojiView emojiView13 = chatActivityEnterView13;
if (chatActivityEnterView13 != null) {
emojiView13 = chatActivityEnterView13.getEmojiView();
}
themeDescriptionArr[283] = new ThemeDescription(emojiView13, 0, new Class[]{EmojiView.class}, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_chat_emojiSearchIcon);
ChatActivityEnterView chatActivityEnterView14 = this.chatActivityEnterView;
EmojiView emojiView14 = chatActivityEnterView14;
if (chatActivityEnterView14 != null) {
emojiView14 = chatActivityEnterView14.getEmojiView();
}
themeDescriptionArr[284] = new ThemeDescription(emojiView14, 0, new Class[]{EmojiView.class}, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_chat_emojiPanelStickerSetNameHighlight);
ChatActivityEnterView chatActivityEnterView15 = this.chatActivityEnterView;
EmojiView emojiView15 = chatActivityEnterView15;
if (chatActivityEnterView15 != null) {
emojiView15 = chatActivityEnterView15.getEmojiView();
}
themeDescriptionArr[285] = new ThemeDescription(emojiView15, 0, new Class[]{EmojiView.class}, (String[]) null, (Paint[]) null, (Drawable[]) null, themeDescriptionDelegate, Theme.key_chat_emojiPanelStickerPackSelectorLine);
themeDescriptionArr[286] = new ThemeDescription(this.undoView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_undo_background);
themeDescriptionArr[287] = new ThemeDescription(this.undoView, 0, new Class[]{UndoView.class}, new String[]{"undoImageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_undo_cancelColor);
themeDescriptionArr[288] = new ThemeDescription(this.undoView, 0, new Class[]{UndoView.class}, new String[]{"undoTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_undo_cancelColor);
themeDescriptionArr[289] = new ThemeDescription(this.undoView, 0, new Class[]{UndoView.class}, new String[]{"infoTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_undo_infoColor);
themeDescriptionArr[290] = new ThemeDescription(this.undoView, 0, new Class[]{UndoView.class}, new String[]{"textPaint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_undo_infoColor);
themeDescriptionArr[291] = new ThemeDescription(this.undoView, 0, new Class[]{UndoView.class}, new String[]{"progressPaint"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_undo_infoColor);
themeDescriptionArr[292] = new ThemeDescription(this.undoView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{UndoView.class}, new String[]{"leftImageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_undo_infoColor);
themeDescriptionArr[293] = new ThemeDescription(null, 0, null, null, null, null, Theme.key_chat_botKeyboardButtonText);
themeDescriptionArr[294] = new ThemeDescription(null, 0, null, null, null, null, Theme.key_chat_botKeyboardButtonBackground);
themeDescriptionArr[295] = new ThemeDescription(null, 0, null, null, null, null, Theme.key_chat_botKeyboardButtonBackgroundPressed);
themeDescriptionArr[296] = new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_BACKGROUND | ThemeDescription.FLAG_CHECKTAG, new Class[]{FragmentContextView.class}, new String[]{"frameLayout"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_inappPlayerBackground);
themeDescriptionArr[297] = new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{FragmentContextView.class}, new String[]{"playButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_inappPlayerPlayPause);
themeDescriptionArr[298] = new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[]{FragmentContextView.class}, new String[]{"titleTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_inappPlayerTitle);
themeDescriptionArr[299] = new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_FASTSCROLL, new Class[]{FragmentContextView.class}, new String[]{"titleTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_inappPlayerPerformer);
themeDescriptionArr[300] = new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{FragmentContextView.class}, new String[]{"closeButton"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_inappPlayerClose);
themeDescriptionArr[301] = new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_BACKGROUND | ThemeDescription.FLAG_CHECKTAG, new Class[]{FragmentContextView.class}, new String[]{"frameLayout"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_returnToCallBackground);
themeDescriptionArr[302] = new ThemeDescription(this.fragmentView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[]{FragmentContextView.class}, new String[]{"titleTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_returnToCallText);
themeDescriptionArr[303] = new ThemeDescription(this.pinnedLineView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_chat_topPanelLine);
themeDescriptionArr[304] = new ThemeDescription(this.pinnedMessageNameTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_topPanelTitle);
themeDescriptionArr[305] = new ThemeDescription(this.pinnedMessageTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_topPanelMessage);
themeDescriptionArr[306] = new ThemeDescription(this.alertNameTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_topPanelTitle);
themeDescriptionArr[307] = new ThemeDescription(this.alertTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_topPanelMessage);
themeDescriptionArr[308] = new ThemeDescription(this.closePinned, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_topPanelClose);
themeDescriptionArr[309] = new ThemeDescription(this.closeReportSpam, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_topPanelClose);
themeDescriptionArr[310] = new ThemeDescription(this.topChatPanelView, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_topPanelBackground);
themeDescriptionArr[311] = new ThemeDescription(this.alertView, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_topPanelBackground);
themeDescriptionArr[312] = new ThemeDescription(this.pinnedMessageView, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_topPanelBackground);
themeDescriptionArr[313] = new ThemeDescription(this.addToContactsButton, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_addContact);
themeDescriptionArr[314] = new ThemeDescription(this.reportSpamButton, ThemeDescription.FLAG_CHECKTAG | ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_reportSpam);
themeDescriptionArr[315] = new ThemeDescription(this.reportSpamButton, ThemeDescription.FLAG_CHECKTAG | ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_addContact);
themeDescriptionArr[316] = new ThemeDescription(this.replyLineView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_chat_replyPanelLine);
themeDescriptionArr[317] = new ThemeDescription(this.replyNameTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_replyPanelName);
themeDescriptionArr[318] = new ThemeDescription(this.replyObjectTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_replyPanelMessage);
themeDescriptionArr[319] = new ThemeDescription(this.replyIconImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_replyPanelIcons);
themeDescriptionArr[320] = new ThemeDescription(this.replyCloseImageView, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_replyPanelClose);
themeDescriptionArr[321] = new ThemeDescription(this.searchUpButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_searchPanelIcons);
themeDescriptionArr[322] = new ThemeDescription(this.searchDownButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_searchPanelIcons);
themeDescriptionArr[323] = new ThemeDescription(this.searchCalendarButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_searchPanelIcons);
themeDescriptionArr[324] = new ThemeDescription(this.searchUserButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_searchPanelIcons);
themeDescriptionArr[325] = new ThemeDescription(this.searchCountText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_searchPanelText);
themeDescriptionArr[326] = new ThemeDescription(this.bottomOverlayText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_secretChatStatusText);
themeDescriptionArr[327] = new ThemeDescription(this.bottomOverlayChatText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_fieldOverlayText);
themeDescriptionArr[328] = new ThemeDescription(this.bottomOverlayChatText2, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_fieldOverlayText);
themeDescriptionArr[329] = new ThemeDescription(this.bottomOverlayProgress, 0, null, null, null, null, Theme.key_chat_fieldOverlayText);
themeDescriptionArr[330] = new ThemeDescription(this.bigEmptyView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_serviceText);
themeDescriptionArr[331] = new ThemeDescription(this.emptyView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_serviceText);
themeDescriptionArr[332] = new ThemeDescription(this.progressBar, ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_chat_serviceText);
themeDescriptionArr[333] = new ThemeDescription(this.stickersPanelArrow, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_stickersHintPanel);
themeDescriptionArr[334] = new ThemeDescription(this.stickersListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{StickerCell.class}, null, null, null, Theme.key_chat_stickersHintPanel);
themeDescriptionArr[335] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE, new Class[]{ChatUnreadCell.class}, new String[]{"backgroundLayout"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_unreadMessagesStartBackground);
themeDescriptionArr[336] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{ChatUnreadCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_unreadMessagesStartArrowIcon);
themeDescriptionArr[337] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{ChatUnreadCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_unreadMessagesStartText);
themeDescriptionArr[338] = new ThemeDescription(this.progressView2, ThemeDescription.FLAG_SERVICEBACKGROUND, null, null, null, null, Theme.key_chat_serviceBackground);
themeDescriptionArr[339] = new ThemeDescription(this.emptyView, ThemeDescription.FLAG_SERVICEBACKGROUND, null, null, null, null, Theme.key_chat_serviceBackground);
themeDescriptionArr[340] = new ThemeDescription(this.bigEmptyView, ThemeDescription.FLAG_SERVICEBACKGROUND, null, null, null, null, Theme.key_chat_serviceBackground);
themeDescriptionArr[341] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_SERVICEBACKGROUND, new Class[]{ChatLoadingCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_serviceBackground);
themeDescriptionArr[342] = new ThemeDescription(this.chatListView, ThemeDescription.FLAG_PROGRESSBAR, new Class[]{ChatLoadingCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_serviceText);
themeDescriptionArr[343] = new ThemeDescription(this.mentionListView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{BotSwitchCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_botSwitchToInlineText);
themeDescriptionArr[344] = new ThemeDescription(this.mentionListView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{MentionCell.class}, new String[]{"nameTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlackText);
themeDescriptionArr[345] = new ThemeDescription(this.mentionListView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{MentionCell.class}, new String[]{"usernameTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText3);
themeDescriptionArr[346] = new ThemeDescription(this.mentionListView, 0, new Class[]{ContextLinkCell.class}, null, new Drawable[]{Theme.chat_inlineResultFile, Theme.chat_inlineResultAudio, Theme.chat_inlineResultLocation}, null, Theme.key_chat_inlineResultIcon);
themeDescriptionArr[347] = new ThemeDescription(this.mentionListView, 0, new Class[]{ContextLinkCell.class}, null, null, null, Theme.key_windowBackgroundWhiteGrayText2);
themeDescriptionArr[348] = new ThemeDescription(this.mentionListView, 0, new Class[]{ContextLinkCell.class}, null, null, null, Theme.key_windowBackgroundWhiteLinkText);
themeDescriptionArr[349] = new ThemeDescription(this.mentionListView, 0, new Class[]{ContextLinkCell.class}, null, null, null, Theme.key_windowBackgroundWhiteBlackText);
themeDescriptionArr[350] = new ThemeDescription(this.mentionListView, 0, new Class[]{ContextLinkCell.class}, null, null, null, Theme.key_chat_inAudioProgress);
themeDescriptionArr[351] = new ThemeDescription(this.mentionListView, 0, new Class[]{ContextLinkCell.class}, null, null, null, Theme.key_chat_inAudioSelectedProgress);
themeDescriptionArr[352] = new ThemeDescription(this.mentionListView, 0, new Class[]{ContextLinkCell.class}, null, null, null, Theme.key_divider);
themeDescriptionArr[353] = new ThemeDescription(this.gifHintTextView, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_gifSaveHintBackground);
themeDescriptionArr[354] = new ThemeDescription(this.gifHintTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_gifSaveHintText);
themeDescriptionArr[355] = new ThemeDescription(null, 0, null, null, null, themeDescriptionDelegate, Theme.key_chat_attachMediaBanBackground);
themeDescriptionArr[356] = new ThemeDescription(null, 0, null, null, null, themeDescriptionDelegate, Theme.key_chat_attachMediaBanText);
themeDescriptionArr[357] = new ThemeDescription(this.noSoundHintView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{HintView.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_gifSaveHintText);
themeDescriptionArr[358] = new ThemeDescription(this.noSoundHintView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{HintView.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_gifSaveHintText);
themeDescriptionArr[359] = new ThemeDescription(this.noSoundHintView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{HintView.class}, new String[]{"arrowImageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_gifSaveHintBackground);
themeDescriptionArr[360] = new ThemeDescription(this.forwardHintView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{HintView.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_gifSaveHintText);
themeDescriptionArr[361] = new ThemeDescription(this.forwardHintView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{HintView.class}, new String[]{"arrowImageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_chat_gifSaveHintBackground);
themeDescriptionArr[362] = new ThemeDescription(this.pagedownButtonCounter, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_goDownButtonCounterBackground);
themeDescriptionArr[363] = new ThemeDescription(this.pagedownButtonCounter, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_goDownButtonCounter);
themeDescriptionArr[364] = new ThemeDescription(this.pagedownButtonImage, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_goDownButton);
themeDescriptionArr[365] = new ThemeDescription(this.pagedownButtonImage, ThemeDescription.FLAG_DRAWABLESELECTEDSTATE | ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_goDownButtonShadow);
themeDescriptionArr[366] = new ThemeDescription(this.pagedownButtonImage, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_goDownButtonIcon);
themeDescriptionArr[367] = new ThemeDescription(this.mentiondownButtonCounter, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_goDownButtonCounterBackground);
themeDescriptionArr[368] = new ThemeDescription(this.mentiondownButtonCounter, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_goDownButtonCounter);
themeDescriptionArr[369] = new ThemeDescription(this.mentiondownButtonImage, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_goDownButton);
themeDescriptionArr[370] = new ThemeDescription(this.mentiondownButtonImage, ThemeDescription.FLAG_DRAWABLESELECTEDSTATE | ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_goDownButtonShadow);
themeDescriptionArr[371] = new ThemeDescription(this.mentiondownButtonImage, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_goDownButtonIcon);
themeDescriptionArr[372] = new ThemeDescription(null, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, new Drawable[]{Theme.chat_attachButtonDrawables[0]}, null, Theme.key_chat_attachGalleryBackground);
themeDescriptionArr[373] = new ThemeDescription(null, 0, null, null, new Drawable[]{Theme.chat_attachButtonDrawables[0]}, null, Theme.key_chat_attachGalleryIcon);
themeDescriptionArr[374] = new ThemeDescription(null, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, new Drawable[]{Theme.chat_attachButtonDrawables[1]}, null, Theme.key_chat_attachAudioBackground);
themeDescriptionArr[375] = new ThemeDescription(null, 0, null, null, new Drawable[]{Theme.chat_attachButtonDrawables[1]}, null, Theme.key_chat_attachAudioIcon);
themeDescriptionArr[376] = new ThemeDescription(null, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, new Drawable[]{Theme.chat_attachButtonDrawables[2]}, null, Theme.key_chat_attachFileBackground);
themeDescriptionArr[377] = new ThemeDescription(null, 0, null, null, new Drawable[]{Theme.chat_attachButtonDrawables[2]}, null, Theme.key_chat_attachFileIcon);
themeDescriptionArr[378] = new ThemeDescription(null, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, new Drawable[]{Theme.chat_attachButtonDrawables[3]}, null, Theme.key_chat_attachContactBackground);
themeDescriptionArr[379] = new ThemeDescription(null, 0, null, null, new Drawable[]{Theme.chat_attachButtonDrawables[3]}, null, Theme.key_chat_attachContactIcon);
themeDescriptionArr[380] = new ThemeDescription(null, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, new Drawable[]{Theme.chat_attachButtonDrawables[4]}, null, Theme.key_chat_attachLocationBackground);
themeDescriptionArr[381] = new ThemeDescription(null, 0, null, null, new Drawable[]{Theme.chat_attachButtonDrawables[4]}, null, Theme.key_chat_attachLocationIcon);
themeDescriptionArr[382] = new ThemeDescription(null, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, new Drawable[]{Theme.chat_attachButtonDrawables[5]}, null, Theme.key_chat_attachPollBackground);
themeDescriptionArr[383] = new ThemeDescription(null, 0, null, null, new Drawable[]{Theme.chat_attachButtonDrawables[5]}, null, Theme.key_chat_attachPollIcon);
themeDescriptionArr[384] = new ThemeDescription(null, 0, null, null, new Drawable[]{Theme.chat_attachEmptyDrawable}, null, Theme.key_chat_attachEmptyImage);
themeDescriptionArr[385] = new ThemeDescription(null, 0, null, null, null, themeDescriptionDelegate, Theme.key_chat_attachPhotoBackground);
themeDescriptionArr[386] = new ThemeDescription(null, 0, null, null, null, themeDescriptionDelegate, Theme.key_dialogBackground);
themeDescriptionArr[387] = new ThemeDescription(null, 0, null, null, null, themeDescriptionDelegate, Theme.key_dialogBackgroundGray);
themeDescriptionArr[388] = new ThemeDescription(null, 0, null, null, null, themeDescriptionDelegate, Theme.key_dialogTextGray2);
themeDescriptionArr[389] = new ThemeDescription(null, 0, null, null, null, themeDescriptionDelegate, Theme.key_dialogScrollGlow);
themeDescriptionArr[390] = new ThemeDescription(null, 0, null, null, null, themeDescriptionDelegate, Theme.key_dialogGrayLine);
themeDescriptionArr[391] = new ThemeDescription(null, 0, null, null, null, themeDescriptionDelegate, Theme.key_dialogCameraIcon);
return themeDescriptionArr;
}
public void lambda$getThemeDescriptions$163$ChatActivity() {
updateVisibleRows();
ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
if (chatActivityEnterView != null && chatActivityEnterView.getEmojiView() != null) {
this.chatActivityEnterView.getEmojiView().updateColors();
}
ChatAttachAlert chatAttachAlert = this.chatAttachAlert;
if (chatAttachAlert != null) {
chatAttachAlert.checkColors();
}
}
}