导航菜单

页面标题

页面副标题

Plus 12 v10.13.1.1 - Theme.java 源代码

正在查看: Plus 12 v10.13.1.1 应用的 Theme.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package org.telegram.ui.ActionBar;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Point;
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.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.NinePatchDrawable;
import android.graphics.drawable.RippleDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.StateListDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.graphics.drawable.shapes.RectShape;
import android.graphics.drawable.shapes.RoundRectShape;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.net.Uri;
import android.os.Build;
import android.os.SystemClock;
import android.text.TextPaint;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import android.util.LongSparseArray;
import android.util.SparseArray;
import android.util.SparseIntArray;
import android.util.StateSet;
import android.view.View;
import android.widget.FrameLayout;
import androidx.core.graphics.ColorUtils;
import androidx.core.math.MathUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.lang.ref.WeakReference;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.CountDownLatch;
import org.json.JSONArray;
import org.json.JSONObject;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.DispatchQueue;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.LiteMode;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaController;
import org.telegram.messenger.MediaDataController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.MessagesController$;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.PlusUtils;
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.messenger.time.SunDate;
import org.telegram.plus.MonetHelper;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.RequestDelegate;
import org.telegram.tgnet.SerializedData;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Cells.BaseCell;
import org.telegram.ui.ChatActivity;
import org.telegram.ui.Components.AudioVisualizerDrawable;
import org.telegram.ui.Components.BackgroundGradientDrawable;
import org.telegram.ui.Components.BulletinFactory;
import org.telegram.ui.Components.ChoosingStickerStatusDrawable;
import org.telegram.ui.Components.CombinedDrawable;
import org.telegram.ui.Components.FragmentContextViewWavesDrawable;
import org.telegram.ui.Components.LinkPath;
import org.telegram.ui.Components.MotionBackgroundDrawable;
import org.telegram.ui.Components.MsgClockDrawable;
import org.telegram.ui.Components.PathAnimator;
import org.telegram.ui.Components.PlayingGameDrawable;
import org.telegram.ui.Components.Premium.PremiumGradient;
import org.telegram.ui.Components.RLottieDrawable;
import org.telegram.ui.Components.RecordStatusDrawable;
import org.telegram.ui.Components.RoundStatusDrawable;
import org.telegram.ui.Components.ScamDrawable;
import org.telegram.ui.Components.SendingFileDrawable;
import org.telegram.ui.Components.StatusDrawable;
import org.telegram.ui.Components.TypingDotsDrawable;
import org.telegram.ui.LaunchActivity;
import org.telegram.ui.RoundVideoProgressShadow;
import org.telegram.ui.ThemeActivity;
import org.telegram.ui.ThemePreviewActivity;

public class Theme {
    public static Paint DEBUG_BLUE;
    public static Paint DEBUG_RED;
    public static int FAV_INDICATOR_COLOR_DEF;
    public static Method StateListDrawable_getStateDrawableMethod;
    public static SensorEventListener ambientSensorListener;
    public static HashMap<MessageObject, AudioVisualizerDrawable> animatedOutVisualizerDrawables;
    public static SparseIntArray animatingColors;
    public static float autoNightBrighnessThreshold;
    public static String autoNightCityName;
    public static int autoNightDayEndTime;
    public static int autoNightDayStartTime;
    public static int autoNightLastSunCheckDay;
    public static double autoNightLocationLatitude;
    public static double autoNightLocationLongitude;
    public static boolean autoNightScheduleByLocation;
    public static int autoNightSunriseTime;
    public static int autoNightSunsetTime;
    public static Drawable[] avatarDrawables;
    public static Paint avatar_backgroundPaint;
    public static BackgroundGradientDrawable.Disposable backgroundGradientDisposable;
    public static Bitmap blurredBitmap;
    public static String[] bubblesNamesArray;
    public static Drawable calllog_msgCallDownGreenDrawable;
    public static Drawable calllog_msgCallDownRedDrawable;
    public static Drawable calllog_msgCallUpGreenDrawable;
    public static Drawable calllog_msgCallUpRedDrawable;
    public static boolean canStartHolidayAnimation;
    public static boolean changingWallpaper;
    public static int chatAttachBGColor;
    public static int chatAttachTextColor;
    public static boolean chatAvatarAlignTop;
    public static int chatAvatarMarginLeft;
    public static int chatAvatarRadius;
    public static int chatAvatarSize;
    public static String chatBubbleStyle;
    public static int chatBubbleStyleVal;
    public static String chatCheckStyle;
    public static int chatCheckStyleVal;
    public static int chatChecksColor;
    public static int chatContactNameColor;
    public static int chatDateBubbleColor;
    public static int chatDateColor;
    public static int chatDateSize;
    public static int chatEditTextBGColor;
    public static int chatEditTextColor;
    public static int chatEditTextIconsColor;
    public static int chatEditTextSize;
    public static int chatForwardLColor;
    public static int chatForwardRColor;
    public static int chatGradientBG;
    public static int chatGradientBGColor;
    public static int chatHeaderColor;
    public static int chatHeaderIconsColor;
    public static boolean chatHideStatusIndicator;
    public static int chatLBubbleColor;
    public static int chatLBubbleColorSelected;
    public static int chatLLinkColor;
    public static int chatLTextColor;
    public static int chatLTimeColor;
    public static int chatMemberColor;
    public static boolean chatMemberColorCheck;
    public static int chatNameColor;
    public static int chatOnlineColor;
    public static boolean chatOwnAvatarAlignTop;
    public static int chatQuickBarColor;
    public static int chatQuickBarNamesColor;
    public static int chatRBubbleColor;
    public static int chatRBubbleColorSelected;
    public static int chatRLinkColor;
    public static int chatRTextColor;
    public static int chatRTimeColor;
    public static int chatSelectedMsgBGColor;
    public static boolean chatShowContactAvatar;
    public static boolean chatShowOwnAvatar;
    public static boolean chatShowOwnAvatarGroup;
    public static boolean chatShowUsernameCheck;
    public static int chatSolidBGColor;
    public static boolean chatSolidBGColorCheck;
    public static int chatStatusColor;
    public static int chatStatusSize;
    public static int chatTimeSize;
    public static int chatTypingColor;
    public static Paint chat_actionBackgroundGradientDarkenPaint;
    public static Paint chat_actionBackgroundPaint;
    public static Paint chat_actionBackgroundSelectedPaint;
    public static TextPaint chat_actionTextPaint;
    public static TextPaint chat_actionTextPaint2;
    public static TextPaint chat_adminPaint;
    public static PorterDuffColorFilter chat_animatedEmojiTextColorFilter;
    public static RLottieDrawable[] chat_attachButtonDrawables;
    public static Drawable chat_attachEmptyDrawable;
    public static TextPaint chat_audioPerformerPaint;
    public static TextPaint chat_audioTimePaint;
    public static TextPaint chat_audioTitlePaint;
    public static TextPaint chat_botButtonPaint;
    public static Drawable chat_botCardDrawable;
    public static Drawable chat_botInlineDrawable;
    public static Drawable chat_botInviteDrawable;
    public static Drawable chat_botLinkDrawable;
    public static Drawable chat_botWebViewDrawable;
    public static Drawable chat_clearIconDrawable;
    public static Drawable chat_closeIconDrawable;
    public static Drawable chat_cloudIconDrawable;
    public static Drawable chat_commentArrowDrawable;
    public static Drawable chat_commentDrawable;
    public static Drawable chat_commentStickerDrawable;
    public static TextPaint chat_commentTextPaint;
    public static Paint chat_composeBackgroundPaint;
    public static Drawable chat_composeShadowDrawable;
    public static Drawable chat_composeShadowRoundDrawable;
    public static Drawable[] chat_contactDrawable;
    public static TextPaint chat_contactNamePaint;
    public static TextPaint chat_contactPhonePaint;
    public static TextPaint chat_contextResult_descriptionTextPaint;
    public static Drawable chat_contextResult_shadowUnderSwitchDrawable;
    public static TextPaint chat_contextResult_titleTextPaint;
    public static Drawable chat_copyIconDrawable;
    public static Drawable chat_deleteIconDrawable;
    public static Paint chat_deleteProgressPaint;
    public static Paint chat_docBackPaint;
    public static TextPaint chat_docNamePaint;
    public static TextPaint chat_durationPaint;
    public static Drawable chat_editIconDrawable;
    public static Path[] chat_filePath;
    public static Drawable[][] chat_fileStatesDrawable;
    public static Drawable chat_flameIcon;
    public static Drawable chat_forwardIconDrawable;
    public static TextPaint chat_forwardNamePaint;
    public static Drawable chat_forwardQuoteIconDrawable;
    public static TextPaint chat_gamePaint;
    public static Drawable chat_gifIcon;
    public static Drawable chat_goIconDrawable;
    public static Drawable chat_gradientLeftDrawable;
    public static Drawable chat_gradientRightDrawable;
    public static TextPaint chat_infoBoldPaint;
    public static TextPaint chat_infoPaint;
    public static Drawable chat_inlineResultAudio;
    public static Drawable chat_inlineResultFile;
    public static Drawable chat_inlineResultLocation;
    public static Paint chat_instantViewButtonPaint;
    public static TextPaint chat_instantViewPaint;
    public static Paint chat_instantViewRectPaint;
    public static TextPaint chat_livePaint;
    public static TextPaint chat_locationAddressPaint;
    public static Drawable[] chat_locationDrawable;
    public static TextPaint chat_locationTitlePaint;
    public static Drawable chat_lockIconDrawable;
    public static Drawable chat_markIconDrawable;
    public static Drawable chat_markedMsgDrawable;
    public static Paint chat_messageBackgroundSelectedPaint;
    public static Drawable chat_moreIconDrawable;
    public static AudioVisualizerDrawable chat_msgAudioVisualizeDrawable;
    public static TextPaint chat_msgBotButtonPaint;
    public static Drawable chat_msgBroadcastDrawable;
    public static Drawable chat_msgBroadcastMediaDrawable;
    public static Drawable chat_msgCallDownGreenDrawable;
    public static Drawable chat_msgCallDownRedDrawable;
    public static Drawable chat_msgCallUpGreenDrawable;
    public static MsgClockDrawable chat_msgClockDrawable;
    public static Drawable chat_msgErrorDrawable;
    public static Paint chat_msgErrorPaint;
    public static TextPaint chat_msgGameTextPaint;
    public static Drawable[] chat_msgInCallDrawable;
    public static Drawable[] chat_msgInCallSelectedDrawable;
    public static MessageDrawable chat_msgInDrawable;
    public static Drawable chat_msgInInstantDrawable;
    public static MessageDrawable chat_msgInMediaDrawable;
    public static MessageDrawable chat_msgInMediaSelectedDrawable;
    public static Drawable chat_msgInMenuDrawable;
    public static Drawable chat_msgInMenuSelectedDrawable;
    public static Drawable chat_msgInPinnedDrawable;
    public static Drawable chat_msgInPinnedSelectedDrawable;
    public static Drawable chat_msgInRepliesDrawable;
    public static Drawable chat_msgInRepliesSelectedDrawable;
    public static MessageDrawable chat_msgInSelectedDrawable;
    public static Drawable chat_msgInViewsDrawable;
    public static Drawable chat_msgInViewsSelectedDrawable;
    public static Drawable chat_msgMediaCheckDrawable;
    public static Drawable chat_msgMediaHalfCheckDrawable;
    public static Drawable chat_msgMediaMenuDrawable;
    public static Drawable chat_msgMediaPinnedDrawable;
    public static Drawable chat_msgMediaRepliesDrawable;
    public static Drawable chat_msgMediaViewsDrawable;
    public static Drawable chat_msgNoSoundDrawable;
    public static Drawable[] chat_msgOutCallDrawable;
    public static Drawable[] chat_msgOutCallSelectedDrawable;
    public static Drawable chat_msgOutCheckDrawable;
    public static Drawable chat_msgOutCheckReadDrawable;
    public static Drawable chat_msgOutCheckReadSelectedDrawable;
    public static Drawable chat_msgOutCheckSelectedDrawable;
    public static MessageDrawable chat_msgOutDrawable;
    public static Drawable chat_msgOutHalfCheckDrawable;
    public static Drawable chat_msgOutHalfCheckSelectedDrawable;
    public static Drawable chat_msgOutInstantDrawable;
    public static MessageDrawable chat_msgOutMediaDrawable;
    public static MessageDrawable chat_msgOutMediaSelectedDrawable;
    public static Drawable chat_msgOutMenuDrawable;
    public static Drawable chat_msgOutMenuSelectedDrawable;
    public static Drawable chat_msgOutPinnedDrawable;
    public static Drawable chat_msgOutPinnedSelectedDrawable;
    public static Drawable chat_msgOutRepliesDrawable;
    public static Drawable chat_msgOutRepliesSelectedDrawable;
    public static MessageDrawable chat_msgOutSelectedDrawable;
    public static Drawable chat_msgOutViewsDrawable;
    public static Drawable chat_msgOutViewsSelectedDrawable;
    public static Drawable chat_msgStickerCheckDrawable;
    public static Drawable chat_msgStickerHalfCheckDrawable;
    public static Drawable chat_msgStickerPinnedDrawable;
    public static Drawable chat_msgStickerRepliesDrawable;
    public static Drawable chat_msgStickerViewsDrawable;
    public static TextPaint chat_msgTextCode2Paint;
    public static TextPaint chat_msgTextCode3Paint;
    public static TextPaint chat_msgTextCodePaint;
    public static TextPaint chat_msgTextPaint;
    public static TextPaint[] chat_msgTextPaintEmoji;
    public static TextPaint chat_msgTextPaintOneEmoji;
    public static TextPaint chat_msgTextPaintThreeEmoji;
    public static TextPaint chat_msgTextPaintTwoEmoji;
    public static Drawable chat_msgUnlockDrawable;
    public static Drawable chat_muteIconDrawable;
    public static TextPaint chat_namePaint;
    public static PorterDuffColorFilter chat_outAnimatedEmojiTextColorFilter;
    public static Paint chat_outUrlPaint;
    public static Drawable[] chat_pollCheckDrawable;
    public static Drawable[] chat_pollCrossDrawable;
    public static Drawable[] chat_pollHintDrawable;
    public static Paint chat_pollTimerPaint;
    public static Drawable[] chat_psaHelpDrawable;
    public static TextPaint chat_quoteTextPaint;
    public static Paint chat_radialProgress2Paint;
    public static Paint chat_radialProgressPaint;
    public static Paint chat_radialProgressPausedSeekbarPaint;
    public static Drawable chat_replyIconDrawable;
    public static Paint chat_replyLinePaint;
    public static TextPaint chat_replyNamePaint;
    public static TextPaint chat_replyTextPaint;
    public static Drawable chat_reportIconDrawable;
    public static Drawable chat_roundVideoShadow;
    public static Drawable chat_shareIconDrawable;
    public static TextPaint chat_shipmentPaint;
    public static Paint chat_statusPaint;
    public static Paint chat_statusRecordPaint;
    public static StatusDrawable[] chat_status_drawables;
    public static TextPaint chat_stickerCommentCountPaint;
    public static Paint chat_textSearchSelectionPaint;
    public static Paint chat_timeBackgroundPaint;
    public static TextPaint chat_timePaint;
    public static TextPaint chat_titleLabelTextPaint;
    public static TextPaint chat_topicTextPaint;
    public static Drawable chat_translateIconDrawable;
    public static TextPaint chat_unlockExtendedMediaTextPaint;
    public static Path[] chat_updatePath;
    public static Paint chat_urlPaint;
    public static int chatsAvatarMarginLeft;
    public static int chatsAvatarRadius;
    public static int chatsAvatarSize;
    public static int chatsChecksColor;
    public static int chatsCountBGColor;
    public static int chatsCountColor;
    public static int chatsCountSize;
    public static int chatsDividerColor;
    public static int chatsFavIndicatorColor;
    public static int chatsFloatingBGColor;
    public static int chatsFloatingPencilColor;
    public static int chatsGroupNameColor;
    public static int chatsHeaderActionModeIconsColor;
    public static int chatsHeaderColor;
    public static int chatsHeaderGradient;
    public static int chatsHeaderGradientColor;
    public static int chatsHeaderIconsColor;
    public static int chatsHeaderSubtitleSize;
    public static int chatsHeaderTabActionModeColor;
    public static int chatsHeaderTabActionModeSelectedColor;
    public static int chatsHeaderTabIconColor;
    public static int chatsHeaderTabUnselectedIconColor;
    public static int chatsHeaderTitleColor;
    public static boolean chatsHideHeaderShadow;
    public static boolean chatsHideStatusIndicator;
    public static int chatsMediaColor;
    public static int chatsMemberColor;
    public static int chatsMessageColor;
    public static int chatsNameColor;
    public static int chatsNameSize;
    public static int chatsPinnedMsgBGColor;
    public static int chatsRowColor;
    public static int chatsRowGradient;
    public static int chatsRowGradientColor;
    public static int chatsTabCounterBGColor;
    public static int chatsTabCounterColor;
    public static int chatsTabCounterSilentBGColor;
    public static int chatsTabCounterSize;
    public static boolean chatsTabTitlesMode;
    public static int chatsTabsBGColor;
    public static int chatsTabsTextSize;
    public static boolean chatsTabsToBottom;
    public static int chatsUnknownNameColor;
    public static Paint checkboxSquare_backgroundPaint;
    public static Paint checkboxSquare_checkPaint;
    public static Paint checkboxSquare_eraserPaint;
    public static Integer[] checkid;
    public static String[] checksNamesArray;
    public static int colorsCount;
    public static int contactsAvatarRadius;
    public static int contactsHeaderColor;
    public static int contactsHeaderIconsColor;
    public static int contactsHeaderTitleColor;
    public static int contactsIconsColor;
    public static int contactsNameColor;
    public static int contactsNameSize;
    public static int contactsOnlineColor;
    public static int contactsRowColor;
    public static int contactsStatusColor;
    public static int contactsStatusSize;
    public static SparseIntArray currentColors;
    public static SparseIntArray currentColorsNoAccent;
    public static ThemeInfo currentDayTheme;
    public static ThemeInfo currentNightTheme;
    public static HashMap<String, Integer> currentPlusColors;
    public static Map<String, ?> currentPlusTheme;
    public static ThemeInfo currentTheme;
    public static int darkColor;
    public static int defColor;
    public static final HashMap<String, Integer> defaultChatDrawableColorKeys;
    public static final HashMap<String, Drawable> defaultChatDrawables;
    public static final HashMap<String, Integer> defaultChatPaintColors;
    public static final HashMap<String, Paint> defaultChatPaints;
    public static int[] defaultColors;
    public static HashMap<String, Integer> defaultPlusColors;
    public static ThemeInfo defaultTheme;
    public static int dialogBGColor;
    public static int dialogColor;
    public static int dialogTextColor;
    public static Drawable dialogs_FavDrawable;
    public static Paint dialogs_actionMessagePaint;
    public static RLottieDrawable dialogs_archiveAvatarDrawable;
    public static boolean dialogs_archiveAvatarDrawableRecolored;
    public static RLottieDrawable dialogs_archiveDrawable;
    public static boolean dialogs_archiveDrawableRecolored;
    public static TextPaint dialogs_archiveTextPaint;
    public static TextPaint dialogs_archiveTextPaintSmall;
    public static Drawable dialogs_botDrawable;
    public static Drawable dialogs_broadcastDrawable;
    public static Drawable dialogs_checkDrawable;
    public static Drawable dialogs_checkReadDrawable;
    public static Drawable dialogs_clockDrawable;
    public static Paint dialogs_countGrayPaint;
    public static Paint dialogs_countPaint;
    public static TextPaint dialogs_countTextPaint;
    public static Drawable dialogs_errorDrawable;
    public static Paint dialogs_errorPaint;
    public static ScamDrawable dialogs_fakeDrawable;
    public static Drawable dialogs_forum_arrowDrawable;
    public static Drawable dialogs_groupDrawable;
    public static TextPaint dialogs_groupPaint;
    public static Drawable dialogs_halfCheckDrawable;
    public static RLottieDrawable dialogs_hidePsaDrawable;
    public static boolean dialogs_hidePsaDrawableRecolored;
    public static Drawable dialogs_holidayDrawable;
    public static int dialogs_holidayDrawableOffsetX;
    public static int dialogs_holidayDrawableOffsetY;
    public static Drawable dialogs_lock2Drawable;
    public static Drawable dialogs_lockDrawable;
    public static TextPaint dialogs_mediaPaint;
    public static Drawable dialogs_mentionDrawable;
    public static TextPaint dialogs_messageNamePaint;
    public static TextPaint[] dialogs_messagePaint;
    public static TextPaint[] dialogs_messagePrintingPaint;
    public static TextPaint dialogs_messageTypingPaint;
    public static Drawable dialogs_muteDrawable;
    public static TextPaint[] dialogs_nameEncryptedPaint;
    public static TextPaint[] dialogs_namePaint;
    public static TextPaint dialogs_nameUnknownPaint;
    public static TextPaint dialogs_offlinePaint;
    public static Paint dialogs_onlineCirclePaint;
    public static TextPaint dialogs_onlinePaint;
    public static RLottieDrawable dialogs_pinArchiveDrawable;
    public static Drawable dialogs_pinnedDrawable;
    public static Paint dialogs_pinnedPaint;
    public static Drawable dialogs_playDrawable;
    public static Paint dialogs_reactionsCountPaint;
    public static Drawable dialogs_reactionsMentionDrawable;
    public static Drawable dialogs_reorderDrawable;
    public static ScamDrawable dialogs_scamDrawable;
    public static TextPaint dialogs_searchNameEncryptedPaint;
    public static TextPaint dialogs_searchNamePaint;
    public static Drawable dialogs_superGroupDrawable;
    public static RLottieDrawable dialogs_swipeDeleteDrawable;
    public static RLottieDrawable dialogs_swipeMuteDrawable;
    public static RLottieDrawable dialogs_swipePinDrawable;
    public static RLottieDrawable dialogs_swipeReadDrawable;
    public static RLottieDrawable dialogs_swipeUnmuteDrawable;
    public static RLottieDrawable dialogs_swipeUnpinDrawable;
    public static RLottieDrawable dialogs_swipeUnreadDrawable;
    public static Paint dialogs_tabletSeletedPaint;
    public static Paint dialogs_tagPaint;
    public static TextPaint dialogs_tagTextPaint;
    public static TextPaint dialogs_timePaint;
    public static RLottieDrawable dialogs_unarchiveDrawable;
    public static Drawable dialogs_unmuteDrawable;
    public static RLottieDrawable dialogs_unpinArchiveDrawable;
    public static Drawable dialogs_verifiedCheckDrawable;
    public static Drawable dialogs_verifiedDrawable;
    public static boolean disallowChangeServiceMessageColor;
    public static Paint dividerExtraPaint;
    public static Paint dividerPaint;
    public static int drawerAvatarSize;
    public static boolean drawerCenterAvatarCheck;
    public static boolean drawerHeaderBGCheck;
    public static int drawerHeaderColor;
    public static boolean drawerHideBGShadowCheck;
    public static int drawerIconColor;
    public static int drawerListColor;
    public static int drawerListDividerColor;
    public static int drawerNameColor;
    public static int drawerOptionColor;
    public static int drawerOptionSize;
    public static int drawerPhoneColor;
    public static int drawerTopShadowColor;
    public static SparseIntArray fallbackKeys;
    public static FragmentContextViewWavesDrawable fragmentContextViewWavesDrawable;
    public static boolean hasPreviousTheme;
    public static final ThreadLocal<float[]> hsvTemp1Local;
    public static final ThreadLocal<float[]> hsvTemp2Local;
    public static final ThreadLocal<float[]> hsvTemp3Local;
    public static final ThreadLocal<float[]> hsvTemp4Local;
    public static final ThreadLocal<float[]> hsvTemp5Local;
    public static Integer[] imgid;
    public static boolean isApplyingAccent;
    public static boolean isCustomTheme;
    public static boolean isInNigthMode;
    public static boolean isPatternWallpaper;
    public static boolean isWallpaperMotion;
    public static final int key_actionBarActionModeDefault;
    public static final int key_actionBarActionModeDefaultIcon;
    public static final int key_actionBarActionModeDefaultSelector;
    public static final int key_actionBarActionModeDefaultTop;
    public static final int key_actionBarActionModeReaction;
    public static final int key_actionBarActionModeReactionDot;
    public static final int key_actionBarActionModeReactionText;
    public static final int key_actionBarBrowser;
    public static final int key_actionBarDefault;
    public static final int key_actionBarDefaultArchived;
    public static final int key_actionBarDefaultArchivedIcon;
    public static final int key_actionBarDefaultArchivedSearch;
    public static final int key_actionBarDefaultArchivedSearchPlaceholder;
    public static final int key_actionBarDefaultArchivedSelector;
    public static final int key_actionBarDefaultArchivedTitle;
    public static final int key_actionBarDefaultIcon;
    public static final int key_actionBarDefaultSearch;
    public static final int key_actionBarDefaultSearchPlaceholder;
    public static final int key_actionBarDefaultSelector;
    public static final int key_actionBarDefaultSubmenuBackground;
    public static final int key_actionBarDefaultSubmenuItem;
    public static final int key_actionBarDefaultSubmenuItemIcon;
    public static final int key_actionBarDefaultSubmenuSeparator;
    public static final int key_actionBarDefaultSubtitle;
    public static final int key_actionBarDefaultTitle;
    public static final int key_actionBarTabActiveText;
    public static final int key_actionBarTabLine;
    public static final int key_actionBarTabSelector;
    public static final int key_actionBarTabUnactiveText;
    public static final int key_actionBarWhiteSelector;
    public static final int key_avatar_actionBarIconBlue;
    public static final int key_avatar_actionBarSelectorBlue;
    public static final int key_avatar_background2Blue;
    public static final int key_avatar_background2Cyan;
    public static final int key_avatar_background2Green;
    public static final int key_avatar_background2Orange;
    public static final int key_avatar_background2Pink;
    public static final int key_avatar_background2Red;
    public static final int key_avatar_background2Saved;
    public static final int key_avatar_background2Violet;
    public static final int key_avatar_backgroundActionBarBlue;
    public static final int key_avatar_backgroundArchived;
    public static final int key_avatar_backgroundArchivedHidden;
    public static final int key_avatar_backgroundBlue;
    public static final int key_avatar_backgroundCyan;
    public static final int key_avatar_backgroundGray;
    public static final int key_avatar_backgroundGreen;
    public static final int key_avatar_backgroundInProfileBlue;
    public static final int key_avatar_backgroundOrange;
    public static final int key_avatar_backgroundPink;
    public static final int key_avatar_backgroundRed;
    public static final int key_avatar_backgroundSaved;
    public static final int key_avatar_backgroundViolet;
    public static final int key_avatar_nameInMessageBlue;
    public static final int key_avatar_nameInMessageCyan;
    public static final int key_avatar_nameInMessageGreen;
    public static final int key_avatar_nameInMessageOrange;
    public static final int key_avatar_nameInMessagePink;
    public static final int key_avatar_nameInMessageRed;
    public static final int key_avatar_nameInMessageViolet;
    public static final int key_avatar_subtitleInProfileBlue;
    public static final int key_avatar_text;
    public static final int key_calls_callReceivedGreenIcon;
    public static final int key_calls_callReceivedRedIcon;
    public static final int key_changephoneinfo_image2;
    public static final int key_chat_BlurAlpha;
    public static final int key_chat_BlurAlphaSlow;
    public static final int key_chat_TextSelectionCursor;
    public static final int key_chat_addContact;
    public static final int key_chat_attachActiveTab;
    public static final int key_chat_attachAudioBackground;
    public static final int key_chat_attachAudioText;
    public static final int key_chat_attachCheckBoxBackground;
    public static final int key_chat_attachCheckBoxCheck;
    public static final int key_chat_attachContactBackground;
    public static final int key_chat_attachContactText;
    public static final int key_chat_attachEmptyImage;
    public static final int key_chat_attachFileBackground;
    public static final int key_chat_attachFileText;
    public static final int key_chat_attachGalleryBackground;
    public static final int key_chat_attachGalleryText;
    public static final int key_chat_attachIcon;
    public static final int key_chat_attachLocationBackground;
    public static final int key_chat_attachLocationText;
    public static final int key_chat_attachPermissionImage;
    public static final int key_chat_attachPermissionMark;
    public static final int key_chat_attachPermissionText;
    public static final int key_chat_attachPhotoBackground;
    public static final int key_chat_attachPollBackground;
    public static final int key_chat_attachPollText;
    public static final int key_chat_attachUnactiveTab;
    public static final int key_chat_botButtonText;
    public static final int key_chat_botKeyboardButtonBackground;
    public static final int key_chat_botKeyboardButtonBackgroundPressed;
    public static final int key_chat_botKeyboardButtonText;
    public static final int key_chat_botSwitchToInlineText;
    public static final int key_chat_editMediaButton;
    public static final int key_chat_emojiBottomPanelIcon;
    public static final int key_chat_emojiPanelBackground;
    public static final int key_chat_emojiPanelBackspace;
    public static final int key_chat_emojiPanelEmptyText;
    public static final int key_chat_emojiPanelIcon;
    public static final int key_chat_emojiPanelIconSelected;
    public static final int key_chat_emojiPanelNewTrending;
    public static final int key_chat_emojiPanelShadowLine;
    public static final int key_chat_emojiPanelStickerPackSelector;
    public static final int key_chat_emojiPanelStickerPackSelectorLine;
    public static final int key_chat_emojiPanelStickerSetName;
    public static final int key_chat_emojiPanelStickerSetNameHighlight;
    public static final int key_chat_emojiPanelStickerSetNameIcon;
    public static final int key_chat_emojiPanelTrendingDescription;
    public static final int key_chat_emojiPanelTrendingTitle;
    public static final int key_chat_emojiSearchBackground;
    public static final int key_chat_emojiSearchIcon;
    public static final int key_chat_fieldOverlayText;
    public static final int key_chat_gifSaveHintBackground;
    public static final int key_chat_gifSaveHintText;
    public static final int key_chat_goDownButton;
    public static final int key_chat_goDownButtonCounter;
    public static final int key_chat_goDownButtonCounterBackground;
    public static final int key_chat_goDownButtonIcon;
    public static final int key_chat_inAdminSelectedText;
    public static final int key_chat_inAdminText;
    public static final int key_chat_inAudioCacheSeekbar;
    public static final int key_chat_inAudioDurationSelectedText;
    public static final int key_chat_inAudioDurationText;
    public static final int key_chat_inAudioPerformerSelectedText;
    public static final int key_chat_inAudioPerformerText;
    public static final int key_chat_inAudioProgress;
    public static final int key_chat_inAudioSeekbar;
    public static final int key_chat_inAudioSeekbarFill;
    public static final int key_chat_inAudioSeekbarSelected;
    public static final int key_chat_inAudioSelectedProgress;
    public static final int key_chat_inAudioTitleText;
    public static final int key_chat_inBubble;
    public static final int key_chat_inBubbleLocationPlaceholder;
    public static final int key_chat_inBubbleSelected;
    public static final int key_chat_inBubbleSelectedOverlay;
    public static final int key_chat_inBubbleShadow;
    public static final int key_chat_inCodeBackground;
    public static final int key_chat_inContactBackground;
    public static final int key_chat_inContactIcon;
    public static final int key_chat_inContactNameText;
    public static final int key_chat_inContactPhoneSelectedText;
    public static final int key_chat_inContactPhoneText;
    public static final int key_chat_inFileBackground;
    public static final int key_chat_inFileBackgroundSelected;
    public static final int key_chat_inFileInfoSelectedText;
    public static final int key_chat_inFileInfoText;
    public static final int key_chat_inFileNameText;
    public static final int key_chat_inFileProgress;
    public static final int key_chat_inFileProgressSelected;
    public static final int key_chat_inForwardedNameText;
    public static final int key_chat_inGreenCall;
    public static final int key_chat_inInstant;
    public static final int key_chat_inInstantSelected;
    public static final int key_chat_inLoader;
    public static final int key_chat_inLoaderPhoto;
    public static final int key_chat_inLoaderSelected;
    public static final int key_chat_inLocationBackground;
    public static final int key_chat_inLocationIcon;
    public static final int key_chat_inMediaIcon;
    public static final int key_chat_inMediaIconSelected;
    public static final int key_chat_inMenu;
    public static final int key_chat_inMenuSelected;
    public static final int key_chat_inPollCorrectAnswer;
    public static final int key_chat_inPollWrongAnswer;
    public static final int key_chat_inPreviewInstantText;
    public static final int key_chat_inPreviewLine;
    public static final int key_chat_inPsaNameText;
    public static final int key_chat_inQuote;
    public static final int key_chat_inReactionButtonBackground;
    public static final int key_chat_inReactionButtonText;
    public static final int key_chat_inReactionButtonTextSelected;
    public static final int key_chat_inReplyLine;
    public static final int key_chat_inReplyMediaMessageSelectedText;
    public static final int key_chat_inReplyMediaMessageText;
    public static final int key_chat_inReplyMessageText;
    public static final int key_chat_inReplyNameText;
    public static final int key_chat_inSentClock;
    public static final int key_chat_inSentClockSelected;
    public static final int key_chat_inSiteNameText;
    public static final int key_chat_inTextSelectionHighlight;
    public static final int key_chat_inTimeSelectedText;
    public static final int key_chat_inTimeText;
    public static final int key_chat_inVenueInfoSelectedText;
    public static final int key_chat_inVenueInfoText;
    public static final int key_chat_inViaBotNameText;
    public static final int key_chat_inViews;
    public static final int key_chat_inViewsSelected;
    public static final int key_chat_inVoiceSeekbar;
    public static final int key_chat_inVoiceSeekbarFill;
    public static final int key_chat_inVoiceSeekbarSelected;
    public static final int key_chat_inlineResultIcon;
    public static final int key_chat_linkSelectBackground;
    public static final int key_chat_lockIcon;
    public static final int key_chat_mediaBroadcast;
    public static final int key_chat_mediaInfoText;
    public static final int key_chat_mediaLoaderPhoto;
    public static final int key_chat_mediaLoaderPhotoIcon;
    public static final int key_chat_mediaLoaderPhotoIconSelected;
    public static final int key_chat_mediaLoaderPhotoSelected;
    public static final int key_chat_mediaMenu;
    public static final int key_chat_mediaProgress;
    public static final int key_chat_mediaSentCheck;
    public static final int key_chat_mediaSentClock;
    public static final int key_chat_mediaTimeBackground;
    public static final int key_chat_mediaTimeText;
    public static final int key_chat_mediaViews;
    public static final int key_chat_messageLinkIn;
    public static final int key_chat_messageLinkOut;
    public static final int key_chat_messagePanelBackground;
    public static final int key_chat_messagePanelCancelInlineBot;
    public static final int key_chat_messagePanelCursor;
    public static final int key_chat_messagePanelHint;
    public static final int key_chat_messagePanelIcons;
    public static final int key_chat_messagePanelSend;
    public static final int key_chat_messagePanelShadow;
    public static final int key_chat_messagePanelText;
    public static final int key_chat_messagePanelVoiceBackground;
    public static final int key_chat_messagePanelVoiceDelete;
    public static final int key_chat_messagePanelVoiceDuration;
    public static final int key_chat_messagePanelVoiceLock;
    public static final int key_chat_messagePanelVoiceLockBackground;
    public static final int key_chat_messagePanelVoiceLockShadow;
    public static final int key_chat_messagePanelVoicePressed;
    public static final int key_chat_messageTextIn;
    public static final int key_chat_messageTextOut;
    public static final int key_chat_muteIcon;
    public static final int key_chat_outAdminSelectedText;
    public static final int key_chat_outAdminText;
    public static final int key_chat_outAudioCacheSeekbar;
    public static final int key_chat_outAudioDurationSelectedText;
    public static final int key_chat_outAudioDurationText;
    public static final int key_chat_outAudioPerformerSelectedText;
    public static final int key_chat_outAudioPerformerText;
    public static final int key_chat_outAudioProgress;
    public static final int key_chat_outAudioSeekbar;
    public static final int key_chat_outAudioSeekbarFill;
    public static final int key_chat_outAudioSeekbarSelected;
    public static final int key_chat_outAudioSelectedProgress;
    public static final int key_chat_outAudioTitleText;
    public static final int key_chat_outBroadcast;
    public static final int key_chat_outBubble;
    public static final int key_chat_outBubbleGradient1;
    public static final int key_chat_outBubbleGradient2;
    public static final int key_chat_outBubbleGradient3;
    public static final int key_chat_outBubbleGradientAnimated;
    public static final int key_chat_outBubbleGradientSelectedOverlay;
    public static final int key_chat_outBubbleLocationPlaceholder;
    public static final int key_chat_outBubbleSelected;
    public static final int key_chat_outBubbleSelectedOverlay;
    public static final int key_chat_outBubbleShadow;
    public static final int key_chat_outCodeBackground;
    public static final int key_chat_outContactBackground;
    public static final int key_chat_outContactIcon;
    public static final int key_chat_outContactNameText;
    public static final int key_chat_outContactPhoneSelectedText;
    public static final int key_chat_outContactPhoneText;
    public static final int key_chat_outFileBackground;
    public static final int key_chat_outFileBackgroundSelected;
    public static final int key_chat_outFileInfoSelectedText;
    public static final int key_chat_outFileInfoText;
    public static final int key_chat_outFileNameText;
    public static final int key_chat_outFileProgress;
    public static final int key_chat_outFileProgressSelected;
    public static final int key_chat_outForwardedNameText;
    public static final int key_chat_outGreenCall;
    public static final int key_chat_outInstant;
    public static final int key_chat_outInstantSelected;
    public static final int key_chat_outLinkSelectBackground;
    public static final int key_chat_outLoader;
    public static final int key_chat_outLoaderSelected;
    public static final int key_chat_outLocationIcon;
    public static final int key_chat_outMediaIcon;
    public static final int key_chat_outMediaIconSelected;
    public static final int key_chat_outMenu;
    public static final int key_chat_outMenuSelected;
    public static final int key_chat_outPollCorrectAnswer;
    public static final int key_chat_outPollWrongAnswer;
    public static final int key_chat_outPreviewInstantText;
    public static final int key_chat_outPreviewLine;
    public static final int key_chat_outPsaNameText;
    public static final int key_chat_outQuote;
    public static final int key_chat_outReactionButtonBackground;
    public static final int key_chat_outReactionButtonText;
    public static final int key_chat_outReactionButtonTextSelected;
    public static final int key_chat_outReplyLine;
    public static final int key_chat_outReplyLine2;
    public static final int key_chat_outReplyMediaMessageSelectedText;
    public static final int key_chat_outReplyMediaMessageText;
    public static final int key_chat_outReplyMessageText;
    public static final int key_chat_outReplyNameText;
    public static final int key_chat_outSentCheck;
    public static final int key_chat_outSentCheckRead;
    public static final int key_chat_outSentCheckReadSelected;
    public static final int key_chat_outSentCheckSelected;
    public static final int key_chat_outSentClock;
    public static final int key_chat_outSentClockSelected;
    public static final int key_chat_outSiteNameText;
    public static final int key_chat_outTextSelectionCursor;
    public static final int key_chat_outTextSelectionHighlight;
    public static final int key_chat_outTimeSelectedText;
    public static final int key_chat_outTimeText;
    public static final int key_chat_outVenueInfoSelectedText;
    public static final int key_chat_outVenueInfoText;
    public static final int key_chat_outViaBotNameText;
    public static final int key_chat_outViews;
    public static final int key_chat_outViewsSelected;
    public static final int key_chat_outVoiceSeekbar;
    public static final int key_chat_outVoiceSeekbarFill;
    public static final int key_chat_outVoiceSeekbarSelected;
    public static final int key_chat_previewDurationText;
    public static final int key_chat_previewGameText;
    public static final int key_chat_recordTime;
    public static final int key_chat_recordVoiceCancel;
    public static final int key_chat_recordedVoiceBackground;
    public static final int key_chat_recordedVoiceDot;
    public static final int key_chat_recordedVoicePlayPause;
    public static final int key_chat_recordedVoiceProgress;
    public static final int key_chat_recordedVoiceProgressInner;
    public static final int key_chat_replyPanelClose;
    public static final int key_chat_replyPanelIcons;
    public static final int key_chat_replyPanelLine;
    public static final int key_chat_replyPanelName;
    public static final int key_chat_searchPanelIcons;
    public static final int key_chat_searchPanelText;
    public static final int key_chat_secretChatStatusText;
    public static final int key_chat_secretTimeText;
    public static final int key_chat_selectedBackground;
    public static final int key_chat_sentError;
    public static final int key_chat_sentErrorIcon;
    public static final int key_chat_serviceBackground;
    public static final int key_chat_serviceBackgroundSelected;
    public static final int key_chat_serviceBackgroundSelector;
    public static final int key_chat_serviceIcon;
    public static final int key_chat_serviceLink;
    public static final int key_chat_serviceText;
    public static final int key_chat_status;
    public static final int key_chat_stickerNameText;
    public static final int key_chat_stickerReplyLine;
    public static final int key_chat_stickerReplyMessageText;
    public static final int key_chat_stickerReplyNameText;
    public static final int key_chat_stickerViaBotNameText;
    public static final int key_chat_stickersHintPanel;
    public static final int key_chat_textSelectBackground;
    public static final int key_chat_topPanelBackground;
    public static final int key_chat_topPanelClose;
    public static final int key_chat_topPanelLine;
    public static final int key_chat_topPanelMessage;
    public static final int key_chat_topPanelTitle;
    public static final int key_chat_unreadMessagesStartArrowIcon;
    public static final int key_chat_unreadMessagesStartBackground;
    public static final int key_chat_unreadMessagesStartText;
    public static final int key_chat_wallpaper;
    public static final int key_chat_wallpaper_gradient_rotation;
    public static final int key_chat_wallpaper_gradient_to1;
    public static final int key_chat_wallpaper_gradient_to2;
    public static final int key_chat_wallpaper_gradient_to3;
    public static final int key_chats_actionBackground;
    public static final int key_chats_actionIcon;
    public static final int key_chats_actionMessage;
    public static final int key_chats_actionPressedBackground;
    public static final int key_chats_archiveBackground;
    public static final int key_chats_archiveIcon;
    public static final int key_chats_archivePinBackground;
    public static final int key_chats_archivePullDownBackground;
    public static final int key_chats_archivePullDownBackgroundActive;
    public static final int key_chats_archiveText;
    public static final int key_chats_attachMessage;
    public static final int key_chats_date;
    public static final int key_chats_draft;
    public static final int key_chats_mentionIcon;
    public static final int key_chats_menuBackground;
    public static final int key_chats_menuCloud;
    public static final int key_chats_menuCloudBackgroundCats;
    public static final int key_chats_menuItemCheck;
    public static final int key_chats_menuItemIcon;
    public static final int key_chats_menuItemText;
    public static final int key_chats_menuName;
    public static final int key_chats_menuPhone;
    public static final int key_chats_menuPhoneCats;
    public static final int key_chats_menuTopBackground;
    public static final int key_chats_menuTopBackgroundCats;
    public static final int key_chats_menuTopShadow;
    public static final int key_chats_menuTopShadowCats;
    public static final int key_chats_message;
    public static final int key_chats_messageArchived;
    public static final int key_chats_message_threeLines;
    public static final int key_chats_muteIcon;
    public static final int key_chats_name;
    public static final int key_chats_nameArchived;
    public static final int key_chats_nameMessage;
    public static final int key_chats_nameMessageArchived;
    public static final int key_chats_nameMessageArchived_threeLines;
    public static final int key_chats_nameMessage_threeLines;
    public static final int key_chats_onlineCircle;
    public static final int key_chats_pinnedIcon;
    public static final int key_chats_pinnedOverlay;
    public static final int key_chats_secretIcon;
    public static final int key_chats_secretName;
    public static final int key_chats_sentCheck;
    public static final int key_chats_sentClock;
    public static final int key_chats_sentError;
    public static final int key_chats_sentErrorIcon;
    public static final int key_chats_sentReadCheck;
    public static final int key_chats_tabUnreadActiveBackground;
    public static final int key_chats_tabUnreadUnactiveBackground;
    public static final int key_chats_tabletSelectedOverlay;
    public static final int key_chats_unreadCounter;
    public static final int key_chats_unreadCounterMuted;
    public static final int key_chats_unreadCounterText;
    public static final int key_chats_verifiedBackground;
    public static final int key_chats_verifiedCheck;
    public static final int key_checkbox;
    public static final int key_checkboxCheck;
    public static final int key_checkboxDisabled;
    public static final int key_checkboxSquareBackground;
    public static final int key_checkboxSquareCheck;
    public static final int key_checkboxSquareDisabled;
    public static final int key_checkboxSquareUnchecked;
    public static final int key_code_comment;
    public static final int key_code_constant;
    public static final int key_code_function;
    public static final int key_code_keyword;
    public static final int key_code_number;
    public static final int key_code_operator;
    public static final int key_code_string;
    public static final int key_color_blue;
    public static final int key_color_cyan;
    public static final int key_color_green;
    public static final int key_color_lightblue;
    public static final int key_color_lightgreen;
    public static final int key_color_orange;
    public static final int key_color_purple;
    public static final int key_color_red;
    public static final int key_color_yellow;
    public static final int key_contacts_inviteBackground;
    public static final int key_contacts_inviteText;
    public static final int key_contextProgressInner1;
    public static final int key_contextProgressInner2;
    public static final int key_contextProgressInner3;
    public static final int key_contextProgressInner4;
    public static final int key_contextProgressOuter1;
    public static final int key_contextProgressOuter2;
    public static final int key_contextProgressOuter3;
    public static final int key_contextProgressOuter4;
    public static final int key_dialogBackground;
    public static final int key_dialogBackgroundGray;
    public static final int key_dialogButton;
    public static final int key_dialogButtonSelector;
    public static final int key_dialogCameraIcon;
    public static final int key_dialogCheckboxSquareBackground;
    public static final int key_dialogCheckboxSquareCheck;
    public static final int key_dialogCheckboxSquareDisabled;
    public static final int key_dialogCheckboxSquareUnchecked;
    public static final int key_dialogEmptyImage;
    public static final int key_dialogEmptyText;
    public static final int key_dialogFloatingButton;
    public static final int key_dialogFloatingButtonPressed;
    public static final int key_dialogFloatingIcon;
    public static final int key_dialogGrayLine;
    public static final int key_dialogIcon;
    public static final int key_dialogInputField;
    public static final int key_dialogInputFieldActivated;
    public static final int key_dialogLineProgress;
    public static final int key_dialogLineProgressBackground;
    public static final int key_dialogLinkSelection;
    public static final int key_dialogRadioBackground;
    public static final int key_dialogRadioBackgroundChecked;
    public static final int key_dialogReactionMentionBackground;
    public static final int key_dialogRoundCheckBox;
    public static final int key_dialogRoundCheckBoxCheck;
    public static final int key_dialogScrollGlow;
    public static final int key_dialogSearchBackground;
    public static final int key_dialogSearchHint;
    public static final int key_dialogSearchIcon;
    public static final int key_dialogSearchText;
    public static final int key_dialogShadowLine;
    public static final int key_dialogSwipeRemove;
    public static final int key_dialogTextBlack;
    public static final int key_dialogTextBlue;
    public static final int key_dialogTextBlue2;
    public static final int key_dialogTextBlue4;
    public static final int key_dialogTextGray;
    public static final int key_dialogTextGray2;
    public static final int key_dialogTextGray3;
    public static final int key_dialogTextGray4;
    public static final int key_dialogTextHint;
    public static final int key_dialogTextLink;
    public static final int key_dialogTopBackground;
    public static final int key_dialog_inlineProgress;
    public static final int key_dialog_inlineProgressBackground;
    public static final int key_dialog_liveLocationProgress;
    public static final int key_divider;
    public static final int key_emptyListPlaceholder;
    public static final int key_fastScrollActive;
    public static final int key_fastScrollInactive;
    public static final int key_fastScrollText;
    public static final int key_featuredStickers_addButton;
    public static final int key_featuredStickers_addButtonPressed;
    public static final int key_featuredStickers_addedIcon;
    public static final int key_featuredStickers_buttonProgress;
    public static final int key_featuredStickers_buttonText;
    public static final int key_featuredStickers_removeButtonText;
    public static final int key_featuredStickers_unread;
    public static final int key_files_folderIcon;
    public static final int key_files_folderIconBackground;
    public static final int key_files_iconText;
    public static final int key_fill_RedDark;
    public static final int key_fill_RedNormal;
    public static final int key_graySection;
    public static final int key_graySectionText;
    public static final int key_groupcreate_cursor;
    public static final int key_groupcreate_hintText;
    public static final int key_groupcreate_sectionShadow;
    public static final int key_groupcreate_sectionText;
    public static final int key_groupcreate_spanBackground;
    public static final int key_groupcreate_spanDelete;
    public static final int key_groupcreate_spanText;
    public static final int key_inappPlayerBackground;
    public static final int key_inappPlayerClose;
    public static final int key_inappPlayerPerformer;
    public static final int key_inappPlayerPlayPause;
    public static final int key_inappPlayerTitle;
    public static final int key_listSelector;
    public static final int key_location_actionActiveIcon;
    public static final int key_location_actionBackground;
    public static final int key_location_actionIcon;
    public static final int key_location_actionPressedBackground;
    public static final int key_location_liveLocationProgress;
    public static final int key_location_placeLocationBackground;
    public static final int key_location_sendLiveLocationBackground;
    public static final int key_location_sendLiveLocationIcon;
    public static final int key_location_sendLiveLocationText;
    public static final int key_location_sendLocationBackground;
    public static final int key_location_sendLocationIcon;
    public static final int key_location_sendLocationText;
    public static final int key_login_progressInner;
    public static final int key_login_progressOuter;
    public static final int key_musicPicker_buttonBackground;
    public static final int key_musicPicker_buttonIcon;
    public static final int key_musicPicker_checkbox;
    public static final int key_musicPicker_checkboxCheck;
    public static final int key_passport_authorizeBackground;
    public static final int key_passport_authorizeBackgroundSelected;
    public static final int key_passport_authorizeText;
    public static final int key_picker_badge;
    public static final int key_picker_badgeText;
    public static final int key_picker_disabledButton;
    public static final int key_picker_enabledButton;
    public static final int key_player_actionBarItems;
    public static final int key_player_actionBarSelector;
    public static final int key_player_actionBarSubtitle;
    public static final int key_player_actionBarTitle;
    public static final int key_player_background;
    public static final int key_player_button;
    public static final int key_player_buttonActive;
    public static final int key_player_progress;
    public static final int key_player_progressBackground;
    public static final int key_player_progressCachedBackground;
    public static final int key_player_time;
    public static final int key_premiumCoinGradient1;
    public static final int key_premiumCoinGradient2;
    public static final int key_premiumGradient0;
    public static final int key_premiumGradient1;
    public static final int key_premiumGradient2;
    public static final int key_premiumGradient3;
    public static final int key_premiumGradient4;
    public static final int key_premiumGradientBackground1;
    public static final int key_premiumGradientBackground2;
    public static final int key_premiumGradientBackground3;
    public static final int key_premiumGradientBackground4;
    public static final int key_premiumGradientBackgroundOverlay;
    public static final int key_premiumGradientBottomSheet1;
    public static final int key_premiumGradientBottomSheet2;
    public static final int key_premiumGradientBottomSheet3;
    public static final int key_premiumStarGradient1;
    public static final int key_premiumStarGradient2;
    public static final int key_premiumStartSmallStarsColor;
    public static final int key_premiumStartSmallStarsColor2;
    public static final int key_profile_actionBackground;
    public static final int key_profile_actionIcon;
    public static final int key_profile_actionPressedBackground;
    public static final int key_profile_creatorIcon;
    public static final int key_profile_status;
    public static final int key_profile_tabSelectedLine;
    public static final int key_profile_tabSelectedText;
    public static final int key_profile_tabSelector;
    public static final int key_profile_tabText;
    public static final int key_profile_title;
    public static final int key_profile_verifiedBackground;
    public static final int key_profile_verifiedCheck;
    public static final int key_progressCircle;
    public static final int key_radioBackground;
    public static final int key_radioBackgroundChecked;
    public static final int key_returnToCallBackground;
    public static final int key_returnToCallMutedBackground;
    public static final int key_returnToCallText;
    public static final int key_sessions_devicesImage;
    public static final int key_sharedMedia_linkPlaceholder;
    public static final int key_sharedMedia_linkPlaceholderText;
    public static final int key_sharedMedia_photoPlaceholder;
    public static final int key_sharedMedia_startStopLoadIcon;
    public static final int key_sheet_other;
    public static final int key_sheet_scrollUp;
    public static final int key_starsGradient1;
    public static final int key_starsGradient2;
    public static final int key_statisticChartActiveLine;
    public static final int key_statisticChartActivePickerChart;
    public static final int key_statisticChartBackZoomColor;
    public static final int key_statisticChartChevronColor;
    public static final int key_statisticChartHintLine;
    public static final int key_statisticChartInactivePickerChart;
    public static final int key_statisticChartLineEmpty;
    public static final int key_statisticChartLine_blue;
    public static final int key_statisticChartLine_cyan;
    public static final int key_statisticChartLine_golden;
    public static final int key_statisticChartLine_green;
    public static final int key_statisticChartLine_indigo;
    public static final int key_statisticChartLine_lightblue;
    public static final int key_statisticChartLine_lightgreen;
    public static final int key_statisticChartLine_orange;
    public static final int key_statisticChartLine_purple;
    public static final int key_statisticChartLine_red;
    public static final int key_statisticChartRipple;
    public static final int key_statisticChartSignature;
    public static final int key_statisticChartSignatureAlpha;
    public static final int key_stickers_menu;
    public static final int key_stickers_menuSelector;
    public static final int key_stories_circle1;
    public static final int key_stories_circle2;
    public static final int key_stories_circle_closeFriends1;
    public static final int key_stories_circle_closeFriends2;
    public static final int key_stories_circle_dialog1;
    public static final int key_stories_circle_dialog2;
    public static final int key_switch2Track;
    public static final int key_switch2TrackChecked;
    public static final int key_switchTrack;
    public static final int key_switchTrackBlue;
    public static final int key_switchTrackBlueChecked;
    public static final int key_switchTrackBlueSelector;
    public static final int key_switchTrackBlueSelectorChecked;
    public static final int key_switchTrackBlueThumb;
    public static final int key_switchTrackBlueThumbChecked;
    public static final int key_switchTrackChecked;
    public static final int key_table_background;
    public static final int key_table_border;
    public static final int key_tealColor;
    public static final int key_text_RedBold;
    public static final int key_text_RedRegular;
    public static final int key_topics_unreadCounter;
    public static final int key_topics_unreadCounterMuted;
    public static final int key_undo_background;
    public static final int key_undo_cancelColor;
    public static final int key_undo_infoColor;
    public static final int key_voipgroup_actionBar;
    public static final int key_voipgroup_actionBarItems;
    public static final int key_voipgroup_actionBarItemsSelector;
    public static final int key_voipgroup_actionBarUnscrolled;
    public static final int key_voipgroup_checkMenu;
    public static final int key_voipgroup_connectingProgress;
    public static final int key_voipgroup_dialogBackground;
    public static final int key_voipgroup_disabledButton;
    public static final int key_voipgroup_disabledButtonActive;
    public static final int key_voipgroup_disabledButtonActiveScrolled;
    public static final int key_voipgroup_inviteMembersBackground;
    public static final int key_voipgroup_lastSeenText;
    public static final int key_voipgroup_lastSeenTextUnscrolled;
    public static final int key_voipgroup_leaveButton;
    public static final int key_voipgroup_leaveButtonScrolled;
    public static final int key_voipgroup_leaveCallMenu;
    public static final int key_voipgroup_listSelector;
    public static final int key_voipgroup_listViewBackground;
    public static final int key_voipgroup_listViewBackgroundUnscrolled;
    public static final int key_voipgroup_listeningText;
    public static final int key_voipgroup_muteButton;
    public static final int key_voipgroup_muteButton2;
    public static final int key_voipgroup_muteButton3;
    public static final int key_voipgroup_mutedByAdminGradient;
    public static final int key_voipgroup_mutedByAdminGradient2;
    public static final int key_voipgroup_mutedByAdminGradient3;
    public static final int key_voipgroup_mutedByAdminIcon;
    public static final int key_voipgroup_mutedByAdminMuteButton;
    public static final int key_voipgroup_mutedByAdminMuteButtonDisabled;
    public static final int key_voipgroup_mutedIcon;
    public static final int key_voipgroup_mutedIconUnscrolled;
    public static final int key_voipgroup_nameText;
    public static final int key_voipgroup_overlayAlertGradientMuted;
    public static final int key_voipgroup_overlayAlertGradientMuted2;
    public static final int key_voipgroup_overlayAlertGradientUnmuted;
    public static final int key_voipgroup_overlayAlertGradientUnmuted2;
    public static final int key_voipgroup_overlayAlertMutedByAdmin;
    public static final int key_voipgroup_overlayAlertMutedByAdmin2;
    public static final int key_voipgroup_overlayBlue1;
    public static final int key_voipgroup_overlayBlue2;
    public static final int key_voipgroup_overlayGreen1;
    public static final int key_voipgroup_overlayGreen2;
    public static final int key_voipgroup_scrollUp;
    public static final int key_voipgroup_searchBackground;
    public static final int key_voipgroup_searchPlaceholder;
    public static final int key_voipgroup_searchText;
    public static final int key_voipgroup_soundButton;
    public static final int key_voipgroup_soundButton2;
    public static final int key_voipgroup_soundButtonActive;
    public static final int key_voipgroup_soundButtonActive2;
    public static final int key_voipgroup_soundButtonActive2Scrolled;
    public static final int key_voipgroup_soundButtonActiveScrolled;
    public static final int key_voipgroup_speakingText;
    public static final int key_voipgroup_topPanelBlue1;
    public static final int key_voipgroup_topPanelBlue2;
    public static final int key_voipgroup_topPanelGray;
    public static final int key_voipgroup_topPanelGreen1;
    public static final int key_voipgroup_topPanelGreen2;
    public static final int key_voipgroup_unmuteButton;
    public static final int key_voipgroup_unmuteButton2;
    public static final int key_voipgroup_windowBackgroundWhiteInputField;
    public static final int key_voipgroup_windowBackgroundWhiteInputFieldActivated;
    public static final int key_wallpaperFileOffset;
    public static final int key_windowBackgroundCheckText;
    public static final int key_windowBackgroundChecked;
    public static final int key_windowBackgroundGray;
    public static final int key_windowBackgroundGrayShadow;
    public static final int key_windowBackgroundUnchecked;
    public static final int key_windowBackgroundWhite;
    public static final int key_windowBackgroundWhiteBlackText;
    public static final int key_windowBackgroundWhiteBlueButton;
    public static final int key_windowBackgroundWhiteBlueHeader;
    public static final int key_windowBackgroundWhiteBlueIcon;
    public static final int key_windowBackgroundWhiteBlueText;
    public static final int key_windowBackgroundWhiteBlueText2;
    public static final int key_windowBackgroundWhiteBlueText3;
    public static final int key_windowBackgroundWhiteBlueText4;
    public static final int key_windowBackgroundWhiteBlueText5;
    public static final int key_windowBackgroundWhiteBlueText6;
    public static final int key_windowBackgroundWhiteBlueText7;
    public static final int key_windowBackgroundWhiteGrayIcon;
    public static final int key_windowBackgroundWhiteGrayText;
    public static final int key_windowBackgroundWhiteGrayText2;
    public static final int key_windowBackgroundWhiteGrayText3;
    public static final int key_windowBackgroundWhiteGrayText4;
    public static final int key_windowBackgroundWhiteGrayText5;
    public static final int key_windowBackgroundWhiteGrayText6;
    public static final int key_windowBackgroundWhiteGrayText7;
    public static final int key_windowBackgroundWhiteGrayText8;
    public static final int key_windowBackgroundWhiteGreenText;
    public static final int key_windowBackgroundWhiteGreenText2;
    public static final int key_windowBackgroundWhiteHintText;
    public static final int key_windowBackgroundWhiteInputField;
    public static final int key_windowBackgroundWhiteInputFieldActivated;
    public static final int key_windowBackgroundWhiteLinkSelection;
    public static final int key_windowBackgroundWhiteLinkText;
    public static final int key_windowBackgroundWhiteValueText;
    public static int[] keys_avatar_background;
    public static int[] keys_avatar_background2;
    public static int[] keys_avatar_nameInMessage;
    public static final int[] keys_colors;
    public static long lastDelayUpdateTime;
    public static WeakReference<Drawable> lastDrawableToBlur;
    public static long lastHolidayCheckTime;
    public static int lastLoadingCurrentThemeTime;
    public static int[] lastLoadingThemesTime;
    public static long lastThemeSwitchTime;
    public static int lightColor;
    public static Sensor lightSensor;
    public static boolean lightSensorRegistered;
    public static boolean linkAndClick;
    public static Paint linkSelectionPaint;
    public static int loadingCurrentTheme;
    public static boolean[] loadingRemoteThemes;
    public static Drawable moveUpDrawable;
    public static final int myMessagesBubblesEndIndex;
    public static final int myMessagesBubblesStartIndex;
    public static final int myMessagesEndIndex;
    public static final int myMessagesStartIndex;
    public static boolean needRebuild;
    public static ArrayList<ThemeInfo> otherThemes;
    public static final int pkey_chatAttachBGColor;
    public static final int pkey_chatAttachBGGradient;
    public static final int pkey_chatAttachBGGradientColor;
    public static final int pkey_chatAttachTextColor;
    public static final int pkey_chatAvatarMarginLeft;
    public static final int pkey_chatAvatarRadius;
    public static final int pkey_chatAvatarSize;
    public static final int pkey_chatChecksColor;
    public static final int pkey_chatCommandColor;
    public static final int pkey_chatContactNameColor;
    public static final int pkey_chatDateBubbleColor;
    public static final int pkey_chatDateColor;
    public static final int pkey_chatDateSize;
    public static final int pkey_chatEditTextBGColor;
    public static final int pkey_chatEditTextBGGradient;
    public static final int pkey_chatEditTextBGGradientColor;
    public static final int pkey_chatEditTextColor;
    public static final int pkey_chatEditTextIconsColor;
    public static final int pkey_chatEditTextSize;
    public static final int pkey_chatEmojiViewBGColor;
    public static final int pkey_chatEmojiViewBGGradient;
    public static final int pkey_chatEmojiViewBGGradientColor;
    public static final int pkey_chatEmojiViewTabColor;
    public static final int pkey_chatEmojiViewTabIconColor;
    public static final int pkey_chatForwardLColor;
    public static final int pkey_chatForwardRColor;
    public static final int pkey_chatGradientBG;
    public static final int pkey_chatGradientBGColor;
    public static final int pkey_chatHeaderAvatarRadius;
    public static final int pkey_chatHeaderColor;
    public static final int pkey_chatHeaderGradient;
    public static final int pkey_chatHeaderGradientColor;
    public static final int pkey_chatHeaderIconsColor;
    public static final int pkey_chatLBubbleColor;
    public static final int pkey_chatLBubbleColorSelected;
    public static final int pkey_chatLLinkColor;
    public static final int pkey_chatLTextColor;
    public static final int pkey_chatLTimeColor;
    public static final int pkey_chatMemberColor;
    public static final int pkey_chatNameColor;
    public static final int pkey_chatNameSize;
    public static final int pkey_chatOnlineColor;
    public static final int pkey_chatQuickBarColor;
    public static final int pkey_chatQuickBarNamesColor;
    public static final int pkey_chatRBubbleColor;
    public static final int pkey_chatRBubbleColorSelected;
    public static final int pkey_chatRLinkColor;
    public static final int pkey_chatRTextColor;
    public static final int pkey_chatRTimeColor;
    public static final int pkey_chatSelectedMsgBGColor;
    public static final int pkey_chatSendIconColor;
    public static final int pkey_chatSolidBGColor;
    public static final int pkey_chatStatusColor;
    public static final int pkey_chatStatusSize;
    public static final int pkey_chatTextSize;
    public static final int pkey_chatTimeSize;
    public static final int pkey_chatTypingColor;
    public static final int pkey_chatsChecksColor;
    public static final int pkey_chatsCountColor;
    public static final int pkey_chatsFloatingBGColor;
    public static final int pkey_chatsFloatingPencilColor;
    public static final int pkey_chatsGroupNameColor;
    public static final int pkey_chatsHeaderActionModeIconsColor;
    public static final int pkey_chatsHeaderColor;
    public static final int pkey_chatsHeaderIconsColor;
    public static final int pkey_chatsHeaderTabActionModeColor;
    public static final int pkey_chatsHeaderTabActionModeSelectedColor;
    public static final int pkey_chatsHeaderTabIconColor;
    public static final int pkey_chatsHeaderTabUnselectedIconColor;
    public static final int pkey_chatsHeaderTitleColor;
    public static final int pkey_chatsMediaColor;
    public static final int pkey_chatsMemberColor;
    public static final int pkey_chatsMessageColor;
    public static final int pkey_chatsNameColor;
    public static final int pkey_chatsUnknownNameColor;
    public static final int pkey_contactsAvatarRadius;
    public static final int pkey_contactsHeaderColor;
    public static final int pkey_contactsHeaderIconsColor;
    public static final int pkey_contactsHeaderTitleColor;
    public static final int pkey_contactsIconsColor;
    public static final int pkey_contactsNameColor;
    public static final int pkey_contactsNameSize;
    public static final int pkey_contactsOnlineColor;
    public static final int pkey_contactsRowColor;
    public static final int pkey_contactsStatusColor;
    public static final int pkey_contactsStatusSize;
    public static final int pkey_dialogBGColor;
    public static final int pkey_dialogColor;
    public static final int pkey_dialogTextColor;
    public static final int pkey_drawerAvatarSize;
    public static final int pkey_drawerHeaderColor;
    public static final int pkey_drawerIconColor;
    public static final int pkey_drawerListColor;
    public static final int pkey_drawerListDividerColor;
    public static final int pkey_drawerNameColor;
    public static final int pkey_drawerOptionColor;
    public static final int pkey_drawerOptionSize;
    public static final int pkey_drawerPhoneColor;
    public static final int pkey_drawerTopShadowColor;
    public static final int pkey_prefActionbarColor;
    public static final int pkey_prefActionbarIconsColor;
    public static final int pkey_prefActionbarStatusColor;
    public static final int pkey_prefActionbarTitleColor;
    public static final int pkey_prefAvatarColor;
    public static final int pkey_prefAvatarRadius;
    public static final int pkey_prefAvatarSize;
    public static final int pkey_prefBGColor;
    public static final int pkey_prefDividerColor;
    public static final int pkey_prefSectionColor;
    public static final int pkey_prefShadowColor;
    public static final int pkey_prefSummaryColor;
    public static final int pkey_prefTitleColor;
    public static final int pkey_profileActionbarAvatarRadius;
    public static final int pkey_profileActionbarGradientColor;
    public static final int pkey_profileActionbarGradientList;
    public static final int pkey_profileActionbarIconsColor;
    public static final int pkey_profileActionbarNameColor;
    public static final int pkey_profileActionbarNameSize;
    public static final int pkey_profileActionbarStatusColor;
    public static final int pkey_profileActionbarStatusSize;
    public static final int pkey_profileAdminStarColor;
    public static final int pkey_profileCreatorStarColor;
    public static final int pkey_profileRowAvatarRadius;
    public static final int pkey_profileRowColor;
    public static final int pkey_profileRowGradientColor;
    public static final int pkey_profileRowGradientList;
    public static final int pkey_profileRowIconsColor;
    public static final int pkey_profileRowOnlineColor;
    public static final int pkey_profileRowStatusColor;
    public static final int pkey_profileRowTitleColor;
    public static final int pkey_themeColor;
    public static final int pkey_themeDarkColor;
    public static final int pkey_themeLightColor;
    public static PathAnimator playPauseAnimator;
    public static boolean plusAlwaysBackToMain;
    public static boolean plusArchiveChatBySwipingToLeft;
    public static int plusArchivedChatsDefaultTab;
    public static int plusArchivedChatsDialogType;
    public static int plusArchivedChatsSelectedTab;
    public static boolean plusCategoriesHideTabs;
    public static boolean plusCenterQuickBarBtn;
    public static boolean plusChangePlayerSpeed;
    public static boolean plusChangePlayerSpeedOnly3Steps;
    public static boolean plusChatSetCustomDateAndTime;
    public static boolean plusChatShowCallButton;
    public static int plusChatsToLoad;
    public static int plusDefaultTab;
    public static int plusDialogType;
    public static boolean plusDirectShareToMenu;
    public static boolean plusDisableArchivingVibration;
    public static boolean plusDisableRestriction;
    public static boolean plusDisableShortNumberFormat;
    public static boolean plusDisableSwipeToReplyVibration;
    public static boolean plusDisableTabsAnimation;
    public static boolean plusDisableTabsScrolling;
    public static boolean plusDoNotChangeHeaderTitle;
    public static boolean plusDoNotCloseQuickBar;
    public static boolean plusDoNotHideSearchBottom;
    public static boolean plusDoNotHideStickersTab;
    public static boolean plusDrawSingleBigEmoji;
    public static boolean plusDrawerHideArchivedChats;
    public static boolean plusDrawerHideCalls;
    public static boolean plusDrawerHideCategories;
    public static boolean plusDrawerHideChannel;
    public static boolean plusDrawerHideChatsCounter;
    public static boolean plusDrawerHideContacts;
    public static boolean plusDrawerHideDownloadThemes;
    public static boolean plusDrawerHideFolders;
    public static boolean plusDrawerHideNewChannel;
    public static boolean plusDrawerHideNewDivider;
    public static boolean plusDrawerHideNewGroup;
    public static boolean plusDrawerHideNewSecretChat;
    public static boolean plusDrawerHideOffTopicGroup;
    public static boolean plusDrawerHidePeopleNearby;
    public static boolean plusDrawerHideSavedMessages;
    public static boolean plusDrawerHideSupportGroup;
    public static boolean plusDrawerHideTheming;
    public static boolean plusEnableDirectReply;
    public static boolean plusEnableMarkdown;
    public static boolean plusHideAdminTab;
    public static boolean plusHideAdminTabDirectShare;
    public static boolean plusHideAllTab;
    public static boolean plusHideAllTabDirectShare;
    public static boolean plusHideBotsTab;
    public static boolean plusHideBotsTabDirectShare;
    public static boolean plusHideBottomLayoutInChannels;
    public static boolean plusHideChannelsTab;
    public static boolean plusHideChannelsTabDirectShare;
    public static boolean plusHideCopyLinkOption;
    public static boolean plusHideCopySelectionOption;
    public static boolean plusHideFavsTab;
    public static boolean plusHideFavsTabDirectShare;
    public static boolean plusHideForwardNoQuoteOption;
    public static boolean plusHideGroupsTab;
    public static boolean plusHideGroupsTabDirectShare;
    public static boolean plusHideInstantCamera;
    public static boolean plusHideMobile;
    public static boolean plusHideMsgDetailsOption;
    public static boolean plusHideNotificationsIfPlaying;
    public static boolean plusHideQuickBarOnScroll;
    public static boolean plusHideSaveToCloudOption;
    public static boolean plusHideSuperGroupsTab;
    public static boolean plusHideSuperGroupsTabDirectShare;
    public static boolean plusHideTabs;
    public static boolean plusHideTabsCounters;
    public static boolean plusHideTabsDirectShare;
    public static boolean plusHideTabsSelector;
    public static boolean plusHideUnmutedTab;
    public static boolean plusHideUnreadTab;
    public static boolean plusHideUnreadTabDirectShare;
    public static boolean plusHideUsersTab;
    public static boolean plusHideUsersTabDirectShare;
    public static boolean plusIncreasePinnedDialogsLimit;
    public static boolean plusInfiniteTabsSwipe;
    public static boolean plusLimitTabsCounters;
    public static boolean plusLoadLastCategoryOnStart;
    public static boolean plusMakeTitleScrollable;
    public static boolean plusMoveVersionToSettings;
    public static boolean plusNightModeCheck;
    public static boolean plusOpenMenuBySwipingToRight;
    public static int plusPhotoQuality;
    public static boolean plusPhotoViewerHideStatusBar;
    public static boolean plusProfileEnableGoToMsg;
    public static int plusQuickBarDialogType;
    public static boolean plusQuickBarShowMembers;
    public static boolean plusSaveToCloudQuote;
    public static int plusSelectedTab;
    public static int plusShareAlertDefaultTab;
    public static int plusShareAlertDialogType;
    public static int plusShareAlertSelectedTab;
    public static boolean plusShowAddCategoryOption;
    public static boolean plusShowAllInAdminTab;
    public static boolean plusShowCategoriesIcon;
    public static boolean plusShowDSBtnBots;
    public static boolean plusShowDSBtnChannels;
    public static boolean plusShowDSBtnGroups;
    public static boolean plusShowDSBtnSGroups;
    public static boolean plusShowDSBtnUsers;
    public static boolean plusShowDownloadProgress;
    public static boolean plusShowEditedMark;
    public static boolean plusShowOfflineToast;
    public static boolean plusShowOnlineToast;
    public static boolean plusShowOnlyIfContactFav;
    public static boolean plusShowPhotoQualityBar;
    public static boolean plusShowQuickBar;
    public static boolean plusShowRecentActionsInChat;
    public static boolean plusShowSavedMessagesInUsersTab;
    public static boolean plusShowSelectChatsOption;
    public static boolean plusShowSortingInSubtitle;
    public static boolean plusShowSortingInSubtitleIfNotDefault;
    public static boolean plusShowTypingOnlyIfContactFav;
    public static boolean plusShowTypingToast;
    public static boolean plusShowUserBio;
    public static boolean plusShowUsername;
    public static int plusSortAdmin;
    public static int plusSortAll;
    public static int plusSortBots;
    public static int plusSortChannels;
    public static int plusSortFavs;
    public static int plusSortGroups;
    public static int plusSortSuperGroups;
    public static int plusSortUnmuted;
    public static int plusSortUnread;
    public static int plusSortUsers;
    public static boolean plusStartRoundVideoUsingMainCamera;
    public static boolean plusTabTitlesMode;
    public static int plusTabsHeight;
    public static boolean plusTabsShouldExpand;
    public static int plusTabsTextSize;
    public static boolean plusTabsToBottom;
    public static int plusToastNotificationPadding;
    public static int plusToastNotificationPosition;
    public static int plusToastNotificationSize;
    public static boolean plusToastNotificationToBottom;
    public static boolean plusVerticalQuickBar;
    public static int prefActionbarColor;
    public static int prefActionbarIconsColor;
    public static int prefActionbarStatusColor;
    public static int prefActionbarTitleColor;
    public static int prefAvatarColor;
    public static int prefAvatarRadius;
    public static int prefAvatarSize;
    public static int prefBGColor;
    public static int prefDividerColor;
    public static int prefSectionColor;
    public static int prefShadowColor;
    public static int prefSummaryColor;
    public static int prefTitleColor;
    public static int previousPhase;
    public static ThemeInfo previousTheme;
    public static int profileActionbarAvatarRadius;
    public static int profileActionbarColor;
    public static int profileActionbarGradientColor;
    public static int profileActionbarGradientList;
    public static int profileActionbarIconsColor;
    public static int profileActionbarNameColor;
    public static int profileActionbarNameSize;
    public static int profileActionbarStatusColor;
    public static int profileActionbarStatusSize;
    public static int profileRowAdminStarColor;
    public static int profileRowAvatarRadius;
    public static int profileRowColor;
    public static int profileRowCreatorStarColor;
    public static int profileRowGradientColor;
    public static int profileRowGradientList;
    public static int profileRowIconsColor;
    public static int profileRowOnlineColor;
    public static int profileRowStatusColor;
    public static int profileRowTitleColor;
    public static TextPaint profile_aboutTextPaint;
    public static Drawable profile_verifiedCheckDrawable;
    public static Drawable profile_verifiedDrawable;
    public static long[] remoteThemesHash;
    public static RoundVideoProgressShadow roundPlayDrawable;
    public static int selectedAutoNightType;
    public static SensorManager sensorManager;
    public static Bitmap serviceBitmap;
    public static Matrix serviceBitmapMatrix;
    public static BitmapShader serviceBitmapShader;
    public static int serviceMessageColor;
    public static int serviceMessageColorBackup;
    public static int serviceSelectedMessageColor;
    public static int serviceSelectedMessageColorBackup;
    public static boolean shouldDrawGradientIcons;
    public static boolean showAndroidEmoji;
    public static boolean switchDayRunnableScheduled;
    public static boolean switchNightRunnableScheduled;
    public static int switchNightThemeDelay;
    public static boolean switchingNightTheme;
    public static final int[] tabEmoticonsInt;
    public static final String[] tabEmoticonsString;
    public static final int[] tabNewIcons;
    public static final String[] tabTitles;
    public static int[] tabType;
    public static Drawable[] tabsDrawables;
    public static HashMap<String, String> telegramToPlus;
    public static HashMap<Integer, Integer> telegramToPlusInt;
    public static HashSet<Integer> themeAccentExclusionKeys;
    public static Drawable themedWallpaper;
    public static int themedWallpaperFileOffset;
    public static String themedWallpaperLink;
    public static ArrayList<ThemeInfo> themes;
    public static HashMap<String, ThemeInfo> themesDict;
    public static float[] tmpHSV5;
    public static Boolean useDeviceFont;
    public static boolean usePlusTheme;
    public static int[] viewPos;
    public static Drawable wallpaper;
    public static Runnable wallpaperLoadTask;
    public static final int default_shadow_color = ColorUtils.setAlphaComponent(-16777216, 27);
    public static final Object sync = new Object();
    public static float lastBrightnessValue = 1.0f;
    public static Runnable switchDayBrightnessRunnable = new Runnable() {
        @Override
        public void run() {
            Theme.switchDayRunnableScheduled = false;
            Theme.applyDayNightThemeMaybe(false);
        }
    };
    public static Runnable switchNightBrightnessRunnable = new Runnable() {
        @Override
        public void run() {
            Theme.switchNightRunnableScheduled = false;
            Theme.applyDayNightThemeMaybe(true);
        }
    };
    public static int DEFALT_THEME_ACCENT_ID = 99;
    public static Paint maskPaint = new Paint(1);

    public static class BackgroundDrawableSettings {
        public Boolean isCustomTheme;
        public Boolean isPatternWallpaper;
        public Boolean isWallpaperMotion;
        public Drawable themedWallpaper;
        public Drawable wallpaper;
    }

    public static float abs(float a) {
        return a > 0.0f ? a : -a;
    }

    public static void destroyResources() {
    }

    public static int getWallpaperColor(int color) {
        if (color == 0) {
            return 0;
        }
        return color | (-16777216);
    }

    public static void applyDefaultShadow(Paint paint) {
        paint.setShadowLayer(AndroidUtilities.dpf2(1.0f), 0.0f, AndroidUtilities.dpf2(0.33f), default_shadow_color);
    }

    public static Paint getThemePaint(String key, ResourcesProvider resourcesProvider) {
        Paint paint;
        return (resourcesProvider == null || (paint = resourcesProvider.getPaint(key)) == null) ? getThemePaint(key) : paint;
    }

    public static ColorFilter getAnimatedEmojiColorFilter(ResourcesProvider resourcesProvider) {
        if (resourcesProvider != null) {
            return resourcesProvider.getAnimatedEmojiColorFilter();
        }
        return chat_animatedEmojiTextColorFilter;
    }

    public static class MessageDrawable extends Drawable {
        public static MotionBackgroundDrawable[] motionBackground = new MotionBackgroundDrawable[3];
        public int alpha;
        public Drawable[][] backgroundDrawable;
        public int[][] backgroundDrawableColor;
        public Rect backupRect;
        public boolean botButtonsBottom;
        public Bitmap crosfadeFromBitmap;
        public Shader crosfadeFromBitmapShader;
        public MessageDrawable crossfadeFromDrawable;
        public float crossfadeProgress;
        public boolean currentAnimateGradient;
        public int[][] currentBackgroundDrawableRadius;
        public int currentBackgroundHeight;
        public int currentColor;
        public int currentGradientColor1;
        public int currentGradientColor2;
        public int currentGradientColor3;
        public int[] currentShadowDrawableRadius;
        public int currentType;
        public boolean drawFullBubble;
        public Shader gradientShader;
        public boolean isBottomNear;
        public boolean isCrossfadeBackground;
        public final boolean isOut;
        public boolean isSelected;
        public boolean isTopNear;
        public boolean lastDrawWithShadow;
        public Matrix matrix;
        public Drawable msgDrawable;
        public boolean nineDrawable;
        public int overrideRoundRadius;
        public float overrideRounding;
        public Paint paint;
        public Path path;
        public PathDrawParams pathDrawCacheParams;
        public RectF rect;
        public ResourcesProvider resourcesProvider;
        public Paint selectedPaint;
        public Drawable[] shadowDrawable;
        public Bitmap[] shadowDrawableBitmap;
        public int[] shadowDrawableColor;
        public boolean themePreview;
        public int topY;
        public Drawable transitionDrawable;
        public int transitionDrawableColor;

        @Override
        public int getOpacity() {
            return -2;
        }

        @Override
        public void setColorFilter(int color, PorterDuff.Mode mode) {
        }

        @Override
        public void setColorFilter(ColorFilter colorFilter) {
        }

        public MessageDrawable(int type, boolean out, boolean selected) {
            this(type, out, selected, null);
        }

        public MessageDrawable(int type, boolean out, boolean selected, ResourcesProvider resourcesProvider) {
            this.paint = new Paint(1);
            this.rect = new RectF();
            this.matrix = new Matrix();
            this.backupRect = new Rect();
            this.currentShadowDrawableRadius = new int[]{-1, -1, -1, -1};
            this.shadowDrawableBitmap = new Bitmap[4];
            this.shadowDrawable = new Drawable[4];
            this.shadowDrawableColor = new int[]{-1, -1, -1, -1};
            this.currentBackgroundDrawableRadius = new int[][]{new int[]{-1, -1, -1, -1}, new int[]{-1, -1, -1, -1}, new int[]{-1, -1, -1, -1}, new int[]{-1, -1, -1, -1}};
            this.backgroundDrawable = (Drawable[][]) Array.newInstance((Class<?>) Drawable.class, 4, 4);
            this.backgroundDrawableColor = new int[][]{new int[]{-1, -1, -1, -1}, new int[]{-1, -1, -1, -1}, new int[]{-1, -1, -1, -1}, new int[]{-1, -1, -1, -1}};
            this.resourcesProvider = resourcesProvider;
            this.isOut = out;
            this.currentType = type;
            this.isSelected = selected;
            this.path = new Path();
            this.selectedPaint = new Paint(1);
            this.alpha = 255;
        }

        public MessageDrawable(int type, boolean out, boolean selected, Drawable drawable, ResourcesProvider resourcesProvider) {
            this.paint = new Paint(1);
            this.rect = new RectF();
            this.matrix = new Matrix();
            this.backupRect = new Rect();
            this.currentShadowDrawableRadius = new int[]{-1, -1, -1, -1};
            this.shadowDrawableBitmap = new Bitmap[4];
            this.shadowDrawable = new Drawable[4];
            this.shadowDrawableColor = new int[]{-1, -1, -1, -1};
            this.currentBackgroundDrawableRadius = new int[][]{new int[]{-1, -1, -1, -1}, new int[]{-1, -1, -1, -1}, new int[]{-1, -1, -1, -1}, new int[]{-1, -1, -1, -1}};
            this.backgroundDrawable = (Drawable[][]) Array.newInstance((Class<?>) Drawable.class, 4, 4);
            this.backgroundDrawableColor = new int[][]{new int[]{-1, -1, -1, -1}, new int[]{-1, -1, -1, -1}, new int[]{-1, -1, -1, -1}, new int[]{-1, -1, -1, -1}};
            this.resourcesProvider = resourcesProvider;
            this.isOut = out;
            this.currentType = type;
            this.isSelected = selected;
            this.path = new Path();
            this.selectedPaint = new Paint(1);
            this.msgDrawable = drawable;
            this.nineDrawable = true;
        }

        public boolean hasGradient() {
            return this.gradientShader != null && Theme.shouldDrawGradientIcons;
        }

        public void applyMatrixScale() {
            Bitmap bitmap;
            if (this.gradientShader instanceof BitmapShader) {
                char c = 2;
                if (this.isCrossfadeBackground && (bitmap = this.crosfadeFromBitmap) != null) {
                    char c2 = this.currentType != 2 ? (char) 0 : (char) 1;
                    float min = 1.0f / Math.min(bitmap.getWidth() / motionBackground[c2].getBounds().width(), this.crosfadeFromBitmap.getHeight() / motionBackground[c2].getBounds().height());
                    this.matrix.postScale(min, min);
                } else {
                    if (!this.themePreview) {
                        c = this.currentType != 2 ? (char) 0 : (char) 1;
                    }
                    Bitmap bitmap2 = motionBackground[c].getBitmap();
                    float min2 = 1.0f / Math.min(bitmap2.getWidth() / motionBackground[c].getBounds().width(), bitmap2.getHeight() / motionBackground[c].getBounds().height());
                    this.matrix.postScale(min2, min2);
                }
            }
        }

        public Shader getGradientShader() {
            return this.gradientShader;
        }

        public Matrix getMatrix() {
            return this.matrix;
        }

        public int getColor(int key) {
            if (this.currentType == 2) {
                return Theme.getColor(key);
            }
            ResourcesProvider resourcesProvider = this.resourcesProvider;
            if (resourcesProvider != null) {
                return resourcesProvider.getColor(key);
            }
            return Theme.getColor(key);
        }

        public int getCurrentColor(int key) {
            if (this.currentType == 2) {
                return Theme.getColor(key);
            }
            ResourcesProvider resourcesProvider = this.resourcesProvider;
            return resourcesProvider != null ? resourcesProvider.getCurrentColor(key) : Theme.currentColors.get(key);
        }

        public void setBotButtonsBottom(boolean botButtonsBottom) {
            this.botButtonsBottom = botButtonsBottom;
        }

        public void setTop(int top, int backgroundWidth, int backgroundHeight, boolean topNear, boolean bottomNear) {
            setTop(top, backgroundWidth, backgroundHeight, backgroundHeight, 0, 0, topNear, bottomNear);
        }

        public void setTop(int top, int backgroundWidth, int backgroundHeight, int heightOffset, int blurredViewTopOffset, int blurredViewBottomOffset, boolean topNear, boolean bottomNear) {
            int color;
            int i;
            int i2;
            int i3;
            boolean z;
            ?? r16;
            int i4;
            int i5;
            MessageDrawable messageDrawable = this.crossfadeFromDrawable;
            if (messageDrawable != null) {
                messageDrawable.setTop(top, backgroundWidth, backgroundHeight, heightOffset, blurredViewTopOffset, blurredViewBottomOffset, topNear, bottomNear);
            }
            if (this.isOut) {
                if (Theme.usePlusTheme) {
                    color = this.isSelected ? Theme.chatRBubbleColorSelected : Theme.chatRBubbleColor;
                } else {
                    color = getColor(this.isSelected ? Theme.key_chat_outBubbleSelected : Theme.key_chat_outBubble);
                }
                int currentColor = getCurrentColor(Theme.key_chat_outBubbleGradient1);
                i = currentColor;
                i2 = getCurrentColor(Theme.key_chat_outBubbleGradient2);
                i3 = getCurrentColor(Theme.key_chat_outBubbleGradient3);
                z = getCurrentColor(Theme.key_chat_outBubbleGradientAnimated) != 0;
            } else {
                if (Theme.usePlusTheme) {
                    color = this.isSelected ? Theme.chatLBubbleColorSelected : Theme.chatLBubbleColor;
                } else {
                    color = getColor(this.isSelected ? Theme.key_chat_inBubbleSelected : Theme.key_chat_inBubble);
                }
                i = 0;
                i2 = 0;
                i3 = 0;
                z = false;
            }
            if (i != 0) {
                color = getColor(Theme.key_chat_outBubble);
            }
            if (this.themePreview) {
                r16 = 2;
            } else {
                r16 = this.currentType == 2;
            }
            if (!this.isCrossfadeBackground && i2 != 0 && z) {
                MotionBackgroundDrawable[] motionBackgroundDrawableArr = motionBackground;
                if (motionBackgroundDrawableArr[r16] != null) {
                    int[] colors = motionBackgroundDrawableArr[r16].getColors();
                    this.currentColor = colors[0];
                    this.currentGradientColor1 = colors[1];
                    this.currentGradientColor2 = colors[2];
                    this.currentGradientColor3 = colors[3];
                }
            }
            if (this.isCrossfadeBackground && i2 != 0 && z) {
                if (backgroundHeight == this.currentBackgroundHeight && this.crosfadeFromBitmapShader != null && this.currentColor == color && this.currentGradientColor1 == i && this.currentGradientColor2 == i2 && this.currentGradientColor3 == i3 && this.currentAnimateGradient == z) {
                    i5 = -1;
                } else {
                    if (this.crosfadeFromBitmap == null) {
                        this.crosfadeFromBitmap = Bitmap.createBitmap(60, 80, Bitmap.Config.ARGB_8888);
                        Bitmap bitmap = this.crosfadeFromBitmap;
                        Shader.TileMode tileMode = Shader.TileMode.CLAMP;
                        this.crosfadeFromBitmapShader = new BitmapShader(bitmap, tileMode, tileMode);
                    }
                    MotionBackgroundDrawable[] motionBackgroundDrawableArr2 = motionBackground;
                    if (motionBackgroundDrawableArr2[r16] == null) {
                        motionBackgroundDrawableArr2[r16] = new MotionBackgroundDrawable();
                        if (this.currentType != 2) {
                            motionBackground[r16].setPostInvalidateParent(true);
                        }
                        motionBackground[r16].setRoundRadius(dp(1.0f));
                    }
                    i5 = -1;
                    motionBackground[r16].setColors(color, i, i2, i3, this.crosfadeFromBitmap);
                    this.crosfadeFromBitmapShader.setLocalMatrix(this.matrix);
                }
                Shader shader = this.crosfadeFromBitmapShader;
                this.gradientShader = shader;
                this.paint.setShader(shader);
                this.paint.setColor(i5);
                this.currentColor = color;
                this.currentAnimateGradient = z;
                this.currentGradientColor1 = i;
                this.currentGradientColor2 = i2;
                this.currentGradientColor3 = i3;
            } else if (i != 0 && (this.gradientShader == null || backgroundHeight != this.currentBackgroundHeight || this.currentColor != color || this.currentGradientColor1 != i || this.currentGradientColor2 != i2 || this.currentGradientColor3 != i3 || this.currentAnimateGradient != z)) {
                if (i2 != 0 && z) {
                    MotionBackgroundDrawable[] motionBackgroundDrawableArr3 = motionBackground;
                    if (motionBackgroundDrawableArr3[r16] == null) {
                        motionBackgroundDrawableArr3[r16] = new MotionBackgroundDrawable();
                        if (this.currentType != 2) {
                            motionBackground[r16].setPostInvalidateParent(true);
                        }
                        motionBackground[r16].setRoundRadius(dp(1.0f));
                    }
                    motionBackground[r16].setColors(color, i, i2, i3);
                    this.gradientShader = motionBackground[r16].getBitmapShader();
                } else if (i2 == 0) {
                    this.gradientShader = new LinearGradient(0.0f, blurredViewTopOffset, 0.0f, backgroundHeight, new int[]{i, color}, (float[]) null, Shader.TileMode.CLAMP);
                } else if (i3 != 0) {
                    this.gradientShader = new LinearGradient(0.0f, blurredViewTopOffset, 0.0f, backgroundHeight, new int[]{i3, i2, i, color}, (float[]) null, Shader.TileMode.CLAMP);
                } else {
                    this.gradientShader = new LinearGradient(0.0f, blurredViewTopOffset, 0.0f, backgroundHeight, new int[]{i2, i, color}, (float[]) null, Shader.TileMode.CLAMP);
                }
                this.paint.setShader(this.gradientShader);
                this.currentColor = color;
                this.currentAnimateGradient = z;
                this.currentGradientColor1 = i;
                this.currentGradientColor2 = i2;
                this.currentGradientColor3 = i3;
                this.paint.setColor(-1);
            } else if (i == 0) {
                if (this.gradientShader != null) {
                    this.gradientShader = null;
                    this.paint.setShader(null);
                }
                this.paint.setColor(color);
            }
            if (this.gradientShader instanceof BitmapShader) {
                i4 = 0;
                motionBackground[r16].setBounds(0, blurredViewTopOffset, backgroundWidth, backgroundHeight - heightOffset);
            } else {
                i4 = 0;
            }
            this.currentBackgroundHeight = backgroundHeight;
            if (this.nineDrawable) {
                this.msgDrawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN));
            }
            if (this.gradientShader instanceof BitmapShader) {
                i4 = heightOffset;
            }
            this.topY = top - i4;
            this.isTopNear = topNear;
            this.isBottomNear = bottomNear;
        }

        public int getTopY() {
            return this.topY;
        }

        public final int dp(float value) {
            if (this.currentType == 2) {
                return (int) Math.ceil(value * 3.0f);
            }
            return AndroidUtilities.dp(value);
        }

        public Paint getPaint() {
            return this.paint;
        }

        public Drawable[] getShadowDrawables() {
            return this.shadowDrawable;
        }

        public Drawable getBackgroundDrawable() {
            char c;
            int color;
            int i = this.overrideRoundRadius;
            boolean z = false;
            if (i == 0) {
                i = this.overrideRounding > 0.0f ? 0 : dp(SharedConfig.bubbleRadius);
            }
            boolean z2 = this.isTopNear;
            char c2 = 3;
            if (z2 && this.isBottomNear) {
                c = 3;
            } else if (z2) {
                c = 2;
            } else {
                c = this.isBottomNear ? (char) 1 : (char) 0;
            }
            boolean z3 = this.isSelected;
            if (!z3 || !this.botButtonsBottom) {
                if (z3) {
                    c2 = 1;
                } else {
                    c2 = this.botButtonsBottom ? (char) 2 : (char) 0;
                }
            }
            boolean z4 = (this.gradientShader != null || z3 || this.isCrossfadeBackground) ? false : true;
            int color2 = getColor(this.isOut ? Theme.key_chat_outBubbleShadow : Theme.key_chat_inBubbleShadow);
            if (this.lastDrawWithShadow != z4 || this.currentBackgroundDrawableRadius[c2][c] != i || (z4 && this.shadowDrawableColor[c] != color2)) {
                this.currentBackgroundDrawableRadius[c2][c] = i;
                try {
                    Bitmap createBitmap = Bitmap.createBitmap(dp(50.0f), dp(40.0f), Bitmap.Config.ARGB_8888);
                    Canvas canvas = new Canvas(createBitmap);
                    this.backupRect.set(getBounds());
                    if (z4) {
                        this.shadowDrawableColor[c] = color2;
                        Paint paint = new Paint(1);
                        paint.setShader(new LinearGradient(0.0f, 0.0f, 0.0f, dp(40.0f), new int[]{358573417, 694117737}, (float[]) null, Shader.TileMode.CLAMP));
                        paint.setColorFilter(new PorterDuffColorFilter(color2, PorterDuff.Mode.MULTIPLY));
                        paint.setShadowLayer(2.0f, 0.0f, 1.0f, -1);
                        if (AndroidUtilities.density > 1.0f) {
                            setBounds(-1, -1, createBitmap.getWidth() + 1, createBitmap.getHeight() + 1);
                        } else {
                            setBounds(0, 0, createBitmap.getWidth(), createBitmap.getHeight());
                        }
                        draw(canvas, paint);
                        if (AndroidUtilities.density > 1.0f) {
                            paint.setColor(0);
                            paint.setShadowLayer(0.0f, 0.0f, 0.0f, 0);
                            paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
                            setBounds(0, 0, createBitmap.getWidth(), createBitmap.getHeight());
                            draw(canvas, paint);
                        }
                    }
                    Paint paint2 = new Paint(1);
                    paint2.setColor(-1);
                    setBounds(0, 0, createBitmap.getWidth(), createBitmap.getHeight());
                    draw(canvas, paint2);
                    this.backgroundDrawable[c2][c] = new NinePatchDrawable(createBitmap, getByteBuffer((createBitmap.getWidth() / 2) - 1, (createBitmap.getWidth() / 2) + 1, (createBitmap.getHeight() / 2) - 1, (createBitmap.getHeight() / 2) + 1).array(), new Rect(), null);
                    try {
                        setBounds(this.backupRect);
                    } catch (Throwable unused) {
                    }
                    z = true;
                } catch (Throwable unused2) {
                }
            }
            this.lastDrawWithShadow = z4;
            if (this.isSelected) {
                if (Theme.usePlusTheme) {
                    color = this.isOut ? Theme.chatRBubbleColorSelected : Theme.chatLBubbleColorSelected;
                } else {
                    color = getColor(this.isOut ? Theme.key_chat_outBubbleSelected : Theme.key_chat_inBubbleSelected);
                }
            } else {
                color = getColor(this.isOut ? Theme.key_chat_outBubble : Theme.key_chat_inBubble);
            }
            Drawable[][] drawableArr = this.backgroundDrawable;
            if (drawableArr[c2][c] != null && (this.backgroundDrawableColor[c2][c] != color || z)) {
                drawableArr[c2][c].setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
                this.backgroundDrawableColor[c2][c] = color;
            }
            return this.backgroundDrawable[c2][c];
        }

        public Drawable getTransitionDrawable(int color) {
            if (this.transitionDrawable == null) {
                Bitmap createBitmap = Bitmap.createBitmap(dp(50.0f), dp(40.0f), Bitmap.Config.ARGB_8888);
                Canvas canvas = new Canvas(createBitmap);
                this.backupRect.set(getBounds());
                Paint paint = new Paint(1);
                paint.setColor(-1);
                setBounds(0, 0, createBitmap.getWidth(), createBitmap.getHeight());
                draw(canvas, paint);
                this.transitionDrawable = new NinePatchDrawable(createBitmap, getByteBuffer((createBitmap.getWidth() / 2) - 1, (createBitmap.getWidth() / 2) + 1, (createBitmap.getHeight() / 2) - 1, (createBitmap.getHeight() / 2) + 1).array(), new Rect(), null);
                setBounds(this.backupRect);
            }
            if (this.transitionDrawableColor != color) {
                this.transitionDrawableColor = color;
                this.transitionDrawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
            }
            return this.transitionDrawable;
        }

        public MotionBackgroundDrawable getMotionBackgroundDrawable() {
            if (this.themePreview) {
                return motionBackground[2];
            }
            return motionBackground[this.currentType == 2 ? (char) 1 : (char) 0];
        }

        public Drawable getShadowDrawable() {
            char c;
            if (this.nineDrawable) {
                return this.msgDrawable;
            }
            if (this.isCrossfadeBackground) {
                return null;
            }
            if (this.gradientShader == null && !this.isSelected && this.crossfadeFromDrawable == null) {
                return null;
            }
            int dp = dp(SharedConfig.bubbleRadius);
            boolean z = this.isTopNear;
            boolean z2 = false;
            if (z && this.isBottomNear) {
                c = 3;
            } else if (z) {
                c = 2;
            } else {
                c = this.isBottomNear ? (char) 1 : (char) 0;
            }
            int[] iArr = this.currentShadowDrawableRadius;
            if (iArr[c] != dp) {
                iArr[c] = dp;
                Bitmap[] bitmapArr = this.shadowDrawableBitmap;
                if (bitmapArr[c] != null) {
                    bitmapArr[c].recycle();
                }
                try {
                    Bitmap createBitmap = Bitmap.createBitmap(dp(50.0f), dp(40.0f), Bitmap.Config.ARGB_8888);
                    Canvas canvas = new Canvas(createBitmap);
                    Paint paint = new Paint(1);
                    paint.setShader(new LinearGradient(0.0f, 0.0f, 0.0f, dp(40.0f), new int[]{358573417, 694117737}, (float[]) null, Shader.TileMode.CLAMP));
                    paint.setShadowLayer(2.0f, 0.0f, 1.0f, -1);
                    if (AndroidUtilities.density > 1.0f) {
                        setBounds(-1, -1, createBitmap.getWidth() + 1, createBitmap.getHeight() + 1);
                    } else {
                        setBounds(0, 0, createBitmap.getWidth(), createBitmap.getHeight());
                    }
                    draw(canvas, paint);
                    if (AndroidUtilities.density > 1.0f) {
                        paint.setColor(0);
                        paint.setShadowLayer(0.0f, 0.0f, 0.0f, 0);
                        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
                        setBounds(0, 0, createBitmap.getWidth(), createBitmap.getHeight());
                        draw(canvas, paint);
                    }
                    this.shadowDrawableBitmap[c] = createBitmap;
                    this.shadowDrawable[c] = new NinePatchDrawable(createBitmap, getByteBuffer((createBitmap.getWidth() / 2) - 1, (createBitmap.getWidth() / 2) + 1, (createBitmap.getHeight() / 2) - 1, (createBitmap.getHeight() / 2) + 1).array(), new Rect(), null);
                    z2 = true;
                } catch (Throwable unused) {
                }
            }
            int color = getColor(this.isOut ? Theme.key_chat_outBubbleShadow : Theme.key_chat_inBubbleShadow);
            Drawable[] drawableArr = this.shadowDrawable;
            if (drawableArr[c] != null && (this.shadowDrawableColor[c] != color || z2)) {
                drawableArr[c].setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
                this.shadowDrawableColor[c] = color;
            }
            return this.shadowDrawable[c];
        }

        public void finalize() throws Throwable {
            super.finalize();
            for (Bitmap bitmap : this.shadowDrawableBitmap) {
                if (bitmap != null) {
                    bitmap.recycle();
                }
            }
            Arrays.fill(this.shadowDrawableBitmap, (Object) null);
            Arrays.fill(this.shadowDrawable, (Object) null);
            Arrays.fill(this.currentShadowDrawableRadius, -1);
        }

        public static ByteBuffer getByteBuffer(int x1, int x2, int y1, int y2) {
            ByteBuffer order = ByteBuffer.allocate(84).order(ByteOrder.nativeOrder());
            order.put((byte) 1);
            order.put((byte) 2);
            order.put((byte) 2);
            order.put((byte) 9);
            order.putInt(0);
            order.putInt(0);
            order.putInt(0);
            order.putInt(0);
            order.putInt(0);
            order.putInt(0);
            order.putInt(0);
            order.putInt(x1);
            order.putInt(x2);
            order.putInt(y1);
            order.putInt(y2);
            order.putInt(1);
            order.putInt(1);
            order.putInt(1);
            order.putInt(1);
            order.putInt(1);
            order.putInt(1);
            order.putInt(1);
            order.putInt(1);
            order.putInt(1);
            return order;
        }

        public void drawCached(Canvas canvas, PathDrawParams patchDrawCacheParams, Paint paintToUse) {
            this.pathDrawCacheParams = patchDrawCacheParams;
            MessageDrawable messageDrawable = this.crossfadeFromDrawable;
            if (messageDrawable != null) {
                messageDrawable.pathDrawCacheParams = patchDrawCacheParams;
            }
            draw(canvas, paintToUse);
            this.pathDrawCacheParams = null;
            MessageDrawable messageDrawable2 = this.crossfadeFromDrawable;
            if (messageDrawable2 != null) {
                messageDrawable2.pathDrawCacheParams = null;
            }
        }

        public void drawCached(Canvas canvas, PathDrawParams patchDrawCacheParams) {
            drawCached(canvas, patchDrawCacheParams, null);
        }

        @Override
        public void draw(Canvas canvas) {
            MessageDrawable messageDrawable = this.crossfadeFromDrawable;
            if (messageDrawable != null) {
                messageDrawable.draw(canvas);
                setAlpha((int) (this.crossfadeProgress * 255.0f));
                draw(canvas, null);
                setAlpha(255);
                return;
            }
            draw(canvas, null);
        }

        public void draw(Canvas canvas, Paint paintToUse) {
            int dp;
            int dp2;
            int i;
            int i2;
            boolean z;
            boolean z2;
            Path path;
            boolean z3;
            Drawable backgroundDrawable;
            if (this.nineDrawable) {
                return;
            }
            Rect bounds = getBounds();
            if (paintToUse == null && this.gradientShader == null && this.overrideRoundRadius == 0 && this.overrideRounding <= 0.0f && (backgroundDrawable = getBackgroundDrawable()) != null) {
                backgroundDrawable.setBounds(bounds);
                backgroundDrawable.draw(canvas);
                return;
            }
            int dp3 = dp(2.0f);
            int i3 = this.overrideRoundRadius;
            if (i3 != 0) {
                i2 = i3;
                i = i2;
            } else {
                if (this.overrideRounding > 0.0f) {
                    dp = AndroidUtilities.lerp(dp(SharedConfig.bubbleRadius), Math.min(bounds.width(), bounds.height()) / 2, this.overrideRounding);
                    dp2 = AndroidUtilities.lerp(dp(Math.min(6, SharedConfig.bubbleRadius)), Math.min(bounds.width(), bounds.height()) / 2, this.overrideRounding);
                } else if (this.currentType == 2) {
                    dp = dp(6.0f);
                    dp2 = dp(6.0f);
                } else {
                    dp = dp(SharedConfig.bubbleRadius);
                    dp2 = dp(Math.min(6, SharedConfig.bubbleRadius));
                }
                i = dp2;
                i2 = dp;
            }
            int dp4 = dp(6.0f);
            Paint paint = paintToUse == null ? this.paint : paintToUse;
            if (paintToUse == null && this.gradientShader != null) {
                this.matrix.reset();
                applyMatrixScale();
                this.matrix.postTranslate(0.0f, -this.topY);
                this.gradientShader.setLocalMatrix(this.matrix);
            }
            int max = Math.max(bounds.top, 0);
            if (this.pathDrawCacheParams == null || bounds.height() >= this.currentBackgroundHeight) {
                boolean z4 = this.currentType != 1 ? (this.topY + bounds.bottom) - i2 < this.currentBackgroundHeight : (this.topY + bounds.bottom) - (dp4 * 2) < this.currentBackgroundHeight;
                z = this.topY + (i2 * 2) >= 0;
                z2 = z4;
            } else {
                z2 = true;
                z = true;
            }
            PathDrawParams pathDrawParams = this.pathDrawCacheParams;
            if (pathDrawParams != null) {
                path = pathDrawParams.path;
                z3 = pathDrawParams.invalidatePath(bounds, z2, z);
            } else {
                path = this.path;
                z3 = true;
            }
            if (z3 || this.overrideRoundRadius != 0) {
                generatePath(path, bounds, dp3, i2, dp4, i, max, z2, z, paintToUse != null);
            }
            canvas.drawPath(path, paint);
            if (this.gradientShader != null && this.isSelected && paintToUse == null) {
                this.selectedPaint.setColor(ColorUtils.setAlphaComponent(getColor(Theme.key_chat_outBubbleGradientSelectedOverlay), (int) ((Color.alpha(r0) * this.alpha) / 255.0f)));
                canvas.drawPath(path, this.selectedPaint);
            }
        }

        public Path makePath() {
            return makePath(this.pathDrawCacheParams);
        }

        public Path makePath(PathDrawParams pathDrawCacheParams) {
            int dp;
            int dp2;
            int i;
            int i2;
            boolean z;
            boolean z2;
            Path path;
            Rect bounds = getBounds();
            int dp3 = dp(2.0f);
            int i3 = this.overrideRoundRadius;
            if (i3 != 0) {
                i2 = i3;
                i = i2;
            } else {
                if (this.overrideRounding > 0.0f) {
                    dp = AndroidUtilities.lerp(dp(SharedConfig.bubbleRadius), Math.min(bounds.width(), bounds.height()) / 2, this.overrideRounding);
                    dp2 = AndroidUtilities.lerp(dp(Math.min(6, SharedConfig.bubbleRadius)), Math.min(bounds.width(), bounds.height()) / 2, this.overrideRounding);
                } else if (this.currentType == 2) {
                    dp = dp(6.0f);
                    dp2 = dp(6.0f);
                } else {
                    dp = dp(SharedConfig.bubbleRadius);
                    dp2 = dp(Math.min(6, SharedConfig.bubbleRadius));
                }
                i = dp2;
                i2 = dp;
            }
            int dp4 = dp(6.0f);
            int max = Math.max(bounds.top, 0);
            boolean z3 = true;
            if (pathDrawCacheParams == null || bounds.height() >= this.currentBackgroundHeight) {
                z = this.currentType != 1 ? (this.topY + bounds.bottom) - i2 < this.currentBackgroundHeight : (this.topY + bounds.bottom) - (dp4 * 2) < this.currentBackgroundHeight;
                z2 = this.topY + (i2 * 2) >= 0;
            } else {
                z = true;
                z2 = true;
            }
            if (pathDrawCacheParams != null) {
                Path path2 = pathDrawCacheParams.path;
                z3 = pathDrawCacheParams.invalidatePath(bounds, z, z2);
                path = path2;
            } else {
                path = this.path;
            }
            if (z3 || this.overrideRoundRadius != 0) {
                generatePath(path, bounds, dp3, i2, dp4, i, max, z, z2, true);
            }
            return path;
        }

        public final void generatePath(Path path, Rect bounds, int padding, int rad, int smallRad, int nearRad, int top, boolean drawFullBottom, boolean drawFullTop, boolean customPaint) {
            path.rewind();
            int height = (bounds.height() - padding) >> 1;
            int i = rad;
            if (i > height) {
                i = height;
            }
            if (this.isOut) {
                if (this.drawFullBubble || this.currentType == 2 || customPaint || drawFullBottom) {
                    int i2 = this.botButtonsBottom ? nearRad : i;
                    if (this.currentType == 1) {
                        path.moveTo((bounds.right - dp(8.0f)) - i2, bounds.bottom - padding);
                    } else {
                        path.moveTo(bounds.right - dp(2.6f), bounds.bottom - padding);
                    }
                    path.lineTo(bounds.left + padding + i2, bounds.bottom - padding);
                    RectF rectF = this.rect;
                    int i3 = bounds.left;
                    int i4 = bounds.bottom;
                    int i5 = i2 * 2;
                    rectF.set(i3 + padding, (i4 - padding) - i5, i3 + padding + i5, i4 - padding);
                    path.arcTo(this.rect, 90.0f, 90.0f, false);
                } else {
                    path.moveTo(bounds.right - dp(8.0f), (top - this.topY) + this.currentBackgroundHeight);
                    path.lineTo(bounds.left + padding, (top - this.topY) + this.currentBackgroundHeight);
                }
                if (this.drawFullBubble || this.currentType == 2 || customPaint || drawFullTop) {
                    path.lineTo(bounds.left + padding, bounds.top + padding + i);
                    RectF rectF2 = this.rect;
                    int i6 = bounds.left;
                    int i7 = bounds.top;
                    int i8 = i * 2;
                    rectF2.set(i6 + padding, i7 + padding, i6 + padding + i8, i7 + padding + i8);
                    path.arcTo(this.rect, 180.0f, 90.0f, false);
                    int i9 = this.isTopNear ? nearRad : i;
                    if (this.currentType == 1) {
                        path.lineTo((bounds.right - padding) - i9, bounds.top + padding);
                        RectF rectF3 = this.rect;
                        int i10 = bounds.right;
                        int i11 = i9 * 2;
                        int i12 = bounds.top;
                        rectF3.set((i10 - padding) - i11, i12 + padding, i10 - padding, i12 + padding + i11);
                    } else {
                        path.lineTo((bounds.right - dp(8.0f)) - i9, bounds.top + padding);
                        int i13 = i9 * 2;
                        this.rect.set((bounds.right - dp(8.0f)) - i13, bounds.top + padding, bounds.right - dp(8.0f), bounds.top + padding + i13);
                    }
                    path.arcTo(this.rect, 270.0f, 90.0f, false);
                } else {
                    path.lineTo(bounds.left + padding, (top - this.topY) - dp(2.0f));
                    if (this.currentType == 1) {
                        path.lineTo(bounds.right - padding, (top - this.topY) - dp(2.0f));
                    } else {
                        path.lineTo(bounds.right - dp(8.0f), (top - this.topY) - dp(2.0f));
                    }
                }
                int i14 = this.currentType;
                if (i14 == 1) {
                    if (customPaint || drawFullBottom) {
                        if (this.isBottomNear) {
                            i = nearRad;
                        }
                        path.lineTo(bounds.right - padding, (bounds.bottom - padding) - i);
                        RectF rectF4 = this.rect;
                        int i15 = bounds.right;
                        int i16 = i * 2;
                        int i17 = bounds.bottom;
                        rectF4.set((i15 - padding) - i16, (i17 - padding) - i16, i15 - padding, i17 - padding);
                        path.arcTo(this.rect, 0.0f, 90.0f, false);
                    } else {
                        path.lineTo(bounds.right - padding, (top - this.topY) + this.currentBackgroundHeight);
                    }
                } else if (this.drawFullBubble || i14 == 2 || customPaint || drawFullBottom) {
                    path.lineTo(bounds.right - dp(8.0f), ((bounds.bottom - padding) - smallRad) - dp(3.0f));
                    int i18 = smallRad * 2;
                    this.rect.set(bounds.right - dp(8.0f), ((bounds.bottom - padding) - i18) - dp(9.0f), (bounds.right - dp(7.0f)) + i18, (bounds.bottom - padding) - dp(1.0f));
                    path.arcTo(this.rect, 180.0f, -83.0f, false);
                } else {
                    path.lineTo(bounds.right - dp(8.0f), (top - this.topY) + this.currentBackgroundHeight);
                }
            } else {
                if (this.drawFullBubble || this.currentType == 2 || customPaint || drawFullBottom) {
                    int i19 = this.botButtonsBottom ? nearRad : i;
                    if (this.currentType == 1) {
                        path.moveTo(bounds.left + dp(8.0f) + i19, bounds.bottom - padding);
                    } else {
                        path.moveTo(bounds.left + dp(2.6f), bounds.bottom - padding);
                    }
                    path.lineTo((bounds.right - padding) - i19, bounds.bottom - padding);
                    RectF rectF5 = this.rect;
                    int i20 = bounds.right;
                    int i21 = i19 * 2;
                    int i22 = bounds.bottom;
                    rectF5.set((i20 - padding) - i21, (i22 - padding) - i21, i20 - padding, i22 - padding);
                    path.arcTo(this.rect, 90.0f, -90.0f, false);
                } else {
                    path.moveTo(bounds.left + dp(8.0f), (top - this.topY) + this.currentBackgroundHeight);
                    path.lineTo(bounds.right - padding, (top - this.topY) + this.currentBackgroundHeight);
                }
                if (this.drawFullBubble || this.currentType == 2 || customPaint || drawFullTop) {
                    path.lineTo(bounds.right - padding, bounds.top + padding + i);
                    RectF rectF6 = this.rect;
                    int i23 = bounds.right;
                    int i24 = i * 2;
                    int i25 = bounds.top;
                    rectF6.set((i23 - padding) - i24, i25 + padding, i23 - padding, i25 + padding + i24);
                    path.arcTo(this.rect, 0.0f, -90.0f, false);
                    int i26 = this.isTopNear ? nearRad : i;
                    if (this.currentType == 1) {
                        path.lineTo(bounds.left + padding + i26, bounds.top + padding);
                        RectF rectF7 = this.rect;
                        int i27 = bounds.left;
                        int i28 = bounds.top;
                        int i29 = i26 * 2;
                        rectF7.set(i27 + padding, i28 + padding, i27 + padding + i29, i28 + padding + i29);
                    } else {
                        path.lineTo(bounds.left + dp(8.0f) + i26, bounds.top + padding);
                        int i30 = i26 * 2;
                        this.rect.set(bounds.left + dp(8.0f), bounds.top + padding, bounds.left + dp(8.0f) + i30, bounds.top + padding + i30);
                    }
                    path.arcTo(this.rect, 270.0f, -90.0f, false);
                } else {
                    path.lineTo(bounds.right - padding, (top - this.topY) - dp(2.0f));
                    if (this.currentType == 1) {
                        path.lineTo(bounds.left + padding, (top - this.topY) - dp(2.0f));
                    } else {
                        path.lineTo(bounds.left + dp(8.0f), (top - this.topY) - dp(2.0f));
                    }
                }
                int i31 = this.currentType;
                if (i31 == 1) {
                    if (customPaint || drawFullBottom) {
                        if (this.isBottomNear || this.botButtonsBottom) {
                            i = nearRad;
                        }
                        path.lineTo(bounds.left + padding, (bounds.bottom - padding) - i);
                        RectF rectF8 = this.rect;
                        int i32 = bounds.left;
                        int i33 = bounds.bottom;
                        int i34 = i * 2;
                        rectF8.set(i32 + padding, (i33 - padding) - i34, i32 + padding + i34, i33 - padding);
                        path.arcTo(this.rect, 180.0f, -90.0f, false);
                    } else {
                        path.lineTo(bounds.left + padding, (top - this.topY) + this.currentBackgroundHeight);
                    }
                } else if (this.drawFullBubble || i31 == 2 || customPaint || drawFullBottom) {
                    path.lineTo(bounds.left + dp(8.0f), ((bounds.bottom - padding) - smallRad) - dp(3.0f));
                    int i35 = smallRad * 2;
                    this.rect.set((bounds.left + dp(7.0f)) - i35, ((bounds.bottom - padding) - i35) - dp(9.0f), bounds.left + dp(8.0f), (bounds.bottom - padding) - dp(1.0f));
                    path.arcTo(this.rect, 0.0f, 83.0f, false);
                } else {
                    path.lineTo(bounds.left + dp(8.0f), (top - this.topY) + this.currentBackgroundHeight);
                }
            }
            path.close();
        }

        public void setDrawFullBubble(boolean drawFullBuble) {
            this.drawFullBubble = drawFullBuble;
        }

        @Override
        public void setAlpha(int alpha) {
            if (this.alpha != alpha || this.paint.getAlpha() != alpha) {
                this.alpha = alpha;
                this.paint.setAlpha(alpha);
                if (this.isOut) {
                    this.selectedPaint.setAlpha((int) (Color.alpha(getColor(Theme.key_chat_outBubbleGradientSelectedOverlay)) * (alpha / 255.0f)));
                }
            }
            if (this.gradientShader == null) {
                Drawable backgroundDrawable = getBackgroundDrawable();
                if (Build.VERSION.SDK_INT >= 19) {
                    if (backgroundDrawable.getAlpha() != alpha) {
                        backgroundDrawable.setAlpha(alpha);
                        return;
                    }
                    return;
                }
                backgroundDrawable.setAlpha(alpha);
            }
        }

        @Override
        public void setBounds(int left, int top, int right, int bottom) {
            super.setBounds(left, top, right, bottom);
            MessageDrawable messageDrawable = this.crossfadeFromDrawable;
            if (messageDrawable != null) {
                messageDrawable.setBounds(left, top, right, bottom);
            }
        }

        public void setRoundRadius(int radius) {
            this.overrideRoundRadius = radius;
        }

        public void setRoundingRadius(float rounding) {
            this.overrideRounding = rounding;
        }

        public void setResourceProvider(ResourcesProvider resourcesProvider) {
            this.resourcesProvider = resourcesProvider;
        }

        public static class PathDrawParams {
            public boolean lastDrawFullBottom;
            public boolean lastDrawFullTop;
            public Path path = new Path();
            public Rect lastRect = new Rect();

            public boolean invalidatePath(Rect bounds, boolean drawFullBottom, boolean drawFullTop) {
                boolean z;
                if (!this.lastRect.isEmpty()) {
                    Rect rect = this.lastRect;
                    if (rect.top == bounds.top && rect.bottom == bounds.bottom && rect.right == bounds.right && rect.left == bounds.left && this.lastDrawFullTop == drawFullTop && this.lastDrawFullBottom == drawFullBottom && drawFullTop && drawFullBottom) {
                        z = false;
                        this.lastDrawFullTop = drawFullTop;
                        this.lastDrawFullBottom = drawFullBottom;
                        this.lastRect.set(bounds);
                        return z;
                    }
                }
                z = true;
                this.lastDrawFullTop = drawFullTop;
                this.lastDrawFullBottom = drawFullBottom;
                this.lastRect.set(bounds);
                return z;
            }

            public Path getPath() {
                return this.path;
            }
        }
    }

    public static class PatternsLoader implements NotificationCenter.NotificationCenterDelegate {
        public static PatternsLoader loader;
        public int account = UserConfig.selectedAccount;
        public HashMap<String, LoadingPattern> watingForLoad;

        public static class LoadingPattern {
            public ArrayList<ThemeAccent> accents;
            public TLRPC.TL_wallPaper pattern;

            public LoadingPattern() {
                this.accents = new ArrayList<>();
            }
        }

        public static void createLoader(boolean force) {
            ArrayList<ThemeAccent> arrayList;
            if (loader == null || force) {
                ArrayList arrayList2 = null;
                int i = 0;
                while (i < 6) {
                    ThemeInfo themeInfo = (ThemeInfo) Theme.themesDict.get(i != 0 ? i != 1 ? i != 2 ? i != 3 ? i != 4 ? "Amoled" : "Night" : "Day" : "Arctic Blue" : "Dark Blue" : "Blue");
                    if (themeInfo != null && (arrayList = themeInfo.themeAccents) != null && !arrayList.isEmpty()) {
                        int size = themeInfo.themeAccents.size();
                        for (int i2 = 0; i2 < size; i2++) {
                            ThemeAccent themeAccent = themeInfo.themeAccents.get(i2);
                            if (themeAccent.id != Theme.DEFALT_THEME_ACCENT_ID && !TextUtils.isEmpty(themeAccent.patternSlug)) {
                                if (arrayList2 == null) {
                                    arrayList2 = new ArrayList();
                                }
                                arrayList2.add(themeAccent);
                            }
                        }
                    }
                    i++;
                }
                loader = new PatternsLoader(arrayList2);
            }
        }

        public PatternsLoader(final ArrayList<ThemeAccent> accents) {
            if (accents == null) {
                return;
            }
            Utilities.globalQueue.postRunnable(new Runnable() {
                @Override
                public final void run() {
                    Theme.PatternsLoader.this.lambda$new$1(accents);
                }
            });
        }

        public void lambda$new$1(final ArrayList arrayList) {
            int size = arrayList.size();
            ArrayList arrayList2 = null;
            int i = 0;
            while (i < size) {
                ThemeAccent themeAccent = (ThemeAccent) arrayList.get(i);
                File pathToWallpaper = themeAccent.getPathToWallpaper();
                if (pathToWallpaper != null && pathToWallpaper.length() > 0) {
                    arrayList.remove(i);
                    i--;
                    size--;
                } else {
                    if (arrayList2 == null) {
                        arrayList2 = new ArrayList();
                    }
                    if (!arrayList2.contains(themeAccent.patternSlug)) {
                        arrayList2.add(themeAccent.patternSlug);
                    }
                }
                i++;
            }
            if (arrayList2 == null) {
                return;
            }
            TLRPC.TL_account_getMultiWallPapers tL_account_getMultiWallPapers = new TLRPC.TL_account_getMultiWallPapers();
            int size2 = arrayList2.size();
            for (int i2 = 0; i2 < size2; i2++) {
                TLRPC.TL_inputWallPaperSlug tL_inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug();
                tL_inputWallPaperSlug.slug = (String) arrayList2.get(i2);
                tL_account_getMultiWallPapers.wallpapers.add(tL_inputWallPaperSlug);
            }
            ConnectionsManager.getInstance(this.account).sendRequest(tL_account_getMultiWallPapers, new RequestDelegate() {
                public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                    Theme.PatternsLoader.this.lambda$new$0(arrayList, tLObject, tL_error);
                }
            });
        }

        public void lambda$new$0(ArrayList arrayList, TLObject tLObject, TLRPC.TL_error tL_error) {
            if (tLObject instanceof TLRPC.Vector) {
                TLRPC.Vector vector = (TLRPC.Vector) tLObject;
                int size = vector.objects.size();
                Bitmap bitmap = null;
                ArrayList<ThemeAccent> arrayList2 = null;
                int i = 0;
                while (i < size) {
                    TLRPC.TL_wallPaper tL_wallPaper = (TLRPC.WallPaper) vector.objects.get(i);
                    if (tL_wallPaper instanceof TLRPC.TL_wallPaper) {
                        TLRPC.TL_wallPaper tL_wallPaper2 = tL_wallPaper;
                        if (((TLRPC.WallPaper) tL_wallPaper2).pattern) {
                            File pathToAttach = FileLoader.getInstance(UserConfig.selectedAccount).getPathToAttach(((TLRPC.WallPaper) tL_wallPaper2).document, true);
                            int size2 = arrayList.size();
                            Bitmap bitmap2 = bitmap;
                            ?? r12 = bitmap2;
                            int i2 = 0;
                            ?? r4 = bitmap;
                            while (i2 < size2) {
                                ThemeAccent themeAccent = (ThemeAccent) arrayList.get(i2);
                                r12 = r12;
                                if (themeAccent.patternSlug.equals(((TLRPC.WallPaper) tL_wallPaper2).slug)) {
                                    if (r12 == 0) {
                                        r12 = Boolean.valueOf(pathToAttach.exists());
                                    }
                                    if (bitmap2 != null || r12.booleanValue()) {
                                        bitmap2 = createWallpaperForAccent(bitmap2, "application/x-tgwallpattern".equals(((TLRPC.WallPaper) tL_wallPaper2).document.mime_type), pathToAttach, themeAccent);
                                        if (arrayList2 == null) {
                                            arrayList2 = new ArrayList<>();
                                        }
                                        arrayList2.add(themeAccent);
                                    } else {
                                        String attachFileName = FileLoader.getAttachFileName(((TLRPC.WallPaper) tL_wallPaper2).document);
                                        if (this.watingForLoad == null) {
                                            this.watingForLoad = new HashMap<>();
                                        }
                                        LoadingPattern loadingPattern = this.watingForLoad.get(attachFileName);
                                        if (loadingPattern == null) {
                                            loadingPattern = new LoadingPattern();
                                            loadingPattern.pattern = tL_wallPaper2;
                                            this.watingForLoad.put(attachFileName, loadingPattern);
                                        }
                                        loadingPattern.accents.add(themeAccent);
                                    }
                                }
                                i2++;
                                r4 = 0;
                                r12 = r12;
                            }
                            if (bitmap2 != null) {
                                bitmap2.recycle();
                            }
                            i++;
                            bitmap = null;
                        }
                    }
                    i++;
                    bitmap = null;
                }
                checkCurrentWallpaper(arrayList2, true);
            }
        }

        public final void checkCurrentWallpaper(final ArrayList<ThemeAccent> accents, final boolean load) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    Theme.PatternsLoader.this.lambda$checkCurrentWallpaper$2(accents, load);
                }
            });
        }

        public final void lambda$checkCurrentWallpaper$2(ArrayList<ThemeAccent> accents, boolean load) {
            if (accents != null && Theme.currentTheme.themeAccents != null && !Theme.currentTheme.themeAccents.isEmpty() && accents.contains(Theme.currentTheme.getAccent(false))) {
                Theme.reloadWallpaper(true);
            }
            if (load) {
                if (this.watingForLoad != null) {
                    NotificationCenter.getInstance(this.account).addObserver(this, NotificationCenter.fileLoaded);
                    NotificationCenter.getInstance(this.account).addObserver(this, NotificationCenter.fileLoadFailed);
                    Iterator<Map.Entry<String, LoadingPattern>> it = this.watingForLoad.entrySet().iterator();
                    while (it.hasNext()) {
                        FileLoader.getInstance(this.account).loadFile(ImageLocation.getForDocument(((TLRPC.WallPaper) it.next().getValue().pattern).document), "wallpaper", (String) null, 0, 1);
                    }
                    return;
                }
                return;
            }
            HashMap<String, LoadingPattern> hashMap = this.watingForLoad;
            if (hashMap == null || hashMap.isEmpty()) {
                NotificationCenter.getInstance(this.account).removeObserver(this, NotificationCenter.fileLoaded);
                NotificationCenter.getInstance(this.account).removeObserver(this, NotificationCenter.fileLoadFailed);
            }
        }

        public final Bitmap createWallpaperForAccent(Bitmap patternBitmap, boolean svg, File patternPath, ThemeAccent accent) {
            Bitmap bitmap;
            File pathToWallpaper;
            ColorDrawable colorDrawable;
            int patternColor;
            Bitmap loadScreenSizedBitmap;
            int i;
            int i2;
            int i3;
            try {
                pathToWallpaper = accent.getPathToWallpaper();
                colorDrawable = null;
            } catch (Throwable th) {
                th = th;
                bitmap = patternBitmap;
            }
            if (pathToWallpaper == null) {
                return null;
            }
            ThemeInfo themeInfo = accent.parentTheme;
            SparseIntArray themeFileValues = Theme.getThemeFileValues(null, themeInfo.assetName, null);
            Theme.checkIsDark(themeFileValues, themeInfo);
            int i4 = accent.accentColor;
            int i5 = (int) accent.backgroundOverrideColor;
            long j = accent.backgroundGradientOverrideColor1;
            int i6 = (int) j;
            if (i6 == 0 && j == 0) {
                if (i5 != 0) {
                    i4 = i5;
                }
                int i7 = themeFileValues.get(Theme.key_chat_wallpaper_gradient_to1);
                if (i7 != 0) {
                    i6 = Theme.changeColorAccent(themeInfo, i4, i7);
                }
            } else {
                i4 = 0;
            }
            long j2 = accent.backgroundGradientOverrideColor2;
            int i8 = (int) j2;
            if (i8 == 0 && j2 == 0 && (i3 = themeFileValues.get(Theme.key_chat_wallpaper_gradient_to2)) != 0) {
                i8 = Theme.changeColorAccent(themeInfo, i4, i3);
            }
            long j3 = accent.backgroundGradientOverrideColor3;
            int i9 = (int) j3;
            if (i9 == 0 && j3 == 0 && (i2 = themeFileValues.get(Theme.key_chat_wallpaper_gradient_to3)) != 0) {
                i9 = Theme.changeColorAccent(themeInfo, i4, i2);
            }
            if (i5 == 0 && (i = themeFileValues.get(Theme.key_chat_wallpaper)) != 0) {
                i5 = Theme.changeColorAccent(themeInfo, i4, i);
            }
            if (i8 != 0) {
                patternColor = MotionBackgroundDrawable.getPatternColor(i5, i6, i8, i9);
            } else if (i6 != 0) {
                ColorDrawable backgroundGradientDrawable = new BackgroundGradientDrawable(BackgroundGradientDrawable.getGradientOrientation(accent.backgroundRotation), new int[]{i5, i6});
                patternColor = AndroidUtilities.getPatternColor(AndroidUtilities.getAverageColor(i5, i6));
                colorDrawable = backgroundGradientDrawable;
            } else {
                colorDrawable = new ColorDrawable(i5);
                patternColor = AndroidUtilities.getPatternColor(i5);
            }
            if (patternBitmap == null) {
                Point point = AndroidUtilities.displaySize;
                int min = Math.min(point.x, point.y);
                Point point2 = AndroidUtilities.displaySize;
                int max = Math.max(point2.x, point2.y);
                if (svg) {
                    loadScreenSizedBitmap = SvgHelper.getBitmap(patternPath, min, max, false);
                } else {
                    loadScreenSizedBitmap = Theme.loadScreenSizedBitmap(new FileInputStream(patternPath), 0);
                }
                bitmap = loadScreenSizedBitmap;
            } else {
                bitmap = patternBitmap;
            }
            try {
                if (colorDrawable != null) {
                    Bitmap createBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
                    Canvas canvas = new Canvas(createBitmap);
                    colorDrawable.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());
                    colorDrawable.draw(canvas);
                    Paint paint = new Paint(2);
                    paint.setColorFilter(new PorterDuffColorFilter(patternColor, PorterDuff.Mode.SRC_IN));
                    paint.setAlpha((int) (Math.abs(accent.patternIntensity) * 255.0f));
                    canvas.drawBitmap(bitmap, 0.0f, 0.0f, paint);
                    createBitmap.compress(Bitmap.CompressFormat.JPEG, 87, new FileOutputStream(pathToWallpaper));
                } else {
                    FileOutputStream fileOutputStream = new FileOutputStream(pathToWallpaper);
                    bitmap.compress(Bitmap.CompressFormat.PNG, 87, fileOutputStream);
                    fileOutputStream.close();
                }
            } catch (Throwable th2) {
                th = th2;
                FileLog.e(th);
                return bitmap;
            }
            return bitmap;
        }

        public void didReceivedNotification(int id, int account, Object... args) {
            HashMap<String, LoadingPattern> hashMap = this.watingForLoad;
            if (hashMap == null) {
                return;
            }
            if (id == NotificationCenter.fileLoaded) {
                final LoadingPattern remove = hashMap.remove((String) args[0]);
                if (remove != null) {
                    Utilities.globalQueue.postRunnable(new Runnable() {
                        @Override
                        public final void run() {
                            Theme.PatternsLoader.this.lambda$didReceivedNotification$3(remove);
                        }
                    });
                    return;
                }
                return;
            }
            if (id != NotificationCenter.fileLoadFailed || hashMap.remove((String) args[0]) == null) {
                return;
            }
            checkCurrentWallpaper(null, false);
        }

        public void lambda$didReceivedNotification$3(LoadingPattern loadingPattern) {
            TLRPC.TL_wallPaper tL_wallPaper = loadingPattern.pattern;
            File pathToAttach = FileLoader.getInstance(UserConfig.selectedAccount).getPathToAttach(((TLRPC.WallPaper) tL_wallPaper).document, true);
            int size = loadingPattern.accents.size();
            Bitmap bitmap = null;
            ArrayList<ThemeAccent> arrayList = null;
            for (int i = 0; i < size; i++) {
                ThemeAccent themeAccent = loadingPattern.accents.get(i);
                if (themeAccent.patternSlug.equals(((TLRPC.WallPaper) tL_wallPaper).slug)) {
                    bitmap = createWallpaperForAccent(bitmap, "application/x-tgwallpattern".equals(((TLRPC.WallPaper) tL_wallPaper).document.mime_type), pathToAttach, themeAccent);
                    if (arrayList == null) {
                        arrayList = new ArrayList<>();
                        arrayList.add(themeAccent);
                    }
                }
            }
            if (bitmap != null) {
                bitmap.recycle();
            }
            checkCurrentWallpaper(arrayList, false);
        }
    }

    public static class ThemeAccent {
        public int accentColor;
        public int accentColor2;
        public int account;
        public long backgroundGradientOverrideColor1;
        public long backgroundGradientOverrideColor2;
        public long backgroundGradientOverrideColor3;
        public long backgroundOverrideColor;
        public int id;
        public TLRPC.TL_theme info;
        public boolean isDefault;
        public int myMessagesAccentColor;
        public boolean myMessagesAnimated;
        public int myMessagesGradientAccentColor1;
        public int myMessagesGradientAccentColor2;
        public int myMessagesGradientAccentColor3;
        public OverrideWallpaperInfo overrideWallpaper;
        public ThemeInfo parentTheme;
        public TLRPC.TL_wallPaper pattern;
        public float patternIntensity;
        public boolean patternMotion;
        public TLRPC.InputFile uploadedFile;
        public TLRPC.InputFile uploadedThumb;
        public String uploadingFile;
        public String uploadingThumb;
        public int backgroundRotation = 45;
        public String patternSlug = "";
        public float[] tempHSV = new float[3];

        public boolean fillAccentColors(SparseIntArray sparseIntArray, SparseIntArray sparseIntArray2) {
            int valueAt;
            boolean useBlackText;
            boolean z;
            int valueAt2;
            int valueAt3;
            int i;
            boolean useBlackText2;
            int i2;
            int i3;
            int i4;
            int i5;
            int i6;
            float[] tempHsv = Theme.getTempHsv(1);
            float[] tempHsv2 = Theme.getTempHsv(2);
            Color.colorToHSV(this.parentTheme.accentBaseColor, tempHsv);
            Color.colorToHSV(this.accentColor, tempHsv2);
            boolean isDark = this.parentTheme.isDark();
            if (this.accentColor != this.parentTheme.accentBaseColor || this.accentColor2 != 0) {
                for (int i7 = 0; i7 < Theme.defaultColors.length; i7++) {
                    if (!Theme.themeAccentExclusionKeys.contains(Integer.valueOf(i7))) {
                        int indexOfKey = sparseIntArray.indexOfKey(i7);
                        if (indexOfKey < 0) {
                            int i8 = Theme.fallbackKeys.get(i7, -1);
                            if (i8 < 0 || sparseIntArray.indexOfKey(i8) < 0) {
                                valueAt = Theme.defaultColors[i7];
                            }
                        } else {
                            valueAt = sparseIntArray.valueAt(indexOfKey);
                        }
                        int changeColorAccent = Theme.changeColorAccent(tempHsv, tempHsv2, valueAt, isDark, valueAt);
                        if (changeColorAccent != valueAt) {
                            sparseIntArray2.put(i7, changeColorAccent);
                        }
                    }
                }
            }
            int i9 = this.myMessagesAccentColor;
            if ((i9 == 0 && this.accentColor == 0) || this.myMessagesGradientAccentColor1 == 0) {
                z = false;
            } else {
                if (i9 == 0) {
                    i9 = this.accentColor;
                }
                int i10 = Theme.key_chat_outBubble;
                int i11 = sparseIntArray.get(i10);
                if (i11 == 0) {
                    i11 = Theme.defaultColors[i10];
                }
                int colorDistance = AndroidUtilities.getColorDistance(i9, Theme.changeColorAccent(tempHsv, tempHsv2, i11, isDark, i11));
                int colorDistance2 = AndroidUtilities.getColorDistance(i9, this.myMessagesGradientAccentColor1);
                if (this.myMessagesGradientAccentColor2 != 0) {
                    int averageColor = AndroidUtilities.getAverageColor(AndroidUtilities.getAverageColor(this.myMessagesAccentColor, this.myMessagesGradientAccentColor1), this.myMessagesGradientAccentColor2);
                    int i12 = this.myMessagesGradientAccentColor3;
                    if (i12 != 0) {
                        averageColor = AndroidUtilities.getAverageColor(averageColor, i12);
                    }
                    useBlackText = AndroidUtilities.computePerceivedBrightness(averageColor) > 0.705f;
                } else {
                    useBlackText = Theme.useBlackText(this.myMessagesAccentColor, this.myMessagesGradientAccentColor1);
                }
                z = useBlackText && colorDistance <= 35000 && colorDistance2 <= 35000;
                i9 = Theme.getAccentColor(tempHsv, i11, i9);
            }
            boolean z2 = (i9 == 0 || (((i5 = this.parentTheme.accentBaseColor) == 0 || i9 == i5) && ((i6 = this.accentColor) == 0 || i6 == i9))) ? false : true;
            if (z2 || this.accentColor2 != 0) {
                int i13 = this.accentColor2;
                if (i13 != 0) {
                    Color.colorToHSV(i13, tempHsv2);
                } else {
                    Color.colorToHSV(i9, tempHsv2);
                }
                for (int i14 = Theme.myMessagesStartIndex; i14 < Theme.myMessagesEndIndex; i14++) {
                    int indexOfKey2 = sparseIntArray.indexOfKey(i14);
                    if (indexOfKey2 < 0) {
                        int i15 = Theme.fallbackKeys.get(i14, -1);
                        if (i15 < 0 || sparseIntArray.get(i15, -1) < 0) {
                            valueAt3 = Theme.defaultColors[i14];
                        }
                    } else {
                        valueAt3 = sparseIntArray.valueAt(indexOfKey2);
                    }
                    int changeColorAccent2 = Theme.changeColorAccent(tempHsv, tempHsv2, valueAt3, isDark, valueAt3);
                    if (changeColorAccent2 != valueAt3) {
                        sparseIntArray2.put(i14, changeColorAccent2);
                    }
                }
                if (z2) {
                    Color.colorToHSV(i9, tempHsv2);
                    for (int i16 = Theme.myMessagesBubblesStartIndex; i16 < Theme.myMessagesBubblesEndIndex; i16++) {
                        int indexOfKey3 = sparseIntArray.indexOfKey(i16);
                        if (indexOfKey3 < 0) {
                            int i17 = Theme.fallbackKeys.get(i16, -1);
                            if (i17 < 0 || sparseIntArray.get(i17, -1) < 0) {
                                valueAt2 = Theme.defaultColors[i16];
                            }
                        } else {
                            valueAt2 = sparseIntArray.valueAt(indexOfKey3);
                        }
                        int changeColorAccent3 = Theme.changeColorAccent(tempHsv, tempHsv2, valueAt2, isDark, valueAt2);
                        if (changeColorAccent3 != valueAt2) {
                            sparseIntArray2.put(i16, changeColorAccent3);
                        }
                    }
                }
            }
            if (!z && (i = this.myMessagesGradientAccentColor1) != 0) {
                if (this.myMessagesGradientAccentColor2 != 0) {
                    int averageColor2 = AndroidUtilities.getAverageColor(AndroidUtilities.getAverageColor(this.myMessagesAccentColor, i), this.myMessagesGradientAccentColor2);
                    int i18 = this.myMessagesGradientAccentColor3;
                    if (i18 != 0) {
                        averageColor2 = AndroidUtilities.getAverageColor(averageColor2, i18);
                    }
                    useBlackText2 = AndroidUtilities.computePerceivedBrightness(averageColor2) > 0.705f;
                } else {
                    useBlackText2 = Theme.useBlackText(this.myMessagesAccentColor, i);
                }
                if (useBlackText2) {
                    i4 = -14606047;
                    i2 = -11184811;
                    i3 = 1291845632;
                } else {
                    i2 = -1118482;
                    i3 = 1308622847;
                    i4 = -1;
                }
                if (this.accentColor2 == 0) {
                    sparseIntArray2.put(Theme.key_chat_outAudioProgress, i3);
                    sparseIntArray2.put(Theme.key_chat_outAudioSelectedProgress, i3);
                    sparseIntArray2.put(Theme.key_chat_outAudioSeekbar, i3);
                    sparseIntArray2.put(Theme.key_chat_outAudioCacheSeekbar, i3);
                    sparseIntArray2.put(Theme.key_chat_outAudioSeekbarSelected, i3);
                    sparseIntArray2.put(Theme.key_chat_outAudioSeekbarFill, i4);
                    sparseIntArray2.put(Theme.key_chat_outVoiceSeekbar, i3);
                    sparseIntArray2.put(Theme.key_chat_outVoiceSeekbarSelected, i3);
                    sparseIntArray2.put(Theme.key_chat_outVoiceSeekbarFill, i4);
                    sparseIntArray2.put(Theme.key_chat_messageLinkOut, i4);
                    sparseIntArray2.put(Theme.key_chat_outForwardedNameText, i4);
                    sparseIntArray2.put(Theme.key_chat_outViaBotNameText, i4);
                    sparseIntArray2.put(Theme.key_chat_outReplyLine, i4);
                    sparseIntArray2.put(Theme.key_chat_outReplyLine2, i4);
                    sparseIntArray2.put(Theme.key_chat_outReplyNameText, i4);
                    sparseIntArray2.put(Theme.key_chat_outPreviewLine, i4);
                    sparseIntArray2.put(Theme.key_chat_outSiteNameText, i4);
                    sparseIntArray2.put(Theme.key_chat_outInstant, i4);
                    sparseIntArray2.put(Theme.key_chat_outInstantSelected, i4);
                    sparseIntArray2.put(Theme.key_chat_outPreviewInstantText, i4);
                    sparseIntArray2.put(Theme.key_chat_outViews, i4);
                    sparseIntArray2.put(Theme.key_chat_outViewsSelected, i4);
                    sparseIntArray2.put(Theme.key_chat_outAudioTitleText, i4);
                    sparseIntArray2.put(Theme.key_chat_outFileNameText, i4);
                    sparseIntArray2.put(Theme.key_chat_outContactNameText, i4);
                    sparseIntArray2.put(Theme.key_chat_outAudioPerformerText, i4);
                    sparseIntArray2.put(Theme.key_chat_outAudioPerformerSelectedText, i4);
                    sparseIntArray2.put(Theme.key_chat_outSentCheck, i4);
                    sparseIntArray2.put(Theme.key_chat_outSentCheckSelected, i4);
                    sparseIntArray2.put(Theme.key_chat_outSentCheckRead, i4);
                    sparseIntArray2.put(Theme.key_chat_outSentCheckReadSelected, i4);
                    sparseIntArray2.put(Theme.key_chat_outSentClock, i4);
                    sparseIntArray2.put(Theme.key_chat_outSentClockSelected, i4);
                    sparseIntArray2.put(Theme.key_chat_outMenu, i4);
                    sparseIntArray2.put(Theme.key_chat_outMenuSelected, i4);
                    sparseIntArray2.put(Theme.key_chat_outTimeText, i4);
                    sparseIntArray2.put(Theme.key_chat_outTimeSelectedText, i4);
                    sparseIntArray2.put(Theme.key_chat_outAudioDurationText, i2);
                    sparseIntArray2.put(Theme.key_chat_outAudioDurationSelectedText, i2);
                    sparseIntArray2.put(Theme.key_chat_outContactPhoneText, i2);
                    sparseIntArray2.put(Theme.key_chat_outContactPhoneSelectedText, i2);
                    sparseIntArray2.put(Theme.key_chat_outFileInfoText, i2);
                    sparseIntArray2.put(Theme.key_chat_outFileInfoSelectedText, i2);
                    sparseIntArray2.put(Theme.key_chat_outVenueInfoText, i2);
                    sparseIntArray2.put(Theme.key_chat_outVenueInfoSelectedText, i2);
                    sparseIntArray2.put(Theme.key_chat_outLoader, i4);
                    sparseIntArray2.put(Theme.key_chat_outLoaderSelected, i4);
                    sparseIntArray2.put(Theme.key_chat_outFileProgress, this.myMessagesAccentColor);
                    sparseIntArray2.put(Theme.key_chat_outFileProgressSelected, this.myMessagesAccentColor);
                    sparseIntArray2.put(Theme.key_chat_outMediaIcon, this.myMessagesAccentColor);
                    sparseIntArray2.put(Theme.key_chat_outMediaIconSelected, this.myMessagesAccentColor);
                }
                sparseIntArray2.put(Theme.key_chat_outReplyMessageText, i4);
                sparseIntArray2.put(Theme.key_chat_outReplyMediaMessageText, i4);
                sparseIntArray2.put(Theme.key_chat_outReplyMediaMessageSelectedText, i4);
                sparseIntArray2.put(Theme.key_chat_messageTextOut, i4);
            }
            if (z) {
                int i19 = Theme.key_chat_outLoader;
                if (AndroidUtilities.getColorDistance(-1, sparseIntArray2.indexOfKey(i19) >= 0 ? sparseIntArray2.get(i19) : 0) < 5000) {
                    z = false;
                }
            }
            int i20 = this.myMessagesAccentColor;
            if (i20 != 0 && this.myMessagesGradientAccentColor1 != 0) {
                sparseIntArray2.put(Theme.key_chat_outBubble, i20);
                sparseIntArray2.put(Theme.key_chat_outBubbleGradient1, this.myMessagesGradientAccentColor1);
                int i21 = this.myMessagesGradientAccentColor2;
                if (i21 != 0) {
                    sparseIntArray2.put(Theme.key_chat_outBubbleGradient2, i21);
                    int i22 = this.myMessagesGradientAccentColor3;
                    if (i22 != 0) {
                        sparseIntArray2.put(Theme.key_chat_outBubbleGradient3, i22);
                    }
                }
                sparseIntArray2.put(Theme.key_chat_outBubbleGradientAnimated, this.myMessagesAnimated ? 1 : 0);
            }
            long j = this.backgroundOverrideColor;
            int i23 = (int) j;
            if (i23 != 0) {
                sparseIntArray2.put(Theme.key_chat_wallpaper, i23);
            } else if (j != 0) {
                sparseIntArray2.delete(Theme.key_chat_wallpaper);
            }
            long j2 = this.backgroundGradientOverrideColor1;
            int i24 = (int) j2;
            if (i24 != 0) {
                sparseIntArray2.put(Theme.key_chat_wallpaper_gradient_to1, i24);
            } else if (j2 != 0) {
                sparseIntArray2.delete(Theme.key_chat_wallpaper_gradient_to1);
            }
            long j3 = this.backgroundGradientOverrideColor2;
            int i25 = (int) j3;
            if (i25 != 0) {
                sparseIntArray2.put(Theme.key_chat_wallpaper_gradient_to2, i25);
            } else if (j3 != 0) {
                sparseIntArray2.delete(Theme.key_chat_wallpaper_gradient_to2);
            }
            long j4 = this.backgroundGradientOverrideColor3;
            int i26 = (int) j4;
            if (i26 != 0) {
                sparseIntArray2.put(Theme.key_chat_wallpaper_gradient_to3, i26);
            } else if (j4 != 0) {
                sparseIntArray2.delete(Theme.key_chat_wallpaper_gradient_to3);
            }
            int i27 = this.backgroundRotation;
            if (i27 != 45) {
                sparseIntArray2.put(Theme.key_chat_wallpaper_gradient_rotation, i27);
            }
            int i28 = Theme.key_chat_outBubble;
            int i29 = sparseIntArray2.get(i28);
            if (i29 == 0) {
                i29 = Theme.getColor(i28);
            }
            int i30 = Theme.key_chat_inBubble;
            int i31 = sparseIntArray2.get(i30);
            if (i31 == 0) {
                i31 = Theme.getColor(i30);
            }
            TLRPC.TL_theme tL_theme = this.info;
            if (tL_theme != null && tL_theme.emoticon != null && !isDark) {
                sparseIntArray2.delete(Theme.key_chat_selectedBackground);
                int averageColor3 = averageColor(sparseIntArray2, Theme.key_chat_wallpaper_gradient_to1, Theme.key_chat_wallpaper_gradient_to2, Theme.key_chat_wallpaper_gradient_to3);
                if (averageColor3 == 0) {
                    averageColor3 = averageColor(sparseIntArray2, Theme.key_chat_wallpaper);
                }
                if (averageColor3 == 0) {
                    averageColor3 = this.accentColor;
                }
                int bubbleSelectedOverlay = bubbleSelectedOverlay(i29, averageColor3);
                sparseIntArray2.put(Theme.key_chat_outBubbleSelectedOverlay, bubbleSelectedOverlay);
                sparseIntArray2.put(Theme.key_chat_outBubbleGradientSelectedOverlay, bubbleSelectedOverlay);
                sparseIntArray2.put(Theme.key_chat_outBubbleSelected, Theme.blendOver(i29, bubbleSelectedOverlay));
                int bubbleSelectedOverlay2 = bubbleSelectedOverlay(i31, this.accentColor);
                sparseIntArray2.put(Theme.key_chat_inBubbleSelectedOverlay, bubbleSelectedOverlay2);
                sparseIntArray2.put(Theme.key_chat_inBubbleSelected, Theme.blendOver(i31, bubbleSelectedOverlay2));
            }
            if (!isDark) {
                sparseIntArray2.put(Theme.key_chat_inTextSelectionHighlight, textSelectionBackground(false, i31, this.accentColor));
                sparseIntArray2.put(Theme.key_chat_outTextSelectionHighlight, textSelectionBackground(true, i29, this.accentColor));
                sparseIntArray2.put(Theme.key_chat_outTextSelectionCursor, textSelectionHandle(i29, this.accentColor));
            }
            float hue = getHue(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText));
            sparseIntArray2.put(Theme.key_chat_outBubbleLocationPlaceholder, locationPlaceholderColor(hue, i29, isDark));
            sparseIntArray2.put(Theme.key_chat_inBubbleLocationPlaceholder, locationPlaceholderColor(hue, i31, isDark));
            int i32 = Theme.key_chat_messageLinkIn;
            int i33 = sparseIntArray2.get(i32);
            if (i33 == 0) {
                i33 = Theme.getColor(i32);
            }
            int i34 = Theme.key_chat_messageLinkOut;
            int i35 = sparseIntArray2.get(i34);
            if (i35 == 0) {
                i35 = Theme.getColor(i34);
            }
            sparseIntArray2.put(Theme.key_chat_linkSelectBackground, linkSelectionBackground(i33, i31, isDark));
            sparseIntArray2.put(Theme.key_chat_outLinkSelectBackground, linkSelectionBackground(i35, i29, isDark));
            int i36 = Theme.key_actionBarDefaultSubmenuBackground;
            int i37 = sparseIntArray2.get(i36);
            if (i37 == 0) {
                i37 = Theme.getColor(i36);
            }
            sparseIntArray2.put(Theme.key_actionBarDefaultSubmenuSeparator, Color.argb(Color.alpha(i37), Math.max(0, Color.red(i37) - 10), Math.max(0, Color.green(i37) - 10), Math.max(0, Color.blue(i37) - 10)));
            if (isDark) {
                int i38 = Theme.key_chat_outBubbleGradient1;
                if (sparseIntArray2.get(i38) != 0) {
                    Color.colorToHSV(averageColor(sparseIntArray2, i38, Theme.key_chat_outBubbleGradient2, Theme.key_chat_outBubbleGradient3), this.tempHSV);
                    float[] fArr = this.tempHSV;
                    fArr[1] = Utilities.clamp(fArr[1] + 0.1f, 1.0f, 0.0f);
                    float[] fArr2 = this.tempHSV;
                    fArr2[2] = Utilities.clamp(fArr2[2] - 0.8f, 1.0f, 0.0f);
                    sparseIntArray2.put(Theme.key_chat_outCodeBackground, Color.HSVToColor(64, this.tempHSV));
                    return !z;
                }
            }
            sparseIntArray2.put(Theme.key_chat_outCodeBackground, codeBackground(i29, isDark));
            return !z;
        }

        public final float getHue(int color) {
            Color.colorToHSV(color, this.tempHSV);
            return this.tempHSV[0];
        }

        public final int bubbleSelectedOverlay(int bubble, int accentColor) {
            Color.colorToHSV(accentColor, this.tempHSV);
            float[] fArr = this.tempHSV;
            float f = fArr[0];
            Color.colorToHSV(bubble, fArr);
            float[] fArr2 = this.tempHSV;
            if (fArr2[1] <= 0.0f) {
                fArr2[0] = f;
            }
            fArr2[1] = Math.max(0.0f, Math.min(1.0f, fArr2[1] + 0.6f));
            float[] fArr3 = this.tempHSV;
            fArr3[2] = Math.max(0.0f, Math.min(1.0f, fArr3[2] - 0.05f));
            return Color.HSVToColor(30, this.tempHSV);
        }

        public final int textSelectionBackground(boolean isOut, int bubble, int accentColor) {
            Color.colorToHSV(accentColor, this.tempHSV);
            float[] fArr = this.tempHSV;
            float f = fArr[0];
            Color.colorToHSV(bubble, fArr);
            float[] fArr2 = this.tempHSV;
            if (fArr2[1] <= 0.0f || (fArr2[0] > 45.0f && fArr2[0] < 85.0f)) {
                fArr2[0] = f;
            }
            fArr2[1] = Math.max(0.0f, Math.min(1.0f, fArr2[1] + (fArr2[2] > 0.85f ? 0.25f : 0.45f)));
            float[] fArr3 = this.tempHSV;
            fArr3[2] = Math.max(0.0f, Math.min(1.0f, fArr3[2] - 0.15f));
            return Color.HSVToColor(80, this.tempHSV);
        }

        public final int textSelectionHandle(int bubble, int accentColor) {
            Color.colorToHSV(accentColor, this.tempHSV);
            float[] fArr = this.tempHSV;
            float f = fArr[0];
            Color.colorToHSV(bubble, fArr);
            float[] fArr2 = this.tempHSV;
            if (fArr2[1] <= 0.0f || (fArr2[0] > 45.0f && fArr2[0] < 85.0f)) {
                fArr2[0] = f;
            }
            fArr2[1] = Math.max(0.0f, Math.min(1.0f, fArr2[1] + 0.6f));
            float[] fArr3 = this.tempHSV;
            fArr3[2] = Math.max(0.0f, Math.min(1.0f, fArr3[2] - (fArr3[2] > 0.7f ? 0.25f : 0.125f)));
            return Theme.blendOver(bubble, Color.HSVToColor(255, this.tempHSV));
        }

        public final int linkSelectionBackground(int linkColor, int bgColor, boolean isDarkTheme) {
            Color.colorToHSV(ColorUtils.blendARGB(linkColor, bgColor, 0.25f), this.tempHSV);
            float[] fArr = this.tempHSV;
            fArr[1] = Math.max(0.0f, Math.min(1.0f, fArr[1] - 0.1f));
            float[] fArr2 = this.tempHSV;
            fArr2[2] = Math.max(0.0f, Math.min(1.0f, fArr2[2] + (isDarkTheme ? 0.1f : 0.0f)));
            return Color.HSVToColor(51, this.tempHSV);
        }

        public final int codeBackground(int bubbleColor, boolean isDarkTheme) {
            int i;
            Color.colorToHSV(bubbleColor, this.tempHSV);
            if (isDarkTheme) {
                i = 64;
                float[] fArr = this.tempHSV;
                fArr[1] = Utilities.clamp(fArr[1] - 0.08f, 1.0f, 0.0f);
                this.tempHSV[2] = 0.03f;
            } else {
                float[] fArr2 = this.tempHSV;
                if (fArr2[1] <= 0.0f || fArr2[2] >= 1.0f || fArr2[2] <= 0.0f) {
                    fArr2[2] = Math.max(0.0f, Math.min(1.0f, fArr2[2] - 0.2f));
                } else {
                    fArr2[1] = Math.max(0.0f, Math.min(1.0f, fArr2[1] + 0.28f));
                    this.tempHSV[2] = Math.max(0.0f, Math.min(1.0f, r8[2] - 0.1f));
                }
                i = 32;
            }
            return Color.HSVToColor(i, this.tempHSV);
        }

        public final int locationPlaceholderColor(float accentHue, int bubbleColor, boolean isDarkTheme) {
            if (isDarkTheme) {
                return 520093695;
            }
            Color.colorToHSV(bubbleColor, this.tempHSV);
            float[] fArr = this.tempHSV;
            if (fArr[1] <= 0.0f || fArr[2] >= 1.0f || fArr[2] <= 0.0f) {
                fArr[0] = accentHue;
                fArr[1] = 0.2f;
            } else {
                fArr[0] = MathUtils.clamp(fArr[0] + 0.22f, 0.0f, 1.0f);
                float[] fArr2 = this.tempHSV;
                fArr2[1] = MathUtils.clamp(fArr2[1] - 0.35f, 0.0f, 1.0f);
            }
            float[] fArr3 = this.tempHSV;
            fArr3[2] = MathUtils.clamp(fArr3[2] - 0.65f, 0.0f, 1.0f);
            return Color.HSVToColor(90, this.tempHSV);
        }

        public final int averageColor(SparseIntArray colors, int... keys) {
            int i = 0;
            int i2 = 0;
            int i3 = 0;
            int i4 = 0;
            for (int i5 = 0; i5 < keys.length; i5++) {
                if (colors.indexOfKey(keys[i5]) >= 0) {
                    try {
                        int i6 = colors.get(keys[i5]);
                        i2 += Color.red(i6);
                        i3 += Color.green(i6);
                        i4 += Color.blue(i6);
                        i++;
                    } catch (Exception unused) {
                    }
                }
            }
            if (i == 0) {
                return 0;
            }
            return Color.argb(255, i2 / i, i3 / i, i4 / i);
        }

        public File getPathToWallpaper() {
            if (this.id < 100) {
                if (TextUtils.isEmpty(this.patternSlug)) {
                    return null;
                }
                return new File(ApplicationLoader.getFilesDirFixed(), String.format(Locale.US, "%s_%d_%s_v5.jpg", this.parentTheme.getKey(), Integer.valueOf(this.id), this.patternSlug));
            }
            if (TextUtils.isEmpty(this.patternSlug)) {
                return null;
            }
            return new File(ApplicationLoader.getFilesDirFixed(), String.format(Locale.US, "%s_%d_%s_v8_debug.jpg", this.parentTheme.getKey(), Integer.valueOf(this.id), this.patternSlug));
        }

        public java.io.File saveToFile() {
            throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.ActionBar.Theme.ThemeAccent.saveToFile():java.io.File");
        }
    }

    public static int blendOver(int A, int B) {
        float alpha = Color.alpha(B) / 255.0f;
        float alpha2 = Color.alpha(A) / 255.0f;
        float f = 1.0f - alpha;
        float f2 = (alpha2 * f) + alpha;
        if (f2 == 0.0f) {
            return 0;
        }
        return Color.argb((int) (255.0f * f2), (int) (((Color.red(B) * alpha) + ((Color.red(A) * alpha2) * f)) / f2), (int) (((Color.green(B) * alpha) + ((Color.green(A) * alpha2) * f)) / f2), (int) (((Color.blue(B) * alpha) + ((Color.blue(A) * alpha2) * f)) / f2));
    }

    public static int adaptHue(int color, int hueFromColor) {
        float[] tempHsv = getTempHsv(5);
        Color.colorToHSV(hueFromColor, tempHsv);
        float f = tempHsv[0];
        float f2 = tempHsv[1];
        Color.colorToHSV(color, tempHsv);
        tempHsv[0] = f;
        tempHsv[1] = AndroidUtilities.lerp(tempHsv[1], f2, 0.25f);
        return Color.HSVToColor(Color.alpha(color), tempHsv);
    }

    public static int adaptHSV(int color, float sat, float val) {
        float[] tempHsv = getTempHsv(5);
        Color.colorToHSV(color, tempHsv);
        if (tempHsv[1] > 0.1f && tempHsv[1] < 0.9f) {
            tempHsv[1] = MathUtils.clamp(tempHsv[1] + sat, 0.0f, 1.0f);
        }
        tempHsv[2] = MathUtils.clamp(tempHsv[2] + val, 0.0f, 1.0f);
        return Color.HSVToColor(Color.alpha(color), tempHsv);
    }

    public static int multAlpha(int color, float multiply) {
        return multiply == 1.0f ? color : ColorUtils.setAlphaComponent(color, MathUtils.clamp((int) (Color.alpha(color) * multiply), 0, 255));
    }

    public static class OverrideWallpaperInfo {
        public long accessHash;
        public int color;
        public long dialogId;
        public String fileName;
        public boolean forBoth;
        public int gradientColor1;
        public int gradientColor2;
        public int gradientColor3;
        public float intensity;
        public boolean isBlurred;
        public boolean isMotion;
        public String originalFileName;
        public ThemeAccent parentAccent;
        public ThemeInfo parentTheme;
        public TLRPC.WallPaper prevUserWallpaper;
        public ArrayList<Integer> requestIds;
        public int rotation;
        public String slug;
        public float uploadingProgress;
        public long wallpaperId;

        public OverrideWallpaperInfo() {
            this.fileName = "";
            this.originalFileName = "";
            this.slug = "";
        }

        public OverrideWallpaperInfo(OverrideWallpaperInfo info, ThemeInfo themeInfo, ThemeAccent accent) {
            this.fileName = "";
            this.originalFileName = "";
            this.slug = "";
            this.slug = info.slug;
            this.color = info.color;
            this.gradientColor1 = info.gradientColor1;
            this.gradientColor2 = info.gradientColor2;
            this.gradientColor3 = info.gradientColor3;
            this.rotation = info.rotation;
            this.isBlurred = info.isBlurred;
            this.isMotion = info.isMotion;
            this.intensity = info.intensity;
            this.parentTheme = themeInfo;
            this.parentAccent = accent;
            if (!TextUtils.isEmpty(info.fileName)) {
                try {
                    File file = new File(ApplicationLoader.getFilesDirFixed(), info.fileName);
                    File filesDirFixed = ApplicationLoader.getFilesDirFixed();
                    String generateWallpaperName = this.parentTheme.generateWallpaperName(this.parentAccent, false);
                    this.fileName = generateWallpaperName;
                    AndroidUtilities.copyFile(file, new File(filesDirFixed, generateWallpaperName));
                } catch (Exception e) {
                    this.fileName = "";
                    FileLog.e(e);
                }
            } else {
                this.fileName = "";
            }
            if (!TextUtils.isEmpty(info.originalFileName)) {
                if (!info.originalFileName.equals(info.fileName)) {
                    try {
                        File file2 = new File(ApplicationLoader.getFilesDirFixed(), info.originalFileName);
                        File filesDirFixed2 = ApplicationLoader.getFilesDirFixed();
                        String generateWallpaperName2 = this.parentTheme.generateWallpaperName(this.parentAccent, true);
                        this.originalFileName = generateWallpaperName2;
                        AndroidUtilities.copyFile(file2, new File(filesDirFixed2, generateWallpaperName2));
                        return;
                    } catch (Exception e2) {
                        this.originalFileName = "";
                        FileLog.e(e2);
                        return;
                    }
                }
                this.originalFileName = this.fileName;
                return;
            }
            this.originalFileName = "";
        }

        public boolean isDefault() {
            return "d".equals(this.slug);
        }

        public boolean isColor() {
            return "c".equals(this.slug);
        }

        public boolean isTheme() {
            return "t".equals(this.slug);
        }

        public void saveOverrideWallpaper() {
            ThemeInfo themeInfo = this.parentTheme;
            if (themeInfo != null) {
                ThemeAccent themeAccent = this.parentAccent;
                if (themeAccent != null || themeInfo.overrideWallpaper == this) {
                    if (themeAccent == null || themeAccent.overrideWallpaper == this) {
                        save();
                    }
                }
            }
        }

        public final String getKey() {
            if (this.parentAccent != null) {
                return this.parentTheme.name + "_" + this.parentAccent.id + "_owp";
            }
            return this.parentTheme.name + "_owp";
        }

        public final void save() {
            try {
                String key = getKey();
                SharedPreferences.Editor edit = ApplicationLoader.applicationContext.getSharedPreferences("themeconfig", 0).edit();
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("wall", this.fileName);
                jSONObject.put("owall", this.originalFileName);
                jSONObject.put("pColor", this.color);
                jSONObject.put("pGrColor", this.gradientColor1);
                jSONObject.put("pGrColor2", this.gradientColor2);
                jSONObject.put("pGrColor3", this.gradientColor3);
                jSONObject.put("pGrAngle", this.rotation);
                String str = this.slug;
                if (str == null) {
                    str = "";
                }
                jSONObject.put("wallSlug", str);
                jSONObject.put("wBlur", this.isBlurred);
                jSONObject.put("wMotion", this.isMotion);
                jSONObject.put("pIntensity", this.intensity);
                edit.putString(key, jSONObject.toString());
                edit.commit();
            } catch (Throwable th) {
                FileLog.e(th);
            }
        }

        public final void delete() {
            ApplicationLoader.applicationContext.getSharedPreferences("themeconfig", 0).edit().remove(getKey()).commit();
            new File(ApplicationLoader.getFilesDirFixed(), this.fileName).delete();
            new File(ApplicationLoader.getFilesDirFixed(), this.originalFileName).delete();
        }
    }

    public static class ThemeInfo implements NotificationCenter.NotificationCenterDelegate {
        public int accentBaseColor;
        public LongSparseArray<ThemeAccent> accentsByThemeId;
        public int account;
        public String assetName;
        public boolean badWallpaper;
        public LongSparseArray<ThemeAccent> chatAccentsByThemeId;
        public int currentAccentId;
        public int defaultAccentCount;
        public boolean firstAccentIsDefault;
        public TLRPC.TL_theme info;
        public boolean isBlured;
        public int isDark;
        public boolean isMotion;
        public int lastAccentId;
        public int lastChatThemeId;
        public boolean loaded;
        public String loadingThemeWallpaperName;
        public String name;
        public String newPathToWallpaper;
        public OverrideWallpaperInfo overrideWallpaper;
        public String pathToFile;
        public String pathToWallpaper;
        public int patternBgColor;
        public int patternBgGradientColor1;
        public int patternBgGradientColor2;
        public int patternBgGradientColor3;
        public int patternBgGradientRotation;
        public int patternIntensity;
        public int prevAccentId;
        public int previewBackgroundColor;
        public int previewBackgroundGradientColor1;
        public int previewBackgroundGradientColor2;
        public int previewBackgroundGradientColor3;
        public int previewInColor;
        public int previewOutColor;
        public boolean previewParsed;
        public int previewWallpaperOffset;
        public String slug;
        public int sortIndex;
        public ArrayList<ThemeAccent> themeAccents;
        public SparseArray<ThemeAccent> themeAccentsMap;
        public boolean themeLoaded;
        public TLRPC.InputFile uploadedFile;
        public TLRPC.InputFile uploadedThumb;
        public String uploadingFile;
        public String uploadingThumb;

        public ThemeInfo() {
            this.patternBgGradientRotation = 45;
            this.loaded = true;
            this.themeLoaded = true;
            this.prevAccentId = -1;
            this.chatAccentsByThemeId = new LongSparseArray<>();
            this.lastChatThemeId = 0;
            this.lastAccentId = 100;
            this.isDark = -1;
        }

        public ThemeInfo(ThemeInfo other) {
            this.patternBgGradientRotation = 45;
            this.loaded = true;
            this.themeLoaded = true;
            this.prevAccentId = -1;
            this.chatAccentsByThemeId = new LongSparseArray<>();
            this.lastChatThemeId = 0;
            this.lastAccentId = 100;
            this.isDark = -1;
            this.name = other.name;
            this.pathToFile = other.pathToFile;
            this.pathToWallpaper = other.pathToWallpaper;
            this.assetName = other.assetName;
            this.slug = other.slug;
            this.badWallpaper = other.badWallpaper;
            this.isBlured = other.isBlured;
            this.isMotion = other.isMotion;
            this.patternBgColor = other.patternBgColor;
            this.patternBgGradientColor1 = other.patternBgGradientColor1;
            this.patternBgGradientColor2 = other.patternBgGradientColor2;
            this.patternBgGradientColor3 = other.patternBgGradientColor3;
            this.patternBgGradientRotation = other.patternBgGradientRotation;
            this.patternIntensity = other.patternIntensity;
            this.account = other.account;
            this.info = other.info;
            this.loaded = other.loaded;
            this.uploadingThumb = other.uploadingThumb;
            this.uploadingFile = other.uploadingFile;
            this.uploadedThumb = other.uploadedThumb;
            this.uploadedFile = other.uploadedFile;
            this.previewBackgroundColor = other.previewBackgroundColor;
            this.previewBackgroundGradientColor1 = other.previewBackgroundGradientColor1;
            this.previewBackgroundGradientColor2 = other.previewBackgroundGradientColor2;
            this.previewBackgroundGradientColor3 = other.previewBackgroundGradientColor3;
            this.previewWallpaperOffset = other.previewWallpaperOffset;
            this.previewInColor = other.previewInColor;
            this.previewOutColor = other.previewOutColor;
            this.firstAccentIsDefault = other.firstAccentIsDefault;
            this.previewParsed = other.previewParsed;
            this.themeLoaded = other.themeLoaded;
            this.sortIndex = other.sortIndex;
            this.defaultAccentCount = other.defaultAccentCount;
            this.accentBaseColor = other.accentBaseColor;
            this.currentAccentId = other.currentAccentId;
            this.prevAccentId = other.prevAccentId;
            this.themeAccentsMap = other.themeAccentsMap;
            this.themeAccents = other.themeAccents;
            this.accentsByThemeId = other.accentsByThemeId;
            this.lastAccentId = other.lastAccentId;
            this.loadingThemeWallpaperName = other.loadingThemeWallpaperName;
            this.newPathToWallpaper = other.newPathToWallpaper;
            this.overrideWallpaper = other.overrideWallpaper;
        }

        public JSONObject getSaveJson() {
            try {
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("name", this.name);
                jSONObject.put("path", this.pathToFile);
                jSONObject.put("account", this.account);
                TLRPC.TL_theme tL_theme = this.info;
                if (tL_theme != null) {
                    SerializedData serializedData = new SerializedData(tL_theme.getObjectSize());
                    this.info.serializeToStream(serializedData);
                    jSONObject.put("info", Utilities.bytesToHex(serializedData.toByteArray()));
                }
                jSONObject.put("loaded", this.loaded);
                return jSONObject;
            } catch (Exception e) {
                FileLog.e(e);
                return null;
            }
        }

        public final void loadWallpapers(SharedPreferences sharedPreferences) {
            ArrayList<ThemeAccent> arrayList = this.themeAccents;
            if (arrayList != null && !arrayList.isEmpty()) {
                int size = this.themeAccents.size();
                for (int i = 0; i < size; i++) {
                    ThemeAccent themeAccent = this.themeAccents.get(i);
                    loadOverrideWallpaper(sharedPreferences, themeAccent, this.name + "_" + themeAccent.id + "_owp");
                }
                return;
            }
            loadOverrideWallpaper(sharedPreferences, null, this.name + "_owp");
        }

        public final void loadOverrideWallpaper(SharedPreferences sharedPreferences, ThemeAccent accent, String key) {
            try {
                String string = sharedPreferences.getString(key, null);
                if (TextUtils.isEmpty(string)) {
                    return;
                }
                JSONObject jSONObject = new JSONObject(string);
                OverrideWallpaperInfo overrideWallpaperInfo = new OverrideWallpaperInfo();
                overrideWallpaperInfo.fileName = jSONObject.getString("wall");
                overrideWallpaperInfo.originalFileName = jSONObject.getString("owall");
                overrideWallpaperInfo.color = jSONObject.getInt("pColor");
                overrideWallpaperInfo.gradientColor1 = jSONObject.getInt("pGrColor");
                overrideWallpaperInfo.gradientColor2 = jSONObject.optInt("pGrColor2");
                overrideWallpaperInfo.gradientColor3 = jSONObject.optInt("pGrColor3");
                overrideWallpaperInfo.rotation = jSONObject.getInt("pGrAngle");
                overrideWallpaperInfo.slug = jSONObject.getString("wallSlug");
                overrideWallpaperInfo.isBlurred = jSONObject.getBoolean("wBlur");
                overrideWallpaperInfo.isMotion = jSONObject.getBoolean("wMotion");
                overrideWallpaperInfo.intensity = (float) jSONObject.getDouble("pIntensity");
                overrideWallpaperInfo.parentTheme = this;
                overrideWallpaperInfo.parentAccent = accent;
                if (accent != null) {
                    accent.overrideWallpaper = overrideWallpaperInfo;
                } else {
                    this.overrideWallpaper = overrideWallpaperInfo;
                }
                if (jSONObject.has("wallId") && jSONObject.getLong("wallId") == 1000001) {
                    overrideWallpaperInfo.slug = "d";
                }
            } catch (Throwable th) {
                FileLog.e(th);
            }
        }

        public void setOverrideWallpaper(OverrideWallpaperInfo info) {
            if (this.overrideWallpaper == info) {
                return;
            }
            ThemeAccent accent = getAccent(false);
            OverrideWallpaperInfo overrideWallpaperInfo = this.overrideWallpaper;
            if (overrideWallpaperInfo != null) {
                overrideWallpaperInfo.delete();
            }
            if (info != null) {
                info.parentAccent = accent;
                info.parentTheme = this;
                info.save();
            }
            this.overrideWallpaper = info;
            if (accent != null) {
                accent.overrideWallpaper = info;
            }
        }

        public String getName() {
            if ("Blue".equals(this.name)) {
                return LocaleController.getString("ThemeClassic", R.string.ThemeClassic);
            }
            if ("Dark Blue".equals(this.name)) {
                return LocaleController.getString("ThemeDark", R.string.ThemeDark);
            }
            if ("Arctic Blue".equals(this.name)) {
                return LocaleController.getString("ThemeArcticBlue", R.string.ThemeArcticBlue);
            }
            if ("Day".equals(this.name)) {
                return LocaleController.getString("ThemeDay", R.string.ThemeDay);
            }
            if ("Night".equals(this.name)) {
                return LocaleController.getString("ThemeNight", R.string.ThemeNight);
            }
            TLRPC.TL_theme tL_theme = this.info;
            return tL_theme != null ? tL_theme.title : this.name;
        }

        public void setCurrentAccentId(int id) {
            this.currentAccentId = id;
            ThemeAccent accent = getAccent(false);
            if (accent != null) {
                this.overrideWallpaper = accent.overrideWallpaper;
            }
        }

        public String generateWallpaperName(ThemeAccent accent, boolean original) {
            StringBuilder sb;
            StringBuilder sb2;
            if (accent == null) {
                accent = getAccent(false);
            }
            if (accent != null) {
                StringBuilder sb3 = new StringBuilder();
                if (original) {
                    sb2 = new StringBuilder();
                    sb2.append(this.name);
                    sb2.append("_");
                    sb2.append(accent.id);
                    sb2.append("_wp_o");
                } else {
                    sb2 = new StringBuilder();
                    sb2.append(this.name);
                    sb2.append("_");
                    sb2.append(accent.id);
                    sb2.append("_wp");
                }
                sb3.append(sb2.toString());
                sb3.append(Utilities.random.nextInt());
                sb3.append(".jpg");
                return sb3.toString();
            }
            StringBuilder sb4 = new StringBuilder();
            if (original) {
                sb = new StringBuilder();
                sb.append(this.name);
                sb.append("_wp_o");
            } else {
                sb = new StringBuilder();
                sb.append(this.name);
                sb.append("_wp");
            }
            sb4.append(sb.toString());
            sb4.append(Utilities.random.nextInt());
            sb4.append(".jpg");
            return sb4.toString();
        }

        public void setPreviewInColor(int color) {
            this.previewInColor = color;
        }

        public void setPreviewOutColor(int color) {
            this.previewOutColor = color;
        }

        public void setPreviewBackgroundColor(int color) {
            this.previewBackgroundColor = color;
        }

        public int getPreviewInColor() {
            if (this.firstAccentIsDefault && this.currentAccentId == Theme.DEFALT_THEME_ACCENT_ID) {
                return -1;
            }
            return this.previewInColor;
        }

        public int getPreviewOutColor() {
            if (this.firstAccentIsDefault && this.currentAccentId == Theme.DEFALT_THEME_ACCENT_ID) {
                return -983328;
            }
            return this.previewOutColor;
        }

        public int getPreviewBackgroundColor() {
            if (this.firstAccentIsDefault && this.currentAccentId == Theme.DEFALT_THEME_ACCENT_ID) {
                return -3155485;
            }
            return this.previewBackgroundColor;
        }

        public final boolean isDefaultMyMessagesBubbles() {
            if (!this.firstAccentIsDefault) {
                return false;
            }
            int i = this.currentAccentId;
            int i2 = Theme.DEFALT_THEME_ACCENT_ID;
            if (i == i2) {
                return true;
            }
            ThemeAccent themeAccent = this.themeAccentsMap.get(i2);
            ThemeAccent themeAccent2 = this.themeAccentsMap.get(this.currentAccentId);
            return themeAccent != null && themeAccent2 != null && themeAccent.myMessagesAccentColor == themeAccent2.myMessagesAccentColor && themeAccent.myMessagesGradientAccentColor1 == themeAccent2.myMessagesGradientAccentColor1 && themeAccent.myMessagesGradientAccentColor2 == themeAccent2.myMessagesGradientAccentColor2 && themeAccent.myMessagesGradientAccentColor3 == themeAccent2.myMessagesGradientAccentColor3 && themeAccent.myMessagesAnimated == themeAccent2.myMessagesAnimated;
        }

        public final boolean isDefaultMyMessages() {
            if (!this.firstAccentIsDefault) {
                return false;
            }
            int i = this.currentAccentId;
            int i2 = Theme.DEFALT_THEME_ACCENT_ID;
            if (i == i2) {
                return true;
            }
            ThemeAccent themeAccent = this.themeAccentsMap.get(i2);
            ThemeAccent themeAccent2 = this.themeAccentsMap.get(this.currentAccentId);
            return themeAccent != null && themeAccent2 != null && themeAccent.accentColor2 == themeAccent2.accentColor2 && themeAccent.myMessagesAccentColor == themeAccent2.myMessagesAccentColor && themeAccent.myMessagesGradientAccentColor1 == themeAccent2.myMessagesGradientAccentColor1 && themeAccent.myMessagesGradientAccentColor2 == themeAccent2.myMessagesGradientAccentColor2 && themeAccent.myMessagesGradientAccentColor3 == themeAccent2.myMessagesGradientAccentColor3 && themeAccent.myMessagesAnimated == themeAccent2.myMessagesAnimated;
        }

        public final boolean isDefaultMainAccent() {
            if (!this.firstAccentIsDefault) {
                return false;
            }
            int i = this.currentAccentId;
            int i2 = Theme.DEFALT_THEME_ACCENT_ID;
            if (i == i2) {
                return true;
            }
            ThemeAccent themeAccent = this.themeAccentsMap.get(i2);
            ThemeAccent themeAccent2 = this.themeAccentsMap.get(this.currentAccentId);
            return (themeAccent2 == null || themeAccent == null || themeAccent.accentColor != themeAccent2.accentColor) ? false : true;
        }

        public boolean hasAccentColors() {
            return this.defaultAccentCount != 0;
        }

        public boolean isMonet() {
            return "Monet Dark".equals(this.name) || "Monet Light".equals(this.name);
        }

        public boolean isDark() {
            int i = this.isDark;
            if (i != -1) {
                return i == 1;
            }
            if ("Dark Blue".equals(this.name) || "Night".equals(this.name) || "Amoled".equals(this.name) || "Monet Dark".equals(this.name)) {
                this.isDark = 1;
            } else if ("Blue".equals(this.name) || "Arctic Blue".equals(this.name) || "Day".equals(this.name) || "Monet Light".equals(this.name)) {
                this.isDark = 0;
            }
            if (this.isDark == -1) {
                Theme.checkIsDark(Theme.getThemeFileValues(new File(this.pathToFile), null, new String[1]), this);
            }
            return this.isDark == 1;
        }

        public boolean isLight() {
            return this.pathToFile == null && !isDark();
        }

        public String getKey() {
            if (this.info != null) {
                return "remote" + this.info.id;
            }
            return this.name;
        }

        public static ThemeInfo createWithJson(JSONObject object) {
            if (object == null) {
                return null;
            }
            try {
                ThemeInfo themeInfo = new ThemeInfo();
                themeInfo.name = object.getString("name");
                themeInfo.pathToFile = object.getString("path");
                if (object.has("account")) {
                    themeInfo.account = object.getInt("account");
                }
                if (object.has("info")) {
                    try {
                        SerializedData serializedData = new SerializedData(Utilities.hexToBytes(object.getString("info")));
                        themeInfo.info = TLRPC.Theme.TLdeserialize(serializedData, serializedData.readInt32(true), true);
                    } catch (Throwable th) {
                        FileLog.e(th);
                    }
                }
                if (object.has("loaded")) {
                    themeInfo.loaded = object.getBoolean("loaded");
                }
                return themeInfo;
            } catch (Exception e) {
                FileLog.e(e);
                return null;
            }
        }

        public static ThemeInfo createWithString(String string) {
            if (TextUtils.isEmpty(string)) {
                return null;
            }
            String[] split = string.split("\\|");
            if (split.length != 2) {
                return null;
            }
            ThemeInfo themeInfo = new ThemeInfo();
            themeInfo.name = split[0];
            themeInfo.pathToFile = split[1];
            return themeInfo;
        }

        public final void setAccentColorOptions(int[] accent, int[] myMessages, int[] myMessagesGradient, int[] background, int[] backgroundGradient1, int[] backgroundGradient2, int[] backgroundGradient3, int[] ids, String[] patternSlugs, int[] patternRotations, int[] patternIntensities) {
            this.defaultAccentCount = accent.length;
            this.themeAccents = new ArrayList<>();
            this.themeAccentsMap = new SparseArray<>();
            this.accentsByThemeId = new LongSparseArray<>();
            for (int i = 0; i < accent.length; i++) {
                ThemeAccent themeAccent = new ThemeAccent();
                themeAccent.id = ids != null ? ids[i] : i;
                if (Theme.isHome(themeAccent)) {
                    themeAccent.isDefault = true;
                }
                themeAccent.accentColor = accent[i];
                themeAccent.parentTheme = this;
                if (myMessages != null) {
                    themeAccent.myMessagesAccentColor = myMessages[i];
                }
                if (myMessagesGradient != null) {
                    themeAccent.myMessagesGradientAccentColor1 = myMessagesGradient[i];
                }
                if (background != null) {
                    themeAccent.backgroundOverrideColor = background[i];
                    if (this.firstAccentIsDefault && themeAccent.id == Theme.DEFALT_THEME_ACCENT_ID) {
                        themeAccent.backgroundOverrideColor = 4294967296L;
                    } else {
                        themeAccent.backgroundOverrideColor = background[i];
                    }
                }
                if (backgroundGradient1 != null) {
                    if (this.firstAccentIsDefault && themeAccent.id == Theme.DEFALT_THEME_ACCENT_ID) {
                        themeAccent.backgroundGradientOverrideColor1 = 4294967296L;
                    } else {
                        themeAccent.backgroundGradientOverrideColor1 = backgroundGradient1[i];
                    }
                }
                if (backgroundGradient2 != null) {
                    if (this.firstAccentIsDefault && themeAccent.id == Theme.DEFALT_THEME_ACCENT_ID) {
                        themeAccent.backgroundGradientOverrideColor2 = 4294967296L;
                    } else {
                        themeAccent.backgroundGradientOverrideColor2 = backgroundGradient2[i];
                    }
                }
                if (backgroundGradient3 != null) {
                    if (this.firstAccentIsDefault && themeAccent.id == Theme.DEFALT_THEME_ACCENT_ID) {
                        themeAccent.backgroundGradientOverrideColor3 = 4294967296L;
                    } else {
                        themeAccent.backgroundGradientOverrideColor3 = backgroundGradient3[i];
                    }
                }
                if (patternSlugs != null) {
                    themeAccent.patternIntensity = patternIntensities[i] / 100.0f;
                    themeAccent.backgroundRotation = patternRotations[i];
                    themeAccent.patternSlug = patternSlugs[i];
                }
                if ((Theme.isHome(themeAccent) && this.name.equals("Dark Blue")) || this.name.equals("Night")) {
                    themeAccent.myMessagesAccentColor = -10128392;
                    themeAccent.myMessagesGradientAccentColor1 = -9026357;
                    themeAccent.myMessagesGradientAccentColor2 = -7845452;
                    themeAccent.myMessagesGradientAccentColor3 = -5811800;
                    if (this.name.equals("Night")) {
                        themeAccent.patternIntensity = -0.57f;
                        themeAccent.backgroundOverrideColor = -9666650L;
                        themeAccent.backgroundGradientOverrideColor1 = -13749173L;
                        themeAccent.backgroundGradientOverrideColor2 = -8883033L;
                        themeAccent.backgroundGradientOverrideColor3 = -13421992L;
                    }
                }
                this.themeAccentsMap.put(themeAccent.id, themeAccent);
                this.themeAccents.add(themeAccent);
            }
            this.accentBaseColor = this.themeAccentsMap.get(0).accentColor;
        }

        public final void loadThemeDocument() {
            this.loaded = false;
            this.loadingThemeWallpaperName = null;
            this.newPathToWallpaper = null;
            addObservers();
            FileLoader fileLoader = FileLoader.getInstance(this.account);
            TLRPC.TL_theme tL_theme = this.info;
            fileLoader.loadFile(tL_theme.document, tL_theme, 1, 1);
        }

        public final void addObservers() {
            NotificationCenter.getInstance(this.account).addObserver(this, NotificationCenter.fileLoaded);
            NotificationCenter.getInstance(this.account).addObserver(this, NotificationCenter.fileLoadFailed);
        }

        public final void removeObservers() {
            NotificationCenter.getInstance(this.account).removeObserver(this, NotificationCenter.fileLoaded);
            NotificationCenter.getInstance(this.account).removeObserver(this, NotificationCenter.fileLoadFailed);
        }

        public final void onFinishLoadingRemoteTheme() {
            this.loaded = true;
            this.previewParsed = false;
            Theme.saveOtherThemes(true);
            if (this == Theme.currentTheme && Theme.previousTheme == null) {
                NotificationCenter globalInstance = NotificationCenter.getGlobalInstance();
                int i = NotificationCenter.needSetDayNightTheme;
                Object[] objArr = new Object[5];
                objArr[0] = this;
                objArr[1] = Boolean.valueOf(this == Theme.currentNightTheme);
                objArr[2] = null;
                objArr[3] = -1;
                objArr[4] = Theme.fallbackKeys;
                globalInstance.postNotificationName(i, objArr);
            }
        }

        public static boolean accentEquals(ThemeAccent accent, TLRPC.ThemeSettings settings) {
            long j;
            long j2;
            int i;
            String str;
            float f;
            int i2;
            TLRPC.WallPaperSettings wallPaperSettings;
            long j3;
            int intValue = settings.message_colors.size() > 0 ? ((Integer) settings.message_colors.get(0)).intValue() | (-16777216) : 0;
            int intValue2 = settings.message_colors.size() > 1 ? ((Integer) settings.message_colors.get(1)).intValue() | (-16777216) : 0;
            if (intValue == intValue2) {
                intValue2 = 0;
            }
            int intValue3 = settings.message_colors.size() > 2 ? ((Integer) settings.message_colors.get(2)).intValue() | (-16777216) : 0;
            int intValue4 = settings.message_colors.size() > 3 ? (-16777216) | ((Integer) settings.message_colors.get(3)).intValue() : 0;
            TLRPC.WallPaper wallPaper = settings.wallpaper;
            long j4 = 0;
            if (wallPaper == null || (wallPaperSettings = wallPaper.settings) == null) {
                j = 0;
                j2 = 0;
                i = 0;
                str = null;
                f = 0.0f;
                i2 = 0;
            } else {
                i2 = Theme.getWallpaperColor(wallPaperSettings.background_color);
                long wallpaperColor = settings.wallpaper.settings.second_background_color == 0 ? 4294967296L : Theme.getWallpaperColor(r11);
                long wallpaperColor2 = settings.wallpaper.settings.third_background_color == 0 ? 4294967296L : Theme.getWallpaperColor(r11);
                long wallpaperColor3 = settings.wallpaper.settings.fourth_background_color == 0 ? 4294967296L : Theme.getWallpaperColor(r11);
                int wallpaperRotation = AndroidUtilities.getWallpaperRotation(settings.wallpaper.settings.rotation, false);
                TLRPC.WallPaper wallPaper2 = settings.wallpaper;
                if ((wallPaper2 instanceof TLRPC.TL_wallPaperNoFile) || !wallPaper2.pattern) {
                    i = wallpaperRotation;
                    j3 = wallpaperColor2;
                    str = null;
                    f = 0.0f;
                } else {
                    j3 = wallpaperColor2;
                    f = wallPaper2.settings.intensity / 100.0f;
                    str = wallPaper2.slug;
                    i = wallpaperRotation;
                }
                long j5 = wallpaperColor3;
                j4 = wallpaperColor;
                j = j3;
                j2 = j5;
            }
            return settings.accent_color == accent.accentColor && settings.outbox_accent_color == accent.accentColor2 && intValue == accent.myMessagesAccentColor && intValue2 == accent.myMessagesGradientAccentColor1 && intValue3 == accent.myMessagesGradientAccentColor2 && intValue4 == accent.myMessagesGradientAccentColor3 && settings.message_colors_animated == accent.myMessagesAnimated && ((long) i2) == accent.backgroundOverrideColor && j4 == accent.backgroundGradientOverrideColor1 && j == accent.backgroundGradientOverrideColor2 && j2 == accent.backgroundGradientOverrideColor3 && i == accent.backgroundRotation && TextUtils.equals(str, accent.patternSlug) && ((double) Math.abs(f - accent.patternIntensity)) < 0.001d;
        }

        public static void fillAccentValues(ThemeAccent themeAccent, TLRPC.ThemeSettings settings) {
            TLRPC.WallPaperSettings wallPaperSettings;
            themeAccent.accentColor = settings.accent_color;
            themeAccent.accentColor2 = settings.outbox_accent_color;
            themeAccent.myMessagesAccentColor = settings.message_colors.size() > 0 ? ((Integer) settings.message_colors.get(0)).intValue() | (-16777216) : 0;
            int intValue = settings.message_colors.size() > 1 ? ((Integer) settings.message_colors.get(1)).intValue() | (-16777216) : 0;
            themeAccent.myMessagesGradientAccentColor1 = intValue;
            if (themeAccent.myMessagesAccentColor == intValue) {
                themeAccent.myMessagesGradientAccentColor1 = 0;
            }
            themeAccent.myMessagesGradientAccentColor2 = settings.message_colors.size() > 2 ? ((Integer) settings.message_colors.get(2)).intValue() | (-16777216) : 0;
            themeAccent.myMessagesGradientAccentColor3 = settings.message_colors.size() > 3 ? ((Integer) settings.message_colors.get(3)).intValue() | (-16777216) : 0;
            themeAccent.myMessagesAnimated = settings.message_colors_animated;
            TLRPC.WallPaper wallPaper = settings.wallpaper;
            if (wallPaper == null || (wallPaperSettings = wallPaper.settings) == null) {
                return;
            }
            if (wallPaperSettings.background_color == 0) {
                themeAccent.backgroundOverrideColor = 4294967296L;
            } else {
                themeAccent.backgroundOverrideColor = Theme.getWallpaperColor(r0);
            }
            TLRPC.WallPaperSettings wallPaperSettings2 = settings.wallpaper.settings;
            if ((wallPaperSettings2.flags & 16) != 0 && wallPaperSettings2.second_background_color == 0) {
                themeAccent.backgroundGradientOverrideColor1 = 4294967296L;
            } else {
                themeAccent.backgroundGradientOverrideColor1 = Theme.getWallpaperColor(wallPaperSettings2.second_background_color);
            }
            TLRPC.WallPaperSettings wallPaperSettings3 = settings.wallpaper.settings;
            if ((wallPaperSettings3.flags & 32) != 0 && wallPaperSettings3.third_background_color == 0) {
                themeAccent.backgroundGradientOverrideColor2 = 4294967296L;
            } else {
                themeAccent.backgroundGradientOverrideColor2 = Theme.getWallpaperColor(wallPaperSettings3.third_background_color);
            }
            TLRPC.WallPaperSettings wallPaperSettings4 = settings.wallpaper.settings;
            if ((wallPaperSettings4.flags & 64) != 0 && wallPaperSettings4.fourth_background_color == 0) {
                themeAccent.backgroundGradientOverrideColor3 = 4294967296L;
            } else {
                themeAccent.backgroundGradientOverrideColor3 = Theme.getWallpaperColor(wallPaperSettings4.fourth_background_color);
            }
            themeAccent.backgroundRotation = AndroidUtilities.getWallpaperRotation(settings.wallpaper.settings.rotation, false);
            TLRPC.WallPaper wallPaper2 = settings.wallpaper;
            if ((wallPaper2 instanceof TLRPC.TL_wallPaperNoFile) || !wallPaper2.pattern) {
                return;
            }
            themeAccent.patternSlug = wallPaper2.slug;
            TLRPC.WallPaperSettings wallPaperSettings5 = wallPaper2.settings;
            themeAccent.patternIntensity = wallPaperSettings5.intensity / 100.0f;
            themeAccent.patternMotion = wallPaperSettings5.motion;
        }

        public ThemeAccent createNewAccent(TLRPC.ThemeSettings settings) {
            ThemeAccent themeAccent = new ThemeAccent();
            fillAccentValues(themeAccent, settings);
            themeAccent.parentTheme = this;
            return themeAccent;
        }

        public ThemeAccent createNewAccent(TLRPC.TL_theme info, int account) {
            return createNewAccent(info, account, false, 0);
        }

        public ThemeAccent createNewAccent(TLRPC.TL_theme info, int account, boolean ignoreThemeInfoId, int settingsIndex) {
            if (info == null) {
                return null;
            }
            TLRPC.ThemeSettings themeSettings = settingsIndex < info.settings.size() ? (TLRPC.ThemeSettings) info.settings.get(settingsIndex) : null;
            if (ignoreThemeInfoId) {
                ThemeAccent themeAccent = this.chatAccentsByThemeId.get(info.id);
                if (themeAccent != null) {
                    return themeAccent;
                }
                int i = this.lastChatThemeId + 1;
                this.lastChatThemeId = i;
                ThemeAccent createNewAccent = createNewAccent(themeSettings);
                createNewAccent.id = i;
                createNewAccent.info = info;
                createNewAccent.account = account;
                this.chatAccentsByThemeId.put(i, createNewAccent);
                return createNewAccent;
            }
            ThemeAccent themeAccent2 = this.accentsByThemeId.get(info.id);
            if (themeAccent2 != null) {
                return themeAccent2;
            }
            int i2 = this.lastAccentId + 1;
            this.lastAccentId = i2;
            ThemeAccent createNewAccent2 = createNewAccent(themeSettings);
            createNewAccent2.id = i2;
            createNewAccent2.info = info;
            createNewAccent2.account = account;
            this.themeAccentsMap.put(i2, createNewAccent2);
            this.themeAccents.add(0, createNewAccent2);
            Theme.sortAccents(this);
            this.accentsByThemeId.put(info.id, createNewAccent2);
            return createNewAccent2;
        }

        public ThemeAccent getAccent(boolean createNew) {
            ThemeAccent themeAccent;
            if (this.themeAccents == null || (themeAccent = this.themeAccentsMap.get(this.currentAccentId)) == null) {
                return null;
            }
            if (!createNew) {
                return themeAccent;
            }
            int i = this.lastAccentId + 1;
            this.lastAccentId = i;
            ThemeAccent themeAccent2 = new ThemeAccent();
            themeAccent2.accentColor = themeAccent.accentColor;
            themeAccent2.accentColor2 = themeAccent.accentColor2;
            themeAccent2.myMessagesAccentColor = themeAccent.myMessagesAccentColor;
            themeAccent2.myMessagesGradientAccentColor1 = themeAccent.myMessagesGradientAccentColor1;
            themeAccent2.myMessagesGradientAccentColor2 = themeAccent.myMessagesGradientAccentColor2;
            themeAccent2.myMessagesGradientAccentColor3 = themeAccent.myMessagesGradientAccentColor3;
            themeAccent2.myMessagesAnimated = themeAccent.myMessagesAnimated;
            themeAccent2.backgroundOverrideColor = themeAccent.backgroundOverrideColor;
            themeAccent2.backgroundGradientOverrideColor1 = themeAccent.backgroundGradientOverrideColor1;
            themeAccent2.backgroundGradientOverrideColor2 = themeAccent.backgroundGradientOverrideColor2;
            themeAccent2.backgroundGradientOverrideColor3 = themeAccent.backgroundGradientOverrideColor3;
            themeAccent2.backgroundRotation = themeAccent.backgroundRotation;
            themeAccent2.patternSlug = themeAccent.patternSlug;
            themeAccent2.patternIntensity = themeAccent.patternIntensity;
            themeAccent2.patternMotion = themeAccent.patternMotion;
            themeAccent2.parentTheme = this;
            OverrideWallpaperInfo overrideWallpaperInfo = this.overrideWallpaper;
            if (overrideWallpaperInfo != null) {
                themeAccent2.overrideWallpaper = new OverrideWallpaperInfo(overrideWallpaperInfo, this, themeAccent2);
            }
            this.prevAccentId = this.currentAccentId;
            themeAccent2.id = i;
            this.currentAccentId = i;
            this.overrideWallpaper = themeAccent2.overrideWallpaper;
            this.themeAccentsMap.put(i, themeAccent2);
            this.themeAccents.add(0, themeAccent2);
            Theme.sortAccents(this);
            return themeAccent2;
        }

        public int getAccentColor(int id) {
            ThemeAccent themeAccent = this.themeAccentsMap.get(id);
            if (themeAccent != null) {
                return themeAccent.accentColor;
            }
            return 0;
        }

        public boolean createBackground(File file, String toPath) {
            int patternColor;
            try {
                Bitmap scaledBitmap = AndroidUtilities.getScaledBitmap(AndroidUtilities.dp(640.0f), AndroidUtilities.dp(360.0f), file.getAbsolutePath(), (String) null, 0);
                if (scaledBitmap != null && this.patternBgColor != 0) {
                    Bitmap createBitmap = Bitmap.createBitmap(scaledBitmap.getWidth(), scaledBitmap.getHeight(), scaledBitmap.getConfig());
                    Canvas canvas = new Canvas(createBitmap);
                    int i = this.patternBgGradientColor2;
                    if (i != 0) {
                        patternColor = MotionBackgroundDrawable.getPatternColor(this.patternBgColor, this.patternBgGradientColor1, i, this.patternBgGradientColor3);
                    } else {
                        int i2 = this.patternBgGradientColor1;
                        if (i2 != 0) {
                            patternColor = AndroidUtilities.getAverageColor(this.patternBgColor, i2);
                            GradientDrawable gradientDrawable = new GradientDrawable(BackgroundGradientDrawable.getGradientOrientation(this.patternBgGradientRotation), new int[]{this.patternBgColor, this.patternBgGradientColor1});
                            gradientDrawable.setBounds(0, 0, createBitmap.getWidth(), createBitmap.getHeight());
                            gradientDrawable.draw(canvas);
                        } else {
                            patternColor = AndroidUtilities.getPatternColor(this.patternBgColor);
                            canvas.drawColor(this.patternBgColor);
                        }
                    }
                    Paint paint = new Paint(2);
                    paint.setColorFilter(new PorterDuffColorFilter(patternColor, PorterDuff.Mode.SRC_IN));
                    paint.setAlpha((int) ((this.patternIntensity / 100.0f) * 255.0f));
                    canvas.drawBitmap(scaledBitmap, 0.0f, 0.0f, paint);
                    canvas.setBitmap(null);
                    scaledBitmap = createBitmap;
                }
                if (this.isBlured) {
                    scaledBitmap = Utilities.blurWallpaper(scaledBitmap);
                }
                FileOutputStream fileOutputStream = new FileOutputStream(toPath);
                scaledBitmap.compress(this.patternBgGradientColor2 != 0 ? Bitmap.CompressFormat.PNG : Bitmap.CompressFormat.JPEG, 87, fileOutputStream);
                fileOutputStream.close();
                return true;
            } catch (Throwable th) {
                FileLog.e(th);
                return false;
            }
        }

        public void didReceivedNotification(int id, int account, Object... args) {
            int i = NotificationCenter.fileLoaded;
            if (id == i || id == NotificationCenter.fileLoadFailed) {
                String str = (String) args[0];
                TLRPC.TL_theme tL_theme = this.info;
                if (tL_theme == null || tL_theme.document == null) {
                    return;
                }
                if (str.equals(this.loadingThemeWallpaperName)) {
                    this.loadingThemeWallpaperName = null;
                    final File file = (File) args[1];
                    Utilities.globalQueue.postRunnable(new Runnable() {
                        @Override
                        public final void run() {
                            Theme.ThemeInfo.this.lambda$didReceivedNotification$0(file);
                        }
                    });
                    return;
                }
                if (str.equals(FileLoader.getAttachFileName(this.info.document))) {
                    removeObservers();
                    if (id == i) {
                        File file2 = new File(this.pathToFile);
                        TLRPC.TL_theme tL_theme2 = this.info;
                        final ThemeInfo fillThemeValues = Theme.fillThemeValues(file2, tL_theme2.title, tL_theme2);
                        if (fillThemeValues != null && fillThemeValues.pathToWallpaper != null && !new File(fillThemeValues.pathToWallpaper).exists()) {
                            this.patternBgColor = fillThemeValues.patternBgColor;
                            this.patternBgGradientColor1 = fillThemeValues.patternBgGradientColor1;
                            this.patternBgGradientColor2 = fillThemeValues.patternBgGradientColor2;
                            this.patternBgGradientColor3 = fillThemeValues.patternBgGradientColor3;
                            this.patternBgGradientRotation = fillThemeValues.patternBgGradientRotation;
                            this.isBlured = fillThemeValues.isBlured;
                            this.patternIntensity = fillThemeValues.patternIntensity;
                            this.newPathToWallpaper = fillThemeValues.pathToWallpaper;
                            TLRPC.TL_account_getWallPaper tL_account_getWallPaper = new TLRPC.TL_account_getWallPaper();
                            TLRPC.TL_inputWallPaperSlug tL_inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug();
                            tL_inputWallPaperSlug.slug = fillThemeValues.slug;
                            tL_account_getWallPaper.wallpaper = tL_inputWallPaperSlug;
                            ConnectionsManager.getInstance(fillThemeValues.account).sendRequest(tL_account_getWallPaper, new RequestDelegate() {
                                public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                                    Theme.ThemeInfo.this.lambda$didReceivedNotification$2(fillThemeValues, tLObject, tL_error);
                                }
                            });
                            return;
                        }
                        onFinishLoadingRemoteTheme();
                    }
                }
            }
        }

        public void lambda$didReceivedNotification$0(File file) {
            createBackground(file, this.newPathToWallpaper);
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    Theme.ThemeInfo.this.onFinishLoadingRemoteTheme();
                }
            });
        }

        public void lambda$didReceivedNotification$2(final ThemeInfo themeInfo, final TLObject tLObject, TLRPC.TL_error tL_error) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    Theme.ThemeInfo.this.lambda$didReceivedNotification$1(tLObject, themeInfo);
                }
            });
        }

        public void lambda$didReceivedNotification$1(TLObject tLObject, ThemeInfo themeInfo) {
            if (tLObject instanceof TLRPC.TL_wallPaper) {
                TLRPC.TL_wallPaper tL_wallPaper = (TLRPC.TL_wallPaper) tLObject;
                this.loadingThemeWallpaperName = FileLoader.getAttachFileName(((TLRPC.WallPaper) tL_wallPaper).document);
                addObservers();
                FileLoader.getInstance(themeInfo.account).loadFile(((TLRPC.WallPaper) tL_wallPaper).document, tL_wallPaper, 1, 1);
                return;
            }
            onFinishLoadingRemoteTheme();
        }
    }

    public interface ResourcesProvider {
        void applyServiceShaderMatrix(int w, int h, float translationX, float translationY);

        ColorFilter getAnimatedEmojiColorFilter();

        int getColor(int key);

        int getColorOrDefault(int key);

        int getCurrentColor(int key);

        Drawable getDrawable(String drawableKey);

        Paint getPaint(String paintKey);

        boolean hasGradientService();

        boolean isDark();

        void setAnimatedColor(int key, int color);

        public final class CC {
            public static Drawable $default$getDrawable(ResourcesProvider resourcesProvider, String str) {
                return null;
            }

            public static boolean $default$hasGradientService(ResourcesProvider resourcesProvider) {
                return false;
            }

            public static void $default$setAnimatedColor(ResourcesProvider resourcesProvider, int i, int i2) {
            }

            public static Paint $default$getPaint(ResourcesProvider _this, String str) {
                return Theme.getThemePaint(str);
            }

            public static boolean $default$isDark(ResourcesProvider _this) {
                return Theme.isCurrentThemeDark();
            }

            public static ColorFilter $default$getAnimatedEmojiColorFilter(ResourcesProvider _this) {
                return Theme.chat_animatedEmojiTextColorFilter;
            }
        }
    }

    static {
        ThemeInfo themeInfo;
        ThemeInfo themeInfo2;
        ThemeInfo themeInfo3;
        ?? r2;
        boolean z;
        Iterator<ThemeInfo> it;
        ThemeInfo themeInfo4;
        String str;
        RuntimeException runtimeException;
        boolean z2;
        Iterator<ThemeInfo> it2;
        ThemeInfo themeInfo5;
        String str2;
        SerializedData serializedData;
        int i;
        boolean z3;
        selectedAutoNightType = 0;
        autoNightBrighnessThreshold = 0.25f;
        autoNightDayStartTime = 1320;
        autoNightDayEndTime = 480;
        autoNightSunsetTime = 1320;
        autoNightLastSunCheckDay = -1;
        autoNightSunriseTime = 480;
        String str3 = "";
        autoNightCityName = "";
        autoNightLocationLatitude = 10000.0d;
        autoNightLocationLongitude = 10000.0d;
        int i2 = UserConfig.MAX_ACCOUNT_COUNT;
        loadingRemoteThemes = new boolean[i2];
        lastLoadingThemesTime = new int[i2];
        remoteThemesHash = new long[i2];
        avatarDrawables = new Drawable[22];
        tabsDrawables = new Drawable[38];
        chat_status_drawables = new StatusDrawable[6];
        chat_msgInCallDrawable = new Drawable[2];
        chat_msgInCallSelectedDrawable = new Drawable[2];
        chat_msgOutCallDrawable = new Drawable[2];
        chat_msgOutCallSelectedDrawable = new Drawable[2];
        chat_pollCheckDrawable = new Drawable[2];
        chat_pollCrossDrawable = new Drawable[2];
        chat_pollHintDrawable = new Drawable[2];
        chat_psaHelpDrawable = new Drawable[2];
        chat_attachButtonDrawables = new RLottieDrawable[6];
        chat_locationDrawable = new Drawable[2];
        chat_contactDrawable = new Drawable[2];
        chat_fileStatesDrawable = (Drawable[][]) Array.newInstance((Class<?>) Drawable.class, 5, 2);
        chat_filePath = new Path[2];
        chat_updatePath = new Path[3];
        int i3 = colorsCount;
        int i4 = i3 + 1;
        colorsCount = i4;
        key_wallpaperFileOffset = i3;
        int i5 = i4 + 1;
        colorsCount = i5;
        key_dialogBackground = i4;
        int i6 = i5 + 1;
        colorsCount = i6;
        key_dialogBackgroundGray = i5;
        int i7 = i6 + 1;
        colorsCount = i7;
        key_dialogTextBlack = i6;
        int i8 = i7 + 1;
        colorsCount = i8;
        key_dialogTextLink = i7;
        int i9 = i8 + 1;
        colorsCount = i9;
        key_dialogLinkSelection = i8;
        int i10 = i9 + 1;
        colorsCount = i10;
        key_dialogTextBlue = i9;
        int i11 = i10 + 1;
        colorsCount = i11;
        key_dialogTextBlue2 = i10;
        int i12 = i11 + 1;
        colorsCount = i12;
        key_dialogTextBlue4 = i11;
        int i13 = i12 + 1;
        colorsCount = i13;
        key_dialogTextGray = i12;
        int i14 = i13 + 1;
        colorsCount = i14;
        key_dialogTextGray2 = i13;
        int i15 = i14 + 1;
        colorsCount = i15;
        key_dialogTextGray3 = i14;
        int i16 = i15 + 1;
        colorsCount = i16;
        key_dialogTextGray4 = i15;
        int i17 = i16 + 1;
        colorsCount = i17;
        key_dialogTextHint = i16;
        int i18 = i17 + 1;
        colorsCount = i18;
        key_dialogInputField = i17;
        int i19 = i18 + 1;
        colorsCount = i19;
        key_dialogInputFieldActivated = i18;
        int i20 = i19 + 1;
        colorsCount = i20;
        key_dialogCheckboxSquareBackground = i19;
        int i21 = i20 + 1;
        colorsCount = i21;
        key_dialogCheckboxSquareCheck = i20;
        int i22 = i21 + 1;
        colorsCount = i22;
        key_dialogCheckboxSquareUnchecked = i21;
        int i23 = i22 + 1;
        colorsCount = i23;
        key_dialogCheckboxSquareDisabled = i22;
        int i24 = i23 + 1;
        colorsCount = i24;
        key_dialogScrollGlow = i23;
        int i25 = i24 + 1;
        colorsCount = i25;
        key_dialogRoundCheckBox = i24;
        int i26 = i25 + 1;
        colorsCount = i26;
        key_dialogRoundCheckBoxCheck = i25;
        int i27 = i26 + 1;
        colorsCount = i27;
        key_dialogRadioBackground = i26;
        int i28 = i27 + 1;
        colorsCount = i28;
        key_dialogRadioBackgroundChecked = i27;
        int i29 = i28 + 1;
        colorsCount = i29;
        key_dialogLineProgress = i28;
        int i30 = i29 + 1;
        colorsCount = i30;
        key_dialogLineProgressBackground = i29;
        int i31 = i30 + 1;
        colorsCount = i31;
        key_dialogButton = i30;
        int i32 = i31 + 1;
        colorsCount = i32;
        key_dialogButtonSelector = i31;
        int i33 = i32 + 1;
        colorsCount = i33;
        key_dialogIcon = i32;
        int i34 = i33 + 1;
        colorsCount = i34;
        key_dialogGrayLine = i33;
        int i35 = i34 + 1;
        colorsCount = i35;
        key_dialogTopBackground = i34;
        int i36 = i35 + 1;
        colorsCount = i36;
        key_dialogCameraIcon = i35;
        int i37 = i36 + 1;
        colorsCount = i37;
        key_dialog_inlineProgressBackground = i36;
        int i38 = i37 + 1;
        colorsCount = i38;
        key_dialog_inlineProgress = i37;
        int i39 = i38 + 1;
        colorsCount = i39;
        key_dialogSearchBackground = i38;
        int i40 = i39 + 1;
        colorsCount = i40;
        key_dialogSearchHint = i39;
        int i41 = i40 + 1;
        colorsCount = i41;
        key_dialogSearchIcon = i40;
        int i42 = i41 + 1;
        colorsCount = i42;
        key_dialogSearchText = i41;
        int i43 = i42 + 1;
        colorsCount = i43;
        key_dialogFloatingButton = i42;
        int i44 = i43 + 1;
        colorsCount = i44;
        key_dialogFloatingButtonPressed = i43;
        int i45 = i44 + 1;
        colorsCount = i45;
        key_dialogFloatingIcon = i44;
        int i46 = i45 + 1;
        colorsCount = i46;
        key_dialogShadowLine = i45;
        int i47 = i46 + 1;
        colorsCount = i47;
        key_dialogEmptyImage = i46;
        int i48 = i47 + 1;
        colorsCount = i48;
        key_dialogEmptyText = i47;
        int i49 = i48 + 1;
        colorsCount = i49;
        key_dialogSwipeRemove = i48;
        int i50 = i49 + 1;
        colorsCount = i50;
        key_dialogReactionMentionBackground = i49;
        colorsCount = i50 + 1;
        key_windowBackgroundWhite = i50;
        int i51 = colorsCount;
        colorsCount = i51 + 1;
        key_windowBackgroundUnchecked = i51;
        int i52 = colorsCount;
        colorsCount = i52 + 1;
        key_windowBackgroundChecked = i52;
        int i53 = colorsCount;
        colorsCount = i53 + 1;
        key_windowBackgroundCheckText = i53;
        int i54 = colorsCount;
        colorsCount = i54 + 1;
        key_progressCircle = i54;
        int i55 = colorsCount;
        colorsCount = i55 + 1;
        key_listSelector = i55;
        int i56 = colorsCount;
        colorsCount = i56 + 1;
        key_windowBackgroundWhiteInputField = i56;
        int i57 = colorsCount;
        colorsCount = i57 + 1;
        key_windowBackgroundWhiteInputFieldActivated = i57;
        int i58 = colorsCount;
        colorsCount = i58 + 1;
        key_windowBackgroundWhiteGrayIcon = i58;
        int i59 = colorsCount;
        colorsCount = i59 + 1;
        key_windowBackgroundWhiteBlueText = i59;
        int i60 = colorsCount;
        colorsCount = i60 + 1;
        key_windowBackgroundWhiteBlueText2 = i60;
        int i61 = colorsCount;
        colorsCount = i61 + 1;
        key_windowBackgroundWhiteBlueText3 = i61;
        int i62 = colorsCount;
        colorsCount = i62 + 1;
        key_windowBackgroundWhiteBlueText4 = i62;
        int i63 = colorsCount;
        colorsCount = i63 + 1;
        key_windowBackgroundWhiteBlueText5 = i63;
        int i64 = colorsCount;
        colorsCount = i64 + 1;
        key_windowBackgroundWhiteBlueText6 = i64;
        int i65 = colorsCount;
        colorsCount = i65 + 1;
        key_windowBackgroundWhiteBlueText7 = i65;
        int i66 = colorsCount;
        colorsCount = i66 + 1;
        key_windowBackgroundWhiteBlueButton = i66;
        int i67 = colorsCount;
        colorsCount = i67 + 1;
        key_windowBackgroundWhiteBlueIcon = i67;
        int i68 = colorsCount;
        colorsCount = i68 + 1;
        key_windowBackgroundWhiteGreenText = i68;
        int i69 = colorsCount;
        colorsCount = i69 + 1;
        key_windowBackgroundWhiteGreenText2 = i69;
        int i70 = colorsCount;
        colorsCount = i70 + 1;
        key_windowBackgroundWhiteGrayText = i70;
        int i71 = colorsCount;
        colorsCount = i71 + 1;
        key_windowBackgroundWhiteGrayText2 = i71;
        int i72 = colorsCount;
        colorsCount = i72 + 1;
        key_windowBackgroundWhiteGrayText3 = i72;
        int i73 = colorsCount;
        colorsCount = i73 + 1;
        key_windowBackgroundWhiteGrayText4 = i73;
        int i74 = colorsCount;
        colorsCount = i74 + 1;
        key_windowBackgroundWhiteGrayText5 = i74;
        int i75 = colorsCount;
        colorsCount = i75 + 1;
        key_windowBackgroundWhiteGrayText6 = i75;
        int i76 = colorsCount;
        colorsCount = i76 + 1;
        key_windowBackgroundWhiteGrayText7 = i76;
        int i77 = colorsCount;
        colorsCount = i77 + 1;
        key_windowBackgroundWhiteGrayText8 = i77;
        int i78 = colorsCount;
        colorsCount = i78 + 1;
        key_windowBackgroundWhiteBlackText = i78;
        int i79 = colorsCount;
        colorsCount = i79 + 1;
        key_windowBackgroundWhiteHintText = i79;
        int i80 = colorsCount;
        colorsCount = i80 + 1;
        key_windowBackgroundWhiteValueText = i80;
        int i81 = colorsCount;
        colorsCount = i81 + 1;
        key_windowBackgroundWhiteLinkText = i81;
        int i82 = colorsCount;
        colorsCount = i82 + 1;
        key_windowBackgroundWhiteLinkSelection = i82;
        int i83 = colorsCount;
        colorsCount = i83 + 1;
        key_windowBackgroundWhiteBlueHeader = i83;
        int i84 = colorsCount;
        colorsCount = i84 + 1;
        key_switchTrack = i84;
        int i85 = colorsCount;
        colorsCount = i85 + 1;
        key_switchTrackChecked = i85;
        int i86 = colorsCount;
        colorsCount = i86 + 1;
        key_switchTrackBlue = i86;
        int i87 = colorsCount;
        colorsCount = i87 + 1;
        key_switchTrackBlueChecked = i87;
        int i88 = colorsCount;
        colorsCount = i88 + 1;
        key_switchTrackBlueThumb = i88;
        int i89 = colorsCount;
        colorsCount = i89 + 1;
        key_switchTrackBlueThumbChecked = i89;
        int i90 = colorsCount;
        colorsCount = i90 + 1;
        key_switchTrackBlueSelector = i90;
        int i91 = colorsCount;
        colorsCount = i91 + 1;
        key_switchTrackBlueSelectorChecked = i91;
        int i92 = colorsCount;
        colorsCount = i92 + 1;
        key_switch2Track = i92;
        int i93 = colorsCount;
        colorsCount = i93 + 1;
        key_switch2TrackChecked = i93;
        int i94 = colorsCount;
        colorsCount = i94 + 1;
        key_checkboxSquareBackground = i94;
        int i95 = colorsCount;
        colorsCount = i95 + 1;
        key_checkboxSquareCheck = i95;
        int i96 = colorsCount;
        colorsCount = i96 + 1;
        key_checkboxSquareUnchecked = i96;
        int i97 = colorsCount;
        colorsCount = i97 + 1;
        key_checkboxSquareDisabled = i97;
        int i98 = colorsCount;
        colorsCount = i98 + 1;
        key_windowBackgroundGray = i98;
        int i99 = colorsCount;
        colorsCount = i99 + 1;
        key_windowBackgroundGrayShadow = i99;
        int i100 = colorsCount;
        colorsCount = i100 + 1;
        key_emptyListPlaceholder = i100;
        int i101 = colorsCount;
        colorsCount = i101 + 1;
        key_divider = i101;
        int i102 = colorsCount;
        colorsCount = i102 + 1;
        key_graySection = i102;
        int i103 = colorsCount;
        colorsCount = i103 + 1;
        key_graySectionText = i103;
        int i104 = colorsCount;
        colorsCount = i104 + 1;
        key_radioBackground = i104;
        int i105 = colorsCount;
        colorsCount = i105 + 1;
        key_radioBackgroundChecked = i105;
        int i106 = colorsCount;
        colorsCount = i106 + 1;
        key_checkbox = i106;
        int i107 = colorsCount;
        colorsCount = i107 + 1;
        key_checkboxDisabled = i107;
        int i108 = colorsCount;
        colorsCount = i108 + 1;
        key_checkboxCheck = i108;
        int i109 = colorsCount;
        colorsCount = i109 + 1;
        key_fastScrollActive = i109;
        int i110 = colorsCount;
        colorsCount = i110 + 1;
        key_fastScrollInactive = i110;
        int i111 = colorsCount;
        colorsCount = i111 + 1;
        key_fastScrollText = i111;
        int i112 = colorsCount;
        colorsCount = i112 + 1;
        key_text_RedRegular = i112;
        int i113 = colorsCount;
        colorsCount = i113 + 1;
        key_text_RedBold = i113;
        int i114 = colorsCount;
        colorsCount = i114 + 1;
        key_fill_RedNormal = i114;
        int i115 = colorsCount;
        colorsCount = i115 + 1;
        key_fill_RedDark = i115;
        int i116 = colorsCount;
        colorsCount = i116 + 1;
        key_inappPlayerPerformer = i116;
        int i117 = colorsCount;
        colorsCount = i117 + 1;
        key_inappPlayerTitle = i117;
        int i118 = colorsCount;
        colorsCount = i118 + 1;
        key_inappPlayerBackground = i118;
        int i119 = colorsCount;
        colorsCount = i119 + 1;
        key_inappPlayerPlayPause = i119;
        int i120 = colorsCount;
        colorsCount = i120 + 1;
        key_inappPlayerClose = i120;
        int i121 = colorsCount;
        colorsCount = i121 + 1;
        key_returnToCallBackground = i121;
        int i122 = colorsCount;
        colorsCount = i122 + 1;
        key_returnToCallMutedBackground = i122;
        int i123 = colorsCount;
        colorsCount = i123 + 1;
        key_returnToCallText = i123;
        int i124 = colorsCount;
        colorsCount = i124 + 1;
        key_contextProgressInner1 = i124;
        int i125 = colorsCount;
        colorsCount = i125 + 1;
        key_contextProgressOuter1 = i125;
        int i126 = colorsCount;
        colorsCount = i126 + 1;
        key_contextProgressInner2 = i126;
        int i127 = colorsCount;
        colorsCount = i127 + 1;
        key_contextProgressOuter2 = i127;
        int i128 = colorsCount;
        colorsCount = i128 + 1;
        key_contextProgressInner3 = i128;
        int i129 = colorsCount;
        colorsCount = i129 + 1;
        key_contextProgressOuter3 = i129;
        int i130 = colorsCount;
        colorsCount = i130 + 1;
        key_contextProgressInner4 = i130;
        int i131 = colorsCount;
        colorsCount = i131 + 1;
        key_contextProgressOuter4 = i131;
        int i132 = colorsCount;
        colorsCount = i132 + 1;
        key_avatar_text = i132;
        int i133 = colorsCount;
        colorsCount = i133 + 1;
        key_avatar_backgroundSaved = i133;
        int i134 = colorsCount;
        colorsCount = i134 + 1;
        key_avatar_background2Saved = i134;
        int i135 = colorsCount;
        colorsCount = i135 + 1;
        key_avatar_backgroundArchived = i135;
        int i136 = colorsCount;
        colorsCount = i136 + 1;
        key_avatar_backgroundArchivedHidden = i136;
        int i137 = colorsCount;
        colorsCount = i137 + 1;
        key_avatar_backgroundRed = i137;
        int i138 = colorsCount;
        colorsCount = i138 + 1;
        key_avatar_backgroundOrange = i138;
        int i139 = colorsCount;
        colorsCount = i139 + 1;
        key_avatar_backgroundViolet = i139;
        int i140 = colorsCount;
        colorsCount = i140 + 1;
        key_avatar_backgroundGreen = i140;
        int i141 = colorsCount;
        colorsCount = i141 + 1;
        key_avatar_backgroundCyan = i141;
        int i142 = colorsCount;
        colorsCount = i142 + 1;
        key_avatar_backgroundBlue = i142;
        int i143 = colorsCount;
        colorsCount = i143 + 1;
        key_avatar_backgroundPink = i143;
        int i144 = colorsCount;
        colorsCount = i144 + 1;
        key_avatar_background2Red = i144;
        int i145 = colorsCount;
        colorsCount = i145 + 1;
        key_avatar_background2Orange = i145;
        int i146 = colorsCount;
        colorsCount = i146 + 1;
        key_avatar_background2Violet = i146;
        int i147 = colorsCount;
        colorsCount = i147 + 1;
        key_avatar_background2Green = i147;
        int i148 = colorsCount;
        colorsCount = i148 + 1;
        key_avatar_background2Cyan = i148;
        int i149 = colorsCount;
        colorsCount = i149 + 1;
        key_avatar_background2Blue = i149;
        int i150 = colorsCount;
        colorsCount = i150 + 1;
        key_avatar_background2Pink = i150;
        int i151 = colorsCount;
        colorsCount = i151 + 1;
        key_avatar_backgroundGray = i151;
        int i152 = colorsCount;
        colorsCount = i152 + 1;
        key_avatar_backgroundInProfileBlue = i152;
        int i153 = colorsCount;
        colorsCount = i153 + 1;
        key_avatar_backgroundActionBarBlue = i153;
        int i154 = colorsCount;
        colorsCount = i154 + 1;
        key_avatar_actionBarSelectorBlue = i154;
        int i155 = colorsCount;
        colorsCount = i155 + 1;
        key_avatar_actionBarIconBlue = i155;
        int i156 = colorsCount;
        colorsCount = i156 + 1;
        key_avatar_subtitleInProfileBlue = i156;
        int i157 = colorsCount;
        colorsCount = i157 + 1;
        key_avatar_nameInMessageRed = i157;
        int i158 = colorsCount;
        colorsCount = i158 + 1;
        key_avatar_nameInMessageOrange = i158;
        int i159 = colorsCount;
        colorsCount = i159 + 1;
        key_avatar_nameInMessageViolet = i159;
        int i160 = colorsCount;
        colorsCount = i160 + 1;
        key_avatar_nameInMessageGreen = i160;
        int i161 = colorsCount;
        colorsCount = i161 + 1;
        key_avatar_nameInMessageCyan = i161;
        int i162 = colorsCount;
        colorsCount = i162 + 1;
        key_avatar_nameInMessageBlue = i162;
        int i163 = colorsCount;
        colorsCount = i163 + 1;
        key_avatar_nameInMessagePink = i163;
        keys_avatar_background = new int[]{i137, i138, i139, i140, i141, i142, i143};
        keys_avatar_background2 = new int[]{i144, i145, i146, i147, i148, i149, i150};
        keys_avatar_nameInMessage = new int[]{i157, i158, i159, i160, i161, i162, i163};
        int i164 = colorsCount;
        colorsCount = i164 + 1;
        key_actionBarDefault = i164;
        int i165 = colorsCount;
        colorsCount = i165 + 1;
        key_actionBarDefaultSelector = i165;
        int i166 = colorsCount;
        colorsCount = i166 + 1;
        key_actionBarWhiteSelector = i166;
        int i167 = colorsCount;
        colorsCount = i167 + 1;
        key_actionBarDefaultIcon = i167;
        int i168 = colorsCount;
        colorsCount = i168 + 1;
        key_actionBarActionModeDefault = i168;
        int i169 = colorsCount;
        colorsCount = i169 + 1;
        key_actionBarActionModeDefaultTop = i169;
        int i170 = colorsCount;
        colorsCount = i170 + 1;
        key_actionBarActionModeDefaultIcon = i170;
        int i171 = colorsCount;
        colorsCount = i171 + 1;
        key_actionBarActionModeDefaultSelector = i171;
        int i172 = colorsCount;
        colorsCount = i172 + 1;
        key_actionBarDefaultTitle = i172;
        int i173 = colorsCount;
        colorsCount = i173 + 1;
        key_actionBarDefaultSubtitle = i173;
        int i174 = colorsCount;
        colorsCount = i174 + 1;
        key_actionBarDefaultSearch = i174;
        int i175 = colorsCount;
        colorsCount = i175 + 1;
        key_actionBarDefaultSearchPlaceholder = i175;
        int i176 = colorsCount;
        colorsCount = i176 + 1;
        key_actionBarDefaultSubmenuItem = i176;
        int i177 = colorsCount;
        colorsCount = i177 + 1;
        key_actionBarDefaultSubmenuItemIcon = i177;
        int i178 = colorsCount;
        colorsCount = i178 + 1;
        key_actionBarDefaultSubmenuBackground = i178;
        int i179 = colorsCount;
        colorsCount = i179 + 1;
        key_actionBarDefaultSubmenuSeparator = i179;
        int i180 = colorsCount;
        colorsCount = i180 + 1;
        key_actionBarTabActiveText = i180;
        int i181 = colorsCount;
        colorsCount = i181 + 1;
        key_actionBarTabUnactiveText = i181;
        int i182 = colorsCount;
        colorsCount = i182 + 1;
        key_actionBarTabLine = i182;
        int i183 = colorsCount;
        colorsCount = i183 + 1;
        key_actionBarTabSelector = i183;
        int i184 = colorsCount;
        colorsCount = i184 + 1;
        key_actionBarDefaultArchived = i184;
        int i185 = colorsCount;
        colorsCount = i185 + 1;
        key_actionBarDefaultArchivedSelector = i185;
        int i186 = colorsCount;
        colorsCount = i186 + 1;
        key_actionBarDefaultArchivedIcon = i186;
        int i187 = colorsCount;
        colorsCount = i187 + 1;
        key_actionBarDefaultArchivedTitle = i187;
        int i188 = colorsCount;
        colorsCount = i188 + 1;
        key_actionBarDefaultArchivedSearch = i188;
        int i189 = colorsCount;
        colorsCount = i189 + 1;
        key_actionBarDefaultArchivedSearchPlaceholder = i189;
        int i190 = colorsCount;
        colorsCount = i190 + 1;
        key_actionBarBrowser = i190;
        int i191 = colorsCount;
        colorsCount = i191 + 1;
        key_chats_onlineCircle = i191;
        int i192 = colorsCount;
        colorsCount = i192 + 1;
        key_chats_unreadCounter = i192;
        int i193 = colorsCount;
        colorsCount = i193 + 1;
        key_chats_unreadCounterMuted = i193;
        int i194 = colorsCount;
        colorsCount = i194 + 1;
        key_chats_unreadCounterText = i194;
        int i195 = colorsCount;
        colorsCount = i195 + 1;
        key_chats_name = i195;
        int i196 = colorsCount;
        colorsCount = i196 + 1;
        key_chats_nameArchived = i196;
        int i197 = colorsCount;
        colorsCount = i197 + 1;
        key_chats_secretName = i197;
        int i198 = colorsCount;
        colorsCount = i198 + 1;
        key_chats_secretIcon = i198;
        int i199 = colorsCount;
        colorsCount = i199 + 1;
        key_chats_pinnedIcon = i199;
        int i200 = colorsCount;
        colorsCount = i200 + 1;
        key_chats_archiveBackground = i200;
        int i201 = colorsCount;
        colorsCount = i201 + 1;
        key_chats_archivePinBackground = i201;
        int i202 = colorsCount;
        colorsCount = i202 + 1;
        key_chats_archiveIcon = i202;
        int i203 = colorsCount;
        colorsCount = i203 + 1;
        key_chats_archiveText = i203;
        int i204 = colorsCount;
        colorsCount = i204 + 1;
        key_chats_message = i204;
        int i205 = colorsCount;
        colorsCount = i205 + 1;
        key_chats_messageArchived = i205;
        int i206 = colorsCount;
        colorsCount = i206 + 1;
        key_chats_message_threeLines = i206;
        int i207 = colorsCount;
        colorsCount = i207 + 1;
        key_chats_draft = i207;
        int i208 = colorsCount;
        colorsCount = i208 + 1;
        key_chats_nameMessage = i208;
        int i209 = colorsCount;
        colorsCount = i209 + 1;
        key_chats_nameMessageArchived = i209;
        int i210 = colorsCount;
        colorsCount = i210 + 1;
        key_chats_nameMessage_threeLines = i210;
        int i211 = colorsCount;
        colorsCount = i211 + 1;
        key_chats_nameMessageArchived_threeLines = i211;
        int i212 = colorsCount;
        colorsCount = i212 + 1;
        key_chats_attachMessage = i212;
        int i213 = colorsCount;
        colorsCount = i213 + 1;
        key_chats_actionMessage = i213;
        int i214 = colorsCount;
        colorsCount = i214 + 1;
        key_chats_date = i214;
        int i215 = colorsCount;
        colorsCount = i215 + 1;
        key_chats_pinnedOverlay = i215;
        int i216 = colorsCount;
        colorsCount = i216 + 1;
        key_chats_tabletSelectedOverlay = i216;
        int i217 = colorsCount;
        colorsCount = i217 + 1;
        key_chats_sentCheck = i217;
        int i218 = colorsCount;
        colorsCount = i218 + 1;
        key_chats_sentReadCheck = i218;
        int i219 = colorsCount;
        colorsCount = i219 + 1;
        key_chats_sentClock = i219;
        int i220 = colorsCount;
        colorsCount = i220 + 1;
        key_chats_sentError = i220;
        int i221 = colorsCount;
        colorsCount = i221 + 1;
        key_chats_sentErrorIcon = i221;
        int i222 = colorsCount;
        colorsCount = i222 + 1;
        key_chats_verifiedBackground = i222;
        int i223 = colorsCount;
        colorsCount = i223 + 1;
        key_chats_verifiedCheck = i223;
        int i224 = colorsCount;
        colorsCount = i224 + 1;
        key_chats_muteIcon = i224;
        int i225 = colorsCount;
        colorsCount = i225 + 1;
        key_chats_mentionIcon = i225;
        int i226 = colorsCount;
        colorsCount = i226 + 1;
        key_chats_menuTopShadow = i226;
        int i227 = colorsCount;
        colorsCount = i227 + 1;
        key_chats_menuTopShadowCats = i227;
        int i228 = colorsCount;
        colorsCount = i228 + 1;
        key_chats_menuBackground = i228;
        int i229 = colorsCount;
        colorsCount = i229 + 1;
        key_chats_menuItemText = i229;
        int i230 = colorsCount;
        colorsCount = i230 + 1;
        key_chats_menuItemCheck = i230;
        int i231 = colorsCount;
        colorsCount = i231 + 1;
        key_chats_menuItemIcon = i231;
        int i232 = colorsCount;
        colorsCount = i232 + 1;
        key_chats_menuName = i232;
        int i233 = colorsCount;
        colorsCount = i233 + 1;
        key_chats_menuPhone = i233;
        int i234 = colorsCount;
        colorsCount = i234 + 1;
        key_chats_menuPhoneCats = i234;
        int i235 = colorsCount;
        colorsCount = i235 + 1;
        key_chats_menuTopBackgroundCats = i235;
        int i236 = colorsCount;
        colorsCount = i236 + 1;
        key_chats_menuTopBackground = i236;
        int i237 = colorsCount;
        colorsCount = i237 + 1;
        key_chats_actionIcon = i237;
        int i238 = colorsCount;
        colorsCount = i238 + 1;
        key_chats_actionBackground = i238;
        int i239 = colorsCount;
        colorsCount = i239 + 1;
        key_chats_actionPressedBackground = i239;
        int i240 = colorsCount;
        colorsCount = i240 + 1;
        key_chats_archivePullDownBackground = i240;
        int i241 = colorsCount;
        colorsCount = i241 + 1;
        key_chats_archivePullDownBackgroundActive = i241;
        int i242 = colorsCount;
        colorsCount = i242 + 1;
        key_chats_tabUnreadActiveBackground = i242;
        int i243 = colorsCount;
        colorsCount = i243 + 1;
        key_chats_tabUnreadUnactiveBackground = i243;
        int i244 = colorsCount;
        colorsCount = i244 + 1;
        key_chat_attachCheckBoxCheck = i244;
        int i245 = colorsCount;
        colorsCount = i245 + 1;
        key_chat_attachCheckBoxBackground = i245;
        int i246 = colorsCount;
        colorsCount = i246 + 1;
        key_chat_attachPhotoBackground = i246;
        int i247 = colorsCount;
        colorsCount = i247 + 1;
        key_chat_attachActiveTab = i247;
        int i248 = colorsCount;
        colorsCount = i248 + 1;
        key_chat_attachUnactiveTab = i248;
        int i249 = colorsCount;
        colorsCount = i249 + 1;
        key_chat_attachPermissionImage = i249;
        int i250 = colorsCount;
        colorsCount = i250 + 1;
        key_chat_attachPermissionMark = i250;
        int i251 = colorsCount;
        colorsCount = i251 + 1;
        key_chat_attachPermissionText = i251;
        int i252 = colorsCount;
        colorsCount = i252 + 1;
        key_chat_attachEmptyImage = i252;
        int i253 = colorsCount;
        colorsCount = i253 + 1;
        key_chat_inPollCorrectAnswer = i253;
        int i254 = colorsCount;
        colorsCount = i254 + 1;
        key_chat_outPollCorrectAnswer = i254;
        int i255 = colorsCount;
        colorsCount = i255 + 1;
        key_chat_inPollWrongAnswer = i255;
        int i256 = colorsCount;
        colorsCount = i256 + 1;
        key_chat_outPollWrongAnswer = i256;
        int i257 = colorsCount;
        colorsCount = i257 + 1;
        key_chat_attachIcon = i257;
        int i258 = colorsCount;
        colorsCount = i258 + 1;
        key_chat_attachGalleryBackground = i258;
        int i259 = colorsCount;
        colorsCount = i259 + 1;
        key_chat_attachGalleryText = i259;
        int i260 = colorsCount;
        colorsCount = i260 + 1;
        key_chat_attachAudioBackground = i260;
        int i261 = colorsCount;
        colorsCount = i261 + 1;
        key_chat_attachAudioText = i261;
        int i262 = colorsCount;
        colorsCount = i262 + 1;
        key_chat_attachFileBackground = i262;
        int i263 = colorsCount;
        colorsCount = i263 + 1;
        key_chat_attachFileText = i263;
        int i264 = colorsCount;
        colorsCount = i264 + 1;
        key_chat_attachContactBackground = i264;
        int i265 = colorsCount;
        colorsCount = i265 + 1;
        key_chat_attachContactText = i265;
        int i266 = colorsCount;
        colorsCount = i266 + 1;
        key_chat_attachLocationBackground = i266;
        int i267 = colorsCount;
        colorsCount = i267 + 1;
        key_chat_attachLocationText = i267;
        int i268 = colorsCount;
        colorsCount = i268 + 1;
        key_chat_attachPollBackground = i268;
        int i269 = colorsCount;
        colorsCount = i269 + 1;
        key_chat_attachPollText = i269;
        int i270 = colorsCount;
        colorsCount = i270 + 1;
        key_chat_status = i270;
        int i271 = colorsCount;
        colorsCount = i271 + 1;
        key_chat_inGreenCall = i271;
        int i272 = colorsCount;
        colorsCount = i272 + 1;
        key_chat_inBubble = i272;
        int i273 = colorsCount;
        colorsCount = i273 + 1;
        key_chat_inBubbleSelectedOverlay = i273;
        int i274 = colorsCount;
        colorsCount = i274 + 1;
        key_chat_inBubbleShadow = i274;
        int i275 = colorsCount;
        colorsCount = i275 + 1;
        key_actionBarActionModeReaction = i275;
        int i276 = colorsCount;
        colorsCount = i276 + 1;
        key_actionBarActionModeReactionText = i276;
        int i277 = colorsCount;
        colorsCount = i277 + 1;
        key_actionBarActionModeReactionDot = i277;
        myMessagesBubblesStartIndex = colorsCount;
        int i278 = colorsCount;
        colorsCount = i278 + 1;
        key_chat_outBubble = i278;
        int i279 = colorsCount;
        colorsCount = i279 + 1;
        key_chat_outBubbleSelected = i279;
        int i280 = colorsCount;
        colorsCount = i280 + 1;
        key_chat_outBubbleShadow = i280;
        int i281 = colorsCount;
        colorsCount = i281 + 1;
        key_chat_outBubbleGradient1 = i281;
        int i282 = colorsCount;
        colorsCount = i282 + 1;
        key_chat_outBubbleGradient2 = i282;
        int i283 = colorsCount;
        colorsCount = i283 + 1;
        key_chat_outBubbleGradient3 = i283;
        myMessagesBubblesEndIndex = colorsCount;
        myMessagesStartIndex = colorsCount;
        int i284 = colorsCount;
        colorsCount = i284 + 1;
        key_chat_outGreenCall = i284;
        int i285 = colorsCount;
        colorsCount = i285 + 1;
        key_chat_outSentCheck = i285;
        int i286 = colorsCount;
        colorsCount = i286 + 1;
        key_chat_outSentCheckSelected = i286;
        int i287 = colorsCount;
        colorsCount = i287 + 1;
        key_chat_outSentCheckRead = i287;
        int i288 = colorsCount;
        colorsCount = i288 + 1;
        key_chat_outSentCheckReadSelected = i288;
        int i289 = colorsCount;
        colorsCount = i289 + 1;
        key_chat_outSentClock = i289;
        int i290 = colorsCount;
        colorsCount = i290 + 1;
        key_chat_outSentClockSelected = i290;
        int i291 = colorsCount;
        colorsCount = i291 + 1;
        key_chat_outMediaIcon = i291;
        int i292 = colorsCount;
        colorsCount = i292 + 1;
        key_chat_outMediaIconSelected = i292;
        int i293 = colorsCount;
        colorsCount = i293 + 1;
        key_chat_outViews = i293;
        int i294 = colorsCount;
        colorsCount = i294 + 1;
        key_chat_outViewsSelected = i294;
        int i295 = colorsCount;
        colorsCount = i295 + 1;
        key_chat_outMenu = i295;
        int i296 = colorsCount;
        colorsCount = i296 + 1;
        key_chat_outMenuSelected = i296;
        int i297 = colorsCount;
        colorsCount = i297 + 1;
        key_chat_outInstant = i297;
        int i298 = colorsCount;
        colorsCount = i298 + 1;
        key_chat_outInstantSelected = i298;
        int i299 = colorsCount;
        colorsCount = i299 + 1;
        key_chat_outPreviewInstantText = i299;
        int i300 = colorsCount;
        colorsCount = i300 + 1;
        key_chat_outForwardedNameText = i300;
        int i301 = colorsCount;
        colorsCount = i301 + 1;
        key_chat_outViaBotNameText = i301;
        int i302 = colorsCount;
        colorsCount = i302 + 1;
        key_chat_outReplyLine = i302;
        int i303 = colorsCount;
        colorsCount = i303 + 1;
        key_chat_outReplyLine2 = i303;
        int i304 = colorsCount;
        colorsCount = i304 + 1;
        key_chat_outReplyNameText = i304;
        int i305 = colorsCount;
        colorsCount = i305 + 1;
        key_chat_outReplyMessageText = i305;
        int i306 = colorsCount;
        colorsCount = i306 + 1;
        key_chat_outReplyMediaMessageText = i306;
        int i307 = colorsCount;
        colorsCount = i307 + 1;
        key_chat_outReplyMediaMessageSelectedText = i307;
        int i308 = colorsCount;
        colorsCount = i308 + 1;
        key_chat_outPreviewLine = i308;
        int i309 = colorsCount;
        colorsCount = i309 + 1;
        key_chat_outSiteNameText = i309;
        int i310 = colorsCount;
        colorsCount = i310 + 1;
        key_chat_outContactNameText = i310;
        int i311 = colorsCount;
        colorsCount = i311 + 1;
        key_chat_outContactPhoneText = i311;
        int i312 = colorsCount;
        colorsCount = i312 + 1;
        key_chat_outContactPhoneSelectedText = i312;
        int i313 = colorsCount;
        colorsCount = i313 + 1;
        key_chat_outAudioPerformerText = i313;
        int i314 = colorsCount;
        colorsCount = i314 + 1;
        key_chat_outAudioPerformerSelectedText = i314;
        int i315 = colorsCount;
        colorsCount = i315 + 1;
        key_chat_outTimeSelectedText = i315;
        int i316 = colorsCount;
        colorsCount = i316 + 1;
        key_chat_outAdminText = i316;
        int i317 = colorsCount;
        colorsCount = i317 + 1;
        key_chat_outAdminSelectedText = i317;
        int i318 = colorsCount;
        colorsCount = i318 + 1;
        key_chat_outAudioProgress = i318;
        int i319 = colorsCount;
        colorsCount = i319 + 1;
        key_chat_outAudioSelectedProgress = i319;
        int i320 = colorsCount;
        colorsCount = i320 + 1;
        key_chat_outTimeText = i320;
        int i321 = colorsCount;
        colorsCount = i321 + 1;
        key_chat_outAudioTitleText = i321;
        int i322 = colorsCount;
        colorsCount = i322 + 1;
        key_chat_outAudioDurationText = i322;
        int i323 = colorsCount;
        colorsCount = i323 + 1;
        key_chat_outAudioDurationSelectedText = i323;
        int i324 = colorsCount;
        colorsCount = i324 + 1;
        key_chat_outAudioSeekbar = i324;
        int i325 = colorsCount;
        colorsCount = i325 + 1;
        key_chat_outAudioCacheSeekbar = i325;
        int i326 = colorsCount;
        colorsCount = i326 + 1;
        key_chat_outAudioSeekbarSelected = i326;
        int i327 = colorsCount;
        colorsCount = i327 + 1;
        key_chat_outAudioSeekbarFill = i327;
        int i328 = colorsCount;
        colorsCount = i328 + 1;
        key_chat_outVoiceSeekbar = i328;
        int i329 = colorsCount;
        colorsCount = i329 + 1;
        key_chat_outVoiceSeekbarSelected = i329;
        int i330 = colorsCount;
        colorsCount = i330 + 1;
        key_chat_outVoiceSeekbarFill = i330;
        int i331 = colorsCount;
        colorsCount = i331 + 1;
        key_chat_outFileProgress = i331;
        int i332 = colorsCount;
        colorsCount = i332 + 1;
        key_chat_outFileProgressSelected = i332;
        int i333 = colorsCount;
        colorsCount = i333 + 1;
        key_chat_outFileNameText = i333;
        int i334 = colorsCount;
        colorsCount = i334 + 1;
        key_chat_outFileInfoText = i334;
        int i335 = colorsCount;
        colorsCount = i335 + 1;
        key_chat_outFileInfoSelectedText = i335;
        int i336 = colorsCount;
        colorsCount = i336 + 1;
        key_chat_outFileBackground = i336;
        int i337 = colorsCount;
        colorsCount = i337 + 1;
        key_chat_outFileBackgroundSelected = i337;
        int i338 = colorsCount;
        colorsCount = i338 + 1;
        key_chat_outVenueInfoText = i338;
        int i339 = colorsCount;
        colorsCount = i339 + 1;
        key_chat_outVenueInfoSelectedText = i339;
        int i340 = colorsCount;
        colorsCount = i340 + 1;
        key_chat_outLinkSelectBackground = i340;
        int i341 = colorsCount;
        colorsCount = i341 + 1;
        key_chat_outLoader = i341;
        int i342 = colorsCount;
        colorsCount = i342 + 1;
        key_chat_outLoaderSelected = i342;
        int i343 = colorsCount;
        colorsCount = i343 + 1;
        key_chat_outLocationIcon = i343;
        int i344 = colorsCount;
        colorsCount = i344 + 1;
        key_chat_outContactBackground = i344;
        int i345 = colorsCount;
        colorsCount = i345 + 1;
        key_chat_outContactIcon = i345;
        int i346 = colorsCount;
        colorsCount = i346 + 1;
        key_chat_outReactionButtonBackground = i346;
        myMessagesEndIndex = colorsCount;
        int i347 = colorsCount;
        colorsCount = i347 + 1;
        key_chat_outTextSelectionHighlight = i347;
        int i348 = colorsCount;
        colorsCount = i348 + 1;
        key_chat_outTextSelectionCursor = i348;
        int i349 = colorsCount;
        colorsCount = i349 + 1;
        key_chat_outBubbleLocationPlaceholder = i349;
        int i350 = colorsCount;
        colorsCount = i350 + 1;
        key_chat_outBubbleSelectedOverlay = i350;
        int i351 = colorsCount;
        colorsCount = i351 + 1;
        key_chat_outPsaNameText = i351;
        int i352 = colorsCount;
        colorsCount = i352 + 1;
        key_chat_outBubbleGradientAnimated = i352;
        int i353 = colorsCount;
        colorsCount = i353 + 1;
        key_chat_outBubbleGradientSelectedOverlay = i353;
        int i354 = colorsCount;
        colorsCount = i354 + 1;
        key_chat_inBubbleSelected = i354;
        int i355 = colorsCount;
        colorsCount = i355 + 1;
        key_chat_messageTextIn = i355;
        int i356 = colorsCount;
        colorsCount = i356 + 1;
        key_chat_messageTextOut = i356;
        int i357 = colorsCount;
        colorsCount = i357 + 1;
        key_chat_messageLinkIn = i357;
        int i358 = colorsCount;
        colorsCount = i358 + 1;
        key_chat_messageLinkOut = i358;
        int i359 = colorsCount;
        colorsCount = i359 + 1;
        key_chat_serviceText = i359;
        int i360 = colorsCount;
        colorsCount = i360 + 1;
        key_chat_serviceLink = i360;
        int i361 = colorsCount;
        colorsCount = i361 + 1;
        key_chat_serviceIcon = i361;
        int i362 = colorsCount;
        colorsCount = i362 + 1;
        key_chat_serviceBackground = i362;
        int i363 = colorsCount;
        colorsCount = i363 + 1;
        key_chat_serviceBackgroundSelected = i363;
        int i364 = colorsCount;
        colorsCount = i364 + 1;
        key_chat_serviceBackgroundSelector = i364;
        int i365 = colorsCount;
        colorsCount = i365 + 1;
        key_chat_muteIcon = i365;
        int i366 = colorsCount;
        colorsCount = i366 + 1;
        key_chat_lockIcon = i366;
        int i367 = colorsCount;
        colorsCount = i367 + 1;
        key_chat_inSentClock = i367;
        int i368 = colorsCount;
        colorsCount = i368 + 1;
        key_chat_inSentClockSelected = i368;
        int i369 = colorsCount;
        colorsCount = i369 + 1;
        key_chat_mediaSentCheck = i369;
        int i370 = colorsCount;
        colorsCount = i370 + 1;
        key_chat_mediaSentClock = i370;
        int i371 = colorsCount;
        colorsCount = i371 + 1;
        key_chat_inMediaIcon = i371;
        int i372 = colorsCount;
        colorsCount = i372 + 1;
        key_chat_inMediaIconSelected = i372;
        int i373 = colorsCount;
        colorsCount = i373 + 1;
        key_chat_mediaTimeBackground = i373;
        int i374 = colorsCount;
        colorsCount = i374 + 1;
        key_chat_inViews = i374;
        int i375 = colorsCount;
        colorsCount = i375 + 1;
        key_chat_inViewsSelected = i375;
        int i376 = colorsCount;
        colorsCount = i376 + 1;
        key_chat_mediaViews = i376;
        int i377 = colorsCount;
        colorsCount = i377 + 1;
        key_chat_inMenu = i377;
        int i378 = colorsCount;
        colorsCount = i378 + 1;
        key_chat_inMenuSelected = i378;
        int i379 = colorsCount;
        colorsCount = i379 + 1;
        key_chat_mediaMenu = i379;
        int i380 = colorsCount;
        colorsCount = i380 + 1;
        key_chat_inInstant = i380;
        int i381 = colorsCount;
        colorsCount = i381 + 1;
        key_chat_inInstantSelected = i381;
        int i382 = colorsCount;
        colorsCount = i382 + 1;
        key_chat_sentError = i382;
        int i383 = colorsCount;
        colorsCount = i383 + 1;
        key_chat_sentErrorIcon = i383;
        int i384 = colorsCount;
        colorsCount = i384 + 1;
        key_chat_selectedBackground = i384;
        int i385 = colorsCount;
        colorsCount = i385 + 1;
        key_chat_previewDurationText = i385;
        int i386 = colorsCount;
        colorsCount = i386 + 1;
        key_chat_previewGameText = i386;
        int i387 = colorsCount;
        colorsCount = i387 + 1;
        key_chat_inPreviewInstantText = i387;
        int i388 = colorsCount;
        colorsCount = i388 + 1;
        key_chat_secretTimeText = i388;
        int i389 = colorsCount;
        colorsCount = i389 + 1;
        key_chat_stickerNameText = i389;
        int i390 = colorsCount;
        colorsCount = i390 + 1;
        key_chat_botButtonText = i390;
        int i391 = colorsCount;
        colorsCount = i391 + 1;
        key_chat_inForwardedNameText = i391;
        int i392 = colorsCount;
        colorsCount = i392 + 1;
        key_chat_inPsaNameText = i392;
        int i393 = colorsCount;
        colorsCount = i393 + 1;
        key_chat_inViaBotNameText = i393;
        int i394 = colorsCount;
        colorsCount = i394 + 1;
        key_chat_stickerViaBotNameText = i394;
        int i395 = colorsCount;
        colorsCount = i395 + 1;
        key_chat_inQuote = i395;
        int i396 = colorsCount;
        colorsCount = i396 + 1;
        key_chat_outQuote = i396;
        int i397 = colorsCount;
        colorsCount = i397 + 1;
        key_chat_inReplyLine = i397;
        int i398 = colorsCount;
        colorsCount = i398 + 1;
        key_chat_stickerReplyLine = i398;
        int i399 = colorsCount;
        colorsCount = i399 + 1;
        key_chat_inReplyNameText = i399;
        int i400 = colorsCount;
        colorsCount = i400 + 1;
        key_chat_stickerReplyNameText = i400;
        int i401 = colorsCount;
        colorsCount = i401 + 1;
        key_chat_inReplyMessageText = i401;
        int i402 = colorsCount;
        colorsCount = i402 + 1;
        key_chat_inReplyMediaMessageText = i402;
        int i403 = colorsCount;
        colorsCount = i403 + 1;
        key_chat_inReplyMediaMessageSelectedText = i403;
        int i404 = colorsCount;
        colorsCount = i404 + 1;
        key_chat_stickerReplyMessageText = i404;
        int i405 = colorsCount;
        colorsCount = i405 + 1;
        key_chat_inPreviewLine = i405;
        int i406 = colorsCount;
        colorsCount = i406 + 1;
        key_chat_inSiteNameText = i406;
        int i407 = colorsCount;
        colorsCount = i407 + 1;
        key_chat_inContactNameText = i407;
        int i408 = colorsCount;
        colorsCount = i408 + 1;
        key_chat_inContactPhoneText = i408;
        int i409 = colorsCount;
        colorsCount = i409 + 1;
        key_chat_inContactPhoneSelectedText = i409;
        int i410 = colorsCount;
        colorsCount = i410 + 1;
        key_chat_mediaProgress = i410;
        int i411 = colorsCount;
        colorsCount = i411 + 1;
        key_chat_inAudioProgress = i411;
        int i412 = colorsCount;
        colorsCount = i412 + 1;
        key_chat_inAudioSelectedProgress = i412;
        int i413 = colorsCount;
        colorsCount = i413 + 1;
        key_chat_mediaTimeText = i413;
        int i414 = colorsCount;
        colorsCount = i414 + 1;
        key_chat_inAdminText = i414;
        int i415 = colorsCount;
        colorsCount = i415 + 1;
        key_chat_inAdminSelectedText = i415;
        int i416 = colorsCount;
        colorsCount = i416 + 1;
        key_chat_inTimeText = i416;
        int i417 = colorsCount;
        colorsCount = i417 + 1;
        key_chat_inTimeSelectedText = i417;
        int i418 = colorsCount;
        colorsCount = i418 + 1;
        key_chat_inAudioPerformerText = i418;
        int i419 = colorsCount;
        colorsCount = i419 + 1;
        key_chat_inAudioPerformerSelectedText = i419;
        int i420 = colorsCount;
        colorsCount = i420 + 1;
        key_chat_inAudioTitleText = i420;
        int i421 = colorsCount;
        colorsCount = i421 + 1;
        key_chat_inAudioDurationText = i421;
        int i422 = colorsCount;
        colorsCount = i422 + 1;
        key_chat_inAudioDurationSelectedText = i422;
        int i423 = colorsCount;
        colorsCount = i423 + 1;
        key_chat_inAudioSeekbar = i423;
        int i424 = colorsCount;
        colorsCount = i424 + 1;
        key_chat_inAudioCacheSeekbar = i424;
        int i425 = colorsCount;
        colorsCount = i425 + 1;
        key_chat_inAudioSeekbarSelected = i425;
        int i426 = colorsCount;
        colorsCount = i426 + 1;
        key_chat_inAudioSeekbarFill = i426;
        int i427 = colorsCount;
        colorsCount = i427 + 1;
        key_chat_inVoiceSeekbar = i427;
        int i428 = colorsCount;
        colorsCount = i428 + 1;
        key_chat_inVoiceSeekbarSelected = i428;
        int i429 = colorsCount;
        colorsCount = i429 + 1;
        key_chat_inVoiceSeekbarFill = i429;
        int i430 = colorsCount;
        colorsCount = i430 + 1;
        key_chat_inFileProgress = i430;
        int i431 = colorsCount;
        colorsCount = i431 + 1;
        key_chat_inFileProgressSelected = i431;
        int i432 = colorsCount;
        colorsCount = i432 + 1;
        key_chat_inFileNameText = i432;
        int i433 = colorsCount;
        colorsCount = i433 + 1;
        key_chat_inFileInfoText = i433;
        int i434 = colorsCount;
        colorsCount = i434 + 1;
        key_chat_inFileInfoSelectedText = i434;
        int i435 = colorsCount;
        colorsCount = i435 + 1;
        key_chat_inFileBackground = i435;
        int i436 = colorsCount;
        colorsCount = i436 + 1;
        key_chat_inFileBackgroundSelected = i436;
        int i437 = colorsCount;
        colorsCount = i437 + 1;
        key_chat_inVenueInfoText = i437;
        int i438 = colorsCount;
        colorsCount = i438 + 1;
        key_chat_inVenueInfoSelectedText = i438;
        int i439 = colorsCount;
        colorsCount = i439 + 1;
        key_chat_mediaInfoText = i439;
        int i440 = colorsCount;
        colorsCount = i440 + 1;
        key_chat_linkSelectBackground = i440;
        int i441 = colorsCount;
        colorsCount = i441 + 1;
        key_chat_textSelectBackground = i441;
        int i442 = colorsCount;
        colorsCount = i442 + 1;
        key_chat_wallpaper = i442;
        int i443 = colorsCount;
        colorsCount = i443 + 1;
        key_chat_wallpaper_gradient_to1 = i443;
        int i444 = colorsCount;
        colorsCount = i444 + 1;
        key_chat_wallpaper_gradient_to2 = i444;
        int i445 = colorsCount;
        colorsCount = i445 + 1;
        key_chat_wallpaper_gradient_to3 = i445;
        int i446 = colorsCount;
        colorsCount = i446 + 1;
        key_chat_wallpaper_gradient_rotation = i446;
        int i447 = colorsCount;
        colorsCount = i447 + 1;
        key_chat_messagePanelBackground = i447;
        int i448 = colorsCount;
        colorsCount = i448 + 1;
        key_chat_messagePanelShadow = i448;
        int i449 = colorsCount;
        colorsCount = i449 + 1;
        key_chat_messagePanelText = i449;
        int i450 = colorsCount;
        colorsCount = i450 + 1;
        key_chat_messagePanelHint = i450;
        int i451 = colorsCount;
        colorsCount = i451 + 1;
        key_chat_messagePanelCursor = i451;
        int i452 = colorsCount;
        colorsCount = i452 + 1;
        key_chat_messagePanelIcons = i452;
        int i453 = colorsCount;
        colorsCount = i453 + 1;
        key_chat_messagePanelSend = i453;
        int i454 = colorsCount;
        colorsCount = i454 + 1;
        key_chat_messagePanelVoiceLock = i454;
        int i455 = colorsCount;
        colorsCount = i455 + 1;
        key_chat_messagePanelVoiceLockBackground = i455;
        int i456 = colorsCount;
        colorsCount = i456 + 1;
        key_chat_messagePanelVoiceLockShadow = i456;
        int i457 = colorsCount;
        colorsCount = i457 + 1;
        key_chat_topPanelBackground = i457;
        int i458 = colorsCount;
        colorsCount = i458 + 1;
        key_chat_topPanelClose = i458;
        int i459 = colorsCount;
        colorsCount = i459 + 1;
        key_chat_topPanelLine = i459;
        int i460 = colorsCount;
        colorsCount = i460 + 1;
        key_chat_topPanelTitle = i460;
        int i461 = colorsCount;
        colorsCount = i461 + 1;
        key_chat_topPanelMessage = i461;
        int i462 = colorsCount;
        colorsCount = i462 + 1;
        key_chat_addContact = i462;
        int i463 = colorsCount;
        colorsCount = i463 + 1;
        key_chat_inLoader = i463;
        int i464 = colorsCount;
        colorsCount = i464 + 1;
        key_chat_inLoaderSelected = i464;
        int i465 = colorsCount;
        colorsCount = i465 + 1;
        key_chat_inLoaderPhoto = i465;
        int i466 = colorsCount;
        colorsCount = i466 + 1;
        key_chat_mediaLoaderPhoto = i466;
        int i467 = colorsCount;
        colorsCount = i467 + 1;
        key_chat_mediaLoaderPhotoSelected = i467;
        int i468 = colorsCount;
        colorsCount = i468 + 1;
        key_chat_mediaLoaderPhotoIcon = i468;
        int i469 = colorsCount;
        colorsCount = i469 + 1;
        key_chat_mediaLoaderPhotoIconSelected = i469;
        int i470 = colorsCount;
        colorsCount = i470 + 1;
        key_chat_inLocationBackground = i470;
        int i471 = colorsCount;
        colorsCount = i471 + 1;
        key_chat_inLocationIcon = i471;
        int i472 = colorsCount;
        colorsCount = i472 + 1;
        key_chat_inContactBackground = i472;
        int i473 = colorsCount;
        colorsCount = i473 + 1;
        key_chat_inContactIcon = i473;
        int i474 = colorsCount;
        colorsCount = i474 + 1;
        key_chat_replyPanelIcons = i474;
        int i475 = colorsCount;
        colorsCount = i475 + 1;
        key_chat_replyPanelClose = i475;
        int i476 = colorsCount;
        colorsCount = i476 + 1;
        key_chat_replyPanelName = i476;
        int i477 = colorsCount;
        colorsCount = i477 + 1;
        key_chat_replyPanelLine = i477;
        int i478 = colorsCount;
        colorsCount = i478 + 1;
        key_chat_searchPanelIcons = i478;
        int i479 = colorsCount;
        colorsCount = i479 + 1;
        key_chat_searchPanelText = i479;
        int i480 = colorsCount;
        colorsCount = i480 + 1;
        key_chat_secretChatStatusText = i480;
        int i481 = colorsCount;
        colorsCount = i481 + 1;
        key_chat_fieldOverlayText = i481;
        int i482 = colorsCount;
        colorsCount = i482 + 1;
        key_chat_stickersHintPanel = i482;
        int i483 = colorsCount;
        colorsCount = i483 + 1;
        key_chat_botSwitchToInlineText = i483;
        int i484 = colorsCount;
        colorsCount = i484 + 1;
        key_chat_unreadMessagesStartArrowIcon = i484;
        int i485 = colorsCount;
        colorsCount = i485 + 1;
        key_chat_unreadMessagesStartText = i485;
        int i486 = colorsCount;
        colorsCount = i486 + 1;
        key_chat_unreadMessagesStartBackground = i486;
        int i487 = colorsCount;
        colorsCount = i487 + 1;
        key_chat_inlineResultIcon = i487;
        int i488 = colorsCount;
        colorsCount = i488 + 1;
        key_chat_emojiPanelBackground = i488;
        int i489 = colorsCount;
        colorsCount = i489 + 1;
        key_chat_emojiSearchBackground = i489;
        int i490 = colorsCount;
        colorsCount = i490 + 1;
        key_chat_emojiSearchIcon = i490;
        int i491 = colorsCount;
        colorsCount = i491 + 1;
        key_chat_emojiPanelShadowLine = i491;
        int i492 = colorsCount;
        colorsCount = i492 + 1;
        key_chat_emojiPanelEmptyText = i492;
        int i493 = colorsCount;
        colorsCount = i493 + 1;
        key_chat_emojiPanelIcon = i493;
        int i494 = colorsCount;
        colorsCount = i494 + 1;
        key_chat_emojiBottomPanelIcon = i494;
        int i495 = colorsCount;
        colorsCount = i495 + 1;
        key_chat_emojiPanelIconSelected = i495;
        int i496 = colorsCount;
        colorsCount = i496 + 1;
        key_chat_emojiPanelStickerPackSelector = i496;
        int i497 = colorsCount;
        colorsCount = i497 + 1;
        key_chat_emojiPanelStickerPackSelectorLine = i497;
        int i498 = colorsCount;
        colorsCount = i498 + 1;
        key_chat_emojiPanelBackspace = i498;
        int i499 = colorsCount;
        colorsCount = i499 + 1;
        key_chat_emojiPanelTrendingTitle = i499;
        int i500 = colorsCount;
        colorsCount = i500 + 1;
        key_chat_emojiPanelStickerSetName = i500;
        int i501 = colorsCount;
        colorsCount = i501 + 1;
        key_chat_emojiPanelStickerSetNameHighlight = i501;
        int i502 = colorsCount;
        colorsCount = i502 + 1;
        key_chat_emojiPanelStickerSetNameIcon = i502;
        int i503 = colorsCount;
        colorsCount = i503 + 1;
        key_chat_emojiPanelTrendingDescription = i503;
        int i504 = colorsCount;
        colorsCount = i504 + 1;
        key_chat_botKeyboardButtonText = i504;
        int i505 = colorsCount;
        colorsCount = i505 + 1;
        key_chat_botKeyboardButtonBackground = i505;
        int i506 = colorsCount;
        colorsCount = i506 + 1;
        key_chat_botKeyboardButtonBackgroundPressed = i506;
        int i507 = colorsCount;
        colorsCount = i507 + 1;
        key_chat_emojiPanelNewTrending = i507;
        int i508 = colorsCount;
        colorsCount = i508 + 1;
        key_chat_messagePanelVoicePressed = i508;
        int i509 = colorsCount;
        colorsCount = i509 + 1;
        key_chat_messagePanelVoiceBackground = i509;
        int i510 = colorsCount;
        colorsCount = i510 + 1;
        key_chat_messagePanelVoiceDelete = i510;
        int i511 = colorsCount;
        colorsCount = i511 + 1;
        key_chat_messagePanelVoiceDuration = i511;
        int i512 = colorsCount;
        colorsCount = i512 + 1;
        key_chat_recordedVoicePlayPause = i512;
        int i513 = colorsCount;
        colorsCount = i513 + 1;
        key_chat_recordedVoiceProgress = i513;
        int i514 = colorsCount;
        colorsCount = i514 + 1;
        key_chat_recordedVoiceProgressInner = i514;
        int i515 = colorsCount;
        colorsCount = i515 + 1;
        key_chat_recordedVoiceDot = i515;
        int i516 = colorsCount;
        colorsCount = i516 + 1;
        key_chat_recordedVoiceBackground = i516;
        int i517 = colorsCount;
        colorsCount = i517 + 1;
        key_chat_recordVoiceCancel = i517;
        int i518 = colorsCount;
        colorsCount = i518 + 1;
        key_chat_recordTime = i518;
        int i519 = colorsCount;
        colorsCount = i519 + 1;
        key_chat_messagePanelCancelInlineBot = i519;
        int i520 = colorsCount;
        colorsCount = i520 + 1;
        key_chat_gifSaveHintText = i520;
        int i521 = colorsCount;
        colorsCount = i521 + 1;
        key_chat_gifSaveHintBackground = i521;
        int i522 = colorsCount;
        colorsCount = i522 + 1;
        key_chat_goDownButton = i522;
        int i523 = colorsCount;
        colorsCount = i523 + 1;
        key_chat_goDownButtonIcon = i523;
        int i524 = colorsCount;
        colorsCount = i524 + 1;
        key_chat_goDownButtonCounter = i524;
        int i525 = colorsCount;
        colorsCount = i525 + 1;
        key_chat_goDownButtonCounterBackground = i525;
        int i526 = colorsCount;
        colorsCount = i526 + 1;
        key_chat_inTextSelectionHighlight = i526;
        int i527 = colorsCount;
        colorsCount = i527 + 1;
        key_chat_TextSelectionCursor = i527;
        int i528 = colorsCount;
        colorsCount = i528 + 1;
        key_chat_inBubbleLocationPlaceholder = i528;
        int i529 = colorsCount;
        colorsCount = i529 + 1;
        key_chat_BlurAlpha = i529;
        int i530 = colorsCount;
        colorsCount = i530 + 1;
        key_chat_BlurAlphaSlow = i530;
        int i531 = colorsCount;
        colorsCount = i531 + 1;
        key_chat_editMediaButton = i531;
        int i532 = colorsCount;
        colorsCount = i532 + 1;
        key_voipgroup_listSelector = i532;
        int i533 = colorsCount;
        colorsCount = i533 + 1;
        key_voipgroup_inviteMembersBackground = i533;
        int i534 = colorsCount;
        colorsCount = i534 + 1;
        key_voipgroup_actionBar = i534;
        int i535 = colorsCount;
        colorsCount = i535 + 1;
        key_voipgroup_actionBarItems = i535;
        int i536 = colorsCount;
        colorsCount = i536 + 1;
        key_voipgroup_actionBarItemsSelector = i536;
        int i537 = colorsCount;
        colorsCount = i537 + 1;
        key_voipgroup_actionBarUnscrolled = i537;
        int i538 = colorsCount;
        colorsCount = i538 + 1;
        key_voipgroup_listViewBackgroundUnscrolled = i538;
        int i539 = colorsCount;
        colorsCount = i539 + 1;
        key_voipgroup_lastSeenTextUnscrolled = i539;
        int i540 = colorsCount;
        colorsCount = i540 + 1;
        key_voipgroup_mutedIconUnscrolled = i540;
        int i541 = colorsCount;
        colorsCount = i541 + 1;
        key_voipgroup_nameText = i541;
        int i542 = colorsCount;
        colorsCount = i542 + 1;
        key_voipgroup_lastSeenText = i542;
        int i543 = colorsCount;
        colorsCount = i543 + 1;
        key_voipgroup_listeningText = i543;
        int i544 = colorsCount;
        colorsCount = i544 + 1;
        key_voipgroup_speakingText = i544;
        int i545 = colorsCount;
        colorsCount = i545 + 1;
        key_voipgroup_mutedIcon = i545;
        int i546 = colorsCount;
        colorsCount = i546 + 1;
        key_voipgroup_mutedByAdminIcon = i546;
        int i547 = colorsCount;
        colorsCount = i547 + 1;
        key_voipgroup_listViewBackground = i547;
        int i548 = colorsCount;
        colorsCount = i548 + 1;
        key_voipgroup_dialogBackground = i548;
        int i549 = colorsCount;
        colorsCount = i549 + 1;
        key_voipgroup_leaveCallMenu = i549;
        int i550 = colorsCount;
        colorsCount = i550 + 1;
        key_voipgroup_checkMenu = i550;
        int i551 = colorsCount;
        colorsCount = i551 + 1;
        key_voipgroup_soundButton = i551;
        int i552 = colorsCount;
        colorsCount = i552 + 1;
        key_voipgroup_soundButtonActive = i552;
        int i553 = colorsCount;
        colorsCount = i553 + 1;
        key_voipgroup_soundButtonActiveScrolled = i553;
        int i554 = colorsCount;
        colorsCount = i554 + 1;
        key_voipgroup_soundButton2 = i554;
        int i555 = colorsCount;
        colorsCount = i555 + 1;
        key_voipgroup_soundButtonActive2 = i555;
        int i556 = colorsCount;
        colorsCount = i556 + 1;
        key_voipgroup_soundButtonActive2Scrolled = i556;
        int i557 = colorsCount;
        colorsCount = i557 + 1;
        key_voipgroup_leaveButton = i557;
        int i558 = colorsCount;
        colorsCount = i558 + 1;
        key_voipgroup_leaveButtonScrolled = i558;
        int i559 = colorsCount;
        colorsCount = i559 + 1;
        key_voipgroup_muteButton = i559;
        int i560 = colorsCount;
        colorsCount = i560 + 1;
        key_voipgroup_muteButton2 = i560;
        int i561 = colorsCount;
        colorsCount = i561 + 1;
        key_voipgroup_muteButton3 = i561;
        int i562 = colorsCount;
        colorsCount = i562 + 1;
        key_voipgroup_unmuteButton = i562;
        int i563 = colorsCount;
        colorsCount = i563 + 1;
        key_voipgroup_unmuteButton2 = i563;
        int i564 = colorsCount;
        colorsCount = i564 + 1;
        key_voipgroup_disabledButton = i564;
        int i565 = colorsCount;
        colorsCount = i565 + 1;
        key_voipgroup_disabledButtonActive = i565;
        int i566 = colorsCount;
        colorsCount = i566 + 1;
        key_voipgroup_disabledButtonActiveScrolled = i566;
        int i567 = colorsCount;
        colorsCount = i567 + 1;
        key_voipgroup_connectingProgress = i567;
        int i568 = colorsCount;
        colorsCount = i568 + 1;
        key_voipgroup_scrollUp = i568;
        int i569 = colorsCount;
        colorsCount = i569 + 1;
        key_voipgroup_searchPlaceholder = i569;
        int i570 = colorsCount;
        colorsCount = i570 + 1;
        key_voipgroup_searchBackground = i570;
        int i571 = colorsCount;
        colorsCount = i571 + 1;
        key_voipgroup_searchText = i571;
        int i572 = colorsCount;
        colorsCount = i572 + 1;
        key_voipgroup_overlayGreen1 = i572;
        int i573 = colorsCount;
        colorsCount = i573 + 1;
        key_voipgroup_overlayGreen2 = i573;
        int i574 = colorsCount;
        colorsCount = i574 + 1;
        key_voipgroup_overlayBlue1 = i574;
        int i575 = colorsCount;
        colorsCount = i575 + 1;
        key_voipgroup_overlayBlue2 = i575;
        int i576 = colorsCount;
        colorsCount = i576 + 1;
        key_voipgroup_topPanelGreen1 = i576;
        int i577 = colorsCount;
        colorsCount = i577 + 1;
        key_voipgroup_topPanelGreen2 = i577;
        int i578 = colorsCount;
        colorsCount = i578 + 1;
        key_voipgroup_topPanelBlue1 = i578;
        int i579 = colorsCount;
        colorsCount = i579 + 1;
        key_voipgroup_topPanelBlue2 = i579;
        int i580 = colorsCount;
        colorsCount = i580 + 1;
        key_voipgroup_topPanelGray = i580;
        int i581 = colorsCount;
        colorsCount = i581 + 1;
        key_voipgroup_overlayAlertGradientMuted = i581;
        int i582 = colorsCount;
        colorsCount = i582 + 1;
        key_voipgroup_overlayAlertGradientMuted2 = i582;
        int i583 = colorsCount;
        colorsCount = i583 + 1;
        key_voipgroup_overlayAlertGradientUnmuted = i583;
        int i584 = colorsCount;
        colorsCount = i584 + 1;
        key_voipgroup_overlayAlertGradientUnmuted2 = i584;
        int i585 = colorsCount;
        colorsCount = i585 + 1;
        key_voipgroup_overlayAlertMutedByAdmin = i585;
        int i586 = colorsCount;
        colorsCount = i586 + 1;
        key_voipgroup_overlayAlertMutedByAdmin2 = i586;
        int i587 = colorsCount;
        colorsCount = i587 + 1;
        key_voipgroup_mutedByAdminGradient = i587;
        int i588 = colorsCount;
        colorsCount = i588 + 1;
        key_voipgroup_mutedByAdminGradient2 = i588;
        int i589 = colorsCount;
        colorsCount = i589 + 1;
        key_voipgroup_mutedByAdminGradient3 = i589;
        int i590 = colorsCount;
        colorsCount = i590 + 1;
        key_voipgroup_mutedByAdminMuteButton = i590;
        int i591 = colorsCount;
        colorsCount = i591 + 1;
        key_voipgroup_mutedByAdminMuteButtonDisabled = i591;
        int i592 = colorsCount;
        colorsCount = i592 + 1;
        key_voipgroup_windowBackgroundWhiteInputField = i592;
        int i593 = colorsCount;
        colorsCount = i593 + 1;
        key_voipgroup_windowBackgroundWhiteInputFieldActivated = i593;
        int i594 = colorsCount;
        colorsCount = i594 + 1;
        key_table_background = i594;
        int i595 = colorsCount;
        colorsCount = i595 + 1;
        key_table_border = i595;
        int i596 = colorsCount;
        colorsCount = i596 + 1;
        key_passport_authorizeBackground = i596;
        int i597 = colorsCount;
        colorsCount = i597 + 1;
        key_passport_authorizeBackgroundSelected = i597;
        int i598 = colorsCount;
        colorsCount = i598 + 1;
        key_passport_authorizeText = i598;
        int i599 = colorsCount;
        colorsCount = i599 + 1;
        key_profile_creatorIcon = i599;
        int i600 = colorsCount;
        colorsCount = i600 + 1;
        key_profile_title = i600;
        int i601 = colorsCount;
        colorsCount = i601 + 1;
        key_profile_actionIcon = i601;
        int i602 = colorsCount;
        colorsCount = i602 + 1;
        key_profile_actionBackground = i602;
        int i603 = colorsCount;
        colorsCount = i603 + 1;
        key_profile_actionPressedBackground = i603;
        int i604 = colorsCount;
        colorsCount = i604 + 1;
        key_profile_verifiedBackground = i604;
        int i605 = colorsCount;
        colorsCount = i605 + 1;
        key_profile_verifiedCheck = i605;
        int i606 = colorsCount;
        colorsCount = i606 + 1;
        key_profile_status = i606;
        int i607 = colorsCount;
        colorsCount = i607 + 1;
        key_profile_tabText = i607;
        int i608 = colorsCount;
        colorsCount = i608 + 1;
        key_profile_tabSelectedText = i608;
        int i609 = colorsCount;
        colorsCount = i609 + 1;
        key_profile_tabSelectedLine = i609;
        int i610 = colorsCount;
        colorsCount = i610 + 1;
        key_profile_tabSelector = i610;
        int i611 = colorsCount;
        colorsCount = i611 + 1;
        key_sharedMedia_startStopLoadIcon = i611;
        int i612 = colorsCount;
        colorsCount = i612 + 1;
        key_sharedMedia_linkPlaceholder = i612;
        int i613 = colorsCount;
        colorsCount = i613 + 1;
        key_sharedMedia_linkPlaceholderText = i613;
        int i614 = colorsCount;
        colorsCount = i614 + 1;
        key_sharedMedia_photoPlaceholder = i614;
        int i615 = colorsCount;
        colorsCount = i615 + 1;
        key_featuredStickers_addedIcon = i615;
        int i616 = colorsCount;
        colorsCount = i616 + 1;
        key_featuredStickers_buttonProgress = i616;
        int i617 = colorsCount;
        colorsCount = i617 + 1;
        key_featuredStickers_addButton = i617;
        int i618 = colorsCount;
        colorsCount = i618 + 1;
        key_featuredStickers_addButtonPressed = i618;
        int i619 = colorsCount;
        colorsCount = i619 + 1;
        key_featuredStickers_removeButtonText = i619;
        int i620 = colorsCount;
        colorsCount = i620 + 1;
        key_featuredStickers_buttonText = i620;
        int i621 = colorsCount;
        colorsCount = i621 + 1;
        key_featuredStickers_unread = i621;
        int i622 = colorsCount;
        colorsCount = i622 + 1;
        key_stickers_menu = i622;
        int i623 = colorsCount;
        colorsCount = i623 + 1;
        key_stickers_menuSelector = i623;
        int i624 = colorsCount;
        colorsCount = i624 + 1;
        key_changephoneinfo_image2 = i624;
        int i625 = colorsCount;
        colorsCount = i625 + 1;
        key_groupcreate_hintText = i625;
        int i626 = colorsCount;
        colorsCount = i626 + 1;
        key_groupcreate_cursor = i626;
        int i627 = colorsCount;
        colorsCount = i627 + 1;
        key_groupcreate_sectionShadow = i627;
        int i628 = colorsCount;
        colorsCount = i628 + 1;
        key_groupcreate_sectionText = i628;
        int i629 = colorsCount;
        colorsCount = i629 + 1;
        key_groupcreate_spanText = i629;
        int i630 = colorsCount;
        colorsCount = i630 + 1;
        key_groupcreate_spanBackground = i630;
        int i631 = colorsCount;
        colorsCount = i631 + 1;
        key_groupcreate_spanDelete = i631;
        int i632 = colorsCount;
        colorsCount = i632 + 1;
        key_contacts_inviteBackground = i632;
        int i633 = colorsCount;
        colorsCount = i633 + 1;
        key_contacts_inviteText = i633;
        int i634 = colorsCount;
        colorsCount = i634 + 1;
        key_login_progressInner = i634;
        int i635 = colorsCount;
        colorsCount = i635 + 1;
        key_login_progressOuter = i635;
        int i636 = colorsCount;
        colorsCount = i636 + 1;
        key_picker_enabledButton = i636;
        int i637 = colorsCount;
        colorsCount = i637 + 1;
        key_picker_disabledButton = i637;
        int i638 = colorsCount;
        colorsCount = i638 + 1;
        key_picker_badge = i638;
        int i639 = colorsCount;
        colorsCount = i639 + 1;
        key_picker_badgeText = i639;
        int i640 = colorsCount;
        colorsCount = i640 + 1;
        key_location_sendLocationBackground = i640;
        int i641 = colorsCount;
        colorsCount = i641 + 1;
        key_location_sendLocationIcon = i641;
        int i642 = colorsCount;
        colorsCount = i642 + 1;
        key_location_sendLocationText = i642;
        int i643 = colorsCount;
        colorsCount = i643 + 1;
        key_location_sendLiveLocationBackground = i643;
        int i644 = colorsCount;
        colorsCount = i644 + 1;
        key_location_sendLiveLocationIcon = i644;
        int i645 = colorsCount;
        colorsCount = i645 + 1;
        key_location_sendLiveLocationText = i645;
        int i646 = colorsCount;
        colorsCount = i646 + 1;
        key_location_liveLocationProgress = i646;
        int i647 = colorsCount;
        colorsCount = i647 + 1;
        key_location_placeLocationBackground = i647;
        int i648 = colorsCount;
        colorsCount = i648 + 1;
        key_location_actionIcon = i648;
        int i649 = colorsCount;
        colorsCount = i649 + 1;
        key_location_actionActiveIcon = i649;
        int i650 = colorsCount;
        colorsCount = i650 + 1;
        key_location_actionBackground = i650;
        int i651 = colorsCount;
        colorsCount = i651 + 1;
        key_location_actionPressedBackground = i651;
        int i652 = colorsCount;
        colorsCount = i652 + 1;
        key_dialog_liveLocationProgress = i652;
        int i653 = colorsCount;
        colorsCount = i653 + 1;
        key_files_folderIcon = i653;
        int i654 = colorsCount;
        colorsCount = i654 + 1;
        key_files_folderIconBackground = i654;
        int i655 = colorsCount;
        colorsCount = i655 + 1;
        key_files_iconText = i655;
        int i656 = colorsCount;
        colorsCount = i656 + 1;
        key_sessions_devicesImage = i656;
        int i657 = colorsCount;
        colorsCount = i657 + 1;
        key_calls_callReceivedGreenIcon = i657;
        int i658 = colorsCount;
        colorsCount = i658 + 1;
        key_calls_callReceivedRedIcon = i658;
        int i659 = colorsCount;
        colorsCount = i659 + 1;
        key_undo_background = i659;
        int i660 = colorsCount;
        colorsCount = i660 + 1;
        key_undo_cancelColor = i660;
        int i661 = colorsCount;
        colorsCount = i661 + 1;
        key_undo_infoColor = i661;
        int i662 = colorsCount;
        colorsCount = i662 + 1;
        key_sheet_scrollUp = i662;
        int i663 = colorsCount;
        colorsCount = i663 + 1;
        key_sheet_other = i663;
        int i664 = colorsCount;
        colorsCount = i664 + 1;
        key_player_actionBarSelector = i664;
        int i665 = colorsCount;
        colorsCount = i665 + 1;
        key_player_actionBarTitle = i665;
        int i666 = colorsCount;
        colorsCount = i666 + 1;
        key_player_actionBarSubtitle = i666;
        int i667 = colorsCount;
        colorsCount = i667 + 1;
        key_player_actionBarItems = i667;
        int i668 = colorsCount;
        colorsCount = i668 + 1;
        key_player_background = i668;
        int i669 = colorsCount;
        colorsCount = i669 + 1;
        key_player_time = i669;
        int i670 = colorsCount;
        colorsCount = i670 + 1;
        key_player_progressBackground = i670;
        int i671 = colorsCount;
        colorsCount = i671 + 1;
        key_player_progressCachedBackground = i671;
        int i672 = colorsCount;
        colorsCount = i672 + 1;
        key_player_progress = i672;
        int i673 = colorsCount;
        colorsCount = i673 + 1;
        key_player_button = i673;
        int i674 = colorsCount;
        colorsCount = i674 + 1;
        key_player_buttonActive = i674;
        int i675 = colorsCount;
        colorsCount = i675 + 1;
        key_statisticChartSignature = i675;
        int i676 = colorsCount;
        colorsCount = i676 + 1;
        key_statisticChartSignatureAlpha = i676;
        int i677 = colorsCount;
        colorsCount = i677 + 1;
        key_statisticChartHintLine = i677;
        int i678 = colorsCount;
        colorsCount = i678 + 1;
        key_statisticChartActiveLine = i678;
        int i679 = colorsCount;
        colorsCount = i679 + 1;
        key_statisticChartInactivePickerChart = i679;
        int i680 = colorsCount;
        colorsCount = i680 + 1;
        key_statisticChartActivePickerChart = i680;
        int i681 = colorsCount;
        colorsCount = i681 + 1;
        key_statisticChartRipple = i681;
        int i682 = colorsCount;
        colorsCount = i682 + 1;
        key_statisticChartBackZoomColor = i682;
        int i683 = colorsCount;
        colorsCount = i683 + 1;
        key_statisticChartChevronColor = i683;
        int i684 = colorsCount;
        colorsCount = i684 + 1;
        key_statisticChartLine_blue = i684;
        int i685 = colorsCount;
        colorsCount = i685 + 1;
        key_statisticChartLine_green = i685;
        int i686 = colorsCount;
        colorsCount = i686 + 1;
        key_statisticChartLine_red = i686;
        int i687 = colorsCount;
        colorsCount = i687 + 1;
        key_statisticChartLine_golden = i687;
        int i688 = colorsCount;
        colorsCount = i688 + 1;
        key_statisticChartLine_lightblue = i688;
        int i689 = colorsCount;
        colorsCount = i689 + 1;
        key_statisticChartLine_lightgreen = i689;
        int i690 = colorsCount;
        colorsCount = i690 + 1;
        key_statisticChartLine_orange = i690;
        int i691 = colorsCount;
        colorsCount = i691 + 1;
        key_statisticChartLine_indigo = i691;
        int i692 = colorsCount;
        colorsCount = i692 + 1;
        key_statisticChartLine_purple = i692;
        int i693 = colorsCount;
        colorsCount = i693 + 1;
        key_statisticChartLine_cyan = i693;
        int i694 = colorsCount;
        colorsCount = i694 + 1;
        key_statisticChartLineEmpty = i694;
        tabNewIcons = new int[]{R.drawable.tab_all_new, R.drawable.tab_user_new, R.drawable.tab_groups_new, R.drawable.tab_sgroups_new, R.drawable.tab_channel_new, R.drawable.tab_bot_new, R.drawable.tab_fave_new, R.drawable.tab_admin_new, R.drawable.tab_unread_new};
        tabTitles = new String[]{LocaleController.getString("All", R.string.All), LocaleController.getString("Users", R.string.Users), LocaleController.getString("Groups", R.string.Groups), LocaleController.getString("SuperGroups", R.string.SuperGroups), LocaleController.getString("Channels", R.string.Channels), LocaleController.getString("Bots", R.string.Bots), LocaleController.getString("Favorites", R.string.Favorites), LocaleController.getString("Administrator", R.string.Administrator), LocaleController.getString("Unread", R.string.Unread)};
        int i695 = colorsCount;
        colorsCount = i695 + 1;
        key_color_lightblue = i695;
        int i696 = colorsCount;
        colorsCount = i696 + 1;
        key_color_blue = i696;
        int i697 = colorsCount;
        colorsCount = i697 + 1;
        key_color_green = i697;
        int i698 = colorsCount;
        colorsCount = i698 + 1;
        key_color_lightgreen = i698;
        int i699 = colorsCount;
        colorsCount = i699 + 1;
        key_color_red = i699;
        int i700 = colorsCount;
        colorsCount = i700 + 1;
        key_color_orange = i700;
        int i701 = colorsCount;
        colorsCount = i701 + 1;
        key_color_yellow = i701;
        int i702 = colorsCount;
        colorsCount = i702 + 1;
        key_color_purple = i702;
        int i703 = colorsCount;
        colorsCount = i703 + 1;
        key_color_cyan = i703;
        keys_colors = new int[]{i695, i696, i697, i698, i699, i700, i701, i702, i703};
        int i704 = colorsCount;
        colorsCount = i704 + 1;
        key_chat_inReactionButtonBackground = i704;
        int i705 = colorsCount;
        colorsCount = i705 + 1;
        key_chat_outReactionButtonText = i705;
        int i706 = colorsCount;
        colorsCount = i706 + 1;
        key_chat_inReactionButtonText = i706;
        int i707 = colorsCount;
        colorsCount = i707 + 1;
        key_chat_inReactionButtonTextSelected = i707;
        int i708 = colorsCount;
        colorsCount = i708 + 1;
        key_chat_outReactionButtonTextSelected = i708;
        int i709 = colorsCount;
        colorsCount = i709 + 1;
        key_premiumGradient0 = i709;
        int i710 = colorsCount;
        colorsCount = i710 + 1;
        key_premiumGradient1 = i710;
        int i711 = colorsCount;
        colorsCount = i711 + 1;
        key_premiumGradient2 = i711;
        int i712 = colorsCount;
        colorsCount = i712 + 1;
        key_premiumGradient3 = i712;
        int i713 = colorsCount;
        colorsCount = i713 + 1;
        key_premiumGradient4 = i713;
        int i714 = colorsCount;
        colorsCount = i714 + 1;
        key_premiumGradientBackground1 = i714;
        int i715 = colorsCount;
        colorsCount = i715 + 1;
        key_premiumGradientBackground2 = i715;
        int i716 = colorsCount;
        colorsCount = i716 + 1;
        key_premiumGradientBackground3 = i716;
        int i717 = colorsCount;
        colorsCount = i717 + 1;
        key_premiumGradientBackground4 = i717;
        int i718 = colorsCount;
        colorsCount = i718 + 1;
        key_premiumGradientBackgroundOverlay = i718;
        int i719 = colorsCount;
        colorsCount = i719 + 1;
        key_premiumStartSmallStarsColor = i719;
        int i720 = colorsCount;
        colorsCount = i720 + 1;
        key_premiumStarGradient1 = i720;
        int i721 = colorsCount;
        colorsCount = i721 + 1;
        key_premiumStarGradient2 = i721;
        int i722 = colorsCount;
        colorsCount = i722 + 1;
        key_premiumCoinGradient1 = i722;
        int i723 = colorsCount;
        colorsCount = i723 + 1;
        key_premiumCoinGradient2 = i723;
        int i724 = colorsCount;
        colorsCount = i724 + 1;
        key_premiumStartSmallStarsColor2 = i724;
        int i725 = colorsCount;
        colorsCount = i725 + 1;
        key_premiumGradientBottomSheet1 = i725;
        int i726 = colorsCount;
        colorsCount = i726 + 1;
        key_premiumGradientBottomSheet2 = i726;
        int i727 = colorsCount;
        colorsCount = i727 + 1;
        key_premiumGradientBottomSheet3 = i727;
        int i728 = colorsCount;
        colorsCount = i728 + 1;
        key_topics_unreadCounter = i728;
        int i729 = colorsCount;
        colorsCount = i729 + 1;
        key_topics_unreadCounterMuted = i729;
        int i730 = colorsCount;
        colorsCount = i730 + 1;
        key_starsGradient1 = i730;
        int i731 = colorsCount;
        colorsCount = i731 + 1;
        key_starsGradient2 = i731;
        int i732 = colorsCount;
        colorsCount = i732 + 1;
        key_chats_menuCloud = i732;
        int i733 = colorsCount;
        colorsCount = i733 + 1;
        key_chats_menuCloudBackgroundCats = i733;
        int i734 = colorsCount;
        colorsCount = i734 + 1;
        key_musicPicker_checkbox = i734;
        int i735 = colorsCount;
        colorsCount = i735 + 1;
        key_musicPicker_checkboxCheck = i735;
        int i736 = colorsCount;
        colorsCount = i736 + 1;
        key_musicPicker_buttonBackground = i736;
        int i737 = colorsCount;
        colorsCount = i737 + 1;
        key_musicPicker_buttonIcon = i737;
        int i738 = colorsCount;
        colorsCount = i738 + 1;
        key_chat_outBroadcast = i738;
        int i739 = colorsCount;
        colorsCount = i739 + 1;
        key_chat_mediaBroadcast = i739;
        int i740 = colorsCount;
        colorsCount = i740 + 1;
        key_tealColor = i740;
        int i741 = colorsCount;
        colorsCount = i741 + 1;
        pkey_themeColor = i741;
        int i742 = colorsCount;
        colorsCount = i742 + 1;
        pkey_themeLightColor = i742;
        int i743 = colorsCount;
        colorsCount = i743 + 1;
        pkey_themeDarkColor = i743;
        int i744 = colorsCount;
        colorsCount = i744 + 1;
        pkey_dialogColor = i744;
        int i745 = colorsCount;
        colorsCount = i745 + 1;
        pkey_dialogTextColor = i745;
        int i746 = colorsCount;
        colorsCount = i746 + 1;
        pkey_dialogBGColor = i746;
        int i747 = colorsCount;
        colorsCount = i747 + 1;
        pkey_chatHeaderColor = i747;
        int i748 = colorsCount;
        colorsCount = i748 + 1;
        pkey_chatHeaderGradient = i748;
        int i749 = colorsCount;
        colorsCount = i749 + 1;
        pkey_chatHeaderGradientColor = i749;
        int i750 = colorsCount;
        colorsCount = i750 + 1;
        pkey_chatHeaderIconsColor = i750;
        int i751 = colorsCount;
        colorsCount = i751 + 1;
        pkey_chatHeaderAvatarRadius = i751;
        int i752 = colorsCount;
        colorsCount = i752 + 1;
        pkey_chatNameSize = i752;
        int i753 = colorsCount;
        colorsCount = i753 + 1;
        pkey_chatNameColor = i753;
        int i754 = colorsCount;
        colorsCount = i754 + 1;
        pkey_chatStatusSize = i754;
        int i755 = colorsCount;
        colorsCount = i755 + 1;
        pkey_chatStatusColor = i755;
        int i756 = colorsCount;
        colorsCount = i756 + 1;
        pkey_chatOnlineColor = i756;
        int i757 = colorsCount;
        colorsCount = i757 + 1;
        pkey_chatTypingColor = i757;
        int i758 = colorsCount;
        colorsCount = i758 + 1;
        pkey_chatSolidBGColor = i758;
        int i759 = colorsCount;
        colorsCount = i759 + 1;
        pkey_chatGradientBGColor = i759;
        int i760 = colorsCount;
        colorsCount = i760 + 1;
        pkey_chatGradientBG = i760;
        int i761 = colorsCount;
        colorsCount = i761 + 1;
        pkey_chatMemberColor = i761;
        int i762 = colorsCount;
        colorsCount = i762 + 1;
        pkey_chatContactNameColor = i762;
        int i763 = colorsCount;
        colorsCount = i763 + 1;
        pkey_chatRTextColor = i763;
        int i764 = colorsCount;
        colorsCount = i764 + 1;
        pkey_chatRLinkColor = i764;
        int i765 = colorsCount;
        colorsCount = i765 + 1;
        pkey_chatLTextColor = i765;
        int i766 = colorsCount;
        colorsCount = i766 + 1;
        pkey_chatLLinkColor = i766;
        int i767 = colorsCount;
        colorsCount = i767 + 1;
        pkey_chatSelectedMsgBGColor = i767;
        int i768 = colorsCount;
        colorsCount = i768 + 1;
        pkey_chatRTimeColor = i768;
        int i769 = colorsCount;
        colorsCount = i769 + 1;
        pkey_chatLTimeColor = i769;
        int i770 = colorsCount;
        colorsCount = i770 + 1;
        pkey_chatCommandColor = i770;
        int i771 = colorsCount;
        colorsCount = i771 + 1;
        pkey_chatDateColor = i771;
        int i772 = colorsCount;
        colorsCount = i772 + 1;
        pkey_chatChecksColor = i772;
        int i773 = colorsCount;
        colorsCount = i773 + 1;
        pkey_chatRBubbleColor = i773;
        int i774 = colorsCount;
        colorsCount = i774 + 1;
        pkey_chatRBubbleColorSelected = i774;
        int i775 = colorsCount;
        colorsCount = i775 + 1;
        pkey_chatLBubbleColor = i775;
        int i776 = colorsCount;
        colorsCount = i776 + 1;
        pkey_chatLBubbleColorSelected = i776;
        int i777 = colorsCount;
        colorsCount = i777 + 1;
        pkey_chatForwardRColor = i777;
        int i778 = colorsCount;
        colorsCount = i778 + 1;
        pkey_chatForwardLColor = i778;
        int i779 = colorsCount;
        colorsCount = i779 + 1;
        pkey_chatTextSize = i779;
        int i780 = colorsCount;
        colorsCount = i780 + 1;
        pkey_chatTimeSize = i780;
        int i781 = colorsCount;
        colorsCount = i781 + 1;
        pkey_chatDateSize = i781;
        int i782 = colorsCount;
        colorsCount = i782 + 1;
        pkey_chatDateBubbleColor = i782;
        int i783 = colorsCount;
        colorsCount = i783 + 1;
        pkey_chatSendIconColor = i783;
        int i784 = colorsCount;
        colorsCount = i784 + 1;
        pkey_chatEditTextColor = i784;
        int i785 = colorsCount;
        colorsCount = i785 + 1;
        pkey_chatEditTextSize = i785;
        int i786 = colorsCount;
        colorsCount = i786 + 1;
        pkey_chatEditTextBGColor = i786;
        int i787 = colorsCount;
        colorsCount = i787 + 1;
        pkey_chatEditTextBGGradientColor = i787;
        int i788 = colorsCount;
        colorsCount = i788 + 1;
        pkey_chatEditTextBGGradient = i788;
        int i789 = colorsCount;
        colorsCount = i789 + 1;
        pkey_chatEditTextIconsColor = i789;
        int i790 = colorsCount;
        colorsCount = i790 + 1;
        pkey_chatAttachBGColor = i790;
        int i791 = colorsCount;
        colorsCount = i791 + 1;
        pkey_chatAttachBGGradient = i791;
        int i792 = colorsCount;
        colorsCount = i792 + 1;
        pkey_chatAttachBGGradientColor = i792;
        int i793 = colorsCount;
        colorsCount = i793 + 1;
        pkey_chatAttachTextColor = i793;
        int i794 = colorsCount;
        colorsCount = i794 + 1;
        pkey_chatEmojiViewBGColor = i794;
        int i795 = colorsCount;
        colorsCount = i795 + 1;
        pkey_chatEmojiViewBGGradient = i795;
        int i796 = colorsCount;
        colorsCount = i796 + 1;
        pkey_chatEmojiViewBGGradientColor = i796;
        int i797 = colorsCount;
        colorsCount = i797 + 1;
        pkey_chatEmojiViewTabIconColor = i797;
        int i798 = colorsCount;
        colorsCount = i798 + 1;
        pkey_chatEmojiViewTabColor = i798;
        int i799 = colorsCount;
        colorsCount = i799 + 1;
        pkey_chatQuickBarColor = i799;
        int i800 = colorsCount;
        colorsCount = i800 + 1;
        pkey_chatQuickBarNamesColor = i800;
        int i801 = colorsCount;
        colorsCount = i801 + 1;
        pkey_chatAvatarRadius = i801;
        int i802 = colorsCount;
        colorsCount = i802 + 1;
        pkey_chatAvatarSize = i802;
        int i803 = colorsCount;
        colorsCount = i803 + 1;
        pkey_chatAvatarMarginLeft = i803;
        int i804 = colorsCount;
        colorsCount = i804 + 1;
        pkey_chatsHeaderActionModeIconsColor = i804;
        int i805 = colorsCount;
        colorsCount = i805 + 1;
        pkey_chatsHeaderTabActionModeColor = i805;
        int i806 = colorsCount;
        colorsCount = i806 + 1;
        pkey_chatsHeaderTabActionModeSelectedColor = i806;
        int i807 = colorsCount;
        colorsCount = i807 + 1;
        pkey_chatsHeaderTabIconColor = i807;
        int i808 = colorsCount;
        colorsCount = i808 + 1;
        pkey_chatsHeaderTitleColor = i808;
        int i809 = colorsCount;
        colorsCount = i809 + 1;
        pkey_chatsHeaderIconsColor = i809;
        int i810 = colorsCount;
        colorsCount = i810 + 1;
        pkey_chatsChecksColor = i810;
        int i811 = colorsCount;
        colorsCount = i811 + 1;
        pkey_chatsGroupNameColor = i811;
        int i812 = colorsCount;
        colorsCount = i812 + 1;
        pkey_chatsNameColor = i812;
        int i813 = colorsCount;
        colorsCount = i813 + 1;
        pkey_chatsUnknownNameColor = i813;
        int i814 = colorsCount;
        colorsCount = i814 + 1;
        pkey_chatsFloatingBGColor = i814;
        int i815 = colorsCount;
        colorsCount = i815 + 1;
        pkey_chatsFloatingPencilColor = i815;
        int i816 = colorsCount;
        colorsCount = i816 + 1;
        pkey_chatsMessageColor = i816;
        int i817 = colorsCount;
        colorsCount = i817 + 1;
        pkey_chatsMemberColor = i817;
        int i818 = colorsCount;
        colorsCount = i818 + 1;
        pkey_chatsMediaColor = i818;
        int i819 = colorsCount;
        colorsCount = i819 + 1;
        pkey_chatsCountColor = i819;
        int i820 = colorsCount;
        colorsCount = i820 + 1;
        pkey_chatsHeaderColor = i820;
        int i821 = colorsCount;
        colorsCount = i821 + 1;
        pkey_chatsHeaderTabUnselectedIconColor = i821;
        int i822 = colorsCount;
        colorsCount = i822 + 1;
        pkey_contactsHeaderColor = i822;
        int i823 = colorsCount;
        colorsCount = i823 + 1;
        pkey_contactsHeaderTitleColor = i823;
        int i824 = colorsCount;
        colorsCount = i824 + 1;
        pkey_contactsHeaderIconsColor = i824;
        int i825 = colorsCount;
        colorsCount = i825 + 1;
        pkey_contactsIconsColor = i825;
        int i826 = colorsCount;
        colorsCount = i826 + 1;
        pkey_contactsRowColor = i826;
        int i827 = colorsCount;
        colorsCount = i827 + 1;
        pkey_contactsNameColor = i827;
        int i828 = colorsCount;
        colorsCount = i828 + 1;
        pkey_contactsStatusColor = i828;
        int i829 = colorsCount;
        colorsCount = i829 + 1;
        pkey_contactsOnlineColor = i829;
        int i830 = colorsCount;
        colorsCount = i830 + 1;
        pkey_contactsAvatarRadius = i830;
        int i831 = colorsCount;
        colorsCount = i831 + 1;
        pkey_contactsNameSize = i831;
        int i832 = colorsCount;
        colorsCount = i832 + 1;
        pkey_contactsStatusSize = i832;
        int i833 = colorsCount;
        colorsCount = i833 + 1;
        pkey_prefActionbarColor = i833;
        int i834 = colorsCount;
        colorsCount = i834 + 1;
        pkey_prefActionbarTitleColor = i834;
        int i835 = colorsCount;
        colorsCount = i835 + 1;
        pkey_prefActionbarStatusColor = i835;
        int i836 = colorsCount;
        colorsCount = i836 + 1;
        pkey_prefAvatarColor = i836;
        int i837 = colorsCount;
        colorsCount = i837 + 1;
        pkey_prefBGColor = i837;
        int i838 = colorsCount;
        colorsCount = i838 + 1;
        pkey_prefSectionColor = i838;
        int i839 = colorsCount;
        colorsCount = i839 + 1;
        pkey_drawerOptionColor = i839;
        int i840 = colorsCount;
        colorsCount = i840 + 1;
        pkey_drawerIconColor = i840;
        int i841 = colorsCount;
        colorsCount = i841 + 1;
        pkey_drawerPhoneColor = i841;
        int i842 = colorsCount;
        colorsCount = i842 + 1;
        pkey_drawerNameColor = i842;
        int i843 = colorsCount;
        colorsCount = i843 + 1;
        pkey_drawerListColor = i843;
        int i844 = colorsCount;
        colorsCount = i844 + 1;
        key_stories_circle1 = i844;
        int i845 = colorsCount;
        colorsCount = i845 + 1;
        key_stories_circle2 = i845;
        int i846 = colorsCount;
        colorsCount = i846 + 1;
        key_stories_circle_dialog1 = i846;
        int i847 = colorsCount;
        colorsCount = i847 + 1;
        key_stories_circle_dialog2 = i847;
        int i848 = colorsCount;
        colorsCount = i848 + 1;
        key_stories_circle_closeFriends1 = i848;
        int i849 = colorsCount;
        colorsCount = i849 + 1;
        key_stories_circle_closeFriends2 = i849;
        int i850 = colorsCount;
        colorsCount = i850 + 1;
        key_chat_inCodeBackground = i850;
        int i851 = colorsCount;
        colorsCount = i851 + 1;
        key_chat_outCodeBackground = i851;
        int i852 = colorsCount;
        colorsCount = i852 + 1;
        key_code_keyword = i852;
        int i853 = colorsCount;
        colorsCount = i853 + 1;
        key_code_operator = i853;
        int i854 = colorsCount;
        colorsCount = i854 + 1;
        key_code_constant = i854;
        int i855 = colorsCount;
        colorsCount = i855 + 1;
        key_code_string = i855;
        int i856 = colorsCount;
        colorsCount = i856 + 1;
        key_code_number = i856;
        int i857 = colorsCount;
        colorsCount = i857 + 1;
        key_code_comment = i857;
        int i858 = colorsCount;
        colorsCount = i858 + 1;
        key_code_function = i858;
        int i859 = colorsCount;
        colorsCount = i859 + 1;
        pkey_drawerHeaderColor = i859;
        int i860 = colorsCount;
        colorsCount = i860 + 1;
        pkey_drawerAvatarSize = i860;
        int i861 = colorsCount;
        colorsCount = i861 + 1;
        pkey_drawerOptionSize = i861;
        int i862 = colorsCount;
        colorsCount = i862 + 1;
        pkey_drawerTopShadowColor = i862;
        int i863 = colorsCount;
        colorsCount = i863 + 1;
        pkey_drawerListDividerColor = i863;
        int i864 = colorsCount;
        colorsCount = i864 + 1;
        pkey_profileActionbarIconsColor = i864;
        int i865 = colorsCount;
        colorsCount = i865 + 1;
        pkey_profileCreatorStarColor = i865;
        int i866 = colorsCount;
        colorsCount = i866 + 1;
        pkey_profileAdminStarColor = i866;
        int i867 = colorsCount;
        colorsCount = i867 + 1;
        pkey_prefActionbarIconsColor = i867;
        int i868 = colorsCount;
        colorsCount = i868 + 1;
        pkey_prefAvatarRadius = i868;
        int i869 = colorsCount;
        colorsCount = i869 + 1;
        pkey_prefAvatarSize = i869;
        int i870 = colorsCount;
        colorsCount = i870 + 1;
        pkey_prefShadowColor = i870;
        int i871 = colorsCount;
        colorsCount = i871 + 1;
        pkey_prefTitleColor = i871;
        int i872 = colorsCount;
        colorsCount = i872 + 1;
        pkey_prefSummaryColor = i872;
        int i873 = colorsCount;
        colorsCount = i873 + 1;
        pkey_prefDividerColor = i873;
        int i874 = colorsCount;
        colorsCount = i874 + 1;
        pkey_profileActionbarGradientList = i874;
        int i875 = colorsCount;
        colorsCount = i875 + 1;
        pkey_profileActionbarGradientColor = i875;
        int i876 = colorsCount;
        colorsCount = i876 + 1;
        pkey_profileActionbarAvatarRadius = i876;
        int i877 = colorsCount;
        colorsCount = i877 + 1;
        pkey_profileActionbarNameSize = i877;
        int i878 = colorsCount;
        colorsCount = i878 + 1;
        pkey_profileActionbarNameColor = i878;
        int i879 = colorsCount;
        colorsCount = i879 + 1;
        pkey_profileActionbarStatusColor = i879;
        int i880 = colorsCount;
        colorsCount = i880 + 1;
        pkey_profileActionbarStatusSize = i880;
        int i881 = colorsCount;
        colorsCount = i881 + 1;
        pkey_profileRowColor = i881;
        int i882 = colorsCount;
        colorsCount = i882 + 1;
        pkey_profileRowGradientList = i882;
        int i883 = colorsCount;
        colorsCount = i883 + 1;
        pkey_profileRowGradientColor = i883;
        int i884 = colorsCount;
        colorsCount = i884 + 1;
        pkey_profileRowAvatarRadius = i884;
        int i885 = colorsCount;
        colorsCount = i885 + 1;
        pkey_profileRowTitleColor = i885;
        int i886 = colorsCount;
        colorsCount = i886 + 1;
        pkey_profileRowStatusColor = i886;
        int i887 = colorsCount;
        colorsCount = i887 + 1;
        pkey_profileRowOnlineColor = i887;
        int i888 = colorsCount;
        colorsCount = i888 + 1;
        pkey_profileRowIconsColor = i888;
        defaultChatDrawables = new HashMap<>();
        defaultChatDrawableColorKeys = new HashMap<>();
        defaultChatPaints = new HashMap<>();
        defaultChatPaintColors = new HashMap<>();
        FAV_INDICATOR_COLOR_DEF = -10929;
        bubblesNamesArray = new String[]{"Telegram", "Lex", "Hangouts", "Notepad", "Ed", "Edge", "iOS", "Telegram_old", "OvaLex", "MaxSquare", "MaxLines", "LineFineLex", "PictuLineLex", "Tx"};
        imgid = new Integer[]{Integer.valueOf(R.drawable.msg_in), Integer.valueOf(R.drawable.msg_in_2), Integer.valueOf(R.drawable.msg_in_3), Integer.valueOf(R.drawable.msg_in_4), Integer.valueOf(R.drawable.msg_in_5), Integer.valueOf(R.drawable.msg_in_6), Integer.valueOf(R.drawable.msg_in_7), Integer.valueOf(R.drawable.msg_in_8), Integer.valueOf(R.drawable.msg_in_9_photo), Integer.valueOf(R.drawable.msg_in_10), Integer.valueOf(R.drawable.msg_in_11), Integer.valueOf(R.drawable.msg_in_12), Integer.valueOf(R.drawable.msg_in_13), Integer.valueOf(R.drawable.msg_in_14), Integer.valueOf(R.drawable.msg_out), Integer.valueOf(R.drawable.msg_out_2), Integer.valueOf(R.drawable.msg_out_3), Integer.valueOf(R.drawable.msg_out_4), Integer.valueOf(R.drawable.msg_out_5), Integer.valueOf(R.drawable.msg_out_6), Integer.valueOf(R.drawable.msg_out_7), Integer.valueOf(R.drawable.msg_out_8), Integer.valueOf(R.drawable.msg_out_9_photo), Integer.valueOf(R.drawable.msg_out_10), Integer.valueOf(R.drawable.msg_out_11), Integer.valueOf(R.drawable.msg_out_12), Integer.valueOf(R.drawable.msg_out_13), Integer.valueOf(R.drawable.msg_out_14)};
        checksNamesArray = new String[]{"Stock", "EdCheck", "Lex", "Gladiator", "MaxChecks", "ElipLex", "CubeLex", "MaxLines", "RLex", "MaxLinesPro", "ReadLex", "MaxHeart"};
        int i889 = R.drawable.msg_check_w_2;
        int i890 = R.drawable.msg_check_w_3;
        int i891 = R.drawable.msg_check_w_4;
        int i892 = R.drawable.msg_check_w_5;
        int i893 = R.drawable.msg_check_w_6;
        int i894 = R.drawable.msg_check_w_7;
        int i895 = R.drawable.msg_check_w_8;
        int i896 = R.drawable.msg_check_w_9;
        int i897 = R.drawable.msg_check_w_10;
        int i898 = R.drawable.msg_check_w_11;
        int i899 = R.drawable.msg_check_w_12;
        int i900 = R.drawable.msg_halfcheck_w_2;
        int i901 = R.drawable.msg_halfcheck_w_3;
        int i902 = R.drawable.msg_halfcheck_w_4;
        int i903 = R.drawable.msg_halfcheck_w_5;
        int i904 = R.drawable.msg_halfcheck_w_6;
        int i905 = R.drawable.msg_halfcheck_w_7;
        int i906 = R.drawable.msg_halfcheck_w_8;
        int i907 = R.drawable.msg_halfcheck_w_9;
        int i908 = R.drawable.msg_halfcheck_w_10;
        int i909 = R.drawable.msg_halfcheck_w_11;
        int i910 = R.drawable.msg_halfcheck_w_12;
        checkid = new Integer[]{Integer.valueOf(R.drawable.list_check), Integer.valueOf(R.drawable.dialogs_check_2), Integer.valueOf(R.drawable.dialogs_check_3), Integer.valueOf(R.drawable.dialogs_check_4), Integer.valueOf(R.drawable.dialogs_check_5), Integer.valueOf(R.drawable.dialogs_check_6), Integer.valueOf(R.drawable.dialogs_check_7), Integer.valueOf(R.drawable.dialogs_check_8), Integer.valueOf(R.drawable.dialogs_check_9), Integer.valueOf(R.drawable.dialogs_check_10), Integer.valueOf(R.drawable.dialogs_check_11), Integer.valueOf(R.drawable.dialogs_check_12), Integer.valueOf(R.drawable.list_halfcheck), Integer.valueOf(R.drawable.dialogs_halfcheck_2), Integer.valueOf(R.drawable.dialogs_halfcheck_3), Integer.valueOf(R.drawable.dialogs_halfcheck_4), Integer.valueOf(R.drawable.dialogs_halfcheck_5), Integer.valueOf(R.drawable.dialogs_halfcheck_6), Integer.valueOf(R.drawable.dialogs_halfcheck_7), Integer.valueOf(R.drawable.dialogs_halfcheck_8), Integer.valueOf(R.drawable.dialogs_halfcheck_9), Integer.valueOf(R.drawable.dialogs_halfcheck_10), Integer.valueOf(R.drawable.dialogs_halfcheck_11), Integer.valueOf(R.drawable.dialogs_halfcheck_12), Integer.valueOf(R.drawable.msg_check_s), Integer.valueOf(i889), Integer.valueOf(i890), Integer.valueOf(i891), Integer.valueOf(i892), Integer.valueOf(i893), Integer.valueOf(i894), Integer.valueOf(i895), Integer.valueOf(i896), Integer.valueOf(i897), Integer.valueOf(i898), Integer.valueOf(i899), Integer.valueOf(R.drawable.msg_halfcheck), Integer.valueOf(i900), Integer.valueOf(i901), Integer.valueOf(i902), Integer.valueOf(i903), Integer.valueOf(i904), Integer.valueOf(i905), Integer.valueOf(i906), Integer.valueOf(i907), Integer.valueOf(i908), Integer.valueOf(i909), Integer.valueOf(i910), Integer.valueOf(R.drawable.msg_check_w), Integer.valueOf(i889), Integer.valueOf(i890), Integer.valueOf(i891), Integer.valueOf(i892), Integer.valueOf(i893), Integer.valueOf(i894), Integer.valueOf(i895), Integer.valueOf(i896), Integer.valueOf(i897), Integer.valueOf(i898), Integer.valueOf(i899), Integer.valueOf(R.drawable.msg_halfcheck_w), Integer.valueOf(i900), Integer.valueOf(i901), Integer.valueOf(i902), Integer.valueOf(i903), Integer.valueOf(i904), Integer.valueOf(i905), Integer.valueOf(i906), Integer.valueOf(i907), Integer.valueOf(i908), Integer.valueOf(i909), Integer.valueOf(i910)};
        tabType = new int[]{0, 20, 21, 22, 24, 25, 26, 27, 28};
        defaultPlusColors = new HashMap<>();
        telegramToPlus = new HashMap<>();
        telegramToPlusInt = new HashMap<>();
        fallbackKeys = new SparseIntArray();
        themeAccentExclusionKeys = new HashSet<>();
        hsvTemp1Local = new ThreadLocal<>();
        hsvTemp2Local = new ThreadLocal<>();
        hsvTemp3Local = new ThreadLocal<>();
        hsvTemp4Local = new ThreadLocal<>();
        hsvTemp5Local = new ThreadLocal<>();
        ThemeColors.createDefaultPlusColors();
        defColor = -16738680;
        lightColor = -12527928;
        darkColor = -16744077;
        defaultPlusColors.put(ThemeColors.getStringName(pkey_themeColor), -16738680);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_dialogColor), -16738680);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_dialogTextColor), -14540254);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_dialogBGColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_themeDarkColor), Integer.valueOf(AndroidUtilities.setDarkColor(-16738680, 21)));
        defaultPlusColors.put(ThemeColors.getStringName(pkey_themeLightColor), Integer.valueOf(AndroidUtilities.setDarkColor(-16738680, -64)));
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsHeaderTitleColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsHeaderIconsColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsChecksColor), -16738680);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsNameColor), -14606047);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsGroupNameColor), -14606047);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsUnknownNameColor), -14606047);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsFloatingBGColor), -16738680);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsFloatingPencilColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsMessageColor), -8355712);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsMemberColor), -16744077);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsMediaColor), -16744077);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsCountColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatHeaderColor), -16738680);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatHeaderGradient), 0);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatHeaderGradientColor), -16738680);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatHeaderIconsColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatHeaderAvatarRadius), 32);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatNameSize), 18);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatNameColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatStatusSize), 14);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatStatusColor), -12527928);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatOnlineColor), -12527928);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatTypingColor), -12527928);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatSolidBGColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatGradientBG), 0);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatGradientBGColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatAvatarRadius), 32);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatAvatarSize), 42);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatAvatarMarginLeft), 6);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatTextSize), 16);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatRTextColor), -16777216);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatRLinkColor), -16738680);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatLTextColor), -16777216);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatLLinkColor), -16738680);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatSelectedMsgBGColor), 1713809050);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatCommandColor), -16738680);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatTimeSize), 12);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatRTimeColor), -16744077);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatLTimeColor), -6182221);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatChecksColor), -16738680);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatDateSize), 16);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatDateColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatRBubbleColor), -5054501);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatRBubbleColorSelected), -6436154);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatLBubbleColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatLBubbleColorSelected), -1381654);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatDateBubbleColor), 1711934734);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatMemberColor), -16744077);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatContactNameColor), -16738680);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatForwardRColor), -16744077);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatForwardLColor), -16744077);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatSendIconColor), -16738680);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatEditTextSize), 18);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatEditTextColor), -16777216);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatEditTextBGColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatEditTextBGGradient), 0);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatEditTextBGGradientColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatEditTextIconsColor), -5395027);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatAttachBGColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatAttachBGGradient), 0);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatAttachBGGradientColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatAttachTextColor), -16738680);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatEmojiViewBGColor), -657673);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatEmojiViewBGGradient), 0);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatEmojiViewBGGradientColor), -657673);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatEmojiViewTabIconColor), -5723992);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatEmojiViewTabColor), -16744077);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatQuickBarColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatQuickBarNamesColor), -14606047);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_drawerOptionColor), -12303292);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_drawerIconColor), -9211021);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_drawerPhoneColor), -12527928);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_drawerNameColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_prefActionbarColor), -16738680);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_prefActionbarTitleColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_prefActionbarStatusColor), -12527928);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_prefAvatarColor), -16744077);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_prefBGColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_prefSectionColor), Integer.valueOf(defColor));
        defaultPlusColors.put(ThemeColors.getStringName(pkey_profileActionbarIconsColor), -1);
        HashMap<String, Integer> hashMap = defaultPlusColors;
        int i911 = pkey_chatsHeaderColor;
        hashMap.put(ThemeColors.getStringName(i911), -16738680);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsHeaderTabIconColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsHeaderTabUnselectedIconColor), -1);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsHeaderActionModeIconsColor), -9999761);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsHeaderTabActionModeColor), -7893872);
        defaultPlusColors.put(ThemeColors.getStringName(pkey_chatsHeaderTabActionModeSelectedColor), -16738680);
        HashMap<String, Integer> hashMap2 = defaultPlusColors;
        String stringName = ThemeColors.getStringName(pkey_profileCreatorStarColor);
        int i912 = profileRowColor;
        int i913 = defColor;
        if (i912 == i913) {
            i913 = darkColor;
        }
        hashMap2.put(stringName, Integer.valueOf(i913));
        defaultPlusColors.put(ThemeColors.getStringName(pkey_profileAdminStarColor), Integer.valueOf(profileRowColor == -8026747 ? -4473925 : -8026747));
        defaultPlusColors.put(ThemeColors.getStringName(pkey_drawerListColor), -1);
        currentPlusColors = new HashMap<>();
        telegramToPlusInt.put(Integer.valueOf(key_actionBarDefault), Integer.valueOf(i911));
        telegramToPlusInt.put(Integer.valueOf(key_actionBarDefaultTitle), Integer.valueOf(pkey_chatsHeaderTitleColor));
        HashMap<Integer, Integer> hashMap3 = telegramToPlusInt;
        Integer valueOf = Integer.valueOf(key_windowBackgroundWhiteBlueHeader);
        int i914 = pkey_themeColor;
        hashMap3.put(valueOf, Integer.valueOf(i914));
        telegramToPlusInt.put(Integer.valueOf(key_dialogTopBackground), Integer.valueOf(i914));
        telegramToPlusInt.put(Integer.valueOf(key_actionBarDefaultIcon), Integer.valueOf(pkey_chatsHeaderIconsColor));
        HashMap<Integer, Integer> hashMap4 = telegramToPlusInt;
        Integer valueOf2 = Integer.valueOf(key_chat_messageTextOut);
        int i915 = pkey_chatRTextColor;
        hashMap4.put(valueOf2, Integer.valueOf(i915));
        telegramToPlusInt.put(Integer.valueOf(key_chat_outFileNameText), Integer.valueOf(i915));
        telegramToPlusInt.put(Integer.valueOf(key_chat_outFileInfoText), Integer.valueOf(i915));
        HashMap<Integer, Integer> hashMap5 = telegramToPlusInt;
        Integer valueOf3 = Integer.valueOf(key_chat_inFileNameText);
        int i916 = pkey_chatLTextColor;
        hashMap5.put(valueOf3, Integer.valueOf(i916));
        telegramToPlusInt.put(Integer.valueOf(key_chat_inFileInfoText), Integer.valueOf(i916));
        HashMap<Integer, Integer> hashMap6 = telegramToPlusInt;
        Integer valueOf4 = Integer.valueOf(key_chat_outMenu);
        int i917 = pkey_chatRTimeColor;
        hashMap6.put(valueOf4, Integer.valueOf(i917));
        HashMap<Integer, Integer> hashMap7 = telegramToPlusInt;
        Integer valueOf5 = Integer.valueOf(key_chat_inMenu);
        int i918 = pkey_chatLTimeColor;
        hashMap7.put(valueOf5, Integer.valueOf(i918));
        HashMap<Integer, Integer> hashMap8 = telegramToPlusInt;
        Integer valueOf6 = Integer.valueOf(key_chat_outSentCheck);
        int i919 = pkey_chatChecksColor;
        hashMap8.put(valueOf6, Integer.valueOf(i919));
        telegramToPlusInt.put(Integer.valueOf(key_chat_outSentCheckSelected), Integer.valueOf(i919));
        telegramToPlusInt.put(Integer.valueOf(key_chat_outSentCheckRead), Integer.valueOf(i919));
        telegramToPlusInt.put(Integer.valueOf(key_chat_outSentCheckReadSelected), Integer.valueOf(i919));
        telegramToPlusInt.put(Integer.valueOf(key_chat_outSentClock), Integer.valueOf(i919));
        telegramToPlusInt.put(Integer.valueOf(key_chat_outSentClockSelected), Integer.valueOf(i919));
        telegramToPlusInt.put(Integer.valueOf(key_chat_mediaSentCheck), Integer.valueOf(i919));
        telegramToPlusInt.put(Integer.valueOf(key_chat_messageLinkOut), Integer.valueOf(pkey_chatRLinkColor));
        telegramToPlusInt.put(Integer.valueOf(key_chat_messageTextIn), Integer.valueOf(i916));
        telegramToPlusInt.put(Integer.valueOf(key_chat_messageLinkIn), Integer.valueOf(pkey_chatLLinkColor));
        telegramToPlusInt.put(Integer.valueOf(key_chat_outTimeText), Integer.valueOf(i917));
        telegramToPlusInt.put(Integer.valueOf(key_chat_inTimeText), Integer.valueOf(i918));
        HashMap<Integer, Integer> hashMap9 = telegramToPlusInt;
        Integer valueOf7 = Integer.valueOf(key_chat_outForwardedNameText);
        int i920 = pkey_chatForwardRColor;
        hashMap9.put(valueOf7, Integer.valueOf(i920));
        HashMap<Integer, Integer> hashMap10 = telegramToPlusInt;
        Integer valueOf8 = Integer.valueOf(key_chat_inForwardedNameText);
        int i921 = pkey_chatForwardLColor;
        hashMap10.put(valueOf8, Integer.valueOf(i921));
        telegramToPlusInt.put(Integer.valueOf(key_chat_outReplyLine), Integer.valueOf(i920));
        telegramToPlusInt.put(Integer.valueOf(key_chat_outReplyNameText), Integer.valueOf(i920));
        telegramToPlusInt.put(Integer.valueOf(key_chat_outReplyMediaMessageText), Integer.valueOf(i920));
        telegramToPlusInt.put(Integer.valueOf(key_chat_outReplyMessageText), Integer.valueOf(i915));
        telegramToPlusInt.put(Integer.valueOf(key_chat_inReplyLine), Integer.valueOf(i921));
        telegramToPlusInt.put(Integer.valueOf(key_chat_inReplyNameText), Integer.valueOf(i921));
        telegramToPlusInt.put(Integer.valueOf(key_chat_inReplyMediaMessageText), Integer.valueOf(i921));
        telegramToPlusInt.put(Integer.valueOf(key_chat_inReplyMessageText), Integer.valueOf(i916));
        HashMap<Integer, Integer> hashMap11 = telegramToPlusInt;
        Integer valueOf9 = Integer.valueOf(key_chat_inBubble);
        int i922 = pkey_chatLBubbleColor;
        hashMap11.put(valueOf9, Integer.valueOf(i922));
        telegramToPlusInt.put(Integer.valueOf(key_chat_inBubbleSelected), Integer.valueOf(pkey_chatLBubbleColorSelected));
        telegramToPlusInt.put(Integer.valueOf(key_chat_inBubbleShadow), Integer.valueOf(i922));
        HashMap<Integer, Integer> hashMap12 = telegramToPlusInt;
        Integer valueOf10 = Integer.valueOf(key_chat_outBubble);
        int i923 = pkey_chatRBubbleColor;
        hashMap12.put(valueOf10, Integer.valueOf(i923));
        telegramToPlusInt.put(Integer.valueOf(key_chat_outBubbleSelected), Integer.valueOf(pkey_chatRBubbleColorSelected));
        telegramToPlusInt.put(Integer.valueOf(key_chat_outBubbleShadow), Integer.valueOf(i923));
        telegramToPlusInt.put(Integer.valueOf(key_chat_serviceText), Integer.valueOf(pkey_chatDateColor));
        telegramToPlusInt.put(Integer.valueOf(key_chat_messagePanelVoiceBackground), Integer.valueOf(pkey_themeColor));
        HashMap<Integer, Integer> hashMap13 = telegramToPlusInt;
        Integer valueOf11 = Integer.valueOf(key_chat_emojiPanelNewTrending);
        int i924 = pkey_chatEditTextIconsColor;
        hashMap13.put(valueOf11, Integer.valueOf(i924));
        telegramToPlusInt.put(Integer.valueOf(key_chat_messagePanelIcons), Integer.valueOf(i924));
        telegramToPlusInt.put(Integer.valueOf(key_chat_messagePanelVoiceDelete), Integer.valueOf(i924));
        telegramToPlusInt.put(Integer.valueOf(key_chat_messagePanelSend), Integer.valueOf(pkey_chatSendIconColor));
        HashMap<Integer, Integer> hashMap14 = telegramToPlusInt;
        Integer valueOf12 = Integer.valueOf(key_inappPlayerBackground);
        int i925 = pkey_chatHeaderColor;
        hashMap14.put(valueOf12, Integer.valueOf(i925));
        telegramToPlusInt.put(Integer.valueOf(key_chat_messagePanelBackground), Integer.valueOf(pkey_chatEditTextBGColor));
        telegramToPlusInt.put(Integer.valueOf(key_chat_topPanelBackground), Integer.valueOf(i925));
        HashMap<Integer, Integer> hashMap15 = telegramToPlusInt;
        Integer valueOf13 = Integer.valueOf(key_chat_topPanelLine);
        int i926 = pkey_chatNameColor;
        hashMap15.put(valueOf13, Integer.valueOf(i926));
        telegramToPlusInt.put(Integer.valueOf(key_chat_topPanelTitle), Integer.valueOf(i926));
        HashMap<Integer, Integer> hashMap16 = telegramToPlusInt;
        Integer valueOf14 = Integer.valueOf(key_chat_topPanelMessage);
        int i927 = pkey_chatStatusColor;
        hashMap16.put(valueOf14, Integer.valueOf(i927));
        telegramToPlusInt.put(Integer.valueOf(key_chat_topPanelClose), Integer.valueOf(i927));
        telegramToPlusInt.put(Integer.valueOf(key_chat_goDownButtonIcon), Integer.valueOf(i924));
        HashMap<Integer, Integer> hashMap17 = telegramToPlusInt;
        Integer valueOf15 = Integer.valueOf(key_windowBackgroundWhiteBlueText);
        int i928 = pkey_prefSectionColor;
        hashMap17.put(valueOf15, Integer.valueOf(i928));
        telegramToPlusInt.put(Integer.valueOf(key_windowBackgroundWhiteBlueText4), Integer.valueOf(i928));
        telegramToPlusInt.put(Integer.valueOf(key_windowBackgroundWhiteBlueButton), Integer.valueOf(i928));
        telegramToPlusInt.put(Integer.valueOf(key_windowBackgroundWhiteBlueIcon), Integer.valueOf(i928));
        telegramToPlusInt.put(Integer.valueOf(key_chat_goDownButtonCounterBackground), Integer.valueOf(i925));
        HashMap<Integer, Integer> hashMap18 = telegramToPlusInt;
        Integer valueOf16 = Integer.valueOf(key_chats_sentCheck);
        int i929 = pkey_chatsChecksColor;
        hashMap18.put(valueOf16, Integer.valueOf(i929));
        telegramToPlusInt.put(Integer.valueOf(key_chats_sentReadCheck), Integer.valueOf(i929));
        telegramToPlusInt.put(Integer.valueOf(key_chats_sentClock), Integer.valueOf(i929));
        HashMap<Integer, Integer> hashMap19 = telegramToPlusInt;
        Integer valueOf17 = Integer.valueOf(key_chats_name);
        int i930 = pkey_chatsNameColor;
        hashMap19.put(valueOf17, Integer.valueOf(i930));
        telegramToPlusInt.put(Integer.valueOf(key_chats_secretName), Integer.valueOf(i930));
        telegramToPlusInt.put(Integer.valueOf(key_chats_actionBackground), Integer.valueOf(pkey_chatsFloatingBGColor));
        telegramToPlusInt.put(Integer.valueOf(key_chats_attachMessage), Integer.valueOf(pkey_chatsMessageColor));
        telegramToPlusInt.put(Integer.valueOf(key_chats_nameMessage), Integer.valueOf(pkey_chatsMemberColor));
        telegramToPlusInt.put(Integer.valueOf(key_chats_unreadCounterText), Integer.valueOf(pkey_chatsCountColor));
        telegramToPlusInt.put(Integer.valueOf(key_avatar_backgroundActionBarBlue), Integer.valueOf(pkey_prefActionbarColor));
        telegramToPlusInt.put(Integer.valueOf(key_profile_title), Integer.valueOf(pkey_prefActionbarTitleColor));
        telegramToPlusInt.put(Integer.valueOf(key_avatar_subtitleInProfileBlue), Integer.valueOf(pkey_prefActionbarStatusColor));
        telegramToPlusInt.put(Integer.valueOf(key_avatar_backgroundInProfileBlue), Integer.valueOf(pkey_prefAvatarColor));
        telegramToPlusInt.put(Integer.valueOf(key_windowBackgroundWhite), Integer.valueOf(pkey_prefBGColor));
        telegramToPlusInt.put(Integer.valueOf(key_chats_menuItemText), Integer.valueOf(pkey_drawerOptionColor));
        telegramToPlusInt.put(Integer.valueOf(key_chats_menuItemIcon), Integer.valueOf(pkey_drawerIconColor));
        telegramToPlusInt.put(Integer.valueOf(key_chats_menuPhone), Integer.valueOf(pkey_drawerPhoneColor));
        HashMap<Integer, Integer> hashMap20 = telegramToPlusInt;
        Integer valueOf18 = Integer.valueOf(key_switchTrackChecked);
        int i931 = pkey_themeColor;
        hashMap20.put(valueOf18, Integer.valueOf(i931));
        telegramToPlusInt.put(Integer.valueOf(key_switch2TrackChecked), Integer.valueOf(i931));
        HashMap<Integer, Integer> hashMap21 = telegramToPlusInt;
        Integer valueOf19 = Integer.valueOf(key_musicPicker_checkbox);
        int i932 = pkey_themeLightColor;
        hashMap21.put(valueOf19, Integer.valueOf(i932));
        telegramToPlusInt.put(Integer.valueOf(key_picker_badge), Integer.valueOf(i932));
        telegramToPlusInt.put(Integer.valueOf(key_picker_enabledButton), Integer.valueOf(i932));
        telegramToPlusInt.put(Integer.valueOf(key_musicPicker_buttonBackground), Integer.valueOf(i932));
        telegramToPlusInt.put(Integer.valueOf(key_player_progress), Integer.valueOf(i931));
        telegramToPlusInt.put(Integer.valueOf(key_player_progressBackground), Integer.valueOf(i932));
        telegramToPlusInt.put(Integer.valueOf(key_player_progressCachedBackground), Integer.valueOf(i932));
        HashMap<Integer, Integer> hashMap22 = telegramToPlusInt;
        Integer valueOf20 = Integer.valueOf(key_actionBarTabActiveText);
        int i933 = pkey_chatsHeaderTabIconColor;
        hashMap22.put(valueOf20, Integer.valueOf(i933));
        telegramToPlusInt.put(Integer.valueOf(key_actionBarTabUnactiveText), Integer.valueOf(pkey_chatsHeaderTabUnselectedIconColor));
        telegramToPlusInt.put(Integer.valueOf(key_actionBarTabLine), Integer.valueOf(i933));
        HashMap<Integer, Integer> hashMap23 = telegramToPlusInt;
        Integer valueOf21 = Integer.valueOf(key_profile_tabSelectedText);
        int i934 = pkey_chatsHeaderTabActionModeSelectedColor;
        hashMap23.put(valueOf21, Integer.valueOf(i934));
        telegramToPlusInt.put(Integer.valueOf(key_profile_tabSelectedLine), Integer.valueOf(i934));
        telegramToPlusInt.put(Integer.valueOf(key_profile_tabText), Integer.valueOf(pkey_chatsHeaderTabActionModeColor));
        telegramToPlusInt.put(Integer.valueOf(key_actionBarActionModeDefaultIcon), Integer.valueOf(pkey_chatsHeaderActionModeIconsColor));
        telegramToPlusInt.put(Integer.valueOf(key_chat_addContact), Integer.valueOf(pkey_chatNameColor));
        telegramToPlusInt.put(Integer.valueOf(key_featuredStickers_addButton), Integer.valueOf(pkey_profileCreatorStarColor));
        telegramToPlusInt.put(Integer.valueOf(key_chat_fieldOverlayText), Integer.valueOf(i931));
        HashMap<Integer, Integer> hashMap24 = telegramToPlusInt;
        Integer valueOf22 = Integer.valueOf(key_chat_inInstant);
        int i935 = pkey_chatLLinkColor;
        hashMap24.put(valueOf22, Integer.valueOf(i935));
        telegramToPlusInt.put(Integer.valueOf(key_checkbox), Integer.valueOf(i931));
        telegramToPlusInt.put(Integer.valueOf(key_chats_menuBackground), Integer.valueOf(pkey_drawerListColor));
        telegramToPlus.put(ThemeColors.getStringName(key_actionBarDefault), ThemeColors.getStringName(pkey_chatsHeaderColor));
        telegramToPlus.put(ThemeColors.getStringName(key_actionBarDefaultTitle), ThemeColors.getStringName(pkey_chatsHeaderTitleColor));
        telegramToPlus.put(ThemeColors.getStringName(key_windowBackgroundWhiteBlueHeader), ThemeColors.getStringName(i931));
        telegramToPlus.put(ThemeColors.getStringName(key_dialogTopBackground), ThemeColors.getStringName(i931));
        telegramToPlus.put(ThemeColors.getStringName(key_actionBarDefaultIcon), ThemeColors.getStringName(pkey_chatsHeaderIconsColor));
        HashMap<String, String> hashMap25 = telegramToPlus;
        String stringName2 = ThemeColors.getStringName(key_chat_messageTextOut);
        int i936 = pkey_chatRTextColor;
        hashMap25.put(stringName2, ThemeColors.getStringName(i936));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_outFileNameText), ThemeColors.getStringName(i936));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_outFileInfoText), ThemeColors.getStringName(i936));
        HashMap<String, String> hashMap26 = telegramToPlus;
        String stringName3 = ThemeColors.getStringName(key_chat_inFileNameText);
        int i937 = pkey_chatLTextColor;
        hashMap26.put(stringName3, ThemeColors.getStringName(i937));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_inFileInfoText), ThemeColors.getStringName(i937));
        HashMap<String, String> hashMap27 = telegramToPlus;
        String stringName4 = ThemeColors.getStringName(key_chat_outMenu);
        int i938 = pkey_chatRTimeColor;
        hashMap27.put(stringName4, ThemeColors.getStringName(i938));
        HashMap<String, String> hashMap28 = telegramToPlus;
        String stringName5 = ThemeColors.getStringName(key_chat_inMenu);
        int i939 = pkey_chatLTimeColor;
        hashMap28.put(stringName5, ThemeColors.getStringName(i939));
        HashMap<String, String> hashMap29 = telegramToPlus;
        String stringName6 = ThemeColors.getStringName(key_chat_outSentCheck);
        int i940 = pkey_chatChecksColor;
        hashMap29.put(stringName6, ThemeColors.getStringName(i940));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_outSentCheckSelected), ThemeColors.getStringName(i940));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_outSentCheckRead), ThemeColors.getStringName(i940));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_outSentCheckReadSelected), ThemeColors.getStringName(i940));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_outSentClock), ThemeColors.getStringName(i940));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_outSentClockSelected), ThemeColors.getStringName(i940));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_mediaSentCheck), ThemeColors.getStringName(i940));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_messageLinkOut), ThemeColors.getStringName(pkey_chatRLinkColor));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_messageTextIn), ThemeColors.getStringName(i937));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_messageLinkIn), ThemeColors.getStringName(i935));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_outTimeText), ThemeColors.getStringName(i938));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_inTimeText), ThemeColors.getStringName(i939));
        HashMap<String, String> hashMap30 = telegramToPlus;
        String stringName7 = ThemeColors.getStringName(key_chat_outForwardedNameText);
        int i941 = pkey_chatForwardRColor;
        hashMap30.put(stringName7, ThemeColors.getStringName(i941));
        HashMap<String, String> hashMap31 = telegramToPlus;
        String stringName8 = ThemeColors.getStringName(key_chat_inForwardedNameText);
        int i942 = pkey_chatForwardLColor;
        hashMap31.put(stringName8, ThemeColors.getStringName(i942));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_outReplyLine), ThemeColors.getStringName(i941));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_outReplyNameText), ThemeColors.getStringName(i941));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_outReplyMediaMessageText), ThemeColors.getStringName(i941));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_outReplyMessageText), ThemeColors.getStringName(i936));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_inReplyLine), ThemeColors.getStringName(i942));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_inReplyNameText), ThemeColors.getStringName(i942));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_inReplyMediaMessageText), ThemeColors.getStringName(i942));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_inReplyMessageText), ThemeColors.getStringName(i937));
        HashMap<String, String> hashMap32 = telegramToPlus;
        String stringName9 = ThemeColors.getStringName(key_chat_inBubble);
        int i943 = pkey_chatLBubbleColor;
        hashMap32.put(stringName9, ThemeColors.getStringName(i943));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_inBubbleSelected), ThemeColors.getStringName(pkey_chatLBubbleColorSelected));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_inBubbleShadow), ThemeColors.getStringName(i943));
        HashMap<String, String> hashMap33 = telegramToPlus;
        String stringName10 = ThemeColors.getStringName(key_chat_outBubble);
        int i944 = pkey_chatRBubbleColor;
        hashMap33.put(stringName10, ThemeColors.getStringName(i944));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_outBubbleSelected), ThemeColors.getStringName(pkey_chatRBubbleColorSelected));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_outBubbleShadow), ThemeColors.getStringName(i944));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_serviceText), ThemeColors.getStringName(pkey_chatDateColor));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_messagePanelVoiceBackground), ThemeColors.getStringName(pkey_themeColor));
        HashMap<String, String> hashMap34 = telegramToPlus;
        String stringName11 = ThemeColors.getStringName(key_chat_emojiPanelNewTrending);
        int i945 = pkey_chatEditTextIconsColor;
        hashMap34.put(stringName11, ThemeColors.getStringName(i945));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_messagePanelIcons), ThemeColors.getStringName(i945));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_messagePanelVoiceDelete), ThemeColors.getStringName(i945));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_messagePanelSend), ThemeColors.getStringName(pkey_chatSendIconColor));
        HashMap<String, String> hashMap35 = telegramToPlus;
        String stringName12 = ThemeColors.getStringName(key_inappPlayerBackground);
        int i946 = pkey_chatHeaderColor;
        hashMap35.put(stringName12, ThemeColors.getStringName(i946));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_messagePanelBackground), ThemeColors.getStringName(pkey_chatEditTextBGColor));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_topPanelBackground), ThemeColors.getStringName(i946));
        HashMap<String, String> hashMap36 = telegramToPlus;
        String stringName13 = ThemeColors.getStringName(key_chat_topPanelLine);
        int i947 = pkey_chatNameColor;
        hashMap36.put(stringName13, ThemeColors.getStringName(i947));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_topPanelTitle), ThemeColors.getStringName(i947));
        HashMap<String, String> hashMap37 = telegramToPlus;
        String stringName14 = ThemeColors.getStringName(key_chat_topPanelMessage);
        int i948 = pkey_chatStatusColor;
        hashMap37.put(stringName14, ThemeColors.getStringName(i948));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_topPanelClose), ThemeColors.getStringName(i948));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_goDownButtonIcon), ThemeColors.getStringName(i945));
        HashMap<String, String> hashMap38 = telegramToPlus;
        String stringName15 = ThemeColors.getStringName(key_windowBackgroundWhiteBlueText);
        int i949 = pkey_prefSectionColor;
        hashMap38.put(stringName15, ThemeColors.getStringName(i949));
        telegramToPlus.put(ThemeColors.getStringName(key_windowBackgroundWhiteBlueText4), ThemeColors.getStringName(i949));
        telegramToPlus.put(ThemeColors.getStringName(key_windowBackgroundWhiteBlueButton), ThemeColors.getStringName(i949));
        telegramToPlus.put(ThemeColors.getStringName(key_windowBackgroundWhiteBlueIcon), ThemeColors.getStringName(i949));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_goDownButtonCounterBackground), ThemeColors.getStringName(i946));
        HashMap<String, String> hashMap39 = telegramToPlus;
        String stringName16 = ThemeColors.getStringName(key_chats_sentCheck);
        int i950 = pkey_chatsChecksColor;
        hashMap39.put(stringName16, ThemeColors.getStringName(i950));
        telegramToPlus.put(ThemeColors.getStringName(key_chats_sentReadCheck), ThemeColors.getStringName(i950));
        telegramToPlus.put(ThemeColors.getStringName(key_chats_sentClock), ThemeColors.getStringName(i950));
        HashMap<String, String> hashMap40 = telegramToPlus;
        String stringName17 = ThemeColors.getStringName(key_chats_name);
        int i951 = pkey_chatsNameColor;
        hashMap40.put(stringName17, ThemeColors.getStringName(i951));
        telegramToPlus.put(ThemeColors.getStringName(key_chats_secretName), ThemeColors.getStringName(i951));
        telegramToPlus.put(ThemeColors.getStringName(key_chats_actionBackground), ThemeColors.getStringName(pkey_chatsFloatingBGColor));
        telegramToPlus.put(ThemeColors.getStringName(key_chats_attachMessage), ThemeColors.getStringName(pkey_chatsMessageColor));
        telegramToPlus.put(ThemeColors.getStringName(key_chats_nameMessage), ThemeColors.getStringName(pkey_chatsMemberColor));
        telegramToPlus.put(ThemeColors.getStringName(key_chats_unreadCounterText), ThemeColors.getStringName(pkey_chatsCountColor));
        telegramToPlus.put(ThemeColors.getStringName(key_avatar_backgroundActionBarBlue), ThemeColors.getStringName(pkey_prefActionbarColor));
        telegramToPlus.put(ThemeColors.getStringName(key_profile_title), ThemeColors.getStringName(pkey_prefActionbarTitleColor));
        telegramToPlus.put(ThemeColors.getStringName(key_avatar_subtitleInProfileBlue), ThemeColors.getStringName(pkey_prefActionbarStatusColor));
        telegramToPlus.put(ThemeColors.getStringName(key_avatar_backgroundInProfileBlue), ThemeColors.getStringName(pkey_prefAvatarColor));
        telegramToPlus.put(ThemeColors.getStringName(key_windowBackgroundWhite), ThemeColors.getStringName(pkey_prefBGColor));
        telegramToPlus.put(ThemeColors.getStringName(key_chats_menuItemText), ThemeColors.getStringName(pkey_drawerOptionColor));
        telegramToPlus.put(ThemeColors.getStringName(key_chats_menuItemIcon), ThemeColors.getStringName(pkey_drawerIconColor));
        telegramToPlus.put(ThemeColors.getStringName(key_chats_menuPhone), ThemeColors.getStringName(pkey_drawerPhoneColor));
        HashMap<String, String> hashMap41 = telegramToPlus;
        String stringName18 = ThemeColors.getStringName(key_switchTrackChecked);
        int i952 = pkey_themeColor;
        hashMap41.put(stringName18, ThemeColors.getStringName(i952));
        telegramToPlus.put(ThemeColors.getStringName(key_switch2TrackChecked), ThemeColors.getStringName(i952));
        HashMap<String, String> hashMap42 = telegramToPlus;
        String stringName19 = ThemeColors.getStringName(key_musicPicker_checkbox);
        int i953 = pkey_themeLightColor;
        hashMap42.put(stringName19, ThemeColors.getStringName(i953));
        telegramToPlus.put(ThemeColors.getStringName(key_picker_badge), ThemeColors.getStringName(i953));
        telegramToPlus.put(ThemeColors.getStringName(key_picker_enabledButton), ThemeColors.getStringName(i953));
        telegramToPlus.put(ThemeColors.getStringName(key_musicPicker_buttonBackground), ThemeColors.getStringName(i953));
        telegramToPlus.put(ThemeColors.getStringName(key_player_progress), ThemeColors.getStringName(i952));
        HashMap<String, String> hashMap43 = telegramToPlus;
        int i954 = key_player_progressBackground;
        hashMap43.put(ThemeColors.getStringName(i954), ThemeColors.getStringName(i953));
        HashMap<String, String> hashMap44 = telegramToPlus;
        int i955 = key_player_progressCachedBackground;
        hashMap44.put(ThemeColors.getStringName(i955), ThemeColors.getStringName(i953));
        HashMap<String, String> hashMap45 = telegramToPlus;
        String stringName20 = ThemeColors.getStringName(key_actionBarTabActiveText);
        int i956 = pkey_chatsHeaderTabIconColor;
        hashMap45.put(stringName20, ThemeColors.getStringName(i956));
        telegramToPlus.put(ThemeColors.getStringName(key_actionBarTabUnactiveText), ThemeColors.getStringName(pkey_chatsHeaderTabUnselectedIconColor));
        telegramToPlus.put(ThemeColors.getStringName(key_actionBarTabLine), ThemeColors.getStringName(i956));
        HashMap<String, String> hashMap46 = telegramToPlus;
        String stringName21 = ThemeColors.getStringName(key_profile_tabSelectedText);
        int i957 = pkey_chatsHeaderTabActionModeSelectedColor;
        hashMap46.put(stringName21, ThemeColors.getStringName(i957));
        telegramToPlus.put(ThemeColors.getStringName(key_profile_tabSelectedLine), ThemeColors.getStringName(i957));
        telegramToPlus.put(ThemeColors.getStringName(key_profile_tabText), ThemeColors.getStringName(pkey_chatsHeaderTabActionModeColor));
        telegramToPlus.put(ThemeColors.getStringName(key_actionBarActionModeDefaultIcon), ThemeColors.getStringName(pkey_chatsHeaderActionModeIconsColor));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_addContact), ThemeColors.getStringName(pkey_chatNameColor));
        HashMap<String, String> hashMap47 = telegramToPlus;
        int i958 = key_featuredStickers_addButton;
        hashMap47.put(ThemeColors.getStringName(i958), ThemeColors.getStringName(pkey_profileCreatorStarColor));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_fieldOverlayText), ThemeColors.getStringName(i952));
        telegramToPlus.put(ThemeColors.getStringName(key_chat_inInstant), ThemeColors.getStringName(pkey_chatLLinkColor));
        telegramToPlus.put(ThemeColors.getStringName(key_checkbox), ThemeColors.getStringName(i952));
        telegramToPlus.put(ThemeColors.getStringName(key_chats_menuBackground), ThemeColors.getStringName(pkey_drawerListColor));
        defaultColors = ThemeColors.createDefaultColors();
        fallbackKeys.put(key_chat_inQuote, key_featuredStickers_addButtonPressed);
        SparseIntArray sparseIntArray = fallbackKeys;
        int i959 = key_chat_outQuote;
        int i960 = key_chat_outReplyLine;
        sparseIntArray.put(i959, i960);
        fallbackKeys.put(key_chat_outReplyLine2, i960);
        fallbackKeys.put(key_chat_inAdminText, key_chat_inTimeText);
        fallbackKeys.put(key_chat_inAdminSelectedText, key_chat_inTimeSelectedText);
        fallbackKeys.put(i955, i954);
        fallbackKeys.put(key_chat_inAudioCacheSeekbar, key_chat_inAudioSeekbar);
        fallbackKeys.put(key_chat_outAudioCacheSeekbar, key_chat_outAudioSeekbar);
        fallbackKeys.put(key_chat_emojiSearchBackground, key_chat_emojiPanelStickerPackSelector);
        fallbackKeys.put(key_location_sendLiveLocationIcon, key_location_sendLocationIcon);
        fallbackKeys.put(key_changephoneinfo_image2, i958);
        fallbackKeys.put(key_graySectionText, key_windowBackgroundWhiteGrayText2);
        fallbackKeys.put(key_chat_inMediaIcon, key_chat_inBubble);
        fallbackKeys.put(key_chat_outMediaIcon, key_chat_outBubble);
        fallbackKeys.put(key_chat_inMediaIconSelected, key_chat_inBubbleSelected);
        fallbackKeys.put(key_chat_outMediaIconSelected, key_chat_outBubbleSelected);
        SparseIntArray sparseIntArray2 = fallbackKeys;
        int i961 = key_dialog_inlineProgressBackground;
        int i962 = key_windowBackgroundGray;
        sparseIntArray2.put(i961, i962);
        fallbackKeys.put(key_dialog_inlineProgress, key_chats_menuItemIcon);
        fallbackKeys.put(key_groupcreate_spanDelete, key_chats_actionIcon);
        fallbackKeys.put(key_sharedMedia_photoPlaceholder, i962);
        fallbackKeys.put(key_chat_attachPollBackground, key_chat_attachAudioBackground);
        fallbackKeys.put(key_chats_onlineCircle, key_windowBackgroundWhiteBlueText);
        SparseIntArray sparseIntArray3 = fallbackKeys;
        int i963 = key_windowBackgroundWhiteBlueButton;
        int i964 = key_windowBackgroundWhiteValueText;
        sparseIntArray3.put(i963, i964);
        fallbackKeys.put(key_windowBackgroundWhiteBlueIcon, i964);
        fallbackKeys.put(key_undo_background, key_chat_gifSaveHintBackground);
        SparseIntArray sparseIntArray4 = fallbackKeys;
        int i965 = key_undo_cancelColor;
        int i966 = key_chat_gifSaveHintText;
        sparseIntArray4.put(i965, i966);
        fallbackKeys.put(key_undo_infoColor, i966);
        SparseIntArray sparseIntArray5 = fallbackKeys;
        int i967 = key_windowBackgroundUnchecked;
        int i968 = key_windowBackgroundWhite;
        sparseIntArray5.put(i967, i968);
        fallbackKeys.put(key_windowBackgroundChecked, i968);
        fallbackKeys.put(key_switchTrackBlue, key_switchTrack);
        fallbackKeys.put(key_switchTrackBlueChecked, key_switchTrackChecked);
        fallbackKeys.put(key_switchTrackBlueThumb, i968);
        fallbackKeys.put(key_switchTrackBlueThumbChecked, i968);
        fallbackKeys.put(key_windowBackgroundCheckText, i968);
        fallbackKeys.put(key_contextProgressInner4, key_contextProgressInner1);
        fallbackKeys.put(key_contextProgressOuter4, key_contextProgressOuter1);
        SparseIntArray sparseIntArray6 = fallbackKeys;
        int i969 = key_switchTrackBlueSelector;
        int i970 = key_listSelector;
        sparseIntArray6.put(i969, i970);
        fallbackKeys.put(key_switchTrackBlueSelectorChecked, i970);
        SparseIntArray sparseIntArray7 = fallbackKeys;
        int i971 = key_chat_emojiBottomPanelIcon;
        int i972 = key_chat_emojiPanelIcon;
        sparseIntArray7.put(i971, i972);
        fallbackKeys.put(key_chat_emojiSearchIcon, i972);
        fallbackKeys.put(key_chat_emojiPanelStickerSetNameHighlight, key_windowBackgroundWhiteBlueText4);
        fallbackKeys.put(key_chat_emojiPanelStickerPackSelectorLine, key_chat_emojiPanelIconSelected);
        SparseIntArray sparseIntArray8 = fallbackKeys;
        int i973 = key_sheet_scrollUp;
        int i974 = key_chat_emojiPanelStickerPackSelector;
        sparseIntArray8.put(i973, i974);
        fallbackKeys.put(key_sheet_other, key_player_actionBarItems);
        fallbackKeys.put(key_dialogSearchBackground, i974);
        fallbackKeys.put(key_dialogSearchHint, i972);
        fallbackKeys.put(key_dialogSearchIcon, i972);
        fallbackKeys.put(key_dialogSearchText, key_windowBackgroundWhiteBlackText);
        SparseIntArray sparseIntArray9 = fallbackKeys;
        int i975 = key_dialogFloatingButton;
        int i976 = key_dialogRoundCheckBox;
        sparseIntArray9.put(i975, i976);
        fallbackKeys.put(key_dialogFloatingButtonPressed, i976);
        fallbackKeys.put(key_dialogFloatingIcon, key_dialogRoundCheckBoxCheck);
        fallbackKeys.put(key_dialogShadowLine, key_chat_emojiPanelShadowLine);
        fallbackKeys.put(key_actionBarDefaultArchived, key_actionBarDefault);
        SparseIntArray sparseIntArray10 = fallbackKeys;
        int i977 = key_actionBarDefaultArchivedSelector;
        int i978 = key_actionBarDefaultSelector;
        sparseIntArray10.put(i977, i978);
        fallbackKeys.put(key_actionBarDefaultArchivedIcon, key_actionBarDefaultIcon);
        SparseIntArray sparseIntArray11 = fallbackKeys;
        int i979 = key_actionBarDefaultArchivedTitle;
        int i980 = key_actionBarDefaultTitle;
        sparseIntArray11.put(i979, i980);
        fallbackKeys.put(key_actionBarDefaultArchivedSearch, key_actionBarDefaultSearch);
        fallbackKeys.put(key_actionBarDefaultArchivedSearchPlaceholder, key_actionBarDefaultSearchPlaceholder);
        SparseIntArray sparseIntArray12 = fallbackKeys;
        int i981 = key_chats_message_threeLines;
        int i982 = key_chats_message;
        sparseIntArray12.put(i981, i982);
        SparseIntArray sparseIntArray13 = fallbackKeys;
        int i983 = key_chats_nameMessage_threeLines;
        int i984 = key_chats_nameMessage;
        sparseIntArray13.put(i983, i984);
        fallbackKeys.put(key_chats_nameArchived, key_chats_name);
        fallbackKeys.put(key_chats_nameMessageArchived, i984);
        fallbackKeys.put(key_chats_nameMessageArchived_threeLines, i984);
        fallbackKeys.put(key_chats_messageArchived, i982);
        SparseIntArray sparseIntArray14 = fallbackKeys;
        int i985 = key_avatar_backgroundArchived;
        int i986 = key_chats_unreadCounterMuted;
        sparseIntArray14.put(i985, i986);
        SparseIntArray sparseIntArray15 = fallbackKeys;
        int i987 = key_chats_archiveBackground;
        int i988 = key_chats_actionBackground;
        sparseIntArray15.put(i987, i988);
        fallbackKeys.put(key_chats_archivePinBackground, i986);
        SparseIntArray sparseIntArray16 = fallbackKeys;
        int i989 = key_chats_archiveIcon;
        int i990 = key_chats_actionIcon;
        sparseIntArray16.put(i989, i990);
        fallbackKeys.put(key_chats_archiveText, i990);
        fallbackKeys.put(key_actionBarDefaultSubmenuItemIcon, key_dialogIcon);
        fallbackKeys.put(key_checkboxDisabled, i986);
        SparseIntArray sparseIntArray17 = fallbackKeys;
        int i991 = key_chat_status;
        int i992 = key_actionBarDefaultSubtitle;
        sparseIntArray17.put(i991, i992);
        SparseIntArray sparseIntArray18 = fallbackKeys;
        int i993 = key_chat_inGreenCall;
        int i994 = key_calls_callReceivedGreenIcon;
        sparseIntArray18.put(i993, i994);
        fallbackKeys.put(key_chat_outGreenCall, i994);
        fallbackKeys.put(key_actionBarTabActiveText, i980);
        fallbackKeys.put(key_actionBarTabUnactiveText, i992);
        fallbackKeys.put(key_actionBarTabLine, i980);
        fallbackKeys.put(key_actionBarTabSelector, i978);
        fallbackKeys.put(key_profile_status, key_avatar_subtitleInProfileBlue);
        fallbackKeys.put(key_chats_menuTopBackgroundCats, key_avatar_backgroundActionBarBlue);
        fallbackKeys.put(key_chat_outLinkSelectBackground, key_chat_linkSelectBackground);
        fallbackKeys.put(key_actionBarDefaultSubmenuSeparator, key_windowBackgroundGray);
        SparseIntArray sparseIntArray19 = fallbackKeys;
        int i995 = key_chat_attachPermissionImage;
        int i996 = key_dialogTextBlack;
        sparseIntArray19.put(i995, i996);
        fallbackKeys.put(key_chat_attachPermissionMark, key_chat_sentError);
        fallbackKeys.put(key_chat_attachPermissionText, i996);
        fallbackKeys.put(key_chat_attachEmptyImage, key_emptyListPlaceholder);
        fallbackKeys.put(key_actionBarBrowser, key_actionBarDefault);
        fallbackKeys.put(key_chats_sentReadCheck, key_chats_sentCheck);
        fallbackKeys.put(key_chat_outSentCheckRead, key_chat_outSentCheck);
        fallbackKeys.put(key_chat_outSentCheckReadSelected, key_chat_outSentCheckSelected);
        fallbackKeys.put(key_chats_archivePullDownBackground, i986);
        fallbackKeys.put(key_chats_archivePullDownBackgroundActive, i988);
        fallbackKeys.put(key_avatar_backgroundArchivedHidden, key_avatar_backgroundSaved);
        fallbackKeys.put(key_featuredStickers_removeButtonText, key_featuredStickers_addButtonPressed);
        SparseIntArray sparseIntArray20 = fallbackKeys;
        int i997 = key_dialogEmptyImage;
        int i998 = key_player_time;
        sparseIntArray20.put(i997, i998);
        fallbackKeys.put(key_dialogEmptyText, i998);
        fallbackKeys.put(key_location_actionIcon, i996);
        SparseIntArray sparseIntArray21 = fallbackKeys;
        int i999 = key_location_actionActiveIcon;
        int i1000 = key_windowBackgroundWhiteBlueText7;
        sparseIntArray21.put(i999, i1000);
        fallbackKeys.put(key_location_actionBackground, key_dialogBackground);
        fallbackKeys.put(key_location_actionPressedBackground, key_dialogBackgroundGray);
        fallbackKeys.put(key_location_sendLocationText, i1000);
        fallbackKeys.put(key_location_sendLiveLocationText, key_windowBackgroundWhiteGreenText);
        SparseIntArray sparseIntArray22 = fallbackKeys;
        int i1001 = key_chat_outTextSelectionHighlight;
        int i1002 = key_chat_textSelectBackground;
        sparseIntArray22.put(i1001, i1002);
        fallbackKeys.put(key_chat_inTextSelectionHighlight, i1002);
        SparseIntArray sparseIntArray23 = fallbackKeys;
        int i1003 = key_chat_TextSelectionCursor;
        sparseIntArray23.put(i1003, key_chat_messagePanelCursor);
        fallbackKeys.put(key_chat_outTextSelectionCursor, i1003);
        SparseIntArray sparseIntArray24 = fallbackKeys;
        int i1004 = key_chat_inPollCorrectAnswer;
        int i1005 = key_chat_attachLocationBackground;
        sparseIntArray24.put(i1004, i1005);
        fallbackKeys.put(key_chat_outPollCorrectAnswer, i1005);
        SparseIntArray sparseIntArray25 = fallbackKeys;
        int i1006 = key_chat_inPollWrongAnswer;
        int i1007 = key_chat_attachAudioBackground;
        sparseIntArray25.put(i1006, i1007);
        fallbackKeys.put(key_chat_outPollWrongAnswer, i1007);
        fallbackKeys.put(key_chat_editMediaButton, key_dialogFloatingButton);
        fallbackKeys.put(key_chat_attachCheckBoxBackground, key_dialogRoundCheckBox);
        fallbackKeys.put(key_profile_tabText, key_windowBackgroundWhiteGrayText);
        SparseIntArray sparseIntArray26 = fallbackKeys;
        int i1008 = key_profile_tabSelectedText;
        int i1009 = key_windowBackgroundWhiteBlueHeader;
        sparseIntArray26.put(i1008, i1009);
        fallbackKeys.put(key_profile_tabSelectedLine, i1009);
        fallbackKeys.put(key_profile_tabSelector, key_listSelector);
        fallbackKeys.put(key_chat_attachGalleryText, key_chat_attachGalleryBackground);
        fallbackKeys.put(key_chat_attachAudioText, i1007);
        fallbackKeys.put(key_chat_attachFileText, key_chat_attachFileBackground);
        fallbackKeys.put(key_chat_attachContactText, key_chat_attachContactBackground);
        fallbackKeys.put(key_chat_attachLocationText, i1005);
        fallbackKeys.put(key_chat_attachPollText, key_chat_attachPollBackground);
        SparseIntArray sparseIntArray27 = fallbackKeys;
        int i1010 = key_chat_inPsaNameText;
        int i1011 = key_avatar_nameInMessageGreen;
        sparseIntArray27.put(i1010, i1011);
        fallbackKeys.put(key_chat_outPsaNameText, i1011);
        fallbackKeys.put(key_chat_outAdminText, key_chat_outTimeText);
        fallbackKeys.put(key_chat_outAdminSelectedText, key_chat_outTimeSelectedText);
        SparseIntArray sparseIntArray28 = fallbackKeys;
        int i1012 = key_returnToCallMutedBackground;
        int i1013 = key_windowBackgroundWhite;
        sparseIntArray28.put(i1012, i1013);
        SparseIntArray sparseIntArray29 = fallbackKeys;
        int i1014 = key_dialogSwipeRemove;
        int i1015 = key_avatar_backgroundRed;
        sparseIntArray29.put(i1014, i1015);
        fallbackKeys.put(key_chat_inReactionButtonBackground, key_chat_inLoader);
        fallbackKeys.put(key_chat_outReactionButtonBackground, key_chat_outLoader);
        SparseIntArray sparseIntArray30 = fallbackKeys;
        int i1016 = key_chat_inReactionButtonText;
        sparseIntArray30.put(i1016, key_chat_inPreviewInstantText);
        fallbackKeys.put(key_chat_outReactionButtonText, key_chat_outPreviewInstantText);
        fallbackKeys.put(key_chat_inReactionButtonTextSelected, i1013);
        fallbackKeys.put(key_chat_outReactionButtonTextSelected, i1013);
        fallbackKeys.put(key_dialogReactionMentionBackground, key_voipgroup_mutedByAdminGradient2);
        fallbackKeys.put(key_topics_unreadCounter, key_chats_unreadCounter);
        fallbackKeys.put(key_topics_unreadCounterMuted, key_chats_message);
        fallbackKeys.put(key_avatar_background2Saved, key_avatar_backgroundSaved);
        fallbackKeys.put(key_avatar_background2Red, i1015);
        fallbackKeys.put(key_avatar_background2Orange, key_avatar_backgroundOrange);
        fallbackKeys.put(key_avatar_background2Violet, key_avatar_backgroundViolet);
        fallbackKeys.put(key_avatar_background2Green, key_avatar_backgroundGreen);
        fallbackKeys.put(key_avatar_background2Cyan, key_avatar_backgroundCyan);
        fallbackKeys.put(key_avatar_background2Blue, key_avatar_backgroundBlue);
        fallbackKeys.put(key_avatar_background2Pink, key_avatar_backgroundPink);
        fallbackKeys.put(key_statisticChartLine_orange, key_color_orange);
        fallbackKeys.put(key_statisticChartLine_blue, key_color_blue);
        fallbackKeys.put(key_statisticChartLine_red, key_color_red);
        fallbackKeys.put(key_statisticChartLine_lightblue, key_color_lightblue);
        fallbackKeys.put(key_statisticChartLine_golden, key_color_yellow);
        SparseIntArray sparseIntArray31 = fallbackKeys;
        int i1017 = key_statisticChartLine_purple;
        int i1018 = key_color_purple;
        sparseIntArray31.put(i1017, i1018);
        fallbackKeys.put(key_statisticChartLine_indigo, i1018);
        fallbackKeys.put(key_statisticChartLine_cyan, key_color_cyan);
        fallbackKeys.put(key_actionBarActionModeReaction, key_windowBackgroundGray);
        fallbackKeys.put(key_actionBarActionModeReactionText, i1016);
        fallbackKeys.put(key_table_background, key_graySection);
        fallbackKeys.put(key_table_border, key_divider);
        int i1019 = 0;
        while (true) {
            int[] iArr = keys_avatar_background;
            if (i1019 >= iArr.length) {
                break;
            }
            themeAccentExclusionKeys.add(Integer.valueOf(iArr[i1019]));
            i1019++;
        }
        int i1020 = 0;
        while (true) {
            int[] iArr2 = keys_avatar_background2;
            if (i1020 >= iArr2.length) {
                break;
            }
            themeAccentExclusionKeys.add(Integer.valueOf(iArr2[i1020]));
            i1020++;
        }
        int i1021 = 0;
        while (true) {
            int[] iArr3 = keys_avatar_nameInMessage;
            if (i1021 >= iArr3.length) {
                break;
            }
            themeAccentExclusionKeys.add(Integer.valueOf(iArr3[i1021]));
            i1021++;
        }
        int i1022 = 0;
        while (true) {
            int[] iArr4 = keys_colors;
            if (i1022 >= iArr4.length) {
                break;
            }
            themeAccentExclusionKeys.add(Integer.valueOf(iArr4[i1022]));
            i1022++;
        }
        themeAccentExclusionKeys.add(Integer.valueOf(key_chat_attachFileBackground));
        themeAccentExclusionKeys.add(Integer.valueOf(key_chat_attachGalleryBackground));
        themeAccentExclusionKeys.add(Integer.valueOf(key_chat_attachFileText));
        themeAccentExclusionKeys.add(Integer.valueOf(key_chat_attachGalleryText));
        themeAccentExclusionKeys.add(Integer.valueOf(key_statisticChartLine_blue));
        themeAccentExclusionKeys.add(Integer.valueOf(key_statisticChartLine_green));
        themeAccentExclusionKeys.add(Integer.valueOf(key_statisticChartLine_red));
        themeAccentExclusionKeys.add(Integer.valueOf(key_statisticChartLine_golden));
        themeAccentExclusionKeys.add(Integer.valueOf(key_statisticChartLine_lightblue));
        themeAccentExclusionKeys.add(Integer.valueOf(key_statisticChartLine_lightgreen));
        themeAccentExclusionKeys.add(Integer.valueOf(key_statisticChartLine_orange));
        themeAccentExclusionKeys.add(Integer.valueOf(key_statisticChartLine_indigo));
        themeAccentExclusionKeys.add(Integer.valueOf(key_chat_inCodeBackground));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_checkMenu));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_muteButton));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_muteButton2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_muteButton3));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_searchText));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_searchPlaceholder));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_searchBackground));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_leaveCallMenu));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_scrollUp));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_soundButton));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_soundButtonActive));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_soundButtonActiveScrolled));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_soundButton2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_soundButtonActive2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_soundButtonActive2Scrolled));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_leaveButton));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_leaveButtonScrolled));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_connectingProgress));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_disabledButton));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_disabledButtonActive));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_disabledButtonActiveScrolled));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_unmuteButton));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_unmuteButton2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_actionBarUnscrolled));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_listViewBackgroundUnscrolled));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_lastSeenTextUnscrolled));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_mutedIconUnscrolled));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_actionBar));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_actionBarItems));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_actionBarItemsSelector));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_mutedByAdminIcon));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_mutedIcon));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_lastSeenText));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_nameText));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_listViewBackground));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_listeningText));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_speakingText));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_listSelector));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_inviteMembersBackground));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_dialogBackground));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_overlayGreen1));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_overlayGreen2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_overlayBlue1));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_overlayBlue2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_topPanelGreen1));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_topPanelGreen2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_topPanelBlue1));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_topPanelBlue2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_topPanelGray));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_overlayAlertGradientMuted));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_overlayAlertGradientMuted2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_overlayAlertGradientUnmuted));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_overlayAlertGradientUnmuted2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_overlayAlertMutedByAdmin));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_overlayAlertMutedByAdmin2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_mutedByAdminGradient));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_mutedByAdminGradient2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_mutedByAdminGradient3));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_mutedByAdminMuteButton));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_mutedByAdminMuteButtonDisabled));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_windowBackgroundWhiteInputField));
        themeAccentExclusionKeys.add(Integer.valueOf(key_voipgroup_windowBackgroundWhiteInputFieldActivated));
        themeAccentExclusionKeys.add(Integer.valueOf(key_premiumGradient0));
        themeAccentExclusionKeys.add(Integer.valueOf(key_premiumGradient1));
        themeAccentExclusionKeys.add(Integer.valueOf(key_premiumGradient2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_premiumGradient3));
        themeAccentExclusionKeys.add(Integer.valueOf(key_premiumGradient4));
        themeAccentExclusionKeys.add(Integer.valueOf(key_premiumGradientBackground1));
        themeAccentExclusionKeys.add(Integer.valueOf(key_premiumGradientBackground2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_premiumGradientBackground3));
        themeAccentExclusionKeys.add(Integer.valueOf(key_premiumGradientBackground4));
        themeAccentExclusionKeys.add(Integer.valueOf(key_premiumStartSmallStarsColor));
        themeAccentExclusionKeys.add(Integer.valueOf(key_premiumStarGradient1));
        themeAccentExclusionKeys.add(Integer.valueOf(key_premiumStarGradient2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_stories_circle1));
        themeAccentExclusionKeys.add(Integer.valueOf(key_stories_circle2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_stories_circle_dialog1));
        themeAccentExclusionKeys.add(Integer.valueOf(key_stories_circle_dialog2));
        themeAccentExclusionKeys.add(Integer.valueOf(key_stories_circle_closeFriends1));
        themeAccentExclusionKeys.add(Integer.valueOf(key_stories_circle_closeFriends2));
        themes = new ArrayList<>();
        otherThemes = new ArrayList<>();
        themesDict = new HashMap<>();
        currentColorsNoAccent = new SparseIntArray();
        currentColors = new SparseIntArray();
        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("themeconfig", 0);
        ThemeInfo themeInfo6 = new ThemeInfo();
        themeInfo6.name = "Blue";
        themeInfo6.assetName = "bluebubbles.attheme";
        themeInfo6.previewBackgroundColor = -6963476;
        themeInfo6.previewInColor = -1;
        themeInfo6.previewOutColor = -3086593;
        themeInfo6.firstAccentIsDefault = true;
        themeInfo6.currentAccentId = DEFALT_THEME_ACCENT_ID;
        themeInfo6.sortIndex = 1;
        themeInfo6.setAccentColorOptions(new int[]{-10972987, -14444461, -3252606, -8428605, -14380627, -14050257, -7842636, -13464881, -12342073, -11359164, -3317869, -2981834, -8165684, -3256745, -2904512, -8681301}, new int[]{-4660851, -328756, -1572, -4108434, -3031781, -1335, -198952, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, -853047, -264993, 0, 0, -135756, -198730, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, -2104672, -937328, -2637335, -2639714, -1270157, -3428124, -6570777, -7223828, -6567550, -1793599, -1855875, -4674838, -1336199, -2900876, -6247730}, new int[]{0, -4532067, -1257580, -1524266, -1646910, -1519483, -1324823, -4138509, -4202516, -2040429, -1458474, -1256030, -3814930, -1000039, -1450082, -3485987}, new int[]{0, -1909081, -1592444, -2969879, -2439762, -1137033, -2119471, -6962197, -4857383, -4270699, -3364639, -2117514, -5000734, -1598028, -2045813, -5853742}, new int[]{0, -6371440, -1319256, -1258616, -1712961, -1186647, -1193816, -4467224, -4203544, -3023977, -1061929, -1255788, -2113811, -806526, -1715305, -3485976}, new int[]{99, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8}, new String[]{"", "p-pXcflrmFIBAAAAvXYQk-mCwZU", "JqSUrO0-mFIBAAAAWwTvLzoWGQI", "O-wmAfBPSFADAAAA4zINVfD_bro", "RepJ5uE_SVABAAAAr4d0YhgB850", "-Xc-np9y2VMCAAAARKr0yNNPYW0", "fqv01SQemVIBAAAApND8LDRUhRU", "fqv01SQemVIBAAAApND8LDRUhRU", "RepJ5uE_SVABAAAAr4d0YhgB850", "lp0prF8ISFAEAAAA_p385_CvG0w", "heptcj-hSVACAAAAC9RrMzOa-cs", "PllZ-bf_SFAEAAAA8crRfwZiDNg", "dhf9pceaQVACAAAAbzdVo4SCiZA", "Ujx2TFcJSVACAAAARJ4vLa50MkM", "p-pXcflrmFIBAAAAvXYQk-mCwZU", "dk_wwlghOFACAAAAfz9xrxi6euw"}, new int[]{0, 180, 45, 0, 45, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, 52, 46, 57, 45, 64, 52, 35, 36, 41, 50, 50, 35, 38, 37, 30});
        sortAccents(themeInfo6);
        ArrayList<ThemeInfo> arrayList = themes;
        defaultTheme = themeInfo6;
        currentDayTheme = themeInfo6;
        arrayList.add(themeInfo6);
        themesDict.put("Blue", themeInfo6);
        ThemeInfo themeInfo7 = new ThemeInfo();
        themeInfo7.name = "Dark Blue";
        themeInfo7.assetName = "darkblue.attheme";
        themeInfo7.previewBackgroundColor = -10523006;
        themeInfo7.previewInColor = -9009508;
        themeInfo7.previewOutColor = -8214301;
        themeInfo7.sortIndex = 3;
        themeInfo7.setAccentColorOptions(new int[]{-7177260, -9860357, -14440464, -8687151, -9848491, -14053142, -9403671, -10044691, -13203974, -12138259, -10179489, -1344335, -1142742, -6127120, -2931932, -1131212, -8417365, -13270557}, new int[]{-6464359, -10267323, -13532789, -5413850, -11898828, -13410942, -13215889, -10914461, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{-10465880, -9937588, -14983040, -6736562, -14197445, -13534568, -13144441, -10587280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{-14213586, -15263198, -16310753, -15724781, -15853551, -16051428, -14868183, -14668758, -15854566, -15326427, -15327979, -14411490, -14345453, -14738135, -14543346, -14212843, -15263205, -15854566}, new int[]{-15659501, -14277074, -15459034, -14542297, -14735336, -15129808, -15591910, -15459810, -15260623, -15853800, -15259879, -14477540, -14674936, -15461604, -13820650, -15067635, -14605528, -15260623}, new int[]{-13951445, -15395557, -15985382, -15855853, -16050417, -15525854, -15260627, -15327189, -15788258, -14799314, -15458796, -13952727, -13754603, -14081231, -14478324, -14081004, -15197667, -15788258}, new int[]{-15330777, -15066858, -15915220, -14213847, -15262439, -15260879, -15657695, -16443625, -15459285, -15589601, -14932454, -14740451, -15002870, -15264997, -13821660, -14805234, -14605784, -15459285}, new int[]{11, 12, 13, 14, 15, 16, 17, 18, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, new String[]{"O-wmAfBPSFADAAAA4zINVfD_bro", "RepJ5uE_SVABAAAAr4d0YhgB850", "dk_wwlghOFACAAAAfz9xrxi6euw", "9LW_RcoOSVACAAAAFTk3DTyXN-M", "PllZ-bf_SFAEAAAA8crRfwZiDNg", "-Xc-np9y2VMCAAAARKr0yNNPYW0", "kO4jyq55SFABAAAA0WEpcLfahXk", "CJNyxPMgSVAEAAAAvW9sMwc51cw", "fqv01SQemVIBAAAApND8LDRUhRU", "RepJ5uE_SVABAAAAr4d0YhgB850", "CJNyxPMgSVAEAAAAvW9sMwc51cw", "9LW_RcoOSVACAAAAFTk3DTyXN-M", "9GcNVISdSVADAAAAUcw5BYjELW4", "F5oWoCs7QFACAAAAgf2bD_mg8Bw", "9ShF73d1MFIIAAAAjWnm8_ZMe8Q", "3rX-PaKbSFACAAAAEiHNvcEm6X4", "dk_wwlghOFACAAAAfz9xrxi6euw", "fqv01SQemVIBAAAApND8LDRUhRU"}, new int[]{225, 45, 225, 135, 45, 225, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{40, 40, 31, 50, 25, 34, 35, 35, 38, 29, 24, 34, 34, 31, 29, 37, 21, 38});
        sortAccents(themeInfo7);
        themes.add(themeInfo7);
        HashMap<String, ThemeInfo> hashMap48 = themesDict;
        currentNightTheme = themeInfo7;
        hashMap48.put("Dark Blue", themeInfo7);
        ThemeInfo themeInfo8 = new ThemeInfo();
        themeInfo8.name = "Arctic Blue";
        themeInfo8.assetName = "arctic.attheme";
        themeInfo8.previewBackgroundColor = -1971728;
        themeInfo8.previewInColor = -1;
        themeInfo8.previewOutColor = -9657877;
        themeInfo8.sortIndex = 5;
        themeInfo8.setAccentColorOptions(new int[]{-12537374, -12472227, -3240928, -11033621, -2194124, -3382903, -13332245, -12342073, -11359164, -3317869, -2981834, -8165684, -3256745, -2904512, -8681301}, new int[]{-13525046, -14113959, -7579073, -13597229, -3581840, -8883763, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{-11616542, -9716647, -6400452, -12008744, -2592697, -4297041, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{-3808528, -2433367, -2700891, -1838093, -1120848, -1712148, -2037779, -4202261, -4005713, -1058332, -925763, -1975316, -1189672, -1318451, -2302235}, new int[]{-1510157, -4398164, -1647697, -3610898, -1130838, -1980692, -4270093, -4202261, -3415654, -1259815, -1521765, -4341268, -1127744, -1318219, -3945761}, new int[]{-4924688, -3283031, -1523567, -2494477, -1126510, -595210, -2037517, -3478548, -4661623, -927514, -796762, -2696971, -1188403, -1319735, -1577487}, new int[]{-3149585, -5714021, -1978209, -4925720, -1134713, -1718833, -3613709, -5317397, -3218014, -999207, -2116466, -4343054, -931397, -1583186, -3815718}, new int[]{9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8}, new String[]{"MIo6r0qGSFAFAAAAtL8TsDzNX60", "dhf9pceaQVACAAAAbzdVo4SCiZA", "fqv01SQemVIBAAAApND8LDRUhRU", "p-pXcflrmFIBAAAAvXYQk-mCwZU", "JqSUrO0-mFIBAAAAWwTvLzoWGQI", "F5oWoCs7QFACAAAAgf2bD_mg8Bw", "fqv01SQemVIBAAAApND8LDRUhRU", "RepJ5uE_SVABAAAAr4d0YhgB850", "PllZ-bf_SFAEAAAA8crRfwZiDNg", "pgJfpFNRSFABAAAACDT8s5sEjfc", "ptuUd96JSFACAAAATobI23sPpz0", "dhf9pceaQVACAAAAbzdVo4SCiZA", "JqSUrO0-mFIBAAAAWwTvLzoWGQI", "9iklpvIPQVABAAAAORQXKur_Eyc", "F5oWoCs7QFACAAAAgf2bD_mg8Bw"}, new int[]{315, 315, 225, 315, 0, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{50, 50, 58, 47, 46, 50, 49, 46, 51, 50, 49, 34, 54, 50, 40});
        sortAccents(themeInfo8);
        themes.add(themeInfo8);
        themesDict.put("Arctic Blue", themeInfo8);
        ThemeInfo themeInfo9 = new ThemeInfo();
        themeInfo9.name = "Day";
        themeInfo9.assetName = "day.attheme";
        themeInfo9.previewBackgroundColor = -1;
        themeInfo9.previewInColor = -1315084;
        themeInfo9.previewOutColor = -8604930;
        themeInfo9.sortIndex = 2;
        themeInfo9.setAccentColorOptions(new int[]{-11099447, -3379581, -3109305, -3382174, -7963438, -11759137, -11029287, -11226775, -2506945, -3382174, -3379581, -6587438, -2649788, -8681301}, new int[]{-10125092, -9671214, -3451775, -3978678, -10711329, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{-12664362, -3642988, -2383569, -3109317, -11422261, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, null, null, new int[]{9, 10, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, 7, 8}, new String[]{"", "", "", "", "", "", "", "", "", "", "", "", "", ""}, new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
        sortAccents(themeInfo9);
        themes.add(themeInfo9);
        themesDict.put("Day", themeInfo9);
        ThemeInfo themeInfo10 = new ThemeInfo();
        themeInfo10.name = "Night";
        themeInfo10.assetName = "night.attheme";
        themeInfo10.previewBackgroundColor = -11315623;
        themeInfo10.previewInColor = -9143676;
        themeInfo10.previewOutColor = -9067802;
        themeInfo10.sortIndex = 4;
        themeInfo10.setAccentColorOptions(new int[]{-9781697, -7505693, -2204034, -10913816, -2375398, -12678921, -11881005, -11880383, -2534026, -1934037, -7115558, -3128522, -1528292, -8812381}, new int[]{-7712108, -4953061, -5288081, -14258547, -9154889, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{-9939525, -5948598, -10335844, -13659747, -14054507, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{-15330532, -14806760, -15791344, -16184308, -16313063, -15921641, -15656164, -15986420, -15856883, -14871025, -16185078, -14937584, -14869736, -15855598}, new int[]{-14673881, -15724781, -15002342, -15458526, -15987697, -16184820, -16118258, -16250616, -15067624, -15527923, -14804447, -15790836, -15987960, -16316665}, new int[]{-15856877, -14608861, -15528430, -15921391, -15722209, -15197144, -15458015, -15591406, -15528431, -15068401, -16053749, -15594229, -15395825, -15724012}, new int[]{-14804694, -15658986, -14609382, -15656421, -16118509, -15855854, -16315381, -16052981, -14544354, -15791092, -15659241, -16316922, -15988214, -16185077}, new int[]{9, 10, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, 7, 8}, new String[]{"YIxYGEALQVADAAAAA3QbEH0AowY", "9LW_RcoOSVACAAAAFTk3DTyXN-M", "O-wmAfBPSFADAAAA4zINVfD_bro", "F5oWoCs7QFACAAAAgf2bD_mg8Bw", "-Xc-np9y2VMCAAAARKr0yNNPYW0", "fqv01SQemVIBAAAApND8LDRUhRU", "F5oWoCs7QFACAAAAgf2bD_mg8Bw", "ptuUd96JSFACAAAATobI23sPpz0", "p-pXcflrmFIBAAAAvXYQk-mCwZU", "Nl8Pg2rBQVACAAAA25Lxtb8SDp0", "dhf9pceaQVACAAAAbzdVo4SCiZA", "9GcNVISdSVADAAAAUcw5BYjELW4", "9LW_RcoOSVACAAAAFTk3DTyXN-M", "dk_wwlghOFACAAAAfz9xrxi6euw"}, new int[]{45, 135, 0, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{34, 47, 52, 48, 54, 50, 37, 56, 48, 49, 40, 64, 38, 48});
        sortAccents(themeInfo10);
        themes.add(themeInfo10);
        themesDict.put("Night", themeInfo10);
        ThemeInfo themeInfo11 = new ThemeInfo();
        themeInfo11.name = "Amoled";
        themeInfo11.assetName = "amoled.attheme";
        themeInfo11.previewBackgroundColor = -16777216;
        themeInfo11.previewInColor = -16777216;
        themeInfo11.previewOutColor = -9067802;
        themeInfo11.sortIndex = 5;
        themeInfo11.setAccentColorOptions(new int[]{-9781697, -7505693, -2204034, -10913816, -2375398, -12678921, -11881005, -11880383, -2534026, -1934037, -7115558, -3128522, -1528292, -8812381}, new int[]{-7712108, -4953061, -5288081, -14258547, -9154889, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{-9939525, -5948598, -10335844, -13659747, -14054507, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{-15330532, -14806760, -15791344, -16184308, -16313063, -15921641, -15656164, -15986420, -15856883, -14871025, -16185078, -14937584, -14869736, -15855598}, new int[]{-14673881, -15724781, -15002342, -15458526, -15987697, -16184820, -16118258, -16250616, -15067624, -15527923, -14804447, -15790836, -15987960, -16316665}, new int[]{-15856877, -14608861, -15528430, -15921391, -15722209, -15197144, -15458015, -15591406, -15528431, -15068401, -16053749, -15594229, -15395825, -15724012}, new int[]{-14804694, -15658986, -14609382, -15656421, -16118509, -15855854, -16315381, -16052981, -14544354, -15791092, -15659241, -16316922, -15988214, -16185077}, new int[]{9, 10, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, 7, 8}, new String[]{"YIxYGEALQVADAAAAA3QbEH0AowY", "9LW_RcoOSVACAAAAFTk3DTyXN-M", "O-wmAfBPSFADAAAA4zINVfD_bro", "F5oWoCs7QFACAAAAgf2bD_mg8Bw", "-Xc-np9y2VMCAAAARKr0yNNPYW0", "fqv01SQemVIBAAAApND8LDRUhRU", "F5oWoCs7QFACAAAAgf2bD_mg8Bw", "ptuUd96JSFACAAAATobI23sPpz0", "p-pXcflrmFIBAAAAvXYQk-mCwZU", "Nl8Pg2rBQVACAAAA25Lxtb8SDp0", "dhf9pceaQVACAAAAbzdVo4SCiZA", "9GcNVISdSVADAAAAUcw5BYjELW4", "9LW_RcoOSVACAAAAFTk3DTyXN-M", "dk_wwlghOFACAAAAfz9xrxi6euw"}, new int[]{45, 135, 0, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[]{34, 47, 52, 48, 54, 50, 37, 56, 48, 49, 40, 64, 38, 48});
        themes.add(themeInfo11);
        themesDict.put("Amoled", themeInfo11);
        if (Build.VERSION.SDK_INT >= 31) {
            ThemeInfo themeInfo12 = new ThemeInfo();
            themeInfo12.name = "Monet Light";
            themeInfo12.assetName = "monet_light.attheme";
            themeInfo12.previewBackgroundColor = MonetHelper.getColor("n1_50");
            themeInfo12.previewInColor = MonetHelper.getColor("a1_100");
            themeInfo12.previewOutColor = MonetHelper.getColor("a1_600");
            themeInfo12.sortIndex = 6;
            themes.add(themeInfo12);
            themesDict.put("Monet Light", themeInfo12);
            ThemeInfo themeInfo13 = new ThemeInfo();
            themeInfo13.name = "Monet Dark";
            themeInfo13.assetName = "monet_dark.attheme";
            themeInfo13.previewBackgroundColor = MonetHelper.getColor("n1_900");
            themeInfo13.previewInColor = MonetHelper.getColor("n2_800");
            themeInfo13.previewOutColor = MonetHelper.getColor("a1_100");
            themeInfo13.sortIndex = 7;
            themes.add(themeInfo13);
            themesDict.put("Monet Dark", themeInfo13);
        }
        String str4 = null;
        String string = sharedPreferences.getString("themes2", null);
        if (sharedPreferences.getInt("remote_version", 0) == 1) {
            int i1023 = 0;
            while (i1023 < UserConfig.MAX_ACCOUNT_COUNT) {
                long[] jArr = remoteThemesHash;
                StringBuilder sb = new StringBuilder();
                sb.append("2remoteThemesHash");
                sb.append(i1023 != 0 ? Integer.valueOf(i1023) : "");
                jArr[i1023] = sharedPreferences.getLong(sb.toString(), 0L);
                int[] iArr5 = lastLoadingThemesTime;
                StringBuilder sb2 = new StringBuilder();
                sb2.append("lastLoadingThemesTime");
                sb2.append(i1023 != 0 ? Integer.valueOf(i1023) : "");
                iArr5[i1023] = sharedPreferences.getInt(sb2.toString(), 0);
                i1023++;
            }
        }
        sharedPreferences.edit().putInt("remote_version", 1).apply();
        if (!TextUtils.isEmpty(string)) {
            try {
                JSONArray jSONArray = new JSONArray(string);
                for (int i1024 = 0; i1024 < jSONArray.length(); i1024++) {
                    ThemeInfo createWithJson = ThemeInfo.createWithJson(jSONArray.getJSONObject(i1024));
                    if (createWithJson != null) {
                        otherThemes.add(createWithJson);
                        themes.add(createWithJson);
                        themesDict.put(createWithJson.getKey(), createWithJson);
                        createWithJson.loadWallpapers(sharedPreferences);
                    }
                }
            } catch (Exception e) {
                FileLog.e(e);
            }
        } else {
            String string2 = sharedPreferences.getString("themes", null);
            if (!TextUtils.isEmpty(string2)) {
                for (String str5 : string2.split("&")) {
                    ThemeInfo createWithString = ThemeInfo.createWithString(str5);
                    if (createWithString != null) {
                        otherThemes.add(createWithString);
                        themes.add(createWithString);
                        themesDict.put(createWithString.getKey(), createWithString);
                    }
                }
                saveOtherThemes(true, true);
                sharedPreferences.edit().remove("themes").commit();
            }
        }
        sortThemes();
        SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
        try {
            ThemeInfo themeInfo14 = themesDict.get("Dark Blue");
            String string3 = globalMainSettings.getString("theme", null);
            if ("Default".equals(string3)) {
                themeInfo = themesDict.get("Blue");
                themeInfo.currentAccentId = DEFALT_THEME_ACCENT_ID;
            } else if ("Dark".equals(string3)) {
                themeInfo14.currentAccentId = 9;
                themeInfo = themeInfo14;
            } else if (string3 != null) {
                themeInfo = themesDict.get(string3);
                if (themeInfo != null && !sharedPreferences.contains("lastDayTheme")) {
                    SharedPreferences.Editor edit = sharedPreferences.edit();
                    edit.putString("lastDayTheme", themeInfo.getKey());
                    edit.commit();
                }
            } else {
                themeInfo = null;
            }
            String string4 = globalMainSettings.getString("nighttheme", null);
            if ("Default".equals(string4)) {
                themeInfo = themesDict.get("Blue");
                themeInfo.currentAccentId = DEFALT_THEME_ACCENT_ID;
            } else if ("Dark".equals(string4)) {
                currentNightTheme = themeInfo14;
                themeInfo14.currentAccentId = 9;
            } else if (string4 != null && (themeInfo2 = themesDict.get(string4)) != null) {
                currentNightTheme = themeInfo2;
            }
            if (currentNightTheme != null && !sharedPreferences.contains("lastDarkTheme")) {
                SharedPreferences.Editor edit2 = sharedPreferences.edit();
                edit2.putString("lastDarkTheme", currentNightTheme.getKey());
                edit2.commit();
            }
            Iterator<ThemeInfo> it3 = themesDict.values().iterator();
            SharedPreferences.Editor editor = null;
            SharedPreferences.Editor editor2 = null;
            while (it3.hasNext()) {
                ThemeInfo next = it3.next();
                if (next.assetName == null || next.accentBaseColor == 0) {
                    it = it3;
                    themeInfo4 = themeInfo;
                    str = str3;
                } else {
                    String string5 = sharedPreferences.getString("accents_" + next.assetName, str4);
                    next.currentAccentId = sharedPreferences.getInt("accent_current_" + next.assetName, next.firstAccentIsDefault ? DEFALT_THEME_ACCENT_ID : 0);
                    ArrayList arrayList2 = new ArrayList();
                    if (!TextUtils.isEmpty(string5)) {
                        try {
                            SerializedData serializedData2 = new SerializedData(Base64.decode(string5, 3));
                            boolean z4 = true;
                            int readInt32 = serializedData2.readInt32(true);
                            int readInt322 = serializedData2.readInt32(true);
                            int i1025 = 0;
                            while (i1025 < readInt322) {
                                try {
                                    ThemeAccent themeAccent = new ThemeAccent();
                                    themeAccent.id = serializedData2.readInt32(z4);
                                    themeAccent.accentColor = serializedData2.readInt32(z4);
                                    if (readInt32 >= 9) {
                                        themeAccent.accentColor2 = serializedData2.readInt32(z4);
                                    }
                                    themeAccent.parentTheme = next;
                                    themeAccent.myMessagesAccentColor = serializedData2.readInt32(true);
                                    themeAccent.myMessagesGradientAccentColor1 = serializedData2.readInt32(true);
                                    if (readInt32 >= 7) {
                                        themeAccent.myMessagesGradientAccentColor2 = serializedData2.readInt32(true);
                                        themeAccent.myMessagesGradientAccentColor3 = serializedData2.readInt32(true);
                                    }
                                    if (readInt32 >= 8) {
                                        z2 = true;
                                        themeAccent.myMessagesAnimated = serializedData2.readBool(true);
                                    } else {
                                        z2 = true;
                                    }
                                    if (readInt32 >= 3) {
                                        it2 = it3;
                                        themeInfo5 = themeInfo;
                                        themeAccent.backgroundOverrideColor = serializedData2.readInt64(z2);
                                    } else {
                                        it2 = it3;
                                        themeInfo5 = themeInfo;
                                        themeAccent.backgroundOverrideColor = serializedData2.readInt32(z2);
                                    }
                                    if (readInt32 >= 2) {
                                        themeAccent.backgroundGradientOverrideColor1 = serializedData2.readInt64(z2);
                                    } else {
                                        themeAccent.backgroundGradientOverrideColor1 = serializedData2.readInt32(z2);
                                    }
                                    if (readInt32 >= 6) {
                                        themeAccent.backgroundGradientOverrideColor2 = serializedData2.readInt64(z2);
                                        themeAccent.backgroundGradientOverrideColor3 = serializedData2.readInt64(z2);
                                    }
                                    if (readInt32 >= 1) {
                                        themeAccent.backgroundRotation = serializedData2.readInt32(true);
                                    }
                                    if (readInt32 >= 4) {
                                        serializedData2.readInt64(true);
                                        str2 = str3;
                                        themeAccent.patternIntensity = (float) serializedData2.readDouble(true);
                                        themeAccent.patternMotion = serializedData2.readBool(true);
                                        if (readInt32 >= 5) {
                                            themeAccent.patternSlug = serializedData2.readString(true);
                                        }
                                    } else {
                                        str2 = str3;
                                    }
                                    if (readInt32 >= 5 && serializedData2.readBool(true)) {
                                        themeAccent.account = serializedData2.readInt32(true);
                                        themeAccent.info = TLRPC.Theme.TLdeserialize(serializedData2, serializedData2.readInt32(true), true);
                                    }
                                    TLRPC.TL_theme tL_theme = themeAccent.info;
                                    if (tL_theme != null) {
                                        themeAccent.isDefault = tL_theme.isDefault;
                                    }
                                    next.themeAccentsMap.put(themeAccent.id, themeAccent);
                                    TLRPC.TL_theme tL_theme2 = themeAccent.info;
                                    if (tL_theme2 != null) {
                                        serializedData = serializedData2;
                                        i = readInt32;
                                        next.accentsByThemeId.put(tL_theme2.id, themeAccent);
                                    } else {
                                        serializedData = serializedData2;
                                        i = readInt32;
                                    }
                                    arrayList2.add(themeAccent);
                                    next.lastAccentId = Math.max(next.lastAccentId, themeAccent.id);
                                    i1025++;
                                    str3 = str2;
                                    serializedData2 = serializedData;
                                    themeInfo = themeInfo5;
                                    it3 = it2;
                                    readInt32 = i;
                                    z4 = true;
                                } finally {
                                    runtimeException = new RuntimeException(th);
                                }
                            }
                            it = it3;
                            themeInfo4 = themeInfo;
                            str = str3;
                        } finally {
                            FileLog.e(th);
                        }
                    } else {
                        it = it3;
                        themeInfo4 = themeInfo;
                        str = str3;
                        String str6 = "accent_for_" + next.assetName;
                        int i1026 = globalMainSettings.getInt(str6, 0);
                        if (i1026 != 0) {
                            if (editor == null) {
                                editor = globalMainSettings.edit();
                                editor2 = sharedPreferences.edit();
                            }
                            editor.remove(str6);
                            int size = next.themeAccents.size();
                            int i1027 = 0;
                            while (true) {
                                if (i1027 >= size) {
                                    z3 = false;
                                    break;
                                }
                                ThemeAccent themeAccent2 = next.themeAccents.get(i1027);
                                if (themeAccent2.accentColor == i1026) {
                                    next.currentAccentId = themeAccent2.id;
                                    z3 = true;
                                    break;
                                }
                                i1027++;
                            }
                            if (!z3) {
                                ThemeAccent themeAccent3 = new ThemeAccent();
                                themeAccent3.id = 100;
                                themeAccent3.accentColor = i1026;
                                themeAccent3.parentTheme = next;
                                next.themeAccentsMap.put(100, themeAccent3);
                                arrayList2.add(0, themeAccent3);
                                next.currentAccentId = 100;
                                next.lastAccentId = 101;
                                SerializedData serializedData3 = new SerializedData(72);
                                serializedData3.writeInt32(9);
                                serializedData3.writeInt32(1);
                                serializedData3.writeInt32(themeAccent3.id);
                                serializedData3.writeInt32(themeAccent3.accentColor);
                                serializedData3.writeInt32(themeAccent3.myMessagesAccentColor);
                                serializedData3.writeInt32(themeAccent3.myMessagesGradientAccentColor1);
                                serializedData3.writeInt32(themeAccent3.myMessagesGradientAccentColor2);
                                serializedData3.writeInt32(themeAccent3.myMessagesGradientAccentColor3);
                                serializedData3.writeBool(themeAccent3.myMessagesAnimated);
                                serializedData3.writeInt64(themeAccent3.backgroundOverrideColor);
                                serializedData3.writeInt64(themeAccent3.backgroundGradientOverrideColor1);
                                serializedData3.writeInt64(themeAccent3.backgroundGradientOverrideColor2);
                                serializedData3.writeInt64(themeAccent3.backgroundGradientOverrideColor3);
                                serializedData3.writeInt32(themeAccent3.backgroundRotation);
                                serializedData3.writeInt64(0L);
                                serializedData3.writeDouble(themeAccent3.patternIntensity);
                                serializedData3.writeBool(themeAccent3.patternMotion);
                                serializedData3.writeString(themeAccent3.patternSlug);
                                serializedData3.writeBool(false);
                                editor2.putString("accents_" + next.assetName, Base64.encodeToString(serializedData3.toByteArray(), 3));
                            }
                            editor2.putInt("accent_current_" + next.assetName, next.currentAccentId);
                        }
                    }
                    if (!arrayList2.isEmpty()) {
                        next.themeAccents.addAll(0, arrayList2);
                        sortAccents(next);
                    }
                    SparseArray<ThemeAccent> sparseArray = next.themeAccentsMap;
                    if (sparseArray != null && sparseArray.get(next.currentAccentId) == null) {
                        next.currentAccentId = next.firstAccentIsDefault ? DEFALT_THEME_ACCENT_ID : 0;
                    }
                    next.loadWallpapers(sharedPreferences);
                    ThemeAccent accent = next.getAccent(false);
                    if (accent != null) {
                        next.overrideWallpaper = accent.overrideWallpaper;
                    }
                }
                str3 = str;
                themeInfo = themeInfo4;
                it3 = it;
                str4 = null;
            }
            ThemeInfo themeInfo15 = themeInfo;
            String str7 = str3;
            if (editor != null) {
                editor.commit();
                editor2.commit();
            }
            selectedAutoNightType = globalMainSettings.getInt("selectedAutoNightType", Build.VERSION.SDK_INT >= 29 ? 3 : 0);
            autoNightScheduleByLocation = globalMainSettings.getBoolean("autoNightScheduleByLocation", false);
            autoNightBrighnessThreshold = globalMainSettings.getFloat("autoNightBrighnessThreshold", 0.25f);
            autoNightDayStartTime = globalMainSettings.getInt("autoNightDayStartTime", 1320);
            autoNightDayEndTime = globalMainSettings.getInt("autoNightDayEndTime", 480);
            autoNightSunsetTime = globalMainSettings.getInt("autoNightSunsetTime", 1320);
            autoNightSunriseTime = globalMainSettings.getInt("autoNightSunriseTime", 480);
            autoNightCityName = globalMainSettings.getString("autoNightCityName", str7);
            long j = globalMainSettings.getLong("autoNightLocationLatitude3", 10000L);
            if (j != 10000) {
                autoNightLocationLatitude = Double.longBitsToDouble(j);
            } else {
                autoNightLocationLatitude = 10000.0d;
            }
            long j2 = globalMainSettings.getLong("autoNightLocationLongitude3", 10000L);
            if (j2 != 10000) {
                autoNightLocationLongitude = Double.longBitsToDouble(j2);
            } else {
                autoNightLocationLongitude = 10000.0d;
            }
            autoNightLastSunCheckDay = globalMainSettings.getInt("autoNightLastSunCheckDay", -1);
            if (themeInfo15 == null) {
                themeInfo3 = defaultTheme;
            } else {
                currentDayTheme = themeInfo15;
                themeInfo3 = themeInfo15;
            }
            if (globalMainSettings.contains("overrideThemeWallpaper") || globalMainSettings.contains("selectedBackground2")) {
                boolean z5 = globalMainSettings.getBoolean("overrideThemeWallpaper", false);
                long j3 = globalMainSettings.getLong("selectedBackground2", 1000001L);
                if (j3 == -1 || (z5 && j3 != -2 && j3 != 1000001)) {
                    OverrideWallpaperInfo overrideWallpaperInfo = new OverrideWallpaperInfo();
                    overrideWallpaperInfo.color = globalMainSettings.getInt("selectedColor", 0);
                    overrideWallpaperInfo.slug = globalMainSettings.getString("selectedBackgroundSlug", str7);
                    if (j3 >= -100 && j3 <= -1 && overrideWallpaperInfo.color != 0) {
                        overrideWallpaperInfo.slug = "c";
                        overrideWallpaperInfo.fileName = str7;
                        overrideWallpaperInfo.originalFileName = str7;
                    } else {
                        overrideWallpaperInfo.fileName = "wallpaper.jpg";
                        overrideWallpaperInfo.originalFileName = "wallpaper_original.jpg";
                    }
                    overrideWallpaperInfo.gradientColor1 = globalMainSettings.getInt("selectedGradientColor", 0);
                    overrideWallpaperInfo.gradientColor2 = globalMainSettings.getInt("selectedGradientColor2", 0);
                    overrideWallpaperInfo.gradientColor3 = globalMainSettings.getInt("selectedGradientColor3", 0);
                    overrideWallpaperInfo.rotation = globalMainSettings.getInt("selectedGradientRotation", 45);
                    overrideWallpaperInfo.isBlurred = globalMainSettings.getBoolean("selectedBackgroundBlurred", false);
                    overrideWallpaperInfo.isMotion = globalMainSettings.getBoolean("selectedBackgroundMotion", false);
                    overrideWallpaperInfo.intensity = globalMainSettings.getFloat("selectedIntensity", 0.5f);
                    currentDayTheme.setOverrideWallpaper(overrideWallpaperInfo);
                    if (selectedAutoNightType != 0) {
                        currentNightTheme.setOverrideWallpaper(overrideWallpaperInfo);
                    }
                }
                globalMainSettings.edit().remove("overrideThemeWallpaper").remove("selectedBackground2").commit();
            }
            int needSwitchToTheme = needSwitchToTheme();
            if (needSwitchToTheme == 2) {
                themeInfo3 = currentNightTheme;
            }
            if (needSwitchToTheme == 2) {
                r2 = 0;
                z = true;
            } else {
                r2 = 0;
                z = false;
            }
            applyTheme(themeInfo3, r2, r2, z);
            AndroidUtilities.runOnUIThread(MessagesController$.ExternalSyntheticLambda292.INSTANCE);
            ambientSensorListener = new SensorEventListener() {
                @Override
                public void onAccuracyChanged(Sensor sensor, int accuracy) {
                }

                @Override
                public void onSensorChanged(SensorEvent event) {
                    float f = event.values[0];
                    if (f <= 0.0f) {
                        f = 0.1f;
                    }
                    if (ApplicationLoader.mainInterfacePaused || !ApplicationLoader.isScreenOn) {
                        return;
                    }
                    if (f > 500.0f) {
                        Theme.lastBrightnessValue = 1.0f;
                    } else {
                        Theme.lastBrightnessValue = ((float) Math.ceil((Math.log(f) * 9.932299613952637d) + 27.05900001525879d)) / 100.0f;
                    }
                    if (Theme.lastBrightnessValue <= Theme.autoNightBrighnessThreshold) {
                        if (MediaController.getInstance().isRecordingOrListeningByProximity()) {
                            return;
                        }
                        if (Theme.switchDayRunnableScheduled) {
                            Theme.switchDayRunnableScheduled = false;
                            AndroidUtilities.cancelRunOnUIThread(Theme.switchDayBrightnessRunnable);
                        }
                        if (Theme.switchNightRunnableScheduled) {
                            return;
                        }
                        Theme.switchNightRunnableScheduled = true;
                        AndroidUtilities.runOnUIThread(Theme.switchNightBrightnessRunnable, Theme.getAutoNightSwitchThemeDelay());
                        return;
                    }
                    if (Theme.switchNightRunnableScheduled) {
                        Theme.switchNightRunnableScheduled = false;
                        AndroidUtilities.cancelRunOnUIThread(Theme.switchNightBrightnessRunnable);
                    }
                    if (Theme.switchDayRunnableScheduled) {
                        return;
                    }
                    Theme.switchDayRunnableScheduled = true;
                    AndroidUtilities.runOnUIThread(Theme.switchDayBrightnessRunnable, Theme.getAutoNightSwitchThemeDelay());
                }
            };
            int[] iArr6 = new int[30];
            iArr6[r2] = R.drawable.tab_user_new;
            iArr6[1] = R.drawable.tab_groups_new;
            iArr6[2] = R.drawable.tab_channel_new;
            iArr6[3] = R.drawable.tab_bot_new;
            iArr6[4] = R.drawable.tab_fave_new;
            iArr6[5] = R.drawable.menu_folders;
            iArr6[6] = R.drawable.tab_polls;
            iArr6[7] = R.drawable.tab_cat;
            iArr6[8] = R.drawable.tab_soccer;
            iArr6[9] = R.drawable.menu_jobtitle;
            iArr6[10] = R.drawable.tab_especial;
            iArr6[11] = R.drawable.tab_flower;
            iArr6[12] = R.drawable.input_notify_on;
            iArr6[13] = R.drawable.tab_home;
            iArr6[14] = R.drawable.tab_play;
            iArr6[15] = R.drawable.tab_school;
            iArr6[16] = R.drawable.tab_selector;
            iArr6[17] = R.drawable.tab_travel;
            iArr6[18] = R.drawable.tab_crown;
            iArr6[19] = R.drawable.tab_secret;
            iArr6[20] = R.drawable.tab_cups;
            iArr6[21] = R.drawable.menu_chats1;
            iArr6[22] = R.drawable.menu_chats2;
            iArr6[23] = R.drawable.tab_btc;
            iArr6[24] = R.drawable.tab_book;
            iArr6[25] = R.drawable.tab_palette;
            iArr6[26] = R.drawable.tab_camera;
            iArr6[27] = R.drawable.tab_note;
            iArr6[28] = R.drawable.tab_lightbulb;
            iArr6[29] = R.drawable.tab_airplane;
            tabEmoticonsInt = iArr6;
            tabEmoticonsString = new String[]{"👤", "👥", "📢", "🤖", "⭐", "📁", "📈", "🐱", "⚽", "💼", "❤", "🌹", "🔔", "🏠", "🎮", "🎓", "📋", "✈", "👑", "🎭", "🍸", "💬", "✅", "💰", "📕", "🎨", "📸", "🎵", "💡", "🛫"};
            viewPos = new int[2];
            Paint paint = new Paint();
            DEBUG_RED = paint;
            paint.setColor(-65536);
            Paint paint2 = new Paint();
            DEBUG_BLUE = paint2;
            paint2.setColor(-16776961);
        } catch (Exception th) {
            throw new RuntimeException(th);
        }
    }

    public static void sortAccents(ThemeInfo info) {
        Collections.sort(info.themeAccents, new Comparator() {
            @Override
            public final int compare(Object obj, Object obj2) {
                int lambda$sortAccents$0;
                lambda$sortAccents$0 = Theme.lambda$sortAccents$0((Theme.ThemeAccent) obj, (Theme.ThemeAccent) obj2);
                return lambda$sortAccents$0;
            }
        });
    }

    public static int lambda$sortAccents$0(ThemeAccent themeAccent, ThemeAccent themeAccent2) {
        if (isHome(themeAccent)) {
            return -1;
        }
        if (isHome(themeAccent2)) {
            return 1;
        }
        ?? r0 = themeAccent.isDefault;
        ?? r3 = themeAccent2.isDefault;
        if (r0 != r3) {
            return r0 > r3 ? -1 : 1;
        }
        if (r0 != 0) {
            int i = themeAccent.id;
            int i2 = themeAccent2.id;
            if (i > i2) {
                return 1;
            }
            return i < i2 ? -1 : 0;
        }
        int i3 = themeAccent.id;
        int i4 = themeAccent2.id;
        if (i3 > i4) {
            return -1;
        }
        return i3 < i4 ? 1 : 0;
    }

    public static void saveAutoNightThemeConfig() {
        SharedPreferences.Editor edit = MessagesController.getGlobalMainSettings().edit();
        edit.putInt("selectedAutoNightType", selectedAutoNightType);
        edit.putBoolean("autoNightScheduleByLocation", autoNightScheduleByLocation);
        edit.putFloat("autoNightBrighnessThreshold", autoNightBrighnessThreshold);
        edit.putInt("autoNightDayStartTime", autoNightDayStartTime);
        edit.putInt("autoNightDayEndTime", autoNightDayEndTime);
        edit.putInt("autoNightSunriseTime", autoNightSunriseTime);
        edit.putString("autoNightCityName", autoNightCityName);
        edit.putInt("autoNightSunsetTime", autoNightSunsetTime);
        edit.putLong("autoNightLocationLatitude3", Double.doubleToRawLongBits(autoNightLocationLatitude));
        edit.putLong("autoNightLocationLongitude3", Double.doubleToRawLongBits(autoNightLocationLongitude));
        edit.putInt("autoNightLastSunCheckDay", autoNightLastSunCheckDay);
        ThemeInfo themeInfo = currentNightTheme;
        if (themeInfo != null) {
            edit.putString("nighttheme", themeInfo.getKey());
        } else {
            edit.remove("nighttheme");
        }
        edit.commit();
    }

    @SuppressLint({"PrivateApi"})
    public static Drawable getStateDrawable(Drawable drawable, int index) {
        if (Build.VERSION.SDK_INT >= 29 && (drawable instanceof StateListDrawable)) {
            return ((StateListDrawable) drawable).getStateDrawable(index);
        }
        if (StateListDrawable_getStateDrawableMethod == null) {
            try {
                StateListDrawable_getStateDrawableMethod = StateListDrawable.class.getDeclaredMethod("getStateDrawable", Integer.TYPE);
            } catch (Throwable unused) {
            }
        }
        Method method = StateListDrawable_getStateDrawableMethod;
        if (method == null) {
            return null;
        }
        try {
            return (Drawable) method.invoke(drawable, Integer.valueOf(index));
        } catch (Exception unused2) {
            return null;
        }
    }

    public static Drawable createEmojiIconSelectorDrawable(Context context, int resource, int defaultColor, int pressedColor) {
        Resources resources = context.getResources();
        Drawable mutate = resources.getDrawable(resource).mutate();
        if (defaultColor != 0) {
            mutate.setColorFilter(new PorterDuffColorFilter(defaultColor, PorterDuff.Mode.MULTIPLY));
        }
        Drawable mutate2 = resources.getDrawable(resource).mutate();
        if (pressedColor != 0) {
            mutate2.setColorFilter(new PorterDuffColorFilter(pressedColor, PorterDuff.Mode.MULTIPLY));
        }
        StateListDrawable stateListDrawable = new StateListDrawable() {
            @Override
            public boolean selectDrawable(int index) {
                if (Build.VERSION.SDK_INT < 21) {
                    Drawable stateDrawable = Theme.getStateDrawable(this, index);
                    ColorFilter colorFilter = null;
                    if (stateDrawable instanceof BitmapDrawable) {
                        colorFilter = ((BitmapDrawable) stateDrawable).getPaint().getColorFilter();
                    } else if (stateDrawable instanceof NinePatchDrawable) {
                        colorFilter = ((NinePatchDrawable) stateDrawable).getPaint().getColorFilter();
                    }
                    boolean selectDrawable = super.selectDrawable(index);
                    if (colorFilter != null) {
                        stateDrawable.setColorFilter(colorFilter);
                    }
                    return selectDrawable;
                }
                return super.selectDrawable(index);
            }
        };
        stateListDrawable.setEnterFadeDuration(1);
        stateListDrawable.setExitFadeDuration(200);
        stateListDrawable.addState(new int[]{android.R.attr.state_selected}, mutate2);
        stateListDrawable.addState(new int[0], mutate);
        return stateListDrawable;
    }

    public static Drawable createEditTextDrawable(Context context, boolean alert) {
        return createEditTextDrawable(context, getColor(alert ? key_dialogInputField : key_windowBackgroundWhiteInputField), getColor(alert ? key_dialogInputFieldActivated : key_windowBackgroundWhiteInputFieldActivated));
    }

    public static Drawable createEditTextDrawable(Context context, int color, int colorActivated) {
        Resources resources = context.getResources();
        Drawable mutate = resources.getDrawable(R.drawable.search_dark).mutate();
        mutate.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
        Drawable mutate2 = resources.getDrawable(R.drawable.search_dark_activated).mutate();
        if (usePlusTheme) {
            colorActivated = defColor;
        }
        mutate2.setColorFilter(new PorterDuffColorFilter(colorActivated, PorterDuff.Mode.MULTIPLY));
        StateListDrawable stateListDrawable = new StateListDrawable() {
            @Override
            public boolean selectDrawable(int index) {
                if (Build.VERSION.SDK_INT < 21) {
                    Drawable stateDrawable = Theme.getStateDrawable(this, index);
                    ColorFilter colorFilter = null;
                    if (stateDrawable instanceof BitmapDrawable) {
                        colorFilter = ((BitmapDrawable) stateDrawable).getPaint().getColorFilter();
                    } else if (stateDrawable instanceof NinePatchDrawable) {
                        colorFilter = ((NinePatchDrawable) stateDrawable).getPaint().getColorFilter();
                    }
                    boolean selectDrawable = super.selectDrawable(index);
                    if (colorFilter != null) {
                        stateDrawable.setColorFilter(colorFilter);
                    }
                    return selectDrawable;
                }
                return super.selectDrawable(index);
            }
        };
        stateListDrawable.addState(new int[]{android.R.attr.state_enabled, android.R.attr.state_focused}, mutate2);
        stateListDrawable.addState(new int[]{android.R.attr.state_focused}, mutate2);
        stateListDrawable.addState(StateSet.WILD_CARD, mutate);
        return stateListDrawable;
    }

    public static boolean canStartHolidayAnimation() {
        return canStartHolidayAnimation;
    }

    public static int getEventType() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(System.currentTimeMillis());
        int i = calendar.get(2);
        int i2 = calendar.get(5);
        calendar.get(12);
        int i3 = calendar.get(11);
        if ((i == 11 && i2 >= 24 && i2 <= 31) || (i == 0 && i2 == 1)) {
            return 0;
        }
        if (i == 1 && i2 == 14) {
            return 1;
        }
        if (i != 9 || i2 < 30) {
            return (i == 10 && i2 == 1 && i3 < 12) ? 2 : -1;
        }
        return 2;
    }

    public static android.graphics.drawable.Drawable getCurrentHolidayDrawable() {
        throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.ActionBar.Theme.getCurrentHolidayDrawable():android.graphics.drawable.Drawable");
    }

    public static int getCurrentHolidayDrawableXOffset() {
        return dialogs_holidayDrawableOffsetX;
    }

    public static int getCurrentHolidayDrawableYOffset() {
        return dialogs_holidayDrawableOffsetY;
    }

    public static ShapeDrawable createCircleDrawable(int size, int color) {
        OvalShape ovalShape = new OvalShape();
        float f = size;
        ovalShape.resize(f, f);
        ShapeDrawable shapeDrawable = new ShapeDrawable(ovalShape);
        shapeDrawable.setIntrinsicWidth(size);
        shapeDrawable.setIntrinsicHeight(size);
        shapeDrawable.getPaint().setColor(color);
        return shapeDrawable;
    }

    public static CombinedDrawable createCircleDrawableWithIcon(int size, int iconRes) {
        return createCircleDrawableWithIcon(size, iconRes, 0);
    }

    public static CombinedDrawable createCircleDrawableWithIcon(int size, int iconRes, int stroke) {
        return createCircleDrawableWithIcon(size, iconRes != 0 ? ApplicationLoader.applicationContext.getResources().getDrawable(iconRes).mutate() : null, stroke);
    }

    public static CombinedDrawable createCircleDrawableWithIcon(int size, Drawable drawable, int stroke) {
        OvalShape ovalShape = new OvalShape();
        float f = size;
        ovalShape.resize(f, f);
        ShapeDrawable shapeDrawable = new ShapeDrawable(ovalShape);
        Paint paint = shapeDrawable.getPaint();
        paint.setColor(-1);
        if (stroke == 1) {
            paint.setStyle(Paint.Style.STROKE);
            paint.setStrokeWidth(AndroidUtilities.dp(2.0f));
        } else if (stroke == 2) {
            paint.setAlpha(0);
        }
        CombinedDrawable combinedDrawable = new CombinedDrawable(shapeDrawable, drawable);
        combinedDrawable.setCustomSize(size, size);
        return combinedDrawable;
    }

    public static float getThemeIntensity(float value) {
        return (value >= 0.0f || getActiveTheme().isDark()) ? value : -value;
    }

    public static void setCombinedDrawableColor(Drawable combinedDrawable, int color, boolean isIcon) {
        Drawable background;
        if (combinedDrawable instanceof CombinedDrawable) {
            if (isIcon) {
                background = ((CombinedDrawable) combinedDrawable).getIcon();
            } else {
                background = ((CombinedDrawable) combinedDrawable).getBackground();
            }
            if (background instanceof ColorDrawable) {
                ((ColorDrawable) background).setColor(color);
            } else {
                background.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
            }
        }
    }

    public static Drawable createSimpleSelectorCircleDrawable(int size, int defaultColor, int pressedColor) {
        OvalShape ovalShape = new OvalShape();
        float f = size;
        ovalShape.resize(f, f);
        ShapeDrawable shapeDrawable = new ShapeDrawable(ovalShape);
        shapeDrawable.getPaint().setColor(defaultColor);
        ShapeDrawable shapeDrawable2 = new ShapeDrawable(ovalShape);
        if (Build.VERSION.SDK_INT >= 21) {
            shapeDrawable2.getPaint().setColor(-1);
            return new BaseCell.RippleDrawableSafe(new ColorStateList(new int[][]{StateSet.WILD_CARD}, new int[]{pressedColor}), shapeDrawable, shapeDrawable2);
        }
        shapeDrawable2.getPaint().setColor(pressedColor);
        StateListDrawable stateListDrawable = new StateListDrawable();
        stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, shapeDrawable2);
        stateListDrawable.addState(new int[]{android.R.attr.state_focused}, shapeDrawable2);
        stateListDrawable.addState(StateSet.WILD_CARD, shapeDrawable);
        return stateListDrawable;
    }

    public static Drawable createRoundRectDrawable(int rad, int defaultColor) {
        float f = rad;
        ShapeDrawable shapeDrawable = new ShapeDrawable(new RoundRectShape(new float[]{f, f, f, f, f, f, f, f}, null, null));
        shapeDrawable.getPaint().setColor(defaultColor);
        return shapeDrawable;
    }

    public static Drawable createRoundRectDrawable(int topRad, int bottomRad, int defaultColor) {
        float f = topRad;
        float f2 = bottomRad;
        ShapeDrawable shapeDrawable = new ShapeDrawable(new RoundRectShape(new float[]{f, f, f, f, f2, f2, f2, f2}, null, null));
        shapeDrawable.getPaint().setColor(defaultColor);
        return shapeDrawable;
    }

    public static Drawable createServiceDrawable(int rad, View view, View containerView) {
        return createServiceDrawable(rad, view, containerView, chat_actionBackgroundPaint);
    }

    public static Drawable createServiceDrawable(int rad, View view, View containerView, Paint backgroundPaint) {
        return createServiceDrawable(rad, view, containerView, backgroundPaint, null);
    }

    public static Drawable createServiceDrawable(final int rad, final View view, final View containerView, final Paint backgroundPaint, final ResourcesProvider resourcesProvider) {
        return new Drawable() {
            public RectF rect = new RectF();

            @Override
            public int getOpacity() {
                return -2;
            }

            @Override
            public void setAlpha(int alpha) {
            }

            @Override
            public void setColorFilter(ColorFilter colorFilter) {
            }

            @Override
            public void draw(Canvas canvas) {
                Rect bounds = getBounds();
                this.rect.set(bounds.left, bounds.top, bounds.right, bounds.bottom);
                Theme.applyServiceShaderMatrixForView(view, containerView);
                RectF rectF = this.rect;
                int i = rad;
                float f = i;
                float f2 = i;
                Paint paint = backgroundPaint;
                if (paint == null) {
                    paint = Theme.getThemePaint("paintChatActionBackground", resourcesProvider);
                }
                canvas.drawRoundRect(rectF, f, f2, paint);
                ResourcesProvider resourcesProvider2 = resourcesProvider;
                if (resourcesProvider2 != null) {
                    if (!resourcesProvider2.hasGradientService()) {
                        return;
                    }
                } else if (!Theme.hasGradientService()) {
                    return;
                }
                RectF rectF2 = this.rect;
                int i2 = rad;
                canvas.drawRoundRect(rectF2, i2, i2, Theme.getThemePaint("paintChatActionBackgroundDarken", resourcesProvider));
            }
        };
    }

    public static Drawable createSimpleSelectorRoundRectDrawable(int rad, int defaultColor, int pressedColor) {
        return createSimpleSelectorRoundRectDrawable(rad, defaultColor, pressedColor, pressedColor);
    }

    public static Drawable createSimpleSelectorRoundRectDrawable(int rad, int defaultColor, int pressedColor, int maskColor) {
        float f = rad;
        ShapeDrawable shapeDrawable = new ShapeDrawable(new RoundRectShape(new float[]{f, f, f, f, f, f, f, f}, null, null));
        shapeDrawable.getPaint().setColor(defaultColor);
        ShapeDrawable shapeDrawable2 = new ShapeDrawable(new RoundRectShape(new float[]{f, f, f, f, f, f, f, f}, null, null));
        shapeDrawable2.getPaint().setColor(maskColor);
        if (Build.VERSION.SDK_INT >= 21) {
            return new BaseCell.RippleDrawableSafe(new ColorStateList(new int[][]{StateSet.WILD_CARD}, new int[]{pressedColor}), shapeDrawable, shapeDrawable2);
        }
        StateListDrawable stateListDrawable = new StateListDrawable();
        stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, shapeDrawable2);
        stateListDrawable.addState(new int[]{android.R.attr.state_selected}, shapeDrawable2);
        stateListDrawable.addState(StateSet.WILD_CARD, shapeDrawable);
        return stateListDrawable;
    }

    public static Drawable createSelectorDrawableFromDrawables(Drawable normal, Drawable pressed) {
        StateListDrawable stateListDrawable = new StateListDrawable();
        stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, pressed);
        stateListDrawable.addState(new int[]{android.R.attr.state_selected}, pressed);
        stateListDrawable.addState(StateSet.WILD_CARD, normal);
        return stateListDrawable;
    }

    public static Drawable getRoundRectSelectorDrawable(int color) {
        return getRoundRectSelectorDrawable(AndroidUtilities.dp(3.0f), color);
    }

    public static Drawable getRoundRectSelectorDrawable(int corners, int color) {
        if (Build.VERSION.SDK_INT >= 21) {
            return new BaseCell.RippleDrawableSafe(new ColorStateList(new int[][]{StateSet.WILD_CARD}, new int[]{(color & 16777215) | 419430400}), null, createRoundRectDrawable(corners, -1));
        }
        StateListDrawable stateListDrawable = new StateListDrawable();
        int i = (color & 16777215) | 419430400;
        stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, createRoundRectDrawable(corners, i));
        stateListDrawable.addState(new int[]{android.R.attr.state_selected}, createRoundRectDrawable(corners, i));
        stateListDrawable.addState(StateSet.WILD_CARD, new ColorDrawable(0));
        return stateListDrawable;
    }

    public static Drawable createSelectorWithBackgroundDrawable(int backgroundColor, int color) {
        if (Build.VERSION.SDK_INT >= 21) {
            return new BaseCell.RippleDrawableSafe(new ColorStateList(new int[][]{StateSet.WILD_CARD}, new int[]{color}), new ColorDrawable(backgroundColor), new ColorDrawable(backgroundColor));
        }
        StateListDrawable stateListDrawable = new StateListDrawable();
        stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, new ColorDrawable(color));
        stateListDrawable.addState(new int[]{android.R.attr.state_selected}, new ColorDrawable(color));
        stateListDrawable.addState(StateSet.WILD_CARD, new ColorDrawable(backgroundColor));
        return stateListDrawable;
    }

    public static Drawable getSelectorDrawable(boolean whiteBackground) {
        return getSelectorDrawable(getColor(key_listSelector), whiteBackground);
    }

    public static Drawable getSelectorDrawable(boolean whiteBackground, ResourcesProvider resourcesProvider) {
        return getSelectorDrawable(getColor(key_listSelector, resourcesProvider), whiteBackground);
    }

    public static Drawable getSelectorDrawable(int color, boolean whiteBackground) {
        if (whiteBackground) {
            return getSelectorDrawable(color, key_windowBackgroundWhite);
        }
        return createSelectorDrawable(color, 2);
    }

    public static Drawable getSelectorDrawable(int color, int backgroundColor) {
        if (backgroundColor >= 0) {
            if (Build.VERSION.SDK_INT >= 21) {
                return new BaseCell.RippleDrawableSafe(new ColorStateList(new int[][]{StateSet.WILD_CARD}, new int[]{color}), new ColorDrawable(getColor(backgroundColor)), new ColorDrawable(-1));
            }
            StateListDrawable stateListDrawable = new StateListDrawable();
            stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, new ColorDrawable(color));
            stateListDrawable.addState(new int[]{android.R.attr.state_selected}, new ColorDrawable(color));
            stateListDrawable.addState(StateSet.WILD_CARD, new ColorDrawable(getColor(backgroundColor)));
            return stateListDrawable;
        }
        return createSelectorDrawable(color, 2);
    }

    public static Drawable createSelectorDrawable(int color) {
        return createSelectorDrawable(color, 1, -1);
    }

    public static Drawable createSelectorDrawable(int color, int maskType) {
        return createSelectorDrawable(color, maskType, -1);
    }

    public static android.graphics.drawable.Drawable createSelectorDrawable(int r11, final int r12, final int r13) {
        throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.ActionBar.Theme.createSelectorDrawable(int, int, int):android.graphics.drawable.Drawable");
    }

    public static Drawable createCircleSelectorDrawable(int color, final int leftInset, final int rightInset) {
        if (Build.VERSION.SDK_INT >= 21) {
            maskPaint.setColor(-1);
            return new BaseCell.RippleDrawableSafe(new ColorStateList(new int[][]{StateSet.WILD_CARD}, new int[]{color}), null, new Drawable() {
                @Override
                public int getOpacity() {
                    return 0;
                }

                @Override
                public void setAlpha(int alpha) {
                }

                @Override
                public void setColorFilter(ColorFilter colorFilter) {
                }

                @Override
                public void draw(Canvas canvas) {
                    Rect bounds = getBounds();
                    canvas.drawCircle((bounds.centerX() - leftInset) + rightInset, bounds.centerY(), (Math.max(bounds.width(), bounds.height()) / 2) + leftInset + rightInset, Theme.maskPaint);
                }
            });
        }
        StateListDrawable stateListDrawable = new StateListDrawable();
        stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, new ColorDrawable(color));
        stateListDrawable.addState(new int[]{android.R.attr.state_selected}, new ColorDrawable(color));
        stateListDrawable.addState(StateSet.WILD_CARD, new ColorDrawable(0));
        return stateListDrawable;
    }

    public static class AdaptiveRipple {
        public static final int defaultBackgroundColorKey = Theme.key_windowBackgroundWhite;
        public static float[] tempHSV;

        public static Drawable circle(int backgroundColor) {
            return circle(backgroundColor, -1.0f);
        }

        public static Drawable circle(int backgroundColor, float radius) {
            return createCircle(calcRippleColor(backgroundColor), radius);
        }

        public static Drawable filledCircle() {
            return filledCircle(null, Theme.getColor(defaultBackgroundColorKey), -1.0f);
        }

        public static Drawable filledCircle(Drawable background, int backgroundColor, float radius) {
            return createCircle(background, calcRippleColor(backgroundColor), radius);
        }

        public static Drawable rectByKey(int backgroundColorKey, float... radii) {
            return rect(Theme.getColor(backgroundColorKey), radii);
        }

        public static Drawable rect(int backgroundColor) {
            return rect(backgroundColor, 0.0f);
        }

        public static Drawable rect(int backgroundColor, float... radii) {
            return createRect(0, calcRippleColor(backgroundColor), radii);
        }

        public static Drawable filledRect() {
            return filledRect(Theme.getColor(defaultBackgroundColorKey), 0.0f);
        }

        public static Drawable filledRectByKey(int backgroundColorKey) {
            return filledRect(Theme.getColor(backgroundColorKey));
        }

        public static Drawable filledRectByKey(int backgroundColorKey, float... radii) {
            return filledRect(Theme.getColor(backgroundColorKey), radii);
        }

        public static Drawable filledRect(int backgroundColor) {
            return createRect(backgroundColor, calcRippleColor(backgroundColor), new float[0]);
        }

        public static Drawable filledRect(int backgroundColor, float... radii) {
            return createRect(backgroundColor, calcRippleColor(backgroundColor), radii);
        }

        public static Drawable createRect(int backgroundColor, int rippleColor, float... radii) {
            ColorDrawable colorDrawable = null;
            if (backgroundColor != 0) {
                if (hasNonzeroRadii(radii)) {
                    ShapeDrawable shapeDrawable = new ShapeDrawable(new RoundRectShape(calcRadii(radii), null, null));
                    shapeDrawable.getPaint().setColor(backgroundColor);
                    colorDrawable = shapeDrawable;
                } else {
                    colorDrawable = new ColorDrawable(backgroundColor);
                }
            }
            return createRect(colorDrawable, rippleColor, radii);
        }

        public static Drawable createRect(Drawable background, int rippleColor, float... radii) {
            ShapeDrawable shapeDrawable;
            ShapeDrawable shapeDrawable2;
            if (Build.VERSION.SDK_INT >= 21) {
                if (hasNonzeroRadii(radii)) {
                    shapeDrawable2 = new ShapeDrawable(new RoundRectShape(calcRadii(radii), null, null));
                    shapeDrawable2.getPaint().setColor(-1);
                } else {
                    shapeDrawable2 = new ShapeDrawable(new RectShape());
                    shapeDrawable2.getPaint().setColor(-1);
                }
                return new BaseCell.RippleDrawableSafe(new ColorStateList(new int[][]{StateSet.WILD_CARD}, new int[]{rippleColor}), background, shapeDrawable2);
            }
            StateListDrawable stateListDrawable = new StateListDrawable();
            if (hasNonzeroRadii(radii)) {
                shapeDrawable = new ShapeDrawable(new RoundRectShape(calcRadii(radii), null, null));
                shapeDrawable.getPaint().setColor(rippleColor);
            } else {
                shapeDrawable = new ShapeDrawable(new RectShape());
                shapeDrawable.getPaint().setColor(rippleColor);
            }
            if (background != null) {
                shapeDrawable = new LayerDrawable(new Drawable[]{background, shapeDrawable});
            }
            stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, shapeDrawable);
            stateListDrawable.addState(new int[]{android.R.attr.state_selected}, shapeDrawable);
            stateListDrawable.addState(StateSet.WILD_CARD, background);
            return stateListDrawable;
        }

        public static Drawable createCircle(int rippleColor, float radius) {
            return createCircle(0, rippleColor, radius);
        }

        public static Drawable createCircle(int backgroundColor, int rippleColor, float radius) {
            return createCircle(backgroundColor == 0 ? null : new CircleDrawable(radius, backgroundColor), rippleColor, radius);
        }

        public static Drawable createCircle(Drawable background, int rippleColor, float radius) {
            if (Build.VERSION.SDK_INT >= 21) {
                return new BaseCell.RippleDrawableSafe(new ColorStateList(new int[][]{StateSet.WILD_CARD}, new int[]{rippleColor}), background, new CircleDrawable(radius));
            }
            StateListDrawable stateListDrawable = new StateListDrawable();
            Drawable circleDrawable = new CircleDrawable(radius, rippleColor);
            if (background != null) {
                circleDrawable = new LayerDrawable(new Drawable[]{background, circleDrawable});
            }
            stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, circleDrawable);
            stateListDrawable.addState(new int[]{android.R.attr.state_selected}, circleDrawable);
            stateListDrawable.addState(StateSet.WILD_CARD, background);
            return stateListDrawable;
        }

        public static class CircleDrawable extends Drawable {
            public static Paint maskPaint;
            public Paint paint;
            public float radius;

            @Override
            @Deprecated
            public int getOpacity() {
                return -2;
            }

            @Override
            public void setAlpha(int i) {
            }

            @Override
            public void setColorFilter(ColorFilter colorFilter) {
            }

            public CircleDrawable(float radius) {
                this.radius = radius;
                if (maskPaint == null) {
                    Paint paint = new Paint(1);
                    maskPaint = paint;
                    paint.setColor(-1);
                }
                this.paint = maskPaint;
            }

            public CircleDrawable(float radius, int paintColor) {
                this.radius = radius;
                Paint paint = new Paint(1);
                this.paint = paint;
                paint.setColor(paintColor);
            }

            @Override
            public void draw(Canvas canvas) {
                int dp;
                Rect bounds = getBounds();
                if (Math.abs(this.radius - (-1.0f)) < 0.01f) {
                    dp = Math.max(bounds.width(), bounds.height()) / 2;
                } else if (Math.abs(this.radius - (-2.0f)) < 0.01f) {
                    dp = (int) Math.ceil(Math.sqrt(((bounds.left - bounds.centerX()) * (bounds.left - bounds.centerX())) + ((bounds.top - bounds.centerY()) * (bounds.top - bounds.centerY()))));
                } else {
                    dp = AndroidUtilities.dp(this.radius);
                }
                canvas.drawCircle(bounds.centerX(), bounds.centerY(), dp, this.paint);
            }
        }

        public static float[] calcRadii(float... radii) {
            return radii.length == 0 ? new float[]{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f} : radii.length == 1 ? new float[]{AndroidUtilities.dp(radii[0]), AndroidUtilities.dp(radii[0]), AndroidUtilities.dp(radii[0]), AndroidUtilities.dp(radii[0]), AndroidUtilities.dp(radii[0]), AndroidUtilities.dp(radii[0]), AndroidUtilities.dp(radii[0]), AndroidUtilities.dp(radii[0])} : radii.length == 2 ? new float[]{AndroidUtilities.dp(radii[0]), AndroidUtilities.dp(radii[0]), AndroidUtilities.dp(radii[0]), AndroidUtilities.dp(radii[0]), AndroidUtilities.dp(radii[1]), AndroidUtilities.dp(radii[1]), AndroidUtilities.dp(radii[1]), AndroidUtilities.dp(radii[1])} : radii.length == 3 ? new float[]{AndroidUtilities.dp(radii[0]), AndroidUtilities.dp(radii[0]), AndroidUtilities.dp(radii[1]), AndroidUtilities.dp(radii[1]), AndroidUtilities.dp(radii[2]), AndroidUtilities.dp(radii[2]), AndroidUtilities.dp(radii[2]), AndroidUtilities.dp(radii[2])} : radii.length < 8 ? new float[]{AndroidUtilities.dp(radii[0]), AndroidUtilities.dp(radii[0]), AndroidUtilities.dp(radii[1]), AndroidUtilities.dp(radii[1]), AndroidUtilities.dp(radii[2]), AndroidUtilities.dp(radii[2]), AndroidUtilities.dp(radii[3]), AndroidUtilities.dp(radii[3])} : new float[]{AndroidUtilities.dp(radii[0]), AndroidUtilities.dp(radii[1]), AndroidUtilities.dp(radii[2]), AndroidUtilities.dp(radii[3]), AndroidUtilities.dp(radii[4]), AndroidUtilities.dp(radii[5]), AndroidUtilities.dp(radii[6]), AndroidUtilities.dp(radii[7])};
        }

        public static boolean hasNonzeroRadii(float... radii) {
            for (int i = 0; i < Math.min(8, radii.length); i++) {
                if (radii[i] > 0.0f) {
                    return true;
                }
            }
            return false;
        }

        public static int calcRippleColor(int backgroundColor) {
            if (tempHSV == null) {
                tempHSV = new float[3];
            }
            Color.colorToHSV(backgroundColor, tempHSV);
            float[] fArr = tempHSV;
            if (fArr[1] > 0.01f) {
                fArr[1] = Math.min(1.0f, Math.max(0.0f, fArr[1] + (Theme.isCurrentThemeDark() ? 0.25f : -0.25f)));
                float[] fArr2 = tempHSV;
                fArr2[2] = Math.min(1.0f, Math.max(0.0f, fArr2[2] + (Theme.isCurrentThemeDark() ? 0.05f : -0.05f)));
            } else {
                fArr[2] = Math.min(1.0f, Math.max(0.0f, fArr[2] + (Theme.isCurrentThemeDark() ? 0.1f : -0.1f)));
            }
            return Color.HSVToColor(127, tempHSV);
        }
    }

    public static class RippleRadMaskDrawable extends Drawable {
        public float[] radii;
        public Path path = new Path();
        public boolean invalidatePath = true;

        @Override
        public int getOpacity() {
            return 0;
        }

        @Override
        public void setAlpha(int alpha) {
        }

        @Override
        public void setColorFilter(ColorFilter colorFilter) {
        }

        public RippleRadMaskDrawable(float top, float bottom) {
            this.radii = new float[]{r4, r4, r4, r4, 0.0f, 0.0f, 0.0f, 0.0f};
            float dp = AndroidUtilities.dp(top);
            float[] fArr = this.radii;
            float dp2 = AndroidUtilities.dp(bottom);
            fArr[7] = dp2;
            fArr[6] = dp2;
            fArr[5] = dp2;
            fArr[4] = dp2;
        }

        public RippleRadMaskDrawable(float topLeft, float topRight, float bottomRight, float bottomLeft) {
            float[] fArr = new float[8];
            this.radii = fArr;
            float dp = AndroidUtilities.dp(topLeft);
            fArr[1] = dp;
            fArr[0] = dp;
            float[] fArr2 = this.radii;
            float dp2 = AndroidUtilities.dp(topRight);
            fArr2[3] = dp2;
            fArr2[2] = dp2;
            float[] fArr3 = this.radii;
            float dp3 = AndroidUtilities.dp(bottomRight);
            fArr3[5] = dp3;
            fArr3[4] = dp3;
            float[] fArr4 = this.radii;
            float dp4 = AndroidUtilities.dp(bottomLeft);
            fArr4[7] = dp4;
            fArr4[6] = dp4;
        }

        public void setRadius(float top, float bottom) {
            float[] fArr = this.radii;
            float dp = AndroidUtilities.dp(top);
            fArr[3] = dp;
            fArr[2] = dp;
            fArr[1] = dp;
            fArr[0] = dp;
            float[] fArr2 = this.radii;
            float dp2 = AndroidUtilities.dp(bottom);
            fArr2[7] = dp2;
            fArr2[6] = dp2;
            fArr2[5] = dp2;
            fArr2[4] = dp2;
            this.invalidatePath = true;
            invalidateSelf();
        }

        public void setRadius(float topLeft, float topRight, float bottomRight, float bottomLeft) {
            float[] fArr = this.radii;
            float dp = AndroidUtilities.dp(topLeft);
            fArr[1] = dp;
            fArr[0] = dp;
            float[] fArr2 = this.radii;
            float dp2 = AndroidUtilities.dp(topRight);
            fArr2[3] = dp2;
            fArr2[2] = dp2;
            float[] fArr3 = this.radii;
            float dp3 = AndroidUtilities.dp(bottomRight);
            fArr3[5] = dp3;
            fArr3[4] = dp3;
            float[] fArr4 = this.radii;
            float dp4 = AndroidUtilities.dp(bottomLeft);
            fArr4[7] = dp4;
            fArr4[6] = dp4;
            this.invalidatePath = true;
            invalidateSelf();
        }

        @Override
        public void onBoundsChange(Rect bounds) {
            this.invalidatePath = true;
        }

        @Override
        public void draw(Canvas canvas) {
            if (this.invalidatePath) {
                this.invalidatePath = false;
                this.path.reset();
                RectF rectF = AndroidUtilities.rectTmp;
                rectF.set(getBounds());
                this.path.addRoundRect(rectF, this.radii, Path.Direction.CW);
            }
            canvas.drawPath(this.path, Theme.maskPaint);
        }
    }

    public static void setMaskDrawableRad(Drawable rippleDrawable, int top, int bottom) {
        if (Build.VERSION.SDK_INT >= 21 && (rippleDrawable instanceof RippleDrawable)) {
            RippleDrawable rippleDrawable2 = (RippleDrawable) rippleDrawable;
            int numberOfLayers = rippleDrawable2.getNumberOfLayers();
            for (int i = 0; i < numberOfLayers; i++) {
                Drawable drawable = rippleDrawable2.getDrawable(i);
                if (drawable instanceof RippleRadMaskDrawable) {
                    ((RippleRadMaskDrawable) drawable).setRadius(top, bottom);
                    return;
                }
            }
        }
    }

    public static void setMaskDrawableRad(Drawable rippleDrawable, float topLeftRad, float topRightRad, float bottomRightRad, float bottomLeftRad) {
        if (Build.VERSION.SDK_INT >= 21 && (rippleDrawable instanceof RippleDrawable)) {
            RippleDrawable rippleDrawable2 = (RippleDrawable) rippleDrawable;
            int numberOfLayers = rippleDrawable2.getNumberOfLayers();
            for (int i = 0; i < numberOfLayers; i++) {
                Drawable drawable = rippleDrawable2.getDrawable(i);
                if (drawable instanceof RippleRadMaskDrawable) {
                    ((RippleRadMaskDrawable) drawable).setRadius(topLeftRad, topRightRad, bottomRightRad, bottomLeftRad);
                    return;
                }
            }
        }
    }

    public static Drawable createRadSelectorDrawable(int color, int topRad, int bottomRad) {
        if (Build.VERSION.SDK_INT >= 21) {
            maskPaint.setColor(-1);
            return new BaseCell.RippleDrawableSafe(new ColorStateList(new int[][]{StateSet.WILD_CARD}, new int[]{color}), null, new RippleRadMaskDrawable(topRad, bottomRad));
        }
        StateListDrawable stateListDrawable = new StateListDrawable();
        stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, new ColorDrawable(color));
        stateListDrawable.addState(new int[]{android.R.attr.state_selected}, new ColorDrawable(color));
        stateListDrawable.addState(StateSet.WILD_CARD, new ColorDrawable(0));
        return stateListDrawable;
    }

    public static Drawable createRadSelectorDrawable(int color, int rippleColor, int topRad, int bottomRad) {
        if (Build.VERSION.SDK_INT >= 21) {
            maskPaint.setColor(-1);
            float f = topRad;
            float f2 = bottomRad;
            return new BaseCell.RippleDrawableSafe(new ColorStateList(new int[][]{StateSet.WILD_CARD}, new int[]{rippleColor}), createRoundRectDrawable(AndroidUtilities.dp(f), AndroidUtilities.dp(f2), color), new RippleRadMaskDrawable(f, f2));
        }
        float f3 = topRad;
        float f4 = bottomRad;
        Drawable createRoundRectDrawable = createRoundRectDrawable(AndroidUtilities.dp(f3), AndroidUtilities.dp(f4), color);
        LayerDrawable layerDrawable = new LayerDrawable(new Drawable[]{createRoundRectDrawable, createRoundRectDrawable(AndroidUtilities.dp(f3), AndroidUtilities.dp(f4), rippleColor)});
        StateListDrawable stateListDrawable = new StateListDrawable();
        stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, layerDrawable);
        stateListDrawable.addState(new int[]{android.R.attr.state_selected}, layerDrawable);
        stateListDrawable.addState(StateSet.WILD_CARD, createRoundRectDrawable);
        return stateListDrawable;
    }

    public static Drawable createRadSelectorDrawable(int color, int topLeftRad, int topRightRad, int bottomRightRad, int bottomLeftRad) {
        if (Build.VERSION.SDK_INT >= 21) {
            maskPaint.setColor(-1);
            return new BaseCell.RippleDrawableSafe(new ColorStateList(new int[][]{StateSet.WILD_CARD}, new int[]{color}), null, new RippleRadMaskDrawable(topLeftRad, topRightRad, bottomRightRad, bottomLeftRad));
        }
        StateListDrawable stateListDrawable = new StateListDrawable();
        stateListDrawable.addState(new int[]{android.R.attr.state_pressed}, new ColorDrawable(color));
        stateListDrawable.addState(new int[]{android.R.attr.state_selected}, new ColorDrawable(color));
        stateListDrawable.addState(StateSet.WILD_CARD, new ColorDrawable(0));
        return stateListDrawable;
    }

    public static void applyPreviousTheme() {
        ThemeInfo themeInfo;
        ThemeInfo themeInfo2 = previousTheme;
        if (themeInfo2 == null) {
            return;
        }
        hasPreviousTheme = false;
        if (isInNigthMode && (themeInfo = currentNightTheme) != null) {
            applyTheme(themeInfo, true, false, true);
        } else if (!isApplyingAccent) {
            applyTheme(themeInfo2, true, false, false);
        }
        isApplyingAccent = false;
        previousTheme = null;
        checkAutoNightThemeConditions();
    }

    public static void clearPreviousTheme() {
        if (previousTheme == null) {
            return;
        }
        hasPreviousTheme = false;
        isApplyingAccent = false;
        previousTheme = null;
    }

    public static void sortThemes() {
        Collections.sort(themes, new Comparator() {
            @Override
            public final int compare(Object obj, Object obj2) {
                int lambda$sortThemes$1;
                lambda$sortThemes$1 = Theme.lambda$sortThemes$1((Theme.ThemeInfo) obj, (Theme.ThemeInfo) obj2);
                return lambda$sortThemes$1;
            }
        });
    }

    public static int lambda$sortThemes$1(ThemeInfo themeInfo, ThemeInfo themeInfo2) {
        if (themeInfo.pathToFile == null && themeInfo.assetName == null) {
            return -1;
        }
        if (themeInfo2.pathToFile == null && themeInfo2.assetName == null) {
            return 1;
        }
        return themeInfo.name.compareTo(themeInfo2.name);
    }

    public static void applyThemeTemporary(ThemeInfo themeInfo, boolean accent) {
        previousTheme = getCurrentTheme();
        hasPreviousTheme = true;
        isApplyingAccent = accent;
        applyTheme(themeInfo, false, false, false);
    }

    public static boolean hasCustomWallpaper() {
        return isApplyingAccent && currentTheme.overrideWallpaper != null;
    }

    public static boolean isCustomWallpaperColor() {
        return hasCustomWallpaper() && currentTheme.overrideWallpaper.color != 0;
    }

    public static void resetCustomWallpaper(boolean temporary) {
        if (temporary) {
            isApplyingAccent = false;
            reloadWallpaper(true);
        } else {
            currentTheme.setOverrideWallpaper(null);
        }
    }

    public static ThemeInfo fillThemeValues(File file, String themeName, TLRPC.TL_theme theme) {
        String[] split;
        try {
            ThemeInfo themeInfo = new ThemeInfo();
            themeInfo.name = themeName;
            themeInfo.info = theme;
            themeInfo.pathToFile = file.getAbsolutePath();
            themeInfo.account = UserConfig.selectedAccount;
            String[] strArr = new String[1];
            checkIsDark(getThemeFileValues(new File(themeInfo.pathToFile), null, strArr), themeInfo);
            if (!TextUtils.isEmpty(strArr[0])) {
                String str = strArr[0];
                themeInfo.pathToWallpaper = new File(ApplicationLoader.getFilesDirFixed(), Utilities.MD5(str) + ".wp").getAbsolutePath();
                try {
                    Uri parse = Uri.parse(str);
                    themeInfo.slug = parse.getQueryParameter("slug");
                    String queryParameter = parse.getQueryParameter("mode");
                    if (queryParameter != null && (split = queryParameter.toLowerCase().split(" ")) != null && split.length > 0) {
                        for (int i = 0; i < split.length; i++) {
                            if ("blur".equals(split[i])) {
                                themeInfo.isBlured = true;
                            } else if ("motion".equals(split[i])) {
                                themeInfo.isMotion = true;
                            }
                        }
                    }
                    String queryParameter2 = parse.getQueryParameter("intensity");
                    if (!TextUtils.isEmpty(queryParameter2)) {
                        try {
                            String queryParameter3 = parse.getQueryParameter("bg_color");
                            if (!TextUtils.isEmpty(queryParameter3)) {
                                themeInfo.patternBgColor = Integer.parseInt(queryParameter3.substring(0, 6), 16) | (-16777216);
                                if (queryParameter3.length() >= 13 && AndroidUtilities.isValidWallChar(queryParameter3.charAt(6))) {
                                    themeInfo.patternBgGradientColor1 = Integer.parseInt(queryParameter3.substring(7, 13), 16) | (-16777216);
                                }
                                if (queryParameter3.length() >= 20 && AndroidUtilities.isValidWallChar(queryParameter3.charAt(13))) {
                                    themeInfo.patternBgGradientColor2 = Integer.parseInt(queryParameter3.substring(14, 20), 16) | (-16777216);
                                }
                                if (queryParameter3.length() == 27 && AndroidUtilities.isValidWallChar(queryParameter3.charAt(20))) {
                                    themeInfo.patternBgGradientColor3 = Integer.parseInt(queryParameter3.substring(21), 16) | (-16777216);
                                }
                            }
                        } catch (Exception unused) {
                        }
                        try {
                            String queryParameter4 = parse.getQueryParameter("rotation");
                            if (!TextUtils.isEmpty(queryParameter4)) {
                                themeInfo.patternBgGradientRotation = Utilities.parseInt(queryParameter4).intValue();
                            }
                        } catch (Exception unused2) {
                        }
                        if (!TextUtils.isEmpty(queryParameter2)) {
                            themeInfo.patternIntensity = Utilities.parseInt(queryParameter2).intValue();
                        }
                        if (themeInfo.patternIntensity == 0) {
                            themeInfo.patternIntensity = 50;
                        }
                    }
                } catch (Throwable th) {
                    FileLog.e(th);
                }
            } else {
                themedWallpaperLink = null;
            }
            return themeInfo;
        } catch (Exception e) {
            FileLog.e(e);
            return null;
        }
    }

    public static ThemeInfo applyThemeFile(File file, String themeName, TLRPC.TL_theme theme, boolean temporary) {
        File file2;
        String str;
        try {
            if (!themeName.toLowerCase().endsWith(".attheme")) {
                themeName = themeName + ".attheme";
            }
            if (temporary) {
                NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.goingToPreviewTheme, new Object[0]);
                ThemeInfo themeInfo = new ThemeInfo();
                themeInfo.name = themeName;
                themeInfo.info = theme;
                themeInfo.pathToFile = file.getAbsolutePath();
                themeInfo.account = UserConfig.selectedAccount;
                applyThemeTemporary(themeInfo, false);
                return themeInfo;
            }
            if (theme != null) {
                str = "remote" + theme.id;
                file2 = new File(ApplicationLoader.getFilesDirFixed(), str + ".attheme");
            } else {
                file2 = new File(ApplicationLoader.getFilesDirFixed(), themeName);
                str = themeName;
            }
            if (!AndroidUtilities.copyFile(file, file2)) {
                applyPreviousTheme();
                return null;
            }
            previousTheme = null;
            hasPreviousTheme = false;
            isApplyingAccent = false;
            ThemeInfo themeInfo2 = themesDict.get(str);
            if (themeInfo2 == null) {
                themeInfo2 = new ThemeInfo();
                themeInfo2.name = themeName;
                themeInfo2.account = UserConfig.selectedAccount;
                themes.add(themeInfo2);
                otherThemes.add(themeInfo2);
                sortThemes();
            } else {
                themesDict.remove(str);
            }
            themeInfo2.info = theme;
            themeInfo2.pathToFile = file2.getAbsolutePath();
            themesDict.put(themeInfo2.getKey(), themeInfo2);
            saveOtherThemes(true);
            applyTheme(themeInfo2, true, true, false);
            return themeInfo2;
        } catch (Exception e) {
            FileLog.e(e);
            return null;
        }
    }

    public static ThemeInfo getTheme(String key) {
        return themesDict.get(key);
    }

    public static void setUsePlusThemeKey(boolean value) {
        usePlusTheme = value;
        SharedPreferences.Editor edit = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0).edit();
        edit.putBoolean("usePlusTheme", value);
        edit.apply();
        if (!usePlusTheme || selectedAutoNightType == 0) {
            return;
        }
        selectedAutoNightType = 0;
        saveAutoNightThemeConfig();
        checkAutoNightThemeConditions();
    }

    public static void applyTheme(ThemeInfo themeInfo) {
        setUsePlusThemeKey(false);
        applyTheme(themeInfo, true, true, false);
    }

    public static void applyTheme(ThemeInfo themeInfo, boolean nightTheme) {
        applyTheme(themeInfo, true, nightTheme);
    }

    public static void applyThemeInBackground(ThemeInfo themeInfo, boolean nightTheme, Runnable onDone) {
        applyThemeInBackground(themeInfo, true, true, nightTheme, onDone);
    }

    public static void applyTheme(ThemeInfo themeInfo, boolean save, boolean nightTheme) {
        applyTheme(themeInfo, save, true, nightTheme);
    }

    public static void applyTheme(org.telegram.ui.ActionBar.Theme.ThemeInfo r8, boolean r9, boolean r10, final boolean r11) {
        throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.ActionBar.Theme.applyTheme(org.telegram.ui.ActionBar.Theme$ThemeInfo, boolean, boolean, boolean):void");
    }

    public static void applyThemeInBackground(final org.telegram.ui.ActionBar.Theme.ThemeInfo r9, final boolean r10, boolean r11, final boolean r12, final java.lang.Runnable r13) {
        throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.ActionBar.Theme.applyThemeInBackground(org.telegram.ui.ActionBar.Theme$ThemeInfo, boolean, boolean, boolean, java.lang.Runnable):void");
    }

    public static void lambda$applyThemeInBackground$2(String[] strArr, ThemeInfo themeInfo, boolean z, boolean z2, Runnable runnable) {
        String[] split;
        try {
            themedWallpaperFileOffset = currentColorsNoAccent.get(key_wallpaperFileOffset, -1);
            if (!TextUtils.isEmpty(strArr[0])) {
                themedWallpaperLink = strArr[0];
                String absolutePath = new File(ApplicationLoader.getFilesDirFixed(), Utilities.MD5(themedWallpaperLink) + ".wp").getAbsolutePath();
                try {
                    String str = themeInfo.pathToWallpaper;
                    if (str != null && !str.equals(absolutePath)) {
                        new File(themeInfo.pathToWallpaper).delete();
                    }
                } catch (Exception unused) {
                }
                themeInfo.pathToWallpaper = absolutePath;
                try {
                    Uri parse = Uri.parse(themedWallpaperLink);
                    themeInfo.slug = parse.getQueryParameter("slug");
                    String queryParameter = parse.getQueryParameter("mode");
                    if (queryParameter != null && (split = queryParameter.toLowerCase().split(" ")) != null && split.length > 0) {
                        for (int i = 0; i < split.length; i++) {
                            if ("blur".equals(split[i])) {
                                themeInfo.isBlured = true;
                            } else if ("motion".equals(split[i])) {
                                themeInfo.isMotion = true;
                            }
                        }
                    }
                    Utilities.parseInt(parse.getQueryParameter("intensity")).intValue();
                    themeInfo.patternBgGradientRotation = 45;
                    try {
                        String queryParameter2 = parse.getQueryParameter("bg_color");
                        if (!TextUtils.isEmpty(queryParameter2)) {
                            themeInfo.patternBgColor = Integer.parseInt(queryParameter2.substring(0, 6), 16) | (-16777216);
                            if (queryParameter2.length() >= 13 && AndroidUtilities.isValidWallChar(queryParameter2.charAt(6))) {
                                themeInfo.patternBgGradientColor1 = Integer.parseInt(queryParameter2.substring(7, 13), 16) | (-16777216);
                            }
                            if (queryParameter2.length() >= 20 && AndroidUtilities.isValidWallChar(queryParameter2.charAt(13))) {
                                themeInfo.patternBgGradientColor2 = Integer.parseInt(queryParameter2.substring(14, 20), 16) | (-16777216);
                            }
                            if (queryParameter2.length() == 27 && AndroidUtilities.isValidWallChar(queryParameter2.charAt(20))) {
                                themeInfo.patternBgGradientColor3 = Integer.parseInt(queryParameter2.substring(21), 16) | (-16777216);
                            }
                        }
                    } catch (Exception unused2) {
                    }
                    try {
                        String queryParameter3 = parse.getQueryParameter("rotation");
                        if (!TextUtils.isEmpty(queryParameter3)) {
                            themeInfo.patternBgGradientRotation = Utilities.parseInt(queryParameter3).intValue();
                        }
                    } catch (Exception unused3) {
                    }
                } catch (Throwable th) {
                    FileLog.e(th);
                }
            } else {
                try {
                    if (themeInfo.pathToWallpaper != null) {
                        new File(themeInfo.pathToWallpaper).delete();
                    }
                } catch (Exception unused4) {
                }
                themeInfo.pathToWallpaper = null;
                themedWallpaperLink = null;
            }
            if (!z && previousTheme == null) {
                currentDayTheme = themeInfo;
                if (isCurrentThemeNight()) {
                    switchNightThemeDelay = 2000;
                    lastDelayUpdateTime = SystemClock.elapsedRealtime();
                    AndroidUtilities.runOnUIThread(MessagesController$.ExternalSyntheticLambda292.INSTANCE, 2100L);
                }
            }
            currentTheme = themeInfo;
            refreshThemeColors();
        } catch (Exception e) {
            FileLog.e(e);
        }
        if (previousTheme == null && z2 && !switchingNightTheme) {
            MessagesController.getInstance(themeInfo.account).saveTheme(themeInfo, themeInfo.getAccent(false), z, false);
        }
        if (runnable != null) {
            runnable.run();
        }
    }

    public static void lambda$applyThemeInBackground$3(Runnable runnable, SparseIntArray sparseIntArray) {
        currentColorsNoAccent = sparseIntArray;
        runnable.run();
    }

    public static void lambda$applyThemeInBackground$4(Runnable runnable, SparseIntArray sparseIntArray) {
        currentColorsNoAccent = sparseIntArray;
        runnable.run();
    }

    public static boolean useBlackText(int color1, int color2) {
        float red = Color.red(color1) / 255.0f;
        float green = Color.green(color1) / 255.0f;
        float blue = Color.blue(color1) / 255.0f;
        return ((((red * 0.5f) + ((Color.red(color2) / 255.0f) * 0.5f)) * 0.2126f) + (((green * 0.5f) + ((Color.green(color2) / 255.0f) * 0.5f)) * 0.7152f)) + (((blue * 0.5f) + ((((float) Color.blue(color2)) / 255.0f) * 0.5f)) * 0.0722f) > 0.705f || ((red * 0.2126f) + (green * 0.7152f)) + (blue * 0.0722f) > 0.705f;
    }

    public static void refreshThemeColors() {
        refreshThemeColors(false, false);
    }

    public static void refreshThemeColors(boolean bg, boolean messages) {
        currentColors = currentColorsNoAccent.clone();
        shouldDrawGradientIcons = true;
        ThemeAccent accent = currentTheme.getAccent(false);
        if (accent != null) {
            shouldDrawGradientIcons = accent.fillAccentColors(currentColorsNoAccent, currentColors);
        }
        if (!messages) {
            reloadWallpaper(!(LaunchActivity.getLastFragment() instanceof ChatActivity));
        }
        applyCommonTheme();
        applyDialogsTheme();
        applyProfileTheme();
        applyChatTheme(false, bg);
        final boolean z = !hasPreviousTheme;
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                Theme.lambda$refreshThemeColors$5(z);
            }
        });
    }

    public static void lambda$refreshThemeColors$5(boolean z) {
        NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didSetNewTheme, new Object[]{Boolean.FALSE, Boolean.valueOf(z)});
    }

    public static void applyPlusTheme2(boolean applyDefTheme) {
        if (applyDefTheme) {
            try {
                applyTheme(getDefaultTheme());
            } catch (Exception e) {
                FileLog.e(e);
                return;
            }
        }
        if (!usePlusTheme) {
            usePlusTheme = true;
            SharedPreferences.Editor edit = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0).edit();
            edit.putBoolean("usePlusTheme", true);
            edit.apply();
        }
        SharedPreferences.Editor edit2 = MessagesController.getGlobalMainSettings().edit();
        edit2.putBoolean("overrideThemeWallpaper", true);
        edit2.commit();
        wallpaper = null;
        themedWallpaper = null;
        getPlusThemeFileValues(false);
        reloadWallpaper(true);
        applyCommonTheme();
        applyDialogsTheme();
        applyProfileTheme();
        applyChatTheme(false, false);
    }

    public static void applyPlusTheme(boolean plus) {
        try {
            getPlusThemeFileValues(true);
            reloadWallpaper(true);
            applyCommonTheme();
            applyDialogsTheme();
            applyProfileTheme();
            applyChatTheme(false, false);
        } catch (Exception e) {
            FileLog.e(e);
        }
    }

    public static void applyPlusTheme() {
        try {
            if (!usePlusTheme) {
                usePlusTheme = true;
                SharedPreferences.Editor edit = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0).edit();
                edit.putBoolean("usePlusTheme", true);
                edit.commit();
            }
            getPlusThemeFileValues(true);
            reloadWallpaper(true);
            applyCommonTheme();
            applyDialogsTheme();
            applyProfileTheme();
            applyChatTheme(false, false);
        } catch (Exception e) {
            FileLog.e(e);
        }
    }

    public static void getPlusThemeFileValues(boolean savePrev) {
        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0);
        usePlusTheme = sharedPreferences.getBoolean("usePlusTheme", true);
        SharedPreferences sharedPreferences2 = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
        String string = sharedPreferences2.getString("prevTheme", null);
        if (savePrev && usePlusTheme && string == null) {
            SharedPreferences.Editor edit = sharedPreferences2.edit();
            edit.putString("prevTheme", getCurrentTheme().name);
            edit.commit();
            applyTheme(getDefaultTheme());
        }
        Map<String, ?> all = sharedPreferences.getAll();
        currentPlusTheme = all;
        try {
            for (Map.Entry<String, ?> entry : all.entrySet()) {
                if (entry.getValue() instanceof Integer) {
                    currentPlusColors.put(entry.getKey(), (Integer) entry.getValue());
                }
            }
        } catch (Throwable th) {
            FileLog.e(th);
        }
    }

    public static boolean hasHue(int color) {
        float[] tempHsv = getTempHsv(3);
        Color.colorToHSV(color, tempHsv);
        return tempHsv[1] > 0.1f && tempHsv[1] < 0.9f;
    }

    public static int changeColorAccent(int themeBaseAccent, int accent, int color, boolean isDark, int fallback) {
        float[] tempHsv = getTempHsv(3);
        float[] tempHsv2 = getTempHsv(4);
        Color.colorToHSV(themeBaseAccent, tempHsv);
        Color.colorToHSV(accent, tempHsv2);
        return changeColorAccent(tempHsv, tempHsv2, color, isDark, fallback);
    }

    public static ThemeInfo getDefaultTheme() {
        return defaultTheme;
    }

    public static HashMap<String, ThemeInfo> getThemeList() {
        return themesDict;
    }

    public static int changeColorAccent(ThemeInfo themeInfo, int accent, int color) {
        int i;
        if (accent == 0 || (i = themeInfo.accentBaseColor) == 0 || accent == i || (themeInfo.firstAccentIsDefault && themeInfo.currentAccentId == DEFALT_THEME_ACCENT_ID)) {
            return color;
        }
        float[] tempHsv = getTempHsv(3);
        float[] tempHsv2 = getTempHsv(4);
        Color.colorToHSV(themeInfo.accentBaseColor, tempHsv);
        Color.colorToHSV(accent, tempHsv2);
        return changeColorAccent(tempHsv, tempHsv2, color, themeInfo.isDark(), color);
    }

    public static float[] getTempHsv(int num) {
        ThreadLocal<float[]> threadLocal;
        if (num == 1) {
            threadLocal = hsvTemp1Local;
        } else if (num == 2) {
            threadLocal = hsvTemp2Local;
        } else if (num == 3) {
            threadLocal = hsvTemp3Local;
        } else if (num == 4) {
            threadLocal = hsvTemp4Local;
        } else {
            threadLocal = hsvTemp5Local;
        }
        float[] fArr = threadLocal.get();
        if (fArr != null) {
            return fArr;
        }
        float[] fArr2 = new float[3];
        threadLocal.set(fArr2);
        return fArr2;
    }

    public static int getAccentColor(float[] baseHsv, int baseColor, int elementColor) {
        float[] tempHsv = getTempHsv(3);
        float[] tempHsv2 = getTempHsv(4);
        Color.colorToHSV(baseColor, tempHsv);
        Color.colorToHSV(elementColor, tempHsv2);
        float min = Math.min((tempHsv[1] * 1.5f) / baseHsv[1], 1.0f);
        tempHsv[0] = (tempHsv2[0] - tempHsv[0]) + baseHsv[0];
        tempHsv[1] = (tempHsv2[1] * baseHsv[1]) / tempHsv[1];
        tempHsv[2] = ((((tempHsv2[2] / tempHsv[2]) + min) - 1.0f) * baseHsv[2]) / min;
        return tempHsv[2] < 0.3f ? elementColor : Color.HSVToColor(255, tempHsv);
    }

    public static int changeColorAccent(int color) {
        ThemeAccent accent = currentTheme.getAccent(false);
        return changeColorAccent(currentTheme, accent != null ? accent.accentColor : 0, color);
    }

    public static int changeColorAccent(float[] baseHsv, float[] accentHsv, int color, boolean isDarkTheme, int fallback) {
        if (tmpHSV5 == null) {
            tmpHSV5 = new float[3];
        }
        float[] fArr = tmpHSV5;
        Color.colorToHSV(color, fArr);
        boolean z = false;
        if (Math.min(abs(fArr[0] - baseHsv[0]), abs((fArr[0] - baseHsv[0]) - 360.0f)) > 30.0f) {
            return fallback;
        }
        float min = Math.min((fArr[1] * 1.5f) / baseHsv[1], 1.0f);
        fArr[0] = (fArr[0] + accentHsv[0]) - baseHsv[0];
        fArr[1] = (fArr[1] * accentHsv[1]) / baseHsv[1];
        fArr[2] = fArr[2] * ((1.0f - min) + ((min * accentHsv[2]) / baseHsv[2]));
        int HSVToColor = Color.HSVToColor(Color.alpha(color), fArr);
        float computePerceivedBrightness = AndroidUtilities.computePerceivedBrightness(color);
        float computePerceivedBrightness2 = AndroidUtilities.computePerceivedBrightness(HSVToColor);
        if (!isDarkTheme ? computePerceivedBrightness < computePerceivedBrightness2 : computePerceivedBrightness > computePerceivedBrightness2) {
            z = true;
        }
        return z ? changeBrightness(HSVToColor, ((0.39999998f * computePerceivedBrightness) / computePerceivedBrightness2) + 0.6f) : HSVToColor;
    }

    public static int changeBrightness(int color, float amount) {
        int red = (int) (Color.red(color) * amount);
        int green = (int) (Color.green(color) * amount);
        int blue = (int) (Color.blue(color) * amount);
        return Color.argb(Color.alpha(color), red < 0 ? 0 : Math.min(red, 255), green < 0 ? 0 : Math.min(green, 255), blue >= 0 ? Math.min(blue, 255) : 0);
    }

    public static boolean deleteThemeAccent(ThemeInfo theme, ThemeAccent accent, boolean save) {
        boolean z = false;
        if (accent == null || theme == null || theme.themeAccents == null) {
            return false;
        }
        boolean z2 = accent.id == theme.currentAccentId;
        File pathToWallpaper = accent.getPathToWallpaper();
        if (pathToWallpaper != null) {
            pathToWallpaper.delete();
        }
        theme.themeAccentsMap.remove(accent.id);
        theme.themeAccents.remove(accent);
        TLRPC.TL_theme tL_theme = accent.info;
        if (tL_theme != null) {
            theme.accentsByThemeId.remove(tL_theme.id);
        }
        OverrideWallpaperInfo overrideWallpaperInfo = accent.overrideWallpaper;
        if (overrideWallpaperInfo != null) {
            overrideWallpaperInfo.delete();
        }
        if (z2) {
            theme.setCurrentAccentId(theme.themeAccents.get(0).id);
        }
        if (save) {
            saveThemeAccents(theme, true, false, false, false);
            if (accent.info != null) {
                MessagesController messagesController = MessagesController.getInstance(accent.account);
                if (z2 && theme == currentNightTheme) {
                    z = true;
                }
                messagesController.saveTheme(theme, accent, z, true);
            }
        }
        return z2;
    }

    public static void saveThemeAccents(ThemeInfo theme, boolean save, boolean remove, boolean indexOnly, boolean upload) {
        saveThemeAccents(theme, save, remove, indexOnly, upload, false);
    }

    public static void saveThemeAccents(ThemeInfo theme, boolean save, boolean remove, boolean indexOnly, boolean upload, boolean migration) {
        if (save) {
            SharedPreferences.Editor edit = ApplicationLoader.applicationContext.getSharedPreferences("themeconfig", 0).edit();
            if (!indexOnly) {
                int size = theme.themeAccents.size();
                int max = Math.max(0, size - theme.defaultAccentCount);
                SerializedData serializedData = new SerializedData(((max * 16) + 2) * 4);
                serializedData.writeInt32(9);
                serializedData.writeInt32(max);
                for (int i = 0; i < size; i++) {
                    ThemeAccent themeAccent = theme.themeAccents.get(i);
                    int i2 = themeAccent.id;
                    if (i2 >= 100) {
                        serializedData.writeInt32(i2);
                        serializedData.writeInt32(themeAccent.accentColor);
                        serializedData.writeInt32(themeAccent.accentColor2);
                        serializedData.writeInt32(themeAccent.myMessagesAccentColor);
                        serializedData.writeInt32(themeAccent.myMessagesGradientAccentColor1);
                        serializedData.writeInt32(themeAccent.myMessagesGradientAccentColor2);
                        serializedData.writeInt32(themeAccent.myMessagesGradientAccentColor3);
                        serializedData.writeBool(themeAccent.myMessagesAnimated);
                        serializedData.writeInt64(themeAccent.backgroundOverrideColor);
                        serializedData.writeInt64(themeAccent.backgroundGradientOverrideColor1);
                        serializedData.writeInt64(themeAccent.backgroundGradientOverrideColor2);
                        serializedData.writeInt64(themeAccent.backgroundGradientOverrideColor3);
                        serializedData.writeInt32(themeAccent.backgroundRotation);
                        serializedData.writeInt64(0L);
                        serializedData.writeDouble(themeAccent.patternIntensity);
                        serializedData.writeBool(themeAccent.patternMotion);
                        serializedData.writeString(themeAccent.patternSlug);
                        serializedData.writeBool(themeAccent.info != null);
                        if (themeAccent.info != null) {
                            serializedData.writeInt32(themeAccent.account);
                            themeAccent.info.serializeToStream(serializedData);
                        }
                    }
                }
                edit.putString("accents_" + theme.assetName, Base64.encodeToString(serializedData.toByteArray(), 3));
                if (!migration) {
                    NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.themeAccentListUpdated, new Object[0]);
                }
                if (upload) {
                    MessagesController.getInstance(UserConfig.selectedAccount).saveThemeToServer(theme, theme.getAccent(false));
                }
            }
            edit.putInt("accent_current_" + theme.assetName, theme.currentAccentId);
            edit.commit();
        } else {
            if (theme.prevAccentId != -1) {
                if (remove) {
                    ThemeAccent themeAccent2 = theme.themeAccentsMap.get(theme.currentAccentId);
                    theme.themeAccentsMap.remove(themeAccent2.id);
                    theme.themeAccents.remove(themeAccent2);
                    TLRPC.TL_theme tL_theme = themeAccent2.info;
                    if (tL_theme != null) {
                        theme.accentsByThemeId.remove(tL_theme.id);
                    }
                }
                theme.currentAccentId = theme.prevAccentId;
                ThemeAccent accent = theme.getAccent(false);
                if (accent != null) {
                    theme.overrideWallpaper = accent.overrideWallpaper;
                } else {
                    theme.overrideWallpaper = null;
                }
            }
            if (currentTheme == theme) {
                refreshThemeColors();
            }
        }
        theme.prevAccentId = -1;
    }

    public static void saveOtherThemes(boolean full) {
        saveOtherThemes(full, false);
    }

    public static void saveOtherThemes(boolean full, boolean migration) {
        ArrayList<ThemeAccent> arrayList;
        int i = 0;
        SharedPreferences.Editor edit = ApplicationLoader.applicationContext.getSharedPreferences("themeconfig", 0).edit();
        if (full) {
            JSONArray jSONArray = new JSONArray();
            for (int i2 = 0; i2 < otherThemes.size(); i2++) {
                JSONObject saveJson = otherThemes.get(i2).getSaveJson();
                if (saveJson != null) {
                    jSONArray.put(saveJson);
                }
            }
            edit.putString("themes2", jSONArray.toString());
        }
        int i3 = 0;
        while (i3 < UserConfig.MAX_ACCOUNT_COUNT) {
            StringBuilder sb = new StringBuilder();
            sb.append("2remoteThemesHash");
            Object obj = "";
            sb.append(i3 != 0 ? Integer.valueOf(i3) : "");
            edit.putLong(sb.toString(), remoteThemesHash[i3]);
            StringBuilder sb2 = new StringBuilder();
            sb2.append("lastLoadingThemesTime");
            if (i3 != 0) {
                obj = Integer.valueOf(i3);
            }
            sb2.append(obj);
            edit.putInt(sb2.toString(), lastLoadingThemesTime[i3]);
            i3++;
        }
        edit.putInt("lastLoadingCurrentThemeTime", lastLoadingCurrentThemeTime);
        edit.commit();
        if (full) {
            while (i < 5) {
                ThemeInfo themeInfo = themesDict.get(i != 0 ? i != 1 ? i != 2 ? i != 3 ? "Night" : "Day" : "Arctic Blue" : "Dark Blue" : "Blue");
                if (themeInfo != null && (arrayList = themeInfo.themeAccents) != null && !arrayList.isEmpty()) {
                    saveThemeAccents(themeInfo, true, false, false, false, migration);
                }
                i++;
            }
        }
    }

    public static int[] getDefaultColors() {
        return defaultColors;
    }

    public static ThemeInfo getPreviousTheme() {
        return previousTheme;
    }

    public static String getCurrentNightThemeName() {
        ThemeInfo themeInfo = currentNightTheme;
        if (themeInfo == null) {
            return "";
        }
        String name = themeInfo.getName();
        return name.toLowerCase().endsWith(".attheme") ? name.substring(0, name.lastIndexOf(46)) : name;
    }

    public static ThemeInfo getCurrentTheme() {
        ThemeInfo themeInfo = currentDayTheme;
        return themeInfo != null ? themeInfo : defaultTheme;
    }

    public static ThemeInfo getCurrentNightTheme() {
        return currentNightTheme;
    }

    public static boolean isCurrentThemeNight() {
        return currentTheme == currentNightTheme;
    }

    public static boolean isCurrentThemeDark() {
        return currentTheme.isDark();
    }

    public static ThemeInfo getActiveTheme() {
        return currentTheme;
    }

    public static long getAutoNightSwitchThemeDelay() {
        return Math.abs(lastThemeSwitchTime - SystemClock.elapsedRealtime()) >= 12000 ? 1800L : 12000L;
    }

    public static void setCurrentNightTheme(ThemeInfo theme) {
        boolean z = currentTheme == currentNightTheme;
        currentNightTheme = theme;
        if (z) {
            applyDayNightThemeMaybe(true);
        }
    }

    public static void checkAutoNightThemeConditions() {
        checkAutoNightThemeConditions(false);
    }

    public static void cancelAutoNightThemeCallbacks() {
        if (selectedAutoNightType != 2) {
            if (switchNightRunnableScheduled) {
                switchNightRunnableScheduled = false;
                AndroidUtilities.cancelRunOnUIThread(switchNightBrightnessRunnable);
            }
            if (switchDayRunnableScheduled) {
                switchDayRunnableScheduled = false;
                AndroidUtilities.cancelRunOnUIThread(switchDayBrightnessRunnable);
            }
            if (lightSensorRegistered) {
                lastBrightnessValue = 1.0f;
                sensorManager.unregisterListener(ambientSensorListener, lightSensor);
                lightSensorRegistered = false;
                if (BuildVars.LOGS_ENABLED) {
                    FileLog.d("light sensor unregistered");
                }
            }
        }
    }

    public static int needSwitchToTheme() {
        Sensor sensor;
        SensorEventListener sensorEventListener;
        int i;
        int i2;
        int i3 = selectedAutoNightType;
        if (i3 == 1) {
            if (usePlusTheme) {
                setUsePlusThemeKey(false);
            }
            Calendar calendar = Calendar.getInstance();
            calendar.setTimeInMillis(System.currentTimeMillis());
            int i4 = (calendar.get(11) * 60) + calendar.get(12);
            if (autoNightScheduleByLocation) {
                int i5 = calendar.get(5);
                if (autoNightLastSunCheckDay != i5) {
                    double d = autoNightLocationLatitude;
                    if (d != 10000.0d) {
                        double d2 = autoNightLocationLongitude;
                        if (d2 != 10000.0d) {
                            int[] calculateSunriseSunset = SunDate.calculateSunriseSunset(d, d2);
                            autoNightSunriseTime = calculateSunriseSunset[0];
                            autoNightSunsetTime = calculateSunriseSunset[1];
                            autoNightLastSunCheckDay = i5;
                            saveAutoNightThemeConfig();
                        }
                    }
                }
                i = autoNightSunsetTime;
                i2 = autoNightSunriseTime;
            } else {
                i = autoNightDayStartTime;
                i2 = autoNightDayEndTime;
            }
            return i < i2 ? (i > i4 || i4 > i2) ? 1 : 2 : ((i > i4 || i4 > 1440) && (i4 < 0 || i4 > i2)) ? 1 : 2;
        }
        if (i3 == 2) {
            if (usePlusTheme) {
                setUsePlusThemeKey(false);
            }
            if (lightSensor == null) {
                SensorManager sensorManager2 = (SensorManager) ApplicationLoader.applicationContext.getSystemService("sensor");
                sensorManager = sensorManager2;
                lightSensor = sensorManager2.getDefaultSensor(5);
            }
            if (!lightSensorRegistered && (sensor = lightSensor) != null && (sensorEventListener = ambientSensorListener) != null) {
                sensorManager.registerListener(sensorEventListener, sensor, 500000);
                lightSensorRegistered = true;
                if (BuildVars.LOGS_ENABLED) {
                    FileLog.d("light sensor registered");
                }
            }
            if (lastBrightnessValue <= autoNightBrighnessThreshold) {
                if (!switchNightRunnableScheduled) {
                    return 2;
                }
            } else if (!switchDayRunnableScheduled) {
                return 1;
            }
        } else if (i3 == 3) {
            int i6 = ApplicationLoader.applicationContext.getResources().getConfiguration().uiMode & 48;
            if (i6 == 0 || i6 == 16) {
                return 1;
            }
            if (i6 == 32) {
                return 2;
            }
        } else if (i3 == 0) {
            return 1;
        }
        return 0;
    }

    public static void setChangingWallpaper(boolean value) {
        changingWallpaper = value;
        if (value) {
            return;
        }
        checkAutoNightThemeConditions(false);
    }

    public static void checkAutoNightThemeConditions(boolean force) {
        if (previousTheme != null || changingWallpaper) {
            return;
        }
        if (!force && switchNightThemeDelay > 0) {
            long elapsedRealtime = SystemClock.elapsedRealtime();
            long j = elapsedRealtime - lastDelayUpdateTime;
            lastDelayUpdateTime = elapsedRealtime;
            int i = (int) (switchNightThemeDelay - j);
            switchNightThemeDelay = i;
            if (i > 0) {
                return;
            }
        }
        if (force) {
            if (switchNightRunnableScheduled) {
                switchNightRunnableScheduled = false;
                AndroidUtilities.cancelRunOnUIThread(switchNightBrightnessRunnable);
            }
            if (switchDayRunnableScheduled) {
                switchDayRunnableScheduled = false;
                AndroidUtilities.cancelRunOnUIThread(switchDayBrightnessRunnable);
            }
        }
        cancelAutoNightThemeCallbacks();
        int needSwitchToTheme = needSwitchToTheme();
        if (needSwitchToTheme != 0) {
            applyDayNightThemeMaybe(needSwitchToTheme == 2);
        }
        if (force) {
            lastThemeSwitchTime = 0L;
        }
    }

    public static void setPlusNightThemeCheck(boolean night) {
        plusNightModeCheck = night;
        ApplicationLoader.applicationContext.getSharedPreferences("plusconfig", 0).edit().putBoolean("nightModeCheck", plusNightModeCheck).apply();
    }

    public static void applyDayNightThemeMaybe(boolean night) {
        if (previousTheme != null) {
            return;
        }
        if (night) {
            ThemeInfo themeInfo = currentTheme;
            ThemeInfo themeInfo2 = currentNightTheme;
            if (themeInfo != themeInfo2) {
                if (themeInfo == null || !(themeInfo2 == null || themeInfo.isDark() == currentNightTheme.isDark())) {
                    setPlusNightThemeCheck(true);
                    isInNigthMode = true;
                    lastThemeSwitchTime = SystemClock.elapsedRealtime();
                    switchingNightTheme = true;
                    NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needSetDayNightTheme, new Object[]{currentNightTheme, Boolean.TRUE, null, -1});
                    switchingNightTheme = false;
                    return;
                }
                return;
            }
            return;
        }
        ThemeInfo themeInfo3 = currentTheme;
        ThemeInfo themeInfo4 = currentDayTheme;
        if (themeInfo3 != themeInfo4) {
            if (themeInfo3 == null || !(themeInfo4 == null || themeInfo3.isLight() == currentDayTheme.isLight())) {
                setPlusNightThemeCheck(false);
                isInNigthMode = false;
                lastThemeSwitchTime = SystemClock.elapsedRealtime();
                switchingNightTheme = true;
                NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needSetDayNightTheme, new Object[]{currentDayTheme, Boolean.TRUE, null, -1});
                switchingNightTheme = false;
            }
        }
    }

    public static boolean deleteTheme(ThemeInfo themeInfo) {
        boolean z = false;
        if (themeInfo.pathToFile == null) {
            return false;
        }
        if (currentTheme == themeInfo) {
            applyTheme(defaultTheme, true, false, false);
            z = true;
        }
        if (themeInfo == currentNightTheme) {
            currentNightTheme = themesDict.get("Dark Blue");
        }
        themeInfo.removeObservers();
        otherThemes.remove(themeInfo);
        themesDict.remove(themeInfo.name);
        OverrideWallpaperInfo overrideWallpaperInfo = themeInfo.overrideWallpaper;
        if (overrideWallpaperInfo != null) {
            overrideWallpaperInfo.delete();
        }
        themes.remove(themeInfo);
        new File(themeInfo.pathToFile).delete();
        saveOtherThemes(true);
        return z;
    }

    public static ThemeInfo createNewTheme(String name) {
        ThemeInfo themeInfo = new ThemeInfo();
        themeInfo.pathToFile = new File(ApplicationLoader.getFilesDirFixed(), "theme" + Utilities.random.nextLong() + ".attheme").getAbsolutePath();
        themeInfo.name = name;
        themedWallpaperLink = getWallpaperUrl(currentTheme.overrideWallpaper);
        themeInfo.account = UserConfig.selectedAccount;
        saveCurrentTheme(themeInfo, true, true, false);
        return themeInfo;
    }

    public static String getWallpaperUrl(OverrideWallpaperInfo wallpaperInfo) {
        String str;
        if (wallpaperInfo == null || TextUtils.isEmpty(wallpaperInfo.slug) || wallpaperInfo.slug.equals("d")) {
            return null;
        }
        StringBuilder sb = new StringBuilder();
        if (wallpaperInfo.isBlurred) {
            sb.append("blur");
        }
        if (wallpaperInfo.isMotion) {
            if (sb.length() > 0) {
                sb.append("+");
            }
            sb.append("motion");
        }
        int i = wallpaperInfo.color;
        if (i == 0) {
            str = "https://attheme.org?slug=" + wallpaperInfo.slug;
        } else {
            String lowerCase = String.format("%02x%02x%02x", Integer.valueOf(((byte) (i >> 16)) & 255), Integer.valueOf(((byte) (wallpaperInfo.color >> 8)) & 255), Byte.valueOf((byte) (wallpaperInfo.color & 255))).toLowerCase();
            int i2 = wallpaperInfo.gradientColor1;
            String lowerCase2 = i2 != 0 ? String.format("%02x%02x%02x", Integer.valueOf(((byte) (i2 >> 16)) & 255), Integer.valueOf(((byte) (wallpaperInfo.gradientColor1 >> 8)) & 255), Byte.valueOf((byte) (wallpaperInfo.gradientColor1 & 255))).toLowerCase() : null;
            int i3 = wallpaperInfo.gradientColor2;
            String lowerCase3 = i3 != 0 ? String.format("%02x%02x%02x", Integer.valueOf(((byte) (i3 >> 16)) & 255), Integer.valueOf(((byte) (wallpaperInfo.gradientColor2 >> 8)) & 255), Byte.valueOf((byte) (wallpaperInfo.gradientColor2 & 255))).toLowerCase() : null;
            int i4 = wallpaperInfo.gradientColor3;
            String lowerCase4 = i4 != 0 ? String.format("%02x%02x%02x", Integer.valueOf(((byte) (i4 >> 16)) & 255), Integer.valueOf(((byte) (wallpaperInfo.gradientColor3 >> 8)) & 255), Byte.valueOf((byte) (wallpaperInfo.gradientColor3 & 255))).toLowerCase() : null;
            if (lowerCase2 == null || lowerCase3 == null) {
                if (lowerCase2 != null) {
                    lowerCase = (lowerCase + "-" + lowerCase2) + "&rotation=" + wallpaperInfo.rotation;
                }
            } else if (lowerCase4 != null) {
                lowerCase = lowerCase + "~" + lowerCase2 + "~" + lowerCase3 + "~" + lowerCase4;
            } else {
                lowerCase = lowerCase + "~" + lowerCase2 + "~" + lowerCase3;
            }
            str = "https://attheme.org?slug=" + wallpaperInfo.slug + "&intensity=" + ((int) (wallpaperInfo.intensity * 100.0f)) + "&bg_color=" + lowerCase;
        }
        if (sb.length() <= 0) {
            return str;
        }
        return str + "&mode=" + sb.toString();
    }

    public static void saveCurrentTheme(org.telegram.ui.ActionBar.Theme.ThemeInfo r15, boolean r16, boolean r17, boolean r18) {
        throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.ActionBar.Theme.saveCurrentTheme(org.telegram.ui.ActionBar.Theme$ThemeInfo, boolean, boolean, boolean):void");
    }

    public static void checkCurrentRemoteTheme(boolean force) {
        int i;
        if (loadingCurrentTheme == 0) {
            if (force || Math.abs((System.currentTimeMillis() / 1000) - lastLoadingCurrentThemeTime) >= 3600) {
                int i2 = 0;
                while (i2 < 2) {
                    final ThemeInfo themeInfo = i2 == 0 ? currentDayTheme : currentNightTheme;
                    if ((themeInfo == null || UserConfig.MAX_ACCOUNT_COUNT > themeInfo.account) && themeInfo != null && UserConfig.getInstance(themeInfo.account).isClientActivated()) {
                        final ThemeAccent accent = themeInfo.getAccent(false);
                        final TLRPC.TL_theme tL_theme = themeInfo.info;
                        if (tL_theme != null) {
                            i = themeInfo.account;
                        } else if (accent != null && (tL_theme = accent.info) != null) {
                            i = UserConfig.selectedAccount;
                        }
                        if (tL_theme != null && tL_theme.document != null) {
                            loadingCurrentTheme++;
                            TLRPC.TL_account_getTheme tL_account_getTheme = new TLRPC.TL_account_getTheme();
                            tL_account_getTheme.document_id = tL_theme.document.id;
                            tL_account_getTheme.format = "android";
                            TLRPC.TL_inputTheme tL_inputTheme = new TLRPC.TL_inputTheme();
                            tL_inputTheme.access_hash = tL_theme.access_hash;
                            tL_inputTheme.id = tL_theme.id;
                            tL_account_getTheme.theme = tL_inputTheme;
                            ConnectionsManager.getInstance(i).sendRequest(tL_account_getTheme, new RequestDelegate() {
                                public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                                    Theme.lambda$checkCurrentRemoteTheme$7(Theme.ThemeAccent.this, themeInfo, tL_theme, tLObject, tL_error);
                                }
                            });
                        }
                    }
                    i2++;
                }
            }
        }
    }

    public static void lambda$checkCurrentRemoteTheme$7(final ThemeAccent themeAccent, final ThemeInfo themeInfo, final TLRPC.TL_theme tL_theme, final TLObject tLObject, TLRPC.TL_error tL_error) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                Theme.lambda$checkCurrentRemoteTheme$6(tLObject, themeAccent, themeInfo, tL_theme);
            }
        });
    }

    public static void lambda$checkCurrentRemoteTheme$6(org.telegram.tgnet.TLObject r7, org.telegram.ui.ActionBar.Theme.ThemeAccent r8, org.telegram.ui.ActionBar.Theme.ThemeInfo r9, org.telegram.tgnet.TLRPC.TL_theme r10) {
        throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.ActionBar.Theme.lambda$checkCurrentRemoteTheme$6(org.telegram.tgnet.TLObject, org.telegram.ui.ActionBar.Theme$ThemeAccent, org.telegram.ui.ActionBar.Theme$ThemeInfo, org.telegram.tgnet.TLRPC$TL_theme):void");
    }

    public static void loadRemoteThemes(final int currentAccount, boolean force) {
        if (loadingRemoteThemes[currentAccount]) {
            return;
        }
        if ((force || Math.abs((System.currentTimeMillis() / 1000) - lastLoadingThemesTime[currentAccount]) >= 3600) && UserConfig.getInstance(currentAccount).isClientActivated()) {
            if (UserConfig.getInstance(currentAccount).getCurrentUser() == null || !UserConfig.getInstance(currentAccount).getCurrentUser().bot) {
                loadingRemoteThemes[currentAccount] = true;
                TLRPC.TL_account_getThemes tL_account_getThemes = new TLRPC.TL_account_getThemes();
                tL_account_getThemes.format = "android";
                if (!MediaDataController.getInstance(currentAccount).defaultEmojiThemes.isEmpty()) {
                    tL_account_getThemes.hash = remoteThemesHash[currentAccount];
                }
                if (BuildVars.LOGS_ENABLED) {
                    Log.i("theme", "loading remote themes, hash " + tL_account_getThemes.hash);
                }
                ConnectionsManager.getInstance(currentAccount).sendRequest(tL_account_getThemes, new RequestDelegate() {
                    public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
                        Theme.lambda$loadRemoteThemes$9(currentAccount, tLObject, tL_error);
                    }
                });
            }
        }
    }

    public static void lambda$loadRemoteThemes$9(final int i, final TLObject tLObject, TLRPC.TL_error tL_error) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                Theme.lambda$loadRemoteThemes$8(i, tLObject);
            }
        });
    }

    public static void lambda$loadRemoteThemes$8(int r18, org.telegram.tgnet.TLObject r19) {
        throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.ActionBar.Theme.lambda$loadRemoteThemes$8(int, org.telegram.tgnet.TLObject):void");
    }

    public static String getBaseThemeKey(TLRPC.ThemeSettings settings) {
        TLRPC.BaseTheme baseTheme = settings.base_theme;
        if (baseTheme instanceof TLRPC.TL_baseThemeClassic) {
            return "Blue";
        }
        if (baseTheme instanceof TLRPC.TL_baseThemeDay) {
            return "Day";
        }
        if (baseTheme instanceof TLRPC.TL_baseThemeTinted) {
            return "Dark Blue";
        }
        if (baseTheme instanceof TLRPC.TL_baseThemeArctic) {
            return "Arctic Blue";
        }
        if (baseTheme instanceof TLRPC.TL_baseThemeNight) {
            return "Night";
        }
        return null;
    }

    public static TLRPC.BaseTheme getBaseThemeByKey(String key) {
        if ("Blue".equals(key)) {
            return new TLRPC.TL_baseThemeClassic();
        }
        if ("Day".equals(key)) {
            return new TLRPC.TL_baseThemeDay();
        }
        if ("Dark Blue".equals(key)) {
            return new TLRPC.TL_baseThemeTinted();
        }
        if ("Arctic Blue".equals(key)) {
            return new TLRPC.TL_baseThemeArctic();
        }
        if ("Night".equals(key)) {
            return new TLRPC.TL_baseThemeNight();
        }
        return null;
    }

    public static void setThemeFileReference(TLRPC.TL_theme info) {
        TLRPC.Document document;
        int size = themes.size();
        for (int i = 0; i < size; i++) {
            TLRPC.TL_theme tL_theme = themes.get(i).info;
            if (tL_theme != null && tL_theme.id == info.id) {
                TLRPC.Document document2 = tL_theme.document;
                if (document2 == null || (document = info.document) == null) {
                    return;
                }
                document2.file_reference = document.file_reference;
                saveOtherThemes(true);
                return;
            }
        }
    }

    public static boolean isThemeInstalled(ThemeInfo themeInfo) {
        return (themeInfo == null || themesDict.get(themeInfo.getKey()) == null) ? false : true;
    }

    public static void setThemeUploadInfo(ThemeInfo theme, ThemeAccent accent, TLRPC.TL_theme info, int account, boolean update) {
        String str;
        TLRPC.WallPaperSettings wallPaperSettings;
        if (info == null) {
            return;
        }
        TLRPC.ThemeSettings themeSettings = info.settings.size() > 0 ? (TLRPC.ThemeSettings) info.settings.get(0) : null;
        if (themeSettings != null) {
            if (theme == null) {
                String baseThemeKey = getBaseThemeKey(themeSettings);
                if (baseThemeKey == null || (theme = themesDict.get(baseThemeKey)) == null) {
                    return;
                } else {
                    accent = theme.accentsByThemeId.get(info.id);
                }
            }
            if (accent == null) {
                return;
            }
            TLRPC.TL_theme tL_theme = accent.info;
            if (tL_theme != null) {
                theme.accentsByThemeId.remove(tL_theme.id);
            }
            accent.info = info;
            accent.account = account;
            theme.accentsByThemeId.put(info.id, accent);
            if (!ThemeInfo.accentEquals(accent, themeSettings)) {
                File pathToWallpaper = accent.getPathToWallpaper();
                if (pathToWallpaper != null) {
                    pathToWallpaper.delete();
                }
                ThemeInfo.fillAccentValues(accent, themeSettings);
                ThemeInfo themeInfo = currentTheme;
                if (themeInfo == theme && themeInfo.currentAccentId == accent.id) {
                    refreshThemeColors();
                    NotificationCenter globalInstance = NotificationCenter.getGlobalInstance();
                    int i = NotificationCenter.needSetDayNightTheme;
                    Object[] objArr = new Object[4];
                    ThemeInfo themeInfo2 = currentTheme;
                    objArr[0] = themeInfo2;
                    objArr[1] = Boolean.valueOf(currentNightTheme == themeInfo2);
                    objArr[2] = null;
                    objArr[3] = -1;
                    globalInstance.postNotificationName(i, objArr);
                }
                PatternsLoader.createLoader(true);
            }
            TLRPC.WallPaper wallPaper = themeSettings.wallpaper;
            accent.patternMotion = (wallPaper == null || (wallPaperSettings = wallPaper.settings) == null || !wallPaperSettings.motion) ? false : true;
            theme.previewParsed = false;
        } else {
            if (theme != null) {
                HashMap<String, ThemeInfo> hashMap = themesDict;
                str = theme.getKey();
                hashMap.remove(str);
            } else {
                HashMap<String, ThemeInfo> hashMap2 = themesDict;
                str = "remote" + info.id;
                theme = hashMap2.get(str);
            }
            if (theme == null) {
                return;
            }
            theme.info = info;
            theme.name = info.title;
            File file = new File(theme.pathToFile);
            File file2 = new File(ApplicationLoader.getFilesDirFixed(), str + ".attheme");
            if (!file.equals(file2)) {
                try {
                    AndroidUtilities.copyFile(file, file2);
                    theme.pathToFile = file2.getAbsolutePath();
                } catch (Exception e) {
                    FileLog.e(e);
                }
            }
            if (update) {
                theme.loadThemeDocument();
            } else {
                theme.previewParsed = false;
            }
            themesDict.put(theme.getKey(), theme);
        }
        saveOtherThemes(true);
    }

    public static File getAssetFile(String assetName) {
        long j;
        File file = new File(ApplicationLoader.getFilesDirFixed(), assetName);
        try {
            InputStream open = ApplicationLoader.applicationContext.getAssets().open(assetName);
            j = open.available();
            open.close();
        } catch (Exception e) {
            FileLog.e(e);
            j = 0;
        }
        if (!file.exists() || (j != 0 && file.length() != j)) {
            try {
                InputStream open2 = ApplicationLoader.applicationContext.getAssets().open(assetName);
                try {
                    AndroidUtilities.copyFile(open2, file);
                    if (open2 != null) {
                        open2.close();
                    }
                } finally {
                }
            } catch (Exception e2) {
                FileLog.e(e2);
            }
        }
        return file;
    }

    public static int getPreviewColor(SparseIntArray colors, int key) {
        int indexOfKey = colors.indexOfKey(key);
        if (indexOfKey >= 0) {
            return colors.valueAt(indexOfKey);
        }
        return defaultColors[key];
    }

    public static java.lang.String createThemePreviewImage(java.lang.String r35, java.lang.String r36, org.telegram.ui.ActionBar.Theme.ThemeAccent r37) {
        throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.ActionBar.Theme.createThemePreviewImage(java.lang.String, java.lang.String, org.telegram.ui.ActionBar.Theme$ThemeAccent):java.lang.String");
    }

    public static void checkIsDark(SparseIntArray colors, ThemeInfo info) {
        if (info == null || colors == null || info.isDark != -1) {
            return;
        }
        int i = key_windowBackgroundWhite;
        if (ColorUtils.calculateLuminance(ColorUtils.blendARGB(getPreviewColor(colors, i), getPreviewColor(colors, i), 0.5f)) < 0.5d) {
            info.isDark = 1;
        } else {
            info.isDark = 0;
        }
    }

    public static void getThemeFileValuesInBackground(final File file, final String assetName, final String[] wallpaperLink, final Utilities.Callback<SparseIntArray> onDone) {
        Utilities.themeQueue.postRunnable(new Runnable() {
            @Override
            public final void run() {
                Theme.lambda$getThemeFileValuesInBackground$10(onDone, file, assetName, wallpaperLink);
            }
        });
    }

    public static void lambda$getThemeFileValuesInBackground$10(Utilities.Callback callback, File file, String str, String[] strArr) {
        callback.run(getThemeFileValues(file, str, strArr));
    }

    public static SparseIntArray getThemeFileValues(File file, String assetName, String[] wallpaperLink) {
        int intValue;
        SparseIntArray sparseIntArray = new SparseIntArray();
        FileInputStream fileInputStream = null;
        try {
            try {
                byte[] bArr = new byte[1024];
                FileInputStream fileInputStream2 = new FileInputStream(assetName != null ? getAssetFile(assetName) : file);
                int i = -1;
                int i2 = 0;
                int i3 = -1;
                boolean z = false;
                while (true) {
                    try {
                        int read = fileInputStream2.read(bArr);
                        if (read == i) {
                            break;
                        }
                        int i4 = i2;
                        int i5 = 0;
                        int i6 = 0;
                        while (true) {
                            if (i5 >= read) {
                                break;
                            }
                            if (bArr[i5] == 10) {
                                int i7 = (i5 - i6) + 1;
                                String str = new String(bArr, i6, i7 - 1);
                                if (str.startsWith("WLS=")) {
                                    if (wallpaperLink != null && wallpaperLink.length > 0) {
                                        wallpaperLink[0] = str.substring(4);
                                    }
                                } else {
                                    if (str.startsWith("WPS")) {
                                        i3 = i7 + i4;
                                        z = true;
                                        break;
                                    }
                                    int indexOf = str.indexOf(61);
                                    if (indexOf != i) {
                                        String substring = str.substring(0, indexOf);
                                        String substring2 = str.substring(indexOf + 1);
                                        if (substring2.length() > 0 && substring2.charAt(0) == '#') {
                                            try {
                                                intValue = Color.parseColor(substring2.trim());
                                            } catch (Exception unused) {
                                                intValue = Utilities.parseInt(substring2.trim()).intValue();
                                            }
                                        } else if (Build.VERSION.SDK_INT >= 31 && (substring2.startsWith("a") || substring2.startsWith("n") || substring2.startsWith("monet"))) {
                                            intValue = MonetHelper.getColor(substring2.trim());
                                        } else {
                                            intValue = Utilities.parseInt(substring2.trim()).intValue();
                                        }
                                        int stringKeyToInt = ThemeColors.stringKeyToInt(substring);
                                        if (stringKeyToInt >= 0) {
                                            sparseIntArray.put(stringKeyToInt, intValue);
                                        }
                                    }
                                }
                                i6 += i7;
                                i4 += i7;
                            }
                            i5++;
                            i = -1;
                        }
                        if (i2 == i4) {
                            break;
                        }
                        fileInputStream2.getChannel().position(i4);
                        if (z) {
                            break;
                        }
                        i2 = i4;
                        i = -1;
                    } catch (Throwable th) {
                        th = th;
                        fileInputStream = fileInputStream2;
                        try {
                            FileLog.e(th);
                            if (fileInputStream != null) {
                                fileInputStream.close();
                            }
                            return sparseIntArray;
                        } finally {
                        }
                    }
                }
                sparseIntArray.put(key_wallpaperFileOffset, i3);
                fileInputStream2.close();
            } catch (Exception e) {
                FileLog.e(e);
            }
        } catch (Throwable th2) {
            th = th2;
        }
        return sparseIntArray;
    }

    public static void createCommonResources(Context context) {
        if (dividerPaint == null) {
            Paint paint = new Paint();
            dividerPaint = paint;
            paint.setStrokeWidth(1.0f);
            Paint paint2 = new Paint();
            dividerExtraPaint = paint2;
            paint2.setStrokeWidth(1.0f);
            avatar_backgroundPaint = new Paint(1);
            Paint paint3 = new Paint(1);
            checkboxSquare_checkPaint = paint3;
            paint3.setStyle(Paint.Style.STROKE);
            checkboxSquare_checkPaint.setStrokeWidth(AndroidUtilities.dp(2.0f));
            checkboxSquare_checkPaint.setStrokeCap(Paint.Cap.ROUND);
            Paint paint4 = new Paint(1);
            checkboxSquare_eraserPaint = paint4;
            paint4.setColor(0);
            checkboxSquare_eraserPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
            checkboxSquare_backgroundPaint = new Paint(1);
            Paint paint5 = new Paint();
            linkSelectionPaint = paint5;
            paint5.setPathEffect(LinkPath.getRoundedEffect());
            Resources resources = context.getResources();
            avatarDrawables[0] = resources.getDrawable(R.drawable.chats_saved);
            avatarDrawables[1] = resources.getDrawable(R.drawable.ghost);
            Drawable[] drawableArr = avatarDrawables;
            int i = R.drawable.msg_folders_private;
            drawableArr[2] = resources.getDrawable(i);
            avatarDrawables[3] = resources.getDrawable(R.drawable.msg_folders_requests);
            avatarDrawables[4] = resources.getDrawable(R.drawable.msg_folders_groups);
            avatarDrawables[5] = resources.getDrawable(R.drawable.msg_folders_channels);
            avatarDrawables[6] = resources.getDrawable(R.drawable.msg_folders_bots);
            avatarDrawables[7] = resources.getDrawable(R.drawable.msg_folders_muted);
            avatarDrawables[8] = resources.getDrawable(R.drawable.msg_folders_read);
            avatarDrawables[9] = resources.getDrawable(R.drawable.msg_folders_archive);
            avatarDrawables[10] = resources.getDrawable(i);
            avatarDrawables[11] = resources.getDrawable(R.drawable.chats_replies);
            avatarDrawables[12] = resources.getDrawable(R.drawable.other_chats);
            avatarDrawables[13] = resources.getDrawable(R.drawable.msg_stories_closefriends);
            avatarDrawables[14] = resources.getDrawable(R.drawable.filled_gift_premium);
            avatarDrawables[15] = resources.getDrawable(R.drawable.filled_unknown);
            avatarDrawables[16] = resources.getDrawable(R.drawable.filled_unclaimed);
            avatarDrawables[17] = resources.getDrawable(R.drawable.large_repost_story);
            avatarDrawables[18] = resources.getDrawable(R.drawable.large_hidden);
            avatarDrawables[19] = resources.getDrawable(R.drawable.large_notes);
            avatarDrawables[20] = resources.getDrawable(R.drawable.filled_folder_new);
            avatarDrawables[21] = resources.getDrawable(R.drawable.filled_folder_existing);
            setTabsDrawables(resources);
            RLottieDrawable rLottieDrawable = dialogs_archiveAvatarDrawable;
            if (rLottieDrawable != null) {
                rLottieDrawable.setCallback(null);
                dialogs_archiveAvatarDrawable.recycle(false);
            }
            RLottieDrawable rLottieDrawable2 = dialogs_archiveDrawable;
            if (rLottieDrawable2 != null) {
                rLottieDrawable2.recycle(false);
            }
            RLottieDrawable rLottieDrawable3 = dialogs_unarchiveDrawable;
            if (rLottieDrawable3 != null) {
                rLottieDrawable3.recycle(false);
            }
            RLottieDrawable rLottieDrawable4 = dialogs_pinArchiveDrawable;
            if (rLottieDrawable4 != null) {
                rLottieDrawable4.recycle(false);
            }
            RLottieDrawable rLottieDrawable5 = dialogs_unpinArchiveDrawable;
            if (rLottieDrawable5 != null) {
                rLottieDrawable5.recycle(false);
            }
            RLottieDrawable rLottieDrawable6 = dialogs_hidePsaDrawable;
            if (rLottieDrawable6 != null) {
                rLottieDrawable6.recycle(false);
            }
            dialogs_archiveAvatarDrawable = new RLottieDrawable(R.raw.chats_archiveavatar, "chats_archiveavatar", AndroidUtilities.dp(36.0f), AndroidUtilities.dp(36.0f), false, (int[]) null);
            dialogs_archiveDrawable = new RLottieDrawable(R.raw.chats_archive, "chats_archive", AndroidUtilities.dp(36.0f), AndroidUtilities.dp(36.0f), false, (int[]) null);
            dialogs_unarchiveDrawable = new RLottieDrawable(R.raw.chats_unarchive, "chats_unarchive", AndroidUtilities.dp(AndroidUtilities.dp(36.0f)), AndroidUtilities.dp(36.0f), false, (int[]) null);
            dialogs_pinArchiveDrawable = new RLottieDrawable(R.raw.chats_hide, "chats_hide", AndroidUtilities.dp(36.0f), AndroidUtilities.dp(36.0f), false, (int[]) null);
            dialogs_unpinArchiveDrawable = new RLottieDrawable(R.raw.chats_unhide, "chats_unhide", AndroidUtilities.dp(36.0f), AndroidUtilities.dp(36.0f), false, (int[]) null);
            dialogs_hidePsaDrawable = new RLottieDrawable(R.raw.chat_audio_record_delete, "chats_psahide", AndroidUtilities.dp(30.0f), AndroidUtilities.dp(30.0f), false, (int[]) null);
            dialogs_swipeMuteDrawable = new RLottieDrawable(R.raw.swipe_mute, "swipe_mute", AndroidUtilities.dp(36.0f), AndroidUtilities.dp(36.0f), false, (int[]) null);
            dialogs_swipeUnmuteDrawable = new RLottieDrawable(R.raw.swipe_unmute, "swipe_unmute", AndroidUtilities.dp(36.0f), AndroidUtilities.dp(36.0f), false, (int[]) null);
            dialogs_swipeReadDrawable = new RLottieDrawable(R.raw.swipe_read, "swipe_read", AndroidUtilities.dp(36.0f), AndroidUtilities.dp(36.0f), false, (int[]) null);
            dialogs_swipeUnreadDrawable = new RLottieDrawable(R.raw.swipe_unread, "swipe_unread", AndroidUtilities.dp(36.0f), AndroidUtilities.dp(36.0f), false, (int[]) null);
            dialogs_swipeDeleteDrawable = new RLottieDrawable(R.raw.swipe_delete, "swipe_delete", AndroidUtilities.dp(36.0f), AndroidUtilities.dp(36.0f), false, (int[]) null);
            dialogs_swipeUnpinDrawable = new RLottieDrawable(R.raw.swipe_unpin, "swipe_unpin", AndroidUtilities.dp(36.0f), AndroidUtilities.dp(36.0f), false, (int[]) null);
            dialogs_swipePinDrawable = new RLottieDrawable(R.raw.swipe_pin, "swipe_pin", AndroidUtilities.dp(36.0f), AndroidUtilities.dp(36.0f), false, (int[]) null);
            applyCommonTheme();
        }
    }

    public static void setTabsDrawables(Resources resources) {
        Drawable[] drawableArr = tabsDrawables;
        int[] iArr = tabNewIcons;
        drawableArr[0] = resources.getDrawable(iArr[0]);
        tabsDrawables[1] = resources.getDrawable(iArr[1]);
        tabsDrawables[2] = resources.getDrawable(iArr[3]);
        tabsDrawables[3] = resources.getDrawable(iArr[4]);
        tabsDrawables[4] = resources.getDrawable(iArr[5]);
        tabsDrawables[5] = resources.getDrawable(iArr[6]);
        tabsDrawables[6] = resources.getDrawable(iArr[7]);
        tabsDrawables[7] = resources.getDrawable(iArr[8]);
        tabsDrawables[8] = resources.getDrawable(R.drawable.msg_unmute);
        tabsDrawables[9] = resources.getDrawable(R.drawable.menu_folders);
        tabsDrawables[10] = resources.getDrawable(R.drawable.tab_polls);
        tabsDrawables[11] = resources.getDrawable(R.drawable.tab_cups);
        tabsDrawables[12] = resources.getDrawable(R.drawable.tab_cat);
        Drawable[] drawableArr2 = tabsDrawables;
        int i = R.drawable.tab_soccer;
        drawableArr2[13] = resources.getDrawable(i);
        tabsDrawables[14] = resources.getDrawable(R.drawable.menu_jobtitle);
        tabsDrawables[15] = resources.getDrawable(R.drawable.tab_especial);
        tabsDrawables[16] = resources.getDrawable(R.drawable.tab_flower);
        tabsDrawables[17] = resources.getDrawable(R.drawable.input_notify_on);
        tabsDrawables[18] = resources.getDrawable(R.drawable.tab_home);
        tabsDrawables[19] = resources.getDrawable(R.drawable.tab_play);
        tabsDrawables[20] = resources.getDrawable(R.drawable.tab_school);
        tabsDrawables[21] = resources.getDrawable(i);
        tabsDrawables[22] = resources.getDrawable(R.drawable.tab_selector);
        tabsDrawables[23] = resources.getDrawable(R.drawable.tab_travel);
        tabsDrawables[24] = resources.getDrawable(R.drawable.tab_crown);
        tabsDrawables[25] = resources.getDrawable(R.drawable.tab_secret);
        tabsDrawables[26] = resources.getDrawable(R.drawable.tab_music);
        tabsDrawables[27] = resources.getDrawable(iArr[2]);
        tabsDrawables[28] = resources.getDrawable(R.drawable.menu_chats1);
        tabsDrawables[29] = resources.getDrawable(R.drawable.menu_chats2);
        tabsDrawables[30] = resources.getDrawable(R.drawable.menu_support2);
        tabsDrawables[31] = resources.getDrawable(R.drawable.tab_btc);
        tabsDrawables[32] = resources.getDrawable(R.drawable.tab_book);
        tabsDrawables[33] = resources.getDrawable(R.drawable.tab_palette);
        tabsDrawables[34] = resources.getDrawable(R.drawable.tab_camera);
        tabsDrawables[35] = resources.getDrawable(R.drawable.tab_note);
        tabsDrawables[36] = resources.getDrawable(R.drawable.tab_lightbulb);
        tabsDrawables[37] = resources.getDrawable(R.drawable.tab_airplane);
    }

    public static void applyCommonTheme() {
        Paint paint = dividerPaint;
        if (paint == null) {
            return;
        }
        paint.setColor(getColor(key_divider));
        linkSelectionPaint.setColor(getColor(key_windowBackgroundWhiteLinkSelection));
        int i = 0;
        while (true) {
            Drawable[] drawableArr = avatarDrawables;
            if (i < drawableArr.length) {
                setDrawableColorByKey(drawableArr[i], key_avatar_text);
                i++;
            } else {
                dialogs_archiveAvatarDrawable.beginApplyLayerColors();
                RLottieDrawable rLottieDrawable = dialogs_archiveAvatarDrawable;
                int i2 = key_avatar_backgroundArchived;
                rLottieDrawable.setLayerColor("Arrow1.**", getNonAnimatedColor(i2));
                dialogs_archiveAvatarDrawable.setLayerColor("Arrow2.**", getNonAnimatedColor(i2));
                RLottieDrawable rLottieDrawable2 = dialogs_archiveAvatarDrawable;
                int i3 = key_avatar_text;
                rLottieDrawable2.setLayerColor("Box2.**", getNonAnimatedColor(i3));
                dialogs_archiveAvatarDrawable.setLayerColor("Box1.**", getNonAnimatedColor(i3));
                dialogs_archiveAvatarDrawable.commitApplyLayerColors();
                dialogs_archiveAvatarDrawableRecolored = false;
                dialogs_archiveAvatarDrawable.setAllowDecodeSingleFrame(true);
                dialogs_pinArchiveDrawable.beginApplyLayerColors();
                RLottieDrawable rLottieDrawable3 = dialogs_pinArchiveDrawable;
                int i4 = key_chats_archiveIcon;
                rLottieDrawable3.setLayerColor("Arrow.**", getNonAnimatedColor(i4));
                dialogs_pinArchiveDrawable.setLayerColor("Line.**", getNonAnimatedColor(i4));
                dialogs_pinArchiveDrawable.commitApplyLayerColors();
                dialogs_unpinArchiveDrawable.beginApplyLayerColors();
                dialogs_unpinArchiveDrawable.setLayerColor("Arrow.**", getNonAnimatedColor(i4));
                dialogs_unpinArchiveDrawable.setLayerColor("Line.**", getNonAnimatedColor(i4));
                dialogs_unpinArchiveDrawable.commitApplyLayerColors();
                dialogs_hidePsaDrawable.beginApplyLayerColors();
                RLottieDrawable rLottieDrawable4 = dialogs_hidePsaDrawable;
                int i5 = key_chats_archiveBackground;
                rLottieDrawable4.setLayerColor("Line 1.**", getNonAnimatedColor(i5));
                dialogs_hidePsaDrawable.setLayerColor("Line 2.**", getNonAnimatedColor(i5));
                dialogs_hidePsaDrawable.setLayerColor("Line 3.**", getNonAnimatedColor(i5));
                dialogs_hidePsaDrawable.setLayerColor("Cup Red.**", getNonAnimatedColor(i4));
                dialogs_hidePsaDrawable.setLayerColor("Box.**", getNonAnimatedColor(i4));
                dialogs_hidePsaDrawable.commitApplyLayerColors();
                dialogs_hidePsaDrawableRecolored = false;
                dialogs_archiveDrawable.beginApplyLayerColors();
                dialogs_archiveDrawable.setLayerColor("Arrow.**", getNonAnimatedColor(i5));
                dialogs_archiveDrawable.setLayerColor("Box2.**", getNonAnimatedColor(i4));
                dialogs_archiveDrawable.setLayerColor("Box1.**", getNonAnimatedColor(i4));
                dialogs_archiveDrawable.commitApplyLayerColors();
                dialogs_archiveDrawableRecolored = false;
                dialogs_unarchiveDrawable.beginApplyLayerColors();
                dialogs_unarchiveDrawable.setLayerColor("Arrow1.**", getNonAnimatedColor(i4));
                dialogs_unarchiveDrawable.setLayerColor("Arrow2.**", getNonAnimatedColor(key_chats_archivePinBackground));
                dialogs_unarchiveDrawable.setLayerColor("Box2.**", getNonAnimatedColor(i4));
                dialogs_unarchiveDrawable.setLayerColor("Box1.**", getNonAnimatedColor(i4));
                dialogs_unarchiveDrawable.commitApplyLayerColors();
                chat_animatedEmojiTextColorFilter = new PorterDuffColorFilter(getColor(key_windowBackgroundWhiteBlackText), PorterDuff.Mode.SRC_IN);
                chat_outAnimatedEmojiTextColorFilter = new PorterDuffColorFilter(getColor(key_chat_messageTextOut), PorterDuff.Mode.SRC_IN);
                PremiumGradient.getInstance().checkIconColors();
                return;
            }
        }
    }

    public static void createCommonDialogResources(Context context) {
        if (dialogs_countTextPaint == null) {
            TextPaint textPaint = new TextPaint(1);
            dialogs_countTextPaint = textPaint;
            textPaint.setTypeface(AndroidUtilities.bold());
            dialogs_countPaint = new Paint(1);
            dialogs_reactionsCountPaint = new Paint(1);
            dialogs_onlineCirclePaint = new Paint(1);
            dialogs_tagPaint = new Paint(1);
        }
        dialogs_countTextPaint.setTextSize(AndroidUtilities.dp(13.0f));
    }

    public static void createDialogsResources(Context context) {
        createCommonResources(context);
        createCommonDialogResources(context);
        if (dialogs_namePaint == null) {
            Resources resources = context.getResources();
            dialogs_namePaint = new TextPaint[2];
            dialogs_nameEncryptedPaint = new TextPaint[2];
            dialogs_messagePaint = new TextPaint[2];
            dialogs_messagePrintingPaint = new TextPaint[2];
            for (int i = 0; i < 2; i++) {
                dialogs_namePaint[i] = new TextPaint(1);
                dialogs_namePaint[i].setTypeface(AndroidUtilities.bold());
                dialogs_nameEncryptedPaint[i] = new TextPaint(1);
                dialogs_nameEncryptedPaint[i].setTypeface(AndroidUtilities.bold());
                dialogs_messagePaint[i] = new TextPaint(1);
                dialogs_messagePrintingPaint[i] = new TextPaint(1);
            }
            TextPaint textPaint = new TextPaint(1);
            dialogs_searchNamePaint = textPaint;
            textPaint.setTypeface(AndroidUtilities.bold());
            TextPaint textPaint2 = new TextPaint(1);
            dialogs_searchNameEncryptedPaint = textPaint2;
            textPaint2.setTypeface(AndroidUtilities.bold());
            TextPaint textPaint3 = new TextPaint(1);
            dialogs_messageNamePaint = textPaint3;
            textPaint3.setTypeface(AndroidUtilities.bold());
            dialogs_timePaint = new TextPaint(1);
            TextPaint textPaint4 = new TextPaint(1);
            dialogs_archiveTextPaint = textPaint4;
            textPaint4.setTypeface(AndroidUtilities.bold());
            TextPaint textPaint5 = new TextPaint(1);
            dialogs_archiveTextPaintSmall = textPaint5;
            textPaint5.setTypeface(AndroidUtilities.bold());
            dialogs_onlinePaint = new TextPaint(1);
            dialogs_offlinePaint = new TextPaint(1);
            TextPaint textPaint6 = new TextPaint(1);
            dialogs_tagTextPaint = textPaint6;
            textPaint6.setTypeface(AndroidUtilities.bold());
            dialogs_tabletSeletedPaint = new Paint();
            dialogs_pinnedPaint = new Paint(1);
            dialogs_countGrayPaint = new Paint(1);
            dialogs_errorPaint = new Paint(1);
            dialogs_actionMessagePaint = new Paint(1);
            dialogs_lockDrawable = resources.getDrawable(R.drawable.list_secret);
            dialogs_lock2Drawable = resources.getDrawable(R.drawable.msg_mini_lock2);
            int i2 = R.drawable.list_check;
            dialogs_checkDrawable = resources.getDrawable(i2).mutate();
            dialogs_playDrawable = resources.getDrawable(R.drawable.minithumb_play).mutate();
            dialogs_checkReadDrawable = resources.getDrawable(i2).mutate();
            dialogs_halfCheckDrawable = resources.getDrawable(R.drawable.list_halfcheck);
            dialogs_clockDrawable = new MsgClockDrawable();
            dialogs_errorDrawable = resources.getDrawable(R.drawable.list_warning_sign);
            dialogs_reorderDrawable = resources.getDrawable(R.drawable.list_reorder).mutate();
            dialogs_groupDrawable = resources.getDrawable(R.drawable.list_group);
            dialogs_broadcastDrawable = resources.getDrawable(R.drawable.list_broadcast);
            dialogs_muteDrawable = resources.getDrawable(R.drawable.list_mute).mutate();
            dialogs_unmuteDrawable = resources.getDrawable(R.drawable.list_unmute).mutate();
            dialogs_verifiedDrawable = resources.getDrawable(R.drawable.verified_area).mutate();
            dialogs_scamDrawable = new ScamDrawable(11, 0);
            dialogs_fakeDrawable = new ScamDrawable(11, 1);
            dialogs_verifiedCheckDrawable = resources.getDrawable(R.drawable.verified_check).mutate();
            dialogs_mentionDrawable = resources.getDrawable(R.drawable.mentionchatslist);
            dialogs_reactionsMentionDrawable = resources.getDrawable(R.drawable.reactionchatslist);
            dialogs_botDrawable = resources.getDrawable(R.drawable.list_bot);
            dialogs_pinnedDrawable = resources.getDrawable(R.drawable.list_pin);
            dialogs_forum_arrowDrawable = resources.getDrawable(R.drawable.msg_mini_forumarrow);
            moveUpDrawable = resources.getDrawable(R.drawable.preview_arrow);
            dialogs_superGroupDrawable = resources.getDrawable(R.drawable.list_supergroup);
            dialogs_FavDrawable = resources.getDrawable(R.drawable.admin_star);
            TextPaint textPaint7 = new TextPaint(1);
            dialogs_groupPaint = textPaint7;
            textPaint7.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            TextPaint textPaint8 = new TextPaint(1);
            dialogs_nameUnknownPaint = textPaint8;
            textPaint8.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
            dialogs_messageTypingPaint = new TextPaint(1);
            RectF rectF = new RectF();
            chat_updatePath[0] = new Path();
            chat_updatePath[2] = new Path();
            float dp = AndroidUtilities.dp(12.0f);
            float dp2 = AndroidUtilities.dp(12.0f);
            rectF.set(dp - AndroidUtilities.dp(5.0f), dp2 - AndroidUtilities.dp(5.0f), AndroidUtilities.dp(5.0f) + dp, AndroidUtilities.dp(5.0f) + dp2);
            chat_updatePath[2].arcTo(rectF, -160.0f, -110.0f, true);
            chat_updatePath[2].arcTo(rectF, 20.0f, -110.0f, true);
            chat_updatePath[0].moveTo(dp, AndroidUtilities.dp(8.0f) + dp2);
            chat_updatePath[0].lineTo(dp, AndroidUtilities.dp(2.0f) + dp2);
            chat_updatePath[0].lineTo(AndroidUtilities.dp(3.0f) + dp, AndroidUtilities.dp(5.0f) + dp2);
            chat_updatePath[0].close();
            chat_updatePath[0].moveTo(dp, dp2 - AndroidUtilities.dp(8.0f));
            chat_updatePath[0].lineTo(dp, dp2 - AndroidUtilities.dp(2.0f));
            chat_updatePath[0].lineTo(dp - AndroidUtilities.dp(3.0f), dp2 - AndroidUtilities.dp(5.0f));
            chat_updatePath[0].close();
            dialogs_mediaPaint = new TextPaint(1);
            setDialogsChecks(resources);
            applyDialogsTheme();
        }
        dialogs_messageNamePaint.setTextSize(AndroidUtilities.dp(14.0f));
        dialogs_timePaint.setTextSize(AndroidUtilities.dp(13.0f));
        dialogs_archiveTextPaint.setTextSize(AndroidUtilities.dp(13.0f));
        dialogs_archiveTextPaintSmall.setTextSize(AndroidUtilities.dp(11.0f));
        dialogs_onlinePaint.setTextSize(AndroidUtilities.dp(15.0f));
        dialogs_offlinePaint.setTextSize(AndroidUtilities.dp(15.0f));
        dialogs_tagTextPaint.setTextSize(AndroidUtilities.dp(10.0f));
        dialogs_searchNamePaint.setTextSize(AndroidUtilities.dp(16.0f));
        dialogs_searchNameEncryptedPaint.setTextSize(AndroidUtilities.dp(16.0f));
        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0);
        dialogs_timePaint.setTextSize(AndroidUtilities.dp(sharedPreferences.getInt("chatsTimeSize", 13)));
        dialogs_countTextPaint.setTextSize(AndroidUtilities.dp(chatsCountSize));
        dialogs_mediaPaint.setTextSize(AndroidUtilities.dp(16.0f));
        int i3 = sharedPreferences.getInt("chatsMessageSize", 16);
        if (SharedConfig.useThreeLinesLayout) {
            dialogs_namePaint[1].setTextSize(AndroidUtilities.dp(usePlusTheme ? chatsNameSize : 16.0f));
            dialogs_nameEncryptedPaint[1].setTextSize(AndroidUtilities.dp(usePlusTheme ? chatsNameSize : 16.0f));
            dialogs_messagePaint[1].setTextSize(AndroidUtilities.dp(usePlusTheme ? i3 : 15.0f));
            dialogs_messagePrintingPaint[1].setTextSize(AndroidUtilities.dp(usePlusTheme ? i3 : 15.0f));
            dialogs_nameUnknownPaint.setTextSize(AndroidUtilities.dp(usePlusTheme ? chatsNameSize : 16.0f));
            dialogs_messageTypingPaint.setTextSize(AndroidUtilities.dp(usePlusTheme ? i3 : 15.0f));
            dialogs_groupPaint.setTextSize(AndroidUtilities.dp(usePlusTheme ? sharedPreferences.getInt("chatsGroupNameSize", chatsNameSize) : 16.0f));
            return;
        }
        dialogs_namePaint[0].setTextSize(AndroidUtilities.dp(usePlusTheme ? chatsNameSize + 1 : 17.0f));
        dialogs_nameEncryptedPaint[0].setTextSize(AndroidUtilities.dp(usePlusTheme ? chatsNameSize + 1 : 17.0f));
        dialogs_messagePrintingPaint[0].setTextSize(AndroidUtilities.dp(usePlusTheme ? i3 + 1 : 16.0f));
        dialogs_messagePaint[0].setTextSize(AndroidUtilities.dp(usePlusTheme ? i3 + 1 : 16.0f));
        dialogs_nameUnknownPaint.setTextSize(AndroidUtilities.dp(usePlusTheme ? chatsNameSize + 1 : 17.0f));
        dialogs_messageTypingPaint.setTextSize(AndroidUtilities.dp(usePlusTheme ? i3 + 1 : 16.0f));
        dialogs_groupPaint.setTextSize(AndroidUtilities.dp(usePlusTheme ? sharedPreferences.getInt("chatsGroupNameSize", chatsNameSize) + 1 : 17.0f));
    }

    public static void applyDialogsTheme() {
        if (dialogs_namePaint == null) {
            return;
        }
        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0);
        for (int i = 0; i < 2; i++) {
            dialogs_namePaint[i].setColor(getColor(key_chats_name));
            dialogs_nameEncryptedPaint[i].setColor(getColor(key_chats_secretName));
            TextPaint[] textPaintArr = dialogs_messagePaint;
            TextPaint textPaint = textPaintArr[i];
            TextPaint textPaint2 = textPaintArr[i];
            int color = usePlusTheme ? chatsMessageColor : getColor(key_chats_message);
            textPaint2.linkColor = color;
            textPaint.setColor(color);
            dialogs_messagePrintingPaint[i].setColor(usePlusTheme ? sharedPreferences.getInt("chatsMessageColor", defColor) : getColor(key_chats_actionMessage));
        }
        dialogs_searchNamePaint.setColor(getColor(key_chats_name));
        dialogs_searchNameEncryptedPaint.setColor(getColor(key_chats_secretName));
        TextPaint textPaint3 = dialogs_messageNamePaint;
        int color2 = usePlusTheme ? chatsMemberColor : getColor(key_chats_nameMessage_threeLines);
        textPaint3.linkColor = color2;
        textPaint3.setColor(color2);
        dialogs_tabletSeletedPaint.setColor(getColor(key_chats_tabletSelectedOverlay));
        dialogs_pinnedPaint.setColor(getColor(key_chats_pinnedOverlay));
        dialogs_timePaint.setColor(getColor(key_chats_date));
        TextPaint textPaint4 = dialogs_countTextPaint;
        int i2 = key_chats_unreadCounterText;
        textPaint4.setColor(getColor(i2));
        TextPaint textPaint5 = dialogs_archiveTextPaint;
        int i3 = key_chats_archiveText;
        textPaint5.setColor(getColor(i3));
        dialogs_archiveTextPaintSmall.setColor(getColor(i3));
        dialogs_countPaint.setColor(getColor(key_chats_unreadCounter));
        dialogs_reactionsCountPaint.setColor(getColor(key_dialogReactionMentionBackground));
        dialogs_countGrayPaint.setColor(getColor(key_chats_unreadCounterMuted));
        dialogs_actionMessagePaint.setColor(getColor(key_chats_actionMessage));
        dialogs_errorPaint.setColor(getColor(key_chats_sentError));
        dialogs_onlinePaint.setColor(getColor(key_windowBackgroundWhiteBlueText3));
        dialogs_offlinePaint.setColor(getColor(key_windowBackgroundWhiteGrayText3));
        setDrawableColorByKey(dialogs_lockDrawable, key_chats_secretIcon);
        Drawable drawable = dialogs_lock2Drawable;
        int i4 = key_chats_pinnedIcon;
        setDrawableColorByKey(drawable, i4);
        setDrawableColorByKey(dialogs_checkDrawable, key_chats_sentCheck);
        Drawable drawable2 = dialogs_checkReadDrawable;
        int i5 = key_chats_sentReadCheck;
        setDrawableColorByKey(drawable2, i5);
        setDrawableColorByKey(dialogs_halfCheckDrawable, i5);
        setDrawableColorByKey(dialogs_clockDrawable, key_chats_sentClock);
        setDrawableColorByKey(dialogs_errorDrawable, key_chats_sentErrorIcon);
        setDrawableColorByKey(dialogs_pinnedDrawable, i4);
        setDrawableColorByKey(dialogs_reorderDrawable, i4);
        Drawable drawable3 = dialogs_muteDrawable;
        int i6 = key_chats_muteIcon;
        setDrawableColorByKey(drawable3, i6);
        setDrawableColorByKey(dialogs_unmuteDrawable, i6);
        Drawable drawable4 = dialogs_mentionDrawable;
        int i7 = key_chats_mentionIcon;
        setDrawableColorByKey(drawable4, i7);
        setDrawableColorByKey(dialogs_forum_arrowDrawable, key_chats_message);
        setDrawableColorByKey(dialogs_reactionsMentionDrawable, i7);
        Drawable drawable5 = dialogs_verifiedDrawable;
        int i8 = key_chats_verifiedBackground;
        setDrawableColorByKey(drawable5, i8);
        setDrawableColorByKey(dialogs_verifiedCheckDrawable, key_chats_verifiedCheck);
        setDrawableColorByKey(dialogs_holidayDrawable, key_actionBarDefaultTitle);
        ScamDrawable scamDrawable = dialogs_scamDrawable;
        int i9 = key_chats_draft;
        setDrawableColorByKey(scamDrawable, i9);
        setDrawableColorByKey(dialogs_fakeDrawable, i9);
        setDrawableColorByKey(dialogs_mentionDrawable, i2);
        setDrawableColorByKey(dialogs_FavDrawable, i8);
        if (getColor(i8) == getDefaultColor(i8)) {
            dialogs_FavDrawable.setColorFilter(FAV_INDICATOR_COLOR_DEF, PorterDuff.Mode.SRC_IN);
        }
        if (usePlusTheme) {
            dialogs_groupPaint.setColor(chatsGroupNameColor);
            dialogs_nameUnknownPaint.setColor(chatsUnknownNameColor);
            dialogs_mediaPaint.setColor(sharedPreferences.getInt("chatsMediaColor", darkColor));
            dialogs_messageTypingPaint.setColor(sharedPreferences.getInt("chatsTypingColor", defColor));
            dialogs_timePaint.setColor(sharedPreferences.getInt("chatsTimeColor", -6710887));
            dialogs_countTextPaint.setColor(chatsCountColor);
            dialogs_mentionDrawable.setColorFilter(chatsCountColor, PorterDuff.Mode.MULTIPLY);
            dialogs_mediaPaint.setColor(-16711936);
            dialogs_lockDrawable.setColorFilter(sharedPreferences.getInt("chatsGroupIconColor", sharedPreferences.getInt("chatsNameColor", defColor)), PorterDuff.Mode.SRC_IN);
            int i10 = sharedPreferences.getInt("chatsGroupIconColor", sharedPreferences.getInt("chatsGroupNameColor", -16777216));
            dialogs_groupDrawable.setColorFilter(i10, PorterDuff.Mode.SRC_IN);
            dialogs_superGroupDrawable.setColorFilter(i10, PorterDuff.Mode.SRC_IN);
            dialogs_broadcastDrawable.setColorFilter(i10, PorterDuff.Mode.SRC_IN);
            dialogs_botDrawable.setColorFilter(i10, PorterDuff.Mode.SRC_IN);
            dialogs_muteDrawable.setColorFilter(sharedPreferences.getInt("chatsMuteColor", -5723992), PorterDuff.Mode.SRC_IN);
            dialogs_pinnedDrawable.setColorFilter(i10, PorterDuff.Mode.SRC_IN);
            dialogs_countPaint.setColor(chatsCountBGColor);
            dialogs_countGrayPaint.setColor(sharedPreferences.getInt("chatsCountSilentBGColor", sharedPreferences.getInt("chatsCountBGColor", -4605511)));
            dialogs_pinnedPaint.setColor(chatsPinnedMsgBGColor);
            dialogs_FavDrawable.setColorFilter(chatsFavIndicatorColor, PorterDuff.Mode.SRC_IN);
            dialogs_verifiedDrawable.setColorFilter(lightColor, PorterDuff.Mode.SRC_IN);
            dialogs_verifiedCheckDrawable.setColorFilter(chatsRowColor, PorterDuff.Mode.SRC_IN);
        }
    }

    public static void setDialogsChecks(Resources resources) {
        String string = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0).getString("chatCheckStyle", checksNamesArray[0]);
        if (string.equals(checksNamesArray[1])) {
            int i = R.drawable.dialogs_check_2;
            dialogs_checkDrawable = resources.getDrawable(i);
            dialogs_checkReadDrawable = resources.getDrawable(i).mutate();
            dialogs_halfCheckDrawable = resources.getDrawable(R.drawable.dialogs_halfcheck_2);
            return;
        }
        if (string.equals(checksNamesArray[2])) {
            int i2 = R.drawable.dialogs_check_3;
            dialogs_checkDrawable = resources.getDrawable(i2);
            dialogs_checkReadDrawable = resources.getDrawable(i2).mutate();
            dialogs_halfCheckDrawable = resources.getDrawable(R.drawable.dialogs_halfcheck_3);
            return;
        }
        if (string.equals(checksNamesArray[3])) {
            int i3 = R.drawable.dialogs_check_4;
            dialogs_checkDrawable = resources.getDrawable(i3);
            dialogs_checkReadDrawable = resources.getDrawable(i3).mutate();
            dialogs_halfCheckDrawable = resources.getDrawable(R.drawable.dialogs_halfcheck_4);
            return;
        }
        if (string.equals(checksNamesArray[4])) {
            int i4 = R.drawable.dialogs_check_5;
            dialogs_checkDrawable = resources.getDrawable(i4);
            dialogs_checkReadDrawable = resources.getDrawable(i4).mutate();
            dialogs_halfCheckDrawable = resources.getDrawable(R.drawable.dialogs_halfcheck_5);
            return;
        }
        if (string.equals(checksNamesArray[5])) {
            int i5 = R.drawable.dialogs_check_6;
            dialogs_checkDrawable = resources.getDrawable(i5);
            dialogs_checkReadDrawable = resources.getDrawable(i5).mutate();
            dialogs_halfCheckDrawable = resources.getDrawable(R.drawable.dialogs_halfcheck_6);
            return;
        }
        if (string.equals(checksNamesArray[6])) {
            int i6 = R.drawable.dialogs_check_7;
            dialogs_checkDrawable = resources.getDrawable(i6);
            dialogs_checkReadDrawable = resources.getDrawable(i6).mutate();
            dialogs_halfCheckDrawable = resources.getDrawable(R.drawable.dialogs_halfcheck_7);
            return;
        }
        if (string.equals(checksNamesArray[7])) {
            int i7 = R.drawable.dialogs_check_8;
            dialogs_checkDrawable = resources.getDrawable(i7);
            dialogs_checkReadDrawable = resources.getDrawable(i7).mutate();
            dialogs_halfCheckDrawable = resources.getDrawable(R.drawable.dialogs_halfcheck_8);
            return;
        }
        if (string.equals(checksNamesArray[8])) {
            int i8 = R.drawable.dialogs_check_9;
            dialogs_checkDrawable = resources.getDrawable(i8);
            dialogs_checkReadDrawable = resources.getDrawable(i8).mutate();
            dialogs_halfCheckDrawable = resources.getDrawable(R.drawable.dialogs_halfcheck_9);
            return;
        }
        if (string.equals(checksNamesArray[9])) {
            int i9 = R.drawable.dialogs_check_10;
            dialogs_checkDrawable = resources.getDrawable(i9);
            dialogs_checkReadDrawable = resources.getDrawable(i9).mutate();
            dialogs_halfCheckDrawable = resources.getDrawable(R.drawable.dialogs_halfcheck_10);
            return;
        }
        if (string.equals(checksNamesArray[10])) {
            int i10 = R.drawable.dialogs_check_11;
            dialogs_checkDrawable = resources.getDrawable(i10);
            dialogs_checkReadDrawable = resources.getDrawable(i10).mutate();
            dialogs_halfCheckDrawable = resources.getDrawable(R.drawable.dialogs_halfcheck_11);
            return;
        }
        if (string.equals(checksNamesArray[11])) {
            int i11 = R.drawable.dialogs_check_12;
            dialogs_checkDrawable = resources.getDrawable(i11);
            dialogs_checkReadDrawable = resources.getDrawable(i11).mutate();
            dialogs_halfCheckDrawable = resources.getDrawable(R.drawable.dialogs_halfcheck_12);
            return;
        }
        int i12 = R.drawable.list_check;
        dialogs_checkDrawable = resources.getDrawable(i12);
        dialogs_checkReadDrawable = resources.getDrawable(i12).mutate();
        dialogs_halfCheckDrawable = resources.getDrawable(R.drawable.list_halfcheck);
    }

    public static void reloadAllResources(Context context) {
        destroyResources();
        if (chat_msgInDrawable != null) {
            chat_msgInDrawable = null;
            createChatResources(context, false);
        }
        if (dialogs_namePaint != null) {
            dialogs_namePaint = null;
            createDialogsResources(context);
        }
        if (profile_verifiedDrawable != null) {
            profile_verifiedDrawable = null;
            createProfileResources(context);
        }
    }

    public static void createCommonMessageResources() {
        synchronized (sync) {
            if (chat_msgTextPaint == null) {
                chat_msgTextPaint = new TextPaint(1);
                chat_msgGameTextPaint = new TextPaint(1);
                chat_msgTextPaintEmoji = new TextPaint[6];
                chat_msgTextPaintOneEmoji = new TextPaint(1);
                chat_msgTextPaintTwoEmoji = new TextPaint(1);
                chat_msgTextPaintThreeEmoji = new TextPaint(1);
                TextPaint textPaint = new TextPaint(1);
                chat_msgBotButtonPaint = textPaint;
                textPaint.setTypeface(AndroidUtilities.bold());
                TextPaint textPaint2 = new TextPaint(1);
                chat_namePaint = textPaint2;
                textPaint2.setTypeface(AndroidUtilities.bold());
                TextPaint textPaint3 = new TextPaint(1);
                chat_replyNamePaint = textPaint3;
                textPaint3.setTypeface(AndroidUtilities.bold());
                chat_replyTextPaint = new TextPaint(1);
                chat_quoteTextPaint = new TextPaint(1);
                chat_titleLabelTextPaint = new TextPaint(1);
                TextPaint textPaint4 = new TextPaint(1);
                chat_topicTextPaint = textPaint4;
                textPaint4.setTypeface(AndroidUtilities.bold());
                chat_forwardNamePaint = new TextPaint(1);
                chat_adminPaint = new TextPaint(1);
                chat_timePaint = new TextPaint(1);
                TextPaint textPaint5 = new TextPaint(1);
                chat_msgTextCodePaint = textPaint5;
                textPaint5.setTypeface(Typeface.MONOSPACE);
                TextPaint textPaint6 = new TextPaint(1);
                chat_msgTextCode2Paint = textPaint6;
                textPaint6.setTypeface(Typeface.MONOSPACE);
                TextPaint textPaint7 = new TextPaint(1);
                chat_msgTextCode3Paint = textPaint7;
                textPaint7.setTypeface(Typeface.MONOSPACE);
                new TextPaint(1);
            }
            int i = 0;
            float[] fArr = {0.68f, 0.46f, 0.34f, 0.28f, 0.22f, 0.19f};
            while (true) {
                TextPaint[] textPaintArr = chat_msgTextPaintEmoji;
                if (i < textPaintArr.length) {
                    textPaintArr[i] = new TextPaint(1);
                    chat_msgTextPaintEmoji[i].setTextSize(AndroidUtilities.dp(fArr[i] * 120.0f));
                    i++;
                } else {
                    chat_msgTextPaintOneEmoji.setTextSize(AndroidUtilities.dp(46.0f));
                    chat_msgTextPaintTwoEmoji.setTextSize(AndroidUtilities.dp(38.0f));
                    chat_msgTextPaintThreeEmoji.setTextSize(AndroidUtilities.dp(30.0f));
                    chat_msgTextPaint.setTextSize(AndroidUtilities.dp(SharedConfig.fontSize));
                    chat_msgGameTextPaint.setTextSize(AndroidUtilities.dp(14.0f));
                    chat_msgBotButtonPaint.setTextSize(AndroidUtilities.dp(15.0f));
                    chat_namePaint.setTextSize(AndroidUtilities.dp(r1));
                    chat_replyNamePaint.setTextSize(AndroidUtilities.dp(r1));
                    chat_replyTextPaint.setTextSize(AndroidUtilities.dp(r1));
                    float f = (((SharedConfig.fontSize * 2) + 10) / 3.0f) - 1.0f;
                    chat_quoteTextPaint.setTextSize(AndroidUtilities.dp(f));
                    chat_topicTextPaint.setTextSize(AndroidUtilities.dp(f));
                    chat_titleLabelTextPaint.setTextSize(AndroidUtilities.dp(r1 - 2.0f));
                    chat_forwardNamePaint.setTextSize(AndroidUtilities.dp(r1));
                    chat_adminPaint.setTextSize(AndroidUtilities.dp(f));
                    chat_msgTextCodePaint.setTextSize(AndroidUtilities.dp(Math.max(Math.min(10, SharedConfig.fontSize - 1), SharedConfig.fontSize - 2)));
                    chat_msgTextCode2Paint.setTextSize(AndroidUtilities.dp(Math.max(Math.min(10, SharedConfig.fontSize - 2), SharedConfig.fontSize - 3)));
                    chat_msgTextCode3Paint.setTextSize(AndroidUtilities.dp(Math.max(Math.min(10, SharedConfig.fontSize - 2), SharedConfig.fontSize - 5)));
                }
            }
        }
    }

    public static void createCommonChatResources() {
        createCommonMessageResources();
        if (chat_infoPaint == null) {
            updateAllColors();
            chat_infoPaint = new TextPaint(1);
            TextPaint textPaint = new TextPaint(1);
            chat_infoBoldPaint = textPaint;
            textPaint.setTypeface(AndroidUtilities.bold());
            TextPaint textPaint2 = new TextPaint(1);
            chat_stickerCommentCountPaint = textPaint2;
            textPaint2.setTypeface(AndroidUtilities.bold());
            TextPaint textPaint3 = new TextPaint(1);
            chat_docNamePaint = textPaint3;
            textPaint3.setTypeface(AndroidUtilities.bold());
            chat_docBackPaint = new Paint(1);
            Paint paint = new Paint(1);
            chat_deleteProgressPaint = paint;
            paint.setStyle(Paint.Style.STROKE);
            chat_deleteProgressPaint.setStrokeCap(Paint.Cap.ROUND);
            TextPaint textPaint4 = new TextPaint(1);
            chat_locationTitlePaint = textPaint4;
            textPaint4.setTypeface(AndroidUtilities.bold());
            chat_locationAddressPaint = new TextPaint(1);
            Paint paint2 = new Paint();
            chat_urlPaint = paint2;
            paint2.setPathEffect(LinkPath.getRoundedEffect());
            Paint paint3 = new Paint();
            chat_outUrlPaint = paint3;
            paint3.setPathEffect(LinkPath.getRoundedEffect());
            Paint paint4 = new Paint();
            chat_textSearchSelectionPaint = paint4;
            paint4.setPathEffect(LinkPath.getRoundedEffect());
            Paint paint5 = new Paint(1);
            chat_radialProgressPaint = paint5;
            paint5.setStrokeCap(Paint.Cap.ROUND);
            chat_radialProgressPaint.setStyle(Paint.Style.STROKE);
            chat_radialProgressPaint.setColor(-1610612737);
            Paint paint6 = new Paint(1);
            chat_radialProgress2Paint = paint6;
            paint6.setStrokeCap(Paint.Cap.ROUND);
            chat_radialProgress2Paint.setStyle(Paint.Style.STROKE);
            chat_audioTimePaint = new TextPaint(1);
            TextPaint textPaint5 = new TextPaint(1);
            chat_livePaint = textPaint5;
            textPaint5.setTypeface(Typeface.DEFAULT_BOLD);
            TextPaint textPaint6 = new TextPaint(1);
            chat_audioTitlePaint = textPaint6;
            textPaint6.setTypeface(AndroidUtilities.bold());
            chat_audioPerformerPaint = new TextPaint(1);
            TextPaint textPaint7 = new TextPaint(1);
            chat_botButtonPaint = textPaint7;
            textPaint7.setTypeface(AndroidUtilities.bold());
            TextPaint textPaint8 = new TextPaint(1);
            chat_contactNamePaint = textPaint8;
            textPaint8.setTypeface(AndroidUtilities.bold());
            chat_contactPhonePaint = new TextPaint(1);
            chat_durationPaint = new TextPaint(1);
            TextPaint textPaint9 = new TextPaint(1);
            chat_gamePaint = textPaint9;
            textPaint9.setTypeface(AndroidUtilities.bold());
            chat_shipmentPaint = new TextPaint(1);
            chat_timePaint = new TextPaint(1);
            chat_adminPaint = new TextPaint(1);
            TextPaint textPaint10 = new TextPaint(1);
            chat_namePaint = textPaint10;
            textPaint10.setTypeface(AndroidUtilities.bold());
            chat_forwardNamePaint = new TextPaint(1);
            TextPaint textPaint11 = new TextPaint(1);
            chat_replyNamePaint = textPaint11;
            textPaint11.setTypeface(AndroidUtilities.bold());
            chat_replyTextPaint = new TextPaint(1);
            TextPaint textPaint12 = new TextPaint(1);
            chat_topicTextPaint = textPaint12;
            textPaint12.setTypeface(AndroidUtilities.bold());
            chat_titleLabelTextPaint = new TextPaint(1);
            chat_commentTextPaint = new TextPaint(1);
            TextPaint textPaint13 = new TextPaint(1);
            chat_instantViewPaint = textPaint13;
            textPaint13.setTypeface(AndroidUtilities.bold());
            Paint paint7 = new Paint(1);
            chat_instantViewRectPaint = paint7;
            paint7.setStyle(Paint.Style.STROKE);
            chat_instantViewRectPaint.setStrokeCap(Paint.Cap.ROUND);
            chat_instantViewButtonPaint = new Paint(1);
            Paint paint8 = new Paint(1);
            chat_pollTimerPaint = paint8;
            paint8.setStyle(Paint.Style.STROKE);
            chat_pollTimerPaint.setStrokeCap(Paint.Cap.ROUND);
            chat_replyLinePaint = new Paint(1);
            chat_msgErrorPaint = new Paint(1);
            chat_statusPaint = new Paint(1);
            Paint paint9 = new Paint(1);
            chat_statusRecordPaint = paint9;
            paint9.setStyle(Paint.Style.STROKE);
            chat_statusRecordPaint.setStrokeCap(Paint.Cap.ROUND);
            chat_actionTextPaint = new TextPaint(1);
            chat_actionTextPaint2 = new TextPaint(1);
            chat_actionTextPaint.setTypeface(AndroidUtilities.bold());
            TextPaint textPaint14 = new TextPaint(1);
            chat_unlockExtendedMediaTextPaint = textPaint14;
            textPaint14.setTypeface(AndroidUtilities.bold());
            Paint paint10 = new Paint(1);
            chat_actionBackgroundGradientDarkenPaint = paint10;
            paint10.setColor(usePlusTheme ? chatDateBubbleColor : 352321536);
            chat_timeBackgroundPaint = new Paint(1);
            TextPaint textPaint15 = new TextPaint(1);
            chat_contextResult_titleTextPaint = textPaint15;
            textPaint15.setTypeface(AndroidUtilities.bold());
            chat_contextResult_descriptionTextPaint = new TextPaint(1);
            chat_composeBackgroundPaint = new Paint();
            new Paint(1);
            chat_radialProgressPausedSeekbarPaint = new Paint(1);
            chat_messageBackgroundSelectedPaint = new Paint(1);
            chat_actionBackgroundPaint = new Paint(7);
            chat_actionBackgroundSelectedPaint = new Paint(7);
            addChatPaint("paintChatMessageBackgroundSelected", chat_messageBackgroundSelectedPaint, key_chat_selectedBackground);
            Paint paint11 = chat_actionBackgroundPaint;
            int i = key_chat_serviceBackground;
            addChatPaint("paintChatActionBackground", paint11, i);
            addChatPaint("paintChatActionBackgroundDarken", chat_actionBackgroundGradientDarkenPaint, i);
            addChatPaint("paintChatActionBackgroundSelected", chat_actionBackgroundSelectedPaint, key_chat_serviceBackgroundSelected);
            TextPaint textPaint16 = chat_actionTextPaint;
            int i2 = key_chat_serviceText;
            addChatPaint("paintChatActionText", textPaint16, i2);
            addChatPaint("paintChatActionText2", chat_actionTextPaint2, i2);
            addChatPaint("paintChatBotButton", chat_botButtonPaint, key_chat_botButtonText);
            addChatPaint("paintChatComposeBackground", chat_composeBackgroundPaint, key_chat_messagePanelBackground);
            addChatPaint("paintChatTimeBackground", chat_timeBackgroundPaint, key_chat_mediaTimeBackground);
        }
    }

    public static void createChatResources(Context context, boolean fontsOnly) {
        TextPaint textPaint;
        createCommonChatResources();
        if (!fontsOnly && chat_msgInDrawable == null) {
            Resources resources = context.getResources();
            chat_msgNoSoundDrawable = resources.getDrawable(R.drawable.video_muted);
            chat_msgInDrawable = new MessageDrawable(0, false, false);
            chat_msgInSelectedDrawable = new MessageDrawable(0, false, true);
            chat_msgOutDrawable = new MessageDrawable(0, true, false);
            chat_msgOutSelectedDrawable = new MessageDrawable(0, true, true);
            chat_msgInMediaDrawable = new MessageDrawable(1, false, false);
            chat_msgInMediaSelectedDrawable = new MessageDrawable(1, false, true);
            chat_msgOutMediaDrawable = new MessageDrawable(1, true, false);
            chat_msgOutMediaSelectedDrawable = new MessageDrawable(1, true, true);
            PathAnimator pathAnimator = new PathAnimator(0.293f, -26.0f, -28.0f, 1.0f);
            playPauseAnimator = pathAnimator;
            pathAnimator.addSvgKeyFrame("M 34.141 16.042 C 37.384 17.921 40.886 20.001 44.211 21.965 C 46.139 23.104 49.285 24.729 49.586 25.917 C 50.289 28.687 48.484 30 46.274 30 L 6 30.021 C 3.79 30.021 2.075 30.023 2 26.021 L 2.009 3.417 C 2.009 0.417 5.326 -0.58 7.068 0.417 C 10.545 2.406 25.024 10.761 34.141 16.042 Z", 166.0f);
            playPauseAnimator.addSvgKeyFrame("M 37.843 17.769 C 41.143 19.508 44.131 21.164 47.429 23.117 C 48.542 23.775 49.623 24.561 49.761 25.993 C 50.074 28.708 48.557 30 46.347 30 L 6 30.012 C 3.79 30.012 2 28.222 2 26.012 L 2.009 4.609 C 2.009 1.626 5.276 0.664 7.074 1.541 C 10.608 3.309 28.488 12.842 37.843 17.769 Z", 200.0f);
            playPauseAnimator.addSvgKeyFrame("M 40.644 18.756 C 43.986 20.389 49.867 23.108 49.884 25.534 C 49.897 27.154 49.88 24.441 49.894 26.059 C 49.911 28.733 48.6 30 46.39 30 L 6 30.013 C 3.79 30.013 2 28.223 2 26.013 L 2.008 5.52 C 2.008 2.55 5.237 1.614 7.079 2.401 C 10.656 4 31.106 14.097 40.644 18.756 Z", 217.0f);
            playPauseAnimator.addSvgKeyFrame("M 43.782 19.218 C 47.117 20.675 50.075 21.538 50.041 24.796 C 50.022 26.606 50.038 24.309 50.039 26.104 C 50.038 28.736 48.663 30 46.453 30 L 6 29.986 C 3.79 29.986 2 28.196 2 25.986 L 2.008 6.491 C 2.008 3.535 5.196 2.627 7.085 3.316 C 10.708 4.731 33.992 14.944 43.782 19.218 Z", 234.0f);
            playPauseAnimator.addSvgKeyFrame("M 47.421 16.941 C 50.544 18.191 50.783 19.91 50.769 22.706 C 50.761 24.484 50.76 23.953 50.79 26.073 C 50.814 27.835 49.334 30 47.124 30 L 5 30.01 C 2.79 30.01 1 28.22 1 26.01 L 1.001 10.823 C 1.001 8.218 3.532 6.895 5.572 7.26 C 7.493 8.01 47.421 16.941 47.421 16.941 Z", 267.0f);
            playPauseAnimator.addSvgKeyFrame("M 47.641 17.125 C 50.641 18.207 51.09 19.935 51.078 22.653 C 51.07 24.191 51.062 21.23 51.088 23.063 C 51.109 24.886 49.587 27 47.377 27 L 5 27.009 C 2.79 27.009 1 25.219 1 23.009 L 0.983 11.459 C 0.983 8.908 3.414 7.522 5.476 7.838 C 7.138 8.486 47.641 17.125 47.641 17.125 Z", 300.0f);
            playPauseAnimator.addSvgKeyFrame("M 48 7 C 50.21 7 52 8.79 52 11 C 52 19 52 19 52 19 C 52 21.21 50.21 23 48 23 L 4 23 C 1.79 23 0 21.21 0 19 L 0 11 C 0 8.79 1.79 7 4 7 C 48 7 48 7 48 7 Z", 383.0f);
            int i = R.drawable.msg_check_s;
            chat_msgOutCheckDrawable = resources.getDrawable(i).mutate();
            chat_msgOutCheckSelectedDrawable = resources.getDrawable(i).mutate();
            chat_msgOutCheckReadDrawable = resources.getDrawable(i).mutate();
            chat_msgOutCheckReadSelectedDrawable = resources.getDrawable(i).mutate();
            chat_msgMediaCheckDrawable = resources.getDrawable(i).mutate();
            chat_msgStickerCheckDrawable = resources.getDrawable(i).mutate();
            int i2 = R.drawable.msg_halfcheck;
            chat_msgOutHalfCheckDrawable = resources.getDrawable(i2).mutate();
            chat_msgOutHalfCheckSelectedDrawable = resources.getDrawable(i2).mutate();
            int i3 = R.drawable.msg_halfcheck_s;
            chat_msgMediaHalfCheckDrawable = resources.getDrawable(i3).mutate();
            chat_msgStickerHalfCheckDrawable = resources.getDrawable(i3).mutate();
            chat_msgClockDrawable = new MsgClockDrawable();
            int i4 = R.drawable.ic_lock_header;
            chat_msgUnlockDrawable = resources.getDrawable(i4).mutate();
            int i5 = R.drawable.msg_views;
            chat_msgInViewsDrawable = resources.getDrawable(i5).mutate();
            chat_msgInViewsSelectedDrawable = resources.getDrawable(i5).mutate();
            chat_msgOutViewsDrawable = resources.getDrawable(i5).mutate();
            chat_msgOutViewsSelectedDrawable = resources.getDrawable(i5).mutate();
            int i6 = R.drawable.msg_reply_small;
            chat_msgInRepliesDrawable = resources.getDrawable(i6).mutate();
            chat_msgInRepliesSelectedDrawable = resources.getDrawable(i6).mutate();
            chat_msgOutRepliesDrawable = resources.getDrawable(i6).mutate();
            chat_msgOutRepliesSelectedDrawable = resources.getDrawable(i6).mutate();
            int i7 = R.drawable.msg_pin_mini;
            chat_msgInPinnedDrawable = resources.getDrawable(i7).mutate();
            chat_msgInPinnedSelectedDrawable = resources.getDrawable(i7).mutate();
            chat_msgOutPinnedDrawable = resources.getDrawable(i7).mutate();
            chat_msgOutPinnedSelectedDrawable = resources.getDrawable(i7).mutate();
            chat_msgMediaPinnedDrawable = resources.getDrawable(i7).mutate();
            chat_msgStickerPinnedDrawable = resources.getDrawable(i7).mutate();
            chat_msgMediaViewsDrawable = resources.getDrawable(i5).mutate();
            chat_msgMediaRepliesDrawable = resources.getDrawable(i6).mutate();
            chat_msgStickerViewsDrawable = resources.getDrawable(i5).mutate();
            chat_msgStickerRepliesDrawable = resources.getDrawable(i6).mutate();
            int i8 = R.drawable.msg_actions;
            chat_msgInMenuDrawable = resources.getDrawable(i8).mutate();
            chat_msgInMenuSelectedDrawable = resources.getDrawable(i8).mutate();
            chat_msgOutMenuDrawable = resources.getDrawable(i8).mutate();
            chat_msgOutMenuSelectedDrawable = resources.getDrawable(i8).mutate();
            chat_msgMediaMenuDrawable = resources.getDrawable(R.drawable.video_actions);
            int i9 = R.drawable.msg_instant;
            chat_msgInInstantDrawable = resources.getDrawable(i9).mutate();
            chat_msgOutInstantDrawable = resources.getDrawable(i9).mutate();
            chat_msgErrorDrawable = resources.getDrawable(R.drawable.msg_warning);
            chat_muteIconDrawable = resources.getDrawable(R.drawable.list_mute).mutate();
            chat_lockIconDrawable = resources.getDrawable(i4);
            int i10 = R.drawable.broadcast3;
            chat_msgBroadcastDrawable = resources.getDrawable(i10).mutate();
            chat_msgBroadcastMediaDrawable = resources.getDrawable(i10).mutate();
            Drawable[] drawableArr = chat_msgInCallDrawable;
            int i11 = R.drawable.chat_calls_voice;
            drawableArr[0] = resources.getDrawable(i11).mutate();
            chat_msgInCallSelectedDrawable[0] = resources.getDrawable(i11).mutate();
            chat_msgOutCallDrawable[0] = resources.getDrawable(i11).mutate();
            chat_msgOutCallSelectedDrawable[0] = resources.getDrawable(i11).mutate();
            Drawable[] drawableArr2 = chat_msgInCallDrawable;
            int i12 = R.drawable.chat_calls_video;
            drawableArr2[1] = resources.getDrawable(i12).mutate();
            chat_msgInCallSelectedDrawable[1] = resources.getDrawable(i12).mutate();
            chat_msgOutCallDrawable[1] = resources.getDrawable(i12).mutate();
            chat_msgOutCallSelectedDrawable[1] = resources.getDrawable(i12).mutate();
            chat_msgCallUpGreenDrawable = resources.getDrawable(R.drawable.chat_calls_outgoing).mutate();
            int i13 = R.drawable.chat_calls_incoming;
            chat_msgCallDownRedDrawable = resources.getDrawable(i13).mutate();
            chat_msgCallDownGreenDrawable = resources.getDrawable(i13).mutate();
            for (int i14 = 0; i14 < 2; i14++) {
                chat_pollCheckDrawable[i14] = resources.getDrawable(R.drawable.poll_right).mutate();
                chat_pollCrossDrawable[i14] = resources.getDrawable(R.drawable.poll_wrong).mutate();
                chat_pollHintDrawable[i14] = resources.getDrawable(R.drawable.msg_emoji_objects).mutate();
                chat_psaHelpDrawable[i14] = resources.getDrawable(R.drawable.msg_psa).mutate();
            }
            int i15 = R.drawable.ic_call_made_green_18dp;
            calllog_msgCallUpRedDrawable = resources.getDrawable(i15).mutate();
            calllog_msgCallUpGreenDrawable = resources.getDrawable(i15).mutate();
            int i16 = R.drawable.ic_call_received_green_18dp;
            calllog_msgCallDownRedDrawable = resources.getDrawable(i16).mutate();
            calllog_msgCallDownGreenDrawable = resources.getDrawable(i16).mutate();
            chat_inlineResultFile = resources.getDrawable(R.drawable.bot_file);
            chat_inlineResultAudio = resources.getDrawable(R.drawable.bot_music);
            chat_inlineResultLocation = resources.getDrawable(R.drawable.bot_location);
            chat_botLinkDrawable = resources.getDrawable(R.drawable.bot_link);
            chat_botInlineDrawable = resources.getDrawable(R.drawable.bot_lines);
            chat_botCardDrawable = resources.getDrawable(R.drawable.bot_card);
            chat_botWebViewDrawable = resources.getDrawable(R.drawable.bot_webview);
            chat_botInviteDrawable = resources.getDrawable(R.drawable.bot_invite);
            chat_commentDrawable = resources.getDrawable(R.drawable.msg_msgbubble);
            chat_commentStickerDrawable = resources.getDrawable(R.drawable.msg_msgbubble2);
            chat_commentArrowDrawable = resources.getDrawable(R.drawable.msg_arrowright);
            chat_gradientLeftDrawable = resources.getDrawable(R.drawable.gradient_left);
            chat_gradientRightDrawable = resources.getDrawable(R.drawable.gradient_right);
            chat_contextResult_shadowUnderSwitchDrawable = resources.getDrawable(R.drawable.header_shadow).mutate();
            chat_attachButtonDrawables[0] = new RLottieDrawable(R.raw.attach_gallery, "attach_gallery", AndroidUtilities.dp(26.0f), AndroidUtilities.dp(26.0f));
            chat_attachButtonDrawables[1] = new RLottieDrawable(R.raw.attach_music, "attach_music", AndroidUtilities.dp(26.0f), AndroidUtilities.dp(26.0f));
            chat_attachButtonDrawables[2] = new RLottieDrawable(R.raw.attach_file, "attach_file", AndroidUtilities.dp(26.0f), AndroidUtilities.dp(26.0f));
            chat_attachButtonDrawables[3] = new RLottieDrawable(R.raw.attach_contact, "attach_contact", AndroidUtilities.dp(26.0f), AndroidUtilities.dp(26.0f));
            chat_attachButtonDrawables[4] = new RLottieDrawable(R.raw.attach_location, "attach_location", AndroidUtilities.dp(26.0f), AndroidUtilities.dp(26.0f));
            chat_attachButtonDrawables[5] = new RLottieDrawable(R.raw.attach_poll, "attach_poll", AndroidUtilities.dp(26.0f), AndroidUtilities.dp(26.0f));
            chat_attachEmptyDrawable = resources.getDrawable(R.drawable.nophotos3);
            chat_shareIconDrawable = resources.getDrawable(R.drawable.filled_button_share).mutate();
            chat_replyIconDrawable = resources.getDrawable(R.drawable.filled_button_reply);
            chat_closeIconDrawable = resources.getDrawable(R.drawable.msg_voiceclose).mutate();
            chat_moreIconDrawable = resources.getDrawable(R.drawable.media_more).mutate();
            chat_goIconDrawable = resources.getDrawable(R.drawable.filled_open_message);
            chat_cloudIconDrawable = resources.getDrawable(R.drawable.cloud).mutate();
            chat_translateIconDrawable = resources.getDrawable(R.drawable.translate).mutate();
            chat_copyIconDrawable = resources.getDrawable(R.drawable.copy).mutate();
            chat_markIconDrawable = resources.getDrawable(R.drawable.mark).mutate();
            chat_forwardIconDrawable = resources.getDrawable(R.drawable.forward).mutate();
            chat_forwardQuoteIconDrawable = resources.getDrawable(R.drawable.forward_quote).mutate();
            chat_deleteIconDrawable = resources.getDrawable(R.drawable.delete_white).mutate();
            chat_editIconDrawable = resources.getDrawable(R.drawable.edit).mutate();
            chat_clearIconDrawable = resources.getDrawable(R.drawable.clear).mutate();
            chat_reportIconDrawable = resources.getDrawable(R.drawable.report).mutate();
            int dp = AndroidUtilities.dp(2.0f);
            RectF rectF = new RectF();
            chat_filePath[0] = new Path();
            chat_filePath[0].moveTo(AndroidUtilities.dp(7.0f), AndroidUtilities.dp(3.0f));
            chat_filePath[0].lineTo(AndroidUtilities.dp(14.0f), AndroidUtilities.dp(3.0f));
            chat_filePath[0].lineTo(AndroidUtilities.dp(21.0f), AndroidUtilities.dp(10.0f));
            chat_filePath[0].lineTo(AndroidUtilities.dp(21.0f), AndroidUtilities.dp(20.0f));
            int i17 = dp * 2;
            rectF.set(AndroidUtilities.dp(21.0f) - i17, AndroidUtilities.dp(19.0f) - dp, AndroidUtilities.dp(21.0f), AndroidUtilities.dp(19.0f) + dp);
            chat_filePath[0].arcTo(rectF, 0.0f, 90.0f, false);
            chat_filePath[0].lineTo(AndroidUtilities.dp(6.0f), AndroidUtilities.dp(21.0f));
            rectF.set(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(19.0f) - dp, AndroidUtilities.dp(5.0f) + i17, AndroidUtilities.dp(19.0f) + dp);
            chat_filePath[0].arcTo(rectF, 90.0f, 90.0f, false);
            chat_filePath[0].lineTo(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(4.0f));
            rectF.set(AndroidUtilities.dp(5.0f), AndroidUtilities.dp(3.0f), AndroidUtilities.dp(5.0f) + i17, AndroidUtilities.dp(3.0f) + i17);
            chat_filePath[0].arcTo(rectF, 180.0f, 90.0f, false);
            chat_filePath[0].close();
            chat_filePath[1] = new Path();
            chat_filePath[1].moveTo(AndroidUtilities.dp(14.0f), AndroidUtilities.dp(5.0f));
            chat_filePath[1].lineTo(AndroidUtilities.dp(19.0f), AndroidUtilities.dp(10.0f));
            chat_filePath[1].lineTo(AndroidUtilities.dp(14.0f), AndroidUtilities.dp(10.0f));
            chat_filePath[1].close();
            chat_flameIcon = resources.getDrawable(R.drawable.filled_fire).mutate();
            chat_gifIcon = resources.getDrawable(R.drawable.msg_round_gif_m).mutate();
            Drawable[] drawableArr3 = chat_fileStatesDrawable[0];
            int dp2 = AndroidUtilities.dp(44.0f);
            int i18 = R.drawable.msg_round_play_m;
            drawableArr3[0] = createCircleDrawableWithIcon(dp2, i18);
            chat_fileStatesDrawable[0][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44.0f), i18);
            Drawable[] drawableArr4 = chat_fileStatesDrawable[1];
            int dp3 = AndroidUtilities.dp(44.0f);
            int i19 = R.drawable.msg_round_pause_m;
            drawableArr4[0] = createCircleDrawableWithIcon(dp3, i19);
            chat_fileStatesDrawable[1][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44.0f), i19);
            Drawable[] drawableArr5 = chat_fileStatesDrawable[2];
            int dp4 = AndroidUtilities.dp(44.0f);
            int i20 = R.drawable.msg_round_load_m;
            drawableArr5[0] = createCircleDrawableWithIcon(dp4, i20);
            chat_fileStatesDrawable[2][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44.0f), i20);
            Drawable[] drawableArr6 = chat_fileStatesDrawable[3];
            int dp5 = AndroidUtilities.dp(44.0f);
            int i21 = R.drawable.msg_round_file_s;
            drawableArr6[0] = createCircleDrawableWithIcon(dp5, i21);
            chat_fileStatesDrawable[3][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44.0f), i21);
            Drawable[] drawableArr7 = chat_fileStatesDrawable[4];
            int dp6 = AndroidUtilities.dp(44.0f);
            int i22 = R.drawable.msg_round_cancel_m;
            drawableArr7[0] = createCircleDrawableWithIcon(dp6, i22);
            chat_fileStatesDrawable[4][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44.0f), i22);
            Drawable[] drawableArr8 = chat_contactDrawable;
            int dp7 = AndroidUtilities.dp(44.0f);
            int i23 = R.drawable.msg_contact;
            drawableArr8[0] = createCircleDrawableWithIcon(dp7, i23);
            chat_contactDrawable[1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44.0f), i23);
            Drawable[] drawableArr9 = chat_locationDrawable;
            int i24 = R.drawable.msg_location;
            drawableArr9[0] = resources.getDrawable(i24).mutate();
            chat_locationDrawable[1] = resources.getDrawable(i24).mutate();
            chat_composeShadowDrawable = context.getResources().getDrawable(R.drawable.compose_panel_shadow).mutate();
            chat_composeShadowRoundDrawable = context.getResources().getDrawable(R.drawable.sheet_shadow_round).mutate();
            chat_roundVideoShadow = new RoundVideoShadow();
            chat_markedMsgDrawable = resources.getDrawable(R.drawable.bookmark_white_18);
            setBubbles(context);
            setChecks(context);
            updatePlusPrefs();
            defaultChatDrawables.clear();
            defaultChatDrawableColorKeys.clear();
            Drawable drawable = chat_botInlineDrawable;
            int i25 = key_chat_serviceIcon;
            addChatDrawable("drawableBotInline", drawable, i25);
            addChatDrawable("drawableBotWebView", chat_botWebViewDrawable, i25);
            addChatDrawable("drawableBotLink", chat_botLinkDrawable, i25);
            addChatDrawable("drawable_botInvite", chat_botInviteDrawable, i25);
            addChatDrawable("drawableGoIcon", chat_goIconDrawable, i25);
            addChatDrawable("drawableCommentSticker", chat_commentStickerDrawable, i25);
            addChatDrawable("drawableMsgError", chat_msgErrorDrawable, key_chat_sentErrorIcon);
            addChatDrawable("drawableMsgIn", chat_msgInDrawable, usePlusTheme ? key_chat_inBubble : -1);
            addChatDrawable("drawableMsgInSelected", chat_msgInSelectedDrawable, usePlusTheme ? key_chat_inBubbleSelected : -1);
            addChatDrawable("drawableMsgInMedia", chat_msgInMediaDrawable, usePlusTheme ? key_chat_inBubble : -1);
            addChatDrawable("drawableMsgInMediaSelected", chat_msgInMediaSelectedDrawable, usePlusTheme ? key_chat_inBubbleSelected : -1);
            addChatDrawable("drawableMsgInInstant", chat_msgInInstantDrawable, key_chat_inInstant);
            addChatDrawable("drawableMsgOut", chat_msgOutDrawable, usePlusTheme ? key_chat_outBubble : -1);
            addChatDrawable("drawableMsgOutSelected", chat_msgOutSelectedDrawable, usePlusTheme ? key_chat_outBubbleSelected : -1);
            addChatDrawable("drawableMsgOutMedia", chat_msgOutMediaDrawable, usePlusTheme ? key_chat_outBubble : -1);
            addChatDrawable("drawableMsgOutMediaSelected", chat_msgOutMediaSelectedDrawable, usePlusTheme ? key_chat_outBubble : -1);
            Drawable drawable2 = chat_msgOutCallDrawable[0];
            int i26 = key_chat_outInstant;
            addChatDrawable("drawableMsgOutCallAudio", drawable2, i26);
            Drawable drawable3 = chat_msgOutCallSelectedDrawable[0];
            int i27 = key_chat_outInstantSelected;
            addChatDrawable("drawableMsgOutCallAudioSelected", drawable3, i27);
            addChatDrawable("drawableMsgOutCallVideo", chat_msgOutCallDrawable[1], i26);
            addChatDrawable("drawableMsgOutCallVideo", chat_msgOutCallSelectedDrawable[1], i27);
            addChatDrawable("drawableMsgOutCheck", chat_msgOutCheckDrawable, key_chat_outSentCheck);
            addChatDrawable("drawableMsgOutCheckSelected", chat_msgOutCheckSelectedDrawable, key_chat_outSentCheckSelected);
            Drawable drawable4 = chat_msgOutCheckReadDrawable;
            int i28 = key_chat_outSentCheckRead;
            addChatDrawable("drawableMsgOutCheckRead", drawable4, i28);
            Drawable drawable5 = chat_msgOutCheckReadSelectedDrawable;
            int i29 = key_chat_outSentCheckReadSelected;
            addChatDrawable("drawableMsgOutCheckReadSelected", drawable5, i29);
            addChatDrawable("drawableMsgOutHalfCheck", chat_msgOutHalfCheckDrawable, i28);
            addChatDrawable("drawableMsgOutHalfCheckSelected", chat_msgOutHalfCheckSelectedDrawable, i29);
            addChatDrawable("drawableMsgOutInstant", chat_msgOutInstantDrawable, i26);
            addChatDrawable("drawableMsgOutMenu", chat_msgOutMenuDrawable, key_chat_outMenu);
            addChatDrawable("drawableMsgOutMenuSelected", chat_msgOutMenuSelectedDrawable, key_chat_outMenuSelected);
            Drawable drawable6 = chat_msgOutPinnedDrawable;
            int i30 = key_chat_outViews;
            addChatDrawable("drawableMsgOutPinned", drawable6, i30);
            Drawable drawable7 = chat_msgOutPinnedSelectedDrawable;
            int i31 = key_chat_outViewsSelected;
            addChatDrawable("drawableMsgOutPinnedSelected", drawable7, i31);
            addChatDrawable("drawableMsgOutReplies", chat_msgOutRepliesDrawable, i30);
            addChatDrawable("drawableMsgOutReplies", chat_msgOutRepliesSelectedDrawable, i31);
            addChatDrawable("drawableMsgOutViews", chat_msgOutViewsDrawable, i30);
            addChatDrawable("drawableMsgOutViewsSelected", chat_msgOutViewsSelectedDrawable, i31);
            Drawable drawable8 = chat_msgStickerCheckDrawable;
            int i32 = key_chat_serviceText;
            addChatDrawable("drawableMsgStickerCheck", drawable8, i32);
            addChatDrawable("drawableMsgStickerHalfCheck", chat_msgStickerHalfCheckDrawable, i32);
            addChatDrawable("drawableMsgStickerPinned", chat_msgStickerPinnedDrawable, i32);
            addChatDrawable("drawableMsgStickerReplies", chat_msgStickerRepliesDrawable, i32);
            addChatDrawable("drawableMsgStickerViews", chat_msgStickerViewsDrawable, i32);
            addChatDrawable("drawableReplyIcon", chat_replyIconDrawable, i25);
            addChatDrawable("drawableCloseIcon", chat_closeIconDrawable, i25);
            addChatDrawable("drawableMoreIcon", chat_moreIconDrawable, i25);
            addChatDrawable("drawableShareIcon", chat_shareIconDrawable, i25);
            addChatDrawable("drawableMuteIcon", chat_muteIconDrawable, key_chat_muteIcon);
            addChatDrawable("drawableLockIcon", chat_lockIconDrawable, key_chat_lockIcon);
            addChatDrawable("drawable_chat_pollHintDrawableOut", chat_pollHintDrawable[1], key_chat_outPreviewInstantText);
            addChatDrawable("drawable_chat_pollHintDrawableIn", chat_pollHintDrawable[0], key_chat_inPreviewInstantText);
            addChatDrawable("drawableCloudIcon", chat_cloudIconDrawable, i25);
            addChatDrawable("drawableTranslateIcon", chat_translateIconDrawable, i25);
            addChatDrawable("drawableCopyIcon", chat_copyIconDrawable, i25);
            addChatDrawable("drawableMarkIcon", chat_markIconDrawable, i25);
            addChatDrawable("drawableForwardIcon", chat_forwardIconDrawable, i25);
            addChatDrawable("drawableForwardQuoteIcon", chat_forwardQuoteIconDrawable, i25);
            addChatDrawable("drawableDeleteIcon", chat_deleteIconDrawable, i25);
            addChatDrawable("drawableEditIcon", chat_editIconDrawable, i25);
            addChatDrawable("drawableClearIcon", chat_clearIconDrawable, i25);
            addChatDrawable("drawableReportIcon", chat_reportIconDrawable, i25);
            applyChatTheme(fontsOnly, false);
        }
        if (fontsOnly || (textPaint = chat_infoPaint) == null) {
            return;
        }
        textPaint.setTextSize(AndroidUtilities.dp(12.0f));
        chat_infoBoldPaint.setTextSize(AndroidUtilities.dp(12.0f));
        chat_stickerCommentCountPaint.setTextSize(AndroidUtilities.dp(11.0f));
        chat_docNamePaint.setTextSize(AndroidUtilities.dp(15.0f));
        chat_locationTitlePaint.setTextSize(AndroidUtilities.dp(15.0f));
        chat_locationAddressPaint.setTextSize(AndroidUtilities.dp(13.0f));
        chat_audioTimePaint.setTextSize(AndroidUtilities.dp(12.0f));
        chat_livePaint.setTextSize(AndroidUtilities.dp(12.0f));
        chat_audioTitlePaint.setTextSize(AndroidUtilities.dp(16.0f));
        chat_audioPerformerPaint.setTextSize(AndroidUtilities.dp(15.0f));
        chat_botButtonPaint.setTextSize(AndroidUtilities.dp(15.0f));
        chat_contactNamePaint.setTextSize(AndroidUtilities.dp(15.0f));
        chat_contactPhonePaint.setTextSize(AndroidUtilities.dp(13.0f));
        chat_durationPaint.setTextSize(AndroidUtilities.dp(12.0f));
        chat_namePaint.setTextSize(AndroidUtilities.dp(r0));
        chat_replyNamePaint.setTextSize(AndroidUtilities.dp(r0));
        chat_replyTextPaint.setTextSize(AndroidUtilities.dp(r0));
        float f = (((SharedConfig.fontSize * 2) + 10) / 3.0f) - 1.0f;
        chat_topicTextPaint.setTextSize(AndroidUtilities.dp(f));
        chat_forwardNamePaint.setTextSize(AndroidUtilities.dp(r0));
        chat_adminPaint.setTextSize(AndroidUtilities.dp(f));
        int i33 = SharedConfig.fontSize;
        chat_timePaint.setTextSize(AndroidUtilities.dp(12.0f));
        chat_gamePaint.setTextSize(AndroidUtilities.dp(13.0f));
        chat_shipmentPaint.setTextSize(AndroidUtilities.dp(13.0f));
        chat_instantViewPaint.setTextSize(AndroidUtilities.dp(13.0f));
        chat_instantViewRectPaint.setStrokeWidth(AndroidUtilities.dp(1.0f));
        chat_pollTimerPaint.setStrokeWidth(AndroidUtilities.dp(1.1f));
        chat_actionTextPaint.setTextSize(AndroidUtilities.dp(Math.max(16, SharedConfig.fontSize) - 2));
        chat_actionTextPaint2.setTextSize(AndroidUtilities.dp(Math.max(16, SharedConfig.fontSize) - 2));
        chat_unlockExtendedMediaTextPaint.setTextSize(AndroidUtilities.dp(Math.max(16, SharedConfig.fontSize)));
        chat_contextResult_titleTextPaint.setTextSize(AndroidUtilities.dp(15.0f));
        chat_contextResult_descriptionTextPaint.setTextSize(AndroidUtilities.dp(13.0f));
        chat_radialProgressPaint.setStrokeWidth(AndroidUtilities.dp(3.0f));
        chat_radialProgress2Paint.setStrokeWidth(AndroidUtilities.dp(2.33f));
        chat_commentTextPaint.setTextSize(AndroidUtilities.dp(14.0f));
        chat_commentTextPaint.setTypeface(AndroidUtilities.bold());
    }

    public static void refreshAttachButtonsColors() {
        int i = 0;
        while (true) {
            RLottieDrawable[] rLottieDrawableArr = chat_attachButtonDrawables;
            if (i >= rLottieDrawableArr.length) {
                return;
            }
            if (rLottieDrawableArr[i] != null) {
                rLottieDrawableArr[i].beginApplyLayerColors();
                if (i == 0) {
                    RLottieDrawable rLottieDrawable = chat_attachButtonDrawables[i];
                    int i2 = key_chat_attachGalleryBackground;
                    rLottieDrawable.setLayerColor("Color_Mount.**", getNonAnimatedColor(i2));
                    chat_attachButtonDrawables[i].setLayerColor("Color_PhotoShadow.**", getNonAnimatedColor(i2));
                    RLottieDrawable rLottieDrawable2 = chat_attachButtonDrawables[i];
                    int i3 = key_chat_attachIcon;
                    rLottieDrawable2.setLayerColor("White_Photo.**", getNonAnimatedColor(i3));
                    chat_attachButtonDrawables[i].setLayerColor("White_BackPhoto.**", getNonAnimatedColor(i3));
                } else if (i == 1) {
                    RLottieDrawable rLottieDrawable3 = chat_attachButtonDrawables[i];
                    int i4 = key_chat_attachIcon;
                    rLottieDrawable3.setLayerColor("White_Play1.**", getNonAnimatedColor(i4));
                    chat_attachButtonDrawables[i].setLayerColor("White_Play2.**", getNonAnimatedColor(i4));
                } else if (i == 2) {
                    chat_attachButtonDrawables[i].setLayerColor("Color_Corner.**", getNonAnimatedColor(key_chat_attachFileBackground));
                    chat_attachButtonDrawables[i].setLayerColor("White_List.**", getNonAnimatedColor(key_chat_attachIcon));
                } else if (i == 3) {
                    RLottieDrawable rLottieDrawable4 = chat_attachButtonDrawables[i];
                    int i5 = key_chat_attachIcon;
                    rLottieDrawable4.setLayerColor("White_User1.**", getNonAnimatedColor(i5));
                    chat_attachButtonDrawables[i].setLayerColor("White_User2.**", getNonAnimatedColor(i5));
                } else if (i == 4) {
                    chat_attachButtonDrawables[i].setLayerColor("Color_Oval.**", getNonAnimatedColor(key_chat_attachLocationBackground));
                    chat_attachButtonDrawables[i].setLayerColor("White_Pin.**", getNonAnimatedColor(key_chat_attachIcon));
                } else if (i == 5) {
                    RLottieDrawable rLottieDrawable5 = chat_attachButtonDrawables[i];
                    int i6 = key_chat_attachIcon;
                    rLottieDrawable5.setLayerColor("White_Column 1.**", getNonAnimatedColor(i6));
                    chat_attachButtonDrawables[i].setLayerColor("White_Column 2.**", getNonAnimatedColor(i6));
                    chat_attachButtonDrawables[i].setLayerColor("White_Column 3.**", getNonAnimatedColor(i6));
                }
                chat_attachButtonDrawables[i].commitApplyLayerColors();
            }
            i++;
        }
    }

    public static void applyChatTheme(boolean fontsOnly, boolean bg) {
        if (chat_msgTextPaint == null || chat_msgInDrawable == null || fontsOnly) {
            return;
        }
        chat_gamePaint.setColor(getColor(key_chat_previewGameText));
        chat_durationPaint.setColor(getColor(key_chat_previewDurationText));
        chat_botButtonPaint.setColor(getColor(key_chat_botButtonText));
        chat_urlPaint.setColor(getColor(key_chat_linkSelectBackground));
        chat_outUrlPaint.setColor(getColor(key_chat_outLinkSelectBackground));
        chat_textSearchSelectionPaint.setColor(getColor(key_chat_textSelectBackground));
        chat_msgErrorPaint.setColor(getColor(key_chat_sentError));
        Paint paint = chat_statusPaint;
        int i = key_chat_status;
        paint.setColor(getColor(i));
        chat_statusRecordPaint.setColor(getColor(i));
        TextPaint textPaint = chat_actionTextPaint;
        int i2 = key_chat_serviceText;
        textPaint.setColor(getColor(i2));
        chat_actionTextPaint2.setColor(getColor(i2));
        chat_actionTextPaint.linkColor = getColor(key_chat_serviceLink);
        chat_unlockExtendedMediaTextPaint.setColor(getColor(i2));
        chat_contextResult_titleTextPaint.setColor(getColor(key_windowBackgroundWhiteBlackText));
        chat_composeBackgroundPaint.setColor(getColor(key_chat_messagePanelBackground));
        chat_timeBackgroundPaint.setColor(getColor(key_chat_mediaTimeBackground));
        Drawable drawable = chat_msgNoSoundDrawable;
        int i3 = key_chat_mediaTimeText;
        setDrawableColorByKey(drawable, i3);
        MessageDrawable messageDrawable = chat_msgInDrawable;
        int i4 = key_chat_inBubble;
        setDrawableColorByKey(messageDrawable, i4);
        MessageDrawable messageDrawable2 = chat_msgInSelectedDrawable;
        int i5 = key_chat_inBubbleSelected;
        setDrawableColorByKey(messageDrawable2, i5);
        setDrawableColorByKey(chat_msgInMediaDrawable, i4);
        setDrawableColorByKey(chat_msgInMediaSelectedDrawable, i5);
        if (chatBubbleStyleVal > 0) {
            setDrawableColorByKeyIN(chat_msgNoSoundDrawable, i3);
            setDrawableColorByKeyIN(chat_msgInDrawable, i4);
            setDrawableColorByKeyIN(chat_msgInSelectedDrawable, i5);
            MessageDrawable messageDrawable3 = chat_msgOutDrawable;
            int i6 = key_chat_outBubble;
            setDrawableColorByKeyIN(messageDrawable3, i6);
            MessageDrawable messageDrawable4 = chat_msgOutSelectedDrawable;
            int i7 = key_chat_outBubbleSelected;
            setDrawableColorByKeyIN(messageDrawable4, i7);
            setDrawableColorByKeyIN(chat_msgInMediaDrawable, i4);
            setDrawableColorByKeyIN(chat_msgInMediaSelectedDrawable, i5);
            setDrawableColorByKeyIN(chat_msgOutMediaDrawable, i6);
            setDrawableColorByKeyIN(chat_msgOutMediaSelectedDrawable, i7);
        }
        setDrawableColorByKey(chat_msgOutCheckDrawable, key_chat_outSentCheck);
        setDrawableColorByKey(chat_msgOutCheckSelectedDrawable, key_chat_outSentCheckSelected);
        Drawable drawable2 = chat_msgOutCheckReadDrawable;
        int i8 = key_chat_outSentCheckRead;
        setDrawableColorByKey(drawable2, i8);
        Drawable drawable3 = chat_msgOutCheckReadSelectedDrawable;
        int i9 = key_chat_outSentCheckReadSelected;
        setDrawableColorByKey(drawable3, i9);
        setDrawableColorByKey(chat_msgOutHalfCheckDrawable, i8);
        setDrawableColorByKey(chat_msgOutHalfCheckSelectedDrawable, i9);
        Drawable drawable4 = chat_msgMediaCheckDrawable;
        int i10 = key_chat_mediaSentCheck;
        setDrawableColorByKey(drawable4, i10);
        setDrawableColorByKey(chat_msgMediaHalfCheckDrawable, i10);
        setDrawableColorByKey(chat_msgStickerCheckDrawable, i2);
        setDrawableColorByKey(chat_msgStickerHalfCheckDrawable, i2);
        setDrawableColorByKey(chat_msgStickerViewsDrawable, i2);
        setDrawableColorByKey(chat_msgStickerRepliesDrawable, i2);
        setDrawableColorByKey(chat_msgUnlockDrawable, i2);
        Drawable drawable5 = chat_shareIconDrawable;
        int i11 = key_chat_serviceIcon;
        setDrawableColorByKey(drawable5, i11);
        setDrawableColorByKey(chat_replyIconDrawable, i11);
        setDrawableColorByKey(chat_goIconDrawable, i11);
        setDrawableColorByKey(chat_cloudIconDrawable, i11);
        setDrawableColorByKey(chat_translateIconDrawable, i11);
        setDrawableColorByKey(chat_copyIconDrawable, i11);
        setDrawableColorByKey(chat_markIconDrawable, i11);
        setDrawableColorByKey(chat_forwardIconDrawable, i11);
        setDrawableColorByKey(chat_forwardQuoteIconDrawable, i11);
        setDrawableColorByKey(chat_deleteIconDrawable, i11);
        setDrawableColorByKey(chat_editIconDrawable, i11);
        setDrawableColorByKey(chat_clearIconDrawable, i11);
        setDrawableColorByKey(chat_reportIconDrawable, i11);
        setDrawableColorByKey(chat_botInlineDrawable, i11);
        setDrawableColorByKey(chat_botWebViewDrawable, i11);
        setDrawableColorByKey(chat_botInviteDrawable, i11);
        setDrawableColorByKey(chat_botLinkDrawable, i11);
        Drawable drawable6 = chat_msgInViewsDrawable;
        int i12 = key_chat_inViews;
        setDrawableColorByKey(drawable6, i12);
        Drawable drawable7 = chat_msgInViewsSelectedDrawable;
        int i13 = key_chat_inViewsSelected;
        setDrawableColorByKey(drawable7, i13);
        Drawable drawable8 = chat_msgOutViewsDrawable;
        int i14 = key_chat_outViews;
        setDrawableColorByKey(drawable8, i14);
        Drawable drawable9 = chat_msgOutViewsSelectedDrawable;
        int i15 = key_chat_outViewsSelected;
        setDrawableColorByKey(drawable9, i15);
        setDrawableColorByKey(chat_msgInRepliesDrawable, i12);
        setDrawableColorByKey(chat_msgInRepliesSelectedDrawable, i13);
        setDrawableColorByKey(chat_msgOutRepliesDrawable, i14);
        setDrawableColorByKey(chat_msgOutRepliesSelectedDrawable, i15);
        setDrawableColorByKey(chat_msgInPinnedDrawable, i12);
        setDrawableColorByKey(chat_msgInPinnedSelectedDrawable, i13);
        setDrawableColorByKey(chat_msgOutPinnedDrawable, i14);
        setDrawableColorByKey(chat_msgOutPinnedSelectedDrawable, i15);
        Drawable drawable10 = chat_msgMediaPinnedDrawable;
        int i16 = key_chat_mediaViews;
        setDrawableColorByKey(drawable10, i16);
        setDrawableColorByKey(chat_msgStickerPinnedDrawable, i2);
        setDrawableColorByKey(chat_msgMediaViewsDrawable, i16);
        setDrawableColorByKey(chat_msgMediaRepliesDrawable, i16);
        setDrawableColorByKey(chat_msgInMenuDrawable, key_chat_inMenu);
        setDrawableColorByKey(chat_msgInMenuSelectedDrawable, key_chat_inMenuSelected);
        setDrawableColorByKey(chat_msgOutMenuDrawable, key_chat_outMenu);
        setDrawableColorByKey(chat_msgOutMenuSelectedDrawable, key_chat_outMenuSelected);
        setDrawableColorByKey(chat_msgMediaMenuDrawable, key_chat_mediaMenu);
        setDrawableColorByKey(chat_msgOutInstantDrawable, key_chat_outInstant);
        Drawable drawable11 = chat_msgInInstantDrawable;
        int i17 = key_chat_inInstant;
        setDrawableColorByKey(drawable11, i17);
        setDrawableColorByKey(chat_msgErrorDrawable, key_chat_sentErrorIcon);
        setDrawableColorByKey(chat_muteIconDrawable, key_chat_muteIcon);
        setDrawableColorByKey(chat_lockIconDrawable, key_chat_lockIcon);
        Drawable drawable12 = chat_inlineResultFile;
        int i18 = key_chat_inlineResultIcon;
        setDrawableColorByKey(drawable12, i18);
        setDrawableColorByKey(chat_inlineResultAudio, i18);
        setDrawableColorByKey(chat_inlineResultLocation, i18);
        setDrawableColorByKey(chat_commentDrawable, i17);
        setDrawableColorByKey(chat_commentStickerDrawable, i11);
        setDrawableColorByKey(chat_commentArrowDrawable, i17);
        Drawable drawable13 = chat_gradientLeftDrawable;
        int i19 = key_chat_stickersHintPanel;
        setDrawableColorByKey(drawable13, i19);
        setDrawableColorByKey(chat_gradientRightDrawable, i19);
        for (int i20 = 0; i20 < 2; i20++) {
            setDrawableColorByKey(chat_msgInCallDrawable[i20], key_chat_inInstant);
            setDrawableColorByKey(chat_msgInCallSelectedDrawable[i20], key_chat_inInstantSelected);
            setDrawableColorByKey(chat_msgOutCallDrawable[i20], key_chat_outInstant);
            setDrawableColorByKey(chat_msgOutCallSelectedDrawable[i20], key_chat_outInstantSelected);
        }
        setDrawableColorByKey(chat_msgCallUpGreenDrawable, key_chat_outGreenCall);
        Drawable drawable14 = chat_msgCallDownRedDrawable;
        int i21 = key_fill_RedNormal;
        setDrawableColorByKey(drawable14, i21);
        setDrawableColorByKey(chat_msgCallDownGreenDrawable, key_chat_inGreenCall);
        setDrawableColorByKey(calllog_msgCallUpRedDrawable, i21);
        Drawable drawable15 = calllog_msgCallUpGreenDrawable;
        int i22 = key_calls_callReceivedGreenIcon;
        setDrawableColorByKey(drawable15, i22);
        setDrawableColorByKey(calllog_msgCallDownRedDrawable, i21);
        setDrawableColorByKey(calllog_msgCallDownGreenDrawable, i22);
        int i23 = 0;
        while (true) {
            Drawable[] drawableArr = chat_status_drawables;
            if (i23 >= drawableArr.length) {
                break;
            }
            setDrawableColorByKey(drawableArr[i23], key_chats_actionMessage);
            i23++;
        }
        for (int i24 = 0; i24 < 5; i24++) {
            setCombinedDrawableColor(chat_fileStatesDrawable[i24][0], getColor(key_chat_inLoader), false);
            setCombinedDrawableColor(chat_fileStatesDrawable[i24][0], getColor(key_chat_inMediaIcon), true);
            setCombinedDrawableColor(chat_fileStatesDrawable[i24][1], getColor(key_chat_inLoaderSelected), false);
            setCombinedDrawableColor(chat_fileStatesDrawable[i24][1], getColor(key_chat_inMediaIconSelected), true);
        }
        setCombinedDrawableColor(chat_contactDrawable[0], getColor(key_chat_inContactBackground), false);
        setCombinedDrawableColor(chat_contactDrawable[0], getColor(key_chat_inContactIcon), true);
        setCombinedDrawableColor(chat_contactDrawable[1], getColor(key_chat_outContactBackground), false);
        setCombinedDrawableColor(chat_contactDrawable[1], getColor(key_chat_outContactIcon), true);
        setDrawableColor(chat_locationDrawable[0], getColor(key_chat_inLocationIcon));
        setDrawableColor(chat_locationDrawable[1], getColor(key_chat_outLocationIcon));
        setDrawableColor(chat_pollHintDrawable[0], getColor(key_chat_inPreviewInstantText));
        setDrawableColor(chat_pollHintDrawable[1], getColor(key_chat_outPreviewInstantText));
        setDrawableColor(chat_psaHelpDrawable[0], getColor(key_chat_inViews));
        setDrawableColor(chat_psaHelpDrawable[1], getColor(key_chat_outViews));
        setDrawableColorByKey(chat_composeShadowDrawable, key_chat_messagePanelShadow);
        setDrawableColorByKey(chat_composeShadowRoundDrawable, key_chat_messagePanelBackground);
        int color = getColor(key_chat_outAudioSeekbarFill) == -1 ? getColor(key_chat_outBubble) : -1;
        setDrawableColor(chat_pollCheckDrawable[1], color);
        setDrawableColor(chat_pollCrossDrawable[1], color);
        setDrawableColor(chat_attachEmptyDrawable, getColor(key_chat_attachEmptyImage));
        if (!bg && !disallowChangeServiceMessageColor) {
            applyChatServiceMessageColor();
            applyChatMessageSelectedBackgroundColor();
        }
        refreshAttachButtonsColors();
        if (usePlusTheme) {
            chat_msgInViewsDrawable.setColorFilter(new PorterDuffColorFilter(chatLTimeColor, PorterDuff.Mode.MULTIPLY));
            chat_msgInViewsSelectedDrawable.setColorFilter(new PorterDuffColorFilter(chatLTimeColor, PorterDuff.Mode.MULTIPLY));
            chat_msgMediaViewsDrawable.setColorFilter(new PorterDuffColorFilter(chatLTimeColor, PorterDuff.Mode.MULTIPLY));
            chat_msgOutViewsDrawable.setColorFilter(new PorterDuffColorFilter(chatRTimeColor, PorterDuff.Mode.MULTIPLY));
            chat_msgOutViewsSelectedDrawable.setColorFilter(new PorterDuffColorFilter(chatRTimeColor, PorterDuff.Mode.MULTIPLY));
            chat_muteIconDrawable.setColorFilter(new PorterDuffColorFilter(chatHeaderIconsColor, PorterDuff.Mode.MULTIPLY));
            chat_lockIconDrawable.setColorFilter(new PorterDuffColorFilter(chatHeaderIconsColor, PorterDuff.Mode.MULTIPLY));
            chat_actionTextPaint.setColor(chatDateColor);
            if (chatDateColor != -1) {
                chat_actionTextPaint.linkColor = AndroidUtilities.getIntDarkerColor("chatDateColor", -80);
            }
            chat_textSearchSelectionPaint.setColor(chatSelectedMsgBGColor);
            updateChatDrawablesColor();
            updatePrefsColors();
            chat_contextResult_titleTextPaint.setColor(prefTitleColor);
            chat_contextResult_descriptionTextPaint.setColor(prefSummaryColor);
        }
    }

    public static void applyChatServiceMessageColor() {
        Drawable drawable = wallpaper;
        if (drawable != null) {
            applyChatServiceMessageColor(null, null, drawable);
        }
    }

    public static boolean hasGradientService() {
        return serviceBitmapShader != null;
    }

    public static void applyServiceShaderMatrixForView(View view, View background) {
        applyServiceShaderMatrixForView(view, background, null);
    }

    public static void applyServiceShaderMatrixForView(View view, View background, ResourcesProvider resourcesProvider) {
        int i;
        if (view == null || background == 0) {
            return;
        }
        view.getLocationOnScreen(viewPos);
        int[] iArr = viewPos;
        int i2 = iArr[0];
        int i3 = iArr[1];
        background.getLocationOnScreen(iArr);
        if (background instanceof ThemePreviewActivity.BackgroundView) {
            Bitmap bitmap = serviceBitmap;
            if (bitmap != null) {
                float width = bitmap.getWidth();
                i = (int) (i2 + (((background.getMeasuredWidth() - (width * Math.max(background.getMeasuredWidth() / width, background.getMeasuredHeight() / serviceBitmap.getHeight()))) / 2.0f) - ((ThemePreviewActivity.BackgroundView) background).tx));
            } else {
                i = (int) (i2 + (-((ThemePreviewActivity.BackgroundView) background).tx));
            }
            i2 = i;
            i3 = (int) (i3 + (-((ThemePreviewActivity.BackgroundView) background).ty));
        }
        if (resourcesProvider != null) {
            resourcesProvider.applyServiceShaderMatrix(background.getMeasuredWidth(), background.getMeasuredHeight(), i2, i3 - viewPos[1]);
        } else {
            applyServiceShaderMatrix(background.getMeasuredWidth(), background.getMeasuredHeight(), i2, i3 - viewPos[1]);
        }
    }

    public static void applyServiceShaderMatrix(int w, int h, float translationX, float translationY) {
        applyServiceShaderMatrix(serviceBitmap, serviceBitmapShader, serviceBitmapMatrix, w, h, translationX, translationY);
    }

    public static void applyServiceShaderMatrix(Bitmap bitmap, BitmapShader shader, Matrix matrix, int w, int h, float translationX, float translationY) {
        if (shader == null || matrix == null) {
            return;
        }
        float width = bitmap.getWidth();
        float height = bitmap.getHeight();
        float f = w;
        float f2 = h;
        float max = Math.max(f / width, f2 / height);
        matrix.reset();
        matrix.setTranslate(((f - (width * max)) / 2.0f) - translationX, ((f2 - (height * max)) / 2.0f) - translationY);
        matrix.preScale(max, max);
        shader.setLocalMatrix(matrix);
    }

    public static void applyChatServiceMessageColor(int[] custom, Drawable wallpaperOverride, Drawable currentWallpaper) {
        int i;
        int i2;
        int i3;
        Bitmap checkBlur;
        if (chat_actionBackgroundPaint == null) {
            return;
        }
        serviceMessageColor = serviceMessageColorBackup;
        serviceSelectedMessageColor = serviceSelectedMessageColorBackup;
        if (custom != null && custom.length >= 2) {
            i2 = custom[0];
            i3 = custom[1];
            serviceMessageColor = custom[0];
            serviceSelectedMessageColor = custom[1];
        } else {
            int indexOfKey = currentColors.indexOfKey(key_chat_serviceBackground);
            if (indexOfKey >= 0) {
                i = currentColors.valueAt(indexOfKey);
            } else {
                i = serviceMessageColor;
            }
            i2 = i;
            int indexOfKey2 = currentColors.indexOfKey(key_chat_serviceBackgroundSelected);
            if (indexOfKey2 >= 0) {
                i3 = currentColors.valueAt(indexOfKey2);
            } else {
                i3 = serviceSelectedMessageColor;
            }
        }
        if (wallpaperOverride == null) {
            wallpaperOverride = currentWallpaper;
        }
        boolean z = wallpaperOverride instanceof MotionBackgroundDrawable;
        if ((z || (wallpaperOverride instanceof BitmapDrawable)) && SharedConfig.getDevicePerformanceClass() != 0 && LiteMode.isEnabled(32)) {
            if (z) {
                checkBlur = ((MotionBackgroundDrawable) wallpaperOverride).getBitmap();
            } else {
                checkBlur = wallpaperOverride instanceof BitmapDrawable ? checkBlur(wallpaperOverride) : null;
            }
            if (serviceBitmap != checkBlur) {
                serviceBitmap = checkBlur;
                Bitmap bitmap = serviceBitmap;
                Shader.TileMode tileMode = Shader.TileMode.CLAMP;
                BitmapShader bitmapShader = new BitmapShader(bitmap, tileMode, tileMode);
                serviceBitmapShader = bitmapShader;
                if (Build.VERSION.SDK_INT >= 33) {
                    bitmapShader.setFilterMode(2);
                }
                if (serviceBitmapMatrix == null) {
                    serviceBitmapMatrix = new Matrix();
                }
            }
            setDrawableColor(chat_msgStickerPinnedDrawable, -1);
            setDrawableColor(chat_msgStickerCheckDrawable, -1);
            setDrawableColor(chat_msgStickerHalfCheckDrawable, -1);
            setDrawableColor(chat_msgStickerViewsDrawable, -1);
            setDrawableColor(chat_msgStickerRepliesDrawable, -1);
            chat_actionTextPaint.setColor(-1);
            chat_actionTextPaint2.setColor(-1);
            chat_actionTextPaint.linkColor = -1;
            chat_unlockExtendedMediaTextPaint.setColor(-1);
            chat_botButtonPaint.setColor(-1);
            setDrawableColor(chat_commentStickerDrawable, -1);
            setDrawableColor(chat_shareIconDrawable, -1);
            setDrawableColor(chat_replyIconDrawable, -1);
            setDrawableColor(chat_goIconDrawable, -1);
            setDrawableColor(chat_cloudIconDrawable, -1);
            setDrawableColor(chat_translateIconDrawable, -1);
            setDrawableColor(chat_copyIconDrawable, -1);
            setDrawableColor(chat_markIconDrawable, -1);
            setDrawableColor(chat_forwardIconDrawable, -1);
            setDrawableColor(chat_forwardQuoteIconDrawable, -1);
            setDrawableColor(chat_deleteIconDrawable, -1);
            setDrawableColor(chat_editIconDrawable, -1);
            setDrawableColor(chat_clearIconDrawable, -1);
            setDrawableColor(chat_reportIconDrawable, -1);
            setDrawableColor(chat_botInlineDrawable, -1);
            setDrawableColor(chat_botWebViewDrawable, -1);
            setDrawableColor(chat_botInviteDrawable, -1);
            setDrawableColor(chat_botLinkDrawable, -1);
        } else {
            serviceBitmap = null;
            serviceBitmapShader = null;
            Drawable drawable = chat_msgStickerPinnedDrawable;
            int i4 = key_chat_serviceText;
            setDrawableColorByKey(drawable, i4);
            setDrawableColorByKey(chat_msgStickerCheckDrawable, i4);
            setDrawableColorByKey(chat_msgStickerHalfCheckDrawable, i4);
            setDrawableColorByKey(chat_msgStickerViewsDrawable, i4);
            setDrawableColorByKey(chat_msgStickerRepliesDrawable, i4);
            chat_actionTextPaint.setColor(getColor(i4));
            chat_actionTextPaint2.setColor(getColor(i4));
            chat_actionTextPaint.linkColor = getColor(key_chat_serviceLink);
            chat_unlockExtendedMediaTextPaint.setColor(getColor(i4));
            Drawable drawable2 = chat_commentStickerDrawable;
            int i5 = key_chat_serviceIcon;
            setDrawableColorByKey(drawable2, i5);
            setDrawableColorByKey(chat_shareIconDrawable, i5);
            setDrawableColorByKey(chat_replyIconDrawable, i5);
            setDrawableColorByKey(chat_goIconDrawable, i5);
            setDrawableColorByKey(chat_cloudIconDrawable, i5);
            setDrawableColorByKey(chat_translateIconDrawable, i5);
            setDrawableColorByKey(chat_copyIconDrawable, i5);
            setDrawableColorByKey(chat_markIconDrawable, i5);
            setDrawableColorByKey(chat_forwardIconDrawable, i5);
            setDrawableColorByKey(chat_forwardQuoteIconDrawable, i5);
            setDrawableColorByKey(chat_deleteIconDrawable, i5);
            setDrawableColorByKey(chat_editIconDrawable, i5);
            setDrawableColorByKey(chat_clearIconDrawable, i5);
            setDrawableColorByKey(chat_reportIconDrawable, i5);
            setDrawableColorByKey(chat_botInlineDrawable, i5);
            setDrawableColorByKey(chat_botWebViewDrawable, i5);
            setDrawableColorByKey(chat_botInviteDrawable, i5);
            setDrawableColorByKey(chat_botLinkDrawable, i5);
            chat_botButtonPaint.setColor(getColor(key_chat_botButtonText));
        }
        Paint paint = chat_actionBackgroundPaint;
        if (usePlusTheme) {
            i2 = chatDateBubbleColor;
        }
        paint.setColor(i2);
        chat_actionBackgroundSelectedPaint.setColor(i3);
        if (serviceBitmapShader != null && (currentColors.indexOfKey(key_chat_serviceBackground) < 0 || z || (wallpaperOverride instanceof BitmapDrawable))) {
            ColorMatrix colorMatrix = new ColorMatrix();
            if (z) {
                if (((MotionBackgroundDrawable) wallpaperOverride).getIntensity() >= 0.0f) {
                    colorMatrix.setSaturation(1.6f);
                    AndroidUtilities.multiplyBrightnessColorMatrix(colorMatrix, isCurrentThemeDark() ? 0.97f : 0.92f);
                    AndroidUtilities.adjustBrightnessColorMatrix(colorMatrix, isCurrentThemeDark() ? 0.12f : -0.06f);
                } else {
                    colorMatrix.setSaturation(1.1f);
                    AndroidUtilities.multiplyBrightnessColorMatrix(colorMatrix, isCurrentThemeDark() ? 0.4f : 0.8f);
                    AndroidUtilities.adjustBrightnessColorMatrix(colorMatrix, isCurrentThemeDark() ? 0.08f : -0.06f);
                }
            } else {
                colorMatrix.setSaturation(1.6f);
                AndroidUtilities.multiplyBrightnessColorMatrix(colorMatrix, isCurrentThemeDark() ? 0.9f : 0.84f);
                AndroidUtilities.adjustBrightnessColorMatrix(colorMatrix, isCurrentThemeDark() ? -0.04f : 0.06f);
            }
            chat_actionBackgroundPaint.setFilterBitmap(true);
            chat_actionBackgroundPaint.setShader(serviceBitmapShader);
            chat_actionBackgroundPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
            chat_actionBackgroundPaint.setAlpha(255);
            chat_actionBackgroundSelectedPaint.setFilterBitmap(true);
            chat_actionBackgroundSelectedPaint.setShader(serviceBitmapShader);
            ColorMatrix colorMatrix2 = new ColorMatrix(colorMatrix);
            AndroidUtilities.adjustSaturationColorMatrix(colorMatrix2, 0.26f);
            isCurrentThemeDark();
            AndroidUtilities.multiplyBrightnessColorMatrix(colorMatrix2, 0.92f);
            chat_actionBackgroundSelectedPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix2));
            chat_actionBackgroundSelectedPaint.setAlpha(255);
            chat_actionBackgroundGradientDarkenPaint.setAlpha(0);
        } else {
            chat_actionBackgroundPaint.setColorFilter(null);
            chat_actionBackgroundPaint.setShader(null);
            chat_actionBackgroundSelectedPaint.setColorFilter(null);
            chat_actionBackgroundSelectedPaint.setShader(null);
            chat_actionBackgroundGradientDarkenPaint.setAlpha(21);
        }
        if (usePlusTheme) {
            chat_actionBackgroundPaint.setColor(chatDateBubbleColor);
        }
    }

    public static Bitmap checkBlur(Drawable d) {
        WeakReference<Drawable> weakReference = lastDrawableToBlur;
        if (weakReference != null && weakReference.get() == d) {
            return blurredBitmap;
        }
        WeakReference<Drawable> weakReference2 = lastDrawableToBlur;
        if (weakReference2 != null) {
            weakReference2.clear();
        }
        lastDrawableToBlur = null;
        if (d == null || d.getIntrinsicWidth() == 0 || d.getIntrinsicHeight() == 0) {
            blurredBitmap = null;
            return null;
        }
        lastDrawableToBlur = new WeakReference<>(d);
        int intrinsicWidth = (int) ((d.getIntrinsicWidth() / d.getIntrinsicHeight()) * 24.0f);
        Bitmap createBitmap = Bitmap.createBitmap(intrinsicWidth, 24, Bitmap.Config.ARGB_8888);
        d.setBounds(0, 0, intrinsicWidth, 24);
        if (Build.VERSION.SDK_INT >= 21) {
            ColorFilter colorFilter = d.getColorFilter();
            ColorMatrix colorMatrix = new ColorMatrix();
            colorMatrix.setSaturation(1.3f);
            AndroidUtilities.multiplyBrightnessColorMatrix(colorMatrix, 0.94f);
            d.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
            d.draw(new Canvas(createBitmap));
            d.setColorFilter(colorFilter);
        } else {
            d.draw(new Canvas(createBitmap));
        }
        Utilities.blurBitmap(createBitmap, 3, 1, createBitmap.getWidth(), createBitmap.getHeight(), createBitmap.getRowBytes());
        blurredBitmap = createBitmap;
        return createBitmap;
    }

    public static void applyChatMessageSelectedBackgroundColor() {
        applyChatMessageSelectedBackgroundColor(null, wallpaper);
    }

    public static void applyChatMessageSelectedBackgroundColor(Drawable wallpaperOverride, Drawable currentWallpaper) {
        Bitmap bitmap;
        if (chat_messageBackgroundSelectedPaint == null) {
            return;
        }
        int i = currentColors.get(key_chat_selectedBackground);
        if (wallpaperOverride == null) {
            wallpaperOverride = currentWallpaper;
        }
        boolean z = (wallpaperOverride instanceof MotionBackgroundDrawable) && SharedConfig.getDevicePerformanceClass() != 0 && i == 0;
        if (z && serviceBitmap != (bitmap = ((MotionBackgroundDrawable) wallpaperOverride).getBitmap())) {
            serviceBitmap = bitmap;
            Bitmap bitmap2 = serviceBitmap;
            Shader.TileMode tileMode = Shader.TileMode.CLAMP;
            serviceBitmapShader = new BitmapShader(bitmap2, tileMode, tileMode);
            if (serviceBitmapMatrix == null) {
                serviceBitmapMatrix = new Matrix();
            }
        }
        if (serviceBitmapShader != null && i == 0 && z) {
            ColorMatrix colorMatrix = new ColorMatrix();
            AndroidUtilities.adjustSaturationColorMatrix(colorMatrix, 2.5f);
            AndroidUtilities.multiplyBrightnessColorMatrix(colorMatrix, 0.75f);
            chat_messageBackgroundSelectedPaint.setShader(serviceBitmapShader);
            chat_messageBackgroundSelectedPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
            chat_messageBackgroundSelectedPaint.setAlpha(64);
            return;
        }
        Paint paint = chat_messageBackgroundSelectedPaint;
        if (i == 0) {
            i = 1073741824;
        }
        paint.setColor(i);
        chat_messageBackgroundSelectedPaint.setColorFilter(null);
        chat_messageBackgroundSelectedPaint.setShader(null);
    }

    public static void applyChatPlusServiceMessageColor() {
        if (chat_actionBackgroundPaint == null) {
            return;
        }
        Integer valueOf = Integer.valueOf(currentColors.get(key_chat_serviceBackground));
        if (valueOf == null) {
            valueOf = Integer.valueOf(serviceMessageColor);
        }
        chat_actionBackgroundPaint.setColor(usePlusTheme ? chatDateBubbleColor : valueOf.intValue());
    }

    public static void createProfileResources(Context context) {
        if (profile_verifiedDrawable == null) {
            profile_aboutTextPaint = new TextPaint(1);
            Resources resources = context.getResources();
            profile_verifiedDrawable = resources.getDrawable(R.drawable.verified_area).mutate();
            profile_verifiedCheckDrawable = resources.getDrawable(R.drawable.verified_check).mutate();
            applyProfileTheme();
        }
        profile_aboutTextPaint.setTextSize(AndroidUtilities.dp(16.0f));
    }

    public static void applyProfileTheme() {
        if (profile_verifiedDrawable == null) {
            return;
        }
        profile_aboutTextPaint.setColor(usePlusTheme ? profileRowTitleColor : getColor(key_windowBackgroundWhiteBlackText));
        profile_aboutTextPaint.linkColor = usePlusTheme ? profileRowStatusColor : getColor(key_windowBackgroundWhiteLinkText);
        setDrawableColorByKey(profile_verifiedDrawable, key_profile_verifiedBackground);
        setDrawableColorByKey(profile_verifiedCheckDrawable, key_profile_verifiedCheck);
    }

    public static Drawable getThemedDrawableByKey(Context context, int resId, int key, ResourcesProvider resourcesProvider) {
        return getThemedDrawable(context, resId, getColor(key, resourcesProvider));
    }

    public static Drawable getThemedDrawableByKey(Context context, int resId, int key) {
        return getThemedDrawable(context, resId, getColor(key));
    }

    public static Drawable getThemedDrawable(Context context, int resId, int color) {
        if (context == null) {
            return null;
        }
        Drawable mutate = context.getResources().getDrawable(resId).mutate();
        mutate.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
        return mutate;
    }

    public static int getDefaultColor(int key) {
        String stringName = ThemeColors.getStringName(key);
        String str = telegramToPlus.get(stringName);
        if (usePlusTheme && telegramToPlus.containsKey(stringName)) {
            return defaultPlusColors.get(str).intValue();
        }
        if (key < 0) {
            return 0;
        }
        int i = defaultColors[key];
        return i == 0 ? (isMyMessagesBubbles(key) || key == key_chats_menuTopShadow || key == key_chats_menuTopBackground || key == key_chats_menuTopShadowCats || key == key_chat_wallpaper_gradient_to2 || key == key_chat_wallpaper_gradient_to3) ? 0 : -65536 : i;
    }

    public static boolean hasThemeKey(int key) {
        return currentColors.indexOfKey(key) >= 0;
    }

    public static void setAnimatingColor(boolean animating) {
        animatingColors = animating ? new SparseIntArray() : null;
    }

    public static boolean isAnimatingColor() {
        return animatingColors != null;
    }

    public static void setAnimatedColor(int key, int value) {
        SparseIntArray sparseIntArray = animatingColors;
        if (sparseIntArray == null) {
            return;
        }
        sparseIntArray.put(key, value);
    }

    public static int getDefaultAccentColor(int key) {
        int indexOfKey = currentColorsNoAccent.indexOfKey(key);
        if (indexOfKey < 0) {
            return 0;
        }
        int valueAt = currentColorsNoAccent.valueAt(indexOfKey);
        ThemeAccent accent = currentTheme.getAccent(false);
        if (accent == null) {
            return 0;
        }
        float[] tempHsv = getTempHsv(1);
        float[] tempHsv2 = getTempHsv(2);
        Color.colorToHSV(currentTheme.accentBaseColor, tempHsv);
        Color.colorToHSV(accent.accentColor, tempHsv2);
        return changeColorAccent(tempHsv, tempHsv2, valueAt, currentTheme.isDark(), valueAt);
    }

    public static int getNonAnimatedColor(int key) {
        return getColor(key, null, true);
    }

    public static int getColor(int key, ResourcesProvider provider) {
        if (provider != null) {
            return provider.getColor(key);
        }
        return getColor(key);
    }

    public static int getColor(int key) {
        return getColor(key, null, false);
    }

    public static int getColor(int key, boolean[] isDefault) {
        return getColor(key, isDefault, false);
    }

    public static int getColor(int key, boolean[] isDefault, boolean ignoreAnimation) {
        int indexOfKey;
        boolean isDefaultMainAccent;
        SparseIntArray sparseIntArray;
        int indexOfKey2;
        String stringName = ThemeColors.getStringName(key);
        if (!ignoreAnimation && (sparseIntArray = animatingColors) != null && (indexOfKey2 = sparseIntArray.indexOfKey(key)) >= 0) {
            return animatingColors.valueAt(indexOfKey2);
        }
        if (serviceBitmapShader != null && (key_chat_serviceText == key || key_chat_serviceLink == key || key_chat_serviceIcon == key || key_chat_stickerReplyLine == key || key_chat_stickerReplyNameText == key || key_chat_stickerReplyMessageText == key)) {
            return -1;
        }
        if (currentTheme == defaultTheme && !usePlusTheme) {
            if (isMyMessagesBubbles(key)) {
                isDefaultMainAccent = currentTheme.isDefaultMyMessagesBubbles();
            } else if (isMyMessages(key)) {
                isDefaultMainAccent = currentTheme.isDefaultMyMessages();
            } else {
                isDefaultMainAccent = (key_chat_wallpaper == key || key_chat_wallpaper_gradient_to1 == key || key_chat_wallpaper_gradient_to2 == key || key_chat_wallpaper_gradient_to3 == key) ? false : currentTheme.isDefaultMainAccent();
            }
            if (isDefaultMainAccent) {
                if (key == key_chat_serviceBackground) {
                    return serviceMessageColor;
                }
                if (key == key_chat_serviceBackgroundSelected) {
                    return serviceSelectedMessageColor;
                }
                return getDefaultColor(key);
            }
        }
        int indexOfKey3 = currentColors.indexOfKey(key);
        Integer plusColor = usePlusTheme ? getPlusColor(null, stringName) : null;
        if (indexOfKey3 < 0) {
            int i = fallbackKeys.get(key, -1);
            if (i != -1 && (indexOfKey = currentColors.indexOfKey(i)) >= 0) {
                return currentColors.valueAt(indexOfKey);
            }
            if (isDefault != null) {
                isDefault[0] = true;
            }
            if (key == key_chat_serviceBackground) {
                return serviceMessageColor;
            }
            if (key == key_chat_serviceBackgroundSelected) {
                return serviceSelectedMessageColor;
            }
            if (usePlusTheme && plusColor != null) {
                return plusColor.intValue();
            }
            return getDefaultColor(key);
        }
        int valueAt = (!usePlusTheme || plusColor == null) ? currentColors.valueAt(indexOfKey3) : plusColor.intValue();
        return (key_windowBackgroundWhite == key || key_windowBackgroundGray == key || key_actionBarDefault == key || key_actionBarDefaultArchived == key) ? valueAt | (-16777216) : valueAt;
    }

    public static Integer getPlusColor(Integer color, String key) {
        if (!telegramToPlus.containsKey(key)) {
            return currentPlusColors.containsKey(key) ? currentPlusColors.get(key) : color;
        }
        String str = telegramToPlus.get(key);
        Integer num = currentPlusColors.get(str);
        return num == null ? defaultPlusColors.get(str) : num;
    }

    public static boolean isMyMessagesBubbles(int key) {
        return key >= myMessagesBubblesStartIndex && key < myMessagesBubblesEndIndex;
    }

    public static boolean isMyMessages(int key) {
        return key >= myMessagesStartIndex && key < myMessagesEndIndex;
    }

    public static void setColor(int key, int color, boolean useDefault) {
        int i = key_chat_wallpaper;
        if (key == i || key == key_chat_wallpaper_gradient_to1 || key == key_chat_wallpaper_gradient_to2 || key == key_chat_wallpaper_gradient_to3 || key == key_windowBackgroundWhite || key == key_windowBackgroundGray || key == key_actionBarDefault || key == key_actionBarDefaultArchived) {
            color |= -16777216;
        }
        if (useDefault) {
            currentColors.delete(key);
        } else {
            currentColors.put(key, color);
        }
        if (key == key_chat_selectedBackground) {
            applyChatMessageSelectedBackgroundColor();
            return;
        }
        if (key == key_chat_serviceBackground || key == key_chat_serviceBackgroundSelected) {
            applyChatServiceMessageColor();
            return;
        }
        if (key == i || key == key_chat_wallpaper_gradient_to1 || key == key_chat_wallpaper_gradient_to2 || key == key_chat_wallpaper_gradient_to3 || key == key_chat_wallpaper_gradient_rotation) {
            reloadWallpaper(true);
            return;
        }
        if (key == key_actionBarDefault) {
            if (Build.VERSION.SDK_INT >= 23) {
                NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needCheckSystemBarColors, new Object[0]);
            }
        } else {
            if (key != key_windowBackgroundGray || Build.VERSION.SDK_INT < 26) {
                return;
            }
            NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needCheckSystemBarColors, new Object[0]);
        }
    }

    public static void setDefaultColor(int key, int color) {
        defaultColors[key] = color;
    }

    public static void setPlusColor(String key, int color, boolean useDefault) {
        int i = key_chat_wallpaper;
        if (key.equals(Integer.valueOf(i))) {
            color |= -16777216;
        }
        if (useDefault) {
            currentPlusColors.remove(key);
        } else {
            currentPlusColors.put(key, Integer.valueOf(color));
        }
        if (key.equals(Integer.valueOf(key_chat_serviceBackground)) || key.equals(Integer.valueOf(key_chat_serviceBackgroundSelected))) {
            applyChatServiceMessageColor();
        } else if (key.equals(Integer.valueOf(i))) {
            reloadWallpaper(true);
        }
    }

    public static void setDrawableColorByKeyIN(Drawable drawable, int key) {
        drawable.setColorFilter(new PorterDuffColorFilter(getColor(key), PorterDuff.Mode.SRC_IN));
    }

    public static void updateAllColors() {
        updateMainColors();
        updateDrawerColors();
        updateChatColors();
        updateChatsColors();
        updateContactsColors();
        updateProfileColors();
        updatePrefsColors();
    }

    public static void updateMainColors() {
        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0);
        usePlusTheme = sharedPreferences.getBoolean("usePlusTheme", true);
        defColor = sharedPreferences.getInt("themeColor", -16738680);
        dialogTextColor = sharedPreferences.getInt("dialogTextColor", -14540254);
        dialogBGColor = sharedPreferences.getInt("dialogBGColor", -1);
        dialogColor = sharedPreferences.getInt("dialogColor", dialogTextColor);
        lightColor = AndroidUtilities.setDarkColor(defColor, -64);
        darkColor = AndroidUtilities.setDarkColor(defColor, 21);
        SharedPreferences.Editor edit = sharedPreferences.edit();
        edit.putInt(ThemeColors.getStringName(pkey_themeLightColor), lightColor);
        edit.putInt(ThemeColors.getStringName(pkey_themeDarkColor), darkColor);
        edit.apply();
    }

    public static void updateChatColors() {
        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0);
        chatStatusColor = sharedPreferences.getInt("chatStatusColor", lightColor);
        chatStatusSize = sharedPreferences.getInt("chatStatusSize", AndroidUtilities.isTablet() ? 16 : 14);
        chatOnlineColor = sharedPreferences.getInt("chatOnlineColor", chatStatusColor);
        chatTypingColor = sharedPreferences.getInt("chatTypingColor", chatStatusColor);
        chatSelectedMsgBGColor = sharedPreferences.getInt("chatSelectedMsgBGColor", 1713809050);
        chatQuickBarColor = sharedPreferences.getInt("chatQuickBarColor", -1);
        chatQuickBarNamesColor = sharedPreferences.getInt("chatQuickBarNamesColor", -14606047);
        chatAvatarRadius = sharedPreferences.getInt("chatAvatarRadius", AndroidUtilities.isTablet() ? 35 : 32);
        chatAvatarSize = sharedPreferences.getInt("chatAvatarSize", AndroidUtilities.isTablet() ? 45 : 42);
        chatAvatarMarginLeft = sharedPreferences.getInt("chatAvatarMarginLeft", 6);
        chatAvatarAlignTop = sharedPreferences.getBoolean("chatAvatarAlignTop", false);
        chatOwnAvatarAlignTop = sharedPreferences.getBoolean("chatOwnAvatarAlignTop", false);
        chatShowOwnAvatar = sharedPreferences.getBoolean("chatShowOwnAvatar", false);
        chatShowOwnAvatarGroup = sharedPreferences.getBoolean("chatShowOwnAvatarGroup", false);
        chatShowContactAvatar = sharedPreferences.getBoolean("chatShowContactAvatar", false);
        chatDateBubbleColor = sharedPreferences.getInt("chatDateBubbleColor", 1719044499);
        chatRTextColor = sharedPreferences.getInt("chatRTextColor", -16777216);
        chatRLinkColor = sharedPreferences.getInt("chatRLinkColor", defColor);
        chatRBubbleColor = sharedPreferences.getInt("chatRBubbleColor", AndroidUtilities.getDefBubbleColor());
        chatRBubbleColorSelected = sharedPreferences.getInt("chatRBubbleColorSelected", -6436154);
        chatLTextColor = sharedPreferences.getInt("chatLTextColor", -16777216);
        chatLLinkColor = sharedPreferences.getInt("chatLLinkColor", defColor);
        chatLBubbleColor = sharedPreferences.getInt("chatLBubbleColor", -1);
        chatLBubbleColorSelected = sharedPreferences.getInt("chatLBubbleColorSelected", -1381654);
        chatDateColor = sharedPreferences.getInt("chatDateColor", -1);
        chatDateSize = sharedPreferences.getInt("chatDateSize", AndroidUtilities.isTablet() ? 18 : SharedConfig.fontSize - 2);
        chatChecksColor = sharedPreferences.getInt("chatChecksColor", defColor);
        chatRTimeColor = sharedPreferences.getInt("chatRTimeColor", darkColor);
        chatLTimeColor = sharedPreferences.getInt("chatLTimeColor", -6182221);
        chatContactNameColor = sharedPreferences.getInt("chatContactNameColor", defColor);
        chatForwardRColor = sharedPreferences.getInt("chatForwardRColor", darkColor);
        chatForwardLColor = sharedPreferences.getInt("chatForwardLColor", darkColor);
        chatMemberColor = sharedPreferences.getInt("chatMemberColor", darkColor);
        chatMemberColorCheck = sharedPreferences.getBoolean("chatMemberColorCheck", false);
        chatHideStatusIndicator = sharedPreferences.getBoolean("chatHideStatusIndicator", false);
        chatShowUsernameCheck = sharedPreferences.getBoolean("chatShowUsernameCheck", false);
        chatSolidBGColorCheck = sharedPreferences.getBoolean("chatSolidBGColorCheck", false);
        chatSolidBGColor = sharedPreferences.getInt("chatSolidBGColor", -1);
        chatGradientBG = sharedPreferences.getInt("chatGradientBG", 0);
        chatGradientBGColor = sharedPreferences.getInt("chatGradientBGColor", -1);
        chatHeaderColor = sharedPreferences.getInt("chatHeaderColor", defColor);
        chatHeaderIconsColor = sharedPreferences.getInt("chatHeaderIconsColor", -1);
        chatTimeSize = sharedPreferences.getInt("chatTimeSize", AndroidUtilities.isTablet() ? 14 : 12);
        chatEditTextIconsColor = sharedPreferences.getInt("chatEditTextIconsColor", -5395027);
        chatEditTextColor = sharedPreferences.getInt("chatEditTextColor", -16777216);
        chatEditTextBGColor = sharedPreferences.getInt("chatEditTextBGColor", -1);
        chatAttachTextColor = sharedPreferences.getInt("chatAttachTextColor", defColor);
        chatAttachBGColor = sharedPreferences.getInt("chatAttachBGColor", -1);
        chatEditTextSize = sharedPreferences.getInt("chatEditTextSize", AndroidUtilities.isTablet() ? 20 : 18);
        chatNameColor = sharedPreferences.getInt("chatNameColor", -1);
    }

    public static void updateChatDrawablesColor() {
        chatRBubbleColorSelected = AndroidUtilities.setDarkColor(chatRBubbleColor, 21);
        chatLBubbleColorSelected = AndroidUtilities.setDarkColor(chatLBubbleColor, 21);
        chat_msgOutDrawable.setColorFilter(chatRBubbleColor, PorterDuff.Mode.SRC_IN);
        chat_msgOutMediaDrawable.setColorFilter(chatRBubbleColor, PorterDuff.Mode.SRC_IN);
        chat_msgOutSelectedDrawable.setColorFilter(chatRBubbleColorSelected, PorterDuff.Mode.SRC_IN);
        chat_msgOutMediaSelectedDrawable.setColorFilter(chatRBubbleColorSelected, PorterDuff.Mode.SRC_IN);
        chat_msgInDrawable.setColorFilter(chatLBubbleColor, PorterDuff.Mode.SRC_IN);
        chat_msgInMediaDrawable.setColorFilter(chatLBubbleColor, PorterDuff.Mode.SRC_IN);
        chat_msgInSelectedDrawable.setColorFilter(chatLBubbleColorSelected, PorterDuff.Mode.SRC_IN);
        chat_msgInMediaSelectedDrawable.setColorFilter(chatLBubbleColorSelected, PorterDuff.Mode.SRC_IN);
    }

    public static void updateChatsColors() {
        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0);
        chatsFavIndicatorColor = sharedPreferences.getInt("chatsFavIndicatorColor", FAV_INDICATOR_COLOR_DEF);
        chatsTabsToBottom = sharedPreferences.getBoolean("chatsTabsToBottom", false);
        chatsHeaderColor = sharedPreferences.getInt("chatsHeaderColor", defColor);
        int i = sharedPreferences.getInt("chatsHeaderGradient", 0);
        chatsHeaderGradient = i;
        chatsHeaderGradientColor = i == 0 ? 0 : sharedPreferences.getInt("chatsHeaderGradientColor", defColor);
        chatsHeaderTitleColor = sharedPreferences.getInt("chatsHeaderTitleColor", -1);
        chatsHeaderSubtitleSize = sharedPreferences.getInt("chatsHeaderSubtitleSize", 12);
        chatsTabsBGColor = sharedPreferences.getInt("chatsTabsBGColor", chatsHeaderColor);
        chatsChecksColor = sharedPreferences.getInt("chatsChecksColor", defColor);
        int i2 = sharedPreferences.getInt("chatsNameColor", -14606047);
        chatsNameColor = i2;
        chatsGroupNameColor = sharedPreferences.getInt("chatsGroupNameColor", i2);
        chatsDividerColor = sharedPreferences.getInt("chatsDividerColor", -2302756);
        chatsUnknownNameColor = sharedPreferences.getInt("chatsUnknownNameColor", chatsNameColor);
        chatsNameSize = sharedPreferences.getInt("chatsNameSize", AndroidUtilities.isTablet() ? 19 : 17);
        chatsAvatarRadius = sharedPreferences.getInt("chatsAvatarRadius", AndroidUtilities.isTablet() ? 35 : 32);
        chatsAvatarSize = sharedPreferences.getInt("chatsAvatarSize", AndroidUtilities.isTablet() ? 55 : 52);
        chatsAvatarMarginLeft = sharedPreferences.getInt("chatsAvatarMarginLeft", AndroidUtilities.isTablet() ? 13 : 9);
        chatsRowColor = sharedPreferences.getInt("chatsRowColor", -1);
        chatsRowGradient = sharedPreferences.getInt("chatsRowGradient", 0);
        chatsRowGradientColor = sharedPreferences.getInt("chatsRowGradientColor", -1);
        chatsPinnedMsgBGColor = sharedPreferences.getInt("chatsPinnedMsgBGColor", chatsRowColor);
        int i3 = sharedPreferences.getInt("chatsHeaderIconsColor", -1);
        chatsHeaderIconsColor = i3;
        chatsHeaderTabIconColor = sharedPreferences.getInt("chatsHeaderTabIconColor", i3);
        chatsHeaderTabUnselectedIconColor = sharedPreferences.getInt("chatsHeaderTabUnselectedIconColor", AndroidUtilities.getIntAlphaColor("chatsHeaderTabIconColor", chatsHeaderIconsColor, 0.35f));
        chatsHeaderActionModeIconsColor = sharedPreferences.getInt("chatsHeaderActionModeIconsColor", -9999761);
        chatsHeaderTabActionModeColor = sharedPreferences.getInt("chatsHeaderTabActionModeColor", -7893872);
        chatsHeaderTabActionModeSelectedColor = sharedPreferences.getInt("chatsHeaderTabActionModeSelectedColor", -16738680);
        chatsCountColor = sharedPreferences.getInt("chatsCountColor", -1);
        chatsCountBGColor = sharedPreferences.getInt("chatsCountBGColor", defColor);
        chatsCountSize = sharedPreferences.getInt("chatsCountSize", AndroidUtilities.isTablet() ? 15 : 13);
        chatsHideStatusIndicator = sharedPreferences.getBoolean("chatsHideStatusIndicator", false);
        chatsHideHeaderShadow = sharedPreferences.getBoolean("chatsHideHeaderShadow", true);
        chatsTabCounterSilentBGColor = sharedPreferences.getInt("chatsHeaderTabCounterSilentBGColor", -4605511);
        chatsTabCounterBGColor = sharedPreferences.getInt("chatsHeaderTabCounterBGColor", -2937041);
        chatsTabCounterColor = sharedPreferences.getInt("chatsHeaderTabCounterColor", -1);
        chatsTabCounterSize = sharedPreferences.getInt("chatsHeaderTabCounterSize", AndroidUtilities.isTablet() ? 13 : 11);
        chatsTabTitlesMode = sharedPreferences.getBoolean("chatsTabTitlesMode", plusTabTitlesMode);
        chatsTabsTextSize = sharedPreferences.getInt("chatsTabsTextSize", 14);
        chatsFloatingBGColor = sharedPreferences.getInt("chatsFloatingBGColor", defColor);
        chatsFloatingPencilColor = sharedPreferences.getInt("chatsFloatingPencilColor", -1);
        chatsMessageColor = sharedPreferences.getInt("chatsMessageColor", -8355712);
        int i4 = sharedPreferences.getInt("chatsMemberColor", darkColor);
        chatsMemberColor = i4;
        chatsMediaColor = sharedPreferences.getInt("chatsMediaColor", i4);
    }

    public static void updateContactsColors() {
        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0);
        contactsHeaderColor = sharedPreferences.getInt("contactsHeaderColor", defColor);
        contactsHeaderTitleColor = sharedPreferences.getInt("contactsHeaderTitleColor", -1);
        contactsHeaderIconsColor = sharedPreferences.getInt("contactsHeaderIconsColor", -1);
        contactsIconsColor = sharedPreferences.getInt("contactsIconsColor", -9211021);
        contactsRowColor = sharedPreferences.getInt("contactsRowColor", -1);
        contactsNameColor = sharedPreferences.getInt("contactsNameColor", -16777216);
        contactsStatusColor = sharedPreferences.getInt("contactsStatusColor", -5723992);
        contactsOnlineColor = sharedPreferences.getInt("contactsOnlineColor", AndroidUtilities.getIntDarkerColor("themeColor", 21));
        contactsAvatarRadius = sharedPreferences.getInt("contactsAvatarRadius", AndroidUtilities.isTablet() ? 35 : 32);
        contactsNameSize = sharedPreferences.getInt("contactsNameSize", AndroidUtilities.isTablet() ? 19 : 17);
        contactsStatusSize = sharedPreferences.getInt("contactsStatusSize", AndroidUtilities.isTablet() ? 16 : 14);
    }

    public static void updateDrawerColors() {
        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0);
        drawerListColor = sharedPreferences.getInt("drawerListColor", -1) | (-16777216);
        drawerHeaderColor = sharedPreferences.getInt("drawerHeaderColor", defColor) | (-16777216);
        drawerOptionColor = sharedPreferences.getInt("drawerOptionColor", -12303292) | (-16777216);
        drawerNameColor = sharedPreferences.getInt("drawerNameColor", -1) | (-16777216);
        drawerPhoneColor = sharedPreferences.getInt("drawerPhoneColor", lightColor);
        drawerAvatarSize = sharedPreferences.getInt("drawerAvatarSize", 64);
        drawerCenterAvatarCheck = sharedPreferences.getBoolean("drawerCenterAvatarCheck", false);
        drawerHeaderBGCheck = sharedPreferences.getBoolean("drawerHeaderBGCheck", false);
        drawerHideBGShadowCheck = sharedPreferences.getBoolean("drawerHideBGShadowCheck", false);
        drawerIconColor = sharedPreferences.getInt("drawerIconColor", -9211021) | (-16777216);
        drawerOptionSize = sharedPreferences.getInt("drawerOptionSize", AndroidUtilities.isTablet() ? 17 : 15);
        drawerTopShadowColor = sharedPreferences.getInt("drawerTopShadowColor", drawerHeaderColor) | (-16777216);
        drawerListDividerColor = sharedPreferences.getInt("drawerListDividerColor", -2500135) | (-16777216);
    }

    public static void updateProfileColors() {
        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0);
        profileActionbarColor = sharedPreferences.getInt("profileHeaderColor", defColor);
        profileActionbarGradientList = sharedPreferences.getInt("profileHeaderGradient", 0);
        profileActionbarGradientColor = sharedPreferences.getInt("profileHeaderGradientColor", defColor);
        profileActionbarIconsColor = sharedPreferences.getInt("profileHeaderIconsColor", -1);
        profileActionbarAvatarRadius = sharedPreferences.getInt("profileAvatarRadius", AndroidUtilities.isTablet() ? 35 : 32);
        profileActionbarNameSize = sharedPreferences.getInt("profileNameSize", AndroidUtilities.isTablet() ? 20 : 18);
        profileActionbarNameColor = sharedPreferences.getInt("profileNameColor", -1);
        profileActionbarStatusColor = sharedPreferences.getInt("profileStatusColor", lightColor);
        profileActionbarStatusSize = sharedPreferences.getInt("profileStatusSize", AndroidUtilities.isTablet() ? 16 : 14);
        profileRowColor = sharedPreferences.getInt("profileRowColor", -1);
        profileRowGradientList = sharedPreferences.getInt("profileRowGradient", 0);
        profileRowGradientColor = sharedPreferences.getInt("profileRowGradientColor", defColor);
        profileRowAvatarRadius = sharedPreferences.getInt("profileRowAvatarRadius", AndroidUtilities.isTablet() ? 35 : 32);
        profileRowTitleColor = sharedPreferences.getInt("profileTitleColor", -16777216);
        profileRowStatusColor = sharedPreferences.getInt("profileSummaryColor", -7697782);
        profileRowOnlineColor = sharedPreferences.getInt("profileOnlineColor", lightColor);
        profileRowIconsColor = sharedPreferences.getInt("profileIconsColor", -9211021);
        int i = profileRowColor;
        int i2 = defColor;
        if (i == i2) {
            i2 = darkColor;
        }
        profileRowCreatorStarColor = sharedPreferences.getInt("profileCreatorStarColor", i2);
        profileRowAdminStarColor = sharedPreferences.getInt("profileAdminStarColor", profileRowColor == -8026747 ? -4473925 : -8026747);
    }

    public static void updatePrefsColors() {
        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0);
        prefActionbarColor = sharedPreferences.getInt("prefHeaderColor", defColor);
        prefActionbarTitleColor = sharedPreferences.getInt("prefHeaderTitleColor", -1);
        prefActionbarStatusColor = sharedPreferences.getInt("prefHeaderStatusColor", lightColor);
        prefActionbarIconsColor = sharedPreferences.getInt("prefHeaderIconsColor", -1);
        prefAvatarColor = sharedPreferences.getInt("prefAvatarColor", darkColor);
        prefAvatarRadius = sharedPreferences.getInt("prefAvatarRadius", AndroidUtilities.isTablet() ? 35 : 32);
        prefAvatarSize = sharedPreferences.getInt("prefAvatarSize", AndroidUtilities.isTablet() ? 45 : 42);
        prefBGColor = sharedPreferences.getInt("prefBGColor", -1);
        prefShadowColor = sharedPreferences.getInt("prefShadowColor", -986896);
        prefSectionColor = sharedPreferences.getInt("prefSectionColor", defColor);
        prefTitleColor = sharedPreferences.getInt("prefTitleColor", -14606047);
        prefSummaryColor = sharedPreferences.getInt("prefSummaryColor", -7697782);
        prefDividerColor = sharedPreferences.getInt("prefDividerColor", -2500135);
    }

    public static void setBubbles(Context context) {
        String string = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0).getString("chatBubbleStyle", bubblesNamesArray[0]);
        if (string.equals(bubblesNamesArray[0])) {
            chat_msgInDrawable = new MessageDrawable(0, false, false);
            chat_msgInSelectedDrawable = new MessageDrawable(0, false, true);
            chat_msgOutDrawable = new MessageDrawable(0, true, false);
            chat_msgOutSelectedDrawable = new MessageDrawable(0, true, true);
            chat_msgInMediaDrawable = new MessageDrawable(1, false, false);
            chat_msgInMediaSelectedDrawable = new MessageDrawable(1, false, true);
            chat_msgOutMediaDrawable = new MessageDrawable(1, true, false);
            chat_msgOutMediaSelectedDrawable = new MessageDrawable(1, true, true);
            chatBubbleStyleVal = 0;
        } else if (string.equals(bubblesNamesArray[1])) {
            Resources resources = context.getResources();
            int i = R.drawable.msg_in_2;
            chat_msgInDrawable = new MessageDrawable(0, false, false, resources.getDrawable(i), null);
            chat_msgInSelectedDrawable = new MessageDrawable(0, false, true, context.getResources().getDrawable(i), null);
            Resources resources2 = context.getResources();
            int i2 = R.drawable.msg_out_2;
            chat_msgOutDrawable = new MessageDrawable(0, true, false, resources2.getDrawable(i2), null);
            chat_msgOutSelectedDrawable = new MessageDrawable(0, true, true, context.getResources().getDrawable(i2), null);
            Resources resources3 = context.getResources();
            int i3 = R.drawable.msg_in_2_photo;
            chat_msgInMediaDrawable = new MessageDrawable(1, false, false, resources3.getDrawable(i3), null);
            chat_msgInMediaSelectedDrawable = new MessageDrawable(1, false, true, context.getResources().getDrawable(i3), null);
            Resources resources4 = context.getResources();
            int i4 = R.drawable.msg_out_2_photo;
            chat_msgOutMediaDrawable = new MessageDrawable(1, true, false, resources4.getDrawable(i4), null);
            chat_msgOutMediaSelectedDrawable = new MessageDrawable(1, true, true, context.getResources().getDrawable(i4), null);
            chatBubbleStyleVal = 1;
        } else if (string.equals(bubblesNamesArray[2])) {
            Resources resources5 = context.getResources();
            int i5 = R.drawable.msg_in_3;
            chat_msgInDrawable = new MessageDrawable(0, false, false, resources5.getDrawable(i5), null);
            chat_msgInSelectedDrawable = new MessageDrawable(0, false, true, context.getResources().getDrawable(i5), null);
            Resources resources6 = context.getResources();
            int i6 = R.drawable.msg_out_3;
            chat_msgOutDrawable = new MessageDrawable(0, true, false, resources6.getDrawable(i6), null);
            chat_msgOutSelectedDrawable = new MessageDrawable(0, true, true, context.getResources().getDrawable(i6), null);
            Resources resources7 = context.getResources();
            int i7 = R.drawable.msg_in_3_photo;
            chat_msgInMediaDrawable = new MessageDrawable(1, false, false, resources7.getDrawable(i7), null);
            chat_msgInMediaSelectedDrawable = new MessageDrawable(1, false, true, context.getResources().getDrawable(i7), null);
            Resources resources8 = context.getResources();
            int i8 = R.drawable.msg_out_3_photo;
            chat_msgOutMediaDrawable = new MessageDrawable(1, true, false, resources8.getDrawable(i8), null);
            chat_msgOutMediaSelectedDrawable = new MessageDrawable(1, true, true, context.getResources().getDrawable(i8), null);
            chatBubbleStyleVal = 2;
        } else if (string.equals(bubblesNamesArray[3])) {
            Resources resources9 = context.getResources();
            int i9 = R.drawable.msg_in_4;
            chat_msgInDrawable = new MessageDrawable(0, false, false, resources9.getDrawable(i9), null);
            chat_msgInSelectedDrawable = new MessageDrawable(0, false, true, context.getResources().getDrawable(i9), null);
            Resources resources10 = context.getResources();
            int i10 = R.drawable.msg_out_4;
            chat_msgOutDrawable = new MessageDrawable(0, true, false, resources10.getDrawable(i10), null);
            chat_msgOutSelectedDrawable = new MessageDrawable(0, true, true, context.getResources().getDrawable(i10), null);
            Resources resources11 = context.getResources();
            int i11 = R.drawable.msg_in_4_photo;
            chat_msgInMediaDrawable = new MessageDrawable(1, false, false, resources11.getDrawable(i11), null);
            chat_msgInMediaSelectedDrawable = new MessageDrawable(1, false, true, context.getResources().getDrawable(i11), null);
            Resources resources12 = context.getResources();
            int i12 = R.drawable.msg_out_4_photo;
            chat_msgOutMediaDrawable = new MessageDrawable(1, true, false, resources12.getDrawable(i12), null);
            chat_msgOutMediaSelectedDrawable = new MessageDrawable(1, true, true, context.getResources().getDrawable(i12), null);
            chatBubbleStyleVal = 3;
        } else if (string.equals(bubblesNamesArray[4])) {
            Resources resources13 = context.getResources();
            int i13 = R.drawable.msg_in_5;
            chat_msgInDrawable = new MessageDrawable(0, false, false, resources13.getDrawable(i13), null);
            chat_msgInSelectedDrawable = new MessageDrawable(0, false, true, context.getResources().getDrawable(i13), null);
            Resources resources14 = context.getResources();
            int i14 = R.drawable.msg_out_5;
            chat_msgOutDrawable = new MessageDrawable(0, true, false, resources14.getDrawable(i14), null);
            chat_msgOutSelectedDrawable = new MessageDrawable(0, true, true, context.getResources().getDrawable(i14), null);
            Resources resources15 = context.getResources();
            int i15 = R.drawable.msg_in_5_photo;
            chat_msgInMediaDrawable = new MessageDrawable(1, false, false, resources15.getDrawable(i15), null);
            chat_msgInMediaSelectedDrawable = new MessageDrawable(1, false, true, context.getResources().getDrawable(i15), null);
            Resources resources16 = context.getResources();
            int i16 = R.drawable.msg_out_5_photo;
            chat_msgOutMediaDrawable = new MessageDrawable(1, true, false, resources16.getDrawable(i16), null);
            chat_msgOutMediaSelectedDrawable = new MessageDrawable(1, true, true, context.getResources().getDrawable(i16), null);
            chatBubbleStyleVal = 4;
        } else if (string.equals(bubblesNamesArray[5])) {
            Resources resources17 = context.getResources();
            int i17 = R.drawable.msg_in_6;
            chat_msgInDrawable = new MessageDrawable(0, false, false, resources17.getDrawable(i17), null);
            chat_msgInSelectedDrawable = new MessageDrawable(0, false, true, context.getResources().getDrawable(i17), null);
            Resources resources18 = context.getResources();
            int i18 = R.drawable.msg_out_6;
            chat_msgOutDrawable = new MessageDrawable(0, true, false, resources18.getDrawable(i18), null);
            chat_msgOutSelectedDrawable = new MessageDrawable(0, true, true, context.getResources().getDrawable(i18), null);
            Resources resources19 = context.getResources();
            int i19 = R.drawable.msg_in_6_photo;
            chat_msgInMediaDrawable = new MessageDrawable(1, false, false, resources19.getDrawable(i19), null);
            chat_msgInMediaSelectedDrawable = new MessageDrawable(1, false, true, context.getResources().getDrawable(i19), null);
            Resources resources20 = context.getResources();
            int i20 = R.drawable.msg_out_6_photo;
            chat_msgOutMediaDrawable = new MessageDrawable(1, true, false, resources20.getDrawable(i20), null);
            chat_msgOutMediaSelectedDrawable = new MessageDrawable(1, true, true, context.getResources().getDrawable(i20), null);
            chatBubbleStyleVal = 5;
        } else if (string.equals(bubblesNamesArray[6])) {
            Resources resources21 = context.getResources();
            int i21 = R.drawable.msg_in_7;
            chat_msgInDrawable = new MessageDrawable(0, false, false, resources21.getDrawable(i21), null);
            chat_msgInSelectedDrawable = new MessageDrawable(0, false, true, context.getResources().getDrawable(i21), null);
            Resources resources22 = context.getResources();
            int i22 = R.drawable.msg_out_7;
            chat_msgOutDrawable = new MessageDrawable(0, true, false, resources22.getDrawable(i22), null);
            chat_msgOutSelectedDrawable = new MessageDrawable(0, true, true, context.getResources().getDrawable(i22), null);
            Resources resources23 = context.getResources();
            int i23 = R.drawable.msg_in_7_photo;
            chat_msgInMediaDrawable = new MessageDrawable(1, false, false, resources23.getDrawable(i23), null);
            chat_msgInMediaSelectedDrawable = new MessageDrawable(1, false, true, context.getResources().getDrawable(i23), null);
            Resources resources24 = context.getResources();
            int i24 = R.drawable.msg_out_7_photo;
            chat_msgOutMediaDrawable = new MessageDrawable(1, true, false, resources24.getDrawable(i24), null);
            chat_msgOutMediaSelectedDrawable = new MessageDrawable(1, true, true, context.getResources().getDrawable(i24), null);
            chatBubbleStyleVal = 6;
        } else if (string.equals(bubblesNamesArray[7])) {
            Resources resources25 = context.getResources();
            int i25 = R.drawable.msg_in_8;
            chat_msgInDrawable = new MessageDrawable(0, false, false, resources25.getDrawable(i25), null);
            chat_msgInSelectedDrawable = new MessageDrawable(0, false, true, context.getResources().getDrawable(i25), null);
            Resources resources26 = context.getResources();
            int i26 = R.drawable.msg_out_8;
            chat_msgOutDrawable = new MessageDrawable(0, true, false, resources26.getDrawable(i26), null);
            chat_msgOutSelectedDrawable = new MessageDrawable(0, true, true, context.getResources().getDrawable(i26), null);
            Resources resources27 = context.getResources();
            int i27 = R.drawable.msg_in_8_photo;
            chat_msgInMediaDrawable = new MessageDrawable(1, false, false, resources27.getDrawable(i27), null);
            chat_msgInMediaSelectedDrawable = new MessageDrawable(1, false, true, context.getResources().getDrawable(i27), null);
            Resources resources28 = context.getResources();
            int i28 = R.drawable.msg_out_8_photo;
            chat_msgOutMediaDrawable = new MessageDrawable(1, true, false, resources28.getDrawable(i28), null);
            chat_msgOutMediaSelectedDrawable = new MessageDrawable(1, true, true, context.getResources().getDrawable(i28), null);
            chatBubbleStyleVal = 7;
        } else if (string.equals(bubblesNamesArray[8])) {
            Resources resources29 = context.getResources();
            int i29 = R.drawable.msg_in_9;
            chat_msgInDrawable = new MessageDrawable(0, false, false, resources29.getDrawable(i29), null);
            chat_msgInSelectedDrawable = new MessageDrawable(0, false, true, context.getResources().getDrawable(i29), null);
            Resources resources30 = context.getResources();
            int i30 = R.drawable.msg_out_9;
            chat_msgOutDrawable = new MessageDrawable(0, true, false, resources30.getDrawable(i30), null);
            chat_msgOutSelectedDrawable = new MessageDrawable(0, true, true, context.getResources().getDrawable(i30), null);
            Resources resources31 = context.getResources();
            int i31 = R.drawable.msg_in_9_photo;
            chat_msgInMediaDrawable = new MessageDrawable(1, false, false, resources31.getDrawable(i31), null);
            chat_msgInMediaSelectedDrawable = new MessageDrawable(1, false, true, context.getResources().getDrawable(i31), null);
            Resources resources32 = context.getResources();
            int i32 = R.drawable.msg_out_9_photo;
            chat_msgOutMediaDrawable = new MessageDrawable(1, true, false, resources32.getDrawable(i32), null);
            chat_msgOutMediaSelectedDrawable = new MessageDrawable(1, true, true, context.getResources().getDrawable(i32), null);
            chatBubbleStyleVal = 8;
        } else if (string.equals(bubblesNamesArray[9])) {
            Resources resources33 = context.getResources();
            int i33 = R.drawable.msg_in_10;
            chat_msgInDrawable = new MessageDrawable(0, false, false, resources33.getDrawable(i33), null);
            chat_msgInSelectedDrawable = new MessageDrawable(0, false, true, context.getResources().getDrawable(i33), null);
            Resources resources34 = context.getResources();
            int i34 = R.drawable.msg_out_10;
            chat_msgOutDrawable = new MessageDrawable(0, true, false, resources34.getDrawable(i34), null);
            chat_msgOutSelectedDrawable = new MessageDrawable(0, true, true, context.getResources().getDrawable(i34), null);
            Resources resources35 = context.getResources();
            int i35 = R.drawable.msg_in_10_photo;
            chat_msgInMediaDrawable = new MessageDrawable(1, false, false, resources35.getDrawable(i35), null);
            chat_msgInMediaSelectedDrawable = new MessageDrawable(1, false, true, context.getResources().getDrawable(i35), null);
            Resources resources36 = context.getResources();
            int i36 = R.drawable.msg_out_10_photo;
            chat_msgOutMediaDrawable = new MessageDrawable(1, true, false, resources36.getDrawable(i36), null);
            chat_msgOutMediaSelectedDrawable = new MessageDrawable(1, true, true, context.getResources().getDrawable(i36), null);
            chatBubbleStyleVal = 9;
        } else if (string.equals(bubblesNamesArray[10])) {
            Resources resources37 = context.getResources();
            int i37 = R.drawable.msg_in_11;
            chat_msgInDrawable = new MessageDrawable(0, false, false, resources37.getDrawable(i37), null);
            chat_msgInSelectedDrawable = new MessageDrawable(0, false, true, context.getResources().getDrawable(i37), null);
            Resources resources38 = context.getResources();
            int i38 = R.drawable.msg_out_11;
            chat_msgOutDrawable = new MessageDrawable(0, true, false, resources38.getDrawable(i38), null);
            chat_msgOutSelectedDrawable = new MessageDrawable(0, true, true, context.getResources().getDrawable(i38), null);
            Resources resources39 = context.getResources();
            int i39 = R.drawable.msg_in_11_photo;
            chat_msgInMediaDrawable = new MessageDrawable(1, false, false, resources39.getDrawable(i39), null);
            chat_msgInMediaSelectedDrawable = new MessageDrawable(1, false, true, context.getResources().getDrawable(i39), null);
            Resources resources40 = context.getResources();
            int i40 = R.drawable.msg_out_11_photo;
            chat_msgOutMediaDrawable = new MessageDrawable(1, true, false, resources40.getDrawable(i40), null);
            chat_msgOutMediaSelectedDrawable = new MessageDrawable(1, true, true, context.getResources().getDrawable(i40), null);
            chatBubbleStyleVal = 10;
        } else if (string.equals(bubblesNamesArray[11])) {
            Resources resources41 = context.getResources();
            int i41 = R.drawable.msg_in_12;
            chat_msgInDrawable = new MessageDrawable(0, false, false, resources41.getDrawable(i41), null);
            chat_msgInSelectedDrawable = new MessageDrawable(0, false, true, context.getResources().getDrawable(i41), null);
            Resources resources42 = context.getResources();
            int i42 = R.drawable.msg_out_12;
            chat_msgOutDrawable = new MessageDrawable(0, true, false, resources42.getDrawable(i42), null);
            chat_msgOutSelectedDrawable = new MessageDrawable(0, true, true, context.getResources().getDrawable(i42), null);
            Resources resources43 = context.getResources();
            int i43 = R.drawable.msg_in_12_photo;
            chat_msgInMediaDrawable = new MessageDrawable(1, false, false, resources43.getDrawable(i43), null);
            chat_msgInMediaSelectedDrawable = new MessageDrawable(1, false, true, context.getResources().getDrawable(i43), null);
            Resources resources44 = context.getResources();
            int i44 = R.drawable.msg_out_12_photo;
            chat_msgOutMediaDrawable = new MessageDrawable(1, true, false, resources44.getDrawable(i44), null);
            chat_msgOutMediaSelectedDrawable = new MessageDrawable(1, true, true, context.getResources().getDrawable(i44), null);
            chatBubbleStyleVal = 11;
        } else if (string.equals(bubblesNamesArray[12])) {
            Resources resources45 = context.getResources();
            int i45 = R.drawable.msg_in_13;
            chat_msgInDrawable = new MessageDrawable(0, false, false, resources45.getDrawable(i45), null);
            chat_msgInSelectedDrawable = new MessageDrawable(0, false, true, context.getResources().getDrawable(i45), null);
            Resources resources46 = context.getResources();
            int i46 = R.drawable.msg_out_13;
            chat_msgOutDrawable = new MessageDrawable(0, true, false, resources46.getDrawable(i46), null);
            chat_msgOutSelectedDrawable = new MessageDrawable(0, true, true, context.getResources().getDrawable(i46), null);
            Resources resources47 = context.getResources();
            int i47 = R.drawable.msg_in_13_photo;
            chat_msgInMediaDrawable = new MessageDrawable(1, false, false, resources47.getDrawable(i47), null);
            chat_msgInMediaSelectedDrawable = new MessageDrawable(1, false, true, context.getResources().getDrawable(i47), null);
            Resources resources48 = context.getResources();
            int i48 = R.drawable.msg_out_13_photo;
            chat_msgOutMediaDrawable = new MessageDrawable(1, true, false, resources48.getDrawable(i48), null);
            chat_msgOutMediaSelectedDrawable = new MessageDrawable(1, true, true, context.getResources().getDrawable(i48), null);
            chatBubbleStyleVal = 12;
        } else if (string.equals(bubblesNamesArray[13])) {
            Resources resources49 = context.getResources();
            int i49 = R.drawable.msg_in_14;
            chat_msgInDrawable = new MessageDrawable(0, false, false, resources49.getDrawable(i49), null);
            chat_msgInSelectedDrawable = new MessageDrawable(0, false, true, context.getResources().getDrawable(i49), null);
            Resources resources50 = context.getResources();
            int i50 = R.drawable.msg_out_14;
            chat_msgOutDrawable = new MessageDrawable(0, true, false, resources50.getDrawable(i50), null);
            chat_msgOutSelectedDrawable = new MessageDrawable(0, true, true, context.getResources().getDrawable(i50), null);
            Resources resources51 = context.getResources();
            int i51 = R.drawable.msg_in_14_photo;
            chat_msgInMediaDrawable = new MessageDrawable(1, false, false, resources51.getDrawable(i51), null);
            chat_msgInMediaSelectedDrawable = new MessageDrawable(1, false, true, context.getResources().getDrawable(i51), null);
            Resources resources52 = context.getResources();
            int i52 = R.drawable.msg_out_14_photo;
            chat_msgOutMediaDrawable = new MessageDrawable(1, true, false, resources52.getDrawable(i52), null);
            chat_msgOutMediaSelectedDrawable = new MessageDrawable(1, true, true, context.getResources().getDrawable(i52), null);
            chatBubbleStyleVal = 13;
        } else {
            chat_msgInDrawable = new MessageDrawable(0, false, false);
            chat_msgInSelectedDrawable = new MessageDrawable(0, false, true);
            chat_msgOutDrawable = new MessageDrawable(0, true, false);
            chat_msgOutSelectedDrawable = new MessageDrawable(0, true, true);
            chat_msgInMediaDrawable = new MessageDrawable(1, false, false);
            chat_msgInMediaSelectedDrawable = new MessageDrawable(1, false, true);
            chat_msgOutMediaDrawable = new MessageDrawable(1, true, false);
            chat_msgOutMediaSelectedDrawable = new MessageDrawable(1, true, true);
            chatBubbleStyleVal = 0;
        }
        chatBubbleStyle = bubblesNamesArray[chatBubbleStyleVal];
    }

    public static void setChecks(Context context) {
        String string = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0).getString("chatCheckStyle", checksNamesArray[0]);
        if (string.equals(checksNamesArray[1])) {
            Resources resources = context.getResources();
            int i = R.drawable.msg_check_w_2;
            chat_msgOutCheckDrawable = resources.getDrawable(i).mutate();
            chat_msgOutCheckSelectedDrawable = context.getResources().getDrawable(i).mutate();
            chat_msgOutCheckReadDrawable = context.getResources().getDrawable(i).mutate();
            chat_msgOutCheckReadSelectedDrawable = context.getResources().getDrawable(i).mutate();
            chat_msgMediaCheckDrawable = context.getResources().getDrawable(i).mutate();
            chat_msgStickerCheckDrawable = context.getResources().getDrawable(i).mutate();
            Resources resources2 = context.getResources();
            int i2 = R.drawable.msg_halfcheck_w_2;
            chat_msgOutHalfCheckDrawable = resources2.getDrawable(i2).mutate();
            chat_msgOutHalfCheckSelectedDrawable = context.getResources().getDrawable(i2).mutate();
            chat_msgMediaHalfCheckDrawable = context.getResources().getDrawable(i2).mutate();
            chat_msgStickerHalfCheckDrawable = context.getResources().getDrawable(i2).mutate();
            chatCheckStyleVal = 1;
        } else if (string.equals(checksNamesArray[2])) {
            Resources resources3 = context.getResources();
            int i3 = R.drawable.msg_check_w_3;
            chat_msgOutCheckDrawable = resources3.getDrawable(i3).mutate();
            chat_msgOutCheckSelectedDrawable = context.getResources().getDrawable(i3).mutate();
            chat_msgOutCheckReadDrawable = context.getResources().getDrawable(i3).mutate();
            chat_msgOutCheckReadSelectedDrawable = context.getResources().getDrawable(i3).mutate();
            chat_msgMediaCheckDrawable = context.getResources().getDrawable(i3).mutate();
            chat_msgStickerCheckDrawable = context.getResources().getDrawable(i3).mutate();
            Resources resources4 = context.getResources();
            int i4 = R.drawable.msg_halfcheck_w_3;
            chat_msgOutHalfCheckDrawable = resources4.getDrawable(i4).mutate();
            chat_msgOutHalfCheckSelectedDrawable = context.getResources().getDrawable(i4).mutate();
            chat_msgMediaHalfCheckDrawable = context.getResources().getDrawable(i4).mutate();
            chat_msgStickerHalfCheckDrawable = context.getResources().getDrawable(i4).mutate();
            chatCheckStyleVal = 2;
        } else if (string.equals(checksNamesArray[3])) {
            Resources resources5 = context.getResources();
            int i5 = R.drawable.msg_check_w_4;
            chat_msgOutCheckDrawable = resources5.getDrawable(i5).mutate();
            chat_msgOutCheckSelectedDrawable = context.getResources().getDrawable(i5).mutate();
            chat_msgOutCheckReadDrawable = context.getResources().getDrawable(i5).mutate();
            chat_msgOutCheckReadSelectedDrawable = context.getResources().getDrawable(i5).mutate();
            chat_msgMediaCheckDrawable = context.getResources().getDrawable(i5).mutate();
            chat_msgStickerCheckDrawable = context.getResources().getDrawable(i5).mutate();
            Resources resources6 = context.getResources();
            int i6 = R.drawable.msg_halfcheck_w_4;
            chat_msgOutHalfCheckDrawable = resources6.getDrawable(i6).mutate();
            chat_msgOutHalfCheckSelectedDrawable = context.getResources().getDrawable(i6).mutate();
            chat_msgMediaHalfCheckDrawable = context.getResources().getDrawable(i6).mutate();
            chat_msgStickerHalfCheckDrawable = context.getResources().getDrawable(i6).mutate();
            chatCheckStyleVal = 3;
        } else if (string.equals(checksNamesArray[4])) {
            Resources resources7 = context.getResources();
            int i7 = R.drawable.msg_check_w_5;
            chat_msgOutCheckDrawable = resources7.getDrawable(i7).mutate();
            chat_msgOutCheckSelectedDrawable = context.getResources().getDrawable(i7).mutate();
            chat_msgOutCheckReadDrawable = context.getResources().getDrawable(i7).mutate();
            chat_msgOutCheckReadSelectedDrawable = context.getResources().getDrawable(i7).mutate();
            chat_msgMediaCheckDrawable = context.getResources().getDrawable(i7).mutate();
            chat_msgStickerCheckDrawable = context.getResources().getDrawable(i7).mutate();
            Resources resources8 = context.getResources();
            int i8 = R.drawable.msg_halfcheck_w_5;
            chat_msgOutHalfCheckDrawable = resources8.getDrawable(i8).mutate();
            chat_msgOutHalfCheckSelectedDrawable = context.getResources().getDrawable(i8).mutate();
            chat_msgMediaHalfCheckDrawable = context.getResources().getDrawable(i8).mutate();
            chat_msgStickerHalfCheckDrawable = context.getResources().getDrawable(i8).mutate();
            chatCheckStyleVal = 4;
        } else if (string.equals(checksNamesArray[5])) {
            Resources resources9 = context.getResources();
            int i9 = R.drawable.msg_check_w_6;
            chat_msgOutCheckDrawable = resources9.getDrawable(i9).mutate();
            chat_msgOutCheckSelectedDrawable = context.getResources().getDrawable(i9).mutate();
            chat_msgOutCheckReadDrawable = context.getResources().getDrawable(i9).mutate();
            chat_msgOutCheckReadSelectedDrawable = context.getResources().getDrawable(i9).mutate();
            chat_msgMediaCheckDrawable = context.getResources().getDrawable(i9).mutate();
            chat_msgStickerCheckDrawable = context.getResources().getDrawable(i9).mutate();
            Resources resources10 = context.getResources();
            int i10 = R.drawable.msg_halfcheck_w_6;
            chat_msgOutHalfCheckDrawable = resources10.getDrawable(i10).mutate();
            chat_msgOutHalfCheckSelectedDrawable = context.getResources().getDrawable(i10).mutate();
            chat_msgMediaHalfCheckDrawable = context.getResources().getDrawable(i10).mutate();
            chat_msgStickerHalfCheckDrawable = context.getResources().getDrawable(i10).mutate();
            chatCheckStyleVal = 5;
        } else if (string.equals(checksNamesArray[6])) {
            Resources resources11 = context.getResources();
            int i11 = R.drawable.msg_check_w_7;
            chat_msgOutCheckDrawable = resources11.getDrawable(i11).mutate();
            chat_msgOutCheckSelectedDrawable = context.getResources().getDrawable(i11).mutate();
            chat_msgOutCheckReadDrawable = context.getResources().getDrawable(i11).mutate();
            chat_msgOutCheckReadSelectedDrawable = context.getResources().getDrawable(i11).mutate();
            chat_msgMediaCheckDrawable = context.getResources().getDrawable(i11).mutate();
            chat_msgStickerCheckDrawable = context.getResources().getDrawable(i11).mutate();
            Resources resources12 = context.getResources();
            int i12 = R.drawable.msg_halfcheck_w_7;
            chat_msgOutHalfCheckDrawable = resources12.getDrawable(i12).mutate();
            chat_msgOutHalfCheckSelectedDrawable = context.getResources().getDrawable(i12).mutate();
            chat_msgMediaHalfCheckDrawable = context.getResources().getDrawable(i12).mutate();
            chat_msgStickerHalfCheckDrawable = context.getResources().getDrawable(i12).mutate();
            chatCheckStyleVal = 6;
        } else if (string.equals(checksNamesArray[7])) {
            Resources resources13 = context.getResources();
            int i13 = R.drawable.msg_check_w_8;
            chat_msgOutCheckDrawable = resources13.getDrawable(i13).mutate();
            chat_msgOutCheckSelectedDrawable = context.getResources().getDrawable(i13).mutate();
            chat_msgOutCheckReadDrawable = context.getResources().getDrawable(i13).mutate();
            chat_msgOutCheckReadSelectedDrawable = context.getResources().getDrawable(i13).mutate();
            chat_msgMediaCheckDrawable = context.getResources().getDrawable(i13).mutate();
            chat_msgStickerCheckDrawable = context.getResources().getDrawable(i13).mutate();
            Resources resources14 = context.getResources();
            int i14 = R.drawable.msg_halfcheck_w_8;
            chat_msgOutHalfCheckDrawable = resources14.getDrawable(i14).mutate();
            chat_msgOutHalfCheckSelectedDrawable = context.getResources().getDrawable(i14).mutate();
            chat_msgMediaHalfCheckDrawable = context.getResources().getDrawable(i14).mutate();
            chat_msgStickerHalfCheckDrawable = context.getResources().getDrawable(i14).mutate();
            chatCheckStyleVal = 7;
        } else if (string.equals(checksNamesArray[8])) {
            Resources resources15 = context.getResources();
            int i15 = R.drawable.msg_check_w_9;
            chat_msgOutCheckDrawable = resources15.getDrawable(i15).mutate();
            chat_msgOutCheckSelectedDrawable = context.getResources().getDrawable(i15).mutate();
            chat_msgOutCheckReadDrawable = context.getResources().getDrawable(i15).mutate();
            chat_msgOutCheckReadSelectedDrawable = context.getResources().getDrawable(i15).mutate();
            chat_msgMediaCheckDrawable = context.getResources().getDrawable(i15).mutate();
            chat_msgStickerCheckDrawable = context.getResources().getDrawable(i15).mutate();
            Resources resources16 = context.getResources();
            int i16 = R.drawable.msg_halfcheck_w_9;
            chat_msgOutHalfCheckDrawable = resources16.getDrawable(i16).mutate();
            chat_msgOutHalfCheckSelectedDrawable = context.getResources().getDrawable(i16).mutate();
            chat_msgMediaHalfCheckDrawable = context.getResources().getDrawable(i16).mutate();
            chat_msgStickerHalfCheckDrawable = context.getResources().getDrawable(i16).mutate();
            chatCheckStyleVal = 8;
        } else if (string.equals(checksNamesArray[9])) {
            Resources resources17 = context.getResources();
            int i17 = R.drawable.msg_check_w_10;
            chat_msgOutCheckDrawable = resources17.getDrawable(i17).mutate();
            chat_msgOutCheckSelectedDrawable = context.getResources().getDrawable(i17).mutate();
            chat_msgOutCheckReadDrawable = context.getResources().getDrawable(i17).mutate();
            chat_msgOutCheckReadSelectedDrawable = context.getResources().getDrawable(i17).mutate();
            chat_msgMediaCheckDrawable = context.getResources().getDrawable(i17).mutate();
            chat_msgStickerCheckDrawable = context.getResources().getDrawable(i17).mutate();
            Resources resources18 = context.getResources();
            int i18 = R.drawable.msg_halfcheck_w_10;
            chat_msgOutHalfCheckDrawable = resources18.getDrawable(i18).mutate();
            chat_msgOutHalfCheckSelectedDrawable = context.getResources().getDrawable(i18).mutate();
            chat_msgMediaHalfCheckDrawable = context.getResources().getDrawable(i18).mutate();
            chat_msgStickerHalfCheckDrawable = context.getResources().getDrawable(i18).mutate();
            chatCheckStyleVal = 9;
        } else if (string.equals(checksNamesArray[10])) {
            Resources resources19 = context.getResources();
            int i19 = R.drawable.msg_check_w_11;
            chat_msgOutCheckDrawable = resources19.getDrawable(i19).mutate();
            chat_msgOutCheckSelectedDrawable = context.getResources().getDrawable(i19).mutate();
            chat_msgOutCheckReadDrawable = context.getResources().getDrawable(i19).mutate();
            chat_msgOutCheckReadSelectedDrawable = context.getResources().getDrawable(i19).mutate();
            chat_msgMediaCheckDrawable = context.getResources().getDrawable(i19).mutate();
            chat_msgStickerCheckDrawable = context.getResources().getDrawable(i19).mutate();
            Resources resources20 = context.getResources();
            int i20 = R.drawable.msg_halfcheck_w_11;
            chat_msgOutHalfCheckDrawable = resources20.getDrawable(i20).mutate();
            chat_msgOutHalfCheckSelectedDrawable = context.getResources().getDrawable(i20).mutate();
            chat_msgMediaHalfCheckDrawable = context.getResources().getDrawable(i20).mutate();
            chat_msgStickerHalfCheckDrawable = context.getResources().getDrawable(i20).mutate();
            chatCheckStyleVal = 10;
        } else if (string.equals(checksNamesArray[11])) {
            Resources resources21 = context.getResources();
            int i21 = R.drawable.msg_check_w_12;
            chat_msgOutCheckDrawable = resources21.getDrawable(i21).mutate();
            chat_msgOutCheckSelectedDrawable = context.getResources().getDrawable(i21).mutate();
            chat_msgOutCheckReadDrawable = context.getResources().getDrawable(i21).mutate();
            chat_msgOutCheckReadSelectedDrawable = context.getResources().getDrawable(i21).mutate();
            chat_msgMediaCheckDrawable = context.getResources().getDrawable(i21).mutate();
            chat_msgStickerCheckDrawable = context.getResources().getDrawable(i21).mutate();
            Resources resources22 = context.getResources();
            int i22 = R.drawable.msg_halfcheck_w_12;
            chat_msgOutHalfCheckDrawable = resources22.getDrawable(i22).mutate();
            chat_msgOutHalfCheckSelectedDrawable = context.getResources().getDrawable(i22).mutate();
            chat_msgMediaHalfCheckDrawable = context.getResources().getDrawable(i22).mutate();
            chat_msgStickerHalfCheckDrawable = context.getResources().getDrawable(i22).mutate();
            chatCheckStyleVal = 11;
        } else {
            Resources resources23 = context.getResources();
            int i23 = R.drawable.msg_check_s;
            chat_msgOutCheckDrawable = resources23.getDrawable(i23).mutate();
            chat_msgOutCheckSelectedDrawable = context.getResources().getDrawable(i23).mutate();
            chat_msgOutCheckReadDrawable = context.getResources().getDrawable(i23).mutate();
            chat_msgOutCheckReadSelectedDrawable = context.getResources().getDrawable(i23).mutate();
            chat_msgMediaCheckDrawable = context.getResources().getDrawable(i23).mutate();
            chat_msgStickerCheckDrawable = context.getResources().getDrawable(i23).mutate();
            Resources resources24 = context.getResources();
            int i24 = R.drawable.msg_halfcheck;
            chat_msgOutHalfCheckDrawable = resources24.getDrawable(i24).mutate();
            chat_msgOutHalfCheckSelectedDrawable = context.getResources().getDrawable(i24).mutate();
            chat_msgMediaHalfCheckDrawable = context.getResources().getDrawable(i24).mutate();
            chat_msgStickerHalfCheckDrawable = context.getResources().getDrawable(i24).mutate();
            chatCheckStyleVal = 0;
        }
        setDialogsChecks(context.getResources());
        chatCheckStyle = checksNamesArray[chatCheckStyleVal];
    }

    public static boolean getDeviceFont() {
        if (useDeviceFont == null) {
            SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("plusconfig", 0);
            showAndroidEmoji = sharedPreferences.getBoolean("showAndroidEmoji", false);
            useDeviceFont = Boolean.valueOf(sharedPreferences.getBoolean("useDeviceFont", false));
        }
        return useDeviceFont.booleanValue();
    }

    public static void updatePlusPrefs() {
        SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("plusconfig", 0);
        showAndroidEmoji = sharedPreferences.getBoolean("showAndroidEmoji", false);
        useDeviceFont = Boolean.valueOf(sharedPreferences.getBoolean("useDeviceFont", false));
        linkAndClick = sharedPreferences.getBoolean("linkAndClick", false);
        plusShowDSBtnUsers = sharedPreferences.getBoolean("showDSBtnUsers", false);
        plusShowDSBtnGroups = sharedPreferences.getBoolean("showDSBtnGroups", true);
        plusShowDSBtnSGroups = sharedPreferences.getBoolean("showDSBtnSGroups", true);
        plusShowDSBtnChannels = sharedPreferences.getBoolean("showDSBtnChannels", true);
        plusShowDSBtnBots = sharedPreferences.getBoolean("showDSBtnBots", true);
        sharedPreferences.getBoolean("showEditedMark", true);
        plusShowPhotoQualityBar = sharedPreferences.getBoolean("showPhotoQualityBar", true);
        plusPhotoQuality = sharedPreferences.getInt("photoQuality", 80);
        plusPhotoViewerHideStatusBar = sharedPreferences.getBoolean("photoViewerHideStatusBar", false);
        plusShowTypingToast = sharedPreferences.getBoolean("showTypingToast", false);
        plusShowOnlineToast = sharedPreferences.getBoolean("showOnlineToast", false);
        plusShowOnlyIfContactFav = sharedPreferences.getBoolean("showOnlyIfContactFav", true);
        plusShowTypingOnlyIfContactFav = sharedPreferences.getBoolean("showTypingOnlyIfContactFav", true);
        plusShowOfflineToast = sharedPreferences.getBoolean("showOfflineToast", false);
        plusToastNotificationSize = sharedPreferences.getInt("toastNotificationSize", 13);
        sharedPreferences.getInt("toastNotificationColor", 13);
        plusToastNotificationPadding = sharedPreferences.getInt("toastNotificationPadding", 0);
        plusToastNotificationToBottom = sharedPreferences.getBoolean("toastNotificationToBottom", false);
        plusToastNotificationPosition = sharedPreferences.getInt("toastNotificationPosition", 1);
        plusEnableDirectReply = sharedPreferences.getBoolean("enableDirectReply", true);
        plusShowQuickBar = sharedPreferences.getBoolean("showQuickBar", true);
        plusVerticalQuickBar = sharedPreferences.getBoolean("verticalQuickBar", true);
        plusAlwaysBackToMain = sharedPreferences.getBoolean("alwaysBackToMain", false);
        plusDoNotCloseQuickBar = sharedPreferences.getBoolean("doNotCloseQuickBar", false);
        plusHideQuickBarOnScroll = sharedPreferences.getBoolean("hideQuickBarOnScroll", true);
        plusCenterQuickBarBtn = sharedPreferences.getBoolean("centerQuickBarBtn", false);
        plusQuickBarDialogType = sharedPreferences.getInt("quickBarDialogType", 0);
        plusQuickBarShowMembers = sharedPreferences.getBoolean("quickBarShowMembers", false);
        plusSaveToCloudQuote = sharedPreferences.getBoolean("saveToCloudQuote", true);
        plusDisableSwipeToReplyVibration = sharedPreferences.getBoolean("plusDisableSwipeToReplyVibration", false);
        plusHideNotificationsIfPlaying = sharedPreferences.getBoolean("hideNotificationsIfPlaying", false);
        AndroidUtilities.playingAGame = false;
        plusHideInstantCamera = sharedPreferences.getBoolean("hideInstantCamera", false);
        plusDoNotHideStickersTab = sharedPreferences.getBoolean("doNotHideStickersTab", false);
        plusSortAll = sharedPreferences.getInt("sortAll", 0);
        plusSortUsers = sharedPreferences.getInt("sortUsers", 0);
        plusSortGroups = sharedPreferences.getInt("sortGroups", 0);
        plusSortSuperGroups = sharedPreferences.getInt("sortSGroups", 0);
        plusSortChannels = sharedPreferences.getInt("sortChannels", 0);
        plusSortBots = sharedPreferences.getInt("sortBots", 0);
        plusSortFavs = sharedPreferences.getInt("sortFavs", 0);
        plusSortAdmin = sharedPreferences.getInt("sortAdmin", 0);
        plusSortUnread = sharedPreferences.getInt("sortUnread", 0);
        plusSortUnmuted = sharedPreferences.getInt("sortUnmuted", 0);
        plusDrawSingleBigEmoji = sharedPreferences.getBoolean("drawSingleBigEmoji", SharedConfig.allowBigEmoji);
        plusEnableMarkdown = sharedPreferences.getBoolean("enableMarkdown", false);
        sharedPreferences.getBoolean("showUnmutedFirst", false);
        plusShowSavedMessagesInUsersTab = sharedPreferences.getBoolean("showSavedMessagesInUsersTab", true);
        plusHideTabs = sharedPreferences.getBoolean("hideTabs", false);
        plusHideTabsDirectShare = sharedPreferences.getBoolean("hideTabsDS", false);
        SharedPreferences sharedPreferences2 = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0);
        plusTabsToBottom = sharedPreferences.getBoolean("tabsToBottom", sharedPreferences2.contains("chatsTabsToBottom") ? chatsTabsToBottom : false);
        plusHideTabsSelector = sharedPreferences.getBoolean("hideSelectedTabIndicator", false);
        plusHideTabsCounters = sharedPreferences.getBoolean("hideTabsCounters", false);
        plusProfileEnableGoToMsg = sharedPreferences.getBoolean("profileEnableGoToMsg", false);
        plusChatsToLoad = sharedPreferences.getInt("chatsToLoad", 100);
        plusTabsHeight = sharedPreferences.getInt("tabsHeight", 44);
        plusDialogType = sharedPreferences.getInt("dialogType", 0);
        int i = sharedPreferences.getInt("defaultTab", -1);
        plusDefaultTab = i;
        if (i == -1) {
            i = sharedPreferences.getInt("selectedTab", 0);
        }
        plusSelectedTab = i;
        plusShareAlertDialogType = sharedPreferences.getInt("shareAlertDialogType", plusDialogType);
        int i2 = sharedPreferences.getInt("shareAlertDefaultTab", -1);
        plusShareAlertDefaultTab = i2;
        if (i2 == -1) {
            i2 = sharedPreferences.getInt("shareAlertSelectedTab", plusSelectedTab);
        }
        plusShareAlertSelectedTab = i2;
        plusArchivedChatsDialogType = sharedPreferences.getInt("archivedChatsDialogType", plusDialogType);
        int i3 = sharedPreferences.getInt("archivedChatsDefaultTab", -1);
        plusArchivedChatsDefaultTab = i3;
        if (i3 == -1) {
            i3 = sharedPreferences.getInt("archivedChatsSelectedTab", plusSelectedTab);
        }
        plusArchivedChatsSelectedTab = i3;
        plusHideAllTab = sharedPreferences.getBoolean("hideAllTab", false);
        plusHideAllTabDirectShare = sharedPreferences.getBoolean("hideAllTabDS", false);
        plusHideUsersTab = sharedPreferences.getBoolean("hideUsers", false);
        plusHideUsersTabDirectShare = sharedPreferences.getBoolean("hideUsersDS", false);
        plusHideGroupsTab = sharedPreferences.getBoolean("hideGroups", false);
        plusHideGroupsTabDirectShare = sharedPreferences.getBoolean("hideGroupsDS", false);
        plusHideSuperGroupsTab = sharedPreferences.getBoolean("hideSGroups", false);
        plusHideSuperGroupsTabDirectShare = sharedPreferences.getBoolean("hideSGroupsDS", false);
        plusHideChannelsTab = sharedPreferences.getBoolean("hideChannels", false);
        plusHideChannelsTabDirectShare = sharedPreferences.getBoolean("hideChannelsDS", false);
        plusHideBotsTab = sharedPreferences.getBoolean("hideBots", false);
        plusHideBotsTabDirectShare = sharedPreferences.getBoolean("hideBotsDS", false);
        plusHideFavsTab = sharedPreferences.getBoolean("hideFavs", false);
        plusHideFavsTabDirectShare = sharedPreferences.getBoolean("hideFavsDS", false);
        plusHideAdminTab = sharedPreferences.getBoolean("hideAdmin", false);
        plusHideAdminTabDirectShare = sharedPreferences.getBoolean("hideAdminDS", false);
        plusHideUnreadTab = sharedPreferences.getBoolean("hideUnread", true);
        plusHideUnreadTabDirectShare = sharedPreferences.getBoolean("hideUnreadDS", true);
        plusHideUnmutedTab = sharedPreferences.getBoolean("hideUnmuted", true);
        plusShowAllInAdminTab = sharedPreferences.getBoolean("showAllInAdminTab", true);
        plusTabTitlesMode = sharedPreferences2.contains("chatsTabTitlesMode") ? chatsTabTitlesMode : sharedPreferences.getBoolean("tabTitlesMode", false);
        plusTabsTextSize = sharedPreferences2.contains("chatsTabsTextSize") ? chatsTabsTextSize : sharedPreferences.getInt("tabsTextSize", 14);
        plusTabsShouldExpand = sharedPreferences.getBoolean("tabsShouldExpand", true);
        plusDisableTabsAnimation = sharedPreferences.getBoolean("disableTabsAnimation", true);
        plusDisableTabsScrolling = sharedPreferences.getBoolean("disableTabsScrolling", false);
        plusInfiniteTabsSwipe = sharedPreferences.getBoolean("infiniteTabsSwipe", false);
        plusDoNotChangeHeaderTitle = sharedPreferences.getBoolean("doNotChangeHeaderTitle", false);
        plusLimitTabsCounters = sharedPreferences.getBoolean("limitTabsCounters", true);
        plusHideMobile = sharedPreferences.getBoolean("hideMobile", false);
        plusShowUsername = sharedPreferences.getBoolean("showUsername", false);
        plusMoveVersionToSettings = sharedPreferences.getBoolean("moveVersionToSettings", false);
        plusShowUserBio = sharedPreferences.getBoolean("showUserBio", true);
        plusChatShowCallButton = sharedPreferences.getBoolean("showCallButton", false);
        plusChatSetCustomDateAndTime = sharedPreferences.getBoolean("setCustomDateAndTime", false);
        plusDirectShareToMenu = sharedPreferences.getBoolean("directShareToMenu", false);
        plusHideMsgDetailsOption = sharedPreferences.getBoolean("hideMsgDetailsOption", false);
        plusHideSaveToCloudOption = sharedPreferences.getBoolean("hideSaveToCloudOption", false);
        plusHideForwardNoQuoteOption = sharedPreferences.getBoolean("hideForwardNoQuoteOption", false);
        plusHideCopySelectionOption = sharedPreferences.getBoolean("hideCopySelectionOption", false);
        plusHideCopyLinkOption = sharedPreferences.getBoolean("hideCopyLinkOption", false);
        plusDisableShortNumberFormat = sharedPreferences.getBoolean("disableShortNumberFormat", true);
        plusShowSortingInSubtitle = sharedPreferences.getBoolean("showSortingInSubtitle", true);
        plusShowSortingInSubtitleIfNotDefault = sharedPreferences.getBoolean("showSortingInSubtitleIfNotDefault", true);
        plusStartRoundVideoUsingMainCamera = sharedPreferences.getBoolean("startRoundVideoUsingMainCamera", false);
        plusChangePlayerSpeed = sharedPreferences.getBoolean("changePlayerSpeed", false);
        plusChangePlayerSpeedOnly3Steps = sharedPreferences.getBoolean("changePlayerSpeedOnly3Steps", false);
        plusDisableRestriction = sharedPreferences.getBoolean("disableRestriction", BuildVars.BETA || BuildVars.BETA_HOCKEY || !PlusUtils.verifyInstallerId());
        plusShowDownloadProgress = sharedPreferences.getBoolean("showDownloadProgress", true);
        plusMakeTitleScrollable = sharedPreferences.getBoolean("makeTitleScrollable", false);
        plusShowRecentActionsInChat = sharedPreferences.getBoolean("showRecentActionsInChat", true);
        plusHideBottomLayoutInChannels = sharedPreferences.getBoolean("hideBottomLayoutInChannels", false);
        plusDoNotHideSearchBottom = sharedPreferences.getBoolean("doNotHideSearchBottom", false);
        plusNightModeCheck = sharedPreferences.getBoolean("nightModeCheck", !usePlusTheme && getCurrentTheme().isDark());
        plusDrawerHideNewGroup = sharedPreferences.getBoolean("drawerHideNewGroup", false);
        plusDrawerHideNewSecretChat = sharedPreferences.getBoolean("drawerHideNewSecretChat", false);
        boolean z = sharedPreferences.getBoolean("drawerHideNewChannel", false);
        plusDrawerHideNewChannel = z;
        plusDrawerHideNewDivider = sharedPreferences.getBoolean("drawerHideNewDivider", plusDrawerHideNewGroup && plusDrawerHideNewSecretChat && z);
        plusDrawerHideContacts = sharedPreferences.getBoolean("drawerHideContacts", false);
        plusDrawerHideFolders = sharedPreferences.getBoolean("drawerHideFolders", false);
        plusDrawerHidePeopleNearby = sharedPreferences.getBoolean("drawerHidePeopleNearby", false);
        plusDrawerHideSavedMessages = sharedPreferences.getBoolean("drawerHideSavedMessages", false);
        plusDrawerHideCalls = sharedPreferences.getBoolean("drawerHideCalls", false);
        plusDrawerHideArchivedChats = sharedPreferences.getBoolean("drawerHideArchivedChats", !plusHideAllTab);
        sharedPreferences.getBoolean("drawerHidePlusSettings", false);
        plusDrawerHideCategories = sharedPreferences.getBoolean("drawerHideCategories", false);
        plusDrawerHideDownloadThemes = sharedPreferences.getBoolean("drawerHideDownloadThemes", false);
        plusDrawerHideTheming = sharedPreferences.getBoolean("drawerHideTheming", false);
        plusDrawerHideChannel = sharedPreferences.getBoolean("drawerHideChannel", true);
        plusDrawerHideSupportGroup = sharedPreferences.getBoolean("drawerHideSupportGroup", false);
        plusDrawerHideOffTopicGroup = sharedPreferences.getBoolean("drawerHideOffTopicGroup", true);
        plusDrawerHideChatsCounter = sharedPreferences.getBoolean("drawerHideChatsCounter", false);
        sharedPreferences.getBoolean("drawerHideNightMode", false);
        plusCategoriesHideTabs = sharedPreferences.getBoolean("categoriesHideTabs", true);
        plusShowCategoriesIcon = sharedPreferences.getBoolean("showCategoriesIcon", true);
        plusShowAddCategoryOption = sharedPreferences.getBoolean("showAddCategoryOption", true);
        plusLoadLastCategoryOnStart = sharedPreferences.getBoolean("loadLastCategoryOnStart", false);
        plusShowSelectChatsOption = sharedPreferences.getBoolean("showSelectChatsOption", false);
        sharedPreferences.getBoolean("groupMyMessages", false);
        plusDisableArchivingVibration = sharedPreferences.getBoolean("disableArchivingVibration", false);
        plusIncreasePinnedDialogsLimit = sharedPreferences.getBoolean("increasePinnedDialogsLimit", true);
        plusOpenMenuBySwipingToRight = sharedPreferences.getBoolean("openMenuBySwipingToRight", false);
        plusArchiveChatBySwipingToLeft = sharedPreferences.getBoolean("archiveChatBySwipingToLeft", false);
        PlusSettings.loadPlusSettings();
    }

    public static void setThemeWallpaper(ThemeInfo themeInfo, Bitmap bitmap, File path) {
        currentColors.delete(key_chat_wallpaper);
        currentColors.delete(key_chat_wallpaper_gradient_to1);
        currentColors.delete(key_chat_wallpaper_gradient_to2);
        currentColors.delete(key_chat_wallpaper_gradient_to3);
        currentColors.delete(key_chat_wallpaper_gradient_rotation);
        themedWallpaperLink = null;
        themeInfo.setOverrideWallpaper(null);
        if (bitmap != null) {
            themedWallpaper = new BitmapDrawable(bitmap);
            saveCurrentTheme(themeInfo, false, false, false);
            calcBackgroundColor(themedWallpaper, 0);
            applyChatServiceMessageColor();
            applyChatMessageSelectedBackgroundColor();
            NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didSetNewWallpapper, new Object[0]);
            return;
        }
        themedWallpaper = null;
        wallpaper = null;
        saveCurrentTheme(themeInfo, false, false, false);
        reloadWallpaper(true);
    }

    public static void setDrawableColor(Drawable drawable, int color) {
        if (drawable == null) {
            return;
        }
        if (drawable instanceof StatusDrawable) {
            ((StatusDrawable) drawable).setColor(color);
            return;
        }
        if (drawable instanceof MsgClockDrawable) {
            ((MsgClockDrawable) drawable).setColor(color);
            return;
        }
        if (drawable instanceof ShapeDrawable) {
            ((ShapeDrawable) drawable).getPaint().setColor(color);
        } else if (drawable instanceof ScamDrawable) {
            ((ScamDrawable) drawable).setColor(color);
        } else {
            drawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
        }
    }

    public static void setDrawableColorByKey(Drawable drawable, int key) {
        setDrawableColor(drawable, getColor(key));
    }

    public static void setEmojiDrawableColor(Drawable drawable, int color, boolean selected) {
        Drawable stateDrawable;
        if (drawable instanceof StateListDrawable) {
            try {
                if (selected) {
                    stateDrawable = getStateDrawable(drawable, 0);
                } else {
                    stateDrawable = getStateDrawable(drawable, 1);
                }
                if (stateDrawable instanceof ShapeDrawable) {
                    ((ShapeDrawable) stateDrawable).getPaint().setColor(color);
                } else {
                    stateDrawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
                }
            } catch (Throwable unused) {
            }
        }
    }

    @SuppressLint({"DiscouragedPrivateApi"})
    @TargetApi(21)
    public static void setRippleDrawableForceSoftware(RippleDrawable drawable) {
        if (drawable == null) {
            return;
        }
        try {
            RippleDrawable.class.getDeclaredMethod("setForceSoftware", Boolean.TYPE).invoke(drawable, Boolean.TRUE);
        } catch (Throwable unused) {
        }
    }

    public static void setSelectorDrawableColor(Drawable drawable, int color, boolean selected) {
        Drawable stateDrawable;
        if (drawable instanceof StateListDrawable) {
            try {
                if (selected) {
                    Drawable stateDrawable2 = getStateDrawable(drawable, 0);
                    if (stateDrawable2 instanceof ShapeDrawable) {
                        ((ShapeDrawable) stateDrawable2).getPaint().setColor(color);
                    } else {
                        stateDrawable2.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
                    }
                    stateDrawable = getStateDrawable(drawable, 1);
                } else {
                    stateDrawable = getStateDrawable(drawable, 2);
                }
                if (stateDrawable instanceof ShapeDrawable) {
                    ((ShapeDrawable) stateDrawable).getPaint().setColor(color);
                    return;
                } else {
                    stateDrawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
                    return;
                }
            } catch (Throwable unused) {
                return;
            }
        }
        if (Build.VERSION.SDK_INT < 21 || !(drawable instanceof RippleDrawable)) {
            return;
        }
        RippleDrawable rippleDrawable = (RippleDrawable) drawable;
        if (selected) {
            rippleDrawable.setColor(new ColorStateList(new int[][]{StateSet.WILD_CARD}, new int[]{color}));
            return;
        }
        if (rippleDrawable.getNumberOfLayers() > 0) {
            Drawable drawable2 = rippleDrawable.getDrawable(0);
            if (drawable2 instanceof ShapeDrawable) {
                ((ShapeDrawable) drawable2).getPaint().setColor(color);
            } else {
                drawable2.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY));
            }
        }
    }

    public static boolean isThemeWallpaperPublic() {
        return !TextUtils.isEmpty(themedWallpaperLink);
    }

    public static boolean hasWallpaperFromTheme() {
        ThemeInfo themeInfo = currentTheme;
        if (themeInfo.firstAccentIsDefault && themeInfo.currentAccentId == DEFALT_THEME_ACCENT_ID) {
            return false;
        }
        return currentColors.indexOfKey(key_chat_wallpaper) >= 0 || themedWallpaperFileOffset > 0 || !TextUtils.isEmpty(themedWallpaperLink);
    }

    public static boolean isCustomTheme() {
        return isCustomTheme;
    }

    public static void reloadWallpaper(boolean async) {
        BackgroundGradientDrawable.Disposable disposable = backgroundGradientDisposable;
        if (disposable != null) {
            disposable.dispose();
            backgroundGradientDisposable = null;
        }
        MotionBackgroundDrawable motionBackgroundDrawable = wallpaper;
        if (motionBackgroundDrawable instanceof MotionBackgroundDrawable) {
            previousPhase = motionBackgroundDrawable.getPhase();
        } else {
            previousPhase = 0;
        }
        wallpaper = null;
        themedWallpaper = null;
        loadWallpaper(async);
    }

    public static void calcBackgroundColor(Drawable drawable, int save) {
        if (save != 2) {
            int[] calcDrawableColor = AndroidUtilities.calcDrawableColor(drawable);
            int i = calcDrawableColor[0];
            serviceMessageColorBackup = i;
            serviceMessageColor = i;
            int i2 = calcDrawableColor[1];
            serviceSelectedMessageColorBackup = i2;
            serviceSelectedMessageColor = i2;
        }
    }

    public static int getServiceMessageColor() {
        int indexOfKey = currentColors.indexOfKey(key_chat_serviceBackground);
        if (indexOfKey >= 0) {
            return currentColors.valueAt(indexOfKey);
        }
        return serviceMessageColor;
    }

    public static void loadWallpaper(boolean r10) {
        throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.ActionBar.Theme.loadWallpaper(boolean):void");
    }

    public static void lambda$loadWallpaper$12(OverrideWallpaperInfo overrideWallpaperInfo, File file, int i, boolean z, TLRPC.Document document, boolean z2) {
        final Drawable loadWallpaperInternal = loadWallpaperInternal(overrideWallpaperInfo, file, i, z, document, z2);
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                Theme.lambda$loadWallpaper$11(loadWallpaperInternal);
            }
        });
    }

    public static void lambda$loadWallpaper$11(Drawable drawable) {
        wallpaperLoadTask = null;
        createCommonChatResources();
        if (!disallowChangeServiceMessageColor) {
            applyChatServiceMessageColor(null, null, drawable);
            applyChatMessageSelectedBackgroundColor(null, drawable);
        }
        NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didSetNewWallpapper, new Object[0]);
    }

    public static Drawable loadWallpaperInternal(OverrideWallpaperInfo overrideWallpaper, File wallpaperFile, int intensity, boolean wallpaperMotion, TLRPC.Document finalWallpaperDocument, boolean defaultTheme2) {
        BackgroundDrawableSettings createBackgroundDrawable = createBackgroundDrawable(currentTheme, overrideWallpaper, currentColors, wallpaperFile, themedWallpaperLink, themedWallpaperFileOffset, intensity, previousPhase, defaultTheme2, hasPreviousTheme, isApplyingAccent, wallpaperMotion, finalWallpaperDocument, false);
        Boolean bool = createBackgroundDrawable.isWallpaperMotion;
        isWallpaperMotion = bool != null ? bool.booleanValue() : isWallpaperMotion;
        Boolean bool2 = createBackgroundDrawable.isPatternWallpaper;
        isPatternWallpaper = bool2 != null ? bool2.booleanValue() : isPatternWallpaper;
        Boolean bool3 = createBackgroundDrawable.isCustomTheme;
        isCustomTheme = bool3 != null ? bool3.booleanValue() : isCustomTheme;
        Drawable drawable = createBackgroundDrawable.wallpaper;
        wallpaper = drawable != null ? drawable : wallpaper;
        calcBackgroundColor(drawable, 1);
        applyChatServiceMessageColor();
        return drawable;
    }

    public static BackgroundDrawableSettings createBackgroundDrawable(ThemeInfo currentTheme2, SparseIntArray currentColors2, String wallpaperLink, int prevoiusPhase, boolean local) {
        float f;
        float f2;
        boolean z = currentTheme2.firstAccentIsDefault && currentTheme2.currentAccentId == DEFALT_THEME_ACCENT_ID;
        ThemeAccent accent = currentTheme2.getAccent(false);
        File pathToWallpaper = accent != null ? accent.getPathToWallpaper() : null;
        boolean z2 = accent != null && accent.patternMotion;
        OverrideWallpaperInfo overrideWallpaperInfo = currentTheme2.overrideWallpaper;
        if (overrideWallpaperInfo != null) {
            f2 = overrideWallpaperInfo.intensity;
        } else if (accent != null) {
            f2 = accent.patternIntensity;
        } else {
            f = currentTheme2.patternIntensity;
            return createBackgroundDrawable(currentTheme2, overrideWallpaperInfo, currentColors2, pathToWallpaper, wallpaperLink, currentColorsNoAccent.get(key_wallpaperFileOffset, -1), (int) f, prevoiusPhase, z, false, false, z2, null, local);
        }
        f = f2 * 100.0f;
        return createBackgroundDrawable(currentTheme2, overrideWallpaperInfo, currentColors2, pathToWallpaper, wallpaperLink, currentColorsNoAccent.get(key_wallpaperFileOffset, -1), (int) f, prevoiusPhase, z, false, false, z2, null, local);
    }

    public static org.telegram.ui.ActionBar.Theme.BackgroundDrawableSettings createBackgroundDrawable(org.telegram.ui.ActionBar.Theme.ThemeInfo r25, org.telegram.ui.ActionBar.Theme.OverrideWallpaperInfo r26, android.util.SparseIntArray r27, java.io.File r28, java.lang.String r29, int r30, int r31, int r32, boolean r33, boolean r34, boolean r35, boolean r36, org.telegram.tgnet.TLRPC.Document r37, boolean r38) {
        throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.ActionBar.Theme.createBackgroundDrawable(org.telegram.ui.ActionBar.Theme$ThemeInfo, org.telegram.ui.ActionBar.Theme$OverrideWallpaperInfo, android.util.SparseIntArray, java.io.File, java.lang.String, int, int, int, boolean, boolean, boolean, boolean, org.telegram.tgnet.TLRPC$Document, boolean):org.telegram.ui.ActionBar.Theme$BackgroundDrawableSettings");
    }

    public static Drawable createDefaultWallpaper() {
        return createDefaultWallpaper(0, 0);
    }

    public static Drawable createDefaultWallpaper(int w, int h) {
        MotionBackgroundDrawable motionBackgroundDrawable = new MotionBackgroundDrawable(-2368069, -9722489, -2762611, -7817084, w != 0);
        if (w <= 0 || h <= 0) {
            Point point = AndroidUtilities.displaySize;
            w = Math.min(point.x, point.y);
            Point point2 = AndroidUtilities.displaySize;
            h = Math.max(point2.x, point2.y);
        }
        motionBackgroundDrawable.setPatternBitmap(34, SvgHelper.getBitmap(R.raw.default_pattern, w, h, -16777216));
        motionBackgroundDrawable.setPatternColorFilter(motionBackgroundDrawable.getPatternColor());
        return motionBackgroundDrawable;
    }

    public static Bitmap loadScreenSizedBitmap(FileInputStream stream, int offset) {
        float min;
        try {
            try {
                BitmapFactory.Options options = new BitmapFactory.Options();
                options.inSampleSize = 1;
                options.inJustDecodeBounds = true;
                long j = offset;
                stream.getChannel().position(j);
                BitmapFactory.decodeStream(stream, null, options);
                float f = options.outWidth;
                float f2 = options.outHeight;
                Point point = AndroidUtilities.displaySize;
                int min2 = Math.min(point.x, point.y);
                Point point2 = AndroidUtilities.displaySize;
                int max = Math.max(point2.x, point2.y);
                if (min2 >= max && f > f2) {
                    min = Math.max(f / min2, f2 / max);
                } else {
                    min = Math.min(f / min2, f2 / max);
                }
                if (min < 1.2f) {
                    min = 1.0f;
                }
                options.inJustDecodeBounds = false;
                if (min > 1.0f && (f > min2 || f2 > max)) {
                    int i = 1;
                    do {
                        i *= 2;
                    } while (i * 2 < min);
                    options.inSampleSize = i;
                } else {
                    options.inSampleSize = (int) min;
                }
                stream.getChannel().position(j);
                Bitmap decodeStream = BitmapFactory.decodeStream(stream, null, options);
                if (decodeStream.getWidth() < min2 || decodeStream.getHeight() < max) {
                    float max2 = Math.max(min2 / decodeStream.getWidth(), max / decodeStream.getHeight());
                    if (max2 >= 1.02f) {
                        Bitmap createScaledBitmap = Bitmap.createScaledBitmap(decodeStream, (int) (decodeStream.getWidth() * max2), (int) (decodeStream.getHeight() * max2), true);
                        decodeStream.recycle();
                        try {
                            stream.close();
                        } catch (Exception unused) {
                        }
                        return createScaledBitmap;
                    }
                }
                try {
                    stream.close();
                } catch (Exception unused2) {
                }
                return decodeStream;
            } catch (Exception e) {
                FileLog.e(e);
                if (stream != null) {
                    try {
                        stream.close();
                    } catch (Exception unused3) {
                    }
                }
                return null;
            }
        } catch (Throwable th) {
            if (stream != null) {
                try {
                    stream.close();
                } catch (Exception unused4) {
                }
            }
            throw th;
        }
    }

    public static android.graphics.drawable.Drawable getThemedWallpaper(final boolean r10, final android.view.View r11) {
        throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.ActionBar.Theme.getThemedWallpaper(boolean, android.view.View):android.graphics.drawable.Drawable");
    }

    public static String getSelectedBackgroundSlug() {
        OverrideWallpaperInfo overrideWallpaperInfo = currentTheme.overrideWallpaper;
        if (overrideWallpaperInfo != null) {
            return overrideWallpaperInfo.slug;
        }
        return hasWallpaperFromTheme() ? "t" : "d";
    }

    public static Drawable getCachedWallpaper() {
        Drawable cachedWallpaperNonBlocking = getCachedWallpaperNonBlocking();
        if (cachedWallpaperNonBlocking != null || wallpaperLoadTask == null) {
            return cachedWallpaperNonBlocking;
        }
        final CountDownLatch countDownLatch = new CountDownLatch(1);
        Utilities.themeQueue.postRunnable(new Runnable() {
            @Override
            public final void run() {
                countDownLatch.countDown();
            }
        });
        try {
            countDownLatch.await();
        } catch (Exception e) {
            FileLog.e(e);
        }
        return getCachedWallpaperNonBlocking();
    }

    public static Drawable getCachedWallpaperNonBlocking() {
        Drawable drawable = themedWallpaper;
        return drawable != null ? drawable : wallpaper;
    }

    public static boolean isWallpaperMotion() {
        return isWallpaperMotion;
    }

    public static boolean isPatternWallpaper() {
        String selectedBackgroundSlug = getSelectedBackgroundSlug();
        return isPatternWallpaper || "CJz3BZ6YGEYBAAAABboWp6SAv04".equals(selectedBackgroundSlug) || "qeZWES8rGVIEAAAARfWlK1lnfiI".equals(selectedBackgroundSlug);
    }

    public static BackgroundGradientDrawable getCurrentGradientWallpaper() {
        int i;
        int i2;
        OverrideWallpaperInfo overrideWallpaperInfo = currentTheme.overrideWallpaper;
        if (overrideWallpaperInfo == null || (i = overrideWallpaperInfo.color) == 0 || (i2 = overrideWallpaperInfo.gradientColor1) == 0) {
            return null;
        }
        return new BackgroundGradientDrawable(BackgroundGradientDrawable.getGradientOrientation(overrideWallpaperInfo.rotation), new int[]{i, i2});
    }

    public static AudioVisualizerDrawable getCurrentAudiVisualizerDrawable() {
        if (chat_msgAudioVisualizeDrawable == null) {
            chat_msgAudioVisualizeDrawable = new AudioVisualizerDrawable();
        }
        return chat_msgAudioVisualizeDrawable;
    }

    public static void unrefAudioVisualizeDrawable(final MessageObject messageObject) {
        AudioVisualizerDrawable audioVisualizerDrawable = chat_msgAudioVisualizeDrawable;
        if (audioVisualizerDrawable == null) {
            return;
        }
        if (audioVisualizerDrawable.getParentView() == null || messageObject == null) {
            chat_msgAudioVisualizeDrawable.setParentView((View) null);
            return;
        }
        if (animatedOutVisualizerDrawables == null) {
            animatedOutVisualizerDrawables = new HashMap<>();
        }
        animatedOutVisualizerDrawables.put(messageObject, chat_msgAudioVisualizeDrawable);
        chat_msgAudioVisualizeDrawable.setWaveform(false, true, (float[]) null);
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                Theme.lambda$unrefAudioVisualizeDrawable$13(messageObject);
            }
        }, 200L);
        chat_msgAudioVisualizeDrawable = null;
    }

    public static void lambda$unrefAudioVisualizeDrawable$13(MessageObject messageObject) {
        AudioVisualizerDrawable remove = animatedOutVisualizerDrawables.remove(messageObject);
        if (remove != null) {
            remove.setParentView((View) null);
        }
    }

    public static AudioVisualizerDrawable getAnimatedOutAudioVisualizerDrawable(MessageObject messageObject) {
        HashMap<MessageObject, AudioVisualizerDrawable> hashMap = animatedOutVisualizerDrawables;
        if (hashMap == null || messageObject == null) {
            return null;
        }
        return hashMap.get(messageObject);
    }

    public static StatusDrawable getChatStatusDrawable(int type) {
        if (type < 0 || type > 5) {
            return null;
        }
        StatusDrawable[] statusDrawableArr = chat_status_drawables;
        StatusDrawable statusDrawable = statusDrawableArr[type];
        if (statusDrawable != null) {
            return statusDrawable;
        }
        if (type == 0) {
            statusDrawableArr[0] = new TypingDotsDrawable(true);
        } else if (type == 1) {
            statusDrawableArr[1] = new RecordStatusDrawable(true);
        } else if (type == 2) {
            statusDrawableArr[2] = new SendingFileDrawable(true);
        } else if (type == 3) {
            statusDrawableArr[3] = new PlayingGameDrawable(true, (ResourcesProvider) null);
        } else if (type == 4) {
            statusDrawableArr[4] = new RoundStatusDrawable(true);
        } else if (type == 5) {
            statusDrawableArr[5] = new ChoosingStickerStatusDrawable(true);
        }
        StatusDrawable statusDrawable2 = chat_status_drawables[type];
        statusDrawable2.start();
        statusDrawable2.setColor(getColor(key_chats_actionMessage));
        return statusDrawable2;
    }

    public static FragmentContextViewWavesDrawable getFragmentContextViewWavesDrawable() {
        if (fragmentContextViewWavesDrawable == null) {
            fragmentContextViewWavesDrawable = new FragmentContextViewWavesDrawable();
        }
        return fragmentContextViewWavesDrawable;
    }

    public static RoundVideoProgressShadow getRadialSeekbarShadowDrawable() {
        if (roundPlayDrawable == null) {
            roundPlayDrawable = new RoundVideoProgressShadow();
        }
        return roundPlayDrawable;
    }

    public static SparseIntArray getFallbackKeys() {
        return fallbackKeys;
    }

    public static int getFallbackKey(int key) {
        return fallbackKeys.get(key);
    }

    public static Map<String, Drawable> getThemeDrawablesMap() {
        return defaultChatDrawables;
    }

    public static Drawable getThemeDrawable(String drawableKey) {
        return defaultChatDrawables.get(drawableKey);
    }

    public static int getThemeDrawableColorKey(String drawableKey) {
        return defaultChatDrawableColorKeys.get(drawableKey).intValue();
    }

    public static Map<String, Paint> getThemePaintsMap() {
        return defaultChatPaints;
    }

    public static Paint getThemePaint(String paintKey) {
        if (Objects.equals(paintKey, "paintDivider")) {
            return dividerPaint;
        }
        return defaultChatPaints.get(paintKey);
    }

    public static int getThemePaintColorKey(String paintKey) {
        return defaultChatPaintColors.get(paintKey).intValue();
    }

    public static void addChatDrawable(String key, Drawable drawable, int colorKey) {
        defaultChatDrawables.put(key, drawable);
        defaultChatDrawableColorKeys.put(key, Integer.valueOf(colorKey));
    }

    public static void addChatPaint(String key, Paint paint, int colorKey) {
        defaultChatPaints.put(key, paint);
        defaultChatPaintColors.put(key, Integer.valueOf(colorKey));
    }

    public static boolean isCurrentThemeDay() {
        return !getActiveTheme().isDark();
    }

    public static boolean isHome(ThemeAccent accent) {
        ThemeInfo themeInfo = accent.parentTheme;
        if (themeInfo == null) {
            return false;
        }
        if (themeInfo.getKey().equals("Blue") && accent.id == 99) {
            return true;
        }
        if (accent.parentTheme.getKey().equals("Day") && accent.id == 9) {
            return true;
        }
        return (accent.parentTheme.getKey().equals("Night") || accent.parentTheme.getKey().equals("Dark Blue")) && accent.id == 0;
    }

    public static void turnOffAutoNight(final BaseFragment fragment) {
        String string;
        if (selectedAutoNightType != 0) {
            if (fragment != null) {
                try {
                    BulletinFactory of = BulletinFactory.of(fragment);
                    int i = R.raw.auto_night_off;
                    if (selectedAutoNightType == 3) {
                        string = LocaleController.getString("AutoNightSystemModeOff", R.string.AutoNightSystemModeOff);
                    } else {
                        string = LocaleController.getString("AutoNightModeOff", R.string.AutoNightModeOff);
                    }
                    of.createSimpleBulletin(i, string, LocaleController.getString("Settings", R.string.Settings), 5000, new Runnable() {
                        @Override
                        public final void run() {
                            Theme.lambda$turnOffAutoNight$14(fragment);
                        }
                    }).show();
                } catch (Exception e) {
                    FileLog.e(e);
                }
            }
            selectedAutoNightType = 0;
            saveAutoNightThemeConfig();
            cancelAutoNightThemeCallbacks();
        }
    }

    public static void lambda$turnOffAutoNight$14(BaseFragment baseFragment) {
        baseFragment.presentFragment(new ThemeActivity(1));
    }

    public static void turnOffAutoNight(FrameLayout container, Runnable openSettings) {
        String string;
        if (selectedAutoNightType != 0) {
            if (container != null && openSettings != null) {
                try {
                    BulletinFactory of = BulletinFactory.of(container, (ResourcesProvider) null);
                    int i = R.raw.auto_night_off;
                    if (selectedAutoNightType == 3) {
                        string = LocaleController.getString("AutoNightSystemModeOff", R.string.AutoNightSystemModeOff);
                    } else {
                        string = LocaleController.getString("AutoNightModeOff", R.string.AutoNightModeOff);
                    }
                    of.createSimpleBulletin(i, string, LocaleController.getString("Settings", R.string.Settings), 5000, openSettings).show();
                } catch (Exception e) {
                    FileLog.e(e);
                }
            }
            selectedAutoNightType = 0;
            saveAutoNightThemeConfig();
            cancelAutoNightThemeCallbacks();
        }
    }

    public static void setPlusWallpaper(final File wallpaperFile) {
        setUsePlusThemeKey(true);
        DispatchQueue dispatchQueue = Utilities.searchQueue;
        Runnable runnable = new Runnable() {
            @Override
            public final void run() {
                Theme.lambda$setPlusWallpaper$16(wallpaperFile);
            }
        };
        wallpaperLoadTask = runnable;
        dispatchQueue.postRunnable(runnable);
    }

    public static void lambda$setPlusWallpaper$16(File file) {
        Integer valueOf = Integer.valueOf(chatSolidBGColor);
        if (file != null && file.exists()) {
            try {
                Bitmap loadScreenSizedBitmap = loadScreenSizedBitmap(new FileInputStream(file), 0);
                if (loadScreenSizedBitmap != null) {
                    wallpaper = new BitmapDrawable(loadScreenSizedBitmap);
                } else {
                    wallpaper = Drawable.createFromPath(file.getAbsolutePath());
                }
                isCustomTheme = true;
            } catch (Throwable th) {
                FileLog.e(th);
            }
        } else if (valueOf != null) {
            int i = chatGradientBG;
            if (i == 0) {
                wallpaper = new ColorDrawable(valueOf.intValue());
            } else {
                BackgroundGradientDrawable backgroundGradientDrawable = new BackgroundGradientDrawable(BackgroundGradientDrawable.getGradientOrientation(i), new int[]{chatSolidBGColor, chatGradientBGColor});
                backgroundGradientDisposable = backgroundGradientDrawable.startDithering(BackgroundGradientDrawable.Sizes.ofDeviceScreen(), new BackgroundGradientDrawable.ListenerAdapter() {
                    public void onSizeReady(int width, int height) {
                        Point point = AndroidUtilities.displaySize;
                        if ((point.x <= point.y) == (width <= height)) {
                            NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didSetNewWallpapper, new Object[0]);
                        }
                    }
                }, 100L);
                wallpaper = backgroundGradientDrawable;
            }
            isCustomTheme = true;
        }
        Drawable drawable = wallpaper;
        if (drawable == null) {
            if (drawable == null) {
                wallpaper = createDefaultWallpaper();
                isCustomTheme = false;
            }
            if (wallpaper == null) {
                wallpaper = new ColorDrawable(-2693905);
            }
        }
        calcBackgroundColor(wallpaper, 1);
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                Theme.lambda$setPlusWallpaper$15();
            }
        });
    }

    public static void lambda$setPlusWallpaper$15() {
        applyChatServiceMessageColor();
        NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didSetNewWallpapper, new Object[0]);
    }
}