正在查看: Plus 12 v10.13.1.1 应用的 ChatActivityEnterView.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Plus 12 v10.13.1.1 应用的 ChatActivityEnterView.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package org.telegram.ui.Components;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.PorterDuffXfermode;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.PowerManager;
import android.os.SystemClock;
import android.provider.Settings;
import android.text.Editable;
import android.text.Layout;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.StaticLayout;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Property;
import android.view.ActionMode;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.OvershootInterpolator;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.webkit.MimeTypeMap;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Keep;
import androidx.collection.LongSparseArray;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.ColorUtils;
import androidx.core.math.MathUtils;
import androidx.core.os.BuildCompat;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.core.view.inputmethod.EditorInfoCompat;
import androidx.core.view.inputmethod.InputConnectionCompat;
import androidx.core.view.inputmethod.InputContentInfoCompat;
import androidx.customview.widget.ExploreByTouchHelper;
import androidx.dynamicanimation.animation.DynamicAnimation;
import androidx.dynamicanimation.animation.SpringAnimation;
import androidx.dynamicanimation.animation.SpringForce;
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
import androidx.recyclerview.widget.ChatListItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import org.telegram.messenger.AccountInstance;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.AnimationNotificationsLocker;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BirthdayController;
import org.telegram.messenger.BotWebViewVibrationEffect;
import org.telegram.messenger.BuildConfig;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.ChatObject;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.DialogObject;
import org.telegram.messenger.Emoji;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LiteMode;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaController;
import org.telegram.messenger.MediaController$PhotoEntry;
import org.telegram.messenger.MediaDataController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagePreviewParams;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.MessagesStorage;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.NotificationsController;
import org.telegram.messenger.NotificationsSettingsFacade;
import org.telegram.messenger.PlusUtils;
import org.telegram.messenger.R;
import org.telegram.messenger.SendMessagesHelper;
import org.telegram.messenger.SendMessagesHelper$SendMessageParams;
import org.telegram.messenger.SendMessagesHelper$SendingMediaInfo;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.SharedPrefsHelper;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.UserObject;
import org.telegram.messenger.Utilities;
import org.telegram.messenger.VideoEditedInfo;
import org.telegram.messenger.browser.Browser;
import org.telegram.messenger.camera.CameraController;
import org.telegram.messenger.translator.BaseTranslationEngine;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.RequestDelegate;
import org.telegram.tgnet.SerializedData;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
import org.telegram.tgnet.tl.TL_stories$StoryItem;
import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.ActionBarMenuSubItem;
import org.telegram.ui.ActionBar.ActionBarPopupWindow;
import org.telegram.ui.ActionBar.AdjustPanLayoutHelper;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.PlusSettings;
import org.telegram.ui.ActionBar.SimpleTextView;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Business.BusinessLinksController;
import org.telegram.ui.ChatActivity;
import org.telegram.ui.Components.AlertsCreator;
import org.telegram.ui.Components.AnimatedTextView;
import org.telegram.ui.Components.ChatActivityEnterView;
import org.telegram.ui.Components.ChatActivityEnterViewAnimatedIconView;
import org.telegram.ui.Components.EditTextCaption;
import org.telegram.ui.Components.EmojiView;
import org.telegram.ui.Components.MessagePreviewView;
import org.telegram.ui.Components.Premium.GiftPremiumBottomSheet;
import org.telegram.ui.Components.Premium.PremiumFeatureBottomSheet;
import org.telegram.ui.Components.Premium.boosts.BoostRepository;
import org.telegram.ui.Components.Premium.boosts.PremiumPreviewGiftToUsersBottomSheet;
import org.telegram.ui.Components.RecyclerListView;
import org.telegram.ui.Components.SeekBar;
import org.telegram.ui.Components.SenderSelectPopup;
import org.telegram.ui.Components.SizeNotifierFrameLayout;
import org.telegram.ui.Components.StickersAlert;
import org.telegram.ui.Components.SuggestEmojiView;
import org.telegram.ui.Components.TextStyleSpan;
import org.telegram.ui.Components.VideoTimelineView;
import org.telegram.ui.ContentPreviewViewer;
import org.telegram.ui.DialogsActivity;
import org.telegram.ui.GroupStickersActivity;
import org.telegram.ui.LaunchActivity;
import org.telegram.ui.MessageSendPreview;
import org.telegram.ui.MultiContactsSelectorBottomSheet;
import org.telegram.ui.PhotoViewer;
import org.telegram.ui.PremiumPreviewFragment;
import org.telegram.ui.ProfileActivity;
import org.telegram.ui.StickersActivity;
import org.telegram.ui.Stories.recorder.CaptionContainerView;
import org.telegram.ui.Stories.recorder.HintView2;
import org.telegram.ui.TopicsFragment;
import org.telegram.ui.bots.BotCommandsMenuContainer;
import org.telegram.ui.bots.BotCommandsMenuView;
import org.telegram.ui.bots.BotKeyboardView;
import org.telegram.ui.bots.BotWebViewMenuContainer;
import org.telegram.ui.bots.BotWebViewSheet;
import org.telegram.ui.bots.ChatActivityBotWebViewButton;
public class ChatActivityEnterView extends BlurredFrameLayout implements NotificationCenter.NotificationCenterDelegate, SizeNotifierFrameLayout.SizeNotifierFrameLayoutDelegate, StickersAlert.StickersAlertDelegate, SuggestEmojiView.AnchorViewDelegate {
public final Property<? super View, Float> ATTACH_LAYOUT_ALPHA;
public final Property<? super View, Float> ATTACH_LAYOUT_TRANSLATION_X;
public final Property<? super View, Float> EMOJI_BUTTON_ALPHA;
public final Property<? super View, Float> EMOJI_BUTTON_SCALE;
public final Property<? super View, Float> MESSAGE_TEXT_TRANSLATION_X;
public AccountInstance accountInstance;
public ActionBarMenuSubItem actionScheduleButton;
public AdjustPanLayoutHelper adjustPanLayoutHelper;
public boolean allowAnimatedEmoji;
public boolean allowBlur;
public boolean allowGifs;
public boolean allowShowTopView;
public boolean allowStickers;
public int animatedTop;
public int animatingContentType;
public Runnable animationEndRunnable;
public HashMap<View, Float> animationParamsX;
public ImageView attachButton;
public LinearLayout attachLayout;
public float attachLayoutAlpha;
public float attachLayoutPaddingAlpha;
public float attachLayoutPaddingTranslationX;
public float attachLayoutTranslationX;
public TLRPC.TL_document audioToSend;
public MessageObject audioToSendMessageObject;
public String audioToSendPath;
public FrameLayout audioVideoButtonContainer;
public ChatActivityEnterViewAnimatedIconView audioVideoSendButton;
public Paint backgroundPaint;
public HintView2 birthdayHint;
public android.graphics.Rect blurBounds;
public ImageView botButton;
public ReplaceableIconDrawable botButtonDrawable;
public MessageObject botButtonsMessageObject;
public int botCommandLastPosition;
public int botCommandLastTop;
public BotCommandsMenuView.BotCommandsAdapter botCommandsAdapter;
public BotCommandsMenuView botCommandsMenuButton;
public BotCommandsMenuContainer botCommandsMenuContainer;
public int botCount;
public BotKeyboardView botKeyboardView;
public boolean botKeyboardViewVisible;
public BotMenuButtonType botMenuButtonType;
public String botMenuWebViewTitle;
public String botMenuWebViewUrl;
public MessageObject botMessageObject;
public TLRPC.TL_replyKeyboardMarkup botReplyMarkup;
public ChatActivityBotWebViewButton botWebViewButton;
public BotWebViewMenuContainer botWebViewMenuContainer;
public final AnimatedFloat bottomGradientAlpha;
public boolean calledRecordRunnable;
public Drawable cameraDrawable;
public Drawable cameraOutline;
public boolean canWriteToChannel;
public ImageView cancelBotButton;
public boolean canceledByGesture;
public boolean captionAbove;
public boolean captionLimitBulletinShown;
public NumberTextView captionLimitView;
public float chatSearchExpandOffset;
public boolean clearBotButtonsOnKeyboardOpen;
public final LinearGradient clipGradient;
public final Matrix clipMatrix;
public boolean closeAnimationInProgress;
public int codePointCount;
public int commonInputType;
public float composeShadowAlpha;
public float controlsScale;
public ControlsView controlsView;
public int currentAccount;
public int currentLimit;
public int currentPopupContentType;
public ValueAnimator currentTopViewAnimation;
public ChatActivityEnterViewDelegate delegate;
public boolean destroyed;
public long dialog_id;
public final Runnable dismissSendPreview;
public float distCanMove;
public SendButton doneButton;
public AnimatorSet doneButtonAnimation;
public boolean doneButtonEnabled;
public float doneButtonEnabledProgress;
public Drawable doneCheckDrawable;
public boolean dontUpdateDiscussionChat;
public Paint dotPaint;
public CharSequence draftMessage;
public boolean draftSearchWebpage;
public TLRPC.TL_businessChatLink editingBusinessLink;
public boolean editingCaption;
public MessageObject editingMessageObject;
public ChatActivityEnterViewAnimatedIconView emojiButton;
public float emojiButtonAlpha;
public float emojiButtonPaddingAlpha;
public float emojiButtonPaddingScale;
public boolean emojiButtonRestricted;
public float emojiButtonScale;
public int emojiPadding;
public boolean emojiTabOpen;
public EmojiView emojiView;
public boolean emojiViewFrozen;
public boolean emojiViewVisible;
public float exitTransition;
public ImageView expandStickersButton;
public Runnable focusRunnable;
public boolean forceShowSendButton;
public ImageView giftButton;
public final Paint gradientPaint;
public boolean hasBotCommands;
public boolean hasQuickReplies;
public boolean hasRecordVideo;
public Runnable hideKeyboardRunnable;
public float horizontalPadding;
public float idleProgress;
public boolean ignoreTextChange;
public TLRPC.ChatFull info;
public int innerTextChange;
public final boolean isChat;
public boolean isInVideoMode;
public boolean isInitLineCount;
public boolean isPaste;
public boolean isPaused;
public boolean isStories;
public int keyboardHeight;
public int keyboardHeightLand;
public boolean keyboardVisible;
public LongSparseArray<TLRPC.BotInfo> lastBotInfo;
public int lastRecordState;
public BusinessLinkPresetMessage lastSavedBusinessLinkMessage;
public int lastSizeChangeValue1;
public boolean lastSizeChangeValue2;
public long lastTypingTimeSend;
public int lineCount;
public int[] location;
public float lockAnimatedTranslation;
public Drawable lockShadowDrawable;
public EditTextCaption messageEditText;
public FrameLayout messageEditTextContainer;
public boolean messageEditTextEnabled;
public ArrayList<TextWatcher> messageEditTextWatchers;
public MessageSendPreview messageSendPreview;
public float messageTextPaddingTranslationX;
public float messageTextTranslationX;
public boolean messageTransitionIsRunning;
public TLRPC.WebPage messageWebPage;
public boolean messageWebPageSearch;
public Drawable micDrawable;
public Drawable micOutline;
public long millisecondsRecorded;
public Runnable moveToSendStateRunnable;
public boolean needShowTopView;
public AnimationNotificationsLocker notificationsLocker;
public ImageView notifyButton;
public CrossOutDrawable notifySilentDrawable;
public Runnable onEmojiSearchClosed;
public Runnable onFinishInitCameraRunnable;
public Runnable onKeyboardClosed;
public boolean onceVisible;
public Runnable openKeyboardRunnable;
public int originalViewHeight;
public CharSequence overrideHint;
public CharSequence overrideHint2;
public boolean overrideKeyboardAnimation;
public Paint paint;
public AnimatorSet panelAnimation;
public Activity parentActivity;
public ChatActivity parentFragment;
public RectF pauseRect;
public TLRPC.KeyboardButton pendingLocationButton;
public MessageObject pendingMessageObject;
public MediaActionDrawable playPauseDrawable;
public int popupX;
public int popupY;
public boolean preventInput;
public CloseProgressDrawable2 progressDrawable;
public ImageView reactionsButton;
public Runnable recordAudioVideoRunnable;
public boolean recordAudioVideoRunnableStarted;
public RecordCircle recordCircle;
public Property<RecordCircle, Float> recordCircleScale;
public Property<RecordCircle, Float> recordControlsCircleScale;
public RLottieImageView recordDeleteImageView;
public RecordDot recordDot;
public int recordInterfaceState;
public boolean recordIsCanceled;
public FrameLayout recordPanel;
public AnimatorSet recordPannelAnimation;
public LinearLayout recordTimeContainer;
public TimerView recordTimerView;
public View recordedAudioBackground;
public FrameLayout recordedAudioPanel;
public ImageView recordedAudioPlayButton;
public SeekBarWaveformView recordedAudioSeekBar;
public TextView recordedAudioTimeTextView;
public boolean recordingAudioVideo;
public int recordingGuid;
public android.graphics.Rect rect;
public Paint redDotPaint;
public boolean removeEmojiViewAfterAnimation;
public MessageObject replyingMessageObject;
public ChatActivity.ReplyQuote replyingQuote;
public MessageObject replyingTopMessage;
public final Theme.ResourcesProvider resourcesProvider;
public Property<View, Integer> roundedTranslationYProperty;
public Runnable runEmojiPanelAnimation;
public AnimatorSet runningAnimation;
public AnimatorSet runningAnimation2;
public AnimatorSet runningAnimationAudio;
public int runningAnimationType;
public float scale;
public boolean scheduleButtonHidden;
public ImageView scheduledButton;
public AnimatorSet scheduledButtonAnimation;
public ValueAnimator searchAnimator;
public float searchToOpenProgress;
public int searchingType;
public SeekBarWaveform seekBarWaveform;
public SendButton sendButton;
public int sendButtonBackgroundColor;
public FrameLayout sendButtonContainer;
public boolean sendButtonEnabled;
public boolean sendButtonVisible;
public boolean sendByEnter;
public Drawable sendDrawable;
public boolean sendPlainEnabled;
public ActionBarPopupWindow.ActionBarPopupWindowLayout sendPopupLayout;
public ActionBarPopupWindow sendPopupWindow;
public android.graphics.Rect sendRect;
public boolean sendRoundEnabled;
public boolean sendVoiceEnabled;
public ActionBarMenuSubItem sendWhenOnlineButton;
public SenderSelectPopup senderSelectPopupWindow;
public SenderSelectView senderSelectView;
public long sentFromPreview;
public Runnable setTextFieldRunnable;
public boolean shouldAnimateEditTextWithBounds;
public boolean shouldDrawBackground;
public boolean shouldDrawRecordedAudioPanelInParent;
public boolean showKeyboardOnResume;
public boolean showTooltip;
public long showTooltipStartTime;
public Runnable showTopViewRunnable;
public boolean silent;
public SizeNotifierFrameLayout sizeNotifierLayout;
public int slideDelta;
public SlideTextView slideText;
public float slideToCancelLockProgress;
public float slideToCancelProgress;
public SlowModeBtn slowModeButton;
public int slowModeTimer;
public boolean smoothKeyboard;
public float snapAnimationProgress;
public float startTranslation;
public float startedDraggingX;
public AnimatedArrowDrawable stickersArrow;
public boolean stickersDragging;
public boolean stickersEnabled;
public boolean stickersExpanded;
public int stickersExpandedHeight;
public Animator stickersExpansionAnim;
public float stickersExpansionProgress;
public boolean stickersTabOpen;
public FrameLayout textFieldContainer;
public boolean textTransitionIsRunning;
public float tooltipAlpha;
public final AnimatedFloat topGradientAlpha;
public View topLineView;
public View topView;
public float topViewEnterProgress;
public boolean topViewShowed;
public final ValueAnimator.AnimatorUpdateListener topViewUpdateListener;
public float transformToSeekbar;
public String translationChatLang;
public TrendingStickersAlert trendingStickersAlert;
public Runnable updateExpandabilityRunnable;
public Runnable updateSlowModeRunnable;
public TLRPC.UserFull userInfo;
public Toast vToast;
public VideoTimelineView videoTimelineView;
public VideoEditedInfo videoToSendMessageObject;
public boolean voiceOnce;
public boolean waitingForKeyboardOpen;
public boolean waitingForKeyboardOpenAfterAnimation;
public PowerManager.WakeLock wakeLock;
public boolean wasSendTyping;
public enum BotMenuButtonType {
NO_BUTTON,
COMMANDS,
WEB_VIEW
}
public interface ChatActivityEnterViewDelegate {
public final class CC {
public static void $default$bottomPanelTranslationYChanged(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate, float f) {
}
public static boolean $default$checkCanRemoveRestrictionsByBoosts(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
return false;
}
public static int $default$getContentViewHeight(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
return 0;
}
public static ChatActivity.ReplyQuote $default$getReplyQuote(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
return null;
}
public static TL_stories$StoryItem $default$getReplyToStory(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
return null;
}
public static TLRPC.TL_channels_sendAsPeers $default$getSendAsPeers(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
return null;
}
public static boolean $default$hasForwardingMessages(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
return false;
}
public static boolean $default$hasScheduledMessages(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
return true;
}
public static int $default$measureKeyboardHeight(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
return 0;
}
public static void $default$onContextMenuClose(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
}
public static void $default$onContextMenuOpen(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
}
public static void $default$onEditTextScroll(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
}
public static void $default$onKeyboardRequested(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
}
public static void $default$onTrendingStickersShowed(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate, boolean z) {
}
public static boolean $default$onceVoiceAvailable(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
return false;
}
public static void $default$openScheduledMessages(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
}
public static void $default$prepareMessageSending(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
}
public static void $default$scrollToSendingMessage(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
}
}
void bottomPanelTranslationYChanged(float translation);
boolean checkCanRemoveRestrictionsByBoosts();
void didPressAttachButton();
int getContentViewHeight();
ChatActivity.ReplyQuote getReplyQuote();
TL_stories$StoryItem getReplyToStory();
TLRPC.TL_channels_sendAsPeers getSendAsPeers();
boolean hasForwardingMessages();
boolean hasScheduledMessages();
int measureKeyboardHeight();
void needChangeVideoPreviewState(int state, float seekProgress);
void needSendTyping();
void needShowMediaBanHint();
void needStartRecordAudio(int state);
void needStartRecordVideo(int state, boolean notify, int scheduleDate, int ttl, long effectId);
void onAttachButtonHidden();
void onAttachButtonShow();
void onAudioVideoInterfaceUpdated();
void onContextMenuClose();
void onContextMenuOpen();
void onEditTextScroll();
void onKeyboardRequested();
void onMessageEditEnd(boolean loading);
void onMessageSend(CharSequence message, boolean notify, int scheduleDate);
void onPreAudioVideoRecord();
void onSendLongClick();
void onStickersExpandedChange();
void onStickersTab(boolean opened);
void onSwitchRecordMode(boolean video);
void onTextChanged(CharSequence text, boolean bigChange, boolean fromDraft);
void onTextSelectionChanged(int start, int end);
void onTextSpansChanged(CharSequence text);
void onTrendingStickersShowed(boolean show);
void onUpdateSlowModeButton(View button, boolean show, CharSequence time);
void onWindowSizeChanged(int size);
boolean onceVoiceAvailable();
void openScheduledMessages();
void prepareMessageSending();
void scrollToSendingMessage();
void toggleVideoRecordingPause();
}
public static void m1604$$Nest$mcheckBirthdayHint(ChatActivityEnterView chatActivityEnterView) {
chatActivityEnterView.checkBirthdayHint();
}
public static boolean lambda$createRecordPanel$60(View view, MotionEvent motionEvent) {
return true;
}
public void checkAnimation() {
}
public void extendActionMode(Menu menu) {
}
public boolean hasOverlappingRendering() {
return false;
}
public void isRecordingStateChanged() {
}
public void onLineCountChanged(int oldLineCount, int newLineCount) {
}
public boolean pannelAnimationEnabled() {
return true;
}
public boolean showConfirmAlert(Runnable onConfirmed) {
return false;
}
public void drawRecordedPannel(Canvas canvas) {
FrameLayout frameLayout;
if (getAlpha() == 0.0f || (frameLayout = this.recordedAudioPanel) == null || frameLayout.getParent() == null || this.recordedAudioPanel.getVisibility() != 0) {
return;
}
int save = canvas.save();
canvas.translate(getX() + this.textFieldContainer.getX() + this.messageEditTextContainer.getX() + this.recordedAudioPanel.getX(), getY() + this.textFieldContainer.getY() + this.messageEditTextContainer.getY() + this.recordedAudioPanel.getY());
if (getAlpha() != 1.0f) {
canvas.saveLayerAlpha(0.0f, 0.0f, getMeasuredWidth(), getMeasuredHeight(), (int) (getAlpha() * 255.0f), 31);
}
this.recordedAudioPanel.draw(canvas);
canvas.restoreToCount(save);
}
public class SeekBarWaveformView extends View {
public SeekBarWaveformView(Context context) {
super(context);
ChatActivityEnterView.this.seekBarWaveform = new SeekBarWaveform(context);
ChatActivityEnterView.this.seekBarWaveform.setDelegate(new SeekBar.SeekBarDelegate() {
@Override
public boolean isSeekBarDragAllowed() {
return SeekBar.SeekBarDelegate.CC.$default$isSeekBarDragAllowed(this);
}
@Override
public void onSeekBarContinuousDrag(float f) {
SeekBar.SeekBarDelegate.CC.$default$onSeekBarContinuousDrag(this, f);
}
@Override
public final void onSeekBarDrag(float f) {
ChatActivityEnterView.SeekBarWaveformView.this.lambda$new$0(f);
}
@Override
public void onSeekBarPressed() {
SeekBar.SeekBarDelegate.CC.$default$onSeekBarPressed(this);
}
@Override
public void onSeekBarReleased() {
SeekBar.SeekBarDelegate.CC.$default$onSeekBarReleased(this);
}
@Override
public boolean reverseWaveform() {
return SeekBar.SeekBarDelegate.CC.$default$reverseWaveform(this);
}
});
}
public void lambda$new$0(float f) {
if (ChatActivityEnterView.this.audioToSendMessageObject != null) {
ChatActivityEnterView.this.audioToSendMessageObject.audioProgress = f;
MediaController.getInstance().seekToProgress(ChatActivityEnterView.this.audioToSendMessageObject, f);
}
}
public void setWaveform(byte[] waveform) {
ChatActivityEnterView.this.seekBarWaveform.setWaveform(waveform);
invalidate();
}
public void setProgress(float progress) {
ChatActivityEnterView.this.seekBarWaveform.setProgress(progress);
invalidate();
}
public boolean isDragging() {
return ChatActivityEnterView.this.seekBarWaveform.isDragging();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
boolean onTouch = ChatActivityEnterView.this.seekBarWaveform.onTouch(event.getAction(), event.getX(), event.getY());
if (onTouch) {
if (event.getAction() == 0) {
ChatActivityEnterView.this.requestDisallowInterceptTouchEvent(true);
}
invalidate();
}
return onTouch || super.onTouchEvent(event);
}
@Override
public void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
ChatActivityEnterView.this.seekBarWaveform.setSize((int) ((right - left) - (ChatActivityEnterView.this.horizontalPadding * 2.0f)), bottom - top);
}
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
SeekBarWaveform seekBarWaveform = ChatActivityEnterView.this.seekBarWaveform;
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
int i = Theme.key_chat_recordedVoiceProgress;
seekBarWaveform.setColors(chatActivityEnterView.getThemedColor(i), ChatActivityEnterView.this.getThemedColor(Theme.key_chat_recordedVoiceProgressInner), ChatActivityEnterView.this.getThemedColor(i));
ChatActivityEnterView.this.seekBarWaveform.draw(canvas, this);
}
}
public static class SlowModeBtn extends FrameLayout {
public final RectF bgRect;
public final Drawable closeDrawable;
public final Paint gradientPaint;
public boolean isPremiumMode;
public final SimpleTextView textView;
public SlowModeBtn(Context context) {
super(context);
this.bgRect = new RectF();
this.gradientPaint = new Paint(1);
this.isPremiumMode = false;
SimpleTextView simpleTextView = new SimpleTextView(context);
this.textView = simpleTextView;
addView((View) simpleTextView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, -1.0f));
setWillNotDraw(false);
Drawable drawable = ContextCompat.getDrawable(context, R.drawable.msg_mini_close_tooltip);
this.closeDrawable = drawable;
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
setClipToPadding(false);
setClipChildren(false);
ScaleStateListAnimator.apply(this);
}
@Override
public void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
this.gradientPaint.setShader(new LinearGradient(0.0f, 0.0f, getMeasuredWidth(), 0.0f, new int[]{-9071617, -5999873}, new float[]{0.0f, 1.0f}, Shader.TileMode.CLAMP));
}
public void setTextSize(int size) {
this.textView.setTextSize(size);
invalidate();
}
public void setTextColor(int color) {
this.textView.setTextColor(color);
invalidate();
}
public void setGravity(int gravity) {
this.textView.setGravity(gravity);
invalidate();
}
public void setText(CharSequence text) {
this.textView.setText(text);
invalidate();
}
public void setPremiumMode(boolean premiumMode) {
this.isPremiumMode = premiumMode;
invalidate();
}
public CharSequence getText() {
return this.textView.getText();
}
@Override
public void onDraw(Canvas canvas) {
if (this.isPremiumMode) {
canvas.save();
int dp = AndroidUtilities.dp(26.0f);
canvas.translate(0.0f, ((getMeasuredHeight() - dp) / 2.0f) - AndroidUtilities.dp(1.0f));
float f = dp;
this.bgRect.set(0.0f, 0.0f, getMeasuredWidth() - getPaddingEnd(), f);
float f2 = f / 2.0f;
canvas.drawRoundRect(this.bgRect, f2, f2, this.gradientPaint);
canvas.translate(((getMeasuredWidth() - getPaddingEnd()) - AndroidUtilities.dp(6.0f)) - this.closeDrawable.getIntrinsicWidth(), AndroidUtilities.dp(5.0f));
this.closeDrawable.draw(canvas);
canvas.restore();
}
}
@Override
public boolean drawChild(Canvas canvas, View child, long drawingTime) {
if ((child instanceof SimpleTextView) && this.isPremiumMode) {
SimpleTextView simpleTextView = (SimpleTextView) child;
canvas.save();
canvas.scale(0.8f, 0.8f);
canvas.translate(-AndroidUtilities.dp(16.0f), AndroidUtilities.dp(5.0f));
int color = simpleTextView.getTextPaint().getColor();
simpleTextView.getTextPaint().setColor(-1);
boolean drawChild = super.drawChild(canvas, child, drawingTime);
simpleTextView.getTextPaint().setColor(color);
canvas.restore();
return drawChild;
}
return super.drawChild(canvas, child, drawingTime);
}
}
public class RecordDot extends View {
public float alpha;
public boolean attachedToWindow;
public RLottieDrawable drawable;
public boolean enterAnimation;
public boolean isIncr;
public long lastUpdateTime;
public boolean playing;
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
this.attachedToWindow = true;
if (this.playing) {
this.drawable.start();
}
this.drawable.setMasterParent(this);
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
this.attachedToWindow = false;
this.drawable.stop();
this.drawable.setMasterParent(null);
}
public RecordDot(Context context) {
super(context);
int i = R.raw.chat_audio_record_delete_2;
RLottieDrawable rLottieDrawable = new RLottieDrawable(i, BuildConfig.APP_CENTER_HASH + i, AndroidUtilities.dp(28.0f), AndroidUtilities.dp(28.0f), false, null);
this.drawable = rLottieDrawable;
rLottieDrawable.setCurrentParentView(this);
this.drawable.setInvalidateOnProgressSet(true);
updateColors();
}
public void updateColors() {
int themedColor = ChatActivityEnterView.this.getThemedColor(Theme.key_chat_recordedVoiceDot);
int themedColor2 = ChatActivityEnterView.this.getThemedColor(Theme.key_chat_messagePanelBackground);
ChatActivityEnterView.this.redDotPaint.setColor(themedColor);
this.drawable.beginApplyLayerColors();
this.drawable.setLayerColor("Cup Red.**", themedColor);
this.drawable.setLayerColor("Box.**", themedColor);
this.drawable.setLayerColor("Line 1.**", themedColor2);
this.drawable.setLayerColor("Line 2.**", themedColor2);
this.drawable.setLayerColor("Line 3.**", themedColor2);
this.drawable.commitApplyLayerColors();
if (ChatActivityEnterView.this.playPauseDrawable != null) {
ChatActivityEnterView.this.playPauseDrawable.setColor(ChatActivityEnterView.this.getThemedColor(Theme.key_chat_recordedVoicePlayPause));
}
}
public void resetAlpha() {
this.alpha = 1.0f;
this.lastUpdateTime = System.currentTimeMillis();
this.isIncr = false;
this.playing = false;
this.drawable.stop();
invalidate();
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
this.drawable.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
}
@Override
public void onDraw(Canvas canvas) {
if (this.playing) {
this.drawable.setAlpha((int) (this.alpha * 255.0f));
}
ChatActivityEnterView.this.redDotPaint.setAlpha((int) (this.alpha * 255.0f));
long currentTimeMillis = System.currentTimeMillis() - this.lastUpdateTime;
if (this.enterAnimation) {
this.alpha = 1.0f;
} else if (!this.isIncr && !this.playing) {
float f = this.alpha - (currentTimeMillis / 600.0f);
this.alpha = f;
if (f <= 0.0f) {
this.alpha = 0.0f;
this.isIncr = true;
}
} else {
float f2 = this.alpha + (currentTimeMillis / 600.0f);
this.alpha = f2;
if (f2 >= 1.0f) {
this.alpha = 1.0f;
this.isIncr = false;
}
}
this.lastUpdateTime = System.currentTimeMillis();
if (this.playing) {
this.drawable.draw(canvas);
}
if (!this.playing || !this.drawable.hasBitmap()) {
canvas.drawCircle(getMeasuredWidth() >> 1, getMeasuredHeight() >> 1, AndroidUtilities.dp(5.0f), ChatActivityEnterView.this.redDotPaint);
}
invalidate();
}
public void playDeleteAnimation() {
this.playing = true;
this.drawable.setProgress(0.0f);
if (this.attachedToWindow) {
this.drawable.start();
}
}
}
public class ControlsView extends FrameLayout {
public AnimatedFloat hidePauseT;
public HintView2 hintView;
public int lastSize;
public long lastUpdateTime;
public Paint lockBackgroundPaint;
public Paint lockOutlinePaint;
public Paint lockPaint;
public Drawable micDrawable;
public boolean oncePressed;
public final RectF onceRect;
public Paint p;
public Path path;
public final Path path2;
public boolean pausePressed;
public CaptionContainerView.PeriodDrawable periodDrawable;
public final float[] radiiLeft;
public final float[] radiiRight;
public final RectF rectF;
public Drawable tooltipBackground;
public Drawable tooltipBackgroundArrow;
public StaticLayout tooltipLayout;
public String tooltipMessage;
public TextPaint tooltipPaint;
public float tooltipWidth;
public Drawable vidDrawable;
public VirtualViewHelper virtualViewHelper;
@Override
public void setAlpha(float alpha) {
super.setAlpha(alpha);
}
@Override
public boolean onSetAlpha(int alpha) {
return super.onSetAlpha(alpha);
}
public ControlsView(Context context) {
super(context);
this.tooltipPaint = new TextPaint(1);
this.lockBackgroundPaint = new Paint(1);
this.lockPaint = new Paint(1);
this.lockOutlinePaint = new Paint(1);
this.path = new Path();
this.p = new Paint(1);
this.rectF = new RectF();
this.onceRect = new RectF();
this.path2 = new Path();
this.radiiLeft = new float[]{r13, r13, 0.0f, 0.0f, 0.0f, 0.0f, r13, r13};
this.radiiRight = new float[]{0.0f, 0.0f, r12, r12, r12, r12, 0.0f, 0.0f};
this.hidePauseT = new AnimatedFloat(this, 0L, 350L, CubicBezierInterpolator.EASE_OUT_QUINT);
VirtualViewHelper virtualViewHelper = new VirtualViewHelper(this);
this.virtualViewHelper = virtualViewHelper;
ViewCompat.setAccessibilityDelegate(this, virtualViewHelper);
CaptionContainerView.PeriodDrawable periodDrawable = new CaptionContainerView.PeriodDrawable();
this.periodDrawable = periodDrawable;
periodDrawable.setCallback(this);
this.periodDrawable.setValue(1, ChatActivityEnterView.this.voiceOnce, false);
this.lockOutlinePaint.setStyle(Paint.Style.STROKE);
this.lockOutlinePaint.setStrokeCap(Paint.Cap.ROUND);
this.lockOutlinePaint.setStrokeWidth(AndroidUtilities.dpf2(1.7f));
ChatActivityEnterView.this.lockShadowDrawable = getResources().getDrawable(R.drawable.lock_round_shadow);
ChatActivityEnterView.this.lockShadowDrawable.setColorFilter(new PorterDuffColorFilter(ChatActivityEnterView.this.getThemedColor(Theme.key_chat_messagePanelVoiceLockShadow), PorterDuff.Mode.MULTIPLY));
this.tooltipBackground = Theme.createRoundRectDrawable(AndroidUtilities.dp(5.0f), ChatActivityEnterView.this.getThemedColor(Theme.key_chat_gifSaveHintBackground));
this.tooltipPaint.setTextSize(AndroidUtilities.dp(14.0f));
this.tooltipBackgroundArrow = ContextCompat.getDrawable(context, R.drawable.tooltip_arrow);
this.tooltipMessage = LocaleController.getString("SlideUpToLock", R.string.SlideUpToLock);
float dp = AndroidUtilities.dp(3.0f);
float dp2 = AndroidUtilities.dp(3.0f);
this.micDrawable = getResources().getDrawable(R.drawable.input_mic).mutate();
this.vidDrawable = getResources().getDrawable(R.drawable.input_video).mutate();
setWillNotDraw(false);
updateColors();
}
public void showTooltipIfNeed() {
if (SharedConfig.lockRecordAudioVideoHint < 3) {
ChatActivityEnterView.this.showTooltip = true;
ChatActivityEnterView.this.showTooltipStartTime = System.currentTimeMillis();
}
}
public void showHintView() {
int i;
hideHintView();
HintView2 hintView2 = new HintView2(getContext(), 2);
this.hintView = hintView2;
hintView2.setJoint(1.0f, 0.0f);
this.hintView.setMultilineText(true);
if (ChatActivityEnterView.this.isInVideoMode) {
i = ChatActivityEnterView.this.voiceOnce ? R.string.VideoSetOnceHintEnabled : R.string.VideoSetOnceHint;
} else {
i = ChatActivityEnterView.this.voiceOnce ? R.string.VoiceSetOnceHintEnabled : R.string.VoiceSetOnceHint;
}
this.hintView.setText(AndroidUtilities.replaceTags(LocaleController.getString(i)));
HintView2 hintView22 = this.hintView;
hintView22.setMaxWidthPx(HintView2.cutInFancyHalf(hintView22.getText(), this.hintView.getTextPaint()));
if (ChatActivityEnterView.this.voiceOnce) {
this.hintView.setIcon(R.raw.fire_on);
} else {
MessagesController.getGlobalMainSettings().edit().putInt("voiceoncehint", MessagesController.getGlobalMainSettings().getInt("voiceoncehint", 0) + 1).apply();
}
addView((View) this.hintView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, -1.0f, R.styleable.AppCompatTheme_windowActionModeOverlay, 0.0f, 0.0f, 54.0f, 58.0f));
final HintView2 hintView23 = this.hintView;
hintView23.setOnHiddenListener(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.ControlsView.this.lambda$showHintView$0(hintView23);
}
});
this.hintView.show();
}
public void lambda$showHintView$0(HintView2 hintView2) {
removeView(hintView2);
if (this.hintView == hintView2) {
this.hintView = null;
}
}
public void hideHintView() {
final HintView2 hintView2 = this.hintView;
if (hintView2 != null) {
hintView2.setOnHiddenListener(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.ControlsView.this.lambda$hideHintView$1(hintView2);
}
});
hintView2.hide();
this.hintView = null;
}
}
public void lambda$hideHintView$1(HintView2 hintView2) {
removeView(hintView2);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int size = View.MeasureSpec.getSize(widthMeasureSpec);
int dp = AndroidUtilities.dp(254.0f);
if (this.lastSize != size) {
this.lastSize = size;
StaticLayout staticLayout = new StaticLayout(this.tooltipMessage, this.tooltipPaint, AndroidUtilities.dp(220.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, true);
this.tooltipLayout = staticLayout;
int lineCount = staticLayout.getLineCount();
this.tooltipWidth = 0.0f;
for (int i = 0; i < lineCount; i++) {
float lineWidth = this.tooltipLayout.getLineWidth(i);
if (lineWidth > this.tooltipWidth) {
this.tooltipWidth = lineWidth;
}
}
}
super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(dp, 1073741824));
}
@Override
public void onDraw(Canvas canvas) {
float f;
float f2;
float dp;
float dpf2;
float f3;
float f4;
float f5;
float f6;
float f7;
float f8;
float f9;
float f10;
float f11;
float max;
if (ChatActivityEnterView.this.scale <= 0.5f) {
f = ChatActivityEnterView.this.scale / 0.5f;
} else if (ChatActivityEnterView.this.scale <= 0.75f) {
f = 1.0f - (((ChatActivityEnterView.this.scale - 0.5f) / 0.25f) * 0.1f);
} else {
f = 0.9f + (((ChatActivityEnterView.this.scale - 0.75f) / 0.25f) * 0.1f);
}
long currentTimeMillis = System.currentTimeMillis() - this.lastUpdateTime;
this.lastUpdateTime = System.currentTimeMillis();
if (ChatActivityEnterView.this.lockAnimatedTranslation != 10000.0f) {
f2 = Math.max(0, (int) (ChatActivityEnterView.this.startTranslation - ChatActivityEnterView.this.lockAnimatedTranslation));
if (f2 > AndroidUtilities.dp(57.0f)) {
f2 = AndroidUtilities.dp(57.0f);
}
} else {
f2 = 0.0f;
}
int measuredWidth = getMeasuredWidth() - AndroidUtilities.dp2(26.0f);
float dp2 = 1.0f - (f2 / AndroidUtilities.dp(57.0f));
float measuredHeight = getMeasuredHeight() - AndroidUtilities.dp(194.0f);
if (ChatActivityEnterView.this.sendButtonVisible) {
dp = AndroidUtilities.dp(36.0f);
float dp3 = (((AndroidUtilities.dp(60.0f) + measuredHeight) + (AndroidUtilities.dpf2(30.0f) * (1.0f - f))) - f2) + (AndroidUtilities.dpf2(14.0f) * dp2);
dpf2 = (((dp / 2.0f) + dp3) - AndroidUtilities.dpf2(8.0f)) + AndroidUtilities.dpf2(2.0f);
AndroidUtilities.dpf2(16.0f);
AndroidUtilities.dpf2(2.0f);
f3 = dp3;
f5 = dp2;
f4 = (((1.0f - dp2) * 9.0f) * (1.0f - ChatActivityEnterView.this.snapAnimationProgress)) - ((ChatActivityEnterView.this.snapAnimationProgress * 15.0f) * (1.0f - (dp2 > 0.4f ? 1.0f : dp2 / 0.4f)));
} else {
dp = AndroidUtilities.dp(36.0f) + ((int) (AndroidUtilities.dp(14.0f) * dp2));
float dp4 = (((AndroidUtilities.dp(60.0f) + measuredHeight) + ((int) (AndroidUtilities.dp(30.0f) * (1.0f - f)))) - ((int) f2)) + (ChatActivityEnterView.this.idleProgress * dp2 * (-AndroidUtilities.dp(8.0f)));
dpf2 = (((dp / 2.0f) + dp4) - AndroidUtilities.dpf2(8.0f)) + AndroidUtilities.dpf2(2.0f) + (AndroidUtilities.dpf2(2.0f) * dp2);
AndroidUtilities.dpf2(16.0f);
AndroidUtilities.dpf2(2.0f);
AndroidUtilities.dpf2(2.0f);
ChatActivityEnterView.this.snapAnimationProgress = 0.0f;
f3 = dp4;
f4 = (1.0f - dp2) * 9.0f;
f5 = 0.0f;
}
if ((ChatActivityEnterView.this.showTooltip && System.currentTimeMillis() - ChatActivityEnterView.this.showTooltipStartTime > 200) || ChatActivityEnterView.this.tooltipAlpha != 0.0f) {
if (dp2 < 0.8f || ChatActivityEnterView.this.sendButtonVisible || ChatActivityEnterView.this.exitTransition != 0.0f || ChatActivityEnterView.this.transformToSeekbar != 0.0f) {
ChatActivityEnterView.this.showTooltip = false;
}
if (!ChatActivityEnterView.this.showTooltip) {
ChatActivityEnterView.this.tooltipAlpha -= currentTimeMillis / 150.0f;
if (ChatActivityEnterView.this.tooltipAlpha < 0.0f) {
ChatActivityEnterView.this.tooltipAlpha = 0.0f;
}
} else if (ChatActivityEnterView.this.tooltipAlpha != 1.0f) {
ChatActivityEnterView.this.tooltipAlpha += currentTimeMillis / 150.0f;
if (ChatActivityEnterView.this.tooltipAlpha >= 1.0f) {
ChatActivityEnterView.this.tooltipAlpha = 1.0f;
SharedConfig.increaseLockRecordAudioVideoHintShowed();
}
}
int i = (int) (ChatActivityEnterView.this.tooltipAlpha * 255.0f);
this.tooltipBackground.setAlpha(i);
this.tooltipBackgroundArrow.setAlpha(i);
this.tooltipPaint.setAlpha(i);
if (this.tooltipLayout != null) {
canvas.save();
this.rectF.set(0.0f, 0.0f, getMeasuredWidth(), getMeasuredHeight());
canvas.translate((getMeasuredWidth() - this.tooltipWidth) - AndroidUtilities.dp(44.0f), AndroidUtilities.dpf2(16.0f) + measuredHeight);
this.tooltipBackground.setBounds(-AndroidUtilities.dp(8.0f), -AndroidUtilities.dp(2.0f), (int) (this.tooltipWidth + AndroidUtilities.dp(36.0f)), (int) (this.tooltipLayout.getHeight() + AndroidUtilities.dpf2(4.0f)));
this.tooltipBackground.draw(canvas);
this.tooltipLayout.draw(canvas);
canvas.restore();
canvas.save();
canvas.translate(getMeasuredWidth() - AndroidUtilities.dp(26.0f), ((AndroidUtilities.dpf2(17.0f) + measuredHeight) + (this.tooltipLayout.getHeight() / 2.0f)) - (ChatActivityEnterView.this.idleProgress * AndroidUtilities.dpf2(3.0f)));
this.path.reset();
this.path.setLastPoint(-AndroidUtilities.dpf2(5.0f), AndroidUtilities.dpf2(4.0f));
this.path.lineTo(0.0f, 0.0f);
this.path.lineTo(AndroidUtilities.dpf2(5.0f), AndroidUtilities.dpf2(4.0f));
this.p.setColor(-1);
this.p.setAlpha(i);
this.p.setStyle(Paint.Style.STROKE);
this.p.setStrokeCap(Paint.Cap.ROUND);
this.p.setStrokeJoin(Paint.Join.ROUND);
this.p.setStrokeWidth(AndroidUtilities.dpf2(1.5f));
canvas.drawPath(this.path, this.p);
canvas.restore();
canvas.save();
Drawable drawable = this.tooltipBackgroundArrow;
drawable.setBounds(measuredWidth - (drawable.getIntrinsicWidth() / 2), (int) (this.tooltipLayout.getHeight() + measuredHeight + AndroidUtilities.dpf2(20.0f)), (this.tooltipBackgroundArrow.getIntrinsicWidth() / 2) + measuredWidth, ((int) (this.tooltipLayout.getHeight() + measuredHeight + AndroidUtilities.dpf2(20.0f))) + this.tooltipBackgroundArrow.getIntrinsicHeight());
this.tooltipBackgroundArrow.draw(canvas);
canvas.restore();
}
}
float f12 = this.hidePauseT.set(ChatActivityEnterView.this.isInVideoMode && ChatActivityEnterView.this.millisecondsRecorded >= 59000);
if (ChatActivityEnterView.this.transformToSeekbar != 0.0f && ChatActivityEnterView.this.recordedAudioBackground != null) {
float f13 = ChatActivityEnterView.this.transformToSeekbar > 0.38f ? 1.0f : ChatActivityEnterView.this.transformToSeekbar / 0.38f;
if (ChatActivityEnterView.this.transformToSeekbar > 0.63f) {
f6 = 0.0f;
max = 1.0f;
} else {
f6 = 0.0f;
max = Math.max(0.0f, (ChatActivityEnterView.this.transformToSeekbar - 0.38f) / 0.25f);
}
CubicBezierInterpolator cubicBezierInterpolator = CubicBezierInterpolator.EASE_BOTH;
float interpolation = cubicBezierInterpolator.getInterpolation(f13);
cubicBezierInterpolator.getInterpolation(max);
f7 = interpolation;
} else if (ChatActivityEnterView.this.exitTransition != 0.0f) {
float f14 = ChatActivityEnterView.this.exitTransition > 0.6f ? 1.0f : ChatActivityEnterView.this.exitTransition / 0.6f;
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
float max2 = chatActivityEnterView.messageTransitionIsRunning ? chatActivityEnterView.exitTransition : Math.max(0.0f, (chatActivityEnterView.exitTransition - 0.6f) / 0.4f);
CubicBezierInterpolator cubicBezierInterpolator2 = CubicBezierInterpolator.EASE_BOTH;
float interpolation2 = cubicBezierInterpolator2.getInterpolation(f14);
f6 = cubicBezierInterpolator2.getInterpolation(max2);
f7 = interpolation2;
} else {
f6 = 0.0f;
f7 = 0.0f;
}
canvas.save();
canvas.clipRect(0, 0, getMeasuredWidth(), getMeasuredHeight() - ChatActivityEnterView.this.textFieldContainer.getMeasuredHeight());
if (1.0f - ChatActivityEnterView.this.controlsScale != 0.0f) {
f8 = 1.0f - ChatActivityEnterView.this.controlsScale;
} else {
f8 = f6 != 0.0f ? f6 : 0.0f;
}
if (ChatActivityEnterView.this.slideToCancelProgress < 0.7f || ChatActivityEnterView.this.canceledByGesture) {
ChatActivityEnterView.this.showTooltip = false;
if (ChatActivityEnterView.this.slideToCancelLockProgress != 0.0f) {
ChatActivityEnterView.this.slideToCancelLockProgress -= 0.12f;
if (ChatActivityEnterView.this.slideToCancelLockProgress < 0.0f) {
ChatActivityEnterView.this.slideToCancelLockProgress = 0.0f;
}
}
} else if (ChatActivityEnterView.this.slideToCancelLockProgress != 1.0f) {
ChatActivityEnterView.this.slideToCancelLockProgress += 0.12f;
if (ChatActivityEnterView.this.slideToCancelLockProgress > 1.0f) {
ChatActivityEnterView.this.slideToCancelLockProgress = 1.0f;
}
}
float dpf22 = AndroidUtilities.dpf2(72.0f);
float dpf23 = (dpf22 * f8) + (AndroidUtilities.dpf2(24.0f) * f7 * (1.0f - f8)) + ((1.0f - ChatActivityEnterView.this.slideToCancelLockProgress) * dpf22);
if (dpf23 > dpf22) {
dpf23 = dpf22;
}
float f15 = (1.0f - f12) * ChatActivityEnterView.this.controlsScale * (1.0f - f6) * ChatActivityEnterView.this.slideToCancelLockProgress;
float f16 = measuredWidth;
float f17 = dpf2 + dpf23;
canvas.scale(f15, f15, f16, f17);
float f18 = f3 + dpf23;
float f19 = f3;
float f20 = f7;
this.rectF.set(f16 - AndroidUtilities.dpf2(18.0f), f18, f16 + AndroidUtilities.dpf2(18.0f), f18 + dp);
ChatActivityEnterView.this.lockShadowDrawable.setBounds((int) (this.rectF.left - AndroidUtilities.dpf2(3.0f)), (int) (this.rectF.top - AndroidUtilities.dpf2(3.0f)), (int) (this.rectF.right + AndroidUtilities.dpf2(3.0f)), (int) (this.rectF.bottom + AndroidUtilities.dpf2(3.0f)));
ChatActivityEnterView.this.lockShadowDrawable.draw(canvas);
canvas.drawRoundRect(this.rectF, AndroidUtilities.dpf2(18.0f), AndroidUtilities.dpf2(18.0f), this.lockBackgroundPaint);
ChatActivityEnterView.this.pauseRect.set(this.rectF);
scale(ChatActivityEnterView.this.pauseRect, f15);
float f21 = 1.0f - f5;
this.rectF.set((f16 - AndroidUtilities.dpf2(6.0f)) - (AndroidUtilities.dpf2(2.0f) * f21), f17 - (AndroidUtilities.dpf2(2.0f) * f21), measuredWidth + AndroidUtilities.dp(6.0f) + (AndroidUtilities.dpf2(2.0f) * f21), f17 + AndroidUtilities.dp(12.0f) + (AndroidUtilities.dpf2(2.0f) * f21));
RectF rectF = this.rectF;
float f22 = rectF.bottom;
float centerX = rectF.centerX();
float centerY = this.rectF.centerY();
canvas.save();
float f23 = 1.0f - dp2;
canvas.translate(0.0f, AndroidUtilities.dpf2(2.0f) * f23);
canvas.rotate(f4, centerX, centerY);
if (f5 != 1.0f) {
RectF rectF2 = AndroidUtilities.rectTmp;
rectF2.set(0.0f, 0.0f, AndroidUtilities.dpf2(8.0f), AndroidUtilities.dpf2(8.0f));
canvas.save();
canvas.clipRect(0.0f, 0.0f, getMeasuredWidth(), f22 + dpf23 + (AndroidUtilities.dpf2(2.0f) * f23));
canvas.translate(f16 - AndroidUtilities.dpf2(4.0f), ((this.rectF.top - AndroidUtilities.dp(6.0f)) - AndroidUtilities.lerp(AndroidUtilities.dpf2(2.0f), AndroidUtilities.dpf2(1.5f) * (1.0f - ChatActivityEnterView.this.idleProgress), dp2)) + (AndroidUtilities.dpf2(12.0f) * f5) + (AndroidUtilities.dpf2(2.0f) * ChatActivityEnterView.this.snapAnimationProgress));
if (f4 > 0.0f) {
canvas.rotate(f4, AndroidUtilities.dp(8.0f), AndroidUtilities.dp(8.0f));
}
f9 = dp;
f10 = centerY;
canvas.drawLine(AndroidUtilities.dpf2(8.0f), AndroidUtilities.dpf2(4.0f), AndroidUtilities.dpf2(8.0f), (AndroidUtilities.dpf2(4.0f) * f21) + AndroidUtilities.dpf2(6.0f), this.lockOutlinePaint);
canvas.drawArc(rectF2, 0.0f, -180.0f, false, this.lockOutlinePaint);
float dpf24 = AndroidUtilities.dpf2(4.0f);
float dpf25 = AndroidUtilities.dpf2(4.0f);
float dpf26 = AndroidUtilities.dpf2(4.0f);
ChatActivityEnterView chatActivityEnterView2 = ChatActivityEnterView.this;
canvas.drawLine(0.0f, dpf24, 0.0f, (AndroidUtilities.dpf2(4.0f) * ChatActivityEnterView.this.snapAnimationProgress * f23) + dpf25 + (dpf26 * chatActivityEnterView2.idleProgress * dp2 * (!chatActivityEnterView2.sendButtonVisible ? 1 : 0)), this.lockOutlinePaint);
canvas.restore();
} else {
f9 = dp;
f10 = centerY;
}
Drawable drawable2 = null;
float clamp = Utilities.clamp(ChatActivityEnterView.this.transformToSeekbar * 2.0f, 1.0f, 0.0f);
if (clamp > 0.0f) {
drawable2 = ChatActivityEnterView.this.isInVideoMode ? this.vidDrawable : this.micDrawable;
}
int alpha = this.lockPaint.getAlpha();
this.lockPaint.setAlpha((int) (alpha * (1.0f - clamp)));
if (f5 > 0.0f) {
canvas.drawRoundRect(this.rectF, AndroidUtilities.dpf2(3.0f), AndroidUtilities.dpf2(3.0f), this.lockBackgroundPaint);
this.path2.rewind();
RectF rectF3 = AndroidUtilities.rectTmp;
rectF3.set(this.rectF);
rectF3.right = this.rectF.centerX() - (AndroidUtilities.dp(1.66f) * f5);
float[] fArr = this.radiiLeft;
float lerp = AndroidUtilities.lerp(AndroidUtilities.dp(3.0f), AndroidUtilities.dp(1.5f), f5);
fArr[7] = lerp;
fArr[6] = lerp;
fArr[1] = lerp;
fArr[0] = lerp;
float[] fArr2 = this.radiiLeft;
float dp5 = AndroidUtilities.dp(1.5f) * f5;
fArr2[5] = dp5;
fArr2[4] = dp5;
fArr2[3] = dp5;
fArr2[2] = dp5;
this.path2.addRoundRect(rectF3, this.radiiLeft, Path.Direction.CW);
rectF3.set(this.rectF);
rectF3.left = this.rectF.centerX() + (AndroidUtilities.dp(1.66f) * f5);
float[] fArr3 = this.radiiRight;
float lerp2 = AndroidUtilities.lerp(AndroidUtilities.dp(3.0f), AndroidUtilities.dp(1.5f), f5);
fArr3[5] = lerp2;
fArr3[4] = lerp2;
fArr3[3] = lerp2;
fArr3[2] = lerp2;
float[] fArr4 = this.radiiRight;
float dp6 = AndroidUtilities.dp(1.5f) * f5;
fArr4[7] = dp6;
fArr4[6] = dp6;
fArr4[1] = dp6;
fArr4[0] = dp6;
this.path2.addRoundRect(rectF3, this.radiiRight, Path.Direction.CW);
canvas.drawPath(this.path2, this.lockPaint);
} else {
canvas.drawRoundRect(this.rectF, AndroidUtilities.dpf2(3.0f), AndroidUtilities.dpf2(3.0f), this.lockPaint);
}
this.lockPaint.setAlpha(alpha);
if (drawable2 != null) {
android.graphics.Rect rect = AndroidUtilities.rectTmp2;
f11 = f16;
rect.set((int) (this.rectF.centerX() - ((drawable2.getIntrinsicWidth() / 2) * 0.9285f)), (int) (this.rectF.centerY() - ((drawable2.getIntrinsicHeight() / 2) * 0.9285f)), (int) (this.rectF.centerX() + ((drawable2.getIntrinsicWidth() / 2) * 0.9285f)), (int) (this.rectF.centerY() + ((drawable2.getIntrinsicHeight() / 2) * 0.9285f)));
drawable2.setBounds(rect);
drawable2.setAlpha((int) (clamp * 255.0f));
drawable2.draw(canvas);
} else {
f11 = f16;
}
if (f5 != 1.0f) {
canvas.drawCircle(centerX, f10, AndroidUtilities.dpf2(2.0f) * f21, this.lockBackgroundPaint);
}
canvas.restore();
canvas.restore();
float lerp3 = AndroidUtilities.lerp(f19, getMeasuredHeight() - AndroidUtilities.dp(118.0f), Math.max(ChatActivityEnterView.this.exitTransition, Math.min(f20, ChatActivityEnterView.this.slideToCancelLockProgress))) + dpf23 + (AndroidUtilities.dp(38.0f) * f12);
this.rectF.set(f11 - AndroidUtilities.dpf2(18.0f), lerp3, f11 + AndroidUtilities.dpf2(18.0f), lerp3 + f9);
ChatActivityEnterView chatActivityEnterView3 = ChatActivityEnterView.this;
chatActivityEnterView3.onceVisible = chatActivityEnterView3.delegate != null && ChatActivityEnterView.this.delegate.onceVoiceAvailable();
if (ChatActivityEnterView.this.onceVisible) {
float dpf27 = AndroidUtilities.dpf2(12.0f);
RectF rectF4 = this.rectF;
float f24 = rectF4.left;
float dpf28 = (rectF4.top - AndroidUtilities.dpf2(36.0f)) - dpf27;
RectF rectF5 = this.rectF;
rectF4.set(f24, dpf28, rectF5.right, rectF5.top - dpf27);
HintView2 hintView2 = this.hintView;
if (hintView2 != null) {
hintView2.setJointPx(0.0f, this.rectF.centerY());
this.hintView.invalidate();
}
this.onceRect.set(this.rectF);
canvas.save();
float f25 = ChatActivityEnterView.this.controlsScale * (1.0f - ChatActivityEnterView.this.exitTransition) * ChatActivityEnterView.this.slideToCancelLockProgress * ChatActivityEnterView.this.snapAnimationProgress;
canvas.scale(f25, f25, this.rectF.centerX(), this.rectF.centerY());
ChatActivityEnterView.this.lockShadowDrawable.setBounds((int) (this.rectF.left - AndroidUtilities.dpf2(3.0f)), (int) (this.rectF.top - AndroidUtilities.dpf2(3.0f)), (int) (this.rectF.right + AndroidUtilities.dpf2(3.0f)), (int) (this.rectF.bottom + AndroidUtilities.dpf2(3.0f)));
ChatActivityEnterView.this.lockShadowDrawable.draw(canvas);
canvas.drawRoundRect(this.rectF, AndroidUtilities.dpf2(18.0f), AndroidUtilities.dpf2(18.0f), this.lockBackgroundPaint);
CaptionContainerView.PeriodDrawable periodDrawable = this.periodDrawable;
RectF rectF6 = this.rectF;
periodDrawable.setBounds((int) rectF6.left, (int) rectF6.top, (int) rectF6.right, (int) rectF6.bottom);
this.periodDrawable.draw(canvas);
canvas.restore();
}
}
@Override
public boolean dispatchHoverEvent(MotionEvent event) {
return super.dispatchHoverEvent(event) || this.virtualViewHelper.dispatchHoverEvent(event);
}
public void updateColors() {
CaptionContainerView.PeriodDrawable periodDrawable = this.periodDrawable;
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
int i = Theme.key_chat_messagePanelVoiceLock;
periodDrawable.updateColors(chatActivityEnterView.getThemedColor(i), ChatActivityEnterView.this.getThemedColor(Theme.key_chat_messagePanelVoiceBackground), -1);
Paint paint = this.lockBackgroundPaint;
ChatActivityEnterView chatActivityEnterView2 = ChatActivityEnterView.this;
int i2 = Theme.key_chat_messagePanelVoiceLockBackground;
paint.setColor(chatActivityEnterView2.getThemedColor(i2));
this.tooltipPaint.setColor(ChatActivityEnterView.this.getThemedColor(Theme.key_chat_gifSaveHintText));
int dp = AndroidUtilities.dp(5.0f);
ChatActivityEnterView chatActivityEnterView3 = ChatActivityEnterView.this;
int i3 = Theme.key_chat_gifSaveHintBackground;
this.tooltipBackground = Theme.createRoundRectDrawable(dp, chatActivityEnterView3.getThemedColor(i3));
this.tooltipBackgroundArrow.setColorFilter(new PorterDuffColorFilter(ChatActivityEnterView.this.getThemedColor(i3), PorterDuff.Mode.SRC_IN));
this.lockBackgroundPaint.setColor(ChatActivityEnterView.this.getThemedColor(i2));
this.lockPaint.setColor(ChatActivityEnterView.this.getThemedColor(i));
this.lockOutlinePaint.setColor(ChatActivityEnterView.this.getThemedColor(i));
this.micDrawable.setColorFilter(new PorterDuffColorFilter(ChatActivityEnterView.this.getThemedColor(i), PorterDuff.Mode.SRC_IN));
this.vidDrawable.setColorFilter(new PorterDuffColorFilter(ChatActivityEnterView.this.getThemedColor(i), PorterDuff.Mode.SRC_IN));
}
public final void scale(RectF rect, float s) {
float centerX = rect.centerX();
float centerY = rect.centerY();
rect.left = AndroidUtilities.lerp(centerX, rect.left, s);
rect.right = AndroidUtilities.lerp(centerX, rect.right, s);
rect.top = AndroidUtilities.lerp(centerY, rect.top, s);
rect.bottom = AndroidUtilities.lerp(centerY, rect.bottom, s);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
int x = (int) event.getX();
int y = (int) event.getY();
if (event.getAction() == 0) {
if (ChatActivityEnterView.this.sendButtonVisible) {
this.pausePressed = ChatActivityEnterView.this.pauseRect.contains(x, y);
}
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
if (chatActivityEnterView.onceVisible && chatActivityEnterView.recordCircle != null && ChatActivityEnterView.this.snapAnimationProgress > 0.1f) {
this.oncePressed = this.onceRect.contains(x, y);
}
} else if (event.getAction() == 1) {
if (this.pausePressed && ChatActivityEnterView.this.pauseRect.contains(x, y)) {
if (ChatActivityEnterView.this.isInVideoMode()) {
if (ChatActivityEnterView.this.slideText != null) {
ChatActivityEnterView.this.slideText.setEnabled(false);
}
ChatActivityEnterView.this.delegate.toggleVideoRecordingPause();
} else {
if (ChatActivityEnterView.this.sendButtonVisible) {
ChatActivityEnterView.this.calledRecordRunnable = true;
}
MediaController.getInstance().toggleRecordingPause(ChatActivityEnterView.this.voiceOnce);
ChatActivityEnterView.this.delegate.needStartRecordAudio(0);
if (ChatActivityEnterView.this.slideText != null) {
ChatActivityEnterView.this.slideText.setEnabled(false);
}
}
this.oncePressed = false;
this.pausePressed = false;
return true;
}
if (this.oncePressed && this.onceRect.contains(x, y)) {
ChatActivityEnterView chatActivityEnterView2 = ChatActivityEnterView.this;
boolean z = !chatActivityEnterView2.voiceOnce;
chatActivityEnterView2.voiceOnce = z;
this.periodDrawable.setValue(1, z, true);
MediaDataController.getInstance(ChatActivityEnterView.this.currentAccount).toggleDraftVoiceOnce(ChatActivityEnterView.this.dialog_id, (ChatActivityEnterView.this.parentFragment == null || !ChatActivityEnterView.this.parentFragment.isTopic) ? 0L : ChatActivityEnterView.this.parentFragment.getTopicId(), ChatActivityEnterView.this.voiceOnce);
if (ChatActivityEnterView.this.voiceOnce) {
showHintView();
} else {
hideHintView();
}
invalidate();
this.oncePressed = false;
this.pausePressed = false;
return true;
}
this.oncePressed = false;
this.pausePressed = false;
} else if (event.getAction() == 3) {
this.oncePressed = false;
this.pausePressed = false;
}
return this.pausePressed || this.oncePressed;
}
@Override
public boolean verifyDrawable(Drawable who) {
return who == this.periodDrawable || super.verifyDrawable(who);
}
public class VirtualViewHelper extends ExploreByTouchHelper {
public boolean onPerformActionForVirtualView(int id, int action, Bundle args) {
return true;
}
public VirtualViewHelper(View host) {
super(host);
}
public int getVirtualViewAt(float x, float y) {
if (ChatActivityEnterView.this.sendButtonVisible && ChatActivityEnterView.this.recordCircle != null && ChatActivityEnterView.this.pauseRect.contains(x, y)) {
return 2;
}
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
return (!chatActivityEnterView.onceVisible || chatActivityEnterView.recordCircle == null || ChatActivityEnterView.this.snapAnimationProgress <= 0.1f || !ControlsView.this.onceRect.contains(x, y)) ? -1 : 4;
}
public void getVisibleVirtualViews(List<Integer> list) {
if (ChatActivityEnterView.this.sendButtonVisible) {
list.add(2);
}
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
if (!chatActivityEnterView.onceVisible || chatActivityEnterView.recordCircle == null || ChatActivityEnterView.this.snapAnimationProgress <= 0.1f) {
return;
}
list.add(4);
}
public void onPopulateNodeForVirtualView(int id, AccessibilityNodeInfoCompat info) {
if (id == 2) {
ChatActivityEnterView.this.rect.set((int) ChatActivityEnterView.this.pauseRect.left, (int) ChatActivityEnterView.this.pauseRect.top, (int) ChatActivityEnterView.this.pauseRect.right, (int) ChatActivityEnterView.this.pauseRect.bottom);
info.setBoundsInParent(ChatActivityEnterView.this.rect);
info.setText(LocaleController.getString(ChatActivityEnterView.this.transformToSeekbar > 0.5f ? R.string.AccActionResume : R.string.AccActionPause));
} else if (id == 4) {
android.graphics.Rect rect = ChatActivityEnterView.this.rect;
RectF rectF = ControlsView.this.onceRect;
rect.set((int) rectF.left, (int) rectF.top, (int) rectF.right, (int) rectF.bottom);
info.setBoundsInParent(ChatActivityEnterView.this.rect);
info.setText(LocaleController.getString(ChatActivityEnterView.this.voiceOnce ? R.string.AccActionOnceDeactivate : R.string.AccActionOnceActivate));
}
}
}
}
@Keep
public float getExitTransition() {
return this.exitTransition;
}
@Keep
public void setExitTransition(float value) {
this.exitTransition = value;
RecordCircle recordCircle = this.recordCircle;
if (recordCircle != null) {
recordCircle.invalidate();
}
}
@Keep
public float getSlideToCancelProgress() {
return this.slideToCancelProgress;
}
@Keep
public void setSlideToCancelProgress(float value) {
this.slideToCancelProgress = value;
float measuredWidth = getMeasuredWidth() * 0.35f;
if (measuredWidth > AndroidUtilities.dp(140.0f)) {
measuredWidth = AndroidUtilities.dp(140.0f);
}
this.slideDelta = (int) ((-measuredWidth) * (1.0f - this.slideToCancelProgress));
RecordCircle recordCircle = this.recordCircle;
if (recordCircle != null) {
recordCircle.invalidate();
}
}
@Keep
public float getLockAnimatedTranslation() {
return this.lockAnimatedTranslation;
}
@Keep
public void setLockAnimatedTranslation(float value) {
this.lockAnimatedTranslation = value;
RecordCircle recordCircle = this.recordCircle;
if (recordCircle != null) {
recordCircle.invalidate();
}
}
@Keep
public void setSnapAnimationProgress(float value) {
this.snapAnimationProgress = value;
invalidate();
}
public boolean seekbarVisible() {
return !this.recordIsCanceled && this.transformToSeekbar > 0.0f;
}
public class RecordCircle extends View {
public float amplitude;
public float animateAmplitudeDiff;
public float animateToAmplitude;
public BlobDrawable bigWaveDrawable;
public float circleRadius;
public float circleRadiusAmplitude;
public float drawingCircleRadius;
public float drawingCx;
public float drawingCy;
public boolean incIdle;
public float lastMovingX;
public float lastMovingY;
public long lastUpdateTime;
public int paintAlpha;
public float progressToSeekbarStep3;
public float progressToSendButton;
public RectF rectF;
public boolean showWaves;
public boolean skipDraw;
public BlobDrawable tinyWaveDrawable;
public float touchSlop;
public VirtualViewHelper virtualViewHelper;
public boolean voiceEnterTransitionInProgress;
public float wavesEnterAnimation;
@Override
public void setTranslationY(float translationY) {
super.setTranslationY(translationY);
}
public RecordCircle(Context context) {
super(context);
this.tinyWaveDrawable = new BlobDrawable(11, LiteMode.FLAGS_CHAT);
this.bigWaveDrawable = new BlobDrawable(12, LiteMode.FLAGS_CHAT);
this.circleRadius = AndroidUtilities.dpf2(41.0f);
this.circleRadiusAmplitude = AndroidUtilities.dp(30.0f);
this.rectF = new RectF();
this.wavesEnterAnimation = 0.0f;
this.showWaves = true;
VirtualViewHelper virtualViewHelper = new VirtualViewHelper(this);
this.virtualViewHelper = virtualViewHelper;
ViewCompat.setAccessibilityDelegate(this, virtualViewHelper);
this.tinyWaveDrawable.minRadius = AndroidUtilities.dp(47.0f);
this.tinyWaveDrawable.maxRadius = AndroidUtilities.dp(55.0f);
this.tinyWaveDrawable.generateBlob();
this.bigWaveDrawable.minRadius = AndroidUtilities.dp(47.0f);
this.bigWaveDrawable.maxRadius = AndroidUtilities.dp(55.0f);
this.bigWaveDrawable.generateBlob();
float scaledTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
this.touchSlop = scaledTouchSlop;
this.touchSlop = scaledTouchSlop * scaledTouchSlop;
updateColors();
}
public final void checkDrawables() {
if (ChatActivityEnterView.this.micDrawable != null) {
return;
}
ChatActivityEnterView.this.micDrawable = getResources().getDrawable(R.drawable.input_mic_pressed).mutate();
Drawable drawable = ChatActivityEnterView.this.micDrawable;
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
int i = Theme.key_chat_messagePanelVoicePressed;
drawable.setColorFilter(new PorterDuffColorFilter(chatActivityEnterView.getThemedColor(i), PorterDuff.Mode.MULTIPLY));
ChatActivityEnterView.this.cameraDrawable = getResources().getDrawable(R.drawable.input_video_pressed).mutate();
ChatActivityEnterView.this.cameraDrawable.setColorFilter(new PorterDuffColorFilter(ChatActivityEnterView.this.getThemedColor(i), PorterDuff.Mode.MULTIPLY));
ChatActivityEnterView.this.sendDrawable = getResources().getDrawable(R.drawable.attach_send).mutate();
ChatActivityEnterView.this.sendDrawable.setColorFilter(new PorterDuffColorFilter(ChatActivityEnterView.this.getThemedColor(i), PorterDuff.Mode.MULTIPLY));
ChatActivityEnterView.this.micOutline = getResources().getDrawable(R.drawable.input_mic).mutate();
Drawable drawable2 = ChatActivityEnterView.this.micOutline;
ChatActivityEnterView chatActivityEnterView2 = ChatActivityEnterView.this;
int i2 = Theme.key_chat_messagePanelIcons;
drawable2.setColorFilter(new PorterDuffColorFilter(chatActivityEnterView2.getThemedColor(i2), PorterDuff.Mode.MULTIPLY));
ChatActivityEnterView.this.cameraOutline = getResources().getDrawable(R.drawable.input_video).mutate();
ChatActivityEnterView.this.cameraOutline.setColorFilter(new PorterDuffColorFilter(ChatActivityEnterView.this.getThemedColor(i2), PorterDuff.Mode.MULTIPLY));
}
public void setAmplitude(double value) {
this.bigWaveDrawable.setValue((float) (Math.min(1800.0d, value) / 1800.0d), true);
this.tinyWaveDrawable.setValue((float) (Math.min(1800.0d, value) / 1800.0d), false);
float min = (float) (Math.min(1800.0d, value) / 1800.0d);
this.animateToAmplitude = min;
this.animateAmplitudeDiff = (min - this.amplitude) / 375.0f;
invalidate();
}
public float getScale() {
return ChatActivityEnterView.this.scale;
}
@Keep
public void setScale(float value) {
ChatActivityEnterView.this.scale = value;
invalidate();
}
public float getControlsScale() {
return ChatActivityEnterView.this.controlsScale;
}
@Keep
public void setControlsScale(float value) {
ChatActivityEnterView.this.controlsScale = value;
ControlsView controlsView = ChatActivityEnterView.this.controlsView;
if (controlsView != null) {
controlsView.invalidate();
}
}
public boolean isSendButtonVisible() {
return ChatActivityEnterView.this.sendButtonVisible;
}
public void setSendButtonInvisible() {
ChatActivityEnterView.this.sendButtonVisible = false;
invalidate();
ControlsView controlsView = ChatActivityEnterView.this.controlsView;
if (controlsView != null) {
controlsView.invalidate();
}
}
public void resetLockTranslation(boolean toLock) {
if (!toLock) {
ChatActivityEnterView.this.sendButtonVisible = false;
ChatActivityEnterView.this.lockAnimatedTranslation = -1.0f;
ChatActivityEnterView.this.startTranslation = -1.0f;
ChatActivityEnterView.this.slideToCancelProgress = 1.0f;
ChatActivityEnterView.this.slideToCancelLockProgress = 1.0f;
ChatActivityEnterView.this.snapAnimationProgress = 0.0f;
ChatActivityEnterView.this.controlsScale = 0.0f;
}
invalidate();
ChatActivityEnterView.this.transformToSeekbar = 0.0f;
ChatActivityEnterView.this.isRecordingStateChanged();
ChatActivityEnterView.this.exitTransition = 0.0f;
ChatActivityEnterView.this.scale = 0.0f;
ChatActivityEnterView.this.tooltipAlpha = 0.0f;
ChatActivityEnterView.this.showTooltip = false;
this.progressToSendButton = 0.0f;
ChatActivityEnterView.this.canceledByGesture = false;
ControlsView controlsView = ChatActivityEnterView.this.controlsView;
if (controlsView != null) {
controlsView.invalidate();
}
}
public int setLockTranslation(float value) {
if (ChatActivityEnterView.this.sendButtonVisible) {
return 2;
}
if (ChatActivityEnterView.this.lockAnimatedTranslation == -1.0f) {
ChatActivityEnterView.this.startTranslation = value;
}
ChatActivityEnterView.this.lockAnimatedTranslation = value;
invalidate();
if (ChatActivityEnterView.this.canceledByGesture || ChatActivityEnterView.this.slideToCancelProgress < 0.7f || ChatActivityEnterView.this.startTranslation - ChatActivityEnterView.this.lockAnimatedTranslation < AndroidUtilities.dp(57.0f)) {
return 1;
}
ChatActivityEnterView.this.sendButtonVisible = true;
return 2;
}
@Override
@SuppressLint({"DrawAllocation"})
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
View.MeasureSpec.getSize(widthMeasureSpec);
super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(194.0f), 1073741824));
float measuredWidth = getMeasuredWidth() * 0.35f;
if (measuredWidth > AndroidUtilities.dp(140.0f)) {
measuredWidth = AndroidUtilities.dp(140.0f);
}
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
chatActivityEnterView.slideDelta = (int) ((-measuredWidth) * (1.0f - chatActivityEnterView.slideToCancelProgress));
}
@Override
public void onDraw(android.graphics.Canvas r26) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.Components.ChatActivityEnterView.RecordCircle.onDraw(android.graphics.Canvas):void");
}
@Override
public void invalidate() {
super.invalidate();
ControlsView controlsView = ChatActivityEnterView.this.controlsView;
if (controlsView != null) {
controlsView.invalidate();
}
}
public void drawIcon(Canvas canvas, int cx, int cy, float alpha) {
Drawable drawable;
checkDrawables();
Drawable drawable2 = null;
if (isSendButtonVisible()) {
if (this.progressToSendButton != 1.0f) {
drawable2 = ChatActivityEnterView.this.isInVideoMode() ? ChatActivityEnterView.this.cameraDrawable : ChatActivityEnterView.this.micDrawable;
}
drawable = ChatActivityEnterView.this.sendDrawable;
} else {
drawable = ChatActivityEnterView.this.isInVideoMode() ? ChatActivityEnterView.this.cameraDrawable : ChatActivityEnterView.this.micDrawable;
}
Drawable drawable3 = drawable;
Drawable drawable4 = drawable2;
ChatActivityEnterView.this.sendRect.set(cx - (drawable3.getIntrinsicWidth() / 2), cy - (drawable3.getIntrinsicHeight() / 2), (drawable3.getIntrinsicWidth() / 2) + cx, (drawable3.getIntrinsicHeight() / 2) + cy);
drawable3.setBounds(ChatActivityEnterView.this.sendRect);
if (drawable4 != null) {
drawable4.setBounds(cx - (drawable4.getIntrinsicWidth() / 2), cy - (drawable4.getIntrinsicHeight() / 2), cx + (drawable4.getIntrinsicWidth() / 2), cy + (drawable4.getIntrinsicHeight() / 2));
}
drawIconInternal(canvas, drawable3, drawable4, this.progressToSendButton, (int) (alpha * 255.0f));
}
public final void drawIconInternal(Canvas canvas, Drawable drawable, Drawable replaceDrawable, float progressToSendButton, int alpha) {
checkDrawables();
if (progressToSendButton == 0.0f || progressToSendButton == 1.0f || replaceDrawable == null) {
if (ChatActivityEnterView.this.canceledByGesture && ChatActivityEnterView.this.slideToCancelProgress == 1.0f) {
ChatActivityEnterView.this.audioVideoSendButton.setAlpha(1.0f);
setVisibility(8);
return;
}
if (ChatActivityEnterView.this.canceledByGesture && ChatActivityEnterView.this.slideToCancelProgress < 1.0f) {
Drawable drawable2 = ChatActivityEnterView.this.isInVideoMode() ? ChatActivityEnterView.this.cameraOutline : ChatActivityEnterView.this.micOutline;
drawable2.setBounds(drawable.getBounds());
int i = (int) (ChatActivityEnterView.this.slideToCancelProgress >= 0.93f ? ((ChatActivityEnterView.this.slideToCancelProgress - 0.93f) / 0.07f) * 255.0f : 0.0f);
drawable2.setAlpha(i);
drawable2.draw(canvas);
drawable2.setAlpha(255);
drawable.setAlpha(255 - i);
drawable.draw(canvas);
return;
}
if (ChatActivityEnterView.this.canceledByGesture) {
return;
}
drawable.setAlpha(alpha);
drawable.draw(canvas);
return;
}
canvas.save();
canvas.scale(progressToSendButton, progressToSendButton, drawable.getBounds().centerX(), drawable.getBounds().centerY());
float f = alpha;
drawable.setAlpha((int) (f * progressToSendButton));
drawable.draw(canvas);
canvas.restore();
canvas.save();
float f2 = 1.0f - progressToSendButton;
canvas.scale(f2, f2, drawable.getBounds().centerX(), drawable.getBounds().centerY());
replaceDrawable.setAlpha((int) (f * f2));
replaceDrawable.draw(canvas);
canvas.restore();
}
@Override
public boolean dispatchHoverEvent(MotionEvent event) {
return super.dispatchHoverEvent(event) || this.virtualViewHelper.dispatchHoverEvent(event);
}
public void setTransformToSeekbar(float value) {
ChatActivityEnterView.this.transformToSeekbar = value;
invalidate();
}
public float getTransformToSeekbarProgressStep3() {
return this.progressToSeekbarStep3;
}
public void updateColors() {
Paint paint = ChatActivityEnterView.this.paint;
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
int i = Theme.key_chat_messagePanelVoiceBackground;
paint.setColor(chatActivityEnterView.getThemedColor(i));
this.tinyWaveDrawable.paint.setColor(ColorUtils.setAlphaComponent(ChatActivityEnterView.this.getThemedColor(i), 38));
this.bigWaveDrawable.paint.setColor(ColorUtils.setAlphaComponent(ChatActivityEnterView.this.getThemedColor(i), 76));
this.paintAlpha = ChatActivityEnterView.this.paint.getAlpha();
}
public void canceledByGesture() {
ChatActivityEnterView.this.canceledByGesture = true;
}
public void setMovingCords(float x, float y) {
float f = this.lastMovingX;
float f2 = (x - f) * (x - f);
float f3 = this.lastMovingY;
float f4 = f2 + ((y - f3) * (y - f3));
this.lastMovingY = y;
this.lastMovingX = x;
if (ChatActivityEnterView.this.showTooltip && ChatActivityEnterView.this.tooltipAlpha == 0.0f && f4 > this.touchSlop) {
ChatActivityEnterView.this.showTooltipStartTime = System.currentTimeMillis();
}
}
public void showWaves(boolean b, boolean animated) {
if (!animated) {
this.wavesEnterAnimation = b ? 1.0f : 0.5f;
}
this.showWaves = b;
}
public void drawWaves(Canvas canvas, float cx, float cy, float additionalScale) {
float interpolation = CubicBezierInterpolator.EASE_OUT.getInterpolation(this.wavesEnterAnimation);
float f = ChatActivityEnterView.this.slideToCancelProgress > 0.7f ? 1.0f : ChatActivityEnterView.this.slideToCancelProgress / 0.7f;
canvas.save();
float f2 = ChatActivityEnterView.this.scale * f * interpolation * (BlobDrawable.SCALE_BIG_MIN + (this.bigWaveDrawable.amplitude * 1.4f)) * additionalScale;
canvas.scale(f2, f2, cx, cy);
BlobDrawable blobDrawable = this.bigWaveDrawable;
blobDrawable.draw(cx, cy, canvas, blobDrawable.paint);
canvas.restore();
float f3 = ChatActivityEnterView.this.scale * f * interpolation * (BlobDrawable.SCALE_SMALL_MIN + (this.tinyWaveDrawable.amplitude * 1.4f)) * additionalScale;
canvas.save();
canvas.scale(f3, f3, cx, cy);
BlobDrawable blobDrawable2 = this.tinyWaveDrawable;
blobDrawable2.draw(cx, cy, canvas, blobDrawable2.paint);
canvas.restore();
}
public class VirtualViewHelper extends ExploreByTouchHelper {
public int[] coords;
public boolean onPerformActionForVirtualView(int id, int action, Bundle args) {
return true;
}
public VirtualViewHelper(View host) {
super(host);
this.coords = new int[2];
}
public int getVirtualViewAt(float x, float y) {
if (!RecordCircle.this.isSendButtonVisible() || ChatActivityEnterView.this.recordCircle == null) {
return -1;
}
if (ChatActivityEnterView.this.sendRect.contains((int) x, (int) y)) {
return 1;
}
if (ChatActivityEnterView.this.pauseRect.contains(x, y)) {
return 2;
}
if (ChatActivityEnterView.this.slideText == null || ChatActivityEnterView.this.slideText.cancelRect == null) {
return -1;
}
RectF rectF = AndroidUtilities.rectTmp;
rectF.set(ChatActivityEnterView.this.slideText.cancelRect);
ChatActivityEnterView.this.slideText.getLocationOnScreen(this.coords);
int[] iArr = this.coords;
rectF.offset(iArr[0], iArr[1]);
ChatActivityEnterView.this.recordCircle.getLocationOnScreen(this.coords);
int[] iArr2 = this.coords;
rectF.offset(-iArr2[0], -iArr2[1]);
return rectF.contains(x, y) ? 3 : -1;
}
public void getVisibleVirtualViews(List<Integer> list) {
if (RecordCircle.this.isSendButtonVisible()) {
list.add(1);
list.add(3);
}
}
public void onPopulateNodeForVirtualView(int id, AccessibilityNodeInfoCompat info) {
if (id == 1) {
info.setBoundsInParent(ChatActivityEnterView.this.sendRect);
info.setText(LocaleController.getString("Send", R.string.Send));
return;
}
if (id == 2) {
ChatActivityEnterView.this.rect.set((int) ChatActivityEnterView.this.pauseRect.left, (int) ChatActivityEnterView.this.pauseRect.top, (int) ChatActivityEnterView.this.pauseRect.right, (int) ChatActivityEnterView.this.pauseRect.bottom);
info.setBoundsInParent(ChatActivityEnterView.this.rect);
info.setText(LocaleController.getString(R.string.Stop));
return;
}
if (id != 3 || ChatActivityEnterView.this.recordCircle == null) {
return;
}
if (ChatActivityEnterView.this.slideText != null && ChatActivityEnterView.this.slideText.cancelRect != null) {
android.graphics.Rect rect = AndroidUtilities.rectTmp2;
rect.set(ChatActivityEnterView.this.slideText.cancelRect);
ChatActivityEnterView.this.slideText.getLocationOnScreen(this.coords);
int[] iArr = this.coords;
rect.offset(iArr[0], iArr[1]);
ChatActivityEnterView.this.recordCircle.getLocationOnScreen(this.coords);
int[] iArr2 = this.coords;
rect.offset(-iArr2[0], -iArr2[1]);
info.setBoundsInParent(rect);
}
info.setText(LocaleController.getString("Cancel", R.string.Cancel));
}
}
}
public ChatActivityEnterView(Activity context, SizeNotifierFrameLayout parent, ChatActivity fragment, final boolean isChat) {
this(context, parent, fragment, isChat, null);
}
@SuppressLint({"ClickableViewAccessibility"})
public ChatActivityEnterView(final Activity context, SizeNotifierFrameLayout parent, final ChatActivity fragment, final boolean isChat, Theme.ResourcesProvider resourcesProvider) {
super(context, fragment == null ? null : fragment.contentView);
int i;
String str;
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate;
Class<Float> cls = Float.class;
this.emojiButtonScale = 1.0f;
this.emojiButtonAlpha = 1.0f;
this.emojiButtonPaddingScale = 1.0f;
this.emojiButtonPaddingAlpha = 1.0f;
this.attachLayoutAlpha = 1.0f;
this.attachLayoutPaddingAlpha = 1.0f;
this.horizontalPadding = 0.0f;
this.sendButtonEnabled = true;
int i2 = UserConfig.selectedAccount;
this.currentAccount = i2;
this.accountInstance = AccountInstance.getInstance(i2);
this.lineCount = 1;
this.currentLimit = -1;
this.botMenuButtonType = BotMenuButtonType.NO_BUTTON;
this.sendRoundEnabled = true;
this.sendVoiceEnabled = true;
this.sendPlainEnabled = true;
this.animationParamsX = new HashMap<>();
new View.AccessibilityDelegate(this) {
@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(host, info);
info.setClassName("android.widget.ImageButton");
info.setClickable(true);
info.setLongClickable(true);
}
};
this.currentPopupContentType = -1;
this.isPaused = true;
this.startedDraggingX = -1.0f;
this.distCanMove = AndroidUtilities.dp(80.0f);
this.location = new int[2];
this.messageWebPageSearch = true;
this.animatingContentType = -1;
this.doneButtonEnabledProgress = 1.0f;
this.doneButtonEnabled = true;
this.openKeyboardRunnable = new Runnable() {
@Override
public void run() {
if ((ChatActivityEnterView.this.hasBotWebView() && ChatActivityEnterView.this.botCommandsMenuIsShowing()) || ChatActivityEnterView.this.destroyed) {
return;
}
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
if (chatActivityEnterView.messageEditText == null || !chatActivityEnterView.waitingForKeyboardOpen || ChatActivityEnterView.this.keyboardVisible || AndroidUtilities.usingHardwareInput || AndroidUtilities.isInMultiwindow) {
return;
}
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterView.this.delegate.onKeyboardRequested();
}
ChatActivityEnterView.this.messageEditText.requestFocus();
AndroidUtilities.showKeyboard(ChatActivityEnterView.this.messageEditText);
AndroidUtilities.cancelRunOnUIThread(ChatActivityEnterView.this.openKeyboardRunnable);
AndroidUtilities.runOnUIThread(ChatActivityEnterView.this.openKeyboardRunnable, 100L);
}
};
this.updateExpandabilityRunnable = new Runnable() {
public int lastKnownPage = -1;
@Override
public void run() {
int currentPage;
if (ChatActivityEnterView.this.emojiView == null || (currentPage = ChatActivityEnterView.this.emojiView.getCurrentPage()) == this.lastKnownPage) {
return;
}
this.lastKnownPage = currentPage;
boolean z = ChatActivityEnterView.this.stickersTabOpen;
ChatActivityEnterView.this.stickersTabOpen = currentPage == 1 || currentPage == 2;
boolean z2 = ChatActivityEnterView.this.emojiTabOpen;
ChatActivityEnterView.this.emojiTabOpen = currentPage == 0;
if (ChatActivityEnterView.this.stickersExpanded) {
if (ChatActivityEnterView.this.searchingType != 0) {
ChatActivityEnterView.this.setSearchingTypeInternal(currentPage != 0 ? 1 : 2, true);
ChatActivityEnterView.this.checkStickresExpandHeight();
} else if (!ChatActivityEnterView.this.stickersTabOpen) {
ChatActivityEnterView.this.setStickersExpanded(false, true, false);
}
}
if (z == ChatActivityEnterView.this.stickersTabOpen && z2 == ChatActivityEnterView.this.emojiTabOpen) {
return;
}
ChatActivityEnterView.this.checkSendButton(true);
}
};
this.roundedTranslationYProperty = new Property<View, Integer>(this, Integer.class, "translationY") {
@Override
public Integer get(View object) {
return Integer.valueOf(Math.round(object.getTranslationY()));
}
@Override
public void set(View object, Integer value) {
object.setTranslationY(value.intValue());
}
};
this.recordCircleScale = new Property<RecordCircle, Float>(this, cls, "scale") {
@Override
public Float get(RecordCircle object) {
return Float.valueOf(object.getScale());
}
@Override
public void set(RecordCircle object, Float value) {
object.setScale(value.floatValue());
}
};
this.recordControlsCircleScale = new Property<RecordCircle, Float>(this, cls, "controlsScale") {
@Override
public Float get(RecordCircle object) {
return Float.valueOf(object.getControlsScale());
}
@Override
public void set(RecordCircle object, Float value) {
object.setControlsScale(value.floatValue());
}
};
this.redDotPaint = new Paint(1);
this.onFinishInitCameraRunnable = new Runnable() {
@Override
public void run() {
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterView.this.delegate.needStartRecordVideo(0, true, 0, 0, 0L);
}
}
};
this.recordAudioVideoRunnable = new Runnable() {
@Override
public void run() {
if (ChatActivityEnterView.this.delegate == null || ChatActivityEnterView.this.parentActivity == null) {
return;
}
ChatActivityEnterView.this.delegate.onPreAudioVideoRecord();
ChatActivityEnterView.this.calledRecordRunnable = true;
ChatActivityEnterView.this.recordAudioVideoRunnableStarted = false;
if (ChatActivityEnterView.this.slideText != null) {
ChatActivityEnterView.this.slideText.setAlpha(1.0f);
ChatActivityEnterView.this.slideText.setTranslationY(0.0f);
}
ChatActivityEnterView.this.audioToSendPath = null;
ChatActivityEnterView.this.audioToSend = null;
if (ChatActivityEnterView.this.isInVideoMode()) {
if (Build.VERSION.SDK_INT >= 23) {
boolean z = ChatActivityEnterView.this.parentActivity.checkSelfPermission("android.permission.RECORD_AUDIO") == 0;
boolean z2 = ChatActivityEnterView.this.parentActivity.checkSelfPermission("android.permission.CAMERA") == 0;
if (!z || !z2) {
String[] strArr = new String[(z || z2) ? 1 : 2];
if (!z && !z2) {
strArr[0] = "android.permission.RECORD_AUDIO";
strArr[1] = "android.permission.CAMERA";
} else if (!z) {
strArr[0] = "android.permission.RECORD_AUDIO";
} else {
strArr[0] = "android.permission.CAMERA";
}
ChatActivityEnterView.this.parentActivity.requestPermissions(strArr, ImageReceiver.DEFAULT_CROSSFADE_DURATION);
return;
}
}
if (!CameraController.getInstance().isCameraInitied()) {
CameraController.getInstance().initCamera(ChatActivityEnterView.this.onFinishInitCameraRunnable);
} else {
ChatActivityEnterView.this.onFinishInitCameraRunnable.run();
}
if (ChatActivityEnterView.this.recordingAudioVideo) {
return;
}
ChatActivityEnterView.this.recordingAudioVideo = true;
ChatActivityEnterView.this.updateRecordInterface(0, true);
if (ChatActivityEnterView.this.recordCircle != null) {
ChatActivityEnterView.this.recordCircle.showWaves(false, false);
}
if (ChatActivityEnterView.this.recordTimerView != null) {
ChatActivityEnterView.this.recordTimerView.reset();
return;
}
return;
}
if (Build.VERSION.SDK_INT >= 23 && ChatActivityEnterView.this.parentActivity.checkSelfPermission("android.permission.RECORD_AUDIO") != 0) {
ChatActivityEnterView.this.parentActivity.requestPermissions(new String[]{"android.permission.RECORD_AUDIO"}, 3);
return;
}
ChatActivityEnterView.this.delegate.needStartRecordAudio(1);
ChatActivityEnterView.this.startedDraggingX = -1.0f;
TL_stories$StoryItem replyToStory = ChatActivityEnterView.this.delegate != null ? ChatActivityEnterView.this.delegate.getReplyToStory() : null;
MediaController mediaController = MediaController.getInstance();
int i3 = ChatActivityEnterView.this.currentAccount;
long j = ChatActivityEnterView.this.dialog_id;
MessageObject messageObject = ChatActivityEnterView.this.replyingMessageObject;
MessageObject threadMessage = ChatActivityEnterView.this.getThreadMessage();
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
mediaController.startRecording(i3, j, messageObject, threadMessage, replyToStory, chatActivityEnterView.recordingGuid, true, chatActivityEnterView.parentFragment != null ? ChatActivityEnterView.this.parentFragment.quickReplyShortcut : null, ChatActivityEnterView.this.parentFragment != null ? ChatActivityEnterView.this.parentFragment.getQuickReplyId() : 0);
ChatActivityEnterView.this.recordingAudioVideo = true;
ChatActivityEnterView.this.updateRecordInterface(0, true);
if (ChatActivityEnterView.this.recordTimerView != null) {
ChatActivityEnterView.this.recordTimerView.start(0L);
}
if (ChatActivityEnterView.this.recordDot != null) {
ChatActivityEnterView.this.recordDot.enterAnimation = false;
}
ChatActivityEnterView.this.audioVideoButtonContainer.getParent().requestDisallowInterceptTouchEvent(true);
if (ChatActivityEnterView.this.recordCircle != null) {
ChatActivityEnterView.this.recordCircle.showWaves(true, false);
}
}
};
this.notificationsLocker = new AnimationNotificationsLocker();
this.paint = new Paint(1);
this.pauseRect = new RectF();
this.sendRect = new android.graphics.Rect();
this.rect = new android.graphics.Rect();
this.runEmojiPanelAnimation = new Runnable() {
@Override
public void run() {
if (ChatActivityEnterView.this.panelAnimation == null || ChatActivityEnterView.this.panelAnimation.isRunning()) {
return;
}
ChatActivityEnterView.this.panelAnimation.start();
}
};
this.EMOJI_BUTTON_SCALE = new Property<View, Float>(cls, "emoji_button_scale") {
@Override
public Float get(View object) {
return Float.valueOf(ChatActivityEnterView.this.emojiButtonScale);
}
@Override
public void set(View object, Float value) {
ChatActivityEnterView.this.emojiButtonScale = value.floatValue();
ChatActivityEnterView.this.updateEmojiButtonParams();
}
};
this.ATTACH_LAYOUT_ALPHA = new Property<View, Float>(cls, "attach_scale") {
@Override
public Float get(View object) {
return Float.valueOf(ChatActivityEnterView.this.attachLayoutAlpha);
}
@Override
public void set(View object, Float value) {
ChatActivityEnterView.this.attachLayoutAlpha = value.floatValue();
ChatActivityEnterView.this.updateAttachLayoutParams();
}
};
this.EMOJI_BUTTON_ALPHA = new Property<View, Float>(cls, "emoji_button_alpha") {
@Override
public Float get(View object) {
return Float.valueOf(ChatActivityEnterView.this.emojiButtonAlpha);
}
@Override
public void set(View object, Float value) {
ChatActivityEnterView.this.emojiButtonAlpha = value.floatValue();
ChatActivityEnterView.this.updateEmojiButtonParams();
}
};
this.ATTACH_LAYOUT_TRANSLATION_X = new Property<View, Float>(cls, "attach_layout_translation_x") {
@Override
public Float get(View object) {
return Float.valueOf(ChatActivityEnterView.this.attachLayoutTranslationX);
}
@Override
public void set(View object, Float value) {
ChatActivityEnterView.this.attachLayoutTranslationX = value.floatValue();
ChatActivityEnterView.this.updateAttachLayoutParams();
}
};
this.MESSAGE_TEXT_TRANSLATION_X = new Property<View, Float>(cls, "message_text_translation_x") {
@Override
public Float get(View object) {
return Float.valueOf(ChatActivityEnterView.this.messageTextTranslationX);
}
@Override
public void set(View object, Float value) {
ChatActivityEnterView.this.messageTextTranslationX = value.floatValue();
ChatActivityEnterView.this.updateMessageTextParams();
}
};
this.allowBlur = true;
this.shouldDrawBackground = true;
this.backgroundPaint = new Paint();
this.composeShadowAlpha = 1.0f;
this.blurBounds = new android.graphics.Rect();
this.dismissSendPreview = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$new$27();
}
};
this.messageEditTextEnabled = true;
this.topViewUpdateListener = new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
ChatActivityEnterView.this.lambda$new$43(valueAnimator);
}
};
this.botCommandLastPosition = -1;
Paint paint = new Paint(1);
this.gradientPaint = paint;
LinearGradient linearGradient = new LinearGradient(0.0f, 0.0f, 0.0f, 16.0f, new int[]{-1, 16777215}, new float[]{0.0f, 1.0f}, Shader.TileMode.CLAMP);
this.clipGradient = linearGradient;
this.clipMatrix = new Matrix();
CubicBezierInterpolator cubicBezierInterpolator = CubicBezierInterpolator.EASE_OUT_QUINT;
this.topGradientAlpha = new AnimatedFloat((View) this, 0L, 280L, (TimeInterpolator) cubicBezierInterpolator);
this.bottomGradientAlpha = new AnimatedFloat((View) this, 0L, 280L, (TimeInterpolator) cubicBezierInterpolator);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
paint.setShader(linearGradient);
this.resourcesProvider = resourcesProvider;
((BlurredFrameLayout) this).backgroundColor = getThemedColor(Theme.key_chat_messagePanelBackground);
((BlurredFrameLayout) this).drawBlur = false;
this.isChat = isChat;
this.smoothKeyboard = isChat && !AndroidUtilities.isInMultiwindow && (fragment == null || !fragment.isInBubbleMode());
Paint paint2 = new Paint(1);
this.dotPaint = paint2;
paint2.setColor(getThemedColor(Theme.key_chat_emojiPanelNewTrending));
setFocusable(true);
setFocusableInTouchMode(true);
setWillNotDraw(false);
setClipChildren(false);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.recordStarted);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.recordPaused);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.recordResumed);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.recordStartError);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.recordStopped);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.recordProgressChanged);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.closeChats);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.audioDidSent);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.audioRouteChanged);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.messagePlayingDidReset);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.messagePlayingProgressDidChanged);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.featuredStickersDidLoad);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.messageReceivedByServer2);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.sendingMessagesChanged);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.audioRecordTooShort);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.updateBotMenuButton);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.didUpdatePremiumGiftFieldIcon);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiLoaded);
this.parentActivity = context;
this.parentFragment = fragment;
if (fragment != null) {
this.recordingGuid = fragment.getClassGuid();
}
this.sizeNotifierLayout = parent;
parent.setDelegate(this);
this.sendByEnter = MessagesController.getGlobalMainSettings().getBoolean("send_by_enter", false);
FrameLayout frameLayout = new FrameLayout(context) {
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (ChatActivityEnterView.this.botWebViewButton != null && ChatActivityEnterView.this.botWebViewButton.getVisibility() == 0) {
return ChatActivityEnterView.this.botWebViewButton.dispatchTouchEvent(ev);
}
return super.dispatchTouchEvent(ev);
}
};
this.textFieldContainer = frameLayout;
frameLayout.setClipChildren(false);
this.textFieldContainer.setClipToPadding(false);
this.textFieldContainer.setPadding(0, AndroidUtilities.dp(1.0f), 0, 0);
addView(this.textFieldContainer, LayoutHelper.createFrame(-1, -2.0f, 83, 0.0f, 1.0f, 0.0f, 0.0f));
AnonymousClass16 anonymousClass16 = new AnonymousClass16(context);
this.messageEditTextContainer = anonymousClass16;
anonymousClass16.setClipChildren(false);
this.textFieldContainer.addView(anonymousClass16, LayoutHelper.createFrame(-1, -2.0f, 80, 0.0f, 0.0f, 48.0f, 0.0f));
ChatActivityEnterViewAnimatedIconView chatActivityEnterViewAnimatedIconView = new ChatActivityEnterViewAnimatedIconView(context) {
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (getTag() == null || ChatActivityEnterView.this.attachLayout == null || ChatActivityEnterView.this.emojiViewVisible || MediaDataController.getInstance(ChatActivityEnterView.this.currentAccount).getUnreadStickerSets().isEmpty() || ChatActivityEnterView.this.dotPaint == null) {
return;
}
canvas.drawCircle((getWidth() / 2) + AndroidUtilities.dp(9.0f), (getHeight() / 2) - AndroidUtilities.dp(8.0f), AndroidUtilities.dp(5.0f), ChatActivityEnterView.this.dotPaint);
}
};
this.emojiButton = chatActivityEnterViewAnimatedIconView;
if (BuildVars.BETA && Build.VERSION.SDK_INT >= 19) {
chatActivityEnterViewAnimatedIconView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public final boolean onLongClick(View view) {
boolean lambda$new$0;
lambda$new$0 = ChatActivityEnterView.this.lambda$new$0(view);
return lambda$new$0;
}
});
}
this.emojiButton.setContentDescription(LocaleController.getString(R.string.AccDescrEmojiButton));
this.emojiButton.setFocusable(true);
int dp = AndroidUtilities.dp(9.5f);
this.emojiButton.setPadding(dp, dp, dp, dp);
ChatActivityEnterViewAnimatedIconView chatActivityEnterViewAnimatedIconView2 = this.emojiButton;
int i3 = Theme.key_chat_messagePanelIcons;
chatActivityEnterViewAnimatedIconView2.setColorFilter(new PorterDuffColorFilter(getThemedColor(i3), PorterDuff.Mode.SRC_IN));
int i4 = Build.VERSION.SDK_INT;
if (i4 >= 21) {
this.emojiButton.setBackground(Theme.createSelectorDrawable(getThemedColor(Theme.key_listSelector)));
}
this.emojiButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivityEnterView.this.lambda$new$2(view);
}
});
this.messageEditTextContainer.addView(this.emojiButton, LayoutHelper.createFrame(48, 48.0f, 83, 3.0f, 0.0f, 0.0f, 0.0f));
setEmojiButtonImage(false, false);
if (isChat) {
LinearLayout linearLayout = new LinearLayout(context);
this.attachLayout = linearLayout;
linearLayout.setOrientation(0);
this.attachLayout.setEnabled(false);
this.attachLayout.setPivotX(AndroidUtilities.dp(48.0f));
this.attachLayout.setClipChildren(false);
this.messageEditTextContainer.addView(this.attachLayout, LayoutHelper.createFrame(-2, 48, 85));
this.notifyButton = new ImageView(context);
CrossOutDrawable crossOutDrawable = new CrossOutDrawable(context, R.drawable.input_notify_on, i3);
this.notifySilentDrawable = crossOutDrawable;
this.notifyButton.setImageDrawable(crossOutDrawable);
this.notifySilentDrawable.setCrossOut(this.silent, false);
ImageView imageView = this.notifyButton;
if (this.silent) {
i = R.string.AccDescrChanSilentOn;
str = "AccDescrChanSilentOn";
} else {
i = R.string.AccDescrChanSilentOff;
str = "AccDescrChanSilentOff";
}
imageView.setContentDescription(LocaleController.getString(str, i));
this.notifyButton.setColorFilter(new PorterDuffColorFilter(getThemedColor(i3), PorterDuff.Mode.MULTIPLY));
this.notifyButton.setScaleType(ImageView.ScaleType.CENTER);
if (i4 >= 21) {
this.notifyButton.setBackgroundDrawable(Theme.createSelectorDrawable(getThemedColor(Theme.key_listSelector)));
}
this.notifyButton.setVisibility((!this.canWriteToChannel || ((chatActivityEnterViewDelegate = this.delegate) != null && chatActivityEnterViewDelegate.hasScheduledMessages())) ? 8 : 0);
this.attachLayout.addView(this.notifyButton, LayoutHelper.createLinear(48, 48));
this.notifyButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int i5;
String str2;
ChatActivityEnterView.this.silent = !r9.silent;
if (ChatActivityEnterView.this.notifySilentDrawable == null) {
ChatActivityEnterView.this.notifySilentDrawable = new CrossOutDrawable(context, R.drawable.input_notify_on, Theme.key_chat_messagePanelIcons);
}
ChatActivityEnterView.this.notifySilentDrawable.setCrossOut(ChatActivityEnterView.this.silent, true);
ChatActivityEnterView.this.notifyButton.setImageDrawable(ChatActivityEnterView.this.notifySilentDrawable);
MessagesController.getNotificationsSettings(ChatActivityEnterView.this.currentAccount).edit().putBoolean(NotificationsSettingsFacade.PROPERTY_SILENT + ChatActivityEnterView.this.dialog_id, ChatActivityEnterView.this.silent).commit();
NotificationsController notificationsController = NotificationsController.getInstance(ChatActivityEnterView.this.currentAccount);
long j = ChatActivityEnterView.this.dialog_id;
ChatActivity chatActivity = fragment;
notificationsController.updateServerNotificationsSettings(j, chatActivity == null ? 0L : chatActivity.getTopicId());
UndoView undoView = fragment.getUndoView();
if (undoView != null) {
undoView.showWithAction(0L, !ChatActivityEnterView.this.silent ? 54 : 55, (Runnable) null);
}
ImageView imageView2 = ChatActivityEnterView.this.notifyButton;
if (ChatActivityEnterView.this.silent) {
i5 = R.string.AccDescrChanSilentOn;
str2 = "AccDescrChanSilentOn";
} else {
i5 = R.string.AccDescrChanSilentOff;
str2 = "AccDescrChanSilentOff";
}
imageView2.setContentDescription(LocaleController.getString(str2, i5));
ChatActivityEnterView.this.updateFieldHint(true);
}
});
ImageView imageView2 = new ImageView(context);
this.attachButton = imageView2;
imageView2.setScaleType(ImageView.ScaleType.CENTER);
this.attachButton.setColorFilter(new PorterDuffColorFilter(getThemedColor(i3), PorterDuff.Mode.MULTIPLY));
this.attachButton.setImageResource(R.drawable.msg_input_attach2);
if (i4 >= 21) {
this.attachButton.setBackgroundDrawable(Theme.createSelectorDrawable(getThemedColor(Theme.key_listSelector)));
}
this.attachLayout.addView(this.attachButton, LayoutHelper.createLinear(48, 48));
this.attachButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivityEnterView.this.lambda$new$3(view);
}
});
this.attachButton.setContentDescription(LocaleController.getString("AccDescrAttachButton", R.string.AccDescrAttachButton));
}
if (this.audioToSend != null) {
createRecordAudioPanel();
}
FrameLayout frameLayout2 = new FrameLayout(context) {
@Override
public boolean drawChild(Canvas canvas, View child, long drawingTime) {
if (child == ChatActivityEnterView.this.sendButton && ChatActivityEnterView.this.textTransitionIsRunning) {
return true;
}
return super.drawChild(canvas, child, drawingTime);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (ChatActivityEnterView.this.sendButtonEnabled) {
return super.dispatchTouchEvent(ev);
}
return false;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (ChatActivityEnterView.this.sendButtonEnabled) {
return super.onTouchEvent(event);
}
return false;
}
};
this.sendButtonContainer = frameLayout2;
frameLayout2.setClipChildren(false);
this.sendButtonContainer.setClipToPadding(false);
this.textFieldContainer.addView(this.sendButtonContainer, LayoutHelper.createFrame(48, 48, 85));
AnonymousClass20 anonymousClass20 = new AnonymousClass20(context, resourcesProvider);
this.audioVideoButtonContainer = anonymousClass20;
anonymousClass20.setSoundEffectsEnabled(false);
this.sendButtonContainer.addView(this.audioVideoButtonContainer, LayoutHelper.createFrame(48, 48.0f));
this.audioVideoButtonContainer.setFocusable(true);
this.audioVideoButtonContainer.setImportantForAccessibility(1);
ChatActivityEnterViewAnimatedIconView chatActivityEnterViewAnimatedIconView3 = new ChatActivityEnterViewAnimatedIconView(context);
this.audioVideoSendButton = chatActivityEnterViewAnimatedIconView3;
chatActivityEnterViewAnimatedIconView3.setImportantForAccessibility(2);
int dp2 = AndroidUtilities.dp(9.5f);
this.audioVideoSendButton.setPadding(dp2, dp2, dp2, dp2);
this.audioVideoSendButton.setColorFilter(new PorterDuffColorFilter(getThemedColor(i3), PorterDuff.Mode.SRC_IN));
this.audioVideoButtonContainer.addView(this.audioVideoSendButton, LayoutHelper.createFrame(48, 48.0f));
ImageView imageView3 = new ImageView(context);
this.cancelBotButton = imageView3;
imageView3.setVisibility(4);
this.cancelBotButton.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
ImageView imageView4 = this.cancelBotButton;
CloseProgressDrawable2 closeProgressDrawable2 = new CloseProgressDrawable2(this) {
@Override
public int getCurrentColor() {
return Theme.getColor(Theme.key_chat_messagePanelCancelInlineBot);
}
};
this.progressDrawable = closeProgressDrawable2;
imageView4.setImageDrawable(closeProgressDrawable2);
this.cancelBotButton.setContentDescription(LocaleController.getString("Cancel", R.string.Cancel));
this.cancelBotButton.setSoundEffectsEnabled(false);
this.cancelBotButton.setScaleX(0.1f);
this.cancelBotButton.setScaleY(0.1f);
this.cancelBotButton.setAlpha(0.0f);
if (i4 >= 21) {
this.cancelBotButton.setBackgroundDrawable(Theme.createSelectorDrawable(getThemedColor(Theme.key_listSelector)));
}
this.sendButtonContainer.addView(this.cancelBotButton, LayoutHelper.createFrame(48, 48.0f));
this.cancelBotButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivityEnterView.this.lambda$new$4(view);
}
});
SendButton sendButton = new SendButton(context, isInScheduleMode() ? R.drawable.input_schedule : R.drawable.ic_send, resourcesProvider) {
@Override
public boolean isInScheduleMode() {
return ChatActivityEnterView.this.isInScheduleMode();
}
@Override
public boolean isOpen() {
MessageSendPreview messageSendPreview = ChatActivityEnterView.this.messageSendPreview;
return messageSendPreview != null && messageSendPreview.isShowing();
}
@Override
public boolean isInactive() {
return !isInScheduleMode() && ChatActivityEnterView.this.slowModeTimer == Integer.MAX_VALUE;
}
@Override
public boolean shouldDrawBackground() {
return ChatActivityEnterView.this.shouldDrawBackground;
}
};
this.sendButton = sendButton;
sendButton.setVisibility(4);
int themedColor = getThemedColor(Theme.key_chat_messagePanelSend);
this.sendButton.setContentDescription(LocaleController.getString("Send", R.string.Send));
this.sendButton.setSoundEffectsEnabled(false);
this.sendButton.setScaleX(0.1f);
this.sendButton.setScaleY(0.1f);
this.sendButton.setAlpha(0.0f);
if (i4 >= 21) {
this.sendButton.setBackground(Theme.createSelectorDrawable(ColorUtils.setAlphaComponent(themedColor, 24), 1));
}
this.sendButtonContainer.addView(this.sendButton, LayoutHelper.createFrame(48, 48.0f));
this.sendButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivityEnterView.this.lambda$new$5(view);
}
});
this.sendButton.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public final boolean onLongClick(View view) {
return ChatActivityEnterView.this.onSendLongClick(view);
}
});
SlowModeBtn slowModeBtn = new SlowModeBtn(context);
this.slowModeButton = slowModeBtn;
slowModeBtn.setTextSize(18);
this.slowModeButton.setVisibility(4);
this.slowModeButton.setSoundEffectsEnabled(false);
this.slowModeButton.setScaleX(0.1f);
this.slowModeButton.setScaleY(0.1f);
this.slowModeButton.setAlpha(0.0f);
this.slowModeButton.setPadding(0, 0, AndroidUtilities.dp(10.0f), 0);
this.slowModeButton.setGravity(21);
this.slowModeButton.setTextColor(getThemedColor(i3));
this.sendButtonContainer.addView(this.slowModeButton, LayoutHelper.createFrame(74, 48, 53));
this.slowModeButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivityEnterView.this.lambda$new$6(view);
}
});
this.slowModeButton.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public final boolean onLongClick(View view) {
boolean lambda$new$7;
lambda$new$7 = ChatActivityEnterView.this.lambda$new$7(view);
return lambda$new$7;
}
});
SharedPreferences globalEmojiSettings = MessagesController.getGlobalEmojiSettings();
this.keyboardHeight = globalEmojiSettings.getInt("kbd_height", AndroidUtilities.dp(200.0f));
this.keyboardHeightLand = globalEmojiSettings.getInt("kbd_height_land3", AndroidUtilities.dp(200.0f));
setRecordVideoButtonVisible(false, false);
checkSendButton(false);
checkChannelRights();
createMessageEditText();
}
public class AnonymousClass16 extends FrameLayout {
public AnonymousClass16(Context context) {
super(context);
}
@Override
public void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (ChatActivityEnterView.this.scheduledButton != null) {
int measuredWidth = (getMeasuredWidth() - AndroidUtilities.dp((ChatActivityEnterView.this.botButton == null || ChatActivityEnterView.this.botButton.getVisibility() != 0) ? 48.0f : 96.0f)) - AndroidUtilities.dp(48.0f);
ChatActivityEnterView.this.scheduledButton.layout(measuredWidth, ChatActivityEnterView.this.scheduledButton.getTop(), ChatActivityEnterView.this.scheduledButton.getMeasuredWidth() + measuredWidth, ChatActivityEnterView.this.scheduledButton.getBottom());
}
if (ChatActivityEnterView.this.animationParamsX.isEmpty()) {
return;
}
for (int i = 0; i < getChildCount(); i++) {
View childAt = getChildAt(i);
Float f = (Float) ChatActivityEnterView.this.animationParamsX.get(childAt);
if (f != null) {
childAt.setTranslationX(f.floatValue() - childAt.getLeft());
childAt.animate().translationX(0.0f).setDuration(150L).setInterpolator(CubicBezierInterpolator.DEFAULT).start();
}
}
ChatActivityEnterView.this.animationParamsX.clear();
}
@Override
public boolean drawChild(final Canvas canvas, final View child, final long drawingTime) {
if (child != null) {
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
if (child == chatActivityEnterView.messageEditText) {
return chatActivityEnterView.drawMessageEditText(canvas, new Utilities.Callback0Return() {
@Override
public final Object run() {
Boolean lambda$drawChild$0;
lambda$drawChild$0 = ChatActivityEnterView.AnonymousClass16.this.lambda$drawChild$0(canvas, child, drawingTime);
return lambda$drawChild$0;
}
});
}
}
ChatActivityEnterView chatActivityEnterView2 = ChatActivityEnterView.this;
if (chatActivityEnterView2.shouldDrawRecordedAudioPanelInParent && child == chatActivityEnterView2.recordedAudioPanel) {
return true;
}
return super.drawChild(canvas, child, drawingTime);
}
public Boolean lambda$drawChild$0(Canvas canvas, View view, long j) {
return Boolean.valueOf(super.drawChild(canvas, view, j));
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
return super.dispatchTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
return super.onTouchEvent(event);
}
}
public boolean lambda$new$0(View view) {
Theme.showAndroidEmoji = !Theme.showAndroidEmoji;
ApplicationLoader.applicationContext.getSharedPreferences("plusconfig", 0).edit().putBoolean("showAndroidEmoji", Theme.showAndroidEmoji).apply();
EmojiView emojiView = this.emojiView;
if (emojiView != null) {
emojiView.setVisibility(0);
}
try {
Toast toast = this.vToast;
if (toast != null) {
toast.cancel();
}
String str = LocaleController.getString("ShowAndroidEmoji", R.string.ShowAndroidEmoji) + " " + Theme.showAndroidEmoji;
if (Theme.showAndroidEmoji) {
Toast makeText = Toast.makeText(this.parentActivity, str, 0);
this.vToast = makeText;
makeText.show();
} else {
Toast makeText2 = Toast.makeText(this.parentActivity, str, 0);
this.vToast = makeText2;
makeText2.show();
}
} catch (Exception e) {
FileLog.e(e);
}
return true;
}
public void lambda$new$2(View view) {
AdjustPanLayoutHelper adjustPanLayoutHelper = this.adjustPanLayoutHelper;
if (adjustPanLayoutHelper == null || !adjustPanLayoutHelper.animationInProgress()) {
if (this.emojiButtonRestricted) {
showRestrictedHint();
return;
}
if (hasBotWebView() && botCommandsMenuIsShowing()) {
BotWebViewMenuContainer botWebViewMenuContainer = this.botWebViewMenuContainer;
if (botWebViewMenuContainer != null) {
Objects.requireNonNull(view);
botWebViewMenuContainer.dismiss(new ChatActivityEnterView$$ExternalSyntheticLambda42(view));
return;
}
return;
}
if (!isPopupShowing() || this.currentPopupContentType != 0) {
showPopup(1, 0);
EmojiView emojiView = this.emojiView;
EditTextCaption editTextCaption = this.messageEditText;
boolean z = editTextCaption != null && editTextCaption.length() > 0;
ChatActivity chatActivity = this.parentFragment;
emojiView.onOpen(z, chatActivity != null && chatActivity.groupEmojiPackHintWasVisible());
return;
}
if (this.searchingType != 0) {
setSearchingTypeInternal(0, true);
EmojiView emojiView2 = this.emojiView;
if (emojiView2 != null) {
emojiView2.closeSearch(false);
}
EditTextCaption editTextCaption2 = this.messageEditText;
if (editTextCaption2 != null) {
editTextCaption2.requestFocus();
}
}
if (this.stickersExpanded) {
setStickersExpanded(false, true, false);
this.waitingForKeyboardOpenAfterAnimation = true;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$new$1();
}
}, 200L);
return;
}
openKeyboardInternal();
}
}
public void lambda$new$1() {
this.waitingForKeyboardOpenAfterAnimation = false;
openKeyboardInternal();
}
public void lambda$new$3(View view) {
AdjustPanLayoutHelper adjustPanLayoutHelper = this.adjustPanLayoutHelper;
if ((adjustPanLayoutHelper == null || !adjustPanLayoutHelper.animationInProgress()) && this.attachLayoutPaddingAlpha != 0.0f) {
this.delegate.didPressAttachButton();
}
}
public class AnonymousClass20 extends FrameLayout {
public final Theme.ResourcesProvider val$resourcesProvider;
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return true;
}
public AnonymousClass20(Context context, final Theme.ResourcesProvider val$resourcesProvider) {
super(context);
this.val$resourcesProvider = val$resourcesProvider;
}
@Override
public void setVisibility(int visibility) {
super.setVisibility(visibility);
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
FrameLayout frameLayout;
ChatActivityEnterView.this.createRecordCircle();
if (motionEvent.getAction() == 0) {
if (ChatActivityEnterView.this.recordCircle.isSendButtonVisible()) {
if (!ChatActivityEnterView.this.hasRecordVideo || ChatActivityEnterView.this.calledRecordRunnable) {
ChatActivityEnterView.this.startedDraggingX = -1.0f;
if (ChatActivityEnterView.this.hasRecordVideo && ChatActivityEnterView.this.isInVideoMode()) {
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = ChatActivityEnterView.this.delegate;
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
int i = chatActivityEnterView.voiceOnce ? Integer.MAX_VALUE : 0;
MessageSendPreview messageSendPreview = chatActivityEnterView.messageSendPreview;
chatActivityEnterViewDelegate.needStartRecordVideo(1, true, 0, i, messageSendPreview != null ? messageSendPreview.getSelectedEffect() : 0L);
} else {
if (ChatActivityEnterView.this.recordingAudioVideo && ChatActivityEnterView.this.isInScheduleMode()) {
AlertsCreator.createScheduleDatePickerDialog(ChatActivityEnterView.this.parentActivity, ChatActivityEnterView.this.parentFragment.getDialogId(), new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public final void didSelectDate(boolean z, int i2) {
ChatActivityEnterView.AnonymousClass20.lambda$onTouchEvent$0(z, i2);
}
}, new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.AnonymousClass20.lambda$onTouchEvent$1();
}
}, this.val$resourcesProvider);
}
MediaController.getInstance().stopRecording(ChatActivityEnterView.this.isInScheduleMode() ? 3 : 1, true, 0, ChatActivityEnterView.this.voiceOnce);
ChatActivityEnterView.this.delegate.needStartRecordAudio(0);
}
ChatActivityEnterView.this.recordingAudioVideo = false;
ChatActivityEnterView chatActivityEnterView2 = ChatActivityEnterView.this;
chatActivityEnterView2.messageTransitionIsRunning = false;
Runnable runnable = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.AnonymousClass20.this.lambda$onTouchEvent$2();
}
};
chatActivityEnterView2.moveToSendStateRunnable = runnable;
AndroidUtilities.runOnUIThread(runnable, 200L);
}
getParent().requestDisallowInterceptTouchEvent(true);
return true;
}
TLRPC.Chat currentChat = ChatActivityEnterView.this.parentFragment == null ? null : ChatActivityEnterView.this.parentFragment.getCurrentChat();
TLRPC.UserFull currentUserInfo = ChatActivityEnterView.this.parentFragment == null ? ChatActivityEnterView.this.userInfo : ChatActivityEnterView.this.parentFragment.getCurrentUserInfo();
if ((currentChat != null && !ChatObject.canSendVoice(currentChat) && (!ChatObject.canSendRoundVideo(currentChat) || !ChatActivityEnterView.this.hasRecordVideo)) || (currentUserInfo != null && currentUserInfo.voice_messages_forbidden)) {
ChatActivityEnterView.this.delegate.needShowMediaBanHint();
return true;
}
if (ChatActivityEnterView.this.hasRecordVideo) {
ChatActivityEnterView.this.calledRecordRunnable = false;
ChatActivityEnterView.this.recordAudioVideoRunnableStarted = true;
AndroidUtilities.runOnUIThread(ChatActivityEnterView.this.recordAudioVideoRunnable, 150L);
} else {
ChatActivityEnterView.this.recordAudioVideoRunnable.run();
}
return true;
}
if (motionEvent.getAction() == 1 || motionEvent.getAction() == 3) {
if (motionEvent.getAction() == 3 && ChatActivityEnterView.this.recordingAudioVideo) {
if (ChatActivityEnterView.this.slideToCancelProgress < 0.7f) {
if (ChatActivityEnterView.this.hasRecordVideo && ChatActivityEnterView.this.isInVideoMode()) {
CameraController.getInstance().cancelOnInitRunnable(ChatActivityEnterView.this.onFinishInitCameraRunnable);
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate2 = ChatActivityEnterView.this.delegate;
ChatActivityEnterView chatActivityEnterView3 = ChatActivityEnterView.this;
int i2 = chatActivityEnterView3.voiceOnce ? Integer.MAX_VALUE : 0;
MessageSendPreview messageSendPreview2 = chatActivityEnterView3.messageSendPreview;
chatActivityEnterViewDelegate2.needStartRecordVideo(2, true, 0, i2, messageSendPreview2 != null ? messageSendPreview2.getSelectedEffect() : 0L);
} else {
ChatActivityEnterView.this.delegate.needStartRecordAudio(0);
MediaController.getInstance().stopRecording(0, false, 0, ChatActivityEnterView.this.voiceOnce);
}
ChatActivityEnterView.this.millisecondsRecorded = 0L;
ChatActivityEnterView.this.recordingAudioVideo = false;
ChatActivityEnterView.this.updateRecordInterface(5, true);
} else {
ChatActivityEnterView.this.sendButtonVisible = true;
ChatActivityEnterView.this.startLockTransition();
}
return false;
}
if ((ChatActivityEnterView.this.recordCircle != null && ChatActivityEnterView.this.recordCircle.isSendButtonVisible()) || ((frameLayout = ChatActivityEnterView.this.recordedAudioPanel) != null && frameLayout.getVisibility() == 0)) {
if (ChatActivityEnterView.this.recordAudioVideoRunnableStarted) {
AndroidUtilities.cancelRunOnUIThread(ChatActivityEnterView.this.recordAudioVideoRunnable);
}
return false;
}
if ((((motionEvent.getX() + ChatActivityEnterView.this.audioVideoButtonContainer.getX()) - ChatActivityEnterView.this.startedDraggingX) / ChatActivityEnterView.this.distCanMove) + 1.0f < 0.45d) {
if (ChatActivityEnterView.this.hasRecordVideo && ChatActivityEnterView.this.isInVideoMode()) {
CameraController.getInstance().cancelOnInitRunnable(ChatActivityEnterView.this.onFinishInitCameraRunnable);
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate3 = ChatActivityEnterView.this.delegate;
ChatActivityEnterView chatActivityEnterView4 = ChatActivityEnterView.this;
int i3 = chatActivityEnterView4.voiceOnce ? Integer.MAX_VALUE : 0;
MessageSendPreview messageSendPreview3 = chatActivityEnterView4.messageSendPreview;
chatActivityEnterViewDelegate3.needStartRecordVideo(2, true, 0, i3, messageSendPreview3 != null ? messageSendPreview3.getSelectedEffect() : 0L);
} else {
ChatActivityEnterView.this.delegate.needStartRecordAudio(0);
MediaController.getInstance().stopRecording(0, false, 0, ChatActivityEnterView.this.voiceOnce);
}
ChatActivityEnterView.this.millisecondsRecorded = 0L;
ChatActivityEnterView.this.recordingAudioVideo = false;
ChatActivityEnterView.this.updateRecordInterface(5, true);
} else if (ChatActivityEnterView.this.recordAudioVideoRunnableStarted) {
AndroidUtilities.cancelRunOnUIThread(ChatActivityEnterView.this.recordAudioVideoRunnable);
if (ChatActivityEnterView.this.sendVoiceEnabled && ChatActivityEnterView.this.sendRoundEnabled) {
ChatActivityEnterView.this.delegate.onSwitchRecordMode(!ChatActivityEnterView.this.isInVideoMode());
ChatActivityEnterView.this.setRecordVideoButtonVisible(!r1.isInVideoMode(), true);
} else {
ChatActivityEnterView.this.delegate.needShowMediaBanHint();
}
if (!PlusSettings.disableActionsVibrations) {
performHapticFeedback(3);
}
sendAccessibilityEvent(1);
} else if (!ChatActivityEnterView.this.hasRecordVideo || ChatActivityEnterView.this.calledRecordRunnable) {
ChatActivityEnterView.this.startedDraggingX = -1.0f;
if (ChatActivityEnterView.this.hasRecordVideo && ChatActivityEnterView.this.isInVideoMode()) {
CameraController.getInstance().cancelOnInitRunnable(ChatActivityEnterView.this.onFinishInitCameraRunnable);
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate4 = ChatActivityEnterView.this.delegate;
int i4 = PlusSettings.confirmAudioVideoBeforeSending ? 3 : 1;
ChatActivityEnterView chatActivityEnterView5 = ChatActivityEnterView.this;
int i5 = chatActivityEnterView5.voiceOnce ? Integer.MAX_VALUE : 0;
MessageSendPreview messageSendPreview4 = chatActivityEnterView5.messageSendPreview;
chatActivityEnterViewDelegate4.needStartRecordVideo(i4, true, 0, i5, messageSendPreview4 != null ? messageSendPreview4.getSelectedEffect() : 0L);
} else if (!ChatActivityEnterView.this.sendVoiceEnabled) {
ChatActivityEnterView.this.delegate.needShowMediaBanHint();
} else {
if (ChatActivityEnterView.this.recordingAudioVideo && ChatActivityEnterView.this.isInScheduleMode() && !PlusSettings.confirmAudioVideoBeforeSending) {
AlertsCreator.createScheduleDatePickerDialog(ChatActivityEnterView.this.parentActivity, ChatActivityEnterView.this.parentFragment.getDialogId(), new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public final void didSelectDate(boolean z, int i6) {
ChatActivityEnterView.AnonymousClass20.lambda$onTouchEvent$3(z, i6);
}
}, new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.AnonymousClass20.lambda$onTouchEvent$4();
}
}, this.val$resourcesProvider);
}
ChatActivityEnterView.this.delegate.needStartRecordAudio(0);
MediaController mediaController = MediaController.getInstance();
if (PlusSettings.confirmAudioVideoBeforeSending) {
r4 = 2;
} else if (!ChatActivityEnterView.this.isInScheduleMode()) {
r4 = 1;
}
mediaController.stopRecording(r4, true, 0, ChatActivityEnterView.this.voiceOnce);
}
if (!PlusSettings.confirmAudioVideoBeforeSending) {
ChatActivityEnterView.this.recordingAudioVideo = false;
ChatActivityEnterView chatActivityEnterView6 = ChatActivityEnterView.this;
chatActivityEnterView6.messageTransitionIsRunning = false;
Runnable runnable2 = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.AnonymousClass20.this.lambda$onTouchEvent$5();
}
};
chatActivityEnterView6.moveToSendStateRunnable = runnable2;
AndroidUtilities.runOnUIThread(runnable2, ChatActivityEnterView.this.shouldDrawBackground ? 500L : 0L);
}
}
return true;
}
if (motionEvent.getAction() == 2 && ChatActivityEnterView.this.recordingAudioVideo) {
float x = motionEvent.getX();
float y = motionEvent.getY();
if (ChatActivityEnterView.this.recordCircle.isSendButtonVisible()) {
return false;
}
if (ChatActivityEnterView.this.recordCircle.setLockTranslation(y) == 2) {
ChatActivityEnterView.this.startLockTransition();
return false;
}
ChatActivityEnterView.this.recordCircle.setMovingCords(x, y);
if (ChatActivityEnterView.this.startedDraggingX == -1.0f) {
ChatActivityEnterView.this.startedDraggingX = x;
ChatActivityEnterView chatActivityEnterView7 = ChatActivityEnterView.this;
double measuredWidth = chatActivityEnterView7.sizeNotifierLayout.getMeasuredWidth();
Double.isNaN(measuredWidth);
chatActivityEnterView7.distCanMove = (float) (measuredWidth * 0.35d);
if (ChatActivityEnterView.this.distCanMove > AndroidUtilities.dp(140.0f)) {
ChatActivityEnterView.this.distCanMove = AndroidUtilities.dp(140.0f);
}
}
float x2 = (((x + ChatActivityEnterView.this.audioVideoButtonContainer.getX()) - ChatActivityEnterView.this.startedDraggingX) / ChatActivityEnterView.this.distCanMove) + 1.0f;
if (ChatActivityEnterView.this.startedDraggingX != -1.0f) {
float f = x2 <= 1.0f ? x2 < 0.0f ? 0.0f : x2 : 1.0f;
if (ChatActivityEnterView.this.slideText != null) {
ChatActivityEnterView.this.slideText.setSlideX(f);
}
ChatActivityEnterView.this.setSlideToCancelProgress(f);
x2 = f;
}
if (x2 == 0.0f) {
if (ChatActivityEnterView.this.hasRecordVideo && ChatActivityEnterView.this.isInVideoMode()) {
CameraController.getInstance().cancelOnInitRunnable(ChatActivityEnterView.this.onFinishInitCameraRunnable);
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate5 = ChatActivityEnterView.this.delegate;
ChatActivityEnterView chatActivityEnterView8 = ChatActivityEnterView.this;
int i6 = chatActivityEnterView8.voiceOnce ? Integer.MAX_VALUE : 0;
MessageSendPreview messageSendPreview5 = chatActivityEnterView8.messageSendPreview;
chatActivityEnterViewDelegate5.needStartRecordVideo(2, true, 0, i6, messageSendPreview5 != null ? messageSendPreview5.getSelectedEffect() : 0L);
} else {
ChatActivityEnterView.this.delegate.needStartRecordAudio(0);
MediaController.getInstance().stopRecording(0, false, 0, ChatActivityEnterView.this.voiceOnce);
}
ChatActivityEnterView.this.recordingAudioVideo = false;
ChatActivityEnterView.this.updateRecordInterface(5, true);
}
}
return true;
}
public static void lambda$onTouchEvent$0(boolean z, int i) {
MediaController.getInstance().stopRecording(1, z, i, false);
}
public static void lambda$onTouchEvent$1() {
MediaController.getInstance().stopRecording(0, false, 0, false);
}
public void lambda$onTouchEvent$2() {
ChatActivityEnterView.this.moveToSendStateRunnable = null;
ChatActivityEnterView.this.updateRecordInterface(1, true);
}
public static void lambda$onTouchEvent$3(boolean z, int i) {
MediaController.getInstance().stopRecording(1, z, i, false);
}
public static void lambda$onTouchEvent$4() {
MediaController.getInstance().stopRecording(0, false, 0, false);
}
public void lambda$onTouchEvent$5() {
ChatActivityEnterView.this.moveToSendStateRunnable = null;
ChatActivityEnterView.this.updateRecordInterface(1, true);
}
}
public void lambda$new$4(View view) {
EditTextCaption editTextCaption = this.messageEditText;
String obj = editTextCaption != null ? editTextCaption.getText().toString() : BuildConfig.APP_CENTER_HASH;
int indexOf = obj.indexOf(32);
if (indexOf == -1 || indexOf == obj.length() - 1) {
setFieldText(BuildConfig.APP_CENTER_HASH);
} else {
setFieldText(obj.substring(0, indexOf + 1));
}
}
public void lambda$new$5(View view) {
MessageSendPreview messageSendPreview = this.messageSendPreview;
if (messageSendPreview == null || !messageSendPreview.isShowing()) {
AnimatorSet animatorSet = this.runningAnimationAudio;
if ((animatorSet == null || !animatorSet.isRunning()) && this.moveToSendStateRunnable == null) {
sendMessage();
}
}
}
public void lambda$new$6(View view) {
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate == null || chatActivityEnterViewDelegate.checkCanRemoveRestrictionsByBoosts()) {
return;
}
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate2 = this.delegate;
SlowModeBtn slowModeBtn = this.slowModeButton;
chatActivityEnterViewDelegate2.onUpdateSlowModeButton(slowModeBtn, true, slowModeBtn.getText());
}
public boolean lambda$new$7(View view) {
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption == null || editTextCaption.length() <= 0) {
return false;
}
return onSendLongClick(view);
}
public final void createCaptionLimitView() {
if (this.captionLimitView != null) {
return;
}
NumberTextView numberTextView = new NumberTextView(getContext());
this.captionLimitView = numberTextView;
numberTextView.setVisibility(8);
this.captionLimitView.setTextSize(15);
this.captionLimitView.setTextColor(getThemedColor(Theme.key_windowBackgroundWhiteGrayText));
this.captionLimitView.setTypeface(AndroidUtilities.bold());
this.captionLimitView.setCenterAlign(true);
addView(this.captionLimitView, 3, LayoutHelper.createFrame(48, 20.0f, 85, 3.0f, 0.0f, 0.0f, 48.0f));
}
public final void createScheduledButton() {
if (this.scheduledButton != null || this.parentFragment == null) {
return;
}
Drawable mutate = getContext().getResources().getDrawable(R.drawable.input_calendar1).mutate();
Drawable mutate2 = getContext().getResources().getDrawable(R.drawable.input_calendar2).mutate();
mutate.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_messagePanelIcons), PorterDuff.Mode.MULTIPLY));
mutate2.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_recordedVoiceDot), PorterDuff.Mode.MULTIPLY));
CombinedDrawable combinedDrawable = new CombinedDrawable(mutate, mutate2);
ImageView imageView = new ImageView(getContext());
this.scheduledButton = imageView;
imageView.setImageDrawable(combinedDrawable);
this.scheduledButton.setVisibility(8);
this.scheduledButton.setContentDescription(LocaleController.getString("ScheduledMessages", R.string.ScheduledMessages));
this.scheduledButton.setScaleType(ImageView.ScaleType.CENTER);
if (Build.VERSION.SDK_INT >= 21) {
this.scheduledButton.setBackgroundDrawable(Theme.createSelectorDrawable(getThemedColor(Theme.key_listSelector)));
}
this.messageEditTextContainer.addView(this.scheduledButton, 2, LayoutHelper.createFrame(48, 48, 85));
this.scheduledButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivityEnterView.this.lambda$createScheduledButton$8(view);
}
});
}
public void lambda$createScheduledButton$8(View view) {
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
chatActivityEnterViewDelegate.openScheduledMessages();
}
}
public final void createGiftButton() {
if (this.giftButton != null || this.parentFragment == null) {
return;
}
AnonymousClass23 anonymousClass23 = new AnonymousClass23(getContext());
this.giftButton = anonymousClass23;
anonymousClass23.setImageResource(R.drawable.msg_input_gift);
this.giftButton.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_messagePanelIcons), PorterDuff.Mode.MULTIPLY));
this.giftButton.setVisibility(8);
this.giftButton.setContentDescription(LocaleController.getString(R.string.GiftPremium));
this.giftButton.setScaleType(ImageView.ScaleType.CENTER);
if (Build.VERSION.SDK_INT >= 21) {
this.giftButton.setBackground(Theme.createSelectorDrawable(getThemedColor(Theme.key_listSelector)));
}
this.attachLayout.addView(this.giftButton, 0, LayoutHelper.createFrame(48, 48, 21));
this.giftButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivityEnterView.this.lambda$createGiftButton$11(view);
}
});
}
public class AnonymousClass23 extends ImageView {
public AnonymousClass23(Context context) {
super(context);
}
@Override
public void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
final ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
post(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.m1604$$Nest$mcheckBirthdayHint(ChatActivityEnterView.this);
}
});
}
}
public void lambda$createGiftButton$11(View view) {
SharedPreferences.Editor edit = MessagesController.getInstance(this.currentAccount).getMainSettings().edit();
if (BirthdayController.isToday(this.parentFragment.getCurrentUserInfo())) {
edit.putBoolean(Calendar.getInstance().get(1) + "show_gift_for_" + this.parentFragment.getDialogId(), false);
} else {
edit.putBoolean("show_gift_for_" + this.parentFragment.getDialogId(), false);
}
if (MessagesController.getInstance(this.currentAccount).giftAttachMenuIcon && MessagesController.getInstance(this.currentAccount).giftTextFieldIcon && !getParentFragment().getCurrentUserInfo().premium_gifts.isEmpty()) {
edit.putBoolean("show_gift_for_" + this.parentFragment.getDialogId(), false);
}
edit.apply();
AndroidUtilities.updateViewVisibilityAnimated(this.giftButton, false);
final TLRPC.User currentUser = getParentFragment().getCurrentUser();
if (currentUser == null) {
return;
}
if (new ArrayList(getParentFragment().getCurrentUserInfo().premium_gifts).isEmpty()) {
final AlertDialog alertDialog = new AlertDialog(getContext(), 3);
final int loadGiftOptions = BoostRepository.loadGiftOptions((TLRPC.Chat) null, new Utilities.Callback() {
@Override
public final void run(Object obj) {
ChatActivityEnterView.lambda$createGiftButton$9(alertDialog, currentUser, (List) obj);
}
});
alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public final void onCancel(DialogInterface dialogInterface) {
ChatActivityEnterView.this.lambda$createGiftButton$10(loadGiftOptions, dialogInterface);
}
});
alertDialog.showDelayed(200L);
return;
}
new GiftPremiumBottomSheet(getParentFragment(), getParentFragment().getCurrentUser()).show();
}
public static void lambda$createGiftButton$9(AlertDialog alertDialog, TLRPC.User user, List list) {
alertDialog.dismiss();
List filterGiftOptionsByBilling = BoostRepository.filterGiftOptionsByBilling(BoostRepository.filterGiftOptions(list, 1));
ArrayList arrayList = new ArrayList();
arrayList.add(user);
PremiumPreviewGiftToUsersBottomSheet.show(arrayList, filterGiftOptionsByBilling);
}
public void lambda$createGiftButton$10(int i, DialogInterface dialogInterface) {
this.parentFragment.getConnectionsManager().cancelRequest(i, true);
}
public final void createBotButton() {
if (this.botButton != null) {
return;
}
ImageView imageView = new ImageView(getContext());
this.botButton = imageView;
ReplaceableIconDrawable replaceableIconDrawable = new ReplaceableIconDrawable(getContext());
this.botButtonDrawable = replaceableIconDrawable;
imageView.setImageDrawable(replaceableIconDrawable);
this.botButtonDrawable.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_messagePanelIcons), PorterDuff.Mode.MULTIPLY));
this.botButtonDrawable.setIcon(R.drawable.input_bot2, false);
this.botButton.setScaleType(ImageView.ScaleType.CENTER);
if (Build.VERSION.SDK_INT >= 21) {
this.botButton.setBackgroundDrawable(Theme.createSelectorDrawable(getThemedColor(Theme.key_listSelector)));
}
this.botButton.setVisibility(8);
AndroidUtilities.updateViewVisibilityAnimated(this.botButton, false, 0.1f, false);
this.attachLayout.addView(this.botButton, 0, LayoutHelper.createLinear(48, 48));
this.botButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivityEnterView.this.lambda$createBotButton$12(view);
}
});
}
public void lambda$createBotButton$12(View view) {
if (hasBotWebView() && botCommandsMenuIsShowing()) {
BotWebViewMenuContainer botWebViewMenuContainer = this.botWebViewMenuContainer;
Objects.requireNonNull(view);
botWebViewMenuContainer.dismiss(new ChatActivityEnterView$$ExternalSyntheticLambda42(view));
return;
}
if (this.searchingType != 0) {
setSearchingTypeInternal(0, false);
this.emojiView.closeSearch(false);
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null) {
editTextCaption.requestFocus();
}
}
if (this.botReplyMarkup != null) {
if (!isPopupShowing() || this.currentPopupContentType != 1) {
showPopup(1, 1);
} else if (isPopupShowing() && this.currentPopupContentType == 1) {
showPopup(0, 1);
}
} else if (this.hasBotCommands || this.hasQuickReplies) {
setFieldText("/");
EditTextCaption editTextCaption2 = this.messageEditText;
if (editTextCaption2 != null) {
editTextCaption2.requestFocus();
}
openKeyboard();
}
if (this.stickersExpanded) {
setStickersExpanded(false, false, false);
}
}
public final void createDoneButton(boolean bounceable) {
if (this.doneButton != null) {
return;
}
SendButton sendButton = new SendButton(getContext(), R.drawable.input_done, this.resourcesProvider) {
@Override
public boolean isOpen() {
return true;
}
@Override
public boolean shouldDrawBackground() {
return true;
}
@Override
public boolean isInactive() {
return !ChatActivityEnterView.this.doneButtonEnabled;
}
};
this.doneButton = sendButton;
sendButton.center = true;
if (bounceable) {
ScaleStateListAnimator.apply(sendButton);
}
this.textFieldContainer.addView(this.doneButton, LayoutHelper.createFrame(38, 38.0f, 85, 5.0f, 5.0f, 5.0f, 5.0f));
}
public final void createExpandStickersButton() {
if (this.expandStickersButton != null) {
return;
}
ImageView imageView = new ImageView(this, getContext()) {
@Override
public boolean onTouchEvent(MotionEvent event) {
if (getAlpha() <= 0.0f) {
return false;
}
return super.onTouchEvent(event);
}
};
this.expandStickersButton = imageView;
imageView.setScaleType(ImageView.ScaleType.CENTER);
ImageView imageView2 = this.expandStickersButton;
AnimatedArrowDrawable animatedArrowDrawable = new AnimatedArrowDrawable(getThemedColor(Theme.key_chat_messagePanelIcons), false);
this.stickersArrow = animatedArrowDrawable;
imageView2.setImageDrawable(animatedArrowDrawable);
this.expandStickersButton.setVisibility(8);
this.expandStickersButton.setScaleX(0.1f);
this.expandStickersButton.setScaleY(0.1f);
this.expandStickersButton.setAlpha(0.0f);
if (Build.VERSION.SDK_INT >= 21) {
this.expandStickersButton.setBackgroundDrawable(Theme.createSelectorDrawable(getThemedColor(Theme.key_listSelector)));
}
this.sendButtonContainer.addView(this.expandStickersButton, LayoutHelper.createFrame(48, 48.0f));
this.expandStickersButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivityEnterView.this.lambda$createExpandStickersButton$13(view);
}
});
this.expandStickersButton.setContentDescription(LocaleController.getString("AccDescrExpandPanel", R.string.AccDescrExpandPanel));
}
public void lambda$createExpandStickersButton$13(View view) {
EmojiView emojiView;
EditTextCaption editTextCaption;
if (this.expandStickersButton.getVisibility() == 0 && this.expandStickersButton.getAlpha() == 1.0f && !this.waitingForKeyboardOpen) {
if (this.keyboardVisible && (editTextCaption = this.messageEditText) != null && editTextCaption.isFocused()) {
return;
}
if (this.stickersExpanded) {
if (this.searchingType != 0) {
setSearchingTypeInternal(0, true);
this.emojiView.closeSearch(true);
this.emojiView.hideSearchKeyboard();
if (this.emojiTabOpen) {
checkSendButton(true);
}
} else if (!this.stickersDragging && (emojiView = this.emojiView) != null) {
emojiView.showSearchField(false);
}
} else if (!this.stickersDragging) {
this.emojiView.showSearchField(true);
}
if (this.stickersDragging) {
return;
}
setStickersExpanded(!this.stickersExpanded, true, false);
}
}
public final void createRecordAudioPanel() {
if (this.recordedAudioPanel != null) {
return;
}
FrameLayout frameLayout = new FrameLayout(getContext()) {
@Override
public void setVisibility(int visibility) {
super.setVisibility(visibility);
ChatActivityEnterView.this.updateSendAsButton();
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
return super.dispatchTouchEvent(ev);
}
};
this.recordedAudioPanel = frameLayout;
frameLayout.setVisibility(this.audioToSend == null ? 8 : 0);
if (Theme.usePlusTheme) {
this.recordedAudioPanel.setBackgroundColor(Theme.chatEditTextBGColor);
}
this.recordedAudioPanel.setFocusable(true);
this.recordedAudioPanel.setFocusableInTouchMode(true);
this.recordedAudioPanel.setClickable(true);
this.messageEditTextContainer.addView(this.recordedAudioPanel, LayoutHelper.createFrame(-1, 48, 80));
RLottieImageView rLottieImageView = new RLottieImageView(getContext());
this.recordDeleteImageView = rLottieImageView;
rLottieImageView.setScaleType(ImageView.ScaleType.CENTER);
this.recordDeleteImageView.setAnimation(R.raw.chat_audio_record_delete_2, 28, 28);
this.recordDeleteImageView.getAnimatedDrawable().setInvalidateOnProgressSet(true);
updateRecordedDeleteIconColors();
this.recordDeleteImageView.setContentDescription(LocaleController.getString("Delete", R.string.Delete));
if (Build.VERSION.SDK_INT >= 21) {
this.recordDeleteImageView.setBackgroundDrawable(Theme.createSelectorDrawable(getThemedColor(Theme.key_listSelector)));
}
this.recordedAudioPanel.addView(this.recordDeleteImageView, LayoutHelper.createFrame(48, 48.0f));
this.recordDeleteImageView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivityEnterView.this.lambda$createRecordAudioPanel$14(view);
}
});
VideoTimelineView videoTimelineView = new VideoTimelineView(getContext());
this.videoTimelineView = videoTimelineView;
videoTimelineView.setVisibility(4);
VideoTimelineView videoTimelineView2 = this.videoTimelineView;
videoTimelineView2.useClip = !this.shouldDrawBackground;
videoTimelineView2.setRoundFrames(true);
this.videoTimelineView.setDelegate(new VideoTimelineView.VideoTimelineViewDelegate() {
@Override
public void onLeftProgressChanged(float progress) {
if (ChatActivityEnterView.this.videoToSendMessageObject == null) {
return;
}
ChatActivityEnterView.this.videoToSendMessageObject.startTime = (long) (ChatActivityEnterView.this.videoToSendMessageObject.estimatedDuration * progress);
ChatActivityEnterView.this.delegate.needChangeVideoPreviewState(2, progress);
}
@Override
public void onRightProgressChanged(float progress) {
if (ChatActivityEnterView.this.videoToSendMessageObject == null) {
return;
}
ChatActivityEnterView.this.videoToSendMessageObject.endTime = (long) (ChatActivityEnterView.this.videoToSendMessageObject.estimatedDuration * progress);
ChatActivityEnterView.this.delegate.needChangeVideoPreviewState(2, progress);
}
@Override
public void didStartDragging() {
ChatActivityEnterView.this.delegate.needChangeVideoPreviewState(1, 0.0f);
}
@Override
public void didStopDragging() {
ChatActivityEnterView.this.delegate.needChangeVideoPreviewState(0, 0.0f);
}
});
this.recordedAudioPanel.addView(this.videoTimelineView, LayoutHelper.createFrame(-1, -1.0f, 19, 56.0f, 0.0f, 8.0f, 0.0f));
VideoTimelineView.TimeHintView timeHintView = new VideoTimelineView.TimeHintView(getContext());
this.videoTimelineView.setTimeHintView(timeHintView);
this.sizeNotifierLayout.addView(timeHintView, LayoutHelper.createFrame(-1, -2.0f, 80, 0.0f, 0.0f, 0.0f, 52.0f));
View view = new View(getContext()) {
@Override
public void dispatchDraw(Canvas canvas) {
getBackground().setBounds((int) ChatActivityEnterView.this.horizontalPadding, 0, (int) (getMeasuredWidth() - ChatActivityEnterView.this.horizontalPadding), getMeasuredHeight());
getBackground().draw(canvas);
}
};
this.recordedAudioBackground = view;
view.setBackgroundDrawable(Theme.createRoundRectDrawable(AndroidUtilities.dp(18.0f), getThemedColor(Theme.key_chat_recordedVoiceBackground)));
this.recordedAudioPanel.addView(this.recordedAudioBackground, LayoutHelper.createFrame(-1, 36.0f, 19, 48.0f, 0.0f, 0.0f, 0.0f));
LinearLayout linearLayout = new LinearLayout(getContext());
linearLayout.setOrientation(0);
this.recordedAudioPanel.addView(linearLayout, LayoutHelper.createFrame(-1, 32.0f, 19, 92.0f, 0.0f, 13.0f, 0.0f));
this.recordedAudioPlayButton = new ImageView(getContext());
Matrix matrix = new Matrix();
matrix.postScale(0.8f, 0.8f, AndroidUtilities.dpf2(24.0f), AndroidUtilities.dpf2(24.0f));
this.recordedAudioPlayButton.setImageMatrix(matrix);
ImageView imageView = this.recordedAudioPlayButton;
MediaActionDrawable mediaActionDrawable = new MediaActionDrawable();
this.playPauseDrawable = mediaActionDrawable;
imageView.setImageDrawable(mediaActionDrawable);
this.recordedAudioPlayButton.setScaleType(ImageView.ScaleType.MATRIX);
this.recordedAudioPlayButton.setContentDescription(LocaleController.getString("AccActionPlay", R.string.AccActionPlay));
this.recordedAudioPanel.addView(this.recordedAudioPlayButton, LayoutHelper.createFrame(48, 48.0f, 83, 48.0f, 0.0f, 13.0f, 0.0f));
this.recordedAudioPlayButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
ChatActivityEnterView.this.lambda$createRecordAudioPanel$15(view2);
}
});
SeekBarWaveformView seekBarWaveformView = new SeekBarWaveformView(getContext());
this.recordedAudioSeekBar = seekBarWaveformView;
seekBarWaveformView.setVisibility(4);
linearLayout.addView(this.recordedAudioSeekBar, LayoutHelper.createLinear(0, 32, 1.0f, 16, 0, 0, 4, 0));
TextView textView = new TextView(getContext());
this.recordedAudioTimeTextView = textView;
textView.setTextColor(getThemedColor(Theme.key_chat_messagePanelVoiceDuration));
this.recordedAudioTimeTextView.setTextSize(1, 13.0f);
linearLayout.addView(this.recordedAudioTimeTextView, LayoutHelper.createLinear(-2, -2, 0.0f, 16));
}
public void lambda$createRecordAudioPanel$14(View view) {
AnimatorSet animatorSet = this.runningAnimationAudio;
if (animatorSet == null || !animatorSet.isRunning()) {
resetRecordedState();
}
}
public void lambda$createRecordAudioPanel$15(View view) {
if (this.audioToSend == null) {
return;
}
if (MediaController.getInstance().isPlayingMessage(this.audioToSendMessageObject) && !MediaController.getInstance().isMessagePaused()) {
MediaController.getInstance().pauseMessage(this.audioToSendMessageObject);
this.playPauseDrawable.setIcon(0, true);
this.recordedAudioPlayButton.setContentDescription(LocaleController.getString("AccActionPlay", R.string.AccActionPlay));
} else {
this.playPauseDrawable.setIcon(1, true);
MediaController.getInstance().playMessage(this.audioToSendMessageObject);
this.recordedAudioPlayButton.setContentDescription(LocaleController.getString("AccActionPause", R.string.AccActionPause));
}
}
public final void resetRecordedState() {
if (this.videoToSendMessageObject != null) {
CameraController.getInstance().cancelOnInitRunnable(this.onFinishInitCameraRunnable);
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
int i = this.voiceOnce ? Integer.MAX_VALUE : 0;
MessageSendPreview messageSendPreview = this.messageSendPreview;
chatActivityEnterViewDelegate.needStartRecordVideo(2, true, 0, i, messageSendPreview != null ? messageSendPreview.getSelectedEffect() : 0L);
} else {
MessageObject playingMessageObject = MediaController.getInstance().getPlayingMessageObject();
if (playingMessageObject != null && playingMessageObject == this.audioToSendMessageObject) {
MediaController.getInstance().cleanupPlayer(true, true);
}
}
if (this.audioToSendPath != null) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("delete file " + this.audioToSendPath);
}
new File(this.audioToSendPath).delete();
}
MediaController.getInstance().cleanRecording(true);
MediaDataController mediaDataController = MediaDataController.getInstance(this.currentAccount);
long j = this.dialog_id;
ChatActivity chatActivity = this.parentFragment;
mediaDataController.pushDraftVoiceMessage(j, (chatActivity == null || !chatActivity.isTopic) ? 0L : chatActivity.getTopicId(), null);
MediaController.getInstance().stopRecording(0, false, 0, false);
this.millisecondsRecorded = 0L;
hideRecordedAudioPanel(false);
checkSendButton(true);
}
public final void createSenderSelectView() {
if (this.senderSelectView != null) {
return;
}
SenderSelectView senderSelectView = new SenderSelectView(getContext());
this.senderSelectView = senderSelectView;
senderSelectView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivityEnterView.this.lambda$createSenderSelectView$22(view);
}
});
this.senderSelectView.setVisibility(8);
this.messageEditTextContainer.addView(this.senderSelectView, LayoutHelper.createFrame(32, 32.0f, 83, 10.0f, 8.0f, 10.0f, 8.0f));
}
public void lambda$createSenderSelectView$22(View view) {
int i;
int i2;
if (getTranslationY() != 0.0f) {
this.onEmojiSearchClosed = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$createSenderSelectView$16();
}
};
hidePopup(true, true);
return;
}
if (this.delegate.measureKeyboardHeight() > AndroidUtilities.dp(20.0f)) {
int contentViewHeight = this.delegate.getContentViewHeight();
int measureKeyboardHeight = this.delegate.measureKeyboardHeight();
if (measureKeyboardHeight <= AndroidUtilities.dp(20.0f)) {
contentViewHeight += measureKeyboardHeight;
}
if (this.emojiViewVisible) {
contentViewHeight -= getEmojiPadding();
}
if (contentViewHeight < AndroidUtilities.dp(200.0f)) {
this.onKeyboardClosed = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$createSenderSelectView$17();
}
};
closeKeyboard();
return;
}
}
if (this.delegate.getSendAsPeers() != null) {
try {
if (!PlusSettings.disableActionsVibrations) {
view.performHapticFeedback(3, 2);
}
} catch (Exception unused) {
}
SenderSelectPopup senderSelectPopup = this.senderSelectPopupWindow;
if (senderSelectPopup != null) {
senderSelectPopup.setPauseNotifications(false);
this.senderSelectPopupWindow.startDismissAnimation(new SpringAnimation[0]);
return;
}
final MessagesController messagesController = MessagesController.getInstance(this.currentAccount);
final TLRPC.ChatFull chatFull = messagesController.getChatFull(-this.dialog_id);
if (chatFull == null) {
return;
}
final FrameLayout overlayContainerView = this.parentFragment.getParentLayout().getOverlayContainerView();
SenderSelectPopup senderSelectPopup2 = new SenderSelectPopup(getContext(), this.parentFragment, messagesController, chatFull, this.delegate.getSendAsPeers(), new SenderSelectPopup.OnSelectCallback() {
@Override
public final void onPeerSelected(RecyclerView recyclerView, SenderSelectPopup.SenderView senderView, TLRPC.Peer peer) {
ChatActivityEnterView.this.lambda$createSenderSelectView$21(chatFull, messagesController, recyclerView, senderView, peer);
}
}) {
@Override
public void dismiss() {
if (ChatActivityEnterView.this.senderSelectPopupWindow != this) {
overlayContainerView.removeView(this.dimView);
super.dismiss();
return;
}
ChatActivityEnterView.this.senderSelectPopupWindow = null;
if (!this.runningCustomSprings) {
startDismissAnimation(new SpringAnimation[0]);
ChatActivityEnterView.this.senderSelectView.setProgress(0.0f, true, true);
return;
}
Iterator<SpringAnimation> it = this.springAnimations.iterator();
while (it.hasNext()) {
it.next().cancel();
}
this.springAnimations.clear();
super.dismiss();
}
};
this.senderSelectPopupWindow = senderSelectPopup2;
senderSelectPopup2.setPauseNotifications(true);
this.senderSelectPopupWindow.setDismissAnimationDuration(220);
this.senderSelectPopupWindow.setOutsideTouchable(true);
this.senderSelectPopupWindow.setClippingEnabled(true);
this.senderSelectPopupWindow.setFocusable(true);
this.senderSelectPopupWindow.getContentView().measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000.0f), Integer.MIN_VALUE), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000.0f), Integer.MIN_VALUE));
this.senderSelectPopupWindow.setInputMethodMode(2);
this.senderSelectPopupWindow.setSoftInputMode(0);
this.senderSelectPopupWindow.getContentView().setFocusableInTouchMode(true);
this.senderSelectPopupWindow.setAnimationEnabled(false);
int i3 = -AndroidUtilities.dp(4.0f);
int[] iArr = new int[2];
if (AndroidUtilities.isTablet()) {
this.parentFragment.getFragmentView().getLocationInWindow(iArr);
i = iArr[0] + i3;
} else {
i = i3;
}
int contentViewHeight2 = this.delegate.getContentViewHeight();
int measuredHeight = this.senderSelectPopupWindow.getContentView().getMeasuredHeight();
int measureKeyboardHeight2 = this.delegate.measureKeyboardHeight();
if (measureKeyboardHeight2 <= AndroidUtilities.dp(20.0f)) {
contentViewHeight2 += measureKeyboardHeight2;
}
if (this.emojiViewVisible) {
contentViewHeight2 -= getEmojiPadding();
}
int dp = AndroidUtilities.dp(1.0f);
if (measuredHeight < (((i3 * 2) + contentViewHeight2) - (this.parentFragment.isInBubbleMode() ? 0 : AndroidUtilities.statusBarHeight)) - this.senderSelectPopupWindow.headerText.getMeasuredHeight()) {
getLocationInWindow(iArr);
i2 = ((iArr[1] - measuredHeight) - i3) - AndroidUtilities.dp(2.0f);
overlayContainerView.addView(this.senderSelectPopupWindow.dimView, new FrameLayout.LayoutParams(-1, i3 + i2 + measuredHeight + dp + AndroidUtilities.dp(2.0f)));
} else {
int i4 = this.parentFragment.isInBubbleMode() ? 0 : AndroidUtilities.statusBarHeight;
int dp2 = AndroidUtilities.dp(14.0f);
this.senderSelectPopupWindow.recyclerContainer.getLayoutParams().height = ((contentViewHeight2 - i4) - dp2) - getHeightWithTopView();
overlayContainerView.addView(this.senderSelectPopupWindow.dimView, new FrameLayout.LayoutParams(-1, dp2 + i4 + this.senderSelectPopupWindow.recyclerContainer.getLayoutParams().height + dp));
i2 = i4;
}
this.senderSelectPopupWindow.startShowAnimation();
SenderSelectPopup senderSelectPopup3 = this.senderSelectPopupWindow;
this.popupX = i;
this.popupY = i2;
senderSelectPopup3.showAtLocation(view, 51, i, i2);
this.senderSelectView.setProgress(1.0f);
}
}
public void lambda$createSenderSelectView$16() {
this.senderSelectView.callOnClick();
}
public void lambda$createSenderSelectView$17() {
this.senderSelectView.callOnClick();
}
public void lambda$createSenderSelectView$21(TLRPC.ChatFull chatFull, MessagesController messagesController, RecyclerView recyclerView, final SenderSelectPopup.SenderView senderView, TLRPC.Peer peer) {
TLRPC.User user;
if (this.senderSelectPopupWindow == null) {
return;
}
if (chatFull != null) {
chatFull.default_send_as = peer;
updateSendAsButton();
}
MessagesController messagesController2 = this.parentFragment.getMessagesController();
long j = this.dialog_id;
long j2 = peer.user_id;
if (j2 == 0) {
j2 = -peer.channel_id;
}
messagesController2.setDefaultSendAs(j, j2);
final int[] iArr = new int[2];
boolean isSelected = senderView.avatar.isSelected();
senderView.avatar.getLocationInWindow(iArr);
senderView.avatar.setSelected(true, true);
final SimpleAvatarView simpleAvatarView = new SimpleAvatarView(getContext());
long j3 = peer.channel_id;
if (j3 != 0) {
TLRPC.Chat chat = messagesController.getChat(Long.valueOf(j3));
if (chat != null) {
simpleAvatarView.setAvatar(chat);
}
} else {
long j4 = peer.user_id;
if (j4 != 0 && (user = messagesController.getUser(Long.valueOf(j4))) != null) {
simpleAvatarView.setAvatar(user);
}
}
for (int i = 0; i < recyclerView.getChildCount(); i++) {
View childAt = recyclerView.getChildAt(i);
if ((childAt instanceof SenderSelectPopup.SenderView) && childAt != senderView) {
((SenderSelectPopup.SenderView) childAt).avatar.setSelected(false, true);
}
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$createSenderSelectView$20(simpleAvatarView, iArr, senderView);
}
}, isSelected ? 0L : 200L);
}
public void lambda$createSenderSelectView$20(final SimpleAvatarView simpleAvatarView, int[] iArr, SenderSelectPopup.SenderView senderView) {
if (this.senderSelectPopupWindow == null) {
return;
}
final Dialog dialog = new Dialog(getContext(), R.style.TransparentDialogNoAnimation);
FrameLayout frameLayout = new FrameLayout(getContext());
frameLayout.addView(simpleAvatarView, LayoutHelper.createFrame(40, 40, 3));
dialog.setContentView(frameLayout);
dialog.getWindow().setLayout(-1, -1);
int i = Build.VERSION.SDK_INT;
if (i >= 21) {
dialog.getWindow().clearFlags(1024);
dialog.getWindow().clearFlags(67108864);
dialog.getWindow().clearFlags(134217728);
dialog.getWindow().addFlags(Integer.MIN_VALUE);
dialog.getWindow().addFlags(512);
dialog.getWindow().addFlags(131072);
dialog.getWindow().getAttributes().windowAnimations = 0;
dialog.getWindow().getDecorView().setSystemUiVisibility(1792);
dialog.getWindow().setStatusBarColor(0);
dialog.getWindow().setNavigationBarColor(0);
AndroidUtilities.setLightStatusBar(dialog.getWindow(), Theme.getColor(Theme.key_actionBarDefault, (boolean[]) null, true) == -1);
if (i >= 26) {
AndroidUtilities.setLightNavigationBar(dialog.getWindow(), AndroidUtilities.computePerceivedBrightness(Theme.getColor(Theme.key_windowBackgroundGray, (boolean[]) null, true)) >= 0.721f);
}
}
if (i >= 23) {
this.popupX += getRootWindowInsets().getSystemWindowInsetLeft();
}
this.senderSelectView.getLocationInWindow(this.location);
int[] iArr2 = this.location;
final float f = iArr2[0];
final float f2 = iArr2[1];
float dp = AndroidUtilities.dp(5.0f);
float dp2 = iArr[0] + this.popupX + dp + AndroidUtilities.dp(4.0f) + 0.0f;
float f3 = iArr[1] + this.popupY + dp + 0.0f;
simpleAvatarView.setTranslationX(dp2);
simpleAvatarView.setTranslationY(f3);
float dp3 = this.senderSelectView.getLayoutParams().width / AndroidUtilities.dp(40.0f);
simpleAvatarView.setPivotX(0.0f);
simpleAvatarView.setPivotY(0.0f);
simpleAvatarView.setScaleX(0.75f);
simpleAvatarView.setScaleY(0.75f);
simpleAvatarView.getViewTreeObserver().addOnDrawListener(new AnonymousClass30(this, simpleAvatarView, senderView));
dialog.show();
this.senderSelectView.setScaleX(1.0f);
this.senderSelectView.setScaleY(1.0f);
this.senderSelectView.setAlpha(1.0f);
SenderSelectPopup senderSelectPopup = this.senderSelectPopupWindow;
SenderSelectView senderSelectView = this.senderSelectView;
DynamicAnimation.ViewProperty viewProperty = DynamicAnimation.SCALE_X;
SenderSelectView senderSelectView2 = this.senderSelectView;
DynamicAnimation.ViewProperty viewProperty2 = DynamicAnimation.SCALE_Y;
senderSelectPopup.startDismissAnimation(new SpringAnimation(senderSelectView, viewProperty).setSpring(new SpringForce(0.5f).setStiffness(750.0f).setDampingRatio(1.0f)), new SpringAnimation(senderSelectView2, viewProperty2).setSpring(new SpringForce(0.5f).setStiffness(750.0f).setDampingRatio(1.0f)), (SpringAnimation) new SpringAnimation(this.senderSelectView, DynamicAnimation.ALPHA).setSpring(new SpringForce(0.0f).setStiffness(750.0f).setDampingRatio(1.0f)).addEndListener(new DynamicAnimation.OnAnimationEndListener() {
public final void onAnimationEnd(DynamicAnimation dynamicAnimation, boolean z, float f4, float f5) {
ChatActivityEnterView.this.lambda$createSenderSelectView$18(dialog, simpleAvatarView, f, f2, dynamicAnimation, z, f4, f5);
}
}), (SpringAnimation) new SpringAnimation(simpleAvatarView, DynamicAnimation.TRANSLATION_X).setStartValue(MathUtils.clamp(dp2, f - AndroidUtilities.dp(6.0f), dp2)).setSpring(new SpringForce(f).setStiffness(700.0f).setDampingRatio(0.75f)).setMinValue(f - AndroidUtilities.dp(6.0f)), (SpringAnimation) new SpringAnimation(simpleAvatarView, DynamicAnimation.TRANSLATION_Y).setStartValue(MathUtils.clamp(f3, f3, AndroidUtilities.dp(6.0f) + f2)).setSpring(new SpringForce(f2).setStiffness(700.0f).setDampingRatio(0.75f)).setMaxValue(AndroidUtilities.dp(6.0f) + f2).addUpdateListener(new DynamicAnimation.OnAnimationUpdateListener(this) {
public boolean performedHapticFeedback = false;
public void onAnimationUpdate(DynamicAnimation animation, float value, float velocity) {
if (this.performedHapticFeedback || value < f2) {
return;
}
this.performedHapticFeedback = true;
try {
if (PlusSettings.disableActionsVibrations) {
return;
}
simpleAvatarView.performHapticFeedback(3, 2);
} catch (Exception unused) {
}
}
}).addEndListener(new DynamicAnimation.OnAnimationEndListener() {
public final void onAnimationEnd(DynamicAnimation dynamicAnimation, boolean z, float f4, float f5) {
ChatActivityEnterView.this.lambda$createSenderSelectView$19(dialog, simpleAvatarView, f, f2, dynamicAnimation, z, f4, f5);
}
}), new SpringAnimation(simpleAvatarView, viewProperty).setSpring(new SpringForce(dp3).setStiffness(1000.0f).setDampingRatio(1.0f)), new SpringAnimation(simpleAvatarView, viewProperty2).setSpring(new SpringForce(dp3).setStiffness(1000.0f).setDampingRatio(1.0f)));
}
public class AnonymousClass30 implements ViewTreeObserver.OnDrawListener {
public final SimpleAvatarView val$avatar;
public final SenderSelectPopup.SenderView val$senderView;
public AnonymousClass30(final ChatActivityEnterView this$0, final SimpleAvatarView val$avatar, final SenderSelectPopup.SenderView val$senderView) {
this.val$avatar = val$avatar;
this.val$senderView = val$senderView;
}
@Override
public void onDraw() {
final SimpleAvatarView simpleAvatarView = this.val$avatar;
final SenderSelectPopup.SenderView senderView = this.val$senderView;
simpleAvatarView.post(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.AnonymousClass30.this.lambda$onDraw$0(simpleAvatarView, senderView);
}
});
}
public void lambda$onDraw$0(SimpleAvatarView simpleAvatarView, SenderSelectPopup.SenderView senderView) {
simpleAvatarView.getViewTreeObserver().removeOnDrawListener(this);
senderView.avatar.setHideAvatar(true);
}
}
public void lambda$createSenderSelectView$18(final Dialog dialog, SimpleAvatarView simpleAvatarView, float f, float f2, DynamicAnimation dynamicAnimation, boolean z, float f3, float f4) {
if (dialog.isShowing()) {
simpleAvatarView.setTranslationX(f);
simpleAvatarView.setTranslationY(f2);
this.senderSelectView.setProgress(0.0f, false);
this.senderSelectView.setScaleX(1.0f);
this.senderSelectView.setScaleY(1.0f);
this.senderSelectView.setAlpha(1.0f);
this.senderSelectView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
ChatActivityEnterView.this.senderSelectView.getViewTreeObserver().removeOnPreDrawListener(this);
SenderSelectView senderSelectView = ChatActivityEnterView.this.senderSelectView;
Dialog dialog2 = dialog;
Objects.requireNonNull(dialog2);
senderSelectView.postDelayed(new ChatActivityEnterView$31$$ExternalSyntheticLambda0(dialog2), 100L);
return true;
}
});
}
}
public void lambda$createSenderSelectView$19(final Dialog dialog, SimpleAvatarView simpleAvatarView, float f, float f2, DynamicAnimation dynamicAnimation, boolean z, float f3, float f4) {
if (dialog.isShowing()) {
simpleAvatarView.setTranslationX(f);
simpleAvatarView.setTranslationY(f2);
this.senderSelectView.setProgress(0.0f, false);
this.senderSelectView.setScaleX(1.0f);
this.senderSelectView.setScaleY(1.0f);
this.senderSelectView.setAlpha(1.0f);
this.senderSelectView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
ChatActivityEnterView.this.senderSelectView.getViewTreeObserver().removeOnPreDrawListener(this);
SenderSelectView senderSelectView = ChatActivityEnterView.this.senderSelectView;
Dialog dialog2 = dialog;
Objects.requireNonNull(dialog2);
senderSelectView.postDelayed(new ChatActivityEnterView$31$$ExternalSyntheticLambda0(dialog2), 100L);
return true;
}
});
}
}
public final void createBotCommandsMenuButton() {
if (this.botCommandsMenuButton != null) {
return;
}
BotCommandsMenuView botCommandsMenuView = new BotCommandsMenuView(getContext());
this.botCommandsMenuButton = botCommandsMenuView;
botCommandsMenuView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivityEnterView.this.lambda$createBotCommandsMenuButton$23(view);
}
});
this.messageEditTextContainer.addView((View) this.botCommandsMenuButton, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-2, 32.0f, 83, 10.0f, 8.0f, 10.0f, 8.0f));
AndroidUtilities.updateViewVisibilityAnimated(this.botCommandsMenuButton, false, 1.0f, false);
this.botCommandsMenuButton.setExpanded(true, false);
}
public void lambda$createBotCommandsMenuButton$23(View view) {
boolean z = !this.botCommandsMenuButton.isOpened();
this.botCommandsMenuButton.setOpened(z);
try {
if (!PlusSettings.disableActionsVibrations) {
performHapticFeedback(3, 2);
}
} catch (Exception unused) {
}
if (!hasBotWebView()) {
if (z) {
createBotCommandsMenuContainer();
this.botCommandsMenuContainer.show();
return;
} else {
BotCommandsMenuContainer botCommandsMenuContainer = this.botCommandsMenuContainer;
if (botCommandsMenuContainer != null) {
botCommandsMenuContainer.dismiss();
return;
}
return;
}
}
if (z) {
if (this.emojiViewVisible || this.botKeyboardViewVisible) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.openWebViewMenu();
}
}, 275L);
hidePopup(false);
return;
} else {
openWebViewMenu();
return;
}
}
BotWebViewMenuContainer botWebViewMenuContainer = this.botWebViewMenuContainer;
if (botWebViewMenuContainer != null) {
botWebViewMenuContainer.dismiss();
}
}
public final void createBotWebViewButton() {
if (this.botWebViewButton != null) {
return;
}
ChatActivityBotWebViewButton chatActivityBotWebViewButton = new ChatActivityBotWebViewButton(getContext());
this.botWebViewButton = chatActivityBotWebViewButton;
chatActivityBotWebViewButton.setVisibility(8);
createBotCommandsMenuButton();
this.botWebViewButton.setBotMenuButton(this.botCommandsMenuButton);
this.messageEditTextContainer.addView((View) this.botWebViewButton, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, -1, 80));
}
public final void createRecordCircle() {
createControlsView();
if (this.recordCircle != null) {
return;
}
RecordCircle recordCircle = new RecordCircle(getContext());
this.recordCircle = recordCircle;
recordCircle.setVisibility(8);
this.sizeNotifierLayout.addView(this.recordCircle, LayoutHelper.createFrame(-1, -2, 80));
}
public final void createControlsView() {
if (this.controlsView != null) {
return;
}
ControlsView controlsView = new ControlsView(getContext());
this.controlsView = controlsView;
controlsView.setVisibility(8);
this.sizeNotifierLayout.addView(this.controlsView, LayoutHelper.createFrame(-1, -2, 80));
}
public final void showRestrictedHint() {
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if ((chatActivityEnterViewDelegate == null || !chatActivityEnterViewDelegate.checkCanRemoveRestrictionsByBoosts()) && DialogObject.isChatDialog(this.dialog_id)) {
BulletinFactory.of(this.parentFragment).createSimpleBulletin(R.raw.passcode_lock_close, LocaleController.formatString("SendPlainTextRestrictionHint", R.string.SendPlainTextRestrictionHint, new Object[]{ChatObject.getAllowedSendString(this.accountInstance.getMessagesController().getChat(Long.valueOf(-this.dialog_id)))}), 3).show();
}
}
public final void openWebViewMenu() {
createBotWebViewMenuContainer();
final Runnable runnable = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$openWebViewMenu$24();
}
};
if (SharedPrefsHelper.isWebViewConfirmShown(this.currentAccount, this.dialog_id)) {
runnable.run();
} else {
AlertsCreator.createBotLaunchAlert((BaseFragment) this.parentFragment, MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(this.dialog_id)), new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$openWebViewMenu$25(runnable);
}
}, new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$openWebViewMenu$26();
}
});
}
}
public void lambda$openWebViewMenu$24() {
AndroidUtilities.hideKeyboard(this);
if (AndroidUtilities.isTablet()) {
BotWebViewSheet botWebViewSheet = new BotWebViewSheet(getContext(), this.parentFragment.getResourceProvider());
botWebViewSheet.setParentActivity(this.parentActivity);
int i = this.currentAccount;
long j = this.dialog_id;
botWebViewSheet.requestWebView(i, j, j, this.botMenuWebViewTitle, this.botMenuWebViewUrl, 2, 0, false);
this.parentFragment.showDialog(botWebViewSheet);
BotCommandsMenuView botCommandsMenuView = this.botCommandsMenuButton;
if (botCommandsMenuView != null) {
botCommandsMenuView.setOpened(false);
return;
}
return;
}
this.botWebViewMenuContainer.show(this.currentAccount, this.dialog_id, this.botMenuWebViewUrl);
}
public void lambda$openWebViewMenu$25(Runnable runnable) {
runnable.run();
SharedPrefsHelper.setWebViewConfirmShown(this.currentAccount, this.dialog_id, true);
}
public void lambda$openWebViewMenu$26() {
if (this.botCommandsMenuButton == null || SharedPrefsHelper.isWebViewConfirmShown(this.currentAccount, this.dialog_id)) {
return;
}
this.botCommandsMenuButton.setOpened(false);
}
public void setBotWebViewButtonOffsetX(float offset) {
this.emojiButton.setTranslationX(offset);
if (this.messageEditText != null) {
this.messageTextTranslationX = offset;
updateMessageTextParams();
}
this.attachButton.setTranslationX(offset);
this.audioVideoSendButton.setTranslationX(offset);
ImageView imageView = this.botButton;
if (imageView != null) {
imageView.setTranslationX(offset);
}
}
public void setComposeShadowAlpha(float alpha) {
this.composeShadowAlpha = alpha;
invalidate();
}
public ChatActivityBotWebViewButton getBotWebViewButton() {
createBotWebViewButton();
return this.botWebViewButton;
}
@Override
public ChatActivity getParentFragment() {
return this.parentFragment;
}
public final void checkBotMenu() {
EditTextCaption editTextCaption = this.messageEditText;
boolean z = ((editTextCaption != null && !TextUtils.isEmpty(editTextCaption.getText())) || this.keyboardVisible || this.waitingForKeyboardOpen || isPopupShowing()) ? false : true;
if (z) {
createBotCommandsMenuButton();
}
BotCommandsMenuView botCommandsMenuView = this.botCommandsMenuButton;
if (botCommandsMenuView != null) {
boolean z2 = botCommandsMenuView.expanded;
botCommandsMenuView.setExpanded(z, true);
if (z2 != this.botCommandsMenuButton.expanded) {
beginDelayedTransition();
}
}
}
public void forceSmoothKeyboard(boolean smoothKeyboard) {
ChatActivity chatActivity;
this.smoothKeyboard = smoothKeyboard && !AndroidUtilities.isInMultiwindow && ((chatActivity = this.parentFragment) == null || !chatActivity.isInBubbleMode());
}
public final void updateTheme() {
GradientDrawable.Orientation orientation;
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0);
sharedPreferences.getInt("themeColor", -16738680);
this.messageEditText.setTextSize(Theme.chatEditTextSize);
this.messageEditText.setTextColor(sharedPreferences.getInt("chatEditTextColor", -16777216));
int intAlphaColor = AndroidUtilities.getIntAlphaColor("chatEditTextColor", -16777216, 0.35f);
this.messageEditText.setHintColor(Theme.chatEditTextColor != -16777216 ? intAlphaColor : -5066062);
EditTextCaption editTextCaption = this.messageEditText;
if (Theme.chatEditTextColor == -16777216) {
intAlphaColor = -5066062;
}
editTextCaption.setHintTextColor(intAlphaColor);
if (this.shouldDrawBackground) {
setBackgroundColor(Theme.chatEditTextBGColor);
this.textFieldContainer.setBackgroundColor(Theme.chatEditTextBGColor);
this.sendButtonContainer.setBackgroundColor(Theme.chatEditTextBGColor);
this.audioVideoButtonContainer.setBackgroundColor(Theme.chatEditTextBGColor);
int i = sharedPreferences.getInt("chatEditTextBGGradient", 0);
if (i > 0) {
if (i == 2) {
orientation = GradientDrawable.Orientation.LEFT_RIGHT;
} else if (i == 3) {
orientation = GradientDrawable.Orientation.TL_BR;
} else if (i == 4) {
orientation = GradientDrawable.Orientation.BL_TR;
} else {
orientation = GradientDrawable.Orientation.TOP_BOTTOM;
}
GradientDrawable gradientDrawable = new GradientDrawable(orientation, new int[]{Theme.chatEditTextBGColor, sharedPreferences.getInt("chatEditTextBGGradientColor", -1)});
setBackgroundDrawable(gradientDrawable);
this.textFieldContainer.setBackgroundDrawable(gradientDrawable);
this.sendButtonContainer.setBackgroundDrawable(gradientDrawable);
this.audioVideoButtonContainer.setBackgroundDrawable(gradientDrawable);
}
}
}
public final void startLockTransition() {
AnimatorSet animatorSet = new AnimatorSet();
if (!PlusSettings.disableActionsVibrations) {
performHapticFeedback(3, 2);
}
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this, "lockAnimatedTranslation", this.startTranslation);
ofFloat.setStartDelay(100L);
ofFloat.setDuration(350L);
ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(this, "snapAnimationProgress", 1.0f);
ofFloat2.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
ofFloat2.setDuration(250L);
SharedConfig.removeLockRecordAudioVideoHint();
animatorSet.playTogether(ofFloat2, ofFloat, ObjectAnimator.ofFloat(this, "slideToCancelProgress", 1.0f).setDuration(200L), ObjectAnimator.ofFloat(this.slideText, "cancelToProgress", 1.0f));
animatorSet.start();
}
public int getBackgroundTop() {
int top = getTop();
View view = this.topView;
return (view == null || view.getVisibility() != 0) ? top : top + this.topView.getLayoutParams().height;
}
public boolean drawChild(Canvas canvas, View child, long drawingTime) {
boolean z = child == this.topView || child == this.textFieldContainer;
if (z) {
canvas.save();
if (child == this.textFieldContainer) {
int dp = (int) (this.animatedTop + AndroidUtilities.dp(2.0f) + this.chatSearchExpandOffset);
View view = this.topView;
if (view != null && view.getVisibility() == 0) {
dp += this.topView.getHeight();
}
canvas.clipRect(0, dp, getMeasuredWidth(), getMeasuredHeight());
} else {
canvas.clipRect(0, this.animatedTop, getMeasuredWidth(), this.animatedTop + child.getLayoutParams().height + AndroidUtilities.dp(2.0f));
}
}
boolean drawChild = super/*android.widget.FrameLayout*/.drawChild(canvas, child, drawingTime);
if (z) {
canvas.restore();
}
return drawChild;
}
public void onDraw(Canvas canvas) {
if (this.shouldDrawBackground) {
int intrinsicHeight = (int) (this.animatedTop + (Theme.chat_composeShadowDrawable.getIntrinsicHeight() * (1.0f - this.composeShadowAlpha)));
View view = this.topView;
if (view != null && view.getVisibility() == 0) {
intrinsicHeight = (int) (intrinsicHeight + ((1.0f - this.topViewEnterProgress) * this.topView.getLayoutParams().height));
}
int intrinsicHeight2 = Theme.chat_composeShadowDrawable.getIntrinsicHeight() + intrinsicHeight;
Theme.chat_composeShadowDrawable.setAlpha((int) (this.composeShadowAlpha * 255.0f));
Theme.chat_composeShadowDrawable.setBounds(0, intrinsicHeight, getMeasuredWidth(), intrinsicHeight2);
Theme.chat_composeShadowDrawable.draw(canvas);
int i = (int) (intrinsicHeight2 + this.chatSearchExpandOffset);
if (this.allowBlur) {
this.backgroundPaint.setColor(getThemedColor(Theme.key_chat_messagePanelBackground));
if (SharedConfig.chatBlurEnabled() && this.sizeNotifierLayout != null) {
this.blurBounds.set(0, i, getWidth(), getHeight());
this.sizeNotifierLayout.drawBlurRect(canvas, getTop(), this.blurBounds, this.backgroundPaint, false);
return;
} else {
canvas.drawRect(0.0f, i, getWidth(), getHeight(), this.backgroundPaint);
return;
}
}
canvas.drawRect(0.0f, i, getWidth(), getHeight(), getThemedPaint("paintChatComposeBackground"));
}
}
public void lambda$new$27() {
MessageSendPreview messageSendPreview = this.messageSendPreview;
if (messageSendPreview != null) {
messageSendPreview.dismiss(true);
this.messageSendPreview = null;
}
}
public boolean onSendLongClick(android.view.View r19) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.Components.ChatActivityEnterView.onSendLongClick(android.view.View):boolean");
}
public void lambda$onSendLongClick$28(KeyEvent keyEvent) {
ActionBarPopupWindow actionBarPopupWindow;
if (keyEvent.getKeyCode() == 4 && keyEvent.getRepeatCount() == 0 && (actionBarPopupWindow = this.sendPopupWindow) != null && actionBarPopupWindow.isShowing()) {
this.sendPopupWindow.dismiss();
}
}
public void lambda$onSendLongClick$29(View view) {
ActionBarPopupWindow actionBarPopupWindow = this.sendPopupWindow;
if (actionBarPopupWindow != null && actionBarPopupWindow.isShowing()) {
this.sendPopupWindow.dismiss();
}
AlertsCreator.createScheduleDatePickerDialog(this.parentActivity, this.parentFragment.getDialogId(), new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public void didSelectDate(boolean notify, int scheduleDate) {
ChatActivityEnterView.this.sendMessageInternal(notify, scheduleDate, true);
}
}, this.resourcesProvider);
}
public void lambda$onSendLongClick$30(View view) {
ActionBarPopupWindow actionBarPopupWindow = this.sendPopupWindow;
if (actionBarPopupWindow != null && actionBarPopupWindow.isShowing()) {
this.sendPopupWindow.dismiss();
}
sendMessageInternal(true, 2147483646, true);
}
public void lambda$onSendLongClick$31(View view) {
ActionBarPopupWindow actionBarPopupWindow = this.sendPopupWindow;
if (actionBarPopupWindow != null && actionBarPopupWindow.isShowing()) {
this.sendPopupWindow.dismiss();
}
sendMessageInternal(false, 0, true);
}
public boolean lambda$onSendLongClick$32(View view) {
ActionBarPopupWindow actionBarPopupWindow = this.sendPopupWindow;
if (actionBarPopupWindow != null && actionBarPopupWindow.isShowing()) {
this.sendPopupWindow.dismiss();
}
this.dontUpdateDiscussionChat = true;
sendMessageInternal(true, 0, true);
return true;
}
public void lambda$onSendLongClick$33(View view) {
ActionBarPopupWindow actionBarPopupWindow = this.sendPopupWindow;
if (actionBarPopupWindow != null && actionBarPopupWindow.isShowing()) {
this.sendPopupWindow.dismiss();
}
translateMessage();
}
public void lambda$onSendLongClick$34(DialogInterface dialogInterface) {
this.messageSendPreview = null;
}
public void lambda$onSendLongClick$35(boolean z, View view) {
MessageSendPreview messageSendPreview;
this.sentFromPreview = System.currentTimeMillis();
sendMessage();
if (!z && (messageSendPreview = this.messageSendPreview) != null) {
messageSendPreview.dismiss(true);
this.messageSendPreview = null;
} else {
AndroidUtilities.cancelRunOnUIThread(this.dismissSendPreview);
AndroidUtilities.runOnUIThread(this.dismissSendPreview, 500L);
}
}
public void lambda$onSendLongClick$36() {
AlertsCreator.createScheduleDatePickerDialog(this.parentActivity, this.parentFragment.getDialogId(), new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public void didSelectDate(boolean notify, int scheduleDate) {
ChatActivityEnterView.this.sendMessageInternal(notify, scheduleDate, true);
MessageSendPreview messageSendPreview = ChatActivityEnterView.this.messageSendPreview;
if (messageSendPreview != null) {
messageSendPreview.dismiss(true);
ChatActivityEnterView.this.messageSendPreview = null;
}
}
}, this.resourcesProvider);
}
public void lambda$onSendLongClick$37() {
sendMessageInternal(true, 2147483646, true);
MessageSendPreview messageSendPreview = this.messageSendPreview;
if (messageSendPreview != null) {
messageSendPreview.dismiss(true);
this.messageSendPreview = null;
}
}
public void lambda$onSendLongClick$38(boolean z) {
MessageSendPreview messageSendPreview;
this.sentFromPreview = System.currentTimeMillis();
sendMessageInternal(false, 0, true);
if (!z && (messageSendPreview = this.messageSendPreview) != null) {
messageSendPreview.dismiss(true);
this.messageSendPreview = null;
} else {
AndroidUtilities.cancelRunOnUIThread(this.dismissSendPreview);
AndroidUtilities.runOnUIThread(this.dismissSendPreview, 500L);
}
}
public void lambda$onSendLongClick$39() {
translateMessage();
MessageSendPreview messageSendPreview = this.messageSendPreview;
if (messageSendPreview != null) {
messageSendPreview.dismiss(true);
this.messageSendPreview = null;
} else {
AndroidUtilities.cancelRunOnUIThread(this.dismissSendPreview);
AndroidUtilities.runOnUIThread(this.dismissSendPreview, 500L);
}
}
public final void createBotCommandsMenuContainer() {
if (this.botCommandsMenuContainer != null) {
return;
}
BotCommandsMenuContainer botCommandsMenuContainer = new BotCommandsMenuContainer(getContext()) {
public boolean ignoreLayout = false;
public void onDismiss() {
super.onDismiss();
if (ChatActivityEnterView.this.botCommandsMenuButton != null) {
ChatActivityEnterView.this.botCommandsMenuButton.setOpened(false);
}
}
public void onLayout(boolean changed, int left, int top, int right, int bottom) {
super/*android.widget.FrameLayout*/.onLayout(changed, left, top, right, bottom);
if (this.ignoreLayout) {
return;
}
this.ignoreLayout = true;
ChatActivityEnterView.this.updateBotCommandsMenuContainerTopPadding();
}
};
this.botCommandsMenuContainer = botCommandsMenuContainer;
botCommandsMenuContainer.listView.setLayoutManager(new LinearLayoutManager(getContext()));
RecyclerListView recyclerListView = this.botCommandsMenuContainer.listView;
BotCommandsMenuView.BotCommandsAdapter botCommandsAdapter = new BotCommandsMenuView.BotCommandsAdapter();
this.botCommandsAdapter = botCommandsAdapter;
recyclerListView.setAdapter(botCommandsAdapter);
this.botCommandsMenuContainer.listView.setOnItemClickListener(new AnonymousClass40());
this.botCommandsMenuContainer.listView.setOnItemLongClickListener(new RecyclerListView.OnItemLongClickListener() {
@Override
public boolean onItemClick(View view, int position) {
if (!(view instanceof BotCommandsMenuView.BotCommandView)) {
return false;
}
String command = ((BotCommandsMenuView.BotCommandView) view).getCommand();
ChatActivityEnterView.this.setFieldText(command + " ");
ChatActivityEnterView.this.botCommandsMenuContainer.dismiss();
return true;
}
});
this.botCommandsMenuContainer.setClipToPadding(false);
this.sizeNotifierLayout.addView((View) this.botCommandsMenuContainer, 14, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, -1, 80));
this.botCommandsMenuContainer.setVisibility(8);
LongSparseArray<TLRPC.BotInfo> longSparseArray = this.lastBotInfo;
if (longSparseArray != null) {
this.botCommandsAdapter.setBotInfo(longSparseArray);
}
updateBotCommandsMenuContainerTopPadding();
}
public class AnonymousClass40 implements RecyclerListView.OnItemClickListener {
public AnonymousClass40() {
}
@Override
public void onItemClick(View view, int position) {
if (view instanceof BotCommandsMenuView.BotCommandView) {
final String command = ((BotCommandsMenuView.BotCommandView) view).getCommand();
if (TextUtils.isEmpty(command)) {
return;
}
if (ChatActivityEnterView.this.isInScheduleMode()) {
AlertsCreator.createScheduleDatePickerDialog(ChatActivityEnterView.this.parentActivity, ChatActivityEnterView.this.dialog_id, new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public final void didSelectDate(boolean z, int i) {
ChatActivityEnterView.AnonymousClass40.this.lambda$onItemClick$0(command, z, i);
}
}, ChatActivityEnterView.this.resourcesProvider);
return;
}
if (ChatActivityEnterView.this.parentFragment == null || !ChatActivityEnterView.this.parentFragment.checkSlowMode(view)) {
SendMessagesHelper$SendMessageParams of = SendMessagesHelper$SendMessageParams.of(command, ChatActivityEnterView.this.dialog_id, ChatActivityEnterView.this.replyingMessageObject, ChatActivityEnterView.this.getThreadMessage(), null, false, null, null, null, true, 0, null, false);
of.quick_reply_shortcut = ChatActivityEnterView.this.parentFragment != null ? ChatActivityEnterView.this.parentFragment.quickReplyShortcut : null;
of.quick_reply_shortcut_id = ChatActivityEnterView.this.parentFragment != null ? ChatActivityEnterView.this.parentFragment.getQuickReplyId() : 0;
MessageSendPreview messageSendPreview = ChatActivityEnterView.this.messageSendPreview;
of.effect_id = messageSendPreview != null ? messageSendPreview.getSelectedEffect() : 0L;
SendMessagesHelper.getInstance(ChatActivityEnterView.this.currentAccount).sendMessage(of);
ChatActivityEnterView.this.setFieldText(BuildConfig.APP_CENTER_HASH);
ChatActivityEnterView.this.botCommandsMenuContainer.dismiss();
}
}
}
public void lambda$onItemClick$0(String str, boolean z, int i) {
SendMessagesHelper.getInstance(ChatActivityEnterView.this.currentAccount).sendMessage(SendMessagesHelper$SendMessageParams.of(str, ChatActivityEnterView.this.dialog_id, ChatActivityEnterView.this.replyingMessageObject, ChatActivityEnterView.this.getThreadMessage(), null, false, null, null, null, z, i, null, false));
ChatActivityEnterView.this.setFieldText(BuildConfig.APP_CENTER_HASH);
ChatActivityEnterView.this.botCommandsMenuContainer.dismiss();
}
}
public final void updateBotCommandsMenuContainerTopPadding() {
int max;
LinearLayoutManager layoutManager;
int findFirstVisibleItemPosition;
View findViewByPosition;
BotCommandsMenuContainer botCommandsMenuContainer = this.botCommandsMenuContainer;
if (botCommandsMenuContainer == null) {
return;
}
int childCount = botCommandsMenuContainer.listView.getChildCount();
int i = 0;
for (int i2 = 0; i2 < childCount; i2++) {
View childAt = this.botCommandsMenuContainer.listView.getChildAt(i2);
if (i2 < 4) {
i += childAt.getMeasuredHeight();
}
}
if (i > 0) {
max = Math.max(0, ((this.sizeNotifierLayout.getMeasuredHeight() - i) - AndroidUtilities.dp(8.0f)) - AndroidUtilities.dp(childCount > 4 ? 12.0f : 0.0f));
} else if (this.botCommandsAdapter.getItemCount() > 4) {
max = Math.max(0, this.sizeNotifierLayout.getMeasuredHeight() - AndroidUtilities.dp(162.8f));
} else {
max = Math.max(0, this.sizeNotifierLayout.getMeasuredHeight() - AndroidUtilities.dp((Math.max(1, Math.min(4, this.botCommandsAdapter.getItemCount())) * 36) + 8));
}
if (this.botCommandsMenuContainer.listView.getPaddingTop() != max) {
this.botCommandsMenuContainer.listView.setTopGlowOffset(max);
if (this.botCommandLastPosition == -1 && this.botCommandsMenuContainer.getVisibility() == 0 && this.botCommandsMenuContainer.listView.getLayoutManager() != null && (findFirstVisibleItemPosition = (layoutManager = this.botCommandsMenuContainer.listView.getLayoutManager()).findFirstVisibleItemPosition()) >= 0 && (findViewByPosition = layoutManager.findViewByPosition(findFirstVisibleItemPosition)) != null) {
this.botCommandLastPosition = findFirstVisibleItemPosition;
this.botCommandLastTop = findViewByPosition.getTop() - this.botCommandsMenuContainer.listView.getPaddingTop();
}
this.botCommandsMenuContainer.listView.setPadding(0, max, 0, AndroidUtilities.dp(8.0f));
}
}
public final void createBotWebViewMenuContainer() {
if (this.botWebViewMenuContainer != null) {
return;
}
View view = new BotWebViewMenuContainer(getContext(), this) {
public void onDismiss() {
super.onDismiss();
if (ChatActivityEnterView.this.botCommandsMenuButton != null) {
ChatActivityEnterView.this.botCommandsMenuButton.setOpened(false);
}
}
};
this.botWebViewMenuContainer = view;
this.sizeNotifierLayout.addView(view, 15, LayoutHelper.createFrame(-1, -1, 80));
this.botWebViewMenuContainer.setVisibility(8);
this.botWebViewMenuContainer.setOnDismissGlobalListener(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$createBotWebViewMenuContainer$41();
}
});
}
public void lambda$createBotWebViewMenuContainer$41() {
if (this.botButtonsMessageObject != null) {
EditTextCaption editTextCaption = this.messageEditText;
if ((editTextCaption == null || TextUtils.isEmpty(editTextCaption.getTextToUse())) && !this.botWebViewMenuContainer.hasSavedText()) {
showPopup(1, 1);
}
}
}
public class ChatActivityEditTextCaption extends EditTextCaption {
public CanvasButton canvasButton;
public ChatActivityEditTextCaption(Context context, Theme.ResourcesProvider resourcesProvider) {
super(context, resourcesProvider);
}
@Override
public void onScrollChanged(int horiz, int vert, int oldHoriz, int oldVert) {
super.onScrollChanged(horiz, vert, oldHoriz, oldVert);
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterView.this.delegate.onEditTextScroll();
}
}
@Override
public void onContextMenuOpen() {
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterView.this.delegate.onContextMenuOpen();
}
}
@Override
public void onContextMenuClose() {
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterView.this.delegate.onContextMenuClose();
}
}
public final void lambda$onCreateInputConnection$0(InputContentInfoCompat inputContentInfo, boolean notify, int scheduleDate) {
MessageSendPreview messageSendPreview = ChatActivityEnterView.this.messageSendPreview;
if (messageSendPreview != null) {
messageSendPreview.dismiss(true);
ChatActivityEnterView.this.messageSendPreview = null;
}
if (ChatActivityEnterView.this.replyingQuote != null && ChatActivityEnterView.this.parentFragment != null && ChatActivityEnterView.this.replyingQuote.outdated) {
ChatActivityEnterView.this.parentFragment.showQuoteMessageUpdate();
return;
}
if (inputContentInfo.getDescription().hasMimeType("image/gif")) {
SendMessagesHelper.prepareSendingDocument(ChatActivityEnterView.this.accountInstance, (String) null, (String) null, inputContentInfo.getContentUri(), (String) null, "image/gif", ChatActivityEnterView.this.dialog_id, ChatActivityEnterView.this.replyingMessageObject, ChatActivityEnterView.this.getThreadMessage(), (TL_stories$StoryItem) null, ChatActivityEnterView.this.replyingQuote, (MessageObject) null, notify, 0, inputContentInfo, ChatActivityEnterView.this.parentFragment != null ? ChatActivityEnterView.this.parentFragment.quickReplyShortcut : null, ChatActivityEnterView.this.parentFragment != null ? ChatActivityEnterView.this.parentFragment.getQuickReplyId() : 0, false);
} else {
SendMessagesHelper.prepareSendingPhoto(ChatActivityEnterView.this.accountInstance, (String) null, inputContentInfo.getContentUri(), ChatActivityEnterView.this.dialog_id, ChatActivityEnterView.this.replyingMessageObject, ChatActivityEnterView.this.getThreadMessage(), ChatActivityEnterView.this.replyingQuote, (CharSequence) null, (ArrayList) null, (ArrayList) null, inputContentInfo, 0, (MessageObject) null, notify, 0, ChatActivityEnterView.this.parentFragment == null ? 0 : ChatActivityEnterView.this.parentFragment.getChatMode(), ChatActivityEnterView.this.parentFragment != null ? ChatActivityEnterView.this.parentFragment.quickReplyShortcut : null, ChatActivityEnterView.this.parentFragment != null ? ChatActivityEnterView.this.parentFragment.getQuickReplyId() : 0);
}
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterView.this.delegate.onMessageSend(null, true, scheduleDate);
}
}
@Override
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
InputConnection onCreateInputConnection = super.onCreateInputConnection(editorInfo);
if (onCreateInputConnection == null) {
return null;
}
try {
if (ChatActivityEnterView.this.isEditingBusinessLink()) {
EditorInfoCompat.setContentMimeTypes(editorInfo, (String[]) null);
} else {
EditorInfoCompat.setContentMimeTypes(editorInfo, new String[]{"image/gif", "image/*", "image/jpg", "image/png", "image/webp"});
}
return InputConnectionCompat.createWrapper(onCreateInputConnection, editorInfo, new InputConnectionCompat.OnCommitContentListener() {
public final boolean onCommitContent(InputContentInfoCompat inputContentInfoCompat, int i, Bundle bundle) {
boolean lambda$onCreateInputConnection$1;
lambda$onCreateInputConnection$1 = ChatActivityEnterView.ChatActivityEditTextCaption.this.lambda$onCreateInputConnection$1(inputContentInfoCompat, i, bundle);
return lambda$onCreateInputConnection$1;
}
});
} catch (Throwable th) {
FileLog.e(th);
return onCreateInputConnection;
}
}
public boolean lambda$onCreateInputConnection$1(final InputContentInfoCompat inputContentInfoCompat, int i, Bundle bundle) {
if (BuildCompat.isAtLeastNMR1() && (i & 1) != 0) {
try {
inputContentInfoCompat.requestPermission();
} catch (Exception unused) {
return false;
}
}
if (inputContentInfoCompat.getDescription().hasMimeType("image/gif") || SendMessagesHelper.shouldSendWebPAsSticker((String) null, inputContentInfoCompat.getContentUri())) {
if (ChatActivityEnterView.this.isInScheduleMode()) {
AlertsCreator.createScheduleDatePickerDialog(ChatActivityEnterView.this.parentActivity, ChatActivityEnterView.this.parentFragment.getDialogId(), new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public final void didSelectDate(boolean z, int i2) {
ChatActivityEnterView.ChatActivityEditTextCaption.this.lambda$onCreateInputConnection$0(inputContentInfoCompat, z, i2);
}
}, this.resourcesProvider);
} else {
lambda$onCreateInputConnection$0(inputContentInfoCompat, true, 0);
}
} else {
editPhoto(inputContentInfoCompat.getContentUri(), inputContentInfoCompat.getDescription().getMimeType(0));
}
return true;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (!ChatActivityEnterView.this.stickersDragging && ChatActivityEnterView.this.stickersExpansionAnim == null) {
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
if (!chatActivityEnterView.sendPlainEnabled && !chatActivityEnterView.isEditingMessage()) {
if (this.canvasButton == null) {
CanvasButton canvasButton = new CanvasButton(this);
this.canvasButton = canvasButton;
canvasButton.setDelegate(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.ChatActivityEditTextCaption.this.lambda$onTouchEvent$2();
}
});
}
this.canvasButton.setRect(0, 0, getMeasuredWidth(), getMeasuredHeight());
return this.canvasButton.checkTouchEvent(event);
}
if (ChatActivityEnterView.this.isPopupShowing() && event.getAction() == 0) {
if (ChatActivityEnterView.this.searchingType != 0) {
ChatActivityEnterView.this.setSearchingTypeInternal(0, false);
ChatActivityEnterView.this.emojiView.closeSearch(false);
requestFocus();
}
ChatActivityEnterView.this.showPopup(AndroidUtilities.usingHardwareInput ? 0 : 2, 0);
if (ChatActivityEnterView.this.stickersExpanded) {
ChatActivityEnterView.this.setStickersExpanded(false, true, false);
ChatActivityEnterView.this.waitingForKeyboardOpenAfterAnimation = true;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.ChatActivityEditTextCaption.this.lambda$onTouchEvent$3();
}
}, 200L);
} else {
ChatActivityEnterView.this.openKeyboardInternal();
}
return true;
}
try {
return super.onTouchEvent(event);
} catch (Exception e) {
FileLog.e(e);
}
}
return false;
}
public void lambda$onTouchEvent$2() {
ChatActivityEnterView.this.showRestrictedHint();
}
public void lambda$onTouchEvent$3() {
ChatActivityEnterView.this.waitingForKeyboardOpenAfterAnimation = false;
ChatActivityEnterView.this.openKeyboardInternal();
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (ChatActivityEnterView.this.preventInput) {
return false;
}
return super.dispatchKeyEvent(event);
}
@Override
public void onSelectionChanged(int selStart, int selEnd) {
super.onSelectionChanged(selStart, selEnd);
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterView.this.delegate.onTextSelectionChanged(selStart, selEnd);
}
}
@Override
public void extendActionMode(ActionMode actionMode, Menu menu) {
if (ChatActivityEnterView.this.parentFragment != null) {
ChatActivityEnterView.this.parentFragment.extendActionMode(menu);
} else {
ChatActivityEnterView.this.extendActionMode(menu);
}
}
@Override
public boolean requestRectangleOnScreen(android.graphics.Rect rectangle) {
rectangle.bottom += AndroidUtilities.dp(1000.0f);
return super.requestRectangleOnScreen(rectangle);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
ChatActivityEnterView.this.isInitLineCount = getMeasuredWidth() == 0 && getMeasuredHeight() == 0;
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (ChatActivityEnterView.this.isInitLineCount) {
ChatActivityEnterView.this.lineCount = getLineCount();
}
ChatActivityEnterView.this.isInitLineCount = false;
}
@Override
public boolean onTextContextMenuItem(int id) {
if (id == 16908322) {
ChatActivityEnterView.this.isPaste = true;
ClipData primaryClip = ((ClipboardManager) getContext().getSystemService("clipboard")).getPrimaryClip();
if (primaryClip != null && primaryClip.getItemCount() == 1 && primaryClip.getDescription().hasMimeType("image/*") && !ChatActivityEnterView.this.isEditingBusinessLink()) {
editPhoto(primaryClip.getItemAt(0).getUri(), primaryClip.getDescription().getMimeType(0));
}
}
return super.onTextContextMenuItem(id);
}
public final void editPhoto(final Uri uri, String mime) {
final File generatePicturePath = AndroidUtilities.generatePicturePath(ChatActivityEnterView.this.parentFragment != null && ChatActivityEnterView.this.parentFragment.isSecretChat(), MimeTypeMap.getSingleton().getExtensionFromMimeType(mime));
Utilities.globalQueue.postRunnable(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.ChatActivityEditTextCaption.this.lambda$editPhoto$5(uri, generatePicturePath);
}
});
}
public void lambda$editPhoto$5(Uri uri, final File file) {
try {
InputStream openInputStream = getContext().getContentResolver().openInputStream(uri);
FileOutputStream fileOutputStream = new FileOutputStream(file);
byte[] bArr = new byte[1024];
while (true) {
int read = openInputStream.read(bArr);
if (read > 0) {
fileOutputStream.write(bArr, 0, read);
fileOutputStream.flush();
} else {
openInputStream.close();
fileOutputStream.close();
MediaController$PhotoEntry mediaController$PhotoEntry = new MediaController$PhotoEntry(0, -1, 0L, file.getAbsolutePath(), 0, false, 0, 0, 0L);
final ArrayList arrayList = new ArrayList();
arrayList.add(mediaController$PhotoEntry);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.ChatActivityEditTextCaption.this.lambda$editPhoto$4(arrayList, file);
}
});
return;
}
}
} catch (Throwable th) {
th.printStackTrace();
}
}
public final void lambda$editPhoto$4(final ArrayList<Object> entries, final File sourceFile) {
if (ChatActivityEnterView.this.parentFragment == null || ChatActivityEnterView.this.parentFragment.getParentActivity() == null) {
return;
}
final MediaController$PhotoEntry mediaController$PhotoEntry = (MediaController$PhotoEntry) entries.get(0);
if (ChatActivityEnterView.this.keyboardVisible) {
AndroidUtilities.hideKeyboard(this);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
ChatActivityEditTextCaption.this.lambda$editPhoto$4(entries, sourceFile);
}
}, 100L);
} else {
PhotoViewer.getInstance().setParentActivity(ChatActivityEnterView.this.parentFragment, this.resourcesProvider);
PhotoViewer.getInstance().openPhotoForSelect(entries, 0, 2, false, new PhotoViewer.EmptyPhotoViewerProvider() {
public boolean sending;
public boolean canCaptureMorePhotos() {
return false;
}
public void sendButtonPressed(int index, VideoEditedInfo videoEditedInfo, boolean notify, int scheduleDate, boolean forceDocument) {
String str;
if (ChatActivityEnterView.this.replyingQuote != null && ChatActivityEnterView.this.parentFragment != null && ChatActivityEnterView.this.replyingQuote.outdated) {
ChatActivityEnterView.this.parentFragment.showQuoteMessageUpdate();
return;
}
ArrayList arrayList = new ArrayList();
SendMessagesHelper$SendingMediaInfo sendMessagesHelper$SendingMediaInfo = new SendMessagesHelper$SendingMediaInfo();
MediaController$PhotoEntry mediaController$PhotoEntry2 = mediaController$PhotoEntry;
boolean z = mediaController$PhotoEntry2.isVideo;
if (!z && (str = mediaController$PhotoEntry2.imagePath) != null) {
sendMessagesHelper$SendingMediaInfo.path = str;
} else {
String str2 = mediaController$PhotoEntry2.path;
if (str2 != null) {
sendMessagesHelper$SendingMediaInfo.path = str2;
}
}
sendMessagesHelper$SendingMediaInfo.thumbPath = mediaController$PhotoEntry2.thumbPath;
sendMessagesHelper$SendingMediaInfo.isVideo = z;
CharSequence charSequence = mediaController$PhotoEntry2.caption;
sendMessagesHelper$SendingMediaInfo.caption = charSequence != null ? charSequence.toString() : null;
MediaController$PhotoEntry mediaController$PhotoEntry3 = mediaController$PhotoEntry;
sendMessagesHelper$SendingMediaInfo.entities = mediaController$PhotoEntry3.entities;
sendMessagesHelper$SendingMediaInfo.masks = mediaController$PhotoEntry3.stickers;
sendMessagesHelper$SendingMediaInfo.ttl = mediaController$PhotoEntry3.ttl;
sendMessagesHelper$SendingMediaInfo.videoEditedInfo = videoEditedInfo;
sendMessagesHelper$SendingMediaInfo.canDeleteAfter = true;
arrayList.add(sendMessagesHelper$SendingMediaInfo);
mediaController$PhotoEntry.reset();
this.sending = true;
SendMessagesHelper.prepareSendingMedia(ChatActivityEnterView.this.accountInstance, arrayList, ChatActivityEnterView.this.dialog_id, ChatActivityEnterView.this.replyingMessageObject, ChatActivityEnterView.this.getThreadMessage(), (TL_stories$StoryItem) null, ChatActivityEnterView.this.replyingQuote, false, false, ChatActivityEnterView.this.editingMessageObject, notify, scheduleDate, ChatActivityEnterView.this.parentFragment == null ? 0 : ChatActivityEnterView.this.parentFragment.getChatMode(), SendMessagesHelper.checkUpdateStickersOrder(sendMessagesHelper$SendingMediaInfo.caption), (InputContentInfoCompat) null, ChatActivityEnterView.this.parentFragment != null ? ChatActivityEnterView.this.parentFragment.quickReplyShortcut : null, ChatActivityEnterView.this.parentFragment != null ? ChatActivityEnterView.this.parentFragment.getQuickReplyId() : 0, 0L, false);
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterView.this.delegate.onMessageSend(null, true, scheduleDate);
}
}
public void willHidePhotoViewer() {
if (this.sending) {
return;
}
try {
sourceFile.delete();
} catch (Throwable unused) {
}
}
}, ChatActivityEnterView.this.parentFragment);
}
}
@Override
public Theme.ResourcesProvider getResourcesProvider() {
return this.resourcesProvider;
}
@Override
public boolean requestFocus(int direction, android.graphics.Rect previouslyFocusedRect) {
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
if (chatActivityEnterView.sendPlainEnabled || chatActivityEnterView.isEditingMessage()) {
return super.requestFocus(direction, previouslyFocusedRect);
}
return false;
}
@Override
public void setOffsetY(float offset) {
super.setOffsetY(offset);
if (ChatActivityEnterView.this.sizeNotifierLayout.getForeground() != null) {
ChatActivityEnterView.this.sizeNotifierLayout.invalidateDrawable(ChatActivityEnterView.this.sizeNotifierLayout.getForeground());
}
}
}
public final boolean isKeyboardSupportIncognitoMode() {
String string = Settings.Secure.getString(getContext().getContentResolver(), "default_input_method");
return string == null || !string.startsWith("com.samsung");
}
public final void createMessageEditText() {
if (this.messageEditText != null) {
return;
}
ChatActivityEditTextCaption chatActivityEditTextCaption = new ChatActivityEditTextCaption(getContext(), this.resourcesProvider) {
public boolean clickMaybe;
public float touchX;
public float touchY;
@Override
public boolean onTouchEvent(MotionEvent event) {
if (ChatActivityEnterView.this.botCommandsMenuIsShowing()) {
if (event.getAction() == 0) {
this.touchX = event.getX();
this.touchY = event.getY();
this.clickMaybe = true;
} else if (this.clickMaybe && event.getAction() == 2) {
if (Math.abs(event.getX() - this.touchX) > AndroidUtilities.touchSlop || Math.abs(event.getY() - this.touchY) > AndroidUtilities.touchSlop) {
this.clickMaybe = false;
}
} else if (this.clickMaybe) {
if (ChatActivityEnterView.this.delegate != null) {
fixHandlesColor();
ChatActivityEnterView.this.delegate.onKeyboardRequested();
}
EditTextCaption editTextCaption = ChatActivityEnterView.this.messageEditText;
if (editTextCaption != null && !AndroidUtilities.showKeyboard(editTextCaption)) {
ChatActivityEnterView.this.messageEditText.clearFocus();
ChatActivityEnterView.this.messageEditText.requestFocus();
}
}
return this.clickMaybe;
}
if (event.getAction() == 0 && ChatActivityEnterView.this.delegate != null) {
fixHandlesColor();
ChatActivityEnterView.this.delegate.onKeyboardRequested();
}
return super.onTouchEvent(event);
}
public final void fixHandlesColor() {
setHandlesColor(ChatActivityEnterView.this.getThemedColor(Theme.key_chat_TextSelectionCursor));
}
@Override
public void setOffsetY(float offset) {
super.setOffsetY(offset);
ChatActivityEnterView.this.messageEditTextContainer.invalidate();
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
if (ChatActivityEnterView.this.parentFragment != null && ChatActivityEnterView.this.parentFragment.getParentLayout() != null && ChatActivityEnterView.this.parentFragment.getParentLayout().isSheet()) {
setWindowView(ChatActivityEnterView.this.parentFragment.getParentLayout().getWindow().getDecorView());
} else {
setWindowView(ChatActivityEnterView.this.parentActivity.getWindow().getDecorView());
}
}
};
this.messageEditText = chatActivityEditTextCaption;
if (Build.VERSION.SDK_INT >= 28) {
chatActivityEditTextCaption.setFallbackLineSpacing(false);
}
this.messageEditText.setDelegate(new EditTextCaption.EditTextCaptionDelegate() {
@Override
public final void onSpansChanged() {
ChatActivityEnterView.this.lambda$createMessageEditText$42();
}
});
ChatActivity chatActivity = this.parentFragment;
if (chatActivity != null && chatActivity.getParentLayout() != null && this.parentFragment.getParentLayout().isSheet()) {
this.messageEditText.setWindowView(this.parentFragment.getParentLayout().getWindow().getDecorView());
} else {
this.messageEditText.setWindowView(this.parentActivity.getWindow().getDecorView());
}
ChatActivity chatActivity2 = this.parentFragment;
TLRPC.EncryptedChat currentEncryptedChat = chatActivity2 != null ? chatActivity2.getCurrentEncryptedChat() : null;
this.messageEditText.setAllowTextEntitiesIntersection(supportsSendingNewEntities());
int i = 268435456;
if (isKeyboardSupportIncognitoMode() && currentEncryptedChat != null) {
i = 285212672;
}
this.messageEditText.setIncludeFontPadding(false);
this.messageEditText.setImeOptions(i);
EditTextCaption editTextCaption = this.messageEditText;
int inputType = editTextCaption.getInputType() | LiteMode.FLAG_ANIMATED_EMOJI_KEYBOARD_NOT_PREMIUM | 131072;
this.commonInputType = inputType;
editTextCaption.setInputType(inputType);
updateFieldHint(false);
this.messageEditText.setSingleLine(false);
this.messageEditText.setMaxLines(6);
this.messageEditText.setTextSize(1, Theme.usePlusTheme ? Theme.chatEditTextSize : 18.0f);
this.messageEditText.setGravity(80);
this.messageEditText.setPadding(0, AndroidUtilities.dp(11.0f), 0, AndroidUtilities.dp(12.0f));
this.messageEditText.setBackgroundDrawable(null);
this.messageEditText.setTextColor(Theme.usePlusTheme ? Theme.chatEditTextColor : getThemedColor(Theme.key_chat_messagePanelText));
this.messageEditText.setLinkTextColor(getThemedColor(Theme.key_chat_messageLinkOut));
this.messageEditText.setHighlightColor(getThemedColor(Theme.key_chat_inTextSelectionHighlight));
EditTextCaption editTextCaption2 = this.messageEditText;
int i2 = Theme.key_chat_messagePanelHint;
editTextCaption2.setHintColor(getThemedColor(i2));
this.messageEditText.setHintTextColor(getThemedColor(i2));
this.messageEditText.setCursorColor(Theme.usePlusTheme ? Theme.chatEditTextColor : getThemedColor(Theme.key_chat_messagePanelCursor));
this.messageEditText.setHandlesColor(getThemedColor(Theme.key_chat_TextSelectionCursor));
this.messageEditTextContainer.addView(this.messageEditText, 1, LayoutHelper.createFrame(-1, -2.0f, 80, 52.0f, 0.0f, this.isChat ? 50.0f : 2.0f, 1.5f));
this.messageEditText.setOnKeyListener(new View.OnKeyListener() {
public boolean ctrlPressed = false;
@Override
public boolean onKey(View view, int keyCode, KeyEvent keyEvent) {
if (keyCode == 4 && !ChatActivityEnterView.this.keyboardVisible && ChatActivityEnterView.this.isPopupShowing() && keyEvent.getAction() == 1) {
if (ContentPreviewViewer.hasInstance() && ContentPreviewViewer.getInstance().isVisible()) {
ContentPreviewViewer.getInstance().closeWithMenu();
return true;
}
if (ChatActivityEnterView.this.currentPopupContentType == 1 && ChatActivityEnterView.this.botButtonsMessageObject != null) {
return false;
}
if (keyEvent.getAction() == 1) {
if (ChatActivityEnterView.this.currentPopupContentType == 1 && ChatActivityEnterView.this.botButtonsMessageObject != null) {
MessagesController.getMainSettings(ChatActivityEnterView.this.currentAccount).edit().putInt("hidekeyboard_" + ChatActivityEnterView.this.dialog_id, ChatActivityEnterView.this.botButtonsMessageObject.getId()).commit();
}
if (ChatActivityEnterView.this.searchingType != 0) {
ChatActivityEnterView.this.setSearchingTypeInternal(0, true);
if (ChatActivityEnterView.this.emojiView != null) {
ChatActivityEnterView.this.emojiView.closeSearch(true);
}
ChatActivityEnterView.this.messageEditText.requestFocus();
} else if (ChatActivityEnterView.this.stickersExpanded) {
ChatActivityEnterView.this.setStickersExpanded(false, true, false);
} else if (ChatActivityEnterView.this.stickersExpansionAnim == null) {
if (ChatActivityEnterView.this.botButtonsMessageObject != null && ChatActivityEnterView.this.currentPopupContentType != 1 && TextUtils.isEmpty(ChatActivityEnterView.this.messageEditText.getTextToUse())) {
ChatActivityEnterView.this.showPopup(1, 1);
} else {
ChatActivityEnterView.this.showPopup(0, 0);
}
}
}
return true;
}
if (keyCode == 66 && ((this.ctrlPressed || ChatActivityEnterView.this.sendByEnter) && keyEvent.getAction() == 0 && ChatActivityEnterView.this.editingMessageObject == null)) {
ChatActivityEnterView.this.sendMessage();
return true;
}
if (keyCode != 113 && keyCode != 114) {
return false;
}
this.ctrlPressed = keyEvent.getAction() == 0;
return true;
}
});
this.messageEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
public boolean ctrlPressed = false;
@Override
public boolean onEditorAction(TextView textView, int i3, KeyEvent keyEvent) {
if (i3 == 4) {
ChatActivityEnterView.this.sendMessage();
return true;
}
if (keyEvent == null || i3 != 0) {
return false;
}
if ((!this.ctrlPressed && !ChatActivityEnterView.this.sendByEnter) || keyEvent.getAction() != 0 || ChatActivityEnterView.this.editingMessageObject != null) {
return false;
}
ChatActivityEnterView.this.sendMessage();
return true;
}
});
this.messageEditText.addTextChangedListener(new AnonymousClass46());
this.messageEditText.addTextChangedListener(new EditTextSuggestionsFix());
this.messageEditText.setEnabled(this.messageEditTextEnabled);
ArrayList<TextWatcher> arrayList = this.messageEditTextWatchers;
if (arrayList != null) {
Iterator<TextWatcher> it = arrayList.iterator();
while (it.hasNext()) {
this.messageEditText.addTextChangedListener(it.next());
}
this.messageEditTextWatchers.clear();
}
updateFieldHint(false);
ChatActivity chatActivity3 = this.parentFragment;
updateSendAsButton(chatActivity3 != null && chatActivity3.getFragmentBeginToShow());
ChatActivity chatActivity4 = this.parentFragment;
if (chatActivity4 != null) {
chatActivity4.applyDraftMaybe(false);
}
}
public void lambda$createMessageEditText$42() {
this.messageEditText.invalidateEffects();
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
chatActivityEnterViewDelegate.onTextSpansChanged(this.messageEditText.getTextToUse());
}
}
public class AnonymousClass46 implements TextWatcher {
public boolean heightShouldBeChanged;
public boolean ignorePrevTextChange;
public boolean nextChangeIsSend;
public CharSequence prevText;
public boolean processChange;
public AnonymousClass46() {
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
if (!this.ignorePrevTextChange && ChatActivityEnterView.this.recordingAudioVideo) {
this.prevText = charSequence.toString();
}
}
@Override
public void onTextChanged(CharSequence charSequence, int start, int before, int count) {
int currentPage;
if (this.ignorePrevTextChange) {
return;
}
if (ChatActivityEnterView.this.emojiView == null) {
currentPage = MessagesController.getGlobalEmojiSettings().getInt("selected_page", 0);
} else {
currentPage = ChatActivityEnterView.this.emojiView.getCurrentPage();
}
boolean z = currentPage != 0 && (ChatActivityEnterView.this.allowStickers || ChatActivityEnterView.this.allowGifs);
if (((before == 0 && !TextUtils.isEmpty(charSequence)) || (before != 0 && TextUtils.isEmpty(charSequence))) && z) {
ChatActivityEnterView.this.setEmojiButtonImage(false, true);
}
if (ChatActivityEnterView.this.lineCount != ChatActivityEnterView.this.messageEditText.getLineCount()) {
this.heightShouldBeChanged = (ChatActivityEnterView.this.messageEditText.getLineCount() >= 4) != (ChatActivityEnterView.this.lineCount >= 4);
if (!ChatActivityEnterView.this.isInitLineCount && ChatActivityEnterView.this.messageEditText.getMeasuredWidth() > 0) {
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
chatActivityEnterView.onLineCountChanged(chatActivityEnterView.lineCount, ChatActivityEnterView.this.messageEditText.getLineCount());
}
ChatActivityEnterView chatActivityEnterView2 = ChatActivityEnterView.this;
chatActivityEnterView2.lineCount = chatActivityEnterView2.messageEditText.getLineCount();
} else {
this.heightShouldBeChanged = false;
}
if (ChatActivityEnterView.this.innerTextChange == 1) {
return;
}
if (ChatActivityEnterView.this.sendByEnter && !ChatActivityEnterView.this.ignoreTextChange && !ChatActivityEnterView.this.isPaste && ChatActivityEnterView.this.editingMessageObject == null && count > before && charSequence.length() > 0 && charSequence.length() == start + count && charSequence.charAt(charSequence.length() - 1) == '\n') {
this.nextChangeIsSend = true;
}
ChatActivityEnterView.this.isPaste = false;
ChatActivityEnterView.this.checkSendButton(true);
CharSequence trimmedString = AndroidUtilities.getTrimmedString(charSequence.toString());
if (ChatActivityEnterView.this.delegate != null && !ChatActivityEnterView.this.ignoreTextChange) {
int i = count + 1;
if (before > i || count - before > 2 || TextUtils.isEmpty(charSequence)) {
ChatActivityEnterView.this.messageWebPageSearch = true;
}
ChatActivityEnterView.this.delegate.onTextChanged(charSequence, before > i || count - before > 2, false);
}
if (ChatActivityEnterView.this.innerTextChange != 2 && count - before > 1) {
this.processChange = true;
}
if (ChatActivityEnterView.this.editingMessageObject != null || ChatActivityEnterView.this.canWriteToChannel || trimmedString.length() == 0 || ChatActivityEnterView.this.lastTypingTimeSend >= System.currentTimeMillis() - 5000 || ChatActivityEnterView.this.ignoreTextChange) {
return;
}
ChatActivityEnterView.this.lastTypingTimeSend = System.currentTimeMillis();
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterView.this.delegate.needSendTyping();
}
}
@Override
public void afterTextChanged(android.text.Editable r10) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.Components.ChatActivityEnterView.AnonymousClass46.afterTextChanged(android.text.Editable):void");
}
public void lambda$afterTextChanged$0() {
ChatActivityEnterView.this.showCaptionLimitBulletin();
}
}
@Override
public void addTextChangedListener(TextWatcher textWatcher) {
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null) {
editTextCaption.addTextChangedListener(textWatcher);
return;
}
if (this.messageEditTextWatchers == null) {
this.messageEditTextWatchers = new ArrayList<>();
}
this.messageEditTextWatchers.add(textWatcher);
}
public boolean isSendButtonVisible() {
return this.sendButton.getVisibility() == 0;
}
public final void setRecordVideoButtonVisible(boolean visible, boolean animated) {
if (this.audioVideoSendButton == null) {
return;
}
this.isInVideoMode = visible;
if (animated) {
SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
boolean z = false;
if (DialogObject.isChatDialog(this.dialog_id)) {
TLRPC.Chat chat = this.accountInstance.getMessagesController().getChat(Long.valueOf(-this.dialog_id));
if (ChatObject.isChannel(chat) && !chat.megagroup) {
z = true;
}
}
globalMainSettings.edit().putBoolean(z ? "currentModeVideoChannel" : "currentModeVideo", visible).apply();
}
this.audioVideoSendButton.setState(isInVideoMode() ? ChatActivityEnterViewAnimatedIconView.State.VIDEO : ChatActivityEnterViewAnimatedIconView.State.VOICE, animated);
this.audioVideoSendButton.setContentDescription(LocaleController.getString(isInVideoMode() ? R.string.AccDescrVideoMessage : R.string.AccDescrVoiceMessage));
this.audioVideoButtonContainer.setContentDescription(LocaleController.getString(isInVideoMode() ? R.string.AccDescrVideoMessage : R.string.AccDescrVoiceMessage));
this.audioVideoSendButton.sendAccessibilityEvent(8);
}
public boolean isRecordingAudioVideo() {
AnimatorSet animatorSet;
return this.recordingAudioVideo || !((animatorSet = this.runningAnimationAudio) == null || !animatorSet.isRunning() || this.recordIsCanceled);
}
public boolean isRecordLocked() {
return this.recordingAudioVideo && this.recordCircle.isSendButtonVisible();
}
public void cancelRecordingAudioVideo() {
if (this.hasRecordVideo && isInVideoMode()) {
CameraController.getInstance().cancelOnInitRunnable(this.onFinishInitCameraRunnable);
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
int i = this.voiceOnce ? Integer.MAX_VALUE : 0;
MessageSendPreview messageSendPreview = this.messageSendPreview;
chatActivityEnterViewDelegate.needStartRecordVideo(5, true, 0, i, messageSendPreview != null ? messageSendPreview.getSelectedEffect() : 0L);
} else {
this.delegate.needStartRecordAudio(0);
MediaController.getInstance().stopRecording(0, false, 0, false);
}
this.recordingAudioVideo = false;
updateRecordInterface(2, true);
}
public void showContextProgress(boolean show) {
CloseProgressDrawable2 closeProgressDrawable2 = this.progressDrawable;
if (closeProgressDrawable2 == null) {
return;
}
if (show) {
closeProgressDrawable2.startAnimation();
} else {
closeProgressDrawable2.stopAnimation();
}
}
public void setCaption(String caption) {
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null) {
editTextCaption.setCaption(caption);
checkSendButton(true);
}
}
public void setSlowModeTimer(int time) {
this.slowModeTimer = time;
updateSlowModeText();
}
public CharSequence getSlowModeTimer() {
if (this.slowModeTimer > 0) {
return this.slowModeButton.getText();
}
return null;
}
public int getSlowModeTimerInt() {
return this.slowModeTimer;
}
public final void updateSlowModeText() {
int i;
boolean isUploadingMessageIdDialog;
int currentTime = ConnectionsManager.getInstance(this.currentAccount).getCurrentTime();
AndroidUtilities.cancelRunOnUIThread(this.updateSlowModeRunnable);
this.updateSlowModeRunnable = null;
TLRPC.ChatFull chatFull = this.info;
if (chatFull != null && chatFull.slowmode_seconds != 0 && chatFull.slowmode_next_send_date <= currentTime && ((isUploadingMessageIdDialog = SendMessagesHelper.getInstance(this.currentAccount).isUploadingMessageIdDialog(this.dialog_id)) || SendMessagesHelper.getInstance(this.currentAccount).isSendingMessageIdDialog(this.dialog_id))) {
if (!ChatObject.hasAdminRights(this.accountInstance.getMessagesController().getChat(Long.valueOf(this.info.id))) && !ChatObject.isIgnoredChatRestrictionsForBoosters(this.info)) {
i = this.info.slowmode_seconds;
this.slowModeTimer = isUploadingMessageIdDialog ? Integer.MAX_VALUE : 2147483646;
}
i = 0;
} else {
int i2 = this.slowModeTimer;
if (i2 >= 2147483646) {
if (this.info != null) {
this.accountInstance.getMessagesController().loadFullChat(this.info.id, 0, true);
}
i = 0;
} else {
i = i2 - currentTime;
}
}
if (this.slowModeTimer != 0 && i > 0) {
this.slowModeButton.setText(AndroidUtilities.formatDurationNoHours(Math.max(1, i), false));
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
SlowModeBtn slowModeBtn = this.slowModeButton;
chatActivityEnterViewDelegate.onUpdateSlowModeButton(slowModeBtn, false, slowModeBtn.getText());
}
Runnable runnable = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.updateSlowModeText();
}
};
this.updateSlowModeRunnable = runnable;
AndroidUtilities.runOnUIThread(runnable, 100L);
} else {
this.slowModeTimer = 0;
}
if (isInScheduleMode()) {
return;
}
checkSendButton(true);
}
public void addTopView(View view, View lineView, int height) {
if (view == null) {
return;
}
this.topLineView = lineView;
lineView.setVisibility(8);
this.topLineView.setAlpha(0.0f);
addView(this.topLineView, LayoutHelper.createFrame(-1, 1.0f, 51, 0.0f, height + 1, 0.0f, 0.0f));
this.topView = view;
view.setVisibility(8);
this.topViewEnterProgress = 0.0f;
float f = height;
this.topView.setTranslationY(f);
addView(this.topView, 0, LayoutHelper.createFrame(-1, f, 51, 0.0f, 2.0f, 0.0f, 0.0f));
this.needShowTopView = false;
}
public void setForceShowSendButton(boolean value, boolean animated) {
this.forceShowSendButton = value;
checkSendButton(animated);
}
public void setAllowStickersAndGifs(boolean needAnimatedEmoji, boolean needStickers, boolean needGifs) {
setAllowStickersAndGifs(needAnimatedEmoji, needStickers, needGifs, false);
}
public void setAllowStickersAndGifs(boolean needAnimatedEmoji, boolean needStickers, boolean needGifs, boolean waitingForKeyboardOpen) {
if ((this.allowStickers != needStickers || this.allowGifs != needGifs) && this.emojiView != null) {
if (this.emojiViewVisible && !waitingForKeyboardOpen) {
this.removeEmojiViewAfterAnimation = true;
hidePopup(false);
} else if (waitingForKeyboardOpen) {
openKeyboardInternal();
}
}
this.allowAnimatedEmoji = needAnimatedEmoji && !PlusSettings.hidePremiumEmojisTabs;
this.allowStickers = needStickers;
this.allowGifs = needGifs;
EmojiView emojiView = this.emojiView;
if (emojiView != null) {
emojiView.setAllow(needStickers, needGifs, true);
}
setEmojiButtonImage(false, !this.isPaused);
}
public void addEmojiToRecent(String code) {
createEmojiView();
this.emojiView.addEmojiToRecent(code);
}
public void setOpenGifsTabFirst() {
createEmojiView();
MediaDataController.getInstance(this.currentAccount).loadRecents(0, true, true, false);
this.emojiView.switchToGifRecent();
}
public void lambda$new$43(ValueAnimator valueAnimator) {
BlurredFrameLayout blurredFrameLayout;
if (this.topView != null) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.topViewEnterProgress = floatValue;
float f = 1.0f - floatValue;
this.topView.setTranslationY(this.animatedTop + (r0.getLayoutParams().height * f));
this.topLineView.setAlpha(floatValue);
this.topLineView.setTranslationY(this.animatedTop);
ChatActivity chatActivity = this.parentFragment;
if (chatActivity == null || (blurredFrameLayout = chatActivity.mentionContainer) == null) {
return;
}
blurredFrameLayout.setTranslationY(f * this.topView.getLayoutParams().height);
}
}
public void showTopView(boolean animated, final boolean openKeyboard) {
showTopView(animated, openKeyboard, false);
}
public final void showTopView(boolean animated, final boolean openKeyboard, boolean skipAwait) {
if (this.topView == null || this.topViewShowed || getVisibility() != 0) {
FrameLayout frameLayout = this.recordedAudioPanel;
if (frameLayout == null || frameLayout.getVisibility() != 0) {
if ((!this.forceShowSendButton && this.replyingQuote == null && this.replyingMessageObject == null) || openKeyboard) {
openKeyboard();
return;
}
return;
}
return;
}
FrameLayout frameLayout2 = this.recordedAudioPanel;
boolean z = (frameLayout2 == null || frameLayout2.getVisibility() != 0) && ((!this.forceShowSendButton && this.replyingQuote == null) || openKeyboard) && (this.botReplyMarkup == null || this.editingMessageObject != null);
if (!skipAwait && animated && z && !this.keyboardVisible && !isPopupShowing()) {
openKeyboard();
Runnable runnable = this.showTopViewRunnable;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
}
Runnable runnable2 = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$showTopView$44();
}
};
this.showTopViewRunnable = runnable2;
AndroidUtilities.runOnUIThread(runnable2, 200L);
return;
}
this.needShowTopView = true;
this.topViewShowed = true;
if (this.allowShowTopView) {
this.topView.setVisibility(0);
this.topLineView.setVisibility(0);
ValueAnimator valueAnimator = this.currentTopViewAnimation;
if (valueAnimator != null) {
valueAnimator.cancel();
this.currentTopViewAnimation = null;
}
resizeForTopView(true);
if (animated) {
ValueAnimator ofFloat = ValueAnimator.ofFloat(this.topViewEnterProgress, 1.0f);
this.currentTopViewAnimation = ofFloat;
ofFloat.addUpdateListener(this.topViewUpdateListener);
this.currentTopViewAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
ValueAnimator valueAnimator2 = ChatActivityEnterView.this.currentTopViewAnimation;
if (valueAnimator2 != null && valueAnimator2.equals(animation)) {
ChatActivityEnterView.this.currentTopViewAnimation = null;
}
ChatActivityEnterView.this.notificationsLocker.unlock();
if (ChatActivityEnterView.this.parentFragment == null || ChatActivityEnterView.this.parentFragment.mentionContainer == null) {
return;
}
ChatActivityEnterView.this.parentFragment.mentionContainer.setTranslationY(0.0f);
}
});
this.currentTopViewAnimation.setDuration(270L);
this.currentTopViewAnimation.setInterpolator(ChatListItemAnimator.DEFAULT_INTERPOLATOR);
this.currentTopViewAnimation.start();
this.notificationsLocker.lock();
} else {
this.topViewEnterProgress = 1.0f;
this.topView.setTranslationY(0.0f);
this.topLineView.setAlpha(1.0f);
}
if (z) {
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null) {
editTextCaption.requestFocus();
}
openKeyboard();
}
}
}
public void lambda$showTopView$44() {
showTopView(true, false, true);
this.showTopViewRunnable = null;
}
public void onEditTimeExpired() {
SendButton sendButton = this.doneButton;
if (sendButton != null) {
sendButton.setVisibility(8);
}
}
public void showEditDoneProgress(final boolean show, boolean animated) {
if (this.doneButton == null) {
return;
}
AnimatorSet animatorSet = this.doneButtonAnimation;
if (animatorSet != null) {
animatorSet.cancel();
}
if (show) {
this.doneButton.setEnabled(false);
this.doneButton.setLoading(true, -3.0f);
} else {
this.doneButton.setEnabled(true);
this.doneButton.setLoading(false, -3.0f);
}
}
public void hideTopView(final boolean animated) {
if (this.topView == null || !this.topViewShowed) {
return;
}
Runnable runnable = this.showTopViewRunnable;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
}
this.topViewShowed = false;
this.needShowTopView = false;
if (this.allowShowTopView) {
ValueAnimator valueAnimator = this.currentTopViewAnimation;
if (valueAnimator != null) {
valueAnimator.cancel();
this.currentTopViewAnimation = null;
}
if (animated) {
ValueAnimator ofFloat = ValueAnimator.ofFloat(this.topViewEnterProgress, 0.0f);
this.currentTopViewAnimation = ofFloat;
ofFloat.addUpdateListener(this.topViewUpdateListener);
this.currentTopViewAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
ValueAnimator valueAnimator2 = ChatActivityEnterView.this.currentTopViewAnimation;
if (valueAnimator2 != null && valueAnimator2.equals(animation)) {
ChatActivityEnterView.this.topView.setVisibility(8);
ChatActivityEnterView.this.topLineView.setVisibility(8);
ChatActivityEnterView.this.resizeForTopView(false);
ChatActivityEnterView.this.currentTopViewAnimation = null;
}
if (ChatActivityEnterView.this.parentFragment == null || ChatActivityEnterView.this.parentFragment.mentionContainer == null) {
return;
}
ChatActivityEnterView.this.parentFragment.mentionContainer.setTranslationY(0.0f);
}
@Override
public void onAnimationCancel(Animator animation) {
ValueAnimator valueAnimator2 = ChatActivityEnterView.this.currentTopViewAnimation;
if (valueAnimator2 == null || !valueAnimator2.equals(animation)) {
return;
}
ChatActivityEnterView.this.currentTopViewAnimation = null;
}
});
this.currentTopViewAnimation.setDuration(250L);
this.currentTopViewAnimation.setInterpolator(ChatListItemAnimator.DEFAULT_INTERPOLATOR);
this.currentTopViewAnimation.start();
return;
}
this.topViewEnterProgress = 0.0f;
this.topView.setVisibility(8);
this.topLineView.setVisibility(8);
this.topLineView.setAlpha(0.0f);
resizeForTopView(false);
this.topView.setTranslationY(r4.getLayoutParams().height);
}
}
public boolean isTopViewVisible() {
View view = this.topView;
return view != null && view.getVisibility() == 0;
}
public float topViewVisible() {
return this.topViewEnterProgress;
}
public void onAdjustPanTransitionUpdate(float y, float progress, boolean keyboardVisible) {
BotWebViewMenuContainer botWebViewMenuContainer = this.botWebViewMenuContainer;
if (botWebViewMenuContainer != null) {
botWebViewMenuContainer.setTranslationY(y);
}
}
public void onAdjustPanTransitionEnd() {
BotWebViewMenuContainer botWebViewMenuContainer = this.botWebViewMenuContainer;
if (botWebViewMenuContainer != null) {
botWebViewMenuContainer.onPanTransitionEnd();
}
Runnable runnable = this.onKeyboardClosed;
if (runnable != null) {
runnable.run();
this.onKeyboardClosed = null;
}
}
public void onAdjustPanTransitionStart(boolean keyboardVisible, int contentHeight) {
EditTextCaption editTextCaption;
BotWebViewMenuContainer botWebViewMenuContainer;
Runnable runnable;
BotWebViewMenuContainer botWebViewMenuContainer2 = this.botWebViewMenuContainer;
if (botWebViewMenuContainer2 != null) {
botWebViewMenuContainer2.onPanTransitionStart(keyboardVisible, contentHeight);
}
if (keyboardVisible && (runnable = this.showTopViewRunnable) != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
this.showTopViewRunnable.run();
}
Runnable runnable2 = this.setTextFieldRunnable;
if (runnable2 != null) {
AndroidUtilities.cancelRunOnUIThread(runnable2);
this.setTextFieldRunnable.run();
}
if (keyboardVisible && (editTextCaption = this.messageEditText) != null && editTextCaption.hasFocus() && hasBotWebView() && botCommandsMenuIsShowing() && (botWebViewMenuContainer = this.botWebViewMenuContainer) != null) {
botWebViewMenuContainer.dismiss();
}
}
public final void onWindowSizeChanged() {
int height = this.sizeNotifierLayout.getHeight();
if (!this.keyboardVisible) {
height -= this.emojiPadding;
}
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
chatActivityEnterViewDelegate.onWindowSizeChanged(height);
}
if (this.topView != null) {
if (height < AndroidUtilities.dp(72.0f) + ActionBar.getCurrentActionBarHeight()) {
if (this.allowShowTopView) {
this.allowShowTopView = false;
if (this.needShowTopView) {
this.topView.setVisibility(8);
this.topLineView.setVisibility(8);
this.topLineView.setAlpha(0.0f);
resizeForTopView(false);
this.topViewEnterProgress = 0.0f;
this.topView.setTranslationY(r0.getLayoutParams().height);
return;
}
return;
}
return;
}
if (this.allowShowTopView) {
return;
}
this.allowShowTopView = true;
if (this.needShowTopView) {
this.topView.setVisibility(0);
this.topLineView.setVisibility(0);
this.topLineView.setAlpha(1.0f);
resizeForTopView(true);
this.topViewEnterProgress = 1.0f;
this.topView.setTranslationY(0.0f);
}
}
}
public final void resizeForTopView(boolean show) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.textFieldContainer.getLayoutParams();
layoutParams.topMargin = AndroidUtilities.dp(2.0f) + (show ? this.topView.getLayoutParams().height : 0);
this.textFieldContainer.setLayoutParams(layoutParams);
setMinimumHeight(AndroidUtilities.dp(51.0f) + (show ? this.topView.getLayoutParams().height : 0));
if (this.stickersExpanded) {
if (this.searchingType == 0) {
setStickersExpanded(false, true, false);
} else {
checkStickresExpandHeight();
}
}
}
public void onDestroy() {
this.destroyed = true;
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.recordStarted);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.recordPaused);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.recordResumed);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.recordStartError);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.recordStopped);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.recordProgressChanged);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.closeChats);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.audioDidSent);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.audioRouteChanged);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.messagePlayingDidReset);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.messagePlayingProgressDidChanged);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.featuredStickersDidLoad);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.messageReceivedByServer2);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.sendingMessagesChanged);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.audioRecordTooShort);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.updateBotMenuButton);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.didUpdatePremiumGiftFieldIcon);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiLoaded);
EmojiView emojiView = this.emojiView;
if (emojiView != null) {
emojiView.onDestroy();
}
Runnable runnable = this.updateSlowModeRunnable;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
this.updateSlowModeRunnable = null;
}
PowerManager.WakeLock wakeLock = this.wakeLock;
if (wakeLock != null) {
try {
wakeLock.release();
this.wakeLock = null;
} catch (Exception e) {
FileLog.e(e);
}
}
SizeNotifierFrameLayout sizeNotifierFrameLayout = this.sizeNotifierLayout;
if (sizeNotifierFrameLayout != null) {
sizeNotifierFrameLayout.setDelegate(null);
}
SenderSelectPopup senderSelectPopup = this.senderSelectPopupWindow;
if (senderSelectPopup != null) {
senderSelectPopup.setPauseNotifications(false);
this.senderSelectPopupWindow.dismiss();
}
}
public void checkChannelRights() {
ChatActivity chatActivity = this.parentFragment;
if (chatActivity == null) {
return;
}
updateRecordButton(chatActivity.getCurrentChat(), this.parentFragment.getCurrentUserInfo());
}
public void updateRecordButton(TLRPC.Chat chat, TLRPC.UserFull userFull) {
EmojiView emojiView;
this.emojiButtonRestricted = false;
boolean z = true;
this.stickersEnabled = true;
this.sendPlainEnabled = true;
this.sendRoundEnabled = true;
this.sendVoiceEnabled = true;
if (chat != null) {
this.audioVideoButtonContainer.setAlpha((ChatObject.canSendVoice(chat) || (ChatObject.canSendRoundVideo(chat) && this.hasRecordVideo)) ? 1.0f : 0.5f);
this.stickersEnabled = ChatObject.canSendStickers(chat);
boolean canSendPlain = ChatObject.canSendPlain(chat);
this.sendPlainEnabled = canSendPlain;
boolean z2 = (this.stickersEnabled || canSendPlain) ? false : true;
this.emojiButtonRestricted = z2;
this.emojiButtonAlpha = z2 ? 0.5f : 1.0f;
updateEmojiButtonParams();
if (!this.emojiButtonRestricted && (emojiView = this.emojiView) != null) {
emojiView.setStickersBanned(!this.sendPlainEnabled, !this.stickersEnabled, -this.dialog_id);
if (ChatObject.canSendGifs(chat) != ChatObject.canSendStickers(chat)) {
this.emojiView.setGifsBanned(!ChatObject.canSendGifs(chat), (int) chat.id);
}
}
this.sendRoundEnabled = ChatObject.canSendRoundVideo(chat);
this.sendVoiceEnabled = ChatObject.canSendVoice(chat);
} else if (userFull != null) {
this.userInfo = userFull;
this.audioVideoButtonContainer.setAlpha(userFull.voice_messages_forbidden ? 0.5f : 1.0f);
}
updateFieldHint(false);
boolean z3 = this.isInVideoMode;
if (!this.sendRoundEnabled && z3) {
z3 = false;
}
if (this.sendVoiceEnabled || z3) {
z = z3;
} else if (!this.hasRecordVideo) {
z = false;
}
setRecordVideoButtonVisible(z, false);
}
public void onBeginHide() {
Runnable runnable = this.focusRunnable;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
this.focusRunnable = null;
}
}
public void onConfigurationChanged(Configuration newConfig) {
super/*android.widget.FrameLayout*/.onConfigurationChanged(newConfig);
SenderSelectPopup senderSelectPopup = this.senderSelectPopupWindow;
if (senderSelectPopup != null) {
senderSelectPopup.setPauseNotifications(false);
this.senderSelectPopupWindow.dismiss();
}
}
public void onPause() {
this.isPaused = true;
SenderSelectPopup senderSelectPopup = this.senderSelectPopupWindow;
if (senderSelectPopup != null) {
senderSelectPopup.setPauseNotifications(false);
this.senderSelectPopupWindow.dismiss();
}
if (this.keyboardVisible) {
this.showKeyboardOnResume = true;
}
Runnable runnable = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$onPause$45();
}
};
this.hideKeyboardRunnable = runnable;
AndroidUtilities.runOnUIThread(runnable, 500L);
}
public void lambda$onPause$45() {
ChatActivity chatActivity = this.parentFragment;
if (chatActivity == null || chatActivity.isLastFragment()) {
closeKeyboard();
}
this.hideKeyboardRunnable = null;
}
public void onResume() {
ChatActivity chatActivity;
EditTextCaption editTextCaption;
this.isPaused = false;
Runnable runnable = this.hideKeyboardRunnable;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
this.hideKeyboardRunnable = null;
}
if (hasBotWebView() && botCommandsMenuIsShowing()) {
return;
}
getVisibility();
if (this.showKeyboardOnResume && (chatActivity = this.parentFragment) != null && chatActivity.isLastFragment()) {
this.showKeyboardOnResume = false;
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
chatActivityEnterViewDelegate.onKeyboardRequested();
}
if (this.searchingType == 0 && (editTextCaption = this.messageEditText) != null) {
editTextCaption.requestFocus();
}
AndroidUtilities.showKeyboard(this.messageEditText);
if (AndroidUtilities.usingHardwareInput || this.keyboardVisible || AndroidUtilities.isInMultiwindow) {
return;
}
this.waitingForKeyboardOpen = true;
AndroidUtilities.cancelRunOnUIThread(this.openKeyboardRunnable);
AndroidUtilities.runOnUIThread(this.openKeyboardRunnable, 100L);
}
}
public void setVisibility(int visibility) {
super/*android.widget.FrameLayout*/.setVisibility(visibility);
boolean z = visibility == 0;
this.messageEditTextEnabled = z;
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null) {
editTextCaption.setEnabled(z);
}
}
public void setDialogId(long id, int account) {
this.dialog_id = id;
if (this.currentAccount != account) {
this.notificationsLocker.unlock();
NotificationCenter notificationCenter = NotificationCenter.getInstance(this.currentAccount);
int i = NotificationCenter.recordStarted;
notificationCenter.removeObserver(this, i);
NotificationCenter notificationCenter2 = NotificationCenter.getInstance(this.currentAccount);
int i2 = NotificationCenter.recordPaused;
notificationCenter2.removeObserver(this, i2);
NotificationCenter notificationCenter3 = NotificationCenter.getInstance(this.currentAccount);
int i3 = NotificationCenter.recordResumed;
notificationCenter3.removeObserver(this, i3);
NotificationCenter notificationCenter4 = NotificationCenter.getInstance(this.currentAccount);
int i4 = NotificationCenter.recordStartError;
notificationCenter4.removeObserver(this, i4);
NotificationCenter notificationCenter5 = NotificationCenter.getInstance(this.currentAccount);
int i5 = NotificationCenter.recordStopped;
notificationCenter5.removeObserver(this, i5);
NotificationCenter notificationCenter6 = NotificationCenter.getInstance(this.currentAccount);
int i6 = NotificationCenter.recordProgressChanged;
notificationCenter6.removeObserver(this, i6);
NotificationCenter notificationCenter7 = NotificationCenter.getInstance(this.currentAccount);
int i7 = NotificationCenter.closeChats;
notificationCenter7.removeObserver(this, i7);
NotificationCenter notificationCenter8 = NotificationCenter.getInstance(this.currentAccount);
int i8 = NotificationCenter.audioDidSent;
notificationCenter8.removeObserver(this, i8);
NotificationCenter notificationCenter9 = NotificationCenter.getInstance(this.currentAccount);
int i9 = NotificationCenter.audioRouteChanged;
notificationCenter9.removeObserver(this, i9);
NotificationCenter notificationCenter10 = NotificationCenter.getInstance(this.currentAccount);
int i10 = NotificationCenter.messagePlayingDidReset;
notificationCenter10.removeObserver(this, i10);
NotificationCenter notificationCenter11 = NotificationCenter.getInstance(this.currentAccount);
int i11 = NotificationCenter.messagePlayingProgressDidChanged;
notificationCenter11.removeObserver(this, i11);
NotificationCenter notificationCenter12 = NotificationCenter.getInstance(this.currentAccount);
int i12 = NotificationCenter.featuredStickersDidLoad;
notificationCenter12.removeObserver(this, i12);
NotificationCenter notificationCenter13 = NotificationCenter.getInstance(this.currentAccount);
int i13 = NotificationCenter.messageReceivedByServer2;
notificationCenter13.removeObserver(this, i13);
NotificationCenter notificationCenter14 = NotificationCenter.getInstance(this.currentAccount);
int i14 = NotificationCenter.sendingMessagesChanged;
notificationCenter14.removeObserver(this, i14);
this.currentAccount = account;
this.accountInstance = AccountInstance.getInstance(account);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, i);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, i2);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, i3);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, i4);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, i5);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, i6);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, i7);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, i8);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, i9);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, i10);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, i11);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, i12);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, i13);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, i14);
}
this.sendPlainEnabled = true;
if (DialogObject.isChatDialog(this.dialog_id)) {
this.sendPlainEnabled = ChatObject.canSendPlain(this.accountInstance.getMessagesController().getChat(Long.valueOf(-this.dialog_id)));
}
updateScheduleButton(false);
updateGiftButton(false);
checkRoundVideo();
checkChannelRights();
updateFieldHint(false);
if (this.messageEditText != null) {
ChatActivity chatActivity = this.parentFragment;
updateSendAsButton(chatActivity != null && chatActivity.getFragmentBeginToShow());
}
}
public void setChatInfo(TLRPC.ChatFull chatInfo) {
this.info = chatInfo;
EmojiView emojiView = this.emojiView;
if (emojiView != null) {
emojiView.setChatInfo(chatInfo);
}
SlowModeBtn slowModeBtn = this.slowModeButton;
if (slowModeBtn != null) {
slowModeBtn.setPremiumMode(ChatObject.isPossibleRemoveChatRestrictionsByBoosts(chatInfo));
}
if (ChatObject.isIgnoredChatRestrictionsForBoosters(chatInfo)) {
return;
}
setSlowModeTimer(chatInfo.slowmode_next_send_date);
}
public void checkRoundVideo() {
boolean z;
boolean z2;
TLRPC.TL_chatAdminRights tL_chatAdminRights;
if (this.hasRecordVideo) {
return;
}
if (this.attachLayout == null || Build.VERSION.SDK_INT < 18) {
this.hasRecordVideo = false;
setRecordVideoButtonVisible(false, false);
return;
}
boolean z3 = true;
this.hasRecordVideo = true;
this.sendRoundEnabled = true;
this.sendVoiceEnabled = true;
if (DialogObject.isChatDialog(this.dialog_id)) {
TLRPC.Chat chat = this.accountInstance.getMessagesController().getChat(Long.valueOf(-this.dialog_id));
z = ChatObject.isChannel(chat) && !chat.megagroup;
if (z && !chat.creator && ((tL_chatAdminRights = chat.admin_rights) == null || !tL_chatAdminRights.post_messages)) {
this.hasRecordVideo = false;
}
this.sendRoundEnabled = ChatObject.canSendRoundVideo(chat);
this.sendVoiceEnabled = ChatObject.canSendVoice(chat);
} else {
z = false;
}
if (!SharedConfig.inappCamera) {
this.hasRecordVideo = false;
}
if (this.hasRecordVideo) {
if (SharedConfig.hasCameraCache) {
CameraController.getInstance().initCamera(null);
}
z2 = MessagesController.getGlobalMainSettings().getBoolean(z ? "currentModeVideoChannel" : "currentModeVideo", z);
} else {
z2 = false;
}
if (!this.sendRoundEnabled && z2) {
z2 = false;
}
if (this.sendVoiceEnabled || z2) {
z3 = z2;
} else if (!this.hasRecordVideo) {
z3 = false;
}
setRecordVideoButtonVisible(z3, false);
}
public boolean isInVideoMode() {
return this.isInVideoMode;
}
public boolean hasRecordVideo() {
return this.hasRecordVideo;
}
public MessageObject getReplyingMessageObject() {
return this.replyingMessageObject;
}
public void updateFieldHint(boolean animated) {
boolean z;
String str;
TLRPC.TL_forumTopic tL_forumTopic;
String str2;
MessageObject messageObject;
TLRPC.ReplyMarkup replyMarkup;
TLRPC.ReplyMarkup replyMarkup2;
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption == null) {
return;
}
CharSequence charSequence = this.overrideHint;
if (charSequence != null) {
editTextCaption.setHintText(charSequence, animated);
this.messageEditText.setHintText2(this.overrideHint2, animated);
return;
}
boolean z2 = false;
if (!this.sendPlainEnabled && !isEditingMessage()) {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(" d " + LocaleController.getString("PlainTextRestrictedHint", R.string.PlainTextRestrictedHint));
spannableStringBuilder.setSpan(new ColoredImageSpan(R.drawable.msg_mini_lock3), 1, 2, 0);
this.messageEditText.setHintText(spannableStringBuilder, animated);
this.messageEditText.setText((CharSequence) null);
this.messageEditText.setEnabled(false);
this.messageEditText.setInputType(1);
return;
}
this.messageEditText.setEnabled(true);
int inputType = this.messageEditText.getInputType();
int i = this.commonInputType;
if (inputType != i) {
this.messageEditText.setInputType(i);
}
ChatActivity chatActivity = this.parentFragment;
if (chatActivity != null && chatActivity.getChatMode() == 5) {
if ("hello".equalsIgnoreCase(this.parentFragment.quickReplyShortcut)) {
this.messageEditText.setHintText(LocaleController.getString(R.string.BusinessGreetingEnter));
return;
} else if ("away".equalsIgnoreCase(this.parentFragment.quickReplyShortcut)) {
this.messageEditText.setHintText(LocaleController.getString(R.string.BusinessAwayEnter));
return;
} else {
this.messageEditText.setHintText(LocaleController.getString(R.string.BusinessRepliesEnter));
return;
}
}
if (isEditingBusinessLink()) {
this.messageEditText.setHintText(LocaleController.getString(R.string.BusinessLinksEnter));
return;
}
MessageObject messageObject2 = this.replyingMessageObject;
if (messageObject2 != null && (replyMarkup2 = messageObject2.messageOwner.reply_markup) != null && !TextUtils.isEmpty(replyMarkup2.placeholder)) {
this.messageEditText.setHintText(this.replyingMessageObject.messageOwner.reply_markup.placeholder, animated);
return;
}
if (this.editingMessageObject != null) {
this.messageEditText.setHintText(this.editingCaption ? LocaleController.getString("Caption", R.string.Caption) : LocaleController.getString("TypeMessage", R.string.TypeMessage));
return;
}
if (this.botKeyboardViewVisible && (messageObject = this.botButtonsMessageObject) != null && (replyMarkup = messageObject.messageOwner.reply_markup) != null && !TextUtils.isEmpty(replyMarkup.placeholder)) {
this.messageEditText.setHintText(this.botButtonsMessageObject.messageOwner.reply_markup.placeholder, animated);
return;
}
ChatActivity chatActivity2 = this.parentFragment;
if (chatActivity2 != null && chatActivity2.isForumInViewAsMessagesMode()) {
MessageObject messageObject3 = this.replyingTopMessage;
if (messageObject3 != null && (tL_forumTopic = messageObject3.replyToForumTopic) != null && (str2 = tL_forumTopic.title) != null) {
this.messageEditText.setHintText(LocaleController.formatString("TypeMessageIn", R.string.TypeMessageIn, new Object[]{str2}), animated);
return;
}
TLRPC.TL_forumTopic findTopic = MessagesController.getInstance(this.currentAccount).getTopicsController().findTopic(this.parentFragment.getCurrentChat().id, 1L);
if (findTopic != null && (str = findTopic.title) != null) {
this.messageEditText.setHintText(LocaleController.formatString("TypeMessageIn", R.string.TypeMessageIn, new Object[]{str}), animated);
return;
} else {
this.messageEditText.setHintText(LocaleController.getString("TypeMessage", R.string.TypeMessage), animated);
return;
}
}
if (DialogObject.isChatDialog(this.dialog_id)) {
TLRPC.Chat chat = this.accountInstance.getMessagesController().getChat(Long.valueOf(-this.dialog_id));
TLRPC.ChatFull chatFull = this.accountInstance.getMessagesController().getChatFull(-this.dialog_id);
z = ChatObject.isChannelAndNotMegaGroup(chat);
z2 = ChatObject.getSendAsPeerId(chat, chatFull) == (-this.dialog_id);
} else {
z = false;
}
if (z2) {
this.messageEditText.setHintText(LocaleController.getString("SendAnonymously", R.string.SendAnonymously));
return;
}
ChatActivity chatActivity3 = this.parentFragment;
if (chatActivity3 != null && chatActivity3.isThreadChat()) {
ChatActivity chatActivity4 = this.parentFragment;
if (!chatActivity4.isTopic) {
if (chatActivity4.isReplyChatComment()) {
this.messageEditText.setHintText(LocaleController.getString("Comment", R.string.Comment));
return;
} else {
this.messageEditText.setHintText(LocaleController.getString("Reply", R.string.Reply));
return;
}
}
}
if (z) {
if (this.silent) {
this.messageEditText.setHintText(LocaleController.getString("ChannelSilentBroadcast", R.string.ChannelSilentBroadcast), animated);
return;
} else {
this.messageEditText.setHintText(LocaleController.getString("ChannelBroadcast", R.string.ChannelBroadcast), animated);
return;
}
}
this.messageEditText.setHintText(LocaleController.getString("TypeMessage", R.string.TypeMessage));
}
public void setReplyingMessageObject(MessageObject messageObject, ChatActivity.ReplyQuote quote) {
setReplyingMessageObject(messageObject, quote, null);
}
public void setReplyingMessageObject(MessageObject messageObject, ChatActivity.ReplyQuote quote, MessageObject replyingTopMessage) {
MessageObject messageObject2;
ChatActivity chatActivity = this.parentFragment;
boolean z = (chatActivity == null || !chatActivity.isForumInViewAsMessagesMode() || this.replyingTopMessage == replyingTopMessage) ? false : true;
if (messageObject != null) {
if (this.botMessageObject == null && (messageObject2 = this.botButtonsMessageObject) != this.replyingMessageObject) {
this.botMessageObject = messageObject2;
}
this.replyingMessageObject = messageObject;
this.replyingQuote = quote;
this.replyingTopMessage = replyingTopMessage;
ChatActivity chatActivity2 = this.parentFragment;
if (chatActivity2 == null || !chatActivity2.isTopic || chatActivity2.getThreadMessage() != this.replyingMessageObject) {
setButtons(this.replyingMessageObject, true);
}
} else if (this.replyingMessageObject == this.botButtonsMessageObject) {
this.replyingMessageObject = null;
this.replyingTopMessage = null;
this.replyingQuote = null;
setButtons(this.botMessageObject, false);
this.botMessageObject = null;
} else {
this.replyingMessageObject = null;
this.replyingQuote = null;
this.replyingTopMessage = null;
}
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
MediaController.getInstance().setReplyingMessage(messageObject, getThreadMessage(), chatActivityEnterViewDelegate != null ? chatActivityEnterViewDelegate.getReplyToStory() : null);
updateFieldHint(z);
}
public void setWebPage(TLRPC.WebPage webPage, boolean searchWebPages) {
this.messageWebPage = webPage;
this.messageWebPageSearch = searchWebPages;
}
public boolean isMessageWebPageSearchEnabled() {
return this.messageWebPageSearch;
}
public final void hideRecordedAudioPanel(boolean wasSent) {
AnimatorSet animatorSet;
AnimatorSet animatorSet2 = this.recordPannelAnimation;
if (animatorSet2 == null || !animatorSet2.isRunning()) {
this.audioToSendPath = null;
this.audioToSend = null;
this.audioToSendMessageObject = null;
this.videoToSendMessageObject = null;
VideoTimelineView videoTimelineView = this.videoTimelineView;
if (videoTimelineView != null) {
videoTimelineView.destroy();
}
ChatActivityEnterViewAnimatedIconView chatActivityEnterViewAnimatedIconView = this.audioVideoSendButton;
if (chatActivityEnterViewAnimatedIconView != null) {
chatActivityEnterViewAnimatedIconView.setVisibility(0);
}
if (wasSent) {
this.attachButton.setAlpha(0.0f);
this.attachButton.setScaleX(0.0f);
this.attachButton.setScaleY(0.0f);
this.emojiButtonAlpha = 0.0f;
this.emojiButtonScale = 0.0f;
updateEmojiButtonParams();
this.recordPannelAnimation = new AnimatorSet();
ArrayList arrayList = new ArrayList();
ChatActivityEnterViewAnimatedIconView chatActivityEnterViewAnimatedIconView2 = this.emojiButton;
Property<? super View, Float> property = this.EMOJI_BUTTON_ALPHA;
float[] fArr = new float[1];
fArr[0] = this.emojiButtonRestricted ? 0.5f : 1.0f;
arrayList.add(ObjectAnimator.ofFloat(chatActivityEnterViewAnimatedIconView2, (Property<ChatActivityEnterViewAnimatedIconView, Float>) property, fArr));
arrayList.add(ObjectAnimator.ofFloat(this.emojiButton, (Property<ChatActivityEnterViewAnimatedIconView, Float>) this.EMOJI_BUTTON_SCALE, 1.0f));
arrayList.add(ObjectAnimator.ofFloat(this.recordDeleteImageView, (Property<RLottieImageView, Float>) View.ALPHA, 0.0f));
arrayList.add(ObjectAnimator.ofFloat(this.recordDeleteImageView, (Property<RLottieImageView, Float>) View.SCALE_X, 0.0f));
arrayList.add(ObjectAnimator.ofFloat(this.recordDeleteImageView, (Property<RLottieImageView, Float>) View.SCALE_Y, 0.0f));
arrayList.add(ObjectAnimator.ofFloat(this.recordedAudioPanel, (Property<FrameLayout, Float>) View.ALPHA, 0.0f));
arrayList.add(ObjectAnimator.ofFloat(this.attachButton, (Property<ImageView, Float>) View.ALPHA, 1.0f));
arrayList.add(ObjectAnimator.ofFloat(this.attachButton, (Property<ImageView, Float>) View.SCALE_X, 1.0f));
arrayList.add(ObjectAnimator.ofFloat(this.attachButton, (Property<ImageView, Float>) View.SCALE_Y, 1.0f));
arrayList.add(ObjectAnimator.ofFloat(this.messageEditText, (Property<EditTextCaption, Float>) View.ALPHA, 1.0f));
arrayList.add(ObjectAnimator.ofFloat(this.messageEditText, (Property<EditTextCaption, Float>) this.MESSAGE_TEXT_TRANSLATION_X, 0.0f));
ControlsView controlsView = this.controlsView;
if (controlsView != null) {
arrayList.add(ObjectAnimator.ofFloat(controlsView, (Property<ControlsView, Float>) View.ALPHA, 0.0f));
this.controlsView.hideHintView();
}
this.recordPannelAnimation.playTogether(arrayList);
BotCommandsMenuView botCommandsMenuView = this.botCommandsMenuButton;
if (botCommandsMenuView != null) {
botCommandsMenuView.setAlpha(0.0f);
this.botCommandsMenuButton.setScaleY(0.0f);
this.botCommandsMenuButton.setScaleX(0.0f);
this.recordPannelAnimation.playTogether(ObjectAnimator.ofFloat(this.botCommandsMenuButton, (Property<BotCommandsMenuView, Float>) View.ALPHA, 1.0f), ObjectAnimator.ofFloat(this.botCommandsMenuButton, (Property<BotCommandsMenuView, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.botCommandsMenuButton, (Property<BotCommandsMenuView, Float>) View.SCALE_Y, 1.0f));
}
this.recordPannelAnimation.setDuration(150L);
this.recordPannelAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
FrameLayout frameLayout = ChatActivityEnterView.this.recordedAudioPanel;
if (frameLayout != null) {
frameLayout.setVisibility(8);
}
EditTextCaption editTextCaption = ChatActivityEnterView.this.messageEditText;
if (editTextCaption != null) {
editTextCaption.requestFocus();
}
ChatActivityEnterView.this.isRecordingStateChanged();
}
});
} else {
RLottieImageView rLottieImageView = this.recordDeleteImageView;
if (rLottieImageView != null) {
rLottieImageView.playAnimation();
}
AnimatorSet animatorSet3 = new AnimatorSet();
ArrayList arrayList2 = new ArrayList();
if (isInVideoMode()) {
arrayList2.add(ObjectAnimator.ofFloat(this.videoTimelineView, (Property<VideoTimelineView, Float>) View.ALPHA, 0.0f));
arrayList2.add(ObjectAnimator.ofFloat(this.videoTimelineView, (Property<VideoTimelineView, Float>) View.TRANSLATION_X, -AndroidUtilities.dp(20.0f)));
arrayList2.add(ObjectAnimator.ofFloat(this.messageEditText, (Property<EditTextCaption, Float>) this.MESSAGE_TEXT_TRANSLATION_X, 0.0f));
ControlsView controlsView2 = this.controlsView;
if (controlsView2 != null) {
arrayList2.add(ObjectAnimator.ofFloat(controlsView2, (Property<ControlsView, Float>) View.ALPHA, 0.0f));
this.controlsView.hideHintView();
}
animatorSet3.playTogether(arrayList2);
if (this.emojiButtonPaddingAlpha == 1.0f) {
animatorSet3.playTogether(ObjectAnimator.ofFloat(this.messageEditText, (Property<EditTextCaption, Float>) View.ALPHA, 1.0f));
} else {
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.messageEditText, (Property<EditTextCaption, Float>) View.ALPHA, 1.0f);
ofFloat.setStartDelay(750L);
ofFloat.setDuration(200L);
animatorSet3.playTogether(ofFloat);
}
} else {
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null && this.emojiButtonPaddingAlpha == 1.0f) {
editTextCaption.setAlpha(1.0f);
this.messageTextTranslationX = 0.0f;
updateMessageTextParams();
} else {
this.messageTextTranslationX = 0.0f;
updateMessageTextParams();
ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(this.messageEditText, (Property<EditTextCaption, Float>) View.ALPHA, 1.0f);
ofFloat2.setStartDelay(750L);
ofFloat2.setDuration(200L);
animatorSet3.playTogether(ofFloat2);
}
arrayList2.add(ObjectAnimator.ofFloat(this.recordedAudioSeekBar, (Property<SeekBarWaveformView, Float>) View.ALPHA, 0.0f));
arrayList2.add(ObjectAnimator.ofFloat(this.recordedAudioPlayButton, (Property<ImageView, Float>) View.ALPHA, 0.0f));
arrayList2.add(ObjectAnimator.ofFloat(this.recordedAudioBackground, (Property<View, Float>) View.ALPHA, 0.0f));
arrayList2.add(ObjectAnimator.ofFloat(this.recordedAudioTimeTextView, (Property<TextView, Float>) View.ALPHA, 0.0f));
arrayList2.add(ObjectAnimator.ofFloat(this.recordedAudioSeekBar, (Property<SeekBarWaveformView, Float>) View.TRANSLATION_X, -AndroidUtilities.dp(20.0f)));
arrayList2.add(ObjectAnimator.ofFloat(this.recordedAudioPlayButton, (Property<ImageView, Float>) View.TRANSLATION_X, -AndroidUtilities.dp(20.0f)));
arrayList2.add(ObjectAnimator.ofFloat(this.recordedAudioBackground, (Property<View, Float>) View.TRANSLATION_X, -AndroidUtilities.dp(20.0f)));
arrayList2.add(ObjectAnimator.ofFloat(this.recordedAudioTimeTextView, (Property<TextView, Float>) View.TRANSLATION_X, -AndroidUtilities.dp(20.0f)));
ControlsView controlsView3 = this.controlsView;
if (controlsView3 != null) {
arrayList2.add(ObjectAnimator.ofFloat(controlsView3, (Property<ControlsView, Float>) View.ALPHA, 0.0f));
this.controlsView.hideHintView();
}
animatorSet3.playTogether(arrayList2);
}
animatorSet3.setDuration(200L);
ImageView imageView = this.attachButton;
if (imageView != null) {
imageView.setAlpha(0.0f);
this.attachButton.setScaleX(0.0f);
this.attachButton.setScaleY(0.0f);
animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofFloat(this.attachButton, (Property<ImageView, Float>) View.ALPHA, 1.0f), ObjectAnimator.ofFloat(this.attachButton, (Property<ImageView, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.attachButton, (Property<ImageView, Float>) View.SCALE_Y, 1.0f));
animatorSet.setDuration(150L);
} else {
animatorSet = null;
}
this.emojiButtonScale = 0.0f;
this.emojiButtonAlpha = 0.0f;
updateEmojiButtonParams();
AnimatorSet animatorSet4 = new AnimatorSet();
Animator[] animatorArr = new Animator[6];
animatorArr[0] = ObjectAnimator.ofFloat(this.recordDeleteImageView, (Property<RLottieImageView, Float>) View.ALPHA, 0.0f);
animatorArr[1] = ObjectAnimator.ofFloat(this.recordDeleteImageView, (Property<RLottieImageView, Float>) View.SCALE_X, 0.0f);
animatorArr[2] = ObjectAnimator.ofFloat(this.recordDeleteImageView, (Property<RLottieImageView, Float>) View.SCALE_Y, 0.0f);
animatorArr[3] = ObjectAnimator.ofFloat(this.recordDeleteImageView, (Property<RLottieImageView, Float>) View.ALPHA, 0.0f);
ChatActivityEnterViewAnimatedIconView chatActivityEnterViewAnimatedIconView3 = this.emojiButton;
Property<? super View, Float> property2 = this.EMOJI_BUTTON_ALPHA;
float[] fArr2 = new float[1];
fArr2[0] = this.emojiButtonRestricted ? 0.5f : 1.0f;
animatorArr[4] = ObjectAnimator.ofFloat(chatActivityEnterViewAnimatedIconView3, (Property<ChatActivityEnterViewAnimatedIconView, Float>) property2, fArr2);
animatorArr[5] = ObjectAnimator.ofFloat(this.emojiButton, (Property<ChatActivityEnterViewAnimatedIconView, Float>) this.EMOJI_BUTTON_SCALE, 1.0f);
animatorSet4.playTogether(animatorArr);
BotCommandsMenuView botCommandsMenuView2 = this.botCommandsMenuButton;
if (botCommandsMenuView2 != null) {
botCommandsMenuView2.setAlpha(0.0f);
this.botCommandsMenuButton.setScaleY(0.0f);
this.botCommandsMenuButton.setScaleX(0.0f);
animatorSet4.playTogether(ObjectAnimator.ofFloat(this.botCommandsMenuButton, (Property<BotCommandsMenuView, Float>) View.ALPHA, 1.0f), ObjectAnimator.ofFloat(this.botCommandsMenuButton, (Property<BotCommandsMenuView, Float>) View.SCALE_X, 1.0f), ObjectAnimator.ofFloat(this.botCommandsMenuButton, (Property<BotCommandsMenuView, Float>) View.SCALE_Y, 1.0f));
}
animatorSet4.setDuration(150L);
animatorSet4.setStartDelay(600L);
AnimatorSet animatorSet5 = new AnimatorSet();
this.recordPannelAnimation = animatorSet5;
if (animatorSet != null) {
animatorSet5.playTogether(animatorSet3, animatorSet, animatorSet4);
} else {
animatorSet5.playTogether(animatorSet3, animatorSet4);
}
this.recordPannelAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
VideoTimelineView videoTimelineView2 = ChatActivityEnterView.this.videoTimelineView;
if (videoTimelineView2 != null) {
videoTimelineView2.setVisibility(8);
}
SeekBarWaveformView seekBarWaveformView = ChatActivityEnterView.this.recordedAudioSeekBar;
if (seekBarWaveformView != null) {
seekBarWaveformView.setVisibility(8);
}
if (ChatActivityEnterView.this.recordedAudioPlayButton != null) {
ChatActivityEnterView.this.recordedAudioPlayButton.setVisibility(8);
}
if (ChatActivityEnterView.this.recordedAudioBackground != null) {
ChatActivityEnterView.this.recordedAudioBackground.setVisibility(8);
}
if (ChatActivityEnterView.this.recordedAudioTimeTextView != null) {
ChatActivityEnterView.this.recordedAudioTimeTextView.setVisibility(8);
}
ChatActivityEnterView.this.transformToSeekbar = 0.0f;
ChatActivityEnterView.this.isRecordingStateChanged();
ChatActivityEnterView.this.hideRecordedAudioPanelInternal();
if (ChatActivityEnterView.this.recordCircle != null) {
ChatActivityEnterView.this.recordCircle.setSendButtonInvisible();
}
}
});
}
AnimatorSet animatorSet6 = this.recordPannelAnimation;
if (animatorSet6 != null) {
animatorSet6.start();
}
ControlsView controlsView4 = this.controlsView;
if (controlsView4 != null) {
controlsView4.invalidate();
}
}
}
public final void hideRecordedAudioPanelInternal() {
this.audioToSendPath = null;
this.audioToSend = null;
this.audioToSendMessageObject = null;
this.videoToSendMessageObject = null;
VideoTimelineView videoTimelineView = this.videoTimelineView;
if (videoTimelineView != null) {
videoTimelineView.destroy();
}
SeekBarWaveformView seekBarWaveformView = this.recordedAudioSeekBar;
if (seekBarWaveformView != null) {
seekBarWaveformView.setAlpha(1.0f);
this.recordedAudioSeekBar.setTranslationX(0.0f);
}
ImageView imageView = this.recordedAudioPlayButton;
if (imageView != null) {
imageView.setAlpha(1.0f);
this.recordedAudioPlayButton.setTranslationX(0.0f);
}
View view = this.recordedAudioBackground;
if (view != null) {
view.setAlpha(1.0f);
this.recordedAudioBackground.setTranslationX(0.0f);
}
TextView textView = this.recordedAudioTimeTextView;
if (textView != null) {
textView.setAlpha(1.0f);
this.recordedAudioTimeTextView.setTranslationX(0.0f);
}
VideoTimelineView videoTimelineView2 = this.videoTimelineView;
if (videoTimelineView2 != null) {
videoTimelineView2.setAlpha(1.0f);
this.videoTimelineView.setTranslationX(0.0f);
}
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null) {
editTextCaption.setAlpha(1.0f);
this.messageTextTranslationX = 0.0f;
updateMessageTextParams();
this.messageEditText.requestFocus();
}
FrameLayout frameLayout = this.recordedAudioPanel;
if (frameLayout != null) {
frameLayout.setVisibility(8);
}
isRecordingStateChanged();
}
public final void lambda$onSendLongClick$40() {
PlusUtils.showLanguageSelector(this.parentActivity, null, new PlusUtils.TranslateCallBack() {
@Override
public void onProviderChanged(int i) {
PlusUtils.TranslateCallBack.CC.$default$onProviderChanged(this, i);
}
@Override
public void onSuccess(String translation) {
}
@Override
public void onChanged(String toLang) {
if (TextUtils.isEmpty(toLang)) {
return;
}
ChatActivityEnterView.this.translationChatLang = toLang;
PlusSettings.saveChatTranslationLanguage(ChatActivityEnterView.this.parentFragment.getDialogId(), toLang);
ChatActivityEnterView.this.sendPopupLayout = null;
ChatActivityEnterView.this.translateMessage();
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
MessageSendPreview messageSendPreview = chatActivityEnterView.messageSendPreview;
if (messageSendPreview != null) {
messageSendPreview.dismiss(true);
ChatActivityEnterView.this.messageSendPreview = null;
} else {
AndroidUtilities.cancelRunOnUIThread(chatActivityEnterView.dismissSendPreview);
AndroidUtilities.runOnUIThread(ChatActivityEnterView.this.dismissSendPreview, 500L);
}
}
}, false, false);
}
public final void translateMessage() {
BaseTranslationEngine.translate(this.messageEditText.getText().toString(), this.translationChatLang, new BaseTranslationEngine.TranslateCallBack() {
@Override
public void onError(Exception error) {
}
@Override
public void onSuccess(String translation, String fl, String tl) {
onSuccess(translation);
}
@Override
public void onSuccess(String translation) {
ChatActivityEnterView.this.messageEditText.setText(translation);
MessageSendPreview messageSendPreview = ChatActivityEnterView.this.messageSendPreview;
if (messageSendPreview != null) {
messageSendPreview.setEditText(translation);
}
ChatActivityEnterView.this.showSendButton();
}
});
}
public final void showSendButton() {
this.cancelBotButton.setVisibility(8);
this.cancelBotButton.setScaleX(0.1f);
this.cancelBotButton.setScaleY(0.1f);
this.cancelBotButton.setAlpha(0.0f);
this.sendButton.setVisibility(0);
this.sendButton.setScaleX(1.0f);
this.sendButton.setScaleY(1.0f);
this.sendButton.setAlpha(1.0f);
}
public final void sendMessage() {
if (isInScheduleMode()) {
AlertsCreator.createScheduleDatePickerDialog(this.parentActivity, this.parentFragment.getDialogId(), new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public void didSelectDate(boolean notify, int scheduleDate) {
MessageSendPreview messageSendPreview = ChatActivityEnterView.this.messageSendPreview;
if (messageSendPreview != null) {
messageSendPreview.dismiss(true);
ChatActivityEnterView.this.messageSendPreview = null;
}
ChatActivityEnterView.this.sendMessageInternal(notify, scheduleDate, true);
}
}, this.resourcesProvider);
} else {
sendMessageInternal(true, 0, true);
}
}
public final void sendMessageInternal(final boolean notify, final int scheduleDate, boolean allowConfirm) {
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate;
TLRPC.Chat currentChat;
EmojiView emojiView;
if (this.slowModeTimer == Integer.MAX_VALUE && !isInScheduleMode()) {
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate2 = this.delegate;
if (chatActivityEnterViewDelegate2 != null) {
chatActivityEnterViewDelegate2.scrollToSendingMessage();
return;
}
return;
}
ChatActivity chatActivity = this.parentFragment;
if (chatActivity != null) {
TLRPC.Chat currentChat2 = chatActivity.getCurrentChat();
if ((this.parentFragment.getCurrentUser() != null || ((ChatObject.isChannel(currentChat2) && currentChat2.megagroup) || !ChatObject.isChannel(currentChat2))) && !PlusSettings.showSendWithoutSound) {
MessagesController.getNotificationsSettings(this.currentAccount).edit().putBoolean(NotificationsSettingsFacade.PROPERTY_SILENT + this.dialog_id, !notify).commit();
}
}
if (this.stickersExpanded) {
setStickersExpanded(false, true, false);
if (this.searchingType != 0 && (emojiView = this.emojiView) != null) {
emojiView.closeSearch(false);
this.emojiView.hideSearchKeyboard();
}
}
if (allowConfirm && showConfirmAlert(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$sendMessageInternal$46(notify, scheduleDate);
}
})) {
return;
}
if (this.videoToSendMessageObject != null) {
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate3 = this.delegate;
int i = this.voiceOnce ? Integer.MAX_VALUE : 0;
MessageSendPreview messageSendPreview = this.messageSendPreview;
chatActivityEnterViewDelegate3.needStartRecordVideo(4, notify, scheduleDate, i, messageSendPreview != null ? messageSendPreview.getSelectedEffect() : 0L);
hideRecordedAudioPanel(true);
checkSendButton(true);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$sendMessageInternal$47();
}
}, 100L);
this.millisecondsRecorded = 0L;
return;
}
if (this.audioToSend != null) {
MessageObject playingMessageObject = MediaController.getInstance().getPlayingMessageObject();
if (playingMessageObject != null && playingMessageObject == this.audioToSendMessageObject) {
MediaController.getInstance().cleanupPlayer(true, true);
}
MediaController.getInstance().cleanRecording(false);
MediaDataController mediaDataController = MediaDataController.getInstance(this.currentAccount);
long j = this.dialog_id;
ChatActivity chatActivity2 = this.parentFragment;
mediaDataController.pushDraftVoiceMessage(j, (chatActivity2 == null || !chatActivity2.isTopic) ? 0L : chatActivity2.getTopicId(), null);
SendMessagesHelper$SendMessageParams of = SendMessagesHelper$SendMessageParams.of(this.audioToSend, null, this.audioToSendPath, this.dialog_id, this.replyingMessageObject, getThreadMessage(), null, null, null, null, notify, scheduleDate, this.voiceOnce ? Integer.MAX_VALUE : 0, null, null, false);
ChatActivity chatActivity3 = this.parentFragment;
of.quick_reply_shortcut = chatActivity3 != null ? chatActivity3.quickReplyShortcut : null;
of.quick_reply_shortcut_id = chatActivity3 != null ? chatActivity3.getQuickReplyId() : 0;
MessageSendPreview messageSendPreview2 = this.messageSendPreview;
of.effect_id = messageSendPreview2 != null ? messageSendPreview2.getSelectedEffect() : 0L;
if (!this.delegate.hasForwardingMessages()) {
MessageObject.SendAnimationData sendAnimationData = new MessageObject.SendAnimationData();
sendAnimationData.fromPreview = System.currentTimeMillis() - this.sentFromPreview < 200;
of.sendAnimationData = sendAnimationData;
}
applyStoryToSendMessageParams(of);
SendMessagesHelper.getInstance(this.currentAccount).sendMessage(of);
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate4 = this.delegate;
if (chatActivityEnterViewDelegate4 != null) {
chatActivityEnterViewDelegate4.onMessageSend(null, notify, scheduleDate);
}
hideRecordedAudioPanel(true);
checkSendButton(true);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$sendMessageInternal$48();
}
}, 100L);
this.millisecondsRecorded = 0L;
return;
}
EditTextCaption editTextCaption = this.messageEditText;
final CharSequence textToUse = editTextCaption == null ? BuildConfig.APP_CENTER_HASH : editTextCaption.getTextToUse();
ChatActivity chatActivity4 = this.parentFragment;
if (chatActivity4 != null && (currentChat = chatActivity4.getCurrentChat()) != null && currentChat.slowmode_enabled && !ChatObject.hasAdminRights(currentChat)) {
if (textToUse.length() > this.accountInstance.getMessagesController().maxMessageLength) {
AlertsCreator.showSimpleAlert(this.parentFragment, LocaleController.getString("Slowmode", R.string.Slowmode), LocaleController.getString("SlowmodeSendErrorTooLong", R.string.SlowmodeSendErrorTooLong), this.resourcesProvider);
return;
} else if (this.forceShowSendButton && textToUse.length() > 0) {
AlertsCreator.showSimpleAlert(this.parentFragment, LocaleController.getString("Slowmode", R.string.Slowmode), LocaleController.getString("SlowmodeSendError", R.string.SlowmodeSendError), this.resourcesProvider);
return;
}
}
if (checkPremiumAnimatedEmoji(this.currentAccount, this.dialog_id, this.parentFragment, null, textToUse)) {
return;
}
if (processSendingText(textToUse, notify, scheduleDate)) {
if (this.delegate.hasForwardingMessages() || ((scheduleDate != 0 && !isInScheduleMode()) || isInScheduleMode())) {
EditTextCaption editTextCaption2 = this.messageEditText;
if (editTextCaption2 != null) {
editTextCaption2.setText(BuildConfig.APP_CENTER_HASH);
}
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate5 = this.delegate;
if (chatActivityEnterViewDelegate5 != null) {
chatActivityEnterViewDelegate5.onMessageSend(textToUse, notify, scheduleDate);
}
} else {
this.messageTransitionIsRunning = false;
Runnable runnable = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$sendMessageInternal$49(textToUse, notify, scheduleDate);
}
};
this.moveToSendStateRunnable = runnable;
AndroidUtilities.runOnUIThread(runnable, 200L);
}
this.lastTypingTimeSend = 0L;
return;
}
if (!this.forceShowSendButton || (chatActivityEnterViewDelegate = this.delegate) == null) {
return;
}
chatActivityEnterViewDelegate.onMessageSend(null, notify, scheduleDate);
}
public void lambda$sendMessageInternal$46(boolean z, int i) {
sendMessageInternal(z, i, false);
}
public void lambda$sendMessageInternal$47() {
RecordCircle recordCircle = this.recordCircle;
if (recordCircle != null) {
recordCircle.setSendButtonInvisible();
}
}
public void lambda$sendMessageInternal$48() {
RecordCircle recordCircle = this.recordCircle;
if (recordCircle != null) {
recordCircle.setSendButtonInvisible();
}
}
public void lambda$sendMessageInternal$49(CharSequence charSequence, boolean z, int i) {
this.moveToSendStateRunnable = null;
hideTopView(true);
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null) {
editTextCaption.setText(BuildConfig.APP_CENTER_HASH);
}
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
chatActivityEnterViewDelegate.onMessageSend(charSequence, z, i);
}
}
public static boolean checkPremiumAnimatedEmoji(int currentAccount, long dialogId, final BaseFragment parentFragment, FrameLayout container, CharSequence message) {
AnimatedEmojiSpan[] animatedEmojiSpanArr;
int i;
TLRPC.ChatFull chatFull;
TLRPC.TL_messages_stickerSet groupStickerSetById;
ArrayList<TLRPC.Document> arrayList;
ArrayList<TLRPC.Document> arrayList2;
ArrayList<TLRPC.Document> arrayList3;
if (message == null || parentFragment == null || UserConfig.getInstance(currentAccount).isPremium() || UserConfig.getInstance(currentAccount).getClientUserId() == dialogId || !(message instanceof Spanned) || (animatedEmojiSpanArr = (AnimatedEmojiSpan[]) ((Spanned) message).getSpans(0, message.length(), AnimatedEmojiSpan.class)) == null) {
return false;
}
int i2 = 0;
while (i2 < animatedEmojiSpanArr.length) {
if (animatedEmojiSpanArr[i2] != null) {
TLRPC.Document document = animatedEmojiSpanArr[i2].document;
if (document == null) {
document = AnimatedEmojiDrawable.findDocument(currentAccount, animatedEmojiSpanArr[i2].getDocumentId());
}
long documentId = animatedEmojiSpanArr[i2].getDocumentId();
if (document == null) {
Iterator<TLRPC.TL_messages_stickerSet> it = MediaDataController.getInstance(currentAccount).getStickerSets(5).iterator();
while (it.hasNext()) {
TLRPC.TL_messages_stickerSet next = it.next();
if (next != null && (arrayList3 = next.documents) != null && !arrayList3.isEmpty()) {
Iterator<TLRPC.Document> it2 = next.documents.iterator();
while (true) {
if (!it2.hasNext()) {
break;
}
TLRPC.Document next2 = it2.next();
if (next2.id == documentId) {
document = next2;
break;
}
}
}
}
}
if (document == null) {
Iterator<TLRPC.StickerSetCovered> it3 = MediaDataController.getInstance(currentAccount).getFeaturedEmojiSets().iterator();
while (it3.hasNext()) {
TLRPC.StickerSetCovered next3 = it3.next();
if (next3 != null && (arrayList2 = next3.covers) != null && !arrayList2.isEmpty()) {
Iterator<TLRPC.Document> it4 = next3.covers.iterator();
while (it4.hasNext()) {
TLRPC.Document next4 = it4.next();
i = i2;
if (next4.id == documentId) {
document = next4;
break;
}
i2 = i;
}
}
i = i2;
if (document != null) {
break;
}
ArrayList<TLRPC.Document> arrayList4 = null;
if (next3 instanceof TLRPC.TL_stickerSetFullCovered) {
arrayList4 = ((TLRPC.TL_stickerSetFullCovered) next3).documents;
} else if ((next3 instanceof TLRPC.TL_stickerSetNoCovered) && next3.set != null) {
TLRPC.TL_inputStickerSetID tL_inputStickerSetID = new TLRPC.TL_inputStickerSetID();
tL_inputStickerSetID.id = next3.set.id;
TLRPC.TL_messages_stickerSet stickerSet = MediaDataController.getInstance(currentAccount).getStickerSet(tL_inputStickerSetID, true);
if (stickerSet != null && (arrayList = stickerSet.documents) != null) {
arrayList4 = arrayList;
}
}
if (arrayList4 != null && !arrayList4.isEmpty()) {
Iterator<TLRPC.Document> it5 = arrayList4.iterator();
while (true) {
if (!it5.hasNext()) {
break;
}
TLRPC.Document next5 = it5.next();
if (next5.id == documentId) {
document = next5;
break;
}
}
}
if (document != null) {
break;
}
i2 = i;
}
}
i = i2;
if (document != null && (chatFull = MessagesController.getInstance(currentAccount).getChatFull(-dialogId)) != null && chatFull.emojiset != null && (groupStickerSetById = MediaDataController.getInstance(currentAccount).getGroupStickerSetById(chatFull.emojiset)) != null) {
Iterator<TLRPC.Document> it6 = groupStickerSetById.documents.iterator();
while (it6.hasNext()) {
if (it6.next().id == documentId) {
return false;
}
}
}
if (document == null || !MessageObject.isFreeEmoji(document)) {
BulletinFactory.of(parentFragment).createEmojiBulletin(document, AndroidUtilities.replaceTags(LocaleController.getString("UnlockPremiumEmojiHint", R.string.UnlockPremiumEmojiHint)), LocaleController.getString("PremiumMore", R.string.PremiumMore), new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.lambda$checkPremiumAnimatedEmoji$50(parentFragment);
}
}).show();
return true;
}
} else {
i = i2;
}
i2 = i + 1;
}
return false;
}
public static void lambda$checkPremiumAnimatedEmoji$50(BaseFragment baseFragment) {
if (baseFragment != null) {
new PremiumFeatureBottomSheet(baseFragment, 11, false).show();
} else if (baseFragment.getContext() instanceof LaunchActivity) {
baseFragment.getContext().presentFragment(new PremiumPreviewFragment((String) null));
}
}
public final void showCaptionLimitBulletin() {
ChatActivity chatActivity = this.parentFragment;
if (chatActivity == null || !ChatObject.isChannelAndNotMegaGroup(chatActivity.getCurrentChat())) {
return;
}
BulletinFactory.of(this.parentFragment).createCaptionLimitBulletin(MessagesController.getInstance(this.currentAccount).captionLengthLimitPremium, new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$showCaptionLimitBulletin$51();
}
}).show();
}
public void lambda$showCaptionLimitBulletin$51() {
ChatActivity chatActivity = this.parentFragment;
if (chatActivity != null) {
chatActivity.presentFragment(new PremiumPreviewFragment("caption_limit"));
}
}
public static class BusinessLinkPresetMessage {
public ArrayList<TLRPC.MessageEntity> entities;
public String text;
public BusinessLinkPresetMessage() {
}
}
public final BusinessLinkPresetMessage calculateBusinessLinkPresetMessage() {
EditTextCaption editTextCaption = this.messageEditText;
CharSequence[] charSequenceArr = {AndroidUtilities.getTrimmedString(editTextCaption == null ? BuildConfig.APP_CENTER_HASH : editTextCaption.getTextToUse())};
ArrayList<TLRPC.MessageEntity> entities = MediaDataController.getInstance(this.currentAccount).getEntities(charSequenceArr, true);
CharSequence charSequence = charSequenceArr[0];
int size = entities.size();
for (int i = 0; i < size; i++) {
TLRPC.MessageEntity messageEntity = entities.get(i);
if (messageEntity.offset + messageEntity.length > charSequence.length()) {
messageEntity.length = charSequence.length() - messageEntity.offset;
}
}
BusinessLinkPresetMessage businessLinkPresetMessage = new BusinessLinkPresetMessage();
businessLinkPresetMessage.text = charSequence.toString();
businessLinkPresetMessage.entities = entities;
return businessLinkPresetMessage;
}
public boolean businessLinkHasChanges() {
BusinessLinkPresetMessage calculateBusinessLinkPresetMessage = calculateBusinessLinkPresetMessage();
return (TextUtils.equals(calculateBusinessLinkPresetMessage.text, this.lastSavedBusinessLinkMessage.text) && MediaDataController.entitiesEqual(this.lastSavedBusinessLinkMessage.entities, calculateBusinessLinkPresetMessage.entities)) ? false : true;
}
public final void saveBusinessLink() {
if (isEditingBusinessLink()) {
if (this.currentLimit - this.codePointCount < 0) {
NumberTextView numberTextView = this.captionLimitView;
if (numberTextView != null) {
AndroidUtilities.shakeViewSpring(numberTextView, 3.5f);
try {
this.captionLimitView.performHapticFeedback(3, 2);
return;
} catch (Exception unused) {
return;
}
}
return;
}
BusinessLinkPresetMessage calculateBusinessLinkPresetMessage = calculateBusinessLinkPresetMessage();
this.lastSavedBusinessLinkMessage = calculateBusinessLinkPresetMessage;
BusinessLinksController.getInstance(this.currentAccount).editLinkMessage(this.editingBusinessLink.link, calculateBusinessLinkPresetMessage.text, calculateBusinessLinkPresetMessage.entities, new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$saveBusinessLink$52();
}
});
}
}
public void lambda$saveBusinessLink$52() {
BulletinFactory.of(this.parentFragment).createSuccessBulletin(LocaleController.getString(R.string.BusinessLinkSaved)).show();
}
public void doneEditingMessage() {
MessagePreviewParams messagePreviewParams;
int i;
if (this.editingMessageObject == null) {
return;
}
if (this.currentLimit - this.codePointCount < 0) {
NumberTextView numberTextView = this.captionLimitView;
if (numberTextView != null) {
AndroidUtilities.shakeViewSpring(numberTextView, 3.5f);
try {
if (!PlusSettings.disableActionsVibrations) {
this.captionLimitView.performHapticFeedback(3, 2);
}
} catch (Exception unused) {
}
}
if (MessagesController.getInstance(this.currentAccount).premiumFeaturesBlocked() || MessagesController.getInstance(this.currentAccount).captionLengthLimitPremium <= this.codePointCount) {
return;
}
showCaptionLimitBulletin();
return;
}
if (this.searchingType != 0) {
setSearchingTypeInternal(0, true);
this.emojiView.closeSearch(false);
if (this.stickersExpanded) {
setStickersExpanded(false, true, false);
this.waitingForKeyboardOpenAfterAnimation = true;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$doneEditingMessage$53();
}
}, 200L);
}
}
EditTextCaption editTextCaption = this.messageEditText;
CharSequence textToUse = editTextCaption == null ? BuildConfig.APP_CENTER_HASH : editTextCaption.getTextToUse();
MessageObject messageObject = this.editingMessageObject;
if (messageObject == null || messageObject.type != 19) {
textToUse = AndroidUtilities.getTrimmedString(textToUse);
}
CharSequence[] charSequenceArr = {textToUse};
if (TextUtils.isEmpty(charSequenceArr[0])) {
TLRPC.MessageMedia messageMedia = this.editingMessageObject.messageOwner.media;
if ((messageMedia instanceof TLRPC.TL_messageMediaWebPage) || (messageMedia instanceof TLRPC.TL_messageMediaEmpty) || messageMedia == null) {
AndroidUtilities.shakeViewSpring(this.messageEditText, -3.0f);
BotWebViewVibrationEffect.APP_ERROR.vibrate();
return;
}
}
ArrayList<TLRPC.MessageEntity> entities = MediaDataController.getInstance(this.currentAccount).getEntities(charSequenceArr, supportsSendingNewEntities());
if (!TextUtils.equals(charSequenceArr[0], this.editingMessageObject.messageText) || ((entities != null && !entities.isEmpty()) || !this.editingMessageObject.messageOwner.entities.isEmpty() || (this.editingMessageObject.messageOwner.media instanceof TLRPC.TL_messageMediaWebPage))) {
MessageObject messageObject2 = this.editingMessageObject;
messageObject2.editingMessage = charSequenceArr[0];
messageObject2.editingMessageEntities = entities;
messageObject2.editingMessageSearchWebPage = this.messageWebPageSearch;
ChatActivity chatActivity = this.parentFragment;
if (chatActivity != null && chatActivity.getCurrentChat() != null && (((i = this.editingMessageObject.type) == 0 || i == 19) && !ChatObject.canSendEmbed(this.parentFragment.getCurrentChat()))) {
MessageObject messageObject3 = this.editingMessageObject;
messageObject3.editingMessageSearchWebPage = false;
TLRPC.Message message = messageObject3.messageOwner;
message.flags &= -513;
message.media = null;
} else {
ChatActivity chatActivity2 = this.parentFragment;
if (chatActivity2 != null && (messagePreviewParams = chatActivity2.messagePreviewParams) != null) {
if (chatActivity2.foundWebPage instanceof TLRPC.TL_webPagePending) {
MessageObject messageObject4 = this.editingMessageObject;
messageObject4.editingMessageSearchWebPage = false;
int i2 = messageObject4.type;
if (i2 == 0 || i2 == 19) {
messageObject4.messageOwner.media = new TLRPC.TL_messageMediaEmpty();
this.editingMessageObject.messageOwner.flags |= 512;
}
} else if (messagePreviewParams.webpage != null) {
MessageObject messageObject5 = this.editingMessageObject;
messageObject5.editingMessageSearchWebPage = false;
TLRPC.Message message2 = messageObject5.messageOwner;
message2.flags |= 512;
message2.media = new TLRPC.TL_messageMediaWebPage();
this.editingMessageObject.messageOwner.media.webpage = this.parentFragment.messagePreviewParams.webpage;
} else {
MessageObject messageObject6 = this.editingMessageObject;
messageObject6.editingMessageSearchWebPage = false;
int i3 = messageObject6.type;
if (i3 == 0 || i3 == 19) {
TLRPC.Message message3 = messageObject6.messageOwner;
message3.flags |= 512;
message3.media = new TLRPC.TL_messageMediaEmpty();
}
}
TLRPC.Message message4 = this.editingMessageObject.messageOwner;
MessagePreviewParams messagePreviewParams2 = this.parentFragment.messagePreviewParams;
message4.invert_media = messagePreviewParams2.webpageTop;
if (messagePreviewParams2.hasMedia) {
TLRPC.MessageMedia messageMedia2 = message4.media;
if (messageMedia2 instanceof TLRPC.TL_messageMediaWebPage) {
boolean z = messagePreviewParams2.webpageSmall;
messageMedia2.force_small_media = z;
messageMedia2.force_large_media = true ^ z;
}
}
} else {
MessageObject messageObject7 = this.editingMessageObject;
messageObject7.editingMessageSearchWebPage = false;
int i4 = messageObject7.type;
if (i4 == 0 || i4 == 19) {
TLRPC.Message message5 = messageObject7.messageOwner;
message5.flags |= 512;
message5.media = new TLRPC.TL_messageMediaEmpty();
}
}
}
SendMessagesHelper sendMessagesHelper = SendMessagesHelper.getInstance(this.currentAccount);
MessageObject messageObject8 = this.editingMessageObject;
sendMessagesHelper.editMessage(messageObject8, (TLRPC.TL_photo) null, (VideoEditedInfo) null, (TLRPC.TL_document) null, (String) null, (HashMap) null, false, messageObject8.hasMediaSpoilers(), (Object) null);
}
setEditingMessageObject(null, null, false);
}
public void lambda$doneEditingMessage$53() {
this.waitingForKeyboardOpenAfterAnimation = false;
openKeyboardInternal();
}
public boolean processSendingText(CharSequence text, boolean notify, int scheduleDate) {
int i;
int i2;
int i3;
int i4;
boolean z;
MessageObject.SendAnimationData sendAnimationData;
MessagePreviewParams messagePreviewParams;
MessagePreviewParams messagePreviewParams2;
MessagePreviewParams messagePreviewParams3;
MessageObject messageObject;
ChatActivity chatActivity;
ChatActivity chatActivity2;
ChatActivity.ReplyQuote replyQuote = this.replyingQuote;
char c = 0;
if (replyQuote != null && (chatActivity2 = this.parentFragment) != null && replyQuote.outdated) {
chatActivity2.showQuoteMessageUpdate();
return false;
}
int i5 = 1;
int[] iArr = new int[1];
CharSequence charSequence = text;
Emoji.parseEmojis(charSequence, iArr);
boolean z2 = iArr[0] > 0;
if (!z2) {
charSequence = AndroidUtilities.getTrimmedString(text);
}
boolean supportsSendingNewEntities = supportsSendingNewEntities();
if (this.dontUpdateDiscussionChat && PlusSettings.discussionChat == 0) {
TLRPC.Chat chat = MessagesController.getInstance(this.currentAccount).getChat(Long.valueOf(this.dialog_id));
boolean z3 = ChatObject.isChannel(chat) && !chat.megagroup;
TLRPC.ChatFull chatFull = this.info;
if (chatFull != null && (!z3 || chatFull.linked_chat_id != 0)) {
TLRPC.TL_channels_setDiscussionGroup tL_channels_setDiscussionGroup = new TLRPC.TL_channels_setDiscussionGroup();
if (z3) {
tL_channels_setDiscussionGroup.broadcast = MessagesController.getInputChannel(chat);
tL_channels_setDiscussionGroup.group = new TLRPC.TL_inputChannelEmpty();
} else {
tL_channels_setDiscussionGroup.broadcast = new TLRPC.TL_inputChannelEmpty();
tL_channels_setDiscussionGroup.group = MessagesController.getInputChannel(chat);
}
ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_channels_setDiscussionGroup, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChatActivityEnterView.this.lambda$processSendingText$55(tLObject, tL_error);
}
}, 2);
}
}
int i6 = this.accountInstance.getMessagesController().maxMessageLength;
if (charSequence.length() == 0) {
return false;
}
if (this.delegate != null && (chatActivity = this.parentFragment) != null) {
if ((scheduleDate != 0) == chatActivity.isInScheduleMode()) {
this.delegate.prepareMessageSending();
}
}
int i7 = 0;
while (true) {
int i8 = i7 + i6;
if (charSequence.length() > i8) {
int i9 = i8 - 1;
i2 = -1;
i3 = -1;
i4 = -1;
for (int i10 = 0; i9 > i7 && i10 < 300; i10++) {
char charAt = charSequence.charAt(i9);
char charAt2 = i9 > 0 ? charSequence.charAt(i9 - 1) : ' ';
if (charAt == '\n' && charAt2 == '\n') {
i = i9;
break;
}
if (charAt == '\n') {
i4 = i9;
} else if (i2 < 0 && Character.isWhitespace(charAt) && charAt2 == '.') {
i2 = i9;
} else if (i3 < 0 && Character.isWhitespace(charAt)) {
i3 = i9;
}
i9--;
}
i = -1;
} else {
i = -1;
i2 = -1;
i3 = -1;
i4 = -1;
}
int min = Math.min(i8, charSequence.length());
if (i > 0) {
min = i;
} else if (i4 > 0) {
min = i4;
} else if (i2 > 0) {
min = i2;
} else if (i3 > 0) {
min = i3;
}
CharSequence subSequence = charSequence.subSequence(i7, min);
if (!z2) {
subSequence = AndroidUtilities.getTrimmedString(subSequence);
}
CharSequence[] charSequenceArr = new CharSequence[i5];
charSequenceArr[c] = subSequence;
ArrayList<TLRPC.MessageEntity> entities = MediaDataController.getInstance(this.currentAccount).getEntities(charSequenceArr, supportsSendingNewEntities);
if (!this.delegate.hasForwardingMessages()) {
MessageObject.SendAnimationData sendAnimationData2 = new MessageObject.SendAnimationData();
sendAnimationData2.fromPreview = System.currentTimeMillis() - this.sentFromPreview < 200;
float dp = AndroidUtilities.dp(22.0f);
sendAnimationData2.height = dp;
sendAnimationData2.width = dp;
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null) {
editTextCaption.getLocationInWindow(this.location);
sendAnimationData2.x = this.location[0] + AndroidUtilities.dp(11.0f);
sendAnimationData2.y = this.location[1] + AndroidUtilities.dp(19.0f);
} else {
sendAnimationData2.x = AndroidUtilities.dp(59.0f);
sendAnimationData2.y = AndroidUtilities.displaySize.y - AndroidUtilities.dp(19.0f);
}
sendAnimationData = sendAnimationData2;
z = z2;
} else if (this.messageSendPreview != null) {
MessageObject.SendAnimationData sendAnimationData3 = new MessageObject.SendAnimationData();
z = z2;
sendAnimationData3.fromPreview = System.currentTimeMillis() - this.sentFromPreview < 200;
sendAnimationData = sendAnimationData3;
} else {
z = z2;
sendAnimationData = null;
}
boolean checkUpdateStickersOrder = SendMessagesHelper.checkUpdateStickersOrder(charSequence);
MessageObject threadMessage = getThreadMessage();
SendMessagesHelper$SendMessageParams of = SendMessagesHelper$SendMessageParams.of(charSequenceArr[0].toString(), this.dialog_id, this.replyingMessageObject, (threadMessage != null || (messageObject = this.replyingTopMessage) == null) ? threadMessage : messageObject, this.messageWebPage, this.messageWebPageSearch, entities, null, null, notify, scheduleDate, sendAnimationData, checkUpdateStickersOrder);
ChatActivity chatActivity3 = this.parentFragment;
of.quick_reply_shortcut = chatActivity3 != null ? chatActivity3.quickReplyShortcut : null;
of.quick_reply_shortcut_id = chatActivity3 != null ? chatActivity3.getQuickReplyId() : 0;
MessageSendPreview messageSendPreview = this.messageSendPreview;
of.effect_id = messageSendPreview != null ? messageSendPreview.getSelectedEffect() : 0L;
applyStoryToSendMessageParams(of);
ChatActivity chatActivity4 = this.parentFragment;
of.invert_media = (chatActivity4 == null || (messagePreviewParams3 = chatActivity4.messagePreviewParams) == null || !messagePreviewParams3.webpageTop) ? false : true;
if (chatActivity4 != null && chatActivity4.getCurrentChat() != null && !ChatObject.canSendEmbed(this.parentFragment.getCurrentChat())) {
of.searchLinks = false;
of.mediaWebPage = null;
} else {
TLRPC.WebPage webPage = this.messageWebPage;
if (webPage instanceof TLRPC.TL_webPagePending) {
of.searchLinks = true;
of.mediaWebPage = null;
} else if (webPage != null) {
TLRPC.TL_messageMediaWebPage tL_messageMediaWebPage = new TLRPC.TL_messageMediaWebPage();
of.mediaWebPage = tL_messageMediaWebPage;
tL_messageMediaWebPage.webpage = this.messageWebPage;
ChatActivity chatActivity5 = this.parentFragment;
tL_messageMediaWebPage.force_large_media = (chatActivity5 == null || (messagePreviewParams2 = chatActivity5.messagePreviewParams) == null || messagePreviewParams2.webpageSmall) ? false : true;
tL_messageMediaWebPage.force_small_media = (chatActivity5 == null || (messagePreviewParams = chatActivity5.messagePreviewParams) == null || !messagePreviewParams.webpageSmall) ? false : true;
}
}
ChatActivity chatActivity6 = this.parentFragment;
if (chatActivity6 != null) {
chatActivity6.editingMessageObject = null;
chatActivity6.foundWebPage = null;
MessagePreviewParams messagePreviewParams4 = chatActivity6.messagePreviewParams;
if (messagePreviewParams4 != null) {
messagePreviewParams4.updateLink(this.currentAccount, null, BuildConfig.APP_CENTER_HASH, null, null, null);
}
setWebPage(null, true);
this.parentFragment.fallbackFieldPanel();
}
SendMessagesHelper.getInstance(this.currentAccount).sendMessage(of);
i7 = min + 1;
if (min == charSequence.length()) {
return true;
}
z2 = z;
i5 = 1;
c = 0;
}
}
public void lambda$processSendingText$55(TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$processSendingText$54(tL_error);
}
});
}
public void lambda$processSendingText$54(TLRPC.TL_error tL_error) {
if (tL_error == null) {
TLRPC.ChatFull chatFull = this.info;
PlusSettings.discussionChat = chatFull.linked_chat_id;
chatFull.linked_chat_id = 0L;
NotificationCenter.getInstance(this.currentAccount).lambda$postNotificationNameOnUIThread$1(NotificationCenter.chatInfoDidLoad, this.info, 0, Boolean.FALSE, null);
MessagesController.getInstance(this.currentAccount).loadFullChat(-((int) this.dialog_id), 0, true);
return;
}
String str = tL_error.text;
if (str != null) {
needShowAlert(str);
}
}
public final void applyStoryToSendMessageParams(SendMessagesHelper$SendMessageParams params) {
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
params.replyToStoryItem = chatActivityEnterViewDelegate.getReplyToStory();
params.replyQuote = this.delegate.getReplyQuote();
}
}
public final boolean supportsSendingNewEntities() {
ChatActivity chatActivity = this.parentFragment;
TLRPC.EncryptedChat currentEncryptedChat = chatActivity != null ? chatActivity.getCurrentEncryptedChat() : null;
return currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(currentEncryptedChat.layer) >= 101;
}
public final void dontUpdateGroup() {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$dontUpdateGroup$58();
}
}, 10000L);
}
public void lambda$dontUpdateGroup$58() {
TLRPC.ChatFull chatFull;
if (PlusSettings.discussionChat == 0 || (chatFull = this.info) == null || chatFull.linked_chat_id != 0) {
return;
}
TLRPC.TL_channels_setDiscussionGroup tL_channels_setDiscussionGroup = new TLRPC.TL_channels_setDiscussionGroup();
tL_channels_setDiscussionGroup.broadcast = MessagesController.getInputChannel(MessagesController.getInstance(this.currentAccount).getChat(Long.valueOf(this.dialog_id)));
tL_channels_setDiscussionGroup.group = MessagesController.getInputChannel(MessagesController.getInstance(this.currentAccount).getChat(Long.valueOf(PlusSettings.discussionChat)));
ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_channels_setDiscussionGroup, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
ChatActivityEnterView.this.lambda$dontUpdateGroup$57(tLObject, tL_error);
}
}, 2);
}
public void lambda$dontUpdateGroup$57(TLObject tLObject, final TLRPC.TL_error tL_error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$dontUpdateGroup$56(tL_error);
}
});
}
public void lambda$dontUpdateGroup$56(TLRPC.TL_error tL_error) {
if (tL_error == null) {
this.info.linked_chat_id = PlusSettings.discussionChat;
PlusSettings.discussionChat = 0L;
NotificationCenter.getInstance(this.currentAccount).lambda$postNotificationNameOnUIThread$1(NotificationCenter.chatInfoDidLoad, this.info, 0, Boolean.FALSE, null);
MessagesController.getInstance(this.currentAccount).loadFullChat(-((int) this.dialog_id), 0, true);
return;
}
String str = tL_error.text;
if (str != null) {
needShowAlert(str);
}
}
public final void needShowAlert(String text) {
String formatPluralString;
if (text == null || this.parentActivity == null || this.parentFragment == null) {
return;
}
int intValue = Utilities.parseInt((CharSequence) text).intValue();
if (intValue < 60) {
formatPluralString = LocaleController.formatPluralString("Seconds", intValue, new Object[0]);
} else {
formatPluralString = LocaleController.formatPluralString("Minutes", intValue / 60, new Object[0]);
}
AlertDialog.Builder builder = new AlertDialog.Builder(this.parentActivity);
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.formatString("FloodWaitTime", R.string.FloodWaitTime, new Object[]{formatPluralString}));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), (DialogInterface.OnClickListener) null);
this.parentFragment.showDialog(builder.create());
}
public final void checkSendButton(boolean animated) {
int themedColor;
int i;
ImageView imageView;
ImageView imageView2;
ImageView imageView3;
int i2;
if (this.editingMessageObject != null || this.recordingAudioVideo) {
return;
}
boolean z = this.isPaused ? false : animated;
EditTextCaption editTextCaption = this.messageEditText;
CharSequence trimmedString = editTextCaption == null ? BuildConfig.APP_CENTER_HASH : AndroidUtilities.getTrimmedString(editTextCaption.getTextToUse());
int i3 = this.slowModeTimer;
float f = 1.0f;
if (i3 > 0 && i3 != Integer.MAX_VALUE && !isInScheduleMode()) {
if (this.slowModeButton.getVisibility() != 0) {
if (z) {
if (this.runningAnimationType == 5) {
return;
}
AnimatorSet animatorSet = this.runningAnimation;
if (animatorSet != null) {
animatorSet.cancel();
this.runningAnimation = null;
}
AnimatorSet animatorSet2 = this.runningAnimation2;
if (animatorSet2 != null) {
animatorSet2.cancel();
this.runningAnimation2 = null;
}
if (this.attachLayout != null) {
this.runningAnimation2 = new AnimatorSet();
ArrayList arrayList = new ArrayList();
arrayList.add(ObjectAnimator.ofFloat(this.attachLayout, (Property<LinearLayout, Float>) this.ATTACH_LAYOUT_ALPHA, 0.0f));
arrayList.add(ObjectAnimator.ofFloat(this.attachLayout, (Property<LinearLayout, Float>) View.SCALE_X, 0.0f));
this.scheduleButtonHidden = false;
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
boolean z2 = chatActivityEnterViewDelegate != null && chatActivityEnterViewDelegate.hasScheduledMessages();
if (z2) {
createScheduledButton();
}
ImageView imageView4 = this.scheduledButton;
if (imageView4 != null) {
imageView4.setScaleY(1.0f);
if (z2) {
this.scheduledButton.setVisibility(0);
this.scheduledButton.setTag(1);
this.scheduledButton.setPivotX(AndroidUtilities.dp(48.0f));
ImageView imageView5 = this.scheduledButton;
Property property = View.TRANSLATION_X;
float[] fArr = new float[1];
ImageView imageView6 = this.botButton;
int dp = AndroidUtilities.dp((imageView6 == null || imageView6.getVisibility() != 0) ? 48.0f : 96.0f);
ImageView imageView7 = this.giftButton;
fArr[0] = dp - AndroidUtilities.dp((imageView7 == null || imageView7.getVisibility() != 0) ? 0.0f : 48.0f);
arrayList.add(ObjectAnimator.ofFloat(imageView5, (Property<ImageView, Float>) property, fArr));
arrayList.add(ObjectAnimator.ofFloat(this.scheduledButton, (Property<ImageView, Float>) View.ALPHA, 1.0f));
arrayList.add(ObjectAnimator.ofFloat(this.scheduledButton, (Property<ImageView, Float>) View.SCALE_X, 1.0f));
} else {
ImageView imageView8 = this.scheduledButton;
ImageView imageView9 = this.botButton;
int dp2 = AndroidUtilities.dp((imageView9 == null || imageView9.getVisibility() != 0) ? 48.0f : 96.0f);
ImageView imageView10 = this.giftButton;
imageView8.setTranslationX(dp2 - AndroidUtilities.dp((imageView10 == null || imageView10.getVisibility() != 0) ? 0.0f : 48.0f));
this.scheduledButton.setAlpha(1.0f);
this.scheduledButton.setScaleX(1.0f);
}
}
this.runningAnimation2.playTogether(arrayList);
this.runningAnimation2.setDuration(100L);
this.runningAnimation2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (animation.equals(ChatActivityEnterView.this.runningAnimation2)) {
ChatActivityEnterView.this.attachLayout.setVisibility(8);
ChatActivityEnterView.this.runningAnimation2 = null;
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (animation.equals(ChatActivityEnterView.this.runningAnimation2)) {
ChatActivityEnterView.this.runningAnimation2 = null;
}
}
});
this.runningAnimation2.start();
updateFieldRight(0);
if (this.delegate != null && getVisibility() == 0) {
this.delegate.onAttachButtonHidden();
}
}
this.runningAnimationType = 5;
this.runningAnimation = new AnimatorSet();
ArrayList arrayList2 = new ArrayList();
if (this.audioVideoButtonContainer.getVisibility() == 0) {
arrayList2.add(ObjectAnimator.ofFloat(this.audioVideoButtonContainer, (Property<FrameLayout, Float>) View.SCALE_X, 0.1f));
arrayList2.add(ObjectAnimator.ofFloat(this.audioVideoButtonContainer, (Property<FrameLayout, Float>) View.SCALE_Y, 0.1f));
arrayList2.add(ObjectAnimator.ofFloat(this.audioVideoButtonContainer, (Property<FrameLayout, Float>) View.ALPHA, 0.0f));
}
ImageView imageView11 = this.expandStickersButton;
if (imageView11 != null && imageView11.getVisibility() == 0) {
arrayList2.add(ObjectAnimator.ofFloat(this.expandStickersButton, (Property<ImageView, Float>) View.SCALE_X, 0.1f));
arrayList2.add(ObjectAnimator.ofFloat(this.expandStickersButton, (Property<ImageView, Float>) View.SCALE_Y, 0.1f));
arrayList2.add(ObjectAnimator.ofFloat(this.expandStickersButton, (Property<ImageView, Float>) View.ALPHA, 0.0f));
}
if (this.sendButton.getVisibility() == 0) {
arrayList2.add(ObjectAnimator.ofFloat(this.sendButton, (Property<SendButton, Float>) View.SCALE_X, 0.1f));
arrayList2.add(ObjectAnimator.ofFloat(this.sendButton, (Property<SendButton, Float>) View.SCALE_Y, 0.1f));
arrayList2.add(ObjectAnimator.ofFloat(this.sendButton, (Property<SendButton, Float>) View.ALPHA, 0.0f));
}
if (this.cancelBotButton.getVisibility() == 0) {
arrayList2.add(ObjectAnimator.ofFloat(this.cancelBotButton, (Property<ImageView, Float>) View.SCALE_X, 0.1f));
arrayList2.add(ObjectAnimator.ofFloat(this.cancelBotButton, (Property<ImageView, Float>) View.SCALE_Y, 0.1f));
arrayList2.add(ObjectAnimator.ofFloat(this.cancelBotButton, (Property<ImageView, Float>) View.ALPHA, 0.0f));
}
arrayList2.add(ObjectAnimator.ofFloat(this.slowModeButton, (Property<SlowModeBtn, Float>) View.SCALE_X, 1.0f));
arrayList2.add(ObjectAnimator.ofFloat(this.slowModeButton, (Property<SlowModeBtn, Float>) View.SCALE_Y, 1.0f));
arrayList2.add(ObjectAnimator.ofFloat(this.slowModeButton, (Property<SlowModeBtn, Float>) View.ALPHA, 1.0f));
setSlowModeButtonVisible(true);
this.runningAnimation.playTogether(arrayList2);
this.runningAnimation.setDuration(150L);
this.runningAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (animation.equals(ChatActivityEnterView.this.runningAnimation)) {
ChatActivityEnterView.this.sendButton.setVisibility(8);
ChatActivityEnterView.this.cancelBotButton.setVisibility(8);
ChatActivityEnterView.this.audioVideoButtonContainer.setVisibility(8);
if (ChatActivityEnterView.this.expandStickersButton != null) {
ChatActivityEnterView.this.expandStickersButton.setVisibility(8);
}
ChatActivityEnterView.this.runningAnimation = null;
ChatActivityEnterView.this.runningAnimationType = 0;
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (animation.equals(ChatActivityEnterView.this.runningAnimation)) {
ChatActivityEnterView.this.runningAnimation = null;
}
}
});
this.runningAnimation.start();
return;
}
this.slowModeButton.setScaleX(1.0f);
this.slowModeButton.setScaleY(1.0f);
this.slowModeButton.setAlpha(1.0f);
setSlowModeButtonVisible(true);
this.audioVideoButtonContainer.setScaleX(0.1f);
this.audioVideoButtonContainer.setScaleY(0.1f);
this.audioVideoButtonContainer.setAlpha(0.0f);
this.audioVideoButtonContainer.setVisibility(8);
this.sendButton.setScaleX(0.1f);
this.sendButton.setScaleY(0.1f);
this.sendButton.setAlpha(0.0f);
this.sendButton.setVisibility(8);
this.cancelBotButton.setScaleX(0.1f);
this.cancelBotButton.setScaleY(0.1f);
this.cancelBotButton.setAlpha(0.0f);
this.cancelBotButton.setVisibility(8);
ImageView imageView12 = this.expandStickersButton;
if (imageView12 == null || imageView12.getVisibility() != 0) {
i2 = 8;
} else {
this.expandStickersButton.setScaleX(0.1f);
this.expandStickersButton.setScaleY(0.1f);
this.expandStickersButton.setAlpha(0.0f);
i2 = 8;
this.expandStickersButton.setVisibility(8);
}
LinearLayout linearLayout = this.attachLayout;
if (linearLayout != null) {
linearLayout.setVisibility(i2);
if (this.delegate != null && getVisibility() == 0) {
this.delegate.onAttachButtonHidden();
}
updateFieldRight(0);
}
this.scheduleButtonHidden = false;
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate2 = this.delegate;
boolean z3 = chatActivityEnterViewDelegate2 != null && chatActivityEnterViewDelegate2.hasScheduledMessages();
if (z3) {
createScheduledButton();
}
ImageView imageView13 = this.scheduledButton;
if (imageView13 != null) {
if (z3) {
imageView13.setVisibility(0);
this.scheduledButton.setTag(1);
}
ImageView imageView14 = this.scheduledButton;
ImageView imageView15 = this.botButton;
int dp3 = AndroidUtilities.dp((imageView15 == null || imageView15.getVisibility() != 0) ? 48.0f : 96.0f);
ImageView imageView16 = this.giftButton;
imageView14.setTranslationX(dp3 - AndroidUtilities.dp((imageView16 == null || imageView16.getVisibility() != 0) ? 0.0f : 48.0f));
this.scheduledButton.setAlpha(1.0f);
this.scheduledButton.setScaleX(1.0f);
this.scheduledButton.setScaleY(1.0f);
return;
}
return;
}
return;
}
if (trimmedString.length() > 0 || this.forceShowSendButton || this.audioToSend != null || this.videoToSendMessageObject != null || (this.slowModeTimer == Integer.MAX_VALUE && !isInScheduleMode())) {
EditTextCaption editTextCaption2 = this.messageEditText;
final String caption = editTextCaption2 == null ? null : editTextCaption2.getCaption();
boolean z4 = caption != null && (this.sendButton.getVisibility() == 0 || ((imageView2 = this.expandStickersButton) != null && imageView2.getVisibility() == 0));
boolean z5 = caption == null && (this.cancelBotButton.getVisibility() == 0 || ((imageView = this.expandStickersButton) != null && imageView.getVisibility() == 0));
if (this.slowModeTimer == Integer.MAX_VALUE && !isInScheduleMode()) {
themedColor = getThemedColor(Theme.key_chat_messagePanelIcons);
} else {
themedColor = getThemedColor(Theme.key_chat_messagePanelSend);
}
if (themedColor != this.sendButtonBackgroundColor) {
this.sendButtonBackgroundColor = themedColor;
Theme.setSelectorDrawableColor(this.sendButton.getBackground(), Color.argb(24, Color.red(themedColor), Color.green(themedColor), Color.blue(themedColor)), true);
}
if (this.audioVideoButtonContainer.getVisibility() == 0 || this.slowModeButton.getVisibility() == 0 || z4 || z5) {
if (z) {
int i4 = this.runningAnimationType;
if (i4 == 1 && caption == null) {
return;
}
if (i4 != 3 || caption == null) {
AnimatorSet animatorSet3 = this.runningAnimation;
if (animatorSet3 != null) {
animatorSet3.cancel();
this.runningAnimation = null;
}
AnimatorSet animatorSet4 = this.runningAnimation2;
if (animatorSet4 != null) {
animatorSet4.cancel();
this.runningAnimation2 = null;
}
if (this.attachLayout != null) {
this.runningAnimation2 = new AnimatorSet();
ArrayList arrayList3 = new ArrayList();
arrayList3.add(ObjectAnimator.ofFloat(this.attachLayout, (Property<LinearLayout, Float>) this.ATTACH_LAYOUT_ALPHA, 0.0f));
arrayList3.add(ObjectAnimator.ofFloat(this.attachLayout, (Property<LinearLayout, Float>) View.SCALE_X, 0.0f));
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate3 = this.delegate;
final boolean z6 = chatActivityEnterViewDelegate3 != null && chatActivityEnterViewDelegate3.hasScheduledMessages();
this.scheduleButtonHidden = true;
ImageView imageView17 = this.scheduledButton;
if (imageView17 != null) {
imageView17.setScaleY(1.0f);
if (z6) {
this.scheduledButton.setTag(null);
arrayList3.add(ObjectAnimator.ofFloat(this.scheduledButton, (Property<ImageView, Float>) View.ALPHA, 0.0f));
arrayList3.add(ObjectAnimator.ofFloat(this.scheduledButton, (Property<ImageView, Float>) View.SCALE_X, 0.0f));
ImageView imageView18 = this.scheduledButton;
Property property2 = View.TRANSLATION_X;
float[] fArr2 = new float[1];
ImageView imageView19 = this.botButton;
int dp4 = AndroidUtilities.dp((imageView19 == null || imageView19.getVisibility() != 0) ? 48.0f : 96.0f);
ImageView imageView20 = this.giftButton;
fArr2[0] = dp4 - AndroidUtilities.dp((imageView20 == null || imageView20.getVisibility() != 0) ? 0.0f : 48.0f);
arrayList3.add(ObjectAnimator.ofFloat(imageView18, (Property<ImageView, Float>) property2, fArr2));
} else {
this.scheduledButton.setAlpha(0.0f);
this.scheduledButton.setScaleX(0.0f);
ImageView imageView21 = this.scheduledButton;
ImageView imageView22 = this.botButton;
int dp5 = AndroidUtilities.dp((imageView22 == null || imageView22.getVisibility() != 0) ? 48.0f : 96.0f);
ImageView imageView23 = this.giftButton;
imageView21.setTranslationX(dp5 - AndroidUtilities.dp((imageView23 == null || imageView23.getVisibility() != 0) ? 0.0f : 48.0f));
}
}
this.runningAnimation2.playTogether(arrayList3);
this.runningAnimation2.setDuration(100L);
this.runningAnimation2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (animation.equals(ChatActivityEnterView.this.runningAnimation2)) {
ChatActivityEnterView.this.attachLayout.setVisibility(8);
if (z6 && ChatActivityEnterView.this.scheduledButton != null) {
ChatActivityEnterView.this.scheduledButton.setVisibility(8);
}
ChatActivityEnterView.this.runningAnimation2 = null;
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (animation.equals(ChatActivityEnterView.this.runningAnimation2)) {
ChatActivityEnterView.this.runningAnimation2 = null;
}
}
});
this.runningAnimation2.start();
updateFieldRight(0);
if (this.delegate != null && getVisibility() == 0) {
this.delegate.onAttachButtonHidden();
}
}
this.runningAnimation = new AnimatorSet();
ArrayList arrayList4 = new ArrayList();
if (this.audioVideoButtonContainer.getVisibility() == 0) {
arrayList4.add(ObjectAnimator.ofFloat(this.audioVideoButtonContainer, (Property<FrameLayout, Float>) View.SCALE_X, 0.1f));
arrayList4.add(ObjectAnimator.ofFloat(this.audioVideoButtonContainer, (Property<FrameLayout, Float>) View.SCALE_Y, 0.1f));
arrayList4.add(ObjectAnimator.ofFloat(this.audioVideoButtonContainer, (Property<FrameLayout, Float>) View.ALPHA, 0.0f));
}
ImageView imageView24 = this.expandStickersButton;
if (imageView24 != null && imageView24.getVisibility() == 0) {
arrayList4.add(ObjectAnimator.ofFloat(this.expandStickersButton, (Property<ImageView, Float>) View.SCALE_X, 0.1f));
arrayList4.add(ObjectAnimator.ofFloat(this.expandStickersButton, (Property<ImageView, Float>) View.SCALE_Y, 0.1f));
arrayList4.add(ObjectAnimator.ofFloat(this.expandStickersButton, (Property<ImageView, Float>) View.ALPHA, 0.0f));
}
if (this.slowModeButton.getVisibility() == 0) {
arrayList4.add(ObjectAnimator.ofFloat(this.slowModeButton, (Property<SlowModeBtn, Float>) View.SCALE_X, 0.1f));
arrayList4.add(ObjectAnimator.ofFloat(this.slowModeButton, (Property<SlowModeBtn, Float>) View.SCALE_Y, 0.1f));
arrayList4.add(ObjectAnimator.ofFloat(this.slowModeButton, (Property<SlowModeBtn, Float>) View.ALPHA, 0.0f));
}
if (z4) {
arrayList4.add(ObjectAnimator.ofFloat(this.sendButton, (Property<SendButton, Float>) View.SCALE_X, 0.1f));
arrayList4.add(ObjectAnimator.ofFloat(this.sendButton, (Property<SendButton, Float>) View.SCALE_Y, 0.1f));
arrayList4.add(ObjectAnimator.ofFloat(this.sendButton, (Property<SendButton, Float>) View.ALPHA, 0.0f));
} else if (z5) {
arrayList4.add(ObjectAnimator.ofFloat(this.cancelBotButton, (Property<ImageView, Float>) View.SCALE_X, 0.1f));
arrayList4.add(ObjectAnimator.ofFloat(this.cancelBotButton, (Property<ImageView, Float>) View.SCALE_Y, 0.1f));
arrayList4.add(ObjectAnimator.ofFloat(this.cancelBotButton, (Property<ImageView, Float>) View.ALPHA, 0.0f));
}
if (caption != null) {
this.runningAnimationType = 3;
arrayList4.add(ObjectAnimator.ofFloat(this.cancelBotButton, (Property<ImageView, Float>) View.SCALE_X, 1.0f));
arrayList4.add(ObjectAnimator.ofFloat(this.cancelBotButton, (Property<ImageView, Float>) View.SCALE_Y, 1.0f));
arrayList4.add(ObjectAnimator.ofFloat(this.cancelBotButton, (Property<ImageView, Float>) View.ALPHA, 1.0f));
this.cancelBotButton.setVisibility(0);
} else {
this.runningAnimationType = 1;
arrayList4.add(ObjectAnimator.ofFloat(this.sendButton, (Property<SendButton, Float>) View.SCALE_X, 1.0f));
arrayList4.add(ObjectAnimator.ofFloat(this.sendButton, (Property<SendButton, Float>) View.SCALE_Y, 1.0f));
arrayList4.add(ObjectAnimator.ofFloat(this.sendButton, (Property<SendButton, Float>) View.ALPHA, 1.0f));
this.sendButton.setVisibility(0);
}
this.runningAnimation.playTogether(arrayList4);
this.runningAnimation.setDuration(150L);
this.runningAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (animation.equals(ChatActivityEnterView.this.runningAnimation)) {
if (caption != null) {
ChatActivityEnterView.this.cancelBotButton.setVisibility(0);
ChatActivityEnterView.this.sendButton.setVisibility(8);
} else {
ChatActivityEnterView.this.sendButton.setVisibility(0);
ChatActivityEnterView.this.cancelBotButton.setVisibility(8);
}
ChatActivityEnterView.this.audioVideoButtonContainer.setVisibility(8);
if (ChatActivityEnterView.this.expandStickersButton != null) {
ChatActivityEnterView.this.expandStickersButton.setVisibility(8);
}
ChatActivityEnterView.this.setSlowModeButtonVisible(false);
ChatActivityEnterView.this.runningAnimation = null;
ChatActivityEnterView.this.runningAnimationType = 0;
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (animation.equals(ChatActivityEnterView.this.runningAnimation)) {
ChatActivityEnterView.this.runningAnimation = null;
}
}
});
this.runningAnimation.start();
return;
}
return;
}
this.audioVideoButtonContainer.setScaleX(0.1f);
this.audioVideoButtonContainer.setScaleY(0.1f);
this.audioVideoButtonContainer.setAlpha(0.0f);
this.audioVideoButtonContainer.setVisibility(8);
if (this.slowModeButton.getVisibility() == 0) {
this.slowModeButton.setScaleX(0.1f);
this.slowModeButton.setScaleY(0.1f);
this.slowModeButton.setAlpha(0.0f);
setSlowModeButtonVisible(false);
}
if (caption != null) {
this.sendButton.setScaleX(0.1f);
this.sendButton.setScaleY(0.1f);
this.sendButton.setAlpha(0.0f);
this.sendButton.setVisibility(8);
this.cancelBotButton.setScaleX(1.0f);
this.cancelBotButton.setScaleY(1.0f);
this.cancelBotButton.setAlpha(1.0f);
this.cancelBotButton.setVisibility(0);
} else {
this.cancelBotButton.setScaleX(0.1f);
this.cancelBotButton.setScaleY(0.1f);
this.cancelBotButton.setAlpha(0.0f);
this.sendButton.setVisibility(0);
this.sendButton.setScaleX(1.0f);
this.sendButton.setScaleY(1.0f);
this.sendButton.setAlpha(1.0f);
this.cancelBotButton.setVisibility(8);
}
ImageView imageView25 = this.expandStickersButton;
if (imageView25 == null || imageView25.getVisibility() != 0) {
i = 8;
} else {
this.expandStickersButton.setScaleX(0.1f);
this.expandStickersButton.setScaleY(0.1f);
this.expandStickersButton.setAlpha(0.0f);
i = 8;
this.expandStickersButton.setVisibility(8);
}
LinearLayout linearLayout2 = this.attachLayout;
if (linearLayout2 != null) {
linearLayout2.setVisibility(i);
if (this.delegate != null && getVisibility() == 0) {
this.delegate.onAttachButtonHidden();
}
updateFieldRight(0);
}
this.scheduleButtonHidden = true;
if (this.scheduledButton != null) {
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate4 = this.delegate;
if (chatActivityEnterViewDelegate4 != null && chatActivityEnterViewDelegate4.hasScheduledMessages()) {
this.scheduledButton.setVisibility(8);
this.scheduledButton.setTag(null);
}
this.scheduledButton.setAlpha(0.0f);
this.scheduledButton.setScaleX(0.0f);
this.scheduledButton.setScaleY(1.0f);
ImageView imageView26 = this.scheduledButton;
ImageView imageView27 = this.botButton;
int dp6 = AndroidUtilities.dp((imageView27 == null || imageView27.getVisibility() != 0) ? 48.0f : 96.0f);
ImageView imageView28 = this.giftButton;
imageView26.setTranslationX(dp6 - AndroidUtilities.dp((imageView28 == null || imageView28.getVisibility() != 0) ? 0.0f : 48.0f));
return;
}
return;
}
return;
}
if (this.emojiView != null && this.emojiViewVisible && ((this.stickersTabOpen || (this.emojiTabOpen && this.searchingType == 2)) && !AndroidUtilities.isInMultiwindow)) {
if (z) {
if (this.runningAnimationType == 4) {
return;
}
AnimatorSet animatorSet5 = this.runningAnimation;
if (animatorSet5 != null) {
animatorSet5.cancel();
this.runningAnimation = null;
}
AnimatorSet animatorSet6 = this.runningAnimation2;
if (animatorSet6 != null) {
animatorSet6.cancel();
this.runningAnimation2 = null;
}
LinearLayout linearLayout3 = this.attachLayout;
if (linearLayout3 != null && this.recordInterfaceState == 0) {
linearLayout3.setVisibility(0);
this.runningAnimation2 = new AnimatorSet();
ArrayList arrayList5 = new ArrayList();
arrayList5.add(ObjectAnimator.ofFloat(this.attachLayout, (Property<LinearLayout, Float>) this.ATTACH_LAYOUT_ALPHA, 1.0f));
arrayList5.add(ObjectAnimator.ofFloat(this.attachLayout, (Property<LinearLayout, Float>) View.SCALE_X, 1.0f));
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate5 = this.delegate;
boolean z7 = chatActivityEnterViewDelegate5 != null && chatActivityEnterViewDelegate5.hasScheduledMessages();
this.scheduleButtonHidden = false;
if (z7) {
createScheduledButton();
}
ImageView imageView29 = this.scheduledButton;
if (imageView29 != null) {
imageView29.setScaleY(1.0f);
if (z7) {
this.scheduledButton.setVisibility(0);
this.scheduledButton.setTag(1);
this.scheduledButton.setPivotX(AndroidUtilities.dp(48.0f));
arrayList5.add(ObjectAnimator.ofFloat(this.scheduledButton, (Property<ImageView, Float>) View.ALPHA, 1.0f));
arrayList5.add(ObjectAnimator.ofFloat(this.scheduledButton, (Property<ImageView, Float>) View.SCALE_X, 1.0f));
arrayList5.add(ObjectAnimator.ofFloat(this.scheduledButton, (Property<ImageView, Float>) View.TRANSLATION_X, 0.0f));
} else {
this.scheduledButton.setAlpha(1.0f);
this.scheduledButton.setScaleX(1.0f);
this.scheduledButton.setTranslationX(0.0f);
}
}
this.runningAnimation2.playTogether(arrayList5);
this.runningAnimation2.setDuration(100L);
this.runningAnimation2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (animation.equals(ChatActivityEnterView.this.runningAnimation2)) {
ChatActivityEnterView.this.runningAnimation2 = null;
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (animation.equals(ChatActivityEnterView.this.runningAnimation2)) {
ChatActivityEnterView.this.runningAnimation2 = null;
}
}
});
this.runningAnimation2.start();
updateFieldRight(1);
if (getVisibility() == 0) {
this.delegate.onAttachButtonShow();
}
}
createExpandStickersButton();
this.expandStickersButton.setVisibility(0);
this.runningAnimation = new AnimatorSet();
this.runningAnimationType = 4;
ArrayList arrayList6 = new ArrayList();
arrayList6.add(ObjectAnimator.ofFloat(this.expandStickersButton, (Property<ImageView, Float>) View.SCALE_X, 1.0f));
arrayList6.add(ObjectAnimator.ofFloat(this.expandStickersButton, (Property<ImageView, Float>) View.SCALE_Y, 1.0f));
arrayList6.add(ObjectAnimator.ofFloat(this.expandStickersButton, (Property<ImageView, Float>) View.ALPHA, 1.0f));
if (this.cancelBotButton.getVisibility() == 0) {
arrayList6.add(ObjectAnimator.ofFloat(this.cancelBotButton, (Property<ImageView, Float>) View.SCALE_X, 0.1f));
arrayList6.add(ObjectAnimator.ofFloat(this.cancelBotButton, (Property<ImageView, Float>) View.SCALE_Y, 0.1f));
arrayList6.add(ObjectAnimator.ofFloat(this.cancelBotButton, (Property<ImageView, Float>) View.ALPHA, 0.0f));
} else if (this.audioVideoButtonContainer.getVisibility() == 0) {
arrayList6.add(ObjectAnimator.ofFloat(this.audioVideoButtonContainer, (Property<FrameLayout, Float>) View.SCALE_X, 0.1f));
arrayList6.add(ObjectAnimator.ofFloat(this.audioVideoButtonContainer, (Property<FrameLayout, Float>) View.SCALE_Y, 0.1f));
arrayList6.add(ObjectAnimator.ofFloat(this.audioVideoButtonContainer, (Property<FrameLayout, Float>) View.ALPHA, 0.0f));
} else if (this.slowModeButton.getVisibility() == 0) {
arrayList6.add(ObjectAnimator.ofFloat(this.slowModeButton, (Property<SlowModeBtn, Float>) View.SCALE_X, 0.1f));
arrayList6.add(ObjectAnimator.ofFloat(this.slowModeButton, (Property<SlowModeBtn, Float>) View.SCALE_Y, 0.1f));
arrayList6.add(ObjectAnimator.ofFloat(this.slowModeButton, (Property<SlowModeBtn, Float>) View.ALPHA, 0.0f));
} else {
arrayList6.add(ObjectAnimator.ofFloat(this.sendButton, (Property<SendButton, Float>) View.SCALE_X, 0.1f));
arrayList6.add(ObjectAnimator.ofFloat(this.sendButton, (Property<SendButton, Float>) View.SCALE_Y, 0.1f));
arrayList6.add(ObjectAnimator.ofFloat(this.sendButton, (Property<SendButton, Float>) View.ALPHA, 0.0f));
}
this.runningAnimation.playTogether(arrayList6);
this.runningAnimation.setDuration(250L);
this.runningAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (animation.equals(ChatActivityEnterView.this.runningAnimation)) {
ChatActivityEnterView.this.sendButton.setVisibility(8);
ChatActivityEnterView.this.cancelBotButton.setVisibility(8);
ChatActivityEnterView.this.setSlowModeButtonVisible(false);
ChatActivityEnterView.this.audioVideoButtonContainer.setVisibility(8);
ChatActivityEnterView.this.expandStickersButton.setVisibility(0);
ChatActivityEnterView.this.runningAnimation = null;
ChatActivityEnterView.this.runningAnimationType = 0;
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (animation.equals(ChatActivityEnterView.this.runningAnimation)) {
ChatActivityEnterView.this.runningAnimation = null;
}
}
});
this.runningAnimation.start();
return;
}
this.slowModeButton.setScaleX(0.1f);
this.slowModeButton.setScaleY(0.1f);
this.slowModeButton.setAlpha(0.0f);
setSlowModeButtonVisible(false);
this.sendButton.setScaleX(0.1f);
this.sendButton.setScaleY(0.1f);
this.sendButton.setAlpha(0.0f);
this.sendButton.setVisibility(8);
this.cancelBotButton.setScaleX(0.1f);
this.cancelBotButton.setScaleY(0.1f);
this.cancelBotButton.setAlpha(0.0f);
this.cancelBotButton.setVisibility(8);
this.audioVideoButtonContainer.setScaleX(0.1f);
this.audioVideoButtonContainer.setScaleY(0.1f);
this.audioVideoButtonContainer.setAlpha(0.0f);
this.audioVideoButtonContainer.setVisibility(8);
createExpandStickersButton();
this.expandStickersButton.setScaleX(1.0f);
this.expandStickersButton.setScaleY(1.0f);
this.expandStickersButton.setAlpha(1.0f);
this.expandStickersButton.setVisibility(0);
if (this.attachLayout != null) {
if (getVisibility() == 0) {
this.delegate.onAttachButtonShow();
}
this.attachLayout.setVisibility(0);
updateFieldRight(1);
}
this.scheduleButtonHidden = false;
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate6 = this.delegate;
boolean z8 = chatActivityEnterViewDelegate6 != null && chatActivityEnterViewDelegate6.hasScheduledMessages();
if (z8) {
createScheduledButton();
}
ImageView imageView30 = this.scheduledButton;
if (imageView30 != null) {
if (z8) {
imageView30.setVisibility(0);
this.scheduledButton.setTag(1);
}
this.scheduledButton.setAlpha(1.0f);
this.scheduledButton.setScaleX(1.0f);
this.scheduledButton.setScaleY(1.0f);
this.scheduledButton.setTranslationX(0.0f);
return;
}
return;
}
if (this.sendButton.getVisibility() == 0 || this.cancelBotButton.getVisibility() == 0 || (((imageView3 = this.expandStickersButton) != null && imageView3.getVisibility() == 0) || this.slowModeButton.getVisibility() == 0)) {
if (z) {
if (this.runningAnimationType == 2) {
return;
}
AnimatorSet animatorSet7 = this.runningAnimation;
if (animatorSet7 != null) {
animatorSet7.cancel();
this.runningAnimation = null;
}
AnimatorSet animatorSet8 = this.runningAnimation2;
if (animatorSet8 != null) {
animatorSet8.cancel();
this.runningAnimation2 = null;
}
LinearLayout linearLayout4 = this.attachLayout;
if (linearLayout4 != null) {
if (linearLayout4.getVisibility() != 0) {
this.attachLayout.setVisibility(0);
this.attachLayoutAlpha = 0.0f;
updateAttachLayoutParams();
this.attachLayout.setScaleX(0.0f);
}
this.runningAnimation2 = new AnimatorSet();
ArrayList arrayList7 = new ArrayList();
arrayList7.add(ObjectAnimator.ofFloat(this.attachLayout, (Property<LinearLayout, Float>) this.ATTACH_LAYOUT_ALPHA, 1.0f));
arrayList7.add(ObjectAnimator.ofFloat(this.attachLayout, (Property<LinearLayout, Float>) View.SCALE_X, 1.0f));
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate7 = this.delegate;
boolean z9 = chatActivityEnterViewDelegate7 != null && chatActivityEnterViewDelegate7.hasScheduledMessages();
this.scheduleButtonHidden = false;
if (z9) {
createScheduledButton();
}
ImageView imageView31 = this.scheduledButton;
if (imageView31 != null) {
if (z9) {
imageView31.setVisibility(0);
this.scheduledButton.setTag(1);
this.scheduledButton.setPivotX(AndroidUtilities.dp(48.0f));
arrayList7.add(ObjectAnimator.ofFloat(this.scheduledButton, (Property<ImageView, Float>) View.ALPHA, 1.0f));
arrayList7.add(ObjectAnimator.ofFloat(this.scheduledButton, (Property<ImageView, Float>) View.SCALE_X, 1.0f));
ImageView imageView32 = this.scheduledButton;
Property property3 = View.TRANSLATION_X;
float[] fArr3 = new float[1];
ImageView imageView33 = this.giftButton;
fArr3[0] = (imageView33 == null || imageView33.getVisibility() != 0) ? 0.0f : -AndroidUtilities.dp(48.0f);
arrayList7.add(ObjectAnimator.ofFloat(imageView32, (Property<ImageView, Float>) property3, fArr3));
} else {
imageView31.setAlpha(1.0f);
this.scheduledButton.setScaleX(1.0f);
this.scheduledButton.setScaleY(1.0f);
this.scheduledButton.setTranslationX(0.0f);
}
}
this.runningAnimation2.playTogether(arrayList7);
this.runningAnimation2.setDuration(100L);
this.runningAnimation2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (animation.equals(ChatActivityEnterView.this.runningAnimation2)) {
ChatActivityEnterView.this.runningAnimation2 = null;
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (animation.equals(ChatActivityEnterView.this.runningAnimation2)) {
ChatActivityEnterView.this.runningAnimation2 = null;
}
}
});
this.runningAnimation2.start();
updateFieldRight(1);
if (getVisibility() == 0) {
this.delegate.onAttachButtonShow();
}
}
this.audioVideoButtonContainer.setVisibility(0);
this.runningAnimation = new AnimatorSet();
this.runningAnimationType = 2;
ArrayList arrayList8 = new ArrayList();
arrayList8.add(ObjectAnimator.ofFloat(this.audioVideoButtonContainer, (Property<FrameLayout, Float>) View.SCALE_X, 1.0f));
arrayList8.add(ObjectAnimator.ofFloat(this.audioVideoButtonContainer, (Property<FrameLayout, Float>) View.SCALE_Y, 1.0f));
ChatActivity chatActivity = this.parentFragment;
TLRPC.Chat currentChat = chatActivity != null ? chatActivity.getCurrentChat() : null;
ChatActivity chatActivity2 = this.parentFragment;
TLRPC.UserFull currentUserInfo = chatActivity2 == null ? this.userInfo : chatActivity2.getCurrentUserInfo();
if (currentChat == null ? !(currentUserInfo == null || !currentUserInfo.voice_messages_forbidden) : !(ChatObject.canSendVoice(currentChat) || ChatObject.canSendRoundVideo(currentChat))) {
f = 0.5f;
}
arrayList8.add(ObjectAnimator.ofFloat(this.audioVideoButtonContainer, (Property<FrameLayout, Float>) View.ALPHA, f));
if (this.cancelBotButton.getVisibility() == 0) {
arrayList8.add(ObjectAnimator.ofFloat(this.cancelBotButton, (Property<ImageView, Float>) View.SCALE_X, 0.1f));
arrayList8.add(ObjectAnimator.ofFloat(this.cancelBotButton, (Property<ImageView, Float>) View.SCALE_Y, 0.1f));
arrayList8.add(ObjectAnimator.ofFloat(this.cancelBotButton, (Property<ImageView, Float>) View.ALPHA, 0.0f));
} else {
ImageView imageView34 = this.expandStickersButton;
if (imageView34 != null && imageView34.getVisibility() == 0) {
arrayList8.add(ObjectAnimator.ofFloat(this.expandStickersButton, (Property<ImageView, Float>) View.SCALE_X, 0.1f));
arrayList8.add(ObjectAnimator.ofFloat(this.expandStickersButton, (Property<ImageView, Float>) View.SCALE_Y, 0.1f));
arrayList8.add(ObjectAnimator.ofFloat(this.expandStickersButton, (Property<ImageView, Float>) View.ALPHA, 0.0f));
} else if (this.slowModeButton.getVisibility() == 0) {
arrayList8.add(ObjectAnimator.ofFloat(this.slowModeButton, (Property<SlowModeBtn, Float>) View.SCALE_X, 0.1f));
arrayList8.add(ObjectAnimator.ofFloat(this.slowModeButton, (Property<SlowModeBtn, Float>) View.SCALE_Y, 0.1f));
arrayList8.add(ObjectAnimator.ofFloat(this.slowModeButton, (Property<SlowModeBtn, Float>) View.ALPHA, 0.0f));
} else {
arrayList8.add(ObjectAnimator.ofFloat(this.sendButton, (Property<SendButton, Float>) View.SCALE_X, 0.1f));
arrayList8.add(ObjectAnimator.ofFloat(this.sendButton, (Property<SendButton, Float>) View.SCALE_Y, 0.1f));
arrayList8.add(ObjectAnimator.ofFloat(this.sendButton, (Property<SendButton, Float>) View.ALPHA, 0.0f));
}
}
this.runningAnimation.playTogether(arrayList8);
this.runningAnimation.setDuration(150L);
this.runningAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (animation.equals(ChatActivityEnterView.this.runningAnimation)) {
ChatActivityEnterView.this.setSlowModeButtonVisible(false);
ChatActivityEnterView.this.runningAnimation = null;
ChatActivityEnterView.this.runningAnimationType = 0;
if (ChatActivityEnterView.this.audioVideoButtonContainer != null) {
ChatActivityEnterView.this.audioVideoButtonContainer.setVisibility(0);
}
}
}
@Override
public void onAnimationCancel(Animator animation) {
if (animation.equals(ChatActivityEnterView.this.runningAnimation)) {
ChatActivityEnterView.this.runningAnimation = null;
}
}
});
this.runningAnimation.start();
return;
}
this.slowModeButton.setScaleX(0.1f);
this.slowModeButton.setScaleY(0.1f);
this.slowModeButton.setAlpha(0.0f);
setSlowModeButtonVisible(false);
this.sendButton.setScaleX(0.1f);
this.sendButton.setScaleY(0.1f);
this.sendButton.setAlpha(0.0f);
this.sendButton.setVisibility(8);
this.cancelBotButton.setScaleX(0.1f);
this.cancelBotButton.setScaleY(0.1f);
this.cancelBotButton.setAlpha(0.0f);
this.cancelBotButton.setVisibility(8);
ImageView imageView35 = this.expandStickersButton;
if (imageView35 != null) {
imageView35.setScaleX(0.1f);
this.expandStickersButton.setScaleY(0.1f);
this.expandStickersButton.setAlpha(0.0f);
this.expandStickersButton.setVisibility(8);
}
this.audioVideoButtonContainer.setScaleX(1.0f);
this.audioVideoButtonContainer.setScaleY(1.0f);
this.audioVideoButtonContainer.setAlpha(1.0f);
this.audioVideoButtonContainer.setVisibility(0);
if (this.attachLayout != null) {
if (getVisibility() == 0) {
this.delegate.onAttachButtonShow();
}
this.attachLayoutAlpha = 1.0f;
updateAttachLayoutParams();
this.attachLayout.setScaleX(1.0f);
this.attachLayout.setVisibility(0);
updateFieldRight(1);
}
this.scheduleButtonHidden = false;
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate8 = this.delegate;
if (chatActivityEnterViewDelegate8 != null && chatActivityEnterViewDelegate8.hasScheduledMessages()) {
createScheduledButton();
}
if (this.scheduledButton != null) {
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate9 = this.delegate;
if (chatActivityEnterViewDelegate9 != null && chatActivityEnterViewDelegate9.hasScheduledMessages()) {
this.scheduledButton.setVisibility(0);
this.scheduledButton.setTag(1);
}
this.scheduledButton.setAlpha(1.0f);
this.scheduledButton.setScaleX(1.0f);
this.scheduledButton.setScaleY(1.0f);
this.scheduledButton.setTranslationX(0.0f);
}
}
}
public void setSlowModeButtonVisible(boolean visible) {
int i;
this.slowModeButton.setVisibility(visible ? 0 : 8);
if (visible) {
i = AndroidUtilities.dp(this.slowModeButton.isPremiumMode ? 26.0f : 16.0f);
} else {
i = 0;
}
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption == null || editTextCaption.getPaddingRight() == i) {
return;
}
this.messageEditText.setPadding(0, AndroidUtilities.dp(11.0f), i, AndroidUtilities.dp(12.0f));
}
public final void updateFieldRight(int attachVisible) {
ImageView imageView;
ImageView imageView2;
ImageView imageView3;
LinearLayout linearLayout;
ImageView imageView4;
ImageView imageView5;
ImageView imageView6;
LinearLayout linearLayout2;
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption == null || this.editingMessageObject != null) {
return;
}
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) editTextCaption.getLayoutParams();
int i = layoutParams.rightMargin;
if (attachVisible == 1) {
ImageView imageView7 = this.botButton;
if (imageView7 != null && imageView7.getVisibility() == 0 && (imageView6 = this.scheduledButton) != null && imageView6.getVisibility() == 0 && (linearLayout2 = this.attachLayout) != null && linearLayout2.getVisibility() == 0) {
layoutParams.rightMargin = AndroidUtilities.dp(146.0f);
} else {
ImageView imageView8 = this.botButton;
if ((imageView8 != null && imageView8.getVisibility() == 0) || (((imageView4 = this.notifyButton) != null && imageView4.getVisibility() == 0) || ((imageView5 = this.scheduledButton) != null && imageView5.getTag() != null))) {
layoutParams.rightMargin = AndroidUtilities.dp(98.0f);
} else {
layoutParams.rightMargin = AndroidUtilities.dp(50.0f);
}
}
} else if (attachVisible == 2) {
if (i != AndroidUtilities.dp(2.0f)) {
ImageView imageView9 = this.botButton;
if (imageView9 != null && imageView9.getVisibility() == 0 && (imageView3 = this.scheduledButton) != null && imageView3.getVisibility() == 0 && (linearLayout = this.attachLayout) != null && linearLayout.getVisibility() == 0) {
layoutParams.rightMargin = AndroidUtilities.dp(146.0f);
} else {
ImageView imageView10 = this.botButton;
if ((imageView10 != null && imageView10.getVisibility() == 0) || (((imageView = this.notifyButton) != null && imageView.getVisibility() == 0) || ((imageView2 = this.scheduledButton) != null && imageView2.getTag() != null))) {
layoutParams.rightMargin = AndroidUtilities.dp(98.0f);
} else {
layoutParams.rightMargin = AndroidUtilities.dp(50.0f);
}
}
}
} else {
ImageView imageView11 = this.scheduledButton;
if (imageView11 != null && imageView11.getTag() != null) {
layoutParams.rightMargin = AndroidUtilities.dp(50.0f);
} else {
layoutParams.rightMargin = AndroidUtilities.dp(2.0f);
}
}
if (i != layoutParams.rightMargin) {
this.messageEditText.setLayoutParams(layoutParams);
}
}
public void startMessageTransition() {
Runnable runnable = this.moveToSendStateRunnable;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
this.messageTransitionIsRunning = true;
this.moveToSendStateRunnable.run();
this.moveToSendStateRunnable = null;
}
}
public boolean canShowMessageTransition() {
MessageSendPreview messageSendPreview;
boolean z = this.moveToSendStateRunnable != null && ((messageSendPreview = this.messageSendPreview) == null || !messageSendPreview.isShowing()) && System.currentTimeMillis() - this.sentFromPreview > 300;
this.sentFromPreview = -1L;
return z;
}
public void updateRecordInterface(final int r26, boolean r27) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.Components.ChatActivityEnterView.updateRecordInterface(int, boolean):void");
}
public void lambda$updateRecordInterface$59(ValueAnimator valueAnimator) {
this.recordCircle.setTransformToSeekbar(((Float) valueAnimator.getAnimatedValue()).floatValue());
if (!isInVideoMode()) {
this.seekBarWaveform.setWaveScaling(this.recordCircle.getTransformToSeekbarProgressStep3());
this.recordedAudioTimeTextView.setAlpha(this.recordCircle.getTransformToSeekbarProgressStep3());
this.recordedAudioPlayButton.setAlpha(this.recordCircle.getTransformToSeekbarProgressStep3());
this.recordedAudioPlayButton.setScaleX(this.recordCircle.getTransformToSeekbarProgressStep3());
this.recordedAudioPlayButton.setScaleY(this.recordCircle.getTransformToSeekbarProgressStep3());
this.recordedAudioSeekBar.setAlpha(this.recordCircle.getTransformToSeekbarProgressStep3());
this.recordedAudioSeekBar.invalidate();
}
isRecordingStateChanged();
}
public final void cancelRecordInterfaceInternal() {
FrameLayout frameLayout = this.recordPanel;
if (frameLayout != null) {
frameLayout.setVisibility(8);
}
RecordCircle recordCircle = this.recordCircle;
if (recordCircle != null) {
recordCircle.setVisibility(8);
}
this.runningAnimationAudio = null;
isRecordingStateChanged();
View view = this.recordedAudioBackground;
if (view != null) {
view.setAlpha(1.0f);
}
if (this.attachLayout != null) {
this.attachLayoutTranslationX = 0.0f;
updateAttachLayoutParams();
}
SlideTextView slideTextView = this.slideText;
if (slideTextView != null) {
slideTextView.setCancelToProgress(0.0f);
}
this.delegate.onAudioVideoInterfaceUpdated();
updateSendAsButton();
}
public final void createRecordPanel() {
if (this.recordPanel != null || getContext() == null) {
return;
}
FrameLayout frameLayout = new FrameLayout(this, getContext()) {
@Override
public boolean onTouchEvent(MotionEvent event) {
return super.onTouchEvent(event);
}
};
this.recordPanel = frameLayout;
frameLayout.setClipChildren(false);
this.recordPanel.setVisibility(8);
this.messageEditTextContainer.addView(this.recordPanel, LayoutHelper.createFrame(-1, 48.0f));
this.recordPanel.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view, MotionEvent motionEvent) {
boolean lambda$createRecordPanel$60;
lambda$createRecordPanel$60 = ChatActivityEnterView.lambda$createRecordPanel$60(view, motionEvent);
return lambda$createRecordPanel$60;
}
});
FrameLayout frameLayout2 = this.recordPanel;
SlideTextView slideTextView = new SlideTextView(getContext());
this.slideText = slideTextView;
frameLayout2.addView(slideTextView, LayoutHelper.createFrame(-1, -1.0f, 0, 45.0f, 0.0f, 0.0f, 0.0f));
LinearLayout linearLayout = new LinearLayout(getContext());
this.recordTimeContainer = linearLayout;
linearLayout.setOrientation(0);
this.recordTimeContainer.setPadding(AndroidUtilities.dp(13.0f), 0, 0, 0);
this.recordTimeContainer.setFocusable(false);
LinearLayout linearLayout2 = this.recordTimeContainer;
RecordDot recordDot = new RecordDot(getContext());
this.recordDot = recordDot;
linearLayout2.addView(recordDot, LayoutHelper.createLinear(28, 28, 16, 0, 0, 0, 0));
LinearLayout linearLayout3 = this.recordTimeContainer;
TimerView timerView = new TimerView(getContext());
this.recordTimerView = timerView;
linearLayout3.addView(timerView, LayoutHelper.createLinear(-1, -1, 16, 6, 0, 0, 0));
this.recordPanel.addView(this.recordTimeContainer, LayoutHelper.createFrame(-1, -1, 16));
}
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (this.recordingAudioVideo) {
getParent().requestDisallowInterceptTouchEvent(true);
}
if (ev.getAction() == 0 && AndroidUtilities.findChildViewUnder(this, ev.getX(), ev.getY()) != this.birthdayHint) {
hideHints();
}
return super/*android.widget.FrameLayout*/.onInterceptTouchEvent(ev);
}
public void setDelegate(ChatActivityEnterViewDelegate chatActivityEnterViewDelegate) {
this.delegate = chatActivityEnterViewDelegate;
}
public void setCommand(MessageObject messageObject, String command, boolean longPress, boolean username) {
EditTextCaption editTextCaption;
String str;
if (command == null || getVisibility() != 0 || (editTextCaption = this.messageEditText) == null) {
return;
}
if (longPress) {
String obj = editTextCaption.getText().toString();
if (messageObject != null && DialogObject.isChatDialog(this.dialog_id)) {
r15 = this.accountInstance.getMessagesController().getUser(Long.valueOf(messageObject.messageOwner.from_id.user_id));
}
if ((this.botCount != 1 || username) && r15 != null && r15.bot && !command.contains("@")) {
str = String.format(Locale.US, "%s@%s", command, UserObject.getPublicUsername(r15)) + " " + obj.replaceFirst("^/[a-zA-Z@\\d_]{1,255}(\\s|$)", BuildConfig.APP_CENTER_HASH);
} else {
str = command + " " + obj.replaceFirst("^/[a-zA-Z@\\d_]{1,255}(\\s|$)", BuildConfig.APP_CENTER_HASH);
}
this.ignoreTextChange = true;
this.messageEditText.setText(str);
EditTextCaption editTextCaption2 = this.messageEditText;
editTextCaption2.setSelection(editTextCaption2.getText().length());
this.ignoreTextChange = false;
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
chatActivityEnterViewDelegate.onTextChanged(this.messageEditText.getText(), true, false);
}
if (this.keyboardVisible || this.currentPopupContentType != -1) {
return;
}
openKeyboard();
return;
}
if (this.slowModeTimer > 0 && !isInScheduleMode()) {
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate2 = this.delegate;
if (chatActivityEnterViewDelegate2 != null) {
SlowModeBtn slowModeBtn = this.slowModeButton;
chatActivityEnterViewDelegate2.onUpdateSlowModeButton(slowModeBtn, true, slowModeBtn.getText());
return;
}
return;
}
TLRPC.User user = (messageObject == null || !DialogObject.isChatDialog(this.dialog_id)) ? null : this.accountInstance.getMessagesController().getUser(Long.valueOf(messageObject.messageOwner.from_id.user_id));
SendMessagesHelper$SendMessageParams of = ((this.botCount != 1 || username) && user != null && user.bot && !command.contains("@")) ? SendMessagesHelper$SendMessageParams.of(String.format(Locale.US, "%s@%s", command, UserObject.getPublicUsername(user)), this.dialog_id, this.replyingMessageObject, getThreadMessage(), null, false, null, null, null, true, 0, null, false) : SendMessagesHelper$SendMessageParams.of(command, this.dialog_id, this.replyingMessageObject, getThreadMessage(), null, false, null, null, null, true, 0, null, false);
ChatActivity chatActivity = this.parentFragment;
of.quick_reply_shortcut = chatActivity != null ? chatActivity.quickReplyShortcut : null;
of.quick_reply_shortcut_id = chatActivity != null ? chatActivity.getQuickReplyId() : 0;
MessageSendPreview messageSendPreview = this.messageSendPreview;
of.effect_id = messageSendPreview != null ? messageSendPreview.getSelectedEffect() : 0L;
applyStoryToSendMessageParams(of);
SendMessagesHelper.getInstance(this.currentAccount).sendMessage(of);
}
public void setEditingBusinessLink(TLRPC.TL_businessChatLink businessLink) {
String str;
this.editingBusinessLink = businessLink;
updateFieldHint(false);
if (this.editingBusinessLink != null) {
AnimatorSet animatorSet = this.doneButtonAnimation;
if (animatorSet != null) {
animatorSet.cancel();
this.doneButtonAnimation = null;
}
createDoneButton(true);
this.doneButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivityEnterView.this.lambda$setEditingBusinessLink$61(view);
}
});
this.doneButton.setVisibility(0);
this.doneButton.setScaleX(0.1f);
this.doneButton.setScaleY(0.1f);
this.doneButton.setAlpha(0.0f);
this.doneButton.animate().alpha(1.0f).scaleX(1.0f).scaleY(1.0f).setDuration(150L).setInterpolator(CubicBezierInterpolator.DEFAULT).start();
this.currentLimit = this.accountInstance.getMessagesController().maxMessageLength;
EditTextCaption editTextCaption = this.messageEditText;
TextPaint paint = editTextCaption != null ? editTextCaption.getPaint() : null;
if (paint == null) {
paint = new TextPaint();
paint.setTextSize(AndroidUtilities.dp(18.0f));
}
Paint.FontMetricsInt fontMetricsInt = paint.getFontMetricsInt();
ArrayList<TLRPC.MessageEntity> arrayList = this.editingBusinessLink.entities;
if (arrayList != null && (str = businessLink.message) != null) {
setFieldText(applyMessageEntities(arrayList, str, fontMetricsInt));
} else {
String str2 = businessLink.message;
if (str2 != null) {
setFieldText(str2);
}
}
this.lastSavedBusinessLinkMessage = calculateBusinessLinkPresetMessage();
setAllowStickersAndGifs(true, false, false);
this.sendButton.setVisibility(8);
setSlowModeButtonVisible(false);
this.cancelBotButton.setVisibility(8);
this.audioVideoButtonContainer.setVisibility(8);
LinearLayout linearLayout = this.attachLayout;
if (linearLayout != null) {
linearLayout.setVisibility(8);
}
this.sendButtonContainer.setVisibility(8);
ImageView imageView = this.scheduledButton;
if (imageView != null) {
imageView.setVisibility(8);
}
}
}
public void lambda$setEditingBusinessLink$61(View view) {
saveBusinessLink();
}
public final MessageObject editingMessageObjectPreview(MessageObject msg, boolean applyCaption) {
MessageObject messageObject = new MessageObject(this, msg.currentAccount, msg.messageOwner, true, true) {
@Override
public boolean isOutOwner() {
return true;
}
@Override
public boolean needDrawShareButton() {
return false;
}
};
if (applyCaption) {
CharSequence[] charSequenceArr = new CharSequence[1];
EditTextCaption editTextCaption = this.messageEditText;
charSequenceArr[0] = editTextCaption == null ? BuildConfig.APP_CENTER_HASH : editTextCaption.getTextToUse();
ArrayList<TLRPC.MessageEntity> entities = MediaDataController.getInstance(this.currentAccount).getEntities(charSequenceArr, true);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(charSequenceArr[0].toString());
MessageObject.addEntitiesToText(spannableStringBuilder, entities, true, true, false, true);
messageObject.caption = MessageObject.replaceAnimatedEmoji(Emoji.replaceEmoji((CharSequence) spannableStringBuilder, Theme.chat_msgTextPaint.getFontMetricsInt(), false, (int[]) null), entities, Theme.chat_msgTextPaint.getFontMetricsInt());
}
return messageObject;
}
public void setEditingMessageObject(final MessageObject messageObject, final MessageObject.GroupedMessages groupedMessages, boolean caption) {
CharSequence charSequence;
final CharSequence charSequence2;
int i;
if (this.audioToSend == null && this.videoToSendMessageObject == null && this.editingMessageObject != messageObject) {
createMessageEditText();
boolean z = this.editingMessageObject != null;
this.editingMessageObject = messageObject;
this.editingCaption = caption;
if (messageObject != null) {
this.captionAbove = groupedMessages != null ? groupedMessages.captionAbove : messageObject.messageOwner.invert_media;
AnimatorSet animatorSet = this.doneButtonAnimation;
if (animatorSet != null) {
animatorSet.cancel();
this.doneButtonAnimation = null;
}
createDoneButton(false);
this.doneButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChatActivityEnterView.this.lambda$setEditingMessageObject$62(view);
}
});
this.doneButton.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public final boolean onLongClick(View view) {
boolean lambda$setEditingMessageObject$65;
lambda$setEditingMessageObject$65 = ChatActivityEnterView.this.lambda$setEditingMessageObject$65(messageObject, groupedMessages, view);
return lambda$setEditingMessageObject$65;
}
});
this.doneButton.setVisibility(0);
this.doneButton.setScaleX(0.1f);
this.doneButton.setScaleY(0.1f);
this.doneButton.setAlpha(0.0f);
this.doneButton.animate().alpha(1.0f).scaleX(1.0f).scaleY(1.0f).setDuration(150L).setInterpolator(CubicBezierInterpolator.DEFAULT).start();
if (caption) {
this.currentLimit = this.accountInstance.getMessagesController().maxCaptionLength;
charSequence = this.editingMessageObject.caption;
} else {
this.currentLimit = this.accountInstance.getMessagesController().maxMessageLength;
charSequence = this.editingMessageObject.messageText;
}
if (charSequence != null) {
EditTextCaption editTextCaption = this.messageEditText;
TextPaint paint = editTextCaption != null ? editTextCaption.getPaint() : null;
if (paint == null) {
paint = new TextPaint();
paint.setTextSize(AndroidUtilities.dp(18.0f));
}
charSequence2 = applyMessageEntities(this.editingMessageObject.messageOwner.entities, charSequence, paint.getFontMetricsInt());
} else {
charSequence2 = BuildConfig.APP_CENTER_HASH;
}
if (this.draftMessage == null && !z) {
EditTextCaption editTextCaption2 = this.messageEditText;
this.draftMessage = (editTextCaption2 == null || editTextCaption2.length() <= 0) ? null : this.messageEditText.getText();
this.draftSearchWebpage = this.messageWebPageSearch;
}
MessageObject messageObject2 = this.editingMessageObject;
TLRPC.MessageMedia messageMedia = messageObject2.messageOwner.media;
this.messageWebPageSearch = !((messageMedia instanceof TLRPC.TL_messageMediaWebPage) && messageMedia.manual) && ((i = messageObject2.type) == 0 || i == 19);
if (!this.keyboardVisible) {
Runnable runnable = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$setEditingMessageObject$66(charSequence2);
}
};
this.setTextFieldRunnable = runnable;
AndroidUtilities.runOnUIThread(runnable, 200L);
} else {
Runnable runnable2 = this.setTextFieldRunnable;
if (runnable2 != null) {
AndroidUtilities.cancelRunOnUIThread(runnable2);
this.setTextFieldRunnable = null;
}
setFieldText(charSequence2);
}
EditTextCaption editTextCaption3 = this.messageEditText;
if (editTextCaption3 != null) {
editTextCaption3.requestFocus();
}
openKeyboard();
EditTextCaption editTextCaption4 = this.messageEditText;
if (editTextCaption4 != null) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) editTextCaption4.getLayoutParams();
layoutParams.rightMargin = AndroidUtilities.dp(4.0f);
this.messageEditText.setLayoutParams(layoutParams);
}
this.sendButton.setVisibility(8);
setSlowModeButtonVisible(false);
this.cancelBotButton.setVisibility(8);
this.audioVideoButtonContainer.setVisibility(8);
this.attachLayout.setVisibility(8);
this.sendButtonContainer.setVisibility(8);
ImageView imageView = this.scheduledButton;
if (imageView != null) {
imageView.setVisibility(8);
}
} else {
Runnable runnable3 = this.setTextFieldRunnable;
if (runnable3 != null) {
AndroidUtilities.cancelRunOnUIThread(runnable3);
this.setTextFieldRunnable = null;
}
SendButton sendButton = this.doneButton;
if (sendButton != null) {
sendButton.setVisibility(8);
}
this.currentLimit = -1;
this.delegate.onMessageEditEnd(false);
this.sendButtonContainer.setVisibility(0);
this.cancelBotButton.setScaleX(0.1f);
this.cancelBotButton.setScaleY(0.1f);
this.cancelBotButton.setAlpha(0.0f);
this.cancelBotButton.setVisibility(8);
if (this.slowModeTimer > 0 && !isInScheduleMode()) {
if (this.slowModeTimer == Integer.MAX_VALUE) {
this.sendButton.setScaleX(1.0f);
this.sendButton.setScaleY(1.0f);
this.sendButton.setAlpha(1.0f);
this.sendButton.setVisibility(0);
this.slowModeButton.setScaleX(0.1f);
this.slowModeButton.setScaleY(0.1f);
this.slowModeButton.setAlpha(0.0f);
setSlowModeButtonVisible(false);
} else {
this.sendButton.setScaleX(0.1f);
this.sendButton.setScaleY(0.1f);
this.sendButton.setAlpha(0.0f);
this.sendButton.setVisibility(8);
this.slowModeButton.setScaleX(1.0f);
this.slowModeButton.setScaleY(1.0f);
this.slowModeButton.setAlpha(1.0f);
setSlowModeButtonVisible(true);
}
this.attachLayout.setScaleX(0.01f);
this.attachLayoutAlpha = 0.0f;
updateAttachLayoutParams();
this.attachLayout.setVisibility(8);
this.audioVideoButtonContainer.setScaleX(0.1f);
this.audioVideoButtonContainer.setScaleY(0.1f);
this.audioVideoButtonContainer.setAlpha(0.0f);
this.audioVideoButtonContainer.setVisibility(8);
} else {
this.sendButton.setScaleX(0.1f);
this.sendButton.setScaleY(0.1f);
this.sendButton.setAlpha(0.0f);
this.sendButton.setVisibility(8);
this.slowModeButton.setScaleX(0.1f);
this.slowModeButton.setScaleY(0.1f);
this.slowModeButton.setAlpha(0.0f);
setSlowModeButtonVisible(false);
this.attachLayout.setScaleX(1.0f);
this.attachLayoutAlpha = 1.0f;
updateAttachLayoutParams();
this.attachLayout.setVisibility(0);
this.audioVideoButtonContainer.setScaleX(1.0f);
this.audioVideoButtonContainer.setScaleY(1.0f);
this.audioVideoButtonContainer.setAlpha(1.0f);
this.audioVideoButtonContainer.setVisibility(0);
}
createScheduledButton();
ImageView imageView2 = this.scheduledButton;
if (imageView2 != null && imageView2.getTag() != null) {
this.scheduledButton.setScaleX(1.0f);
this.scheduledButton.setScaleY(1.0f);
this.scheduledButton.setAlpha(1.0f);
this.scheduledButton.setVisibility(0);
}
ChatActivity chatActivity = this.parentFragment;
if (chatActivity != null) {
chatActivity.editingMessageObject = null;
chatActivity.foundWebPage = null;
MessagePreviewParams messagePreviewParams = chatActivity.messagePreviewParams;
if (messagePreviewParams != null) {
messagePreviewParams.updateLink(this.currentAccount, null, BuildConfig.APP_CENTER_HASH, null, null, null);
}
setWebPage(null, true);
this.parentFragment.fallbackFieldPanel();
}
createMessageEditText();
EditTextCaption editTextCaption5 = this.messageEditText;
if (editTextCaption5 != null) {
editTextCaption5.setText(this.draftMessage);
EditTextCaption editTextCaption6 = this.messageEditText;
editTextCaption6.setSelection(editTextCaption6.length());
}
this.draftMessage = null;
this.messageWebPageSearch = this.draftSearchWebpage;
if (getVisibility() == 0) {
this.delegate.onAttachButtonShow();
}
updateFieldRight(1);
}
updateFieldHint(true);
updateSendAsButton(true);
}
}
public void lambda$setEditingMessageObject$62(View view) {
doneEditingMessage();
}
public boolean lambda$setEditingMessageObject$65(final MessageObject messageObject, final MessageObject.GroupedMessages groupedMessages, View view) {
EditTextCaption editTextCaption;
if (messageObject.isMediaEmpty() || (editTextCaption = this.messageEditText) == null || TextUtils.isEmpty(editTextCaption.getTextToUse())) {
return false;
}
if (groupedMessages != null && (!groupedMessages.hasCaption || groupedMessages.isDocuments)) {
return false;
}
int i = messageObject.type;
if (i != 1 && i != 3 && i != 8) {
return false;
}
final MessageSendPreview messageSendPreview = new MessageSendPreview(getContext(), this.resourcesProvider);
messageSendPreview.allowRelayout = true;
final ArrayList arrayList = new ArrayList();
if (groupedMessages != null) {
int i2 = 0;
while (i2 < groupedMessages.messages.size()) {
arrayList.add(editingMessageObjectPreview(groupedMessages.messages.get(i2), i2 == 0));
i2++;
}
} else {
arrayList.add(editingMessageObjectPreview(messageObject, true));
}
messageSendPreview.setMessageObjects(arrayList);
ItemOptions makeOptions = ItemOptions.makeOptions(this.sizeNotifierLayout, this.resourcesProvider, this.doneButton);
final MessagePreviewView.ToggleButton toggleButton = new MessagePreviewView.ToggleButton(getContext(), R.raw.position_below, LocaleController.getString(R.string.CaptionAbove), R.raw.position_above, LocaleController.getString(R.string.CaptionBelow), this.resourcesProvider);
toggleButton.setState(!this.captionAbove, false);
toggleButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
ChatActivityEnterView.this.lambda$setEditingMessageObject$63(arrayList, toggleButton, messageSendPreview, view2);
}
});
makeOptions.addView(toggleButton);
makeOptions.setupSelectors();
messageSendPreview.setItemOptions(makeOptions);
messageSendPreview.setSendButton(this.doneButton, false, new View.OnClickListener() {
@Override
public final void onClick(View view2) {
ChatActivityEnterView.this.lambda$setEditingMessageObject$64(groupedMessages, messageObject, messageSendPreview, view2);
}
});
messageSendPreview.show();
return true;
}
public void lambda$setEditingMessageObject$63(ArrayList arrayList, MessagePreviewView.ToggleButton toggleButton, MessageSendPreview messageSendPreview, View view) {
this.captionAbove = !this.captionAbove;
for (int i = 0; i < arrayList.size(); i++) {
((MessageObject) arrayList.get(i)).messageOwner.invert_media = this.captionAbove;
}
toggleButton.setState(!this.captionAbove, true);
if (!arrayList.isEmpty()) {
messageSendPreview.changeMessage((MessageObject) arrayList.get(0));
}
messageSendPreview.scrollTo(!this.captionAbove);
}
public void lambda$setEditingMessageObject$64(MessageObject.GroupedMessages groupedMessages, MessageObject messageObject, MessageSendPreview messageSendPreview, View view) {
if (groupedMessages != null) {
Iterator<MessageObject> it = groupedMessages.messages.iterator();
while (it.hasNext()) {
it.next().messageOwner.invert_media = this.captionAbove;
}
groupedMessages.calculate();
} else {
messageObject.messageOwner.invert_media = this.captionAbove;
}
doneEditingMessage();
messageSendPreview.dismiss(true);
this.captionAbove = false;
}
public void lambda$setEditingMessageObject$66(CharSequence charSequence) {
setFieldText(charSequence);
this.setTextFieldRunnable = null;
}
public static CharSequence applyMessageEntities(ArrayList<TLRPC.MessageEntity> entities, CharSequence text, Paint.FontMetricsInt fontMetricsInt) {
AnimatedEmojiSpan animatedEmojiSpan;
MediaDataController.sortEntities(entities);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(text);
Object[] spans = spannableStringBuilder.getSpans(0, spannableStringBuilder.length(), Object.class);
if (spans != null && spans.length > 0) {
for (Object obj : spans) {
spannableStringBuilder.removeSpan(obj);
}
}
if (entities != null) {
for (int i = 0; i < entities.size(); i++) {
try {
TLRPC.MessageEntity messageEntity = entities.get(i);
if (messageEntity.offset + messageEntity.length <= spannableStringBuilder.length()) {
if (messageEntity instanceof TLRPC.TL_inputMessageEntityMentionName) {
if (messageEntity.offset + messageEntity.length < spannableStringBuilder.length() && spannableStringBuilder.charAt(messageEntity.offset + messageEntity.length) == ' ') {
messageEntity.length++;
}
URLSpanUserMention uRLSpanUserMention = new URLSpanUserMention(BuildConfig.APP_CENTER_HASH + ((TLRPC.TL_inputMessageEntityMentionName) messageEntity).user_id.user_id, 3);
int i2 = messageEntity.offset;
spannableStringBuilder.setSpan(uRLSpanUserMention, i2, messageEntity.length + i2, 33);
} else if (messageEntity instanceof TLRPC.TL_messageEntityMentionName) {
if (messageEntity.offset + messageEntity.length < spannableStringBuilder.length() && spannableStringBuilder.charAt(messageEntity.offset + messageEntity.length) == ' ') {
messageEntity.length++;
}
URLSpanUserMention uRLSpanUserMention2 = new URLSpanUserMention(BuildConfig.APP_CENTER_HASH + ((TLRPC.TL_messageEntityMentionName) messageEntity).user_id, 3);
int i3 = messageEntity.offset;
spannableStringBuilder.setSpan(uRLSpanUserMention2, i3, messageEntity.length + i3, 33);
} else if (messageEntity instanceof TLRPC.TL_messageEntityCode) {
TextStyleSpan.TextStyleRun textStyleRun = new TextStyleSpan.TextStyleRun();
textStyleRun.flags |= 4;
TextStyleSpan textStyleSpan = new TextStyleSpan(textStyleRun);
int i4 = messageEntity.offset;
MediaDataController.addStyleToText(textStyleSpan, i4, messageEntity.length + i4, spannableStringBuilder, true);
} else if (!(messageEntity instanceof TLRPC.TL_messageEntityPre)) {
if (messageEntity instanceof TLRPC.TL_messageEntityBold) {
TextStyleSpan.TextStyleRun textStyleRun2 = new TextStyleSpan.TextStyleRun();
textStyleRun2.flags |= 1;
TextStyleSpan textStyleSpan2 = new TextStyleSpan(textStyleRun2);
int i5 = messageEntity.offset;
MediaDataController.addStyleToText(textStyleSpan2, i5, messageEntity.length + i5, spannableStringBuilder, true);
} else if (messageEntity instanceof TLRPC.TL_messageEntityItalic) {
TextStyleSpan.TextStyleRun textStyleRun3 = new TextStyleSpan.TextStyleRun();
textStyleRun3.flags |= 2;
TextStyleSpan textStyleSpan3 = new TextStyleSpan(textStyleRun3);
int i6 = messageEntity.offset;
MediaDataController.addStyleToText(textStyleSpan3, i6, messageEntity.length + i6, spannableStringBuilder, true);
} else if (messageEntity instanceof TLRPC.TL_messageEntityStrike) {
TextStyleSpan.TextStyleRun textStyleRun4 = new TextStyleSpan.TextStyleRun();
textStyleRun4.flags |= 8;
TextStyleSpan textStyleSpan4 = new TextStyleSpan(textStyleRun4);
int i7 = messageEntity.offset;
MediaDataController.addStyleToText(textStyleSpan4, i7, messageEntity.length + i7, spannableStringBuilder, true);
} else if (messageEntity instanceof TLRPC.TL_messageEntityUnderline) {
TextStyleSpan.TextStyleRun textStyleRun5 = new TextStyleSpan.TextStyleRun();
textStyleRun5.flags |= 16;
TextStyleSpan textStyleSpan5 = new TextStyleSpan(textStyleRun5);
int i8 = messageEntity.offset;
MediaDataController.addStyleToText(textStyleSpan5, i8, messageEntity.length + i8, spannableStringBuilder, true);
} else if (messageEntity instanceof TLRPC.TL_messageEntityTextUrl) {
URLSpanReplacement uRLSpanReplacement = new URLSpanReplacement(messageEntity.url);
int i9 = messageEntity.offset;
spannableStringBuilder.setSpan(uRLSpanReplacement, i9, messageEntity.length + i9, 33);
} else if (messageEntity instanceof TLRPC.TL_messageEntitySpoiler) {
TextStyleSpan.TextStyleRun textStyleRun6 = new TextStyleSpan.TextStyleRun();
textStyleRun6.flags |= 256;
TextStyleSpan textStyleSpan6 = new TextStyleSpan(textStyleRun6);
int i10 = messageEntity.offset;
MediaDataController.addStyleToText(textStyleSpan6, i10, messageEntity.length + i10, spannableStringBuilder, true);
} else if (messageEntity instanceof TLRPC.TL_messageEntityCustomEmoji) {
TLRPC.TL_messageEntityCustomEmoji tL_messageEntityCustomEmoji = (TLRPC.TL_messageEntityCustomEmoji) messageEntity;
if (tL_messageEntityCustomEmoji.document != null) {
animatedEmojiSpan = new AnimatedEmojiSpan(tL_messageEntityCustomEmoji.document, fontMetricsInt);
} else {
animatedEmojiSpan = new AnimatedEmojiSpan(tL_messageEntityCustomEmoji.document_id, fontMetricsInt);
}
int i11 = messageEntity.offset;
spannableStringBuilder.setSpan(animatedEmojiSpan, i11, messageEntity.length + i11, 33);
}
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
}
QuoteSpan.mergeQuotes(spannableStringBuilder, entities);
CharSequence replaceEmoji = Emoji.replaceEmoji((CharSequence) new SpannableStringBuilder(spannableStringBuilder), fontMetricsInt, false, (int[]) null);
if (entities != null) {
try {
for (int size = entities.size() - 1; size >= 0; size--) {
TLRPC.MessageEntity messageEntity2 = entities.get(size);
if ((messageEntity2 instanceof TLRPC.TL_messageEntityPre) && messageEntity2.offset + messageEntity2.length <= replaceEmoji.length()) {
if (!(replaceEmoji instanceof Spannable)) {
replaceEmoji = new SpannableStringBuilder(replaceEmoji);
}
((SpannableStringBuilder) replaceEmoji).insert(messageEntity2.offset + messageEntity2.length, (CharSequence) "```\n");
SpannableStringBuilder spannableStringBuilder2 = (SpannableStringBuilder) replaceEmoji;
int i12 = messageEntity2.offset;
StringBuilder sb = new StringBuilder();
sb.append("```");
String str = messageEntity2.language;
if (str == null) {
str = BuildConfig.APP_CENTER_HASH;
}
sb.append(str);
sb.append("\n");
spannableStringBuilder2.insert(i12, (CharSequence) sb.toString());
}
}
} catch (Exception e2) {
FileLog.e(e2);
}
}
return replaceEmoji;
}
public ImageView getAttachButton() {
return this.attachButton;
}
public View getSendButton() {
return this.sendButton.getVisibility() == 0 ? this.sendButton : this.audioVideoButtonContainer;
}
public View getAudioVideoButtonContainer() {
return this.audioVideoButtonContainer;
}
public View getEmojiButton() {
return this.emojiButton;
}
public EmojiView getEmojiView() {
return this.emojiView;
}
public TrendingStickersAlert getTrendingStickersAlert() {
return this.trendingStickersAlert;
}
public void updateColors() {
MessageSendPreview messageSendPreview = this.messageSendPreview;
if (messageSendPreview != null) {
messageSendPreview.updateColors();
}
updateRecordedDeleteIconColors();
RecordCircle recordCircle = this.recordCircle;
if (recordCircle != null) {
recordCircle.updateColors();
}
RecordDot recordDot = this.recordDot;
if (recordDot != null) {
recordDot.updateColors();
}
SlideTextView slideTextView = this.slideText;
if (slideTextView != null) {
slideTextView.updateColors();
}
TimerView timerView = this.recordTimerView;
if (timerView != null) {
timerView.updateColors();
}
VideoTimelineView videoTimelineView = this.videoTimelineView;
if (videoTimelineView != null) {
videoTimelineView.updateColors();
}
NumberTextView numberTextView = this.captionLimitView;
if (numberTextView != null && this.messageEditText != null) {
if (this.codePointCount - this.currentLimit < 0) {
numberTextView.setTextColor(getThemedColor(Theme.key_text_RedRegular));
} else {
numberTextView.setTextColor(getThemedColor(Theme.key_windowBackgroundWhiteGrayText));
}
}
int themedColor = getThemedColor(Theme.key_chat_messagePanelVoicePressed);
int alpha = Color.alpha(themedColor);
Drawable drawable = this.doneCheckDrawable;
if (drawable != null) {
drawable.setColorFilter(new PorterDuffColorFilter(ColorUtils.setAlphaComponent(themedColor, (int) (alpha * ((this.doneButtonEnabledProgress * 0.42f) + 0.58f))), PorterDuff.Mode.MULTIPLY));
}
BotCommandsMenuContainer botCommandsMenuContainer = this.botCommandsMenuContainer;
if (botCommandsMenuContainer != null) {
botCommandsMenuContainer.updateColors();
}
BotKeyboardView botKeyboardView = this.botKeyboardView;
if (botKeyboardView != null) {
botKeyboardView.updateColors();
}
ChatActivityEnterViewAnimatedIconView chatActivityEnterViewAnimatedIconView = this.audioVideoSendButton;
int i = Theme.key_chat_messagePanelIcons;
chatActivityEnterViewAnimatedIconView.setColorFilter(new PorterDuffColorFilter(getThemedColor(i), PorterDuff.Mode.SRC_IN));
this.emojiButton.setColorFilter(new PorterDuffColorFilter(getThemedColor(i), PorterDuff.Mode.SRC_IN));
if (Build.VERSION.SDK_INT >= 21) {
this.emojiButton.setBackground(Theme.createSelectorDrawable(getThemedColor(Theme.key_listSelector)));
}
if (Theme.usePlusTheme) {
updateTheme();
}
}
public final void updateRecordedDeleteIconColors() {
int themedColor = getThemedColor(Theme.key_chat_recordedVoiceDot);
int themedColor2 = getThemedColor(Theme.key_chat_messagePanelBackground);
int themedColor3 = getThemedColor(Theme.key_chat_messagePanelVoiceDelete);
RLottieImageView rLottieImageView = this.recordDeleteImageView;
if (rLottieImageView != null) {
rLottieImageView.setLayerColor("Cup Red.**", themedColor);
this.recordDeleteImageView.setLayerColor("Box Red.**", themedColor);
this.recordDeleteImageView.setLayerColor("Cup Grey.**", themedColor3);
this.recordDeleteImageView.setLayerColor("Box Grey.**", themedColor3);
this.recordDeleteImageView.setLayerColor("Line 1.**", themedColor2);
this.recordDeleteImageView.setLayerColor("Line 2.**", themedColor2);
this.recordDeleteImageView.setLayerColor("Line 3.**", themedColor2);
}
}
@Override
public void setFieldText(CharSequence text) {
setFieldText(text, true, false);
}
public void setFieldText(CharSequence text, boolean ignoreChange) {
setFieldText(text, ignoreChange, false);
}
public void setFieldText(CharSequence text, boolean ignoreChange, boolean fromDraft) {
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate;
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption == null) {
return;
}
this.ignoreTextChange = ignoreChange;
editTextCaption.setText(text);
this.messageEditText.invalidateQuotes(true);
EditTextCaption editTextCaption2 = this.messageEditText;
editTextCaption2.setSelection(editTextCaption2.getText().length());
this.ignoreTextChange = false;
if (!ignoreChange || (chatActivityEnterViewDelegate = this.delegate) == null) {
return;
}
chatActivityEnterViewDelegate.onTextChanged(this.messageEditText.getText(), true, fromDraft);
}
public void setVoiceDraft(MediaDataController.DraftVoice draft) {
if (draft == null) {
return;
}
this.voiceOnce = draft.once;
ControlsView controlsView = this.controlsView;
if (controlsView != null) {
controlsView.periodDrawable.setValue(1, this.voiceOnce, true);
}
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
TL_stories$StoryItem replyToStory = chatActivityEnterViewDelegate != null ? chatActivityEnterViewDelegate.getReplyToStory() : null;
MediaController mediaController = MediaController.getInstance();
int i = this.currentAccount;
long j = this.dialog_id;
MessageObject messageObject = this.replyingMessageObject;
MessageObject threadMessage = getThreadMessage();
int i2 = this.recordingGuid;
ChatActivity chatActivity = this.parentFragment;
mediaController.prepareResumedRecording(i, draft, j, messageObject, threadMessage, replyToStory, i2, chatActivity != null ? chatActivity.quickReplyShortcut : null, chatActivity != null ? chatActivity.getQuickReplyId() : 0);
}
public void setSelection(int start) {
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption == null) {
return;
}
editTextCaption.setSelection(start, editTextCaption.length());
}
public int getCursorPosition() {
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption == null) {
return 0;
}
return editTextCaption.getSelectionStart();
}
public int getSelectionLength() {
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption == null) {
return 0;
}
try {
return editTextCaption.getSelectionEnd() - this.messageEditText.getSelectionStart();
} catch (Exception e) {
FileLog.e(e);
return 0;
}
}
public void replaceWithText(int start, int len, CharSequence text, boolean parseEmoji) {
if (this.messageEditText == null) {
return;
}
try {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(this.messageEditText.getText());
spannableStringBuilder.replace(start, len + start, text);
if (parseEmoji) {
Emoji.replaceEmoji((CharSequence) spannableStringBuilder, this.messageEditText.getPaint().getFontMetricsInt(), false, (int[]) null);
}
this.messageEditText.setText(spannableStringBuilder);
this.messageEditText.setSelection(start + text.length());
} catch (Exception e) {
FileLog.e(e);
}
}
public void setFieldFocused() {
AccessibilityManager accessibilityManager = (AccessibilityManager) this.parentActivity.getSystemService("accessibility");
if (this.messageEditText == null || accessibilityManager.isTouchExplorationEnabled()) {
return;
}
try {
this.messageEditText.requestFocus();
} catch (Exception e) {
FileLog.e(e);
}
}
public void setFieldFocused(boolean focus) {
AccessibilityManager accessibilityManager = (AccessibilityManager) this.parentActivity.getSystemService("accessibility");
if (this.messageEditText == null || accessibilityManager.isTouchExplorationEnabled()) {
return;
}
if (focus) {
if (this.searchingType != 0 || this.messageEditText.isFocused()) {
return;
}
BotWebViewMenuContainer botWebViewMenuContainer = this.botWebViewMenuContainer;
if (botWebViewMenuContainer == null || botWebViewMenuContainer.getVisibility() == 8) {
Runnable runnable = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$setFieldFocused$67();
}
};
this.focusRunnable = runnable;
AndroidUtilities.runOnUIThread(runnable, 600L);
return;
}
return;
}
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption == null || !editTextCaption.isFocused()) {
return;
}
if (!this.keyboardVisible || this.isPaused) {
this.messageEditText.clearFocus();
}
}
public void lambda$setFieldFocused$67() {
EditTextCaption editTextCaption;
ViewGroup viewGroup = null;
this.focusRunnable = null;
boolean z = true;
if (AndroidUtilities.isTablet()) {
LaunchActivity launchActivity = this.parentActivity;
if (launchActivity instanceof LaunchActivity) {
LaunchActivity launchActivity2 = launchActivity;
if (launchActivity2 != null && launchActivity2.getLayersActionBarLayout() != null) {
viewGroup = launchActivity2.getLayersActionBarLayout().getView();
}
if (viewGroup != null && viewGroup.getVisibility() == 0) {
z = false;
}
}
}
if (this.isPaused || !z || (editTextCaption = this.messageEditText) == null) {
return;
}
try {
editTextCaption.requestFocus();
} catch (Exception e) {
FileLog.e(e);
}
}
public boolean hasText() {
EditTextCaption editTextCaption = this.messageEditText;
return editTextCaption != null && editTextCaption.length() > 0;
}
@Override
public EditTextCaption getEditField() {
return this.messageEditText;
}
@Override
public Editable getEditText() {
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption == null) {
return null;
}
return editTextCaption.getText();
}
public CharSequence getDraftMessage() {
if (this.editingMessageObject != null) {
if (TextUtils.isEmpty(this.draftMessage)) {
return null;
}
return this.draftMessage;
}
if (this.messageEditText == null || !hasText()) {
return null;
}
return this.messageEditText.getText();
}
@Override
public CharSequence getFieldText() {
if (this.messageEditText == null || !hasText()) {
return null;
}
return this.messageEditText.getText();
}
public void updateGiftButton(boolean r8) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.Components.ChatActivityEnterView.updateGiftButton(boolean):void");
}
public final void checkBirthdayHint() {
ImageView imageView;
ChatActivity chatActivity;
if (this.birthdayHint != null || (imageView = this.giftButton) == null || imageView.getRight() == 0 || (chatActivity = this.parentFragment) == null || !BirthdayController.isToday(chatActivity.getCurrentUserInfo())) {
return;
}
if (MessagesController.getInstance(this.currentAccount).getMainSettings().getBoolean(Calendar.getInstance().get(1) + "bdayhint_" + this.parentFragment.getDialogId(), true)) {
MessagesController.getInstance(this.currentAccount).getMainSettings().edit().putBoolean(Calendar.getInstance().get(1) + "bdayhint_" + this.parentFragment.getDialogId(), false).apply();
HintView2 hintView2 = new HintView2(getContext(), 3);
this.birthdayHint = hintView2;
hintView2.setRounding(13.0f);
this.birthdayHint.setMultilineText(true);
setBirthdayHintText();
this.birthdayHint.setPadding(AndroidUtilities.dp(12.0f), 0, AndroidUtilities.dp(12.0f), 0);
this.birthdayHint.setJointPx(1.0f, -((getWidth() - AndroidUtilities.dp(12.0f)) - (((this.messageEditTextContainer.getX() + this.attachLayout.getX()) + this.giftButton.getX()) + (this.giftButton.getMeasuredWidth() / 2.0f))));
addView(this.birthdayHint, LayoutHelper.createFrame(-1, 200.0f, 48, 0.0f, -192.0f, 0.0f, 0.0f));
this.birthdayHint.setOnHiddenListener(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$checkBirthdayHint$68();
}
});
this.birthdayHint.setDuration(8000L);
this.birthdayHint.show();
}
}
public void lambda$checkBirthdayHint$68() {
removeView(this.birthdayHint);
}
public final void setBirthdayHintText() {
HintView2 hintView2 = this.birthdayHint;
if (hintView2 == null) {
return;
}
hintView2.setText(Emoji.replaceWithRestrictedEmoji(AndroidUtilities.replaceTags(LocaleController.formatString(R.string.UserBirthdayHint, new Object[]{UserObject.getFirstName(this.parentFragment.getCurrentUser())})), this.birthdayHint.getTextPaint().getFontMetricsInt(), new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.setBirthdayHintText();
}
}));
HintView2 hintView22 = this.birthdayHint;
hintView22.setMaxWidthPx(HintView2.cutInFancyHalf(hintView22.getText(), this.birthdayHint.getTextPaint()));
}
public void hideHints() {
HintView2 hintView2 = this.birthdayHint;
if (hintView2 != null) {
hintView2.hide();
}
}
public void updateScheduleButton(boolean animated) {
boolean z;
ImageView imageView;
ImageView imageView2;
TLRPC.TL_chatAdminRights tL_chatAdminRights;
if (DialogObject.isChatDialog(this.dialog_id)) {
TLRPC.Chat chat = this.accountInstance.getMessagesController().getChat(Long.valueOf(-this.dialog_id));
this.silent = MessagesController.getNotificationsSettings(this.currentAccount).getBoolean(NotificationsSettingsFacade.PROPERTY_SILENT + this.dialog_id, false);
z = ChatObject.isChannel(chat) && (chat.creator || ((tL_chatAdminRights = chat.admin_rights) != null && tL_chatAdminRights.post_messages)) && !chat.megagroup;
this.canWriteToChannel = z;
if (this.notifyButton != null) {
if (this.notifySilentDrawable == null) {
this.notifySilentDrawable = new CrossOutDrawable(getContext(), R.drawable.input_notify_on, Theme.key_chat_messagePanelIcons);
}
this.notifySilentDrawable.setCrossOut(this.silent, false);
this.notifyButton.setImageDrawable(this.notifySilentDrawable);
} else {
z = false;
}
LinearLayout linearLayout = this.attachLayout;
if (linearLayout != null) {
updateFieldRight(linearLayout.getVisibility() == 0 ? 1 : 0);
}
} else {
z = false;
}
TLRPC.Chat chat2 = this.accountInstance.getMessagesController().getChat(Long.valueOf(-this.dialog_id));
TLRPC.User user = this.accountInstance.getMessagesController().getUser(Long.valueOf(this.dialog_id));
if (PlusSettings.showSendWithoutSound && !z && (user != null || ((ChatObject.isChannel(chat2) && chat2.megagroup) || !ChatObject.isChannel(chat2)))) {
z = true;
}
boolean z2 = (this.delegate == null || isInScheduleMode() || !this.delegate.hasScheduledMessages()) ? false : true;
final boolean z3 = (!z2 || this.scheduleButtonHidden || this.recordingAudioVideo) ? false : true;
if (z3) {
createScheduledButton();
}
ImageView imageView3 = this.scheduledButton;
float f = 96.0f;
if (imageView3 != null) {
if ((imageView3.getTag() != null && z3) || (this.scheduledButton.getTag() == null && !z3)) {
if (this.notifyButton != null) {
int i = (z2 || !z || this.scheduledButton.getVisibility() == 0) ? 8 : 0;
if (i != this.notifyButton.getVisibility()) {
this.notifyButton.setVisibility(i);
LinearLayout linearLayout2 = this.attachLayout;
if (linearLayout2 != null) {
ImageView imageView4 = this.botButton;
if ((imageView4 == null || imageView4.getVisibility() == 8) && ((imageView2 = this.notifyButton) == null || imageView2.getVisibility() == 8)) {
f = 48.0f;
}
linearLayout2.setPivotX(AndroidUtilities.dp(f));
return;
}
return;
}
return;
}
return;
}
this.scheduledButton.setTag(z3 ? 1 : null);
}
AnimatorSet animatorSet = this.scheduledButtonAnimation;
if (animatorSet != null) {
animatorSet.cancel();
this.scheduledButtonAnimation = null;
}
if (!animated || z) {
ImageView imageView5 = this.scheduledButton;
if (imageView5 != null) {
imageView5.setVisibility(z3 ? 0 : 8);
this.scheduledButton.setAlpha(z3 ? 1.0f : 0.0f);
this.scheduledButton.setScaleX(z3 ? 1.0f : 0.1f);
this.scheduledButton.setScaleY(z3 ? 1.0f : 0.1f);
ImageView imageView6 = this.notifyButton;
if (imageView6 != null) {
imageView6.setVisibility((!z || this.scheduledButton.getVisibility() == 0) ? 8 : 0);
}
ImageView imageView7 = this.giftButton;
if (imageView7 != null && imageView7.getVisibility() == 0) {
this.scheduledButton.setTranslationX(-AndroidUtilities.dp(48.0f));
}
}
} else {
ImageView imageView8 = this.scheduledButton;
if (imageView8 != null) {
if (z3) {
imageView8.setVisibility(0);
}
this.scheduledButton.setPivotX(AndroidUtilities.dp(24.0f));
AnimatorSet animatorSet2 = new AnimatorSet();
this.scheduledButtonAnimation = animatorSet2;
Animator[] animatorArr = new Animator[3];
ImageView imageView9 = this.scheduledButton;
Property property = View.ALPHA;
float[] fArr = new float[1];
fArr[0] = z3 ? 1.0f : 0.0f;
animatorArr[0] = ObjectAnimator.ofFloat(imageView9, (Property<ImageView, Float>) property, fArr);
ImageView imageView10 = this.scheduledButton;
Property property2 = View.SCALE_X;
float[] fArr2 = new float[1];
fArr2[0] = z3 ? 1.0f : 0.1f;
animatorArr[1] = ObjectAnimator.ofFloat(imageView10, (Property<ImageView, Float>) property2, fArr2);
ImageView imageView11 = this.scheduledButton;
Property property3 = View.SCALE_Y;
float[] fArr3 = new float[1];
fArr3[0] = z3 ? 1.0f : 0.1f;
animatorArr[2] = ObjectAnimator.ofFloat(imageView11, (Property<ImageView, Float>) property3, fArr3);
animatorSet2.playTogether(animatorArr);
this.scheduledButtonAnimation.setDuration(180L);
this.scheduledButtonAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
ChatActivityEnterView.this.scheduledButtonAnimation = null;
if (z3) {
return;
}
ChatActivityEnterView.this.scheduledButton.setVisibility(8);
}
});
this.scheduledButtonAnimation.start();
}
}
LinearLayout linearLayout3 = this.attachLayout;
if (linearLayout3 != null) {
ImageView imageView12 = this.botButton;
if ((imageView12 == null || imageView12.getVisibility() == 8) && ((imageView = this.notifyButton) == null || imageView.getVisibility() == 8)) {
f = 48.0f;
}
linearLayout3.setPivotX(AndroidUtilities.dp(f));
}
}
public void updateSendAsButton() {
updateSendAsButton(true);
}
public void updateSendAsButton(boolean animated) {
float f;
float f2;
SenderSelectView senderSelectView;
SenderSelectView senderSelectView2;
FrameLayout frameLayout;
if (this.parentFragment == null || this.delegate == null) {
return;
}
createMessageEditText();
TLRPC.ChatFull chatFull = this.parentFragment.getMessagesController().getChatFull(-this.dialog_id);
TLRPC.Peer peer = chatFull != null ? chatFull.default_send_as : null;
if (peer == null && this.delegate.getSendAsPeers() != null && !this.delegate.getSendAsPeers().peers.isEmpty()) {
peer = this.delegate.getSendAsPeers().peers.get(0).peer;
}
boolean z = (PlusSettings.hideSenderSelector || peer == null || (this.delegate.getSendAsPeers() != null && this.delegate.getSendAsPeers().peers.size() <= 1) || isEditingMessage() || isRecordingAudioVideo() || ((frameLayout = this.recordedAudioPanel) != null && frameLayout.getVisibility() == 0)) ? false : true;
if (z) {
createSenderSelectView();
}
if (peer != null) {
if (peer.channel_id != 0) {
TLRPC.Chat chat = MessagesController.getInstance(this.currentAccount).getChat(Long.valueOf(peer.channel_id));
if (chat != null && (senderSelectView2 = this.senderSelectView) != null) {
senderSelectView2.setAvatar(chat);
this.senderSelectView.setContentDescription(LocaleController.formatString(R.string.AccDescrSendAs, new Object[]{chat.title}));
}
} else {
TLObject user = MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(peer.user_id));
if (user != null && (senderSelectView = this.senderSelectView) != null) {
senderSelectView.setAvatar(user);
this.senderSelectView.setContentDescription(LocaleController.formatString(R.string.AccDescrSendAs, new Object[]{ContactsController.formatName(((TLRPC.User) user).first_name, ((TLRPC.User) user).last_name)}));
}
}
}
SenderSelectView senderSelectView3 = this.senderSelectView;
boolean z2 = senderSelectView3 != null && senderSelectView3.getVisibility() == 0;
int dp = AndroidUtilities.dp(2.0f);
float f3 = z ? 0.0f : 1.0f;
float f4 = z ? 1.0f : 0.0f;
SenderSelectView senderSelectView4 = this.senderSelectView;
if (senderSelectView4 != null) {
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) senderSelectView4.getLayoutParams();
f = z ? ((-this.senderSelectView.getLayoutParams().width) - marginLayoutParams.leftMargin) - dp : 0.0f;
f2 = z ? 0.0f : ((-this.senderSelectView.getLayoutParams().width) - marginLayoutParams.leftMargin) - dp;
} else {
f = 0.0f;
f2 = 0.0f;
}
if (z2 != z) {
SenderSelectView senderSelectView5 = this.senderSelectView;
ValueAnimator valueAnimator = senderSelectView5 == null ? null : (ValueAnimator) senderSelectView5.getTag();
if (valueAnimator != null) {
valueAnimator.cancel();
this.senderSelectView.setTag(null);
}
if (this.parentFragment.getOtherSameChatsDiff() == 0 && this.parentFragment.fragmentOpened && animated) {
ValueAnimator duration = ValueAnimator.ofFloat(0.0f, 1.0f).setDuration(150L);
SenderSelectView senderSelectView6 = this.senderSelectView;
if (senderSelectView6 != null) {
senderSelectView6.setTranslationX(f);
}
this.messageTextTranslationX = f;
updateMessageTextParams();
final float f5 = f;
final float f6 = f2;
final float f7 = f3;
final float f8 = f4;
duration.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
ChatActivityEnterView.this.lambda$updateSendAsButton$69(f5, f6, f7, f8, valueAnimator2);
}
});
final boolean z3 = z;
final float f9 = f3;
final float f10 = f;
final float f11 = f2;
duration.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
if (z3) {
ChatActivityEnterView.this.createSenderSelectView();
ChatActivityEnterView.this.senderSelectView.setVisibility(0);
}
float f12 = 0.0f;
if (ChatActivityEnterView.this.senderSelectView != null) {
ChatActivityEnterView.this.senderSelectView.setAlpha(f9);
ChatActivityEnterView.this.senderSelectView.setTranslationX(f10);
f12 = ChatActivityEnterView.this.senderSelectView.getTranslationX();
}
ChatActivityEnterView.this.emojiButton.setTranslationX(f12);
ChatActivityEnterView.this.messageTextTranslationX = f12;
ChatActivityEnterView.this.updateMessageTextParams();
if (ChatActivityEnterView.this.botCommandsMenuButton == null || ChatActivityEnterView.this.botCommandsMenuButton.getTag() != null) {
return;
}
ChatActivityEnterView.this.animationParamsX.clear();
}
@Override
public void onAnimationEnd(Animator animation) {
if (z3) {
return;
}
if (ChatActivityEnterView.this.senderSelectView != null) {
ChatActivityEnterView.this.senderSelectView.setVisibility(8);
}
ChatActivityEnterView.this.emojiButton.setTranslationX(0.0f);
ChatActivityEnterView.this.messageTextTranslationX = 0.0f;
ChatActivityEnterView.this.updateMessageTextParams();
}
@Override
public void onAnimationCancel(Animator animation) {
float f12;
if (z3) {
ChatActivityEnterView.this.createSenderSelectView();
}
if (ChatActivityEnterView.this.senderSelectView != null) {
ChatActivityEnterView.this.senderSelectView.setVisibility(z3 ? 0 : 8);
ChatActivityEnterView.this.senderSelectView.setAlpha(f8);
ChatActivityEnterView.this.senderSelectView.setTranslationX(f11);
f12 = ChatActivityEnterView.this.senderSelectView.getTranslationX();
} else {
f12 = 0.0f;
}
ChatActivityEnterView.this.emojiButton.setTranslationX(f12);
ChatActivityEnterView.this.messageTextTranslationX = f12;
ChatActivityEnterView.this.updateMessageTextParams();
ChatActivityEnterView.this.requestLayout();
}
});
duration.start();
SenderSelectView senderSelectView7 = this.senderSelectView;
if (senderSelectView7 != null) {
senderSelectView7.setTag(duration);
return;
}
return;
}
if (z) {
createSenderSelectView();
}
SenderSelectView senderSelectView8 = this.senderSelectView;
if (senderSelectView8 != null) {
senderSelectView8.setVisibility(z ? 0 : 8);
this.senderSelectView.setTranslationX(f2);
}
float f12 = z ? f2 : 0.0f;
this.emojiButton.setTranslationX(f12);
this.messageTextTranslationX = f12;
updateMessageTextParams();
SenderSelectView senderSelectView9 = this.senderSelectView;
if (senderSelectView9 != null) {
senderSelectView9.setAlpha(f4);
this.senderSelectView.setTag(null);
}
}
}
public void lambda$updateSendAsButton$69(float f, float f2, float f3, float f4, ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
float f5 = f + ((f2 - f) * floatValue);
SenderSelectView senderSelectView = this.senderSelectView;
if (senderSelectView != null) {
senderSelectView.setAlpha(f3 + ((f4 - f3) * floatValue));
this.senderSelectView.setTranslationX(f5);
}
this.emojiButton.setTranslationX(f5);
this.messageTextTranslationX = f5;
updateMessageTextParams();
}
public boolean onBotWebViewBackPressed() {
BotWebViewMenuContainer botWebViewMenuContainer = this.botWebViewMenuContainer;
return botWebViewMenuContainer != null && botWebViewMenuContainer.onBackPressed();
}
public boolean hasBotWebView() {
return this.botMenuButtonType == BotMenuButtonType.WEB_VIEW;
}
public final void updateBotButton(boolean animated) {
ImageView imageView;
ImageView imageView2;
if (this.isChat) {
ChatActivity chatActivity = this.parentFragment;
if (chatActivity != null && !chatActivity.openAnimationEnded) {
animated = false;
}
boolean hasBotWebView = hasBotWebView();
boolean z = this.botMenuButtonType != BotMenuButtonType.NO_BUTTON && this.dialog_id > 0;
ImageView imageView3 = this.botButton;
boolean z2 = imageView3 != null && imageView3.getVisibility() == 0;
if (hasBotWebView || this.hasBotCommands || this.hasQuickReplies || this.botReplyMarkup != null) {
int i = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0).getInt("chatEditTextIconsColor", -5395027);
if (this.botReplyMarkup != null) {
if (isPopupShowing() && this.currentPopupContentType == 1 && this.botReplyMarkup.is_persistent) {
ImageView imageView4 = this.botButton;
if (imageView4 != null && imageView4.getVisibility() != 8) {
this.botButton.setVisibility(8);
}
} else {
createBotButton();
if (this.botButton.getVisibility() != 0) {
this.botButton.setVisibility(0);
}
this.botButtonDrawable.setIcon(R.drawable.input_bot2, true);
this.botButton.setContentDescription(LocaleController.getString("AccDescrBotKeyboard", R.string.AccDescrBotKeyboard));
}
} else if (!z && !PlusSettings.hideSlashBotButton) {
createBotButton();
this.botButtonDrawable.setIcon(R.drawable.input_bot1, true);
this.botButton.setContentDescription(LocaleController.getString("AccDescrBotCommands", R.string.AccDescrBotCommands));
this.botButton.setVisibility(0);
} else {
ImageView imageView5 = this.botButton;
if (imageView5 != null) {
imageView5.setVisibility(8);
}
}
if (z2 && Theme.usePlusTheme) {
this.botButton.setColorFilter(i, PorterDuff.Mode.SRC_IN);
}
} else {
ImageView imageView6 = this.botButton;
if (imageView6 != null) {
imageView6.setVisibility(8);
}
}
if (z) {
createBotCommandsMenuButton();
}
ImageView imageView7 = this.botButton;
boolean z3 = (imageView7 != null && imageView7.getVisibility() == 0) != z2;
BotCommandsMenuView botCommandsMenuView = this.botCommandsMenuButton;
if (botCommandsMenuView != null) {
boolean z4 = botCommandsMenuView.isWebView;
botCommandsMenuView.setWebView(this.botMenuButtonType == BotMenuButtonType.WEB_VIEW);
boolean menuText = this.botCommandsMenuButton.setMenuText(this.botMenuButtonType == BotMenuButtonType.COMMANDS ? LocaleController.getString(R.string.BotsMenuTitle) : this.botMenuWebViewTitle);
AndroidUtilities.updateViewVisibilityAnimated(this.botCommandsMenuButton, z, 0.5f, animated);
z3 = z3 || menuText || z4 != this.botCommandsMenuButton.isWebView;
}
if (z3 && animated) {
beginDelayedTransition();
ImageView imageView8 = this.botButton;
boolean z5 = imageView8 != null && imageView8.getVisibility() == 0;
if (z5 != z2 && (imageView2 = this.botButton) != null) {
imageView2.setVisibility(0);
if (z5) {
this.botButton.setAlpha(0.0f);
this.botButton.setScaleX(0.1f);
this.botButton.setScaleY(0.1f);
} else if (!z5) {
this.botButton.setAlpha(1.0f);
this.botButton.setScaleX(1.0f);
this.botButton.setScaleY(1.0f);
}
AndroidUtilities.updateViewVisibilityAnimated(this.botButton, z5, 0.1f, true);
}
}
updateFieldRight(2);
LinearLayout linearLayout = this.attachLayout;
ImageView imageView9 = this.botButton;
linearLayout.setPivotX(AndroidUtilities.dp(((imageView9 == null || imageView9.getVisibility() == 8) && ((imageView = this.notifyButton) == null || imageView.getVisibility() == 8)) ? 48.0f : 96.0f));
}
}
public void updateBotWebView(boolean animated) {
if (this.botMenuButtonType != BotMenuButtonType.NO_BUTTON && this.dialog_id > 0) {
createBotCommandsMenuButton();
}
BotCommandsMenuView botCommandsMenuView = this.botCommandsMenuButton;
if (botCommandsMenuView != null) {
botCommandsMenuView.setWebView(hasBotWebView());
}
updateBotButton(animated);
}
public void setBotsCount(int count, boolean hasCommands, boolean hasQuickReplies, boolean animated) {
this.botCount = count;
if (this.hasBotCommands == hasCommands && this.hasQuickReplies == hasQuickReplies) {
return;
}
this.hasBotCommands = hasCommands;
this.hasQuickReplies = hasQuickReplies;
updateBotButton(animated);
}
public void setButtons(MessageObject messageObject) {
setButtons(messageObject, true);
}
public void setButtons(org.telegram.messenger.MessageObject r6, boolean r7) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.Components.ChatActivityEnterView.setButtons(org.telegram.messenger.MessageObject, boolean):void");
}
public void lambda$setButtons$70(TLRPC.KeyboardButton keyboardButton) {
ChatActivity chatActivity;
boolean z = this.replyingMessageObject != null && (chatActivity = this.parentFragment) != null && chatActivity.isTopic && chatActivity.getTopicId() == ((long) this.replyingMessageObject.getId());
MessageObject messageObject = this.replyingMessageObject;
if (messageObject == null || z) {
messageObject = DialogObject.isChatDialog(this.dialog_id) ? this.botButtonsMessageObject : null;
}
MessageObject messageObject2 = this.replyingMessageObject;
if (messageObject2 == null || z) {
messageObject2 = this.botButtonsMessageObject;
}
boolean didPressedBotButton = didPressedBotButton(keyboardButton, messageObject, messageObject2);
if (this.replyingMessageObject != null && !z) {
openKeyboardInternal();
setButtons(this.botMessageObject, false);
} else {
MessageObject messageObject3 = this.botButtonsMessageObject;
if (messageObject3 != null && messageObject3.messageOwner.reply_markup.single_use) {
if (didPressedBotButton) {
openKeyboardInternal();
} else {
showPopup(0, 0);
}
MessagesController.getMainSettings(this.currentAccount).edit().putInt("answered_" + getTopicKeyString(), this.botButtonsMessageObject.getId()).commit();
}
}
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
chatActivityEnterViewDelegate.onMessageSend(null, true, 0);
}
}
public boolean didPressedBotButton(final TLRPC.KeyboardButton button, final MessageObject replyMessageObject, final MessageObject messageObject) {
return didPressedBotButton(button, replyMessageObject, messageObject, null);
}
public boolean didPressedBotButton(final TLRPC.KeyboardButton keyboardButton, final MessageObject messageObject, final MessageObject messageObject2, Browser.Progress progress) {
int i;
if (keyboardButton == null || messageObject2 == null) {
return false;
}
ChatActivity chatActivity = this.parentFragment;
if (chatActivity != null && chatActivity.getChatMode() == 5) {
return false;
}
if (keyboardButton instanceof TLRPC.TL_keyboardButton) {
SendMessagesHelper$SendMessageParams of = SendMessagesHelper$SendMessageParams.of(keyboardButton.text, this.dialog_id, messageObject, getThreadMessage(), null, false, null, null, null, true, 0, null, false);
ChatActivity chatActivity2 = this.parentFragment;
of.quick_reply_shortcut = chatActivity2 != null ? chatActivity2.quickReplyShortcut : null;
of.quick_reply_shortcut_id = chatActivity2 != null ? chatActivity2.getQuickReplyId() : 0;
MessageSendPreview messageSendPreview = this.messageSendPreview;
of.effect_id = messageSendPreview != null ? messageSendPreview.getSelectedEffect() : 0L;
SendMessagesHelper.getInstance(this.currentAccount).sendMessage(of);
} else if (keyboardButton instanceof TLRPC.TL_keyboardButtonUrl) {
if (Browser.urlMustNotHaveConfirmation(keyboardButton.url)) {
Browser.openUrl(this.parentActivity, Uri.parse(keyboardButton.url), true, true, progress);
} else {
AlertsCreator.showOpenUrlAlert(this.parentFragment, keyboardButton.url, false, true, true, progress, this.resourcesProvider);
}
} else if (keyboardButton instanceof TLRPC.TL_keyboardButtonRequestPhone) {
this.parentFragment.shareMyContact(2, messageObject2);
} else {
if (keyboardButton instanceof TLRPC.TL_keyboardButtonRequestPoll) {
this.parentFragment.openPollCreate((keyboardButton.flags & 1) != 0 ? Boolean.valueOf(keyboardButton.quiz) : null);
return false;
}
if ((keyboardButton instanceof TLRPC.TL_keyboardButtonWebView) || (keyboardButton instanceof TLRPC.TL_keyboardButtonSimpleWebView)) {
TLRPC.Message message = messageObject2.messageOwner;
long j = message.via_bot_id;
if (j == 0) {
j = message.from_id.user_id;
}
final long j2 = j;
MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(j2));
final Runnable runnable = new Runnable() {
@Override
public void run() {
if (ChatActivityEnterView.this.sizeNotifierLayout.measureKeyboardHeight() > AndroidUtilities.dp(20.0f)) {
AndroidUtilities.hideKeyboard(ChatActivityEnterView.this);
AndroidUtilities.runOnUIThread(this, 150L);
return;
}
BotWebViewSheet botWebViewSheet = new BotWebViewSheet(ChatActivityEnterView.this.getContext(), ChatActivityEnterView.this.resourcesProvider);
botWebViewSheet.setParentActivity(ChatActivityEnterView.this.parentActivity);
int i2 = ChatActivityEnterView.this.currentAccount;
long j3 = messageObject2.messageOwner.dialog_id;
long j4 = j2;
TLRPC.KeyboardButton keyboardButton2 = keyboardButton;
String str = keyboardButton2.text;
String str2 = keyboardButton2.url;
boolean z = keyboardButton2 instanceof TLRPC.TL_keyboardButtonSimpleWebView;
MessageObject messageObject3 = messageObject;
botWebViewSheet.requestWebView(i2, j3, j4, str, str2, z ? 1 : 0, messageObject3 != null ? messageObject3.messageOwner.id : 0, false);
if (ChatActivityEnterView.this.parentFragment != null) {
ChatActivityEnterView.this.parentFragment.showDialog(botWebViewSheet);
} else {
botWebViewSheet.show();
}
}
};
if (SharedPrefsHelper.isWebViewConfirmShown(this.currentAccount, j2)) {
runnable.run();
} else {
AlertsCreator.createBotLaunchAlert((BaseFragment) this.parentFragment, MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(this.dialog_id)), new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$didPressedBotButton$71(runnable, j2);
}
}, (Runnable) null);
}
} else if (keyboardButton instanceof TLRPC.TL_keyboardButtonRequestGeoLocation) {
AlertDialog.Builder builder = new AlertDialog.Builder(this.parentActivity);
builder.setTitle(LocaleController.getString("ShareYouLocationTitle", R.string.ShareYouLocationTitle));
builder.setMessage(LocaleController.getString("ShareYouLocationInfo", R.string.ShareYouLocationInfo));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
ChatActivityEnterView.this.lambda$didPressedBotButton$72(messageObject2, keyboardButton, dialogInterface, i2);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), (DialogInterface.OnClickListener) null);
this.parentFragment.showDialog(builder.create());
} else if ((keyboardButton instanceof TLRPC.TL_keyboardButtonCallback) || (keyboardButton instanceof TLRPC.TL_keyboardButtonGame) || (keyboardButton instanceof TLRPC.TL_keyboardButtonBuy) || (keyboardButton instanceof TLRPC.TL_keyboardButtonUrlAuth)) {
SendMessagesHelper.getInstance(this.currentAccount).sendCallback(true, messageObject2, keyboardButton, this.parentFragment);
} else if (keyboardButton instanceof TLRPC.TL_keyboardButtonSwitchInline) {
if (this.parentFragment.processSwitchButton((TLRPC.TL_keyboardButtonSwitchInline) keyboardButton)) {
return true;
}
if (keyboardButton.same_peer) {
TLRPC.Message message2 = messageObject2.messageOwner;
long j3 = message2.from_id.user_id;
long j4 = message2.via_bot_id;
if (j4 != 0) {
j3 = j4;
}
TLRPC.User user = this.accountInstance.getMessagesController().getUser(Long.valueOf(j3));
if (user == null) {
return true;
}
setFieldText("@" + UserObject.getPublicUsername(user) + " " + keyboardButton.query);
} else {
Bundle bundle = new Bundle();
bundle.putBoolean("onlySelect", true);
bundle.putInt("dialogsType", 1);
if ((keyboardButton.flags & 2) != 0) {
bundle.putBoolean("allowGroups", false);
bundle.putBoolean("allowMegagroups", false);
bundle.putBoolean("allowLegacyGroups", false);
bundle.putBoolean("allowUsers", false);
bundle.putBoolean("allowChannels", false);
bundle.putBoolean("allowBots", false);
Iterator<TLRPC.InlineQueryPeerType> it = keyboardButton.peer_types.iterator();
while (it.hasNext()) {
TLRPC.InlineQueryPeerType next = it.next();
if (next instanceof TLRPC.TL_inlineQueryPeerTypePM) {
bundle.putBoolean("allowUsers", true);
} else if (next instanceof TLRPC.TL_inlineQueryPeerTypeBotPM) {
bundle.putBoolean("allowBots", true);
} else if (next instanceof TLRPC.TL_inlineQueryPeerTypeBroadcast) {
bundle.putBoolean("allowChannels", true);
} else if (next instanceof TLRPC.TL_inlineQueryPeerTypeChat) {
bundle.putBoolean("allowLegacyGroups", true);
} else if (next instanceof TLRPC.TL_inlineQueryPeerTypeMegagroup) {
bundle.putBoolean("allowMegagroups", true);
}
}
}
DialogsActivity dialogsActivity = new DialogsActivity(bundle);
dialogsActivity.setDelegate(new DialogsActivity.DialogsActivityDelegate() {
public final boolean didSelectDialogs(DialogsActivity dialogsActivity2, ArrayList arrayList, CharSequence charSequence, boolean z, TopicsFragment topicsFragment) {
boolean lambda$didPressedBotButton$73;
lambda$didPressedBotButton$73 = ChatActivityEnterView.this.lambda$didPressedBotButton$73(messageObject2, keyboardButton, dialogsActivity2, arrayList, charSequence, z, topicsFragment);
return lambda$didPressedBotButton$73;
}
public boolean didSelectDialogs(DialogsActivity dialogsActivity2, ArrayList arrayList, CharSequence charSequence, boolean z, TopicsFragment topicsFragment, boolean z2) {
return DialogsActivity.DialogsActivityDelegate.-CC.$default$didSelectDialogs(this, dialogsActivity2, arrayList, charSequence, z, topicsFragment, z2);
}
});
this.parentFragment.presentFragment(dialogsActivity);
}
} else if (keyboardButton instanceof TLRPC.TL_keyboardButtonUserProfile) {
if (MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(keyboardButton.user_id)) != null) {
Bundle bundle2 = new Bundle();
bundle2.putLong("user_id", keyboardButton.user_id);
this.parentFragment.presentFragment(new ProfileActivity(bundle2));
}
} else if (keyboardButton instanceof TLRPC.TL_keyboardButtonRequestPeer) {
final TLRPC.TL_keyboardButtonRequestPeer tL_keyboardButtonRequestPeer = (TLRPC.TL_keyboardButtonRequestPeer) keyboardButton;
TLRPC.RequestPeerType requestPeerType = tL_keyboardButtonRequestPeer.peer_type;
if (requestPeerType != null && messageObject2.messageOwner != null) {
if ((requestPeerType instanceof TLRPC.TL_requestPeerTypeUser) && (i = tL_keyboardButtonRequestPeer.max_quantity) > 1) {
MultiContactsSelectorBottomSheet.open(i, new MultiContactsSelectorBottomSheet.SelectorListener() {
public final void onUserSelected(List list) {
ChatActivityEnterView.this.lambda$didPressedBotButton$74(messageObject2, tL_keyboardButtonRequestPeer, list);
}
});
return false;
}
Bundle bundle3 = new Bundle();
bundle3.putBoolean("onlySelect", true);
bundle3.putInt("dialogsType", 15);
TLRPC.Message message3 = messageObject2.messageOwner;
if (message3 != null) {
TLRPC.Peer peer = message3.from_id;
if (peer instanceof TLRPC.TL_peerUser) {
bundle3.putLong("requestPeerBotId", peer.user_id);
}
}
try {
SerializedData serializedData = new SerializedData(tL_keyboardButtonRequestPeer.peer_type.getObjectSize());
tL_keyboardButtonRequestPeer.peer_type.serializeToStream(serializedData);
bundle3.putByteArray("requestPeerType", serializedData.toByteArray());
serializedData.cleanup();
} catch (Exception e) {
FileLog.e(e);
}
DialogsActivity dialogsActivity2 = new DialogsActivity(bundle3);
dialogsActivity2.setDelegate(new DialogsActivity.DialogsActivityDelegate() {
public final boolean didSelectDialogs(DialogsActivity dialogsActivity3, ArrayList arrayList, CharSequence charSequence, boolean z, TopicsFragment topicsFragment) {
boolean lambda$didPressedBotButton$75;
lambda$didPressedBotButton$75 = ChatActivityEnterView.this.lambda$didPressedBotButton$75(messageObject2, tL_keyboardButtonRequestPeer, dialogsActivity3, arrayList, charSequence, z, topicsFragment);
return lambda$didPressedBotButton$75;
}
public boolean didSelectDialogs(DialogsActivity dialogsActivity3, ArrayList arrayList, CharSequence charSequence, boolean z, TopicsFragment topicsFragment, boolean z2) {
return DialogsActivity.DialogsActivityDelegate.-CC.$default$didSelectDialogs(this, dialogsActivity3, arrayList, charSequence, z, topicsFragment, z2);
}
});
this.parentFragment.presentFragment(dialogsActivity2);
return false;
}
FileLog.e("button.peer_type is null");
}
}
return true;
}
public void lambda$didPressedBotButton$71(Runnable runnable, long j) {
runnable.run();
SharedPrefsHelper.setWebViewConfirmShown(this.currentAccount, j, true);
}
public void lambda$didPressedBotButton$72(MessageObject messageObject, TLRPC.KeyboardButton keyboardButton, DialogInterface dialogInterface, int i) {
if (Build.VERSION.SDK_INT >= 23 && this.parentActivity.checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") != 0) {
this.parentActivity.requestPermissions(new String[]{"android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"}, 2);
this.pendingMessageObject = messageObject;
this.pendingLocationButton = keyboardButton;
return;
}
SendMessagesHelper.getInstance(this.currentAccount).sendCurrentLocation(messageObject, keyboardButton);
}
public boolean lambda$didPressedBotButton$73(MessageObject messageObject, TLRPC.KeyboardButton keyboardButton, DialogsActivity dialogsActivity, ArrayList arrayList, CharSequence charSequence, boolean z, TopicsFragment topicsFragment) {
TLRPC.Message message = messageObject.messageOwner;
long j = message.from_id.user_id;
long j2 = message.via_bot_id;
if (j2 != 0) {
j = j2;
}
TLRPC.User user = this.accountInstance.getMessagesController().getUser(Long.valueOf(j));
if (user == null) {
dialogsActivity.finishFragment();
return true;
}
long j3 = ((MessagesStorage.TopicKey) arrayList.get(0)).dialogId;
MediaDataController.getInstance(this.currentAccount).saveDraft(j3, 0, "@" + UserObject.getPublicUsername(user) + " " + keyboardButton.query, null, null, true);
if (j3 != this.dialog_id) {
if (!DialogObject.isEncryptedDialog(j3)) {
Bundle bundle = new Bundle();
if (DialogObject.isUserDialog(j3)) {
bundle.putLong("user_id", j3);
} else {
bundle.putLong("chat_id", -j3);
}
if (!this.accountInstance.getMessagesController().checkCanOpenChat(bundle, dialogsActivity)) {
return true;
}
if (this.parentFragment.presentFragment(new ChatActivity(bundle), true)) {
if (!AndroidUtilities.isTablet()) {
this.parentFragment.removeSelfFromStack();
}
} else {
dialogsActivity.finishFragment();
}
} else {
dialogsActivity.finishFragment();
}
} else {
dialogsActivity.finishFragment();
}
return true;
}
public void lambda$didPressedBotButton$74(MessageObject messageObject, TLRPC.TL_keyboardButtonRequestPeer tL_keyboardButtonRequestPeer, List list) {
if (list == null || list.isEmpty()) {
return;
}
TLRPC.TL_messages_sendBotRequestedPeer tL_messages_sendBotRequestedPeer = new TLRPC.TL_messages_sendBotRequestedPeer();
tL_messages_sendBotRequestedPeer.peer = MessagesController.getInstance(this.currentAccount).getInputPeer(messageObject.messageOwner.peer_id);
tL_messages_sendBotRequestedPeer.msg_id = messageObject.getId();
tL_messages_sendBotRequestedPeer.button_id = tL_keyboardButtonRequestPeer.button_id;
Iterator it = list.iterator();
while (it.hasNext()) {
tL_messages_sendBotRequestedPeer.requested_peers.add(MessagesController.getInstance(this.currentAccount).getInputPeer(((Long) it.next()).longValue()));
}
ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_messages_sendBotRequestedPeer, (RequestDelegate) null);
}
public boolean lambda$didPressedBotButton$75(MessageObject messageObject, TLRPC.TL_keyboardButtonRequestPeer tL_keyboardButtonRequestPeer, DialogsActivity dialogsActivity, ArrayList arrayList, CharSequence charSequence, boolean z, TopicsFragment topicsFragment) {
if (arrayList != null && !arrayList.isEmpty()) {
TLRPC.TL_messages_sendBotRequestedPeer tL_messages_sendBotRequestedPeer = new TLRPC.TL_messages_sendBotRequestedPeer();
tL_messages_sendBotRequestedPeer.peer = MessagesController.getInstance(this.currentAccount).getInputPeer(messageObject.messageOwner.peer_id);
tL_messages_sendBotRequestedPeer.msg_id = messageObject.getId();
tL_messages_sendBotRequestedPeer.button_id = tL_keyboardButtonRequestPeer.button_id;
tL_messages_sendBotRequestedPeer.requested_peers.add(MessagesController.getInstance(this.currentAccount).getInputPeer(((MessagesStorage.TopicKey) arrayList.get(0)).dialogId));
ConnectionsManager.getInstance(this.currentAccount).sendRequest(tL_messages_sendBotRequestedPeer, (RequestDelegate) null);
}
dialogsActivity.finishFragment();
return true;
}
public boolean isPopupView(View view) {
return view == this.botKeyboardView || view == this.emojiView;
}
public int getPopupViewHeight(View view) {
BotKeyboardView botKeyboardView = this.botKeyboardView;
if (view != botKeyboardView || botKeyboardView == null) {
return -1;
}
return botKeyboardView.getKeyboardHeight();
}
public boolean isRecordCircle(View view) {
return view == this.recordCircle;
}
public SizeNotifierFrameLayout getSizeNotifierLayout() {
return this.sizeNotifierLayout;
}
public final void createEmojiView() {
EmojiView emojiView = this.emojiView;
if (emojiView != null && emojiView.currentAccount != UserConfig.selectedAccount) {
this.sizeNotifierLayout.removeView(emojiView);
this.emojiView = null;
}
if (this.emojiView != null) {
return;
}
EmojiView emojiView2 = new EmojiView(this.parentFragment, this.allowAnimatedEmoji, true, true, getContext(), true, this.info, this.sizeNotifierLayout, this.shouldDrawBackground, this.resourcesProvider, this.emojiViewFrozen) {
@Override
public void setTranslationY(float translationY) {
super.setTranslationY(translationY);
if (ChatActivityEnterView.this.panelAnimation == null || ChatActivityEnterView.this.animatingContentType != 0) {
return;
}
ChatActivityEnterView.this.delegate.bottomPanelTranslationYChanged(translationY);
}
};
this.emojiView = emojiView2;
if (!this.shouldDrawBackground) {
emojiView2.updateColors();
}
this.emojiView.setAllow(this.allowStickers, this.allowGifs, true);
this.emojiView.setVisibility(8);
this.emojiView.setShowing(false);
this.emojiView.setDelegate(new AnonymousClass75());
this.emojiView.setDragListener(new EmojiView.DragListener() {
public int initialOffset;
public boolean wasExpanded;
@Override
public void onDragStart() {
if (allowDragging()) {
if (ChatActivityEnterView.this.stickersExpansionAnim != null) {
ChatActivityEnterView.this.stickersExpansionAnim.cancel();
}
ChatActivityEnterView.this.stickersDragging = true;
this.wasExpanded = ChatActivityEnterView.this.stickersExpanded;
ChatActivityEnterView.this.stickersExpanded = true;
NotificationCenter.getGlobalInstance().lambda$postNotificationNameOnUIThread$1(NotificationCenter.stopAllHeavyOperations, 1);
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
chatActivityEnterView.stickersExpandedHeight = (((chatActivityEnterView.sizeNotifierLayout.getHeight() - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0)) - ActionBar.getCurrentActionBarHeight()) - ChatActivityEnterView.this.getHeight()) + Theme.chat_composeShadowDrawable.getIntrinsicHeight();
if (ChatActivityEnterView.this.searchingType == 2) {
ChatActivityEnterView chatActivityEnterView2 = ChatActivityEnterView.this;
int i = chatActivityEnterView2.stickersExpandedHeight;
int dp = AndroidUtilities.dp(120.0f);
android.graphics.Point point = AndroidUtilities.displaySize;
chatActivityEnterView2.stickersExpandedHeight = Math.min(i, dp + (point.x > point.y ? ChatActivityEnterView.this.keyboardHeightLand : ChatActivityEnterView.this.keyboardHeight));
}
ChatActivityEnterView.this.emojiView.getLayoutParams().height = ChatActivityEnterView.this.stickersExpandedHeight;
ChatActivityEnterView.this.emojiView.setLayerType(2, null);
ChatActivityEnterView.this.sizeNotifierLayout.requestLayout();
ChatActivityEnterView chatActivityEnterView3 = ChatActivityEnterView.this;
if (chatActivityEnterView3.shouldDrawBackground) {
chatActivityEnterView3.sizeNotifierLayout.setForeground(ChatActivityEnterView.this.new ScrimDrawable());
}
this.initialOffset = (int) ChatActivityEnterView.this.getTranslationY();
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterView.this.delegate.onStickersExpandedChange();
}
}
}
@Override
public void onDragEnd(float velocity) {
if (allowDragging()) {
ChatActivityEnterView.this.stickersDragging = false;
if ((this.wasExpanded && velocity >= AndroidUtilities.dp(200.0f)) || ((!this.wasExpanded && velocity <= AndroidUtilities.dp(-200.0f)) || ((this.wasExpanded && ChatActivityEnterView.this.stickersExpansionProgress <= 0.6f) || (!this.wasExpanded && ChatActivityEnterView.this.stickersExpansionProgress >= 0.4f)))) {
ChatActivityEnterView.this.setStickersExpanded(!this.wasExpanded, true, true);
} else {
ChatActivityEnterView.this.setStickersExpanded(this.wasExpanded, true, true);
}
}
}
@Override
public void onDragCancel() {
if (ChatActivityEnterView.this.stickersTabOpen) {
ChatActivityEnterView.this.stickersDragging = false;
ChatActivityEnterView.this.setStickersExpanded(this.wasExpanded, true, false);
}
}
@Override
public void onDrag(int offset) {
if (allowDragging()) {
android.graphics.Point point = AndroidUtilities.displaySize;
float max = Math.max(Math.min(offset + this.initialOffset, 0), -(ChatActivityEnterView.this.stickersExpandedHeight - (point.x > point.y ? ChatActivityEnterView.this.keyboardHeightLand : ChatActivityEnterView.this.keyboardHeight)));
ChatActivityEnterView.this.emojiView.setTranslationY(max);
ChatActivityEnterView.this.setTranslationY(max);
ChatActivityEnterView.this.stickersExpansionProgress = max / (-(r1.stickersExpandedHeight - r0));
ChatActivityEnterView.this.sizeNotifierLayout.invalidate();
}
}
public final boolean allowDragging() {
EditTextCaption editTextCaption;
return ChatActivityEnterView.this.stickersTabOpen && (ChatActivityEnterView.this.stickersExpanded || (editTextCaption = ChatActivityEnterView.this.messageEditText) == null || editTextCaption.length() <= 0) && ChatActivityEnterView.this.emojiView.areThereAnyStickers() && !ChatActivityEnterView.this.waitingForKeyboardOpen;
}
});
EmojiView emojiView3 = this.emojiView;
if (emojiView3 != null) {
emojiView3.setStickersBanned(!this.sendPlainEnabled, !this.stickersEnabled, -this.dialog_id);
}
attachEmojiView();
checkChannelRights();
}
public class AnonymousClass75 implements EmojiView.EmojiViewDelegate {
public AnonymousClass75() {
}
@Override
public boolean isUserSelf() {
return ChatActivityEnterView.this.dialog_id == UserConfig.getInstance(ChatActivityEnterView.this.currentAccount).getClientUserId();
}
@Override
public boolean onBackspace() {
EditTextCaption editTextCaption = ChatActivityEnterView.this.messageEditText;
if (editTextCaption == null || editTextCaption.length() == 0) {
return false;
}
ChatActivityEnterView.this.messageEditText.dispatchKeyEvent(new KeyEvent(0, 67));
return true;
}
@Override
public void onEmojiSelected(String symbol) {
EditTextCaption editTextCaption = ChatActivityEnterView.this.messageEditText;
if (editTextCaption == null) {
return;
}
int selectionEnd = editTextCaption.getSelectionEnd();
if (selectionEnd < 0) {
selectionEnd = 0;
}
try {
try {
ChatActivityEnterView.this.innerTextChange = 2;
CharSequence replaceEmoji = Emoji.replaceEmoji((CharSequence) symbol, ChatActivityEnterView.this.messageEditText.getPaint().getFontMetricsInt(), false, (int[]) null);
EditTextCaption editTextCaption2 = ChatActivityEnterView.this.messageEditText;
editTextCaption2.setText(editTextCaption2.getText().insert(selectionEnd, replaceEmoji));
int length = selectionEnd + replaceEmoji.length();
ChatActivityEnterView.this.messageEditText.setSelection(length, length);
} catch (Exception e) {
FileLog.e(e);
}
} finally {
ChatActivityEnterView.this.innerTextChange = 0;
}
}
@Override
public void onCustomEmojiSelected(final long documentId, final TLRPC.Document document, final String emoticon, final boolean isRecent) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.AnonymousClass75.this.lambda$onCustomEmojiSelected$0(emoticon, document, documentId, isRecent);
}
});
}
public void lambda$onCustomEmojiSelected$0(String str, TLRPC.Document document, long j, boolean z) {
AnimatedEmojiSpan animatedEmojiSpan;
EditTextCaption editTextCaption = ChatActivityEnterView.this.messageEditText;
if (editTextCaption == null) {
return;
}
int selectionEnd = editTextCaption.getSelectionEnd();
if (selectionEnd < 0) {
selectionEnd = 0;
}
try {
try {
ChatActivityEnterView.this.innerTextChange = 2;
if (str == null) {
str = "😀";
}
SpannableString spannableString = new SpannableString(str);
if (document != null) {
animatedEmojiSpan = new AnimatedEmojiSpan(document, ChatActivityEnterView.this.messageEditText.getPaint().getFontMetricsInt());
} else {
animatedEmojiSpan = new AnimatedEmojiSpan(j, ChatActivityEnterView.this.messageEditText.getPaint().getFontMetricsInt());
}
if (!z) {
animatedEmojiSpan.fromEmojiKeyboard = true;
}
animatedEmojiSpan.cacheType = AnimatedEmojiDrawable.getCacheTypeForEnterView();
spannableString.setSpan(animatedEmojiSpan, 0, spannableString.length(), 33);
EditTextCaption editTextCaption2 = ChatActivityEnterView.this.messageEditText;
editTextCaption2.setText(editTextCaption2.getText().insert(selectionEnd, spannableString));
ChatActivityEnterView.this.messageEditText.setSelection(spannableString.length() + selectionEnd, selectionEnd + spannableString.length());
} catch (Exception e) {
FileLog.e(e);
}
} finally {
ChatActivityEnterView.this.innerTextChange = 0;
}
}
@Override
public void onAnimatedEmojiUnlockClick() {
BaseFragment baseFragment = ChatActivityEnterView.this.parentFragment;
if (baseFragment == null) {
baseFragment = LaunchActivity.getLastFragment();
}
PremiumFeatureBottomSheet premiumFeatureBottomSheet = new PremiumFeatureBottomSheet(baseFragment, 11, false);
if (baseFragment != null) {
baseFragment.showDialog(premiumFeatureBottomSheet);
} else {
premiumFeatureBottomSheet.show();
}
}
@Override
public void onStickerSelected(View view, TLRPC.Document sticker, String query, Object parent, MessageObject.SendAnimationData sendAnimationData, boolean notify, int scheduleDate) {
if (ChatActivityEnterView.this.trendingStickersAlert != null) {
ChatActivityEnterView.this.trendingStickersAlert.dismiss();
ChatActivityEnterView.this.trendingStickersAlert = null;
}
if (ChatActivityEnterView.this.slowModeTimer > 0 && !isInScheduleMode()) {
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterView.this.delegate.onUpdateSlowModeButton(view != null ? view : ChatActivityEnterView.this.slowModeButton, true, ChatActivityEnterView.this.slowModeButton.getText());
return;
}
return;
}
if (ChatActivityEnterView.this.stickersExpanded) {
if (ChatActivityEnterView.this.searchingType != 0) {
ChatActivityEnterView.this.setSearchingTypeInternal(0, true);
ChatActivityEnterView.this.emojiView.closeSearch(true, MessageObject.getStickerSetId(sticker));
ChatActivityEnterView.this.emojiView.hideSearchKeyboard();
}
ChatActivityEnterView.this.setStickersExpanded(false, true, false);
}
ChatActivityEnterView.this.lambda$onStickerSelected$76(sticker, query, parent, sendAnimationData, false, notify, scheduleDate);
if (DialogObject.isEncryptedDialog(ChatActivityEnterView.this.dialog_id) && MessageObject.isGifDocument(sticker)) {
ChatActivityEnterView.this.accountInstance.getMessagesController().saveGif(parent, sticker);
}
}
@Override
public void onStickersSettingsClick() {
if (ChatActivityEnterView.this.parentFragment != null) {
ChatActivityEnterView.this.parentFragment.presentFragment(new StickersActivity(0, (ArrayList) null));
}
}
@Override
public void onEmojiSettingsClick(ArrayList<TLRPC.TL_messages_stickerSet> frozenEmojiPacks) {
if (ChatActivityEnterView.this.parentFragment != null) {
ChatActivityEnterView.this.parentFragment.presentFragment(new StickersActivity(5, frozenEmojiPacks));
}
}
@Override
public void lambda$onGifSelected$1(final View view, final Object gif, final String query, final Object parent, final boolean notify, final int scheduleDate) {
if (ChatActivityEnterView.this.replyingQuote != null && ChatActivityEnterView.this.parentFragment != null && ChatActivityEnterView.this.replyingQuote.outdated) {
ChatActivityEnterView.this.parentFragment.showQuoteMessageUpdate();
return;
}
if (isInScheduleMode() && scheduleDate == 0) {
AlertsCreator.createScheduleDatePickerDialog(ChatActivityEnterView.this.parentActivity, ChatActivityEnterView.this.parentFragment.getDialogId(), new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public final void didSelectDate(boolean z, int i) {
ChatActivityEnterView.AnonymousClass75.this.lambda$onGifSelected$1(view, gif, query, parent, z, i);
}
}, ChatActivityEnterView.this.resourcesProvider);
return;
}
if (ChatActivityEnterView.this.slowModeTimer > 0 && !isInScheduleMode()) {
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = ChatActivityEnterView.this.delegate;
if (view == null) {
view = ChatActivityEnterView.this.slowModeButton;
}
chatActivityEnterViewDelegate.onUpdateSlowModeButton(view, true, ChatActivityEnterView.this.slowModeButton.getText());
return;
}
return;
}
Runnable runnable = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.AnonymousClass75.this.lambda$onGifSelected$3(view, gif, query, parent, notify, scheduleDate);
}
};
if (ChatActivityEnterView.this.showConfirmAlert(runnable)) {
return;
}
runnable.run();
}
public void lambda$onGifSelected$3(final View view, final Object obj, final String str, final Object obj2, final boolean z, final int i) {
CharSequence charSequence;
if (PlusSettings.confirmBeforeSending && ChatActivityEnterView.this.parentFragment != null && ChatActivityEnterView.this.parentActivity != null) {
AlertDialog.Builder builder = new AlertDialog.Builder(ChatActivityEnterView.this.parentActivity);
builder.setTitle(LocaleController.getString("SendingGif", R.string.SendingGif));
builder.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
ChatActivityEnterView.AnonymousClass75.this.lambda$onGifSelected$2(view, obj, str, obj2, z, i, dialogInterface, i2);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), (DialogInterface.OnClickListener) null);
ChatActivityEnterView.this.parentFragment.showDialog(builder.create());
return;
}
if (ChatActivityEnterView.this.stickersExpanded) {
if (ChatActivityEnterView.this.searchingType != 0) {
ChatActivityEnterView.this.emojiView.hideSearchKeyboard();
}
ChatActivityEnterView.this.setStickersExpanded(false, true, false);
}
TL_stories$StoryItem replyToStory = ChatActivityEnterView.this.delegate != null ? ChatActivityEnterView.this.delegate.getReplyToStory() : null;
if (obj instanceof TLRPC.Document) {
TLRPC.Document document = (TLRPC.Document) obj;
charSequence = null;
SendMessagesHelper.getInstance(ChatActivityEnterView.this.currentAccount).sendSticker(document, str, ChatActivityEnterView.this.dialog_id, ChatActivityEnterView.this.replyingMessageObject, ChatActivityEnterView.this.getThreadMessage(), replyToStory, ChatActivityEnterView.this.replyingQuote, (MessageObject.SendAnimationData) null, z, i, false, obj2, ChatActivityEnterView.this.parentFragment != null ? ChatActivityEnterView.this.parentFragment.quickReplyShortcut : null, ChatActivityEnterView.this.parentFragment != null ? ChatActivityEnterView.this.parentFragment.getQuickReplyId() : 0);
MediaDataController.getInstance(ChatActivityEnterView.this.currentAccount).addRecentGif(document, (int) (System.currentTimeMillis() / 1000), true);
if (DialogObject.isEncryptedDialog(ChatActivityEnterView.this.dialog_id)) {
ChatActivityEnterView.this.accountInstance.getMessagesController().saveGif(obj2, document);
}
} else {
charSequence = null;
if (obj instanceof TLRPC.BotInlineResult) {
TLRPC.BotInlineResult botInlineResult = (TLRPC.BotInlineResult) obj;
if (botInlineResult.document != null) {
MediaDataController.getInstance(ChatActivityEnterView.this.currentAccount).addRecentGif(botInlineResult.document, (int) (System.currentTimeMillis() / 1000), false);
if (DialogObject.isEncryptedDialog(ChatActivityEnterView.this.dialog_id)) {
ChatActivityEnterView.this.accountInstance.getMessagesController().saveGif(obj2, botInlineResult.document);
}
}
HashMap hashMap = new HashMap();
hashMap.put("id", botInlineResult.id);
hashMap.put("query_id", BuildConfig.APP_CENTER_HASH + botInlineResult.query_id);
hashMap.put("force_gif", "1");
if (replyToStory == null) {
SendMessagesHelper.prepareSendingBotContextResult(ChatActivityEnterView.this.parentFragment, ChatActivityEnterView.this.accountInstance, botInlineResult, hashMap, ChatActivityEnterView.this.dialog_id, ChatActivityEnterView.this.replyingMessageObject, ChatActivityEnterView.this.getThreadMessage(), (TL_stories$StoryItem) null, ChatActivityEnterView.this.replyingQuote, z, i, ChatActivityEnterView.this.parentFragment != null ? ChatActivityEnterView.this.parentFragment.quickReplyShortcut : null, ChatActivityEnterView.this.parentFragment != null ? ChatActivityEnterView.this.parentFragment.getQuickReplyId() : 0);
} else {
SendMessagesHelper.getInstance(ChatActivityEnterView.this.currentAccount).sendSticker(botInlineResult.document, str, ChatActivityEnterView.this.dialog_id, ChatActivityEnterView.this.replyingMessageObject, ChatActivityEnterView.this.getThreadMessage(), replyToStory, ChatActivityEnterView.this.replyingQuote, (MessageObject.SendAnimationData) null, z, i, false, obj2, ChatActivityEnterView.this.parentFragment != null ? ChatActivityEnterView.this.parentFragment.quickReplyShortcut : null, ChatActivityEnterView.this.parentFragment != null ? ChatActivityEnterView.this.parentFragment.getQuickReplyId() : 0);
}
if (ChatActivityEnterView.this.searchingType != 0) {
ChatActivityEnterView.this.setSearchingTypeInternal(0, true);
ChatActivityEnterView.this.emojiView.closeSearch(true);
ChatActivityEnterView.this.emojiView.hideSearchKeyboard();
}
}
}
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterView.this.delegate.onMessageSend(charSequence, z, i);
}
}
public void lambda$onGifSelected$2(View view, Object obj, String str, Object obj2, boolean z, int i, DialogInterface dialogInterface, int i2) {
PlusSettings.confirmBeforeSending = false;
lambda$onGifSelected$1(view, obj, str, obj2, z, i);
PlusSettings.confirmBeforeSending = true;
}
@Override
public void onTabOpened(int type) {
ChatActivityEnterView.this.delegate.onStickersTab(type == 3);
?? r3 = ChatActivityEnterView.this;
r3.post(r3.updateExpandabilityRunnable);
}
@Override
public void onClearEmojiRecent() {
if (ChatActivityEnterView.this.parentFragment == null || ChatActivityEnterView.this.parentActivity == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(ChatActivityEnterView.this.parentActivity, ChatActivityEnterView.this.resourcesProvider);
builder.setTitle(LocaleController.getString(R.string.ClearRecentEmojiTitle));
builder.setMessage(LocaleController.getString(R.string.ClearRecentEmojiText));
builder.setPositiveButton(LocaleController.getString(R.string.ClearForAll), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ChatActivityEnterView.AnonymousClass75.this.lambda$onClearEmojiRecent$4(dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString(R.string.Cancel), (DialogInterface.OnClickListener) null);
ChatActivityEnterView.this.parentFragment.showDialog(builder.create());
}
public void lambda$onClearEmojiRecent$4(DialogInterface dialogInterface, int i) {
ChatActivityEnterView.this.emojiView.clearRecentEmoji();
}
@Override
public void onShowStickerSet(TLRPC.StickerSet stickerSet, TLRPC.InputStickerSet inputStickerSet, boolean edit) {
if (ChatActivityEnterView.this.trendingStickersAlert != null && !ChatActivityEnterView.this.trendingStickersAlert.isDismissed()) {
ChatActivityEnterView.this.trendingStickersAlert.getLayout().showStickerSet(stickerSet, inputStickerSet);
return;
}
BaseFragment baseFragment = ChatActivityEnterView.this.parentFragment;
if (baseFragment == null) {
baseFragment = LaunchActivity.getLastFragment();
}
if (baseFragment == null || ChatActivityEnterView.this.parentActivity == null) {
return;
}
if (stickerSet != null) {
inputStickerSet = new TLRPC.TL_inputStickerSetID();
inputStickerSet.access_hash = stickerSet.access_hash;
inputStickerSet.id = stickerSet.id;
}
Activity activity = ChatActivityEnterView.this.parentActivity;
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
BaseFragment baseFragment2 = baseFragment;
?? stickersAlert = new StickersAlert(activity, baseFragment2, inputStickerSet, null, chatActivityEnterView, chatActivityEnterView.resourcesProvider);
baseFragment.showDialog((Dialog) stickersAlert);
if (edit) {
stickersAlert.enableEditMode();
}
}
@Override
public void onStickerSetAdd(TLRPC.StickerSetCovered stickerSet) {
MediaDataController.getInstance(ChatActivityEnterView.this.currentAccount).toggleStickerSet(ChatActivityEnterView.this.parentActivity, stickerSet, 2, ChatActivityEnterView.this.parentFragment, false, false);
}
@Override
public void onStickerSetRemove(TLRPC.StickerSetCovered stickerSet) {
MediaDataController.getInstance(ChatActivityEnterView.this.currentAccount).toggleStickerSet(ChatActivityEnterView.this.parentActivity, stickerSet, 0, ChatActivityEnterView.this.parentFragment, false, false);
}
@Override
public void onStickersGroupClick(long chatId) {
if (ChatActivityEnterView.this.parentFragment != null) {
if (AndroidUtilities.isTablet()) {
ChatActivityEnterView.this.hidePopup(false);
}
GroupStickersActivity groupStickersActivity = new GroupStickersActivity(chatId);
groupStickersActivity.setInfo(ChatActivityEnterView.this.info);
ChatActivityEnterView.this.parentFragment.presentFragment(groupStickersActivity);
}
}
@Override
public void onSearchOpenClose(int type) {
ChatActivityEnterView.this.setSearchingTypeInternal(type, true);
if (type != 0) {
ChatActivityEnterView.this.setStickersExpanded(true, true, false, type == 1);
}
if (ChatActivityEnterView.this.emojiTabOpen && ChatActivityEnterView.this.searchingType == 2) {
ChatActivityEnterView.this.checkStickresExpandHeight();
}
}
@Override
public boolean isSearchOpened() {
return ChatActivityEnterView.this.searchingType != 0;
}
@Override
public boolean isExpanded() {
return ChatActivityEnterView.this.stickersExpanded;
}
@Override
public boolean canSchedule() {
return ChatActivityEnterView.this.parentFragment != null && ChatActivityEnterView.this.parentFragment.canScheduleMessage();
}
@Override
public boolean isInScheduleMode() {
return ChatActivityEnterView.this.parentFragment != null && ChatActivityEnterView.this.parentFragment.isInScheduleMode();
}
@Override
public long getDialogId() {
return ChatActivityEnterView.this.dialog_id;
}
@Override
public int getThreadId() {
return ChatActivityEnterView.this.getThreadMessageId();
}
@Override
public void showTrendingStickersAlert(TrendingStickersLayout layout) {
BaseFragment baseFragment = ChatActivityEnterView.this.parentFragment;
if (baseFragment == null) {
baseFragment = LaunchActivity.getLastFragment();
}
if (baseFragment != null) {
ChatActivityEnterView.this.trendingStickersAlert = new TrendingStickersAlert(ChatActivityEnterView.this.getContext(), baseFragment, layout, ChatActivityEnterView.this.resourcesProvider) {
@Override
public void dismiss() {
super.dismiss();
if (ChatActivityEnterView.this.trendingStickersAlert == this) {
ChatActivityEnterView.this.trendingStickersAlert = null;
}
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterView.this.delegate.onTrendingStickersShowed(false);
}
}
};
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterView.this.delegate.onTrendingStickersShowed(true);
}
baseFragment.showDialog(ChatActivityEnterView.this.trendingStickersAlert);
}
}
@Override
public void invalidateEnterView() {
ChatActivityEnterView.this.invalidate();
}
@Override
public float getProgressToSearchOpened() {
return ChatActivityEnterView.this.searchToOpenProgress;
}
}
@Override
public void lambda$onStickerSelected$76(final TLRPC.Document sticker, final String query, final Object parent, final MessageObject.SendAnimationData sendAnimationData, final boolean clearsInputField, final boolean notify, final int scheduleDate) {
ChatActivity chatActivity;
ChatActivity.ReplyQuote replyQuote = this.replyingQuote;
if (replyQuote != null && (chatActivity = this.parentFragment) != null && replyQuote.outdated) {
chatActivity.showQuoteMessageUpdate();
return;
}
if (isInScheduleMode() && scheduleDate == 0) {
AlertsCreator.createScheduleDatePickerDialog(this.parentActivity, this.parentFragment.getDialogId(), new AlertsCreator.ScheduleDatePickerDelegate() {
@Override
public final void didSelectDate(boolean z, int i) {
ChatActivityEnterView.this.lambda$onStickerSelected$76(sticker, query, parent, sendAnimationData, clearsInputField, z, i);
}
}, this.resourcesProvider);
return;
}
Runnable runnable = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$onStickerSelected$78(sticker, query, parent, sendAnimationData, clearsInputField, notify, scheduleDate);
}
};
if (showConfirmAlert(runnable)) {
return;
}
runnable.run();
}
public void lambda$onStickerSelected$78(final TLRPC.Document document, final String str, final Object obj, final MessageObject.SendAnimationData sendAnimationData, final boolean z, final boolean z2, final int i) {
Activity activity;
if (this.slowModeTimer > 0 && !isInScheduleMode()) {
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
SlowModeBtn slowModeBtn = this.slowModeButton;
chatActivityEnterViewDelegate.onUpdateSlowModeButton(slowModeBtn, true, slowModeBtn.getText());
return;
}
return;
}
if (PlusSettings.confirmBeforeSending && this.parentFragment != null && (activity = this.parentActivity) != null) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(LocaleController.getString("SendSticker", R.string.SendSticker));
builder.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
ChatActivityEnterView.this.lambda$onStickerSelected$77(document, str, obj, sendAnimationData, z, z2, i, dialogInterface, i2);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), (DialogInterface.OnClickListener) null);
this.parentFragment.showDialog(builder.create());
return;
}
if (this.searchingType != 0) {
setSearchingTypeInternal(0, true);
this.emojiView.closeSearch(true);
this.emojiView.hideSearchKeyboard();
}
setStickersExpanded(false, true, false);
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate2 = this.delegate;
TL_stories$StoryItem replyToStory = chatActivityEnterViewDelegate2 != null ? chatActivityEnterViewDelegate2.getReplyToStory() : null;
SendMessagesHelper sendMessagesHelper = SendMessagesHelper.getInstance(this.currentAccount);
long j = this.dialog_id;
MessageObject messageObject = this.replyingMessageObject;
MessageObject threadMessage = getThreadMessage();
ChatActivity.ReplyQuote replyQuote = this.replyingQuote;
boolean z3 = obj instanceof TLRPC.TL_messages_stickerSet;
ChatActivity chatActivity = this.parentFragment;
sendMessagesHelper.sendSticker(document, str, j, messageObject, threadMessage, replyToStory, replyQuote, sendAnimationData, z2, i, z3, obj, chatActivity != null ? chatActivity.quickReplyShortcut : null, chatActivity != null ? chatActivity.getQuickReplyId() : 0);
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate3 = this.delegate;
if (chatActivityEnterViewDelegate3 != null) {
chatActivityEnterViewDelegate3.onMessageSend(null, true, i);
}
if (z) {
setFieldText(BuildConfig.APP_CENTER_HASH);
}
MediaDataController.getInstance(this.currentAccount).addRecentSticker(0, obj, document, (int) (System.currentTimeMillis() / 1000), false);
}
public void lambda$onStickerSelected$77(TLRPC.Document document, String str, Object obj, MessageObject.SendAnimationData sendAnimationData, boolean z, boolean z2, int i, DialogInterface dialogInterface, int i2) {
PlusSettings.confirmBeforeSending = false;
lambda$onStickerSelected$76(document, str, obj, sendAnimationData, z, z2, i);
PlusSettings.confirmBeforeSending = true;
}
@Override
public boolean canSchedule() {
ChatActivity chatActivity = this.parentFragment;
return chatActivity != null && chatActivity.canScheduleMessage();
}
@Override
public boolean isInScheduleMode() {
ChatActivity chatActivity = this.parentFragment;
return chatActivity != null && chatActivity.isInScheduleMode();
}
public final boolean isEditingBusinessLink() {
return this.editingBusinessLink != null;
}
public void addStickerToRecent(TLRPC.Document sticker) {
createEmojiView();
this.emojiView.addRecentSticker(sticker);
}
public void showEmojiView() {
showPopup(1, 0);
}
public final void showPopup(int show, int contentType) {
showPopup(show, contentType, true);
}
public final void showPopup(final int show, int contentType, boolean allowAnimation) {
boolean z;
int i;
int i2;
int i3;
if (show == 2) {
return;
}
EmojiView emojiView = null;
if (show == 1) {
if (contentType == 0) {
if (this.parentActivity == null && this.emojiView == null) {
return;
} else {
createEmojiView();
}
}
if (contentType == 0) {
attachEmojiView();
if (this.emojiViewVisible) {
this.emojiView.getVisibility();
}
this.emojiView.setVisibility(0);
this.emojiViewVisible = true;
BotKeyboardView botKeyboardView = this.botKeyboardView;
if (botKeyboardView == null || botKeyboardView.getVisibility() == 8) {
i2 = 0;
} else {
this.botKeyboardView.setVisibility(8);
this.botKeyboardViewVisible = false;
i2 = this.botKeyboardView.getMeasuredHeight();
}
this.emojiView.setShowing(true);
emojiView = this.emojiView;
this.animatingContentType = 0;
} else if (contentType == 1) {
if (this.botKeyboardViewVisible) {
this.botKeyboardView.getVisibility();
}
this.botKeyboardViewVisible = true;
EmojiView emojiView2 = this.emojiView;
if (emojiView2 == null || emojiView2.getVisibility() == 8) {
i3 = 0;
} else {
this.sizeNotifierLayout.removeView(this.emojiView);
this.emojiView.setVisibility(8);
this.emojiView.setShowing(false);
this.emojiViewVisible = false;
i3 = this.emojiView.getMeasuredHeight();
}
this.botKeyboardView.setVisibility(0);
EmojiView emojiView3 = this.botKeyboardView;
this.animatingContentType = 1;
MessagesController.getMainSettings(this.currentAccount).edit().remove("closed_botkeyboard_" + getTopicKeyString()).apply();
i2 = i3;
emojiView = emojiView3;
} else {
i2 = 0;
}
this.currentPopupContentType = contentType;
if (this.keyboardHeight <= 0) {
this.keyboardHeight = MessagesController.getGlobalEmojiSettings().getInt("kbd_height", AndroidUtilities.dp(200.0f));
}
if (this.keyboardHeightLand <= 0) {
this.keyboardHeightLand = MessagesController.getGlobalEmojiSettings().getInt("kbd_height_land3", AndroidUtilities.dp(200.0f));
}
android.graphics.Point point = AndroidUtilities.displaySize;
int i4 = point.x > point.y ? this.keyboardHeightLand : this.keyboardHeight;
if (contentType == 1) {
i4 = Math.min(this.botKeyboardView.getKeyboardHeight(), i4);
}
BotKeyboardView botKeyboardView2 = this.botKeyboardView;
if (botKeyboardView2 != null) {
botKeyboardView2.setPanelHeight(i4);
}
if (emojiView != null) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) emojiView.getLayoutParams();
layoutParams.height = i4;
emojiView.setLayoutParams(layoutParams);
}
if (!AndroidUtilities.isInMultiwindow) {
AndroidUtilities.hideKeyboard(this.messageEditText);
}
SizeNotifierFrameLayout sizeNotifierFrameLayout = this.sizeNotifierLayout;
if (sizeNotifierFrameLayout != null) {
this.emojiPadding = i4;
sizeNotifierFrameLayout.requestLayout();
setEmojiButtonImage(true, true);
updateBotButton(true);
onWindowSizeChanged();
if (this.smoothKeyboard && !this.keyboardVisible && i4 != i2 && allowAnimation) {
final Runnable runnable = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$showPopup$79();
}
};
if (this.overrideKeyboardAnimation) {
this.animationEndRunnable = runnable;
} else {
this.panelAnimation = new AnimatorSet();
float f = i4 - i2;
emojiView.setTranslationY(f);
this.panelAnimation.playTogether(ObjectAnimator.ofFloat(emojiView, (Property<EmojiView, Float>) View.TRANSLATION_Y, f, 0.0f));
this.panelAnimation.setInterpolator(AdjustPanLayoutHelper.keyboardInterpolator);
this.panelAnimation.setDuration(250L);
this.panelAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
ChatActivityEnterView.this.panelAnimation = null;
ChatActivityEnterView.this.notificationsLocker.unlock();
runnable.run();
}
});
AndroidUtilities.runOnUIThread(this.runEmojiPanelAnimation, 50L);
this.notificationsLocker.lock();
}
requestLayout();
}
}
z = true;
} else {
if (this.emojiButton != null) {
setEmojiButtonImage(false, true);
}
this.currentPopupContentType = -1;
EmojiView emojiView4 = this.emojiView;
if (emojiView4 != null) {
if (show != 2 || AndroidUtilities.usingHardwareInput || AndroidUtilities.isInMultiwindow) {
if (this.smoothKeyboard && !this.keyboardVisible && !this.stickersExpanded) {
this.emojiViewVisible = true;
this.animatingContentType = 0;
emojiView4.setShowing(false);
final Runnable runnable2 = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$showPopup$80(show);
}
};
if (!this.overrideKeyboardAnimation) {
AnimatorSet animatorSet = new AnimatorSet();
this.panelAnimation = animatorSet;
animatorSet.playTogether(ObjectAnimator.ofFloat(this.emojiView, (Property<EmojiView, Float>) View.TRANSLATION_Y, r10.getMeasuredHeight()));
this.panelAnimation.setInterpolator(AdjustPanLayoutHelper.keyboardInterpolator);
this.panelAnimation.setDuration(250L);
this.notificationsLocker.lock();
this.panelAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
runnable2.run();
ChatActivityEnterView.this.notificationsLocker.unlock();
}
});
} else {
this.animationEndRunnable = runnable2;
}
AndroidUtilities.runOnUIThread(this.runEmojiPanelAnimation, 50L);
requestLayout();
} else {
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
chatActivityEnterViewDelegate.bottomPanelTranslationYChanged(0.0f);
}
this.emojiPadding = 0;
this.sizeNotifierLayout.removeView(this.emojiView);
this.emojiView.setVisibility(8);
this.emojiView.setShowing(false);
}
} else {
this.removeEmojiViewAfterAnimation = false;
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate2 = this.delegate;
if (chatActivityEnterViewDelegate2 != null) {
chatActivityEnterViewDelegate2.bottomPanelTranslationYChanged(0.0f);
}
this.sizeNotifierLayout.removeView(this.emojiView);
this.emojiView = null;
}
this.emojiViewVisible = false;
}
BotKeyboardView botKeyboardView3 = this.botKeyboardView;
if (botKeyboardView3 != null && botKeyboardView3.getVisibility() == 0) {
if (show != 2 || AndroidUtilities.usingHardwareInput || AndroidUtilities.isInMultiwindow) {
if (this.smoothKeyboard && !this.keyboardVisible) {
if (this.botKeyboardViewVisible) {
i = 1;
this.animatingContentType = 1;
} else {
i = 1;
}
AnimatorSet animatorSet2 = new AnimatorSet();
this.panelAnimation = animatorSet2;
Animator[] animatorArr = new Animator[i];
BotKeyboardView botKeyboardView4 = this.botKeyboardView;
Property property = View.TRANSLATION_Y;
float[] fArr = new float[i];
fArr[0] = botKeyboardView4.getMeasuredHeight();
animatorArr[0] = ObjectAnimator.ofFloat(botKeyboardView4, (Property<BotKeyboardView, Float>) property, fArr);
animatorSet2.playTogether(animatorArr);
this.panelAnimation.setInterpolator(AdjustPanLayoutHelper.keyboardInterpolator);
this.panelAnimation.setDuration(250L);
this.panelAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (show == 0) {
ChatActivityEnterView.this.emojiPadding = 0;
}
ChatActivityEnterView.this.panelAnimation = null;
ChatActivityEnterView.this.botKeyboardView.setTranslationY(0.0f);
ChatActivityEnterView.this.botKeyboardView.setVisibility(8);
ChatActivityEnterView.this.notificationsLocker.unlock();
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterView.this.delegate.bottomPanelTranslationYChanged(0.0f);
}
ChatActivityEnterView.this.requestLayout();
}
});
this.notificationsLocker.lock();
AndroidUtilities.runOnUIThread(this.runEmojiPanelAnimation, 50L);
requestLayout();
} else if (!this.waitingForKeyboardOpen) {
this.botKeyboardView.setVisibility(8);
}
}
this.botKeyboardViewVisible = false;
}
if (contentType == 1 && this.botButtonsMessageObject != null) {
MessagesController.getMainSettings(this.currentAccount).edit().putInt("closed_botkeyboard_" + getTopicKeyString(), this.botButtonsMessageObject.getId()).apply();
}
z = true;
updateBotButton(true);
}
if (this.stickersTabOpen || this.emojiTabOpen) {
checkSendButton(z);
}
if (this.stickersExpanded && show != z) {
setStickersExpanded(false, false, false);
}
updateFieldHint(false);
checkBotMenu();
}
public void lambda$showPopup$79() {
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
chatActivityEnterViewDelegate.bottomPanelTranslationYChanged(0.0f);
}
requestLayout();
}
public void lambda$showPopup$80(int i) {
if (i == 0) {
this.emojiPadding = 0;
}
this.panelAnimation = null;
EmojiView emojiView = this.emojiView;
if (emojiView != null) {
emojiView.setTranslationY(0.0f);
this.emojiView.setVisibility(8);
this.sizeNotifierLayout.removeView(this.emojiView);
if (this.removeEmojiViewAfterAnimation) {
this.removeEmojiViewAfterAnimation = false;
this.emojiView = null;
}
}
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
chatActivityEnterViewDelegate.bottomPanelTranslationYChanged(0.0f);
}
requestLayout();
}
public final void attachEmojiView() {
if (this.emojiView.getParent() == null) {
int childCount = this.sizeNotifierLayout.getChildCount() - 5;
if (!this.shouldDrawBackground) {
childCount = this.sizeNotifierLayout.getChildCount();
}
this.sizeNotifierLayout.addView(this.emojiView, childCount);
}
}
private String getTopicKeyString() {
ChatActivity chatActivity = this.parentFragment;
if (chatActivity != null && chatActivity.isTopic) {
return this.dialog_id + "_" + this.parentFragment.getTopicId();
}
return BuildConfig.APP_CENTER_HASH + this.dialog_id;
}
public final void setEmojiButtonImage(boolean byOpen, boolean animated) {
int currentPage;
ChatActivityEnterViewAnimatedIconView.State state;
ChatActivityEnterViewAnimatedIconView.State state2;
FrameLayout frameLayout;
if (this.emojiButton == null) {
return;
}
if (this.recordInterfaceState == 1 || ((frameLayout = this.recordedAudioPanel) != null && frameLayout.getVisibility() == 0)) {
this.emojiButtonScale = 0.0f;
this.emojiButtonAlpha = 0.0f;
updateEmojiButtonParams();
animated = false;
}
if (byOpen && this.currentPopupContentType == 0) {
if (!this.sendPlainEnabled) {
return;
} else {
state = ChatActivityEnterViewAnimatedIconView.State.KEYBOARD;
}
} else {
EmojiView emojiView = this.emojiView;
if (emojiView == null) {
currentPage = MessagesController.getGlobalEmojiSettings().getInt("selected_page", 0);
} else {
currentPage = emojiView.getCurrentPage();
}
if (currentPage == 0 || (!this.allowStickers && !this.allowGifs)) {
state = ChatActivityEnterViewAnimatedIconView.State.SMILE;
} else {
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null && !TextUtils.isEmpty(editTextCaption.getText())) {
state = ChatActivityEnterViewAnimatedIconView.State.SMILE;
} else if (currentPage == 1) {
state = ChatActivityEnterViewAnimatedIconView.State.STICKER;
} else {
state = ChatActivityEnterViewAnimatedIconView.State.GIF;
}
}
}
if (!this.sendPlainEnabled && state == ChatActivityEnterViewAnimatedIconView.State.SMILE) {
state = ChatActivityEnterViewAnimatedIconView.State.GIF;
} else if (!this.stickersEnabled && state != (state2 = ChatActivityEnterViewAnimatedIconView.State.SMILE)) {
state = state2;
}
if (Theme.usePlusTheme) {
this.emojiButton.setColorFilter(ApplicationLoader.applicationContext.getSharedPreferences("theme", 0).getInt("chatEditTextIconsColor", -5395027), PorterDuff.Mode.SRC_IN);
}
this.emojiButton.setState(state, animated);
onEmojiIconChanged(state);
}
public void onEmojiIconChanged(ChatActivityEnterViewAnimatedIconView.State currentIcon) {
if (currentIcon == ChatActivityEnterViewAnimatedIconView.State.GIF && this.emojiView == null) {
MediaDataController.getInstance(this.currentAccount).loadRecents(0, true, true, false);
ArrayList arrayList = MessagesController.getInstance(this.currentAccount).gifSearchEmojies;
int min = Math.min(10, arrayList.size());
for (int i = 0; i < min; i++) {
Emoji.preloadEmoji((CharSequence) arrayList.get(i));
}
}
}
public boolean hidePopup(boolean byBackButton) {
return hidePopup(byBackButton, false);
}
public boolean hidePopup(boolean byBackButton, boolean forceAnimate) {
TLRPC.TL_replyKeyboardMarkup tL_replyKeyboardMarkup;
if (!isPopupShowing()) {
return false;
}
if (this.currentPopupContentType == 1 && (tL_replyKeyboardMarkup = this.botReplyMarkup) != null && byBackButton && this.botButtonsMessageObject != null) {
if (tL_replyKeyboardMarkup.is_persistent) {
return false;
}
MessagesController.getMainSettings(this.currentAccount).edit().putInt("closed_botkeyboard_" + getTopicKeyString(), this.botButtonsMessageObject.getId()).apply();
}
if ((byBackButton && this.searchingType != 0) || forceAnimate) {
setSearchingTypeInternal(0, true);
EmojiView emojiView = this.emojiView;
if (emojiView != null) {
emojiView.closeSearch(true);
}
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null) {
editTextCaption.requestFocus();
}
setStickersExpanded(false, true, false);
if (this.emojiTabOpen) {
checkSendButton(true);
}
} else if (this.searchingType != 0) {
setSearchingTypeInternal(0, false);
this.emojiView.closeSearch(false);
EditTextCaption editTextCaption2 = this.messageEditText;
if (editTextCaption2 != null) {
editTextCaption2.requestFocus();
}
} else if (this.stickersExpanded) {
setStickersExpanded(false, true, false);
} else {
showPopup(0, 0);
}
return true;
}
public final void setSearchingTypeInternal(int searchingType, boolean animated) {
final boolean z = searchingType != 0;
if (z != (this.searchingType != 0)) {
ValueAnimator valueAnimator = this.searchAnimator;
if (valueAnimator != null) {
valueAnimator.removeAllListeners();
this.searchAnimator.cancel();
}
if (!animated) {
this.searchToOpenProgress = z ? 1.0f : 0.0f;
EmojiView emojiView = this.emojiView;
if (emojiView != null) {
emojiView.searchProgressChanged();
}
} else {
float[] fArr = new float[2];
fArr[0] = this.searchToOpenProgress;
fArr[1] = z ? 1.0f : 0.0f;
ValueAnimator ofFloat = ValueAnimator.ofFloat(fArr);
this.searchAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
ChatActivityEnterView.this.lambda$setSearchingTypeInternal$81(valueAnimator2);
}
});
this.searchAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
ChatActivityEnterView.this.searchToOpenProgress = z ? 1.0f : 0.0f;
if (ChatActivityEnterView.this.emojiView != null) {
ChatActivityEnterView.this.emojiView.searchProgressChanged();
}
}
});
this.searchAnimator.setDuration(220L);
this.searchAnimator.setInterpolator(CubicBezierInterpolator.DEFAULT);
this.searchAnimator.start();
}
}
this.searchingType = searchingType;
}
public void lambda$setSearchingTypeInternal$81(ValueAnimator valueAnimator) {
this.searchToOpenProgress = ((Float) valueAnimator.getAnimatedValue()).floatValue();
EmojiView emojiView = this.emojiView;
if (emojiView != null) {
emojiView.searchProgressChanged();
}
}
public void openKeyboardInternal() {
ChatActivity chatActivity;
if (hasBotWebView() && botCommandsMenuIsShowing()) {
return;
}
showPopup((AndroidUtilities.usingHardwareInput || AndroidUtilities.isInMultiwindow || ((chatActivity = this.parentFragment) != null && chatActivity.isInBubbleMode()) || this.isPaused) ? 0 : 2, 0);
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
chatActivityEnterViewDelegate.onKeyboardRequested();
}
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null) {
editTextCaption.requestFocus();
}
AndroidUtilities.showKeyboard(this.messageEditText);
if (this.isPaused) {
this.showKeyboardOnResume = true;
return;
}
if (AndroidUtilities.usingHardwareInput || this.keyboardVisible || AndroidUtilities.isInMultiwindow) {
return;
}
ChatActivity chatActivity2 = this.parentFragment;
if (chatActivity2 == null || !chatActivity2.isInBubbleMode()) {
this.waitingForKeyboardOpen = true;
EmojiView emojiView = this.emojiView;
if (emojiView != null) {
emojiView.onTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), 3, 0.0f, 0.0f, 0));
}
AndroidUtilities.cancelRunOnUIThread(this.openKeyboardRunnable);
AndroidUtilities.runOnUIThread(this.openKeyboardRunnable, 100L);
}
}
public boolean isEditingMessage() {
return this.editingMessageObject != null;
}
public MessageObject getEditingMessageObject() {
return this.editingMessageObject;
}
public boolean isEditingCaption() {
return this.editingCaption;
}
public boolean hasAudioToSend() {
return (this.audioToSendMessageObject == null && this.videoToSendMessageObject == null) ? false : true;
}
public void openKeyboard() {
if (hasBotWebView() && botCommandsMenuIsShowing()) {
return;
}
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
chatActivityEnterViewDelegate.onKeyboardRequested();
}
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption == null || AndroidUtilities.showKeyboard(editTextCaption)) {
return;
}
this.messageEditText.clearFocus();
this.messageEditText.requestFocus();
}
public void closeKeyboard() {
AndroidUtilities.hideKeyboard(this.messageEditText);
}
public boolean isPopupShowing() {
return this.emojiViewVisible || this.botKeyboardViewVisible;
}
public boolean closeCreationLinkDialog() {
EditTextCaption editTextCaption = this.messageEditText;
return editTextCaption != null && editTextCaption.closeCreationLinkDialog();
}
public boolean isKeyboardVisible() {
return this.keyboardVisible;
}
public boolean isWaitingForKeyboard() {
return this.waitingForKeyboardOpen;
}
public void addRecentGif(TLRPC.Document searchImage) {
MediaDataController.getInstance(this.currentAccount).addRecentGif(searchImage, (int) (System.currentTimeMillis() / 1000), true);
EmojiView emojiView = this.emojiView;
if (emojiView != null) {
emojiView.addRecentGif(searchImage);
}
}
public void onSizeChanged(int w, int h, int oldw, int oldh) {
super/*android.widget.FrameLayout*/.onSizeChanged(w, h, oldw, oldh);
if (w != oldw && this.stickersExpanded) {
setSearchingTypeInternal(0, false);
this.emojiView.closeSearch(false);
setStickersExpanded(false, false, false);
}
VideoTimelineView videoTimelineView = this.videoTimelineView;
if (videoTimelineView != null) {
videoTimelineView.clearFrames();
}
}
public boolean isStickersExpanded() {
return this.stickersExpanded;
}
@Override
public void onSizeChanged(int height, boolean isWidthGreater) {
MessageObject messageObject;
EditTextCaption editTextCaption;
TLRPC.TL_replyKeyboardMarkup tL_replyKeyboardMarkup;
boolean z;
if (this.searchingType != 0) {
this.lastSizeChangeValue1 = height;
this.lastSizeChangeValue2 = isWidthGreater;
this.keyboardVisible = height > 0;
checkBotMenu();
return;
}
if (height > AndroidUtilities.dp(50.0f) && this.keyboardVisible && !AndroidUtilities.isInMultiwindow) {
if (isWidthGreater) {
this.keyboardHeightLand = height;
MessagesController.getGlobalEmojiSettings().edit().putInt("kbd_height_land3", this.keyboardHeightLand).commit();
} else {
this.keyboardHeight = height;
MessagesController.getGlobalEmojiSettings().edit().putInt("kbd_height", this.keyboardHeight).commit();
}
}
if (this.keyboardVisible && this.emojiViewVisible && this.emojiView == null) {
this.emojiViewVisible = false;
}
if (isPopupShowing()) {
int i = isWidthGreater ? this.keyboardHeightLand : this.keyboardHeight;
int dp = AndroidUtilities.dp((ApplicationLoader.applicationContext.getSharedPreferences("plusconfig", 0).getInt("emojiPopupSize", 60) - 40) * 10);
if (dp >= i) {
i = dp;
}
if (this.currentPopupContentType == 1 && !this.botKeyboardView.isFullSize()) {
i = Math.min(this.botKeyboardView.getKeyboardHeight(), i);
}
EmojiView emojiView = null;
int i2 = this.currentPopupContentType;
if (i2 == 0) {
emojiView = this.emojiView;
} else if (i2 == 1) {
emojiView = this.botKeyboardView;
}
BotKeyboardView botKeyboardView = this.botKeyboardView;
if (botKeyboardView != null) {
botKeyboardView.setPanelHeight(i);
}
if (emojiView != null) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) emojiView.getLayoutParams();
if (!this.closeAnimationInProgress) {
int i3 = layoutParams.width;
int i4 = AndroidUtilities.displaySize.x;
if ((i3 != i4 || layoutParams.height != i) && !this.stickersExpanded) {
layoutParams.width = i4;
layoutParams.height = i;
emojiView.setLayoutParams(layoutParams);
SizeNotifierFrameLayout sizeNotifierFrameLayout = this.sizeNotifierLayout;
if (sizeNotifierFrameLayout != null) {
int i5 = this.emojiPadding;
this.emojiPadding = layoutParams.height;
sizeNotifierFrameLayout.requestLayout();
onWindowSizeChanged();
if (this.smoothKeyboard && !this.keyboardVisible && i5 != this.emojiPadding && pannelAnimationEnabled()) {
AnimatorSet animatorSet = new AnimatorSet();
this.panelAnimation = animatorSet;
animatorSet.playTogether(ObjectAnimator.ofFloat(emojiView, (Property<EmojiView, Float>) View.TRANSLATION_Y, this.emojiPadding - i5, 0.0f));
this.panelAnimation.setInterpolator(AdjustPanLayoutHelper.keyboardInterpolator);
this.panelAnimation.setDuration(250L);
this.panelAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
ChatActivityEnterView.this.panelAnimation = null;
if (ChatActivityEnterView.this.delegate != null) {
ChatActivityEnterView.this.delegate.bottomPanelTranslationYChanged(0.0f);
}
ChatActivityEnterView.this.requestLayout();
ChatActivityEnterView.this.notificationsLocker.unlock();
}
});
AndroidUtilities.runOnUIThread(this.runEmojiPanelAnimation, 50L);
this.notificationsLocker.lock();
requestLayout();
}
}
}
}
}
}
if (this.lastSizeChangeValue1 == height && this.lastSizeChangeValue2 == isWidthGreater) {
onWindowSizeChanged();
return;
}
this.lastSizeChangeValue1 = height;
this.lastSizeChangeValue2 = isWidthGreater;
boolean z2 = this.keyboardVisible;
this.keyboardVisible = height > 0;
checkBotMenu();
if (this.keyboardVisible && isPopupShowing() && this.stickersExpansionAnim == null) {
showPopup(0, this.currentPopupContentType);
} else if (!this.keyboardVisible && !isPopupShowing() && (messageObject = this.botButtonsMessageObject) != null && this.replyingMessageObject != messageObject && ((!hasBotWebView() || !botCommandsMenuIsShowing()) && (((editTextCaption = this.messageEditText) == null || TextUtils.isEmpty(editTextCaption.getText())) && (tL_replyKeyboardMarkup = this.botReplyMarkup) != null && !tL_replyKeyboardMarkup.rows.isEmpty()))) {
if (this.sizeNotifierLayout.adjustPanLayoutHelper.animationInProgress()) {
this.sizeNotifierLayout.adjustPanLayoutHelper.stopTransition();
} else {
this.sizeNotifierLayout.adjustPanLayoutHelper.ignoreOnce();
}
showPopup(1, 1, false);
}
if (this.emojiPadding != 0 && !(z = this.keyboardVisible) && z != z2 && !isPopupShowing()) {
this.emojiPadding = 0;
this.sizeNotifierLayout.requestLayout();
}
if (this.keyboardVisible && this.waitingForKeyboardOpen) {
this.waitingForKeyboardOpen = false;
if (this.clearBotButtonsOnKeyboardOpen) {
this.clearBotButtonsOnKeyboardOpen = false;
this.botKeyboardView.setButtons(this.botReplyMarkup);
}
AndroidUtilities.cancelRunOnUIThread(this.openKeyboardRunnable);
}
onWindowSizeChanged();
}
public void checkReactionsButton(boolean visible) {
AndroidUtilities.updateViewVisibilityAnimated(this.reactionsButton, visible, 0.1f, true);
}
public int getEmojiPadding() {
return this.emojiPadding;
}
public int getVisibleEmojiPadding() {
if (this.emojiViewVisible) {
return this.emojiPadding;
}
return 0;
}
public MessageObject getThreadMessage() {
ChatActivity chatActivity = this.parentFragment;
if (chatActivity != null) {
return chatActivity.getThreadMessage();
}
return null;
}
public int getThreadMessageId() {
ChatActivity chatActivity = this.parentFragment;
if (chatActivity == null || chatActivity.getThreadMessage() == null) {
return 0;
}
return this.parentFragment.getThreadMessage().getId();
}
public void didReceivedNotification(int id, int account, Object... args) {
TLRPC.ChatFull chatFull;
TLRPC.Chat chat;
if (id == NotificationCenter.emojiLoaded) {
EmojiView emojiView = this.emojiView;
if (emojiView != null) {
emojiView.invalidateViews();
}
BotKeyboardView botKeyboardView = this.botKeyboardView;
if (botKeyboardView != null) {
botKeyboardView.invalidateViews();
}
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null) {
editTextCaption.postInvalidate();
this.messageEditText.invalidateForce();
return;
}
return;
}
if (id == NotificationCenter.recordProgressChanged) {
if (((Integer) args[0]).intValue() != this.recordingGuid) {
return;
}
if (this.recordInterfaceState != 0 && !this.wasSendTyping && !isInScheduleMode()) {
this.wasSendTyping = true;
this.accountInstance.getMessagesController().sendTyping(this.dialog_id, getThreadMessageId(), isInVideoMode() ? 7 : 1, 0);
}
RecordCircle recordCircle = this.recordCircle;
if (recordCircle != null) {
recordCircle.setAmplitude(((Double) args[1]).doubleValue());
return;
}
return;
}
if (id == NotificationCenter.closeChats) {
EditTextCaption editTextCaption2 = this.messageEditText;
if (editTextCaption2 == null || !editTextCaption2.isFocused()) {
return;
}
AndroidUtilities.hideKeyboard(this.messageEditText);
return;
}
int i = 4;
if (id == NotificationCenter.recordStartError || id == NotificationCenter.recordStopped) {
if (((Integer) args[0]).intValue() == this.recordingGuid && this.recordingAudioVideo) {
this.recordingAudioVideo = false;
if (id == NotificationCenter.recordStopped) {
Integer num = (Integer) args[1];
if (num.intValue() != 4) {
if (isInVideoMode() && num.intValue() == 5) {
i = 1;
} else if (num.intValue() == 0) {
i = 5;
} else {
i = num.intValue() == 6 ? 2 : 3;
}
}
if (i != 3) {
updateRecordInterface(i, true);
return;
}
return;
}
updateRecordInterface(2, true);
return;
}
return;
}
if (id == NotificationCenter.recordStarted) {
if (((Integer) args[0]).intValue() != this.recordingGuid) {
return;
}
boolean booleanValue = ((Boolean) args[1]).booleanValue();
this.isInVideoMode = !booleanValue;
ChatActivityEnterViewAnimatedIconView chatActivityEnterViewAnimatedIconView = this.audioVideoSendButton;
if (chatActivityEnterViewAnimatedIconView != null) {
chatActivityEnterViewAnimatedIconView.setState(booleanValue ? ChatActivityEnterViewAnimatedIconView.State.VOICE : ChatActivityEnterViewAnimatedIconView.State.VIDEO, true);
}
if (!this.recordingAudioVideo) {
this.recordingAudioVideo = true;
updateRecordInterface(0, true);
} else {
RecordCircle recordCircle2 = this.recordCircle;
if (recordCircle2 != null) {
recordCircle2.showWaves(true, true);
}
}
TimerView timerView = this.recordTimerView;
if (timerView != null) {
timerView.start(this.millisecondsRecorded);
}
RecordDot recordDot = this.recordDot;
if (recordDot != null) {
recordDot.enterAnimation = false;
return;
}
return;
}
if (id == NotificationCenter.recordPaused) {
this.recordingAudioVideo = false;
this.audioToSend = null;
this.videoToSendMessageObject = null;
return;
}
if (id == NotificationCenter.recordResumed) {
this.audioToSend = null;
this.videoToSendMessageObject = null;
checkSendButton(true);
this.recordingAudioVideo = true;
updateRecordInterface(0, true);
return;
}
if (id == NotificationCenter.audioDidSent) {
if (((Integer) args[0]).intValue() != this.recordingGuid) {
return;
}
this.millisecondsRecorded = 0L;
Object obj = args[1];
if (obj instanceof VideoEditedInfo) {
VideoEditedInfo videoEditedInfo = (VideoEditedInfo) obj;
this.videoToSendMessageObject = videoEditedInfo;
String str = (String) args[2];
this.audioToSendPath = str;
ArrayList<Bitmap> arrayList = (ArrayList) args[3];
this.millisecondsRecorded = videoEditedInfo.estimatedDuration;
VideoTimelineView videoTimelineView = this.videoTimelineView;
if (videoTimelineView != null) {
videoTimelineView.setVideoPath(str);
this.videoTimelineView.setKeyframes(arrayList);
this.videoTimelineView.setVisibility(0);
this.videoTimelineView.setMinProgressDiff(1000.0f / this.videoToSendMessageObject.estimatedDuration);
isRecordingStateChanged();
}
updateRecordInterface(3, true);
checkSendButton(false);
return;
}
this.audioToSend = (TLRPC.TL_document) args[1];
this.audioToSendPath = (String) args[2];
boolean z = args.length >= 4 && ((Boolean) args[3]).booleanValue();
if (this.audioToSend != null) {
createRecordAudioPanel();
if (this.recordedAudioPanel == null) {
return;
}
TLRPC.TL_message tL_message = new TLRPC.TL_message();
tL_message.out = true;
tL_message.id = 0;
tL_message.peer_id = new TLRPC.TL_peerUser();
TLRPC.TL_peerUser tL_peerUser = new TLRPC.TL_peerUser();
tL_message.from_id = tL_peerUser;
TLRPC.Peer peer = tL_message.peer_id;
long clientUserId = UserConfig.getInstance(this.currentAccount).getClientUserId();
tL_peerUser.user_id = clientUserId;
peer.user_id = clientUserId;
tL_message.date = (int) (System.currentTimeMillis() / 1000);
tL_message.message = BuildConfig.APP_CENTER_HASH;
tL_message.attachPath = this.audioToSendPath;
TLRPC.TL_messageMediaDocument tL_messageMediaDocument = new TLRPC.TL_messageMediaDocument();
tL_message.media = tL_messageMediaDocument;
tL_messageMediaDocument.flags |= 3;
tL_messageMediaDocument.document = this.audioToSend;
tL_message.flags |= 768;
this.audioToSendMessageObject = new MessageObject(UserConfig.selectedAccount, tL_message, false, true);
this.recordedAudioPanel.setAlpha(1.0f);
this.recordedAudioPanel.setVisibility(0);
this.recordDeleteImageView.setVisibility(0);
this.recordDeleteImageView.setAlpha(0.0f);
this.recordDeleteImageView.setScaleY(0.0f);
this.recordDeleteImageView.setScaleX(0.0f);
double d = 0.0d;
int i2 = 0;
while (true) {
if (i2 >= ((TLRPC.Document) this.audioToSend).attributes.size()) {
break;
}
TLRPC.DocumentAttribute documentAttribute = (TLRPC.DocumentAttribute) ((TLRPC.Document) this.audioToSend).attributes.get(i2);
if (documentAttribute instanceof TLRPC.TL_documentAttributeAudio) {
d = documentAttribute.duration;
break;
}
i2++;
}
int i3 = 0;
while (true) {
if (i3 >= ((TLRPC.Document) this.audioToSend).attributes.size()) {
break;
}
TLRPC.DocumentAttribute documentAttribute2 = (TLRPC.DocumentAttribute) ((TLRPC.Document) this.audioToSend).attributes.get(i3);
if (documentAttribute2 instanceof TLRPC.TL_documentAttributeAudio) {
byte[] bArr = documentAttribute2.waveform;
if (bArr == null || bArr.length == 0) {
documentAttribute2.waveform = MediaController.getWaveform(this.audioToSendPath);
}
this.recordedAudioSeekBar.setWaveform(documentAttribute2.waveform);
} else {
i3++;
}
}
this.millisecondsRecorded = (long) (1000.0d * d);
this.recordedAudioTimeTextView.setText(AndroidUtilities.formatShortDuration((int) d));
checkSendButton(false);
if (z) {
createRecordCircle();
createRecordPanel();
createRecordAudioPanel();
this.recordInterfaceState = 1;
this.recordCircle.resetLockTranslation(false);
this.recordControlsCircleScale.set(this.recordCircle, Float.valueOf(1.0f));
ControlsView controlsView = this.controlsView;
if (controlsView != null) {
controlsView.setVisibility(0);
this.controlsView.setAlpha(1.0f);
}
}
updateRecordInterface(3, !z);
return;
}
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
chatActivityEnterViewDelegate.onMessageSend(null, true, 0);
return;
}
return;
}
if (id == NotificationCenter.audioRouteChanged) {
if (this.parentActivity != null) {
this.parentActivity.setVolumeControlStream(((Boolean) args[0]).booleanValue() ? 0 : Integer.MIN_VALUE);
return;
}
return;
}
if (id == NotificationCenter.messagePlayingDidReset) {
if (this.audioToSendMessageObject == null || MediaController.getInstance().isPlayingMessage(this.audioToSendMessageObject)) {
return;
}
MediaActionDrawable mediaActionDrawable = this.playPauseDrawable;
if (mediaActionDrawable != null) {
mediaActionDrawable.setIcon(0, true);
}
ImageView imageView = this.recordedAudioPlayButton;
if (imageView != null) {
imageView.setContentDescription(LocaleController.getString("AccActionPlay", R.string.AccActionPlay));
}
SeekBarWaveformView seekBarWaveformView = this.recordedAudioSeekBar;
if (seekBarWaveformView != null) {
seekBarWaveformView.setProgress(0.0f);
return;
}
return;
}
if (id == NotificationCenter.messagePlayingProgressDidChanged) {
if (this.audioToSendMessageObject == null || !MediaController.getInstance().isPlayingMessage(this.audioToSendMessageObject)) {
return;
}
MessageObject playingMessageObject = MediaController.getInstance().getPlayingMessageObject();
MessageObject messageObject = this.audioToSendMessageObject;
messageObject.audioProgress = playingMessageObject.audioProgress;
messageObject.audioProgressSec = playingMessageObject.audioProgressSec;
if (this.recordedAudioSeekBar.isDragging()) {
return;
}
this.recordedAudioSeekBar.setProgress(this.audioToSendMessageObject.audioProgress);
return;
}
if (id == NotificationCenter.featuredStickersDidLoad) {
ChatActivityEnterViewAnimatedIconView chatActivityEnterViewAnimatedIconView2 = this.emojiButton;
if (chatActivityEnterViewAnimatedIconView2 != null) {
chatActivityEnterViewAnimatedIconView2.invalidate();
return;
}
return;
}
if (id == NotificationCenter.messageReceivedByServer2) {
if (((Boolean) args[6]).booleanValue()) {
return;
}
if (((Long) args[3]).longValue() == this.dialog_id && (chatFull = this.info) != null && chatFull.slowmode_seconds != 0 && (chat = this.accountInstance.getMessagesController().getChat(Long.valueOf(this.info.id))) != null && !ChatObject.hasAdminRights(chat) && !ChatObject.isIgnoredChatRestrictionsForBoosters(chat)) {
TLRPC.ChatFull chatFull2 = this.info;
int currentTime = ConnectionsManager.getInstance(this.currentAccount).getCurrentTime();
TLRPC.ChatFull chatFull3 = this.info;
chatFull2.slowmode_next_send_date = currentTime + chatFull3.slowmode_seconds;
chatFull3.flags |= 262144;
setSlowModeTimer(chatFull3.slowmode_next_send_date);
}
if (BuildVars.BETA && this.dontUpdateDiscussionChat) {
this.dontUpdateDiscussionChat = false;
dontUpdateGroup();
return;
}
return;
}
if (id == NotificationCenter.sendingMessagesChanged) {
if (this.info != null) {
updateSlowModeText();
return;
}
return;
}
if (id == NotificationCenter.audioRecordTooShort) {
this.audioToSend = null;
this.videoToSendMessageObject = null;
updateRecordInterface(4, true);
return;
}
if (id == NotificationCenter.updateBotMenuButton) {
long longValue = ((Long) args[0]).longValue();
TLRPC.BotMenuButton botMenuButton = (TLRPC.BotMenuButton) args[1];
if (longValue == this.dialog_id) {
if (botMenuButton instanceof TLRPC.TL_botMenuButton) {
TLRPC.TL_botMenuButton tL_botMenuButton = (TLRPC.TL_botMenuButton) botMenuButton;
this.botMenuWebViewTitle = tL_botMenuButton.text;
this.botMenuWebViewUrl = tL_botMenuButton.url;
this.botMenuButtonType = BotMenuButtonType.WEB_VIEW;
} else if (this.hasBotCommands || this.hasQuickReplies) {
this.botMenuButtonType = BotMenuButtonType.COMMANDS;
} else {
this.botMenuButtonType = BotMenuButtonType.NO_BUTTON;
}
updateBotButton(false);
return;
}
return;
}
if (id == NotificationCenter.didUpdatePremiumGiftFieldIcon) {
updateGiftButton(true);
}
}
public void onRequestPermissionsResultFragment(int requestCode, String[] permissions, int[] grantResults) {
if (requestCode != 2 || this.pendingLocationButton == null) {
return;
}
if (grantResults.length > 0 && grantResults[0] == 0) {
SendMessagesHelper.getInstance(this.currentAccount).sendCurrentLocation(this.pendingMessageObject, this.pendingLocationButton);
}
this.pendingLocationButton = null;
this.pendingMessageObject = null;
}
public void checkStickresExpandHeight() {
if (this.emojiView == null) {
return;
}
android.graphics.Point point = AndroidUtilities.displaySize;
int i = point.x > point.y ? this.keyboardHeightLand : this.keyboardHeight;
int currentActionBarHeight = (((this.originalViewHeight - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0)) - ActionBar.getCurrentActionBarHeight()) - getHeight()) + Theme.chat_composeShadowDrawable.getIntrinsicHeight();
if (this.searchingType == 2) {
currentActionBarHeight = Math.min(currentActionBarHeight, AndroidUtilities.dp(120.0f) + i);
}
int i2 = this.emojiView.getLayoutParams().height;
if (i2 == currentActionBarHeight) {
return;
}
Animator animator = this.stickersExpansionAnim;
if (animator != null) {
animator.cancel();
this.stickersExpansionAnim = null;
}
this.stickersExpandedHeight = currentActionBarHeight;
if (i2 > currentActionBarHeight) {
final Runnable runnable = new Runnable() {
@Override
public final void run() {
ChatActivityEnterView.this.lambda$checkStickresExpandHeight$82();
}
};
this.emojiView.setLayerType(2, null);
if (this.overrideKeyboardAnimation) {
this.animationEndRunnable = runnable;
return;
}
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofInt(this, (Property<ChatActivityEnterView, Integer>) this.roundedTranslationYProperty, -(this.stickersExpandedHeight - i)), ObjectAnimator.ofInt(this.emojiView, (Property<EmojiView, Integer>) this.roundedTranslationYProperty, -(this.stickersExpandedHeight - i)));
((ObjectAnimator) animatorSet.getChildAnimations().get(0)).addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
ChatActivityEnterView.this.lambda$checkStickresExpandHeight$83(valueAnimator);
}
});
animatorSet.setDuration(300L);
animatorSet.setInterpolator(CubicBezierInterpolator.DEFAULT);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
ChatActivityEnterView.this.stickersExpansionAnim = null;
runnable.run();
}
});
this.stickersExpansionAnim = animatorSet;
animatorSet.start();
return;
}
this.emojiView.getLayoutParams().height = this.stickersExpandedHeight;
this.sizeNotifierLayout.requestLayout();
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null) {
int selectionStart = editTextCaption.getSelectionStart();
int selectionEnd = this.messageEditText.getSelectionEnd();
EditTextCaption editTextCaption2 = this.messageEditText;
editTextCaption2.setText(editTextCaption2.getText());
this.messageEditText.setSelection(selectionStart, selectionEnd);
}
AnimatorSet animatorSet2 = new AnimatorSet();
animatorSet2.playTogether(ObjectAnimator.ofInt(this, (Property<ChatActivityEnterView, Integer>) this.roundedTranslationYProperty, -(this.stickersExpandedHeight - i)), ObjectAnimator.ofInt(this.emojiView, (Property<EmojiView, Integer>) this.roundedTranslationYProperty, -(this.stickersExpandedHeight - i)));
((ObjectAnimator) animatorSet2.getChildAnimations().get(0)).addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
ChatActivityEnterView.this.lambda$checkStickresExpandHeight$84(valueAnimator);
}
});
animatorSet2.setDuration(300L);
animatorSet2.setInterpolator(CubicBezierInterpolator.DEFAULT);
animatorSet2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
ChatActivityEnterView.this.stickersExpansionAnim = null;
ChatActivityEnterView.this.emojiView.setLayerType(0, null);
}
});
this.stickersExpansionAnim = animatorSet2;
this.emojiView.setLayerType(2, null);
animatorSet2.start();
}
public void lambda$checkStickresExpandHeight$82() {
EmojiView emojiView = this.emojiView;
if (emojiView != null) {
emojiView.getLayoutParams().height = this.stickersExpandedHeight;
this.emojiView.setLayerType(0, null);
}
}
public void lambda$checkStickresExpandHeight$83(ValueAnimator valueAnimator) {
this.sizeNotifierLayout.invalidate();
}
public void lambda$checkStickresExpandHeight$84(ValueAnimator valueAnimator) {
this.sizeNotifierLayout.invalidate();
}
public void setStickersExpanded(boolean expanded, boolean animated, boolean byDrag) {
setStickersExpanded(expanded, animated, byDrag, true);
}
public void setStickersExpanded(boolean expanded, boolean animated, boolean byDrag, boolean stopAllHeavy) {
AdjustPanLayoutHelper adjustPanLayoutHelper = this.adjustPanLayoutHelper;
if ((adjustPanLayoutHelper != null && adjustPanLayoutHelper.animationInProgress()) || this.waitingForKeyboardOpenAfterAnimation || this.emojiView == null) {
return;
}
if (byDrag || this.stickersExpanded != expanded) {
this.stickersExpanded = expanded;
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = this.delegate;
if (chatActivityEnterViewDelegate != null) {
chatActivityEnterViewDelegate.onStickersExpandedChange();
}
android.graphics.Point point = AndroidUtilities.displaySize;
final int i = point.x > point.y ? this.keyboardHeightLand : this.keyboardHeight;
Animator animator = this.stickersExpansionAnim;
if (animator != null) {
animator.cancel();
this.stickersExpansionAnim = null;
}
if (this.stickersExpanded) {
if (stopAllHeavy) {
NotificationCenter.getGlobalInstance().lambda$postNotificationNameOnUIThread$1(NotificationCenter.stopAllHeavyOperations, 1);
}
int height = this.sizeNotifierLayout.getHeight();
this.originalViewHeight = height;
int currentActionBarHeight = (((height - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0)) - ActionBar.getCurrentActionBarHeight()) - getHeight()) + Theme.chat_composeShadowDrawable.getIntrinsicHeight();
this.stickersExpandedHeight = currentActionBarHeight;
if (this.searchingType == 2) {
this.stickersExpandedHeight = Math.min(currentActionBarHeight, AndroidUtilities.dp(120.0f) + i);
}
this.emojiView.getLayoutParams().height = this.stickersExpandedHeight;
this.sizeNotifierLayout.requestLayout();
if (this.shouldDrawBackground) {
this.sizeNotifierLayout.setForeground(new ScrimDrawable());
}
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null) {
int selectionStart = editTextCaption.getSelectionStart();
int selectionEnd = this.messageEditText.getSelectionEnd();
EditTextCaption editTextCaption2 = this.messageEditText;
editTextCaption2.setText(editTextCaption2.getText());
this.messageEditText.setSelection(selectionStart, selectionEnd);
}
if (animated) {
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(ObjectAnimator.ofInt(this, (Property<ChatActivityEnterView, Integer>) this.roundedTranslationYProperty, -(this.stickersExpandedHeight - i)), ObjectAnimator.ofInt(this.emojiView, (Property<EmojiView, Integer>) this.roundedTranslationYProperty, -(this.stickersExpandedHeight - i)), ObjectAnimator.ofFloat(this.stickersArrow, "animationProgress", 1.0f));
animatorSet.setDuration(300L);
animatorSet.setInterpolator(CubicBezierInterpolator.DEFAULT);
((ObjectAnimator) animatorSet.getChildAnimations().get(0)).addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
ChatActivityEnterView.this.lambda$setStickersExpanded$85(i, valueAnimator);
}
});
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
ChatActivityEnterView.this.stickersExpansionAnim = null;
ChatActivityEnterView.this.emojiView.setLayerType(0, null);
ChatActivityEnterView.this.notificationsLocker.unlock();
}
});
this.stickersExpansionAnim = animatorSet;
this.emojiView.setLayerType(2, null);
this.notificationsLocker.lock();
this.stickersExpansionProgress = 0.0f;
this.sizeNotifierLayout.invalidate();
animatorSet.start();
} else {
this.stickersExpansionProgress = 1.0f;
setTranslationY(-(this.stickersExpandedHeight - i));
this.emojiView.setTranslationY(-(this.stickersExpandedHeight - i));
AnimatedArrowDrawable animatedArrowDrawable = this.stickersArrow;
if (animatedArrowDrawable != null) {
animatedArrowDrawable.setAnimationProgress(1.0f);
}
}
} else {
if (stopAllHeavy) {
NotificationCenter.getGlobalInstance().lambda$postNotificationNameOnUIThread$1(NotificationCenter.startAllHeavyOperations, 1);
}
if (animated) {
this.closeAnimationInProgress = true;
AnimatorSet animatorSet2 = new AnimatorSet();
animatorSet2.playTogether(ObjectAnimator.ofInt(this, (Property<ChatActivityEnterView, Integer>) this.roundedTranslationYProperty, 0), ObjectAnimator.ofInt(this.emojiView, (Property<EmojiView, Integer>) this.roundedTranslationYProperty, 0), ObjectAnimator.ofFloat(this.stickersArrow, "animationProgress", 0.0f));
animatorSet2.setDuration(300L);
animatorSet2.setInterpolator(CubicBezierInterpolator.DEFAULT);
((ObjectAnimator) animatorSet2.getChildAnimations().get(0)).addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
ChatActivityEnterView.this.lambda$setStickersExpanded$86(i, valueAnimator);
}
});
animatorSet2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
ChatActivityEnterView.this.closeAnimationInProgress = false;
ChatActivityEnterView.this.stickersExpansionAnim = null;
if (ChatActivityEnterView.this.emojiView != null) {
ChatActivityEnterView.this.emojiView.getLayoutParams().height = i;
ChatActivityEnterView.this.emojiView.setLayerType(0, null);
}
if (ChatActivityEnterView.this.sizeNotifierLayout != null) {
ChatActivityEnterView.this.sizeNotifierLayout.requestLayout();
ChatActivityEnterView.this.sizeNotifierLayout.setForeground(null);
ChatActivityEnterView.this.sizeNotifierLayout.setWillNotDraw(false);
}
if (ChatActivityEnterView.this.keyboardVisible && ChatActivityEnterView.this.isPopupShowing()) {
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
chatActivityEnterView.showPopup(0, chatActivityEnterView.currentPopupContentType);
}
if (ChatActivityEnterView.this.onEmojiSearchClosed != null) {
ChatActivityEnterView.this.onEmojiSearchClosed.run();
ChatActivityEnterView.this.onEmojiSearchClosed = null;
}
ChatActivityEnterView.this.notificationsLocker.unlock();
}
});
this.stickersExpansionProgress = 1.0f;
this.sizeNotifierLayout.invalidate();
this.stickersExpansionAnim = animatorSet2;
this.emojiView.setLayerType(2, null);
this.notificationsLocker.lock();
animatorSet2.start();
} else {
this.stickersExpansionProgress = 0.0f;
setTranslationY(0.0f);
this.emojiView.setTranslationY(0.0f);
this.emojiView.getLayoutParams().height = i;
this.sizeNotifierLayout.requestLayout();
this.sizeNotifierLayout.setForeground(null);
this.sizeNotifierLayout.setWillNotDraw(false);
AnimatedArrowDrawable animatedArrowDrawable2 = this.stickersArrow;
if (animatedArrowDrawable2 != null) {
animatedArrowDrawable2.setAnimationProgress(0.0f);
}
}
}
ImageView imageView = this.expandStickersButton;
if (imageView != null) {
if (this.stickersExpanded) {
imageView.setContentDescription(LocaleController.getString("AccDescrCollapsePanel", R.string.AccDescrCollapsePanel));
} else {
imageView.setContentDescription(LocaleController.getString("AccDescrExpandPanel", R.string.AccDescrExpandPanel));
}
}
}
}
public void lambda$setStickersExpanded$85(int i, ValueAnimator valueAnimator) {
this.stickersExpansionProgress = Math.abs(getTranslationY() / (-(this.stickersExpandedHeight - i)));
this.sizeNotifierLayout.invalidate();
}
public void lambda$setStickersExpanded$86(int i, ValueAnimator valueAnimator) {
this.stickersExpansionProgress = getTranslationY() / (-(this.stickersExpandedHeight - i));
this.sizeNotifierLayout.invalidate();
}
public boolean swipeToBackEnabled() {
FrameLayout frameLayout;
if (this.recordingAudioVideo) {
return false;
}
if (isInVideoMode() && (frameLayout = this.recordedAudioPanel) != null && frameLayout.getVisibility() == 0) {
return false;
}
return (hasBotWebView() && this.botCommandsMenuButton.isOpened()) ? false : true;
}
public int getHeightWithTopView() {
int measuredHeight = getMeasuredHeight();
View view = this.topView;
return (view == null || view.getVisibility() != 0) ? measuredHeight : (int) (measuredHeight - ((1.0f - this.topViewEnterProgress) * this.topView.getLayoutParams().height));
}
public void setAdjustPanLayoutHelper(AdjustPanLayoutHelper adjustPanLayoutHelper) {
this.adjustPanLayoutHelper = adjustPanLayoutHelper;
}
public AdjustPanLayoutHelper getAdjustPanLayoutHelper() {
return this.adjustPanLayoutHelper;
}
public boolean panelAnimationInProgress() {
return this.panelAnimation != null;
}
public float getTopViewTranslation() {
View view = this.topView;
if (view == null || view.getVisibility() == 8) {
return 0.0f;
}
return this.topView.getTranslationY();
}
public int getAnimatedTop() {
return this.animatedTop;
}
public class ScrimDrawable extends Drawable {
public Paint paint;
@Override
public int getOpacity() {
return -2;
}
@Override
public void setAlpha(int alpha) {
}
@Override
public void setColorFilter(ColorFilter colorFilter) {
}
public ScrimDrawable() {
Paint paint = new Paint();
this.paint = paint;
paint.setColor(0);
}
@Override
public void draw(Canvas canvas) {
if (ChatActivityEnterView.this.emojiView == null) {
return;
}
this.paint.setAlpha(Math.round(ChatActivityEnterView.this.stickersExpansionProgress * 102.0f));
float width = ChatActivityEnterView.this.getWidth();
float y = (ChatActivityEnterView.this.emojiView.getY() - ChatActivityEnterView.this.getHeight()) + Theme.chat_composeShadowDrawable.getIntrinsicHeight();
EditTextCaption editTextCaption = ChatActivityEnterView.this.messageEditText;
canvas.drawRect(0.0f, 0.0f, width, y + (editTextCaption == null ? 0.0f : editTextCaption.getOffsetY()), this.paint);
}
}
public class SlideTextView extends View {
public Paint arrowPaint;
public Path arrowPath;
public TextPaint bluePaint;
public float cancelAlpha;
public int cancelCharOffset;
public StaticLayout cancelLayout;
public android.graphics.Rect cancelRect;
public String cancelString;
public float cancelToProgress;
public float cancelWidth;
public TextPaint grayPaint;
public int lastSize;
public long lastUpdateTime;
public boolean moveForward;
public boolean pressed;
public Drawable selectableBackground;
public float slideProgress;
public float slideToAlpha;
public String slideToCancelString;
public float slideToCancelWidth;
public StaticLayout slideToLayout;
public boolean smallSize;
public float xOffset;
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == 3 || event.getAction() == 1) {
setPressed(false);
}
if (this.cancelToProgress == 0.0f || !isEnabled()) {
return false;
}
int x = (int) event.getX();
int y = (int) event.getY();
if (event.getAction() == 0) {
boolean contains = this.cancelRect.contains(x, y);
this.pressed = contains;
if (contains) {
if (Build.VERSION.SDK_INT >= 21) {
this.selectableBackground.setHotspot(x, y);
}
setPressed(true);
}
return this.pressed;
}
boolean z = this.pressed;
if (!z) {
return z;
}
if (event.getAction() == 2 && !this.cancelRect.contains(x, y)) {
setPressed(false);
return false;
}
if (event.getAction() == 1 && this.cancelRect.contains(x, y)) {
onCancelButtonPressed();
}
return true;
}
public void onCancelButtonPressed() {
long j = 0;
if (ChatActivityEnterView.this.hasRecordVideo && ChatActivityEnterView.this.isInVideoMode()) {
CameraController.getInstance().cancelOnInitRunnable(ChatActivityEnterView.this.onFinishInitCameraRunnable);
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = ChatActivityEnterView.this.delegate;
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
int i = chatActivityEnterView.voiceOnce ? Integer.MAX_VALUE : 0;
MessageSendPreview messageSendPreview = chatActivityEnterView.messageSendPreview;
chatActivityEnterViewDelegate.needStartRecordVideo(5, true, 0, i, messageSendPreview != null ? messageSendPreview.getSelectedEffect() : 0L);
} else {
ChatActivityEnterView.this.delegate.needStartRecordAudio(0);
MediaController.getInstance().stopRecording(0, false, 0, ChatActivityEnterView.this.voiceOnce);
}
ChatActivityEnterView.this.audioToSend = null;
ChatActivityEnterView.this.audioToSendMessageObject = null;
ChatActivityEnterView.this.videoToSendMessageObject = null;
ChatActivityEnterView.this.millisecondsRecorded = 0L;
ChatActivityEnterView.this.recordingAudioVideo = false;
MediaDataController mediaDataController = MediaDataController.getInstance(ChatActivityEnterView.this.currentAccount);
long j2 = ChatActivityEnterView.this.dialog_id;
if (ChatActivityEnterView.this.parentFragment != null && ChatActivityEnterView.this.parentFragment.isTopic) {
j = ChatActivityEnterView.this.parentFragment.getTopicId();
}
mediaDataController.pushDraftVoiceMessage(j2, j, null);
ChatActivityEnterView.this.updateRecordInterface(2, true);
ChatActivityEnterView.this.checkSendButton(true);
}
public SlideTextView(Context context) {
super(context);
this.arrowPaint = new Paint(1);
this.xOffset = 0.0f;
this.arrowPath = new Path();
this.cancelRect = new android.graphics.Rect();
this.smallSize = AndroidUtilities.displaySize.x <= AndroidUtilities.dp(320.0f);
TextPaint textPaint = new TextPaint(1);
this.grayPaint = textPaint;
textPaint.setTextSize(AndroidUtilities.dp(this.smallSize ? 13.0f : 15.0f));
TextPaint textPaint2 = new TextPaint(1);
this.bluePaint = textPaint2;
textPaint2.setTextSize(AndroidUtilities.dp(15.0f));
this.bluePaint.setTypeface(AndroidUtilities.bold());
this.arrowPaint.setColor(ChatActivityEnterView.this.getThemedColor(Theme.key_chat_messagePanelIcons));
this.arrowPaint.setStyle(Paint.Style.STROKE);
this.arrowPaint.setStrokeWidth(AndroidUtilities.dpf2(this.smallSize ? 1.0f : 1.6f));
this.arrowPaint.setStrokeCap(Paint.Cap.ROUND);
this.arrowPaint.setStrokeJoin(Paint.Join.ROUND);
this.slideToCancelString = LocaleController.getString(R.string.SlideToCancel2);
String upperCase = LocaleController.getString("Cancel", R.string.Cancel).toUpperCase();
this.cancelString = upperCase;
this.cancelCharOffset = this.slideToCancelString.indexOf(upperCase);
updateColors();
}
public void updateColors() {
this.grayPaint.setColor(ChatActivityEnterView.this.getThemedColor(Theme.key_chat_recordTime));
TextPaint textPaint = this.bluePaint;
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
int i = Theme.key_chat_recordVoiceCancel;
textPaint.setColor(chatActivityEnterView.getThemedColor(i));
this.slideToAlpha = this.grayPaint.getAlpha();
this.cancelAlpha = this.bluePaint.getAlpha();
Drawable createSimpleSelectorCircleDrawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(60.0f), 0, ColorUtils.setAlphaComponent(ChatActivityEnterView.this.getThemedColor(i), 26));
this.selectableBackground = createSimpleSelectorCircleDrawable;
createSimpleSelectorCircleDrawable.setCallback(this);
}
@Override
public void drawableStateChanged() {
super.drawableStateChanged();
this.selectableBackground.setState(getDrawableState());
}
@Override
public boolean verifyDrawable(Drawable drawable) {
return this.selectableBackground == drawable || super.verifyDrawable(drawable);
}
@Override
public void jumpDrawablesToCurrentState() {
super.jumpDrawablesToCurrentState();
Drawable drawable = this.selectableBackground;
if (drawable != null) {
drawable.jumpToCurrentState();
}
}
@Override
@SuppressLint({"DrawAllocation"})
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int measuredHeight = getMeasuredHeight() + (getMeasuredWidth() << 16);
if (this.lastSize != measuredHeight) {
this.lastSize = measuredHeight;
this.slideToCancelWidth = this.grayPaint.measureText(this.slideToCancelString);
this.cancelWidth = this.bluePaint.measureText(this.cancelString);
this.lastUpdateTime = System.currentTimeMillis();
int measuredHeight2 = getMeasuredHeight() >> 1;
this.arrowPath.reset();
if (this.smallSize) {
float f = measuredHeight2;
this.arrowPath.setLastPoint(AndroidUtilities.dpf2(2.5f), f - AndroidUtilities.dpf2(3.12f));
this.arrowPath.lineTo(0.0f, f);
this.arrowPath.lineTo(AndroidUtilities.dpf2(2.5f), f + AndroidUtilities.dpf2(3.12f));
} else {
float f2 = measuredHeight2;
this.arrowPath.setLastPoint(AndroidUtilities.dpf2(4.0f), f2 - AndroidUtilities.dpf2(5.0f));
this.arrowPath.lineTo(0.0f, f2);
this.arrowPath.lineTo(AndroidUtilities.dpf2(4.0f), f2 + AndroidUtilities.dpf2(5.0f));
}
this.slideToLayout = new StaticLayout(this.slideToCancelString, this.grayPaint, (int) this.slideToCancelWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.cancelLayout = new StaticLayout(this.cancelString, this.bluePaint, (int) this.cancelWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
}
}
@Override
public void onDraw(Canvas canvas) {
if (this.slideToLayout == null || this.cancelLayout == null || ChatActivityEnterView.this.recordCircle == null) {
return;
}
int width = this.cancelLayout.getWidth() + AndroidUtilities.dp(16.0f);
this.grayPaint.setColor(ChatActivityEnterView.this.getThemedColor(Theme.key_chat_recordTime));
this.grayPaint.setAlpha((int) (this.slideToAlpha * (1.0f - this.cancelToProgress) * this.slideProgress));
this.bluePaint.setAlpha((int) (this.cancelAlpha * this.cancelToProgress));
this.arrowPaint.setColor(this.grayPaint.getColor());
if (this.smallSize) {
this.xOffset = AndroidUtilities.dp(16.0f);
} else {
long currentTimeMillis = System.currentTimeMillis() - this.lastUpdateTime;
this.lastUpdateTime = System.currentTimeMillis();
if (this.cancelToProgress == 0.0f && this.slideProgress > 0.8f) {
if (this.moveForward) {
float dp = this.xOffset + ((AndroidUtilities.dp(3.0f) / 250.0f) * currentTimeMillis);
this.xOffset = dp;
if (dp > AndroidUtilities.dp(6.0f)) {
this.xOffset = AndroidUtilities.dp(6.0f);
this.moveForward = false;
}
} else {
float dp2 = this.xOffset - ((AndroidUtilities.dp(3.0f) / 250.0f) * currentTimeMillis);
this.xOffset = dp2;
if (dp2 < (-AndroidUtilities.dp(6.0f))) {
this.xOffset = -AndroidUtilities.dp(6.0f);
this.moveForward = true;
}
}
}
}
boolean z = this.cancelCharOffset >= 0;
int measuredWidth = ((int) ((getMeasuredWidth() - this.slideToCancelWidth) / 2.0f)) + AndroidUtilities.dp(5.0f);
int measuredWidth2 = (int) ((getMeasuredWidth() - this.cancelWidth) / 2.0f);
float primaryHorizontal = z ? this.slideToLayout.getPrimaryHorizontal(this.cancelCharOffset) : 0.0f;
float f = z ? (measuredWidth + primaryHorizontal) - measuredWidth2 : 0.0f;
float f2 = this.xOffset;
float f3 = this.cancelToProgress;
float dp3 = ((measuredWidth + ((f2 * (1.0f - f3)) * this.slideProgress)) - (f * f3)) + AndroidUtilities.dp(16.0f);
float dp4 = z ? 0.0f : this.cancelToProgress * AndroidUtilities.dp(12.0f);
if (this.cancelToProgress != 1.0f) {
int translationX = (int) ((((-getMeasuredWidth()) / 4) * (1.0f - this.slideProgress)) + (ChatActivityEnterView.this.recordCircle.getTranslationX() * 0.3f));
canvas.save();
canvas.clipRect((ChatActivityEnterView.this.recordTimerView == null ? 0.0f : ChatActivityEnterView.this.recordTimerView.getLeftProperty()) + AndroidUtilities.dp(4.0f), 0.0f, getMeasuredWidth(), getMeasuredHeight());
canvas.save();
int i = (int) dp3;
canvas.translate((i - AndroidUtilities.dp(this.smallSize ? 7.0f : 10.0f)) + translationX, dp4);
canvas.drawPath(this.arrowPath, this.arrowPaint);
canvas.restore();
canvas.save();
canvas.translate(i + translationX, ((getMeasuredHeight() - this.slideToLayout.getHeight()) / 2.0f) + dp4);
this.slideToLayout.draw(canvas);
canvas.restore();
canvas.restore();
}
float measuredHeight = (getMeasuredHeight() - this.cancelLayout.getHeight()) / 2.0f;
if (!z) {
measuredHeight -= AndroidUtilities.dp(12.0f) - dp4;
}
float f4 = z ? dp3 + primaryHorizontal : measuredWidth2;
this.cancelRect.set((int) f4, (int) measuredHeight, (int) (this.cancelLayout.getWidth() + f4), (int) (this.cancelLayout.getHeight() + measuredHeight));
this.cancelRect.inset(-AndroidUtilities.dp(16.0f), -AndroidUtilities.dp(16.0f));
if (this.cancelToProgress > 0.0f) {
this.selectableBackground.setBounds((getMeasuredWidth() / 2) - width, (getMeasuredHeight() / 2) - width, (getMeasuredWidth() / 2) + width, (getMeasuredHeight() / 2) + width);
this.selectableBackground.draw(canvas);
canvas.save();
canvas.translate(f4, measuredHeight);
this.cancelLayout.draw(canvas);
canvas.restore();
} else {
setPressed(false);
}
if (this.cancelToProgress != 1.0f) {
invalidate();
}
}
@Keep
public void setCancelToProgress(float cancelToProgress) {
this.cancelToProgress = cancelToProgress;
}
@Keep
public float getSlideToCancelWidth() {
return this.slideToCancelWidth;
}
public void setSlideX(float v) {
this.slideProgress = v;
}
}
public class TimerView extends View {
public StaticLayout inLayout;
public boolean isRunning;
public long lastSendTypingTime;
public float left;
public String oldString;
public StaticLayout outLayout;
public final float replaceDistance;
public SpannableStringBuilder replaceIn;
public SpannableStringBuilder replaceOut;
public SpannableStringBuilder replaceStable;
public float replaceTransition;
public long startTime;
public long stopTime;
public boolean stoppedInternal;
public TextPaint textPaint;
public TimerView(Context context) {
super(context);
this.replaceIn = new SpannableStringBuilder();
this.replaceOut = new SpannableStringBuilder();
this.replaceStable = new SpannableStringBuilder();
this.replaceDistance = AndroidUtilities.dp(15.0f);
}
public void start(long milliseconds) {
this.isRunning = true;
long currentTimeMillis = System.currentTimeMillis() - milliseconds;
this.startTime = currentTimeMillis;
this.lastSendTypingTime = currentTimeMillis;
invalidate();
}
public void stop() {
if (this.isRunning) {
this.isRunning = false;
if (this.startTime > 0) {
this.stopTime = System.currentTimeMillis();
}
invalidate();
}
this.lastSendTypingTime = 0L;
}
@Override
@SuppressLint({"DrawAllocation"})
public void onDraw(Canvas canvas) {
String str;
if (this.textPaint == null) {
TextPaint textPaint = new TextPaint(1);
this.textPaint = textPaint;
textPaint.setTextSize(AndroidUtilities.dp(15.0f));
this.textPaint.setTypeface(AndroidUtilities.bold());
this.textPaint.setColor(ChatActivityEnterView.this.getThemedColor(Theme.key_chat_recordTime));
}
long currentTimeMillis = System.currentTimeMillis();
long j = this.isRunning ? currentTimeMillis - this.startTime : this.stopTime - this.startTime;
long j2 = j / 1000;
int i = ((int) (j % 1000)) / 10;
if (ChatActivityEnterView.this.isInVideoMode() && j >= 59500 && !this.stoppedInternal) {
ChatActivityEnterView.this.startedDraggingX = -1.0f;
ChatActivityEnterViewDelegate chatActivityEnterViewDelegate = ChatActivityEnterView.this.delegate;
ChatActivityEnterView chatActivityEnterView = ChatActivityEnterView.this;
int i2 = chatActivityEnterView.voiceOnce ? Integer.MAX_VALUE : 0;
MessageSendPreview messageSendPreview = chatActivityEnterView.messageSendPreview;
chatActivityEnterViewDelegate.needStartRecordVideo(3, true, 0, i2, messageSendPreview != null ? messageSendPreview.getSelectedEffect() : 0L);
this.stoppedInternal = true;
}
if (this.isRunning && currentTimeMillis > this.lastSendTypingTime + 5000) {
this.lastSendTypingTime = currentTimeMillis;
MessagesController.getInstance(ChatActivityEnterView.this.currentAccount).sendTyping(ChatActivityEnterView.this.dialog_id, ChatActivityEnterView.this.getThreadMessageId(), ChatActivityEnterView.this.isInVideoMode() ? 7 : 1, 0);
}
String formatTimerDurationFast = AndroidUtilities.formatTimerDurationFast((int) j2, i);
if (formatTimerDurationFast.length() >= 3 && (str = this.oldString) != null && str.length() >= 3 && formatTimerDurationFast.length() == this.oldString.length() && formatTimerDurationFast.charAt(formatTimerDurationFast.length() - 3) != this.oldString.charAt(formatTimerDurationFast.length() - 3)) {
int length = formatTimerDurationFast.length();
this.replaceIn.clear();
this.replaceOut.clear();
this.replaceStable.clear();
this.replaceIn.append((CharSequence) formatTimerDurationFast);
this.replaceOut.append((CharSequence) this.oldString);
this.replaceStable.append((CharSequence) formatTimerDurationFast);
int i3 = -1;
int i4 = -1;
int i5 = 0;
int i6 = 0;
for (int i7 = 0; i7 < length - 1; i7++) {
if (this.oldString.charAt(i7) != formatTimerDurationFast.charAt(i7)) {
if (i6 == 0) {
i4 = i7;
}
i6++;
if (i5 != 0) {
EmptyStubSpan emptyStubSpan = new EmptyStubSpan();
if (i7 == length - 2) {
i5++;
}
int i8 = i5 + i3;
this.replaceIn.setSpan(emptyStubSpan, i3, i8, 33);
this.replaceOut.setSpan(emptyStubSpan, i3, i8, 33);
i5 = 0;
}
} else {
if (i5 == 0) {
i3 = i7;
}
i5++;
if (i6 != 0) {
this.replaceStable.setSpan(new EmptyStubSpan(), i4, i6 + i4, 33);
i6 = 0;
}
}
}
if (i5 != 0) {
EmptyStubSpan emptyStubSpan2 = new EmptyStubSpan();
int i9 = i5 + i3 + 1;
this.replaceIn.setSpan(emptyStubSpan2, i3, i9, 33);
this.replaceOut.setSpan(emptyStubSpan2, i3, i9, 33);
}
if (i6 != 0) {
this.replaceStable.setSpan(new EmptyStubSpan(), i4, i6 + i4, 33);
}
this.inLayout = new StaticLayout(this.replaceIn, this.textPaint, getMeasuredWidth(), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.outLayout = new StaticLayout(this.replaceOut, this.textPaint, getMeasuredWidth(), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.replaceTransition = 1.0f;
} else {
if (this.replaceStable == null) {
this.replaceStable = new SpannableStringBuilder(formatTimerDurationFast);
}
if (this.replaceStable.length() == 0 || this.replaceStable.length() != formatTimerDurationFast.length()) {
this.replaceStable.clear();
this.replaceStable.append((CharSequence) formatTimerDurationFast);
} else {
this.replaceStable.replace(r10.length() - 1, this.replaceStable.length(), (CharSequence) formatTimerDurationFast, (formatTimerDurationFast.length() - 1) - (formatTimerDurationFast.length() - this.replaceStable.length()), formatTimerDurationFast.length());
}
}
float f = this.replaceTransition;
if (f != 0.0f) {
float f2 = f - 0.15f;
this.replaceTransition = f2;
if (f2 < 0.0f) {
this.replaceTransition = 0.0f;
}
}
float measuredHeight = getMeasuredHeight() / 2;
if (this.replaceTransition == 0.0f) {
this.replaceStable.clearSpans();
StaticLayout staticLayout = new StaticLayout(this.replaceStable, this.textPaint, getMeasuredWidth(), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
canvas.save();
canvas.translate(0.0f, measuredHeight - (staticLayout.getHeight() / 2.0f));
staticLayout.draw(canvas);
canvas.restore();
this.left = staticLayout.getLineWidth(0) + 0.0f;
} else {
if (this.inLayout != null) {
canvas.save();
this.textPaint.setAlpha((int) ((1.0f - this.replaceTransition) * 255.0f));
canvas.translate(0.0f, (measuredHeight - (this.inLayout.getHeight() / 2.0f)) - (this.replaceDistance * this.replaceTransition));
this.inLayout.draw(canvas);
canvas.restore();
}
if (this.outLayout != null) {
canvas.save();
this.textPaint.setAlpha((int) (this.replaceTransition * 255.0f));
canvas.translate(0.0f, (measuredHeight - (this.outLayout.getHeight() / 2.0f)) + (this.replaceDistance * (1.0f - this.replaceTransition)));
this.outLayout.draw(canvas);
canvas.restore();
}
canvas.save();
this.textPaint.setAlpha(255);
StaticLayout staticLayout2 = new StaticLayout(this.replaceStable, this.textPaint, getMeasuredWidth(), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
canvas.translate(0.0f, measuredHeight - (staticLayout2.getHeight() / 2.0f));
staticLayout2.draw(canvas);
canvas.restore();
this.left = staticLayout2.getLineWidth(0) + 0.0f;
}
this.oldString = formatTimerDurationFast;
if (this.isRunning || this.replaceTransition != 0.0f) {
invalidate();
}
}
public void updateColors() {
TextPaint textPaint = this.textPaint;
if (textPaint != null) {
textPaint.setColor(ChatActivityEnterView.this.getThemedColor(Theme.key_chat_recordTime));
}
}
public float getLeftProperty() {
return this.left;
}
public void reset() {
this.isRunning = false;
this.startTime = 0L;
this.stopTime = 0L;
this.stoppedInternal = false;
}
}
public RecordCircle getRecordCircle() {
return this.recordCircle;
}
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
BotCommandsMenuView botCommandsMenuView = this.botCommandsMenuButton;
if (botCommandsMenuView != null && botCommandsMenuView.getTag() != null) {
this.botCommandsMenuButton.measure(widthMeasureSpec, heightMeasureSpec);
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.emojiButton.getLayoutParams();
int dp = AndroidUtilities.dp(10.0f);
BotCommandsMenuView botCommandsMenuView2 = this.botCommandsMenuButton;
marginLayoutParams.leftMargin = dp + (botCommandsMenuView2 == null ? 0 : botCommandsMenuView2.getMeasuredWidth());
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null) {
ViewGroup.MarginLayoutParams marginLayoutParams2 = (ViewGroup.MarginLayoutParams) editTextCaption.getLayoutParams();
int dp2 = AndroidUtilities.dp(57.0f);
BotCommandsMenuView botCommandsMenuView3 = this.botCommandsMenuButton;
marginLayoutParams2.leftMargin = dp2 + (botCommandsMenuView3 == null ? 0 : botCommandsMenuView3.getMeasuredWidth());
}
} else {
SenderSelectView senderSelectView = this.senderSelectView;
if (senderSelectView != null && senderSelectView.getVisibility() == 0) {
int i = this.senderSelectView.getLayoutParams().width;
this.senderSelectView.measure(View.MeasureSpec.makeMeasureSpec(i, 1073741824), View.MeasureSpec.makeMeasureSpec(this.senderSelectView.getLayoutParams().height, 1073741824));
((ViewGroup.MarginLayoutParams) this.emojiButton.getLayoutParams()).leftMargin = AndroidUtilities.dp(16.0f) + i;
EditTextCaption editTextCaption2 = this.messageEditText;
if (editTextCaption2 != null) {
((ViewGroup.MarginLayoutParams) editTextCaption2.getLayoutParams()).leftMargin = AndroidUtilities.dp(63.0f) + i;
}
} else {
((ViewGroup.MarginLayoutParams) this.emojiButton.getLayoutParams()).leftMargin = AndroidUtilities.dp(3.0f);
EditTextCaption editTextCaption3 = this.messageEditText;
if (editTextCaption3 != null) {
((ViewGroup.MarginLayoutParams) editTextCaption3.getLayoutParams()).leftMargin = AndroidUtilities.dp(50.0f);
}
}
}
updateBotCommandsMenuContainerTopPadding();
super/*android.widget.FrameLayout*/.onMeasure(widthMeasureSpec, heightMeasureSpec);
ChatActivityBotWebViewButton chatActivityBotWebViewButton = this.botWebViewButton;
if (chatActivityBotWebViewButton != null) {
BotCommandsMenuView botCommandsMenuView4 = this.botCommandsMenuButton;
if (botCommandsMenuView4 != null) {
chatActivityBotWebViewButton.setMeasuredButtonWidth(botCommandsMenuView4.getMeasuredWidth());
}
this.botWebViewButton.getLayoutParams().height = getMeasuredHeight() - AndroidUtilities.dp(2.0f);
measureChild(this.botWebViewButton, widthMeasureSpec, heightMeasureSpec);
}
BotWebViewMenuContainer botWebViewMenuContainer = this.botWebViewMenuContainer;
if (botWebViewMenuContainer != null) {
ViewGroup.MarginLayoutParams marginLayoutParams3 = (ViewGroup.MarginLayoutParams) botWebViewMenuContainer.getLayoutParams();
EditTextCaption editTextCaption4 = this.messageEditText;
marginLayoutParams3.bottomMargin = editTextCaption4 != null ? editTextCaption4.getMeasuredHeight() : 0;
measureChild(this.botWebViewMenuContainer, widthMeasureSpec, heightMeasureSpec);
}
}
public void onLayout(boolean changed, int left, int top, int right, int bottom) {
BotCommandsMenuContainer botCommandsMenuContainer;
super/*android.widget.FrameLayout*/.onLayout(changed, left, top, right, bottom);
if (this.botCommandLastPosition == -1 || (botCommandsMenuContainer = this.botCommandsMenuContainer) == null) {
return;
}
LinearLayoutManager layoutManager = botCommandsMenuContainer.listView.getLayoutManager();
if (layoutManager != null) {
layoutManager.scrollToPositionWithOffset(this.botCommandLastPosition, this.botCommandLastTop);
}
this.botCommandLastPosition = -1;
}
public final void beginDelayedTransition() {
HashMap<View, Float> hashMap = this.animationParamsX;
ChatActivityEnterViewAnimatedIconView chatActivityEnterViewAnimatedIconView = this.emojiButton;
hashMap.put(chatActivityEnterViewAnimatedIconView, Float.valueOf(chatActivityEnterViewAnimatedIconView.getX()));
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null) {
this.animationParamsX.put(editTextCaption, Float.valueOf(editTextCaption.getX()));
}
}
public void setBotInfo(LongSparseArray<TLRPC.BotInfo> botInfo) {
setBotInfo(botInfo, true);
}
public void setBotInfo(LongSparseArray<TLRPC.BotInfo> botInfo, boolean animate) {
this.lastBotInfo = botInfo;
if (botInfo.size() == 1 && ((TLRPC.BotInfo) botInfo.valueAt(0)).user_id == this.dialog_id) {
TLRPC.BotInfo botInfo2 = (TLRPC.BotInfo) botInfo.valueAt(0);
TLRPC.BotMenuButton botMenuButton = botInfo2.menu_button;
if (botMenuButton instanceof TLRPC.TL_botMenuButton) {
TLRPC.TL_botMenuButton tL_botMenuButton = (TLRPC.TL_botMenuButton) botMenuButton;
this.botMenuWebViewTitle = tL_botMenuButton.text;
this.botMenuWebViewUrl = tL_botMenuButton.url;
this.botMenuButtonType = BotMenuButtonType.WEB_VIEW;
} else if (!botInfo2.commands.isEmpty()) {
this.botMenuButtonType = BotMenuButtonType.COMMANDS;
} else {
this.botMenuButtonType = BotMenuButtonType.NO_BUTTON;
}
} else {
this.botMenuButtonType = BotMenuButtonType.NO_BUTTON;
}
BotCommandsMenuView.BotCommandsAdapter botCommandsAdapter = this.botCommandsAdapter;
if (botCommandsAdapter != null) {
botCommandsAdapter.setBotInfo(botInfo);
}
updateBotButton(animate);
}
public boolean botCommandsMenuIsShowing() {
BotCommandsMenuView botCommandsMenuView = this.botCommandsMenuButton;
return botCommandsMenuView != null && botCommandsMenuView.isOpened();
}
public void hideBotCommands() {
BotCommandsMenuView botCommandsMenuView = this.botCommandsMenuButton;
if (botCommandsMenuView != null) {
botCommandsMenuView.setOpened(false);
}
if (hasBotWebView()) {
BotWebViewMenuContainer botWebViewMenuContainer = this.botWebViewMenuContainer;
if (botWebViewMenuContainer != null) {
botWebViewMenuContainer.dismiss();
return;
}
return;
}
BotCommandsMenuContainer botCommandsMenuContainer = this.botCommandsMenuContainer;
if (botCommandsMenuContainer != null) {
botCommandsMenuContainer.dismiss();
}
}
public void setTextTransitionIsRunning(boolean b) {
this.textTransitionIsRunning = b;
this.sendButtonContainer.invalidate();
}
public float getTopViewHeight() {
View view = this.topView;
if (view == null || view.getVisibility() != 0) {
return 0.0f;
}
return this.topView.getLayoutParams().height;
}
public void runEmojiPanelAnimation() {
AndroidUtilities.cancelRunOnUIThread(this.runEmojiPanelAnimation);
this.runEmojiPanelAnimation.run();
}
public Drawable getStickersArrowDrawable() {
return this.stickersArrow;
}
public void dispatchDraw(Canvas canvas) {
EmojiView emojiView = this.emojiView;
if (emojiView == null || emojiView.getVisibility() != 0 || this.emojiView.getStickersExpandOffset() == 0.0f) {
super.dispatchDraw(canvas);
return;
}
canvas.save();
canvas.clipRect(0, AndroidUtilities.dp(2.0f), getMeasuredWidth(), getMeasuredHeight());
canvas.translate(0.0f, -this.emojiView.getStickersExpandOffset());
super.dispatchDraw(canvas);
canvas.restore();
}
public final int getThemedColor(int key) {
Theme.ResourcesProvider resourcesProvider = this.resourcesProvider;
if (resourcesProvider != null) {
return resourcesProvider.getColor(key);
}
return Theme.getColor(key);
}
public final Paint getThemedPaint(String paintKey) {
Theme.ResourcesProvider resourcesProvider = this.resourcesProvider;
Paint paint = resourcesProvider != null ? resourcesProvider.getPaint(paintKey) : null;
return paint != null ? paint : Theme.getThemePaint(paintKey);
}
public void setChatSearchExpandOffset(float chatSearchExpandOffset) {
this.chatSearchExpandOffset = chatSearchExpandOffset;
invalidate();
}
public void setHorizontalPadding(float padding, float progress, boolean allowShare) {
SeekBarWaveformView seekBarWaveformView;
float f = 1.0f - progress;
float f2 = (-padding) * f;
float f3 = (-(AndroidUtilities.dp(40.0f) + padding)) * f;
this.emojiButtonPaddingScale = (progress * 0.5f) + 0.5f;
this.emojiButtonPaddingAlpha = progress;
updateEmojiButtonParams();
float f4 = -f2;
this.emojiButton.setTranslationX(f4);
this.messageTextPaddingTranslationX = f4 - (AndroidUtilities.dp(31.0f) * f);
RLottieImageView rLottieImageView = this.recordDeleteImageView;
if (rLottieImageView != null) {
rLottieImageView.setTranslationX(f4);
}
RecordCircle recordCircle = this.recordCircle;
if (recordCircle != null) {
recordCircle.setTranslationX(f3);
}
ControlsView controlsView = this.controlsView;
if (controlsView != null) {
controlsView.setTranslationX(f3);
}
LinearLayout linearLayout = this.recordTimeContainer;
if (linearLayout != null) {
linearLayout.setTranslationX(f4);
}
ImageView imageView = this.recordedAudioPlayButton;
if (imageView != null) {
imageView.setTranslationX(f4);
}
TextView textView = this.recordedAudioTimeTextView;
if (textView != null) {
textView.setTranslationX(f2);
}
this.sendButtonContainer.setTranslationX(f3);
this.sendButtonContainer.setAlpha(allowShare ? progress : 1.0f);
boolean z = true;
if (allowShare && progress != 1.0f) {
z = false;
}
this.sendButtonEnabled = z;
this.attachLayoutPaddingTranslationX = f3;
this.attachLayoutPaddingAlpha = progress;
updateAttachLayoutParams();
updateMessageTextParams();
float f5 = padding * f;
if (this.horizontalPadding != f5) {
this.horizontalPadding = f5;
if (this.seekBarWaveform != null && (seekBarWaveformView = this.recordedAudioSeekBar) != null) {
seekBarWaveformView.setTranslationX(f5);
this.recordedAudioSeekBar.invalidate();
this.seekBarWaveform.setSize((int) (this.recordedAudioSeekBar.getMeasuredWidth() - (this.horizontalPadding * 2.0f)), this.recordedAudioSeekBar.getMeasuredHeight());
}
View view = this.recordedAudioBackground;
if (view != null) {
view.invalidate();
}
}
if (this.messageEditText != null) {
float lerp = AndroidUtilities.lerp(0.88f, 1.0f, progress);
this.messageEditText.setPivotX(0.0f);
this.messageEditText.setPivotY(r9.getMeasuredHeight() / 2.0f);
this.messageEditText.setScaleX(lerp);
this.messageEditText.setScaleY(lerp);
this.messageEditText.setHintRightOffset(AndroidUtilities.lerp(AndroidUtilities.dp(30.0f), 0, progress));
}
}
public final void updateMessageTextParams() {
EditTextCaption editTextCaption = this.messageEditText;
if (editTextCaption != null) {
editTextCaption.setTranslationX(this.messageTextPaddingTranslationX + this.messageTextTranslationX);
}
}
public final void updateAttachLayoutParams() {
LinearLayout linearLayout = this.attachLayout;
if (linearLayout != null) {
linearLayout.setTranslationX(this.attachLayoutPaddingTranslationX + this.attachLayoutTranslationX);
this.attachLayout.setAlpha(this.attachLayoutAlpha * this.attachLayoutPaddingAlpha);
LinearLayout linearLayout2 = this.attachLayout;
linearLayout2.setVisibility(linearLayout2.getAlpha() > 0.0f ? 0 : 8);
}
}
public final void updateEmojiButtonParams() {
this.emojiButton.setScaleX(this.emojiButtonPaddingScale * this.emojiButtonScale);
this.emojiButton.setScaleY(this.emojiButtonPaddingScale * this.emojiButtonScale);
this.emojiButton.setAlpha(this.emojiButtonPaddingAlpha * this.emojiButtonAlpha);
}
public void setOverrideHint(CharSequence overrideHint) {
setOverrideHint(overrideHint, false);
}
public void setOverrideHint(CharSequence overrideHint, boolean animated) {
this.overrideHint = overrideHint;
this.overrideHint2 = null;
updateFieldHint(animated);
}
public void setOverrideHint(CharSequence overrideHint, CharSequence overrideHint2, boolean animated) {
this.overrideHint = overrideHint;
this.overrideHint2 = overrideHint2;
updateFieldHint(animated);
}
public void setOverrideKeyboardAnimation(boolean overrideKeyboardAnimation) {
this.overrideKeyboardAnimation = overrideKeyboardAnimation;
}
public void onOverrideAnimationEnd() {
Runnable runnable = this.animationEndRunnable;
if (runnable != null) {
runnable.run();
this.animationEndRunnable = null;
}
}
public int getStickersExpandedHeight() {
return this.stickersExpandedHeight;
}
public void reset() {
setStickersExpanded(false, true, false);
showPopup(0, 0, false);
if (getEditField() != null && !TextUtils.isEmpty(getEditField().getText())) {
getEditField().setText(BuildConfig.APP_CENTER_HASH);
}
this.recordingAudioVideo = false;
ChatActivityEnterViewAnimatedIconView chatActivityEnterViewAnimatedIconView = this.audioVideoSendButton;
if (chatActivityEnterViewAnimatedIconView != null) {
chatActivityEnterViewAnimatedIconView.setVisibility(0);
}
this.recordIsCanceled = true;
isRecordingStateChanged();
cancelRecordInterfaceInternal();
hideRecordedAudioPanelInternal();
ControlsView controlsView = this.controlsView;
if (controlsView != null) {
controlsView.setVisibility(8);
}
RecordCircle recordCircle = this.recordCircle;
if (recordCircle != null) {
recordCircle.setSendButtonInvisible();
}
}
public void freezeEmojiView(boolean freeze) {
this.emojiViewFrozen = freeze;
EmojiView emojiView = this.emojiView;
if (emojiView != null) {
emojiView.freeze(freeze);
}
}
public static class SendButton extends View {
public final Paint backgroundPaint;
public ValueAnimator bounceCountAnimator;
public boolean center;
public final AnimatedTextView.AnimatedTextDrawable count;
public float countBounceScale;
public final Paint countClearPaint;
public final Drawable drawable;
public int drawableColor;
public final Drawable drawableInverse;
public final Drawable inactiveDrawable;
public boolean infiniteLoading;
public final AnimatedFloat loadingAnimatedProgress;
public final AnimatedFloat loadingAnimatedShown;
public final FastOutSlowInInterpolator loadingInterpolator;
public final Paint loadingPaint;
public float loadingProgress;
public boolean loadingShown;
public final AnimatedFloat open;
public final Path path;
public final int resId;
public final Theme.ResourcesProvider resourcesProvider;
public boolean isInScheduleMode() {
return false;
}
public boolean isInactive() {
return false;
}
public boolean isOpen() {
return false;
}
public boolean shouldDrawBackground() {
return false;
}
public SendButton(Context context, int resId, Theme.ResourcesProvider resourcesProvider) {
super(context);
this.backgroundPaint = new Paint(1);
Paint paint = new Paint(1);
this.countClearPaint = paint;
CubicBezierInterpolator cubicBezierInterpolator = CubicBezierInterpolator.EASE_OUT_QUINT;
this.open = new AnimatedFloat(this, 0L, 420L, cubicBezierInterpolator);
this.loadingInterpolator = new FastOutSlowInInterpolator();
this.loadingAnimatedShown = new AnimatedFloat(this, 0L, 420L, cubicBezierInterpolator);
this.loadingAnimatedProgress = new AnimatedFloat(this, 0L, 500L, cubicBezierInterpolator);
this.path = new Path();
Paint paint2 = new Paint(1);
this.loadingPaint = paint2;
AnimatedTextView.AnimatedTextDrawable animatedTextDrawable = new AnimatedTextView.AnimatedTextDrawable(true, true, true);
this.count = animatedTextDrawable;
this.countBounceScale = 1.0f;
this.resId = resId;
this.resourcesProvider = resourcesProvider;
this.drawable = context.getResources().getDrawable(resId).mutate();
this.inactiveDrawable = context.getResources().getDrawable(resId).mutate();
this.drawableInverse = context.getResources().getDrawable(resId).mutate();
paint2.setStyle(Paint.Style.STROKE);
paint2.setStrokeWidth(AndroidUtilities.dp(2.0f));
paint2.setStrokeJoin(Paint.Join.ROUND);
paint2.setStrokeCap(Paint.Cap.ROUND);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
animatedTextDrawable.setCallback(this);
animatedTextDrawable.setTextColor(-1);
animatedTextDrawable.setTextSize(AndroidUtilities.dp(14.0f));
animatedTextDrawable.setTypeface(AndroidUtilities.getTypeface("fonts/num.otf"));
animatedTextDrawable.setGravity(17);
}
@Override
public boolean verifyDrawable(Drawable who) {
return who == this.count || super.verifyDrawable(who);
}
@Override
public void invalidate(int l, int t, int r, int b) {
super.invalidate(l, t, r, b);
}
public int getFillColor() {
return Theme.getColor(Theme.key_chat_messagePanelSend, this.resourcesProvider);
}
@Override
public void onDraw(Canvas canvas) {
int i;
float f;
float f2;
canvas.saveLayerAlpha(0.0f, 0.0f, getWidth(), getHeight(), 255, 31);
boolean isOpen = isOpen();
updateColors(isOpen);
Drawable drawable = isInactive() ? this.inactiveDrawable : this.drawable;
int measuredWidth = (getMeasuredWidth() - drawable.getIntrinsicWidth()) / 2;
int measuredHeight = (getMeasuredHeight() - drawable.getIntrinsicHeight()) / 2;
if (!this.center) {
if (isInScheduleMode()) {
measuredHeight -= AndroidUtilities.dp(1.0f);
} else {
measuredWidth += AndroidUtilities.dp(2.0f);
}
}
int i2 = measuredWidth;
int i3 = measuredHeight;
float f3 = this.loadingAnimatedShown.set(this.loadingShown);
float f4 = this.open.set(isOpen);
if (f4 < 1.0f) {
drawable.setBounds(i2, i3, drawable.getIntrinsicWidth() + i2, drawable.getIntrinsicHeight() + i3);
drawable.draw(canvas);
}
if (f4 > 0.0f) {
int measuredWidth2 = getMeasuredWidth() / 2;
int measuredHeight2 = getMeasuredHeight() / 2;
canvas.save();
this.path.rewind();
float f5 = measuredWidth2;
float f6 = measuredHeight2;
this.path.addCircle(f5, f6, (measuredWidth2 - AndroidUtilities.dp(4.0f)) * f4, Path.Direction.CW);
canvas.drawCircle(f5, f6, (measuredWidth2 - AndroidUtilities.dp(4.0f)) * f4, this.backgroundPaint);
canvas.clipPath(this.path);
if (f3 > 0.0f) {
this.loadingPaint.setColor(-1);
this.loadingPaint.setAlpha((int) (f3 * 255.0f));
float dp = AndroidUtilities.dp(8.66f);
RectF rectF = AndroidUtilities.rectTmp;
rectF.set(f5 - dp, f6 - dp, f5 + dp, dp + f6);
if (this.infiniteLoading) {
long currentTimeMillis = System.currentTimeMillis() % 5400;
float f7 = (1520 * currentTimeMillis) / 5400.0f;
int i4 = 0;
float f8 = f7;
float max = Math.max(0.0f, f7 - 20.0f);
while (i4 < 4) {
int i5 = i4 * 1350;
f8 += this.loadingInterpolator.getInterpolation((currentTimeMillis - i5) / 667.0f) * 250.0f;
max += this.loadingInterpolator.getInterpolation((currentTimeMillis - (i5 + 667)) / 667.0f) * 250.0f;
i4++;
f5 = f5;
i2 = i2;
}
i = i2;
f2 = f5;
canvas.drawArc(AndroidUtilities.rectTmp, max, f8 - max, false, this.loadingPaint);
} else {
i = i2;
f2 = f5;
canvas.drawArc(rectF, ((((System.currentTimeMillis() % 3000) / 1000.0f) * 120.0f) % 360.0f) - 90.0f, 360.0f * this.loadingAnimatedProgress.set(this.loadingProgress), false, this.loadingPaint);
}
canvas.save();
f = 1.0f;
float lerp = AndroidUtilities.lerp(1.0f, 0.6f, f3);
canvas.scale(lerp, lerp, f2, f6);
invalidate();
} else {
i = i2;
f = 1.0f;
}
this.drawableInverse.setAlpha((int) ((f - f3) * 255.0f));
Drawable drawable2 = this.drawableInverse;
drawable2.setBounds(i, i3, i + drawable2.getIntrinsicWidth(), this.drawableInverse.getIntrinsicHeight() + i3);
this.drawableInverse.draw(canvas);
if (f3 > 0.0f) {
canvas.restore();
}
canvas.restore();
}
float max2 = Math.max(AndroidUtilities.dp(12.0f) + this.count.getCurrentWidth(), AndroidUtilities.dp(24.0f)) / 2.0f;
float measuredWidth3 = getMeasuredWidth() - max2;
float measuredHeight3 = getMeasuredHeight() - max2;
this.count.setBounds((int) (measuredWidth3 - max2), (int) (measuredHeight3 - max2), (int) (measuredWidth3 + max2), (int) (measuredHeight3 + max2));
float isNotEmpty = this.count.isNotEmpty();
if (isNotEmpty > 0.0f) {
canvas.drawCircle(measuredWidth3, measuredHeight3, (AndroidUtilities.dp(2.0f) + max2) * isNotEmpty * this.countBounceScale, this.countClearPaint);
canvas.drawCircle(measuredWidth3, measuredHeight3, max2 * isNotEmpty * this.countBounceScale, this.backgroundPaint);
this.count.draw(canvas);
}
canvas.restore();
super.onDraw(canvas);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (getAlpha() <= 0.0f) {
return false;
}
return super.onTouchEvent(event);
}
public final void updateColors(boolean showingPopup) {
int i = Theme.key_chat_messagePanelSend;
int color = Theme.getColor(i, this.resourcesProvider);
if (color != this.drawableColor) {
this.drawableColor = color;
this.drawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(i, this.resourcesProvider), PorterDuff.Mode.SRC_IN));
int color2 = Theme.getColor(Theme.key_chat_messagePanelIcons, this.resourcesProvider);
this.inactiveDrawable.setColorFilter(new PorterDuffColorFilter(Color.argb(180, Color.red(color2), Color.green(color2), Color.blue(color2)), PorterDuff.Mode.SRC_IN));
this.drawableInverse.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_messagePanelVoicePressed, this.resourcesProvider), PorterDuff.Mode.SRC_IN));
}
if (shouldDrawBackground()) {
this.backgroundPaint.setColor(getFillColor());
} else {
this.backgroundPaint.setColor(ColorUtils.setAlphaComponent(-1, 75));
}
}
public void setLoading(boolean shown, float progress) {
if (this.loadingShown == shown && (!shown || Math.abs(this.loadingProgress - progress) < 0.01f)) {
if (this.infiniteLoading == (Math.abs(progress - (-3.0f)) < 0.01f)) {
return;
}
}
this.infiniteLoading = Math.abs(progress - (-3.0f)) < 0.01f;
if (!this.loadingShown && shown) {
this.loadingAnimatedProgress.set(0.0f, true);
}
AnimatedFloat animatedFloat = this.loadingAnimatedShown;
animatedFloat.setDelay((!shown || animatedFloat.get() < 1.0f) ? 0L : 650L);
this.loadingShown = shown;
if (!shown) {
progress = 1.0f;
}
this.loadingProgress = progress;
invalidate();
}
public void setCount(int count, boolean animated) {
AnimatedTextView.AnimatedTextDrawable animatedTextDrawable = this.count;
String str = BuildConfig.APP_CENTER_HASH;
if (count > 0) {
str = BuildConfig.APP_CENTER_HASH + count;
}
animatedTextDrawable.setText(str, animated);
invalidate();
}
public void copyCountTo(SendButton sendButton) {
sendButton.count.setText(this.count.getText(), false);
sendButton.countBounceScale = this.countBounceScale;
}
public void bounceCount() {
ValueAnimator valueAnimator = this.bounceCountAnimator;
if (valueAnimator != null) {
valueAnimator.cancel();
}
ValueAnimator ofFloat = ValueAnimator.ofFloat(0.9f, 1.0f);
this.bounceCountAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
ChatActivityEnterView.SendButton.this.lambda$bounceCount$0(valueAnimator2);
}
});
this.bounceCountAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
SendButton.this.countBounceScale = 1.0f;
}
});
this.bounceCountAnimator.setDuration(180L);
this.bounceCountAnimator.setInterpolator(new OvershootInterpolator());
this.bounceCountAnimator.start();
}
public void lambda$bounceCount$0(ValueAnimator valueAnimator) {
this.countBounceScale = ((Float) valueAnimator.getAnimatedValue()).floatValue();
}
}
public boolean drawMessageEditText(Canvas canvas, Utilities.Callback0Return<Boolean> drawChild) {
float f = this.topGradientAlpha.set(this.messageEditText.canScrollVertically(-1));
float f2 = this.bottomGradientAlpha.set(this.messageEditText.canScrollVertically(1));
if (f <= 0.0f && f2 <= 0.0f) {
return drawChild.run().booleanValue();
}
canvas.saveLayerAlpha(0.0f, 0.0f, AndroidUtilities.dp(5.0f) + this.messageEditText.getX() + this.messageEditText.getMeasuredWidth(), AndroidUtilities.dp(2.0f) + this.messageEditText.getY() + this.messageEditText.getMeasuredHeight(), 255, 31);
boolean booleanValue = drawChild.run().booleanValue();
canvas.save();
if (f > 0.0f) {
RectF rectF = AndroidUtilities.rectTmp;
rectF.set(this.messageEditText.getX() - AndroidUtilities.dp(5.0f), (this.messageEditText.getY() + this.animatedTop) - 1.0f, this.messageEditText.getX() + this.messageEditText.getMeasuredWidth() + AndroidUtilities.dp(5.0f), this.messageEditText.getY() + this.animatedTop + AndroidUtilities.dp(13.0f));
this.clipMatrix.reset();
this.clipMatrix.postScale(1.0f, rectF.height() / 16.0f);
this.clipMatrix.postTranslate(rectF.left, rectF.top);
this.clipGradient.setLocalMatrix(this.clipMatrix);
this.gradientPaint.setAlpha((int) (f * 255.0f));
canvas.drawRect(rectF, this.gradientPaint);
}
if (f2 > 0.0f) {
RectF rectF2 = AndroidUtilities.rectTmp;
rectF2.set(this.messageEditText.getX() - AndroidUtilities.dp(5.0f), (this.messageEditText.getY() + this.messageEditText.getMeasuredHeight()) - AndroidUtilities.dp(15.0f), this.messageEditText.getX() + this.messageEditText.getMeasuredWidth() + AndroidUtilities.dp(5.0f), this.messageEditText.getY() + this.messageEditText.getMeasuredHeight() + AndroidUtilities.dp(2.0f) + 1.0f);
this.clipMatrix.reset();
this.clipMatrix.postScale(1.0f, rectF2.height() / 16.0f);
this.clipMatrix.postRotate(180.0f);
this.clipMatrix.postTranslate(rectF2.left, rectF2.bottom);
this.clipGradient.setLocalMatrix(this.clipMatrix);
this.gradientPaint.setAlpha((int) (f2 * 255.0f));
canvas.drawRect(rectF2, this.gradientPaint);
}
canvas.restore();
canvas.restore();
return booleanValue;
}
}