正在查看: Plus 12 v10.13.1.1 应用的 SelectAnimatedEmojiDialog.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Plus 12 v10.13.1.1 应用的 SelectAnimatedEmojiDialog.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package org.telegram.ui;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.LinearGradient;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Parcelable;
import android.os.SystemClock;
import android.text.Editable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.style.ForegroundColorSpan;
import android.util.LongSparseArray;
import android.util.SparseArray;
import android.util.SparseIntArray;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.view.animation.LinearInterpolator;
import android.view.animation.OvershootInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.core.graphics.ColorUtils;
import androidx.core.math.MathUtils;
import androidx.core.util.Consumer;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearSmoothScrollerCustom;
import androidx.recyclerview.widget.RecyclerView;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CountDownLatch;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.AnimationNotificationsLocker;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.DocumentObject;
import org.telegram.messenger.Emoji;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LiteMode;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaDataController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.SvgHelper;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.Utilities;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.RequestDelegate;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.ActionBarMenuItem;
import org.telegram.ui.ActionBar.ActionBarPopupWindow;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.BottomSheet;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Cells.FixedHeightEmptyCell;
import org.telegram.ui.Components.AlertsCreator;
import org.telegram.ui.Components.AnimatedEmojiDrawable;
import org.telegram.ui.Components.AnimatedEmojiSpan;
import org.telegram.ui.Components.AnimatedTextView;
import org.telegram.ui.Components.BackupImageView;
import org.telegram.ui.Components.CloseProgressDrawable2;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.DrawingInBackgroundThreadDrawable;
import org.telegram.ui.Components.EditTextCaption;
import org.telegram.ui.Components.EmojiPacksAlert;
import org.telegram.ui.Components.EmojiTabsStrip;
import org.telegram.ui.Components.EmojiView;
import org.telegram.ui.Components.FloatingDebug.FloatingDebugView$$ExternalSyntheticLambda3;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.Premium.PremiumButtonView;
import org.telegram.ui.Components.Premium.PremiumFeatureBottomSheet;
import org.telegram.ui.Components.Premium.PremiumLockIconView;
import org.telegram.ui.Components.RLottieImageView;
import org.telegram.ui.Components.Reactions.HwEmojis;
import org.telegram.ui.Components.Reactions.ReactionsEffectOverlay;
import org.telegram.ui.Components.Reactions.ReactionsLayoutInBubble;
import org.telegram.ui.Components.RecyclerAnimationScrollHelper;
import org.telegram.ui.Components.RecyclerListView;
import org.telegram.ui.Components.ScrollableHorizontalScrollView;
import org.telegram.ui.Components.SearchStateDrawable;
import org.telegram.ui.Components.StickerCategoriesListView;
import org.telegram.ui.SelectAnimatedEmojiDialog;
public class SelectAnimatedEmojiDialog extends FrameLayout implements NotificationCenter.NotificationCenterDelegate {
public static String[] lastSearchKeyboardLanguage;
public int accentColor;
public Adapter adapter;
public View animateExpandFromButton;
public float animateExpandFromButtonTranslate;
public int animateExpandFromPosition;
public long animateExpandStartTime;
public int animateExpandToPosition;
public boolean animationsEnabled;
public BackgroundDelegate backgroundDelegate;
public View backgroundView;
public BaseFragment baseFragment;
public AnimatedEmojiDrawable bigReactionAnimatedEmoji;
public ImageReceiver bigReactionImageReceiver;
public onLongPressedListener bigReactionListener;
public boolean bottomGradientShown;
public View bottomGradientView;
public View bubble1View;
public View bubble2View;
public EmojiTabsStrip[] cachedEmojiTabs;
public boolean cancelPressed;
public Runnable clearSearchRunnable;
public FrameLayout contentView;
public View contentViewForeground;
public final int currentAccount;
public ArrayList<AnimatedEmojiSpan> defaultStatuses;
public int defaultTopicIconRow;
public ValueAnimator dimAnimator;
public Runnable dismiss;
public boolean drawBackground;
public Rect drawableToBounds;
public EmojiListView emojiGridView;
public FrameLayout emojiGridViewContainer;
public DefaultItemAnimator emojiItemAnimator;
public FrameLayout emojiSearchEmptyView;
public BackupImageView emojiSearchEmptyViewImageView;
public EmojiListView emojiSearchGridView;
public float emojiSelectAlpha;
public ValueAnimator emojiSelectAnimator;
public Rect emojiSelectRect;
public ImageViewEmoji emojiSelectView;
public EmojiTabsStrip emojiTabs;
public View emojiTabsShadow;
public Integer emojiX;
public boolean enterAnimationInProgress;
public ArrayList<Long> expandedEmojiSets;
public boolean forUser;
public Drawable forumIconDrawable;
public ImageViewEmoji forumIconImage;
public ArrayList<TLRPC.TL_messages_stickerSet> frozenEmojiPacks;
public boolean gridSearch;
public ValueAnimator gridSwitchAnimator;
public FrameLayout gridViewContainer;
public ValueAnimator hideAnimator;
public Integer hintExpireDate;
public boolean includeEmpty;
public boolean includeHint;
public ArrayList<Long> installedEmojiSets;
public boolean isAttached;
public String lastQuery;
public GridLayoutManager layoutManager;
public Integer listStateId;
public int longtapHintRow;
public AnimationNotificationsLocker notificationsLocker;
public OvershootInterpolator overshootInterpolator;
public ArrayList<EmojiView.EmojiPack> packs;
public Paint paint;
public boolean paused;
public boolean pausedExceptSelected;
public int popularSectionRow;
public SparseIntArray positionToButton;
public SparseIntArray positionToExpand;
public SparseIntArray positionToSection;
public Drawable premiumStar;
public ColorFilter premiumStarColorFilter;
public float pressedProgress;
public ArrayList<AnimatedEmojiSpan> recent;
public EmojiPackExpand recentExpandButton;
public boolean recentExpanded;
public ArrayList<ReactionsLayoutInBubble.VisibleReaction> recentReactions;
public int recentReactionsEndRow;
public int recentReactionsSectionRow;
public int recentReactionsStartRow;
public List<ReactionsLayoutInBubble.VisibleReaction> recentReactionsToSet;
public ArrayList<TLRPC.Document> recentStickers;
public Theme.ResourcesProvider resourcesProvider;
public ArrayList<Long> rowHashCodes;
public float scaleX;
public float scaleY;
public float scrimAlpha;
public int scrimColor;
public AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable scrimDrawable;
public View scrimDrawableParent;
public RecyclerAnimationScrollHelper scrollHelper;
public SearchAdapter searchAdapter;
public SearchBox searchBox;
public ValueAnimator searchEmptyViewAnimator;
public boolean searchEmptyViewVisible;
public GridLayoutManager searchLayoutManager;
public ArrayList<ReactionsLayoutInBubble.VisibleReaction> searchResult;
public ArrayList<ReactionsLayoutInBubble.VisibleReaction> searchResultStickers;
public int searchRow;
public Runnable searchRunnable;
public ArrayList<TLRPC.Document> searchSets;
public boolean searched;
public boolean searching;
public SparseIntArray sectionToPosition;
public SelectStatusDurationDialog selectStatusDateDialog;
public HashSet<Long> selectedDocumentIds;
public ImageViewEmoji selectedReactionView;
public HashSet<ReactionsLayoutInBubble.VisibleReaction> selectedReactions;
public Paint selectorAccentPaint;
public Paint selectorPaint;
public ValueAnimator showAnimator;
public boolean showStickers;
public boolean smoothScrolling;
public ArrayList<String> standardEmojis;
public ArrayList<TLRPC.TL_messages_stickerSet> stickerSets;
public ArrayList<ReactionsLayoutInBubble.VisibleReaction> stickers;
public int stickersEndRow;
public ArrayList<TLRPC.Document> stickersSearchResult;
public int stickersSectionRow;
public int stickersStartRow;
public View topGradientView;
public int topMarginDp;
public ArrayList<ReactionsLayoutInBubble.VisibleReaction> topReactions;
public int topReactionsEndRow;
public int topReactionsStartRow;
public int topicEmojiHeaderRow;
public int totalCount;
public int type;
public final Runnable updateRows;
public final Runnable updateRowsDelayed;
public boolean useAccentForPlus;
public static final List<String> emptyViewEmojis = Arrays.asList("😖", "😫", "\u1fae0", "😨", "❓");
public static boolean[] preloaded = new boolean[UserConfig.MAX_ACCOUNT_COUNT];
public static boolean isFirstOpen = true;
public static HashMap<Integer, Parcelable> listStates = new HashMap<>();
public interface BackgroundDelegate {
void drawRect(Canvas canvas, int left, int top, int right, int bottom, float x, float y);
}
public interface onLongPressedListener {
void onLongPressed(ImageViewEmoji view);
}
public interface onRecentClearedListener {
}
public float getScrimDrawableTranslationY() {
return 0.0f;
}
public void lambda$new$3() {
}
public void onEmojiSelected(View view, Long documentId, TLRPC.Document document, Integer until) {
}
public void onInputFocus() {
}
public void onReactionClick(ImageViewEmoji emoji, ReactionsLayoutInBubble.VisibleReaction reaction) {
}
public void onSettings() {
}
public boolean prevWindowKeyboardVisible() {
return false;
}
public void setOnRecentClearedListener(onRecentClearedListener onRecentClearedListener2) {
}
@Override
public void setPressed(boolean pressed) {
}
public boolean isBottom() {
int i = this.type;
return i == 5 || i == 10 || i == 12;
}
public void setSelectedReactions(HashSet<ReactionsLayoutInBubble.VisibleReaction> selectedReactions) {
this.selectedReactions = selectedReactions;
this.selectedDocumentIds.clear();
ArrayList arrayList = new ArrayList(selectedReactions);
for (int i = 0; i < arrayList.size(); i++) {
if (arrayList.get(i) != null && ((ReactionsLayoutInBubble.VisibleReaction) arrayList.get(i)).documentId != 0) {
this.selectedDocumentIds.add(Long.valueOf(((ReactionsLayoutInBubble.VisibleReaction) arrayList.get(i)).documentId));
}
}
}
public void setSelectedReaction(ReactionsLayoutInBubble.VisibleReaction reaction) {
this.selectedReactions.clear();
this.selectedReactions.add(reaction);
if (this.emojiGridView != null) {
for (int i = 0; i < this.emojiGridView.getChildCount(); i++) {
if (this.emojiGridView.getChildAt(i) instanceof ImageViewEmoji) {
ImageViewEmoji imageViewEmoji = (ImageViewEmoji) this.emojiGridView.getChildAt(i);
imageViewEmoji.setViewSelected(this.selectedReactions.contains(imageViewEmoji.reaction), true);
}
}
this.emojiGridView.invalidate();
}
if (this.emojiSearchGridView != null) {
for (int i2 = 0; i2 < this.emojiSearchGridView.getChildCount(); i2++) {
if (this.emojiSearchGridView.getChildAt(i2) instanceof ImageViewEmoji) {
ImageViewEmoji imageViewEmoji2 = (ImageViewEmoji) this.emojiSearchGridView.getChildAt(i2);
imageViewEmoji2.setViewSelected(this.selectedReactions.contains(imageViewEmoji2.reaction), true);
}
}
this.emojiSearchGridView.invalidate();
}
}
public void setSelectedReactions(ArrayList<String> emojis) {
this.selectedReactions.clear();
Iterator<String> it = emojis.iterator();
while (it.hasNext()) {
this.selectedReactions.add(ReactionsLayoutInBubble.VisibleReaction.fromEmojicon(it.next()));
}
if (this.emojiGridView != null) {
for (int i = 0; i < this.emojiGridView.getChildCount(); i++) {
if (this.emojiGridView.getChildAt(i) instanceof ImageViewEmoji) {
ImageViewEmoji imageViewEmoji = (ImageViewEmoji) this.emojiGridView.getChildAt(i);
imageViewEmoji.setViewSelected(this.selectedReactions.contains(imageViewEmoji.reaction), true);
}
}
this.emojiGridView.invalidate();
}
}
public void setForUser(boolean forUser) {
this.forUser = forUser;
updateRows(false, false);
}
public void invalidateSearchBox() {
this.searchBox.invalidate();
}
public static class SelectAnimatedEmojiDialogWindow extends PopupWindow {
public static final ViewTreeObserver.OnScrollChangedListener NOP = new ViewTreeObserver.OnScrollChangedListener() {
@Override
public final void onScrollChanged() {
SelectAnimatedEmojiDialog.SelectAnimatedEmojiDialogWindow.lambda$static$0();
}
};
public static final Field superListenerField;
public ViewTreeObserver.OnScrollChangedListener mSuperScrollListener;
public ViewTreeObserver mViewTreeObserver;
public static void lambda$static$0() {
}
static {
Field field = null;
try {
field = PopupWindow.class.getDeclaredField("mOnScrollChangedListener");
field.setAccessible(true);
} catch (NoSuchFieldException unused) {
}
superListenerField = field;
}
public SelectAnimatedEmojiDialogWindow(View anchor, int width, int height) {
super(anchor, width, height);
init();
}
public final void init() {
setFocusable(true);
setAnimationStyle(0);
setOutsideTouchable(true);
setClippingEnabled(true);
setInputMethodMode(0);
setSoftInputMode(4);
Field field = superListenerField;
if (field != null) {
try {
this.mSuperScrollListener = (ViewTreeObserver.OnScrollChangedListener) field.get(this);
field.set(this, NOP);
} catch (Exception unused) {
this.mSuperScrollListener = null;
}
}
}
public final void unregisterListener() {
ViewTreeObserver viewTreeObserver;
if (this.mSuperScrollListener == null || (viewTreeObserver = this.mViewTreeObserver) == null) {
return;
}
if (viewTreeObserver.isAlive()) {
this.mViewTreeObserver.removeOnScrollChangedListener(this.mSuperScrollListener);
}
this.mViewTreeObserver = null;
}
public final void registerListener(View anchor) {
if (getContentView() instanceof SelectAnimatedEmojiDialog) {
((SelectAnimatedEmojiDialog) getContentView()).onShow(new Runnable() {
@Override
public final void run() {
SelectAnimatedEmojiDialog.SelectAnimatedEmojiDialogWindow.this.dismiss();
}
});
}
if (this.mSuperScrollListener != null) {
ViewTreeObserver viewTreeObserver = anchor.getWindowToken() != null ? anchor.getViewTreeObserver() : null;
ViewTreeObserver viewTreeObserver2 = this.mViewTreeObserver;
if (viewTreeObserver != viewTreeObserver2) {
if (viewTreeObserver2 != null && viewTreeObserver2.isAlive()) {
this.mViewTreeObserver.removeOnScrollChangedListener(this.mSuperScrollListener);
}
this.mViewTreeObserver = viewTreeObserver;
if (viewTreeObserver != null) {
viewTreeObserver.addOnScrollChangedListener(this.mSuperScrollListener);
}
}
}
}
public void dimBehind() {
View rootView = getContentView().getRootView();
WindowManager windowManager = (WindowManager) getContentView().getContext().getSystemService("window");
WindowManager.LayoutParams layoutParams = (WindowManager.LayoutParams) rootView.getLayoutParams();
layoutParams.flags |= 2;
layoutParams.dimAmount = 0.2f;
windowManager.updateViewLayout(rootView, layoutParams);
}
public final void dismissDim() {
View rootView = getContentView().getRootView();
WindowManager windowManager = (WindowManager) getContentView().getContext().getSystemService("window");
if (rootView.getLayoutParams() == null || !(rootView.getLayoutParams() instanceof WindowManager.LayoutParams)) {
return;
}
WindowManager.LayoutParams layoutParams = (WindowManager.LayoutParams) rootView.getLayoutParams();
try {
int i = layoutParams.flags;
if ((i & 2) != 0) {
layoutParams.flags = i & (-3);
layoutParams.dimAmount = 0.0f;
windowManager.updateViewLayout(rootView, layoutParams);
}
} catch (Exception unused) {
}
}
@Override
public void showAsDropDown(View anchor) {
super.showAsDropDown(anchor);
registerListener(anchor);
}
@Override
public void showAsDropDown(View anchor, int xoff, int yoff) {
super.showAsDropDown(anchor, xoff, yoff);
registerListener(anchor);
}
@Override
public void showAsDropDown(View anchor, int xoff, int yoff, int gravity) {
super.showAsDropDown(anchor, xoff, yoff, gravity);
registerListener(anchor);
}
@Override
public void showAtLocation(View parent, int gravity, int x, int y) {
super.showAtLocation(parent, gravity, x, y);
unregisterListener();
}
@Override
public void dismiss() {
if (getContentView() instanceof SelectAnimatedEmojiDialog) {
((SelectAnimatedEmojiDialog) getContentView()).onDismiss(new Runnable() {
@Override
public final void run() {
SelectAnimatedEmojiDialog.SelectAnimatedEmojiDialogWindow.this.lambda$dismiss$1();
}
});
dismissDim();
} else {
super.dismiss();
}
}
public void lambda$dismiss$1() {
super.dismiss();
}
}
public SelectAnimatedEmojiDialog(BaseFragment baseFragment, Context context, boolean includeEmpty, Integer emojiX, int type, Theme.ResourcesProvider resourcesProvider) {
this(baseFragment, context, includeEmpty, emojiX, type, true, resourcesProvider, 16);
}
public SelectAnimatedEmojiDialog(BaseFragment baseFragment, Context context, boolean includeEmpty, Integer emojiX, int type, boolean shouldDrawBackground, Theme.ResourcesProvider resourcesProvider, int topPaddingDp) {
this(baseFragment, context, includeEmpty, emojiX, type, shouldDrawBackground, resourcesProvider, topPaddingDp, Theme.getColor(Theme.key_windowBackgroundWhiteBlueIcon, resourcesProvider));
}
public SelectAnimatedEmojiDialog(org.telegram.ui.ActionBar.BaseFragment r34, android.content.Context r35, boolean r36, java.lang.Integer r37, final int r38, boolean r39, final org.telegram.ui.ActionBar.Theme.ResourcesProvider r40, int r41, int r42) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.SelectAnimatedEmojiDialog.<init>(org.telegram.ui.ActionBar.BaseFragment, android.content.Context, boolean, java.lang.Integer, int, boolean, org.telegram.ui.ActionBar.Theme$ResourcesProvider, int, int):void");
}
public boolean lambda$new$0(View view, MotionEvent motionEvent) {
Runnable runnable;
if (motionEvent.getAction() != 0 || (runnable = this.dismiss) == null) {
return false;
}
runnable.run();
return true;
}
public void lambda$new$1(BaseFragment baseFragment) {
search(null, false, false);
onSettings();
baseFragment.presentFragment(new StickersActivity(5, this.frozenEmojiPacks));
Runnable runnable = this.dismiss;
if (runnable != null) {
runnable.run();
}
}
public boolean lambda$new$2(View view) {
onRecentLongClick();
try {
performHapticFeedback(0, 1);
} catch (Exception unused) {
}
return true;
}
public class AnonymousClass17 implements RecyclerListView.OnItemLongClickListenerExtended {
public final Context val$context;
public final Integer val$emojiX;
public final Theme.ResourcesProvider val$resourcesProvider;
public final int val$type;
public void onMove(float f, float f2) {
RecyclerListView.OnItemLongClickListenerExtended.-CC.$default$onMove(this, f, f2);
}
public AnonymousClass17(final int val$type, final Context val$context, final Theme.ResourcesProvider val$resourcesProvider, final Integer val$emojiX) {
this.val$type = val$type;
this.val$context = val$context;
this.val$resourcesProvider = val$resourcesProvider;
this.val$emojiX = val$emojiX;
}
public boolean onItemClick(final View view, int position, float x, float y) {
int i = this.val$type;
if (i != 11 && i != 13) {
boolean z = view instanceof ImageViewEmoji;
if (z && (i == 1 || i == 8)) {
SelectAnimatedEmojiDialog.this.incrementHintUse();
SelectAnimatedEmojiDialog.this.performHapticFeedback(0);
ImageViewEmoji imageViewEmoji = (ImageViewEmoji) view;
if (!imageViewEmoji.isDefaultReaction && !UserConfig.getInstance(SelectAnimatedEmojiDialog.this.currentAccount).isPremium()) {
TLRPC.Document document = imageViewEmoji.span.document;
if (document == null) {
document = AnimatedEmojiDrawable.findDocument(SelectAnimatedEmojiDialog.this.currentAccount, imageViewEmoji.span.documentId);
}
SelectAnimatedEmojiDialog.this.onEmojiSelected(imageViewEmoji, Long.valueOf(imageViewEmoji.span.documentId), document, null);
return true;
}
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog = SelectAnimatedEmojiDialog.this;
selectAnimatedEmojiDialog.selectedReactionView = imageViewEmoji;
selectAnimatedEmojiDialog.pressedProgress = 0.0f;
selectAnimatedEmojiDialog.cancelPressed = false;
if (imageViewEmoji.isDefaultReaction) {
selectAnimatedEmojiDialog.setBigReactionAnimatedEmoji(null);
TLRPC.TL_availableReaction tL_availableReaction = (TLRPC.TL_availableReaction) MediaDataController.getInstance(SelectAnimatedEmojiDialog.this.currentAccount).getReactionsMap().get(SelectAnimatedEmojiDialog.this.selectedReactionView.reaction.emojicon);
if (tL_availableReaction != null) {
SelectAnimatedEmojiDialog.this.bigReactionImageReceiver.setImage(ImageLocation.getForDocument(tL_availableReaction.select_animation), "60_60_pcache", (ImageLocation) null, (String) null, (Drawable) null, 0L, "tgs", SelectAnimatedEmojiDialog.this.selectedReactionView.reaction, 0);
}
} else {
selectAnimatedEmojiDialog.setBigReactionAnimatedEmoji(new AnimatedEmojiDrawable(4, SelectAnimatedEmojiDialog.this.currentAccount, SelectAnimatedEmojiDialog.this.selectedReactionView.span.documentId));
}
SelectAnimatedEmojiDialog.this.emojiGridView.invalidate();
SelectAnimatedEmojiDialog.this.lambda$new$3();
return true;
}
if (z) {
ImageViewEmoji imageViewEmoji2 = (ImageViewEmoji) view;
if (imageViewEmoji2.span != null && (i == 0 || i == 12 || i == 9 || i == 10)) {
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog2 = SelectAnimatedEmojiDialog.this;
SelectStatusDurationDialog selectStatusDurationDialog = new SelectStatusDurationDialog(this.val$context, SelectAnimatedEmojiDialog.this.dismiss, SelectAnimatedEmojiDialog.this, imageViewEmoji2, this.val$resourcesProvider) {
{
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog3 = SelectAnimatedEmojiDialog.this;
}
@Override
public boolean getOutBounds(Rect rect) {
if (SelectAnimatedEmojiDialog.this.scrimDrawable == null) {
return false;
}
AnonymousClass17 anonymousClass17 = AnonymousClass17.this;
if (anonymousClass17.val$emojiX == null) {
return false;
}
rect.set(SelectAnimatedEmojiDialog.this.drawableToBounds);
return true;
}
@Override
public void onEndPartly(Integer date) {
SelectAnimatedEmojiDialog.this.incrementHintUse();
TLRPC.TL_emojiStatus tL_emojiStatus = new TLRPC.TL_emojiStatus();
View view2 = view;
long j = ((ImageViewEmoji) view2).span.documentId;
tL_emojiStatus.document_id = j;
SelectAnimatedEmojiDialog.this.onEmojiSelected(view2, Long.valueOf(j), ((ImageViewEmoji) view).span.document, date);
MediaDataController.getInstance(SelectAnimatedEmojiDialog.this.currentAccount).pushRecentEmojiStatus(tL_emojiStatus);
}
@Override
public void onEnd(Integer date) {
if (date == null || SelectAnimatedEmojiDialog.this.dismiss == null) {
return;
}
SelectAnimatedEmojiDialog.this.dismiss.run();
}
@Override
public void dismiss() {
super.dismiss();
SelectAnimatedEmojiDialog.this.selectStatusDateDialog = null;
}
};
selectAnimatedEmojiDialog2.selectStatusDateDialog = selectStatusDurationDialog;
selectStatusDurationDialog.show();
try {
view.performHapticFeedback(0, 1);
} catch (Exception unused) {
}
return true;
}
}
}
return false;
}
public void onLongClickRelease() {
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog = SelectAnimatedEmojiDialog.this;
if (selectAnimatedEmojiDialog.selectedReactionView != null) {
selectAnimatedEmojiDialog.cancelPressed = true;
ValueAnimator ofFloat = ValueAnimator.ofFloat(selectAnimatedEmojiDialog.pressedProgress, 0.0f);
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
SelectAnimatedEmojiDialog.AnonymousClass17.this.lambda$onLongClickRelease$0(valueAnimator);
}
});
ofFloat.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog2 = SelectAnimatedEmojiDialog.this;
selectAnimatedEmojiDialog2.selectedReactionView.bigReactionSelectedProgress = 0.0f;
selectAnimatedEmojiDialog2.selectedReactionView = null;
selectAnimatedEmojiDialog2.emojiGridView.invalidate();
}
});
ofFloat.setDuration(150L);
ofFloat.setInterpolator(CubicBezierInterpolator.DEFAULT);
ofFloat.start();
}
}
public void lambda$onLongClickRelease$0(ValueAnimator valueAnimator) {
SelectAnimatedEmojiDialog.this.pressedProgress = ((Float) valueAnimator.getAnimatedValue()).floatValue();
}
}
public void lambda$new$4(int i, View view, int i2) {
TLRPC.Document document;
try {
if (view instanceof ImageViewEmoji) {
ImageViewEmoji imageViewEmoji = (ImageViewEmoji) view;
if (imageViewEmoji.isDefaultReaction || i == 13 || i == 14) {
incrementHintUse();
onReactionClick(imageViewEmoji, imageViewEmoji.reaction);
} else if (imageViewEmoji.isStaticIcon && (document = imageViewEmoji.document) != null) {
onStickerClick(imageViewEmoji, document);
} else {
onEmojiClick(imageViewEmoji, imageViewEmoji.span);
}
if (i == 1 || i == 11) {
} else {
performHapticFeedback(3, 1);
}
} else if (view instanceof ImageView) {
onEmojiClick(view, null);
if (i == 1 || i == 11) {
} else {
performHapticFeedback(3, 1);
}
} else if (!(view instanceof EmojiPackExpand)) {
if (view != null) {
view.callOnClick();
}
} else {
expand(i2, (EmojiPackExpand) view);
if (i == 1 || i == 11) {
} else {
performHapticFeedback(3, 1);
}
}
} catch (Exception unused) {
}
}
public final void onStickerClick(ImageViewEmoji viewEmoji, TLRPC.Document document) {
if (this.type == 6) {
onEmojiSelected(viewEmoji, Long.valueOf(document.id), document, null);
} else {
onEmojiSelected(viewEmoji, null, document, null);
}
}
public void setExpireDateHint(int date) {
if (date <= 0) {
return;
}
this.includeHint = true;
this.hintExpireDate = Integer.valueOf(date);
updateRows(true, false);
}
public void setBigReactionAnimatedEmoji(AnimatedEmojiDrawable animatedEmojiDrawable) {
AnimatedEmojiDrawable animatedEmojiDrawable2;
if (this.isAttached && (animatedEmojiDrawable2 = this.bigReactionAnimatedEmoji) != animatedEmojiDrawable) {
if (animatedEmojiDrawable2 != null) {
animatedEmojiDrawable2.removeView(this);
}
this.bigReactionAnimatedEmoji = animatedEmojiDrawable;
if (animatedEmojiDrawable != null) {
animatedEmojiDrawable.setColorFilter(this.premiumStarColorFilter);
this.bigReactionAnimatedEmoji.addView(this);
}
}
}
public final void onRecentLongClick() {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext(), null);
builder.setTitle(LocaleController.getString("ClearRecentEmojiStatusesTitle", R.string.ClearRecentEmojiStatusesTitle));
builder.setMessage(LocaleController.getString("ClearRecentEmojiStatusesText", R.string.ClearRecentEmojiStatusesText));
builder.setPositiveButton(LocaleController.getString("Clear", R.string.Clear), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
SelectAnimatedEmojiDialog.this.lambda$onRecentLongClick$5(dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.setDimEnabled(false);
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
SelectAnimatedEmojiDialog.this.lambda$onRecentLongClick$6(dialogInterface);
}
});
builder.show();
setDim(1.0f, true);
}
public void lambda$onRecentLongClick$5(DialogInterface dialogInterface, int i) {
ConnectionsManager.getInstance(this.currentAccount).sendRequest(new TLRPC.TL_account_clearRecentEmojiStatuses(), (RequestDelegate) null);
MediaDataController.getInstance(this.currentAccount).clearRecentEmojiStatuses();
updateRows(false, true);
}
public void lambda$onRecentLongClick$6(DialogInterface dialogInterface) {
setDim(0.0f, true);
}
public final void setDim(float dim, boolean animated) {
ValueAnimator valueAnimator = this.dimAnimator;
if (valueAnimator != null) {
valueAnimator.cancel();
this.dimAnimator = null;
}
if (animated) {
ValueAnimator ofFloat = ValueAnimator.ofFloat(this.contentViewForeground.getAlpha(), dim * 0.25f);
this.dimAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
SelectAnimatedEmojiDialog.this.lambda$setDim$7(valueAnimator2);
}
});
this.dimAnimator.setDuration(200L);
this.dimAnimator.setInterpolator(CubicBezierInterpolator.DEFAULT);
this.dimAnimator.start();
return;
}
this.contentViewForeground.setAlpha(dim * 0.25f);
int blendOver = Theme.blendOver(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground, this.resourcesProvider), ColorUtils.setAlphaComponent(-16777216, (int) (dim * 255.0f * 0.25f)));
View view = this.bubble1View;
if (view != null) {
view.getBackground().setColorFilter(new PorterDuffColorFilter(blendOver, PorterDuff.Mode.MULTIPLY));
}
View view2 = this.bubble2View;
if (view2 != null) {
view2.getBackground().setColorFilter(new PorterDuffColorFilter(blendOver, PorterDuff.Mode.MULTIPLY));
}
}
public void lambda$setDim$7(ValueAnimator valueAnimator) {
View view = this.contentViewForeground;
if (view != null) {
view.setAlpha(((Float) valueAnimator.getAnimatedValue()).floatValue());
}
int blendOver = Theme.blendOver(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground, this.resourcesProvider), ColorUtils.setAlphaComponent(-16777216, (int) (((Float) valueAnimator.getAnimatedValue()).floatValue() * 255.0f)));
View view2 = this.bubble1View;
if (view2 != null) {
view2.getBackground().setColorFilter(new PorterDuffColorFilter(blendOver, PorterDuff.Mode.MULTIPLY));
}
View view3 = this.bubble2View;
if (view3 != null) {
view3.getBackground().setColorFilter(new PorterDuffColorFilter(blendOver, PorterDuff.Mode.MULTIPLY));
}
}
public final void updateTabsPosition(int i) {
if (i != -1) {
if (i <= ((this.recent.size() <= 40 || this.recentExpanded) ? (this.includeEmpty ? 1 : 0) + this.recent.size() : 40) || i <= this.recentReactions.size()) {
this.emojiTabs.select(0);
return;
}
for (int i2 = 0; i2 < this.positionToSection.size(); i2++) {
int keyAt = this.positionToSection.keyAt(i2);
int i3 = i2 - (!this.defaultStatuses.isEmpty() ? 1 : 0);
EmojiView.EmojiPack emojiPack = i3 >= 0 ? this.packs.get(i3) : null;
if (emojiPack != null) {
int size = emojiPack.expanded ? emojiPack.documents.size() : Math.min(24, emojiPack.documents.size());
if (i > keyAt && i <= keyAt + 1 + size) {
this.emojiTabs.select(i2 + 1);
return;
}
}
}
}
}
public final void updateSearchBox() {
SearchBox searchBox = this.searchBox;
if (searchBox == null) {
return;
}
if (this.searched) {
searchBox.clearAnimation();
this.searchBox.setVisibility(0);
this.searchBox.animate().translationY(0.0f).start();
} else {
if (this.emojiGridView.getChildCount() > 0) {
View childAt = this.emojiGridView.getChildAt(0);
if (this.emojiGridView.getChildAdapterPosition(childAt) == this.searchRow && "searchbox".equals(childAt.getTag())) {
this.searchBox.setVisibility(0);
this.searchBox.setTranslationY(childAt.getY());
return;
} else {
this.searchBox.setTranslationY(-AndroidUtilities.dp(52.0f));
return;
}
}
this.searchBox.setTranslationY(-AndroidUtilities.dp(52.0f));
}
}
public Drawable getPremiumStar() {
if (this.premiumStar == null) {
int i = this.type;
if (i == 5 || i == 9 || i == 10 || i == 7) {
this.premiumStar = ApplicationLoader.applicationContext.getResources().getDrawable(R.drawable.msg_filled_blocked).mutate();
} else {
this.premiumStar = ApplicationLoader.applicationContext.getResources().getDrawable(R.drawable.msg_settings_premium).mutate();
}
this.premiumStar.setColorFilter(this.premiumStarColorFilter);
}
return this.premiumStar;
}
@Override
public void dispatchDraw(Canvas canvas) {
AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable swapAnimatedEmojiDrawable = this.scrimDrawable;
if (swapAnimatedEmojiDrawable != null && this.emojiX != null) {
Rect bounds = swapAnimatedEmojiDrawable.getBounds();
View view = this.scrimDrawableParent;
float scaleY = view == null ? 1.0f : view.getScaleY();
int alpha = Build.VERSION.SDK_INT >= 19 ? this.scrimDrawable.getAlpha() : 255;
View view2 = this.scrimDrawableParent;
if (view2 == null) {
bounds.height();
} else {
view2.getHeight();
}
canvas.save();
canvas.translate(0.0f, -getTranslationY());
AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable swapAnimatedEmojiDrawable2 = this.scrimDrawable;
double d = alpha;
double pow = Math.pow(this.contentView.getAlpha(), 0.25d);
Double.isNaN(d);
double d2 = d * pow;
double d3 = this.scrimAlpha;
Double.isNaN(d3);
swapAnimatedEmojiDrawable2.setAlpha((int) (d2 * d3));
if (this.drawableToBounds == null) {
this.drawableToBounds = new Rect();
}
float f = (scaleY <= 1.0f || scaleY >= 1.5f) ? 0 : 2;
float intValue = this.emojiX.intValue() + f;
float centerY = (bounds.centerY() * (scaleY - 1.0f)) + (-(scaleY > 1.5f ? (bounds.height() * 0.81f) + 1.0f : 0.0f)) + (!isBottom() ? AndroidUtilities.dp(this.topMarginDp) : getMeasuredHeight() - (AndroidUtilities.dp(this.topMarginDp) / 2.0f)) + getScrimDrawableTranslationY();
float width = (bounds.width() * scaleY) / 2.0f;
float height = (bounds.height() * scaleY) / 2.0f;
this.drawableToBounds.set((int) (intValue - width), (int) (centerY - height), (int) (intValue + width), (int) (centerY + height));
AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable swapAnimatedEmojiDrawable3 = this.scrimDrawable;
Rect rect = this.drawableToBounds;
int i = rect.left;
Rect rect2 = this.drawableToBounds;
swapAnimatedEmojiDrawable3.setBounds(i, rect.top, (int) (i + (rect.width() / scaleY)), (int) (rect2.top + (rect2.height() / scaleY)));
Rect rect3 = this.drawableToBounds;
canvas.scale(scaleY, scaleY, rect3.left, rect3.top);
this.scrimDrawable.draw(canvas);
this.scrimDrawable.setAlpha(alpha);
this.scrimDrawable.setBounds(bounds);
canvas.restore();
}
super.dispatchDraw(canvas);
ImageViewEmoji imageViewEmoji = this.emojiSelectView;
if (imageViewEmoji == null || this.emojiSelectRect == null || imageViewEmoji.drawable == null) {
return;
}
canvas.save();
canvas.translate(0.0f, -getTranslationY());
this.emojiSelectView.drawable.setAlpha((int) (this.emojiSelectAlpha * 255.0f));
this.emojiSelectView.drawable.setBounds(this.emojiSelectRect);
this.emojiSelectView.drawable.setColorFilter(new PorterDuffColorFilter(ColorUtils.blendARGB(this.accentColor, this.scrimColor, 1.0f - this.scrimAlpha), PorterDuff.Mode.SRC_IN));
this.emojiSelectView.drawable.draw(canvas);
canvas.restore();
}
public void animateEmojiSelect(final ImageViewEmoji view, final Runnable onDone) {
if (this.emojiSelectAnimator != null || this.scrimDrawable == null) {
onDone.run();
return;
}
view.notDraw = true;
final Rect rect = new Rect();
rect.set(this.contentView.getLeft() + this.emojiGridView.getLeft() + view.getLeft(), this.contentView.getTop() + this.emojiGridView.getTop() + view.getTop(), this.contentView.getLeft() + this.emojiGridView.getLeft() + view.getRight(), this.contentView.getTop() + this.emojiGridView.getTop() + view.getBottom());
AnimatedEmojiDrawable animatedEmojiDrawable = view.drawable;
final AnimatedEmojiDrawable make = animatedEmojiDrawable instanceof AnimatedEmojiDrawable ? AnimatedEmojiDrawable.make(this.currentAccount, 7, animatedEmojiDrawable.getDocumentId()) : null;
this.emojiSelectView = view;
Rect rect2 = new Rect();
this.emojiSelectRect = rect2;
rect2.set(rect);
final boolean[] zArr = new boolean[1];
ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
this.emojiSelectAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
SelectAnimatedEmojiDialog.this.lambda$animateEmojiSelect$8(rect, view, zArr, onDone, make, valueAnimator);
}
});
this.emojiSelectAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
SelectAnimatedEmojiDialog.this.emojiSelectView = null;
SelectAnimatedEmojiDialog.this.invalidate();
boolean[] zArr2 = zArr;
if (zArr2[0]) {
return;
}
zArr2[0] = true;
onDone.run();
}
});
this.emojiSelectAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
this.emojiSelectAnimator.setDuration(260L);
this.emojiSelectAnimator.start();
}
public void lambda$animateEmojiSelect$8(Rect rect, ImageViewEmoji imageViewEmoji, boolean[] zArr, Runnable runnable, AnimatedEmojiDrawable animatedEmojiDrawable, ValueAnimator valueAnimator) {
AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable swapAnimatedEmojiDrawable;
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.scrimAlpha = 1.0f - ((floatValue * floatValue) * floatValue);
this.emojiSelectAlpha = 1.0f - ((float) Math.pow(floatValue, 10.0d));
AndroidUtilities.lerp(rect, this.drawableToBounds, floatValue, this.emojiSelectRect);
float max = Math.max(1.0f, this.overshootInterpolator.getInterpolation(MathUtils.clamp((3.0f * floatValue) - 2.0f, 0.0f, 1.0f))) * imageViewEmoji.getScaleX();
this.emojiSelectRect.set((int) (r8.centerX() - ((this.emojiSelectRect.width() / 2.0f) * max)), (int) (this.emojiSelectRect.centerY() - ((this.emojiSelectRect.height() / 2.0f) * max)), (int) (this.emojiSelectRect.centerX() + ((this.emojiSelectRect.width() / 2.0f) * max)), (int) (this.emojiSelectRect.centerY() + ((this.emojiSelectRect.height() / 2.0f) * max)));
invalidate();
if (floatValue <= 0.85f || zArr[0]) {
return;
}
zArr[0] = true;
runnable.run();
if (animatedEmojiDrawable == null || (swapAnimatedEmojiDrawable = this.scrimDrawable) == null) {
return;
}
swapAnimatedEmojiDrawable.play();
}
public final void checkScroll() {
boolean canScrollVertically = (this.gridSearch ? this.emojiSearchGridView : this.emojiGridView).canScrollVertically(1);
if (canScrollVertically != this.bottomGradientShown) {
this.bottomGradientShown = canScrollVertically;
this.bottomGradientView.animate().alpha(canScrollVertically ? 1.0f : 0.0f).setDuration(200L).start();
}
}
public final void scrollToPosition(int p, int offset) {
View findViewByPosition = this.layoutManager.findViewByPosition(p);
int findFirstVisibleItemPosition = this.layoutManager.findFirstVisibleItemPosition();
if ((findViewByPosition == null && Math.abs(p - findFirstVisibleItemPosition) > 72.0f) || !SharedConfig.animationsEnabled()) {
this.scrollHelper.setScrollDirection(this.layoutManager.findFirstVisibleItemPosition() < p ? 0 : 1);
this.scrollHelper.scrollToPosition(p, offset, false, true);
} else {
LinearSmoothScrollerCustom linearSmoothScrollerCustom = new LinearSmoothScrollerCustom(this.emojiGridView.getContext(), 2) {
public void onEnd() {
SelectAnimatedEmojiDialog.this.smoothScrolling = false;
}
public void onStart() {
SelectAnimatedEmojiDialog.this.smoothScrolling = true;
}
};
linearSmoothScrollerCustom.setTargetPosition(p);
linearSmoothScrollerCustom.setOffset(offset);
this.layoutManager.startSmoothScroll(linearSmoothScrollerCustom);
}
}
public void switchGrids(final boolean search, boolean liftUp) {
if (this.gridSearch == search) {
return;
}
this.gridSearch = search;
this.emojiGridView.setVisibility(0);
this.emojiSearchGridView.setVisibility(0);
ValueAnimator valueAnimator = this.gridSwitchAnimator;
if (valueAnimator != null) {
valueAnimator.cancel();
}
ValueAnimator valueAnimator2 = this.searchEmptyViewAnimator;
if (valueAnimator2 != null) {
valueAnimator2.cancel();
this.searchEmptyViewAnimator = null;
}
ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
this.gridSwitchAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator3) {
SelectAnimatedEmojiDialog.this.lambda$switchGrids$9(search, valueAnimator3);
}
});
this.gridSwitchAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
SelectAnimatedEmojiDialog.this.emojiSearchGridView.setVisibility(search ? 0 : 8);
SelectAnimatedEmojiDialog.this.emojiGridView.setVisibility(search ? 8 : 0);
SelectAnimatedEmojiDialog.this.gridSwitchAnimator = null;
if (!search && SelectAnimatedEmojiDialog.this.searchResult != null) {
SelectAnimatedEmojiDialog.this.searchResult.clear();
if (SelectAnimatedEmojiDialog.this.searchSets != null) {
SelectAnimatedEmojiDialog.this.searchSets.clear();
}
SelectAnimatedEmojiDialog.this.searchAdapter.updateRows(false);
}
if (search || SelectAnimatedEmojiDialog.this.searchResultStickers == null) {
return;
}
SelectAnimatedEmojiDialog.this.searchResultStickers.clear();
}
});
this.gridSwitchAnimator.setDuration(320L);
this.gridSwitchAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
this.gridSwitchAnimator.start();
((View) this.emojiGridView.getParent()).animate().translationY((this.gridSearch && liftUp) ? -AndroidUtilities.dp(36.0f) : 0.0f).setUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator3) {
SelectAnimatedEmojiDialog.this.lambda$switchGrids$10(valueAnimator3);
}
}).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(160L).start();
if (this.gridSearch && liftUp) {
this.emojiSearchGridView.setPadding(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(54.0f), AndroidUtilities.dp(5.0f), AndroidUtilities.dp(38.0f));
} else {
this.emojiSearchGridView.setPadding(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(54.0f), AndroidUtilities.dp(5.0f), AndroidUtilities.dp(38.0f));
}
checkScroll();
}
public void lambda$switchGrids$9(boolean z, ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
if (!z) {
floatValue = 1.0f - floatValue;
}
float f = 1.0f - floatValue;
this.emojiGridView.setAlpha(f);
this.emojiGridView.setTranslationY(AndroidUtilities.dp(8.0f) * floatValue);
this.emojiSearchGridView.setAlpha(floatValue);
this.emojiSearchGridView.setTranslationY(AndroidUtilities.dp(8.0f) * f);
this.emojiSearchEmptyView.setAlpha(this.emojiSearchGridView.getAlpha() * floatValue);
}
public void lambda$switchGrids$10(ValueAnimator valueAnimator) {
lambda$new$3();
}
public static void updateSearchEmptyViewImage(int currentAccount, BackupImageView imageView) {
ImageLocation forDocument;
if (imageView == null) {
return;
}
ArrayList arrayList = new ArrayList(MediaDataController.getInstance(currentAccount).getFeaturedEmojiSets());
Collections.shuffle(arrayList);
int round = (int) Math.round(Math.random() * 10.0d);
TLRPC.Document document = null;
for (int i = 0; i < arrayList.size(); i++) {
if ((arrayList.get(i) instanceof TLRPC.TL_stickerSetFullCovered) && ((TLRPC.TL_stickerSetFullCovered) arrayList.get(i)).documents != null) {
ArrayList arrayList2 = new ArrayList(((TLRPC.TL_stickerSetFullCovered) arrayList.get(i)).documents);
Collections.shuffle(arrayList2);
int i2 = 0;
while (true) {
if (i2 >= arrayList2.size()) {
break;
}
TLRPC.Document document2 = (TLRPC.Document) arrayList2.get(i2);
if (document2 != null && emptyViewEmojis.contains(MessageObject.findAnimatedEmojiEmoticon(document2, (String) null))) {
int i3 = round - 1;
if (round <= 0) {
round = i3;
document = document2;
break;
} else {
round = i3;
document = document2;
}
}
i2++;
}
}
if (document != null && round <= 0) {
break;
}
}
if (document == null || round > 0) {
ArrayList arrayList3 = new ArrayList(MediaDataController.getInstance(currentAccount).getStickerSets(5));
Collections.shuffle(arrayList3);
for (int i4 = 0; i4 < arrayList3.size(); i4++) {
if (arrayList3.get(i4) != null && ((TLRPC.messages_StickerSet) ((TLRPC.TL_messages_stickerSet) arrayList3.get(i4))).documents != null) {
ArrayList arrayList4 = new ArrayList(((TLRPC.messages_StickerSet) ((TLRPC.TL_messages_stickerSet) arrayList3.get(i4))).documents);
Collections.shuffle(arrayList4);
int i5 = 0;
while (true) {
if (i5 >= arrayList4.size()) {
break;
}
TLRPC.Document document3 = (TLRPC.Document) arrayList4.get(i5);
if (document3 != null && emptyViewEmojis.contains(MessageObject.findAnimatedEmojiEmoticon(document3, (String) null))) {
int i6 = round - 1;
if (round <= 0) {
round = i6;
document = document3;
break;
} else {
round = i6;
document = document3;
}
}
i5++;
}
}
if (document != null && round <= 0) {
break;
}
}
}
TLRPC.Document document4 = document;
if (document4 != null) {
String str = "36_36";
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(document4.thumbs, Theme.key_windowBackgroundWhiteGrayIcon, 0.2f);
TLRPC.PhotoSize closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(document4.thumbs, 90);
if ("video/webm".equals(document4.mime_type)) {
forDocument = ImageLocation.getForDocument(document4);
str = "36_36_g";
if (svgThumb != null) {
svgThumb.overrideWidthAndHeight(512, 512);
}
} else {
if (svgThumb != null && MessageObject.isAnimatedStickerDocument(document4, false)) {
svgThumb.overrideWidthAndHeight(512, 512);
}
forDocument = ImageLocation.getForDocument(document4);
}
String str2 = str;
ImageLocation imageLocation = forDocument;
imageView.setLayerNum(7);
imageView.setRoundRadius(AndroidUtilities.dp(4.0f));
imageView.setImage(imageLocation, str2, ImageLocation.getForDocument(closestPhotoSizeWithSize, document4), "36_36", svgThumb, document4);
}
}
public void switchSearchEmptyView(final boolean empty) {
if (this.searchEmptyViewVisible == empty) {
return;
}
this.searchEmptyViewVisible = empty;
ValueAnimator valueAnimator = this.searchEmptyViewAnimator;
if (valueAnimator != null) {
valueAnimator.cancel();
}
ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
this.searchEmptyViewAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
SelectAnimatedEmojiDialog.this.lambda$switchSearchEmptyView$11(empty, valueAnimator2);
}
});
this.searchEmptyViewAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog = SelectAnimatedEmojiDialog.this;
selectAnimatedEmojiDialog.emojiSearchEmptyView.setVisibility((empty && selectAnimatedEmojiDialog.emojiSearchGridView.getVisibility() == 0) ? 0 : 8);
SelectAnimatedEmojiDialog.this.searchEmptyViewAnimator = null;
}
});
this.searchEmptyViewAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
this.searchEmptyViewAnimator.setDuration(100L);
this.searchEmptyViewAnimator.start();
if (empty) {
updateSearchEmptyViewImage(this.currentAccount, this.emojiSearchEmptyViewImageView);
}
}
public void lambda$switchSearchEmptyView$11(boolean z, ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
if (!z) {
floatValue = 1.0f - floatValue;
}
this.emojiSearchEmptyView.setAlpha(this.emojiSearchGridView.getAlpha() * floatValue);
}
public void search(String query) {
search(query, true, true);
}
public void setPaused(boolean paused, boolean exceptSelected) {
if (this.paused == paused) {
return;
}
this.paused = paused;
this.pausedExceptSelected = exceptSelected;
EmojiListView emojiListView = this.emojiGridView;
if (emojiListView != null) {
emojiListView.invalidate();
}
EmojiListView emojiListView2 = this.emojiSearchGridView;
if (emojiListView2 != null) {
emojiListView2.invalidate();
}
}
public void search(final String query, final boolean liftUp, boolean delay) {
Runnable runnable = this.clearSearchRunnable;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
this.clearSearchRunnable = null;
}
Runnable runnable2 = this.searchRunnable;
if (runnable2 != null) {
AndroidUtilities.cancelRunOnUIThread(runnable2);
this.searchRunnable = null;
}
if (TextUtils.isEmpty(query)) {
this.searching = false;
this.searched = false;
switchGrids(false, liftUp);
SearchBox searchBox = this.searchBox;
if (searchBox != null) {
searchBox.showProgress(false);
this.searchBox.toggleClear(false);
}
this.searchAdapter.updateRows(true);
this.lastQuery = null;
} else {
final boolean z = !this.searching;
this.searching = true;
this.searched = false;
SearchBox searchBox2 = this.searchBox;
if (searchBox2 != null) {
searchBox2.showProgress(true);
}
if (z) {
ArrayList<ReactionsLayoutInBubble.VisibleReaction> arrayList = this.searchResult;
if (arrayList != null) {
arrayList.clear();
}
ArrayList<ReactionsLayoutInBubble.VisibleReaction> arrayList2 = this.searchResultStickers;
if (arrayList2 != null) {
arrayList2.clear();
}
ArrayList<TLRPC.Document> arrayList3 = this.searchSets;
if (arrayList3 != null) {
arrayList3.clear();
}
this.searchAdapter.updateRows(false);
} else if (!query.equals(this.lastQuery)) {
Runnable runnable3 = new Runnable() {
@Override
public final void run() {
SelectAnimatedEmojiDialog.this.lambda$search$12();
}
};
this.clearSearchRunnable = runnable3;
AndroidUtilities.runOnUIThread(runnable3, 120L);
}
this.lastQuery = query;
String[] currentKeyboardLanguage = AndroidUtilities.getCurrentKeyboardLanguage();
if (!Arrays.equals(currentKeyboardLanguage, lastSearchKeyboardLanguage)) {
MediaDataController.getInstance(this.currentAccount).fetchNewEmojiKeywords(currentKeyboardLanguage);
}
lastSearchKeyboardLanguage = currentKeyboardLanguage;
Runnable runnable4 = new Runnable() {
@Override
public final void run() {
SelectAnimatedEmojiDialog.this.lambda$search$29(query, liftUp, z);
}
};
this.searchRunnable = runnable4;
AndroidUtilities.runOnUIThread(runnable4, delay ? 425L : 0L);
SearchBox searchBox3 = this.searchBox;
if (searchBox3 != null) {
searchBox3.showProgress(true);
this.searchBox.toggleClear(liftUp);
}
}
updateSearchBox();
}
public void lambda$search$12() {
ArrayList<ReactionsLayoutInBubble.VisibleReaction> arrayList = this.searchResult;
if (arrayList != null) {
arrayList.clear();
}
ArrayList<ReactionsLayoutInBubble.VisibleReaction> arrayList2 = this.searchResultStickers;
if (arrayList2 != null) {
arrayList2.clear();
}
ArrayList<TLRPC.Document> arrayList3 = this.searchSets;
if (arrayList3 != null) {
arrayList3.clear();
}
this.searchAdapter.updateRows(true);
}
public void lambda$search$29(final String str, final boolean z, final boolean z2) {
Utilities.Callback callback;
final LinkedHashSet linkedHashSet = new LinkedHashSet();
final LinkedHashSet linkedHashSet2 = new LinkedHashSet();
final HashMap reactionsMap = MediaDataController.getInstance(this.currentAccount).getReactionsMap();
final ArrayList arrayList = new ArrayList();
final ArrayList arrayList2 = new ArrayList();
final boolean fullyConsistsOfEmojis = Emoji.fullyConsistsOfEmojis(str);
final ArrayList arrayList3 = new ArrayList();
final HashMap hashMap = new HashMap();
final ArrayList arrayList4 = new ArrayList();
Utilities.Callback callback2 = new Utilities.Callback() {
public final void run(Object obj) {
SelectAnimatedEmojiDialog.this.lambda$search$14(str, z, arrayList, reactionsMap, arrayList2, linkedHashSet, linkedHashSet2, arrayList4, arrayList3, z2, (Runnable) obj);
}
};
int i = this.type;
if (i == 13) {
Utilities.doCallbacks(new Utilities.Callback[]{new Utilities.Callback() {
public final void run(Object obj) {
SelectAnimatedEmojiDialog.this.lambda$search$16(str, linkedHashSet2, (Runnable) obj);
}
}, callback2});
return;
}
if (i == 14) {
if (fullyConsistsOfEmojis) {
callback = new Utilities.Callback() {
public final void run(Object obj) {
SelectAnimatedEmojiDialog.this.lambda$search$17(str, arrayList2, arrayList, (Runnable) obj);
}
};
} else {
callback = new Utilities.Callback() {
public final void run(Object obj) {
SelectAnimatedEmojiDialog.this.lambda$search$19(str, arrayList2, arrayList, (Runnable) obj);
}
};
}
Utilities.doCallbacks(new Utilities.Callback[]{callback, callback2});
return;
}
Utilities.doCallbacks(new Utilities.Callback[]{new Utilities.Callback() {
public final void run(Object obj) {
SelectAnimatedEmojiDialog.lambda$search$21(fullyConsistsOfEmojis, str, linkedHashSet, (Runnable) obj);
}
}, new Utilities.Callback() {
public final void run(Object obj) {
SelectAnimatedEmojiDialog.this.lambda$search$23(str, linkedHashSet, (Runnable) obj);
}
}, new Utilities.Callback() {
public final void run(Object obj) {
SelectAnimatedEmojiDialog.this.lambda$search$25(fullyConsistsOfEmojis, linkedHashSet, str, reactionsMap, arrayList, (Runnable) obj);
}
}, new Utilities.Callback() {
public final void run(Object obj) {
SelectAnimatedEmojiDialog.this.lambda$search$27(str, arrayList3, hashMap, (Runnable) obj);
}
}, new Utilities.Callback() {
public final void run(Object obj) {
SelectAnimatedEmojiDialog.this.lambda$search$28(str, arrayList4, (Runnable) obj);
}
}, callback2});
}
public void lambda$search$14(final String str, final boolean z, final ArrayList arrayList, final HashMap hashMap, final ArrayList arrayList2, final LinkedHashSet linkedHashSet, final LinkedHashSet linkedHashSet2, final ArrayList arrayList3, final ArrayList arrayList4, final boolean z2, Runnable runnable) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
SelectAnimatedEmojiDialog.this.lambda$search$13(str, z, arrayList, hashMap, arrayList2, linkedHashSet, linkedHashSet2, arrayList3, arrayList4, z2);
}
});
}
public void lambda$search$13(String str, boolean z, ArrayList arrayList, HashMap hashMap, ArrayList arrayList2, LinkedHashSet linkedHashSet, LinkedHashSet linkedHashSet2, ArrayList arrayList3, ArrayList arrayList4, boolean z2) {
Runnable runnable = this.clearSearchRunnable;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
this.clearSearchRunnable = null;
}
if (str != this.lastQuery) {
return;
}
this.searched = true;
switchGrids(true, z);
SearchBox searchBox = this.searchBox;
if (searchBox != null) {
searchBox.showProgress(false);
}
ArrayList<ReactionsLayoutInBubble.VisibleReaction> arrayList5 = this.searchResult;
if (arrayList5 == null) {
this.searchResult = new ArrayList<>();
} else {
arrayList5.clear();
}
ArrayList<TLRPC.Document> arrayList6 = this.searchSets;
if (arrayList6 == null) {
this.searchSets = new ArrayList<>();
} else {
arrayList6.clear();
}
ArrayList<TLRPC.Document> arrayList7 = this.stickersSearchResult;
if (arrayList7 == null) {
this.stickersSearchResult = new ArrayList<>();
} else {
arrayList7.clear();
}
ArrayList<ReactionsLayoutInBubble.VisibleReaction> arrayList8 = this.searchResultStickers;
if (arrayList8 == null) {
this.searchResultStickers = new ArrayList<>();
} else {
arrayList8.clear();
}
this.emojiSearchGridView.scrollToPosition(0);
int i = this.type;
if (i == 1 || i == 14 || i == 11 || i == 2) {
if (!arrayList.isEmpty()) {
this.searchResult.addAll(arrayList);
} else {
TLRPC.TL_availableReaction tL_availableReaction = (TLRPC.TL_availableReaction) hashMap.get(str);
if (tL_availableReaction != null) {
this.searchResult.add(ReactionsLayoutInBubble.VisibleReaction.fromEmojicon(tL_availableReaction));
}
}
if (!arrayList2.isEmpty()) {
this.searchResultStickers.addAll(arrayList2);
}
}
Iterator it = linkedHashSet.iterator();
while (it.hasNext()) {
this.searchResult.add(ReactionsLayoutInBubble.VisibleReaction.fromCustomEmoji(Long.valueOf(((Long) it.next()).longValue())));
}
Iterator it2 = linkedHashSet2.iterator();
while (it2.hasNext()) {
this.searchResult.add(ReactionsLayoutInBubble.VisibleReaction.fromEmojicon((String) it2.next()));
}
this.searchSets.addAll(arrayList3);
Iterator it3 = arrayList4.iterator();
while (it3.hasNext()) {
this.stickersSearchResult.addAll((ArrayList) it3.next());
}
this.searchAdapter.updateRows(!z2);
}
public void lambda$search$16(String str, final LinkedHashSet linkedHashSet, final Runnable runnable) {
MediaDataController.getInstance(this.currentAccount).getEmojiSuggestions(lastSearchKeyboardLanguage, str, false, new MediaDataController.KeywordResultCallback() {
public final void run(ArrayList arrayList, String str2) {
SelectAnimatedEmojiDialog.lambda$search$15(linkedHashSet, runnable, arrayList, str2);
}
}, (CountDownLatch) null, false, false, false, 0);
}
public static void lambda$search$15(LinkedHashSet linkedHashSet, Runnable runnable, ArrayList arrayList, String str) {
for (int i = 0; i < arrayList.size(); i++) {
try {
if (!((MediaDataController.KeywordResult) arrayList.get(i)).emoji.startsWith("animated_")) {
String fixEmoji = Emoji.fixEmoji(((MediaDataController.KeywordResult) arrayList.get(i)).emoji);
if (Emoji.getEmojiDrawable(fixEmoji) != null) {
linkedHashSet.add(fixEmoji);
}
}
} catch (Exception unused) {
}
}
runnable.run();
}
public void lambda$search$17(String str, ArrayList arrayList, ArrayList arrayList2, Runnable runnable) {
TLRPC.messages_AvailableEffects availableEffects = MessagesController.getInstance(this.currentAccount).getAvailableEffects();
if (availableEffects != null) {
for (int i = 0; i < availableEffects.effects.size(); i++) {
try {
TLRPC.TL_availableEffect tL_availableEffect = (TLRPC.TL_availableEffect) availableEffects.effects.get(i);
if (str.contains(tL_availableEffect.emoticon)) {
((tL_availableEffect.effect_animation_id > 0L ? 1 : (tL_availableEffect.effect_animation_id == 0L ? 0 : -1)) == 0 ? arrayList : arrayList2).add(ReactionsLayoutInBubble.VisibleReaction.fromTL(tL_availableEffect));
}
} catch (Exception unused) {
}
}
}
runnable.run();
}
public void lambda$search$19(String str, final ArrayList arrayList, final ArrayList arrayList2, final Runnable runnable) {
MediaDataController.getInstance(this.currentAccount).getEmojiSuggestions(lastSearchKeyboardLanguage, str, false, new MediaDataController.KeywordResultCallback() {
public final void run(ArrayList arrayList3, String str2) {
SelectAnimatedEmojiDialog.this.lambda$search$18(arrayList, arrayList2, runnable, arrayList3, str2);
}
}, (CountDownLatch) null, false, false, false, 0);
}
public void lambda$search$18(ArrayList arrayList, ArrayList arrayList2, Runnable runnable, ArrayList arrayList3, String str) {
TLRPC.messages_AvailableEffects availableEffects = MessagesController.getInstance(this.currentAccount).getAvailableEffects();
HashSet hashSet = new HashSet();
if (availableEffects != null) {
for (int i = 0; i < arrayList3.size(); i++) {
try {
if (!((MediaDataController.KeywordResult) arrayList3.get(i)).emoji.startsWith("animated_")) {
String fixEmoji = Emoji.fixEmoji(((MediaDataController.KeywordResult) arrayList3.get(i)).emoji);
for (int i2 = 0; i2 < availableEffects.effects.size(); i2++) {
TLRPC.TL_availableEffect tL_availableEffect = (TLRPC.TL_availableEffect) availableEffects.effects.get(i2);
if (!hashSet.contains(Long.valueOf(tL_availableEffect.id)) && (tL_availableEffect.emoticon.contains(fixEmoji) || fixEmoji.contains(tL_availableEffect.emoticon))) {
((tL_availableEffect.effect_animation_id > 0L ? 1 : (tL_availableEffect.effect_animation_id == 0L ? 0 : -1)) == 0 ? arrayList : arrayList2).add(ReactionsLayoutInBubble.VisibleReaction.fromTL(tL_availableEffect));
hashSet.add(Long.valueOf(tL_availableEffect.id));
}
}
}
} catch (Exception unused) {
}
}
}
runnable.run();
}
public static void lambda$search$21(boolean z, String str, final LinkedHashSet linkedHashSet, final Runnable runnable) {
if (z) {
StickerCategoriesListView.search.fetch(UserConfig.selectedAccount, str, new Utilities.Callback() {
public final void run(Object obj) {
SelectAnimatedEmojiDialog.lambda$search$20(linkedHashSet, runnable, (TLRPC.TL_emojiList) obj);
}
});
} else {
runnable.run();
}
}
public static void lambda$search$20(LinkedHashSet linkedHashSet, Runnable runnable, TLRPC.TL_emojiList tL_emojiList) {
if (tL_emojiList != null) {
linkedHashSet.addAll(tL_emojiList.document_id);
}
runnable.run();
}
public void lambda$search$23(String str, final LinkedHashSet linkedHashSet, final Runnable runnable) {
MediaDataController.getInstance(this.currentAccount).getAnimatedEmojiByKeywords(str, new Utilities.Callback() {
public final void run(Object obj) {
SelectAnimatedEmojiDialog.lambda$search$22(linkedHashSet, runnable, (ArrayList) obj);
}
});
}
public static void lambda$search$22(LinkedHashSet linkedHashSet, Runnable runnable, ArrayList arrayList) {
if (arrayList != null) {
linkedHashSet.addAll(arrayList);
}
runnable.run();
}
public void lambda$search$25(boolean z, final LinkedHashSet linkedHashSet, String str, final HashMap hashMap, final ArrayList arrayList, final Runnable runnable) {
ArrayList arrayList2;
ArrayList arrayList3;
if (z) {
ArrayList stickerSets = MediaDataController.getInstance(this.currentAccount).getStickerSets(5);
for (int i = 0; i < stickerSets.size(); i++) {
if (((TLRPC.messages_StickerSet) ((TLRPC.TL_messages_stickerSet) stickerSets.get(i))).documents != null && (arrayList3 = ((TLRPC.messages_StickerSet) ((TLRPC.TL_messages_stickerSet) stickerSets.get(i))).documents) != null) {
for (int i2 = 0; i2 < arrayList3.size(); i2++) {
String findAnimatedEmojiEmoticon = MessageObject.findAnimatedEmojiEmoticon((TLRPC.Document) arrayList3.get(i2), (String) null);
long j = ((TLRPC.Document) arrayList3.get(i2)).id;
if (findAnimatedEmojiEmoticon != null && !linkedHashSet.contains(Long.valueOf(j)) && str.contains(findAnimatedEmojiEmoticon.toLowerCase())) {
linkedHashSet.add(Long.valueOf(j));
}
}
}
}
ArrayList featuredEmojiSets = MediaDataController.getInstance(this.currentAccount).getFeaturedEmojiSets();
for (int i3 = 0; i3 < featuredEmojiSets.size(); i3++) {
if ((featuredEmojiSets.get(i3) instanceof TLRPC.TL_stickerSetFullCovered) && ((TLRPC.TL_stickerSetFullCovered) featuredEmojiSets.get(i3)).keywords != null && (arrayList2 = ((TLRPC.TL_stickerSetFullCovered) featuredEmojiSets.get(i3)).documents) != null) {
for (int i4 = 0; i4 < arrayList2.size(); i4++) {
String findAnimatedEmojiEmoticon2 = MessageObject.findAnimatedEmojiEmoticon((TLRPC.Document) arrayList2.get(i4), (String) null);
long j2 = ((TLRPC.Document) arrayList2.get(i4)).id;
if (findAnimatedEmojiEmoticon2 != null && !linkedHashSet.contains(Long.valueOf(j2)) && str.contains(findAnimatedEmojiEmoticon2)) {
linkedHashSet.add(Long.valueOf(j2));
}
}
}
}
runnable.run();
return;
}
MediaDataController.getInstance(this.currentAccount).getEmojiSuggestions(lastSearchKeyboardLanguage, str, false, new MediaDataController.KeywordResultCallback() {
public final void run(ArrayList arrayList4, String str2) {
SelectAnimatedEmojiDialog.this.lambda$search$24(linkedHashSet, hashMap, arrayList, runnable, arrayList4, str2);
}
}, (CountDownLatch) null, true, this.type == 3, false, 30);
}
public void lambda$search$24(LinkedHashSet linkedHashSet, HashMap hashMap, ArrayList arrayList, Runnable runnable, ArrayList arrayList2, String str) {
TLRPC.TL_availableReaction tL_availableReaction;
for (int i = 0; i < arrayList2.size(); i++) {
try {
if (((MediaDataController.KeywordResult) arrayList2.get(i)).emoji.startsWith("animated_")) {
linkedHashSet.add(Long.valueOf(Long.parseLong(((MediaDataController.KeywordResult) arrayList2.get(i)).emoji.substring(9))));
} else {
int i2 = this.type;
if ((i2 == 1 || i2 == 11 || i2 == 2) && (tL_availableReaction = (TLRPC.TL_availableReaction) hashMap.get(((MediaDataController.KeywordResult) arrayList2.get(i)).emoji)) != null) {
arrayList.add(ReactionsLayoutInBubble.VisibleReaction.fromEmojicon(tL_availableReaction));
}
}
} catch (Exception unused) {
}
}
runnable.run();
}
public void lambda$search$27(java.lang.String r15, final java.util.ArrayList r16, final java.util.HashMap r17, final java.lang.Runnable r18) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.SelectAnimatedEmojiDialog.lambda$search$27(java.lang.String, java.util.ArrayList, java.util.HashMap, java.lang.Runnable):void");
}
public static void lambda$search$26(HashMap hashMap, HashMap hashMap2, ArrayList arrayList, Runnable runnable, ArrayList arrayList2, String str) {
int size = arrayList2.size();
for (int i = 0; i < size; i++) {
String str2 = ((MediaDataController.KeywordResult) arrayList2.get(i)).emoji;
ArrayList arrayList3 = hashMap != null ? (ArrayList) hashMap.get(str2) : null;
if (arrayList3 != null && !arrayList3.isEmpty() && !hashMap2.containsKey(arrayList3)) {
hashMap2.put(arrayList3, str2);
arrayList.add(arrayList3);
}
}
runnable.run();
}
public void lambda$search$28(String str, ArrayList arrayList, Runnable runnable) {
TLRPC.StickerSet stickerSet;
TLRPC.StickerSet stickerSet2;
ArrayList stickerSets = MediaDataController.getInstance(this.currentAccount).getStickerSets(5);
HashSet hashSet = new HashSet();
String translitSafe = AndroidUtilities.translitSafe(str);
String str2 = " " + translitSafe;
if (stickerSets != null) {
for (int i = 0; i < stickerSets.size(); i++) {
TLRPC.TL_messages_stickerSet tL_messages_stickerSet = (TLRPC.TL_messages_stickerSet) stickerSets.get(i);
if (tL_messages_stickerSet != null && (stickerSet2 = ((TLRPC.messages_StickerSet) tL_messages_stickerSet).set) != null && stickerSet2.title != null && ((TLRPC.messages_StickerSet) tL_messages_stickerSet).documents != null && !hashSet.contains(Long.valueOf(stickerSet2.id))) {
String translitSafe2 = AndroidUtilities.translitSafe(((TLRPC.messages_StickerSet) tL_messages_stickerSet).set.title);
if (translitSafe2.startsWith(translitSafe) || translitSafe2.contains(str2)) {
arrayList.add(new SetTitleDocument(translitSafe2));
arrayList.addAll(((TLRPC.messages_StickerSet) tL_messages_stickerSet).documents);
hashSet.add(Long.valueOf(((TLRPC.messages_StickerSet) tL_messages_stickerSet).set.id));
}
}
}
}
ArrayList featuredEmojiSets = MediaDataController.getInstance(this.currentAccount).getFeaturedEmojiSets();
if (featuredEmojiSets != null) {
for (int i2 = 0; i2 < featuredEmojiSets.size(); i2++) {
TLRPC.TL_stickerSetFullCovered tL_stickerSetFullCovered = (TLRPC.StickerSetCovered) featuredEmojiSets.get(i2);
if (tL_stickerSetFullCovered != null && (stickerSet = ((TLRPC.StickerSetCovered) tL_stickerSetFullCovered).set) != null && stickerSet.title != null && !hashSet.contains(Long.valueOf(stickerSet.id))) {
String translitSafe3 = AndroidUtilities.translitSafe(((TLRPC.StickerSetCovered) tL_stickerSetFullCovered).set.title);
if (translitSafe3.startsWith(translitSafe) || translitSafe3.contains(str2)) {
ArrayList arrayList2 = null;
if (tL_stickerSetFullCovered instanceof TLRPC.TL_stickerSetNoCovered) {
TLRPC.TL_messages_stickerSet stickerSet3 = MediaDataController.getInstance(this.currentAccount).getStickerSet(MediaDataController.getInputStickerSet(((TLRPC.StickerSetCovered) tL_stickerSetFullCovered).set), Integer.valueOf(((TLRPC.StickerSetCovered) tL_stickerSetFullCovered).set.hash), true);
if (stickerSet3 != null) {
arrayList2 = ((TLRPC.messages_StickerSet) stickerSet3).documents;
}
} else if (tL_stickerSetFullCovered instanceof TLRPC.TL_stickerSetFullCovered) {
arrayList2 = tL_stickerSetFullCovered.documents;
} else {
arrayList2 = ((TLRPC.StickerSetCovered) tL_stickerSetFullCovered).covers;
}
if (arrayList2 != null && arrayList2.size() != 0) {
arrayList.add(new SetTitleDocument(((TLRPC.StickerSetCovered) tL_stickerSetFullCovered).set.title));
arrayList.addAll(arrayList2);
hashSet.add(Long.valueOf(((TLRPC.StickerSetCovered) tL_stickerSetFullCovered).set.id));
}
}
}
}
}
runnable.run();
}
public static TLRPC.Document findSticker(TLRPC.TL_messages_stickerSet set, String emoji) {
long j;
if (set == null) {
return null;
}
String fixEmoji = Emoji.fixEmoji(emoji);
int i = 0;
while (true) {
if (i >= ((TLRPC.messages_StickerSet) set).packs.size()) {
j = 0;
break;
}
if (!((TLRPC.TL_stickerPack) ((TLRPC.messages_StickerSet) set).packs.get(i)).documents.isEmpty() && TextUtils.equals(Emoji.fixEmoji(((TLRPC.TL_stickerPack) ((TLRPC.messages_StickerSet) set).packs.get(i)).emoticon), fixEmoji)) {
j = ((Long) ((TLRPC.TL_stickerPack) ((TLRPC.messages_StickerSet) set).packs.get(i)).documents.get(0)).longValue();
break;
}
i++;
}
if (j == 0) {
return null;
}
for (int i2 = 0; i2 < ((TLRPC.messages_StickerSet) set).documents.size(); i2++) {
TLRPC.Document document = (TLRPC.Document) ((TLRPC.messages_StickerSet) set).documents.get(i2);
if (document.id == j) {
return document;
}
}
return null;
}
public class SearchAdapter extends RecyclerListView.SelectionAdapter {
public int count;
public int emojiHeaderRow;
public int emojiStartRow;
public ArrayList<Integer> rowHashCodes;
public int setsStartRow;
public int stickersHeaderRow;
public int stickersStartRow;
public SearchAdapter() {
this.emojiHeaderRow = -1;
this.stickersHeaderRow = -1;
this.count = 1;
this.rowHashCodes = new ArrayList<>();
}
public boolean isEnabled(RecyclerView.ViewHolder holder) {
return holder.getItemViewType() == 3 || holder.getItemViewType() == 4;
}
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View imageViewEmoji;
if (viewType == 6) {
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog = SelectAnimatedEmojiDialog.this;
imageViewEmoji = selectAnimatedEmojiDialog.new HeaderView(selectAnimatedEmojiDialog.getContext(), SelectAnimatedEmojiDialog.this.type == 6);
} else if (viewType == 7) {
imageViewEmoji = new View(this, SelectAnimatedEmojiDialog.this.getContext()) {
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(52.0f), 1073741824));
}
};
imageViewEmoji.setTag("searchbox");
} else {
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog2 = SelectAnimatedEmojiDialog.this;
imageViewEmoji = selectAnimatedEmojiDialog2.new ImageViewEmoji(selectAnimatedEmojiDialog2.getContext());
}
if (SelectAnimatedEmojiDialog.this.enterAnimationInProgress()) {
imageViewEmoji.setScaleX(0.0f);
imageViewEmoji.setScaleY(0.0f);
}
return new RecyclerListView.Holder(imageViewEmoji);
}
public boolean isSticker(int position) {
int i;
if (SelectAnimatedEmojiDialog.this.type == 14) {
return SelectAnimatedEmojiDialog.this.searchResultStickers != null && position >= (i = this.stickersStartRow) && position - i < SelectAnimatedEmojiDialog.this.searchResultStickers.size();
}
int i2 = this.stickersStartRow;
return position > i2 && (position - i2) - 1 < SelectAnimatedEmojiDialog.this.stickersSearchResult.size();
}
public int getItemViewType(int position) {
int i;
if (position == this.emojiHeaderRow || position == this.stickersHeaderRow) {
return 6;
}
if (SelectAnimatedEmojiDialog.this.type == 14) {
if (SelectAnimatedEmojiDialog.this.searchResultStickers != null && position >= (i = this.stickersStartRow) && position - i < SelectAnimatedEmojiDialog.this.searchResultStickers.size()) {
return 4;
}
} else {
if (position > this.stickersStartRow && (position - r0) - 1 < SelectAnimatedEmojiDialog.this.stickersSearchResult.size()) {
return 5;
}
}
if (SelectAnimatedEmojiDialog.this.searchResult == null) {
return 3;
}
if (position > this.emojiStartRow && (position - r0) - 1 < SelectAnimatedEmojiDialog.this.searchResult.size() && (SelectAnimatedEmojiDialog.this.type == 13 || ((ReactionsLayoutInBubble.VisibleReaction) SelectAnimatedEmojiDialog.this.searchResult.get((position - this.emojiStartRow) - 1)).documentId != 0)) {
return 3;
}
int i2 = this.setsStartRow;
if (position - i2 < 0 || position - i2 >= SelectAnimatedEmojiDialog.this.searchSets.size()) {
return 4;
}
return SelectAnimatedEmojiDialog.this.searchSets.get(position - this.setsStartRow) instanceof SetTitleDocument ? 6 : 3;
}
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
TLRPC.Document document;
Long l;
boolean contains;
int i;
ReactionsLayoutInBubble.VisibleReaction visibleReaction;
if (holder.getItemViewType() == 6) {
HeaderView headerView = (HeaderView) holder.itemView;
if (SelectAnimatedEmojiDialog.this.searchSets != null) {
int i2 = this.setsStartRow;
if (position - i2 >= 0 && position - i2 < SelectAnimatedEmojiDialog.this.searchSets.size()) {
TLRPC.Document document2 = (TLRPC.Document) SelectAnimatedEmojiDialog.this.searchSets.get(position - this.setsStartRow);
if (document2 instanceof SetTitleDocument) {
headerView.setText(((SetTitleDocument) document2).title, SelectAnimatedEmojiDialog.this.lastQuery, false);
}
headerView.closeIcon.setVisibility(8);
return;
}
}
if (position == this.emojiHeaderRow) {
headerView.setText(LocaleController.getString("Emoji", R.string.Emoji), false);
} else if (SelectAnimatedEmojiDialog.this.type == 14) {
headerView.setText(LocaleController.getString(R.string.StickerEffects), false);
} else {
headerView.setText(LocaleController.getString(R.string.AccDescrStickers), false);
}
headerView.closeIcon.setVisibility(8);
return;
}
if (holder.getItemViewType() == 5) {
TLRPC.Document document3 = (TLRPC.Document) SelectAnimatedEmojiDialog.this.stickersSearchResult.get((position - this.stickersStartRow) - 1);
ImageViewEmoji imageViewEmoji = (ImageViewEmoji) holder.itemView;
imageViewEmoji.createImageReceiver(SelectAnimatedEmojiDialog.this.emojiSearchGridView);
imageViewEmoji.imageReceiver.setImage(ImageLocation.getForDocument(document3), "100_100_firstframe", (ImageLocation) null, (String) null, DocumentObject.getSvgThumb(document3, Theme.key_windowBackgroundWhiteGrayIcon, 0.2f), 0L, "tgs", document3, 0);
imageViewEmoji.isStaticIcon = true;
imageViewEmoji.document = document3;
imageViewEmoji.span = null;
return;
}
if (holder.getItemViewType() == 4) {
ImageViewEmoji imageViewEmoji2 = (ImageViewEmoji) holder.itemView;
imageViewEmoji2.position = position;
if (SelectAnimatedEmojiDialog.this.searchResult != null && position >= 0 && position < SelectAnimatedEmojiDialog.this.searchResult.size()) {
visibleReaction = (ReactionsLayoutInBubble.VisibleReaction) SelectAnimatedEmojiDialog.this.searchResult.get(position);
} else if (SelectAnimatedEmojiDialog.this.searchResultStickers == null || position < (i = this.stickersStartRow) || position - i >= SelectAnimatedEmojiDialog.this.searchResultStickers.size()) {
return;
} else {
visibleReaction = (ReactionsLayoutInBubble.VisibleReaction) SelectAnimatedEmojiDialog.this.searchResultStickers.get(position - this.stickersStartRow);
}
if (imageViewEmoji2.imageReceiver == null) {
ImageReceiver imageReceiver = new ImageReceiver(imageViewEmoji2);
imageViewEmoji2.imageReceiver = imageReceiver;
imageReceiver.setLayerNum(7);
imageViewEmoji2.imageReceiver.onAttachedToWindow();
}
imageViewEmoji2.imageReceiver.setParentView(SelectAnimatedEmojiDialog.this.emojiSearchGridView);
imageViewEmoji2.reaction = visibleReaction;
imageViewEmoji2.isFirstReactions = false;
imageViewEmoji2.setViewSelected(SelectAnimatedEmojiDialog.this.selectedReactions.contains(visibleReaction), false);
imageViewEmoji2.notDraw = false;
imageViewEmoji2.invalidate();
if (SelectAnimatedEmojiDialog.this.type == 13) {
imageViewEmoji2.setDrawable(Emoji.getEmojiDrawable(visibleReaction.emojicon));
} else if (!visibleReaction.isEffect && visibleReaction.emojicon != null) {
imageViewEmoji2.isDefaultReaction = true;
TLRPC.TL_availableReaction tL_availableReaction = (TLRPC.TL_availableReaction) MediaDataController.getInstance(SelectAnimatedEmojiDialog.this.currentAccount).getReactionsMap().get(visibleReaction.emojicon);
if (tL_availableReaction != null) {
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(tL_availableReaction.activate_animation, Theme.key_windowBackgroundWhiteGrayIcon, 0.2f);
if (!LiteMode.isEnabled(8200)) {
imageViewEmoji2.imageReceiver.setImage(ImageLocation.getForDocument(tL_availableReaction.select_animation), "60_60_firstframe", (ImageLocation) null, (String) null, svgThumb, 0L, "tgs", visibleReaction, 0);
} else {
imageViewEmoji2.imageReceiver.setImage(ImageLocation.getForDocument(tL_availableReaction.select_animation), "60_60_pcache", ImageLocation.getForDocument(tL_availableReaction.select_animation), "30_30_firstframe", (ImageLocation) null, (String) null, svgThumb, 0L, "tgs", visibleReaction, 0);
}
MediaDataController.getInstance(SelectAnimatedEmojiDialog.this.currentAccount).preloadImage(imageViewEmoji2.preloadEffectImageReceiver, ImageLocation.getForDocument(tL_availableReaction.around_animation), ReactionsEffectOverlay.getFilterForAroundAnimation());
} else {
imageViewEmoji2.imageReceiver.clearImage();
imageViewEmoji2.preloadEffectImageReceiver.clearImage();
}
imageViewEmoji2.span = null;
imageViewEmoji2.document = null;
imageViewEmoji2.setDrawable(null);
PremiumLockIconView premiumLockIconView = imageViewEmoji2.premiumLockIconView;
if (premiumLockIconView != null) {
premiumLockIconView.setVisibility(8);
imageViewEmoji2.premiumLockIconView.setImageReceiver(null);
}
if (tL_availableReaction == null && visibleReaction.isEffect) {
imageViewEmoji2.setDrawable(Emoji.getEmojiDrawable(visibleReaction.emojicon));
}
} else {
imageViewEmoji2.isDefaultReaction = false;
imageViewEmoji2.span = new AnimatedEmojiSpan(visibleReaction.documentId, (Paint.FontMetricsInt) null);
imageViewEmoji2.document = null;
imageViewEmoji2.imageReceiver.clearImage();
imageViewEmoji2.preloadEffectImageReceiver.clearImage();
AnimatedEmojiDrawable animatedEmojiDrawable = (AnimatedEmojiDrawable) SelectAnimatedEmojiDialog.this.emojiSearchGridView.animatedEmojiDrawables.get(imageViewEmoji2.span.getDocumentId());
if (animatedEmojiDrawable == null) {
animatedEmojiDrawable = AnimatedEmojiDrawable.make(SelectAnimatedEmojiDialog.this.currentAccount, SelectAnimatedEmojiDialog.this.getCacheType(), imageViewEmoji2.span.getDocumentId());
SelectAnimatedEmojiDialog.this.emojiSearchGridView.animatedEmojiDrawables.put(imageViewEmoji2.span.getDocumentId(), animatedEmojiDrawable);
}
imageViewEmoji2.setDrawable(animatedEmojiDrawable);
}
if (!UserConfig.getInstance(SelectAnimatedEmojiDialog.this.currentAccount).isPremium() && SelectAnimatedEmojiDialog.this.type == 14 && visibleReaction.isEffect && visibleReaction.premium) {
imageViewEmoji2.createPremiumLockView();
imageViewEmoji2.premiumLockIconView.setVisibility(0);
imageViewEmoji2.setEmojicon(null);
return;
}
if (visibleReaction.sticker) {
imageViewEmoji2.setEmojicon(visibleReaction.emojicon);
} else {
imageViewEmoji2.setEmojicon(null);
}
PremiumLockIconView premiumLockIconView2 = imageViewEmoji2.premiumLockIconView;
if (premiumLockIconView2 != null) {
premiumLockIconView2.setVisibility(4);
return;
}
return;
}
if (holder.getItemViewType() == 3) {
ImageViewEmoji imageViewEmoji3 = (ImageViewEmoji) holder.itemView;
imageViewEmoji3.empty = false;
imageViewEmoji3.position = position;
imageViewEmoji3.setPadding(AndroidUtilities.dp(1.0f), AndroidUtilities.dp(1.0f), AndroidUtilities.dp(1.0f), AndroidUtilities.dp(1.0f));
imageViewEmoji3.setDrawable(null);
if (SelectAnimatedEmojiDialog.this.searchResult != null && position >= 0 && position < SelectAnimatedEmojiDialog.this.searchResult.size()) {
ReactionsLayoutInBubble.VisibleReaction visibleReaction2 = (ReactionsLayoutInBubble.VisibleReaction) SelectAnimatedEmojiDialog.this.searchResult.get(position);
imageViewEmoji3.reaction = visibleReaction2;
long j = visibleReaction2.documentId;
if (j == 0) {
boolean contains2 = SelectAnimatedEmojiDialog.this.selectedReactions.contains(visibleReaction2);
imageViewEmoji3.isFirstReactions = true;
imageViewEmoji3.setDrawable(Emoji.getEmojiDrawable(visibleReaction2.emojicon));
imageViewEmoji3.setViewSelected(contains2, false);
return;
}
l = Long.valueOf(j);
if (SelectAnimatedEmojiDialog.this.type == 14 && !UserConfig.getInstance(SelectAnimatedEmojiDialog.this.currentAccount).isPremium() && visibleReaction2.isEffect && visibleReaction2.premium) {
imageViewEmoji3.createPremiumLockView();
imageViewEmoji3.premiumLockIconView.setVisibility(0);
} else {
PremiumLockIconView premiumLockIconView3 = imageViewEmoji3.premiumLockIconView;
if (premiumLockIconView3 != null) {
premiumLockIconView3.setVisibility(4);
}
}
document = null;
} else {
if (SelectAnimatedEmojiDialog.this.searchSets != null) {
int i3 = this.setsStartRow;
if (position - i3 >= 0 && position - i3 < SelectAnimatedEmojiDialog.this.searchSets.size()) {
document = (TLRPC.Document) SelectAnimatedEmojiDialog.this.searchSets.get(position - this.setsStartRow);
if (!(document instanceof SetTitleDocument)) {
l = null;
}
}
}
document = null;
l = null;
}
if (l == null && document == null) {
contains = false;
} else {
if (document != null) {
imageViewEmoji3.span = new AnimatedEmojiSpan(document, (Paint.FontMetricsInt) null);
imageViewEmoji3.document = document;
contains = SelectAnimatedEmojiDialog.this.selectedDocumentIds.contains(Long.valueOf(document.id));
} else {
AnimatedEmojiSpan animatedEmojiSpan = new AnimatedEmojiSpan(l.longValue(), (Paint.FontMetricsInt) null);
imageViewEmoji3.span = animatedEmojiSpan;
imageViewEmoji3.document = animatedEmojiSpan.document;
contains = SelectAnimatedEmojiDialog.this.selectedDocumentIds.contains(l);
}
AnimatedEmojiDrawable animatedEmojiDrawable2 = (AnimatedEmojiDrawable) SelectAnimatedEmojiDialog.this.emojiSearchGridView.animatedEmojiDrawables.get(imageViewEmoji3.span.getDocumentId());
if (animatedEmojiDrawable2 == null) {
animatedEmojiDrawable2 = AnimatedEmojiDrawable.make(SelectAnimatedEmojiDialog.this.currentAccount, SelectAnimatedEmojiDialog.this.getCacheType(), imageViewEmoji3.span.getDocumentId());
SelectAnimatedEmojiDialog.this.emojiSearchGridView.animatedEmojiDrawables.put(imageViewEmoji3.span.getDocumentId(), animatedEmojiDrawable2);
}
imageViewEmoji3.setDrawable(animatedEmojiDrawable2);
}
imageViewEmoji3.setViewSelected(contains, false);
}
}
public int getItemCount() {
return this.count;
}
public void updateRows(boolean diff) {
if (SelectAnimatedEmojiDialog.this.isAttached) {
int unused = SelectAnimatedEmojiDialog.this.type;
}
new ArrayList(this.rowHashCodes);
this.setsStartRow = -1;
this.stickersStartRow = -1;
boolean z = false;
this.count = 0;
this.rowHashCodes.clear();
if (SelectAnimatedEmojiDialog.this.searchResult != null) {
if (SelectAnimatedEmojiDialog.this.type == 4 && !SelectAnimatedEmojiDialog.this.searchResult.isEmpty()) {
int i = this.count;
this.count = i + 1;
this.emojiHeaderRow = i;
this.rowHashCodes.add(1);
}
this.emojiStartRow = this.count;
for (int i2 = 0; i2 < SelectAnimatedEmojiDialog.this.searchResult.size(); i2++) {
this.count++;
this.rowHashCodes.add(Integer.valueOf(Objects.hash(-4342, SelectAnimatedEmojiDialog.this.searchResult.get(i2))));
}
}
if (SelectAnimatedEmojiDialog.this.type == 14) {
if (SelectAnimatedEmojiDialog.this.searchResultStickers != null && !SelectAnimatedEmojiDialog.this.searchResultStickers.isEmpty()) {
int i3 = this.count;
this.count = i3 + 1;
this.stickersHeaderRow = i3;
this.rowHashCodes.add(2);
this.stickersStartRow = this.count;
for (int i4 = 0; i4 < SelectAnimatedEmojiDialog.this.searchResultStickers.size(); i4++) {
this.count++;
this.rowHashCodes.add(Integer.valueOf(Objects.hash(-7453, SelectAnimatedEmojiDialog.this.searchResultStickers.get(i4))));
}
}
} else if (SelectAnimatedEmojiDialog.this.stickersSearchResult != null) {
if (SelectAnimatedEmojiDialog.this.type == 4 && !SelectAnimatedEmojiDialog.this.stickersSearchResult.isEmpty()) {
int i5 = this.count;
this.count = i5 + 1;
this.stickersHeaderRow = i5;
this.rowHashCodes.add(2);
}
this.stickersStartRow = this.count;
for (int i6 = 0; i6 < SelectAnimatedEmojiDialog.this.stickersSearchResult.size(); i6++) {
this.count++;
this.rowHashCodes.add(Integer.valueOf(Objects.hash(-7453, SelectAnimatedEmojiDialog.this.stickersSearchResult.get(i6))));
}
}
if (SelectAnimatedEmojiDialog.this.searchSets != null) {
int i7 = this.count;
this.setsStartRow = i7;
this.count = i7 + SelectAnimatedEmojiDialog.this.searchSets.size();
}
notifyDataSetChanged();
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog = SelectAnimatedEmojiDialog.this;
if (selectAnimatedEmojiDialog.searched && this.count == 0) {
z = true;
}
selectAnimatedEmojiDialog.switchSearchEmptyView(z);
}
}
public class Adapter extends RecyclerListView.SelectionAdapter {
public Adapter() {
}
public boolean isEnabled(RecyclerView.ViewHolder holder) {
int itemViewType = holder.getItemViewType();
return itemViewType == 2 || itemViewType == 1 || itemViewType == 3 || itemViewType == 8;
}
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View view;
if (i == 0) {
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog = SelectAnimatedEmojiDialog.this;
view = selectAnimatedEmojiDialog.new HeaderView(selectAnimatedEmojiDialog.getContext(), SelectAnimatedEmojiDialog.this.type == 6);
} else if (i == 2) {
view = new ImageView(SelectAnimatedEmojiDialog.this.getContext());
} else if (i == 3 || i == 1 || i == 8) {
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog2 = SelectAnimatedEmojiDialog.this;
ImageViewEmoji imageViewEmoji = selectAnimatedEmojiDialog2.new ImageViewEmoji(selectAnimatedEmojiDialog2.getContext());
if (i == 8) {
imageViewEmoji.isStaticIcon = true;
ImageReceiver imageReceiver = new ImageReceiver(imageViewEmoji);
imageViewEmoji.imageReceiver = imageReceiver;
imageViewEmoji.imageReceiverToDraw = imageReceiver;
imageReceiver.setImageBitmap(SelectAnimatedEmojiDialog.this.forumIconDrawable);
SelectAnimatedEmojiDialog.this.forumIconImage = imageViewEmoji;
imageViewEmoji.setPadding(AndroidUtilities.dp(8.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(8.0f));
}
view = imageViewEmoji;
} else if (i == 4) {
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog3 = SelectAnimatedEmojiDialog.this;
view = new EmojiPackExpand(selectAnimatedEmojiDialog3, selectAnimatedEmojiDialog3.getContext(), null);
} else if (i == 5) {
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog4 = SelectAnimatedEmojiDialog.this;
view = new EmojiPackButton(selectAnimatedEmojiDialog4, selectAnimatedEmojiDialog4.getContext());
} else if (i == 6) {
TextView textView = new TextView(this, SelectAnimatedEmojiDialog.this.getContext()) {
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(AndroidUtilities.dp(26.0f)), 1073741824));
}
};
textView.setTextSize(1, 13.0f);
if (SelectAnimatedEmojiDialog.this.type == 3) {
textView.setText(LocaleController.getString("SelectTopicIconHint", R.string.SelectTopicIconHint));
} else if (SelectAnimatedEmojiDialog.this.type == 0 || SelectAnimatedEmojiDialog.this.type == 12 || SelectAnimatedEmojiDialog.this.type == 9 || SelectAnimatedEmojiDialog.this.type == 10) {
textView.setText(LocaleController.getString("EmojiLongtapHint", R.string.EmojiLongtapHint));
} else {
textView.setText(LocaleController.getString("ReactionsLongtapHint", R.string.ReactionsLongtapHint));
}
textView.setGravity(17);
textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText, SelectAnimatedEmojiDialog.this.resourcesProvider));
view = textView;
} else if (i == 7) {
View fixedHeightEmptyCell = new FixedHeightEmptyCell(SelectAnimatedEmojiDialog.this.getContext(), 52);
fixedHeightEmptyCell.setTag("searchbox");
view = fixedHeightEmptyCell;
} else {
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog5 = SelectAnimatedEmojiDialog.this;
view = selectAnimatedEmojiDialog5.new ImageViewEmoji(selectAnimatedEmojiDialog5.getContext());
}
if (SelectAnimatedEmojiDialog.this.enterAnimationInProgress()) {
view.setScaleX(0.0f);
view.setScaleY(0.0f);
}
return new RecyclerListView.Holder(view);
}
public int getItemViewType(int position) {
if (position == SelectAnimatedEmojiDialog.this.searchRow) {
return 7;
}
if (position >= SelectAnimatedEmojiDialog.this.recentReactionsStartRow && position < SelectAnimatedEmojiDialog.this.recentReactionsEndRow) {
return 1;
}
if (position >= SelectAnimatedEmojiDialog.this.topReactionsStartRow && position < SelectAnimatedEmojiDialog.this.topReactionsEndRow) {
return 1;
}
if (position >= SelectAnimatedEmojiDialog.this.stickersStartRow && position < SelectAnimatedEmojiDialog.this.stickersEndRow) {
return 1;
}
if (SelectAnimatedEmojiDialog.this.positionToExpand.indexOfKey(position) >= 0) {
return 4;
}
if (SelectAnimatedEmojiDialog.this.positionToButton.indexOfKey(position) >= 0) {
return 5;
}
if (position == SelectAnimatedEmojiDialog.this.longtapHintRow) {
return 6;
}
if (SelectAnimatedEmojiDialog.this.positionToSection.indexOfKey(position) >= 0 || position == SelectAnimatedEmojiDialog.this.recentReactionsSectionRow || position == SelectAnimatedEmojiDialog.this.stickersSectionRow || position == SelectAnimatedEmojiDialog.this.popularSectionRow || position == SelectAnimatedEmojiDialog.this.topicEmojiHeaderRow) {
return 0;
}
if (position == SelectAnimatedEmojiDialog.this.defaultTopicIconRow) {
return 8;
}
boolean unused = SelectAnimatedEmojiDialog.this.showStickers;
return 3;
}
public void onBindViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder r28, int r29) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.SelectAnimatedEmojiDialog.Adapter.onBindViewHolder(androidx.recyclerview.widget.RecyclerView$ViewHolder, int):void");
}
public void lambda$onBindViewHolder$0(EmojiView.EmojiPack emojiPack, int i, View view) {
Integer num;
View view2;
int childAdapterPosition;
if (!emojiPack.free && !UserConfig.getInstance(SelectAnimatedEmojiDialog.this.currentAccount).isPremium()) {
BaseFragment lastFragment = LaunchActivity.getLastFragment();
if (lastFragment != null) {
lastFragment.showDialog(new PremiumFeatureBottomSheet(SelectAnimatedEmojiDialog.this.baseFragment, SelectAnimatedEmojiDialog.this.getContext(), SelectAnimatedEmojiDialog.this.currentAccount, 11, false));
return;
}
return;
}
int i2 = 0;
while (true) {
if (i2 >= SelectAnimatedEmojiDialog.this.emojiGridView.getChildCount()) {
num = null;
view2 = null;
break;
} else {
if ((SelectAnimatedEmojiDialog.this.emojiGridView.getChildAt(i2) instanceof EmojiPackExpand) && (childAdapterPosition = SelectAnimatedEmojiDialog.this.emojiGridView.getChildAdapterPosition((view2 = SelectAnimatedEmojiDialog.this.emojiGridView.getChildAt(i2)))) >= 0 && SelectAnimatedEmojiDialog.this.positionToExpand.get(childAdapterPosition) == i) {
num = Integer.valueOf(childAdapterPosition);
break;
}
i2++;
}
}
if (num != null) {
SelectAnimatedEmojiDialog.this.expand(num.intValue(), view2);
}
EmojiPacksAlert.installSet((BaseFragment) null, emojiPack.set, false);
SelectAnimatedEmojiDialog.this.installedEmojiSets.add(Long.valueOf(emojiPack.set.id));
SelectAnimatedEmojiDialog.this.updateRows(true, true);
}
public int getItemCount() {
return SelectAnimatedEmojiDialog.this.totalCount;
}
public long getItemId(int position) {
return Math.abs(((Long) SelectAnimatedEmojiDialog.this.rowHashCodes.get(position)).longValue());
}
}
public final boolean enterAnimationInProgress() {
ValueAnimator valueAnimator;
return this.enterAnimationInProgress || ((valueAnimator = this.showAnimator) != null && valueAnimator.isRunning());
}
public class HeaderView extends FrameLayout {
public ImageView closeIcon;
public LinearLayout layoutView;
public ValueAnimator lockAnimator;
public float lockT;
public RLottieImageView lockView;
public TextView textView;
public HeaderView(Context context, boolean leftGravity) {
super(context);
LinearLayout linearLayout = new LinearLayout(context);
this.layoutView = linearLayout;
linearLayout.setOrientation(0);
addView(this.layoutView, LayoutHelper.createFrame(-2, -2, leftGravity ? 3 : 17));
RLottieImageView rLottieImageView = new RLottieImageView(context);
this.lockView = rLottieImageView;
rLottieImageView.setAnimation(R.raw.unlock_icon, 20, 20);
RLottieImageView rLottieImageView2 = this.lockView;
int i = Theme.key_chat_emojiPanelStickerSetName;
rLottieImageView2.setColorFilter(Theme.getColor(i, SelectAnimatedEmojiDialog.this.resourcesProvider));
this.layoutView.addView((View) this.lockView, (ViewGroup.LayoutParams) LayoutHelper.createLinear(20, 20));
TextView textView = new TextView(context);
this.textView = textView;
textView.setTextColor(Theme.getColor(i, SelectAnimatedEmojiDialog.this.resourcesProvider));
this.textView.setTypeface(AndroidUtilities.bold());
this.textView.setTextSize(1, 14.0f);
this.textView.setEllipsize(TextUtils.TruncateAt.END);
this.textView.setLines(1);
this.textView.setMaxLines(1);
this.textView.setSingleLine(true);
this.layoutView.addView(this.textView, LayoutHelper.createLinear(-2, -2, 17));
ImageView imageView = new ImageView(context);
this.closeIcon = imageView;
imageView.setImageResource(R.drawable.msg_close);
this.closeIcon.setScaleType(ImageView.ScaleType.CENTER);
this.closeIcon.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_emojiPanelStickerSetNameIcon, SelectAnimatedEmojiDialog.this.resourcesProvider), PorterDuff.Mode.MULTIPLY));
addView(this.closeIcon, LayoutHelper.createFrame(24, 24, 21));
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(30.0f), 1073741824));
}
public void setText(String text, boolean lock) {
this.textView.setText(text);
updateLock(lock, false);
}
public void setText(String text, String query, boolean lock) {
int indexOf;
if (text != null && query != null && (indexOf = text.toLowerCase().indexOf(query.toLowerCase())) >= 0) {
SpannableString spannableString = new SpannableString(text);
spannableString.setSpan(new ForegroundColorSpan(Theme.getColor(Theme.key_chat_emojiPanelStickerSetNameHighlight, SelectAnimatedEmojiDialog.this.resourcesProvider)), indexOf, query.length() + indexOf, 33);
text = spannableString;
}
this.textView.setText(text);
updateLock(lock, false);
}
public void updateLock(boolean lock, boolean animated) {
ValueAnimator valueAnimator = this.lockAnimator;
if (valueAnimator != null) {
valueAnimator.cancel();
this.lockAnimator = null;
}
if (animated) {
float[] fArr = new float[2];
fArr[0] = this.lockT;
fArr[1] = lock ? 1.0f : 0.0f;
ValueAnimator ofFloat = ValueAnimator.ofFloat(fArr);
this.lockAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
SelectAnimatedEmojiDialog.HeaderView.this.lambda$updateLock$0(valueAnimator2);
}
});
this.lockAnimator.setDuration(200L);
this.lockAnimator.setInterpolator(CubicBezierInterpolator.EASE_BOTH);
this.lockAnimator.start();
return;
}
this.lockT = lock ? 1.0f : 0.0f;
this.lockView.setTranslationX(AndroidUtilities.dp(-8.0f) * (1.0f - this.lockT));
this.textView.setTranslationX(AndroidUtilities.dp(-8.0f) * (1.0f - this.lockT));
this.lockView.setAlpha(this.lockT);
}
public void lambda$updateLock$0(ValueAnimator valueAnimator) {
this.lockT = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.lockView.setTranslationX(AndroidUtilities.dp(-8.0f) * (1.0f - this.lockT));
this.textView.setTranslationX(AndroidUtilities.dp(-8.0f) * (1.0f - this.lockT));
this.lockView.setAlpha(this.lockT);
}
}
public class EmojiPackButton extends FrameLayout {
public AnimatedTextView addButtonTextView;
public FrameLayout addButtonView;
public ValueAnimator installFadeAway;
public String lastTitle;
public ValueAnimator lockAnimator;
public Boolean lockShow;
public float lockT;
public PremiumButtonView premiumButtonView;
public EmojiPackButton(final SelectAnimatedEmojiDialog this$0, Context context) {
super(context);
AnimatedTextView animatedTextView = new AnimatedTextView(this, getContext(), this$0) {
public void invalidate() {
if (HwEmojis.grab(this)) {
return;
}
EmojiPackButton.super.invalidate();
}
public void invalidate(int l, int t, int r, int b) {
if (HwEmojis.grab(this)) {
return;
}
EmojiPackButton.super.invalidate(l, t, r, b);
}
};
this.addButtonTextView = animatedTextView;
animatedTextView.setAnimationProperties(0.3f, 0L, 250L, CubicBezierInterpolator.EASE_OUT_QUINT);
this.addButtonTextView.setTextSize(AndroidUtilities.dp(14.0f));
this.addButtonTextView.setTypeface(AndroidUtilities.bold());
this.addButtonTextView.setTextColor(Theme.getColor(Theme.key_featuredStickers_buttonText, this$0.resourcesProvider));
this.addButtonTextView.setGravity(17);
FrameLayout frameLayout = new FrameLayout(getContext());
this.addButtonView = frameLayout;
frameLayout.setBackground(Theme.AdaptiveRipple.filledRect(Theme.getColor(Theme.key_featuredStickers_addButton, this$0.resourcesProvider), 8.0f));
this.addButtonView.addView((View) this.addButtonTextView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, -2, 17));
addView(this.addButtonView, LayoutHelper.createFrame(-1, -1.0f));
PremiumButtonView premiumButtonView = new PremiumButtonView(getContext(), false, this$0.resourcesProvider);
this.premiumButtonView = premiumButtonView;
premiumButtonView.setIcon(R.raw.unlock_icon);
addView(this.premiumButtonView, LayoutHelper.createFrame(-1, -1.0f));
}
public void set(String title, boolean unlock, boolean installed, View.OnClickListener onClickListener) {
this.lastTitle = title;
if (unlock) {
this.addButtonView.setVisibility(8);
this.premiumButtonView.setVisibility(0);
this.premiumButtonView.setButton(LocaleController.formatString("UnlockPremiumEmojiPack", R.string.UnlockPremiumEmojiPack, new Object[]{title}), onClickListener);
} else {
this.premiumButtonView.setVisibility(8);
this.addButtonView.setVisibility(0);
this.addButtonView.setOnClickListener(onClickListener);
}
updateInstall(installed, false);
updateLock(unlock, false);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setPadding(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(8.0f), AndroidUtilities.dp(5.0f), AndroidUtilities.dp(8.0f));
super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(44.0f) + getPaddingTop() + getPaddingBottom(), 1073741824));
}
public void updateInstall(boolean installed, boolean animated) {
String formatString;
if (installed) {
formatString = LocaleController.getString("Added", R.string.Added);
} else {
formatString = LocaleController.formatString("AddStickersCount", R.string.AddStickersCount, new Object[]{this.lastTitle});
}
this.addButtonTextView.setText(formatString, animated);
ValueAnimator valueAnimator = this.installFadeAway;
if (valueAnimator != null) {
valueAnimator.cancel();
this.installFadeAway = null;
}
this.addButtonView.setEnabled(!installed);
if (animated) {
float[] fArr = new float[2];
fArr[0] = this.addButtonView.getAlpha();
fArr[1] = installed ? 0.6f : 1.0f;
this.installFadeAway = ValueAnimator.ofFloat(fArr);
FrameLayout frameLayout = this.addButtonView;
frameLayout.setAlpha(frameLayout.getAlpha());
this.installFadeAway.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
SelectAnimatedEmojiDialog.EmojiPackButton.this.lambda$updateInstall$0(valueAnimator2);
}
});
this.installFadeAway.setDuration(450L);
this.installFadeAway.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
this.installFadeAway.start();
return;
}
this.addButtonView.setAlpha(installed ? 0.6f : 1.0f);
}
public void lambda$updateInstall$0(ValueAnimator valueAnimator) {
FrameLayout frameLayout = this.addButtonView;
if (frameLayout != null) {
frameLayout.setAlpha(((Float) valueAnimator.getAnimatedValue()).floatValue());
}
}
public final void updateLock(final boolean show, boolean animated) {
ValueAnimator valueAnimator = this.lockAnimator;
if (valueAnimator != null) {
valueAnimator.cancel();
this.lockAnimator = null;
}
Boolean bool = this.lockShow;
if (bool == null || bool.booleanValue() != show) {
Boolean valueOf = Boolean.valueOf(show);
this.lockShow = valueOf;
if (animated) {
this.premiumButtonView.setVisibility(0);
float[] fArr = new float[2];
fArr[0] = this.lockT;
fArr[1] = show ? 1.0f : 0.0f;
ValueAnimator ofFloat = ValueAnimator.ofFloat(fArr);
this.lockAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
SelectAnimatedEmojiDialog.EmojiPackButton.this.lambda$updateLock$1(valueAnimator2);
}
});
this.lockAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (show) {
return;
}
EmojiPackButton.this.premiumButtonView.setVisibility(8);
}
});
this.lockAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
this.lockAnimator.setDuration(350L);
this.lockAnimator.start();
return;
}
float f = valueOf.booleanValue() ? 1.0f : 0.0f;
this.lockT = f;
this.addButtonView.setAlpha(1.0f - f);
this.premiumButtonView.setAlpha(this.lockT);
this.premiumButtonView.setScaleX(this.lockT);
this.premiumButtonView.setScaleY(this.lockT);
this.premiumButtonView.setVisibility(this.lockShow.booleanValue() ? 0 : 8);
}
}
public void lambda$updateLock$1(ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.lockT = floatValue;
FrameLayout frameLayout = this.addButtonView;
if (frameLayout != null) {
frameLayout.setAlpha(1.0f - floatValue);
}
PremiumButtonView premiumButtonView = this.premiumButtonView;
if (premiumButtonView != null) {
premiumButtonView.setAlpha(this.lockT);
}
}
}
public class EmojiPackExpand extends FrameLayout {
public TextView textView;
public EmojiPackExpand(final SelectAnimatedEmojiDialog this$0, Context context, Theme.ResourcesProvider resourcesProvider) {
super(context);
TextView textView = new TextView(context);
this.textView = textView;
textView.setTextSize(1, 12.0f);
this.textView.setTextColor(-1);
this.textView.setBackground(Theme.createRoundRectDrawable(AndroidUtilities.dp(11.0f), this$0.useAccentForPlus ? Theme.blendOver(this$0.accentColor, Theme.multAlpha(Theme.getColor(Theme.key_windowBackgroundWhite), 0.4f)) : ColorUtils.setAlphaComponent(Theme.getColor(Theme.key_chat_emojiPanelStickerSetName, resourcesProvider), 99)));
this.textView.setTypeface(AndroidUtilities.bold());
this.textView.setPadding(AndroidUtilities.dp(4.0f), AndroidUtilities.dp(1.66f), AndroidUtilities.dp(4.0f), AndroidUtilities.dp(2.0f));
addView(this.textView, LayoutHelper.createFrame(-2, -2, 17));
}
}
public long animateExpandDuration() {
return animateExpandAppearDuration() + animateExpandCrossfadeDuration() + 16;
}
public long animateExpandAppearDuration() {
return Math.max(450L, Math.min(55, this.animateExpandToPosition - this.animateExpandFromPosition) * 30);
}
public long animateExpandCrossfadeDuration() {
return Math.max(300L, Math.min(45, this.animateExpandToPosition - this.animateExpandFromPosition) * 25);
}
public class ImageViewEmoji extends View {
public float animatedScale;
public boolean attached;
public ValueAnimator backAnimator;
public ImageReceiver.BackgroundThreadDrawHolder[] backgroundThreadDrawHolder;
public float bigReactionSelectedProgress;
public TLRPC.Document document;
public Drawable drawable;
public Rect drawableBounds;
public Drawable emojiDrawable;
public boolean empty;
public ImageReceiver imageReceiver;
public ImageReceiver imageReceiverToDraw;
public final AnimatedEmojiSpan.InvalidateHolder invalidateHolder;
public boolean isDefaultReaction;
public boolean isFirstReactions;
public boolean isStaticIcon;
public boolean notDraw;
public int position;
public ImageReceiver preloadEffectImageReceiver;
public PremiumLockIconView premiumLockIconView;
public float pressedProgress;
public ReactionsLayoutInBubble.VisibleReaction reaction;
public boolean selected;
public float selectedProgress;
public float selectedProgressT;
public boolean shouldSelected;
public float skewAlpha;
public int skewIndex;
public AnimatedEmojiSpan span;
public void lambda$new$0() {
if (HwEmojis.isHwEnabled() || getParent() == null) {
return;
}
((View) getParent()).invalidate();
}
public ImageViewEmoji(Context context) {
super(context);
this.empty = false;
this.notDraw = false;
this.backgroundThreadDrawHolder = new ImageReceiver.BackgroundThreadDrawHolder[2];
this.preloadEffectImageReceiver = new ImageReceiver();
this.animatedScale = 1.0f;
this.invalidateHolder = new AnimatedEmojiSpan.InvalidateHolder() {
public final void invalidate() {
SelectAnimatedEmojiDialog.ImageViewEmoji.this.lambda$new$0();
}
};
this.preloadEffectImageReceiver.ignoreNotifications = true;
}
public void setAnimatedScale(float scale) {
this.animatedScale = scale;
}
public float getAnimatedScale() {
return this.animatedScale;
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(widthMeasureSpec), 1073741824), View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(widthMeasureSpec), 1073741824));
}
@Override
public void setPressed(boolean pressed) {
ValueAnimator valueAnimator;
if (isPressed() != pressed) {
super.setPressed(pressed);
invalidate();
if (pressed && (valueAnimator = this.backAnimator) != null) {
valueAnimator.removeAllListeners();
this.backAnimator.cancel();
}
if (pressed || this.pressedProgress == 0.0f || SelectAnimatedEmojiDialog.this.type == 14) {
return;
}
ValueAnimator ofFloat = ValueAnimator.ofFloat(this.pressedProgress, 0.0f);
this.backAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
SelectAnimatedEmojiDialog.ImageViewEmoji.this.lambda$setPressed$1(valueAnimator2);
}
});
this.backAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
ImageViewEmoji.this.backAnimator = null;
}
});
this.backAnimator.setInterpolator(new OvershootInterpolator(5.0f));
this.backAnimator.setDuration(350L);
this.backAnimator.start();
}
}
public void lambda$setPressed$1(ValueAnimator valueAnimator) {
this.pressedProgress = ((Float) valueAnimator.getAnimatedValue()).floatValue();
SelectAnimatedEmojiDialog.this.emojiGridView.invalidate();
}
public void updatePressedProgress() {
if (!isPressed() || this.pressedProgress == 1.0f || SelectAnimatedEmojiDialog.this.type == 14) {
return;
}
this.pressedProgress = Utilities.clamp(this.pressedProgress + 0.16f, 1.0f, 0.0f);
invalidate();
}
public void update(long time) {
ImageReceiver imageReceiver = this.imageReceiverToDraw;
if (imageReceiver != null) {
if (imageReceiver.getLottieAnimation() != null) {
this.imageReceiverToDraw.getLottieAnimation().updateCurrentFrame(time, true);
}
if (this.imageReceiverToDraw.getAnimation() != null) {
this.imageReceiverToDraw.getAnimation().updateCurrentFrame(time, true);
}
}
}
public final void cancelBackAnimator() {
ValueAnimator valueAnimator = this.backAnimator;
if (valueAnimator != null) {
valueAnimator.removeAllListeners();
this.backAnimator.cancel();
}
}
public void unselectWithScale() {
if (!this.selected || SelectAnimatedEmojiDialog.this.type == 14) {
return;
}
cancelBackAnimator();
this.pressedProgress = 1.0f;
ValueAnimator ofFloat = ValueAnimator.ofFloat(1.0f, 0.0f);
this.backAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
SelectAnimatedEmojiDialog.ImageViewEmoji.this.lambda$unselectWithScale$2(valueAnimator);
}
});
this.backAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
ImageViewEmoji.this.backAnimator = null;
}
});
this.backAnimator.setInterpolator(new OvershootInterpolator(5.0f));
this.backAnimator.setDuration(350L);
this.backAnimator.start();
setViewSelected(false, true);
}
public void lambda$unselectWithScale$2(ValueAnimator valueAnimator) {
this.pressedProgress = ((Float) valueAnimator.getAnimatedValue()).floatValue();
SelectAnimatedEmojiDialog.this.emojiGridView.invalidate();
}
public void setViewSelectedWithScale(boolean selected, boolean animated) {
if (!this.selected && selected && animated && SelectAnimatedEmojiDialog.this.type != 14) {
this.shouldSelected = true;
this.selectedProgress = 1.0f;
this.selectedProgressT = 1.0f;
cancelBackAnimator();
ValueAnimator ofFloat = ValueAnimator.ofFloat(this.pressedProgress, 1.6f, 0.7f);
this.backAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
SelectAnimatedEmojiDialog.ImageViewEmoji.this.lambda$setViewSelectedWithScale$3(valueAnimator);
}
});
this.backAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
ImageViewEmoji.this.pressedProgress = 0.0f;
ImageViewEmoji imageViewEmoji = ImageViewEmoji.this;
imageViewEmoji.backAnimator = null;
imageViewEmoji.shouldSelected = false;
ImageViewEmoji.this.setViewSelected(true, false);
}
});
this.backAnimator.setInterpolator(new LinearInterpolator());
this.backAnimator.setDuration(200L);
this.backAnimator.start();
return;
}
this.shouldSelected = false;
setViewSelected(selected, animated);
}
public void lambda$setViewSelectedWithScale$3(ValueAnimator valueAnimator) {
this.pressedProgress = ((Float) valueAnimator.getAnimatedValue()).floatValue();
SelectAnimatedEmojiDialog.this.emojiGridView.invalidate();
}
public void setViewSelected(boolean selected, boolean animated) {
if (this.selected != selected) {
this.selected = selected;
if (animated) {
return;
}
this.selectedProgressT = selected ? 1.0f : 0.0f;
this.selectedProgress = selected ? 1.0f : 0.0f;
}
}
public void drawSelected(Canvas canvas, View view) {
Paint paint;
boolean z = this.selected;
if ((z || this.shouldSelected || this.selectedProgress > 0.0f) && !this.notDraw) {
if (z || this.shouldSelected) {
float f = this.selectedProgressT;
if (f < 1.0f) {
this.selectedProgressT = f + ((1000.0f / AndroidUtilities.screenRefreshRate) / 240.0f);
view.invalidate();
}
}
if (!this.selected && !this.shouldSelected) {
float f2 = this.selectedProgressT;
if (f2 > 0.0f) {
this.selectedProgressT = f2 - ((1000.0f / AndroidUtilities.screenRefreshRate) / 240.0f);
view.invalidate();
}
}
this.selectedProgress = Utilities.clamp(this.selected ? CubicBezierInterpolator.EASE_OUT_QUINT.getInterpolation(this.selectedProgressT) : 1.0f - CubicBezierInterpolator.EASE_OUT_QUINT.getInterpolation(1.0f - this.selectedProgressT), 1.0f, 0.0f);
int dp = AndroidUtilities.dp(SelectAnimatedEmojiDialog.this.type == 6 ? 1.5f : 1.0f);
int dp2 = AndroidUtilities.dp(SelectAnimatedEmojiDialog.this.type == 6 ? 6.0f : 4.0f);
RectF rectF = AndroidUtilities.rectTmp;
rectF.set(0.0f, 0.0f, getMeasuredWidth(), getMeasuredHeight());
float f3 = dp;
rectF.inset(f3, f3);
if (!this.empty) {
AnimatedEmojiDrawable animatedEmojiDrawable = this.drawable;
if (!(animatedEmojiDrawable instanceof AnimatedEmojiDrawable) || !animatedEmojiDrawable.canOverrideColor()) {
paint = SelectAnimatedEmojiDialog.this.selectorPaint;
int alpha = paint.getAlpha();
paint.setAlpha((int) (alpha * getAlpha() * this.selectedProgress));
float f4 = dp2;
canvas.drawRoundRect(rectF, f4, f4, paint);
paint.setAlpha(alpha);
}
}
paint = SelectAnimatedEmojiDialog.this.selectorAccentPaint;
int alpha2 = paint.getAlpha();
paint.setAlpha((int) (alpha2 * getAlpha() * this.selectedProgress));
float f42 = dp2;
canvas.drawRoundRect(rectF, f42, f42, paint);
paint.setAlpha(alpha2);
}
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
if (this.attached) {
return;
}
this.attached = true;
AnimatedEmojiDrawable animatedEmojiDrawable = this.drawable;
if (animatedEmojiDrawable instanceof AnimatedEmojiDrawable) {
animatedEmojiDrawable.addView(this.invalidateHolder);
}
ImageReceiver imageReceiver = this.imageReceiver;
if (imageReceiver != null) {
imageReceiver.setParentView((View) getParent());
this.imageReceiver.onAttachedToWindow();
}
this.preloadEffectImageReceiver.onAttachedToWindow();
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (this.attached) {
this.attached = false;
AnimatedEmojiDrawable animatedEmojiDrawable = this.drawable;
if (animatedEmojiDrawable instanceof AnimatedEmojiDrawable) {
animatedEmojiDrawable.removeView(this.invalidateHolder);
if (this.drawable.getImageReceiver() != null) {
this.drawable.getImageReceiver().setEmojiPaused(false);
}
}
ImageReceiver imageReceiver = this.imageReceiver;
if (imageReceiver != null) {
imageReceiver.onDetachedFromWindow();
this.imageReceiver.setEmojiPaused(false);
}
this.preloadEffectImageReceiver.onDetachedFromWindow();
}
}
public void setDrawable(Drawable drawable) {
AnimatedEmojiDrawable animatedEmojiDrawable = this.drawable;
if (animatedEmojiDrawable != drawable) {
if (this.attached && animatedEmojiDrawable != null && (animatedEmojiDrawable instanceof AnimatedEmojiDrawable)) {
animatedEmojiDrawable.removeView(this.invalidateHolder);
}
this.drawable = drawable;
if (this.attached && (drawable instanceof AnimatedEmojiDrawable)) {
((AnimatedEmojiDrawable) drawable).addView(this.invalidateHolder);
}
}
}
public void setSticker(TLRPC.Document document, View parent) {
this.document = document;
createImageReceiver(parent);
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(document, Theme.key_windowBackgroundWhiteGrayIcon, 0.2f);
if (SelectAnimatedEmojiDialog.this.type == 6) {
this.imageReceiver.setImage(ImageLocation.getForDocument(document), !LiteMode.isEnabled(16388) ? "34_34_firstframe" : "34_34", (ImageLocation) null, (String) null, svgThumb, document.size, (String) null, document, 0);
} else {
this.imageReceiver.setImage(ImageLocation.getForDocument(document), "100_100_firstframe", (ImageLocation) null, (String) null, svgThumb, 0L, "tgs", document, 0);
}
this.isStaticIcon = true;
this.span = null;
}
public void createImageReceiver(View parent) {
if (this.imageReceiver == null) {
ImageReceiver imageReceiver = new ImageReceiver(parent);
this.imageReceiver = imageReceiver;
imageReceiver.setLayerNum(7);
if (this.attached) {
this.imageReceiver.onAttachedToWindow();
}
this.imageReceiver.setAspectFit(true);
}
}
@Override
public void invalidate() {
if (HwEmojis.isHwEnabled() || getParent() == null) {
return;
}
((View) getParent()).invalidate();
}
@Override
public void invalidate(int l, int t, int r, int b) {
if (HwEmojis.isHwEnabled()) {
return;
}
super.invalidate(l, t, r, b);
}
public void createPremiumLockView() {
PremiumLockIconView premiumLockIconView = this.premiumLockIconView;
if (premiumLockIconView == null) {
this.premiumLockIconView = new PremiumLockIconView(getContext(), PremiumLockIconView.TYPE_REACTIONS_LOCK) {
@Override
public void invalidate() {
super.invalidate();
if (ImageViewEmoji.this.getParent() instanceof View) {
((View) ImageViewEmoji.this.getParent()).invalidate();
}
}
};
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(16.66f), 1073741824);
this.premiumLockIconView.measure(makeMeasureSpec, makeMeasureSpec);
PremiumLockIconView premiumLockIconView2 = this.premiumLockIconView;
premiumLockIconView2.layout(0, 0, premiumLockIconView2.getMeasuredWidth(), this.premiumLockIconView.getMeasuredHeight());
return;
}
premiumLockIconView.resetColor();
}
public void setEmojicon(String emojicon) {
if (TextUtils.isEmpty(emojicon)) {
this.emojiDrawable = null;
} else {
this.emojiDrawable = Emoji.getEmojiDrawable(emojicon);
}
}
}
public void onEmojiClick(final View view, final AnimatedEmojiSpan span) {
int i;
incrementHintUse();
if (span == null || (((i = this.type) == 0 || i == 12 || i == 9 || i == 10) && this.selectedDocumentIds.contains(Long.valueOf(span.documentId)))) {
onEmojiSelected(view, null, null, null);
return;
}
TLRPC.TL_emojiStatus tL_emojiStatus = new TLRPC.TL_emojiStatus();
tL_emojiStatus.document_id = span.getDocumentId();
final TLRPC.Document document = span.document;
if (document == null) {
document = AnimatedEmojiDrawable.findDocument(this.currentAccount, span.documentId);
}
if (view instanceof ImageViewEmoji) {
int i2 = this.type;
if (i2 == 0 || i2 == 12 || i2 == 9 || i2 == 10) {
MediaDataController.getInstance(this.currentAccount).pushRecentEmojiStatus(tL_emojiStatus);
}
int i3 = this.type;
if (i3 == 0 || i3 == 12 || i3 == 9 || i3 == 10 || i3 == 2) {
animateEmojiSelect((ImageViewEmoji) view, new Runnable() {
@Override
public final void run() {
SelectAnimatedEmojiDialog.this.lambda$onEmojiClick$30(view, span, document);
}
});
return;
} else {
onEmojiSelected(view, Long.valueOf(span.documentId), document, null);
return;
}
}
onEmojiSelected(view, Long.valueOf(span.documentId), document, null);
}
public void lambda$onEmojiClick$30(View view, AnimatedEmojiSpan animatedEmojiSpan, TLRPC.Document document) {
onEmojiSelected(view, Long.valueOf(animatedEmojiSpan.documentId), document, null);
}
public final void incrementHintUse() {
if (this.type == 2) {
return;
}
StringBuilder sb = new StringBuilder();
sb.append("emoji");
int i = this.type;
sb.append((i == 0 || i == 12 || i == 9 || i == 10) ? "status" : "reaction");
sb.append("usehint");
String sb2 = sb.toString();
int i2 = MessagesController.getGlobalMainSettings().getInt(sb2, 0);
if (i2 <= 3) {
MessagesController.getGlobalMainSettings().edit().putInt(sb2, i2 + 1).apply();
}
}
public void preload(int type, int account) {
if (MediaDataController.getInstance(account) == null) {
return;
}
MediaDataController.getInstance(account).checkStickers(5);
if (type == 14) {
MessagesController.getInstance(this.currentAccount).getAvailableEffects();
return;
}
if (type == 1 || type == 11 || type == 2 || type == 6 || type == 13) {
MediaDataController.getInstance(account).checkReactions();
return;
}
if (type == 9 || type == 10) {
if (MessagesController.getInstance(account).getMainSettings().getBoolean("resetemojipacks", true)) {
MediaDataController.getInstance(account).loadStickers(5, false, false);
MessagesController.getInstance(account).getMainSettings().edit().putBoolean("resetemojipacks", false).commit();
}
MediaDataController.getInstance(account).fetchEmojiStatuses(2, false);
MediaDataController.getInstance(account).loadRestrictedStatusEmojis();
MediaDataController.getInstance(account).getStickerSet(new TLRPC.TL_inputStickerSetEmojiChannelDefaultStatuses(), false);
return;
}
if (type == 0 || type == 12) {
MediaDataController.getInstance(account).fetchEmojiStatuses(0, true);
MediaDataController.getInstance(account).getStickerSet(new TLRPC.TL_inputStickerSetEmojiDefaultStatuses(), false);
} else if (type == 3) {
MediaDataController.getInstance(account).checkDefaultTopicIcons();
} else if (type == 4) {
MediaDataController.getInstance(account).loadRecents(0, false, true, false);
MediaDataController.getInstance(account).checkStickers(0);
}
}
public static void preload(int account) {
if (preloaded[account] || MediaDataController.getInstance(account) == null) {
return;
}
preloaded[account] = true;
MediaDataController.getInstance(account).checkStickers(5);
MediaDataController.getInstance(account).fetchEmojiStatuses(0, true);
MediaDataController.getInstance(account).checkReactions();
MediaDataController.getInstance(account).getStickerSet(new TLRPC.TL_inputStickerSetEmojiDefaultStatuses(), false);
MediaDataController.getInstance(account).getDefaultEmojiStatuses();
MediaDataController.getInstance(account).checkDefaultTopicIcons();
StickerCategoriesListView.preload(account, 1);
}
public final void updateRows(boolean updateEmojipacks, boolean animated) {
updateRows(updateEmojipacks, animated, true);
}
public final void updateRows(boolean r25, boolean r26, boolean r27) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.SelectAnimatedEmojiDialog.updateRows(boolean, boolean, boolean):void");
}
public void notifyDataSetChanged() {
Adapter adapter = this.adapter;
if (adapter != null) {
adapter.notifyDataSetChanged();
}
}
public void expand(int i, View view) {
boolean z;
int min;
int i2;
int size;
Integer num;
int i3;
int i4;
boolean z2;
int i5 = this.positionToExpand.get(i);
this.animateExpandFromButtonTranslate = 0.0f;
Integer num2 = null;
if (i5 >= 0 && i5 < this.packs.size()) {
i4 = 24;
EmojiView.EmojiPack emojiPack = this.packs.get(i5);
if (emojiPack.expanded) {
return;
}
z2 = i5 + 1 == this.packs.size();
i3 = this.sectionToPosition.get(i5);
this.expandedEmojiSets.add(Long.valueOf(emojiPack.set.id));
i2 = emojiPack.expanded ? emojiPack.documents.size() : Math.min(24, emojiPack.documents.size());
num = emojiPack.documents.size() > 24 ? Integer.valueOf(i3 + 1 + i2) : null;
emojiPack.expanded = true;
size = emojiPack.documents.size();
} else {
if (i5 != -1 || (z = this.recentExpanded)) {
return;
}
int i6 = (this.searchRow != -1 ? 1 : 0) + (this.longtapHintRow != -1 ? 1 : 0);
boolean z3 = this.includeEmpty;
int i7 = i6 + (z3 ? 1 : 0);
if (z) {
min = this.recent.size();
} else {
min = Math.min((40 - (z3 ? 1 : 0)) - 2, this.recent.size());
}
i2 = min;
size = this.recent.size();
this.recentExpanded = true;
num = null;
i3 = i7;
i4 = 40;
z2 = false;
}
if (size > i2) {
num = Integer.valueOf(i3 + 1 + i2);
num2 = Integer.valueOf(size - i2);
}
updateRows(false, true);
if (num == null || num2 == null) {
return;
}
this.animateExpandFromButton = view;
this.animateExpandFromPosition = num.intValue();
this.animateExpandToPosition = num.intValue() + num2.intValue();
this.animateExpandStartTime = SystemClock.elapsedRealtime();
if (z2) {
final int intValue = num.intValue();
final float f = num2.intValue() > i4 / 2 ? 1.5f : 3.5f;
post(new Runnable() {
@Override
public final void run() {
SelectAnimatedEmojiDialog.this.lambda$expand$31(f, intValue);
}
});
}
}
public void lambda$expand$31(float f, int i) {
try {
LinearSmoothScrollerCustom linearSmoothScrollerCustom = new LinearSmoothScrollerCustom(this.emojiGridView.getContext(), 0, f);
linearSmoothScrollerCustom.setTargetPosition(i);
this.layoutManager.startSmoothScroll(linearSmoothScrollerCustom);
} catch (Exception e) {
FileLog.e(e);
}
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int i;
if (this.drawBackground && (i = this.type) != 3 && i != 4) {
super.onMeasure(View.MeasureSpec.makeMeasureSpec((int) Math.min(AndroidUtilities.dp(324.0f), AndroidUtilities.displaySize.x * 0.95f), 1073741824), View.MeasureSpec.makeMeasureSpec((int) Math.min(AndroidUtilities.dp(330.0f), AndroidUtilities.displaySize.y * 0.75f), Integer.MIN_VALUE));
} else if (this.type == 6) {
super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec((int) (AndroidUtilities.displaySize.y * 0.35f), Integer.MIN_VALUE));
} else {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
@Override
public void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (changed && this.type == 6) {
this.layoutManager.setSpanCount((getMeasuredWidth() / AndroidUtilities.dp(42.0f)) * 5);
}
}
public int getCacheType() {
int i = this.type;
if (i != 5 && i != 7) {
if (i == 6) {
return AnimatedEmojiDrawable.getCacheTypeForEnterView();
}
if (i != 3 && i != 4) {
return (i == 0 || i == 12 || i == 9 || i == 10 || i == 2) ? 2 : 3;
}
}
return 13;
}
public class EmojiListView extends RecyclerListView {
public LongSparseArray<AnimatedEmojiDrawable> animatedEmojiDrawables;
public boolean invalidated;
public ArrayList<DrawingInBackgroundLine> lineDrawables;
public ArrayList<DrawingInBackgroundLine> lineDrawablesTmp;
public ArrayList<ArrayList<ImageViewEmoji>> unusedArrays;
public ArrayList<DrawingInBackgroundLine> unusedLineDrawables;
public SparseArray<ArrayList<ImageViewEmoji>> viewsGroupedByLines;
public EmojiListView(Context context) {
super(context);
this.viewsGroupedByLines = new SparseArray<>();
this.unusedArrays = new ArrayList<>();
this.unusedLineDrawables = new ArrayList<>();
this.lineDrawables = new ArrayList<>();
this.lineDrawablesTmp = new ArrayList<>();
this.animatedEmojiDrawables = new LongSparseArray<>();
setDrawSelectorBehind(true);
setClipToPadding(false);
setSelectorRadius(AndroidUtilities.dp(4.0f));
setSelectorDrawableColor(Theme.getColor(Theme.key_listSelector, ((RecyclerListView) this).resourcesProvider));
}
public boolean drawChild(Canvas canvas, View child, long drawingTime) {
return super/*androidx.recyclerview.widget.RecyclerView*/.drawChild(canvas, child, drawingTime);
}
public boolean canHighlightChildAt(android.view.View r3, float r4, float r5) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.SelectAnimatedEmojiDialog.EmojiListView.canHighlightChildAt(android.view.View, float, float):boolean");
}
public void setAlpha(float alpha) {
SelectAnimatedEmojiDialog.super.setAlpha(alpha);
invalidate();
}
public void dispatchDraw(Canvas canvas) {
ImageReceiver imageReceiver;
ImageReceiver imageReceiver2;
if (getVisibility() != 0) {
return;
}
this.invalidated = false;
int saveCount = canvas.getSaveCount();
if (SelectAnimatedEmojiDialog.this.type != 6 && SelectAnimatedEmojiDialog.this.type != 14 && SelectAnimatedEmojiDialog.this.type != 13 && !((RecyclerListView) this).selectorRect.isEmpty()) {
((RecyclerListView) this).selectorDrawable.setBounds(((RecyclerListView) this).selectorRect);
canvas.save();
Consumer consumer = ((RecyclerListView) this).selectorTransformer;
if (consumer != null) {
consumer.accept(canvas);
}
((RecyclerListView) this).selectorDrawable.draw(canvas);
canvas.restore();
}
for (int i = 0; i < this.viewsGroupedByLines.size(); i++) {
ArrayList<ImageViewEmoji> valueAt = this.viewsGroupedByLines.valueAt(i);
valueAt.clear();
this.unusedArrays.add(valueAt);
}
this.viewsGroupedByLines.clear();
boolean z = ((SelectAnimatedEmojiDialog.this.animateExpandStartTime > 0L ? 1 : (SelectAnimatedEmojiDialog.this.animateExpandStartTime == 0L ? 0 : -1)) > 0 && ((SystemClock.elapsedRealtime() - SelectAnimatedEmojiDialog.this.animateExpandStartTime) > SelectAnimatedEmojiDialog.this.animateExpandDuration() ? 1 : ((SystemClock.elapsedRealtime() - SelectAnimatedEmojiDialog.this.animateExpandStartTime) == SelectAnimatedEmojiDialog.this.animateExpandDuration() ? 0 : -1)) < 0) && SelectAnimatedEmojiDialog.this.animateExpandFromButton != null && SelectAnimatedEmojiDialog.this.animateExpandFromPosition >= 0;
if (this.animatedEmojiDrawables != null) {
for (int i2 = 0; i2 < getChildCount(); i2++) {
View childAt = getChildAt(i2);
if (childAt instanceof ImageViewEmoji) {
ImageViewEmoji imageViewEmoji = (ImageViewEmoji) childAt;
imageViewEmoji.updatePressedProgress();
int y = SelectAnimatedEmojiDialog.this.smoothScrolling ? (int) childAt.getY() : childAt.getTop();
ArrayList<ImageViewEmoji> arrayList = this.viewsGroupedByLines.get(y);
canvas.save();
canvas.translate(imageViewEmoji.getX(), imageViewEmoji.getY());
imageViewEmoji.drawSelected(canvas, this);
canvas.restore();
if (imageViewEmoji.getBackground() != null) {
imageViewEmoji.getBackground().setBounds((int) imageViewEmoji.getX(), (int) imageViewEmoji.getY(), ((int) imageViewEmoji.getX()) + imageViewEmoji.getWidth(), ((int) imageViewEmoji.getY()) + imageViewEmoji.getHeight());
imageViewEmoji.getBackground().setAlpha((int) (255 * imageViewEmoji.getAlpha()));
imageViewEmoji.getBackground().draw(canvas);
imageViewEmoji.getBackground().setAlpha(255);
}
if (arrayList == null) {
if (!this.unusedArrays.isEmpty()) {
ArrayList<ArrayList<ImageViewEmoji>> arrayList2 = this.unusedArrays;
arrayList = arrayList2.remove(arrayList2.size() - 1);
} else {
arrayList = new ArrayList<>();
}
this.viewsGroupedByLines.put(y, arrayList);
}
arrayList.add(imageViewEmoji);
PremiumLockIconView premiumLockIconView = imageViewEmoji.premiumLockIconView;
if (premiumLockIconView != null && premiumLockIconView.getVisibility() == 0 && imageViewEmoji.premiumLockIconView.getImageReceiver() == null && (imageReceiver2 = imageViewEmoji.imageReceiverToDraw) != null) {
imageViewEmoji.premiumLockIconView.setImageReceiver(imageReceiver2);
}
}
if (z && childAt != null) {
if (getChildAdapterPosition(childAt) == SelectAnimatedEmojiDialog.this.animateExpandFromPosition - (SelectAnimatedEmojiDialog.this.animateExpandFromButtonTranslate > 0.0f ? 0 : 1)) {
float interpolation = CubicBezierInterpolator.EASE_OUT.getInterpolation(MathUtils.clamp((SystemClock.elapsedRealtime() - SelectAnimatedEmojiDialog.this.animateExpandStartTime) / 200.0f, 0.0f, 1.0f));
if (interpolation < 1.0f) {
float f = 1.0f - interpolation;
canvas.saveLayerAlpha(childAt.getLeft(), childAt.getTop(), childAt.getRight(), childAt.getBottom(), (int) (255.0f * f), 31);
canvas.translate(childAt.getLeft(), childAt.getTop() + SelectAnimatedEmojiDialog.this.animateExpandFromButtonTranslate);
float f2 = (f * 0.5f) + 0.5f;
canvas.scale(f2, f2, childAt.getWidth() / 2.0f, childAt.getHeight() / 2.0f);
SelectAnimatedEmojiDialog.this.animateExpandFromButton.draw(canvas);
canvas.restore();
}
}
}
}
}
this.lineDrawablesTmp.clear();
this.lineDrawablesTmp.addAll(this.lineDrawables);
this.lineDrawables.clear();
long currentTimeMillis = System.currentTimeMillis();
int i3 = 0;
while (true) {
DrawingInBackgroundLine drawingInBackgroundLine = null;
if (i3 >= this.viewsGroupedByLines.size()) {
break;
}
ArrayList<ImageViewEmoji> valueAt2 = this.viewsGroupedByLines.valueAt(i3);
ImageViewEmoji imageViewEmoji2 = valueAt2.get(0);
int childAdapterPosition = getChildAdapterPosition(imageViewEmoji2);
int i4 = 0;
while (true) {
if (i4 >= this.lineDrawablesTmp.size()) {
break;
}
if (this.lineDrawablesTmp.get(i4).position == childAdapterPosition) {
drawingInBackgroundLine = this.lineDrawablesTmp.get(i4);
this.lineDrawablesTmp.remove(i4);
break;
}
i4++;
}
if (drawingInBackgroundLine == null) {
if (!this.unusedLineDrawables.isEmpty()) {
ArrayList<DrawingInBackgroundLine> arrayList3 = this.unusedLineDrawables;
drawingInBackgroundLine = arrayList3.remove(arrayList3.size() - 1);
} else {
drawingInBackgroundLine = new DrawingInBackgroundLine();
drawingInBackgroundLine.setLayerNum(7);
}
drawingInBackgroundLine.position = childAdapterPosition;
drawingInBackgroundLine.onAttachToWindow();
}
this.lineDrawables.add(drawingInBackgroundLine);
drawingInBackgroundLine.imageViewEmojis = valueAt2;
canvas.save();
canvas.translate(imageViewEmoji2.getLeft(), imageViewEmoji2.getY());
drawingInBackgroundLine.startOffset = imageViewEmoji2.getLeft();
int measuredWidth = getMeasuredWidth() - (imageViewEmoji2.getLeft() * 2);
int measuredHeight = imageViewEmoji2.getMeasuredHeight();
if (measuredWidth > 0 && measuredHeight > 0) {
drawingInBackgroundLine.draw(canvas, currentTimeMillis, measuredWidth, measuredHeight, getAlpha());
}
canvas.restore();
i3++;
}
for (int i5 = 0; i5 < this.lineDrawablesTmp.size(); i5++) {
if (this.unusedLineDrawables.size() < 3) {
this.unusedLineDrawables.add(this.lineDrawablesTmp.get(i5));
this.lineDrawablesTmp.get(i5).imageViewEmojis = null;
this.lineDrawablesTmp.get(i5).reset();
} else {
this.lineDrawablesTmp.get(i5).onDetachFromWindow();
}
}
this.lineDrawablesTmp.clear();
for (int i6 = 0; i6 < getChildCount(); i6++) {
View childAt2 = getChildAt(i6);
if (childAt2 instanceof ImageViewEmoji) {
ImageViewEmoji imageViewEmoji3 = (ImageViewEmoji) childAt2;
PremiumLockIconView premiumLockIconView2 = imageViewEmoji3.premiumLockIconView;
if (premiumLockIconView2 != null && premiumLockIconView2.getVisibility() == 0) {
canvas.save();
canvas.translate((int) ((imageViewEmoji3.getX() + imageViewEmoji3.getMeasuredWidth()) - imageViewEmoji3.premiumLockIconView.getMeasuredWidth()), (int) ((imageViewEmoji3.getY() + imageViewEmoji3.getMeasuredHeight()) - imageViewEmoji3.premiumLockIconView.getMeasuredHeight()));
AnimatedEmojiDrawable animatedEmojiDrawable = imageViewEmoji3.drawable;
if (animatedEmojiDrawable instanceof AnimatedEmojiDrawable) {
imageReceiver = animatedEmojiDrawable.getImageReceiver();
} else {
imageReceiver = imageViewEmoji3.imageReceiver;
}
if (!imageViewEmoji3.premiumLockIconView.done()) {
imageViewEmoji3.premiumLockIconView.setImageReceiver(imageReceiver);
}
imageViewEmoji3.premiumLockIconView.draw(canvas);
canvas.restore();
}
if (imageViewEmoji3.emojiDrawable != null) {
canvas.save();
int dp = AndroidUtilities.dp(17.0f);
float f3 = dp;
canvas.translate((int) ((imageViewEmoji3.getX() + imageViewEmoji3.getMeasuredWidth()) - f3), (int) ((imageViewEmoji3.getY() + imageViewEmoji3.getMeasuredHeight()) - f3));
imageViewEmoji3.emojiDrawable.setBounds(0, 0, dp, dp);
imageViewEmoji3.emojiDrawable.draw(canvas);
canvas.restore();
}
} else if (childAt2 != null && childAt2 != SelectAnimatedEmojiDialog.this.animateExpandFromButton) {
canvas.save();
canvas.translate((int) childAt2.getX(), (int) childAt2.getY());
childAt2.draw(canvas);
canvas.restore();
}
}
canvas.restoreToCount(saveCount);
HwEmojis.exec();
}
public class DrawingInBackgroundLine extends DrawingInBackgroundThreadDrawable {
public ArrayList<ImageViewEmoji> imageViewEmojis;
public int position;
public int startOffset;
public ArrayList<ImageViewEmoji> drawInBackgroundViews = new ArrayList<>();
public float skewAlpha = 1.0f;
public boolean skewBelow = false;
public boolean lite = LiteMode.isEnabled(8200);
public OvershootInterpolator appearScaleInterpolator = new OvershootInterpolator(3.0f);
public DrawingInBackgroundLine() {
}
public void draw(Canvas canvas, long time, int w, int h, float alpha) {
ArrayList<ImageViewEmoji> arrayList = this.imageViewEmojis;
if (arrayList == null) {
return;
}
this.skewAlpha = 1.0f;
this.skewBelow = false;
if (!arrayList.isEmpty()) {
ImageViewEmoji imageViewEmoji = this.imageViewEmojis.get(0);
if (imageViewEmoji.getY() > (EmojiListView.this.getHeight() - EmojiListView.this.getPaddingBottom()) - imageViewEmoji.getHeight()) {
float clamp = MathUtils.clamp((-((imageViewEmoji.getY() - EmojiListView.this.getHeight()) + EmojiListView.this.getPaddingBottom())) / imageViewEmoji.getHeight(), 0.0f, 1.0f);
this.skewAlpha = clamp;
this.skewAlpha = (clamp * 0.75f) + 0.25f;
}
}
boolean z = true;
boolean z2 = SelectAnimatedEmojiDialog.this.type == 13 || this.skewAlpha < 1.0f || EmojiListView.this.isAnimating() || this.imageViewEmojis.size() <= 4 || !this.lite || SelectAnimatedEmojiDialog.this.enterAnimationInProgress() || SelectAnimatedEmojiDialog.this.type == 4 || SelectAnimatedEmojiDialog.this.type == 6;
if (!z2) {
boolean z3 = SelectAnimatedEmojiDialog.this.animateExpandStartTime > 0 && SystemClock.elapsedRealtime() - SelectAnimatedEmojiDialog.this.animateExpandStartTime < SelectAnimatedEmojiDialog.this.animateExpandDuration();
for (int i = 0; i < this.imageViewEmojis.size(); i++) {
ImageViewEmoji imageViewEmoji2 = this.imageViewEmojis.get(i);
if (imageViewEmoji2.pressedProgress != 0.0f || imageViewEmoji2.selectedProgress != 0.0f || imageViewEmoji2.backAnimator != null || imageViewEmoji2.getTranslationX() != 0.0f || imageViewEmoji2.getTranslationY() != 0.0f || imageViewEmoji2.getAlpha() != 1.0f || ((z3 && imageViewEmoji2.position > SelectAnimatedEmojiDialog.this.animateExpandFromPosition && imageViewEmoji2.position < SelectAnimatedEmojiDialog.this.animateExpandToPosition) || imageViewEmoji2.isStaticIcon)) {
break;
}
}
}
z = z2;
float f = HwEmojis.isHwEnabled() ? 1.0f : alpha;
if (z || HwEmojis.isPreparing()) {
prepareDraw(System.currentTimeMillis());
drawInUiThread(canvas, f);
reset();
return;
}
super.draw(canvas, time, w, h, f);
}
public void drawBitmap(Canvas canvas, Bitmap bitmap, Paint paint) {
canvas.drawBitmap(bitmap, 0.0f, 0.0f, paint);
}
public void prepareDraw(long time) {
float alpha;
ImageReceiver imageReceiver;
this.drawInBackgroundViews.clear();
for (int i = 0; i < this.imageViewEmojis.size(); i++) {
ImageViewEmoji imageViewEmoji = this.imageViewEmojis.get(i);
if (!imageViewEmoji.notDraw) {
if (imageViewEmoji.empty) {
Drawable premiumStar = SelectAnimatedEmojiDialog.this.getPremiumStar();
float f = (SelectAnimatedEmojiDialog.this.type == 5 || SelectAnimatedEmojiDialog.this.type == 10 || SelectAnimatedEmojiDialog.this.type == 9 || SelectAnimatedEmojiDialog.this.type == 7) ? 1.3f : 1.0f;
if (imageViewEmoji.pressedProgress != 0.0f || imageViewEmoji.selectedProgress > 0.0f) {
f *= ((1.0f - Math.max(imageViewEmoji.selectedProgress * 0.8f, imageViewEmoji.pressedProgress)) * 0.2f) + 0.8f;
}
if (premiumStar != null) {
premiumStar.setAlpha(255);
int width = (imageViewEmoji.getWidth() - imageViewEmoji.getPaddingLeft()) - imageViewEmoji.getPaddingRight();
int height = (imageViewEmoji.getHeight() - imageViewEmoji.getPaddingTop()) - imageViewEmoji.getPaddingBottom();
Rect rect = AndroidUtilities.rectTmp2;
float f2 = width / 2.0f;
float f3 = height / 2.0f;
rect.set((int) ((imageViewEmoji.getWidth() / 2.0f) - ((imageViewEmoji.getScaleX() * f2) * f)), (int) ((imageViewEmoji.getHeight() / 2.0f) - ((imageViewEmoji.getScaleY() * f3) * f)), (int) ((imageViewEmoji.getWidth() / 2.0f) + (f2 * imageViewEmoji.getScaleX() * f)), (int) ((imageViewEmoji.getHeight() / 2.0f) + (f3 * imageViewEmoji.getScaleY() * f)));
rect.offset(imageViewEmoji.getLeft() - this.startOffset, 0);
if (imageViewEmoji.drawableBounds == null) {
imageViewEmoji.drawableBounds = new Rect();
}
imageViewEmoji.drawableBounds.set(rect);
imageViewEmoji.setDrawable(premiumStar);
this.drawInBackgroundViews.add(imageViewEmoji);
}
} else {
if (imageViewEmoji.pressedProgress != 0.0f || imageViewEmoji.selectedProgress > 0.0f) {
Math.max(imageViewEmoji.selectedProgress * 0.8f, imageViewEmoji.pressedProgress);
}
if ((SelectAnimatedEmojiDialog.this.animateExpandStartTime > 0 && SystemClock.elapsedRealtime() - SelectAnimatedEmojiDialog.this.animateExpandStartTime < SelectAnimatedEmojiDialog.this.animateExpandDuration()) && SelectAnimatedEmojiDialog.this.animateExpandFromPosition >= 0 && SelectAnimatedEmojiDialog.this.animateExpandToPosition >= 0 && SelectAnimatedEmojiDialog.this.animateExpandStartTime > 0) {
int childAdapterPosition = EmojiListView.this.getChildAdapterPosition(imageViewEmoji) - SelectAnimatedEmojiDialog.this.animateExpandFromPosition;
int i2 = SelectAnimatedEmojiDialog.this.animateExpandToPosition - SelectAnimatedEmojiDialog.this.animateExpandFromPosition;
if (childAdapterPosition < 0 || childAdapterPosition >= i2) {
alpha = 1.0f;
} else {
float clamp = MathUtils.clamp((SystemClock.elapsedRealtime() - SelectAnimatedEmojiDialog.this.animateExpandStartTime) / SelectAnimatedEmojiDialog.this.animateExpandAppearDuration(), 0.0f, 1.0f);
float f4 = childAdapterPosition;
float f5 = i2;
float f6 = f5 / 4.0f;
float cascade = AndroidUtilities.cascade(clamp, f4, f5, f6);
this.appearScaleInterpolator.getInterpolation(AndroidUtilities.cascade(clamp, f4, f5, f6));
alpha = cascade * 1.0f;
}
} else {
alpha = 1.0f * imageViewEmoji.getAlpha();
}
if (!imageViewEmoji.isDefaultReaction && !imageViewEmoji.isStaticIcon) {
if (imageViewEmoji.span != null) {
Drawable drawable = imageViewEmoji.drawable;
AnimatedEmojiDrawable animatedEmojiDrawable = drawable instanceof AnimatedEmojiDrawable ? (AnimatedEmojiDrawable) drawable : null;
if (animatedEmojiDrawable != null && animatedEmojiDrawable.getImageReceiver() != null) {
imageReceiver = animatedEmojiDrawable.getImageReceiver();
animatedEmojiDrawable.setAlpha((int) (alpha * 255.0f));
imageViewEmoji.setDrawable(animatedEmojiDrawable);
imageViewEmoji.drawable.setColorFilter(SelectAnimatedEmojiDialog.this.premiumStarColorFilter);
}
}
} else {
imageReceiver = imageViewEmoji.imageReceiver;
imageReceiver.setAlpha(alpha);
}
if (imageReceiver != null) {
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog = SelectAnimatedEmojiDialog.this;
imageReceiver.setEmojiPaused(selectAnimatedEmojiDialog.paused && !(selectAnimatedEmojiDialog.pausedExceptSelected && imageViewEmoji.selected));
if (imageViewEmoji.selected) {
imageReceiver.setRoundRadius(AndroidUtilities.dp(4.0f));
} else {
imageReceiver.setRoundRadius(0);
}
ImageReceiver.BackgroundThreadDrawHolder[] backgroundThreadDrawHolderArr = imageViewEmoji.backgroundThreadDrawHolder;
int i3 = ((DrawingInBackgroundThreadDrawable) this).threadIndex;
backgroundThreadDrawHolderArr[i3] = imageReceiver.setDrawInBackgroundThread(backgroundThreadDrawHolderArr[i3], i3);
imageViewEmoji.backgroundThreadDrawHolder[((DrawingInBackgroundThreadDrawable) this).threadIndex].time = time;
imageViewEmoji.imageReceiverToDraw = imageReceiver;
imageViewEmoji.update(time);
imageViewEmoji.getWidth();
imageViewEmoji.getPaddingLeft();
imageViewEmoji.getPaddingRight();
imageViewEmoji.getHeight();
imageViewEmoji.getPaddingTop();
imageViewEmoji.getPaddingBottom();
Rect rect2 = AndroidUtilities.rectTmp2;
rect2.set(imageViewEmoji.getPaddingLeft(), imageViewEmoji.getPaddingTop(), imageViewEmoji.getWidth() - imageViewEmoji.getPaddingRight(), imageViewEmoji.getHeight() - imageViewEmoji.getPaddingBottom());
if (imageViewEmoji.selected && SelectAnimatedEmojiDialog.this.type != 3 && SelectAnimatedEmojiDialog.this.type != 4) {
rect2.set(Math.round(rect2.centerX() - ((rect2.width() / 2.0f) * 0.86f)), Math.round(rect2.centerY() - ((rect2.height() / 2.0f) * 0.86f)), Math.round(rect2.centerX() + ((rect2.width() / 2.0f) * 0.86f)), Math.round(rect2.centerY() + ((rect2.height() / 2.0f) * 0.86f)));
}
rect2.offset((imageViewEmoji.getLeft() + ((int) imageViewEmoji.getTranslationX())) - this.startOffset, 0);
imageViewEmoji.backgroundThreadDrawHolder[((DrawingInBackgroundThreadDrawable) this).threadIndex].setBounds(rect2);
imageViewEmoji.skewAlpha = 1.0f;
imageViewEmoji.skewIndex = i;
this.drawInBackgroundViews.add(imageViewEmoji);
}
}
}
}
}
public void drawInBackground(Canvas canvas) {
for (int i = 0; i < this.drawInBackgroundViews.size(); i++) {
ImageViewEmoji imageViewEmoji = this.drawInBackgroundViews.get(i);
if (!imageViewEmoji.notDraw) {
if (imageViewEmoji.empty) {
imageViewEmoji.drawable.setBounds(imageViewEmoji.drawableBounds);
imageViewEmoji.drawable.draw(canvas);
} else {
ImageReceiver imageReceiver = imageViewEmoji.imageReceiverToDraw;
if (imageReceiver != null) {
imageReceiver.draw(canvas, imageViewEmoji.backgroundThreadDrawHolder[((DrawingInBackgroundThreadDrawable) this).threadIndex]);
}
}
}
}
}
public void drawInUiThread(Canvas canvas, float alpha) {
if (this.imageViewEmojis != null) {
canvas.save();
canvas.translate(-this.startOffset, 0.0f);
float f = alpha;
for (int i = 0; i < this.imageViewEmojis.size(); i++) {
ImageViewEmoji imageViewEmoji = this.imageViewEmojis.get(i);
if (!imageViewEmoji.notDraw) {
float scaleX = imageViewEmoji.getScaleX();
if (SelectAnimatedEmojiDialog.this.type == 13) {
scaleX *= 0.87f;
}
if (imageViewEmoji.pressedProgress != 0.0f || (imageViewEmoji.selectedProgress > 0.0f && SelectAnimatedEmojiDialog.this.type != 3 && SelectAnimatedEmojiDialog.this.type != 4)) {
scaleX *= 0.8f + (0.2f * (1.0f - Math.max((SelectAnimatedEmojiDialog.this.type == 3 || SelectAnimatedEmojiDialog.this.type == 4) ? 1.0f : imageViewEmoji.selectedProgress * 0.7f, imageViewEmoji.pressedProgress)));
}
boolean z = SelectAnimatedEmojiDialog.this.animateExpandStartTime > 0 && SystemClock.elapsedRealtime() - SelectAnimatedEmojiDialog.this.animateExpandStartTime < SelectAnimatedEmojiDialog.this.animateExpandDuration();
if (z && SelectAnimatedEmojiDialog.this.animateExpandFromPosition >= 0 && SelectAnimatedEmojiDialog.this.animateExpandToPosition >= 0 && SelectAnimatedEmojiDialog.this.animateExpandStartTime > 0) {
int childAdapterPosition = EmojiListView.this.getChildAdapterPosition(imageViewEmoji) - SelectAnimatedEmojiDialog.this.animateExpandFromPosition;
int i2 = SelectAnimatedEmojiDialog.this.animateExpandToPosition - SelectAnimatedEmojiDialog.this.animateExpandFromPosition;
if (childAdapterPosition >= 0 && childAdapterPosition < i2) {
float clamp = MathUtils.clamp((SystemClock.elapsedRealtime() - SelectAnimatedEmojiDialog.this.animateExpandStartTime) / SelectAnimatedEmojiDialog.this.animateExpandAppearDuration(), 0.0f, 1.0f);
float f2 = childAdapterPosition;
float f3 = i2;
float f4 = f3 / 4.0f;
float cascade = AndroidUtilities.cascade(clamp, f2, f3, f4);
scaleX *= (this.appearScaleInterpolator.getInterpolation(AndroidUtilities.cascade(clamp, f2, f3, f4)) * 0.5f) + 0.5f;
f = cascade;
}
} else {
f *= imageViewEmoji.getAlpha();
}
Rect rect = AndroidUtilities.rectTmp2;
rect.set(((int) imageViewEmoji.getX()) + imageViewEmoji.getPaddingLeft(), imageViewEmoji.getPaddingTop(), (((int) imageViewEmoji.getX()) + imageViewEmoji.getWidth()) - imageViewEmoji.getPaddingRight(), imageViewEmoji.getHeight() - imageViewEmoji.getPaddingBottom());
if (!SelectAnimatedEmojiDialog.this.smoothScrolling && !z) {
rect.offset(0, (int) imageViewEmoji.getTranslationY());
}
Drawable drawable = null;
if (imageViewEmoji.empty) {
drawable = SelectAnimatedEmojiDialog.this.getPremiumStar();
if (SelectAnimatedEmojiDialog.this.type == 5 || SelectAnimatedEmojiDialog.this.type == 10 || SelectAnimatedEmojiDialog.this.type == 9 || SelectAnimatedEmojiDialog.this.type == 7) {
rect.inset((int) ((-rect.width()) * 0.15f), (int) ((-rect.height()) * 0.15f));
}
drawable.setBounds(rect);
drawable.setAlpha(255);
} else if (!imageViewEmoji.isDefaultReaction && !imageViewEmoji.isStaticIcon) {
if ((imageViewEmoji.span != null || SelectAnimatedEmojiDialog.this.type == 13) && !imageViewEmoji.notDraw && (drawable = imageViewEmoji.drawable) != null) {
drawable.setAlpha(255);
drawable.setBounds(rect);
}
} else {
ImageReceiver imageReceiver = imageViewEmoji.imageReceiver;
if (imageReceiver != null) {
imageReceiver.setImageCoords(rect);
}
}
if (SelectAnimatedEmojiDialog.this.premiumStarColorFilter != null) {
Drawable drawable2 = imageViewEmoji.drawable;
if (drawable2 instanceof AnimatedEmojiDrawable) {
drawable2.setColorFilter(SelectAnimatedEmojiDialog.this.premiumStarColorFilter);
}
}
float f5 = this.skewAlpha;
imageViewEmoji.skewAlpha = f5;
imageViewEmoji.skewIndex = i;
if (scaleX != 1.0f || f5 < 1.0f) {
canvas.save();
if (imageViewEmoji.selectedProgress > 1.0f && SelectAnimatedEmojiDialog.this.type != 3 && SelectAnimatedEmojiDialog.this.type != 4 && SelectAnimatedEmojiDialog.this.type != 6) {
float lerp = AndroidUtilities.lerp(1.0f, 0.85f, imageViewEmoji.selectedProgress);
canvas.scale(lerp, lerp, rect.centerX(), rect.centerY());
}
if (SelectAnimatedEmojiDialog.this.type == 6 || SelectAnimatedEmojiDialog.this.type == 13 || SelectAnimatedEmojiDialog.this.type == 14) {
canvas.scale(scaleX, scaleX, rect.centerX(), rect.centerY());
} else {
skew(canvas, i, imageViewEmoji.getHeight());
}
drawImage(canvas, drawable, imageViewEmoji, f);
canvas.restore();
} else {
drawImage(canvas, drawable, imageViewEmoji, f);
}
}
}
canvas.restore();
}
}
public final void skew(Canvas canvas, int i, int h) {
float f = this.skewAlpha;
if (f < 1.0f) {
if (this.skewBelow) {
canvas.translate(0.0f, h);
canvas.skew((1.0f - ((i * 2.0f) / this.imageViewEmojis.size())) * (-(1.0f - this.skewAlpha)), 0.0f);
canvas.translate(0.0f, -h);
} else {
canvas.scale(1.0f, f, 0.0f, 0.0f);
canvas.skew((1.0f - ((i * 2.0f) / this.imageViewEmojis.size())) * (1.0f - this.skewAlpha), 0.0f);
}
}
}
public final void drawImage(Canvas canvas, Drawable drawable, ImageViewEmoji imageView, float alpha) {
if (drawable != null) {
drawable.setAlpha((int) (alpha * 255.0f));
drawable.draw(canvas);
drawable.setColorFilter(SelectAnimatedEmojiDialog.this.premiumStarColorFilter);
} else if ((imageView.isDefaultReaction || imageView.isStaticIcon) && imageView.imageReceiver != null) {
canvas.save();
canvas.clipRect(imageView.imageReceiver.getImageX(), imageView.imageReceiver.getImageY(), imageView.imageReceiver.getImageX2(), imageView.imageReceiver.getImageY2());
imageView.imageReceiver.setAlpha(alpha);
imageView.imageReceiver.draw(canvas);
canvas.restore();
}
}
public void onFrameReady() {
super.onFrameReady();
for (int i = 0; i < this.drawInBackgroundViews.size(); i++) {
ImageReceiver.BackgroundThreadDrawHolder[] backgroundThreadDrawHolderArr = this.drawInBackgroundViews.get(i).backgroundThreadDrawHolder;
int i2 = ((DrawingInBackgroundThreadDrawable) this).threadIndex;
if (backgroundThreadDrawHolderArr[i2] != null) {
backgroundThreadDrawHolderArr[i2].release();
}
}
SelectAnimatedEmojiDialog.this.emojiGridView.invalidate();
}
}
public void onAttachedToWindow() {
super.onAttachedToWindow();
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog = SelectAnimatedEmojiDialog.this;
if (this == selectAnimatedEmojiDialog.emojiGridView) {
selectAnimatedEmojiDialog.bigReactionImageReceiver.onAttachedToWindow();
}
}
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
SelectAnimatedEmojiDialog selectAnimatedEmojiDialog = SelectAnimatedEmojiDialog.this;
if (this == selectAnimatedEmojiDialog.emojiGridView) {
selectAnimatedEmojiDialog.bigReactionImageReceiver.onDetachedFromWindow();
}
release(this.unusedLineDrawables);
release(this.lineDrawables);
release(this.lineDrawablesTmp);
}
public final void release(ArrayList<DrawingInBackgroundLine> lineDrawables) {
for (int i = 0; i < lineDrawables.size(); i++) {
lineDrawables.get(i).onDetachFromWindow();
}
lineDrawables.clear();
}
public void invalidateViews() {
if (HwEmojis.grab(this)) {
return;
}
super.invalidateViews();
}
public void invalidate() {
if (HwEmojis.grab(this) || this.invalidated) {
return;
}
this.invalidated = true;
SelectAnimatedEmojiDialog.super.invalidate();
}
public void invalidate(int l, int t, int r, int b) {
if (HwEmojis.grab(this)) {
return;
}
SelectAnimatedEmojiDialog.super.invalidate(l, t, r, b);
}
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
this.isAttached = true;
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.featuredEmojiDidLoad);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.stickersDidLoad);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.recentEmojiStatusesUpdate);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.groupStickersDidLoad);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiLoaded);
AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable swapAnimatedEmojiDrawable = this.scrimDrawable;
if (swapAnimatedEmojiDrawable != null) {
swapAnimatedEmojiDrawable.setSecondParent(this);
}
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
setBigReactionAnimatedEmoji(null);
this.isAttached = false;
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.featuredEmojiDidLoad);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.stickersDidLoad);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.recentEmojiStatusesUpdate);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.groupStickersDidLoad);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiLoaded);
AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable swapAnimatedEmojiDrawable = this.scrimDrawable;
if (swapAnimatedEmojiDrawable != null) {
swapAnimatedEmojiDrawable.setSecondParent((View) null);
}
}
public void lambda$new$32() {
updateRows(true, true);
}
public void lambda$new$33() {
NotificationCenter.getGlobalInstance().removeDelayed(this.updateRows);
NotificationCenter.getGlobalInstance().doOnIdle(this.updateRows);
}
public final void updateRowsDelayed() {
AndroidUtilities.cancelRunOnUIThread(this.updateRowsDelayed);
AndroidUtilities.runOnUIThread(this.updateRowsDelayed);
}
public void didReceivedNotification(int id, int account, Object... args) {
if (id == NotificationCenter.stickersDidLoad) {
if (((Integer) args[0]).intValue() == 5 || (((Integer) args[0]).intValue() == 0 && this.showStickers)) {
updateRowsDelayed();
return;
}
return;
}
if (id == NotificationCenter.featuredEmojiDidLoad) {
updateRowsDelayed();
return;
}
if (id == NotificationCenter.recentEmojiStatusesUpdate) {
updateRowsDelayed();
return;
}
if (id == NotificationCenter.groupStickersDidLoad) {
updateRowsDelayed();
return;
}
if (id == NotificationCenter.emojiLoaded) {
AndroidUtilities.forEachViews(this.emojiGridView, FloatingDebugView$$ExternalSyntheticLambda3.INSTANCE);
EmojiListView emojiListView = this.emojiGridView;
if (emojiListView != null) {
emojiListView.invalidate();
}
}
}
public final boolean isAnimatedShow() {
int i = this.type;
return (i == 3 || i == 4 || i == 6) ? false : true;
}
public void onShow(Runnable dismiss) {
int i;
Integer num = this.listStateId;
if (num != null) {
listStates.get(num);
}
this.dismiss = dismiss;
if (!this.drawBackground) {
checkScroll();
for (int i2 = 0; i2 < this.emojiGridView.getChildCount(); i2++) {
View childAt = this.emojiGridView.getChildAt(i2);
childAt.setScaleX(1.0f);
childAt.setScaleY(1.0f);
}
return;
}
ValueAnimator valueAnimator = this.showAnimator;
if (valueAnimator != null) {
valueAnimator.cancel();
this.showAnimator = null;
}
ValueAnimator valueAnimator2 = this.hideAnimator;
if (valueAnimator2 != null) {
valueAnimator2.cancel();
this.hideAnimator = null;
}
if (isAnimatedShow()) {
ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
this.showAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator3) {
SelectAnimatedEmojiDialog.this.lambda$onShow$34(valueAnimator3);
}
});
this.showAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
HwEmojis.disableHw();
SelectAnimatedEmojiDialog.this.emojiGridView.setLayerType(0, null);
SelectAnimatedEmojiDialog.this.searchBox.setLayerType(0, null);
SelectAnimatedEmojiDialog.this.emojiTabsShadow.setLayerType(0, null);
SelectAnimatedEmojiDialog.this.backgroundView.setLayerType(0, null);
if (SelectAnimatedEmojiDialog.this.bubble2View != null) {
SelectAnimatedEmojiDialog.this.bubble2View.setLayerType(0, null);
}
if (SelectAnimatedEmojiDialog.this.bubble1View != null) {
SelectAnimatedEmojiDialog.this.bubble1View.setLayerType(0, null);
}
SelectAnimatedEmojiDialog.this.searchBox.checkInitialization();
SelectAnimatedEmojiDialog.this.emojiTabs.showRecentTabStub(false);
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.startAllHeavyOperations, new Object[]{512});
SelectAnimatedEmojiDialog.this.notificationsLocker.unlock();
final NotificationCenter globalInstance = NotificationCenter.getGlobalInstance();
Objects.requireNonNull(globalInstance);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
globalInstance.runDelayedNotifications();
}
});
SelectAnimatedEmojiDialog.this.checkScroll();
SelectAnimatedEmojiDialog.this.updateShow(1.0f);
for (int i3 = 0; i3 < SelectAnimatedEmojiDialog.this.emojiGridView.getChildCount(); i3++) {
View childAt2 = SelectAnimatedEmojiDialog.this.emojiGridView.getChildAt(i3);
childAt2.setScaleX(1.0f);
childAt2.setScaleY(1.0f);
}
for (int i4 = 0; i4 < ((ScrollableHorizontalScrollView) SelectAnimatedEmojiDialog.this.emojiTabs).contentView.getChildCount(); i4++) {
View childAt3 = ((ScrollableHorizontalScrollView) SelectAnimatedEmojiDialog.this.emojiTabs).contentView.getChildAt(i4);
childAt3.setScaleX(1.0f);
childAt3.setScaleY(1.0f);
}
((ScrollableHorizontalScrollView) SelectAnimatedEmojiDialog.this.emojiTabs).contentView.invalidate();
SelectAnimatedEmojiDialog.this.emojiGridViewContainer.invalidate();
SelectAnimatedEmojiDialog.this.emojiGridView.invalidate();
}
});
if (isFirstOpen && (i = this.type) != 5 && i != 10 && i != 7) {
isFirstOpen = false;
AnimatedEmojiDrawable.getDocumentFetcher(this.currentAccount).setUiDbCallback(new Runnable() {
@Override
public final void run() {
SelectAnimatedEmojiDialog.this.lambda$onShow$36();
}
});
HwEmojis.prepare((Runnable) null, true);
} else {
HwEmojis.prepare(new Runnable() {
@Override
public final void run() {
SelectAnimatedEmojiDialog.this.lambda$onShow$38();
}
}, true);
}
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.stopAllHeavyOperations, new Object[]{512});
this.notificationsLocker.lock();
this.showAnimator.setDuration(800L);
this.emojiGridView.setLayerType(2, null);
this.searchBox.setLayerType(2, null);
this.emojiTabsShadow.setLayerType(2, null);
this.backgroundView.setLayerType(2, null);
View view = this.bubble2View;
if (view != null) {
view.setLayerType(2, null);
}
View view2 = this.bubble1View;
if (view2 != null) {
view2.setLayerType(2, null);
}
this.emojiTabs.showRecentTabStub(true);
updateShow(0.0f);
return;
}
checkScroll();
updateShow(1.0f);
}
public void lambda$onShow$34(ValueAnimator valueAnimator) {
updateShow(((Float) valueAnimator.getAnimatedValue()).floatValue());
}
public void lambda$onShow$36() {
HwEmojis.enableHw();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
SelectAnimatedEmojiDialog.this.lambda$onShow$35();
}
}, 0L);
}
public void lambda$onShow$35() {
this.showAnimator.start();
}
public void lambda$onShow$38() {
HwEmojis.enableHw();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
SelectAnimatedEmojiDialog.this.lambda$onShow$37();
}
}, 0L);
}
public void lambda$onShow$37() {
this.showAnimator.start();
}
public class SearchBox extends FrameLayout {
public FrameLayout box;
public StickerCategoriesListView categoriesListView;
public ImageView clear;
public Runnable delayedToggle;
public EditTextCaption input;
public FrameLayout inputBox;
public View inputBoxGradient;
public float inputBoxGradientAlpha;
public ValueAnimator inputBoxGradientAnimator;
public boolean inputBoxShown;
public ImageView search;
public SearchStateDrawable searchStateDrawable;
public SearchBox(Context context, boolean drawBackground) {
super(context);
this.inputBoxShown = false;
setClickable(true);
this.box = new FrameLayout(context);
if (drawBackground) {
setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground, SelectAnimatedEmojiDialog.this.resourcesProvider));
}
FrameLayout frameLayout = this.box;
int dp = AndroidUtilities.dp(18.0f);
int i = Theme.key_chat_emojiPanelBackground;
frameLayout.setBackground(Theme.createRoundRectDrawable(dp, Theme.getColor(i, SelectAnimatedEmojiDialog.this.resourcesProvider)));
if (Build.VERSION.SDK_INT >= 21) {
this.box.setClipToOutline(true);
this.box.setOutlineProvider(new ViewOutlineProvider(this, SelectAnimatedEmojiDialog.this) {
@Override
public void getOutline(View view, Outline outline) {
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), AndroidUtilities.dp(18.0f));
}
});
}
addView(this.box, LayoutHelper.createFrame(-1, 36.0f, 55, 8.0f, 12.0f, 8.0f, 8.0f));
ImageView imageView = new ImageView(context);
this.search = imageView;
imageView.setScaleType(ImageView.ScaleType.CENTER);
SearchStateDrawable searchStateDrawable = new SearchStateDrawable();
this.searchStateDrawable = searchStateDrawable;
searchStateDrawable.setIconState(0, false);
SearchStateDrawable searchStateDrawable2 = this.searchStateDrawable;
int i2 = Theme.key_chat_emojiSearchIcon;
searchStateDrawable2.setColor(Theme.getColor(i2, SelectAnimatedEmojiDialog.this.resourcesProvider));
this.search.setImageDrawable(this.searchStateDrawable);
this.search.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
SelectAnimatedEmojiDialog.SearchBox.this.lambda$new$0(view);
}
});
this.box.addView(this.search, LayoutHelper.createFrame(36, 36, 51));
FrameLayout frameLayout2 = new FrameLayout(context, SelectAnimatedEmojiDialog.this, drawBackground) {
public Paint fadePaint;
public final boolean val$drawBackground;
{
this.val$drawBackground = drawBackground;
}
@Override
public void dispatchDraw(Canvas canvas) {
if (!this.val$drawBackground && SearchBox.this.inputBoxGradientAlpha > 0.0f) {
if (this.fadePaint == null) {
Paint paint = new Paint();
this.fadePaint = paint;
paint.setShader(new LinearGradient(0.0f, 0.0f, AndroidUtilities.dp(18.0f), 0.0f, new int[]{-1, 0}, new float[]{0.0f, 1.0f}, Shader.TileMode.CLAMP));
this.fadePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
}
canvas.saveLayerAlpha(0.0f, 0.0f, getMeasuredWidth(), getMeasuredHeight(), 255, 31);
super.dispatchDraw(canvas);
this.fadePaint.setAlpha((int) (SearchBox.this.inputBoxGradientAlpha * 255.0f));
canvas.drawRect(0.0f, 0.0f, AndroidUtilities.dp(18.0f), getMeasuredHeight(), this.fadePaint);
canvas.restore();
return;
}
super.dispatchDraw(canvas);
}
};
this.inputBox = frameLayout2;
this.box.addView(frameLayout2, LayoutHelper.createFrame(-1, -1.0f, 119, 36.0f, 0.0f, 0.0f, 0.0f));
AnonymousClass3 anonymousClass3 = new AnonymousClass3(context, SelectAnimatedEmojiDialog.this.resourcesProvider, SelectAnimatedEmojiDialog.this);
this.input = anonymousClass3;
anonymousClass3.addTextChangedListener(new TextWatcher(SelectAnimatedEmojiDialog.this) {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
String obj = (SearchBox.this.input.getText() == null || AndroidUtilities.trim(SearchBox.this.input.getText(), (int[]) null).length() == 0) ? null : SearchBox.this.input.getText().toString();
SelectAnimatedEmojiDialog.this.search(obj);
if (SearchBox.this.categoriesListView != null) {
SearchBox.this.categoriesListView.selectCategory((StickerCategoriesListView.EmojiCategory) null);
SearchBox.this.categoriesListView.updateCategoriesShown(TextUtils.isEmpty(obj), true);
}
if (SearchBox.this.input != null) {
SearchBox.this.input.clearAnimation();
SearchBox.this.input.animate().translationX(0.0f).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT).start();
}
SearchBox.this.showInputBoxGradient(false);
}
});
this.input.setBackground(null);
this.input.setPadding(0, 0, AndroidUtilities.dp(4.0f), 0);
this.input.setTextSize(1, 16.0f);
this.input.setHint(LocaleController.getString("Search", R.string.Search));
this.input.setHintTextColor(Theme.getColor(i2, SelectAnimatedEmojiDialog.this.resourcesProvider));
this.input.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText, SelectAnimatedEmojiDialog.this.resourcesProvider));
this.input.setImeOptions(268435459);
this.input.setCursorColor(Theme.getColor(Theme.key_featuredStickers_addedIcon, SelectAnimatedEmojiDialog.this.resourcesProvider));
this.input.setCursorSize(AndroidUtilities.dp(20.0f));
this.input.setGravity(19);
this.input.setCursorWidth(1.5f);
this.input.setMaxLines(1);
this.input.setSingleLine(true);
this.input.setLines(1);
this.input.setTranslationY(AndroidUtilities.dp(-1.0f));
this.inputBox.addView((View) this.input, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, -1.0f, 119, 0.0f, 0.0f, 32.0f, 0.0f));
if (drawBackground) {
this.inputBoxGradient = new View(context);
Drawable mutate = context.getResources().getDrawable(R.drawable.gradient_right).mutate();
mutate.setColorFilter(new PorterDuffColorFilter(Theme.getColor(i, SelectAnimatedEmojiDialog.this.resourcesProvider), PorterDuff.Mode.MULTIPLY));
this.inputBoxGradient.setBackground(mutate);
this.inputBoxGradient.setAlpha(0.0f);
this.inputBox.addView(this.inputBoxGradient, LayoutHelper.createFrame(18, -1, 3));
}
setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
SelectAnimatedEmojiDialog.SearchBox.this.lambda$new$1(view);
}
});
ImageView imageView2 = new ImageView(context);
this.clear = imageView2;
imageView2.setScaleType(ImageView.ScaleType.CENTER);
this.clear.setImageDrawable(new CloseProgressDrawable2(1.25f, SelectAnimatedEmojiDialog.this) {
{
setSide(AndroidUtilities.dp(7.0f));
}
public int getCurrentColor() {
return Theme.getColor(Theme.key_chat_emojiSearchIcon, SelectAnimatedEmojiDialog.this.resourcesProvider);
}
});
this.clear.setBackground(Theme.createSelectorDrawable(Theme.getColor(Theme.key_listSelector, SelectAnimatedEmojiDialog.this.resourcesProvider), 1, AndroidUtilities.dp(15.0f)));
this.clear.setAlpha(0.0f);
this.clear.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
SelectAnimatedEmojiDialog.SearchBox.this.lambda$new$2(view);
}
});
this.box.addView(this.clear, LayoutHelper.createFrame(36, 36, 53));
if (HwEmojis.isFirstOpen()) {
return;
}
createCategoriesListView();
}
public void lambda$new$0(View view) {
if (this.searchStateDrawable.getIconState() == 1) {
this.input.setText("");
SelectAnimatedEmojiDialog.this.search(null, true, false);
StickerCategoriesListView stickerCategoriesListView = this.categoriesListView;
if (stickerCategoriesListView != null) {
stickerCategoriesListView.selectCategory((StickerCategoriesListView.EmojiCategory) null);
this.categoriesListView.updateCategoriesShown(true, true);
this.categoriesListView.scrollToStart();
}
this.input.clearAnimation();
this.input.animate().translationX(0.0f).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT).start();
showInputBoxGradient(false);
}
}
public class AnonymousClass3 extends EditTextCaption {
public AnonymousClass3(Context context, Theme.ResourcesProvider resourcesProvider, final SelectAnimatedEmojiDialog val$this$0) {
super(context, resourcesProvider);
}
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == 1 && SelectAnimatedEmojiDialog.this.prevWindowKeyboardVisible()) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
SelectAnimatedEmojiDialog.SearchBox.AnonymousClass3.this.lambda$onTouchEvent$0();
}
}, 200L);
return false;
}
return super/*org.telegram.ui.Components.EditTextBoldCursor*/.onTouchEvent(event);
}
public void lambda$onTouchEvent$0() {
requestFocus();
}
public void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
if (focused) {
SelectAnimatedEmojiDialog.this.onInputFocus();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
SelectAnimatedEmojiDialog.SearchBox.AnonymousClass3.this.lambda$onFocusChanged$1();
}
}, 200L);
}
super/*org.telegram.ui.Components.EditTextBoldCursor*/.onFocusChanged(focused, direction, previouslyFocusedRect);
}
public void lambda$onFocusChanged$1() {
AndroidUtilities.showKeyboard(SearchBox.this.input);
}
public void invalidate() {
if (HwEmojis.isHwEnabled()) {
return;
}
super/*android.widget.EditText*/.invalidate();
}
}
public void lambda$new$1(View view) {
if (SelectAnimatedEmojiDialog.this.prevWindowKeyboardVisible()) {
return;
}
SelectAnimatedEmojiDialog.this.onInputFocus();
this.input.requestFocus();
SelectAnimatedEmojiDialog.this.scrollToPosition(0, 0);
}
public void lambda$new$2(View view) {
this.input.setText("");
SelectAnimatedEmojiDialog.this.search(null, true, false);
StickerCategoriesListView stickerCategoriesListView = this.categoriesListView;
if (stickerCategoriesListView != null) {
stickerCategoriesListView.selectCategory((StickerCategoriesListView.EmojiCategory) null);
this.categoriesListView.updateCategoriesShown(true, true);
}
this.input.clearAnimation();
this.input.animate().translationX(0.0f).setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT).start();
showInputBoxGradient(false);
}
public void checkInitialization() {
createCategoriesListView();
}
public final void createCategoriesListView() {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.SelectAnimatedEmojiDialog.SearchBox.createCategoriesListView():void");
}
public void lambda$createCategoriesListView$3(Integer num) {
this.input.setTranslationX(-Math.max(0, num.intValue()));
showInputBoxGradient(num.intValue() > 0);
updateButton();
}
public void lambda$createCategoriesListView$4(StickerCategoriesListView.EmojiCategory emojiCategory) {
if (this.categoriesListView.getSelectedCategory() == emojiCategory) {
SelectAnimatedEmojiDialog.this.search(null, false, false);
this.categoriesListView.selectCategory((StickerCategoriesListView.EmojiCategory) null);
} else {
SelectAnimatedEmojiDialog.this.search(emojiCategory.emojis, false, false);
this.categoriesListView.selectCategory(emojiCategory);
}
}
public final void toggleClear(boolean enabled) {
if (enabled) {
if (this.delayedToggle == null) {
Runnable runnable = new Runnable() {
@Override
public final void run() {
SelectAnimatedEmojiDialog.SearchBox.this.lambda$toggleClear$5();
}
};
this.delayedToggle = runnable;
AndroidUtilities.runOnUIThread(runnable, 340L);
return;
}
return;
}
Runnable runnable2 = this.delayedToggle;
if (runnable2 != null) {
AndroidUtilities.cancelRunOnUIThread(runnable2);
this.delayedToggle = null;
}
AndroidUtilities.updateViewShow(this.clear, false);
}
public void lambda$toggleClear$5() {
AndroidUtilities.updateViewShow(this.clear, true);
}
public final void showInputBoxGradient(boolean show) {
if (show == this.inputBoxShown) {
return;
}
this.inputBoxShown = show;
ValueAnimator valueAnimator = this.inputBoxGradientAnimator;
if (valueAnimator != null) {
valueAnimator.cancel();
}
float[] fArr = new float[2];
fArr[0] = this.inputBoxGradientAlpha;
fArr[1] = show ? 1.0f : 0.0f;
ValueAnimator ofFloat = ValueAnimator.ofFloat(fArr);
this.inputBoxGradientAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
SelectAnimatedEmojiDialog.SearchBox.this.lambda$showInputBoxGradient$6(valueAnimator2);
}
});
this.inputBoxGradientAnimator.setDuration(120L);
this.inputBoxGradientAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
this.inputBoxGradientAnimator.start();
}
public void lambda$showInputBoxGradient$6(ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.inputBoxGradientAlpha = floatValue;
View view = this.inputBoxGradient;
if (view != null) {
view.setAlpha(floatValue);
return;
}
FrameLayout frameLayout = this.inputBox;
if (frameLayout != null) {
frameLayout.invalidate();
}
}
public boolean isInProgress() {
return this.searchStateDrawable.getIconState() == 2;
}
public void showProgress(boolean progress) {
if (progress) {
this.searchStateDrawable.setIconState(2);
} else {
updateButton(true);
}
}
public final void updateButton() {
updateButton(false);
}
public final void updateButton(boolean force) {
StickerCategoriesListView stickerCategoriesListView;
StickerCategoriesListView stickerCategoriesListView2;
if (!isInProgress() || ((this.input.length() == 0 && ((stickerCategoriesListView2 = this.categoriesListView) == null || stickerCategoriesListView2.getSelectedCategory() == null)) || force)) {
this.searchStateDrawable.setIconState((this.input.length() > 0 || ((stickerCategoriesListView = this.categoriesListView) != null && stickerCategoriesListView.isCategoriesShown() && (this.categoriesListView.isScrolledIntoOccupiedWidth() || this.categoriesListView.getSelectedCategory() != null))) ? 1 : 0);
}
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(52.0f), 1073741824));
}
@Override
public void invalidate() {
if (HwEmojis.grab(this)) {
return;
}
super.invalidate();
}
}
public final void updateShow(float t) {
if (this.bubble1View != null) {
float interpolation = CubicBezierInterpolator.EASE_OUT.getInterpolation(MathUtils.clamp((((t * 800.0f) - 0.0f) / 120.0f) / 1.0f, 0.0f, 1.0f));
this.bubble1View.setAlpha(interpolation);
this.bubble1View.setScaleX(interpolation);
this.bubble1View.setScaleY(interpolation * (isBottom() ? -1 : 1));
}
if (this.bubble2View != null) {
float clamp = MathUtils.clamp((((t * 800.0f) - 30.0f) / 120.0f) / 1.0f, 0.0f, 1.0f);
this.bubble2View.setAlpha(clamp);
this.bubble2View.setScaleX(clamp);
this.bubble2View.setScaleY(clamp * (isBottom() ? -1 : 1));
}
float f = t * 800.0f;
float f2 = f - 40.0f;
float clamp2 = MathUtils.clamp(f2 / 700.0f, 0.0f, 1.0f);
float clamp3 = MathUtils.clamp((f - 80.0f) / 700.0f, 0.0f, 1.0f);
float clamp4 = MathUtils.clamp(f2 / 750.0f, 0.0f, 1.0f);
float clamp5 = MathUtils.clamp((f - 30.0f) / 120.0f, 0.0f, 1.0f);
CubicBezierInterpolator cubicBezierInterpolator = CubicBezierInterpolator.EASE_OUT_QUINT;
float interpolation2 = cubicBezierInterpolator.getInterpolation(clamp2);
float interpolation3 = cubicBezierInterpolator.getInterpolation(clamp3);
this.backgroundView.setAlpha(clamp5);
this.searchBox.setAlpha(clamp5);
for (int i = 0; i < ((ScrollableHorizontalScrollView) this.emojiTabs).contentView.getChildCount(); i++) {
((ScrollableHorizontalScrollView) this.emojiTabs).contentView.getChildAt(i).setAlpha(clamp5);
}
if (this.scrimDrawable != null) {
invalidate();
}
float f3 = 1.0f - clamp5;
this.contentView.setTranslationY(AndroidUtilities.dp(-5.0f) * f3);
View view = this.bubble2View;
if (view != null) {
view.setTranslationY(AndroidUtilities.dp(-5.0f) * f3);
}
this.scaleX = (interpolation2 * 0.85f) + 0.15f;
this.scaleY = (interpolation3 * 0.925f) + 0.075f;
if (Build.VERSION.SDK_INT >= 21) {
this.contentView.invalidateOutline();
} else {
this.backgroundView.setVisibility(8);
this.contentView.setAlpha(clamp5);
this.contentView.invalidate();
}
View view2 = this.bubble2View;
if (view2 != null) {
view2.setAlpha(clamp5);
}
this.emojiTabsShadow.setAlpha(clamp5);
this.emojiTabsShadow.setScaleX(Math.min(this.scaleX, 1.0f));
float pivotX = this.emojiTabsShadow.getPivotX();
double d = pivotX * pivotX;
double pow = Math.pow(this.contentView.getHeight(), 2.0d);
Double.isNaN(d);
float sqrt = (float) Math.sqrt(Math.max(d + pow, Math.pow(this.contentView.getWidth() - pivotX, 2.0d) + Math.pow(this.contentView.getHeight(), 2.0d)));
for (int i2 = 0; i2 < ((ScrollableHorizontalScrollView) this.emojiTabs).contentView.getChildCount(); i2++) {
View childAt = ((ScrollableHorizontalScrollView) this.emojiTabs).contentView.getChildAt(i2);
if (t == 0.0f) {
childAt.setLayerType(2, null);
} else if (t == 1.0f) {
childAt.setLayerType(0, null);
}
float left = (childAt.getLeft() + (childAt.getWidth() / 2.0f)) - pivotX;
float top = childAt.getTop() + (childAt.getHeight() / 2.0f);
if (isBottom()) {
top = getMeasuredHeight() - top;
}
float cascade = AndroidUtilities.cascade(clamp4, (float) Math.sqrt((left * left) + (top * top * 0.4f)), sqrt, childAt.getHeight() * 1.75f);
if (Float.isNaN(cascade)) {
cascade = 0.0f;
}
childAt.setScaleX(cascade);
childAt.setScaleY(cascade);
}
for (int i3 = 0; i3 < this.emojiGridView.getChildCount(); i3++) {
View childAt2 = this.emojiGridView.getChildAt(i3);
if (childAt2 instanceof ImageViewEmoji) {
ImageViewEmoji imageViewEmoji = (ImageViewEmoji) childAt2;
float left2 = (childAt2.getLeft() + (childAt2.getWidth() / 2.0f)) - pivotX;
float top2 = childAt2.getTop() + (childAt2.getHeight() / 2.0f);
if (isBottom()) {
top2 = getMeasuredHeight() - top2;
}
float cascade2 = AndroidUtilities.cascade(clamp4, (float) Math.sqrt((left2 * left2) + (top2 * top2 * 0.2f)), sqrt, childAt2.getHeight() * 1.75f);
if (Float.isNaN(cascade2)) {
cascade2 = 0.0f;
}
imageViewEmoji.setAnimatedScale(cascade2);
}
}
this.emojiGridViewContainer.invalidate();
this.emojiGridView.invalidate();
}
public void onDismiss(final Runnable dismiss) {
Integer num = this.listStateId;
if (num != null) {
listStates.put(num, this.layoutManager.onSaveInstanceState());
}
ValueAnimator valueAnimator = this.hideAnimator;
if (valueAnimator != null) {
valueAnimator.cancel();
this.hideAnimator = null;
}
ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
this.hideAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
SelectAnimatedEmojiDialog.this.lambda$onDismiss$39(valueAnimator2);
}
});
this.hideAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
dismiss.run();
if (SelectAnimatedEmojiDialog.this.selectStatusDateDialog != null) {
SelectAnimatedEmojiDialog.this.selectStatusDateDialog.dismiss();
SelectAnimatedEmojiDialog.this.selectStatusDateDialog = null;
}
}
});
this.hideAnimator.setDuration(200L);
this.hideAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
this.hideAnimator.start();
SearchBox searchBox = this.searchBox;
if (searchBox != null) {
AndroidUtilities.hideKeyboard(searchBox.input);
}
}
public void lambda$onDismiss$39(ValueAnimator valueAnimator) {
float floatValue = 1.0f - ((Float) valueAnimator.getAnimatedValue()).floatValue();
setTranslationY(AndroidUtilities.dp(8.0f) * (1.0f - floatValue));
View view = this.bubble1View;
if (view != null) {
view.setAlpha(floatValue);
}
View view2 = this.bubble2View;
if (view2 != null) {
view2.setAlpha(floatValue * floatValue);
}
this.contentView.setAlpha(floatValue);
this.contentView.invalidate();
invalidate();
}
public void setDrawBackground(boolean drawBackground) {
this.drawBackground = drawBackground;
if (Build.VERSION.SDK_INT >= 21) {
this.contentView.setClipToOutline(drawBackground);
}
if (!drawBackground) {
this.backgroundView.setVisibility(8);
} else {
this.backgroundView.setVisibility(0);
}
}
public void setRecentReactions(List<ReactionsLayoutInBubble.VisibleReaction> reactions) {
this.recentReactionsToSet = reactions;
updateRows(false, true);
}
public void resetBackgroundBitmaps() {
for (int i = 0; i < this.emojiGridView.lineDrawables.size(); i++) {
EmojiListView.DrawingInBackgroundLine drawingInBackgroundLine = this.emojiGridView.lineDrawables.get(i);
for (int i2 = 0; i2 < drawingInBackgroundLine.imageViewEmojis.size(); i2++) {
if (drawingInBackgroundLine.imageViewEmojis.get(i2).notDraw) {
drawingInBackgroundLine.imageViewEmojis.get(i2).notDraw = false;
drawingInBackgroundLine.imageViewEmojis.get(i2).invalidate();
drawingInBackgroundLine.reset();
}
}
}
this.emojiGridView.invalidate();
for (int i3 = 0; i3 < this.emojiSearchGridView.lineDrawables.size(); i3++) {
EmojiListView.DrawingInBackgroundLine drawingInBackgroundLine2 = this.emojiSearchGridView.lineDrawables.get(i3);
for (int i4 = 0; i4 < drawingInBackgroundLine2.imageViewEmojis.size(); i4++) {
if (drawingInBackgroundLine2.imageViewEmojis.get(i4).notDraw) {
drawingInBackgroundLine2.imageViewEmojis.get(i4).notDraw = false;
drawingInBackgroundLine2.imageViewEmojis.get(i4).invalidate();
drawingInBackgroundLine2.reset();
}
}
}
this.emojiSearchGridView.invalidate();
}
public void setSelected(Long documentId) {
this.selectedDocumentIds.clear();
this.selectedDocumentIds.add(documentId);
if (this.emojiGridView != null) {
for (int i = 0; i < this.emojiGridView.getChildCount(); i++) {
if (this.emojiGridView.getChildAt(i) instanceof ImageViewEmoji) {
ImageViewEmoji imageViewEmoji = (ImageViewEmoji) this.emojiGridView.getChildAt(i);
AnimatedEmojiSpan animatedEmojiSpan = imageViewEmoji.span;
if (animatedEmojiSpan != null) {
imageViewEmoji.setViewSelected(this.selectedDocumentIds.contains(Long.valueOf(animatedEmojiSpan.getDocumentId())), true);
} else {
imageViewEmoji.setViewSelected(this.selectedDocumentIds.contains(0L), true);
}
}
}
this.emojiGridView.invalidate();
}
}
public void setMultiSelected(Long documentId, boolean animated) {
boolean z;
if (!this.selectedDocumentIds.contains(documentId)) {
this.selectedDocumentIds.add(documentId);
z = true;
} else {
this.selectedDocumentIds.remove(documentId);
z = false;
}
if (this.emojiGridView != null) {
for (int i = 0; i < this.emojiGridView.getChildCount(); i++) {
if (this.emojiGridView.getChildAt(i) instanceof ImageViewEmoji) {
ImageViewEmoji imageViewEmoji = (ImageViewEmoji) this.emojiGridView.getChildAt(i);
AnimatedEmojiSpan animatedEmojiSpan = imageViewEmoji.span;
if (animatedEmojiSpan != null && animatedEmojiSpan.getDocumentId() == documentId.longValue()) {
imageViewEmoji.setViewSelectedWithScale(z, animated);
} else {
TLRPC.Document document = imageViewEmoji.document;
if (document != null && document.id == documentId.longValue()) {
imageViewEmoji.setViewSelectedWithScale(z, animated);
}
}
}
}
this.emojiGridView.invalidate();
}
}
public boolean unselect(Long documentId) {
this.selectedDocumentIds.remove(documentId);
if (this.emojiGridView == null) {
return false;
}
boolean z = false;
for (int i = 0; i < this.emojiGridView.getChildCount(); i++) {
if (this.emojiGridView.getChildAt(i) instanceof ImageViewEmoji) {
ImageViewEmoji imageViewEmoji = (ImageViewEmoji) this.emojiGridView.getChildAt(i);
AnimatedEmojiSpan animatedEmojiSpan = imageViewEmoji.span;
if (animatedEmojiSpan != null && animatedEmojiSpan.getDocumentId() == documentId.longValue()) {
imageViewEmoji.unselectWithScale();
} else {
TLRPC.Document document = imageViewEmoji.document;
if (document != null && document.id == documentId.longValue()) {
imageViewEmoji.unselectWithScale();
}
}
z = true;
}
}
this.emojiGridView.invalidate();
if (!z) {
for (int i2 = 0; i2 < this.rowHashCodes.size(); i2++) {
long longValue = this.rowHashCodes.get(i2).longValue();
if (longValue == (documentId.longValue() * 13) + 62425 || longValue == (documentId.longValue() * 13) + 3212) {
Adapter adapter = this.adapter;
if (adapter != null) {
adapter.notifyItemChanged(i2);
}
return true;
}
}
}
return z;
}
public void clearSelectedDocuments() {
this.selectedDocumentIds.clear();
}
public void setScrimDrawable(AnimatedEmojiDrawable.SwapAnimatedEmojiDrawable scrimDrawable, View drawableParent) {
this.scrimColor = (scrimDrawable == null || scrimDrawable.getColor() == null) ? 0 : scrimDrawable.getColor().intValue();
this.scrimDrawable = scrimDrawable;
this.scrimDrawableParent = drawableParent;
if (this.isAttached && scrimDrawable != null) {
scrimDrawable.setSecondParent(this);
}
invalidate();
}
public void drawBigReaction(Canvas canvas, View view) {
if (this.selectedReactionView == null) {
return;
}
this.bigReactionImageReceiver.setParentView(view);
ImageViewEmoji imageViewEmoji = this.selectedReactionView;
if (imageViewEmoji != null) {
float f = this.pressedProgress;
if (f != 1.0f && !this.cancelPressed) {
float f2 = f + 0.010666667f;
this.pressedProgress = f2;
if (f2 >= 1.0f) {
this.pressedProgress = 1.0f;
onLongPressedListener onlongpressedlistener = this.bigReactionListener;
if (onlongpressedlistener != null) {
onlongpressedlistener.onLongPressed(imageViewEmoji);
}
}
this.selectedReactionView.bigReactionSelectedProgress = this.pressedProgress;
}
float f3 = (this.pressedProgress * 2.0f) + 1.0f;
canvas.save();
canvas.translate(this.emojiGridView.getX() + this.selectedReactionView.getX(), this.gridViewContainer.getY() + this.emojiGridView.getY() + this.selectedReactionView.getY());
this.paint.setColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground, this.resourcesProvider));
canvas.drawRect(0.0f, 0.0f, this.selectedReactionView.getMeasuredWidth(), this.selectedReactionView.getMeasuredHeight(), this.paint);
canvas.scale(f3, f3, this.selectedReactionView.getMeasuredWidth() / 2.0f, this.selectedReactionView.getMeasuredHeight());
ImageViewEmoji imageViewEmoji2 = this.selectedReactionView;
ImageReceiver imageReceiver = imageViewEmoji2.isDefaultReaction ? this.bigReactionImageReceiver : imageViewEmoji2.imageReceiverToDraw;
AnimatedEmojiDrawable animatedEmojiDrawable = this.bigReactionAnimatedEmoji;
if (animatedEmojiDrawable != null && animatedEmojiDrawable.getImageReceiver() != null && this.bigReactionAnimatedEmoji.getImageReceiver().hasBitmapImage()) {
imageReceiver = this.bigReactionAnimatedEmoji.getImageReceiver();
}
if (imageReceiver != null) {
imageReceiver.setImageCoords(0.0f, 0.0f, this.selectedReactionView.getMeasuredWidth(), this.selectedReactionView.getMeasuredHeight());
imageReceiver.draw(canvas);
}
canvas.restore();
view.invalidate();
}
}
public void setSaveState(int saveId) {
this.listStateId = Integer.valueOf(saveId);
}
public void setOnLongPressedListener(onLongPressedListener l) {
this.bigReactionListener = l;
}
public class SelectStatusDurationDialog extends Dialog {
public Bitmap blurBitmap;
public Paint blurBitmapPaint;
public boolean changeToScrimColor;
public int clipBottom;
public ContentView contentView;
public Rect current;
public BottomSheet dateBottomSheet;
public boolean dismissed;
public boolean done;
public View emojiPreviewView;
public Rect from;
public ImageReceiver imageReceiver;
public ImageViewEmoji imageViewEmoji;
public WindowInsets lastInsets;
public LinearLayout linearLayoutView;
public ActionBarPopupWindow.ActionBarPopupWindowLayout menuView;
public Runnable parentDialogDismiss;
public View parentDialogView;
public int parentDialogX;
public int parentDialogY;
public Theme.ResourcesProvider resourcesProvider;
public ValueAnimator showAnimator;
public ValueAnimator showMenuAnimator;
public float showMenuT;
public float showT;
public boolean showing;
public boolean showingMenu;
public int[] tempLocation;
public Rect to;
public boolean getOutBounds(Rect rect) {
throw null;
}
public void onEnd(Integer date) {
throw null;
}
public void onEndPartly(Integer date) {
throw null;
}
public class ContentView extends FrameLayout {
public ContentView(Context context) {
super(context);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(widthMeasureSpec), 1073741824), View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(heightMeasureSpec), 1073741824));
}
@Override
public void dispatchDraw(Canvas canvas) {
if (SelectStatusDurationDialog.this.blurBitmap != null && SelectStatusDurationDialog.this.blurBitmapPaint != null) {
canvas.save();
canvas.scale(12.0f, 12.0f);
SelectStatusDurationDialog.this.blurBitmapPaint.setAlpha((int) (SelectStatusDurationDialog.this.showT * 255.0f));
canvas.drawBitmap(SelectStatusDurationDialog.this.blurBitmap, 0.0f, 0.0f, SelectStatusDurationDialog.this.blurBitmapPaint);
canvas.restore();
}
super.dispatchDraw(canvas);
if (SelectStatusDurationDialog.this.imageViewEmoji != null) {
Drawable drawable = SelectStatusDurationDialog.this.imageViewEmoji.drawable;
if (drawable != null) {
if (SelectStatusDurationDialog.this.changeToScrimColor) {
drawable.setColorFilter(new PorterDuffColorFilter(ColorUtils.blendARGB(SelectAnimatedEmojiDialog.this.scrimColor, SelectAnimatedEmojiDialog.this.accentColor, SelectStatusDurationDialog.this.showT), PorterDuff.Mode.MULTIPLY));
} else {
drawable.setColorFilter(SelectAnimatedEmojiDialog.this.premiumStarColorFilter);
}
drawable.setAlpha((int) ((1.0f - SelectStatusDurationDialog.this.showT) * 255.0f));
RectF rectF = AndroidUtilities.rectTmp;
rectF.set(SelectStatusDurationDialog.this.current);
float max = (SelectStatusDurationDialog.this.imageViewEmoji.pressedProgress != 0.0f || SelectStatusDurationDialog.this.imageViewEmoji.selectedProgress > 0.0f) ? (((1.0f - Math.max(SelectStatusDurationDialog.this.imageViewEmoji.selectedProgress * 0.8f, SelectStatusDurationDialog.this.imageViewEmoji.pressedProgress)) * 0.2f) + 0.8f) * 1.0f : 1.0f;
Rect rect = AndroidUtilities.rectTmp2;
rect.set((int) (rectF.centerX() - ((rectF.width() / 2.0f) * max)), (int) (rectF.centerY() - ((rectF.height() / 2.0f) * max)), (int) (rectF.centerX() + ((rectF.width() / 2.0f) * max)), (int) (rectF.centerY() + ((rectF.height() / 2.0f) * max)));
float f = 1.0f - ((1.0f - SelectStatusDurationDialog.this.imageViewEmoji.skewAlpha) * (1.0f - SelectStatusDurationDialog.this.showT));
canvas.save();
if (f < 1.0f) {
canvas.translate(rect.left, rect.top);
canvas.scale(1.0f, f, 0.0f, 0.0f);
canvas.skew((1.0f - ((SelectStatusDurationDialog.this.imageViewEmoji.skewIndex * 2.0f) / 8.0f)) * (1.0f - f), 0.0f);
canvas.translate(-rect.left, -rect.top);
}
canvas.clipRect(0.0f, 0.0f, getWidth(), SelectStatusDurationDialog.this.clipBottom + (SelectStatusDurationDialog.this.showT * AndroidUtilities.dp(45.0f)));
drawable.setBounds(rect);
drawable.draw(canvas);
canvas.restore();
if (SelectStatusDurationDialog.this.imageViewEmoji.skewIndex == 0) {
rect.offset(AndroidUtilities.dp(f * 8.0f), 0);
} else if (SelectStatusDurationDialog.this.imageViewEmoji.skewIndex == 1) {
rect.offset(AndroidUtilities.dp(f * 4.0f), 0);
} else if (SelectStatusDurationDialog.this.imageViewEmoji.skewIndex == 6) {
rect.offset(-AndroidUtilities.dp(f * (-4.0f)), 0);
} else if (SelectStatusDurationDialog.this.imageViewEmoji.skewIndex == 7) {
rect.offset(AndroidUtilities.dp(f * (-8.0f)), 0);
}
canvas.saveLayerAlpha(rect.left, rect.top, rect.right, rect.bottom, (int) ((1.0f - SelectStatusDurationDialog.this.showT) * 255.0f), 31);
canvas.clipRect(rect);
canvas.translate((int) (SelectAnimatedEmojiDialog.this.bottomGradientView.getX() + SelectAnimatedEmojiDialog.this.contentView.getX() + SelectStatusDurationDialog.this.parentDialogX), ((int) SelectAnimatedEmojiDialog.this.bottomGradientView.getY()) + SelectAnimatedEmojiDialog.this.contentView.getY() + SelectStatusDurationDialog.this.parentDialogY);
SelectAnimatedEmojiDialog.this.bottomGradientView.draw(canvas);
canvas.restore();
} else if (SelectStatusDurationDialog.this.imageViewEmoji.isDefaultReaction && SelectStatusDurationDialog.this.imageViewEmoji.imageReceiver != null) {
SelectStatusDurationDialog.this.imageViewEmoji.imageReceiver.setAlpha(1.0f - SelectStatusDurationDialog.this.showT);
SelectStatusDurationDialog.this.imageViewEmoji.imageReceiver.setImageCoords(SelectStatusDurationDialog.this.current);
SelectStatusDurationDialog.this.imageViewEmoji.imageReceiver.draw(canvas);
}
}
if (SelectStatusDurationDialog.this.imageReceiver != null) {
SelectStatusDurationDialog.this.imageReceiver.setAlpha(SelectStatusDurationDialog.this.showT);
SelectStatusDurationDialog.this.imageReceiver.setImageCoords(SelectStatusDurationDialog.this.current);
SelectStatusDurationDialog.this.imageReceiver.draw(canvas);
}
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
SelectStatusDurationDialog.this.lastInsets = null;
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
if (SelectStatusDurationDialog.this.imageReceiver != null) {
SelectStatusDurationDialog.this.imageReceiver.onAttachedToWindow();
}
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (SelectStatusDurationDialog.this.imageReceiver != null) {
SelectStatusDurationDialog.this.imageReceiver.onDetachedFromWindow();
}
}
@Override
public void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
Activity parentActivity = SelectStatusDurationDialog.this.getParentActivity();
if (parentActivity == null) {
return;
}
View decorView = parentActivity.getWindow().getDecorView();
if (SelectStatusDurationDialog.this.blurBitmap != null && SelectStatusDurationDialog.this.blurBitmap.getWidth() == decorView.getMeasuredWidth() && SelectStatusDurationDialog.this.blurBitmap.getHeight() == decorView.getMeasuredHeight()) {
return;
}
SelectStatusDurationDialog.this.prepareBlurBitmap();
}
}
public SelectStatusDurationDialog(final Context context, Runnable parentDialogDismiss, View parentDialogView, ImageViewEmoji imageViewEmoji, Theme.ResourcesProvider resourcesProvider) {
super(context);
String str;
ImageLocation forDocument;
this.from = new Rect();
this.to = new Rect();
this.current = new Rect();
this.tempLocation = new int[2];
this.done = false;
this.dismissed = false;
this.imageViewEmoji = imageViewEmoji;
this.resourcesProvider = resourcesProvider;
this.parentDialogDismiss = parentDialogDismiss;
this.parentDialogView = parentDialogView;
ContentView contentView = new ContentView(context);
this.contentView = contentView;
setContentView(contentView, new ViewGroup.LayoutParams(-1, -1));
LinearLayout linearLayout = new LinearLayout(context);
this.linearLayoutView = linearLayout;
linearLayout.setOrientation(1);
View view = new View(context, SelectAnimatedEmojiDialog.this) {
@Override
public void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
getLocationOnScreen(SelectStatusDurationDialog.this.tempLocation);
SelectStatusDurationDialog.this.to.set(SelectStatusDurationDialog.this.tempLocation[0], SelectStatusDurationDialog.this.tempLocation[1], SelectStatusDurationDialog.this.tempLocation[0] + getWidth(), SelectStatusDurationDialog.this.tempLocation[1] + getHeight());
AndroidUtilities.lerp(SelectStatusDurationDialog.this.from, SelectStatusDurationDialog.this.to, SelectStatusDurationDialog.this.showT, SelectStatusDurationDialog.this.current);
}
};
this.emojiPreviewView = view;
this.linearLayoutView.addView(view, LayoutHelper.createLinear(160, 160, 17, 0, 0, 0, 16));
ActionBarPopupWindow.ActionBarPopupWindowLayout actionBarPopupWindowLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(context, R.drawable.popup_fixed_alert2, resourcesProvider);
this.menuView = actionBarPopupWindowLayout;
this.linearLayoutView.addView(actionBarPopupWindowLayout, LayoutHelper.createLinear(-2, -2, 17, 0, 0, 0, 0));
ActionBarMenuItem.addItem(true, false, this.menuView, 0, LocaleController.getString("SetEmojiStatusUntil1Hour", R.string.SetEmojiStatusUntil1Hour), false, resourcesProvider).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
SelectAnimatedEmojiDialog.SelectStatusDurationDialog.this.lambda$new$0(view2);
}
});
ActionBarMenuItem.addItem(false, false, this.menuView, 0, LocaleController.getString("SetEmojiStatusUntil2Hours", R.string.SetEmojiStatusUntil2Hours), false, resourcesProvider).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
SelectAnimatedEmojiDialog.SelectStatusDurationDialog.this.lambda$new$1(view2);
}
});
ActionBarMenuItem.addItem(false, false, this.menuView, 0, LocaleController.getString("SetEmojiStatusUntil8Hours", R.string.SetEmojiStatusUntil8Hours), false, resourcesProvider).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
SelectAnimatedEmojiDialog.SelectStatusDurationDialog.this.lambda$new$2(view2);
}
});
ActionBarMenuItem.addItem(false, false, this.menuView, 0, LocaleController.getString("SetEmojiStatusUntil2Days", R.string.SetEmojiStatusUntil2Days), false, resourcesProvider).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
SelectAnimatedEmojiDialog.SelectStatusDurationDialog.this.lambda$new$3(view2);
}
});
ActionBarMenuItem.addItem(false, true, this.menuView, 0, LocaleController.getString("SetEmojiStatusUntilOther", R.string.SetEmojiStatusUntilOther), false, resourcesProvider).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
SelectAnimatedEmojiDialog.SelectStatusDurationDialog.this.lambda$new$6(context, view2);
}
});
this.contentView.addView(this.linearLayoutView, LayoutHelper.createFrame(-2, -2, 17));
Window window = getWindow();
if (window != null) {
window.setWindowAnimations(R.style.DialogNoAnimation);
window.setBackgroundDrawable(null);
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.width = -1;
attributes.gravity = 51;
attributes.dimAmount = 0.0f;
int i = attributes.flags & (-3);
attributes.flags = i;
int i2 = i | 131072;
attributes.flags = i2;
int i3 = Build.VERSION.SDK_INT;
if (i3 >= 21) {
attributes.flags = i2 | (-2147417856);
this.contentView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public final WindowInsets onApplyWindowInsets(View view2, WindowInsets windowInsets) {
WindowInsets lambda$new$7;
lambda$new$7 = SelectAnimatedEmojiDialog.SelectStatusDurationDialog.this.lambda$new$7(view2, windowInsets);
return lambda$new$7;
}
});
}
attributes.flags |= 1024;
this.contentView.setFitsSystemWindows(true);
this.contentView.setSystemUiVisibility(1284);
attributes.height = -1;
if (i3 >= 28) {
attributes.layoutInDisplayCutoutMode = 1;
}
window.setAttributes(attributes);
}
if (imageViewEmoji != null) {
imageViewEmoji.notDraw = true;
}
prepareBlurBitmap();
ImageReceiver imageReceiver = new ImageReceiver();
this.imageReceiver = imageReceiver;
imageReceiver.setParentView(this.contentView);
this.imageReceiver.setLayerNum(7);
TLRPC.Document document = imageViewEmoji.document;
if (document == null) {
AnimatedEmojiDrawable animatedEmojiDrawable = imageViewEmoji.drawable;
if (animatedEmojiDrawable instanceof AnimatedEmojiDrawable) {
document = animatedEmojiDrawable.getDocument();
}
}
if (document != null) {
SvgHelper.SvgDrawable svgThumb = DocumentObject.getSvgThumb(document.thumbs, Theme.key_windowBackgroundWhiteGrayIcon, 0.2f);
TLRPC.PhotoSize closestPhotoSizeWithSize = FileLoader.getClosestPhotoSizeWithSize(document.thumbs, 90);
if ("video/webm".equals(document.mime_type)) {
ImageLocation forDocument2 = ImageLocation.getForDocument(document);
String str2 = "160_160_g";
if (svgThumb != null) {
svgThumb.overrideWidthAndHeight(512, 512);
}
forDocument = forDocument2;
str = str2;
} else {
if (svgThumb != null && MessageObject.isAnimatedStickerDocument(document, false)) {
svgThumb.overrideWidthAndHeight(512, 512);
}
str = "160_160";
forDocument = ImageLocation.getForDocument(document);
}
this.imageReceiver.setImage(forDocument, str, ImageLocation.getForDocument(closestPhotoSizeWithSize, document), "160_160", (ImageLocation) null, (String) null, svgThumb, document.size, (String) null, document, 1);
if ((imageViewEmoji.drawable instanceof AnimatedEmojiDrawable) && (MessageObject.isTextColorEmoji(document) || imageViewEmoji.drawable.canOverrideColor())) {
this.imageReceiver.setColorFilter((MessageObject.isTextColorEmoji(document) || AnimatedEmojiDrawable.isDefaultStatusEmoji(imageViewEmoji.drawable)) ? SelectAnimatedEmojiDialog.this.premiumStarColorFilter : Theme.getAnimatedEmojiColorFilter(resourcesProvider));
}
}
imageViewEmoji.getLocationOnScreen(this.tempLocation);
this.from.left = this.tempLocation[0] + imageViewEmoji.getPaddingLeft();
this.from.top = this.tempLocation[1] + imageViewEmoji.getPaddingTop();
this.from.right = (this.tempLocation[0] + imageViewEmoji.getWidth()) - imageViewEmoji.getPaddingRight();
this.from.bottom = (this.tempLocation[1] + imageViewEmoji.getHeight()) - imageViewEmoji.getPaddingBottom();
AndroidUtilities.lerp(this.from, this.to, this.showT, this.current);
parentDialogView.getLocationOnScreen(this.tempLocation);
int[] iArr = this.tempLocation;
this.parentDialogX = iArr[0];
int i4 = iArr[1];
this.parentDialogY = i4;
this.clipBottom = i4 + parentDialogView.getHeight();
}
public void lambda$new$0(View view) {
done(Integer.valueOf((int) ((System.currentTimeMillis() / 1000) + 3600)));
}
public void lambda$new$1(View view) {
done(Integer.valueOf((int) ((System.currentTimeMillis() / 1000) + 7200)));
}
public void lambda$new$2(View view) {
done(Integer.valueOf((int) ((System.currentTimeMillis() / 1000) + 28800)));
}
public void lambda$new$3(View view) {
done(Integer.valueOf((int) ((System.currentTimeMillis() / 1000) + 172800)));
}
public void lambda$new$6(Context context, View view) {
if (this.dateBottomSheet != null) {
return;
}
final boolean[] zArr = new boolean[1];
BottomSheet.Builder createStatusUntilDatePickerDialog = AlertsCreator.createStatusUntilDatePickerDialog(context, System.currentTimeMillis() / 1000, new AlertsCreator.StatusUntilDatePickerDelegate() {
public final void didSelectDate(int i) {
SelectAnimatedEmojiDialog.SelectStatusDurationDialog.this.lambda$new$4(zArr, i);
}
});
createStatusUntilDatePickerDialog.setOnPreDismissListener(new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
SelectAnimatedEmojiDialog.SelectStatusDurationDialog.this.lambda$new$5(zArr, dialogInterface);
}
});
this.dateBottomSheet = createStatusUntilDatePickerDialog.show();
animateMenuShow(false, null);
}
public void lambda$new$4(boolean[] zArr, int i) {
zArr[0] = true;
done(Integer.valueOf(i));
}
public void lambda$new$5(boolean[] zArr, DialogInterface dialogInterface) {
if (!zArr[0]) {
animateMenuShow(true, null);
}
this.dateBottomSheet = null;
}
public WindowInsets lambda$new$7(View view, WindowInsets windowInsets) {
view.requestLayout();
return Build.VERSION.SDK_INT >= 30 ? WindowInsets.CONSUMED : windowInsets.consumeSystemWindowInsets();
}
public final void done(final Integer date) {
Runnable runnable;
if (this.done) {
return;
}
this.done = true;
boolean z = date != null && getOutBounds(this.from);
this.changeToScrimColor = z;
if (z) {
this.parentDialogView.getLocationOnScreen(this.tempLocation);
Rect rect = this.from;
int[] iArr = this.tempLocation;
rect.offset(iArr[0], iArr[1]);
} else {
this.imageViewEmoji.getLocationOnScreen(this.tempLocation);
this.from.left = this.tempLocation[0] + this.imageViewEmoji.getPaddingLeft();
this.from.top = this.tempLocation[1] + this.imageViewEmoji.getPaddingTop();
this.from.right = (this.tempLocation[0] + this.imageViewEmoji.getWidth()) - this.imageViewEmoji.getPaddingRight();
this.from.bottom = (this.tempLocation[1] + this.imageViewEmoji.getHeight()) - this.imageViewEmoji.getPaddingBottom();
}
if (date != null && (runnable = this.parentDialogDismiss) != null) {
runnable.run();
}
animateShow(false, new Runnable() {
@Override
public final void run() {
SelectAnimatedEmojiDialog.SelectStatusDurationDialog.this.lambda$done$8(date);
}
}, new Runnable() {
@Override
public final void run() {
SelectAnimatedEmojiDialog.SelectStatusDurationDialog.this.lambda$done$9(date);
}
}, !z);
animateMenuShow(false, null);
}
public void lambda$done$8(Integer num) {
onEnd(num);
try {
super.dismiss();
} catch (Exception unused) {
}
}
public void lambda$done$9(Integer num) {
if (num != null) {
try {
SelectAnimatedEmojiDialog.this.performHapticFeedback(0, 1);
} catch (Exception unused) {
}
onEndPartly(num);
}
}
public final Activity getParentActivity() {
for (Context context = getContext(); context instanceof ContextWrapper; context = ((ContextWrapper) context).getBaseContext()) {
if (context instanceof Activity) {
return (Activity) context;
}
}
return null;
}
public final void prepareBlurBitmap() {
Activity parentActivity = getParentActivity();
if (parentActivity == 0) {
return;
}
View decorView = parentActivity.getWindow().getDecorView();
int measuredWidth = (int) (decorView.getMeasuredWidth() / 12.0f);
int measuredHeight = (int) (decorView.getMeasuredHeight() / 12.0f);
Bitmap createBitmap = Bitmap.createBitmap(measuredWidth, measuredHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(createBitmap);
canvas.scale(0.083333336f, 0.083333336f);
canvas.drawColor(Theme.getColor(Theme.key_windowBackgroundWhite));
decorView.draw(canvas);
if (parentActivity instanceof LaunchActivity) {
LaunchActivity launchActivity = (LaunchActivity) parentActivity;
if (launchActivity.getActionBarLayout().getLastFragment().getVisibleDialog() != null) {
launchActivity.getActionBarLayout().getLastFragment().getVisibleDialog().getWindow().getDecorView().draw(canvas);
}
}
View view = this.parentDialogView;
if (view != null) {
view.getLocationOnScreen(this.tempLocation);
canvas.save();
int[] iArr = this.tempLocation;
canvas.translate(iArr[0], iArr[1]);
this.parentDialogView.draw(canvas);
canvas.restore();
}
Utilities.stackBlurBitmap(createBitmap, Math.max(10, Math.max(measuredWidth, measuredHeight) / 180));
this.blurBitmapPaint = new Paint(1);
this.blurBitmap = createBitmap;
}
public final void animateShow(final boolean show, final Runnable onDone, final Runnable onPartly, final boolean showback) {
if (this.imageViewEmoji == null) {
if (onDone != null) {
onDone.run();
return;
}
return;
}
ValueAnimator valueAnimator = this.showAnimator;
if (valueAnimator != null) {
if (this.showing == show) {
return;
} else {
valueAnimator.cancel();
}
}
this.showing = show;
if (show) {
this.imageViewEmoji.notDraw = true;
}
final boolean[] zArr = new boolean[1];
float[] fArr = new float[2];
fArr[0] = this.showT;
fArr[1] = show ? 1.0f : 0.0f;
ValueAnimator ofFloat = ValueAnimator.ofFloat(fArr);
this.showAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
SelectAnimatedEmojiDialog.SelectStatusDurationDialog.this.lambda$animateShow$10(show, showback, onPartly, zArr, valueAnimator2);
}
});
this.showAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
Runnable runnable;
SelectStatusDurationDialog.this.showT = show ? 1.0f : 0.0f;
AndroidUtilities.lerp(SelectStatusDurationDialog.this.from, SelectStatusDurationDialog.this.to, SelectStatusDurationDialog.this.showT, SelectStatusDurationDialog.this.current);
SelectStatusDurationDialog.this.contentView.invalidate();
if (!show) {
SelectStatusDurationDialog.this.menuView.setAlpha(SelectStatusDurationDialog.this.showT);
}
if (SelectStatusDurationDialog.this.showT < 0.5f && !show && (runnable = onPartly) != null) {
boolean[] zArr2 = zArr;
if (!zArr2[0]) {
zArr2[0] = true;
runnable.run();
}
}
if (!show) {
if (showback) {
SelectStatusDurationDialog.this.imageViewEmoji.notDraw = false;
SelectAnimatedEmojiDialog.this.emojiGridView.invalidate();
}
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.startAllHeavyOperations, new Object[]{4});
}
SelectStatusDurationDialog.this.showAnimator = null;
SelectStatusDurationDialog.this.contentView.invalidate();
Runnable runnable2 = onDone;
if (runnable2 != null) {
runnable2.run();
}
}
});
this.showAnimator.setDuration(420L);
this.showAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
this.showAnimator.start();
}
public void lambda$animateShow$10(boolean z, boolean z2, Runnable runnable, boolean[] zArr, ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.showT = floatValue;
AndroidUtilities.lerp(this.from, this.to, floatValue, this.current);
this.contentView.invalidate();
if (!z) {
this.menuView.setAlpha(this.showT);
}
if (this.showT < 0.025f && !z) {
if (z2) {
this.imageViewEmoji.notDraw = false;
SelectAnimatedEmojiDialog.this.emojiGridView.invalidate();
}
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.startAllHeavyOperations, new Object[]{4});
}
if (this.showT >= 0.5f || z || runnable == null || zArr[0]) {
return;
}
zArr[0] = true;
runnable.run();
}
public final void animateMenuShow(final boolean show, final Runnable onDone) {
ValueAnimator valueAnimator = this.showMenuAnimator;
if (valueAnimator != null) {
if (this.showingMenu == show) {
return;
} else {
valueAnimator.cancel();
}
}
this.showingMenu = show;
float[] fArr = new float[2];
fArr[0] = this.showMenuT;
fArr[1] = show ? 1.0f : 0.0f;
ValueAnimator ofFloat = ValueAnimator.ofFloat(fArr);
this.showMenuAnimator = ofFloat;
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public final void onAnimationUpdate(ValueAnimator valueAnimator2) {
SelectAnimatedEmojiDialog.SelectStatusDurationDialog.this.lambda$animateMenuShow$11(valueAnimator2);
}
});
this.showMenuAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
SelectStatusDurationDialog.this.showMenuT = show ? 1.0f : 0.0f;
SelectStatusDurationDialog.this.menuView.setBackScaleY(SelectStatusDurationDialog.this.showMenuT);
SelectStatusDurationDialog.this.menuView.setAlpha(CubicBezierInterpolator.EASE_OUT.getInterpolation(SelectStatusDurationDialog.this.showMenuT));
int itemsCount = SelectStatusDurationDialog.this.menuView.getItemsCount();
for (int i = 0; i < itemsCount; i++) {
float cascade = AndroidUtilities.cascade(SelectStatusDurationDialog.this.showMenuT, i, itemsCount, 4.0f);
SelectStatusDurationDialog.this.menuView.getItemAt(i).setTranslationY((1.0f - cascade) * AndroidUtilities.dp(-12.0f));
SelectStatusDurationDialog.this.menuView.getItemAt(i).setAlpha(cascade);
}
SelectStatusDurationDialog.this.showMenuAnimator = null;
Runnable runnable = onDone;
if (runnable != null) {
runnable.run();
}
}
});
if (show) {
this.showMenuAnimator.setDuration(360L);
this.showMenuAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
} else {
this.showMenuAnimator.setDuration(240L);
this.showMenuAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT);
}
this.showMenuAnimator.start();
}
public void lambda$animateMenuShow$11(ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.showMenuT = floatValue;
this.menuView.setBackScaleY(floatValue);
this.menuView.setAlpha(CubicBezierInterpolator.EASE_OUT.getInterpolation(this.showMenuT));
int itemsCount = this.menuView.getItemsCount();
for (int i = 0; i < itemsCount; i++) {
float cascade = AndroidUtilities.cascade(this.showMenuT, i, itemsCount, 4.0f);
this.menuView.getItemAt(i).setTranslationY((1.0f - cascade) * AndroidUtilities.dp(-12.0f));
this.menuView.getItemAt(i).setAlpha(cascade);
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
boolean dispatchTouchEvent = super.dispatchTouchEvent(ev);
if (dispatchTouchEvent || ev.getAction() != 0) {
return dispatchTouchEvent;
}
dismiss();
return false;
}
@Override
public void show() {
super.show();
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.stopAllHeavyOperations, new Object[]{4});
animateShow(true, null, null, true);
animateMenuShow(true, null);
}
@Override
public void dismiss() {
if (this.dismissed) {
return;
}
done(null);
this.dismissed = true;
}
}
public void setForumIconDrawable(Drawable drawable) {
this.forumIconDrawable = drawable;
ImageViewEmoji imageViewEmoji = this.forumIconImage;
if (imageViewEmoji != null) {
imageViewEmoji.imageReceiver.setImageBitmap(drawable);
}
}
public void setAnimationsEnabled(boolean aniationsEnabled) {
this.animationsEnabled = aniationsEnabled;
}
public void setEnterAnimationInProgress(boolean enterAnimationInProgress) {
if (this.enterAnimationInProgress != enterAnimationInProgress) {
this.enterAnimationInProgress = enterAnimationInProgress;
if (enterAnimationInProgress) {
return;
}
AndroidUtilities.forEachViews(this.emojiGridView, new com.google.android.exoplayer2.util.Consumer() {
public final void accept(Object obj) {
SelectAnimatedEmojiDialog.lambda$setEnterAnimationInProgress$40((View) obj);
}
});
for (int i = 0; i < ((ScrollableHorizontalScrollView) this.emojiTabs).contentView.getChildCount(); i++) {
View childAt = ((ScrollableHorizontalScrollView) this.emojiTabs).contentView.getChildAt(i);
childAt.setScaleX(1.0f);
childAt.setScaleY(1.0f);
}
((ScrollableHorizontalScrollView) this.emojiTabs).contentView.invalidate();
}
}
public static void lambda$setEnterAnimationInProgress$40(View view) {
view.setScaleX(1.0f);
view.setScaleY(1.0f);
}
public void setBackgroundDelegate(BackgroundDelegate backgroundDelegate) {
this.backgroundDelegate = backgroundDelegate;
}
public static class SetTitleDocument extends TLRPC.Document {
public final String title;
public SetTitleDocument(String title) {
this.title = title;
}
}
public final ArrayList<TLRPC.Document> filter(ArrayList<TLRPC.Document> documents, HashSet<Long> restricted) {
if (restricted == null) {
return documents;
}
int i = 0;
while (i < documents.size()) {
TLRPC.Document document = documents.get(i);
if (document == null || restricted.contains(Long.valueOf(document.id))) {
documents.remove(i);
i--;
}
i++;
}
return documents;
}
}