Telegram5 v10.6.2版本的 MD5 值为:423cae39e902ed9dd2cc7f4b4547b276
以下内容为反编译后的 ChatMessageCell.java 源代码,内容仅作参考
package org.telegram.ui.Cells;
import android.R;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.Keyframe;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Region;
import android.graphics.Shader;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.RippleDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
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.style.CharacterStyle;
import android.text.style.ClickableSpan;
import android.text.style.LeadingMarginSpan;
import android.text.style.URLSpan;
import android.util.Property;
import android.util.SparseArray;
import android.util.StateSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewStructure;
import android.view.Window;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeProvider;
import android.view.animation.OvershootInterpolator;
import android.widget.Toast;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.ColorUtils;
import androidx.core.math.MathUtils;
import com.swift.sandhook.utils.FileUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Stack;
import java.util.concurrent.atomic.AtomicReference;
import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.AccountInstance;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.ChatMessageSharedResources;
import org.telegram.messenger.ChatObject;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.DialogObject;
import org.telegram.messenger.DocumentObject;
import org.telegram.messenger.DownloadController;
import org.telegram.messenger.Emoji;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.FlagSecureReason;
import org.telegram.messenger.ImageLoader;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LiteMode;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaController;
import org.telegram.messenger.MediaDataController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.SendMessagesHelper;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.SvgHelper;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.UserObject;
import org.telegram.messenger.Utilities;
import org.telegram.messenger.VideoEditedInfo;
import org.telegram.messenger.WebFile;
import org.telegram.messenger.browser.Browser;
import org.telegram.messenger.video.VideoPlayerRewinder;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC$BotApp;
import org.telegram.tgnet.TLRPC$Chat;
import org.telegram.tgnet.TLRPC$ChatInvite;
import org.telegram.tgnet.TLRPC$ChatPhoto;
import org.telegram.tgnet.TLRPC$Document;
import org.telegram.tgnet.TLRPC$DocumentAttribute;
import org.telegram.tgnet.TLRPC$EncryptedChat;
import org.telegram.tgnet.TLRPC$FileLocation;
import org.telegram.tgnet.TLRPC$GeoPoint;
import org.telegram.tgnet.TLRPC$KeyboardButton;
import org.telegram.tgnet.TLRPC$Message;
import org.telegram.tgnet.TLRPC$MessageEntity;
import org.telegram.tgnet.TLRPC$MessageFwdHeader;
import org.telegram.tgnet.TLRPC$MessageMedia;
import org.telegram.tgnet.TLRPC$MessagePeerReaction;
import org.telegram.tgnet.TLRPC$MessageReplies;
import org.telegram.tgnet.TLRPC$MessageReplyHeader;
import org.telegram.tgnet.TLRPC$PageBlock;
import org.telegram.tgnet.TLRPC$Peer;
import org.telegram.tgnet.TLRPC$PhoneCallDiscardReason;
import org.telegram.tgnet.TLRPC$Photo;
import org.telegram.tgnet.TLRPC$PhotoSize;
import org.telegram.tgnet.TLRPC$Poll;
import org.telegram.tgnet.TLRPC$PollResults;
import org.telegram.tgnet.TLRPC$Reaction;
import org.telegram.tgnet.TLRPC$ReactionCount;
import org.telegram.tgnet.TLRPC$ReplyMarkup;
import org.telegram.tgnet.TLRPC$TL_chatInvite;
import org.telegram.tgnet.TLRPC$TL_documentAttributeAudio;
import org.telegram.tgnet.TLRPC$TL_documentAttributeImageSize;
import org.telegram.tgnet.TLRPC$TL_documentAttributeVideo;
import org.telegram.tgnet.TLRPC$TL_fileLocationUnavailable;
import org.telegram.tgnet.TLRPC$TL_forumTopic;
import org.telegram.tgnet.TLRPC$TL_game;
import org.telegram.tgnet.TLRPC$TL_keyboardButtonBuy;
import org.telegram.tgnet.TLRPC$TL_keyboardButtonCallback;
import org.telegram.tgnet.TLRPC$TL_keyboardButtonGame;
import org.telegram.tgnet.TLRPC$TL_keyboardButtonRequestGeoLocation;
import org.telegram.tgnet.TLRPC$TL_keyboardButtonRequestPeer;
import org.telegram.tgnet.TLRPC$TL_keyboardButtonRow;
import org.telegram.tgnet.TLRPC$TL_keyboardButtonSwitchInline;
import org.telegram.tgnet.TLRPC$TL_keyboardButtonUrl;
import org.telegram.tgnet.TLRPC$TL_keyboardButtonUrlAuth;
import org.telegram.tgnet.TLRPC$TL_keyboardButtonWebView;
import org.telegram.tgnet.TLRPC$TL_messageActionPhoneCall;
import org.telegram.tgnet.TLRPC$TL_messageEmpty;
import org.telegram.tgnet.TLRPC$TL_messageExtendedMediaPreview;
import org.telegram.tgnet.TLRPC$TL_messageMediaContact;
import org.telegram.tgnet.TLRPC$TL_messageMediaGame;
import org.telegram.tgnet.TLRPC$TL_messageMediaGeoLive;
import org.telegram.tgnet.TLRPC$TL_messageMediaGiveaway;
import org.telegram.tgnet.TLRPC$TL_messageMediaGiveawayResults;
import org.telegram.tgnet.TLRPC$TL_messageMediaInvoice;
import org.telegram.tgnet.TLRPC$TL_messageMediaPoll;
import org.telegram.tgnet.TLRPC$TL_messageMediaVenue;
import org.telegram.tgnet.TLRPC$TL_messageMediaWebPage;
import org.telegram.tgnet.TLRPC$TL_messageReactions;
import org.telegram.tgnet.TLRPC$TL_messages_stickerSet;
import org.telegram.tgnet.TLRPC$TL_page;
import org.telegram.tgnet.TLRPC$TL_pageBlockCollage;
import org.telegram.tgnet.TLRPC$TL_pageBlockSlideshow;
import org.telegram.tgnet.TLRPC$TL_peerChannel;
import org.telegram.tgnet.TLRPC$TL_peerChat;
import org.telegram.tgnet.TLRPC$TL_peerUser;
import org.telegram.tgnet.TLRPC$TL_phoneCallDiscardReasonBusy;
import org.telegram.tgnet.TLRPC$TL_phoneCallDiscardReasonMissed;
import org.telegram.tgnet.TLRPC$TL_photo;
import org.telegram.tgnet.TLRPC$TL_photoSize;
import org.telegram.tgnet.TLRPC$TL_photoSizeEmpty;
import org.telegram.tgnet.TLRPC$TL_photoStrippedSize;
import org.telegram.tgnet.TLRPC$TL_pollAnswer;
import org.telegram.tgnet.TLRPC$TL_pollAnswerVoters;
import org.telegram.tgnet.TLRPC$TL_reactionEmoji;
import org.telegram.tgnet.TLRPC$TL_replyInlineMarkup;
import org.telegram.tgnet.TLRPC$TL_sponsoredWebPage;
import org.telegram.tgnet.TLRPC$TL_user;
import org.telegram.tgnet.TLRPC$TL_webDocument;
import org.telegram.tgnet.TLRPC$TL_webPage;
import org.telegram.tgnet.TLRPC$TL_webPageAttributeStory;
import org.telegram.tgnet.TLRPC$TL_webPageAttributeTheme;
import org.telegram.tgnet.TLRPC$ThemeSettings;
import org.telegram.tgnet.TLRPC$User;
import org.telegram.tgnet.TLRPC$UserProfilePhoto;
import org.telegram.tgnet.TLRPC$VideoSize;
import org.telegram.tgnet.TLRPC$WebDocument;
import org.telegram.tgnet.TLRPC$WebPage;
import org.telegram.tgnet.TLRPC$WebPageAttribute;
import org.telegram.tgnet.tl.TL_stories$StoryItem;
import org.telegram.tgnet.tl.TL_stories$TL_storyItemDeleted;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Cells.ChatMessageCell;
import org.telegram.ui.Cells.DialogCell;
import org.telegram.ui.Cells.TextSelectionHelper;
import org.telegram.ui.ChatActivity;
import org.telegram.ui.Components.AnimatedEmojiDrawable;
import org.telegram.ui.Components.AnimatedEmojiSpan;
import org.telegram.ui.Components.AnimatedFileDrawable;
import org.telegram.ui.Components.AnimatedFloat;
import org.telegram.ui.Components.AnimatedNumberLayout;
import org.telegram.ui.Components.AnimationProperties;
import org.telegram.ui.Components.AudioVisualizerDrawable;
import org.telegram.ui.Components.AvatarDrawable;
import org.telegram.ui.Components.BackgroundGradientDrawable;
import org.telegram.ui.Components.ButtonBounce;
import org.telegram.ui.Components.CheckBoxBase;
import org.telegram.ui.Components.ClipRoundedDrawable;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.EmptyStubSpan;
import org.telegram.ui.Components.FloatSeekBarAccessibilityDelegate;
import org.telegram.ui.Components.Forum.MessageTopicButton;
import org.telegram.ui.Components.InfiniteProgress;
import org.telegram.ui.Components.LinkPath;
import org.telegram.ui.Components.LinkSpanDrawable;
import org.telegram.ui.Components.LoadingDrawable;
import org.telegram.ui.Components.MessageBackgroundDrawable;
import org.telegram.ui.Components.MotionBackgroundDrawable;
import org.telegram.ui.Components.MsgClockDrawable;
import org.telegram.ui.Components.Point;
import org.telegram.ui.Components.Premium.boosts.cells.msg.GiveawayMessageCell;
import org.telegram.ui.Components.Premium.boosts.cells.msg.GiveawayResultsMessageCell;
import org.telegram.ui.Components.QuoteHighlight;
import org.telegram.ui.Components.RLottieDrawable;
import org.telegram.ui.Components.RadialProgress2;
import org.telegram.ui.Components.Reactions.ReactionsLayoutInBubble;
import org.telegram.ui.Components.RecyclerListView;
import org.telegram.ui.Components.ReplyMessageLine;
import org.telegram.ui.Components.RoundVideoPlayingDrawable;
import org.telegram.ui.Components.SeekBar;
import org.telegram.ui.Components.SeekBarAccessibilityDelegate;
import org.telegram.ui.Components.SeekBarWaveform;
import org.telegram.ui.Components.SlotsDrawable;
import org.telegram.ui.Components.StaticLayoutEx;
import org.telegram.ui.Components.Text;
import org.telegram.ui.Components.TextStyleSpan;
import org.telegram.ui.Components.TimerParticles;
import org.telegram.ui.Components.TranscribeButton;
import org.telegram.ui.Components.TypefaceSpan;
import org.telegram.ui.Components.URLSpanBotCommand;
import org.telegram.ui.Components.URLSpanBrowser;
import org.telegram.ui.Components.URLSpanMono;
import org.telegram.ui.Components.URLSpanNoUnderline;
import org.telegram.ui.Components.VideoForwardDrawable;
import org.telegram.ui.Components.spoilers.SpoilerEffect;
import org.telegram.ui.Components.spoilers.SpoilerEffect2;
import org.telegram.ui.PhotoViewer;
import org.telegram.ui.PinchToZoomHelper;
import org.telegram.ui.SecretMediaViewer;
import org.telegram.ui.Stories.StoriesUtilities;
import org.telegram.ui.Stories.StoryViewer;
import org.telegram.ui.Stories.recorder.CaptionContainerView;
import org.telegram.ui.Stories.recorder.DominantColors;
import org.webrtc.MediaStreamTrack;
public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate, ImageReceiver.ImageReceiverDelegate, DownloadController.FileDownloadProgressListener, TextSelectionHelper.SelectableView, NotificationCenter.NotificationCenterDelegate {
private static float[] radii = new float[8];
private final boolean ALPHA_PROPERTY_WORKAROUND;
public Property<ChatMessageCell, Float> ANIMATION_OFFSET_X;
private int TAG;
CharSequence accessibilityText;
private boolean accessibilityTextContentUnread;
private long accessibilityTextFileSize;
private boolean accessibilityTextUnread;
private SparseArray<Rect> accessibilityVirtualViewBounds;
private int[] adaptiveEmojiColor;
private ColorFilter[] adaptiveEmojiColorFilter;
private int addedCaptionHeight;
private boolean addedForTest;
private int additionalTimeOffsetY;
private StaticLayout adminLayout;
private boolean allowAssistant;
private float alphaInternal;
private int animateFromStatusDrawableParams;
private boolean animatePollAnswer;
private boolean animatePollAnswerAlpha;
private boolean animatePollAvatars;
private int animateToStatusDrawableParams;
public AnimatedEmojiSpan.EmojiGroupedSpans animatedEmojiDescriptionStack;
public AnimatedEmojiSpan.EmojiGroupedSpans animatedEmojiReplyStack;
public AnimatedEmojiSpan.EmojiGroupedSpans animatedEmojiStack;
private int animatingDrawVideoImageButton;
private float animatingDrawVideoImageButtonProgress;
private float animatingLoadingProgressProgress;
private int animatingNoSound;
private boolean animatingNoSoundPlaying;
private float animatingNoSoundProgress;
private float animationOffsetX;
private boolean animationRunning;
private boolean attachedToWindow;
private StaticLayout authorLayout;
private int authorLayoutLeft;
private int authorLayoutWidth;
private boolean autoPlayingMedia;
private int availableTimeWidth;
protected AvatarDrawable avatarDrawable;
private ImageReceiver avatarImage;
private boolean avatarPressed;
private Theme.MessageDrawable.PathDrawParams backgroundCacheParams;
private MessageBackgroundDrawable backgroundDrawable;
private int backgroundDrawableBottom;
private int backgroundDrawableLeft;
private int backgroundDrawableRight;
private int backgroundDrawableTop;
private int backgroundHeight;
private int backgroundWidth;
private ImageReceiver blurredPhotoImage;
private int blurredViewBottomOffset;
private int blurredViewTopOffset;
private Path botButtonPath;
private float[] botButtonRadii;
private ArrayList<BotButton> botButtons;
private HashMap<String, BotButton> botButtonsByData;
private HashMap<String, BotButton> botButtonsByPosition;
private String botButtonsLayout;
private boolean bottomNearToSet;
private int buttonPressed;
private int buttonState;
private int buttonX;
private int buttonY;
private final boolean canDrawBackgroundInParent;
private boolean canStreamVideo;
private int captionFullWidth;
private int captionHeight;
public MessageObject.TextLayoutBlocks captionLayout;
private int captionOffsetX;
private int captionWidth;
private float captionX;
public float captionY;
public ChannelRecommendationsCell channelRecommendationsCell;
private CheckBoxBase checkBox;
private boolean checkBoxAnimationInProgress;
private float checkBoxAnimationProgress;
public int checkBoxTranslation;
private boolean checkBoxVisible;
private boolean checkOnlyButtonPressed;
private int childPosition;
private Paint clipPaint;
private ButtonBounce closeSponsoredBounce;
private RectF closeSponsoredBounds;
private String closeTimeText;
private int closeTimeWidth;
private int commentArrowX;
private AvatarDrawable[] commentAvatarDrawables;
private ImageReceiver[] commentAvatarImages;
private boolean[] commentAvatarImagesVisible;
private boolean commentButtonPressed;
private Rect commentButtonRect;
private boolean commentDrawUnread;
private StaticLayout commentLayout;
private AnimatedNumberLayout commentNumberLayout;
private int commentNumberWidth;
private InfiniteProgress commentProgress;
private float commentProgressAlpha;
private long commentProgressLastUpadteTime;
private int commentUnreadX;
private int commentWidth;
private int commentX;
public MessageObject.TextLayoutBlocks computedCaptionLayout;
public int computedGroupCaptionY;
private AvatarDrawable contactAvatarDrawable;
public ButtonBounce contactBounce;
private ArrayList<InstantViewButton> contactButtons;
public ReplyMessageLine contactLine;
private boolean contactPressed;
private RectF contactRect;
private float controlsAlpha;
public int currentAccount;
public Theme.MessageDrawable currentBackgroundDrawable;
private Theme.MessageDrawable currentBackgroundSelectedDrawable;
private CharSequence currentCaption;
private TLRPC$Chat currentChat;
private int currentFocusedVirtualView;
private TLRPC$Chat currentForwardChannel;
private String currentForwardName;
private String currentForwardNameString;
private TLRPC$User currentForwardUser;
private int currentMapProvider;
private MessageObject currentMessageObject;
private MessageObject.GroupedMessages currentMessagesGroup;
private Object currentNameStatus;
public AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable currentNameStatusDrawable;
private String currentNameString;
private TLRPC$FileLocation currentPhoto;
private String currentPhotoFilter;
private String currentPhotoFilterThumb;
private ImageLocation currentPhotoLocation;
private TLRPC$PhotoSize currentPhotoObject;
private TLRPC$PhotoSize currentPhotoObjectThumb;
private BitmapDrawable currentPhotoObjectThumbStripped;
private ImageLocation currentPhotoThumbLocation;
private MessageObject.GroupedMessagePosition currentPosition;
private String currentRepliesString;
private TLRPC$PhotoSize currentReplyPhoto;
private float currentSelectedBackgroundAlpha;
private CharSequence currentTimeString;
private String currentUnlockString;
private String currentUrl;
private TLRPC$User currentUser;
private TLRPC$User currentViaBotUser;
private String currentViewsString;
private WebFile currentWebFile;
private ChatMessageCellDelegate delegate;
private RectF deleteProgressRect;
private StaticLayout descriptionLayout;
private int descriptionLayoutLeft;
private int descriptionLayoutWidth;
private int descriptionX;
private int descriptionY;
private Runnable diceFinishCallback;
private boolean disallowLongPress;
private StaticLayout docTitleLayout;
private int docTitleOffsetX;
private int docTitleWidth;
private TLRPC$Document documentAttach;
private int documentAttachType;
private boolean drawBackground;
private boolean drawCommentButton;
private boolean drawCommentNumber;
private boolean drawContact;
private boolean drawContactAdd;
private boolean drawContactSendMessage;
private boolean drawContactView;
public boolean drawForBlur;
private boolean drawForwardedName;
public boolean drawFromPinchToZoom;
private boolean drawImageButton;
private boolean drawInstantView;
public int drawInstantViewType;
private boolean drawMediaCheckBox;
private boolean drawName;
private boolean drawNameLayout;
public boolean drawPhotoImage;
public boolean drawPinnedBottom;
public boolean drawPinnedTop;
private boolean drawRadialCheckBackground;
private boolean drawSelectionBackground;
private int drawSideButton;
private boolean drawTime;
private float drawTimeX;
private float drawTimeY;
private boolean drawTopic;
private boolean drawVideoImageButton;
private boolean drawVideoSize;
public boolean drawingToBitmap;
private int drawnContactButtonsFlag;
private Paint drillHolePaint;
private Path drillHolePath;
private StaticLayout durationLayout;
private int durationWidth;
private boolean edited;
boolean enterTransitionInProgress;
public ExpiredStoryView expiredStoryView;
private ColorMatrixColorFilter fancyBlurFilter;
private boolean firstCircleLength;
private int firstVisibleBlockNum;
private FlagSecureReason flagSecure;
private boolean flipImage;
private boolean forceNotDrawTime;
private boolean forwardBotPressed;
private int forwardHeight;
private int forwardNameCenterX;
private final float[] forwardNameOffsetX;
private boolean forwardNamePressed;
private float forwardNameX;
private int forwardNameY;
private final StaticLayout[] forwardedNameLayout;
private int forwardedNameWidth;
private boolean frozen;
private boolean fullyDraw;
private boolean gamePreviewPressed;
public final GiveawayMessageCell giveawayMessageCell;
public final GiveawayResultsMessageCell giveawayResultsMessageCell;
private Drawable gradientDrawable;
private LinearGradient gradientShader;
private boolean groupPhotoInvisible;
private MessageObject.GroupedMessages groupedMessagesToSet;
private boolean hadLongPress;
public boolean hasDiscussion;
private boolean hasEmbed;
private boolean hasGamePreview;
private boolean hasInvoicePreview;
private boolean hasLinkPreview;
private int hasMiniProgress;
private boolean hasNewLineForTime;
private boolean hasOldCaptionPreview;
private boolean hasPsaHint;
public boolean hasReplyQuote;
private int highlightCaptionToSetEnd;
private int highlightCaptionToSetStart;
private LinkPath highlightPath;
private long highlightPathStart;
private int highlightProgress;
private boolean highlightedQuote;
private float hintButtonProgress;
private boolean hintButtonVisible;
private int imageBackgroundColor;
private int imageBackgroundGradientColor1;
private int imageBackgroundGradientColor2;
private int imageBackgroundGradientColor3;
private int imageBackgroundGradientRotation;
private float imageBackgroundIntensity;
private int imageBackgroundSideColor;
private int imageBackgroundSideWidth;
private boolean imageDrawn;
private boolean imagePressed;
boolean imageReceiversAttachState;
boolean imageReceiversVisibleState;
private boolean inLayout;
private StaticLayout infoLayout;
private int infoWidth;
private int infoX;
private ButtonBounce instantButtonBounce;
private LoadingDrawable instantButtonLoading;
private boolean instantButtonPressed;
private RectF instantButtonRect;
public Drawable instantDrawable;
public int instantDrawableColor;
private Paint instantLinkArrowPaint;
private Path instantLinkArrowPath;
private boolean instantPressed;
private int instantTextLeftX;
private boolean instantTextNewLine;
private int instantTextX;
public String instantViewButtonText;
private StaticLayout instantViewLayout;
private float instantViewLayoutLeft;
private float instantViewLayoutWidth;
private int instantWidth;
private Runnable invalidateCallback;
private Runnable invalidateRunnable;
private boolean invalidateSpoilersParent;
private boolean invalidatesParent;
public boolean isAvatarVisible;
public boolean isBlurred;
public boolean isBot;
public boolean isChat;
private boolean isCheckPressed;
public boolean isForum;
public boolean isForumGeneral;
private boolean isHighlighted;
private boolean isHighlightedAnimated;
public boolean isMegagroup;
public boolean isPinned;
public boolean isPinnedChat;
private boolean isPlayingRound;
private boolean isPressed;
public boolean isRepliesChat;
public boolean isReplyQuote;
private boolean isRoundVideo;
public boolean isSavedChat;
public boolean isSavedPreviewChat;
private boolean isSmallImage;
private boolean isSpoilerRevealing;
public boolean isThreadChat;
private boolean isThreadPost;
private boolean isUpdating;
private int keyboardHeight;
private long lastAnimationTime;
private long lastCheckBoxAnimationTime;
private long lastControlsAlphaChangeTime;
private int lastDeleteDate;
private float lastDrawingAudioProgress;
private int lastHeight;
private long lastHighlightProgressTime;
private long lastLoadingSizeTotal;
private long lastNamesAnimationTime;
private TLRPC$Poll lastPoll;
private long lastPollCloseTime;
private ArrayList<TLRPC$TL_pollAnswerVoters> lastPollResults;
private int lastPollResultsVoters;
private String lastPostAuthor;
private TLRPC$TL_messageReactions lastReactions;
private int lastRepliesCount;
private TLRPC$Message lastReplyMessage;
private long lastSeekUpdateTime;
private int lastSendState;
int lastSize;
private double lastTime;
private float lastTouchX;
private float lastTouchY;
private boolean lastTranslated;
private int lastViewsCount;
private int lastVisibleBlockNum;
private int lastWidth;
private int layoutHeight;
private int layoutWidth;
private int linkBlockNum;
public ReplyMessageLine linkLine;
public boolean linkPreviewAbove;
private ButtonBounce linkPreviewBounce;
public int linkPreviewHeight;
private boolean linkPreviewPressed;
private Drawable linkPreviewSelector;
public int linkPreviewSelectorColor;
private int linkPreviewY;
private int linkSelectionBlockNum;
public long linkedChatId;
private LinkSpanDrawable.LinkCollector links;
private StaticLayout loadingProgressLayout;
private long loadingProgressLayoutHash;
private boolean locationExpired;
private ImageReceiver locationImageReceiver;
private Drawable locationLoadingThumb;
public boolean makeVisibleAfterChange;
private boolean mediaBackground;
private CheckBoxBase mediaCheckBox;
private int mediaOffsetY;
private SpoilerEffect mediaSpoilerEffect;
private SpoilerEffect2 mediaSpoilerEffect2;
private Integer mediaSpoilerEffect2Index;
private Path mediaSpoilerPath;
private float[] mediaSpoilerRadii;
private float mediaSpoilerRevealMaxRadius;
private float mediaSpoilerRevealProgress;
private float mediaSpoilerRevealX;
private float mediaSpoilerRevealY;
private boolean mediaWasInvisible;
private MessageObject messageObjectToSet;
private int miniButtonPressed;
private int miniButtonState;
private MotionBackgroundDrawable motionBackgroundDrawable;
private StaticLayout nameLayout;
private boolean nameLayoutPressed;
private Drawable nameLayoutSelector;
private int nameLayoutSelectorColor;
private int nameLayoutWidth;
private float nameOffsetX;
private boolean nameStatusPressed;
private Drawable nameStatusSelector;
private int nameStatusSelectorColor;
private int nameWidth;
private float nameX;
private float nameY;
private int namesOffset;
private boolean needNewVisiblePart;
public boolean needReplyImage;
private int noSoundCenterX;
private Paint onceClearPaint;
private RLottieDrawable onceFire;
private CaptionContainerView.PeriodDrawable oncePeriod;
private Paint onceRadialCutPaint;
private Paint onceRadialPaint;
private Paint onceRadialStrokePaint;
private boolean otherPressed;
private int otherX;
private int otherY;
private int overideShouldDrawTimeOnMedia;
private AudioVisualizerDrawable overridenAudioVisualizer;
private long overridenDuration;
public int parentBoundsBottom;
public float parentBoundsTop;
private int parentHeight;
public float parentViewTopOffset;
private int parentWidth;
private StaticLayout performerLayout;
private int performerX;
private ImageReceiver photoImage;
private boolean photoImageOutOfBounds;
private boolean photoNotSet;
private TLObject photoParentObject;
private StaticLayout photosCountLayout;
private int photosCountWidth;
public boolean pinnedBottom;
public boolean pinnedTop;
private float pollAnimationProgress;
private float pollAnimationProgressTime;
private AvatarDrawable[] pollAvatarDrawables;
private ImageReceiver[] pollAvatarImages;
private boolean[] pollAvatarImagesVisible;
private ArrayList<PollButton> pollButtons;
private CheckBoxBase[] pollCheckBox;
private boolean pollClosed;
private boolean pollHintPressed;
private int pollHintX;
private int pollHintY;
private boolean pollInstantViewTouchesBottom;
private boolean pollUnvoteInProgress;
private boolean pollVoteInProgress;
private int pollVoteInProgressNum;
private boolean pollVoted;
private int pressedBotButton;
private MessageObject.TextLayoutBlock pressedCopyCode;
private AnimatedEmojiSpan pressedEmoji;
private LinkSpanDrawable pressedLink;
private int pressedLinkType;
private int[] pressedState;
private int pressedVoteButton;
private CharacterStyle progressLoadingLink;
private LoadingDrawable progressLoadingLinkCurrentDrawable;
private ArrayList<LoadingDrawableLocation> progressLoadingLinkDrawables;
private float psaButtonProgress;
private boolean psaButtonVisible;
private int psaHelpX;
private int psaHelpY;
private boolean psaHintPressed;
public QuoteHighlight quoteHighlight;
public ReplyMessageLine quoteLine;
private RadialProgress2 radialProgress;
protected float radialProgressAlpha;
public final ReactionsLayoutInBubble reactionsLayoutInBubble;
private RectF rect;
private Path rectPath;
private StaticLayout repliesLayout;
private int repliesTextWidth;
public ButtonBounce replyBounce;
public float replyBounceX;
public float replyBounceY;
public float replyHeight;
public ImageReceiver replyImageReceiver;
public ReplyMessageLine replyLine;
public StaticLayout replyNameLayout;
private int replyNameOffset;
private int replyNameWidth;
private boolean replyPanelIsForward;
private boolean replyPressed;
private AnimatedFloat replyPressedFloat;
public Drawable replyQuoteDrawable;
public int replyQuoteDrawableColor;
private Path replyRoundRectPath;
public Drawable replySelector;
private boolean replySelectorCanBePressed;
public int replySelectorColor;
private boolean replySelectorPressed;
public float replySelectorRadLeft;
public float replySelectorRadRight;
public RectF replySelectorRect;
public List<SpoilerEffect> replySpoilers;
private final Stack<SpoilerEffect> replySpoilersPool;
public int replyStartX;
public int replyStartY;
private int replyTextHeight;
public StaticLayout replyTextLayout;
public int replyTextOffset;
public boolean replyTextRTL;
private int replyTextWidth;
private float replyTouchX;
private float replyTouchY;
private Theme.ResourcesProvider resourcesProvider;
private float roundPlayingDrawableProgress;
private float roundProgressAlpha;
float roundSeekbarOutAlpha;
float roundSeekbarOutProgress;
int roundSeekbarTouched;
private float roundToPauseProgress;
private float roundToPauseProgress2;
private AnimatedFloat roundVideoPlayPipFloat;
private RoundVideoPlayingDrawable roundVideoPlayingDrawable;
private final Path sPath;
private boolean scheduledInvalidate;
private Rect scrollRect;
private SeekBar seekBar;
private SeekBarAccessibilityDelegate seekBarAccessibilityDelegate;
private SeekBarWaveform seekBarWaveform;
private int seekBarWaveformTranslateX;
private int seekBarX;
private int seekBarY;
float seekbarRoundX;
float seekbarRoundY;
private float selectedBackgroundProgress;
private Paint selectionOverlayPaint;
private final Drawable[] selectorDrawable;
private int[] selectorDrawableMaskType;
private AnimatorSet shakeAnimation;
private ChatMessageSharedResources sharedResources;
public boolean shouldCheckVisibleOnScreen;
private boolean sideButtonPressed;
private float sideStartX;
private float sideStartY;
private StaticLayout siteNameLayout;
private float siteNameLayoutWidth;
private float siteNameLeft;
private int siteNameWidth;
private boolean skipFrameUpdate;
private float slidingOffsetX;
private StaticLayout songLayout;
private int songX;
private SpoilerEffect spoilerPressed;
private AtomicReference<Layout> spoilersPatchedReplyTextLayout;
private boolean statusDrawableAnimationInProgress;
private ValueAnimator statusDrawableAnimator;
private float statusDrawableProgress;
private int substractBackgroundHeight;
public int textX;
public int textY;
private float timeAlpha;
private int timeAudioX;
private StaticLayout timeLayout;
private boolean timePressed;
private int timeTextWidth;
private boolean timeWasInvisible;
public int timeWidth;
private int timeWidthAudio;
protected int timeX;
private TimerParticles timerParticles;
private AnimatedFloat timerParticlesAlpha;
private float timerTransitionProgress;
private StaticLayout titleLayout;
private int titleLayoutLeft;
private int titleLayoutWidth;
private float toSeekBarProgress;
private boolean topNearToSet;
private MessageTopicButton topicButton;
private long totalChangeTime;
private int totalCommentWidth;
public int totalHeight;
private int totalVisibleBlocksCount;
public TranscribeButton transcribeButton;
private float transcribeX;
private float transcribeY;
public final TransitionParams transitionParams;
float transitionYOffsetForDrawables;
private LoadingDrawable translationLoadingDrawable;
private ArrayList<MessageObject.TextLayoutBlock> translationLoadingDrawableText;
private AnimatedFloat translationLoadingFloat;
private LinkPath translationLoadingPath;
private float unlockAlpha;
private StaticLayout unlockLayout;
private SpoilerEffect unlockSpoilerEffect;
private Path unlockSpoilerPath;
private float[] unlockSpoilerRadii;
private int unlockTextWidth;
private float unlockX;
private float unlockY;
private int unmovedTextX;
private ArrayList<LinkPath> urlPathCache;
private ArrayList<LinkPath> urlPathSelection;
private boolean useSeekBarWaveform;
private boolean useTranscribeButton;
private int viaNameWidth;
private boolean viaOnly;
private TypefaceSpan viaSpan1;
private TypefaceSpan viaSpan2;
private int viaWidth;
private boolean vibrateOnPollVote;
private int videoButtonPressed;
private int videoButtonX;
private int videoButtonY;
VideoForwardDrawable videoForwardDrawable;
private StaticLayout videoInfoLayout;
VideoPlayerRewinder videoPlayerRewinder;
private RadialProgress2 videoRadialProgress;
private float viewTop;
private StaticLayout viewsLayout;
private int viewsTextWidth;
private int visibleHeight;
private boolean visibleOnScreen;
private int visibleParent;
private float visibleParentOffset;
private float visibleTop;
private float voteCurrentCircleLength;
private float voteCurrentProgressTime;
private long voteLastUpdateTime;
private float voteRadOffset;
private boolean voteRisingCircleLength;
private boolean wasLayout;
private boolean wasPinned;
private boolean wasSending;
private boolean wasTranscriptionOpen;
private int widthBeforeNewTimeLine;
private int widthForButtons;
private boolean willRemoved;
private boolean wouldBeInPip;
private boolean intersect(float f, float f2, float f3, float f4) {
return f <= f3 ? f2 >= f3 : f <= f4;
}
protected boolean isWidthAdaptive() {
return false;
}
public RadialProgress2 getRadialProgress() {
return this.radialProgress;
}
public void setEnterTransitionInProgress(boolean z) {
this.enterTransitionInProgress = z;
invalidate();
}
public ReactionsLayoutInBubble.ReactionButton getReactionButton(ReactionsLayoutInBubble.VisibleReaction visibleReaction) {
return this.reactionsLayoutInBubble.getReactionButton(visibleReaction);
}
public MessageObject getPrimaryMessageObject() {
MessageObject messageObject = this.currentMessageObject;
MessageObject findPrimaryMessageObject = (messageObject == null || this.currentMessagesGroup == null || !messageObject.hasValidGroupId()) ? null : this.currentMessagesGroup.findPrimaryMessageObject();
return findPrimaryMessageObject != null ? findPrimaryMessageObject : this.currentMessageObject;
}
@Override
public void didReceivedNotification(int i, int i2, Object... objArr) {
MessageObject messageObject;
if (i == NotificationCenter.startSpoilers) {
setSpoilersSuppressed(false);
return;
}
if (i == NotificationCenter.stopSpoilers) {
setSpoilersSuppressed(true);
return;
}
if (i == NotificationCenter.userInfoDidLoad) {
TLRPC$User tLRPC$User = this.currentUser;
if (tLRPC$User != null) {
if (tLRPC$User.id == ((Long) objArr[0]).longValue()) {
setAvatar(this.currentMessageObject);
return;
}
return;
}
return;
}
if (i == NotificationCenter.emojiLoaded) {
invalidate();
return;
}
if (i != NotificationCenter.didUpdatePremiumGiftStickers || (messageObject = this.currentMessageObject) == null) {
return;
}
TLRPC$MessageMedia tLRPC$MessageMedia = messageObject.messageOwner.media;
if ((tLRPC$MessageMedia instanceof TLRPC$TL_messageMediaGiveaway) || (tLRPC$MessageMedia instanceof TLRPC$TL_messageMediaGiveawayResults)) {
setMessageObject(messageObject, this.currentMessagesGroup, this.pinnedBottom, this.pinnedTop);
}
}
public void setAvatar(MessageObject messageObject) {
TLRPC$Photo tLRPC$Photo;
TLRPC$Chat tLRPC$Chat;
if (messageObject == null) {
return;
}
if (this.isAvatarVisible) {
Drawable drawable = messageObject.customAvatarDrawable;
if (drawable != null) {
this.avatarImage.setImageBitmap(drawable);
return;
}
TLRPC$User tLRPC$User = this.currentUser;
if (tLRPC$User != null) {
TLRPC$UserProfilePhoto tLRPC$UserProfilePhoto = tLRPC$User.photo;
if (tLRPC$UserProfilePhoto != null) {
this.currentPhoto = tLRPC$UserProfilePhoto.photo_small;
} else {
this.currentPhoto = null;
}
this.avatarDrawable.setInfo(this.currentAccount, tLRPC$User);
this.avatarImage.setForUserOrChat(this.currentUser, this.avatarDrawable, null, LiteMode.isEnabled(LiteMode.FLAGS_CHAT), 1, false);
return;
}
TLRPC$Chat tLRPC$Chat2 = this.currentChat;
if (tLRPC$Chat2 != null) {
TLRPC$ChatPhoto tLRPC$ChatPhoto = tLRPC$Chat2.photo;
if (tLRPC$ChatPhoto != null) {
this.currentPhoto = tLRPC$ChatPhoto.photo_small;
} else {
this.currentPhoto = null;
}
this.avatarDrawable.setInfo(this.currentAccount, tLRPC$Chat2);
this.avatarImage.setForUserOrChat(this.currentChat, this.avatarDrawable);
return;
}
if (messageObject.isSponsored()) {
TLRPC$TL_sponsoredWebPage tLRPC$TL_sponsoredWebPage = messageObject.sponsoredWebPage;
if (tLRPC$TL_sponsoredWebPage != null) {
this.avatarDrawable.setInfo(messageObject.sponsoredId[0], tLRPC$TL_sponsoredWebPage.site_name, null, null);
TLRPC$Photo tLRPC$Photo2 = messageObject.sponsoredWebPage.photo;
if (tLRPC$Photo2 != null) {
this.avatarImage.setImage(ImageLocation.getForPhoto(FileLoader.getClosestPhotoSizeWithSize(tLRPC$Photo2.sizes, AndroidUtilities.dp(50.0f), false, null, true), tLRPC$Photo2), "50_50", this.avatarDrawable, null, null, 0);
return;
}
return;
}
TLRPC$ChatInvite tLRPC$ChatInvite = messageObject.sponsoredChatInvite;
if (tLRPC$ChatInvite != null && (tLRPC$Chat = tLRPC$ChatInvite.chat) != null) {
this.avatarDrawable.setInfo(this.currentAccount, tLRPC$Chat);
this.avatarImage.setForUserOrChat(messageObject.sponsoredChatInvite.chat, this.avatarDrawable);
return;
}
this.avatarDrawable.setInfo(this.currentAccount, tLRPC$ChatInvite);
TLRPC$ChatInvite tLRPC$ChatInvite2 = messageObject.sponsoredChatInvite;
if (tLRPC$ChatInvite2 == null || (tLRPC$Photo = tLRPC$ChatInvite2.photo) == null) {
return;
}
this.avatarImage.setImage(ImageLocation.getForPhoto(FileLoader.getClosestPhotoSizeWithSize(tLRPC$Photo.sizes, AndroidUtilities.dp(50.0f), false, null, true), tLRPC$Photo), "50_50", this.avatarDrawable, null, null, 0);
return;
}
this.currentPhoto = null;
this.avatarDrawable.setInfo(messageObject.getFromChatId(), null, null);
this.avatarImage.setImage(null, null, this.avatarDrawable, null, null, 0);
return;
}
this.currentPhoto = null;
}
public void setSpoilersSuppressed(boolean z) {
for (int i = 0; i < this.replySpoilers.size(); i++) {
this.replySpoilers.get(i).setSuppressUpdates(z);
}
MessageObject.TextLayoutBlocks textLayoutBlocks = this.captionLayout;
if (textLayoutBlocks != null && textLayoutBlocks.textLayoutBlocks != null) {
for (int i2 = 0; i2 < this.captionLayout.textLayoutBlocks.size(); i2++) {
MessageObject.TextLayoutBlock textLayoutBlock = this.captionLayout.textLayoutBlocks.get(i2);
for (int i3 = 0; i3 < textLayoutBlock.spoilers.size(); i3++) {
textLayoutBlock.spoilers.get(i3).setSuppressUpdates(z);
}
}
}
if (getMessageObject() == null || getMessageObject().textLayoutBlocks == null) {
return;
}
for (int i4 = 0; i4 < getMessageObject().textLayoutBlocks.size(); i4++) {
MessageObject.TextLayoutBlock textLayoutBlock2 = getMessageObject().textLayoutBlocks.get(i4);
for (int i5 = 0; i5 < textLayoutBlock2.spoilers.size(); i5++) {
textLayoutBlock2.spoilers.get(i5).setSuppressUpdates(z);
}
}
}
public boolean hasSpoilers() {
ArrayList<MessageObject.TextLayoutBlock> arrayList;
MessageObject.TextLayoutBlocks textLayoutBlocks = this.captionLayout;
if (textLayoutBlocks != null && (arrayList = textLayoutBlocks.textLayoutBlocks) != null) {
Iterator<MessageObject.TextLayoutBlock> it = arrayList.iterator();
while (it.hasNext()) {
if (!it.next().spoilers.isEmpty()) {
return true;
}
}
}
if (getMessageObject() == null || getMessageObject().textLayoutBlocks == null) {
return false;
}
Iterator<MessageObject.TextLayoutBlock> it2 = getMessageObject().textLayoutBlocks.iterator();
while (it2.hasNext()) {
if (!it2.next().spoilers.isEmpty()) {
return true;
}
}
return false;
}
private void updateSpoilersVisiblePart(int i, int i2) {
ArrayList<MessageObject.TextLayoutBlock> arrayList;
MessageObject.TextLayoutBlocks textLayoutBlocks = this.captionLayout;
if (textLayoutBlocks != null && (arrayList = textLayoutBlocks.textLayoutBlocks) != null) {
Iterator<MessageObject.TextLayoutBlock> it = arrayList.iterator();
while (it.hasNext()) {
MessageObject.TextLayoutBlock next = it.next();
Iterator<SpoilerEffect> it2 = next.spoilers.iterator();
while (it2.hasNext()) {
it2.next().setVisibleBounds(0.0f, (i - next.textYOffset) - this.captionX, getWidth(), (i2 - next.textYOffset) - this.captionY);
}
}
}
StaticLayout staticLayout = this.replyTextLayout;
if (staticLayout != null) {
float height = (-this.replyStartY) - staticLayout.getHeight();
Iterator<SpoilerEffect> it3 = this.replySpoilers.iterator();
while (it3.hasNext()) {
it3.next().setVisibleBounds(0.0f, i + height, getWidth(), i2 + height);
}
}
if (getMessageObject() == null || getMessageObject().textLayoutBlocks == null) {
return;
}
Iterator<MessageObject.TextLayoutBlock> it4 = getMessageObject().textLayoutBlocks.iterator();
while (it4.hasNext()) {
MessageObject.TextLayoutBlock next2 = it4.next();
Iterator<SpoilerEffect> it5 = next2.spoilers.iterator();
while (it5.hasNext()) {
it5.next().setVisibleBounds(0.0f, (i - next2.textYOffset) - this.textY, getWidth(), (i2 - next2.textYOffset) - this.textY);
}
}
}
public void setScrimReaction(String str) {
this.reactionsLayoutInBubble.setScrimReaction(str);
}
public void drawScrimReaction(Canvas canvas, String str) {
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
if (groupedMessagePosition != null) {
int i = groupedMessagePosition.flags;
if ((i & 8) == 0 || (i & 1) == 0) {
return;
}
}
ReactionsLayoutInBubble reactionsLayoutInBubble = this.reactionsLayoutInBubble;
if (reactionsLayoutInBubble.isSmall) {
return;
}
reactionsLayoutInBubble.draw(canvas, this.transitionParams.animateChangeProgress, str);
}
public boolean checkUnreadReactions(float f, int i) {
if (!this.reactionsLayoutInBubble.hasUnreadReactions) {
return false;
}
float y = getY();
float f2 = y + r2.y;
return f2 > f && (f2 + ((float) this.reactionsLayoutInBubble.height)) - ((float) AndroidUtilities.dp(16.0f)) < ((float) i);
}
public void markReactionsAsRead() {
this.reactionsLayoutInBubble.hasUnreadReactions = false;
MessageObject messageObject = this.currentMessageObject;
if (messageObject == null) {
return;
}
messageObject.markReactionsAsRead();
}
public void setVisibleOnScreen(boolean z, float f, float f2) {
if (this.visibleOnScreen != z) {
this.visibleOnScreen = z;
checkImageReceiversAttachState();
if (z) {
invalidate();
}
}
float imageY = f - this.photoImage.getImageY();
float measuredHeight = f2 - (getMeasuredHeight() - this.photoImage.getImageY2());
float imageHeight = this.photoImage.getImageHeight();
if (imageY > 0.0f) {
imageHeight -= imageY;
}
if (measuredHeight > 0.0f) {
imageHeight -= measuredHeight;
}
ImageReceiver imageReceiver = this.photoImage;
boolean z2 = imageHeight / imageReceiver.getImageHeight() < 0.25f;
this.skipFrameUpdate = z2;
imageReceiver.setSkipUpdateFrame(z2);
}
public void setParentBounds(float f, int i) {
this.parentBoundsTop = f;
this.parentBoundsBottom = i;
if (this.photoImageOutOfBounds) {
float y = getY() + this.photoImage.getImageY();
if (this.photoImage.getImageHeight() + y < this.parentBoundsTop || y > this.parentBoundsBottom) {
return;
}
invalidate();
}
}
public interface ChatMessageCellDelegate {
boolean canDrawOutboundsContent();
boolean canPerformActions();
void didLongPress(ChatMessageCell chatMessageCell, float f, float f2);
void didLongPressBotButton(ChatMessageCell chatMessageCell, TLRPC$KeyboardButton tLRPC$KeyboardButton);
boolean didLongPressChannelAvatar(ChatMessageCell chatMessageCell, TLRPC$Chat tLRPC$Chat, int i, float f, float f2);
boolean didLongPressUserAvatar(ChatMessageCell chatMessageCell, TLRPC$User tLRPC$User, float f, float f2);
boolean didPressAnimatedEmoji(ChatMessageCell chatMessageCell, AnimatedEmojiSpan animatedEmojiSpan);
void didPressBotButton(ChatMessageCell chatMessageCell, TLRPC$KeyboardButton tLRPC$KeyboardButton);
void didPressCancelSendButton(ChatMessageCell chatMessageCell);
void didPressChannelAvatar(ChatMessageCell chatMessageCell, TLRPC$Chat tLRPC$Chat, int i, float f, float f2);
void didPressChannelRecommendation(ChatMessageCell chatMessageCell, TLRPC$Chat tLRPC$Chat, boolean z);
void didPressChannelRecommendationsClose(ChatMessageCell chatMessageCell);
void didPressCodeCopy(ChatMessageCell chatMessageCell, MessageObject.TextLayoutBlock textLayoutBlock);
void didPressCommentButton(ChatMessageCell chatMessageCell);
void didPressExtendedMediaPreview(ChatMessageCell chatMessageCell, TLRPC$KeyboardButton tLRPC$KeyboardButton);
void didPressGiveawayChatButton(ChatMessageCell chatMessageCell, int i);
void didPressHiddenForward(ChatMessageCell chatMessageCell);
void didPressHint(ChatMessageCell chatMessageCell, int i);
void didPressImage(ChatMessageCell chatMessageCell, float f, float f2);
void didPressInstantButton(ChatMessageCell chatMessageCell, int i);
void didPressMoreChannelRecommendations(ChatMessageCell chatMessageCell);
void didPressOther(ChatMessageCell chatMessageCell, float f, float f2);
void didPressReaction(ChatMessageCell chatMessageCell, TLRPC$ReactionCount tLRPC$ReactionCount, boolean z);
void didPressReplyMessage(ChatMessageCell chatMessageCell, int i);
void didPressSideButton(ChatMessageCell chatMessageCell);
void didPressSponsoredClose();
void didPressTime(ChatMessageCell chatMessageCell);
void didPressTopicButton(ChatMessageCell chatMessageCell);
void didPressUrl(ChatMessageCell chatMessageCell, CharacterStyle characterStyle, boolean z);
void didPressUserAvatar(ChatMessageCell chatMessageCell, TLRPC$User tLRPC$User, float f, float f2);
void didPressUserStatus(ChatMessageCell chatMessageCell, TLRPC$User tLRPC$User, TLRPC$Document tLRPC$Document);
void didPressViaBot(ChatMessageCell chatMessageCell, String str);
void didPressViaBotNotInline(ChatMessageCell chatMessageCell, long j);
void didPressVoteButtons(ChatMessageCell chatMessageCell, ArrayList<TLRPC$TL_pollAnswer> arrayList, int i, int i2, int i3);
void didPressWebPage(ChatMessageCell chatMessageCell, TLRPC$WebPage tLRPC$WebPage, String str, boolean z);
void didStartVideoStream(MessageObject messageObject);
String getAdminRank(long j);
PinchToZoomHelper getPinchToZoomHelper();
String getProgressLoadingBotButtonUrl(ChatMessageCell chatMessageCell);
CharacterStyle getProgressLoadingLink(ChatMessageCell chatMessageCell);
TextSelectionHelper.ChatListTextSelectionHelper getTextSelectionHelper();
boolean hasSelectedMessages();
void invalidateBlur();
boolean isLandscape();
boolean isProgressLoading(ChatMessageCell chatMessageCell, int i);
boolean isReplyOrSelf();
boolean keyboardIsOpened();
void needOpenWebView(MessageObject messageObject, String str, String str2, String str3, String str4, int i, int i2);
boolean needPlayMessage(ChatMessageCell chatMessageCell, MessageObject messageObject, boolean z);
void needReloadPolls();
void needShowPremiumBulletin(int i);
boolean onAccessibilityAction(int i, Bundle bundle);
void onDiceFinished();
void setShouldNotRepeatSticker(MessageObject messageObject);
boolean shouldDrawThreadProgress(ChatMessageCell chatMessageCell);
boolean shouldRepeatSticker(MessageObject messageObject);
boolean shouldShowTopicButton();
void videoTimerReached();
public final class CC {
public static boolean $default$canDrawOutboundsContent(ChatMessageCellDelegate chatMessageCellDelegate) {
return true;
}
public static boolean $default$canPerformActions(ChatMessageCellDelegate chatMessageCellDelegate) {
return false;
}
public static void $default$didLongPress(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, float f, float f2) {
}
public static void $default$didLongPressBotButton(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, TLRPC$KeyboardButton tLRPC$KeyboardButton) {
}
public static boolean $default$didLongPressChannelAvatar(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, TLRPC$Chat tLRPC$Chat, int i, float f, float f2) {
return false;
}
public static boolean $default$didLongPressUserAvatar(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, TLRPC$User tLRPC$User, float f, float f2) {
return false;
}
public static boolean $default$didPressAnimatedEmoji(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, AnimatedEmojiSpan animatedEmojiSpan) {
return false;
}
public static void $default$didPressBotButton(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, TLRPC$KeyboardButton tLRPC$KeyboardButton) {
}
public static void $default$didPressCancelSendButton(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell) {
}
public static void $default$didPressChannelAvatar(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, TLRPC$Chat tLRPC$Chat, int i, float f, float f2) {
}
public static void $default$didPressChannelRecommendation(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, TLRPC$Chat tLRPC$Chat, boolean z) {
}
public static void $default$didPressChannelRecommendationsClose(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell) {
}
public static void $default$didPressCodeCopy(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, MessageObject.TextLayoutBlock textLayoutBlock) {
}
public static void $default$didPressCommentButton(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell) {
}
public static void $default$didPressExtendedMediaPreview(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, TLRPC$KeyboardButton tLRPC$KeyboardButton) {
}
public static void $default$didPressGiveawayChatButton(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, int i) {
}
public static void $default$didPressHiddenForward(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell) {
}
public static void $default$didPressHint(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, int i) {
}
public static void $default$didPressImage(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, float f, float f2) {
}
public static void $default$didPressInstantButton(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, int i) {
}
public static void $default$didPressMoreChannelRecommendations(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell) {
}
public static void $default$didPressOther(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, float f, float f2) {
}
public static void $default$didPressReaction(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, TLRPC$ReactionCount tLRPC$ReactionCount, boolean z) {
}
public static void $default$didPressReplyMessage(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, int i) {
}
public static void $default$didPressSideButton(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell) {
}
public static void $default$didPressSponsoredClose(ChatMessageCellDelegate chatMessageCellDelegate) {
}
public static void $default$didPressTime(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell) {
}
public static void $default$didPressTopicButton(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell) {
}
public static void $default$didPressUrl(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, CharacterStyle characterStyle, boolean z) {
}
public static void $default$didPressUserAvatar(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, TLRPC$User tLRPC$User, float f, float f2) {
}
public static void $default$didPressUserStatus(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, TLRPC$User tLRPC$User, TLRPC$Document tLRPC$Document) {
}
public static void $default$didPressViaBot(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, String str) {
}
public static void $default$didPressViaBotNotInline(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, long j) {
}
public static void $default$didPressVoteButtons(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, ArrayList arrayList, int i, int i2, int i3) {
}
public static void $default$didStartVideoStream(ChatMessageCellDelegate chatMessageCellDelegate, MessageObject messageObject) {
}
public static String $default$getAdminRank(ChatMessageCellDelegate chatMessageCellDelegate, long j) {
return null;
}
public static PinchToZoomHelper $default$getPinchToZoomHelper(ChatMessageCellDelegate chatMessageCellDelegate) {
return null;
}
public static String $default$getProgressLoadingBotButtonUrl(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell) {
return null;
}
public static CharacterStyle $default$getProgressLoadingLink(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell) {
return null;
}
public static TextSelectionHelper.ChatListTextSelectionHelper $default$getTextSelectionHelper(ChatMessageCellDelegate chatMessageCellDelegate) {
return null;
}
public static boolean $default$hasSelectedMessages(ChatMessageCellDelegate chatMessageCellDelegate) {
return false;
}
public static void $default$invalidateBlur(ChatMessageCellDelegate chatMessageCellDelegate) {
}
public static boolean $default$isLandscape(ChatMessageCellDelegate chatMessageCellDelegate) {
return false;
}
public static boolean $default$isProgressLoading(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, int i) {
return false;
}
public static boolean $default$isReplyOrSelf(ChatMessageCellDelegate chatMessageCellDelegate) {
return false;
}
public static boolean $default$keyboardIsOpened(ChatMessageCellDelegate chatMessageCellDelegate) {
return false;
}
public static void $default$needOpenWebView(ChatMessageCellDelegate chatMessageCellDelegate, MessageObject messageObject, String str, String str2, String str3, String str4, int i, int i2) {
}
public static boolean $default$needPlayMessage(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell, MessageObject messageObject, boolean z) {
return false;
}
public static void $default$needReloadPolls(ChatMessageCellDelegate chatMessageCellDelegate) {
}
public static void $default$needShowPremiumBulletin(ChatMessageCellDelegate chatMessageCellDelegate, int i) {
}
public static boolean $default$onAccessibilityAction(ChatMessageCellDelegate chatMessageCellDelegate, int i, Bundle bundle) {
return false;
}
public static void $default$onDiceFinished(ChatMessageCellDelegate chatMessageCellDelegate) {
}
public static void $default$setShouldNotRepeatSticker(ChatMessageCellDelegate chatMessageCellDelegate, MessageObject messageObject) {
}
public static boolean $default$shouldDrawThreadProgress(ChatMessageCellDelegate chatMessageCellDelegate, ChatMessageCell chatMessageCell) {
return false;
}
public static boolean $default$shouldRepeatSticker(ChatMessageCellDelegate chatMessageCellDelegate, MessageObject messageObject) {
return true;
}
public static boolean $default$shouldShowTopicButton(ChatMessageCellDelegate chatMessageCellDelegate) {
return false;
}
public static void $default$videoTimerReached(ChatMessageCellDelegate chatMessageCellDelegate) {
}
}
}
public class BotButton {
private int angle;
private TLRPC$KeyboardButton button;
private int height;
private boolean isInviteButton;
private long lastUpdateTime;
private LoadingDrawable loadingDrawable;
private int positionFlags;
private ValueAnimator pressAnimator;
private float pressT;
private boolean pressed;
private float progressAlpha;
private Drawable selectorDrawable;
private StaticLayout title;
private int width;
private int x;
private int y;
private BotButton() {
}
static int access$3776(BotButton botButton, int i) {
int i2 = i | botButton.positionFlags;
botButton.positionFlags = i2;
return i2;
}
public void setPressed(boolean z) {
ValueAnimator valueAnimator;
if (this.pressed != z) {
this.pressed = z;
ChatMessageCell.this.invalidateOutbounds();
if (z && (valueAnimator = this.pressAnimator) != null) {
valueAnimator.removeAllListeners();
this.pressAnimator.cancel();
}
if (z) {
return;
}
float f = this.pressT;
if (f != 0.0f) {
ValueAnimator ofFloat = ValueAnimator.ofFloat(f, 0.0f);
this.pressAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
ChatMessageCell.BotButton.this.lambda$setPressed$0(valueAnimator2);
}
});
this.pressAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
super.onAnimationEnd(animator);
BotButton.this.pressAnimator = null;
}
});
this.pressAnimator.setInterpolator(new OvershootInterpolator(2.0f));
this.pressAnimator.setDuration(350L);
this.pressAnimator.start();
}
}
}
public void lambda$setPressed$0(ValueAnimator valueAnimator) {
this.pressT = ((Float) valueAnimator.getAnimatedValue()).floatValue();
ChatMessageCell.this.invalidateOutbounds();
}
public boolean hasPositionFlag(int i) {
return (this.positionFlags & i) == i;
}
public float getPressScale() {
if (this.pressed) {
float f = this.pressT;
if (f != 1.0f) {
float min = f + (Math.min(40.0f, 1000.0f / AndroidUtilities.screenRefreshRate) / 100.0f);
this.pressT = min;
this.pressT = Utilities.clamp(min, 1.0f, 0.0f);
ChatMessageCell.this.invalidateOutbounds();
}
}
return ((1.0f - this.pressT) * 0.04f) + 0.96f;
}
}
public static class PollButton {
private TLRPC$TL_pollAnswer answer;
private boolean chosen;
private boolean correct;
private int count;
private float decimal;
public int height;
private int percent;
private float percentProgress;
private boolean prevChosen;
private int prevPercent;
private float prevPercentProgress;
private StaticLayout title;
public int x;
public int y;
static int access$2412(PollButton pollButton, int i) {
int i2 = pollButton.percent + i;
pollButton.percent = i2;
return i2;
}
static float access$3124(PollButton pollButton, float f) {
float f2 = pollButton.decimal - f;
pollButton.decimal = f2;
return f2;
}
}
public static class InstantViewButton {
private ButtonBounce buttonBounce;
private float buttonWidth;
private StaticLayout layout;
private final RectF rect;
private Drawable selectorDrawable;
private float textX;
private int type;
private InstantViewButton() {
this.rect = new RectF();
}
static float access$4924(InstantViewButton instantViewButton, float f) {
float f2 = instantViewButton.textX - f;
instantViewButton.textX = f2;
return f2;
}
}
public boolean isCellAttachedToWindow() {
return this.attachedToWindow;
}
public class LoadingDrawableLocation {
int blockNum;
LoadingDrawable drawable;
LoadingDrawableLocation(ChatMessageCell chatMessageCell) {
}
}
public ChatMessageCell(Context context) {
this(context, false, null, null);
}
public ChatMessageCell(Context context, boolean z, ChatMessageSharedResources chatMessageSharedResources, Theme.ResourcesProvider resourcesProvider) {
super(context);
this.visibleOnScreen = true;
this.reactionsLayoutInBubble = new ReactionsLayoutInBubble(this);
this.giveawayMessageCell = new GiveawayMessageCell(this);
this.giveawayResultsMessageCell = new GiveawayResultsMessageCell(this);
this.scrollRect = new Rect();
this.drawnContactButtonsFlag = 0;
this.imageBackgroundGradientRotation = 45;
this.selectorDrawable = new Drawable[2];
this.selectorDrawableMaskType = new int[2];
this.instantButtonRect = new RectF();
this.pressedState = new int[]{R.attr.state_enabled, R.attr.state_pressed};
this.highlightCaptionToSetStart = -1;
this.highlightCaptionToSetEnd = -1;
this.deleteProgressRect = new RectF();
this.rect = new RectF();
this.timeAlpha = 1.0f;
this.controlsAlpha = 1.0f;
this.links = new LinkSpanDrawable.LinkCollector(this);
this.urlPathCache = new ArrayList<>();
this.urlPathSelection = new ArrayList<>();
this.rectPath = new Path();
this.pollButtons = new ArrayList<>();
this.botButtons = new ArrayList<>();
this.botButtonPath = new Path();
this.botButtonRadii = new float[8];
this.botButtonsByData = new HashMap<>();
this.botButtonsByPosition = new HashMap<>();
this.currentAccount = UserConfig.selectedAccount;
this.isCheckPressed = true;
this.drawBackground = true;
this.backgroundWidth = 100;
this.commentButtonRect = new Rect();
this.spoilersPatchedReplyTextLayout = new AtomicReference<>();
this.forwardedNameLayout = new StaticLayout[2];
this.forwardNameOffsetX = new float[2];
this.drawTime = true;
this.mediaSpoilerPath = new Path();
this.mediaSpoilerRadii = new float[8];
this.mediaSpoilerEffect = new SpoilerEffect();
this.unlockAlpha = 1.0f;
this.unlockSpoilerEffect = new SpoilerEffect();
this.unlockSpoilerPath = new Path();
this.unlockSpoilerRadii = new float[8];
this.replySelectorRect = new RectF();
this.ALPHA_PROPERTY_WORKAROUND = Build.VERSION.SDK_INT == 28;
this.alphaInternal = 1.0f;
this.transitionParams = new TransitionParams();
this.roundVideoPlayPipFloat = new AnimatedFloat(this, 200L, CubicBezierInterpolator.EASE_OUT);
this.diceFinishCallback = new Runnable() {
@Override
public void run() {
if (ChatMessageCell.this.delegate != null) {
ChatMessageCell.this.delegate.onDiceFinished();
}
}
};
this.invalidateRunnable = new Runnable() {
@Override
public void run() {
ChatMessageCell.this.checkLocationExpired();
if (ChatMessageCell.this.locationExpired) {
ChatMessageCell.this.invalidate();
ChatMessageCell.this.scheduledInvalidate = false;
return;
}
ChatMessageCell.this.invalidate(((int) r0.rect.left) - 5, ((int) ChatMessageCell.this.rect.top) - 5, ((int) ChatMessageCell.this.rect.right) + 5, ((int) ChatMessageCell.this.rect.bottom) + 5);
if (ChatMessageCell.this.scheduledInvalidate) {
AndroidUtilities.runOnUIThread(ChatMessageCell.this.invalidateRunnable, 1000L);
}
}
};
this.accessibilityVirtualViewBounds = new SparseArray<>();
this.currentFocusedVirtualView = -1;
this.backgroundCacheParams = new Theme.MessageDrawable.PathDrawParams();
this.replySpoilers = new ArrayList();
this.replySpoilersPool = new Stack<>();
this.sPath = new Path();
this.overridenDuration = -1L;
this.hadLongPress = false;
this.radialProgressAlpha = 1.0f;
this.ANIMATION_OFFSET_X = new Property<ChatMessageCell, Float>(this, Float.class, "animationOffsetX") {
@Override
public Float get(ChatMessageCell chatMessageCell) {
return Float.valueOf(chatMessageCell.animationOffsetX);
}
@Override
public void set(ChatMessageCell chatMessageCell, Float f) {
chatMessageCell.setAnimationOffsetX(f.floatValue());
}
};
this.resourcesProvider = resourcesProvider;
this.canDrawBackgroundInParent = z;
this.sharedResources = chatMessageSharedResources;
if (chatMessageSharedResources == null) {
this.sharedResources = new ChatMessageSharedResources(context);
}
this.backgroundDrawable = new MessageBackgroundDrawable(this);
ImageReceiver imageReceiver = new ImageReceiver();
this.avatarImage = imageReceiver;
imageReceiver.setAllowLoadingOnAttachedOnly(true);
this.avatarImage.setRoundRadius(AndroidUtilities.dp(21.0f));
this.avatarDrawable = new AvatarDrawable();
ImageReceiver imageReceiver2 = new ImageReceiver(this);
this.replyImageReceiver = imageReceiver2;
imageReceiver2.setAllowLoadingOnAttachedOnly(true);
this.replyImageReceiver.setRoundRadius(AndroidUtilities.dp(4.0f));
ImageReceiver imageReceiver3 = new ImageReceiver(this);
this.locationImageReceiver = imageReceiver3;
imageReceiver3.setAllowLoadingOnAttachedOnly(true);
this.locationImageReceiver.setRoundRadius(AndroidUtilities.dp(26.1f));
this.TAG = DownloadController.getInstance(this.currentAccount).generateObserverTag();
this.contactAvatarDrawable = new AvatarDrawable();
ImageReceiver imageReceiver4 = new ImageReceiver(this);
this.photoImage = imageReceiver4;
imageReceiver4.setAllowLoadingOnAttachedOnly(true);
this.photoImage.setUseRoundForThumbDrawable(true);
this.photoImage.setDelegate(this);
ImageReceiver imageReceiver5 = new ImageReceiver(this);
this.blurredPhotoImage = imageReceiver5;
imageReceiver5.setAllowLoadingOnAttachedOnly(true);
this.blurredPhotoImage.setUseRoundForThumbDrawable(true);
this.radialProgress = new RadialProgress2(this, resourcesProvider);
RadialProgress2 radialProgress2 = new RadialProgress2(this, resourcesProvider);
this.videoRadialProgress = radialProgress2;
radialProgress2.setDrawBackground(false);
this.videoRadialProgress.setCircleRadius(AndroidUtilities.dp(15.0f));
SeekBar seekBar = new SeekBar(this) {
@Override
protected void onTimestampUpdate(URLSpanNoUnderline uRLSpanNoUnderline) {
ChatMessageCell.this.setHighlightedSpan(uRLSpanNoUnderline);
}
};
this.seekBar = seekBar;
seekBar.setDelegate(this);
SeekBarWaveform seekBarWaveform = new SeekBarWaveform(context);
this.seekBarWaveform = seekBarWaveform;
seekBarWaveform.setDelegate(this);
this.seekBarWaveform.setParentView(this);
this.seekBarAccessibilityDelegate = new FloatSeekBarAccessibilityDelegate() {
@Override
public float getProgress() {
if (ChatMessageCell.this.currentMessageObject.isMusic()) {
return ChatMessageCell.this.seekBar.getProgress();
}
if (ChatMessageCell.this.currentMessageObject.isVoice()) {
return ChatMessageCell.this.useSeekBarWaveform ? ChatMessageCell.this.seekBarWaveform.getProgress() : ChatMessageCell.this.seekBar.getProgress();
}
if (ChatMessageCell.this.currentMessageObject.isRoundVideo()) {
return ChatMessageCell.this.currentMessageObject.audioProgress;
}
return 0.0f;
}
@Override
public void setProgress(float f) {
if (ChatMessageCell.this.currentMessageObject.isMusic()) {
ChatMessageCell.this.seekBar.setProgress(f);
} else if (ChatMessageCell.this.currentMessageObject.isVoice()) {
if (ChatMessageCell.this.useSeekBarWaveform) {
ChatMessageCell.this.seekBarWaveform.setProgress(f);
} else {
ChatMessageCell.this.seekBar.setProgress(f);
}
} else {
if (!ChatMessageCell.this.currentMessageObject.isRoundVideo()) {
return;
}
if (ChatMessageCell.this.useSeekBarWaveform) {
if (ChatMessageCell.this.seekBarWaveform != null) {
ChatMessageCell.this.seekBarWaveform.setProgress(f);
}
} else if (ChatMessageCell.this.seekBar != null) {
ChatMessageCell.this.seekBar.setProgress(f);
}
ChatMessageCell.this.currentMessageObject.audioProgress = f;
}
ChatMessageCell.this.onSeekBarDrag(f);
ChatMessageCell.this.invalidate();
}
};
this.roundVideoPlayingDrawable = new RoundVideoPlayingDrawable(this, resourcesProvider);
setImportantForAccessibility(1);
}
public void setResourcesProvider(Theme.ResourcesProvider resourcesProvider) {
this.resourcesProvider = resourcesProvider;
RadialProgress2 radialProgress2 = this.radialProgress;
if (radialProgress2 != null) {
radialProgress2.setResourcesProvider(resourcesProvider);
}
RadialProgress2 radialProgress22 = this.videoRadialProgress;
if (radialProgress22 != null) {
radialProgress22.setResourcesProvider(resourcesProvider);
}
RoundVideoPlayingDrawable roundVideoPlayingDrawable = this.roundVideoPlayingDrawable;
if (roundVideoPlayingDrawable != null) {
roundVideoPlayingDrawable.setResourcesProvider(resourcesProvider);
}
}
public Theme.ResourcesProvider getResourcesProvider() {
return this.resourcesProvider;
}
private void createPollUI() {
if (this.pollAvatarImages != null) {
return;
}
this.pollAvatarImages = new ImageReceiver[3];
this.pollAvatarDrawables = new AvatarDrawable[3];
this.pollAvatarImagesVisible = new boolean[3];
int i = 0;
while (true) {
ImageReceiver[] imageReceiverArr = this.pollAvatarImages;
if (i >= imageReceiverArr.length) {
break;
}
imageReceiverArr[i] = new ImageReceiver(this);
this.pollAvatarImages[i].setRoundRadius(AndroidUtilities.dp(8.0f));
this.pollAvatarDrawables[i] = new AvatarDrawable();
this.pollAvatarDrawables[i].setTextSize(AndroidUtilities.dp(22.0f));
i++;
}
this.pollCheckBox = new CheckBoxBase[10];
int i2 = 0;
while (true) {
CheckBoxBase[] checkBoxBaseArr = this.pollCheckBox;
if (i2 >= checkBoxBaseArr.length) {
return;
}
checkBoxBaseArr[i2] = new CheckBoxBase(this, 20, this.resourcesProvider);
this.pollCheckBox[i2].setDrawUnchecked(false);
this.pollCheckBox[i2].setBackgroundType(9);
i2++;
}
}
private void createCommentUI() {
if (this.commentAvatarImages != null) {
return;
}
this.commentAvatarImages = new ImageReceiver[3];
this.commentAvatarDrawables = new AvatarDrawable[3];
this.commentAvatarImagesVisible = new boolean[3];
int i = 0;
while (true) {
ImageReceiver[] imageReceiverArr = this.commentAvatarImages;
if (i >= imageReceiverArr.length) {
return;
}
imageReceiverArr[i] = new ImageReceiver(this);
this.commentAvatarImages[i].setRoundRadius(AndroidUtilities.dp(12.0f));
this.commentAvatarDrawables[i] = new AvatarDrawable();
this.commentAvatarDrawables[i].setTextSize(AndroidUtilities.dp(18.0f));
i++;
}
}
public void resetPressedLink(int i) {
if (i != -1) {
this.links.removeLinks(Integer.valueOf(i));
} else {
this.links.clear();
}
this.pressedEmoji = null;
if (this.pressedLink != null) {
if (this.pressedLinkType == i || i == -1) {
this.pressedLink = null;
this.pressedLinkType = -1;
invalidate();
}
}
}
private void resetUrlPaths() {
if (this.quoteHighlight != null) {
this.quoteHighlight = null;
}
if (this.urlPathSelection.isEmpty()) {
return;
}
this.urlPathCache.addAll(this.urlPathSelection);
this.urlPathSelection.clear();
}
private LinkPath obtainNewUrlPath() {
LinkPath linkPath;
if (!this.urlPathCache.isEmpty()) {
linkPath = this.urlPathCache.get(0);
this.urlPathCache.remove(0);
} else {
linkPath = new LinkPath(true);
}
linkPath.reset();
this.urlPathSelection.add(linkPath);
return linkPath;
}
public int[] getRealSpanStartAndEnd(Spannable spannable, CharacterStyle characterStyle) {
int i;
int i2;
boolean z;
TextStyleSpan.TextStyleRun style;
TLRPC$MessageEntity tLRPC$MessageEntity;
if (!(characterStyle instanceof URLSpanBrowser) || (style = ((URLSpanBrowser) characterStyle).getStyle()) == null || (tLRPC$MessageEntity = style.urlEntity) == null) {
i = 0;
i2 = 0;
z = false;
} else {
i2 = tLRPC$MessageEntity.offset;
i = tLRPC$MessageEntity.length + i2;
z = true;
}
if (!z) {
i2 = spannable.getSpanStart(characterStyle);
i = spannable.getSpanEnd(characterStyle);
}
return new int[]{i2, i};
}
private boolean checkNameMotionEvent(MotionEvent motionEvent) {
Drawable drawable;
ChatMessageCellDelegate chatMessageCellDelegate;
TLRPC$Chat tLRPC$Chat;
int i;
int i2;
if (!this.drawNameLayout || this.nameLayout == null || (drawable = this.nameLayoutSelector) == null || (this.currentUser == null && this.currentChat == null)) {
this.nameLayoutPressed = false;
return false;
}
boolean contains = drawable.getBounds().contains((int) motionEvent.getX(), (int) motionEvent.getY());
if (motionEvent.getAction() == 0) {
this.nameLayoutPressed = contains;
if (contains) {
if (Build.VERSION.SDK_INT >= 21) {
this.nameLayoutSelector.setHotspot((int) motionEvent.getX(), (int) motionEvent.getY());
}
this.nameLayoutSelector.setState(this.pressedState);
}
} else if (motionEvent.getAction() == 1 || motionEvent.getAction() == 3) {
if (motionEvent.getAction() == 1 && this.nameLayoutPressed && (chatMessageCellDelegate = this.delegate) != null) {
if (this.viaOnly) {
TLRPC$User tLRPC$User = this.currentViaBotUser;
if (tLRPC$User != null && tLRPC$User.bot_inline_placeholder == null) {
chatMessageCellDelegate.didPressViaBotNotInline(this, tLRPC$User != null ? tLRPC$User.id : 0L);
} else {
chatMessageCellDelegate.didPressViaBot(this, tLRPC$User != null ? tLRPC$User.username : this.currentMessageObject.messageOwner.via_bot_name);
}
} else {
TLRPC$User tLRPC$User2 = this.currentUser;
if (tLRPC$User2 != null) {
chatMessageCellDelegate.didPressUserAvatar(this, tLRPC$User2, motionEvent.getX(), motionEvent.getY());
} else {
TLRPC$Chat tLRPC$Chat2 = this.currentChat;
if (tLRPC$Chat2 != null) {
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader = this.currentMessageObject.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader != null) {
if (tLRPC$Chat2 == null && (tLRPC$MessageFwdHeader.flags & 16) != 0) {
i2 = tLRPC$MessageFwdHeader.saved_from_msg_id;
tLRPC$Chat = tLRPC$Chat2;
} else {
i2 = tLRPC$MessageFwdHeader.channel_post;
tLRPC$Chat = this.currentForwardChannel;
}
i = i2;
} else {
tLRPC$Chat = tLRPC$Chat2;
i = 0;
}
chatMessageCellDelegate.didPressChannelAvatar(this, tLRPC$Chat != null ? tLRPC$Chat : tLRPC$Chat2, i, this.lastTouchX, this.lastTouchY);
}
}
}
}
this.nameLayoutSelector.setState(StateSet.NOTHING);
this.nameLayoutPressed = false;
}
return this.nameLayoutPressed;
}
private boolean checkNameStatusMotionEvent(MotionEvent motionEvent) {
if (!this.drawNameLayout || this.nameLayout == null || this.nameLayoutSelector == null || ((this.currentUser == null && this.currentChat == null) || this.currentNameStatus == null || this.currentNameStatusDrawable == null)) {
this.nameStatusPressed = false;
return false;
}
boolean contains = this.nameStatusSelector.getBounds().contains((int) motionEvent.getX(), (int) motionEvent.getY());
if (motionEvent.getAction() == 0) {
this.nameStatusPressed = contains;
if (contains) {
if (Build.VERSION.SDK_INT >= 21) {
this.nameStatusSelector.setHotspot((int) motionEvent.getX(), (int) motionEvent.getY());
}
this.nameStatusSelector.setState(this.pressedState);
}
} else if (motionEvent.getAction() == 1 || motionEvent.getAction() == 3) {
if (motionEvent.getAction() == 1 && this.nameStatusPressed && this.delegate != null && this.currentUser != null) {
this.delegate.didPressUserStatus(this, this.currentUser, this.currentNameStatusDrawable.getDrawable() instanceof AnimatedEmojiDrawable ? ((AnimatedEmojiDrawable) this.currentNameStatusDrawable.getDrawable()).getDocument() : null);
invalidateOutbounds();
}
this.nameStatusSelector.setState(StateSet.NOTHING);
this.nameStatusPressed = false;
}
return this.nameStatusPressed;
}
private void resetCodeSelectors() {
MessageObject messageObject = this.currentMessageObject;
if (messageObject != null && messageObject.textLayoutBlocks != null) {
for (int i = 0; i < this.currentMessageObject.textLayoutBlocks.size(); i++) {
Drawable drawable = this.currentMessageObject.textLayoutBlocks.get(i).copySelector;
if (drawable != null) {
drawable.setState(StateSet.NOTHING);
}
}
}
if (this.captionLayout != null) {
for (int i2 = 0; i2 < this.captionLayout.textLayoutBlocks.size(); i2++) {
Drawable drawable2 = this.captionLayout.textLayoutBlocks.get(i2).copySelector;
if (drawable2 != null) {
drawable2.setState(StateSet.NOTHING);
}
}
}
}
private boolean checkTextBlockMotionEvent(MotionEvent motionEvent) {
ArrayList<MessageObject.TextLayoutBlock> arrayList;
int i;
boolean z;
boolean z2;
AnimatedEmojiSpan animatedEmojiSpan;
CharacterStyle[] characterStyleArr;
CharacterStyle[] characterStyleArr2;
ReplyMessageLine replyMessageLine;
ChatMessageCellDelegate chatMessageCellDelegate;
MessageObject messageObject = this.currentMessageObject;
int i2 = messageObject.type;
if ((i2 == 0 || i2 == 19 || i2 == 24) && (arrayList = messageObject.textLayoutBlocks) != null && !arrayList.isEmpty() && (this.currentMessageObject.messageText instanceof Spannable)) {
if (motionEvent.getAction() == 0 || (motionEvent.getAction() == 1 && (this.pressedLinkType == 1 || this.pressedCopyCode != null))) {
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
int i3 = this.textX;
if (x >= i3 && y >= (i = this.textY)) {
MessageObject messageObject2 = this.currentMessageObject;
if (x <= i3 + messageObject2.textWidth && y <= messageObject2.textHeight + i) {
int i4 = y - i;
int i5 = 0;
for (int i6 = 0; i6 < this.currentMessageObject.textLayoutBlocks.size() && this.currentMessageObject.textLayoutBlocks.get(i6).textYOffset <= i4; i6++) {
i5 = i6;
}
try {
MessageObject.TextLayoutBlock textLayoutBlock = this.currentMessageObject.textLayoutBlocks.get(i5);
int i7 = (int) (x - (this.textX - (textLayoutBlock.isRtl() ? this.currentMessageObject.textXOffset : 0.0f)));
int i8 = (int) (i4 - textLayoutBlock.textYOffset);
if (!textLayoutBlock.quote && textLayoutBlock.code && i7 > 0 && i7 <= this.currentMessageObject.textWidth && i8 >= ((textLayoutBlock.padTop + textLayoutBlock.height) + textLayoutBlock.padBottom) - AndroidUtilities.dp(38.0f) && i8 <= textLayoutBlock.padTop + textLayoutBlock.height + textLayoutBlock.padBottom) {
if (motionEvent.getAction() == 1) {
if (textLayoutBlock == this.pressedCopyCode && (chatMessageCellDelegate = this.delegate) != null) {
chatMessageCellDelegate.didPressCodeCopy(this, textLayoutBlock);
}
resetCodeSelectors();
this.pressedCopyCode = null;
} else {
this.pressedCopyCode = textLayoutBlock;
if (Build.VERSION.SDK_INT >= 21) {
textLayoutBlock.copySelector.setHotspot(i7, i8);
}
textLayoutBlock.copySelector.setState(this.pressedState);
}
return true;
}
int lineForVertical = textLayoutBlock.textLayout.getLineForVertical(i8);
float f = i7;
int offsetForHorizontal = textLayoutBlock.charactersOffset + textLayoutBlock.textLayout.getOffsetForHorizontal(lineForVertical, f);
float lineLeft = textLayoutBlock.textLayout.getLineLeft(lineForVertical);
if (lineLeft <= f && lineLeft + textLayoutBlock.textLayout.getLineWidth(lineForVertical) >= f) {
Spannable spannable = (Spannable) this.currentMessageObject.messageText;
CharacterStyle[] characterStyleArr3 = (CharacterStyle[]) spannable.getSpans(offsetForHorizontal, offsetForHorizontal, ClickableSpan.class);
if (characterStyleArr3 != null && characterStyleArr3.length != 0) {
z = false;
if (characterStyleArr3 != null || characterStyleArr3.length == 0) {
characterStyleArr3 = (CharacterStyle[]) spannable.getSpans(offsetForHorizontal, offsetForHorizontal, AnimatedEmojiSpan.class);
z = false;
}
if (characterStyleArr3.length != 0 && (!(characterStyleArr3[0] instanceof URLSpanBotCommand) || URLSpanBotCommand.enabled)) {
z2 = false;
if (!z2 && !AndroidUtilities.isAccessibilityScreenReaderEnabled()) {
if (motionEvent.getAction() != 0) {
if (characterStyleArr3[0] instanceof AnimatedEmojiSpan) {
AnimatedEmojiSpan animatedEmojiSpan2 = this.pressedEmoji;
if (animatedEmojiSpan2 == null || animatedEmojiSpan2 != characterStyleArr3[0]) {
resetPressedLink(1);
this.pressedEmoji = (AnimatedEmojiSpan) characterStyleArr3[0];
this.pressedLinkType = 1;
}
} else {
LinkSpanDrawable linkSpanDrawable = this.pressedLink;
if (linkSpanDrawable == null || linkSpanDrawable.getSpan() != characterStyleArr3[0]) {
this.links.removeLink(this.pressedLink);
LinkSpanDrawable linkSpanDrawable2 = new LinkSpanDrawable(characterStyleArr3[0], this.resourcesProvider, f, i8, spanSupportsLongPress(characterStyleArr3[0]));
this.pressedLink = linkSpanDrawable2;
linkSpanDrawable2.setColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outLinkSelectBackground : Theme.key_chat_linkSelectBackground));
if (textLayoutBlock.quote && (replyMessageLine = this.quoteLine) != null) {
this.pressedLink.setColor(Theme.multAlpha(replyMessageLine.getColor(), Theme.isCurrentThemeDark() ? 0.13f : 0.1f));
}
this.linkBlockNum = i5;
this.pressedLinkType = 1;
try {
LinkPath obtainNewPath = this.pressedLink.obtainNewPath();
int[] realSpanStartAndEnd = getRealSpanStartAndEnd(spannable, this.pressedLink.getSpan());
int i9 = realSpanStartAndEnd[0];
int i10 = textLayoutBlock.charactersOffset;
realSpanStartAndEnd[0] = i9 - i10;
realSpanStartAndEnd[1] = realSpanStartAndEnd[1] - i10;
obtainNewPath.setCurrentLayout(textLayoutBlock.textLayout, realSpanStartAndEnd[0], 0.0f);
textLayoutBlock.textLayout.getSelectionPath(realSpanStartAndEnd[0], realSpanStartAndEnd[1], obtainNewPath);
if (realSpanStartAndEnd[1] >= textLayoutBlock.charactersEnd) {
for (int i11 = i5 + 1; i11 < this.currentMessageObject.textLayoutBlocks.size(); i11++) {
MessageObject.TextLayoutBlock textLayoutBlock2 = this.currentMessageObject.textLayoutBlocks.get(i11);
if (z) {
int i12 = textLayoutBlock2.charactersOffset;
characterStyleArr2 = (CharacterStyle[]) spannable.getSpans(i12, i12, URLSpanMono.class);
} else {
int i13 = textLayoutBlock2.charactersOffset;
characterStyleArr2 = (CharacterStyle[]) spannable.getSpans(i13, i13, ClickableSpan.class);
}
if (characterStyleArr2 == null || characterStyleArr2.length == 0 || characterStyleArr2[0] != this.pressedLink.getSpan()) {
break;
}
LinkPath obtainNewPath2 = this.pressedLink.obtainNewPath();
obtainNewPath2.setCurrentLayout(textLayoutBlock2.textLayout, 0, textLayoutBlock2.textYOffset - textLayoutBlock.textYOffset);
int i14 = (realSpanStartAndEnd[1] + textLayoutBlock.charactersOffset) - textLayoutBlock2.charactersOffset;
textLayoutBlock2.textLayout.getSelectionPath(0, i14, obtainNewPath2);
if (i14 < textLayoutBlock2.charactersEnd - 1) {
break;
}
}
}
if (realSpanStartAndEnd[0] <= textLayoutBlock.charactersOffset) {
int i15 = 0;
for (int i16 = i5 - 1; i16 >= 0; i16--) {
MessageObject.TextLayoutBlock textLayoutBlock3 = this.currentMessageObject.textLayoutBlocks.get(i16);
if (z) {
int i17 = textLayoutBlock3.charactersEnd;
characterStyleArr = (CharacterStyle[]) spannable.getSpans(i17 - 1, i17 - 1, URLSpanMono.class);
} else {
int i18 = textLayoutBlock3.charactersEnd;
characterStyleArr = (CharacterStyle[]) spannable.getSpans(i18 - 1, i18 - 1, ClickableSpan.class);
}
if (characterStyleArr == null || characterStyleArr.length == 0 || characterStyleArr[0] != this.pressedLink.getSpan()) {
break;
}
LinkPath obtainNewPath3 = this.pressedLink.obtainNewPath();
i15 -= textLayoutBlock3.height;
int i19 = realSpanStartAndEnd[0];
int i20 = textLayoutBlock.charactersOffset;
int i21 = textLayoutBlock3.charactersOffset;
int i22 = (i19 + i20) - i21;
int i23 = (realSpanStartAndEnd[1] + i20) - i21;
obtainNewPath3.setCurrentLayout(textLayoutBlock3.textLayout, i22, i15);
textLayoutBlock3.textLayout.getSelectionPath(i22, i23, obtainNewPath3);
if (i22 > textLayoutBlock3.charactersOffset) {
break;
}
}
}
} catch (Exception e) {
FileLog.e(e);
}
this.links.addLink(this.pressedLink, 1);
}
}
invalidate();
return true;
}
if ((characterStyleArr3[0] instanceof AnimatedEmojiSpan) && (animatedEmojiSpan = this.pressedEmoji) == characterStyleArr3[0]) {
if (this.delegate.didPressAnimatedEmoji(this, animatedEmojiSpan)) {
resetPressedLink(1);
this.pressedEmoji = null;
return true;
}
resetPressedLink(1);
this.pressedEmoji = null;
} else {
LinkSpanDrawable linkSpanDrawable3 = this.pressedLink;
if (linkSpanDrawable3 != null && characterStyleArr3[0] == linkSpanDrawable3.getSpan()) {
this.delegate.didPressUrl(this, this.pressedLink.getSpan(), false);
resetPressedLink(1);
return true;
}
}
}
}
z2 = true;
if (!z2) {
if (motionEvent.getAction() != 0) {
}
}
}
characterStyleArr3 = (CharacterStyle[]) spannable.getSpans(offsetForHorizontal, offsetForHorizontal, URLSpanMono.class);
z = true;
if (characterStyleArr3 != null) {
}
characterStyleArr3 = (CharacterStyle[]) spannable.getSpans(offsetForHorizontal, offsetForHorizontal, AnimatedEmojiSpan.class);
z = false;
if (characterStyleArr3.length != 0) {
z2 = false;
if (!z2) {
}
}
z2 = true;
if (!z2) {
}
}
} catch (Exception e2) {
FileLog.e(e2);
}
}
}
resetPressedLink(1);
} else if (motionEvent.getAction() == 1) {
this.pressedCopyCode = null;
resetCodeSelectors();
}
}
return false;
}
private boolean checkCaptionMotionEvent(MotionEvent motionEvent) {
boolean z;
boolean z2;
AnimatedEmojiSpan animatedEmojiSpan;
CharacterStyle[] characterStyleArr;
CharacterStyle[] characterStyleArr2;
ReplyMessageLine replyMessageLine;
ChatMessageCellDelegate chatMessageCellDelegate;
if ((this.currentCaption instanceof Spannable) && this.captionLayout != null) {
if (motionEvent.getAction() == 0 || (motionEvent.getAction() == 1 && (this.pressedLinkType == 1 || this.pressedCopyCode != null))) {
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
float f = x;
float f2 = this.captionX;
if (f >= f2) {
float f3 = y;
float f4 = this.captionY;
if (f3 >= f4) {
MessageObject.TextLayoutBlocks textLayoutBlocks = this.captionLayout;
if (f <= f2 + textLayoutBlocks.textWidth && f3 <= textLayoutBlocks.textHeight + f4) {
int i = (int) (f3 - f4);
int i2 = 0;
for (int i3 = 0; i3 < this.captionLayout.textLayoutBlocks.size() && this.captionLayout.textLayoutBlocks.get(i3).textYOffset <= i; i3++) {
i2 = i3;
}
try {
MessageObject.TextLayoutBlock textLayoutBlock = this.captionLayout.textLayoutBlocks.get(i2);
int i4 = (int) (f - (this.captionX - (textLayoutBlock.isRtl() ? this.captionLayout.textXOffset : 0.0f)));
int i5 = (int) (i - textLayoutBlock.textYOffset);
if (!textLayoutBlock.quote && textLayoutBlock.code && i4 > 0 && i4 <= this.captionLayout.textWidth && i5 >= ((textLayoutBlock.padTop + textLayoutBlock.height) + textLayoutBlock.padBottom) - AndroidUtilities.dp(38.0f) && i5 <= textLayoutBlock.padTop + textLayoutBlock.height + textLayoutBlock.padBottom) {
if (motionEvent.getAction() == 1) {
if (textLayoutBlock == this.pressedCopyCode && (chatMessageCellDelegate = this.delegate) != null) {
chatMessageCellDelegate.didPressCodeCopy(this, textLayoutBlock);
}
resetCodeSelectors();
this.pressedCopyCode = null;
} else {
this.pressedCopyCode = textLayoutBlock;
if (Build.VERSION.SDK_INT >= 21) {
textLayoutBlock.copySelector.setHotspot(i4, i5);
}
textLayoutBlock.copySelector.setState(this.pressedState);
}
return true;
}
int lineForVertical = textLayoutBlock.textLayout.getLineForVertical(i5);
float f5 = i4;
int offsetForHorizontal = textLayoutBlock.charactersOffset + textLayoutBlock.textLayout.getOffsetForHorizontal(lineForVertical, f5);
float lineLeft = textLayoutBlock.textLayout.getLineLeft(lineForVertical);
if (lineLeft <= f5 && lineLeft + textLayoutBlock.textLayout.getLineWidth(lineForVertical) >= f5) {
Spannable spannable = (Spannable) this.currentCaption;
CharacterStyle[] characterStyleArr3 = (CharacterStyle[]) spannable.getSpans(offsetForHorizontal, offsetForHorizontal, ClickableSpan.class);
if (characterStyleArr3 != null && characterStyleArr3.length != 0) {
z = false;
if (characterStyleArr3 != null || characterStyleArr3.length == 0) {
characterStyleArr3 = (CharacterStyle[]) spannable.getSpans(offsetForHorizontal, offsetForHorizontal, AnimatedEmojiSpan.class);
z = false;
}
if (characterStyleArr3.length != 0 && (!(characterStyleArr3[0] instanceof URLSpanBotCommand) || URLSpanBotCommand.enabled)) {
z2 = false;
if (!z2 && !AndroidUtilities.isAccessibilityScreenReaderEnabled()) {
if (motionEvent.getAction() != 0) {
if (characterStyleArr3[0] instanceof AnimatedEmojiSpan) {
AnimatedEmojiSpan animatedEmojiSpan2 = this.pressedEmoji;
if (animatedEmojiSpan2 == null || animatedEmojiSpan2 != characterStyleArr3[0]) {
resetPressedLink(1);
this.pressedEmoji = (AnimatedEmojiSpan) characterStyleArr3[0];
this.pressedLinkType = 1;
}
} else {
LinkSpanDrawable linkSpanDrawable = this.pressedLink;
if (linkSpanDrawable == null || linkSpanDrawable.getSpan() != characterStyleArr3[0]) {
this.links.removeLink(this.pressedLink);
LinkSpanDrawable linkSpanDrawable2 = new LinkSpanDrawable(characterStyleArr3[0], this.resourcesProvider, f5, i5, spanSupportsLongPress(characterStyleArr3[0]));
this.pressedLink = linkSpanDrawable2;
linkSpanDrawable2.setColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outLinkSelectBackground : Theme.key_chat_linkSelectBackground));
if (textLayoutBlock.quote && (replyMessageLine = this.quoteLine) != null) {
this.pressedLink.setColor(Theme.multAlpha(replyMessageLine.getColor(), Theme.isCurrentThemeDark() ? 0.13f : 0.1f));
}
this.linkBlockNum = i2;
this.pressedLinkType = 1;
try {
LinkPath obtainNewPath = this.pressedLink.obtainNewPath();
int[] realSpanStartAndEnd = getRealSpanStartAndEnd(spannable, this.pressedLink.getSpan());
int i6 = realSpanStartAndEnd[0];
int i7 = textLayoutBlock.charactersOffset;
realSpanStartAndEnd[0] = i6 - i7;
realSpanStartAndEnd[1] = realSpanStartAndEnd[1] - i7;
obtainNewPath.setCurrentLayout(textLayoutBlock.textLayout, realSpanStartAndEnd[0], 0.0f);
textLayoutBlock.textLayout.getSelectionPath(realSpanStartAndEnd[0], realSpanStartAndEnd[1], obtainNewPath);
if (realSpanStartAndEnd[1] >= textLayoutBlock.charactersEnd) {
for (int i8 = i2 + 1; i8 < this.captionLayout.textLayoutBlocks.size(); i8++) {
MessageObject.TextLayoutBlock textLayoutBlock2 = this.captionLayout.textLayoutBlocks.get(i8);
if (z) {
int i9 = textLayoutBlock2.charactersOffset;
characterStyleArr2 = (CharacterStyle[]) spannable.getSpans(i9, i9, URLSpanMono.class);
} else {
int i10 = textLayoutBlock2.charactersOffset;
characterStyleArr2 = (CharacterStyle[]) spannable.getSpans(i10, i10, ClickableSpan.class);
}
if (characterStyleArr2 == null || characterStyleArr2.length == 0 || characterStyleArr2[0] != this.pressedLink.getSpan()) {
break;
}
LinkPath obtainNewPath2 = this.pressedLink.obtainNewPath();
obtainNewPath2.setCurrentLayout(textLayoutBlock2.textLayout, 0, textLayoutBlock2.textYOffset - textLayoutBlock.textYOffset);
int i11 = (realSpanStartAndEnd[1] + textLayoutBlock.charactersOffset) - textLayoutBlock2.charactersOffset;
textLayoutBlock2.textLayout.getSelectionPath(0, i11, obtainNewPath2);
if (i11 < textLayoutBlock2.charactersEnd - 1) {
break;
}
}
}
if (realSpanStartAndEnd[0] <= textLayoutBlock.charactersOffset) {
int i12 = 0;
for (int i13 = i2 - 1; i13 >= 0; i13--) {
MessageObject.TextLayoutBlock textLayoutBlock3 = this.captionLayout.textLayoutBlocks.get(i13);
if (z) {
int i14 = textLayoutBlock3.charactersEnd;
characterStyleArr = (CharacterStyle[]) spannable.getSpans(i14 - 1, i14 - 1, URLSpanMono.class);
} else {
int i15 = textLayoutBlock3.charactersEnd;
characterStyleArr = (CharacterStyle[]) spannable.getSpans(i15 - 1, i15 - 1, ClickableSpan.class);
}
if (characterStyleArr == null || characterStyleArr.length == 0 || characterStyleArr[0] != this.pressedLink.getSpan()) {
break;
}
LinkPath obtainNewPath3 = this.pressedLink.obtainNewPath();
i12 -= textLayoutBlock3.height;
int i16 = realSpanStartAndEnd[0];
int i17 = textLayoutBlock.charactersOffset;
int i18 = textLayoutBlock3.charactersOffset;
int i19 = (i16 + i17) - i18;
int i20 = (realSpanStartAndEnd[1] + i17) - i18;
obtainNewPath3.setCurrentLayout(textLayoutBlock3.textLayout, i19, i12);
textLayoutBlock3.textLayout.getSelectionPath(i19, i20, obtainNewPath3);
if (i19 > textLayoutBlock3.charactersOffset) {
break;
}
}
}
} catch (Exception e) {
FileLog.e(e);
}
this.links.addLink(this.pressedLink, 1);
}
}
invalidate();
return true;
}
if ((characterStyleArr3[0] instanceof AnimatedEmojiSpan) && (animatedEmojiSpan = this.pressedEmoji) == characterStyleArr3[0]) {
if (this.delegate.didPressAnimatedEmoji(this, animatedEmojiSpan)) {
resetPressedLink(1);
this.pressedEmoji = null;
return true;
}
resetPressedLink(1);
this.pressedEmoji = null;
} else {
LinkSpanDrawable linkSpanDrawable3 = this.pressedLink;
if (linkSpanDrawable3 != null && characterStyleArr3[0] == linkSpanDrawable3.getSpan()) {
this.delegate.didPressUrl(this, this.pressedLink.getSpan(), false);
resetPressedLink(1);
return true;
}
}
}
}
z2 = true;
if (!z2) {
if (motionEvent.getAction() != 0) {
}
}
}
characterStyleArr3 = (CharacterStyle[]) spannable.getSpans(offsetForHorizontal, offsetForHorizontal, URLSpanMono.class);
z = true;
if (characterStyleArr3 != null) {
}
characterStyleArr3 = (CharacterStyle[]) spannable.getSpans(offsetForHorizontal, offsetForHorizontal, AnimatedEmojiSpan.class);
z = false;
if (characterStyleArr3.length != 0) {
z2 = false;
if (!z2) {
}
}
z2 = true;
if (!z2) {
}
}
} catch (Exception e2) {
FileLog.e(e2);
}
}
}
}
resetPressedLink(1);
} else if (motionEvent.getAction() == 1) {
this.pressedCopyCode = null;
resetCodeSelectors();
}
}
return false;
}
private boolean checkGameMotionEvent(MotionEvent motionEvent) {
boolean z;
LinkSpanDrawable linkSpanDrawable;
int i;
int i2;
if (!this.hasGamePreview) {
return false;
}
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
if (motionEvent.getAction() == 0) {
if (this.drawPhotoImage && this.drawImageButton && this.buttonState != -1 && x >= (i = this.buttonX) && x <= i + AndroidUtilities.dp(48.0f) && y >= (i2 = this.buttonY) && y <= i2 + AndroidUtilities.dp(48.0f) && this.radialProgress.getIcon() != 4) {
this.buttonPressed = 1;
invalidate();
return true;
}
if (this.drawPhotoImage && this.photoImage.isInsideImage(x, y)) {
this.gamePreviewPressed = true;
return true;
}
if (this.descriptionLayout != null && y >= this.descriptionY) {
try {
int dp = x - ((this.unmovedTextX + AndroidUtilities.dp(10.0f)) + this.descriptionX);
int i3 = y - this.descriptionY;
int lineForVertical = this.descriptionLayout.getLineForVertical(i3);
float f = dp;
int offsetForHorizontal = this.descriptionLayout.getOffsetForHorizontal(lineForVertical, f);
float lineLeft = this.descriptionLayout.getLineLeft(lineForVertical);
if (lineLeft <= f && lineLeft + this.descriptionLayout.getLineWidth(lineForVertical) >= f) {
Spannable spannable = (Spannable) this.currentMessageObject.linkDescription;
ClickableSpan[] clickableSpanArr = (ClickableSpan[]) spannable.getSpans(offsetForHorizontal, offsetForHorizontal, ClickableSpan.class);
if (clickableSpanArr.length != 0 && (!(clickableSpanArr[0] instanceof URLSpanBotCommand) || URLSpanBotCommand.enabled)) {
z = false;
if (!z && !AndroidUtilities.isAccessibilityScreenReaderEnabled()) {
linkSpanDrawable = this.pressedLink;
if (linkSpanDrawable != null || linkSpanDrawable.getSpan() != clickableSpanArr[0]) {
this.links.removeLink(this.pressedLink);
LinkSpanDrawable linkSpanDrawable2 = new LinkSpanDrawable(clickableSpanArr[0], this.resourcesProvider, f, i3, spanSupportsLongPress(clickableSpanArr[0]));
this.pressedLink = linkSpanDrawable2;
linkSpanDrawable2.setColor(getThemedColor(!this.currentMessageObject.isOutOwner() ? Theme.key_chat_outLinkSelectBackground : Theme.key_chat_linkSelectBackground));
this.linkBlockNum = -10;
this.pressedLinkType = 2;
try {
LinkPath obtainNewPath = this.pressedLink.obtainNewPath();
int[] realSpanStartAndEnd = getRealSpanStartAndEnd(spannable, this.pressedLink.getSpan());
obtainNewPath.setCurrentLayout(this.descriptionLayout, realSpanStartAndEnd[0], 0.0f);
this.descriptionLayout.getSelectionPath(realSpanStartAndEnd[0], realSpanStartAndEnd[1], obtainNewPath);
} catch (Exception e) {
FileLog.e(e);
}
this.links.addLink(this.pressedLink, 2);
}
invalidate();
return true;
}
}
z = true;
if (!z) {
linkSpanDrawable = this.pressedLink;
if (linkSpanDrawable != null) {
}
this.links.removeLink(this.pressedLink);
LinkSpanDrawable linkSpanDrawable22 = new LinkSpanDrawable(clickableSpanArr[0], this.resourcesProvider, f, i3, spanSupportsLongPress(clickableSpanArr[0]));
this.pressedLink = linkSpanDrawable22;
linkSpanDrawable22.setColor(getThemedColor(!this.currentMessageObject.isOutOwner() ? Theme.key_chat_outLinkSelectBackground : Theme.key_chat_linkSelectBackground));
this.linkBlockNum = -10;
this.pressedLinkType = 2;
LinkPath obtainNewPath2 = this.pressedLink.obtainNewPath();
int[] realSpanStartAndEnd2 = getRealSpanStartAndEnd(spannable, this.pressedLink.getSpan());
obtainNewPath2.setCurrentLayout(this.descriptionLayout, realSpanStartAndEnd2[0], 0.0f);
this.descriptionLayout.getSelectionPath(realSpanStartAndEnd2[0], realSpanStartAndEnd2[1], obtainNewPath2);
this.links.addLink(this.pressedLink, 2);
invalidate();
return true;
}
}
} catch (Exception e2) {
FileLog.e(e2);
}
}
} else if (motionEvent.getAction() == 1) {
if (this.pressedLinkType == 2 || this.gamePreviewPressed || this.buttonPressed != 0) {
if (this.buttonPressed != 0) {
this.buttonPressed = 0;
playSoundEffect(0);
didPressButton(true, false);
invalidate();
} else {
LinkSpanDrawable linkSpanDrawable3 = this.pressedLink;
if (linkSpanDrawable3 != null) {
if (linkSpanDrawable3.getSpan() instanceof URLSpan) {
Browser.openUrl(getContext(), ((URLSpan) this.pressedLink.getSpan()).getURL());
} else if (this.pressedLink.getSpan() instanceof ClickableSpan) {
((ClickableSpan) this.pressedLink.getSpan()).onClick(this);
}
resetPressedLink(2);
} else {
this.gamePreviewPressed = false;
int i4 = 0;
while (true) {
if (i4 >= this.botButtons.size()) {
break;
}
BotButton botButton = this.botButtons.get(i4);
if (botButton.button instanceof TLRPC$TL_keyboardButtonGame) {
playSoundEffect(0);
this.delegate.didPressBotButton(this, botButton.button);
invalidate();
break;
}
i4++;
}
resetPressedLink(2);
return true;
}
}
} else {
resetPressedLink(2);
}
}
return false;
}
private boolean checkTranscribeButtonMotionEvent(MotionEvent motionEvent) {
TranscribeButton transcribeButton;
return this.useTranscribeButton && (!this.isPlayingRound || getVideoTranscriptionProgress() > 0.0f || this.wasTranscriptionOpen) && (transcribeButton = this.transcribeButton) != null && transcribeButton.onTouch(motionEvent.getAction(), motionEvent.getX(), motionEvent.getY());
}
private boolean checkLinkPreviewMotionEvent(MotionEvent motionEvent) {
int i;
boolean z;
int i2;
int i3;
int i4;
int i5;
boolean z2;
LinkSpanDrawable linkSpanDrawable;
int themedColor;
MessageObject messageObject;
int i6 = this.currentMessageObject.type;
if ((i6 != 0 && i6 != 24) || !this.hasLinkPreview) {
return false;
}
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
int i7 = this.unmovedTextX;
if (x >= i7 && x <= (i7 + this.backgroundWidth) - AndroidUtilities.dp(14.0f) && y >= (i = this.linkPreviewY)) {
if (y <= i + this.linkPreviewHeight + AndroidUtilities.dp((this.drawInstantView ? 46 : 0) + 8)) {
if (motionEvent.getAction() == 0) {
if (this.descriptionLayout != null && y >= this.descriptionY && !this.currentMessageObject.preview) {
try {
int dp = x - ((this.unmovedTextX + AndroidUtilities.dp(10.0f)) + this.descriptionX);
int i8 = y - this.descriptionY;
if (i8 <= this.descriptionLayout.getHeight()) {
int lineForVertical = this.descriptionLayout.getLineForVertical(i8);
float f = dp;
int offsetForHorizontal = this.descriptionLayout.getOffsetForHorizontal(lineForVertical, f);
float lineLeft = this.descriptionLayout.getLineLeft(lineForVertical);
if (lineLeft <= f && lineLeft + this.descriptionLayout.getLineWidth(lineForVertical) >= f) {
Spannable spannable = (Spannable) this.currentMessageObject.linkDescription;
ClickableSpan[] clickableSpanArr = (ClickableSpan[]) spannable.getSpans(offsetForHorizontal, offsetForHorizontal, ClickableSpan.class);
if (clickableSpanArr.length != 0 && (!(clickableSpanArr[0] instanceof URLSpanBotCommand) || URLSpanBotCommand.enabled)) {
z2 = false;
if (!z2 && !AndroidUtilities.isAccessibilityScreenReaderEnabled()) {
linkSpanDrawable = this.pressedLink;
if (linkSpanDrawable != null || linkSpanDrawable.getSpan() != clickableSpanArr[0]) {
this.links.removeLink(this.pressedLink);
LinkSpanDrawable linkSpanDrawable2 = new LinkSpanDrawable(clickableSpanArr[0], this.resourcesProvider, x, y, spanSupportsLongPress(clickableSpanArr[0]));
this.pressedLink = linkSpanDrawable2;
if (this.hasLinkPreview || this.linkLine == null || (messageObject = this.currentMessageObject) == null || messageObject.isOutOwner()) {
themedColor = getThemedColor(!this.currentMessageObject.isOutOwner() ? Theme.key_chat_outLinkSelectBackground : Theme.key_chat_linkSelectBackground);
} else {
themedColor = Theme.multAlpha(this.linkLine.getColor(), 0.1f);
}
linkSpanDrawable2.setColor(themedColor);
this.linkBlockNum = -10;
this.pressedLinkType = 2;
startCheckLongPress();
try {
LinkPath obtainNewPath = this.pressedLink.obtainNewPath();
int[] realSpanStartAndEnd = getRealSpanStartAndEnd(spannable, this.pressedLink.getSpan());
obtainNewPath.setCurrentLayout(this.descriptionLayout, realSpanStartAndEnd[0], 0.0f);
this.descriptionLayout.getSelectionPath(realSpanStartAndEnd[0], realSpanStartAndEnd[1], obtainNewPath);
} catch (Exception e) {
FileLog.e(e);
}
this.links.addLink(this.pressedLink, 2);
}
invalidate();
return true;
}
}
z2 = true;
if (!z2) {
linkSpanDrawable = this.pressedLink;
if (linkSpanDrawable != null) {
}
this.links.removeLink(this.pressedLink);
LinkSpanDrawable linkSpanDrawable22 = new LinkSpanDrawable(clickableSpanArr[0], this.resourcesProvider, x, y, spanSupportsLongPress(clickableSpanArr[0]));
this.pressedLink = linkSpanDrawable22;
if (this.hasLinkPreview) {
}
themedColor = getThemedColor(!this.currentMessageObject.isOutOwner() ? Theme.key_chat_outLinkSelectBackground : Theme.key_chat_linkSelectBackground);
linkSpanDrawable22.setColor(themedColor);
this.linkBlockNum = -10;
this.pressedLinkType = 2;
startCheckLongPress();
LinkPath obtainNewPath2 = this.pressedLink.obtainNewPath();
int[] realSpanStartAndEnd2 = getRealSpanStartAndEnd(spannable, this.pressedLink.getSpan());
obtainNewPath2.setCurrentLayout(this.descriptionLayout, realSpanStartAndEnd2[0], 0.0f);
this.descriptionLayout.getSelectionPath(realSpanStartAndEnd2[0], realSpanStartAndEnd2[1], obtainNewPath2);
this.links.addLink(this.pressedLink, 2);
invalidate();
return true;
}
}
}
} catch (Exception e2) {
FileLog.e(e2);
}
}
if (this.pressedLink == null) {
int dp2 = AndroidUtilities.dp(48.0f);
if (this.miniButtonState >= 0) {
int dp3 = AndroidUtilities.dp(27.0f);
int i9 = this.buttonX;
if (x >= i9 + dp3 && x <= i9 + dp3 + dp2) {
int i10 = this.buttonY;
if (y >= i10 + dp3 && y <= i10 + dp3 + dp2) {
z = true;
if (!z) {
this.miniButtonPressed = 1;
invalidate();
return true;
}
if (this.drawVideoImageButton && this.buttonState != -1 && x >= (i4 = this.videoButtonX) && x <= i4 + AndroidUtilities.dp(34.0f) + Math.max(this.infoWidth, this.docTitleWidth) && y >= (i5 = this.videoButtonY) && y <= i5 + AndroidUtilities.dp(30.0f)) {
this.videoButtonPressed = 1;
invalidate();
return true;
}
if (this.drawPhotoImage && this.drawImageButton && this.buttonState != -1 && ((!this.checkOnlyButtonPressed && this.photoImage.isInsideImage(x, y)) || (x >= (i2 = this.buttonX) && x <= i2 + AndroidUtilities.dp(48.0f) && y >= (i3 = this.buttonY) && y <= i3 + AndroidUtilities.dp(48.0f) && this.radialProgress.getIcon() != 4))) {
this.buttonPressed = 1;
invalidate();
return true;
}
this.instantPressed = true;
this.selectorDrawableMaskType[0] = 0;
if (Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr = this.selectorDrawable;
if (drawableArr[0] != null && drawableArr[0].getBounds().contains(x, y)) {
this.selectorDrawable[0].setHotspot(x, y);
this.selectorDrawable[0].setState(this.pressedState);
}
Drawable drawable = this.linkPreviewSelector;
if (drawable != null && drawable.getBounds().contains(x, y)) {
this.linkPreviewSelector.setHotspot(x, y);
this.linkPreviewSelector.setState(this.pressedState);
}
setInstantButtonPressed(true);
}
ButtonBounce buttonBounce = this.linkPreviewBounce;
if (buttonBounce != null) {
buttonBounce.setPressed(true);
}
invalidate();
return true;
}
}
}
z = false;
if (!z) {
}
}
} else if (motionEvent.getAction() == 1) {
if (this.instantPressed) {
if (this.documentAttachType == 7) {
if (!MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || MediaController.getInstance().isMessagePaused()) {
this.delegate.needPlayMessage(this, this.currentMessageObject, false);
} else {
MediaController.getInstance().lambda$startAudioAgain$7(this.currentMessageObject);
}
} else if (this.drawInstantView) {
ChatMessageCellDelegate chatMessageCellDelegate = this.delegate;
if (chatMessageCellDelegate != null) {
chatMessageCellDelegate.didPressInstantButton(this, this.drawInstantViewType);
}
} else if (this.drawPhotoImage && this.authorLayout == null && this.titleLayout == null && this.descriptionLayout == null && this.siteNameLayout == null) {
ChatMessageCellDelegate chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
chatMessageCellDelegate2.didPressImage(this, this.lastTouchX, this.lastTouchY);
}
} else {
MessageObject messageObject2 = this.currentMessageObject;
if (!messageObject2.preview) {
TLRPC$WebPage tLRPC$WebPage = MessageObject.getMedia(messageObject2.messageOwner).webpage;
if (tLRPC$WebPage != null && !TextUtils.isEmpty(tLRPC$WebPage.embed_url)) {
ChatMessageCellDelegate chatMessageCellDelegate3 = this.delegate;
if (chatMessageCellDelegate3 != null) {
chatMessageCellDelegate3.needOpenWebView(this.currentMessageObject, tLRPC$WebPage.embed_url, tLRPC$WebPage.site_name, tLRPC$WebPage.title, tLRPC$WebPage.url, tLRPC$WebPage.embed_width, tLRPC$WebPage.embed_height);
}
} else if (tLRPC$WebPage != null) {
ChatMessageCellDelegate chatMessageCellDelegate4 = this.delegate;
if (chatMessageCellDelegate4 != null) {
chatMessageCellDelegate4.didPressWebPage(this, tLRPC$WebPage, tLRPC$WebPage.url, MessageObject.getMedia(this.currentMessageObject.messageOwner).safe);
} else {
Browser.openUrl(getContext(), tLRPC$WebPage.url);
}
}
}
}
playSoundEffect(0);
if (Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr2 = this.selectorDrawable;
if (drawableArr2[0] != null) {
drawableArr2[0].setState(StateSet.NOTHING);
}
Drawable drawable2 = this.linkPreviewSelector;
if (drawable2 != null) {
drawable2.setState(StateSet.NOTHING);
}
}
ButtonBounce buttonBounce2 = this.linkPreviewBounce;
if (buttonBounce2 != null) {
buttonBounce2.setPressed(false);
}
this.instantPressed = false;
setInstantButtonPressed(false);
invalidate();
} else if (this.pressedLinkType == 2 || this.buttonPressed != 0 || this.miniButtonPressed != 0 || this.videoButtonPressed != 0 || this.linkPreviewPressed) {
if (this.videoButtonPressed == 1) {
this.videoButtonPressed = 0;
playSoundEffect(0);
didPressButton(true, true);
invalidate();
} else if (this.buttonPressed != 0) {
this.buttonPressed = 0;
playSoundEffect(0);
if (this.drawVideoImageButton) {
didClickedImage();
} else {
didPressButton(true, false);
}
invalidate();
} else if (this.miniButtonPressed != 0) {
this.miniButtonPressed = 0;
playSoundEffect(0);
didPressMiniButton(true);
invalidate();
} else {
LinkSpanDrawable linkSpanDrawable3 = this.pressedLink;
if (linkSpanDrawable3 != null) {
if (linkSpanDrawable3.getSpan() instanceof URLSpan) {
this.delegate.didPressUrl(this, this.pressedLink.getSpan(), false);
} else if (this.pressedLink.getSpan() instanceof ClickableSpan) {
((ClickableSpan) this.pressedLink.getSpan()).onClick(this);
}
resetPressedLink(2);
} else {
AnimatedEmojiSpan animatedEmojiSpan = this.pressedEmoji;
if (animatedEmojiSpan != null && this.delegate.didPressAnimatedEmoji(this, animatedEmojiSpan)) {
this.pressedEmoji = null;
resetPressedLink(2);
} else {
if (this.documentAttachType == 2 && this.drawImageButton) {
int i11 = this.buttonState;
if (i11 == -1) {
if (SharedConfig.isAutoplayGifs() && !this.currentMessageObject.isRepostPreview) {
this.delegate.didPressImage(this, this.lastTouchX, this.lastTouchY);
} else {
this.buttonState = 2;
this.currentMessageObject.gifState = 1.0f;
this.photoImage.setAllowStartAnimation(false);
this.photoImage.stopAnimation();
this.radialProgress.setIcon(getIconForCurrentState(), false, true);
invalidate();
playSoundEffect(0);
}
} else if (i11 == 2 || i11 == 0) {
didPressButton(true, false);
playSoundEffect(0);
}
} else {
MessageObject messageObject3 = this.currentMessageObject;
if (!messageObject3.preview) {
TLRPC$WebPage tLRPC$WebPage2 = MessageObject.getMedia(messageObject3.messageOwner).webpage;
if (tLRPC$WebPage2 != null && !TextUtils.isEmpty(tLRPC$WebPage2.embed_url)) {
this.delegate.needOpenWebView(this.currentMessageObject, tLRPC$WebPage2.embed_url, tLRPC$WebPage2.site_name, tLRPC$WebPage2.title, tLRPC$WebPage2.url, tLRPC$WebPage2.embed_width, tLRPC$WebPage2.embed_height);
} else {
int i12 = this.buttonState;
if (i12 == -1 || i12 == 3) {
this.delegate.didPressImage(this, this.lastTouchX, this.lastTouchY);
playSoundEffect(0);
} else if (tLRPC$WebPage2 != null) {
ChatMessageCellDelegate chatMessageCellDelegate5 = this.delegate;
if (chatMessageCellDelegate5 != null) {
chatMessageCellDelegate5.didPressWebPage(this, tLRPC$WebPage2, tLRPC$WebPage2.url, MessageObject.getMedia(this.currentMessageObject.messageOwner).safe);
} else {
Browser.openUrl(getContext(), tLRPC$WebPage2.url);
}
}
}
}
}
resetPressedLink(2);
return true;
}
}
}
} else if (!this.hadLongPress) {
this.hadLongPress = false;
resetPressedLink(2);
}
} else if (motionEvent.getAction() == 2 && this.instantButtonPressed && Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr3 = this.selectorDrawable;
if (drawableArr3[0] != null) {
drawableArr3[0].setHotspot(x, y);
}
Drawable drawable3 = this.linkPreviewSelector;
if (drawable3 != null) {
drawable3.setHotspot(x, y);
}
}
}
}
return false;
}
private boolean checkPollButtonMotionEvent(MotionEvent motionEvent) {
int i;
int i2;
if (this.currentMessageObject.eventId != 0 || this.pollVoteInProgress || this.pollUnvoteInProgress || this.pollButtons.isEmpty()) {
return false;
}
MessageObject messageObject = this.currentMessageObject;
if (messageObject.type != 17 || !messageObject.isSent()) {
return false;
}
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
if (motionEvent.getAction() == 0) {
this.pressedVoteButton = -1;
this.pollHintPressed = false;
if (this.hintButtonVisible && (i = this.pollHintX) != -1 && x >= i && x <= i + AndroidUtilities.dp(40.0f) && y >= (i2 = this.pollHintY) && y <= i2 + AndroidUtilities.dp(40.0f)) {
this.pollHintPressed = true;
this.selectorDrawableMaskType[0] = 3;
if (Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr = this.selectorDrawable;
if (drawableArr[0] != null) {
drawableArr[0].setBounds(this.pollHintX - AndroidUtilities.dp(8.0f), this.pollHintY - AndroidUtilities.dp(8.0f), this.pollHintX + AndroidUtilities.dp(32.0f), this.pollHintY + AndroidUtilities.dp(32.0f));
this.selectorDrawable[0].setHotspot(x, y);
this.selectorDrawable[0].setState(this.pressedState);
}
}
invalidate();
} else {
for (int i3 = 0; i3 < this.pollButtons.size(); i3++) {
PollButton pollButton = this.pollButtons.get(i3);
int dp = (pollButton.y + this.namesOffset) - AndroidUtilities.dp(13.0f);
int i4 = pollButton.x;
if (x >= i4 && x <= (i4 + this.backgroundWidth) - AndroidUtilities.dp(31.0f) && y >= dp && y <= pollButton.height + dp + AndroidUtilities.dp(26.0f)) {
this.pressedVoteButton = i3;
if (!this.pollVoted && !this.pollClosed) {
this.selectorDrawableMaskType[0] = 1;
if (Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr2 = this.selectorDrawable;
if (drawableArr2[0] != null) {
drawableArr2[0].setBounds(pollButton.x - AndroidUtilities.dp(9.0f), dp, (pollButton.x + this.backgroundWidth) - AndroidUtilities.dp(22.0f), pollButton.height + dp + AndroidUtilities.dp(26.0f));
this.selectorDrawable[0].setHotspot(x, y);
this.selectorDrawable[0].setState(this.pressedState);
}
}
invalidate();
}
}
}
return false;
}
return true;
}
if (motionEvent.getAction() == 1) {
if (this.pollHintPressed) {
playSoundEffect(0);
this.delegate.didPressHint(this, 0);
this.pollHintPressed = false;
if (Build.VERSION.SDK_INT < 21) {
return false;
}
Drawable[] drawableArr3 = this.selectorDrawable;
if (drawableArr3[0] == null) {
return false;
}
drawableArr3[0].setState(StateSet.NOTHING);
return false;
}
if (this.pressedVoteButton == -1) {
return false;
}
playSoundEffect(0);
if (Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr4 = this.selectorDrawable;
if (drawableArr4[0] != null) {
drawableArr4[0].setState(StateSet.NOTHING);
}
}
if (this.currentMessageObject.scheduled) {
Toast.makeText(getContext(), LocaleController.getString("MessageScheduledVote", org.telegram.messenger.R.string.MessageScheduledVote), 1).show();
} else {
PollButton pollButton2 = this.pollButtons.get(this.pressedVoteButton);
TLRPC$TL_pollAnswer tLRPC$TL_pollAnswer = pollButton2.answer;
if (this.pollVoted || this.pollClosed) {
ArrayList<TLRPC$TL_pollAnswer> arrayList = new ArrayList<>();
arrayList.add(tLRPC$TL_pollAnswer);
this.delegate.didPressVoteButtons(this, arrayList, pollButton2.count, pollButton2.x + AndroidUtilities.dp(50.0f), this.namesOffset + pollButton2.y);
} else if (this.lastPoll.multiple_choice) {
if (this.currentMessageObject.checkedVotes.contains(tLRPC$TL_pollAnswer)) {
this.currentMessageObject.checkedVotes.remove(tLRPC$TL_pollAnswer);
this.pollCheckBox[this.pressedVoteButton].setChecked(false, true);
} else {
this.currentMessageObject.checkedVotes.add(tLRPC$TL_pollAnswer);
this.pollCheckBox[this.pressedVoteButton].setChecked(true, true);
}
} else {
this.pollVoteInProgressNum = this.pressedVoteButton;
this.pollVoteInProgress = true;
this.vibrateOnPollVote = true;
this.voteCurrentProgressTime = 0.0f;
this.firstCircleLength = true;
this.voteCurrentCircleLength = 360.0f;
this.voteRisingCircleLength = false;
ArrayList<TLRPC$TL_pollAnswer> arrayList2 = new ArrayList<>();
arrayList2.add(tLRPC$TL_pollAnswer);
this.delegate.didPressVoteButtons(this, arrayList2, -1, 0, 0);
}
}
this.pressedVoteButton = -1;
invalidate();
return false;
}
if (motionEvent.getAction() != 2) {
return false;
}
if ((this.pressedVoteButton == -1 && !this.pollHintPressed) || Build.VERSION.SDK_INT < 21) {
return false;
}
Drawable[] drawableArr5 = this.selectorDrawable;
if (drawableArr5[0] == null) {
return false;
}
drawableArr5[0].setHotspot(x, y);
return false;
}
private boolean checkInstantButtonMotionEvent(MotionEvent motionEvent) {
if (!this.currentMessageObject.isSponsored() && (!this.drawInstantView || this.currentMessageObject.type == 0)) {
return false;
}
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
if (motionEvent.getAction() == 0) {
if (this.drawInstantView) {
float f = x;
float f2 = y;
if (this.instantButtonRect.contains(f, f2)) {
this.selectorDrawableMaskType[0] = this.lastPoll == null ? 0 : 2;
this.instantPressed = true;
if (Build.VERSION.SDK_INT >= 21 && this.selectorDrawable[0] != null && this.instantButtonRect.contains(f, f2)) {
this.selectorDrawable[0].setHotspot(f, f2);
this.selectorDrawable[0].setState(this.pressedState);
setInstantButtonPressed(true);
}
invalidate();
return true;
}
}
} else if (motionEvent.getAction() == 1) {
if (this.instantPressed) {
ChatMessageCellDelegate chatMessageCellDelegate = this.delegate;
if (chatMessageCellDelegate != null) {
if (this.lastPoll != null) {
MessageObject messageObject = this.currentMessageObject;
if (messageObject.scheduled) {
Toast.makeText(getContext(), LocaleController.getString("MessageScheduledVoteResults", org.telegram.messenger.R.string.MessageScheduledVoteResults), 1).show();
} else if (this.pollVoted || this.pollClosed) {
chatMessageCellDelegate.didPressInstantButton(this, this.drawInstantViewType);
} else {
if (!messageObject.checkedVotes.isEmpty()) {
this.pollVoteInProgressNum = -1;
this.pollVoteInProgress = true;
this.vibrateOnPollVote = true;
this.voteCurrentProgressTime = 0.0f;
this.firstCircleLength = true;
this.voteCurrentCircleLength = 360.0f;
this.voteRisingCircleLength = false;
}
this.delegate.didPressVoteButtons(this, this.currentMessageObject.checkedVotes, -1, 0, this.namesOffset);
}
} else {
chatMessageCellDelegate.didPressInstantButton(this, this.drawInstantViewType);
}
}
playSoundEffect(0);
if (Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr = this.selectorDrawable;
if (drawableArr[0] != null) {
drawableArr[0].setState(StateSet.NOTHING);
}
}
this.instantPressed = false;
setInstantButtonPressed(false);
invalidate();
}
} else if (motionEvent.getAction() == 2 && this.instantButtonPressed && Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr2 = this.selectorDrawable;
if (drawableArr2[0] != null) {
drawableArr2[0].setHotspot(x, y);
}
}
return false;
}
private boolean checkContactMotionEvent(MotionEvent motionEvent) {
if (this.currentMessageObject.type != 12) {
return false;
}
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
if (motionEvent.getAction() == 0) {
ArrayList<InstantViewButton> arrayList = this.contactButtons;
if (arrayList != null && arrayList.size() > 1) {
for (int i = 0; i < this.contactButtons.size(); i++) {
InstantViewButton instantViewButton = this.contactButtons.get(i);
float f = x;
float f2 = y;
if (instantViewButton.rect.contains(f, f2)) {
if (instantViewButton.buttonBounce == null) {
instantViewButton.buttonBounce = new ButtonBounce(this);
}
instantViewButton.buttonBounce.setPressed(true);
if (Build.VERSION.SDK_INT >= 21 && instantViewButton.selectorDrawable != null) {
instantViewButton.selectorDrawable.setHotspot(f, f2);
instantViewButton.selectorDrawable.setState(this.pressedState);
}
invalidate();
return true;
}
}
}
float f3 = x;
float f4 = y;
if (this.contactRect.contains(f3, f4)) {
this.contactPressed = true;
this.contactBounce.setPressed(true);
if (Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr = this.selectorDrawable;
if (drawableArr[0] != null) {
drawableArr[0].setHotspot(f3, f4);
this.selectorDrawable[0].setState(this.pressedState);
}
}
invalidate();
return true;
}
} else if (motionEvent.getAction() == 1) {
if (this.contactPressed) {
if (this.delegate != null) {
ArrayList<InstantViewButton> arrayList2 = this.contactButtons;
if (arrayList2 != null && arrayList2.size() == 1) {
this.delegate.didPressInstantButton(this, this.contactButtons.get(0).type);
} else {
this.delegate.didPressInstantButton(this, 5);
}
}
playSoundEffect(0);
if (Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr2 = this.selectorDrawable;
if (drawableArr2[0] != null) {
drawableArr2[0].setState(StateSet.NOTHING);
}
}
this.contactPressed = false;
this.contactBounce.setPressed(false);
invalidate();
} else {
ArrayList<InstantViewButton> arrayList3 = this.contactButtons;
if (arrayList3 != null && arrayList3.size() > 1) {
for (int i2 = 0; i2 < this.contactButtons.size(); i2++) {
InstantViewButton instantViewButton2 = this.contactButtons.get(i2);
if (instantViewButton2.buttonBounce != null && instantViewButton2.buttonBounce.isPressed()) {
ChatMessageCellDelegate chatMessageCellDelegate = this.delegate;
if (chatMessageCellDelegate != null) {
chatMessageCellDelegate.didPressInstantButton(this, instantViewButton2.type);
}
if (Build.VERSION.SDK_INT >= 21 && instantViewButton2.selectorDrawable != null) {
instantViewButton2.selectorDrawable.setState(StateSet.NOTHING);
}
instantViewButton2.buttonBounce.setPressed(false);
playSoundEffect(0);
invalidate();
}
}
}
}
} else if (motionEvent.getAction() == 2) {
if (this.contactPressed && Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr3 = this.selectorDrawable;
if (drawableArr3[0] != null) {
drawableArr3[0].setHotspot(x, y);
}
}
ArrayList<InstantViewButton> arrayList4 = this.contactButtons;
if (arrayList4 != null && arrayList4.size() > 1) {
int i3 = 0;
while (true) {
if (i3 >= this.contactButtons.size()) {
break;
}
InstantViewButton instantViewButton3 = this.contactButtons.get(i3);
if (instantViewButton3.buttonBounce == null || !instantViewButton3.buttonBounce.isPressed()) {
i3++;
} else if (Build.VERSION.SDK_INT >= 21 && instantViewButton3.selectorDrawable != null) {
instantViewButton3.selectorDrawable.setHotspot(x, y);
}
}
}
}
return false;
}
private void invalidateWithParent() {
if (this.currentMessagesGroup != null && getParent() != null) {
((ViewGroup) getParent()).invalidate();
}
invalidate();
}
private boolean checkCommentButtonMotionEvent(MotionEvent motionEvent) {
int i = 0;
if (!this.drawCommentButton) {
return false;
}
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
if (groupedMessagePosition != null && (groupedMessagePosition.flags & 1) == 0 && this.commentButtonRect.contains(x, y)) {
ViewGroup viewGroup = (ViewGroup) getParent();
int childCount = viewGroup.getChildCount();
while (true) {
if (i >= childCount) {
break;
}
View childAt = viewGroup.getChildAt(i);
if (childAt != this && (childAt instanceof ChatMessageCell)) {
ChatMessageCell chatMessageCell = (ChatMessageCell) childAt;
if (chatMessageCell.drawCommentButton && chatMessageCell.currentMessagesGroup == this.currentMessagesGroup && (chatMessageCell.currentPosition.flags & 1) != 0) {
MotionEvent obtain = MotionEvent.obtain(0L, 0L, motionEvent.getActionMasked(), (motionEvent.getX() + getLeft()) - chatMessageCell.getLeft(), (motionEvent.getY() + getTop()) - chatMessageCell.getTop(), 0);
chatMessageCell.checkCommentButtonMotionEvent(obtain);
obtain.recycle();
break;
}
}
i++;
}
return true;
}
if (motionEvent.getAction() == 0) {
if (this.commentButtonRect.contains(x, y)) {
if (this.currentMessageObject.isSent()) {
this.selectorDrawableMaskType[1] = 2;
this.commentButtonPressed = true;
if (Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr = this.selectorDrawable;
if (drawableArr[1] != null) {
drawableArr[1].setHotspot(x, y);
this.selectorDrawable[1].setState(this.pressedState);
}
}
invalidateWithParent();
}
return true;
}
} else if (motionEvent.getAction() == 1) {
if (this.commentButtonPressed) {
ChatMessageCellDelegate chatMessageCellDelegate = this.delegate;
if (chatMessageCellDelegate != null) {
if (this.isRepliesChat) {
chatMessageCellDelegate.didPressSideButton(this);
} else {
chatMessageCellDelegate.didPressCommentButton(this);
}
}
playSoundEffect(0);
if (Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr2 = this.selectorDrawable;
if (drawableArr2[1] != null) {
drawableArr2[1].setState(StateSet.NOTHING);
}
}
this.commentButtonPressed = false;
invalidateWithParent();
}
} else if (motionEvent.getAction() == 2 && this.commentButtonPressed && Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr3 = this.selectorDrawable;
if (drawableArr3[1] != null) {
drawableArr3[1].setHotspot(x, y);
}
}
return false;
}
private boolean checkSponsoredCloseMotionEvent(MotionEvent motionEvent) {
ButtonBounce buttonBounce;
ChatMessageCellDelegate chatMessageCellDelegate;
RectF rectF;
if (motionEvent.getAction() == 0 && (rectF = this.closeSponsoredBounds) != null && this.closeSponsoredBounce != null && rectF.contains(motionEvent.getX(), motionEvent.getY())) {
this.closeSponsoredBounce.setPressed(true);
return true;
}
if (motionEvent.getAction() == 1) {
ButtonBounce buttonBounce2 = this.closeSponsoredBounce;
if (buttonBounce2 != null && buttonBounce2.isPressed() && (chatMessageCellDelegate = this.delegate) != null) {
chatMessageCellDelegate.didPressSponsoredClose();
}
ButtonBounce buttonBounce3 = this.closeSponsoredBounce;
if (buttonBounce3 != null) {
buttonBounce3.setPressed(false);
}
} else if (motionEvent.getAction() == 3 && (buttonBounce = this.closeSponsoredBounce) != null) {
buttonBounce.setPressed(false);
}
ButtonBounce buttonBounce4 = this.closeSponsoredBounce;
return buttonBounce4 != null && buttonBounce4.isPressed();
}
private boolean checkOtherButtonMotionEvent(MotionEvent motionEvent) {
MessageObject.GroupedMessagePosition groupedMessagePosition;
int i = this.documentAttachType;
if ((i == 5 || i == 1) && (groupedMessagePosition = this.currentPosition) != null && (groupedMessagePosition.flags & 4) == 0) {
return false;
}
int i2 = this.currentMessageObject.type;
boolean z = i2 == 16;
boolean z2 = z;
if (!z) {
z2 = ((i != 1 && i2 != 12 && i != 5 && i != 4 && i != 2 && i2 != 8) || this.hasGamePreview || this.hasInvoicePreview) ? false : true;
}
if (!z2) {
return false;
}
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
if (motionEvent.getAction() == 0) {
MessageObject messageObject = this.currentMessageObject;
if (messageObject.type == 16) {
boolean isVideoCall = messageObject.isVideoCall();
int i3 = this.otherX;
if (x >= i3) {
if (x <= i3 + AndroidUtilities.dp((LocaleController.isRTL ? 0 : 200) + 30 + (!isVideoCall ? 2 : 0)) && y >= this.otherY - AndroidUtilities.dp(14.0f) && y <= this.otherY + AndroidUtilities.dp(50.0f)) {
this.otherPressed = true;
this.selectorDrawableMaskType[0] = 4;
if (Build.VERSION.SDK_INT >= 21 && this.selectorDrawable[0] != null) {
int dp = this.otherX + AndroidUtilities.dp((LocaleController.isRTL ? 0 : 200) + (!isVideoCall ? 2 : 0)) + (Theme.chat_msgInCallDrawable[isVideoCall ? 1 : 0].getIntrinsicWidth() / 2);
int intrinsicHeight = this.otherY + (Theme.chat_msgInCallDrawable[isVideoCall ? 1 : 0].getIntrinsicHeight() / 2);
this.selectorDrawable[0].setBounds(dp - AndroidUtilities.dp(20.0f), intrinsicHeight - AndroidUtilities.dp(20.0f), dp + AndroidUtilities.dp(20.0f), intrinsicHeight + AndroidUtilities.dp(20.0f));
this.selectorDrawable[0].setHotspot(x, y);
this.selectorDrawable[0].setState(this.pressedState);
}
invalidate();
return true;
}
}
} else if (x >= this.otherX - AndroidUtilities.dp(20.0f) && x <= this.otherX + AndroidUtilities.dp(20.0f) && y >= this.otherY - AndroidUtilities.dp(4.0f) && y <= this.otherY + AndroidUtilities.dp(30.0f)) {
this.otherPressed = true;
invalidate();
return true;
}
} else if (motionEvent.getAction() == 1) {
if (this.otherPressed) {
if (this.currentMessageObject.type == 16 && Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr = this.selectorDrawable;
if (drawableArr[0] != null) {
drawableArr[0].setState(StateSet.NOTHING);
}
}
this.otherPressed = false;
playSoundEffect(0);
this.delegate.didPressOther(this, this.otherX, this.otherY);
invalidate();
return true;
}
} else if (motionEvent.getAction() == 2 && this.currentMessageObject.type == 16 && this.otherPressed && Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr2 = this.selectorDrawable;
if (drawableArr2[0] != null) {
drawableArr2[0].setHotspot(x, y);
}
}
return false;
}
private void setInstantButtonPressed(boolean z) {
if (this.instantButtonBounce == null) {
this.instantButtonBounce = new ButtonBounce(this);
}
ButtonBounce buttonBounce = this.instantButtonBounce;
this.instantButtonPressed = z;
buttonBounce.setPressed(z);
}
private void resetContactButtonsPressedState() {
this.contactPressed = false;
ButtonBounce buttonBounce = this.contactBounce;
if (buttonBounce != null) {
buttonBounce.setPressed(false);
}
if (Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr = this.selectorDrawable;
if (drawableArr[0] != null) {
drawableArr[0].setState(StateSet.NOTHING);
}
}
if (this.contactButtons != null) {
for (int i = 0; i < this.contactButtons.size(); i++) {
InstantViewButton instantViewButton = this.contactButtons.get(i);
if (instantViewButton.buttonBounce != null) {
instantViewButton.buttonBounce.setPressed(false);
}
if (instantViewButton.selectorDrawable != null) {
instantViewButton.selectorDrawable.setState(StateSet.NOTHING);
}
}
}
}
private boolean checkDateMotionEvent(MotionEvent motionEvent) {
if (!this.currentMessageObject.isImportedForward()) {
return false;
}
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
if (motionEvent.getAction() == 0) {
float f = x;
float f2 = this.drawTimeX;
if (f < f2 || f > f2 + this.timeWidth) {
return false;
}
float f3 = y;
float f4 = this.drawTimeY;
if (f3 < f4 || f3 > f4 + AndroidUtilities.dp(20.0f)) {
return false;
}
this.timePressed = true;
invalidate();
} else {
if (motionEvent.getAction() != 1 || !this.timePressed) {
return false;
}
this.timePressed = false;
playSoundEffect(0);
this.delegate.didPressTime(this);
invalidate();
}
return true;
}
private boolean checkRoundSeekbar(MotionEvent motionEvent) {
if (!MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || !MediaController.getInstance().isMessagePaused()) {
return false;
}
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
if (motionEvent.getAction() == 0) {
float f = x;
if (f >= this.seekbarRoundX - AndroidUtilities.dp(20.0f) && f <= this.seekbarRoundX + AndroidUtilities.dp(20.0f)) {
float f2 = y;
if (f2 >= this.seekbarRoundY - AndroidUtilities.dp(20.0f) && f2 <= this.seekbarRoundY + AndroidUtilities.dp(20.0f)) {
getParent().requestDisallowInterceptTouchEvent(true);
cancelCheckLongPress();
this.roundSeekbarTouched = 1;
invalidate();
}
}
float centerX = f - this.photoImage.getCenterX();
float centerY = y - this.photoImage.getCenterY();
float imageWidth = (this.photoImage.getImageWidth() - AndroidUtilities.dp(64.0f)) / 2.0f;
float f3 = (centerX * centerX) + (centerY * centerY);
if (f3 < ((this.photoImage.getImageWidth() / 2.0f) * this.photoImage.getImageWidth()) / 2.0f && f3 > imageWidth * imageWidth) {
getParent().requestDisallowInterceptTouchEvent(true);
cancelCheckLongPress();
this.roundSeekbarTouched = 1;
invalidate();
}
} else if (this.roundSeekbarTouched == 1 && motionEvent.getAction() == 2) {
float degrees = ((float) Math.toDegrees(Math.atan2(y - this.photoImage.getCenterY(), x - this.photoImage.getCenterX()))) + 90.0f;
if (degrees < 0.0f) {
degrees += 360.0f;
}
float f4 = degrees / 360.0f;
if (Math.abs(this.currentMessageObject.audioProgress - f4) > 0.9f) {
if (this.roundSeekbarOutAlpha == 0.0f) {
performHapticFeedback(3);
}
this.roundSeekbarOutAlpha = 1.0f;
this.roundSeekbarOutProgress = this.currentMessageObject.audioProgress;
}
long currentTimeMillis = System.currentTimeMillis();
if (currentTimeMillis - this.lastSeekUpdateTime > 100) {
MediaController.getInstance().seekToProgress(this.currentMessageObject, f4);
this.lastSeekUpdateTime = currentTimeMillis;
}
this.currentMessageObject.audioProgress = f4;
updatePlayingMessageProgress();
}
if ((motionEvent.getAction() == 1 || motionEvent.getAction() == 3) && this.roundSeekbarTouched != 0) {
if (motionEvent.getAction() == 1) {
float degrees2 = ((float) Math.toDegrees(Math.atan2(y - this.photoImage.getCenterY(), x - this.photoImage.getCenterX()))) + 90.0f;
if (degrees2 < 0.0f) {
degrees2 += 360.0f;
}
float f5 = degrees2 / 360.0f;
this.currentMessageObject.audioProgress = f5;
MediaController.getInstance().seekToProgress(this.currentMessageObject, f5);
updatePlayingMessageProgress();
}
MediaController.getInstance().playMessage(this.currentMessageObject);
this.roundSeekbarTouched = 0;
getParent().requestDisallowInterceptTouchEvent(false);
}
return this.roundSeekbarTouched != 0;
}
private boolean checkPhotoImageMotionEvent(MotionEvent motionEvent) {
boolean z;
MessageObject messageObject;
int i;
int i2;
int i3;
int i4;
boolean z2 = true;
if ((!this.drawPhotoImage && this.documentAttachType != 1) || (this.currentMessageObject.isSending() && this.buttonState != 1)) {
return false;
}
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
if (motionEvent.getAction() == 0) {
int dp = AndroidUtilities.dp(48.0f);
if (this.miniButtonState >= 0) {
int dp2 = AndroidUtilities.dp(27.0f);
int i5 = this.buttonX;
if (x >= i5 + dp2 && x <= i5 + dp2 + dp) {
int i6 = this.buttonY;
if (y >= i6 + dp2 && y <= i6 + dp2 + dp) {
z = true;
MessageObject messageObject2 = this.currentMessageObject;
boolean z3 = messageObject2 != null || !messageObject2.hasMediaSpoilers() || this.currentMessageObject.isMediaSpoilersRevealed || this.buttonState == 1;
if (!z) {
this.miniButtonPressed = 1;
invalidate();
} else if (this.buttonState != -1 && this.radialProgress.getIcon() != 4 && x >= (i3 = this.buttonX) && x <= i3 + dp && y >= (i4 = this.buttonY) && y <= i4 + dp && z3) {
this.buttonPressed = 1;
invalidate();
} else if (this.drawVideoImageButton && this.buttonState != -1 && x >= (i = this.videoButtonX) && x <= i + AndroidUtilities.dp(34.0f) + Math.max(this.infoWidth, this.docTitleWidth) && y >= (i2 = this.videoButtonY) && y <= i2 + AndroidUtilities.dp(30.0f) && z3) {
this.videoButtonPressed = 1;
invalidate();
} else if (this.documentAttachType == 1) {
float f = x;
if (f >= this.photoImage.getImageX() && f <= (this.photoImage.getImageX() + this.backgroundWidth) - AndroidUtilities.dp(50.0f)) {
float f2 = y;
if (f2 >= this.photoImage.getImageY() && f2 <= this.photoImage.getImageY() + this.photoImage.getImageHeight()) {
this.imagePressed = true;
}
}
z2 = false;
} else {
if (!this.currentMessageObject.isAnyKindOfSticker() || this.currentMessageObject.getInputStickerSet() != null || this.currentMessageObject.isAnimatedEmoji() || this.currentMessageObject.isDice()) {
float f3 = x;
if (f3 >= this.photoImage.getImageX() && f3 <= this.photoImage.getImageX() + this.photoImage.getImageWidth()) {
float f4 = y;
if (f4 >= this.photoImage.getImageY() && f4 <= this.photoImage.getImageY() + this.photoImage.getImageHeight()) {
if (!this.isRoundVideo) {
this.imagePressed = true;
} else if (((f3 - this.photoImage.getCenterX()) * (f3 - this.photoImage.getCenterX())) + ((f4 - this.photoImage.getCenterY()) * (f4 - this.photoImage.getCenterY())) < (this.photoImage.getImageWidth() / 2.0f) * (this.photoImage.getImageWidth() / 2.0f)) {
this.imagePressed = true;
}
messageObject = this.currentMessageObject;
if (messageObject.type == 12) {
long j = MessageObject.getMedia(messageObject.messageOwner).user_id;
if ((j != 0 ? MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(j)) : null) == null) {
this.imagePressed = false;
}
}
}
}
z2 = false;
messageObject = this.currentMessageObject;
if (messageObject.type == 12) {
}
}
z2 = false;
}
if (this.imagePressed) {
if (this.currentMessageObject.isSendError()) {
this.imagePressed = false;
return false;
}
if (this.currentMessageObject.type == 8 && this.buttonState == -1 && SharedConfig.isAutoplayGifs() && !this.currentMessageObject.isRepostPreview && this.photoImage.getAnimation() == null) {
this.imagePressed = false;
return false;
}
}
return z2;
}
}
}
z = false;
MessageObject messageObject22 = this.currentMessageObject;
if (messageObject22 != null) {
}
if (!z) {
}
if (this.imagePressed) {
}
return z2;
}
if (motionEvent.getAction() != 1) {
return false;
}
if (this.videoButtonPressed == 1) {
this.videoButtonPressed = 0;
playSoundEffect(0);
didPressButton(true, true);
invalidate();
return false;
}
if (this.buttonPressed == 1) {
this.buttonPressed = 0;
playSoundEffect(0);
if (this.drawVideoImageButton) {
didClickedImage();
} else {
didPressButton(true, false);
}
invalidate();
return false;
}
if (this.miniButtonPressed == 1) {
this.miniButtonPressed = 0;
playSoundEffect(0);
didPressMiniButton(true);
invalidate();
return false;
}
if (!this.imagePressed) {
return false;
}
this.imagePressed = false;
int i7 = this.buttonState;
if (i7 == -1 || ((i7 == 1 && this.isRoundVideo) || i7 == 2 || i7 == 3 || this.drawVideoImageButton)) {
playSoundEffect(0);
didClickedImage();
} else if (i7 == 0) {
playSoundEffect(0);
didPressButton(true, false);
}
invalidate();
return false;
}
private boolean checkAudioMotionEvent(MotionEvent motionEvent) {
boolean onTouch;
MessageObject messageObject;
boolean z;
boolean z2;
MessageObject messageObject2;
int i;
boolean z3;
int i2;
MessageObject messageObject3;
int i3 = this.documentAttachType;
if ((i3 != 3 && i3 != 5 && (i3 != 7 || (i3 == 7 && (messageObject3 = this.currentMessageObject) != null && !messageObject3.isVoiceTranscriptionOpen()))) || AndroidUtilities.isAccessibilityScreenReaderEnabled()) {
return false;
}
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
if (this.useSeekBarWaveform) {
onTouch = this.seekBarWaveform.onTouch(motionEvent.getAction(), (motionEvent.getX() - this.seekBarX) - AndroidUtilities.dp(13.0f), motionEvent.getY() - this.seekBarY);
} else {
onTouch = (MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || ((messageObject = this.currentMessageObject) != null && this.documentAttachType == 7 && messageObject.isVoiceTranscriptionOpen())) ? this.seekBar.onTouch(motionEvent.getAction(), motionEvent.getX() - this.seekBarX, motionEvent.getY() - this.seekBarY) : false;
}
if (onTouch) {
if (!this.useSeekBarWaveform && motionEvent.getAction() == 0) {
getParent().requestDisallowInterceptTouchEvent(true);
} else if (this.useSeekBarWaveform && !this.seekBarWaveform.isStartDraging() && motionEvent.getAction() == 1) {
didPressButton(true, false);
}
this.disallowLongPress = true;
invalidate();
return onTouch;
}
int dp = AndroidUtilities.dp(36.0f);
if (this.miniButtonState >= 0) {
int dp2 = AndroidUtilities.dp(27.0f);
int i4 = this.buttonX;
if (x >= i4 + dp2 && x <= i4 + dp2 + dp) {
int i5 = this.buttonY;
if (y >= i5 + dp2 && y <= i5 + dp2 + dp) {
z = true;
if (!z && ((messageObject2 = this.currentMessageObject) == null || !messageObject2.hasMediaSpoilers() || this.currentMessageObject.isVoice() || this.currentMessageObject.isMediaSpoilersRevealed)) {
i = this.buttonState;
if (i != 0 || i == 1 || i == 2) {
if (x >= this.buttonX - AndroidUtilities.dp(12.0f) && x <= (this.buttonX - AndroidUtilities.dp(12.0f)) + this.backgroundWidth) {
z3 = this.drawInstantView;
if (y >= (!z3 ? this.buttonY : this.namesOffset + this.mediaOffsetY)) {
if (z3) {
i2 = this.buttonY;
} else {
i2 = this.namesOffset + this.mediaOffsetY;
dp = AndroidUtilities.dp(82.0f);
}
}
}
} else {
int i6 = this.buttonX;
if (x >= i6) {
if (x <= i6 + dp) {
int i7 = this.buttonY;
if (y >= i7) {
}
}
}
}
if (motionEvent.getAction() == 0) {
if (!z2 && !z) {
return onTouch;
}
if (z2) {
this.buttonPressed = 1;
} else {
this.miniButtonPressed = 1;
}
invalidate();
return true;
}
if (this.buttonPressed != 0) {
if (motionEvent.getAction() == 1) {
this.buttonPressed = 0;
playSoundEffect(0);
didPressButton(true, false);
invalidate();
return onTouch;
}
if (motionEvent.getAction() == 3) {
this.buttonPressed = 0;
invalidate();
return onTouch;
}
if (motionEvent.getAction() != 2 || z2) {
return onTouch;
}
this.buttonPressed = 0;
invalidate();
return onTouch;
}
if (this.miniButtonPressed == 0) {
return onTouch;
}
if (motionEvent.getAction() == 1) {
this.miniButtonPressed = 0;
playSoundEffect(0);
didPressMiniButton(true);
invalidate();
return onTouch;
}
if (motionEvent.getAction() == 3) {
this.miniButtonPressed = 0;
invalidate();
return onTouch;
}
if (motionEvent.getAction() != 2 || z) {
return onTouch;
}
this.miniButtonPressed = 0;
invalidate();
return onTouch;
}
z2 = false;
if (motionEvent.getAction() == 0) {
}
}
}
}
z = false;
if (!z) {
i = this.buttonState;
if (i != 0) {
}
if (x >= this.buttonX - AndroidUtilities.dp(12.0f)) {
z3 = this.drawInstantView;
if (y >= (!z3 ? this.buttonY : this.namesOffset + this.mediaOffsetY)) {
}
}
}
z2 = false;
if (motionEvent.getAction() == 0) {
}
}
public boolean checkSpoilersMotionEvent(MotionEvent motionEvent, int i) {
int i2;
MessageObject.GroupedMessages groupedMessages;
if (i <= 15 && getParent() != null) {
if (this.currentMessageObject.hasValidGroupId() && (groupedMessages = this.currentMessagesGroup) != null && !groupedMessages.isDocuments) {
ViewGroup viewGroup = (ViewGroup) getParent();
for (int i3 = 0; i3 < viewGroup.getChildCount(); i3++) {
View childAt = viewGroup.getChildAt(i3);
if (childAt instanceof ChatMessageCell) {
ChatMessageCell chatMessageCell = (ChatMessageCell) childAt;
MessageObject.GroupedMessages currentMessagesGroup = chatMessageCell.getCurrentMessagesGroup();
MessageObject.GroupedMessagePosition currentPosition = chatMessageCell.getCurrentPosition();
if (currentMessagesGroup != null && currentMessagesGroup.groupId == this.currentMessagesGroup.groupId) {
int i4 = currentPosition.flags;
if ((i4 & 8) != 0 && (i4 & 1) != 0 && chatMessageCell != this) {
motionEvent.offsetLocation(getLeft() - chatMessageCell.getLeft(), getTop() - chatMessageCell.getTop());
boolean checkSpoilersMotionEvent = chatMessageCell.checkSpoilersMotionEvent(motionEvent, i + 1);
motionEvent.offsetLocation(-(getLeft() - chatMessageCell.getLeft()), -(getTop() - chatMessageCell.getTop()));
return checkSpoilersMotionEvent;
}
}
}
}
}
if (this.isSpoilerRevealing) {
return false;
}
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
int actionMasked = motionEvent.getActionMasked();
if (actionMasked == 0) {
int i5 = this.textX;
if (x >= i5 && y >= (i2 = this.textY)) {
MessageObject messageObject = this.currentMessageObject;
if (x <= i5 + messageObject.textWidth && y <= i2 + messageObject.textHeight) {
ArrayList<MessageObject.TextLayoutBlock> arrayList = messageObject.textLayoutBlocks;
for (int i6 = 0; i6 < arrayList.size() && arrayList.get(i6).textYOffset <= y; i6++) {
MessageObject.TextLayoutBlock textLayoutBlock = arrayList.get(i6);
int i7 = textLayoutBlock.isRtl() ? (int) this.currentMessageObject.textXOffset : 0;
for (SpoilerEffect spoilerEffect : textLayoutBlock.spoilers) {
if (spoilerEffect.getBounds().contains((x - this.textX) + i7, (int) ((y - this.textY) - textLayoutBlock.textYOffset))) {
this.spoilerPressed = spoilerEffect;
return true;
}
}
}
}
}
MessageObject.TextLayoutBlocks textLayoutBlocks = this.captionLayout;
if (textLayoutBlocks != null) {
float f = x;
float f2 = this.captionX;
if (f >= f2) {
float f3 = y;
float f4 = this.captionY;
if (f3 >= f4 && f <= f2 + textLayoutBlocks.textWidth && f3 <= f4 + textLayoutBlocks.textHeight) {
ArrayList<MessageObject.TextLayoutBlock> arrayList2 = textLayoutBlocks.textLayoutBlocks;
for (int i8 = 0; i8 < arrayList2.size() && arrayList2.get(i8).textYOffset <= f3; i8++) {
MessageObject.TextLayoutBlock textLayoutBlock2 = arrayList2.get(i8);
int i9 = textLayoutBlock2.isRtl() ? (int) this.captionLayout.textXOffset : 0;
for (SpoilerEffect spoilerEffect2 : textLayoutBlock2.spoilers) {
if (spoilerEffect2.getBounds().contains((int) ((f - this.captionX) + i9), (int) ((f3 - this.captionY) - textLayoutBlock2.textYOffset))) {
this.spoilerPressed = spoilerEffect2;
return true;
}
}
}
}
}
}
} else if (actionMasked == 1 && this.spoilerPressed != null) {
playSoundEffect(0);
this.sPath.rewind();
MessageObject.TextLayoutBlocks textLayoutBlocks2 = this.captionLayout;
if (textLayoutBlocks2 != null) {
Iterator<MessageObject.TextLayoutBlock> it = textLayoutBlocks2.textLayoutBlocks.iterator();
while (it.hasNext()) {
MessageObject.TextLayoutBlock next = it.next();
Iterator<SpoilerEffect> it2 = next.spoilers.iterator();
while (it2.hasNext()) {
Rect bounds = it2.next().getBounds();
Path path = this.sPath;
float f5 = bounds.left;
float f6 = bounds.top;
float f7 = next.textYOffset;
path.addRect(f5, f6 + f7, bounds.right, bounds.bottom + f7, Path.Direction.CW);
}
}
} else {
Iterator<MessageObject.TextLayoutBlock> it3 = this.currentMessageObject.textLayoutBlocks.iterator();
while (it3.hasNext()) {
MessageObject.TextLayoutBlock next2 = it3.next();
Iterator<SpoilerEffect> it4 = next2.spoilers.iterator();
while (it4.hasNext()) {
Rect bounds2 = it4.next().getBounds();
Path path2 = this.sPath;
float f8 = bounds2.left;
float f9 = bounds2.top;
float f10 = next2.textYOffset;
path2.addRect(f8, f9 + f10, bounds2.right, bounds2.bottom + f10, Path.Direction.CW);
}
}
}
this.sPath.computeBounds(this.rect, false);
float sqrt = (float) Math.sqrt(Math.pow(this.rect.width(), 2.0d) + Math.pow(this.rect.height(), 2.0d));
this.isSpoilerRevealing = true;
this.spoilerPressed.setOnRippleEndCallback(new Runnable() {
@Override
public final void run() {
ChatMessageCell.this.lambda$checkSpoilersMotionEvent$1();
}
});
MessageObject.TextLayoutBlocks textLayoutBlocks3 = this.captionLayout;
if (textLayoutBlocks3 != null) {
Iterator<MessageObject.TextLayoutBlock> it5 = textLayoutBlocks3.textLayoutBlocks.iterator();
while (it5.hasNext()) {
MessageObject.TextLayoutBlock next3 = it5.next();
int i10 = next3.isRtl() ? (int) this.captionLayout.textXOffset : 0;
Iterator<SpoilerEffect> it6 = next3.spoilers.iterator();
while (it6.hasNext()) {
it6.next().startRipple((x - this.captionX) + i10, (y - next3.textYOffset) - this.captionY, sqrt);
}
}
} else {
ArrayList<MessageObject.TextLayoutBlock> arrayList3 = this.currentMessageObject.textLayoutBlocks;
if (arrayList3 != null) {
Iterator<MessageObject.TextLayoutBlock> it7 = arrayList3.iterator();
while (it7.hasNext()) {
MessageObject.TextLayoutBlock next4 = it7.next();
int i11 = next4.isRtl() ? (int) this.currentMessageObject.textXOffset : 0;
Iterator<SpoilerEffect> it8 = next4.spoilers.iterator();
while (it8.hasNext()) {
it8.next().startRipple((x - this.textX) + i11, (y - next4.textYOffset) - this.textY, sqrt);
}
}
}
}
if (getParent() instanceof RecyclerListView) {
ViewGroup viewGroup2 = (ViewGroup) getParent();
for (int i12 = 0; i12 < viewGroup2.getChildCount(); i12++) {
View childAt2 = viewGroup2.getChildAt(i12);
if (childAt2 instanceof ChatMessageCell) {
final ChatMessageCell chatMessageCell2 = (ChatMessageCell) childAt2;
if (chatMessageCell2.getMessageObject() != null && chatMessageCell2.getMessageObject().getReplyMsgId() == getMessageObject().getId() && !chatMessageCell2.replySpoilers.isEmpty()) {
chatMessageCell2.replySpoilers.get(0).setOnRippleEndCallback(new Runnable() {
@Override
public final void run() {
ChatMessageCell.this.lambda$checkSpoilersMotionEvent$3(chatMessageCell2);
}
});
Iterator<SpoilerEffect> it9 = chatMessageCell2.replySpoilers.iterator();
while (it9.hasNext()) {
it9.next().startRipple(r4.getBounds().centerX(), r4.getBounds().centerY(), sqrt);
}
}
}
}
}
this.spoilerPressed = null;
return true;
}
}
return false;
}
public void lambda$checkSpoilersMotionEvent$1() {
post(new Runnable() {
@Override
public final void run() {
ChatMessageCell.this.lambda$checkSpoilersMotionEvent$0();
}
});
}
public void lambda$checkSpoilersMotionEvent$0() {
this.isSpoilerRevealing = false;
getMessageObject().isSpoilersRevealed = true;
MessageObject.TextLayoutBlocks textLayoutBlocks = this.captionLayout;
if (textLayoutBlocks != null) {
Iterator<MessageObject.TextLayoutBlock> it = textLayoutBlocks.textLayoutBlocks.iterator();
while (it.hasNext()) {
it.next().spoilers.clear();
}
} else {
ArrayList<MessageObject.TextLayoutBlock> arrayList = this.currentMessageObject.textLayoutBlocks;
if (arrayList != null) {
Iterator<MessageObject.TextLayoutBlock> it2 = arrayList.iterator();
while (it2.hasNext()) {
it2.next().spoilers.clear();
}
}
}
invalidate();
}
public void lambda$checkSpoilersMotionEvent$3(final ChatMessageCell chatMessageCell) {
post(new Runnable() {
@Override
public final void run() {
ChatMessageCell.lambda$checkSpoilersMotionEvent$2(ChatMessageCell.this);
}
});
}
public static void lambda$checkSpoilersMotionEvent$2(ChatMessageCell chatMessageCell) {
chatMessageCell.getMessageObject().replyMessageObject.isSpoilersRevealed = true;
chatMessageCell.replySpoilers.clear();
chatMessageCell.invalidate();
}
private boolean checkBotButtonMotionEvent(MotionEvent motionEvent) {
int i;
int dp;
if (this.botButtons.isEmpty() || this.currentMessageObject.eventId != 0) {
return false;
}
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
if (motionEvent.getAction() == 0) {
if (this.currentMessageObject.isOutOwner()) {
dp = (getMeasuredWidth() - this.widthForButtons) - AndroidUtilities.dp(10.0f);
} else {
dp = this.backgroundDrawableLeft + AndroidUtilities.dp(this.mediaBackground ? 1.0f : 7.0f);
}
for (int i2 = 0; i2 < this.botButtons.size(); i2++) {
BotButton botButton = this.botButtons.get(i2);
int dp2 = (botButton.y + this.layoutHeight) - AndroidUtilities.dp(2.0f);
if (x >= botButton.x + dp && x <= botButton.x + dp + botButton.width && y >= dp2 && y <= botButton.height + dp2) {
this.pressedBotButton = i2;
invalidateOutbounds();
if (botButton.selectorDrawable == null) {
botButton.selectorDrawable = Theme.createRadSelectorDrawable(getThemedColor(Theme.key_chat_serviceBackgroundSelector), 6, 6);
botButton.selectorDrawable.setBounds(botButton.x + dp, dp2, botButton.x + dp + botButton.width, botButton.height + dp2);
}
if (Build.VERSION.SDK_INT >= 21) {
botButton.selectorDrawable.setHotspot(x, y);
}
botButton.selectorDrawable.setState(this.pressedState);
botButton.setPressed(true);
final int i3 = this.pressedBotButton;
postDelayed(new Runnable() {
@Override
public final void run() {
ChatMessageCell.this.lambda$checkBotButtonMotionEvent$4(i3);
}
}, ViewConfiguration.getLongPressTimeout() - 1);
return true;
}
}
return false;
}
if (motionEvent.getAction() == 1) {
if (this.pressedBotButton == -1) {
return false;
}
playSoundEffect(0);
BotButton botButton2 = this.botButtons.get(this.pressedBotButton);
if (botButton2.selectorDrawable != null) {
botButton2.selectorDrawable.setState(StateSet.NOTHING);
}
botButton2.setPressed(false);
if (!this.currentMessageObject.scheduled) {
if (botButton2.button != null) {
this.delegate.didPressBotButton(this, botButton2.button);
}
} else {
Toast.makeText(getContext(), LocaleController.getString("MessageScheduledBotAction", org.telegram.messenger.R.string.MessageScheduledBotAction), 1).show();
}
this.pressedBotButton = -1;
invalidateOutbounds();
return false;
}
if (motionEvent.getAction() != 3 || (i = this.pressedBotButton) == -1) {
return false;
}
BotButton botButton3 = this.botButtons.get(i);
if (botButton3.selectorDrawable != null) {
botButton3.selectorDrawable.setState(StateSet.NOTHING);
}
botButton3.setPressed(false);
this.pressedBotButton = -1;
invalidateOutbounds();
return false;
}
public void lambda$checkBotButtonMotionEvent$4(int i) {
int i2 = this.pressedBotButton;
if (i == i2) {
BotButton botButton = this.botButtons.get(i2);
if (botButton != null) {
if (botButton.selectorDrawable != null) {
botButton.selectorDrawable.setState(StateSet.NOTHING);
}
botButton.setPressed(false);
if (!this.currentMessageObject.scheduled && botButton.button != null) {
cancelCheckLongPress();
this.delegate.didLongPressBotButton(this, botButton.button);
}
}
this.pressedBotButton = -1;
invalidateOutbounds();
}
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
ChatMessageCellDelegate chatMessageCellDelegate;
boolean z;
int i;
int i2;
TLRPC$Message tLRPC$Message;
TLRPC$MessageReplyHeader tLRPC$MessageReplyHeader;
TLRPC$Chat tLRPC$Chat;
int i3;
int i4;
int i5;
int i6;
MessageTopicButton messageTopicButton;
ChannelRecommendationsCell channelRecommendationsCell;
MessageObject messageObject;
if (this.currentMessageObject == null || (((chatMessageCellDelegate = this.delegate) != null && !chatMessageCellDelegate.canPerformActions()) || this.animationRunning)) {
MessageObject messageObject2 = this.currentMessageObject;
if (messageObject2 != null && messageObject2.preview) {
return checkTextSelection(motionEvent);
}
checkTextSelection(motionEvent);
return super.onTouchEvent(motionEvent);
}
boolean z2 = true;
if (checkTextSelection(motionEvent) || checkRoundSeekbar(motionEvent) || checkReactionsTouchEvent(motionEvent)) {
return true;
}
VideoPlayerRewinder videoPlayerRewinder = this.videoPlayerRewinder;
int i7 = 0;
if (videoPlayerRewinder != null && videoPlayerRewinder.rewindCount > 0) {
if (motionEvent.getAction() != 1 && motionEvent.getAction() != 3) {
return true;
}
getParent().requestDisallowInterceptTouchEvent(false);
this.videoPlayerRewinder.cancelRewind();
return false;
}
this.disallowLongPress = false;
this.lastTouchX = motionEvent.getX();
float y = motionEvent.getY();
this.lastTouchY = y;
this.backgroundDrawable.setTouchCoords(this.lastTouchX, y);
boolean checkSpoilersMotionEvent = checkSpoilersMotionEvent(motionEvent, 0);
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkTextBlockMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent && (channelRecommendationsCell = this.channelRecommendationsCell) != null && (messageObject = this.currentMessageObject) != null && messageObject.type == 27 && (checkSpoilersMotionEvent = channelRecommendationsCell.checkTouchEvent(motionEvent))) {
this.disallowLongPress = true;
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkNameMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkNameStatusMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkPinchToZoom(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkDateMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkTextSelection(motionEvent);
}
if (!checkSpoilersMotionEvent && (messageTopicButton = this.topicButton) != null) {
checkSpoilersMotionEvent = messageTopicButton.checkTouchEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkOtherButtonMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkSponsoredCloseMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkCaptionMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkTranscribeButtonMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkAudioMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkContactMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkLinkPreviewMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkInstantButtonMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkCommentButtonMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkGameMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkPhotoImageMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkBotButtonMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = checkPollButtonMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = this.giveawayMessageCell.checkMotionEvent(motionEvent);
}
if (!checkSpoilersMotionEvent) {
checkSpoilersMotionEvent = this.giveawayResultsMessageCell.checkMotionEvent(motionEvent);
}
if (motionEvent.getAction() == 3) {
this.spoilerPressed = null;
this.buttonPressed = 0;
this.miniButtonPressed = 0;
this.pressedBotButton = -1;
this.pressedVoteButton = -1;
this.pollHintPressed = false;
this.psaHintPressed = false;
this.linkPreviewPressed = false;
this.otherPressed = false;
this.sideButtonPressed = false;
this.imagePressed = false;
this.timePressed = false;
this.gamePreviewPressed = false;
this.commentButtonPressed = false;
this.instantPressed = false;
setInstantButtonPressed(false);
resetContactButtonsPressedState();
if (Build.VERSION.SDK_INT >= 21) {
int i8 = 0;
while (true) {
Drawable[] drawableArr = this.selectorDrawable;
if (i8 >= drawableArr.length) {
break;
}
if (drawableArr[i8] != null) {
drawableArr[i8].setState(StateSet.NOTHING);
}
i8++;
}
Drawable drawable = this.linkPreviewSelector;
if (drawable != null) {
drawable.setState(StateSet.NOTHING);
}
}
Drawable drawable2 = this.nameStatusSelector;
if (drawable2 != null) {
drawable2.setState(StateSet.NOTHING);
}
Drawable drawable3 = this.nameLayoutSelector;
if (drawable3 != null) {
drawable3.setState(StateSet.NOTHING);
}
resetCodeSelectors();
ButtonBounce buttonBounce = this.linkPreviewBounce;
if (buttonBounce != null) {
buttonBounce.setPressed(false);
}
if (this.hadLongPress) {
if (this.pressedLinkType != 2) {
this.hadLongPress = false;
}
this.pressedLink = null;
this.pressedEmoji = null;
this.pressedLinkType = -1;
} else {
resetPressedLink(-1);
}
z = false;
} else {
z = checkSpoilersMotionEvent;
}
updateRadialProgressBackground();
if (!this.disallowLongPress && z && motionEvent.getAction() == 0) {
startCheckLongPress();
}
if (motionEvent.getAction() != 0 && motionEvent.getAction() != 2) {
cancelCheckLongPress();
}
if (z) {
return z;
}
float x = motionEvent.getX();
float y2 = motionEvent.getY();
if (motionEvent.getAction() == 0) {
ChatMessageCellDelegate chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null && !chatMessageCellDelegate2.canPerformActions()) {
return z;
}
if (this.isAvatarVisible && this.avatarImage.isInsideImage(x, getTop() + y2)) {
this.avatarPressed = true;
} else {
if (this.psaButtonVisible && this.hasPsaHint) {
if (x >= this.psaHelpX && x <= r0 + AndroidUtilities.dp(40.0f)) {
if (y2 >= this.psaHelpY && y2 <= r0 + AndroidUtilities.dp(40.0f)) {
this.psaHintPressed = true;
createSelectorDrawable(0);
this.selectorDrawableMaskType[0] = 3;
if (Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr2 = this.selectorDrawable;
if (drawableArr2[0] != null) {
drawableArr2[0].setBounds(this.psaHelpX - AndroidUtilities.dp(8.0f), this.psaHelpY - AndroidUtilities.dp(8.0f), this.psaHelpX + AndroidUtilities.dp(32.0f), this.psaHelpY + AndroidUtilities.dp(32.0f));
this.selectorDrawable[0].setHotspot(x, y2);
this.selectorDrawable[0].setState(this.pressedState);
}
}
invalidate();
}
}
}
if (this.drawForwardedName && this.forwardedNameLayout[0] != null) {
float f = this.forwardNameX;
if (x >= f && x <= this.forwardedNameWidth + f) {
if (y2 >= this.forwardNameY && y2 <= r8 + this.forwardHeight) {
if (this.viaWidth != 0 && x >= f + this.viaNameWidth + AndroidUtilities.dp(4.0f)) {
this.forwardBotPressed = true;
} else {
this.forwardNamePressed = true;
}
}
}
}
if (this.drawNameLayout && this.nameLayout != null && (i6 = this.viaWidth) != 0) {
float f2 = this.nameX;
int i9 = this.viaNameWidth;
if (x >= i9 + f2 && x <= f2 + i9 + i6 && y2 >= this.nameY - AndroidUtilities.dp(4.0f) && y2 <= this.nameY + AndroidUtilities.dp(20.0f)) {
this.forwardBotPressed = true;
}
}
if (this.drawSideButton != 0 && x >= this.sideStartX - AndroidUtilities.dp(24.0f) && x <= this.sideStartX + AndroidUtilities.dp(40.0f) && y2 >= this.sideStartY - AndroidUtilities.dp(24.0f)) {
if (y2 <= this.sideStartY + AndroidUtilities.dp(38 + ((this.drawSideButton != 3 || this.commentLayout == null) ? 0 : 18))) {
if (this.currentMessageObject.isSent()) {
this.sideButtonPressed = true;
}
invalidate();
}
}
if (this.replyNameLayout != null) {
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
i4 = this.replyStartX;
i5 = Math.max(this.replyNameWidth, this.replyTextWidth);
} else {
i4 = this.replyStartX;
i5 = this.backgroundDrawableRight;
}
int i10 = i4 + i5;
if (x >= this.replyStartX && x <= i10) {
int i11 = this.replyStartY;
if (y2 >= i11 && y2 <= i11 + this.replyHeight) {
this.replyPressed = true;
this.replyTouchX = x;
this.replyTouchY = getY() + y2;
Drawable drawable4 = this.replySelector;
if (drawable4 != null) {
if (Build.VERSION.SDK_INT >= 21) {
drawable4.setHotspot(x, y2);
}
this.replySelectorPressed = false;
this.replySelectorCanBePressed = true;
postDelayed(new Runnable() {
@Override
public final void run() {
ChatMessageCell.this.lambda$onTouchEvent$5();
}
}, ViewConfiguration.getTapTimeout() / 6);
invalidate();
}
ButtonBounce buttonBounce2 = this.replyBounce;
if (buttonBounce2 != null) {
buttonBounce2.setPressed(true);
this.replyBounceX = x;
this.replyBounceY = y2;
}
}
}
}
z2 = z;
}
if (z2) {
startCheckLongPress();
}
return z2;
}
if (motionEvent.getAction() != 2) {
cancelCheckLongPress();
}
if (this.avatarPressed) {
if (motionEvent.getAction() == 1) {
this.avatarPressed = false;
playSoundEffect(0);
ChatMessageCellDelegate chatMessageCellDelegate3 = this.delegate;
if (chatMessageCellDelegate3 == null) {
return z;
}
TLRPC$User tLRPC$User = this.currentUser;
if (tLRPC$User != null) {
if (tLRPC$User.id == 0) {
chatMessageCellDelegate3.didPressHiddenForward(this);
return z;
}
chatMessageCellDelegate3.didPressUserAvatar(this, tLRPC$User, this.lastTouchX, this.lastTouchY);
return z;
}
TLRPC$Chat tLRPC$Chat2 = this.currentChat;
if (tLRPC$Chat2 != null) {
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader = this.currentMessageObject.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader != null) {
if ((tLRPC$MessageFwdHeader.flags & 16) != 0) {
i3 = tLRPC$MessageFwdHeader.saved_from_msg_id;
tLRPC$Chat = tLRPC$Chat2;
} else {
i3 = tLRPC$MessageFwdHeader.channel_post;
tLRPC$Chat = this.currentForwardChannel;
}
i7 = i3;
} else {
tLRPC$Chat = tLRPC$Chat2;
}
chatMessageCellDelegate3.didPressChannelAvatar(this, tLRPC$Chat != null ? tLRPC$Chat : tLRPC$Chat2, i7, this.lastTouchX, this.lastTouchY);
return z;
}
MessageObject messageObject3 = this.currentMessageObject;
if (messageObject3 == null || messageObject3.sponsoredChatInvite == null) {
return z;
}
chatMessageCellDelegate3.didPressInstantButton(this, this.drawInstantViewType);
return z;
}
if (motionEvent.getAction() == 3) {
this.avatarPressed = false;
return z;
}
if (motionEvent.getAction() != 2 || !this.isAvatarVisible || this.avatarImage.isInsideImage(x, y2 + getTop())) {
return z;
}
this.avatarPressed = false;
return z;
}
if (this.psaHintPressed) {
if (motionEvent.getAction() != 1) {
return z;
}
playSoundEffect(0);
this.delegate.didPressHint(this, 1);
this.psaHintPressed = false;
if (Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr3 = this.selectorDrawable;
if (drawableArr3[0] != null) {
drawableArr3[0].setState(StateSet.NOTHING);
}
}
invalidate();
return z;
}
if (this.forwardNamePressed) {
if (motionEvent.getAction() == 1) {
this.forwardNamePressed = false;
playSoundEffect(0);
ChatMessageCellDelegate chatMessageCellDelegate4 = this.delegate;
if (chatMessageCellDelegate4 == null) {
return z;
}
TLRPC$Chat tLRPC$Chat3 = this.currentForwardChannel;
if (tLRPC$Chat3 != null) {
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader2 = this.currentMessageObject.messageOwner.fwd_from;
chatMessageCellDelegate4.didPressChannelAvatar(this, tLRPC$Chat3, tLRPC$MessageFwdHeader2 != null ? tLRPC$MessageFwdHeader2.channel_post : 0, this.lastTouchX, this.lastTouchY);
return z;
}
TLRPC$User tLRPC$User2 = this.currentForwardUser;
if (tLRPC$User2 != null) {
chatMessageCellDelegate4.didPressUserAvatar(this, tLRPC$User2, this.lastTouchX, this.lastTouchY);
return z;
}
if (this.currentForwardName == null) {
return z;
}
chatMessageCellDelegate4.didPressHiddenForward(this);
return z;
}
if (motionEvent.getAction() == 3) {
this.forwardNamePressed = false;
return z;
}
if (motionEvent.getAction() != 2) {
return z;
}
float f3 = this.forwardNameX;
if (x >= f3 && x <= f3 + this.forwardedNameWidth) {
if (y2 >= this.forwardNameY && y2 <= r0 + this.forwardHeight) {
return z;
}
}
this.forwardNamePressed = false;
return z;
}
if (this.forwardBotPressed) {
if (motionEvent.getAction() == 1) {
this.forwardBotPressed = false;
playSoundEffect(0);
ChatMessageCellDelegate chatMessageCellDelegate5 = this.delegate;
if (chatMessageCellDelegate5 == null) {
return z;
}
TLRPC$User tLRPC$User3 = this.currentViaBotUser;
if (tLRPC$User3 != null && tLRPC$User3.bot_inline_placeholder == null) {
chatMessageCellDelegate5.didPressViaBotNotInline(this, tLRPC$User3 != null ? tLRPC$User3.id : 0L);
return z;
}
chatMessageCellDelegate5.didPressViaBot(this, tLRPC$User3 != null ? tLRPC$User3.username : this.currentMessageObject.messageOwner.via_bot_name);
return z;
}
if (motionEvent.getAction() == 3) {
this.forwardBotPressed = false;
return z;
}
if (motionEvent.getAction() != 2) {
return z;
}
if (this.drawForwardedName && this.forwardedNameLayout[0] != null) {
float f4 = this.forwardNameX;
if (x >= f4 && x <= f4 + this.forwardedNameWidth) {
if (y2 >= this.forwardNameY && y2 <= r0 + this.forwardHeight) {
return z;
}
}
this.forwardBotPressed = false;
return z;
}
float f5 = this.nameX;
int i12 = this.viaNameWidth;
if (x >= i12 + f5 && x <= f5 + i12 + this.viaWidth && y2 >= this.nameY - AndroidUtilities.dp(4.0f) && y2 <= this.nameY + AndroidUtilities.dp(20.0f)) {
return z;
}
this.forwardBotPressed = false;
return z;
}
if (this.replyPressed) {
if (motionEvent.getAction() == 1) {
this.replyPressed = false;
Drawable drawable5 = this.replySelector;
if (drawable5 != null) {
if (!this.replySelectorPressed) {
drawable5.setState(new int[]{R.attr.state_pressed, R.attr.state_enabled});
post(new Runnable() {
@Override
public final void run() {
ChatMessageCell.this.lambda$onTouchEvent$6();
}
});
} else {
drawable5.setState(new int[0]);
}
this.replySelectorPressed = false;
this.replySelectorCanBePressed = false;
invalidate();
}
ButtonBounce buttonBounce3 = this.replyBounce;
if (buttonBounce3 != null) {
buttonBounce3.setPressed(false);
}
playSoundEffect(0);
if (this.replyPanelIsForward) {
ChatMessageCellDelegate chatMessageCellDelegate6 = this.delegate;
if (chatMessageCellDelegate6 == null) {
return z;
}
TLRPC$Chat tLRPC$Chat4 = this.currentForwardChannel;
if (tLRPC$Chat4 != null) {
chatMessageCellDelegate6.didPressChannelAvatar(this, tLRPC$Chat4, this.currentMessageObject.messageOwner.fwd_from.channel_post, this.lastTouchX, this.lastTouchY);
return z;
}
TLRPC$User tLRPC$User4 = this.currentForwardUser;
if (tLRPC$User4 != null) {
chatMessageCellDelegate6.didPressUserAvatar(this, tLRPC$User4, this.lastTouchX, this.lastTouchY);
return z;
}
if (this.currentForwardName == null) {
return z;
}
chatMessageCellDelegate6.didPressHiddenForward(this);
return z;
}
if (this.delegate == null) {
return z;
}
if (!this.currentMessageObject.hasValidReplyMessageObject() && !this.currentMessageObject.isReplyToStory() && !this.hasReplyQuote && ((tLRPC$Message = this.currentMessageObject.messageOwner) == null || (tLRPC$MessageReplyHeader = tLRPC$Message.reply_to) == null || tLRPC$MessageReplyHeader.reply_from == null)) {
return z;
}
this.delegate.didPressReplyMessage(this, this.currentMessageObject.getReplyMsgId());
return z;
}
if (motionEvent.getAction() == 3) {
this.replyPressed = false;
this.replySelectorPressed = false;
Drawable drawable6 = this.replySelector;
if (drawable6 != null) {
drawable6.setState(new int[0]);
}
invalidate();
ButtonBounce buttonBounce4 = this.replyBounce;
if (buttonBounce4 == null) {
return z;
}
buttonBounce4.setPressed(false);
return z;
}
if (motionEvent.getAction() != 2) {
return z;
}
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
i = this.replyStartX;
i2 = Math.max(this.replyNameWidth, this.replyTextWidth);
} else {
i = this.replyStartX;
i2 = this.backgroundDrawableRight;
}
int i13 = i + i2;
if (x >= this.replyStartX && x <= i13) {
int i14 = this.replyStartY;
if (y2 >= i14 && y2 <= i14 + this.replyHeight) {
if (this.replySelector == null || !this.replySelectorCanBePressed || Math.sqrt(Math.pow(x - this.replyTouchX, 2.0d) + Math.pow((y2 + getY()) - this.replyTouchY, 2.0d)) <= 0.75d) {
return z;
}
this.replySelectorCanBePressed = false;
return z;
}
}
this.replyPressed = false;
this.replySelectorPressed = false;
this.replySelectorCanBePressed = false;
Drawable drawable7 = this.replySelector;
if (drawable7 != null) {
drawable7.setState(new int[0]);
}
invalidate();
ButtonBounce buttonBounce5 = this.replyBounce;
if (buttonBounce5 == null) {
return z;
}
buttonBounce5.setPressed(false);
return z;
}
if (!this.sideButtonPressed) {
return z;
}
if (motionEvent.getAction() == 1) {
this.sideButtonPressed = false;
playSoundEffect(0);
ChatMessageCellDelegate chatMessageCellDelegate7 = this.delegate;
if (chatMessageCellDelegate7 != null) {
int i15 = this.drawSideButton;
if (i15 == 4) {
chatMessageCellDelegate7.didPressSponsoredClose();
} else if (i15 == 3) {
chatMessageCellDelegate7.didPressCommentButton(this);
} else {
chatMessageCellDelegate7.didPressSideButton(this);
}
}
} else if (motionEvent.getAction() == 3) {
this.sideButtonPressed = false;
} else if (motionEvent.getAction() == 2) {
if (x >= this.sideStartX - AndroidUtilities.dp(24.0f) && x <= this.sideStartX + AndroidUtilities.dp(40.0f) && y2 >= this.sideStartY - AndroidUtilities.dp(24.0f)) {
}
this.sideButtonPressed = false;
}
invalidate();
return z;
}
public void lambda$onTouchEvent$5() {
if (this.replyPressed && !this.replySelectorPressed && this.replySelectorCanBePressed) {
this.replySelectorPressed = true;
this.replySelector.setState(new int[]{R.attr.state_pressed, R.attr.state_enabled});
}
}
public void lambda$onTouchEvent$6() {
this.replySelector.setState(new int[0]);
invalidate();
}
private boolean checkReactionsTouchEvent(MotionEvent motionEvent) {
MessageObject.GroupedMessages groupedMessages;
if (this.currentMessageObject.hasValidGroupId() && (groupedMessages = this.currentMessagesGroup) != null && !groupedMessages.isDocuments) {
ViewGroup viewGroup = (ViewGroup) getParent();
if (viewGroup == null) {
return false;
}
for (int i = 0; i < viewGroup.getChildCount(); i++) {
View childAt = viewGroup.getChildAt(i);
if (childAt instanceof ChatMessageCell) {
ChatMessageCell chatMessageCell = (ChatMessageCell) childAt;
MessageObject.GroupedMessages currentMessagesGroup = chatMessageCell.getCurrentMessagesGroup();
MessageObject.GroupedMessagePosition currentPosition = chatMessageCell.getCurrentPosition();
if (currentMessagesGroup != null && currentMessagesGroup.groupId == this.currentMessagesGroup.groupId) {
int i2 = currentPosition.flags;
if ((i2 & 8) != 0 && (i2 & 1) != 0) {
if (chatMessageCell == this) {
return this.reactionsLayoutInBubble.chekTouchEvent(motionEvent);
}
motionEvent.offsetLocation(getLeft() - chatMessageCell.getLeft(), getTop() - chatMessageCell.getTop());
boolean chekTouchEvent = chatMessageCell.reactionsLayoutInBubble.chekTouchEvent(motionEvent);
motionEvent.offsetLocation(-(getLeft() - chatMessageCell.getLeft()), -(getTop() - chatMessageCell.getTop()));
return chekTouchEvent;
}
}
}
}
return false;
}
return this.reactionsLayoutInBubble.chekTouchEvent(motionEvent);
}
private boolean checkPinchToZoom(MotionEvent motionEvent) {
ChatMessageCellDelegate chatMessageCellDelegate = this.delegate;
PinchToZoomHelper pinchToZoomHelper = chatMessageCellDelegate == null ? null : chatMessageCellDelegate.getPinchToZoomHelper();
if (this.currentMessageObject == null || !this.photoImage.hasNotThumb() || pinchToZoomHelper == null || this.currentMessageObject.isSticker() || this.currentMessageObject.isAnimatedEmoji() || ((this.currentMessageObject.isVideo() && !this.autoPlayingMedia) || this.isRoundVideo || this.currentMessageObject.isAnimatedSticker() || ((this.currentMessageObject.isDocument() && !this.currentMessageObject.isGif()) || this.currentMessageObject.needDrawBluredPreview()))) {
return false;
}
ImageReceiver imageReceiver = this.photoImage;
MessageObject messageObject = this.currentMessageObject;
SpoilerEffect2 spoilerEffect2 = this.mediaSpoilerEffect2;
return pinchToZoomHelper.checkPinchToZoom(motionEvent, this, imageReceiver, null, null, messageObject, spoilerEffect2 == null ? 0 : spoilerEffect2.getAttachIndex(this));
}
private boolean checkTextSelection(MotionEvent motionEvent) {
MessageObject messageObject;
TLRPC$Message tLRPC$Message;
int i;
int dp;
int i2;
MessageObject.GroupedMessages groupedMessages;
TextSelectionHelper.ChatListTextSelectionHelper textSelectionHelper = this.delegate.getTextSelectionHelper();
if (textSelectionHelper == null || MessagesController.getInstance(this.currentAccount).isChatNoForwards(this.currentMessageObject.getChatId()) || ((tLRPC$Message = (messageObject = this.currentMessageObject).messageOwner) != null && tLRPC$Message.noforwards)) {
return false;
}
ArrayList<MessageObject.TextLayoutBlock> arrayList = messageObject.textLayoutBlocks;
if (!((arrayList == null || arrayList.isEmpty()) ? false : true) && !hasCaptionLayout()) {
return false;
}
if ((!this.drawSelectionBackground && this.currentMessagesGroup == null) || (this.currentMessagesGroup != null && !this.delegate.hasSelectedMessages())) {
return false;
}
if (this.currentMessageObject.hasValidGroupId() && (groupedMessages = this.currentMessagesGroup) != null && !groupedMessages.isDocuments) {
ViewGroup viewGroup = (ViewGroup) getParent();
if (viewGroup == null) {
return false;
}
for (int i3 = 0; i3 < viewGroup.getChildCount(); i3++) {
View childAt = viewGroup.getChildAt(i3);
if (childAt instanceof ChatMessageCell) {
ChatMessageCell chatMessageCell = (ChatMessageCell) childAt;
MessageObject.GroupedMessages currentMessagesGroup = chatMessageCell.getCurrentMessagesGroup();
MessageObject.GroupedMessagePosition currentPosition = chatMessageCell.getCurrentPosition();
if (currentMessagesGroup != null && currentMessagesGroup.groupId == this.currentMessagesGroup.groupId) {
int i4 = currentPosition.flags;
if ((i4 & 8) != 0 && (i4 & 1) != 0) {
textSelectionHelper.setMaybeTextCord((int) chatMessageCell.captionX, (int) chatMessageCell.captionY);
textSelectionHelper.setMessageObject(chatMessageCell);
if (chatMessageCell == this) {
return textSelectionHelper.onTouchEvent(motionEvent);
}
motionEvent.offsetLocation(getLeft() - chatMessageCell.getLeft(), getTop() - chatMessageCell.getTop());
boolean onTouchEvent = textSelectionHelper.onTouchEvent(motionEvent);
motionEvent.offsetLocation(-(getLeft() - chatMessageCell.getLeft()), -(getTop() - chatMessageCell.getTop()));
return onTouchEvent;
}
}
}
}
return false;
}
if (hasCaptionLayout()) {
textSelectionHelper.setIsDescription(false);
textSelectionHelper.setMaybeTextCord((int) this.captionX, (int) this.captionY);
} else {
MessageObject messageObject2 = this.currentMessageObject;
if (messageObject2 != null && !messageObject2.preview && this.descriptionLayout != null && (!this.linkPreviewAbove ? motionEvent.getY() > this.descriptionY : motionEvent.getY() < this.textY)) {
textSelectionHelper.setIsDescription(true);
if (this.hasGamePreview) {
i2 = this.unmovedTextX - AndroidUtilities.dp(10.0f);
} else {
if (this.hasInvoicePreview) {
i = this.unmovedTextX;
dp = AndroidUtilities.dp(1.0f);
} else {
i = this.unmovedTextX;
dp = AndroidUtilities.dp(1.0f);
}
i2 = i + dp;
}
textSelectionHelper.setMaybeTextCord(i2 + AndroidUtilities.dp(10.0f) + this.descriptionX, this.descriptionY);
} else {
textSelectionHelper.setIsDescription(false);
textSelectionHelper.setMaybeTextCord(this.textX, this.textY);
}
}
textSelectionHelper.setMessageObject(this);
return textSelectionHelper.onTouchEvent(motionEvent);
}
private void updateSelectionTextPosition() {
int i;
int dp;
int i2;
if (getDelegate() == null || getDelegate().getTextSelectionHelper() == null || !getDelegate().getTextSelectionHelper().isSelected(this.currentMessageObject)) {
return;
}
int textSelectionType = getDelegate().getTextSelectionHelper().getTextSelectionType(this);
if (textSelectionType == TextSelectionHelper.ChatListTextSelectionHelper.TYPE_DESCRIPTION) {
if (this.hasGamePreview) {
i2 = this.unmovedTextX - AndroidUtilities.dp(10.0f);
} else {
if (this.hasInvoicePreview) {
i = this.unmovedTextX;
dp = AndroidUtilities.dp(1.0f);
} else {
i = this.unmovedTextX;
dp = AndroidUtilities.dp(1.0f);
}
i2 = i + dp;
}
getDelegate().getTextSelectionHelper().updateTextPosition(i2 + AndroidUtilities.dp(10.0f) + this.descriptionX, this.descriptionY);
return;
}
if (textSelectionType == TextSelectionHelper.ChatListTextSelectionHelper.TYPE_CAPTION) {
updateCaptionLayout();
getDelegate().getTextSelectionHelper().updateTextPosition((int) this.captionX, (int) this.captionY);
} else {
getDelegate().getTextSelectionHelper().updateTextPosition(this.textX, this.textY);
}
}
public ArrayList<PollButton> getPollButtons() {
return this.pollButtons;
}
public void updatePlayingMessageProgress() {
double d;
double d2;
double d3;
MessageObject messageObject = this.currentMessageObject;
if (messageObject == null) {
return;
}
VideoPlayerRewinder videoPlayerRewinder = this.videoPlayerRewinder;
if (videoPlayerRewinder != null && videoPlayerRewinder.rewindCount != 0 && videoPlayerRewinder.rewindByBackSeek) {
messageObject.audioProgress = videoPlayerRewinder.getVideoProgress();
}
double d4 = 0.0d;
if (this.documentAttachType == 4) {
SeekBar seekBar = this.seekBar;
if (seekBar != null) {
seekBar.clearTimestamps();
}
if (this.infoLayout == null || !(PhotoViewer.isPlayingMessage(this.currentMessageObject) || MediaController.getInstance().isGoingToShowMessageObject(this.currentMessageObject))) {
AnimatedFileDrawable animation = this.photoImage.getAnimation();
if (animation != null) {
MessageObject messageObject2 = this.currentMessageObject;
int durationMs = animation.getDurationMs() / 1000;
messageObject2.audioPlayerDuration = durationMs;
d3 = durationMs;
MessageObject messageObject3 = this.currentMessageObject;
TLRPC$Message tLRPC$Message = messageObject3.messageOwner;
if (tLRPC$Message.ttl > 0 && tLRPC$Message.destroyTime == 0 && !messageObject3.needDrawBluredPreview() && this.currentMessageObject.isVideo() && animation.hasBitmap()) {
this.delegate.didStartVideoStream(this.currentMessageObject);
}
} else {
d3 = 0.0d;
}
if (d3 == 0.0d) {
d3 = this.currentMessageObject.getDuration();
}
if (MediaController.getInstance().isPlayingMessage(this.currentMessageObject)) {
d3 -= this.currentMessageObject.audioProgress * d3;
} else if (animation != null) {
if (d3 != 0.0d) {
d3 -= animation.getCurrentProgressMs() / 1000;
}
if (this.delegate != null && animation.getCurrentProgressMs() >= 3000) {
this.delegate.videoTimerReached();
}
}
if (this.lastTime != d3) {
String formatShortDuration = AndroidUtilities.formatShortDuration((int) d3);
this.infoWidth = (int) Math.ceil(Theme.chat_infoPaint.measureText(formatShortDuration));
this.infoLayout = new StaticLayout(formatShortDuration, Theme.chat_infoPaint, this.infoWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.lastTime = d3;
return;
}
return;
}
return;
}
if (this.isRoundVideo) {
if (this.useSeekBarWaveform) {
if (!this.seekBarWaveform.isDragging()) {
this.seekBarWaveform.setProgress(this.currentMessageObject.audioProgress, true);
}
} else {
if (!this.seekBar.isDragging()) {
this.seekBar.setProgress(this.currentMessageObject.audioProgress);
this.seekBar.setBufferedProgress(this.currentMessageObject.bufferedProgress);
}
this.seekBar.clearTimestamps();
}
TLRPC$Document document = this.currentMessageObject.getDocument();
if (document != null) {
while (r1 < document.attributes.size()) {
TLRPC$DocumentAttribute tLRPC$DocumentAttribute = document.attributes.get(r1);
if (tLRPC$DocumentAttribute instanceof TLRPC$TL_documentAttributeVideo) {
d2 = tLRPC$DocumentAttribute.duration;
break;
}
r1++;
}
}
d2 = 0.0d;
long j = this.overridenDuration;
if (j >= 0) {
d2 = j;
} else if (MediaController.getInstance().isPlayingMessage(this.currentMessageObject)) {
d2 = Math.max(0.0d, d2 - this.currentMessageObject.audioProgressSec);
}
if (this.lastTime != d2) {
this.lastTime = d2;
String formatLongDuration = AndroidUtilities.formatLongDuration((int) d2);
this.timeWidthAudio = (int) Math.ceil(Theme.chat_timePaint.measureText(formatLongDuration));
this.durationLayout = new StaticLayout(formatLongDuration, Theme.chat_timePaint, this.timeWidthAudio, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
}
float f = this.currentMessageObject.audioProgress;
if (f != 0.0f) {
this.lastDrawingAudioProgress = f;
if (f > 0.9f) {
this.lastDrawingAudioProgress = 1.0f;
}
}
invalidate();
return;
}
if (this.documentAttach != null) {
if (this.useSeekBarWaveform) {
if (!this.seekBarWaveform.isDragging()) {
this.seekBarWaveform.setProgress(this.currentMessageObject.audioProgress, true);
}
} else {
if (!this.seekBar.isDragging()) {
this.seekBar.setProgress(this.currentMessageObject.audioProgress);
this.seekBar.setBufferedProgress(this.currentMessageObject.bufferedProgress);
}
this.seekBar.updateTimestamps(this.currentMessageObject, null);
}
if (this.documentAttachType == 3) {
long j2 = this.overridenDuration;
if (j2 >= 0) {
d = j2;
} else if (MediaController.getInstance().isPlayingMessage(this.currentMessageObject)) {
d = this.currentMessageObject.audioProgressSec;
} else {
while (true) {
if (r1 >= this.documentAttach.attributes.size()) {
break;
}
TLRPC$DocumentAttribute tLRPC$DocumentAttribute2 = this.documentAttach.attributes.get(r1);
if (tLRPC$DocumentAttribute2 instanceof TLRPC$TL_documentAttributeAudio) {
d4 = tLRPC$DocumentAttribute2.duration;
break;
}
r1++;
}
d = d4;
}
if (this.lastTime != d) {
this.lastTime = d;
String formatLongDuration2 = AndroidUtilities.formatLongDuration((int) d);
this.timeWidthAudio = (int) Math.ceil(Theme.chat_audioTimePaint.measureText(formatLongDuration2));
this.durationLayout = new StaticLayout(formatLongDuration2, Theme.chat_audioTimePaint, this.timeWidthAudio, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
}
} else {
double duration = this.currentMessageObject.getDuration();
r1 = MediaController.getInstance().isPlayingMessage(this.currentMessageObject) ? this.currentMessageObject.audioProgressSec : 0;
double d5 = r1;
if (this.lastTime != d5) {
this.lastTime = d5;
this.durationLayout = new StaticLayout(AndroidUtilities.formatShortDuration(r1, (int) duration), Theme.chat_audioTimePaint, (int) Math.ceil(Theme.chat_audioTimePaint.measureText(r3)), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
}
}
invalidate();
}
}
public void overrideDuration(long j) {
this.overridenDuration = j;
}
public void setFullyDraw(boolean z) {
this.fullyDraw = z;
}
public void setParentViewSize(int i, int i2) {
Theme.MessageDrawable messageDrawable;
this.parentWidth = i;
this.parentHeight = i2;
this.backgroundHeight = i2;
if (!(this.currentMessageObject != null && hasGradientService() && this.currentMessageObject.shouldDrawWithoutBackground()) && ((messageDrawable = this.currentBackgroundDrawable) == null || messageDrawable.getGradientShader() == null)) {
return;
}
invalidate();
}
public void copyVisiblePartTo(ChatMessageCell chatMessageCell) {
if (chatMessageCell == null) {
return;
}
chatMessageCell.setVisiblePart(this.childPosition, this.visibleHeight, this.visibleParent, this.visibleParentOffset, this.visibleTop, this.parentWidth, this.parentHeight, this.blurredViewTopOffset, this.blurredViewBottomOffset);
}
public void setVisiblePart(int i, int i2, int i3, float f, float f2, int i4, int i5, int i6, int i7) {
MessageObject messageObject;
this.childPosition = i;
this.visibleHeight = i2;
this.visibleParent = i3;
this.parentWidth = i4;
this.parentHeight = i5;
this.visibleTop = f2;
this.visibleParentOffset = f;
this.backgroundHeight = i5;
this.blurredViewTopOffset = i6;
this.blurredViewBottomOffset = i7;
if ((!this.botButtons.isEmpty() || (this.channelRecommendationsCell != null && (messageObject = this.currentMessageObject) != null && messageObject.type == 27)) && this.viewTop != f2) {
invalidate();
}
this.viewTop = f2;
if (i3 != this.parentHeight || f != this.parentViewTopOffset) {
this.parentViewTopOffset = f;
this.parentHeight = i3;
}
if (this.currentMessageObject != null && hasGradientService() && this.currentMessageObject.shouldDrawWithoutBackground()) {
invalidate();
}
MessageObject messageObject2 = this.currentMessageObject;
if (messageObject2 == null || messageObject2.textLayoutBlocks == null) {
return;
}
int i8 = i - this.textY;
int i9 = 0;
for (int i10 = 0; i10 < this.currentMessageObject.textLayoutBlocks.size() && this.currentMessageObject.textLayoutBlocks.get(i10).textYOffset <= i8; i10++) {
i9 = i10;
}
int i11 = 0;
int i12 = -1;
int i13 = -1;
while (i9 < this.currentMessageObject.textLayoutBlocks.size()) {
float f3 = this.currentMessageObject.textLayoutBlocks.get(i9).textYOffset;
float f4 = i8;
if (!intersect(f3, r13.height + f3, f4, i8 + i2)) {
if (f3 > f4) {
break;
}
} else {
if (i12 == -1) {
i12 = i9;
}
i11++;
i13 = i9;
}
i9++;
}
if (this.lastVisibleBlockNum != i13 || this.firstVisibleBlockNum != i12 || this.totalVisibleBlocksCount != i11) {
this.lastVisibleBlockNum = i13;
this.firstVisibleBlockNum = i12;
this.totalVisibleBlocksCount = i11;
invalidate();
return;
}
if (this.animatedEmojiStack != null) {
for (int i14 = 0; i14 < this.animatedEmojiStack.holders.size(); i14++) {
AnimatedEmojiSpan.AnimatedEmojiHolder animatedEmojiHolder = this.animatedEmojiStack.holders.get(i14);
if (animatedEmojiHolder != null && animatedEmojiHolder.skipDraw && !animatedEmojiHolder.outOfBounds((this.parentBoundsTop - getY()) - animatedEmojiHolder.drawingYOffset, (this.parentBoundsBottom - getY()) - animatedEmojiHolder.drawingYOffset)) {
invalidate();
return;
}
}
}
}
public static StaticLayout generateStaticLayout(CharSequence charSequence, TextPaint textPaint, int i, int i2, int i3, int i4) {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(charSequence);
StaticLayout staticLayout = new StaticLayout(charSequence, textPaint, i2, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
int i5 = 0;
int i6 = i;
for (int i7 = 0; i7 < i3; i7++) {
staticLayout.getLineDirections(i7);
if (staticLayout.getLineLeft(i7) != 0.0f || staticLayout.isRtlCharAt(staticLayout.getLineStart(i7)) || staticLayout.isRtlCharAt(staticLayout.getLineEnd(i7))) {
i6 = i2;
}
int lineEnd = staticLayout.getLineEnd(i7);
if (lineEnd == charSequence.length()) {
break;
}
int i8 = (lineEnd - 1) + i5;
if (spannableStringBuilder.charAt(i8) == ' ') {
spannableStringBuilder.replace(i8, i8 + 1, (CharSequence) "\n");
} else if (spannableStringBuilder.charAt(i8) != '\n') {
spannableStringBuilder.insert(i8, (CharSequence) "\n");
i5++;
}
if (i7 == staticLayout.getLineCount() - 1 || i7 == i4 - 1) {
break;
}
}
int i9 = i6;
return StaticLayoutEx.createStaticLayout(spannableStringBuilder, textPaint, i9, Layout.Alignment.ALIGN_NORMAL, 1.0f, AndroidUtilities.dp(1.0f), false, TextUtils.TruncateAt.END, i9, i4, true);
}
private void didClickedImage() {
ChatMessageCellDelegate chatMessageCellDelegate;
TLRPC$WebPage tLRPC$WebPage;
boolean z;
TLRPC$MessageMedia tLRPC$MessageMedia;
TLRPC$ReplyMarkup tLRPC$ReplyMarkup;
if (this.currentMessageObject.hasMediaSpoilers() && !this.currentMessageObject.needDrawBluredPreview() && !this.currentMessageObject.isMediaSpoilersRevealed) {
startRevealMedia(this.lastTouchX, this.lastTouchY);
return;
}
MessageObject messageObject = this.currentMessageObject;
int i = messageObject.type;
if (i == 20) {
TLRPC$Message tLRPC$Message = messageObject.messageOwner;
if (tLRPC$Message == null || (tLRPC$MessageMedia = tLRPC$Message.media) == null || tLRPC$MessageMedia.extended_media == null || (tLRPC$ReplyMarkup = tLRPC$Message.reply_markup) == null) {
return;
}
Iterator<TLRPC$TL_keyboardButtonRow> it = tLRPC$ReplyMarkup.rows.iterator();
while (it.hasNext()) {
Iterator<TLRPC$KeyboardButton> it2 = it.next().buttons.iterator();
if (it2.hasNext()) {
this.delegate.didPressExtendedMediaPreview(this, it2.next());
return;
}
}
return;
}
if (i == 1 || messageObject.isAnyKindOfSticker()) {
int i2 = this.buttonState;
if (i2 == -1) {
this.delegate.didPressImage(this, this.lastTouchX, this.lastTouchY);
return;
} else {
if (i2 == 0) {
didPressButton(true, false);
return;
}
return;
}
}
MessageObject messageObject2 = this.currentMessageObject;
int i3 = messageObject2.type;
if (i3 == 12) {
long j = MessageObject.getMedia(messageObject2.messageOwner).user_id;
this.delegate.didPressUserAvatar(this, j != 0 ? MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(j)) : null, this.lastTouchX, this.lastTouchY);
return;
}
if (i3 == 5) {
if (this.buttonState != -1) {
didPressButton(true, false);
return;
} else if (!MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || MediaController.getInstance().isMessagePaused()) {
this.delegate.needPlayMessage(this, this.currentMessageObject, false);
return;
} else {
MediaController.getInstance().lambda$startAudioAgain$7(this.currentMessageObject);
return;
}
}
if (i3 == 8) {
int i4 = this.buttonState;
if (i4 == -1 || (i4 == 1 && this.canStreamVideo && this.autoPlayingMedia)) {
this.delegate.didPressImage(this, this.lastTouchX, this.lastTouchY);
return;
} else {
if (i4 == 2 || i4 == 0) {
didPressButton(true, false);
return;
}
return;
}
}
int i5 = this.documentAttachType;
if (i5 == 4) {
int i6 = this.buttonState;
if (i6 == -1 || ((z = this.drawVideoImageButton) && (this.autoPlayingMedia || (SharedConfig.streamMedia && this.canStreamVideo)))) {
this.delegate.didPressImage(this, this.lastTouchX, this.lastTouchY);
return;
}
if (z) {
didPressButton(true, true);
return;
} else {
if (i6 == 0 || i6 == 3) {
didPressButton(true, false);
return;
}
return;
}
}
if (i3 == 4 || i3 == 23 || i3 == 24) {
this.delegate.didPressImage(this, this.lastTouchX, this.lastTouchY);
return;
}
if (i5 == 1) {
if (this.buttonState == -1) {
this.delegate.didPressImage(this, this.lastTouchX, this.lastTouchY);
return;
}
return;
}
if (i5 == 2) {
if (this.buttonState != -1 || (tLRPC$WebPage = MessageObject.getMedia(messageObject2.messageOwner).webpage) == null) {
return;
}
String str = tLRPC$WebPage.embed_url;
if (str != null && str.length() != 0) {
this.delegate.needOpenWebView(this.currentMessageObject, tLRPC$WebPage.embed_url, tLRPC$WebPage.site_name, tLRPC$WebPage.description, tLRPC$WebPage.url, tLRPC$WebPage.embed_width, tLRPC$WebPage.embed_height);
return;
} else {
Browser.openUrl(getContext(), tLRPC$WebPage.url);
return;
}
}
if (this.hasInvoicePreview) {
if (this.buttonState == -1) {
this.delegate.didPressImage(this, this.lastTouchX, this.lastTouchY);
}
} else {
if (Build.VERSION.SDK_INT < 26 || (chatMessageCellDelegate = this.delegate) == null) {
return;
}
if (i3 == 16) {
chatMessageCellDelegate.didLongPress(this, 0.0f, 0.0f);
} else {
chatMessageCellDelegate.didPressOther(this, this.otherX, this.otherY);
}
}
}
private void updateSecretTimeText(MessageObject messageObject) {
CharSequence secretTimeString;
if (messageObject == null || !messageObject.needDrawBluredPreview() || (secretTimeString = messageObject.getSecretTimeString()) == null) {
return;
}
if (secretTimeString instanceof String) {
int ceil = (int) Math.ceil(Theme.chat_infoPaint.measureText((String) secretTimeString));
this.infoWidth = ceil;
this.infoLayout = new StaticLayout(TextUtils.ellipsize(secretTimeString, Theme.chat_infoPaint, ceil, TextUtils.TruncateAt.END), Theme.chat_infoPaint, this.infoWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
} else {
StaticLayout staticLayout = new StaticLayout(secretTimeString, Theme.chat_infoBoldPaint, getMeasuredWidth() > 0 ? getMeasuredWidth() : 9999, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.infoLayout = staticLayout;
this.infoWidth = staticLayout.getLineCount() > 0 ? (int) this.infoLayout.getLineWidth(0) : 0;
}
invalidate();
}
private boolean isPhotoDataChanged(MessageObject messageObject) {
int i;
TLRPC$MessageMedia tLRPC$MessageMedia;
String formapMapUrl;
int i2;
int i3 = messageObject.type;
if (i3 == 0 || i3 == 14) {
return false;
}
if (i3 == 4) {
if (this.currentUrl == null) {
return true;
}
TLRPC$GeoPoint tLRPC$GeoPoint = messageObject.messageOwner.media.geo;
double d = tLRPC$GeoPoint.lat;
double d2 = tLRPC$GeoPoint._long;
if (((int) messageObject.getDialogId()) == 0 && (i2 = SharedConfig.mapPreviewType) != 0) {
if (i2 == 1) {
i = 4;
} else if (i2 == 3) {
i = 1;
}
tLRPC$MessageMedia = messageObject.messageOwner.media;
if (!(tLRPC$MessageMedia instanceof TLRPC$TL_messageMediaGeoLive)) {
int dp = this.backgroundWidth - AndroidUtilities.dp(21.0f);
int dp2 = AndroidUtilities.dp(195.0f);
double d3 = 268435456;
double d4 = (d * 3.141592653589793d) / 180.0d;
double atan = ((1.5707963267948966d - (Math.atan(Math.exp(((Math.round(d3 - ((Math.log((Math.sin(d4) + 1.0d) / (1.0d - Math.sin(d4))) * r15) / 2.0d)) - (AndroidUtilities.dp(10.3f) << 6)) - d3) / (d3 / 3.141592653589793d))) * 2.0d)) * 180.0d) / 3.141592653589793d;
int i4 = this.currentAccount;
float f = AndroidUtilities.density;
formapMapUrl = AndroidUtilities.formapMapUrl(i4, atan, d2, (int) (dp / f), (int) (dp2 / f), false, 15, i);
} else if (!TextUtils.isEmpty(tLRPC$MessageMedia.title)) {
int dp3 = this.backgroundWidth - AndroidUtilities.dp(21.0f);
int dp4 = AndroidUtilities.dp(195.0f);
int i5 = this.currentAccount;
float f2 = AndroidUtilities.density;
formapMapUrl = AndroidUtilities.formapMapUrl(i5, d, d2, (int) (dp3 / f2), (int) (dp4 / f2), true, 15, i);
} else {
int dp5 = this.backgroundWidth - AndroidUtilities.dp(12.0f);
int dp6 = AndroidUtilities.dp(195.0f);
int i6 = this.currentAccount;
float f3 = AndroidUtilities.density;
formapMapUrl = AndroidUtilities.formapMapUrl(i6, d, d2, (int) (dp5 / f3), (int) (dp6 / f3), true, 15, i);
}
return !formapMapUrl.equals(this.currentUrl);
}
i = -1;
tLRPC$MessageMedia = messageObject.messageOwner.media;
if (!(tLRPC$MessageMedia instanceof TLRPC$TL_messageMediaGeoLive)) {
}
return !formapMapUrl.equals(this.currentUrl);
}
TLRPC$PhotoSize tLRPC$PhotoSize = this.currentPhotoObject;
if (tLRPC$PhotoSize == null || (tLRPC$PhotoSize.location instanceof TLRPC$TL_fileLocationUnavailable)) {
return i3 == 1 || i3 == 20 || i3 == 5 || i3 == 3 || i3 == 8 || messageObject.isAnyKindOfSticker();
}
if (this.currentMessageObject == null || !this.photoNotSet) {
return false;
}
return FileLoader.getInstance(this.currentAccount).getPathToMessage(this.currentMessageObject.messageOwner).exists();
}
public int getRepliesCount() {
MessageObject.GroupedMessages groupedMessages = this.currentMessagesGroup;
if (groupedMessages != null && !groupedMessages.messages.isEmpty()) {
return this.currentMessagesGroup.messages.get(0).getRepliesCount();
}
return this.currentMessageObject.getRepliesCount();
}
private ArrayList<TLRPC$Peer> getRecentRepliers() {
TLRPC$MessageReplies tLRPC$MessageReplies;
MessageObject.GroupedMessages groupedMessages = this.currentMessagesGroup;
if (groupedMessages != null && !groupedMessages.messages.isEmpty() && (tLRPC$MessageReplies = this.currentMessagesGroup.messages.get(0).messageOwner.replies) != null) {
return tLRPC$MessageReplies.recent_repliers;
}
TLRPC$MessageReplies tLRPC$MessageReplies2 = this.currentMessageObject.messageOwner.replies;
if (tLRPC$MessageReplies2 != null) {
return tLRPC$MessageReplies2.recent_repliers;
}
return null;
}
public void updateAnimatedEmojis() {
MessageObject messageObject;
ArrayList<MessageObject.TextLayoutBlock> arrayList;
if (!this.imageReceiversAttachState || (messageObject = this.currentMessageObject) == null) {
return;
}
int cacheTypeForEnterView = messageObject.wasJustSent ? AnimatedEmojiDrawable.getCacheTypeForEnterView() : 0;
MessageObject.TextLayoutBlocks textLayoutBlocks = this.captionLayout;
if (textLayoutBlocks != null && (arrayList = textLayoutBlocks.textLayoutBlocks) != null) {
this.animatedEmojiStack = AnimatedEmojiSpan.update(cacheTypeForEnterView, (View) this, false, this.animatedEmojiStack, arrayList);
} else {
ChatMessageCellDelegate chatMessageCellDelegate = this.delegate;
this.animatedEmojiStack = AnimatedEmojiSpan.update(cacheTypeForEnterView, this, chatMessageCellDelegate == null || !chatMessageCellDelegate.canDrawOutboundsContent(), this.animatedEmojiStack, this.currentMessageObject.textLayoutBlocks);
}
}
private boolean isUserDataChanged() {
TLRPC$FileLocation tLRPC$FileLocation;
TLRPC$FileLocation tLRPC$FileLocation2;
TLRPC$PhotoSize tLRPC$PhotoSize;
String str;
String forwardedName;
String str2;
MessageObject messageObject;
MessageObject messageObject2;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader;
TLRPC$ChatPhoto tLRPC$ChatPhoto;
TLRPC$UserProfilePhoto tLRPC$UserProfilePhoto;
MessageObject messageObject3 = this.currentMessageObject;
if (messageObject3 != null && !this.hasLinkPreview && MessageObject.getMedia(messageObject3.messageOwner) != null && (MessageObject.getMedia(this.currentMessageObject.messageOwner).webpage instanceof TLRPC$TL_webPage)) {
return true;
}
MessageObject messageObject4 = this.currentMessageObject;
if (messageObject4 != null && (this.currentUser != null || this.currentChat != null)) {
int i = this.lastSendState;
TLRPC$Message tLRPC$Message = messageObject4.messageOwner;
if (i != tLRPC$Message.send_state || this.lastDeleteDate != tLRPC$Message.destroyTime || this.lastViewsCount != tLRPC$Message.views || this.lastRepliesCount != getRepliesCount() || this.lastReactions != this.currentMessageObject.messageOwner.reactions) {
return true;
}
updateCurrentUserAndChat();
if (this.isAvatarVisible) {
TLRPC$User tLRPC$User = this.currentUser;
if (tLRPC$User != null && (tLRPC$UserProfilePhoto = tLRPC$User.photo) != null) {
tLRPC$FileLocation = tLRPC$UserProfilePhoto.photo_small;
} else {
TLRPC$Chat tLRPC$Chat = this.currentChat;
if (tLRPC$Chat != null && (tLRPC$ChatPhoto = tLRPC$Chat.photo) != null) {
tLRPC$FileLocation = tLRPC$ChatPhoto.photo_small;
}
}
if (this.replyTextLayout != null && (messageObject2 = this.currentMessageObject.replyMessageObject) != null && (!this.isThreadChat || (tLRPC$MessageFwdHeader = messageObject2.messageOwner.fwd_from) == null || tLRPC$MessageFwdHeader.channel_post == 0)) {
return true;
}
tLRPC$FileLocation2 = this.currentPhoto;
if ((tLRPC$FileLocation2 != null && tLRPC$FileLocation != null) || ((tLRPC$FileLocation2 != null && tLRPC$FileLocation == null) || (tLRPC$FileLocation2 != null && (tLRPC$FileLocation2.local_id != tLRPC$FileLocation.local_id || tLRPC$FileLocation2.volume_id != tLRPC$FileLocation.volume_id)))) {
return true;
}
if (this.replyNameLayout != null || (messageObject = this.currentMessageObject.replyMessageObject) == null || (tLRPC$PhotoSize = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 40)) == null || this.currentMessageObject.replyMessageObject.isAnyKindOfSticker()) {
tLRPC$PhotoSize = null;
}
if (this.currentReplyPhoto != null && tLRPC$PhotoSize != null) {
return true;
}
String authorName = isNeedAuthorName() ? getAuthorName() : null;
str = this.currentNameString;
if ((str != null && authorName != null) || ((str != null && authorName == null) || (str != null && !str.equals(authorName)))) {
return true;
}
if (this.drawForwardedName && this.currentMessageObject.needDrawForwarded()) {
forwardedName = this.currentMessageObject.getForwardedName();
str2 = this.currentForwardNameString;
if (str2 != null && forwardedName != null) {
return true;
}
if (str2 == null && forwardedName == null) {
return true;
}
return str2 == null && !str2.equals(forwardedName);
}
}
tLRPC$FileLocation = null;
if (this.replyTextLayout != null) {
}
tLRPC$FileLocation2 = this.currentPhoto;
if (tLRPC$FileLocation2 != null) {
}
if (this.replyNameLayout != null) {
}
tLRPC$PhotoSize = null;
if (this.currentReplyPhoto != null) {
}
if (isNeedAuthorName()) {
}
str = this.currentNameString;
if (str != null) {
}
if (this.drawForwardedName) {
forwardedName = this.currentMessageObject.getForwardedName();
str2 = this.currentForwardNameString;
if (str2 != null) {
}
if (str2 == null) {
}
if (str2 == null) {
}
}
}
return false;
}
public ImageReceiver getPhotoImage() {
return this.photoImage;
}
public ImageReceiver getBlurredPhotoImage() {
return this.blurredPhotoImage;
}
public int getNoSoundIconCenterX() {
return this.noSoundCenterX;
}
public int getForwardNameCenterX() {
float f;
TLRPC$User tLRPC$User = this.currentUser;
if (tLRPC$User != null && tLRPC$User.id == 0) {
f = this.avatarImage.getCenterX();
} else {
f = this.forwardNameX + this.forwardNameCenterX;
}
return (int) f;
}
public int getChecksX() {
return this.layoutWidth - AndroidUtilities.dp(SharedConfig.bubbleRadius >= 10 ? 27.3f : 25.3f);
}
public int getChecksY() {
float f;
int intrinsicHeight;
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
f = this.drawTimeY;
intrinsicHeight = getThemedDrawable("drawableMsgStickerCheck").getIntrinsicHeight();
} else {
f = this.drawTimeY;
intrinsicHeight = Theme.chat_msgMediaCheckDrawable.getIntrinsicHeight();
}
return (int) (f - intrinsicHeight);
}
public void overrideAudioVisualizer(AudioVisualizerDrawable audioVisualizerDrawable) {
this.overridenAudioVisualizer = audioVisualizerDrawable;
}
public TLRPC$User getCurrentUser() {
return this.currentUser;
}
public TLRPC$Chat getCurrentChat() {
return this.currentChat;
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.startSpoilers);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.stopSpoilers);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiLoaded);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didUpdatePremiumGiftStickers);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.userInfoDidLoad);
cancelShakeAnimation();
CheckBoxBase checkBoxBase = this.checkBox;
if (checkBoxBase != null) {
checkBoxBase.onDetachedFromWindow();
}
CheckBoxBase checkBoxBase2 = this.mediaCheckBox;
if (checkBoxBase2 != null) {
checkBoxBase2.onDetachedFromWindow();
}
if (this.pollCheckBox != null) {
int i = 0;
while (true) {
CheckBoxBase[] checkBoxBaseArr = this.pollCheckBox;
if (i >= checkBoxBaseArr.length) {
break;
}
checkBoxBaseArr[i].onDetachedFromWindow();
i++;
}
}
this.attachedToWindow = false;
this.avatarImage.onDetachedFromWindow();
checkImageReceiversAttachState();
if (this.addedForTest && this.currentUrl != null && this.currentWebFile != null) {
ImageLoader.getInstance().removeTestWebFile(this.currentUrl);
this.addedForTest = false;
}
DownloadController.getInstance(this.currentAccount).removeLoadingFileObserver(this);
if (getDelegate() != null && getDelegate().getTextSelectionHelper() != null) {
getDelegate().getTextSelectionHelper().onChatMessageCellDetached(this);
}
this.transitionParams.onDetach();
if (MediaController.getInstance().isPlayingMessage(this.currentMessageObject)) {
Theme.getCurrentAudiVisualizerDrawable().setParentView(null);
}
ValueAnimator valueAnimator = this.statusDrawableAnimator;
if (valueAnimator != null) {
valueAnimator.removeAllListeners();
this.statusDrawableAnimator.cancel();
}
this.reactionsLayoutInBubble.onDetachFromWindow();
this.statusDrawableAnimationInProgress = false;
FlagSecureReason flagSecureReason = this.flagSecure;
if (flagSecureReason != null) {
flagSecureReason.detach();
}
MessageTopicButton messageTopicButton = this.topicButton;
if (messageTopicButton != null) {
messageTopicButton.onDetached(this);
}
AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable swapAnimatedEmojiDrawable = this.currentNameStatusDrawable;
if (swapAnimatedEmojiDrawable != null) {
swapAnimatedEmojiDrawable.detach();
}
SpoilerEffect2 spoilerEffect2 = this.mediaSpoilerEffect2;
if (spoilerEffect2 != null) {
spoilerEffect2.detach(this);
}
ChannelRecommendationsCell channelRecommendationsCell = this.channelRecommendationsCell;
if (channelRecommendationsCell != null) {
channelRecommendationsCell.onDetachedFromWindow();
}
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.startSpoilers);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.stopSpoilers);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiLoaded);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didUpdatePremiumGiftStickers);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.userInfoDidLoad);
MessageObject messageObject = this.currentMessageObject;
if (messageObject != null) {
messageObject.animateComments = false;
}
MessageObject messageObject2 = this.messageObjectToSet;
if (messageObject2 != null) {
messageObject2.animateComments = false;
setMessageContent(messageObject2, this.groupedMessagesToSet, this.bottomNearToSet, this.topNearToSet);
this.messageObjectToSet = null;
this.groupedMessagesToSet = null;
}
CheckBoxBase checkBoxBase = this.checkBox;
if (checkBoxBase != null) {
checkBoxBase.onAttachedToWindow();
}
CheckBoxBase checkBoxBase2 = this.mediaCheckBox;
if (checkBoxBase2 != null) {
checkBoxBase2.onAttachedToWindow();
}
if (this.pollCheckBox != null) {
int i = 0;
while (true) {
CheckBoxBase[] checkBoxBaseArr = this.pollCheckBox;
if (i >= checkBoxBaseArr.length) {
break;
}
checkBoxBaseArr[i].onAttachedToWindow();
i++;
}
}
this.attachedToWindow = true;
this.animationOffsetX = 0.0f;
this.slidingOffsetX = 0.0f;
this.checkBoxTranslation = 0;
updateTranslation();
this.avatarImage.setParentView((View) getParent());
this.avatarImage.onAttachedToWindow();
checkImageReceiversAttachState();
MessageObject messageObject3 = this.currentMessageObject;
if (messageObject3 != null) {
setAvatar(messageObject3);
}
int i2 = this.documentAttachType;
if (i2 == 4 && this.autoPlayingMedia) {
boolean isPlayingMessage = MediaController.getInstance().isPlayingMessage(this.currentMessageObject);
this.animatingNoSoundPlaying = isPlayingMessage;
this.animatingNoSoundProgress = isPlayingMessage ? 0.0f : 1.0f;
this.animatingNoSound = 0;
} else {
this.animatingNoSoundPlaying = false;
this.animatingNoSoundProgress = 0.0f;
this.animatingDrawVideoImageButtonProgress = ((i2 == 4 || i2 == 2) && this.drawVideoSize) ? 1.0f : 0.0f;
}
if (getDelegate() != null && getDelegate().getTextSelectionHelper() != null) {
getDelegate().getTextSelectionHelper().onChatMessageCellAttached(this);
}
if (this.documentAttachType == 5) {
this.toSeekBarProgress = MediaController.getInstance().isPlayingMessage(this.currentMessageObject) ? 1.0f : 0.0f;
}
this.reactionsLayoutInBubble.onAttachToWindow();
FlagSecureReason flagSecureReason = this.flagSecure;
if (flagSecureReason != null) {
flagSecureReason.attach();
}
updateFlagSecure();
MessageObject messageObject4 = this.currentMessageObject;
if (messageObject4 != null && messageObject4.type == 20 && this.unlockLayout != null) {
invalidate();
}
MessageTopicButton messageTopicButton = this.topicButton;
if (messageTopicButton != null) {
messageTopicButton.onAttached(this);
}
AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable swapAnimatedEmojiDrawable = this.currentNameStatusDrawable;
if (swapAnimatedEmojiDrawable != null) {
swapAnimatedEmojiDrawable.attach();
}
SpoilerEffect2 spoilerEffect2 = this.mediaSpoilerEffect2;
if (spoilerEffect2 != null) {
if (spoilerEffect2.destroyed) {
SpoilerEffect2 spoilerEffect22 = SpoilerEffect2.getInstance(this);
this.mediaSpoilerEffect2 = spoilerEffect22;
Integer num = this.mediaSpoilerEffect2Index;
if (num != null) {
spoilerEffect22.reassignAttach(this, num.intValue());
}
} else {
spoilerEffect2.attach(this);
}
}
ChannelRecommendationsCell channelRecommendationsCell = this.channelRecommendationsCell;
if (channelRecommendationsCell != null) {
channelRecommendationsCell.onAttachedToWindow();
}
}
public void copySpoilerEffect2AttachIndexFrom(ChatMessageCell chatMessageCell) {
SpoilerEffect2 spoilerEffect2;
if (chatMessageCell == null || (spoilerEffect2 = chatMessageCell.mediaSpoilerEffect2) == null) {
return;
}
Integer valueOf = Integer.valueOf(spoilerEffect2.getAttachIndex(chatMessageCell));
this.mediaSpoilerEffect2Index = valueOf;
SpoilerEffect2 spoilerEffect22 = this.mediaSpoilerEffect2;
if (spoilerEffect22 != null) {
spoilerEffect22.reassignAttach(this, valueOf.intValue());
}
}
private void checkImageReceiversAttachState() {
boolean z = this.attachedToWindow;
boolean z2 = false;
if (z != this.imageReceiversAttachState) {
this.imageReceiversAttachState = z;
if (z) {
this.radialProgress.onAttachedToWindow();
this.videoRadialProgress.onAttachedToWindow();
if (this.pollAvatarImages != null) {
int i = 0;
while (true) {
ImageReceiver[] imageReceiverArr = this.pollAvatarImages;
if (i >= imageReceiverArr.length) {
break;
}
imageReceiverArr[i].onAttachedToWindow();
i++;
}
}
if (this.commentAvatarImages != null) {
int i2 = 0;
while (true) {
ImageReceiver[] imageReceiverArr2 = this.commentAvatarImages;
if (i2 >= imageReceiverArr2.length) {
break;
}
imageReceiverArr2[i2].onAttachedToWindow();
i2++;
}
}
this.giveawayMessageCell.onAttachedToWindow();
this.giveawayResultsMessageCell.onAttachedToWindow();
this.replyImageReceiver.onAttachedToWindow();
this.locationImageReceiver.onAttachedToWindow();
this.blurredPhotoImage.onAttachedToWindow();
if (this.photoImage.onAttachedToWindow()) {
if (this.drawPhotoImage) {
updateButtonState(false, false, false);
}
} else {
updateButtonState(false, false, false);
}
this.animatedEmojiReplyStack = AnimatedEmojiSpan.update(0, (View) this, false, this.animatedEmojiReplyStack, this.replyTextLayout);
this.animatedEmojiDescriptionStack = AnimatedEmojiSpan.update(0, (View) this, false, this.animatedEmojiDescriptionStack, this.descriptionLayout);
updateAnimatedEmojis();
} else {
this.radialProgress.onDetachedFromWindow();
this.videoRadialProgress.onDetachedFromWindow();
if (this.pollAvatarImages != null) {
int i3 = 0;
while (true) {
ImageReceiver[] imageReceiverArr3 = this.pollAvatarImages;
if (i3 >= imageReceiverArr3.length) {
break;
}
imageReceiverArr3[i3].onDetachedFromWindow();
i3++;
}
}
if (this.commentAvatarImages != null) {
int i4 = 0;
while (true) {
ImageReceiver[] imageReceiverArr4 = this.commentAvatarImages;
if (i4 >= imageReceiverArr4.length) {
break;
}
imageReceiverArr4[i4].onDetachedFromWindow();
i4++;
}
}
this.replyImageReceiver.onDetachedFromWindow();
this.locationImageReceiver.onDetachedFromWindow();
this.photoImage.onDetachedFromWindow();
this.blurredPhotoImage.onDetachedFromWindow();
this.giveawayMessageCell.onDetachedFromWindow();
this.giveawayResultsMessageCell.onDetachedFromWindow();
AnimatedEmojiSpan.release(this, this.animatedEmojiDescriptionStack);
AnimatedEmojiSpan.release(this, this.animatedEmojiReplyStack);
AnimatedEmojiSpan.release(this, this.animatedEmojiStack);
}
}
if (this.attachedToWindow && (this.visibleOnScreen || !this.shouldCheckVisibleOnScreen)) {
z2 = true;
}
if (z2 != this.imageReceiversVisibleState) {
this.imageReceiversVisibleState = z2;
if (z2) {
fileAttach(true, this.currentMessageObject);
} else {
fileDetach(this.currentMessageObject);
}
}
}
private void fileAttach(boolean z, MessageObject messageObject) {
ImageReceiver imageReceiver = this.photoImage;
if (imageReceiver != null) {
imageReceiver.setFileLoadingPriority(1);
}
if (z && messageObject != null && (this.isRoundVideo || messageObject.isVideo())) {
checkVideoPlayback(true, null);
}
if (messageObject == null || messageObject.mediaExists) {
return;
}
int canDownloadMedia = DownloadController.getInstance(this.currentAccount).canDownloadMedia(messageObject.messageOwner);
TLRPC$Document document = messageObject.getDocument();
if ((MessageObject.isStickerDocument(document) || MessageObject.isAnimatedStickerDocument(document, true) || MessageObject.isGifDocument(document) || MessageObject.isRoundVideoDocument(document)) || this.isSmallImage) {
return;
}
TLRPC$PhotoSize closestPhotoSizeWithSize = document == null ? FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, AndroidUtilities.getPhotoSize()) : null;
if (canDownloadMedia == 2 || (canDownloadMedia == 1 && messageObject.isVideo())) {
if (canDownloadMedia != 2 && document != null && !messageObject.shouldEncryptPhotoOrVideo() && messageObject.canStreamVideo()) {
FileLoader.getInstance(this.currentAccount).loadFile(document, messageObject, 1, 0);
}
} else if (canDownloadMedia != 0) {
if (document != null) {
FileLoader.getInstance(this.currentAccount).loadFile(document, messageObject, 1, ((MessageObject.isVideoDocument(document) || messageObject.isVoiceOnce() || messageObject.isRoundOnce()) && messageObject.shouldEncryptPhotoOrVideo()) ? 2 : 0);
} else if (closestPhotoSizeWithSize != null) {
FileLoader.getInstance(this.currentAccount).loadFile(ImageLocation.getForObject(closestPhotoSizeWithSize, messageObject.photoThumbsObject), messageObject, null, 1, messageObject.shouldEncryptPhotoOrVideo() ? 2 : 0);
}
}
if (z) {
updateButtonState(false, false, false);
}
}
private void fileDetach(MessageObject messageObject) {
ImageReceiver imageReceiver = this.photoImage;
if (imageReceiver != null) {
imageReceiver.setFileLoadingPriority(0);
}
cancelLoading(messageObject);
}
private void cancelLoading(MessageObject messageObject) {
if (messageObject == null || messageObject.mediaExists || messageObject.putInDownloadsStore || DownloadController.getInstance(this.currentAccount).isDownloading(messageObject.messageOwner.id) || PhotoViewer.getInstance().isVisible()) {
return;
}
TLRPC$Document document = messageObject.getDocument();
boolean z = true;
if (!MessageObject.isStickerDocument(document) && !MessageObject.isAnimatedStickerDocument(document, true) && !MessageObject.isGifDocument(document) && !MessageObject.isRoundVideoDocument(document)) {
z = false;
}
if (z) {
return;
}
if (document != null) {
FileLoader.getInstance(this.currentAccount).cancelLoadFile(document);
return;
}
TLRPC$PhotoSize closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, AndroidUtilities.getPhotoSize());
if (closestPhotoSizeWithSize != null) {
FileLoader.getInstance(this.currentAccount).cancelLoadFile(closestPhotoSizeWithSize);
}
}
private void setMessageContent(MessageObject messageObject, MessageObject.GroupedMessages groupedMessages, boolean z, boolean z2) {
boolean z3;
boolean z4;
char c;
boolean z5;
boolean z6;
long j;
int i;
int i2;
MessageObject.GroupedMessages groupedMessages2;
MessageObject.GroupedMessagePosition groupedMessagePosition;
MessageObject.GroupedMessages groupedMessages3;
boolean z7;
boolean needDrawAvatar;
boolean z8;
?? r2;
ExpiredStoryView expiredStoryView;
boolean z9;
MessageObject.GroupedMessages groupedMessages4;
boolean isLinkedToChat;
StaticLayout staticLayout;
boolean z10;
int i3;
MessageObject messageObject2;
int i4;
int i5;
boolean z11;
float f;
float f2;
int i6;
int i7;
?? r7;
int i8;
int minTabletSide;
int dp;
int i9;
MessageObject.TextLayoutBlocks textLayoutBlocks;
int i10;
Float valueOf;
int i11;
int i12;
MessageObject.GroupedMessagePosition groupedMessagePosition2;
MessageObject messageObject3;
float f3;
int i13;
int i14;
boolean z12;
int i15;
int dp2;
StringBuilder sb;
StringBuilder sb2;
HashMap hashMap;
int i16;
BotButton botButton;
int i17;
int i18;
int i19;
CharSequence string;
Uri parse;
boolean z13;
AnonymousClass1 anonymousClass1;
String str;
int minTabletSide2;
?? r72;
boolean z14;
MessageObject.GroupedMessagePosition groupedMessagePosition3;
int dp3;
int i20;
int i21;
int i22;
int i23;
MessageObject messageObject4;
ArrayList<BotButton> arrayList;
MessageObject messageObject5;
float f4;
String string2;
boolean z15;
CharSequence charSequence;
String replace;
ReactionsLayoutInBubble reactionsLayoutInBubble;
SpoilerEffect2 spoilerEffect2;
int dp4;
ReactionsLayoutInBubble reactionsLayoutInBubble2;
MessageObject.GroupedMessagePosition groupedMessagePosition4;
int min;
boolean z16;
int min2;
int createDocumentLayout;
ReactionsLayoutInBubble reactionsLayoutInBubble3;
MessageObject.GroupedMessages groupedMessages5;
boolean z17;
String string3;
ArrayList arrayList2;
boolean z18;
boolean z19;
ArrayList arrayList3;
String string4;
int i24;
CharSequence ellipsize;
int i25;
float f5;
MessageObject messageObject6;
float f6;
int i26;
int i27;
float f7;
int i28;
int i29;
int dp5;
int dp6;
int i30;
int i31;
int i32;
int i33;
int i34;
StaticLayout staticLayout2;
MessageObject messageObject7;
MessageObject.GroupedMessages groupedMessages6;
StaticLayout staticLayout3;
int dp7;
SpoilerEffect2 spoilerEffect22;
int i35;
int i36;
int dp8;
MessageObject.GroupedMessagePosition groupedMessagePosition5;
int i37;
int dp9;
MessageObject messageObject8;
int i38;
int i39;
int i40;
Drawable drawable;
int i41;
ReactionsLayoutInBubble reactionsLayoutInBubble4;
int i42;
int i43;
int i44;
int i45;
int i46;
float f8;
MessageObject messageObject9;
float minTabletSide3;
float f9;
int dp10;
MessageObject messageObject10;
StaticLayout[] staticLayoutArr;
int i47;
int i48;
int i49;
float minTabletSide4;
float f10;
int i50;
int i51;
Drawable drawable2;
String str2;
Drawable drawable3;
Object obj;
int i52;
?? r11;
int i53;
boolean z20;
String format;
int i54;
boolean z21;
int i55;
boolean z22;
BitmapDrawable bitmapDrawable;
int i56;
TLRPC$PhotoSize tLRPC$PhotoSize;
TLRPC$PhotoSize tLRPC$PhotoSize2;
TLRPC$Document document;
int i57;
int i58;
boolean z23;
int dp11;
int i59;
MessageObject.GroupedMessagePosition groupedMessagePosition6;
int round;
boolean z24;
int dp12;
int i60;
int i61;
int dp13;
int additionalWidthForPosition;
MessageObject messageObject11;
MessageObject.GroupedMessagePosition groupedMessagePosition7;
int i62;
int i63;
int i64;
double ceil;
CharSequence charSequence2;
boolean z25;
int i65;
boolean z26;
int i66;
int i67;
MessageObject messageObject12;
?? r13;
int i68;
int i69;
MessageObject.TextLayoutBlocks textLayoutBlocks2;
MessageObject.GroupedMessagePosition groupedMessagePosition8;
ReactionsLayoutInBubble reactionsLayoutInBubble5;
int i70;
MessageObject.TextLayoutBlocks textLayoutBlocks3;
int dp14;
MessageObject messageObject13;
int measureText;
int i71;
int i72;
Object obj2;
ImageLocation forObject;
TLRPC$PhotoSize tLRPC$PhotoSize3;
int i73;
TLRPC$PhotoSize tLRPC$PhotoSize4;
char c2;
int i74;
MessageObject messageObject14;
boolean z27;
int i75;
char c3;
ArrayList<TLRPC$PhotoSize> arrayList4;
int i76;
int minTabletSide5;
boolean z28;
int minTabletSide6;
TLRPC$PhotoSize tLRPC$PhotoSize5;
TLRPC$PhotoSize tLRPC$PhotoSize6;
int i77;
int i78;
int i79;
int i80;
int i81;
int minTabletSide7;
int i82;
MessageObject.GroupedMessagePosition groupedMessagePosition9;
int minTabletSide8;
int dp15;
int i83;
TLRPC$User user;
TLRPC$Document tLRPC$Document;
TLRPC$ThemeSettings tLRPC$ThemeSettings;
TL_stories$StoryItem tL_stories$StoryItem;
boolean z29;
Uri parse2;
String queryParameter;
boolean z30;
int i84;
TL_stories$StoryItem tL_stories$StoryItem2;
int i85;
MessageObject messageObject15;
MessageTopicButton messageTopicButton;
int max;
MessageObject messageObject16;
int maxMessageTextWidth;
int i86;
String str3;
CharSequence charSequence3;
TLRPC$Photo tLRPC$Photo;
TLObject tLObject;
String str4;
int i87;
int i88;
TL_stories$StoryItem tL_stories$StoryItem3;
String str5;
CharSequence charSequence4;
String str6;
WebFile webFile;
TLRPC$Document tLRPC$Document2;
CharSequence charSequence5;
boolean z31;
int i89;
TLRPC$Photo tLRPC$Photo2;
Object obj3;
int i90;
TLRPC$ChatInvite tLRPC$ChatInvite;
TLObject tLObject2;
TLRPC$Chat tLRPC$Chat;
int i91;
String string5;
CharSequence charSequence6;
int i92;
MessageObject messageObject17;
int max2;
CharSequence charSequence7;
int i93;
boolean z32;
TLRPC$Photo tLRPC$Photo3;
int i94;
int i95;
int i96;
boolean z33;
int lineCount;
int i97;
CharSequence charSequence8;
int i98;
int width;
int i99;
boolean z34;
int i100;
boolean z35;
String str7;
int i101;
int dp16;
boolean z36;
CharSequence charSequence9;
int i102;
int i103;
int i104;
boolean z37;
WebFile webFile2;
int i105;
int i106;
String str8;
TLRPC$Photo tLRPC$Photo4;
TL_stories$StoryItem tL_stories$StoryItem4;
TLRPC$MessageMedia tLRPC$MessageMedia;
TLRPC$Photo tLRPC$Photo5;
int i107;
boolean z38;
int i108;
int i109;
int i110;
int i111;
int max3;
TLRPC$PhotoSize tLRPC$PhotoSize7;
int i112;
int i113;
int i114;
boolean z39;
int i115;
boolean z40;
long j2;
TLRPC$User user2;
String str9;
int i116;
int i117;
int i118;
boolean z41;
boolean canDownloadMedia;
int i119;
int i120;
int i121;
int i122;
int i123;
int i124;
int i125;
int i126;
int minTabletSide9;
int i127;
boolean z42;
String upperCase;
int i128;
float f11;
TLRPC$PhotoSize tLRPC$PhotoSize8;
boolean z43;
BitmapDrawable bitmapDrawable2;
boolean z44;
WebFile webFile3;
int i129;
CharSequence charSequence10;
int i130;
TL_stories$StoryItem tL_stories$StoryItem5;
TLRPC$User tLRPC$User;
int dp17;
CharSequence createExpiredStoryString;
String str10;
TLRPC$Document tLRPC$Document3;
TLRPC$Photo tLRPC$Photo6;
TLRPC$Document tLRPC$Document4;
int i131;
boolean z45;
int i132;
TLRPC$MessageMedia tLRPC$MessageMedia2;
TLRPC$Document tLRPC$Document5;
TLRPC$MessageMedia tLRPC$MessageMedia3;
TLRPC$MessageMedia tLRPC$MessageMedia4;
int i133;
int i134;
int i135;
String str11;
TLRPC$Photo tLRPC$Photo7;
TLRPC$MessageMedia media;
int minTabletSide10;
int dp18;
boolean z46;
int measuredWidth;
int size;
int minTabletSide11;
int dp19;
TLRPC$Peer tLRPC$Peer;
int repliesCount;
boolean z47;
String string6;
String str12;
int i136;
boolean z48;
AnimatedNumberLayout animatedNumberLayout;
boolean z49;
AnimatedNumberLayout animatedNumberLayout2;
String formatPluralString;
boolean z50;
TLRPC$User user3;
boolean z51;
TLRPC$Chat tLRPC$Chat2;
int i137;
int i138;
ArrayList<TLRPC$Peer> arrayList5;
ArrayList<MessageObject.TextLayoutBlock> arrayList6;
MessageObject.GroupedMessagePosition groupedMessagePosition10;
int i139;
Drawable[] drawableArr;
TLRPC$Message tLRPC$Message;
MessageObject.GroupedMessagePosition groupedMessagePosition11;
TLRPC$Message tLRPC$Message2;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader;
ChatMessageCellDelegate chatMessageCellDelegate;
MessageObject.GroupedMessagePosition groupedMessagePosition12;
MessageObject.GroupedMessagePosition groupedMessagePosition13;
?? r73;
TranscribeButton transcribeButton;
boolean z52;
boolean z53;
boolean z54;
ChatMessageCellDelegate chatMessageCellDelegate2;
MessageObject messageObject18;
int i140;
int i141;
boolean z55;
boolean z56;
TLRPC$Message tLRPC$Message3;
ArrayList<TLRPC$TL_pollAnswerVoters> arrayList7;
TLRPC$Poll tLRPC$Poll;
int i142;
boolean z57;
TLRPC$Poll tLRPC$Poll2;
TLRPC$TL_messageMediaPoll tLRPC$TL_messageMediaPoll;
TLRPC$PollResults tLRPC$PollResults;
int size2;
int i143;
TLRPC$TL_pollAnswerVoters tLRPC$TL_pollAnswerVoters;
int i144;
String str13;
MessageObject.GroupedMessagePosition groupedMessagePosition14;
float[] fArr;
MessageObject messageObject19;
MessageObject messageObject20 = messageObject;
if (messageObject.checkLayout() || (this.currentPosition != null && this.lastHeight != AndroidUtilities.displaySize.y)) {
this.currentMessageObject = null;
}
messageObject20.isOutOwnerCached = null;
boolean z58 = 1;
z58 = 1;
z58 = 1;
boolean z59 = this.lastWidth != getParentWidth();
this.lastHeight = AndroidUtilities.displaySize.y;
this.lastWidth = getParentWidth();
this.isRoundVideo = messageObject.isRoundVideo();
this.mediaSpoilerRevealProgress = 0.0f;
TLRPC$Message tLRPC$Message4 = !messageObject.hasValidReplyMessageObject() ? null : messageObject20.replyMessageObject.messageOwner;
MessageObject messageObject21 = this.currentMessageObject;
boolean z60 = messageObject21 == null || messageObject21.getId() != messageObject.getId();
if (this.currentMessageObject == messageObject20 && !messageObject20.forceUpdate) {
if (this.isRoundVideo) {
}
z3 = false;
MessageObject messageObject22 = this.currentMessageObject;
boolean z61 = (messageObject22 != null && messageObject22.getId() == messageObject.getId() && this.lastSendState == 3 && messageObject.isSent()) || !((this.currentMessageObject != messageObject20 || (!isUserDataChanged() && !this.photoNotSet)) && this.lastPostAuthor == messageObject20.messageOwner.post_author && this.wasPinned == this.isPinned && tLRPC$Message4 == this.lastReplyMessage && messageObject20.translated == this.lastTranslated);
z4 = groupedMessages != this.currentMessagesGroup;
if (!z60 && (messageObject19 = this.currentMessageObject) != null) {
messageObject20.copyStableParams(messageObject19);
}
this.accessibilityText = null;
c = 4;
z5 = (this.drawCommentButton || this.useTranscribeButton || (this.drawSideButton == 3 && (((!this.hasDiscussion || !messageObject20.isLinkedToChat(this.linkedChatId)) && !this.isRepliesChat) || ((groupedMessagePosition14 = this.currentPosition) != null && (((fArr = groupedMessagePosition14.siblingHeights) != null || (groupedMessagePosition14.flags & 8) == 0) && (fArr == null || (groupedMessagePosition14.flags & 4) != 0)))))) ? true : z61;
if (!z3 && messageObject.isDice()) {
setCurrentDiceValue(this.isUpdating);
}
if (!z3 && messageObject.isPoll()) {
if (MessageObject.getMedia(messageObject20.messageOwner) instanceof TLRPC$TL_messageMediaPoll) {
i142 = 0;
tLRPC$Poll = null;
arrayList7 = null;
} else {
TLRPC$TL_messageMediaPoll tLRPC$TL_messageMediaPoll2 = (TLRPC$TL_messageMediaPoll) MessageObject.getMedia(messageObject20.messageOwner);
TLRPC$PollResults tLRPC$PollResults2 = tLRPC$TL_messageMediaPoll2.results;
arrayList7 = tLRPC$PollResults2.results;
tLRPC$Poll = tLRPC$TL_messageMediaPoll2.poll;
i142 = tLRPC$PollResults2.total_voters;
}
z57 = (arrayList7 == null || this.lastPollResults == null || i142 == this.lastPollResultsVoters) ? false : true;
if (!z57 && arrayList7 != this.lastPollResults) {
z57 = true;
}
tLRPC$Poll2 = this.lastPoll;
z6 = z57;
if (tLRPC$Poll2 != tLRPC$Poll) {
z6 = z57;
if (tLRPC$Poll2.closed != tLRPC$Poll.closed) {
if (!this.pollVoted) {
this.pollVoteInProgress = true;
this.vibrateOnPollVote = false;
}
z6 = true;
}
}
this.animatePollAvatars = false;
if (z6 && this.attachedToWindow) {
this.pollAnimationProgressTime = 0.0f;
if (this.pollVoted && !messageObject.isVoted()) {
this.pollUnvoteInProgress = true;
}
int i145 = this.lastPollResultsVoters;
this.animatePollAvatars = i145 == 0 || (i145 != 0 && i142 == 0);
}
if (!z60 && tLRPC$Poll != null && this.lastPoll.quiz && tLRPC$Poll.quiz && this.currentMessageObject != null && !this.pollVoted && messageObject.isVoted() && (tLRPC$PollResults = (tLRPC$TL_messageMediaPoll = (TLRPC$TL_messageMediaPoll) MessageObject.getMedia(messageObject20.messageOwner)).results) != null && !tLRPC$PollResults.results.isEmpty()) {
size2 = tLRPC$TL_messageMediaPoll.results.results.size();
i143 = 0;
while (true) {
if (i143 < size2) {
tLRPC$TL_pollAnswerVoters = null;
break;
}
tLRPC$TL_pollAnswerVoters = tLRPC$TL_messageMediaPoll.results.results.get(i143);
if (tLRPC$TL_pollAnswerVoters.chosen) {
break;
} else {
i143++;
}
}
if (tLRPC$TL_pollAnswerVoters != null) {
int i146 = i143 + 500;
if (tLRPC$TL_pollAnswerVoters.correct) {
i144 = org.telegram.messenger.R.string.AccDescrQuizCorrectAnswer;
str13 = "AccDescrQuizCorrectAnswer";
} else {
i144 = org.telegram.messenger.R.string.AccDescrQuizIncorrectAnswer;
str13 = "AccDescrQuizIncorrectAnswer";
}
sendAccessibilityEventForVirtualView(i146, 4, LocaleController.getString(str13, i144));
}
}
} else {
z6 = false;
}
if (!z4 && groupedMessages != null) {
z4 = (groupedMessages.messages.size() > 1 ? null : this.currentMessagesGroup.positions.get(this.currentMessageObject)) == this.currentPosition;
}
j = 0;
i = -1;
i2 = 2;
if (z3 || z5 || z4 || z6 || ((z59 && messageObject.isPoll()) || isPhotoDataChanged(messageObject) || this.pinnedBottom != z || this.pinnedTop != z2)) {
this.wasPinned = this.isPinned;
this.pinnedBottom = z;
this.pinnedTop = z2;
this.currentMessageObject = messageObject20;
this.currentMessagesGroup = groupedMessages;
this.lastTime = -2.0d;
this.lastPostAuthor = messageObject20.messageOwner.post_author;
if (!z60 || z4) {
this.isHighlightedAnimated = false;
this.wasTranscriptionOpen = false;
if (this.highlightedQuote) {
resetUrlPaths();
}
this.highlightedQuote = false;
}
this.widthBeforeNewTimeLine = -1;
groupedMessages2 = this.currentMessagesGroup;
if (groupedMessages2 != null && groupedMessages2.posArray.size() > 1) {
groupedMessagePosition = this.currentMessagesGroup.positions.get(this.currentMessageObject);
this.currentPosition = groupedMessagePosition;
if (groupedMessagePosition == null) {
this.currentMessagesGroup = null;
}
} else {
this.currentMessagesGroup = null;
this.currentPosition = null;
}
groupedMessages3 = this.currentMessagesGroup;
if (groupedMessages3 == null || groupedMessages3.isDocuments) {
this.drawPinnedTop = this.pinnedTop;
this.drawPinnedBottom = this.pinnedBottom;
} else {
this.drawPinnedTop = this.pinnedTop && ((groupedMessagePosition13 = this.currentPosition) == null || (groupedMessagePosition13.flags & 4) != 0);
this.drawPinnedBottom = this.pinnedBottom && ((groupedMessagePosition12 = this.currentPosition) == null || (groupedMessagePosition12.flags & 8) != 0);
}
boolean z62 = this.isPlayingRound;
this.isPlayingRound = (!this.isRoundVideo || !MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || (chatMessageCellDelegate = this.delegate) == null || chatMessageCellDelegate.keyboardIsOpened() || this.delegate.isLandscape()) ? false : true;
this.photoImage.setCrossfadeWithOldImage(false);
this.photoImage.setCrossfadeDuration(ImageReceiver.DEFAULT_CROSSFADE_DURATION);
this.photoImage.setCrossfadeByScale(0.0f);
this.photoImage.setGradientBitmap(null);
this.photoImage.clearDecorators();
this.photoImage.setInvalidateAll(false);
this.linkPreviewY = 0;
this.lastTranslated = messageObject20.translated;
TLRPC$Message tLRPC$Message5 = messageObject20.messageOwner;
this.lastSendState = tLRPC$Message5.send_state;
this.lastDeleteDate = tLRPC$Message5.destroyTime;
this.lastViewsCount = tLRPC$Message5.views;
this.lastRepliesCount = getRepliesCount();
if (z60) {
z7 = false;
this.isPressed = false;
this.isCheckPressed = true;
} else {
z7 = false;
}
this.gamePreviewPressed = z7;
this.sideButtonPressed = z7;
this.hasNewLineForTime = z7;
this.flipImage = z7;
this.isThreadPost = this.isThreadChat && (tLRPC$MessageFwdHeader = (tLRPC$Message2 = messageObject20.messageOwner).fwd_from) != null && tLRPC$MessageFwdHeader.channel_post != 0 && tLRPC$Message2.reply_to == null;
this.isAvatarVisible = needDrawAvatar() && ((groupedMessagePosition11 = this.currentPosition) == null || groupedMessagePosition11.edge);
needDrawAvatar = needDrawAvatar();
if (messageObject20.customAvatarDrawable == null && !messageObject20.forceAvatar) {
z8 = needDrawAvatar;
} else {
this.isAvatarVisible = true;
z8 = true;
}
this.wasLayout = false;
this.groupPhotoInvisible = false;
this.animatingDrawVideoImageButton = 0;
this.drawVideoSize = false;
this.canStreamVideo = false;
this.animatingNoSound = 0;
if (!messageObject.isSponsored()) {
r2 = 0;
this.drawSideButton = 4;
} else if (MessagesController.getInstance(this.currentAccount).isChatNoForwards(messageObject.getChatId()) || ((tLRPC$Message = messageObject20.messageOwner) != null && tLRPC$Message.noforwards)) {
r2 = 0;
this.drawSideButton = 0;
} else {
int i147 = (!this.isRepliesChat && checkNeedDrawShareButton(messageObject)) ? 1 : 0;
this.drawSideButton = i147;
if (this.isPinnedChat || (i147 == 1 && ((messageObject20.messageOwner.fwd_from != null && !messageObject.isOutOwner() && messageObject20.messageOwner.fwd_from.saved_from_peer != null && messageObject.getDialogId() == UserConfig.getInstance(this.currentAccount).getClientUserId()) || messageObject20.isSaved))) {
this.drawSideButton = 2;
}
r2 = 0;
}
this.hasReplyQuote = r2;
this.isReplyQuote = r2;
this.replyNameLayout = null;
this.adminLayout = null;
this.checkOnlyButtonPressed = r2;
this.replyTextLayout = null;
AnimatedEmojiSpan.release((View) this, this.animatedEmojiReplyStack);
this.lastReplyMessage = null;
this.hasEmbed = r2;
this.autoPlayingMedia = r2;
this.replyNameWidth = r2;
this.replyTextWidth = r2;
this.replyTextHeight = r2;
this.viaWidth = r2;
this.viaNameWidth = r2;
this.viaOnly = r2;
this.addedCaptionHeight = r2;
this.currentReplyPhoto = null;
this.currentUser = null;
this.currentChat = null;
this.currentViaBotUser = null;
this.instantViewLayout = null;
this.drawNameLayout = r2;
this.linkPreviewAbove = r2;
this.isSmallImage = r2;
this.lastLoadingSizeTotal = 0L;
if (this.scheduledInvalidate) {
AndroidUtilities.cancelRunOnUIThread(this.invalidateRunnable);
this.scheduledInvalidate = r2;
}
this.links.clear();
this.pressedLink = null;
this.pressedEmoji = null;
this.pressedLinkType = -1;
messageObject20.forceUpdate = r2;
this.drawPhotoImage = r2;
this.drawMediaCheckBox = r2;
this.hasLinkPreview = r2;
this.hasOldCaptionPreview = r2;
this.hasGamePreview = r2;
this.hasInvoicePreview = r2;
this.commentButtonPressed = r2;
this.instantPressed = r2;
this.gradientDrawable = null;
setInstantButtonPressed(r2);
if (!z6 && Build.VERSION.SDK_INT >= 21) {
i139 = 0;
z5 = z5;
while (true) {
drawableArr = this.selectorDrawable;
if (i139 < drawableArr.length) {
break;
}
char c4 = c;
boolean z63 = z5 ? 1 : 0;
boolean z64 = z58 == true ? 1 : 0;
int i148 = i2;
if (drawableArr[i139] != null) {
drawableArr[i139].setVisible(false, false);
this.selectorDrawable[i139].setState(StateSet.NOTHING);
}
i139++;
messageObject20 = messageObject;
i2 = i148;
z58 = z64 ? 1 : 0;
c = c4;
z5 = z63 ? 1 : 0;
i = -1;
j = 0;
}
}
resetContactButtonsPressedState();
this.drawnContactButtonsFlag = 0;
this.drawContact = false;
this.drawContactView = false;
this.drawContactSendMessage = false;
this.drawContactAdd = false;
this.spoilerPressed = null;
this.isSpoilerRevealing = false;
this.linkPreviewPressed = false;
this.buttonPressed = 0;
this.additionalTimeOffsetY = 0;
this.miniButtonPressed = 0;
this.pressedBotButton = i;
this.pressedVoteButton = i;
this.pollHintPressed = false;
this.psaHintPressed = false;
this.linkPreviewHeight = 0;
this.mediaOffsetY = 0;
this.documentAttachType = 0;
this.documentAttach = null;
this.descriptionLayout = null;
this.titleLayout = null;
this.videoInfoLayout = null;
this.photosCountLayout = null;
this.siteNameLayout = null;
this.authorLayout = null;
this.captionFullWidth = 0;
this.captionLayout = null;
this.captionWidth = 0;
this.captionHeight = 0;
this.captionOffsetX = 0;
this.currentCaption = null;
this.captionLayout = null;
this.docTitleLayout = null;
this.drawImageButton = false;
this.drawVideoImageButton = false;
this.currentPhotoLocation = null;
this.currentPhotoThumbLocation = null;
this.currentPhotoObject = null;
this.photoParentObject = null;
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = null;
if (!z3 || z60 || z5) {
this.currentPhotoFilter = null;
}
this.buttonState = i;
this.miniButtonState = i;
this.hasMiniProgress = 0;
if (this.addedForTest && this.currentUrl != null && this.currentWebFile != null) {
ImageLoader.getInstance().removeTestWebFile(this.currentUrl);
}
this.addedForTest = false;
this.photoNotSet = false;
this.drawBackground = z58;
this.drawName = false;
this.useSeekBarWaveform = false;
this.useTranscribeButton = false;
this.drawInstantView = false;
this.drawInstantViewType = 0;
this.instantViewButtonText = null;
this.drawForwardedName = false;
this.drawCommentButton = false;
this.photoImage.setSideClip(0.0f);
this.photoImage.setAspectFit(false);
this.gradientShader = null;
this.motionBackgroundDrawable = null;
this.imageBackgroundColor = 0;
this.imageBackgroundGradientColor1 = 0;
this.imageBackgroundGradientColor2 = 0;
this.imageBackgroundIntensity = 0.0f;
this.imageBackgroundGradientColor3 = 0;
this.imageBackgroundGradientRotation = 45;
this.imageBackgroundSideColor = 0;
this.mediaBackground = false;
expiredStoryView = this.expiredStoryView;
if (expiredStoryView != null) {
expiredStoryView.visible = false;
}
this.photoImage.animatedFileDrawableRepeatMaxCount = 0;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader2 = messageObject20.messageOwner.fwd_from;
z9 = (tLRPC$MessageFwdHeader2 == null || TextUtils.isEmpty(tLRPC$MessageFwdHeader2.psa_type)) ? false : z58 ? 1 : 0;
this.hasPsaHint = z9;
if (z9) {
createSelectorDrawable(0);
}
this.photoImage.setAlpha(1.0f);
if ((!z3 || z5) && !this.pollUnvoteInProgress) {
this.pollButtons.clear();
}
this.availableTimeWidth = 0;
this.photoImage.setForceLoading(false);
this.photoImage.setNeedsQualityThumb(false);
this.photoImage.setShouldGenerateQualityThumb(false);
this.photoImage.setAllowDecodeSingleFrame(false);
this.photoImage.setColorFilter(null);
this.photoImage.setMediaStartEndTime(-1L, -1L);
if (!z60 || messageObject20.reactionsChanged || z62 != this.isPlayingRound) {
messageObject20.reactionsChanged = false;
if (messageObject.shouldDrawReactions() && !messageObject.isExpiredStory() && ((groupedMessagePosition10 = this.currentPosition) == null || (groupedMessagePosition10.flags & 8) != 0)) {
boolean z65 = !messageObject.shouldDrawReactionsInLayout() ? false : z58 ? 1 : 0;
if (this.currentPosition == null) {
this.reactionsLayoutInBubble.setMessage(groupedMessages.findPrimaryMessageObject(), messageObject.shouldDrawReactionsInLayout() ? false : z58 ? 1 : 0, this.resourcesProvider);
} else {
this.reactionsLayoutInBubble.setMessage(messageObject20, z65, this.resourcesProvider);
}
} else {
this.reactionsLayoutInBubble.setMessage(null, false, this.resourcesProvider);
}
}
if (z3) {
this.firstVisibleBlockNum = 0;
this.lastVisibleBlockNum = 0;
MessageObject messageObject23 = this.currentMessageObject;
if (messageObject23 != null && (arrayList6 = messageObject23.textLayoutBlocks) != null && arrayList6.size() > z58) {
this.needNewVisiblePart = z58;
}
}
groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null && groupedMessages4.messages.size() > 0) {
isLinkedToChat = this.currentMessagesGroup.messages.get(0).isLinkedToChat(this.linkedChatId);
} else {
isLinkedToChat = messageObject20.isLinkedToChat(this.linkedChatId);
}
if ((this.hasDiscussion && isLinkedToChat) || (this.isRepliesChat && !messageObject.isOutOwner())) {
MessageObject.GroupedMessagePosition groupedMessagePosition15 = this.currentPosition;
staticLayout = (groupedMessagePosition15 != null && (groupedMessagePosition15.flags & 8) == 0) ? null : null;
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground() && !messageObject.isAnimatedEmoji()) {
this.drawCommentButton = z58;
if (this.commentProgress == null) {
this.commentProgress = new InfiniteProgress(AndroidUtilities.dp(7.0f));
}
if (!this.isRepliesChat) {
z47 = z5 ? 1 : 0;
string6 = LocaleController.getString("ViewInChat", org.telegram.messenger.R.string.ViewInChat);
} else {
if (LocaleController.isRTL) {
formatPluralString = repliesCount != 0 ? LocaleController.formatPluralString("CommentsCount", repliesCount, new Object[0]) : LocaleController.getString("LeaveAComment", org.telegram.messenger.R.string.LeaveAComment);
} else {
formatPluralString = repliesCount != 0 ? LocaleController.getPluralString("CommentsNoNumber", repliesCount) : LocaleController.getString("LeaveAComment", org.telegram.messenger.R.string.LeaveAComment);
}
string6 = formatPluralString;
ArrayList<TLRPC$Peer> recentRepliers = getRecentRepliers();
if (repliesCount != 0 && recentRepliers != null && !recentRepliers.isEmpty()) {
createCommentUI();
int size3 = recentRepliers.size();
final int i149 = 0;
i136 = 0;
boolean z66 = z5;
while (true) {
ImageReceiver[] imageReceiverArr = this.commentAvatarImages;
if (i149 >= imageReceiverArr.length) {
break;
}
if (i149 >= size3) {
if (size3 != 0) {
imageReceiverArr[i149].setImageBitmap((Drawable) null);
this.commentAvatarImagesVisible[i149] = false;
}
i137 = i149;
i138 = size3;
arrayList5 = recentRepliers;
z51 = z66;
} else {
imageReceiverArr[i149].setImageCoords(0.0f, 0.0f, AndroidUtilities.dp(24.0f), AndroidUtilities.dp(24.0f));
final long peerId = MessageObject.getPeerId(recentRepliers.get(i149));
if (DialogObject.isUserDialog(peerId)) {
z50 = z66;
user3 = MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(peerId));
} else if (DialogObject.isChatDialog(peerId)) {
z51 = z66;
tLRPC$Chat2 = MessagesController.getInstance(this.currentAccount).getChat(Long.valueOf(-peerId));
user3 = null;
final TLRPC$User tLRPC$User2 = user3;
i137 = i149;
i138 = size3;
final TLRPC$Chat tLRPC$Chat3 = tLRPC$Chat2;
arrayList5 = recentRepliers;
post(new Runnable() {
@Override
public final void run() {
ChatMessageCell.this.lambda$setMessageContent$7(tLRPC$User2, i149, tLRPC$Chat3, peerId);
}
});
this.commentAvatarImagesVisible[i137] = z58;
i136 += i137 == 0 ? 17 : i2;
} else {
z50 = z66;
user3 = null;
}
tLRPC$Chat2 = null;
z51 = z50;
final TLRPC$User tLRPC$User22 = user3;
i137 = i149;
i138 = size3;
final TLRPC$Chat tLRPC$Chat32 = tLRPC$Chat2;
arrayList5 = recentRepliers;
post(new Runnable() {
@Override
public final void run() {
ChatMessageCell.this.lambda$setMessageContent$7(tLRPC$User22, i149, tLRPC$Chat32, peerId);
}
});
this.commentAvatarImagesVisible[i137] = z58;
i136 += i137 == 0 ? 17 : i2;
}
i149 = i137 + 1;
recentRepliers = arrayList5;
z66 = z51;
size3 = i138;
}
z48 = z66;
str12 = string6;
int ceil2 = (int) Math.ceil(Theme.chat_commentTextPaint.measureText(str12));
this.totalCommentWidth = ceil2;
this.commentWidth = ceil2;
this.commentLayout = new StaticLayout(str12, Theme.chat_commentTextPaint, this.commentWidth + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
if (repliesCount != 0 && !LocaleController.isRTL) {
this.drawCommentNumber = z58;
animatedNumberLayout = this.commentNumberLayout;
if (animatedNumberLayout != null) {
AnimatedNumberLayout animatedNumberLayout3 = new AnimatedNumberLayout(this, Theme.chat_commentTextPaint);
this.commentNumberLayout = animatedNumberLayout3;
z49 = false;
animatedNumberLayout3.setNumber(repliesCount, false);
} else {
animatedNumberLayout.setNumber(repliesCount, messageObject20.animateComments);
z49 = false;
}
messageObject20.animateComments = z49;
int width2 = this.commentNumberLayout.getWidth();
this.commentNumberWidth = width2;
this.totalCommentWidth += width2 + AndroidUtilities.dp(4.0f);
} else {
this.drawCommentNumber = false;
animatedNumberLayout2 = this.commentNumberLayout;
if (animatedNumberLayout2 != null) {
animatedNumberLayout2.setNumber(z58 ? 1 : 0, false);
}
}
this.totalCommentWidth += AndroidUtilities.dp(i136 + 70);
z10 = z48;
int i150 = 20;
if (messageObject20.type == 27) {
i3 = 20;
boolean z67 = z58 ? 1 : 0;
messageObject2 = messageObject20;
i4 = 3;
i5 = 4;
z11 = false;
f = 50.0f;
f2 = 1.0f;
this.drawBackground = z67;
this.drawForwardedName = false;
this.hasReplyQuote = false;
this.isReplyQuote = false;
this.replyNameLayout = null;
this.replyTextLayout = null;
StaticLayout[] staticLayoutArr2 = this.forwardedNameLayout;
staticLayoutArr2[0] = null;
staticLayoutArr2[z67 ? 1 : 0] = null;
this.drawName = false;
if (this.channelRecommendationsCell == null) {
this.channelRecommendationsCell = new ChannelRecommendationsCell(this);
}
this.channelRecommendationsCell.setMessageObject(messageObject2);
} else if (messageObject.isExpiredStory()) {
i3 = 20;
messageObject2 = messageObject20;
i4 = 3;
i5 = 4;
z11 = false;
f = 50.0f;
f2 = 1.0f;
if (!z60) {
requestLayout();
}
this.drawBackground = true;
if (this.expiredStoryView == null) {
this.expiredStoryView = new ExpiredStoryView();
}
ExpiredStoryView expiredStoryView2 = this.expiredStoryView;
expiredStoryView2.visible = true;
expiredStoryView2.measure(this);
this.totalHeight = this.expiredStoryView.height + AndroidUtilities.dp(8.0f);
this.backgroundWidth = this.expiredStoryView.width;
measureTime(this.currentMessageObject);
this.backgroundWidth += this.timeWidth + AndroidUtilities.dp(12.0f);
this.drawForwardedName = false;
this.hasReplyQuote = false;
this.isReplyQuote = false;
this.replyNameLayout = null;
this.replyTextLayout = null;
StaticLayout[] staticLayoutArr3 = this.forwardedNameLayout;
staticLayoutArr3[0] = null;
staticLayoutArr3[1] = null;
this.drawName = false;
} else {
int i151 = messageObject20.type;
if (i151 == 0 || i151 == 24 || messageObject.isGiveawayOrGiveawayResults() || messageObject.isSponsored()) {
long j3 = j;
MessageObject messageObject24 = messageObject20;
this.drawForwardedName = !this.isRepliesChat;
if (z8) {
if (AndroidUtilities.isTablet()) {
minTabletSide8 = AndroidUtilities.getMinTabletSide();
dp15 = AndroidUtilities.dp(122.0f);
} else {
minTabletSide8 = Math.min(getParentWidth(), AndroidUtilities.displaySize.y);
dp15 = AndroidUtilities.dp(122.0f);
}
i83 = minTabletSide8 - dp15;
this.drawName = true;
} else {
if (AndroidUtilities.isTablet()) {
minTabletSide11 = AndroidUtilities.getMinTabletSide();
dp19 = AndroidUtilities.dp(80.0f);
} else {
minTabletSide11 = Math.min(getParentWidth(), AndroidUtilities.displaySize.y);
dp19 = AndroidUtilities.dp(80.0f);
}
i83 = minTabletSide11 - dp19;
this.drawName = this.isPinnedChat || (this.isSavedChat && !messageObject.isOutOwner() && (messageObject.getSavedDialogId() < j3 || messageObject.getSavedDialogId() == UserObject.ANONYMOUS)) || (!((tLRPC$Peer = messageObject24.messageOwner.peer_id) == null || tLRPC$Peer.channel_id == j3 || (messageObject.isOutOwner() && !messageObject.isSupergroup())) || (messageObject.isImportedForward() && messageObject24.messageOwner.fwd_from.from_id == null));
}
int i152 = i83;
this.availableTimeWidth = i152;
if (messageObject.isRoundVideo()) {
this.availableTimeWidth = (int) (this.availableTimeWidth - (Math.ceil(Theme.chat_audioTimePaint.measureText("00:00")) + (!messageObject.isOutOwner() ? AndroidUtilities.dp(64.0f) : 0)));
}
measureTime(messageObject);
int dp20 = this.timeWidth + AndroidUtilities.dp(6.0f);
if (messageObject.isOutOwner()) {
dp20 += AndroidUtilities.dp(20.5f);
}
int extraTimeX = getExtraTimeX() + dp20;
this.hasGamePreview = (MessageObject.getMedia(messageObject24.messageOwner) instanceof TLRPC$TL_messageMediaGame) && (MessageObject.getMedia(messageObject24.messageOwner).game instanceof TLRPC$TL_game);
this.hasInvoicePreview = MessageObject.getMedia(messageObject24.messageOwner) instanceof TLRPC$TL_messageMediaInvoice;
boolean z68 = !messageObject24.isRestrictedMessage && (MessageObject.getMedia(messageObject24.messageOwner) instanceof TLRPC$TL_messageMediaWebPage) && (MessageObject.getMedia(messageObject24.messageOwner).webpage instanceof TLRPC$TL_webPage);
this.hasLinkPreview = z68;
TLRPC$WebPage tLRPC$WebPage = !z68 ? null : MessageObject.getMedia(messageObject24.messageOwner).webpage;
if (messageObject.isStoryMention()) {
this.hasLinkPreview = true;
tLRPC$WebPage = messageObject.getStoryMentionWebpage();
}
boolean z69 = this.hasLinkPreview;
this.drawInstantView = z69 && tLRPC$WebPage.cached_page != null;
String str14 = !z69 ? null : tLRPC$WebPage.site_name;
this.hasEmbed = (!z69 || TextUtils.isEmpty(tLRPC$WebPage.embed_url) || messageObject.isGif() || "instagram".equalsIgnoreCase(str14)) ? false : true;
String str15 = tLRPC$WebPage == null ? null : tLRPC$WebPage.type;
if (messageObject.isGiveawayOrGiveawayResults()) {
this.hasLinkPreview = true;
}
if (this.drawInstantView) {
if (str14 != null) {
String lowerCase = str14.toLowerCase();
if ((lowerCase.equals("instagram") || lowerCase.equals("twitter") || "telegram_album".equals(str15)) && (tLRPC$WebPage.cached_page instanceof TLRPC$TL_page) && ((tLRPC$WebPage.photo instanceof TLRPC$TL_photo) || MessageObject.isVideoDocument(tLRPC$WebPage.document))) {
this.drawInstantView = false;
ArrayList<TLRPC$PageBlock> arrayList8 = MessageObject.getMedia(messageObject24.messageOwner).webpage.cached_page.blocks;
int i153 = 1;
for (int i154 = 0; i154 < arrayList8.size(); i154++) {
TLRPC$PageBlock tLRPC$PageBlock = arrayList8.get(i154);
if (tLRPC$PageBlock instanceof TLRPC$TL_pageBlockSlideshow) {
size = ((TLRPC$TL_pageBlockSlideshow) tLRPC$PageBlock).items.size();
} else if (tLRPC$PageBlock instanceof TLRPC$TL_pageBlockCollage) {
size = ((TLRPC$TL_pageBlockCollage) tLRPC$PageBlock).items.size();
}
i153 = size;
}
String formatString = LocaleController.formatString("Of", org.telegram.messenger.R.string.Of, 1, Integer.valueOf(i153));
this.photosCountWidth = (int) Math.ceil(Theme.chat_durationPaint.measureText(formatString));
this.photosCountLayout = new StaticLayout(formatString, Theme.chat_durationPaint, this.photosCountWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
tLRPC$ThemeSettings = null;
tL_stories$StoryItem = null;
tLRPC$Document = null;
z30 = true;
if (messageObject24.isRepostPreview) {
this.drawInstantView = false;
}
this.backgroundWidth = i152;
if ((this.hasLinkPreview || this.linkPreviewAbove) && !this.hasGamePreview && !this.hasInvoicePreview) {
i84 = messageObject24.lastLineWidth;
if (i152 - i84 >= extraTimeX) {
int i155 = i152 - i84;
if (i155 >= 0 && i155 <= extraTimeX) {
this.backgroundWidth = ((i152 + extraTimeX) - i155) + AndroidUtilities.dp(31.0f);
} else {
this.backgroundWidth = Math.max(i152, i84 + extraTimeX) + AndroidUtilities.dp(31.0f);
}
this.availableTimeWidth = this.backgroundWidth - AndroidUtilities.dp(31.0f);
if (messageObject.isRoundVideo()) {
double d = this.availableTimeWidth;
double ceil3 = Math.ceil(Theme.chat_audioTimePaint.measureText("00:00"));
if (messageObject.isOutOwner()) {
tL_stories$StoryItem2 = tL_stories$StoryItem;
i85 = 0;
} else {
i85 = AndroidUtilities.dp(64.0f);
tL_stories$StoryItem2 = tL_stories$StoryItem;
}
this.availableTimeWidth = (int) (d - (ceil3 + i85));
} else {
tL_stories$StoryItem2 = tL_stories$StoryItem;
}
setMessageObjectInternal(messageObject);
this.giveawayMessageCell.setMessageContent(messageObject24, getParentWidth(), this.forwardedNameWidth);
this.giveawayResultsMessageCell.setMessageContent(messageObject24, getParentWidth(), this.forwardedNameWidth);
if (!messageObject.isSponsored()) {
this.backgroundWidth = messageObject24.textWidth + (getExtraTextX() * 2) + ((this.hasGamePreview || this.hasInvoicePreview) ? AndroidUtilities.dp(10.0f) : 0);
} else if (AndroidUtilities.isTablet()) {
this.backgroundWidth = Math.min(AndroidUtilities.getMinTabletSide() - AndroidUtilities.dp(50.0f), AndroidUtilities.dp(270.0f));
} else {
this.backgroundWidth = Math.min(getParentWidth() - AndroidUtilities.dp(50.0f), AndroidUtilities.dp(270.0f));
}
if (messageObject.isSponsored()) {
this.totalHeight = AndroidUtilities.dp(22.5f);
} else {
this.totalHeight = messageObject24.textHeight + AndroidUtilities.dp(19.5f) + this.namesOffset;
}
if (!this.reactionsLayoutInBubble.isSmall) {
if (messageObject.isGiveaway()) {
measuredWidth = this.giveawayMessageCell.getMeasuredWidth();
} else {
measuredWidth = !messageObject.isGiveawayResults() ? i152 : this.giveawayResultsMessageCell.getMeasuredWidth();
}
this.reactionsLayoutInBubble.measure(measuredWidth, 3);
ReactionsLayoutInBubble reactionsLayoutInBubble6 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble6.isEmpty) {
reactionsLayoutInBubble6.totalHeight = reactionsLayoutInBubble6.height + AndroidUtilities.dp(8.0f);
ReactionsLayoutInBubble reactionsLayoutInBubble7 = this.reactionsLayoutInBubble;
int i156 = reactionsLayoutInBubble7.width;
if (i156 > this.backgroundWidth) {
this.backgroundWidth = i156;
}
this.totalHeight += reactionsLayoutInBubble7.totalHeight;
}
}
if (this.drawPinnedTop) {
this.namesOffset -= AndroidUtilities.dp(1.0f);
}
messageObject15 = this.currentMessageObject;
if (messageObject15 != null && messageObject15.hasCodeAtTop && this.namesOffset > 0) {
this.totalHeight += AndroidUtilities.dp(5.0f);
}
int max4 = Math.max(Math.max(Math.max(this.backgroundWidth, this.nameWidth), this.forwardedNameWidth), this.replyNameWidth);
messageTopicButton = this.topicButton;
if (messageTopicButton != null) {
max4 = Math.max(max4, messageTopicButton.width());
}
max = Math.max(max4, this.replyTextWidth);
if (this.commentLayout != null && this.drawSideButton != 3) {
max = Math.max(max, this.totalCommentWidth);
}
if (this.hasLinkPreview || this.hasGamePreview || this.hasInvoicePreview) {
messageObject16 = this.currentMessageObject;
if (messageObject16.isRepostPreview) {
maxMessageTextWidth = messageObject16.getMaxMessageTextWidth();
} else {
if (AndroidUtilities.isTablet()) {
minTabletSide10 = AndroidUtilities.getMinTabletSide();
dp18 = AndroidUtilities.dp(80 + (!z8 ? 0 : 52));
} else {
minTabletSide10 = getParentWidth();
dp18 = AndroidUtilities.dp(80 + (!z8 ? 0 : 52));
}
maxMessageTextWidth = minTabletSide10 - dp18;
}
if (this.drawSideButton != 0) {
maxMessageTextWidth -= AndroidUtilities.dp(20.0f);
}
int dp21 = AndroidUtilities.dp(48.0f);
int dp22 = AndroidUtilities.dp(10.0f);
if (messageObject.isSponsored()) {
i86 = maxMessageTextWidth;
TL_stories$StoryItem tL_stories$StoryItem6 = tL_stories$StoryItem2;
String string7 = LocaleController.getString(!messageObject24.sponsoredRecommended ? org.telegram.messenger.R.string.SponsoredMessage2 : org.telegram.messenger.R.string.SponsoredMessage2Recommended);
String str16 = messageObject24.customName;
if (str16 == null) {
str16 = getAuthorName();
}
CharSequence charSequence11 = messageObject24.messageText;
String charSequence12 = charSequence11 == null ? null : charSequence11.toString();
TLRPC$BotApp tLRPC$BotApp = messageObject24.sponsoredBotApp;
if (tLRPC$BotApp != null) {
str3 = str16;
charSequence3 = charSequence11;
tLRPC$Photo = tLRPC$BotApp.photo;
} else {
TLRPC$TL_sponsoredWebPage tLRPC$TL_sponsoredWebPage = messageObject24.sponsoredWebPage;
if (tLRPC$TL_sponsoredWebPage != null) {
str3 = str16;
charSequence3 = charSequence11;
tLRPC$Photo = tLRPC$TL_sponsoredWebPage.photo;
} else {
TLRPC$ChatInvite tLRPC$ChatInvite2 = messageObject24.sponsoredChatInvite;
if (tLRPC$ChatInvite2 != null && (tLRPC$Chat = tLRPC$ChatInvite2.chat) != null) {
str3 = str16;
charSequence3 = charSequence11;
this.currentPhotoLocation = ImageLocation.getForChat(tLRPC$Chat, 0);
this.currentPhotoThumbLocation = ImageLocation.getForChat(messageObject24.sponsoredChatInvite.chat, 1);
tLObject2 = tLRPC$Chat;
} else if (messageObject24.sponsoredShowPeerPhoto) {
TLObject fromPeerObject = messageObject.getFromPeerObject();
if (fromPeerObject instanceof TLRPC$User) {
str3 = str16;
TLRPC$User tLRPC$User3 = (TLRPC$User) fromPeerObject;
charSequence3 = charSequence11;
this.currentPhotoLocation = ImageLocation.getForUser(tLRPC$User3, 0);
this.currentPhotoThumbLocation = ImageLocation.getForUser(tLRPC$User3, 1);
tLObject2 = fromPeerObject;
} else if (fromPeerObject instanceof TLRPC$Chat) {
TLRPC$Chat tLRPC$Chat4 = (TLRPC$Chat) fromPeerObject;
str3 = str16;
this.currentPhotoLocation = ImageLocation.getForChat(tLRPC$Chat4, 0);
this.currentPhotoThumbLocation = ImageLocation.getForChat(tLRPC$Chat4, 1);
charSequence3 = charSequence11;
tLObject2 = fromPeerObject;
} else {
str3 = str16;
charSequence3 = charSequence11;
tLObject2 = fromPeerObject;
}
} else {
str3 = str16;
charSequence3 = charSequence11;
tLRPC$Photo = null;
}
tLRPC$Photo = null;
tLObject = tLObject2;
if (tLRPC$Photo == null && (tLRPC$ChatInvite = messageObject24.sponsoredChatInvite) != null) {
tLRPC$Photo = tLRPC$ChatInvite.photo;
}
this.isSmallImage = (tLRPC$Photo == null && tLObject == null) ? false : true;
this.linkPreviewAbove = false;
str4 = str3;
i87 = i152;
i88 = extraTimeX;
tL_stories$StoryItem3 = tL_stories$StoryItem6;
str5 = charSequence12;
charSequence4 = string7;
str6 = null;
webFile = null;
tLRPC$Document2 = null;
charSequence5 = null;
z31 = true;
i89 = 0;
tLRPC$Photo2 = tLRPC$Photo;
obj3 = tLObject;
i90 = 0;
}
}
tLObject = null;
if (tLRPC$Photo == null) {
tLRPC$Photo = tLRPC$ChatInvite.photo;
}
if (tLRPC$Photo == null) {
this.isSmallImage = (tLRPC$Photo == null && tLObject == null) ? false : true;
this.linkPreviewAbove = false;
str4 = str3;
i87 = i152;
i88 = extraTimeX;
tL_stories$StoryItem3 = tL_stories$StoryItem6;
str5 = charSequence12;
charSequence4 = string7;
str6 = null;
webFile = null;
tLRPC$Document2 = null;
charSequence5 = null;
z31 = true;
i89 = 0;
tLRPC$Photo2 = tLRPC$Photo;
obj3 = tLObject;
i90 = 0;
}
this.isSmallImage = (tLRPC$Photo == null && tLObject == null) ? false : true;
this.linkPreviewAbove = false;
str4 = str3;
i87 = i152;
i88 = extraTimeX;
tL_stories$StoryItem3 = tL_stories$StoryItem6;
str5 = charSequence12;
charSequence4 = string7;
str6 = null;
webFile = null;
tLRPC$Document2 = null;
charSequence5 = null;
z31 = true;
i89 = 0;
tLRPC$Photo2 = tLRPC$Photo;
obj3 = tLObject;
i90 = 0;
} else {
int i157 = this.drawInstantViewType;
if (i157 == 19) {
i86 = maxMessageTextWidth;
this.isSmallImage = false;
this.linkPreviewAbove = false;
i87 = i152;
i88 = extraTimeX;
tL_stories$StoryItem3 = tL_stories$StoryItem2;
charSequence4 = null;
str6 = null;
obj3 = null;
webFile = null;
tLRPC$Document2 = null;
charSequence5 = null;
i90 = 0;
z31 = false;
tLRPC$Photo2 = null;
str4 = null;
charSequence3 = null;
str5 = null;
i89 = 0;
} else if (i157 == 17) {
i86 = maxMessageTextWidth;
if (tL_stories$StoryItem2 != null) {
tL_stories$StoryItem5 = tL_stories$StoryItem2;
tLRPC$User = MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(tL_stories$StoryItem5.dialogId));
} else {
tL_stories$StoryItem5 = tL_stories$StoryItem2;
tLRPC$User = null;
}
if (tL_stories$StoryItem5 instanceof TL_stories$TL_storyItemDeleted) {
dp17 = AndroidUtilities.dp(14.0f) + 0;
createExpiredStoryString = StoriesUtilities.createExpiredStoryString();
} else {
if (tLRPC$User != null) {
createExpiredStoryString = UserObject.getUserName(tLRPC$User);
} else {
createExpiredStoryString = tLRPC$WebPage != null ? tLRPC$WebPage.title : null;
}
dp17 = 0;
}
if (tL_stories$StoryItem5 == null) {
str10 = tLRPC$WebPage != null ? tLRPC$WebPage.description : null;
} else {
str10 = tL_stories$StoryItem5.caption;
}
if (tL_stories$StoryItem5 == null || (tLRPC$MessageMedia4 = tL_stories$StoryItem5.media) == null || (tLRPC$Document3 = tLRPC$MessageMedia4.document) == null) {
tLRPC$Document3 = tLRPC$WebPage != null ? tLRPC$WebPage.document : null;
}
if (tL_stories$StoryItem5 == null || (tLRPC$MessageMedia3 = tL_stories$StoryItem5.media) == null || (tLRPC$Photo6 = tLRPC$MessageMedia3.photo) == null) {
tLRPC$Photo6 = tLRPC$WebPage != null ? tLRPC$WebPage.photo : null;
}
String str17 = tLRPC$WebPage != null ? tLRPC$WebPage.type : null;
if (tL_stories$StoryItem5 == null || (tLRPC$MessageMedia2 = tL_stories$StoryItem5.media) == null || (tLRPC$Document5 = tLRPC$MessageMedia2.document) == null) {
tLRPC$Document4 = tLRPC$Document3;
i131 = dp17;
z45 = false;
i132 = 0;
} else {
tLRPC$Document4 = tLRPC$Document3;
i131 = dp17;
i132 = (int) MessageObject.getDocumentDuration(tLRPC$Document5);
z45 = false;
}
this.isSmallImage = z45;
TLRPC$Message tLRPC$Message6 = this.currentMessageObject.messageOwner;
this.linkPreviewAbove = tLRPC$Message6 != null && tLRPC$Message6.invert_media;
i87 = i152;
i88 = extraTimeX;
tL_stories$StoryItem3 = tL_stories$StoryItem5;
str5 = str10;
i89 = i132;
str6 = str17;
tLRPC$Document2 = tLRPC$Document4;
webFile = null;
charSequence5 = null;
str4 = null;
charSequence3 = null;
i90 = i131;
charSequence4 = createExpiredStoryString;
tLRPC$Photo2 = tLRPC$Photo6;
obj3 = null;
z31 = false;
} else if (this.hasLinkPreview) {
TLRPC$TL_webPage tLRPC$TL_webPage = (TLRPC$TL_webPage) tLRPC$WebPage;
String str18 = tLRPC$TL_webPage.site_name;
if (i157 == 6 || i157 == 7) {
i133 = maxMessageTextWidth;
i134 = 6;
str4 = null;
} else {
str4 = tLRPC$TL_webPage.title;
i133 = maxMessageTextWidth;
i134 = 6;
}
if (i157 == i134 || i157 == 7) {
i135 = 6;
str11 = null;
} else {
str11 = tLRPC$TL_webPage.author;
i135 = 6;
}
str5 = (i157 == i135 || i157 == 7) ? null : tLRPC$TL_webPage.description;
TLRPC$Photo tLRPC$Photo8 = tLRPC$TL_webPage.photo;
TLRPC$Document tLRPC$Document6 = tLRPC$Document;
if (i157 != 7) {
tLRPC$Document6 = tLRPC$TL_webPage.document;
} else if (tLRPC$ThemeSettings != null) {
tLRPC$Document6 = new DocumentObject.ThemeDocument(tLRPC$ThemeSettings);
}
String str19 = tLRPC$TL_webPage.type;
int i158 = tLRPC$TL_webPage.duration;
int max5 = (str18 == null || tLRPC$Photo8 == null || !str18.toString().toLowerCase().equals("instagram")) ? i133 : Math.max(AndroidUtilities.displaySize.y / 3, this.currentMessageObject.textWidth);
boolean z70 = "app".equals(str19) || "profile".equals(str19) || "article".equals(str19) || "telegram_bot".equals(str19) || "telegram_user".equals(str19) || "telegram_channel".equals(str19) || "telegram_megagroup".equals(str19) || "telegram_voicechat".equals(str19) || "telegram_livestream".equals(str19) || "telegram_channel_boost".equals(str19);
if (z30) {
tLRPC$Photo7 = tLRPC$Photo8;
} else {
if (this.drawInstantView) {
int i159 = this.drawInstantViewType;
tLRPC$Photo7 = tLRPC$Photo8;
if (i159 != 1 && i159 != 2 && i159 != 9 && i159 != 11 && i159 != 13 && i159 != 18) {
}
} else {
tLRPC$Photo7 = tLRPC$Photo8;
}
if (tLRPC$Document6 == null && z70) {
z31 = true;
media = MessageObject.getMedia(messageObject24.messageOwner);
if (media != null) {
if (media.force_large_media) {
z31 = false;
}
if (media.force_small_media) {
z31 = true;
}
}
MessageObject messageObject25 = this.currentMessageObject;
TLRPC$Message tLRPC$Message7 = messageObject25.messageOwner;
this.linkPreviewAbove = tLRPC$Message7 != null && tLRPC$Message7.invert_media;
this.isSmallImage = (!z31 || str19 == null || messageObject25.photoThumbs == null) ? false : true;
i87 = i152;
i88 = extraTimeX;
str6 = str19;
i86 = max5;
charSequence5 = str11;
tLRPC$Photo2 = tLRPC$Photo7;
obj3 = null;
webFile = null;
charSequence3 = null;
tL_stories$StoryItem3 = tL_stories$StoryItem2;
charSequence4 = str18;
i90 = 0;
TLRPC$Document tLRPC$Document7 = tLRPC$Document6;
i89 = i158;
tLRPC$Document2 = tLRPC$Document7;
}
}
z31 = false;
media = MessageObject.getMedia(messageObject24.messageOwner);
if (media != null) {
}
MessageObject messageObject252 = this.currentMessageObject;
TLRPC$Message tLRPC$Message72 = messageObject252.messageOwner;
if (tLRPC$Message72 != null) {
this.linkPreviewAbove = tLRPC$Message72 != null && tLRPC$Message72.invert_media;
if (!z31) {
this.isSmallImage = (!z31 || str19 == null || messageObject252.photoThumbs == null) ? false : true;
i87 = i152;
i88 = extraTimeX;
str6 = str19;
i86 = max5;
charSequence5 = str11;
tLRPC$Photo2 = tLRPC$Photo7;
obj3 = null;
webFile = null;
charSequence3 = null;
tL_stories$StoryItem3 = tL_stories$StoryItem2;
charSequence4 = str18;
i90 = 0;
TLRPC$Document tLRPC$Document72 = tLRPC$Document6;
i89 = i158;
tLRPC$Document2 = tLRPC$Document72;
}
this.isSmallImage = (!z31 || str19 == null || messageObject252.photoThumbs == null) ? false : true;
i87 = i152;
i88 = extraTimeX;
str6 = str19;
i86 = max5;
charSequence5 = str11;
tLRPC$Photo2 = tLRPC$Photo7;
obj3 = null;
webFile = null;
charSequence3 = null;
tL_stories$StoryItem3 = tL_stories$StoryItem2;
charSequence4 = str18;
i90 = 0;
TLRPC$Document tLRPC$Document722 = tLRPC$Document6;
i89 = i158;
tLRPC$Document2 = tLRPC$Document722;
}
this.linkPreviewAbove = tLRPC$Message72 != null && tLRPC$Message72.invert_media;
this.isSmallImage = (!z31 || str19 == null || messageObject252.photoThumbs == null) ? false : true;
i87 = i152;
i88 = extraTimeX;
str6 = str19;
i86 = max5;
charSequence5 = str11;
tLRPC$Photo2 = tLRPC$Photo7;
obj3 = null;
webFile = null;
charSequence3 = null;
tL_stories$StoryItem3 = tL_stories$StoryItem2;
charSequence4 = str18;
i90 = 0;
TLRPC$Document tLRPC$Document7222 = tLRPC$Document6;
i89 = i158;
tLRPC$Document2 = tLRPC$Document7222;
} else if (this.hasInvoicePreview) {
TLRPC$TL_messageMediaInvoice tLRPC$TL_messageMediaInvoice = (TLRPC$TL_messageMediaInvoice) MessageObject.getMedia(messageObject24.messageOwner);
String str20 = MessageObject.getMedia(messageObject24.messageOwner).title;
TLRPC$WebDocument tLRPC$WebDocument = tLRPC$TL_messageMediaInvoice.webPhoto;
WebFile createWithWebDocument = !(tLRPC$WebDocument instanceof TLRPC$TL_webDocument) ? null : WebFile.createWithWebDocument(tLRPC$WebDocument);
this.isSmallImage = false;
this.linkPreviewAbove = false;
tL_stories$StoryItem3 = tL_stories$StoryItem2;
i87 = i152;
i88 = extraTimeX;
i86 = maxMessageTextWidth;
str6 = "invoice";
charSequence4 = str20;
tLRPC$Document2 = null;
charSequence5 = null;
i90 = 0;
z31 = false;
tLRPC$Photo2 = null;
str4 = null;
charSequence3 = null;
str5 = null;
i89 = 0;
webFile = createWithWebDocument;
obj3 = null;
} else {
TLRPC$TL_game tLRPC$TL_game = MessageObject.getMedia(messageObject24.messageOwner).game;
String str21 = tLRPC$TL_game.title;
String str22 = !TextUtils.isEmpty(messageObject24.messageText) ? null : tLRPC$TL_game.description;
TLRPC$Photo tLRPC$Photo9 = tLRPC$TL_game.photo;
TLRPC$Document tLRPC$Document8 = tLRPC$TL_game.document;
this.isSmallImage = false;
this.linkPreviewAbove = false;
tL_stories$StoryItem3 = tL_stories$StoryItem2;
i87 = i152;
i88 = extraTimeX;
i86 = maxMessageTextWidth;
str5 = str22;
str6 = "game";
charSequence4 = str21;
webFile = null;
i90 = 0;
z31 = false;
str4 = null;
charSequence3 = null;
i89 = 0;
tLRPC$Document2 = tLRPC$Document8;
tLRPC$Photo2 = tLRPC$Photo9;
obj3 = null;
charSequence5 = null;
}
}
i91 = this.drawInstantViewType;
String str23 = str6;
if (i91 == 18) {
string5 = LocaleController.getString("BoostChannel", org.telegram.messenger.R.string.BoostChannel);
} else if (i91 == 11) {
string5 = LocaleController.getString("VoipChannelVoiceChat", org.telegram.messenger.R.string.VoipChannelVoiceChat);
} else if (i91 == 9) {
string5 = LocaleController.getString("VoipGroupVoiceChat", org.telegram.messenger.R.string.VoipGroupVoiceChat);
} else if (i91 == 6) {
string5 = LocaleController.getString("ChatBackground", org.telegram.messenger.R.string.ChatBackground);
} else if ("telegram_theme".equals(str15)) {
string5 = LocaleController.getString("ColorTheme", org.telegram.messenger.R.string.ColorTheme);
} else {
charSequence6 = charSequence4;
int dp23 = AndroidUtilities.dp(20.0f);
if (this.hasInvoicePreview) {
dp23 = 0;
}
WebFile webFile4 = webFile;
if (this.drawInstantViewType == 17) {
dp23 += AndroidUtilities.dp(20.0f);
}
i92 = dp23;
int i160 = i86 - i92;
messageObject17 = this.currentMessageObject;
Object obj4 = obj3;
if (messageObject17.photoThumbs == null && tLRPC$Photo2 != null) {
messageObject17.generateThumbs(true);
}
this.totalHeight += this.giveawayMessageCell.getMeasuredHeight();
this.linkPreviewHeight += this.giveawayMessageCell.getMeasuredHeight();
this.totalHeight += this.giveawayResultsMessageCell.getMeasuredHeight();
this.linkPreviewHeight += this.giveawayResultsMessageCell.getMeasuredHeight();
max2 = Math.max(Math.max(max, this.giveawayMessageCell.getMeasuredWidth()), this.giveawayResultsMessageCell.getMeasuredWidth());
if (charSequence6 != null) {
charSequence7 = charSequence6;
i93 = i160;
z32 = z31;
tLRPC$Photo3 = tLRPC$Photo2;
i96 = 0;
i95 = 3;
} else {
try {
z33 = z31;
try {
int ceil4 = (int) Math.ceil(Theme.chat_replyNamePaint.measureText(charSequence6.toString()) + 1.0f + i90);
if (!this.isSmallImage) {
tLRPC$Photo3 = null;
charSequence7 = null;
CharSequence charSequence13 = charSequence6;
this.siteNameLayout = new StaticLayout(charSequence13, Theme.chat_replyNamePaint, Math.min(ceil4, i160), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
i97 = 0;
lineCount = 3;
charSequence8 = charSequence13;
} else {
try {
?? r43 = Theme.chat_replyNamePaint;
StaticLayout generateStaticLayout = generateStaticLayout(charSequence6, r43, i160, (i160 - dp21) - dp22, 3, 1);
this.siteNameLayout = generateStaticLayout;
lineCount = 3 - generateStaticLayout.getLineCount();
i97 = 3;
charSequence8 = r43;
} catch (Exception e) {
e = e;
charSequence7 = charSequence6;
z32 = z33;
i93 = i160;
tLRPC$Photo3 = tLRPC$Photo2;
i94 = 3;
FileLog.e(e);
i95 = i94;
i96 = 0;
if (str4 == null) {
}
if (z35) {
}
if (charSequence5 != null) {
}
int i161 = i100;
if (str5 != null) {
}
if (z32) {
}
z37 = z32;
if (!z37) {
}
if (this.drawInstantViewType != 17) {
}
i6 = 0;
r7 = z46;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i162 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
}
try {
this.siteNameLeft = this.siteNameLayout.getWidth();
this.siteNameLayoutWidth = 0.0f;
i94 = lineCount;
int i163 = 0;
?? r432 = charSequence8;
while (i163 < this.siteNameLayout.getLineCount()) {
try {
charSequence7 = charSequence6;
int i164 = max2;
z32 = z33;
i93 = i160;
tLRPC$Photo3 = tLRPC$Photo2;
int lineLeft = (int) this.siteNameLayout.getLineLeft(i163);
if (i163 > 0) {
if ((this.siteNameLeft == 0.0f) != (lineLeft == 0)) {
this.siteNameLayoutWidth = this.siteNameLayout.getWidth();
}
}
this.siteNameLeft = Math.min(this.siteNameLeft, lineLeft);
this.siteNameLayoutWidth = Math.max(this.siteNameLayoutWidth, this.siteNameLayout.getLineWidth(i163));
i163++;
max2 = i164 == true ? 1 : 0;
tLRPC$Photo2 = tLRPC$Photo3;
charSequence6 = charSequence7;
i160 = i93;
z33 = z32;
r432 = i164;
} catch (Exception e2) {
e = e2;
max2 = r432;
FileLog.e(e);
i95 = i94;
i96 = 0;
if (str4 == null) {
}
if (z35) {
}
if (charSequence5 != null) {
}
int i1612 = i100;
if (str5 != null) {
}
if (z32) {
}
z37 = z32;
if (!z37) {
}
if (this.drawInstantViewType != 17) {
}
i6 = 0;
r7 = z46;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i1622 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
}
int lineBottom = this.siteNameLayout.getLineBottom(r12.getLineCount() - 1);
this.linkPreviewHeight += lineBottom;
this.totalHeight += lineBottom;
tLRPC$Photo3 = tLRPC$Photo2;
int i165 = 0;
i98 = 0;
while (i165 < this.siteNameLayout.getLineCount()) {
try {
r432 = max2;
try {
int max6 = (int) Math.max(0.0f, this.siteNameLayout.getLineLeft(i165));
if (max6 != 0) {
charSequence7 = charSequence6;
z32 = z33;
i93 = i160;
width = this.siteNameLayout.getWidth() - max6;
} else {
try {
if (i165 >= i97) {
if (max6 == 0) {
}
charSequence7 = charSequence6;
i99 = i160;
z32 = z33;
i93 = i160;
width = (int) Math.min(i99, Math.ceil(this.siteNameLayout.getLineWidth(i165)));
}
z32 = z33;
i93 = i160;
width = (int) Math.min(i99, Math.ceil(this.siteNameLayout.getLineWidth(i165)));
} catch (Exception e3) {
e = e3;
z32 = z33;
i93 = i160;
max2 = r432;
FileLog.e(e);
i95 = i94;
i96 = 0;
if (str4 == null) {
}
if (z35) {
}
if (charSequence5 != null) {
}
int i16122 = i100;
if (str5 != null) {
}
if (z32) {
}
z37 = z32;
if (!z37) {
}
if (this.drawInstantViewType != 17) {
}
i6 = 0;
r7 = z46;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i16222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
i99 = i160 - (dp21 + dp22);
charSequence7 = charSequence6;
}
if (i165 >= i97) {
if (max6 != 0) {
if (!this.isSmallImage) {
}
}
i98 = Math.max(i98, width);
i165++;
max2 = r432 == true ? 1 : 0;
charSequence6 = charSequence7;
i160 = i93;
z33 = z32;
}
width += dp21 + dp22;
i98 = Math.max(i98, width);
i165++;
max2 = r432 == true ? 1 : 0;
charSequence6 = charSequence7;
i160 = i93;
z33 = z32;
} catch (Exception e4) {
e = e4;
charSequence7 = charSequence6;
}
} catch (Exception e5) {
e = e5;
charSequence7 = charSequence6;
}
}
} catch (Exception e6) {
e = e6;
charSequence7 = charSequence6;
z32 = z33;
i93 = i160;
i94 = lineCount;
}
} catch (Exception e7) {
e = e7;
charSequence7 = charSequence6;
}
} catch (Exception e8) {
e = e8;
charSequence7 = charSequence6;
i93 = i160;
z32 = z31;
}
try {
this.siteNameWidth = i98;
int i166 = i98 + i92;
max2 = Math.max(max2, i166);
i96 = Math.max(0, i166);
charSequence7 = charSequence6;
z32 = z33;
i93 = i160;
i95 = i94;
} catch (Exception e9) {
e = e9;
charSequence7 = charSequence6;
z32 = z33;
i93 = i160;
FileLog.e(e);
i95 = i94;
i96 = 0;
if (str4 == null) {
}
if (z35) {
}
if (charSequence5 != null) {
}
int i161222 = i100;
if (str5 != null) {
}
if (z32) {
}
z37 = z32;
if (!z37) {
}
if (this.drawInstantViewType != 17) {
}
i6 = 0;
r7 = z46;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i162222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
}
if (str4 == null) {
i100 = i95;
z35 = false;
} else {
try {
int i167 = this.linkPreviewHeight;
if (i167 != 0) {
this.linkPreviewHeight = i167 + AndroidUtilities.dp(2.0f);
this.totalHeight += AndroidUtilities.dp(2.0f);
}
try {
str7 = Emoji.replaceEmoji((CharSequence) str4, Theme.chat_replyNamePaint.getFontMetricsInt(), AndroidUtilities.dp(14.0f), false);
} catch (Exception unused) {
str7 = str4;
}
int i168 = !this.currentMessageObject.isRepostPreview ? 4 : 1;
if (!this.isSmallImage) {
this.titleLayout = StaticLayoutEx.createStaticLayout(str7, Theme.chat_replyNamePaint, i93, Layout.Alignment.ALIGN_NORMAL, 1.0f, AndroidUtilities.dp(1.0f), false, TextUtils.TruncateAt.END, i93, i168);
i100 = i95;
i101 = 0;
i95 = 0;
} else {
StaticLayout generateStaticLayout2 = generateStaticLayout(str7, Theme.chat_replyNamePaint, i93, (i93 - dp21) - dp22, i95, i168);
this.titleLayout = generateStaticLayout2;
i100 = i95 - generateStaticLayout2.getLineCount();
i101 = 0;
}
try {
this.titleLayoutWidth = i101;
this.titleLayoutLeft = this.titleLayout.getWidth();
for (int i169 = 0; i169 < this.titleLayout.getLineCount(); i169++) {
this.titleLayoutLeft = (int) Math.min(this.titleLayoutLeft, this.titleLayout.getLineLeft(i169));
float lineWidth = this.titleLayout.getLineWidth(i169);
if (i169 >= i95) {
if (this.titleLayoutLeft != 0) {
if (!this.isSmallImage) {
}
}
this.titleLayoutWidth = (int) Math.max(this.titleLayoutWidth, lineWidth);
}
lineWidth += dp21 + dp22;
this.titleLayoutWidth = (int) Math.max(this.titleLayoutWidth, lineWidth);
}
max2 = Math.max(max2, this.titleLayoutWidth + i92);
i96 = Math.max(i96, this.titleLayoutWidth + i92);
z34 = this.titleLayoutLeft != 0;
try {
StaticLayout staticLayout4 = this.titleLayout;
int lineBottom2 = staticLayout4.getLineBottom(staticLayout4.getLineCount() - 1);
this.linkPreviewHeight += lineBottom2;
this.totalHeight += lineBottom2;
} catch (Exception e10) {
e = e10;
i95 = i100;
FileLog.e(e);
i100 = i95;
z35 = z34;
if (z35) {
}
if (charSequence5 != null) {
}
int i1612222 = i100;
if (str5 != null) {
}
if (z32) {
}
z37 = z32;
if (!z37) {
}
if (this.drawInstantViewType != 17) {
}
i6 = 0;
r7 = z46;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i1622222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
} catch (Exception e11) {
e = e11;
i95 = i100;
z34 = false;
FileLog.e(e);
i100 = i95;
z35 = z34;
if (z35) {
}
if (charSequence5 != null) {
}
int i16122222 = i100;
if (str5 != null) {
}
if (z32) {
}
z37 = z32;
if (!z37) {
}
if (this.drawInstantViewType != 17) {
}
i6 = 0;
r7 = z46;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i16222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
} catch (Exception e12) {
e = e12;
}
z35 = z34;
}
dp16 = (z35 && this.isSmallImage) ? i93 - AndroidUtilities.dp(48.0f) : i93;
if (charSequence5 != null && str4 == null) {
try {
i129 = this.linkPreviewHeight;
if (i129 == 0) {
this.linkPreviewHeight = i129 + AndroidUtilities.dp(2.0f);
this.totalHeight += AndroidUtilities.dp(2.0f);
}
try {
charSequence5 = Emoji.replaceEmoji(charSequence5, Theme.chat_replyNamePaint.getFontMetricsInt(), AndroidUtilities.dp(14.0f), false);
} catch (Exception unused2) {
}
charSequence10 = charSequence5;
if (i100 == 3 || (this.isSmallImage && str5 != null)) {
StaticLayout generateStaticLayout3 = generateStaticLayout(charSequence10, Theme.chat_replyNamePaint, dp16, (dp16 - dp21) - dp22, i100, 1);
this.authorLayout = generateStaticLayout3;
i100 -= generateStaticLayout3.getLineCount();
this.authorLayoutLeft = this.authorLayout.getWidth();
this.authorLayoutWidth = 0;
for (i130 = 0; i130 < this.authorLayout.getLineCount(); i130++) {
int lineLeft2 = (int) this.authorLayout.getLineLeft(i130);
if (i130 > 0) {
if ((this.authorLayoutLeft == 0) != (lineLeft2 == 0)) {
this.authorLayoutWidth = this.authorLayout.getWidth();
}
}
this.authorLayoutLeft = Math.min(this.authorLayoutLeft, lineLeft2);
this.authorLayoutWidth = (int) Math.max(this.authorLayoutWidth, this.authorLayout.getLineWidth(i130));
}
StaticLayout staticLayout5 = this.authorLayout;
int lineBottom3 = staticLayout5.getLineBottom(staticLayout5.getLineCount() - 1);
this.linkPreviewHeight += lineBottom3;
this.totalHeight += lineBottom3;
max2 = Math.max(max2, this.authorLayoutWidth + i92);
Math.max(i96, this.authorLayoutWidth + i92);
}
this.authorLayout = new StaticLayout(charSequence10, Theme.chat_replyNamePaint, dp16, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.authorLayoutLeft = this.authorLayout.getWidth();
this.authorLayoutWidth = 0;
while (i130 < this.authorLayout.getLineCount()) {
}
StaticLayout staticLayout52 = this.authorLayout;
int lineBottom32 = staticLayout52.getLineBottom(staticLayout52.getLineCount() - 1);
this.linkPreviewHeight += lineBottom32;
this.totalHeight += lineBottom32;
max2 = Math.max(max2, this.authorLayoutWidth + i92);
Math.max(i96, this.authorLayoutWidth + i92);
} catch (Exception e13) {
FileLog.e(e13);
}
}
int i161222222 = i100;
if (str5 != null) {
messageObject2 = messageObject;
} else {
try {
this.descriptionX = 0;
this.currentMessageObject.generateLinkDescription();
int i170 = this.linkPreviewHeight;
if (i170 != 0) {
this.linkPreviewHeight = i170 + AndroidUtilities.dp(2.0f);
this.totalHeight += AndroidUtilities.dp(2.0f);
}
if (charSequence7 != null) {
if (charSequence7.toString().toLowerCase().equals("twitter")) {
z36 = true;
messageObject2 = messageObject;
if (charSequence3 != null) {
try {
charSequence9 = messageObject2.linkDescription;
} catch (Exception e14) {
e = e14;
FileLog.e(e);
if (z32) {
}
z37 = z32;
if (!z37) {
}
if (this.drawInstantViewType != 17) {
}
i6 = 0;
r7 = z46;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i162222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
} else {
charSequence9 = charSequence3;
}
boolean isRTL = AndroidUtilities.isRTL(charSequence9);
if (!z36) {
i102 = 100;
i103 = 3;
} else if (this.currentMessageObject.isRepostPreview) {
i103 = 3;
i102 = 3;
} else {
i103 = 3;
i102 = 6;
}
if (i161222222 == i103 && !this.isSmallImage) {
this.descriptionLayout = StaticLayoutEx.createStaticLayout(charSequence9, Theme.chat_replyTextPaint, dp16, Layout.Alignment.ALIGN_NORMAL, 1.0f, AndroidUtilities.dp(1.0f), false, TextUtils.TruncateAt.END, dp16, i102);
i161222222 = 0;
this.animatedEmojiDescriptionStack = AnimatedEmojiSpan.update(0, (View) this, false, this.animatedEmojiDescriptionStack, this.descriptionLayout);
StaticLayout staticLayout6 = this.descriptionLayout;
int lineBottom4 = staticLayout6.getLineBottom(staticLayout6.getLineCount() - 1);
this.linkPreviewHeight += lineBottom4;
this.totalHeight += lineBottom4;
this.descriptionLayoutWidth = 0;
this.descriptionLayoutLeft = this.descriptionLayout.getWidth();
for (i104 = 0; i104 < this.descriptionLayout.getLineCount(); i104++) {
this.descriptionLayoutLeft = (int) Math.min(this.descriptionLayoutLeft, this.descriptionLayout.getLineLeft(i104));
float min3 = Math.min(this.descriptionLayout.getWidth(), this.descriptionLayout.getLineWidth(i104));
if (i104 >= i161222222) {
if (i161222222 != 0) {
if (this.descriptionLayoutLeft != 0) {
if (!this.isSmallImage) {
}
}
}
this.descriptionLayoutWidth = (int) Math.max(this.descriptionLayoutWidth, min3);
}
min3 += dp21 + dp22;
this.descriptionLayoutWidth = (int) Math.max(this.descriptionLayoutWidth, min3);
}
int i171 = this.descriptionLayoutWidth;
int i172 = i171 + i92;
max2 = Math.max(max2, i171 + i92);
}
this.descriptionLayout = generateStaticLayout(charSequence9, Theme.chat_replyTextPaint, dp16 - (isRTL ? 0 : (dp22 * 2) + dp21), (dp16 - dp21) - (dp22 * 2), i161222222, i102);
this.animatedEmojiDescriptionStack = AnimatedEmojiSpan.update(0, (View) this, false, this.animatedEmojiDescriptionStack, this.descriptionLayout);
StaticLayout staticLayout62 = this.descriptionLayout;
int lineBottom42 = staticLayout62.getLineBottom(staticLayout62.getLineCount() - 1);
this.linkPreviewHeight += lineBottom42;
this.totalHeight += lineBottom42;
this.descriptionLayoutWidth = 0;
this.descriptionLayoutLeft = this.descriptionLayout.getWidth();
while (i104 < this.descriptionLayout.getLineCount()) {
}
int i1712 = this.descriptionLayoutWidth;
int i1722 = i1712 + i92;
max2 = Math.max(max2, i1712 + i92);
}
}
z36 = false;
messageObject2 = messageObject;
if (charSequence3 != null) {
}
boolean isRTL2 = AndroidUtilities.isRTL(charSequence9);
if (!z36) {
}
if (i161222222 == i103) {
this.descriptionLayout = StaticLayoutEx.createStaticLayout(charSequence9, Theme.chat_replyTextPaint, dp16, Layout.Alignment.ALIGN_NORMAL, 1.0f, AndroidUtilities.dp(1.0f), false, TextUtils.TruncateAt.END, dp16, i102);
i161222222 = 0;
this.animatedEmojiDescriptionStack = AnimatedEmojiSpan.update(0, (View) this, false, this.animatedEmojiDescriptionStack, this.descriptionLayout);
StaticLayout staticLayout622 = this.descriptionLayout;
int lineBottom422 = staticLayout622.getLineBottom(staticLayout622.getLineCount() - 1);
this.linkPreviewHeight += lineBottom422;
this.totalHeight += lineBottom422;
this.descriptionLayoutWidth = 0;
this.descriptionLayoutLeft = this.descriptionLayout.getWidth();
while (i104 < this.descriptionLayout.getLineCount()) {
}
int i17122 = this.descriptionLayoutWidth;
int i17222 = i17122 + i92;
max2 = Math.max(max2, i17122 + i92);
}
this.descriptionLayout = generateStaticLayout(charSequence9, Theme.chat_replyTextPaint, dp16 - (isRTL2 ? 0 : (dp22 * 2) + dp21), (dp16 - dp21) - (dp22 * 2), i161222222, i102);
this.animatedEmojiDescriptionStack = AnimatedEmojiSpan.update(0, (View) this, false, this.animatedEmojiDescriptionStack, this.descriptionLayout);
StaticLayout staticLayout6222 = this.descriptionLayout;
int lineBottom4222 = staticLayout6222.getLineBottom(staticLayout6222.getLineCount() - 1);
this.linkPreviewHeight += lineBottom4222;
this.totalHeight += lineBottom4222;
this.descriptionLayoutWidth = 0;
this.descriptionLayoutLeft = this.descriptionLayout.getWidth();
while (i104 < this.descriptionLayout.getLineCount()) {
}
int i171222 = this.descriptionLayoutWidth;
int i172222 = i171222 + i92;
max2 = Math.max(max2, i171222 + i92);
} catch (Exception e15) {
e = e15;
messageObject2 = messageObject;
}
}
if (z32 && this.descriptionLayout == null && this.titleLayout == null) {
this.isSmallImage = false;
z37 = false;
} else {
z37 = z32;
}
if (!z37) {
dp21 = dp16;
}
if (this.drawInstantViewType != 17) {
webFile2 = webFile4;
i105 = i87;
i106 = i88;
str8 = str23;
tLRPC$Photo4 = tLRPC$Photo3;
if (tL_stories$StoryItem3 != null && (tLRPC$MessageMedia = (tL_stories$StoryItem4 = tL_stories$StoryItem3).media) != null) {
int i173 = (int) ((dp21 * 16.0f) / 9.0f);
TLRPC$Document tLRPC$Document9 = tLRPC$MessageMedia.document;
if (tLRPC$Document9 != null) {
this.currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Document9.thumbs, i173);
BitmapDrawable bitmapDrawable3 = this.currentMessageObject.strippedThumb;
if (bitmapDrawable3 == null) {
this.currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Document9.thumbs, 40);
} else {
this.currentPhotoObjectThumbStripped = bitmapDrawable3;
}
TLRPC$PhotoSize tLRPC$PhotoSize9 = this.currentPhotoObject;
if (tLRPC$PhotoSize9 != null && (tLRPC$PhotoSize9.w == 0 || tLRPC$PhotoSize9.h == 0)) {
int i174 = 0;
while (true) {
if (i174 >= tLRPC$Document9.attributes.size()) {
break;
}
TLRPC$DocumentAttribute tLRPC$DocumentAttribute = tLRPC$Document9.attributes.get(i174);
if (tLRPC$DocumentAttribute instanceof TLRPC$TL_documentAttributeImageSize) {
TLRPC$PhotoSize tLRPC$PhotoSize10 = this.currentPhotoObject;
tLRPC$PhotoSize10.w = tLRPC$DocumentAttribute.w;
tLRPC$PhotoSize10.h = tLRPC$DocumentAttribute.h;
break;
}
i174++;
}
TLRPC$PhotoSize tLRPC$PhotoSize11 = this.currentPhotoObject;
if (tLRPC$PhotoSize11.w == 0 || tLRPC$PhotoSize11.h == 0) {
tLRPC$PhotoSize11.w = AndroidUtilities.dp(150.0f);
this.currentPhotoObject.h = (int) ((r0.w / 9.0f) * 16.0f);
}
}
this.documentAttach = tLRPC$Document9;
tLRPC$Document2 = tLRPC$Document9;
} else {
TLRPC$Photo tLRPC$Photo10 = tLRPC$MessageMedia.photo;
if (tLRPC$Photo10 != null) {
this.currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Photo10.sizes, i173);
BitmapDrawable bitmapDrawable4 = this.currentMessageObject.strippedThumb;
if (bitmapDrawable4 == null) {
this.currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Photo10.sizes, 40);
} else {
this.currentPhotoObjectThumbStripped = bitmapDrawable4;
}
tLRPC$Photo5 = tLRPC$Photo10;
this.photoParentObject = tL_stories$StoryItem4;
this.documentAttachType = 10;
i107 = this.documentAttachType;
if (i107 == 5) {
}
i3 = 20;
i4 = 3;
i5 = 4;
z38 = false;
i7 = 1;
f = 50.0f;
f2 = 1.0f;
if (!this.hasInvoicePreview) {
}
if (!this.hasInvoicePreview) {
}
int i175 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i175 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
}
}
tLRPC$Photo5 = tLRPC$Photo4;
this.photoParentObject = tL_stories$StoryItem4;
this.documentAttachType = 10;
i107 = this.documentAttachType;
if (i107 == 5) {
}
i3 = 20;
i4 = 3;
i5 = 4;
z38 = false;
i7 = 1;
f = 50.0f;
f2 = 1.0f;
if (!this.hasInvoicePreview) {
}
if (!this.hasInvoicePreview) {
}
int i1752 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i1752 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
}
tLRPC$Photo5 = tLRPC$Photo4;
i107 = this.documentAttachType;
if (i107 == 5) {
}
i3 = 20;
i4 = 3;
i5 = 4;
z38 = false;
i7 = 1;
f = 50.0f;
f2 = 1.0f;
if (!this.hasInvoicePreview) {
}
if (!this.hasInvoicePreview) {
}
int i17522 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i17522 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
} else if (tLRPC$Document2 != null) {
webFile2 = webFile4;
str8 = str23;
if (MessageObject.isRoundVideoDocument(tLRPC$Document2)) {
i105 = i87;
i106 = i88;
this.currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Document2.thumbs, 90);
this.photoParentObject = tLRPC$Document2;
this.documentAttach = tLRPC$Document2;
this.isSmallImage = false;
this.documentAttachType = 7;
tLRPC$Photo5 = tLRPC$Photo3;
} else if (MessageObject.isGifDocument(tLRPC$Document2, messageObject.hasValidGroupId())) {
i105 = i87;
i106 = i88;
tLRPC$Photo4 = tLRPC$Photo3;
if (!messageObject.isGame() && (!SharedConfig.isAutoplayGifs() || messageObject2.isRepostPreview)) {
f11 = 1.0f;
messageObject2.gifState = 1.0f;
} else {
f11 = 1.0f;
}
this.photoImage.setAllowStartAnimation(messageObject2.gifState != f11);
TLRPC$PhotoSize closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Document2.thumbs, 90);
this.currentPhotoObject = closestPhotoSizeWithSize;
if (closestPhotoSizeWithSize != null) {
this.photoParentObject = tLRPC$Document2;
} else if (tLRPC$Photo4 != null) {
this.currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Photo4.sizes, 90);
this.photoParentObject = tLRPC$Photo4;
}
TLRPC$PhotoSize tLRPC$PhotoSize12 = this.currentPhotoObject;
if (tLRPC$PhotoSize12 != null && (tLRPC$PhotoSize12.w == 0 || tLRPC$PhotoSize12.h == 0)) {
for (int i176 = 0; i176 < tLRPC$Document2.attributes.size(); i176++) {
TLRPC$DocumentAttribute tLRPC$DocumentAttribute2 = tLRPC$Document2.attributes.get(i176);
if ((tLRPC$DocumentAttribute2 instanceof TLRPC$TL_documentAttributeImageSize) || (tLRPC$DocumentAttribute2 instanceof TLRPC$TL_documentAttributeVideo)) {
TLRPC$PhotoSize tLRPC$PhotoSize13 = this.currentPhotoObject;
tLRPC$PhotoSize13.w = tLRPC$DocumentAttribute2.w;
tLRPC$PhotoSize13.h = tLRPC$DocumentAttribute2.h;
break;
}
}
TLRPC$PhotoSize tLRPC$PhotoSize14 = this.currentPhotoObject;
if (tLRPC$PhotoSize14.w == 0 || tLRPC$PhotoSize14.h == 0) {
int dp24 = AndroidUtilities.dp(150.0f);
tLRPC$PhotoSize14.h = dp24;
tLRPC$PhotoSize14.w = dp24;
}
}
this.documentAttach = tLRPC$Document2;
this.documentAttachType = 2;
tLRPC$Photo5 = tLRPC$Photo4;
i107 = this.documentAttachType;
if (i107 == 5) {
}
i3 = 20;
i4 = 3;
i5 = 4;
z38 = false;
i7 = 1;
f = 50.0f;
f2 = 1.0f;
if (!this.hasInvoicePreview) {
}
if (!this.hasInvoicePreview) {
}
int i175222 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i175222 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
} else if (MessageObject.isVideoDocument(tLRPC$Document2)) {
i105 = i87;
i106 = i88;
if (tLRPC$Photo3 == null) {
tLRPC$Photo4 = tLRPC$Photo3;
} else {
tLRPC$Photo4 = tLRPC$Photo3;
this.currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Photo4.sizes, AndroidUtilities.getPhotoSize(), true);
this.currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Photo4.sizes, 40);
this.photoParentObject = tLRPC$Photo4;
}
if (this.currentPhotoObject == null) {
this.currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Document2.thumbs, 320);
this.currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Document2.thumbs, 40);
this.photoParentObject = tLRPC$Document2;
}
TLRPC$PhotoSize tLRPC$PhotoSize15 = this.currentPhotoObject;
if (tLRPC$PhotoSize15 != this.currentPhotoObjectThumb) {
tLRPC$PhotoSize8 = null;
} else {
tLRPC$PhotoSize8 = null;
this.currentPhotoObjectThumb = null;
}
BitmapDrawable bitmapDrawable5 = this.currentMessageObject.strippedThumb;
if (bitmapDrawable5 != null) {
this.currentPhotoObjectThumb = tLRPC$PhotoSize8;
this.currentPhotoObjectThumbStripped = bitmapDrawable5;
}
if (tLRPC$PhotoSize15 == null) {
TLRPC$TL_photoSize tLRPC$TL_photoSize = new TLRPC$TL_photoSize();
this.currentPhotoObject = tLRPC$TL_photoSize;
tLRPC$TL_photoSize.type = "s";
tLRPC$TL_photoSize.location = new TLRPC$TL_fileLocationUnavailable();
}
TLRPC$PhotoSize tLRPC$PhotoSize16 = this.currentPhotoObject;
if (tLRPC$PhotoSize16 != null && (tLRPC$PhotoSize16.w == 0 || tLRPC$PhotoSize16.h == 0 || (tLRPC$PhotoSize16 instanceof TLRPC$TL_photoStrippedSize))) {
int i177 = 0;
while (true) {
if (i177 >= tLRPC$Document2.attributes.size()) {
break;
}
TLRPC$DocumentAttribute tLRPC$DocumentAttribute3 = tLRPC$Document2.attributes.get(i177);
if (tLRPC$DocumentAttribute3 instanceof TLRPC$TL_documentAttributeVideo) {
TLRPC$PhotoSize tLRPC$PhotoSize17 = this.currentPhotoObject;
if (tLRPC$PhotoSize17 instanceof TLRPC$TL_photoStrippedSize) {
int i178 = tLRPC$DocumentAttribute3.w;
float max7 = Math.max(i178, i178) / 50.0f;
TLRPC$PhotoSize tLRPC$PhotoSize18 = this.currentPhotoObject;
tLRPC$PhotoSize18.w = (int) (tLRPC$DocumentAttribute3.w / max7);
tLRPC$PhotoSize18.h = (int) (tLRPC$DocumentAttribute3.h / max7);
} else {
tLRPC$PhotoSize17.w = tLRPC$DocumentAttribute3.w;
tLRPC$PhotoSize17.h = tLRPC$DocumentAttribute3.h;
}
} else {
i177++;
}
}
TLRPC$PhotoSize tLRPC$PhotoSize19 = this.currentPhotoObject;
if (tLRPC$PhotoSize19.w == 0 || tLRPC$PhotoSize19.h == 0) {
int dp25 = AndroidUtilities.dp(150.0f);
tLRPC$PhotoSize19.h = dp25;
tLRPC$PhotoSize19.w = dp25;
}
}
createDocumentLayout(0, messageObject2);
tLRPC$Photo5 = tLRPC$Photo4;
i107 = this.documentAttachType;
if (i107 == 5) {
}
i3 = 20;
i4 = 3;
i5 = 4;
z38 = false;
i7 = 1;
f = 50.0f;
f2 = 1.0f;
if (!this.hasInvoicePreview) {
}
if (!this.hasInvoicePreview) {
}
int i1752222 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i1752222 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
} else {
if (MessageObject.isStickerDocument(tLRPC$Document2) || MessageObject.isAnimatedStickerDocument(tLRPC$Document2, true)) {
i105 = i87;
i106 = i88;
TLRPC$PhotoSize closestPhotoSizeWithSize2 = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Document2.thumbs, 90);
this.currentPhotoObject = closestPhotoSizeWithSize2;
this.photoParentObject = tLRPC$Document2;
if (closestPhotoSizeWithSize2 != null && (closestPhotoSizeWithSize2.w == 0 || closestPhotoSizeWithSize2.h == 0)) {
int i179 = 0;
while (true) {
if (i179 >= tLRPC$Document2.attributes.size()) {
break;
}
TLRPC$DocumentAttribute tLRPC$DocumentAttribute4 = tLRPC$Document2.attributes.get(i179);
if (tLRPC$DocumentAttribute4 instanceof TLRPC$TL_documentAttributeImageSize) {
TLRPC$PhotoSize tLRPC$PhotoSize20 = this.currentPhotoObject;
tLRPC$PhotoSize20.w = tLRPC$DocumentAttribute4.w;
tLRPC$PhotoSize20.h = tLRPC$DocumentAttribute4.h;
break;
}
i179++;
}
TLRPC$PhotoSize tLRPC$PhotoSize21 = this.currentPhotoObject;
if (tLRPC$PhotoSize21.w == 0 || tLRPC$PhotoSize21.h == 0) {
int dp26 = AndroidUtilities.dp(150.0f);
tLRPC$PhotoSize21.h = dp26;
tLRPC$PhotoSize21.w = dp26;
}
}
this.documentAttach = tLRPC$Document2;
this.isSmallImage = false;
this.documentAttachType = 6;
} else {
int i180 = this.drawInstantViewType;
if (i180 == 6) {
i105 = i87;
i106 = i88;
TLRPC$PhotoSize closestPhotoSizeWithSize3 = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Document2.thumbs, 320);
this.currentPhotoObject = closestPhotoSizeWithSize3;
this.photoParentObject = tLRPC$Document2;
if (closestPhotoSizeWithSize3 != null && (closestPhotoSizeWithSize3.w == 0 || closestPhotoSizeWithSize3.h == 0)) {
int i181 = 0;
while (true) {
if (i181 >= tLRPC$Document2.attributes.size()) {
break;
}
TLRPC$DocumentAttribute tLRPC$DocumentAttribute5 = tLRPC$Document2.attributes.get(i181);
if (tLRPC$DocumentAttribute5 instanceof TLRPC$TL_documentAttributeImageSize) {
TLRPC$PhotoSize tLRPC$PhotoSize22 = this.currentPhotoObject;
tLRPC$PhotoSize22.w = tLRPC$DocumentAttribute5.w;
tLRPC$PhotoSize22.h = tLRPC$DocumentAttribute5.h;
break;
}
i181++;
}
TLRPC$PhotoSize tLRPC$PhotoSize23 = this.currentPhotoObject;
if (tLRPC$PhotoSize23.w == 0 || tLRPC$PhotoSize23.h == 0) {
int dp27 = AndroidUtilities.dp(150.0f);
tLRPC$PhotoSize23.h = dp27;
tLRPC$PhotoSize23.w = dp27;
}
}
this.documentAttach = tLRPC$Document2;
this.isSmallImage = false;
this.documentAttachType = 8;
String formatFileSize = AndroidUtilities.formatFileSize(tLRPC$Document2.size);
this.durationWidth = (int) Math.ceil(Theme.chat_durationPaint.measureText(formatFileSize));
this.videoInfoLayout = new StaticLayout(formatFileSize, Theme.chat_durationPaint, this.durationWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
} else if (i180 == 7) {
i105 = i87;
i106 = i88;
this.currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Document2.thumbs, 700);
BitmapDrawable bitmapDrawable6 = this.currentMessageObject.strippedThumb;
if (bitmapDrawable6 == null) {
this.currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Document2.thumbs, 40);
} else {
this.currentPhotoObjectThumbStripped = bitmapDrawable6;
}
this.photoParentObject = tLRPC$Document2;
TLRPC$PhotoSize tLRPC$PhotoSize24 = this.currentPhotoObject;
if (tLRPC$PhotoSize24 != null && (tLRPC$PhotoSize24.w == 0 || tLRPC$PhotoSize24.h == 0)) {
int i182 = 0;
while (true) {
if (i182 >= tLRPC$Document2.attributes.size()) {
break;
}
TLRPC$DocumentAttribute tLRPC$DocumentAttribute6 = tLRPC$Document2.attributes.get(i182);
if (tLRPC$DocumentAttribute6 instanceof TLRPC$TL_documentAttributeImageSize) {
TLRPC$PhotoSize tLRPC$PhotoSize25 = this.currentPhotoObject;
tLRPC$PhotoSize25.w = tLRPC$DocumentAttribute6.w;
tLRPC$PhotoSize25.h = tLRPC$DocumentAttribute6.h;
break;
}
i182++;
}
TLRPC$PhotoSize tLRPC$PhotoSize26 = this.currentPhotoObject;
if (tLRPC$PhotoSize26.w == 0 || tLRPC$PhotoSize26.h == 0) {
int dp28 = AndroidUtilities.dp(150.0f);
tLRPC$PhotoSize26.h = dp28;
tLRPC$PhotoSize26.w = dp28;
}
}
this.isSmallImage = false;
this.documentAttach = tLRPC$Document2;
this.documentAttachType = 9;
} else {
i105 = i87;
i106 = i88;
calcBackgroundWidth(i105, i106, max2);
if (this.backgroundWidth < AndroidUtilities.dp(20.0f) + i105) {
this.backgroundWidth = AndroidUtilities.dp(20.0f) + i105;
}
if (MessageObject.isVoiceDocument(tLRPC$Document2)) {
createDocumentLayout(this.backgroundWidth - AndroidUtilities.dp(10.0f), messageObject2);
this.mediaOffsetY = (!this.linkPreviewAbove ? this.currentMessageObject.textHeight : 0) + AndroidUtilities.dp(8.0f) + this.linkPreviewHeight;
this.totalHeight += AndroidUtilities.dp(44 + (!this.hasLinkPreview ? !this.linkPreviewAbove ? 0 : -4 : 4));
this.linkPreviewHeight += AndroidUtilities.dp(44 + (!this.hasLinkPreview ? 0 : 4));
int dp29 = i105 - AndroidUtilities.dp(86.0f);
max2 = AndroidUtilities.isTablet() ? Math.max(max2, (Math.min(AndroidUtilities.getMinTabletSide() - AndroidUtilities.dp(!z8 ? 0.0f : 52.0f), AndroidUtilities.dp(220.0f)) - AndroidUtilities.dp(30.0f)) + i92) : Math.max(max2, (Math.min(getParentWidth() - AndroidUtilities.dp(!z8 ? 0.0f : 52.0f), AndroidUtilities.dp(220.0f)) - AndroidUtilities.dp(30.0f)) + i92);
calcBackgroundWidth(dp29, i106, max2);
i105 = dp29;
} else if (MessageObject.isMusicDocument(tLRPC$Document2)) {
int createDocumentLayout2 = createDocumentLayout(this.backgroundWidth - AndroidUtilities.dp(10.0f), messageObject2);
this.mediaOffsetY = (!this.linkPreviewAbove ? this.currentMessageObject.textHeight : 0) + AndroidUtilities.dp(8.0f) + this.linkPreviewHeight;
this.totalHeight += AndroidUtilities.dp(56 + (!this.linkPreviewAbove ? 0 : -4));
this.linkPreviewHeight += AndroidUtilities.dp(60.0f);
i105 -= AndroidUtilities.dp(86.0f);
int max8 = Math.max(max2, createDocumentLayout2 + i92 + AndroidUtilities.dp(94.0f));
StaticLayout staticLayout7 = this.songLayout;
if (staticLayout7 != null && staticLayout7.getLineCount() > 0) {
max8 = (int) Math.max(max8, this.songLayout.getLineWidth(0) + i92 + AndroidUtilities.dp(86.0f));
}
StaticLayout staticLayout8 = this.performerLayout;
if (staticLayout8 != null && staticLayout8.getLineCount() > 0) {
max8 = (int) Math.max(max8, this.performerLayout.getLineWidth(0) + i92 + AndroidUtilities.dp(86.0f));
}
max2 = max8;
calcBackgroundWidth(i105, i106, max2);
} else {
createDocumentLayout(this.backgroundWidth - AndroidUtilities.dp(168.0f), messageObject2);
this.drawImageButton = true;
if (this.drawPhotoImage) {
this.totalHeight += AndroidUtilities.dp(100.0f);
this.linkPreviewHeight += AndroidUtilities.dp(86.0f);
this.photoImage.setImageCoords(0.0f, this.totalHeight + this.namesOffset, AndroidUtilities.dp(86.0f), AndroidUtilities.dp(86.0f));
} else {
this.mediaOffsetY = (!this.linkPreviewAbove ? this.currentMessageObject.textHeight : 0) + AndroidUtilities.dp(8.0f) + this.linkPreviewHeight;
this.photoImage.setImageCoords(0.0f, (this.totalHeight + this.namesOffset) - AndroidUtilities.dp(14.0f), AndroidUtilities.dp(56.0f), AndroidUtilities.dp(56.0f));
this.totalHeight += AndroidUtilities.dp(64 + (!this.linkPreviewAbove ? 0 : -4));
this.linkPreviewHeight += AndroidUtilities.dp(50.0f);
StaticLayout staticLayout9 = this.docTitleLayout;
if (staticLayout9 != null && staticLayout9.getLineCount() > 1) {
int lineCount2 = (this.docTitleLayout.getLineCount() - 1) * AndroidUtilities.dp(16.0f);
this.totalHeight += lineCount2;
this.linkPreviewHeight += lineCount2;
}
}
tLRPC$Photo4 = tLRPC$Photo3;
tLRPC$Photo5 = tLRPC$Photo4;
i107 = this.documentAttachType;
if (i107 == 5) {
}
i3 = 20;
i4 = 3;
i5 = 4;
z38 = false;
i7 = 1;
f = 50.0f;
f2 = 1.0f;
if (!this.hasInvoicePreview) {
}
if (!this.hasInvoicePreview) {
}
int i17522222 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i17522222 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
}
tLRPC$Photo5 = tLRPC$Photo3;
i107 = this.documentAttachType;
if (i107 == 5) {
}
i3 = 20;
i4 = 3;
i5 = 4;
z38 = false;
i7 = 1;
f = 50.0f;
f2 = 1.0f;
if (!this.hasInvoicePreview) {
}
if (!this.hasInvoicePreview) {
}
int i175222222 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i175222222 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
}
}
tLRPC$Photo5 = tLRPC$Photo3;
}
z37 = false;
i107 = this.documentAttachType;
if (i107 == 5) {
}
i3 = 20;
i4 = 3;
i5 = 4;
z38 = false;
i7 = 1;
f = 50.0f;
f2 = 1.0f;
if (!this.hasInvoicePreview) {
}
if (!this.hasInvoicePreview) {
}
int i1752222222 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i1752222222 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
} else {
if (obj4 != null) {
webFile2 = webFile4;
str8 = str23;
this.checkOnlyButtonPressed = false;
if (obj4 instanceof TLRPC$User) {
TLRPC$UserProfilePhoto tLRPC$UserProfilePhoto = ((TLRPC$User) obj4).photo;
this.photoParentObject = tLRPC$UserProfilePhoto;
this.currentPhotoObjectThumbStripped = tLRPC$UserProfilePhoto.strippedBitmap;
} else if (obj4 instanceof TLRPC$Chat) {
TLRPC$ChatPhoto tLRPC$ChatPhoto = ((TLRPC$Chat) obj4).photo;
this.photoParentObject = tLRPC$ChatPhoto;
this.currentPhotoObjectThumbStripped = tLRPC$ChatPhoto.strippedBitmap;
}
} else if (tLRPC$Photo3 != null) {
webFile2 = webFile4;
if (str23 == null) {
str8 = str23;
} else {
str8 = str23;
if (str8.equals("photo")) {
z43 = true;
this.currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(messageObject2.photoThumbs, (!z43 && z37) ? dp21 : AndroidUtilities.getPhotoSize(), !z43);
this.photoParentObject = messageObject2.photoThumbsObject;
this.checkOnlyButtonPressed = !z43;
bitmapDrawable2 = this.currentMessageObject.strippedThumb;
if (bitmapDrawable2 == null) {
this.currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(messageObject2.photoThumbs, 40);
} else {
this.currentPhotoObjectThumbStripped = bitmapDrawable2;
}
if (this.currentPhotoObjectThumb == this.currentPhotoObject) {
this.currentPhotoObjectThumb = null;
}
}
}
z43 = false;
if (z43) {
this.currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(messageObject2.photoThumbs, (!z43 && z37) ? dp21 : AndroidUtilities.getPhotoSize(), !z43);
this.photoParentObject = messageObject2.photoThumbsObject;
this.checkOnlyButtonPressed = !z43;
bitmapDrawable2 = this.currentMessageObject.strippedThumb;
if (bitmapDrawable2 == null) {
}
if (this.currentPhotoObjectThumb == this.currentPhotoObject) {
}
}
this.currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(messageObject2.photoThumbs, (!z43 && z37) ? dp21 : AndroidUtilities.getPhotoSize(), !z43);
this.photoParentObject = messageObject2.photoThumbsObject;
this.checkOnlyButtonPressed = !z43;
bitmapDrawable2 = this.currentMessageObject.strippedThumb;
if (bitmapDrawable2 == null) {
}
if (this.currentPhotoObjectThumb == this.currentPhotoObject) {
}
} else if (webFile4 != null) {
if (webFile4.mime_type.startsWith("image/")) {
webFile3 = webFile4;
z44 = false;
} else {
z44 = false;
webFile3 = null;
}
this.drawImageButton = z44;
webFile2 = webFile3;
i105 = i87;
i106 = i88;
str8 = str23;
tLRPC$Photo5 = tLRPC$Photo3;
i107 = this.documentAttachType;
if (i107 == 5) {
if (this.currentPhotoObject != null) {
this.photoImage.setImageBitmap((Drawable) null);
if (this.blurredPhotoImage.getBitmap() != null) {
}
this.linkPreviewHeight -= AndroidUtilities.dp(4.0f);
this.totalHeight += AndroidUtilities.dp(4.0f);
i115 = max2;
i114 = i106;
i3 = 20;
i4 = 3;
z42 = false;
i7 = 1;
f = 50.0f;
f2 = 1.0f;
if (this.hasInvoicePreview) {
}
if (this.hasGamePreview) {
this.linkPreviewHeight += i128 + AndroidUtilities.dp(6.0f);
this.totalHeight += AndroidUtilities.dp(4.0f);
}
calcBackgroundWidth(i105, i114, i115);
z38 = z42;
if (!this.hasInvoicePreview) {
this.linkPreviewHeight += AndroidUtilities.dp(6.0f);
this.totalHeight += AndroidUtilities.dp(6.0f);
}
if (!this.hasInvoicePreview) {
this.linkPreviewHeight += AndroidUtilities.dp(2.66f);
}
int i17522222222 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i17522222222 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
}
if (tLRPC$Photo5 == null) {
this.drawImageButton = !(tLRPC$Photo5 == null || z37) || (str8 != null && (str8.equals("photo") || ((str8.equals("document") && this.documentAttachType != 6) || str8.equals("gif") || (i110 = this.documentAttachType) == 4 || i110 == 8)));
if (this.isSmallImage) {
}
i111 = this.linkPreviewHeight;
if (i111 != 0) {
}
if (this.imageBackgroundSideColor != 0) {
}
if (this.hasInvoicePreview) {
dp21 = AndroidUtilities.dp(22.0f) + i126;
}
max3 = Math.max(max2, (dp21 - (!this.hasInvoicePreview ? 0 : AndroidUtilities.dp(12.0f))) + i92);
tLRPC$PhotoSize7 = this.currentPhotoObject;
if (tLRPC$PhotoSize7 != null) {
}
if (this.imageBackgroundSideColor != 0) {
}
if (z37) {
if (this.hasGamePreview) {
if (this.drawInstantViewType == 7) {
}
float f12 = i122;
float dp30 = f12 / (dp21 - AndroidUtilities.dp(2.0f));
i112 = (int) (f12 / dp30);
dp21 = (int) (i123 / dp30);
if (charSequence7 == null) {
i125 = AndroidUtilities.displaySize.y;
if (dp21 > i125 / 2) {
}
if (this.imageBackgroundSideColor != 0) {
}
if (dp21 < AndroidUtilities.dp(60.0f)) {
}
if (this.isSmallImage) {
}
if (this.documentAttachType == 8) {
this.photoImage.setImageCoords(0.0f, 0.0f, Math.max(max3 - AndroidUtilities.dp(13.0f), i112), dp21);
float f13 = AndroidUtilities.density;
int i183 = (int) (i112 / f13);
int i184 = (int) (dp21 / f13);
Locale locale = Locale.US;
this.currentPhotoFilter = String.format(locale, "%d_%d", Integer.valueOf(i183), Integer.valueOf(i184));
this.currentPhotoFilterThumb = String.format(locale, "%d_%d_b", Integer.valueOf(i183), Integer.valueOf(i184));
if (webFile2 != null) {
}
i7 = 1;
if (this.blurredPhotoImage.getBitmap() != null) {
}
if (this.photoImage.getBitmap() != null) {
}
this.drawPhotoImage = true;
if (str8 != null) {
}
String formatShortDuration = AndroidUtilities.formatShortDuration(i89);
this.durationWidth = (int) Math.ceil(Theme.chat_durationPaint.measureText(formatShortDuration));
this.videoInfoLayout = new StaticLayout(formatShortDuration, Theme.chat_durationPaint, this.durationWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
i115 = i113;
z42 = z39;
if (this.hasInvoicePreview) {
}
if (this.hasGamePreview) {
}
calcBackgroundWidth(i105, i114, i115);
z38 = z42;
if (!this.hasInvoicePreview) {
}
if (!this.hasInvoicePreview) {
}
int i175222222222 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i175222222222 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
}
this.photoImage.setImageCoords(0.0f, 0.0f, i112, dp21);
float f132 = AndroidUtilities.density;
int i1832 = (int) (i112 / f132);
int i1842 = (int) (dp21 / f132);
Locale locale2 = Locale.US;
this.currentPhotoFilter = String.format(locale2, "%d_%d", Integer.valueOf(i1832), Integer.valueOf(i1842));
this.currentPhotoFilterThumb = String.format(locale2, "%d_%d_b", Integer.valueOf(i1832), Integer.valueOf(i1842));
if (webFile2 != null) {
}
i7 = 1;
if (this.blurredPhotoImage.getBitmap() != null) {
}
if (this.photoImage.getBitmap() != null) {
}
this.drawPhotoImage = true;
if (str8 != null) {
}
String formatShortDuration2 = AndroidUtilities.formatShortDuration(i89);
this.durationWidth = (int) Math.ceil(Theme.chat_durationPaint.measureText(formatShortDuration2));
this.videoInfoLayout = new StaticLayout(formatShortDuration2, Theme.chat_durationPaint, this.durationWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
i115 = i113;
z42 = z39;
if (this.hasInvoicePreview) {
}
if (this.hasGamePreview) {
}
calcBackgroundWidth(i105, i114, i115);
z38 = z42;
if (!this.hasInvoicePreview) {
}
if (!this.hasInvoicePreview) {
}
int i1752222222222 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i1752222222222 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
}
i124 = AndroidUtilities.displaySize.y;
if (dp21 > i124 / 3) {
}
if (this.imageBackgroundSideColor != 0) {
}
if (dp21 < AndroidUtilities.dp(60.0f)) {
}
if (this.isSmallImage) {
}
if (this.documentAttachType == 8) {
}
this.photoImage.setImageCoords(0.0f, 0.0f, i112, dp21);
float f1322 = AndroidUtilities.density;
int i18322 = (int) (i112 / f1322);
int i18422 = (int) (dp21 / f1322);
Locale locale22 = Locale.US;
this.currentPhotoFilter = String.format(locale22, "%d_%d", Integer.valueOf(i18322), Integer.valueOf(i18422));
this.currentPhotoFilterThumb = String.format(locale22, "%d_%d_b", Integer.valueOf(i18322), Integer.valueOf(i18422));
if (webFile2 != null) {
}
i7 = 1;
if (this.blurredPhotoImage.getBitmap() != null) {
}
if (this.photoImage.getBitmap() != null) {
}
this.drawPhotoImage = true;
if (str8 != null) {
}
String formatShortDuration22 = AndroidUtilities.formatShortDuration(i89);
this.durationWidth = (int) Math.ceil(Theme.chat_durationPaint.measureText(formatShortDuration22));
this.videoInfoLayout = new StaticLayout(formatShortDuration22, Theme.chat_durationPaint, this.durationWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
i115 = i113;
z42 = z39;
if (this.hasInvoicePreview) {
}
if (this.hasGamePreview) {
}
calcBackgroundWidth(i105, i114, i115);
z38 = z42;
if (!this.hasInvoicePreview) {
}
if (!this.hasInvoicePreview) {
}
int i17522222222222 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i17522222222222 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
}
if (this.hasInvoicePreview) {
}
i120 = 640;
i121 = 360;
float f14 = i120;
float dp31 = f14 / (dp21 - AndroidUtilities.dp(2.0f));
dp21 = (int) (i121 / dp31);
i112 = (int) (f14 / dp31);
if (this.isSmallImage) {
}
if (this.documentAttachType == 8) {
}
this.photoImage.setImageCoords(0.0f, 0.0f, i112, dp21);
float f13222 = AndroidUtilities.density;
int i183222 = (int) (i112 / f13222);
int i184222 = (int) (dp21 / f13222);
Locale locale222 = Locale.US;
this.currentPhotoFilter = String.format(locale222, "%d_%d", Integer.valueOf(i183222), Integer.valueOf(i184222));
this.currentPhotoFilterThumb = String.format(locale222, "%d_%d_b", Integer.valueOf(i183222), Integer.valueOf(i184222));
if (webFile2 != null) {
}
i7 = 1;
if (this.blurredPhotoImage.getBitmap() != null) {
}
if (this.photoImage.getBitmap() != null) {
}
this.drawPhotoImage = true;
if (str8 != null) {
}
String formatShortDuration222 = AndroidUtilities.formatShortDuration(i89);
this.durationWidth = (int) Math.ceil(Theme.chat_durationPaint.measureText(formatShortDuration222));
this.videoInfoLayout = new StaticLayout(formatShortDuration222, Theme.chat_durationPaint, this.durationWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
i115 = i113;
z42 = z39;
if (this.hasInvoicePreview) {
}
if (this.hasGamePreview) {
}
calcBackgroundWidth(i105, i114, i115);
z38 = z42;
if (!this.hasInvoicePreview) {
}
if (!this.hasInvoicePreview) {
}
int i175222222222222 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i175222222222222 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
}
this.photoImage.setInvalidateAll(true);
i112 = dp21;
if (this.isSmallImage) {
}
if (this.documentAttachType == 8) {
}
this.photoImage.setImageCoords(0.0f, 0.0f, i112, dp21);
float f132222 = AndroidUtilities.density;
int i1832222 = (int) (i112 / f132222);
int i1842222 = (int) (dp21 / f132222);
Locale locale2222 = Locale.US;
this.currentPhotoFilter = String.format(locale2222, "%d_%d", Integer.valueOf(i1832222), Integer.valueOf(i1842222));
this.currentPhotoFilterThumb = String.format(locale2222, "%d_%d_b", Integer.valueOf(i1832222), Integer.valueOf(i1842222));
if (webFile2 != null) {
}
i7 = 1;
if (this.blurredPhotoImage.getBitmap() != null) {
}
if (this.photoImage.getBitmap() != null) {
}
this.drawPhotoImage = true;
if (str8 != null) {
}
String formatShortDuration2222 = AndroidUtilities.formatShortDuration(i89);
this.durationWidth = (int) Math.ceil(Theme.chat_durationPaint.measureText(formatShortDuration2222));
this.videoInfoLayout = new StaticLayout(formatShortDuration2222, Theme.chat_durationPaint, this.durationWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
i115 = i113;
z42 = z39;
if (this.hasInvoicePreview) {
}
if (this.hasGamePreview) {
}
calcBackgroundWidth(i105, i114, i115);
z38 = z42;
if (!this.hasInvoicePreview) {
}
if (!this.hasInvoicePreview) {
}
int i1752222222222222 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i1752222222222222 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
}
this.drawImageButton = !(tLRPC$Photo5 == null || z37) || (str8 != null && (str8.equals("photo") || ((str8.equals("document") && this.documentAttachType != 6) || str8.equals("gif") || (i110 = this.documentAttachType) == 4 || i110 == 8)));
if (this.isSmallImage) {
}
i111 = this.linkPreviewHeight;
if (i111 != 0) {
}
if (this.imageBackgroundSideColor != 0) {
}
if (this.hasInvoicePreview) {
}
max3 = Math.max(max2, (dp21 - (!this.hasInvoicePreview ? 0 : AndroidUtilities.dp(12.0f))) + i92);
tLRPC$PhotoSize7 = this.currentPhotoObject;
if (tLRPC$PhotoSize7 != null) {
}
if (this.imageBackgroundSideColor != 0) {
}
if (z37) {
}
this.photoImage.setInvalidateAll(true);
i112 = dp21;
if (this.isSmallImage) {
}
if (this.documentAttachType == 8) {
}
this.photoImage.setImageCoords(0.0f, 0.0f, i112, dp21);
float f1322222 = AndroidUtilities.density;
int i18322222 = (int) (i112 / f1322222);
int i18422222 = (int) (dp21 / f1322222);
Locale locale22222 = Locale.US;
this.currentPhotoFilter = String.format(locale22222, "%d_%d", Integer.valueOf(i18322222), Integer.valueOf(i18422222));
this.currentPhotoFilterThumb = String.format(locale22222, "%d_%d_b", Integer.valueOf(i18322222), Integer.valueOf(i18422222));
if (webFile2 != null) {
}
i7 = 1;
if (this.blurredPhotoImage.getBitmap() != null) {
}
if (this.photoImage.getBitmap() != null) {
}
this.drawPhotoImage = true;
if (str8 != null) {
}
String formatShortDuration22222 = AndroidUtilities.formatShortDuration(i89);
this.durationWidth = (int) Math.ceil(Theme.chat_durationPaint.measureText(formatShortDuration22222));
this.videoInfoLayout = new StaticLayout(formatShortDuration22222, Theme.chat_durationPaint, this.durationWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
i115 = i113;
z42 = z39;
if (this.hasInvoicePreview) {
}
if (this.hasGamePreview) {
}
calcBackgroundWidth(i105, i114, i115);
z38 = z42;
if (!this.hasInvoicePreview) {
}
if (!this.hasInvoicePreview) {
}
int i17522222222222222 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i17522222222222222 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
}
i3 = 20;
i4 = 3;
i5 = 4;
z38 = false;
i7 = 1;
f = 50.0f;
f2 = 1.0f;
if (!this.hasInvoicePreview) {
}
if (!this.hasInvoicePreview) {
}
int i175222222222222222 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i175222222222222222 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
} else {
webFile2 = webFile4;
i105 = i87;
i106 = i88;
str8 = str23;
tLRPC$Photo4 = tLRPC$Photo3;
tLRPC$Photo5 = tLRPC$Photo4;
i107 = this.documentAttachType;
if (i107 == 5 || i107 == 3 || i107 == 1) {
i3 = 20;
i4 = 3;
i5 = 4;
z38 = false;
i7 = 1;
f = 50.0f;
f2 = 1.0f;
} else {
if (this.currentPhotoObject != null || this.currentPhotoLocation != null || webFile2 != null || i107 == 8 || i107 == 9) {
this.drawImageButton = !(tLRPC$Photo5 == null || z37) || (str8 != null && (str8.equals("photo") || ((str8.equals("document") && this.documentAttachType != 6) || str8.equals("gif") || (i110 = this.documentAttachType) == 4 || i110 == 8)));
if (this.isSmallImage) {
this.drawImageButton = false;
}
i111 = this.linkPreviewHeight;
if (i111 != 0) {
this.linkPreviewHeight = i111 + AndroidUtilities.dp(2.0f);
this.totalHeight += AndroidUtilities.dp(2.0f);
}
if (this.imageBackgroundSideColor != 0) {
dp21 = AndroidUtilities.dp(208.0f);
} else {
TLRPC$PhotoSize tLRPC$PhotoSize27 = this.currentPhotoObject;
if ((tLRPC$PhotoSize27 instanceof TLRPC$TL_photoSizeEmpty) && (i127 = tLRPC$PhotoSize27.w) != 0) {
dp21 = i127;
} else {
int i185 = this.documentAttachType;
if (i185 == 6 || i185 == 8 || i185 == 9) {
if (AndroidUtilities.isTablet()) {
minTabletSide9 = AndroidUtilities.getMinTabletSide();
} else {
minTabletSide9 = getParentWidth();
}
dp21 = (int) (minTabletSide9 * 0.5f);
} else if (i185 == 7) {
dp21 = AndroidUtilities.roundMessageSize;
this.photoImage.setAllowDecodeSingleFrame(true);
} else if (i185 == 10) {
dp21 /= 2;
}
}
}
if (this.hasInvoicePreview && dp21 < (i126 = messageObject2.textWidth)) {
dp21 = AndroidUtilities.dp(22.0f) + i126;
}
max3 = Math.max(max2, (dp21 - (!this.hasInvoicePreview ? 0 : AndroidUtilities.dp(12.0f))) + i92);
tLRPC$PhotoSize7 = this.currentPhotoObject;
if (tLRPC$PhotoSize7 != null) {
tLRPC$PhotoSize7.size = -1;
TLRPC$PhotoSize tLRPC$PhotoSize28 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize28 != null) {
tLRPC$PhotoSize28.size = -1;
}
} else if (webFile2 != null) {
webFile2.size = -1;
}
if (this.imageBackgroundSideColor != 0) {
this.imageBackgroundSideWidth = max3 - AndroidUtilities.dp(13.0f);
}
if (z37 || this.documentAttachType == 7) {
this.photoImage.setInvalidateAll(true);
i112 = dp21;
} else if (this.hasGamePreview || this.hasInvoicePreview) {
if (this.hasInvoicePreview) {
int size4 = webFile2.attributes.size();
for (int i186 = 0; i186 < size4; i186++) {
TLRPC$DocumentAttribute tLRPC$DocumentAttribute7 = webFile2.attributes.get(i186);
if (tLRPC$DocumentAttribute7 instanceof TLRPC$TL_documentAttributeImageSize) {
i120 = tLRPC$DocumentAttribute7.w;
i121 = tLRPC$DocumentAttribute7.h;
break;
}
}
}
i120 = 640;
i121 = 360;
float f142 = i120;
float dp312 = f142 / (dp21 - AndroidUtilities.dp(2.0f));
dp21 = (int) (i121 / dp312);
i112 = (int) (f142 / dp312);
} else {
if (this.drawInstantViewType == 7) {
TLRPC$PhotoSize tLRPC$PhotoSize29 = this.currentPhotoObject;
if (tLRPC$PhotoSize29 == null) {
i122 = 30;
i123 = 50;
} else {
int i187 = tLRPC$PhotoSize29.w;
i123 = tLRPC$PhotoSize29.h;
i122 = i187;
}
} else {
i122 = 560;
i123 = 678;
}
float f122 = i122;
float dp302 = f122 / (dp21 - AndroidUtilities.dp(2.0f));
i112 = (int) (f122 / dp302);
dp21 = (int) (i123 / dp302);
if (charSequence7 == null || (!charSequence7.toString().toLowerCase().equals("instagram") && this.documentAttachType == 0)) {
i124 = AndroidUtilities.displaySize.y;
if (dp21 > i124 / 3) {
dp21 = i124 / 3;
if (this.imageBackgroundSideColor != 0) {
float f15 = dp21;
float dp32 = f15 / AndroidUtilities.dp(160.0f);
i112 = (int) (i112 / dp32);
dp21 = (int) (f15 / dp32);
}
if (dp21 < AndroidUtilities.dp(60.0f)) {
dp21 = AndroidUtilities.dp(60.0f);
}
}
} else {
i125 = AndroidUtilities.displaySize.y;
if (dp21 > i125 / 2) {
dp21 = i125 / 2;
}
}
if (this.imageBackgroundSideColor != 0) {
}
if (dp21 < AndroidUtilities.dp(60.0f)) {
}
}
if (this.isSmallImage) {
this.totalHeight += AndroidUtilities.dp(12.0f) + dp21;
this.linkPreviewHeight += dp21;
} else {
if (AndroidUtilities.dp(50.0f) > this.linkPreviewHeight) {
this.totalHeight += (AndroidUtilities.dp(50.0f) - this.linkPreviewHeight) + AndroidUtilities.dp(8.0f);
this.linkPreviewHeight = AndroidUtilities.dp(50.0f);
}
this.linkPreviewHeight -= AndroidUtilities.dp(8.0f);
}
if (this.documentAttachType == 8 && this.imageBackgroundSideColor == 0) {
this.photoImage.setImageCoords(0.0f, 0.0f, Math.max(max3 - AndroidUtilities.dp(13.0f), i112), dp21);
} else {
this.photoImage.setImageCoords(0.0f, 0.0f, i112, dp21);
}
float f13222222 = AndroidUtilities.density;
int i183222222 = (int) (i112 / f13222222);
int i184222222 = (int) (dp21 / f13222222);
Locale locale222222 = Locale.US;
this.currentPhotoFilter = String.format(locale222222, "%d_%d", Integer.valueOf(i183222222), Integer.valueOf(i184222222));
this.currentPhotoFilterThumb = String.format(locale222222, "%d_%d_b", Integer.valueOf(i183222222), Integer.valueOf(i184222222));
if (webFile2 != null) {
i113 = max3;
i114 = i106;
i3 = 20;
i4 = 3;
f = 50.0f;
f2 = 1.0f;
this.photoImage.setImage(ImageLocation.getForWebFile(webFile2), this.currentPhotoFilter, null, null, webFile2.size, null, messageObject, 1);
} else {
int i188 = this.documentAttachType;
if (i188 == 8) {
i113 = max3;
i114 = i106;
i4 = 3;
f = 50.0f;
f2 = 1.0f;
if (messageObject2.mediaExists) {
this.photoImage.setImage(ImageLocation.getForDocument(this.documentAttach), this.currentPhotoFilter, ImageLocation.getForDocument(this.currentPhotoObject, tLRPC$Document2), "b1", 0L, "jpg", messageObject, 1);
} else {
this.photoImage.setImage(null, null, ImageLocation.getForDocument(this.currentPhotoObject, tLRPC$Document2), "b1", 0L, "jpg", messageObject, 1);
}
} else if (i188 == 9) {
i113 = max3;
i114 = i106;
i4 = 3;
f = 50.0f;
f2 = 1.0f;
if (tLRPC$Document2 instanceof DocumentObject.ThemeDocument) {
this.photoImage.setImage(ImageLocation.getForDocument(tLRPC$Document2), this.currentPhotoFilter, null, "b1", 0L, "jpg", messageObject, 1);
} else {
this.photoImage.setImage(ImageLocation.getForDocument(this.currentPhotoObject, tLRPC$Document2), this.currentPhotoFilter, ImageLocation.getForDocument(this.currentPhotoObjectThumb, tLRPC$Document2), "b1", this.currentPhotoObjectThumbStripped, 0L, "jpg", messageObject, 1);
}
} else if (i188 == 10) {
i113 = max3;
i114 = i106;
i4 = 3;
f = 50.0f;
f2 = 1.0f;
if (tLRPC$Document2 != null) {
this.photoImage.setImage(ImageLocation.getForDocument(this.currentPhotoObject, tLRPC$Document2), this.currentPhotoFilter, ImageLocation.getForDocument(this.currentPhotoObjectThumb, tLRPC$Document2), "b1", this.currentPhotoObjectThumbStripped, 0L, "jpg", messageObject, 1);
} else if (tLRPC$Photo5 != null) {
this.photoImage.setImage(ImageLocation.getForPhoto(this.currentPhotoObject, tLRPC$Photo5), this.currentPhotoFilter, ImageLocation.getForPhoto(this.currentPhotoObjectThumb, tLRPC$Photo5), "b1", this.currentPhotoObjectThumbStripped, 0L, "jpg", messageObject, 1);
}
TLRPC$PhotoSize tLRPC$PhotoSize30 = this.currentPhotoObject;
if (tLRPC$PhotoSize30 != null && tLRPC$PhotoSize30.gradientTopColor != 0 && tLRPC$PhotoSize30.gradientBottomColor != 0) {
GradientDrawable.Orientation orientation = GradientDrawable.Orientation.TOP_BOTTOM;
TLRPC$PhotoSize tLRPC$PhotoSize31 = this.currentPhotoObject;
this.gradientDrawable = new GradientDrawable(orientation, new int[]{tLRPC$PhotoSize31.gradientTopColor, tLRPC$PhotoSize31.gradientBottomColor});
} else {
BitmapDrawable bitmapDrawable7 = this.currentPhotoObjectThumbStripped;
if (bitmapDrawable7 != null && bitmapDrawable7.getBitmap() != null) {
int[] colorsSync = DominantColors.getColorsSync(false, this.currentPhotoObjectThumbStripped.getBitmap(), Theme.isCurrentThemeDark());
this.gradientDrawable = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, colorsSync);
TLRPC$PhotoSize tLRPC$PhotoSize32 = this.currentPhotoObject;
if (tLRPC$PhotoSize32 != null) {
tLRPC$PhotoSize32.gradientTopColor = colorsSync[0];
tLRPC$PhotoSize32.gradientBottomColor = colorsSync[1];
}
}
}
} else if (i188 != 6) {
if (i188 == 4) {
i113 = max3;
i114 = i106;
f = 50.0f;
f2 = 1.0f;
this.photoImage.setNeedsQualityThumb(true);
this.photoImage.setShouldGenerateQualityThumb(true);
if (!this.isSmallImage && SharedConfig.isAutoplayVideo()) {
MessageObject messageObject26 = this.currentMessageObject;
if (!messageObject26.isRepostPreview) {
if (messageObject26.hasMediaSpoilers()) {
MessageObject messageObject27 = this.currentMessageObject;
if (!messageObject27.isMediaSpoilersRevealed) {
}
}
MessageObject messageObject28 = this.currentMessageObject;
if (messageObject28.mediaExists || messageObject28.attachPathExists || (messageObject.canStreamVideo() && DownloadController.getInstance(this.currentAccount).canDownloadMedia(this.currentMessageObject))) {
this.photoImage.setAllowDecodeSingleFrame(true);
this.photoImage.setAllowStartAnimation(true);
this.photoImage.startAnimation();
this.photoImage.setImage(ImageLocation.getForDocument(this.documentAttach), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject), this.currentPhotoFilter, ImageLocation.getForDocument(this.currentPhotoObjectThumb, this.documentAttach), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, this.documentAttach.size, null, messageObject, 0);
this.autoPlayingMedia = true;
i3 = 20;
}
}
}
if (this.currentPhotoObjectThumb != null || this.currentPhotoObjectThumbStripped != null) {
this.photoImage.setImage(ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject), this.currentPhotoFilter, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, 0L, null, messageObject, 0);
} else {
ImageReceiver imageReceiver = this.photoImage;
ImageLocation forObject2 = ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject);
TLRPC$PhotoSize tLRPC$PhotoSize33 = this.currentPhotoObject;
imageReceiver.setImage(null, null, forObject2, ((tLRPC$PhotoSize33 instanceof TLRPC$TL_photoStrippedSize) || "s".equals(tLRPC$PhotoSize33.type)) ? this.currentPhotoFilterThumb : this.currentPhotoFilter, this.currentPhotoObjectThumbStripped, 0L, null, messageObject, 0);
}
i3 = 20;
} else {
if (i188 == 2) {
i116 = 2;
} else if (i188 != 7) {
boolean z71 = messageObject2.mediaExists;
String attachFileName = FileLoader.getAttachFileName(this.currentPhotoObject);
if (this.hasGamePreview || z71 || DownloadController.getInstance(this.currentAccount).canDownloadMedia(this.currentMessageObject) || FileLoader.getInstance(this.currentAccount).isLoadingFile(attachFileName)) {
i117 = i106;
i118 = 20;
z41 = false;
f = 50.0f;
f2 = 1.0f;
} else if (this.currentMessageObject.isSponsored()) {
i117 = i106;
i118 = 20;
f = 50.0f;
f2 = 1.0f;
z41 = false;
} else {
this.photoNotSet = true;
TLRPC$PhotoSize tLRPC$PhotoSize34 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize34 != null || this.currentPhotoObjectThumbStripped != null) {
i118 = 20;
i117 = i106;
f2 = 1.0f;
f = 50.0f;
this.photoImage.setImage(null, null, ImageLocation.getForObject(tLRPC$PhotoSize34, this.photoParentObject), String.format(locale222222, "%d_%d_b", Integer.valueOf(i183222222), Integer.valueOf(i184222222)), this.currentPhotoObjectThumbStripped, 0L, null, messageObject, 0);
i3 = i118;
i113 = max3;
i114 = i117;
} else {
this.photoImage.setImageBitmap((Drawable) null);
i113 = max3;
i114 = i106;
i3 = 20;
i4 = 3;
f = 50.0f;
f2 = 1.0f;
}
}
this.photoNotSet = z41;
ImageLocation imageLocation = this.currentPhotoLocation;
if (imageLocation != null) {
this.photoImage.setImage(imageLocation, this.currentPhotoFilter, this.currentPhotoThumbLocation, this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, 0L, null, messageObject, 0);
} else {
this.photoImage.setImage(ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject), this.currentPhotoFilter, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, 0L, null, messageObject, 0);
}
i3 = i118;
i113 = max3;
i114 = i117;
} else {
i116 = 2;
}
f = 50.0f;
f2 = 1.0f;
this.photoImage.setAllowDecodeSingleFrame(true);
if (MessageObject.isRoundVideoDocument(tLRPC$Document2)) {
this.photoImage.setRoundRadius(AndroidUtilities.roundMessageSize / i116);
canDownloadMedia = DownloadController.getInstance(this.currentAccount).canDownloadMedia(this.currentMessageObject);
i119 = 0;
} else if (MessageObject.isGifDocument(tLRPC$Document2, messageObject.hasValidGroupId())) {
canDownloadMedia = DownloadController.getInstance(this.currentAccount).canDownloadMedia(this.currentMessageObject);
i119 = 1;
} else {
i119 = 1;
canDownloadMedia = false;
}
TLRPC$PhotoSize tLRPC$PhotoSize35 = this.currentPhotoObject;
String str24 = ((tLRPC$PhotoSize35 instanceof TLRPC$TL_photoStrippedSize) || "s".equals(tLRPC$PhotoSize35.type)) ? this.currentPhotoFilterThumb : this.currentPhotoFilter;
if ((messageObject2.mediaExists || canDownloadMedia) && !this.currentMessageObject.isRepostPreview) {
this.autoPlayingMedia = true;
TLRPC$VideoSize documentVideoThumb = MessageObject.getDocumentVideoThumb(tLRPC$Document2);
if (!messageObject2.mediaExists && documentVideoThumb != null && (this.currentPhotoObject == null || this.currentPhotoObjectThumb == null)) {
i113 = max3;
i114 = i106;
ImageReceiver imageReceiver2 = this.photoImage;
ImageLocation forDocument = ImageLocation.getForDocument(tLRPC$Document2);
String str25 = tLRPC$Document2.size >= 32768 ? ImageLoader.AUTOPLAY_FILTER : null;
ImageLocation forDocument2 = ImageLocation.getForDocument(documentVideoThumb, this.documentAttach);
TLRPC$PhotoSize tLRPC$PhotoSize36 = this.currentPhotoObject;
if (tLRPC$PhotoSize36 == null) {
tLRPC$PhotoSize36 = this.currentPhotoObjectThumb;
}
imageReceiver2.setImage(forDocument, str25, forDocument2, null, ImageLocation.getForDocument(tLRPC$PhotoSize36, this.documentAttach), this.currentPhotoObject == null ? this.currentPhotoFilterThumb : str24, this.currentPhotoObjectThumbStripped, tLRPC$Document2.size, null, messageObject, 0);
} else {
i113 = max3;
i114 = i106;
this.photoImage.setImage(ImageLocation.getForDocument(tLRPC$Document2), tLRPC$Document2.size >= 32768 ? ImageLoader.AUTOPLAY_FILTER : null, ImageLocation.getForDocument(this.currentPhotoObject, this.documentAttach), str24, ImageLocation.getForDocument(this.currentPhotoObjectThumb, this.documentAttach), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, tLRPC$Document2.size, null, messageObject, 0);
}
} else {
this.photoImage.setImage(null, null, ImageLocation.getForDocument(this.currentPhotoObject, this.documentAttach), str24, 0L, null, this.currentMessageObject, 0);
i113 = max3;
i114 = i106;
}
i7 = i119;
i3 = 20;
i4 = 3;
if (this.blurredPhotoImage.getBitmap() != null) {
z39 = false;
} else {
this.blurredPhotoImage.getBitmap().recycle();
z39 = false;
this.blurredPhotoImage.setImageBitmap((Bitmap) null);
}
if (this.photoImage.getBitmap() != null && !this.photoImage.getBitmap().isRecycled() && this.currentMessageObject.hasMediaSpoilers() && !this.currentMessageObject.isMediaSpoilersRevealed) {
this.blurredPhotoImage.setImageBitmap(Utilities.stackBlurBitmapMax(this.photoImage.getBitmap(), this.currentMessageObject.isRoundVideo()));
this.blurredPhotoImage.setColorFilter(getFancyBlurFilter());
}
this.drawPhotoImage = true;
if (((str8 != null && str8.equals(MediaStreamTrack.VIDEO_TRACK_KIND)) || this.documentAttachType == 10) && i89 != 0) {
String formatShortDuration222222 = AndroidUtilities.formatShortDuration(i89);
this.durationWidth = (int) Math.ceil(Theme.chat_durationPaint.measureText(formatShortDuration222222));
this.videoInfoLayout = new StaticLayout(formatShortDuration222222, Theme.chat_durationPaint, this.durationWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
} else if (this.hasGamePreview) {
try {
TLRPC$Message tLRPC$Message8 = messageObject2.messageOwner;
j2 = tLRPC$Message8.via_bot_id;
if (j2 == 0) {
j2 = tLRPC$Message8.from_id.user_id;
}
} catch (Exception unused3) {
}
if (j2 != 0 && (user2 = MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(j2))) != null && (str9 = user2.username) != null) {
if (str9.equals("donate")) {
z40 = false;
if (z40) {
String upperCase2 = LocaleController.getString("AttachGame", org.telegram.messenger.R.string.AttachGame).toUpperCase();
this.durationWidth = (int) Math.ceil(Theme.chat_gamePaint.measureText(upperCase2));
this.videoInfoLayout = new StaticLayout(upperCase2, Theme.chat_gamePaint, this.durationWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
}
}
}
z40 = true;
if (z40) {
}
}
i115 = i113;
z42 = z39;
}
i4 = 3;
} else {
i113 = max3;
i114 = i106;
f = 50.0f;
f2 = 1.0f;
boolean isSticker = messageObject.isSticker();
if (!SharedConfig.loopStickers() && messageObject.isVideoSticker()) {
this.photoImage.animatedFileDrawableRepeatMaxCount = 1;
}
if (SharedConfig.loopStickers() || (isSticker && !messageObject.isVideoSticker())) {
i4 = 3;
this.photoImage.setAutoRepeat(1);
} else {
i4 = 3;
this.currentPhotoFilter = String.format(locale222222, "%d_%d_nr_messageId=%d", Integer.valueOf(i183222222), Integer.valueOf(i184222222), Integer.valueOf(messageObject2.stableId));
ImageReceiver imageReceiver3 = this.photoImage;
ChatMessageCellDelegate chatMessageCellDelegate3 = this.delegate;
imageReceiver3.setAutoRepeat((chatMessageCellDelegate3 != null && chatMessageCellDelegate3.shouldRepeatSticker(messageObject2)) ? 2 : 3);
}
this.photoImage.setImage(ImageLocation.getForDocument(this.documentAttach), this.currentPhotoFilter, ImageLocation.getForDocument(this.currentPhotoObject, this.documentAttach), "b1", this.documentAttach.size, "webp", messageObject, 1);
}
i3 = 20;
}
i7 = 1;
if (this.blurredPhotoImage.getBitmap() != null) {
}
if (this.photoImage.getBitmap() != null) {
this.blurredPhotoImage.setImageBitmap(Utilities.stackBlurBitmapMax(this.photoImage.getBitmap(), this.currentMessageObject.isRoundVideo()));
this.blurredPhotoImage.setColorFilter(getFancyBlurFilter());
}
this.drawPhotoImage = true;
if (str8 != null) {
String formatShortDuration2222222 = AndroidUtilities.formatShortDuration(i89);
this.durationWidth = (int) Math.ceil(Theme.chat_durationPaint.measureText(formatShortDuration2222222));
this.videoInfoLayout = new StaticLayout(formatShortDuration2222222, Theme.chat_durationPaint, this.durationWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
i115 = i113;
z42 = z39;
}
String formatShortDuration22222222 = AndroidUtilities.formatShortDuration(i89);
this.durationWidth = (int) Math.ceil(Theme.chat_durationPaint.measureText(formatShortDuration22222222));
this.videoInfoLayout = new StaticLayout(formatShortDuration22222222, Theme.chat_durationPaint, this.durationWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
i115 = i113;
z42 = z39;
} else {
this.photoImage.setImageBitmap((Drawable) null);
if (this.blurredPhotoImage.getBitmap() != null) {
this.blurredPhotoImage.getBitmap().recycle();
this.blurredPhotoImage.setImageBitmap((Bitmap) null);
}
this.linkPreviewHeight -= AndroidUtilities.dp(4.0f);
this.totalHeight += AndroidUtilities.dp(4.0f);
i115 = max2;
i114 = i106;
i3 = 20;
i4 = 3;
z42 = false;
i7 = 1;
f = 50.0f;
f2 = 1.0f;
}
if (this.hasInvoicePreview) {
i5 = 4;
} else {
i5 = 4;
if ((MessageObject.getMedia(messageObject2.messageOwner).flags & 4) != 0) {
upperCase = LocaleController.getString("PaymentReceipt", org.telegram.messenger.R.string.PaymentReceipt).toUpperCase();
} else if (MessageObject.getMedia(messageObject2.messageOwner).test) {
upperCase = LocaleController.getString("PaymentTestInvoice", org.telegram.messenger.R.string.PaymentTestInvoice).toUpperCase();
} else {
upperCase = LocaleController.getString("PaymentInvoice", org.telegram.messenger.R.string.PaymentInvoice).toUpperCase();
}
String formatCurrencyString = LocaleController.getInstance().formatCurrencyString(MessageObject.getMedia(messageObject2.messageOwner).total_amount, MessageObject.getMedia(messageObject2.messageOwner).currency);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(formatCurrencyString + " " + ((Object) upperCase));
spannableStringBuilder.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM)), 0, formatCurrencyString.length(), 33);
this.durationWidth = (int) Math.ceil((double) Theme.chat_shipmentPaint.measureText(spannableStringBuilder, 0, spannableStringBuilder.length()));
this.videoInfoLayout = new StaticLayout(spannableStringBuilder, Theme.chat_shipmentPaint, this.durationWidth + AndroidUtilities.dp(10.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
if (!this.drawPhotoImage) {
this.totalHeight += AndroidUtilities.dp(6.0f);
int dp33 = this.timeWidth + AndroidUtilities.dp(14 + (!messageObject.isOutOwner() ? 0 : i3));
int i189 = this.durationWidth;
if (i189 + dp33 > i105) {
i115 = Math.max(i189, i115);
this.totalHeight += AndroidUtilities.dp(12.0f);
} else {
i115 = Math.max(i189 + dp33, i115);
}
}
}
if (this.hasGamePreview && (i128 = messageObject2.textHeight) != 0) {
this.linkPreviewHeight += i128 + AndroidUtilities.dp(6.0f);
this.totalHeight += AndroidUtilities.dp(4.0f);
}
calcBackgroundWidth(i105, i114, i115);
z38 = z42;
}
if (!this.hasInvoicePreview && !this.currentMessageObject.isGiveawayOrGiveawayResults()) {
this.linkPreviewHeight += AndroidUtilities.dp(6.0f);
this.totalHeight += AndroidUtilities.dp(6.0f);
}
if (!this.hasInvoicePreview && !this.currentMessageObject.isGiveawayOrGiveawayResults() && ((this.currentPhotoObject != null || this.documentAttachType == i5) && (this.authorLayout != null || this.descriptionLayout != null || this.titleLayout != null || this.siteNameLayout != null))) {
this.linkPreviewHeight += AndroidUtilities.dp(2.66f);
}
int i1752222222222222222 = this.totalHeight;
if (this.drawInstantView) {
i108 = i5;
i109 = 2;
} else {
i109 = 2;
i108 = 0;
}
this.totalHeight = i1752222222222222222 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
}
i105 = i87;
i106 = i88;
tLRPC$Photo4 = tLRPC$Photo3;
tLRPC$Photo5 = tLRPC$Photo4;
i107 = this.documentAttachType;
if (i107 == 5) {
}
i3 = 20;
i4 = 3;
i5 = 4;
z38 = false;
i7 = 1;
f = 50.0f;
f2 = 1.0f;
if (!this.hasInvoicePreview) {
}
if (!this.hasInvoicePreview) {
}
int i17522222222222222222 = this.totalHeight;
if (this.drawInstantView) {
}
this.totalHeight = i17522222222222222222 + AndroidUtilities.dp(i109 + i108);
createInstantViewButton();
z46 = z38;
}
}
charSequence6 = string5;
int dp232 = AndroidUtilities.dp(20.0f);
if (this.hasInvoicePreview) {
}
WebFile webFile42 = webFile;
if (this.drawInstantViewType == 17) {
}
i92 = dp232;
int i1602 = i86 - i92;
messageObject17 = this.currentMessageObject;
Object obj42 = obj3;
if (messageObject17.photoThumbs == null) {
messageObject17.generateThumbs(true);
}
this.totalHeight += this.giveawayMessageCell.getMeasuredHeight();
this.linkPreviewHeight += this.giveawayMessageCell.getMeasuredHeight();
this.totalHeight += this.giveawayResultsMessageCell.getMeasuredHeight();
this.linkPreviewHeight += this.giveawayResultsMessageCell.getMeasuredHeight();
max2 = Math.max(Math.max(max, this.giveawayMessageCell.getMeasuredWidth()), this.giveawayResultsMessageCell.getMeasuredWidth());
if (charSequence6 != null) {
}
if (str4 == null) {
}
if (z35) {
if (charSequence5 != null) {
i129 = this.linkPreviewHeight;
if (i129 == 0) {
}
charSequence5 = Emoji.replaceEmoji(charSequence5, Theme.chat_replyNamePaint.getFontMetricsInt(), AndroidUtilities.dp(14.0f), false);
charSequence10 = charSequence5;
if (i100 == 3) {
}
StaticLayout generateStaticLayout32 = generateStaticLayout(charSequence10, Theme.chat_replyNamePaint, dp16, (dp16 - dp21) - dp22, i100, 1);
this.authorLayout = generateStaticLayout32;
i100 -= generateStaticLayout32.getLineCount();
this.authorLayoutLeft = this.authorLayout.getWidth();
this.authorLayoutWidth = 0;
while (i130 < this.authorLayout.getLineCount()) {
}
StaticLayout staticLayout522 = this.authorLayout;
int lineBottom322 = staticLayout522.getLineBottom(staticLayout522.getLineCount() - 1);
this.linkPreviewHeight += lineBottom322;
this.totalHeight += lineBottom322;
max2 = Math.max(max2, this.authorLayoutWidth + i92);
Math.max(i96, this.authorLayoutWidth + i92);
}
int i1612222222 = i100;
if (str5 != null) {
}
if (z32) {
this.isSmallImage = false;
z37 = false;
if (!z37) {
}
if (this.drawInstantViewType != 17) {
}
}
z37 = z32;
if (!z37) {
}
if (this.drawInstantViewType != 17) {
}
}
if (charSequence5 != null) {
}
int i16122222222 = i100;
if (str5 != null) {
}
if (z32) {
}
z37 = z32;
if (!z37) {
}
if (this.drawInstantViewType != 17) {
}
} else {
this.photoImage.setImageBitmap((Drawable) null);
calcBackgroundWidth(i152, extraTimeX, max);
if (this.blurredPhotoImage.getBitmap() != null) {
this.blurredPhotoImage.getBitmap().recycle();
this.blurredPhotoImage.setImageBitmap((Bitmap) null);
}
messageObject2 = messageObject24;
i3 = 20;
i4 = 3;
i5 = 4;
z46 = false;
i7 = 1;
f = 50.0f;
f2 = 1.0f;
}
i6 = 0;
r7 = z46;
}
}
int max9 = Math.max(i152, messageObject24.lastLineWidth) + AndroidUtilities.dp(31.0f);
this.backgroundWidth = max9;
this.backgroundWidth = Math.max(max9, this.timeWidth + AndroidUtilities.dp(31.0f));
this.availableTimeWidth = this.backgroundWidth - AndroidUtilities.dp(31.0f);
if (messageObject.isRoundVideo()) {
}
setMessageObjectInternal(messageObject);
this.giveawayMessageCell.setMessageContent(messageObject24, getParentWidth(), this.forwardedNameWidth);
this.giveawayResultsMessageCell.setMessageContent(messageObject24, getParentWidth(), this.forwardedNameWidth);
if (!messageObject.isSponsored()) {
}
if (messageObject.isSponsored()) {
}
if (!this.reactionsLayoutInBubble.isSmall) {
}
if (this.drawPinnedTop) {
}
messageObject15 = this.currentMessageObject;
if (messageObject15 != null) {
this.totalHeight += AndroidUtilities.dp(5.0f);
}
int max42 = Math.max(Math.max(Math.max(this.backgroundWidth, this.nameWidth), this.forwardedNameWidth), this.replyNameWidth);
messageTopicButton = this.topicButton;
if (messageTopicButton != null) {
}
max = Math.max(max42, this.replyTextWidth);
if (this.commentLayout != null) {
max = Math.max(max, this.totalCommentWidth);
}
if (this.hasLinkPreview) {
this.photoImage.setImageBitmap((Drawable) null);
calcBackgroundWidth(i152, extraTimeX, max);
if (this.blurredPhotoImage.getBitmap() != null) {
}
messageObject2 = messageObject24;
i3 = 20;
i4 = 3;
i5 = 4;
z46 = false;
i7 = 1;
f = 50.0f;
f2 = 1.0f;
i6 = 0;
r7 = z46;
}
messageObject16 = this.currentMessageObject;
if (messageObject16.isRepostPreview) {
}
if (this.drawSideButton != 0) {
}
int dp212 = AndroidUtilities.dp(48.0f);
int dp222 = AndroidUtilities.dp(10.0f);
if (messageObject.isSponsored()) {
}
i91 = this.drawInstantViewType;
String str232 = str6;
if (i91 == 18) {
}
charSequence6 = string5;
int dp2322 = AndroidUtilities.dp(20.0f);
if (this.hasInvoicePreview) {
}
WebFile webFile422 = webFile;
if (this.drawInstantViewType == 17) {
}
i92 = dp2322;
int i16022 = i86 - i92;
messageObject17 = this.currentMessageObject;
Object obj422 = obj3;
if (messageObject17.photoThumbs == null) {
}
this.totalHeight += this.giveawayMessageCell.getMeasuredHeight();
this.linkPreviewHeight += this.giveawayMessageCell.getMeasuredHeight();
this.totalHeight += this.giveawayResultsMessageCell.getMeasuredHeight();
this.linkPreviewHeight += this.giveawayResultsMessageCell.getMeasuredHeight();
max2 = Math.max(Math.max(max, this.giveawayMessageCell.getMeasuredWidth()), this.giveawayResultsMessageCell.getMeasuredWidth());
if (charSequence6 != null) {
}
if (str4 == null) {
}
if (z35) {
}
if (charSequence5 != null) {
}
int i161222222222 = i100;
if (str5 != null) {
}
if (z32) {
}
z37 = z32;
if (!z37) {
}
if (this.drawInstantViewType != 17) {
}
i6 = 0;
r7 = z46;
}
}
} else if (messageObject.isSponsored()) {
this.drawInstantView = true;
this.hasLinkPreview = true;
this.instantViewButtonText = messageObject24.sponsoredButtonText;
if (messageObject24.sponsoredBotApp != null) {
this.drawInstantViewType = 15;
} else if (messageObject24.sponsoredWebPage != null) {
this.drawInstantViewType = 16;
} else if (messageObject24.sponsoredChannelPost != 0) {
this.drawInstantViewType = 12;
} else {
this.drawInstantViewType = 1;
long peerId2 = MessageObject.getPeerId(messageObject24.messageOwner.from_id);
if (peerId2 > 0 && (user = MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(peerId2))) != null && user.bot) {
this.drawInstantViewType = 10;
}
}
} else if (messageObject.isGiveawayOrGiveawayResults()) {
this.drawInstantView = true;
this.drawInstantViewType = 19;
} else if ("telegram_channel_boost".equals(str15)) {
this.drawInstantView = true;
this.drawInstantViewType = 18;
} else if ("telegram_giftcode".equals(str15)) {
this.drawInstantView = true;
this.drawInstantViewType = 20;
} else if ("telegram_livestream".equals(str15)) {
this.drawInstantView = true;
this.drawInstantViewType = 11;
} else if ("telegram_voicechat".equals(str15)) {
this.drawInstantView = true;
this.drawInstantViewType = 9;
} else if ("telegram_channel".equals(str15)) {
this.drawInstantView = true;
this.drawInstantViewType = 1;
} else if ("telegram_user".equals(str15)) {
this.drawInstantView = true;
this.drawInstantViewType = 13;
} else if ("telegram_megagroup".equals(str15)) {
this.drawInstantView = true;
this.drawInstantViewType = 2;
} else if ("telegram_message".equals(str15) || ("photo".equals(str15) && tLRPC$WebPage != null && Browser.isTMe(tLRPC$WebPage.url))) {
this.drawInstantView = true;
this.drawInstantViewType = 3;
} else if ("telegram_community".equals(str15) || "telegram_chatlist".equals(str15)) {
this.drawInstantView = true;
this.drawInstantViewType = 14;
} else if ("telegram_botapp".equals(str15)) {
this.drawInstantView = true;
this.drawInstantViewType = 15;
} else if ("telegram_theme".equals(str15)) {
int size5 = MessageObject.getMedia(messageObject24.messageOwner).webpage.attributes.size();
tLRPC$Document = null;
int i190 = 0;
while (true) {
if (i190 >= size5) {
tLRPC$ThemeSettings = null;
break;
}
TLRPC$WebPageAttribute tLRPC$WebPageAttribute = MessageObject.getMedia(messageObject24.messageOwner).webpage.attributes.get(i190);
if (tLRPC$WebPageAttribute instanceof TLRPC$TL_webPageAttributeTheme) {
TLRPC$TL_webPageAttributeTheme tLRPC$TL_webPageAttributeTheme = (TLRPC$TL_webPageAttributeTheme) tLRPC$WebPageAttribute;
ArrayList<TLRPC$Document> arrayList9 = tLRPC$TL_webPageAttributeTheme.documents;
int size6 = arrayList9.size();
int i191 = 0;
while (true) {
if (i191 >= size6) {
z29 = true;
break;
}
TLRPC$Document tLRPC$Document10 = arrayList9.get(i191);
if ("application/x-tgtheme-android".equals(tLRPC$Document10.mime_type)) {
z29 = true;
this.drawInstantView = true;
this.drawInstantViewType = 7;
tLRPC$Document = tLRPC$Document10;
break;
}
i191++;
}
if (this.drawInstantView) {
tLRPC$ThemeSettings = null;
break;
}
tLRPC$ThemeSettings = tLRPC$TL_webPageAttributeTheme.settings;
if (tLRPC$ThemeSettings != null) {
this.drawInstantView = z29;
this.drawInstantViewType = 7;
break;
}
}
i190++;
}
tL_stories$StoryItem = null;
z30 = false;
if (messageObject24.isRepostPreview) {
}
this.backgroundWidth = i152;
if (this.hasLinkPreview) {
}
i84 = messageObject24.lastLineWidth;
if (i152 - i84 >= extraTimeX) {
}
int max92 = Math.max(i152, messageObject24.lastLineWidth) + AndroidUtilities.dp(31.0f);
this.backgroundWidth = max92;
this.backgroundWidth = Math.max(max92, this.timeWidth + AndroidUtilities.dp(31.0f));
this.availableTimeWidth = this.backgroundWidth - AndroidUtilities.dp(31.0f);
if (messageObject.isRoundVideo()) {
}
setMessageObjectInternal(messageObject);
this.giveawayMessageCell.setMessageContent(messageObject24, getParentWidth(), this.forwardedNameWidth);
this.giveawayResultsMessageCell.setMessageContent(messageObject24, getParentWidth(), this.forwardedNameWidth);
if (!messageObject.isSponsored()) {
}
if (messageObject.isSponsored()) {
}
if (!this.reactionsLayoutInBubble.isSmall) {
}
if (this.drawPinnedTop) {
}
messageObject15 = this.currentMessageObject;
if (messageObject15 != null) {
}
int max422 = Math.max(Math.max(Math.max(this.backgroundWidth, this.nameWidth), this.forwardedNameWidth), this.replyNameWidth);
messageTopicButton = this.topicButton;
if (messageTopicButton != null) {
}
max = Math.max(max422, this.replyTextWidth);
if (this.commentLayout != null) {
}
if (this.hasLinkPreview) {
}
messageObject16 = this.currentMessageObject;
if (messageObject16.isRepostPreview) {
}
if (this.drawSideButton != 0) {
}
int dp2122 = AndroidUtilities.dp(48.0f);
int dp2222 = AndroidUtilities.dp(10.0f);
if (messageObject.isSponsored()) {
}
i91 = this.drawInstantViewType;
String str2322 = str6;
if (i91 == 18) {
}
charSequence6 = string5;
int dp23222 = AndroidUtilities.dp(20.0f);
if (this.hasInvoicePreview) {
}
WebFile webFile4222 = webFile;
if (this.drawInstantViewType == 17) {
}
i92 = dp23222;
int i160222 = i86 - i92;
messageObject17 = this.currentMessageObject;
Object obj4222 = obj3;
if (messageObject17.photoThumbs == null) {
}
this.totalHeight += this.giveawayMessageCell.getMeasuredHeight();
this.linkPreviewHeight += this.giveawayMessageCell.getMeasuredHeight();
this.totalHeight += this.giveawayResultsMessageCell.getMeasuredHeight();
this.linkPreviewHeight += this.giveawayResultsMessageCell.getMeasuredHeight();
max2 = Math.max(Math.max(max, this.giveawayMessageCell.getMeasuredWidth()), this.giveawayResultsMessageCell.getMeasuredWidth());
if (charSequence6 != null) {
}
if (str4 == null) {
}
if (z35) {
}
if (charSequence5 != null) {
}
int i1612222222222 = i100;
if (str5 != null) {
}
if (z32) {
}
z37 = z32;
if (!z37) {
}
if (this.drawInstantViewType != 17) {
}
i6 = 0;
r7 = z46;
} else if ("telegram_story".equals(str15)) {
int size7 = tLRPC$WebPage.attributes.size();
int i192 = 0;
while (true) {
if (i192 >= size7) {
tL_stories$StoryItem = null;
break;
}
TLRPC$WebPageAttribute tLRPC$WebPageAttribute2 = tLRPC$WebPage.attributes.get(i192);
if (tLRPC$WebPageAttribute2 instanceof TLRPC$TL_webPageAttributeStory) {
this.drawInstantView = true;
this.drawInstantViewType = 17;
TLRPC$TL_webPageAttributeStory tLRPC$TL_webPageAttributeStory = (TLRPC$TL_webPageAttributeStory) tLRPC$WebPageAttribute2;
tL_stories$StoryItem = tLRPC$TL_webPageAttributeStory.storyItem;
if (tL_stories$StoryItem != null) {
tL_stories$StoryItem.messageId = messageObject.getId();
tL_stories$StoryItem.dialogId = DialogObject.getPeerDialogId(tLRPC$TL_webPageAttributeStory.peer);
if (tL_stories$StoryItem instanceof TL_stories$TL_storyItemDeleted) {
this.drawInstantView = false;
this.hasLinkPreview = false;
this.drawInstantViewType = 0;
}
} else {
this.drawInstantView = false;
this.hasLinkPreview = false;
this.drawInstantViewType = 0;
}
} else {
i192++;
}
}
tLRPC$ThemeSettings = null;
tLRPC$Document = null;
z30 = false;
if (messageObject24.isRepostPreview) {
}
this.backgroundWidth = i152;
if (this.hasLinkPreview) {
}
i84 = messageObject24.lastLineWidth;
if (i152 - i84 >= extraTimeX) {
}
int max922 = Math.max(i152, messageObject24.lastLineWidth) + AndroidUtilities.dp(31.0f);
this.backgroundWidth = max922;
this.backgroundWidth = Math.max(max922, this.timeWidth + AndroidUtilities.dp(31.0f));
this.availableTimeWidth = this.backgroundWidth - AndroidUtilities.dp(31.0f);
if (messageObject.isRoundVideo()) {
}
setMessageObjectInternal(messageObject);
this.giveawayMessageCell.setMessageContent(messageObject24, getParentWidth(), this.forwardedNameWidth);
this.giveawayResultsMessageCell.setMessageContent(messageObject24, getParentWidth(), this.forwardedNameWidth);
if (!messageObject.isSponsored()) {
}
if (messageObject.isSponsored()) {
}
if (!this.reactionsLayoutInBubble.isSmall) {
}
if (this.drawPinnedTop) {
}
messageObject15 = this.currentMessageObject;
if (messageObject15 != null) {
}
int max4222 = Math.max(Math.max(Math.max(this.backgroundWidth, this.nameWidth), this.forwardedNameWidth), this.replyNameWidth);
messageTopicButton = this.topicButton;
if (messageTopicButton != null) {
}
max = Math.max(max4222, this.replyTextWidth);
if (this.commentLayout != null) {
}
if (this.hasLinkPreview) {
}
messageObject16 = this.currentMessageObject;
if (messageObject16.isRepostPreview) {
}
if (this.drawSideButton != 0) {
}
int dp21222 = AndroidUtilities.dp(48.0f);
int dp22222 = AndroidUtilities.dp(10.0f);
if (messageObject.isSponsored()) {
}
i91 = this.drawInstantViewType;
String str23222 = str6;
if (i91 == 18) {
}
charSequence6 = string5;
int dp232222 = AndroidUtilities.dp(20.0f);
if (this.hasInvoicePreview) {
}
WebFile webFile42222 = webFile;
if (this.drawInstantViewType == 17) {
}
i92 = dp232222;
int i1602222 = i86 - i92;
messageObject17 = this.currentMessageObject;
Object obj42222 = obj3;
if (messageObject17.photoThumbs == null) {
}
this.totalHeight += this.giveawayMessageCell.getMeasuredHeight();
this.linkPreviewHeight += this.giveawayMessageCell.getMeasuredHeight();
this.totalHeight += this.giveawayResultsMessageCell.getMeasuredHeight();
this.linkPreviewHeight += this.giveawayResultsMessageCell.getMeasuredHeight();
max2 = Math.max(Math.max(max, this.giveawayMessageCell.getMeasuredWidth()), this.giveawayResultsMessageCell.getMeasuredWidth());
if (charSequence6 != null) {
}
if (str4 == null) {
}
if (z35) {
}
if (charSequence5 != null) {
}
int i16122222222222 = i100;
if (str5 != null) {
}
if (z32) {
}
z37 = z32;
if (!z37) {
}
if (this.drawInstantViewType != 17) {
}
i6 = 0;
r7 = z46;
} else if ("telegram_background".equals(str15)) {
this.drawInstantView = true;
this.drawInstantViewType = 6;
try {
parse2 = Uri.parse(MessageObject.getMedia(messageObject24.messageOwner).webpage.url);
this.imageBackgroundIntensity = Utilities.parseInt((CharSequence) parse2.getQueryParameter("intensity")).intValue();
queryParameter = parse2.getQueryParameter("bg_color");
String queryParameter2 = parse2.getQueryParameter("rotation");
if (queryParameter2 != null) {
this.imageBackgroundGradientRotation = Utilities.parseInt((CharSequence) queryParameter2).intValue();
}
} catch (Exception unused4) {
}
try {
if (TextUtils.isEmpty(queryParameter)) {
TLRPC$Document document2 = messageObject.getDocument();
if (document2 != null && "image/png".equals(document2.mime_type)) {
queryParameter = "ffffff";
}
if (this.imageBackgroundIntensity == 0.0f) {
try {
this.imageBackgroundIntensity = 50.0f;
} catch (Exception unused5) {
}
if (queryParameter == null) {
int parseInt = Integer.parseInt(queryParameter.substring(0, 6), 16) | (-16777216);
this.imageBackgroundColor = parseInt;
if (queryParameter.length() >= 13 && AndroidUtilities.isValidWallChar(queryParameter.charAt(6))) {
int parseInt2 = Integer.parseInt(queryParameter.substring(7, 13), 16) | (-16777216);
this.imageBackgroundGradientColor1 = parseInt2;
parseInt = AndroidUtilities.getAverageColor(this.imageBackgroundColor, parseInt2);
}
if (queryParameter.length() >= 20 && AndroidUtilities.isValidWallChar(queryParameter.charAt(13))) {
this.imageBackgroundGradientColor2 = Integer.parseInt(queryParameter.substring(14, 20), 16) | (-16777216);
}
if (queryParameter.length() == 27 && AndroidUtilities.isValidWallChar(queryParameter.charAt(20))) {
this.imageBackgroundGradientColor3 = Integer.parseInt(queryParameter.substring(21), 16) | (-16777216);
}
if (this.imageBackgroundIntensity < 0.0f) {
this.imageBackgroundSideColor = -15658735;
} else {
this.imageBackgroundSideColor = AndroidUtilities.getPatternSideColor(parseInt);
}
this.photoImage.setColorFilter(new PorterDuffColorFilter(AndroidUtilities.getPatternColor(parseInt), PorterDuff.Mode.SRC_IN));
this.photoImage.setAlpha(Math.abs(this.imageBackgroundIntensity) / 100.0f);
} else {
String lastPathSegment = parse2.getLastPathSegment();
if (lastPathSegment != null && lastPathSegment.length() >= 6) {
this.imageBackgroundColor = Integer.parseInt(lastPathSegment.substring(0, 6), 16) | (-16777216);
if (lastPathSegment.length() >= 13 && AndroidUtilities.isValidWallChar(lastPathSegment.charAt(6))) {
this.imageBackgroundGradientColor1 = Integer.parseInt(lastPathSegment.substring(7, 13), 16) | (-16777216);
}
if (lastPathSegment.length() >= 20 && AndroidUtilities.isValidWallChar(lastPathSegment.charAt(13))) {
this.imageBackgroundGradientColor2 = Integer.parseInt(lastPathSegment.substring(14, 20), 16) | (-16777216);
}
if (lastPathSegment.length() == 27 && AndroidUtilities.isValidWallChar(lastPathSegment.charAt(20))) {
this.imageBackgroundGradientColor3 = Integer.parseInt(lastPathSegment.substring(21), 16) | (-16777216);
}
TLRPC$TL_photoSizeEmpty tLRPC$TL_photoSizeEmpty = new TLRPC$TL_photoSizeEmpty();
this.currentPhotoObject = tLRPC$TL_photoSizeEmpty;
tLRPC$TL_photoSizeEmpty.type = "s";
tLRPC$TL_photoSizeEmpty.w = AndroidUtilities.dp(180.0f);
this.currentPhotoObject.h = AndroidUtilities.dp(150.0f);
this.currentPhotoObject.location = new TLRPC$TL_fileLocationUnavailable();
}
}
}
}
if (queryParameter == null) {
}
} catch (Exception unused6) {
}
}
tLRPC$ThemeSettings = null;
tL_stories$StoryItem = null;
tLRPC$Document = null;
z30 = false;
if (messageObject24.isRepostPreview) {
}
this.backgroundWidth = i152;
if (this.hasLinkPreview) {
}
i84 = messageObject24.lastLineWidth;
if (i152 - i84 >= extraTimeX) {
}
int max9222 = Math.max(i152, messageObject24.lastLineWidth) + AndroidUtilities.dp(31.0f);
this.backgroundWidth = max9222;
this.backgroundWidth = Math.max(max9222, this.timeWidth + AndroidUtilities.dp(31.0f));
this.availableTimeWidth = this.backgroundWidth - AndroidUtilities.dp(31.0f);
if (messageObject.isRoundVideo()) {
}
setMessageObjectInternal(messageObject);
this.giveawayMessageCell.setMessageContent(messageObject24, getParentWidth(), this.forwardedNameWidth);
this.giveawayResultsMessageCell.setMessageContent(messageObject24, getParentWidth(), this.forwardedNameWidth);
if (!messageObject.isSponsored()) {
}
if (messageObject.isSponsored()) {
}
if (!this.reactionsLayoutInBubble.isSmall) {
}
if (this.drawPinnedTop) {
}
messageObject15 = this.currentMessageObject;
if (messageObject15 != null) {
}
int max42222 = Math.max(Math.max(Math.max(this.backgroundWidth, this.nameWidth), this.forwardedNameWidth), this.replyNameWidth);
messageTopicButton = this.topicButton;
if (messageTopicButton != null) {
}
max = Math.max(max42222, this.replyTextWidth);
if (this.commentLayout != null) {
}
if (this.hasLinkPreview) {
}
messageObject16 = this.currentMessageObject;
if (messageObject16.isRepostPreview) {
}
if (this.drawSideButton != 0) {
}
int dp212222 = AndroidUtilities.dp(48.0f);
int dp222222 = AndroidUtilities.dp(10.0f);
if (messageObject.isSponsored()) {
}
i91 = this.drawInstantViewType;
String str232222 = str6;
if (i91 == 18) {
}
charSequence6 = string5;
int dp2322222 = AndroidUtilities.dp(20.0f);
if (this.hasInvoicePreview) {
}
WebFile webFile422222 = webFile;
if (this.drawInstantViewType == 17) {
}
i92 = dp2322222;
int i16022222 = i86 - i92;
messageObject17 = this.currentMessageObject;
Object obj422222 = obj3;
if (messageObject17.photoThumbs == null) {
}
this.totalHeight += this.giveawayMessageCell.getMeasuredHeight();
this.linkPreviewHeight += this.giveawayMessageCell.getMeasuredHeight();
this.totalHeight += this.giveawayResultsMessageCell.getMeasuredHeight();
this.linkPreviewHeight += this.giveawayResultsMessageCell.getMeasuredHeight();
max2 = Math.max(Math.max(max, this.giveawayMessageCell.getMeasuredWidth()), this.giveawayResultsMessageCell.getMeasuredWidth());
if (charSequence6 != null) {
}
if (str4 == null) {
}
if (z35) {
}
if (charSequence5 != null) {
}
int i161222222222222 = i100;
if (str5 != null) {
}
if (z32) {
}
z37 = z32;
if (!z37) {
}
if (this.drawInstantViewType != 17) {
}
i6 = 0;
r7 = z46;
} else {
int i193 = messageObject20.type;
if (i193 != 16) {
if (i193 == 12) {
long j4 = j;
MessageObject messageObject29 = messageObject20;
this.drawContact = z58 ? 1 : 0;
this.drawName = (this.isSavedChat && !messageObject.isOutOwner() && (messageObject.getSavedDialogId() < j4 || messageObject.getSavedDialogId() == UserObject.ANONYMOUS)) || (messageObject.isFromGroup() && messageObject.isSupergroup()) || (messageObject.isImportedForward() && messageObject29.messageOwner.fwd_from.from_id == null);
this.drawForwardedName = !this.isRepliesChat;
this.drawPhotoImage = true;
this.photoImage.setRoundRadius(AndroidUtilities.dp(22.0f));
if (AndroidUtilities.isTablet()) {
this.backgroundWidth = Math.min(AndroidUtilities.getMinTabletSide() - AndroidUtilities.dp(!z8 ? 50.0f : 102.0f), AndroidUtilities.dp(270.0f));
} else {
this.backgroundWidth = Math.min(getParentWidth() - AndroidUtilities.dp(!z8 ? 50.0f : 102.0f), AndroidUtilities.dp(270.0f));
}
this.availableTimeWidth = this.backgroundWidth - AndroidUtilities.dp(31.0f);
long j5 = MessageObject.getMedia(messageObject29.messageOwner).user_id;
TLRPC$User user4 = j5 == j4 ? null : MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(j5));
int maxNameWidth = getMaxNameWidth() - AndroidUtilities.dp(80.0f);
if (maxNameWidth < 0) {
maxNameWidth = AndroidUtilities.dp(10.0f);
}
if (user4 != null) {
this.contactAvatarDrawable.setInfo(this.currentAccount, user4);
} else if (!TextUtils.isEmpty(MessageObject.getMedia(messageObject29.messageOwner).first_name) || !TextUtils.isEmpty(MessageObject.getMedia(messageObject29.messageOwner).last_name)) {
this.contactAvatarDrawable.setInfo(j4, MessageObject.getMedia(messageObject29.messageOwner).first_name, MessageObject.getMedia(messageObject29.messageOwner).last_name);
} else {
z15 = false;
this.photoImage.setForUserOrChat(user4, z15 ? Theme.chat_contactDrawable[!messageObject.isOutOwner() ? (char) 0 : (char) 1] : this.contactAvatarDrawable, messageObject29);
if (TextUtils.isEmpty(messageObject29.vCardData)) {
charSequence = messageObject29.vCardData;
} else if (user4 != null && !TextUtils.isEmpty(user4.phone)) {
charSequence = PhoneFormat.getInstance().format("+" + user4.phone);
} else {
String str26 = MessageObject.getMedia(messageObject29.messageOwner).phone_number;
if (!TextUtils.isEmpty(str26)) {
charSequence = PhoneFormat.getInstance().format(str26);
} else {
charSequence = LocaleController.getString("NumberUnknown", org.telegram.messenger.R.string.NumberUnknown);
}
}
CharSequence charSequence14 = charSequence;
if (user4 == null || !TextUtils.isEmpty(messageObject29.vCardData) || (MessageObject.getMedia(messageObject29.messageOwner) instanceof TLRPC$TL_messageMediaContact)) {
if (user4 == null) {
this.drawContactSendMessage = true;
this.drawContactAdd = !user4.contact;
} else {
this.drawContactView = true;
}
}
replace = ContactsController.formatName(MessageObject.getMedia(messageObject29.messageOwner).first_name, MessageObject.getMedia(messageObject29.messageOwner).last_name).replace('\n', ' ');
if (replace.length() == 0 && (replace = MessageObject.getMedia(messageObject29.messageOwner).phone_number) == null) {
replace = "";
}
this.titleLayout = new StaticLayout(TextUtils.ellipsize(replace, Theme.chat_contactNamePaint, maxNameWidth, TextUtils.TruncateAt.END), Theme.chat_contactNamePaint, maxNameWidth + AndroidUtilities.dp(4.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.docTitleLayout = new StaticLayout(charSequence14, Theme.chat_contactPhonePaint, maxNameWidth + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, AndroidUtilities.dp(1.0f), false);
setMessageObjectInternal(messageObject);
if (this.drawForwardedName && messageObject.needDrawForwarded() && ((groupedMessagePosition4 = this.currentPosition) == null || groupedMessagePosition4.minY == 0)) {
this.namesOffset += AndroidUtilities.dp(5.0f);
} else if (this.drawNameLayout && messageObject.getReplyMsgId() == 0) {
this.namesOffset += AndroidUtilities.dp(7.0f);
}
this.totalHeight = AndroidUtilities.dp(65.0f) + this.namesOffset + this.docTitleLayout.getHeight();
if (this.drawPinnedTop) {
this.namesOffset -= AndroidUtilities.dp(1.0f);
}
if (this.drawContactSendMessage || this.drawContactAdd || this.drawContactView) {
createContactButtons();
} else if (this.docTitleLayout.getLineCount() > 0) {
int dp34 = this.backgroundWidth - AndroidUtilities.dp(110.0f);
StaticLayout staticLayout10 = this.docTitleLayout;
if (dp34 - ((int) Math.ceil(staticLayout10.getLineWidth(staticLayout10.getLineCount() - 1))) < this.timeWidth) {
this.totalHeight += AndroidUtilities.dp(8.0f);
}
}
reactionsLayoutInBubble = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble.isSmall && !reactionsLayoutInBubble.isEmpty) {
reactionsLayoutInBubble.measure(this.backgroundWidth - AndroidUtilities.dp(32.0f), 3);
ReactionsLayoutInBubble reactionsLayoutInBubble8 = this.reactionsLayoutInBubble;
reactionsLayoutInBubble8.totalHeight = reactionsLayoutInBubble8.height;
dp4 = this.backgroundWidth - AndroidUtilities.dp(32.0f);
reactionsLayoutInBubble2 = this.reactionsLayoutInBubble;
if (dp4 - reactionsLayoutInBubble2.lastLineX < this.timeWidth) {
reactionsLayoutInBubble2.totalHeight += AndroidUtilities.dp(12.0f);
this.reactionsLayoutInBubble.positionOffsetY += -AndroidUtilities.dp(12.0f);
}
this.totalHeight += this.reactionsLayoutInBubble.totalHeight;
}
f = 50.0f;
messageObject2 = messageObject29;
i3 = 20;
i4 = 3;
i5 = 4;
spoilerEffect2 = null;
i6 = 0;
i7 = 0;
}
z15 = true;
if (z15) {
}
this.photoImage.setForUserOrChat(user4, z15 ? Theme.chat_contactDrawable[!messageObject.isOutOwner() ? (char) 0 : (char) 1] : this.contactAvatarDrawable, messageObject29);
if (TextUtils.isEmpty(messageObject29.vCardData)) {
}
CharSequence charSequence142 = charSequence;
if (user4 == null) {
}
if (user4 == null) {
}
replace = ContactsController.formatName(MessageObject.getMedia(messageObject29.messageOwner).first_name, MessageObject.getMedia(messageObject29.messageOwner).last_name).replace('\n', ' ');
if (replace.length() == 0) {
replace = "";
}
this.titleLayout = new StaticLayout(TextUtils.ellipsize(replace, Theme.chat_contactNamePaint, maxNameWidth, TextUtils.TruncateAt.END), Theme.chat_contactNamePaint, maxNameWidth + AndroidUtilities.dp(4.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.docTitleLayout = new StaticLayout(charSequence142, Theme.chat_contactPhonePaint, maxNameWidth + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, AndroidUtilities.dp(1.0f), false);
setMessageObjectInternal(messageObject);
if (this.drawForwardedName) {
this.namesOffset += AndroidUtilities.dp(5.0f);
this.totalHeight = AndroidUtilities.dp(65.0f) + this.namesOffset + this.docTitleLayout.getHeight();
if (this.drawPinnedTop) {
}
if (this.drawContactSendMessage) {
if (this.docTitleLayout.getLineCount() > 0) {
}
reactionsLayoutInBubble = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble.isSmall) {
reactionsLayoutInBubble.measure(this.backgroundWidth - AndroidUtilities.dp(32.0f), 3);
ReactionsLayoutInBubble reactionsLayoutInBubble82 = this.reactionsLayoutInBubble;
reactionsLayoutInBubble82.totalHeight = reactionsLayoutInBubble82.height;
dp4 = this.backgroundWidth - AndroidUtilities.dp(32.0f);
reactionsLayoutInBubble2 = this.reactionsLayoutInBubble;
if (dp4 - reactionsLayoutInBubble2.lastLineX < this.timeWidth) {
}
this.totalHeight += this.reactionsLayoutInBubble.totalHeight;
}
f = 50.0f;
messageObject2 = messageObject29;
i3 = 20;
i4 = 3;
i5 = 4;
spoilerEffect2 = null;
i6 = 0;
i7 = 0;
}
createContactButtons();
reactionsLayoutInBubble = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble.isSmall) {
}
f = 50.0f;
messageObject2 = messageObject29;
i3 = 20;
i4 = 3;
i5 = 4;
spoilerEffect2 = null;
i6 = 0;
i7 = 0;
}
if (this.drawNameLayout) {
this.namesOffset += AndroidUtilities.dp(7.0f);
}
this.totalHeight = AndroidUtilities.dp(65.0f) + this.namesOffset + this.docTitleLayout.getHeight();
if (this.drawPinnedTop) {
}
if (this.drawContactSendMessage) {
}
createContactButtons();
reactionsLayoutInBubble = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble.isSmall) {
}
f = 50.0f;
messageObject2 = messageObject29;
i3 = 20;
i4 = 3;
i5 = 4;
spoilerEffect2 = null;
i6 = 0;
i7 = 0;
} else if (i193 == i2) {
long j6 = j;
messageObject5 = messageObject20;
f4 = 50.0f;
this.drawForwardedName = !this.isRepliesChat;
this.drawName = (this.isSavedChat && !messageObject.isOutOwner() && (messageObject.getSavedDialogId() < j6 || messageObject.getSavedDialogId() == UserObject.ANONYMOUS)) || (messageObject.isFromGroup() && messageObject.isSupergroup()) || (messageObject.isImportedForward() && messageObject5.messageOwner.fwd_from.from_id == null);
if (AndroidUtilities.isTablet()) {
min = Math.min(AndroidUtilities.getMinTabletSide() - AndroidUtilities.dp(!z8 ? 50.0f : 102.0f), AndroidUtilities.dp(270.0f));
this.backgroundWidth = min;
} else {
min = Math.min(getParentWidth() - AndroidUtilities.dp(!z8 ? 50.0f : 102.0f), AndroidUtilities.dp(270.0f));
this.backgroundWidth = min;
}
createDocumentLayout(this.backgroundWidth, messageObject5);
setMessageObjectInternal(messageObject);
int dp35 = AndroidUtilities.dp(70.0f);
int i194 = this.namesOffset;
this.totalHeight = dp35 + i194;
if (this.drawPinnedTop) {
this.namesOffset = i194 - AndroidUtilities.dp(1.0f);
}
ReactionsLayoutInBubble reactionsLayoutInBubble9 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble9.isSmall) {
reactionsLayoutInBubble9.measure(min - AndroidUtilities.dp(!messageObject.isOutOwner() ? 24.0f : 32.0f), 3);
ReactionsLayoutInBubble reactionsLayoutInBubble10 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble10.isEmpty) {
reactionsLayoutInBubble10.totalHeight = reactionsLayoutInBubble10.height;
if (TextUtils.isEmpty(messageObject5.caption)) {
this.reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(12.0f);
} else {
this.reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(8.0f);
}
int i195 = this.reactionsLayoutInBubble.width;
if (i195 > this.backgroundWidth) {
this.backgroundWidth = i195;
}
int dp36 = this.timeWidth + AndroidUtilities.dp(6.0f);
if (messageObject.isOutOwner()) {
dp36 += AndroidUtilities.dp(20.5f);
}
int extraTimeX2 = dp36 + getExtraTimeX();
ReactionsLayoutInBubble reactionsLayoutInBubble11 = this.reactionsLayoutInBubble;
if (reactionsLayoutInBubble11.lastLineX + extraTimeX2 >= this.backgroundWidth) {
reactionsLayoutInBubble11.totalHeight += AndroidUtilities.dp(12.0f);
this.reactionsLayoutInBubble.positionOffsetY -= AndroidUtilities.dp(12.0f);
}
this.totalHeight += this.reactionsLayoutInBubble.totalHeight;
}
}
} else if (i193 == 14) {
f4 = 50.0f;
if (this.isSavedChat && !messageObject.isOutOwner()) {
if (messageObject.getSavedDialogId() < 0 || messageObject.getSavedDialogId() == UserObject.ANONYMOUS) {
messageObject5 = messageObject;
z16 = true;
this.drawName = z16;
if (AndroidUtilities.isTablet()) {
min2 = Math.min(AndroidUtilities.getMinTabletSide() - AndroidUtilities.dp(!z8 ? 50.0f : 102.0f), AndroidUtilities.dp(270.0f));
this.backgroundWidth = min2;
} else {
min2 = Math.min(getParentWidth() - AndroidUtilities.dp(!z8 ? 50.0f : 102.0f), AndroidUtilities.dp(270.0f));
this.backgroundWidth = min2;
}
createDocumentLayout = createDocumentLayout(this.backgroundWidth, messageObject5);
setMessageObjectInternal(messageObject);
this.totalHeight = AndroidUtilities.dp(82.0f) + this.namesOffset;
if (AndroidUtilities.dp(76.0f) + createDocumentLayout >= (this.backgroundWidth - this.timeWidth) - AndroidUtilities.dp(12.0f)) {
this.totalHeight += AndroidUtilities.dp(14.0f);
}
if (this.currentPosition != null && (groupedMessages5 = this.currentMessagesGroup) != null && groupedMessages5.messages.size() > 1) {
if ((this.currentPosition.flags & 4) == 0) {
this.totalHeight -= AndroidUtilities.dp(6.0f);
this.mediaOffsetY -= AndroidUtilities.dp(6.0f);
}
if ((this.currentPosition.flags & 8) == 0) {
this.totalHeight -= AndroidUtilities.dp(6.0f);
}
}
if (this.drawPinnedTop) {
this.namesOffset -= AndroidUtilities.dp(1.0f);
}
reactionsLayoutInBubble3 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble3.isSmall) {
reactionsLayoutInBubble3.measure(min2 - AndroidUtilities.dp(24.0f), 3);
ReactionsLayoutInBubble reactionsLayoutInBubble12 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble12.isEmpty) {
reactionsLayoutInBubble12.totalHeight = reactionsLayoutInBubble12.height + AndroidUtilities.dp(12.0f);
measureTime(messageObject);
ReactionsLayoutInBubble reactionsLayoutInBubble13 = this.reactionsLayoutInBubble;
int i196 = reactionsLayoutInBubble13.width;
if (i196 > this.backgroundWidth) {
this.backgroundWidth = i196;
}
if (reactionsLayoutInBubble13.lastLineX + this.timeWidth + AndroidUtilities.dp(24.0f) > this.backgroundWidth) {
this.reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(12.0f);
this.reactionsLayoutInBubble.positionOffsetY -= AndroidUtilities.dp(12.0f);
}
if (!messageObject5.isRestrictedMessage && messageObject5.caption != null) {
this.reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(14.0f);
}
this.totalHeight += this.reactionsLayoutInBubble.totalHeight;
}
}
}
}
if (messageObject.isFromGroup() && messageObject.isSupergroup()) {
messageObject5 = messageObject;
} else {
messageObject5 = messageObject;
if (messageObject.isImportedForward()) {
}
z16 = false;
this.drawName = z16;
if (AndroidUtilities.isTablet()) {
}
createDocumentLayout = createDocumentLayout(this.backgroundWidth, messageObject5);
setMessageObjectInternal(messageObject);
this.totalHeight = AndroidUtilities.dp(82.0f) + this.namesOffset;
if (AndroidUtilities.dp(76.0f) + createDocumentLayout >= (this.backgroundWidth - this.timeWidth) - AndroidUtilities.dp(12.0f)) {
}
if (this.currentPosition != null) {
if ((this.currentPosition.flags & 4) == 0) {
}
if ((this.currentPosition.flags & 8) == 0) {
}
}
if (this.drawPinnedTop) {
}
reactionsLayoutInBubble3 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble3.isSmall) {
}
}
MessageObject.GroupedMessagePosition groupedMessagePosition16 = this.currentPosition;
if (groupedMessagePosition16 != null) {
}
z16 = true;
this.drawName = z16;
if (AndroidUtilities.isTablet()) {
}
createDocumentLayout = createDocumentLayout(this.backgroundWidth, messageObject5);
setMessageObjectInternal(messageObject);
this.totalHeight = AndroidUtilities.dp(82.0f) + this.namesOffset;
if (AndroidUtilities.dp(76.0f) + createDocumentLayout >= (this.backgroundWidth - this.timeWidth) - AndroidUtilities.dp(12.0f)) {
}
if (this.currentPosition != null) {
}
if (this.drawPinnedTop) {
}
reactionsLayoutInBubble3 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble3.isSmall) {
}
} else if (i193 == 17) {
boolean z72 = z58 ? 1 : 0;
int i197 = i2;
MessageObject messageObject30 = messageObject20;
boolean z73 = false;
z73 = false;
z73 = false;
ArrayList arrayList10 = null;
float f16 = 0.0f;
if (this.timerParticles == null) {
this.timerParticles = new TimerParticles();
}
createSelectorDrawable(0);
this.drawName = z72;
this.drawForwardedName = this.isRepliesChat ? false : z72 ? 1 : 0;
this.drawPhotoImage = false;
int min4 = Math.min(AndroidUtilities.dp(500.0f), messageObject.getMaxMessageTextWidth());
this.backgroundWidth = AndroidUtilities.dp(31.0f) + min4;
TLRPC$TL_messageMediaPoll tLRPC$TL_messageMediaPoll3 = (TLRPC$TL_messageMediaPoll) MessageObject.getMedia(messageObject30.messageOwner);
this.timerTransitionProgress = tLRPC$TL_messageMediaPoll3.poll.close_date - ConnectionsManager.getInstance(this.currentAccount).getCurrentTime() >= 60 ? 1.0f : 0.0f;
this.pollClosed = tLRPC$TL_messageMediaPoll3.poll.closed;
boolean isVoted = messageObject.isVoted();
this.pollVoted = isVoted;
if (isVoted) {
messageObject30.checkedVotes.clear();
}
StaticLayout staticLayout11 = new StaticLayout(Emoji.replaceEmoji((CharSequence) tLRPC$TL_messageMediaPoll3.poll.question, Theme.chat_audioTitlePaint.getFontMetricsInt(), AndroidUtilities.dp(16.0f), false), Theme.chat_audioTitlePaint, (AndroidUtilities.dp(2.0f) + min4) - (getExtraTextX() * i197), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.titleLayout = staticLayout11;
int lineCount3 = staticLayout11.getLineCount();
int i198 = 0;
while (true) {
if (i198 >= lineCount3) {
z17 = false;
break;
}
if (this.titleLayout.getLineLeft(i198) > 0.0f) {
z17 = z72 ? 1 : 0;
break;
}
i198++;
}
if (this.pollClosed) {
string3 = LocaleController.getString("FinalResults", org.telegram.messenger.R.string.FinalResults);
} else {
TLRPC$Poll tLRPC$Poll3 = tLRPC$TL_messageMediaPoll3.poll;
if (tLRPC$Poll3.quiz) {
if (tLRPC$Poll3.public_voters) {
string3 = LocaleController.getString("QuizPoll", org.telegram.messenger.R.string.QuizPoll);
} else {
string3 = LocaleController.getString("AnonymousQuizPoll", org.telegram.messenger.R.string.AnonymousQuizPoll);
}
} else if (tLRPC$Poll3.public_voters) {
string3 = LocaleController.getString("PublicPoll", org.telegram.messenger.R.string.PublicPoll);
} else {
string3 = LocaleController.getString("AnonymousPoll", org.telegram.messenger.R.string.AnonymousPoll);
}
}
float f17 = min4;
StaticLayout staticLayout12 = new StaticLayout(TextUtils.ellipsize(string3, Theme.chat_timePaint, f17, TextUtils.TruncateAt.END), Theme.chat_timePaint, (AndroidUtilities.dp(2.0f) + min4) - (getExtraTextX() * i197), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.docTitleLayout = staticLayout12;
if (staticLayout12.getLineCount() > 0) {
if (z17 && !LocaleController.isRTL) {
this.docTitleOffsetX = (int) Math.ceil(f17 - this.docTitleLayout.getLineWidth(0));
} else if (!z17 && LocaleController.isRTL) {
this.docTitleOffsetX = -((int) Math.ceil(this.docTitleLayout.getLineLeft(0)));
} else {
this.docTitleOffsetX = 0;
}
}
int dp37 = min4 - AndroidUtilities.dp(!messageObject.isOutOwner() ? 8.0f : 28.0f);
if (!this.isBot) {
TLRPC$Poll tLRPC$Poll4 = tLRPC$TL_messageMediaPoll3.poll;
TextPaint textPaint = (tLRPC$Poll4.public_voters || tLRPC$Poll4.multiple_choice) ? Theme.chat_locationAddressPaint : Theme.chat_livePaint;
if (tLRPC$Poll4.quiz) {
int i199 = tLRPC$TL_messageMediaPoll3.results.total_voters;
ellipsize = TextUtils.ellipsize(i199 != 0 ? LocaleController.formatPluralString("Answer", i199, new Object[0]) : LocaleController.getString("NoVotesQuiz", org.telegram.messenger.R.string.NoVotesQuiz), textPaint, dp37, TextUtils.TruncateAt.END);
} else {
int i200 = tLRPC$TL_messageMediaPoll3.results.total_voters;
ellipsize = TextUtils.ellipsize(i200 != 0 ? LocaleController.formatPluralString("Vote", i200, new Object[0]) : LocaleController.getString("NoVotes", org.telegram.messenger.R.string.NoVotes), textPaint, dp37, TextUtils.TruncateAt.END);
}
StaticLayout staticLayout13 = new StaticLayout(ellipsize, textPaint, dp37, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.infoLayout = staticLayout13;
TLRPC$Poll tLRPC$Poll5 = tLRPC$TL_messageMediaPoll3.poll;
if (!tLRPC$Poll5.public_voters && !tLRPC$Poll5.multiple_choice) {
this.infoX = (int) Math.ceil(staticLayout13.getLineCount() <= 0 ? 0.0d : -this.infoLayout.getLineLeft(0));
this.availableTimeWidth = (int) ((f17 - this.infoLayout.getLineWidth(0)) - AndroidUtilities.dp(16.0f));
} else {
this.infoX = (int) ((((this.backgroundWidth - AndroidUtilities.dp(28.0f)) - Math.ceil(this.infoLayout.getLineWidth(0))) / 2.0d) - this.infoLayout.getLineLeft(0));
this.availableTimeWidth = min4;
}
}
measureTime(messageObject);
TLRPC$Poll tLRPC$Poll6 = tLRPC$TL_messageMediaPoll3.poll;
this.lastPoll = tLRPC$Poll6;
TLRPC$PollResults tLRPC$PollResults3 = tLRPC$TL_messageMediaPoll3.results;
this.lastPollResults = tLRPC$PollResults3.results;
int i201 = tLRPC$PollResults3.total_voters;
this.lastPollResultsVoters = i201;
if ((tLRPC$Poll6.multiple_choice && !this.pollVoted && !this.pollClosed) || (!this.isBot && tLRPC$Poll6.public_voters && (this.pollVoted || (this.pollClosed && tLRPC$PollResults3 != null && i201 != 0)))) {
this.drawInstantView = z72;
this.drawInstantViewType = 8;
createInstantViewButton();
}
if (tLRPC$TL_messageMediaPoll3.poll.multiple_choice) {
createPollUI();
}
if (tLRPC$TL_messageMediaPoll3.results != null) {
createPollUI();
int size8 = tLRPC$TL_messageMediaPoll3.results.recent_voters.size();
int i202 = 0;
z72 = z72;
while (true) {
ImageReceiver[] imageReceiverArr2 = this.pollAvatarImages;
if (i202 >= imageReceiverArr2.length) {
break;
}
if (!this.isBot && i202 < size8) {
imageReceiverArr2[i202].setImageCoords(0.0f, 0.0f, AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f));
TLRPC$Peer tLRPC$Peer2 = tLRPC$TL_messageMediaPoll3.results.recent_voters.get(i202);
TLObject userOrChat = MessagesController.getInstance(this.currentAccount).getUserOrChat(DialogObject.getPeerDialogId(tLRPC$Peer2));
if (userOrChat != null) {
this.pollAvatarDrawables[i202].setInfo(this.currentAccount, userOrChat);
this.pollAvatarImages[i202].setForUserOrChat(userOrChat, this.pollAvatarDrawables[i202]);
} else {
this.pollAvatarDrawables[i202].setInfo(DialogObject.getPeerDialogId(tLRPC$Peer2), "", "");
}
this.pollAvatarImagesVisible[i202] = true;
} else if (!this.pollUnvoteInProgress || size8 != 0) {
imageReceiverArr2[i202].setImageBitmap((Drawable) null);
this.pollAvatarImagesVisible[i202] = false;
}
i202++;
messageObject30 = messageObject;
z72 = true;
z73 = false;
i197 = 2;
arrayList10 = null;
f16 = 0.0f;
}
} else if (this.pollAvatarImages != null) {
int i203 = 0;
while (true) {
ImageReceiver[] imageReceiverArr3 = this.pollAvatarImages;
if (i203 >= imageReceiverArr3.length) {
break;
}
imageReceiverArr3[i203].setImageBitmap((Drawable) null);
this.pollAvatarImagesVisible[i203] = false;
i203++;
}
}
if (!this.animatePollAnswer && this.pollVoteInProgress && this.vibrateOnPollVote) {
performHapticFeedback(3, i197);
}
boolean z74 = (this.attachedToWindow && (this.pollVoteInProgress || this.pollUnvoteInProgress)) ? z72 ? 1 : 0 : z73 ? 1 : 0;
this.animatePollAnswer = z74;
this.animatePollAnswerAlpha = z74;
ArrayList arrayList11 = new ArrayList();
if (this.pollButtons.isEmpty()) {
arrayList2 = arrayList10;
z19 = z72;
z18 = z73;
} else {
ArrayList arrayList12 = new ArrayList(this.pollButtons);
this.pollButtons.clear();
if (!this.animatePollAnswer) {
this.animatePollAnswer = (this.attachedToWindow && (this.pollVoted || this.pollClosed)) ? z72 ? 1 : 0 : z73 ? 1 : 0;
}
float f18 = this.pollAnimationProgress;
if (f18 > f16 && f18 < 1.0f) {
int size9 = arrayList12.size();
int i204 = z73 ? 1 : 0;
z72 = z72;
z73 = z73;
while (i204 < size9) {
PollButton pollButton = (PollButton) arrayList12.get(i204);
pollButton.percent = (int) Math.ceil(pollButton.prevPercent + ((pollButton.percent - pollButton.prevPercent) * this.pollAnimationProgress));
pollButton.percentProgress = pollButton.prevPercentProgress + ((pollButton.percentProgress - pollButton.prevPercentProgress) * this.pollAnimationProgress);
i204++;
messageObject30 = messageObject;
z72 = true;
z73 = false;
i197 = 2;
arrayList10 = null;
f16 = 0.0f;
}
}
arrayList2 = arrayList12;
z19 = z72;
z18 = z73;
}
this.pollAnimationProgress = !this.animatePollAnswer ? 1.0f : f16;
if (this.animatePollAnswerAlpha) {
arrayList3 = arrayList10;
} else {
this.pollVoteInProgress = z18;
this.pollVoteInProgressNum = -1;
arrayList3 = SendMessagesHelper.getInstance(this.currentAccount).isSendingVote(this.currentMessageObject);
}
StaticLayout staticLayout14 = this.titleLayout;
int height = staticLayout14 == null ? z18 ? 1 : 0 : staticLayout14.getHeight();
int i205 = 100;
int size10 = tLRPC$TL_messageMediaPoll3.poll.answers.size();
?? r69 = arrayList3;
int i206 = z18 ? 1 : 0;
int i207 = i206;
int i208 = i207;
int i209 = i208;
?? r6 = z19;
?? r74 = z18;
while (i206 < size10) {
PollButton pollButton2 = new PollButton();
pollButton2.answer = tLRPC$TL_messageMediaPoll3.poll.answers.get(i206);
int i210 = size10;
pollButton2.title = new StaticLayout(Emoji.replaceEmoji((CharSequence) pollButton2.answer.text, Theme.chat_audioPerformerPaint.getFontMetricsInt(), AndroidUtilities.dp(15.0f), false), Theme.chat_audioPerformerPaint, min4 - AndroidUtilities.dp(33.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
pollButton2.y = AndroidUtilities.dp(52.0f) + height;
pollButton2.height = pollButton2.title.getHeight();
this.pollButtons.add(pollButton2);
arrayList11.add(pollButton2);
height += pollButton2.height + AndroidUtilities.dp(26.0f);
if (!tLRPC$TL_messageMediaPoll3.results.results.isEmpty()) {
int size11 = tLRPC$TL_messageMediaPoll3.results.results.size();
int i211 = 0;
while (true) {
if (i211 >= size11) {
break;
}
TLRPC$TL_pollAnswerVoters tLRPC$TL_pollAnswerVoters2 = tLRPC$TL_messageMediaPoll3.results.results.get(i211);
if (Arrays.equals(pollButton2.answer.option, tLRPC$TL_pollAnswerVoters2.option)) {
pollButton2.chosen = tLRPC$TL_pollAnswerVoters2.chosen;
pollButton2.count = tLRPC$TL_pollAnswerVoters2.voters;
pollButton2.correct = tLRPC$TL_pollAnswerVoters2.correct;
if ((!this.pollVoted && !this.pollClosed) || (i24 = tLRPC$TL_messageMediaPoll3.results.total_voters) <= 0) {
pollButton2.percent = 0;
pollButton2.decimal = 0.0f;
} else {
pollButton2.decimal = (tLRPC$TL_pollAnswerVoters2.voters / i24) * 100.0f;
pollButton2.percent = (int) pollButton2.decimal;
PollButton.access$3124(pollButton2, pollButton2.percent);
}
if (i207 != 0) {
if (pollButton2.percent != 0 && i207 != pollButton2.percent) {
i209 = 1;
}
} else {
i207 = pollButton2.percent;
}
i205 -= pollButton2.percent;
i208 = Math.max(pollButton2.percent, i208);
} else {
i211++;
}
}
}
if (arrayList2 != null) {
int size12 = arrayList2.size();
int i212 = 0;
while (true) {
if (i212 >= size12) {
break;
}
PollButton pollButton3 = (PollButton) arrayList2.get(i212);
if (Arrays.equals(pollButton2.answer.option, pollButton3.answer.option)) {
pollButton2.prevPercent = pollButton3.percent;
pollButton2.prevPercentProgress = pollButton3.percentProgress;
pollButton2.prevChosen = pollButton3.chosen;
break;
}
i212++;
}
}
byte[] bArr = r69;
if (bArr != null && pollButton2.answer.option.length > 0 && Arrays.binarySearch(bArr, pollButton2.answer.option[0]) >= 0) {
this.pollVoteInProgressNum = i206;
this.pollVoteInProgress = true;
this.vibrateOnPollVote = true;
r69 = null;
} else {
r69 = bArr;
}
if (this.currentMessageObject.checkedVotes.contains(pollButton2.answer)) {
this.pollCheckBox[i206].setChecked(true, false);
} else {
this.pollCheckBox[i206].setChecked(false, false);
}
i206++;
messageObject30 = messageObject;
size10 = i210;
r6 = 1;
r74 = 0;
i197 = 2;
f16 = 0.0f;
}
if (i209 != 0 && i205 != 0) {
Collections.sort(arrayList11, new Comparator() {
@Override
public final int compare(Object obj5, Object obj6) {
int lambda$setMessageContent$8;
lambda$setMessageContent$8 = ChatMessageCell.lambda$setMessageContent$8((ChatMessageCell.PollButton) obj5, (ChatMessageCell.PollButton) obj6);
return lambda$setMessageContent$8;
}
});
int min5 = Math.min(i205, arrayList11.size());
int i213 = r74;
while (i213 < min5) {
PollButton.access$2412((PollButton) arrayList11.get(i213), r6);
i213++;
i197 = 2;
}
}
int dp38 = this.backgroundWidth - AndroidUtilities.dp(76.0f);
int size13 = this.pollButtons.size();
int i214 = r74;
while (i214 < size13) {
this.pollButtons.get(i214).percentProgress = Math.max(AndroidUtilities.dp(5.0f) / dp38, i208 == 0 ? f16 : r2.percent / i208);
i214++;
i197 = 2;
}
setMessageObjectInternal(messageObject);
this.pollInstantViewTouchesBottom = r74;
if (this.isBot && !this.drawInstantView) {
height -= AndroidUtilities.dp(10.0f);
} else {
TLRPC$Poll tLRPC$Poll7 = tLRPC$TL_messageMediaPoll3.poll;
if (tLRPC$Poll7.public_voters || tLRPC$Poll7.multiple_choice) {
this.pollInstantViewTouchesBottom = r6;
height += AndroidUtilities.dp(13.0f);
}
}
int dp39 = AndroidUtilities.dp(73.0f);
int i215 = this.namesOffset;
this.totalHeight = dp39 + i215 + height;
if (this.drawPinnedTop) {
this.namesOffset = i215 - AndroidUtilities.dp(1.0f);
}
this.instantTextNewLine = r74;
TLRPC$Poll tLRPC$Poll8 = tLRPC$TL_messageMediaPoll3.poll;
if (tLRPC$Poll8.public_voters || tLRPC$Poll8.multiple_choice) {
int i216 = r74;
for (int i217 = i216; i217 < 3; i217++) {
if (i217 == 0) {
string4 = LocaleController.getString("PollViewResults", org.telegram.messenger.R.string.PollViewResults);
} else if (i217 == r6) {
string4 = LocaleController.getString("PollSubmitVotes", org.telegram.messenger.R.string.PollSubmitVotes);
} else {
string4 = LocaleController.getString("NoVotes", org.telegram.messenger.R.string.NoVotes);
}
i216 = Math.max(i216, (int) Math.ceil(Theme.chat_instantViewPaint.measureText(string4)));
}
int dp40 = this.timeWidth + (!messageObject.isOutOwner() ? r74 : AndroidUtilities.dp(20.0f)) + getExtraTimeX();
ReactionsLayoutInBubble reactionsLayoutInBubble14 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble14.isSmall && reactionsLayoutInBubble14.isEmpty && dp40 >= ((this.backgroundWidth - AndroidUtilities.dp(76.0f)) - i216) / i197) {
this.totalHeight += AndroidUtilities.dp(18.0f);
this.instantTextNewLine = r6;
}
}
ReactionsLayoutInBubble reactionsLayoutInBubble15 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble15.isSmall && !reactionsLayoutInBubble15.isEmpty) {
reactionsLayoutInBubble15.measure(min4, 3);
this.totalHeight += this.reactionsLayoutInBubble.height + AndroidUtilities.dp(12.0f);
if (this.timeWidth + (!messageObject.isOutOwner() ? r74 : AndroidUtilities.dp(20.0f)) + getExtraTimeX() >= (this.backgroundWidth - AndroidUtilities.dp(24.0f)) - this.reactionsLayoutInBubble.lastLineX) {
this.totalHeight += AndroidUtilities.dp(16.0f);
this.reactionsLayoutInBubble.positionOffsetY -= AndroidUtilities.dp(16.0f);
}
}
f = 50.0f;
messageObject2 = messageObject30;
i3 = 20;
i4 = 3;
i5 = 4;
z11 = false;
f2 = 1.0f;
} else {
this.drawForwardedName = (!(messageObject20.messageOwner.fwd_from == null || (messageObject.isAnyKindOfSticker() && messageObject.isDice())) || messageObject20.type == 23) ? z58 ? 1 : 0 : false;
if (!messageObject.isAnyKindOfSticker() && messageObject20.type != 5) {
this.drawName = (((this.isSavedChat && !messageObject.isOutOwner() && (messageObject.getSavedDialogId() < j || messageObject.getSavedDialogId() == UserObject.ANONYMOUS)) || ((messageObject.isFromGroup() && messageObject.isSupergroup()) || messageObject20.isRepostPreview || (messageObject.isImportedForward() && messageObject20.messageOwner.fwd_from.from_id == null))) && ((groupedMessagePosition9 = this.currentPosition) == null || (groupedMessagePosition9.flags & 4) != 0)) ? z58 ? 1 : 0 : false;
}
this.mediaBackground = messageObject20.type == 9 ? false : z58 ? 1 : 0;
this.drawImageButton = z58;
this.drawPhotoImage = z58;
if (messageObject20.gifState != 2.0f && (!SharedConfig.isAutoplayGifs() || messageObject20.isRepostPreview)) {
int i218 = messageObject20.type;
i25 = 8;
if (i218 == 8 || i218 == 5) {
f5 = 1.0f;
messageObject20.gifState = 1.0f;
} else {
f5 = 1.0f;
}
} else {
f5 = 1.0f;
i25 = 8;
}
this.photoImage.setAllowDecodeSingleFrame(z58);
if (messageObject.isVideo()) {
this.photoImage.setAllowStartAnimation(z58);
} else if (messageObject.isRoundVideo()) {
MessageObject playingMessageObject = MediaController.getInstance().getPlayingMessageObject();
this.photoImage.setAllowStartAnimation((playingMessageObject != null && playingMessageObject.isRoundVideo()) ? false : z58 ? 1 : 0);
} else {
this.photoImage.setAllowStartAnimation(messageObject20.gifState != 0.0f ? false : z58 ? 1 : 0);
}
this.photoImage.setForcePreview(messageObject.needDrawBluredPreview());
int i219 = messageObject20.type;
if (i219 == 9) {
int i220 = i2;
messageObject6 = messageObject20;
f6 = 50.0f;
i26 = 3;
i27 = 4;
f7 = f5;
if (AndroidUtilities.isTablet()) {
this.backgroundWidth = Math.min(AndroidUtilities.getMinTabletSide() - AndroidUtilities.dp(!z8 ? 50.0f : 102.0f), AndroidUtilities.dp(300.0f));
} else {
this.backgroundWidth = Math.min(getParentWidth() - AndroidUtilities.dp(!z8 ? 50.0f : 102.0f), AndroidUtilities.dp(300.0f));
}
if (checkNeedDrawShareButton(messageObject)) {
this.backgroundWidth -= AndroidUtilities.dp(20.0f);
}
int dp41 = this.backgroundWidth - AndroidUtilities.dp(138.0f);
createDocumentLayout(dp41, messageObject6);
int dp42 = (this.backgroundWidth - AndroidUtilities.dp(31.0f)) - AndroidUtilities.dp(10.0f);
this.captionFullWidth = dp42;
int extraTextX = dp42 - (getExtraTextX() * i220);
StaticLayout staticLayout15 = this.docTitleLayout;
if (staticLayout15 == null) {
i28 = 0;
} else {
int lineCount4 = staticLayout15.getLineCount();
int i221 = 0;
i28 = 0;
while (i221 < lineCount4) {
i28 = Math.max(i28, ((int) Math.ceil(this.docTitleLayout.getLineWidth(i221) + this.docTitleLayout.getLineLeft(i221))) + AndroidUtilities.dp(86 + (!this.drawPhotoImage ? 22 : 52)));
i221++;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
}
StaticLayout staticLayout16 = this.infoLayout;
if (staticLayout16 != null) {
int lineCount5 = staticLayout16.getLineCount();
int i222 = 0;
while (i222 < lineCount5) {
i28 = Math.max(i28, this.infoWidth + AndroidUtilities.dp(86 + (!this.drawPhotoImage ? 22 : 52)));
i222++;
i27 = 4;
f7 = 1.0f;
}
}
MessageObject.TextLayoutBlocks textLayoutBlocks4 = this.captionLayout;
if (textLayoutBlocks4 != null) {
i28 = Math.max(textLayoutBlocks4.textWidth, i28);
}
ReactionsLayoutInBubble reactionsLayoutInBubble16 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble16.isSmall) {
reactionsLayoutInBubble16.measure(extraTextX, i26);
ReactionsLayoutInBubble reactionsLayoutInBubble17 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble17.isEmpty && reactionsLayoutInBubble17.width + AndroidUtilities.dp(31.0f) > i28) {
i28 = this.reactionsLayoutInBubble.width + AndroidUtilities.dp(31.0f);
}
}
if (i28 > 0 && this.currentPosition == null) {
this.backgroundWidth = i28;
dp41 = i28 - AndroidUtilities.dp(31.0f);
}
this.availableTimeWidth = dp41;
if (this.drawPhotoImage) {
i29 = 1;
dp5 = AndroidUtilities.dp(86.0f);
dp6 = AndroidUtilities.dp(86.0f);
this.availableTimeWidth -= dp5;
} else {
dp5 = AndroidUtilities.dp(56.0f);
dp6 = AndroidUtilities.dp(56.0f);
StaticLayout staticLayout17 = this.docTitleLayout;
if (staticLayout17 == null) {
i29 = 1;
} else {
i29 = 1;
if (staticLayout17.getLineCount() > 1) {
dp6 += (this.docTitleLayout.getLineCount() - 1) * AndroidUtilities.dp(16.0f);
}
}
if (TextUtils.isEmpty(messageObject6.caption) && (staticLayout3 = this.infoLayout) != null) {
int lineCount6 = staticLayout3.getLineCount();
measureTime(messageObject);
int dp43 = (this.backgroundWidth - AndroidUtilities.dp(122.0f)) - this.infoWidth;
ReactionsLayoutInBubble reactionsLayoutInBubble18 = this.reactionsLayoutInBubble;
if (reactionsLayoutInBubble18.isSmall || reactionsLayoutInBubble18.isEmpty) {
if (dp43 < this.timeWidth) {
dp7 = AndroidUtilities.dp(12.0f);
} else if (lineCount6 == i29) {
dp7 = AndroidUtilities.dp(4.0f);
}
dp6 += dp7;
}
}
}
i30 = dp6;
ReactionsLayoutInBubble reactionsLayoutInBubble19 = this.reactionsLayoutInBubble;
if (reactionsLayoutInBubble19.isSmall || reactionsLayoutInBubble19.isEmpty) {
i31 = 0;
i32 = 0;
} else {
if (!this.drawPhotoImage) {
reactionsLayoutInBubble19.positionOffsetY += AndroidUtilities.dp(2.0f);
}
if (this.captionLayout != null && this.currentPosition != null && (groupedMessages6 = this.currentMessagesGroup) != null && groupedMessages6.isDocuments) {
this.reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(10.0f);
} else if (!this.drawPhotoImage && !TextUtils.isEmpty(messageObject6.caption) && ((((staticLayout2 = this.docTitleLayout) != null && staticLayout2.getLineCount() > i29) || this.currentMessageObject.hasValidReplyMessageObject()) && !this.currentMessageObject.isForwarded())) {
this.reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(10.0f);
} else if (!this.drawPhotoImage && !TextUtils.isEmpty(messageObject6.caption) && !this.currentMessageObject.isOutOwner()) {
this.reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(10.0f);
}
ReactionsLayoutInBubble reactionsLayoutInBubble20 = this.reactionsLayoutInBubble;
reactionsLayoutInBubble20.totalHeight = reactionsLayoutInBubble20.height + AndroidUtilities.dp(8.0f);
measureTime(messageObject);
if (this.drawPhotoImage && this.captionLayout == null) {
this.reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(8.0f);
}
if (!this.drawPhotoImage && this.captionLayout != null && (messageObject7 = this.currentMessageObject) != null && messageObject7.isOutOwner() && this.currentMessageObject.isDocument() && this.currentMessagesGroup == null && !this.currentMessageObject.isForwarded() && !this.currentMessageObject.isReply()) {
this.reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(10.0f);
}
if ((this.backgroundWidth - this.reactionsLayoutInBubble.lastLineX) - AndroidUtilities.dp(31.0f) < this.timeWidth) {
this.reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(12.0f);
this.reactionsLayoutInBubble.positionOffsetY -= AndroidUtilities.dp(12.0f);
}
i31 = 0;
i32 = this.reactionsLayoutInBubble.totalHeight + 0;
}
i7 = i29;
i33 = i32;
i34 = i31;
} else if (i219 != 4) {
if (i219 == 19) {
f8 = f5;
messageObject9 = messageObject20;
this.drawBackground = false;
int i223 = messageObject9.textWidth;
i30 = messageObject9.textHeight + AndroidUtilities.dp(32.0f);
this.backgroundWidth = AndroidUtilities.dp(14.0f) + i223;
this.availableTimeWidth = i223 - AndroidUtilities.dp(12.0f);
if (AndroidUtilities.isTablet()) {
minTabletSide3 = AndroidUtilities.getMinTabletSide();
f9 = 0.4f;
} else {
minTabletSide3 = Math.min(getParentWidth(), AndroidUtilities.displaySize.y);
f9 = 0.5f;
}
int max10 = Math.max(this.backgroundWidth, (int) (minTabletSide3 * f9));
ReactionsLayoutInBubble reactionsLayoutInBubble21 = this.reactionsLayoutInBubble;
if (reactionsLayoutInBubble21.isSmall) {
dp10 = 0;
} else {
reactionsLayoutInBubble21.measure(max10, !this.currentMessageObject.isOutOwner() ? 3 : 5);
ReactionsLayoutInBubble reactionsLayoutInBubble22 = this.reactionsLayoutInBubble;
reactionsLayoutInBubble22.drawServiceShaderBackground = f8;
int i224 = reactionsLayoutInBubble22.height;
reactionsLayoutInBubble22.totalHeight = i224;
dp10 = 0 + i224 + AndroidUtilities.dp(8.0f);
this.reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(8.0f);
}
if (!this.drawTopic || (((messageObject10 = this.currentMessageObject) == null || messageObject10.replyMessageObject == null) && ((staticLayoutArr = this.forwardedNameLayout) == null || staticLayoutArr[0] == null))) {
dp10 -= AndroidUtilities.dp(17.0f);
}
i33 = dp10;
dp5 = i223;
i31 = 0;
i34 = 0;
f6 = 50.0f;
i29 = 1;
i26 = 3;
i27 = 4;
i7 = 1;
} else if (messageObject.isAnyKindOfSticker()) {
MessageObject messageObject31 = messageObject20;
this.drawBackground = false;
boolean z75 = messageObject31.type == 13;
TLRPC$Document document3 = messageObject.getDocument();
if (document3 != null) {
for (int i225 = 0; i225 < document3.attributes.size(); i225++) {
TLRPC$DocumentAttribute tLRPC$DocumentAttribute8 = document3.attributes.get(i225);
if (tLRPC$DocumentAttribute8 instanceof TLRPC$TL_documentAttributeImageSize) {
i47 = tLRPC$DocumentAttribute8.w;
i48 = tLRPC$DocumentAttribute8.h;
} else if (tLRPC$DocumentAttribute8 instanceof TLRPC$TL_documentAttributeVideo) {
i47 = tLRPC$DocumentAttribute8.w;
i48 = tLRPC$DocumentAttribute8.h;
}
i49 = i47;
}
}
i48 = 0;
i49 = 0;
if ((messageObject.isAnimatedSticker() || messageObject.isVideoSticker()) && i49 == 0 && i48 == 0) {
i49 = 512;
i48 = 512;
}
if (messageObject.isAnimatedAnimatedEmoji()) {
i49 = Math.max(512, i49);
i48 = Math.max(512, i48);
if (MessageObject.isTextColorEmoji(messageObject.getDocument())) {
this.photoImage.setColorFilter(getAdaptiveEmojiColorFilter(0, getThemedColor(Theme.key_windowBackgroundWhiteBlackText)));
}
}
if (AndroidUtilities.isTablet()) {
minTabletSide4 = AndroidUtilities.getMinTabletSide();
f10 = 0.4f;
} else {
minTabletSide4 = Math.min(getParentWidth(), AndroidUtilities.displaySize.y);
f10 = 0.5f;
}
int i226 = (int) (minTabletSide4 * f10);
float f19 = i226;
if (messageObject.isAnimatedEmoji() || messageObject.isDice()) {
float f20 = MessagesController.getInstance(this.currentAccount).animatedEmojisZoom;
i50 = (int) ((i48 / 512.0f) * f19 * f20);
i51 = (int) ((i49 / 512.0f) * i226 * f20);
} else {
if (i49 == 0) {
i48 = (int) f19;
i49 = i48 + AndroidUtilities.dp(100.0f);
}
float f21 = i226;
int i227 = (int) (i48 * (f21 / i49));
float f22 = i227;
if (f22 <= f19) {
i51 = i226;
i50 = i227;
} else {
i51 = (int) (f21 * (f19 / f22));
i50 = (int) f19;
}
}
float f23 = AndroidUtilities.density;
int i228 = (int) (i51 / f23);
int i229 = (int) (i50 / f23);
ChatMessageCellDelegate chatMessageCellDelegate4 = this.delegate;
boolean z76 = chatMessageCellDelegate4 != null && chatMessageCellDelegate4.shouldRepeatSticker(messageObject31);
BitmapDrawable bitmapDrawable8 = this.currentMessageObject.strippedThumb;
if (bitmapDrawable8 == null) {
this.currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(messageObject31.photoThumbs, 40);
} else {
this.currentPhotoObjectThumbStripped = bitmapDrawable8;
}
this.photoParentObject = messageObject31.photoThumbsObject;
if (messageObject.isDice()) {
String format2 = String.format(Locale.US, "%d_%d_dice_%s_%s", Integer.valueOf(i228), Integer.valueOf(i229), messageObject.getDiceEmoji(), messageObject.toString());
this.photoImage.setAutoRepeat(2);
String diceEmoji = this.currentMessageObject.getDiceEmoji();
TLRPC$TL_messages_stickerSet stickerSetByEmojiOrName = MediaDataController.getInstance(this.currentAccount).getStickerSetByEmojiOrName(diceEmoji);
if (stickerSetByEmojiOrName != null && stickerSetByEmojiOrName.documents.size() > 0 && this.currentMessageObject.getDiceValue() <= 0) {
TLRPC$Document tLRPC$Document11 = stickerSetByEmojiOrName.documents.get(0);
if ("🎰".equals(diceEmoji)) {
drawable2 = null;
this.currentPhotoObjectThumb = null;
} else {
this.currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Document11.thumbs, 40);
drawable2 = null;
}
this.photoParentObject = tLRPC$Document11;
} else {
drawable2 = null;
}
str2 = format2;
drawable3 = drawable2;
obj = messageObject31;
} else {
if (messageObject.isAnimatedEmoji()) {
if (!LiteMode.isEnabled(LiteMode.FLAG_ANIMATED_EMOJI_CHAT)) {
String format3 = String.format(Locale.US, "%d_%d_nr_messageId=%d" + messageObject31.emojiAnimatedStickerColor, Integer.valueOf(i228), Integer.valueOf(i229), Integer.valueOf(messageObject31.stableId));
Drawable circleThumb = DocumentObject.getCircleThumb(0.4f, Theme.key_chat_serviceBackground, this.resourcesProvider, 0.65f);
this.photoImage.setAutoRepeat(3);
messageObject.loadAnimatedEmojiDocument();
str2 = format3;
drawable3 = circleThumb;
} else if (messageObject31.emojiAnimatedSticker == null && messageObject31.emojiAnimatedStickerId != null) {
String format4 = String.format(Locale.US, "%d_%d_nr_messageId=%d" + messageObject31.emojiAnimatedStickerColor, Integer.valueOf(i228), Integer.valueOf(i229), Integer.valueOf(messageObject31.stableId));
drawable3 = DocumentObject.getCircleThumb(0.4f, Theme.key_chat_serviceBackground, this.resourcesProvider, 0.65f);
this.photoImage.setAutoRepeat(1);
messageObject.loadAnimatedEmojiDocument();
str2 = format4;
} else {
String format5 = String.format(Locale.US, "%d_%d_nr_messageId=%d" + messageObject31.emojiAnimatedStickerColor, Integer.valueOf(i228), Integer.valueOf(i229), Integer.valueOf(messageObject31.stableId));
if (MessageObject.isAnimatedEmoji(messageObject31.emojiAnimatedSticker)) {
z20 = true;
this.photoImage.setAutoRepeat(1);
} else {
this.photoImage.setAutoRepeat(!z76 ? 3 : 2);
z20 = true;
}
Object inputStickerSet = MessageObject.getInputStickerSet(messageObject31.emojiAnimatedSticker);
if (messageObject31.emojiAnimatedStickerId != null) {
this.photoImage.setCrossfadeWithOldImage(z20);
}
str2 = format5;
obj = inputStickerSet;
}
obj = messageObject31;
drawable2 = null;
} else {
if (SharedConfig.loopStickers() || (z75 && !messageObject.isVideoSticker())) {
format = String.format(Locale.US, "%d_%d", Integer.valueOf(i228), Integer.valueOf(i229));
this.photoImage.setAutoRepeat(1);
} else {
format = String.format(Locale.US, "%d_%d_nr_messageId=%d", Integer.valueOf(i228), Integer.valueOf(i229), Integer.valueOf(messageObject31.stableId));
this.photoImage.setAutoRepeat(!z76 ? 3 : 2);
}
str2 = format;
obj = messageObject31;
}
drawable3 = null;
drawable2 = null;
}
this.documentAttachType = 6;
this.availableTimeWidth = i51 - AndroidUtilities.dp(14.0f);
this.backgroundWidth = AndroidUtilities.dp(12.0f) + i51;
this.photoImage.setRoundRadius(0);
if (!messageObject.isOutOwner() && MessageObject.isPremiumSticker(messageObject.getDocument())) {
this.flipImage = true;
}
if (messageObject.getDocument() != null) {
messageObject9 = messageObject31;
i52 = 0;
f8 = 1.0f;
Drawable drawable4 = drawable2;
if (messageObject.isVideoSticker()) {
if (!loopStickers()) {
this.photoImage.animatedFileDrawableRepeatMaxCount = 1;
}
this.photoImage.setImage(ImageLocation.getForDocument(messageObject.getDocument()), ImageLoader.AUTOPLAY_FILTER, null, null, messageObject9.pathThumb, messageObject.getDocument().size, !z75 ? drawable4 : "webp", obj, 1);
r11 = drawable4;
} else if (messageObject9.pathThumb != null) {
this.photoImage.setImage(ImageLocation.getForDocument(messageObject.getDocument()), str2, messageObject9.pathThumb, messageObject.getDocument().size, !z75 ? drawable4 : "webp", obj, 1);
r11 = drawable4;
} else if (messageObject9.attachPathExists) {
this.photoImage.setImage(ImageLocation.getForPath(messageObject9.messageOwner.attachPath), str2, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), "b1", drawable3 == null ? this.currentPhotoObjectThumbStripped : drawable3, messageObject.getDocument().size, !z75 ? drawable4 : "webp", obj, 1);
r11 = drawable4;
} else if (messageObject.getDocument().id != 0) {
this.photoImage.setImage(ImageLocation.getForDocument(messageObject.getDocument()), str2, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), "b1", drawable3 == null ? this.currentPhotoObjectThumbStripped : drawable3, messageObject.getDocument().size, !z75 ? drawable4 : "webp", obj, 1);
r11 = drawable4;
} else {
this.photoImage.setImage(null, null, drawable3, null, messageObject, 0);
r11 = drawable4;
}
} else {
f8 = 1.0f;
r11 = drawable2;
i52 = 0;
messageObject9 = messageObject31;
this.photoImage.setImage(null, null, drawable3, null, messageObject, 0);
}
ReactionsLayoutInBubble reactionsLayoutInBubble23 = this.reactionsLayoutInBubble;
if (reactionsLayoutInBubble23.isSmall) {
i53 = i52;
} else {
reactionsLayoutInBubble23.measure(i226 + AndroidUtilities.dp(36.0f), (this.currentMessageObject.isOutOwner() && (this.currentMessageObject.isAnimatedEmoji() || this.currentMessageObject.isAnyKindOfSticker())) ? 5 : 3);
ReactionsLayoutInBubble reactionsLayoutInBubble24 = this.reactionsLayoutInBubble;
reactionsLayoutInBubble24.drawServiceShaderBackground = f8;
reactionsLayoutInBubble24.totalHeight = reactionsLayoutInBubble24.height + AndroidUtilities.dp(8.0f);
i53 = this.reactionsLayoutInBubble.totalHeight + i52;
if (!this.currentMessageObject.isAnimatedEmoji()) {
this.reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(4.0f);
}
}
if (this.blurredPhotoImage.getBitmap() != null) {
this.blurredPhotoImage.getBitmap().recycle();
this.blurredPhotoImage.setImageBitmap(r11);
}
if (this.photoImage.getBitmap() != null && !this.photoImage.getBitmap().isRecycled() && this.currentMessageObject.hasMediaSpoilers() && !this.currentMessageObject.isMediaSpoilersRevealed) {
this.blurredPhotoImage.setImageBitmap(Utilities.stackBlurBitmapMax(this.photoImage.getBitmap(), this.currentMessageObject.isRoundVideo()));
this.blurredPhotoImage.setColorFilter(getFancyBlurFilter());
}
i33 = i53;
i30 = i50;
dp5 = i51;
i31 = i52;
i7 = i31;
i34 = i7;
f6 = 50.0f;
i29 = 1;
i26 = 3;
i27 = 4;
} else {
this.currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(messageObject20.photoThumbs, AndroidUtilities.getPhotoSize());
this.photoParentObject = messageObject20.photoThumbsObject;
if (messageObject20.type == 5) {
this.documentAttach = messageObject.getDocument();
this.documentAttachType = 7;
i54 = 0;
} else {
if (AndroidUtilities.isTablet()) {
minTabletSide7 = AndroidUtilities.getMinTabletSide();
} else {
TLRPC$PhotoSize tLRPC$PhotoSize37 = this.currentPhotoObject;
if (tLRPC$PhotoSize37 != null && (((i82 = messageObject20.type) == z58 || i82 == 20 || i82 == 3 || i82 == i25) && tLRPC$PhotoSize37.w >= tLRPC$PhotoSize37.h)) {
i54 = Math.min(getParentWidth(), AndroidUtilities.displaySize.y) - AndroidUtilities.dp(64 + (!checkNeedDrawShareButton(messageObject) ? 0 : 10));
z21 = z58 ? 1 : 0;
int dp44 = AndroidUtilities.dp(100.0f) + i54;
if (z21) {
if (messageObject20.type != 5 && checkNeedDrawShareButton(messageObject)) {
i54 -= AndroidUtilities.dp(20.0f);
}
if (i54 > AndroidUtilities.getPhotoSize()) {
i54 = AndroidUtilities.getPhotoSize();
}
if (dp44 > AndroidUtilities.getPhotoSize()) {
dp44 = AndroidUtilities.getPhotoSize();
}
} else if (z8) {
i54 -= AndroidUtilities.dp(52.0f);
}
i55 = messageObject20.type;
if (i55 == z58 || i55 == 20) {
updateSecretTimeText(messageObject);
this.currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(messageObject20.photoThumbs, 40);
} else {
if (i55 == 3 || i55 == i25) {
createDocumentLayout(0, messageObject20);
this.currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(messageObject20.photoThumbs, 40);
updateSecretTimeText(messageObject);
} else if (i55 == 5) {
this.currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(messageObject20.photoThumbs, 40);
}
z22 = z58 ? 1 : 0;
bitmapDrawable = this.currentMessageObject.strippedThumb;
if (bitmapDrawable != null) {
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = bitmapDrawable;
}
if (messageObject20.type == 5) {
if (this.isPlayingRound && !messageObject.isVoiceTranscriptionOpen()) {
i56 = AndroidUtilities.roundPlayingMessageSize;
} else {
i56 = AndroidUtilities.roundMessageSize;
}
i30 = i56;
} else {
TLRPC$PhotoSize tLRPC$PhotoSize38 = this.currentPhotoObject;
if (tLRPC$PhotoSize38 == null) {
tLRPC$PhotoSize38 = this.currentPhotoObjectThumb;
}
if (messageObject.hasExtendedMediaPreview()) {
TLRPC$TL_messageExtendedMediaPreview tLRPC$TL_messageExtendedMediaPreview = (TLRPC$TL_messageExtendedMediaPreview) messageObject20.messageOwner.media.extended_media;
int i230 = tLRPC$TL_messageExtendedMediaPreview.w;
if (i230 == 0 || (i81 = tLRPC$TL_messageExtendedMediaPreview.h) == 0) {
TLRPC$PhotoSize tLRPC$PhotoSize39 = tLRPC$TL_messageExtendedMediaPreview.thumb;
if (tLRPC$PhotoSize39 == null) {
i78 = 0;
i230 = 0;
} else {
i230 = tLRPC$PhotoSize39.w;
i78 = tLRPC$PhotoSize39.h;
}
} else {
i78 = i81;
}
int i231 = i230;
i79 = i78;
i80 = i231;
} else if (tLRPC$PhotoSize38 != null && !(tLRPC$PhotoSize38 instanceof TLRPC$TL_photoStrippedSize)) {
i80 = tLRPC$PhotoSize38.w;
i79 = tLRPC$PhotoSize38.h;
} else {
TLRPC$Document tLRPC$Document12 = this.documentAttach;
if (tLRPC$Document12 == null) {
i80 = 0;
i79 = 0;
} else {
int size14 = tLRPC$Document12.attributes.size();
int i232 = 0;
int i233 = 0;
for (int i234 = 0; i234 < size14; i234++) {
TLRPC$DocumentAttribute tLRPC$DocumentAttribute9 = this.documentAttach.attributes.get(i234);
if (tLRPC$DocumentAttribute9 instanceof TLRPC$TL_documentAttributeVideo) {
int i235 = tLRPC$DocumentAttribute9.w;
i233 = tLRPC$DocumentAttribute9.h;
i232 = i235;
}
}
i80 = i232;
i79 = i233;
}
}
Point messageSize = getMessageSize(i80, i79, i54, dp44);
i56 = (int) messageSize.x;
i30 = (int) messageSize.y;
}
tLRPC$PhotoSize = this.currentPhotoObject;
if (tLRPC$PhotoSize != null && "s".equals(tLRPC$PhotoSize.type)) {
this.currentPhotoObject = null;
}
tLRPC$PhotoSize2 = this.currentPhotoObject;
if (tLRPC$PhotoSize2 != null && tLRPC$PhotoSize2 == this.currentPhotoObjectThumb) {
i77 = messageObject20.type;
if (i77 == z58 || i77 == 20) {
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = null;
} else {
this.currentPhotoObject = null;
}
}
if (z22 && !messageObject.needDrawBluredPreview() && (((tLRPC$PhotoSize5 = this.currentPhotoObject) == null || tLRPC$PhotoSize5 == this.currentPhotoObjectThumb) && ((tLRPC$PhotoSize6 = this.currentPhotoObjectThumb) == null || !"m".equals(tLRPC$PhotoSize6.type)))) {
this.photoImage.setNeedsQualityThumb(z58);
this.photoImage.setShouldGenerateQualityThumb(z58);
}
if (this.currentMessagesGroup == null && messageObject20.caption != null) {
this.mediaBackground = false;
}
if ((i56 != 0 || i30 == 0) && messageObject20.type == i25 && (document = messageObject.getDocument()) != null) {
for (i57 = 0; i57 < document.attributes.size(); i57++) {
TLRPC$DocumentAttribute tLRPC$DocumentAttribute10 = document.attributes.get(i57);
if ((tLRPC$DocumentAttribute10 instanceof TLRPC$TL_documentAttributeImageSize) || (tLRPC$DocumentAttribute10 instanceof TLRPC$TL_documentAttributeVideo)) {
int i236 = tLRPC$DocumentAttribute10.w;
float f24 = i54;
float f25 = i236 / f24;
int i237 = (int) (i236 / f25);
i30 = (int) (tLRPC$DocumentAttribute10.h / f25);
if (i30 > dp44) {
i56 = (int) (i237 / (i30 / dp44));
} else if (i30 >= AndroidUtilities.dp(120.0f)) {
i56 = i237;
dp44 = i30;
} else {
dp44 = AndroidUtilities.dp(120.0f);
float f26 = tLRPC$DocumentAttribute10.h / dp44;
int i238 = tLRPC$DocumentAttribute10.w;
if (i238 / f26 < f24) {
i237 = (int) (i238 / f26);
}
i56 = i237;
}
i30 = dp44;
}
}
dp44 = i30;
i30 = dp44;
}
if (i56 != 0 || i30 == 0) {
i30 = AndroidUtilities.dp(150.0f);
i56 = i30;
}
if (messageObject20.type == 3 && i56 < this.infoWidth + AndroidUtilities.dp(40.0f)) {
i56 = this.infoWidth + AndroidUtilities.dp(40.0f);
}
i58 = messageObject20.type;
if (i58 != 23 || i58 == 24) {
i56 = (int) Math.min(AndroidUtilities.displaySize.x * 0.53d, AndroidUtilities.dp(300.0f));
i30 = (int) ((i56 * 16.0f) / 9.0f);
}
if (this.commentLayout != null && this.drawSideButton != 3 && i56 < this.totalCommentWidth + AndroidUtilities.dp(10.0f)) {
i56 = this.totalCommentWidth + AndroidUtilities.dp(10.0f);
}
if (this.currentMessagesGroup != null) {
int groupPhotosWidth = getGroupPhotosWidth();
int i239 = 0;
int i240 = 0;
boolean z77 = z58;
while (i239 < this.currentMessagesGroup.posArray.size()) {
if (this.currentMessagesGroup.posArray.get(i239).minY != 0) {
break;
}
i240 = (int) (i240 + Math.ceil(((r9.pw + r9.leftSpanOffset) / 1000.0f) * groupPhotosWidth));
i239++;
messageObject20 = messageObject20;
i150 = i150;
f5 = 1.0f;
i25 = 8;
z77 = true;
i2 = 2;
}
this.availableTimeWidth = i240 - AndroidUtilities.dp(35.0f);
z23 = z77;
} else {
this.availableTimeWidth = i54 - AndroidUtilities.dp(14.0f);
z23 = z58;
}
if (messageObject20.type == 5) {
this.availableTimeWidth = (int) ((AndroidUtilities.roundMessageSize - Math.ceil(Theme.chat_audioTimePaint.measureText("00:00"))) - AndroidUtilities.dp(46.0f));
}
measureTime(messageObject);
dp11 = this.timeWidth + AndroidUtilities.dp((SharedConfig.bubbleRadius < 10 ? 18 : 22) + (!messageObject.isOutOwner() ? 0 : i150));
if (i56 < dp11) {
i56 = dp11;
}
if (messageObject.isRoundVideo()) {
int min6 = Math.min(i56, i30);
boolean isVoiceTranscriptionOpen = messageObject.isVoiceTranscriptionOpen();
this.drawBackground = isVoiceTranscriptionOpen;
this.mediaBackground = isVoiceTranscriptionOpen ? false : z23 ? 1 : 0;
int i241 = !isVoiceTranscriptionOpen ? min6 : 0;
this.photoImage.setRoundRadius(min6 / 2);
i56 = min6;
i30 = i241;
i59 = 0;
} else {
if (messageObject.needDrawBluredPreview() && !messageObject.hasExtendedMediaPreview()) {
if (AndroidUtilities.isTablet()) {
minTabletSide6 = AndroidUtilities.getMinTabletSide();
} else {
minTabletSide6 = Math.min(getParentWidth(), AndroidUtilities.displaySize.y);
}
i56 = (int) (minTabletSide6 * 0.6f);
i30 = (int) (i56 * 0.61f);
}
i59 = z23 ? 1 : 0;
}
if (this.currentMessagesGroup != null) {
float max11 = Math.max(getParentWidth(), AndroidUtilities.displaySize.y) * 0.5f;
float groupPhotosWidth2 = getGroupPhotosWidth();
int ceil5 = (int) Math.ceil((this.currentPosition.pw / 1000.0f) * groupPhotosWidth2);
boolean z78 = z23;
if (this.currentPosition.minY != 0) {
if (!messageObject.isOutOwner() || (this.currentPosition.flags & (z23 ? 1 : 0)) == 0) {
z78 = z23;
if (!messageObject.isOutOwner()) {
z78 = z23;
}
}
int i242 = 0;
int i243 = 0;
int i244 = 0;
boolean z79 = z23;
while (i242 < this.currentMessagesGroup.posArray.size()) {
MessageObject.GroupedMessagePosition groupedMessagePosition17 = this.currentMessagesGroup.posArray.get(i242);
byte b = groupedMessagePosition17.minY;
if (b == 0) {
i66 = i150;
i67 = dp11;
messageObject12 = messageObject20;
i243 = (int) (i243 + Math.ceil((groupedMessagePosition17.pw / 1000.0f) * groupPhotosWidth2) + (groupedMessagePosition17.leftSpanOffset == 0 ? 0.0d : Math.ceil((r2 / 1000.0f) * groupPhotosWidth2)));
} else {
byte b2 = this.currentPosition.minY;
if (b == b2) {
i67 = dp11;
messageObject12 = messageObject20;
i66 = 20;
i244 = (int) (i244 + Math.ceil((groupedMessagePosition17.pw / 1000.0f) * groupPhotosWidth2) + (groupedMessagePosition17.leftSpanOffset == 0 ? 0.0d : Math.ceil((r5 / 1000.0f) * groupPhotosWidth2)));
} else {
if (b > b2) {
break;
}
i67 = dp11;
messageObject12 = messageObject20;
i66 = 20;
}
}
i242++;
messageObject20 = messageObject12;
dp11 = i67;
i150 = i66;
f5 = 1.0f;
i25 = 8;
z79 = true;
i2 = 2;
}
ceil5 += i243 - i244;
z78 = z79;
}
int dp45 = ceil5 - AndroidUtilities.dp(9.0f);
if (this.isAvatarVisible) {
dp45 -= AndroidUtilities.dp(48.0f);
}
int i245 = dp45;
if (this.currentPosition.siblingHeights != null) {
int i246 = 0;
int i247 = 0;
boolean z80 = z78;
while (true) {
groupedMessagePosition6 = this.currentPosition;
if (i246 >= groupedMessagePosition6.siblingHeights.length) {
break;
}
i247 += (int) Math.ceil(r3[i246] * max11);
i246++;
i25 = 8;
z80 = true;
i2 = 2;
i245 = i245;
f5 = 1.0f;
}
round = i247 + ((groupedMessagePosition6.maxY - groupedMessagePosition6.minY) * Math.round(AndroidUtilities.density * 7.0f));
z24 = z80;
} else {
round = (int) Math.ceil(max11 * r0.ph);
z24 = z78;
}
this.backgroundWidth = i245;
int i248 = this.currentPosition.flags;
if ((i248 & 2) != 0 && (i248 & 1) != 0) {
dp12 = AndroidUtilities.dp(8.0f);
} else if ((i248 & 2) == 0 && (i248 & 1) == 0) {
dp12 = AndroidUtilities.dp(11.0f);
} else if ((i248 & i2) != 0) {
dp12 = AndroidUtilities.dp(10.0f);
} else {
dp12 = AndroidUtilities.dp(9.0f);
}
i60 = i245 - dp12;
i56 = this.currentPosition.edge ? i60 : AndroidUtilities.dp(10.0f) + i60;
int dp46 = (i56 - AndroidUtilities.dp(15.0f)) + 0;
MessageObject.GroupedMessagePosition groupedMessagePosition18 = this.currentPosition;
int i249 = groupedMessagePosition18.flags;
if ((i249 & 8) == 0) {
z25 = z24;
if (this.currentMessagesGroup.hasSibling) {
z25 = z24;
}
i65 = dp46;
i30 = round;
z26 = false;
r13 = z25;
}
int additionalWidthForPosition2 = dp46 + getAdditionalWidthForPosition(groupedMessagePosition18);
int min7 = Math.min(this.currentMessagesGroup.posArray.size(), this.currentMessagesGroup.messages.size());
int i250 = additionalWidthForPosition2;
boolean z81 = z24 ? 1 : 0;
int i251 = 0;
boolean z82 = z24;
while (i251 < min7) {
int i252 = i60;
boolean z83 = z82 ? 1 : 0;
MessageObject messageObject32 = messageObject20;
MessageObject messageObject33 = this.currentMessagesGroup.messages.get(i251);
MessageObject.GroupedMessagePosition groupedMessagePosition19 = this.currentMessagesGroup.posArray.get(i251);
if (groupedMessagePosition19 != this.currentPosition && (groupedMessagePosition19.flags & 8) != 0) {
int ceil6 = (int) Math.ceil((groupedMessagePosition19.pw / 1000.0f) * groupPhotosWidth2);
if (groupedMessagePosition19.minY != 0 && ((messageObject.isOutOwner() && (groupedMessagePosition19.flags & 1) != 0) || !(messageObject.isOutOwner() || (groupedMessagePosition19.flags & 2) == 0))) {
int i253 = 0;
int i254 = 0;
int i255 = 0;
while (true) {
if (i253 >= this.currentMessagesGroup.posArray.size()) {
i61 = round;
break;
}
MessageObject.GroupedMessagePosition groupedMessagePosition20 = this.currentMessagesGroup.posArray.get(i253);
byte b3 = groupedMessagePosition20.minY;
if (b3 == 0) {
i61 = round;
messageObject11 = messageObject33;
groupedMessagePosition7 = groupedMessagePosition19;
i62 = min7;
i63 = dp11;
i64 = ceil6;
i254 = (int) (i254 + Math.ceil((groupedMessagePosition20.pw / 1000.0f) * groupPhotosWidth2) + (groupedMessagePosition20.leftSpanOffset == 0 ? 0.0d : Math.ceil((r5 / 1000.0f) * groupPhotosWidth2)));
} else {
i61 = round;
byte b4 = groupedMessagePosition19.minY;
if (b3 == b4) {
messageObject11 = messageObject33;
groupedMessagePosition7 = groupedMessagePosition19;
double d2 = i255;
i62 = min7;
i63 = dp11;
double ceil7 = Math.ceil((groupedMessagePosition20.pw / 1000.0f) * groupPhotosWidth2);
if (groupedMessagePosition20.leftSpanOffset == 0) {
i64 = ceil6;
ceil = 0.0d;
} else {
i64 = ceil6;
ceil = Math.ceil((r11 / 1000.0f) * groupPhotosWidth2);
}
i255 = (int) (d2 + ceil7 + ceil);
} else {
if (b3 > b4) {
break;
}
messageObject11 = messageObject33;
groupedMessagePosition7 = groupedMessagePosition19;
i62 = min7;
i63 = dp11;
i64 = ceil6;
}
}
i253++;
groupedMessagePosition19 = groupedMessagePosition7;
messageObject33 = messageObject11;
round = i61;
min7 = i62;
dp11 = i63;
ceil6 = i64;
}
ceil6 += i254 - i255;
} else {
i61 = round;
}
int dp47 = ceil6 - AndroidUtilities.dp(9.0f);
int i256 = groupedMessagePosition19.flags;
if ((i256 & 2) != 0 && (i256 & 1) != 0) {
dp13 = AndroidUtilities.dp(8.0f);
} else if ((i256 & 2) == 0 && (i256 & 1) == 0) {
dp13 = AndroidUtilities.dp(11.0f);
} else if ((i256 & 2) != 0) {
dp13 = AndroidUtilities.dp(10.0f);
} else {
dp13 = AndroidUtilities.dp(9.0f);
}
int i257 = dp47 - dp13;
if ((((this.isChat || messageObject33.isRepostPreview) && !this.isThreadPost && !messageObject33.isOutOwner()) || messageObject33.forceAvatar) && messageObject33.needDrawAvatar() && groupedMessagePosition19.edge) {
i257 -= AndroidUtilities.dp(48.0f);
}
additionalWidthForPosition = i257 + getAdditionalWidthForPosition(groupedMessagePosition19);
if (!groupedMessagePosition19.edge) {
additionalWidthForPosition += AndroidUtilities.dp(10.0f);
}
i250 += additionalWidthForPosition;
if (groupedMessagePosition19.minX < this.currentPosition.minX || (this.currentMessagesGroup.hasSibling && groupedMessagePosition19.minY != groupedMessagePosition19.maxY)) {
this.captionOffsetX -= additionalWidthForPosition;
}
if (z81 && (charSequence2 = messageObject33.caption) != null) {
if (this.currentCaption == null) {
this.currentCaption = null;
z81 = false;
} else {
this.currentCaption = charSequence2;
}
}
i251++;
messageObject20 = messageObject32;
i60 = additionalWidthForPosition;
round = i61;
f5 = 1.0f;
i25 = 8;
z82 = true;
i2 = 2;
}
additionalWidthForPosition = i252;
i61 = round;
if (z81) {
if (this.currentCaption == null) {
}
}
i251++;
messageObject20 = messageObject32;
i60 = additionalWidthForPosition;
round = i61;
f5 = 1.0f;
i25 = 8;
z82 = true;
i2 = 2;
}
dp46 = i250;
z25 = z82;
i65 = dp46;
i30 = round;
z26 = false;
r13 = z25;
} else {
this.currentCaption = messageObject20.caption;
if (AndroidUtilities.isTablet()) {
minTabletSide5 = AndroidUtilities.getMinTabletSide();
} else {
minTabletSide5 = Math.min(getParentWidth(), AndroidUtilities.displaySize.y);
}
int i258 = (int) (minTabletSide5 * 0.65f);
if (!messageObject.needDrawBluredPreview()) {
if (this.currentCaption == null) {
ReactionsLayoutInBubble reactionsLayoutInBubble25 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble25.isEmpty) {
}
}
if (i56 < i258) {
z28 = z23 ? 1 : 0;
int dp48 = AndroidUtilities.dp(8.0f) + i56;
this.backgroundWidth = dp48;
if (!this.mediaBackground) {
this.backgroundWidth = dp48 + AndroidUtilities.dp(9.0f);
}
z26 = z28;
i60 = i56;
i65 = i258;
r13 = z23;
}
}
i258 = i56 - AndroidUtilities.dp(10.0f);
z28 = false;
int dp482 = AndroidUtilities.dp(8.0f) + i56;
this.backgroundWidth = dp482;
if (!this.mediaBackground) {
}
z26 = z28;
i60 = i56;
i65 = i258;
r13 = z23;
}
if (this.currentCaption != null) {
try {
this.captionFullWidth = i65;
i65 -= getExtraTextX() * i2;
MessageObject.TextLayoutBlocks textLayoutBlocks5 = new MessageObject.TextLayoutBlocks(this.currentMessageObject, this.currentCaption, Theme.chat_msgTextPaint, i65);
this.captionLayout = textLayoutBlocks5;
if (z26) {
int i259 = textLayoutBlocks5.textWidth;
this.captionWidth = i259;
if (i259 > i65) {
this.captionWidth = i65;
}
} else {
this.captionWidth = i65;
}
int i260 = textLayoutBlocks5.textHeight;
this.captionHeight = i260;
this.addedCaptionHeight = i260 + AndroidUtilities.dp(9.0f);
textLayoutBlocks2 = this.captionLayout;
} catch (Exception e16) {
e = e16;
i68 = 0;
}
if (!textLayoutBlocks2.hasCodeAtBottom && !textLayoutBlocks2.hasQuoteAtBottom) {
groupedMessagePosition8 = this.currentPosition;
if (groupedMessagePosition8 != null && (groupedMessagePosition8.flags & i25) == 0) {
this.captionLayout = null;
}
i68 = 0 + this.addedCaptionHeight;
int max12 = Math.max(this.captionWidth, i56 - AndroidUtilities.dp(10.0f));
reactionsLayoutInBubble5 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble5.isEmpty && !reactionsLayoutInBubble5.isSmall) {
i69 = 0;
i70 = this.highlightCaptionToSetStart;
if (i70 >= 0 && (textLayoutBlocks3 = this.captionLayout) != null) {
highlight(i70, this.highlightCaptionToSetEnd, textLayoutBlocks3.textLayoutBlocks);
}
this.highlightCaptionToSetEnd = -1;
this.highlightCaptionToSetStart = -1;
if (!this.reactionsLayoutInBubble.isSmall) {
boolean z84 = this.backgroundWidth - AndroidUtilities.dp(24.0f) <= i65 ? false : r13;
int max13 = Math.max(this.backgroundWidth - AndroidUtilities.dp(36.0f), i65);
this.reactionsLayoutInBubble.measure(max13, 3);
ReactionsLayoutInBubble reactionsLayoutInBubble26 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble26.isEmpty) {
if (this.isRoundVideo) {
reactionsLayoutInBubble26.drawServiceShaderBackground = f5 - getVideoTranscriptionProgress();
} else if (shouldDrawTimeOnMedia()) {
this.reactionsLayoutInBubble.drawServiceShaderBackground = f5;
}
int i261 = this.reactionsLayoutInBubble.height;
if (this.captionLayout == null) {
dp14 = i261 + AndroidUtilities.dp(12.0f) + AndroidUtilities.dp(4.0f);
} else {
dp14 = i261 + AndroidUtilities.dp(12.0f);
this.reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(12.0f);
}
this.reactionsLayoutInBubble.totalHeight = dp14;
i68 += dp14;
if (this.isRoundVideo && (messageObject13 = this.currentMessageObject) != null && messageObject13.isVoiceTranscriptionOpen()) {
this.reactionsLayoutInBubble.positionOffsetY += AndroidUtilities.dp(8.0f);
}
if (!shouldDrawTimeOnMedia()) {
int min8 = Math.min(max13, this.reactionsLayoutInBubble.width + dp11 + getExtraTimeX() + AndroidUtilities.dp(2.0f));
float f27 = this.reactionsLayoutInBubble.lastLineX;
if (!shouldDrawTimeOnMedia() && min8 - f27 < getExtraTimeX() + dp11) {
i68 += AndroidUtilities.dp(14.0f);
this.reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(14.0f);
this.reactionsLayoutInBubble.positionOffsetY -= AndroidUtilities.dp(14.0f);
if (!z84) {
int i262 = this.captionWidth;
int i263 = this.reactionsLayoutInBubble.width;
if (i262 < i263) {
this.captionWidth = i263;
}
}
i69 = r13;
} else if (!z84) {
ReactionsLayoutInBubble reactionsLayoutInBubble27 = this.reactionsLayoutInBubble;
int i264 = reactionsLayoutInBubble27.lastLineX;
if (i264 + dp11 > this.captionWidth) {
this.captionWidth = i264 + dp11;
}
int i265 = reactionsLayoutInBubble27.width;
if (i265 > this.captionWidth) {
this.captionWidth = i265;
}
}
}
}
}
i33 = i68;
measureText = (int) (Theme.chat_infoPaint.measureText("100%") + AndroidUtilities.dp(100.0f));
if (this.currentMessagesGroup == null && (((i71 = this.documentAttachType) == 4 || i71 == i2) && i56 < measureText)) {
int dp49 = AndroidUtilities.dp(8.0f) + measureText;
this.backgroundWidth = dp49;
if (!this.mediaBackground) {
this.backgroundWidth = dp49 + AndroidUtilities.dp(9.0f);
}
i56 = measureText;
}
if (i56 < this.captionWidth + AndroidUtilities.dp(10.0f)) {
i56 = this.captionWidth + AndroidUtilities.dp(10.0f);
int dp50 = AndroidUtilities.dp(8.0f) + i56;
this.backgroundWidth = dp50;
if (!this.mediaBackground) {
this.backgroundWidth = dp50 + AndroidUtilities.dp(9.0f);
}
}
if (z3 || z60 || z10) {
obj2 = null;
Locale locale3 = Locale.US;
Object[] objArr = new Object[i2];
Integer valueOf2 = Integer.valueOf((int) (i60 / AndroidUtilities.density));
i72 = 0;
objArr[0] = valueOf2;
objArr[r13] = Integer.valueOf((int) (i30 / AndroidUtilities.density));
String format6 = String.format(locale3, "%d_%d", objArr);
this.currentPhotoFilterThumb = format6;
this.currentPhotoFilter = format6;
arrayList4 = messageObject20.photoThumbs;
if ((arrayList4 != null && arrayList4.size() > r13) || (i76 = messageObject20.type) == 3 || i76 == 8 || i76 == 5) {
if (messageObject.needDrawBluredPreview()) {
this.photoImage.setColorFilter(getFancyBlurFilter());
if (!messageObject.isRoundOnce()) {
this.currentPhotoFilter += "_b2";
}
if (messageObject.isRoundOnce()) {
this.currentPhotoFilterThumb += "_b2r";
} else {
this.currentPhotoFilterThumb += "_b2";
}
} else {
this.currentPhotoFilterThumb += "_b";
}
}
} else {
Locale locale4 = Locale.US;
Object[] objArr2 = new Object[i2];
objArr2[0] = Integer.valueOf((int) (i60 / AndroidUtilities.density));
objArr2[r13] = Integer.valueOf((int) (i30 / AndroidUtilities.density));
String format7 = String.format(locale4, "%d_%d", objArr2);
if (!messageObject.needDrawBluredPreview() && !format7.equals(this.currentPhotoFilter)) {
forObject = ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject);
if (forObject != null) {
obj2 = null;
} else {
StringBuilder sb3 = new StringBuilder();
obj2 = null;
sb3.append(forObject.getKey(this.photoParentObject, null, false));
sb3.append("@");
sb3.append(this.currentPhotoFilter);
if (ImageLoader.getInstance().isInMemCache(sb3.toString(), false)) {
this.currentPhotoObjectThumb = this.currentPhotoObject;
this.currentPhotoFilterThumb = this.currentPhotoFilter;
this.currentPhotoFilter = format7;
}
}
i72 = 0;
} else {
if (messageObject.needDrawBluredPreview()) {
this.photoImage.setColorFilter(getFancyBlurFilter());
}
i72 = 0;
obj2 = null;
}
}
int i266 = messageObject20.type;
int i267 = (i266 == 3 || i266 == 8 || i266 == 5) ? r13 : i72;
tLRPC$PhotoSize3 = this.currentPhotoObject;
if (tLRPC$PhotoSize3 != null && i267 == 0 && tLRPC$PhotoSize3.size == 0) {
i73 = -1;
tLRPC$PhotoSize3.size = -1;
} else {
i73 = -1;
}
tLRPC$PhotoSize4 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize4 != null && i267 == 0 && tLRPC$PhotoSize4.size == 0) {
tLRPC$PhotoSize4.size = i73;
}
if (SharedConfig.isAutoplayVideo()) {
MessageObject messageObject34 = this.currentMessageObject;
if (!messageObject34.isRepostPreview) {
if (messageObject34.hasMediaSpoilers()) {
MessageObject messageObject35 = this.currentMessageObject;
if (!messageObject35.isMediaSpoilersRevealed) {
}
}
c2 = 3;
if (messageObject20.type == 3 && !messageObject.needDrawBluredPreview()) {
MessageObject messageObject36 = this.currentMessageObject;
if (messageObject36.mediaExists || messageObject36.attachPathExists || (messageObject.canStreamVideo() && DownloadController.getInstance(this.currentAccount).canDownloadMedia(this.currentMessageObject))) {
MessageObject.GroupedMessagePosition groupedMessagePosition21 = this.currentPosition;
if (groupedMessagePosition21 != null) {
int i268 = groupedMessagePosition21.flags;
this.autoPlayingMedia = ((i268 & 1) == 0 || (i268 & i2) == 0) ? i72 : r13;
} else {
this.autoPlayingMedia = r13;
}
}
}
int i269 = this.currentMessageObject.shouldEncryptPhotoOrVideo() ? i72 : i2;
if (!this.autoPlayingMedia) {
i74 = i56;
messageObject14 = messageObject20;
this.photoImage.setAllowStartAnimation(true);
this.photoImage.startAnimation();
TLRPC$Document document4 = messageObject.getDocument();
VideoEditedInfo videoEditedInfo = this.currentMessageObject.videoEditedInfo;
if (videoEditedInfo != null && videoEditedInfo.canAutoPlaySourceVideo() && messageObject.getDocument() != null) {
this.photoImage.setImage(ImageLocation.getForPath(this.currentMessageObject.videoEditedInfo.originalPath), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject), this.currentPhotoFilter, ImageLocation.getForDocument(this.currentPhotoObjectThumb, document4), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, messageObject.getDocument().size, null, messageObject, 0);
ImageReceiver imageReceiver4 = this.photoImage;
VideoEditedInfo videoEditedInfo2 = this.currentMessageObject.videoEditedInfo;
imageReceiver4.setMediaStartEndTime(videoEditedInfo2.startTime / 1000, videoEditedInfo2.endTime / 1000);
} else if (messageObject.getDocument() != null) {
if (!z60 && !z10) {
this.photoImage.setCrossfadeWithOldImage(true);
}
this.photoImage.setImage(ImageLocation.getForDocument(document4), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject), this.currentPhotoFilter, ImageLocation.getForDocument(this.currentPhotoObjectThumb, document4), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, messageObject.getDocument().size, null, messageObject, 0);
}
} else {
int i270 = messageObject20.type;
if (i270 == 23 || i270 == 24) {
i74 = i56;
messageObject14 = messageObject20;
TL_stories$StoryItem tL_stories$StoryItem7 = messageObject14.messageOwner.media.storyItem;
if (tL_stories$StoryItem7 != null) {
if (tL_stories$StoryItem7 instanceof TL_stories$TL_storyItemDeleted) {
this.photoImage.setImageBitmap(StoriesUtilities.getExpiredStoryDrawable());
} else {
StoriesUtilities.setImage(this.photoImage, tL_stories$StoryItem7);
}
} else {
this.photoImage.clearImage();
}
} else if (i270 == 20) {
i74 = i56;
messageObject14 = messageObject20;
this.photoImage.setImage(null, null, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, 0L, null, this.currentMessageObject, i269);
} else if (i270 == r13) {
i74 = i56;
messageObject14 = messageObject20;
if (messageObject14.useCustomPhoto) {
this.photoImage.setImageBitmap(getResources().getDrawable(org.telegram.messenger.R.drawable.theme_preview_image));
} else {
TLRPC$PhotoSize tLRPC$PhotoSize40 = this.currentPhotoObject;
if (tLRPC$PhotoSize40 != null) {
String attachFileName2 = FileLoader.getAttachFileName(tLRPC$PhotoSize40);
if (messageObject14.mediaExists) {
DownloadController.getInstance(this.currentAccount).removeLoadingFileObserver(this);
z27 = true;
} else {
z27 = false;
}
if (z27 || ((!this.currentMessageObject.loadingCancelled && DownloadController.getInstance(this.currentAccount).canDownloadMedia(this.currentMessageObject)) || FileLoader.getInstance(this.currentAccount).isLoadingFile(attachFileName2))) {
this.photoImage.setImage(ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject), this.currentPhotoFilter, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, this.currentPhotoObject.size, null, this.currentMessageObject, i269);
} else {
this.photoNotSet = true;
TLRPC$PhotoSize tLRPC$PhotoSize41 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize41 != null || this.currentPhotoObjectThumbStripped != null) {
this.photoImage.setImage(null, null, ImageLocation.getForObject(tLRPC$PhotoSize41, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, 0L, null, this.currentMessageObject, i269);
} else {
this.photoImage.setImageBitmap((Drawable) null);
}
}
} else {
this.photoImage.setImageBitmap((Drawable) null);
}
}
} else {
if (i270 == 8) {
messageObject14 = messageObject20;
i75 = 5;
} else if (i270 != 5) {
if (messageObject20.videoEditedInfo != null && i270 == 5 && !this.currentMessageObject.needDrawBluredPreview()) {
messageObject14 = messageObject20;
this.photoImage.setImage(ImageLocation.getForPath(messageObject14.videoEditedInfo.originalPath), this.currentPhotoFilter, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, 0L, null, messageObject, i269);
ImageReceiver imageReceiver5 = this.photoImage;
VideoEditedInfo videoEditedInfo3 = this.currentMessageObject.videoEditedInfo;
imageReceiver5.setMediaStartEndTime(videoEditedInfo3.startTime / 1000, videoEditedInfo3.endTime / 1000);
} else {
if (!z60 && !this.currentMessageObject.needDrawBluredPreview()) {
this.photoImage.setCrossfadeWithOldImage(r13);
this.photoImage.setCrossfadeDuration(250);
}
messageObject14 = messageObject20;
this.photoImage.setImage(ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject), this.currentPhotoFilter, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, 0L, null, messageObject, i269);
}
i74 = i56;
} else {
i75 = 5;
messageObject14 = messageObject20;
}
String attachFileName3 = FileLoader.getAttachFileName(messageObject.getDocument());
if (messageObject14.attachPathExists) {
DownloadController.getInstance(this.currentAccount).removeLoadingFileObserver(this);
c3 = 1;
} else {
c3 = !messageObject14.mediaExists ? (char) 0 : (char) 2;
}
TLRPC$Document document5 = messageObject.getDocument();
boolean canDownloadMedia2 = (MessageObject.isGifDocument(document5, messageObject.hasValidGroupId()) || messageObject14.type == i75) ? DownloadController.getInstance(this.currentAccount).canDownloadMedia(this.currentMessageObject) : false;
TLRPC$VideoSize documentVideoThumb2 = MessageObject.getDocumentVideoThumb(document5);
if (((MessageObject.isGifDocument(document5, messageObject.hasValidGroupId()) && messageObject14.videoEditedInfo == null) || !(messageObject.isSending() || messageObject.isEditing())) && (c3 != 0 || FileLoader.getInstance(this.currentAccount).isLoadingFile(attachFileName3) || canDownloadMedia2)) {
char c5 = 1;
if (c3 != 1) {
if (!messageObject.needDrawBluredPreview() && (c3 != 0 || (messageObject.canStreamVideo() && canDownloadMedia2))) {
i74 = i56;
this.autoPlayingMedia = true;
if (!z60) {
this.photoImage.setCrossfadeWithOldImage(true);
this.photoImage.setCrossfadeDuration(250);
}
if (c3 == 0 && documentVideoThumb2 != null && (this.currentPhotoObject == null || this.currentPhotoObjectThumb == null)) {
ImageReceiver imageReceiver6 = this.photoImage;
ImageLocation forDocument3 = ImageLocation.getForDocument(document5);
ImageLocation forDocument4 = ImageLocation.getForDocument(documentVideoThumb2, this.documentAttach);
TLRPC$PhotoSize tLRPC$PhotoSize42 = this.currentPhotoObject;
if (tLRPC$PhotoSize42 == null) {
tLRPC$PhotoSize42 = this.currentPhotoObjectThumb;
}
imageReceiver6.setImage(forDocument3, ImageLoader.AUTOPLAY_FILTER, forDocument4, null, ImageLocation.getForDocument(tLRPC$PhotoSize42, this.documentAttach), this.currentPhotoObject == null ? this.currentPhotoFilterThumb : this.currentPhotoFilter, this.currentPhotoObjectThumbStripped, document5.size, null, messageObject, i269);
} else if (this.isRoundVideo && !z60 && this.photoImage.hasStaticThumb()) {
this.photoImage.setImage(ImageLocation.getForDocument(document5), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject), this.currentPhotoFilter, null, null, this.photoImage.getStaticThumb(), document5.size, null, messageObject, !messageObject.isRoundOnce() ? 0 : i269);
} else {
this.photoImage.setImage(ImageLocation.getForDocument(document5), ImageLoader.AUTOPLAY_FILTER, ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject), this.currentPhotoFilter, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, document5.size, null, messageObject, i269);
}
} else {
c5 = 1;
}
}
if (c3 == c5) {
i74 = i56;
this.photoImage.setImage(ImageLocation.getForPath(!messageObject.isSendError() ? messageObject14.messageOwner.attachPath : null), null, ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject), this.currentPhotoFilter, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, 0L, null, messageObject, i269);
} else if (documentVideoThumb2 != null && (this.currentPhotoObject == null || this.currentPhotoObjectThumb == null)) {
i74 = i56;
ImageReceiver imageReceiver7 = this.photoImage;
ImageLocation forDocument5 = ImageLocation.getForDocument(document5);
ImageLocation forDocument6 = ImageLocation.getForDocument(documentVideoThumb2, this.documentAttach);
TLRPC$PhotoSize tLRPC$PhotoSize43 = this.currentPhotoObject;
if (tLRPC$PhotoSize43 == null) {
tLRPC$PhotoSize43 = this.currentPhotoObjectThumb;
}
imageReceiver7.setImage(forDocument5, null, forDocument6, null, ImageLocation.getForDocument(tLRPC$PhotoSize43, this.documentAttach), this.currentPhotoObject == null ? this.currentPhotoFilterThumb : this.currentPhotoFilter, this.currentPhotoObjectThumbStripped, document5.size, null, messageObject, i269);
} else {
i74 = i56;
this.photoImage.setImage(ImageLocation.getForDocument(document5), null, ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject), this.currentPhotoFilter, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, document5.size, null, messageObject, !messageObject.isRoundOnce() ? 0 : i269);
}
} else {
if (messageObject14.videoEditedInfo != null && messageObject14.type == i75 && !this.currentMessageObject.needDrawBluredPreview()) {
this.photoImage.setImage(ImageLocation.getForPath(messageObject14.videoEditedInfo.originalPath), this.currentPhotoFilter, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, 0L, null, messageObject, 0);
ImageReceiver imageReceiver8 = this.photoImage;
VideoEditedInfo videoEditedInfo4 = this.currentMessageObject.videoEditedInfo;
imageReceiver8.setMediaStartEndTime(videoEditedInfo4.startTime / 1000, videoEditedInfo4.endTime / 1000);
} else {
if (!z60 && !this.currentMessageObject.needDrawBluredPreview()) {
this.photoImage.setCrossfadeWithOldImage(true);
this.photoImage.setCrossfadeDuration(250);
}
this.photoImage.setImage(ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject), this.currentPhotoFilter, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, 0L, null, messageObject, i269);
}
i74 = i56;
}
}
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
}
c2 = 3;
if (this.currentMessageObject.shouldEncryptPhotoOrVideo()) {
}
if (!this.autoPlayingMedia) {
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
if (!shouldDrawTimeOnMedia() && (max12 + AndroidUtilities.dp(2.0f)) - this.captionLayout.lastLineWidth < getExtraTimeX() + dp11) {
i68 += AndroidUtilities.dp(14.0f);
this.addedCaptionHeight += AndroidUtilities.dp(14.0f);
i69 = r13;
i70 = this.highlightCaptionToSetStart;
if (i70 >= 0) {
highlight(i70, this.highlightCaptionToSetEnd, textLayoutBlocks3.textLayoutBlocks);
}
this.highlightCaptionToSetEnd = -1;
this.highlightCaptionToSetStart = -1;
if (!this.reactionsLayoutInBubble.isSmall) {
}
i33 = i68;
measureText = (int) (Theme.chat_infoPaint.measureText("100%") + AndroidUtilities.dp(100.0f));
if (this.currentMessagesGroup == null) {
int dp492 = AndroidUtilities.dp(8.0f) + measureText;
this.backgroundWidth = dp492;
if (!this.mediaBackground) {
}
i56 = measureText;
}
if (i56 < this.captionWidth + AndroidUtilities.dp(10.0f)) {
}
if (z3) {
Locale locale42 = Locale.US;
Object[] objArr22 = new Object[i2];
objArr22[0] = Integer.valueOf((int) (i60 / AndroidUtilities.density));
objArr22[r13] = Integer.valueOf((int) (i30 / AndroidUtilities.density));
String format72 = String.format(locale42, "%d_%d", objArr22);
if (!messageObject.needDrawBluredPreview()) {
forObject = ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject);
if (forObject != null) {
}
i72 = 0;
int i2662 = messageObject20.type;
if (i2662 == 3) {
tLRPC$PhotoSize3 = this.currentPhotoObject;
if (tLRPC$PhotoSize3 != null) {
i73 = -1;
tLRPC$PhotoSize3.size = -1;
tLRPC$PhotoSize4 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize4 != null) {
tLRPC$PhotoSize4.size = i73;
}
if (SharedConfig.isAutoplayVideo()) {
}
c2 = 3;
if (this.currentMessageObject.shouldEncryptPhotoOrVideo()) {
}
if (!this.autoPlayingMedia) {
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
i73 = -1;
tLRPC$PhotoSize4 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize4 != null) {
}
if (SharedConfig.isAutoplayVideo()) {
}
c2 = 3;
if (this.currentMessageObject.shouldEncryptPhotoOrVideo()) {
}
if (!this.autoPlayingMedia) {
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
tLRPC$PhotoSize3 = this.currentPhotoObject;
if (tLRPC$PhotoSize3 != null) {
}
i73 = -1;
tLRPC$PhotoSize4 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize4 != null) {
}
if (SharedConfig.isAutoplayVideo()) {
}
c2 = 3;
if (this.currentMessageObject.shouldEncryptPhotoOrVideo()) {
}
if (!this.autoPlayingMedia) {
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
if (messageObject.needDrawBluredPreview()) {
}
i72 = 0;
obj2 = null;
int i26622 = messageObject20.type;
if (i26622 == 3) {
}
tLRPC$PhotoSize3 = this.currentPhotoObject;
if (tLRPC$PhotoSize3 != null) {
}
i73 = -1;
tLRPC$PhotoSize4 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize4 != null) {
}
if (SharedConfig.isAutoplayVideo()) {
}
c2 = 3;
if (this.currentMessageObject.shouldEncryptPhotoOrVideo()) {
}
if (!this.autoPlayingMedia) {
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
obj2 = null;
Locale locale32 = Locale.US;
Object[] objArr3 = new Object[i2];
Integer valueOf22 = Integer.valueOf((int) (i60 / AndroidUtilities.density));
i72 = 0;
objArr3[0] = valueOf22;
objArr3[r13] = Integer.valueOf((int) (i30 / AndroidUtilities.density));
String format62 = String.format(locale32, "%d_%d", objArr3);
this.currentPhotoFilterThumb = format62;
this.currentPhotoFilter = format62;
arrayList4 = messageObject20.photoThumbs;
if (arrayList4 != null) {
if (messageObject.needDrawBluredPreview()) {
}
int i266222 = messageObject20.type;
if (i266222 == 3) {
}
tLRPC$PhotoSize3 = this.currentPhotoObject;
if (tLRPC$PhotoSize3 != null) {
}
i73 = -1;
tLRPC$PhotoSize4 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize4 != null) {
}
if (SharedConfig.isAutoplayVideo()) {
}
c2 = 3;
if (this.currentMessageObject.shouldEncryptPhotoOrVideo()) {
}
if (!this.autoPlayingMedia) {
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
if (messageObject.needDrawBluredPreview()) {
}
int i2662222 = messageObject20.type;
if (i2662222 == 3) {
}
tLRPC$PhotoSize3 = this.currentPhotoObject;
if (tLRPC$PhotoSize3 != null) {
}
i73 = -1;
tLRPC$PhotoSize4 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize4 != null) {
}
if (SharedConfig.isAutoplayVideo()) {
}
c2 = 3;
if (this.currentMessageObject.shouldEncryptPhotoOrVideo()) {
}
if (!this.autoPlayingMedia) {
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
i69 = 0;
i70 = this.highlightCaptionToSetStart;
if (i70 >= 0) {
}
this.highlightCaptionToSetEnd = -1;
this.highlightCaptionToSetStart = -1;
if (!this.reactionsLayoutInBubble.isSmall) {
}
i33 = i68;
measureText = (int) (Theme.chat_infoPaint.measureText("100%") + AndroidUtilities.dp(100.0f));
if (this.currentMessagesGroup == null) {
}
if (i56 < this.captionWidth + AndroidUtilities.dp(10.0f)) {
}
if (z3) {
}
obj2 = null;
Locale locale322 = Locale.US;
Object[] objArr32 = new Object[i2];
Integer valueOf222 = Integer.valueOf((int) (i60 / AndroidUtilities.density));
i72 = 0;
objArr32[0] = valueOf222;
objArr32[r13] = Integer.valueOf((int) (i30 / AndroidUtilities.density));
String format622 = String.format(locale322, "%d_%d", objArr32);
this.currentPhotoFilterThumb = format622;
this.currentPhotoFilter = format622;
arrayList4 = messageObject20.photoThumbs;
if (arrayList4 != null) {
}
if (messageObject.needDrawBluredPreview()) {
}
int i26622222 = messageObject20.type;
if (i26622222 == 3) {
}
tLRPC$PhotoSize3 = this.currentPhotoObject;
if (tLRPC$PhotoSize3 != null) {
}
i73 = -1;
tLRPC$PhotoSize4 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize4 != null) {
}
if (SharedConfig.isAutoplayVideo()) {
}
c2 = 3;
if (this.currentMessageObject.shouldEncryptPhotoOrVideo()) {
}
if (!this.autoPlayingMedia) {
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
this.captionHeight += AndroidUtilities.dp(14.0f);
this.addedCaptionHeight += AndroidUtilities.dp(14.0f);
groupedMessagePosition8 = this.currentPosition;
if (groupedMessagePosition8 != null) {
this.captionLayout = null;
}
i68 = 0 + this.addedCaptionHeight;
int max122 = Math.max(this.captionWidth, i56 - AndroidUtilities.dp(10.0f));
reactionsLayoutInBubble5 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble5.isEmpty) {
i69 = 0;
i70 = this.highlightCaptionToSetStart;
if (i70 >= 0) {
}
this.highlightCaptionToSetEnd = -1;
this.highlightCaptionToSetStart = -1;
if (!this.reactionsLayoutInBubble.isSmall) {
}
i33 = i68;
measureText = (int) (Theme.chat_infoPaint.measureText("100%") + AndroidUtilities.dp(100.0f));
if (this.currentMessagesGroup == null) {
}
if (i56 < this.captionWidth + AndroidUtilities.dp(10.0f)) {
}
if (z3) {
}
obj2 = null;
Locale locale3222 = Locale.US;
Object[] objArr322 = new Object[i2];
Integer valueOf2222 = Integer.valueOf((int) (i60 / AndroidUtilities.density));
i72 = 0;
objArr322[0] = valueOf2222;
objArr322[r13] = Integer.valueOf((int) (i30 / AndroidUtilities.density));
String format6222 = String.format(locale3222, "%d_%d", objArr322);
this.currentPhotoFilterThumb = format6222;
this.currentPhotoFilter = format6222;
arrayList4 = messageObject20.photoThumbs;
if (arrayList4 != null) {
}
if (messageObject.needDrawBluredPreview()) {
}
int i266222222 = messageObject20.type;
if (i266222222 == 3) {
}
tLRPC$PhotoSize3 = this.currentPhotoObject;
if (tLRPC$PhotoSize3 != null) {
}
i73 = -1;
tLRPC$PhotoSize4 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize4 != null) {
}
if (SharedConfig.isAutoplayVideo()) {
}
c2 = 3;
if (this.currentMessageObject.shouldEncryptPhotoOrVideo()) {
}
if (!this.autoPlayingMedia) {
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
if (!shouldDrawTimeOnMedia()) {
i68 += AndroidUtilities.dp(14.0f);
this.addedCaptionHeight += AndroidUtilities.dp(14.0f);
i69 = r13;
i70 = this.highlightCaptionToSetStart;
if (i70 >= 0) {
}
this.highlightCaptionToSetEnd = -1;
this.highlightCaptionToSetStart = -1;
if (!this.reactionsLayoutInBubble.isSmall) {
}
i33 = i68;
measureText = (int) (Theme.chat_infoPaint.measureText("100%") + AndroidUtilities.dp(100.0f));
if (this.currentMessagesGroup == null) {
}
if (i56 < this.captionWidth + AndroidUtilities.dp(10.0f)) {
}
if (z3) {
}
obj2 = null;
Locale locale32222 = Locale.US;
Object[] objArr3222 = new Object[i2];
Integer valueOf22222 = Integer.valueOf((int) (i60 / AndroidUtilities.density));
i72 = 0;
objArr3222[0] = valueOf22222;
objArr3222[r13] = Integer.valueOf((int) (i30 / AndroidUtilities.density));
String format62222 = String.format(locale32222, "%d_%d", objArr3222);
this.currentPhotoFilterThumb = format62222;
this.currentPhotoFilter = format62222;
arrayList4 = messageObject20.photoThumbs;
if (arrayList4 != null) {
}
if (messageObject.needDrawBluredPreview()) {
}
int i2662222222 = messageObject20.type;
if (i2662222222 == 3) {
}
tLRPC$PhotoSize3 = this.currentPhotoObject;
if (tLRPC$PhotoSize3 != null) {
}
i73 = -1;
tLRPC$PhotoSize4 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize4 != null) {
}
if (SharedConfig.isAutoplayVideo()) {
}
c2 = 3;
if (this.currentMessageObject.shouldEncryptPhotoOrVideo()) {
}
if (!this.autoPlayingMedia) {
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
i69 = 0;
i70 = this.highlightCaptionToSetStart;
if (i70 >= 0) {
}
this.highlightCaptionToSetEnd = -1;
this.highlightCaptionToSetStart = -1;
if (!this.reactionsLayoutInBubble.isSmall) {
}
i33 = i68;
measureText = (int) (Theme.chat_infoPaint.measureText("100%") + AndroidUtilities.dp(100.0f));
if (this.currentMessagesGroup == null) {
}
if (i56 < this.captionWidth + AndroidUtilities.dp(10.0f)) {
}
if (z3) {
}
obj2 = null;
Locale locale322222 = Locale.US;
Object[] objArr32222 = new Object[i2];
Integer valueOf222222 = Integer.valueOf((int) (i60 / AndroidUtilities.density));
i72 = 0;
objArr32222[0] = valueOf222222;
objArr32222[r13] = Integer.valueOf((int) (i30 / AndroidUtilities.density));
String format622222 = String.format(locale322222, "%d_%d", objArr32222);
this.currentPhotoFilterThumb = format622222;
this.currentPhotoFilter = format622222;
arrayList4 = messageObject20.photoThumbs;
if (arrayList4 != null) {
}
if (messageObject.needDrawBluredPreview()) {
}
int i26622222222 = messageObject20.type;
if (i26622222222 == 3) {
}
tLRPC$PhotoSize3 = this.currentPhotoObject;
if (tLRPC$PhotoSize3 != null) {
}
i73 = -1;
tLRPC$PhotoSize4 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize4 != null) {
}
if (SharedConfig.isAutoplayVideo()) {
}
c2 = 3;
if (this.currentMessageObject.shouldEncryptPhotoOrVideo()) {
}
if (!this.autoPlayingMedia) {
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
i69 = 0;
i68 = 0;
i70 = this.highlightCaptionToSetStart;
if (i70 >= 0) {
}
this.highlightCaptionToSetEnd = -1;
this.highlightCaptionToSetStart = -1;
if (!this.reactionsLayoutInBubble.isSmall) {
}
i33 = i68;
measureText = (int) (Theme.chat_infoPaint.measureText("100%") + AndroidUtilities.dp(100.0f));
if (this.currentMessagesGroup == null) {
}
if (i56 < this.captionWidth + AndroidUtilities.dp(10.0f)) {
}
if (z3) {
}
obj2 = null;
Locale locale3222222 = Locale.US;
Object[] objArr322222 = new Object[i2];
Integer valueOf2222222 = Integer.valueOf((int) (i60 / AndroidUtilities.density));
i72 = 0;
objArr322222[0] = valueOf2222222;
objArr322222[r13] = Integer.valueOf((int) (i30 / AndroidUtilities.density));
String format6222222 = String.format(locale3222222, "%d_%d", objArr322222);
this.currentPhotoFilterThumb = format6222222;
this.currentPhotoFilter = format6222222;
arrayList4 = messageObject20.photoThumbs;
if (arrayList4 != null) {
}
if (messageObject.needDrawBluredPreview()) {
}
int i266222222222 = messageObject20.type;
if (i266222222222 == 3) {
}
tLRPC$PhotoSize3 = this.currentPhotoObject;
if (tLRPC$PhotoSize3 != null) {
}
i73 = -1;
tLRPC$PhotoSize4 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize4 != null) {
}
if (SharedConfig.isAutoplayVideo()) {
}
c2 = 3;
if (this.currentMessageObject.shouldEncryptPhotoOrVideo()) {
}
if (!this.autoPlayingMedia) {
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
z22 = false;
bitmapDrawable = this.currentMessageObject.strippedThumb;
if (bitmapDrawable != null) {
}
if (messageObject20.type == 5) {
}
tLRPC$PhotoSize = this.currentPhotoObject;
if (tLRPC$PhotoSize != null) {
this.currentPhotoObject = null;
}
tLRPC$PhotoSize2 = this.currentPhotoObject;
if (tLRPC$PhotoSize2 != null) {
i77 = messageObject20.type;
if (i77 == z58) {
this.currentPhotoObject = null;
}
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = null;
}
if (z22) {
this.photoImage.setNeedsQualityThumb(z58);
this.photoImage.setShouldGenerateQualityThumb(z58);
}
if (this.currentMessagesGroup == null) {
this.mediaBackground = false;
}
if (i56 != 0) {
}
while (i57 < document.attributes.size()) {
}
dp44 = i30;
i30 = dp44;
if (i56 != 0) {
}
i30 = AndroidUtilities.dp(150.0f);
i56 = i30;
if (messageObject20.type == 3) {
i56 = this.infoWidth + AndroidUtilities.dp(40.0f);
}
i58 = messageObject20.type;
if (i58 != 23) {
}
i56 = (int) Math.min(AndroidUtilities.displaySize.x * 0.53d, AndroidUtilities.dp(300.0f));
i30 = (int) ((i56 * 16.0f) / 9.0f);
if (this.commentLayout != null) {
i56 = this.totalCommentWidth + AndroidUtilities.dp(10.0f);
}
if (this.currentMessagesGroup != null) {
}
if (messageObject20.type == 5) {
}
measureTime(messageObject);
dp11 = this.timeWidth + AndroidUtilities.dp((SharedConfig.bubbleRadius < 10 ? 18 : 22) + (!messageObject.isOutOwner() ? 0 : i150));
if (i56 < dp11) {
}
if (messageObject.isRoundVideo()) {
}
if (this.currentMessagesGroup != null) {
}
if (this.currentCaption != null) {
}
i69 = 0;
i68 = 0;
i70 = this.highlightCaptionToSetStart;
if (i70 >= 0) {
}
this.highlightCaptionToSetEnd = -1;
this.highlightCaptionToSetStart = -1;
if (!this.reactionsLayoutInBubble.isSmall) {
}
i33 = i68;
measureText = (int) (Theme.chat_infoPaint.measureText("100%") + AndroidUtilities.dp(100.0f));
if (this.currentMessagesGroup == null) {
}
if (i56 < this.captionWidth + AndroidUtilities.dp(10.0f)) {
}
if (z3) {
}
obj2 = null;
Locale locale32222222 = Locale.US;
Object[] objArr3222222 = new Object[i2];
Integer valueOf22222222 = Integer.valueOf((int) (i60 / AndroidUtilities.density));
i72 = 0;
objArr3222222[0] = valueOf22222222;
objArr3222222[r13] = Integer.valueOf((int) (i30 / AndroidUtilities.density));
String format62222222 = String.format(locale32222222, "%d_%d", objArr3222222);
this.currentPhotoFilterThumb = format62222222;
this.currentPhotoFilter = format62222222;
arrayList4 = messageObject20.photoThumbs;
if (arrayList4 != null) {
}
if (messageObject.needDrawBluredPreview()) {
}
int i2662222222222 = messageObject20.type;
if (i2662222222222 == 3) {
}
tLRPC$PhotoSize3 = this.currentPhotoObject;
if (tLRPC$PhotoSize3 != null) {
}
i73 = -1;
tLRPC$PhotoSize4 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize4 != null) {
}
if (SharedConfig.isAutoplayVideo()) {
}
c2 = 3;
if (this.currentMessageObject.shouldEncryptPhotoOrVideo()) {
}
if (!this.autoPlayingMedia) {
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
} else {
minTabletSide7 = Math.min(getParentWidth(), AndroidUtilities.displaySize.y);
}
}
i54 = (int) (minTabletSide7 * 0.7f);
}
z21 = false;
int dp442 = AndroidUtilities.dp(100.0f) + i54;
if (z21) {
}
i55 = messageObject20.type;
if (i55 == z58) {
if (i55 == 3) {
if (i55 == 5) {
}
z22 = false;
bitmapDrawable = this.currentMessageObject.strippedThumb;
if (bitmapDrawable != null) {
}
if (messageObject20.type == 5) {
}
tLRPC$PhotoSize = this.currentPhotoObject;
if (tLRPC$PhotoSize != null) {
}
tLRPC$PhotoSize2 = this.currentPhotoObject;
if (tLRPC$PhotoSize2 != null) {
}
if (z22) {
}
if (this.currentMessagesGroup == null) {
}
if (i56 != 0) {
}
while (i57 < document.attributes.size()) {
}
dp442 = i30;
i30 = dp442;
if (i56 != 0) {
}
i30 = AndroidUtilities.dp(150.0f);
i56 = i30;
if (messageObject20.type == 3) {
}
i58 = messageObject20.type;
if (i58 != 23) {
}
i56 = (int) Math.min(AndroidUtilities.displaySize.x * 0.53d, AndroidUtilities.dp(300.0f));
i30 = (int) ((i56 * 16.0f) / 9.0f);
if (this.commentLayout != null) {
}
if (this.currentMessagesGroup != null) {
}
if (messageObject20.type == 5) {
}
measureTime(messageObject);
dp11 = this.timeWidth + AndroidUtilities.dp((SharedConfig.bubbleRadius < 10 ? 18 : 22) + (!messageObject.isOutOwner() ? 0 : i150));
if (i56 < dp11) {
}
if (messageObject.isRoundVideo()) {
}
if (this.currentMessagesGroup != null) {
}
if (this.currentCaption != null) {
}
i69 = 0;
i68 = 0;
i70 = this.highlightCaptionToSetStart;
if (i70 >= 0) {
}
this.highlightCaptionToSetEnd = -1;
this.highlightCaptionToSetStart = -1;
if (!this.reactionsLayoutInBubble.isSmall) {
}
i33 = i68;
measureText = (int) (Theme.chat_infoPaint.measureText("100%") + AndroidUtilities.dp(100.0f));
if (this.currentMessagesGroup == null) {
}
if (i56 < this.captionWidth + AndroidUtilities.dp(10.0f)) {
}
if (z3) {
}
obj2 = null;
Locale locale322222222 = Locale.US;
Object[] objArr32222222 = new Object[i2];
Integer valueOf222222222 = Integer.valueOf((int) (i60 / AndroidUtilities.density));
i72 = 0;
objArr32222222[0] = valueOf222222222;
objArr32222222[r13] = Integer.valueOf((int) (i30 / AndroidUtilities.density));
String format622222222 = String.format(locale322222222, "%d_%d", objArr32222222);
this.currentPhotoFilterThumb = format622222222;
this.currentPhotoFilter = format622222222;
arrayList4 = messageObject20.photoThumbs;
if (arrayList4 != null) {
}
if (messageObject.needDrawBluredPreview()) {
}
int i26622222222222 = messageObject20.type;
if (i26622222222222 == 3) {
}
tLRPC$PhotoSize3 = this.currentPhotoObject;
if (tLRPC$PhotoSize3 != null) {
}
i73 = -1;
tLRPC$PhotoSize4 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize4 != null) {
}
if (SharedConfig.isAutoplayVideo()) {
}
c2 = 3;
if (this.currentMessageObject.shouldEncryptPhotoOrVideo()) {
}
if (!this.autoPlayingMedia) {
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
createDocumentLayout(0, messageObject20);
this.currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(messageObject20.photoThumbs, 40);
updateSecretTimeText(messageObject);
z22 = z58 ? 1 : 0;
bitmapDrawable = this.currentMessageObject.strippedThumb;
if (bitmapDrawable != null) {
}
if (messageObject20.type == 5) {
}
tLRPC$PhotoSize = this.currentPhotoObject;
if (tLRPC$PhotoSize != null) {
}
tLRPC$PhotoSize2 = this.currentPhotoObject;
if (tLRPC$PhotoSize2 != null) {
}
if (z22) {
}
if (this.currentMessagesGroup == null) {
}
if (i56 != 0) {
}
while (i57 < document.attributes.size()) {
}
dp442 = i30;
i30 = dp442;
if (i56 != 0) {
}
i30 = AndroidUtilities.dp(150.0f);
i56 = i30;
if (messageObject20.type == 3) {
}
i58 = messageObject20.type;
if (i58 != 23) {
}
i56 = (int) Math.min(AndroidUtilities.displaySize.x * 0.53d, AndroidUtilities.dp(300.0f));
i30 = (int) ((i56 * 16.0f) / 9.0f);
if (this.commentLayout != null) {
}
if (this.currentMessagesGroup != null) {
}
if (messageObject20.type == 5) {
}
measureTime(messageObject);
dp11 = this.timeWidth + AndroidUtilities.dp((SharedConfig.bubbleRadius < 10 ? 18 : 22) + (!messageObject.isOutOwner() ? 0 : i150));
if (i56 < dp11) {
}
if (messageObject.isRoundVideo()) {
}
if (this.currentMessagesGroup != null) {
}
if (this.currentCaption != null) {
}
i69 = 0;
i68 = 0;
i70 = this.highlightCaptionToSetStart;
if (i70 >= 0) {
}
this.highlightCaptionToSetEnd = -1;
this.highlightCaptionToSetStart = -1;
if (!this.reactionsLayoutInBubble.isSmall) {
}
i33 = i68;
measureText = (int) (Theme.chat_infoPaint.measureText("100%") + AndroidUtilities.dp(100.0f));
if (this.currentMessagesGroup == null) {
}
if (i56 < this.captionWidth + AndroidUtilities.dp(10.0f)) {
}
if (z3) {
}
obj2 = null;
Locale locale3222222222 = Locale.US;
Object[] objArr322222222 = new Object[i2];
Integer valueOf2222222222 = Integer.valueOf((int) (i60 / AndroidUtilities.density));
i72 = 0;
objArr322222222[0] = valueOf2222222222;
objArr322222222[r13] = Integer.valueOf((int) (i30 / AndroidUtilities.density));
String format6222222222 = String.format(locale3222222222, "%d_%d", objArr322222222);
this.currentPhotoFilterThumb = format6222222222;
this.currentPhotoFilter = format6222222222;
arrayList4 = messageObject20.photoThumbs;
if (arrayList4 != null) {
}
if (messageObject.needDrawBluredPreview()) {
}
int i266222222222222 = messageObject20.type;
if (i266222222222222 == 3) {
}
tLRPC$PhotoSize3 = this.currentPhotoObject;
if (tLRPC$PhotoSize3 != null) {
}
i73 = -1;
tLRPC$PhotoSize4 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize4 != null) {
}
if (SharedConfig.isAutoplayVideo()) {
}
c2 = 3;
if (this.currentMessageObject.shouldEncryptPhotoOrVideo()) {
}
if (!this.autoPlayingMedia) {
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
updateSecretTimeText(messageObject);
this.currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(messageObject20.photoThumbs, 40);
z22 = false;
bitmapDrawable = this.currentMessageObject.strippedThumb;
if (bitmapDrawable != null) {
}
if (messageObject20.type == 5) {
}
tLRPC$PhotoSize = this.currentPhotoObject;
if (tLRPC$PhotoSize != null) {
}
tLRPC$PhotoSize2 = this.currentPhotoObject;
if (tLRPC$PhotoSize2 != null) {
}
if (z22) {
}
if (this.currentMessagesGroup == null) {
}
if (i56 != 0) {
}
while (i57 < document.attributes.size()) {
}
dp442 = i30;
i30 = dp442;
if (i56 != 0) {
}
i30 = AndroidUtilities.dp(150.0f);
i56 = i30;
if (messageObject20.type == 3) {
}
i58 = messageObject20.type;
if (i58 != 23) {
}
i56 = (int) Math.min(AndroidUtilities.displaySize.x * 0.53d, AndroidUtilities.dp(300.0f));
i30 = (int) ((i56 * 16.0f) / 9.0f);
if (this.commentLayout != null) {
}
if (this.currentMessagesGroup != null) {
}
if (messageObject20.type == 5) {
}
measureTime(messageObject);
dp11 = this.timeWidth + AndroidUtilities.dp((SharedConfig.bubbleRadius < 10 ? 18 : 22) + (!messageObject.isOutOwner() ? 0 : i150));
if (i56 < dp11) {
}
if (messageObject.isRoundVideo()) {
}
if (this.currentMessagesGroup != null) {
}
if (this.currentCaption != null) {
}
i69 = 0;
i68 = 0;
i70 = this.highlightCaptionToSetStart;
if (i70 >= 0) {
}
this.highlightCaptionToSetEnd = -1;
this.highlightCaptionToSetStart = -1;
if (!this.reactionsLayoutInBubble.isSmall) {
}
i33 = i68;
measureText = (int) (Theme.chat_infoPaint.measureText("100%") + AndroidUtilities.dp(100.0f));
if (this.currentMessagesGroup == null) {
}
if (i56 < this.captionWidth + AndroidUtilities.dp(10.0f)) {
}
if (z3) {
}
obj2 = null;
Locale locale32222222222 = Locale.US;
Object[] objArr3222222222 = new Object[i2];
Integer valueOf22222222222 = Integer.valueOf((int) (i60 / AndroidUtilities.density));
i72 = 0;
objArr3222222222[0] = valueOf22222222222;
objArr3222222222[r13] = Integer.valueOf((int) (i30 / AndroidUtilities.density));
String format62222222222 = String.format(locale32222222222, "%d_%d", objArr3222222222);
this.currentPhotoFilterThumb = format62222222222;
this.currentPhotoFilter = format62222222222;
arrayList4 = messageObject20.photoThumbs;
if (arrayList4 != null) {
}
if (messageObject.needDrawBluredPreview()) {
}
int i2662222222222222 = messageObject20.type;
if (i2662222222222222 == 3) {
}
tLRPC$PhotoSize3 = this.currentPhotoObject;
if (tLRPC$PhotoSize3 != null) {
}
i73 = -1;
tLRPC$PhotoSize4 = this.currentPhotoObjectThumb;
if (tLRPC$PhotoSize4 != null) {
}
if (SharedConfig.isAutoplayVideo()) {
}
c2 = 3;
if (this.currentMessageObject.shouldEncryptPhotoOrVideo()) {
}
if (!this.autoPlayingMedia) {
}
i34 = i69;
messageObject6 = messageObject14;
i7 = i59;
dp5 = i74;
f6 = 50.0f;
i29 = 1;
i31 = 0;
i26 = 3;
i27 = 4;
f7 = 1.0f;
}
f7 = f8;
messageObject6 = messageObject9;
} else {
MessageObject messageObject37 = messageObject20;
TLRPC$GeoPoint tLRPC$GeoPoint = MessageObject.getMedia(messageObject37.messageOwner).geo;
double d3 = tLRPC$GeoPoint.lat;
double d4 = tLRPC$GeoPoint._long;
if (((int) messageObject.getDialogId()) == 0 && (i46 = SharedConfig.mapPreviewType) != 0) {
if (i46 == 1) {
i37 = 4;
} else if (i46 == 3) {
i37 = 1;
}
if (!(MessageObject.getMedia(messageObject37.messageOwner) instanceof TLRPC$TL_messageMediaGeoLive)) {
if (AndroidUtilities.isTablet()) {
this.backgroundWidth = Math.min(AndroidUtilities.getMinTabletSide() - AndroidUtilities.dp(!z8 ? 50.0f : 102.0f), AndroidUtilities.dp(289.0f));
} else {
this.backgroundWidth = Math.min(getParentWidth() - AndroidUtilities.dp(!z8 ? 50.0f : 102.0f), AndroidUtilities.dp(289.0f));
}
this.backgroundWidth -= AndroidUtilities.dp(4.0f);
if (checkNeedDrawShareButton(messageObject)) {
this.backgroundWidth -= AndroidUtilities.dp(20.0f);
}
int dp51 = this.backgroundWidth - AndroidUtilities.dp(37.0f);
this.availableTimeWidth = dp51;
int dp52 = dp51 - AndroidUtilities.dp(54.0f);
int dp53 = this.backgroundWidth - AndroidUtilities.dp(17.0f);
int dp54 = AndroidUtilities.dp(195.0f);
double d5 = 268435456;
double d6 = (d3 * 3.141592653589793d) / 180.0d;
double atan = ((1.5707963267948966d - (Math.atan(Math.exp(((Math.round(d5 - ((Math.log((Math.sin(d6) + 1.0d) / (1.0d - Math.sin(d6))) * r20) / 2.0d)) - (AndroidUtilities.dp(10.3f) << 6)) - d5) / (d5 / 3.141592653589793d))) * 2.0d)) * 180.0d) / 3.141592653589793d;
int i271 = this.currentAccount;
float f28 = dp53;
float f29 = AndroidUtilities.density;
float f30 = dp54;
this.currentUrl = AndroidUtilities.formapMapUrl(i271, atan, d4, (int) (f28 / f29), (int) (f30 / f29), false, 15, i37);
long j7 = tLRPC$GeoPoint.access_hash;
float f31 = AndroidUtilities.density;
this.currentWebFile = WebFile.createWithGeoPoint(atan, d4, j7, (int) (f28 / f31), (int) (f30 / f31), 15, Math.min(2, (int) Math.ceil(f31)));
this.photoImage.setCrossfadeWithOldImage(true);
boolean isCurrentLocationTimeExpired = isCurrentLocationTimeExpired(messageObject);
this.locationExpired = isCurrentLocationTimeExpired;
if (isCurrentLocationTimeExpired) {
this.backgroundWidth -= AndroidUtilities.dp(9.0f);
dp9 = 0;
} else {
this.mediaBackground = false;
dp9 = AndroidUtilities.dp(56.0f);
AndroidUtilities.runOnUIThread(this.invalidateRunnable, 1000L);
this.scheduledInvalidate = true;
}
this.docTitleLayout = new StaticLayout(TextUtils.ellipsize(LocaleController.getString("AttachLiveLocation", org.telegram.messenger.R.string.AttachLiveLocation), Theme.chat_locationTitlePaint, dp52, TextUtils.TruncateAt.END), Theme.chat_locationTitlePaint, dp52 + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
updateCurrentUserAndChat();
TLRPC$User tLRPC$User4 = this.currentUser;
if (tLRPC$User4 != null) {
this.contactAvatarDrawable.setInfo(this.currentAccount, tLRPC$User4);
this.locationImageReceiver.setForUserOrChat(this.currentUser, this.contactAvatarDrawable);
} else {
TLRPC$Chat tLRPC$Chat5 = this.currentChat;
if (tLRPC$Chat5 != null) {
TLRPC$ChatPhoto tLRPC$ChatPhoto2 = tLRPC$Chat5.photo;
if (tLRPC$ChatPhoto2 != null) {
this.currentPhoto = tLRPC$ChatPhoto2.photo_small;
}
this.contactAvatarDrawable.setInfo(this.currentAccount, tLRPC$Chat5);
this.locationImageReceiver.setForUserOrChat(this.currentChat, this.contactAvatarDrawable);
} else {
this.locationImageReceiver.setImage(null, null, this.contactAvatarDrawable, null, null, 0);
}
}
messageObject8 = messageObject;
int i272 = messageObject8.messageOwner.edit_date;
this.infoLayout = new StaticLayout(TextUtils.ellipsize(LocaleController.formatLocationUpdateDate(i272 == 0 ? r3.date : i272), Theme.chat_locationAddressPaint, AndroidUtilities.dp(2.0f) + dp52, TextUtils.TruncateAt.END), Theme.chat_locationAddressPaint, dp52, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
i38 = dp53;
i39 = dp9;
i40 = dp54;
} else if (!TextUtils.isEmpty(MessageObject.getMedia(messageObject37.messageOwner).title)) {
if (AndroidUtilities.isTablet()) {
this.backgroundWidth = Math.min(AndroidUtilities.getMinTabletSide() - AndroidUtilities.dp(!z8 ? 50.0f : 102.0f), AndroidUtilities.dp(289.0f));
} else {
this.backgroundWidth = Math.min(getParentWidth() - AndroidUtilities.dp(!z8 ? 50.0f : 102.0f), AndroidUtilities.dp(289.0f));
}
this.backgroundWidth -= AndroidUtilities.dp(4.0f);
if (checkNeedDrawShareButton(messageObject)) {
this.backgroundWidth -= AndroidUtilities.dp(20.0f);
}
int dp55 = this.backgroundWidth - AndroidUtilities.dp(34.0f);
this.availableTimeWidth = dp55;
int dp56 = this.backgroundWidth - AndroidUtilities.dp(17.0f);
int dp57 = AndroidUtilities.dp(195.0f);
this.mediaBackground = false;
int i273 = this.currentAccount;
float f32 = dp56;
float f33 = AndroidUtilities.density;
float f34 = dp57;
this.currentUrl = AndroidUtilities.formapMapUrl(i273, d3, d4, (int) (f32 / f33), (int) (f34 / f33), true, 15, i37);
float f35 = AndroidUtilities.density;
this.currentWebFile = WebFile.createWithGeoPoint(tLRPC$GeoPoint, (int) (f32 / f35), (int) (f34 / f35), 15, Math.min(2, (int) Math.ceil(f35)));
this.docTitleLayout = StaticLayoutEx.createStaticLayout(MessageObject.getMedia(messageObject37.messageOwner).title, Theme.chat_locationTitlePaint, dp55 + AndroidUtilities.dp(4.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false, TextUtils.TruncateAt.END, dp55, 1);
int dp58 = AndroidUtilities.dp(50.0f) + 0;
this.docTitleLayout.getLineCount();
if (!TextUtils.isEmpty(MessageObject.getMedia(messageObject37.messageOwner).address)) {
this.infoLayout = StaticLayoutEx.createStaticLayout(MessageObject.getMedia(messageObject37.messageOwner).address, Theme.chat_locationAddressPaint, dp55, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false, TextUtils.TruncateAt.END, dp55, 1);
measureTime(messageObject);
int ceil8 = (this.backgroundWidth - ((int) Math.ceil(this.infoLayout.getLineWidth(0)))) - AndroidUtilities.dp(24.0f);
boolean z85 = this.infoLayout.getLineLeft(0) > 0.0f;
if (!z85) {
int i274 = this.timeWidth;
if (messageObject.isOutOwner()) {
i44 = 20;
i45 = 20;
} else {
i45 = 0;
i44 = 20;
}
}
dp58 += AndroidUtilities.dp(!z85 ? 8.0f : 10.0f);
} else {
this.infoLayout = null;
}
i39 = dp58;
i38 = dp56;
i40 = dp57;
messageObject8 = messageObject37;
} else {
if (AndroidUtilities.isTablet()) {
this.backgroundWidth = Math.min(AndroidUtilities.getMinTabletSide() - AndroidUtilities.dp(!z8 ? 50.0f : 102.0f), AndroidUtilities.dp(289.0f));
} else {
this.backgroundWidth = Math.min(getParentWidth() - AndroidUtilities.dp(!z8 ? 50.0f : 102.0f), AndroidUtilities.dp(289.0f));
}
this.backgroundWidth -= AndroidUtilities.dp(4.0f);
if (checkNeedDrawShareButton(messageObject)) {
this.backgroundWidth -= AndroidUtilities.dp(20.0f);
}
this.availableTimeWidth = this.backgroundWidth - AndroidUtilities.dp(34.0f);
int dp59 = this.backgroundWidth - AndroidUtilities.dp(8.0f);
int dp60 = AndroidUtilities.dp(195.0f);
int i275 = this.currentAccount;
float f36 = dp59;
float f37 = AndroidUtilities.density;
float f38 = dp60;
this.currentUrl = AndroidUtilities.formapMapUrl(i275, d3, d4, (int) (f36 / f37), (int) (f38 / f37), true, 15, i37);
float f39 = AndroidUtilities.density;
this.currentWebFile = WebFile.createWithGeoPoint(tLRPC$GeoPoint, (int) (f36 / f39), (int) (f38 / f39), 15, Math.min(2, (int) Math.ceil(f39)));
i38 = dp59;
i40 = dp60;
messageObject8 = messageObject37;
i39 = 0;
}
if (((int) messageObject.getDialogId()) != 0) {
int i276 = SharedConfig.mapPreviewType;
if (i276 == 0) {
this.currentMapProvider = 2;
} else if (i276 == 1) {
this.currentMapProvider = 1;
} else if (i276 == 3) {
this.currentMapProvider = 1;
} else {
this.currentMapProvider = -1;
}
} else {
this.currentMapProvider = MessagesController.getInstance(messageObject8.currentAccount).mapProvider;
}
if (this.locationLoadingThumb == null) {
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(org.telegram.messenger.R.raw.map_placeholder, Theme.key_chat_outLocationIcon, (!Theme.isCurrentThemeDark() ? 6 : 3) * 0.12f);
svgThumb.setAspectCenter(true);
this.locationLoadingThumb = new ClipRoundedDrawable(svgThumb);
}
drawable = this.locationLoadingThumb;
if ((drawable instanceof ClipRoundedDrawable) && (((ClipRoundedDrawable) drawable).getDrawable() instanceof SvgHelper.SvgDrawable)) {
((SvgHelper.SvgDrawable) ((ClipRoundedDrawable) this.locationLoadingThumb).getDrawable()).setColorKey(messageObject.isOutOwner() ? Theme.key_chat_inLocationIcon : Theme.key_chat_outLocationIcon, this.resourcesProvider);
}
this.photoImage.setCrossfadeDuration(300);
this.photoImage.setCrossfadeByScale(0.05f);
i41 = this.currentMapProvider;
if (i41 == -1) {
if (i41 == 2) {
i42 = 3;
i43 = 4;
WebFile webFile5 = this.currentWebFile;
if (webFile5 != null) {
Object obj5 = messageObject8.lastGeoWebFileLoaded;
ImageLocation imageLocation2 = !(obj5 instanceof ImageLocation) ? null : (ImageLocation) obj5;
messageObject8.lastGeoWebFileSet = ImageLocation.getForWebFile(webFile5);
f6 = 50.0f;
this.photoImage.setImage(ImageLocation.getForWebFile(this.currentWebFile), (String) null, imageLocation2, (String) null, this.locationLoadingThumb, messageObject, 0);
f7 = 1.0f;
messageObject6 = messageObject8;
i26 = 3;
i27 = 4;
}
} else {
i42 = 3;
i43 = 4;
if (i41 == 3 || i41 == 4) {
ImageLoader.getInstance().addTestWebFile(this.currentUrl, this.currentWebFile);
this.addedForTest = true;
}
String str27 = this.currentUrl;
if (str27 != null) {
this.photoImage.setImage(str27, null, this.locationLoadingThumb, null, 0L);
}
}
messageObject6 = messageObject8;
i26 = i42;
i27 = i43;
f6 = 50.0f;
f7 = 1.0f;
} else {
f6 = 50.0f;
f7 = 1.0f;
messageObject6 = messageObject8;
i26 = 3;
i27 = 4;
this.photoImage.setImage(null, null, null, null, messageObject, 0);
}
reactionsLayoutInBubble4 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble4.isSmall && !reactionsLayoutInBubble4.isEmpty) {
reactionsLayoutInBubble4.measure(this.backgroundWidth - AndroidUtilities.dp(16.0f), i26);
ReactionsLayoutInBubble reactionsLayoutInBubble28 = this.reactionsLayoutInBubble;
reactionsLayoutInBubble28.totalHeight = reactionsLayoutInBubble28.height + AndroidUtilities.dp(14.0f);
measureTime(messageObject);
if (this.reactionsLayoutInBubble.lastLineX + this.timeWidth + AndroidUtilities.dp(24.0f) > this.backgroundWidth) {
this.reactionsLayoutInBubble.totalHeight += AndroidUtilities.dp(12.0f);
this.reactionsLayoutInBubble.positionOffsetY -= AndroidUtilities.dp(12.0f);
}
i39 += this.reactionsLayoutInBubble.totalHeight;
}
i33 = i39;
i30 = i40;
dp5 = i38;
i29 = 1;
i31 = 0;
i7 = 1;
i34 = 0;
}
i37 = -1;
if (!(MessageObject.getMedia(messageObject37.messageOwner) instanceof TLRPC$TL_messageMediaGeoLive)) {
}
if (((int) messageObject.getDialogId()) != 0) {
}
if (this.locationLoadingThumb == null) {
}
drawable = this.locationLoadingThumb;
if (drawable instanceof ClipRoundedDrawable) {
((SvgHelper.SvgDrawable) ((ClipRoundedDrawable) this.locationLoadingThumb).getDrawable()).setColorKey(messageObject.isOutOwner() ? Theme.key_chat_inLocationIcon : Theme.key_chat_outLocationIcon, this.resourcesProvider);
}
this.photoImage.setCrossfadeDuration(300);
this.photoImage.setCrossfadeByScale(0.05f);
i41 = this.currentMapProvider;
if (i41 == -1) {
}
reactionsLayoutInBubble4 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble4.isSmall) {
reactionsLayoutInBubble4.measure(this.backgroundWidth - AndroidUtilities.dp(16.0f), i26);
ReactionsLayoutInBubble reactionsLayoutInBubble282 = this.reactionsLayoutInBubble;
reactionsLayoutInBubble282.totalHeight = reactionsLayoutInBubble282.height + AndroidUtilities.dp(14.0f);
measureTime(messageObject);
if (this.reactionsLayoutInBubble.lastLineX + this.timeWidth + AndroidUtilities.dp(24.0f) > this.backgroundWidth) {
}
i39 += this.reactionsLayoutInBubble.totalHeight;
}
i33 = i39;
i30 = i40;
dp5 = i38;
i29 = 1;
i31 = 0;
i7 = 1;
i34 = 0;
}
if (this.blurredPhotoImage.getBitmap() != null) {
spoilerEffect22 = null;
} else {
this.blurredPhotoImage.getBitmap().recycle();
spoilerEffect22 = null;
this.blurredPhotoImage.setImageBitmap((Bitmap) null);
}
if (this.photoImage.getBitmap() != null && !this.photoImage.getBitmap().isRecycled() && this.currentMessageObject.hasMediaSpoilers() && !this.currentMessageObject.isMediaSpoilersRevealed) {
this.blurredPhotoImage.setImageBitmap(Utilities.stackBlurBitmapMax(this.photoImage.getBitmap(), this.currentMessageObject.isRoundVideo()));
this.blurredPhotoImage.setColorFilter(getFancyBlurFilter());
}
setMessageObjectInternal(messageObject);
if (this.drawForwardedName && messageObject.needDrawForwarded() && ((groupedMessagePosition5 = this.currentPosition) == null || groupedMessagePosition5.minY == 0)) {
if (messageObject6.type != 5) {
this.namesOffset += AndroidUtilities.dp(5.0f);
}
} else if (this.drawNameLayout && (messageObject.getReplyMsgId() == 0 || (this.isThreadChat && messageObject.getReplyTopMsgId() == 0))) {
this.namesOffset += AndroidUtilities.dp(7.0f);
}
this.totalHeight = AndroidUtilities.dp(14.0f) + i30 + this.namesOffset + i33;
if (messageObject.isVoiceTranscriptionOpen()) {
this.totalHeight += AndroidUtilities.dp(56.0f);
}
MessageObject.GroupedMessagePosition groupedMessagePosition22 = this.currentPosition;
if (groupedMessagePosition22 == null) {
i35 = 8;
} else {
i35 = 8;
if ((groupedMessagePosition22.flags & 8) == 0 && !this.currentMessageObject.isDocument() && this.currentMessageObject.type != 19) {
this.totalHeight -= AndroidUtilities.dp(3.0f);
}
}
if (this.currentMessageObject.isDice()) {
this.totalHeight += AndroidUtilities.dp(21.0f);
this.additionalTimeOffsetY = AndroidUtilities.dp(21.0f);
}
if (this.currentPosition != null && !this.currentMessageObject.isDocument()) {
dp5 += getAdditionalWidthForPosition(this.currentPosition);
if ((this.currentPosition.flags & i27) == 0) {
i36 = i31;
} else {
i30 += AndroidUtilities.dp(4.0f);
i36 = 0 - AndroidUtilities.dp(4.0f);
}
if ((this.currentPosition.flags & i35) == 0) {
i30 += AndroidUtilities.dp(f7);
}
} else {
if (this.currentPosition != null && this.currentMessageObject.isDocument()) {
int i277 = this.currentPosition.flags;
if ((i277 & 4) == 0 && (i277 & i35) != 0 && !messageObject.isOutOwner() && !this.drawPhotoImage) {
this.totalHeight -= AndroidUtilities.dp(2.0f);
}
}
i36 = i31;
}
if (this.currentMessageObject.type != 19) {
dp8 = i31;
} else {
if (this.drawPinnedTop) {
this.namesOffset -= AndroidUtilities.dp(this.documentAttachType != i29 ? f7 : 2.0f);
}
if (this.drawPinnedTop && !messageObject.isOutOwner()) {
this.totalHeight += AndroidUtilities.dp(this.documentAttachType != i29 ? 0.0f : 2.0f);
}
if (this.namesOffset > 0) {
dp8 = AndroidUtilities.dp(7.0f);
this.totalHeight -= AndroidUtilities.dp(2.0f);
} else {
dp8 = AndroidUtilities.dp(5.0f);
this.totalHeight -= AndroidUtilities.dp(4.0f);
}
}
if (this.currentPosition != null) {
MessageObject.GroupedMessages groupedMessages7 = this.currentMessagesGroup;
if (groupedMessages7.isDocuments && groupedMessages7.messages.size() > i29) {
if ((this.currentPosition.flags & i27) == 0) {
this.totalHeight -= AndroidUtilities.dp(!this.drawPhotoImage ? 6.0f : 3.0f);
this.mediaOffsetY -= AndroidUtilities.dp(!this.drawPhotoImage ? 6.0f : 3.0f);
dp8 -= AndroidUtilities.dp(!this.drawPhotoImage ? 6.0f : 3.0f);
}
if ((this.currentPosition.flags & i35) == 0) {
this.totalHeight -= AndroidUtilities.dp(!this.drawPhotoImage ? 6.0f : 3.0f);
}
}
}
if (messageObject.isRoundVideo() && messageObject.isVoiceTranscriptionOpen()) {
this.photoImage.setImageCoords(0.0f, AndroidUtilities.dp(13.0f), AndroidUtilities.dp(44.0f), AndroidUtilities.dp(44.0f));
} else {
this.photoImage.setImageCoords(0.0f, dp8 + this.namesOffset + i36, dp5, i30);
}
if (messageObject.hasMediaSpoilers() && SpoilerEffect2.supports()) {
if (this.mediaSpoilerEffect2 == null) {
SpoilerEffect2 spoilerEffect23 = SpoilerEffect2.getInstance(this);
this.mediaSpoilerEffect2 = spoilerEffect23;
Integer num = this.mediaSpoilerEffect2Index;
if (num != null) {
spoilerEffect23.reassignAttach(this, num.intValue());
}
}
} else {
SpoilerEffect2 spoilerEffect24 = this.mediaSpoilerEffect2;
if (spoilerEffect24 != null) {
spoilerEffect24.detach(this);
this.mediaSpoilerEffect2 = spoilerEffect22;
}
}
invalidate();
f = f6;
spoilerEffect2 = spoilerEffect22;
i4 = i26;
i5 = i27;
messageObject2 = messageObject6;
i6 = i34;
i3 = 20;
}
f2 = 1.0f;
r7 = spoilerEffect2;
} else {
messageObject5 = messageObject20;
f4 = 50.0f;
createSelectorDrawable(0);
this.drawName = false;
this.drawForwardedName = false;
this.drawPhotoImage = false;
if (AndroidUtilities.isTablet()) {
this.backgroundWidth = Math.min(AndroidUtilities.getMinTabletSide() - AndroidUtilities.dp(!z8 ? 50.0f : 102.0f), AndroidUtilities.dp(270.0f));
} else {
this.backgroundWidth = Math.min(getParentWidth() - AndroidUtilities.dp(!z8 ? 50.0f : 102.0f), AndroidUtilities.dp(270.0f));
}
this.availableTimeWidth = this.backgroundWidth - AndroidUtilities.dp(31.0f);
int maxNameWidth2 = getMaxNameWidth() - AndroidUtilities.dp(50.0f);
if (maxNameWidth2 < 0) {
maxNameWidth2 = AndroidUtilities.dp(10.0f);
}
String format8 = LocaleController.getInstance().formatterDay.format(messageObject5.messageOwner.date * 1000);
TLRPC$TL_messageActionPhoneCall tLRPC$TL_messageActionPhoneCall = (TLRPC$TL_messageActionPhoneCall) messageObject5.messageOwner.action;
boolean z86 = tLRPC$TL_messageActionPhoneCall.reason instanceof TLRPC$TL_phoneCallDiscardReasonMissed;
if (messageObject.isOutOwner()) {
if (z86) {
if (tLRPC$TL_messageActionPhoneCall.video) {
string2 = LocaleController.getString("CallMessageVideoOutgoingMissed", org.telegram.messenger.R.string.CallMessageVideoOutgoingMissed);
} else {
string2 = LocaleController.getString("CallMessageOutgoingMissed", org.telegram.messenger.R.string.CallMessageOutgoingMissed);
}
} else if (tLRPC$TL_messageActionPhoneCall.video) {
string2 = LocaleController.getString("CallMessageVideoOutgoing", org.telegram.messenger.R.string.CallMessageVideoOutgoing);
} else {
string2 = LocaleController.getString("CallMessageOutgoing", org.telegram.messenger.R.string.CallMessageOutgoing);
}
} else if (z86) {
if (tLRPC$TL_messageActionPhoneCall.video) {
string2 = LocaleController.getString("CallMessageVideoIncomingMissed", org.telegram.messenger.R.string.CallMessageVideoIncomingMissed);
} else {
string2 = LocaleController.getString("CallMessageIncomingMissed", org.telegram.messenger.R.string.CallMessageIncomingMissed);
}
} else if (tLRPC$TL_messageActionPhoneCall.reason instanceof TLRPC$TL_phoneCallDiscardReasonBusy) {
if (tLRPC$TL_messageActionPhoneCall.video) {
string2 = LocaleController.getString("CallMessageVideoIncomingDeclined", org.telegram.messenger.R.string.CallMessageVideoIncomingDeclined);
} else {
string2 = LocaleController.getString("CallMessageIncomingDeclined", org.telegram.messenger.R.string.CallMessageIncomingDeclined);
}
} else if (tLRPC$TL_messageActionPhoneCall.video) {
string2 = LocaleController.getString("CallMessageVideoIncoming", org.telegram.messenger.R.string.CallMessageVideoIncoming);
} else {
string2 = LocaleController.getString("CallMessageIncoming", org.telegram.messenger.R.string.CallMessageIncoming);
}
if (tLRPC$TL_messageActionPhoneCall.duration > 0) {
format8 = format8 + ", " + LocaleController.formatCallDuration(tLRPC$TL_messageActionPhoneCall.duration);
}
this.titleLayout = new StaticLayout(TextUtils.ellipsize(string2, Theme.chat_audioTitlePaint, maxNameWidth2, TextUtils.TruncateAt.END), Theme.chat_audioTitlePaint, maxNameWidth2 + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.docTitleLayout = new StaticLayout(TextUtils.ellipsize(format8, Theme.chat_contactPhonePaint, maxNameWidth2 - AndroidUtilities.dp(19.0f), TextUtils.TruncateAt.END), Theme.chat_contactPhonePaint, maxNameWidth2 + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
setMessageObjectInternal(messageObject);
int dp61 = AndroidUtilities.dp(65.0f);
int i278 = this.namesOffset;
this.totalHeight = dp61 + i278;
if (this.drawPinnedTop) {
this.namesOffset = i278 - AndroidUtilities.dp(1.0f);
}
}
f = f4;
messageObject2 = messageObject5;
i3 = 20;
i4 = 3;
i5 = 4;
z11 = false;
f2 = 1.0f;
}
if (!(this.currentPosition == null || this.currentMessageObject.isMusic() || this.currentMessageObject.isDocument()) || messageObject.isAnyKindOfSticker() || this.addedCaptionHeight != 0 || messageObject.isExpiredStory()) {
i = -1;
i8 = 5;
} else {
if (!messageObject2.isRestrictedMessage && this.captionLayout == null && (messageObject2.caption != null || messageObject.isVoiceTranscriptionOpen())) {
CharSequence voiceTranscription = !messageObject.isVoiceTranscriptionOpen() ? messageObject2.caption : messageObject.getVoiceTranscription();
this.currentCaption = voiceTranscription;
if (voiceTranscription != null && !TextUtils.isEmpty(messageObject2.messageOwner.voiceTranscription) && this.currentMessageObject.isVoiceTranscriptionOpen() && !this.currentMessageObject.messageOwner.voiceTranscriptionFinal) {
String str28 = ((Object) this.currentCaption) + " ";
this.currentCaption = str28;
if (!(str28 instanceof Spannable)) {
this.currentCaption = new SpannableString(this.currentCaption);
}
((SpannableString) this.currentCaption).setSpan(new TranscribeButton.LoadingPointsSpan(), this.currentCaption.length() - 1, this.currentCaption.length(), 33);
}
try {
int i279 = this.backgroundWidth;
try {
if (this.currentMessageObject.type != 2 && !this.isRoundVideo) {
if (this.drawSideButton != 0 && this.isRoundVideo) {
i279 -= AndroidUtilities.dp(24.0f);
}
i8 = 5;
int dp62 = (i279 - AndroidUtilities.dp(31 + (this.currentMessageObject.type != 5 ? 0 : 14))) - (getExtraTextX() * 2);
this.captionFullWidth = dp62;
this.captionLayout = new MessageObject.TextLayoutBlocks(this.currentMessageObject, this.currentCaption, Theme.chat_msgTextPaint, dp62);
updateSeekBarWaveformWidth(r7);
}
int dp622 = (i279 - AndroidUtilities.dp(31 + (this.currentMessageObject.type != 5 ? 0 : 14))) - (getExtraTextX() * 2);
this.captionFullWidth = dp622;
this.captionLayout = new MessageObject.TextLayoutBlocks(this.currentMessageObject, this.currentCaption, Theme.chat_msgTextPaint, dp622);
updateSeekBarWaveformWidth(r7);
} catch (Exception e17) {
e = e17;
FileLog.e(e);
i9 = this.highlightCaptionToSetStart;
if (i9 >= 0) {
highlight(i9, this.highlightCaptionToSetEnd, textLayoutBlocks.textLayoutBlocks);
}
i = -1;
this.highlightCaptionToSetEnd = -1;
this.highlightCaptionToSetStart = -1;
if (this.captionLayout == null) {
}
try {
if (messageObject.isVoiceTranscriptionOpen()) {
float dp63 = ((this.backgroundWidth - AndroidUtilities.dp(31.0f)) - AndroidUtilities.dp(10.0f)) - (getExtraTextX() * 2);
this.backgroundWidth = (int) (this.backgroundWidth + (Math.max(dp63, this.captionLayout.textWidth) - dp63));
}
int dp64 = this.backgroundWidth - AndroidUtilities.dp(31.0f);
if (this.captionLayout == null) {
}
if (valueOf != null) {
}
i10 = 8;
} catch (Exception e18) {
e = e18;
i10 = 8;
}
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i1622222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
if (messageObject.isVoiceTranscriptionOpen()) {
if (AndroidUtilities.isTablet()) {
minTabletSide = AndroidUtilities.getMinTabletSide();
dp = AndroidUtilities.dp(z8 ? 102.0f : f);
} else {
minTabletSide = getParentWidth();
dp = AndroidUtilities.dp(z8 ? 102.0f : f);
}
i279 = minTabletSide - dp;
}
if (this.drawSideButton != 0) {
i279 -= AndroidUtilities.dp(24.0f);
}
i8 = 5;
} catch (Exception e19) {
e = e19;
i8 = 5;
}
} else {
i8 = 5;
}
i9 = this.highlightCaptionToSetStart;
if (i9 >= 0 && (textLayoutBlocks = this.captionLayout) != null) {
highlight(i9, this.highlightCaptionToSetEnd, textLayoutBlocks.textLayoutBlocks);
}
i = -1;
this.highlightCaptionToSetEnd = -1;
this.highlightCaptionToSetStart = -1;
if (this.captionLayout == null || (i12 = this.currentMessageObject.type) == 2 || i12 == i8) {
if (messageObject.isVoiceTranscriptionOpen() && this.captionLayout != null) {
float dp632 = ((this.backgroundWidth - AndroidUtilities.dp(31.0f)) - AndroidUtilities.dp(10.0f)) - (getExtraTextX() * 2);
this.backgroundWidth = (int) (this.backgroundWidth + (Math.max(dp632, this.captionLayout.textWidth) - dp632));
}
int dp642 = this.backgroundWidth - AndroidUtilities.dp(31.0f);
if (this.captionLayout == null) {
valueOf = Float.valueOf(r1.lastLineWidth);
} else {
valueOf = this.currentMessageObject.type != 2 ? r7 : Float.valueOf(AndroidUtilities.dp(64.0f));
}
if (valueOf != null) {
MessageObject.TextLayoutBlocks textLayoutBlocks6 = this.captionLayout;
if (textLayoutBlocks6 != null) {
this.captionWidth = dp642;
this.captionHeight = textLayoutBlocks6.textHeight;
}
this.totalHeight += this.captionHeight + AndroidUtilities.dp(9.0f);
MessageObject.TextLayoutBlocks textLayoutBlocks7 = this.captionLayout;
if (textLayoutBlocks7 != null) {
if (!textLayoutBlocks7.hasCodeAtBottom && !textLayoutBlocks7.hasQuoteAtBottom) {
}
this.captionHeight += AndroidUtilities.dp(10.0f);
this.totalHeight += AndroidUtilities.dp(10.0f);
}
ReactionsLayoutInBubble reactionsLayoutInBubble29 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble29.isEmpty && !reactionsLayoutInBubble29.isSmall) {
}
MessageObject.GroupedMessagePosition groupedMessagePosition23 = this.currentPosition;
if (groupedMessagePosition23 == null) {
i10 = 8;
} else {
i10 = 8;
}
try {
} catch (Exception e20) {
e = e20;
FileLog.e(e);
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i16222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
if ((dp642 - AndroidUtilities.dp(8.0f)) - valueOf.floatValue() < this.timeWidth + (!messageObject.isOutOwner() ? 0 : AndroidUtilities.dp(20.0f)) + getExtraTimeX()) {
this.totalHeight += AndroidUtilities.dp(14.0f);
if (this.captionLayout != null) {
this.captionHeight += AndroidUtilities.dp(14.0f);
i11 = 2;
i6 = i11;
groupedMessagePosition2 = this.currentPosition;
if ((groupedMessagePosition2 != null || (groupedMessagePosition2.flags & i10) != 0) && this.captionLayout == null) {
int i162222222222 = this.widthBeforeNewTimeLine;
}
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0 || messageObject3.isMediaEmpty() || MessageObject.getMedia(this.currentMessageObject.messageOwner).webpage == null) {
f3 = 0.0f;
} else {
int dp65 = this.backgroundWidth - AndroidUtilities.dp(41.0f);
this.hasOldCaptionPreview = true;
this.linkPreviewHeight = 0;
TLRPC$WebPage tLRPC$WebPage2 = MessageObject.getMedia(this.currentMessageObject.messageOwner).webpage;
try {
int ceil9 = (int) Math.ceil(Theme.chat_replyNamePaint.measureText(tLRPC$WebPage2.site_name) + f2);
this.siteNameWidth = ceil9;
this.siteNameLayout = new StaticLayout(tLRPC$WebPage2.site_name, Theme.chat_replyNamePaint, Math.min(ceil9, dp65), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
f3 = 0.0f;
try {
this.siteNameLayoutWidth = 0.0f;
this.siteNameLeft = 0.0f;
for (i15 = 0; i15 < this.siteNameLayout.getLineCount(); i15++) {
this.siteNameLeft = this.siteNameLayout.getLineLeft(i15);
this.siteNameLayoutWidth = this.siteNameLayout.getLineWidth(i15);
}
StaticLayout staticLayout18 = this.siteNameLayout;
int lineBottom5 = staticLayout18.getLineBottom(staticLayout18.getLineCount() - 1);
this.linkPreviewHeight += lineBottom5;
this.totalHeight += lineBottom5;
} catch (Exception e21) {
e = e21;
FileLog.e(e);
this.descriptionX = 0;
if (this.linkPreviewHeight != 0) {
}
StaticLayout createStaticLayout = StaticLayoutEx.createStaticLayout(tLRPC$WebPage2.description, Theme.chat_replyTextPaint, dp65, Layout.Alignment.ALIGN_NORMAL, 1.0f, AndroidUtilities.dp(f2), false, TextUtils.TruncateAt.END, dp65, 6);
this.descriptionLayout = createStaticLayout;
int lineBottom6 = createStaticLayout.getLineBottom(createStaticLayout.getLineCount() - 1);
this.linkPreviewHeight += lineBottom6;
this.totalHeight += lineBottom6;
z12 = false;
while (i14 < this.descriptionLayout.getLineCount()) {
}
if (z12) {
}
i13 = messageObject2.type;
if (i13 != 1) {
}
this.totalHeight += AndroidUtilities.dp(6.0f);
int dp66 = this.totalHeight + AndroidUtilities.dp(17.0f);
this.totalHeight = dp66;
if (i6 != 0) {
}
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
} catch (Exception e22) {
e = e22;
f3 = 0.0f;
}
try {
this.descriptionX = 0;
if (this.linkPreviewHeight != 0) {
this.totalHeight += AndroidUtilities.dp(2.0f);
}
StaticLayout createStaticLayout2 = StaticLayoutEx.createStaticLayout(tLRPC$WebPage2.description, Theme.chat_replyTextPaint, dp65, Layout.Alignment.ALIGN_NORMAL, 1.0f, AndroidUtilities.dp(f2), false, TextUtils.TruncateAt.END, dp65, 6);
this.descriptionLayout = createStaticLayout2;
int lineBottom62 = createStaticLayout2.getLineBottom(createStaticLayout2.getLineCount() - 1);
this.linkPreviewHeight += lineBottom62;
this.totalHeight += lineBottom62;
z12 = false;
for (i14 = 0; i14 < this.descriptionLayout.getLineCount(); i14++) {
int ceil10 = (int) Math.ceil(this.descriptionLayout.getLineLeft(i14));
if (ceil10 == 0) {
z12 = true;
} else {
int i280 = this.descriptionX;
if (i280 == 0) {
this.descriptionX = -ceil10;
} else {
this.descriptionX = Math.max(i280, -ceil10);
}
}
}
if (z12) {
this.descriptionX = 0;
}
} catch (Exception e23) {
FileLog.e(e23);
}
i13 = messageObject2.type;
if (i13 != 1 || i13 == i4 || i13 == i3) {
this.totalHeight += AndroidUtilities.dp(6.0f);
}
int dp662 = this.totalHeight + AndroidUtilities.dp(17.0f);
this.totalHeight = dp662;
if (i6 != 0) {
this.totalHeight = dp662 - AndroidUtilities.dp(14.0f);
if (i6 == 2) {
this.captionHeight -= AndroidUtilities.dp(14.0f);
}
}
}
this.botButtons.clear();
if (z60) {
this.botButtonsByData.clear();
this.botButtonsByPosition.clear();
this.botButtonsLayout = r7;
}
if (!messageObject2.isRestrictedMessage && !messageObject2.isRepostPreview && this.currentPosition == null && (messageObject2.messageOwner.reply_markup instanceof TLRPC$TL_replyInlineMarkup) && !messageObject.hasExtendedMedia()) {
TLRPC$ReplyMarkup tLRPC$ReplyMarkup = messageObject2.messageOwner.reply_markup;
int size15 = tLRPC$ReplyMarkup instanceof TLRPC$TL_replyInlineMarkup ? 1 : tLRPC$ReplyMarkup.rows.size();
int dp67 = (AndroidUtilities.dp(48.0f) * size15) + AndroidUtilities.dp(f2);
this.keyboardHeight = dp67;
this.substractBackgroundHeight = dp67;
dp2 = this.backgroundWidth - AndroidUtilities.dp(this.mediaBackground ? 9.0f : f3);
this.widthForButtons = dp2;
if (messageObject2.wantedBotKeyboardWidth > dp2) {
int i281 = -AndroidUtilities.dp(!z8 ? 10.0f : 62.0f);
if (AndroidUtilities.isTablet()) {
minTabletSide2 = AndroidUtilities.getMinTabletSide();
} else {
minTabletSide2 = Math.min(getParentWidth(), AndroidUtilities.displaySize.y) - AndroidUtilities.dp(5.0f);
}
this.widthForButtons = Math.max(this.backgroundWidth, Math.min(messageObject2.wantedBotKeyboardWidth, i281 + minTabletSide2));
}
HashMap hashMap2 = new HashMap(this.botButtonsByData);
sb = messageObject2.botButtonsLayout;
if (sb != null && (str = this.botButtonsLayout) != null && str.equals(sb.toString())) {
hashMap = new HashMap(this.botButtonsByPosition);
} else {
sb2 = messageObject2.botButtonsLayout;
if (sb2 != null) {
this.botButtonsLayout = sb2.toString();
}
hashMap = r7;
}
this.botButtonsByData.clear();
if (messageObject2.messageOwner.reply_markup instanceof TLRPC$TL_replyInlineMarkup) {
int i282 = 0;
int i283 = 0;
AnonymousClass1 anonymousClass12 = r7;
while (i282 < size15) {
TLRPC$TL_keyboardButtonRow tLRPC$TL_keyboardButtonRow = messageObject2.messageOwner.reply_markup.rows.get(i282);
int size16 = tLRPC$TL_keyboardButtonRow.buttons.size();
if (size16 != 0) {
int dp68 = ((this.widthForButtons - (AndroidUtilities.dp(5.0f) * (size16 - 1))) - AndroidUtilities.dp(2.0f)) / size16;
int i284 = 0;
AnonymousClass1 anonymousClass13 = anonymousClass12;
while (i284 < tLRPC$TL_keyboardButtonRow.buttons.size()) {
BotButton botButton2 = new BotButton();
botButton2.button = tLRPC$TL_keyboardButtonRow.buttons.get(i284);
String bytesToHex = Utilities.bytesToHex(botButton2.button.data);
String str29 = tLRPC$TL_keyboardButtonRow + "" + i284;
if (hashMap != null) {
botButton = (BotButton) hashMap.get(str29);
} else {
botButton = (BotButton) hashMap2.get(bytesToHex);
}
if (botButton == null) {
i17 = dp68;
botButton2.lastUpdateTime = System.currentTimeMillis();
} else {
i17 = dp68;
botButton2.progressAlpha = botButton.progressAlpha;
botButton2.angle = botButton.angle;
botButton2.lastUpdateTime = botButton.lastUpdateTime;
}
this.botButtonsByData.put(bytesToHex, botButton2);
this.botButtonsByPosition.put(str29, botButton2);
botButton2.x = (i17 + AndroidUtilities.dp(5.0f)) * i284;
botButton2.y = (AndroidUtilities.dp(48.0f) * i282) + AndroidUtilities.dp(2.5f);
dp68 = i17;
botButton2.width = dp68;
botButton2.height = AndroidUtilities.dp(44.0f);
if (i284 != 0) {
i18 = 1;
} else {
i18 = 1;
BotButton.access$3776(botButton2, 1);
}
if (i284 == tLRPC$TL_keyboardButtonRow.buttons.size() - i18) {
BotButton.access$3776(botButton2, 2);
}
if (i282 == 0) {
BotButton.access$3776(botButton2, 4);
}
if (i282 == size15 - 1) {
BotButton.access$3776(botButton2, 8);
}
TextPaint textPaint2 = (TextPaint) getThemedPaint("paintChatBotButton");
if (botButton2.button instanceof TLRPC$TL_keyboardButtonBuy) {
i19 = 4;
if ((MessageObject.getMedia(messageObject2.messageOwner).flags & 4) != 0) {
string = LocaleController.getString("PaymentReceipt", org.telegram.messenger.R.string.PaymentReceipt);
botButton2.title = new StaticLayout(string, textPaint2, dp68 - AndroidUtilities.dp(10.0f), Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false);
this.botButtons.add(botButton2);
if (i284 == tLRPC$TL_keyboardButtonRow.buttons.size() - 1) {
i283 = Math.max(i283, botButton2.x + botButton2.width);
}
if (messageObject.isFromUser() && (botButton2.button instanceof TLRPC$TL_keyboardButtonUrl)) {
try {
parse = Uri.parse(botButton2.button.url);
String lowerCase2 = parse.getHost().toLowerCase();
if (parse.getQueryParameter("startgroup") != null) {
if (!"http".equals(parse.getScheme()) && !"https".equals(parse.getScheme())) {
if ("tg".equals(parse.getScheme())) {
if (botButton2.button.url.startsWith("tg:resolve")) {
}
z13 = true;
botButton2.isInviteButton = z13;
}
}
if (!"t.me".equals(lowerCase2)) {
if (!"telegram.me".equals(lowerCase2)) {
if ("telegram.dog".equals(lowerCase2)) {
}
if ("tg".equals(parse.getScheme())) {
}
}
}
z13 = true;
botButton2.isInviteButton = z13;
}
z13 = false;
botButton2.isInviteButton = z13;
} catch (Exception unused7) {
}
}
i284++;
messageObject2 = messageObject;
i5 = i19;
anonymousClass13 = null;
}
} else {
i19 = 4;
}
string = TextUtils.ellipsize(Emoji.replaceEmoji((CharSequence) (botButton2.button.text != null ? botButton2.button.text : ""), textPaint2.getFontMetricsInt(), AndroidUtilities.dp(15.0f), false), textPaint2, dp68 - AndroidUtilities.dp(10.0f), TextUtils.TruncateAt.END);
botButton2.title = new StaticLayout(string, textPaint2, dp68 - AndroidUtilities.dp(10.0f), Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false);
this.botButtons.add(botButton2);
if (i284 == tLRPC$TL_keyboardButtonRow.buttons.size() - 1) {
}
if (messageObject.isFromUser()) {
parse = Uri.parse(botButton2.button.url);
String lowerCase22 = parse.getHost().toLowerCase();
if (parse.getQueryParameter("startgroup") != null) {
}
z13 = false;
botButton2.isInviteButton = z13;
}
i284++;
messageObject2 = messageObject;
i5 = i19;
anonymousClass13 = null;
}
}
i282++;
messageObject2 = messageObject;
i5 = i5;
i4 = 3;
i = -1;
anonymousClass12 = null;
i8 = 5;
f3 = 0.0f;
}
i16 = i283;
anonymousClass1 = anonymousClass12;
} else {
i16 = 0;
anonymousClass1 = r7;
}
this.widthForButtons = i16;
r72 = anonymousClass1;
} else {
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
}
if (this.drawCommentButton) {
this.totalHeight += AndroidUtilities.dp(!shouldDrawTimeOnMedia() ? 43.0f : 41.3f);
createSelectorDrawable(1);
}
z14 = this.drawPinnedBottom;
if (z14 && this.drawPinnedTop) {
this.totalHeight -= AndroidUtilities.dp(2.0f);
} else if (!z14) {
this.totalHeight -= AndroidUtilities.dp(f2);
} else if (this.drawPinnedTop && this.pinnedBottom && (groupedMessagePosition3 = this.currentPosition) != null && groupedMessagePosition3.siblingHeights == null) {
this.totalHeight -= AndroidUtilities.dp(f2);
}
if (!this.mediaBackground) {
if (messageObject2.type == 0) {
this.totalHeight -= AndroidUtilities.dp(2.0f);
}
if (this.drawPinnedBottom) {
this.totalHeight -= AndroidUtilities.dp(f2);
}
if (this.drawPinnedTop) {
this.totalHeight -= AndroidUtilities.dp(f2);
}
}
if (messageObject2.type != 19) {
if (messageObject.isAnyKindOfSticker() && this.totalHeight < AndroidUtilities.dp(70.0f)) {
int dp69 = AndroidUtilities.dp(70.0f);
int i285 = this.totalHeight;
int i286 = dp69 - i285;
this.additionalTimeOffsetY = i286;
this.totalHeight = i285 + i286;
} else if (messageObject.isAnimatedEmoji()) {
this.additionalTimeOffsetY = AndroidUtilities.dp(16.0f);
this.totalHeight += AndroidUtilities.dp(16.0f);
}
}
if (!this.drawPhotoImage) {
this.photoImage.setImageBitmap(r72);
if (this.blurredPhotoImage.getBitmap() != null) {
this.blurredPhotoImage.getBitmap().recycle();
this.blurredPhotoImage.setImageBitmap(r72);
}
}
if (this.documentAttachType == i8) {
if (MessageObject.isDocumentHasThumb(this.documentAttach)) {
this.radialProgress.setImageOverlay(FileLoader.getClosestPhotoSizeWithSize(this.documentAttach.thumbs, 90), this.documentAttach, messageObject2);
} else {
String artworkUrl = messageObject2.getArtworkUrl(true);
if (!TextUtils.isEmpty(artworkUrl)) {
this.radialProgress.setImageOverlay(artworkUrl);
} else {
this.radialProgress.setImageOverlay(r72, r72, r72);
}
}
} else {
this.radialProgress.setImageOverlay(r72, r72, r72);
}
calculateUnlockXY();
if (i7 != 0) {
int dp70 = AndroidUtilities.dp(4.0f);
int i287 = SharedConfig.bubbleRadius;
if (i287 > 2) {
dp3 = AndroidUtilities.dp(i287 - 2);
} else {
dp3 = AndroidUtilities.dp(i287);
}
int min9 = Math.min(AndroidUtilities.dp(3.0f), dp3);
if (dp70 > dp3) {
dp70 = dp3;
}
if (this.hasLinkPreview || this.hasGamePreview || this.hasInvoicePreview) {
dp3 = dp70;
}
int i288 = (this.forwardedNameLayout[0] == null && this.replyNameLayout == null && !this.drawNameLayout) ? dp3 : dp70;
if (this.captionLayout != null || this.drawCommentButton || ((arrayList = this.botButtons) != null && !arrayList.isEmpty())) {
dp3 = dp70;
}
if (this.documentAttachType != 1) {
i21 = dp3;
i20 = i288;
} else {
i20 = dp70;
i21 = i20;
}
MessageObject.GroupedMessagePosition groupedMessagePosition24 = this.currentPosition;
if (groupedMessagePosition24 != null && this.currentMessagesGroup != null) {
int i289 = groupedMessagePosition24.flags;
if ((i289 & 2) == 0) {
i20 = dp70;
i21 = i20;
}
if ((i289 & 1) == 0) {
dp3 = dp70;
i288 = dp3;
}
if ((i289 & 8) == 0) {
dp3 = dp70;
i21 = dp3;
}
if ((i289 & i5) == 0) {
i20 = dp70;
if (this.pinnedTop) {
int i290 = i20;
i22 = dp70;
i23 = i290;
} else if (this.currentMessageObject.isOutOwner()) {
i22 = dp70;
i23 = min9;
} else {
i23 = i20;
i22 = min9;
}
if (this.pinnedBottom) {
if (this.currentMessageObject.isOutOwner()) {
i21 = min9;
} else {
dp3 = min9;
}
}
if (!this.mediaBackground && !this.currentMessageObject.isOutOwner()) {
dp3 = min9;
}
messageObject4 = this.currentMessageObject;
if (messageObject4.type == i5 && (MessageObject.getMedia(messageObject4) instanceof TLRPC$TL_messageMediaVenue)) {
dp3 = min9;
i21 = dp3;
}
if (this.documentAttachType == 10) {
i23 = 0;
dp3 = 0;
i22 = 0;
i21 = 0;
}
this.photoImage.setRoundRadius(i22, i23, i21, dp3);
}
}
dp70 = i288;
if (this.pinnedTop) {
}
if (this.pinnedBottom) {
}
if (!this.mediaBackground) {
dp3 = min9;
}
messageObject4 = this.currentMessageObject;
if (messageObject4.type == i5) {
dp3 = min9;
i21 = dp3;
}
if (this.documentAttachType == 10) {
}
this.photoImage.setRoundRadius(i22, i23, i21, dp3);
}
updateAnimatedEmojis();
r73 = r72;
}
}
i11 = i6;
i6 = i11;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i1622222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
int dp652 = this.backgroundWidth - AndroidUtilities.dp(41.0f);
this.hasOldCaptionPreview = true;
this.linkPreviewHeight = 0;
TLRPC$WebPage tLRPC$WebPage22 = MessageObject.getMedia(this.currentMessageObject.messageOwner).webpage;
int ceil92 = (int) Math.ceil(Theme.chat_replyNamePaint.measureText(tLRPC$WebPage22.site_name) + f2);
this.siteNameWidth = ceil92;
this.siteNameLayout = new StaticLayout(tLRPC$WebPage22.site_name, Theme.chat_replyNamePaint, Math.min(ceil92, dp652), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
f3 = 0.0f;
this.siteNameLayoutWidth = 0.0f;
this.siteNameLeft = 0.0f;
while (i15 < this.siteNameLayout.getLineCount()) {
}
StaticLayout staticLayout182 = this.siteNameLayout;
int lineBottom52 = staticLayout182.getLineBottom(staticLayout182.getLineCount() - 1);
this.linkPreviewHeight += lineBottom52;
this.totalHeight += lineBottom52;
this.descriptionX = 0;
if (this.linkPreviewHeight != 0) {
}
StaticLayout createStaticLayout22 = StaticLayoutEx.createStaticLayout(tLRPC$WebPage22.description, Theme.chat_replyTextPaint, dp652, Layout.Alignment.ALIGN_NORMAL, 1.0f, AndroidUtilities.dp(f2), false, TextUtils.TruncateAt.END, dp652, 6);
this.descriptionLayout = createStaticLayout22;
int lineBottom622 = createStaticLayout22.getLineBottom(createStaticLayout22.getLineCount() - 1);
this.linkPreviewHeight += lineBottom622;
this.totalHeight += lineBottom622;
z12 = false;
while (i14 < this.descriptionLayout.getLineCount()) {
}
if (z12) {
}
i13 = messageObject2.type;
if (i13 != 1) {
}
this.totalHeight += AndroidUtilities.dp(6.0f);
int dp6622 = this.totalHeight + AndroidUtilities.dp(17.0f);
this.totalHeight = dp6622;
if (i6 != 0) {
}
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
TLRPC$ReplyMarkup tLRPC$ReplyMarkup2 = messageObject2.messageOwner.reply_markup;
if (tLRPC$ReplyMarkup2 instanceof TLRPC$TL_replyInlineMarkup) {
}
int dp672 = (AndroidUtilities.dp(48.0f) * size15) + AndroidUtilities.dp(f2);
this.keyboardHeight = dp672;
this.substractBackgroundHeight = dp672;
dp2 = this.backgroundWidth - AndroidUtilities.dp(this.mediaBackground ? 9.0f : f3);
this.widthForButtons = dp2;
if (messageObject2.wantedBotKeyboardWidth > dp2) {
}
HashMap hashMap22 = new HashMap(this.botButtonsByData);
sb = messageObject2.botButtonsLayout;
if (sb != null) {
hashMap = new HashMap(this.botButtonsByPosition);
this.botButtonsByData.clear();
if (messageObject2.messageOwner.reply_markup instanceof TLRPC$TL_replyInlineMarkup) {
}
this.widthForButtons = i16;
r72 = anonymousClass1;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
this.totalHeight -= AndroidUtilities.dp(2.0f);
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
}
sb2 = messageObject2.botButtonsLayout;
if (sb2 != null) {
}
hashMap = r7;
this.botButtonsByData.clear();
if (messageObject2.messageOwner.reply_markup instanceof TLRPC$TL_replyInlineMarkup) {
}
this.widthForButtons = i16;
r72 = anonymousClass1;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
}
}
}
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i16222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i162222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i1622222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
} else {
if (this.commentAvatarImages != null) {
int i291 = 0;
while (true) {
ImageReceiver[] imageReceiverArr4 = this.commentAvatarImages;
if (i291 >= imageReceiverArr4.length) {
break;
}
imageReceiverArr4[i291].setImageBitmap((Drawable) null);
this.commentAvatarImagesVisible[i291] = false;
i291++;
}
}
z47 = z5 ? 1 : 0;
}
}
str12 = string6;
i136 = 0;
z48 = z47;
int ceil22 = (int) Math.ceil(Theme.chat_commentTextPaint.measureText(str12));
this.totalCommentWidth = ceil22;
this.commentWidth = ceil22;
this.commentLayout = new StaticLayout(str12, Theme.chat_commentTextPaint, this.commentWidth + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
if (repliesCount != 0) {
this.drawCommentNumber = z58;
animatedNumberLayout = this.commentNumberLayout;
if (animatedNumberLayout != null) {
}
messageObject20.animateComments = z49;
int width22 = this.commentNumberLayout.getWidth();
this.commentNumberWidth = width22;
this.totalCommentWidth += width22 + AndroidUtilities.dp(4.0f);
this.totalCommentWidth += AndroidUtilities.dp(i136 + 70);
z10 = z48;
int i1502 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i16222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
}
this.drawCommentNumber = false;
animatedNumberLayout2 = this.commentNumberLayout;
if (animatedNumberLayout2 != null) {
}
this.totalCommentWidth += AndroidUtilities.dp(i136 + 70);
z10 = z48;
int i15022 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i162222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
} else {
if (!this.isRepliesChat && repliesCount > 0) {
String formatShortNumber = LocaleController.formatShortNumber(repliesCount, null);
int ceil11 = (int) Math.ceil(Theme.chat_stickerCommentCountPaint.measureText(formatShortNumber));
this.totalCommentWidth = ceil11;
this.commentWidth = ceil11;
this.commentLayout = new StaticLayout(formatShortNumber, Theme.chat_stickerCommentCountPaint, this.commentWidth + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
} else {
this.commentLayout = null;
}
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i150222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i1622222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
}
}
this.commentLayout = staticLayout;
this.drawCommentNumber = false;
z10 = z5 ? 1 : 0;
int i1502222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i16222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
} else {
i5 = 4;
messageObject2 = messageObject20;
i4 = 3;
r73 = 0;
i8 = 5;
f3 = 0.0f;
f2 = 1.0f;
}
if (z60) {
this.currentUrl = r73;
this.currentWebFile = r73;
this.loadingProgressLayout = r73;
this.animatingLoadingProgressProgress = f3;
this.lastLoadingSizeTotal = 0L;
this.selectedBackgroundProgress = f3;
ValueAnimator valueAnimator = this.statusDrawableAnimator;
if (valueAnimator != null) {
valueAnimator.removeAllListeners();
this.statusDrawableAnimator.cancel();
}
AnimatedFloat animatedFloat = this.translationLoadingFloat;
if (animatedFloat != null) {
animatedFloat.set(f3, true);
}
LinkPath linkPath = this.translationLoadingPath;
if (linkPath != null) {
linkPath.reset();
this.translationLoadingPath = r73;
}
LoadingDrawable loadingDrawable = this.translationLoadingDrawable;
if (loadingDrawable != null) {
loadingDrawable.reset();
this.translationLoadingDrawable = r73;
}
AnimatedFloat animatedFloat2 = this.timerParticlesAlpha;
if (animatedFloat2 != null) {
MessageObject messageObject38 = this.currentMessageObject;
if (messageObject38 == null || !messageObject38.needDrawBluredPreview() || (tLRPC$Message3 = this.currentMessageObject.messageOwner) == null || tLRPC$Message3.destroyTime == 0 || !MediaController.getInstance().isPlayingMessage(this.currentMessageObject)) {
z55 = true;
z56 = false;
} else {
z55 = true;
z56 = true;
}
animatedFloat2.set(z56, z55);
}
this.transitionParams.lastStatusDrawableParams = i;
this.statusDrawableAnimationInProgress = false;
if (this.documentAttachType == i8) {
this.toSeekBarProgress = !MediaController.getInstance().isPlayingMessage(this.currentMessageObject) ? f3 : f2;
}
?? r0 = this.seekBar;
if (r0 != 0) {
r0.updateTimestamps(this.currentMessageObject, r73);
}
this.seekBarWaveform.setProgress(f3);
AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable swapAnimatedEmojiDrawable = this.currentNameStatusDrawable;
if (swapAnimatedEmojiDrawable != null) {
swapAnimatedEmojiDrawable.play();
}
ReplyMessageLine replyMessageLine = this.replyLine;
if (replyMessageLine != null) {
replyMessageLine.resetAnimation();
}
this.quoteHighlight = r73;
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
MessageObject messageObject39 = this.currentMessageObject;
TLRPC$Message tLRPC$Message9 = messageObject39.messageOwner;
transcribeButton.setOpen(tLRPC$Message9 != null && tLRPC$Message9.voiceTranscriptionOpen && tLRPC$Message9.voiceTranscriptionFinal && TranscribeButton.isVideoTranscriptionOpen(messageObject39), !z60);
this.transcribeButton.setLoading(TranscribeButton.isTranscribing(this.currentMessageObject), !z60);
this.transcribeButton.setLock(TranscribeButton.showTranscribeLock(this.currentMessageObject), !z60);
}
updateWaveform();
if (z60 || messageObject2.cancelEditing) {
z52 = true;
z53 = false;
z54 = false;
} else {
z52 = true;
z53 = false;
z54 = true;
}
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled && this.buttonState == 2 && this.documentAttachType == i4 && DownloadController.getInstance(this.currentAccount).canDownloadMedia(messageObject2)) {
FileLoader fileLoader = FileLoader.getInstance(this.currentAccount);
TLRPC$Document tLRPC$Document13 = this.documentAttach;
messageObject18 = this.currentMessageObject;
if (messageObject18.shouldEncryptPhotoOrVideo()) {
i140 = 1;
i141 = 0;
} else {
i140 = 1;
i141 = 2;
}
fileLoader.loadFile(tLRPC$Document13, messageObject18, i140, i141);
this.buttonState = i5;
this.radialProgress.setIcon(getIconForCurrentState(), false, false);
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null && chatMessageCellDelegate2.getTextSelectionHelper() != null && !z60 && z3 && !messageObject2.preview) {
this.delegate.getTextSelectionHelper().checkDataChanged(messageObject2);
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
z3 = true;
MessageObject messageObject222 = this.currentMessageObject;
if (messageObject222 != null) {
if (groupedMessages != this.currentMessagesGroup) {
}
if (!z60) {
messageObject20.copyStableParams(messageObject19);
}
this.accessibilityText = null;
c = 4;
if (this.drawCommentButton) {
if (!z3) {
setCurrentDiceValue(this.isUpdating);
}
if (z3) {
if (MessageObject.getMedia(messageObject20.messageOwner) instanceof TLRPC$TL_messageMediaPoll) {
}
if (arrayList7 == null) {
if (!z57) {
z57 = true;
}
tLRPC$Poll2 = this.lastPoll;
z6 = z57;
if (tLRPC$Poll2 != tLRPC$Poll) {
}
this.animatePollAvatars = false;
if (z6) {
this.pollAnimationProgressTime = 0.0f;
if (this.pollVoted) {
this.pollUnvoteInProgress = true;
}
int i1452 = this.lastPollResultsVoters;
if (i1452 == 0) {
this.animatePollAvatars = i1452 == 0 || (i1452 != 0 && i142 == 0);
}
this.animatePollAvatars = i1452 == 0 || (i1452 != 0 && i142 == 0);
}
if (!z60) {
size2 = tLRPC$TL_messageMediaPoll.results.results.size();
i143 = 0;
while (true) {
if (i143 < size2) {
}
i143++;
}
if (tLRPC$TL_pollAnswerVoters != null) {
}
}
if (!z4) {
if ((groupedMessages.messages.size() > 1 ? null : this.currentMessagesGroup.positions.get(this.currentMessageObject)) == this.currentPosition) {
}
}
j = 0;
i = -1;
i2 = 2;
if (z3) {
i5 = 4;
messageObject2 = messageObject20;
i4 = 3;
r73 = 0;
i8 = 5;
f3 = 0.0f;
f2 = 1.0f;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
z52 = true;
z53 = false;
z54 = true;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
FileLoader fileLoader2 = FileLoader.getInstance(this.currentAccount);
TLRPC$Document tLRPC$Document132 = this.documentAttach;
messageObject18 = this.currentMessageObject;
if (messageObject18.shouldEncryptPhotoOrVideo()) {
}
fileLoader2.loadFile(tLRPC$Document132, messageObject18, i140, i141);
this.buttonState = i5;
this.radialProgress.setIcon(getIconForCurrentState(), false, false);
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
this.delegate.getTextSelectionHelper().checkDataChanged(messageObject2);
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
this.wasPinned = this.isPinned;
this.pinnedBottom = z;
this.pinnedTop = z2;
this.currentMessageObject = messageObject20;
this.currentMessagesGroup = groupedMessages;
this.lastTime = -2.0d;
this.lastPostAuthor = messageObject20.messageOwner.post_author;
if (!z60) {
}
this.isHighlightedAnimated = false;
this.wasTranscriptionOpen = false;
if (this.highlightedQuote) {
}
this.highlightedQuote = false;
this.widthBeforeNewTimeLine = -1;
groupedMessages2 = this.currentMessagesGroup;
if (groupedMessages2 != null) {
groupedMessagePosition = this.currentMessagesGroup.positions.get(this.currentMessageObject);
this.currentPosition = groupedMessagePosition;
if (groupedMessagePosition == null) {
}
groupedMessages3 = this.currentMessagesGroup;
if (groupedMessages3 == null) {
if (this.pinnedTop) {
this.drawPinnedTop = this.pinnedTop && ((groupedMessagePosition13 = this.currentPosition) == null || (groupedMessagePosition13.flags & 4) != 0);
if (this.pinnedBottom) {
this.drawPinnedBottom = this.pinnedBottom && ((groupedMessagePosition12 = this.currentPosition) == null || (groupedMessagePosition12.flags & 8) != 0);
boolean z622 = this.isPlayingRound;
if (!this.isRoundVideo) {
this.isPlayingRound = (!this.isRoundVideo || !MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || (chatMessageCellDelegate = this.delegate) == null || chatMessageCellDelegate.keyboardIsOpened() || this.delegate.isLandscape()) ? false : true;
this.photoImage.setCrossfadeWithOldImage(false);
this.photoImage.setCrossfadeDuration(ImageReceiver.DEFAULT_CROSSFADE_DURATION);
this.photoImage.setCrossfadeByScale(0.0f);
this.photoImage.setGradientBitmap(null);
this.photoImage.clearDecorators();
this.photoImage.setInvalidateAll(false);
this.linkPreviewY = 0;
this.lastTranslated = messageObject20.translated;
TLRPC$Message tLRPC$Message52 = messageObject20.messageOwner;
this.lastSendState = tLRPC$Message52.send_state;
this.lastDeleteDate = tLRPC$Message52.destroyTime;
this.lastViewsCount = tLRPC$Message52.views;
this.lastRepliesCount = getRepliesCount();
if (z60) {
}
this.gamePreviewPressed = z7;
this.sideButtonPressed = z7;
this.hasNewLineForTime = z7;
this.flipImage = z7;
if (this.isThreadChat) {
this.isThreadPost = this.isThreadChat && (tLRPC$MessageFwdHeader = (tLRPC$Message2 = messageObject20.messageOwner).fwd_from) != null && tLRPC$MessageFwdHeader.channel_post != 0 && tLRPC$Message2.reply_to == null;
if (needDrawAvatar()) {
this.isAvatarVisible = needDrawAvatar() && ((groupedMessagePosition11 = this.currentPosition) == null || groupedMessagePosition11.edge);
needDrawAvatar = needDrawAvatar();
if (messageObject20.customAvatarDrawable == null) {
z8 = needDrawAvatar;
this.wasLayout = false;
this.groupPhotoInvisible = false;
this.animatingDrawVideoImageButton = 0;
this.drawVideoSize = false;
this.canStreamVideo = false;
this.animatingNoSound = 0;
if (!messageObject.isSponsored()) {
}
this.hasReplyQuote = r2;
this.isReplyQuote = r2;
this.replyNameLayout = null;
this.adminLayout = null;
this.checkOnlyButtonPressed = r2;
this.replyTextLayout = null;
AnimatedEmojiSpan.release((View) this, this.animatedEmojiReplyStack);
this.lastReplyMessage = null;
this.hasEmbed = r2;
this.autoPlayingMedia = r2;
this.replyNameWidth = r2;
this.replyTextWidth = r2;
this.replyTextHeight = r2;
this.viaWidth = r2;
this.viaNameWidth = r2;
this.viaOnly = r2;
this.addedCaptionHeight = r2;
this.currentReplyPhoto = null;
this.currentUser = null;
this.currentChat = null;
this.currentViaBotUser = null;
this.instantViewLayout = null;
this.drawNameLayout = r2;
this.linkPreviewAbove = r2;
this.isSmallImage = r2;
this.lastLoadingSizeTotal = 0L;
if (this.scheduledInvalidate) {
}
this.links.clear();
this.pressedLink = null;
this.pressedEmoji = null;
this.pressedLinkType = -1;
messageObject20.forceUpdate = r2;
this.drawPhotoImage = r2;
this.drawMediaCheckBox = r2;
this.hasLinkPreview = r2;
this.hasOldCaptionPreview = r2;
this.hasGamePreview = r2;
this.hasInvoicePreview = r2;
this.commentButtonPressed = r2;
this.instantPressed = r2;
this.gradientDrawable = null;
setInstantButtonPressed(r2);
if (!z6) {
i139 = 0;
z5 = z5;
while (true) {
drawableArr = this.selectorDrawable;
if (i139 < drawableArr.length) {
}
i139++;
messageObject20 = messageObject;
i2 = i148;
z58 = z64 ? 1 : 0;
c = c4;
z5 = z63 ? 1 : 0;
i = -1;
j = 0;
}
}
resetContactButtonsPressedState();
this.drawnContactButtonsFlag = 0;
this.drawContact = false;
this.drawContactView = false;
this.drawContactSendMessage = false;
this.drawContactAdd = false;
this.spoilerPressed = null;
this.isSpoilerRevealing = false;
this.linkPreviewPressed = false;
this.buttonPressed = 0;
this.additionalTimeOffsetY = 0;
this.miniButtonPressed = 0;
this.pressedBotButton = i;
this.pressedVoteButton = i;
this.pollHintPressed = false;
this.psaHintPressed = false;
this.linkPreviewHeight = 0;
this.mediaOffsetY = 0;
this.documentAttachType = 0;
this.documentAttach = null;
this.descriptionLayout = null;
this.titleLayout = null;
this.videoInfoLayout = null;
this.photosCountLayout = null;
this.siteNameLayout = null;
this.authorLayout = null;
this.captionFullWidth = 0;
this.captionLayout = null;
this.captionWidth = 0;
this.captionHeight = 0;
this.captionOffsetX = 0;
this.currentCaption = null;
this.captionLayout = null;
this.docTitleLayout = null;
this.drawImageButton = false;
this.drawVideoImageButton = false;
this.currentPhotoLocation = null;
this.currentPhotoThumbLocation = null;
this.currentPhotoObject = null;
this.photoParentObject = null;
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = null;
if (!z3) {
}
this.currentPhotoFilter = null;
this.buttonState = i;
this.miniButtonState = i;
this.hasMiniProgress = 0;
if (this.addedForTest) {
ImageLoader.getInstance().removeTestWebFile(this.currentUrl);
}
this.addedForTest = false;
this.photoNotSet = false;
this.drawBackground = z58;
this.drawName = false;
this.useSeekBarWaveform = false;
this.useTranscribeButton = false;
this.drawInstantView = false;
this.drawInstantViewType = 0;
this.instantViewButtonText = null;
this.drawForwardedName = false;
this.drawCommentButton = false;
this.photoImage.setSideClip(0.0f);
this.photoImage.setAspectFit(false);
this.gradientShader = null;
this.motionBackgroundDrawable = null;
this.imageBackgroundColor = 0;
this.imageBackgroundGradientColor1 = 0;
this.imageBackgroundGradientColor2 = 0;
this.imageBackgroundIntensity = 0.0f;
this.imageBackgroundGradientColor3 = 0;
this.imageBackgroundGradientRotation = 45;
this.imageBackgroundSideColor = 0;
this.mediaBackground = false;
expiredStoryView = this.expiredStoryView;
if (expiredStoryView != null) {
}
this.photoImage.animatedFileDrawableRepeatMaxCount = 0;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader22 = messageObject20.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader22 == null) {
this.hasPsaHint = z9;
if (z9) {
}
this.photoImage.setAlpha(1.0f);
if (!z3) {
}
this.pollButtons.clear();
this.availableTimeWidth = 0;
this.photoImage.setForceLoading(false);
this.photoImage.setNeedsQualityThumb(false);
this.photoImage.setShouldGenerateQualityThumb(false);
this.photoImage.setAllowDecodeSingleFrame(false);
this.photoImage.setColorFilter(null);
this.photoImage.setMediaStartEndTime(-1L, -1L);
if (!z60) {
}
messageObject20.reactionsChanged = false;
if (messageObject.shouldDrawReactions()) {
if (!messageObject.shouldDrawReactionsInLayout()) {
}
if (this.currentPosition == null) {
}
if (z3) {
}
groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
isLinkedToChat = this.currentMessagesGroup.messages.get(0).isLinkedToChat(this.linkedChatId);
if (this.hasDiscussion) {
MessageObject.GroupedMessagePosition groupedMessagePosition152 = this.currentPosition;
if (groupedMessagePosition152 != null) {
this.commentLayout = staticLayout;
this.drawCommentNumber = false;
z10 = z5 ? 1 : 0;
int i15022222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i162222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
this.drawCommentButton = z58;
if (this.commentProgress == null) {
}
if (!this.isRepliesChat) {
}
str12 = string6;
i136 = 0;
z48 = z47;
int ceil222 = (int) Math.ceil(Theme.chat_commentTextPaint.measureText(str12));
this.totalCommentWidth = ceil222;
this.commentWidth = ceil222;
this.commentLayout = new StaticLayout(str12, Theme.chat_commentTextPaint, this.commentWidth + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
if (repliesCount != 0) {
}
this.drawCommentNumber = false;
animatedNumberLayout2 = this.commentNumberLayout;
if (animatedNumberLayout2 != null) {
}
this.totalCommentWidth += AndroidUtilities.dp(i136 + 70);
z10 = z48;
int i150222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i1622222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
if (!this.isRepliesChat) {
String formatShortNumber2 = LocaleController.formatShortNumber(repliesCount, null);
int ceil112 = (int) Math.ceil(Theme.chat_stickerCommentCountPaint.measureText(formatShortNumber2));
this.totalCommentWidth = ceil112;
this.commentWidth = ceil112;
this.commentLayout = new StaticLayout(formatShortNumber2, Theme.chat_stickerCommentCountPaint, this.commentWidth + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i1502222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i16222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i15022222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i162222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
MessageObject.GroupedMessagePosition groupedMessagePosition1522 = this.currentPosition;
if (groupedMessagePosition1522 != null) {
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
}
if (!this.isRepliesChat) {
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i150222222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i1622222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
isLinkedToChat = messageObject20.isLinkedToChat(this.linkedChatId);
if (this.hasDiscussion) {
}
MessageObject.GroupedMessagePosition groupedMessagePosition15222 = this.currentPosition;
if (groupedMessagePosition15222 != null) {
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
}
if (!this.isRepliesChat) {
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i1502222222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i16222222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
this.reactionsLayoutInBubble.setMessage(null, false, this.resourcesProvider);
if (z3) {
}
groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
}
isLinkedToChat = messageObject20.isLinkedToChat(this.linkedChatId);
if (this.hasDiscussion) {
}
MessageObject.GroupedMessagePosition groupedMessagePosition152222 = this.currentPosition;
if (groupedMessagePosition152222 != null) {
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
}
if (!this.isRepliesChat) {
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i15022222222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i162222222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
this.hasPsaHint = z9;
if (z9) {
}
this.photoImage.setAlpha(1.0f);
if (!z3) {
}
this.pollButtons.clear();
this.availableTimeWidth = 0;
this.photoImage.setForceLoading(false);
this.photoImage.setNeedsQualityThumb(false);
this.photoImage.setShouldGenerateQualityThumb(false);
this.photoImage.setAllowDecodeSingleFrame(false);
this.photoImage.setColorFilter(null);
this.photoImage.setMediaStartEndTime(-1L, -1L);
if (!z60) {
}
messageObject20.reactionsChanged = false;
if (messageObject.shouldDrawReactions()) {
}
this.reactionsLayoutInBubble.setMessage(null, false, this.resourcesProvider);
if (z3) {
}
groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
}
isLinkedToChat = messageObject20.isLinkedToChat(this.linkedChatId);
if (this.hasDiscussion) {
}
MessageObject.GroupedMessagePosition groupedMessagePosition1522222 = this.currentPosition;
if (groupedMessagePosition1522222 != null) {
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
}
if (!this.isRepliesChat) {
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i150222222222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i1622222222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
this.isAvatarVisible = true;
z8 = true;
this.wasLayout = false;
this.groupPhotoInvisible = false;
this.animatingDrawVideoImageButton = 0;
this.drawVideoSize = false;
this.canStreamVideo = false;
this.animatingNoSound = 0;
if (!messageObject.isSponsored()) {
}
this.hasReplyQuote = r2;
this.isReplyQuote = r2;
this.replyNameLayout = null;
this.adminLayout = null;
this.checkOnlyButtonPressed = r2;
this.replyTextLayout = null;
AnimatedEmojiSpan.release((View) this, this.animatedEmojiReplyStack);
this.lastReplyMessage = null;
this.hasEmbed = r2;
this.autoPlayingMedia = r2;
this.replyNameWidth = r2;
this.replyTextWidth = r2;
this.replyTextHeight = r2;
this.viaWidth = r2;
this.viaNameWidth = r2;
this.viaOnly = r2;
this.addedCaptionHeight = r2;
this.currentReplyPhoto = null;
this.currentUser = null;
this.currentChat = null;
this.currentViaBotUser = null;
this.instantViewLayout = null;
this.drawNameLayout = r2;
this.linkPreviewAbove = r2;
this.isSmallImage = r2;
this.lastLoadingSizeTotal = 0L;
if (this.scheduledInvalidate) {
}
this.links.clear();
this.pressedLink = null;
this.pressedEmoji = null;
this.pressedLinkType = -1;
messageObject20.forceUpdate = r2;
this.drawPhotoImage = r2;
this.drawMediaCheckBox = r2;
this.hasLinkPreview = r2;
this.hasOldCaptionPreview = r2;
this.hasGamePreview = r2;
this.hasInvoicePreview = r2;
this.commentButtonPressed = r2;
this.instantPressed = r2;
this.gradientDrawable = null;
setInstantButtonPressed(r2);
if (!z6) {
}
resetContactButtonsPressedState();
this.drawnContactButtonsFlag = 0;
this.drawContact = false;
this.drawContactView = false;
this.drawContactSendMessage = false;
this.drawContactAdd = false;
this.spoilerPressed = null;
this.isSpoilerRevealing = false;
this.linkPreviewPressed = false;
this.buttonPressed = 0;
this.additionalTimeOffsetY = 0;
this.miniButtonPressed = 0;
this.pressedBotButton = i;
this.pressedVoteButton = i;
this.pollHintPressed = false;
this.psaHintPressed = false;
this.linkPreviewHeight = 0;
this.mediaOffsetY = 0;
this.documentAttachType = 0;
this.documentAttach = null;
this.descriptionLayout = null;
this.titleLayout = null;
this.videoInfoLayout = null;
this.photosCountLayout = null;
this.siteNameLayout = null;
this.authorLayout = null;
this.captionFullWidth = 0;
this.captionLayout = null;
this.captionWidth = 0;
this.captionHeight = 0;
this.captionOffsetX = 0;
this.currentCaption = null;
this.captionLayout = null;
this.docTitleLayout = null;
this.drawImageButton = false;
this.drawVideoImageButton = false;
this.currentPhotoLocation = null;
this.currentPhotoThumbLocation = null;
this.currentPhotoObject = null;
this.photoParentObject = null;
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = null;
if (!z3) {
}
this.currentPhotoFilter = null;
this.buttonState = i;
this.miniButtonState = i;
this.hasMiniProgress = 0;
if (this.addedForTest) {
}
this.addedForTest = false;
this.photoNotSet = false;
this.drawBackground = z58;
this.drawName = false;
this.useSeekBarWaveform = false;
this.useTranscribeButton = false;
this.drawInstantView = false;
this.drawInstantViewType = 0;
this.instantViewButtonText = null;
this.drawForwardedName = false;
this.drawCommentButton = false;
this.photoImage.setSideClip(0.0f);
this.photoImage.setAspectFit(false);
this.gradientShader = null;
this.motionBackgroundDrawable = null;
this.imageBackgroundColor = 0;
this.imageBackgroundGradientColor1 = 0;
this.imageBackgroundGradientColor2 = 0;
this.imageBackgroundIntensity = 0.0f;
this.imageBackgroundGradientColor3 = 0;
this.imageBackgroundGradientRotation = 45;
this.imageBackgroundSideColor = 0;
this.mediaBackground = false;
expiredStoryView = this.expiredStoryView;
if (expiredStoryView != null) {
}
this.photoImage.animatedFileDrawableRepeatMaxCount = 0;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader222 = messageObject20.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader222 == null) {
}
this.hasPsaHint = z9;
if (z9) {
}
this.photoImage.setAlpha(1.0f);
if (!z3) {
}
this.pollButtons.clear();
this.availableTimeWidth = 0;
this.photoImage.setForceLoading(false);
this.photoImage.setNeedsQualityThumb(false);
this.photoImage.setShouldGenerateQualityThumb(false);
this.photoImage.setAllowDecodeSingleFrame(false);
this.photoImage.setColorFilter(null);
this.photoImage.setMediaStartEndTime(-1L, -1L);
if (!z60) {
}
messageObject20.reactionsChanged = false;
if (messageObject.shouldDrawReactions()) {
}
this.reactionsLayoutInBubble.setMessage(null, false, this.resourcesProvider);
if (z3) {
}
groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
}
isLinkedToChat = messageObject20.isLinkedToChat(this.linkedChatId);
if (this.hasDiscussion) {
}
MessageObject.GroupedMessagePosition groupedMessagePosition15222222 = this.currentPosition;
if (groupedMessagePosition15222222 != null) {
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
}
if (!this.isRepliesChat) {
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i1502222222222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i16222222222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
this.isAvatarVisible = needDrawAvatar() && ((groupedMessagePosition11 = this.currentPosition) == null || groupedMessagePosition11.edge);
needDrawAvatar = needDrawAvatar();
if (messageObject20.customAvatarDrawable == null) {
}
this.isAvatarVisible = true;
z8 = true;
this.wasLayout = false;
this.groupPhotoInvisible = false;
this.animatingDrawVideoImageButton = 0;
this.drawVideoSize = false;
this.canStreamVideo = false;
this.animatingNoSound = 0;
if (!messageObject.isSponsored()) {
}
this.hasReplyQuote = r2;
this.isReplyQuote = r2;
this.replyNameLayout = null;
this.adminLayout = null;
this.checkOnlyButtonPressed = r2;
this.replyTextLayout = null;
AnimatedEmojiSpan.release((View) this, this.animatedEmojiReplyStack);
this.lastReplyMessage = null;
this.hasEmbed = r2;
this.autoPlayingMedia = r2;
this.replyNameWidth = r2;
this.replyTextWidth = r2;
this.replyTextHeight = r2;
this.viaWidth = r2;
this.viaNameWidth = r2;
this.viaOnly = r2;
this.addedCaptionHeight = r2;
this.currentReplyPhoto = null;
this.currentUser = null;
this.currentChat = null;
this.currentViaBotUser = null;
this.instantViewLayout = null;
this.drawNameLayout = r2;
this.linkPreviewAbove = r2;
this.isSmallImage = r2;
this.lastLoadingSizeTotal = 0L;
if (this.scheduledInvalidate) {
}
this.links.clear();
this.pressedLink = null;
this.pressedEmoji = null;
this.pressedLinkType = -1;
messageObject20.forceUpdate = r2;
this.drawPhotoImage = r2;
this.drawMediaCheckBox = r2;
this.hasLinkPreview = r2;
this.hasOldCaptionPreview = r2;
this.hasGamePreview = r2;
this.hasInvoicePreview = r2;
this.commentButtonPressed = r2;
this.instantPressed = r2;
this.gradientDrawable = null;
setInstantButtonPressed(r2);
if (!z6) {
}
resetContactButtonsPressedState();
this.drawnContactButtonsFlag = 0;
this.drawContact = false;
this.drawContactView = false;
this.drawContactSendMessage = false;
this.drawContactAdd = false;
this.spoilerPressed = null;
this.isSpoilerRevealing = false;
this.linkPreviewPressed = false;
this.buttonPressed = 0;
this.additionalTimeOffsetY = 0;
this.miniButtonPressed = 0;
this.pressedBotButton = i;
this.pressedVoteButton = i;
this.pollHintPressed = false;
this.psaHintPressed = false;
this.linkPreviewHeight = 0;
this.mediaOffsetY = 0;
this.documentAttachType = 0;
this.documentAttach = null;
this.descriptionLayout = null;
this.titleLayout = null;
this.videoInfoLayout = null;
this.photosCountLayout = null;
this.siteNameLayout = null;
this.authorLayout = null;
this.captionFullWidth = 0;
this.captionLayout = null;
this.captionWidth = 0;
this.captionHeight = 0;
this.captionOffsetX = 0;
this.currentCaption = null;
this.captionLayout = null;
this.docTitleLayout = null;
this.drawImageButton = false;
this.drawVideoImageButton = false;
this.currentPhotoLocation = null;
this.currentPhotoThumbLocation = null;
this.currentPhotoObject = null;
this.photoParentObject = null;
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = null;
if (!z3) {
}
this.currentPhotoFilter = null;
this.buttonState = i;
this.miniButtonState = i;
this.hasMiniProgress = 0;
if (this.addedForTest) {
}
this.addedForTest = false;
this.photoNotSet = false;
this.drawBackground = z58;
this.drawName = false;
this.useSeekBarWaveform = false;
this.useTranscribeButton = false;
this.drawInstantView = false;
this.drawInstantViewType = 0;
this.instantViewButtonText = null;
this.drawForwardedName = false;
this.drawCommentButton = false;
this.photoImage.setSideClip(0.0f);
this.photoImage.setAspectFit(false);
this.gradientShader = null;
this.motionBackgroundDrawable = null;
this.imageBackgroundColor = 0;
this.imageBackgroundGradientColor1 = 0;
this.imageBackgroundGradientColor2 = 0;
this.imageBackgroundIntensity = 0.0f;
this.imageBackgroundGradientColor3 = 0;
this.imageBackgroundGradientRotation = 45;
this.imageBackgroundSideColor = 0;
this.mediaBackground = false;
expiredStoryView = this.expiredStoryView;
if (expiredStoryView != null) {
}
this.photoImage.animatedFileDrawableRepeatMaxCount = 0;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader2222 = messageObject20.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader2222 == null) {
}
this.hasPsaHint = z9;
if (z9) {
}
this.photoImage.setAlpha(1.0f);
if (!z3) {
}
this.pollButtons.clear();
this.availableTimeWidth = 0;
this.photoImage.setForceLoading(false);
this.photoImage.setNeedsQualityThumb(false);
this.photoImage.setShouldGenerateQualityThumb(false);
this.photoImage.setAllowDecodeSingleFrame(false);
this.photoImage.setColorFilter(null);
this.photoImage.setMediaStartEndTime(-1L, -1L);
if (!z60) {
}
messageObject20.reactionsChanged = false;
if (messageObject.shouldDrawReactions()) {
}
this.reactionsLayoutInBubble.setMessage(null, false, this.resourcesProvider);
if (z3) {
}
groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
}
isLinkedToChat = messageObject20.isLinkedToChat(this.linkedChatId);
if (this.hasDiscussion) {
}
MessageObject.GroupedMessagePosition groupedMessagePosition152222222 = this.currentPosition;
if (groupedMessagePosition152222222 != null) {
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
}
if (!this.isRepliesChat) {
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i15022222222222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i162222222222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
this.isThreadPost = this.isThreadChat && (tLRPC$MessageFwdHeader = (tLRPC$Message2 = messageObject20.messageOwner).fwd_from) != null && tLRPC$MessageFwdHeader.channel_post != 0 && tLRPC$Message2.reply_to == null;
this.isAvatarVisible = needDrawAvatar() && ((groupedMessagePosition11 = this.currentPosition) == null || groupedMessagePosition11.edge);
needDrawAvatar = needDrawAvatar();
if (messageObject20.customAvatarDrawable == null) {
}
this.isAvatarVisible = true;
z8 = true;
this.wasLayout = false;
this.groupPhotoInvisible = false;
this.animatingDrawVideoImageButton = 0;
this.drawVideoSize = false;
this.canStreamVideo = false;
this.animatingNoSound = 0;
if (!messageObject.isSponsored()) {
}
this.hasReplyQuote = r2;
this.isReplyQuote = r2;
this.replyNameLayout = null;
this.adminLayout = null;
this.checkOnlyButtonPressed = r2;
this.replyTextLayout = null;
AnimatedEmojiSpan.release((View) this, this.animatedEmojiReplyStack);
this.lastReplyMessage = null;
this.hasEmbed = r2;
this.autoPlayingMedia = r2;
this.replyNameWidth = r2;
this.replyTextWidth = r2;
this.replyTextHeight = r2;
this.viaWidth = r2;
this.viaNameWidth = r2;
this.viaOnly = r2;
this.addedCaptionHeight = r2;
this.currentReplyPhoto = null;
this.currentUser = null;
this.currentChat = null;
this.currentViaBotUser = null;
this.instantViewLayout = null;
this.drawNameLayout = r2;
this.linkPreviewAbove = r2;
this.isSmallImage = r2;
this.lastLoadingSizeTotal = 0L;
if (this.scheduledInvalidate) {
}
this.links.clear();
this.pressedLink = null;
this.pressedEmoji = null;
this.pressedLinkType = -1;
messageObject20.forceUpdate = r2;
this.drawPhotoImage = r2;
this.drawMediaCheckBox = r2;
this.hasLinkPreview = r2;
this.hasOldCaptionPreview = r2;
this.hasGamePreview = r2;
this.hasInvoicePreview = r2;
this.commentButtonPressed = r2;
this.instantPressed = r2;
this.gradientDrawable = null;
setInstantButtonPressed(r2);
if (!z6) {
}
resetContactButtonsPressedState();
this.drawnContactButtonsFlag = 0;
this.drawContact = false;
this.drawContactView = false;
this.drawContactSendMessage = false;
this.drawContactAdd = false;
this.spoilerPressed = null;
this.isSpoilerRevealing = false;
this.linkPreviewPressed = false;
this.buttonPressed = 0;
this.additionalTimeOffsetY = 0;
this.miniButtonPressed = 0;
this.pressedBotButton = i;
this.pressedVoteButton = i;
this.pollHintPressed = false;
this.psaHintPressed = false;
this.linkPreviewHeight = 0;
this.mediaOffsetY = 0;
this.documentAttachType = 0;
this.documentAttach = null;
this.descriptionLayout = null;
this.titleLayout = null;
this.videoInfoLayout = null;
this.photosCountLayout = null;
this.siteNameLayout = null;
this.authorLayout = null;
this.captionFullWidth = 0;
this.captionLayout = null;
this.captionWidth = 0;
this.captionHeight = 0;
this.captionOffsetX = 0;
this.currentCaption = null;
this.captionLayout = null;
this.docTitleLayout = null;
this.drawImageButton = false;
this.drawVideoImageButton = false;
this.currentPhotoLocation = null;
this.currentPhotoThumbLocation = null;
this.currentPhotoObject = null;
this.photoParentObject = null;
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = null;
if (!z3) {
}
this.currentPhotoFilter = null;
this.buttonState = i;
this.miniButtonState = i;
this.hasMiniProgress = 0;
if (this.addedForTest) {
}
this.addedForTest = false;
this.photoNotSet = false;
this.drawBackground = z58;
this.drawName = false;
this.useSeekBarWaveform = false;
this.useTranscribeButton = false;
this.drawInstantView = false;
this.drawInstantViewType = 0;
this.instantViewButtonText = null;
this.drawForwardedName = false;
this.drawCommentButton = false;
this.photoImage.setSideClip(0.0f);
this.photoImage.setAspectFit(false);
this.gradientShader = null;
this.motionBackgroundDrawable = null;
this.imageBackgroundColor = 0;
this.imageBackgroundGradientColor1 = 0;
this.imageBackgroundGradientColor2 = 0;
this.imageBackgroundIntensity = 0.0f;
this.imageBackgroundGradientColor3 = 0;
this.imageBackgroundGradientRotation = 45;
this.imageBackgroundSideColor = 0;
this.mediaBackground = false;
expiredStoryView = this.expiredStoryView;
if (expiredStoryView != null) {
}
this.photoImage.animatedFileDrawableRepeatMaxCount = 0;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader22222 = messageObject20.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader22222 == null) {
}
this.hasPsaHint = z9;
if (z9) {
}
this.photoImage.setAlpha(1.0f);
if (!z3) {
}
this.pollButtons.clear();
this.availableTimeWidth = 0;
this.photoImage.setForceLoading(false);
this.photoImage.setNeedsQualityThumb(false);
this.photoImage.setShouldGenerateQualityThumb(false);
this.photoImage.setAllowDecodeSingleFrame(false);
this.photoImage.setColorFilter(null);
this.photoImage.setMediaStartEndTime(-1L, -1L);
if (!z60) {
}
messageObject20.reactionsChanged = false;
if (messageObject.shouldDrawReactions()) {
}
this.reactionsLayoutInBubble.setMessage(null, false, this.resourcesProvider);
if (z3) {
}
groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
}
isLinkedToChat = messageObject20.isLinkedToChat(this.linkedChatId);
if (this.hasDiscussion) {
}
MessageObject.GroupedMessagePosition groupedMessagePosition1522222222 = this.currentPosition;
if (groupedMessagePosition1522222222 != null) {
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
}
if (!this.isRepliesChat) {
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i150222222222222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i1622222222222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
this.isPlayingRound = (!this.isRoundVideo || !MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || (chatMessageCellDelegate = this.delegate) == null || chatMessageCellDelegate.keyboardIsOpened() || this.delegate.isLandscape()) ? false : true;
this.photoImage.setCrossfadeWithOldImage(false);
this.photoImage.setCrossfadeDuration(ImageReceiver.DEFAULT_CROSSFADE_DURATION);
this.photoImage.setCrossfadeByScale(0.0f);
this.photoImage.setGradientBitmap(null);
this.photoImage.clearDecorators();
this.photoImage.setInvalidateAll(false);
this.linkPreviewY = 0;
this.lastTranslated = messageObject20.translated;
TLRPC$Message tLRPC$Message522 = messageObject20.messageOwner;
this.lastSendState = tLRPC$Message522.send_state;
this.lastDeleteDate = tLRPC$Message522.destroyTime;
this.lastViewsCount = tLRPC$Message522.views;
this.lastRepliesCount = getRepliesCount();
if (z60) {
}
this.gamePreviewPressed = z7;
this.sideButtonPressed = z7;
this.hasNewLineForTime = z7;
this.flipImage = z7;
this.isThreadPost = this.isThreadChat && (tLRPC$MessageFwdHeader = (tLRPC$Message2 = messageObject20.messageOwner).fwd_from) != null && tLRPC$MessageFwdHeader.channel_post != 0 && tLRPC$Message2.reply_to == null;
this.isAvatarVisible = needDrawAvatar() && ((groupedMessagePosition11 = this.currentPosition) == null || groupedMessagePosition11.edge);
needDrawAvatar = needDrawAvatar();
if (messageObject20.customAvatarDrawable == null) {
}
this.isAvatarVisible = true;
z8 = true;
this.wasLayout = false;
this.groupPhotoInvisible = false;
this.animatingDrawVideoImageButton = 0;
this.drawVideoSize = false;
this.canStreamVideo = false;
this.animatingNoSound = 0;
if (!messageObject.isSponsored()) {
}
this.hasReplyQuote = r2;
this.isReplyQuote = r2;
this.replyNameLayout = null;
this.adminLayout = null;
this.checkOnlyButtonPressed = r2;
this.replyTextLayout = null;
AnimatedEmojiSpan.release((View) this, this.animatedEmojiReplyStack);
this.lastReplyMessage = null;
this.hasEmbed = r2;
this.autoPlayingMedia = r2;
this.replyNameWidth = r2;
this.replyTextWidth = r2;
this.replyTextHeight = r2;
this.viaWidth = r2;
this.viaNameWidth = r2;
this.viaOnly = r2;
this.addedCaptionHeight = r2;
this.currentReplyPhoto = null;
this.currentUser = null;
this.currentChat = null;
this.currentViaBotUser = null;
this.instantViewLayout = null;
this.drawNameLayout = r2;
this.linkPreviewAbove = r2;
this.isSmallImage = r2;
this.lastLoadingSizeTotal = 0L;
if (this.scheduledInvalidate) {
}
this.links.clear();
this.pressedLink = null;
this.pressedEmoji = null;
this.pressedLinkType = -1;
messageObject20.forceUpdate = r2;
this.drawPhotoImage = r2;
this.drawMediaCheckBox = r2;
this.hasLinkPreview = r2;
this.hasOldCaptionPreview = r2;
this.hasGamePreview = r2;
this.hasInvoicePreview = r2;
this.commentButtonPressed = r2;
this.instantPressed = r2;
this.gradientDrawable = null;
setInstantButtonPressed(r2);
if (!z6) {
}
resetContactButtonsPressedState();
this.drawnContactButtonsFlag = 0;
this.drawContact = false;
this.drawContactView = false;
this.drawContactSendMessage = false;
this.drawContactAdd = false;
this.spoilerPressed = null;
this.isSpoilerRevealing = false;
this.linkPreviewPressed = false;
this.buttonPressed = 0;
this.additionalTimeOffsetY = 0;
this.miniButtonPressed = 0;
this.pressedBotButton = i;
this.pressedVoteButton = i;
this.pollHintPressed = false;
this.psaHintPressed = false;
this.linkPreviewHeight = 0;
this.mediaOffsetY = 0;
this.documentAttachType = 0;
this.documentAttach = null;
this.descriptionLayout = null;
this.titleLayout = null;
this.videoInfoLayout = null;
this.photosCountLayout = null;
this.siteNameLayout = null;
this.authorLayout = null;
this.captionFullWidth = 0;
this.captionLayout = null;
this.captionWidth = 0;
this.captionHeight = 0;
this.captionOffsetX = 0;
this.currentCaption = null;
this.captionLayout = null;
this.docTitleLayout = null;
this.drawImageButton = false;
this.drawVideoImageButton = false;
this.currentPhotoLocation = null;
this.currentPhotoThumbLocation = null;
this.currentPhotoObject = null;
this.photoParentObject = null;
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = null;
if (!z3) {
}
this.currentPhotoFilter = null;
this.buttonState = i;
this.miniButtonState = i;
this.hasMiniProgress = 0;
if (this.addedForTest) {
}
this.addedForTest = false;
this.photoNotSet = false;
this.drawBackground = z58;
this.drawName = false;
this.useSeekBarWaveform = false;
this.useTranscribeButton = false;
this.drawInstantView = false;
this.drawInstantViewType = 0;
this.instantViewButtonText = null;
this.drawForwardedName = false;
this.drawCommentButton = false;
this.photoImage.setSideClip(0.0f);
this.photoImage.setAspectFit(false);
this.gradientShader = null;
this.motionBackgroundDrawable = null;
this.imageBackgroundColor = 0;
this.imageBackgroundGradientColor1 = 0;
this.imageBackgroundGradientColor2 = 0;
this.imageBackgroundIntensity = 0.0f;
this.imageBackgroundGradientColor3 = 0;
this.imageBackgroundGradientRotation = 45;
this.imageBackgroundSideColor = 0;
this.mediaBackground = false;
expiredStoryView = this.expiredStoryView;
if (expiredStoryView != null) {
}
this.photoImage.animatedFileDrawableRepeatMaxCount = 0;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader222222 = messageObject20.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader222222 == null) {
}
this.hasPsaHint = z9;
if (z9) {
}
this.photoImage.setAlpha(1.0f);
if (!z3) {
}
this.pollButtons.clear();
this.availableTimeWidth = 0;
this.photoImage.setForceLoading(false);
this.photoImage.setNeedsQualityThumb(false);
this.photoImage.setShouldGenerateQualityThumb(false);
this.photoImage.setAllowDecodeSingleFrame(false);
this.photoImage.setColorFilter(null);
this.photoImage.setMediaStartEndTime(-1L, -1L);
if (!z60) {
}
messageObject20.reactionsChanged = false;
if (messageObject.shouldDrawReactions()) {
}
this.reactionsLayoutInBubble.setMessage(null, false, this.resourcesProvider);
if (z3) {
}
groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
}
isLinkedToChat = messageObject20.isLinkedToChat(this.linkedChatId);
if (this.hasDiscussion) {
}
MessageObject.GroupedMessagePosition groupedMessagePosition15222222222 = this.currentPosition;
if (groupedMessagePosition15222222222 != null) {
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
}
if (!this.isRepliesChat) {
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i1502222222222222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i16222222222222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
this.drawPinnedBottom = this.pinnedBottom && ((groupedMessagePosition12 = this.currentPosition) == null || (groupedMessagePosition12.flags & 8) != 0);
boolean z6222 = this.isPlayingRound;
this.isPlayingRound = (!this.isRoundVideo || !MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || (chatMessageCellDelegate = this.delegate) == null || chatMessageCellDelegate.keyboardIsOpened() || this.delegate.isLandscape()) ? false : true;
this.photoImage.setCrossfadeWithOldImage(false);
this.photoImage.setCrossfadeDuration(ImageReceiver.DEFAULT_CROSSFADE_DURATION);
this.photoImage.setCrossfadeByScale(0.0f);
this.photoImage.setGradientBitmap(null);
this.photoImage.clearDecorators();
this.photoImage.setInvalidateAll(false);
this.linkPreviewY = 0;
this.lastTranslated = messageObject20.translated;
TLRPC$Message tLRPC$Message5222 = messageObject20.messageOwner;
this.lastSendState = tLRPC$Message5222.send_state;
this.lastDeleteDate = tLRPC$Message5222.destroyTime;
this.lastViewsCount = tLRPC$Message5222.views;
this.lastRepliesCount = getRepliesCount();
if (z60) {
}
this.gamePreviewPressed = z7;
this.sideButtonPressed = z7;
this.hasNewLineForTime = z7;
this.flipImage = z7;
this.isThreadPost = this.isThreadChat && (tLRPC$MessageFwdHeader = (tLRPC$Message2 = messageObject20.messageOwner).fwd_from) != null && tLRPC$MessageFwdHeader.channel_post != 0 && tLRPC$Message2.reply_to == null;
this.isAvatarVisible = needDrawAvatar() && ((groupedMessagePosition11 = this.currentPosition) == null || groupedMessagePosition11.edge);
needDrawAvatar = needDrawAvatar();
if (messageObject20.customAvatarDrawable == null) {
}
this.isAvatarVisible = true;
z8 = true;
this.wasLayout = false;
this.groupPhotoInvisible = false;
this.animatingDrawVideoImageButton = 0;
this.drawVideoSize = false;
this.canStreamVideo = false;
this.animatingNoSound = 0;
if (!messageObject.isSponsored()) {
}
this.hasReplyQuote = r2;
this.isReplyQuote = r2;
this.replyNameLayout = null;
this.adminLayout = null;
this.checkOnlyButtonPressed = r2;
this.replyTextLayout = null;
AnimatedEmojiSpan.release((View) this, this.animatedEmojiReplyStack);
this.lastReplyMessage = null;
this.hasEmbed = r2;
this.autoPlayingMedia = r2;
this.replyNameWidth = r2;
this.replyTextWidth = r2;
this.replyTextHeight = r2;
this.viaWidth = r2;
this.viaNameWidth = r2;
this.viaOnly = r2;
this.addedCaptionHeight = r2;
this.currentReplyPhoto = null;
this.currentUser = null;
this.currentChat = null;
this.currentViaBotUser = null;
this.instantViewLayout = null;
this.drawNameLayout = r2;
this.linkPreviewAbove = r2;
this.isSmallImage = r2;
this.lastLoadingSizeTotal = 0L;
if (this.scheduledInvalidate) {
}
this.links.clear();
this.pressedLink = null;
this.pressedEmoji = null;
this.pressedLinkType = -1;
messageObject20.forceUpdate = r2;
this.drawPhotoImage = r2;
this.drawMediaCheckBox = r2;
this.hasLinkPreview = r2;
this.hasOldCaptionPreview = r2;
this.hasGamePreview = r2;
this.hasInvoicePreview = r2;
this.commentButtonPressed = r2;
this.instantPressed = r2;
this.gradientDrawable = null;
setInstantButtonPressed(r2);
if (!z6) {
}
resetContactButtonsPressedState();
this.drawnContactButtonsFlag = 0;
this.drawContact = false;
this.drawContactView = false;
this.drawContactSendMessage = false;
this.drawContactAdd = false;
this.spoilerPressed = null;
this.isSpoilerRevealing = false;
this.linkPreviewPressed = false;
this.buttonPressed = 0;
this.additionalTimeOffsetY = 0;
this.miniButtonPressed = 0;
this.pressedBotButton = i;
this.pressedVoteButton = i;
this.pollHintPressed = false;
this.psaHintPressed = false;
this.linkPreviewHeight = 0;
this.mediaOffsetY = 0;
this.documentAttachType = 0;
this.documentAttach = null;
this.descriptionLayout = null;
this.titleLayout = null;
this.videoInfoLayout = null;
this.photosCountLayout = null;
this.siteNameLayout = null;
this.authorLayout = null;
this.captionFullWidth = 0;
this.captionLayout = null;
this.captionWidth = 0;
this.captionHeight = 0;
this.captionOffsetX = 0;
this.currentCaption = null;
this.captionLayout = null;
this.docTitleLayout = null;
this.drawImageButton = false;
this.drawVideoImageButton = false;
this.currentPhotoLocation = null;
this.currentPhotoThumbLocation = null;
this.currentPhotoObject = null;
this.photoParentObject = null;
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = null;
if (!z3) {
}
this.currentPhotoFilter = null;
this.buttonState = i;
this.miniButtonState = i;
this.hasMiniProgress = 0;
if (this.addedForTest) {
}
this.addedForTest = false;
this.photoNotSet = false;
this.drawBackground = z58;
this.drawName = false;
this.useSeekBarWaveform = false;
this.useTranscribeButton = false;
this.drawInstantView = false;
this.drawInstantViewType = 0;
this.instantViewButtonText = null;
this.drawForwardedName = false;
this.drawCommentButton = false;
this.photoImage.setSideClip(0.0f);
this.photoImage.setAspectFit(false);
this.gradientShader = null;
this.motionBackgroundDrawable = null;
this.imageBackgroundColor = 0;
this.imageBackgroundGradientColor1 = 0;
this.imageBackgroundGradientColor2 = 0;
this.imageBackgroundIntensity = 0.0f;
this.imageBackgroundGradientColor3 = 0;
this.imageBackgroundGradientRotation = 45;
this.imageBackgroundSideColor = 0;
this.mediaBackground = false;
expiredStoryView = this.expiredStoryView;
if (expiredStoryView != null) {
}
this.photoImage.animatedFileDrawableRepeatMaxCount = 0;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader2222222 = messageObject20.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader2222222 == null) {
}
this.hasPsaHint = z9;
if (z9) {
}
this.photoImage.setAlpha(1.0f);
if (!z3) {
}
this.pollButtons.clear();
this.availableTimeWidth = 0;
this.photoImage.setForceLoading(false);
this.photoImage.setNeedsQualityThumb(false);
this.photoImage.setShouldGenerateQualityThumb(false);
this.photoImage.setAllowDecodeSingleFrame(false);
this.photoImage.setColorFilter(null);
this.photoImage.setMediaStartEndTime(-1L, -1L);
if (!z60) {
}
messageObject20.reactionsChanged = false;
if (messageObject.shouldDrawReactions()) {
}
this.reactionsLayoutInBubble.setMessage(null, false, this.resourcesProvider);
if (z3) {
}
groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
}
isLinkedToChat = messageObject20.isLinkedToChat(this.linkedChatId);
if (this.hasDiscussion) {
}
MessageObject.GroupedMessagePosition groupedMessagePosition152222222222 = this.currentPosition;
if (groupedMessagePosition152222222222 != null) {
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
}
if (!this.isRepliesChat) {
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i15022222222222222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i162222222222222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
this.drawPinnedTop = this.pinnedTop && ((groupedMessagePosition13 = this.currentPosition) == null || (groupedMessagePosition13.flags & 4) != 0);
this.drawPinnedBottom = this.pinnedBottom && ((groupedMessagePosition12 = this.currentPosition) == null || (groupedMessagePosition12.flags & 8) != 0);
boolean z62222 = this.isPlayingRound;
this.isPlayingRound = (!this.isRoundVideo || !MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || (chatMessageCellDelegate = this.delegate) == null || chatMessageCellDelegate.keyboardIsOpened() || this.delegate.isLandscape()) ? false : true;
this.photoImage.setCrossfadeWithOldImage(false);
this.photoImage.setCrossfadeDuration(ImageReceiver.DEFAULT_CROSSFADE_DURATION);
this.photoImage.setCrossfadeByScale(0.0f);
this.photoImage.setGradientBitmap(null);
this.photoImage.clearDecorators();
this.photoImage.setInvalidateAll(false);
this.linkPreviewY = 0;
this.lastTranslated = messageObject20.translated;
TLRPC$Message tLRPC$Message52222 = messageObject20.messageOwner;
this.lastSendState = tLRPC$Message52222.send_state;
this.lastDeleteDate = tLRPC$Message52222.destroyTime;
this.lastViewsCount = tLRPC$Message52222.views;
this.lastRepliesCount = getRepliesCount();
if (z60) {
}
this.gamePreviewPressed = z7;
this.sideButtonPressed = z7;
this.hasNewLineForTime = z7;
this.flipImage = z7;
this.isThreadPost = this.isThreadChat && (tLRPC$MessageFwdHeader = (tLRPC$Message2 = messageObject20.messageOwner).fwd_from) != null && tLRPC$MessageFwdHeader.channel_post != 0 && tLRPC$Message2.reply_to == null;
this.isAvatarVisible = needDrawAvatar() && ((groupedMessagePosition11 = this.currentPosition) == null || groupedMessagePosition11.edge);
needDrawAvatar = needDrawAvatar();
if (messageObject20.customAvatarDrawable == null) {
}
this.isAvatarVisible = true;
z8 = true;
this.wasLayout = false;
this.groupPhotoInvisible = false;
this.animatingDrawVideoImageButton = 0;
this.drawVideoSize = false;
this.canStreamVideo = false;
this.animatingNoSound = 0;
if (!messageObject.isSponsored()) {
}
this.hasReplyQuote = r2;
this.isReplyQuote = r2;
this.replyNameLayout = null;
this.adminLayout = null;
this.checkOnlyButtonPressed = r2;
this.replyTextLayout = null;
AnimatedEmojiSpan.release((View) this, this.animatedEmojiReplyStack);
this.lastReplyMessage = null;
this.hasEmbed = r2;
this.autoPlayingMedia = r2;
this.replyNameWidth = r2;
this.replyTextWidth = r2;
this.replyTextHeight = r2;
this.viaWidth = r2;
this.viaNameWidth = r2;
this.viaOnly = r2;
this.addedCaptionHeight = r2;
this.currentReplyPhoto = null;
this.currentUser = null;
this.currentChat = null;
this.currentViaBotUser = null;
this.instantViewLayout = null;
this.drawNameLayout = r2;
this.linkPreviewAbove = r2;
this.isSmallImage = r2;
this.lastLoadingSizeTotal = 0L;
if (this.scheduledInvalidate) {
}
this.links.clear();
this.pressedLink = null;
this.pressedEmoji = null;
this.pressedLinkType = -1;
messageObject20.forceUpdate = r2;
this.drawPhotoImage = r2;
this.drawMediaCheckBox = r2;
this.hasLinkPreview = r2;
this.hasOldCaptionPreview = r2;
this.hasGamePreview = r2;
this.hasInvoicePreview = r2;
this.commentButtonPressed = r2;
this.instantPressed = r2;
this.gradientDrawable = null;
setInstantButtonPressed(r2);
if (!z6) {
}
resetContactButtonsPressedState();
this.drawnContactButtonsFlag = 0;
this.drawContact = false;
this.drawContactView = false;
this.drawContactSendMessage = false;
this.drawContactAdd = false;
this.spoilerPressed = null;
this.isSpoilerRevealing = false;
this.linkPreviewPressed = false;
this.buttonPressed = 0;
this.additionalTimeOffsetY = 0;
this.miniButtonPressed = 0;
this.pressedBotButton = i;
this.pressedVoteButton = i;
this.pollHintPressed = false;
this.psaHintPressed = false;
this.linkPreviewHeight = 0;
this.mediaOffsetY = 0;
this.documentAttachType = 0;
this.documentAttach = null;
this.descriptionLayout = null;
this.titleLayout = null;
this.videoInfoLayout = null;
this.photosCountLayout = null;
this.siteNameLayout = null;
this.authorLayout = null;
this.captionFullWidth = 0;
this.captionLayout = null;
this.captionWidth = 0;
this.captionHeight = 0;
this.captionOffsetX = 0;
this.currentCaption = null;
this.captionLayout = null;
this.docTitleLayout = null;
this.drawImageButton = false;
this.drawVideoImageButton = false;
this.currentPhotoLocation = null;
this.currentPhotoThumbLocation = null;
this.currentPhotoObject = null;
this.photoParentObject = null;
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = null;
if (!z3) {
}
this.currentPhotoFilter = null;
this.buttonState = i;
this.miniButtonState = i;
this.hasMiniProgress = 0;
if (this.addedForTest) {
}
this.addedForTest = false;
this.photoNotSet = false;
this.drawBackground = z58;
this.drawName = false;
this.useSeekBarWaveform = false;
this.useTranscribeButton = false;
this.drawInstantView = false;
this.drawInstantViewType = 0;
this.instantViewButtonText = null;
this.drawForwardedName = false;
this.drawCommentButton = false;
this.photoImage.setSideClip(0.0f);
this.photoImage.setAspectFit(false);
this.gradientShader = null;
this.motionBackgroundDrawable = null;
this.imageBackgroundColor = 0;
this.imageBackgroundGradientColor1 = 0;
this.imageBackgroundGradientColor2 = 0;
this.imageBackgroundIntensity = 0.0f;
this.imageBackgroundGradientColor3 = 0;
this.imageBackgroundGradientRotation = 45;
this.imageBackgroundSideColor = 0;
this.mediaBackground = false;
expiredStoryView = this.expiredStoryView;
if (expiredStoryView != null) {
}
this.photoImage.animatedFileDrawableRepeatMaxCount = 0;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader22222222 = messageObject20.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader22222222 == null) {
}
this.hasPsaHint = z9;
if (z9) {
}
this.photoImage.setAlpha(1.0f);
if (!z3) {
}
this.pollButtons.clear();
this.availableTimeWidth = 0;
this.photoImage.setForceLoading(false);
this.photoImage.setNeedsQualityThumb(false);
this.photoImage.setShouldGenerateQualityThumb(false);
this.photoImage.setAllowDecodeSingleFrame(false);
this.photoImage.setColorFilter(null);
this.photoImage.setMediaStartEndTime(-1L, -1L);
if (!z60) {
}
messageObject20.reactionsChanged = false;
if (messageObject.shouldDrawReactions()) {
}
this.reactionsLayoutInBubble.setMessage(null, false, this.resourcesProvider);
if (z3) {
}
groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
}
isLinkedToChat = messageObject20.isLinkedToChat(this.linkedChatId);
if (this.hasDiscussion) {
}
MessageObject.GroupedMessagePosition groupedMessagePosition1522222222222 = this.currentPosition;
if (groupedMessagePosition1522222222222 != null) {
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
}
if (!this.isRepliesChat) {
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i150222222222222222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i1622222222222222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
this.drawPinnedTop = this.pinnedTop;
this.drawPinnedBottom = this.pinnedBottom;
boolean z622222 = this.isPlayingRound;
this.isPlayingRound = (!this.isRoundVideo || !MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || (chatMessageCellDelegate = this.delegate) == null || chatMessageCellDelegate.keyboardIsOpened() || this.delegate.isLandscape()) ? false : true;
this.photoImage.setCrossfadeWithOldImage(false);
this.photoImage.setCrossfadeDuration(ImageReceiver.DEFAULT_CROSSFADE_DURATION);
this.photoImage.setCrossfadeByScale(0.0f);
this.photoImage.setGradientBitmap(null);
this.photoImage.clearDecorators();
this.photoImage.setInvalidateAll(false);
this.linkPreviewY = 0;
this.lastTranslated = messageObject20.translated;
TLRPC$Message tLRPC$Message522222 = messageObject20.messageOwner;
this.lastSendState = tLRPC$Message522222.send_state;
this.lastDeleteDate = tLRPC$Message522222.destroyTime;
this.lastViewsCount = tLRPC$Message522222.views;
this.lastRepliesCount = getRepliesCount();
if (z60) {
}
this.gamePreviewPressed = z7;
this.sideButtonPressed = z7;
this.hasNewLineForTime = z7;
this.flipImage = z7;
this.isThreadPost = this.isThreadChat && (tLRPC$MessageFwdHeader = (tLRPC$Message2 = messageObject20.messageOwner).fwd_from) != null && tLRPC$MessageFwdHeader.channel_post != 0 && tLRPC$Message2.reply_to == null;
this.isAvatarVisible = needDrawAvatar() && ((groupedMessagePosition11 = this.currentPosition) == null || groupedMessagePosition11.edge);
needDrawAvatar = needDrawAvatar();
if (messageObject20.customAvatarDrawable == null) {
}
this.isAvatarVisible = true;
z8 = true;
this.wasLayout = false;
this.groupPhotoInvisible = false;
this.animatingDrawVideoImageButton = 0;
this.drawVideoSize = false;
this.canStreamVideo = false;
this.animatingNoSound = 0;
if (!messageObject.isSponsored()) {
}
this.hasReplyQuote = r2;
this.isReplyQuote = r2;
this.replyNameLayout = null;
this.adminLayout = null;
this.checkOnlyButtonPressed = r2;
this.replyTextLayout = null;
AnimatedEmojiSpan.release((View) this, this.animatedEmojiReplyStack);
this.lastReplyMessage = null;
this.hasEmbed = r2;
this.autoPlayingMedia = r2;
this.replyNameWidth = r2;
this.replyTextWidth = r2;
this.replyTextHeight = r2;
this.viaWidth = r2;
this.viaNameWidth = r2;
this.viaOnly = r2;
this.addedCaptionHeight = r2;
this.currentReplyPhoto = null;
this.currentUser = null;
this.currentChat = null;
this.currentViaBotUser = null;
this.instantViewLayout = null;
this.drawNameLayout = r2;
this.linkPreviewAbove = r2;
this.isSmallImage = r2;
this.lastLoadingSizeTotal = 0L;
if (this.scheduledInvalidate) {
}
this.links.clear();
this.pressedLink = null;
this.pressedEmoji = null;
this.pressedLinkType = -1;
messageObject20.forceUpdate = r2;
this.drawPhotoImage = r2;
this.drawMediaCheckBox = r2;
this.hasLinkPreview = r2;
this.hasOldCaptionPreview = r2;
this.hasGamePreview = r2;
this.hasInvoicePreview = r2;
this.commentButtonPressed = r2;
this.instantPressed = r2;
this.gradientDrawable = null;
setInstantButtonPressed(r2);
if (!z6) {
}
resetContactButtonsPressedState();
this.drawnContactButtonsFlag = 0;
this.drawContact = false;
this.drawContactView = false;
this.drawContactSendMessage = false;
this.drawContactAdd = false;
this.spoilerPressed = null;
this.isSpoilerRevealing = false;
this.linkPreviewPressed = false;
this.buttonPressed = 0;
this.additionalTimeOffsetY = 0;
this.miniButtonPressed = 0;
this.pressedBotButton = i;
this.pressedVoteButton = i;
this.pollHintPressed = false;
this.psaHintPressed = false;
this.linkPreviewHeight = 0;
this.mediaOffsetY = 0;
this.documentAttachType = 0;
this.documentAttach = null;
this.descriptionLayout = null;
this.titleLayout = null;
this.videoInfoLayout = null;
this.photosCountLayout = null;
this.siteNameLayout = null;
this.authorLayout = null;
this.captionFullWidth = 0;
this.captionLayout = null;
this.captionWidth = 0;
this.captionHeight = 0;
this.captionOffsetX = 0;
this.currentCaption = null;
this.captionLayout = null;
this.docTitleLayout = null;
this.drawImageButton = false;
this.drawVideoImageButton = false;
this.currentPhotoLocation = null;
this.currentPhotoThumbLocation = null;
this.currentPhotoObject = null;
this.photoParentObject = null;
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = null;
if (!z3) {
}
this.currentPhotoFilter = null;
this.buttonState = i;
this.miniButtonState = i;
this.hasMiniProgress = 0;
if (this.addedForTest) {
}
this.addedForTest = false;
this.photoNotSet = false;
this.drawBackground = z58;
this.drawName = false;
this.useSeekBarWaveform = false;
this.useTranscribeButton = false;
this.drawInstantView = false;
this.drawInstantViewType = 0;
this.instantViewButtonText = null;
this.drawForwardedName = false;
this.drawCommentButton = false;
this.photoImage.setSideClip(0.0f);
this.photoImage.setAspectFit(false);
this.gradientShader = null;
this.motionBackgroundDrawable = null;
this.imageBackgroundColor = 0;
this.imageBackgroundGradientColor1 = 0;
this.imageBackgroundGradientColor2 = 0;
this.imageBackgroundIntensity = 0.0f;
this.imageBackgroundGradientColor3 = 0;
this.imageBackgroundGradientRotation = 45;
this.imageBackgroundSideColor = 0;
this.mediaBackground = false;
expiredStoryView = this.expiredStoryView;
if (expiredStoryView != null) {
}
this.photoImage.animatedFileDrawableRepeatMaxCount = 0;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader222222222 = messageObject20.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader222222222 == null) {
}
this.hasPsaHint = z9;
if (z9) {
}
this.photoImage.setAlpha(1.0f);
if (!z3) {
}
this.pollButtons.clear();
this.availableTimeWidth = 0;
this.photoImage.setForceLoading(false);
this.photoImage.setNeedsQualityThumb(false);
this.photoImage.setShouldGenerateQualityThumb(false);
this.photoImage.setAllowDecodeSingleFrame(false);
this.photoImage.setColorFilter(null);
this.photoImage.setMediaStartEndTime(-1L, -1L);
if (!z60) {
}
messageObject20.reactionsChanged = false;
if (messageObject.shouldDrawReactions()) {
}
this.reactionsLayoutInBubble.setMessage(null, false, this.resourcesProvider);
if (z3) {
}
groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
}
isLinkedToChat = messageObject20.isLinkedToChat(this.linkedChatId);
if (this.hasDiscussion) {
}
MessageObject.GroupedMessagePosition groupedMessagePosition15222222222222 = this.currentPosition;
if (groupedMessagePosition15222222222222 != null) {
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
}
if (!this.isRepliesChat) {
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i1502222222222222222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i16222222222222222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
this.currentMessagesGroup = null;
this.currentPosition = null;
groupedMessages3 = this.currentMessagesGroup;
if (groupedMessages3 == null) {
}
this.drawPinnedTop = this.pinnedTop;
this.drawPinnedBottom = this.pinnedBottom;
boolean z6222222 = this.isPlayingRound;
this.isPlayingRound = (!this.isRoundVideo || !MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || (chatMessageCellDelegate = this.delegate) == null || chatMessageCellDelegate.keyboardIsOpened() || this.delegate.isLandscape()) ? false : true;
this.photoImage.setCrossfadeWithOldImage(false);
this.photoImage.setCrossfadeDuration(ImageReceiver.DEFAULT_CROSSFADE_DURATION);
this.photoImage.setCrossfadeByScale(0.0f);
this.photoImage.setGradientBitmap(null);
this.photoImage.clearDecorators();
this.photoImage.setInvalidateAll(false);
this.linkPreviewY = 0;
this.lastTranslated = messageObject20.translated;
TLRPC$Message tLRPC$Message5222222 = messageObject20.messageOwner;
this.lastSendState = tLRPC$Message5222222.send_state;
this.lastDeleteDate = tLRPC$Message5222222.destroyTime;
this.lastViewsCount = tLRPC$Message5222222.views;
this.lastRepliesCount = getRepliesCount();
if (z60) {
}
this.gamePreviewPressed = z7;
this.sideButtonPressed = z7;
this.hasNewLineForTime = z7;
this.flipImage = z7;
this.isThreadPost = this.isThreadChat && (tLRPC$MessageFwdHeader = (tLRPC$Message2 = messageObject20.messageOwner).fwd_from) != null && tLRPC$MessageFwdHeader.channel_post != 0 && tLRPC$Message2.reply_to == null;
this.isAvatarVisible = needDrawAvatar() && ((groupedMessagePosition11 = this.currentPosition) == null || groupedMessagePosition11.edge);
needDrawAvatar = needDrawAvatar();
if (messageObject20.customAvatarDrawable == null) {
}
this.isAvatarVisible = true;
z8 = true;
this.wasLayout = false;
this.groupPhotoInvisible = false;
this.animatingDrawVideoImageButton = 0;
this.drawVideoSize = false;
this.canStreamVideo = false;
this.animatingNoSound = 0;
if (!messageObject.isSponsored()) {
}
this.hasReplyQuote = r2;
this.isReplyQuote = r2;
this.replyNameLayout = null;
this.adminLayout = null;
this.checkOnlyButtonPressed = r2;
this.replyTextLayout = null;
AnimatedEmojiSpan.release((View) this, this.animatedEmojiReplyStack);
this.lastReplyMessage = null;
this.hasEmbed = r2;
this.autoPlayingMedia = r2;
this.replyNameWidth = r2;
this.replyTextWidth = r2;
this.replyTextHeight = r2;
this.viaWidth = r2;
this.viaNameWidth = r2;
this.viaOnly = r2;
this.addedCaptionHeight = r2;
this.currentReplyPhoto = null;
this.currentUser = null;
this.currentChat = null;
this.currentViaBotUser = null;
this.instantViewLayout = null;
this.drawNameLayout = r2;
this.linkPreviewAbove = r2;
this.isSmallImage = r2;
this.lastLoadingSizeTotal = 0L;
if (this.scheduledInvalidate) {
}
this.links.clear();
this.pressedLink = null;
this.pressedEmoji = null;
this.pressedLinkType = -1;
messageObject20.forceUpdate = r2;
this.drawPhotoImage = r2;
this.drawMediaCheckBox = r2;
this.hasLinkPreview = r2;
this.hasOldCaptionPreview = r2;
this.hasGamePreview = r2;
this.hasInvoicePreview = r2;
this.commentButtonPressed = r2;
this.instantPressed = r2;
this.gradientDrawable = null;
setInstantButtonPressed(r2);
if (!z6) {
}
resetContactButtonsPressedState();
this.drawnContactButtonsFlag = 0;
this.drawContact = false;
this.drawContactView = false;
this.drawContactSendMessage = false;
this.drawContactAdd = false;
this.spoilerPressed = null;
this.isSpoilerRevealing = false;
this.linkPreviewPressed = false;
this.buttonPressed = 0;
this.additionalTimeOffsetY = 0;
this.miniButtonPressed = 0;
this.pressedBotButton = i;
this.pressedVoteButton = i;
this.pollHintPressed = false;
this.psaHintPressed = false;
this.linkPreviewHeight = 0;
this.mediaOffsetY = 0;
this.documentAttachType = 0;
this.documentAttach = null;
this.descriptionLayout = null;
this.titleLayout = null;
this.videoInfoLayout = null;
this.photosCountLayout = null;
this.siteNameLayout = null;
this.authorLayout = null;
this.captionFullWidth = 0;
this.captionLayout = null;
this.captionWidth = 0;
this.captionHeight = 0;
this.captionOffsetX = 0;
this.currentCaption = null;
this.captionLayout = null;
this.docTitleLayout = null;
this.drawImageButton = false;
this.drawVideoImageButton = false;
this.currentPhotoLocation = null;
this.currentPhotoThumbLocation = null;
this.currentPhotoObject = null;
this.photoParentObject = null;
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = null;
if (!z3) {
}
this.currentPhotoFilter = null;
this.buttonState = i;
this.miniButtonState = i;
this.hasMiniProgress = 0;
if (this.addedForTest) {
}
this.addedForTest = false;
this.photoNotSet = false;
this.drawBackground = z58;
this.drawName = false;
this.useSeekBarWaveform = false;
this.useTranscribeButton = false;
this.drawInstantView = false;
this.drawInstantViewType = 0;
this.instantViewButtonText = null;
this.drawForwardedName = false;
this.drawCommentButton = false;
this.photoImage.setSideClip(0.0f);
this.photoImage.setAspectFit(false);
this.gradientShader = null;
this.motionBackgroundDrawable = null;
this.imageBackgroundColor = 0;
this.imageBackgroundGradientColor1 = 0;
this.imageBackgroundGradientColor2 = 0;
this.imageBackgroundIntensity = 0.0f;
this.imageBackgroundGradientColor3 = 0;
this.imageBackgroundGradientRotation = 45;
this.imageBackgroundSideColor = 0;
this.mediaBackground = false;
expiredStoryView = this.expiredStoryView;
if (expiredStoryView != null) {
}
this.photoImage.animatedFileDrawableRepeatMaxCount = 0;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader2222222222 = messageObject20.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader2222222222 == null) {
}
this.hasPsaHint = z9;
if (z9) {
}
this.photoImage.setAlpha(1.0f);
if (!z3) {
}
this.pollButtons.clear();
this.availableTimeWidth = 0;
this.photoImage.setForceLoading(false);
this.photoImage.setNeedsQualityThumb(false);
this.photoImage.setShouldGenerateQualityThumb(false);
this.photoImage.setAllowDecodeSingleFrame(false);
this.photoImage.setColorFilter(null);
this.photoImage.setMediaStartEndTime(-1L, -1L);
if (!z60) {
}
messageObject20.reactionsChanged = false;
if (messageObject.shouldDrawReactions()) {
}
this.reactionsLayoutInBubble.setMessage(null, false, this.resourcesProvider);
if (z3) {
}
groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
}
isLinkedToChat = messageObject20.isLinkedToChat(this.linkedChatId);
if (this.hasDiscussion) {
}
MessageObject.GroupedMessagePosition groupedMessagePosition152222222222222 = this.currentPosition;
if (groupedMessagePosition152222222222222 != null) {
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
}
if (!this.isRepliesChat) {
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i15022222222222222222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i162222222222222222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
if (!z57) {
}
tLRPC$Poll2 = this.lastPoll;
z6 = z57;
if (tLRPC$Poll2 != tLRPC$Poll) {
}
this.animatePollAvatars = false;
if (z6) {
}
if (!z60) {
}
if (!z4) {
}
j = 0;
i = -1;
i2 = 2;
if (z3) {
}
this.wasPinned = this.isPinned;
this.pinnedBottom = z;
this.pinnedTop = z2;
this.currentMessageObject = messageObject20;
this.currentMessagesGroup = groupedMessages;
this.lastTime = -2.0d;
this.lastPostAuthor = messageObject20.messageOwner.post_author;
if (!z60) {
}
this.isHighlightedAnimated = false;
this.wasTranscriptionOpen = false;
if (this.highlightedQuote) {
}
this.highlightedQuote = false;
this.widthBeforeNewTimeLine = -1;
groupedMessages2 = this.currentMessagesGroup;
if (groupedMessages2 != null) {
}
this.currentMessagesGroup = null;
this.currentPosition = null;
groupedMessages3 = this.currentMessagesGroup;
if (groupedMessages3 == null) {
}
this.drawPinnedTop = this.pinnedTop;
this.drawPinnedBottom = this.pinnedBottom;
boolean z62222222 = this.isPlayingRound;
this.isPlayingRound = (!this.isRoundVideo || !MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || (chatMessageCellDelegate = this.delegate) == null || chatMessageCellDelegate.keyboardIsOpened() || this.delegate.isLandscape()) ? false : true;
this.photoImage.setCrossfadeWithOldImage(false);
this.photoImage.setCrossfadeDuration(ImageReceiver.DEFAULT_CROSSFADE_DURATION);
this.photoImage.setCrossfadeByScale(0.0f);
this.photoImage.setGradientBitmap(null);
this.photoImage.clearDecorators();
this.photoImage.setInvalidateAll(false);
this.linkPreviewY = 0;
this.lastTranslated = messageObject20.translated;
TLRPC$Message tLRPC$Message52222222 = messageObject20.messageOwner;
this.lastSendState = tLRPC$Message52222222.send_state;
this.lastDeleteDate = tLRPC$Message52222222.destroyTime;
this.lastViewsCount = tLRPC$Message52222222.views;
this.lastRepliesCount = getRepliesCount();
if (z60) {
}
this.gamePreviewPressed = z7;
this.sideButtonPressed = z7;
this.hasNewLineForTime = z7;
this.flipImage = z7;
this.isThreadPost = this.isThreadChat && (tLRPC$MessageFwdHeader = (tLRPC$Message2 = messageObject20.messageOwner).fwd_from) != null && tLRPC$MessageFwdHeader.channel_post != 0 && tLRPC$Message2.reply_to == null;
this.isAvatarVisible = needDrawAvatar() && ((groupedMessagePosition11 = this.currentPosition) == null || groupedMessagePosition11.edge);
needDrawAvatar = needDrawAvatar();
if (messageObject20.customAvatarDrawable == null) {
}
this.isAvatarVisible = true;
z8 = true;
this.wasLayout = false;
this.groupPhotoInvisible = false;
this.animatingDrawVideoImageButton = 0;
this.drawVideoSize = false;
this.canStreamVideo = false;
this.animatingNoSound = 0;
if (!messageObject.isSponsored()) {
}
this.hasReplyQuote = r2;
this.isReplyQuote = r2;
this.replyNameLayout = null;
this.adminLayout = null;
this.checkOnlyButtonPressed = r2;
this.replyTextLayout = null;
AnimatedEmojiSpan.release((View) this, this.animatedEmojiReplyStack);
this.lastReplyMessage = null;
this.hasEmbed = r2;
this.autoPlayingMedia = r2;
this.replyNameWidth = r2;
this.replyTextWidth = r2;
this.replyTextHeight = r2;
this.viaWidth = r2;
this.viaNameWidth = r2;
this.viaOnly = r2;
this.addedCaptionHeight = r2;
this.currentReplyPhoto = null;
this.currentUser = null;
this.currentChat = null;
this.currentViaBotUser = null;
this.instantViewLayout = null;
this.drawNameLayout = r2;
this.linkPreviewAbove = r2;
this.isSmallImage = r2;
this.lastLoadingSizeTotal = 0L;
if (this.scheduledInvalidate) {
}
this.links.clear();
this.pressedLink = null;
this.pressedEmoji = null;
this.pressedLinkType = -1;
messageObject20.forceUpdate = r2;
this.drawPhotoImage = r2;
this.drawMediaCheckBox = r2;
this.hasLinkPreview = r2;
this.hasOldCaptionPreview = r2;
this.hasGamePreview = r2;
this.hasInvoicePreview = r2;
this.commentButtonPressed = r2;
this.instantPressed = r2;
this.gradientDrawable = null;
setInstantButtonPressed(r2);
if (!z6) {
}
resetContactButtonsPressedState();
this.drawnContactButtonsFlag = 0;
this.drawContact = false;
this.drawContactView = false;
this.drawContactSendMessage = false;
this.drawContactAdd = false;
this.spoilerPressed = null;
this.isSpoilerRevealing = false;
this.linkPreviewPressed = false;
this.buttonPressed = 0;
this.additionalTimeOffsetY = 0;
this.miniButtonPressed = 0;
this.pressedBotButton = i;
this.pressedVoteButton = i;
this.pollHintPressed = false;
this.psaHintPressed = false;
this.linkPreviewHeight = 0;
this.mediaOffsetY = 0;
this.documentAttachType = 0;
this.documentAttach = null;
this.descriptionLayout = null;
this.titleLayout = null;
this.videoInfoLayout = null;
this.photosCountLayout = null;
this.siteNameLayout = null;
this.authorLayout = null;
this.captionFullWidth = 0;
this.captionLayout = null;
this.captionWidth = 0;
this.captionHeight = 0;
this.captionOffsetX = 0;
this.currentCaption = null;
this.captionLayout = null;
this.docTitleLayout = null;
this.drawImageButton = false;
this.drawVideoImageButton = false;
this.currentPhotoLocation = null;
this.currentPhotoThumbLocation = null;
this.currentPhotoObject = null;
this.photoParentObject = null;
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = null;
if (!z3) {
}
this.currentPhotoFilter = null;
this.buttonState = i;
this.miniButtonState = i;
this.hasMiniProgress = 0;
if (this.addedForTest) {
}
this.addedForTest = false;
this.photoNotSet = false;
this.drawBackground = z58;
this.drawName = false;
this.useSeekBarWaveform = false;
this.useTranscribeButton = false;
this.drawInstantView = false;
this.drawInstantViewType = 0;
this.instantViewButtonText = null;
this.drawForwardedName = false;
this.drawCommentButton = false;
this.photoImage.setSideClip(0.0f);
this.photoImage.setAspectFit(false);
this.gradientShader = null;
this.motionBackgroundDrawable = null;
this.imageBackgroundColor = 0;
this.imageBackgroundGradientColor1 = 0;
this.imageBackgroundGradientColor2 = 0;
this.imageBackgroundIntensity = 0.0f;
this.imageBackgroundGradientColor3 = 0;
this.imageBackgroundGradientRotation = 45;
this.imageBackgroundSideColor = 0;
this.mediaBackground = false;
expiredStoryView = this.expiredStoryView;
if (expiredStoryView != null) {
}
this.photoImage.animatedFileDrawableRepeatMaxCount = 0;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader22222222222 = messageObject20.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader22222222222 == null) {
}
this.hasPsaHint = z9;
if (z9) {
}
this.photoImage.setAlpha(1.0f);
if (!z3) {
}
this.pollButtons.clear();
this.availableTimeWidth = 0;
this.photoImage.setForceLoading(false);
this.photoImage.setNeedsQualityThumb(false);
this.photoImage.setShouldGenerateQualityThumb(false);
this.photoImage.setAllowDecodeSingleFrame(false);
this.photoImage.setColorFilter(null);
this.photoImage.setMediaStartEndTime(-1L, -1L);
if (!z60) {
}
messageObject20.reactionsChanged = false;
if (messageObject.shouldDrawReactions()) {
}
this.reactionsLayoutInBubble.setMessage(null, false, this.resourcesProvider);
if (z3) {
}
groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
}
isLinkedToChat = messageObject20.isLinkedToChat(this.linkedChatId);
if (this.hasDiscussion) {
}
MessageObject.GroupedMessagePosition groupedMessagePosition1522222222222222 = this.currentPosition;
if (groupedMessagePosition1522222222222222 != null) {
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
}
if (!this.isRepliesChat) {
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i150222222222222222222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i1622222222222222222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
z6 = false;
if (!z4) {
}
j = 0;
i = -1;
i2 = 2;
if (z3) {
}
this.wasPinned = this.isPinned;
this.pinnedBottom = z;
this.pinnedTop = z2;
this.currentMessageObject = messageObject20;
this.currentMessagesGroup = groupedMessages;
this.lastTime = -2.0d;
this.lastPostAuthor = messageObject20.messageOwner.post_author;
if (!z60) {
}
this.isHighlightedAnimated = false;
this.wasTranscriptionOpen = false;
if (this.highlightedQuote) {
}
this.highlightedQuote = false;
this.widthBeforeNewTimeLine = -1;
groupedMessages2 = this.currentMessagesGroup;
if (groupedMessages2 != null) {
}
this.currentMessagesGroup = null;
this.currentPosition = null;
groupedMessages3 = this.currentMessagesGroup;
if (groupedMessages3 == null) {
}
this.drawPinnedTop = this.pinnedTop;
this.drawPinnedBottom = this.pinnedBottom;
boolean z622222222 = this.isPlayingRound;
this.isPlayingRound = (!this.isRoundVideo || !MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || (chatMessageCellDelegate = this.delegate) == null || chatMessageCellDelegate.keyboardIsOpened() || this.delegate.isLandscape()) ? false : true;
this.photoImage.setCrossfadeWithOldImage(false);
this.photoImage.setCrossfadeDuration(ImageReceiver.DEFAULT_CROSSFADE_DURATION);
this.photoImage.setCrossfadeByScale(0.0f);
this.photoImage.setGradientBitmap(null);
this.photoImage.clearDecorators();
this.photoImage.setInvalidateAll(false);
this.linkPreviewY = 0;
this.lastTranslated = messageObject20.translated;
TLRPC$Message tLRPC$Message522222222 = messageObject20.messageOwner;
this.lastSendState = tLRPC$Message522222222.send_state;
this.lastDeleteDate = tLRPC$Message522222222.destroyTime;
this.lastViewsCount = tLRPC$Message522222222.views;
this.lastRepliesCount = getRepliesCount();
if (z60) {
}
this.gamePreviewPressed = z7;
this.sideButtonPressed = z7;
this.hasNewLineForTime = z7;
this.flipImage = z7;
this.isThreadPost = this.isThreadChat && (tLRPC$MessageFwdHeader = (tLRPC$Message2 = messageObject20.messageOwner).fwd_from) != null && tLRPC$MessageFwdHeader.channel_post != 0 && tLRPC$Message2.reply_to == null;
this.isAvatarVisible = needDrawAvatar() && ((groupedMessagePosition11 = this.currentPosition) == null || groupedMessagePosition11.edge);
needDrawAvatar = needDrawAvatar();
if (messageObject20.customAvatarDrawable == null) {
}
this.isAvatarVisible = true;
z8 = true;
this.wasLayout = false;
this.groupPhotoInvisible = false;
this.animatingDrawVideoImageButton = 0;
this.drawVideoSize = false;
this.canStreamVideo = false;
this.animatingNoSound = 0;
if (!messageObject.isSponsored()) {
}
this.hasReplyQuote = r2;
this.isReplyQuote = r2;
this.replyNameLayout = null;
this.adminLayout = null;
this.checkOnlyButtonPressed = r2;
this.replyTextLayout = null;
AnimatedEmojiSpan.release((View) this, this.animatedEmojiReplyStack);
this.lastReplyMessage = null;
this.hasEmbed = r2;
this.autoPlayingMedia = r2;
this.replyNameWidth = r2;
this.replyTextWidth = r2;
this.replyTextHeight = r2;
this.viaWidth = r2;
this.viaNameWidth = r2;
this.viaOnly = r2;
this.addedCaptionHeight = r2;
this.currentReplyPhoto = null;
this.currentUser = null;
this.currentChat = null;
this.currentViaBotUser = null;
this.instantViewLayout = null;
this.drawNameLayout = r2;
this.linkPreviewAbove = r2;
this.isSmallImage = r2;
this.lastLoadingSizeTotal = 0L;
if (this.scheduledInvalidate) {
}
this.links.clear();
this.pressedLink = null;
this.pressedEmoji = null;
this.pressedLinkType = -1;
messageObject20.forceUpdate = r2;
this.drawPhotoImage = r2;
this.drawMediaCheckBox = r2;
this.hasLinkPreview = r2;
this.hasOldCaptionPreview = r2;
this.hasGamePreview = r2;
this.hasInvoicePreview = r2;
this.commentButtonPressed = r2;
this.instantPressed = r2;
this.gradientDrawable = null;
setInstantButtonPressed(r2);
if (!z6) {
}
resetContactButtonsPressedState();
this.drawnContactButtonsFlag = 0;
this.drawContact = false;
this.drawContactView = false;
this.drawContactSendMessage = false;
this.drawContactAdd = false;
this.spoilerPressed = null;
this.isSpoilerRevealing = false;
this.linkPreviewPressed = false;
this.buttonPressed = 0;
this.additionalTimeOffsetY = 0;
this.miniButtonPressed = 0;
this.pressedBotButton = i;
this.pressedVoteButton = i;
this.pollHintPressed = false;
this.psaHintPressed = false;
this.linkPreviewHeight = 0;
this.mediaOffsetY = 0;
this.documentAttachType = 0;
this.documentAttach = null;
this.descriptionLayout = null;
this.titleLayout = null;
this.videoInfoLayout = null;
this.photosCountLayout = null;
this.siteNameLayout = null;
this.authorLayout = null;
this.captionFullWidth = 0;
this.captionLayout = null;
this.captionWidth = 0;
this.captionHeight = 0;
this.captionOffsetX = 0;
this.currentCaption = null;
this.captionLayout = null;
this.docTitleLayout = null;
this.drawImageButton = false;
this.drawVideoImageButton = false;
this.currentPhotoLocation = null;
this.currentPhotoThumbLocation = null;
this.currentPhotoObject = null;
this.photoParentObject = null;
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = null;
if (!z3) {
}
this.currentPhotoFilter = null;
this.buttonState = i;
this.miniButtonState = i;
this.hasMiniProgress = 0;
if (this.addedForTest) {
}
this.addedForTest = false;
this.photoNotSet = false;
this.drawBackground = z58;
this.drawName = false;
this.useSeekBarWaveform = false;
this.useTranscribeButton = false;
this.drawInstantView = false;
this.drawInstantViewType = 0;
this.instantViewButtonText = null;
this.drawForwardedName = false;
this.drawCommentButton = false;
this.photoImage.setSideClip(0.0f);
this.photoImage.setAspectFit(false);
this.gradientShader = null;
this.motionBackgroundDrawable = null;
this.imageBackgroundColor = 0;
this.imageBackgroundGradientColor1 = 0;
this.imageBackgroundGradientColor2 = 0;
this.imageBackgroundIntensity = 0.0f;
this.imageBackgroundGradientColor3 = 0;
this.imageBackgroundGradientRotation = 45;
this.imageBackgroundSideColor = 0;
this.mediaBackground = false;
expiredStoryView = this.expiredStoryView;
if (expiredStoryView != null) {
}
this.photoImage.animatedFileDrawableRepeatMaxCount = 0;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader222222222222 = messageObject20.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader222222222222 == null) {
}
this.hasPsaHint = z9;
if (z9) {
}
this.photoImage.setAlpha(1.0f);
if (!z3) {
}
this.pollButtons.clear();
this.availableTimeWidth = 0;
this.photoImage.setForceLoading(false);
this.photoImage.setNeedsQualityThumb(false);
this.photoImage.setShouldGenerateQualityThumb(false);
this.photoImage.setAllowDecodeSingleFrame(false);
this.photoImage.setColorFilter(null);
this.photoImage.setMediaStartEndTime(-1L, -1L);
if (!z60) {
}
messageObject20.reactionsChanged = false;
if (messageObject.shouldDrawReactions()) {
}
this.reactionsLayoutInBubble.setMessage(null, false, this.resourcesProvider);
if (z3) {
}
groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
}
isLinkedToChat = messageObject20.isLinkedToChat(this.linkedChatId);
if (this.hasDiscussion) {
}
MessageObject.GroupedMessagePosition groupedMessagePosition15222222222222222 = this.currentPosition;
if (groupedMessagePosition15222222222222222 != null) {
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
}
if (!this.isRepliesChat) {
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i1502222222222222222222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i16222222222222222222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
if (!z3) {
}
if (z3) {
}
z6 = false;
if (!z4) {
}
j = 0;
i = -1;
i2 = 2;
if (z3) {
}
this.wasPinned = this.isPinned;
this.pinnedBottom = z;
this.pinnedTop = z2;
this.currentMessageObject = messageObject20;
this.currentMessagesGroup = groupedMessages;
this.lastTime = -2.0d;
this.lastPostAuthor = messageObject20.messageOwner.post_author;
if (!z60) {
}
this.isHighlightedAnimated = false;
this.wasTranscriptionOpen = false;
if (this.highlightedQuote) {
}
this.highlightedQuote = false;
this.widthBeforeNewTimeLine = -1;
groupedMessages2 = this.currentMessagesGroup;
if (groupedMessages2 != null) {
}
this.currentMessagesGroup = null;
this.currentPosition = null;
groupedMessages3 = this.currentMessagesGroup;
if (groupedMessages3 == null) {
}
this.drawPinnedTop = this.pinnedTop;
this.drawPinnedBottom = this.pinnedBottom;
boolean z6222222222 = this.isPlayingRound;
this.isPlayingRound = (!this.isRoundVideo || !MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || (chatMessageCellDelegate = this.delegate) == null || chatMessageCellDelegate.keyboardIsOpened() || this.delegate.isLandscape()) ? false : true;
this.photoImage.setCrossfadeWithOldImage(false);
this.photoImage.setCrossfadeDuration(ImageReceiver.DEFAULT_CROSSFADE_DURATION);
this.photoImage.setCrossfadeByScale(0.0f);
this.photoImage.setGradientBitmap(null);
this.photoImage.clearDecorators();
this.photoImage.setInvalidateAll(false);
this.linkPreviewY = 0;
this.lastTranslated = messageObject20.translated;
TLRPC$Message tLRPC$Message5222222222 = messageObject20.messageOwner;
this.lastSendState = tLRPC$Message5222222222.send_state;
this.lastDeleteDate = tLRPC$Message5222222222.destroyTime;
this.lastViewsCount = tLRPC$Message5222222222.views;
this.lastRepliesCount = getRepliesCount();
if (z60) {
}
this.gamePreviewPressed = z7;
this.sideButtonPressed = z7;
this.hasNewLineForTime = z7;
this.flipImage = z7;
this.isThreadPost = this.isThreadChat && (tLRPC$MessageFwdHeader = (tLRPC$Message2 = messageObject20.messageOwner).fwd_from) != null && tLRPC$MessageFwdHeader.channel_post != 0 && tLRPC$Message2.reply_to == null;
this.isAvatarVisible = needDrawAvatar() && ((groupedMessagePosition11 = this.currentPosition) == null || groupedMessagePosition11.edge);
needDrawAvatar = needDrawAvatar();
if (messageObject20.customAvatarDrawable == null) {
}
this.isAvatarVisible = true;
z8 = true;
this.wasLayout = false;
this.groupPhotoInvisible = false;
this.animatingDrawVideoImageButton = 0;
this.drawVideoSize = false;
this.canStreamVideo = false;
this.animatingNoSound = 0;
if (!messageObject.isSponsored()) {
}
this.hasReplyQuote = r2;
this.isReplyQuote = r2;
this.replyNameLayout = null;
this.adminLayout = null;
this.checkOnlyButtonPressed = r2;
this.replyTextLayout = null;
AnimatedEmojiSpan.release((View) this, this.animatedEmojiReplyStack);
this.lastReplyMessage = null;
this.hasEmbed = r2;
this.autoPlayingMedia = r2;
this.replyNameWidth = r2;
this.replyTextWidth = r2;
this.replyTextHeight = r2;
this.viaWidth = r2;
this.viaNameWidth = r2;
this.viaOnly = r2;
this.addedCaptionHeight = r2;
this.currentReplyPhoto = null;
this.currentUser = null;
this.currentChat = null;
this.currentViaBotUser = null;
this.instantViewLayout = null;
this.drawNameLayout = r2;
this.linkPreviewAbove = r2;
this.isSmallImage = r2;
this.lastLoadingSizeTotal = 0L;
if (this.scheduledInvalidate) {
}
this.links.clear();
this.pressedLink = null;
this.pressedEmoji = null;
this.pressedLinkType = -1;
messageObject20.forceUpdate = r2;
this.drawPhotoImage = r2;
this.drawMediaCheckBox = r2;
this.hasLinkPreview = r2;
this.hasOldCaptionPreview = r2;
this.hasGamePreview = r2;
this.hasInvoicePreview = r2;
this.commentButtonPressed = r2;
this.instantPressed = r2;
this.gradientDrawable = null;
setInstantButtonPressed(r2);
if (!z6) {
}
resetContactButtonsPressedState();
this.drawnContactButtonsFlag = 0;
this.drawContact = false;
this.drawContactView = false;
this.drawContactSendMessage = false;
this.drawContactAdd = false;
this.spoilerPressed = null;
this.isSpoilerRevealing = false;
this.linkPreviewPressed = false;
this.buttonPressed = 0;
this.additionalTimeOffsetY = 0;
this.miniButtonPressed = 0;
this.pressedBotButton = i;
this.pressedVoteButton = i;
this.pollHintPressed = false;
this.psaHintPressed = false;
this.linkPreviewHeight = 0;
this.mediaOffsetY = 0;
this.documentAttachType = 0;
this.documentAttach = null;
this.descriptionLayout = null;
this.titleLayout = null;
this.videoInfoLayout = null;
this.photosCountLayout = null;
this.siteNameLayout = null;
this.authorLayout = null;
this.captionFullWidth = 0;
this.captionLayout = null;
this.captionWidth = 0;
this.captionHeight = 0;
this.captionOffsetX = 0;
this.currentCaption = null;
this.captionLayout = null;
this.docTitleLayout = null;
this.drawImageButton = false;
this.drawVideoImageButton = false;
this.currentPhotoLocation = null;
this.currentPhotoThumbLocation = null;
this.currentPhotoObject = null;
this.photoParentObject = null;
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = null;
if (!z3) {
}
this.currentPhotoFilter = null;
this.buttonState = i;
this.miniButtonState = i;
this.hasMiniProgress = 0;
if (this.addedForTest) {
}
this.addedForTest = false;
this.photoNotSet = false;
this.drawBackground = z58;
this.drawName = false;
this.useSeekBarWaveform = false;
this.useTranscribeButton = false;
this.drawInstantView = false;
this.drawInstantViewType = 0;
this.instantViewButtonText = null;
this.drawForwardedName = false;
this.drawCommentButton = false;
this.photoImage.setSideClip(0.0f);
this.photoImage.setAspectFit(false);
this.gradientShader = null;
this.motionBackgroundDrawable = null;
this.imageBackgroundColor = 0;
this.imageBackgroundGradientColor1 = 0;
this.imageBackgroundGradientColor2 = 0;
this.imageBackgroundIntensity = 0.0f;
this.imageBackgroundGradientColor3 = 0;
this.imageBackgroundGradientRotation = 45;
this.imageBackgroundSideColor = 0;
this.mediaBackground = false;
expiredStoryView = this.expiredStoryView;
if (expiredStoryView != null) {
}
this.photoImage.animatedFileDrawableRepeatMaxCount = 0;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader2222222222222 = messageObject20.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader2222222222222 == null) {
}
this.hasPsaHint = z9;
if (z9) {
}
this.photoImage.setAlpha(1.0f);
if (!z3) {
}
this.pollButtons.clear();
this.availableTimeWidth = 0;
this.photoImage.setForceLoading(false);
this.photoImage.setNeedsQualityThumb(false);
this.photoImage.setShouldGenerateQualityThumb(false);
this.photoImage.setAllowDecodeSingleFrame(false);
this.photoImage.setColorFilter(null);
this.photoImage.setMediaStartEndTime(-1L, -1L);
if (!z60) {
}
messageObject20.reactionsChanged = false;
if (messageObject.shouldDrawReactions()) {
}
this.reactionsLayoutInBubble.setMessage(null, false, this.resourcesProvider);
if (z3) {
}
groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
}
isLinkedToChat = messageObject20.isLinkedToChat(this.linkedChatId);
if (this.hasDiscussion) {
}
MessageObject.GroupedMessagePosition groupedMessagePosition152222222222222222 = this.currentPosition;
if (groupedMessagePosition152222222222222222 != null) {
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
}
if (!this.isRepliesChat) {
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i15022222222222222222222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i162222222222222222222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
if (groupedMessages != this.currentMessagesGroup) {
}
if (!z60) {
}
this.accessibilityText = null;
c = 4;
if (this.drawCommentButton) {
}
if (!z3) {
}
if (z3) {
}
z6 = false;
if (!z4) {
}
j = 0;
i = -1;
i2 = 2;
if (z3) {
}
this.wasPinned = this.isPinned;
this.pinnedBottom = z;
this.pinnedTop = z2;
this.currentMessageObject = messageObject20;
this.currentMessagesGroup = groupedMessages;
this.lastTime = -2.0d;
this.lastPostAuthor = messageObject20.messageOwner.post_author;
if (!z60) {
}
this.isHighlightedAnimated = false;
this.wasTranscriptionOpen = false;
if (this.highlightedQuote) {
}
this.highlightedQuote = false;
this.widthBeforeNewTimeLine = -1;
groupedMessages2 = this.currentMessagesGroup;
if (groupedMessages2 != null) {
}
this.currentMessagesGroup = null;
this.currentPosition = null;
groupedMessages3 = this.currentMessagesGroup;
if (groupedMessages3 == null) {
}
this.drawPinnedTop = this.pinnedTop;
this.drawPinnedBottom = this.pinnedBottom;
boolean z62222222222 = this.isPlayingRound;
this.isPlayingRound = (!this.isRoundVideo || !MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || (chatMessageCellDelegate = this.delegate) == null || chatMessageCellDelegate.keyboardIsOpened() || this.delegate.isLandscape()) ? false : true;
this.photoImage.setCrossfadeWithOldImage(false);
this.photoImage.setCrossfadeDuration(ImageReceiver.DEFAULT_CROSSFADE_DURATION);
this.photoImage.setCrossfadeByScale(0.0f);
this.photoImage.setGradientBitmap(null);
this.photoImage.clearDecorators();
this.photoImage.setInvalidateAll(false);
this.linkPreviewY = 0;
this.lastTranslated = messageObject20.translated;
TLRPC$Message tLRPC$Message52222222222 = messageObject20.messageOwner;
this.lastSendState = tLRPC$Message52222222222.send_state;
this.lastDeleteDate = tLRPC$Message52222222222.destroyTime;
this.lastViewsCount = tLRPC$Message52222222222.views;
this.lastRepliesCount = getRepliesCount();
if (z60) {
}
this.gamePreviewPressed = z7;
this.sideButtonPressed = z7;
this.hasNewLineForTime = z7;
this.flipImage = z7;
this.isThreadPost = this.isThreadChat && (tLRPC$MessageFwdHeader = (tLRPC$Message2 = messageObject20.messageOwner).fwd_from) != null && tLRPC$MessageFwdHeader.channel_post != 0 && tLRPC$Message2.reply_to == null;
this.isAvatarVisible = needDrawAvatar() && ((groupedMessagePosition11 = this.currentPosition) == null || groupedMessagePosition11.edge);
needDrawAvatar = needDrawAvatar();
if (messageObject20.customAvatarDrawable == null) {
}
this.isAvatarVisible = true;
z8 = true;
this.wasLayout = false;
this.groupPhotoInvisible = false;
this.animatingDrawVideoImageButton = 0;
this.drawVideoSize = false;
this.canStreamVideo = false;
this.animatingNoSound = 0;
if (!messageObject.isSponsored()) {
}
this.hasReplyQuote = r2;
this.isReplyQuote = r2;
this.replyNameLayout = null;
this.adminLayout = null;
this.checkOnlyButtonPressed = r2;
this.replyTextLayout = null;
AnimatedEmojiSpan.release((View) this, this.animatedEmojiReplyStack);
this.lastReplyMessage = null;
this.hasEmbed = r2;
this.autoPlayingMedia = r2;
this.replyNameWidth = r2;
this.replyTextWidth = r2;
this.replyTextHeight = r2;
this.viaWidth = r2;
this.viaNameWidth = r2;
this.viaOnly = r2;
this.addedCaptionHeight = r2;
this.currentReplyPhoto = null;
this.currentUser = null;
this.currentChat = null;
this.currentViaBotUser = null;
this.instantViewLayout = null;
this.drawNameLayout = r2;
this.linkPreviewAbove = r2;
this.isSmallImage = r2;
this.lastLoadingSizeTotal = 0L;
if (this.scheduledInvalidate) {
}
this.links.clear();
this.pressedLink = null;
this.pressedEmoji = null;
this.pressedLinkType = -1;
messageObject20.forceUpdate = r2;
this.drawPhotoImage = r2;
this.drawMediaCheckBox = r2;
this.hasLinkPreview = r2;
this.hasOldCaptionPreview = r2;
this.hasGamePreview = r2;
this.hasInvoicePreview = r2;
this.commentButtonPressed = r2;
this.instantPressed = r2;
this.gradientDrawable = null;
setInstantButtonPressed(r2);
if (!z6) {
}
resetContactButtonsPressedState();
this.drawnContactButtonsFlag = 0;
this.drawContact = false;
this.drawContactView = false;
this.drawContactSendMessage = false;
this.drawContactAdd = false;
this.spoilerPressed = null;
this.isSpoilerRevealing = false;
this.linkPreviewPressed = false;
this.buttonPressed = 0;
this.additionalTimeOffsetY = 0;
this.miniButtonPressed = 0;
this.pressedBotButton = i;
this.pressedVoteButton = i;
this.pollHintPressed = false;
this.psaHintPressed = false;
this.linkPreviewHeight = 0;
this.mediaOffsetY = 0;
this.documentAttachType = 0;
this.documentAttach = null;
this.descriptionLayout = null;
this.titleLayout = null;
this.videoInfoLayout = null;
this.photosCountLayout = null;
this.siteNameLayout = null;
this.authorLayout = null;
this.captionFullWidth = 0;
this.captionLayout = null;
this.captionWidth = 0;
this.captionHeight = 0;
this.captionOffsetX = 0;
this.currentCaption = null;
this.captionLayout = null;
this.docTitleLayout = null;
this.drawImageButton = false;
this.drawVideoImageButton = false;
this.currentPhotoLocation = null;
this.currentPhotoThumbLocation = null;
this.currentPhotoObject = null;
this.photoParentObject = null;
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = null;
if (!z3) {
}
this.currentPhotoFilter = null;
this.buttonState = i;
this.miniButtonState = i;
this.hasMiniProgress = 0;
if (this.addedForTest) {
}
this.addedForTest = false;
this.photoNotSet = false;
this.drawBackground = z58;
this.drawName = false;
this.useSeekBarWaveform = false;
this.useTranscribeButton = false;
this.drawInstantView = false;
this.drawInstantViewType = 0;
this.instantViewButtonText = null;
this.drawForwardedName = false;
this.drawCommentButton = false;
this.photoImage.setSideClip(0.0f);
this.photoImage.setAspectFit(false);
this.gradientShader = null;
this.motionBackgroundDrawable = null;
this.imageBackgroundColor = 0;
this.imageBackgroundGradientColor1 = 0;
this.imageBackgroundGradientColor2 = 0;
this.imageBackgroundIntensity = 0.0f;
this.imageBackgroundGradientColor3 = 0;
this.imageBackgroundGradientRotation = 45;
this.imageBackgroundSideColor = 0;
this.mediaBackground = false;
expiredStoryView = this.expiredStoryView;
if (expiredStoryView != null) {
}
this.photoImage.animatedFileDrawableRepeatMaxCount = 0;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader22222222222222 = messageObject20.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader22222222222222 == null) {
}
this.hasPsaHint = z9;
if (z9) {
}
this.photoImage.setAlpha(1.0f);
if (!z3) {
}
this.pollButtons.clear();
this.availableTimeWidth = 0;
this.photoImage.setForceLoading(false);
this.photoImage.setNeedsQualityThumb(false);
this.photoImage.setShouldGenerateQualityThumb(false);
this.photoImage.setAllowDecodeSingleFrame(false);
this.photoImage.setColorFilter(null);
this.photoImage.setMediaStartEndTime(-1L, -1L);
if (!z60) {
}
messageObject20.reactionsChanged = false;
if (messageObject.shouldDrawReactions()) {
}
this.reactionsLayoutInBubble.setMessage(null, false, this.resourcesProvider);
if (z3) {
}
groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
}
isLinkedToChat = messageObject20.isLinkedToChat(this.linkedChatId);
if (this.hasDiscussion) {
}
MessageObject.GroupedMessagePosition groupedMessagePosition1522222222222222222 = this.currentPosition;
if (groupedMessagePosition1522222222222222222 != null) {
}
repliesCount = getRepliesCount();
if (!messageObject.shouldDrawWithoutBackground()) {
}
if (!this.isRepliesChat) {
}
this.commentLayout = null;
this.drawCommentNumber = false;
this.drawSideButton = !this.isRepliesChat ? 3 : i2;
z10 = z5 ? 1 : 0;
int i150222222222222222222222222 = 20;
if (messageObject20.type == 27) {
}
i6 = 0;
i7 = 1;
r7 = z11;
if (this.currentPosition == null) {
}
i = -1;
i8 = 5;
i10 = 8;
groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
}
int i1622222222222222222222222222222222222222 = this.widthBeforeNewTimeLine;
messageObject3 = this.currentMessageObject;
if (messageObject3.eventId == 0) {
}
f3 = 0.0f;
this.botButtons.clear();
if (z60) {
}
if (!messageObject2.isRestrictedMessage) {
}
this.substractBackgroundHeight = 0;
this.keyboardHeight = 0;
r72 = r7;
if (this.drawCommentButton) {
}
z14 = this.drawPinnedBottom;
if (z14) {
}
if (!z14) {
}
if (!this.mediaBackground) {
}
if (messageObject2.type != 19) {
}
if (!this.drawPhotoImage) {
}
if (this.documentAttachType == i8) {
}
calculateUnlockXY();
if (i7 != 0) {
}
updateAnimatedEmojis();
r73 = r72;
if (z60) {
}
transcribeButton = this.transcribeButton;
if (transcribeButton != null) {
}
updateWaveform();
if (z60) {
}
z52 = true;
z53 = false;
z54 = false;
updateButtonState(z53, z54, z52);
if (!this.currentMessageObject.loadingCancelled) {
}
chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null) {
}
this.accessibilityVirtualViewBounds.clear();
this.transitionParams.updatePhotoImageX = true;
this.highlightCaptionToSetEnd = i;
this.highlightCaptionToSetStart = i;
updateFlagSecure();
}
public void lambda$setMessageContent$7(TLRPC$User tLRPC$User, int i, TLRPC$Chat tLRPC$Chat, long j) {
if (tLRPC$User != null) {
this.commentAvatarDrawables[i].setInfo(this.currentAccount, tLRPC$User);
this.commentAvatarImages[i].setForUserOrChat(tLRPC$User, this.commentAvatarDrawables[i]);
} else if (tLRPC$Chat != null) {
this.commentAvatarDrawables[i].setInfo(this.currentAccount, tLRPC$Chat);
this.commentAvatarImages[i].setForUserOrChat(tLRPC$Chat, this.commentAvatarDrawables[i]);
} else {
this.commentAvatarDrawables[i].setInfo(j, "", "");
}
}
public static int lambda$setMessageContent$8(PollButton pollButton, PollButton pollButton2) {
if (pollButton.decimal > pollButton2.decimal) {
return -1;
}
if (pollButton.decimal < pollButton2.decimal) {
return 1;
}
if (pollButton.decimal != pollButton2.decimal) {
return 0;
}
if (pollButton.percent > pollButton2.percent) {
return 1;
}
return pollButton.percent < pollButton2.percent ? -1 : 0;
}
private boolean loopStickers() {
return LiteMode.isEnabled(2);
}
private void calculateUnlockXY() {
if (this.currentMessageObject.type != 20 || this.unlockLayout == null) {
return;
}
this.unlockX = this.backgroundDrawableLeft + ((this.photoImage.getImageWidth() - this.unlockLayout.getWidth()) / 2.0f);
this.unlockY = this.backgroundDrawableTop + this.photoImage.getImageY() + ((this.photoImage.getImageHeight() - this.unlockLayout.getHeight()) / 2.0f);
}
private void updateFlagSecure() {
if (this.flagSecure == null) {
Activity findActivity = AndroidUtilities.findActivity(getContext());
Window window = findActivity == null ? null : findActivity.getWindow();
if (window != null) {
FlagSecureReason flagSecureReason = new FlagSecureReason(window, new FlagSecureReason.FlagSecureCondition() {
@Override
public final boolean run() {
boolean lambda$updateFlagSecure$9;
lambda$updateFlagSecure$9 = ChatMessageCell.this.lambda$updateFlagSecure$9();
return lambda$updateFlagSecure$9;
}
});
this.flagSecure = flagSecureReason;
if (this.attachedToWindow) {
flagSecureReason.attach();
}
}
}
FlagSecureReason flagSecureReason2 = this.flagSecure;
if (flagSecureReason2 != null) {
flagSecureReason2.invalidate();
}
}
public boolean lambda$updateFlagSecure$9() {
TLRPC$Message tLRPC$Message;
MessageObject messageObject = this.currentMessageObject;
return (messageObject == null || (tLRPC$Message = messageObject.messageOwner) == null || (!tLRPC$Message.noforwards && !messageObject.isVoiceOnce() && !this.currentMessageObject.hasRevealedExtendedMedia())) ? false : true;
}
public void checkVideoPlayback(boolean z, Bitmap bitmap) {
if (this.currentMessageObject.isVideo()) {
if (MediaController.getInstance().isPlayingMessage(this.currentMessageObject)) {
this.photoImage.setAllowStartAnimation(false);
this.photoImage.stopAnimation();
return;
} else {
this.photoImage.setAllowStartAnimation(true);
this.photoImage.startAnimation();
return;
}
}
if (z) {
MessageObject playingMessageObject = MediaController.getInstance().getPlayingMessageObject();
z = playingMessageObject == null || !playingMessageObject.isRoundVideo();
}
this.photoImage.setAllowStartAnimation(z);
if (bitmap != null) {
this.photoImage.startCrossfadeFromStaticThumb(bitmap);
}
if (z) {
this.photoImage.startAnimation();
} else {
this.photoImage.stopAnimation();
}
}
private static boolean spanSupportsLongPress(CharacterStyle characterStyle) {
return (characterStyle instanceof URLSpanMono) || (characterStyle instanceof URLSpan);
}
@Override
protected boolean onLongPress() {
boolean z = false;
z = false;
int i = 0;
z = false;
if (this.isRoundVideo && this.isPlayingRound && MediaController.getInstance().isPlayingMessage(this.currentMessageObject) && ((this.lastTouchX - this.photoImage.getCenterX()) * (this.lastTouchX - this.photoImage.getCenterX())) + ((this.lastTouchY - this.photoImage.getCenterY()) * (this.lastTouchY - this.photoImage.getCenterY())) < (this.photoImage.getImageWidth() / 2.0f) * (this.photoImage.getImageWidth() / 2.0f) && (this.lastTouchX > this.photoImage.getCenterX() + (this.photoImage.getImageWidth() / 4.0f) || this.lastTouchX < this.photoImage.getCenterX() - (this.photoImage.getImageWidth() / 4.0f))) {
boolean z2 = this.lastTouchX > this.photoImage.getCenterX();
if (this.videoPlayerRewinder == null) {
this.videoForwardDrawable = new VideoForwardDrawable(true);
this.videoPlayerRewinder = new VideoPlayerRewinder() {
@Override
protected void onRewindCanceled() {
ChatMessageCell.this.onTouchEvent(MotionEvent.obtain(0L, 0L, 3, 0.0f, 0.0f, 0));
ChatMessageCell.this.videoForwardDrawable.setShowing(false);
}
@Override
protected void updateRewindProgressUi(long j, float f, boolean z3) {
ChatMessageCell.this.videoForwardDrawable.setTime(Math.abs(j));
if (z3) {
ChatMessageCell.this.currentMessageObject.audioProgress = f;
ChatMessageCell.this.updatePlayingMessageProgress();
}
}
@Override
protected void onRewindStart(boolean z3) {
ChatMessageCell.this.videoForwardDrawable.setDelegate(new VideoForwardDrawable.VideoForwardDrawableDelegate() {
@Override
public void onAnimationEnd() {
}
@Override
public void invalidate() {
ChatMessageCell.this.invalidate();
}
});
ChatMessageCell.this.videoForwardDrawable.setOneShootAnimation(false);
ChatMessageCell.this.videoForwardDrawable.setLeftSide(!z3);
ChatMessageCell.this.videoForwardDrawable.setShowing(true);
ChatMessageCell.this.invalidate();
}
};
getParent().requestDisallowInterceptTouchEvent(true);
}
this.videoPlayerRewinder.startRewind(MediaController.getInstance().getVideoPlayer(), z2, MediaController.getInstance().getPlaybackSpeed(false));
return false;
}
Drawable drawable = this.replySelector;
if (drawable != null) {
this.replySelectorPressed = false;
drawable.setState(StateSet.NOTHING);
invalidate();
}
Drawable drawable2 = this.nameStatusSelector;
if (drawable2 != null) {
drawable2.setState(StateSet.NOTHING);
}
Drawable drawable3 = this.nameLayoutSelector;
if (drawable3 != null) {
drawable3.setState(StateSet.NOTHING);
}
resetCodeSelectors();
ButtonBounce buttonBounce = this.replyBounce;
if (buttonBounce != null) {
buttonBounce.setPressed(false);
}
MessageTopicButton messageTopicButton = this.topicButton;
if (messageTopicButton != null) {
messageTopicButton.resetClick();
}
if (this.pressedEmoji != null) {
this.pressedEmoji = null;
}
LinkSpanDrawable linkSpanDrawable = this.pressedLink;
if (linkSpanDrawable != null) {
if (linkSpanDrawable.getSpan() instanceof URLSpanMono) {
this.hadLongPress = true;
this.delegate.didPressUrl(this, this.pressedLink.getSpan(), true);
return true;
}
if (this.pressedLink.getSpan() instanceof URLSpanNoUnderline) {
URLSpanNoUnderline uRLSpanNoUnderline = (URLSpanNoUnderline) this.pressedLink.getSpan();
if (ChatActivity.isClickableLink(uRLSpanNoUnderline.getURL()) || uRLSpanNoUnderline.getURL().startsWith("/")) {
this.hadLongPress = true;
this.delegate.didPressUrl(this, this.pressedLink.getSpan(), true);
return true;
}
} else if (this.pressedLink.getSpan() instanceof URLSpan) {
this.hadLongPress = true;
this.delegate.didPressUrl(this, this.pressedLink.getSpan(), true);
return true;
}
}
resetPressedLink(-1);
if (this.buttonPressed != 0 || this.miniButtonPressed != 0 || this.videoButtonPressed != 0 || this.pressedBotButton != -1) {
this.buttonPressed = 0;
this.miniButtonPressed = 0;
this.videoButtonPressed = 0;
this.pressedBotButton = -1;
invalidate();
}
this.linkPreviewPressed = false;
this.sideButtonPressed = false;
this.imagePressed = false;
this.timePressed = false;
this.gamePreviewPressed = false;
this.giveawayMessageCell.setButtonPressed(false);
this.giveawayResultsMessageCell.setButtonPressed(false);
resetContactButtonsPressedState();
if (this.pressedVoteButton != -1 || this.pollHintPressed || this.psaHintPressed || this.instantPressed || this.otherPressed || this.commentButtonPressed) {
this.commentButtonPressed = false;
this.instantPressed = false;
setInstantButtonPressed(false);
this.pressedVoteButton = -1;
this.pollHintPressed = false;
this.psaHintPressed = false;
this.otherPressed = false;
if (Build.VERSION.SDK_INT >= 21) {
int i2 = 0;
while (true) {
Drawable[] drawableArr = this.selectorDrawable;
if (i2 >= drawableArr.length) {
break;
}
if (drawableArr[i2] != null) {
drawableArr[i2].setState(StateSet.NOTHING);
}
i2++;
}
Drawable drawable4 = this.linkPreviewSelector;
if (drawable4 != null) {
drawable4.setState(StateSet.NOTHING);
}
}
ButtonBounce buttonBounce2 = this.linkPreviewBounce;
if (buttonBounce2 != null) {
buttonBounce2.setPressed(false);
}
invalidate();
}
ChatMessageCellDelegate chatMessageCellDelegate = this.delegate;
if (chatMessageCellDelegate != null) {
if (this.avatarPressed) {
TLRPC$User tLRPC$User = this.currentUser;
if (tLRPC$User == null) {
TLRPC$Chat tLRPC$Chat = this.currentChat;
if (tLRPC$Chat != null) {
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader = this.currentMessageObject.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader != null) {
if ((tLRPC$MessageFwdHeader.flags & 16) != 0) {
i = tLRPC$MessageFwdHeader.saved_from_msg_id;
} else {
i = tLRPC$MessageFwdHeader.channel_post;
}
}
z = chatMessageCellDelegate.didLongPressChannelAvatar(this, tLRPC$Chat, i, this.lastTouchX, this.lastTouchY);
}
} else if (tLRPC$User.id != 0) {
z = chatMessageCellDelegate.didLongPressUserAvatar(this, tLRPC$User, this.lastTouchX, this.lastTouchY);
}
}
if (!z) {
this.delegate.didLongPress(this, this.lastTouchX, this.lastTouchY);
}
}
return true;
}
public void showHintButton(boolean z, boolean z2, int i) {
if (i == -1 || i == 0) {
if (this.hintButtonVisible == z) {
return;
}
this.hintButtonVisible = z;
if (!z2) {
this.hintButtonProgress = z ? 1.0f : 0.0f;
} else {
invalidate();
}
}
if ((i == -1 || i == 1) && this.psaButtonVisible != z) {
this.psaButtonVisible = z;
if (!z2) {
this.psaButtonProgress = z ? 1.0f : 0.0f;
} else {
setInvalidatesParent(true);
invalidate();
}
}
}
public void setCheckPressed(boolean z, boolean z2) {
this.isCheckPressed = z;
this.isPressed = z2;
updateRadialProgressBackground();
if (this.useSeekBarWaveform) {
this.seekBarWaveform.setSelected(isDrawSelectionBackground());
} else {
this.seekBar.setSelected(isDrawSelectionBackground());
}
invalidate();
}
public void setInvalidateSpoilersParent(boolean z) {
this.invalidateSpoilersParent = z;
}
public void setInvalidatesParent(boolean z) {
this.invalidatesParent = z;
}
private boolean invalidateParentForce() {
MessageObject messageObject;
return (this.links.isEmpty() && this.reactionsLayoutInBubble.isEmpty && ((messageObject = this.currentMessageObject) == null || !messageObject.preview)) ? false : true;
}
public void invalidateOutbounds() {
ChatMessageCellDelegate chatMessageCellDelegate = this.delegate;
if (chatMessageCellDelegate == null || !chatMessageCellDelegate.canDrawOutboundsContent()) {
if (getParent() instanceof View) {
((View) getParent()).invalidate();
return;
}
return;
}
super.invalidate();
}
@Override
public void invalidate() {
ChatMessageCellDelegate chatMessageCellDelegate;
if (this.currentMessageObject == null) {
return;
}
Runnable runnable = this.invalidateCallback;
if (runnable != null) {
runnable.run();
return;
}
super.invalidate();
if ((this.invalidatesParent || (this.currentMessagesGroup != null && invalidateParentForce())) && getParent() != null) {
View view = (View) getParent();
if (view.getParent() != null) {
view.invalidate();
((View) view.getParent()).invalidate();
}
}
if (!this.isBlurred || (chatMessageCellDelegate = this.delegate) == null) {
return;
}
chatMessageCellDelegate.invalidateBlur();
}
public void setInvalidateCallback(Runnable runnable) {
this.invalidateCallback = runnable;
}
@Override
public void invalidate(int i, int i2, int i3, int i4) {
ChatMessageCellDelegate chatMessageCellDelegate;
if (this.currentMessageObject == null) {
return;
}
Runnable runnable = this.invalidateCallback;
if (runnable != null) {
runnable.run();
return;
}
super.invalidate(i, i2, i3, i4);
if (this.invalidatesParent && getParent() != null) {
((View) getParent()).invalidate(((int) getX()) + i, ((int) getY()) + i2, ((int) getX()) + i3, ((int) getY()) + i4);
}
if (!this.isBlurred || (chatMessageCellDelegate = this.delegate) == null) {
return;
}
chatMessageCellDelegate.invalidateBlur();
}
public boolean isHighlightedAnimated() {
return this.isHighlightedAnimated;
}
public void setHighlightedAnimated() {
this.isHighlightedAnimated = true;
this.highlightProgress = 1000;
this.lastHighlightProgressTime = System.currentTimeMillis();
invalidate();
if (getParent() != null) {
((View) getParent()).invalidate();
}
}
public boolean isHighlighted() {
return this.isHighlighted;
}
public void setHighlighted(boolean z) {
if (this.isHighlighted == z) {
return;
}
this.isHighlighted = z;
if (z) {
this.quoteHighlight = null;
}
if (!z) {
this.lastHighlightProgressTime = System.currentTimeMillis();
this.isHighlightedAnimated = true;
this.highlightProgress = 300;
} else {
this.isHighlightedAnimated = false;
this.highlightProgress = 0;
}
updateRadialProgressBackground();
if (this.useSeekBarWaveform) {
this.seekBarWaveform.setSelected(isDrawSelectionBackground());
} else {
this.seekBar.setSelected(isDrawSelectionBackground());
}
invalidate();
if (getParent() != null) {
((View) getParent()).invalidate();
}
}
@Override
public void setPressed(boolean z) {
super.setPressed(z);
updateRadialProgressBackground();
if (this.useSeekBarWaveform) {
this.seekBarWaveform.setSelected(isDrawSelectionBackground());
} else {
this.seekBar.setSelected(isDrawSelectionBackground());
}
invalidate();
}
private void updateRadialProgressBackground() {
if (this.drawRadialCheckBackground) {
return;
}
boolean z = true;
boolean z2 = (this.isHighlighted || this.isPressed || isPressed()) && !(this.drawPhotoImage && this.photoImage.hasBitmapImage());
this.radialProgress.setPressed(z2 || this.buttonPressed != 0, false);
if (this.hasMiniProgress != 0) {
this.radialProgress.setPressed(z2 || this.miniButtonPressed != 0, true);
}
RadialProgress2 radialProgress2 = this.videoRadialProgress;
if (!z2 && this.videoButtonPressed == 0) {
z = false;
}
radialProgress2.setPressed(z, false);
}
@Override
public void onSeekBarPressed() {
requestDisallowInterceptTouchEvent(true);
}
@Override
public void onSeekBarReleased() {
requestDisallowInterceptTouchEvent(false);
}
@Override
public boolean isSeekBarDragAllowed() {
MessageObject messageObject = this.currentMessageObject;
return messageObject == null || !messageObject.isVoiceOnce();
}
@Override
public boolean reverseWaveform() {
MessageObject messageObject = this.currentMessageObject;
return messageObject != null && messageObject.isVoiceOnce();
}
@Override
public void onSeekBarDrag(float f) {
MessageObject messageObject = this.currentMessageObject;
if (messageObject == null) {
return;
}
messageObject.audioProgress = f;
MediaController.getInstance().seekToProgress(this.currentMessageObject, f);
updatePlayingMessageProgress();
}
@Override
public void onSeekBarContinuousDrag(float f) {
MessageObject messageObject = this.currentMessageObject;
if (messageObject == null) {
return;
}
messageObject.audioProgress = f;
messageObject.audioProgressSec = (int) (messageObject.getDuration() * f);
updatePlayingMessageProgress();
}
public boolean isAnimatingPollAnswer() {
return this.animatePollAnswerAlpha;
}
private void updateWaveform() {
MessageObject messageObject = this.currentMessageObject;
if (messageObject != null) {
int i = this.documentAttachType;
if (i == 3 || i == 7) {
byte[] waveform = messageObject.getWaveform();
boolean z = true;
this.useSeekBarWaveform = waveform != null;
SeekBarWaveform seekBarWaveform = this.seekBarWaveform;
if (seekBarWaveform != null) {
seekBarWaveform.setWaveform(waveform);
}
MessageObject messageObject2 = this.currentMessageObject;
if (messageObject2 != null && (!messageObject2.isOutOwner() || this.currentMessageObject.isSent())) {
if (!UserConfig.getInstance(this.currentAccount).isPremium()) {
if (MessagesController.getInstance(this.currentAccount).transcribeAudioTrialWeeklyNumber > 0 && this.currentMessageObject.getDuration() <= MessagesController.getInstance(this.currentAccount).transcribeAudioTrialDurationMax) {
TLRPC$Message tLRPC$Message = this.currentMessageObject.messageOwner;
if (tLRPC$Message == null || (TextUtils.isEmpty(tLRPC$Message.voiceTranscription) && !this.currentMessageObject.messageOwner.voiceTranscriptionFinal)) {
TranscribeButton.canTranscribeTrial(this.currentMessageObject);
}
} else if (MessagesController.getInstance(this.currentAccount).transcribeAudioTrialWeeklyNumber <= 0) {
if (!MessagesController.getInstance(this.currentAccount).premiumFeaturesBlocked()) {
if (!MessagesController.getInstance(this.currentAccount).didPressTranscribeButtonEnough()) {
if (!this.currentMessageObject.isOutOwner()) {
MessageObject messageObject3 = this.currentMessageObject;
TLRPC$Message tLRPC$Message2 = messageObject3.messageOwner;
if (tLRPC$Message2 != null) {
}
}
}
}
}
}
if (this.currentMessageObject.isVoice()) {
}
}
z = false;
this.useTranscribeButton = z;
updateSeekBarWaveformWidth(null);
}
}
}
private void updateSeekBarWaveformWidth(Canvas canvas) {
int i;
this.seekBarWaveformTranslateX = 0;
int i2 = -AndroidUtilities.dp((this.hasLinkPreview ? 10 : 0) + 92);
TransitionParams transitionParams = this.transitionParams;
if (transitionParams.animateBackgroundBoundsInner && ((i = this.documentAttachType) == 3 || i == 7)) {
int i3 = this.backgroundWidth;
int i4 = (int) ((i3 - transitionParams.toDeltaLeft) + transitionParams.toDeltaRight);
int i5 = (int) ((i3 - transitionParams.deltaLeft) + transitionParams.deltaRight);
if (this.isRoundVideo && !this.drawBackground) {
i5 = (int) (i5 + (getVideoTranscriptionProgress() * AndroidUtilities.dp(8.0f)));
i4 += AndroidUtilities.dp(8.0f);
}
TransitionParams transitionParams2 = this.transitionParams;
if (transitionParams2.toDeltaLeft == 0.0f && transitionParams2.toDeltaRight == 0.0f) {
i4 = i5;
}
SeekBarWaveform seekBarWaveform = this.seekBarWaveform;
if (seekBarWaveform != null) {
if (transitionParams2.animateUseTranscribeButton) {
seekBarWaveform.setSize(((i5 + i2) - ((int) (AndroidUtilities.dp(34.0f) * getUseTranscribeButtonProgress()))) - AndroidUtilities.dp(this.hasLinkPreview ? 10.0f : 0.0f), AndroidUtilities.dp(30.0f), i3 + i2 + (!this.useTranscribeButton ? -AndroidUtilities.dp(34.0f) : 0), i4 + i2 + (this.useTranscribeButton ? -AndroidUtilities.dp(34.0f) : 0));
} else {
seekBarWaveform.setSize(((i5 + i2) - ((int) (AndroidUtilities.dp(34.0f) * getUseTranscribeButtonProgress()))) - AndroidUtilities.dp(this.hasLinkPreview ? 10.0f : 0.0f), AndroidUtilities.dp(30.0f), (i3 + i2) - ((int) (AndroidUtilities.dp(34.0f) * getUseTranscribeButtonProgress())), (i4 + i2) - ((int) (AndroidUtilities.dp(34.0f) * getUseTranscribeButtonProgress())));
}
}
SeekBar seekBar = this.seekBar;
if (seekBar != null) {
seekBar.setSize((i5 - ((int) (getUseTranscribeButtonProgress() * AndroidUtilities.dp(34.0f)))) - AndroidUtilities.dp((this.documentAttachType != 5 ? 72 : 65) + (this.hasLinkPreview ? 20 : 0)), AndroidUtilities.dp(30.0f));
return;
}
return;
}
SeekBarWaveform seekBarWaveform2 = this.seekBarWaveform;
if (seekBarWaveform2 != null) {
if (transitionParams.animateUseTranscribeButton) {
seekBarWaveform2.setSize(((this.backgroundWidth + i2) - ((int) (AndroidUtilities.dp(34.0f) * getUseTranscribeButtonProgress()))) - AndroidUtilities.dp(this.hasLinkPreview ? 10.0f : 0.0f), AndroidUtilities.dp(30.0f), ((this.backgroundWidth + i2) + (!this.useTranscribeButton ? -AndroidUtilities.dp(34.0f) : 0)) - AndroidUtilities.dp(this.hasLinkPreview ? 10.0f : 0.0f), this.backgroundWidth + i2 + (this.useTranscribeButton ? -AndroidUtilities.dp(34.0f) : 0));
} else {
seekBarWaveform2.setSize(((this.backgroundWidth + i2) - ((int) (AndroidUtilities.dp(34.0f) * getUseTranscribeButtonProgress()))) - AndroidUtilities.dp(this.hasLinkPreview ? 10.0f : 0.0f), AndroidUtilities.dp(30.0f));
}
}
SeekBar seekBar2 = this.seekBar;
if (seekBar2 != null) {
seekBar2.setSize((this.backgroundWidth - ((int) (getUseTranscribeButtonProgress() * AndroidUtilities.dp(34.0f)))) - AndroidUtilities.dp((this.documentAttachType != 5 ? 72 : 65) + (this.hasLinkPreview ? 20 : 0)), AndroidUtilities.dp(30.0f));
}
}
private int createDocumentLayout(int i, MessageObject messageObject) {
int i2;
int i3 = i;
if (messageObject.type == 0) {
this.documentAttach = MessageObject.getMedia(messageObject.messageOwner).webpage.document;
} else {
this.documentAttach = messageObject.getDocument();
}
TLRPC$Document tLRPC$Document = this.documentAttach;
int i4 = 0;
if (tLRPC$Document == null) {
return 0;
}
double d = 0.0d;
if (MessageObject.isVoiceDocument(tLRPC$Document)) {
this.documentAttachType = 3;
int i5 = 0;
while (true) {
if (i5 >= this.documentAttach.attributes.size()) {
break;
}
TLRPC$DocumentAttribute tLRPC$DocumentAttribute = this.documentAttach.attributes.get(i5);
if (tLRPC$DocumentAttribute instanceof TLRPC$TL_documentAttributeAudio) {
d = tLRPC$DocumentAttribute.duration;
break;
}
i5++;
}
this.widthBeforeNewTimeLine = (i3 - AndroidUtilities.dp(94.0f)) - ((int) Math.ceil(Theme.chat_audioTimePaint.measureText("00:00")));
this.availableTimeWidth = i3 - AndroidUtilities.dp(18.0f);
measureTime(messageObject);
int dp = AndroidUtilities.dp(174.0f) + this.timeWidth;
if (!this.hasLinkPreview) {
this.backgroundWidth = Math.min(i3, dp + ((int) Math.ceil(Theme.chat_audioTimePaint.measureText(AndroidUtilities.formatLongDuration((int) d)))));
}
this.seekBarWaveform.setMessageObject(messageObject);
return 0;
}
if (MessageObject.isVideoDocument(this.documentAttach)) {
this.documentAttachType = 4;
if (!messageObject.needDrawBluredPreview()) {
updatePlayingMessageProgress();
String format = String.format("%s", AndroidUtilities.formatFileSize(this.documentAttach.size));
this.docTitleWidth = (int) Math.ceil(Theme.chat_infoPaint.measureText(format));
this.docTitleLayout = new StaticLayout(format, Theme.chat_infoPaint, this.docTitleWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
}
return 0;
}
if (MessageObject.isMusicDocument(this.documentAttach)) {
this.documentAttachType = 5;
int dp2 = i3 - AndroidUtilities.dp(92.0f);
if (dp2 < 0) {
dp2 = AndroidUtilities.dp(100.0f);
}
int i6 = dp2;
StaticLayout staticLayout = new StaticLayout(TextUtils.ellipsize(messageObject.getMusicTitle().replace('\n', ' '), Theme.chat_audioTitlePaint, i6 - AndroidUtilities.dp(12.0f), TextUtils.TruncateAt.END), Theme.chat_audioTitlePaint, i6, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.songLayout = staticLayout;
if (staticLayout.getLineCount() > 0) {
this.songX = -((int) Math.ceil(this.songLayout.getLineLeft(0)));
}
StaticLayout staticLayout2 = new StaticLayout(TextUtils.ellipsize(messageObject.getMusicAuthor().replace('\n', ' '), Theme.chat_audioPerformerPaint, i6, TextUtils.TruncateAt.END), Theme.chat_audioPerformerPaint, i6, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.performerLayout = staticLayout2;
if (staticLayout2.getLineCount() > 0) {
this.performerX = -((int) Math.ceil(this.performerLayout.getLineLeft(0)));
}
while (true) {
if (i4 >= this.documentAttach.attributes.size()) {
break;
}
TLRPC$DocumentAttribute tLRPC$DocumentAttribute2 = this.documentAttach.attributes.get(i4);
if (tLRPC$DocumentAttribute2 instanceof TLRPC$TL_documentAttributeAudio) {
d = tLRPC$DocumentAttribute2.duration;
break;
}
i4++;
}
int i7 = (int) d;
int ceil = (int) Math.ceil(Theme.chat_audioTimePaint.measureText(AndroidUtilities.formatShortDuration(i7, i7)));
this.widthBeforeNewTimeLine = (this.backgroundWidth - AndroidUtilities.dp(86.0f)) - ceil;
this.availableTimeWidth = this.backgroundWidth - AndroidUtilities.dp(28.0f);
return ceil;
}
if (MessageObject.isGifDocument(this.documentAttach, messageObject.hasValidGroupId())) {
this.documentAttachType = 2;
if (!messageObject.needDrawBluredPreview()) {
String string = LocaleController.getString("AttachGif", org.telegram.messenger.R.string.AttachGif);
this.infoWidth = (int) Math.ceil(Theme.chat_infoPaint.measureText(string));
this.infoLayout = new StaticLayout(string, Theme.chat_infoPaint, this.infoWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
String format2 = String.format("%s", AndroidUtilities.formatFileSize(this.documentAttach.size));
this.docTitleWidth = (int) Math.ceil(Theme.chat_infoPaint.measureText(format2));
this.docTitleLayout = new StaticLayout(format2, Theme.chat_infoPaint, this.docTitleWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
}
return 0;
}
String str = this.documentAttach.mime_type;
boolean z = (str != null && (str.toLowerCase().startsWith("image/") || this.documentAttach.mime_type.toLowerCase().startsWith("video/mp4"))) || MessageObject.isDocumentHasThumb(this.documentAttach);
this.drawPhotoImage = z;
if (!z) {
i3 += AndroidUtilities.dp(30.0f);
}
this.documentAttachType = 1;
String documentFileName = FileLoader.getDocumentFileName(this.documentAttach);
if (documentFileName.length() == 0) {
documentFileName = LocaleController.getString("AttachDocument", org.telegram.messenger.R.string.AttachDocument);
}
StaticLayout createStaticLayout = StaticLayoutEx.createStaticLayout(documentFileName, Theme.chat_docNamePaint, i3, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false, TextUtils.TruncateAt.MIDDLE, i3, 2, false);
this.docTitleLayout = createStaticLayout;
this.docTitleOffsetX = Integer.MIN_VALUE;
if (createStaticLayout != null && createStaticLayout.getLineCount() > 0) {
int i8 = 0;
while (i4 < this.docTitleLayout.getLineCount()) {
i8 = Math.max(i8, (int) Math.ceil(this.docTitleLayout.getLineWidth(i4)));
this.docTitleOffsetX = Math.max(this.docTitleOffsetX, (int) Math.ceil(-this.docTitleLayout.getLineLeft(i4)));
i4++;
}
i2 = Math.min(i3, i8);
} else {
this.docTitleOffsetX = 0;
i2 = i3;
}
String str2 = AndroidUtilities.formatFileSize(this.documentAttach.size) + " " + FileLoader.getDocumentExtension(this.documentAttach);
int dp3 = i3 - AndroidUtilities.dp(30.0f);
TextPaint textPaint = Theme.chat_infoPaint;
int min = Math.min(dp3, (int) Math.ceil(textPaint.measureText("000.0 mm / " + AndroidUtilities.formatFileSize(this.documentAttach.size))));
this.infoWidth = min;
CharSequence ellipsize = TextUtils.ellipsize(str2, Theme.chat_infoPaint, (float) min, TextUtils.TruncateAt.END);
try {
if (this.infoWidth < 0) {
this.infoWidth = AndroidUtilities.dp(10.0f);
}
this.infoLayout = new StaticLayout(ellipsize, Theme.chat_infoPaint, this.infoWidth + AndroidUtilities.dp(6.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
} catch (Exception e) {
FileLog.e(e);
}
if (this.drawPhotoImage) {
this.currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 320);
this.currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 40);
if ((DownloadController.getInstance(this.currentAccount).getAutodownloadMask() & 1) == 0) {
this.currentPhotoObject = null;
}
TLRPC$PhotoSize tLRPC$PhotoSize = this.currentPhotoObject;
if (tLRPC$PhotoSize == null || tLRPC$PhotoSize == this.currentPhotoObjectThumb) {
this.currentPhotoObject = null;
this.photoImage.setNeedsQualityThumb(true);
this.photoImage.setShouldGenerateQualityThumb(true);
} else {
BitmapDrawable bitmapDrawable = this.currentMessageObject.strippedThumb;
if (bitmapDrawable != null) {
this.currentPhotoObjectThumb = null;
this.currentPhotoObjectThumbStripped = bitmapDrawable;
}
}
this.currentPhotoFilter = "86_86_b";
this.photoImage.setImage(ImageLocation.getForObject(this.currentPhotoObject, messageObject.photoThumbsObject), "86_86", ImageLocation.getForObject(this.currentPhotoObjectThumb, messageObject.photoThumbsObject), this.currentPhotoFilter, this.currentPhotoObjectThumbStripped, 0L, null, messageObject, 1);
}
return i2;
}
private void calcBackgroundWidth(int i, int i2, int i3) {
if (this.currentMessageObject.isSponsored()) {
this.backgroundWidth = i3 + AndroidUtilities.dp(31.0f);
return;
}
ReactionsLayoutInBubble reactionsLayoutInBubble = this.reactionsLayoutInBubble;
boolean z = reactionsLayoutInBubble.isEmpty;
int i4 = (z || reactionsLayoutInBubble.isSmall) ? this.currentMessageObject.lastLineWidth : reactionsLayoutInBubble.lastLineX;
if (!z && !reactionsLayoutInBubble.isSmall) {
r4 = i - i4 < i2 || this.currentMessageObject.hasRtl;
if (this.hasInvoicePreview) {
this.totalHeight += AndroidUtilities.dp(14.0f);
}
} else if ((!this.linkPreviewAbove && ((this.hasLinkPreview && !this.currentMessageObject.isSponsored()) || this.hasOldCaptionPreview || this.hasGamePreview || this.hasInvoicePreview)) || i - i4 < i2 || this.currentMessageObject.hasRtl) {
r4 = true;
}
int i5 = 14;
MessageObject messageObject = this.currentMessageObject;
if (messageObject.hasCodeAtBottom) {
ReactionsLayoutInBubble reactionsLayoutInBubble2 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble2.isEmpty) {
}
i5 = 18;
r4 = true;
if (!r4) {
this.totalHeight += AndroidUtilities.dp(i5);
this.hasNewLineForTime = true;
int max = Math.max(i3, i4) + AndroidUtilities.dp(31.0f);
this.backgroundWidth = max;
this.backgroundWidth = Math.max(max, (this.currentMessageObject.isOutOwner() ? this.timeWidth + AndroidUtilities.dp(17.0f) : this.timeWidth) + AndroidUtilities.dp(31.0f));
return;
}
int extraTextX = (i3 - getExtraTextX()) - i4;
if (extraTextX >= 0 && extraTextX <= i2) {
this.backgroundWidth = ((i3 + i2) - extraTextX) + AndroidUtilities.dp(31.0f);
return;
} else {
this.backgroundWidth = Math.max(i3, i4 + i2) + AndroidUtilities.dp(31.0f);
return;
}
}
if (messageObject.hasQuoteAtBottom) {
ReactionsLayoutInBubble reactionsLayoutInBubble3 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble3.isEmpty) {
}
i5 = 18;
r4 = true;
if (!r4) {
}
}
}
public boolean setHighlightedText(String str) {
return setHighlightedText(str, false, -1);
}
public boolean setHighlightedText(String str, boolean z, int i) {
String str2;
String str3;
int i2;
int i3;
int i4 = 0;
if (this.highlightedQuote && !z && TextUtils.isEmpty(str)) {
return false;
}
MessageObject messageObject = this.messageObjectToSet;
if (messageObject == null) {
messageObject = this.currentMessageObject;
}
this.highlightedQuote = z;
if (messageObject == null || TextUtils.isEmpty(str)) {
if (!this.urlPathSelection.isEmpty()) {
this.linkSelectionBlockNum = -1;
this.highlightedQuote = false;
resetUrlPaths();
invalidate();
}
return false;
}
if (!z) {
this.quoteHighlight = null;
}
CharSequence charSequence = this.currentCaption;
if (charSequence != null) {
str2 = charSequence.toString();
} else {
str2 = messageObject.messageOwner.message;
}
if (str2 == null || TextUtils.isEmpty(str2)) {
if (this.urlPathSelection.isEmpty()) {
return false;
}
this.linkSelectionBlockNum = -1;
this.highlightedQuote = false;
resetUrlPaths();
invalidate();
return false;
}
if (z) {
str3 = str;
} else {
str3 = str.toLowerCase();
str2 = str2.toLowerCase();
}
if (z) {
int findQuoteStart = MessageObject.findQuoteStart(str2, str3, i);
i2 = str3.length();
i3 = findQuoteStart;
} else {
int length = str2.length();
int i5 = 0;
i2 = -1;
int i6 = -1;
while (i5 < length) {
int min = Math.min(str3.length(), length - i5);
int i7 = i4;
int i8 = i7;
while (i7 < min) {
boolean z2 = str2.charAt(i5 + i7) == str3.charAt(i7);
if (z2) {
if (i8 != 0 || i5 == 0 || " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\n".indexOf(str2.charAt(i5 - 1)) >= 0) {
i8++;
} else {
z2 = false;
}
}
if (!z2 || i7 == min - 1) {
if (i8 > 0 && i8 > i2) {
i6 = i5;
i2 = i8;
}
i5++;
i4 = 0;
} else {
i7++;
}
}
i5++;
i4 = 0;
}
i3 = i6;
}
if (i3 == -1) {
if (this.urlPathSelection.isEmpty()) {
return false;
}
this.linkSelectionBlockNum = -1;
this.highlightedQuote = false;
resetUrlPaths();
invalidate();
return false;
}
if (!z) {
int length2 = str2.length();
for (int i9 = i3 + i2; i9 < length2 && " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\n".indexOf(str2.charAt(i9)) < 0; i9++) {
i2++;
}
}
this.highlightedQuote = z;
int i10 = i3 + i2;
if (z && this.currentMessagesGroup == null && this.groupedMessagesToSet == null) {
QuoteHighlight quoteHighlight = this.quoteHighlight;
if (quoteHighlight != null && quoteHighlight.id == messageObject.getId()) {
QuoteHighlight quoteHighlight2 = this.quoteHighlight;
if (quoteHighlight2.start == i3 && quoteHighlight2.end == i10) {
return true;
}
}
if (this.captionLayout != null) {
ViewParent parent = getParent();
int id = messageObject.getId();
MessageObject.TextLayoutBlocks textLayoutBlocks = this.captionLayout;
this.quoteHighlight = new QuoteHighlight(this, parent, id, textLayoutBlocks.textLayoutBlocks, i3, i10, textLayoutBlocks.textXOffset);
return true;
}
this.quoteHighlight = new QuoteHighlight(this, getParent(), messageObject.getId(), messageObject.textLayoutBlocks, i3, i10, messageObject.textXOffset);
return true;
}
if (!TextUtils.isEmpty(this.currentCaption)) {
MessageObject.TextLayoutBlocks textLayoutBlocks2 = this.captionLayout;
if (textLayoutBlocks2 == null) {
this.highlightCaptionToSetStart = i3;
this.highlightCaptionToSetEnd = i10;
return true;
}
highlight(i3, i10, textLayoutBlocks2.textLayoutBlocks);
return true;
}
ArrayList<MessageObject.TextLayoutBlock> arrayList = messageObject.textLayoutBlocks;
if (arrayList == null) {
return true;
}
highlight(i3, i10, arrayList);
return true;
}
private void highlight(int i, int i2, ArrayList<MessageObject.TextLayoutBlock> arrayList) {
if (arrayList == null) {
return;
}
int i3 = i2 - i;
int i4 = 0;
while (true) {
if (i4 >= arrayList.size()) {
break;
}
MessageObject.TextLayoutBlock textLayoutBlock = arrayList.get(i4);
if (i < textLayoutBlock.charactersOffset || i >= textLayoutBlock.charactersEnd) {
i4++;
} else {
this.linkSelectionBlockNum = i4;
resetUrlPaths();
try {
LinkPath obtainNewUrlPath = obtainNewUrlPath();
obtainNewUrlPath.setCurrentLayout(textLayoutBlock.textLayout, i, 0.0f);
textLayoutBlock.textLayout.getSelectionPath(i, i2, obtainNewUrlPath);
float f = textLayoutBlock.height + textLayoutBlock.padBottom;
if (i2 >= textLayoutBlock.charactersOffset + i3) {
for (int i5 = i4 + 1; i5 < arrayList.size(); i5++) {
MessageObject.TextLayoutBlock textLayoutBlock2 = arrayList.get(i5);
int i6 = textLayoutBlock2.charactersEnd - textLayoutBlock2.charactersOffset;
LinkPath obtainNewUrlPath2 = obtainNewUrlPath();
float f2 = f + textLayoutBlock2.padTop;
obtainNewUrlPath2.setCurrentLayout(textLayoutBlock2.textLayout, 0, f2);
f = f2 + textLayoutBlock2.height + textLayoutBlock2.padBottom;
textLayoutBlock2.textLayout.getSelectionPath(0, i2 - textLayoutBlock2.charactersOffset, obtainNewUrlPath2);
if (i2 < (textLayoutBlock.charactersOffset + i6) - 1) {
break;
}
}
}
if (this.highlightedQuote) {
this.isHighlightedAnimated = true;
this.highlightProgress = 2500;
}
} catch (Exception e) {
FileLog.e(e);
}
invalidate();
}
}
this.highlightCaptionToSetStart = -1;
this.highlightCaptionToSetEnd = -1;
}
public boolean setHighlightedSpan(CharacterStyle characterStyle) {
int i;
int i2;
int i3;
int i4;
MessageObject messageObject = this.messageObjectToSet;
if (messageObject == null) {
messageObject = this.currentMessageObject;
}
this.highlightedQuote = false;
if (messageObject == null || messageObject.messageOwner.message == null || characterStyle == null) {
if (!this.urlPathSelection.isEmpty()) {
this.linkSelectionBlockNum = -1;
this.highlightedQuote = false;
resetUrlPaths();
invalidate();
}
return false;
}
if (this.captionLayout != null && !TextUtils.isEmpty(messageObject.caption)) {
CharSequence charSequence = messageObject.caption;
if (charSequence instanceof Spannable) {
Spanned spanned = (Spanned) charSequence;
CharacterStyle[] characterStyleArr = (CharacterStyle[]) spanned.getSpans(0, spanned.length(), CharacterStyle.class);
if (characterStyleArr != null && characterStyleArr.length > 0) {
for (CharacterStyle characterStyle2 : characterStyleArr) {
if (characterStyle2 == characterStyle) {
i4 = spanned.getSpanStart(characterStyle);
i3 = spanned.getSpanEnd(characterStyle);
break;
}
}
}
i3 = -1;
i4 = -1;
if (i4 >= 0 && i3 >= 0) {
int i5 = i3 - i4;
for (int i6 = 0; i6 < this.captionLayout.textLayoutBlocks.size(); i6++) {
MessageObject.TextLayoutBlock textLayoutBlock = this.captionLayout.textLayoutBlocks.get(i6);
if (i4 >= textLayoutBlock.charactersOffset && i4 < textLayoutBlock.charactersEnd) {
this.linkSelectionBlockNum = i6;
this.highlightedQuote = false;
resetUrlPaths();
try {
LinkPath obtainNewUrlPath = obtainNewUrlPath();
obtainNewUrlPath.setCurrentLayout(textLayoutBlock.textLayout, i4, 0.0f);
textLayoutBlock.textLayout.getSelectionPath(i4, i3, obtainNewUrlPath);
if (i3 >= textLayoutBlock.charactersOffset + i5) {
for (int i7 = i6 + 1; i7 < this.captionLayout.textLayoutBlocks.size(); i7++) {
MessageObject.TextLayoutBlock textLayoutBlock2 = this.captionLayout.textLayoutBlocks.get(i7);
int i8 = textLayoutBlock2.charactersEnd - textLayoutBlock2.charactersOffset;
LinkPath obtainNewUrlPath2 = obtainNewUrlPath();
obtainNewUrlPath2.setCurrentLayout(textLayoutBlock2.textLayout, 0, textLayoutBlock2.height);
textLayoutBlock2.textLayout.getSelectionPath(0, i3 - textLayoutBlock2.charactersOffset, obtainNewUrlPath2);
if (i3 < (textLayoutBlock.charactersOffset + i8) - 1) {
break;
}
}
}
} catch (Exception e) {
FileLog.e(e);
}
invalidate();
return true;
}
}
}
}
}
CharSequence charSequence2 = messageObject.messageText;
if ((charSequence2 instanceof Spanned) && messageObject.textLayoutBlocks != null) {
Spanned spanned2 = (Spanned) charSequence2;
CharacterStyle[] characterStyleArr2 = (CharacterStyle[]) spanned2.getSpans(0, spanned2.length(), CharacterStyle.class);
if (characterStyleArr2 != null && characterStyleArr2.length > 0) {
for (CharacterStyle characterStyle3 : characterStyleArr2) {
if (characterStyle3 == characterStyle) {
i2 = spanned2.getSpanStart(characterStyle);
i = spanned2.getSpanEnd(characterStyle);
break;
}
}
}
i = -1;
i2 = -1;
if (i2 >= 0 && i >= 0) {
int i9 = i - i2;
for (int i10 = 0; i10 < messageObject.textLayoutBlocks.size(); i10++) {
MessageObject.TextLayoutBlock textLayoutBlock3 = messageObject.textLayoutBlocks.get(i10);
if (i2 >= textLayoutBlock3.charactersOffset && i2 < textLayoutBlock3.charactersEnd) {
this.linkSelectionBlockNum = i10;
this.highlightedQuote = false;
resetUrlPaths();
try {
LinkPath obtainNewUrlPath3 = obtainNewUrlPath();
obtainNewUrlPath3.setCurrentLayout(textLayoutBlock3.textLayout, i2, 0.0f);
textLayoutBlock3.textLayout.getSelectionPath(i2, i, obtainNewUrlPath3);
if (i >= textLayoutBlock3.charactersOffset + i9) {
for (int i11 = i10 + 1; i11 < messageObject.textLayoutBlocks.size(); i11++) {
MessageObject.TextLayoutBlock textLayoutBlock4 = messageObject.textLayoutBlocks.get(i11);
int i12 = textLayoutBlock4.charactersEnd - textLayoutBlock4.charactersOffset;
LinkPath obtainNewUrlPath4 = obtainNewUrlPath();
obtainNewUrlPath4.setCurrentLayout(textLayoutBlock4.textLayout, 0, textLayoutBlock4.height);
textLayoutBlock4.textLayout.getSelectionPath(0, i - textLayoutBlock4.charactersOffset, obtainNewUrlPath4);
if (i < (textLayoutBlock3.charactersOffset + i12) - 1) {
break;
}
}
}
} catch (Exception e2) {
FileLog.e(e2);
}
invalidate();
return true;
}
}
}
}
if (!this.urlPathSelection.isEmpty()) {
this.linkSelectionBlockNum = -1;
this.highlightedQuote = false;
resetUrlPaths();
invalidate();
}
return false;
}
@Override
protected boolean verifyDrawable(Drawable drawable) {
if (!super.verifyDrawable(drawable)) {
Drawable[] drawableArr = this.selectorDrawable;
if (drawable != drawableArr[0] && drawable != drawableArr[1] && drawable != this.linkPreviewSelector && drawable != this.nameLayoutSelector && drawable != this.replySelector) {
return false;
}
}
return true;
}
@Override
public void invalidateDrawable(Drawable drawable) {
super.invalidateDrawable(drawable);
if (this.currentMessagesGroup != null) {
invalidateWithParent();
}
}
private boolean isCurrentLocationTimeExpired(MessageObject messageObject) {
return MessageObject.getMedia(this.currentMessageObject.messageOwner).period % 60 == 0 ? Math.abs(ConnectionsManager.getInstance(this.currentAccount).getCurrentTime() - messageObject.messageOwner.date) > MessageObject.getMedia(messageObject.messageOwner).period : Math.abs(ConnectionsManager.getInstance(this.currentAccount).getCurrentTime() - messageObject.messageOwner.date) > MessageObject.getMedia(messageObject.messageOwner).period + (-5);
}
public void checkLocationExpired() {
boolean isCurrentLocationTimeExpired;
MessageObject messageObject = this.currentMessageObject;
if (messageObject == null || (isCurrentLocationTimeExpired = isCurrentLocationTimeExpired(messageObject)) == this.locationExpired) {
return;
}
this.locationExpired = isCurrentLocationTimeExpired;
if (!isCurrentLocationTimeExpired) {
AndroidUtilities.runOnUIThread(this.invalidateRunnable, 1000L);
this.scheduledInvalidate = true;
int dp = this.backgroundWidth - AndroidUtilities.dp(91.0f);
this.docTitleLayout = new StaticLayout(TextUtils.ellipsize(LocaleController.getString("AttachLiveLocation", org.telegram.messenger.R.string.AttachLiveLocation), Theme.chat_locationTitlePaint, dp, TextUtils.TruncateAt.END), Theme.chat_locationTitlePaint, dp, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
return;
}
MessageObject messageObject2 = this.currentMessageObject;
this.currentMessageObject = null;
setMessageObject(messageObject2, this.currentMessagesGroup, this.pinnedBottom, this.pinnedTop);
}
public void setIsUpdating(boolean z) {
this.isUpdating = true;
}
public void setMessageObject(MessageObject messageObject, MessageObject.GroupedMessages groupedMessages, boolean z, boolean z2) {
if (this.attachedToWindow && !this.frozen) {
setMessageContent(messageObject, groupedMessages, z, z2);
return;
}
this.messageObjectToSet = messageObject;
this.groupedMessagesToSet = groupedMessages;
this.bottomNearToSet = z;
this.topNearToSet = z2;
}
private int getAdditionalWidthForPosition(MessageObject.GroupedMessagePosition groupedMessagePosition) {
if (groupedMessagePosition == null) {
return 0;
}
int dp = (groupedMessagePosition.flags & 2) == 0 ? 0 + AndroidUtilities.dp(4.0f) : 0;
return (groupedMessagePosition.flags & 1) == 0 ? dp + AndroidUtilities.dp(4.0f) : dp;
}
public void createSelectorDrawable(final int i) {
int themedColor;
if (Build.VERSION.SDK_INT < 21) {
return;
}
if (this.psaHintPressed) {
themedColor = getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outViews : Theme.key_chat_inViews);
} else {
ReplyMessageLine replyMessageLine = this.linkLine;
if (replyMessageLine != null) {
themedColor = replyMessageLine.getColor();
} else {
ReplyMessageLine replyMessageLine2 = this.contactLine;
if (replyMessageLine2 != null) {
themedColor = replyMessageLine2.getColor();
} else {
themedColor = getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outPreviewInstantText : Theme.key_chat_inPreviewInstantText);
}
}
}
Drawable[] drawableArr = this.selectorDrawable;
if (drawableArr[i] == null) {
final Paint paint = new Paint(1);
paint.setColor(-1);
Drawable drawable = new Drawable() {
RectF rect = new RectF();
Path path = new Path();
@Override
public int getOpacity() {
return -2;
}
@Override
public void setAlpha(int i2) {
}
@Override
public void setColorFilter(ColorFilter colorFilter) {
}
@Override
public void draw(Canvas canvas) {
Rect bounds = getBounds();
this.rect.set(bounds.left, bounds.top, bounds.right, bounds.bottom);
if (ChatMessageCell.this.selectorDrawableMaskType[i] != 3 && ChatMessageCell.this.selectorDrawableMaskType[i] != 4) {
if (ChatMessageCell.this.selectorDrawableMaskType[i] != 2) {
canvas.drawRoundRect(this.rect, ChatMessageCell.this.selectorDrawableMaskType[i] == 0 ? AndroidUtilities.dp(6.0f) : 0.0f, ChatMessageCell.this.selectorDrawableMaskType[i] == 0 ? AndroidUtilities.dp(6.0f) : 0.0f, paint);
return;
}
this.path.reset();
boolean z = ChatMessageCell.this.currentMessageObject != null && ChatMessageCell.this.currentMessageObject.isOutOwner();
for (int i2 = 0; i2 < 4; i2++) {
if (!ChatMessageCell.this.instantTextNewLine) {
if (i2 == 2 && !z) {
float[] fArr = ChatMessageCell.radii;
int i3 = i2 * 2;
float dp = AndroidUtilities.dp(SharedConfig.bubbleRadius);
ChatMessageCell.radii[i3 + 1] = dp;
fArr[i3] = dp;
} else if (i2 != 3 || !z) {
if ((ChatMessageCell.this.mediaBackground || ChatMessageCell.this.pinnedBottom) && (i2 == 2 || i2 == 3)) {
float[] fArr2 = ChatMessageCell.radii;
int i4 = i2 * 2;
float[] fArr3 = ChatMessageCell.radii;
int i5 = i4 + 1;
float dp2 = AndroidUtilities.dp(ChatMessageCell.this.pinnedBottom ? Math.min(5, SharedConfig.bubbleRadius) : SharedConfig.bubbleRadius);
fArr3[i5] = dp2;
fArr2[i4] = dp2;
}
} else {
float[] fArr4 = ChatMessageCell.radii;
int i6 = i2 * 2;
float dp3 = AndroidUtilities.dp(SharedConfig.bubbleRadius);
ChatMessageCell.radii[i6 + 1] = dp3;
fArr4[i6] = dp3;
}
}
float[] fArr5 = ChatMessageCell.radii;
int i7 = i2 * 2;
ChatMessageCell.radii[i7 + 1] = 0.0f;
fArr5[i7] = 0.0f;
}
if (!z) {
ChatMessageCell chatMessageCell = ChatMessageCell.this;
if (!chatMessageCell.drawPinnedBottom && chatMessageCell.currentPosition == null && (ChatMessageCell.this.currentMessageObject == null || ChatMessageCell.this.currentMessageObject.type != 17 || ChatMessageCell.this.pollInstantViewTouchesBottom)) {
this.path.moveTo(this.rect.left + AndroidUtilities.dp(6.0f), this.rect.top);
this.path.lineTo(this.rect.left + AndroidUtilities.dp(6.0f), (this.rect.bottom - AndroidUtilities.dp(6.0f)) - AndroidUtilities.dp(5.0f));
RectF rectF = AndroidUtilities.rectTmp;
rectF.set(this.rect.left + AndroidUtilities.dp(-7.0f), this.rect.bottom - AndroidUtilities.dp(23.0f), this.rect.left + AndroidUtilities.dp(6.0f), this.rect.bottom);
this.path.arcTo(rectF, 0.0f, 83.0f, false);
float f = this.rect.right - (ChatMessageCell.radii[4] * 2.0f);
float f2 = this.rect.bottom - (ChatMessageCell.radii[5] * 2.0f);
RectF rectF2 = this.rect;
rectF.set(f, f2, rectF2.right, rectF2.bottom);
this.path.arcTo(rectF, 90.0f, -90.0f, false);
Path path = this.path;
RectF rectF3 = this.rect;
path.lineTo(rectF3.right, rectF3.top);
this.path.close();
this.path.close();
canvas.drawPath(this.path, paint);
return;
}
}
this.path.addRoundRect(this.rect, ChatMessageCell.radii, Path.Direction.CW);
this.path.close();
canvas.drawPath(this.path, paint);
return;
}
canvas.drawCircle(this.rect.centerX(), this.rect.centerY(), AndroidUtilities.dp(ChatMessageCell.this.selectorDrawableMaskType[i] == 3 ? 16.0f : 20.0f), paint);
}
};
int[][] iArr = {StateSet.WILD_CARD};
int[] iArr2 = new int[1];
iArr2[0] = 436207615 & getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outPreviewInstantText : Theme.key_chat_inPreviewInstantText);
this.selectorDrawable[i] = new RippleDrawable(new ColorStateList(iArr, iArr2), null, drawable);
this.selectorDrawable[i].setCallback(this);
} else {
Theme.setSelectorDrawableColor(drawableArr[i], themedColor & 436207615, true);
}
this.selectorDrawable[i].setVisible(true, false);
}
private void createInstantViewButton() {
int measureText;
if (Build.VERSION.SDK_INT >= 21 && this.drawInstantView) {
createSelectorDrawable(0);
}
if (this.drawInstantView && this.instantViewLayout == null) {
this.instantWidth = AndroidUtilities.dp(33.0f);
String str = this.instantViewButtonText;
if (str == null) {
int i = this.drawInstantViewType;
if (i == 12) {
str = LocaleController.getString("OpenChannelPost", org.telegram.messenger.R.string.OpenChannelPost);
} else if (i == 1) {
str = LocaleController.getString("OpenChannel", org.telegram.messenger.R.string.OpenChannel);
} else if (i == 13) {
str = LocaleController.getString("SendMessage", org.telegram.messenger.R.string.SendMessage).toUpperCase();
} else if (i == 10) {
str = LocaleController.getString("OpenBot", org.telegram.messenger.R.string.OpenBot);
} else if (i == 2) {
str = LocaleController.getString("OpenGroup", org.telegram.messenger.R.string.OpenGroup);
} else if (i == 3) {
str = LocaleController.getString("OpenMessage", org.telegram.messenger.R.string.OpenMessage);
} else if (i == 5) {
str = LocaleController.getString("ViewContact", org.telegram.messenger.R.string.ViewContact);
} else if (i == 6) {
str = LocaleController.getString("OpenBackground", org.telegram.messenger.R.string.OpenBackground);
} else if (i == 7) {
str = LocaleController.getString("OpenTheme", org.telegram.messenger.R.string.OpenTheme);
} else if (i == 8) {
if (this.pollVoted || this.pollClosed) {
str = LocaleController.getString("PollViewResults", org.telegram.messenger.R.string.PollViewResults);
} else {
str = LocaleController.getString("PollSubmitVotes", org.telegram.messenger.R.string.PollSubmitVotes);
}
} else if (i == 9 || i == 11) {
TLRPC$TL_webPage tLRPC$TL_webPage = (TLRPC$TL_webPage) MessageObject.getMedia(this.currentMessageObject.messageOwner).webpage;
if (tLRPC$TL_webPage != null && tLRPC$TL_webPage.url.contains("voicechat=")) {
str = LocaleController.getString("VoipGroupJoinAsSpeaker", org.telegram.messenger.R.string.VoipGroupJoinAsSpeaker);
} else {
str = LocaleController.getString("VoipGroupJoinAsLinstener", org.telegram.messenger.R.string.VoipGroupJoinAsLinstener);
}
} else if (i == 14) {
str = LocaleController.getString("ViewChatList", org.telegram.messenger.R.string.ViewChatList).toUpperCase();
} else if (i == 15) {
str = LocaleController.getString(org.telegram.messenger.R.string.BotWebAppInstantViewOpen).toUpperCase();
} else if (i == 16) {
str = LocaleController.getString("OpenLink").toUpperCase();
} else if (i == 17) {
str = LocaleController.getString("ViewStory").toUpperCase();
} else if (i == 18) {
str = LocaleController.getString("BoostLinkButton", org.telegram.messenger.R.string.BoostLinkButton);
} else if (i == 19) {
str = LocaleController.getString("BoostingHowItWork", org.telegram.messenger.R.string.BoostingHowItWork);
} else if (i == 20) {
str = LocaleController.getString(org.telegram.messenger.R.string.OpenGift);
} else {
str = LocaleController.getString(org.telegram.messenger.R.string.InstantView);
}
}
if (this.currentMessageObject.isSponsored() && this.backgroundWidth < (measureText = (int) (Theme.chat_instantViewPaint.measureText(str) + AndroidUtilities.dp(75.0f)))) {
this.backgroundWidth = measureText;
}
int dp = this.backgroundWidth - AndroidUtilities.dp(75.0f);
StaticLayout staticLayout = new StaticLayout(TextUtils.ellipsize(str, Theme.chat_instantViewPaint, dp, TextUtils.TruncateAt.END), Theme.chat_instantViewPaint, dp + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.instantViewLayout = staticLayout;
this.instantViewLayoutWidth = staticLayout.getLineCount() > 0 ? this.instantViewLayout.getLineWidth(0) : 0.0f;
this.instantViewLayoutLeft = this.instantViewLayout.getLineCount() > 0 ? this.instantViewLayout.getLineLeft(0) : 0.0f;
this.instantWidth = this.backgroundWidth - AndroidUtilities.dp(this.drawInstantViewType == 8 ? 13.0f : 34.0f);
int dp2 = this.totalHeight + AndroidUtilities.dp(46.0f);
this.totalHeight = dp2;
if (this.currentMessageObject.type == 12) {
this.totalHeight = dp2 + AndroidUtilities.dp(14.0f);
}
if (this.currentMessageObject.isSponsored()) {
this.totalHeight += AndroidUtilities.dp(2.0f);
}
StaticLayout staticLayout2 = this.instantViewLayout;
if (staticLayout2 == null || staticLayout2.getLineCount() <= 0) {
return;
}
this.instantTextX = (((int) (this.instantWidth - Math.ceil(this.instantViewLayout.getLineWidth(0)))) / 2) + (this.drawInstantViewType == 0 ? AndroidUtilities.dp(8.0f) : 0);
int lineLeft = (int) this.instantViewLayout.getLineLeft(0);
this.instantTextLeftX = lineLeft;
this.instantTextX += -lineLeft;
}
}
private void createContactButtons() {
int i;
boolean z;
if (Build.VERSION.SDK_INT >= 21) {
createSelectorDrawable(0);
}
if (this.drawContact) {
boolean z2 = this.drawContactView;
if (this.drawContactSendMessage) {
boolean z3 = (z2 ? 1 : 0) | 2;
i = (z2 ? 1 : 0) + 1;
z = z3;
} else {
i = z2 ? 1 : 0;
z = z2;
}
boolean z4 = z;
if (this.drawContactAdd) {
i++;
z4 = (z ? 1 : 0) | 4;
}
if (i == 0) {
this.contactButtons = null;
this.drawnContactButtonsFlag = 0;
return;
}
this.totalHeight += AndroidUtilities.dp(60.0f);
if (z4 != this.drawnContactButtonsFlag) {
this.drawnContactButtonsFlag = 0;
int dp = (this.backgroundWidth - AndroidUtilities.dp(75.0f)) / i;
float dpf2 = (this.backgroundWidth - AndroidUtilities.dpf2(37.0f)) / i;
ArrayList<InstantViewButton> arrayList = this.contactButtons;
if (arrayList == null) {
this.contactButtons = new ArrayList<>(i);
} else {
arrayList.clear();
}
if (this.drawContactView) {
this.drawnContactButtonsFlag = 1 | this.drawnContactButtonsFlag;
this.contactButtons.add(createInstantViewButton(5, LocaleController.getString("ViewContact", org.telegram.messenger.R.string.ViewContact), dp, dpf2));
}
if (this.drawContactSendMessage) {
this.drawnContactButtonsFlag |= 2;
this.contactButtons.add(createInstantViewButton(30, LocaleController.getString("SharedContactMessage", org.telegram.messenger.R.string.SharedContactMessage), dp, dpf2));
}
if (this.drawContactAdd) {
this.drawnContactButtonsFlag |= 4;
this.contactButtons.add(createInstantViewButton(31, LocaleController.getString("SharedContactAdd", org.telegram.messenger.R.string.SharedContactAdd), dp, dpf2));
}
}
}
}
private InstantViewButton createInstantViewButton(int i, String str, int i2, float f) {
InstantViewButton instantViewButton = new InstantViewButton();
instantViewButton.type = i;
instantViewButton.layout = new StaticLayout(TextUtils.ellipsize(str, Theme.chat_instantViewPaint, i2, TextUtils.TruncateAt.END), Theme.chat_instantViewPaint, i2 + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
instantViewButton.buttonWidth = f;
if (instantViewButton.layout.getLineCount() > 0) {
instantViewButton.textX = ((float) (instantViewButton.buttonWidth - Math.ceil(instantViewButton.layout.getLineWidth(0)))) / 2.0f;
InstantViewButton.access$4924(instantViewButton, (int) instantViewButton.layout.getLineLeft(0));
}
return instantViewButton;
}
@Override
public void requestLayout() {
if (this.inLayout) {
return;
}
super.requestLayout();
}
@Override
protected void onMeasure(int i, int i2) {
MessageObject messageObject = this.currentMessageObject;
if (messageObject != null && (messageObject.checkLayout() || this.lastHeight != AndroidUtilities.displaySize.y)) {
this.inLayout = true;
MessageObject messageObject2 = this.currentMessageObject;
this.currentMessageObject = null;
setMessageObject(messageObject2, this.currentMessagesGroup, this.pinnedBottom, this.pinnedTop);
this.inLayout = false;
}
updateSelectionTextPosition();
setMeasuredDimension(isWidthAdaptive() ? getBoundsRight() - getBoundsLeft() : View.MeasureSpec.getSize(i), this.totalHeight + this.keyboardHeight);
}
public void forceResetMessageObject() {
MessageObject messageObject = this.messageObjectToSet;
if (messageObject == null) {
messageObject = this.currentMessageObject;
}
this.currentMessageObject = null;
setMessageObject(messageObject, this.currentMessagesGroup, this.pinnedBottom, this.pinnedTop);
}
private int getGroupPhotosWidth() {
int parentWidth = getParentWidth();
MessageObject messageObject = this.currentMessageObject;
if (messageObject != null && messageObject.preview) {
parentWidth = this.parentWidth;
}
if (AndroidUtilities.isInMultiwindow || !AndroidUtilities.isTablet()) {
return parentWidth;
}
if (AndroidUtilities.isSmallTablet() && getResources().getConfiguration().orientation != 2) {
return parentWidth;
}
int i = (parentWidth / 100) * 35;
if (i < AndroidUtilities.dp(320.0f)) {
i = AndroidUtilities.dp(320.0f);
}
return parentWidth - i;
}
public int getExtraTextX() {
int i = SharedConfig.bubbleRadius;
if (i >= 15) {
return AndroidUtilities.dp(2.0f);
}
if (i >= 11) {
return AndroidUtilities.dp(1.0f);
}
return 0;
}
private int getExtraTimeX() {
int i;
if (!this.currentMessageObject.isOutOwner() && ((!this.mediaBackground || this.captionLayout != null) && (i = SharedConfig.bubbleRadius) > 11)) {
return AndroidUtilities.dp((i - 11) / 1.5f);
}
if (!this.currentMessageObject.isOutOwner() && this.isPlayingRound && this.isAvatarVisible && this.currentMessageObject.type == 5) {
return (int) ((AndroidUtilities.roundPlayingMessageSize - AndroidUtilities.roundMessageSize) * 0.7f);
}
return 0;
}
@Override
@SuppressLint({"DrawAllocation"})
public void onLayout(boolean z, int i, int i2, int i3, int i4) {
int i5;
int i6;
int dp;
int dp2;
MessageObject messageObject;
int i7;
int dp3;
int i8;
int dp4;
int dp5;
int dp6;
int i9;
int dp7;
int i10;
int dp8;
int dp9;
if (this.currentMessageObject == null) {
return;
}
int measuredHeight = getMeasuredHeight() + (getMeasuredWidth() << 16);
if (this.lastSize != measuredHeight || !this.wasLayout) {
this.layoutWidth = getMeasuredWidth();
this.layoutHeight = getMeasuredHeight() - this.substractBackgroundHeight;
if (this.timeTextWidth < 0) {
this.timeTextWidth = AndroidUtilities.dp(10.0f);
}
if (this.currentTimeString != null) {
this.timeLayout = new StaticLayout(this.currentTimeString, Theme.chat_timePaint, this.timeTextWidth + AndroidUtilities.dp(100.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
} else {
this.timeLayout = null;
}
if (this.mediaBackground) {
if (this.currentMessageObject.isOutOwner()) {
this.timeX = (this.layoutWidth - this.timeWidth) - AndroidUtilities.dp(42.0f);
} else {
this.timeX = (this.backgroundWidth - AndroidUtilities.dp(4.0f)) - this.timeWidth;
if (this.currentMessageObject.isAnyKindOfSticker()) {
this.timeX = Math.max(AndroidUtilities.dp(26.0f), this.timeX);
}
if (this.isAvatarVisible && !isWidthAdaptive()) {
this.timeX += AndroidUtilities.dp(48.0f);
}
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
if (groupedMessagePosition != null && (i5 = groupedMessagePosition.leftSpanOffset) != 0) {
this.timeX += (int) Math.ceil((i5 / 1000.0f) * getGroupPhotosWidth());
}
if (this.captionLayout != null && this.currentPosition != null) {
this.timeX += AndroidUtilities.dp(4.0f);
}
}
if (SharedConfig.bubbleRadius >= 10 && this.captionLayout == null && (i6 = this.documentAttachType) != 7 && i6 != 6) {
this.timeX -= AndroidUtilities.dp(2.0f);
}
} else if (this.currentMessageObject.isOutOwner()) {
this.timeX = (this.layoutWidth - this.timeWidth) - AndroidUtilities.dp(38.5f);
} else {
this.timeX = (this.backgroundWidth - AndroidUtilities.dp(9.0f)) - this.timeWidth;
if (this.currentMessageObject.isAnyKindOfSticker()) {
this.timeX = Math.max(0, this.timeX);
}
if (this.isAvatarVisible && !isWidthAdaptive()) {
this.timeX += AndroidUtilities.dp(48.0f);
}
if (shouldDrawTimeOnMedia()) {
this.timeX -= AndroidUtilities.dp(7.0f);
}
}
this.timeX -= getExtraTimeX();
if ((this.currentMessageObject.messageOwner.flags & 1024) != 0) {
this.viewsLayout = new StaticLayout(this.currentViewsString, Theme.chat_timePaint, this.viewsTextWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
} else {
this.viewsLayout = null;
}
if (this.currentRepliesString != null && !this.currentMessageObject.scheduled) {
this.repliesLayout = new StaticLayout(this.currentRepliesString, Theme.chat_timePaint, this.repliesTextWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
} else {
this.repliesLayout = null;
}
if (this.isAvatarVisible) {
this.avatarImage.setImageCoords(AndroidUtilities.dp(this.currentMessageObject.isRepostPreview ? 15.0f : 6.0f), this.avatarImage.getImageY(), AndroidUtilities.dp(this.currentMessageObject.isRepostPreview ? 36.0f : 42.0f), AndroidUtilities.dp(this.currentMessageObject.isRepostPreview ? 36.0f : 42.0f));
}
if (this.currentMessageObject.type == 20 && this.currentUnlockString != null) {
this.unlockLayout = new StaticLayout(this.currentUnlockString, Theme.chat_unlockExtendedMediaTextPaint, this.unlockTextWidth, Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false);
int i11 = ((TLRPC$TL_messageExtendedMediaPreview) this.currentMessageObject.messageOwner.media.extended_media).video_duration;
if (i11 != 0) {
String formatDuration = AndroidUtilities.formatDuration(i11, false);
this.durationWidth = (int) Math.ceil(Theme.chat_durationPaint.measureText(formatDuration));
this.videoInfoLayout = new StaticLayout(formatDuration, Theme.chat_durationPaint, this.durationWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
} else {
this.videoInfoLayout = null;
}
} else {
this.unlockLayout = null;
}
this.wasLayout = true;
}
this.lastSize = measuredHeight;
if (this.currentMessageObject.type == 0) {
this.textY = AndroidUtilities.dp(10.0f) + this.namesOffset;
if (this.currentMessageObject.isSponsored()) {
this.linkPreviewY = this.textY + AndroidUtilities.dp(14.0f);
} else if (this.linkPreviewAbove) {
this.linkPreviewY = this.textY + AndroidUtilities.dp(10.0f);
this.textY += this.linkPreviewHeight + AndroidUtilities.dp(13.0f);
if (this.drawInstantView && !this.hasInvoicePreview && !this.currentMessageObject.isGiveawayOrGiveawayResults()) {
this.textY += AndroidUtilities.dp(44.0f);
}
} else {
this.linkPreviewY = this.textY + this.currentMessageObject.textHeight + AndroidUtilities.dp(10.0f);
}
}
if (this.isRoundVideo) {
updatePlayingMessageProgress();
}
int i12 = this.documentAttachType;
if (i12 == 3 || i12 == 7) {
if (this.currentMessageObject.isOutOwner()) {
this.seekBarX = (this.layoutWidth - this.backgroundWidth) + AndroidUtilities.dp(57.0f);
this.buttonX = (this.layoutWidth - this.backgroundWidth) + AndroidUtilities.dp(14.0f);
this.timeAudioX = (this.layoutWidth - this.backgroundWidth) + AndroidUtilities.dp(67.0f);
} else if (needDrawAvatar()) {
this.seekBarX = AndroidUtilities.dp(114.0f);
this.buttonX = AndroidUtilities.dp(71.0f);
this.timeAudioX = AndroidUtilities.dp(124.0f);
} else {
this.seekBarX = AndroidUtilities.dp(66.0f);
this.buttonX = AndroidUtilities.dp(23.0f);
this.timeAudioX = AndroidUtilities.dp(76.0f);
}
if (this.hasLinkPreview) {
this.seekBarX += AndroidUtilities.dp(10.0f);
this.buttonX += AndroidUtilities.dp(10.0f);
this.timeAudioX += AndroidUtilities.dp(10.0f);
}
updateSeekBarWaveformWidth(null);
this.seekBarY = AndroidUtilities.dp(13.0f) + this.namesOffset + this.mediaOffsetY;
int dp10 = AndroidUtilities.dp(13.0f) + this.namesOffset + this.mediaOffsetY;
this.buttonY = dp10;
RadialProgress2 radialProgress2 = this.radialProgress;
int i13 = this.buttonX;
radialProgress2.setProgressRect(i13, dp10, AndroidUtilities.dp(44.0f) + i13, this.buttonY + AndroidUtilities.dp(44.0f));
updatePlayingMessageProgress();
if (this.documentAttachType == 7) {
MessageObject messageObject2 = this.currentMessageObject;
if (messageObject2.type == 0 && (this.hasLinkPreview || this.hasGamePreview || this.hasInvoicePreview)) {
if (this.hasGamePreview) {
i7 = this.unmovedTextX - AndroidUtilities.dp(10.0f);
} else {
if (this.hasInvoicePreview) {
i8 = this.unmovedTextX;
dp4 = AndroidUtilities.dp(1.0f);
} else {
i8 = this.unmovedTextX;
dp4 = AndroidUtilities.dp(1.0f);
}
i7 = i8 + dp4;
}
if (this.isSmallImage) {
dp = i7 + this.backgroundWidth;
dp2 = AndroidUtilities.dp(81.0f);
dp -= dp2;
} else {
dp3 = this.hasInvoicePreview ? -AndroidUtilities.dp(6.3f) : AndroidUtilities.dp(10.0f);
dp = i7 + dp3;
}
} else {
if (messageObject2.isOutOwner()) {
if (this.mediaBackground) {
dp = this.layoutWidth - this.backgroundWidth;
dp2 = AndroidUtilities.dp(3.0f);
} else {
i7 = this.layoutWidth - this.backgroundWidth;
dp3 = AndroidUtilities.dp(6.0f);
dp = i7 + dp3;
}
} else {
if ((this.isChat || ((messageObject = this.currentMessageObject) != null && messageObject.forceAvatar)) && this.isAvatarVisible && (!this.isPlayingRound || this.currentMessageObject.isVoiceTranscriptionOpen())) {
dp = AndroidUtilities.dp(63.0f);
} else {
dp = AndroidUtilities.dp(15.0f);
}
MessageObject.GroupedMessagePosition groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null && !groupedMessagePosition2.edge) {
dp2 = AndroidUtilities.dp(10.0f);
}
}
dp -= dp2;
}
MessageObject.GroupedMessagePosition groupedMessagePosition3 = this.currentPosition;
if (groupedMessagePosition3 != null) {
if ((groupedMessagePosition3.flags & 1) == 0) {
dp -= AndroidUtilities.dp(2.0f);
}
if (this.currentPosition.leftSpanOffset != 0) {
dp += (int) Math.ceil((r2 / 1000.0f) * getGroupPhotosWidth());
}
}
if (this.currentMessageObject.type != 0) {
dp -= AndroidUtilities.dp(2.0f);
}
if (this.currentMessageObject.isVoiceTranscriptionOpen()) {
dp += AndroidUtilities.dp(10.0f);
}
TransitionParams transitionParams = this.transitionParams;
if (!transitionParams.imageChangeBoundsTransition || transitionParams.updatePhotoImageX) {
transitionParams.updatePhotoImageX = false;
ImageReceiver imageReceiver = this.photoImage;
imageReceiver.setImageCoords(dp, this.currentMessageObject.type != 5 ? this.linkPreviewY : imageReceiver.getImageY(), this.photoImage.getImageWidth(), this.photoImage.getImageHeight());
return;
}
return;
}
return;
}
if (i12 == 5) {
if (this.currentMessageObject.isOutOwner()) {
this.seekBarX = (this.layoutWidth - this.backgroundWidth) + AndroidUtilities.dp(56.0f);
this.buttonX = (this.layoutWidth - this.backgroundWidth) + AndroidUtilities.dp(14.0f);
this.timeAudioX = (this.layoutWidth - this.backgroundWidth) + AndroidUtilities.dp(67.0f);
} else if (needDrawAvatar()) {
this.seekBarX = AndroidUtilities.dp(113.0f);
this.buttonX = AndroidUtilities.dp(71.0f);
this.timeAudioX = AndroidUtilities.dp(124.0f);
} else {
this.seekBarX = AndroidUtilities.dp(65.0f);
this.buttonX = AndroidUtilities.dp(23.0f);
this.timeAudioX = AndroidUtilities.dp(76.0f);
}
if (this.hasLinkPreview) {
this.seekBarX += AndroidUtilities.dp(10.0f);
this.buttonX += AndroidUtilities.dp(10.0f);
this.timeAudioX += AndroidUtilities.dp(10.0f);
}
updateSeekBarWaveformWidth(null);
this.seekBarY = AndroidUtilities.dp(29.0f) + this.namesOffset + this.mediaOffsetY;
int dp11 = AndroidUtilities.dp(13.0f) + this.namesOffset + this.mediaOffsetY;
this.buttonY = dp11;
RadialProgress2 radialProgress22 = this.radialProgress;
int i14 = this.buttonX;
radialProgress22.setProgressRect(i14, dp11, AndroidUtilities.dp(44.0f) + i14, this.buttonY + AndroidUtilities.dp(44.0f));
updatePlayingMessageProgress();
return;
}
if (i12 == 1 && !this.drawPhotoImage) {
if (this.currentMessageObject.isOutOwner()) {
this.buttonX = (this.layoutWidth - this.backgroundWidth) + AndroidUtilities.dp(14.0f);
} else if (needDrawAvatar()) {
this.buttonX = AndroidUtilities.dp(71.0f);
} else {
this.buttonX = AndroidUtilities.dp(23.0f);
}
if (this.hasLinkPreview) {
this.buttonX += AndroidUtilities.dp(10.0f);
}
int dp12 = AndroidUtilities.dp(13.0f) + this.namesOffset + this.mediaOffsetY;
this.buttonY = dp12;
RadialProgress2 radialProgress23 = this.radialProgress;
int i15 = this.buttonX;
radialProgress23.setProgressRect(i15, dp12, AndroidUtilities.dp(44.0f) + i15, this.buttonY + AndroidUtilities.dp(44.0f));
this.photoImage.setImageCoords(this.buttonX - AndroidUtilities.dp(10.0f), this.buttonY - AndroidUtilities.dp(10.0f), this.photoImage.getImageWidth(), this.photoImage.getImageHeight());
return;
}
MessageObject messageObject3 = this.currentMessageObject;
int i16 = messageObject3.type;
if (i16 == 12) {
if (messageObject3.isOutOwner()) {
dp9 = (this.layoutWidth - this.backgroundWidth) + AndroidUtilities.dp(26.0f);
} else if (needDrawAvatar()) {
dp9 = AndroidUtilities.dp(84.0f);
} else {
dp9 = AndroidUtilities.dp(35.0f);
}
this.photoImage.setImageCoords(dp9, AndroidUtilities.dp(24.0f) + this.namesOffset, AndroidUtilities.dp(46.0f), AndroidUtilities.dp(46.0f));
return;
}
if (i16 == 0 && (this.hasLinkPreview || this.hasGamePreview || this.hasInvoicePreview)) {
if (this.hasGamePreview) {
i9 = this.unmovedTextX - AndroidUtilities.dp(10.0f);
} else {
if (this.hasInvoicePreview) {
i10 = this.unmovedTextX;
dp8 = AndroidUtilities.dp(1.0f);
} else {
i10 = this.unmovedTextX;
dp8 = AndroidUtilities.dp(1.0f);
}
i9 = i10 + dp8;
}
if (this.isSmallImage) {
dp5 = i9 + this.backgroundWidth;
dp6 = AndroidUtilities.dp(81.0f);
dp5 -= dp6;
} else {
dp7 = this.hasInvoicePreview ? -AndroidUtilities.dp(6.3f) : AndroidUtilities.dp(10.0f);
dp5 = i9 + dp7;
}
} else {
if (messageObject3.isOutOwner()) {
if (this.mediaBackground) {
dp5 = this.layoutWidth - this.backgroundWidth;
dp6 = AndroidUtilities.dp(3.0f);
} else {
i9 = this.layoutWidth - this.backgroundWidth;
dp7 = AndroidUtilities.dp(6.0f);
dp5 = i9 + dp7;
}
} else {
if ((this.isChat || this.currentMessageObject.isRepostPreview) && this.isAvatarVisible && !this.isPlayingRound) {
dp5 = AndroidUtilities.dp(63.0f);
} else {
dp5 = AndroidUtilities.dp(15.0f);
}
MessageObject.GroupedMessagePosition groupedMessagePosition4 = this.currentPosition;
if (groupedMessagePosition4 != null && !groupedMessagePosition4.edge) {
dp6 = AndroidUtilities.dp(10.0f);
}
}
dp5 -= dp6;
}
MessageObject.GroupedMessagePosition groupedMessagePosition5 = this.currentPosition;
if (groupedMessagePosition5 != null) {
if ((groupedMessagePosition5.flags & 1) == 0) {
dp5 -= AndroidUtilities.dp(2.0f);
}
if (this.currentPosition.leftSpanOffset != 0) {
dp5 += (int) Math.ceil((r2 / 1000.0f) * getGroupPhotosWidth());
}
}
if (this.currentMessageObject.type != 0) {
dp5 -= AndroidUtilities.dp(2.0f);
}
if (this.drawInstantViewType == 17) {
dp5 = (int) (dp5 + AndroidUtilities.dp(10.0f) + ((this.instantWidth - this.photoImage.getImageWidth()) / 2.0f));
}
TransitionParams transitionParams2 = this.transitionParams;
if (!transitionParams2.imageChangeBoundsTransition || transitionParams2.updatePhotoImageX) {
transitionParams2.updatePhotoImageX = false;
ImageReceiver imageReceiver2 = this.photoImage;
imageReceiver2.setImageCoords(dp5, imageReceiver2.getImageY(), this.photoImage.getImageWidth(), this.photoImage.getImageHeight());
}
this.buttonX = (int) (dp5 + ((this.photoImage.getImageWidth() - AndroidUtilities.dp(48.0f)) / 2.0f));
int imageY = (int) (this.photoImage.getImageY() + ((this.photoImage.getImageHeight() - AndroidUtilities.dp(48.0f)) / 2.0f));
this.buttonY = imageY;
RadialProgress2 radialProgress24 = this.radialProgress;
int i17 = this.buttonX;
radialProgress24.setProgressRect(i17, imageY, AndroidUtilities.dp(48.0f) + i17, this.buttonY + AndroidUtilities.dp(48.0f));
this.deleteProgressRect.set(this.buttonX + AndroidUtilities.dp(5.0f), this.buttonY + AndroidUtilities.dp(5.0f), this.buttonX + AndroidUtilities.dp(43.0f), this.buttonY + AndroidUtilities.dp(43.0f));
int i18 = this.documentAttachType;
if (i18 == 4 || i18 == 2) {
this.videoButtonX = (int) (this.photoImage.getImageX() + AndroidUtilities.dp(8.0f));
int imageY2 = (int) (this.photoImage.getImageY() + AndroidUtilities.dp(8.0f));
this.videoButtonY = imageY2;
RadialProgress2 radialProgress25 = this.videoRadialProgress;
int i19 = this.videoButtonX;
radialProgress25.setProgressRect(i19, imageY2, AndroidUtilities.dp(24.0f) + i19, this.videoButtonY + AndroidUtilities.dp(24.0f));
}
}
public boolean needDelayRoundProgressDraw() {
MessageObject messageObject;
int i = this.documentAttachType;
return (i == 7 || i == 4) && (messageObject = this.currentMessageObject) != null && messageObject.type != 5 && MediaController.getInstance().isPlayingMessage(this.currentMessageObject);
}
public void drawRoundProgress(Canvas canvas) {
float interpolation;
TransitionParams transitionParams;
int i;
VideoForwardDrawable videoForwardDrawable;
int i2;
float f;
int i3;
float dp = this.isPlayingRound ? AndroidUtilities.dp(4.0f) : 0.0f;
boolean z = false;
boolean z2 = MediaController.getInstance().isPlayingMessage(this.currentMessageObject) && MediaController.getInstance().isMessagePaused();
if (z2 && this.roundSeekbarTouched == 1) {
z = true;
}
if (z2) {
float f2 = this.roundToPauseProgress;
if (f2 != 1.0f) {
float f3 = f2 + 0.07272727f;
this.roundToPauseProgress = f3;
if (f3 > 1.0f) {
this.roundToPauseProgress = 1.0f;
} else {
invalidate();
}
if (z) {
float f4 = this.roundToPauseProgress2;
if (f4 != 1.0f) {
float f5 = f4 + 0.10666667f;
this.roundToPauseProgress2 = f5;
if (f5 > 1.0f) {
this.roundToPauseProgress2 = 1.0f;
} else {
invalidate();
}
interpolation = z2 ? AndroidUtilities.overshootInterpolator.getInterpolation(this.roundToPauseProgress) : this.roundToPauseProgress;
transitionParams = this.transitionParams;
if (transitionParams.animatePlayingRound) {
dp = (this.isPlayingRound ? transitionParams.animateChangeProgress : 1.0f - transitionParams.animateChangeProgress) * AndroidUtilities.dp(4.0f);
}
float dp2 = dp + (AndroidUtilities.dp(16.0f) * interpolation);
if (this.roundToPauseProgress > 0.0f) {
Theme.getRadialSeekbarShadowDrawable().draw(canvas, this.photoImage.getCenterX(), this.photoImage.getCenterY(), this.photoImage.getImageWidth() / 2.0f, this.roundToPauseProgress);
}
this.rect.set(this.photoImage.getImageX() + AndroidUtilities.dpf2(1.5f) + dp2, this.photoImage.getImageY() + AndroidUtilities.dpf2(1.5f) + dp2, (this.photoImage.getImageX2() - AndroidUtilities.dpf2(1.5f)) - dp2, (this.photoImage.getImageY2() - AndroidUtilities.dpf2(1.5f)) - dp2);
if (this.roundProgressAlpha == 1.0f || (!this.hasLinkPreview && getVideoTranscriptionProgress() > 0.0f)) {
int alpha = Theme.chat_radialProgressPaint.getAlpha();
Theme.chat_radialProgressPaint.setAlpha((int) (this.roundProgressAlpha * (!this.hasLinkPreview ? 1.0f - getVideoTranscriptionProgress() : 1.0f) * alpha));
i = alpha;
} else {
i = -1;
}
videoForwardDrawable = this.videoForwardDrawable;
if (videoForwardDrawable != null && videoForwardDrawable.isAnimating()) {
this.videoForwardDrawable.setBounds((int) this.photoImage.getImageX(), (int) this.photoImage.getImageY(), (int) (this.photoImage.getImageX() + this.photoImage.getImageWidth()), (int) (this.photoImage.getImageY() + this.photoImage.getImageHeight()));
this.videoForwardDrawable.draw(canvas);
}
int alpha2 = Theme.chat_radialProgressPaint.getAlpha();
float strokeWidth = Theme.chat_radialProgressPaint.getStrokeWidth();
float f6 = this.roundProgressAlpha == 1.0f ? this.currentMessageObject.audioProgress : this.lastDrawingAudioProgress;
if (interpolation > 0.0f) {
float width = this.rect.width() / 2.0f;
Theme.chat_radialProgressPaint.setStrokeWidth((0.5f * strokeWidth * this.roundToPauseProgress) + strokeWidth);
Theme.chat_radialProgressPaint.setAlpha((int) (alpha2 * this.roundToPauseProgress * 0.3f));
canvas.drawCircle(this.rect.centerX(), this.rect.centerY(), width, Theme.chat_radialProgressPaint);
Theme.chat_radialProgressPaint.setAlpha(alpha2);
double d = ((-360.0f) * f6) + 180.0f;
i2 = i;
double d2 = width;
this.seekbarRoundX = (float) (this.rect.centerX() + (Math.sin(Math.toRadians(d)) * d2));
this.seekbarRoundY = (float) (this.rect.centerY() + (Math.cos(Math.toRadians(d)) * d2));
Theme.chat_radialProgressPausedSeekbarPaint.setColor(-1);
Theme.chat_radialProgressPausedSeekbarPaint.setAlpha((int) (Math.min(1.0f, interpolation) * 255.0f * (!this.hasLinkPreview ? 1.0f - getVideoTranscriptionProgress() : 1.0f)));
canvas.drawCircle(this.seekbarRoundX, this.seekbarRoundY, AndroidUtilities.dp(3.0f) + (AndroidUtilities.dp(5.0f) * interpolation) + (AndroidUtilities.dp(3.0f) * this.roundToPauseProgress2), Theme.chat_radialProgressPausedSeekbarPaint);
} else {
i2 = i;
}
f = this.roundSeekbarOutAlpha;
if (f != 0.0f) {
float f7 = f - 0.10666667f;
this.roundSeekbarOutAlpha = f7;
if (f7 < 0.0f) {
this.roundSeekbarOutAlpha = 0.0f;
} else {
invalidate();
}
}
if (this.roundSeekbarOutAlpha != 0.0f) {
int i4 = i2;
i3 = i4 == -1 ? Theme.chat_radialProgressPaint.getAlpha() : i4;
float f8 = alpha2;
Theme.chat_radialProgressPaint.setAlpha((int) ((1.0f - this.roundSeekbarOutAlpha) * f8));
canvas.drawArc(this.rect, -90.0f, f6 * 360.0f, false, Theme.chat_radialProgressPaint);
Theme.chat_radialProgressPaint.setAlpha((int) (f8 * this.roundSeekbarOutAlpha));
canvas.drawArc(this.rect, -90.0f, this.roundSeekbarOutProgress * 360.0f, false, Theme.chat_radialProgressPaint);
} else {
canvas.drawArc(this.rect, -90.0f, f6 * 360.0f, false, Theme.chat_radialProgressPaint);
i3 = i2;
}
if (i3 != -1) {
Theme.chat_radialProgressPaint.setAlpha(i3);
}
Theme.chat_radialProgressPaint.setStrokeWidth(strokeWidth);
}
}
if (!z) {
float f9 = this.roundToPauseProgress2;
if (f9 != 0.0f) {
float f10 = f9 - 0.10666667f;
this.roundToPauseProgress2 = f10;
if (f10 < 0.0f) {
this.roundToPauseProgress2 = 0.0f;
} else {
invalidate();
}
}
}
interpolation = z2 ? AndroidUtilities.overshootInterpolator.getInterpolation(this.roundToPauseProgress) : this.roundToPauseProgress;
transitionParams = this.transitionParams;
if (transitionParams.animatePlayingRound) {
}
float dp22 = dp + (AndroidUtilities.dp(16.0f) * interpolation);
if (this.roundToPauseProgress > 0.0f) {
}
this.rect.set(this.photoImage.getImageX() + AndroidUtilities.dpf2(1.5f) + dp22, this.photoImage.getImageY() + AndroidUtilities.dpf2(1.5f) + dp22, (this.photoImage.getImageX2() - AndroidUtilities.dpf2(1.5f)) - dp22, (this.photoImage.getImageY2() - AndroidUtilities.dpf2(1.5f)) - dp22);
if (this.roundProgressAlpha == 1.0f) {
}
int alpha3 = Theme.chat_radialProgressPaint.getAlpha();
Theme.chat_radialProgressPaint.setAlpha((int) (this.roundProgressAlpha * (!this.hasLinkPreview ? 1.0f - getVideoTranscriptionProgress() : 1.0f) * alpha3));
i = alpha3;
videoForwardDrawable = this.videoForwardDrawable;
if (videoForwardDrawable != null) {
this.videoForwardDrawable.setBounds((int) this.photoImage.getImageX(), (int) this.photoImage.getImageY(), (int) (this.photoImage.getImageX() + this.photoImage.getImageWidth()), (int) (this.photoImage.getImageY() + this.photoImage.getImageHeight()));
this.videoForwardDrawable.draw(canvas);
}
int alpha22 = Theme.chat_radialProgressPaint.getAlpha();
float strokeWidth2 = Theme.chat_radialProgressPaint.getStrokeWidth();
if (this.roundProgressAlpha == 1.0f) {
}
if (interpolation > 0.0f) {
}
f = this.roundSeekbarOutAlpha;
if (f != 0.0f) {
}
if (this.roundSeekbarOutAlpha != 0.0f) {
}
if (i3 != -1) {
}
Theme.chat_radialProgressPaint.setStrokeWidth(strokeWidth2);
}
}
if (!z2) {
float f11 = this.roundToPauseProgress;
if (f11 != 0.0f) {
float f12 = f11 - 0.10666667f;
this.roundToPauseProgress = f12;
if (f12 < 0.0f) {
this.roundToPauseProgress = 0.0f;
} else {
invalidate();
}
}
}
if (z) {
}
if (!z) {
}
interpolation = z2 ? AndroidUtilities.overshootInterpolator.getInterpolation(this.roundToPauseProgress) : this.roundToPauseProgress;
transitionParams = this.transitionParams;
if (transitionParams.animatePlayingRound) {
}
float dp222 = dp + (AndroidUtilities.dp(16.0f) * interpolation);
if (this.roundToPauseProgress > 0.0f) {
}
this.rect.set(this.photoImage.getImageX() + AndroidUtilities.dpf2(1.5f) + dp222, this.photoImage.getImageY() + AndroidUtilities.dpf2(1.5f) + dp222, (this.photoImage.getImageX2() - AndroidUtilities.dpf2(1.5f)) - dp222, (this.photoImage.getImageY2() - AndroidUtilities.dpf2(1.5f)) - dp222);
if (this.roundProgressAlpha == 1.0f) {
}
int alpha32 = Theme.chat_radialProgressPaint.getAlpha();
Theme.chat_radialProgressPaint.setAlpha((int) (this.roundProgressAlpha * (!this.hasLinkPreview ? 1.0f - getVideoTranscriptionProgress() : 1.0f) * alpha32));
i = alpha32;
videoForwardDrawable = this.videoForwardDrawable;
if (videoForwardDrawable != null) {
}
int alpha222 = Theme.chat_radialProgressPaint.getAlpha();
float strokeWidth22 = Theme.chat_radialProgressPaint.getStrokeWidth();
if (this.roundProgressAlpha == 1.0f) {
}
if (interpolation > 0.0f) {
}
f = this.roundSeekbarOutAlpha;
if (f != 0.0f) {
}
if (this.roundSeekbarOutAlpha != 0.0f) {
}
if (i3 != -1) {
}
Theme.chat_radialProgressPaint.setStrokeWidth(strokeWidth22);
}
private void updatePollAnimations(long j) {
if (this.pollVoteInProgress) {
float f = this.voteRadOffset + (((float) (360 * j)) / 2000.0f);
this.voteRadOffset = f;
this.voteRadOffset = f - (((int) (f / 360.0f)) * 360);
float f2 = this.voteCurrentProgressTime + ((float) j);
this.voteCurrentProgressTime = f2;
if (f2 >= 500.0f) {
this.voteCurrentProgressTime = 500.0f;
}
if (this.voteRisingCircleLength) {
this.voteCurrentCircleLength = (AndroidUtilities.accelerateInterpolator.getInterpolation(this.voteCurrentProgressTime / 500.0f) * 266.0f) + 4.0f;
} else {
this.voteCurrentCircleLength = 4.0f - ((this.firstCircleLength ? 360 : 270) * (1.0f - AndroidUtilities.decelerateInterpolator.getInterpolation(this.voteCurrentProgressTime / 500.0f)));
}
if (this.voteCurrentProgressTime == 500.0f) {
boolean z = this.voteRisingCircleLength;
if (z) {
this.voteRadOffset += 270.0f;
this.voteCurrentCircleLength = -266.0f;
}
this.voteRisingCircleLength = !z;
if (this.firstCircleLength) {
this.firstCircleLength = false;
}
this.voteCurrentProgressTime = 0.0f;
}
invalidate();
}
boolean z2 = this.hintButtonVisible;
if (z2) {
float f3 = this.hintButtonProgress;
if (f3 < 1.0f) {
float f4 = f3 + (((float) j) / 180.0f);
this.hintButtonProgress = f4;
if (f4 > 1.0f) {
this.hintButtonProgress = 1.0f;
}
invalidate();
if (this.animatePollAnswer) {
return;
}
float f5 = this.pollAnimationProgressTime + ((float) j);
this.pollAnimationProgressTime = f5;
if (f5 >= 300.0f) {
this.pollAnimationProgressTime = 300.0f;
}
float interpolation = AndroidUtilities.decelerateInterpolator.getInterpolation(this.pollAnimationProgressTime / 300.0f);
this.pollAnimationProgress = interpolation;
if (interpolation >= 1.0f) {
this.pollAnimationProgress = 1.0f;
this.animatePollAnswer = false;
this.animatePollAnswerAlpha = false;
this.pollVoteInProgress = false;
if (this.pollUnvoteInProgress && this.animatePollAvatars) {
int i = 0;
while (true) {
ImageReceiver[] imageReceiverArr = this.pollAvatarImages;
if (i >= imageReceiverArr.length) {
break;
}
imageReceiverArr[i].setImageBitmap((Drawable) null);
this.pollAvatarImagesVisible[i] = false;
i++;
}
}
this.pollUnvoteInProgress = false;
int size = this.pollButtons.size();
for (int i2 = 0; i2 < size; i2++) {
this.pollButtons.get(i2).prevChosen = false;
}
}
invalidate();
return;
}
}
if (!z2) {
float f6 = this.hintButtonProgress;
if (f6 > 0.0f) {
float f7 = f6 - (((float) j) / 180.0f);
this.hintButtonProgress = f7;
if (f7 < 0.0f) {
this.hintButtonProgress = 0.0f;
}
invalidate();
}
}
if (this.animatePollAnswer) {
}
}
public void drawContent(final Canvas canvas, boolean z) {
boolean z2;
boolean z3;
MessageObject messageObject;
ArrayList<MessageObject.TextLayoutBlock> arrayList;
float f;
float f2;
boolean isPlayingMessage;
float currentBackgroundRight;
float f3;
int i;
Drawable drawable;
float f4;
float f5;
int i2;
float f6;
int i3;
int i4;
Drawable drawable2;
float dp;
int dp2;
int dp3;
StaticLayout staticLayout;
int i5;
int imageX;
Path path;
float f7;
boolean z4;
ViewGroup viewGroup;
MessageObject messageObject2;
MessageObject messageObject3 = this.currentMessageObject;
if (messageObject3 == null || !messageObject3.preview) {
z2 = z;
z3 = false;
} else {
z2 = z;
z3 = true;
}
if (z2 != z3) {
return;
}
boolean z5 = this.needNewVisiblePart && messageObject3.type == 0;
boolean hasSpoilers = hasSpoilers();
if (z5 || hasSpoilers) {
getLocalVisibleRect(this.scrollRect);
if (hasSpoilers) {
Rect rect = this.scrollRect;
updateSpoilersVisiblePart(rect.top, rect.bottom);
}
if (z5) {
Rect rect2 = this.scrollRect;
int i6 = rect2.top;
setVisiblePart(i6, rect2.bottom - i6, this.parentHeight, this.parentViewTopOffset, this.viewTop, this.parentWidth, this.backgroundHeight, this.blurredViewTopOffset, this.blurredViewBottomOffset);
this.needNewVisiblePart = false;
}
}
float f8 = this.buttonX;
float f9 = this.buttonY;
if (this.transitionParams.animateButton) {
f8 = AndroidUtilities.lerp(this.transitionParams.animateFromButtonX, this.buttonX, this.transitionParams.animateChangeProgress);
f9 = AndroidUtilities.lerp(this.transitionParams.animateFromButtonY, this.buttonY, this.transitionParams.animateChangeProgress);
int i7 = (int) f8;
int i8 = (int) f9;
this.radialProgress.setProgressRect(i7, i8, AndroidUtilities.dp(44.0f) + i7, AndroidUtilities.dp(44.0f) + i8);
}
float f10 = f9;
updateSeekBarWaveformWidth(canvas);
this.forceNotDrawTime = this.currentMessagesGroup != null;
this.photoImage.setPressed(((this.isHighlightedAnimated || this.isHighlighted) && this.currentPosition != null) ? 2 : 0);
this.photoImage.setVisible((PhotoViewer.isShowingImage(this.currentMessageObject) || SecretMediaViewer.getInstance().isShowingImage(this.currentMessageObject) || StoryViewer.isShowingImage(this.currentMessageObject)) ? false : true, false);
this.blurredPhotoImage.setVisible((PhotoViewer.isShowingImage(this.currentMessageObject) || SecretMediaViewer.getInstance().isShowingImage(this.currentMessageObject) || StoryViewer.isShowingImage(this.currentMessageObject)) ? false : true, false);
float f11 = 0.0f;
if (!this.photoImage.getVisible()) {
this.mediaWasInvisible = true;
this.timeWasInvisible = true;
int i9 = this.animatingNoSound;
if (i9 == 1) {
this.animatingNoSoundProgress = 0.0f;
this.animatingNoSound = 0;
} else if (i9 == 2) {
this.animatingNoSoundProgress = 1.0f;
this.animatingNoSound = 0;
}
} else if (this.groupPhotoInvisible) {
this.timeWasInvisible = true;
} else {
boolean z6 = this.mediaWasInvisible;
if (z6 || this.timeWasInvisible) {
if (z6) {
this.controlsAlpha = 0.0f;
this.mediaWasInvisible = false;
}
if (this.timeWasInvisible) {
this.timeAlpha = 0.0f;
this.timeWasInvisible = false;
}
this.lastControlsAlphaChangeTime = System.currentTimeMillis();
this.totalChangeTime = 0L;
}
}
RadialProgress2 radialProgress2 = this.radialProgress;
int i10 = Theme.key_chat_mediaProgress;
radialProgress2.setProgressColor(getThemedColor(i10));
this.videoRadialProgress.setProgressColor(getThemedColor(i10));
this.imageDrawn = false;
this.radialProgress.setCircleCrossfadeColor(-1, 0.0f, 1.0f);
MessageObject messageObject4 = this.currentMessageObject;
int i11 = messageObject4.type;
if (i11 == 0 || i11 == 24 || i11 == 19 || messageObject4.isGiveawayOrGiveawayResults()) {
layoutTextXY(false);
if (!this.enterTransitionInProgress && (messageObject = this.currentMessageObject) != null && !messageObject.preview) {
if (!this.drawForBlur && this.animatedEmojiStack != null && (((arrayList = messageObject.textLayoutBlocks) != null && !arrayList.isEmpty()) || (this.transitionParams.animateOutTextBlocks != null && !this.transitionParams.animateOutTextBlocks.isEmpty()))) {
this.animatedEmojiStack.clearPositions();
}
drawMessageText(canvas);
}
if (!this.enterTransitionInProgress || this.currentMessageObject.isVoice()) {
drawLinkPreview(canvas, 1.0f);
getIconForCurrentState();
}
this.drawTime = true;
} else if (this.drawPhotoImage) {
float f12 = this.roundVideoPlayPipFloat.get();
if (f12 > 0.0f) {
if (this.drillHolePaint == null) {
this.drillHolePaint = new Paint(1);
}
this.drillHolePaint.setColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outLoader : Theme.key_chat_inLoader));
this.drillHolePaint.setAlpha((int) (r6.getAlpha() * getVideoTranscriptionProgress()));
canvas.drawCircle(this.photoImage.getCenterX(), this.photoImage.getCenterY(), this.photoImage.getImageWidth() / 2.0f, this.drillHolePaint);
}
if (this.isRoundVideo && MediaController.getInstance().isPlayingMessage(this.currentMessageObject) && MediaController.getInstance().isVideoDrawingReady() && canvas.isHardwareAccelerated() && ((messageObject2 = this.currentMessageObject) == null || !messageObject2.isVoiceTranscriptionOpen() || f12 >= 1.0f)) {
this.imageDrawn = true;
this.drawTime = true;
} else {
if (this.currentMessageObject.type == 5 && Theme.chat_roundVideoShadow != null) {
float imageX2 = this.photoImage.getImageX() - AndroidUtilities.dp(3.0f);
float imageY = this.photoImage.getImageY() - AndroidUtilities.dp(2.0f);
Theme.chat_roundVideoShadow.setAlpha((int) ((1.0f - getVideoTranscriptionProgress()) * 255.0f));
Theme.chat_roundVideoShadow.setBounds((int) imageX2, (int) imageY, (int) (imageX2 + this.photoImage.getImageWidth() + AndroidUtilities.dp(6.0f)), (int) (imageY + this.photoImage.getImageHeight() + AndroidUtilities.dp(6.0f)));
Theme.chat_roundVideoShadow.draw(canvas);
Theme.chat_roundVideoShadow.setAlpha(255);
if (!this.photoImage.hasBitmapImage() || this.photoImage.getCurrentAlpha() != 1.0f) {
Theme.chat_docBackPaint.setColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outBubble : Theme.key_chat_inBubble));
canvas.drawCircle(this.photoImage.getCenterX(), this.photoImage.getCenterY(), this.photoImage.getImageWidth() / 2.0f, Theme.chat_docBackPaint);
}
}
CheckBoxBase checkBoxBase = this.mediaCheckBox;
boolean z7 = checkBoxBase != null && (this.checkBoxVisible || checkBoxBase.getProgress() != 0.0f || this.checkBoxAnimationInProgress) && this.currentMessagesGroup != null;
this.drawMediaCheckBox = z7;
if (z7 && ((this.mediaCheckBox.isChecked() || this.mediaCheckBox.getProgress() != 0.0f || this.checkBoxAnimationInProgress) && !textIsSelectionMode())) {
if (!this.currentMessagesGroup.isDocuments) {
Theme.chat_replyLinePaint.setColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outBubbleSelected : Theme.key_chat_inBubbleSelected));
this.rect.set(this.photoImage.getImageX(), this.photoImage.getImageY(), this.photoImage.getImageX2(), this.photoImage.getImageY2());
int[] roundRadius = this.photoImage.getRoundRadius();
this.rectPath.reset();
for (int i12 = 0; i12 < roundRadius.length; i12++) {
float[] fArr = radii;
int i13 = i12 * 2;
float f13 = roundRadius[i12];
fArr[i13 + 1] = f13;
fArr[i13] = f13;
}
this.rectPath.addRoundRect(this.rect, radii, Path.Direction.CW);
this.rectPath.close();
canvas.drawPath(this.rectPath, Theme.chat_replyLinePaint);
}
this.photoImage.setSideClip(AndroidUtilities.dp(14.0f) * this.mediaCheckBox.getProgress());
if (this.checkBoxAnimationInProgress) {
this.mediaCheckBox.setBackgroundAlpha(this.checkBoxAnimationProgress);
} else {
CheckBoxBase checkBoxBase2 = this.mediaCheckBox;
checkBoxBase2.setBackgroundAlpha(this.checkBoxVisible ? 1.0f : checkBoxBase2.getProgress());
}
} else {
this.photoImage.setSideClip(0.0f);
}
if (this.isRoundVideo && this.currentMessageObject.isVoiceTranscriptionOpen() && f12 > 0.0f) {
canvas.save();
Path path2 = this.drillHolePath;
if (path2 == null) {
this.drillHolePath = new Path();
} else {
path2.rewind();
}
this.drillHolePath.addCircle(this.photoImage.getCenterX(), this.photoImage.getCenterY(), (this.photoImage.getImageWidth() / 2.0f) * (1.0f - f12), Path.Direction.CW);
canvas.clipPath(this.drillHolePath);
}
ChatMessageCellDelegate chatMessageCellDelegate = this.delegate;
if (chatMessageCellDelegate == null || chatMessageCellDelegate.getPinchToZoomHelper() == null || !this.delegate.getPinchToZoomHelper().isInOverlayModeFor(this)) {
float y = getY() + this.photoImage.getImageY();
float imageHeight = this.photoImage.getImageHeight() + y;
this.photoImageOutOfBounds = false;
float f14 = this.parentBoundsTop;
if ((f14 != 0.0f || this.parentBoundsBottom != 0) && (imageHeight < f14 || y > this.parentBoundsBottom)) {
this.photoImageOutOfBounds = true;
}
if (!this.photoImageOutOfBounds || this.drawForBlur) {
this.photoImage.setSkipUpdateFrame(this.drawForBlur || this.skipFrameUpdate);
if (this.flipImage) {
canvas.save();
canvas.scale(-1.0f, 1.0f, this.photoImage.getCenterX(), this.photoImage.getCenterY());
if (allowDrawPhotoImage()) {
this.imageDrawn = drawPhotoImage(canvas);
} else {
this.imageDrawn = true;
}
if (this.currentMessageObject.hasMediaSpoilers()) {
drawBlurredPhoto(canvas);
}
canvas.restore();
} else {
if (allowDrawPhotoImage()) {
ButtonBounce buttonBounce = this.contactBounce;
if (buttonBounce != null) {
float scale = buttonBounce.getScale(0.0125f);
if (scale != 1.0f) {
canvas.save();
canvas.scale(scale, scale, this.contactRect.centerX(), this.contactRect.centerY());
z4 = true;
this.imageDrawn = drawPhotoImage(canvas);
if (z4) {
canvas.restore();
}
}
}
z4 = false;
this.imageDrawn = drawPhotoImage(canvas);
if (z4) {
}
} else {
this.imageDrawn = true;
}
if (this.currentMessageObject.hasMediaSpoilers()) {
drawBlurredPhoto(canvas);
}
}
this.photoImage.setSkipUpdateFrame(this.skipFrameUpdate);
}
}
if (this.isRoundVideo && this.currentMessageObject.isVoiceTranscriptionOpen() && f12 > 0.0f) {
canvas.restore();
}
boolean z8 = this.drawTime;
boolean visible = this.photoImage.getVisible();
boolean z9 = visible || (this.currentMessageObject.shouldDrawReactionsInLayout() && this.currentMessageObject.hasReactions());
this.drawTime = z9;
if (this.currentPosition != null && z8 != z9 && (viewGroup = (ViewGroup) getParent()) != null) {
if (!this.currentPosition.last) {
int childCount = viewGroup.getChildCount();
for (int i14 = 0; i14 < childCount; i14++) {
View childAt = viewGroup.getChildAt(i14);
if (childAt != this && (childAt instanceof ChatMessageCell)) {
ChatMessageCell chatMessageCell = (ChatMessageCell) childAt;
if (chatMessageCell.getCurrentMessagesGroup() == this.currentMessagesGroup) {
MessageObject.GroupedMessagePosition currentPosition = chatMessageCell.getCurrentPosition();
if (currentPosition.last && currentPosition.maxY == this.currentPosition.maxY && (chatMessageCell.timeX - AndroidUtilities.dp(4.0f)) + chatMessageCell.getLeft() < getRight()) {
chatMessageCell.groupPhotoInvisible = !visible;
chatMessageCell.invalidate();
viewGroup.invalidate();
}
}
}
}
} else {
viewGroup.invalidate();
}
}
}
} else {
int i15 = this.documentAttachType;
if (i15 == 5 || i15 == 1) {
CheckBoxBase checkBoxBase3 = this.mediaCheckBox;
boolean z10 = checkBoxBase3 != null && (this.checkBoxVisible || checkBoxBase3.getProgress() != 0.0f || this.checkBoxAnimationInProgress) && this.currentMessagesGroup != null;
this.drawMediaCheckBox = z10;
if (z10) {
this.radialProgress.setCircleCrossfadeColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outTimeText : Theme.key_chat_inTimeText, this.checkBoxAnimationProgress, 1.0f - this.mediaCheckBox.getProgress());
}
if (this.drawMediaCheckBox && !textIsSelectionMode() && (this.mediaCheckBox.isChecked() || this.mediaCheckBox.getProgress() != 0.0f || this.checkBoxAnimationInProgress)) {
if (this.checkBoxAnimationInProgress) {
this.mediaCheckBox.setBackgroundAlpha(this.checkBoxAnimationProgress);
if (this.radialProgress.getMiniIcon() == 4) {
this.radialProgress.setMiniIconScale(this.checkBoxAnimationProgress);
}
} else {
CheckBoxBase checkBoxBase4 = this.mediaCheckBox;
checkBoxBase4.setBackgroundAlpha(this.checkBoxVisible ? 1.0f : checkBoxBase4.getProgress());
}
} else {
CheckBoxBase checkBoxBase5 = this.mediaCheckBox;
if (checkBoxBase5 != null) {
checkBoxBase5.setBackgroundAlpha(1.0f);
}
}
}
}
int i16 = this.documentAttachType;
if (i16 == 2) {
if (this.drawPhotoImage && !this.currentMessageObject.isRepostPreview && this.photoImage.getVisible() && !this.hasGamePreview && !this.currentMessageObject.needDrawBluredPreview() && !this.currentMessageObject.preview && !this.isSmallImage) {
int alpha = ((BitmapDrawable) Theme.chat_msgMediaMenuDrawable).getPaint().getAlpha();
Theme.chat_msgMediaMenuDrawable.setAlpha((int) (alpha * this.controlsAlpha));
Drawable drawable3 = Theme.chat_msgMediaMenuDrawable;
int imageX3 = (int) ((this.photoImage.getImageX() + this.photoImage.getImageWidth()) - AndroidUtilities.dp(14.0f));
this.otherX = imageX3;
int imageY2 = (int) (this.photoImage.getImageY() + AndroidUtilities.dp(8.1f));
this.otherY = imageY2;
BaseCell.setDrawableBounds(drawable3, imageX3, imageY2);
Theme.chat_msgMediaMenuDrawable.draw(canvas);
Theme.chat_msgMediaMenuDrawable.setAlpha(alpha);
}
f = 1.0f;
} else if (i16 == 5) {
if (this.currentMessageObject.isOutOwner()) {
Theme.chat_audioTitlePaint.setColor(getThemedColor(Theme.key_chat_outAudioTitleText));
Theme.chat_audioPerformerPaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outAudioPerformerSelectedText : Theme.key_chat_outAudioPerformerText));
Theme.chat_audioTimePaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outAudioDurationSelectedText : Theme.key_chat_outAudioDurationText));
this.radialProgress.setProgressColor(getThemedColor((isDrawSelectionBackground() || this.buttonPressed != 0) ? Theme.key_chat_outAudioSelectedProgress : Theme.key_chat_outAudioProgress));
} else {
ReplyMessageLine replyMessageLine = this.linkLine;
if (replyMessageLine != null && this.hasLinkPreview) {
Theme.chat_audioTitlePaint.setColor(replyMessageLine.getColor());
Theme.chat_audioPerformerPaint.setColor(Theme.adaptHue(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inAudioPerformerSelectedText : Theme.key_chat_inAudioPerformerText), this.linkLine.getColor()));
Theme.chat_audioTimePaint.setColor(Theme.adaptHue(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inAudioDurationSelectedText : Theme.key_chat_inAudioDurationText), this.linkLine.getColor()));
this.radialProgress.setProgressColor(Theme.adaptHue(getThemedColor((isDrawSelectionBackground() || this.buttonPressed != 0) ? Theme.key_chat_inAudioSelectedProgress : Theme.key_chat_inAudioProgress), this.linkLine.getColor()));
SeekBar seekBar = this.seekBar;
int adaptHue = Theme.adaptHue(getThemedColor(Theme.key_chat_inAudioSeekbar), this.linkLine.getColor());
int adaptHue2 = Theme.adaptHue(getThemedColor(Theme.key_chat_inAudioCacheSeekbar), this.linkLine.getColor());
int i17 = Theme.key_chat_inAudioSeekbarFill;
seekBar.setColors(adaptHue, adaptHue2, Theme.adaptHue(getThemedColor(i17), this.linkLine.getColor()), Theme.adaptHue(getThemedColor(i17), this.linkLine.getColor()), Theme.adaptHue(getThemedColor(Theme.key_chat_inAudioSeekbarSelected), this.linkLine.getColor()));
} else {
Theme.chat_audioTitlePaint.setColor(getThemedColor(Theme.key_chat_inAudioTitleText));
Theme.chat_audioPerformerPaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inAudioPerformerSelectedText : Theme.key_chat_inAudioPerformerText));
Theme.chat_audioTimePaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inAudioDurationSelectedText : Theme.key_chat_inAudioDurationText));
this.radialProgress.setProgressColor(getThemedColor((isDrawSelectionBackground() || this.buttonPressed != 0) ? Theme.key_chat_inAudioSelectedProgress : Theme.key_chat_inAudioProgress));
}
}
this.radialProgress.setBackgroundDrawable(isDrawSelectionBackground() ? this.currentBackgroundSelectedDrawable : this.currentBackgroundDrawable);
RadialProgress2 radialProgress22 = this.radialProgress;
radialProgress22.iconScale = 1.0f;
radialProgress22.draw(canvas);
canvas.save();
canvas.translate(this.timeAudioX + this.songX, AndroidUtilities.dp(13.0f) + this.namesOffset + getMediaOffsetY());
this.songLayout.draw(canvas);
canvas.restore();
boolean isPlayingMessage2 = MediaController.getInstance().isPlayingMessage(this.currentMessageObject);
if (isPlayingMessage2) {
float f15 = this.toSeekBarProgress;
if (f15 != 1.0f) {
float f16 = f15 + 0.16f;
this.toSeekBarProgress = f16;
if (f16 > 1.0f) {
this.toSeekBarProgress = 1.0f;
}
invalidate();
f3 = this.toSeekBarProgress;
if (f3 <= 0.0f) {
if (f3 != 1.0f) {
i = 255;
f = 1.0f;
canvas.saveLayerAlpha(this.seekBarX, this.seekBarY, r1 + this.seekBar.getWidth() + AndroidUtilities.dp(24.0f), this.seekBarY + AndroidUtilities.dp(24.0f), (int) (this.toSeekBarProgress * 255.0f), 31);
} else {
i = 255;
f = 1.0f;
canvas.save();
}
canvas.translate(this.seekBarX, this.seekBarY);
this.seekBar.draw(canvas);
canvas.restore();
} else {
i = 255;
f = 1.0f;
}
if (this.toSeekBarProgress < f) {
float f17 = this.timeAudioX + this.performerX;
float dp4 = AndroidUtilities.dp(35.0f) + this.namesOffset + getMediaOffsetY();
if (this.toSeekBarProgress != 0.0f) {
f4 = dp4;
f5 = f17;
canvas.saveLayerAlpha(f17, dp4, f17 + this.performerLayout.getWidth(), dp4 + this.performerLayout.getHeight(), (int) ((f - this.toSeekBarProgress) * 255.0f), 31);
} else {
f4 = dp4;
f5 = f17;
canvas.save();
}
float f18 = this.toSeekBarProgress;
if (f18 != 0.0f) {
float f19 = ((f - f18) * 0.3f) + 0.7f;
canvas.scale(f19, f19, f5, f4 + (this.performerLayout.getHeight() / 2.0f));
}
canvas.translate(f5, f4);
this.performerLayout.draw(canvas);
canvas.restore();
}
canvas.save();
canvas.translate(this.timeAudioX, AndroidUtilities.dp(57.0f) + this.namesOffset + getMediaOffsetY());
this.durationLayout.draw(canvas);
canvas.restore();
if (shouldDrawMenuDrawable()) {
if (this.currentMessageObject.isOutOwner()) {
drawable = getThemedDrawable(isDrawSelectionBackground() ? "drawableMsgOutMenuSelected" : "drawableMsgOutMenu");
} else {
drawable = isDrawSelectionBackground() ? Theme.chat_msgInMenuSelectedDrawable : Theme.chat_msgInMenuDrawable;
}
int dp5 = ((((int) f8) + this.backgroundWidth) - AndroidUtilities.dp(this.currentMessageObject.type == 0 ? 58.0f : 48.0f)) - AndroidUtilities.dp(this.hasLinkPreview ? 18.0f : 0.0f);
this.otherX = dp5;
int dp6 = ((int) f10) - AndroidUtilities.dp(2.0f);
this.otherY = dp6;
BaseCell.setDrawableBounds(drawable, dp5, dp6);
TransitionParams transitionParams = this.transitionParams;
if (transitionParams.animateChangeProgress != f && transitionParams.animateShouldDrawMenuDrawable) {
drawable.setAlpha((int) (this.transitionParams.animateChangeProgress * 255.0f));
}
drawable.draw(canvas);
TransitionParams transitionParams2 = this.transitionParams;
if (transitionParams2.animateChangeProgress != f && transitionParams2.animateShouldDrawMenuDrawable) {
drawable.setAlpha(i);
}
}
}
}
if (!isPlayingMessage2) {
float f20 = this.toSeekBarProgress;
if (f20 != 0.0f) {
float f21 = f20 - 0.16f;
this.toSeekBarProgress = f21;
if (f21 < 0.0f) {
this.toSeekBarProgress = 0.0f;
}
invalidate();
}
}
f3 = this.toSeekBarProgress;
if (f3 <= 0.0f) {
}
if (this.toSeekBarProgress < f) {
}
canvas.save();
canvas.translate(this.timeAudioX, AndroidUtilities.dp(57.0f) + this.namesOffset + getMediaOffsetY());
this.durationLayout.draw(canvas);
canvas.restore();
if (shouldDrawMenuDrawable()) {
}
} else {
f = 1.0f;
if (i16 == 3 || i16 == 7) {
if (this.currentMessageObject.isOutOwner()) {
Theme.chat_audioTimePaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outAudioDurationSelectedText : Theme.key_chat_outAudioDurationText));
this.radialProgress.setProgressColor(getThemedColor((isDrawSelectionBackground() || this.buttonPressed != 0) ? Theme.key_chat_outAudioSelectedProgress : Theme.key_chat_outAudioProgress));
} else if (this.hasLinkPreview && this.linkLine != null) {
Theme.chat_audioTimePaint.setColor(Theme.adaptHue(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inAudioDurationSelectedText : Theme.key_chat_inAudioDurationText), this.linkLine.getColor()));
this.radialProgress.setProgressColor(Theme.adaptHue(getThemedColor((isDrawSelectionBackground() || this.buttonPressed != 0) ? Theme.key_chat_inAudioSelectedProgress : Theme.key_chat_inAudioProgress), this.linkLine.getColor()));
SeekBar seekBar2 = this.seekBar;
int adaptHue3 = Theme.adaptHue(getThemedColor(Theme.key_chat_inAudioSeekbar), this.linkLine.getColor());
int adaptHue4 = Theme.adaptHue(getThemedColor(Theme.key_chat_inAudioCacheSeekbar), this.linkLine.getColor());
int i18 = Theme.key_chat_inAudioSeekbarFill;
seekBar2.setColors(adaptHue3, adaptHue4, Theme.adaptHue(getThemedColor(i18), this.linkLine.getColor()), Theme.adaptHue(getThemedColor(i18), this.linkLine.getColor()), Theme.adaptHue(getThemedColor(Theme.key_chat_inAudioSeekbarSelected), this.linkLine.getColor()));
} else {
Theme.chat_audioTimePaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inAudioDurationSelectedText : Theme.key_chat_inAudioDurationText));
this.radialProgress.setProgressColor(getThemedColor((isDrawSelectionBackground() || this.buttonPressed != 0) ? Theme.key_chat_inAudioSelectedProgress : Theme.key_chat_inAudioProgress));
}
AudioVisualizerDrawable audioVisualizerDrawable = this.overridenAudioVisualizer;
if (audioVisualizerDrawable == null) {
if (MediaController.getInstance().isPlayingMessage(this.currentMessageObject)) {
audioVisualizerDrawable = Theme.getCurrentAudiVisualizerDrawable();
} else {
audioVisualizerDrawable = Theme.getAnimatedOutAudioVisualizerDrawable(this.currentMessageObject);
}
}
if (audioVisualizerDrawable != null && (this.documentAttachType != 7 || !this.hasLinkPreview)) {
audioVisualizerDrawable.setParentView(this);
if (this.linkLine != null) {
audioVisualizerDrawable.draw(canvas, f8 + AndroidUtilities.dp(22.0f), f10 + AndroidUtilities.dp(22.0f), this.linkLine.getColor(), this.documentAttachType == 7 ? getVideoTranscriptionProgress() : 1.0f, this.resourcesProvider);
} else {
audioVisualizerDrawable.draw(canvas, f8 + AndroidUtilities.dp(22.0f), f10 + AndroidUtilities.dp(22.0f), this.currentMessageObject.isOutOwner(), this.documentAttachType == 7 ? getVideoTranscriptionProgress() : 1.0f, this.resourcesProvider);
}
}
if (!this.enterTransitionInProgress && this.documentAttachType == 3) {
this.radialProgress.setBackgroundDrawable(isDrawSelectionBackground() ? this.currentBackgroundSelectedDrawable : this.currentBackgroundDrawable);
this.radialProgress.iconScale = 1.0f;
SeekBarWaveform seekBarWaveform = this.seekBarWaveform;
drawVoiceOnce(canvas, seekBarWaveform == null ? 1.0f : 1.0f - seekBarWaveform.explosionRate, new Runnable() {
@Override
public final void run() {
ChatMessageCell.this.lambda$drawContent$10(canvas);
}
});
}
int i19 = this.seekBarX;
int i20 = this.timeAudioX;
if (this.transitionParams.animateButton) {
int i21 = this.buttonX;
float f22 = this.transitionParams.animateFromButtonX;
float f23 = this.transitionParams.animateChangeProgress;
int i22 = i21 - ((int) ((f22 * (1.0f - f23)) + (this.buttonX * f23)));
i19 -= i22;
i20 -= i22;
}
if (this.isRoundVideo && this.currentMessageObject.isOutOwner()) {
i19 = getCurrentBackgroundLeft() + AndroidUtilities.dp(57.0f);
i20 = getCurrentBackgroundLeft() + AndroidUtilities.dp(67.0f);
}
int videoTranscriptionProgress = this.isRoundVideo ? (int) (0 + ((1.0f - getVideoTranscriptionProgress()) * AndroidUtilities.roundMessageSize)) : 0;
canvas.save();
if (this.documentAttachType != 7 || !this.hasLinkPreview) {
if (this.useSeekBarWaveform) {
canvas.translate((AndroidUtilities.dp(13.0f) + i19) - this.seekBarWaveformTranslateX, this.seekBarY + videoTranscriptionProgress);
this.seekBarWaveform.setAlpha(this.isRoundVideo ? CubicBezierInterpolator.EASE_IN.getInterpolation(getVideoTranscriptionProgress()) : 1.0f);
this.seekBarWaveform.draw(canvas, this);
} else {
canvas.translate(i19, this.seekBarY + videoTranscriptionProgress);
this.seekBar.setAlpha(this.isRoundVideo ? CubicBezierInterpolator.EASE_IN.getInterpolation(getVideoTranscriptionProgress()) : 1.0f);
this.seekBar.draw(canvas);
}
}
canvas.restore();
float useTranscribeButtonProgress = getUseTranscribeButtonProgress();
TransitionParams transitionParams3 = this.transitionParams;
if (transitionParams3.animatePlayingRound) {
if (this.isPlayingRound) {
f2 = transitionParams3.animateChangeProgress;
} else {
f2 = 1.0f - transitionParams3.animateChangeProgress;
}
} else {
f2 = this.isPlayingRound ? 1.0f : 0.0f;
}
if (!this.wasTranscriptionOpen) {
useTranscribeButtonProgress = AndroidUtilities.lerp((1.0f - f2) * useTranscribeButtonProgress, useTranscribeButtonProgress, getVideoTranscriptionProgress());
}
if (useTranscribeButtonProgress > 0.0f && (this.documentAttachType != 7 || !this.hasLinkPreview)) {
canvas.save();
int currentBackgroundRight2 = ((getCurrentBackgroundRight() - getCurrentBackgroundLeft()) + AndroidUtilities.dp(this.pinnedBottom ? 6.0f : 0.0f)) - AndroidUtilities.dp(((this.hasLinkPreview ? 10 : 0) + 92) + 36);
if (this.transcribeButton == null) {
TranscribeButton transcribeButton = new TranscribeButton(this, this.seekBarWaveform) {
@Override
public void drawGradientBackground(Canvas canvas2, Rect rect3, float f24) {
Paint themedPaint;
if (ChatMessageCell.this.currentMessageObject.shouldDrawWithoutBackground()) {
themedPaint = ChatMessageCell.this.getThemedPaint("paintChatActionBackground");
} else {
themedPaint = ChatMessageCell.this.getThemedPaint("paintChatTimeBackground");
}
int alpha2 = themedPaint.getAlpha();
themedPaint.setAlpha((int) (alpha2 * f24));
ChatMessageCell.this.applyServiceShaderMatrix();
canvas2.drawRect(rect3, themedPaint);
if (themedPaint == ChatMessageCell.this.getThemedPaint("paintChatActionBackground") && ChatMessageCell.this.hasGradientService()) {
int alpha3 = Theme.chat_actionBackgroundGradientDarkenPaint.getAlpha();
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha((int) (alpha3 * f24));
canvas2.drawRect(rect3, Theme.chat_actionBackgroundGradientDarkenPaint);
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha(alpha3);
}
themedPaint.setAlpha(alpha2);
}
@Override
protected void onOpen() {
ChatMessageCell.this.wasTranscriptionOpen = true;
}
};
this.transcribeButton = transcribeButton;
MessageObject messageObject5 = this.currentMessageObject;
TLRPC$Message tLRPC$Message = messageObject5.messageOwner;
transcribeButton.setOpen(tLRPC$Message != null && tLRPC$Message.voiceTranscriptionOpen && tLRPC$Message.voiceTranscriptionFinal && TranscribeButton.isVideoTranscriptionOpen(messageObject5), false);
this.transcribeButton.setLoading(TranscribeButton.isTranscribing(this.currentMessageObject), false);
this.transcribeButton.setLock(TranscribeButton.showTranscribeLock(this.currentMessageObject), false);
}
if (this.drawSideButton != 0) {
this.transcribeX = AndroidUtilities.lerp(i19 + AndroidUtilities.dp(21.0f) + currentBackgroundRight2, this.sideStartX, 1.0f - getVideoTranscriptionProgress());
this.transcribeY = AndroidUtilities.lerp(this.seekBarY + AndroidUtilities.dp(3.0f), this.sideStartY - AndroidUtilities.dp(40.0f), 1.0f - getVideoTranscriptionProgress());
} else {
float dp7 = i19 + AndroidUtilities.dp(21.0f) + currentBackgroundRight2;
MessageObject messageObject6 = this.currentMessageObject;
if (messageObject6 != null && messageObject6.isOutOwner()) {
currentBackgroundRight = (getCurrentBackgroundLeft() - AndroidUtilities.dp(40.0f)) + (AndroidUtilities.dp(28.0f) * f2);
} else {
currentBackgroundRight = (getCurrentBackgroundRight() + AndroidUtilities.dp(8.0f)) - (AndroidUtilities.dp(40.0f) * f2);
}
this.transcribeX = AndroidUtilities.lerp(dp7, currentBackgroundRight, 1.0f - getVideoTranscriptionProgress());
float dp8 = (this.layoutHeight + this.transitionParams.deltaBottom) - AndroidUtilities.dp(28 - (this.drawPinnedBottom ? 2 : 0));
ReactionsLayoutInBubble reactionsLayoutInBubble = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble.isEmpty) {
dp8 -= reactionsLayoutInBubble.getCurrentTotalHeight(this.transitionParams.animateChangeProgress);
}
this.transcribeY = AndroidUtilities.lerp(this.seekBarY + AndroidUtilities.dp(3.0f), ((AndroidUtilities.lerp(dp8, ((AndroidUtilities.dp(44.0f) + this.namesOffset) + getMediaOffsetY()) - AndroidUtilities.dp(1.7f), getVideoTranscriptionProgress()) + AndroidUtilities.dp(1.7f)) - AndroidUtilities.dp(12.0f)) - (this.currentMessageObject.isOutOwner() ? 0.0f : AndroidUtilities.dp(28.0f) * f2), 1.0f - getVideoTranscriptionProgress());
}
this.transcribeButton.setBounds((int) this.transcribeX, (int) this.transcribeY, AndroidUtilities.lerp(AndroidUtilities.dp(30.0f), AndroidUtilities.dp(32.0f), 1.0f - getVideoTranscriptionProgress()), AndroidUtilities.lerp(AndroidUtilities.dp(24.0f), AndroidUtilities.dp(32.0f), 1.0f - getVideoTranscriptionProgress()), AndroidUtilities.lerp(AndroidUtilities.dp(8.0f), AndroidUtilities.dp(16.0f), 1.0f - getVideoTranscriptionProgress()));
this.transcribeButton.setColor(ColorUtils.blendARGB(getThemedColor(Theme.key_chat_serviceText), getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outReactionButtonBackground : Theme.key_chat_inReactionButtonBackground), this.documentAttachType == 3 ? 1.0f : getVideoTranscriptionProgress()), getThemedColor(Theme.key_windowBackgroundWhiteGrayText), this.currentMessageObject.isOut(), this.documentAttachType == 3 ? 0.0f : 1.0f - getVideoTranscriptionProgress());
this.transcribeButton.draw(canvas, useTranscribeButtonProgress);
canvas.restore();
}
if (this.documentAttachType == 3) {
canvas.save();
canvas.translate(i20, AndroidUtilities.dp(44.0f) + this.namesOffset + getMediaOffsetY() + videoTranscriptionProgress);
this.durationLayout.draw(canvas);
canvas.restore();
MessageObject messageObject7 = this.currentMessageObject;
if (messageObject7.type != 0 && messageObject7.isContentUnread()) {
Theme.chat_docBackPaint.setColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outVoiceSeekbarFill : Theme.key_chat_inVoiceSeekbarFill));
canvas.drawCircle(i20 + this.timeWidthAudio + AndroidUtilities.dp(6.0f), AndroidUtilities.dp(51.0f) + this.namesOffset + getMediaOffsetY(), AndroidUtilities.dp(3.0f), Theme.chat_docBackPaint);
}
}
if (this.documentAttachType != 7 || this.durationLayout == null || (!(isPlayingMessage = MediaController.getInstance().isPlayingMessage(this.currentMessageObject)) && this.roundProgressAlpha == 0.0f)) {
f11 = 0.0f;
} else {
if (isPlayingMessage) {
this.roundProgressAlpha = 1.0f;
f11 = 0.0f;
} else {
float f24 = this.roundProgressAlpha - 0.10666667f;
this.roundProgressAlpha = f24;
f11 = 0.0f;
if (f24 < 0.0f) {
this.roundProgressAlpha = 0.0f;
} else {
invalidate();
}
}
drawRoundProgress(canvas);
}
}
}
if (this.captionLayout != null) {
updateCaptionLayout();
}
updateReactionLayoutPosition();
if (!shouldDrawCaptionLayout() || this.currentMessageObject.preview) {
i2 = 0;
} else {
i2 = 0;
drawCaptionLayout(canvas, false, f);
}
if (this.hasOldCaptionPreview) {
MessageObject messageObject8 = this.currentMessageObject;
int i23 = messageObject8.type;
if (i23 == 1 || i23 == 20) {
i5 = 4;
} else {
i5 = 4;
if (this.documentAttachType != 4 && i23 != 8) {
imageX = this.backgroundDrawableLeft + AndroidUtilities.dp(messageObject8.isOutOwner() ? 11.0f : 17.0f);
float dp9 = ((this.totalHeight - AndroidUtilities.dp(!this.drawPinnedTop ? 9.0f : 10.0f)) - this.linkPreviewHeight) - AndroidUtilities.dp(11.0f);
Theme.chat_replyLinePaint.setColor(getThemedColor(!this.currentMessageObject.isOutOwner() ? Theme.key_chat_outPreviewLine : Theme.key_chat_inPreviewLine));
RectF rectF = AndroidUtilities.rectTmp;
float f25 = imageX;
rectF.set(f25, dp9 - AndroidUtilities.dp(3.0f), AndroidUtilities.dp(6.0f) + imageX, this.linkPreviewHeight + dp9);
path = this.replyRoundRectPath;
if (path != null) {
this.replyRoundRectPath = new Path();
} else {
path.rewind();
}
canvas.save();
float f26 = rectF.left;
canvas.clipRect(f26, rectF.top, AndroidUtilities.dp(3.0f) + f26, rectF.bottom);
this.replyRoundRectPath.addRoundRect(rectF, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(4.0f), Path.Direction.CW);
canvas.drawPath(this.replyRoundRectPath, Theme.chat_replyLinePaint);
canvas.restore();
if (this.siteNameLayout == null) {
Theme.chat_replyNamePaint.setColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outSiteNameText : Theme.key_chat_inSiteNameText));
canvas.save();
canvas.translate(f25 + (-this.siteNameLeft) + (this.hasInvoicePreview ? i2 : AndroidUtilities.dp(10.0f)), dp9 - AndroidUtilities.dp(3.0f));
this.siteNameLayout.draw(canvas);
canvas.restore();
StaticLayout staticLayout2 = this.siteNameLayout;
f7 = staticLayout2.getLineBottom(staticLayout2.getLineCount() - 1) + dp9;
} else {
f7 = dp9;
}
if (!this.currentMessageObject.isOutOwner()) {
Theme.chat_replyTextPaint.setColor(getThemedColor(Theme.key_chat_messageTextOut));
} else {
Theme.chat_replyTextPaint.setColor(getThemedColor(Theme.key_chat_messageTextIn));
}
if (this.descriptionLayout == null) {
if (f7 != dp9) {
f7 += AndroidUtilities.dp(2.0f);
}
this.descriptionY = ((int) f7) - AndroidUtilities.dp(3.0f);
canvas.save();
canvas.translate(imageX + AndroidUtilities.dp(10.0f) + this.descriptionX, this.descriptionY);
SpoilerEffect.layoutDrawMaybe(this.descriptionLayout, canvas);
StaticLayout staticLayout3 = this.descriptionLayout;
f6 = 0.0f;
i4 = i5;
AnimatedEmojiSpan.drawAnimatedEmojis(canvas, staticLayout3, this.animatedEmojiDescriptionStack, 0.0f, null, 0.0f, 0.0f, 0.0f, 1.0f, getAdaptiveEmojiColorFilter(1, staticLayout3.getPaint().getColor()));
canvas.restore();
} else {
f6 = f11;
i4 = i5;
}
i3 = 1;
this.drawTime = true;
}
}
imageX = (int) (this.photoImage.getImageX() + AndroidUtilities.dp(5.0f));
float dp92 = ((this.totalHeight - AndroidUtilities.dp(!this.drawPinnedTop ? 9.0f : 10.0f)) - this.linkPreviewHeight) - AndroidUtilities.dp(11.0f);
Theme.chat_replyLinePaint.setColor(getThemedColor(!this.currentMessageObject.isOutOwner() ? Theme.key_chat_outPreviewLine : Theme.key_chat_inPreviewLine));
RectF rectF2 = AndroidUtilities.rectTmp;
float f252 = imageX;
rectF2.set(f252, dp92 - AndroidUtilities.dp(3.0f), AndroidUtilities.dp(6.0f) + imageX, this.linkPreviewHeight + dp92);
path = this.replyRoundRectPath;
if (path != null) {
}
canvas.save();
float f262 = rectF2.left;
canvas.clipRect(f262, rectF2.top, AndroidUtilities.dp(3.0f) + f262, rectF2.bottom);
this.replyRoundRectPath.addRoundRect(rectF2, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(4.0f), Path.Direction.CW);
canvas.drawPath(this.replyRoundRectPath, Theme.chat_replyLinePaint);
canvas.restore();
if (this.siteNameLayout == null) {
}
if (!this.currentMessageObject.isOutOwner()) {
}
if (this.descriptionLayout == null) {
}
i3 = 1;
this.drawTime = true;
} else {
f6 = f11;
i3 = 1;
i4 = 4;
}
if (this.documentAttachType == i3) {
if (this.currentMessageObject.isOutOwner()) {
Theme.chat_docNamePaint.setColor(getThemedColor(Theme.key_chat_outFileNameText));
Theme.chat_infoPaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outFileInfoSelectedText : Theme.key_chat_outFileInfoText));
Theme.chat_docBackPaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outFileBackgroundSelected : Theme.key_chat_outFileBackground));
drawable2 = getThemedDrawable(isDrawSelectionBackground() ? "drawableMsgOutMenuSelected" : "drawableMsgOutMenu");
} else if (this.linkLine != null && this.hasLinkPreview) {
Theme.chat_docNamePaint.setColor(Theme.adaptHue(getThemedColor(Theme.key_chat_inFileNameText), this.linkLine.getColor()));
Theme.chat_infoPaint.setColor(Theme.adaptHue(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inFileInfoSelectedText : Theme.key_chat_inFileInfoText), this.linkLine.getColor()));
Theme.chat_docBackPaint.setColor(Theme.adaptHue(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inFileBackgroundSelected : Theme.key_chat_inFileBackground), this.linkLine.getColor()));
drawable2 = isDrawSelectionBackground() ? Theme.chat_msgInMenuSelectedDrawable : Theme.chat_msgInMenuDrawable;
} else {
Theme.chat_docNamePaint.setColor(getThemedColor(Theme.key_chat_inFileNameText));
Theme.chat_infoPaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inFileInfoSelectedText : Theme.key_chat_inFileInfoText));
Theme.chat_docBackPaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inFileBackgroundSelected : Theme.key_chat_inFileBackground));
drawable2 = isDrawSelectionBackground() ? Theme.chat_msgInMenuSelectedDrawable : Theme.chat_msgInMenuDrawable;
}
if (this.drawPhotoImage) {
if (this.currentMessageObject.type == 0) {
int imageX4 = (int) ((this.photoImage.getImageX() + this.backgroundWidth) - AndroidUtilities.dp((this.hasLinkPreview ? 12 : 0) + 56));
this.otherX = imageX4;
int imageY3 = (int) (this.photoImage.getImageY() + AndroidUtilities.dp(4.0f));
this.otherY = imageY3;
BaseCell.setDrawableBounds(drawable2, imageX4, imageY3);
} else {
int imageX5 = (int) ((this.photoImage.getImageX() + this.backgroundWidth) - AndroidUtilities.dp((this.hasLinkPreview ? 12 : 0) + 40));
this.otherX = imageX5;
int imageY4 = (int) (this.photoImage.getImageY() + AndroidUtilities.dp(4.0f));
this.otherY = imageY4;
BaseCell.setDrawableBounds(drawable2, imageX5, imageY4);
}
dp = (int) (this.photoImage.getImageX() + this.photoImage.getImageWidth() + AndroidUtilities.dp(10.0f));
dp2 = (int) (this.photoImage.getImageY() + AndroidUtilities.dp(8.0f));
dp3 = (int) (this.photoImage.getImageY() + (this.docTitleLayout != null ? r4.getLineBottom(r4.getLineCount() - 1) + AndroidUtilities.dp(13.0f) : AndroidUtilities.dp(8.0f)));
if (!this.imageDrawn) {
if (this.currentMessageObject.isOutOwner()) {
RadialProgress2 radialProgress23 = this.radialProgress;
int i24 = Theme.key_chat_outLoader;
int i25 = Theme.key_chat_outLoaderSelected;
int i26 = Theme.key_chat_outMediaIcon;
int i27 = Theme.key_chat_outMediaIconSelected;
radialProgress23.setColorKeys(i24, i25, i26, i27);
this.radialProgress.setProgressColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outFileProgressSelected : Theme.key_chat_outFileProgress));
this.videoRadialProgress.setColorKeys(i24, i25, i26, i27);
this.videoRadialProgress.setProgressColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outFileProgressSelected : Theme.key_chat_outFileProgress));
} else {
ReplyMessageLine replyMessageLine2 = this.linkLine;
if (replyMessageLine2 != null && this.hasLinkPreview) {
this.radialProgress.setColors(replyMessageLine2.getColor(), this.linkLine.getColor(), Theme.blendOver(-1, Theme.multAlpha(this.linkLine.getColor(), 0.01f)), Theme.blendOver(-1, Theme.multAlpha(this.linkLine.getColor(), 0.05f)));
this.radialProgress.setProgressColor(Theme.blendOver(-1, Theme.multAlpha(this.linkLine.getColor(), 0.01f)));
this.videoRadialProgress.setColors(this.linkLine.getColor(), this.linkLine.getColor(), Theme.blendOver(-1, Theme.multAlpha(this.linkLine.getColor(), 0.01f)), Theme.blendOver(-1, Theme.multAlpha(this.linkLine.getColor(), 0.05f)));
this.videoRadialProgress.setProgressColor(Theme.blendOver(-1, Theme.multAlpha(this.linkLine.getColor(), 0.01f)));
} else {
RadialProgress2 radialProgress24 = this.radialProgress;
int i28 = Theme.key_chat_inLoader;
int i29 = Theme.key_chat_inLoaderSelected;
int i30 = Theme.key_chat_inMediaIcon;
int i31 = Theme.key_chat_inMediaIconSelected;
radialProgress24.setColorKeys(i28, i29, i30, i31);
this.radialProgress.setProgressColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inFileProgressSelected : Theme.key_chat_inFileProgress));
this.videoRadialProgress.setColorKeys(i28, i29, i30, i31);
this.videoRadialProgress.setProgressColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inFileProgressSelected : Theme.key_chat_inFileProgress));
}
}
this.rect.set(this.photoImage.getImageX(), this.photoImage.getImageY(), this.photoImage.getImageX() + this.photoImage.getImageWidth(), this.photoImage.getImageY() + this.photoImage.getImageHeight());
int[] roundRadius2 = this.photoImage.getRoundRadius();
this.rectPath.reset();
for (int i32 = 0; i32 < roundRadius2.length; i32++) {
float[] fArr2 = radii;
int i33 = i32 * 2;
fArr2[i33] = roundRadius2[i32];
fArr2[i33 + 1] = roundRadius2[i32];
}
this.rectPath.addRoundRect(this.rect, radii, Path.Direction.CW);
this.rectPath.close();
canvas.drawPath(this.rectPath, Theme.chat_docBackPaint);
} else {
RadialProgress2 radialProgress25 = this.radialProgress;
int i34 = Theme.key_chat_mediaLoaderPhoto;
int i35 = Theme.key_chat_mediaLoaderPhotoSelected;
int i36 = Theme.key_chat_mediaLoaderPhotoIcon;
int i37 = Theme.key_chat_mediaLoaderPhotoIconSelected;
radialProgress25.setColorKeys(i34, i35, i36, i37);
RadialProgress2 radialProgress26 = this.radialProgress;
int i38 = Theme.key_chat_mediaProgress;
radialProgress26.setProgressColor(getThemedColor(i38));
this.videoRadialProgress.setColorKeys(i34, i35, i36, i37);
this.videoRadialProgress.setProgressColor(getThemedColor(i38));
if (this.buttonState == -1 && this.radialProgress.getIcon() != i4) {
this.radialProgress.setIcon(i4, true, true);
}
}
} else {
int dp10 = ((((int) f8) + this.backgroundWidth) - AndroidUtilities.dp(this.currentMessageObject.type == 0 ? 58.0f : 48.0f)) - AndroidUtilities.dp(this.hasLinkPreview ? 24.0f : f6);
this.otherX = dp10;
int i39 = (int) f10;
int dp11 = i39 - AndroidUtilities.dp(2.0f);
this.otherY = dp11;
BaseCell.setDrawableBounds(drawable2, dp10, dp11);
dp = f8 + AndroidUtilities.dp(53.0f);
dp2 = AndroidUtilities.dp(4.0f) + i39;
dp3 = i39 + AndroidUtilities.dp(27.0f);
StaticLayout staticLayout4 = this.docTitleLayout;
if (staticLayout4 != null && staticLayout4.getLineCount() > 1) {
dp3 += ((this.docTitleLayout.getLineCount() - 1) * AndroidUtilities.dp(16.0f)) + AndroidUtilities.dp(2.0f);
}
if (this.currentMessageObject.isOutOwner()) {
this.radialProgress.setProgressColor(getThemedColor((isDrawSelectionBackground() || this.buttonPressed != 0) ? Theme.key_chat_outAudioSelectedProgress : Theme.key_chat_outAudioProgress));
this.videoRadialProgress.setProgressColor(getThemedColor((isDrawSelectionBackground() || this.videoButtonPressed != 0) ? Theme.key_chat_outAudioSelectedProgress : Theme.key_chat_outAudioProgress));
} else {
this.radialProgress.setProgressColor(getThemedColor((isDrawSelectionBackground() || this.buttonPressed != 0) ? Theme.key_chat_inAudioSelectedProgress : Theme.key_chat_inAudioProgress));
this.videoRadialProgress.setProgressColor(getThemedColor((isDrawSelectionBackground() || this.videoButtonPressed != 0) ? Theme.key_chat_inAudioSelectedProgress : Theme.key_chat_inAudioProgress));
}
}
int i40 = dp2;
float f27 = dp;
if (shouldDrawMenuDrawable()) {
TransitionParams transitionParams4 = this.transitionParams;
if (transitionParams4.animateChangeProgress != f && transitionParams4.animateShouldDrawMenuDrawable) {
drawable2.setAlpha((int) (this.transitionParams.animateChangeProgress * 255.0f));
}
drawable2.draw(canvas);
TransitionParams transitionParams5 = this.transitionParams;
if (transitionParams5.animateChangeProgress != f && transitionParams5.animateShouldDrawMenuDrawable) {
drawable2.setAlpha(255);
}
}
try {
if (this.docTitleLayout != null) {
canvas.save();
canvas.translate(this.docTitleOffsetX + f27, i40);
this.docTitleLayout.draw(canvas);
canvas.restore();
}
} catch (Exception e) {
FileLog.e(e);
}
try {
if (this.infoLayout != null) {
canvas.save();
canvas.translate(f27, dp3);
if (this.buttonState == 1 && (staticLayout = this.loadingProgressLayout) != null) {
staticLayout.draw(canvas);
} else {
this.infoLayout.draw(canvas);
}
canvas.restore();
}
} catch (Exception e2) {
FileLog.e(e2);
}
}
MessageObject messageObject9 = this.currentMessageObject;
if (messageObject9.type == i4 && !(MessageObject.getMedia(messageObject9.messageOwner) instanceof TLRPC$TL_messageMediaGeoLive) && this.currentMapProvider == 2 && this.photoImage.hasNotThumb()) {
Drawable redLocationIcon = this.sharedResources.getRedLocationIcon();
int intrinsicWidth = (int) (redLocationIcon.getIntrinsicWidth() * 0.8f);
int intrinsicHeight = (int) (redLocationIcon.getIntrinsicHeight() * 0.8f);
int imageX6 = (int) (this.photoImage.getImageX() + ((this.photoImage.getImageWidth() - intrinsicWidth) / 2.0f));
int imageY5 = (int) ((this.photoImage.getImageY() + ((this.photoImage.getImageHeight() / 2.0f) - intrinsicHeight)) - (AndroidUtilities.dp(16.0f) * (f - CubicBezierInterpolator.EASE_OUT_BACK.getInterpolation(this.photoImage.getCurrentAlpha()))));
redLocationIcon.setAlpha((int) (Math.min(f, this.photoImage.getCurrentAlpha() * 5.0f) * 255.0f));
redLocationIcon.setBounds(imageX6, imageY5, intrinsicWidth + imageX6, intrinsicHeight + imageY5);
redLocationIcon.draw(canvas);
if (this.photoImage.getCurrentAlpha() < f) {
invalidate();
}
}
this.transitionParams.recordDrawingState();
}
public void lambda$drawContent$10(Canvas canvas) {
this.radialProgress.draw(canvas);
}
private void startRevealMedia(float f, float f2) {
float sqrt = (float) Math.sqrt(Math.pow(this.photoImage.getImageWidth(), 2.0d) + Math.pow(this.photoImage.getImageHeight(), 2.0d));
this.mediaSpoilerRevealMaxRadius = sqrt;
startRevealMedia(f, f2, sqrt);
}
private void startRevealMedia(float f, float f2, float f3) {
MessageObject messageObject = this.currentMessageObject;
if (messageObject.isMediaSpoilersRevealed || this.mediaSpoilerRevealProgress != 0.0f) {
return;
}
if (messageObject.type == 3) {
messageObject.forceUpdate = true;
messageObject.revealingMediaSpoilers = true;
setMessageContent(messageObject, this.currentMessagesGroup, this.pinnedBottom, this.pinnedTop);
MessageObject messageObject2 = this.currentMessageObject;
messageObject2.revealingMediaSpoilers = false;
messageObject2.forceUpdate = false;
if (this.currentMessagesGroup != null) {
this.radialProgress.setProgress(0.0f, false);
}
}
this.mediaSpoilerRevealX = f;
this.mediaSpoilerRevealY = f2;
ValueAnimator duration = ValueAnimator.ofFloat(0.0f, 1.0f).setDuration(MathUtils.clamp(this.mediaSpoilerRevealMaxRadius * 0.3f, 250.0f, 550.0f));
duration.setInterpolator(CubicBezierInterpolator.EASE_BOTH);
duration.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
ChatMessageCell.this.lambda$startRevealMedia$11(valueAnimator);
}
});
duration.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
ChatMessageCell.this.currentMessageObject.isMediaSpoilersRevealed = true;
ChatMessageCell.this.invalidate();
}
});
duration.start();
}
public void lambda$startRevealMedia$11(ValueAnimator valueAnimator) {
this.mediaSpoilerRevealProgress = ((Float) valueAnimator.getAnimatedValue()).floatValue();
invalidate();
}
public void drawBlurredPhoto(Canvas canvas) {
if (this.currentMessageObject.isMediaSpoilersRevealed || this.mediaSpoilerRevealProgress == 1.0f) {
return;
}
int[] roundRadius = this.photoImage.getRoundRadius();
float[] fArr = this.mediaSpoilerRadii;
float f = roundRadius[0];
fArr[1] = f;
fArr[0] = f;
float f2 = roundRadius[1];
fArr[3] = f2;
fArr[2] = f2;
float f3 = roundRadius[2];
fArr[5] = f3;
fArr[4] = f3;
float f4 = roundRadius[3];
fArr[7] = f4;
fArr[6] = f4;
this.mediaSpoilerPath.rewind();
RectF rectF = AndroidUtilities.rectTmp;
rectF.set(this.photoImage.getImageX(), this.photoImage.getImageY(), this.photoImage.getImageX2(), this.photoImage.getImageY2());
this.mediaSpoilerPath.addRoundRect(rectF, this.mediaSpoilerRadii, Path.Direction.CW);
canvas.save();
canvas.clipPath(this.mediaSpoilerPath);
if (this.mediaSpoilerRevealProgress != 0.0f) {
this.mediaSpoilerPath.rewind();
this.mediaSpoilerPath.addCircle(this.mediaSpoilerRevealX, this.mediaSpoilerRevealY, this.mediaSpoilerRevealMaxRadius * this.mediaSpoilerRevealProgress, Path.Direction.CW);
canvas.clipPath(this.mediaSpoilerPath, Region.Op.DIFFERENCE);
}
if (this.currentMessageObject.needDrawBluredPreview()) {
this.photoImage.draw(canvas);
} else {
this.blurredPhotoImage.setImageCoords(this.photoImage.getImageX(), this.photoImage.getImageY(), this.photoImage.getImageWidth(), this.photoImage.getImageHeight());
this.blurredPhotoImage.setRoundRadius(this.photoImage.getRoundRadius());
this.blurredPhotoImage.draw(canvas);
}
drawBlurredPhotoParticles(canvas);
canvas.restore();
}
public void drawBlurredPhotoParticles(Canvas canvas) {
if (this.mediaSpoilerEffect2 != null) {
canvas.translate(this.photoImage.getImageX(), this.photoImage.getImageY());
this.mediaSpoilerEffect2.draw(canvas, this, (int) this.photoImage.getImageWidth(), (int) this.photoImage.getImageHeight(), this.photoImage.getAlpha(), this.drawingToBitmap);
} else {
this.mediaSpoilerEffect.setColor(ColorUtils.setAlphaComponent(-1, (int) (Color.alpha(-1) * 0.325f * this.photoImage.getAlpha())));
this.mediaSpoilerEffect.setBounds((int) this.photoImage.getImageX(), (int) this.photoImage.getImageY(), (int) this.photoImage.getImageX2(), (int) this.photoImage.getImageY2());
this.mediaSpoilerEffect.draw(canvas);
invalidate();
}
}
private float getUseTranscribeButtonProgress() {
TransitionParams transitionParams = this.transitionParams;
if (!transitionParams.animateUseTranscribeButton) {
return this.useTranscribeButton ? 1.0f : 0.0f;
}
if (this.useTranscribeButton) {
return transitionParams.animateChangeProgress;
}
return 1.0f - transitionParams.animateChangeProgress;
}
public void updateReactionLayoutPosition() {
int i;
float dp;
if (this.currentMessageObject.shouldDrawReactions()) {
ReactionsLayoutInBubble reactionsLayoutInBubble = this.reactionsLayoutInBubble;
int i2 = 0;
if (!reactionsLayoutInBubble.isEmpty) {
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
if (groupedMessagePosition != null) {
int i3 = groupedMessagePosition.flags;
if ((i3 & 8) != 0) {
}
}
if (!reactionsLayoutInBubble.isSmall) {
MessageObject messageObject = this.currentMessageObject;
if (messageObject.type == 19 || messageObject.isAnimatedEmoji() || this.currentMessageObject.isAnyKindOfSticker()) {
if (this.currentMessageObject.isOutOwner()) {
this.reactionsLayoutInBubble.x = (getMeasuredWidth() - this.reactionsLayoutInBubble.width) - AndroidUtilities.dp(16.0f);
} else {
this.reactionsLayoutInBubble.x = getCurrentBackgroundLeft();
}
} else {
if (this.currentMessageObject.isOutOwner()) {
this.reactionsLayoutInBubble.x = getCurrentBackgroundLeft() + AndroidUtilities.dp(11.0f);
} else if (this.isRoundVideo) {
this.reactionsLayoutInBubble.x = getCurrentBackgroundLeft() + AndroidUtilities.dp(11.0f) + AndroidUtilities.dp(AndroidUtilities.lerp(0, !this.drawPinnedBottom ? 6 : 0, getVideoTranscriptionProgress()));
this.reactionsLayoutInBubble.x -= (int) ((1.0f - getVideoTranscriptionProgress()) * AndroidUtilities.dp(9.0f));
} else {
this.reactionsLayoutInBubble.x = getCurrentBackgroundLeft() + AndroidUtilities.dp((this.mediaBackground || !this.drawPinnedBottom) ? 17.0f : 11.0f);
if (this.mediaBackground) {
this.reactionsLayoutInBubble.x -= AndroidUtilities.dp(9.0f);
}
}
}
ReactionsLayoutInBubble reactionsLayoutInBubble2 = this.reactionsLayoutInBubble;
int backgroundDrawableBottom = getBackgroundDrawableBottom() - AndroidUtilities.dp(10.0f);
ReactionsLayoutInBubble reactionsLayoutInBubble3 = this.reactionsLayoutInBubble;
reactionsLayoutInBubble2.y = backgroundDrawableBottom - reactionsLayoutInBubble3.height;
reactionsLayoutInBubble3.y -= this.drawCommentButton ? AndroidUtilities.dp(43.0f) : 0;
if (this.hasNewLineForTime && (!this.drawForwardedName || !this.hasLinkPreview || this.documentAttachType != 3)) {
this.reactionsLayoutInBubble.y -= AndroidUtilities.dp(16.0f);
}
if (this.captionLayout != null) {
MessageObject messageObject2 = this.currentMessageObject;
if ((messageObject2.type != 2 && ((!messageObject2.isOut() || !this.drawForwardedName || this.drawPhotoImage) && (this.currentMessageObject.type != 9 || !this.drawPhotoImage))) || (this.currentPosition != null && this.currentMessagesGroup != null)) {
this.reactionsLayoutInBubble.y -= AndroidUtilities.dp(14.0f);
}
}
ReactionsLayoutInBubble reactionsLayoutInBubble4 = this.reactionsLayoutInBubble;
reactionsLayoutInBubble4.y += reactionsLayoutInBubble4.positionOffsetY;
}
}
ReactionsLayoutInBubble reactionsLayoutInBubble5 = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble5.isSmall || reactionsLayoutInBubble5.isEmpty) {
return;
}
if (shouldDrawTimeOnMedia()) {
if (this.drawCommentButton) {
i2 = AndroidUtilities.dp(41.3f);
}
} else {
if (this.currentMessageObject.isSponsored()) {
i = -AndroidUtilities.dp(48.0f);
if (this.hasNewLineForTime) {
i -= AndroidUtilities.dp(16.0f);
}
ReactionsLayoutInBubble reactionsLayoutInBubble6 = this.reactionsLayoutInBubble;
if (shouldDrawTimeOnMedia()) {
dp = ((this.layoutHeight - AndroidUtilities.dp((this.pinnedBottom || this.pinnedTop) ? 7.5f : 6.5f)) - this.timeLayout.getHeight()) + i;
} else {
dp = ((this.photoImage.getImageY2() + this.additionalTimeOffsetY) - AndroidUtilities.dp(7.3f)) - this.timeLayout.getHeight();
}
reactionsLayoutInBubble6.y = (int) dp;
this.reactionsLayoutInBubble.y = (int) (r0.y + ((this.timeLayout.getHeight() / 2.0f) - AndroidUtilities.dp(7.0f)));
this.reactionsLayoutInBubble.x = this.timeX;
}
if (this.drawCommentButton) {
i2 = AndroidUtilities.dp(43.0f);
}
}
i = -i2;
ReactionsLayoutInBubble reactionsLayoutInBubble62 = this.reactionsLayoutInBubble;
if (shouldDrawTimeOnMedia()) {
}
reactionsLayoutInBubble62.y = (int) dp;
this.reactionsLayoutInBubble.y = (int) (r0.y + ((this.timeLayout.getHeight() / 2.0f) - AndroidUtilities.dp(7.0f)));
this.reactionsLayoutInBubble.x = this.timeX;
}
}
public void drawVoiceOnce(Canvas canvas, float f, Runnable runnable) {
MessageObject messageObject = this.currentMessageObject;
if (messageObject != null && messageObject.isVoiceOnce()) {
float centerX = this.radialProgress.progressRect.centerX() + (((float) Math.cos((AndroidUtilities.lerp(190, 45, f) / 180.0f) * 3.141592653589793d)) * AndroidUtilities.dp(22.6274f));
float centerY = this.radialProgress.progressRect.centerY() + (((float) Math.sin((AndroidUtilities.lerp(190, 45, f) / 180.0f) * 3.141592653589793d)) * AndroidUtilities.dp(22.6274f));
RectF rectF = AndroidUtilities.rectTmp;
rectF.set(this.radialProgress.progressRect);
rectF.inset(-AndroidUtilities.dp(1.0f), -AndroidUtilities.dp(1.0f));
canvas.saveLayerAlpha(rectF, 255, 31);
this.radialProgress.setBackgroundDrawable(isDrawSelectionBackground() ? this.currentBackgroundSelectedDrawable : this.currentBackgroundDrawable);
this.radialProgress.iconScale = f;
runnable.run();
if (this.onceClearPaint == null) {
Paint paint = new Paint(1);
this.onceClearPaint = paint;
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
}
if (f < 1.0f) {
canvas.save();
float f2 = 1.0f - f;
float f3 = 0.7f * f2;
float centerX2 = this.radialProgress.progressRect.centerX();
RectF rectF2 = this.radialProgress.progressRect;
canvas.scale(f3, f3, centerX2, AndroidUtilities.lerp(rectF2.top, rectF2.bottom, 0.5f));
if (this.onceFire == null) {
RLottieDrawable rLottieDrawable = new RLottieDrawable(org.telegram.messenger.R.raw.fire_once, "fire_once", AndroidUtilities.dp(32.0f), AndroidUtilities.dp(32.0f), true, null);
this.onceFire = rLottieDrawable;
rLottieDrawable.setMasterParent(this);
this.onceFire.setAllowDecodeSingleFrame(true);
this.onceFire.setAutoRepeat(1);
this.onceFire.start();
this.onceFire.scaleByCanvas = true;
}
RLottieDrawable rLottieDrawable2 = this.onceFire;
RectF rectF3 = this.radialProgress.progressRect;
rLottieDrawable2.setBounds((int) rectF3.left, (int) rectF3.top, (int) rectF3.right, (int) rectF3.bottom);
if (this.onceRadialPaint == null) {
this.onceRadialPaint = new Paint(1);
}
if (this.onceRadialCutPaint == null) {
Paint paint2 = new Paint(1);
this.onceRadialCutPaint = paint2;
paint2.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
}
if (this.onceRadialStrokePaint == null) {
Paint paint3 = new Paint(1);
this.onceRadialStrokePaint = paint3;
paint3.setStyle(Paint.Style.STROKE);
}
RadialProgress2 radialProgress2 = this.radialProgress;
int i = radialProgress2.iconColorKey;
int themedColor = i >= 0 ? getThemedColor(i) : radialProgress2.iconColor;
this.onceRadialPaint.setColor(themedColor);
this.onceRadialStrokePaint.setColor(themedColor);
this.radialProgress.mediaActionDrawable.applyShaderMatrix(false);
this.onceRadialPaint.setShader(this.radialProgress.mediaActionDrawable.paint2.getShader());
this.onceRadialStrokePaint.setShader(this.radialProgress.mediaActionDrawable.paint2.getShader());
rectF.set(this.onceFire.getBounds());
canvas.saveLayerAlpha(rectF, 255, 31);
rectF.inset(1.0f, 1.0f);
canvas.drawRect(rectF, this.onceRadialPaint);
this.onceFire.draw(canvas, this.onceRadialCutPaint);
canvas.restore();
canvas.restore();
this.onceRadialStrokePaint.setAlpha((int) (255.0f * f2));
this.onceRadialStrokePaint.setStrokeWidth(AndroidUtilities.dp(1.66f));
this.rect.set(this.radialProgress.progressRect);
this.rect.inset(AndroidUtilities.dp(3.0f), AndroidUtilities.dp(3.0f));
canvas.drawArc(this.rect, -90.0f, (1.0f - this.seekBarWaveform.explodeProgress) * (-360.0f), false, this.onceRadialStrokePaint);
if (this.timerParticles == null) {
this.timerParticles = new TimerParticles();
}
this.timerParticles.draw(canvas, this.onceRadialStrokePaint, this.rect, (1.0f - this.seekBarWaveform.explodeProgress) * (-360.0f), f2);
} else {
RLottieDrawable rLottieDrawable3 = this.onceFire;
if (rLottieDrawable3 != null) {
rLottieDrawable3.recycle(true);
this.onceFire = null;
if (this.timerParticles != null) {
this.timerParticles = null;
}
}
}
canvas.drawCircle(centerX, centerY, AndroidUtilities.dp((f * 1.5f) + 10.0f) * f, this.onceClearPaint);
canvas.restore();
if (this.oncePeriod == null) {
CaptionContainerView.PeriodDrawable periodDrawable = new CaptionContainerView.PeriodDrawable(3);
this.oncePeriod = periodDrawable;
periodDrawable.updateColors(-1, 0, 0);
CaptionContainerView.PeriodDrawable periodDrawable2 = this.oncePeriod;
periodDrawable2.diameterDp = 14.0f;
periodDrawable2.setTextSize(10.0f);
this.oncePeriod.strokePaint.setStrokeWidth(AndroidUtilities.dpf2(1.5f));
this.oncePeriod.setValue(1, false, false);
this.oncePeriod.textOffsetX = -AndroidUtilities.dpf2(0.33f);
this.oncePeriod.textOffsetY = AndroidUtilities.dpf2(0.33f);
}
CaptionContainerView.PeriodDrawable periodDrawable3 = this.oncePeriod;
periodDrawable3.diameterDp = f * 14.0f;
periodDrawable3.setTextSize(f * 10.0f);
canvas.saveLayerAlpha(centerX - AndroidUtilities.dp(10.0f), centerY - AndroidUtilities.dp(10.0f), centerX + AndroidUtilities.dp(10.0f), centerY + AndroidUtilities.dp(10.0f), 255, 31);
canvas.drawCircle(centerX, centerY, AndroidUtilities.dp(10.0f) * f, this.radialProgress.circlePaint);
this.oncePeriod.setClear(AndroidUtilities.computePerceivedBrightness(this.radialProgress.circlePaint.getColor()) > 0.8f);
this.oncePeriod.setCenterXY(centerX, centerY);
this.oncePeriod.draw(canvas, f);
canvas.restore();
return;
}
runnable.run();
}
public void drawLinkPreview(Canvas canvas, float f) {
int dp;
int extraTextX;
int i;
int dp2;
int i2;
int i3;
int dp3;
boolean z;
int i4;
int i5;
float f2;
int i6;
int i7;
int i8;
float f3;
int i9;
int i10;
int i11;
float f4;
int i12;
boolean z2;
int i13;
float f5;
int i14;
int i15;
float f6;
float f7;
float f8;
Canvas canvas2;
int i16;
int i17;
Paint themedPaint;
Drawable drawable;
float f9;
int i18;
int i19;
float f10;
MessageObject messageObject;
ReplyMessageLine replyMessageLine;
float f11;
int i20;
float f12;
int i21;
float f13;
float f14;
float f15;
int i22;
int i23;
int i24;
if (this.currentMessageObject.isSponsored() || this.hasLinkPreview || this.hasGamePreview || this.hasInvoicePreview) {
int saveCount = canvas.getSaveCount();
TransitionParams transitionParams = this.transitionParams;
if (transitionParams != null) {
float f16 = transitionParams.deltaLeft;
float f17 = transitionParams.deltaRight;
}
float backgroundDrawableRight = getBackgroundDrawableRight();
TransitionParams transitionParams2 = this.transitionParams;
float dp4 = ((backgroundDrawableRight + (transitionParams2 != null ? transitionParams2.deltaRight : 0.0f)) - AndroidUtilities.dp(10 + ((!this.currentMessageObject.isOutOwner() || this.mediaBackground || this.drawPinnedBottom) ? 0 : 6))) - getExtraTextX();
if (this.hasGamePreview) {
i2 = AndroidUtilities.dp(14.0f) + this.namesOffset;
dp2 = this.unmovedTextX - AndroidUtilities.dp(10.0f);
} else {
if (this.hasInvoicePreview) {
i2 = AndroidUtilities.dp(14.0f) + this.namesOffset;
i3 = this.unmovedTextX;
dp3 = AndroidUtilities.dp(1.0f);
} else if (this.currentMessageObject.isSponsored()) {
i2 = this.linkPreviewY - AndroidUtilities.dp(2.0f);
i3 = this.unmovedTextX;
dp3 = AndroidUtilities.dp(1.0f);
} else {
if (this.currentMessageObject.isOutOwner()) {
i = this.backgroundDrawableLeft + AndroidUtilities.dp(12.0f) + getExtraTextX();
if (this.currentMessageObject.type == 19) {
i -= Math.max(0, ((Math.max(this.replyNameWidth, this.replyTextWidth) + i) + AndroidUtilities.dp(14.0f)) - AndroidUtilities.displaySize.x);
}
} else {
if (this.mediaBackground) {
dp = this.backgroundDrawableLeft + AndroidUtilities.dp(12.0f);
extraTextX = getExtraTextX();
} else {
dp = this.backgroundDrawableLeft + AndroidUtilities.dp(this.drawPinnedBottom ? 12.0f : 18.0f);
extraTextX = getExtraTextX();
}
i = dp + extraTextX;
}
dp2 = ((int) (i + this.transitionParams.deltaLeft)) - AndroidUtilities.dp(1.33f);
i2 = this.linkPreviewY;
TransitionParams transitionParams3 = this.transitionParams;
if (transitionParams3.animateLinkPreviewY) {
i2 = AndroidUtilities.lerp(transitionParams3.animateFromLinkPreviewY, i2, transitionParams3.animateChangeProgress);
}
}
dp2 = i3 + dp3;
}
int i25 = i2;
int i26 = dp2;
float f18 = i26;
int i27 = (int) (dp4 - f18);
int i28 = this.linkPreviewHeight;
TransitionParams transitionParams4 = this.transitionParams;
if (transitionParams4 != null && transitionParams4.animateLinkPreviewHeight) {
i28 = AndroidUtilities.lerp(transitionParams4.animateFromLinkPreviewHeight, i28, transitionParams4.animateChangeProgress);
}
int i29 = i28;
if (this.linkLine == null) {
this.linkLine = new ReplyMessageLine(this);
}
Theme.chat_replyNamePaint.setColor(this.linkLine.check(this.currentMessageObject, this.currentUser, this.currentChat, this.resourcesProvider, 3));
boolean z3 = this.drawInstantView;
boolean z4 = !(!z3 || (i24 = this.drawInstantViewType) == 9 || i24 == 2 || i24 == 13 || i24 == 11 || i24 == 1 || i24 == 18) || (this.drawInstantViewType == 6 && this.imageBackgroundColor != 0);
boolean z5 = !z3 || (i23 = this.drawInstantViewType) == 9 || i23 == 2 || i23 == 11 || i23 == 13 || i23 == 1 || i23 == 18 || this.isSmallImage;
ChatMessageCellDelegate chatMessageCellDelegate = this.delegate;
boolean z6 = chatMessageCellDelegate != null && chatMessageCellDelegate.isProgressLoading(this, 2);
if (this.hasInvoicePreview || this.currentMessageObject.isGiveawayOrGiveawayResults()) {
z = z6;
i4 = 1;
i5 = i27;
f2 = f18;
i6 = i26;
i7 = 0;
} else {
if (this.linkPreviewBounce == null) {
this.linkPreviewBounce = new ButtonBounce(this, 2.0f, 2.0f);
}
canvas.save();
float scale = this.linkPreviewBounce.getScale(0.01f);
canvas.scale(scale, scale, (i27 / 2.0f) + f18, i25 + ((i29 + (this.drawInstantView ? AndroidUtilities.dp(42.0f) : 0)) / 2.0f));
RectF rectF = AndroidUtilities.rectTmp;
rectF.set(f18, i25 - AndroidUtilities.dp(6.0f), i26 + i27, i25 + i29 + (this.drawInstantView ? AndroidUtilities.dp(42.0f) : 0));
this.linkLine.setLoading(z6);
float floor = (float) Math.floor(SharedConfig.bubbleRadius / (this.currentMessageObject.isSponsored() ? 2.0f : 3.0f));
ReplyMessageLine replyMessageLine2 = this.linkLine;
if (z4) {
f15 = (1.0f - isSmallImage()) * (AndroidUtilities.dp(18.0f) + this.photoImage.getImageHeight() + (this.siteNameLayout != null ? r10.getLineBottom(r10.getLineCount() - 1) : 0));
} else {
f15 = 0.0f;
}
z = z6;
i5 = i27;
f2 = f18;
i6 = i26;
replyMessageLine2.offsetEmoji(0.0f, f15).drawBackground(canvas, rectF, floor, floor, floor, f);
int backgroundColor = this.linkLine.getBackgroundColor();
Drawable drawable2 = this.linkPreviewSelector;
if (drawable2 == null) {
this.linkPreviewSelectorColor = backgroundColor;
Drawable createRadSelectorDrawable = Theme.createRadSelectorDrawable(backgroundColor, 0, 0);
this.linkPreviewSelector = createRadSelectorDrawable;
Theme.setMaskDrawableRad(createRadSelectorDrawable, 3.0f, 6.0f, 6.0f, 3.0f);
this.linkPreviewSelector.setCallback(this);
} else if (this.linkPreviewSelectorColor != backgroundColor) {
this.linkPreviewSelectorColor = backgroundColor;
i22 = 1;
Theme.setSelectorDrawableColor(drawable2, backgroundColor, true);
this.linkPreviewSelector.setBounds((int) rectF.left, (int) rectF.top, (int) rectF.right, (int) rectF.bottom);
this.linkPreviewSelector.draw(canvas);
this.linkLine.drawLine(canvas, rectF, f);
i4 = i22;
this.linkLine.drawLoadingBackground(canvas, rectF, floor, floor, floor, f);
i7 = i4;
}
i22 = 1;
this.linkPreviewSelector.setBounds((int) rectF.left, (int) rectF.top, (int) rectF.right, (int) rectF.bottom);
this.linkPreviewSelector.draw(canvas);
this.linkLine.drawLine(canvas, rectF, f);
i4 = i22;
this.linkLine.drawLoadingBackground(canvas, rectF, floor, floor, floor, f);
i7 = i4;
}
if (this.siteNameLayout != null) {
int dp5 = i25 - AndroidUtilities.dp(1.0f);
int alpha = Theme.chat_replyNamePaint.getAlpha();
if (f != 1.0f) {
Theme.chat_replyNamePaint.setAlpha((int) (alpha * f));
}
canvas.save();
if (Math.abs(this.siteNameLeft) > 1.0f) {
i8 = i5;
f14 = ((i8 - AndroidUtilities.dp(this.hasInvoicePreview ? 0.0f : 20.0f)) - this.siteNameWidth) - this.siteNameLeft;
} else {
i8 = i5;
f14 = 0.0f;
}
f3 = f2;
canvas.translate(f3 + f14 + (this.hasInvoicePreview ? 0 : AndroidUtilities.dp(10.0f)), i25 - AndroidUtilities.dp(1.0f));
this.siteNameLayout.draw(canvas);
canvas.restore();
StaticLayout staticLayout = this.siteNameLayout;
i9 = staticLayout.getLineBottom(staticLayout.getLineCount() - i4) + i25;
Theme.chat_replyNamePaint.setAlpha(alpha);
i10 = dp5;
} else {
i8 = i5;
f3 = f2;
i9 = i25;
i10 = 0;
}
if ((this.hasGamePreview || this.hasInvoicePreview) && (i11 = this.currentMessageObject.textHeight) != 0) {
i25 += i11 + AndroidUtilities.dp(4.0f);
i9 += this.currentMessageObject.textHeight + AndroidUtilities.dp(4.0f);
}
if (this.drawPhotoImage && z4) {
if (this.isSmallImage) {
TransitionParams transitionParams5 = this.transitionParams;
if (transitionParams5 != null && transitionParams5.animateSmallImage) {
i9 = (int) (i9 + (((i9 != i25 ? AndroidUtilities.dp(2.0f) : 0) + this.transitionParams.photoImageFromHeight + AndroidUtilities.dp(6.0f)) * (1.0f - this.transitionParams.animateChangeProgress)));
}
} else {
TransitionParams transitionParams6 = this.transitionParams;
float f19 = (transitionParams6 == null || !transitionParams6.animateSmallImage) ? 1.0f : transitionParams6.animateChangeProgress;
if (i9 != i25) {
i9 = (int) (i9 + (AndroidUtilities.dp(2.0f) * f19));
}
int i30 = i9;
int dp6 = i8 - AndroidUtilities.dp(17.0f);
if (this.isSmallImage || this.drawInstantViewType != 17) {
i12 = saveCount;
z2 = z;
i20 = i6;
f12 = 0.0f;
} else {
Rect rect = AndroidUtilities.rectTmp2;
i20 = i6;
rect.set(AndroidUtilities.dp(10.0f) + i20, i30, i20 + AndroidUtilities.dp(10.0f) + dp6, ((int) this.photoImage.getImageHeight()) + i30);
RectF rectF2 = AndroidUtilities.rectTmp;
rectF2.set(rect);
if (this.gradientDrawable == null) {
TLRPC$PhotoSize tLRPC$PhotoSize = this.currentPhotoObject;
if (tLRPC$PhotoSize != null && tLRPC$PhotoSize.gradientTopColor != 0 && tLRPC$PhotoSize.gradientBottomColor != 0) {
GradientDrawable.Orientation orientation = GradientDrawable.Orientation.TOP_BOTTOM;
i12 = saveCount;
TLRPC$PhotoSize tLRPC$PhotoSize2 = this.currentPhotoObject;
z2 = z;
this.gradientDrawable = new GradientDrawable(orientation, new int[]{tLRPC$PhotoSize2.gradientTopColor, tLRPC$PhotoSize2.gradientBottomColor});
} else {
i12 = saveCount;
z2 = z;
if (this.photoImage.getBitmap() != null) {
int[] colorsSync = DominantColors.getColorsSync(false, this.photoImage.getBitmap(), Theme.isCurrentThemeDark());
this.gradientDrawable = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, colorsSync);
TLRPC$PhotoSize tLRPC$PhotoSize3 = this.currentPhotoObject;
if (tLRPC$PhotoSize3 != null) {
tLRPC$PhotoSize3.gradientTopColor = colorsSync[0];
tLRPC$PhotoSize3.gradientBottomColor = colorsSync[1];
}
}
}
} else {
i12 = saveCount;
z2 = z;
}
if (this.gradientDrawable != null) {
canvas.save();
Path path = this.drillHolePath;
if (path != null) {
path.rewind();
} else {
this.drillHolePath = new Path();
}
this.drillHolePath.addRoundRect(rectF2, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(4.0f), Path.Direction.CW);
canvas.clipPath(this.drillHolePath);
this.gradientDrawable.setBounds(rect);
this.gradientDrawable.draw(canvas);
canvas.restore();
}
f12 = (((this.instantWidth - this.photoImage.getImageWidth()) - AndroidUtilities.dp(10.0f)) - (this.transitionParams == null ? 0.0f : this.currentMessageObject.isOutOwner() ? this.transitionParams.deltaLeft : -this.transitionParams.deltaRight)) / 2.0f;
}
if (this.imageBackgroundSideColor != 0) {
int dp7 = i20 + AndroidUtilities.dp(10.0f);
ImageReceiver imageReceiver = this.photoImage;
float f20 = dp7;
imageReceiver.setImageX(f12 + f20 + ((this.imageBackgroundSideWidth - imageReceiver.getImageWidth()) / 2.0f));
this.photoImage.setImageY(i30);
this.rect.set(f20, this.photoImage.getImageY(), dp7 + this.imageBackgroundSideWidth, this.photoImage.getImageY2());
Theme.chat_instantViewPaint.setColor(ColorUtils.setAlphaComponent(this.imageBackgroundSideColor, (int) (f * 255.0f)));
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(4.0f), Theme.chat_instantViewPaint);
} else {
this.photoImage.setImageX(f12 + f3 + AndroidUtilities.dp(10.0f));
this.photoImage.setImageY(i30);
}
if (this.drawInstantViewType != 17) {
TransitionParams transitionParams7 = this.transitionParams;
if (transitionParams7 != null && transitionParams7.animateSmallImage) {
if (!this.isSmallImage && this.documentAttachType != 1) {
this.photoImage.setImageWidth((int) AndroidUtilities.lerp(transitionParams7.photoImageFromWidth, dp6, transitionParams7.animateChangeProgress));
}
ImageReceiver imageReceiver2 = this.photoImage;
imageReceiver2.setImageX(AndroidUtilities.lerp(this.transitionParams.photoImageFromCenterX, imageReceiver2.getCenterX(), this.transitionParams.animateChangeProgress) - (this.photoImage.getImageWidth() / 2.0f));
ImageReceiver imageReceiver3 = this.photoImage;
imageReceiver3.setImageY(AndroidUtilities.lerp(this.transitionParams.photoImageFromCenterY, imageReceiver3.getCenterY(), this.transitionParams.animateChangeProgress) - (this.photoImage.getImageHeight() / 2.0f));
} else if (!this.isSmallImage && this.documentAttachType != 1) {
this.photoImage.setImageWidth(dp6);
}
}
if (this.imageBackgroundColor != 0) {
this.rect.set(this.photoImage.getImageX(), this.photoImage.getImageY(), this.photoImage.getImageX2(), this.photoImage.getImageY2());
if (this.imageBackgroundGradientColor1 != 0) {
if (this.imageBackgroundGradientColor2 != 0) {
if (this.motionBackgroundDrawable == null) {
MotionBackgroundDrawable motionBackgroundDrawable = new MotionBackgroundDrawable(this.imageBackgroundColor, this.imageBackgroundGradientColor1, this.imageBackgroundGradientColor2, this.imageBackgroundGradientColor3, true);
this.motionBackgroundDrawable = motionBackgroundDrawable;
f5 = 0.0f;
if (this.imageBackgroundIntensity < 0.0f) {
this.photoImage.setGradientBitmap(motionBackgroundDrawable.getBitmap());
}
if (!this.photoImage.hasImageSet()) {
this.motionBackgroundDrawable.setRoundRadius(AndroidUtilities.dp(4.0f));
}
} else {
f5 = 0.0f;
}
} else {
f5 = 0.0f;
if (this.gradientShader == null) {
Rect gradientPoints = BackgroundGradientDrawable.getGradientPoints(AndroidUtilities.getWallpaperRotation(this.imageBackgroundGradientRotation, false), (int) this.rect.width(), (int) this.rect.height());
this.gradientShader = new LinearGradient(gradientPoints.left, gradientPoints.top, gradientPoints.right, gradientPoints.bottom, new int[]{this.imageBackgroundColor, this.imageBackgroundGradientColor1}, (float[]) null, Shader.TileMode.CLAMP);
}
Theme.chat_instantViewPaint.setShader(this.gradientShader);
if (f != 1.0f) {
Theme.chat_instantViewPaint.setAlpha((int) (f * 255.0f));
}
}
} else {
f5 = 0.0f;
Theme.chat_instantViewPaint.setShader(null);
Theme.chat_instantViewPaint.setColor(this.imageBackgroundColor);
if (f != 1.0f) {
Theme.chat_instantViewPaint.setAlpha((int) (f * 255.0f));
}
}
MotionBackgroundDrawable motionBackgroundDrawable2 = this.motionBackgroundDrawable;
if (motionBackgroundDrawable2 != null) {
RectF rectF3 = this.rect;
motionBackgroundDrawable2.setBounds((int) rectF3.left, (int) rectF3.top, (int) rectF3.right, (int) rectF3.bottom);
this.motionBackgroundDrawable.draw(canvas);
i13 = i20;
i21 = i30;
f4 = f3;
} else if (this.imageBackgroundSideColor != 0) {
i13 = i20;
i21 = i30;
f4 = f3;
canvas.drawRect(this.photoImage.getImageX(), this.photoImage.getImageY(), this.photoImage.getImageX2(), this.photoImage.getImageY2(), Theme.chat_instantViewPaint);
} else {
i13 = i20;
i21 = i30;
f4 = f3;
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(4.0f), Theme.chat_instantViewPaint);
}
Theme.chat_instantViewPaint.setShader(null);
Theme.chat_instantViewPaint.setAlpha(255);
} else {
i13 = i20;
i21 = i30;
f4 = f3;
f5 = 0.0f;
}
if (this.drawPhotoImage && this.drawInstantView && this.drawInstantViewType != 9) {
if (this.drawImageButton) {
int dp8 = AndroidUtilities.dp(48.0f);
float f21 = dp8;
int imageX = (int) (this.photoImage.getImageX() + ((this.photoImage.getImageWidth() - f21) / 2.0f));
this.buttonX = imageX;
this.buttonX = imageX;
int imageY = (int) (this.photoImage.getImageY() + ((this.photoImage.getImageHeight() - f21) / 2.0f));
this.buttonY = imageY;
this.buttonY = imageY;
RadialProgress2 radialProgress2 = this.radialProgress;
int i31 = this.buttonX;
radialProgress2.setProgressRect(i31, imageY, i31 + dp8, dp8 + imageY);
}
ChatMessageCellDelegate chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 == null || chatMessageCellDelegate2.getPinchToZoomHelper() == null || !this.delegate.getPinchToZoomHelper().isInOverlayModeFor(this)) {
if (f != 1.0f) {
this.photoImage.setAlpha(f);
if (allowDrawPhotoImage()) {
this.imageDrawn = this.photoImage.draw(canvas);
} else {
this.imageDrawn = true;
}
if (this.currentMessageObject.hasMediaSpoilers()) {
this.blurredPhotoImage.setAlpha(f);
drawBlurredPhoto(canvas);
f13 = 1.0f;
this.blurredPhotoImage.setAlpha(1.0f);
} else {
f13 = 1.0f;
}
this.photoImage.setAlpha(f13);
} else {
if (allowDrawPhotoImage()) {
this.imageDrawn = this.photoImage.draw(canvas);
} else {
this.imageDrawn = true;
}
if (this.currentMessageObject.hasMediaSpoilers()) {
drawBlurredPhoto(canvas);
}
}
}
}
TransitionParams transitionParams8 = this.transitionParams;
if (transitionParams8 != null && transitionParams8.animateChange) {
i9 = (int) (i21 + (f19 * (transitionParams8.animateToImageH + AndroidUtilities.dp(6.0f))));
} else {
i9 = (int) (i21 + (f19 * (this.photoImage.getImageHeight() + AndroidUtilities.dp(6.0f))));
}
if (!this.currentMessageObject.isOutOwner()) {
TextPaint textPaint = Theme.chat_replyNamePaint;
int i32 = Theme.key_chat_messageTextOut;
int i33 = (int) (f * 255.0f);
textPaint.setColor(ColorUtils.setAlphaComponent(getThemedColor(i32), i33));
Theme.chat_replyTextPaint.setColor(ColorUtils.setAlphaComponent(getThemedColor(i32), i33));
} else {
TextPaint textPaint2 = Theme.chat_replyNamePaint;
int i34 = Theme.key_chat_messageTextIn;
int i35 = (int) (f * 255.0f);
textPaint2.setColor(ColorUtils.setAlphaComponent(getThemedColor(i34), i35));
Theme.chat_replyTextPaint.setColor(ColorUtils.setAlphaComponent(getThemedColor(i34), i35));
}
if (this.titleLayout != null) {
if (i9 != i25) {
i9 += AndroidUtilities.dp(4.0f);
f11 = 1.0f;
AndroidUtilities.dp(1.0f);
} else {
f11 = 1.0f;
}
if (i10 == 0) {
i10 = i9 - AndroidUtilities.dp(f11);
}
canvas.save();
float dp9 = i13 + AndroidUtilities.dp(10.0f) + (Math.abs(this.titleLayoutLeft) > 1 ? ((i8 - AndroidUtilities.dp(20.0f)) - this.titleLayoutWidth) - this.titleLayoutLeft : 0);
float dp10 = i9 - AndroidUtilities.dp(3.0f);
TransitionParams transitionParams9 = this.transitionParams;
canvas.translate(dp9, dp10 + (!transitionParams9.animateLinkPreviewY ? transitionParams9.deltaBottom + (-transitionParams9.deltaTop) : f5));
TextPaint paint = this.titleLayout.getPaint();
int alpha2 = paint.getAlpha();
paint.setAlpha((int) (alpha2 * f));
this.titleLayout.draw(canvas);
paint.setAlpha(alpha2);
canvas.restore();
StaticLayout staticLayout2 = this.titleLayout;
i9 += staticLayout2.getLineBottom(staticLayout2.getLineCount() - 1);
}
if (this.authorLayout != null) {
if (i9 != i25) {
i9 += AndroidUtilities.dp(2.0f);
}
if (i10 == 0) {
i10 = i9 - AndroidUtilities.dp(1.0f);
}
canvas.save();
float dp11 = i13 + AndroidUtilities.dp(10.0f) + (Math.abs(this.authorLayoutLeft) > 1 ? ((i8 - AndroidUtilities.dp(20.0f)) - this.authorLayoutWidth) - this.authorLayoutLeft : 0);
float dp12 = i9 - AndroidUtilities.dp(3.0f);
TransitionParams transitionParams10 = this.transitionParams;
canvas.translate(dp11, dp12 + (!transitionParams10.animateLinkPreviewY ? transitionParams10.deltaBottom + (-transitionParams10.deltaTop) : f5));
TextPaint paint2 = this.authorLayout.getPaint();
int alpha3 = paint2.getAlpha();
paint2.setAlpha((int) (alpha3 * f));
this.authorLayout.draw(canvas);
paint2.setAlpha(alpha3);
canvas.restore();
StaticLayout staticLayout3 = this.authorLayout;
i9 += staticLayout3.getLineBottom(staticLayout3.getLineCount() - 1);
}
if (this.descriptionLayout == null) {
if (i9 != i25) {
i9 += AndroidUtilities.dp(2.0f);
}
int i36 = i9;
if (i10 == 0) {
i10 = i36 - AndroidUtilities.dp(1.0f);
}
this.descriptionY = i36 - AndroidUtilities.dp(3.0f);
canvas.save();
float dp13 = i13 + AndroidUtilities.dp(10.0f) + (Math.abs(this.descriptionLayoutLeft) > 1 ? ((i8 - AndroidUtilities.dp(20.0f)) - this.descriptionLayoutWidth) - this.descriptionLayoutLeft : 0);
float f22 = this.descriptionY;
TransitionParams transitionParams11 = this.transitionParams;
canvas.translate(dp13, f22 + (!transitionParams11.animateLinkPreviewY ? (-transitionParams11.deltaTop) + transitionParams11.deltaBottom : f5));
if (this.linkBlockNum == -10 && this.links.draw(canvas)) {
invalidate();
}
drawProgressLoadingLink(canvas, -2);
ChatMessageCellDelegate chatMessageCellDelegate3 = this.delegate;
if (chatMessageCellDelegate3 != null && chatMessageCellDelegate3.getTextSelectionHelper() != null && getDelegate().getTextSelectionHelper().isSelected(this.currentMessageObject)) {
this.delegate.getTextSelectionHelper().drawDescription(this.currentMessageObject.isOutOwner(), this.descriptionLayout, canvas);
}
TextPaint paint3 = this.descriptionLayout.getPaint();
if (i7 != 0 && (messageObject = this.currentMessageObject) != null && !messageObject.isOutOwner() && (replyMessageLine = this.linkLine) != null) {
paint3.linkColor = replyMessageLine.getColor();
}
int alpha4 = paint3.getAlpha();
paint3.setAlpha((int) (alpha4 * f));
this.descriptionLayout.draw(canvas);
paint3.setAlpha(alpha4);
StaticLayout staticLayout4 = this.descriptionLayout;
i14 = i25;
i15 = i8;
f8 = 2.0f;
f6 = f4;
f7 = 1.0f;
AnimatedEmojiSpan.drawAnimatedEmojis(canvas, staticLayout4, this.animatedEmojiDescriptionStack, 0.0f, null, 0.0f, 0.0f, 0.0f, 1.0f, getAdaptiveEmojiColorFilter(1, staticLayout4.getPaint().getColor()));
canvas.restore();
paint3.linkColor = getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_messageLinkOut : Theme.key_chat_messageLinkIn);
StaticLayout staticLayout5 = this.descriptionLayout;
i9 = i36 + staticLayout5.getLineBottom(staticLayout5.getLineCount() - 1);
} else {
i14 = i25;
i15 = i8;
f6 = f4;
f7 = 1.0f;
f8 = 2.0f;
}
int i37 = i10;
if (this.drawPhotoImage || !z5) {
canvas2 = canvas;
i16 = i15;
} else {
if (i9 != i14) {
i9 += AndroidUtilities.dp(f8);
}
i16 = i15;
int dp14 = i16 - AndroidUtilities.dp(17.0f);
if (this.isSmallImage) {
ImageReceiver imageReceiver4 = this.photoImage;
imageReceiver4.setImageX(((i13 + i16) - imageReceiver4.getImageWidth()) - AndroidUtilities.dp(6.0f));
this.photoImage.setImageY(i37);
} else {
this.photoImage.setImageX((this.hasInvoicePreview ? -AndroidUtilities.dp(6.3f) : AndroidUtilities.dp(10.0f)) + i13);
this.photoImage.setImageY(i9);
}
TransitionParams transitionParams12 = this.transitionParams;
if (transitionParams12 != null && transitionParams12.animateSmallImage) {
if (!this.isSmallImage && this.documentAttachType != 1) {
this.photoImage.setImageWidth((int) AndroidUtilities.lerp(transitionParams12.photoImageFromWidth, dp14, transitionParams12.animateChangeProgress));
}
ImageReceiver imageReceiver5 = this.photoImage;
imageReceiver5.setImageX(AndroidUtilities.lerp(this.transitionParams.photoImageFromCenterX, imageReceiver5.getCenterX(), this.transitionParams.animateChangeProgress) - (this.photoImage.getImageWidth() / f8));
ImageReceiver imageReceiver6 = this.photoImage;
imageReceiver6.setImageY(AndroidUtilities.lerp(this.transitionParams.photoImageFromCenterY, imageReceiver6.getCenterY(), this.transitionParams.animateChangeProgress) - (this.photoImage.getImageHeight() / f8));
} else if (!this.isSmallImage && (i19 = this.documentAttachType) != 7 && i19 != 1) {
this.photoImage.setImageWidth(dp14);
}
if (!this.isSmallImage && this.drawImageButton) {
int dp15 = AndroidUtilities.dp(48.0f);
float f23 = dp15;
int imageX2 = (int) (this.photoImage.getImageX() + ((this.photoImage.getImageWidth() - f23) / f8));
this.buttonX = imageX2;
this.buttonX = imageX2;
int imageY2 = (int) (this.photoImage.getImageY() + ((this.photoImage.getImageHeight() - f23) / f8));
this.buttonY = imageY2;
this.buttonY = imageY2;
RadialProgress2 radialProgress22 = this.radialProgress;
int i38 = this.buttonX;
radialProgress22.setProgressRect(i38, imageY2, i38 + dp15, dp15 + imageY2);
}
if (this.isRoundVideo && MediaController.getInstance().isPlayingMessage(this.currentMessageObject) && MediaController.getInstance().isVideoDrawingReady() && canvas.isHardwareAccelerated()) {
this.imageDrawn = true;
this.drawTime = true;
} else {
ChatMessageCellDelegate chatMessageCellDelegate4 = this.delegate;
if (chatMessageCellDelegate4 == null || chatMessageCellDelegate4.getPinchToZoomHelper() == null || !this.delegate.getPinchToZoomHelper().isInOverlayModeFor(this)) {
if (f != f7) {
this.photoImage.setAlpha(f);
if (allowDrawPhotoImage()) {
canvas2 = canvas;
f10 = f7;
this.imageDrawn = this.photoImage.draw(canvas2);
} else {
canvas2 = canvas;
f10 = f7;
this.imageDrawn = true;
}
if (this.currentMessageObject.hasMediaSpoilers()) {
this.blurredPhotoImage.setAlpha(f);
drawBlurredPhoto(canvas);
this.blurredPhotoImage.setAlpha(f10);
}
this.photoImage.setAlpha(f10);
} else {
canvas2 = canvas;
if (allowDrawPhotoImage()) {
this.imageDrawn = this.photoImage.draw(canvas2);
} else {
this.imageDrawn = true;
}
if (this.currentMessageObject.hasMediaSpoilers()) {
drawBlurredPhoto(canvas);
}
}
}
}
canvas2 = canvas;
}
i17 = this.documentAttachType;
if (i17 != 4 || i17 == 2) {
this.videoButtonX = (int) (this.photoImage.getImageX() + AndroidUtilities.dp(8.0f));
int imageY3 = (int) (this.photoImage.getImageY() + AndroidUtilities.dp(8.0f));
this.videoButtonY = imageY3;
RadialProgress2 radialProgress23 = this.videoRadialProgress;
int i39 = this.videoButtonX;
radialProgress23.setProgressRect(i39, imageY3, AndroidUtilities.dp(24.0f) + i39, this.videoButtonY + AndroidUtilities.dp(24.0f));
}
themedPaint = getThemedPaint("paintChatTimeBackground");
if (this.photosCountLayout != null && this.photoImage.getVisible()) {
int imageX3 = (int) (((this.photoImage.getImageX() + this.photoImage.getImageWidth()) - AndroidUtilities.dp(8.0f)) - this.photosCountWidth);
int imageY4 = (int) ((this.photoImage.getImageY() + this.photoImage.getImageHeight()) - AndroidUtilities.dp(19.0f));
this.rect.set(imageX3 - AndroidUtilities.dp(4.0f), imageY4 - AndroidUtilities.dp(1.5f), this.photosCountWidth + imageX3 + AndroidUtilities.dp(4.0f), imageY4 + AndroidUtilities.dp(14.5f));
int alpha5 = themedPaint.getAlpha();
themedPaint.setAlpha((int) (alpha5 * this.controlsAlpha));
Theme.chat_durationPaint.setAlpha((int) (this.controlsAlpha * 255.0f));
canvas2.drawRoundRect(this.rect, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(4.0f), themedPaint);
themedPaint.setAlpha(alpha5);
canvas.save();
canvas2.translate(imageX3, imageY4);
this.photosCountLayout.draw(canvas2);
canvas.restore();
Theme.chat_durationPaint.setAlpha(255);
}
if (this.videoInfoLayout != null && ((!this.drawPhotoImage || this.photoImage.getVisible()) && this.imageBackgroundSideColor == 0)) {
if (!this.hasGamePreview || this.hasInvoicePreview || this.documentAttachType == 8) {
if (this.drawPhotoImage) {
i18 = i13;
} else {
int imageX4 = (int) (this.photoImage.getImageX() + AndroidUtilities.dp(8.5f));
int imageY5 = (int) (this.photoImage.getImageY() + AndroidUtilities.dp(6.0f));
this.rect.set(imageX4 - AndroidUtilities.dp(4.0f), imageY5 - AndroidUtilities.dp(1.5f), this.durationWidth + imageX4 + AndroidUtilities.dp(4.0f), AndroidUtilities.dp(this.documentAttachType == 8 ? 14.5f : 16.5f) + imageY5);
canvas2.drawRoundRect(this.rect, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(4.0f), themedPaint);
i18 = imageX4;
i9 = imageY5;
}
} else {
int imageX5 = (int) (((this.photoImage.getImageX() + this.photoImage.getImageWidth()) - AndroidUtilities.dp(8.0f)) - this.durationWidth);
int imageY6 = (int) ((this.photoImage.getImageY() + this.photoImage.getImageHeight()) - AndroidUtilities.dp(19.0f));
this.rect.set(imageX5 - AndroidUtilities.dp(4.0f), imageY6 - AndroidUtilities.dp(1.5f), this.durationWidth + imageX5 + AndroidUtilities.dp(4.0f), AndroidUtilities.dp(14.5f) + imageY6);
canvas2.drawRoundRect(this.rect, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(4.0f), getThemedPaint("paintChatTimeBackground"));
i18 = imageX5;
i9 = imageY6;
}
canvas.save();
canvas2.translate(i18, i9);
if (this.hasInvoicePreview) {
if (this.drawPhotoImage) {
Theme.chat_shipmentPaint.setColor(getThemedColor(Theme.key_chat_previewGameText));
} else if (this.currentMessageObject.isOutOwner()) {
Theme.chat_shipmentPaint.setColor(getThemedColor(Theme.key_chat_messageTextOut));
} else {
Theme.chat_shipmentPaint.setColor(getThemedColor(Theme.key_chat_messageTextIn));
}
}
this.videoInfoLayout.draw(canvas2);
canvas.restore();
}
this.giveawayMessageCell.draw(canvas2, this.namesOffset, i13, this.resourcesProvider);
this.giveawayResultsMessageCell.draw(canvas2, this.namesOffset, i13, this.resourcesProvider);
if (this.drawInstantView) {
if (this.currentMessageObject.isOutOwner()) {
Drawable themedDrawable = getThemedDrawable("drawableMsgOutInstant");
TextPaint textPaint3 = Theme.chat_instantViewPaint;
int i40 = Theme.key_chat_outPreviewInstantText;
textPaint3.setColor(getThemedColor(i40));
Theme.chat_instantViewButtonPaint.setColor(Theme.multAlpha(getThemedColor(i40), 0.1f));
LoadingDrawable loadingDrawable = this.instantButtonLoading;
if (loadingDrawable != null) {
loadingDrawable.setColors(Theme.multAlpha(getThemedColor(i40), 0.1f), Theme.multAlpha(getThemedColor(i40), 0.3f), Theme.multAlpha(getThemedColor(i40), 0.3f), Theme.multAlpha(getThemedColor(i40), 1.2f));
}
drawable = themedDrawable;
} else {
int themedColor = getThemedColor(Theme.key_chat_inPreviewInstantText);
ReplyMessageLine replyMessageLine3 = this.linkLine;
if (replyMessageLine3 != null) {
themedColor = replyMessageLine3.getColor();
}
if (this.instantDrawable == null) {
if (this.drawInstantViewType == 16) {
this.instantDrawable = getContext().getResources().getDrawable(org.telegram.messenger.R.drawable.mini_external_link).mutate();
} else {
this.instantDrawable = getContext().getResources().getDrawable(org.telegram.messenger.R.drawable.msg_instant).mutate();
}
}
if (this.instantDrawableColor != themedColor) {
Drawable drawable3 = this.instantDrawable;
this.instantDrawableColor = themedColor;
drawable3.setColorFilter(new PorterDuffColorFilter(themedColor, PorterDuff.Mode.SRC_IN));
}
Drawable drawable4 = this.instantDrawable;
Theme.chat_instantViewPaint.setColor(themedColor);
Theme.chat_instantViewButtonPaint.setColor(Theme.multAlpha(themedColor, 0.1f));
LoadingDrawable loadingDrawable2 = this.instantButtonLoading;
if (loadingDrawable2 != null) {
loadingDrawable2.setColors(Theme.multAlpha(themedColor, 0.1f), Theme.multAlpha(themedColor, 0.3f), Theme.multAlpha(themedColor, 0.3f), Theme.multAlpha(themedColor, 1.2f));
}
drawable = drawable4;
}
if (i7 != 0) {
int dp16 = i14 + i29 + AndroidUtilities.dp(14.0f);
int alpha6 = Theme.chat_instantViewPaint.getAlpha();
Theme.chat_instantViewPaint.setAlpha((int) (alpha6 * 0.18f));
canvas.drawRect(AndroidUtilities.dp(10.0f) + i13, AndroidUtilities.dp(f8) + r1, (i13 + i16) - AndroidUtilities.dp(7.0f), r1 + AndroidUtilities.dp(f8) + Math.max(1, AndroidUtilities.dp(0.66f)), Theme.chat_instantViewPaint);
Theme.chat_instantViewPaint.setAlpha(alpha6);
float dp17 = AndroidUtilities.dp(this.drawInstantViewType == 0 ? 15.0f : 0.0f) + this.instantViewLayoutWidth;
float f24 = f6 + ((i16 - dp17) / f8);
int i41 = this.drawInstantViewType;
if (i41 == 0) {
BaseCell.setDrawableBounds(drawable, f24, AndroidUtilities.dp(1.0f) + dp16, AndroidUtilities.dp(9.0f), AndroidUtilities.dp(13.0f));
drawable.setAlpha((int) (f * 255.0f));
drawable.draw(canvas2);
f24 += AndroidUtilities.dp(15.0f);
} else if (i41 == 16) {
f24 -= AndroidUtilities.dp(11.0f);
BaseCell.setDrawableBounds(drawable, dp17 + f24 + AndroidUtilities.dp(4.0f), dp16 - AndroidUtilities.dp(f8), AndroidUtilities.dp(18.0f), AndroidUtilities.dp(18.0f));
drawable.setAlpha((int) (f * 255.0f));
drawable.draw(canvas2);
}
if (this.instantViewLayout != null) {
canvas.save();
canvas2.translate(f24 - this.instantViewLayoutLeft, dp16);
this.instantViewLayout.draw(canvas2);
canvas.restore();
}
} else {
float f25 = f6;
int dp18 = i14 + i29 + AndroidUtilities.dp(10.0f);
LoadingDrawable loadingDrawable3 = this.instantButtonLoading;
if (loadingDrawable3 != null && !z2 && !loadingDrawable3.isDisappeared() && !this.instantButtonLoading.isDisappearing()) {
this.instantButtonLoading.disappear();
}
LoadingDrawable loadingDrawable4 = this.instantButtonLoading;
if (loadingDrawable4 == null && z2) {
LoadingDrawable loadingDrawable5 = new LoadingDrawable();
this.instantButtonLoading = loadingDrawable5;
loadingDrawable5.strokePaint.setStrokeWidth(AndroidUtilities.dp(1.25f));
this.instantButtonLoading.setAppearByGradient(true);
} else if (loadingDrawable4 != null && z2 && (loadingDrawable4.isDisappeared() || this.instantButtonLoading.isDisappearing())) {
this.instantButtonLoading.reset();
this.instantButtonLoading.resetDisappear();
}
this.instantButtonRect.set(f25, dp18, i13 + this.instantWidth, AndroidUtilities.dp(36.0f) + dp18);
float scale2 = this.instantButtonBounce.getScale(0.02f);
boolean z7 = scale2 != 1.0f;
if (z7) {
canvas.save();
canvas2.scale(scale2, scale2, this.instantButtonRect.centerX(), this.instantButtonRect.centerY());
}
if (Build.VERSION.SDK_INT >= 21) {
this.selectorDrawableMaskType[0] = 0;
createSelectorDrawable(0);
this.selectorDrawable[0].setBounds(i13, dp18, i13 + this.instantWidth, AndroidUtilities.dp(36.0f) + dp18);
this.selectorDrawable[0].draw(canvas2);
}
LoadingDrawable loadingDrawable6 = this.instantButtonLoading;
if (loadingDrawable6 == null || loadingDrawable6.isDisappeared()) {
f9 = 6.0f;
} else {
this.instantButtonLoading.setBounds(this.instantButtonRect);
f9 = 6.0f;
this.instantButtonLoading.setRadiiDp(6.0f);
this.instantButtonLoading.draw(canvas2);
invalidate();
}
canvas2.drawRoundRect(this.instantButtonRect, AndroidUtilities.dp(f9), AndroidUtilities.dp(f9), Theme.chat_instantViewButtonPaint);
int i42 = this.drawInstantViewType;
if (i42 == 0) {
BaseCell.setDrawableBounds(drawable, ((this.instantTextLeftX + this.instantTextX) + i13) - AndroidUtilities.dp(15.0f), AndroidUtilities.dp(11.5f) + dp18, AndroidUtilities.dp(9.0f), AndroidUtilities.dp(13.0f));
drawable.setAlpha((int) (f * 255.0f));
drawable.draw(canvas2);
} else if (i42 == 16) {
if (this.instantLinkArrowPaint == null) {
Paint paint4 = new Paint(1);
this.instantLinkArrowPaint = paint4;
paint4.setStyle(Paint.Style.STROKE);
this.instantLinkArrowPaint.setStrokeCap(Paint.Cap.ROUND);
this.instantLinkArrowPaint.setStrokeJoin(Paint.Join.ROUND);
}
this.instantLinkArrowPaint.setColor(Theme.chat_instantViewPaint.getColor());
this.instantLinkArrowPaint.setStrokeWidth(AndroidUtilities.dpf2(1.333f));
Path path2 = this.instantLinkArrowPath;
if (path2 == null) {
this.instantLinkArrowPath = new Path();
} else {
path2.rewind();
}
this.instantLinkArrowPath.moveTo(this.instantButtonRect.right - AndroidUtilities.dp(11.0f), this.instantButtonRect.top + AndroidUtilities.dp(6.0f));
this.instantLinkArrowPath.lineTo(this.instantButtonRect.right - AndroidUtilities.dp(6.0f), this.instantButtonRect.top + AndroidUtilities.dp(6.0f));
this.instantLinkArrowPath.lineTo(this.instantButtonRect.right - AndroidUtilities.dp(6.0f), this.instantButtonRect.top + AndroidUtilities.dp(11.0f));
this.instantLinkArrowPath.moveTo(this.instantButtonRect.right - AndroidUtilities.dpf2(11.66f), this.instantButtonRect.top + AndroidUtilities.dp(11.66f));
this.instantLinkArrowPath.lineTo(this.instantButtonRect.right - AndroidUtilities.dp(6.0f), this.instantButtonRect.top + AndroidUtilities.dp(6.0f));
canvas2.drawPath(this.instantLinkArrowPath, this.instantLinkArrowPaint);
}
if (this.instantViewLayout != null) {
canvas.save();
canvas2.translate(i13 + this.instantTextX, dp18 + AndroidUtilities.dp(10.5f));
this.instantViewLayout.draw(canvas2);
canvas.restore();
}
if (z7) {
canvas.restore();
}
}
}
canvas2.restoreToCount(i12);
}
}
f4 = f3;
i12 = saveCount;
z2 = z;
i13 = i6;
f5 = 0.0f;
if (!this.currentMessageObject.isOutOwner()) {
}
if (this.titleLayout != null) {
}
if (this.authorLayout != null) {
}
if (this.descriptionLayout == null) {
}
int i372 = i10;
if (this.drawPhotoImage) {
}
canvas2 = canvas;
i16 = i15;
i17 = this.documentAttachType;
if (i17 != 4) {
}
this.videoButtonX = (int) (this.photoImage.getImageX() + AndroidUtilities.dp(8.0f));
int imageY32 = (int) (this.photoImage.getImageY() + AndroidUtilities.dp(8.0f));
this.videoButtonY = imageY32;
RadialProgress2 radialProgress232 = this.videoRadialProgress;
int i392 = this.videoButtonX;
radialProgress232.setProgressRect(i392, imageY32, AndroidUtilities.dp(24.0f) + i392, this.videoButtonY + AndroidUtilities.dp(24.0f));
themedPaint = getThemedPaint("paintChatTimeBackground");
if (this.photosCountLayout != null) {
int imageX32 = (int) (((this.photoImage.getImageX() + this.photoImage.getImageWidth()) - AndroidUtilities.dp(8.0f)) - this.photosCountWidth);
int imageY42 = (int) ((this.photoImage.getImageY() + this.photoImage.getImageHeight()) - AndroidUtilities.dp(19.0f));
this.rect.set(imageX32 - AndroidUtilities.dp(4.0f), imageY42 - AndroidUtilities.dp(1.5f), this.photosCountWidth + imageX32 + AndroidUtilities.dp(4.0f), imageY42 + AndroidUtilities.dp(14.5f));
int alpha52 = themedPaint.getAlpha();
themedPaint.setAlpha((int) (alpha52 * this.controlsAlpha));
Theme.chat_durationPaint.setAlpha((int) (this.controlsAlpha * 255.0f));
canvas2.drawRoundRect(this.rect, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(4.0f), themedPaint);
themedPaint.setAlpha(alpha52);
canvas.save();
canvas2.translate(imageX32, imageY42);
this.photosCountLayout.draw(canvas2);
canvas.restore();
Theme.chat_durationPaint.setAlpha(255);
}
if (this.videoInfoLayout != null) {
if (!this.hasGamePreview) {
}
if (this.drawPhotoImage) {
}
canvas.save();
canvas2.translate(i18, i9);
if (this.hasInvoicePreview) {
}
this.videoInfoLayout.draw(canvas2);
canvas.restore();
}
this.giveawayMessageCell.draw(canvas2, this.namesOffset, i13, this.resourcesProvider);
this.giveawayResultsMessageCell.draw(canvas2, this.namesOffset, i13, this.resourcesProvider);
if (this.drawInstantView) {
}
canvas2.restoreToCount(i12);
}
}
private float isSmallImage() {
TransitionParams transitionParams = this.transitionParams;
if (!transitionParams.animateSmallImage) {
return this.isSmallImage ? 1.0f : 0.0f;
}
boolean z = this.isSmallImage;
float f = transitionParams.animateChangeProgress;
return z ? f : 1.0f - f;
}
public boolean shouldDrawMenuDrawable() {
MessageObject messageObject;
return (this.currentMessagesGroup == null || (this.currentPosition.flags & 4) != 0) && !this.hasLinkPreview && ((messageObject = this.currentMessageObject) == null || !messageObject.isRepostPreview);
}
private void drawContact(Canvas canvas) {
boolean z;
boolean z2;
boolean z3;
float f;
if (this.contactLine == null) {
this.contactLine = new ReplyMessageLine(this);
}
int check = this.contactLine.check(this.currentMessageObject, this.currentUser, this.currentChat, this.resourcesProvider, 4);
if (this.contactBounce == null) {
this.contactBounce = new ButtonBounce(this, 2.0f, 2.0f);
}
int imageX = (int) (this.photoImage.getImageX() - AndroidUtilities.dp(13.0f));
int dp = this.layoutHeight - AndroidUtilities.dp(62.0f);
ReactionsLayoutInBubble reactionsLayoutInBubble = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble.isEmpty && !reactionsLayoutInBubble.isSmall) {
dp -= reactionsLayoutInBubble.totalHeight;
}
if (this.drawCommentButton) {
dp -= AndroidUtilities.dp(shouldDrawTimeOnMedia() ? 39.3f : 41.0f);
}
int i = dp;
if (this.contactRect == null) {
this.contactRect = new RectF();
}
int backgroundDrawableRight = (getBackgroundDrawableRight() - (AndroidUtilities.dp(10.0f) + ((!this.currentMessageObject.isOutOwner() || this.mediaBackground || this.drawPinnedBottom) ? 0 : AndroidUtilities.dp(6.0f)))) - getExtraTextX();
this.contactRect.set(imageX, this.photoImage.getImageY() - AndroidUtilities.dp(9.0f), backgroundDrawableRight, AndroidUtilities.dp(38.0f) + i);
float scale = this.contactBounce.getScale(0.0125f);
boolean z4 = scale != 1.0f;
if (z4) {
canvas.save();
canvas.scale(scale, scale, this.contactRect.centerX(), this.contactRect.centerY());
}
if (Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr = this.selectorDrawable;
if (drawableArr[0] != null) {
this.selectorDrawableMaskType[0] = 0;
drawableArr[0].setBounds(imageX, (int) (this.photoImage.getImageY() - AndroidUtilities.dp(9.0f)), backgroundDrawableRight, AndroidUtilities.dp(38.0f) + i);
this.selectorDrawable[0].draw(canvas);
}
}
float floor = (float) Math.floor(SharedConfig.bubbleRadius / 3.0f);
int i2 = (int) floor;
this.contactLine.drawBackground(canvas, this.contactRect, floor, floor, floor, 1.0f);
this.contactLine.drawLine(canvas, this.contactRect, 1.0f);
Theme.chat_contactNamePaint.setColor(check);
Theme.chat_contactPhonePaint.setColor(getThemedColor(Theme.key_chat_inContactPhoneSelectedText));
if (this.currentMessageObject.isOutOwner()) {
Theme.chat_contactPhonePaint.setColor(getThemedColor(Theme.key_chat_messageTextOut));
} else {
Theme.chat_contactPhonePaint.setColor(getThemedColor(Theme.key_chat_messageTextIn));
}
if (this.titleLayout != null) {
canvas.save();
canvas.translate(this.photoImage.getImageX() + this.photoImage.getImageWidth() + AndroidUtilities.dp(9.0f), AndroidUtilities.dp(27.0f) + this.namesOffset);
this.titleLayout.draw(canvas);
canvas.restore();
}
if (this.docTitleLayout != null) {
canvas.save();
canvas.translate(this.photoImage.getImageX() + this.photoImage.getImageWidth() + AndroidUtilities.dp(9.0f), AndroidUtilities.dp(50.0f) + this.namesOffset);
this.docTitleLayout.draw(canvas);
canvas.restore();
}
ArrayList<InstantViewButton> arrayList = this.contactButtons;
if (arrayList != null && arrayList.size() > 0) {
Theme.chat_instantViewPaint.setColor(check);
Theme.chat_instantViewButtonPaint.setColor(Theme.multAlpha(check, 0.1f));
int alpha = Theme.chat_instantViewPaint.getAlpha();
Theme.chat_instantViewPaint.setAlpha((int) (alpha * 0.18f));
canvas.drawRect(AndroidUtilities.dp(10.0f) + this.contactRect.left, AndroidUtilities.dp(2.0f) + i, this.contactRect.right - AndroidUtilities.dp(7.0f), AndroidUtilities.dp(2.0f) + i + Math.max(1, AndroidUtilities.dp(0.66f)), Theme.chat_instantViewPaint);
Theme.chat_instantViewPaint.setAlpha(alpha);
int dp2 = i + AndroidUtilities.dp(2.0f);
float dp3 = imageX + AndroidUtilities.dp(3.0f);
ArrayList<InstantViewButton> arrayList2 = this.contactButtons;
boolean z5 = arrayList2 != null && arrayList2.size() > 1;
int backgroundColor = this.contactLine.getBackgroundColor();
int i3 = 0;
while (i3 < this.contactButtons.size()) {
InstantViewButton instantViewButton = this.contactButtons.get(i3);
float min = Math.min(instantViewButton.buttonWidth + dp3, this.contactRect.right);
instantViewButton.rect.set(dp3, dp2, min, AndroidUtilities.dp(36.0f) + dp2);
if (z5 && instantViewButton.selectorDrawable == null) {
this.linkPreviewSelectorColor = backgroundColor;
z = true;
z2 = false;
instantViewButton.selectorDrawable = Theme.createRadSelectorDrawable(backgroundColor, 0, 0, i3 == this.contactButtons.size() - 1 ? i2 : 0, 0);
} else {
z = true;
z2 = false;
}
if (instantViewButton.selectorDrawable != null) {
instantViewButton.selectorDrawable.setBounds((int) dp3, dp2, (int) min, AndroidUtilities.dp(36.0f) + dp2);
instantViewButton.selectorDrawable.draw(canvas);
}
if (z4 || instantViewButton.buttonBounce == null) {
z3 = z2;
f = 1.0f;
} else {
f = instantViewButton.buttonBounce.getScale(0.02f);
z3 = f != 1.0f ? z : z2;
}
if (z3) {
canvas.save();
canvas.scale(f, f, instantViewButton.rect.centerX(), instantViewButton.rect.centerY());
}
if (instantViewButton.layout != null) {
canvas.save();
canvas.translate(instantViewButton.textX + dp3, AndroidUtilities.dp(10.5f) + dp2);
instantViewButton.layout.draw(canvas);
canvas.restore();
}
if (z3) {
canvas.restore();
}
dp3 += instantViewButton.buttonWidth;
i3++;
}
}
if (z4) {
canvas.restore();
}
}
private void drawBotButtons(Canvas canvas, ArrayList<BotButton> arrayList, int i) {
int dp;
Drawable themedDrawable;
ChatMessageCellDelegate chatMessageCellDelegate;
MessageObject messageObject = this.currentMessageObject;
float f = 1.0f;
if (messageObject != null && messageObject.isOutOwner()) {
dp = (getMeasuredWidth() - this.widthForButtons) - AndroidUtilities.dp(10.0f);
} else {
dp = this.backgroundDrawableLeft + AndroidUtilities.dp((this.mediaBackground || this.drawPinnedBottom) ? 1.0f : 7.0f);
}
float f2 = 2.0f;
float dp2 = (this.layoutHeight - AndroidUtilities.dp(2.0f)) + this.transitionParams.deltaBottom;
float f3 = 0.0f;
for (int i2 = 0; i2 < arrayList.size(); i2++) {
BotButton botButton = arrayList.get(i2);
float f4 = botButton.y + botButton.height;
if (f4 > f3) {
f3 = f4;
}
}
this.rect.set(0.0f, dp2, getMeasuredWidth(), f3 + dp2);
if (i != 255) {
canvas.saveLayerAlpha(this.rect, i, 31);
} else {
canvas.save();
}
int i3 = 0;
while (i3 < arrayList.size()) {
BotButton botButton2 = arrayList.get(i3);
float dp3 = ((botButton2.y + this.layoutHeight) - AndroidUtilities.dp(f2)) + this.transitionParams.deltaBottom;
float pressScale = botButton2.getPressScale();
this.rect.set(botButton2.x + dp, dp3, botButton2.x + dp + botButton2.width, botButton2.height + dp3);
canvas.save();
if (pressScale != f) {
canvas.scale(pressScale, pressScale, this.rect.centerX(), this.rect.centerY());
}
applyServiceShaderMatrix();
Arrays.fill(this.botButtonRadii, AndroidUtilities.dp(Math.min(6.75f, SharedConfig.bubbleRadius)));
if (botButton2.hasPositionFlag(9)) {
float[] fArr = this.botButtonRadii;
float dp4 = AndroidUtilities.dp(SharedConfig.bubbleRadius);
fArr[7] = dp4;
fArr[6] = dp4;
}
if (botButton2.hasPositionFlag(10)) {
float[] fArr2 = this.botButtonRadii;
float dp5 = AndroidUtilities.dp(SharedConfig.bubbleRadius);
fArr2[5] = dp5;
fArr2[4] = dp5;
}
this.botButtonPath.rewind();
this.botButtonPath.addRoundRect(this.rect, this.botButtonRadii, Path.Direction.CW);
canvas.drawPath(this.botButtonPath, getThemedPaint("paintChatActionBackground"));
if (hasGradientService()) {
canvas.drawPath(this.botButtonPath, Theme.chat_actionBackgroundGradientDarkenPaint);
}
boolean z = (((botButton2.button instanceof TLRPC$TL_keyboardButtonCallback) || (botButton2.button instanceof TLRPC$TL_keyboardButtonGame) || (botButton2.button instanceof TLRPC$TL_keyboardButtonBuy) || (botButton2.button instanceof TLRPC$TL_keyboardButtonUrlAuth)) && SendMessagesHelper.getInstance(this.currentAccount).isSendingCallback(this.currentMessageObject, botButton2.button)) || ((botButton2.button instanceof TLRPC$TL_keyboardButtonRequestGeoLocation) && SendMessagesHelper.getInstance(this.currentAccount).isSendingCurrentLocation(this.currentMessageObject, botButton2.button)) || ((botButton2.button instanceof TLRPC$TL_keyboardButtonUrl) && (chatMessageCellDelegate = this.delegate) != null && chatMessageCellDelegate.isProgressLoading(this, 3) && this.delegate.getProgressLoadingBotButtonUrl(this) == botButton2.button.url);
canvas.save();
canvas.clipPath(this.botButtonPath);
if (z) {
if (botButton2.loadingDrawable == null) {
botButton2.loadingDrawable = new LoadingDrawable();
botButton2.loadingDrawable.setRadiiDp(5.5f);
botButton2.loadingDrawable.setAppearByGradient(true);
botButton2.loadingDrawable.strokePaint.setStrokeWidth(AndroidUtilities.dpf2(1.25f));
} else if (botButton2.loadingDrawable.isDisappeared() || botButton2.loadingDrawable.isDisappearing()) {
botButton2.loadingDrawable.reset();
botButton2.loadingDrawable.resetDisappear();
}
} else if (botButton2.loadingDrawable != null && !botButton2.loadingDrawable.isDisappearing() && !botButton2.loadingDrawable.isDisappeared()) {
botButton2.loadingDrawable.disappear();
}
if (botButton2.loadingDrawable != null && (z || botButton2.loadingDrawable.isDisappearing())) {
this.rect.inset(AndroidUtilities.dpf2(0.625f), AndroidUtilities.dpf2(0.625f));
botButton2.loadingDrawable.setRadii(this.botButtonRadii);
botButton2.loadingDrawable.setBounds(this.rect);
LoadingDrawable loadingDrawable = botButton2.loadingDrawable;
int i4 = Theme.key_chat_serviceBackgroundSelector;
loadingDrawable.setColors(Theme.multAlpha(Theme.getColor(i4, this.resourcesProvider), f), Theme.multAlpha(Theme.getColor(i4, this.resourcesProvider), 2.5f), Theme.multAlpha(Theme.getColor(i4, this.resourcesProvider), 3.0f), Theme.multAlpha(Theme.getColor(i4, this.resourcesProvider), 10.0f));
botButton2.loadingDrawable.setAlpha(255);
botButton2.loadingDrawable.draw(canvas);
invalidateOutbounds();
}
if (botButton2.selectorDrawable != null) {
int i5 = (int) dp3;
botButton2.selectorDrawable.setBounds(botButton2.x + dp, i5, botButton2.x + dp + botButton2.width, botButton2.height + i5);
botButton2.selectorDrawable.setAlpha(255);
botButton2.selectorDrawable.draw(canvas);
}
canvas.restore();
canvas.save();
canvas.translate(botButton2.x + dp + AndroidUtilities.dp(5.0f), ((AndroidUtilities.dp(44.0f) - botButton2.title.getLineBottom(botButton2.title.getLineCount() - 1)) / 2) + dp3);
botButton2.title.draw(canvas);
canvas.restore();
if (!(botButton2.button instanceof TLRPC$TL_keyboardButtonWebView)) {
if (botButton2.button instanceof TLRPC$TL_keyboardButtonUrl) {
if (botButton2.isInviteButton) {
themedDrawable = getThemedDrawable("drawable_botInvite");
} else {
themedDrawable = getThemedDrawable("drawableBotLink");
}
BaseCell.setDrawableBounds(themedDrawable, (((botButton2.x + botButton2.width) - AndroidUtilities.dp(3.0f)) - themedDrawable.getIntrinsicWidth()) + dp, dp3 + AndroidUtilities.dp(3.0f));
themedDrawable.draw(canvas);
} else if (!(botButton2.button instanceof TLRPC$TL_keyboardButtonSwitchInline) && !(botButton2.button instanceof TLRPC$TL_keyboardButtonRequestPeer)) {
if (botButton2.button instanceof TLRPC$TL_keyboardButtonBuy) {
BaseCell.setDrawableBounds(Theme.chat_botCardDrawable, (((botButton2.x + botButton2.width) - AndroidUtilities.dp(5.0f)) - Theme.chat_botCardDrawable.getIntrinsicWidth()) + dp, dp3 + AndroidUtilities.dp(4.0f));
Theme.chat_botCardDrawable.draw(canvas);
}
} else {
Drawable themedDrawable2 = getThemedDrawable("drawableBotInline");
BaseCell.setDrawableBounds(themedDrawable2, (((botButton2.x + botButton2.width) - AndroidUtilities.dp(3.0f)) - themedDrawable2.getIntrinsicWidth()) + dp, dp3 + AndroidUtilities.dp(3.0f));
themedDrawable2.draw(canvas);
}
} else {
Drawable themedDrawable3 = getThemedDrawable("drawableBotWebView");
BaseCell.setDrawableBounds(themedDrawable3, (((botButton2.x + botButton2.width) - AndroidUtilities.dp(3.0f)) - themedDrawable3.getIntrinsicWidth()) + dp, dp3 + AndroidUtilities.dp(3.0f));
themedDrawable3.draw(canvas);
}
canvas.restore();
i3++;
f = 1.0f;
f2 = 2.0f;
}
canvas.restore();
}
private boolean allowDrawPhotoImage() {
return !this.currentMessageObject.hasMediaSpoilers() || this.currentMessageObject.isMediaSpoilersRevealed || this.mediaSpoilerRevealProgress != 0.0f || this.blurredPhotoImage.getBitmap() == null;
}
public void layoutTextXY(boolean z) {
int dp;
int i;
if (this.currentMessageObject.isOutOwner()) {
this.textX = (z ? (int) (this.backgroundDrawableLeft + this.transitionParams.deltaLeft) : getCurrentBackgroundLeft()) + AndroidUtilities.dp(11.0f) + getExtraTextX();
} else {
int currentBackgroundLeft = z ? (int) (this.backgroundDrawableLeft + this.transitionParams.deltaLeft) : getCurrentBackgroundLeft();
if (this.currentMessageObject.type == 19) {
dp = 0;
} else {
dp = AndroidUtilities.dp((this.mediaBackground || !this.drawPinnedBottom) ? 17.0f : 11.0f);
}
this.textX = currentBackgroundLeft + dp + getExtraTextX();
}
if (this.hasGamePreview) {
this.textX += AndroidUtilities.dp(11.0f);
int dp2 = AndroidUtilities.dp(14.0f) + this.namesOffset;
this.textY = dp2;
StaticLayout staticLayout = this.siteNameLayout;
if (staticLayout != null) {
this.textY = dp2 + staticLayout.getLineBottom(staticLayout.getLineCount() - 1);
}
} else if (this.hasInvoicePreview) {
int dp3 = AndroidUtilities.dp(14.0f) + this.namesOffset;
this.textY = dp3;
StaticLayout staticLayout2 = this.siteNameLayout;
if (staticLayout2 != null) {
this.textY = dp3 + staticLayout2.getLineBottom(staticLayout2.getLineCount() - 1);
}
} else if (this.currentMessageObject.type == 19) {
this.textY = AndroidUtilities.dp(6.0f) + this.namesOffset;
if (!this.currentMessageObject.isOut()) {
this.textX = getCurrentBackgroundLeft();
} else {
this.textX -= AndroidUtilities.dp(4.0f);
}
} else {
int dp4 = AndroidUtilities.dp(8.0f) + this.namesOffset;
this.textY = dp4;
if (this.currentMessageObject.hasCodeAtTop && (i = SharedConfig.bubbleRadius) > 10) {
this.textY = dp4 + AndroidUtilities.dp(i < 15 ? 1.0f : 2.0f);
}
if (this.currentMessageObject.hasCodeAtTop && this.namesOffset > 0) {
this.textY += AndroidUtilities.dp(5.0f);
}
}
if (this.currentMessageObject.isSponsored()) {
this.linkPreviewY = this.textY + AndroidUtilities.dp(14.0f);
} else if (this.linkPreviewAbove) {
this.linkPreviewY = this.textY + AndroidUtilities.dp(10.0f);
this.textY += this.linkPreviewHeight + AndroidUtilities.dp(13.0f);
if (this.drawInstantView && !this.hasInvoicePreview && !this.currentMessageObject.isGiveawayOrGiveawayResults()) {
this.textY += AndroidUtilities.dp(44.0f);
}
} else {
this.linkPreviewY = this.textY + this.currentMessageObject.textHeight + AndroidUtilities.dp(10.0f);
}
this.unmovedTextX = this.textX;
if (this.currentMessageObject.textXOffset == 0.0f || this.replyNameLayout == null) {
return;
}
int dp5 = this.backgroundWidth - AndroidUtilities.dp(31.0f);
MessageObject messageObject = this.currentMessageObject;
int i2 = dp5 - messageObject.textWidth;
if (!this.hasNewLineForTime) {
i2 -= this.timeWidth + AndroidUtilities.dp((messageObject.isOutOwner() ? 20 : 0) + 4);
}
if (i2 > 0) {
this.textX += i2 - getExtraTimeX();
}
}
public void drawMessageText(Canvas canvas) {
float f;
MessageObject messageObject = this.currentMessageObject;
if (messageObject == null || messageObject.isSponsored()) {
return;
}
int i = this.textY;
float f2 = i;
TransitionParams transitionParams = this.transitionParams;
if (transitionParams.animateText) {
float f3 = transitionParams.animateFromTextY;
float f4 = transitionParams.animateChangeProgress;
f2 = (f3 * (1.0f - f4)) + (i * f4);
}
float f5 = f2;
float f6 = transitionParams.animateChangeProgress;
if (f6 != 1.0f && transitionParams.animateMessageText) {
canvas.save();
Theme.MessageDrawable messageDrawable = this.currentBackgroundDrawable;
if (messageDrawable != null) {
Rect bounds = messageDrawable.getBounds();
if (this.currentMessageObject.isOutOwner() && !this.mediaBackground && !this.pinnedBottom) {
canvas.clipRect(bounds.left + AndroidUtilities.dp(4.0f), bounds.top + AndroidUtilities.dp(4.0f), bounds.right - AndroidUtilities.dp(10.0f), bounds.bottom - AndroidUtilities.dp(4.0f));
} else {
canvas.clipRect(bounds.left + AndroidUtilities.dp(4.0f), bounds.top + AndroidUtilities.dp(4.0f), bounds.right - AndroidUtilities.dp(4.0f), bounds.bottom - AndroidUtilities.dp(4.0f));
}
}
drawMessageText(this.textX, f5, canvas, this.transitionParams.animateOutTextBlocks, this.transitionParams.animateOutTextXOffset, false, 1.0f - this.transitionParams.animateChangeProgress, true, false, false);
float f7 = this.textX;
MessageObject messageObject2 = this.currentMessageObject;
drawMessageText(f7, f5, canvas, messageObject2.textLayoutBlocks, messageObject2.textXOffset, true, this.transitionParams.animateChangeProgress, true, false, false);
canvas.restore();
return;
}
boolean z = transitionParams.animateLinkAbove;
if (z && this.currentBackgroundDrawable != null) {
if (z) {
float f8 = i;
boolean z2 = this.linkPreviewAbove;
int i2 = z2 ? 1 : -1;
int i3 = this.currentMessageObject.textHeight;
float f9 = f8 + (i2 * i3 * (1.0f - f6));
f = transitionParams.animateFromTextY - (((z2 ? 1 : -1) * i3) * f6);
f5 = f9;
} else {
f = f5;
}
canvas.save();
RectF rectF = AndroidUtilities.rectTmp;
rectF.set(this.currentBackgroundDrawable.getBounds());
if (this.currentMessageObject.isOutOwner() && !this.mediaBackground && !this.pinnedBottom) {
rectF.left += AndroidUtilities.dp(4.0f);
rectF.right -= AndroidUtilities.dp(10.0f);
} else {
rectF.left += AndroidUtilities.dp(4.0f);
rectF.right -= AndroidUtilities.dp(4.0f);
}
float f10 = rectF.left;
float f11 = this.transitionParams.animateFromTextY;
canvas.clipRect(f10, f11, rectF.right, this.currentMessageObject.textHeight + f11 + AndroidUtilities.dp(4.0f));
float f12 = this.textX;
MessageObject messageObject3 = this.currentMessageObject;
drawMessageText(f12, f, canvas, messageObject3.textLayoutBlocks, messageObject3.textXOffset, false, 1.0f - this.transitionParams.animateChangeProgress, true, false, false);
canvas.restore();
canvas.save();
rectF.set(this.currentBackgroundDrawable.getBounds());
if (this.currentMessageObject.isOutOwner() && !this.mediaBackground && !this.pinnedBottom) {
rectF.left += AndroidUtilities.dp(4.0f);
rectF.right -= AndroidUtilities.dp(10.0f);
} else {
rectF.left += AndroidUtilities.dp(4.0f);
rectF.right -= AndroidUtilities.dp(4.0f);
}
canvas.clipRect(rectF.left, this.textY, rectF.right, r1 + this.currentMessageObject.textHeight + AndroidUtilities.dp(4.0f));
float f13 = this.textX;
MessageObject messageObject4 = this.currentMessageObject;
drawMessageText(f13, f5, canvas, messageObject4.textLayoutBlocks, messageObject4.textXOffset, true, 1.0f, true, false, false);
canvas.restore();
return;
}
float f14 = this.textX;
MessageObject messageObject5 = this.currentMessageObject;
drawMessageText(f14, f5, canvas, messageObject5.textLayoutBlocks, messageObject5.textXOffset, true, 1.0f, true, false, false);
}
public void drawMessageText(Canvas canvas, ArrayList<MessageObject.TextLayoutBlock> arrayList, boolean z, float f, boolean z2) {
int i = this.textY;
float f2 = i;
TransitionParams transitionParams = this.transitionParams;
if (transitionParams.animateText) {
float f3 = transitionParams.animateFromTextY;
float f4 = transitionParams.animateChangeProgress;
f2 = (f3 * (1.0f - f4)) + (i * f4);
}
float f5 = f2;
float f6 = this.textX;
MessageObject messageObject = this.currentMessageObject;
drawMessageText(f6, f5, canvas, arrayList, messageObject == null ? 0.0f : messageObject.textXOffset, z, f, false, z2, false);
}
@SuppressLint({"Range"})
public void drawMessageText(float f, float f2, Canvas canvas, ArrayList<MessageObject.TextLayoutBlock> arrayList, float f3, boolean z, float f4, boolean z2, boolean z3, boolean z4) {
int size;
int i;
float f5;
float backgroundDrawableRight;
int i2;
int i3;
boolean z5;
int i4;
int i5;
int i6;
int i7;
float f6;
float f7;
int i8;
int i9;
MessageObject.TextLayoutBlock textLayoutBlock;
int i10;
char c;
int i11;
char c2;
int min;
float f8;
int i12;
Text text;
int i13;
ChatMessageCellDelegate chatMessageCellDelegate;
int i14;
int i15;
int i16;
int i17;
Theme.MessageDrawable messageDrawable;
MessageObject.GroupedMessagePosition groupedMessagePosition;
int parentWidth;
int i18;
StaticLayout staticLayout;
if (arrayList == null || arrayList.isEmpty()) {
return;
}
float f9 = 0.0f;
if (f4 == 0.0f) {
return;
}
int i19 = 0;
if (z && !z2) {
if (this.fullyDraw) {
this.firstVisibleBlockNum = 0;
this.lastVisibleBlockNum = arrayList.size();
}
i = this.firstVisibleBlockNum;
size = this.lastVisibleBlockNum;
} else {
size = arrayList.size();
i = 0;
}
boolean isTranslating = MessagesController.getInstance(this.currentAccount).getTranslateController().isTranslating(getMessageObject());
boolean z6 = !z;
MessageObject messageObject = this.currentMessageObject;
if (z6 == (messageObject != null && messageObject.translated)) {
if (this.translationLoadingFloat == null) {
this.translationLoadingFloat = new AnimatedFloat(this, 350L, CubicBezierInterpolator.EASE_OUT_QUINT);
}
float f10 = this.translationLoadingFloat.set(isTranslating ? 1.0f : 0.0f);
if (f10 > 0.0f) {
if (this.translationLoadingDrawable == null) {
LoadingDrawable loadingDrawable = new LoadingDrawable();
this.translationLoadingDrawable = loadingDrawable;
loadingDrawable.setAppearByGradient(true);
if (this.translationLoadingPath == null) {
this.translationLoadingPath = new LinkPath(true);
}
this.translationLoadingDrawable.usePath(this.translationLoadingPath);
this.translationLoadingDrawable.setRadiiDp(5.0f);
this.translationLoadingDrawable.reset();
}
if (this.translationLoadingDrawableText != arrayList) {
this.translationLoadingDrawableText = arrayList;
this.translationLoadingPath.reset();
int i20 = 0;
while (i20 < arrayList.size()) {
MessageObject.TextLayoutBlock textLayoutBlock2 = arrayList.get(i20);
if (textLayoutBlock2 != null && (staticLayout = textLayoutBlock2.textLayout) != null) {
LinkPath linkPath = this.translationLoadingPath;
if (textLayoutBlock2.isRtl()) {
f9 = f3;
}
linkPath.setCurrentLayout(staticLayout, 0, f9, textLayoutBlock2.textYOffset);
StaticLayout staticLayout2 = textLayoutBlock2.textLayout;
staticLayout2.getSelectionPath(0, staticLayout2.getText().length(), this.translationLoadingPath);
}
i20++;
f9 = 0.0f;
}
this.translationLoadingDrawable.updateBounds();
}
if (isTranslating && (this.translationLoadingDrawable.isDisappearing() || this.translationLoadingDrawable.isDisappeared())) {
this.translationLoadingDrawable.reset();
this.translationLoadingDrawable.resetDisappear();
} else if (!isTranslating && !this.translationLoadingDrawable.isDisappearing() && !this.translationLoadingDrawable.isDisappeared()) {
this.translationLoadingDrawable.disappear();
}
MessageObject messageObject2 = this.currentMessageObject;
int themedColor = getThemedColor((messageObject2 == null || !messageObject2.isOutOwner()) ? Theme.key_chat_messageLinkIn : Theme.key_chat_messageLinkOut);
f5 = 0.3f;
this.translationLoadingDrawable.setColors(Theme.multAlpha(themedColor, 0.05f), Theme.multAlpha(themedColor, 0.15f), Theme.multAlpha(themedColor, 0.1f), Theme.multAlpha(themedColor, 0.3f));
canvas.save();
canvas.translate(f, f2 + this.transitionYOffsetForDrawables);
this.translationLoadingDrawable.setAlpha((int) (f4 * 255.0f * f10));
this.translationLoadingDrawable.draw(canvas);
canvas.restore();
invalidate();
if (i >= 0) {
return;
}
float f11 = 6.0f;
if (this.currentMessagesGroup != null && (groupedMessagePosition = this.currentPosition) != null) {
int i21 = groupedMessagePosition.flags;
if ((i21 & 1) == 0 || (i21 & 2) == 0) {
if (AndroidUtilities.isTablet()) {
parentWidth = AndroidUtilities.getMinTabletSide();
} else {
parentWidth = getParentWidth();
}
int i22 = 0;
for (int i23 = 0; i23 < this.currentMessagesGroup.posArray.size(); i23++) {
if (this.currentMessagesGroup.posArray.get(i23).minY != 0) {
break;
}
i22 = (int) (i22 + Math.ceil(((r4.pw + r4.leftSpanOffset) / 1000.0f) * parentWidth));
}
if (!this.mediaBackground && this.currentMessageObject.isOutOwner()) {
i18 = (this.backgroundDrawableLeft + i22) - AndroidUtilities.dp(6.0f);
} else {
i18 = this.backgroundDrawableLeft + i22;
}
backgroundDrawableRight = i18 - (getExtraTextX() + AndroidUtilities.dp((this.isAvatarVisible ? 48 : 0) + 8));
float dp = (backgroundDrawableRight - (AndroidUtilities.dp(10 + ((this.currentMessageObject.isOutOwner() || this.mediaBackground || this.drawPinnedBottom) ? 0 : 6)) + getExtraTextX())) - f;
if (f4 != 1.0f) {
i2 = 0;
i3 = 0;
z5 = false;
i4 = Integer.MIN_VALUE;
} else if (z3 || z4) {
int alpha = Theme.chat_msgTextPaint.getAlpha();
int alpha2 = Color.alpha(Theme.chat_msgTextPaint.linkColor);
Theme.chat_msgTextPaint.setAlpha((int) (alpha * f4));
TextPaint textPaint = Theme.chat_msgTextPaint;
textPaint.linkColor = ColorUtils.setAlphaComponent(textPaint.linkColor, (int) (alpha2 * f4));
i3 = alpha;
i2 = alpha2;
i4 = Integer.MIN_VALUE;
z5 = true;
} else {
Theme.MessageDrawable messageDrawable2 = this.currentBackgroundDrawable;
if (messageDrawable2 != null) {
int i24 = messageDrawable2.getBounds().top;
int i25 = this.currentBackgroundDrawable.getBounds().bottom;
if (z4) {
this.rect.set(getCurrentBackgroundLeft() - AndroidUtilities.dp(10.0f), i24, this.currentBackgroundDrawable.getBounds().right + AndroidUtilities.dp(10.0f), i25);
} else {
if (getY() < 0.0f) {
i24 = (int) (-getY());
}
float y = getY() + getMeasuredHeight();
int i26 = this.parentHeight;
if (y > i26) {
i25 = (int) (i26 - getY());
}
this.rect.set(getCurrentBackgroundLeft(), i24, this.currentBackgroundDrawable.getBounds().right, i25);
}
} else {
this.rect.set(0.0f, 0.0f, getMeasuredWidth(), getMeasuredHeight());
}
i4 = canvas.saveLayerAlpha(this.rect, (int) (f4 * 255.0f), 31);
i2 = 0;
i3 = 0;
z5 = false;
}
int color = (this.currentMessageObject.isOut() || ChatObject.isChannelAndNotMegaGroup(this.currentMessageObject.getChatId(), this.currentAccount)) ? Theme.chat_msgTextPaint.getColor() : getThemedColor(Theme.key_chat_outTimeText);
if (this.quoteHighlight == null && this.currentMessagesGroup == null && (messageDrawable = this.currentBackgroundDrawable) != null) {
canvas.save();
canvas.clipPath(messageDrawable.makePath());
Paint paint = this.quoteHighlight.paint;
MessageObject messageObject3 = this.currentMessageObject;
int themedColor2 = getThemedColor((messageObject3 == null || !messageObject3.isOutOwner() || this.currentMessageObject.preview) ? Theme.key_chat_inReplyLine : Theme.key_chat_outReplyLine);
Theme.isCurrentThemeDark();
paint.setColor(Theme.multAlpha(themedColor2, 0.2f));
i5 = i2;
i6 = i3;
i7 = i4;
f6 = 0.2f;
f7 = 0.3f;
this.quoteHighlight.draw(canvas, f, f2, messageDrawable.getBounds(), getHighlightAlpha(true));
canvas.restore();
} else {
i5 = i2;
i6 = i3;
i7 = i4;
f6 = 0.2f;
f7 = f5;
}
i8 = i;
while (i8 <= size && i8 < arrayList.size()) {
textLayoutBlock = arrayList.get(i8);
canvas.save();
canvas.translate(f - (textLayoutBlock.isRtl() ? 0.0f : f3 - (textLayoutBlock.quote ? AndroidUtilities.dp(10.0f) : i19)), f2 + textLayoutBlock.textYOffset + this.transitionYOffsetForDrawables + textLayoutBlock.padTop);
if (i8 == this.linkBlockNum) {
if (!z3 && this.links.draw(canvas)) {
invalidate();
}
drawProgressLoadingLink(canvas, i8);
}
if (!textLayoutBlock.quote) {
if (this.quoteLine == null) {
this.quoteLine = new ReplyMessageLine(this);
}
this.quoteLine.check(this.currentMessageObject, this.currentUser, this.currentChat, this.resourcesProvider, 1);
int dp2 = (int) (textLayoutBlock.maxRight + ((float) AndroidUtilities.dp(24.0f)) > 0.7f * dp ? dp : textLayoutBlock.maxRight + AndroidUtilities.dp(24.0f));
RectF rectF = AndroidUtilities.rectTmp;
rectF.set(0.0f, (-textLayoutBlock.padTop) + AndroidUtilities.dp(textLayoutBlock.first ? 4.66f : 3.0f), dp2, textLayoutBlock.height + AndroidUtilities.dp(4.0f));
rectF.offset(textLayoutBlock.isRtl() ? f3 - AndroidUtilities.dp(10.0f) : 0.0f, 0.0f);
i10 = i8;
this.quoteLine.drawBackground(canvas, rectF, 5.0f, 5.0f, 5.0f, f4);
this.quoteLine.drawLine(canvas, rectF, f4);
if (this.replyQuoteDrawable == null) {
this.replyQuoteDrawable = getContext().getResources().getDrawable(org.telegram.messenger.R.drawable.mini_quote).mutate();
}
if (this.quoteLine.getColor() != this.replyQuoteDrawableColor) {
Drawable drawable = this.replyQuoteDrawable;
int color2 = this.quoteLine.getColor();
this.replyQuoteDrawableColor = color2;
drawable.setColorFilter(new PorterDuffColorFilter(color2, PorterDuff.Mode.SRC_IN));
}
this.replyQuoteDrawable.setBounds((int) ((rectF.right - AndroidUtilities.dp((!this.drawPinnedTop ? 1 : 0) + 2)) - this.replyQuoteDrawable.getIntrinsicWidth()), (int) (rectF.top + AndroidUtilities.dp((!this.drawPinnedTop ? 1 : 0) + 2)), (int) (rectF.right - AndroidUtilities.dp((!this.drawPinnedTop ? 1 : 0) + 2)), (int) (rectF.top + AndroidUtilities.dp((!this.drawPinnedTop ? 1 : 0) + 2) + this.replyQuoteDrawable.getIntrinsicHeight()));
this.replyQuoteDrawable.setAlpha((int) (f4 * 255.0f));
this.replyQuoteDrawable.draw(canvas);
int color3 = this.quoteLine.getColor();
TextPaint textPaint2 = Theme.chat_msgGameTextPaint;
TextPaint textPaint3 = Theme.chat_replyTextPaint;
TextPaint textPaint4 = Theme.chat_quoteTextPaint;
TextPaint textPaint5 = Theme.chat_msgTextPaint;
int color4 = this.quoteLine.getColor();
textPaint5.linkColor = color4;
textPaint4.linkColor = color4;
textPaint3.linkColor = color4;
textPaint2.linkColor = color4;
i11 = color3;
c = 6;
} else {
i10 = i8;
TextPaint textPaint6 = Theme.chat_msgGameTextPaint;
TextPaint textPaint7 = Theme.chat_replyTextPaint;
TextPaint textPaint8 = Theme.chat_quoteTextPaint;
TextPaint textPaint9 = Theme.chat_msgTextPaint;
int themedColor3 = getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_messageLinkOut : Theme.key_chat_messageLinkIn);
textPaint9.linkColor = themedColor3;
textPaint8.linkColor = themedColor3;
textPaint7.linkColor = themedColor3;
textPaint6.linkColor = themedColor3;
if (textLayoutBlock.code) {
if (this.quoteLine == null) {
this.quoteLine = new ReplyMessageLine(this);
}
this.quoteLine.check(this.currentMessageObject, this.currentUser, this.currentChat, this.resourcesProvider, 2);
if (this.currentMessageObject.isOutOwner() && (Theme.isCurrentThemeDark() || Theme.isCustomTheme())) {
this.quoteLine.setBackgroundColor(getThemedColor(Theme.key_chat_outCodeBackground));
}
RectF rectF2 = AndroidUtilities.rectTmp;
rectF2.set(0.0f, (-AndroidUtilities.dp(f11)) - textLayoutBlock.languageHeight, this.namesOffset <= 0 ? dp + AndroidUtilities.dp(4.0f) : dp, textLayoutBlock.height + AndroidUtilities.dp(f11));
rectF2.offset(textLayoutBlock.isRtl() ? f3 : 0.0f, 0.0f);
if (textLayoutBlock.hasCodeCopyButton) {
rectF2.bottom += AndroidUtilities.dp(38.0f);
}
if (!textLayoutBlock.first || this.namesOffset > 0 || z4) {
c2 = 6;
min = Math.min(5, SharedConfig.bubbleRadius);
} else if (this.currentMessageObject.isOutOwner() && this.pinnedTop) {
c2 = 6;
min = Math.min(6, SharedConfig.bubbleRadius);
} else {
c2 = 6;
f8 = (SharedConfig.bubbleRadius / 3.0f) * 2.0f;
float f12 = f8;
c = c2;
this.quoteLine.drawBackground(canvas, rectF2, 5.0f, f12, Math.min(5, SharedConfig.bubbleRadius), f4);
i12 = textLayoutBlock.languageHeight;
if (i12 > 0) {
float f13 = rectF2.bottom;
rectF2.bottom = rectF2.top + i12;
this.quoteLine.drawBackground(canvas, rectF2, 5.0f, f12, 0.0f, (Theme.isCurrentThemeDark() ? 0.6f : 0.8f) * f4);
rectF2.bottom = f13;
}
this.quoteLine.drawLine(canvas, rectF2, f4);
if (textLayoutBlock.hasCodeCopyButton) {
textLayoutBlock.drawCopyCodeButton(canvas, rectF2, this.quoteLine.getColor(), this.quoteLine.getBackgroundColor(), f4);
}
canvas.translate(AndroidUtilities.dp(10.0f), 0.0f);
text = textLayoutBlock.languageLayout;
if (text == null) {
f11 = 6.0f;
text.ellipsize((int) (dp - AndroidUtilities.dp(12.0f))).draw(canvas, 0.0f, (-AndroidUtilities.dp(6.0f)) - (textLayoutBlock.languageHeight / 2.0f), this.quoteLine.color3, f4);
} else {
f11 = 6.0f;
}
}
f8 = min;
float f122 = f8;
c = c2;
this.quoteLine.drawBackground(canvas, rectF2, 5.0f, f122, Math.min(5, SharedConfig.bubbleRadius), f4);
i12 = textLayoutBlock.languageHeight;
if (i12 > 0) {
}
this.quoteLine.drawLine(canvas, rectF2, f4);
if (textLayoutBlock.hasCodeCopyButton) {
}
canvas.translate(AndroidUtilities.dp(10.0f), 0.0f);
text = textLayoutBlock.languageLayout;
if (text == null) {
}
} else {
c = 6;
}
i11 = color;
}
i13 = i10;
if (i13 == this.linkSelectionBlockNum && this.quoteHighlight == null && !this.urlPathSelection.isEmpty() && !z3) {
MessageObject messageObject4 = this.currentMessageObject;
Paint paint2 = (messageObject4 == null && messageObject4.isOutOwner()) ? Theme.chat_outUrlPaint : Theme.chat_urlPaint;
MessageObject messageObject5 = this.currentMessageObject;
paint2.setColor(getThemedColor((messageObject5 == null && messageObject5.isOutOwner() && !this.currentMessageObject.preview) ? Theme.key_chat_outReplyLine : Theme.key_chat_inReplyLine));
int alpha3 = (int) (paint2.getAlpha() * (!Theme.isCurrentThemeDark() ? f6 : f7));
paint2.setAlpha((int) (alpha3 * (!this.highlightedQuote ? getHighlightAlpha() : 1.0f)));
for (i17 = 0; i17 < this.urlPathSelection.size(); i17++) {
canvas.drawPath(this.urlPathSelection.get(i17), paint2);
}
paint2.setAlpha(alpha3);
}
chatMessageCellDelegate = this.delegate;
if (chatMessageCellDelegate != null && chatMessageCellDelegate.getTextSelectionHelper() != null && this.transitionParams.animateChangeProgress == 1.0f && !z3) {
if (!z4) {
this.delegate.getTextSelectionHelper().drawCaption(this.currentMessageObject, textLayoutBlock, canvas);
} else {
this.delegate.getTextSelectionHelper().draw(this.currentMessageObject, textLayoutBlock, canvas);
}
}
try {
Emoji.emojiDrawingYOffset = -this.transitionYOffsetForDrawables;
i14 = size;
i15 = i13;
i16 = 0;
try {
SpoilerEffect.renderWithRipple(this, this.invalidateSpoilersParent, i11, 0, textLayoutBlock.spoilersPatchedTextLayout, textLayoutBlock.textLayout, textLayoutBlock.spoilers, canvas, false);
} catch (Exception e) {
e = e;
}
try {
Emoji.emojiDrawingYOffset = 0.0f;
} catch (Exception e2) {
e = e2;
FileLog.e(e);
canvas.restore();
i8 = i15 + 1;
size = i14;
i19 = i16;
}
} catch (Exception e3) {
e = e3;
i14 = size;
i15 = i13;
i16 = 0;
}
canvas.restore();
i8 = i15 + 1;
size = i14;
i19 = i16;
}
if (z5) {
Theme.chat_msgTextPaint.setAlpha(i6);
TextPaint textPaint10 = Theme.chat_msgTextPaint;
textPaint10.linkColor = ColorUtils.setAlphaComponent(textPaint10.linkColor, i5);
}
i9 = i7;
if (i9 == Integer.MIN_VALUE) {
canvas.restoreToCount(i9);
return;
}
return;
}
}
backgroundDrawableRight = getBackgroundDrawableRight() + this.transitionParams.deltaRight;
float dp3 = (backgroundDrawableRight - (AndroidUtilities.dp(10 + ((this.currentMessageObject.isOutOwner() || this.mediaBackground || this.drawPinnedBottom) ? 0 : 6)) + getExtraTextX())) - f;
if (f4 != 1.0f) {
}
int color5 = (this.currentMessageObject.isOut() || ChatObject.isChannelAndNotMegaGroup(this.currentMessageObject.getChatId(), this.currentAccount)) ? Theme.chat_msgTextPaint.getColor() : getThemedColor(Theme.key_chat_outTimeText);
if (this.quoteHighlight == null) {
}
i5 = i2;
i6 = i3;
i7 = i4;
f6 = 0.2f;
f7 = f5;
i8 = i;
while (i8 <= size) {
textLayoutBlock = arrayList.get(i8);
canvas.save();
if (textLayoutBlock.isRtl()) {
}
canvas.translate(f - (textLayoutBlock.isRtl() ? 0.0f : f3 - (textLayoutBlock.quote ? AndroidUtilities.dp(10.0f) : i19)), f2 + textLayoutBlock.textYOffset + this.transitionYOffsetForDrawables + textLayoutBlock.padTop);
if (i8 == this.linkBlockNum) {
}
if (!textLayoutBlock.quote) {
}
i13 = i10;
if (i13 == this.linkSelectionBlockNum) {
MessageObject messageObject42 = this.currentMessageObject;
if (messageObject42 == null) {
}
MessageObject messageObject52 = this.currentMessageObject;
paint2.setColor(getThemedColor((messageObject52 == null && messageObject52.isOutOwner() && !this.currentMessageObject.preview) ? Theme.key_chat_outReplyLine : Theme.key_chat_inReplyLine));
int alpha32 = (int) (paint2.getAlpha() * (!Theme.isCurrentThemeDark() ? f6 : f7));
paint2.setAlpha((int) (alpha32 * (!this.highlightedQuote ? getHighlightAlpha() : 1.0f)));
while (i17 < this.urlPathSelection.size()) {
}
paint2.setAlpha(alpha32);
}
chatMessageCellDelegate = this.delegate;
if (chatMessageCellDelegate != null) {
if (!z4) {
}
}
Emoji.emojiDrawingYOffset = -this.transitionYOffsetForDrawables;
i14 = size;
i15 = i13;
i16 = 0;
SpoilerEffect.renderWithRipple(this, this.invalidateSpoilersParent, i11, 0, textLayoutBlock.spoilersPatchedTextLayout, textLayoutBlock.textLayout, textLayoutBlock.spoilers, canvas, false);
Emoji.emojiDrawingYOffset = 0.0f;
canvas.restore();
i8 = i15 + 1;
size = i14;
i19 = i16;
}
if (z5) {
}
i9 = i7;
if (i9 == Integer.MIN_VALUE) {
}
}
}
f5 = 0.3f;
if (i >= 0) {
}
}
public AnimatedEmojiSpan[] getAnimatedEmojiSpans() {
AnimatedEmojiSpan[] animatedEmojiSpanArr;
MessageObject messageObject;
AnimatedEmojiSpan[] animatedEmojiSpanArr2;
int i;
MessageObject messageObject2 = this.currentMessageObject;
AnimatedEmojiSpan[] animatedEmojiSpanArr3 = null;
int i2 = 0;
if (messageObject2 != null) {
CharSequence charSequence = messageObject2.messageText;
if (charSequence instanceof Spanned) {
animatedEmojiSpanArr = (AnimatedEmojiSpan[]) ((Spanned) charSequence).getSpans(0, charSequence.length(), AnimatedEmojiSpan.class);
messageObject = this.currentMessageObject;
if (messageObject != null) {
CharSequence charSequence2 = messageObject.caption;
if (charSequence2 instanceof Spanned) {
animatedEmojiSpanArr2 = (AnimatedEmojiSpan[]) ((Spanned) charSequence2).getSpans(0, charSequence2.length(), AnimatedEmojiSpan.class);
if ((animatedEmojiSpanArr != null && animatedEmojiSpanArr.length != 0) || (animatedEmojiSpanArr2 != null && animatedEmojiSpanArr2.length != 0)) {
animatedEmojiSpanArr3 = new AnimatedEmojiSpan[(animatedEmojiSpanArr != null ? 0 : animatedEmojiSpanArr.length) + (animatedEmojiSpanArr2 != null ? 0 : animatedEmojiSpanArr2.length)];
if (animatedEmojiSpanArr == null) {
int i3 = 0;
i = 0;
while (i3 < animatedEmojiSpanArr.length) {
animatedEmojiSpanArr3[i] = animatedEmojiSpanArr[i3];
i3++;
i++;
}
} else {
i = 0;
}
if (animatedEmojiSpanArr2 != null) {
while (i2 < animatedEmojiSpanArr2.length) {
animatedEmojiSpanArr3[i] = animatedEmojiSpanArr2[i2];
i2++;
i++;
}
}
}
return animatedEmojiSpanArr3;
}
}
animatedEmojiSpanArr2 = null;
if (animatedEmojiSpanArr != null) {
animatedEmojiSpanArr3 = new AnimatedEmojiSpan[(animatedEmojiSpanArr != null ? 0 : animatedEmojiSpanArr.length) + (animatedEmojiSpanArr2 != null ? 0 : animatedEmojiSpanArr2.length)];
if (animatedEmojiSpanArr == null) {
}
if (animatedEmojiSpanArr2 != null) {
}
return animatedEmojiSpanArr3;
}
animatedEmojiSpanArr3 = new AnimatedEmojiSpan[(animatedEmojiSpanArr != null ? 0 : animatedEmojiSpanArr.length) + (animatedEmojiSpanArr2 != null ? 0 : animatedEmojiSpanArr2.length)];
if (animatedEmojiSpanArr == null) {
}
if (animatedEmojiSpanArr2 != null) {
}
return animatedEmojiSpanArr3;
}
}
animatedEmojiSpanArr = null;
messageObject = this.currentMessageObject;
if (messageObject != null) {
}
animatedEmojiSpanArr2 = null;
if (animatedEmojiSpanArr != null) {
}
animatedEmojiSpanArr3 = new AnimatedEmojiSpan[(animatedEmojiSpanArr != null ? 0 : animatedEmojiSpanArr.length) + (animatedEmojiSpanArr2 != null ? 0 : animatedEmojiSpanArr2.length)];
if (animatedEmojiSpanArr == null) {
}
if (animatedEmojiSpanArr2 != null) {
}
return animatedEmojiSpanArr3;
}
public void updateCaptionLayout() {
float imageX;
float imageY;
float imageHeight;
MessageObject messageObject = this.currentMessageObject;
int i = messageObject.type;
if (i == 1 || i == 20 || this.documentAttachType == 4 || i == 8 || i == 23) {
TransitionParams transitionParams = this.transitionParams;
if (transitionParams.imageChangeBoundsTransition) {
imageX = transitionParams.animateToImageX;
imageY = transitionParams.animateToImageY;
imageHeight = transitionParams.animateToImageH;
} else {
imageX = this.photoImage.getImageX();
imageY = this.photoImage.getImageY();
imageHeight = this.photoImage.getImageHeight();
}
this.captionX = imageX + AndroidUtilities.dp(5.0f) + this.captionOffsetX;
this.captionY = imageY + imageHeight + AndroidUtilities.dp(6.0f);
} else {
if (this.hasOldCaptionPreview) {
this.captionX = this.backgroundDrawableLeft + AndroidUtilities.dp(messageObject.isOutOwner() ? 11.0f : 17.0f) + this.captionOffsetX;
float dp = (((this.totalHeight - this.captionHeight) - AndroidUtilities.dp(this.drawPinnedTop ? 9.0f : 10.0f)) - this.linkPreviewHeight) - AndroidUtilities.dp(17.0f);
this.captionY = dp;
if (this.drawCommentButton && this.drawSideButton != 3) {
this.captionY = dp - AndroidUtilities.dp(shouldDrawTimeOnMedia() ? 41.3f : 43.0f);
}
} else {
if (this.isRoundVideo) {
this.captionX = getBackgroundDrawableLeft() + AndroidUtilities.dp((this.currentMessageObject.isOutOwner() ? 0 : 6) + 11);
} else {
int i2 = this.backgroundDrawableLeft;
if (!messageObject.isOutOwner() && !this.mediaBackground && !this.drawPinnedBottom) {
r7 = 17.0f;
}
this.captionX = i2 + AndroidUtilities.dp(r7) + this.captionOffsetX;
}
float dp2 = (this.totalHeight - this.captionHeight) - AndroidUtilities.dp(this.drawPinnedTop ? 9.0f : 10.0f);
this.captionY = dp2;
if (this.drawCommentButton && this.drawSideButton != 3) {
this.captionY = dp2 - AndroidUtilities.dp(shouldDrawTimeOnMedia() ? 41.3f : 43.0f);
}
ReactionsLayoutInBubble reactionsLayoutInBubble = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble.isEmpty && !reactionsLayoutInBubble.isSmall) {
this.captionY -= reactionsLayoutInBubble.totalHeight;
}
}
}
this.captionX += getExtraTextX();
}
private boolean textIsSelectionMode() {
return getCurrentMessagesGroup() == null && this.delegate.getTextSelectionHelper() != null && this.delegate.getTextSelectionHelper().isSelected(this.currentMessageObject);
}
public float getViewTop() {
return this.viewTop;
}
public int getBackgroundHeight() {
return this.backgroundHeight;
}
public int getMiniIconForCurrentState() {
int i = this.miniButtonState;
if (i < 0) {
return 4;
}
return i == 0 ? 2 : 3;
}
public int getIconForCurrentState() {
MessageObject messageObject = this.currentMessageObject;
if (messageObject == null || (messageObject != null && messageObject.hasExtendedMedia())) {
return 4;
}
if (this.documentAttachType == 7 && this.currentMessageObject.isVoiceTranscriptionOpen() && this.canStreamVideo) {
int i = this.buttonState;
return (i == 1 || i == 4) ? 1 : 0;
}
int i2 = this.documentAttachType;
if (i2 == 3 || i2 == 5) {
if (this.currentMessageObject.isOutOwner()) {
this.radialProgress.setColorKeys(Theme.key_chat_outLoader, Theme.key_chat_outLoaderSelected, Theme.key_chat_outMediaIcon, Theme.key_chat_outMediaIconSelected);
} else {
ReplyMessageLine replyMessageLine = this.linkLine;
if (replyMessageLine != null && this.hasLinkPreview) {
this.radialProgress.setColors(replyMessageLine.getColor(), this.linkLine.getColor(), Theme.blendOver(-1, Theme.multAlpha(this.linkLine.getColor(), 0.01f)), Theme.blendOver(-1, Theme.multAlpha(this.linkLine.getColor(), 0.05f)));
} else {
this.radialProgress.setColorKeys(Theme.key_chat_inLoader, Theme.key_chat_inLoaderSelected, Theme.key_chat_inMediaIcon, Theme.key_chat_inMediaIconSelected);
}
}
int i3 = this.buttonState;
if (i3 == 1) {
return 1;
}
if (i3 == 2) {
return 2;
}
return i3 == 4 ? 3 : 0;
}
if (i2 == 1 && !this.drawPhotoImage) {
if (this.currentMessageObject.isOutOwner()) {
this.radialProgress.setColorKeys(Theme.key_chat_outLoader, Theme.key_chat_outLoaderSelected, Theme.key_chat_outMediaIcon, Theme.key_chat_outMediaIconSelected);
} else {
ReplyMessageLine replyMessageLine2 = this.linkLine;
if (replyMessageLine2 != null && this.hasLinkPreview) {
this.radialProgress.setColors(replyMessageLine2.getColor(), this.linkLine.getColor(), Theme.blendOver(-1, Theme.multAlpha(this.linkLine.getColor(), 0.01f)), Theme.blendOver(-1, Theme.multAlpha(this.linkLine.getColor(), 0.05f)));
} else {
this.radialProgress.setColorKeys(Theme.key_chat_inLoader, Theme.key_chat_inLoaderSelected, Theme.key_chat_inMediaIcon, Theme.key_chat_inMediaIconSelected);
}
}
int i4 = this.buttonState;
if (i4 == -1) {
return 5;
}
if (i4 == 0) {
return 2;
}
if (i4 == 1) {
return 3;
}
} else {
RadialProgress2 radialProgress2 = this.radialProgress;
int i5 = Theme.key_chat_mediaLoaderPhoto;
int i6 = Theme.key_chat_mediaLoaderPhotoSelected;
int i7 = Theme.key_chat_mediaLoaderPhotoIcon;
int i8 = Theme.key_chat_mediaLoaderPhotoIconSelected;
radialProgress2.setColorKeys(i5, i6, i7, i8);
this.videoRadialProgress.setColorKeys(i5, i6, i7, i8);
int i9 = this.buttonState;
if (i9 >= 0 && i9 < 4) {
if (i9 == 0) {
return 2;
}
if (i9 == 1) {
return 3;
}
return (i9 != 2 && this.autoPlayingMedia) ? 4 : 0;
}
if (i9 == -1) {
if (this.documentAttachType == 1) {
if (this.drawPhotoImage && (this.currentPhotoObject != null || this.currentPhotoObjectThumb != null)) {
if (this.photoImage.hasBitmapImage()) {
return 4;
}
MessageObject messageObject2 = this.currentMessageObject;
if (messageObject2.mediaExists || messageObject2.attachPathExists) {
return 4;
}
}
return 5;
}
if (this.currentMessageObject.needDrawBluredPreview()) {
return 7;
}
if (this.hasEmbed) {
return 0;
}
}
}
MessageObject messageObject3 = this.currentMessageObject;
return (messageObject3 != null && this.isRoundVideo && messageObject3.isVoiceTranscriptionOpen()) ? 0 : 4;
}
public int getMaxNameWidth() {
int min;
int min2;
int dp;
MessageObject messageObject;
MessageObject messageObject2;
int i;
int parentWidth;
int i2 = this.documentAttachType;
if (i2 == 6 || i2 == 8 || (i = (messageObject2 = this.currentMessageObject).type) == 5) {
if (AndroidUtilities.isTablet()) {
if (needDrawAvatar()) {
min2 = AndroidUtilities.getMinTabletSide();
dp = AndroidUtilities.dp(42.0f);
min = min2 - dp;
if (!this.isPlayingRound && ((messageObject = this.currentMessageObject) == null || !messageObject.isVoiceTranscriptionOpen())) {
return (min - (this.backgroundWidth - (AndroidUtilities.roundPlayingMessageSize - AndroidUtilities.roundMessageSize))) - AndroidUtilities.dp(57.0f);
}
return (min - this.backgroundWidth) - AndroidUtilities.dp(57.0f);
}
min = AndroidUtilities.getMinTabletSide();
if (!this.isPlayingRound) {
}
return (min - this.backgroundWidth) - AndroidUtilities.dp(57.0f);
}
if (needDrawAvatar()) {
min2 = Math.min(getParentWidth(), AndroidUtilities.displaySize.y);
dp = AndroidUtilities.dp(42.0f);
min = min2 - dp;
if (!this.isPlayingRound) {
}
return (min - this.backgroundWidth) - AndroidUtilities.dp(57.0f);
}
min = Math.min(getParentWidth(), AndroidUtilities.displaySize.y);
if (!this.isPlayingRound) {
}
return (min - this.backgroundWidth) - AndroidUtilities.dp(57.0f);
}
MessageObject.GroupedMessages groupedMessages = this.currentMessagesGroup;
if (groupedMessages == null || groupedMessages.isDocuments) {
if (i == 19) {
return Math.max(messageObject2.textWidth, (int) (((AndroidUtilities.displaySize.x - AndroidUtilities.dp(52.0f)) - (this.isAvatarVisible ? AndroidUtilities.dp(48.0f) : 0)) * 0.5f));
}
return this.backgroundWidth - AndroidUtilities.dp(this.mediaBackground ? 22.0f : 31.0f);
}
if (AndroidUtilities.isTablet()) {
parentWidth = AndroidUtilities.getMinTabletSide();
} else {
parentWidth = getParentWidth();
}
int i3 = 0;
for (int i4 = 0; i4 < this.currentMessagesGroup.posArray.size(); i4++) {
if (this.currentMessagesGroup.posArray.get(i4).minY != 0) {
break;
}
i3 = (int) (i3 + Math.ceil(((r4.pw + r4.leftSpanOffset) / 1000.0f) * parentWidth));
}
return i3 - AndroidUtilities.dp((this.isAvatarVisible ? 48 : 0) + 31);
}
public void updateButtonState(boolean z, boolean z2, boolean z3) {
boolean z4;
int i;
int i2;
int i3;
boolean z5;
boolean z6;
boolean isLoadingVideo;
int i4;
boolean z7;
int i5;
boolean z8;
int i6;
int i7;
MessageObject messageObject;
MessageObject.GroupedMessagePosition groupedMessagePosition;
MessageObject messageObject2 = this.currentMessageObject;
if (messageObject2 == null) {
return;
}
if (messageObject2.type == 23 && messageObject2.isVideoStory()) {
this.buttonState = 2;
getIconForCurrentState();
return;
}
boolean z9 = (!z2 || (!PhotoViewer.isShowingImage(this.currentMessageObject) && this.attachedToWindow)) ? z2 : false;
this.drawRadialCheckBackground = false;
String str = null;
MessageObject messageObject3 = this.currentMessageObject;
int i8 = messageObject3.type;
if (i8 == 1) {
TLRPC$PhotoSize tLRPC$PhotoSize = this.currentPhotoObject;
if (tLRPC$PhotoSize == null) {
this.radialProgress.setIcon(4, z, z9);
return;
} else {
str = FileLoader.getAttachFileName(tLRPC$PhotoSize);
z4 = this.currentMessageObject.mediaExists;
}
} else if (i8 == 8 || (i2 = this.documentAttachType) == 7 || i2 == 4 || i2 == 8 || i8 == 9 || i2 == 3 || i2 == 5) {
if (messageObject3.useCustomPhoto) {
this.buttonState = 1;
this.radialProgress.setIcon(getIconForCurrentState(), z, z9);
return;
} else if (messageObject3.attachPathExists && !TextUtils.isEmpty(messageObject3.messageOwner.attachPath)) {
str = this.currentMessageObject.messageOwner.attachPath;
z4 = true;
} else {
if (!this.currentMessageObject.isSendError() || (i = this.documentAttachType) == 3 || i == 5) {
str = this.currentMessageObject.getFileName();
z4 = this.currentMessageObject.mediaExists;
}
z4 = false;
}
} else if (i2 != 0) {
str = FileLoader.getAttachFileName(this.documentAttach);
z4 = this.currentMessageObject.mediaExists;
} else {
TLRPC$PhotoSize tLRPC$PhotoSize2 = this.currentPhotoObject;
if (tLRPC$PhotoSize2 != null) {
str = FileLoader.getAttachFileName(tLRPC$PhotoSize2);
z4 = this.currentMessageObject.mediaExists;
}
z4 = false;
}
TLRPC$Document tLRPC$Document = this.documentAttach;
boolean canDownloadMedia = (tLRPC$Document == null || tLRPC$Document.dc_id != Integer.MIN_VALUE) ? DownloadController.getInstance(this.currentAccount).canDownloadMedia(this.currentMessageObject) : false;
this.canStreamVideo = (this.currentMessageObject.isSent() || this.currentMessageObject.isForwarded()) && ((i3 = this.documentAttachType) == 4 || i3 == 7 || (i3 == 2 && canDownloadMedia)) && this.currentMessageObject.canStreamVideo() && !this.currentMessageObject.needDrawBluredPreview();
if (SharedConfig.streamMedia) {
z5 = z9;
if (((int) this.currentMessageObject.getDialogId()) != 0 && !this.currentMessageObject.isSecretMedia()) {
if (this.documentAttachType != 5) {
if (this.canStreamVideo && (groupedMessagePosition = this.currentPosition) != null) {
int i9 = groupedMessagePosition.flags;
if ((i9 & 1) != 0) {
}
}
}
this.hasMiniProgress = z4 ? 1 : 2;
z4 = true;
}
} else {
z5 = z9;
}
if (this.currentMessageObject.isSendError() || (TextUtils.isEmpty(str) && (this.currentMessageObject.isAnyKindOfSticker() || (!this.currentMessageObject.isSending() && !this.currentMessageObject.isEditing())))) {
this.radialProgress.setIcon(4, z, false);
this.radialProgress.setMiniIcon(4, z, false);
this.videoRadialProgress.setIcon(4, z, false);
this.videoRadialProgress.setMiniIcon(4, z, false);
return;
}
HashMap<String, String> hashMap = this.currentMessageObject.messageOwner.params;
boolean z10 = hashMap != null && hashMap.containsKey("query_id");
int i10 = this.documentAttachType;
if (i10 == 3 || i10 == 5 || (i10 == 7 && (messageObject = this.currentMessageObject) != null && messageObject.isVoiceTranscriptionOpen() && this.canStreamVideo)) {
z6 = z5;
if ((this.currentMessageObject.isOut() && ((this.currentMessageObject.isSending() && !this.currentMessageObject.isForwarded()) || (this.currentMessageObject.isEditing() && this.currentMessageObject.isEditingMedia()))) || (this.currentMessageObject.isSendError() && z10)) {
if (!TextUtils.isEmpty(this.currentMessageObject.messageOwner.attachPath)) {
DownloadController downloadController = DownloadController.getInstance(this.currentAccount);
MessageObject messageObject4 = this.currentMessageObject;
downloadController.addLoadingFileObserver(messageObject4.messageOwner.attachPath, messageObject4, this);
this.wasSending = true;
this.buttonState = 4;
boolean isSendingMessage = SendMessagesHelper.getInstance(this.currentAccount).isSendingMessage(this.currentMessageObject.getId());
if (this.currentPosition != null && isSendingMessage && this.buttonState == 4) {
this.drawRadialCheckBackground = true;
getIconForCurrentState();
this.radialProgress.setIcon(6, z, z6);
} else {
this.radialProgress.setIcon(getIconForCurrentState(), z, z6);
}
this.radialProgress.setMiniIcon(4, z, z6);
if (!z10) {
long[] fileProgressSizes = ImageLoader.getInstance().getFileProgressSizes(this.currentMessageObject.messageOwner.attachPath);
if (fileProgressSizes == null && isSendingMessage) {
r15 = 1.0f;
} else if (fileProgressSizes != null) {
r15 = DownloadController.getProgress(fileProgressSizes);
}
this.radialProgress.setProgress(r15, false);
} else {
this.radialProgress.setProgress(0.0f, false);
}
} else {
this.buttonState = -1;
getIconForCurrentState();
this.radialProgress.setIcon(12, z, false);
this.radialProgress.setProgress(0.0f, false);
this.radialProgress.setMiniIcon(4, z, false);
}
} else if (this.hasMiniProgress != 0) {
this.radialProgress.setMiniProgressBackgroundColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outLoader : Theme.key_chat_inLoader));
if (!MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || MediaController.getInstance().isMessagePaused()) {
this.buttonState = 0;
} else {
this.buttonState = 1;
}
this.radialProgress.setIcon(getIconForCurrentState(), z, z6);
if (this.hasMiniProgress == 1) {
DownloadController.getInstance(this.currentAccount).removeLoadingFileObserver(this);
this.miniButtonState = -1;
} else {
DownloadController.getInstance(this.currentAccount).addLoadingFileObserver(str, this.currentMessageObject, this);
if (!FileLoader.getInstance(this.currentAccount).isLoadingFile(str)) {
createLoadingProgressLayout(this.documentAttach);
this.miniButtonState = 0;
} else {
this.miniButtonState = 1;
long[] fileProgressSizes2 = ImageLoader.getInstance().getFileProgressSizes(str);
if (fileProgressSizes2 != null) {
this.radialProgress.setProgress(DownloadController.getProgress(fileProgressSizes2), z6);
createLoadingProgressLayout(fileProgressSizes2[0], fileProgressSizes2[1]);
} else {
this.radialProgress.setProgress(0.0f, z6);
createLoadingProgressLayout(0L, this.currentMessageObject.getSize());
}
}
}
this.radialProgress.setMiniIcon(getMiniIconForCurrentState(), z, z6);
} else if (z4) {
DownloadController.getInstance(this.currentAccount).removeLoadingFileObserver(this);
if (!MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || MediaController.getInstance().isMessagePaused()) {
this.buttonState = 0;
} else {
this.buttonState = 1;
}
this.radialProgress.setIcon(getIconForCurrentState(), z, z6);
} else {
DownloadController.getInstance(this.currentAccount).addLoadingFileObserver(str, this.currentMessageObject, this);
if (!FileLoader.getInstance(this.currentAccount).isLoadingFile(str)) {
this.buttonState = 2;
} else {
this.buttonState = 4;
long[] fileProgressSizes3 = ImageLoader.getInstance().getFileProgressSizes(str);
if (fileProgressSizes3 != null) {
this.radialProgress.setProgress(DownloadController.getProgress(fileProgressSizes3), z6);
createLoadingProgressLayout(fileProgressSizes3[0], fileProgressSizes3[1]);
} else {
createLoadingProgressLayout(this.documentAttach);
this.radialProgress.setProgress(0.0f, z6);
}
}
this.radialProgress.setIcon(getIconForCurrentState(), z, z6);
}
updatePlayingMessageProgress();
} else {
MessageObject messageObject5 = this.currentMessageObject;
if (messageObject5.type == 0 && (i6 = this.documentAttachType) != 1 && i6 != 10 && i6 != 2 && i6 != 4 && i6 != 8 && i6 != 9) {
if (this.currentPhotoObject == null || !this.drawImageButton) {
return;
}
if (!z4) {
DownloadController.getInstance(this.currentAccount).addLoadingFileObserver(str, this.currentMessageObject, this);
if (!FileLoader.getInstance(this.currentAccount).isLoadingFile(str)) {
MessageObject messageObject6 = this.currentMessageObject;
if (!messageObject6.loadingCancelled && canDownloadMedia && ((i7 = this.documentAttachType) == 0 || (i7 == 2 && MessageObject.isGifDocument(this.documentAttach, messageObject6.hasValidGroupId())))) {
this.buttonState = 1;
} else {
this.buttonState = 0;
}
} else {
this.buttonState = 1;
long[] fileProgressSizes4 = ImageLoader.getInstance().getFileProgressSizes(str);
r15 = fileProgressSizes4 != null ? DownloadController.getProgress(fileProgressSizes4) : 0.0f;
if (fileProgressSizes4 != null && fileProgressSizes4[0] == fileProgressSizes4[1]) {
createLoadingProgressLayout(fileProgressSizes4[0], fileProgressSizes4[1]);
} else if (this.currentMessageObject.getDocument() != null) {
MessageObject messageObject7 = this.currentMessageObject;
createLoadingProgressLayout(messageObject7.loadedFileSize, messageObject7.getSize());
}
}
this.radialProgress.setProgress(r15, false);
} else {
DownloadController.getInstance(this.currentAccount).removeLoadingFileObserver(this);
if (this.documentAttachType == 2 && !this.photoImage.isAllowStartAnimation()) {
this.buttonState = 2;
} else {
this.buttonState = -1;
}
}
z6 = z5;
this.radialProgress.setIcon(getIconForCurrentState(), z, z6);
invalidate();
} else {
z6 = z5;
if (messageObject5.isOut() && ((this.currentMessageObject.isSending() && !this.currentMessageObject.isForwarded()) || (this.currentMessageObject.isEditing() && this.currentMessageObject.isEditingMedia()))) {
if (!TextUtils.isEmpty(this.currentMessageObject.messageOwner.attachPath)) {
DownloadController downloadController2 = DownloadController.getInstance(this.currentAccount);
MessageObject messageObject8 = this.currentMessageObject;
downloadController2.addLoadingFileObserver(messageObject8.messageOwner.attachPath, messageObject8, this);
this.wasSending = true;
String str2 = this.currentMessageObject.messageOwner.attachPath;
boolean z11 = str2 == null || !str2.startsWith("http");
TLRPC$Message tLRPC$Message = this.currentMessageObject.messageOwner;
HashMap<String, String> hashMap2 = tLRPC$Message.params;
if (tLRPC$Message.message != null && hashMap2 != null && (hashMap2.containsKey("url") || hashMap2.containsKey("bot"))) {
this.buttonState = -1;
z11 = false;
} else {
this.buttonState = 1;
}
boolean isSendingMessage2 = SendMessagesHelper.getInstance(this.currentAccount).isSendingMessage(this.currentMessageObject.getId());
if (this.currentPosition != null && isSendingMessage2 && this.buttonState == 1) {
this.drawRadialCheckBackground = true;
getIconForCurrentState();
this.radialProgress.setIcon(6, z, z6);
} else {
this.radialProgress.setIcon(getIconForCurrentState(), z, z6);
}
if (z11) {
long[] fileProgressSizes5 = ImageLoader.getInstance().getFileProgressSizes(this.currentMessageObject.messageOwner.attachPath);
if (fileProgressSizes5 == null && isSendingMessage2) {
z8 = false;
r15 = 1.0f;
} else if (fileProgressSizes5 != null) {
r15 = DownloadController.getProgress(fileProgressSizes5);
z8 = false;
createLoadingProgressLayout(fileProgressSizes5[0], fileProgressSizes5[1]);
} else {
z8 = false;
}
this.radialProgress.setProgress(r15, z8);
} else {
this.radialProgress.setProgress(0.0f, false);
}
invalidate();
z7 = false;
} else {
getIconForCurrentState();
if (this.currentMessageObject.isSticker() || this.currentMessageObject.isAnimatedSticker() || this.currentMessageObject.isLocation() || this.currentMessageObject.isGif()) {
z7 = false;
i5 = -1;
} else if (this.documentAttachType == 10) {
i5 = -1;
z7 = false;
} else {
this.buttonState = 1;
z7 = false;
this.radialProgress.setIcon(12, z, false);
this.radialProgress.setProgress(0.0f, z7);
}
this.buttonState = i5;
this.radialProgress.setIcon(4, z, z7);
this.radialProgress.setProgress(0.0f, z7);
}
this.videoRadialProgress.setIcon(4, z, z7);
} else {
if (this.wasSending && !TextUtils.isEmpty(this.currentMessageObject.messageOwner.attachPath)) {
DownloadController.getInstance(this.currentAccount).removeLoadingFileObserver(this);
}
int i11 = this.documentAttachType;
if ((i11 == 4 || i11 == 2 || i11 == 7) && this.autoPlayingMedia) {
isLoadingVideo = FileLoader.getInstance(this.currentAccount).isLoadingVideo(this.documentAttach, MediaController.getInstance().isPlayingMessage(this.currentMessageObject));
AnimatedFileDrawable animation = this.photoImage.getAnimation();
if (animation != null) {
MessageObject messageObject9 = this.currentMessageObject;
if (messageObject9.hadAnimationNotReadyLoading) {
if (animation.hasBitmap()) {
this.currentMessageObject.hadAnimationNotReadyLoading = false;
}
} else {
messageObject9.hadAnimationNotReadyLoading = isLoadingVideo && !animation.hasBitmap();
}
} else if (this.documentAttachType == 2 && !z4) {
this.currentMessageObject.hadAnimationNotReadyLoading = true;
}
} else {
isLoadingVideo = false;
}
if (this.hasMiniProgress != 0) {
this.radialProgress.setMiniProgressBackgroundColor(getThemedColor(Theme.key_chat_inLoaderPhoto));
this.buttonState = 3;
this.radialProgress.setIcon(getIconForCurrentState(), z, z6);
if (this.hasMiniProgress == 1) {
DownloadController.getInstance(this.currentAccount).removeLoadingFileObserver(this);
this.miniButtonState = -1;
} else {
DownloadController.getInstance(this.currentAccount).addLoadingFileObserver(str, this.currentMessageObject, this);
if (!FileLoader.getInstance(this.currentAccount).isLoadingFile(str)) {
this.miniButtonState = 0;
} else {
this.miniButtonState = 1;
long[] fileProgressSizes6 = ImageLoader.getInstance().getFileProgressSizes(str);
if (fileProgressSizes6 != null) {
createLoadingProgressLayout(fileProgressSizes6[0], fileProgressSizes6[1]);
this.radialProgress.setProgress(DownloadController.getProgress(fileProgressSizes6), z6);
} else {
createLoadingProgressLayout(this.documentAttach);
this.radialProgress.setProgress(0.0f, z6);
}
}
}
this.radialProgress.setMiniIcon(getMiniIconForCurrentState(), z, z6);
} else if (z4 || (((i4 = this.documentAttachType) == 4 || i4 == 2 || i4 == 7) && this.autoPlayingMedia && !this.currentMessageObject.hadAnimationNotReadyLoading && !isLoadingVideo)) {
DownloadController.getInstance(this.currentAccount).removeLoadingFileObserver(this);
if (this.drawVideoImageButton && z6) {
int i12 = this.animatingDrawVideoImageButton;
if (i12 != 1 && this.animatingDrawVideoImageButtonProgress > 0.0f) {
if (i12 == 0) {
this.animatingDrawVideoImageButtonProgress = 1.0f;
}
this.animatingDrawVideoImageButton = 1;
}
} else if (this.animatingDrawVideoImageButton == 0) {
this.animatingDrawVideoImageButton = 1;
}
this.drawVideoImageButton = false;
this.drawVideoSize = false;
if (this.currentMessageObject.needDrawBluredPreview()) {
this.buttonState = -1;
} else {
int i13 = this.documentAttachType;
if (i13 == 2 && this.currentMessageObject.gifState == 1.0f) {
if (this.photoImage.isAnimationRunning()) {
this.currentMessageObject.gifState = 0.0f;
this.buttonState = -1;
} else {
this.buttonState = 2;
}
} else if (i13 == 4 && !this.hasEmbed) {
this.buttonState = 3;
} else {
this.buttonState = -1;
}
}
this.videoRadialProgress.setIcon(4, z, this.animatingDrawVideoImageButton != 0);
this.radialProgress.setIcon(getIconForCurrentState(), z, z6);
if (!z3 && this.photoNotSet) {
setMessageObject(this.currentMessageObject, this.currentMessagesGroup, this.pinnedBottom, this.pinnedTop);
}
invalidate();
} else {
this.drawVideoSize = i4 == 4 || i4 == 2;
if ((i4 == 4 || i4 == 2 || i4 == 7) && this.canStreamVideo && !this.drawVideoImageButton && z6) {
int i14 = this.animatingDrawVideoImageButton;
if (i14 != 2 && this.animatingDrawVideoImageButtonProgress < 1.0f) {
if (i14 == 0) {
this.animatingDrawVideoImageButtonProgress = 0.0f;
}
this.animatingDrawVideoImageButton = 2;
}
} else if (this.animatingDrawVideoImageButton == 0) {
this.animatingDrawVideoImageButtonProgress = 1.0f;
}
DownloadController.getInstance(this.currentAccount).addLoadingFileObserver(str, this.currentMessageObject, this);
if (!FileLoader.getInstance(this.currentAccount).isLoadingFile(str)) {
MessageObject messageObject10 = this.currentMessageObject;
if (!messageObject10.loadingCancelled && canDownloadMedia) {
this.buttonState = 1;
} else if (messageObject10.type == 4) {
this.buttonState = -1;
} else {
this.buttonState = 0;
}
int i15 = messageObject10.type;
boolean z12 = i15 == 3 || i15 == 8 || this.documentAttachType == 4;
MessageObject.GroupedMessagePosition groupedMessagePosition2 = this.currentPosition;
boolean z13 = groupedMessagePosition2 == null || (groupedMessagePosition2.flags & 3) == 3;
int i16 = this.documentAttachType;
if ((i16 == 4 || (i16 == 2 && canDownloadMedia)) && this.canStreamVideo && z12 && z13) {
this.drawVideoImageButton = true;
getIconForCurrentState();
this.radialProgress.setIcon(this.autoPlayingMedia ? 4 : 0, z, z6);
this.videoRadialProgress.setIcon(2, z, z6);
} else {
this.drawVideoImageButton = false;
this.radialProgress.setIcon(getIconForCurrentState(), z, z6);
this.videoRadialProgress.setIcon(4, z, false);
if (!this.drawVideoSize && this.animatingDrawVideoImageButton == 0) {
this.animatingDrawVideoImageButtonProgress = 0.0f;
}
}
} else {
this.buttonState = 1;
long[] fileProgressSizes7 = ImageLoader.getInstance().getFileProgressSizes(str);
if (fileProgressSizes7 != null) {
createLoadingProgressLayout(fileProgressSizes7[0], fileProgressSizes7[1]);
} else {
createLoadingProgressLayout(this.documentAttach);
}
MessageObject messageObject11 = this.currentMessageObject;
int i17 = messageObject11.type;
boolean z14 = i17 == 3 || i17 == 8 || this.documentAttachType == 4;
MessageObject.GroupedMessagePosition groupedMessagePosition3 = this.currentPosition;
boolean z15 = groupedMessagePosition3 == null || (groupedMessagePosition3.flags & 3) == 3;
if ((this.documentAttachType == 4 || (MessageObject.isGifDocument(this.documentAttach, messageObject11.hasValidGroupId()) && canDownloadMedia)) && this.canStreamVideo && z14 && z15) {
this.drawVideoImageButton = true;
getIconForCurrentState();
this.radialProgress.setIcon((this.autoPlayingMedia || this.documentAttachType == 2) ? 4 : 0, z, z6);
this.videoRadialProgress.setProgress(fileProgressSizes7 != null ? DownloadController.getProgress(fileProgressSizes7) : 0.0f, z6);
this.videoRadialProgress.setIcon(14, z, z6);
} else {
this.drawVideoImageButton = false;
this.radialProgress.setProgress(fileProgressSizes7 != null ? DownloadController.getProgress(fileProgressSizes7) : 0.0f, z6);
this.radialProgress.setIcon(getIconForCurrentState(), z, z6);
this.videoRadialProgress.setIcon(4, z, false);
if (!this.drawVideoSize && this.animatingDrawVideoImageButton == 0) {
this.animatingDrawVideoImageButtonProgress = 0.0f;
}
}
}
invalidate();
}
}
}
}
if (this.hasMiniProgress == 0) {
this.radialProgress.setMiniIcon(4, false, z6);
}
}
private void didPressMiniButton(boolean z) {
int i = this.miniButtonState;
if (i != 0) {
if (i == 1) {
int i2 = this.documentAttachType;
if ((i2 == 3 || i2 == 5 || i2 == 7) && MediaController.getInstance().isPlayingMessage(this.currentMessageObject)) {
MediaController.getInstance().cleanupPlayer(true, true);
}
this.miniButtonState = 0;
this.currentMessageObject.loadingCancelled = true;
FileLoader.getInstance(this.currentAccount).cancelLoadFile(this.documentAttach);
this.radialProgress.setMiniIcon(getMiniIconForCurrentState(), false, true);
invalidate();
return;
}
return;
}
this.miniButtonState = 1;
this.radialProgress.setProgress(0.0f, false);
MessageObject messageObject = this.currentMessageObject;
if (messageObject != null && !messageObject.isAnyKindOfSticker()) {
this.currentMessageObject.putInDownloadsStore = true;
}
int i3 = this.documentAttachType;
if (i3 == 3 || i3 == 5) {
FileLoader fileLoader = FileLoader.getInstance(this.currentAccount);
TLRPC$Document tLRPC$Document = this.documentAttach;
MessageObject messageObject2 = this.currentMessageObject;
fileLoader.loadFile(tLRPC$Document, messageObject2, 2, messageObject2.shouldEncryptPhotoOrVideo() ? 2 : 0);
this.currentMessageObject.loadingCancelled = false;
} else if (i3 == 4 || i3 == 7) {
createLoadingProgressLayout(this.documentAttach);
FileLoader fileLoader2 = FileLoader.getInstance(this.currentAccount);
TLRPC$Document tLRPC$Document2 = this.documentAttach;
MessageObject messageObject3 = this.currentMessageObject;
fileLoader2.loadFile(tLRPC$Document2, messageObject3, 2, messageObject3.shouldEncryptPhotoOrVideo() ? 2 : 0);
this.currentMessageObject.loadingCancelled = false;
}
this.radialProgress.setMiniIcon(getMiniIconForCurrentState(), false, true);
invalidate();
}
private void didPressButton(boolean z, boolean z2) {
MessageObject messageObject;
MessageObject messageObject2;
TLRPC$PhotoSize tLRPC$PhotoSize;
String str;
MessageObject messageObject3;
MessageObject messageObject4 = this.currentMessageObject;
if (messageObject4 != null && !messageObject4.isAnyKindOfSticker()) {
this.currentMessageObject.putInDownloadsStore = true;
}
int i = this.buttonState;
if (i == 0 && (!this.drawVideoImageButton || z2)) {
int i2 = this.documentAttachType;
if (i2 == 3 || i2 == 5 || (i2 == 7 && (messageObject3 = this.currentMessageObject) != null && messageObject3.isVoiceTranscriptionOpen() && this.currentMessageObject.mediaExists)) {
if (this.miniButtonState == 0) {
FileLoader.getInstance(this.currentAccount).loadFile(this.documentAttach, this.currentMessageObject, 2, 0);
this.currentMessageObject.loadingCancelled = false;
}
if (this.delegate.needPlayMessage(this, this.currentMessageObject, false)) {
if (this.hasMiniProgress == 2 && this.miniButtonState != 1) {
this.miniButtonState = 1;
this.radialProgress.setProgress(0.0f, false);
this.radialProgress.setMiniIcon(getMiniIconForCurrentState(), false, true);
}
updatePlayingMessageProgress();
this.buttonState = 1;
this.radialProgress.setIcon(getIconForCurrentState(), false, true);
invalidate();
return;
}
return;
}
if (z2) {
this.videoRadialProgress.setProgress(0.0f, false);
} else {
this.radialProgress.setProgress(0.0f, false);
}
if (this.currentPhotoObject != null && (this.photoImage.hasNotThumb() || this.currentPhotoObjectThumb == null)) {
tLRPC$PhotoSize = this.currentPhotoObject;
str = ((tLRPC$PhotoSize instanceof TLRPC$TL_photoStrippedSize) || "s".equals(tLRPC$PhotoSize.type)) ? this.currentPhotoFilterThumb : this.currentPhotoFilter;
} else {
tLRPC$PhotoSize = this.currentPhotoObjectThumb;
str = this.currentPhotoFilterThumb;
}
String str2 = str;
int i3 = this.currentMessageObject.shouldEncryptPhotoOrVideo() ? 2 : 0;
MessageObject messageObject5 = this.currentMessageObject;
int i4 = messageObject5.type;
if (i4 == 1 || i4 == 20) {
this.photoImage.setForceLoading(true);
this.photoImage.setImage(ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject), this.currentPhotoFilter, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, this.currentPhotoObject.size, null, this.currentMessageObject, i3);
} else if (i4 == 8) {
FileLoader.getInstance(this.currentAccount).loadFile(this.documentAttach, this.currentMessageObject, 2, 0);
if (this.currentMessageObject.loadedFileSize > 0) {
createLoadingProgressLayout(this.documentAttach);
}
} else if (this.isRoundVideo) {
if (messageObject5.isSecretMedia()) {
FileLoader fileLoader = FileLoader.getInstance(this.currentAccount);
TLRPC$Document document = this.currentMessageObject.getDocument();
MessageObject messageObject6 = this.currentMessageObject;
fileLoader.loadFile(document, messageObject6, 2, messageObject6.shouldEncryptPhotoOrVideo() ? 2 : 1);
} else {
MessageObject messageObject7 = this.currentMessageObject;
messageObject7.gifState = 2.0f;
TLRPC$Document document2 = messageObject7.getDocument();
this.photoImage.setForceLoading(true);
this.photoImage.setImage(ImageLocation.getForDocument(document2), null, ImageLocation.getForObject(tLRPC$PhotoSize, document2), str2, document2.size, null, this.currentMessageObject, 0);
}
this.wouldBeInPip = true;
invalidate();
} else if (i4 == 9) {
FileLoader.getInstance(this.currentAccount).loadFile(this.documentAttach, this.currentMessageObject, 2, 0);
if (this.currentMessageObject.loadedFileSize > 0) {
createLoadingProgressLayout(this.documentAttach);
}
} else {
int i5 = this.documentAttachType;
if (i5 == 4) {
FileLoader.getInstance(this.currentAccount).loadFile(this.documentAttach, this.currentMessageObject, 1, i3);
MessageObject messageObject8 = this.currentMessageObject;
if (messageObject8.loadedFileSize > 0) {
createLoadingProgressLayout(messageObject8.getDocument());
}
} else if (i4 != 0 || i5 == 0) {
this.photoImage.setForceLoading(true);
this.photoImage.setImage(ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject), this.currentPhotoFilter, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, 0L, null, this.currentMessageObject, 0);
} else if (i5 == 2) {
this.photoImage.setForceLoading(true);
this.photoImage.setImage(ImageLocation.getForDocument(this.documentAttach), null, ImageLocation.getForDocument(this.currentPhotoObject, this.documentAttach), this.currentPhotoFilterThumb, this.documentAttach.size, null, this.currentMessageObject, i3);
MessageObject messageObject9 = this.currentMessageObject;
messageObject9.gifState = 2.0f;
if (messageObject9.loadedFileSize > 0) {
createLoadingProgressLayout(messageObject9.getDocument());
}
} else if (i5 == 1) {
FileLoader.getInstance(this.currentAccount).loadFile(this.documentAttach, this.currentMessageObject, 2, 0);
} else if (i5 == 8) {
this.photoImage.setImage(ImageLocation.getForDocument(this.documentAttach), this.currentPhotoFilter, ImageLocation.getForDocument(this.currentPhotoObject, this.documentAttach), "b1", 0L, "jpg", this.currentMessageObject, 1);
}
}
this.currentMessageObject.loadingCancelled = false;
this.buttonState = 1;
if (z2) {
this.videoRadialProgress.setIcon(14, false, z);
} else {
this.radialProgress.setIcon(getIconForCurrentState(), false, z);
}
invalidate();
return;
}
if (i == 1 && (!this.drawVideoImageButton || z2)) {
this.photoImage.setForceLoading(false);
int i6 = this.documentAttachType;
if (i6 == 3 || i6 == 5 || (i6 == 7 && (messageObject2 = this.currentMessageObject) != null && messageObject2.isVoiceTranscriptionOpen())) {
if (MediaController.getInstance().lambda$startAudioAgain$7(this.currentMessageObject)) {
this.buttonState = 0;
this.radialProgress.setIcon(getIconForCurrentState(), false, z);
invalidate();
return;
}
return;
}
if (this.currentMessageObject.isOut() && !this.drawVideoImageButton && (this.currentMessageObject.isSending() || this.currentMessageObject.isEditing())) {
if (this.radialProgress.getIcon() != 6) {
this.delegate.didPressCancelSendButton(this);
return;
}
return;
}
MessageObject messageObject10 = this.currentMessageObject;
messageObject10.loadingCancelled = true;
int i7 = this.documentAttachType;
if (i7 == 2 || i7 == 4 || i7 == 1 || i7 == 8) {
FileLoader.getInstance(this.currentAccount).cancelLoadFile(this.documentAttach);
} else {
int i8 = messageObject10.type;
if (i8 == 0 || i8 == 1 || i8 == 20 || i8 == 8 || i8 == 5) {
ImageLoader.getInstance().cancelForceLoadingForImageReceiver(this.photoImage);
this.photoImage.cancelLoadImage();
} else if (i8 == 9) {
FileLoader.getInstance(this.currentAccount).cancelLoadFile(this.currentMessageObject.getDocument());
}
}
this.buttonState = 0;
if (z2) {
this.videoRadialProgress.setIcon(2, false, z);
} else {
this.radialProgress.setIcon(getIconForCurrentState(), false, z);
}
invalidate();
return;
}
if (i != 2) {
if (i == 3 || i == 0) {
if (this.hasMiniProgress == 2 && this.miniButtonState != 1) {
this.miniButtonState = 1;
this.radialProgress.setProgress(0.0f, false);
this.radialProgress.setMiniIcon(getMiniIconForCurrentState(), false, z);
}
ChatMessageCellDelegate chatMessageCellDelegate = this.delegate;
if (chatMessageCellDelegate != null) {
chatMessageCellDelegate.didPressImage(this, 0.0f, 0.0f);
return;
}
return;
}
if (i == 4) {
int i9 = this.documentAttachType;
if (i9 == 3 || i9 == 5 || (i9 == 7 && (messageObject = this.currentMessageObject) != null && messageObject.isVoiceTranscriptionOpen())) {
if ((this.currentMessageObject.isOut() && (this.currentMessageObject.isSending() || this.currentMessageObject.isEditing())) || this.currentMessageObject.isSendError()) {
if (this.delegate == null || this.radialProgress.getIcon() == 6) {
return;
}
this.delegate.didPressCancelSendButton(this);
return;
}
this.currentMessageObject.loadingCancelled = true;
FileLoader.getInstance(this.currentAccount).cancelLoadFile(this.documentAttach);
this.buttonState = 2;
this.radialProgress.setIcon(getIconForCurrentState(), false, z);
invalidate();
return;
}
return;
}
return;
}
MessageObject messageObject11 = this.currentMessageObject;
if (messageObject11 != null && messageObject11.type == 23) {
this.delegate.didPressImage(this, 0.0f, 0.0f);
return;
}
if (this.documentAttachType == 7 && messageObject11 != null && messageObject11.isVoiceTranscriptionOpen()) {
if (this.miniButtonState == 0) {
FileLoader.getInstance(this.currentAccount).loadFile(this.documentAttach, this.currentMessageObject, 2, 0);
this.currentMessageObject.loadingCancelled = false;
}
if (this.delegate.needPlayMessage(this, this.currentMessageObject, false)) {
if (this.hasMiniProgress == 2 && this.miniButtonState != 1) {
this.miniButtonState = 1;
this.radialProgress.setProgress(0.0f, false);
this.radialProgress.setMiniIcon(getMiniIconForCurrentState(), false, true);
}
updatePlayingMessageProgress();
this.buttonState = 1;
this.radialProgress.setIcon(getIconForCurrentState(), false, true);
invalidate();
}
if (this.isRoundVideo) {
this.wouldBeInPip = true;
invalidate();
return;
}
return;
}
int i10 = this.documentAttachType;
if (i10 == 3 || i10 == 5) {
this.radialProgress.setProgress(0.0f, false);
FileLoader.getInstance(this.currentAccount).loadFile(this.documentAttach, this.currentMessageObject, 2, 0);
this.currentMessageObject.loadingCancelled = false;
this.buttonState = 4;
this.radialProgress.setIcon(getIconForCurrentState(), true, z);
invalidate();
return;
}
if (this.isRoundVideo) {
MessageObject playingMessageObject = MediaController.getInstance().getPlayingMessageObject();
if (playingMessageObject == null || !playingMessageObject.isRoundVideo()) {
this.photoImage.setAllowStartAnimation(true);
this.photoImage.startAnimation();
}
} else {
this.photoImage.setAllowStartAnimation(true);
this.photoImage.startAnimation();
}
this.currentMessageObject.gifState = 0.0f;
this.buttonState = -1;
this.radialProgress.setIcon(getIconForCurrentState(), false, z);
}
@Override
public void onFailedDownload(String str, boolean z) {
int i = this.documentAttachType;
updateButtonState(true, i == 3 || i == 5, false);
}
@Override
public void onSuccessDownload(String str) {
TLRPC$Document tLRPC$Document;
if (this.documentAttachType == 6 && this.currentMessageObject.isDice()) {
DownloadController.getInstance(this.currentAccount).removeLoadingFileObserver(this);
setCurrentDiceValue(true);
return;
}
int i = this.documentAttachType;
if (i == 3 || i == 5) {
updateButtonState(false, true, false);
updateWaveform();
return;
}
if (this.drawVideoImageButton) {
this.videoRadialProgress.setProgress(1.0f, true);
} else {
this.radialProgress.setProgress(1.0f, true);
}
if (!this.currentMessageObject.needDrawBluredPreview() && !this.autoPlayingMedia && (tLRPC$Document = this.documentAttach) != null) {
if (this.documentAttachType == 7) {
ImageReceiver imageReceiver = this.photoImage;
ImageLocation forDocument = ImageLocation.getForDocument(tLRPC$Document);
ImageLocation forObject = ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject);
TLRPC$PhotoSize tLRPC$PhotoSize = this.currentPhotoObject;
imageReceiver.setImage(forDocument, ImageLoader.AUTOPLAY_FILTER, forObject, ((tLRPC$PhotoSize instanceof TLRPC$TL_photoStrippedSize) || (tLRPC$PhotoSize != null && "s".equals(tLRPC$PhotoSize.type))) ? this.currentPhotoFilterThumb : this.currentPhotoFilter, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, this.documentAttach.size, null, this.currentMessageObject, 0);
this.photoImage.setAllowStartAnimation(true);
this.photoImage.startAnimation();
this.autoPlayingMedia = true;
} else {
if (!this.isSmallImage && SharedConfig.isAutoplayVideo() && !this.currentMessageObject.isRepostPreview && this.documentAttachType == 4) {
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
if (groupedMessagePosition != null) {
int i2 = groupedMessagePosition.flags;
if ((i2 & 1) != 0) {
}
}
this.animatingNoSound = 2;
ImageReceiver imageReceiver2 = this.photoImage;
ImageLocation forDocument2 = ImageLocation.getForDocument(this.documentAttach);
ImageLocation forObject2 = ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject);
TLRPC$PhotoSize tLRPC$PhotoSize2 = this.currentPhotoObject;
imageReceiver2.setImage(forDocument2, ImageLoader.AUTOPLAY_FILTER, forObject2, ((tLRPC$PhotoSize2 instanceof TLRPC$TL_photoStrippedSize) || (tLRPC$PhotoSize2 != null && "s".equals(tLRPC$PhotoSize2.type))) ? this.currentPhotoFilterThumb : this.currentPhotoFilter, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, this.documentAttach.size, null, this.currentMessageObject, 0);
if (!PhotoViewer.isPlayingMessage(this.currentMessageObject)) {
this.photoImage.setAllowStartAnimation(true);
this.photoImage.startAnimation();
} else {
this.photoImage.setAllowStartAnimation(false);
}
this.autoPlayingMedia = true;
}
if (this.documentAttachType == 2) {
ImageReceiver imageReceiver3 = this.photoImage;
ImageLocation forDocument3 = ImageLocation.getForDocument(this.documentAttach);
ImageLocation forObject3 = ImageLocation.getForObject(this.currentPhotoObject, this.photoParentObject);
TLRPC$PhotoSize tLRPC$PhotoSize3 = this.currentPhotoObject;
imageReceiver3.setImage(forDocument3, ImageLoader.AUTOPLAY_FILTER, forObject3, ((tLRPC$PhotoSize3 instanceof TLRPC$TL_photoStrippedSize) || (tLRPC$PhotoSize3 != null && "s".equals(tLRPC$PhotoSize3.type))) ? this.currentPhotoFilterThumb : this.currentPhotoFilter, ImageLocation.getForObject(this.currentPhotoObjectThumb, this.photoParentObject), this.currentPhotoFilterThumb, this.currentPhotoObjectThumbStripped, this.documentAttach.size, null, this.currentMessageObject, 0);
if (SharedConfig.isAutoplayGifs() && !this.currentMessageObject.isRepostPreview) {
this.photoImage.setAllowStartAnimation(true);
this.photoImage.startAnimation();
} else {
this.photoImage.setAllowStartAnimation(false);
this.photoImage.stopAnimation();
}
this.autoPlayingMedia = true;
}
}
}
MessageObject messageObject = this.currentMessageObject;
if (messageObject.type == 0) {
if (!this.autoPlayingMedia && this.documentAttachType == 2 && messageObject.gifState != 1.0f) {
this.buttonState = 2;
didPressButton(true, false);
return;
} else if (!this.photoNotSet) {
updateButtonState(false, true, false);
return;
} else {
setMessageObject(messageObject, this.currentMessagesGroup, this.pinnedBottom, this.pinnedTop);
return;
}
}
if (!this.photoNotSet) {
updateButtonState(false, true, false);
}
if (this.photoNotSet) {
setMessageObject(this.currentMessageObject, this.currentMessagesGroup, this.pinnedBottom, this.pinnedTop);
}
}
@Override
public void didSetImage(ImageReceiver imageReceiver, boolean z, boolean z2, boolean z3) {
MessageObject messageObject = this.currentMessageObject;
if (messageObject != null && z) {
if (setCurrentDiceValue((z3 || messageObject.wasUnread) ? false : true)) {
return;
}
if (z2) {
MessageObject messageObject2 = this.currentMessageObject;
if (messageObject2.type == 20) {
}
}
if (!z2) {
MessageObject messageObject3 = this.currentMessageObject;
if (!messageObject3.mediaExists) {
if (!messageObject3.attachPathExists) {
int i = messageObject3.type;
if (i == 0) {
int i2 = this.documentAttachType;
if (i2 != 8) {
if (i2 != 0) {
}
}
this.currentMessageObject.mediaExists = true;
updateButtonState(false, true, false);
}
}
}
}
}
if (!z || this.currentMessageObject == null) {
return;
}
if (this.blurredPhotoImage.getBitmap() != null) {
this.blurredPhotoImage.getBitmap().recycle();
this.blurredPhotoImage.setImageBitmap((Bitmap) null);
}
if (!this.currentMessageObject.hasMediaSpoilers() || imageReceiver.getBitmap() == null || imageReceiver.getBitmap().isRecycled()) {
return;
}
this.blurredPhotoImage.setImageBitmap(Utilities.stackBlurBitmapMax(imageReceiver.getBitmap(), this.currentMessageObject.isRoundVideo()));
this.blurredPhotoImage.setColorFilter(getFancyBlurFilter());
}
public boolean setCurrentDiceValue(boolean z) {
MessagesController.DiceFrameSuccess diceFrameSuccess;
if (!this.currentMessageObject.isDice()) {
return false;
}
Drawable drawable = this.photoImage.getDrawable();
if (drawable instanceof RLottieDrawable) {
RLottieDrawable rLottieDrawable = (RLottieDrawable) drawable;
String diceEmoji = this.currentMessageObject.getDiceEmoji();
TLRPC$TL_messages_stickerSet stickerSetByEmojiOrName = MediaDataController.getInstance(this.currentAccount).getStickerSetByEmojiOrName(diceEmoji);
if (stickerSetByEmojiOrName != null) {
int diceValue = this.currentMessageObject.getDiceValue();
if ("🎰".equals(this.currentMessageObject.getDiceEmoji())) {
if (diceValue >= 0 && diceValue <= 64) {
((SlotsDrawable) rLottieDrawable).setDiceNumber(this, diceValue, stickerSetByEmojiOrName, z);
if (this.currentMessageObject.isOut()) {
rLottieDrawable.setOnFinishCallback(this.diceFinishCallback, ConnectionsManager.DEFAULT_DATACENTER_ID);
}
this.currentMessageObject.wasUnread = false;
}
if (!rLottieDrawable.hasBaseDice() && stickerSetByEmojiOrName.documents.size() > 0) {
((SlotsDrawable) rLottieDrawable).setBaseDice(this, stickerSetByEmojiOrName);
}
} else {
if (!rLottieDrawable.hasBaseDice() && stickerSetByEmojiOrName.documents.size() > 0) {
TLRPC$Document tLRPC$Document = stickerSetByEmojiOrName.documents.get(0);
if (rLottieDrawable.setBaseDice(FileLoader.getInstance(this.currentAccount).getPathToAttach(tLRPC$Document, true))) {
DownloadController.getInstance(this.currentAccount).removeLoadingFileObserver(this);
} else {
DownloadController.getInstance(this.currentAccount).addLoadingFileObserver(FileLoader.getAttachFileName(tLRPC$Document), this.currentMessageObject, this);
FileLoader.getInstance(this.currentAccount).loadFile(tLRPC$Document, stickerSetByEmojiOrName, 1, 1);
}
}
if (diceValue >= 0 && diceValue < stickerSetByEmojiOrName.documents.size()) {
if (!z && this.currentMessageObject.isOut() && (diceFrameSuccess = MessagesController.getInstance(this.currentAccount).diceSuccess.get(diceEmoji)) != null && diceFrameSuccess.num == diceValue) {
rLottieDrawable.setOnFinishCallback(this.diceFinishCallback, diceFrameSuccess.frame);
}
TLRPC$Document tLRPC$Document2 = stickerSetByEmojiOrName.documents.get(Math.max(diceValue, 0));
if (rLottieDrawable.setDiceNumber(FileLoader.getInstance(this.currentAccount).getPathToAttach(tLRPC$Document2, true), z)) {
DownloadController.getInstance(this.currentAccount).removeLoadingFileObserver(this);
} else {
DownloadController.getInstance(this.currentAccount).addLoadingFileObserver(FileLoader.getAttachFileName(tLRPC$Document2), this.currentMessageObject, this);
FileLoader.getInstance(this.currentAccount).loadFile(tLRPC$Document2, stickerSetByEmojiOrName, 1, 1);
}
this.currentMessageObject.wasUnread = false;
}
}
} else {
MediaDataController.getInstance(this.currentAccount).loadStickersByEmojiOrName(diceEmoji, true, true);
}
}
return true;
}
@Override
public void onAnimationReady(ImageReceiver imageReceiver) {
MessageObject messageObject = this.currentMessageObject;
if (messageObject != null && imageReceiver == this.photoImage && messageObject.isAnimatedSticker()) {
this.delegate.setShouldNotRepeatSticker(this.currentMessageObject);
}
}
@Override
public void onProgressDownload(String str, long j, long j2) {
float min = j2 == 0 ? 0.0f : Math.min(1.0f, ((float) j) / ((float) j2));
this.currentMessageObject.loadedFileSize = j;
createLoadingProgressLayout(j, j2);
if (this.drawVideoImageButton) {
this.videoRadialProgress.setProgress(min, true);
} else {
this.radialProgress.setProgress(min, true);
}
int i = this.documentAttachType;
if (i == 3 || i == 5) {
if (this.hasMiniProgress != 0) {
if (this.miniButtonState != 1) {
updateButtonState(false, false, false);
return;
}
return;
} else {
if (this.buttonState != 4) {
updateButtonState(false, false, false);
return;
}
return;
}
}
if (this.hasMiniProgress != 0) {
if (this.miniButtonState != 1) {
updateButtonState(false, false, false);
}
} else if (this.buttonState != 1) {
updateButtonState(false, false, false);
}
}
@Override
public void onProgressUpload(String str, long j, long j2, boolean z) {
int i;
float min = j2 == 0 ? 0.0f : Math.min(1.0f, ((float) j) / ((float) j2));
this.currentMessageObject.loadedFileSize = j;
this.radialProgress.setProgress(min, true);
if (j == j2 && this.currentPosition != null && SendMessagesHelper.getInstance(this.currentAccount).isSendingMessage(this.currentMessageObject.getId()) && ((i = this.buttonState) == 1 || (i == 4 && this.documentAttachType == 5))) {
this.drawRadialCheckBackground = true;
getIconForCurrentState();
this.radialProgress.setIcon(6, false, true);
}
long j3 = this.lastLoadingSizeTotal;
if (j3 > 0 && Math.abs(j3 - j2) > 1048576) {
this.lastLoadingSizeTotal = j2;
}
createLoadingProgressLayout(j, j2);
}
private void createLoadingProgressLayout(TLRPC$Document tLRPC$Document) {
if (tLRPC$Document == null) {
return;
}
long[] fileProgressSizes = ImageLoader.getInstance().getFileProgressSizes(FileLoader.getDocumentFileName(tLRPC$Document));
if (fileProgressSizes != null) {
createLoadingProgressLayout(fileProgressSizes[0], fileProgressSizes[1]);
} else {
createLoadingProgressLayout(this.currentMessageObject.loadedFileSize, tLRPC$Document.size);
}
}
private void createLoadingProgressLayout(long j, long j2) {
boolean z;
String format;
int ceil;
String str;
int i;
long j3 = j2;
if (j3 <= 0 || this.documentAttach == null) {
this.loadingProgressLayout = null;
return;
}
long j4 = (j << 16) + j3;
if (this.loadingProgressLayout == null || this.loadingProgressLayoutHash != j4) {
this.loadingProgressLayoutHash = j4;
long j5 = this.lastLoadingSizeTotal;
if (j5 == 0) {
this.lastLoadingSizeTotal = j3;
} else {
if (j > j5) {
j3 = j5;
String formatFileSize = AndroidUtilities.formatFileSize(j3);
int ceil2 = (int) Math.ceil(Theme.chat_infoPaint.measureText(String.format("000.0 mm / %s", formatFileSize)));
if (this.documentAttachType != 1) {
format = ceil2 <= Math.max(this.infoWidth, this.docTitleWidth) ? String.format("%s / %s", AndroidUtilities.formatFileSize(j5), formatFileSize) : AndroidUtilities.formatFileSize(j5);
z = true;
} else {
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
z = groupedMessagePosition == null || (groupedMessagePosition.flags & 3) == 3;
if (z) {
format = String.format("%s / %s", AndroidUtilities.formatFileSize(j5), formatFileSize);
} else {
int min = (int) (Math.min(1.0f, ((float) j5) / ((float) j3)) * 100.0f);
format = min >= 100 ? "100%" : String.format(Locale.US, "%2d%%", Integer.valueOf(min));
}
}
ceil = (int) Math.ceil(Theme.chat_infoPaint.measureText(format));
if (z || ceil <= this.backgroundWidth - AndroidUtilities.dp(48.0f)) {
str = format;
i = ceil;
} else {
int min2 = (int) (Math.min(1.0f, ((float) j5) / ((float) j3)) * 100.0f);
String format2 = min2 < 100 ? String.format(Locale.US, "%2d%%", Integer.valueOf(min2)) : "100%";
i = (int) Math.ceil(Theme.chat_infoPaint.measureText(format2));
str = format2;
}
this.loadingProgressLayout = new StaticLayout(str, Theme.chat_infoPaint, i, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
}
j3 = j5;
}
j5 = j;
String formatFileSize2 = AndroidUtilities.formatFileSize(j3);
int ceil22 = (int) Math.ceil(Theme.chat_infoPaint.measureText(String.format("000.0 mm / %s", formatFileSize2)));
if (this.documentAttachType != 1) {
}
ceil = (int) Math.ceil(Theme.chat_infoPaint.measureText(format));
if (z) {
}
str = format;
i = ceil;
this.loadingProgressLayout = new StaticLayout(str, Theme.chat_infoPaint, i, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
}
}
@Override
public void onProvideStructure(ViewStructure viewStructure) {
CharSequence charSequence;
CharSequence charSequence2;
super.onProvideStructure(viewStructure);
if (!this.allowAssistant || Build.VERSION.SDK_INT < 23) {
return;
}
MessageObject messageObject = this.currentMessageObject;
if (messageObject != null && (charSequence2 = messageObject.messageText) != null && charSequence2.length() > 0) {
viewStructure.setText(this.currentMessageObject.messageText);
return;
}
MessageObject messageObject2 = this.currentMessageObject;
if (messageObject2 == null || (charSequence = messageObject2.caption) == null || charSequence.length() <= 0) {
return;
}
viewStructure.setText(this.currentMessageObject.caption);
}
public void setDelegate(ChatMessageCellDelegate chatMessageCellDelegate) {
this.delegate = chatMessageCellDelegate;
}
public ChatMessageCellDelegate getDelegate() {
return this.delegate;
}
public void setAllowAssistant(boolean z) {
this.allowAssistant = z;
}
private void measureTime(MessageObject messageObject) {
TLRPC$User user;
String replace;
String str;
String format;
int ceil;
MessageObject messageObject2;
TLRPC$Message tLRPC$Message;
int i;
int dp;
TLRPC$Message tLRPC$Message2;
MessageObject.GroupedMessages groupedMessages;
long fromChatId = messageObject.getFromChatId();
CharSequence charSequence = "";
if (!messageObject.scheduled) {
TLRPC$Message tLRPC$Message3 = messageObject.messageOwner;
if (tLRPC$Message3.post_author != null) {
if (!this.isMegagroup || messageObject.getFromChatId() != messageObject.getDialogId()) {
replace = messageObject.messageOwner.post_author.replace("\n", "");
}
} else {
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader = tLRPC$Message3.fwd_from;
if (tLRPC$MessageFwdHeader != null && (str = tLRPC$MessageFwdHeader.post_author) != null) {
replace = str.replace("\n", "");
} else if (tLRPC$MessageFwdHeader != null && tLRPC$MessageFwdHeader.imported) {
replace = tLRPC$MessageFwdHeader.date == tLRPC$Message3.date ? LocaleController.getString("ImportedMessage", org.telegram.messenger.R.string.ImportedMessage) : LocaleController.formatImportedDate(messageObject.messageOwner.fwd_from.date) + " " + LocaleController.getString("ImportedMessage", org.telegram.messenger.R.string.ImportedMessage);
} else if (!messageObject.isOutOwner() && fromChatId > 0 && messageObject.messageOwner.post && (user = MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(fromChatId))) != null) {
replace = ContactsController.formatName(user.first_name, user.last_name).replace('\n', ' ');
}
}
TLRPC$User user2 = !this.currentMessageObject.isFromUser() ? MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(fromChatId)) : null;
boolean hasReplies = messageObject.hasReplies();
if (!messageObject.scheduled && !messageObject.isLiveLocation() && !messageObject.messageOwner.edit_hide && messageObject.getDialogId() != 777000) {
tLRPC$Message2 = messageObject.messageOwner;
if (tLRPC$Message2.via_bot_id == 0 && tLRPC$Message2.via_bot_name == null && (user2 == null || !user2.bot)) {
if (this.currentPosition != null || (groupedMessages = this.currentMessagesGroup) == null || groupedMessages.messages.isEmpty()) {
this.edited = (messageObject.messageOwner.flags & LiteMode.FLAG_CHAT_SCALE) == 0 || messageObject.isEditing();
} else {
this.edited = false;
hasReplies = this.currentMessagesGroup.messages.get(0).hasReplies();
if (!this.currentMessagesGroup.messages.get(0).messageOwner.edit_hide) {
int size = this.currentMessagesGroup.messages.size();
for (int i2 = 0; i2 < size; i2++) {
MessageObject messageObject3 = this.currentMessagesGroup.messages.get(i2);
if ((messageObject3.messageOwner.flags & LiteMode.FLAG_CHAT_SCALE) != 0 || messageObject3.isEditing()) {
this.edited = true;
break;
}
}
}
}
if (!this.currentMessageObject.isSponsored()) {
MessageObject messageObject4 = this.currentMessageObject;
if (!messageObject4.scheduled || messageObject4.messageOwner.date != 2147483646) {
if (messageObject4.isRepostPreview) {
format = LocaleController.formatSmallDateChat(messageObject.messageOwner.date) + ", " + LocaleController.getInstance().formatterDay.format(messageObject.messageOwner.date * 1000);
} else if (this.edited) {
format = LocaleController.getString("EditedMessage", org.telegram.messenger.R.string.EditedMessage) + " " + LocaleController.getInstance().formatterDay.format(messageObject.messageOwner.date * 1000);
} else {
format = LocaleController.getInstance().formatterDay.format(messageObject.messageOwner.date * 1000);
}
if (replace != null) {
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader2 = messageObject.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader2 != null && tLRPC$MessageFwdHeader2.imported) {
this.currentTimeString = " " + format;
} else {
this.currentTimeString = ", " + format;
}
} else {
this.currentTimeString = format;
}
TextPaint textPaint = Theme.chat_timePaint;
ceil = (int) Math.ceil(textPaint.measureText(r5, 0, this.currentTimeString == null ? 0 : r5.length()));
this.timeWidth = ceil;
this.timeTextWidth = ceil;
messageObject2 = this.currentMessageObject;
if (messageObject2.scheduled && messageObject2.messageOwner.date == 2147483646) {
this.timeWidth = ceil - AndroidUtilities.dp(8.0f);
}
tLRPC$Message = messageObject.messageOwner;
if ((tLRPC$Message.flags & 1024) != 0) {
this.currentViewsString = String.format("%s", LocaleController.formatShortNumber(Math.max(1, tLRPC$Message.views), null));
this.viewsTextWidth = (int) Math.ceil(Theme.chat_timePaint.measureText(r2));
this.timeWidth = (int) (this.timeWidth + this.viewsTextWidth + ((Theme.chat_msgInViewsDrawable.getIntrinsicWidth() * (Theme.chat_timePaint.getTextSize() - AndroidUtilities.dp(2.0f))) / Theme.chat_msgInViewsDrawable.getIntrinsicHeight()) + AndroidUtilities.dp(10.0f));
}
if (messageObject.type == 20) {
int i3 = org.telegram.messenger.R.string.PaymentCheckoutPay;
LocaleController localeController = LocaleController.getInstance();
TLRPC$MessageMedia tLRPC$MessageMedia = messageObject.messageOwner.media;
String formatCurrencyString = localeController.formatCurrencyString(tLRPC$MessageMedia.total_amount, tLRPC$MessageMedia.currency);
Locale locale = Locale.ROOT;
String formatString = LocaleController.formatString(i3, formatCurrencyString.toUpperCase(locale));
if (formatString.length() >= 2) {
formatString = formatString.substring(0, 1).toUpperCase(locale) + formatString.substring(1).toLowerCase(locale);
}
this.currentUnlockString = formatString;
this.unlockTextWidth = (int) Math.ceil(Theme.chat_unlockExtendedMediaTextPaint.measureText(formatString));
}
if (!this.isChat && this.isMegagroup && !this.isThreadChat && hasReplies) {
this.currentRepliesString = String.format("%s", LocaleController.formatShortNumber(getRepliesCount(), null));
this.repliesTextWidth = (int) Math.ceil(Theme.chat_timePaint.measureText(r2));
this.timeWidth = (int) (this.timeWidth + this.repliesTextWidth + ((Theme.chat_msgInRepliesDrawable.getIntrinsicWidth() * (Theme.chat_timePaint.getTextSize() - AndroidUtilities.dp(2.0f))) / Theme.chat_msgInRepliesDrawable.getIntrinsicHeight()) + AndroidUtilities.dp(10.0f));
} else {
this.currentRepliesString = null;
}
if (this.isPinned) {
this.timeWidth += Theme.chat_msgInPinnedDrawable.getIntrinsicWidth() + AndroidUtilities.dp(3.0f);
}
if (messageObject.scheduled) {
if (messageObject.isSendError()) {
this.timeWidth += AndroidUtilities.dp(18.0f);
} else if (messageObject.isSending() && messageObject.messageOwner.peer_id.channel_id != 0 && !messageObject.isSupergroup()) {
this.timeWidth += AndroidUtilities.dp(18.0f);
}
}
if (this.currentMessageObject.shouldDrawReactions()) {
ReactionsLayoutInBubble reactionsLayoutInBubble = this.reactionsLayoutInBubble;
if (reactionsLayoutInBubble.isSmall) {
reactionsLayoutInBubble.measure(ConnectionsManager.DEFAULT_DATACENTER_ID, 3);
this.timeWidth += this.reactionsLayoutInBubble.width;
}
}
if (replace != null) {
if (this.availableTimeWidth == 0) {
this.availableTimeWidth = AndroidUtilities.dp(1000.0f);
}
int i4 = this.availableTimeWidth - this.timeWidth;
if (messageObject.isOutOwner()) {
if (messageObject.type == 5) {
dp = AndroidUtilities.dp(20.0f);
} else {
dp = AndroidUtilities.dp(96.0f);
}
i4 -= dp;
}
CharSequence replaceEmoji = Emoji.replaceEmoji((CharSequence) replace, Theme.chat_timePaint.getFontMetricsInt(), AndroidUtilities.dp(10.0f), false);
int ceil2 = (int) Math.ceil(Theme.chat_timePaint.measureText(replaceEmoji, 0, replaceEmoji.length()));
if (ceil2 <= i4) {
charSequence = replaceEmoji;
i = ceil2;
} else if (i4 <= 0) {
i = 0;
} else {
charSequence = TextUtils.ellipsize(replaceEmoji, Theme.chat_timePaint, i4, TextUtils.TruncateAt.END);
i = i4;
}
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(charSequence);
spannableStringBuilder.append(this.currentTimeString);
this.currentTimeString = spannableStringBuilder;
this.timeTextWidth += i;
this.timeWidth += i;
return;
}
return;
}
}
format = "";
if (replace != null) {
}
TextPaint textPaint2 = Theme.chat_timePaint;
ceil = (int) Math.ceil(textPaint2.measureText(r5, 0, this.currentTimeString == null ? 0 : r5.length()));
this.timeWidth = ceil;
this.timeTextWidth = ceil;
messageObject2 = this.currentMessageObject;
if (messageObject2.scheduled) {
this.timeWidth = ceil - AndroidUtilities.dp(8.0f);
}
tLRPC$Message = messageObject.messageOwner;
if ((tLRPC$Message.flags & 1024) != 0) {
}
if (messageObject.type == 20) {
}
if (!this.isChat) {
}
this.currentRepliesString = null;
if (this.isPinned) {
}
if (messageObject.scheduled) {
}
if (this.currentMessageObject.shouldDrawReactions()) {
}
if (replace != null) {
}
}
}
this.edited = false;
if (!this.currentMessageObject.isSponsored()) {
}
format = "";
if (replace != null) {
}
TextPaint textPaint22 = Theme.chat_timePaint;
ceil = (int) Math.ceil(textPaint22.measureText(r5, 0, this.currentTimeString == null ? 0 : r5.length()));
this.timeWidth = ceil;
this.timeTextWidth = ceil;
messageObject2 = this.currentMessageObject;
if (messageObject2.scheduled) {
}
tLRPC$Message = messageObject.messageOwner;
if ((tLRPC$Message.flags & 1024) != 0) {
}
if (messageObject.type == 20) {
}
if (!this.isChat) {
}
this.currentRepliesString = null;
if (this.isPinned) {
}
if (messageObject.scheduled) {
}
if (this.currentMessageObject.shouldDrawReactions()) {
}
if (replace != null) {
}
}
replace = null;
if (!this.currentMessageObject.isFromUser()) {
}
boolean hasReplies2 = messageObject.hasReplies();
if (!messageObject.scheduled) {
tLRPC$Message2 = messageObject.messageOwner;
if (tLRPC$Message2.via_bot_id == 0) {
if (this.currentPosition != null) {
}
this.edited = (messageObject.messageOwner.flags & LiteMode.FLAG_CHAT_SCALE) == 0 || messageObject.isEditing();
if (!this.currentMessageObject.isSponsored()) {
}
format = "";
if (replace != null) {
}
TextPaint textPaint222 = Theme.chat_timePaint;
ceil = (int) Math.ceil(textPaint222.measureText(r5, 0, this.currentTimeString == null ? 0 : r5.length()));
this.timeWidth = ceil;
this.timeTextWidth = ceil;
messageObject2 = this.currentMessageObject;
if (messageObject2.scheduled) {
}
tLRPC$Message = messageObject.messageOwner;
if ((tLRPC$Message.flags & 1024) != 0) {
}
if (messageObject.type == 20) {
}
if (!this.isChat) {
}
this.currentRepliesString = null;
if (this.isPinned) {
}
if (messageObject.scheduled) {
}
if (this.currentMessageObject.shouldDrawReactions()) {
}
if (replace != null) {
}
}
}
this.edited = false;
if (!this.currentMessageObject.isSponsored()) {
}
format = "";
if (replace != null) {
}
TextPaint textPaint2222 = Theme.chat_timePaint;
ceil = (int) Math.ceil(textPaint2222.measureText(r5, 0, this.currentTimeString == null ? 0 : r5.length()));
this.timeWidth = ceil;
this.timeTextWidth = ceil;
messageObject2 = this.currentMessageObject;
if (messageObject2.scheduled) {
}
tLRPC$Message = messageObject.messageOwner;
if ((tLRPC$Message.flags & 1024) != 0) {
}
if (messageObject.type == 20) {
}
if (!this.isChat) {
}
this.currentRepliesString = null;
if (this.isPinned) {
}
if (messageObject.scheduled) {
}
if (this.currentMessageObject.shouldDrawReactions()) {
}
if (replace != null) {
}
}
private boolean shouldDrawSelectionOverlay() {
return hasSelectionOverlay() && ((isPressed() && this.isCheckPressed) || ((!this.isCheckPressed && this.isPressed) || this.isHighlighted || this.isHighlightedAnimated)) && !textIsSelectionMode() && ((this.currentMessagesGroup == null || this.drawSelectionBackground) && this.currentBackgroundDrawable != null);
}
private int getSelectionOverlayColor() {
Theme.ResourcesProvider resourcesProvider = this.resourcesProvider;
if (resourcesProvider == null) {
return 0;
}
MessageObject messageObject = this.currentMessageObject;
return resourcesProvider.getColor((messageObject == null || !messageObject.isOut()) ? Theme.key_chat_inBubbleSelectedOverlay : Theme.key_chat_outBubbleSelectedOverlay);
}
private boolean hasSelectionOverlay() {
int selectionOverlayColor = getSelectionOverlayColor();
return (selectionOverlayColor == 0 || selectionOverlayColor == -65536) ? false : true;
}
private boolean isDrawSelectionBackground() {
MessageObject messageObject;
return ((isPressed() && this.isCheckPressed) || ((!this.isCheckPressed && this.isPressed) || this.isHighlighted)) && !textIsSelectionMode() && !hasSelectionOverlay() && ((messageObject = this.currentMessageObject) == null || !messageObject.preview);
}
public boolean isOpenChatByShare(MessageObject messageObject) {
ChatMessageCellDelegate chatMessageCellDelegate;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader = messageObject.messageOwner.fwd_from;
return (tLRPC$MessageFwdHeader == null || tLRPC$MessageFwdHeader.saved_from_peer == null || ((chatMessageCellDelegate = this.delegate) != null && !chatMessageCellDelegate.isReplyOrSelf())) ? false : true;
}
protected boolean checkNeedDrawShareButton(MessageObject messageObject) {
MessageObject.GroupedMessagePosition groupedMessagePosition;
MessageObject messageObject2 = this.currentMessageObject;
if ((messageObject2.deleted && !messageObject2.deletedByThanos) || messageObject2.isSponsored()) {
return false;
}
if (this.currentMessagesGroup != null && (groupedMessagePosition = this.currentPosition) != null) {
int i = groupedMessagePosition.flags;
boolean z = true;
if ((i & 8) != 0) {
}
z = false;
MessageObject.GroupedMessages groupedMessages = this.currentMessagesGroup;
boolean z2 = groupedMessages.reversed;
if ((!z2 && !groupedMessages.isDocuments && !z) || (z2 && !z)) {
return false;
}
}
return messageObject.needDrawShareButton();
}
public boolean isInsideBackground(float f, float f2) {
if (this.currentBackgroundDrawable != null) {
if (f >= this.backgroundDrawableLeft && f <= r3 + this.backgroundDrawableRight) {
return true;
}
}
return false;
}
private void updateCurrentUserAndChat() {
TLRPC$Peer tLRPC$Peer;
if (this.currentMessageObject == null) {
return;
}
MessagesController messagesController = MessagesController.getInstance(this.currentAccount);
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader = this.currentMessageObject.messageOwner.fwd_from;
long clientUserId = UserConfig.getInstance(this.currentAccount).getClientUserId();
if (tLRPC$MessageFwdHeader != null && (tLRPC$MessageFwdHeader.from_id instanceof TLRPC$TL_peerChannel) && (this.currentMessageObject.getDialogId() == clientUserId || this.currentMessageObject.getDialogId() == UserObject.REPLY_BOT)) {
this.currentChat = MessagesController.getInstance(this.currentAccount).getChat(Long.valueOf(tLRPC$MessageFwdHeader.from_id.channel_id));
return;
}
if (tLRPC$MessageFwdHeader != null && (tLRPC$Peer = tLRPC$MessageFwdHeader.saved_from_peer) != null) {
long j = tLRPC$Peer.user_id;
if (j != 0) {
if (!this.isSavedChat) {
TLRPC$Peer tLRPC$Peer2 = tLRPC$MessageFwdHeader.from_id;
if (tLRPC$Peer2 instanceof TLRPC$TL_peerUser) {
this.currentUser = messagesController.getUser(Long.valueOf(tLRPC$Peer2.user_id));
return;
}
}
this.currentUser = messagesController.getUser(Long.valueOf(j));
return;
}
if (tLRPC$Peer.channel_id != 0) {
if (this.currentMessageObject.isSavedFromMegagroup()) {
TLRPC$Peer tLRPC$Peer3 = tLRPC$MessageFwdHeader.from_id;
if (tLRPC$Peer3 instanceof TLRPC$TL_peerUser) {
this.currentUser = messagesController.getUser(Long.valueOf(tLRPC$Peer3.user_id));
return;
}
}
this.currentChat = messagesController.getChat(Long.valueOf(tLRPC$MessageFwdHeader.saved_from_peer.channel_id));
return;
}
long j2 = tLRPC$Peer.chat_id;
if (j2 != 0) {
TLRPC$Peer tLRPC$Peer4 = tLRPC$MessageFwdHeader.from_id;
if (tLRPC$Peer4 instanceof TLRPC$TL_peerUser) {
this.currentUser = messagesController.getUser(Long.valueOf(tLRPC$Peer4.user_id));
return;
} else {
this.currentChat = messagesController.getChat(Long.valueOf(j2));
return;
}
}
return;
}
if (tLRPC$MessageFwdHeader != null && (tLRPC$MessageFwdHeader.from_id instanceof TLRPC$TL_peerUser) && (tLRPC$MessageFwdHeader.imported || this.currentMessageObject.getDialogId() == clientUserId)) {
this.currentUser = messagesController.getUser(Long.valueOf(tLRPC$MessageFwdHeader.from_id.user_id));
return;
}
if (tLRPC$MessageFwdHeader != null && !TextUtils.isEmpty(tLRPC$MessageFwdHeader.from_name) && (tLRPC$MessageFwdHeader.imported || this.currentMessageObject.getDialogId() == clientUserId)) {
TLRPC$TL_user tLRPC$TL_user = new TLRPC$TL_user();
this.currentUser = tLRPC$TL_user;
tLRPC$TL_user.first_name = tLRPC$MessageFwdHeader.from_name;
return;
}
long fromChatId = this.currentMessageObject.getFromChatId();
if (DialogObject.isEncryptedDialog(this.currentMessageObject.getDialogId())) {
if (this.currentMessageObject.isOutOwner()) {
this.currentUser = UserConfig.getInstance(this.currentAccount).getCurrentUser();
return;
}
TLRPC$EncryptedChat encryptedChat = messagesController.getEncryptedChat(Integer.valueOf(DialogObject.getEncryptedChatId(this.currentMessageObject.getDialogId())));
if (encryptedChat != null) {
this.currentUser = messagesController.getUser(Long.valueOf(encryptedChat.user_id));
return;
}
return;
}
if (DialogObject.isUserDialog(fromChatId) && !this.currentMessageObject.messageOwner.post) {
this.currentUser = messagesController.getUser(Long.valueOf(fromChatId));
return;
}
if (DialogObject.isChatDialog(fromChatId)) {
this.currentChat = messagesController.getChat(Long.valueOf(-fromChatId));
return;
}
TLRPC$Message tLRPC$Message = this.currentMessageObject.messageOwner;
if (tLRPC$Message.post) {
this.currentChat = messagesController.getChat(Long.valueOf(tLRPC$Message.peer_id.channel_id));
}
}
private void setMessageObjectInternal(MessageObject messageObject) {
String str;
SpannableStringBuilder replaceTags;
String str2;
?? r4;
?? r5;
String forwardedMessageText;
String charSequence;
SpannableStringBuilder spannableStringBuilder;
int i;
CharSequence charSequence2;
String str3;
TLRPC$MessageReplyHeader tLRPC$MessageReplyHeader;
float f;
float f2;
int i2;
boolean z;
TLRPC$PhotoSize tLRPC$PhotoSize;
int i3;
TLRPC$PhotoSize tLRPC$PhotoSize2;
TLObject tLObject;
int i4;
String str4;
CharSequence charSequence3;
float f3;
boolean z2;
char c;
MessageObject messageObject2;
CharSequence charSequence4;
TLRPC$Chat chat;
String str5;
TLRPC$MessageReplyHeader tLRPC$MessageReplyHeader2;
String str6;
boolean z3;
CharSequence replaceEmoji;
ArrayList<TLRPC$MessageEntity> arrayList;
TLRPC$MessageReplyHeader tLRPC$MessageReplyHeader3;
CharSequence charSequence5;
boolean z4;
boolean z5;
MessageObject messageObject3;
TLRPC$Message tLRPC$Message;
TLRPC$MessageMedia tLRPC$MessageMedia;
TLRPC$MessageReplyHeader tLRPC$MessageReplyHeader4;
TLRPC$MessageMedia tLRPC$MessageMedia2;
int i5;
TLRPC$MessageReplyHeader tLRPC$MessageReplyHeader5;
int i6;
CharSequence charSequence6;
int i7;
?? r9;
int i8;
boolean z6;
CharSequence createExpiredStoryString;
MessageTopicButton messageTopicButton;
ChatMessageCellDelegate chatMessageCellDelegate;
MessageObject.GroupedMessagePosition groupedMessagePosition;
int dp;
MessageObject.GroupedMessagePosition groupedMessagePosition2;
ChatMessageCellDelegate chatMessageCellDelegate2;
String adminRank;
int ceil;
String str7;
String str8;
Object obj;
StaticLayout staticLayout;
int themedColor;
SpannableStringBuilder spannableStringBuilder2;
TLRPC$Chat tLRPC$Chat;
TLRPC$Message tLRPC$Message2 = messageObject.messageOwner;
if ((tLRPC$Message2.flags & 1024) != 0 || tLRPC$Message2.replies != null) {
MessageObject messageObject4 = this.currentMessageObject;
if (!messageObject4.scheduled && !messageObject4.isSponsored() && !this.currentMessageObject.viewsReloaded) {
MessagesController.getInstance(this.currentAccount).addToViewsQueue(this.currentMessageObject);
this.currentMessageObject.viewsReloaded = true;
}
}
updateCurrentUserAndChat();
setAvatar(messageObject);
measureTime(messageObject);
this.namesOffset = 0;
TLRPC$Message tLRPC$Message3 = messageObject.messageOwner;
if (tLRPC$Message3.via_bot_id != 0) {
TLRPC$User user = MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(messageObject.messageOwner.via_bot_id));
if (user != null && !TextUtils.isEmpty(user.username)) {
str = "@" + user.username;
replaceTags = AndroidUtilities.replaceTags(String.format(" %s <b>%s</b>", LocaleController.getString("ViaBot", org.telegram.messenger.R.string.ViaBot), str));
this.viaWidth = (int) Math.ceil(Theme.chat_replyNamePaint.measureText(replaceTags, 0, replaceTags.length()));
this.currentViaBotUser = user;
}
str = null;
replaceTags = null;
} else {
if (!TextUtils.isEmpty(tLRPC$Message3.via_bot_name)) {
str = "@" + messageObject.messageOwner.via_bot_name;
replaceTags = AndroidUtilities.replaceTags(String.format(" %s <b>%s</b>", LocaleController.getString("ViaBot", org.telegram.messenger.R.string.ViaBot), str));
this.viaWidth = (int) Math.ceil(Theme.chat_replyNamePaint.measureText(replaceTags, 0, replaceTags.length()));
}
str = null;
replaceTags = null;
}
boolean isNeedAuthorName = isNeedAuthorName();
boolean z7 = (messageObject.messageOwner.fwd_from == null || messageObject.type == 14) && str != null;
if (!this.hasPsaHint && (isNeedAuthorName || z7)) {
this.drawNameLayout = true;
int maxNameWidth = getMaxNameWidth();
this.nameWidth = maxNameWidth;
if (maxNameWidth < 0) {
this.nameWidth = AndroidUtilities.dp(100.0f);
}
if (this.isMegagroup && (tLRPC$Chat = this.currentChat) != null && messageObject.messageOwner.post_author != null && tLRPC$Chat.id == (-this.currentMessageObject.getFromChatId())) {
adminRank = messageObject.messageOwner.post_author.replace("\n", "");
ceil = (int) Math.ceil(Theme.chat_adminPaint.measureText(adminRank));
this.nameWidth -= ceil;
} else if (this.isMegagroup && this.currentChat != null && this.currentMessageObject.isForwardedChannelPost()) {
adminRank = LocaleController.getString("DiscussChannel", org.telegram.messenger.R.string.DiscussChannel);
ceil = (int) Math.ceil(Theme.chat_adminPaint.measureText(adminRank));
this.nameWidth -= ceil;
} else {
if ((this.currentUser != null || this.currentChat != null) && !this.currentMessageObject.isOutOwner() && !this.currentMessageObject.isAnyKindOfSticker() && this.currentMessageObject.type != 5 && (chatMessageCellDelegate2 = this.delegate) != null) {
TLRPC$User tLRPC$User = this.currentUser;
adminRank = chatMessageCellDelegate2.getAdminRank(tLRPC$User != null ? tLRPC$User.id : this.currentChat.id);
if (adminRank != null) {
if (adminRank.length() == 0) {
adminRank = LocaleController.getString("ChatAdmin", org.telegram.messenger.R.string.ChatAdmin);
}
ceil = (int) Math.ceil(Theme.chat_adminPaint.measureText(adminRank));
this.nameWidth -= ceil;
}
}
str7 = null;
ceil = 0;
this.currentNameStatus = null;
str8 = messageObject.customName;
if (str8 == null) {
this.currentNameString = str8;
} else if (isNeedAuthorName) {
this.currentNameString = getAuthorName();
this.currentNameStatus = getAuthorStatus();
} else {
this.currentNameString = "";
}
int dp2 = AndroidUtilities.dp(!this.currentMessageObject.isSponsored() ? -24.0f : 0.0f);
CharSequence replace = this.currentNameString.replace('\n', ' ').replace((char) 8207, ' ');
replace = Emoji.replaceEmoji(replace, Theme.chat_namePaint.getFontMetricsInt(), AndroidUtilities.dp(14.0f), false);
CharSequence ellipsize = TextUtils.ellipsize(replace, Theme.chat_namePaint, (this.nameWidth + dp2) - (!z7 ? this.viaWidth : 0), TextUtils.TruncateAt.END);
if (z7) {
str2 = "";
} else {
int ceil2 = (int) Math.ceil(Theme.chat_namePaint.measureText(ellipsize, 0, ellipsize.length()));
this.viaNameWidth = ceil2;
if (ceil2 != 0) {
this.viaNameWidth = ceil2 + AndroidUtilities.dp(4.0f);
}
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
themedColor = getThemedColor(Theme.key_chat_stickerViaBotNameText);
} else {
themedColor = getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outViaBotNameText : Theme.key_chat_inViaBotNameText);
}
String string = LocaleController.getString("ViaBot", org.telegram.messenger.R.string.ViaBot);
if (this.currentNameString.length() > 0) {
spannableStringBuilder2 = new SpannableStringBuilder(String.format("%s %s %s", ellipsize, string, str));
TypefaceSpan typefaceSpan = new TypefaceSpan(Typeface.DEFAULT, 0, themedColor);
this.viaSpan1 = typefaceSpan;
str2 = "";
spannableStringBuilder2.setSpan(typefaceSpan, ellipsize.length() + 1, ellipsize.length() + 1 + string.length(), 33);
if (this.currentNameStatus != null) {
this.viaNameWidth += AndroidUtilities.dp(28.0f);
spannableStringBuilder2.setSpan(new DialogCell.FixedWidthSpan(AndroidUtilities.dp(28.0f)), ellipsize.length(), ellipsize.length() + 1, 33);
}
TypefaceSpan typefaceSpan2 = new TypefaceSpan(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM), 0, themedColor);
this.viaSpan2 = typefaceSpan2;
spannableStringBuilder2.setSpan(typefaceSpan2, ellipsize.length() + 2 + string.length(), spannableStringBuilder2.length(), 33);
} else {
str2 = "";
this.viaOnly = true;
spannableStringBuilder2 = new SpannableStringBuilder(String.format("%s %s", string, str));
TypefaceSpan typefaceSpan3 = new TypefaceSpan(Typeface.DEFAULT, 0, themedColor);
this.viaSpan1 = typefaceSpan3;
spannableStringBuilder2.setSpan(typefaceSpan3, 0, string.length() + 1, 33);
TypefaceSpan typefaceSpan4 = new TypefaceSpan(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM), 0, themedColor);
this.viaSpan2 = typefaceSpan4;
spannableStringBuilder2.setSpan(typefaceSpan4, string.length() + 1, spannableStringBuilder2.length(), 33);
}
ellipsize = TextUtils.ellipsize(spannableStringBuilder2, Theme.chat_namePaint, this.nameWidth + dp2, TextUtils.TruncateAt.END);
}
staticLayout = new StaticLayout(ellipsize, Theme.chat_namePaint, this.nameWidth + dp2 + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.nameLayout = staticLayout;
if (staticLayout.getLineCount() <= 0) {
int ceil3 = (int) Math.ceil(this.nameLayout.getLineWidth(0));
this.nameLayoutWidth = ceil3;
this.nameWidth = ceil3;
if (!messageObject.isAnyKindOfSticker()) {
this.namesOffset = (int) (this.namesOffset + AndroidUtilities.dp(5.0f) + Theme.chat_namePaint.getTextSize());
}
this.nameOffsetX = this.nameLayout.getLineLeft(0);
} else {
this.nameLayoutWidth = 0;
this.nameWidth = 0;
}
if (this.currentNameStatus != null) {
this.nameWidth += AndroidUtilities.dp(20.0f);
}
this.nameWidth -= dp2;
if (str7 == null) {
StaticLayout staticLayout2 = new StaticLayout(str7, Theme.chat_adminPaint, ceil + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.adminLayout = staticLayout2;
this.nameWidth = (int) (this.nameWidth + staticLayout2.getLineWidth(0) + AndroidUtilities.dp(8.0f));
} else {
this.adminLayout = null;
}
if (this.currentNameStatusDrawable == null) {
AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable swapAnimatedEmojiDrawable = new AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable((View) this, true, AndroidUtilities.dp(20.0f));
this.currentNameStatusDrawable = swapAnimatedEmojiDrawable;
if (this.attachedToWindow) {
swapAnimatedEmojiDrawable.attach();
}
}
obj = this.currentNameStatus;
if (obj != null) {
this.currentNameStatusDrawable.set((Drawable) null, false);
} else if (obj instanceof Long) {
this.currentNameStatusDrawable.set(((Long) obj).longValue(), false);
} else if (obj instanceof Drawable) {
this.currentNameStatusDrawable.set((Drawable) obj, false);
}
r4 = 0;
if (this.currentNameString.length() == 0) {
this.currentNameString = null;
}
r5 = 0;
}
str7 = adminRank;
this.currentNameStatus = null;
str8 = messageObject.customName;
if (str8 == null) {
}
int dp22 = AndroidUtilities.dp(!this.currentMessageObject.isSponsored() ? -24.0f : 0.0f);
CharSequence replace2 = this.currentNameString.replace('\n', ' ').replace((char) 8207, ' ');
replace2 = Emoji.replaceEmoji(replace2, Theme.chat_namePaint.getFontMetricsInt(), AndroidUtilities.dp(14.0f), false);
CharSequence ellipsize2 = TextUtils.ellipsize(replace2, Theme.chat_namePaint, (this.nameWidth + dp22) - (!z7 ? this.viaWidth : 0), TextUtils.TruncateAt.END);
if (z7) {
}
staticLayout = new StaticLayout(ellipsize2, Theme.chat_namePaint, this.nameWidth + dp22 + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.nameLayout = staticLayout;
if (staticLayout.getLineCount() <= 0) {
}
if (this.currentNameStatus != null) {
}
this.nameWidth -= dp22;
if (str7 == null) {
}
if (this.currentNameStatusDrawable == null) {
}
obj = this.currentNameStatus;
if (obj != null) {
}
r4 = 0;
if (this.currentNameString.length() == 0) {
}
r5 = 0;
} else {
str2 = "";
r4 = 0;
this.currentNameString = null;
this.nameLayout = null;
r5 = 0;
this.nameWidth = 0;
}
this.currentForwardUser = r4;
this.currentForwardNameString = r4;
this.currentForwardChannel = r4;
this.currentForwardName = r4;
?? r0 = this.forwardedNameLayout;
r0[r5] = r4;
r0[1] = r4;
this.replyPanelIsForward = r5;
this.forwardedNameWidth = r5;
if (messageObject.isForwarded()) {
TLRPC$Peer tLRPC$Peer = messageObject.messageOwner.fwd_from.from_id;
if (tLRPC$Peer instanceof TLRPC$TL_peerChannel) {
this.currentForwardChannel = MessagesController.getInstance(this.currentAccount).getChat(Long.valueOf(messageObject.messageOwner.fwd_from.from_id.channel_id));
} else if (tLRPC$Peer instanceof TLRPC$TL_peerChat) {
this.currentForwardChannel = MessagesController.getInstance(this.currentAccount).getChat(Long.valueOf(messageObject.messageOwner.fwd_from.from_id.chat_id));
} else if (tLRPC$Peer instanceof TLRPC$TL_peerUser) {
this.currentForwardUser = MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(messageObject.messageOwner.fwd_from.from_id.user_id));
}
}
if (messageObject.type == 23 || (this.drawForwardedName && messageObject.needDrawForwarded() && ((groupedMessagePosition2 = this.currentPosition) == null || groupedMessagePosition2.minY == 0))) {
int i9 = messageObject.type;
if (i9 != 23 && (str3 = messageObject.messageOwner.fwd_from.from_name) != null) {
this.currentForwardName = str3;
}
if (i9 == 23 || this.currentForwardUser != null || this.currentForwardChannel != null || this.currentForwardName != null) {
if (i9 == 23) {
forwardedMessageText = LocaleController.getString("ForwardedStory", org.telegram.messenger.R.string.ForwardedStory);
this.currentForwardNameString = forwardedMessageText;
long peerDialogId = DialogObject.getPeerDialogId(messageObject.messageOwner.media.peer);
if (peerDialogId > 0) {
this.currentForwardUser = MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(peerDialogId));
} else {
this.currentForwardChannel = MessagesController.getInstance(this.currentAccount).getChat(Long.valueOf(-peerDialogId));
}
String nameFromDialogId = getNameFromDialogId(peerDialogId);
if (peerDialogId < 0 && this.currentForwardChannel == null) {
nameFromDialogId = LocaleController.getString("ChannelPrivate", org.telegram.messenger.R.string.ChannelPrivate);
}
charSequence2 = AndroidUtilities.replaceTags(LocaleController.formatString("ForwardedStoryFrom", org.telegram.messenger.R.string.ForwardedStoryFrom, nameFromDialogId));
this.forwardedNameWidth = getMaxNameWidth();
} else {
TLRPC$Chat tLRPC$Chat2 = this.currentForwardChannel;
if (tLRPC$Chat2 != null) {
TLRPC$User tLRPC$User2 = this.currentForwardUser;
if (tLRPC$User2 != null) {
this.currentForwardNameString = String.format("%s (%s)", tLRPC$Chat2.title, UserObject.getUserName(tLRPC$User2));
} else if (TextUtils.isEmpty(messageObject.messageOwner.fwd_from.post_author)) {
this.currentForwardNameString = this.currentForwardChannel.title;
} else {
this.currentForwardNameString = String.format("%s (%s)", this.currentForwardChannel.title, messageObject.messageOwner.fwd_from.post_author);
}
} else {
TLRPC$User tLRPC$User3 = this.currentForwardUser;
if (tLRPC$User3 != null) {
this.currentForwardNameString = UserObject.getUserName(tLRPC$User3);
} else {
this.currentForwardNameString = this.currentForwardName;
}
}
this.forwardedNameWidth = getMaxNameWidth();
forwardedMessageText = getForwardedMessageText(messageObject);
if (this.hasPsaHint) {
this.forwardedNameWidth -= AndroidUtilities.dp(36.0f);
}
String string2 = LocaleController.getString("From", org.telegram.messenger.R.string.From);
String string3 = LocaleController.getString("FromFormatted", org.telegram.messenger.R.string.FromFormatted);
int indexOf = string3.indexOf("%1$s");
TextPaint textPaint = Theme.chat_forwardNamePaint;
int ceil4 = (int) Math.ceil(textPaint.measureText(string2 + " "));
CharSequence ellipsize3 = TextUtils.ellipsize(this.currentForwardNameString.replace('\n', ' '), Theme.chat_replyNamePaint, (float) ((this.forwardedNameWidth - ceil4) - this.viaWidth), TextUtils.TruncateAt.END);
try {
charSequence = String.format(string3, ellipsize3);
} catch (Exception unused) {
charSequence = ellipsize3.toString();
}
if (replaceTags != null) {
SpannableStringBuilder spannableStringBuilder3 = new SpannableStringBuilder(String.format("%s %s %s", charSequence, LocaleController.getString("ViaBot", org.telegram.messenger.R.string.ViaBot), str));
this.viaNameWidth = (int) Math.ceil(Theme.chat_forwardNamePaint.measureText(charSequence));
spannableStringBuilder3.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM)), (spannableStringBuilder3.length() - str.length()) - 1, spannableStringBuilder3.length(), 33);
spannableStringBuilder = spannableStringBuilder3;
i = 0;
} else {
i = 0;
spannableStringBuilder = new SpannableStringBuilder(String.format(string3, ellipsize3));
}
this.forwardNameCenterX = ceil4 + (((int) Math.ceil(Theme.chat_forwardNamePaint.measureText(ellipsize3, i, ellipsize3.length()))) / 2);
if (indexOf >= 0 && (this.currentForwardName == null || messageObject.messageOwner.fwd_from.from_id != null)) {
spannableStringBuilder.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM)), indexOf, ellipsize3.length() + indexOf, 33);
}
charSequence2 = spannableStringBuilder;
}
try {
charSequence2 = Emoji.replaceEmoji(charSequence2, Theme.chat_forwardNamePaint.getFontMetricsInt(), AndroidUtilities.dp(14.0f), false);
} catch (Exception unused2) {
}
try {
this.forwardedNameLayout[1] = new StaticLayout(TextUtils.ellipsize(charSequence2, Theme.chat_forwardNamePaint, this.forwardedNameWidth, TextUtils.TruncateAt.END), Theme.chat_forwardNamePaint, this.forwardedNameWidth + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.forwardedNameLayout[0] = new StaticLayout(TextUtils.ellipsize(AndroidUtilities.replaceTags(forwardedMessageText), Theme.chat_forwardNamePaint, this.forwardedNameWidth, TextUtils.TruncateAt.END), Theme.chat_forwardNamePaint, this.forwardedNameWidth + AndroidUtilities.dp(2.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
int max = Math.max((int) Math.ceil(this.forwardedNameLayout[0].getLineWidth(0)), (int) Math.ceil(this.forwardedNameLayout[1].getLineWidth(0)));
this.forwardedNameWidth = max;
if (this.hasPsaHint) {
this.forwardedNameWidth = max + AndroidUtilities.dp(36.0f);
}
this.forwardNameOffsetX[0] = this.forwardedNameLayout[0].getLineLeft(0);
this.forwardNameOffsetX[1] = this.forwardedNameLayout[1].getLineLeft(0);
if ((messageObject.type != 5 && !messageObject.isAnyKindOfSticker()) || messageObject.type == 19) {
int dp3 = (int) (this.namesOffset + AndroidUtilities.dp(8.0f) + (Theme.chat_forwardNamePaint.getTextSize() * 2.0f));
this.namesOffset = dp3;
if (messageObject.type == 19) {
this.namesOffset = dp3 + AndroidUtilities.dp(8.0f);
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
}
this.drawTopic = false;
if (!this.isThreadChat && (chatMessageCellDelegate = this.delegate) != null && chatMessageCellDelegate.shouldShowTopicButton() && !this.pinnedTop && ((MessageObject.getTopicId(this.currentAccount, messageObject.messageOwner, true) != 0 || messageObject.replyToForumTopic != null) && ((groupedMessagePosition = this.currentPosition) == null || groupedMessagePosition.minY == 0))) {
long topicId = messageObject.replyToForumTopic == null ? MessageObject.getTopicId(this.currentAccount, messageObject.messageOwner, true) : r0.id;
TLRPC$TL_forumTopic tLRPC$TL_forumTopic = messageObject.replyToForumTopic;
if (tLRPC$TL_forumTopic == null) {
tLRPC$TL_forumTopic = MessagesController.getInstance(this.currentAccount).getTopicsController().findTopic(-messageObject.getDialogId(), topicId);
}
if (tLRPC$TL_forumTopic != null) {
this.drawTopic = true;
int maxNameWidth2 = getMaxNameWidth();
if (!messageObject.shouldDrawWithoutBackground()) {
maxNameWidth2 -= AndroidUtilities.dp(10.0f);
} else {
if (messageObject.type == 5) {
dp = AndroidUtilities.dp(48.0f);
} else if (messageObject.isAnyKindOfSticker()) {
dp = AndroidUtilities.dp(25.0f);
}
maxNameWidth2 += dp;
}
if (this.topicButton == null) {
this.topicButton = new MessageTopicButton(getContext(), this.resourcesProvider) {
@Override
protected void onClick() {
if (ChatMessageCell.this.delegate != null) {
ChatMessageCell.this.delegate.didPressTopicButton(ChatMessageCell.this);
}
}
};
}
this.namesOffset += this.topicButton.set(this, messageObject, tLRPC$TL_forumTopic, maxNameWidth2);
}
}
if (!this.drawTopic && (messageTopicButton = this.topicButton) != null) {
messageTopicButton.onDetached(this);
this.topicButton = null;
}
if ((!messageObject.isGiveawayResults() && ((!this.isThreadChat || messageObject.getReplyTopMsgId(this.isForum) != 0 || this.isForumGeneral) && messageObject.hasValidReplyMessageObject())) || ((messageObject.messageOwner.fwd_from != null && messageObject.isDice()) || ((tLRPC$MessageReplyHeader = messageObject.messageOwner.reply_to) != null && (tLRPC$MessageReplyHeader.story_id != 0 || !TextUtils.isEmpty(tLRPC$MessageReplyHeader.quote_text) || messageObject.messageOwner.reply_to.reply_from != null)))) {
MessageObject.GroupedMessagePosition groupedMessagePosition3 = this.currentPosition;
if (groupedMessagePosition3 == null || groupedMessagePosition3.minY == 0) {
if ((messageObject.isAnyKindOfSticker() || messageObject.type == 5) && messageObject.type != 19) {
f = 20.0f;
} else {
f = 20.0f;
int dp4 = (int) (this.namesOffset + AndroidUtilities.dp(20.0f) + Theme.chat_replyTextPaint.getTextSize() + Theme.chat_replyNamePaint.getTextSize());
this.namesOffset = dp4;
int i10 = messageObject.type;
if (i10 == 19 && !this.drawForwardedName) {
this.namesOffset = dp4 + AndroidUtilities.dp(12.0f);
} else if (i10 != 0) {
this.namesOffset = dp4 + AndroidUtilities.dp(5.0f);
}
}
if (!this.drawForwardedName || this.forwardedNameLayout[0] == null) {
f2 = 2.0f;
} else {
f2 = 2.0f;
this.namesOffset += AndroidUtilities.dp(2.0f);
}
int maxNameWidth3 = getMaxNameWidth();
if (!messageObject.shouldDrawWithoutBackground()) {
maxNameWidth3 -= AndroidUtilities.dp(messageObject.isOutOwner() ? f : 10.0f);
if (messageObject.type != 0 || messageObject.needDrawShareButton()) {
maxNameWidth3 -= AndroidUtilities.dp(10.0f);
}
} else if (messageObject.type == 5) {
maxNameWidth3 += AndroidUtilities.dp(13.0f);
}
TLRPC$MessageReplyHeader tLRPC$MessageReplyHeader6 = messageObject.messageOwner.reply_to;
boolean z8 = (tLRPC$MessageReplyHeader6 == null || (tLRPC$MessageReplyHeader6.flags & 64) == 0 || tLRPC$MessageReplyHeader6.quote_text == null) ? false : true;
this.hasReplyQuote = z8;
boolean z9 = z8 && tLRPC$MessageReplyHeader6.quote;
this.isReplyQuote = z9;
boolean z10 = z9 && tLRPC$MessageReplyHeader6.quote;
if (z9 && z10 && this.replyQuoteDrawable == null) {
this.replyQuoteDrawable = getContext().getResources().getDrawable(org.telegram.messenger.R.drawable.mini_quote).mutate();
this.replyQuoteDrawableColor = -1;
}
TextPaint textPaint2 = (this.isReplyQuote && messageObject.shouldDrawWithoutBackground()) ? Theme.chat_quoteTextPaint : Theme.chat_replyTextPaint;
TLRPC$MessageReplyHeader tLRPC$MessageReplyHeader7 = messageObject.messageOwner.reply_to;
if (tLRPC$MessageReplyHeader7 != null && tLRPC$MessageReplyHeader7.story_id != 0) {
charSequence4 = getNameFromDialogId(tLRPC$MessageReplyHeader7.user_id);
TL_stories$StoryItem tL_stories$StoryItem = messageObject.messageOwner.replyStory;
if (tL_stories$StoryItem == null || (tL_stories$StoryItem instanceof TL_stories$TL_storyItemDeleted)) {
if (tL_stories$StoryItem == null) {
createExpiredStoryString = LocaleController.getString("Loading", org.telegram.messenger.R.string.Loading);
} else {
createExpiredStoryString = StoriesUtilities.createExpiredStoryString();
}
this.needReplyImage = false;
} else {
this.needReplyImage = true;
StoriesUtilities.setStoryMiniImage(this.replyImageReceiver, tL_stories$StoryItem);
createExpiredStoryString = StoriesUtilities.createReplyStoryString();
maxNameWidth3 = (int) (maxNameWidth3 - (AndroidUtilities.dp(16.0f) + (textPaint2.getTextSize() + Theme.chat_replyNamePaint.getTextSize())));
}
str4 = str2;
i2 = 2;
z2 = z10;
replaceEmoji = createExpiredStoryString;
f3 = f2;
} else if (((!this.isThreadChat || messageObject.getReplyTopMsgId(this.isForum) != 0 || this.isForumGeneral) && messageObject.hasValidReplyMessageObject()) || this.hasReplyQuote || ((tLRPC$MessageReplyHeader5 = messageObject.messageOwner.reply_to) != null && tLRPC$MessageReplyHeader5.reply_from != null)) {
i2 = 2;
MessageObject messageObject5 = messageObject.replyMessageObject;
this.lastReplyMessage = messageObject5 == null ? null : messageObject5.messageOwner;
if (messageObject5 != null) {
z = messageObject5.hasMediaSpoilers();
tLRPC$PhotoSize = FileLoader.getClosestPhotoSizeWithSize(messageObject.replyMessageObject.photoThumbs2, 320);
TLRPC$PhotoSize closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(messageObject.replyMessageObject.photoThumbs2, 40);
MessageObject messageObject6 = messageObject.replyMessageObject;
TLObject tLObject2 = messageObject6.photoThumbsObject2;
if (tLRPC$PhotoSize == null) {
if (messageObject6.mediaExists) {
tLRPC$PhotoSize = FileLoader.getClosestPhotoSizeWithSize(messageObject6.photoThumbs, AndroidUtilities.getPhotoSize());
i3 = tLRPC$PhotoSize != null ? tLRPC$PhotoSize.size : 0;
i5 = 0;
} else {
tLRPC$PhotoSize = FileLoader.getClosestPhotoSizeWithSize(messageObject6.photoThumbs, 320);
i5 = 1;
i3 = 0;
}
tLRPC$PhotoSize2 = FileLoader.getClosestPhotoSizeWithSize(messageObject.replyMessageObject.photoThumbs, 40);
tLObject = messageObject.replyMessageObject.photoThumbsObject;
} else {
tLObject = tLObject2;
i3 = 0;
tLRPC$PhotoSize2 = closestPhotoSizeWithSize;
i5 = 1;
}
i4 = i5;
if (tLRPC$PhotoSize2 == tLRPC$PhotoSize) {
tLRPC$PhotoSize2 = null;
}
} else {
z = false;
tLRPC$PhotoSize = null;
i3 = 0;
tLRPC$PhotoSize2 = null;
tLObject = null;
i4 = 1;
}
TLRPC$Message tLRPC$Message4 = messageObject.messageOwner;
if (tLRPC$Message4 == null || (tLRPC$MessageReplyHeader4 = tLRPC$Message4.reply_to) == null || (tLRPC$MessageMedia2 = tLRPC$MessageReplyHeader4.reply_media) == null) {
str4 = str2;
charSequence3 = null;
f3 = 2.0f;
z2 = z10;
c = ' ';
if (tLRPC$PhotoSize == null || (messageObject2 = messageObject.replyMessageObject) == null || messageObject2.isAnyKindOfSticker() || ((messageObject.isAnyKindOfSticker() && !AndroidUtilities.isTablet()) || messageObject.replyMessageObject.isSecretMedia() || messageObject.replyMessageObject.isWebpageDocument())) {
this.replyImageReceiver.setImageBitmap((Drawable) null);
this.needReplyImage = false;
} else {
if (messageObject.replyMessageObject.isRoundVideo()) {
this.replyImageReceiver.setRoundRadius(AndroidUtilities.dp(32.0f));
} else {
this.replyImageReceiver.setRoundRadius(AndroidUtilities.dp(4.0f));
}
this.currentReplyPhoto = tLRPC$PhotoSize;
this.replyImageReceiver.setImage(ImageLocation.getForObject(tLRPC$PhotoSize, tLObject), z ? "5_5_b" : "50_50", ImageLocation.getForObject(tLRPC$PhotoSize2, tLObject), z ? "50_50_b4" : "50_50_b", i3, null, messageObject.replyMessageObject, i4);
this.needReplyImage = true;
maxNameWidth3 = (int) (maxNameWidth3 - ((AndroidUtilities.dp(this.isReplyQuote ? 3.0f : 7.0f) + Theme.chat_replyNamePaint.getTextSize()) + Theme.chat_replyTextPaint.getTextSize()));
}
} else {
TLRPC$Document tLRPC$Document = tLRPC$MessageMedia2.document;
if (tLRPC$Document != null) {
tLRPC$PhotoSize = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Document.thumbs, 320);
tLObject = tLRPC$Document;
} else {
TLRPC$Photo tLRPC$Photo = tLRPC$MessageMedia2.photo;
if (tLRPC$Photo != null) {
tLRPC$PhotoSize = FileLoader.getClosestPhotoSizeWithSize(tLRPC$Photo.sizes, 320);
tLObject = tLRPC$Photo;
}
}
if (tLRPC$PhotoSize == null) {
this.replyImageReceiver.setImageBitmap((Drawable) null);
this.needReplyImage = false;
charSequence3 = null;
str4 = str2;
f3 = 2.0f;
z2 = z10;
c = ' ';
} else {
this.currentReplyPhoto = tLRPC$PhotoSize;
str4 = str2;
z2 = z10;
c = ' ';
charSequence3 = null;
this.replyImageReceiver.setImage(ImageLocation.getForObject(tLRPC$PhotoSize, tLObject), z ? "5_5_b" : "50_50", ImageLocation.getForObject(tLRPC$PhotoSize2, tLObject), z ? "50_50_b4" : "50_50_b", i3, null, messageObject, i4);
this.needReplyImage = true;
maxNameWidth3 = (int) (maxNameWidth3 - ((AndroidUtilities.dp(this.isReplyQuote ? 3.0f : 7.0f) + Theme.chat_replyNamePaint.getTextSize()) + Theme.chat_replyTextPaint.getTextSize()));
f3 = 2.0f;
}
}
if (DialogObject.isEncryptedDialog(messageObject.getDialogId())) {
MessageObject messageObject7 = messageObject.replyMessageObject;
if (messageObject7 != null && messageObject7.isOutOwner()) {
charSequence4 = UserObject.getUserName(UserConfig.getInstance(this.currentAccount).getCurrentUser());
} else {
TLRPC$EncryptedChat encryptedChat = MessagesController.getInstance(this.currentAccount).getEncryptedChat(Integer.valueOf(DialogObject.getEncryptedChatId(this.currentMessageObject.getDialogId())));
if (encryptedChat != null) {
charSequence4 = UserObject.getUserName(MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(encryptedChat.user_id)));
}
charSequence4 = charSequence3;
}
if (charSequence4 == null) {
charSequence4 = LocaleController.getString("Loading", org.telegram.messenger.R.string.Loading);
}
if (!this.hasReplyQuote || ((tLRPC$MessageReplyHeader3 = messageObject.messageOwner.reply_to) != null && tLRPC$MessageReplyHeader3.quote_text != null && tLRPC$MessageReplyHeader3.reply_from != null)) {
str6 = messageObject.messageOwner.reply_to.quote_text;
if (str6.length() <= 150) {
z3 = false;
str6 = str6.substring(0, ImageReceiver.DEFAULT_CROSSFADE_DURATION);
} else {
z3 = false;
}
replaceEmoji = Emoji.replaceEmoji(new SpannableStringBuilder(str6.replace('\n', c)), textPaint2.getFontMetricsInt(), AndroidUtilities.dp(14.0f), z3);
arrayList = messageObject.messageOwner.reply_to.quote_entities;
if (arrayList != null) {
replaceEmoji = MessageObject.replaceAnimatedEmoji(replaceEmoji, arrayList, textPaint2.getFontMetricsInt(), true);
MessageObject.addEntitiesToText(replaceEmoji, messageObject.messageOwner.reply_to.quote_entities, this.currentMessageObject.isOutOwner(), false, false, false);
}
} else if (tLRPC$MessageReplyHeader3 != null && tLRPC$MessageReplyHeader3.reply_from != null && (tLRPC$MessageMedia = tLRPC$MessageReplyHeader3.reply_media) != null) {
replaceEmoji = messageObject.getMediaTitle(tLRPC$MessageMedia);
} else {
MessageObject messageObject8 = messageObject.replyMessageObject;
if (messageObject8 == null || (r9 = messageObject8.messageTextForReply) == null) {
if (MessageObject.getMedia(messageObject8) instanceof TLRPC$TL_messageMediaGame) {
replaceEmoji = TextUtils.ellipsize(Emoji.replaceEmoji((CharSequence) MessageObject.getMedia(messageObject.replyMessageObject).game.title, textPaint2.getFontMetricsInt(), AndroidUtilities.dp(14.0f), false), textPaint2, maxNameWidth3, TextUtils.TruncateAt.END);
} else if (MessageObject.getMedia(messageObject.replyMessageObject) instanceof TLRPC$TL_messageMediaInvoice) {
replaceEmoji = TextUtils.ellipsize(Emoji.replaceEmoji((CharSequence) MessageObject.getMedia(messageObject.replyMessageObject).title, textPaint2.getFontMetricsInt(), AndroidUtilities.dp(14.0f), false), textPaint2, maxNameWidth3, TextUtils.TruncateAt.END);
} else {
MessageObject messageObject9 = messageObject.replyMessageObject;
if (messageObject9 != null && !TextUtils.isEmpty(messageObject9.caption)) {
String charSequence7 = messageObject.replyMessageObject.caption.toString();
if (charSequence7.length() > 150) {
z5 = false;
charSequence7 = charSequence7.substring(0, ImageReceiver.DEFAULT_CROSSFADE_DURATION);
} else {
z5 = false;
}
CharSequence replaceEmoji2 = Emoji.replaceEmoji(charSequence7.replace('\n', c), textPaint2.getFontMetricsInt(), AndroidUtilities.dp(14.0f), z5);
TLRPC$Message tLRPC$Message5 = messageObject.replyMessageObject.messageOwner;
if (tLRPC$Message5 != null) {
replaceEmoji2 = MessageObject.replaceAnimatedEmoji(replaceEmoji2, tLRPC$Message5.entities, textPaint2.getFontMetricsInt(), true);
}
float f4 = maxNameWidth3;
replaceEmoji = TextUtils.ellipsize(replaceEmoji2, textPaint2, f4, TextUtils.TruncateAt.END);
if ((replaceEmoji instanceof Spannable) && (tLRPC$Message = (messageObject3 = messageObject.replyMessageObject).messageOwner) != null) {
MediaDataController.addTextStyleRuns(tLRPC$Message.entities, messageObject3.caption, (Spannable) replaceEmoji);
replaceEmoji = TextUtils.ellipsize(replaceEmoji, textPaint2, f4, TextUtils.TruncateAt.END);
}
} else {
MessageObject messageObject10 = messageObject.replyMessageObject;
if (messageObject10 == null || (charSequence5 = messageObject10.messageText) == null || charSequence5.length() <= 0) {
replaceEmoji = charSequence3;
} else {
String charSequence8 = messageObject.replyMessageObject.messageText.toString();
if (charSequence8.length() > 150) {
z4 = false;
charSequence8 = charSequence8.substring(0, ImageReceiver.DEFAULT_CROSSFADE_DURATION);
} else {
z4 = false;
}
CharSequence replaceEmoji3 = Emoji.replaceEmoji(charSequence8.replace('\n', c), textPaint2.getFontMetricsInt(), AndroidUtilities.dp(14.0f), z4);
TLRPC$Message tLRPC$Message6 = messageObject.replyMessageObject.messageOwner;
if (tLRPC$Message6 != null) {
replaceEmoji3 = MessageObject.replaceAnimatedEmoji(replaceEmoji3, tLRPC$Message6.entities, textPaint2.getFontMetricsInt(), true);
}
float f5 = maxNameWidth3;
replaceEmoji = TextUtils.ellipsize(replaceEmoji3, textPaint2, f5, TextUtils.TruncateAt.END);
if (replaceEmoji instanceof Spannable) {
MediaDataController.addTextStyleRuns(messageObject.replyMessageObject, (Spannable) replaceEmoji);
replaceEmoji = TextUtils.ellipsize(replaceEmoji, textPaint2, f5, TextUtils.TruncateAt.END);
}
}
}
}
}
replaceEmoji = r9;
}
} else {
if (this.hasReplyQuote && !DialogObject.isEncryptedDialog(messageObject.getDialogId())) {
charSequence4 = messageObject.getReplyQuoteNameWithIcon();
} else if (messageObject.hideSendersName) {
TLRPC$Peer tLRPC$Peer2 = messageObject.sendAsPeer;
if (tLRPC$Peer2 == null) {
charSequence4 = UserObject.getUserName(AccountInstance.getInstance(this.currentAccount).getUserConfig().getCurrentUser());
} else if (tLRPC$Peer2.channel_id != 0) {
TLRPC$Chat chat2 = MessagesController.getInstance(this.currentAccount).getChat(Long.valueOf(messageObject.sendAsPeer.channel_id));
if (chat2 != null) {
charSequence4 = chat2.title;
}
charSequence4 = charSequence3;
} else {
charSequence4 = UserObject.getUserName(MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(messageObject.sendAsPeer.user_id)));
}
} else {
charSequence4 = messageObject.customReplyName;
if (charSequence4 == null) {
MessageObject messageObject11 = messageObject.replyMessageObject;
if (messageObject11 != null || (tLRPC$MessageReplyHeader2 = messageObject.messageOwner.reply_to) == null || tLRPC$MessageReplyHeader2.reply_from == null) {
if (messageObject11 != null) {
charSequence4 = this.drawForwardedName ? messageObject11.getForwardedName() : charSequence3;
if (charSequence4 == null) {
long fromChatId = messageObject.replyMessageObject.getFromChatId();
if (fromChatId > 0) {
TLRPC$User user2 = MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(fromChatId));
if (user2 != null) {
str5 = UserObject.getUserName(user2);
charSequence4 = str5;
}
} else if (fromChatId < 0) {
TLRPC$Chat chat3 = MessagesController.getInstance(this.currentAccount).getChat(Long.valueOf(-fromChatId));
if (chat3 != null) {
str5 = chat3.title;
charSequence4 = str5;
}
} else {
TLRPC$Message tLRPC$Message7 = messageObject.replyMessageObject.messageOwner;
if (tLRPC$Message7 != null && tLRPC$Message7.peer_id != null && (chat = MessagesController.getInstance(this.currentAccount).getChat(Long.valueOf(messageObject.replyMessageObject.messageOwner.peer_id.channel_id))) != null) {
charSequence4 = chat.title;
}
}
}
}
charSequence4 = charSequence3;
} else {
charSequence4 = messageObject.getReplyQuoteNameWithIcon();
}
}
}
if (charSequence4 == null) {
}
if (!this.hasReplyQuote) {
}
str6 = messageObject.messageOwner.reply_to.quote_text;
if (str6.length() <= 150) {
}
replaceEmoji = Emoji.replaceEmoji(new SpannableStringBuilder(str6.replace('\n', c)), textPaint2.getFontMetricsInt(), AndroidUtilities.dp(14.0f), z3);
arrayList = messageObject.messageOwner.reply_to.quote_entities;
if (arrayList != null) {
}
}
} else {
this.replyImageReceiver.setImageBitmap((Drawable) null);
this.needReplyImage = false;
this.replyPanelIsForward = true;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader = messageObject.messageOwner.fwd_from;
if (tLRPC$MessageFwdHeader != null) {
TLRPC$Peer tLRPC$Peer3 = tLRPC$MessageFwdHeader.from_id;
if (tLRPC$Peer3 instanceof TLRPC$TL_peerChannel) {
this.currentForwardChannel = MessagesController.getInstance(this.currentAccount).getChat(Long.valueOf(messageObject.messageOwner.fwd_from.from_id.channel_id));
} else if (tLRPC$Peer3 instanceof TLRPC$TL_peerChat) {
this.currentForwardChannel = MessagesController.getInstance(this.currentAccount).getChat(Long.valueOf(messageObject.messageOwner.fwd_from.from_id.chat_id));
} else if (tLRPC$Peer3 instanceof TLRPC$TL_peerUser) {
this.currentForwardUser = MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(messageObject.messageOwner.fwd_from.from_id.user_id));
}
String str9 = messageObject.messageOwner.fwd_from.from_name;
if (str9 != null) {
this.currentForwardName = str9;
}
}
TLRPC$User tLRPC$User4 = this.currentForwardUser;
if (tLRPC$User4 == null && this.currentForwardChannel == null && this.currentForwardName == null) {
f3 = f2;
str4 = str2;
charSequence4 = null;
i2 = 2;
z2 = z10;
replaceEmoji = null;
} else {
TLRPC$Chat tLRPC$Chat3 = this.currentForwardChannel;
if (tLRPC$Chat3 != null) {
if (tLRPC$User4 != null) {
this.currentForwardNameString = String.format("%s (%s)", tLRPC$Chat3.title, UserObject.getUserName(tLRPC$User4));
} else {
this.currentForwardNameString = tLRPC$Chat3.title;
}
} else if (tLRPC$User4 != null) {
this.currentForwardNameString = UserObject.getUserName(tLRPC$User4);
} else {
this.currentForwardNameString = this.currentForwardName;
}
charSequence4 = getForwardedMessageText(messageObject);
String string4 = LocaleController.getString("From", org.telegram.messenger.R.string.From);
String string5 = LocaleController.getString("FromFormatted", org.telegram.messenger.R.string.FromFormatted);
int indexOf2 = string5.indexOf("%1$s");
TextPaint textPaint3 = Theme.chat_replyNamePaint;
int ceil5 = (int) Math.ceil(textPaint3.measureText(string4 + " "));
String str10 = this.currentForwardNameString;
CharSequence ellipsize4 = TextUtils.ellipsize(str10 == null ? str2 : str10.replace('\n', ' '), Theme.chat_replyNamePaint, maxNameWidth3 - ceil5, TextUtils.TruncateAt.END);
SpannableStringBuilder spannableStringBuilder4 = new SpannableStringBuilder(String.format(string5, ellipsize4));
if (indexOf2 >= 0 && (this.currentForwardName == null || messageObject.messageOwner.fwd_from.from_id != null)) {
spannableStringBuilder4.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM)), indexOf2, ellipsize4.length() + indexOf2, 33);
}
CharSequence charSequence9 = TextUtils.ellipsize(spannableStringBuilder4, textPaint2, maxNameWidth3, TextUtils.TruncateAt.END);
i2 = 2;
this.forwardNameCenterX = ceil5 + (((int) Math.ceil(Theme.chat_replyNamePaint.measureText(ellipsize4, 0, ellipsize4.length()))) / 2);
str4 = str2;
f3 = 2.0f;
z2 = z10;
replaceEmoji = charSequence9;
}
}
try {
charSequence4 = Emoji.replaceEmoji(charSequence4, Theme.chat_replyNamePaint.getFontMetricsInt(), AndroidUtilities.dp(14.0f), false);
} catch (Exception unused3) {
}
if (this.isReplyQuote) {
maxNameWidth3 -= AndroidUtilities.dp(24.0f);
}
int i11 = maxNameWidth3;
String ellipsize5 = charSequence4 == null ? str4 : TextUtils.ellipsize(AndroidUtilities.replaceCharSequence("\n", charSequence4, " "), Theme.chat_replyNamePaint, i11, TextUtils.TruncateAt.END);
try {
this.replyNameWidth = AndroidUtilities.dp(4.0f) + (this.needReplyImage ? AndroidUtilities.dp(16.0f) + ((int) (textPaint2.getTextSize() + Theme.chat_replyNamePaint.getTextSize())) : 0);
if (ellipsize5 != null) {
StaticLayout staticLayout3 = new StaticLayout(ellipsize5, Theme.chat_replyNamePaint, i11 + AndroidUtilities.dp(6.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.replyNameLayout = staticLayout3;
if (staticLayout3.getLineCount() > 0) {
this.replyNameWidth += ((int) Math.ceil(this.replyNameLayout.getLineWidth(0))) + AndroidUtilities.dp(4.0f);
this.replyNameOffset = (int) this.replyNameLayout.getLineLeft(0);
}
}
if (this.isReplyQuote && z2 && this.replyQuoteDrawable != null) {
int i12 = this.replyNameWidth;
if (this.drawPinnedTop) {
i2 = 0;
}
this.replyNameWidth = i12 + AndroidUtilities.dp(6 + i2) + this.replyQuoteDrawable.getIntrinsicWidth();
} else {
this.replyNameWidth += AndroidUtilities.dp(3.0f);
}
} catch (Exception e2) {
FileLog.e(e2);
}
try {
this.replyTextWidth = AndroidUtilities.dp(4.0f) + (this.needReplyImage ? AndroidUtilities.dp(33.0f) : 0);
if (replaceEmoji != null) {
SpannableStringBuilder spannableStringBuilder5 = new SpannableStringBuilder(replaceEmoji);
boolean z11 = false;
for (TextStyleSpan textStyleSpan : (TextStyleSpan[]) spannableStringBuilder5.getSpans(0, spannableStringBuilder5.length(), TextStyleSpan.class)) {
if ((textStyleSpan.getTextStyleRun().flags & 4) != 0) {
spannableStringBuilder5.removeSpan(textStyleSpan);
z11 = true;
}
}
this.replyTextRTL = AndroidUtilities.isRTL(spannableStringBuilder5);
if (this.isReplyQuote) {
i11 += AndroidUtilities.dp(36.0f);
}
boolean z12 = this.isReplyQuote;
if (z12 && this.needReplyImage && !this.replyTextRTL) {
float dp5 = AndroidUtilities.dp(z12 ? 3.0f : 7.0f) + Theme.chat_replyNamePaint.getTextSize() + Theme.chat_replyTextPaint.getTextSize();
spannableStringBuilder5.setSpan(new LeadingMarginSpan.Standard(((int) dp5) + AndroidUtilities.dp(4.0f), 0), 0, spannableStringBuilder5.length(), 33);
this.replyTextWidth = (int) (this.replyTextWidth - dp5);
i6 = (int) (i11 + dp5);
} else {
i6 = i11;
}
if (!z11) {
charSequence6 = spannableStringBuilder5;
if (!this.isReplyQuote) {
if (!this.currentMessageObject.shouldDrawWithoutBackground()) {
charSequence6 = spannableStringBuilder5;
}
}
this.replyTextOffset = 0;
if (Build.VERSION.SDK_INT < 23) {
StaticLayout.Builder includePad = StaticLayout.Builder.obtain(charSequence6, 0, charSequence6.length(), textPaint2, i6).setAlignment(Layout.Alignment.ALIGN_NORMAL).setIncludePad(false);
includePad.setBreakStrategy(0);
if (this.isReplyQuote && !this.currentMessageObject.replyTextRevealed) {
includePad.setMaxLines(5).setEllipsize(TextUtils.TruncateAt.END);
}
StaticLayout build = includePad.build();
this.replyTextLayout = build;
MessageObject messageObject12 = this.currentMessageObject;
if (messageObject12.replyTextRevealed) {
i7 = 1;
} else {
if (build.getLineCount() > 0) {
StaticLayout staticLayout4 = this.replyTextLayout;
i7 = 1;
if (staticLayout4.getEllipsisCount(staticLayout4.getLineCount() - 1) > 0) {
z6 = true;
messageObject12.replyTextEllipsized = z6;
}
} else {
i7 = 1;
}
z6 = false;
messageObject12.replyTextEllipsized = z6;
}
} else {
i7 = 1;
this.replyTextLayout = new StaticLayout(charSequence6, 0, charSequence6.length(), textPaint2, i6, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false, TextUtils.TruncateAt.END, i6);
}
this.replyTextHeight = this.replyTextLayout.getHeight();
if ((!messageObject.isAnyKindOfSticker() && messageObject.type != 5) || messageObject.type == 19) {
this.namesOffset = (int) (this.namesOffset + Math.max(0.0f, (this.replyTextHeight - AndroidUtilities.dp(3.66f)) - Theme.chat_replyTextPaint.getTextSize()));
}
if (this.replyTextLayout.getLineCount() > 0) {
this.replyTextOffset = this.replyTextLayout.getWidth();
int i13 = 0;
for (int i14 = 0; i14 < this.replyTextLayout.getLineCount(); i14++) {
i13 = Math.max(i13, (int) Math.ceil(this.replyTextLayout.getLineWidth(i14)));
int ceil6 = (int) Math.ceil(this.replyTextLayout.getLineLeft(i14));
if (i14 > 0) {
if ((this.replyTextOffset == 0 ? i7 : 0) != (ceil6 == 0 ? i7 : 0)) {
i13 = this.replyTextLayout.getWidth();
}
}
this.replyTextOffset = Math.min(this.replyTextOffset, ceil6);
}
this.replyTextWidth += i13 + AndroidUtilities.dp(18.0f);
}
this.replySpoilers.clear();
if (!this.hasReplyQuote && (getMessageObject().replyMessageObject == null || getMessageObject().replyMessageObject.isSpoilersRevealed)) {
i8 = i7;
r9 = 0;
AnimatedEmojiSpan.EmojiGroupedSpans emojiGroupedSpans = this.animatedEmojiReplyStack;
Layout[] layoutArr = new Layout[i8];
layoutArr[r9] = this.replyTextLayout;
this.animatedEmojiReplyStack = AnimatedEmojiSpan.update((int) r9, this, (boolean) r9, emojiGroupedSpans, layoutArr);
}
StaticLayout staticLayout5 = this.replyTextLayout;
int i15 = this.replyTextOffset;
r9 = 0;
i8 = i7;
SpoilerEffect.addSpoilers(this, staticLayout5, i15, i15 + this.replyTextWidth, this.replySpoilersPool, this.replySpoilers);
AnimatedEmojiSpan.EmojiGroupedSpans emojiGroupedSpans2 = this.animatedEmojiReplyStack;
Layout[] layoutArr2 = new Layout[i8];
layoutArr2[r9] = this.replyTextLayout;
this.animatedEmojiReplyStack = AnimatedEmojiSpan.update((int) r9, this, (boolean) r9, emojiGroupedSpans2, layoutArr2);
}
charSequence6 = TextUtils.ellipsize(spannableStringBuilder5, textPaint2, i6, TextUtils.TruncateAt.END);
this.replyTextOffset = 0;
if (Build.VERSION.SDK_INT < 23) {
}
this.replyTextHeight = this.replyTextLayout.getHeight();
if (!messageObject.isAnyKindOfSticker()) {
this.namesOffset = (int) (this.namesOffset + Math.max(0.0f, (this.replyTextHeight - AndroidUtilities.dp(3.66f)) - Theme.chat_replyTextPaint.getTextSize()));
if (this.replyTextLayout.getLineCount() > 0) {
}
this.replySpoilers.clear();
if (!this.hasReplyQuote) {
i8 = i7;
r9 = 0;
AnimatedEmojiSpan.EmojiGroupedSpans emojiGroupedSpans22 = this.animatedEmojiReplyStack;
Layout[] layoutArr22 = new Layout[i8];
layoutArr22[r9] = this.replyTextLayout;
this.animatedEmojiReplyStack = AnimatedEmojiSpan.update((int) r9, this, (boolean) r9, emojiGroupedSpans22, layoutArr22);
}
StaticLayout staticLayout52 = this.replyTextLayout;
int i152 = this.replyTextOffset;
r9 = 0;
i8 = i7;
SpoilerEffect.addSpoilers(this, staticLayout52, i152, i152 + this.replyTextWidth, this.replySpoilersPool, this.replySpoilers);
AnimatedEmojiSpan.EmojiGroupedSpans emojiGroupedSpans222 = this.animatedEmojiReplyStack;
Layout[] layoutArr222 = new Layout[i8];
layoutArr222[r9] = this.replyTextLayout;
this.animatedEmojiReplyStack = AnimatedEmojiSpan.update((int) r9, this, (boolean) r9, emojiGroupedSpans222, layoutArr222);
}
this.namesOffset = (int) (this.namesOffset + Math.max(0.0f, (this.replyTextHeight - AndroidUtilities.dp(3.66f)) - Theme.chat_replyTextPaint.getTextSize()));
if (this.replyTextLayout.getLineCount() > 0) {
}
this.replySpoilers.clear();
if (!this.hasReplyQuote) {
}
StaticLayout staticLayout522 = this.replyTextLayout;
int i1522 = this.replyTextOffset;
r9 = 0;
i8 = i7;
SpoilerEffect.addSpoilers(this, staticLayout522, i1522, i1522 + this.replyTextWidth, this.replySpoilersPool, this.replySpoilers);
AnimatedEmojiSpan.EmojiGroupedSpans emojiGroupedSpans2222 = this.animatedEmojiReplyStack;
Layout[] layoutArr2222 = new Layout[i8];
layoutArr2222[r9] = this.replyTextLayout;
this.animatedEmojiReplyStack = AnimatedEmojiSpan.update((int) r9, this, (boolean) r9, emojiGroupedSpans2222, layoutArr2222);
}
int i16 = this.replyNameWidth;
if (i16 > this.replyTextWidth) {
this.replyNameWidth = i16 + AndroidUtilities.dp(Math.max(f3, SharedConfig.bubbleRadius / 4.0f));
}
} catch (Exception e3) {
FileLog.e(e3);
}
}
} else if (!this.isThreadChat && messageObject.getReplyMsgId() != 0 && !messageObject.isGiveawayResults()) {
MessageObject messageObject13 = messageObject.replyMessageObject;
if (messageObject13 != null) {
TLRPC$Message tLRPC$Message8 = messageObject13.messageOwner;
if (!(tLRPC$Message8 instanceof TLRPC$TL_messageEmpty)) {
if (tLRPC$Message8 != null) {
}
}
}
if (messageObject.getDialogId() != UserObject.REPLY_BOT) {
if (!messageObject.isAnyKindOfSticker() && messageObject.type != 5) {
int dp6 = (int) (this.namesOffset + AndroidUtilities.dp(18.0f) + Theme.chat_replyTextPaint.getTextSize() + Theme.chat_replyNamePaint.getTextSize());
this.namesOffset = dp6;
if (messageObject.type != 0) {
this.namesOffset = dp6 + AndroidUtilities.dp(5.0f);
}
}
this.needReplyImage = false;
int maxNameWidth4 = getMaxNameWidth();
if (!messageObject.shouldDrawWithoutBackground()) {
maxNameWidth4 -= AndroidUtilities.dp(10.0f);
} else if (messageObject.type == 5) {
maxNameWidth4 += AndroidUtilities.dp(13.0f);
}
StaticLayout staticLayout6 = new StaticLayout(LocaleController.getString("Loading", org.telegram.messenger.R.string.Loading), Theme.chat_replyNamePaint, maxNameWidth4 + AndroidUtilities.dp(6.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.replyNameLayout = staticLayout6;
if (staticLayout6.getLineCount() > 0) {
this.replyNameWidth += ((int) Math.ceil(this.replyNameLayout.getLineWidth(0))) + AndroidUtilities.dp(8.0f);
this.replyNameOffset = (int) this.replyNameLayout.getLineLeft(0);
}
}
}
requestLayout();
}
private String getNameFromDialogId(long j) {
TLRPC$Chat chat;
if (j > 0) {
TLRPC$User user = MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(j));
if (user != null) {
return UserObject.getUserName(user);
}
return null;
}
if (j >= 0 || (chat = MessagesController.getInstance(this.currentAccount).getChat(Long.valueOf(-j))) == null) {
return null;
}
return chat.title;
}
protected boolean isNeedAuthorName() {
MessageObject messageObject = this.currentMessageObject;
if (messageObject.forceAvatar) {
return true;
}
if (messageObject.isSponsored() || this.currentMessageObject.isGiveawayOrGiveawayResults()) {
return false;
}
if (this.isPinnedChat && this.currentMessageObject.type == 0) {
return true;
}
if (!this.pinnedTop && this.drawName && this.isChat) {
if (!this.currentMessageObject.isOutOwner()) {
return true;
}
if ((this.currentMessageObject.isSupergroup() && this.currentMessageObject.isFromGroup()) || this.currentMessageObject.isRepostPreview) {
return true;
}
}
return this.currentMessageObject.isImportedForward() && this.currentMessageObject.messageOwner.fwd_from.from_id == null;
}
private String getAuthorName() {
TLRPC$Chat tLRPC$Chat;
String str;
String str2;
TLRPC$User tLRPC$User = this.currentUser;
if (tLRPC$User != null) {
return UserObject.getUserName(tLRPC$User);
}
TLRPC$Chat tLRPC$Chat2 = this.currentChat;
if (tLRPC$Chat2 != null) {
return tLRPC$Chat2.title;
}
MessageObject messageObject = this.currentMessageObject;
if (messageObject == null || !messageObject.isSponsored()) {
return "DELETED";
}
MessageObject messageObject2 = this.currentMessageObject;
TLRPC$BotApp tLRPC$BotApp = messageObject2.sponsoredBotApp;
if (tLRPC$BotApp != null) {
return tLRPC$BotApp.title;
}
TLRPC$TL_sponsoredWebPage tLRPC$TL_sponsoredWebPage = messageObject2.sponsoredWebPage;
if (tLRPC$TL_sponsoredWebPage != null) {
return tLRPC$TL_sponsoredWebPage.site_name;
}
TLRPC$ChatInvite tLRPC$ChatInvite = messageObject2.sponsoredChatInvite;
return (tLRPC$ChatInvite == null || (str2 = tLRPC$ChatInvite.title) == null) ? (tLRPC$ChatInvite == null || (tLRPC$Chat = tLRPC$ChatInvite.chat) == null || (str = tLRPC$Chat.title) == null) ? "" : str : str2;
}
private Object getAuthorStatus() {
TLRPC$User tLRPC$User = this.currentUser;
if (tLRPC$User == null) {
return null;
}
Long emojiStatusDocumentId = UserObject.getEmojiStatusDocumentId(tLRPC$User);
if (emojiStatusDocumentId != null) {
return emojiStatusDocumentId;
}
if (this.currentUser.premium) {
return ContextCompat.getDrawable(ApplicationLoader.applicationContext, org.telegram.messenger.R.drawable.msg_premium_liststar).mutate();
}
return null;
}
private String getForwardedMessageText(MessageObject messageObject) {
if (this.hasPsaHint) {
String string = LocaleController.getString("PsaMessage_" + messageObject.messageOwner.fwd_from.psa_type);
return string == null ? LocaleController.getString("PsaMessageDefault", org.telegram.messenger.R.string.PsaMessageDefault) : string;
}
return LocaleController.getString("ForwardedMessage", org.telegram.messenger.R.string.ForwardedMessage);
}
public int getExtraInsetHeight() {
int i = this.addedCaptionHeight;
if (this.drawCommentButton) {
i += AndroidUtilities.dp(shouldDrawTimeOnMedia() ? 41.3f : 43.0f);
}
return (this.reactionsLayoutInBubble.isEmpty || !this.currentMessageObject.shouldDrawReactionsInLayout()) ? i : i + this.reactionsLayoutInBubble.totalHeight;
}
public ImageReceiver getAvatarImage() {
if (this.isAvatarVisible) {
return this.avatarImage;
}
return null;
}
public float getCheckBoxTranslation() {
return this.checkBoxTranslation;
}
public boolean shouldDrawAlphaLayer() {
MessageObject.GroupedMessages groupedMessages = this.currentMessagesGroup;
return (groupedMessages == null || !groupedMessages.transitionParams.backgroundChangeBounds) && getAlpha() != 1.0f;
}
public float getCaptionX() {
return this.captionX;
}
public boolean isDrawPinnedBottom() {
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
return this.mediaBackground || this.drawPinnedBottom || (groupedMessagePosition != null && (groupedMessagePosition.flags & 8) == 0 && this.currentMessagesGroup.isDocuments);
}
public void drawCheckBox(Canvas canvas) {
float f;
MessageObject messageObject = this.currentMessageObject;
if (messageObject == null || messageObject.isSending()) {
return;
}
MessageObject messageObject2 = this.currentMessageObject;
if (messageObject2.type == 27 || messageObject2.isSendError() || this.checkBox == null) {
return;
}
if (this.checkBoxVisible || this.checkBoxAnimationInProgress) {
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
if (groupedMessagePosition != null) {
int i = groupedMessagePosition.flags;
if ((i & 8) == 0 || (i & 1) == 0) {
return;
}
}
canvas.save();
float y = getY();
MessageObject.GroupedMessages groupedMessages = this.currentMessagesGroup;
if (groupedMessages != null && groupedMessages.messages.size() > 1) {
f = (getTop() + this.currentMessagesGroup.transitionParams.offsetTop) - getTranslationY();
} else {
f = y + this.transitionParams.deltaTop;
}
canvas.translate(0.0f, f + this.transitionYOffsetForDrawables);
this.checkBox.draw(canvas);
canvas.restore();
}
}
public void setBackgroundTopY(boolean z) {
int i;
int i2;
int i3 = 0;
while (i3 < 2) {
if (i3 == 1 && !z) {
return;
}
Theme.MessageDrawable messageDrawable = i3 == 0 ? this.currentBackgroundDrawable : this.currentBackgroundSelectedDrawable;
if (messageDrawable != null) {
int i4 = this.parentWidth;
int i5 = this.parentHeight;
if (i5 == 0) {
i4 = getParentWidth();
i5 = AndroidUtilities.displaySize.y;
if (getParent() instanceof View) {
View view = (View) getParent();
int measuredWidth = view.getMeasuredWidth();
i2 = view.getMeasuredHeight();
i = measuredWidth;
float y = !z ? getY() : getTop();
float f = this.parentViewTopOffset;
messageDrawable.setTop((int) (y + f), i, i2, (int) f, this.blurredViewTopOffset, this.blurredViewBottomOffset, this.pinnedTop, (this.pinnedBottom && this.transitionParams.changePinnedBottomProgress == 1.0f) ? false : true);
MessageObject messageObject = this.currentMessageObject;
messageDrawable.setBotButtonsBottom(messageObject == null && messageObject.hasInlineBotButtons());
}
}
i = i4;
i2 = i5;
if (!z) {
}
float f2 = this.parentViewTopOffset;
messageDrawable.setTop((int) (y + f2), i, i2, (int) f2, this.blurredViewTopOffset, this.blurredViewBottomOffset, this.pinnedTop, (this.pinnedBottom && this.transitionParams.changePinnedBottomProgress == 1.0f) ? false : true);
MessageObject messageObject2 = this.currentMessageObject;
messageDrawable.setBotButtonsBottom(messageObject2 == null && messageObject2.hasInlineBotButtons());
}
i3++;
}
}
public void setBackgroundTopY(int i) {
int i2;
int i3;
boolean z;
MessageObject messageObject;
Theme.MessageDrawable messageDrawable = this.currentBackgroundDrawable;
int i4 = this.parentWidth;
int i5 = this.parentHeight;
if (i5 == 0) {
i4 = getParentWidth();
i5 = AndroidUtilities.displaySize.y;
if (getParent() instanceof View) {
View view = (View) getParent();
int measuredWidth = view.getMeasuredWidth();
i3 = view.getMeasuredHeight();
i2 = measuredWidth;
float f = this.parentViewTopOffset;
z = false;
messageDrawable.setTop((int) (i + f), i2, i3, (int) f, this.blurredViewTopOffset, this.blurredViewBottomOffset, this.pinnedTop, (this.pinnedBottom && this.transitionParams.changePinnedBottomProgress == 1.0f) ? false : true);
messageObject = this.currentMessageObject;
if (messageObject != null && messageObject.hasInlineBotButtons()) {
z = true;
}
messageDrawable.setBotButtonsBottom(z);
}
}
i2 = i4;
i3 = i5;
float f2 = this.parentViewTopOffset;
z = false;
messageDrawable.setTop((int) (i + f2), i2, i3, (int) f2, this.blurredViewTopOffset, this.blurredViewBottomOffset, this.pinnedTop, (this.pinnedBottom && this.transitionParams.changePinnedBottomProgress == 1.0f) ? false : true);
messageObject = this.currentMessageObject;
if (messageObject != null) {
z = true;
}
messageDrawable.setBotButtonsBottom(z);
}
public void setDrawableBoundsInner(Drawable drawable, int i, int i2, int i3, int i4) {
if (drawable != null) {
float f = i4 + i2;
TransitionParams transitionParams = this.transitionParams;
float f2 = transitionParams.deltaBottom;
this.transitionYOffsetForDrawables = (f + f2) - ((int) (f + f2));
drawable.setBounds((int) (i + transitionParams.deltaLeft), (int) (i2 + transitionParams.deltaTop), (int) (i + i3 + transitionParams.deltaRight), (int) (f + f2));
}
}
private void setupTextColors() {
if (this.currentMessageObject.isOutOwner()) {
TextPaint textPaint = Theme.chat_msgTextPaint;
int i = Theme.key_chat_messageTextOut;
textPaint.setColor(getThemedColor(i));
Theme.chat_msgGameTextPaint.setColor(getThemedColor(i));
Theme.chat_msgTextCodePaint.setColor(getThemedColor(i));
Theme.chat_msgTextCode2Paint.setColor(getThemedColor(i));
Theme.chat_msgTextCode3Paint.setColor(getThemedColor(i));
TextPaint textPaint2 = Theme.chat_msgGameTextPaint;
TextPaint textPaint3 = Theme.chat_replyTextPaint;
TextPaint textPaint4 = Theme.chat_quoteTextPaint;
TextPaint textPaint5 = Theme.chat_msgTextPaint;
TextPaint textPaint6 = Theme.chat_msgTextCodePaint;
TextPaint textPaint7 = Theme.chat_msgTextCode2Paint;
TextPaint textPaint8 = Theme.chat_msgTextCode3Paint;
int themedColor = getThemedColor(Theme.key_chat_messageLinkOut);
textPaint8.linkColor = themedColor;
textPaint7.linkColor = themedColor;
textPaint6.linkColor = themedColor;
textPaint5.linkColor = themedColor;
textPaint4.linkColor = themedColor;
textPaint3.linkColor = themedColor;
textPaint2.linkColor = themedColor;
return;
}
TextPaint textPaint9 = Theme.chat_msgTextPaint;
int i2 = Theme.key_chat_messageTextIn;
textPaint9.setColor(getThemedColor(i2));
Theme.chat_msgGameTextPaint.setColor(getThemedColor(i2));
Theme.chat_msgTextCodePaint.setColor(getThemedColor(i2));
Theme.chat_msgTextCode2Paint.setColor(getThemedColor(i2));
Theme.chat_msgTextCode3Paint.setColor(getThemedColor(i2));
TextPaint textPaint10 = Theme.chat_msgGameTextPaint;
TextPaint textPaint11 = Theme.chat_replyTextPaint;
TextPaint textPaint12 = Theme.chat_quoteTextPaint;
TextPaint textPaint13 = Theme.chat_msgTextPaint;
TextPaint textPaint14 = Theme.chat_msgTextCodePaint;
TextPaint textPaint15 = Theme.chat_msgTextCode2Paint;
TextPaint textPaint16 = Theme.chat_msgTextCode3Paint;
int themedColor2 = getThemedColor(Theme.key_chat_messageLinkIn);
textPaint16.linkColor = themedColor2;
textPaint15.linkColor = themedColor2;
textPaint14.linkColor = themedColor2;
textPaint13.linkColor = themedColor2;
textPaint12.linkColor = themedColor2;
textPaint11.linkColor = themedColor2;
textPaint10.linkColor = themedColor2;
}
@Override
public int getBoundsLeft() {
int i;
float f;
int backgroundDrawableLeft = getBackgroundDrawableLeft();
if (needDrawAvatar()) {
if (this.currentPosition != null) {
f = 73.0f;
} else {
MessageObject messageObject = this.currentMessageObject;
f = (messageObject == null || !messageObject.isRepostPreview) ? 63 : 42;
}
i = AndroidUtilities.dp(f);
} else {
i = 0;
}
int i2 = backgroundDrawableLeft - i;
MessageObject messageObject2 = this.currentMessageObject;
return Math.max(0, i2 - ((messageObject2 != null && messageObject2.isOutOwner() && (checkNeedDrawShareButton(this.currentMessageObject) || this.useTranscribeButton)) ? AndroidUtilities.dp(48.0f) : 0));
}
@Override
public int getBoundsRight() {
int backgroundDrawableRight = getBackgroundDrawableRight();
MessageObject messageObject = this.currentMessageObject;
return backgroundDrawableRight + ((messageObject == null || messageObject.isOutOwner() || !(checkNeedDrawShareButton(this.currentMessageObject) || this.useTranscribeButton)) ? 0 : AndroidUtilities.dp(48.0f));
}
@Override
@SuppressLint({"WrongCall"})
public void onDraw(Canvas canvas) {
int i;
boolean z;
MessageObject messageObject;
MessageObject.GroupedMessagePosition groupedMessagePosition;
MessageTopicButton messageTopicButton;
MessageTopicButton messageTopicButton2;
Theme.MessageDrawable messageDrawable;
int i2;
int i3;
int i4;
int i5;
int i6;
if (this.currentMessageObject == null) {
return;
}
if (!this.wasLayout) {
onLayout(false, getLeft(), getTop(), getRight(), getBottom());
}
if (this.enterTransitionInProgress && this.currentMessageObject.isAnimatedEmojiStickers()) {
return;
}
if (this.channelRecommendationsCell != null && this.currentMessageObject.type == 27) {
ChatMessageCellDelegate chatMessageCellDelegate = this.delegate;
if (chatMessageCellDelegate == null || chatMessageCellDelegate.canDrawOutboundsContent()) {
this.channelRecommendationsCell.draw(canvas);
}
this.transitionParams.recordDrawingState();
return;
}
setupTextColors();
if (this.documentAttach != null) {
int i7 = this.documentAttachType;
if (i7 == 3 || i7 == 7) {
if (this.currentMessageObject.isOutOwner()) {
this.seekBarWaveform.setColors(getThemedColor(Theme.key_chat_outVoiceSeekbar), getThemedColor(Theme.key_chat_outVoiceSeekbarFill), getThemedColor(Theme.key_chat_outVoiceSeekbarSelected));
SeekBar seekBar = this.seekBar;
int themedColor = getThemedColor(Theme.key_chat_outAudioSeekbar);
int themedColor2 = getThemedColor(Theme.key_chat_outAudioCacheSeekbar);
int i8 = Theme.key_chat_outAudioSeekbarFill;
seekBar.setColors(themedColor, themedColor2, getThemedColor(i8), getThemedColor(i8), getThemedColor(Theme.key_chat_outAudioSeekbarSelected));
} else if (this.hasLinkPreview && this.linkLine != null) {
this.seekBarWaveform.setColors(Theme.adaptHue(getThemedColor(Theme.key_chat_inVoiceSeekbar), this.linkLine.getColor()), Theme.adaptHue(getThemedColor(Theme.key_chat_inVoiceSeekbarFill), this.linkLine.getColor()), Theme.adaptHue(getThemedColor(Theme.key_chat_inVoiceSeekbarSelected), this.linkLine.getColor()));
SeekBar seekBar2 = this.seekBar;
int adaptHue = Theme.adaptHue(getThemedColor(Theme.key_chat_inAudioSeekbar), this.linkLine.getColor());
int adaptHue2 = Theme.adaptHue(getThemedColor(Theme.key_chat_inAudioCacheSeekbar), this.linkLine.getColor());
int i9 = Theme.key_chat_inAudioSeekbarFill;
seekBar2.setColors(adaptHue, adaptHue2, Theme.adaptHue(getThemedColor(i9), this.linkLine.getColor()), Theme.adaptHue(getThemedColor(i9), this.linkLine.getColor()), Theme.adaptHue(getThemedColor(Theme.key_chat_inAudioSeekbarSelected), this.linkLine.getColor()));
} else {
this.seekBarWaveform.setColors(getThemedColor(Theme.key_chat_inVoiceSeekbar), getThemedColor(Theme.key_chat_inVoiceSeekbarFill), getThemedColor(Theme.key_chat_inVoiceSeekbarSelected));
SeekBar seekBar3 = this.seekBar;
int themedColor3 = getThemedColor(Theme.key_chat_inAudioSeekbar);
int themedColor4 = getThemedColor(Theme.key_chat_inAudioCacheSeekbar);
int i10 = Theme.key_chat_inAudioSeekbarFill;
seekBar3.setColors(themedColor3, themedColor4, getThemedColor(i10), getThemedColor(i10), getThemedColor(Theme.key_chat_inAudioSeekbarSelected));
}
} else if (i7 == 5) {
if (this.currentMessageObject.isOutOwner()) {
SeekBar seekBar4 = this.seekBar;
int themedColor5 = getThemedColor(Theme.key_chat_outAudioSeekbar);
int themedColor6 = getThemedColor(Theme.key_chat_outAudioCacheSeekbar);
int i11 = Theme.key_chat_outAudioSeekbarFill;
seekBar4.setColors(themedColor5, themedColor6, getThemedColor(i11), getThemedColor(i11), getThemedColor(Theme.key_chat_outAudioSeekbarSelected));
} else if (this.hasLinkPreview && this.linkLine != null) {
SeekBar seekBar5 = this.seekBar;
int adaptHue3 = Theme.adaptHue(getThemedColor(Theme.key_chat_inAudioSeekbar), this.linkLine.getColor());
int adaptHue4 = Theme.adaptHue(getThemedColor(Theme.key_chat_inAudioCacheSeekbar), this.linkLine.getColor());
int i12 = Theme.key_chat_inAudioSeekbarFill;
seekBar5.setColors(adaptHue3, adaptHue4, Theme.adaptHue(getThemedColor(i12), this.linkLine.getColor()), Theme.adaptHue(getThemedColor(i12), this.linkLine.getColor()), Theme.adaptHue(getThemedColor(Theme.key_chat_inAudioSeekbarSelected), this.linkLine.getColor()));
} else {
SeekBar seekBar6 = this.seekBar;
int themedColor7 = getThemedColor(Theme.key_chat_inAudioSeekbar);
int themedColor8 = getThemedColor(Theme.key_chat_inAudioCacheSeekbar);
int i13 = Theme.key_chat_inAudioSeekbarFill;
seekBar6.setColors(themedColor7, themedColor8, getThemedColor(i13), getThemedColor(i13), getThemedColor(Theme.key_chat_inAudioSeekbarSelected));
}
}
}
MessageObject messageObject2 = this.currentMessageObject;
if (messageObject2.type == 5) {
TextPaint textPaint = Theme.chat_timePaint;
int themedColor9 = getThemedColor(Theme.key_chat_serviceText);
if (isDrawSelectionBackground()) {
i6 = this.currentMessageObject.isOutOwner() ? Theme.key_chat_outTimeSelectedText : Theme.key_chat_inTimeSelectedText;
} else {
i6 = this.currentMessageObject.isOutOwner() ? Theme.key_chat_outTimeText : Theme.key_chat_inTimeText;
}
textPaint.setColor(ColorUtils.blendARGB(themedColor9, getThemedColor(i6), getVideoTranscriptionProgress()));
} else if (this.mediaBackground) {
if (messageObject2.shouldDrawWithoutBackground()) {
Theme.chat_timePaint.setColor(getThemedColor(Theme.key_chat_serviceText));
} else {
Theme.chat_timePaint.setColor(getThemedColor(Theme.key_chat_mediaTimeText));
}
} else if (messageObject2.isOutOwner()) {
Theme.chat_timePaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outTimeSelectedText : Theme.key_chat_outTimeText));
} else {
Theme.chat_timePaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inTimeSelectedText : Theme.key_chat_inTimeText));
}
if (isWidthAdaptive()) {
canvas.save();
canvas.translate(-getBoundsLeft(), 0.0f);
}
drawBackgroundInternal(canvas, false);
if (this.isHighlightedAnimated) {
long currentTimeMillis = System.currentTimeMillis();
long abs = Math.abs(currentTimeMillis - this.lastHighlightProgressTime);
if (abs > 17) {
abs = 17;
}
int i14 = (int) (this.highlightProgress - abs);
this.highlightProgress = i14;
this.lastHighlightProgressTime = currentTimeMillis;
if (i14 <= 0) {
this.highlightProgress = 0;
this.isHighlightedAnimated = false;
if (this.highlightedQuote) {
resetUrlPaths();
}
this.highlightedQuote = false;
}
invalidate();
if (getParent() != null) {
((View) getParent()).invalidate();
}
}
if (this.alphaInternal != 1.0f) {
int measuredHeight = getMeasuredHeight();
int measuredWidth = getMeasuredWidth();
Theme.MessageDrawable messageDrawable2 = this.currentBackgroundDrawable;
if (messageDrawable2 != null) {
i5 = messageDrawable2.getBounds().top;
i4 = this.currentBackgroundDrawable.getBounds().bottom;
i2 = this.currentBackgroundDrawable.getBounds().left;
i3 = this.currentBackgroundDrawable.getBounds().right;
} else {
i2 = 0;
i3 = measuredWidth;
i4 = measuredHeight;
i5 = 0;
}
if (this.drawSideButton != 0) {
if (this.currentMessageObject.isOutOwner()) {
i2 -= AndroidUtilities.dp(40.0f);
} else {
i3 += AndroidUtilities.dp(40.0f);
}
}
if (getY() < 0.0f) {
i5 = (int) (-getY());
}
float y = getY() + getMeasuredHeight();
int i15 = this.parentHeight;
if (y > i15) {
i4 = (int) (i15 - getY());
}
this.rect.set(i2, i5, i3, i4);
i = canvas.saveLayerAlpha(this.rect, (int) (this.alphaInternal * 255.0f), 31);
} else {
i = Integer.MIN_VALUE;
}
if (!this.transitionParams.animateBackgroundBoundsInner || (messageDrawable = this.currentBackgroundDrawable) == null || this.isRoundVideo) {
z = false;
} else {
Rect bounds = messageDrawable.getBounds();
canvas.save();
canvas.clipRect(bounds.left + AndroidUtilities.dp(4.0f), bounds.top + AndroidUtilities.dp(4.0f), bounds.right - AndroidUtilities.dp(4.0f), bounds.bottom - AndroidUtilities.dp(4.0f));
z = true;
}
drawContent(canvas, false);
ExpiredStoryView expiredStoryView = this.expiredStoryView;
if (expiredStoryView != null && expiredStoryView.visible) {
expiredStoryView.draw(canvas, this);
}
if (z) {
canvas.restore();
}
ChatMessageCellDelegate chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 == null || chatMessageCellDelegate2.canDrawOutboundsContent() || this.transitionParams.messageEntering || getAlpha() != 1.0f) {
drawOutboundsContent(canvas);
}
if (this.replyNameLayout != null) {
float f = this.replyTextHeight;
TransitionParams transitionParams = this.transitionParams;
if (transitionParams != null && transitionParams.animateReplyTextLayout != null) {
f = AndroidUtilities.lerp(this.transitionParams.animateFromReplyTextHeight, f, this.transitionParams.animateChangeProgress);
}
this.replyHeight = AndroidUtilities.dp(9.0f) + Theme.chat_replyNamePaint.getTextSize() + Math.max(f - AndroidUtilities.dp(3.66f), Theme.chat_replyTextPaint.getTextSize());
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
MessageObject messageObject3 = this.currentMessageObject;
if (messageObject3.type != 19) {
if (messageObject3.isOutOwner()) {
int dp = AndroidUtilities.dp(23.0f);
this.replyStartX = dp;
if (this.isPlayingRound) {
this.replyStartX = dp - (AndroidUtilities.roundPlayingMessageSize - AndroidUtilities.roundMessageSize);
}
} else if (this.currentMessageObject.type == 5) {
this.replyStartX = this.backgroundDrawableLeft + this.backgroundDrawableRight + AndroidUtilities.dp(4.0f);
} else {
this.replyStartX = this.backgroundDrawableLeft + this.backgroundDrawableRight + AndroidUtilities.dp(17.0f);
}
if (this.drawForwardedName) {
int dp2 = AndroidUtilities.dp(4.0f) + (((int) Theme.chat_forwardNamePaint.getTextSize()) * 2);
this.forwardHeight = dp2;
this.replyStartY = this.forwardNameY + dp2 + AndroidUtilities.dp(6.0f);
} else {
int dp3 = AndroidUtilities.dp(12.0f);
this.replyStartY = dp3;
if (this.drawTopic && (messageTopicButton2 = this.topicButton) != null) {
this.replyStartY = dp3 + messageTopicButton2.height() + AndroidUtilities.dp(10.0f);
}
}
this.replyStartY += AndroidUtilities.dp(0.66f);
}
}
if (this.currentMessageObject.isOutOwner()) {
int dp4 = this.backgroundDrawableLeft + AndroidUtilities.dp(12.0f) + getExtraTextX();
this.replyStartX = dp4;
if (this.currentMessageObject.type == 19) {
this.replyStartX = dp4 - Math.max(0, ((Math.max(this.replyNameWidth, this.replyTextWidth) + dp4) + AndroidUtilities.dp(14.0f)) - AndroidUtilities.displaySize.x);
}
} else if (this.mediaBackground) {
this.replyStartX = this.backgroundDrawableLeft + AndroidUtilities.dp(12.0f) + getExtraTextX();
} else {
this.replyStartX = this.backgroundDrawableLeft + AndroidUtilities.dp(this.drawPinnedBottom ? 12.0f : 18.0f) + getExtraTextX();
}
if (this.currentMessageObject.type == 19) {
this.replyStartX -= AndroidUtilities.dp(7.0f);
}
this.forwardHeight = AndroidUtilities.dp(4.0f) + (((int) Theme.chat_forwardNamePaint.getTextSize()) * 2);
int dp5 = AndroidUtilities.dp(12.0f) + ((!this.drawNameLayout || this.nameLayout == null) ? 0 : AndroidUtilities.dp(6.0f) + ((int) Theme.chat_namePaint.getTextSize())) + ((!this.drawForwardedName || this.forwardedNameLayout[0] == null) ? 0 : AndroidUtilities.dp(4.0f) + this.forwardHeight);
this.replyStartY = dp5;
if (this.drawTopic && (messageTopicButton = this.topicButton) != null) {
this.replyStartY = dp5 + messageTopicButton.height() + AndroidUtilities.dp(5.0f);
}
this.replyStartY += AndroidUtilities.dp(0.66f);
}
if (this.currentPosition == null && !this.transitionParams.animateBackgroundBoundsInner && (!this.enterTransitionInProgress || this.currentMessageObject.isVoice())) {
drawNamesLayout(canvas, 1.0f);
}
if ((!this.autoPlayingMedia || !MediaController.getInstance().isPlayingMessageAndReadyToDraw(this.currentMessageObject) || this.isRoundVideo) && !this.transitionParams.animateBackgroundBoundsInner && ((messageObject = this.currentMessageObject) == null || !messageObject.preview)) {
drawOverlays(canvas);
}
if ((this.drawTime || !this.mediaBackground) && !this.forceNotDrawTime && !this.transitionParams.animateBackgroundBoundsInner && (!this.enterTransitionInProgress || this.currentMessageObject.isVoice())) {
drawTime(canvas, 1.0f, false);
}
if ((this.controlsAlpha != 1.0f || this.timeAlpha != 1.0f) && this.currentMessageObject.type != 5) {
long currentTimeMillis2 = System.currentTimeMillis();
long abs2 = Math.abs(this.lastControlsAlphaChangeTime - currentTimeMillis2);
long j = this.totalChangeTime + (abs2 <= 17 ? abs2 : 17L);
this.totalChangeTime = j;
if (j > 200) {
this.totalChangeTime = 200L;
}
this.lastControlsAlphaChangeTime = currentTimeMillis2;
if (this.controlsAlpha != 1.0f) {
this.controlsAlpha = AndroidUtilities.decelerateInterpolator.getInterpolation(((float) this.totalChangeTime) / 200.0f);
}
if (this.timeAlpha != 1.0f) {
this.timeAlpha = AndroidUtilities.decelerateInterpolator.getInterpolation(((float) this.totalChangeTime) / 200.0f);
}
invalidate();
if (this.forceNotDrawTime && (groupedMessagePosition = this.currentPosition) != null && groupedMessagePosition.last && getParent() != null) {
((View) getParent()).invalidate();
}
}
if ((this.drawBackground || this.transitionParams.animateDrawBackground) && shouldDrawSelectionOverlay() && this.currentMessagesGroup == null && hasSelectionOverlay()) {
if (this.selectionOverlayPaint == null) {
this.selectionOverlayPaint = new Paint(1);
}
this.selectionOverlayPaint.setColor(getSelectionOverlayColor());
int alpha = this.selectionOverlayPaint.getAlpha();
this.selectionOverlayPaint.setAlpha((int) (alpha * getHighlightAlpha() * getAlpha()));
if (this.selectionOverlayPaint.getAlpha() > 0) {
canvas.save();
canvas.clipRect(0, 0, getMeasuredWidth(), getMeasuredHeight());
this.currentBackgroundDrawable.drawCached(canvas, this.backgroundCacheParams, this.selectionOverlayPaint);
canvas.restore();
}
this.selectionOverlayPaint.setAlpha(alpha);
}
if (i != Integer.MIN_VALUE) {
canvas.restoreToCount(i);
}
if (isWidthAdaptive()) {
canvas.restore();
}
updateSelectionTextPosition();
}
@SuppressLint({"WrongCall"})
public void drawBackgroundInternal(Canvas canvas, boolean z) {
Drawable shadowDrawable;
Drawable drawable;
int i;
int i2;
int dp;
int i3;
int i4;
MessageObject messageObject;
Canvas canvas2;
String str;
String str2;
String str3;
boolean z2;
float f;
MessageObject messageObject2;
MessageObject.GroupedMessages groupedMessages;
Theme.MessageDrawable messageDrawable;
int i5;
int i6;
MessageObject messageObject3;
int i7;
int dp2;
Drawable shadowDrawable2;
int i8;
int i9;
int i10;
int dp3;
if (this.currentMessageObject == null) {
return;
}
boolean z3 = this.wasLayout;
if (!z3 && !this.animationRunning) {
forceLayout();
return;
}
if (!z3) {
onLayout(false, getLeft(), getTop(), getRight(), getBottom());
}
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
Object[] objArr = groupedMessagePosition != null && (groupedMessagePosition.flags & 8) == 0 && this.currentMessagesGroup.isDocuments && !this.drawPinnedBottom;
if (this.currentMessageObject.isOutOwner()) {
if (this.transitionParams.changePinnedBottomProgress >= 1.0f && !this.mediaBackground && !this.drawPinnedBottom && objArr == false) {
this.currentBackgroundDrawable = (Theme.MessageDrawable) getThemedDrawable("drawableMsgOut");
this.currentBackgroundSelectedDrawable = (Theme.MessageDrawable) getThemedDrawable("drawableMsgOutSelected");
this.transitionParams.drawPinnedBottomBackground = false;
} else {
this.currentBackgroundDrawable = (Theme.MessageDrawable) getThemedDrawable("drawableMsgOutMedia");
this.currentBackgroundSelectedDrawable = (Theme.MessageDrawable) getThemedDrawable("drawableMsgOutMediaSelected");
this.transitionParams.drawPinnedBottomBackground = true;
}
setBackgroundTopY(true);
if (isDrawSelectionBackground() && (this.currentPosition == null || getBackground() != null)) {
shadowDrawable2 = this.currentBackgroundSelectedDrawable.getShadowDrawable();
} else {
shadowDrawable2 = this.currentBackgroundDrawable.getShadowDrawable();
}
drawable = shadowDrawable2;
this.backgroundDrawableLeft = (this.layoutWidth - this.backgroundWidth) - (!this.mediaBackground ? 0 : AndroidUtilities.dp(9.0f));
int dp4 = this.backgroundWidth - (this.mediaBackground ? 0 : AndroidUtilities.dp(3.0f));
this.backgroundDrawableRight = dp4;
MessageObject.GroupedMessages groupedMessages2 = this.currentMessagesGroup;
if (groupedMessages2 != null && !groupedMessages2.isDocuments && !this.currentPosition.edge) {
this.backgroundDrawableRight = dp4 + AndroidUtilities.dp(10.0f);
}
int i11 = this.backgroundDrawableLeft;
if (objArr == false && this.transitionParams.changePinnedBottomProgress != 1.0f) {
if (!this.mediaBackground) {
this.backgroundDrawableRight -= AndroidUtilities.dp(6.0f);
}
} else if (!this.mediaBackground && this.drawPinnedBottom) {
this.backgroundDrawableRight -= AndroidUtilities.dp(6.0f);
}
MessageObject.GroupedMessagePosition groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
if ((groupedMessagePosition2.flags & 2) == 0) {
this.backgroundDrawableRight += AndroidUtilities.dp(SharedConfig.bubbleRadius + 2);
}
if ((this.currentPosition.flags & 1) == 0) {
i11 -= AndroidUtilities.dp(SharedConfig.bubbleRadius + 2);
this.backgroundDrawableRight += AndroidUtilities.dp(SharedConfig.bubbleRadius + 2);
}
if ((this.currentPosition.flags & 4) == 0) {
i9 = 0 - AndroidUtilities.dp(SharedConfig.bubbleRadius + 3);
i10 = AndroidUtilities.dp(SharedConfig.bubbleRadius + 3) + 0;
} else {
i9 = 0;
i10 = 0;
}
if ((this.currentPosition.flags & 8) == 0) {
i10 += AndroidUtilities.dp(SharedConfig.bubbleRadius + 3);
}
i8 = i11;
} else {
i8 = i11;
i9 = 0;
i10 = 0;
}
boolean z4 = this.drawPinnedBottom;
if (z4 && this.drawPinnedTop) {
dp3 = 0;
} else if (z4) {
dp3 = AndroidUtilities.dp(1.0f);
} else {
dp3 = AndroidUtilities.dp(2.0f);
}
int dp5 = (this.drawPinnedTop ? 0 : AndroidUtilities.dp(1.0f)) + i9;
this.backgroundDrawableTop = dp5;
int i12 = (this.layoutHeight - dp3) + i10;
this.backgroundDrawableBottom = dp5 + i12;
if (!this.mediaBackground) {
if (this.drawPinnedTop) {
this.backgroundDrawableTop = dp5 - AndroidUtilities.dp(1.0f);
i12 += AndroidUtilities.dp(1.0f);
}
if (this.drawPinnedBottom) {
this.backgroundDrawableBottom += AndroidUtilities.dp(1.0f);
i12 += AndroidUtilities.dp(1.0f);
}
}
int i13 = i12;
if (objArr != false) {
setDrawableBoundsInner(this.currentBackgroundDrawable, i8, this.backgroundDrawableTop - i9, this.backgroundDrawableRight, (i13 - i10) + 10);
setDrawableBoundsInner(this.currentBackgroundSelectedDrawable, this.backgroundDrawableLeft, this.backgroundDrawableTop, this.backgroundDrawableRight - AndroidUtilities.dp(6.0f), i13);
} else {
int i14 = i8;
setDrawableBoundsInner(this.currentBackgroundDrawable, i14, this.backgroundDrawableTop, this.backgroundDrawableRight, i13);
setDrawableBoundsInner(this.currentBackgroundSelectedDrawable, i14, this.backgroundDrawableTop, this.backgroundDrawableRight, i13);
}
setDrawableBoundsInner(drawable, i8, this.backgroundDrawableTop, this.backgroundDrawableRight, i13);
} else {
if (this.transitionParams.changePinnedBottomProgress >= 1.0f && !this.mediaBackground && !this.drawPinnedBottom && objArr == false) {
this.currentBackgroundDrawable = (Theme.MessageDrawable) getThemedDrawable("drawableMsgIn");
this.currentBackgroundSelectedDrawable = (Theme.MessageDrawable) getThemedDrawable("drawableMsgInSelected");
this.transitionParams.drawPinnedBottomBackground = false;
} else {
this.currentBackgroundDrawable = (Theme.MessageDrawable) getThemedDrawable("drawableMsgInMedia");
this.currentBackgroundSelectedDrawable = (Theme.MessageDrawable) getThemedDrawable("drawableMsgInMediaSelected");
this.transitionParams.drawPinnedBottomBackground = true;
}
setBackgroundTopY(true);
if (isDrawSelectionBackground() && (this.currentPosition == null || getBackground() != null)) {
shadowDrawable = this.currentBackgroundSelectedDrawable.getShadowDrawable();
} else {
shadowDrawable = this.currentBackgroundDrawable.getShadowDrawable();
}
drawable = shadowDrawable;
this.backgroundDrawableLeft = AndroidUtilities.dp((((this.isChat || ((messageObject = this.currentMessageObject) != null && (messageObject.isRepostPreview || messageObject.forceAvatar))) && this.isAvatarVisible) ? 48 : 0) + (!this.mediaBackground ? 3 : 9));
this.backgroundDrawableRight = this.backgroundWidth - (this.mediaBackground ? 0 : AndroidUtilities.dp(3.0f));
MessageObject.GroupedMessages groupedMessages3 = this.currentMessagesGroup;
if (groupedMessages3 != null && !groupedMessages3.isDocuments) {
if (!this.currentPosition.edge) {
this.backgroundDrawableLeft -= AndroidUtilities.dp(10.0f);
this.backgroundDrawableRight += AndroidUtilities.dp(10.0f);
}
if (this.currentPosition.leftSpanOffset != 0) {
this.backgroundDrawableLeft += (int) Math.ceil((r0 / 1000.0f) * getGroupPhotosWidth());
}
}
boolean z5 = this.mediaBackground;
if ((!z5 && this.drawPinnedBottom) || (objArr == false && this.transitionParams.changePinnedBottomProgress != 1.0f)) {
if (this.drawPinnedBottom || !z5) {
this.backgroundDrawableRight -= AndroidUtilities.dp(6.0f);
}
if (!this.mediaBackground) {
this.backgroundDrawableLeft += AndroidUtilities.dp(6.0f);
}
}
MessageObject.GroupedMessagePosition groupedMessagePosition3 = this.currentPosition;
if (groupedMessagePosition3 != null) {
if ((groupedMessagePosition3.flags & 2) == 0) {
this.backgroundDrawableRight += AndroidUtilities.dp(SharedConfig.bubbleRadius + 2);
}
if ((this.currentPosition.flags & 1) == 0) {
this.backgroundDrawableLeft -= AndroidUtilities.dp(SharedConfig.bubbleRadius + 2);
this.backgroundDrawableRight += AndroidUtilities.dp(SharedConfig.bubbleRadius + 2);
}
if ((this.currentPosition.flags & 4) == 0) {
i4 = 0 - AndroidUtilities.dp(SharedConfig.bubbleRadius + 3);
i3 = AndroidUtilities.dp(SharedConfig.bubbleRadius + 3) + 0;
} else {
i3 = 0;
i4 = 0;
}
if ((this.currentPosition.flags & 8) == 0) {
i3 += AndroidUtilities.dp(SharedConfig.bubbleRadius + 4);
}
i = i3;
i2 = i4;
} else {
i = 0;
i2 = 0;
}
boolean z6 = this.drawPinnedBottom;
if (z6 && this.drawPinnedTop) {
dp = 0;
} else if (z6) {
dp = AndroidUtilities.dp(1.0f);
} else {
dp = AndroidUtilities.dp(2.0f);
}
int dp6 = i2 + (this.drawPinnedTop ? 0 : AndroidUtilities.dp(1.0f));
this.backgroundDrawableTop = dp6;
int i15 = (this.layoutHeight - dp) + i;
this.backgroundDrawableBottom = dp6 + i15;
if (!this.mediaBackground) {
if (this.drawPinnedTop) {
this.backgroundDrawableTop = dp6 - AndroidUtilities.dp(1.0f);
i15 += AndroidUtilities.dp(1.0f);
}
if (this.drawPinnedBottom) {
this.backgroundDrawableBottom += AndroidUtilities.dp(1.0f);
i15 += AndroidUtilities.dp(1.0f);
}
}
int i16 = i15;
setDrawableBoundsInner(this.currentBackgroundDrawable, this.backgroundDrawableLeft, this.backgroundDrawableTop, this.backgroundDrawableRight, i16);
if (objArr != false) {
setDrawableBoundsInner(this.currentBackgroundSelectedDrawable, AndroidUtilities.dp(6.0f) + this.backgroundDrawableLeft, this.backgroundDrawableTop, this.backgroundDrawableRight - AndroidUtilities.dp(6.0f), i16);
} else {
setDrawableBoundsInner(this.currentBackgroundSelectedDrawable, this.backgroundDrawableLeft, this.backgroundDrawableTop, this.backgroundDrawableRight, i16);
}
setDrawableBoundsInner(drawable, this.backgroundDrawableLeft, this.backgroundDrawableTop, this.backgroundDrawableRight, i16);
}
Drawable drawable2 = drawable;
if (!this.currentMessageObject.isOutOwner() && this.transitionParams.changePinnedBottomProgress != 1.0f && !this.mediaBackground && !this.drawPinnedBottom) {
this.backgroundDrawableLeft -= AndroidUtilities.dp(6.0f);
this.backgroundDrawableRight += AndroidUtilities.dp(6.0f);
}
if (this.hasPsaHint) {
MessageObject.GroupedMessagePosition groupedMessagePosition4 = this.currentPosition;
if (groupedMessagePosition4 == null || (groupedMessagePosition4.flags & 2) != 0) {
i7 = this.currentBackgroundDrawable.getBounds().right;
} else {
int groupPhotosWidth = getGroupPhotosWidth();
i7 = 0;
for (int i17 = 0; i17 < this.currentMessagesGroup.posArray.size(); i17++) {
if (this.currentMessagesGroup.posArray.get(i17).minY != 0) {
break;
}
i7 = (int) (i7 + Math.ceil(((r4.pw + r4.leftSpanOffset) / 1000.0f) * groupPhotosWidth));
}
}
Drawable drawable3 = Theme.chat_psaHelpDrawable[this.currentMessageObject.isOutOwner() ? 1 : 0];
if (this.currentMessageObject.type == 5) {
dp2 = AndroidUtilities.dp(12.0f);
} else {
dp2 = AndroidUtilities.dp((this.drawNameLayout ? 19 : 0) + 10);
}
this.psaHelpX = (i7 - drawable3.getIntrinsicWidth()) - AndroidUtilities.dp(this.currentMessageObject.isOutOwner() ? 20.0f : 14.0f);
this.psaHelpY = dp2 + AndroidUtilities.dp(4.0f);
}
if (this.checkBoxVisible || this.checkBoxAnimationInProgress) {
animateCheckboxTranslation();
int dp7 = AndroidUtilities.dp(21.0f);
this.checkBox.setBounds(AndroidUtilities.dp(-27.0f) + this.checkBoxTranslation, (this.currentBackgroundDrawable.getBounds().bottom - AndroidUtilities.dp(8.0f)) - dp7, dp7, dp7);
}
if (z || !drawBackgroundInParent()) {
int saveCount = canvas.getSaveCount();
if (this.transitionYOffsetForDrawables != 0.0f) {
canvas.save();
canvas2 = canvas;
canvas2.translate(0.0f, this.transitionYOffsetForDrawables);
} else {
canvas2 = canvas;
}
MessageObject messageObject4 = this.currentMessageObject;
if (messageObject4 == null || !messageObject4.isRoundVideo()) {
str = "drawableMsgInMedia";
str2 = "drawableMsgIn";
str3 = "drawableMsgOut";
z2 = false;
f = 0.0f;
} else {
float videoTranscriptionProgress = getVideoTranscriptionProgress();
this.currentBackgroundDrawable.setRoundingRadius(1.0f - videoTranscriptionProgress);
f = AndroidUtilities.lerp(this.backgroundWidth / 2, 0, videoTranscriptionProgress);
int i18 = (int) (videoTranscriptionProgress * 255.0f);
str = "drawableMsgInMedia";
str2 = "drawableMsgIn";
str3 = "drawableMsgOut";
z2 = false;
z2 = false;
canvas.saveLayerAlpha(0.0f, 0.0f, getWidth(), Math.max(this.currentBackgroundDrawable.getBounds().bottom, getHeight()), i18, 31);
this.roundVideoPlayPipFloat.set((((MediaController.getInstance().isPiPShown() && MediaController.getInstance().isPlayingMessageAndReadyToDraw(this.currentMessageObject)) || this.wouldBeInPip) && canvas.isHardwareAccelerated()) ? 1.0f : 0.0f);
if (MediaController.getInstance().isPiPShown()) {
this.wouldBeInPip = false;
}
}
if ((this.drawBackground || this.transitionParams.animateDrawBackground) && this.currentBackgroundDrawable != null && ((this.currentPosition == null || (isDrawSelectionBackground() && (this.currentMessageObject.isMusic() || this.currentMessageObject.isDocument()))) && (!this.enterTransitionInProgress || this.currentMessageObject.isVoice()))) {
float f2 = this.alphaInternal;
if (z) {
f2 *= getAlpha();
}
if (hasSelectionOverlay()) {
this.currentSelectedBackgroundAlpha = 0.0f;
int i19 = (int) (f2 * 255.0f);
this.currentBackgroundDrawable.setAlpha(i19);
this.currentBackgroundDrawable.drawCached(canvas2, this.backgroundCacheParams);
if (drawable2 != null && this.currentPosition == null) {
drawable2.setAlpha(i19);
drawable2.draw(canvas2);
}
} else {
if (this.isHighlightedAnimated) {
this.currentBackgroundDrawable.setAlpha((int) (f2 * 255.0f));
this.currentBackgroundDrawable.drawCached(canvas2, this.backgroundCacheParams);
float highlightAlpha = getHighlightAlpha();
this.currentSelectedBackgroundAlpha = highlightAlpha;
if (this.currentPosition == null) {
this.currentBackgroundSelectedDrawable.setAlpha((int) (highlightAlpha * f2 * 255.0f));
this.currentBackgroundSelectedDrawable.drawCached(canvas2, this.backgroundCacheParams);
}
} else if (this.selectedBackgroundProgress != 0.0f && (((messageObject2 = this.currentMessageObject) == null || !messageObject2.preview) && ((groupedMessages = this.currentMessagesGroup) == null || !groupedMessages.isDocuments))) {
this.currentBackgroundDrawable.setAlpha((int) (f2 * 255.0f));
this.currentBackgroundDrawable.drawCached(canvas2, this.backgroundCacheParams);
float f3 = this.selectedBackgroundProgress;
this.currentSelectedBackgroundAlpha = f3;
this.currentBackgroundSelectedDrawable.setAlpha((int) (f3 * f2 * 255.0f));
this.currentBackgroundSelectedDrawable.drawCached(canvas2, this.backgroundCacheParams);
if (this.currentBackgroundDrawable.getGradientShader() == null) {
drawable2 = null;
}
} else if (isDrawSelectionBackground() && this.quoteHighlight == null && (this.currentPosition == null || this.currentMessageObject.isMusic() || this.currentMessageObject.isDocument() || getBackground() != null)) {
if (this.currentPosition != null) {
canvas.save();
canvas2.clipRect(z2 ? 1 : 0, z2 ? 1 : 0, getMeasuredWidth(), getMeasuredHeight());
}
this.currentSelectedBackgroundAlpha = 1.0f;
this.currentBackgroundSelectedDrawable.setAlpha((int) (f2 * 255.0f));
this.currentBackgroundSelectedDrawable.drawCached(canvas2, this.backgroundCacheParams);
if (this.currentPosition != null) {
canvas.restore();
}
} else {
this.currentSelectedBackgroundAlpha = 0.0f;
this.currentBackgroundDrawable.setAlpha((int) (f2 * 255.0f));
this.currentBackgroundDrawable.drawCached(canvas2, this.backgroundCacheParams);
}
if (drawable2 != null && this.currentPosition == null) {
drawable2.setAlpha((int) (f2 * 255.0f));
drawable2.draw(canvas2);
}
if (this.transitionParams.changePinnedBottomProgress != 1.0f && this.currentPosition == null) {
if (this.currentMessageObject.isOutOwner()) {
Theme.MessageDrawable messageDrawable2 = (Theme.MessageDrawable) getThemedDrawable(str3);
Rect bounds = this.currentBackgroundDrawable.getBounds();
messageDrawable2.setBounds(bounds.left, bounds.top, bounds.right + AndroidUtilities.dp(6.0f), bounds.bottom);
canvas.save();
canvas2.translate(-f, 0.0f);
canvas2.clipRect(bounds.right - AndroidUtilities.dp(16.0f), bounds.bottom - AndroidUtilities.dp(16.0f), bounds.right + AndroidUtilities.dp(16.0f), bounds.bottom);
int i20 = this.parentWidth;
int i21 = this.parentHeight;
if (i21 == 0) {
i20 = getParentWidth();
i21 = AndroidUtilities.displaySize.y;
if (getParent() instanceof View) {
View view = (View) getParent();
int measuredWidth = view.getMeasuredWidth();
i6 = view.getMeasuredHeight();
i5 = measuredWidth;
float y = getY();
float f4 = this.parentViewTopOffset;
messageDrawable2.setTop((int) (y + f4), i5, i6, (int) f4, this.blurredViewTopOffset, this.blurredViewBottomOffset, this.pinnedTop, this.pinnedBottom);
messageObject3 = this.currentMessageObject;
if (messageObject3 != null && messageObject3.hasInlineBotButtons()) {
z2 = true;
}
messageDrawable2.setBotButtonsBottom(z2);
messageDrawable2.setAlpha((int) (((!this.mediaBackground || this.pinnedBottom) ? 1.0f - this.transitionParams.changePinnedBottomProgress : this.transitionParams.changePinnedBottomProgress) * 255.0f));
messageDrawable2.draw(canvas2);
messageDrawable2.setAlpha(255);
canvas.restore();
}
}
i5 = i20;
i6 = i21;
float y2 = getY();
float f42 = this.parentViewTopOffset;
messageDrawable2.setTop((int) (y2 + f42), i5, i6, (int) f42, this.blurredViewTopOffset, this.blurredViewBottomOffset, this.pinnedTop, this.pinnedBottom);
messageObject3 = this.currentMessageObject;
if (messageObject3 != null) {
z2 = true;
}
messageDrawable2.setBotButtonsBottom(z2);
messageDrawable2.setAlpha((int) (((!this.mediaBackground || this.pinnedBottom) ? 1.0f - this.transitionParams.changePinnedBottomProgress : this.transitionParams.changePinnedBottomProgress) * 255.0f));
messageDrawable2.draw(canvas2);
messageDrawable2.setAlpha(255);
canvas.restore();
} else {
if (this.transitionParams.drawPinnedBottomBackground) {
messageDrawable = (Theme.MessageDrawable) getThemedDrawable(str2);
} else {
messageDrawable = (Theme.MessageDrawable) getThemedDrawable(str);
}
messageDrawable.setAlpha((int) (((this.mediaBackground || this.pinnedBottom) ? 1.0f - this.transitionParams.changePinnedBottomProgress : this.transitionParams.changePinnedBottomProgress) * 255.0f));
Rect bounds2 = this.currentBackgroundDrawable.getBounds();
messageDrawable.setBounds(bounds2.left - AndroidUtilities.dp(6.0f), bounds2.top, bounds2.right, bounds2.bottom);
canvas.save();
canvas2.translate(f, 0.0f);
canvas2.clipRect(bounds2.left - AndroidUtilities.dp(6.0f), bounds2.bottom - AndroidUtilities.dp(16.0f), bounds2.left + AndroidUtilities.dp(18.0f), bounds2.bottom);
messageDrawable.draw(canvas2);
messageDrawable.setAlpha(255);
canvas.restore();
}
}
}
}
MessageObject messageObject5 = this.currentMessageObject;
if (messageObject5 != null && messageObject5.isRoundVideo()) {
this.currentBackgroundDrawable.setRoundingRadius(0.0f);
}
canvas2.restoreToCount(saveCount);
}
}
private void animateCheckboxTranslation() {
boolean z = this.checkBoxVisible;
if (z || this.checkBoxAnimationInProgress) {
if ((z && this.checkBoxAnimationProgress == 1.0f) || (!z && this.checkBoxAnimationProgress == 0.0f)) {
this.checkBoxAnimationInProgress = false;
}
this.checkBoxTranslation = (int) Math.ceil((z ? CubicBezierInterpolator.EASE_OUT : CubicBezierInterpolator.EASE_IN).getInterpolation(this.checkBoxAnimationProgress) * AndroidUtilities.dp(35.0f));
if (!this.currentMessageObject.isOutOwner() || this.currentMessageObject.hasWideCode) {
updateTranslation();
}
if (this.checkBoxAnimationInProgress) {
long elapsedRealtime = SystemClock.elapsedRealtime();
long j = elapsedRealtime - this.lastCheckBoxAnimationTime;
this.lastCheckBoxAnimationTime = elapsedRealtime;
if (this.checkBoxVisible) {
float f = this.checkBoxAnimationProgress + (((float) j) / 200.0f);
this.checkBoxAnimationProgress = f;
if (f > 1.0f) {
this.checkBoxAnimationProgress = 1.0f;
}
} else {
float f2 = this.checkBoxAnimationProgress - (((float) j) / 200.0f);
this.checkBoxAnimationProgress = f2;
if (f2 <= 0.0f) {
this.checkBoxAnimationProgress = 0.0f;
}
}
invalidate();
((View) getParent()).invalidate();
}
}
}
public boolean drawBackgroundInParent() {
MessageObject messageObject;
return this.canDrawBackgroundInParent && (messageObject = this.currentMessageObject) != null && messageObject.isOutOwner() && getThemedColor(Theme.key_chat_outBubbleGradient1) != 0;
}
public void drawServiceBackground(Canvas canvas, RectF rectF, float f, float f2) {
applyServiceShaderMatrix();
if (f2 != 1.0f) {
int alpha = getThemedPaint("paintChatActionBackground").getAlpha();
getThemedPaint("paintChatActionBackground").setAlpha((int) (alpha * f2));
canvas.drawRoundRect(rectF, f, f, getThemedPaint("paintChatActionBackground"));
getThemedPaint("paintChatActionBackground").setAlpha(alpha);
} else {
canvas.drawRoundRect(rectF, f, f, getThemedPaint(this.sideButtonPressed ? "paintChatActionBackgroundSelected" : "paintChatActionBackground"));
}
if (hasGradientService()) {
if (f2 != 1.0f) {
int alpha2 = Theme.chat_actionBackgroundGradientDarkenPaint.getAlpha();
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha((int) (f2 * alpha2));
canvas.drawRoundRect(rectF, f, f, Theme.chat_actionBackgroundGradientDarkenPaint);
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha(alpha2);
return;
}
canvas.drawRoundRect(rectF, f, f, Theme.chat_actionBackgroundGradientDarkenPaint);
}
}
public void drawCommentButton(Canvas canvas, float f) {
if (this.drawSideButton != 3) {
return;
}
int dp = AndroidUtilities.dp(32.0f);
if (this.commentLayout != null) {
this.sideStartY -= AndroidUtilities.dp(18.0f);
dp += AndroidUtilities.dp(18.0f);
}
RectF rectF = this.rect;
float f2 = this.sideStartX;
rectF.set(f2, this.sideStartY, AndroidUtilities.dp(32.0f) + f2, this.sideStartY + dp);
applyServiceShaderMatrix();
if (f != 1.0f) {
int alpha = getThemedPaint("paintChatActionBackground").getAlpha();
getThemedPaint("paintChatActionBackground").setAlpha((int) (alpha * f));
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), getThemedPaint("paintChatActionBackground"));
getThemedPaint("paintChatActionBackground").setAlpha(alpha);
} else {
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), getThemedPaint(this.sideButtonPressed ? "paintChatActionBackgroundSelected" : "paintChatActionBackground"));
}
if (hasGradientService()) {
if (f != 1.0f) {
int alpha2 = Theme.chat_actionBackgroundGradientDarkenPaint.getAlpha();
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha((int) (alpha2 * f));
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), Theme.chat_actionBackgroundGradientDarkenPaint);
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha(alpha2);
} else {
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), Theme.chat_actionBackgroundGradientDarkenPaint);
}
}
Drawable themeDrawable = Theme.getThemeDrawable("drawableCommentSticker");
BaseCell.setDrawableBounds(themeDrawable, this.sideStartX + AndroidUtilities.dp(4.0f), this.sideStartY + AndroidUtilities.dp(4.0f));
if (f != 1.0f) {
themeDrawable.setAlpha((int) (f * 255.0f));
themeDrawable.draw(canvas);
themeDrawable.setAlpha(255);
} else {
themeDrawable.draw(canvas);
}
if (this.commentLayout != null) {
Theme.chat_stickerCommentCountPaint.setColor(getThemedColor(Theme.key_chat_stickerReplyNameText));
Theme.chat_stickerCommentCountPaint.setAlpha((int) (f * 255.0f));
if (this.transitionParams.animateComments) {
if (this.transitionParams.animateCommentsLayout != null) {
canvas.save();
Theme.chat_stickerCommentCountPaint.setAlpha((int) ((1.0d - this.transitionParams.animateChangeProgress) * 255.0d * f));
canvas.translate(this.sideStartX + ((AndroidUtilities.dp(32.0f) - this.transitionParams.animateTotalCommentWidth) / 2), this.sideStartY + AndroidUtilities.dp(30.0f));
this.transitionParams.animateCommentsLayout.draw(canvas);
canvas.restore();
}
Theme.chat_stickerCommentCountPaint.setAlpha((int) (this.transitionParams.animateChangeProgress * 255.0f));
}
canvas.save();
canvas.translate(this.sideStartX + ((AndroidUtilities.dp(32.0f) - this.totalCommentWidth) / 2), this.sideStartY + AndroidUtilities.dp(30.0f));
this.commentLayout.draw(canvas);
canvas.restore();
}
}
public void applyServiceShaderMatrix() {
applyServiceShaderMatrix(getMeasuredWidth(), this.backgroundHeight, getX(), this.viewTop);
}
private void applyServiceShaderMatrix(int i, int i2, float f, float f2) {
Theme.ResourcesProvider resourcesProvider = this.resourcesProvider;
if (resourcesProvider != null) {
resourcesProvider.applyServiceShaderMatrix(i, i2, f, f2);
} else {
Theme.applyServiceShaderMatrix(i, i2, f, f2);
}
}
public boolean hasOutboundsContent() {
AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable swapAnimatedEmojiDrawable;
MessageObject messageObject;
if (this.channelRecommendationsCell != null && (messageObject = this.currentMessageObject) != null && messageObject.type == 27) {
return true;
}
if (getAlpha() != 1.0f) {
return false;
}
if ((!this.transitionParams.transitionBotButtons.isEmpty() && this.transitionParams.animateBotButtonsChanged) || !this.botButtons.isEmpty() || this.drawSideButton != 0) {
return true;
}
if (this.drawNameLayout && this.nameLayout != null && (swapAnimatedEmojiDrawable = this.currentNameStatusDrawable) != null && swapAnimatedEmojiDrawable.getDrawable() != null) {
return true;
}
AnimatedEmojiSpan.EmojiGroupedSpans emojiGroupedSpans = this.animatedEmojiStack;
if (emojiGroupedSpans != null && !emojiGroupedSpans.holders.isEmpty()) {
return true;
}
if (this.drawTopic && this.topicButton != null) {
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
if (groupedMessagePosition == null) {
return true;
}
if (groupedMessagePosition.minY == 0 && groupedMessagePosition.minX == 0) {
return true;
}
}
if (this.currentMessagesGroup == null) {
TransitionParams transitionParams = this.transitionParams;
if (((transitionParams.animateReplaceCaptionLayout && transitionParams.animateChangeProgress != 1.0f) || (transitionParams.animateChangeProgress != 1.0f && transitionParams.animateMessageText)) && transitionParams.animateOutAnimateEmoji != null && !this.transitionParams.animateOutAnimateEmoji.holders.isEmpty()) {
return true;
}
}
return false;
}
public void drawOutboundsContent(Canvas canvas) {
MessageObject.GroupedMessagePosition groupedMessagePosition;
float f;
float f2;
float f3;
MessageObject.GroupedMessagePosition groupedMessagePosition2;
float dp;
int extraTextX;
float f4;
int themedColor;
TLRPC$User tLRPC$User;
TLRPC$ChatInvite tLRPC$ChatInvite;
TLRPC$Chat tLRPC$Chat;
TLRPC$ChatInvite tLRPC$ChatInvite2;
float dp2;
float dp3;
MessageObject.GroupedMessages groupedMessages;
MessageObject messageObject;
ChannelRecommendationsCell channelRecommendationsCell = this.channelRecommendationsCell;
if (channelRecommendationsCell != null && (messageObject = this.currentMessageObject) != null && messageObject.type == 27) {
channelRecommendationsCell.draw(canvas);
return;
}
if (this.currentMessageObject == null) {
return;
}
if (!this.enterTransitionInProgress) {
drawAnimatedEmojis(canvas, 1.0f);
}
if (this.currentNameStatusDrawable != null && this.drawNameLayout && this.nameLayout != null && (((groupedMessagePosition2 = this.currentPosition) == null || (groupedMessagePosition2.minX == 0 && groupedMessagePosition2.minY == 0)) && (!this.currentMessageObject.deleted || this.drawingToBitmap || (groupedMessages = this.currentMessagesGroup) == null || groupedMessages.messages.size() < 1))) {
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
themedColor = getThemedColor(Theme.key_chat_stickerNameText);
if (this.currentMessageObject.isOutOwner()) {
dp3 = AndroidUtilities.dp(28.0f);
} else {
dp3 = this.backgroundDrawableLeft + this.transitionParams.deltaLeft + this.backgroundDrawableRight + AndroidUtilities.dp(22.0f);
}
dp2 = this.layoutHeight - AndroidUtilities.dp(38.0f);
f4 = dp3 - this.nameOffsetX;
} else {
if (this.mediaBackground || this.currentMessageObject.isOutOwner()) {
dp = this.backgroundDrawableLeft + this.transitionParams.deltaLeft + AndroidUtilities.dp(11.0f);
extraTextX = getExtraTextX();
} else {
dp = this.backgroundDrawableLeft + this.transitionParams.deltaLeft + AndroidUtilities.dp((this.mediaBackground || !this.drawPinnedBottom) ? 17.0f : 11.0f);
extraTextX = getExtraTextX();
}
f4 = dp + extraTextX;
if (this.currentMessageObject.isOutOwner() && ChatObject.isChannel(this.currentChat)) {
Theme.MessageDrawable messageDrawable = this.currentBackgroundDrawable;
if (messageDrawable != null && messageDrawable.hasGradient()) {
themedColor = getThemedColor(Theme.key_chat_messageTextOut);
} else {
themedColor = getThemedColor(Theme.key_chat_outForwardedNameText);
}
} else if (this.currentMessageObject.isOutOwner()) {
themedColor = getThemedColor(Theme.key_chat_outForwardedNameText);
} else {
MessageObject messageObject2 = this.currentMessageObject;
if (messageObject2.overrideLinkColor >= 0 || ((messageObject2.isFromUser() && this.currentUser != null) || ((this.currentMessageObject.isFromChannel() && this.currentChat != null) || ((this.currentMessageObject.isSponsored() && (this.currentMessageObject.sponsoredChatInvite instanceof TLRPC$TL_chatInvite)) || (this.currentMessageObject.isSponsored() && (tLRPC$ChatInvite2 = this.currentMessageObject.sponsoredChatInvite) != null && tLRPC$ChatInvite2.chat != null))))) {
MessageObject messageObject3 = this.currentMessageObject;
int i = messageObject3.overrideLinkColor;
if (i < 0) {
if (messageObject3.isSponsored()) {
TLRPC$ChatInvite tLRPC$ChatInvite3 = this.currentMessageObject.sponsoredChatInvite;
if (tLRPC$ChatInvite3 instanceof TLRPC$TL_chatInvite) {
i = tLRPC$ChatInvite3.color;
}
}
if (this.currentMessageObject.isSponsored() && (tLRPC$ChatInvite = this.currentMessageObject.sponsoredChatInvite) != null && (tLRPC$Chat = tLRPC$ChatInvite.chat) != null) {
i = ChatObject.getColorId(tLRPC$Chat);
} else if (this.currentMessageObject.isFromUser() && (tLRPC$User = this.currentUser) != null) {
i = UserObject.getColorId(tLRPC$User);
} else {
i = ChatObject.getColorId(this.currentChat);
}
}
if (i < 7) {
themedColor = getThemedColor(Theme.keys_avatar_nameInMessage[i]);
} else {
MessagesController.PeerColors peerColors = MessagesController.getInstance(this.currentAccount).peerColors;
MessagesController.PeerColor color = peerColors != null ? peerColors.getColor(i) : null;
if (color != null) {
themedColor = color.getColor(0, this.resourcesProvider);
} else {
themedColor = getThemedColor(Theme.key_chat_inForwardedNameText);
}
}
} else {
themedColor = getThemedColor(Theme.key_chat_inForwardedNameText);
}
}
dp2 = AndroidUtilities.dp(this.drawPinnedTop ? 9.0f : 10.0f);
}
MessageObject.GroupedMessages groupedMessages2 = this.currentMessagesGroup;
if (groupedMessages2 != null) {
MessageObject.GroupedMessages.TransitionParams transitionParams = groupedMessages2.transitionParams;
if (transitionParams.backgroundChangeBounds) {
f4 += transitionParams.offsetLeft;
dp2 += transitionParams.offsetTop - getTranslationY();
}
}
float f5 = f4 + this.animationOffsetX;
TransitionParams transitionParams2 = this.transitionParams;
float f6 = dp2 + transitionParams2.deltaTop;
if (transitionParams2.animateSign) {
f5 = ((f5 - this.transitionParams.animateNameX) * this.transitionParams.animateChangeProgress) + this.transitionParams.animateNameX;
}
this.currentNameStatusDrawable.setBounds((int) (Math.abs(f5) + (this.viaNameWidth > 0 ? r8 - AndroidUtilities.dp(32.0f) : this.nameLayoutWidth) + AndroidUtilities.dp(2.0f)), (int) (((this.nameLayout.getHeight() / 2) + f6) - AndroidUtilities.dp(10.0f)), (int) (Math.abs(f5) + (this.viaNameWidth > 0 ? r10 - AndroidUtilities.dp(32.0f) : this.nameLayoutWidth) + AndroidUtilities.dp(22.0f)), (int) (f6 + (this.nameLayout.getHeight() / 2) + AndroidUtilities.dp(10.0f)));
this.currentNameStatusDrawable.setColor(Integer.valueOf(ColorUtils.setAlphaComponent(themedColor, org.telegram.messenger.R.styleable.AppCompatTheme_tooltipFrameBackground)));
this.currentNameStatusDrawable.draw(canvas);
}
if (this.drawTopic && this.topicButton != null && ((groupedMessagePosition = this.currentPosition) == null || (groupedMessagePosition.minY == 0 && groupedMessagePosition.minX == 0))) {
if (!this.isRoundVideo || this.hasLinkPreview) {
f = 1.0f;
} else {
f = (1.0f - getVideoTranscriptionProgress()) * 1.0f;
TransitionParams transitionParams3 = this.transitionParams;
if (transitionParams3.animatePlayingRound) {
if (this.isPlayingRound) {
f3 = 1.0f - transitionParams3.animateChangeProgress;
} else {
f3 = transitionParams3.animateChangeProgress;
}
f *= f3;
} else if (this.isPlayingRound) {
f = 0.0f;
}
}
if (!this.transitionParams.animateForwardedLayout) {
f2 = 1.0f;
} else if (!this.currentMessageObject.needDrawForwarded()) {
f2 = 1.0f - this.transitionParams.animateChangeProgress;
} else {
f2 = this.transitionParams.animateChangeProgress;
}
this.topicButton.drawOutbounds(canvas, f2 * f);
}
if (!this.transitionParams.transitionBotButtons.isEmpty()) {
if (this.transitionParams.animateBotButtonsChanged) {
drawBotButtons(canvas, this.transitionParams.transitionBotButtons, (int) (MathUtils.clamp(1.0f - ((float) Math.pow(r0.animateChangeProgress, 2.0d)), 0.0f, 1.0f) * 255.0f));
}
}
if (!this.botButtons.isEmpty()) {
ArrayList<BotButton> arrayList = this.botButtons;
TransitionParams transitionParams4 = this.transitionParams;
drawBotButtons(canvas, arrayList, transitionParams4.animateBotButtonsChanged ? (int) (transitionParams4.animateChangeProgress * 255.0f) : 255);
}
drawSideButton(canvas);
}
public void drawAnimatedEmojis(Canvas canvas, float f) {
drawAnimatedEmojiMessageText(canvas, f);
if (shouldDrawCaptionLayout()) {
drawAnimatedEmojiCaption(canvas, f);
}
}
private void drawAnimatedEmojiMessageText(Canvas canvas, float f) {
MessageObject messageObject = this.currentMessageObject;
if (messageObject == null || messageObject.isSponsored()) {
return;
}
int i = this.textY;
float f2 = i;
TransitionParams transitionParams = this.transitionParams;
if (transitionParams.animateText) {
float f3 = transitionParams.animateFromTextY;
float f4 = transitionParams.animateChangeProgress;
f2 = (f3 * (1.0f - f4)) + (i * f4);
}
float f5 = f2;
if (transitionParams.animateChangeProgress != 1.0f && transitionParams.animateMessageText) {
canvas.save();
Theme.MessageDrawable messageDrawable = this.currentBackgroundDrawable;
if (messageDrawable != null) {
Rect bounds = messageDrawable.getBounds();
if (this.currentMessageObject.isOutOwner() && !this.mediaBackground && !this.pinnedBottom) {
canvas.clipRect(bounds.left + AndroidUtilities.dp(4.0f), bounds.top + AndroidUtilities.dp(4.0f), bounds.right - AndroidUtilities.dp(10.0f), bounds.bottom - AndroidUtilities.dp(4.0f));
} else {
canvas.clipRect(bounds.left + AndroidUtilities.dp(4.0f), bounds.top + AndroidUtilities.dp(4.0f), bounds.right - AndroidUtilities.dp(4.0f), bounds.bottom - AndroidUtilities.dp(4.0f));
}
}
drawAnimatedEmojiMessageText(this.textX, f5, canvas, this.transitionParams.animateOutTextBlocks, this.transitionParams.animateOutAnimateEmoji, false, f * (1.0f - this.transitionParams.animateChangeProgress), this.currentMessageObject.textXOffset, false);
float f6 = this.textX;
MessageObject messageObject2 = this.currentMessageObject;
drawAnimatedEmojiMessageText(f6, f5, canvas, messageObject2.textLayoutBlocks, this.animatedEmojiStack, true, f * this.transitionParams.animateChangeProgress, messageObject2.textXOffset, false);
canvas.restore();
return;
}
float f7 = this.textX;
MessageObject messageObject3 = this.currentMessageObject;
drawAnimatedEmojiMessageText(f7, f5, canvas, messageObject3.textLayoutBlocks, this.animatedEmojiStack, true, f, messageObject3.textXOffset, false);
}
private void drawAnimatedEmojiMessageText(float f, float f2, Canvas canvas, ArrayList<MessageObject.TextLayoutBlock> arrayList, AnimatedEmojiSpan.EmojiGroupedSpans emojiGroupedSpans, boolean z, float f3, float f4, boolean z2) {
int size;
int i;
if (this.currentMessageObject == null || arrayList == null || arrayList.isEmpty() || f3 == 0.0f) {
return;
}
if (z && !z2) {
if (this.fullyDraw) {
this.firstVisibleBlockNum = 0;
this.lastVisibleBlockNum = arrayList.size();
}
i = this.firstVisibleBlockNum;
size = this.lastVisibleBlockNum;
} else {
size = arrayList.size();
i = 0;
}
int i2 = size;
for (int i3 = i; i3 <= i2 && i3 < arrayList.size(); i3++) {
if (i3 >= 0) {
MessageObject.TextLayoutBlock textLayoutBlock = arrayList.get(i3);
canvas.save();
canvas.translate(f - (textLayoutBlock.isRtl() ? (int) Math.ceil(f4) : 0), f2 + textLayoutBlock.padTop + textLayoutBlock.textYOffset + this.transitionYOffsetForDrawables);
float f5 = f2 + textLayoutBlock.textYOffset + this.transitionYOffsetForDrawables;
boolean z3 = this.transitionParams.messageEntering;
int i4 = this.currentMessageObject.isOutOwner() ? Theme.key_chat_messageTextOut : Theme.key_chat_messageTextIn;
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
i4 = Theme.key_windowBackgroundWhiteBlackText;
}
AnimatedEmojiSpan.drawAnimatedEmojis(canvas, textLayoutBlock.textLayout, emojiGroupedSpans, 0.0f, textLayoutBlock.spoilers, 0.0f, 0.0f, f5, f3, getAdaptiveEmojiColorFilter(0, getThemedColor(i4)));
canvas.restore();
}
}
}
public void drawAnimatedEmojiCaption(Canvas canvas, float f) {
float f2;
float f3;
TransitionParams transitionParams;
float f4;
if (this.captionLayout == null) {
return;
}
float f5 = this.captionY;
float f6 = this.captionX;
TransitionParams transitionParams2 = this.transitionParams;
if (transitionParams2.animateBackgroundBoundsInner) {
if (transitionParams2.transformGroupToSingleMessage) {
f5 -= getTranslationY();
f4 = this.transitionParams.deltaLeft;
} else {
if (transitionParams2.moveCaption) {
float f7 = this.captionX;
TransitionParams transitionParams3 = this.transitionParams;
float f8 = transitionParams3.animateChangeProgress;
f3 = (f7 * f8) + (transitionParams3.captionFromX * (1.0f - f8));
f2 = (this.captionY * f8) + (transitionParams3.captionFromY * (1.0f - f8));
transitionParams = this.transitionParams;
if (transitionParams.animateReplaceCaptionLayout || transitionParams.animateChangeProgress == 1.0f) {
MessageObject.TextLayoutBlocks textLayoutBlocks = this.captionLayout;
drawAnimatedEmojiMessageText(f3, f2, canvas, textLayoutBlocks == null ? textLayoutBlocks.textLayoutBlocks : null, this.animatedEmojiStack, true, f, textLayoutBlocks == null ? textLayoutBlocks.textXOffset : 0.0f, true);
}
ArrayList<MessageObject.TextLayoutBlock> arrayList = transitionParams.animateOutCaptionLayout != null ? this.transitionParams.animateOutCaptionLayout.textLayoutBlocks : null;
AnimatedEmojiSpan.EmojiGroupedSpans emojiGroupedSpans = this.transitionParams.animateOutAnimateEmoji;
TransitionParams transitionParams4 = this.transitionParams;
drawAnimatedEmojiMessageText(f3, f2, canvas, arrayList, emojiGroupedSpans, false, f * (1.0f - transitionParams4.animateChangeProgress), transitionParams4.animateOutCaptionLayout != null ? this.transitionParams.animateOutCaptionLayout.textXOffset : 0.0f, true);
MessageObject.TextLayoutBlocks textLayoutBlocks2 = this.captionLayout;
drawAnimatedEmojiMessageText(f3, f2, canvas, textLayoutBlocks2 != null ? textLayoutBlocks2.textLayoutBlocks : null, this.animatedEmojiStack, true, f * this.transitionParams.animateChangeProgress, textLayoutBlocks2 != null ? textLayoutBlocks2.textXOffset : 0.0f, true);
return;
}
if (!this.currentMessageObject.isVoice() || !TextUtils.isEmpty(this.currentMessageObject.caption)) {
f4 = this.transitionParams.deltaLeft;
}
}
f6 += f4;
}
f2 = f5;
f3 = f6;
transitionParams = this.transitionParams;
if (transitionParams.animateReplaceCaptionLayout) {
}
MessageObject.TextLayoutBlocks textLayoutBlocks3 = this.captionLayout;
drawAnimatedEmojiMessageText(f3, f2, canvas, textLayoutBlocks3 == null ? textLayoutBlocks3.textLayoutBlocks : null, this.animatedEmojiStack, true, f, textLayoutBlocks3 == null ? textLayoutBlocks3.textXOffset : 0.0f, true);
}
private void drawSideButton(Canvas canvas) {
MessageObject.GroupedMessages groupedMessages;
if (this.drawSideButton != 0) {
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
if (groupedMessagePosition == null || (groupedMessages = this.currentMessagesGroup) == null || !groupedMessages.isDocuments || groupedMessagePosition.last) {
if (this.currentMessageObject.isOutOwner()) {
float dp = this.transitionParams.lastBackgroundLeft - AndroidUtilities.dp(40.0f);
this.sideStartX = dp;
MessageObject.GroupedMessages groupedMessages2 = this.currentMessagesGroup;
if (groupedMessages2 != null) {
this.sideStartX = dp + (groupedMessages2.transitionParams.offsetLeft - this.animationOffsetX);
}
} else {
float dp2 = this.transitionParams.lastBackgroundRight + AndroidUtilities.dp(8.0f);
this.sideStartX = dp2;
MessageObject.GroupedMessages groupedMessages3 = this.currentMessagesGroup;
if (groupedMessages3 != null) {
this.sideStartX = dp2 + (groupedMessages3.transitionParams.offsetRight - this.animationOffsetX);
}
}
if (this.drawSideButton == 4) {
this.sideStartY = AndroidUtilities.dp(6.0f);
} else {
float dp3 = (this.layoutHeight + this.transitionParams.deltaBottom) - AndroidUtilities.dp(41.0f);
this.sideStartY = dp3;
MessageObject messageObject = this.currentMessageObject;
if (messageObject.type == 19 && messageObject.textWidth < this.timeTextWidth) {
this.sideStartY = dp3 - AndroidUtilities.dp(22.0f);
}
MessageObject.GroupedMessages groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
float f = this.sideStartY;
MessageObject.GroupedMessages.TransitionParams transitionParams = groupedMessages4.transitionParams;
float f2 = f + transitionParams.offsetBottom;
this.sideStartY = f2;
if (transitionParams.backgroundChangeBounds) {
this.sideStartY = f2 - getTranslationY();
}
}
if (this.currentMessageObject.shouldDrawReactions()) {
ReactionsLayoutInBubble reactionsLayoutInBubble = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble.isSmall) {
if (this.isRoundVideo) {
this.sideStartY -= reactionsLayoutInBubble.getCurrentTotalHeight(this.transitionParams.animateChangeProgress) * (1.0f - getVideoTranscriptionProgress());
} else if (reactionsLayoutInBubble.drawServiceShaderBackground > 0.0f) {
this.sideStartY -= reactionsLayoutInBubble.getCurrentTotalHeight(this.transitionParams.animateChangeProgress);
}
}
}
}
if (this.drawSideButton != 4 && this.sideStartY < (this.layoutHeight - AndroidUtilities.dp(32.0f)) / 2.0f) {
this.sideStartY = (this.layoutHeight - AndroidUtilities.dp(32.0f)) / 2.0f;
}
if (!this.currentMessageObject.isOutOwner() && this.isRoundVideo && !this.hasLinkPreview) {
float dp4 = this.isAvatarVisible ? (AndroidUtilities.roundPlayingMessageSize - AndroidUtilities.roundMessageSize) * 0.7f : AndroidUtilities.dp(50.0f);
float videoTranscriptionProgress = this.isPlayingRound ? (1.0f - getVideoTranscriptionProgress()) * dp4 : 0.0f;
float dp5 = this.isPlayingRound ? AndroidUtilities.dp(28.0f) * (1.0f - getVideoTranscriptionProgress()) : 0.0f;
TransitionParams transitionParams2 = this.transitionParams;
if (transitionParams2.animatePlayingRound) {
videoTranscriptionProgress = (this.isPlayingRound ? transitionParams2.animateChangeProgress : 1.0f - transitionParams2.animateChangeProgress) * (1.0f - getVideoTranscriptionProgress()) * dp4;
dp5 = AndroidUtilities.dp(28.0f) * (this.isPlayingRound ? this.transitionParams.animateChangeProgress : 1.0f - this.transitionParams.animateChangeProgress) * (1.0f - getVideoTranscriptionProgress());
}
this.sideStartX -= videoTranscriptionProgress;
this.sideStartY -= dp5;
}
if (this.drawSideButton == 3) {
if (!this.enterTransitionInProgress || this.currentMessageObject.isVoice()) {
drawCommentButton(canvas, 1.0f);
return;
}
return;
}
RectF rectF = this.rect;
float f3 = this.sideStartX;
rectF.set(f3, this.sideStartY, AndroidUtilities.dp(32.0f) + f3, this.sideStartY + AndroidUtilities.dp(32.0f));
applyServiceShaderMatrix();
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), getThemedPaint(this.sideButtonPressed ? "paintChatActionBackgroundSelected" : "paintChatActionBackground"));
if (hasGradientService()) {
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(16.0f), AndroidUtilities.dp(16.0f), Theme.chat_actionBackgroundGradientDarkenPaint);
}
int i = this.drawSideButton;
if (i == 2) {
Drawable themedDrawable = getThemedDrawable("drawableGoIcon");
BaseCell.setDrawableBounds(themedDrawable, (this.sideStartX + AndroidUtilities.dp(16.0f)) - (themedDrawable.getIntrinsicWidth() / 2.0f), (this.sideStartY + AndroidUtilities.dp(16.0f)) - (themedDrawable.getIntrinsicHeight() / 2.0f));
themedDrawable.draw(canvas);
return;
}
if (i == 4) {
int dp6 = (int) (this.sideStartX + AndroidUtilities.dp(16.0f));
int dp7 = (int) (this.sideStartY + AndroidUtilities.dp(16.0f));
Drawable themedDrawable2 = getThemedDrawable("drawableCloseIcon");
int intrinsicWidth = themedDrawable2.getIntrinsicWidth() / 2;
int intrinsicHeight = themedDrawable2.getIntrinsicHeight() / 2;
themedDrawable2.setBounds(dp6 - intrinsicWidth, dp7 - intrinsicHeight, dp6 + intrinsicWidth, dp7 + intrinsicHeight);
BaseCell.setDrawableBounds(themedDrawable2, this.sideStartX + AndroidUtilities.dp(4.0f), this.sideStartY + AndroidUtilities.dp(4.0f));
canvas.save();
canvas.scale(0.65f, 0.65f, themedDrawable2.getBounds().centerX(), themedDrawable2.getBounds().centerY());
themedDrawable2.draw(canvas);
canvas.restore();
return;
}
int dp8 = (int) (this.sideStartX + AndroidUtilities.dp(16.0f));
int dp9 = (int) (this.sideStartY + AndroidUtilities.dp(16.0f));
Drawable themedDrawable3 = getThemedDrawable("drawableShareIcon");
int intrinsicWidth2 = themedDrawable3.getIntrinsicWidth() / 2;
int intrinsicHeight2 = themedDrawable3.getIntrinsicHeight() / 2;
themedDrawable3.setBounds(dp8 - intrinsicWidth2, dp9 - intrinsicHeight2, dp8 + intrinsicWidth2, dp9 + intrinsicHeight2);
BaseCell.setDrawableBounds(themedDrawable3, this.sideStartX + AndroidUtilities.dp(4.0f), this.sideStartY + AndroidUtilities.dp(4.0f));
themedDrawable3.draw(canvas);
}
}
}
public void setTimeAlpha(float f) {
this.timeAlpha = f;
}
public float getTimeAlpha() {
return this.timeAlpha;
}
public int getBackgroundDrawableLeft() {
int dp;
int dp2;
int i;
MessageObject messageObject = getMessageObject();
if (messageObject != null && messageObject.isOutOwner()) {
if (this.isRoundVideo) {
return (this.layoutWidth - this.backgroundWidth) - ((int) ((1.0f - getVideoTranscriptionProgress()) * AndroidUtilities.dp(9.0f)));
}
return (this.layoutWidth - this.backgroundWidth) - (this.mediaBackground ? AndroidUtilities.dp(9.0f) : 0);
}
if (this.isRoundVideo) {
if ((this.isChat || (messageObject != null && (messageObject.isRepostPreview || messageObject.forceAvatar))) && this.isAvatarVisible) {
r1 = 48;
}
dp = AndroidUtilities.dp(r1 + 3) + ((int) (AndroidUtilities.dp(6.0f) * (1.0f - getVideoTranscriptionProgress())));
} else {
if ((this.isChat || (messageObject != null && (messageObject.isRepostPreview || messageObject.forceAvatar))) && this.isAvatarVisible) {
r1 = 48;
}
dp = AndroidUtilities.dp(r1 + (this.mediaBackground ? 9 : 3));
}
MessageObject.GroupedMessages groupedMessages = this.currentMessagesGroup;
if (groupedMessages != null && !groupedMessages.isDocuments && (i = this.currentPosition.leftSpanOffset) != 0) {
dp += (int) Math.ceil((i / 1000.0f) * getGroupPhotosWidth());
}
if (this.isRoundVideo) {
if (!this.drawPinnedBottom) {
return dp;
}
dp2 = (int) (AndroidUtilities.dp(6.0f) * (1.0f - getVideoTranscriptionProgress()));
} else {
if (this.mediaBackground || !this.drawPinnedBottom) {
return dp;
}
dp2 = AndroidUtilities.dp(6.0f);
}
return dp + dp2;
}
public int getBackgroundDrawableRight() {
int dp;
int backgroundDrawableLeft;
MessageObject messageObject;
MessageObject messageObject2;
int i = this.backgroundWidth;
if (this.isRoundVideo) {
dp = i - ((int) (getVideoTranscriptionProgress() * AndroidUtilities.dp(3.0f)));
if (this.drawPinnedBottom && (messageObject2 = this.currentMessageObject) != null && messageObject2.isOutOwner()) {
dp = (int) (dp - (AndroidUtilities.dp(6.0f) * (1.0f - getVideoTranscriptionProgress())));
}
if (this.drawPinnedBottom && ((messageObject = this.currentMessageObject) == null || !messageObject.isOutOwner())) {
dp = (int) (dp - (AndroidUtilities.dp(6.0f) * (1.0f - getVideoTranscriptionProgress())));
}
backgroundDrawableLeft = getBackgroundDrawableLeft();
} else {
dp = i - (this.mediaBackground ? 0 : AndroidUtilities.dp(3.0f));
if (!this.mediaBackground && this.drawPinnedBottom) {
dp -= AndroidUtilities.dp(6.0f);
}
backgroundDrawableLeft = getBackgroundDrawableLeft();
}
return backgroundDrawableLeft + dp;
}
public int getBackgroundDrawableTop() {
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
int dp = ((groupedMessagePosition == null || (groupedMessagePosition.flags & 4) != 0) ? 0 : 0 - AndroidUtilities.dp(3.0f)) + (this.drawPinnedTop ? 0 : AndroidUtilities.dp(1.0f));
return (this.mediaBackground || !this.drawPinnedTop) ? dp : dp - AndroidUtilities.dp(1.0f);
}
public int getBackgroundDrawableBottom() {
int i;
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
int i2 = 0;
if (groupedMessagePosition != null) {
int i3 = 4;
i = (groupedMessagePosition.flags & 4) == 0 ? AndroidUtilities.dp(3.0f) + 0 : 0;
if ((this.currentPosition.flags & 8) == 0) {
MessageObject messageObject = this.currentMessageObject;
if (messageObject != null && messageObject.isOutOwner()) {
i3 = 3;
}
i += AndroidUtilities.dp(i3);
}
} else {
i = 0;
}
boolean z = this.drawPinnedBottom;
if (!z || !this.drawPinnedTop) {
if (z) {
i2 = AndroidUtilities.dp(1.0f);
} else {
i2 = AndroidUtilities.dp(2.0f);
}
}
int backgroundDrawableTop = ((getBackgroundDrawableTop() + this.layoutHeight) - i2) + i;
if (this.mediaBackground) {
return backgroundDrawableTop;
}
if (this.drawPinnedTop) {
backgroundDrawableTop += AndroidUtilities.dp(1.0f);
}
return this.drawPinnedBottom ? backgroundDrawableTop + AndroidUtilities.dp(1.0f) : backgroundDrawableTop;
}
public void drawBackground(Canvas canvas, int i, int i2, int i3, int i4, boolean z, boolean z2, boolean z3, int i5) {
int i6;
int i7;
Theme.MessageDrawable messageDrawable;
MessageObject messageObject = this.currentMessageObject;
if (messageObject != null && messageObject.isOutOwner()) {
if (!this.mediaBackground && !z2) {
this.currentBackgroundDrawable = (Theme.MessageDrawable) getThemedDrawable(z3 ? "drawableMsgOutSelected" : "drawableMsgOut");
} else {
this.currentBackgroundDrawable = (Theme.MessageDrawable) getThemedDrawable(z3 ? "drawableMsgOutMediaSelected" : "drawableMsgOutMedia");
}
} else if (!this.mediaBackground && !z2) {
this.currentBackgroundDrawable = (Theme.MessageDrawable) getThemedDrawable(z3 ? "drawableMsgInSelected" : "drawableMsgIn");
} else {
this.currentBackgroundDrawable = (Theme.MessageDrawable) getThemedDrawable(z3 ? "drawableMsgInMediaSelected" : "drawableMsgInMedia");
}
int i8 = this.parentWidth;
int i9 = this.parentHeight;
if (i9 == 0) {
i8 = getParentWidth();
i9 = AndroidUtilities.displaySize.y;
if (getParent() instanceof View) {
View view = (View) getParent();
int measuredWidth = view.getMeasuredWidth();
i7 = view.getMeasuredHeight();
i6 = measuredWidth;
messageDrawable = this.currentBackgroundDrawable;
if (messageDrawable != null) {
messageDrawable.setTop(i5, i6, i7, (int) this.parentViewTopOffset, this.blurredViewTopOffset, this.blurredViewBottomOffset, z, z2);
Theme.MessageDrawable messageDrawable2 = this.currentBackgroundDrawable;
MessageObject messageObject2 = this.currentMessageObject;
messageDrawable2.setBotButtonsBottom(messageObject2 != null && messageObject2.hasInlineBotButtons());
Drawable shadowDrawable = this.currentBackgroundDrawable.getShadowDrawable();
if (shadowDrawable != null) {
shadowDrawable.setAlpha((int) (getAlpha() * 255.0f));
shadowDrawable.setBounds(i, i2, i3, i4);
shadowDrawable.draw(canvas);
shadowDrawable.setAlpha(255);
}
this.currentBackgroundDrawable.setAlpha((int) (getAlpha() * 255.0f));
this.currentBackgroundDrawable.setBounds(i, i2, i3, i4);
this.currentBackgroundDrawable.drawCached(canvas, this.backgroundCacheParams);
this.currentBackgroundDrawable.setAlpha(255);
}
animateCheckboxTranslation();
}
}
i6 = i8;
i7 = i9;
messageDrawable = this.currentBackgroundDrawable;
if (messageDrawable != null) {
}
animateCheckboxTranslation();
}
public boolean hasNameLayout() {
if (this.drawNameLayout && this.nameLayout != null) {
return true;
}
if (this.drawForwardedName) {
StaticLayout[] staticLayoutArr = this.forwardedNameLayout;
if (staticLayoutArr[0] != null && staticLayoutArr[1] != null) {
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
if (groupedMessagePosition == null) {
return true;
}
if (groupedMessagePosition.minY == 0 && groupedMessagePosition.minX == 0) {
return true;
}
}
}
return this.replyNameLayout != null || this.drawTopic;
}
public boolean isDrawNameLayout() {
return this.drawNameLayout && this.nameLayout != null;
}
public boolean isDrawTopic() {
return this.drawTopic;
}
public float getDrawTopicHeight() {
if (this.topicButton != null) {
return r0.height();
}
return 0.0f;
}
public boolean isAdminLayoutChanged() {
return !TextUtils.equals(this.lastPostAuthor, this.currentMessageObject.messageOwner.post_author);
}
public void drawNamesLayout(Canvas canvas, float f) {
float f2;
float f3;
int i;
boolean z;
float f4;
Canvas canvas2;
int i2;
int i3;
float f5;
float f6;
float backgroundDrawableRight;
float f7;
float f8;
MessageObject.GroupedMessagePosition groupedMessagePosition;
int parentWidth;
int i4;
boolean z2;
float f9;
float f10;
float f11;
int color;
float f12;
Canvas canvas3;
int i5;
float f13;
float f14;
float f15;
MessageObject messageObject;
TLRPC$Message tLRPC$Message;
int i6;
int i7;
StaticLayout staticLayout;
ChatMessageCellDelegate chatMessageCellDelegate;
float f16;
MessageObject.GroupedMessagePosition groupedMessagePosition2;
int dp;
int extraTextX;
int i8;
float dp2;
float dp3;
TransitionParams transitionParams;
int dp4;
float f17;
MessageObject.GroupedMessagePosition groupedMessagePosition3;
float f18;
int i9;
int alpha;
int i10;
float f19;
MessageTopicButton messageTopicButton;
float f20;
float f21;
boolean z3;
int i11;
float f22;
long peerDialogId;
int colorId;
TLRPC$MessageFwdHeader tLRPC$MessageFwdHeader;
MessageTopicButton messageTopicButton2;
TLRPC$User tLRPC$User;
TLRPC$ChatInvite tLRPC$ChatInvite;
TLRPC$Chat tLRPC$Chat;
TLRPC$ChatInvite tLRPC$ChatInvite2;
float f23;
MessageObject.GroupedMessages groupedMessages;
int i12;
int i13;
int dp5;
float f24;
int themedColor;
int i14;
float f25;
MessageObject.GroupedMessages groupedMessages2;
long elapsedRealtime = SystemClock.elapsedRealtime();
long j = elapsedRealtime - this.lastNamesAnimationTime;
if (j > 17) {
j = 17;
}
this.lastNamesAnimationTime = elapsedRealtime;
if (this.currentMessageObject.deleted && !this.drawingToBitmap && (groupedMessages2 = this.currentMessagesGroup) != null && groupedMessages2.messages.size() >= 1) {
return;
}
int i15 = Integer.MIN_VALUE;
if (f != 1.0f) {
this.rect.set(0.0f, 0.0f, getMaxNameWidth(), getMeasuredHeight());
i15 = canvas.saveLayerAlpha(this.rect, (int) (255.0f * f), 31);
}
int i16 = i15;
if (!this.isRoundVideo || this.hasLinkPreview) {
f2 = 1.0f;
} else {
float videoTranscriptionProgress = (1.0f - getVideoTranscriptionProgress()) * 1.0f;
TransitionParams transitionParams2 = this.transitionParams;
if (transitionParams2.animatePlayingRound) {
if (this.isPlayingRound) {
f25 = 1.0f - transitionParams2.animateChangeProgress;
} else {
f25 = transitionParams2.animateChangeProgress;
}
videoTranscriptionProgress *= f25;
} else if (this.isPlayingRound) {
f2 = 0.0f;
}
f2 = videoTranscriptionProgress;
}
float f26 = 11.0f;
if (this.drawNameLayout && this.nameLayout != null) {
canvas.save();
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
Theme.chat_namePaint.setColor(getThemedColor(Theme.key_chat_stickerNameText));
if (this.currentMessageObject.isOutOwner()) {
this.nameX = AndroidUtilities.dp(28.0f);
} else {
this.nameX = this.backgroundDrawableLeft + this.transitionParams.deltaLeft + this.backgroundDrawableRight + AndroidUtilities.dp(22.0f);
}
this.nameY = this.layoutHeight - AndroidUtilities.dp(38.0f);
float f27 = (this.currentMessageObject.isOut() && (this.checkBoxVisible || this.checkBoxAnimationInProgress)) ? 1.0f - this.checkBoxAnimationProgress : 1.0f;
this.rect.set(((int) this.nameX) - AndroidUtilities.dp(12.0f), ((int) this.nameY) - AndroidUtilities.dp(5.0f), ((int) this.nameX) + AndroidUtilities.dp(12.0f) + this.nameWidth, ((int) this.nameY) + AndroidUtilities.dp(22.0f));
applyServiceShaderMatrix();
int alpha2 = getThemedPaint("paintChatActionBackground").getAlpha();
getThemedPaint("paintChatActionBackground").setAlpha((int) (alpha2 * f27 * f2));
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(6.0f), AndroidUtilities.dp(6.0f), getThemedPaint("paintChatActionBackground"));
if (hasGradientService()) {
int alpha3 = Theme.chat_actionBackgroundGradientDarkenPaint.getAlpha();
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha((int) (alpha3 * this.timeAlpha * f2));
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(6.0f), AndroidUtilities.dp(6.0f), Theme.chat_actionBackgroundGradientDarkenPaint);
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha(alpha3);
}
if (this.viaSpan1 != null || this.viaSpan2 != null) {
int alpha4 = (((int) (Color.alpha(getThemedColor(r5)) * f27)) << 24) | (getThemedColor(Theme.key_chat_stickerViaBotNameText) & 16777215);
TypefaceSpan typefaceSpan = this.viaSpan1;
if (typefaceSpan != null) {
typefaceSpan.setColor(alpha4);
}
TypefaceSpan typefaceSpan2 = this.viaSpan2;
if (typefaceSpan2 != null) {
typefaceSpan2.setColor(alpha4);
}
}
this.nameX -= this.nameOffsetX;
getThemedPaint("paintChatActionBackground").setAlpha(alpha2);
} else {
if (this.mediaBackground || this.currentMessageObject.isOutOwner()) {
this.nameX = (((this.backgroundDrawableLeft + this.transitionParams.deltaLeft) + AndroidUtilities.dp(11.0f)) - this.nameOffsetX) + getExtraTextX();
} else {
this.nameX = (((this.backgroundDrawableLeft + this.transitionParams.deltaLeft) + AndroidUtilities.dp((this.mediaBackground || !this.drawPinnedBottom) ? 17.0f : 11.0f)) - this.nameOffsetX) + getExtraTextX();
}
if (this.currentMessageObject.isOutOwner() && ChatObject.isChannel(this.currentChat)) {
Theme.MessageDrawable messageDrawable = this.currentBackgroundDrawable;
if (messageDrawable != null && messageDrawable.hasGradient()) {
Theme.chat_namePaint.setColor(getThemedColor(Theme.key_chat_messageTextOut));
} else {
Theme.chat_namePaint.setColor(getThemedColor(Theme.key_chat_outForwardedNameText));
}
} else if (this.currentMessageObject.isOutOwner()) {
Theme.chat_namePaint.setColor(getThemedColor(Theme.key_chat_outForwardedNameText));
} else {
MessageObject messageObject2 = this.currentMessageObject;
if (messageObject2.overrideLinkColor >= 0 || ((messageObject2.isFromUser() && this.currentUser != null) || ((this.currentMessageObject.isFromChannel() && this.currentChat != null) || ((this.currentMessageObject.isSponsored() && (this.currentMessageObject.sponsoredChatInvite instanceof TLRPC$TL_chatInvite)) || (this.currentMessageObject.isSponsored() && (tLRPC$ChatInvite2 = this.currentMessageObject.sponsoredChatInvite) != null && tLRPC$ChatInvite2.chat != null))))) {
MessageObject messageObject3 = this.currentMessageObject;
int i17 = messageObject3.overrideLinkColor;
if (i17 < 0) {
if (messageObject3.isSponsored()) {
TLRPC$ChatInvite tLRPC$ChatInvite3 = this.currentMessageObject.sponsoredChatInvite;
if (tLRPC$ChatInvite3 instanceof TLRPC$TL_chatInvite) {
i17 = tLRPC$ChatInvite3.color;
}
}
if (this.currentMessageObject.isSponsored() && (tLRPC$ChatInvite = this.currentMessageObject.sponsoredChatInvite) != null && (tLRPC$Chat = tLRPC$ChatInvite.chat) != null) {
i17 = ChatObject.getColorId(tLRPC$Chat);
} else if (this.currentMessageObject.isFromUser() && (tLRPC$User = this.currentUser) != null) {
i17 = UserObject.getColorId(tLRPC$User);
} else {
i17 = ChatObject.getColorId(this.currentChat);
}
}
if (i17 < 7) {
Theme.chat_namePaint.setColor(getThemedColor(Theme.keys_avatar_nameInMessage[i17]));
} else {
MessagesController.PeerColors peerColors = MessagesController.getInstance(this.currentAccount).peerColors;
MessagesController.PeerColor color2 = peerColors != null ? peerColors.getColor(i17) : null;
if (color2 != null) {
Theme.chat_namePaint.setColor(color2.getColor(0, this.resourcesProvider));
} else {
Theme.chat_namePaint.setColor(getThemedColor(Theme.key_chat_inForwardedNameText));
}
}
} else {
Theme.chat_namePaint.setColor(getThemedColor(Theme.key_chat_inForwardedNameText));
}
}
this.nameY = AndroidUtilities.dp(this.drawPinnedTop ? 9.0f : 10.0f);
if (this.viaSpan1 != null || this.viaSpan2 != null) {
int themedColor2 = getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outViaBotNameText : Theme.key_chat_inViaBotNameText);
TypefaceSpan typefaceSpan3 = this.viaSpan1;
if (typefaceSpan3 != null) {
typefaceSpan3.setColor(themedColor2);
}
TypefaceSpan typefaceSpan4 = this.viaSpan2;
if (typefaceSpan4 != null) {
typefaceSpan4.setColor(themedColor2);
}
}
}
MessageObject.GroupedMessages groupedMessages3 = this.currentMessagesGroup;
if (groupedMessages3 != null) {
MessageObject.GroupedMessages.TransitionParams transitionParams3 = groupedMessages3.transitionParams;
if (transitionParams3.backgroundChangeBounds) {
this.nameX += transitionParams3.offsetLeft;
this.nameY += transitionParams3.offsetTop - getTranslationY();
}
}
this.nameX += this.animationOffsetX;
float f28 = this.nameY;
TransitionParams transitionParams4 = this.transitionParams;
this.nameY = f28 + transitionParams4.deltaTop;
if (!transitionParams4.animateSign) {
f23 = this.nameX;
} else {
f23 = this.transitionParams.animateNameX + ((this.nameX - this.transitionParams.animateNameX) * this.transitionParams.animateChangeProgress);
}
if (!this.currentMessageObject.isSponsored()) {
int multAlpha = Theme.multAlpha(Theme.chat_namePaint.getColor(), 0.12f);
Drawable drawable = this.nameLayoutSelector;
if (drawable == null) {
this.nameLayoutSelectorColor = multAlpha;
Drawable createRadSelectorDrawable = Theme.createRadSelectorDrawable(multAlpha, 6, 6);
this.nameLayoutSelector = createRadSelectorDrawable;
createRadSelectorDrawable.setCallback(this);
} else if (this.nameLayoutSelectorColor != multAlpha) {
this.nameLayoutSelectorColor = multAlpha;
Theme.setSelectorDrawableColor(drawable, multAlpha, true);
}
this.nameLayoutSelector.setBounds((int) (f23 - AndroidUtilities.dp(4.0f)), (int) (this.nameY - AndroidUtilities.dp(1.33f)), (int) ((this.viaNameWidth > 0 ? r11 - AndroidUtilities.dp(32.0f) : this.nameLayoutWidth) + f23 + AndroidUtilities.dp(4.0f)), (int) (this.nameY + this.nameLayout.getHeight() + AndroidUtilities.dp(1.33f)));
this.nameLayoutSelector.draw(canvas);
if (this.currentNameStatus != null) {
Drawable drawable2 = this.nameStatusSelector;
if (drawable2 == null) {
this.nameStatusSelectorColor = multAlpha;
Drawable createRadSelectorDrawable2 = Theme.createRadSelectorDrawable(multAlpha, 6, 6);
this.nameStatusSelector = createRadSelectorDrawable2;
createRadSelectorDrawable2.setCallback(this);
} else if (this.nameStatusSelectorColor != multAlpha) {
this.nameStatusSelectorColor = multAlpha;
Theme.setSelectorDrawableColor(drawable2, multAlpha, true);
}
this.nameStatusSelector.setBounds((int) ((this.viaNameWidth > 0 ? r5 - AndroidUtilities.dp(32.0f) : this.nameLayoutWidth) + f23), (int) (this.nameY - AndroidUtilities.dp(3.33f)), (int) ((this.viaNameWidth > 0 ? r10 - AndroidUtilities.dp(32.0f) : this.nameLayoutWidth) + f23 + AndroidUtilities.dp(24.0f)), (int) (this.nameY + this.nameLayout.getHeight() + AndroidUtilities.dp(3.33f)));
this.nameStatusSelector.draw(canvas);
canvas.translate(f23, this.nameY);
this.nameLayout.draw(canvas);
canvas.restore();
groupedMessages = this.currentMessagesGroup;
if (groupedMessages == null && !groupedMessages.isDocuments) {
int groupPhotosWidth = getGroupPhotosWidth();
int i18 = 0;
for (int i19 = 0; i19 < this.currentMessagesGroup.posArray.size(); i19++) {
if (this.currentMessagesGroup.posArray.get(i19).minY != 0) {
break;
}
i18 = (int) (i18 + Math.ceil(((r8.pw + r8.leftSpanOffset) / 1000.0f) * groupPhotosWidth));
}
if (!this.mediaBackground && this.currentMessageObject.isOutOwner()) {
i14 = (this.backgroundDrawableLeft + i18) - AndroidUtilities.dp(6.0f);
} else {
i14 = this.backgroundDrawableLeft + i18;
}
f24 = i14 - (getExtraTextX() + AndroidUtilities.dp(8.0f));
if (!this.currentMessageObject.isOutOwner()) {
f24 -= AndroidUtilities.dp(48.0f);
}
} else {
if (!this.currentMessageObject.shouldDrawWithoutBackground()) {
if (this.currentMessageObject.isOutOwner()) {
i12 = AndroidUtilities.dp(39.0f);
i13 = this.nameWidth;
} else {
f24 = this.backgroundDrawableLeft + this.transitionParams.deltaLeft + this.backgroundDrawableRight + AndroidUtilities.dp(33.0f) + this.nameWidth;
}
} else if (!this.mediaBackground && this.currentMessageObject.isOutOwner()) {
dp5 = (this.backgroundDrawableLeft + this.backgroundDrawableRight) - AndroidUtilities.dp(6.0f);
f24 = dp5;
} else {
i12 = this.backgroundDrawableLeft;
i13 = this.backgroundDrawableRight;
}
dp5 = i12 + i13;
f24 = dp5;
}
float f29 = f24 + this.transitionParams.deltaRight;
if (this.adminLayout != null) {
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
themedColor = getThemedColor(Theme.key_chat_stickerReplyNameText);
} else if (this.currentMessageObject.isOutOwner()) {
themedColor = getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outAdminSelectedText : Theme.key_chat_outAdminText);
} else {
themedColor = getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inAdminSelectedText : Theme.key_chat_inAdminText);
}
Theme.chat_adminPaint.setColor(themedColor);
canvas.save();
canvas.translate((f29 - AndroidUtilities.dp(11.0f)) - this.adminLayout.getLineWidth(0), this.nameY + AndroidUtilities.dp(0.5f));
if (this.transitionParams.animateSign) {
Theme.chat_adminPaint.setAlpha((int) (Color.alpha(themedColor) * this.transitionParams.animateChangeProgress));
}
this.adminLayout.draw(canvas);
canvas.restore();
}
}
}
canvas.translate(f23, this.nameY);
this.nameLayout.draw(canvas);
canvas.restore();
groupedMessages = this.currentMessagesGroup;
if (groupedMessages == null) {
}
if (!this.currentMessageObject.shouldDrawWithoutBackground()) {
}
dp5 = i12 + i13;
f24 = dp5;
float f292 = f24 + this.transitionParams.deltaRight;
if (this.adminLayout != null) {
}
}
boolean z4 = this.drawForwardedName || this.currentMessageObject.type == 23;
boolean z5 = this.replyNameLayout != null;
StaticLayout[] staticLayoutArr = this.forwardedNameLayout;
int i20 = this.forwardedNameWidth;
if (!this.transitionParams.animateForwardedLayout) {
f3 = 1.0f;
} else if (!this.currentMessageObject.needDrawForwarded()) {
TransitionParams transitionParams5 = this.transitionParams;
staticLayoutArr = transitionParams5.animatingForwardedNameLayout;
f3 = 1.0f - transitionParams5.animateChangeProgress;
i20 = transitionParams5.animateForwardNameWidth;
z4 = true;
} else {
f3 = this.transitionParams.animateChangeProgress;
}
if (!z4 || staticLayoutArr[0] == null || staticLayoutArr[1] == null || !((groupedMessagePosition3 = this.currentPosition) == null || (groupedMessagePosition3.minY == 0 && groupedMessagePosition3.minX == 0))) {
i = -1;
z = true;
f4 = 0.0f;
} else {
MessageObject messageObject4 = this.currentMessageObject;
if (messageObject4.type == 5 || messageObject4.isAnyKindOfSticker()) {
Theme.chat_forwardNamePaint.setColor(getThemedColor(Theme.key_chat_stickerReplyNameText));
MessageObject messageObject5 = this.currentMessageObject;
if (messageObject5.type == 19) {
if (messageObject5.isOutOwner()) {
if (this.currentMessageObject.needDrawForwarded()) {
float dp6 = this.backgroundDrawableLeft + AndroidUtilities.dp(11.0f) + getExtraTextX();
this.forwardNameX = dp6;
f21 = dp6 + this.transitionParams.deltaLeft;
} else {
f21 = this.transitionParams.animateForwardNameX;
}
f20 = f21 - Math.max(0.0f, (Math.max(AndroidUtilities.dp(14.0f) + i20, z5 ? Math.max(this.replyNameWidth, this.replyTextWidth) + AndroidUtilities.dp(14.0f) : 0) + f21) - AndroidUtilities.displaySize.x);
} else if (this.currentMessageObject.needDrawForwarded()) {
int i21 = this.backgroundDrawableLeft;
if (!this.mediaBackground && !this.drawPinnedBottom) {
f26 = 17.0f;
}
f20 = i21 + AndroidUtilities.dp(f26) + getExtraTextX();
this.forwardNameX = f20;
} else {
f20 = this.transitionParams.animateForwardNameX;
}
f18 = f20 - AndroidUtilities.dp(7.0f);
} else if (messageObject5.needDrawForwarded()) {
if (this.currentMessageObject.isOutOwner()) {
f18 = AndroidUtilities.dp(23.0f);
this.forwardNameX = f18;
} else {
f18 = this.backgroundDrawableLeft + this.backgroundDrawableRight + AndroidUtilities.dp(17.0f);
this.forwardNameX = f18;
}
} else {
f18 = this.transitionParams.animateForwardNameX;
}
if (!this.currentMessageObject.isVoiceTranscriptionOpen() && ((this.currentMessageObject.isOutOwner() && this.currentMessageObject.type == 5 && this.transitionParams.animatePlayingRound) || this.isPlayingRound)) {
f18 -= AndroidUtilities.dp(78.0f) * (this.isPlayingRound ? this.transitionParams.animateChangeProgress : 1.0f - this.transitionParams.animateChangeProgress);
}
this.forwardNameY = AndroidUtilities.dp(12.0f) + ((!this.drawTopic || (messageTopicButton = this.topicButton) == null) ? 0 : messageTopicButton.height() + AndroidUtilities.dp(14.0f));
this.forwardHeight = AndroidUtilities.dp(4.0f) + (((int) Theme.chat_forwardNamePaint.getTextSize()) * 2);
int dp7 = i20 + AndroidUtilities.dp(14.0f);
if (z5) {
int max = Math.max(this.replyNameWidth, this.replyTextWidth) - AndroidUtilities.dp(4.0f);
RectF rectF = this.rect;
int i22 = (int) f18;
float dp8 = i22 - AndroidUtilities.dp(7.0f);
float dp9 = this.forwardNameY - AndroidUtilities.dp(6.0f);
int max2 = Math.max(dp7, max) + (i22 - AndroidUtilities.dp(7.0f));
i9 = max2;
rectF.set(dp8, dp9, max2, this.forwardNameY + this.forwardHeight + AndroidUtilities.dp(6.0f) + AndroidUtilities.dp(41.0f));
z = false;
} else {
int i23 = (int) f18;
this.rect.set(i23 - AndroidUtilities.dp(7.0f), this.forwardNameY - AndroidUtilities.dp(6.0f), (i23 - AndroidUtilities.dp(7.0f)) + dp7, this.forwardNameY + this.forwardHeight + AndroidUtilities.dp(6.0f));
z = true;
i9 = -1;
}
applyServiceShaderMatrix();
if (f3 == 1.0f && f2 == 1.0f) {
alpha = -1;
} else {
alpha = getThemedPaint("paintChatActionBackground").getAlpha();
getThemedPaint("paintChatActionBackground").setAlpha((int) (alpha * f3 * f2));
}
float f30 = f18;
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(6.0f), AndroidUtilities.dp(6.0f), getThemedPaint("paintChatActionBackground"));
if (hasGradientService()) {
if (f3 == 1.0f && f2 == 1.0f) {
i10 = -1;
} else {
i10 = Theme.chat_actionBackgroundGradientDarkenPaint.getAlpha();
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha((int) (i10 * f3 * f2));
}
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(6.0f), AndroidUtilities.dp(6.0f), Theme.chat_actionBackgroundGradientDarkenPaint);
} else {
i10 = -1;
}
if (alpha >= 0) {
getThemedPaint("paintChatActionBackground").setAlpha(alpha);
}
if (i10 >= 0) {
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha(i10);
}
f19 = f30;
} else {
this.forwardNameY = AndroidUtilities.dp(10.0f) + (this.drawNameLayout ? AndroidUtilities.dp(5.0f) + ((int) Theme.chat_namePaint.getTextSize()) : 0) + ((!this.drawTopic || (messageTopicButton2 = this.topicButton) == null) ? 0 : messageTopicButton2.height() + AndroidUtilities.dp((this.currentMessageObject.type != 0 ? 3 : 0) + 7));
this.forwardHeight = AndroidUtilities.dp(4.0f) + (((int) Theme.chat_forwardNamePaint.getTextSize()) * 2);
Theme.chat_forwardNamePaint.setColor(getThemedColor(this.hasPsaHint ? Theme.key_chat_inPsaNameText : Theme.key_chat_inForwardedNameText));
if (this.currentMessageObject.isOutOwner()) {
Theme.chat_forwardNamePaint.setColor(getThemedColor(this.hasPsaHint ? Theme.key_chat_outPsaNameText : Theme.key_chat_outForwardedNameText));
} else if (!this.hasPsaHint) {
MessageObject messageObject6 = this.currentMessageObject;
if (messageObject6.messageOwner != null && (messageObject6.isStoryMedia() || ((tLRPC$MessageFwdHeader = this.currentMessageObject.messageOwner.fwd_from) != null && tLRPC$MessageFwdHeader.from_id != null))) {
if (this.currentMessageObject.isStoryMedia()) {
peerDialogId = DialogObject.getPeerDialogId(MessageObject.getMedia(this.currentMessageObject).peer);
} else {
peerDialogId = DialogObject.getPeerDialogId(this.currentMessageObject.messageOwner.fwd_from.from_id);
}
long j2 = peerDialogId;
if (j2 < 0) {
TLRPC$Chat chat = MessagesController.getInstance(this.currentAccount).getChat(Long.valueOf(-j2));
if (chat != null) {
colorId = ChatObject.getColorId(chat);
if (colorId >= 7) {
Theme.chat_forwardNamePaint.setColor(getThemedColor(Theme.keys_avatar_nameInMessage[colorId]));
} else {
MessagesController.PeerColors peerColors2 = MessagesController.getInstance(this.currentAccount).peerColors;
MessagesController.PeerColor color3 = peerColors2 != null ? peerColors2.getColor(colorId) : null;
if (color3 != null) {
Theme.chat_forwardNamePaint.setColor(color3.getColor(0, this.resourcesProvider));
}
}
}
colorId = 5;
if (colorId >= 7) {
}
} else {
TLRPC$User user = MessagesController.getInstance(this.currentAccount).getUser(Long.valueOf(j2));
if (user != null) {
colorId = UserObject.getColorId(user);
if (colorId >= 7) {
}
}
colorId = 5;
if (colorId >= 7) {
}
}
}
}
if (this.currentMessageObject.isOutOwner()) {
if (this.currentMessageObject.needDrawForwarded()) {
float dp10 = this.backgroundDrawableLeft + AndroidUtilities.dp(11.0f) + getExtraTextX();
this.forwardNameX = dp10;
f19 = dp10 + this.transitionParams.deltaLeft;
} else {
f19 = this.transitionParams.animateForwardNameX;
}
} else if (this.currentMessageObject.needDrawForwarded()) {
int i24 = this.backgroundDrawableLeft;
if (!this.mediaBackground && !this.drawPinnedBottom) {
f26 = 17.0f;
}
f19 = i24 + AndroidUtilities.dp(f26) + getExtraTextX();
this.forwardNameX = f19;
} else {
f19 = this.transitionParams.animateForwardNameX;
}
z = true;
i9 = -1;
}
if (this.transitionParams.animateForwardedLayout && this.currentBackgroundDrawable != null && this.currentMessagesGroup == null) {
MessageObject messageObject7 = this.currentMessageObject;
if (messageObject7.type != 5 && !messageObject7.isAnyKindOfSticker()) {
Rect bounds = this.currentBackgroundDrawable.getBounds();
canvas.save();
if (this.currentMessageObject.isOutOwner() && !this.mediaBackground && !this.pinnedBottom) {
canvas.clipRect(bounds.left + AndroidUtilities.dp(4.0f), bounds.top + AndroidUtilities.dp(4.0f), bounds.right - AndroidUtilities.dp(10.0f), bounds.bottom - AndroidUtilities.dp(4.0f));
} else {
canvas.clipRect(bounds.left + AndroidUtilities.dp(4.0f), bounds.top + AndroidUtilities.dp(4.0f), bounds.right - AndroidUtilities.dp(4.0f), bounds.bottom - AndroidUtilities.dp(4.0f));
}
z3 = true;
i11 = 0;
while (i11 < 2) {
canvas.save();
float f31 = f19;
canvas.translate(f19 - this.forwardNameOffsetX[i11], this.forwardNameY + (((this.forwardHeight / 2.0f) + 2.0f) * i11));
if (f3 != 1.0f || f2 != 1.0f) {
int alpha5 = staticLayoutArr[i11].getPaint().getAlpha();
staticLayoutArr[i11].getPaint().setAlpha((int) (alpha5 * f3 * f2));
staticLayoutArr[i11].draw(canvas);
staticLayoutArr[i11].getPaint().setAlpha(alpha5);
} else {
staticLayoutArr[i11].draw(canvas);
}
canvas.restore();
i11++;
f19 = f31;
}
f4 = f19;
if (z3) {
canvas.restore();
}
if (this.hasPsaHint) {
if (this.psaButtonVisible || this.psaButtonProgress > 0.0f) {
Drawable drawable3 = Theme.chat_psaHelpDrawable[this.currentMessageObject.isOutOwner() ? 1 : 0];
int intrinsicWidth = this.psaHelpX + (drawable3.getIntrinsicWidth() / 2);
int intrinsicHeight = this.psaHelpY + (drawable3.getIntrinsicHeight() / 2);
if (this.psaButtonVisible) {
float f32 = this.psaButtonProgress;
if (f32 < 1.0f) {
f22 = AnimationProperties.overshootInterpolator.getInterpolation(f32);
int intrinsicWidth2 = ((int) (drawable3.getIntrinsicWidth() * f22)) / 2;
int intrinsicHeight2 = ((int) (drawable3.getIntrinsicHeight() * f22)) / 2;
drawable3.setBounds(intrinsicWidth - intrinsicWidth2, intrinsicHeight - intrinsicHeight2, intrinsicWidth + intrinsicWidth2, intrinsicHeight + intrinsicHeight2);
drawable3.draw(canvas);
if (Build.VERSION.SDK_INT >= 21 && this.selectorDrawable[0] != null && this.selectorDrawableMaskType[0] == 3) {
canvas.save();
float f33 = this.psaButtonProgress;
canvas.scale(f33, f33, this.selectorDrawable[0].getBounds().centerX(), this.selectorDrawable[0].getBounds().centerY());
this.selectorDrawable[0].draw(canvas);
canvas.restore();
}
}
}
f22 = this.psaButtonProgress;
int intrinsicWidth22 = ((int) (drawable3.getIntrinsicWidth() * f22)) / 2;
int intrinsicHeight22 = ((int) (drawable3.getIntrinsicHeight() * f22)) / 2;
drawable3.setBounds(intrinsicWidth - intrinsicWidth22, intrinsicHeight - intrinsicHeight22, intrinsicWidth + intrinsicWidth22, intrinsicHeight + intrinsicHeight22);
drawable3.draw(canvas);
if (Build.VERSION.SDK_INT >= 21) {
canvas.save();
float f332 = this.psaButtonProgress;
canvas.scale(f332, f332, this.selectorDrawable[0].getBounds().centerX(), this.selectorDrawable[0].getBounds().centerY());
this.selectorDrawable[0].draw(canvas);
canvas.restore();
}
}
boolean z6 = this.psaButtonVisible;
if (z6) {
float f34 = this.psaButtonProgress;
if (f34 < 1.0f) {
this.psaButtonProgress = f34 + (((float) j) / 180.0f);
invalidate();
if (this.psaButtonProgress > 1.0f) {
this.psaButtonProgress = 1.0f;
setInvalidatesParent(false);
}
}
}
if (!z6) {
float f35 = this.psaButtonProgress;
if (f35 > 0.0f) {
this.psaButtonProgress = f35 - (((float) j) / 180.0f);
invalidate();
if (this.psaButtonProgress < 0.0f) {
this.psaButtonProgress = 0.0f;
setInvalidatesParent(false);
}
}
}
}
i = i9;
}
}
z3 = false;
i11 = 0;
while (i11 < 2) {
}
f4 = f19;
if (z3) {
}
if (this.hasPsaHint) {
}
i = i9;
}
if (this.drawTopic && this.topicButton != null && f3 > 0.0f && f2 > 0.0f && ((groupedMessagePosition2 = this.currentPosition) == null || (groupedMessagePosition2.minY == 0 && groupedMessagePosition2.minX == 0))) {
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
MessageObject messageObject8 = this.currentMessageObject;
if (messageObject8.type != 19) {
if (messageObject8.isOutOwner()) {
f17 = AndroidUtilities.dp(23.0f);
if (this.isPlayingRound) {
f17 -= AndroidUtilities.roundPlayingMessageSize - AndroidUtilities.roundMessageSize;
}
} else {
if (this.currentMessageObject.type == 5) {
dp4 = this.backgroundDrawableLeft + this.backgroundDrawableRight + AndroidUtilities.dp(4.0f);
} else {
dp4 = this.backgroundDrawableLeft + this.backgroundDrawableRight + AndroidUtilities.dp(17.0f);
}
f17 = dp4;
}
dp3 = AndroidUtilities.dp(12.0f);
dp2 = f17 - AndroidUtilities.dp(8.0f);
transitionParams = this.transitionParams;
if (transitionParams.animateBackgroundBoundsInner) {
dp2 += transitionParams.deltaLeft;
}
this.topicButton.draw(canvas, dp2, dp3, f3 * f2);
}
}
if (this.currentMessageObject.isOutOwner()) {
i8 = this.backgroundDrawableLeft + AndroidUtilities.dp(12.0f) + getExtraTextX();
} else {
if (this.mediaBackground) {
dp = this.backgroundDrawableLeft + AndroidUtilities.dp(12.0f);
extraTextX = getExtraTextX();
} else {
dp = this.backgroundDrawableLeft + AndroidUtilities.dp(this.drawPinnedBottom ? 12.0f : 18.0f);
extraTextX = getExtraTextX();
}
i8 = dp + extraTextX;
}
dp2 = i8 - AndroidUtilities.dp(2.33f);
dp3 = AndroidUtilities.dp(12.0f) + ((!this.drawNameLayout || this.nameLayout == null) ? 0 : AndroidUtilities.dp(6.0f) + ((int) Theme.chat_namePaint.getTextSize()));
transitionParams = this.transitionParams;
if (transitionParams.animateBackgroundBoundsInner) {
}
this.topicButton.draw(canvas, dp2, dp3, f3 * f2);
}
if (z5) {
float f36 = this.replyStartX;
float f37 = this.replyStartY;
MessageObject.GroupedMessages groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
MessageObject.GroupedMessages.TransitionParams transitionParams6 = groupedMessages4.transitionParams;
if (transitionParams6.backgroundChangeBounds) {
f36 += transitionParams6.offsetLeft;
}
}
TransitionParams transitionParams7 = this.transitionParams;
if (transitionParams7.animateBackgroundBoundsInner) {
if (this.isRoundVideo) {
f16 = (this.currentMessageObject.isOutOwner() ? 0.0f : this.transitionParams.deltaLeft) + this.transitionParams.deltaRight;
} else {
f16 = transitionParams7.deltaLeft;
}
f36 += f16;
TransitionParams transitionParams8 = this.transitionParams;
f37 = AndroidUtilities.lerp(transitionParams8.animateFromReplyY, this.replyStartY, transitionParams8.animateChangeProgress);
}
float f38 = f37;
float f39 = !z ? f4 : f36;
boolean z7 = (this.currentMessageObject == null || (chatMessageCellDelegate = this.delegate) == null || !chatMessageCellDelegate.isProgressLoading(this, 0)) ? false : true;
if (this.replyPressedFloat == null) {
this.replyPressedFloat = new AnimatedFloat(this);
}
float f40 = this.replyPressedFloat.set((this.replySelectorPressed || z7) ? 1.0f : 0.0f);
if (this.replyLine == null) {
this.replyLine = new ReplyMessageLine(this);
}
Theme.chat_replyNamePaint.setColor(this.replyLine.check(this.currentMessageObject, this.currentUser, this.currentChat, this.resourcesProvider, 0));
int alphaComponent = ColorUtils.setAlphaComponent(this.replyLine.getColor(), 30);
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
Theme.chat_replyLinePaint.setColor(getThemedColor(Theme.key_chat_stickerReplyLine));
Theme.chat_replyLinePaint.setAlpha((int) (Theme.chat_replyLinePaint.getAlpha() * this.timeAlpha * f2));
alphaComponent = ColorUtils.setAlphaComponent(Theme.chat_replyLinePaint.getColor(), Color.alpha(alphaComponent));
Theme.chat_replyNamePaint.setColor(getThemedColor(Theme.key_chat_stickerReplyNameText));
Theme.chat_replyNamePaint.setAlpha((int) (Theme.chat_replyNamePaint.getAlpha() * this.timeAlpha * f2));
Theme.chat_replyTextPaint.setColor(getThemedColor(Theme.key_chat_stickerReplyMessageText));
Theme.chat_replyTextPaint.setAlpha((int) (Theme.chat_replyTextPaint.getAlpha() * this.timeAlpha * f2));
if (z) {
if (this.replyBounce == null) {
this.replyBounce = new ButtonBounce(this, 2.0f, 2.0f);
}
canvas.save();
float scale = this.replyBounce.getScale(0.0125f);
int i25 = (int) f39;
this.rect.set(i25 - AndroidUtilities.dp(7.0f), f38 - AndroidUtilities.dp(3.0f), (i25 - AndroidUtilities.dp(4.0f)) + Math.max(this.replyNameWidth, this.replyTextWidth), f38 + AndroidUtilities.dp(3.0f) + this.replyHeight);
float f41 = this.replyBounceX;
RectF rectF2 = this.rect;
float clamp = Utilities.clamp(f41, rectF2.right, rectF2.left);
float f42 = this.replyBounceY;
RectF rectF3 = this.rect;
canvas.scale(scale, scale, clamp, Utilities.clamp(f42, rectF3.bottom, rectF3.top));
applyServiceShaderMatrix();
int alpha6 = getThemedPaint("paintChatActionBackground").getAlpha();
getThemedPaint("paintChatActionBackground").setAlpha((int) (alpha6 * this.timeAlpha * f2));
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(4.0f), getThemedPaint("paintChatActionBackground"));
getThemedPaint("paintChatActionBackground").setAlpha(alpha6);
if (hasGradientService()) {
int alpha7 = Theme.chat_actionBackgroundGradientDarkenPaint.getAlpha();
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha((int) (alpha7 * this.timeAlpha * f2));
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(4.0f), AndroidUtilities.dp(4.0f), Theme.chat_actionBackgroundGradientDarkenPaint);
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha(alpha7);
}
canvas.restore();
}
} else if (this.currentMessageObject.isOutOwner()) {
if (this.currentMessageObject.isReplyToStory()) {
Theme.chat_replyTextPaint.setColor(Theme.chat_replyNamePaint.getColor());
} else {
int themedColor3 = getThemedColor(Theme.key_chat_outReplyMessageText);
MessageObject messageObject9 = this.currentMessageObject;
if (!messageObject9.forceAvatar) {
if (messageObject9.hasValidReplyMessageObject()) {
MessageObject messageObject10 = this.currentMessageObject.replyMessageObject;
if (messageObject10.contentType != 1) {
}
}
if (!this.hasReplyQuote) {
themedColor3 = getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outReplyMediaMessageSelectedText : Theme.key_chat_outReplyMediaMessageText);
f40 = (f40 * 0.4f) + 0.6f;
}
}
Theme.chat_replyTextPaint.setColor(ColorUtils.blendARGB(themedColor3, Theme.adaptHue(themedColor3, Theme.chat_replyNamePaint.getColor()), f40));
}
} else if (this.currentMessageObject.isReplyToStory()) {
Theme.chat_replyTextPaint.setColor(Theme.chat_replyNamePaint.getColor());
} else {
int themedColor4 = getThemedColor(Theme.key_chat_inReplyMessageText);
MessageObject messageObject11 = this.currentMessageObject;
if (!messageObject11.forceAvatar) {
if (messageObject11.hasValidReplyMessageObject()) {
MessageObject messageObject12 = this.currentMessageObject.replyMessageObject;
if (messageObject12.contentType != 1) {
}
}
if (!this.hasReplyQuote) {
themedColor4 = getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inReplyMediaMessageSelectedText : Theme.key_chat_inReplyMediaMessageText);
f40 = (f40 * 0.4f) + 0.6f;
}
}
Theme.chat_replyTextPaint.setColor(ColorUtils.blendARGB(themedColor4, Theme.adaptHue(themedColor4, Theme.chat_replyNamePaint.getColor()), f40));
}
int i26 = alphaComponent;
Theme.chat_quoteTextPaint.setColor(Theme.chat_replyTextPaint.getColor());
float dp11 = AndroidUtilities.dp(10.0f);
this.forwardNameX = (f39 - this.replyTextOffset) + dp11 + (this.needReplyImage ? r2 + AndroidUtilities.dp(25.0f) : 0);
MessageObject.GroupedMessagePosition groupedMessagePosition4 = this.currentPosition;
if ((groupedMessagePosition4 == null || (groupedMessagePosition4.minY == 0 && groupedMessagePosition4.minX == 0)) && (!this.enterTransitionInProgress || this.currentMessageObject.isVoice())) {
if (getAlpha() * f2 != 1.0f) {
RectF rectF4 = AndroidUtilities.rectTmp;
rectF4.set(0.0f, 0.0f, getWidth(), getHeight());
i3 = canvas.saveLayerAlpha(rectF4, (int) (getAlpha() * 255.0f * f2), 31);
} else {
i3 = -1;
}
float min = Math.min(4.0f, SharedConfig.bubbleRadius);
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
float f43 = z ? 6.0f : 4.0f;
this.replySelectorRect.set(f39 - AndroidUtilities.dp(7.0f), f38 - AndroidUtilities.dp(3.0f), (Math.max(this.replyNameWidth, this.replyTextWidth) + f39) - AndroidUtilities.dp(4.0f), f38 + this.replyHeight + AndroidUtilities.dp(3.0f));
if (i > 0) {
RectF rectF5 = this.replySelectorRect;
rectF5.right = Math.max(rectF5.right, i);
}
f6 = f39;
f7 = f43;
f8 = f7;
} else {
if (this.drawTopic || this.drawNameLayout || (this.drawForwardedName && this.forwardedNameLayout[0] != null)) {
f5 = min;
} else if (!this.currentMessageObject.isOutOwner() || !this.drawPinnedTop) {
f5 = SharedConfig.bubbleRadius * 0.6f;
} else {
f5 = SharedConfig.bubbleRadius / 3.0f;
}
if (this.currentMessagesGroup != null && (groupedMessagePosition = this.currentPosition) != null) {
int i27 = groupedMessagePosition.flags;
if ((i27 & 1) == 0 || (i27 & 2) == 0) {
if (AndroidUtilities.isTablet()) {
parentWidth = AndroidUtilities.getMinTabletSide();
} else {
parentWidth = getParentWidth();
}
int i28 = 0;
int i29 = 0;
while (i28 < this.currentMessagesGroup.posArray.size()) {
if (this.currentMessagesGroup.posArray.get(i28).minY != 0) {
break;
}
i29 = (int) (i29 + Math.ceil(((r8.pw + r8.leftSpanOffset) / 1000.0f) * parentWidth));
i28++;
f39 = f39;
}
f6 = f39;
if (!this.mediaBackground && this.currentMessageObject.isOutOwner()) {
i4 = (this.backgroundDrawableLeft + i29) - AndroidUtilities.dp(6.0f);
} else {
i4 = this.backgroundDrawableLeft + i29;
}
backgroundDrawableRight = i4 - (getExtraTextX() + AndroidUtilities.dp((this.isAvatarVisible ? 48 : 0) + 8));
this.replySelectorRect.set(this.backgroundDrawableLeft + this.transitionParams.deltaLeft + AndroidUtilities.dp(10 + ((!this.currentMessageObject.isOutOwner() || this.mediaBackground || this.drawPinnedBottom) ? 0 : 6)) + getExtraTextX(), (f38 - AndroidUtilities.dp((this.mediaBackground && this.drawPinnedTop && !this.drawNameLayout) ? 2 : 0)) - ((this.drawForwardedName || this.forwardedNameLayout[0] == null || this.drawNameLayout) ? 0 : 2), backgroundDrawableRight - (AndroidUtilities.dp(10 + ((this.currentMessageObject.isOutOwner() || this.mediaBackground || this.drawPinnedBottom) ? 0 : 6)) + getExtraTextX()), f38 + this.replyHeight + AndroidUtilities.dp(4.0f));
f7 = f5;
f8 = min;
}
}
f6 = f39;
backgroundDrawableRight = getBackgroundDrawableRight() + this.transitionParams.deltaRight;
this.replySelectorRect.set(this.backgroundDrawableLeft + this.transitionParams.deltaLeft + AndroidUtilities.dp(10 + ((!this.currentMessageObject.isOutOwner() || this.mediaBackground || this.drawPinnedBottom) ? 0 : 6)) + getExtraTextX(), (f38 - AndroidUtilities.dp((this.mediaBackground && this.drawPinnedTop && !this.drawNameLayout) ? 2 : 0)) - ((this.drawForwardedName || this.forwardedNameLayout[0] == null || this.drawNameLayout) ? 0 : 2), backgroundDrawableRight - (AndroidUtilities.dp(10 + ((this.currentMessageObject.isOutOwner() || this.mediaBackground || this.drawPinnedBottom) ? 0 : 6)) + getExtraTextX()), f38 + this.replyHeight + AndroidUtilities.dp(4.0f));
f7 = f5;
f8 = min;
}
if (z) {
if (this.replyBounce == null) {
this.replyBounce = new ButtonBounce(this, 2.0f, 2.0f);
}
if (i3 == -1) {
i3 = canvas.getSaveCount();
}
canvas.save();
float scale2 = this.replyBounce.getScale(0.0125f);
float f44 = this.replyBounceX;
RectF rectF6 = this.replySelectorRect;
float clamp2 = Utilities.clamp(f44, rectF6.right, rectF6.left);
float f45 = this.replyBounceY;
RectF rectF7 = this.replySelectorRect;
canvas.scale(scale2, scale2, clamp2, Utilities.clamp(f45, rectF7.bottom, rectF7.top));
}
int i30 = i3;
this.replyLine.setLoading(z7);
this.replyLine.drawBackground(canvas, this.replySelectorRect, f8, f7, f8, f, this.isReplyQuote, this.currentMessageObject.shouldDrawWithoutBackground());
if (this.replySelector == null) {
this.replySelectorColor = i26;
Drawable createRadSelectorDrawable3 = Theme.createRadSelectorDrawable(i26, 0, 0);
this.replySelector = createRadSelectorDrawable3;
createRadSelectorDrawable3.setCallback(this);
}
Drawable drawable4 = this.replySelector;
RectF rectF8 = this.replySelectorRect;
drawable4.setBounds((int) rectF8.left, (int) rectF8.top, (int) rectF8.right, (int) rectF8.bottom);
if (f8 != this.replySelectorRadLeft || f7 != this.replySelectorRadRight) {
Drawable drawable5 = this.replySelector;
this.replySelectorRadLeft = f8;
this.replySelectorRadRight = f7;
Theme.setMaskDrawableRad(drawable5, f8, f7, f8, f8);
}
if (i26 != this.replySelectorColor) {
Drawable drawable6 = this.replySelector;
this.replySelectorColor = i26;
Theme.setSelectorDrawableColor(drawable6, i26, true);
}
this.replySelector.draw(canvas);
Path path = this.replyRoundRectPath;
if (path == null) {
this.replyRoundRectPath = new Path();
} else {
path.rewind();
}
this.replyLine.drawLine(canvas, this.replySelectorRect);
this.replyLine.drawLoadingBackground(canvas, this.replySelectorRect, f8, f7, f8, f);
if (this.needReplyImage) {
this.replyImageReceiver.setAlpha(f2);
float min2 = Math.min(this.replySelectorRect.height() - AndroidUtilities.dp(10.0f), AndroidUtilities.dp(this.isReplyQuote ? 3.0f : 7.0f) + Theme.chat_replyNamePaint.getTextSize() + Theme.chat_replyTextPaint.getTextSize());
ImageReceiver imageReceiver = this.replyImageReceiver;
float dp12 = this.replySelectorRect.left + AndroidUtilities.dp(8.0f);
float f46 = this.replySelectorRect.top;
if (!this.isReplyQuote || (staticLayout = this.replyTextLayout) == null || staticLayout.getLineCount() > 1) {
i6 = 5;
i7 = 0;
} else {
i6 = 5;
i7 = 2;
}
imageReceiver.setImageCoords(dp12, f46 + AndroidUtilities.dp(i7 + i6), min2, min2);
this.replyImageReceiver.draw(canvas);
MessageObject messageObject13 = this.currentMessageObject;
if (messageObject13 != null && messageObject13.hasValidReplyMessageObject() && this.currentMessageObject.replyMessageObject.hasMediaSpoilers()) {
int[] roundRadius = this.replyImageReceiver.getRoundRadius();
float[] fArr = this.mediaSpoilerRadii;
z2 = false;
float f47 = roundRadius[0];
fArr[1] = f47;
fArr[0] = f47;
float f48 = roundRadius[1];
fArr[3] = f48;
fArr[2] = f48;
float f49 = roundRadius[2];
fArr[5] = f49;
fArr[4] = f49;
float f50 = roundRadius[3];
fArr[7] = f50;
fArr[6] = f50;
this.mediaSpoilerPath.rewind();
RectF rectF9 = AndroidUtilities.rectTmp;
rectF9.set(this.replyImageReceiver.getImageX(), this.replyImageReceiver.getImageY(), this.replyImageReceiver.getImageX2(), this.replyImageReceiver.getImageY2());
this.mediaSpoilerPath.addRoundRect(rectF9, this.mediaSpoilerRadii, Path.Direction.CW);
canvas.save();
canvas.clipPath(this.mediaSpoilerPath);
this.mediaSpoilerEffect.setColor(ColorUtils.setAlphaComponent(-1, (int) (Color.alpha(-1) * 0.325f * this.replyImageReceiver.getAlpha())));
this.mediaSpoilerEffect.setBounds((int) this.replyImageReceiver.getImageX(), (int) this.replyImageReceiver.getImageY(), (int) this.replyImageReceiver.getImageX2(), (int) this.replyImageReceiver.getImageY2());
this.mediaSpoilerEffect.draw(canvas);
canvas.restore();
invalidate();
} else {
z2 = false;
}
f9 = min2;
} else {
z2 = false;
f9 = 0.0f;
}
MessageObject messageObject14 = this.currentMessageObject;
if (messageObject14 == null || !messageObject14.shouldDrawWithoutBackground()) {
f10 = 1.0f;
f11 = -AndroidUtilities.dp(1.0f);
} else {
f11 = -AndroidUtilities.dp(6.0f);
f10 = 1.0f;
}
MessageObject messageObject15 = this.currentMessageObject;
float dp13 = (messageObject15 == null || !messageObject15.shouldDrawWithoutBackground()) ? AndroidUtilities.dp(3.0f) : AndroidUtilities.dp(f10);
boolean z8 = this.isReplyQuote;
if (z8 && (messageObject = this.currentMessageObject) != null && (tLRPC$Message = messageObject.messageOwner) != null && tLRPC$Message.reply_to.quote) {
z2 = true;
}
if (z8 && z2 && this.replyQuoteDrawable != null) {
if (this.replyLine.getColor() != this.replyQuoteDrawableColor) {
Drawable drawable7 = this.replyQuoteDrawable;
int color4 = this.replyLine.getColor();
this.replyQuoteDrawableColor = color4;
drawable7.setColorFilter(new PorterDuffColorFilter(color4, PorterDuff.Mode.SRC_IN));
}
this.replyQuoteDrawable.setBounds((int) ((this.replySelectorRect.right - AndroidUtilities.dp((!this.drawPinnedTop ? 1 : 0) + 2)) - this.replyQuoteDrawable.getIntrinsicWidth()), (int) (this.replySelectorRect.top + AndroidUtilities.dp((!this.drawPinnedTop ? 1 : 0) + 2)), (int) (this.replySelectorRect.right - AndroidUtilities.dp((!this.drawPinnedTop ? 1 : 0) + 2)), (int) (this.replySelectorRect.top + AndroidUtilities.dp((!this.drawPinnedTop ? 1 : 0) + 2) + this.replyQuoteDrawable.getIntrinsicHeight()));
this.replyQuoteDrawable.draw(canvas);
}
if (this.replyNameLayout != null) {
canvas.save();
canvas.translate(((f6 + f11) - this.replyNameOffset) + dp11 + (this.needReplyImage ? f9 + AndroidUtilities.dp(3.0f) : 0.0f), f38 + dp13);
this.replyNameLayout.draw(canvas);
canvas.restore();
}
MessageObject messageObject16 = this.currentMessageObject;
if (messageObject16 != null && messageObject16.isOut() && !ChatObject.isChannelAndNotMegaGroup(this.currentMessageObject.getChatId(), this.currentAccount)) {
color = getThemedColor(Theme.key_chat_outTimeText);
} else {
color = Theme.chat_replyTextPaint.getColor();
}
int i31 = color;
if (this.transitionParams.animateReplyTextLayout == null || this.transitionParams.animateChangeProgress >= 1.0f) {
f12 = dp11;
canvas3 = canvas;
i5 = i16;
f13 = f6;
f14 = 2.0f;
f15 = 1.0f;
} else {
canvas.save();
canvas.clipRect(this.replySelectorRect);
canvas.save();
float f51 = f6 + dp11 + f11;
if (this.isReplyQuote && this.needReplyImage) {
f51 -= AndroidUtilities.dp(2.0f);
}
if (this.needReplyImage && (!this.isReplyQuote || this.replyTextRTL)) {
f51 += f9 + AndroidUtilities.dp(3.0f);
}
if (this.replyTextRTL && this.transitionParams.animateReplyTextOffset > 0.0f) {
f51 = (this.replySelectorRect.right - AndroidUtilities.dp(8.0f)) - this.transitionParams.animateReplyTextLayout.getWidth();
}
canvas.translate(f51, ((f38 + dp13) - AndroidUtilities.dp(1.0f)) + Theme.chat_replyNamePaint.getTextSize() + AndroidUtilities.dp(5.0f));
TextPaint paint = this.transitionParams.animateReplyTextLayout.getPaint();
int alpha8 = paint.getAlpha();
paint.setAlpha((int) (alpha8 * (1.0f - this.transitionParams.animateChangeProgress)));
SpoilerEffect.renderWithRipple(this, this.invalidateSpoilersParent, i31, -AndroidUtilities.dp(2.0f), this.spoilersPatchedReplyTextLayout, this.transitionParams.animateReplyTextLayout, this.replySpoilers, canvas, false);
f12 = dp11;
f14 = 2.0f;
i5 = i16;
f15 = 1.0f;
f13 = f6;
canvas3 = canvas;
AnimatedEmojiSpan.drawAnimatedEmojis(canvas, this.transitionParams.animateReplyTextLayout, this.transitionParams.animateOutAnimateEmojiReply, 0.0f, this.replySpoilers, 0.0f, 0.0f, 0.0f, f, getAdaptiveEmojiColorFilter(2, paint.getColor()));
paint.setAlpha(alpha8);
canvas.restore();
}
if (this.replyTextLayout != null) {
canvas.save();
float f52 = f13 + f12 + f11;
if (this.isReplyQuote && this.needReplyImage) {
f52 -= AndroidUtilities.dp(f14);
}
if (this.needReplyImage && (!this.isReplyQuote || this.replyTextRTL)) {
f52 += f9 + AndroidUtilities.dp(3.0f);
}
if (this.replyTextRTL && this.replyTextOffset > 0) {
f52 = (this.replySelectorRect.right - AndroidUtilities.dp(8.0f)) - this.replyTextLayout.getWidth();
}
canvas3.translate(f52, ((f38 + dp13) - AndroidUtilities.dp(f15)) + Theme.chat_replyNamePaint.getTextSize() + AndroidUtilities.dp(5.0f));
TextPaint paint2 = this.replyTextLayout.getPaint();
int alpha9 = paint2.getAlpha();
paint2.setAlpha((int) (alpha9 * (this.transitionParams.animateReplyTextLayout != null ? this.transitionParams.animateChangeProgress : f15)));
SpoilerEffect.renderWithRipple(this, this.invalidateSpoilersParent, i31, -AndroidUtilities.dp(f14), this.spoilersPatchedReplyTextLayout, this.replyTextLayout, this.replySpoilers, canvas, false);
i2 = i5;
canvas2 = canvas3;
AnimatedEmojiSpan.drawAnimatedEmojis(canvas, this.replyTextLayout, this.animatedEmojiReplyStack, 0.0f, this.replySpoilers, 0.0f, 0.0f, 0.0f, f, getAdaptiveEmojiColorFilter(2, paint2.getColor()));
paint2.setAlpha(alpha9);
canvas.restore();
} else {
canvas2 = canvas3;
i2 = i5;
}
if (this.transitionParams.animateReplyTextLayout != null && this.transitionParams.animateChangeProgress < f15) {
canvas.restore();
}
if (i30 >= 0) {
canvas2.restoreToCount(i30);
}
if (i2 == Integer.MIN_VALUE) {
canvas2.restoreToCount(i2);
return;
}
return;
}
}
canvas2 = canvas;
i2 = i16;
if (i2 == Integer.MIN_VALUE) {
}
}
public boolean hasCaptionLayout() {
return this.captionLayout != null;
}
public boolean hasCommentLayout() {
return this.drawCommentButton;
}
public MessageObject.TextLayoutBlocks getCaptionLayout() {
return this.captionLayout;
}
public void setDrawSelectionBackground(boolean z) {
if (this.drawSelectionBackground != z) {
this.drawSelectionBackground = z;
invalidate();
}
}
public boolean isDrawingSelectionBackground() {
return this.drawSelectionBackground || this.isHighlightedAnimated || this.isHighlighted;
}
public float getHighlightAlpha() {
return getHighlightAlpha(false);
}
public float getHighlightAlpha(boolean z) {
float f;
QuoteHighlight quoteHighlight;
if (this.drawSelectionBackground || !this.isHighlightedAnimated) {
f = 1.0f;
} else {
int i = this.highlightProgress;
f = (i >= 300 ? 1.0f : i / 300.0f) * 1.0f;
}
return (z || (quoteHighlight = this.quoteHighlight) == null) ? f : f * (1.0f - quoteHighlight.getT());
}
public void setCheckBoxVisible(boolean z, boolean z2) {
MessageObject.GroupedMessages groupedMessages;
MessageObject.GroupedMessages groupedMessages2;
MessageObject messageObject;
if (z2 && (messageObject = this.currentMessageObject) != null && messageObject.deletedByThanos) {
return;
}
if (z) {
this.quoteHighlight = null;
CheckBoxBase checkBoxBase = this.checkBox;
if (checkBoxBase == null) {
CheckBoxBase checkBoxBase2 = new CheckBoxBase(this, 21, this.resourcesProvider);
this.checkBox = checkBoxBase2;
if (this.attachedToWindow) {
checkBoxBase2.onAttachedToWindow();
}
} else {
checkBoxBase.setResourcesProvider(this.resourcesProvider);
}
}
if (z && (((groupedMessages = this.currentMessagesGroup) != null && groupedMessages.messages.size() > 1) || ((groupedMessages2 = this.groupedMessagesToSet) != null && groupedMessages2.messages.size() > 1))) {
CheckBoxBase checkBoxBase3 = this.mediaCheckBox;
if (checkBoxBase3 == null) {
CheckBoxBase checkBoxBase4 = new CheckBoxBase(this, 21, this.resourcesProvider);
this.mediaCheckBox = checkBoxBase4;
checkBoxBase4.setUseDefaultCheck(true);
if (this.attachedToWindow) {
this.mediaCheckBox.onAttachedToWindow();
}
} else {
checkBoxBase3.setResourcesProvider(this.resourcesProvider);
}
}
if (this.checkBoxVisible == z) {
if (z2 == this.checkBoxAnimationInProgress || z2) {
return;
}
this.checkBoxAnimationProgress = z ? 1.0f : 0.0f;
invalidate();
return;
}
this.checkBoxAnimationInProgress = z2;
this.checkBoxVisible = z;
if (z2) {
this.lastCheckBoxAnimationTime = SystemClock.elapsedRealtime();
} else {
this.checkBoxAnimationProgress = z ? 1.0f : 0.0f;
}
invalidate();
}
public boolean isCheckBoxVisible() {
return this.checkBoxVisible || this.checkBoxAnimationInProgress;
}
public void setChecked(boolean z, boolean z2, boolean z3) {
MessageObject messageObject;
if (z || !z3 || (messageObject = this.currentMessageObject) == null || !messageObject.deletedByThanos) {
CheckBoxBase checkBoxBase = this.checkBox;
if (checkBoxBase != null) {
checkBoxBase.setChecked(z2, z3);
}
CheckBoxBase checkBoxBase2 = this.mediaCheckBox;
if (checkBoxBase2 != null) {
checkBoxBase2.setChecked(z, z3);
}
this.backgroundDrawable.setSelected(z2, z3);
}
}
public void setLastTouchCoords(float f, float f2) {
this.lastTouchX = f;
this.lastTouchY = f2;
this.backgroundDrawable.setTouchCoords(f + getTranslationX(), this.lastTouchY);
}
public MessageBackgroundDrawable getBackgroundDrawable() {
return this.backgroundDrawable;
}
public Theme.MessageDrawable getCurrentBackgroundDrawable(boolean z) {
if (z) {
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
boolean z2 = groupedMessagePosition != null && (groupedMessagePosition.flags & 8) == 0 && this.currentMessagesGroup.isDocuments && !this.drawPinnedBottom;
if (this.currentMessageObject.isOutOwner()) {
if (!this.mediaBackground && !this.drawPinnedBottom && !z2) {
this.currentBackgroundDrawable = (Theme.MessageDrawable) getThemedDrawable("drawableMsgOut");
} else {
this.currentBackgroundDrawable = (Theme.MessageDrawable) getThemedDrawable("drawableMsgOutMedia");
}
} else if (!this.mediaBackground && !this.drawPinnedBottom && !z2) {
this.currentBackgroundDrawable = (Theme.MessageDrawable) getThemedDrawable("drawableMsgIn");
} else {
this.currentBackgroundDrawable = (Theme.MessageDrawable) getThemedDrawable("drawableMsgInMedia");
}
}
this.currentBackgroundDrawable.getBackgroundDrawable();
return this.currentBackgroundDrawable;
}
private boolean shouldDrawCaptionLayout() {
MessageObject.GroupedMessagePosition groupedMessagePosition;
MessageObject.GroupedMessages groupedMessages;
MessageObject messageObject = this.currentMessageObject;
return (messageObject == null || messageObject.preview || ((groupedMessagePosition = this.currentPosition) != null && ((groupedMessages = this.currentMessagesGroup) == null || !groupedMessages.isDocuments || (groupedMessagePosition.flags & 8) != 0)) || this.transitionParams.animateBackgroundBoundsInner || (this.enterTransitionInProgress && messageObject.isVoice())) ? false : true;
}
public void drawCaptionLayout(Canvas canvas, boolean z, float f) {
if (this.animatedEmojiStack != null && (this.captionLayout != null || this.transitionParams.animateOutCaptionLayout != null)) {
this.animatedEmojiStack.clearPositions();
}
TransitionParams transitionParams = this.transitionParams;
if (!transitionParams.animateReplaceCaptionLayout || transitionParams.animateChangeProgress == 1.0f) {
drawCaptionLayout(canvas, this.captionLayout, true, z, f);
} else {
drawCaptionLayout(canvas, transitionParams.animateOutCaptionLayout, false, z, f * (1.0f - this.transitionParams.animateChangeProgress));
drawCaptionLayout(canvas, this.captionLayout, true, z, f * this.transitionParams.animateChangeProgress);
}
if (!z) {
drawAnimatedEmojiCaption(canvas, f);
}
MessageObject messageObject = this.currentMessageObject;
if (messageObject != null && messageObject.messageOwner != null && messageObject.isVoiceTranscriptionOpen()) {
MessageObject messageObject2 = this.currentMessageObject;
if (!messageObject2.messageOwner.voiceTranscriptionFinal && TranscribeButton.isTranscribing(messageObject2)) {
invalidate();
}
}
if (this.isRoundVideo) {
this.reactionsLayoutInBubble.drawServiceShaderBackground = 1.0f - getVideoTranscriptionProgress();
}
if (z || !this.currentMessageObject.shouldDrawReactions()) {
return;
}
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
if (groupedMessagePosition != null) {
int i = groupedMessagePosition.flags;
if ((i & 8) == 0 || (i & 1) == 0) {
return;
}
}
ReactionsLayoutInBubble reactionsLayoutInBubble = this.reactionsLayoutInBubble;
if (reactionsLayoutInBubble.isSmall) {
return;
}
if (reactionsLayoutInBubble.drawServiceShaderBackground > 0.0f) {
applyServiceShaderMatrix();
}
if (getAlpha() != 1.0f) {
RectF rectF = AndroidUtilities.rectTmp;
rectF.set(0.0f, 0.0f, getWidth(), getHeight());
canvas.saveLayerAlpha(rectF, (int) (getAlpha() * 255.0f), 31);
}
ReactionsLayoutInBubble reactionsLayoutInBubble2 = this.reactionsLayoutInBubble;
if (reactionsLayoutInBubble2.drawServiceShaderBackground > 0.0f || !this.transitionParams.animateBackgroundBoundsInner || this.currentPosition != null || this.isRoundVideo) {
TransitionParams transitionParams2 = this.transitionParams;
reactionsLayoutInBubble2.draw(canvas, transitionParams2.animateChange ? transitionParams2.animateChangeProgress : 1.0f, null);
} else {
canvas.save();
canvas.clipRect(0.0f, 0.0f, getMeasuredWidth(), getBackgroundDrawableBottom() + this.transitionParams.deltaBottom);
ReactionsLayoutInBubble reactionsLayoutInBubble3 = this.reactionsLayoutInBubble;
TransitionParams transitionParams3 = this.transitionParams;
reactionsLayoutInBubble3.draw(canvas, transitionParams3.animateChange ? transitionParams3.animateChangeProgress : 1.0f, null);
canvas.restore();
}
if (getAlpha() != 1.0f) {
canvas.restore();
}
}
private void drawCaptionLayout(Canvas canvas, MessageObject.TextLayoutBlocks textLayoutBlocks, boolean z, boolean z2, float f) {
int dp;
int extraTextX;
int i;
int dp2;
int i2;
float f2;
int i3;
Rect rect;
int i4;
Path path;
float f3;
int i5;
int i6;
MessageObject messageObject;
int i7;
boolean z3;
int i8;
int i9;
int i10;
boolean shouldDrawThreadProgress;
long j;
float f4;
InfiniteProgress infiniteProgress;
int i11;
int i12;
if (this.mediaBackground) {
dp = this.backgroundDrawableLeft + AndroidUtilities.dp(12.0f);
extraTextX = getExtraTextX();
} else {
dp = this.backgroundDrawableLeft + AndroidUtilities.dp(this.drawPinnedBottom ? 12.0f : 18.0f);
extraTextX = getExtraTextX();
}
int i13 = dp + extraTextX;
int extraTextX2 = i13 - getExtraTextX();
int i14 = 1;
if (this.currentMessagesGroup == null || this.currentMessageObject.isMusic() || this.currentMessageObject.isDocument()) {
i = i13;
dp2 = extraTextX2 + (this.backgroundWidth - (this.mediaBackground ? 0 : AndroidUtilities.dp(9.0f)));
} else {
int groupPhotosWidth = getGroupPhotosWidth();
if ((this.currentPosition.flags & 1) == 0) {
dp2 = (int) (extraTextX2 + Math.ceil((r3.pw / 1000.0f) * groupPhotosWidth));
i = i13;
} else {
int i15 = 0;
int i16 = 0;
while (i15 < this.currentMessagesGroup.posArray.size()) {
if (this.currentMessagesGroup.posArray.get(i15).minY != 0) {
break;
}
i16 = (int) (i16 + Math.ceil(((r14.pw + r14.leftSpanOffset) / 1000.0f) * groupPhotosWidth));
i15++;
i13 = i13;
}
i = i13;
dp2 = extraTextX2 + (i16 - AndroidUtilities.dp(9.0f));
}
}
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
if (groupedMessagePosition != null && (groupedMessagePosition.flags & 1) == 0 && !this.currentMessagesGroup.hasSibling) {
dp2 += AndroidUtilities.dp(14.0f);
}
if (this.currentBackgroundDrawable != null && this.drawCommentButton && this.timeLayout != null) {
float dp3 = ((this.layoutHeight + this.transitionParams.deltaBottom) - AndroidUtilities.dp(18.0f)) - this.timeLayout.getHeight();
MessageObject.GroupedMessages groupedMessages = this.currentMessagesGroup;
if (groupedMessages != null) {
MessageObject.GroupedMessages.TransitionParams transitionParams = groupedMessages.transitionParams;
dp3 += transitionParams.offsetBottom;
if (transitionParams.backgroundChangeBounds) {
dp3 -= getTranslationY();
}
}
float f5 = dp3;
if (this.pinnedBottom) {
i5 = 2;
i6 = 3;
} else if (this.pinnedTop) {
i5 = 4;
i6 = 1;
} else {
i5 = 3;
i6 = 0;
}
int currentBackgroundLeft = getCurrentBackgroundLeft() + AndroidUtilities.dp((this.currentMessageObject.isOutOwner() || this.mediaBackground || this.drawPinnedBottom) ? 2.0f : 8.0f);
float f6 = 45.1f - i6;
float dp4 = this.layoutHeight - AndroidUtilities.dp(f6);
MessageObject.GroupedMessagePosition groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null && (groupedMessagePosition2.flags & 1) == 0 && !this.currentMessagesGroup.hasSibling) {
currentBackgroundLeft -= AndroidUtilities.dp(10.0f);
}
Rect rect2 = this.commentButtonRect;
MessageObject messageObject2 = this.currentMessageObject;
rect2.set(currentBackgroundLeft - AndroidUtilities.dp(((messageObject2 == null || !messageObject2.isOut()) && !this.drawPinnedBottom && this.currentPosition == null && ((messageObject = this.currentMessageObject) == null || messageObject.type != 17 || this.pollInstantViewTouchesBottom)) ? 6.0f : 0.0f), (int) dp4, dp2 - AndroidUtilities.dp(14.0f), this.layoutHeight - AndroidUtilities.dp(i5));
if (this.selectorDrawable[1] != null && this.selectorDrawableMaskType[1] == 2) {
int saveCount = canvas.getSaveCount();
this.selectorDrawable[1].setBounds(this.commentButtonRect);
this.selectorDrawable[1].draw(canvas);
canvas.restoreToCount(saveCount);
}
MessageObject.GroupedMessagePosition groupedMessagePosition3 = this.currentPosition;
if (groupedMessagePosition3 == null || ((groupedMessagePosition3.flags & 1) != 0 && groupedMessagePosition3.minX == 0 && groupedMessagePosition3.maxX == 0)) {
if (getAlpha() != 1.0f) {
RectF rectF = AndroidUtilities.rectTmp;
rectF.set(0.0f, 0.0f, getWidth(), getHeight());
canvas.saveLayerAlpha(rectF, (int) (getAlpha() * 255.0f), 31);
}
Theme.chat_instantViewPaint.setColor(getThemedColor(Theme.key_chat_inPreviewInstantText));
if (this.commentAvatarImages != null) {
int dp5 = AndroidUtilities.dp(17.0f);
int extraTextX3 = i + getExtraTextX();
int length = this.commentAvatarImages.length - 1;
i7 = 2;
z3 = false;
while (length >= 0) {
if (this.commentAvatarImagesVisible[length] && this.commentAvatarImages[length].hasImageSet()) {
this.commentAvatarImages[length].setImageX((dp5 * length) + extraTextX3);
this.commentAvatarImages[length].setImageY((f5 - AndroidUtilities.dp(4.0f)) + (this.pinnedBottom ? AndroidUtilities.dp(2.0f) : 0));
ImageReceiver[] imageReceiverArr = this.commentAvatarImages;
if (length != imageReceiverArr.length - i14) {
canvas.drawCircle(imageReceiverArr[length].getCenterX(), this.commentAvatarImages[length].getCenterY(), AndroidUtilities.dp(13.0f), this.currentBackgroundDrawable.getPaint());
}
this.commentAvatarImages[length].draw(canvas);
if (length != 0) {
i7 += 17;
}
z3 = true;
}
length--;
i14 = 1;
}
} else {
i7 = 2;
z3 = false;
}
if (getAlpha() != 1.0f) {
canvas.restore();
}
if (this.mediaBackground && textLayoutBlocks == null) {
ReactionsLayoutInBubble reactionsLayoutInBubble = this.reactionsLayoutInBubble;
if (reactionsLayoutInBubble.isEmpty || reactionsLayoutInBubble.isSmall) {
i8 = i;
i9 = 3;
if (this.commentLayout != null || this.drawSideButton == i9) {
i2 = 0;
} else {
Theme.chat_commentTextPaint.setColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outPreviewInstantText : Theme.key_chat_inPreviewInstantText));
float f7 = i7 + 33;
int dp6 = i8 + AndroidUtilities.dp(f7);
this.commentX = dp6;
if (this.drawCommentNumber) {
this.commentX = dp6 + this.commentNumberWidth + AndroidUtilities.dp(4.0f);
}
int alpha = Theme.chat_commentTextPaint.getAlpha();
if (this.transitionParams.animateComments && this.transitionParams.animateCommentsLayout != null) {
canvas.save();
Theme.chat_commentTextPaint.setAlpha((int) (alpha * (1.0d - this.transitionParams.animateChangeProgress)));
canvas.translate(this.transitionParams.animateCommentX + ((this.commentX - this.transitionParams.animateCommentX) * this.transitionParams.animateChangeProgress), (f5 - AndroidUtilities.dp(0.1f)) + (this.pinnedBottom ? AndroidUtilities.dp(2.0f) : 0));
this.transitionParams.animateCommentsLayout.draw(canvas);
canvas.restore();
}
canvas.save();
canvas.translate(i8 + AndroidUtilities.dp(f7), (f5 - AndroidUtilities.dp(0.1f)) + (this.pinnedBottom ? AndroidUtilities.dp(2.0f) : 0));
if (!this.currentMessageObject.isSent()) {
Theme.chat_commentTextPaint.setAlpha(127);
Theme.chat_commentArrowDrawable.setAlpha(127);
Theme.chat_commentDrawable.setAlpha(127);
} else {
Theme.chat_commentArrowDrawable.setAlpha(255);
Theme.chat_commentDrawable.setAlpha(255);
}
if (this.drawCommentNumber || (this.transitionParams.animateComments && this.transitionParams.animateDrawCommentNumber)) {
if (this.drawCommentNumber && this.transitionParams.animateComments) {
if (this.transitionParams.animateDrawCommentNumber) {
Theme.chat_commentTextPaint.setAlpha(alpha);
} else {
Theme.chat_commentTextPaint.setAlpha((int) (alpha * this.transitionParams.animateChangeProgress));
}
}
Theme.chat_commentTextPaint.setAlpha((int) (r4.getAlpha() * getAlpha()));
this.commentNumberLayout.draw(canvas);
if (this.drawCommentNumber) {
canvas.translate(this.commentNumberWidth + AndroidUtilities.dp(4.0f), 0.0f);
}
}
if (this.transitionParams.animateComments && this.transitionParams.animateCommentsLayout != null) {
Theme.chat_commentTextPaint.setAlpha((int) (alpha * this.transitionParams.animateChangeProgress));
} else {
Theme.chat_commentTextPaint.setAlpha((int) (alpha * f));
}
Theme.chat_commentTextPaint.setAlpha((int) (r3.getAlpha() * getAlpha()));
this.commentLayout.draw(canvas);
canvas.restore();
int dp7 = i8 + this.commentWidth + AndroidUtilities.dp(f7) + AndroidUtilities.dp(9.0f);
this.commentUnreadX = dp7;
if (this.drawCommentNumber) {
this.commentUnreadX = dp7 + this.commentNumberWidth + AndroidUtilities.dp(4.0f);
}
TLRPC$MessageReplies tLRPC$MessageReplies = null;
MessageObject.GroupedMessages groupedMessages2 = this.currentMessagesGroup;
if (groupedMessages2 != null && !groupedMessages2.messages.isEmpty()) {
i2 = 0;
MessageObject messageObject3 = this.currentMessagesGroup.messages.get(0);
if (messageObject3.hasReplies()) {
tLRPC$MessageReplies = messageObject3.messageOwner.replies;
}
} else {
i2 = 0;
if (this.currentMessageObject.hasReplies()) {
tLRPC$MessageReplies = this.currentMessageObject.messageOwner.replies;
}
}
boolean z4 = (tLRPC$MessageReplies == null || (i12 = tLRPC$MessageReplies.read_max_id) == 0 || i12 >= tLRPC$MessageReplies.max_id) ? i2 : 1;
this.commentDrawUnread = z4;
if (z4 != 0) {
Theme.chat_docBackPaint.setColor(getThemedColor(Theme.key_chat_inInstant));
if (!this.transitionParams.animateComments) {
i11 = this.commentUnreadX;
} else {
if (!this.transitionParams.animateCommentDrawUnread) {
Theme.chat_docBackPaint.setAlpha((int) (Color.alpha(r1) * this.transitionParams.animateChangeProgress));
}
i11 = (int) (this.transitionParams.animateCommentUnreadX + ((this.commentUnreadX - this.transitionParams.animateCommentUnreadX) * this.transitionParams.animateChangeProgress));
}
canvas.drawCircle(i11, f5 + AndroidUtilities.dp(8.0f) + (this.pinnedBottom ? AndroidUtilities.dp(2.0f) : i2), AndroidUtilities.dp(2.5f), Theme.chat_docBackPaint);
}
}
if (!z3) {
BaseCell.setDrawableBounds(Theme.chat_commentDrawable, i8, (f5 - AndroidUtilities.dp(4.0f)) + (this.pinnedBottom ? AndroidUtilities.dp(2.0f) : i2));
if (f != 1.0f) {
Theme.chat_commentDrawable.setAlpha((int) (f * 255.0f));
Theme.chat_commentDrawable.draw(canvas);
Theme.chat_commentDrawable.setAlpha(255);
} else {
Theme.chat_commentDrawable.draw(canvas);
}
}
this.commentArrowX = dp2 - AndroidUtilities.dp(44.0f);
if (this.transitionParams.animateComments) {
i10 = this.commentArrowX;
} else {
i10 = (int) (this.transitionParams.animateCommentArrowX + ((this.commentArrowX - this.transitionParams.animateCommentArrowX) * this.transitionParams.animateChangeProgress));
}
float dp8 = (f5 - AndroidUtilities.dp(4.0f)) + (!this.pinnedBottom ? AndroidUtilities.dp(2.0f) : i2);
shouldDrawThreadProgress = this.delegate.shouldDrawThreadProgress(this);
long elapsedRealtime = SystemClock.elapsedRealtime();
j = elapsedRealtime - this.commentProgressLastUpadteTime;
this.commentProgressLastUpadteTime = elapsedRealtime;
if (j > 17) {
j = 17;
}
if (!shouldDrawThreadProgress) {
float f8 = this.commentProgressAlpha;
if (f8 < 1.0f) {
float f9 = f8 + (((float) j) / 180.0f);
this.commentProgressAlpha = f9;
if (f9 > 1.0f) {
this.commentProgressAlpha = 1.0f;
}
}
f4 = 0.0f;
} else {
float f10 = this.commentProgressAlpha;
f4 = 0.0f;
if (f10 > 0.0f) {
float f11 = f10 - (((float) j) / 180.0f);
this.commentProgressAlpha = f11;
if (f11 < 0.0f) {
this.commentProgressAlpha = 0.0f;
}
}
}
if ((!shouldDrawThreadProgress || this.commentProgressAlpha > f4) && (infiniteProgress = this.commentProgress) != null) {
infiniteProgress.setColor(getThemedColor(Theme.key_chat_inInstant));
this.commentProgress.setAlpha(this.commentProgressAlpha);
this.commentProgress.draw(canvas, AndroidUtilities.dp(11.0f) + i10, dp8 + AndroidUtilities.dp(12.0f), this.commentProgressAlpha);
invalidate();
}
if (shouldDrawThreadProgress || this.commentProgressAlpha < 1.0f) {
int intrinsicWidth = Theme.chat_commentArrowDrawable.getIntrinsicWidth() / 2;
float f12 = i10 + intrinsicWidth;
float intrinsicHeight = Theme.chat_commentArrowDrawable.getIntrinsicHeight() / 2;
float f13 = dp8 + intrinsicHeight;
Drawable drawable = Theme.chat_commentArrowDrawable;
float f14 = intrinsicWidth;
float f15 = this.commentProgressAlpha;
drawable.setBounds((int) (f12 - ((1.0f - f15) * f14)), (int) (f13 - ((1.0f - f15) * intrinsicHeight)), (int) (f12 + (f14 * (1.0f - f15))), (int) (f13 + (intrinsicHeight * (1.0f - f15))));
Theme.chat_commentArrowDrawable.setAlpha((int) ((1.0f - this.commentProgressAlpha) * 255.0f * f));
Theme.chat_commentArrowDrawable.draw(canvas);
}
if (textLayoutBlocks != null) {
if (z2 && this.links.isEmpty()) {
return;
}
if ((!this.currentMessageObject.deleted || this.drawingToBitmap || this.currentPosition == null) && f != 0.0f) {
setupTextColors();
canvas.save();
MessageObject.GroupedMessages groupedMessages3 = this.currentMessagesGroup;
float f16 = groupedMessages3 != null ? groupedMessages3.transitionParams.captionEnterProgress * f : f;
if (f16 == 0.0f) {
return;
}
float f17 = this.captionY;
float f18 = this.captionX;
TransitionParams transitionParams2 = this.transitionParams;
if (transitionParams2.animateBackgroundBoundsInner) {
if (transitionParams2.transformGroupToSingleMessage) {
f17 -= getTranslationY();
f3 = this.transitionParams.deltaLeft;
} else if (transitionParams2.moveCaption) {
float f19 = this.captionX;
TransitionParams transitionParams3 = this.transitionParams;
float f20 = transitionParams3.animateChangeProgress;
float f21 = (f19 * f20) + (transitionParams3.captionFromX * (1.0f - f20));
float f22 = (transitionParams3.captionFromY * (1.0f - f20)) + (this.captionY * f20);
f18 = f21;
f17 = f22;
} else if ((!this.currentMessageObject.isVoice() && !this.currentMessageObject.isRoundVideo()) || !TextUtils.isEmpty(this.currentMessageObject.caption)) {
f3 = this.transitionParams.deltaLeft;
}
f18 += f3;
}
if (this.isRoundVideo && this.transitionParams.animateDrawBackground) {
f2 = 1.0f;
f17 += (1.0f - getVideoTranscriptionProgress()) * AndroidUtilities.roundMessageSize;
} else {
f2 = 1.0f;
}
float f23 = f17;
if (f16 != f2) {
this.rect.set(f18, f23, textLayoutBlocks.textWidth + f18, textLayoutBlocks.textHeight + f23);
i3 = canvas.saveLayerAlpha(this.rect, (int) (f16 * 255.0f), 31);
} else {
i3 = Integer.MIN_VALUE;
}
if (this.isRoundVideo && this.transitionParams.animateDrawBackground) {
Theme.MessageDrawable.PathDrawParams pathDrawParams = this.backgroundCacheParams;
if (pathDrawParams != null && (path = pathDrawParams.getPath()) != null && !path.isEmpty()) {
canvas.translate(0.0f, this.transitionYOffsetForDrawables);
canvas.clipPath(path);
canvas.translate(0.0f, -this.transitionYOffsetForDrawables);
}
} else if (this.transitionParams.animateBackgroundBoundsInner && this.currentBackgroundDrawable != null && this.currentMessagesGroup == null) {
int height = (!this.drawCommentButton || (rect = this.commentButtonRect) == null) ? i2 : rect.height();
ReactionsLayoutInBubble reactionsLayoutInBubble2 = this.reactionsLayoutInBubble;
int i17 = height + ((reactionsLayoutInBubble2 == null || reactionsLayoutInBubble2.isSmall) ? i2 : reactionsLayoutInBubble2.height);
if (this.currentMessageObject.isOutOwner() && !this.mediaBackground && !this.pinnedBottom) {
canvas.clipRect(getBackgroundDrawableLeft() + this.transitionParams.deltaLeft + AndroidUtilities.dp(4.0f), getBackgroundDrawableTop() + this.transitionParams.deltaTop + AndroidUtilities.dp(4.0f), (getBackgroundDrawableRight() + this.transitionParams.deltaRight) - AndroidUtilities.dp(10.0f), ((getBackgroundDrawableBottom() + this.transitionParams.deltaBottom) - AndroidUtilities.dp(4.0f)) - i17);
} else {
canvas.clipRect(getBackgroundDrawableLeft() + this.transitionParams.deltaLeft + AndroidUtilities.dp(4.0f), getBackgroundDrawableTop() + this.transitionParams.deltaTop + AndroidUtilities.dp(4.0f), (getBackgroundDrawableRight() + this.transitionParams.deltaRight) - AndroidUtilities.dp(4.0f), ((getBackgroundDrawableBottom() + this.transitionParams.deltaBottom) - AndroidUtilities.dp(4.0f)) - i17);
}
}
canvas.save();
canvas.translate(f18, f23);
if (this.links.draw(canvas)) {
invalidate();
}
drawProgressLoadingLink(canvas, -1);
if (this.highlightPath != null) {
float currentTimeMillis = ((float) (System.currentTimeMillis() - this.highlightPathStart)) / 850.0f;
if (currentTimeMillis > 1.0f) {
this.highlightPath = null;
} else {
int alpha2 = Theme.chat_textSearchSelectionPaint.getAlpha();
float f24 = currentTimeMillis * 4.0f;
Theme.chat_textSearchSelectionPaint.setAlpha((int) (alpha2 * 0.8f * (1.0f - currentTimeMillis) * f24));
canvas.save();
float interpolation = (AndroidUtilities.overshootInterpolator.getInterpolation(Math.min(1.0f, f24)) * 0.6f) + 0.4f;
LinkPath linkPath = this.highlightPath;
canvas.scale(interpolation, interpolation, linkPath.centerX, linkPath.centerY);
canvas.drawPath(this.highlightPath, Theme.chat_textSearchSelectionPaint);
canvas.restore();
Theme.chat_textSearchSelectionPaint.setAlpha(alpha2);
}
invalidate();
}
if (this.currentMessageObject.type == 5) {
TextPaint textPaint = Theme.chat_timePaint;
int themedColor = getThemedColor(Theme.key_chat_serviceText);
if (isDrawSelectionBackground()) {
i4 = this.currentMessageObject.isOutOwner() ? Theme.key_chat_outTimeSelectedText : Theme.key_chat_inTimeSelectedText;
} else {
i4 = this.currentMessageObject.isOutOwner() ? Theme.key_chat_outTimeText : Theme.key_chat_inTimeText;
}
textPaint.setColor(ColorUtils.blendARGB(themedColor, getThemedColor(i4), getVideoTranscriptionProgress()));
}
canvas.restore();
if (!z2) {
drawMessageText(f18, f23, canvas, textLayoutBlocks.textLayoutBlocks, textLayoutBlocks.textXOffset, z, f, true, false, true);
}
if (i3 != Integer.MIN_VALUE) {
canvas.restoreToCount(i3);
}
canvas.restore();
return;
}
return;
}
return;
}
}
if (isDrawSelectionBackground()) {
Theme.chat_replyLinePaint.setColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outVoiceSeekbarSelected : Theme.key_chat_inVoiceSeekbarSelected));
} else {
Theme.chat_replyLinePaint.setColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outVoiceSeekbar : Theme.key_chat_inVoiceSeekbar));
}
float dp9 = this.layoutHeight - AndroidUtilities.dp(f6);
TransitionParams transitionParams4 = this.transitionParams;
float f25 = dp9 + transitionParams4.deltaBottom;
MessageObject.GroupedMessages groupedMessages4 = this.currentMessagesGroup;
if (groupedMessages4 != null) {
MessageObject.GroupedMessages.TransitionParams transitionParams5 = groupedMessages4.transitionParams;
f25 += transitionParams5.offsetBottom;
if (transitionParams5.backgroundChangeBounds) {
f25 -= getTranslationY();
}
} else {
dp2 = (i + ((int) ((this.backgroundWidth - transitionParams4.deltaLeft) + transitionParams4.deltaRight))) - AndroidUtilities.dp(12.0f);
}
int i18 = dp2;
float f26 = f25;
Theme.chat_replyLinePaint.setAlpha((int) (r0.getAlpha() * getAlpha()));
int i19 = i;
i8 = i19;
i9 = 3;
canvas.drawLine(i19, f26, i18 - AndroidUtilities.dp(14.0f), f26, Theme.chat_replyLinePaint);
dp2 = i18;
if (this.commentLayout != null) {
}
i2 = 0;
if (!z3) {
}
this.commentArrowX = dp2 - AndroidUtilities.dp(44.0f);
if (this.transitionParams.animateComments) {
}
float dp82 = (f5 - AndroidUtilities.dp(4.0f)) + (!this.pinnedBottom ? AndroidUtilities.dp(2.0f) : i2);
shouldDrawThreadProgress = this.delegate.shouldDrawThreadProgress(this);
long elapsedRealtime2 = SystemClock.elapsedRealtime();
j = elapsedRealtime2 - this.commentProgressLastUpadteTime;
this.commentProgressLastUpadteTime = elapsedRealtime2;
if (j > 17) {
}
if (!shouldDrawThreadProgress) {
}
if (!shouldDrawThreadProgress) {
}
infiniteProgress.setColor(getThemedColor(Theme.key_chat_inInstant));
this.commentProgress.setAlpha(this.commentProgressAlpha);
this.commentProgress.draw(canvas, AndroidUtilities.dp(11.0f) + i10, dp82 + AndroidUtilities.dp(12.0f), this.commentProgressAlpha);
invalidate();
if (shouldDrawThreadProgress) {
}
int intrinsicWidth2 = Theme.chat_commentArrowDrawable.getIntrinsicWidth() / 2;
float f122 = i10 + intrinsicWidth2;
float intrinsicHeight2 = Theme.chat_commentArrowDrawable.getIntrinsicHeight() / 2;
float f132 = dp82 + intrinsicHeight2;
Drawable drawable2 = Theme.chat_commentArrowDrawable;
float f142 = intrinsicWidth2;
float f152 = this.commentProgressAlpha;
drawable2.setBounds((int) (f122 - ((1.0f - f152) * f142)), (int) (f132 - ((1.0f - f152) * intrinsicHeight2)), (int) (f122 + (f142 * (1.0f - f152))), (int) (f132 + (intrinsicHeight2 * (1.0f - f152))));
Theme.chat_commentArrowDrawable.setAlpha((int) ((1.0f - this.commentProgressAlpha) * 255.0f * f));
Theme.chat_commentArrowDrawable.draw(canvas);
if (textLayoutBlocks != null) {
}
}
}
i2 = 0;
if (textLayoutBlocks != null) {
}
}
public void drawProgressLoadingLink(Canvas canvas, int i) {
updateProgressLoadingLink();
ArrayList<LoadingDrawableLocation> arrayList = this.progressLoadingLinkDrawables;
if (arrayList == null || arrayList.isEmpty()) {
return;
}
MessageObject messageObject = this.currentMessageObject;
int themedColor = getThemedColor((messageObject == null || !messageObject.isOutOwner()) ? Theme.key_chat_linkSelectBackground : Theme.key_chat_outLinkSelectBackground);
int i2 = 0;
while (i2 < this.progressLoadingLinkDrawables.size()) {
LoadingDrawableLocation loadingDrawableLocation = this.progressLoadingLinkDrawables.get(i2);
if (loadingDrawableLocation.blockNum == i) {
LoadingDrawable loadingDrawable = loadingDrawableLocation.drawable;
loadingDrawable.setColors(Theme.multAlpha(themedColor, 0.85f), Theme.multAlpha(themedColor, 2.0f), Theme.multAlpha(themedColor, 3.5f), Theme.multAlpha(themedColor, 6.0f));
loadingDrawable.draw(canvas);
invalidate();
if (loadingDrawable.isDisappeared()) {
this.progressLoadingLinkDrawables.remove(i2);
i2--;
}
}
i2++;
}
}
public void updateProgressLoadingLink() {
MessageObject messageObject;
ChatMessageCellDelegate chatMessageCellDelegate = this.delegate;
if (chatMessageCellDelegate == null) {
return;
}
if (!chatMessageCellDelegate.isProgressLoading(this, 1)) {
this.progressLoadingLink = null;
ArrayList<LoadingDrawableLocation> arrayList = this.progressLoadingLinkDrawables;
if (arrayList == null || arrayList.isEmpty()) {
return;
}
for (int i = 0; i < this.progressLoadingLinkDrawables.size(); i++) {
LoadingDrawableLocation loadingDrawableLocation = this.progressLoadingLinkDrawables.get(i);
if (!loadingDrawableLocation.drawable.isDisappearing()) {
loadingDrawableLocation.drawable.disappear();
}
}
return;
}
CharacterStyle progressLoadingLink = this.delegate.getProgressLoadingLink(this);
if (progressLoadingLink == this.progressLoadingLink) {
return;
}
this.progressLoadingLink = progressLoadingLink;
LoadingDrawable loadingDrawable = this.progressLoadingLinkCurrentDrawable;
if (loadingDrawable != null) {
loadingDrawable.disappear();
this.progressLoadingLinkCurrentDrawable = null;
}
LoadingDrawable loadingDrawable2 = new LoadingDrawable();
this.progressLoadingLinkCurrentDrawable = loadingDrawable2;
loadingDrawable2.setAppearByGradient(true);
LinkPath linkPath = new LinkPath(true);
this.progressLoadingLinkCurrentDrawable.usePath(linkPath);
this.progressLoadingLinkCurrentDrawable.setRadiiDp(5.0f);
LoadingDrawableLocation loadingDrawableLocation2 = new LoadingDrawableLocation(this);
loadingDrawableLocation2.drawable = this.progressLoadingLinkCurrentDrawable;
loadingDrawableLocation2.blockNum = -3;
if (this.progressLoadingLinkDrawables == null) {
this.progressLoadingLinkDrawables = new ArrayList<>();
}
this.progressLoadingLinkDrawables.add(loadingDrawableLocation2);
if (this.progressLoadingLink == null || findProgressLoadingLink(loadingDrawableLocation2, linkPath, this.descriptionLayout, 0.0f, -2)) {
return;
}
MessageObject.TextLayoutBlocks textLayoutBlocks = this.captionLayout;
if ((textLayoutBlocks == null || !findProgressLoadingLink(loadingDrawableLocation2, linkPath, textLayoutBlocks.textLayoutBlocks)) && (messageObject = this.currentMessageObject) != null) {
findProgressLoadingLink(loadingDrawableLocation2, linkPath, messageObject.textLayoutBlocks);
}
}
private boolean findProgressLoadingLink(LoadingDrawableLocation loadingDrawableLocation, LinkPath linkPath, ArrayList<MessageObject.TextLayoutBlock> arrayList) {
if (arrayList == null) {
return false;
}
for (int i = 0; i < arrayList.size(); i++) {
if (findProgressLoadingLink(loadingDrawableLocation, linkPath, arrayList.get(i).textLayout, 0.0f, i)) {
return true;
}
}
return false;
}
private boolean findProgressLoadingLink(LoadingDrawableLocation loadingDrawableLocation, LinkPath linkPath, Layout layout, float f, int i) {
if (layout != null && (layout.getText() instanceof Spanned)) {
Spanned spanned = (Spanned) layout.getText();
CharacterStyle[] characterStyleArr = (CharacterStyle[]) spanned.getSpans(0, spanned.length(), CharacterStyle.class);
if (characterStyleArr != null) {
int i2 = 0;
while (true) {
if (i2 >= characterStyleArr.length) {
break;
}
if (characterStyleArr[i2] == this.progressLoadingLink) {
loadingDrawableLocation.blockNum = i;
break;
}
i2++;
}
}
if (loadingDrawableLocation.blockNum == i) {
linkPath.rewind();
int spanStart = spanned.getSpanStart(this.progressLoadingLink);
int spanEnd = spanned.getSpanEnd(this.progressLoadingLink);
linkPath.setCurrentLayout(layout, spanStart, f);
layout.getSelectionPath(spanStart, spanEnd, linkPath);
this.progressLoadingLinkCurrentDrawable.updateBounds();
return true;
}
}
return false;
}
public boolean needDrawTime() {
MessageObject messageObject;
return !this.forceNotDrawTime && ((messageObject = this.currentMessageObject) == null || messageObject.type != 27);
}
public boolean shouldDrawTimeOnMedia() {
int i = this.overideShouldDrawTimeOnMedia;
if (i != 0) {
return i == 1;
}
if (!this.mediaBackground || this.captionLayout != null) {
return false;
}
ReactionsLayoutInBubble reactionsLayoutInBubble = this.reactionsLayoutInBubble;
if (!reactionsLayoutInBubble.isEmpty && !reactionsLayoutInBubble.isSmall) {
MessageObject messageObject = this.currentMessageObject;
if (messageObject == null) {
return false;
}
if (!messageObject.isAnyKindOfSticker() && !this.currentMessageObject.isRoundVideo()) {
return false;
}
}
return true;
}
public void drawTime(Canvas canvas, float f, boolean z) {
float f2;
float f3;
TransitionParams transitionParams;
float f4;
float f5;
ChatMessageCellDelegate chatMessageCellDelegate;
if (this.drawFromPinchToZoom || (chatMessageCellDelegate = this.delegate) == null || chatMessageCellDelegate.getPinchToZoomHelper() == null || !this.delegate.getPinchToZoomHelper().isInOverlayModeFor(this) || !shouldDrawTimeOnMedia()) {
MessageObject messageObject = this.currentMessageObject;
if (messageObject == null || messageObject.type != 27) {
int i = 0;
while (i < 2) {
if (i != 0 || !isDrawSelectionBackground() || this.currentSelectedBackgroundAlpha != 1.0f || shouldDrawTimeOnMedia()) {
if (i == 1 && ((!isDrawSelectionBackground() && this.currentSelectedBackgroundAlpha == 0.0f) || shouldDrawTimeOnMedia())) {
break;
}
boolean z2 = i == 1;
if (i == 1) {
f3 = this.currentSelectedBackgroundAlpha;
} else if (!shouldDrawTimeOnMedia()) {
f3 = 1.0f - this.currentSelectedBackgroundAlpha;
} else {
f2 = f;
if (!this.transitionParams.animateShouldDrawTimeOnMedia && this.transitionParams.animateChangeProgress != 1.0f) {
if (shouldDrawTimeOnMedia()) {
this.overideShouldDrawTimeOnMedia = 1;
boolean z3 = z2;
drawTimeInternal(canvas, f2 * this.transitionParams.animateChangeProgress, z, this.timeX, this.timeLayout, this.timeWidth, z3);
this.overideShouldDrawTimeOnMedia = 2;
TransitionParams transitionParams2 = this.transitionParams;
drawTimeInternal(canvas, f2 * (1.0f - transitionParams2.animateChangeProgress), z, transitionParams2.animateFromTimeX, transitionParams2.animateTimeLayout, this.transitionParams.animateTimeWidth, z3);
} else {
this.overideShouldDrawTimeOnMedia = 2;
boolean z4 = z2;
drawTimeInternal(canvas, f2 * this.transitionParams.animateChangeProgress, z, this.timeX, this.timeLayout, this.timeWidth, z4);
this.overideShouldDrawTimeOnMedia = 1;
TransitionParams transitionParams3 = this.transitionParams;
drawTimeInternal(canvas, f2 * (1.0f - transitionParams3.animateChangeProgress), z, transitionParams3.animateFromTimeX, transitionParams3.animateTimeLayout, this.transitionParams.animateTimeWidth, z4);
}
this.overideShouldDrawTimeOnMedia = 0;
} else {
transitionParams = this.transitionParams;
if (!transitionParams.shouldAnimateTimeX) {
float f6 = this.timeX;
float f7 = transitionParams.animateChangeProgress;
f5 = (f6 * f7) + (transitionParams.animateFromTimeX * (1.0f - f7));
f4 = (this.timeWidth * f7) + (transitionParams.animateTimeWidth * (1.0f - this.transitionParams.animateChangeProgress));
} else {
float f8 = this.timeX + transitionParams.deltaRight;
f4 = this.timeWidth;
f5 = f8;
}
drawTimeInternal(canvas, f2, z, f5, this.timeLayout, f4, z2);
}
}
f2 = f3 * f;
if (!this.transitionParams.animateShouldDrawTimeOnMedia) {
}
transitionParams = this.transitionParams;
if (!transitionParams.shouldAnimateTimeX) {
}
drawTimeInternal(canvas, f2, z, f5, this.timeLayout, f4, z2);
}
i++;
}
if (this.transitionParams.animateBackgroundBoundsInner) {
MessageObject messageObject2 = this.currentMessageObject;
if (messageObject2 == null || !messageObject2.preview) {
drawOverlays(canvas);
}
}
}
}
}
private void drawTimeInternal(Canvas canvas, float f, boolean z, float f2, StaticLayout staticLayout, float f3, boolean z2) {
int i;
float f4;
float f5;
char c;
String str;
char c2;
boolean z3;
int i2;
int i3;
boolean z4;
float f6;
char c3;
float dp;
boolean z5;
Paint themedPaint;
float f7;
int dp2;
boolean z6;
float imageY2;
int i4;
int i5;
int i6;
float f8;
MessageObject messageObject;
float currentWidth;
int i7;
if (((!this.drawTime || this.groupPhotoInvisible) && shouldDrawTimeOnMedia()) || staticLayout == null) {
return;
}
MessageObject messageObject2 = this.currentMessageObject;
if ((!messageObject2.deleted || this.currentPosition == null) && (i = messageObject2.type) != 16) {
if (i == 5) {
TextPaint textPaint = Theme.chat_timePaint;
int themedColor = getThemedColor(Theme.key_chat_serviceText);
if (isDrawSelectionBackground()) {
i7 = this.currentMessageObject.isOutOwner() ? Theme.key_chat_outTimeSelectedText : Theme.key_chat_inTimeSelectedText;
} else {
i7 = this.currentMessageObject.isOutOwner() ? Theme.key_chat_outTimeText : Theme.key_chat_inTimeText;
}
textPaint.setColor(ColorUtils.blendARGB(themedColor, getThemedColor(i7), getVideoTranscriptionProgress()));
} else if (shouldDrawTimeOnMedia()) {
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
Theme.chat_timePaint.setColor(getThemedColor(Theme.key_chat_serviceText));
} else {
Theme.chat_timePaint.setColor(getThemedColor(Theme.key_chat_mediaTimeText));
}
} else if (this.currentMessageObject.isOutOwner()) {
Theme.chat_timePaint.setColor(getThemedColor(z2 ? Theme.key_chat_outTimeSelectedText : Theme.key_chat_outTimeText));
} else {
Theme.chat_timePaint.setColor(getThemedColor(z2 ? Theme.key_chat_inTimeSelectedText : Theme.key_chat_inTimeText));
}
float f9 = getTransitionParams().animateDrawingTimeAlpha ? getTransitionParams().animateChangeProgress * f : f;
if (f9 != 1.0f) {
Theme.chat_timePaint.setAlpha((int) (r0.getAlpha() * f9));
}
canvas.save();
if (this.drawPinnedBottom && !shouldDrawTimeOnMedia()) {
canvas.translate(0.0f, AndroidUtilities.dp(2.0f));
}
float f10 = this.layoutHeight;
TransitionParams transitionParams = this.transitionParams;
if (transitionParams.animateBackgroundBoundsInner) {
f10 += transitionParams.deltaBottom;
}
if (transitionParams.shouldAnimateTimeX) {
float f11 = transitionParams.animateFromTimeX;
float f12 = transitionParams.animateChangeProgress;
f4 = (f11 * (1.0f - f12)) + (this.timeX * f12);
} else {
f4 = f2;
}
MessageObject.GroupedMessages groupedMessages = this.currentMessagesGroup;
if (groupedMessages == null || !groupedMessages.transitionParams.backgroundChangeBounds) {
f5 = f2;
} else {
f10 -= getTranslationY();
float f13 = this.currentMessagesGroup.transitionParams.offsetRight;
f5 = f2 + f13;
f4 += f13;
}
if (this.drawPinnedBottom && shouldDrawTimeOnMedia()) {
f10 += AndroidUtilities.dp(1.0f);
}
float f14 = f10;
if (this.transitionParams.animateBackgroundBoundsInner) {
float f15 = this.animationOffsetX;
f5 += f15;
f4 += f15;
}
float f16 = f5;
if (this.currentMessageObject.shouldDrawReactions()) {
ReactionsLayoutInBubble reactionsLayoutInBubble = this.reactionsLayoutInBubble;
if (reactionsLayoutInBubble.isSmall) {
TransitionParams transitionParams2 = this.transitionParams;
if (transitionParams2.animateBackgroundBoundsInner && transitionParams2.deltaRight != 0.0f) {
currentWidth = reactionsLayoutInBubble.getCurrentWidth(1.0f);
} else {
currentWidth = reactionsLayoutInBubble.getCurrentWidth(transitionParams2.animateChangeProgress);
}
f4 += currentWidth;
}
}
if (this.transitionParams.animateEditedEnter) {
f4 -= this.transitionParams.animateEditedWidthDiff * (1.0f - this.transitionParams.animateChangeProgress);
}
float f17 = f4;
if (shouldDrawTimeOnMedia()) {
int i8 = -(this.drawCommentButton ? AndroidUtilities.dp(41.3f) : 0);
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
themedPaint = getThemedPaint("paintChatActionBackground");
} else {
themedPaint = getThemedPaint("paintChatTimeBackground");
}
int alpha = themedPaint.getAlpha();
Theme.chat_timePaint.setAlpha((int) (this.timeAlpha * 255.0f * f9));
MessageObject messageObject3 = this.currentMessageObject;
if (messageObject3 == null || messageObject3.type != 4) {
f7 = f9;
} else {
float currentAlpha = this.photoImage.isCrossfadingWithOldImage() ? 1.0f : this.photoImage.getCurrentAlpha();
if (!this.photoImage.hasNotThumb()) {
currentAlpha = 0.0f;
}
f7 = AndroidUtilities.lerp(0.35f, 1.0f, currentAlpha);
}
themedPaint.setAlpha((int) (alpha * this.timeAlpha * f7 * 0.6f));
int i9 = this.documentAttachType;
if (i9 != 7 && i9 != 6 && this.currentMessageObject.type != 19) {
int[] roundRadius = this.photoImage.getRoundRadius();
dp2 = Math.min(AndroidUtilities.dp(8.0f), Math.max(roundRadius[2], roundRadius[3]));
z6 = SharedConfig.bubbleRadius >= 10;
} else {
dp2 = AndroidUtilities.dp(4.0f);
z6 = false;
}
float dp3 = f16 - AndroidUtilities.dp(z6 ? 6.0f : 4.0f);
if (this.documentAttachType != 7 || ((messageObject = this.currentMessageObject) != null && messageObject.isRoundOnce())) {
imageY2 = this.photoImage.getImageY2() + this.additionalTimeOffsetY;
} else {
imageY2 = f14 - ((AndroidUtilities.dp(this.drawPinnedBottom ? 4.0f : 5.0f) + this.reactionsLayoutInBubble.getCurrentTotalHeight(this.transitionParams.animateChangeProgress)) * (1.0f - getVideoTranscriptionProgress()));
}
float f18 = imageY2;
float dp4 = f18 - AndroidUtilities.dp(23.0f);
float max = Math.max(AndroidUtilities.dp(17.0f), Theme.chat_timePaint.getTextSize() + AndroidUtilities.dp(5.0f));
RectF rectF = this.rect;
float f19 = dp3 + f3;
if (z6) {
i4 = 12;
z4 = z6;
} else {
z4 = z6;
i4 = 8;
}
if (this.currentMessageObject.isOutOwner()) {
i5 = i8;
i6 = (this.currentMessageObject.type == 19 ? 4 : 0) + 20;
} else {
i5 = i8;
i6 = 0;
}
rectF.set(dp3, dp4, f19 + AndroidUtilities.dp(i4 + i6), max + dp4);
if (this.currentMessageObject.hasMediaSpoilers() && this.currentMessageObject.type != 5) {
this.rectPath.rewind();
float f20 = dp2;
this.rectPath.addRoundRect(this.rect, f20, f20, Path.Direction.CW);
canvas.save();
canvas.clipPath(this.rectPath);
ImageReceiver imageReceiver = this.currentMessageObject.needDrawBluredPreview() ? this.photoImage : this.blurredPhotoImage;
float alpha2 = imageReceiver.getAlpha();
imageReceiver.setAlpha(0.5f * alpha2);
imageReceiver.draw(canvas);
imageReceiver.setAlpha(alpha2);
canvas.restore();
Paint themedPaint2 = getThemedPaint("paintChatTimeBackground");
int alpha3 = themedPaint2.getAlpha();
themedPaint2.setAlpha((int) (alpha3 * this.controlsAlpha * 0.4f));
canvas.drawRoundRect(this.rect, f20, f20, themedPaint2);
themedPaint2.setAlpha(alpha3);
themedPaint.setAlpha(alpha);
float f21 = -staticLayout.getLineLeft(0);
if (this.currentMessageObject.shouldDrawReactions() && this.reactionsLayoutInBubble.isSmall) {
updateReactionLayoutPosition();
this.reactionsLayoutInBubble.draw(canvas, this.transitionParams.animateChangeProgress, null);
}
if ((ChatObject.isChannel(this.currentChat) || this.currentChat.megagroup) && (this.currentMessageObject.messageOwner.flags & 1024) == 0 && this.repliesLayout == null && !this.isPinned) {
str = "paintChatTimeBackground";
i3 = i5;
z3 = false;
c = 4;
c2 = 7;
} else {
float lineWidth = f21 + (this.timeWidth - staticLayout.getLineWidth(0));
ReactionsLayoutInBubble reactionsLayoutInBubble2 = this.reactionsLayoutInBubble;
if (reactionsLayoutInBubble2.isSmall && !reactionsLayoutInBubble2.isEmpty) {
lineWidth -= reactionsLayoutInBubble2.width;
}
float f22 = lineWidth;
int createStatusDrawableParams = this.transitionParams.createStatusDrawableParams();
int i10 = this.transitionParams.lastStatusDrawableParams;
if (i10 >= 0 && i10 != createStatusDrawableParams && !this.statusDrawableAnimationInProgress) {
createStatusDrawableAnimator(i10, createStatusDrawableParams, z);
}
boolean z7 = this.statusDrawableAnimationInProgress;
if (z7) {
createStatusDrawableParams = this.animateToStatusDrawableParams;
}
boolean z8 = (createStatusDrawableParams & 4) != 0;
boolean z9 = (createStatusDrawableParams & 8) != 0;
if (z7) {
int i11 = this.animateFromStatusDrawableParams;
boolean z10 = (i11 & 4) != 0;
boolean z11 = (i11 & 8) != 0;
int i12 = i5;
float f23 = i12;
f8 = f22;
c = 4;
z3 = false;
float f24 = f9;
i3 = i12;
str = "paintChatTimeBackground";
c2 = 7;
drawClockOrErrorLayout(canvas, z10, z11, f14, f24, f23, f16, 1.0f - this.statusDrawableProgress, z2);
drawClockOrErrorLayout(canvas, z8, z9, f14, f24, f23, f16, this.statusDrawableProgress, z2);
if (!this.currentMessageObject.isOutOwner()) {
if (!z10 && !z11) {
drawViewsAndRepliesLayout(canvas, f14, f9, f23, f16, 1.0f - this.statusDrawableProgress, z2);
}
if (!z8 && !z9) {
drawViewsAndRepliesLayout(canvas, f14, f9, f23, f16, this.statusDrawableProgress, z2);
}
}
} else {
str = "paintChatTimeBackground";
f8 = f22;
i3 = i5;
c = 4;
c2 = 7;
z3 = false;
if (!this.currentMessageObject.isOutOwner() && !z8 && !z9) {
drawViewsAndRepliesLayout(canvas, f14, f9, i3, f16, 1.0f, z2);
}
drawClockOrErrorLayout(canvas, z8, z9, f14, f9, i3, f16, 1.0f, z2);
}
if (this.currentMessageObject.isOutOwner()) {
drawViewsAndRepliesLayout(canvas, f14, f9, i3, f16, 1.0f, z2);
}
TransitionParams transitionParams3 = this.transitionParams;
transitionParams3.lastStatusDrawableParams = transitionParams3.createStatusDrawableParams();
if (z8 && z && getParent() != null) {
((View) getParent()).invalidate();
}
f21 = f8;
}
canvas.save();
float f25 = f17 + f21;
this.drawTimeX = f25;
float dp5 = (f18 - AndroidUtilities.dp(7.3f)) - staticLayout.getHeight();
this.drawTimeY = dp5;
canvas.translate(f25, dp5);
SpoilerEffect.layoutDrawMaybe(staticLayout, canvas);
canvas.restore();
Theme.chat_timePaint.setAlpha(255);
}
applyServiceShaderMatrix();
float f26 = dp2;
canvas.drawRoundRect(this.rect, f26, f26, themedPaint);
if (themedPaint == getThemedPaint("paintChatActionBackground") && hasGradientService()) {
int alpha4 = Theme.chat_actionBackgroundGradientDarkenPaint.getAlpha();
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha((int) (alpha4 * this.timeAlpha * f7));
canvas.drawRoundRect(this.rect, f26, f26, Theme.chat_actionBackgroundGradientDarkenPaint);
Theme.chat_actionBackgroundGradientDarkenPaint.setAlpha(alpha4);
}
themedPaint.setAlpha(alpha);
float f212 = -staticLayout.getLineLeft(0);
if (this.currentMessageObject.shouldDrawReactions()) {
updateReactionLayoutPosition();
this.reactionsLayoutInBubble.draw(canvas, this.transitionParams.animateChangeProgress, null);
}
if (ChatObject.isChannel(this.currentChat)) {
}
str = "paintChatTimeBackground";
i3 = i5;
z3 = false;
c = 4;
c2 = 7;
canvas.save();
float f252 = f17 + f212;
this.drawTimeX = f252;
float dp52 = (f18 - AndroidUtilities.dp(7.3f)) - staticLayout.getHeight();
this.drawTimeY = dp52;
canvas.translate(f252, dp52);
SpoilerEffect.layoutDrawMaybe(staticLayout, canvas);
canvas.restore();
Theme.chat_timePaint.setAlpha(255);
} else {
c = 4;
str = "paintChatTimeBackground";
c2 = 7;
z3 = false;
if (this.currentMessageObject.isSponsored()) {
i2 = -AndroidUtilities.dp(48.0f);
if (this.hasNewLineForTime) {
i2 -= AndroidUtilities.dp(4.0f);
}
} else {
i2 = -(this.drawCommentButton ? AndroidUtilities.dp(43.0f) : 0);
}
i3 = i2;
float f27 = -staticLayout.getLineLeft(0);
if (this.currentMessageObject.shouldDrawReactions() && this.reactionsLayoutInBubble.isSmall) {
updateReactionLayoutPosition();
this.reactionsLayoutInBubble.draw(canvas, this.transitionParams.animateChangeProgress, null);
}
if ((ChatObject.isChannel(this.currentChat) && !this.currentChat.megagroup) || (this.currentMessageObject.messageOwner.flags & 1024) != 0 || this.repliesLayout != null || this.transitionParams.animateReplies || this.isPinned || this.transitionParams.animatePinned) {
float lineWidth2 = f27 + (f3 - staticLayout.getLineWidth(0));
ReactionsLayoutInBubble reactionsLayoutInBubble3 = this.reactionsLayoutInBubble;
if (reactionsLayoutInBubble3.isSmall && !reactionsLayoutInBubble3.isEmpty) {
lineWidth2 -= reactionsLayoutInBubble3.width;
}
float f28 = lineWidth2;
int createStatusDrawableParams2 = this.transitionParams.createStatusDrawableParams();
int i13 = this.transitionParams.lastStatusDrawableParams;
if (i13 >= 0 && i13 != createStatusDrawableParams2 && !this.statusDrawableAnimationInProgress) {
createStatusDrawableAnimator(i13, createStatusDrawableParams2, z);
}
boolean z12 = this.statusDrawableAnimationInProgress;
if (z12) {
createStatusDrawableParams2 = this.animateToStatusDrawableParams;
}
boolean z13 = (createStatusDrawableParams2 & 4) != 0;
boolean z14 = (createStatusDrawableParams2 & 8) != 0;
if (z12) {
int i14 = this.animateFromStatusDrawableParams;
boolean z15 = (i14 & 4) != 0;
boolean z16 = (i14 & 8) != 0;
float f29 = i3;
float f30 = f9;
drawClockOrErrorLayout(canvas, z15, z16, f14, f30, f29, f16, 1.0f - this.statusDrawableProgress, z2);
drawClockOrErrorLayout(canvas, z13, z14, f14, f30, f29, f16, this.statusDrawableProgress, z2);
if (!this.currentMessageObject.isOutOwner()) {
if (!z15 && !z16) {
drawViewsAndRepliesLayout(canvas, f14, f9, f29, f16, 1.0f - this.statusDrawableProgress, z2);
}
if (!z13 && !z14) {
drawViewsAndRepliesLayout(canvas, f14, f9, f29, f16, this.statusDrawableProgress, z2);
}
}
} else {
if (!this.currentMessageObject.isOutOwner() && !z13 && !z14) {
drawViewsAndRepliesLayout(canvas, f14, f9, i3, f16, 1.0f, z2);
}
drawClockOrErrorLayout(canvas, z13, z14, f14, f9, i3, f16, 1.0f, z2);
}
if (this.currentMessageObject.isOutOwner()) {
drawViewsAndRepliesLayout(canvas, f14, f9, i3, f16, 1.0f, z2);
}
TransitionParams transitionParams4 = this.transitionParams;
transitionParams4.lastStatusDrawableParams = transitionParams4.createStatusDrawableParams();
if (z13 && z && getParent() != null) {
((View) getParent()).invalidate();
}
f27 = f28;
}
canvas.save();
if (this.transitionParams.animateEditedEnter) {
TransitionParams transitionParams5 = this.transitionParams;
if (transitionParams5.animateChangeProgress != 1.0f) {
if (transitionParams5.animateEditedLayout != null) {
canvas.translate(f17 + f27, ((f14 - AndroidUtilities.dp((this.pinnedBottom || this.pinnedTop) ? 7.5f : 6.5f)) - staticLayout.getHeight()) + i3);
int alpha5 = Theme.chat_timePaint.getAlpha();
Theme.chat_timePaint.setAlpha((int) (alpha5 * this.transitionParams.animateChangeProgress));
this.transitionParams.animateEditedLayout.draw(canvas);
Theme.chat_timePaint.setAlpha(alpha5);
SpoilerEffect.layoutDrawMaybe(this.transitionParams.animateTimeLayout, canvas);
} else {
int alpha6 = Theme.chat_timePaint.getAlpha();
canvas.save();
float f31 = i3;
canvas.translate(this.transitionParams.animateFromTimeX + f27, ((f14 - AndroidUtilities.dp((this.pinnedBottom || this.pinnedTop) ? 7.5f : 6.5f)) - staticLayout.getHeight()) + f31);
float f32 = alpha6;
Theme.chat_timePaint.setAlpha((int) ((1.0f - this.transitionParams.animateChangeProgress) * f32));
SpoilerEffect.layoutDrawMaybe(this.transitionParams.animateTimeLayout, canvas);
canvas.restore();
canvas.translate(f17 + f27, ((f14 - AndroidUtilities.dp((this.pinnedBottom || this.pinnedTop) ? 7.5f : 6.5f)) - staticLayout.getHeight()) + f31);
Theme.chat_timePaint.setAlpha((int) (f32 * this.transitionParams.animateChangeProgress));
SpoilerEffect.layoutDrawMaybe(staticLayout, canvas);
Theme.chat_timePaint.setAlpha(alpha6);
}
canvas.restore();
z4 = false;
}
}
float f33 = f17 + f27;
this.drawTimeX = f33;
float dp6 = ((f14 - AndroidUtilities.dp((this.pinnedBottom || this.pinnedTop) ? 7.5f : 6.5f)) - staticLayout.getHeight()) + i3;
this.drawTimeY = dp6;
canvas.translate(f33, dp6);
SpoilerEffect.layoutDrawMaybe(staticLayout, canvas);
canvas.restore();
z4 = false;
}
int i15 = i3;
if (this.currentMessageObject.isOutOwner()) {
int createStatusDrawableParams3 = this.transitionParams.createStatusDrawableParams();
int i16 = this.transitionParams.lastStatusDrawableParams;
if (i16 >= 0 && i16 != createStatusDrawableParams3 && !this.statusDrawableAnimationInProgress) {
createStatusDrawableAnimator(i16, createStatusDrawableParams3, z);
}
if (this.statusDrawableAnimationInProgress) {
createStatusDrawableParams3 = this.animateToStatusDrawableParams;
}
boolean z17 = (createStatusDrawableParams3 & 1) != 0 ? true : z3;
boolean z18 = (createStatusDrawableParams3 & 2) != 0 ? true : z3;
boolean z19 = (createStatusDrawableParams3 & 4) != 0 ? true : z3;
boolean z20 = (createStatusDrawableParams3 & 8) != 0 ? true : z3;
if (this.transitionYOffsetForDrawables != 0.0f) {
canvas.save();
canvas.translate(0.0f, this.transitionYOffsetForDrawables);
z5 = true;
} else {
z5 = z3;
}
if (this.statusDrawableAnimationInProgress) {
int i17 = this.animateFromStatusDrawableParams;
boolean z21 = (i17 & 1) != 0 ? true : z3;
boolean z22 = (i17 & 2) != 0 ? true : z3;
boolean z23 = (i17 & 4) != 0 ? true : z3;
boolean z24 = (i17 & 8) != 0 ? true : z3;
if (!z23 && z22 && z18 && !z21 && z17) {
f6 = 0.0f;
c3 = 5;
drawStatusDrawable(canvas, z17, z18, z19, z20, f9, z4, i15, f14, this.statusDrawableProgress, true, z2);
} else {
f6 = 0.0f;
c3 = 5;
float f34 = i15;
boolean z25 = z22;
boolean z26 = z23;
boolean z27 = z24;
float f35 = f9;
boolean z28 = z4;
drawStatusDrawable(canvas, z21, z25, z26, z27, f35, z28, f34, f14, 1.0f - this.statusDrawableProgress, false, z2);
drawStatusDrawable(canvas, z17, z18, z19, z20, f35, z28, f34, f14, this.statusDrawableProgress, false, z2);
}
} else {
f6 = 0.0f;
c3 = 5;
drawStatusDrawable(canvas, z17, z18, z19, z20, f9, z4, i15, f14, 1.0f, false, z2);
}
if (z5) {
canvas.restore();
}
TransitionParams transitionParams6 = this.transitionParams;
transitionParams6.lastStatusDrawableParams = transitionParams6.createStatusDrawableParams();
if (z && z19 && getParent() != null) {
((View) getParent()).invalidate();
}
} else {
f6 = 0.0f;
c3 = 5;
}
canvas.restore();
if (this.unlockLayout != null) {
if (this.unlockX == f6 || this.unlockY == f6) {
calculateUnlockXY();
}
this.unlockSpoilerPath.rewind();
RectF rectF2 = AndroidUtilities.rectTmp;
rectF2.set(this.photoImage.getImageX(), this.photoImage.getImageY(), this.photoImage.getImageX2(), this.photoImage.getImageY2());
int[] roundRadius2 = this.photoImage.getRoundRadius();
float[] fArr = this.unlockSpoilerRadii;
float f36 = roundRadius2[0];
fArr[1] = f36;
fArr[0] = f36;
float f37 = roundRadius2[1];
fArr[3] = f37;
fArr[2] = f37;
float f38 = roundRadius2[2];
fArr[c3] = f38;
fArr[c] = f38;
float f39 = roundRadius2[3];
fArr[c2] = f39;
fArr[6] = f39;
this.unlockSpoilerPath.addRoundRect(rectF2, fArr, Path.Direction.CW);
canvas.save();
canvas.clipPath(this.unlockSpoilerPath);
this.unlockSpoilerPath.rewind();
rectF2.set(this.unlockX - AndroidUtilities.dp(12.0f), this.unlockY - AndroidUtilities.dp(8.0f), this.unlockX + Theme.chat_msgUnlockDrawable.getIntrinsicWidth() + AndroidUtilities.dp(14.0f) + this.unlockLayout.getWidth() + AndroidUtilities.dp(12.0f), this.unlockY + this.unlockLayout.getHeight() + AndroidUtilities.dp(8.0f));
this.unlockSpoilerPath.addRoundRect(rectF2, AndroidUtilities.dp(32.0f), AndroidUtilities.dp(32.0f), Path.Direction.CW);
canvas.clipPath(this.unlockSpoilerPath, Region.Op.DIFFERENCE);
this.unlockSpoilerEffect.setColor(ColorUtils.setAlphaComponent(-1, (int) (Color.alpha(-1) * 0.325f)));
this.unlockSpoilerEffect.setBounds((int) this.photoImage.getImageX(), (int) this.photoImage.getImageY(), (int) this.photoImage.getImageX2(), (int) this.photoImage.getImageY2());
this.unlockSpoilerEffect.draw(canvas);
invalidate();
canvas.restore();
canvas.saveLayerAlpha(0.0f, 0.0f, getWidth(), getHeight(), (int) (this.unlockAlpha * 255.0f), 31);
int alpha7 = Theme.chat_timeBackgroundPaint.getAlpha();
Theme.chat_timeBackgroundPaint.setAlpha((int) (alpha7 * 0.7f));
canvas.drawRoundRect(rectF2, AndroidUtilities.dp(32.0f), AndroidUtilities.dp(32.0f), Theme.chat_timeBackgroundPaint);
Theme.chat_timeBackgroundPaint.setAlpha(alpha7);
canvas.translate(this.unlockX + AndroidUtilities.dp(4.0f), this.unlockY);
Drawable drawable = Theme.chat_msgUnlockDrawable;
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), Theme.chat_msgUnlockDrawable.getIntrinsicHeight());
Theme.chat_msgUnlockDrawable.draw(canvas);
canvas.translate(AndroidUtilities.dp(6.0f) + Theme.chat_msgUnlockDrawable.getIntrinsicWidth(), f6);
SpoilerEffect.layoutDrawMaybe(this.unlockLayout, canvas);
canvas.restore();
if (this.videoInfoLayout != null && this.photoImage.getVisible() && this.imageBackgroundSideColor == 0) {
int i18 = SharedConfig.bubbleRadius;
if (i18 > 2) {
dp = AndroidUtilities.dp(i18 - 2);
z4 = SharedConfig.bubbleRadius >= 10;
} else {
dp = AndroidUtilities.dp(i18);
}
int imageX = (int) (this.photoImage.getImageX() + AndroidUtilities.dp(9.0f));
int imageY = (int) (this.photoImage.getImageY() + AndroidUtilities.dp(6.0f));
this.rect.set(imageX - AndroidUtilities.dp(4.0f), imageY - AndroidUtilities.dp(1.5f), this.durationWidth + imageX + AndroidUtilities.dp(4.0f) + AndroidUtilities.dp(z4 ? 2.0f : f6), this.videoInfoLayout.getHeight() + imageY + AndroidUtilities.dp(1.5f));
canvas.drawRoundRect(this.rect, dp, dp, getThemedPaint(str));
canvas.save();
canvas.translate(imageX + (z4 ? 2 : 0), imageY);
SpoilerEffect.layoutDrawMaybe(this.videoInfoLayout, canvas);
canvas.restore();
}
}
}
}
public void createStatusDrawableAnimator(int i, int i2, final boolean z) {
boolean z2 = false;
boolean z3 = (i2 & 1) != 0;
boolean z4 = (i2 & 2) != 0;
boolean z5 = (i & 1) != 0;
boolean z6 = (i & 2) != 0;
if (!((i & 4) != 0) && z6 && z4 && !z5 && z3) {
z2 = true;
}
if (!this.transitionParams.messageEntering || z2) {
this.statusDrawableProgress = 0.0f;
ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
this.statusDrawableAnimator = ofFloat;
if (z2) {
ofFloat.setDuration(220L);
} else {
ofFloat.setDuration(150L);
}
this.statusDrawableAnimator.setInterpolator(CubicBezierInterpolator.DEFAULT);
this.animateFromStatusDrawableParams = i;
this.animateToStatusDrawableParams = i2;
this.statusDrawableAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
ChatMessageCell.this.lambda$createStatusDrawableAnimator$12(z, valueAnimator);
}
});
this.statusDrawableAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
int createStatusDrawableParams = ChatMessageCell.this.transitionParams.createStatusDrawableParams();
if (ChatMessageCell.this.animateToStatusDrawableParams == createStatusDrawableParams) {
ChatMessageCell.this.statusDrawableAnimationInProgress = false;
ChatMessageCell chatMessageCell = ChatMessageCell.this;
chatMessageCell.transitionParams.lastStatusDrawableParams = chatMessageCell.animateToStatusDrawableParams;
return;
}
ChatMessageCell chatMessageCell2 = ChatMessageCell.this;
chatMessageCell2.createStatusDrawableAnimator(chatMessageCell2.animateToStatusDrawableParams, createStatusDrawableParams, z);
}
});
this.statusDrawableAnimationInProgress = true;
this.statusDrawableAnimator.start();
}
}
public void lambda$createStatusDrawableAnimator$12(boolean z, ValueAnimator valueAnimator) {
this.statusDrawableProgress = ((Float) valueAnimator.getAnimatedValue()).floatValue();
invalidate();
if (!z || getParent() == null) {
return;
}
((View) getParent()).invalidate();
}
private void drawClockOrErrorLayout(Canvas canvas, boolean z, boolean z2, float f, float f2, float f3, float f4, float f5, boolean z3) {
float dp;
float currentTotalHeight;
int themedColor;
float dp2;
float dp3;
boolean z4 = f5 != 1.0f;
float f6 = (f5 * 0.5f) + 0.5f;
float f7 = f2 * f5;
if (z) {
if (this.currentMessageObject.isOutOwner()) {
return;
}
MsgClockDrawable msgClockDrawable = Theme.chat_msgClockDrawable;
if (shouldDrawTimeOnMedia()) {
themedColor = getThemedColor(Theme.key_chat_mediaSentClock);
} else {
themedColor = getThemedColor(z3 ? Theme.key_chat_outSentClockSelected : Theme.key_chat_mediaSentClock);
}
msgClockDrawable.setColor(themedColor);
if (shouldDrawTimeOnMedia()) {
dp2 = this.photoImage.getImageY2() + this.additionalTimeOffsetY;
dp3 = AndroidUtilities.dp(9.0f);
} else {
dp2 = (f - AndroidUtilities.dp((this.pinnedBottom || this.pinnedTop) ? 9.5f : 8.5f)) + f3;
if (this.isRoundVideo) {
dp3 = (AndroidUtilities.dp(this.drawPinnedBottom ? 4.0f : 5.0f) + this.reactionsLayoutInBubble.getCurrentTotalHeight(this.transitionParams.animateChangeProgress)) * (1.0f - getVideoTranscriptionProgress());
}
BaseCell.setDrawableBounds(msgClockDrawable, f4 + (this.currentMessageObject.scheduled ? 0 : AndroidUtilities.dp(11.0f)), dp2 - msgClockDrawable.getIntrinsicHeight());
msgClockDrawable.setAlpha((int) (f7 * 255.0f));
if (z4) {
canvas.save();
canvas.scale(f6, f6, msgClockDrawable.getBounds().centerX(), msgClockDrawable.getBounds().centerY());
}
msgClockDrawable.draw(canvas);
msgClockDrawable.setAlpha(255);
invalidate();
if (z4) {
return;
}
canvas.restore();
return;
}
dp2 -= dp3;
BaseCell.setDrawableBounds(msgClockDrawable, f4 + (this.currentMessageObject.scheduled ? 0 : AndroidUtilities.dp(11.0f)), dp2 - msgClockDrawable.getIntrinsicHeight());
msgClockDrawable.setAlpha((int) (f7 * 255.0f));
if (z4) {
}
msgClockDrawable.draw(canvas);
msgClockDrawable.setAlpha(255);
invalidate();
if (z4) {
}
} else {
if (!z2 || this.currentMessageObject.isOutOwner()) {
return;
}
float dp4 = f4 + (this.currentMessageObject.scheduled ? 0 : AndroidUtilities.dp(11.0f));
float f8 = 21.5f;
if (shouldDrawTimeOnMedia()) {
dp = this.photoImage.getImageY2() + this.additionalTimeOffsetY;
currentTotalHeight = AndroidUtilities.dp(21.5f);
} else {
if (!this.pinnedBottom && !this.pinnedTop) {
f8 = 20.5f;
}
dp = (f - AndroidUtilities.dp(f8)) + f3;
if (this.isRoundVideo) {
currentTotalHeight = this.reactionsLayoutInBubble.getCurrentTotalHeight(this.transitionParams.animateChangeProgress) * (1.0f - getVideoTranscriptionProgress());
}
this.rect.set(dp4, dp, AndroidUtilities.dp(14.0f) + dp4, AndroidUtilities.dp(14.0f) + dp);
int alpha = Theme.chat_msgErrorPaint.getAlpha();
int i = (int) (f7 * 255.0f);
Theme.chat_msgErrorPaint.setAlpha(i);
if (z4) {
canvas.save();
canvas.scale(f6, f6, this.rect.centerX(), this.rect.centerY());
}
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(1.0f), AndroidUtilities.dp(1.0f), Theme.chat_msgErrorPaint);
Theme.chat_msgErrorPaint.setAlpha(alpha);
Drawable themedDrawable = getThemedDrawable("drawableMsgError");
BaseCell.setDrawableBounds(themedDrawable, dp4 + AndroidUtilities.dp(6.0f), dp + AndroidUtilities.dp(2.0f));
themedDrawable.setAlpha(i);
themedDrawable.draw(canvas);
themedDrawable.setAlpha(255);
if (z4) {
return;
}
canvas.restore();
return;
}
dp -= currentTotalHeight;
this.rect.set(dp4, dp, AndroidUtilities.dp(14.0f) + dp4, AndroidUtilities.dp(14.0f) + dp);
int alpha2 = Theme.chat_msgErrorPaint.getAlpha();
int i2 = (int) (f7 * 255.0f);
Theme.chat_msgErrorPaint.setAlpha(i2);
if (z4) {
}
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(1.0f), AndroidUtilities.dp(1.0f), Theme.chat_msgErrorPaint);
Theme.chat_msgErrorPaint.setAlpha(alpha2);
Drawable themedDrawable2 = getThemedDrawable("drawableMsgError");
BaseCell.setDrawableBounds(themedDrawable2, dp4 + AndroidUtilities.dp(6.0f), dp + AndroidUtilities.dp(2.0f));
themedDrawable2.setAlpha(i2);
themedDrawable2.draw(canvas);
themedDrawable2.setAlpha(255);
if (z4) {
}
}
}
private void drawViewsAndRepliesLayout(Canvas canvas, float f, float f2, float f3, float f4, float f5, boolean z) {
float dp;
float dp2;
float f6;
boolean z2;
TransitionParams transitionParams;
MessageObject.GroupedMessages groupedMessages;
Drawable themedDrawable;
float f7;
float f8;
float f9;
float f10;
StaticLayout staticLayout;
float f11;
MessageObject.GroupedMessages groupedMessages2;
Drawable themedDrawable2;
float drawableBounds;
Drawable themedDrawable3;
boolean z3 = f5 != 1.0f;
float f12 = (f5 * 0.5f) + 0.5f;
float f13 = f2 * f5;
ReactionsLayoutInBubble reactionsLayoutInBubble = this.reactionsLayoutInBubble;
float currentWidth = reactionsLayoutInBubble.isSmall ? reactionsLayoutInBubble.getCurrentWidth(1.0f) : 0.0f;
int alpha = Theme.chat_timePaint.getAlpha();
if (shouldDrawTimeOnMedia() && this.documentAttachType != 7) {
dp = (this.photoImage.getImageY2() + this.additionalTimeOffsetY) - AndroidUtilities.dp(7.3f);
dp2 = this.timeLayout.getHeight();
} else {
dp = ((f - AndroidUtilities.dp((this.pinnedBottom || this.pinnedTop) ? 7.5f : 6.5f)) - this.timeLayout.getHeight()) + f3;
if (this.isRoundVideo) {
dp2 = (AndroidUtilities.dp(this.drawPinnedBottom ? 4.0f : 5.0f) + this.reactionsLayoutInBubble.getCurrentTotalHeight(this.transitionParams.animateChangeProgress)) * (1.0f - getVideoTranscriptionProgress());
}
if (this.repliesLayout == null || this.transitionParams.animateReplies) {
TransitionParams transitionParams2 = this.transitionParams;
f6 = (!transitionParams2.shouldAnimateTimeX ? this.timeX : f4) + currentWidth;
z2 = (transitionParams2.animateReplies || this.transitionParams.animateRepliesLayout != null || this.repliesLayout == null) ? false : true;
boolean z4 = (this.transitionParams.animateReplies || this.transitionParams.animateRepliesLayout == null || this.repliesLayout != null) ? false : true;
boolean z5 = (this.transitionParams.animateReplies || this.transitionParams.animateRepliesLayout == null || this.repliesLayout == null) ? false : true;
if (this.isRoundVideo || !this.transitionParams.animateDrawBackground) {
transitionParams = this.transitionParams;
if (transitionParams.shouldAnimateTimeX || z2) {
f6 += transitionParams.deltaRight;
} else if (z4) {
f6 = transitionParams.animateFromTimeXReplies;
} else {
float f14 = transitionParams.animateFromTimeXReplies;
float f15 = this.transitionParams.animateChangeProgress;
f6 = (f6 * f15) + (f14 * (1.0f - f15));
}
}
groupedMessages = this.currentMessagesGroup;
if (groupedMessages != null) {
MessageObject.GroupedMessages.TransitionParams transitionParams3 = groupedMessages.transitionParams;
if (transitionParams3.backgroundChangeBounds) {
f6 += transitionParams3.offsetRight;
}
}
if (this.transitionParams.animateBackgroundBoundsInner) {
f6 += this.animationOffsetX;
}
if (!shouldDrawTimeOnMedia()) {
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
themedDrawable = getThemedDrawable("drawableMsgStickerReplies");
} else {
themedDrawable = Theme.chat_msgMediaRepliesDrawable;
}
} else if (!this.currentMessageObject.isOutOwner()) {
themedDrawable = z ? Theme.chat_msgInRepliesSelectedDrawable : Theme.chat_msgInRepliesDrawable;
} else {
themedDrawable = getThemedDrawable("drawableMsgOutReplies");
}
float drawableBounds2 = BaseCell.setDrawableBounds(themedDrawable, f6, dp, Theme.chat_timePaint.getTextSize());
if (!z2) {
f8 = this.transitionParams.animateChangeProgress;
} else if (z4) {
f8 = 1.0f - this.transitionParams.animateChangeProgress;
} else {
f7 = f13;
themedDrawable.setAlpha((int) (f7 * 255.0f));
if (z3) {
canvas.save();
canvas.scale(f12, f12, (((AndroidUtilities.dp(3.0f) + drawableBounds2) + this.repliesTextWidth) / 2.0f) + f6, themedDrawable.getBounds().centerY());
}
themedDrawable.draw(canvas);
themedDrawable.setAlpha(255);
if (this.transitionParams.animateReplies) {
if (z5) {
canvas.save();
f9 = f13;
f10 = f12;
Theme.chat_timePaint.setAlpha((int) (alpha * (1.0d - this.transitionParams.animateChangeProgress)));
canvas.translate(f6 + drawableBounds2 + AndroidUtilities.dp(3.0f), dp);
this.transitionParams.animateRepliesLayout.draw(canvas);
canvas.restore();
} else {
f9 = f13;
f10 = f12;
}
Theme.chat_timePaint.setAlpha((int) (alpha * f7));
} else {
f9 = f13;
f10 = f12;
}
canvas.save();
canvas.translate(f6 + drawableBounds2 + AndroidUtilities.dp(3.0f), dp);
staticLayout = this.repliesLayout;
if (staticLayout != null) {
staticLayout.draw(canvas);
} else if (this.transitionParams.animateRepliesLayout != null) {
this.transitionParams.animateRepliesLayout.draw(canvas);
}
canvas.restore();
if (this.repliesLayout != null) {
currentWidth += drawableBounds2 + this.repliesTextWidth + AndroidUtilities.dp(10.0f);
}
if (z3) {
canvas.restore();
}
if (this.transitionParams.animateReplies) {
Theme.chat_timePaint.setAlpha(alpha);
}
this.transitionParams.lastTimeXReplies = f6;
}
f7 = f8 * f13;
themedDrawable.setAlpha((int) (f7 * 255.0f));
if (z3) {
}
themedDrawable.draw(canvas);
themedDrawable.setAlpha(255);
if (this.transitionParams.animateReplies) {
}
canvas.save();
canvas.translate(f6 + drawableBounds2 + AndroidUtilities.dp(3.0f), dp);
staticLayout = this.repliesLayout;
if (staticLayout != null) {
}
canvas.restore();
if (this.repliesLayout != null) {
}
if (z3) {
}
if (this.transitionParams.animateReplies) {
}
this.transitionParams.lastTimeXReplies = f6;
} else {
f9 = f13;
f10 = f12;
}
if (this.viewsLayout == null) {
TransitionParams transitionParams4 = this.transitionParams;
boolean z6 = transitionParams4.shouldAnimateTimeX;
float f16 = (z6 ? this.timeX : f4) + currentWidth;
if (!this.isRoundVideo || !transitionParams4.animateDrawBackground) {
if (!z6) {
f16 += transitionParams4.deltaRight;
} else {
float f17 = transitionParams4.animateFromTimeXViews;
float f18 = this.transitionParams.animateChangeProgress;
f16 = (f16 * f18) + (f17 * (1.0f - f18));
}
}
MessageObject.GroupedMessages groupedMessages3 = this.currentMessagesGroup;
if (groupedMessages3 != null) {
MessageObject.GroupedMessages.TransitionParams transitionParams5 = groupedMessages3.transitionParams;
if (transitionParams5.backgroundChangeBounds) {
f16 += transitionParams5.offsetRight;
}
}
if (this.transitionParams.animateBackgroundBoundsInner) {
f16 += this.animationOffsetX;
}
if (shouldDrawTimeOnMedia()) {
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
themedDrawable3 = getThemedDrawable("drawableMsgStickerViews");
} else {
themedDrawable3 = Theme.chat_msgMediaViewsDrawable;
}
} else if (!this.currentMessageObject.isOutOwner()) {
themedDrawable3 = z ? Theme.chat_msgInViewsSelectedDrawable : Theme.chat_msgInViewsDrawable;
} else {
themedDrawable3 = getThemedDrawable(z ? "drawableMsgOutViewsSelected" : "drawableMsgOutViews");
}
float drawableBounds3 = BaseCell.setDrawableBounds(themedDrawable3, f16, AndroidUtilities.dp(1.5f) + dp, Theme.chat_timePaint.getTextSize() - AndroidUtilities.dp(2.0f));
if (z3) {
canvas.save();
f11 = f10;
canvas.scale(f11, f11, (((themedDrawable3.getIntrinsicWidth() + AndroidUtilities.dp(3.0f)) + this.viewsTextWidth) / 2.0f) + f16, themedDrawable3.getBounds().centerY());
} else {
f11 = f10;
}
themedDrawable3.setAlpha((int) (f9 * 255.0f));
themedDrawable3.draw(canvas);
themedDrawable3.setAlpha(255);
if (this.transitionParams.animateViewsLayout != null) {
canvas.save();
Theme.chat_timePaint.setAlpha((int) (alpha * (1.0d - this.transitionParams.animateChangeProgress)));
canvas.translate(f16 + drawableBounds3 + AndroidUtilities.dp(3.0f), dp);
SpoilerEffect.layoutDrawMaybe(this.transitionParams.animateViewsLayout, canvas);
canvas.restore();
Theme.chat_timePaint.setAlpha((int) (alpha * this.transitionParams.animateChangeProgress));
}
canvas.save();
canvas.translate(f16 + drawableBounds3 + AndroidUtilities.dp(3.0f), dp);
SpoilerEffect.layoutDrawMaybe(this.viewsLayout, canvas);
canvas.restore();
if (z3) {
canvas.restore();
}
currentWidth += this.viewsTextWidth + drawableBounds3 + AndroidUtilities.dp(10.0f);
if (this.transitionParams.animateViewsLayout != null) {
Theme.chat_timePaint.setAlpha(alpha);
}
this.transitionParams.lastTimeXViews = f16;
} else {
f11 = f10;
}
if (!this.isPinned || this.transitionParams.animatePinned) {
TransitionParams transitionParams6 = this.transitionParams;
float f19 = (!transitionParams6.shouldAnimateTimeX ? this.timeX : f4) + currentWidth;
boolean z7 = !transitionParams6.animatePinned && this.isPinned;
boolean z8 = (this.transitionParams.animatePinned || this.isPinned) ? false : true;
if (!this.isRoundVideo) {
TransitionParams transitionParams7 = this.transitionParams;
if (!transitionParams7.shouldAnimateTimeX || z7) {
f19 += transitionParams7.deltaRight;
} else if (z8) {
f19 = transitionParams7.animateFromTimeXPinned;
} else {
float f20 = transitionParams7.animateFromTimeXPinned;
float f21 = transitionParams7.animateChangeProgress;
f19 = (f19 * f21) + (f20 * (1.0f - f21));
}
}
groupedMessages2 = this.currentMessagesGroup;
if (groupedMessages2 != null) {
MessageObject.GroupedMessages.TransitionParams transitionParams8 = groupedMessages2.transitionParams;
if (transitionParams8.backgroundChangeBounds) {
f19 += transitionParams8.offsetRight;
}
}
if (this.transitionParams.animateBackgroundBoundsInner) {
f19 += this.animationOffsetX;
}
if (!shouldDrawTimeOnMedia()) {
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
themedDrawable2 = getThemedDrawable("drawableMsgStickerPinned");
} else {
themedDrawable2 = Theme.chat_msgMediaPinnedDrawable;
}
} else if (!this.currentMessageObject.isOutOwner()) {
themedDrawable2 = z ? Theme.chat_msgInPinnedSelectedDrawable : Theme.chat_msgInPinnedDrawable;
} else {
themedDrawable2 = getThemedDrawable(z ? "drawableMsgOutPinnedSelected" : "drawableMsgOutPinned");
}
if (!this.transitionParams.animatePinned) {
if (this.isPinned) {
themedDrawable2.setAlpha((int) (f9 * 255.0f * this.transitionParams.animateChangeProgress));
drawableBounds = BaseCell.setDrawableBounds(themedDrawable2, f19, dp, Theme.chat_timePaint.getTextSize() + AndroidUtilities.dp(1.0f));
} else {
themedDrawable2.setAlpha((int) (f9 * 255.0f * (1.0f - this.transitionParams.animateChangeProgress)));
drawableBounds = BaseCell.setDrawableBounds(themedDrawable2, f19, dp, Theme.chat_timePaint.getTextSize() + AndroidUtilities.dp(1.0f));
}
} else {
themedDrawable2.setAlpha((int) (f9 * 255.0f));
drawableBounds = BaseCell.setDrawableBounds(themedDrawable2, f19, dp, Theme.chat_timePaint.getTextSize() + AndroidUtilities.dp(1.0f));
}
if (z3) {
canvas.save();
canvas.scale(f11, f11, (drawableBounds / 2.0f) + f19, themedDrawable2.getBounds().centerY());
}
themedDrawable2.draw(canvas);
themedDrawable2.setAlpha(255);
if (z3) {
canvas.restore();
}
this.transitionParams.lastTimeXPinned = f19;
}
return;
}
dp -= dp2;
if (this.repliesLayout == null) {
}
TransitionParams transitionParams22 = this.transitionParams;
f6 = (!transitionParams22.shouldAnimateTimeX ? this.timeX : f4) + currentWidth;
if (transitionParams22.animateReplies) {
}
if (this.transitionParams.animateReplies) {
}
if (this.transitionParams.animateReplies) {
}
if (this.isRoundVideo) {
}
transitionParams = this.transitionParams;
if (transitionParams.shouldAnimateTimeX) {
}
f6 += transitionParams.deltaRight;
groupedMessages = this.currentMessagesGroup;
if (groupedMessages != null) {
}
if (this.transitionParams.animateBackgroundBoundsInner) {
}
if (!shouldDrawTimeOnMedia()) {
}
float drawableBounds22 = BaseCell.setDrawableBounds(themedDrawable, f6, dp, Theme.chat_timePaint.getTextSize());
if (!z2) {
}
f7 = f8 * f13;
themedDrawable.setAlpha((int) (f7 * 255.0f));
if (z3) {
}
themedDrawable.draw(canvas);
themedDrawable.setAlpha(255);
if (this.transitionParams.animateReplies) {
}
canvas.save();
canvas.translate(f6 + drawableBounds22 + AndroidUtilities.dp(3.0f), dp);
staticLayout = this.repliesLayout;
if (staticLayout != null) {
}
canvas.restore();
if (this.repliesLayout != null) {
}
if (z3) {
}
if (this.transitionParams.animateReplies) {
}
this.transitionParams.lastTimeXReplies = f6;
if (this.viewsLayout == null) {
}
if (this.isPinned) {
}
TransitionParams transitionParams62 = this.transitionParams;
float f192 = (!transitionParams62.shouldAnimateTimeX ? this.timeX : f4) + currentWidth;
if (transitionParams62.animatePinned) {
}
if (this.transitionParams.animatePinned) {
}
if (!this.isRoundVideo) {
}
groupedMessages2 = this.currentMessagesGroup;
if (groupedMessages2 != null) {
}
if (this.transitionParams.animateBackgroundBoundsInner) {
}
if (!shouldDrawTimeOnMedia()) {
}
if (!this.transitionParams.animatePinned) {
}
if (z3) {
}
themedDrawable2.draw(canvas);
themedDrawable2.setAlpha(255);
if (z3) {
}
this.transitionParams.lastTimeXPinned = f192;
}
private void drawStatusDrawable(Canvas canvas, boolean z, boolean z2, boolean z3, boolean z4, float f, boolean z5, float f2, float f3, float f4, boolean z6, boolean z7) {
float imageY2;
int dp;
int dp2;
Drawable themedDrawable;
Drawable drawable;
int i;
MessageObject messageObject;
boolean z8 = (f4 == 1.0f || z6) ? false : true;
float f5 = (f4 * 0.5f) + 0.5f;
float f6 = z8 ? f * f4 : f;
if (this.documentAttachType != 7 || ((messageObject = this.currentMessageObject) != null && messageObject.isRoundOnce())) {
imageY2 = this.photoImage.getImageY2() + this.additionalTimeOffsetY;
} else {
imageY2 = f3 - ((AndroidUtilities.dp(this.drawPinnedBottom ? 4.0f : 5.0f) + this.reactionsLayoutInBubble.getCurrentTotalHeight(this.transitionParams.animateChangeProgress)) * (1.0f - getVideoTranscriptionProgress()));
}
float dp3 = imageY2 - AndroidUtilities.dp(8.5f);
if (z3) {
MsgClockDrawable msgClockDrawable = Theme.chat_msgClockDrawable;
if (shouldDrawTimeOnMedia()) {
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
i = getThemedColor(Theme.key_chat_serviceText);
BaseCell.setDrawableBounds(msgClockDrawable, (this.layoutWidth - AndroidUtilities.dp(z5 ? 24.0f : 22.0f)) - msgClockDrawable.getIntrinsicWidth(), (dp3 - msgClockDrawable.getIntrinsicHeight()) + f2);
msgClockDrawable.setAlpha((int) (this.timeAlpha * 255.0f * f6));
} else {
i = getThemedColor(Theme.key_chat_mediaSentClock);
BaseCell.setDrawableBounds(msgClockDrawable, (this.layoutWidth - AndroidUtilities.dp(z5 ? 24.0f : 22.0f)) - msgClockDrawable.getIntrinsicWidth(), (dp3 - msgClockDrawable.getIntrinsicHeight()) + f2);
msgClockDrawable.setAlpha((int) (f6 * 255.0f));
}
} else {
int themedColor = getThemedColor(Theme.key_chat_outSentClock);
BaseCell.setDrawableBounds(msgClockDrawable, (this.layoutWidth - AndroidUtilities.dp(18.5f)) - msgClockDrawable.getIntrinsicWidth(), ((f3 - AndroidUtilities.dp(8.5f)) - msgClockDrawable.getIntrinsicHeight()) + f2);
msgClockDrawable.setAlpha((int) (f6 * 255.0f));
i = themedColor;
}
msgClockDrawable.setColor(i);
if (z8) {
canvas.save();
canvas.scale(f5, f5, msgClockDrawable.getBounds().centerX(), msgClockDrawable.getBounds().centerY());
}
msgClockDrawable.draw(canvas);
msgClockDrawable.setAlpha(255);
if (z8) {
canvas.restore();
}
invalidate();
}
float f7 = 9.0f;
if (z2) {
if (shouldDrawTimeOnMedia()) {
if (z6) {
canvas.save();
}
if (this.currentMessageObject.shouldDrawWithoutBackground()) {
drawable = getThemedDrawable("drawableMsgStickerCheck");
if (z) {
if (z6) {
canvas.translate(AndroidUtilities.dp(4.8f) * (1.0f - f4), 0.0f);
}
BaseCell.setDrawableBounds(drawable, (this.layoutWidth - AndroidUtilities.dp(z5 ? 28.3f : 26.3f)) - drawable.getIntrinsicWidth(), (dp3 - drawable.getIntrinsicHeight()) + f2);
} else {
BaseCell.setDrawableBounds(drawable, (this.layoutWidth - AndroidUtilities.dp(z5 ? 23.5f : 21.5f)) - drawable.getIntrinsicWidth(), (dp3 - drawable.getIntrinsicHeight()) + f2);
}
drawable.setAlpha((int) (this.timeAlpha * 255.0f * f6));
} else {
if (z) {
if (z6) {
canvas.translate(AndroidUtilities.dp(4.8f) * (1.0f - f4), 0.0f);
}
BaseCell.setDrawableBounds(Theme.chat_msgMediaCheckDrawable, (this.layoutWidth - AndroidUtilities.dp(z5 ? 28.3f : 26.3f)) - Theme.chat_msgMediaCheckDrawable.getIntrinsicWidth(), (dp3 - Theme.chat_msgMediaCheckDrawable.getIntrinsicHeight()) + f2);
} else {
BaseCell.setDrawableBounds(Theme.chat_msgMediaCheckDrawable, (this.layoutWidth - AndroidUtilities.dp(z5 ? 23.5f : 21.5f)) - Theme.chat_msgMediaCheckDrawable.getIntrinsicWidth(), (dp3 - Theme.chat_msgMediaCheckDrawable.getIntrinsicHeight()) + f2);
}
Theme.chat_msgMediaCheckDrawable.setAlpha((int) (this.timeAlpha * 255.0f * f6));
drawable = Theme.chat_msgMediaCheckDrawable;
}
if (z8) {
canvas.save();
canvas.scale(f5, f5, drawable.getBounds().centerX(), drawable.getBounds().centerY());
}
drawable.draw(canvas);
if (z8) {
canvas.restore();
}
if (z6) {
canvas.restore();
}
drawable.setAlpha(255);
} else {
if (z6) {
canvas.save();
}
if (z) {
if (z6) {
canvas.translate(AndroidUtilities.dp(4.0f) * (1.0f - f4), 0.0f);
}
themedDrawable = getThemedDrawable(z7 ? "drawableMsgOutCheckReadSelected" : "drawableMsgOutCheckRead");
BaseCell.setDrawableBounds(themedDrawable, (this.layoutWidth - AndroidUtilities.dp(22.5f)) - themedDrawable.getIntrinsicWidth(), ((f3 - AndroidUtilities.dp((this.pinnedBottom || this.pinnedTop) ? 9.0f : 8.0f)) - themedDrawable.getIntrinsicHeight()) + f2);
} else {
themedDrawable = getThemedDrawable(z7 ? "drawableMsgOutCheckSelected" : "drawableMsgOutCheck");
BaseCell.setDrawableBounds(themedDrawable, (this.layoutWidth - AndroidUtilities.dp(18.5f)) - themedDrawable.getIntrinsicWidth(), ((f3 - AndroidUtilities.dp((this.pinnedBottom || this.pinnedTop) ? 9.0f : 8.0f)) - themedDrawable.getIntrinsicHeight()) + f2);
}
themedDrawable.setAlpha((int) (f6 * 255.0f));
if (z8) {
canvas.save();
canvas.scale(f5, f5, themedDrawable.getBounds().centerX(), themedDrawable.getBounds().centerY());
}
themedDrawable.draw(canvas);
if (z8) {
canvas.restore();
}
if (z6) {
canvas.restore();
}
themedDrawable.setAlpha(255);
}
}
if (z) {
if (shouldDrawTimeOnMedia()) {
Drawable themedDrawable2 = this.currentMessageObject.shouldDrawWithoutBackground() ? getThemedDrawable("drawableMsgStickerHalfCheck") : Theme.chat_msgMediaHalfCheckDrawable;
BaseCell.setDrawableBounds(themedDrawable2, (this.layoutWidth - AndroidUtilities.dp(z5 ? 23.5f : 21.5f)) - themedDrawable2.getIntrinsicWidth(), (dp3 - themedDrawable2.getIntrinsicHeight()) + f2);
themedDrawable2.setAlpha((int) (this.timeAlpha * 255.0f * f6));
if (z8 || z6) {
canvas.save();
canvas.scale(f5, f5, themedDrawable2.getBounds().centerX(), themedDrawable2.getBounds().centerY());
}
themedDrawable2.draw(canvas);
if (z8 || z6) {
canvas.restore();
}
themedDrawable2.setAlpha(255);
} else {
Drawable themedDrawable3 = getThemedDrawable(z7 ? "drawableMsgOutHalfCheckSelected" : "drawableMsgOutHalfCheck");
float dp4 = (this.layoutWidth - AndroidUtilities.dp(18.0f)) - themedDrawable3.getIntrinsicWidth();
if (!this.pinnedBottom && !this.pinnedTop) {
f7 = 8.0f;
}
BaseCell.setDrawableBounds(themedDrawable3, dp4, ((f3 - AndroidUtilities.dp(f7)) - themedDrawable3.getIntrinsicHeight()) + f2);
themedDrawable3.setAlpha((int) (f6 * 255.0f));
if (z8 || z6) {
canvas.save();
canvas.scale(f5, f5, themedDrawable3.getBounds().centerX(), themedDrawable3.getBounds().centerY());
}
themedDrawable3.draw(canvas);
if (z8 || z6) {
canvas.restore();
}
themedDrawable3.setAlpha(255);
}
}
if (z4) {
if (shouldDrawTimeOnMedia()) {
dp = this.layoutWidth - AndroidUtilities.dp(34.5f);
dp2 = AndroidUtilities.dp(26.5f);
} else {
dp = this.layoutWidth - AndroidUtilities.dp(32.0f);
dp2 = AndroidUtilities.dp((this.pinnedBottom || this.pinnedTop) ? 22.0f : 21.0f);
}
float f8 = (f3 - dp2) + f2;
this.rect.set(dp, f8, AndroidUtilities.dp(14.0f) + dp, AndroidUtilities.dp(14.0f) + f8);
int alpha = Theme.chat_msgErrorPaint.getAlpha();
Theme.chat_msgErrorPaint.setAlpha((int) (alpha * f6));
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(1.0f), AndroidUtilities.dp(1.0f), Theme.chat_msgErrorPaint);
Theme.chat_msgErrorPaint.setAlpha(alpha);
BaseCell.setDrawableBounds(Theme.chat_msgErrorDrawable, dp + AndroidUtilities.dp(6.0f), f8 + AndroidUtilities.dp(2.0f));
Theme.chat_msgErrorDrawable.setAlpha((int) (f6 * 255.0f));
if (z8) {
canvas.save();
canvas.scale(f5, f5, Theme.chat_msgErrorDrawable.getBounds().centerX(), Theme.chat_msgErrorDrawable.getBounds().centerY());
}
Theme.chat_msgErrorDrawable.draw(canvas);
Theme.chat_msgErrorDrawable.setAlpha(255);
if (z8) {
canvas.restore();
}
}
}
public void drawOverlays(Canvas canvas) {
boolean z;
boolean z2;
int i;
int i2;
long j;
int i3;
float f;
float f2;
float f3;
int i4;
boolean z3;
float f4;
boolean z4;
float f5;
int i5;
int i6;
StaticLayout staticLayout;
int i7;
int i8;
int themedColor;
int themedColor2;
int dp;
float f6;
int size;
int i9;
float f7;
Drawable drawable;
int i10;
float f8;
float f9;
int[] iArr;
int i11;
int dp2;
int i12;
int i13;
float f10;
float f11;
float f12;
Drawable drawable2;
Drawable drawable3;
int dp3;
StaticLayout staticLayout2;
String formatLocationLeftTime;
StaticLayout staticLayout3;
float abs;
float f13;
StaticLayout staticLayout4;
float f14;
float currentAlpha;
boolean z5;
int i14;
int i15;
AnimatedFloat animatedFloat;
float f15;
float f16;
float f17;
int i16;
int i17;
float imageX;
float imageY2;
float f18;
float dp4;
float dp5;
MessageObject messageObject;
boolean z6;
int i18;
AnimatedFileDrawable animation;
ChatMessageCellDelegate chatMessageCellDelegate;
if (!this.drawFromPinchToZoom && (chatMessageCellDelegate = this.delegate) != null && chatMessageCellDelegate.getPinchToZoomHelper() != null && this.delegate.getPinchToZoomHelper().isInOverlayModeFor(this)) {
return;
}
long elapsedRealtime = SystemClock.elapsedRealtime();
long j2 = elapsedRealtime - this.lastAnimationTime;
if (j2 > 17) {
j2 = 17;
}
this.lastAnimationTime = elapsedRealtime;
if (this.currentMessageObject.hadAnimationNotReadyLoading && this.photoImage.getVisible() && !this.currentMessageObject.needDrawBluredPreview() && (((i18 = this.documentAttachType) == 7 || i18 == 4 || i18 == 2) && (animation = this.photoImage.getAnimation()) != null && animation.hasBitmap())) {
this.currentMessageObject.hadAnimationNotReadyLoading = false;
updateButtonState(false, true, false);
}
if (!this.hasGamePreview) {
MessageObject messageObject2 = this.currentMessageObject;
int i19 = messageObject2.type;
long j3 = j2;
if (i19 == 3 || i19 == 1 || i19 == 20 || (i8 = this.documentAttachType) == 4 || i8 == 2) {
if (this.photoImage.getVisible()) {
MessageObject messageObject3 = this.currentMessageObject;
if (!messageObject3.isRepostPreview) {
if (!messageObject3.needDrawBluredPreview()) {
MessageObject messageObject4 = this.currentMessageObject;
if (!messageObject4.isRepostPreview && !messageObject4.preview && !this.isSmallImage && this.documentAttachType == 4) {
int alpha = ((BitmapDrawable) Theme.chat_msgMediaMenuDrawable).getPaint().getAlpha();
if (this.drawMediaCheckBox) {
Theme.chat_msgMediaMenuDrawable.setAlpha((int) (alpha * this.controlsAlpha * (1.0f - this.checkBoxAnimationProgress)));
} else {
Theme.chat_msgMediaMenuDrawable.setAlpha((int) (alpha * this.controlsAlpha));
}
Drawable drawable4 = Theme.chat_msgMediaMenuDrawable;
int imageX2 = (int) ((this.photoImage.getImageX() + this.photoImage.getImageWidth()) - AndroidUtilities.dp(14.0f));
this.otherX = imageX2;
int imageY = (int) (this.photoImage.getImageY() + AndroidUtilities.dp(8.1f));
this.otherY = imageY;
BaseCell.setDrawableBounds(drawable4, imageX2, imageY);
Theme.chat_msgMediaMenuDrawable.draw(canvas);
Theme.chat_msgMediaMenuDrawable.setAlpha(alpha);
}
}
boolean isPlayingMessage = MediaController.getInstance().isPlayingMessage(this.currentMessageObject);
if (this.animatingNoSoundPlaying != isPlayingMessage) {
this.animatingNoSoundPlaying = isPlayingMessage;
this.animatingNoSound = isPlayingMessage ? 1 : 2;
this.animatingNoSoundProgress = isPlayingMessage ? 1.0f : 0.0f;
}
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
if (groupedMessagePosition != null) {
z = (groupedMessagePosition.flags & 3) == 3;
} else {
z = true;
}
int i20 = this.documentAttachType;
int i21 = i20 != 4 ? 2 : 2;
int i22 = this.buttonState;
if (i22 != 1) {
if (i22 != i21) {
if (i22 != 0) {
if (i22 != 3) {
}
}
}
}
if (!this.currentMessageObject.isRepostVideoPreview) {
if (this.autoPlayingMedia) {
updatePlayingMessageProgress();
}
if ((this.infoLayout != null || this.loadingProgressLayout != null) && (!this.forceNotDrawTime || this.autoPlayingMedia || this.drawVideoImageButton || this.animatingLoadingProgressProgress != 0.0f || ((z && this.docTitleLayout != null) || (this.loadingProgressLayout != null && this.currentPosition != null && ((i7 = this.buttonState) == 1 || (i7 == 3 && this.miniButtonState == 1)))))) {
if (!z) {
f4 = this.animatingLoadingProgressProgress;
f5 = 0.0f;
z4 = true;
z3 = false;
} else {
boolean z7 = (this.buttonState == 1 || this.miniButtonState == 1 || this.animatingLoadingProgressProgress != 0.0f) && !this.currentMessageObject.isSecretMedia() && ((i4 = this.documentAttachType) == 4 || i4 == 2 || i4 == 1);
MessageObject messageObject5 = this.currentMessageObject;
int i23 = messageObject5.type;
float f19 = ((i23 == 3 || i23 == 8 || this.documentAttachType == 4) && !(messageObject5.needDrawBluredPreview() && this.docTitleLayout == null)) ? this.animatingDrawVideoImageButtonProgress : 0.0f;
z3 = f19 > 0.0f && this.docTitleLayout != null;
f4 = (z3 || !(z7 || this.infoLayout == null)) ? 1.0f : this.animatingLoadingProgressProgress;
float f20 = f19;
z4 = z7;
f5 = f20;
}
float isSmallImage = f4 * (1.0f - isSmallImage());
if (isSmallImage > 0.0f) {
int i24 = this.documentAttachType;
boolean z8 = (i24 == 7 || i24 == 6 || this.currentMessageObject.type == 19 || SharedConfig.bubbleRadius < 10) ? false : true;
Theme.chat_infoPaint.setColor(getThemedColor(Theme.key_chat_mediaInfoText));
int imageX3 = (int) (this.photoImage.getImageX() + AndroidUtilities.dp(4.0f));
int imageY3 = (int) (this.photoImage.getImageY() + AndroidUtilities.dp(4.0f));
int intrinsicWidth = (!this.autoPlayingMedia || (isPlayingMessage && this.animatingNoSound == 0)) ? 0 : (int) ((Theme.chat_msgNoSoundDrawable.getIntrinsicWidth() + AndroidUtilities.dp(4.0f)) * this.animatingNoSoundProgress);
if (z4 && (staticLayout = this.loadingProgressLayout) != null) {
i6 = (int) staticLayout.getLineWidth(0);
i5 = 0;
} else {
i5 = intrinsicWidth;
i6 = this.infoWidth;
}
int ceil = (int) Math.ceil(AndroidUtilities.dp(z8 ? 12.0f : 8.0f) + i6 + i5 + ((((Math.max((this.infoWidth == i6 ? i5 : 0) + i6, this.docTitleWidth) + (this.canStreamVideo ? AndroidUtilities.dp(32.0f) : 0)) - i6) - i5) * f5));
if (f5 != 0.0f && this.docTitleLayout == null) {
f5 = 0.0f;
}
canvas.save();
int alpha2 = getThemedPaint("paintChatTimeBackground").getAlpha();
z2 = z;
getThemedPaint("paintChatTimeBackground").setAlpha((int) (alpha2 * this.controlsAlpha * isSmallImage * (this.currentMessageObject.needDrawBluredPreview() ? 0.4f : 1.0f)));
float f21 = imageX3;
float f22 = imageY3;
this.rect.set(f21, f22, imageX3 + ceil, imageY3 + AndroidUtilities.dp((15.5f * f5) + 16.5f));
int[] roundRadius = this.photoImage.getRoundRadius();
int min = Math.min(AndroidUtilities.dp(8.0f), Math.max(roundRadius[0], roundRadius[1]));
if (this.currentMessageObject.needDrawBluredPreview()) {
this.rectPath.reset();
float f23 = min;
this.rectPath.addRoundRect(this.rect, f23, f23, Path.Direction.CW);
canvas.save();
canvas.clipPath(this.rectPath);
float alpha3 = this.photoImage.getAlpha();
this.photoImage.setAlpha(0.5f * alpha3);
this.photoImage.draw(canvas);
this.photoImage.setAlpha(alpha3);
canvas.restore();
canvas.drawRoundRect(this.rect, f23, f23, getThemedPaint("paintChatTimeBackground"));
} else if (z3 || ((z4 && this.loadingProgressLayout != null) || (!z4 && this.infoLayout != null))) {
canvas.scale(isSmallImage, isSmallImage, f21, f22);
float f24 = min;
canvas.drawRoundRect(this.rect, f24, f24, getThemedPaint("paintChatTimeBackground"));
} else {
canvas.scale(isSmallImage, isSmallImage, f21, f22);
}
Theme.chat_infoPaint.setAlpha((int) (this.controlsAlpha * 255.0f * isSmallImage));
Theme.chat_infoBoldPaint.setColor(Theme.chat_infoPaint.getColor());
int imageX4 = (int) (this.photoImage.getImageX() + AndroidUtilities.dp((z8 ? 10 : 8) + (this.canStreamVideo ? 30.0f * f5 : 0.0f)));
this.noSoundCenterX = imageX4;
canvas.translate(imageX4, this.photoImage.getImageY() + AndroidUtilities.dp((0.2f * f5) + 5.5f));
StaticLayout staticLayout5 = this.infoLayout;
if (staticLayout5 != null && (!z4 || z3)) {
staticLayout5.draw(canvas);
}
if (i5 != 0 && (!z4 || z3)) {
canvas.save();
Drawable drawable5 = Theme.chat_msgNoSoundDrawable;
float f25 = this.animatingNoSoundProgress;
drawable5.setAlpha((int) (f25 * 255.0f * f25 * this.controlsAlpha));
int dp6 = AndroidUtilities.dp(this.animatingNoSoundProgress * 14.0f);
int dp7 = (AndroidUtilities.dp(14.0f) - dp6) / 2;
int dp8 = this.infoWidth + AndroidUtilities.dp(4.0f);
canvas.translate(dp8, 0.0f);
Theme.chat_msgNoSoundDrawable.setBounds(0, dp7, dp6, dp7 + dp6);
Theme.chat_msgNoSoundDrawable.draw(canvas);
this.noSoundCenterX += dp8 + (dp6 / 2);
canvas.restore();
}
if (z4 && this.loadingProgressLayout != null) {
canvas.save();
if (z3) {
Theme.chat_infoPaint.setAlpha((int) (this.controlsAlpha * 255.0f * f5));
canvas.translate(0.0f, AndroidUtilities.dp(f5 * 14.3f));
}
this.loadingProgressLayout.draw(canvas);
canvas.restore();
} else if (z3) {
Theme.chat_infoPaint.setAlpha((int) (this.controlsAlpha * 255.0f * f5));
canvas.translate(0.0f, AndroidUtilities.dp(f5 * 14.3f));
this.docTitleLayout.draw(canvas);
}
canvas.restore();
i = 255;
Theme.chat_infoPaint.setAlpha(255);
getThemedPaint("paintChatTimeBackground").setAlpha(alpha2);
i2 = this.animatingDrawVideoImageButton;
if (i2 != 1) {
j = j3;
float f26 = this.animatingDrawVideoImageButtonProgress - (((float) j) / 160.0f);
this.animatingDrawVideoImageButtonProgress = f26;
if (f26 <= 0.0f) {
this.animatingDrawVideoImageButtonProgress = 0.0f;
this.animatingDrawVideoImageButton = 0;
}
invalidate();
} else {
j = j3;
if (i2 == 2) {
float f27 = this.animatingDrawVideoImageButtonProgress + (((float) j) / 160.0f);
this.animatingDrawVideoImageButtonProgress = f27;
if (f27 >= 1.0f) {
this.animatingDrawVideoImageButtonProgress = 1.0f;
this.animatingDrawVideoImageButton = 0;
}
invalidate();
}
}
i3 = this.animatingNoSound;
if (i3 != 1) {
float f28 = this.animatingNoSoundProgress - (((float) j) / 180.0f);
this.animatingNoSoundProgress = f28;
if (f28 <= 0.0f) {
this.animatingNoSoundProgress = 0.0f;
this.animatingNoSound = 0;
}
invalidate();
} else if (i3 == 2) {
float f29 = this.animatingNoSoundProgress + (((float) j) / 180.0f);
this.animatingNoSoundProgress = f29;
if (f29 >= 1.0f) {
this.animatingNoSoundProgress = 1.0f;
this.animatingNoSound = 0;
}
invalidate();
}
if ((this.buttonState != 1 || this.miniButtonState == 1) && this.loadingProgressLayout != null) {
f = 0.0f;
f2 = 1.0f;
} else {
f = 0.0f;
f2 = 0.0f;
}
if (f2 == f && this.infoLayout != null && z2) {
this.animatingLoadingProgressProgress = f;
}
f3 = this.animatingLoadingProgressProgress;
if (f3 >= f2) {
float f30 = f3 + (((float) j) / 160.0f);
this.animatingLoadingProgressProgress = f30;
if (f30 > f2) {
this.animatingLoadingProgressProgress = f2;
}
invalidate();
} else if (f3 != f2) {
float f31 = f3 - (((float) j) / 160.0f);
this.animatingLoadingProgressProgress = f31;
if (f31 < f2) {
this.animatingLoadingProgressProgress = f2;
}
invalidate();
}
if (!this.drawImageButton && this.photoImage.getVisible() && !this.isSmallImage && !this.currentMessageObject.isRepostVideoPreview) {
float f32 = this.controlsAlpha;
if (f32 != 1.0f) {
this.radialProgress.setOverrideAlpha(f32);
}
if (this.photoImage.hasImageSet()) {
this.radialProgress.setBackgroundDrawable(null);
} else {
this.radialProgress.setBackgroundDrawable(isDrawSelectionBackground() ? this.currentBackgroundSelectedDrawable : this.currentBackgroundDrawable);
}
MessageObject messageObject6 = this.currentMessageObject;
if (messageObject6 != null && messageObject6.isRoundVideo()) {
MessageObject messageObject7 = this.currentMessageObject;
if (!messageObject7.mediaExists || messageObject7.isRoundOnce()) {
this.radialProgress.setProgressRect(this.photoImage.getImageX() + ((this.photoImage.getImageWidth() / 2.0f) - this.radialProgress.getRadius()), this.photoImage.getImageY() + ((this.photoImage.getImageHeight() / 2.0f) - this.radialProgress.getRadius()), this.photoImage.getImageX() + (this.photoImage.getImageWidth() / 2.0f) + this.radialProgress.getRadius(), this.photoImage.getImageY() + (this.photoImage.getImageHeight() / 2.0f) + this.radialProgress.getRadius());
z6 = false;
if ((this.isRoundVideo || !this.hasLinkPreview) && (!this.currentMessageObject.needDrawBluredPreview() || !MediaController.getInstance().isPlayingMessage(this.currentMessageObject))) {
if (this.currentMessageObject.hasMediaSpoilers()) {
MessageObject messageObject8 = this.currentMessageObject;
if (messageObject8.isMediaSpoilersRevealed) {
}
if (SharedConfig.isAutoplayVideo()) {
if (!this.currentMessageObject.isRepostPreview) {
if (this.currentMessagesGroup == null) {
if (this.radialProgress.getIcon() != 0) {
}
}
}
}
}
if (this.currentMessageObject.needDrawBluredPreview()) {
this.radialProgress.overrideCircleAlpha = 0.0f;
} else if (this.isRoundVideo) {
this.radialProgress.overrideCircleAlpha = ((1.0f - getVideoTranscriptionProgress()) * 0.75f) + 0.25f;
}
if (!this.currentMessageObject.isRoundOnce() && ((!SharedConfig.isAutoplayVideo() || this.currentMessagesGroup != null) && this.currentMessageObject.hasMediaSpoilers() && !this.currentMessageObject.isMediaSpoilersRevealed && this.radialProgress.getIcon() == 0)) {
canvas.saveLayerAlpha(this.radialProgress.getProgressRect(), (int) (this.mediaSpoilerRevealProgress * 255.0f), 31);
}
drawRadialProgress(canvas);
if (!this.currentMessageObject.isRoundOnce() && ((!SharedConfig.isAutoplayVideo() || this.currentMessagesGroup != null) && this.currentMessageObject.hasMediaSpoilers() && !this.currentMessageObject.isMediaSpoilersRevealed && this.radialProgress.getIcon() == 0)) {
canvas.restore();
}
if (!this.currentMessageObject.needDrawBluredPreview() || this.isRoundVideo) {
this.radialProgress.overrideCircleAlpha = 1.0f;
}
}
if (z6) {
canvas.restore();
}
}
}
MessageObject messageObject9 = this.currentMessageObject;
if (messageObject9 != null && messageObject9.isRoundVideo()) {
this.radialProgress.setProgressRect(this.photoImage.getImageX(), this.photoImage.getImageY(), this.photoImage.getImageX() + this.photoImage.getImageWidth(), this.photoImage.getImageY() + this.photoImage.getImageHeight());
canvas.saveLayerAlpha(this.radialProgress.getProgressRect(), (int) (getVideoTranscriptionProgress() * 255.0f), 31);
float imageHeight = this.photoImage.getImageHeight() / (this.radialProgress.getRadius() * 2);
canvas.scale(imageHeight, imageHeight, this.radialProgress.getProgressRect().centerX(), this.radialProgress.getProgressRect().centerY());
z6 = true;
if (this.isRoundVideo) {
}
if (this.currentMessageObject.hasMediaSpoilers()) {
}
if (this.currentMessageObject.needDrawBluredPreview()) {
}
if (!this.currentMessageObject.isRoundOnce()) {
canvas.saveLayerAlpha(this.radialProgress.getProgressRect(), (int) (this.mediaSpoilerRevealProgress * 255.0f), 31);
}
drawRadialProgress(canvas);
if (!this.currentMessageObject.isRoundOnce()) {
canvas.restore();
}
if (!this.currentMessageObject.needDrawBluredPreview()) {
}
this.radialProgress.overrideCircleAlpha = 1.0f;
if (z6) {
}
}
z6 = false;
if (this.isRoundVideo) {
}
if (this.currentMessageObject.hasMediaSpoilers()) {
}
if (this.currentMessageObject.needDrawBluredPreview()) {
}
if (!this.currentMessageObject.isRoundOnce()) {
}
drawRadialProgress(canvas);
if (!this.currentMessageObject.isRoundOnce()) {
}
if (!this.currentMessageObject.needDrawBluredPreview()) {
}
this.radialProgress.overrideCircleAlpha = 1.0f;
if (z6) {
}
}
z5 = (this.buttonState == -1 || (messageObject = this.currentMessageObject) == null || !messageObject.needDrawBluredPreview() || MediaController.getInstance().isPlayingMessage(this.currentMessageObject) || this.currentMessageObject.messageOwner.destroyTime == 0) ? false : true;
if (z5 || this.timerParticlesAlpha != null) {
i14 = -1;
i15 = i;
} else {
i14 = -1;
i15 = i;
this.timerParticlesAlpha = new AnimatedFloat(0.0f, this, 150L, 120L, CubicBezierInterpolator.EASE_OUT);
}
animatedFloat = this.timerParticlesAlpha;
if (animatedFloat == null) {
f16 = 0.0f;
f15 = 0.0f;
} else {
f15 = animatedFloat.set(z5);
f16 = 0.0f;
}
if (f15 > f16 && this.photoImage.getVisible()) {
float max = ((float) Math.max(0L, (this.currentMessageObject.messageOwner.destroyTime * 1000) - (System.currentTimeMillis() + (ConnectionsManager.getInstance(this.currentAccount).getTimeDifference() * 1000)))) / (this.currentMessageObject.messageOwner.ttl * 1000.0f);
Theme.chat_deleteProgressPaint.setColor(i14);
Theme.chat_deleteProgressPaint.setAlpha((int) (f15 * 255.0f * this.controlsAlpha));
Theme.chat_deleteProgressPaint.setStrokeWidth(AndroidUtilities.dp(2.0f));
float f33 = max * (-360.0f);
canvas.drawArc(this.deleteProgressRect, -90.0f, f33, false, Theme.chat_deleteProgressPaint);
if (this.timerParticles == null) {
this.timerParticles = new TimerParticles();
}
this.timerParticles.draw(canvas, Theme.chat_deleteProgressPaint, this.deleteProgressRect, f33, this.controlsAlpha);
invalidate();
updateSecretTimeText(this.currentMessageObject);
}
if ((!this.drawVideoImageButton || this.animatingDrawVideoImageButton != 0) && !this.currentMessageObject.isRepostPreview && this.photoImage.getVisible() && !this.isSmallImage) {
f17 = this.controlsAlpha;
if (f17 != 1.0f) {
this.videoRadialProgress.setOverrideAlpha(f17);
}
this.videoRadialProgress.draw(canvas);
}
if (this.drawMediaCheckBox) {
int i25 = this.documentAttachType;
if (i25 != 5) {
i16 = 1;
if (i25 != 1 || this.drawPhotoImage) {
int dp9 = AndroidUtilities.dp(21.0f);
i17 = 0;
this.mediaCheckBox.setBackgroundType(0);
this.mediaCheckBox.setBounds(((int) this.photoImage.getImageX2()) - AndroidUtilities.dp(25.0f), ((int) this.photoImage.getImageY()) + AndroidUtilities.dp(4.0f), dp9, dp9);
this.mediaCheckBox.setColor(i14, i14, this.currentMessageObject.isOutOwner() ? Theme.key_chat_outBubbleSelected : Theme.key_chat_inBubbleSelected);
this.mediaCheckBox.setBackgroundDrawable(null);
this.mediaCheckBox.draw(canvas);
}
} else {
i16 = 1;
}
i17 = 0;
int dp10 = AndroidUtilities.dp(20.0f);
this.mediaCheckBox.setBackgroundType(this.radialProgress.getMiniIcon() != 4 ? 12 : 13);
this.mediaCheckBox.setBounds(this.buttonX + AndroidUtilities.dp(28.0f), this.buttonY + AndroidUtilities.dp(28.0f), dp10, dp10);
this.mediaCheckBox.setColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outTimeText : Theme.key_chat_inTimeText, this.currentMessageObject.isOutOwner() ? Theme.key_chat_outLoader : Theme.key_chat_inLoader, this.currentMessageObject.isOutOwner() ? Theme.key_chat_outBubble : Theme.key_chat_inBubble);
this.mediaCheckBox.setBackgroundDrawable(isDrawSelectionBackground() ? this.currentBackgroundSelectedDrawable : this.currentBackgroundDrawable);
this.mediaCheckBox.draw(canvas);
} else {
i16 = 1;
i17 = 0;
}
if (this.documentAttachType == 7) {
boolean isPlayingMessage2 = MediaController.getInstance().isPlayingMessage(this.currentMessageObject);
MessageObject messageObject10 = this.currentMessageObject;
if (messageObject10.type == 5) {
if (messageObject10.isOutOwner()) {
float f34 = (AndroidUtilities.roundPlayingMessageSize - AndroidUtilities.roundMessageSize) * 0.2f;
boolean z9 = this.isPlayingRound;
float f35 = z9 ? f34 : 0.0f;
TransitionParams transitionParams = this.transitionParams;
if (transitionParams.animatePlayingRound) {
f18 = f34 * (z9 ? transitionParams.animateChangeProgress : 1.0f - transitionParams.animateChangeProgress);
} else {
f18 = f35;
}
} else {
f18 = 0.0f;
}
MessageObject messageObject11 = this.currentMessageObject;
if (messageObject11 != null && messageObject11.isRoundOnce()) {
dp4 = this.photoImage.getImageX();
dp5 = (this.photoImage.getImageY2() - ((AndroidUtilities.dp(this.drawPinnedBottom ? 4.0f : 5.0f) + this.reactionsLayoutInBubble.getCurrentTotalHeight(this.transitionParams.animateChangeProgress)) * (1.0f - getVideoTranscriptionProgress()))) - AndroidUtilities.dp(17.0f);
} else {
dp4 = f18 + this.backgroundDrawableLeft + this.transitionParams.deltaLeft + ((this.currentMessageObject.isOutOwner() || this.drawPinnedBottom || !this.drawBackground) ? i17 : AndroidUtilities.dp(6.0f)) + AndroidUtilities.dp(8.0f) + this.roundPlayingDrawableProgress;
dp5 = this.layoutHeight - AndroidUtilities.dp(28 - (this.drawPinnedBottom ? 2 : i17));
}
if (!this.reactionsLayoutInBubble.isEmpty) {
dp5 -= r5.totalHeight;
}
TransitionParams transitionParams2 = this.transitionParams;
transitionParams2.lastDrawRoundVideoDotY = dp5;
if (transitionParams2.animateRoundVideoDotY) {
float f36 = transitionParams2.animateFromRoundVideoDotY;
float f37 = transitionParams2.animateChangeProgress;
dp5 = (dp5 * f37) + (f36 * (1.0f - f37));
}
int i26 = this.timeAudioX;
if (!this.hasLinkPreview) {
if (this.currentMessageObject.isOutOwner()) {
int width = getWidth();
TransitionParams transitionParams3 = this.transitionParams;
i26 = ((width - (transitionParams3.animateBackgroundBoundsInner ? (int) ((this.backgroundWidth - transitionParams3.deltaLeft) + transitionParams3.deltaRight) : this.backgroundWidth)) - ((this.drawPinnedBottom || !this.mediaBackground) ? i17 : AndroidUtilities.dp(8.0f))) + AndroidUtilities.dp(67.0f);
}
dp4 = AndroidUtilities.lerp(dp4, i26 - AndroidUtilities.dp(4.0f), getVideoTranscriptionProgress());
dp5 = AndroidUtilities.lerp(dp5, ((AndroidUtilities.dp(44.0f) + this.namesOffset) + this.mediaOffsetY) - AndroidUtilities.dp(1.7f), getVideoTranscriptionProgress());
}
this.rect.set(dp4, dp5, this.timeWidthAudio + dp4 + AndroidUtilities.dp(22.0f), AndroidUtilities.dp(17.0f) + dp5);
applyServiceShaderMatrix();
Paint themedPaint = getThemedPaint("paintChatActionBackground");
int alpha4 = themedPaint.getAlpha();
themedPaint.setAlpha((int) (alpha4 * this.timeAlpha * 0.5f * (1.0f - getVideoTranscriptionProgress())));
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(6.0f), AndroidUtilities.dp(6.0f), themedPaint);
if (hasGradientService()) {
Paint themedPaint2 = getThemedPaint("paintChatActionBackgroundDarken");
int alpha5 = themedPaint2.getAlpha();
themedPaint2.setAlpha((int) (alpha5 * this.timeAlpha * (1.0f - getVideoTranscriptionProgress())));
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(6.0f), AndroidUtilities.dp(6.0f), themedPaint2);
themedPaint2.setAlpha(alpha5);
}
themedPaint.setAlpha(alpha4);
int i27 = (isPlayingMessage2 || !this.currentMessageObject.isContentUnread()) ? i16 : i17;
if (i27 != 0) {
float f38 = this.roundPlayingDrawableProgress;
if (f38 != 1.0f) {
float f39 = f38 + 0.10666667f;
this.roundPlayingDrawableProgress = f39;
if (f39 > 1.0f) {
this.roundPlayingDrawableProgress = 1.0f;
} else {
invalidate();
}
if (i27 != 0) {
if (isPlayingMessage2 && !MediaController.getInstance().isMessagePaused()) {
this.roundVideoPlayingDrawable.start();
} else {
this.roundVideoPlayingDrawable.stop();
}
}
if (this.roundPlayingDrawableProgress < 1.0f) {
float dp11 = this.timeWidthAudio + dp4 + AndroidUtilities.dp(12.0f);
float dp12 = AndroidUtilities.dp(8.3f) + dp5;
canvas.save();
float f40 = this.roundPlayingDrawableProgress;
canvas.scale(1.0f - f40, 1.0f - f40, dp11, dp12);
Theme.chat_docBackPaint.setColor(Theme.chat_timePaint.getColor());
Theme.chat_docBackPaint.setAlpha((int) (this.timeAlpha * 255.0f * (1.0f - this.roundPlayingDrawableProgress)));
canvas.drawCircle(dp11, dp12, AndroidUtilities.dp(3.0f), Theme.chat_docBackPaint);
canvas.restore();
}
if (this.roundPlayingDrawableProgress > 0.0f) {
BaseCell.setDrawableBounds(this.roundVideoPlayingDrawable, this.timeWidthAudio + dp4 + AndroidUtilities.dp(6.0f), AndroidUtilities.dp(2.3f) + dp5);
canvas.save();
float f41 = this.roundPlayingDrawableProgress;
canvas.scale(f41, f41, this.roundVideoPlayingDrawable.getBounds().centerX(), this.roundVideoPlayingDrawable.getBounds().centerY());
if (!this.hasLinkPreview) {
this.roundVideoPlayingDrawable.timeColor = Theme.chat_timePaint.getColor();
this.roundVideoPlayingDrawable.colorProgress = getVideoTranscriptionProgress();
} else {
this.roundVideoPlayingDrawable.colorProgress = 0.0f;
}
this.roundVideoPlayingDrawable.setAlpha((int) (this.roundPlayingDrawableProgress * 255.0f * (1.0f - getVideoTranscriptionProgress())));
this.roundVideoPlayingDrawable.draw(canvas);
canvas.restore();
}
imageX = dp4 + AndroidUtilities.dp(4.0f);
imageY2 = dp5 + AndroidUtilities.dp(1.7f);
}
}
if (i27 == 0) {
float f42 = this.roundPlayingDrawableProgress;
if (f42 != 0.0f) {
float f43 = f42 - 0.10666667f;
this.roundPlayingDrawableProgress = f43;
if (f43 < 0.0f) {
this.roundPlayingDrawableProgress = 0.0f;
} else {
invalidate();
}
}
}
if (i27 != 0) {
}
if (this.roundPlayingDrawableProgress < 1.0f) {
}
if (this.roundPlayingDrawableProgress > 0.0f) {
}
imageX = dp4 + AndroidUtilities.dp(4.0f);
imageY2 = dp5 + AndroidUtilities.dp(1.7f);
} else {
imageX = this.photoImage.getImageX();
imageY2 = this.photoImage.getImageY2() - (this.durationLayout != null ? r1.getHeight() : i17);
}
if (this.durationLayout != null) {
Theme.chat_timePaint.setAlpha((int) (this.timeAlpha * 255.0f));
canvas.save();
canvas.translate(imageX, imageY2);
this.durationLayout.draw(canvas);
canvas.restore();
Theme.chat_timePaint.setAlpha(i15);
return;
}
return;
}
return;
}
}
}
z2 = z;
i = 255;
i2 = this.animatingDrawVideoImageButton;
if (i2 != 1) {
}
i3 = this.animatingNoSound;
if (i3 != 1) {
}
if (this.buttonState != 1) {
}
f = 0.0f;
f2 = 1.0f;
if (f2 == f) {
this.animatingLoadingProgressProgress = f;
}
f3 = this.animatingLoadingProgressProgress;
if (f3 >= f2) {
}
if (!this.drawImageButton) {
}
if (this.buttonState == -1) {
}
if (z5) {
}
i14 = -1;
i15 = i;
animatedFloat = this.timerParticlesAlpha;
if (animatedFloat == null) {
}
if (f15 > f16) {
float max2 = ((float) Math.max(0L, (this.currentMessageObject.messageOwner.destroyTime * 1000) - (System.currentTimeMillis() + (ConnectionsManager.getInstance(this.currentAccount).getTimeDifference() * 1000)))) / (this.currentMessageObject.messageOwner.ttl * 1000.0f);
Theme.chat_deleteProgressPaint.setColor(i14);
Theme.chat_deleteProgressPaint.setAlpha((int) (f15 * 255.0f * this.controlsAlpha));
Theme.chat_deleteProgressPaint.setStrokeWidth(AndroidUtilities.dp(2.0f));
float f332 = max2 * (-360.0f);
canvas.drawArc(this.deleteProgressRect, -90.0f, f332, false, Theme.chat_deleteProgressPaint);
if (this.timerParticles == null) {
}
this.timerParticles.draw(canvas, Theme.chat_deleteProgressPaint, this.deleteProgressRect, f332, this.controlsAlpha);
invalidate();
updateSecretTimeText(this.currentMessageObject);
}
if (!this.drawVideoImageButton) {
}
f17 = this.controlsAlpha;
if (f17 != 1.0f) {
}
this.videoRadialProgress.draw(canvas);
if (this.drawMediaCheckBox) {
}
if (this.documentAttachType == 7) {
}
}
}
} else if (i19 == 4) {
if (this.docTitleLayout != null) {
if (messageObject2.isOutOwner()) {
Theme.chat_locationTitlePaint.setColor(getThemedColor(Theme.key_chat_messageTextOut));
Theme.chat_locationAddressPaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outVenueInfoSelectedText : Theme.key_chat_outVenueInfoText));
} else {
Theme.chat_locationTitlePaint.setColor(getThemedColor(Theme.key_chat_messageTextIn));
Theme.chat_locationAddressPaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inVenueInfoSelectedText : Theme.key_chat_inVenueInfoText));
}
if (MessageObject.getMedia(this.currentMessageObject.messageOwner) instanceof TLRPC$TL_messageMediaGeoLive) {
int imageY22 = (int) (this.photoImage.getImageY2() + AndroidUtilities.dp(30.0f));
if (this.locationExpired) {
TransitionParams transitionParams4 = this.transitionParams;
if (!transitionParams4.animateLocationIsExpired) {
transitionParams4.lastDrawLocationExpireText = null;
transitionParams4.lastDrawDocTitleLayout = null;
transitionParams4.lastDrawInfoLayout = null;
f14 = 0.0f;
currentAlpha = !this.photoImage.isCrossfadingWithOldImage() ? 1.0f : this.photoImage.getCurrentAlpha();
if (currentAlpha > f14 && (this.photoImage.hasNotThumb() || this.photoImage.isCrossfadingWithOldImage())) {
int imageX5 = (int) ((this.photoImage.getImageX() + (this.photoImage.getImageWidth() / 2.0f)) - AndroidUtilities.dp(31.0f));
int imageY4 = (int) (((this.photoImage.getImageY() + (this.photoImage.getImageHeight() / 2.0f)) - AndroidUtilities.dp(38.0f)) - (AndroidUtilities.dp(16.0f) * (1.0f - CubicBezierInterpolator.EASE_OUT_BACK.getInterpolation(currentAlpha))));
Drawable avatarLiveLocation = this.sharedResources.getAvatarLiveLocation();
BaseCell.setDrawableBounds(avatarLiveLocation, imageX5, imageY4);
float f44 = currentAlpha * 5.0f;
avatarLiveLocation.setAlpha((int) (Math.min(1.0f, f44) * 255.0f));
avatarLiveLocation.draw(canvas);
this.locationImageReceiver.setImageCoords(imageX5 + AndroidUtilities.dp(5.0f), imageY4 + AndroidUtilities.dp(5.0f), AndroidUtilities.dp(52.0f), AndroidUtilities.dp(52.0f));
this.locationImageReceiver.setAlpha(Math.min(1.0f, f44));
this.locationImageReceiver.draw(canvas);
}
}
}
this.forceNotDrawTime = true;
StaticLayout staticLayout6 = this.docTitleLayout;
StaticLayout staticLayout7 = this.infoLayout;
TransitionParams transitionParams5 = this.transitionParams;
if (transitionParams5.animateLocationIsExpired) {
float f45 = transitionParams5.lastDrawLocationExpireProgress;
String str = transitionParams5.lastDrawLocationExpireText;
StaticLayout staticLayout8 = transitionParams5.lastDrawDocTitleLayout;
StaticLayout staticLayout9 = transitionParams5.lastDrawInfoLayout;
abs = f45;
f13 = 1.0f - transitionParams5.animateChangeProgress;
staticLayout4 = staticLayout9;
staticLayout3 = staticLayout8;
formatLocationLeftTime = str;
} else {
formatLocationLeftTime = LocaleController.formatLocationLeftTime(Math.abs(MessageObject.getMedia(this.currentMessageObject.messageOwner).period - (ConnectionsManager.getInstance(this.currentAccount).getCurrentTime() - this.currentMessageObject.messageOwner.date)));
staticLayout3 = staticLayout6;
abs = 1.0f - (Math.abs(ConnectionsManager.getInstance(this.currentAccount).getCurrentTime() - this.currentMessageObject.messageOwner.date) / MessageObject.getMedia(this.currentMessageObject.messageOwner).period);
f13 = 1.0f;
staticLayout4 = staticLayout7;
}
this.rect.set(this.photoImage.getImageX2() - AndroidUtilities.dp(43.0f), imageY22 - AndroidUtilities.dp(15.0f), this.photoImage.getImageX2() - AndroidUtilities.dp(13.0f), AndroidUtilities.dp(15.0f) + imageY22);
if (this.currentMessageObject.isOutOwner()) {
Paint paint = Theme.chat_radialProgress2Paint;
int i28 = Theme.key_chat_outInstant;
paint.setColor(getThemedColor(i28));
Theme.chat_livePaint.setColor(getThemedColor(i28));
} else {
Paint paint2 = Theme.chat_radialProgress2Paint;
int i29 = Theme.key_chat_inInstant;
paint2.setColor(getThemedColor(i29));
Theme.chat_livePaint.setColor(getThemedColor(i29));
}
int alpha6 = Theme.chat_locationTitlePaint.getAlpha();
int alpha7 = Theme.chat_locationAddressPaint.getAlpha();
int alpha8 = Theme.chat_livePaint.getAlpha();
if (f13 != 1.0f) {
Theme.chat_locationTitlePaint.setAlpha((int) (alpha6 * f13));
Theme.chat_locationAddressPaint.setAlpha((int) (alpha7 * f13));
Theme.chat_livePaint.setAlpha((int) (alpha8 * f13));
canvas.save();
canvas.translate(0.0f, (-AndroidUtilities.dp(50.0f)) * this.transitionParams.animateChangeProgress);
}
Theme.chat_radialProgress2Paint.setAlpha((int) (50.0f * f13));
canvas.drawCircle(this.rect.centerX(), this.rect.centerY(), AndroidUtilities.dp(15.0f), Theme.chat_radialProgress2Paint);
Theme.chat_radialProgress2Paint.setAlpha((int) (f13 * 255.0f));
StaticLayout staticLayout10 = staticLayout4;
String str2 = formatLocationLeftTime;
StaticLayout staticLayout11 = staticLayout3;
canvas.drawArc(this.rect, -90.0f, abs * (-360.0f), false, Theme.chat_radialProgress2Paint);
canvas.drawText(str2, this.rect.centerX() - (Theme.chat_livePaint.measureText(str2) / 2.0f), imageY22 + AndroidUtilities.dp(4.0f), Theme.chat_livePaint);
if (staticLayout11 == null || staticLayout10 == null) {
f14 = 0.0f;
} else {
canvas.save();
canvas.translate(this.photoImage.getImageX() + AndroidUtilities.dp(10.0f), this.photoImage.getImageY2() + AndroidUtilities.dp(10.0f));
staticLayout11.draw(canvas);
f14 = 0.0f;
canvas.translate(0.0f, AndroidUtilities.dp(23.0f));
staticLayout10.draw(canvas);
canvas.restore();
}
if (f13 != 1.0f) {
Theme.chat_locationTitlePaint.setAlpha(alpha6);
Theme.chat_locationAddressPaint.setAlpha(alpha7);
Theme.chat_livePaint.setAlpha(alpha8);
canvas.restore();
}
TransitionParams transitionParams6 = this.transitionParams;
transitionParams6.lastDrawLocationExpireProgress = abs;
transitionParams6.lastDrawLocationExpireText = str2;
transitionParams6.lastDrawDocTitleLayout = staticLayout11;
transitionParams6.lastDrawInfoLayout = staticLayout10;
if (!this.photoImage.isCrossfadingWithOldImage()) {
}
if (currentAlpha > f14) {
int imageX52 = (int) ((this.photoImage.getImageX() + (this.photoImage.getImageWidth() / 2.0f)) - AndroidUtilities.dp(31.0f));
int imageY42 = (int) (((this.photoImage.getImageY() + (this.photoImage.getImageHeight() / 2.0f)) - AndroidUtilities.dp(38.0f)) - (AndroidUtilities.dp(16.0f) * (1.0f - CubicBezierInterpolator.EASE_OUT_BACK.getInterpolation(currentAlpha))));
Drawable avatarLiveLocation2 = this.sharedResources.getAvatarLiveLocation();
BaseCell.setDrawableBounds(avatarLiveLocation2, imageX52, imageY42);
float f442 = currentAlpha * 5.0f;
avatarLiveLocation2.setAlpha((int) (Math.min(1.0f, f442) * 255.0f));
avatarLiveLocation2.draw(canvas);
this.locationImageReceiver.setImageCoords(imageX52 + AndroidUtilities.dp(5.0f), imageY42 + AndroidUtilities.dp(5.0f), AndroidUtilities.dp(52.0f), AndroidUtilities.dp(52.0f));
this.locationImageReceiver.setAlpha(Math.min(1.0f, f442));
this.locationImageReceiver.draw(canvas);
}
} else {
canvas.save();
canvas.translate(this.photoImage.getImageX() + AndroidUtilities.dp(6.0f), this.photoImage.getImageY2() + AndroidUtilities.dp(8.0f));
this.docTitleLayout.draw(canvas);
if (this.infoLayout != null) {
canvas.translate(0.0f, AndroidUtilities.dp(21.0f));
this.infoLayout.draw(canvas);
}
canvas.restore();
}
}
} else if (i19 == 16) {
boolean isVideoCall = messageObject2.isVideoCall();
if (this.currentMessageObject.isOutOwner()) {
drawable2 = Theme.chat_msgCallUpGreenDrawable;
if (this.currentMessageObject.isVideoCall()) {
isDrawSelectionBackground();
drawable3 = getThemedDrawable("drawableMsgOutCallVideo");
} else {
drawable3 = getThemedDrawable(isDrawSelectionBackground() ? "drawableMsgOutCallAudioSelected" : "drawableMsgOutCallAudio");
}
} else {
TLRPC$PhoneCallDiscardReason tLRPC$PhoneCallDiscardReason = this.currentMessageObject.messageOwner.action.reason;
if ((tLRPC$PhoneCallDiscardReason instanceof TLRPC$TL_phoneCallDiscardReasonMissed) || (tLRPC$PhoneCallDiscardReason instanceof TLRPC$TL_phoneCallDiscardReasonBusy)) {
drawable2 = Theme.chat_msgCallDownRedDrawable;
} else {
drawable2 = Theme.chat_msgCallDownGreenDrawable;
}
drawable3 = isDrawSelectionBackground() ? Theme.chat_msgInCallSelectedDrawable[isVideoCall ? 1 : 0] : Theme.chat_msgInCallDrawable[isVideoCall ? 1 : 0];
}
if (this.currentMessageObject.isOutOwner()) {
Theme.chat_audioTitlePaint.setColor(getThemedColor(Theme.key_chat_messageTextOut));
Theme.chat_contactPhonePaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outTimeSelectedText : Theme.key_chat_outTimeText));
} else {
Theme.chat_audioTitlePaint.setColor(getThemedColor(Theme.key_chat_messageTextIn));
Theme.chat_contactPhonePaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inTimeSelectedText : Theme.key_chat_inTimeText));
}
this.forceNotDrawTime = true;
if (this.currentMessageObject.isOutOwner()) {
dp3 = (this.layoutWidth - this.backgroundWidth) + AndroidUtilities.dp(16.0f);
} else if (needDrawAvatar()) {
dp3 = AndroidUtilities.dp(74.0f);
} else {
dp3 = AndroidUtilities.dp(25.0f);
}
this.otherX = dp3;
if (LocaleController.isRTL) {
dp3 += drawable3.getIntrinsicWidth() + AndroidUtilities.dp(12.0f);
}
if (this.titleLayout != null) {
canvas.save();
canvas.translate(dp3, AndroidUtilities.dp(12.0f) + this.namesOffset);
this.titleLayout.draw(canvas);
canvas.restore();
}
if (this.docTitleLayout != null) {
canvas.save();
canvas.translate(AndroidUtilities.dp(LocaleController.isRTL ? -19.0f : 19.0f) + dp3, AndroidUtilities.dp(37.0f) + this.namesOffset);
this.docTitleLayout.draw(canvas);
canvas.restore();
}
BaseCell.setDrawableBounds(drawable2, (dp3 + ((!LocaleController.isRTL || (staticLayout2 = this.docTitleLayout) == null) ? 0 : staticLayout2.getWidth() - drawable2.getIntrinsicWidth())) - AndroidUtilities.dp(1.0f), AndroidUtilities.dp(37.0f) + this.namesOffset);
drawable2.draw(canvas);
if (Build.VERSION.SDK_INT >= 21) {
Drawable[] drawableArr = this.selectorDrawable;
if (drawableArr[0] != null && this.selectorDrawableMaskType[0] == 4) {
drawableArr[0].draw(canvas);
}
}
boolean z10 = this.pinnedBottom;
if (!z10 && !this.pinnedTop) {
this.otherY = AndroidUtilities.dp(18.5f);
} else if (z10 && this.pinnedTop) {
this.otherY = AndroidUtilities.dp(18.0f);
} else if (!z10) {
this.otherY = AndroidUtilities.dp(17.0f);
} else {
this.otherY = AndroidUtilities.dp(19.0f);
}
BaseCell.setDrawableBounds(drawable3, this.otherX + AndroidUtilities.dp((LocaleController.isRTL ? 0 : 200) + (!isVideoCall ? 1 : 0)), this.otherY);
drawable3.draw(canvas);
} else if (i19 == 17) {
long currentTimeMillis = System.currentTimeMillis();
long j4 = currentTimeMillis - this.voteLastUpdateTime;
if (j4 > 17) {
j4 = 17;
}
this.voteLastUpdateTime = currentTimeMillis;
if (this.currentMessageObject.isOutOwner()) {
themedColor = getThemedColor(Theme.key_chat_messageTextOut);
themedColor2 = getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outTimeSelectedText : Theme.key_chat_outTimeText);
} else {
themedColor = getThemedColor(Theme.key_chat_messageTextIn);
themedColor2 = getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inTimeSelectedText : Theme.key_chat_inTimeText);
}
Theme.chat_audioTitlePaint.setColor(themedColor);
Theme.chat_audioPerformerPaint.setColor(themedColor);
Theme.chat_instantViewPaint.setColor(themedColor);
Theme.chat_timePaint.setColor(themedColor2);
Theme.chat_livePaint.setColor(themedColor2);
Theme.chat_locationAddressPaint.setColor(themedColor2);
canvas.save();
TransitionParams transitionParams7 = this.transitionParams;
if (transitionParams7.animateForwardedLayout) {
float f46 = this.namesOffset;
float f47 = transitionParams7.animateChangeProgress;
float f48 = (f46 * f47) + (transitionParams7.animateForwardedNamesOffset * (1.0f - f47));
if (this.currentMessageObject.needDrawForwarded()) {
f48 -= this.namesOffset;
}
canvas.translate(0.0f, f48);
}
if (this.currentMessageObject.isOutOwner()) {
dp = (this.layoutWidth - this.backgroundWidth) + AndroidUtilities.dp(11.0f);
} else if (needDrawAvatar()) {
dp = AndroidUtilities.dp(68.0f);
} else {
dp = AndroidUtilities.dp(20.0f);
}
int i30 = dp;
if (this.titleLayout != null) {
canvas.save();
canvas.translate(getExtraTextX() + i30, AndroidUtilities.dp(15.0f) + this.namesOffset);
this.titleLayout.draw(canvas);
canvas.restore();
}
StaticLayout staticLayout12 = this.titleLayout;
int height = (staticLayout12 != null ? staticLayout12.getHeight() : 0) + AndroidUtilities.dp(20.0f) + this.namesOffset;
if (this.docTitleLayout != null) {
canvas.save();
canvas.translate(this.docTitleOffsetX + i30 + getExtraTextX(), height);
this.docTitleLayout.draw(canvas);
canvas.restore();
TLRPC$TL_messageMediaPoll tLRPC$TL_messageMediaPoll = (TLRPC$TL_messageMediaPoll) MessageObject.getMedia(this.currentMessageObject.messageOwner);
if (this.lastPoll.quiz && ((this.pollVoted || this.pollClosed) && !TextUtils.isEmpty(tLRPC$TL_messageMediaPoll.results.solution))) {
Drawable themedDrawable = getThemedDrawable(this.currentMessageObject.isOutOwner() ? "drawable_chat_pollHintDrawableOut" : "drawable_chat_pollHintDrawableIn");
if (this.pollVoteInProgress) {
themedDrawable.setAlpha((int) (this.pollAnimationProgress * 255.0f));
} else {
themedDrawable.setAlpha(255);
}
int i31 = this.docTitleOffsetX;
if (i31 < 0 || (i31 == 0 && this.docTitleLayout.getLineLeft(0) == 0.0f)) {
this.pollHintX = (this.currentBackgroundDrawable.getBounds().right - themedDrawable.getIntrinsicWidth()) - AndroidUtilities.dp(this.currentMessageObject.isOutOwner() ? 17.0f : 11.0f);
} else {
this.pollHintX = getCurrentBackgroundLeft() + AndroidUtilities.dp(11.0f);
}
this.pollHintY = height - AndroidUtilities.dp(6.0f);
int intrinsicWidth2 = this.pollHintX + (themedDrawable.getIntrinsicWidth() / 2);
int intrinsicHeight = this.pollHintY + (themedDrawable.getIntrinsicHeight() / 2);
if (this.hintButtonVisible) {
float f49 = this.hintButtonProgress;
if (f49 < 1.0f) {
f12 = AnimationProperties.overshootInterpolator.getInterpolation(f49);
int intrinsicWidth3 = ((int) (themedDrawable.getIntrinsicWidth() * f12)) / 2;
int intrinsicHeight2 = ((int) (themedDrawable.getIntrinsicHeight() * f12)) / 2;
themedDrawable.setBounds(intrinsicWidth2 - intrinsicWidth3, intrinsicHeight - intrinsicHeight2, intrinsicWidth2 + intrinsicWidth3, intrinsicHeight + intrinsicHeight2);
themedDrawable.draw(canvas);
}
}
f12 = this.hintButtonProgress;
int intrinsicWidth32 = ((int) (themedDrawable.getIntrinsicWidth() * f12)) / 2;
int intrinsicHeight22 = ((int) (themedDrawable.getIntrinsicHeight() * f12)) / 2;
themedDrawable.setBounds(intrinsicWidth2 - intrinsicWidth32, intrinsicHeight - intrinsicHeight22, intrinsicWidth2 + intrinsicWidth32, intrinsicHeight + intrinsicHeight22);
themedDrawable.draw(canvas);
} else {
this.pollHintX = -1;
}
if (this.pollAvatarImages != null && !this.isBot) {
int ceil2 = (int) Math.ceil(this.docTitleLayout.getLineLeft(0));
if (this.docTitleOffsetX != 0 || ceil2 != 0) {
int i32 = -AndroidUtilities.dp(13.0f);
int i33 = this.docTitleOffsetX;
if (i33 != 0) {
dp2 = ((i33 + i30) - AndroidUtilities.dp(23.0f)) - getExtraTextX();
} else {
dp2 = ((ceil2 + i30) - AndroidUtilities.dp(23.0f)) - getExtraTextX();
}
i12 = dp2;
i13 = i32;
} else {
i13 = AndroidUtilities.dp(13.0f);
i12 = ((int) Math.ceil(this.docTitleLayout.getLineWidth(0))) + i30 + AndroidUtilities.dp(7.0f) + getExtraTextX();
}
for (int length = this.pollAvatarImages.length - 1; length >= 0; length--) {
if (this.pollAvatarImagesVisible[length] && this.pollAvatarImages[length].hasImageSet()) {
this.pollAvatarImages[length].setImageX((i13 * length) + i12);
this.pollAvatarImages[length].setImageY(height - AndroidUtilities.dp(1.0f));
ImageReceiver[] imageReceiverArr = this.pollAvatarImages;
if (length != imageReceiverArr.length - 1) {
canvas.drawCircle(imageReceiverArr[length].getCenterX(), this.pollAvatarImages[length].getCenterY(), AndroidUtilities.dp(9.0f), this.currentBackgroundDrawable.getPaint());
}
if (this.animatePollAvatars && this.animatePollAnswerAlpha) {
if (this.pollUnvoteInProgress) {
f10 = 1.0f;
f11 = (1.0f - this.pollAnimationProgress) / 0.3f;
} else {
f10 = 1.0f;
f11 = this.pollAnimationProgress;
}
this.pollAvatarImages[length].setAlpha(Math.min(f11, f10));
}
this.pollAvatarImages[length].draw(canvas);
}
}
}
}
if ((!this.pollClosed && !this.pollVoted) || this.pollVoteInProgress) {
TLRPC$Poll tLRPC$Poll = this.lastPoll;
if (tLRPC$Poll.quiz && tLRPC$Poll.close_period != 0) {
long max3 = Math.max(0L, (this.lastPoll.close_date * 1000) - ConnectionsManager.getInstance(this.currentAccount).getCurrentTimeMillis());
if (this.closeTimeText == null || this.lastPollCloseTime != max3) {
this.closeTimeText = AndroidUtilities.formatDurationNoHours((int) Math.ceil(((float) max3) / 1000.0f), false);
this.closeTimeWidth = (int) Math.ceil(Theme.chat_timePaint.measureText(r4));
this.lastPollCloseTime = max3;
}
if (max3 <= 0 && !this.pollClosed) {
if (this.currentMessageObject.pollLastCheckTime + 1000 < SystemClock.elapsedRealtime()) {
this.currentMessageObject.pollLastCheckTime = 0L;
}
this.delegate.needReloadPolls();
}
int dp13 = (this.currentBackgroundDrawable.getBounds().right - this.closeTimeWidth) - AndroidUtilities.dp(this.currentMessageObject.isOutOwner() ? 40.0f : 34.0f);
if (max3 <= 5000) {
Theme.chat_timePaint.setColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outPollWrongAnswer : Theme.key_chat_inPollWrongAnswer));
}
if (this.animatePollAnswer) {
Theme.chat_timePaint.setAlpha((int) ((1.0f - this.pollAnimationProgress) * 255.0f));
}
canvas.drawText(this.closeTimeText, dp13, AndroidUtilities.dp(11.0f) + height, Theme.chat_timePaint);
Theme.chat_pollTimerPaint.setColor(Theme.chat_timePaint.getColor());
int dp14 = dp13 + this.closeTimeWidth + AndroidUtilities.dp(13.0f);
int dp15 = AndroidUtilities.dp(5.1f);
int dp16 = height + AndroidUtilities.dp(6.0f);
if (max3 <= 60000) {
this.rect.set(dp14 - dp15, dp16 - dp15, dp14 + dp15, dp15 + dp16);
float min2 = (((float) max3) / (Math.min(60, this.lastPoll.close_period) * 1000.0f)) * (-360.0f);
f6 = 0.0f;
canvas.drawArc(this.rect, -90.0f, min2, false, Theme.chat_pollTimerPaint);
this.timerParticles.draw(canvas, Theme.chat_pollTimerPaint, this.rect, min2, this.pollVoteInProgress ? 1.0f - this.pollAnimationProgress : 1.0f);
} else {
f6 = 0.0f;
canvas.drawCircle(dp14, dp16, dp15, Theme.chat_pollTimerPaint);
}
if (max3 > 60000 || this.timerTransitionProgress != f6) {
Theme.chat_pollTimerPaint.setAlpha((int) (this.timerTransitionProgress * 255.0f));
float f50 = dp14;
canvas.drawLine(f50 - (AndroidUtilities.dp(2.1f) * this.timerTransitionProgress), dp16 - AndroidUtilities.dp(7.5f), f50 + (AndroidUtilities.dp(2.1f) * this.timerTransitionProgress), dp16 - AndroidUtilities.dp(7.5f), Theme.chat_pollTimerPaint);
float f51 = dp16;
canvas.drawLine(f50, f51 - (AndroidUtilities.dp(3.0f) * this.timerTransitionProgress), f50, f51, Theme.chat_pollTimerPaint);
if (max3 <= 60000) {
float f52 = this.timerTransitionProgress - (((float) j4) / 180.0f);
this.timerTransitionProgress = f52;
if (f52 < f6) {
this.timerTransitionProgress = f6;
}
}
}
invalidate();
if (Build.VERSION.SDK_INT >= 21 && this.selectorDrawable[0] != null) {
iArr = this.selectorDrawableMaskType;
i11 = iArr[0] == 1 ? 3 : 3;
if (iArr[0] == i11) {
canvas.save();
float f53 = this.hintButtonProgress;
canvas.scale(f53, f53, this.selectorDrawable[0].getBounds().centerX(), this.selectorDrawable[0].getBounds().centerY());
}
this.selectorDrawable[0].draw(canvas);
if (this.selectorDrawableMaskType[0] == 3) {
canvas.restore();
}
}
size = this.pollButtons.size();
i9 = 0;
int i34 = 0;
while (i9 < size) {
PollButton pollButton = this.pollButtons.get(i9);
pollButton.x = i30;
canvas.save();
canvas.translate(AndroidUtilities.dp(35.0f) + i30, pollButton.y + this.namesOffset);
pollButton.title.draw(canvas);
if (this.animatePollAnswerAlpha) {
if (this.pollUnvoteInProgress) {
f8 = 1.0f;
f9 = 1.0f - this.pollAnimationProgress;
} else {
f8 = 1.0f;
f9 = this.pollAnimationProgress;
}
f7 = Math.min(f9 / 0.3f, f8) * 255.0f;
} else {
f7 = 255.0f;
}
int i35 = (int) f7;
boolean z11 = this.pollVoted;
if (z11 || this.pollClosed || this.animatePollAnswerAlpha) {
if (this.lastPoll.quiz && z11 && pollButton.chosen) {
if (pollButton.correct) {
i10 = this.currentMessageObject.isOutOwner() ? Theme.key_chat_outPollCorrectAnswer : Theme.key_chat_inPollCorrectAnswer;
} else {
i10 = this.currentMessageObject.isOutOwner() ? Theme.key_chat_outPollWrongAnswer : Theme.key_chat_inPollWrongAnswer;
}
if (!this.currentBackgroundDrawable.hasGradient() || Theme.hasThemeKey(i10)) {
Theme.chat_docBackPaint.setColor(getThemedColor(i10));
} else {
Theme.chat_docBackPaint.setColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outAudioSeekbarFill : Theme.key_chat_inAudioSeekbarFill));
}
} else {
Theme.chat_docBackPaint.setColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outAudioSeekbarFill : Theme.key_chat_inAudioSeekbarFill));
}
if (this.animatePollAnswerAlpha) {
float f54 = i35;
Theme.chat_instantViewPaint.setAlpha((int) ((Theme.chat_instantViewPaint.getAlpha() / 255.0f) * f54));
Theme.chat_docBackPaint.setAlpha((int) (f54 * (Theme.chat_docBackPaint.getAlpha() / 255.0f)));
}
canvas.drawText(String.format("%d%%", Integer.valueOf((int) Math.ceil(pollButton.prevPercent + ((pollButton.percent - pollButton.prevPercent) * this.pollAnimationProgress)))), (-AndroidUtilities.dp(6.5f)) - ((int) Math.ceil(Theme.chat_instantViewPaint.measureText(r0))), AndroidUtilities.dp(14.0f), Theme.chat_instantViewPaint);
this.rect.set(f6, pollButton.height + AndroidUtilities.dp(6.0f), (this.backgroundWidth - AndroidUtilities.dp(76.0f)) * (pollButton.prevPercentProgress + ((pollButton.percentProgress - pollButton.prevPercentProgress) * this.pollAnimationProgress)), pollButton.height + AndroidUtilities.dp(11.0f));
canvas.drawRoundRect(this.rect, AndroidUtilities.dp(2.0f), AndroidUtilities.dp(2.0f), Theme.chat_docBackPaint);
if (pollButton.chosen || pollButton.prevChosen || (this.lastPoll.quiz && pollButton.correct && (this.pollVoted || this.pollClosed))) {
float dp17 = this.rect.left - AndroidUtilities.dp(13.5f);
float centerY = this.rect.centerY();
canvas.drawCircle(dp17, centerY, AndroidUtilities.dp(7.0f), Theme.chat_docBackPaint);
if (this.lastPoll.quiz && pollButton.chosen && !pollButton.correct) {
drawable = Theme.chat_pollCrossDrawable[this.currentMessageObject.isOutOwner() ? 1 : 0];
} else {
drawable = Theme.chat_pollCheckDrawable[this.currentMessageObject.isOutOwner() ? 1 : 0];
}
drawable.setAlpha(i35);
BaseCell.setDrawableBounds(drawable, dp17 - (drawable.getIntrinsicWidth() / 2), centerY - (drawable.getIntrinsicHeight() / 2));
drawable.draw(canvas);
}
}
if ((!this.pollVoted && !this.pollClosed) || this.animatePollAnswerAlpha) {
if (isDrawSelectionBackground()) {
Theme.chat_replyLinePaint.setColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outVoiceSeekbarSelected : Theme.key_chat_inVoiceSeekbarSelected));
} else {
Theme.chat_replyLinePaint.setColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outVoiceSeekbar : Theme.key_chat_inVoiceSeekbar));
}
if (this.animatePollAnswerAlpha) {
Theme.chat_replyLinePaint.setAlpha((int) ((255 - i35) * (Theme.chat_replyLinePaint.getAlpha() / 255.0f)));
}
canvas.drawLine(-AndroidUtilities.dp(2.0f), pollButton.height + AndroidUtilities.dp(13.0f), this.backgroundWidth - AndroidUtilities.dp(58.0f), pollButton.height + AndroidUtilities.dp(13.0f), Theme.chat_replyLinePaint);
if (this.pollVoteInProgress && i9 == this.pollVoteInProgressNum) {
Theme.chat_instantViewRectPaint.setColor(getThemedColor(this.currentMessageObject.isOutOwner() ? Theme.key_chat_outAudioSeekbarFill : Theme.key_chat_inAudioSeekbarFill));
if (this.animatePollAnswerAlpha) {
Theme.chat_instantViewRectPaint.setAlpha((int) ((255 - i35) * (Theme.chat_instantViewRectPaint.getAlpha() / 255.0f)));
}
this.rect.set((-AndroidUtilities.dp(22.0f)) - AndroidUtilities.dp(8.5f), AndroidUtilities.dp(9.0f) - AndroidUtilities.dp(8.5f), (-AndroidUtilities.dp(23.0f)) + AndroidUtilities.dp(8.5f), AndroidUtilities.dp(9.0f) + AndroidUtilities.dp(8.5f));
canvas.drawArc(this.rect, this.voteRadOffset, this.voteCurrentCircleLength, false, Theme.chat_instantViewRectPaint);
} else {
if (this.currentMessageObject.isOutOwner()) {
Theme.chat_instantViewRectPaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_outMenuSelected : Theme.key_chat_outMenu));
} else {
Theme.chat_instantViewRectPaint.setColor(getThemedColor(isDrawSelectionBackground() ? Theme.key_chat_inMenuSelected : Theme.key_chat_inMenu));
}
if (this.animatePollAnswerAlpha) {
Theme.chat_instantViewRectPaint.setAlpha((int) ((255 - i35) * (Theme.chat_instantViewRectPaint.getAlpha() / 255.0f)));
}
canvas.drawCircle(-AndroidUtilities.dp(22.0f), AndroidUtilities.dp(9.0f), AndroidUtilities.dp(8.5f), Theme.chat_instantViewRectPaint);
if (this.lastPoll.multiple_choice) {
int dp18 = AndroidUtilities.dp(8.5f);
int i36 = Theme.key_checkboxCheck;
if (this.currentMessageObject.isOutOwner() && getThemedColor(i36) == -1) {
i36 = Theme.key_chat_outBubble;
}
this.pollCheckBox[i9].setColor(-1, this.currentMessageObject.isOutOwner() ? Theme.key_chat_outAudioSeekbarFill : Theme.key_chat_inAudioSeekbarFill, i36);
int i37 = dp18 / 2;
this.pollCheckBox[i9].setBounds((-AndroidUtilities.dp(22.0f)) - i37, AndroidUtilities.dp(9.0f) - i37, dp18, dp18);
this.pollCheckBox[i9].draw(canvas);
canvas.restore();
if (i9 != size - 1) {
i34 = pollButton.y + this.namesOffset + pollButton.height;
}
i9++;
f6 = 0.0f;
}
}
}
canvas.restore();
if (i9 != size - 1) {
}
i9++;
f6 = 0.0f;
}
if (!this.drawInstantView) {
int currentBackgroundLeft = getCurrentBackgroundLeft() + AndroidUtilities.dp((this.currentMessageObject.isOutOwner() || this.mediaBackground || this.drawPinnedBottom) ? 2.0f : 8.0f);
int dp19 = i34 + AndroidUtilities.dp(13.0f);
if (this.currentMessageObject.isOutOwner()) {
Theme.chat_instantViewPaint.setColor(getThemedColor(Theme.key_chat_outPreviewInstantText));
} else {
Theme.chat_instantViewPaint.setColor(getThemedColor(Theme.key_chat_inPreviewInstantText));
}
this.instantButtonRect.set(currentBackgroundLeft, dp19, this.instantWidth + currentBackgroundLeft, AndroidUtilities.dp(44.0f) + dp19);
Drawable[] drawableArr2 = this.selectorDrawable;
if (drawableArr2[0] != null && this.selectorDrawableMaskType[0] == 2) {
drawableArr2[0].setBounds(currentBackgroundLeft - AndroidUtilities.dp(this.pollInstantViewTouchesBottom ? 6.0f : 0.0f), dp19, this.instantWidth + currentBackgroundLeft, AndroidUtilities.dp(44.0f) + dp19);
this.selectorDrawable[0].draw(canvas);
}
if (this.instantViewLayout != null) {
canvas.save();
canvas.translate(currentBackgroundLeft + this.instantTextX, dp19 + AndroidUtilities.dp(14.5f));
this.instantViewLayout.draw(canvas);
canvas.restore();
}
} else if (this.infoLayout != null) {
TLRPC$Poll tLRPC$Poll2 = this.lastPoll;
if (tLRPC$Poll2.public_voters || tLRPC$Poll2.multiple_choice) {
i34 += AndroidUtilities.dp(6.0f);
}
canvas.save();
canvas.translate(i30 + this.infoX, i34 + AndroidUtilities.dp(22.0f));
this.infoLayout.draw(canvas);
canvas.restore();
}
updatePollAnimations(j4);
canvas.restore();
}
}
f6 = 0.0f;
if (Build.VERSION.SDK_INT >= 21) {
iArr = this.selectorDrawableMaskType;
if (iArr[0] == 1) {
}
if (iArr[0] == i11) {
}
this.selectorDrawable[0].draw(canvas);
if (this.selectorDrawableMaskType[0] == 3) {
}
}
size = this.pollButtons.size();
i9 = 0;
int i342 = 0;
while (i9 < size) {
}
if (!this.drawInstantView) {
}
updatePollAnimations(j4);
canvas.restore();
} else if (i19 == 12) {
drawContact(canvas);
}
}
i = 255;
if (!this.drawImageButton) {
}
if (this.buttonState == -1) {
}
if (z5) {
}
i14 = -1;
i15 = i;
animatedFloat = this.timerParticlesAlpha;
if (animatedFloat == null) {
}
if (f15 > f16) {
}
if (!this.drawVideoImageButton) {
}
f17 = this.controlsAlpha;
if (f17 != 1.0f) {
}
this.videoRadialProgress.draw(canvas);
if (this.drawMediaCheckBox) {
}
if (this.documentAttachType == 7) {
}
}
public void drawRadialProgress(Canvas canvas) {
boolean isRoundOnce = this.currentMessageObject.isRoundOnce();
if (isRoundOnce) {
RectF rectF = AndroidUtilities.rectTmp;
rectF.set(this.radialProgress.getProgressRect());
rectF.inset(-AndroidUtilities.dp(15.0f), -AndroidUtilities.dp(15.0f));
canvas.saveLayerAlpha(rectF, (int) (this.radialProgressAlpha * 255.0f), 31);
}
if (this.currentMessageObject.needDrawBluredPreview()) {
drawPhotoBlurRect(canvas, this.radialProgress.getProgressRect());
}
RadialProgress2 radialProgress2 = this.radialProgress;
radialProgress2.iconScale = 1.0f;
radialProgress2.draw(canvas);
if (isRoundOnce) {
canvas.save();
drawPhotoBlurRect(canvas, getRadialProgress().getProgressRect());
getRadialProgress().draw(canvas);
RectF progressRect = getRadialProgress().getProgressRect();
float centerX = progressRect.centerX() + AndroidUtilities.dp(18.0f);
float centerY = progressRect.centerY() + AndroidUtilities.dp(18.0f);
float dp = AndroidUtilities.dp(10.0f);
float dp2 = AndroidUtilities.dp(1.33f) + dp;
if (this.clipPaint == null) {
Paint paint = new Paint(1);
this.clipPaint = paint;
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
}
canvas.drawCircle(centerX, centerY, dp2, this.clipPaint);
RectF rectF2 = AndroidUtilities.rectTmp;
rectF2.set(centerX - dp, centerY - dp, centerX + dp, dp + centerY);
drawPhotoBlurRect(canvas, rectF2);
if (this.oncePeriod == null) {
CaptionContainerView.PeriodDrawable periodDrawable = new CaptionContainerView.PeriodDrawable(3);
this.oncePeriod = periodDrawable;
periodDrawable.updateColors(-1, 0, 0);
CaptionContainerView.PeriodDrawable periodDrawable2 = this.oncePeriod;
periodDrawable2.diameterDp = 14.0f;
periodDrawable2.setTextSize(10.0f);
this.oncePeriod.strokePaint.setStrokeWidth(AndroidUtilities.dpf2(1.5f));
this.oncePeriod.setValue(1, false, false);
this.oncePeriod.textOffsetX = -AndroidUtilities.dpf2(0.33f);
this.oncePeriod.textOffsetY = AndroidUtilities.dpf2(0.33f);
}
CaptionContainerView.PeriodDrawable periodDrawable3 = this.oncePeriod;
periodDrawable3.diameterDp = 14.0f;
periodDrawable3.setTextSize(10.0f);
this.oncePeriod.setClear(false);
this.oncePeriod.setCenterXY(centerX, centerY);
this.oncePeriod.draw(canvas, 1.0f);
canvas.restore();
canvas.restore();
}
}
protected void drawPhotoBlurRect(Canvas canvas, RectF rectF) {
this.rectPath.rewind();
this.rectPath.addRoundRect(rectF, rectF.width() / 2.0f, rectF.height() / 2.0f, Path.Direction.CW);
canvas.save();
canvas.clipPath(this.rectPath);
float alpha = this.photoImage.getAlpha();
this.photoImage.setAlpha((this.currentMessageObject.isRoundOnce() ? 1.0f : 0.5f) * alpha);
this.photoImage.draw(canvas);
this.photoImage.setAlpha(alpha);
canvas.restore();
Paint themedPaint = getThemedPaint("paintChatTimeBackground");
int alpha2 = themedPaint.getAlpha();
themedPaint.setAlpha((int) (alpha2 * this.controlsAlpha * 0.4f));
canvas.drawRoundRect(rectF, rectF.width() / 2.0f, rectF.height() / 2.0f, themedPaint);
themedPaint.setAlpha(alpha2);
}
@Override
public int getObserverTag() {
return this.TAG;
}
public MessageObject getMessageObject() {
MessageObject messageObject = this.messageObjectToSet;
return messageObject != null ? messageObject : this.currentMessageObject;
}
public TLRPC$Document getStreamingMedia() {
int i = this.documentAttachType;
if (i == 4 || i == 7 || i == 2) {
return this.documentAttach;
}
return null;
}
public boolean drawPinnedBottom() {
MessageObject.GroupedMessages groupedMessages = this.currentMessagesGroup;
if (groupedMessages != null && groupedMessages.isDocuments) {
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
if (groupedMessagePosition == null || (groupedMessagePosition.flags & 8) == 0) {
return true;
}
return this.pinnedBottom;
}
return this.pinnedBottom;
}
public float getVideoTranscriptionProgress() {
MessageObject messageObject;
if (this.transitionParams == null || (messageObject = this.currentMessageObject) == null || !messageObject.isRoundVideo()) {
return 1.0f;
}
TransitionParams transitionParams = this.transitionParams;
if (!transitionParams.animateDrawBackground) {
return this.drawBackground ? 1.0f : 0.0f;
}
if (this.drawBackground) {
return transitionParams.animateChangeProgress;
}
return 1.0f - transitionParams.animateChangeProgress;
}
public boolean drawPinnedTop() {
MessageObject.GroupedMessages groupedMessages = this.currentMessagesGroup;
if (groupedMessages != null && groupedMessages.isDocuments) {
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
if (groupedMessagePosition == null || (groupedMessagePosition.flags & 4) == 0) {
return true;
}
return this.pinnedTop;
}
return this.pinnedTop;
}
public boolean isPinnedBottom() {
return this.pinnedBottom;
}
public boolean isPinnedTop() {
return this.pinnedTop;
}
public MessageObject.GroupedMessages getCurrentMessagesGroup() {
return this.currentMessagesGroup;
}
public MessageObject.GroupedMessagePosition getCurrentPosition() {
return this.currentPosition;
}
public int getLayoutHeight() {
return this.layoutHeight;
}
@Override
public boolean performAccessibilityAction(int i, Bundle bundle) {
ChatMessageCellDelegate chatMessageCellDelegate;
ChatMessageCellDelegate chatMessageCellDelegate2 = this.delegate;
if (chatMessageCellDelegate2 != null && chatMessageCellDelegate2.onAccessibilityAction(i, bundle)) {
return false;
}
if (i == 16) {
int iconForCurrentState = getIconForCurrentState();
if (iconForCurrentState != 4 && iconForCurrentState != 5) {
didPressButton(true, false);
} else if (this.currentMessageObject.type == 16) {
this.delegate.didPressOther(this, this.otherX, this.otherY);
} else {
didClickedImage();
}
return true;
}
if (i == org.telegram.messenger.R.id.acc_action_small_button) {
didPressMiniButton(true);
} else if (i == org.telegram.messenger.R.id.acc_action_msg_options) {
ChatMessageCellDelegate chatMessageCellDelegate3 = this.delegate;
if (chatMessageCellDelegate3 != null) {
if (this.currentMessageObject.type == 16) {
chatMessageCellDelegate3.didLongPress(this, 0.0f, 0.0f);
} else {
chatMessageCellDelegate3.didPressOther(this, this.otherX, this.otherY);
}
}
} else if (i == org.telegram.messenger.R.id.acc_action_open_forwarded_origin && (chatMessageCellDelegate = this.delegate) != null) {
TLRPC$Chat tLRPC$Chat = this.currentForwardChannel;
if (tLRPC$Chat != null) {
chatMessageCellDelegate.didPressChannelAvatar(this, tLRPC$Chat, this.currentMessageObject.messageOwner.fwd_from.channel_post, this.lastTouchX, this.lastTouchY);
} else {
TLRPC$User tLRPC$User = this.currentForwardUser;
if (tLRPC$User != null) {
chatMessageCellDelegate.didPressUserAvatar(this, tLRPC$User, this.lastTouchX, this.lastTouchY);
} else if (this.currentForwardName != null) {
chatMessageCellDelegate.didPressHiddenForward(this);
}
}
}
if ((this.currentMessageObject.isVoice() || this.currentMessageObject.isRoundVideo() || (this.currentMessageObject.isMusic() && MediaController.getInstance().isPlayingMessage(this.currentMessageObject))) && this.seekBarAccessibilityDelegate.performAccessibilityActionInternal(i, bundle)) {
return true;
}
return super.performAccessibilityAction(i, bundle);
}
public void setAnimationRunning(boolean z, boolean z2) {
this.animationRunning = z;
if (z) {
this.willRemoved = z2;
} else {
this.willRemoved = false;
}
}
@Override
public boolean onHoverEvent(MotionEvent motionEvent) {
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
if (motionEvent.getAction() == 9 || motionEvent.getAction() == 7) {
for (int i = 0; i < this.accessibilityVirtualViewBounds.size(); i++) {
if (this.accessibilityVirtualViewBounds.valueAt(i).contains(x, y)) {
int keyAt = this.accessibilityVirtualViewBounds.keyAt(i);
if (keyAt == this.currentFocusedVirtualView) {
return true;
}
this.currentFocusedVirtualView = keyAt;
sendAccessibilityEventForVirtualView(keyAt, LiteMode.FLAG_CHAT_SCALE);
return true;
}
}
} else if (motionEvent.getAction() == 10) {
this.currentFocusedVirtualView = 0;
}
return super.onHoverEvent(motionEvent);
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
}
@Override
public AccessibilityNodeProvider getAccessibilityNodeProvider() {
return new MessageAccessibilityNodeProvider();
}
public void sendAccessibilityEventForVirtualView(int i, int i2) {
sendAccessibilityEventForVirtualView(i, i2, null);
}
private void sendAccessibilityEventForVirtualView(int i, int i2, String str) {
if (((AccessibilityManager) getContext().getSystemService("accessibility")).isTouchExplorationEnabled()) {
AccessibilityEvent obtain = AccessibilityEvent.obtain(i2);
obtain.setPackageName(getContext().getPackageName());
obtain.setSource(this, i);
if (str != null) {
obtain.getText().add(str);
}
if (getParent() != null) {
getParent().requestSendAccessibilityEvent(this, obtain);
}
}
}
public static Point getMessageSize(int i, int i2) {
return getMessageSize(i, i2, 0, 0);
}
private static Point getMessageSize(int i, int i2, int i3, int i4) {
int min;
if (i4 == 0 || i3 == 0) {
if (AndroidUtilities.isTablet()) {
min = AndroidUtilities.getMinTabletSide();
} else if (i >= i2) {
android.graphics.Point point = AndroidUtilities.displaySize;
i3 = Math.min(point.x, point.y) - AndroidUtilities.dp(64.0f);
i4 = AndroidUtilities.dp(100.0f) + i3;
if (i3 > AndroidUtilities.getPhotoSize()) {
i3 = AndroidUtilities.getPhotoSize();
}
if (i4 > AndroidUtilities.getPhotoSize()) {
i4 = AndroidUtilities.getPhotoSize();
}
} else {
android.graphics.Point point2 = AndroidUtilities.displaySize;
min = Math.min(point2.x, point2.y);
}
i3 = (int) (min * 0.7f);
i4 = AndroidUtilities.dp(100.0f) + i3;
if (i3 > AndroidUtilities.getPhotoSize()) {
}
if (i4 > AndroidUtilities.getPhotoSize()) {
}
}
float f = i;
float f2 = i3;
float f3 = f / f2;
int i5 = (int) (f / f3);
float f4 = i2;
int i6 = (int) (f4 / f3);
if (i5 == 0) {
i5 = AndroidUtilities.dp(150.0f);
}
if (i6 == 0) {
i6 = AndroidUtilities.dp(150.0f);
}
if (i6 > i4) {
i5 = (int) (i5 / (i6 / i4));
} else if (i6 < AndroidUtilities.dp(120.0f)) {
i4 = AndroidUtilities.dp(120.0f);
float f5 = f / (f4 / i4);
if (f5 < f2) {
i5 = (int) f5;
}
} else {
i4 = i6;
}
return new Point(i5, i4);
}
public StaticLayout getDescriptionlayout() {
return this.descriptionLayout;
}
public void setSelectedBackgroundProgress(float f) {
this.selectedBackgroundProgress = f;
invalidate();
}
public int computeHeight(MessageObject messageObject, MessageObject.GroupedMessages groupedMessages, boolean z) {
this.photoImage.setIgnoreImageSet(true);
this.avatarImage.setIgnoreImageSet(true);
this.replyImageReceiver.setIgnoreImageSet(true);
this.locationImageReceiver.setIgnoreImageSet(true);
if (groupedMessages != null && groupedMessages.messages.size() != 1) {
if (groupedMessages.messages.size() != groupedMessages.positions.size()) {
groupedMessages.calculate();
}
this.computedGroupCaptionY = 0;
int i = 0;
for (int i2 = 0; i2 < groupedMessages.messages.size(); i2++) {
MessageObject messageObject2 = groupedMessages.messages.get(i2);
MessageObject.GroupedMessagePosition groupedMessagePosition = groupedMessages.positions.get(messageObject2);
if (groupedMessagePosition != null && (groupedMessagePosition.flags & 1) != 0) {
setMessageContent(messageObject2, groupedMessages, false, false);
if (z && !TextUtils.isEmpty(this.currentCaption)) {
updateCaptionLayout();
this.computedGroupCaptionY = (int) (i + this.captionY);
this.computedCaptionLayout = this.captionLayout;
}
i += this.totalHeight + this.keyboardHeight;
}
}
return i;
}
setMessageContent(messageObject, groupedMessages, false, false);
this.photoImage.setIgnoreImageSet(false);
this.avatarImage.setIgnoreImageSet(false);
this.replyImageReceiver.setIgnoreImageSet(false);
this.locationImageReceiver.setIgnoreImageSet(false);
updateCaptionLayout();
return this.totalHeight + this.keyboardHeight;
}
public void shakeView() {
PropertyValuesHolder ofKeyframe = PropertyValuesHolder.ofKeyframe(View.ROTATION, Keyframe.ofFloat(0.0f, 0.0f), Keyframe.ofFloat(0.2f, 3.0f), Keyframe.ofFloat(0.4f, -3.0f), Keyframe.ofFloat(0.6f, 3.0f), Keyframe.ofFloat(0.8f, -3.0f), Keyframe.ofFloat(1.0f, 0.0f));
Keyframe ofFloat = Keyframe.ofFloat(0.0f, 1.0f);
Keyframe ofFloat2 = Keyframe.ofFloat(0.5f, 0.97f);
Keyframe ofFloat3 = Keyframe.ofFloat(1.0f, 1.0f);
PropertyValuesHolder ofKeyframe2 = PropertyValuesHolder.ofKeyframe(View.SCALE_X, ofFloat, ofFloat2, ofFloat3);
PropertyValuesHolder ofKeyframe3 = PropertyValuesHolder.ofKeyframe(View.SCALE_Y, ofFloat, ofFloat2, ofFloat3);
AnimatorSet animatorSet = new AnimatorSet();
this.shakeAnimation = animatorSet;
animatorSet.playTogether(ObjectAnimator.ofPropertyValuesHolder(this, ofKeyframe), ObjectAnimator.ofPropertyValuesHolder(this, ofKeyframe2), ObjectAnimator.ofPropertyValuesHolder(this, ofKeyframe3));
this.shakeAnimation.setDuration(500L);
this.shakeAnimation.start();
}
private void cancelShakeAnimation() {
AnimatorSet animatorSet = this.shakeAnimation;
if (animatorSet != null) {
animatorSet.cancel();
this.shakeAnimation = null;
setScaleX(1.0f);
setScaleY(1.0f);
setRotation(0.0f);
}
}
public void setSlidingOffset(float f) {
if (this.slidingOffsetX != f) {
this.slidingOffsetX = f;
updateTranslation();
}
}
public void setAnimationOffsetX(float f) {
if (this.animationOffsetX != f) {
this.animationOffsetX = f;
updateTranslation();
}
}
private void updateTranslation() {
MessageObject messageObject = this.currentMessageObject;
if (messageObject == null) {
return;
}
setTranslationX(this.slidingOffsetX + this.animationOffsetX + ((!messageObject.isOutOwner() || this.currentMessageObject.hasWideCode) ? this.checkBoxTranslation : 0));
}
public float getNonAnimationTranslationX(boolean z) {
boolean z2;
MessageObject messageObject = this.currentMessageObject;
if (messageObject != null && !messageObject.isOutOwner()) {
if (z && ((z2 = this.checkBoxVisible) || this.checkBoxAnimationInProgress)) {
this.checkBoxTranslation = (int) Math.ceil((z2 ? CubicBezierInterpolator.EASE_OUT : CubicBezierInterpolator.EASE_IN).getInterpolation(this.checkBoxAnimationProgress) * AndroidUtilities.dp(35.0f));
}
return this.slidingOffsetX + this.checkBoxTranslation;
}
return this.slidingOffsetX;
}
public float getSlidingOffsetX() {
return this.slidingOffsetX;
}
public boolean willRemovedAfterAnimation() {
return this.willRemoved;
}
public float getAnimationOffsetX() {
return this.animationOffsetX;
}
@Override
public void setTranslationX(float f) {
super.setTranslationX(f);
}
public SeekBar getSeekBar() {
return this.seekBar;
}
public SeekBarWaveform getSeekBarWaveform() {
return this.seekBarWaveform;
}
public class MessageAccessibilityNodeProvider extends AccessibilityNodeProvider {
private Path linkPath;
private Rect rect;
private RectF rectF;
private MessageAccessibilityNodeProvider() {
this.linkPath = new Path();
this.rectF = new RectF();
this.rect = new Rect();
}
private class ProfileSpan extends ClickableSpan {
private TLRPC$User user;
public ProfileSpan(TLRPC$User tLRPC$User) {
this.user = tLRPC$User;
}
@Override
public void onClick(View view) {
if (ChatMessageCell.this.delegate != null) {
ChatMessageCell.this.delegate.didPressUserAvatar(ChatMessageCell.this, this.user, 0.0f, 0.0f);
}
}
}
@Override
public AccessibilityNodeInfo createAccessibilityNodeInfo(int i) {
int i2;
boolean z;
boolean z2;
int i3;
String str;
String formatShortNumber;
boolean z3;
int i4;
String str2;
boolean z4;
boolean z5;
CharSequence charSequence;
CharSequence charSequence2;
int i5;
boolean z6;
TLRPC$MessagePeerReaction tLRPC$MessagePeerReaction;
int i6;
String str3;
String string;
String string2;
AccessibilityNodeInfo.CollectionItemInfo collectionItemInfo;
int[] iArr = {0, 0};
ChatMessageCell.this.getLocationOnScreen(iArr);
if (i == -1) {
AccessibilityNodeInfo obtain = AccessibilityNodeInfo.obtain(ChatMessageCell.this);
ChatMessageCell.this.onInitializeAccessibilityNodeInfo(obtain);
boolean z7 = ChatMessageCell.this.currentMessageObject != null && ChatMessageCell.this.currentMessageObject.isOut() && !ChatMessageCell.this.currentMessageObject.scheduled && ChatMessageCell.this.currentMessageObject.isUnread();
boolean z8 = ChatMessageCell.this.currentMessageObject != null && ChatMessageCell.this.currentMessageObject.isContentUnread();
long j = ChatMessageCell.this.currentMessageObject != null ? ChatMessageCell.this.currentMessageObject.loadedFileSize : 0L;
ChatMessageCell chatMessageCell = ChatMessageCell.this;
if (chatMessageCell.accessibilityText == null || chatMessageCell.accessibilityTextUnread != z7 || ChatMessageCell.this.accessibilityTextContentUnread != z8 || ChatMessageCell.this.accessibilityTextFileSize != j) {
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
ChatMessageCell chatMessageCell2 = ChatMessageCell.this;
if (chatMessageCell2.isChat && chatMessageCell2.currentUser != null && !ChatMessageCell.this.currentMessageObject.isOut()) {
spannableStringBuilder.append((CharSequence) UserObject.getUserName(ChatMessageCell.this.currentUser));
spannableStringBuilder.setSpan(new ProfileSpan(ChatMessageCell.this.currentUser), 0, spannableStringBuilder.length(), 33);
spannableStringBuilder.append('\n');
}
if (ChatMessageCell.this.drawForwardedName) {
int i7 = 0;
while (i7 < 2) {
if (ChatMessageCell.this.forwardedNameLayout[i7] != null && ChatMessageCell.this.forwardedNameLayout[i7].getText() != null) {
spannableStringBuilder.append(ChatMessageCell.this.forwardedNameLayout[i7].getText());
spannableStringBuilder.append(i7 == 0 ? " " : "\n");
}
i7++;
}
}
if (ChatMessageCell.this.documentAttach != null && ChatMessageCell.this.documentAttachType == 1) {
String attachFileName = FileLoader.getAttachFileName(ChatMessageCell.this.documentAttach);
if (attachFileName.indexOf(46) != -1) {
spannableStringBuilder.append((CharSequence) LocaleController.formatString(org.telegram.messenger.R.string.AccDescrDocumentType, attachFileName.substring(attachFileName.lastIndexOf(46) + 1).toUpperCase(Locale.ROOT)));
}
}
if (!TextUtils.isEmpty(ChatMessageCell.this.currentMessageObject.messageText)) {
spannableStringBuilder.append(ChatMessageCell.this.currentMessageObject.messageText);
}
if (ChatMessageCell.this.documentAttach == null || !((ChatMessageCell.this.documentAttachType == 1 || ChatMessageCell.this.documentAttachType == 2 || ChatMessageCell.this.documentAttachType == 4) && ChatMessageCell.this.buttonState == 1 && ChatMessageCell.this.loadingProgressLayout != null)) {
charSequence = ", ";
} else {
spannableStringBuilder.append((CharSequence) "\n");
boolean isSending = ChatMessageCell.this.currentMessageObject.isSending();
charSequence = ", ";
spannableStringBuilder.append((CharSequence) LocaleController.formatString(isSending ? "AccDescrUploadProgress" : "AccDescrDownloadProgress", isSending ? org.telegram.messenger.R.string.AccDescrUploadProgress : org.telegram.messenger.R.string.AccDescrDownloadProgress, AndroidUtilities.formatFileSize(ChatMessageCell.this.currentMessageObject.loadedFileSize), AndroidUtilities.formatFileSize(ChatMessageCell.this.lastLoadingSizeTotal)));
}
if (!ChatMessageCell.this.currentMessageObject.isMusic()) {
charSequence2 = charSequence;
if (ChatMessageCell.this.currentMessageObject.isVoice() || ChatMessageCell.this.isRoundVideo) {
spannableStringBuilder.append(charSequence2);
spannableStringBuilder.append((CharSequence) LocaleController.formatDuration((int) ChatMessageCell.this.currentMessageObject.getDuration()));
spannableStringBuilder.append(charSequence2);
if (ChatMessageCell.this.currentMessageObject.isContentUnread()) {
spannableStringBuilder.append((CharSequence) LocaleController.getString("AccDescrMsgNotPlayed", org.telegram.messenger.R.string.AccDescrMsgNotPlayed));
} else {
spannableStringBuilder.append((CharSequence) LocaleController.getString("AccDescrMsgPlayed", org.telegram.messenger.R.string.AccDescrMsgPlayed));
}
}
} else {
spannableStringBuilder.append((CharSequence) "\n");
spannableStringBuilder.append((CharSequence) LocaleController.formatString("AccDescrMusicInfo", org.telegram.messenger.R.string.AccDescrMusicInfo, ChatMessageCell.this.currentMessageObject.getMusicAuthor(), ChatMessageCell.this.currentMessageObject.getMusicTitle()));
charSequence2 = charSequence;
spannableStringBuilder.append(charSequence2);
spannableStringBuilder.append((CharSequence) LocaleController.formatDuration((int) ChatMessageCell.this.currentMessageObject.getDuration()));
}
if (ChatMessageCell.this.lastPoll != null) {
spannableStringBuilder.append(charSequence2);
spannableStringBuilder.append((CharSequence) ChatMessageCell.this.lastPoll.question);
spannableStringBuilder.append(charSequence2);
if (!ChatMessageCell.this.pollClosed) {
if (ChatMessageCell.this.lastPoll.quiz) {
if (ChatMessageCell.this.lastPoll.public_voters) {
string = LocaleController.getString("QuizPoll", org.telegram.messenger.R.string.QuizPoll);
} else {
string = LocaleController.getString("AnonymousQuizPoll", org.telegram.messenger.R.string.AnonymousQuizPoll);
}
} else if (ChatMessageCell.this.lastPoll.public_voters) {
string = LocaleController.getString("PublicPoll", org.telegram.messenger.R.string.PublicPoll);
} else {
string = LocaleController.getString("AnonymousPoll", org.telegram.messenger.R.string.AnonymousPoll);
}
} else {
string = LocaleController.getString("FinalResults", org.telegram.messenger.R.string.FinalResults);
}
spannableStringBuilder.append((CharSequence) string);
}
if (ChatMessageCell.this.documentAttach != null) {
if (ChatMessageCell.this.documentAttachType == 4) {
spannableStringBuilder.append(charSequence2);
spannableStringBuilder.append((CharSequence) LocaleController.formatDuration((int) ChatMessageCell.this.currentMessageObject.getDuration()));
}
if (ChatMessageCell.this.buttonState == 0 || ChatMessageCell.this.documentAttachType == 1) {
spannableStringBuilder.append(charSequence2);
spannableStringBuilder.append((CharSequence) AndroidUtilities.formatFileSize(ChatMessageCell.this.documentAttach.size));
}
}
if (!ChatMessageCell.this.currentMessageObject.isVoiceTranscriptionOpen()) {
if (MessageObject.getMedia(ChatMessageCell.this.currentMessageObject.messageOwner) != null && !TextUtils.isEmpty(ChatMessageCell.this.currentMessageObject.caption)) {
spannableStringBuilder.append((CharSequence) "\n");
spannableStringBuilder.append(ChatMessageCell.this.currentMessageObject.caption);
}
} else {
spannableStringBuilder.append((CharSequence) "\n");
spannableStringBuilder.append(ChatMessageCell.this.currentMessageObject.getVoiceTranscription());
}
if (ChatMessageCell.this.currentMessageObject.isOut()) {
if (!ChatMessageCell.this.currentMessageObject.isSent()) {
if (!ChatMessageCell.this.currentMessageObject.isSending()) {
if (ChatMessageCell.this.currentMessageObject.isSendError()) {
spannableStringBuilder.append((CharSequence) "\n");
spannableStringBuilder.append((CharSequence) LocaleController.getString("AccDescrMsgSendingError", org.telegram.messenger.R.string.AccDescrMsgSendingError));
}
} else {
spannableStringBuilder.append((CharSequence) "\n");
spannableStringBuilder.append((CharSequence) LocaleController.getString("AccDescrMsgSending", org.telegram.messenger.R.string.AccDescrMsgSending));
float progress = ChatMessageCell.this.radialProgress.getProgress();
if (progress > 0.0f) {
spannableStringBuilder.append((CharSequence) Integer.toString(Math.round(progress * 100.0f))).append((CharSequence) "%");
}
}
} else {
spannableStringBuilder.append((CharSequence) "\n");
if (ChatMessageCell.this.currentMessageObject.scheduled) {
spannableStringBuilder.append((CharSequence) LocaleController.formatString("AccDescrScheduledDate", org.telegram.messenger.R.string.AccDescrScheduledDate, ChatMessageCell.this.currentTimeString));
} else {
spannableStringBuilder.append((CharSequence) LocaleController.formatString("AccDescrSentDate", org.telegram.messenger.R.string.AccDescrSentDate, LocaleController.getString("TodayAt", org.telegram.messenger.R.string.TodayAt) + " " + ((Object) ChatMessageCell.this.currentTimeString)));
spannableStringBuilder.append(charSequence2);
if (ChatMessageCell.this.currentMessageObject.isUnread()) {
i6 = org.telegram.messenger.R.string.AccDescrMsgUnread;
str3 = "AccDescrMsgUnread";
} else {
i6 = org.telegram.messenger.R.string.AccDescrMsgRead;
str3 = "AccDescrMsgRead";
}
spannableStringBuilder.append((CharSequence) LocaleController.getString(str3, i6));
}
}
} else {
spannableStringBuilder.append((CharSequence) "\n");
spannableStringBuilder.append((CharSequence) LocaleController.formatString("AccDescrReceivedDate", org.telegram.messenger.R.string.AccDescrReceivedDate, LocaleController.getString("TodayAt", org.telegram.messenger.R.string.TodayAt) + " " + ((Object) ChatMessageCell.this.currentTimeString)));
}
if (ChatMessageCell.this.getRepliesCount() > 0 && !ChatMessageCell.this.hasCommentLayout()) {
spannableStringBuilder.append((CharSequence) "\n");
spannableStringBuilder.append((CharSequence) LocaleController.formatPluralString("AccDescrNumberOfReplies", ChatMessageCell.this.getRepliesCount(), new Object[0]));
}
if (ChatMessageCell.this.currentMessageObject.messageOwner.reactions != null && ChatMessageCell.this.currentMessageObject.messageOwner.reactions.results != null) {
String str4 = "";
if (ChatMessageCell.this.currentMessageObject.messageOwner.reactions.results.size() == 1) {
TLRPC$ReactionCount tLRPC$ReactionCount = ChatMessageCell.this.currentMessageObject.messageOwner.reactions.results.get(0);
TLRPC$Reaction tLRPC$Reaction = tLRPC$ReactionCount.reaction;
String str5 = tLRPC$Reaction instanceof TLRPC$TL_reactionEmoji ? ((TLRPC$TL_reactionEmoji) tLRPC$Reaction).emoticon : "";
int i8 = tLRPC$ReactionCount.count;
if (i8 == 1) {
spannableStringBuilder.append((CharSequence) "\n");
if (ChatMessageCell.this.currentMessageObject.messageOwner.reactions.recent_reactions == null || ChatMessageCell.this.currentMessageObject.messageOwner.reactions.recent_reactions.size() != 1 || (tLRPC$MessagePeerReaction = ChatMessageCell.this.currentMessageObject.messageOwner.reactions.recent_reactions.get(0)) == null) {
z6 = false;
} else {
TLRPC$User user = MessagesController.getInstance(ChatMessageCell.this.currentAccount).getUser(Long.valueOf(MessageObject.getPeerId(tLRPC$MessagePeerReaction.peer_id)));
z6 = UserObject.isUserSelf(user);
if (user != null) {
str4 = UserObject.getFirstName(user);
}
}
if (z6) {
spannableStringBuilder.append((CharSequence) LocaleController.formatString("AccDescrYouReactedWith", org.telegram.messenger.R.string.AccDescrYouReactedWith, str5));
} else {
spannableStringBuilder.append((CharSequence) LocaleController.formatString("AccDescrReactedWith", org.telegram.messenger.R.string.AccDescrReactedWith, str4, str5));
}
} else if (i8 > 1) {
spannableStringBuilder.append((CharSequence) "\n");
spannableStringBuilder.append((CharSequence) LocaleController.formatPluralString("AccDescrNumberOfPeopleReactions", tLRPC$ReactionCount.count, str5));
}
} else {
spannableStringBuilder.append((CharSequence) LocaleController.getString("Reactions", org.telegram.messenger.R.string.Reactions)).append((CharSequence) ": ");
int size = ChatMessageCell.this.currentMessageObject.messageOwner.reactions.results.size();
for (int i9 = 0; i9 < size; i9++) {
TLRPC$ReactionCount tLRPC$ReactionCount2 = ChatMessageCell.this.currentMessageObject.messageOwner.reactions.results.get(i9);
TLRPC$Reaction tLRPC$Reaction2 = tLRPC$ReactionCount2.reaction;
spannableStringBuilder.append((CharSequence) (tLRPC$Reaction2 instanceof TLRPC$TL_reactionEmoji ? ((TLRPC$TL_reactionEmoji) tLRPC$Reaction2).emoticon : "")).append((CharSequence) " ").append((CharSequence) (tLRPC$ReactionCount2.count + ""));
if (i9 + 1 < size) {
spannableStringBuilder.append(charSequence2);
}
}
spannableStringBuilder.append((CharSequence) "\n");
}
}
if ((ChatMessageCell.this.currentMessageObject.messageOwner.flags & 1024) != 0) {
spannableStringBuilder.append((CharSequence) "\n");
i5 = 0;
spannableStringBuilder.append((CharSequence) LocaleController.formatPluralString("AccDescrNumberOfViews", ChatMessageCell.this.currentMessageObject.messageOwner.views, new Object[0]));
} else {
i5 = 0;
}
spannableStringBuilder.append((CharSequence) "\n");
for (final CharacterStyle characterStyle : (CharacterStyle[]) spannableStringBuilder.getSpans(i5, spannableStringBuilder.length(), ClickableSpan.class)) {
int spanStart = spannableStringBuilder.getSpanStart(characterStyle);
int spanEnd = spannableStringBuilder.getSpanEnd(characterStyle);
spannableStringBuilder.removeSpan(characterStyle);
spannableStringBuilder.setSpan(new ClickableSpan() {
@Override
public void onClick(View view) {
CharacterStyle characterStyle2 = characterStyle;
if (!(characterStyle2 instanceof ProfileSpan)) {
if (ChatMessageCell.this.delegate != null) {
ChatMessageCell.this.delegate.didPressUrl(ChatMessageCell.this, characterStyle, false);
return;
}
return;
}
((ProfileSpan) characterStyle2).onClick(view);
}
}, spanStart, spanEnd, 33);
}
ChatMessageCell chatMessageCell3 = ChatMessageCell.this;
chatMessageCell3.accessibilityText = spannableStringBuilder;
chatMessageCell3.accessibilityTextUnread = z7;
ChatMessageCell.this.accessibilityTextContentUnread = z8;
ChatMessageCell.this.accessibilityTextFileSize = j;
}
int i10 = Build.VERSION.SDK_INT;
if (i10 < 24) {
obtain.setContentDescription(ChatMessageCell.this.accessibilityText.toString());
} else {
obtain.setText(ChatMessageCell.this.accessibilityText);
}
obtain.setEnabled(true);
if (i10 >= 19 && (collectionItemInfo = obtain.getCollectionItemInfo()) != null) {
obtain.setCollectionItemInfo(AccessibilityNodeInfo.CollectionItemInfo.obtain(collectionItemInfo.getRowIndex(), 1, 0, 1, false));
}
if (i10 >= 21) {
obtain.addAction(new AccessibilityNodeInfo.AccessibilityAction(org.telegram.messenger.R.id.acc_action_msg_options, LocaleController.getString("AccActionMessageOptions", org.telegram.messenger.R.string.AccActionMessageOptions)));
int iconForCurrentState = ChatMessageCell.this.getIconForCurrentState();
if (iconForCurrentState == 0) {
string2 = LocaleController.getString("AccActionPlay", org.telegram.messenger.R.string.AccActionPlay);
} else if (iconForCurrentState == 1) {
string2 = LocaleController.getString("AccActionPause", org.telegram.messenger.R.string.AccActionPause);
} else if (iconForCurrentState == 2) {
string2 = LocaleController.getString("AccActionDownload", org.telegram.messenger.R.string.AccActionDownload);
} else if (iconForCurrentState == 3) {
string2 = LocaleController.getString("AccActionCancelDownload", org.telegram.messenger.R.string.AccActionCancelDownload);
} else if (iconForCurrentState == 5) {
string2 = LocaleController.getString("AccActionOpenFile", org.telegram.messenger.R.string.AccActionOpenFile);
} else {
string2 = ChatMessageCell.this.currentMessageObject.type == 16 ? LocaleController.getString("CallAgain", org.telegram.messenger.R.string.CallAgain) : null;
}
obtain.addAction(new AccessibilityNodeInfo.AccessibilityAction(16, string2));
obtain.addAction(new AccessibilityNodeInfo.AccessibilityAction(32, LocaleController.getString("AccActionEnterSelectionMode", org.telegram.messenger.R.string.AccActionEnterSelectionMode)));
if (ChatMessageCell.this.getMiniIconForCurrentState() == 2) {
obtain.addAction(new AccessibilityNodeInfo.AccessibilityAction(org.telegram.messenger.R.id.acc_action_small_button, LocaleController.getString("AccActionDownload", org.telegram.messenger.R.string.AccActionDownload)));
}
} else {
obtain.addAction(16);
obtain.addAction(32);
}
if ((ChatMessageCell.this.currentMessageObject.isVoice() || ChatMessageCell.this.currentMessageObject.isRoundVideo() || ChatMessageCell.this.currentMessageObject.isMusic()) && MediaController.getInstance().isPlayingMessage(ChatMessageCell.this.currentMessageObject)) {
ChatMessageCell.this.seekBarAccessibilityDelegate.onInitializeAccessibilityNodeInfoInternal(obtain);
}
if (ChatMessageCell.this.useTranscribeButton) {
ChatMessageCell chatMessageCell4 = ChatMessageCell.this;
if (chatMessageCell4.transcribeButton != null) {
obtain.addChild(chatMessageCell4, FileUtils.FileMode.MODE_755);
}
}
if (i10 < 24) {
ChatMessageCell chatMessageCell5 = ChatMessageCell.this;
if (chatMessageCell5.isChat && chatMessageCell5.currentUser != null && !ChatMessageCell.this.currentMessageObject.isOut()) {
obtain.addChild(ChatMessageCell.this, 5000);
}
if (ChatMessageCell.this.currentMessageObject.messageText instanceof Spannable) {
Spannable spannable = (Spannable) ChatMessageCell.this.currentMessageObject.messageText;
int i11 = 0;
for (CharacterStyle characterStyle2 : (CharacterStyle[]) spannable.getSpans(0, spannable.length(), ClickableSpan.class)) {
obtain.addChild(ChatMessageCell.this, i11 + 2000);
i11++;
}
}
if (ChatMessageCell.this.currentMessageObject.caption instanceof Spannable) {
ChatMessageCell chatMessageCell6 = ChatMessageCell.this;
if (chatMessageCell6.captionLayout != null) {
Spannable spannable2 = (Spannable) chatMessageCell6.currentMessageObject.caption;
int i12 = 0;
for (CharacterStyle characterStyle3 : (CharacterStyle[]) spannable2.getSpans(0, spannable2.length(), ClickableSpan.class)) {
obtain.addChild(ChatMessageCell.this, i12 + 3000);
i12++;
}
}
}
}
Iterator it = ChatMessageCell.this.botButtons.iterator();
int i13 = 0;
while (it.hasNext()) {
obtain.addChild(ChatMessageCell.this, i13 + 1000);
i13++;
}
if (ChatMessageCell.this.hintButtonVisible && ChatMessageCell.this.pollHintX != -1 && ChatMessageCell.this.currentMessageObject.isPoll()) {
obtain.addChild(ChatMessageCell.this, 495);
}
Iterator it2 = ChatMessageCell.this.pollButtons.iterator();
int i14 = 0;
while (it2.hasNext()) {
obtain.addChild(ChatMessageCell.this, i14 + 500);
i14++;
}
if (ChatMessageCell.this.drawInstantView && !ChatMessageCell.this.instantButtonRect.isEmpty()) {
obtain.addChild(ChatMessageCell.this, 499);
}
if (ChatMessageCell.this.drawContact && ChatMessageCell.this.contactRect != null && !ChatMessageCell.this.contactRect.isEmpty()) {
obtain.addChild(ChatMessageCell.this, 492);
if (ChatMessageCell.this.contactButtons != null && ChatMessageCell.this.contactButtons.size() > 1) {
Iterator it3 = ChatMessageCell.this.contactButtons.iterator();
while (it3.hasNext()) {
InstantViewButton instantViewButton = (InstantViewButton) it3.next();
if (ChatMessageCell.this.drawContactView && instantViewButton.type == 5 && !instantViewButton.rect.isEmpty()) {
obtain.addChild(ChatMessageCell.this, 491);
}
if (ChatMessageCell.this.drawContactAdd && instantViewButton.type == 31 && !instantViewButton.rect.isEmpty()) {
obtain.addChild(ChatMessageCell.this, 490);
}
if (ChatMessageCell.this.drawContactSendMessage && instantViewButton.type == 30 && !instantViewButton.rect.isEmpty()) {
obtain.addChild(ChatMessageCell.this, 489);
}
}
}
}
if (ChatMessageCell.this.commentLayout != null) {
obtain.addChild(ChatMessageCell.this, 496);
}
if (ChatMessageCell.this.drawSideButton == 1 || ChatMessageCell.this.drawSideButton == 2) {
obtain.addChild(ChatMessageCell.this, 498);
}
ChatMessageCell chatMessageCell7 = ChatMessageCell.this;
if (chatMessageCell7.replyNameLayout != null) {
obtain.addChild(chatMessageCell7, 497);
}
if (ChatMessageCell.this.forwardedNameLayout[0] != null && ChatMessageCell.this.forwardedNameLayout[1] != null) {
if (Build.VERSION.SDK_INT >= 21) {
obtain.addAction(new AccessibilityNodeInfo.AccessibilityAction(org.telegram.messenger.R.id.acc_action_open_forwarded_origin, LocaleController.getString("AccActionOpenForwardedOrigin", org.telegram.messenger.R.string.AccActionOpenForwardedOrigin)));
} else {
obtain.addChild(ChatMessageCell.this, 494);
}
}
if (ChatMessageCell.this.drawSelectionBackground || ChatMessageCell.this.getBackground() != null) {
obtain.setSelected(true);
}
return obtain;
}
AccessibilityNodeInfo obtain2 = AccessibilityNodeInfo.obtain();
obtain2.setSource(ChatMessageCell.this, i);
obtain2.setParent(ChatMessageCell.this);
obtain2.setPackageName(ChatMessageCell.this.getContext().getPackageName());
if (i == 5000) {
if (ChatMessageCell.this.currentUser == null) {
return null;
}
obtain2.setText(UserObject.getUserName(ChatMessageCell.this.currentUser));
this.rect.set((int) ChatMessageCell.this.nameX, (int) ChatMessageCell.this.nameY, (int) (ChatMessageCell.this.nameX + ChatMessageCell.this.nameWidth), (int) (ChatMessageCell.this.nameY + (ChatMessageCell.this.nameLayout != null ? ChatMessageCell.this.nameLayout.getHeight() : 10)));
obtain2.setBoundsInParent(this.rect);
if (ChatMessageCell.this.accessibilityVirtualViewBounds.get(i) == null) {
ChatMessageCell.this.accessibilityVirtualViewBounds.put(i, new Rect(this.rect));
}
this.rect.offset(iArr[0], iArr[1]);
obtain2.setBoundsInScreen(this.rect);
obtain2.setClassName("android.widget.TextView");
obtain2.setEnabled(true);
obtain2.setClickable(true);
obtain2.setLongClickable(true);
obtain2.addAction(16);
obtain2.addAction(32);
} else if (i >= 3000) {
if (!(ChatMessageCell.this.currentMessageObject.caption instanceof Spannable)) {
return null;
}
ChatMessageCell chatMessageCell8 = ChatMessageCell.this;
if (chatMessageCell8.captionLayout == null) {
return null;
}
Spannable spannable3 = (Spannable) chatMessageCell8.currentMessageObject.caption;
ClickableSpan linkById = getLinkById(i, false);
if (linkById == null) {
return null;
}
int[] realSpanStartAndEnd = ChatMessageCell.this.getRealSpanStartAndEnd(spannable3, linkById);
obtain2.setText(spannable3.subSequence(realSpanStartAndEnd[0], realSpanStartAndEnd[1]).toString());
Iterator<MessageObject.TextLayoutBlock> it4 = ChatMessageCell.this.captionLayout.textLayoutBlocks.iterator();
while (true) {
if (!it4.hasNext()) {
z5 = true;
break;
}
MessageObject.TextLayoutBlock next = it4.next();
int length = next.textLayout.getText().length();
int i15 = next.charactersOffset;
if (i15 <= realSpanStartAndEnd[0] && length + i15 >= realSpanStartAndEnd[1]) {
next.textLayout.getSelectionPath(realSpanStartAndEnd[0] - i15, realSpanStartAndEnd[1] - i15, this.linkPath);
this.linkPath.computeBounds(this.rectF, true);
Rect rect = this.rect;
RectF rectF = this.rectF;
rect.set((int) rectF.left, (int) rectF.top, (int) rectF.right, (int) rectF.bottom);
this.rect.offset(0, (int) next.textYOffset);
Rect rect2 = this.rect;
ChatMessageCell chatMessageCell9 = ChatMessageCell.this;
rect2.offset(chatMessageCell9.textX, chatMessageCell9.textY);
obtain2.setBoundsInParent(this.rect);
if (ChatMessageCell.this.accessibilityVirtualViewBounds.get(i) == null) {
ChatMessageCell.this.accessibilityVirtualViewBounds.put(i, new Rect(this.rect));
}
z5 = true;
this.rect.offset(iArr[0], iArr[1]);
obtain2.setBoundsInScreen(this.rect);
}
}
obtain2.setClassName("android.widget.TextView");
obtain2.setEnabled(z5);
obtain2.setClickable(z5);
obtain2.setLongClickable(z5);
obtain2.addAction(16);
obtain2.addAction(32);
} else if (i >= 2000) {
if (!(ChatMessageCell.this.currentMessageObject.messageText instanceof Spannable)) {
return null;
}
Spannable spannable4 = (Spannable) ChatMessageCell.this.currentMessageObject.messageText;
ClickableSpan linkById2 = getLinkById(i, false);
if (linkById2 == null) {
return null;
}
int[] realSpanStartAndEnd2 = ChatMessageCell.this.getRealSpanStartAndEnd(spannable4, linkById2);
obtain2.setText(spannable4.subSequence(realSpanStartAndEnd2[0], realSpanStartAndEnd2[1]).toString());
Iterator<MessageObject.TextLayoutBlock> it5 = ChatMessageCell.this.currentMessageObject.textLayoutBlocks.iterator();
while (true) {
if (!it5.hasNext()) {
z4 = true;
break;
}
MessageObject.TextLayoutBlock next2 = it5.next();
int length2 = next2.textLayout.getText().length();
int i16 = next2.charactersOffset;
if (i16 <= realSpanStartAndEnd2[0] && length2 + i16 >= realSpanStartAndEnd2[1]) {
next2.textLayout.getSelectionPath(realSpanStartAndEnd2[0] - i16, realSpanStartAndEnd2[1] - i16, this.linkPath);
this.linkPath.computeBounds(this.rectF, true);
Rect rect3 = this.rect;
RectF rectF2 = this.rectF;
rect3.set((int) rectF2.left, (int) rectF2.top, (int) rectF2.right, (int) rectF2.bottom);
this.rect.offset(0, (int) next2.textYOffset);
Rect rect4 = this.rect;
ChatMessageCell chatMessageCell10 = ChatMessageCell.this;
rect4.offset(chatMessageCell10.textX, chatMessageCell10.textY);
obtain2.setBoundsInParent(this.rect);
if (ChatMessageCell.this.accessibilityVirtualViewBounds.get(i) == null) {
ChatMessageCell.this.accessibilityVirtualViewBounds.put(i, new Rect(this.rect));
}
z4 = true;
this.rect.offset(iArr[0], iArr[1]);
obtain2.setBoundsInScreen(this.rect);
}
}
obtain2.setClassName("android.widget.TextView");
obtain2.setEnabled(z4);
obtain2.setClickable(z4);
obtain2.setLongClickable(z4);
obtain2.addAction(16);
obtain2.addAction(32);
} else if (i >= 1000) {
int i17 = i - 1000;
if (i17 >= ChatMessageCell.this.botButtons.size()) {
return null;
}
BotButton botButton = (BotButton) ChatMessageCell.this.botButtons.get(i17);
obtain2.setText(botButton.title.getText());
obtain2.setClassName("android.widget.Button");
obtain2.setEnabled(true);
obtain2.setClickable(true);
obtain2.addAction(16);
this.rect.set(botButton.x, botButton.y, botButton.x + botButton.width, botButton.y + botButton.height);
this.rect.offset(ChatMessageCell.this.currentMessageObject.isOutOwner() ? (ChatMessageCell.this.getMeasuredWidth() - ChatMessageCell.this.widthForButtons) - AndroidUtilities.dp(10.0f) : ChatMessageCell.this.backgroundDrawableLeft + AndroidUtilities.dp(ChatMessageCell.this.mediaBackground ? 1.0f : 7.0f), ChatMessageCell.this.layoutHeight);
obtain2.setBoundsInParent(this.rect);
if (ChatMessageCell.this.accessibilityVirtualViewBounds.get(i) == null) {
ChatMessageCell.this.accessibilityVirtualViewBounds.put(i, new Rect(this.rect));
}
this.rect.offset(iArr[0], iArr[1]);
obtain2.setBoundsInScreen(this.rect);
} else {
if (i >= 500) {
int i18 = i - 500;
if (i18 >= ChatMessageCell.this.pollButtons.size()) {
return null;
}
PollButton pollButton = (PollButton) ChatMessageCell.this.pollButtons.get(i18);
StringBuilder sb = new StringBuilder(pollButton.title.getText());
if (ChatMessageCell.this.pollVoted) {
obtain2.setSelected(pollButton.chosen);
sb.append(", ");
sb.append(pollButton.percent);
sb.append("%");
if (ChatMessageCell.this.lastPoll != null && ChatMessageCell.this.lastPoll.quiz && (pollButton.chosen || pollButton.correct)) {
sb.append(", ");
if (pollButton.correct) {
i4 = org.telegram.messenger.R.string.AccDescrQuizCorrectAnswer;
str2 = "AccDescrQuizCorrectAnswer";
} else {
i4 = org.telegram.messenger.R.string.AccDescrQuizIncorrectAnswer;
str2 = "AccDescrQuizIncorrectAnswer";
}
sb.append(LocaleController.getString(str2, i4));
}
} else {
obtain2.setClassName("android.widget.Button");
}
obtain2.setText(sb);
obtain2.setEnabled(true);
obtain2.addAction(16);
int i19 = pollButton.y + ChatMessageCell.this.namesOffset;
int dp = ChatMessageCell.this.backgroundWidth - AndroidUtilities.dp(76.0f);
Rect rect5 = this.rect;
int i20 = pollButton.x;
rect5.set(i20, i19, dp + i20, pollButton.height + i19);
obtain2.setBoundsInParent(this.rect);
if (ChatMessageCell.this.accessibilityVirtualViewBounds.get(i) == null) {
ChatMessageCell.this.accessibilityVirtualViewBounds.put(i, new Rect(this.rect));
}
z3 = true;
this.rect.offset(iArr[0], iArr[1]);
obtain2.setBoundsInScreen(this.rect);
obtain2.setClickable(true);
} else if (i == 495) {
obtain2.setClassName("android.widget.Button");
obtain2.setEnabled(true);
obtain2.setText(LocaleController.getString("AccDescrQuizExplanation", org.telegram.messenger.R.string.AccDescrQuizExplanation));
obtain2.addAction(16);
this.rect.set(ChatMessageCell.this.pollHintX - AndroidUtilities.dp(8.0f), ChatMessageCell.this.pollHintY - AndroidUtilities.dp(8.0f), ChatMessageCell.this.pollHintX + AndroidUtilities.dp(32.0f), ChatMessageCell.this.pollHintY + AndroidUtilities.dp(32.0f));
obtain2.setBoundsInParent(this.rect);
if (ChatMessageCell.this.accessibilityVirtualViewBounds.get(i) == null || !((Rect) ChatMessageCell.this.accessibilityVirtualViewBounds.get(i)).equals(this.rect)) {
ChatMessageCell.this.accessibilityVirtualViewBounds.put(i, new Rect(this.rect));
}
z3 = true;
this.rect.offset(iArr[0], iArr[1]);
obtain2.setBoundsInScreen(this.rect);
obtain2.setClickable(true);
} else if (i == 499) {
obtain2.setClassName("android.widget.Button");
obtain2.setEnabled(true);
if (ChatMessageCell.this.instantViewLayout != null) {
obtain2.setText(ChatMessageCell.this.instantViewLayout.getText());
}
obtain2.addAction(16);
ChatMessageCell.this.instantButtonRect.round(this.rect);
obtain2.setBoundsInParent(this.rect);
if (ChatMessageCell.this.accessibilityVirtualViewBounds.get(i) == null || !((Rect) ChatMessageCell.this.accessibilityVirtualViewBounds.get(i)).equals(this.rect)) {
ChatMessageCell.this.accessibilityVirtualViewBounds.put(i, new Rect(this.rect));
}
z3 = true;
this.rect.offset(iArr[0], iArr[1]);
obtain2.setBoundsInScreen(this.rect);
obtain2.setClickable(true);
} else if (i != 492) {
if (i == 491) {
i2 = 491;
} else {
if (i != 490 && i != 489) {
if (i == 498) {
obtain2.setClassName("android.widget.ImageButton");
obtain2.setEnabled(true);
ChatMessageCell chatMessageCell11 = ChatMessageCell.this;
if (chatMessageCell11.isOpenChatByShare(chatMessageCell11.currentMessageObject)) {
obtain2.setContentDescription(LocaleController.getString("AccDescrOpenChat", org.telegram.messenger.R.string.AccDescrOpenChat));
} else {
obtain2.setContentDescription(LocaleController.getString("ShareFile", org.telegram.messenger.R.string.ShareFile));
}
obtain2.addAction(16);
this.rect.set((int) ChatMessageCell.this.sideStartX, (int) ChatMessageCell.this.sideStartY, ((int) ChatMessageCell.this.sideStartX) + AndroidUtilities.dp(40.0f), ((int) ChatMessageCell.this.sideStartY) + AndroidUtilities.dp(32.0f));
obtain2.setBoundsInParent(this.rect);
if (ChatMessageCell.this.accessibilityVirtualViewBounds.get(i) == null || !((Rect) ChatMessageCell.this.accessibilityVirtualViewBounds.get(i)).equals(this.rect)) {
ChatMessageCell.this.accessibilityVirtualViewBounds.put(i, new Rect(this.rect));
}
z2 = true;
this.rect.offset(iArr[0], iArr[1]);
obtain2.setBoundsInScreen(this.rect);
obtain2.setClickable(true);
} else {
z2 = true;
if (i == 497) {
obtain2.setEnabled(true);
StringBuilder sb2 = new StringBuilder();
sb2.append(LocaleController.getString("Reply", org.telegram.messenger.R.string.Reply));
sb2.append(", ");
StaticLayout staticLayout = ChatMessageCell.this.replyNameLayout;
if (staticLayout != null) {
sb2.append(staticLayout.getText());
sb2.append(", ");
}
StaticLayout staticLayout2 = ChatMessageCell.this.replyTextLayout;
if (staticLayout2 != null) {
sb2.append(staticLayout2.getText());
}
obtain2.setContentDescription(sb2.toString());
obtain2.addAction(16);
Rect rect6 = this.rect;
ChatMessageCell chatMessageCell12 = ChatMessageCell.this;
int i21 = chatMessageCell12.replyStartX;
int i22 = chatMessageCell12.replyStartY;
int max = Math.max(chatMessageCell12.replyNameWidth, ChatMessageCell.this.replyTextWidth) + i21;
ChatMessageCell chatMessageCell13 = ChatMessageCell.this;
rect6.set(i21, i22, max, chatMessageCell13.replyStartY + ((int) chatMessageCell13.replyHeight));
obtain2.setBoundsInParent(this.rect);
if (ChatMessageCell.this.accessibilityVirtualViewBounds.get(i) == null || !((Rect) ChatMessageCell.this.accessibilityVirtualViewBounds.get(i)).equals(this.rect)) {
ChatMessageCell.this.accessibilityVirtualViewBounds.put(i, new Rect(this.rect));
}
z2 = true;
this.rect.offset(iArr[0], iArr[1]);
obtain2.setBoundsInScreen(this.rect);
obtain2.setClickable(true);
} else if (i == 494) {
obtain2.setEnabled(true);
StringBuilder sb3 = new StringBuilder();
if (ChatMessageCell.this.forwardedNameLayout[0] != null && ChatMessageCell.this.forwardedNameLayout[1] != null) {
int i23 = 0;
while (i23 < 2) {
sb3.append(ChatMessageCell.this.forwardedNameLayout[i23].getText());
sb3.append(i23 == 0 ? " " : "\n");
i23++;
}
}
obtain2.setContentDescription(sb3.toString());
obtain2.addAction(16);
int min = (int) Math.min(ChatMessageCell.this.forwardNameX - ChatMessageCell.this.forwardNameOffsetX[0], ChatMessageCell.this.forwardNameX - ChatMessageCell.this.forwardNameOffsetX[1]);
this.rect.set(min, ChatMessageCell.this.forwardNameY, ChatMessageCell.this.forwardedNameWidth + min, ChatMessageCell.this.forwardNameY + ChatMessageCell.this.forwardHeight);
obtain2.setBoundsInParent(this.rect);
if (ChatMessageCell.this.accessibilityVirtualViewBounds.get(i) == null || !((Rect) ChatMessageCell.this.accessibilityVirtualViewBounds.get(i)).equals(this.rect)) {
ChatMessageCell.this.accessibilityVirtualViewBounds.put(i, new Rect(this.rect));
}
z2 = true;
this.rect.offset(iArr[0], iArr[1]);
obtain2.setBoundsInScreen(this.rect);
obtain2.setClickable(true);
} else if (i == 496) {
obtain2.setClassName("android.widget.Button");
obtain2.setEnabled(true);
int repliesCount = ChatMessageCell.this.getRepliesCount();
if (ChatMessageCell.this.currentMessageObject != null && !ChatMessageCell.this.currentMessageObject.shouldDrawWithoutBackground() && !ChatMessageCell.this.currentMessageObject.isAnimatedEmoji()) {
if (ChatMessageCell.this.isRepliesChat) {
formatShortNumber = LocaleController.getString("ViewInChat", org.telegram.messenger.R.string.ViewInChat);
} else {
formatShortNumber = repliesCount == 0 ? LocaleController.getString("LeaveAComment", org.telegram.messenger.R.string.LeaveAComment) : LocaleController.formatPluralString("CommentsCount", repliesCount, new Object[0]);
}
} else {
formatShortNumber = (ChatMessageCell.this.isRepliesChat || repliesCount <= 0) ? null : LocaleController.formatShortNumber(repliesCount, null);
}
if (formatShortNumber != null) {
obtain2.setText(formatShortNumber);
}
obtain2.addAction(16);
this.rect.set(ChatMessageCell.this.commentButtonRect);
obtain2.setBoundsInParent(this.rect);
if (ChatMessageCell.this.accessibilityVirtualViewBounds.get(i) == null || !((Rect) ChatMessageCell.this.accessibilityVirtualViewBounds.get(i)).equals(this.rect)) {
ChatMessageCell.this.accessibilityVirtualViewBounds.put(i, new Rect(this.rect));
}
z2 = true;
this.rect.offset(iArr[0], iArr[1]);
obtain2.setBoundsInScreen(this.rect);
obtain2.setClickable(true);
} else if (i == 493) {
obtain2.setClassName("android.widget.Button");
obtain2.setEnabled(true);
if (ChatMessageCell.this.currentMessageObject.isVoiceTranscriptionOpen()) {
i3 = org.telegram.messenger.R.string.AccActionCloseTranscription;
str = "AccActionCloseTranscription";
} else {
i3 = org.telegram.messenger.R.string.AccActionOpenTranscription;
str = "AccActionOpenTranscription";
}
obtain2.setText(LocaleController.getString(str, i3));
obtain2.addAction(16);
ChatMessageCell chatMessageCell14 = ChatMessageCell.this;
if (chatMessageCell14.transcribeButton != null) {
this.rect.set((int) chatMessageCell14.transcribeX, (int) ChatMessageCell.this.transcribeY, (int) (ChatMessageCell.this.transcribeX + ChatMessageCell.this.transcribeButton.width()), (int) (ChatMessageCell.this.transcribeY + ChatMessageCell.this.transcribeButton.height()));
}
obtain2.setBoundsInParent(this.rect);
z2 = true;
this.rect.offset(iArr[0], iArr[1]);
obtain2.setBoundsInScreen(this.rect);
obtain2.setClickable(true);
}
}
z = z2;
obtain2.setFocusable(z);
obtain2.setVisibleToUser(z);
return obtain2;
}
i2 = 491;
}
int i24 = i != i2 ? i == 490 ? 31 : 30 : 5;
for (int i25 = 0; i25 < ChatMessageCell.this.contactButtons.size(); i25++) {
InstantViewButton instantViewButton2 = (InstantViewButton) ChatMessageCell.this.contactButtons.get(i25);
if (instantViewButton2.type == i24) {
obtain2.setClassName("android.widget.Button");
obtain2.setEnabled(true);
if (instantViewButton2.layout != null) {
obtain2.setText(instantViewButton2.layout.getText());
}
obtain2.addAction(16);
instantViewButton2.rect.round(this.rect);
obtain2.setBoundsInParent(this.rect);
if (ChatMessageCell.this.accessibilityVirtualViewBounds.get(i) == null || !((Rect) ChatMessageCell.this.accessibilityVirtualViewBounds.get(i)).equals(this.rect)) {
ChatMessageCell.this.accessibilityVirtualViewBounds.put(i, new Rect(this.rect));
}
z = true;
this.rect.offset(iArr[0], iArr[1]);
obtain2.setBoundsInScreen(this.rect);
obtain2.setClickable(true);
obtain2.setFocusable(z);
obtain2.setVisibleToUser(z);
return obtain2;
}
}
} else {
obtain2.setClassName("android.widget.Button");
obtain2.setEnabled(true);
if (ChatMessageCell.this.titleLayout != null) {
obtain2.setText(ChatMessageCell.this.titleLayout.getText());
}
obtain2.addAction(16);
ChatMessageCell.this.contactRect.round(this.rect);
if (ChatMessageCell.this.contactButtons != null && ChatMessageCell.this.contactButtons.size() > 1) {
InstantViewButton instantViewButton3 = (InstantViewButton) ChatMessageCell.this.contactButtons.get(0);
if (!instantViewButton3.rect.isEmpty()) {
Rect rect7 = this.rect;
rect7.set(rect7.left, rect7.top, rect7.right, (int) (rect7.bottom - instantViewButton3.rect.height()));
}
}
obtain2.setBoundsInParent(this.rect);
if (ChatMessageCell.this.accessibilityVirtualViewBounds.get(i) == null || !((Rect) ChatMessageCell.this.accessibilityVirtualViewBounds.get(i)).equals(this.rect)) {
ChatMessageCell.this.accessibilityVirtualViewBounds.put(i, new Rect(this.rect));
}
z3 = true;
this.rect.offset(iArr[0], iArr[1]);
obtain2.setBoundsInScreen(this.rect);
obtain2.setClickable(true);
}
z = z3;
obtain2.setFocusable(z);
obtain2.setVisibleToUser(z);
return obtain2;
}
z = true;
obtain2.setFocusable(z);
obtain2.setVisibleToUser(z);
return obtain2;
}
@Override
public boolean performAction(int i, int i2, Bundle bundle) {
TranscribeButton transcribeButton;
if (i == -1) {
ChatMessageCell.this.performAccessibilityAction(i2, bundle);
} else if (i2 == 64) {
ChatMessageCell.this.sendAccessibilityEventForVirtualView(i, LiteMode.FLAG_CHAT_SCALE);
} else {
if (i2 == 16) {
if (i == 5000) {
if (ChatMessageCell.this.delegate != null) {
ChatMessageCellDelegate chatMessageCellDelegate = ChatMessageCell.this.delegate;
ChatMessageCell chatMessageCell = ChatMessageCell.this;
chatMessageCellDelegate.didPressUserAvatar(chatMessageCell, chatMessageCell.currentUser, 0.0f, 0.0f);
}
} else if (i >= 3000) {
ClickableSpan linkById = getLinkById(i, true);
if (linkById != null) {
ChatMessageCell.this.delegate.didPressUrl(ChatMessageCell.this, linkById, false);
ChatMessageCell.this.sendAccessibilityEventForVirtualView(i, 1);
}
} else if (i >= 2000) {
ClickableSpan linkById2 = getLinkById(i, false);
if (linkById2 != null) {
ChatMessageCell.this.delegate.didPressUrl(ChatMessageCell.this, linkById2, false);
ChatMessageCell.this.sendAccessibilityEventForVirtualView(i, 1);
}
} else if (i >= 1000) {
int i3 = i - 1000;
if (i3 >= ChatMessageCell.this.botButtons.size()) {
return false;
}
BotButton botButton = (BotButton) ChatMessageCell.this.botButtons.get(i3);
if (ChatMessageCell.this.delegate != null && botButton.button != null) {
ChatMessageCell.this.delegate.didPressBotButton(ChatMessageCell.this, botButton.button);
}
ChatMessageCell.this.sendAccessibilityEventForVirtualView(i, 1);
} else if (i >= 500) {
int i4 = i - 500;
if (i4 >= ChatMessageCell.this.pollButtons.size()) {
return false;
}
PollButton pollButton = (PollButton) ChatMessageCell.this.pollButtons.get(i4);
if (ChatMessageCell.this.delegate != null) {
ArrayList<TLRPC$TL_pollAnswer> arrayList = new ArrayList<>();
arrayList.add(pollButton.answer);
ChatMessageCell.this.delegate.didPressVoteButtons(ChatMessageCell.this, arrayList, -1, 0, 0);
}
ChatMessageCell.this.sendAccessibilityEventForVirtualView(i, 1);
} else if (i == 495) {
if (ChatMessageCell.this.delegate != null) {
ChatMessageCell.this.delegate.didPressHint(ChatMessageCell.this, 0);
}
} else if (i == 499) {
if (ChatMessageCell.this.delegate != null) {
ChatMessageCellDelegate chatMessageCellDelegate2 = ChatMessageCell.this.delegate;
ChatMessageCell chatMessageCell2 = ChatMessageCell.this;
chatMessageCellDelegate2.didPressInstantButton(chatMessageCell2, chatMessageCell2.drawInstantViewType);
}
} else if (i == 492) {
if (ChatMessageCell.this.delegate != null) {
ChatMessageCell.this.delegate.didPressInstantButton(ChatMessageCell.this, 5);
}
} else if (i == 491) {
if (ChatMessageCell.this.delegate != null) {
ChatMessageCell.this.delegate.didPressInstantButton(ChatMessageCell.this, 5);
}
} else if (i == 490) {
if (ChatMessageCell.this.delegate != null) {
ChatMessageCell.this.delegate.didPressInstantButton(ChatMessageCell.this, 31);
}
} else if (i == 489) {
if (ChatMessageCell.this.delegate != null) {
ChatMessageCell.this.delegate.didPressInstantButton(ChatMessageCell.this, 30);
}
} else if (i == 498) {
if (ChatMessageCell.this.delegate != null) {
ChatMessageCell.this.delegate.didPressSideButton(ChatMessageCell.this);
}
} else if (i == 497) {
if (ChatMessageCell.this.delegate != null) {
ChatMessageCell chatMessageCell3 = ChatMessageCell.this;
if (!chatMessageCell3.isThreadChat || chatMessageCell3.currentMessageObject.getReplyTopMsgId() != 0) {
if (!ChatMessageCell.this.currentMessageObject.hasValidReplyMessageObject()) {
ChatMessageCell chatMessageCell4 = ChatMessageCell.this;
if (!chatMessageCell4.hasReplyQuote) {
if (chatMessageCell4.currentMessageObject.messageOwner != null) {
if (ChatMessageCell.this.currentMessageObject.messageOwner.reply_to != null) {
}
}
}
}
ChatMessageCellDelegate chatMessageCellDelegate3 = ChatMessageCell.this.delegate;
ChatMessageCell chatMessageCell5 = ChatMessageCell.this;
chatMessageCellDelegate3.didPressReplyMessage(chatMessageCell5, chatMessageCell5.currentMessageObject.getReplyMsgId());
}
}
} else if (i == 494) {
if (ChatMessageCell.this.delegate != null) {
if (ChatMessageCell.this.currentForwardChannel != null) {
ChatMessageCellDelegate chatMessageCellDelegate4 = ChatMessageCell.this.delegate;
ChatMessageCell chatMessageCell6 = ChatMessageCell.this;
chatMessageCellDelegate4.didPressChannelAvatar(chatMessageCell6, chatMessageCell6.currentForwardChannel, ChatMessageCell.this.currentMessageObject.messageOwner.fwd_from.channel_post, ChatMessageCell.this.lastTouchX, ChatMessageCell.this.lastTouchY);
} else if (ChatMessageCell.this.currentForwardUser != null) {
ChatMessageCellDelegate chatMessageCellDelegate5 = ChatMessageCell.this.delegate;
ChatMessageCell chatMessageCell7 = ChatMessageCell.this;
chatMessageCellDelegate5.didPressUserAvatar(chatMessageCell7, chatMessageCell7.currentForwardUser, ChatMessageCell.this.lastTouchX, ChatMessageCell.this.lastTouchY);
} else if (ChatMessageCell.this.currentForwardName != null) {
ChatMessageCell.this.delegate.didPressHiddenForward(ChatMessageCell.this);
}
}
} else if (i == 496) {
if (ChatMessageCell.this.delegate != null) {
ChatMessageCell chatMessageCell8 = ChatMessageCell.this;
if (chatMessageCell8.isRepliesChat) {
chatMessageCell8.delegate.didPressSideButton(ChatMessageCell.this);
} else {
chatMessageCell8.delegate.didPressCommentButton(ChatMessageCell.this);
}
}
} else if (i == 493 && (transcribeButton = ChatMessageCell.this.transcribeButton) != null) {
transcribeButton.onTap();
}
} else if (i2 == 32) {
ClickableSpan linkById3 = getLinkById(i, i >= 3000);
if (linkById3 != null && ChatMessageCell.this.delegate != null) {
ChatMessageCell.this.delegate.didPressUrl(ChatMessageCell.this, linkById3, true);
ChatMessageCell.this.sendAccessibilityEventForVirtualView(i, 2);
}
}
}
return true;
}
private ClickableSpan getLinkById(int i, boolean z) {
if (i == 5000) {
return null;
}
if (z) {
int i2 = i - 3000;
if (!(ChatMessageCell.this.currentMessageObject.caption instanceof Spannable) || i2 < 0) {
return null;
}
Spannable spannable = (Spannable) ChatMessageCell.this.currentMessageObject.caption;
ClickableSpan[] clickableSpanArr = (ClickableSpan[]) spannable.getSpans(0, spannable.length(), ClickableSpan.class);
if (clickableSpanArr.length <= i2) {
return null;
}
return clickableSpanArr[i2];
}
int i3 = i - 2000;
if (!(ChatMessageCell.this.currentMessageObject.messageText instanceof Spannable) || i3 < 0) {
return null;
}
Spannable spannable2 = (Spannable) ChatMessageCell.this.currentMessageObject.messageText;
ClickableSpan[] clickableSpanArr2 = (ClickableSpan[]) spannable2.getSpans(0, spannable2.length(), ClickableSpan.class);
if (clickableSpanArr2.length <= i3) {
return null;
}
return clickableSpanArr2[i3];
}
}
public void setImageCoords(RectF rectF) {
setImageCoords(rectF.left, rectF.top, rectF.width(), rectF.height());
}
public void setImageCoords(float f, float f2, float f3, float f4) {
this.photoImage.setImageCoords(f, f2, f3, f4);
int i = this.documentAttachType;
if (i == 4 || i == 2) {
this.videoButtonX = (int) (this.photoImage.getImageX() + AndroidUtilities.dp(8.0f));
int imageY = (int) (this.photoImage.getImageY() + AndroidUtilities.dp(8.0f));
this.videoButtonY = imageY;
RadialProgress2 radialProgress2 = this.videoRadialProgress;
int i2 = this.videoButtonX;
radialProgress2.setProgressRect(i2, imageY, AndroidUtilities.dp(24.0f) + i2, this.videoButtonY + AndroidUtilities.dp(24.0f));
this.buttonX = (int) (f + ((this.photoImage.getImageWidth() - AndroidUtilities.dp(48.0f)) / 2.0f));
int imageY2 = (int) (this.photoImage.getImageY() + ((this.photoImage.getImageHeight() - AndroidUtilities.dp(48.0f)) / 2.0f));
this.buttonY = imageY2;
RadialProgress2 radialProgress22 = this.radialProgress;
int i3 = this.buttonX;
radialProgress22.setProgressRect(i3, imageY2, AndroidUtilities.dp(48.0f) + i3, this.buttonY + AndroidUtilities.dp(48.0f));
}
}
@Override
public float getAlpha() {
if (this.ALPHA_PROPERTY_WORKAROUND) {
return this.alphaInternal;
}
return super.getAlpha();
}
@Override
public void setAlpha(float f) {
if ((f == 1.0f) != (getAlpha() == 1.0f)) {
invalidate();
}
if (this.ALPHA_PROPERTY_WORKAROUND) {
this.alphaInternal = f;
invalidate();
} else {
super.setAlpha(f);
}
MessageObject.GroupedMessagePosition groupedMessagePosition = this.currentPosition;
if ((groupedMessagePosition != null && (groupedMessagePosition.minY != 0 || groupedMessagePosition.minX != 0)) || ((this.enterTransitionInProgress && !this.currentMessageObject.isVoice()) || this.replyNameLayout == null || this.replyTextLayout == null)) {
MessageObject.GroupedMessagePosition groupedMessagePosition2 = this.currentPosition;
if (groupedMessagePosition2 != null) {
int i = groupedMessagePosition2.flags;
if ((i & 8) == 0 || (i & 1) == 0) {
return;
}
}
if (this.reactionsLayoutInBubble.isSmall) {
return;
}
}
invalidate();
}
public int getCurrentBackgroundLeft() {
Theme.MessageDrawable messageDrawable = this.currentBackgroundDrawable;
if (messageDrawable == null) {
return 0;
}
int i = messageDrawable.getBounds().left;
if (this.currentMessageObject.isOutOwner() || this.transitionParams.changePinnedBottomProgress == 1.0f) {
return i;
}
boolean z = this.isRoundVideo;
if ((!z && this.mediaBackground) || this.drawPinnedBottom) {
return i;
}
if (z) {
return (int) (i - (AndroidUtilities.dp(6.0f) * getVideoTranscriptionProgress()));
}
return i - AndroidUtilities.dp(6.0f);
}
public int getCurrentBackgroundRight() {
Theme.MessageDrawable messageDrawable = this.currentBackgroundDrawable;
if (messageDrawable == null) {
return getWidth();
}
int i = messageDrawable.getBounds().right;
if (!this.currentMessageObject.isOutOwner() || this.transitionParams.changePinnedBottomProgress == 1.0f) {
return i;
}
boolean z = this.isRoundVideo;
if ((!z && this.mediaBackground) || this.drawPinnedBottom) {
return i;
}
if (z) {
return (int) (i + (AndroidUtilities.dp(6.0f) * getVideoTranscriptionProgress()));
}
return i + AndroidUtilities.dp(6.0f);
}
public TransitionParams getTransitionParams() {
return this.transitionParams;
}
public int getTopMediaOffset() {
MessageObject messageObject = this.currentMessageObject;
if (messageObject == null || messageObject.type != 14) {
return 0;
}
return this.mediaOffsetY + this.namesOffset;
}
public int getMediaOffsetY() {
if (!this.transitionParams.animateMediaOffsetY) {
return this.mediaOffsetY;
}
return AndroidUtilities.lerp(this.transitionParams.animateFromMediaOffsetY, this.mediaOffsetY, this.transitionParams.animateChangeProgress);
}
public int getTextX() {
return this.textX;
}
public int getTextY() {
return this.textY;
}
public boolean isPlayingRound() {
return this.isRoundVideo && this.isPlayingRound;
}
public int getParentWidth() {
int i;
MessageObject messageObject = this.currentMessageObject;
if (messageObject == null) {
messageObject = this.messageObjectToSet;
}
return (messageObject == null || !messageObject.preview || (i = this.parentWidth) <= 0) ? AndroidUtilities.displaySize.x : i;
}
public class TransitionParams {
public boolean animateBackgroundBoundsInner;
boolean animateBotButtonsChanged;
private boolean animateButton;
public boolean animateChange;
private int animateCommentArrowX;
private boolean animateCommentDrawUnread;
private int animateCommentUnreadX;
private float animateCommentX;
private boolean animateComments;
private StaticLayout animateCommentsLayout;
public boolean animateDrawBackground;
private boolean animateDrawCommentNumber;
public boolean animateDrawingTimeAlpha;
private boolean animateEditedEnter;
private StaticLayout animateEditedLayout;
private int animateEditedWidthDiff;
int animateForwardNameWidth;
float animateForwardNameX;
public boolean animateForwardedLayout;
public int animateForwardedNamesOffset;
private float animateFromButtonX;
private float animateFromButtonY;
public int animateFromLinkPreviewHeight;
public int animateFromLinkPreviewY;
private int animateFromMediaOffsetY;
private float animateFromReplyTextHeight;
public float animateFromReplyY;
public float animateFromRoundVideoDotY;
public float animateFromTextY;
public int animateFromTimeX;
public float animateFromTimeXPinned;
private float animateFromTimeXReplies;
private float animateFromTimeXViews;
public boolean animateLinkAbove;
public boolean animateLinkPreviewHeight;
public boolean animateLinkPreviewY;
public boolean animateLocationIsExpired;
private boolean animateMediaOffsetY;
public boolean animateMessageText;
private float animateNameX;
private AnimatedEmojiSpan.EmojiGroupedSpans animateOutAnimateEmoji;
private AnimatedEmojiSpan.EmojiGroupedSpans animateOutAnimateEmojiReply;
private MessageObject.TextLayoutBlocks animateOutCaptionLayout;
private ArrayList<MessageObject.TextLayoutBlock> animateOutTextBlocks;
private float animateOutTextXOffset;
private boolean animatePinned;
public boolean animatePlayingRound;
public boolean animateRadius;
public boolean animateRecommendationsExpanded;
boolean animateReplaceCaptionLayout;
private boolean animateReplies;
private StaticLayout animateRepliesLayout;
private StaticLayout animateReplyTextLayout;
public float animateReplyTextOffset;
public boolean animateRoundVideoDotY;
private boolean animateShouldDrawMenuDrawable;
private boolean animateShouldDrawTimeOnMedia;
private boolean animateSign;
public boolean animateSmallImage;
public boolean animateText;
private StaticLayout animateTimeLayout;
private int animateTimeWidth;
public float animateToImageH;
public float animateToImageW;
public float animateToImageX;
public float animateToImageY;
public int[] animateToRadius;
private int animateTotalCommentWidth;
public boolean animateUseTranscribeButton;
private StaticLayout animateViewsLayout;
public float captionFromX;
public float captionFromY;
public float deltaBottom;
public float deltaLeft;
public float deltaRight;
public float deltaTop;
public boolean drawPinnedBottomBackground;
public boolean ignoreAlpha;
public boolean imageChangeBoundsTransition;
public int lastBackgroundLeft;
public int lastBackgroundRight;
private float lastButtonX;
private float lastButtonY;
private int lastCommentArrowX;
private boolean lastCommentDrawUnread;
private StaticLayout lastCommentLayout;
private int lastCommentUnreadX;
private float lastCommentX;
private int lastCommentsCount;
public boolean lastDrawBackground;
private boolean lastDrawCommentNumber;
public StaticLayout lastDrawDocTitleLayout;
public StaticLayout lastDrawInfoLayout;
public float lastDrawLocationExpireProgress;
public String lastDrawLocationExpireText;
public float lastDrawReplyY;
public float lastDrawRoundVideoDotY;
public boolean lastDrawTime;
private MessageObject.TextLayoutBlocks lastDrawingCaptionLayout;
public float lastDrawingCaptionX;
public float lastDrawingCaptionY;
private boolean lastDrawingEdited;
public float lastDrawingImageH;
public float lastDrawingImageW;
public float lastDrawingImageX;
public float lastDrawingImageY;
public boolean lastDrawingLinkAbove;
public int lastDrawingLinkPreviewHeight;
public int lastDrawingLinkPreviewY;
public boolean lastDrawingRecommendationsExpanded;
private float lastDrawingReplyTextHeight;
public boolean lastDrawingSmallImage;
private ArrayList<MessageObject.TextLayoutBlock> lastDrawingTextBlocks;
public float lastDrawingTextY;
public boolean lastDrawnForwardedName;
public StaticLayout lastDrawnReplyTextLayout;
int lastForwardNameWidth;
float lastForwardNameX;
public int lastForwardedNamesOffset;
private boolean lastIsPinned;
private boolean lastIsPlayingRound;
public boolean lastLocatinIsExpired;
private int lastMediaOffsetY;
private int lastRepliesCount;
private StaticLayout lastRepliesLayout;
public int lastReplyTextXOffset;
private boolean lastShouldDrawMenuDrawable;
private boolean lastShouldDrawTimeOnMedia;
private String lastSignMessage;
public float lastTextXOffset;
private StaticLayout lastTimeLayout;
private int lastTimeWidth;
public int lastTimeX;
public float lastTimeXPinned;
private float lastTimeXReplies;
private float lastTimeXViews;
public int lastTopOffset;
private int lastTotalCommentWidth;
public boolean lastUseTranscribeButton;
private int lastViewsCount;
private StaticLayout lastViewsLayout;
public boolean messageEntering;
private boolean moveCaption;
public float photoImageFromCenterX;
public float photoImageFromCenterY;
public float photoImageFromHeight;
public float photoImageFromWidth;
public boolean shouldAnimateTimeX;
public float toDeltaLeft;
public float toDeltaRight;
public boolean transformGroupToSingleMessage;
public boolean updatePhotoImageX;
public boolean wasDraw;
public int[] imageRoundRadius = new int[4];
public float captionEnterProgress = 1.0f;
public float changePinnedBottomProgress = 1.0f;
public Rect lastDrawingBackgroundRect = new Rect();
public float animateChangeProgress = 1.0f;
private ArrayList<BotButton> lastDrawBotButtons = new ArrayList<>();
private ArrayList<BotButton> transitionBotButtons = new ArrayList<>();
public int lastStatusDrawableParams = -1;
public StaticLayout[] lastDrawnForwardedNameLayout = new StaticLayout[2];
public StaticLayout[] animatingForwardedNameLayout = new StaticLayout[2];
public boolean supportChangeAnimation() {
return true;
}
public TransitionParams() {
}
public void recordDrawingState() {
ChannelRecommendationsCell channelRecommendationsCell;
this.wasDraw = true;
this.lastDrawingImageX = ChatMessageCell.this.photoImage.getImageX();
this.lastDrawingImageY = ChatMessageCell.this.photoImage.getImageY();
this.lastDrawingImageW = ChatMessageCell.this.photoImage.getImageWidth();
this.lastDrawingImageH = ChatMessageCell.this.photoImage.getImageHeight();
System.arraycopy(ChatMessageCell.this.photoImage.getRoundRadius(), 0, this.imageRoundRadius, 0, 4);
Theme.MessageDrawable messageDrawable = ChatMessageCell.this.currentBackgroundDrawable;
if (messageDrawable != null) {
this.lastDrawingBackgroundRect.set(messageDrawable.getBounds());
}
this.lastDrawingTextBlocks = ChatMessageCell.this.currentMessageObject != null ? ChatMessageCell.this.currentMessageObject.textLayoutBlocks : null;
this.lastDrawingEdited = ChatMessageCell.this.edited;
this.lastDrawingCaptionX = ChatMessageCell.this.captionX;
ChatMessageCell chatMessageCell = ChatMessageCell.this;
this.lastDrawingCaptionY = chatMessageCell.captionY;
this.lastDrawingCaptionLayout = chatMessageCell.captionLayout;
this.lastDrawBotButtons.clear();
if (!ChatMessageCell.this.botButtons.isEmpty()) {
this.lastDrawBotButtons.addAll(ChatMessageCell.this.botButtons);
}
this.lastDrawingSmallImage = ChatMessageCell.this.isSmallImage;
ChatMessageCell chatMessageCell2 = ChatMessageCell.this;
this.lastDrawingLinkPreviewHeight = chatMessageCell2.linkPreviewHeight;
this.lastDrawingLinkAbove = chatMessageCell2.linkPreviewAbove;
this.lastDrawingRecommendationsExpanded = chatMessageCell2.currentMessageObject != null && ChatMessageCell.this.currentMessageObject.type == 27 && (channelRecommendationsCell = ChatMessageCell.this.channelRecommendationsCell) != null && channelRecommendationsCell.isExpanded();
if (ChatMessageCell.this.commentLayout != null) {
this.lastCommentsCount = ChatMessageCell.this.getRepliesCount();
this.lastTotalCommentWidth = ChatMessageCell.this.totalCommentWidth;
this.lastCommentLayout = ChatMessageCell.this.commentLayout;
this.lastCommentArrowX = ChatMessageCell.this.commentArrowX;
this.lastCommentUnreadX = ChatMessageCell.this.commentUnreadX;
this.lastCommentDrawUnread = ChatMessageCell.this.commentDrawUnread;
this.lastCommentX = ChatMessageCell.this.commentX;
this.lastDrawCommentNumber = ChatMessageCell.this.drawCommentNumber;
}
this.lastRepliesCount = ChatMessageCell.this.getRepliesCount();
this.lastViewsCount = ChatMessageCell.this.getMessageObject().messageOwner.views;
this.lastRepliesLayout = ChatMessageCell.this.repliesLayout;
this.lastViewsLayout = ChatMessageCell.this.viewsLayout;
ChatMessageCell chatMessageCell3 = ChatMessageCell.this;
this.lastIsPinned = chatMessageCell3.isPinned;
this.lastSignMessage = chatMessageCell3.lastPostAuthor;
this.lastDrawBackground = ChatMessageCell.this.drawBackground;
this.lastUseTranscribeButton = ChatMessageCell.this.useTranscribeButton;
this.lastButtonX = ChatMessageCell.this.buttonX;
this.lastButtonY = ChatMessageCell.this.buttonY;
this.lastMediaOffsetY = ChatMessageCell.this.mediaOffsetY;
this.lastDrawTime = !ChatMessageCell.this.forceNotDrawTime;
ChatMessageCell chatMessageCell4 = ChatMessageCell.this;
this.lastTimeX = chatMessageCell4.timeX;
this.lastTimeLayout = chatMessageCell4.timeLayout;
ChatMessageCell chatMessageCell5 = ChatMessageCell.this;
this.lastTimeWidth = chatMessageCell5.timeWidth;
this.lastShouldDrawTimeOnMedia = chatMessageCell5.shouldDrawTimeOnMedia();
this.lastTopOffset = ChatMessageCell.this.getTopMediaOffset();
this.lastShouldDrawMenuDrawable = ChatMessageCell.this.shouldDrawMenuDrawable();
this.lastLocatinIsExpired = ChatMessageCell.this.locationExpired;
this.lastIsPlayingRound = ChatMessageCell.this.isPlayingRound;
ChatMessageCell chatMessageCell6 = ChatMessageCell.this;
this.lastDrawingTextY = chatMessageCell6.textY;
int i = chatMessageCell6.textX;
this.lastDrawingLinkPreviewY = chatMessageCell6.linkPreviewY;
this.lastDrawnForwardedNameLayout[0] = ChatMessageCell.this.forwardedNameLayout[0];
this.lastDrawnForwardedNameLayout[1] = ChatMessageCell.this.forwardedNameLayout[1];
this.lastDrawnForwardedName = ChatMessageCell.this.currentMessageObject != null && ChatMessageCell.this.currentMessageObject.needDrawForwarded();
this.lastForwardNameX = ChatMessageCell.this.forwardNameX;
this.lastForwardedNamesOffset = ChatMessageCell.this.namesOffset;
this.lastForwardNameWidth = ChatMessageCell.this.forwardedNameWidth;
this.lastBackgroundLeft = ChatMessageCell.this.getCurrentBackgroundLeft();
Theme.MessageDrawable messageDrawable2 = ChatMessageCell.this.currentBackgroundDrawable;
if (messageDrawable2 != null) {
this.lastBackgroundRight = messageDrawable2.getBounds().right;
}
this.lastTextXOffset = ChatMessageCell.this.currentMessageObject != null ? ChatMessageCell.this.currentMessageObject.textXOffset : 0.0f;
this.lastDrawingReplyTextHeight = ChatMessageCell.this.replyTextHeight;
ChatMessageCell chatMessageCell7 = ChatMessageCell.this;
this.lastDrawnReplyTextLayout = chatMessageCell7.replyTextLayout;
this.lastReplyTextXOffset = chatMessageCell7.replyTextOffset;
chatMessageCell7.reactionsLayoutInBubble.recordDrawingState();
if (ChatMessageCell.this.replyNameLayout != null) {
this.lastDrawReplyY = r0.replyStartY;
} else {
this.lastDrawReplyY = 0.0f;
}
}
public void recordDrawingStatePreview() {
this.lastDrawnForwardedNameLayout[0] = ChatMessageCell.this.forwardedNameLayout[0];
this.lastDrawnForwardedNameLayout[1] = ChatMessageCell.this.forwardedNameLayout[1];
this.lastDrawnForwardedName = ChatMessageCell.this.currentMessageObject.needDrawForwarded();
this.lastForwardNameX = ChatMessageCell.this.forwardNameX;
this.lastForwardedNamesOffset = ChatMessageCell.this.namesOffset;
this.lastForwardNameWidth = ChatMessageCell.this.forwardedNameWidth;
}
public boolean animateChange() {
boolean z;
StaticLayout staticLayout;
ChatMessageCell chatMessageCell;
MessageObject.TextLayoutBlocks textLayoutBlocks;
MessageObject.TextLayoutBlocks textLayoutBlocks2;
int i;
int i2;
boolean z2;
ChatMessageCell chatMessageCell2;
boolean z3;
float f;
ChatMessageCell chatMessageCell3;
ChatMessageCell chatMessageCell4;
StaticLayout staticLayout2;
ChannelRecommendationsCell channelRecommendationsCell;
boolean z4;
if (!this.wasDraw) {
return false;
}
this.animateMessageText = false;
if (ChatMessageCell.this.currentMessageObject.textLayoutBlocks != this.lastDrawingTextBlocks) {
if (ChatMessageCell.this.currentMessageObject.textLayoutBlocks != null && this.lastDrawingTextBlocks != null && ChatMessageCell.this.currentMessageObject.textLayoutBlocks.size() == this.lastDrawingTextBlocks.size()) {
for (int i3 = 0; i3 < this.lastDrawingTextBlocks.size(); i3++) {
String charSequence = ChatMessageCell.this.currentMessageObject.textLayoutBlocks.get(i3).textLayout == null ? null : ChatMessageCell.this.currentMessageObject.textLayoutBlocks.get(i3).textLayout.getText().toString();
String charSequence2 = this.lastDrawingTextBlocks.get(i3).textLayout == null ? null : this.lastDrawingTextBlocks.get(i3).textLayout.getText().toString();
if ((charSequence != null || charSequence2 == null) && ((charSequence == null || charSequence2 != null) && charSequence.equals(charSequence2))) {
ChatMessageCell chatMessageCell5 = ChatMessageCell.this;
AnimatedEmojiSpan.EmojiGroupedSpans emojiGroupedSpans = chatMessageCell5.animatedEmojiStack;
if (emojiGroupedSpans != null) {
emojiGroupedSpans.replaceLayout(chatMessageCell5.currentMessageObject.textLayoutBlocks.get(i3).textLayout, this.lastDrawingTextBlocks.get(i3).textLayout);
}
}
}
z4 = true;
if (z4) {
this.animateMessageText = true;
ArrayList<MessageObject.TextLayoutBlock> arrayList = this.lastDrawingTextBlocks;
this.animateOutTextBlocks = arrayList;
this.animateOutTextXOffset = this.lastTextXOffset;
this.animateOutAnimateEmoji = AnimatedEmojiSpan.update(0, (View) ChatMessageCell.this, this.animateOutAnimateEmoji, arrayList, true);
ChatMessageCell chatMessageCell6 = ChatMessageCell.this;
chatMessageCell6.animatedEmojiStack = AnimatedEmojiSpan.update(0, chatMessageCell6, chatMessageCell6.animatedEmojiStack, chatMessageCell6.currentMessageObject.textLayoutBlocks);
z = true;
staticLayout = ChatMessageCell.this.replyTextLayout;
if (staticLayout != this.lastDrawnReplyTextLayout) {
CharSequence text = staticLayout != null ? staticLayout.getText() : null;
StaticLayout staticLayout3 = this.lastDrawnReplyTextLayout;
if (!TextUtils.equals(text, staticLayout3 != null ? staticLayout3.getText() : null)) {
this.animateFromReplyTextHeight = this.lastDrawingReplyTextHeight;
StaticLayout staticLayout4 = this.lastDrawnReplyTextLayout;
this.animateReplyTextLayout = staticLayout4;
this.animateReplyTextOffset = this.lastReplyTextXOffset;
this.animateOutAnimateEmojiReply = AnimatedEmojiSpan.update(0, (View) ChatMessageCell.this, false, this.animateOutAnimateEmojiReply, true, staticLayout4);
z = true;
}
}
if (ChatMessageCell.this.edited || this.lastDrawingEdited || ChatMessageCell.this.timeLayout == null) {
if (!ChatMessageCell.this.edited && this.lastDrawingEdited && ChatMessageCell.this.timeLayout != null) {
this.animateTimeLayout = this.lastTimeLayout;
int i4 = ChatMessageCell.this.timeWidth;
int i5 = this.lastTimeWidth;
this.animateEditedWidthDiff = i4 - i5;
this.animateEditedEnter = true;
this.animateTimeWidth = i5;
this.animateFromTimeX = this.lastTimeX;
this.shouldAnimateTimeX = true;
z = true;
}
} else {
String string = LocaleController.getString("EditedMessage", org.telegram.messenger.R.string.EditedMessage);
CharSequence text2 = ChatMessageCell.this.timeLayout.getText();
int indexOf = text2.toString().indexOf(string);
if (indexOf >= 0) {
if (indexOf == 0) {
this.animateEditedLayout = new StaticLayout(string, Theme.chat_timePaint, ChatMessageCell.this.timeTextWidth + AndroidUtilities.dp(100.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
spannableStringBuilder.append((CharSequence) string);
spannableStringBuilder.append(text2.subSequence(string.length(), text2.length()));
spannableStringBuilder.setSpan(new EmptyStubSpan(), 0, string.length(), 0);
this.animateTimeLayout = new StaticLayout(spannableStringBuilder, Theme.chat_timePaint, ChatMessageCell.this.timeTextWidth + AndroidUtilities.dp(100.0f), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
this.animateEditedWidthDiff = ChatMessageCell.this.timeWidth - this.lastTimeWidth;
} else {
this.animateEditedWidthDiff = 0;
this.animateEditedLayout = null;
this.animateTimeLayout = this.lastTimeLayout;
}
this.animateEditedEnter = true;
this.animateTimeWidth = this.lastTimeWidth;
this.animateFromTimeX = this.lastTimeX;
this.shouldAnimateTimeX = true;
z = true;
}
ChatMessageCell.this.accessibilityText = null;
}
this.animateDrawBackground = false;
if (ChatMessageCell.this.drawBackground != this.lastDrawBackground) {
this.animateDrawBackground = true;
z = true;
}
this.animateSmallImage = false;
if (ChatMessageCell.this.isSmallImage != this.lastDrawingSmallImage) {
this.animateSmallImage = true;
float f2 = this.lastDrawingImageW;
this.photoImageFromWidth = f2;
float f3 = this.lastDrawingImageH;
this.photoImageFromHeight = f3;
this.photoImageFromCenterX = this.lastDrawingImageX + (f2 / 2.0f);
this.photoImageFromCenterY = this.lastDrawingImageY + (f3 / 2.0f);
z = true;
}
this.animateRecommendationsExpanded = false;
if (((ChatMessageCell.this.currentMessageObject.type == 27 || (channelRecommendationsCell = ChatMessageCell.this.channelRecommendationsCell) == null || !channelRecommendationsCell.isExpanded()) ? false : true) != this.lastDrawingRecommendationsExpanded) {
this.animateRecommendationsExpanded = true;
z = true;
}
this.animateLinkAbove = false;
chatMessageCell = ChatMessageCell.this;
if (chatMessageCell.linkPreviewAbove != this.lastDrawingLinkAbove) {
this.animateLinkAbove = true;
z = true;
}
this.animateLinkPreviewHeight = false;
if (chatMessageCell.hasLinkPreview) {
int i6 = ChatMessageCell.this.linkPreviewHeight;
int i7 = this.lastDrawingLinkPreviewHeight;
if (i6 != i7) {
this.animateLinkPreviewHeight = true;
this.animateFromLinkPreviewHeight = i7;
z = true;
}
}
this.animateUseTranscribeButton = false;
if (ChatMessageCell.this.useTranscribeButton != this.lastUseTranscribeButton) {
this.animateUseTranscribeButton = true;
z = true;
}
ChatMessageCell chatMessageCell7 = ChatMessageCell.this;
textLayoutBlocks = chatMessageCell7.captionLayout;
textLayoutBlocks2 = this.lastDrawingCaptionLayout;
if (textLayoutBlocks == textLayoutBlocks2) {
String charSequence3 = textLayoutBlocks2 == null ? null : textLayoutBlocks2.text.toString();
MessageObject.TextLayoutBlocks textLayoutBlocks3 = ChatMessageCell.this.captionLayout;
String charSequence4 = textLayoutBlocks3 == null ? null : textLayoutBlocks3.text.toString();
if ((charSequence4 == null) != (charSequence3 == null) || (charSequence3 != null && !charSequence3.equals(charSequence4))) {
this.animateReplaceCaptionLayout = true;
MessageObject.TextLayoutBlocks textLayoutBlocks4 = this.lastDrawingCaptionLayout;
this.animateOutCaptionLayout = textLayoutBlocks4;
this.animateOutAnimateEmoji = AnimatedEmojiSpan.update(0, ChatMessageCell.this, (AnimatedEmojiSpan.EmojiGroupedSpans) null, textLayoutBlocks4 == null ? null : textLayoutBlocks4.textLayoutBlocks);
ChatMessageCell chatMessageCell8 = ChatMessageCell.this;
AnimatedEmojiSpan.EmojiGroupedSpans emojiGroupedSpans2 = chatMessageCell8.animatedEmojiStack;
MessageObject.TextLayoutBlocks textLayoutBlocks5 = chatMessageCell8.captionLayout;
chatMessageCell8.animatedEmojiStack = AnimatedEmojiSpan.update(0, chatMessageCell8, emojiGroupedSpans2, textLayoutBlocks5 == null ? null : textLayoutBlocks5.textLayoutBlocks);
} else {
ChatMessageCell.this.updateCaptionLayout();
if (this.lastDrawingCaptionX != ChatMessageCell.this.captionX || this.lastDrawingCaptionY != ChatMessageCell.this.captionY) {
this.moveCaption = true;
this.captionFromX = this.lastDrawingCaptionX;
this.captionFromY = this.lastDrawingCaptionY;
}
}
z = true;
} else if (textLayoutBlocks != null && textLayoutBlocks2 != null) {
chatMessageCell7.updateCaptionLayout();
if (this.lastDrawingCaptionX != ChatMessageCell.this.captionX || this.lastDrawingCaptionY != ChatMessageCell.this.captionY) {
this.moveCaption = true;
this.captionFromX = this.lastDrawingCaptionX;
this.captionFromY = this.lastDrawingCaptionY;
z = true;
}
}
if (this.lastDrawBotButtons.isEmpty() || !ChatMessageCell.this.botButtons.isEmpty()) {
if (this.lastDrawBotButtons.size() != ChatMessageCell.this.botButtons.size()) {
this.animateBotButtonsChanged = true;
}
if (!this.animateBotButtonsChanged) {
for (int i8 = 0; i8 < ChatMessageCell.this.botButtons.size(); i8++) {
BotButton botButton = (BotButton) ChatMessageCell.this.botButtons.get(i8);
BotButton botButton2 = this.lastDrawBotButtons.get(i8);
if (botButton.x != botButton2.x || botButton.width != botButton2.width || botButton.title != botButton2.title) {
this.animateBotButtonsChanged = true;
break;
}
}
}
if (this.animateBotButtonsChanged) {
this.transitionBotButtons.addAll(this.lastDrawBotButtons);
}
}
if ((ChatMessageCell.this.documentAttachType != 5 || ChatMessageCell.this.documentAttachType == 3 || ChatMessageCell.this.documentAttachType == 1) && (ChatMessageCell.this.buttonX != this.lastButtonX || ChatMessageCell.this.buttonY != this.lastButtonY)) {
this.animateFromButtonX = this.lastButtonX;
this.animateFromButtonY = this.lastButtonY;
this.animateButton = true;
z = true;
}
i = ChatMessageCell.this.mediaOffsetY;
i2 = this.lastMediaOffsetY;
if (i != i2) {
this.animateFromMediaOffsetY = i2;
this.animateMediaOffsetY = true;
z = true;
}
z2 = this.lastIsPinned;
chatMessageCell2 = ChatMessageCell.this;
if (z2 == chatMessageCell2.isPinned) {
this.animatePinned = true;
chatMessageCell2.accessibilityText = null;
z = true;
z3 = true;
} else {
z3 = false;
}
if ((this.lastRepliesLayout == null || chatMessageCell2.repliesLayout != null) && this.lastRepliesCount != ChatMessageCell.this.getRepliesCount()) {
this.animateRepliesLayout = this.lastRepliesLayout;
this.animateReplies = true;
ChatMessageCell.this.accessibilityText = null;
z = true;
z3 = true;
}
if (this.lastViewsLayout != null && this.lastViewsCount != ChatMessageCell.this.getMessageObject().messageOwner.views) {
this.animateViewsLayout = this.lastViewsLayout;
ChatMessageCell.this.accessibilityText = null;
z = true;
z3 = true;
}
if (ChatMessageCell.this.commentLayout != null && this.lastCommentsCount != ChatMessageCell.this.getRepliesCount()) {
staticLayout2 = this.lastCommentLayout;
if (staticLayout2 == null && !TextUtils.equals(staticLayout2.getText(), ChatMessageCell.this.commentLayout.getText())) {
this.animateCommentsLayout = this.lastCommentLayout;
} else {
this.animateCommentsLayout = null;
}
this.animateTotalCommentWidth = this.lastTotalCommentWidth;
this.animateCommentX = this.lastCommentX;
this.animateCommentArrowX = this.lastCommentArrowX;
this.animateCommentUnreadX = this.lastCommentUnreadX;
this.animateCommentDrawUnread = this.lastCommentDrawUnread;
this.animateDrawCommentNumber = this.lastDrawCommentNumber;
this.animateComments = true;
z = true;
}
if (!TextUtils.equals(this.lastSignMessage, ChatMessageCell.this.lastPostAuthor)) {
this.animateSign = true;
this.animateNameX = ChatMessageCell.this.nameX;
z = true;
}
if (this.lastDrawTime != ChatMessageCell.this.forceNotDrawTime) {
this.animateDrawingTimeAlpha = true;
this.animateViewsLayout = null;
} else if (this.lastShouldDrawTimeOnMedia != ChatMessageCell.this.shouldDrawTimeOnMedia()) {
this.animateEditedEnter = false;
this.animateShouldDrawTimeOnMedia = true;
this.animateFromTimeX = this.lastTimeX;
this.animateTimeLayout = this.lastTimeLayout;
this.animateTimeWidth = this.lastTimeWidth;
} else {
if (z3 || Math.abs(ChatMessageCell.this.timeX - this.lastTimeX) > 1) {
this.shouldAnimateTimeX = true;
this.animateTimeWidth = this.lastTimeWidth;
this.animateFromTimeX = this.lastTimeX;
this.animateFromTimeXViews = this.lastTimeXViews;
this.animateFromTimeXReplies = this.lastTimeXReplies;
this.animateFromTimeXPinned = this.lastTimeXPinned;
}
if (this.lastShouldDrawMenuDrawable != ChatMessageCell.this.shouldDrawMenuDrawable()) {
this.animateShouldDrawMenuDrawable = true;
}
if (this.lastLocatinIsExpired != ChatMessageCell.this.locationExpired) {
this.animateLocationIsExpired = true;
}
if (this.lastIsPlayingRound != ChatMessageCell.this.isPlayingRound) {
this.animatePlayingRound = true;
z = true;
}
f = this.lastDrawingTextY;
chatMessageCell3 = ChatMessageCell.this;
if (f != chatMessageCell3.textY) {
this.animateText = true;
this.animateFromTextY = f;
z = true;
}
if (this.lastDrawingLinkPreviewY != chatMessageCell3.linkPreviewY) {
this.animateLinkPreviewY = true;
this.animateFromLinkPreviewY = this.lastDrawingLinkPreviewY;
z = true;
}
if (ChatMessageCell.this.currentMessageObject != null && this.lastDrawnForwardedName != ChatMessageCell.this.currentMessageObject.needDrawForwarded()) {
this.animateForwardedLayout = true;
StaticLayout[] staticLayoutArr = this.animatingForwardedNameLayout;
StaticLayout[] staticLayoutArr2 = this.lastDrawnForwardedNameLayout;
staticLayoutArr[0] = staticLayoutArr2[0];
staticLayoutArr[1] = staticLayoutArr2[1];
this.animateForwardNameX = this.lastForwardNameX;
this.animateForwardedNamesOffset = this.lastForwardedNamesOffset;
this.animateForwardNameWidth = this.lastForwardNameWidth;
z = true;
}
ChatMessageCell.this.updateReactionLayoutPosition();
if (ChatMessageCell.this.reactionsLayoutInBubble.animateChange()) {
z = true;
}
if (ChatMessageCell.this.currentMessageObject.isRoundVideo()) {
float dp = ChatMessageCell.this.layoutHeight - AndroidUtilities.dp(28 - (ChatMessageCell.this.drawPinnedBottom ? 2 : 0));
if (!ChatMessageCell.this.reactionsLayoutInBubble.isEmpty) {
dp -= r3.totalHeight;
}
float f4 = this.lastDrawRoundVideoDotY;
if (dp != f4) {
this.animateRoundVideoDotY = true;
this.animateFromRoundVideoDotY = f4;
z = true;
}
}
chatMessageCell4 = ChatMessageCell.this;
if (chatMessageCell4.replyNameLayout != null) {
float f5 = chatMessageCell4.replyStartX;
float f6 = this.lastDrawReplyY;
if (f5 != f6 && f6 != 0.0f) {
this.animateFromReplyY = f6;
return true;
}
}
return z;
}
z = true;
if (this.lastShouldDrawMenuDrawable != ChatMessageCell.this.shouldDrawMenuDrawable()) {
}
if (this.lastLocatinIsExpired != ChatMessageCell.this.locationExpired) {
}
if (this.lastIsPlayingRound != ChatMessageCell.this.isPlayingRound) {
}
f = this.lastDrawingTextY;
chatMessageCell3 = ChatMessageCell.this;
if (f != chatMessageCell3.textY) {
}
if (this.lastDrawingLinkPreviewY != chatMessageCell3.linkPreviewY) {
}
if (ChatMessageCell.this.currentMessageObject != null) {
this.animateForwardedLayout = true;
StaticLayout[] staticLayoutArr3 = this.animatingForwardedNameLayout;
StaticLayout[] staticLayoutArr22 = this.lastDrawnForwardedNameLayout;
staticLayoutArr3[0] = staticLayoutArr22[0];
staticLayoutArr3[1] = staticLayoutArr22[1];
this.animateForwardNameX = this.lastForwardNameX;
this.animateForwardedNamesOffset = this.lastForwardedNamesOffset;
this.animateForwardNameWidth = this.lastForwardNameWidth;
z = true;
}
ChatMessageCell.this.updateReactionLayoutPosition();
if (ChatMessageCell.this.reactionsLayoutInBubble.animateChange()) {
}
if (ChatMessageCell.this.currentMessageObject.isRoundVideo()) {
}
chatMessageCell4 = ChatMessageCell.this;
if (chatMessageCell4.replyNameLayout != null) {
}
return z;
}
ChatMessageCell chatMessageCell9 = ChatMessageCell.this;
chatMessageCell9.animatedEmojiStack = AnimatedEmojiSpan.update(0, chatMessageCell9, chatMessageCell9.animatedEmojiStack, chatMessageCell9.currentMessageObject.textLayoutBlocks);
}
z4 = false;
if (z4) {
}
}
z = false;
staticLayout = ChatMessageCell.this.replyTextLayout;
if (staticLayout != this.lastDrawnReplyTextLayout) {
}
if (ChatMessageCell.this.edited) {
}
if (!ChatMessageCell.this.edited) {
this.animateTimeLayout = this.lastTimeLayout;
int i42 = ChatMessageCell.this.timeWidth;
int i52 = this.lastTimeWidth;
this.animateEditedWidthDiff = i42 - i52;
this.animateEditedEnter = true;
this.animateTimeWidth = i52;
this.animateFromTimeX = this.lastTimeX;
this.shouldAnimateTimeX = true;
z = true;
}
this.animateDrawBackground = false;
if (ChatMessageCell.this.drawBackground != this.lastDrawBackground) {
}
this.animateSmallImage = false;
if (ChatMessageCell.this.isSmallImage != this.lastDrawingSmallImage) {
}
this.animateRecommendationsExpanded = false;
if (((ChatMessageCell.this.currentMessageObject.type == 27 || (channelRecommendationsCell = ChatMessageCell.this.channelRecommendationsCell) == null || !channelRecommendationsCell.isExpanded()) ? false : true) != this.lastDrawingRecommendationsExpanded) {
}
this.animateLinkAbove = false;
chatMessageCell = ChatMessageCell.this;
if (chatMessageCell.linkPreviewAbove != this.lastDrawingLinkAbove) {
}
this.animateLinkPreviewHeight = false;
if (chatMessageCell.hasLinkPreview) {
}
this.animateUseTranscribeButton = false;
if (ChatMessageCell.this.useTranscribeButton != this.lastUseTranscribeButton) {
}
ChatMessageCell chatMessageCell72 = ChatMessageCell.this;
textLayoutBlocks = chatMessageCell72.captionLayout;
textLayoutBlocks2 = this.lastDrawingCaptionLayout;
if (textLayoutBlocks == textLayoutBlocks2) {
}
if (this.lastDrawBotButtons.isEmpty()) {
}
if (this.lastDrawBotButtons.size() != ChatMessageCell.this.botButtons.size()) {
}
if (!this.animateBotButtonsChanged) {
}
if (this.animateBotButtonsChanged) {
}
if (ChatMessageCell.this.documentAttachType != 5) {
}
this.animateFromButtonX = this.lastButtonX;
this.animateFromButtonY = this.lastButtonY;
this.animateButton = true;
z = true;
i = ChatMessageCell.this.mediaOffsetY;
i2 = this.lastMediaOffsetY;
if (i != i2) {
}
z2 = this.lastIsPinned;
chatMessageCell2 = ChatMessageCell.this;
if (z2 == chatMessageCell2.isPinned) {
}
if (this.lastRepliesLayout == null) {
}
this.animateRepliesLayout = this.lastRepliesLayout;
this.animateReplies = true;
ChatMessageCell.this.accessibilityText = null;
z = true;
z3 = true;
if (this.lastViewsLayout != null) {
this.animateViewsLayout = this.lastViewsLayout;
ChatMessageCell.this.accessibilityText = null;
z = true;
z3 = true;
}
if (ChatMessageCell.this.commentLayout != null) {
staticLayout2 = this.lastCommentLayout;
if (staticLayout2 == null) {
}
this.animateCommentsLayout = null;
this.animateTotalCommentWidth = this.lastTotalCommentWidth;
this.animateCommentX = this.lastCommentX;
this.animateCommentArrowX = this.lastCommentArrowX;
this.animateCommentUnreadX = this.lastCommentUnreadX;
this.animateCommentDrawUnread = this.lastCommentDrawUnread;
this.animateDrawCommentNumber = this.lastDrawCommentNumber;
this.animateComments = true;
z = true;
}
if (!TextUtils.equals(this.lastSignMessage, ChatMessageCell.this.lastPostAuthor)) {
}
if (this.lastDrawTime != ChatMessageCell.this.forceNotDrawTime) {
}
z = true;
if (this.lastShouldDrawMenuDrawable != ChatMessageCell.this.shouldDrawMenuDrawable()) {
}
if (this.lastLocatinIsExpired != ChatMessageCell.this.locationExpired) {
}
if (this.lastIsPlayingRound != ChatMessageCell.this.isPlayingRound) {
}
f = this.lastDrawingTextY;
chatMessageCell3 = ChatMessageCell.this;
if (f != chatMessageCell3.textY) {
}
if (this.lastDrawingLinkPreviewY != chatMessageCell3.linkPreviewY) {
}
if (ChatMessageCell.this.currentMessageObject != null) {
}
ChatMessageCell.this.updateReactionLayoutPosition();
if (ChatMessageCell.this.reactionsLayoutInBubble.animateChange()) {
}
if (ChatMessageCell.this.currentMessageObject.isRoundVideo()) {
}
chatMessageCell4 = ChatMessageCell.this;
if (chatMessageCell4.replyNameLayout != null) {
}
return z;
}
public void onDetach() {
this.wasDraw = false;
}
public void resetAnimation() {
this.animateChange = false;
this.animatePinned = false;
this.animateBackgroundBoundsInner = false;
this.deltaLeft = 0.0f;
this.deltaRight = 0.0f;
this.deltaBottom = 0.0f;
this.deltaTop = 0.0f;
this.toDeltaLeft = 0.0f;
this.toDeltaRight = 0.0f;
if (this.imageChangeBoundsTransition && this.animateToImageW != 0.0f && this.animateToImageH != 0.0f) {
ChatMessageCell.this.photoImage.setImageCoords(this.animateToImageX, this.animateToImageY, this.animateToImageW, this.animateToImageH);
}
if (this.animateRadius) {
ChatMessageCell.this.photoImage.setRoundRadius(this.animateToRadius);
}
this.animateToImageX = 0.0f;
this.animateToImageY = 0.0f;
this.animateToImageW = 0.0f;
this.animateToImageH = 0.0f;
this.imageChangeBoundsTransition = false;
this.changePinnedBottomProgress = 1.0f;
this.captionEnterProgress = 1.0f;
this.animateRadius = false;
this.animateChangeProgress = 1.0f;
this.animateMessageText = false;
this.animateOutTextBlocks = null;
this.animateEditedLayout = null;
this.animateTimeLayout = null;
this.animateEditedEnter = false;
this.animateReplaceCaptionLayout = false;
this.transformGroupToSingleMessage = false;
this.animateOutCaptionLayout = null;
AnimatedEmojiSpan.release(ChatMessageCell.this, this.animateOutAnimateEmoji);
this.animateOutAnimateEmoji = null;
this.moveCaption = false;
this.animateDrawingTimeAlpha = false;
this.transitionBotButtons.clear();
this.animateButton = false;
this.animateMediaOffsetY = false;
this.animateReplyTextLayout = null;
this.animateReplies = false;
this.animateRepliesLayout = null;
this.animateComments = false;
this.animateCommentsLayout = null;
this.animateViewsLayout = null;
this.animateShouldDrawTimeOnMedia = false;
this.animateShouldDrawMenuDrawable = false;
this.shouldAnimateTimeX = false;
this.animateDrawBackground = false;
this.animateSign = false;
this.animateSmallImage = false;
this.animateLinkAbove = false;
this.animateRecommendationsExpanded = false;
this.animateDrawingTimeAlpha = false;
this.animateLocationIsExpired = false;
this.animatePlayingRound = false;
this.animateText = false;
this.animateLinkPreviewY = false;
this.animateForwardedLayout = false;
StaticLayout[] staticLayoutArr = this.animatingForwardedNameLayout;
staticLayoutArr[0] = null;
staticLayoutArr[1] = null;
this.animateRoundVideoDotY = false;
ChatMessageCell.this.reactionsLayoutInBubble.resetAnimation();
}
public int createStatusDrawableParams() {
boolean z;
int i;
boolean z2;
boolean z3 = true;
if (ChatMessageCell.this.currentMessageObject.isOutOwner()) {
if (ChatMessageCell.this.currentMessageObject.isSending() || ChatMessageCell.this.currentMessageObject.isEditing()) {
z = true;
i = 0;
z3 = false;
z2 = false;
} else if (ChatMessageCell.this.currentMessageObject.isSendError()) {
z2 = true;
i = 0;
z3 = false;
z = false;
} else {
if (ChatMessageCell.this.currentMessageObject.isSent()) {
i = (ChatMessageCell.this.currentMessageObject.scheduled || ChatMessageCell.this.currentMessageObject.isUnread()) ? 0 : 1;
z = false;
} else {
i = 0;
z3 = false;
z = false;
}
z2 = z;
}
return i | (z3 ? 2 : 0) | (z ? 4 : 0) | (z2 ? 8 : 0);
}
if (!ChatMessageCell.this.currentMessageObject.isSending() && !ChatMessageCell.this.currentMessageObject.isEditing()) {
z3 = false;
}
return (z3 ? 4 : 0) | (ChatMessageCell.this.currentMessageObject.isSendError() ? 8 : 0);
}
}
public int getThemedColor(int i) {
return Theme.getColor(i, this.resourcesProvider);
}
private Drawable getThemedDrawable(String str) {
Theme.ResourcesProvider resourcesProvider = this.resourcesProvider;
Drawable drawable = resourcesProvider != null ? resourcesProvider.getDrawable(str) : null;
return drawable != null ? drawable : Theme.getThemeDrawable(str);
}
public Paint getThemedPaint(String str) {
Theme.ResourcesProvider resourcesProvider = this.resourcesProvider;
Paint paint = resourcesProvider != null ? resourcesProvider.getPaint(str) : null;
return paint != null ? paint : Theme.getThemePaint(str);
}
public boolean hasGradientService() {
Theme.ResourcesProvider resourcesProvider = this.resourcesProvider;
return resourcesProvider != null ? resourcesProvider.hasGradientService() : Theme.hasGradientService();
}
private ColorMatrixColorFilter getFancyBlurFilter() {
if (this.fancyBlurFilter == null) {
ColorMatrix colorMatrix = new ColorMatrix();
AndroidUtilities.multiplyBrightnessColorMatrix(colorMatrix, 0.9f);
AndroidUtilities.adjustSaturationColorMatrix(colorMatrix, 0.6f);
this.fancyBlurFilter = new ColorMatrixColorFilter(colorMatrix);
}
return this.fancyBlurFilter;
}
public int getNameStatusX() {
return (int) (this.nameX + (this.viaNameWidth > 0 ? r1 - AndroidUtilities.dp(32.0f) : this.nameLayoutWidth) + AndroidUtilities.dp(2.0f) + (AndroidUtilities.dp(20.0f) / 2));
}
public int getNameStatusY() {
return (int) (this.nameY + ((this.nameLayout == null ? 0 : r1.getHeight()) / 2));
}
@Override
public void computeScroll() {
super.computeScroll();
ChannelRecommendationsCell channelRecommendationsCell = this.channelRecommendationsCell;
if (channelRecommendationsCell != null) {
channelRecommendationsCell.computeScroll();
}
}
private ColorFilter getAdaptiveEmojiColorFilter(int i, int i2) {
if (this.adaptiveEmojiColorFilter == null) {
this.adaptiveEmojiColor = new int[3];
this.adaptiveEmojiColorFilter = new ColorFilter[3];
}
if (i2 != this.adaptiveEmojiColor[i] || this.adaptiveEmojiColorFilter[i] == null) {
ColorFilter[] colorFilterArr = this.adaptiveEmojiColorFilter;
this.adaptiveEmojiColor[i] = i2;
colorFilterArr[i] = new PorterDuffColorFilter(i2, PorterDuff.Mode.SRC_IN);
}
return this.adaptiveEmojiColorFilter[i];
}
public boolean needDrawAvatar() {
MessageObject messageObject;
MessageObject messageObject2;
return !(!this.isChat || this.isSavedPreviewChat || this.isThreadPost || (messageObject2 = this.currentMessageObject) == null || messageObject2.isOutOwner() || !this.currentMessageObject.needDrawAvatar()) || ((messageObject = this.currentMessageObject) != null && messageObject.forceAvatar);
}
public boolean drawPhotoImage(Canvas canvas) {
return this.photoImage.draw(canvas);
}
}