Telegram5 v10.6.2版本的 MD5 值为:423cae39e902ed9dd2cc7f4b4547b276
以下内容为反编译后的 ThemePreviewMessagesCell.java 源代码,内容仅作参考
package org.telegram.ui.Cells;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.text.style.CharacterStyle;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.ViewTreeObserver;
import android.widget.LinearLayout;
import androidx.core.content.ContextCompat;
import java.util.ArrayList;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaDataController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.R;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.browser.Browser;
import org.telegram.tgnet.TLRPC$Chat;
import org.telegram.tgnet.TLRPC$Document;
import org.telegram.tgnet.TLRPC$KeyboardButton;
import org.telegram.tgnet.TLRPC$Message;
import org.telegram.tgnet.TLRPC$ReactionCount;
import org.telegram.tgnet.TLRPC$TL_message;
import org.telegram.tgnet.TLRPC$TL_messageEntityCustomEmoji;
import org.telegram.tgnet.TLRPC$TL_messageEntityTextUrl;
import org.telegram.tgnet.TLRPC$TL_messageMediaEmpty;
import org.telegram.tgnet.TLRPC$TL_messageMediaWebPage;
import org.telegram.tgnet.TLRPC$TL_messageReplyHeader;
import org.telegram.tgnet.TLRPC$TL_peerChannel;
import org.telegram.tgnet.TLRPC$TL_peerUser;
import org.telegram.tgnet.TLRPC$TL_webPage;
import org.telegram.tgnet.TLRPC$User;
import org.telegram.tgnet.TLRPC$WebPage;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.INavigationLayout;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Cells.ChatMessageCell;
import org.telegram.ui.Cells.TextSelectionHelper;
import org.telegram.ui.Cells.ThemePreviewMessagesCell;
import org.telegram.ui.ChatBackgroundDrawable;
import org.telegram.ui.Components.AnimatedColor;
import org.telegram.ui.Components.AnimatedEmojiSpan;
import org.telegram.ui.Components.AnimatedFloat;
import org.telegram.ui.Components.AvatarDrawable;
import org.telegram.ui.Components.BackgroundGradientDrawable;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.MotionBackgroundDrawable;
import org.telegram.ui.Components.Reactions.ReactionsEffectOverlay;
import org.telegram.ui.Components.Reactions.ReactionsLayoutInBubble;
import org.telegram.ui.PinchToZoomHelper;
import org.telegram.ui.Stories.recorder.StoryEntry;
public class ThemePreviewMessagesCell extends LinearLayout {
private Drawable backgroundDrawable;
private BackgroundGradientDrawable.Disposable backgroundGradientDisposable;
private final Runnable cancelProgress;
private ChatMessageCell[] cells;
public boolean customAnimation;
public BaseFragment fragment;
private Drawable oldBackgroundDrawable;
private BackgroundGradientDrawable.Disposable oldBackgroundGradientDisposable;
private Drawable overrideDrawable;
private final AnimatedFloat overrideDrawableUpdate;
private INavigationLayout parentLayout;
private int progress;
private Drawable shadowDrawable;
private final int type;
@Override
protected void dispatchSetPressed(boolean z) {
}
public void lambda$new$0() {
this.progress = -1;
int i = 0;
while (true) {
ChatMessageCell[] chatMessageCellArr = this.cells;
if (i >= chatMessageCellArr.length) {
return;
}
if (chatMessageCellArr[i] != null) {
chatMessageCellArr[i].invalidate();
}
i++;
}
}
public ThemePreviewMessagesCell(Context context, INavigationLayout iNavigationLayout, int i) {
this(context, iNavigationLayout, i, 0L);
}
public ThemePreviewMessagesCell(Context context, INavigationLayout iNavigationLayout, int i, long j) {
this(context, iNavigationLayout, i, j, null);
}
@SuppressLint({"ClickableViewAccessibility"})
public ThemePreviewMessagesCell(Context context, INavigationLayout iNavigationLayout, int i, long j, Theme.ResourcesProvider resourcesProvider) {
super(context);
boolean z;
MessageObject messageObject;
MessageObject messageObject2;
int i2;
ChatMessageCell[] chatMessageCellArr;
boolean z2;
new Runnable() {
@Override
public final void run() {
ThemePreviewMessagesCell.this.invalidate();
}
};
this.cells = new ChatMessageCell[2];
this.progress = -1;
this.cancelProgress = new Runnable() {
@Override
public final void run() {
ThemePreviewMessagesCell.this.lambda$new$0();
}
};
this.overrideDrawableUpdate = new AnimatedFloat(this, 0L, 350L, CubicBezierInterpolator.EASE_OUT_QUINT);
this.type = i;
int i3 = UserConfig.selectedAccount;
this.parentLayout = iNavigationLayout;
setWillNotDraw(false);
setOrientation(1);
setPadding(0, AndroidUtilities.dp(11.0f), 0, AndroidUtilities.dp(11.0f));
this.shadowDrawable = Theme.getThemedDrawableByKey(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow, resourcesProvider);
int currentTimeMillis = ((int) (System.currentTimeMillis() / 1000)) - 3600;
if (i == 3) {
boolean z3 = j < 0;
TLRPC$TL_message tLRPC$TL_message = new TLRPC$TL_message();
tLRPC$TL_message.message = LocaleController.getString(z3 ? R.string.ChannelColorPreview : R.string.UserColorPreview);
TLRPC$TL_messageReplyHeader tLRPC$TL_messageReplyHeader = new TLRPC$TL_messageReplyHeader();
tLRPC$TL_message.reply_to = tLRPC$TL_messageReplyHeader;
tLRPC$TL_messageReplyHeader.flags |= 1;
if (j == 0) {
tLRPC$TL_messageReplyHeader.reply_to_peer_id = new TLRPC$TL_peerUser();
tLRPC$TL_message.reply_to.reply_to_peer_id.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId();
} else {
tLRPC$TL_messageReplyHeader.reply_to_peer_id = new TLRPC$TL_peerChannel();
tLRPC$TL_message.reply_to.reply_to_peer_id.channel_id = -j;
}
TLRPC$Message tLRPC$Message = new TLRPC$Message();
tLRPC$TL_message.replyMessage = tLRPC$Message;
tLRPC$Message.media = new TLRPC$TL_messageMediaEmpty();
if (j == 0) {
tLRPC$TL_message.replyMessage.from_id = new TLRPC$TL_peerUser();
tLRPC$TL_message.replyMessage.from_id.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId();
tLRPC$TL_message.replyMessage.peer_id = new TLRPC$TL_peerUser();
tLRPC$TL_message.replyMessage.peer_id.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId();
} else {
tLRPC$TL_message.replyMessage.from_id = new TLRPC$TL_peerChannel();
TLRPC$Message tLRPC$Message2 = tLRPC$TL_message.replyMessage;
long j2 = -j;
tLRPC$Message2.from_id.channel_id = j2;
tLRPC$Message2.peer_id = new TLRPC$TL_peerChannel();
tLRPC$TL_message.replyMessage.peer_id.channel_id = j2;
}
tLRPC$TL_message.replyMessage.message = LocaleController.getString(z3 ? R.string.ChannelColorPreviewReply : R.string.UserColorPreviewReply);
TLRPC$TL_messageMediaWebPage tLRPC$TL_messageMediaWebPage = new TLRPC$TL_messageMediaWebPage();
tLRPC$TL_message.media = tLRPC$TL_messageMediaWebPage;
tLRPC$TL_messageMediaWebPage.webpage = new TLRPC$TL_webPage();
TLRPC$WebPage tLRPC$WebPage = tLRPC$TL_message.media.webpage;
tLRPC$WebPage.embed_url = "https://telegram.org/";
tLRPC$WebPage.flags |= 2;
tLRPC$WebPage.site_name = LocaleController.getString(R.string.AppName);
TLRPC$WebPage tLRPC$WebPage2 = tLRPC$TL_message.media.webpage;
tLRPC$WebPage2.flags |= 4;
tLRPC$WebPage2.title = LocaleController.getString(z3 ? R.string.ChannelColorPreviewLinkTitle : R.string.UserColorPreviewLinkTitle);
TLRPC$WebPage tLRPC$WebPage3 = tLRPC$TL_message.media.webpage;
tLRPC$WebPage3.flags |= 8;
tLRPC$WebPage3.description = LocaleController.getString(z3 ? R.string.ChannelColorPreviewLinkDescription : R.string.UserColorPreviewLinkDescription);
tLRPC$TL_message.date = currentTimeMillis + 60;
tLRPC$TL_message.dialog_id = 1L;
tLRPC$TL_message.flags = 259;
if (j == 0) {
TLRPC$TL_peerUser tLRPC$TL_peerUser = new TLRPC$TL_peerUser();
tLRPC$TL_message.from_id = tLRPC$TL_peerUser;
tLRPC$TL_peerUser.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId();
} else {
TLRPC$TL_peerChannel tLRPC$TL_peerChannel = new TLRPC$TL_peerChannel();
tLRPC$TL_message.from_id = tLRPC$TL_peerChannel;
tLRPC$TL_peerChannel.channel_id = -j;
}
tLRPC$TL_message.id = 1;
tLRPC$TL_message.out = false;
if (j == 0) {
TLRPC$TL_peerUser tLRPC$TL_peerUser2 = new TLRPC$TL_peerUser();
tLRPC$TL_message.peer_id = tLRPC$TL_peerUser2;
tLRPC$TL_peerUser2.user_id = 0L;
} else {
TLRPC$TL_peerChannel tLRPC$TL_peerChannel2 = new TLRPC$TL_peerChannel();
tLRPC$TL_message.peer_id = tLRPC$TL_peerChannel2;
tLRPC$TL_peerChannel2.channel_id = -j;
}
MessageObject messageObject3 = new MessageObject(UserConfig.selectedAccount, tLRPC$TL_message, true, false);
messageObject3.forceAvatar = true;
messageObject3.resetLayout();
messageObject3.eventId = 1L;
messageObject = messageObject3;
} else if (i == 2) {
TLRPC$TL_message tLRPC$TL_message2 = new TLRPC$TL_message();
tLRPC$TL_message2.message = LocaleController.getString("DoubleTapPreviewMessage", R.string.DoubleTapPreviewMessage);
tLRPC$TL_message2.date = currentTimeMillis + 60;
tLRPC$TL_message2.dialog_id = 1L;
tLRPC$TL_message2.flags = 259;
TLRPC$TL_peerUser tLRPC$TL_peerUser3 = new TLRPC$TL_peerUser();
tLRPC$TL_message2.from_id = tLRPC$TL_peerUser3;
tLRPC$TL_peerUser3.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId();
tLRPC$TL_message2.id = 1;
tLRPC$TL_message2.media = new TLRPC$TL_messageMediaEmpty();
tLRPC$TL_message2.out = false;
TLRPC$TL_peerUser tLRPC$TL_peerUser4 = new TLRPC$TL_peerUser();
tLRPC$TL_message2.peer_id = tLRPC$TL_peerUser4;
tLRPC$TL_peerUser4.user_id = 0L;
MessageObject messageObject4 = new MessageObject(UserConfig.selectedAccount, tLRPC$TL_message2, true, false);
messageObject4.resetLayout();
messageObject4.eventId = 1L;
messageObject4.customName = LocaleController.getString("DoubleTapPreviewSenderName", R.string.DoubleTapPreviewSenderName);
messageObject4.customAvatarDrawable = ContextCompat.getDrawable(context, R.drawable.dino_pic);
messageObject4.overrideLinkColor = 5;
messageObject4.overrideLinkEmoji = 0L;
messageObject = messageObject4;
} else {
TLRPC$TL_message tLRPC$TL_message3 = new TLRPC$TL_message();
if (i == 0) {
tLRPC$TL_message3.message = LocaleController.getString("FontSizePreviewReply", R.string.FontSizePreviewReply);
} else {
tLRPC$TL_message3.message = LocaleController.getString("NewThemePreviewReply", R.string.NewThemePreviewReply);
}
int indexOf = tLRPC$TL_message3.message.indexOf("👋");
if (indexOf >= 0) {
TLRPC$TL_messageEntityCustomEmoji tLRPC$TL_messageEntityCustomEmoji = new TLRPC$TL_messageEntityCustomEmoji();
tLRPC$TL_messageEntityCustomEmoji.offset = indexOf;
tLRPC$TL_messageEntityCustomEmoji.length = 2;
tLRPC$TL_messageEntityCustomEmoji.document_id = 5386654653003864312L;
tLRPC$TL_message3.entities.add(tLRPC$TL_messageEntityCustomEmoji);
}
int i4 = currentTimeMillis + 60;
tLRPC$TL_message3.date = i4;
tLRPC$TL_message3.dialog_id = 1L;
tLRPC$TL_message3.flags = 259;
TLRPC$TL_peerUser tLRPC$TL_peerUser5 = new TLRPC$TL_peerUser();
tLRPC$TL_message3.from_id = tLRPC$TL_peerUser5;
tLRPC$TL_peerUser5.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId();
tLRPC$TL_message3.id = 1;
tLRPC$TL_message3.media = new TLRPC$TL_messageMediaEmpty();
tLRPC$TL_message3.out = true;
TLRPC$TL_peerUser tLRPC$TL_peerUser6 = new TLRPC$TL_peerUser();
tLRPC$TL_message3.peer_id = tLRPC$TL_peerUser6;
tLRPC$TL_peerUser6.user_id = 0L;
MessageObject messageObject5 = new MessageObject(UserConfig.selectedAccount, tLRPC$TL_message3, true, false);
TLRPC$TL_message tLRPC$TL_message4 = new TLRPC$TL_message();
if (i == 0) {
tLRPC$TL_message4.message = LocaleController.getString("FontSizePreviewLine2", R.string.FontSizePreviewLine2);
} else {
String string = LocaleController.getString("NewThemePreviewLine3", R.string.NewThemePreviewLine3);
StringBuilder sb = new StringBuilder(string);
int indexOf2 = string.indexOf(42);
int lastIndexOf = string.lastIndexOf(42);
if (indexOf2 != -1 && lastIndexOf != -1) {
sb.replace(lastIndexOf, lastIndexOf + 1, "");
sb.replace(indexOf2, indexOf2 + 1, "");
TLRPC$TL_messageEntityTextUrl tLRPC$TL_messageEntityTextUrl = new TLRPC$TL_messageEntityTextUrl();
tLRPC$TL_messageEntityTextUrl.offset = indexOf2;
tLRPC$TL_messageEntityTextUrl.length = (lastIndexOf - indexOf2) - 1;
tLRPC$TL_messageEntityTextUrl.url = "https://telegram.org";
tLRPC$TL_message4.entities.add(tLRPC$TL_messageEntityTextUrl);
}
tLRPC$TL_message4.message = sb.toString();
}
int indexOf3 = tLRPC$TL_message4.message.indexOf("😎");
if (indexOf3 >= 0) {
TLRPC$TL_messageEntityCustomEmoji tLRPC$TL_messageEntityCustomEmoji2 = new TLRPC$TL_messageEntityCustomEmoji();
tLRPC$TL_messageEntityCustomEmoji2.offset = indexOf3;
tLRPC$TL_messageEntityCustomEmoji2.length = 2;
tLRPC$TL_messageEntityCustomEmoji2.document_id = 5373141891321699086L;
tLRPC$TL_message4.entities.add(tLRPC$TL_messageEntityCustomEmoji2);
}
tLRPC$TL_message4.date = currentTimeMillis + 960;
tLRPC$TL_message4.dialog_id = 1L;
tLRPC$TL_message4.flags = 259;
TLRPC$TL_peerUser tLRPC$TL_peerUser7 = new TLRPC$TL_peerUser();
tLRPC$TL_message4.from_id = tLRPC$TL_peerUser7;
tLRPC$TL_peerUser7.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId();
tLRPC$TL_message4.id = 1;
tLRPC$TL_message4.media = new TLRPC$TL_messageMediaEmpty();
tLRPC$TL_message4.out = true;
TLRPC$TL_peerUser tLRPC$TL_peerUser8 = new TLRPC$TL_peerUser();
tLRPC$TL_message4.peer_id = tLRPC$TL_peerUser8;
tLRPC$TL_peerUser8.user_id = 0L;
MessageObject messageObject6 = new MessageObject(UserConfig.selectedAccount, tLRPC$TL_message4, true, false);
messageObject6.resetLayout();
messageObject6.overrideLinkColor = 5;
messageObject6.overrideLinkEmoji = 0L;
messageObject6.eventId = 1L;
TLRPC$TL_message tLRPC$TL_message5 = new TLRPC$TL_message();
if (i == 0) {
tLRPC$TL_message5.message = LocaleController.getString("FontSizePreviewLine1", R.string.FontSizePreviewLine1);
} else {
tLRPC$TL_message5.message = LocaleController.getString("NewThemePreviewLine1", R.string.NewThemePreviewLine1);
}
tLRPC$TL_message5.date = i4;
tLRPC$TL_message5.dialog_id = 1L;
tLRPC$TL_message5.flags = 265;
tLRPC$TL_message5.from_id = new TLRPC$TL_peerUser();
tLRPC$TL_message5.id = 1;
TLRPC$TL_messageReplyHeader tLRPC$TL_messageReplyHeader2 = new TLRPC$TL_messageReplyHeader();
tLRPC$TL_message5.reply_to = tLRPC$TL_messageReplyHeader2;
tLRPC$TL_messageReplyHeader2.flags |= 16;
tLRPC$TL_messageReplyHeader2.reply_to_msg_id = 5;
tLRPC$TL_message5.media = new TLRPC$TL_messageMediaEmpty();
tLRPC$TL_message5.out = false;
TLRPC$TL_peerUser tLRPC$TL_peerUser9 = new TLRPC$TL_peerUser();
tLRPC$TL_message5.peer_id = tLRPC$TL_peerUser9;
tLRPC$TL_peerUser9.user_id = UserConfig.getInstance(UserConfig.selectedAccount).getClientUserId();
z = true;
MessageObject messageObject7 = new MessageObject(UserConfig.selectedAccount, tLRPC$TL_message5, true, false);
if (i != 0) {
messageObject7.customReplyName = LocaleController.getString("NewThemePreviewName", R.string.NewThemePreviewName);
}
messageObject7.eventId = 1L;
messageObject7.resetLayout();
messageObject7.replyMessageObject = messageObject5;
messageObject = messageObject6;
messageObject2 = messageObject7;
i2 = 0;
while (true) {
chatMessageCellArr = this.cells;
if (i2 < chatMessageCellArr.length) {
return;
}
boolean z4 = z;
chatMessageCellArr[i2] = new ChatMessageCell(context, false, null, resourcesProvider, context, i) {
private final AnimatedColor color1;
private final AnimatedColor color2;
private GestureDetector gestureDetector;
final Context val$context;
final int val$type;
public class C00171 extends GestureDetector.SimpleOnGestureListener {
C00171() {
}
@Override
public boolean onDoubleTap(MotionEvent motionEvent) {
AnonymousClass1 anonymousClass1 = AnonymousClass1.this;
if (anonymousClass1.val$type != 2 || MediaDataController.getInstance(anonymousClass1.currentAccount).getDoubleTapReaction() == null) {
return false;
}
boolean selectReaction = getMessageObject().selectReaction(ReactionsLayoutInBubble.VisibleReaction.fromEmojicon(MediaDataController.getInstance(AnonymousClass1.this.currentAccount).getDoubleTapReaction()), false, false);
AnonymousClass1 anonymousClass12 = AnonymousClass1.this;
anonymousClass12.setMessageObject(anonymousClass12.getMessageObject(), null, false, false);
requestLayout();
ReactionsEffectOverlay.removeCurrent(false);
if (selectReaction) {
ThemePreviewMessagesCell themePreviewMessagesCell = ThemePreviewMessagesCell.this;
ReactionsEffectOverlay.show(themePreviewMessagesCell.fragment, null, themePreviewMessagesCell.cells[1], null, motionEvent.getX(), motionEvent.getY(), ReactionsLayoutInBubble.VisibleReaction.fromEmojicon(MediaDataController.getInstance(AnonymousClass1.this.currentAccount).getDoubleTapReaction()), AnonymousClass1.this.currentAccount, 0);
ReactionsEffectOverlay.startAnimation();
}
getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserverOnPreDrawListenerC00181());
return true;
}
public class ViewTreeObserverOnPreDrawListenerC00181 implements ViewTreeObserver.OnPreDrawListener {
ViewTreeObserverOnPreDrawListenerC00181() {
}
@Override
public boolean onPreDraw() {
getViewTreeObserver().removeOnPreDrawListener(this);
getTransitionParams().resetAnimation();
getTransitionParams().animateChange();
getTransitionParams().animateChange = true;
getTransitionParams().animateChangeProgress = 0.0f;
ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
ThemePreviewMessagesCell.AnonymousClass1.C00171.ViewTreeObserverOnPreDrawListenerC00181.this.lambda$onPreDraw$0(valueAnimator);
}
});
ofFloat.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
super.onAnimationEnd(animator);
getTransitionParams().resetAnimation();
getTransitionParams().animateChange = false;
getTransitionParams().animateChangeProgress = 1.0f;
}
});
ofFloat.start();
return false;
}
public void lambda$onPreDraw$0(ValueAnimator valueAnimator) {
getTransitionParams().animateChangeProgress = ((Float) valueAnimator.getAnimatedValue()).floatValue();
invalidate();
}
}
}
{
this.val$context = context;
this.val$type = i;
this.gestureDetector = new GestureDetector(context, new C00171());
CubicBezierInterpolator cubicBezierInterpolator = CubicBezierInterpolator.EASE_OUT;
this.color1 = new AnimatedColor(this, 0L, 180L, cubicBezierInterpolator);
this.color2 = new AnimatedColor(this, 0L, 180L, cubicBezierInterpolator);
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
if (ThemePreviewMessagesCell.this.allowLoadingOnTouch()) {
return super.onTouchEvent(motionEvent);
}
this.gestureDetector.onTouchEvent(motionEvent);
return true;
}
@Override
protected void dispatchDraw(Canvas canvas) {
int themedColor;
int themedColor2;
if (getMessageObject() != null && getMessageObject().overrideLinkColor >= 0) {
int i5 = getMessageObject().overrideLinkColor;
if (i5 >= 14) {
MessagesController messagesController = MessagesController.getInstance(UserConfig.selectedAccount);
MessagesController.PeerColors peerColors = messagesController != null ? messagesController.peerColors : null;
MessagesController.PeerColor color = peerColors != null ? peerColors.getColor(i5) : null;
if (color != null) {
int color1 = color.getColor1();
themedColor = getThemedColor(Theme.keys_avatar_background[AvatarDrawable.getPeerColorIndex(color1)]);
themedColor2 = getThemedColor(Theme.keys_avatar_background2[AvatarDrawable.getPeerColorIndex(color1)]);
} else {
long j3 = i5;
themedColor = getThemedColor(Theme.keys_avatar_background[AvatarDrawable.getColorIndex(j3)]);
themedColor2 = getThemedColor(Theme.keys_avatar_background2[AvatarDrawable.getColorIndex(j3)]);
}
} else {
long j4 = i5;
themedColor = getThemedColor(Theme.keys_avatar_background[AvatarDrawable.getColorIndex(j4)]);
themedColor2 = getThemedColor(Theme.keys_avatar_background2[AvatarDrawable.getColorIndex(j4)]);
}
this.avatarDrawable.setColor(this.color1.set(themedColor), this.color2.set(themedColor2));
} else {
this.color1.set(this.avatarDrawable.getColor());
this.color2.set(this.avatarDrawable.getColor2());
}
if (getAvatarImage() != null && getAvatarImage().getImageHeight() != 0.0f) {
getAvatarImage().setImageCoords(getAvatarImage().getImageX(), (getMeasuredHeight() - getAvatarImage().getImageHeight()) - AndroidUtilities.dp(4.0f), getAvatarImage().getImageWidth(), getAvatarImage().getImageHeight());
getAvatarImage().setRoundRadius((int) (getAvatarImage().getImageHeight() / 2.0f));
getAvatarImage().draw(canvas);
} else if (this.val$type == 2) {
invalidate();
}
super.dispatchDraw(canvas);
}
};
this.cells[i2].setDelegate(new ChatMessageCell.ChatMessageCellDelegate() {
@Override
public boolean canDrawOutboundsContent() {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$canDrawOutboundsContent(this);
}
@Override
public void didLongPress(ChatMessageCell chatMessageCell, float f, float f2) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didLongPress(this, chatMessageCell, f, f2);
}
@Override
public void didLongPressBotButton(ChatMessageCell chatMessageCell, TLRPC$KeyboardButton tLRPC$KeyboardButton) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didLongPressBotButton(this, chatMessageCell, tLRPC$KeyboardButton);
}
@Override
public boolean didLongPressChannelAvatar(ChatMessageCell chatMessageCell, TLRPC$Chat tLRPC$Chat, int i5, float f, float f2) {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$didLongPressChannelAvatar(this, chatMessageCell, tLRPC$Chat, i5, f, f2);
}
@Override
public boolean didLongPressUserAvatar(ChatMessageCell chatMessageCell, TLRPC$User tLRPC$User, float f, float f2) {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$didLongPressUserAvatar(this, chatMessageCell, tLRPC$User, f, f2);
}
@Override
public boolean didPressAnimatedEmoji(ChatMessageCell chatMessageCell, AnimatedEmojiSpan animatedEmojiSpan) {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressAnimatedEmoji(this, chatMessageCell, animatedEmojiSpan);
}
@Override
public void didPressBotButton(ChatMessageCell chatMessageCell, TLRPC$KeyboardButton tLRPC$KeyboardButton) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressBotButton(this, chatMessageCell, tLRPC$KeyboardButton);
}
@Override
public void didPressCancelSendButton(ChatMessageCell chatMessageCell) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressCancelSendButton(this, chatMessageCell);
}
@Override
public void didPressChannelAvatar(ChatMessageCell chatMessageCell, TLRPC$Chat tLRPC$Chat, int i5, float f, float f2) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressChannelAvatar(this, chatMessageCell, tLRPC$Chat, i5, f, f2);
}
@Override
public void didPressChannelRecommendation(ChatMessageCell chatMessageCell, TLRPC$Chat tLRPC$Chat, boolean z5) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressChannelRecommendation(this, chatMessageCell, tLRPC$Chat, z5);
}
@Override
public void didPressChannelRecommendationsClose(ChatMessageCell chatMessageCell) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressChannelRecommendationsClose(this, chatMessageCell);
}
@Override
public void didPressCodeCopy(ChatMessageCell chatMessageCell, MessageObject.TextLayoutBlock textLayoutBlock) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressCodeCopy(this, chatMessageCell, textLayoutBlock);
}
@Override
public void didPressCommentButton(ChatMessageCell chatMessageCell) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressCommentButton(this, chatMessageCell);
}
@Override
public void didPressExtendedMediaPreview(ChatMessageCell chatMessageCell, TLRPC$KeyboardButton tLRPC$KeyboardButton) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressExtendedMediaPreview(this, chatMessageCell, tLRPC$KeyboardButton);
}
@Override
public void didPressGiveawayChatButton(ChatMessageCell chatMessageCell, int i5) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressGiveawayChatButton(this, chatMessageCell, i5);
}
@Override
public void didPressHiddenForward(ChatMessageCell chatMessageCell) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressHiddenForward(this, chatMessageCell);
}
@Override
public void didPressHint(ChatMessageCell chatMessageCell, int i5) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressHint(this, chatMessageCell, i5);
}
@Override
public void didPressImage(ChatMessageCell chatMessageCell, float f, float f2) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressImage(this, chatMessageCell, f, f2);
}
@Override
public void didPressMoreChannelRecommendations(ChatMessageCell chatMessageCell) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressMoreChannelRecommendations(this, chatMessageCell);
}
@Override
public void didPressOther(ChatMessageCell chatMessageCell, float f, float f2) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressOther(this, chatMessageCell, f, f2);
}
@Override
public void didPressReaction(ChatMessageCell chatMessageCell, TLRPC$ReactionCount tLRPC$ReactionCount, boolean z5) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressReaction(this, chatMessageCell, tLRPC$ReactionCount, z5);
}
@Override
public void didPressSideButton(ChatMessageCell chatMessageCell) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressSideButton(this, chatMessageCell);
}
@Override
public void didPressSponsoredClose() {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressSponsoredClose(this);
}
@Override
public void didPressTime(ChatMessageCell chatMessageCell) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressTime(this, chatMessageCell);
}
@Override
public void didPressTopicButton(ChatMessageCell chatMessageCell) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressTopicButton(this, chatMessageCell);
}
@Override
public void didPressUrl(ChatMessageCell chatMessageCell, CharacterStyle characterStyle, boolean z5) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressUrl(this, chatMessageCell, characterStyle, z5);
}
@Override
public void didPressUserAvatar(ChatMessageCell chatMessageCell, TLRPC$User tLRPC$User, float f, float f2) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressUserAvatar(this, chatMessageCell, tLRPC$User, f, f2);
}
@Override
public void didPressUserStatus(ChatMessageCell chatMessageCell, TLRPC$User tLRPC$User, TLRPC$Document tLRPC$Document) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressUserStatus(this, chatMessageCell, tLRPC$User, tLRPC$Document);
}
@Override
public void didPressViaBot(ChatMessageCell chatMessageCell, String str) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressViaBot(this, chatMessageCell, str);
}
@Override
public void didPressViaBotNotInline(ChatMessageCell chatMessageCell, long j3) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressViaBotNotInline(this, chatMessageCell, j3);
}
@Override
public void didPressVoteButtons(ChatMessageCell chatMessageCell, ArrayList arrayList, int i5, int i6, int i7) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didPressVoteButtons(this, chatMessageCell, arrayList, i5, i6, i7);
}
@Override
public void didPressWebPage(ChatMessageCell chatMessageCell, TLRPC$WebPage tLRPC$WebPage4, String str, boolean z5) {
Browser.openUrl(chatMessageCell.getContext(), str);
}
@Override
public void didStartVideoStream(MessageObject messageObject8) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$didStartVideoStream(this, messageObject8);
}
@Override
public String getAdminRank(long j3) {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$getAdminRank(this, j3);
}
@Override
public PinchToZoomHelper getPinchToZoomHelper() {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$getPinchToZoomHelper(this);
}
@Override
public String getProgressLoadingBotButtonUrl(ChatMessageCell chatMessageCell) {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$getProgressLoadingBotButtonUrl(this, chatMessageCell);
}
@Override
public CharacterStyle getProgressLoadingLink(ChatMessageCell chatMessageCell) {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$getProgressLoadingLink(this, chatMessageCell);
}
@Override
public TextSelectionHelper.ChatListTextSelectionHelper getTextSelectionHelper() {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$getTextSelectionHelper(this);
}
@Override
public boolean hasSelectedMessages() {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$hasSelectedMessages(this);
}
@Override
public void invalidateBlur() {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$invalidateBlur(this);
}
@Override
public boolean isLandscape() {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$isLandscape(this);
}
@Override
public boolean isReplyOrSelf() {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$isReplyOrSelf(this);
}
@Override
public boolean keyboardIsOpened() {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$keyboardIsOpened(this);
}
@Override
public boolean needPlayMessage(ChatMessageCell chatMessageCell, MessageObject messageObject8, boolean z5) {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$needPlayMessage(this, chatMessageCell, messageObject8, z5);
}
@Override
public void needReloadPolls() {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$needReloadPolls(this);
}
@Override
public void needShowPremiumBulletin(int i5) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$needShowPremiumBulletin(this, i5);
}
@Override
public boolean onAccessibilityAction(int i5, Bundle bundle) {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$onAccessibilityAction(this, i5, bundle);
}
@Override
public void onDiceFinished() {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$onDiceFinished(this);
}
@Override
public void setShouldNotRepeatSticker(MessageObject messageObject8) {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$setShouldNotRepeatSticker(this, messageObject8);
}
@Override
public boolean shouldDrawThreadProgress(ChatMessageCell chatMessageCell) {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$shouldDrawThreadProgress(this, chatMessageCell);
}
@Override
public boolean shouldRepeatSticker(MessageObject messageObject8) {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$shouldRepeatSticker(this, messageObject8);
}
@Override
public boolean shouldShowTopicButton() {
return ChatMessageCell.ChatMessageCellDelegate.CC.$default$shouldShowTopicButton(this);
}
@Override
public void videoTimerReached() {
ChatMessageCell.ChatMessageCellDelegate.CC.$default$videoTimerReached(this);
}
@Override
public boolean canPerformActions() {
return ThemePreviewMessagesCell.this.allowLoadingOnTouch();
}
@Override
public void didPressReplyMessage(ChatMessageCell chatMessageCell, int i5) {
if (ThemePreviewMessagesCell.this.allowLoadingOnTouch()) {
ThemePreviewMessagesCell.this.progress = 0;
chatMessageCell.invalidate();
AndroidUtilities.cancelRunOnUIThread(ThemePreviewMessagesCell.this.cancelProgress);
AndroidUtilities.runOnUIThread(ThemePreviewMessagesCell.this.cancelProgress, 5000L);
}
}
@Override
public void needOpenWebView(MessageObject messageObject8, String str, String str2, String str3, String str4, int i5, int i6) {
if (ThemePreviewMessagesCell.this.allowLoadingOnTouch()) {
ThemePreviewMessagesCell.this.progress = 2;
AndroidUtilities.cancelRunOnUIThread(ThemePreviewMessagesCell.this.cancelProgress);
AndroidUtilities.runOnUIThread(ThemePreviewMessagesCell.this.cancelProgress, 5000L);
}
}
@Override
public void didPressInstantButton(ChatMessageCell chatMessageCell, int i5) {
if (ThemePreviewMessagesCell.this.allowLoadingOnTouch()) {
ThemePreviewMessagesCell.this.progress = 2;
chatMessageCell.invalidate();
AndroidUtilities.cancelRunOnUIThread(ThemePreviewMessagesCell.this.cancelProgress);
AndroidUtilities.runOnUIThread(ThemePreviewMessagesCell.this.cancelProgress, 5000L);
}
}
@Override
public boolean isProgressLoading(ChatMessageCell chatMessageCell, int i5) {
return i5 == ThemePreviewMessagesCell.this.progress;
}
});
ChatMessageCell[] chatMessageCellArr2 = this.cells;
chatMessageCellArr2[i2].isChat = i == 2 ? z4 : false;
chatMessageCellArr2[i2].setFullyDraw(z4);
MessageObject messageObject8 = i2 == 0 ? messageObject2 : messageObject;
if (messageObject8 == null) {
z2 = false;
} else {
z2 = false;
this.cells[i2].setMessageObject(messageObject8, null, false, false);
addView(this.cells[i2], LayoutHelper.createLinear(-1, -2));
}
i2++;
z = z4;
}
}
z = true;
messageObject2 = null;
i2 = 0;
while (true) {
chatMessageCellArr = this.cells;
if (i2 < chatMessageCellArr.length) {
}
i2++;
z = z4;
}
}
public ChatMessageCell[] getCells() {
return this.cells;
}
@Override
public void invalidate() {
super.invalidate();
int i = 0;
while (true) {
ChatMessageCell[] chatMessageCellArr = this.cells;
if (i >= chatMessageCellArr.length) {
return;
}
chatMessageCellArr[i].invalidate();
i++;
}
}
public void setOverrideBackground(Drawable drawable) {
this.overrideDrawable = drawable;
if (drawable != null) {
drawable.setCallback(this);
}
if ((this.overrideDrawable instanceof ChatBackgroundDrawable) && isAttachedToWindow()) {
((ChatBackgroundDrawable) this.overrideDrawable).onAttachedToWindow(this);
}
invalidate();
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
Drawable drawable = this.overrideDrawable;
if (drawable instanceof ChatBackgroundDrawable) {
((ChatBackgroundDrawable) drawable).onAttachedToWindow(this);
}
}
@Override
protected boolean verifyDrawable(Drawable drawable) {
return drawable == this.overrideDrawable || drawable == this.oldBackgroundDrawable || super.verifyDrawable(drawable);
}
@Override
protected void onDraw(Canvas canvas) {
Drawable drawable = this.overrideDrawable;
if (drawable == null) {
drawable = Theme.getCachedWallpaperNonBlocking();
}
if (Theme.wallpaperLoadTask != null) {
invalidate();
}
if (drawable != this.backgroundDrawable && drawable != null) {
if (Theme.isAnimatingColor() || this.customAnimation) {
this.oldBackgroundDrawable = this.backgroundDrawable;
this.oldBackgroundGradientDisposable = this.backgroundGradientDisposable;
} else {
BackgroundGradientDrawable.Disposable disposable = this.backgroundGradientDisposable;
if (disposable != null) {
disposable.dispose();
this.backgroundGradientDisposable = null;
}
}
this.backgroundDrawable = drawable;
this.overrideDrawableUpdate.set(0.0f, true);
}
float themeAnimationValue = this.customAnimation ? this.overrideDrawableUpdate.set(1.0f) : this.parentLayout.getThemeAnimationValue();
int i = 0;
while (i < 2) {
Drawable drawable2 = i == 0 ? this.oldBackgroundDrawable : this.backgroundDrawable;
if (drawable2 != null) {
int i2 = (i != 1 || this.oldBackgroundDrawable == null || (this.parentLayout == null && !this.customAnimation)) ? 255 : (int) (255.0f * themeAnimationValue);
if (i2 > 0) {
drawable2.setAlpha(i2);
if ((drawable2 instanceof ColorDrawable) || (drawable2 instanceof GradientDrawable) || (drawable2 instanceof MotionBackgroundDrawable)) {
drawable2.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
if (drawable2 instanceof BackgroundGradientDrawable) {
this.backgroundGradientDisposable = ((BackgroundGradientDrawable) drawable2).drawExactBoundsSize(canvas, this);
} else {
drawable2.draw(canvas);
}
} else if (drawable2 instanceof BitmapDrawable) {
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable2;
bitmapDrawable.setFilterBitmap(true);
if (bitmapDrawable.getTileModeX() == Shader.TileMode.REPEAT) {
canvas.save();
float f = 2.0f / AndroidUtilities.density;
canvas.scale(f, f);
drawable2.setBounds(0, 0, (int) Math.ceil(getMeasuredWidth() / f), (int) Math.ceil(getMeasuredHeight() / f));
} else {
int measuredHeight = getMeasuredHeight();
float max = Math.max(getMeasuredWidth() / drawable2.getIntrinsicWidth(), measuredHeight / drawable2.getIntrinsicHeight());
int ceil = (int) Math.ceil(drawable2.getIntrinsicWidth() * max);
int ceil2 = (int) Math.ceil(drawable2.getIntrinsicHeight() * max);
int measuredWidth = (getMeasuredWidth() - ceil) / 2;
int i3 = (measuredHeight - ceil2) / 2;
canvas.save();
canvas.clipRect(0, 0, ceil, getMeasuredHeight());
drawable2.setBounds(measuredWidth, i3, ceil + measuredWidth, ceil2 + i3);
}
drawable2.draw(canvas);
canvas.restore();
} else {
StoryEntry.drawBackgroundDrawable(canvas, drawable2, getWidth(), getHeight());
}
if (i == 0 && this.oldBackgroundDrawable != null && themeAnimationValue >= 1.0f) {
BackgroundGradientDrawable.Disposable disposable2 = this.oldBackgroundGradientDisposable;
if (disposable2 != null) {
disposable2.dispose();
this.oldBackgroundGradientDisposable = null;
}
this.oldBackgroundDrawable = null;
invalidate();
}
}
}
i++;
}
this.shadowDrawable.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
this.shadowDrawable.draw(canvas);
}
public boolean allowLoadingOnTouch() {
int i = this.type;
return i == 3 || i == 0;
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
BackgroundGradientDrawable.Disposable disposable = this.backgroundGradientDisposable;
if (disposable != null) {
disposable.dispose();
this.backgroundGradientDisposable = null;
}
BackgroundGradientDrawable.Disposable disposable2 = this.oldBackgroundGradientDisposable;
if (disposable2 != null) {
disposable2.dispose();
this.oldBackgroundGradientDisposable = null;
}
Drawable drawable = this.overrideDrawable;
if (drawable instanceof ChatBackgroundDrawable) {
((ChatBackgroundDrawable) drawable).onDetachedFromWindow(this);
}
}
@Override
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
if (this.type == 2 || allowLoadingOnTouch()) {
return super.onInterceptTouchEvent(motionEvent);
}
return false;
}
@Override
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
if (this.type == 2 || allowLoadingOnTouch()) {
return super.dispatchTouchEvent(motionEvent);
}
return false;
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
if (this.type == 2 || allowLoadingOnTouch()) {
return super.onTouchEvent(motionEvent);
}
return false;
}
}