正在查看: Plus 12 v10.13.1.1 应用的 ThemeActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Plus 12 v10.13.1.1 应用的 ThemeActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package org.telegram.ui;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextPaint;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.TimePicker;
import androidx.annotation.Keep;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicReference;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.Utilities;
import org.telegram.messenger.time.SunDate;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.ActionBarMenu;
import org.telegram.ui.ActionBar.ActionBarMenuItem;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.EmojiThemes;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.ActionBar.ThemeDescription;
import org.telegram.ui.Cells.AppIconsSelectorCell;
import org.telegram.ui.Cells.BrightnessControlCell;
import org.telegram.ui.Cells.ChatListCell;
import org.telegram.ui.Cells.ChatMessageCell;
import org.telegram.ui.Cells.HeaderCell;
import org.telegram.ui.Cells.NotificationsCheckCell;
import org.telegram.ui.Cells.RadioButtonCell;
import org.telegram.ui.Cells.RadioColorCell;
import org.telegram.ui.Cells.ShadowSectionCell;
import org.telegram.ui.Cells.TextCell;
import org.telegram.ui.Cells.TextCheckCell;
import org.telegram.ui.Cells.TextInfoPrivacyCell;
import org.telegram.ui.Cells.TextSettingsCell;
import org.telegram.ui.Cells.ThemePreviewMessagesCell;
import org.telegram.ui.Cells.ThemeTypeCell;
import org.telegram.ui.Cells.ThemesHorizontalListCell;
import org.telegram.ui.Components.AlertsCreator;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.RLottieDrawable;
import org.telegram.ui.Components.RecyclerListView;
import org.telegram.ui.Components.SeekBarView;
import org.telegram.ui.Components.ShareAlert;
import org.telegram.ui.Components.SimpleThemeDescription;
import org.telegram.ui.Components.SwipeGestureSettingsView;
import org.telegram.ui.PeerColorActivity;
import org.telegram.ui.ThemeActivity;
public class ThemeActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
public int appIconHeaderRow;
public int appIconSelectorRow;
public int appIconShadowRow;
public int automaticBrightnessInfoRow;
public int automaticBrightnessRow;
public int automaticHeaderRow;
public int backgroundRow;
public int bluetoothScoRow;
public int bubbleRadiusHeaderRow;
public int bubbleRadiusInfoRow;
public int bubbleRadiusRow;
public int changeUserColor;
public int chatBlurRow;
public int chatListHeaderRow;
public int chatListInfoRow;
public int chatListRow;
public int contactsReimportRow;
public int contactsSortRow;
public int createNewThemeRow;
public int currentType;
public int customTabsRow;
public ArrayList<Theme.ThemeInfo> darkThemes = new ArrayList<>();
public ArrayList<Theme.ThemeInfo> defaultThemes = new ArrayList<>();
public int directShareRow;
public int distanceRow;
public int downloadThemesRow;
public int editThemeRow;
public int enableAnimationsRow;
public GpsLocationListener gpsLocationListener;
public boolean hasThemeAccents;
public boolean lastIsDarkTheme;
public int lastShadowRow;
public ListAdapter listAdapter;
public RecyclerListView listView;
public int liteModeInfoRow;
public int liteModeRow;
public int mediaSoundHeaderRow;
public int mediaSoundSectionRow;
public ActionBarMenuItem menuItem;
public GpsLocationListener networkLocationListener;
public int newThemeInfoRow;
public int nextMediaTapRow;
public int nightAutomaticRow;
public int nightDisabledRow;
public int nightScheduledRow;
public int nightSystemDefaultRow;
public int nightThemeRow;
public int nightTypeInfoRow;
public int otherHeaderRow;
public int otherSectionRow;
public int pauseOnMediaRow;
public int pauseOnRecordRow;
public int preferedHeaderRow;
public boolean previousByLocation;
public int previousUpdatedType;
public int raiseToListenRow;
public int raiseToSpeakRow;
public int rowCount;
public int saveToGalleryOption1Row;
public int saveToGalleryOption2Row;
public int saveToGallerySectionRow;
public int scheduleFromRow;
public int scheduleFromToInfoRow;
public int scheduleHeaderRow;
public int scheduleLocationInfoRow;
public int scheduleLocationRow;
public int scheduleToRow;
public int scheduleUpdateLocationRow;
public int selectThemeHeaderRow;
public int sendByEnterRow;
public int settings2Row;
public int settingsRow;
public Theme.ThemeAccent sharingAccent;
public AlertDialog sharingProgressDialog;
public Theme.ThemeInfo sharingTheme;
public int stickersInfoRow;
public int stickersRow;
public int stickersSectionRow;
public RLottieDrawable sunDrawable;
public int swipeGestureHeaderRow;
public int swipeGestureInfoRow;
public int swipeGestureRow;
public int textSizeHeaderRow;
public int textSizeRow;
public int themeAccentListRow;
public int themeHeaderRow;
public int themeInfoRow;
public int themeListRow;
public int themeListRow2;
public int themePreviewRow;
public ThemesHorizontalListCell themesHorizontalListCell;
public boolean updateDistance;
public boolean updateRecordViaSco;
public boolean updatingLocation;
public int uploadThemesRow;
public class GpsLocationListener implements LocationListener {
@Override
public void onProviderDisabled(String provider) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
public GpsLocationListener() {
}
@Override
public void onLocationChanged(Location location) {
if (location == null) {
return;
}
ThemeActivity.this.stopLocationUpdate();
ThemeActivity.this.updateSunTime(location, false);
}
}
public class TextSizeCell extends FrameLayout {
public int endFontSize;
public int lastWidth;
public ThemePreviewMessagesCell messagesCell;
public SeekBarView sizeBar;
public int startFontSize;
public TextPaint textPaint;
public TextSizeCell(Context context) {
super(context);
this.startFontSize = 12;
this.endFontSize = 30;
setWillNotDraw(false);
TextPaint textPaint = new TextPaint(1);
this.textPaint = textPaint;
textPaint.setTextSize(AndroidUtilities.dp(16.0f));
SeekBarView seekBarView = new SeekBarView(context);
this.sizeBar = seekBarView;
seekBarView.setReportChanges(true);
this.sizeBar.setSeparatorsCount((this.endFontSize - this.startFontSize) + 1);
this.sizeBar.setDelegate(new SeekBarView.SeekBarViewDelegate(ThemeActivity.this) {
public void onSeekBarPressed(boolean pressed) {
}
public void onSeekBarDrag(boolean stop, float progress) {
ThemeActivity.this.setFontSize(Math.round(r4.startFontSize + ((TextSizeCell.this.endFontSize - TextSizeCell.this.startFontSize) * progress)));
}
public CharSequence getContentDescription() {
return String.valueOf(Math.round(TextSizeCell.this.startFontSize + ((TextSizeCell.this.endFontSize - TextSizeCell.this.startFontSize) * TextSizeCell.this.sizeBar.getProgress())));
}
public int getStepsCount() {
return TextSizeCell.this.endFontSize - TextSizeCell.this.startFontSize;
}
});
this.sizeBar.setImportantForAccessibility(2);
addView((View) this.sizeBar, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, 38.0f, 51, 5.0f, 5.0f, 39.0f, 0.0f));
ThemePreviewMessagesCell themePreviewMessagesCell = new ThemePreviewMessagesCell(context, ((BaseFragment) ThemeActivity.this).parentLayout, 0);
this.messagesCell = themePreviewMessagesCell;
if (Build.VERSION.SDK_INT >= 19) {
themePreviewMessagesCell.setImportantForAccessibility(4);
}
addView(this.messagesCell, LayoutHelper.createFrame(-1, -2.0f, 51, 0.0f, 53.0f, 0.0f, 0.0f));
}
@Override
public void onDraw(Canvas canvas) {
this.textPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteValueText));
canvas.drawText("" + SharedConfig.fontSize, getMeasuredWidth() - AndroidUtilities.dp(39.0f), AndroidUtilities.dp(28.0f), this.textPaint);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int size = View.MeasureSpec.getSize(widthMeasureSpec);
if (this.lastWidth != size) {
SeekBarView seekBarView = this.sizeBar;
int i = SharedConfig.fontSize;
int i2 = this.startFontSize;
seekBarView.setProgress((i - i2) / (this.endFontSize - i2));
this.lastWidth = size;
}
}
@Override
public void invalidate() {
super.invalidate();
this.messagesCell.invalidate();
this.sizeBar.invalidate();
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
this.sizeBar.getSeekBarAccessibilityDelegate().onInitializeAccessibilityNodeInfoInternal(this, info);
}
@Override
public boolean performAccessibilityAction(int action, Bundle arguments) {
return super.performAccessibilityAction(action, arguments) || this.sizeBar.getSeekBarAccessibilityDelegate().performAccessibilityActionInternal(this, action, arguments);
}
}
public class BubbleRadiusCell extends FrameLayout {
public int endRadius;
public SeekBarView sizeBar;
public int startRadius;
public TextPaint textPaint;
public BubbleRadiusCell(Context context) {
super(context);
this.startRadius = 0;
this.endRadius = 17;
setWillNotDraw(false);
TextPaint textPaint = new TextPaint(1);
this.textPaint = textPaint;
textPaint.setTextSize(AndroidUtilities.dp(16.0f));
SeekBarView seekBarView = new SeekBarView(context);
this.sizeBar = seekBarView;
seekBarView.setReportChanges(true);
this.sizeBar.setSeparatorsCount((this.endRadius - this.startRadius) + 1);
this.sizeBar.setDelegate(new SeekBarView.SeekBarViewDelegate(ThemeActivity.this) {
public void onSeekBarPressed(boolean pressed) {
}
public void onSeekBarDrag(boolean stop, float progress) {
ThemeActivity.this.setBubbleRadius(Math.round(r4.startRadius + ((BubbleRadiusCell.this.endRadius - BubbleRadiusCell.this.startRadius) * progress)), false);
}
public CharSequence getContentDescription() {
return String.valueOf(Math.round(BubbleRadiusCell.this.startRadius + ((BubbleRadiusCell.this.endRadius - BubbleRadiusCell.this.startRadius) * BubbleRadiusCell.this.sizeBar.getProgress())));
}
public int getStepsCount() {
return BubbleRadiusCell.this.endRadius - BubbleRadiusCell.this.startRadius;
}
});
this.sizeBar.setImportantForAccessibility(2);
addView((View) this.sizeBar, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, 38.0f, 51, 5.0f, 5.0f, 39.0f, 0.0f));
}
@Override
public void onDraw(Canvas canvas) {
this.textPaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteValueText));
canvas.drawText("" + SharedConfig.bubbleRadius, getMeasuredWidth() - AndroidUtilities.dp(39.0f), AndroidUtilities.dp(28.0f), this.textPaint);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(widthMeasureSpec), 1073741824), heightMeasureSpec);
SeekBarView seekBarView = this.sizeBar;
int i = SharedConfig.bubbleRadius;
int i2 = this.startRadius;
seekBarView.setProgress((i - i2) / (this.endRadius - i2));
}
@Override
public void invalidate() {
super.invalidate();
this.sizeBar.invalidate();
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
this.sizeBar.getSeekBarAccessibilityDelegate().onInitializeAccessibilityNodeInfoInternal(this, info);
}
@Override
public boolean performAccessibilityAction(int action, Bundle arguments) {
return super.performAccessibilityAction(action, arguments) || this.sizeBar.getSeekBarAccessibilityDelegate().performAccessibilityActionInternal(this, action, arguments);
}
}
public ThemeActivity(int type) {
this.gpsLocationListener = new GpsLocationListener();
this.networkLocationListener = new GpsLocationListener();
this.currentType = type;
updateRows(true);
}
public final void setPlusTextSize(int size) {
SharedPreferences.Editor edit = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0).edit();
edit.putInt("chatTextSize", size);
edit.apply();
}
public final boolean setBubbleRadius(int size, boolean layout) {
if (size == SharedConfig.bubbleRadius) {
return false;
}
SharedConfig.bubbleRadius = size;
SharedPreferences.Editor edit = MessagesController.getGlobalMainSettings().edit();
edit.putInt("bubbleRadius", SharedConfig.bubbleRadius);
edit.commit();
RecyclerView.ViewHolder findViewHolderForAdapterPosition = this.listView.findViewHolderForAdapterPosition(this.textSizeRow);
if (findViewHolderForAdapterPosition != null) {
View view = findViewHolderForAdapterPosition.itemView;
if (view instanceof TextSizeCell) {
TextSizeCell textSizeCell = (TextSizeCell) view;
ChatMessageCell[] cells = textSizeCell.messagesCell.getCells();
for (int i = 0; i < cells.length; i++) {
cells[i].getMessageObject().resetLayout();
cells[i].requestLayout();
}
textSizeCell.invalidate();
}
}
RecyclerView.ViewHolder findViewHolderForAdapterPosition2 = this.listView.findViewHolderForAdapterPosition(this.bubbleRadiusRow);
if (findViewHolderForAdapterPosition2 != null) {
View view2 = findViewHolderForAdapterPosition2.itemView;
if (view2 instanceof BubbleRadiusCell) {
BubbleRadiusCell bubbleRadiusCell = (BubbleRadiusCell) view2;
if (layout) {
bubbleRadiusCell.requestLayout();
} else {
bubbleRadiusCell.invalidate();
}
}
}
updateMenuItem();
return true;
}
public final boolean setFontSize(int size) {
if (size == SharedConfig.fontSize) {
return false;
}
SharedConfig.fontSize = size;
SharedConfig.fontSizeIsDefault = false;
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", 0);
if (sharedPreferences == null) {
return false;
}
SharedPreferences.Editor edit = sharedPreferences.edit();
edit.putInt("fons_size", SharedConfig.fontSize);
edit.commit();
Theme.createCommonMessageResources();
setPlusTextSize(size);
RecyclerView.ViewHolder findViewHolderForAdapterPosition = this.listView.findViewHolderForAdapterPosition(this.textSizeRow);
if (findViewHolderForAdapterPosition != null) {
View view = findViewHolderForAdapterPosition.itemView;
if (view instanceof TextSizeCell) {
ChatMessageCell[] cells = ((TextSizeCell) view).messagesCell.getCells();
for (int i = 0; i < cells.length; i++) {
cells[i].getMessageObject().resetLayout();
cells[i].requestLayout();
}
}
}
updateMenuItem();
return true;
}
public final void updateRows(boolean notify) {
int i;
int i2;
int i3;
int i4;
int i5;
TLRPC.TL_theme tL_theme;
int i6 = this.rowCount;
int i7 = this.themeAccentListRow;
int i8 = this.editThemeRow;
int i9 = this.raiseToSpeakRow;
this.rowCount = 0;
this.downloadThemesRow = -1;
this.uploadThemesRow = -1;
this.contactsReimportRow = -1;
this.contactsSortRow = -1;
this.scheduleLocationRow = -1;
this.scheduleUpdateLocationRow = -1;
this.scheduleLocationInfoRow = -1;
this.nightDisabledRow = -1;
this.nightScheduledRow = -1;
this.nightAutomaticRow = -1;
this.nightSystemDefaultRow = -1;
this.nightTypeInfoRow = -1;
this.scheduleHeaderRow = -1;
this.nightThemeRow = -1;
this.newThemeInfoRow = -1;
this.scheduleFromRow = -1;
this.scheduleToRow = -1;
this.scheduleFromToInfoRow = -1;
this.themeListRow = -1;
this.themeListRow2 = -1;
this.themeAccentListRow = -1;
this.themeInfoRow = -1;
this.preferedHeaderRow = -1;
this.automaticHeaderRow = -1;
this.automaticBrightnessRow = -1;
this.automaticBrightnessInfoRow = -1;
this.textSizeHeaderRow = -1;
this.themeHeaderRow = -1;
this.bubbleRadiusHeaderRow = -1;
this.bubbleRadiusRow = -1;
this.bubbleRadiusInfoRow = -1;
this.chatListHeaderRow = -1;
this.chatListRow = -1;
this.chatListInfoRow = -1;
this.chatBlurRow = -1;
this.pauseOnRecordRow = -1;
this.pauseOnMediaRow = -1;
this.stickersRow = -1;
this.stickersInfoRow = -1;
this.stickersSectionRow = -1;
this.mediaSoundHeaderRow = -1;
this.otherHeaderRow = -1;
this.mediaSoundSectionRow = -1;
this.otherSectionRow = -1;
this.liteModeRow = -1;
this.liteModeInfoRow = -1;
this.textSizeRow = -1;
this.backgroundRow = -1;
this.changeUserColor = -1;
this.settingsRow = -1;
this.customTabsRow = -1;
this.directShareRow = -1;
this.enableAnimationsRow = -1;
this.raiseToSpeakRow = -1;
this.raiseToListenRow = -1;
this.nextMediaTapRow = -1;
this.sendByEnterRow = -1;
this.saveToGalleryOption1Row = -1;
this.saveToGalleryOption2Row = -1;
this.saveToGallerySectionRow = -1;
this.distanceRow = -1;
this.bluetoothScoRow = -1;
this.settings2Row = -1;
this.swipeGestureHeaderRow = -1;
this.swipeGestureRow = -1;
this.swipeGestureInfoRow = -1;
this.selectThemeHeaderRow = -1;
this.themePreviewRow = -1;
this.editThemeRow = -1;
this.createNewThemeRow = -1;
this.appIconHeaderRow = -1;
this.appIconSelectorRow = -1;
this.appIconShadowRow = -1;
this.lastShadowRow = -1;
this.defaultThemes.clear();
this.darkThemes.clear();
int size = Theme.themes.size();
int i10 = 0;
while (true) {
if (i10 >= size) {
break;
}
Theme.ThemeInfo themeInfo = Theme.themes.get(i10);
int i11 = this.currentType;
if (i11 == 0 || i11 == 3 || (!themeInfo.isLight() && ((tL_theme = themeInfo.info) == null || tL_theme.document != null))) {
if (themeInfo.pathToFile != null) {
this.darkThemes.add(themeInfo);
} else {
this.defaultThemes.add(themeInfo);
}
}
i10++;
}
Collections.sort(this.defaultThemes, new Comparator() {
@Override
public final int compare(Object obj, Object obj2) {
int lambda$updateRows$0;
lambda$updateRows$0 = ThemeActivity.lambda$updateRows$0((Theme.ThemeInfo) obj, (Theme.ThemeInfo) obj2);
return lambda$updateRows$0;
}
});
int i12 = this.currentType;
if (i12 == 3) {
int i13 = this.rowCount;
int i14 = i13 + 1;
this.rowCount = i14;
this.selectThemeHeaderRow = i13;
int i15 = i14 + 1;
this.rowCount = i15;
this.themeListRow2 = i14;
int i16 = i15 + 1;
this.rowCount = i16;
this.chatListInfoRow = i15;
int i17 = i16 + 1;
this.rowCount = i17;
this.themePreviewRow = i16;
int i18 = i17 + 1;
this.rowCount = i18;
this.themeHeaderRow = i17;
this.rowCount = i18 + 1;
this.themeListRow = i18;
boolean hasAccentColors = Theme.getCurrentTheme().hasAccentColors();
this.hasThemeAccents = hasAccentColors;
ThemesHorizontalListCell themesHorizontalListCell = this.themesHorizontalListCell;
if (themesHorizontalListCell != null) {
themesHorizontalListCell.setDrawDivider(hasAccentColors);
}
if (this.hasThemeAccents) {
int i19 = this.rowCount;
this.rowCount = i19 + 1;
this.themeAccentListRow = i19;
}
int i20 = this.rowCount;
this.rowCount = i20 + 1;
this.bubbleRadiusInfoRow = i20;
Theme.ThemeInfo currentTheme = Theme.getCurrentTheme();
Theme.ThemeAccent accent = currentTheme.getAccent(false);
ArrayList<Theme.ThemeAccent> arrayList = currentTheme.themeAccents;
if (arrayList != null && !arrayList.isEmpty() && accent != null && accent.id >= 100) {
int i21 = this.rowCount;
this.rowCount = i21 + 1;
this.editThemeRow = i21;
}
int i22 = this.rowCount;
int i23 = i22 + 1;
this.rowCount = i23;
this.createNewThemeRow = i22;
this.rowCount = i23 + 1;
this.lastShadowRow = i23;
} else if (i12 == 0) {
int i24 = this.rowCount;
int i25 = i24 + 1;
this.rowCount = i25;
this.downloadThemesRow = i24;
int i26 = i25 + 1;
this.rowCount = i26;
this.uploadThemesRow = i25;
int i27 = i26 + 1;
this.rowCount = i27;
this.textSizeHeaderRow = i26;
int i28 = i27 + 1;
this.rowCount = i28;
this.textSizeRow = i27;
int i29 = i28 + 1;
this.rowCount = i29;
this.backgroundRow = i28;
int i30 = i29 + 1;
this.rowCount = i30;
this.changeUserColor = i29;
int i31 = i30 + 1;
this.rowCount = i31;
this.newThemeInfoRow = i30;
int i32 = i31 + 1;
this.rowCount = i32;
this.themeHeaderRow = i31;
int i33 = i32 + 1;
this.rowCount = i33;
this.themeListRow2 = i32;
int i34 = i33 + 1;
this.rowCount = i34;
this.themeInfoRow = i33;
int i35 = i34 + 1;
this.rowCount = i35;
this.bubbleRadiusHeaderRow = i34;
int i36 = i35 + 1;
this.rowCount = i36;
this.bubbleRadiusRow = i35;
int i37 = i36 + 1;
this.rowCount = i37;
this.bubbleRadiusInfoRow = i36;
int i38 = i37 + 1;
this.rowCount = i38;
this.chatListHeaderRow = i37;
int i39 = i38 + 1;
this.rowCount = i39;
this.chatListRow = i38;
int i40 = i39 + 1;
this.rowCount = i40;
this.chatListInfoRow = i39;
int i41 = i40 + 1;
this.rowCount = i41;
this.appIconHeaderRow = i40;
int i42 = i41 + 1;
this.rowCount = i42;
this.appIconSelectorRow = i41;
int i43 = i42 + 1;
this.rowCount = i43;
this.appIconShadowRow = i42;
int i44 = i43 + 1;
this.rowCount = i44;
this.swipeGestureHeaderRow = i43;
int i45 = i44 + 1;
this.rowCount = i45;
this.swipeGestureRow = i44;
int i46 = i45 + 1;
this.rowCount = i46;
this.swipeGestureInfoRow = i45;
int i47 = i46 + 1;
this.rowCount = i47;
this.nightThemeRow = i46;
int i48 = i47 + 1;
this.rowCount = i48;
this.liteModeRow = i47;
int i49 = i48 + 1;
this.rowCount = i49;
this.stickersRow = i48;
int i50 = i49 + 1;
this.rowCount = i50;
this.stickersSectionRow = i49;
int i51 = i50 + 1;
this.rowCount = i51;
this.mediaSoundHeaderRow = i50;
int i52 = i51 + 1;
this.rowCount = i52;
this.nextMediaTapRow = i51;
int i53 = i52 + 1;
this.rowCount = i53;
this.raiseToListenRow = i52;
if (SharedConfig.raiseToListen) {
this.rowCount = i53 + 1;
this.raiseToSpeakRow = i53;
}
int i54 = this.rowCount;
int i55 = i54 + 1;
this.rowCount = i55;
this.pauseOnRecordRow = i54;
int i56 = i55 + 1;
this.rowCount = i56;
this.pauseOnMediaRow = i55;
int i57 = i56 + 1;
this.rowCount = i57;
this.bluetoothScoRow = i56;
int i58 = i57 + 1;
this.rowCount = i58;
this.mediaSoundSectionRow = i57;
int i59 = i58 + 1;
this.rowCount = i59;
this.otherHeaderRow = i58;
int i60 = i59 + 1;
this.rowCount = i60;
this.customTabsRow = i59;
int i61 = i60 + 1;
this.rowCount = i61;
this.directShareRow = i60;
int i62 = i61 + 1;
this.rowCount = i62;
this.sendByEnterRow = i61;
int i63 = i62 + 1;
this.rowCount = i63;
this.distanceRow = i62;
this.rowCount = i63 + 1;
this.otherSectionRow = i63;
} else {
int i64 = this.rowCount;
int i65 = i64 + 1;
this.rowCount = i65;
this.nightDisabledRow = i64;
int i66 = i65 + 1;
this.rowCount = i66;
this.nightScheduledRow = i65;
int i67 = i66 + 1;
this.rowCount = i67;
this.nightAutomaticRow = i66;
if (Build.VERSION.SDK_INT >= 29) {
this.rowCount = i67 + 1;
this.nightSystemDefaultRow = i67;
}
int i68 = this.rowCount;
int i69 = i68 + 1;
this.rowCount = i69;
this.nightTypeInfoRow = i68;
int i70 = Theme.selectedAutoNightType;
if (i70 == 1) {
int i71 = i69 + 1;
this.rowCount = i71;
this.scheduleHeaderRow = i69;
int i72 = i71 + 1;
this.rowCount = i72;
this.scheduleLocationRow = i71;
if (Theme.autoNightScheduleByLocation) {
int i73 = i72 + 1;
this.rowCount = i73;
this.scheduleUpdateLocationRow = i72;
this.rowCount = i73 + 1;
this.scheduleLocationInfoRow = i73;
} else {
int i74 = i72 + 1;
this.rowCount = i74;
this.scheduleFromRow = i72;
int i75 = i74 + 1;
this.rowCount = i75;
this.scheduleToRow = i74;
this.rowCount = i75 + 1;
this.scheduleFromToInfoRow = i75;
}
} else if (i70 == 2) {
int i76 = i69 + 1;
this.rowCount = i76;
this.automaticHeaderRow = i69;
int i77 = i76 + 1;
this.rowCount = i77;
this.automaticBrightnessRow = i76;
this.rowCount = i77 + 1;
this.automaticBrightnessInfoRow = i77;
}
if (Theme.selectedAutoNightType != 0) {
int i78 = this.rowCount;
int i79 = i78 + 1;
this.rowCount = i79;
this.preferedHeaderRow = i78;
this.rowCount = i79 + 1;
this.themeListRow = i79;
boolean hasAccentColors2 = Theme.getCurrentNightTheme().hasAccentColors();
this.hasThemeAccents = hasAccentColors2;
ThemesHorizontalListCell themesHorizontalListCell2 = this.themesHorizontalListCell;
if (themesHorizontalListCell2 != null) {
themesHorizontalListCell2.setDrawDivider(hasAccentColors2);
}
if (this.hasThemeAccents) {
int i80 = this.rowCount;
this.rowCount = i80 + 1;
this.themeAccentListRow = i80;
}
int i81 = this.rowCount;
this.rowCount = i81 + 1;
this.themeInfoRow = i81;
}
}
ThemesHorizontalListCell themesHorizontalListCell3 = this.themesHorizontalListCell;
if (themesHorizontalListCell3 != null) {
themesHorizontalListCell3.notifyDataSetChanged(this.listView.getWidth());
}
ListAdapter listAdapter = this.listAdapter;
if (listAdapter != null) {
if (this.currentType != 1 || (i4 = this.previousUpdatedType) == (i5 = Theme.selectedAutoNightType) || i4 == -1) {
if (notify || this.previousUpdatedType == -1) {
listAdapter.notifyDataSetChanged();
} else {
if (i7 == -1 && (i3 = this.themeAccentListRow) != -1) {
listAdapter.notifyItemInserted(i3);
} else if (i7 != -1 && this.themeAccentListRow == -1) {
listAdapter.notifyItemRemoved(i7);
if (i8 != -1) {
i8--;
}
} else {
int i82 = this.themeAccentListRow;
if (i82 != -1) {
listAdapter.notifyItemChanged(i82);
}
}
if (i8 == -1 && (i2 = this.editThemeRow) != -1) {
this.listAdapter.notifyItemInserted(i2);
} else if (i8 != -1 && this.editThemeRow == -1) {
this.listAdapter.notifyItemRemoved(i8);
}
if (i9 == -1 && (i = this.raiseToSpeakRow) != -1) {
this.listAdapter.notifyItemInserted(i);
} else if (i9 != -1 && this.raiseToSpeakRow == -1) {
this.listAdapter.notifyItemRemoved(i9);
}
}
} else {
int i83 = this.nightTypeInfoRow + 1;
if (i4 != i5) {
int i84 = 0;
while (true) {
if (i84 >= 4) {
break;
}
RecyclerListView.Holder findViewHolderForAdapterPosition = this.listView.findViewHolderForAdapterPosition(i84);
if (findViewHolderForAdapterPosition != null) {
View view = ((RecyclerView.ViewHolder) findViewHolderForAdapterPosition).itemView;
if (view instanceof ThemeTypeCell) {
((ThemeTypeCell) view).setTypeChecked(i84 == Theme.selectedAutoNightType);
}
}
i84++;
}
int i85 = Theme.selectedAutoNightType;
if (i85 == 0) {
this.listAdapter.notifyItemRangeRemoved(i83, i6 - i83);
} else if (i85 == 1) {
int i86 = this.previousUpdatedType;
if (i86 == 0) {
this.listAdapter.notifyItemRangeInserted(i83, this.rowCount - i83);
} else if (i86 == 2) {
this.listAdapter.notifyItemRangeRemoved(i83, 3);
this.listAdapter.notifyItemRangeInserted(i83, Theme.autoNightScheduleByLocation ? 4 : 5);
} else if (i86 == 3) {
this.listAdapter.notifyItemRangeInserted(i83, Theme.autoNightScheduleByLocation ? 4 : 5);
}
} else if (i85 == 2) {
int i87 = this.previousUpdatedType;
if (i87 == 0) {
this.listAdapter.notifyItemRangeInserted(i83, this.rowCount - i83);
} else if (i87 == 1) {
this.listAdapter.notifyItemRangeRemoved(i83, Theme.autoNightScheduleByLocation ? 4 : 5);
this.listAdapter.notifyItemRangeInserted(i83, 3);
} else if (i87 == 3) {
this.listAdapter.notifyItemRangeInserted(i83, 3);
}
} else if (i85 == 3) {
int i88 = this.previousUpdatedType;
if (i88 == 0) {
this.listAdapter.notifyItemRangeInserted(i83, this.rowCount - i83);
} else if (i88 == 2) {
this.listAdapter.notifyItemRangeRemoved(i83, 3);
} else if (i88 == 1) {
this.listAdapter.notifyItemRangeRemoved(i83, Theme.autoNightScheduleByLocation ? 4 : 5);
}
}
} else {
boolean z = this.previousByLocation;
boolean z2 = Theme.autoNightScheduleByLocation;
if (z != z2) {
int i89 = i83 + 2;
listAdapter.notifyItemRangeRemoved(i89, z2 ? 3 : 2);
this.listAdapter.notifyItemRangeInserted(i89, Theme.autoNightScheduleByLocation ? 2 : 3);
}
}
}
}
if (this.currentType == 1) {
this.previousByLocation = Theme.autoNightScheduleByLocation;
this.previousUpdatedType = Theme.selectedAutoNightType;
}
updateMenuItem();
}
public static int lambda$updateRows$0(Theme.ThemeInfo themeInfo, Theme.ThemeInfo themeInfo2) {
return Integer.compare(themeInfo.sortIndex, themeInfo2.sortIndex);
}
public boolean onFragmentCreate() {
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.locationPermissionGranted);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetNewWallpapper);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.themeListUpdated);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.themeAccentListUpdated);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiLoaded);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.needShareTheme);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.needSetDayNightTheme);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiPreviewThemesChanged);
getNotificationCenter().addObserver(this, NotificationCenter.themeUploadedToServer);
getNotificationCenter().addObserver(this, NotificationCenter.themeUploadError);
if (this.currentType == 0) {
Theme.loadRemoteThemes(((BaseFragment) this).currentAccount, true);
Theme.checkCurrentRemoteTheme(true);
}
return super.onFragmentCreate();
}
public void onFragmentDestroy() {
super.onFragmentDestroy();
stopLocationUpdate();
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.locationPermissionGranted);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didSetNewWallpapper);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.themeListUpdated);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.themeAccentListUpdated);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiLoaded);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.needShareTheme);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.needSetDayNightTheme);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiPreviewThemesChanged);
getNotificationCenter().removeObserver(this, NotificationCenter.themeUploadedToServer);
getNotificationCenter().removeObserver(this, NotificationCenter.themeUploadError);
Theme.saveAutoNightThemeConfig();
}
public void didReceivedNotification(int id, int account, Object... args) {
int i;
AlertDialog alertDialog;
int i2;
if (id == NotificationCenter.locationPermissionGranted) {
updateSunTime(null, true);
return;
}
if (id == NotificationCenter.didSetNewWallpapper || id == NotificationCenter.emojiLoaded) {
RecyclerListView recyclerListView = this.listView;
if (recyclerListView != null) {
recyclerListView.invalidateViews();
}
updateMenuItem();
return;
}
if (id == NotificationCenter.themeAccentListUpdated) {
ListAdapter listAdapter = this.listAdapter;
if (listAdapter == null || (i2 = this.themeAccentListRow) == -1) {
return;
}
listAdapter.notifyItemChanged(i2, new Object());
return;
}
if (id == NotificationCenter.themeListUpdated) {
updateRows(true);
return;
}
if (id == NotificationCenter.themeUploadedToServer) {
Theme.ThemeInfo themeInfo = (Theme.ThemeInfo) args[0];
Theme.ThemeAccent themeAccent = (Theme.ThemeAccent) args[1];
if (themeInfo == this.sharingTheme && themeAccent == this.sharingAccent) {
StringBuilder sb = new StringBuilder();
sb.append("https://");
sb.append(getMessagesController().linkPrefix);
sb.append("/addtheme/");
sb.append((themeAccent != null ? themeAccent.info : themeInfo.info).slug);
String sb2 = sb.toString();
showDialog(new ShareAlert(getParentActivity(), (ArrayList) null, sb2, false, sb2, false));
AlertDialog alertDialog2 = this.sharingProgressDialog;
if (alertDialog2 != null) {
alertDialog2.dismiss();
return;
}
return;
}
return;
}
if (id == NotificationCenter.themeUploadError) {
Theme.ThemeInfo themeInfo2 = (Theme.ThemeInfo) args[0];
Theme.ThemeAccent themeAccent2 = (Theme.ThemeAccent) args[1];
if (themeInfo2 == this.sharingTheme && themeAccent2 == this.sharingAccent && (alertDialog = this.sharingProgressDialog) == null) {
alertDialog.dismiss();
return;
}
return;
}
if (id == NotificationCenter.needShareTheme) {
if (getParentActivity() == null || ((BaseFragment) this).isPaused) {
return;
}
this.sharingTheme = (Theme.ThemeInfo) args[0];
this.sharingAccent = (Theme.ThemeAccent) args[1];
AlertDialog alertDialog3 = new AlertDialog(getParentActivity(), 3);
this.sharingProgressDialog = alertDialog3;
alertDialog3.setCanCancel(true);
showDialog(this.sharingProgressDialog, new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
ThemeActivity.this.lambda$didReceivedNotification$1(dialogInterface);
}
});
return;
}
if (id == NotificationCenter.needSetDayNightTheme) {
updateMenuItem();
checkCurrentDayNight();
} else {
if (id != NotificationCenter.emojiPreviewThemesChanged || (i = this.themeListRow2) < 0) {
return;
}
this.listAdapter.notifyItemChanged(i);
}
}
public void lambda$didReceivedNotification$1(DialogInterface dialogInterface) {
this.sharingProgressDialog = null;
this.sharingTheme = null;
this.sharingAccent = null;
}
public View createView(final Context context) {
this.lastIsDarkTheme = !Theme.isCurrentThemeDay();
((BaseFragment) this).actionBar.setBackButtonImage(R.drawable.ic_ab_back);
((BaseFragment) this).actionBar.setAllowOverlayTitle(false);
if (AndroidUtilities.isTablet()) {
((BaseFragment) this).actionBar.setOccupyStatusBar(false);
}
int i = this.currentType;
if (i == 3) {
((BaseFragment) this).actionBar.setTitle(LocaleController.getString("BrowseThemes", R.string.BrowseThemes));
ActionBarMenu createMenu = ((BaseFragment) this).actionBar.createMenu();
int i2 = R.raw.sun;
RLottieDrawable rLottieDrawable = new RLottieDrawable(i2, "" + i2, AndroidUtilities.dp(28.0f), AndroidUtilities.dp(28.0f), true, (int[]) null);
this.sunDrawable = rLottieDrawable;
if (this.lastIsDarkTheme) {
rLottieDrawable.setCurrentFrame(rLottieDrawable.getFramesCount() - 1);
} else {
rLottieDrawable.setCurrentFrame(0);
}
this.sunDrawable.setPlayInDirectionOfCustomEndFrame(true);
this.menuItem = createMenu.addItem(5, (Drawable) this.sunDrawable);
} else if (i == 0) {
((BaseFragment) this).actionBar.setTitle(LocaleController.getString("ChatSettings", R.string.ChatSettings));
ActionBarMenuItem addItem = ((BaseFragment) this).actionBar.createMenu().addItem(0, R.drawable.ic_ab_other);
this.menuItem = addItem;
addItem.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
this.menuItem.addSubItem(2, R.drawable.msg_share, LocaleController.getString("ShareTheme", R.string.ShareTheme));
this.menuItem.addSubItem(3, R.drawable.msg_edit, LocaleController.getString("EditThemeColors", R.string.EditThemeColors));
this.menuItem.addSubItem(1, R.drawable.msg_palette, LocaleController.getString("CreateNewThemeMenu", R.string.CreateNewThemeMenu));
this.menuItem.addSubItem(4, R.drawable.msg_reset, LocaleController.getString("ThemeResetToDefaults", R.string.ThemeResetToDefaults));
} else {
((BaseFragment) this).actionBar.setTitle(LocaleController.getString("AutoNightTheme", R.string.AutoNightTheme));
}
if (Theme.usePlusTheme) {
((BaseFragment) this).actionBar.setBackgroundColor(Theme.prefActionbarColor);
}
((BaseFragment) this).actionBar.setActionBarMenuOnItemClick(new AnonymousClass1());
this.listAdapter = new ListAdapter(context);
FrameLayout frameLayout = new FrameLayout(context);
frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
((BaseFragment) this).fragmentView = frameLayout;
RecyclerListView recyclerListView = new RecyclerListView(context);
this.listView = recyclerListView;
recyclerListView.setLayoutManager(new LinearLayoutManager(context, 1, false));
this.listView.setVerticalScrollBarEnabled(false);
this.listView.setAdapter(this.listAdapter);
this.listView.getItemAnimator().setDelayAnimations(false);
frameLayout.addView((View) this.listView, (ViewGroup.LayoutParams) LayoutHelper.createFrame(-1, -1.0f));
this.listView.setOnItemClickListener(new RecyclerListView.OnItemClickListenerExtended() {
public boolean hasDoubleTap(View view, int i3) {
return RecyclerListView.OnItemClickListenerExtended.-CC.$default$hasDoubleTap(this, view, i3);
}
public void onDoubleTap(View view, int i3, float f, float f2) {
RecyclerListView.OnItemClickListenerExtended.-CC.$default$onDoubleTap(this, view, i3, f, f2);
}
public final void onItemClick(View view, int i3, float f, float f2) {
ThemeActivity.this.lambda$createView$7(context, view, i3, f, f2);
}
});
if (this.currentType == 0) {
DefaultItemAnimator defaultItemAnimator = new DefaultItemAnimator();
defaultItemAnimator.setDurations(350L);
defaultItemAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
defaultItemAnimator.setDelayAnimations(false);
defaultItemAnimator.setSupportsChangeAnimations(false);
this.listView.setItemAnimator(defaultItemAnimator);
}
return ((BaseFragment) this).fragmentView;
}
public class AnonymousClass1 extends ActionBar.ActionBarMenuOnItemClick {
public AnonymousClass1() {
}
@Override
public void onItemClick(int r13) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.ThemeActivity.AnonymousClass1.onItemClick(int):void");
}
public void lambda$onItemClick$0(DialogInterface dialogInterface, int i) {
boolean fontSize = ThemeActivity.this.setFontSize(AndroidUtilities.isTablet() ? 18 : 16);
if (ThemeActivity.this.setBubbleRadius(17, true)) {
fontSize = true;
}
if (fontSize) {
ThemeActivity.this.listAdapter.notifyItemChanged(ThemeActivity.this.textSizeRow, new Object());
ThemeActivity.this.listAdapter.notifyItemChanged(ThemeActivity.this.bubbleRadiusRow, new Object());
}
if (ThemeActivity.this.themesHorizontalListCell != null) {
Theme.ThemeInfo theme = Theme.getTheme("Blue");
Theme.ThemeInfo currentTheme = Theme.getCurrentTheme();
Theme.ThemeAccent themeAccent = theme.themeAccentsMap.get(Theme.DEFALT_THEME_ACCENT_ID);
if (themeAccent != null) {
Theme.OverrideWallpaperInfo overrideWallpaperInfo = new Theme.OverrideWallpaperInfo();
overrideWallpaperInfo.slug = "d";
overrideWallpaperInfo.fileName = "Blue_99_wp.jpg";
overrideWallpaperInfo.originalFileName = "Blue_99_wp.jpg";
themeAccent.overrideWallpaper = overrideWallpaperInfo;
theme.setOverrideWallpaper(overrideWallpaperInfo);
}
if (theme != currentTheme) {
theme.setCurrentAccentId(Theme.DEFALT_THEME_ACCENT_ID);
Theme.saveThemeAccents(theme, true, false, true, false);
ThemeActivity.this.themesHorizontalListCell.selectTheme(theme);
ThemeActivity.this.themesHorizontalListCell.smoothScrollToPosition(0);
return;
}
if (theme.currentAccentId != Theme.DEFALT_THEME_ACCENT_ID) {
NotificationCenter globalInstance = NotificationCenter.getGlobalInstance();
int i2 = NotificationCenter.needSetDayNightTheme;
Object[] objArr = new Object[4];
objArr[0] = currentTheme;
objArr[1] = Boolean.valueOf(ThemeActivity.this.currentType == 1);
objArr[2] = null;
objArr[3] = Integer.valueOf(Theme.DEFALT_THEME_ACCENT_ID);
globalInstance.postNotificationName(i2, objArr);
ThemeActivity.this.listAdapter.notifyItemChanged(ThemeActivity.this.themeAccentListRow);
return;
}
Theme.reloadWallpaper(true);
}
}
}
public void lambda$createView$7(Context context, View view, final int i, float f, float f2) {
int i2;
int i3;
String string;
if (i == this.enableAnimationsRow) {
SharedPreferences globalMainSettings = MessagesController.getGlobalMainSettings();
boolean z = globalMainSettings.getBoolean("view_animations", true);
SharedPreferences.Editor edit = globalMainSettings.edit();
edit.putBoolean("view_animations", !z);
SharedConfig.setAnimationsEnabled(!z);
edit.commit();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(!z);
return;
}
return;
}
if (i == this.backgroundRow) {
presentFragment(new WallpapersListActivity(0));
return;
}
if (i == this.changeUserColor) {
presentFragment(new PeerColorActivity(0L).setOnApplied(this));
return;
}
if (i == this.sendByEnterRow) {
SharedPreferences globalMainSettings2 = MessagesController.getGlobalMainSettings();
boolean z2 = globalMainSettings2.getBoolean("send_by_enter", false);
SharedPreferences.Editor edit2 = globalMainSettings2.edit();
edit2.putBoolean("send_by_enter", !z2);
edit2.commit();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(!z2);
return;
}
return;
}
if (i == this.raiseToSpeakRow) {
SharedConfig.toggleRaiseToSpeak();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(SharedConfig.raiseToSpeak);
return;
}
return;
}
if (i == this.nextMediaTapRow) {
SharedConfig.toggleNextMediaTap();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(SharedConfig.nextMediaTap);
return;
}
return;
}
if (i == this.raiseToListenRow) {
SharedConfig.toggleRaiseToListen();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(SharedConfig.raiseToListen);
}
if (!SharedConfig.raiseToListen && this.raiseToSpeakRow != -1) {
for (int i4 = 0; i4 < this.listView.getChildCount(); i4++) {
View childAt = this.listView.getChildAt(i4);
if ((childAt instanceof TextCheckCell) && this.listView.getChildAdapterPosition(childAt) == this.raiseToSpeakRow) {
((TextCheckCell) childAt).setChecked(false);
}
}
}
updateRows(false);
return;
}
if (i == this.pauseOnRecordRow) {
SharedConfig.togglePauseMusicOnRecord();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(SharedConfig.pauseMusicOnRecord);
return;
}
return;
}
if (i == this.pauseOnMediaRow) {
SharedConfig.togglePauseMusicOnMedia();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(SharedConfig.pauseMusicOnMedia);
return;
}
return;
}
if (i == this.distanceRow) {
if (getParentActivity() == null) {
return;
}
final AtomicReference atomicReference = new AtomicReference();
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(1);
CharSequence[] charSequenceArr = {LocaleController.getString("DistanceUnitsAutomatic", R.string.DistanceUnitsAutomatic), LocaleController.getString("DistanceUnitsKilometers", R.string.DistanceUnitsKilometers), LocaleController.getString("DistanceUnitsMiles", R.string.DistanceUnitsMiles)};
final int i5 = 0;
while (i5 < 3) {
RadioColorCell radioColorCell = new RadioColorCell(getParentActivity());
radioColorCell.setPadding(AndroidUtilities.dp(4.0f), 0, AndroidUtilities.dp(4.0f), 0);
radioColorCell.setCheckColor(Theme.getColor(Theme.key_radioBackground), Theme.getColor(Theme.key_dialogRadioBackgroundChecked));
radioColorCell.setTextAndValue(charSequenceArr[i5], i5 == SharedConfig.distanceSystemType);
radioColorCell.setBackground(Theme.createSelectorDrawable(Theme.getColor(Theme.key_listSelector), 2));
linearLayout.addView(radioColorCell);
radioColorCell.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
ThemeActivity.this.lambda$createView$2(i5, atomicReference, view2);
}
});
i5++;
}
AlertDialog create = new AlertDialog.Builder(getParentActivity()).setTitle(LocaleController.getString("DistanceUnitsTitle", R.string.DistanceUnitsTitle)).setView(linearLayout).setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null).create();
atomicReference.set(create);
showDialog(create);
return;
}
if (i == this.bluetoothScoRow) {
if (getParentActivity() == null) {
return;
}
final AtomicReference atomicReference2 = new AtomicReference();
LinearLayout linearLayout2 = new LinearLayout(context);
linearLayout2.setOrientation(1);
RadioColorCell radioColorCell2 = new RadioColorCell(getParentActivity());
radioColorCell2.setPadding(AndroidUtilities.dp(4.0f), 0, AndroidUtilities.dp(4.0f), 0);
int i6 = Theme.key_radioBackground;
int color = Theme.getColor(i6);
int i7 = Theme.key_dialogRadioBackgroundChecked;
radioColorCell2.setCheckColor(color, Theme.getColor(i7));
radioColorCell2.setTextAndValue(LocaleController.getString(R.string.MicrophoneForVoiceMessagesBuiltIn), true ^ SharedConfig.recordViaSco);
int i8 = Theme.key_listSelector;
radioColorCell2.setBackground(Theme.createSelectorDrawable(Theme.getColor(i8), 2));
linearLayout2.addView(radioColorCell2);
radioColorCell2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
ThemeActivity.this.lambda$createView$3(atomicReference2, view2);
}
});
RadioColorCell radioColorCell3 = new RadioColorCell(getParentActivity());
radioColorCell3.setPadding(AndroidUtilities.dp(4.0f), 0, AndroidUtilities.dp(4.0f), 0);
radioColorCell3.setCheckColor(Theme.getColor(i6), Theme.getColor(i7));
radioColorCell3.setTextAndText2AndValue(LocaleController.getString(R.string.MicrophoneForVoiceMessagesScoIfConnected), LocaleController.getString(R.string.MicrophoneForVoiceMessagesScoHint), SharedConfig.recordViaSco);
radioColorCell3.setBackground(Theme.createSelectorDrawable(Theme.getColor(i8), 2));
linearLayout2.addView(radioColorCell3);
radioColorCell3.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
ThemeActivity.this.lambda$createView$4(atomicReference2, view2);
}
});
AlertDialog create2 = new AlertDialog.Builder(getParentActivity()).setTitle(LocaleController.getString(R.string.MicrophoneForVoiceMessages)).setView(linearLayout2).setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null).create();
atomicReference2.set(create2);
showDialog(create2);
return;
}
if (i == this.customTabsRow) {
SharedConfig.toggleCustomTabs();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(SharedConfig.customTabs);
return;
}
return;
}
if (i == this.directShareRow) {
SharedConfig.toggleDirectShare();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(SharedConfig.directShare);
return;
}
return;
}
if (i == this.contactsReimportRow) {
return;
}
if (i == this.contactsSortRow) {
if (getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("SortBy", R.string.SortBy));
builder.setItems(new CharSequence[]{LocaleController.getString("Default", R.string.Default), LocaleController.getString("SortFirstName", R.string.SortFirstName), LocaleController.getString("SortLastName", R.string.SortLastName)}, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i9) {
ThemeActivity.this.lambda$createView$5(i, dialogInterface, i9);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
return;
}
if (i == this.chatBlurRow) {
SharedConfig.toggleChatBlur();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(SharedConfig.chatBlurEnabled());
return;
}
return;
}
if (i == this.nightThemeRow) {
if ((LocaleController.isRTL && f <= AndroidUtilities.dp(76.0f)) || (!LocaleController.isRTL && f >= view.getMeasuredWidth() - AndroidUtilities.dp(76.0f))) {
NotificationsCheckCell notificationsCheckCell = (NotificationsCheckCell) view;
if (Theme.selectedAutoNightType == 0) {
Theme.selectedAutoNightType = 2;
notificationsCheckCell.setChecked(true);
} else {
Theme.selectedAutoNightType = 0;
notificationsCheckCell.setChecked(false);
}
Theme.saveAutoNightThemeConfig();
Theme.checkAutoNightThemeConditions(true);
boolean z3 = Theme.selectedAutoNightType != 0;
String currentNightThemeName = z3 ? Theme.getCurrentNightThemeName() : LocaleController.getString("AutoNightThemeOff", R.string.AutoNightThemeOff);
if (z3) {
int i9 = Theme.selectedAutoNightType;
if (i9 == 1) {
string = LocaleController.getString("AutoNightScheduled", R.string.AutoNightScheduled);
} else if (i9 == 3) {
string = LocaleController.getString("AutoNightSystemDefault", R.string.AutoNightSystemDefault);
} else {
string = LocaleController.getString("AutoNightAdaptive", R.string.AutoNightAdaptive);
}
currentNightThemeName = string + " " + currentNightThemeName;
}
notificationsCheckCell.setTextAndValueAndIconAndCheck(LocaleController.getString("AutoNightTheme", R.string.AutoNightTheme), currentNightThemeName, R.drawable.msg2_night_auto, z3, 0, false, true);
return;
}
presentFragment(new ThemeActivity(1));
return;
}
if (i == this.nightDisabledRow) {
if (Theme.selectedAutoNightType == 0) {
return;
}
Theme.selectedAutoNightType = 0;
updateRows(true);
Theme.checkAutoNightThemeConditions();
return;
}
if (i == this.nightScheduledRow) {
if (Theme.selectedAutoNightType == 1) {
return;
}
Theme.selectedAutoNightType = 1;
if (Theme.autoNightScheduleByLocation) {
updateSunTime(null, true);
}
updateRows(true);
Theme.checkAutoNightThemeConditions();
return;
}
if (i == this.nightAutomaticRow) {
if (Theme.selectedAutoNightType == 2) {
return;
}
Theme.selectedAutoNightType = 2;
updateRows(true);
Theme.checkAutoNightThemeConditions();
return;
}
if (i == this.nightSystemDefaultRow) {
if (Theme.selectedAutoNightType == 3) {
return;
}
Theme.selectedAutoNightType = 3;
updateRows(true);
Theme.checkAutoNightThemeConditions();
return;
}
if (i == this.scheduleLocationRow) {
boolean z4 = !Theme.autoNightScheduleByLocation;
Theme.autoNightScheduleByLocation = z4;
((TextCheckCell) view).setChecked(z4);
updateRows(true);
if (Theme.autoNightScheduleByLocation) {
updateSunTime(null, true);
}
Theme.checkAutoNightThemeConditions();
return;
}
if (i == this.scheduleFromRow || i == this.scheduleToRow) {
if (getParentActivity() == null) {
return;
}
if (i == this.scheduleFromRow) {
i2 = Theme.autoNightDayStartTime;
i3 = i2 / 60;
} else {
i2 = Theme.autoNightDayEndTime;
i3 = i2 / 60;
}
int i10 = i2 - (i3 * 60);
final TextSettingsCell textSettingsCell = (TextSettingsCell) view;
showDialog(new TimePickerDialog(getParentActivity(), new TimePickerDialog.OnTimeSetListener() {
@Override
public final void onTimeSet(TimePicker timePicker, int i11, int i12) {
ThemeActivity.this.lambda$createView$6(i, textSettingsCell, timePicker, i11, i12);
}
}, i3, i10, true));
return;
}
if (i == this.scheduleUpdateLocationRow) {
updateSunTime(null, true);
return;
}
if (i == this.createNewThemeRow) {
createNewTheme();
return;
}
if (i == this.editThemeRow) {
editTheme();
return;
}
if (i == this.stickersRow) {
presentFragment(new StickersActivity(0, null));
return;
}
if (i == this.liteModeRow) {
presentFragment(new LiteModeSettingsActivity());
return;
}
if (i == this.downloadThemesRow) {
try {
String str = BuildVars.BETA ? "es.rafalense.telegram.themes.beta" : "es.rafalense.telegram.themes";
Intent launchIntentForPackage = getParentActivity().getPackageManager().getLaunchIntentForPackage(str);
if (launchIntentForPackage == null) {
String str2 = "market://details?id=" + str;
if (BuildVars.BETA) {
str2 = "https://rink.hockeyapp.net/apps/072562a8c274411a9b324524e153f8e4";
}
launchIntentForPackage = new Intent("android.intent.action.VIEW", Uri.parse(str2));
}
startActivityForResult(launchIntentForPackage, 503);
return;
} catch (Exception e) {
startActivityForResult(new Intent("android.intent.action.VIEW", Uri.parse("https://play.google.com/store/apps/details?id=es.rafalense.themes")), 503);
FileLog.e("tmessages", e);
return;
}
}
if (i == this.uploadThemesRow) {
startActivityForResult(new Intent("android.intent.action.VIEW", Uri.parse("https://plusmessenger.org/plus/uploader.php")), 503);
}
}
public void lambda$createView$2(int i, AtomicReference atomicReference, View view) {
SharedConfig.setDistanceSystemType(i);
this.updateDistance = true;
RecyclerView.ViewHolder findViewHolderForAdapterPosition = this.listView.findViewHolderForAdapterPosition(this.distanceRow);
if (findViewHolderForAdapterPosition != null) {
this.listAdapter.onBindViewHolder(findViewHolderForAdapterPosition, this.distanceRow);
}
((Dialog) atomicReference.get()).dismiss();
}
public void lambda$createView$3(AtomicReference atomicReference, View view) {
SharedConfig.recordViaSco = false;
SharedConfig.saveConfig();
this.updateRecordViaSco = true;
((Dialog) atomicReference.get()).dismiss();
RecyclerView.ViewHolder findViewHolderForAdapterPosition = this.listView.findViewHolderForAdapterPosition(this.bluetoothScoRow);
if (findViewHolderForAdapterPosition != null) {
this.listAdapter.onBindViewHolder(findViewHolderForAdapterPosition, this.bluetoothScoRow);
}
}
public void lambda$createView$4(AtomicReference atomicReference, View view) {
SharedConfig.recordViaSco = true;
SharedConfig.saveConfig();
this.updateRecordViaSco = true;
((Dialog) atomicReference.get()).dismiss();
RecyclerView.ViewHolder findViewHolderForAdapterPosition = this.listView.findViewHolderForAdapterPosition(this.bluetoothScoRow);
if (findViewHolderForAdapterPosition != null) {
this.listAdapter.onBindViewHolder(findViewHolderForAdapterPosition, this.bluetoothScoRow);
}
}
public void lambda$createView$5(int i, DialogInterface dialogInterface, int i2) {
SharedPreferences.Editor edit = MessagesController.getGlobalMainSettings().edit();
edit.putInt("sortContactsBy", i2);
edit.commit();
ListAdapter listAdapter = this.listAdapter;
if (listAdapter != null) {
listAdapter.notifyItemChanged(i);
}
}
public void lambda$createView$6(int i, TextSettingsCell textSettingsCell, TimePicker timePicker, int i2, int i3) {
int i4 = (i2 * 60) + i3;
if (i == this.scheduleFromRow) {
Theme.autoNightDayStartTime = i4;
textSettingsCell.setTextAndValue(LocaleController.getString("AutoNightFrom", R.string.AutoNightFrom), String.format("%02d:%02d", Integer.valueOf(i2), Integer.valueOf(i3)), true);
} else {
Theme.autoNightDayEndTime = i4;
textSettingsCell.setTextAndValue(LocaleController.getString("AutoNightTo", R.string.AutoNightTo), String.format("%02d:%02d", Integer.valueOf(i2), Integer.valueOf(i3)), true);
}
}
public final void editTheme() {
Theme.ThemeInfo currentTheme = Theme.getCurrentTheme();
presentFragment(new ThemePreviewActivity(currentTheme, false, 1, currentTheme.getAccent(false).id >= 100, this.currentType == 1));
}
public final void createNewTheme() {
if (getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("NewTheme", R.string.NewTheme));
builder.setMessage(LocaleController.getString("CreateNewThemeAlert", R.string.CreateNewThemeAlert));
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.setPositiveButton(LocaleController.getString("CreateTheme", R.string.CreateTheme), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ThemeActivity.this.lambda$createNewTheme$8(dialogInterface, i);
}
});
showDialog(builder.create());
}
public void lambda$createNewTheme$8(DialogInterface dialogInterface, int i) {
AlertsCreator.createThemeCreateDialog(this, 0, (Theme.ThemeInfo) null, (Theme.ThemeAccent) null);
}
public void onResume() {
super.onResume();
if (this.listAdapter != null) {
updateRows(true);
}
}
public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
if (isOpen) {
AndroidUtilities.requestAdjustResize(getParentActivity(), ((BaseFragment) this).classGuid);
AndroidUtilities.setAdjustResizeToNothing(getParentActivity(), ((BaseFragment) this).classGuid);
}
}
public final void updateMenuItem() {
Theme.OverrideWallpaperInfo overrideWallpaperInfo;
if (this.menuItem == null) {
return;
}
Theme.ThemeInfo currentTheme = Theme.getCurrentTheme();
Theme.ThemeAccent accent = currentTheme.getAccent(false);
ArrayList<Theme.ThemeAccent> arrayList = currentTheme.themeAccents;
if (arrayList != null && !arrayList.isEmpty() && accent != null && accent.id >= 100) {
this.menuItem.showSubItem(2);
this.menuItem.showSubItem(3);
} else {
this.menuItem.hideSubItem(2);
this.menuItem.hideSubItem(3);
}
int i = AndroidUtilities.isTablet() ? 18 : 16;
Theme.ThemeInfo currentTheme2 = Theme.getCurrentTheme();
if (SharedConfig.fontSize != i || SharedConfig.bubbleRadius != 17 || !currentTheme2.firstAccentIsDefault || currentTheme2.currentAccentId != Theme.DEFALT_THEME_ACCENT_ID || (accent != null && (overrideWallpaperInfo = accent.overrideWallpaper) != null && !"d".equals(overrideWallpaperInfo.slug))) {
this.menuItem.showSubItem(4);
} else {
this.menuItem.hideSubItem(4);
}
}
public final void updateSunTime(Location lastKnownLocation, boolean forceUpdate) {
Activity parentActivity;
LocationManager locationManager = (LocationManager) ApplicationLoader.applicationContext.getSystemService("location");
if (Build.VERSION.SDK_INT >= 23 && (parentActivity = getParentActivity()) != null && parentActivity.checkSelfPermission("android.permission.ACCESS_COARSE_LOCATION") != 0) {
parentActivity.requestPermissions(new String[]{"android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"}, 2);
return;
}
if (getParentActivity() != null) {
if (!getParentActivity().getPackageManager().hasSystemFeature("android.hardware.location.gps")) {
return;
}
try {
if (!((LocationManager) ApplicationLoader.applicationContext.getSystemService("location")).isProviderEnabled("gps")) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTopAnimation(R.raw.permission_request_location, 72, false, Theme.usePlusTheme ? Theme.defColor : Theme.getColor(Theme.key_dialogTopBackground));
builder.setMessage(LocaleController.getString("GpsDisabledAlertText", R.string.GpsDisabledAlertText));
builder.setPositiveButton(LocaleController.getString("ConnectingToProxyEnable", R.string.ConnectingToProxyEnable), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ThemeActivity.this.lambda$updateSunTime$9(dialogInterface, i);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
return;
}
} catch (Exception e) {
FileLog.e(e);
}
}
try {
lastKnownLocation = locationManager.getLastKnownLocation("gps");
if (lastKnownLocation == null) {
lastKnownLocation = locationManager.getLastKnownLocation("network");
}
if (lastKnownLocation == null) {
lastKnownLocation = locationManager.getLastKnownLocation("passive");
}
} catch (Exception e2) {
FileLog.e(e2);
}
if (lastKnownLocation == null || forceUpdate) {
startLocationUpdate();
if (lastKnownLocation == null) {
return;
}
}
Theme.autoNightLocationLatitude = lastKnownLocation.getLatitude();
Theme.autoNightLocationLongitude = lastKnownLocation.getLongitude();
int[] calculateSunriseSunset = SunDate.calculateSunriseSunset(Theme.autoNightLocationLatitude, Theme.autoNightLocationLongitude);
Theme.autoNightSunriseTime = calculateSunriseSunset[0];
Theme.autoNightSunsetTime = calculateSunriseSunset[1];
Theme.autoNightCityName = null;
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
Theme.autoNightLastSunCheckDay = calendar.get(5);
Utilities.globalQueue.postRunnable(new Runnable() {
@Override
public final void run() {
ThemeActivity.this.lambda$updateSunTime$11();
}
});
RecyclerListView.Holder findViewHolderForAdapterPosition = this.listView.findViewHolderForAdapterPosition(this.scheduleLocationInfoRow);
if (findViewHolderForAdapterPosition != null) {
View view = ((RecyclerView.ViewHolder) findViewHolderForAdapterPosition).itemView;
if (view instanceof TextInfoPrivacyCell) {
((TextInfoPrivacyCell) view).setText(getLocationSunString());
}
}
if (Theme.autoNightScheduleByLocation && Theme.selectedAutoNightType == 1) {
Theme.checkAutoNightThemeConditions();
}
}
public void lambda$updateSunTime$9(DialogInterface dialogInterface, int i) {
if (getParentActivity() == null) {
return;
}
try {
getParentActivity().startActivity(new Intent("android.settings.LOCATION_SOURCE_SETTINGS"));
} catch (Exception unused) {
}
}
public void lambda$updateSunTime$11() {
final String str = null;
try {
List<Address> fromLocation = new Geocoder(ApplicationLoader.applicationContext, Locale.getDefault()).getFromLocation(Theme.autoNightLocationLatitude, Theme.autoNightLocationLongitude, 1);
if (fromLocation.size() > 0) {
str = fromLocation.get(0).getLocality();
}
} catch (Exception unused) {
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ThemeActivity.this.lambda$updateSunTime$10(str);
}
});
}
public void lambda$updateSunTime$10(String str) {
RecyclerListView.Holder findViewHolderForAdapterPosition;
Theme.autoNightCityName = str;
if (str == null) {
Theme.autoNightCityName = String.format("(%.06f, %.06f)", Double.valueOf(Theme.autoNightLocationLatitude), Double.valueOf(Theme.autoNightLocationLongitude));
}
Theme.saveAutoNightThemeConfig();
RecyclerListView recyclerListView = this.listView;
if (recyclerListView == null || (findViewHolderForAdapterPosition = recyclerListView.findViewHolderForAdapterPosition(this.scheduleUpdateLocationRow)) == null) {
return;
}
View view = ((RecyclerView.ViewHolder) findViewHolderForAdapterPosition).itemView;
if (view instanceof TextSettingsCell) {
((TextSettingsCell) view).setTextAndValue(LocaleController.getString("AutoNightUpdateLocation", R.string.AutoNightUpdateLocation), Theme.autoNightCityName, false);
}
}
public final void startLocationUpdate() {
if (this.updatingLocation) {
return;
}
this.updatingLocation = true;
LocationManager locationManager = (LocationManager) ApplicationLoader.applicationContext.getSystemService("location");
try {
locationManager.requestLocationUpdates("gps", 1L, 0.0f, this.gpsLocationListener);
} catch (Exception e) {
FileLog.e(e);
}
try {
locationManager.requestLocationUpdates("network", 1L, 0.0f, this.networkLocationListener);
} catch (Exception e2) {
FileLog.e(e2);
}
}
public final void stopLocationUpdate() {
this.updatingLocation = false;
LocationManager locationManager = (LocationManager) ApplicationLoader.applicationContext.getSystemService("location");
locationManager.removeUpdates(this.gpsLocationListener);
locationManager.removeUpdates(this.networkLocationListener);
}
public final String getLocationSunString() {
int i = Theme.autoNightSunriseTime;
int i2 = i / 60;
String format = String.format("%02d:%02d", Integer.valueOf(i2), Integer.valueOf(i - (i2 * 60)));
int i3 = Theme.autoNightSunsetTime;
int i4 = i3 / 60;
return LocaleController.formatString("AutoNightUpdateLocationInfo", R.string.AutoNightUpdateLocationInfo, new Object[]{String.format("%02d:%02d", Integer.valueOf(i4), Integer.valueOf(i3 - (i4 * 60))), format});
}
public static class InnerAccentView extends View {
public ObjectAnimator checkAnimator;
public boolean checked;
public float checkedState;
public Theme.ThemeAccent currentAccent;
public Theme.ThemeInfo currentTheme;
public final Paint paint;
public InnerAccentView(Context context) {
super(context);
this.paint = new Paint(1);
}
public void setThemeAndColor(Theme.ThemeInfo themeInfo, Theme.ThemeAccent accent) {
this.currentTheme = themeInfo;
this.currentAccent = accent;
updateCheckedState(false);
}
public void updateCheckedState(boolean animate) {
this.checked = this.currentTheme.currentAccentId == this.currentAccent.id;
ObjectAnimator objectAnimator = this.checkAnimator;
if (objectAnimator != null) {
objectAnimator.cancel();
}
if (animate) {
float[] fArr = new float[1];
fArr[0] = this.checked ? 1.0f : 0.0f;
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this, "checkedState", fArr);
this.checkAnimator = ofFloat;
ofFloat.setDuration(200L);
this.checkAnimator.start();
return;
}
setCheckedState(this.checked ? 1.0f : 0.0f);
}
@Keep
public void setCheckedState(float state) {
this.checkedState = state;
invalidate();
}
@Keep
public float getCheckedState() {
return this.checkedState;
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
updateCheckedState(false);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(62.0f), 1073741824), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(62.0f), 1073741824));
}
@Override
public void onDraw(Canvas canvas) {
float dp = AndroidUtilities.dp(20.0f);
float measuredWidth = getMeasuredWidth() * 0.5f;
float measuredHeight = getMeasuredHeight() * 0.5f;
this.paint.setColor(this.currentAccent.accentColor);
this.paint.setStyle(Paint.Style.STROKE);
this.paint.setStrokeWidth(AndroidUtilities.dp(3.0f));
this.paint.setAlpha(Math.round(this.checkedState * 255.0f));
canvas.drawCircle(measuredWidth, measuredHeight, dp - (this.paint.getStrokeWidth() * 0.5f), this.paint);
this.paint.setAlpha(255);
this.paint.setStyle(Paint.Style.FILL);
canvas.drawCircle(measuredWidth, measuredHeight, dp - (AndroidUtilities.dp(5.0f) * this.checkedState), this.paint);
if (this.checkedState != 0.0f) {
this.paint.setColor(-1);
this.paint.setAlpha(Math.round(this.checkedState * 255.0f));
canvas.drawCircle(measuredWidth, measuredHeight, AndroidUtilities.dp(2.0f), this.paint);
canvas.drawCircle(measuredWidth - (AndroidUtilities.dp(7.0f) * this.checkedState), measuredHeight, AndroidUtilities.dp(2.0f), this.paint);
canvas.drawCircle((AndroidUtilities.dp(7.0f) * this.checkedState) + measuredWidth, measuredHeight, AndroidUtilities.dp(2.0f), this.paint);
}
int i = this.currentAccent.myMessagesAccentColor;
if (i == 0 || this.checkedState == 1.0f) {
return;
}
this.paint.setColor(i);
canvas.drawCircle(measuredWidth, measuredHeight, AndroidUtilities.dp(8.0f) * (1.0f - this.checkedState), this.paint);
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setText(LocaleController.getString("ColorPickerMainColor", R.string.ColorPickerMainColor));
info.setClassName(Button.class.getName());
info.setChecked(this.checked);
info.setCheckable(true);
info.setEnabled(true);
}
}
public static class InnerCustomAccentView extends View {
public int[] colors;
public final Paint paint;
public InnerCustomAccentView(Context context) {
super(context);
this.paint = new Paint(1);
this.colors = new int[7];
}
public final void setTheme(Theme.ThemeInfo themeInfo) {
if (themeInfo.defaultAccentCount >= 8) {
this.colors = new int[]{themeInfo.getAccentColor(6), themeInfo.getAccentColor(4), themeInfo.getAccentColor(7), themeInfo.getAccentColor(2), themeInfo.getAccentColor(0), themeInfo.getAccentColor(5), themeInfo.getAccentColor(3)};
} else {
this.colors = new int[7];
}
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(62.0f), 1073741824), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(62.0f), 1073741824));
}
@Override
public void onDraw(Canvas canvas) {
float measuredWidth = getMeasuredWidth() * 0.5f;
float measuredHeight = getMeasuredHeight() * 0.5f;
float dp = AndroidUtilities.dp(5.0f);
float dp2 = AndroidUtilities.dp(20.0f) - dp;
this.paint.setStyle(Paint.Style.FILL);
int i = 0;
this.paint.setColor(this.colors[0]);
canvas.drawCircle(measuredWidth, measuredHeight, dp, this.paint);
double d = 0.0d;
while (i < 6) {
float sin = (((float) Math.sin(d)) * dp2) + measuredWidth;
float cos = measuredHeight - (((float) Math.cos(d)) * dp2);
i++;
this.paint.setColor(this.colors[i]);
canvas.drawCircle(sin, cos, dp, this.paint);
d += 1.0471975511965976d;
}
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setText(LocaleController.getString("ColorPickerMainColor", R.string.ColorPickerMainColor));
info.setClassName(Button.class.getName());
info.setEnabled(true);
}
}
public class ThemeAccentsListAdapter extends RecyclerListView.SelectionAdapter {
public Theme.ThemeInfo currentTheme;
public Context mContext;
public ArrayList<Theme.ThemeAccent> themeAccents;
public boolean isEnabled(RecyclerView.ViewHolder holder) {
return false;
}
public ThemeAccentsListAdapter(Context context) {
this.mContext = context;
notifyDataSetChanged();
}
public void notifyDataSetChanged() {
this.currentTheme = ThemeActivity.this.currentType == 1 ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme();
this.themeAccents = new ArrayList<>(this.currentTheme.themeAccents);
super/*androidx.recyclerview.widget.RecyclerView.Adapter*/.notifyDataSetChanged();
}
public int getItemViewType(int position) {
return position == getItemCount() - 1 ? 1 : 0;
}
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == 0) {
return new RecyclerListView.Holder(new InnerAccentView(this.mContext));
}
return new RecyclerListView.Holder(new InnerCustomAccentView(this.mContext));
}
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
int itemViewType = getItemViewType(position);
if (itemViewType == 0) {
((InnerAccentView) holder.itemView).setThemeAndColor(this.currentTheme, this.themeAccents.get(position));
} else {
if (itemViewType != 1) {
return;
}
((InnerCustomAccentView) holder.itemView).setTheme(this.currentTheme);
}
}
public int getItemCount() {
if (this.themeAccents.isEmpty()) {
return 0;
}
return this.themeAccents.size() + 1;
}
public final int findCurrentAccent() {
return this.themeAccents.indexOf(this.currentTheme.getAccent(false));
}
}
public class ListAdapter extends RecyclerListView.SelectionAdapter {
public boolean first = true;
public Context mContext;
public ListAdapter(Context context) {
this.mContext = context;
}
public int getItemCount() {
return ThemeActivity.this.rowCount;
}
public boolean isEnabled(RecyclerView.ViewHolder holder) {
int itemViewType = holder.getItemViewType();
return itemViewType == 0 || itemViewType == 1 || itemViewType == 4 || itemViewType == 7 || itemViewType == 10 || itemViewType == 11 || itemViewType == 12 || itemViewType == 14 || itemViewType == 18 || itemViewType == 20 || itemViewType == 21;
}
public final void showOptionsForTheme(final Theme.ThemeInfo themeInfo) {
int[] iArr;
CharSequence[] charSequenceArr;
if (ThemeActivity.this.getParentActivity() != null) {
if ((themeInfo.info == null || themeInfo.themeLoaded) && ThemeActivity.this.currentType != 1) {
AlertDialog.Builder builder = new AlertDialog.Builder(ThemeActivity.this.getParentActivity());
boolean z = false;
if (themeInfo.pathToFile == null) {
charSequenceArr = new CharSequence[]{null, LocaleController.getString("ExportTheme", R.string.ExportTheme)};
iArr = new int[]{0, R.drawable.msg_shareout};
} else {
TLRPC.TL_theme tL_theme = themeInfo.info;
boolean z2 = tL_theme == null || !tL_theme.isDefault;
CharSequence[] charSequenceArr2 = new CharSequence[5];
charSequenceArr2[0] = LocaleController.getString("ShareFile", R.string.ShareFile);
charSequenceArr2[1] = LocaleController.getString("ExportTheme", R.string.ExportTheme);
TLRPC.TL_theme tL_theme2 = themeInfo.info;
charSequenceArr2[2] = (tL_theme2 == null || (!tL_theme2.isDefault && tL_theme2.creator)) ? LocaleController.getString("Edit", R.string.Edit) : null;
TLRPC.TL_theme tL_theme3 = themeInfo.info;
charSequenceArr2[3] = (tL_theme3 == null || !tL_theme3.creator) ? null : LocaleController.getString("ThemeSetUrl", R.string.ThemeSetUrl);
charSequenceArr2[4] = z2 ? LocaleController.getString("Delete", R.string.Delete) : null;
z = z2;
iArr = new int[]{R.drawable.msg_share, R.drawable.msg_shareout, R.drawable.msg_edit, R.drawable.msg_link, R.drawable.msg_delete};
charSequenceArr = charSequenceArr2;
}
builder.setItems(charSequenceArr, iArr, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ThemeActivity.ListAdapter.this.lambda$showOptionsForTheme$1(themeInfo, dialogInterface, i);
}
});
AlertDialog create = builder.create();
ThemeActivity.this.showDialog(create);
if (z) {
create.setItemColor(create.getItemsCount() - 1, Theme.getColor(Theme.key_text_RedBold), Theme.getColor(Theme.key_text_RedRegular));
}
}
}
}
public void lambda$showOptionsForTheme$1(final org.telegram.ui.ActionBar.Theme.ThemeInfo r8, android.content.DialogInterface r9, int r10) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.ThemeActivity.ListAdapter.lambda$showOptionsForTheme$1(org.telegram.ui.ActionBar.Theme$ThemeInfo, android.content.DialogInterface, int):void");
}
public void lambda$showOptionsForTheme$0(Theme.ThemeInfo themeInfo, DialogInterface dialogInterface, int i) {
MessagesController.getInstance(themeInfo.account).saveTheme(themeInfo, (Theme.ThemeAccent) null, themeInfo == Theme.getCurrentNightTheme(), true);
if (Theme.deleteTheme(themeInfo)) {
((BaseFragment) ThemeActivity.this).parentLayout.rebuildAllFragmentViews(true, true);
}
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.themeListUpdated, new Object[0]);
}
public void lambda$onCreateViewHolder$2(ThemeAccentsListAdapter themeAccentsListAdapter, RecyclerListView recyclerListView, View view, int i) {
if (Theme.usePlusTheme) {
Theme.setUsePlusThemeKey(false);
}
Theme.ThemeInfo currentNightTheme = ThemeActivity.this.currentType == 1 ? Theme.getCurrentNightTheme() : Theme.getCurrentTheme();
if (i == themeAccentsListAdapter.getItemCount() - 1) {
ThemeActivity themeActivity = ThemeActivity.this;
themeActivity.presentFragment(new ThemePreviewActivity(currentNightTheme, false, 1, false, themeActivity.currentType == 1));
} else {
Theme.ThemeAccent themeAccent = (Theme.ThemeAccent) themeAccentsListAdapter.themeAccents.get(i);
if (!TextUtils.isEmpty(themeAccent.patternSlug) && themeAccent.id != Theme.DEFALT_THEME_ACCENT_ID) {
Theme.PatternsLoader.createLoader(false);
}
int i2 = currentNightTheme.currentAccentId;
int i3 = themeAccent.id;
if (i2 != i3) {
NotificationCenter globalInstance = NotificationCenter.getGlobalInstance();
int i4 = NotificationCenter.needSetDayNightTheme;
Object[] objArr = new Object[4];
objArr[0] = currentNightTheme;
objArr[1] = Boolean.valueOf(ThemeActivity.this.currentType == 1);
objArr[2] = null;
objArr[3] = Integer.valueOf(themeAccent.id);
globalInstance.postNotificationName(i4, objArr);
EmojiThemes.saveCustomTheme(currentNightTheme, themeAccent.id);
Theme.turnOffAutoNight(ThemeActivity.this);
} else {
ThemeActivity themeActivity2 = ThemeActivity.this;
themeActivity2.presentFragment(new ThemePreviewActivity(currentNightTheme, false, 1, i3 >= 100, themeActivity2.currentType == 1));
}
}
int left = view.getLeft();
int right = view.getRight();
int dp = AndroidUtilities.dp(52.0f);
int i5 = left - dp;
if (i5 < 0) {
recyclerListView.smoothScrollBy(i5, 0);
} else {
int i6 = right + dp;
if (i6 > recyclerListView.getMeasuredWidth()) {
recyclerListView.smoothScrollBy(i6 - recyclerListView.getMeasuredWidth(), 0);
}
}
int childCount = recyclerListView.getChildCount();
for (int i7 = 0; i7 < childCount; i7++) {
View childAt = recyclerListView.getChildAt(i7);
if (childAt instanceof InnerAccentView) {
((InnerAccentView) childAt).updateCheckedState(true);
}
}
}
public boolean lambda$onCreateViewHolder$5(final ThemeAccentsListAdapter themeAccentsListAdapter, View view, int i) {
if (i >= 0 && i < themeAccentsListAdapter.themeAccents.size()) {
final Theme.ThemeAccent themeAccent = (Theme.ThemeAccent) themeAccentsListAdapter.themeAccents.get(i);
if (themeAccent.id >= 100 && !themeAccent.isDefault) {
AlertDialog.Builder builder = new AlertDialog.Builder(ThemeActivity.this.getParentActivity());
CharSequence[] charSequenceArr = new CharSequence[4];
charSequenceArr[0] = LocaleController.getString("OpenInEditor", R.string.OpenInEditor);
charSequenceArr[1] = LocaleController.getString("ShareTheme", R.string.ShareTheme);
TLRPC.TL_theme tL_theme = themeAccent.info;
charSequenceArr[2] = (tL_theme == null || !tL_theme.creator) ? null : LocaleController.getString("ThemeSetUrl", R.string.ThemeSetUrl);
charSequenceArr[3] = LocaleController.getString("DeleteTheme", R.string.DeleteTheme);
builder.setItems(charSequenceArr, new int[]{R.drawable.msg_edit, R.drawable.msg_share, R.drawable.msg_link, R.drawable.msg_delete}, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
ThemeActivity.ListAdapter.this.lambda$onCreateViewHolder$4(themeAccent, themeAccentsListAdapter, dialogInterface, i2);
}
});
AlertDialog create = builder.create();
ThemeActivity.this.showDialog(create);
create.setItemColor(create.getItemsCount() - 1, Theme.getColor(Theme.key_text_RedBold), Theme.getColor(Theme.key_text_RedRegular));
return true;
}
}
return false;
}
public void lambda$onCreateViewHolder$4(final Theme.ThemeAccent themeAccent, final ThemeAccentsListAdapter themeAccentsListAdapter, DialogInterface dialogInterface, int i) {
if (ThemeActivity.this.getParentActivity() == null) {
return;
}
if (i == 0) {
AlertsCreator.createThemeCreateDialog(ThemeActivity.this, i != 1 ? 1 : 2, themeAccent.parentTheme, themeAccent);
return;
}
if (i == 1) {
if (themeAccent.info == null) {
ThemeActivity.this.getMessagesController().saveThemeToServer(themeAccent.parentTheme, themeAccent);
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needShareTheme, new Object[]{themeAccent.parentTheme, themeAccent});
return;
}
String str = "https://" + ThemeActivity.this.getMessagesController().linkPrefix + "/addtheme/" + themeAccent.info.slug;
ThemeActivity.this.showDialog(new ShareAlert(ThemeActivity.this.getParentActivity(), (ArrayList) null, str, false, str, false));
return;
}
if (i == 2) {
ThemeActivity.this.presentFragment(new ThemeSetUrlActivity(themeAccent.parentTheme, themeAccent, false));
return;
}
if (i != 3 || ThemeActivity.this.getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(ThemeActivity.this.getParentActivity());
builder.setTitle(LocaleController.getString("DeleteThemeTitle", R.string.DeleteThemeTitle));
builder.setMessage(LocaleController.getString("DeleteThemeAlert", R.string.DeleteThemeAlert));
builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface2, int i2) {
ThemeActivity.ListAdapter.this.lambda$onCreateViewHolder$3(themeAccentsListAdapter, themeAccent, dialogInterface2, i2);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
AlertDialog create = builder.create();
ThemeActivity.this.showDialog(create);
TextView textView = (TextView) create.getButton(-1);
if (textView != null) {
textView.setTextColor(Theme.getColor(Theme.key_text_RedBold));
}
}
public void lambda$onCreateViewHolder$3(ThemeAccentsListAdapter themeAccentsListAdapter, Theme.ThemeAccent themeAccent, DialogInterface dialogInterface, int i) {
if (Theme.deleteThemeAccent(themeAccentsListAdapter.currentTheme, themeAccent, true)) {
Theme.refreshThemeColors();
NotificationCenter globalInstance = NotificationCenter.getGlobalInstance();
int i2 = NotificationCenter.needSetDayNightTheme;
Object[] objArr = new Object[4];
objArr[0] = Theme.getActiveTheme();
objArr[1] = Boolean.valueOf(ThemeActivity.this.currentType == 1);
objArr[2] = null;
objArr[3] = -1;
globalInstance.postNotificationName(i2, objArr);
}
}
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
final SwipeGestureSettingsView textSettingsCell;
int i = 0;
switch (viewType) {
case 1:
textSettingsCell = new TextSettingsCell(this.mContext);
textSettingsCell.setBackgroundColor(Theme.usePlusTheme ? Theme.prefBGColor : Theme.getColor(Theme.key_windowBackgroundWhite));
break;
case 2:
textSettingsCell = new TextInfoPrivacyCell(this.mContext);
textSettingsCell.setBackground(Theme.getThemedDrawableByKey(this.mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
break;
case 3:
textSettingsCell = new ShadowSectionCell(this.mContext);
break;
case 4:
textSettingsCell = new ThemeTypeCell(this.mContext);
textSettingsCell.setBackgroundColor(Theme.usePlusTheme ? Theme.prefBGColor : Theme.getColor(Theme.key_windowBackgroundWhite));
break;
case 5:
textSettingsCell = new HeaderCell(this.mContext);
textSettingsCell.setBackgroundColor(Theme.usePlusTheme ? Theme.prefBGColor : Theme.getColor(Theme.key_windowBackgroundWhite));
break;
case 6:
textSettingsCell = new BrightnessControlCell(this.mContext, i) {
@Override
public void didChangedValue(float value) {
int i2 = (int) (Theme.autoNightBrighnessThreshold * 100.0f);
int i3 = (int) (value * 100.0f);
Theme.autoNightBrighnessThreshold = value;
if (i2 != i3) {
RecyclerListView.Holder findViewHolderForAdapterPosition = ThemeActivity.this.listView.findViewHolderForAdapterPosition(ThemeActivity.this.automaticBrightnessInfoRow);
if (findViewHolderForAdapterPosition != null) {
((TextInfoPrivacyCell) ((RecyclerView.ViewHolder) findViewHolderForAdapterPosition).itemView).setText(LocaleController.formatString("AutoNightBrightnessInfo", R.string.AutoNightBrightnessInfo, new Object[]{Integer.valueOf((int) (Theme.autoNightBrighnessThreshold * 100.0f))}));
}
Theme.checkAutoNightThemeConditions(true);
}
}
};
textSettingsCell.setBackgroundColor(Theme.usePlusTheme ? Theme.prefBGColor : Theme.getColor(Theme.key_windowBackgroundWhite));
break;
case 7:
textSettingsCell = new TextCheckCell(this.mContext);
textSettingsCell.setBackgroundColor(Theme.usePlusTheme ? Theme.prefBGColor : Theme.getColor(Theme.key_windowBackgroundWhite));
break;
case 8:
textSettingsCell = ThemeActivity.this.new TextSizeCell(this.mContext);
textSettingsCell.setBackgroundColor(Theme.usePlusTheme ? Theme.prefBGColor : Theme.getColor(Theme.key_windowBackgroundWhite));
break;
case 9:
textSettingsCell = new ChatListCell(this, this.mContext) {
@Override
public void didSelectChatType(boolean threeLines) {
SharedConfig.setUseThreeLinesLayout(threeLines);
}
};
textSettingsCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
break;
case 10:
SwipeGestureSettingsView notificationsCheckCell = new NotificationsCheckCell(this.mContext, 21, 60, true);
notificationsCheckCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
textSettingsCell = notificationsCheckCell;
break;
case 11:
this.first = true;
ThemeActivity themeActivity = ThemeActivity.this;
Context context = this.mContext;
ThemeActivity themeActivity2 = ThemeActivity.this;
themeActivity.themesHorizontalListCell = new ThemesHorizontalListCell(context, themeActivity2, themeActivity2.currentType, ThemeActivity.this.defaultThemes, ThemeActivity.this.darkThemes) {
@Override
public void showOptionsForTheme(Theme.ThemeInfo themeInfo) {
ThemeActivity.this.listAdapter.showOptionsForTheme(themeInfo);
}
@Override
public void updateRows() {
ThemeActivity.this.updateRows(false);
}
};
ThemeActivity.this.themesHorizontalListCell.setDrawDivider(ThemeActivity.this.hasThemeAccents);
ThemeActivity.this.themesHorizontalListCell.setFocusable(false);
textSettingsCell = ThemeActivity.this.themesHorizontalListCell;
textSettingsCell.setLayoutParams(new RecyclerView.LayoutParams(-1, AndroidUtilities.dp(148.0f)));
break;
case 12:
textSettingsCell = new TintRecyclerListView(this, this.mContext) {
public boolean onInterceptTouchEvent(MotionEvent e) {
if (getParent() != null && getParent().getParent() != null) {
getParent().getParent().requestDisallowInterceptTouchEvent(canScrollHorizontally(-1));
}
return super.onInterceptTouchEvent(e);
}
};
textSettingsCell.setFocusable(false);
textSettingsCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
textSettingsCell.setItemAnimator((RecyclerView.ItemAnimator) null);
textSettingsCell.setLayoutAnimation(null);
textSettingsCell.setPadding(AndroidUtilities.dp(11.0f), 0, AndroidUtilities.dp(11.0f), 0);
textSettingsCell.setClipToPadding(false);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this.mContext);
linearLayoutManager.setOrientation(0);
textSettingsCell.setLayoutManager(linearLayoutManager);
final ThemeAccentsListAdapter themeAccentsListAdapter = ThemeActivity.this.new ThemeAccentsListAdapter(this.mContext);
textSettingsCell.setAdapter(themeAccentsListAdapter);
textSettingsCell.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
public final void onItemClick(View view, int i2) {
ThemeActivity.ListAdapter.this.lambda$onCreateViewHolder$2(themeAccentsListAdapter, textSettingsCell, view, i2);
}
});
textSettingsCell.setOnItemLongClickListener(new RecyclerListView.OnItemLongClickListener() {
public final boolean onItemClick(View view, int i2) {
boolean lambda$onCreateViewHolder$5;
lambda$onCreateViewHolder$5 = ThemeActivity.ListAdapter.this.lambda$onCreateViewHolder$5(themeAccentsListAdapter, view, i2);
return lambda$onCreateViewHolder$5;
}
});
textSettingsCell.setLayoutParams(new RecyclerView.LayoutParams(-1, AndroidUtilities.dp(62.0f)));
break;
case 13:
textSettingsCell = ThemeActivity.this.new BubbleRadiusCell(this.mContext);
textSettingsCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
break;
case 14:
case 18:
default:
textSettingsCell = new TextCell(this.mContext);
textSettingsCell.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
break;
case 15:
textSettingsCell = new SwipeGestureSettingsView(this.mContext, ((BaseFragment) ThemeActivity.this).currentAccount);
break;
case 16:
textSettingsCell = new ThemePreviewMessagesCell(this, this.mContext, ((BaseFragment) ThemeActivity.this).parentLayout, i) {
@Override
public boolean onInterceptTouchEvent(MotionEvent e) {
if (getParent() != null && getParent().getParent() != null) {
getParent().getParent().requestDisallowInterceptTouchEvent(canScrollHorizontally(-1));
}
return super.onInterceptTouchEvent(e);
}
};
if (Build.VERSION.SDK_INT >= 19) {
textSettingsCell.setImportantForAccessibility(4);
break;
}
break;
case 17:
Context context2 = this.mContext;
ThemeActivity themeActivity3 = ThemeActivity.this;
textSettingsCell = new DefaultThemesPreviewCell(context2, themeActivity3, themeActivity3.currentType);
textSettingsCell.setFocusable(false);
textSettingsCell.setLayoutParams(new RecyclerView.LayoutParams(-1, -2));
break;
case 19:
textSettingsCell = new RadioButtonCell(this.mContext);
break;
case 20:
Context context3 = this.mContext;
ThemeActivity themeActivity4 = ThemeActivity.this;
textSettingsCell = new AppIconsSelectorCell(context3, themeActivity4, ((BaseFragment) themeActivity4).currentAccount);
break;
case 21:
textSettingsCell = new PeerColorActivity.ChangeNameColorCell(((BaseFragment) ThemeActivity.this).currentAccount, 0L, this.mContext, ThemeActivity.this.getResourceProvider());
break;
}
return new RecyclerListView.Holder(textSettingsCell);
}
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
String string;
String string2;
String string3;
switch (holder.getItemViewType()) {
case 1:
TextSettingsCell textSettingsCell = (TextSettingsCell) holder.itemView;
if (position == ThemeActivity.this.nightThemeRow) {
if (Theme.selectedAutoNightType == 0 || Theme.getCurrentNightTheme() == null) {
textSettingsCell.setTextAndValue(LocaleController.getString("AutoNightTheme", R.string.AutoNightTheme), LocaleController.getString("AutoNightThemeOff", R.string.AutoNightThemeOff), false);
break;
} else {
textSettingsCell.setTextAndValue(LocaleController.getString("AutoNightTheme", R.string.AutoNightTheme), Theme.getCurrentNightThemeName(), false);
break;
}
} else if (position == ThemeActivity.this.scheduleFromRow) {
int i = Theme.autoNightDayStartTime;
int i2 = i / 60;
textSettingsCell.setTextAndValue(LocaleController.getString("AutoNightFrom", R.string.AutoNightFrom), String.format("%02d:%02d", Integer.valueOf(i2), Integer.valueOf(i - (i2 * 60))), true);
break;
} else if (position == ThemeActivity.this.scheduleToRow) {
int i3 = Theme.autoNightDayEndTime;
int i4 = i3 / 60;
textSettingsCell.setTextAndValue(LocaleController.getString("AutoNightTo", R.string.AutoNightTo), String.format("%02d:%02d", Integer.valueOf(i4), Integer.valueOf(i3 - (i4 * 60))), false);
break;
} else if (position == ThemeActivity.this.scheduleUpdateLocationRow) {
textSettingsCell.setTextAndValue(LocaleController.getString("AutoNightUpdateLocation", R.string.AutoNightUpdateLocation), Theme.autoNightCityName, false);
break;
} else if (position == ThemeActivity.this.contactsSortRow) {
int i5 = MessagesController.getGlobalMainSettings().getInt("sortContactsBy", 0);
if (i5 == 0) {
string2 = LocaleController.getString("Default", R.string.Default);
} else if (i5 == 1) {
string2 = LocaleController.getString("FirstName", R.string.SortFirstName);
} else {
string2 = LocaleController.getString("LastName", R.string.SortLastName);
}
textSettingsCell.setTextAndValue(LocaleController.getString("SortBy", R.string.SortBy), string2, true);
break;
} else if (position == ThemeActivity.this.contactsReimportRow) {
textSettingsCell.setText(LocaleController.getString("ImportContacts", R.string.ImportContacts), true);
break;
} else if (position == ThemeActivity.this.distanceRow) {
int i6 = SharedConfig.distanceSystemType;
if (i6 == 0) {
string = LocaleController.getString("DistanceUnitsAutomatic", R.string.DistanceUnitsAutomatic);
} else if (i6 == 1) {
string = LocaleController.getString("DistanceUnitsKilometers", R.string.DistanceUnitsKilometers);
} else {
string = LocaleController.getString("DistanceUnitsMiles", R.string.DistanceUnitsMiles);
}
textSettingsCell.setTextAndValue(LocaleController.getString("DistanceUnits", R.string.DistanceUnits), string, ThemeActivity.this.updateDistance, false);
ThemeActivity.this.updateDistance = false;
break;
} else if (position == ThemeActivity.this.bluetoothScoRow) {
textSettingsCell.setTextAndValue(LocaleController.getString(R.string.MicrophoneForVoiceMessages), LocaleController.getString(SharedConfig.recordViaSco ? R.string.MicrophoneForVoiceMessagesSco : R.string.MicrophoneForVoiceMessagesBuiltIn), ThemeActivity.this.updateRecordViaSco, false);
ThemeActivity.this.updateRecordViaSco = false;
break;
} else if (position == ThemeActivity.this.downloadThemesRow) {
textSettingsCell.setText(LocaleController.getString("DownloadNewThemes", R.string.DownloadNewThemes), true);
break;
} else if (position == ThemeActivity.this.uploadThemesRow) {
textSettingsCell.setText(LocaleController.getString("UploadThemes", R.string.UploadThemes), true);
break;
}
break;
case 2:
TextInfoPrivacyCell textInfoPrivacyCell = (TextInfoPrivacyCell) holder.itemView;
textInfoPrivacyCell.setFixedSize(0);
if (position != ThemeActivity.this.automaticBrightnessInfoRow) {
if (position == ThemeActivity.this.scheduleLocationInfoRow) {
textInfoPrivacyCell.setText(ThemeActivity.this.getLocationSunString());
break;
} else if (position == ThemeActivity.this.swipeGestureInfoRow) {
textInfoPrivacyCell.setText(LocaleController.getString("ChatListSwipeGestureInfo", R.string.ChatListSwipeGestureInfo));
break;
} else if (position == ThemeActivity.this.liteModeInfoRow) {
textInfoPrivacyCell.setText(LocaleController.getString("LiteModeInfo", R.string.LiteModeInfo));
break;
} else {
textInfoPrivacyCell.setFixedSize(12);
textInfoPrivacyCell.setText("");
break;
}
} else {
textInfoPrivacyCell.setText(LocaleController.formatString("AutoNightBrightnessInfo", R.string.AutoNightBrightnessInfo, new Object[]{Integer.valueOf((int) (Theme.autoNightBrighnessThreshold * 100.0f))}));
break;
}
case 3:
if ((position == ThemeActivity.this.nightTypeInfoRow && ThemeActivity.this.themeInfoRow == -1) || position == ThemeActivity.this.lastShadowRow || ((position == ThemeActivity.this.themeInfoRow && ThemeActivity.this.nightTypeInfoRow != -1) || position == ThemeActivity.this.saveToGallerySectionRow || position == ThemeActivity.this.settings2Row)) {
holder.itemView.setBackground(Theme.getThemedDrawableByKey(this.mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
break;
} else {
holder.itemView.setBackground(Theme.getThemedDrawableByKey(this.mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
break;
}
break;
case 4:
ThemeTypeCell themeTypeCell = (ThemeTypeCell) holder.itemView;
if (position == ThemeActivity.this.nightDisabledRow) {
themeTypeCell.setValue(LocaleController.getString("AutoNightDisabled", R.string.AutoNightDisabled), Theme.selectedAutoNightType == 0, true);
break;
} else if (position == ThemeActivity.this.nightScheduledRow) {
themeTypeCell.setValue(LocaleController.getString("AutoNightScheduled", R.string.AutoNightScheduled), Theme.selectedAutoNightType == 1, true);
break;
} else if (position == ThemeActivity.this.nightAutomaticRow) {
themeTypeCell.setValue(LocaleController.getString("AutoNightAdaptive", R.string.AutoNightAdaptive), Theme.selectedAutoNightType == 2, ThemeActivity.this.nightSystemDefaultRow != -1);
break;
} else if (position == ThemeActivity.this.nightSystemDefaultRow) {
themeTypeCell.setValue(LocaleController.getString("AutoNightSystemDefault", R.string.AutoNightSystemDefault), Theme.selectedAutoNightType == 3, false);
break;
}
break;
case 5:
HeaderCell headerCell = (HeaderCell) holder.itemView;
if (position == ThemeActivity.this.scheduleHeaderRow) {
headerCell.setText(LocaleController.getString("AutoNightSchedule", R.string.AutoNightSchedule));
break;
} else if (position == ThemeActivity.this.automaticHeaderRow) {
headerCell.setText(LocaleController.getString("AutoNightBrightness", R.string.AutoNightBrightness));
break;
} else if (position == ThemeActivity.this.preferedHeaderRow) {
headerCell.setText(LocaleController.getString("AutoNightPreferred", R.string.AutoNightPreferred));
break;
} else if (position == ThemeActivity.this.settingsRow) {
headerCell.setText(LocaleController.getString("SETTINGS", R.string.SETTINGS));
break;
} else if (position == ThemeActivity.this.themeHeaderRow) {
if (ThemeActivity.this.currentType == 3) {
headerCell.setText(LocaleController.getString("BuildMyOwnTheme", R.string.BuildMyOwnTheme));
break;
} else {
headerCell.setText(LocaleController.getString("ColorTheme", R.string.ColorTheme));
break;
}
} else if (position == ThemeActivity.this.textSizeHeaderRow) {
headerCell.setText(LocaleController.getString("TextSizeHeader", R.string.TextSizeHeader));
break;
} else if (position == ThemeActivity.this.chatListHeaderRow) {
headerCell.setText(LocaleController.getString("ChatList", R.string.ChatList));
break;
} else if (position == ThemeActivity.this.bubbleRadiusHeaderRow) {
headerCell.setText(LocaleController.getString("BubbleRadius", R.string.BubbleRadius));
break;
} else if (position == ThemeActivity.this.swipeGestureHeaderRow) {
headerCell.setText(LocaleController.getString("ChatListSwipeGesture", R.string.ChatListSwipeGesture));
break;
} else if (position == ThemeActivity.this.selectThemeHeaderRow) {
headerCell.setText(LocaleController.getString("SelectTheme", R.string.SelectTheme));
break;
} else if (position == ThemeActivity.this.appIconHeaderRow) {
headerCell.setText(LocaleController.getString(R.string.AppIcon));
break;
} else if (position == ThemeActivity.this.otherHeaderRow) {
headerCell.setText(LocaleController.getString("OtherSettings", R.string.OtherSettings));
break;
} else if (position == ThemeActivity.this.mediaSoundHeaderRow) {
headerCell.setText(LocaleController.getString("MediaAndSoundSettings", R.string.MediaAndSoundSettings));
break;
}
break;
case 6:
((BrightnessControlCell) holder.itemView).setProgress(Theme.autoNightBrighnessThreshold);
break;
case 7:
TextCheckCell textCheckCell = (TextCheckCell) holder.itemView;
if (position == ThemeActivity.this.scheduleLocationRow) {
textCheckCell.setTextAndCheck(LocaleController.getString("AutoNightLocation", R.string.AutoNightLocation), Theme.autoNightScheduleByLocation, true);
break;
} else if (position == ThemeActivity.this.enableAnimationsRow) {
textCheckCell.setTextAndCheck(LocaleController.getString("EnableAnimations", R.string.EnableAnimations), MessagesController.getGlobalMainSettings().getBoolean("view_animations", true), true);
break;
} else if (position == ThemeActivity.this.sendByEnterRow) {
textCheckCell.setTextAndCheck(LocaleController.getString("SendByEnter", R.string.SendByEnter), MessagesController.getGlobalMainSettings().getBoolean("send_by_enter", false), true);
break;
} else if (position == ThemeActivity.this.raiseToSpeakRow) {
textCheckCell.setTextAndValueAndCheck(LocaleController.getString("RaiseToSpeak", R.string.RaiseToSpeak), LocaleController.getString("RaiseToSpeakInfo", R.string.RaiseToSpeakInfo), SharedConfig.raiseToSpeak, true, true);
break;
} else if (position == ThemeActivity.this.raiseToListenRow) {
textCheckCell.setTextAndValueAndCheck(LocaleController.getString("RaiseToListen", R.string.RaiseToListen), LocaleController.getString("RaiseToListenInfo", R.string.RaiseToListenInfo), SharedConfig.raiseToListen, true, true);
break;
} else if (position == ThemeActivity.this.nextMediaTapRow) {
textCheckCell.setTextAndValueAndCheck(LocaleController.getString("NextMediaTap", R.string.NextMediaTap), LocaleController.getString("NextMediaTapInfo", R.string.NextMediaTapInfo), SharedConfig.nextMediaTap, true, true);
break;
} else if (position == ThemeActivity.this.pauseOnRecordRow) {
textCheckCell.setTextAndValueAndCheck(LocaleController.getString(R.string.PauseMusicOnRecord), LocaleController.getString("PauseMusicOnRecordInfo", R.string.PauseMusicOnRecordInfo), SharedConfig.pauseMusicOnRecord, true, true);
break;
} else if (position == ThemeActivity.this.pauseOnMediaRow) {
textCheckCell.setTextAndCheck(LocaleController.getString(R.string.PauseMusicOnMedia), SharedConfig.pauseMusicOnMedia, true);
break;
} else if (position == ThemeActivity.this.customTabsRow) {
textCheckCell.setTextAndValueAndCheck(LocaleController.getString("ChromeCustomTabs", R.string.ChromeCustomTabs), LocaleController.getString("ChromeCustomTabsInfo", R.string.ChromeCustomTabsInfo), SharedConfig.customTabs, false, true);
break;
} else if (position == ThemeActivity.this.directShareRow) {
textCheckCell.setTextAndValueAndCheck(LocaleController.getString("DirectShare", R.string.DirectShare), LocaleController.getString("DirectShareInfo", R.string.DirectShareInfo), SharedConfig.directShare, false, true);
break;
} else if (position == ThemeActivity.this.chatBlurRow) {
textCheckCell.setTextAndCheck(LocaleController.getString("BlurInChat", R.string.BlurInChat), SharedConfig.chatBlurEnabled(), true);
break;
}
break;
case 10:
NotificationsCheckCell notificationsCheckCell = (NotificationsCheckCell) holder.itemView;
if (position == ThemeActivity.this.nightThemeRow) {
boolean z = Theme.selectedAutoNightType != 0;
String currentNightThemeName = z ? Theme.getCurrentNightThemeName() : LocaleController.getString("AutoNightThemeOff", R.string.AutoNightThemeOff);
if (z) {
int i7 = Theme.selectedAutoNightType;
if (i7 == 1) {
string3 = LocaleController.getString("AutoNightScheduled", R.string.AutoNightScheduled);
} else if (i7 == 3) {
string3 = LocaleController.getString("AutoNightSystemDefault", R.string.AutoNightSystemDefault);
} else {
string3 = LocaleController.getString("AutoNightAdaptive", R.string.AutoNightAdaptive);
}
currentNightThemeName = string3 + " " + currentNightThemeName;
}
notificationsCheckCell.setTextAndValueAndIconAndCheck(LocaleController.getString("AutoNightTheme", R.string.AutoNightTheme), currentNightThemeName, R.drawable.msg2_night_auto, z, 0, false, true);
break;
}
break;
case 11:
if (this.first) {
ThemeActivity.this.themesHorizontalListCell.scrollToCurrentTheme(ThemeActivity.this.listView.getMeasuredWidth(), false);
this.first = false;
break;
}
break;
case 12:
RecyclerListView recyclerListView = holder.itemView;
ThemeAccentsListAdapter adapter = recyclerListView.getAdapter();
adapter.notifyDataSetChanged();
int findCurrentAccent = adapter.findCurrentAccent();
if (findCurrentAccent == -1) {
findCurrentAccent = adapter.getItemCount() - 1;
}
if (findCurrentAccent != -1) {
recyclerListView.getLayoutManager().scrollToPositionWithOffset(findCurrentAccent, (ThemeActivity.this.listView.getMeasuredWidth() / 2) - AndroidUtilities.dp(42.0f));
break;
}
break;
case 14:
TextCell textCell = (TextCell) holder.itemView;
textCell.heightDp = 48;
if (position == ThemeActivity.this.backgroundRow) {
textCell.setSubtitle(null);
int i8 = Theme.key_windowBackgroundWhiteBlueText4;
textCell.setColors(i8, i8);
textCell.setTextAndIcon(LocaleController.getString(R.string.ChangeChatBackground), R.drawable.msg_background, ThemeActivity.this.changeUserColor >= 0);
break;
} else if (position == ThemeActivity.this.editThemeRow) {
textCell.setSubtitle(null);
int i9 = Theme.key_windowBackgroundWhiteBlueText4;
textCell.setColors(i9, i9);
textCell.setTextAndIcon((CharSequence) LocaleController.getString("EditCurrentTheme", R.string.EditCurrentTheme), R.drawable.msg_theme, true);
break;
} else if (position == ThemeActivity.this.createNewThemeRow) {
textCell.setSubtitle(null);
int i10 = Theme.key_windowBackgroundWhiteBlueText4;
textCell.setColors(i10, i10);
textCell.setTextAndIcon((CharSequence) LocaleController.getString("CreateNewTheme", R.string.CreateNewTheme), R.drawable.msg_colors, false);
break;
} else if (position == ThemeActivity.this.liteModeRow) {
textCell.setColors(Theme.key_dialogIcon, Theme.key_windowBackgroundWhiteBlackText);
textCell.setTextAndIcon((CharSequence) LocaleController.getString("LiteMode", R.string.LiteMode), R.drawable.msg2_animations, true);
textCell.setSubtitle(LocaleController.getString("LiteModeInfo", R.string.LiteModeInfo));
textCell.heightDp = 60;
textCell.offsetFromImage = 64;
textCell.imageLeft = 20;
break;
} else if (position == ThemeActivity.this.stickersRow) {
textCell.setColors(Theme.key_dialogIcon, Theme.key_windowBackgroundWhiteBlackText);
textCell.setTextAndIcon((CharSequence) LocaleController.getString("StickersName", R.string.StickersName), R.drawable.msg2_sticker, false);
textCell.setSubtitle(LocaleController.getString("StickersNameInfo2", R.string.StickersNameInfo2));
textCell.offsetFromImage = 64;
textCell.heightDp = 60;
textCell.imageLeft = 20;
break;
}
break;
case 17:
((DefaultThemesPreviewCell) holder.itemView).updateDayNightMode();
break;
case 19:
RadioButtonCell radioButtonCell = (RadioButtonCell) holder.itemView;
if (position == ThemeActivity.this.saveToGalleryOption1Row) {
radioButtonCell.setTextAndValue("save media only from peer chats", "", true, false);
break;
} else {
radioButtonCell.setTextAndValue("save media from all chats", "", true, false);
break;
}
case 21:
((PeerColorActivity.ChangeNameColorCell) holder.itemView).set(ThemeActivity.this.getUserConfig().getCurrentUser());
break;
}
}
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
int itemViewType = holder.getItemViewType();
if (itemViewType == 4) {
((ThemeTypeCell) holder.itemView).setTypeChecked(holder.getAdapterPosition() == Theme.selectedAutoNightType);
}
if (itemViewType == 2 || itemViewType == 3) {
return;
}
holder.itemView.setBackgroundColor(Theme.usePlusTheme ? Theme.prefBGColor : Theme.getColor(Theme.key_windowBackgroundWhite));
}
public int getItemViewType(int position) {
if (position == ThemeActivity.this.scheduleFromRow || position == ThemeActivity.this.distanceRow || position == ThemeActivity.this.scheduleToRow || position == ThemeActivity.this.scheduleUpdateLocationRow || position == ThemeActivity.this.contactsReimportRow || position == ThemeActivity.this.contactsSortRow || position == ThemeActivity.this.bluetoothScoRow || position == ThemeActivity.this.downloadThemesRow || position == ThemeActivity.this.uploadThemesRow) {
return 1;
}
if (position == ThemeActivity.this.automaticBrightnessInfoRow || position == ThemeActivity.this.scheduleLocationInfoRow || position == ThemeActivity.this.swipeGestureInfoRow || position == ThemeActivity.this.stickersInfoRow || position == ThemeActivity.this.liteModeInfoRow) {
return 2;
}
if (position == ThemeActivity.this.themeInfoRow || position == ThemeActivity.this.nightTypeInfoRow || position == ThemeActivity.this.scheduleFromToInfoRow || position == ThemeActivity.this.settings2Row || position == ThemeActivity.this.newThemeInfoRow || position == ThemeActivity.this.chatListInfoRow || position == ThemeActivity.this.bubbleRadiusInfoRow || position == ThemeActivity.this.saveToGallerySectionRow || position == ThemeActivity.this.appIconShadowRow || position == ThemeActivity.this.lastShadowRow || position == ThemeActivity.this.stickersSectionRow || position == ThemeActivity.this.mediaSoundSectionRow || position == ThemeActivity.this.otherSectionRow) {
return 3;
}
if (position == ThemeActivity.this.nightDisabledRow || position == ThemeActivity.this.nightScheduledRow || position == ThemeActivity.this.nightAutomaticRow || position == ThemeActivity.this.nightSystemDefaultRow) {
return 4;
}
if (position == ThemeActivity.this.scheduleHeaderRow || position == ThemeActivity.this.automaticHeaderRow || position == ThemeActivity.this.preferedHeaderRow || position == ThemeActivity.this.settingsRow || position == ThemeActivity.this.themeHeaderRow || position == ThemeActivity.this.textSizeHeaderRow || position == ThemeActivity.this.chatListHeaderRow || position == ThemeActivity.this.bubbleRadiusHeaderRow || position == ThemeActivity.this.swipeGestureHeaderRow || position == ThemeActivity.this.selectThemeHeaderRow || position == ThemeActivity.this.appIconHeaderRow || position == ThemeActivity.this.mediaSoundHeaderRow || position == ThemeActivity.this.otherHeaderRow) {
return 5;
}
if (position == ThemeActivity.this.automaticBrightnessRow) {
return 6;
}
if (position == ThemeActivity.this.scheduleLocationRow || position == ThemeActivity.this.sendByEnterRow || position == ThemeActivity.this.raiseToSpeakRow || position == ThemeActivity.this.raiseToListenRow || position == ThemeActivity.this.pauseOnRecordRow || position == ThemeActivity.this.customTabsRow || position == ThemeActivity.this.directShareRow || position == ThemeActivity.this.chatBlurRow || position == ThemeActivity.this.pauseOnMediaRow || position == ThemeActivity.this.nextMediaTapRow) {
return 7;
}
if (position == ThemeActivity.this.textSizeRow) {
return 8;
}
if (position == ThemeActivity.this.chatListRow) {
return 9;
}
if (position == ThemeActivity.this.nightThemeRow) {
return 10;
}
if (position == ThemeActivity.this.themeListRow) {
return 11;
}
if (position == ThemeActivity.this.themeAccentListRow) {
return 12;
}
if (position == ThemeActivity.this.bubbleRadiusRow) {
return 13;
}
if (position == ThemeActivity.this.backgroundRow || position == ThemeActivity.this.editThemeRow || position == ThemeActivity.this.createNewThemeRow || position == ThemeActivity.this.liteModeRow || position == ThemeActivity.this.stickersRow) {
return 14;
}
if (position == ThemeActivity.this.swipeGestureRow) {
return 15;
}
if (position == ThemeActivity.this.themePreviewRow) {
return 16;
}
if (position == ThemeActivity.this.themeListRow2) {
return 17;
}
if (position == ThemeActivity.this.saveToGalleryOption1Row || position == ThemeActivity.this.saveToGalleryOption2Row) {
return 19;
}
if (position == ThemeActivity.this.appIconSelectorRow) {
return 20;
}
return position == ThemeActivity.this.changeUserColor ? 21 : 1;
}
}
public static abstract class TintRecyclerListView extends RecyclerListView {
public TintRecyclerListView(Context context) {
super(context);
}
}
public ArrayList<ThemeDescription> getThemeDescriptions() {
ArrayList<ThemeDescription> arrayList = new ArrayList<>();
int i = Theme.key_windowBackgroundWhite;
arrayList.add(new ThemeDescription(this.listView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{TextSettingsCell.class, TextCheckCell.class, HeaderCell.class, BrightnessControlCell.class, ThemeTypeCell.class, TextSizeCell.class, BubbleRadiusCell.class, ChatListCell.class, NotificationsCheckCell.class, ThemesHorizontalListCell.class, TintRecyclerListView.class, TextCell.class, PeerColorActivity.ChangeNameColorCell.class, SwipeGestureSettingsView.class, DefaultThemesPreviewCell.class, AppIconsSelectorCell.class}, null, null, null, i));
arrayList.add(new ThemeDescription(((BaseFragment) this).fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundGray));
ActionBar actionBar = ((BaseFragment) this).actionBar;
int i2 = ThemeDescription.FLAG_BACKGROUND;
int i3 = Theme.key_actionBarDefault;
arrayList.add(new ThemeDescription(actionBar, i2, null, null, null, null, i3));
arrayList.add(new ThemeDescription(this.listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, i3));
arrayList.add(new ThemeDescription(((BaseFragment) this).actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon));
arrayList.add(new ThemeDescription(((BaseFragment) this).actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle));
arrayList.add(new ThemeDescription(((BaseFragment) this).actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector));
arrayList.add(new ThemeDescription(((BaseFragment) this).actionBar, ThemeDescription.FLAG_AB_SUBMENUBACKGROUND, null, null, null, null, Theme.key_actionBarDefaultSubmenuBackground));
arrayList.add(new ThemeDescription(((BaseFragment) this).actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM, null, null, null, null, Theme.key_actionBarDefaultSubmenuItem));
arrayList.add(new ThemeDescription(((BaseFragment) this).actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM | ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_actionBarDefaultSubmenuItemIcon));
arrayList.add(new ThemeDescription(this.listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{View.class}, Theme.dividerPaint, null, null, Theme.key_divider));
int i4 = Theme.key_windowBackgroundGrayShadow;
arrayList.add(new ThemeDescription(this.listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ShadowSectionCell.class}, null, null, null, i4));
arrayList.add(new ThemeDescription(this.listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{TextInfoPrivacyCell.class}, null, null, null, i4));
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText4));
int i5 = Theme.key_windowBackgroundWhiteBlackText;
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{TextSettingsCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i5));
int i6 = Theme.key_windowBackgroundWhiteValueText;
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{TextSettingsCell.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i6));
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{HeaderCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteBlueHeader));
int i7 = Theme.key_windowBackgroundWhiteBlueText4;
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{TextCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i7));
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{TextCell.class}, new String[]{"imageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i7));
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{TextCheckCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i5));
int i8 = Theme.key_switchTrack;
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{TextCheckCell.class}, new String[]{"checkBox"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i8));
int i9 = Theme.key_switchTrackChecked;
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{TextCheckCell.class}, new String[]{"checkBox"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i9));
int i10 = Theme.key_windowBackgroundWhiteGrayIcon;
arrayList.add(new ThemeDescription((View) this.listView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{BrightnessControlCell.class}, new String[]{"leftImageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i10));
arrayList.add(new ThemeDescription((View) this.listView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{BrightnessControlCell.class}, new String[]{"rightImageView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i10));
int i11 = Theme.key_player_progressBackground;
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{BrightnessControlCell.class}, new String[]{"seekBarView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i11));
int i12 = Theme.key_player_progress;
arrayList.add(new ThemeDescription((View) this.listView, ThemeDescription.FLAG_PROGRESSBAR, new Class[]{BrightnessControlCell.class}, new String[]{"seekBarView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i12));
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{ThemeTypeCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i5));
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{ThemeTypeCell.class}, new String[]{"checkImage"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_featuredStickers_addedIcon));
arrayList.add(new ThemeDescription((View) this.listView, ThemeDescription.FLAG_PROGRESSBAR, new Class[]{TextSizeCell.class}, new String[]{"sizeBar"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i12));
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{TextSizeCell.class}, new String[]{"sizeBar"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i11));
arrayList.add(new ThemeDescription((View) this.listView, ThemeDescription.FLAG_PROGRESSBAR, new Class[]{BubbleRadiusCell.class}, new String[]{"sizeBar"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i12));
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{BubbleRadiusCell.class}, new String[]{"sizeBar"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i11));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{ChatListCell.class}, null, null, null, Theme.key_radioBackground));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{ChatListCell.class}, null, null, null, Theme.key_radioBackgroundChecked));
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{NotificationsCheckCell.class}, new String[]{"textView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i5));
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{NotificationsCheckCell.class}, new String[]{"valueTextView"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, Theme.key_windowBackgroundWhiteGrayText2));
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{NotificationsCheckCell.class}, new String[]{"checkBox"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i8));
arrayList.add(new ThemeDescription((View) this.listView, 0, new Class[]{NotificationsCheckCell.class}, new String[]{"checkBox"}, (Paint[]) null, (Drawable[]) null, (ThemeDescription.ThemeDescriptionDelegate) null, i9));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, new Drawable[]{Theme.chat_msgInDrawable, Theme.chat_msgInMediaDrawable}, null, Theme.key_chat_inBubble));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, new Drawable[]{Theme.chat_msgInSelectedDrawable, Theme.chat_msgInMediaSelectedDrawable}, null, Theme.key_chat_inBubbleSelected));
Drawable[] shadowDrawables = Theme.chat_msgInDrawable.getShadowDrawables();
int i13 = Theme.key_chat_inBubbleShadow;
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, shadowDrawables, null, i13));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, Theme.chat_msgInMediaDrawable.getShadowDrawables(), null, i13));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, new Drawable[]{Theme.chat_msgOutDrawable, Theme.chat_msgOutMediaDrawable}, null, Theme.key_chat_outBubble));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, new Drawable[]{Theme.chat_msgOutDrawable, Theme.chat_msgOutMediaDrawable}, null, Theme.key_chat_outBubbleGradient1));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, new Drawable[]{Theme.chat_msgOutDrawable, Theme.chat_msgOutMediaDrawable}, null, Theme.key_chat_outBubbleGradient2));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, new Drawable[]{Theme.chat_msgOutDrawable, Theme.chat_msgOutMediaDrawable}, null, Theme.key_chat_outBubbleGradient3));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, new Drawable[]{Theme.chat_msgOutSelectedDrawable, Theme.chat_msgOutMediaSelectedDrawable}, null, Theme.key_chat_outBubbleSelected));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, new Drawable[]{Theme.chat_msgOutDrawable, Theme.chat_msgOutMediaDrawable}, null, Theme.key_chat_outBubbleShadow));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, new Drawable[]{Theme.chat_msgInDrawable, Theme.chat_msgInMediaDrawable}, null, i13));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, null, null, Theme.key_chat_messageTextIn));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, null, null, Theme.key_chat_messageTextOut));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, new Drawable[]{Theme.chat_msgOutCheckDrawable}, null, Theme.key_chat_outSentCheck));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, new Drawable[]{Theme.chat_msgOutCheckSelectedDrawable}, null, Theme.key_chat_outSentCheckSelected));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, new Drawable[]{Theme.chat_msgOutCheckReadDrawable, Theme.chat_msgOutHalfCheckDrawable}, null, Theme.key_chat_outSentCheckRead));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, new Drawable[]{Theme.chat_msgOutCheckReadSelectedDrawable, Theme.chat_msgOutHalfCheckSelectedDrawable}, null, Theme.key_chat_outSentCheckReadSelected));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, new Drawable[]{Theme.chat_msgMediaCheckDrawable, Theme.chat_msgMediaHalfCheckDrawable}, null, Theme.key_chat_mediaSentCheck));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, null, null, Theme.key_chat_inReplyLine));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, null, null, Theme.key_chat_outReplyLine));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, null, null, Theme.key_chat_inReplyNameText));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, null, null, Theme.key_chat_outReplyNameText));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, null, null, Theme.key_chat_inReplyMessageText));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, null, null, Theme.key_chat_outReplyMessageText));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, null, null, Theme.key_chat_inReplyMediaMessageSelectedText));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, null, null, Theme.key_chat_outReplyMediaMessageSelectedText));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, null, null, Theme.key_chat_inTimeText));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, null, null, Theme.key_chat_outTimeText));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, null, null, Theme.key_chat_inTimeSelectedText));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{TextSizeCell.class}, null, null, null, Theme.key_chat_outTimeSelectedText));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{AppIconsSelectorCell.class}, null, null, null, i));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{AppIconsSelectorCell.class}, null, null, null, i5));
int i14 = Theme.key_windowBackgroundWhiteHintText;
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{AppIconsSelectorCell.class}, null, null, null, i14));
arrayList.add(new ThemeDescription(this.listView, 0, new Class[]{AppIconsSelectorCell.class}, null, null, null, i6));
arrayList.addAll(SimpleThemeDescription.createThemeDescriptions(new ThemeDescription.ThemeDescriptionDelegate() {
@Override
public final void didSetColor() {
ThemeActivity.this.lambda$getThemeDescriptions$12();
}
@Override
public void onAnimationProgress(float f) {
ThemeDescription.ThemeDescriptionDelegate.CC.$default$onAnimationProgress(this, f);
}
}, new int[]{i14, i5, i6}));
return arrayList;
}
public void lambda$getThemeDescriptions$12() {
for (int i = 0; i < this.listView.getChildCount(); i++) {
Object childAt = this.listView.getChildAt(i);
if (childAt instanceof AppIconsSelectorCell) {
((AppIconsSelectorCell) childAt).getAdapter().notifyDataSetChanged();
} else if (childAt instanceof PeerColorActivity.ChangeNameColorCell) {
((PeerColorActivity.ChangeNameColorCell) childAt).updateColors();
}
}
for (int i2 = 0; i2 < this.listView.getCachedChildCount(); i2++) {
Object cachedChildAt = this.listView.getCachedChildAt(i2);
if (cachedChildAt instanceof AppIconsSelectorCell) {
((AppIconsSelectorCell) cachedChildAt).getAdapter().notifyDataSetChanged();
} else if (cachedChildAt instanceof PeerColorActivity.ChangeNameColorCell) {
((PeerColorActivity.ChangeNameColorCell) cachedChildAt).updateColors();
}
}
for (int i3 = 0; i3 < this.listView.getHiddenChildCount(); i3++) {
Object hiddenChildAt = this.listView.getHiddenChildAt(i3);
if (hiddenChildAt instanceof AppIconsSelectorCell) {
((AppIconsSelectorCell) hiddenChildAt).getAdapter().notifyDataSetChanged();
} else if (hiddenChildAt instanceof PeerColorActivity.ChangeNameColorCell) {
((PeerColorActivity.ChangeNameColorCell) hiddenChildAt).updateColors();
}
}
for (int i4 = 0; i4 < this.listView.getAttachedScrapChildCount(); i4++) {
Object attachedScrapChildAt = this.listView.getAttachedScrapChildAt(i4);
if (attachedScrapChildAt instanceof AppIconsSelectorCell) {
((AppIconsSelectorCell) attachedScrapChildAt).getAdapter().notifyDataSetChanged();
} else if (attachedScrapChildAt instanceof PeerColorActivity.ChangeNameColorCell) {
((PeerColorActivity.ChangeNameColorCell) attachedScrapChildAt).updateColors();
}
}
}
public void checkCurrentDayNight() {
if (this.currentType != 3) {
return;
}
boolean z = !Theme.isCurrentThemeDay();
if (this.lastIsDarkTheme != z) {
this.lastIsDarkTheme = z;
this.sunDrawable.setCustomEndFrame(z ? r1.getFramesCount() - 1 : 0);
this.menuItem.getIconView().playAnimation();
}
if (this.themeListRow2 >= 0) {
for (int i = 0; i < this.listView.getChildCount(); i++) {
if (this.listView.getChildAt(i) instanceof DefaultThemesPreviewCell) {
((DefaultThemesPreviewCell) this.listView.getChildAt(i)).updateDayNightMode();
}
}
}
}
}