正在查看: Plus 12 v10.13.1.1 应用的 ThemingChatsActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Plus 12 v10.13.1.1 应用的 ThemingChatsActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package org.telegram.ui;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.R;
import org.telegram.messenger.UserConfig;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.INavigationLayout;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Cells.HeaderCell;
import org.telegram.ui.Cells.ShadowSectionCell;
import org.telegram.ui.Cells.TextCheckCell;
import org.telegram.ui.Cells.TextColorCell;
import org.telegram.ui.Cells.TextDetailSettingsCell;
import org.telegram.ui.Cells.TextSettingsCell;
public class ThemingChatsActivity extends BaseFragment {
public int avatarMarginLeftRow;
public int avatarRadiusRow;
public int avatarSizeRow;
public int checksColorRow;
public int countBGColorRow;
public int countColorRow;
public int countSilentBGColorRow;
public int countSizeRow;
public int counter;
public int currentAccount;
public int dividerColorRow;
public int favIndicatorColorRow;
public int floatingBGColorRow;
public int floatingPencilColorRow;
public int groupIconColorRow;
public int groupNameColorRow;
public int groupNameSizeRow;
public int headerActionModeIConsColorRow;
public int headerColorRow;
public int headerGradientColorRow;
public int headerGradientRow;
public int headerIconsColorRow;
public int headerSection2Row;
public int headerSubtitleSizeRow;
public int headerTabActionModeColorRow;
public int headerTabActionModeSelectedColor;
public int headerTabCounterBGColorRow;
public int headerTabCounterColorRow;
public int headerTabCounterSilentBGColorRow;
public int headerTabIconColorRow;
public int headerTabUnselectedIconColorRow;
public int headerTitleColorRow;
public int headerTitleRow;
public int hideHeaderShadow;
public int hideStatusIndicatorCheckRow;
public int highlightSearchColorRow;
public ListAdapter listAdapter;
public ListView listView;
public int mediaColorRow;
public int memberColorRow;
public int messageColorRow;
public int messageSizeRow;
public int muteColorRow;
public int nameColorRow;
public int nameSizeRow;
public int pinnedMsgBGColorRow;
public int rowColorRow;
public int rowCount;
public int rowGradientColorRow;
public int rowGradientListCheckRow;
public int rowGradientRow;
public int rowsSection2Row;
public int rowsSectionRow;
public int scrollToPosition;
public boolean showPrefix;
public int tabsBGColorRow;
public int tabsCounterSizeRow;
public int tabsTextModeRow;
public int tabsTextSizeRow;
public int tabsToBottomRow;
public int timeColorRow;
public int timeSizeRow;
public int typingColorRow;
public int unknownNameColorRow;
public ThemingChatsActivity() {
this.currentAccount = UserConfig.selectedAccount;
}
public ThemingChatsActivity(Bundle args) {
super(args);
this.currentAccount = UserConfig.selectedAccount;
}
public boolean onFragmentCreate() {
super.onFragmentCreate();
this.rowCount = 0;
int i = 0 + 1;
this.rowCount = i;
this.headerSection2Row = 0;
int i2 = i + 1;
this.rowCount = i2;
this.headerColorRow = i;
int i3 = i2 + 1;
this.rowCount = i3;
this.headerGradientRow = i2;
int i4 = i3 + 1;
this.rowCount = i4;
this.headerGradientColorRow = i3;
int i5 = i4 + 1;
this.rowCount = i5;
this.headerTitleColorRow = i4;
int i6 = i5 + 1;
this.rowCount = i6;
this.headerTitleRow = i5;
int i7 = i6 + 1;
this.rowCount = i7;
this.headerSubtitleSizeRow = i6;
int i8 = i7 + 1;
this.rowCount = i8;
this.headerIconsColorRow = i7;
int i9 = i8 + 1;
this.rowCount = i9;
this.hideHeaderShadow = i8;
int i10 = i9 + 1;
this.rowCount = i10;
this.tabsBGColorRow = i9;
int i11 = i10 + 1;
this.rowCount = i11;
this.headerTabActionModeColorRow = i10;
int i12 = i11 + 1;
this.rowCount = i12;
this.headerTabActionModeSelectedColor = i11;
int i13 = i12 + 1;
this.rowCount = i13;
this.headerActionModeIConsColorRow = i12;
int i14 = i13 + 1;
this.rowCount = i14;
this.headerTabIconColorRow = i13;
int i15 = i14 + 1;
this.rowCount = i15;
this.headerTabUnselectedIconColorRow = i14;
int i16 = i15 + 1;
this.rowCount = i16;
this.headerTabCounterColorRow = i15;
int i17 = i16 + 1;
this.rowCount = i17;
this.tabsCounterSizeRow = i16;
int i18 = i17 + 1;
this.rowCount = i18;
this.headerTabCounterBGColorRow = i17;
int i19 = i18 + 1;
this.rowCount = i19;
this.headerTabCounterSilentBGColorRow = i18;
int i20 = i19 + 1;
this.rowCount = i20;
this.tabsToBottomRow = i19;
int i21 = i20 + 1;
this.rowCount = i21;
this.tabsTextModeRow = i20;
int i22 = i21 + 1;
this.rowCount = i22;
this.tabsTextSizeRow = i21;
int i23 = i22 + 1;
this.rowCount = i23;
this.rowsSectionRow = i22;
int i24 = i23 + 1;
this.rowCount = i24;
this.rowsSection2Row = i23;
int i25 = i24 + 1;
this.rowCount = i25;
this.rowColorRow = i24;
int i26 = i25 + 1;
this.rowCount = i26;
this.rowGradientRow = i25;
int i27 = i26 + 1;
this.rowCount = i27;
this.rowGradientColorRow = i26;
int i28 = i27 + 1;
this.rowCount = i28;
this.pinnedMsgBGColorRow = i27;
int i29 = i28 + 1;
this.rowCount = i29;
this.dividerColorRow = i28;
int i30 = i29 + 1;
this.rowCount = i30;
this.avatarRadiusRow = i29;
int i31 = i30 + 1;
this.rowCount = i31;
this.avatarSizeRow = i30;
int i32 = i31 + 1;
this.rowCount = i32;
this.avatarMarginLeftRow = i31;
int i33 = i32 + 1;
this.rowCount = i33;
this.hideStatusIndicatorCheckRow = i32;
int i34 = i33 + 1;
this.rowCount = i34;
this.favIndicatorColorRow = i33;
int i35 = i34 + 1;
this.rowCount = i35;
this.nameColorRow = i34;
int i36 = i35 + 1;
this.rowCount = i36;
this.unknownNameColorRow = i35;
int i37 = i36 + 1;
this.rowCount = i37;
this.nameSizeRow = i36;
int i38 = i37 + 1;
this.rowCount = i38;
this.groupNameColorRow = i37;
int i39 = i38 + 1;
this.rowCount = i39;
this.groupNameSizeRow = i38;
int i40 = i39 + 1;
this.rowCount = i40;
this.groupIconColorRow = i39;
int i41 = i40 + 1;
this.rowCount = i41;
this.muteColorRow = i40;
int i42 = i41 + 1;
this.rowCount = i42;
this.checksColorRow = i41;
int i43 = i42 + 1;
this.rowCount = i43;
this.messageColorRow = i42;
int i44 = i43 + 1;
this.rowCount = i44;
this.messageSizeRow = i43;
int i45 = i44 + 1;
this.rowCount = i45;
this.memberColorRow = i44;
int i46 = i45 + 1;
this.rowCount = i46;
this.mediaColorRow = i45;
int i47 = i46 + 1;
this.rowCount = i47;
this.typingColorRow = i46;
int i48 = i47 + 1;
this.rowCount = i48;
this.timeColorRow = i47;
int i49 = i48 + 1;
this.rowCount = i49;
this.timeSizeRow = i48;
int i50 = i49 + 1;
this.rowCount = i50;
this.countColorRow = i49;
int i51 = i50 + 1;
this.rowCount = i51;
this.countSizeRow = i50;
int i52 = i51 + 1;
this.rowCount = i52;
this.countBGColorRow = i51;
int i53 = i52 + 1;
this.rowCount = i53;
this.countSilentBGColorRow = i52;
int i54 = i53 + 1;
this.rowCount = i54;
this.floatingPencilColorRow = i53;
int i55 = i54 + 1;
this.rowCount = i55;
this.floatingBGColorRow = i54;
this.rowCount = i55 + 1;
this.highlightSearchColorRow = i55;
this.showPrefix = ApplicationLoader.applicationContext.getSharedPreferences("plusconfig", 0).getBoolean("chatsShowPrefix", true);
Bundle bundle = ((BaseFragment) this).arguments;
if (bundle != null) {
this.scrollToPosition = bundle.getInt("scroll_to_position", 0);
}
return true;
}
public void onFragmentDestroy() {
super.onFragmentDestroy();
}
public final void clickItem(final int position) {
try {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ThemingChatsActivity.this.lambda$clickItem$1(position);
}
}, 300L);
} catch (Exception e) {
FileLog.e(e);
}
}
public void lambda$clickItem$1(int i) {
ListView listView = this.listView;
listView.performItemClick(listView, i, listView.getItemIdAtPosition(i));
View viewByPosition = getViewByPosition(i);
if (viewByPosition == null || !(viewByPosition instanceof TextCheckCell)) {
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
ThemingChatsActivity.this.lambda$clickItem$0();
}
}, 200L);
}
public void lambda$clickItem$0() {
this.listAdapter.notifyDataSetChanged();
}
public final View getViewByPosition(int pos) {
int firstVisiblePosition = this.listView.getFirstVisiblePosition();
int childCount = (this.listView.getChildCount() + firstVisiblePosition) - 1;
if (pos < firstVisiblePosition || pos > childCount) {
return this.listView.getAdapter().getView(pos, null, this.listView);
}
return this.listView.getChildAt(pos - firstVisiblePosition);
}
public android.view.View createView(android.content.Context r5) {
throw new UnsupportedOperationException("Method not decompiled: org.telegram.ui.ThemingChatsActivity.createView(android.content.Context):android.view.View");
}
public class AnonymousClass4 implements AdapterView.OnItemLongClickListener {
public AnonymousClass4() {
}
@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
if (ThemingChatsActivity.this.getParentActivity() == null) {
return false;
}
final String obj = view.getTag() != null ? view.getTag().toString() : "";
AlertDialog.Builder builder = new AlertDialog.Builder(ThemingChatsActivity.this.getParentActivity());
ArrayList arrayList = new ArrayList();
final ArrayList arrayList2 = new ArrayList();
if (obj != null && !obj.isEmpty()) {
builder.setTitle(obj);
}
arrayList.add(LocaleController.getString("CopyLink", R.string.CopyLink));
arrayList2.add(0);
arrayList.add(LocaleController.getString("ShareLink", R.string.ShareLink));
arrayList2.add(2);
arrayList.add(LocaleController.getString("Reset", R.string.Reset));
arrayList2.add(1);
final String prefix = ThemingChatsActivity.this.getPrefix(i);
builder.setItems((CharSequence[]) arrayList.toArray(new CharSequence[arrayList.size()]), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i2) {
int intValue = ((Integer) arrayList2.get(i2)).intValue();
final String format = String.format("https://t.me/thememods/%s", prefix);
if (intValue == 0) {
try {
((ClipboardManager) ApplicationLoader.applicationContext.getSystemService("clipboard")).setPrimaryClip(ClipData.newPlainText("label", format));
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
if (ThemingChatsActivity.this.getParentActivity() != null) {
Toast.makeText(ThemingChatsActivity.this.getParentActivity(), format, 0).show();
}
}
});
return;
} catch (Exception e) {
FileLog.e(e);
return;
}
}
if (intValue == 1) {
ThemingChatsActivity.this.resetPref(obj);
return;
}
if (intValue == 2) {
try {
Intent intent = new Intent("android.intent.action.SEND");
intent.setType("text/plain");
intent.putExtra("android.intent.extra.TEXT", format);
ThemingChatsActivity.this.getParentActivity().startActivityForResult(Intent.createChooser(intent, LocaleController.getString("ShareLink", R.string.ShareLink)), 500);
} catch (Exception e2) {
FileLog.e(e2);
}
}
}
});
ThemingChatsActivity.this.showDialog(builder.create());
return true;
}
}
public final void resetPref(String key) {
SharedPreferences.Editor edit = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0).edit();
if (key != null) {
edit.remove(key);
}
edit.commit();
Theme.updateChatsColors();
ListView listView = this.listView;
if (listView != null) {
listView.invalidateViews();
}
refreshTheme();
}
public final void commitInt(String key, int value) {
SharedPreferences.Editor edit = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0).edit();
edit.putInt(key, value);
edit.commit();
ListView listView = this.listView;
if (listView != null) {
listView.invalidateViews();
}
refreshTheme();
}
public final void refreshTheme() {
Theme.applyPlusTheme();
INavigationLayout iNavigationLayout = ((BaseFragment) this).parentLayout;
if (iNavigationLayout != null) {
iNavigationLayout.rebuildAllFragmentViews(false, false);
}
}
public void onResume() {
super.onResume();
ListAdapter listAdapter = this.listAdapter;
if (listAdapter != null) {
listAdapter.notifyDataSetChanged();
}
fixLayout();
}
public final void updateTheme() {
((BaseFragment) this).actionBar.setBackgroundColor(Theme.prefActionbarColor);
((BaseFragment) this).actionBar.setTitleColor(Theme.prefActionbarTitleColor);
Drawable drawable = getParentActivity().getResources().getDrawable(R.drawable.ic_ab_back);
drawable.setColorFilter(Theme.prefActionbarIconsColor, PorterDuff.Mode.MULTIPLY);
((BaseFragment) this).actionBar.setBackButtonDrawable(drawable);
((BaseFragment) this).actionBar.setItemsColor(Theme.prefActionbarIconsColor, false);
}
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
fixLayout();
}
public final void fixLayout() {
View view = ((BaseFragment) this).fragmentView;
if (view == null) {
return;
}
view.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
View view2 = ((BaseFragment) ThemingChatsActivity.this).fragmentView;
if (view2 == null) {
return false;
}
view2.getViewTreeObserver().removeOnPreDrawListener(this);
return false;
}
});
}
public final String getPrefix(int i) {
if (i == this.headerSection2Row) {
return "1.1 ";
}
int i2 = this.rowsSection2Row;
if (i == i2) {
return "1.2 ";
}
if (i < i2) {
return "1.1." + i + " ";
}
return "1.2." + (i - this.rowsSection2Row) + " ";
}
public class ListAdapter extends BaseAdapter {
public Context mContext;
@Override
public boolean areAllItemsEnabled() {
return false;
}
@Override
public Object getItem(int i) {
return null;
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public int getViewTypeCount() {
return 6;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isEmpty() {
return false;
}
public ListAdapter(Context context) {
this.mContext = context;
}
@Override
public boolean isEnabled(int i) {
return i == ThemingChatsActivity.this.headerColorRow || i == ThemingChatsActivity.this.headerGradientRow || (Theme.chatsHeaderGradient != 0 && i == ThemingChatsActivity.this.headerGradientColorRow) || i == ThemingChatsActivity.this.headerTitleColorRow || i == ThemingChatsActivity.this.headerIconsColorRow || i == ThemingChatsActivity.this.headerTabIconColorRow || i == ThemingChatsActivity.this.headerTabUnselectedIconColorRow || i == ThemingChatsActivity.this.headerTitleRow || i == ThemingChatsActivity.this.headerTabCounterColorRow || i == ThemingChatsActivity.this.headerTabCounterBGColorRow || i == ThemingChatsActivity.this.headerTabCounterSilentBGColorRow || i == ThemingChatsActivity.this.tabsCounterSizeRow || i == ThemingChatsActivity.this.rowColorRow || i == ThemingChatsActivity.this.rowGradientRow || ((Theme.chatsRowGradient != 0 && i == ThemingChatsActivity.this.rowGradientColorRow) || ((Theme.chatsRowGradient != 0 && i == ThemingChatsActivity.this.rowGradientListCheckRow) || i == ThemingChatsActivity.this.dividerColorRow || i == ThemingChatsActivity.this.avatarRadiusRow || i == ThemingChatsActivity.this.avatarSizeRow || i == ThemingChatsActivity.this.avatarMarginLeftRow || i == ThemingChatsActivity.this.hideHeaderShadow || i == ThemingChatsActivity.this.hideStatusIndicatorCheckRow || i == ThemingChatsActivity.this.nameColorRow || i == ThemingChatsActivity.this.groupNameColorRow || i == ThemingChatsActivity.this.unknownNameColorRow || i == ThemingChatsActivity.this.groupIconColorRow || i == ThemingChatsActivity.this.muteColorRow || i == ThemingChatsActivity.this.checksColorRow || i == ThemingChatsActivity.this.nameSizeRow || i == ThemingChatsActivity.this.groupNameSizeRow || i == ThemingChatsActivity.this.messageColorRow || i == ThemingChatsActivity.this.highlightSearchColorRow || i == ThemingChatsActivity.this.memberColorRow || i == ThemingChatsActivity.this.mediaColorRow || i == ThemingChatsActivity.this.typingColorRow || i == ThemingChatsActivity.this.messageSizeRow || i == ThemingChatsActivity.this.timeColorRow || i == ThemingChatsActivity.this.timeSizeRow || i == ThemingChatsActivity.this.countColorRow || i == ThemingChatsActivity.this.countSizeRow || i == ThemingChatsActivity.this.countBGColorRow || i == ThemingChatsActivity.this.countSilentBGColorRow || i == ThemingChatsActivity.this.floatingPencilColorRow || i == ThemingChatsActivity.this.floatingBGColorRow || i == ThemingChatsActivity.this.tabsBGColorRow || i == ThemingChatsActivity.this.favIndicatorColorRow || i == ThemingChatsActivity.this.tabsToBottomRow || i == ThemingChatsActivity.this.tabsTextModeRow || i == ThemingChatsActivity.this.tabsTextSizeRow || i == ThemingChatsActivity.this.pinnedMsgBGColorRow || i == ThemingChatsActivity.this.headerSubtitleSizeRow || i == ThemingChatsActivity.this.headerTabActionModeColorRow || i == ThemingChatsActivity.this.headerTabActionModeSelectedColor || i == ThemingChatsActivity.this.headerActionModeIConsColorRow));
}
@Override
public int getCount() {
return ThemingChatsActivity.this.rowCount;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
String str;
String str2;
int itemViewType = getItemViewType(i);
String prefix = ThemingChatsActivity.this.showPrefix ? ThemingChatsActivity.this.getPrefix(i) : "";
boolean z = false;
z = false;
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0);
if (itemViewType == 0) {
if (view == null) {
view = new ShadowSectionCell(this.mContext);
}
} else if (itemViewType == 1) {
if (view == null) {
view = new HeaderCell(this.mContext);
view.setBackgroundColor(-1);
}
if (i == ThemingChatsActivity.this.headerSection2Row) {
((HeaderCell) view).setText(prefix + LocaleController.getString("Header", R.string.Header));
} else if (i == ThemingChatsActivity.this.rowsSection2Row) {
((HeaderCell) view).setText(prefix + LocaleController.getString("ChatsList", R.string.ChatsList));
}
} else if (itemViewType == 2) {
if (view == null) {
view = new TextSettingsCell(this.mContext);
}
TextSettingsCell textSettingsCell = (TextSettingsCell) view;
textSettingsCell.setMultilineText();
if (i == ThemingChatsActivity.this.avatarRadiusRow) {
textSettingsCell.setTag("chatsAvatarRadius");
textSettingsCell.setTextAndValue(prefix + LocaleController.getString("AvatarRadius", R.string.AvatarRadius), String.format("%d", Integer.valueOf(Theme.chatsAvatarRadius)), true);
} else if (i == ThemingChatsActivity.this.tabsCounterSizeRow) {
textSettingsCell.setTag("chatsHeaderTabCounterSize");
textSettingsCell.setTextAndValue(prefix + LocaleController.getString("CountSize", R.string.CountSize), String.format("%d", Integer.valueOf(Theme.chatsTabCounterSize)), true);
} else if (i == ThemingChatsActivity.this.headerSubtitleSizeRow) {
textSettingsCell.setTag("chatsHeaderSubtitleSize");
textSettingsCell.setTextAndValue(prefix + LocaleController.getString("HeaderSubtitleSize", R.string.HeaderSubtitleSize), String.format("%d", Integer.valueOf(Theme.chatsHeaderSubtitleSize)), true);
} else if (i == ThemingChatsActivity.this.avatarSizeRow) {
textSettingsCell.setTag("chatsAvatarSize");
textSettingsCell.setTextAndValue(prefix + LocaleController.getString("AvatarSize", R.string.AvatarSize), String.format("%d", Integer.valueOf(Theme.chatsAvatarSize)), true);
} else if (i == ThemingChatsActivity.this.avatarMarginLeftRow) {
textSettingsCell.setTag("chatsAvatarMarginLeft");
textSettingsCell.setTextAndValue(prefix + LocaleController.getString("AvatarMarginLeft", R.string.AvatarMarginLeft), String.format("%d", Integer.valueOf(Theme.chatsAvatarMarginLeft)), true);
} else if (i == ThemingChatsActivity.this.nameSizeRow) {
textSettingsCell.setTag("chatsNameSize");
textSettingsCell.setTextAndValue(prefix + LocaleController.getString("NameSize", R.string.NameSize), String.format("%d", Integer.valueOf(Theme.chatsNameSize)), true);
} else if (i == ThemingChatsActivity.this.groupNameSizeRow) {
textSettingsCell.setTag("chatsGroupNameSize");
textSettingsCell.setTextAndValue(prefix + LocaleController.getString("GroupNameSize", R.string.GroupNameSize), String.format("%d", Integer.valueOf(sharedPreferences.getInt("chatsGroupNameSize", Theme.chatsNameSize))), true);
} else if (i == ThemingChatsActivity.this.messageSizeRow) {
textSettingsCell.setTag("chatsMessageSize");
textSettingsCell.setTextAndValue(prefix + LocaleController.getString("MessageSize", R.string.MessageSize), String.format("%d", Integer.valueOf(sharedPreferences.getInt("chatsMessageSize", AndroidUtilities.isTablet() ? 18 : 15))), true);
} else if (i == ThemingChatsActivity.this.timeSizeRow) {
textSettingsCell.setTag("chatsTimeSize");
textSettingsCell.setTextAndValue(prefix + LocaleController.getString("TimeDateSize", R.string.TimeDateSize), String.format("%d", Integer.valueOf(sharedPreferences.getInt("chatsTimeSize", AndroidUtilities.isTablet() ? 15 : 13))), true);
} else if (i == ThemingChatsActivity.this.countSizeRow) {
textSettingsCell.setTag("chatsCountSize");
textSettingsCell.setTextAndValue(prefix + LocaleController.getString("CountSize", R.string.CountSize), String.format("%d", Integer.valueOf(Theme.chatsCountSize)), true);
} else if (i == ThemingChatsActivity.this.tabsTextSizeRow) {
textSettingsCell.setTag("chatsTabsTextSize");
textSettingsCell.setTextAndValue(prefix + LocaleController.getString("TabsTextSize", R.string.TabsTextSize), String.format("%d", Integer.valueOf(Theme.chatsTabsTextSize)), false);
}
} else if (itemViewType == 3) {
if (view == null) {
view = new TextColorCell(this.mContext);
}
TextColorCell textColorCell = (TextColorCell) view;
textColorCell.setMultilineText();
if (i == ThemingChatsActivity.this.headerColorRow) {
textColorCell.setTag("chatsHeaderColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("HeaderColor", R.string.HeaderColor), Theme.chatsHeaderColor, false);
} else if (i == ThemingChatsActivity.this.headerGradientColorRow) {
textColorCell.setTag("chatsHeaderGradientColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("RowGradientColor", R.string.RowGradientColor), Theme.chatsHeaderGradientColor, true);
} else if (i == ThemingChatsActivity.this.headerTitleColorRow) {
textColorCell.setTag("chatsHeaderTitleColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("HeaderTitleColor", R.string.HeaderTitleColor), Theme.chatsHeaderTitleColor, true);
} else if (i == ThemingChatsActivity.this.headerIconsColorRow) {
textColorCell.setTag("chatsHeaderIconsColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("HeaderIconsColor", R.string.HeaderIconsColor), Theme.chatsHeaderIconsColor, true);
} else if (i == ThemingChatsActivity.this.headerTabIconColorRow) {
Theme.chatsHeaderTabIconColor = sharedPreferences.getInt("chatsHeaderTabIconColor", Theme.chatsHeaderIconsColor);
textColorCell.setTag("chatsHeaderTabIconColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("HeaderTabIconColor", R.string.HeaderTabIconColor), Theme.chatsHeaderTabIconColor, true);
} else if (i == ThemingChatsActivity.this.headerTabUnselectedIconColorRow) {
Theme.chatsHeaderTabUnselectedIconColor = sharedPreferences.getInt("chatsHeaderTabUnselectedIconColor", AndroidUtilities.getIntAlphaColor("chatsHeaderTabIconColor", Theme.chatsHeaderIconsColor, 0.35f));
textColorCell.setTag("chatsHeaderTabUnselectedIconColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("HeaderTabUnselectedIconColor", R.string.HeaderTabUnselectedIconColor), Theme.chatsHeaderTabUnselectedIconColor, true);
} else if (i == ThemingChatsActivity.this.headerTabCounterColorRow) {
textColorCell.setTag("chatsHeaderTabCounterColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("HeaderTabCounterColor", R.string.HeaderTabCounterColor), Theme.chatsTabCounterColor, true);
} else if (i == ThemingChatsActivity.this.headerTabCounterBGColorRow) {
textColorCell.setTag("chatsHeaderTabCounterBGColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("HeaderTabCounterBGColor", R.string.HeaderTabCounterBGColor), Theme.chatsTabCounterBGColor, true);
} else if (i == ThemingChatsActivity.this.headerTabCounterSilentBGColorRow) {
textColorCell.setTag("chatsHeaderTabCounterSilentBGColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("CountSilentBGColor", R.string.CountSilentBGColor), Theme.chatsTabCounterSilentBGColor, false);
} else if (i == ThemingChatsActivity.this.rowColorRow) {
textColorCell.setTag("chatsRowColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("RowColor", R.string.RowColor), Theme.chatsRowColor, false);
} else if (i == ThemingChatsActivity.this.tabsBGColorRow) {
textColorCell.setTag("chatsTabsBGColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("TabsBGColor", R.string.TabsBGColor), sharedPreferences.getInt("chatsTabsBGColor", Theme.chatsHeaderColor), true);
} else if (i == ThemingChatsActivity.this.headerTabActionModeColorRow) {
textColorCell.setMultilineText();
textColorCell.setTag("chatsHeaderTabActionModeColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("TabsActionModeColor", R.string.TabsActionModeColor), Theme.chatsHeaderTabActionModeColor, true);
} else if (i == ThemingChatsActivity.this.headerTabActionModeSelectedColor) {
textColorCell.setMultilineText();
textColorCell.setTag("chatsHeaderTabActionModeSelectedColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("TabsActionModeSelectedColor", R.string.TabsActionModeSelectedColor), Theme.chatsHeaderTabActionModeSelectedColor, true);
} else if (i == ThemingChatsActivity.this.headerActionModeIConsColorRow) {
textColorCell.setMultilineText();
textColorCell.setTag("chatsHeaderActionModeIconsColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("ActionModeIconsColor", R.string.ActionModeIconsColor), Theme.chatsHeaderActionModeIconsColor, true);
} else if (i == ThemingChatsActivity.this.favIndicatorColorRow) {
textColorCell.setTag("chatsFavIndicatorColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("FavIndicatorColor", R.string.FavIndicatorColor), sharedPreferences.getInt("chatsFavIndicatorColor", Theme.FAV_INDICATOR_COLOR_DEF), false);
} else if (i == ThemingChatsActivity.this.rowGradientColorRow) {
textColorCell.setTag("chatsRowGradientColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("RowGradientColor", R.string.RowGradientColor), Theme.chatsRowGradient != 0 ? Theme.chatsRowGradientColor : 0, true);
} else if (i == ThemingChatsActivity.this.pinnedMsgBGColorRow) {
textColorCell.setTag("chatsPinnedMsgBGColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("PinnedMsgBgColor", R.string.PinnedMsgBgColor), sharedPreferences.getInt("chatsPinnedMsgBGColor", Theme.chatsRowColor), true);
} else if (i == ThemingChatsActivity.this.dividerColorRow) {
textColorCell.setTag("chatsDividerColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("DividerColor", R.string.DividerColor), Theme.chatsDividerColor, true);
} else if (i == ThemingChatsActivity.this.nameColorRow) {
textColorCell.setTag("chatsNameColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("NameColor", R.string.NameColor), Theme.chatsNameColor, true);
} else if (i == ThemingChatsActivity.this.groupNameColorRow) {
textColorCell.setTag("chatsGroupNameColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("GroupNameColor", R.string.GroupNameColor), Theme.chatsGroupNameColor, true);
} else if (i == ThemingChatsActivity.this.unknownNameColorRow) {
textColorCell.setTag("chatsUnknownNameColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("UnknownNameColor", R.string.UnknownNameColor), sharedPreferences.getInt("chatsUnknownNameColor", Theme.chatsNameColor), true);
} else if (i == ThemingChatsActivity.this.groupIconColorRow) {
textColorCell.setTag("chatsGroupIconColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("GroupIconColor", R.string.GroupIconColor), sharedPreferences.getInt("chatsGroupIconColor", sharedPreferences.getInt("chatsGroupNameColor", -16777216)), true);
} else if (i == ThemingChatsActivity.this.muteColorRow) {
textColorCell.setTag("chatsMuteColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("MuteColor", R.string.MuteColor), sharedPreferences.getInt("chatsMuteColor", -5723992), true);
} else if (i == ThemingChatsActivity.this.checksColorRow) {
textColorCell.setTag("chatsChecksColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("ChecksColor", R.string.ChecksColor), Theme.chatsChecksColor, true);
} else if (i == ThemingChatsActivity.this.messageColorRow) {
textColorCell.setTag("chatsMessageColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("MessageColor", R.string.MessageColor), Theme.chatsMessageColor, true);
} else if (i == ThemingChatsActivity.this.memberColorRow) {
textColorCell.setTag("chatsMemberColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("MemberColor", R.string.MemberColor), Theme.chatsMemberColor, true);
} else if (i == ThemingChatsActivity.this.mediaColorRow) {
textColorCell.setTag("chatsMediaColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("MediaColor", R.string.MediaColor), sharedPreferences.getInt("chatsMediaColor", Theme.chatsMemberColor), true);
} else if (i == ThemingChatsActivity.this.typingColorRow) {
textColorCell.setTag("chatsTypingColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("TypingColor", R.string.TypingColor), sharedPreferences.getInt(textColorCell.getTag().toString(), Theme.defColor), true);
} else if (i == ThemingChatsActivity.this.timeColorRow) {
textColorCell.setTag("chatsTimeColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("TimeDateColor", R.string.TimeDateColor), sharedPreferences.getInt("chatsTimeColor", -6710887), true);
} else if (i == ThemingChatsActivity.this.countColorRow) {
textColorCell.setTag("chatsCountColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("CountColor", R.string.CountColor), Theme.chatsCountColor, true);
} else if (i == ThemingChatsActivity.this.countBGColorRow) {
textColorCell.setTag("chatsCountBGColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("CountBGColor", R.string.CountBGColor), sharedPreferences.getInt("chatsCountBGColor", Theme.defColor), true);
} else if (i == ThemingChatsActivity.this.countSilentBGColorRow) {
textColorCell.setTag("chatsCountSilentBGColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("CountSilentBGColor", R.string.CountSilentBGColor), sharedPreferences.getInt("chatsCountSilentBGColor", sharedPreferences.getInt("chatsCountBGColor", -4605511)), true);
} else if (i == ThemingChatsActivity.this.floatingPencilColorRow) {
textColorCell.setTag("chatsFloatingPencilColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("FloatingPencilColor", R.string.FloatingPencilColor), Theme.chatsFloatingPencilColor, true);
} else if (i == ThemingChatsActivity.this.floatingBGColorRow) {
textColorCell.setTag("chatsFloatingBGColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("FloatingBGColor", R.string.FloatingBGColor), Theme.chatsFloatingBGColor, true);
} else if (i == ThemingChatsActivity.this.highlightSearchColorRow) {
textColorCell.setTag("chatsHighlightSearchColor");
textColorCell.setTextAndColor(prefix + LocaleController.getString("HighlightSearchColor", R.string.HighlightSearchColor), sharedPreferences.getInt("chatsHighlightSearchColor", Theme.lightColor), false);
}
} else if (itemViewType == 4) {
if (view == null) {
view = new TextCheckCell(this.mContext);
}
TextCheckCell textCheckCell = (TextCheckCell) view;
textCheckCell.setMultilineText();
if (i == ThemingChatsActivity.this.rowGradientListCheckRow) {
textCheckCell.setTag("chatsRowGradientListCheck");
String str3 = prefix + LocaleController.getString("RowGradientList", R.string.RowGradientList);
if (Theme.chatsRowGradient != 0 && sharedPreferences.getBoolean("chatsRowGradientListCheck", false)) {
z = true;
}
textCheckCell.setTextAndCheck(str3, z, true);
} else if (i == ThemingChatsActivity.this.hideHeaderShadow) {
textCheckCell.setTag("chatsHideHeaderShadow");
textCheckCell.setTextAndCheck(prefix + LocaleController.getString("HideHeaderShadow", R.string.HideHeaderShadow), Theme.chatsHideHeaderShadow, true);
} else if (i == ThemingChatsActivity.this.hideStatusIndicatorCheckRow) {
textCheckCell.setTag("chatsHideStatusIndicator");
textCheckCell.setTextAndCheck(prefix + LocaleController.getString("HideStatusIndicator", R.string.HideStatusIndicator), Theme.chatsHideStatusIndicator, true);
} else if (i == ThemingChatsActivity.this.tabsToBottomRow) {
textCheckCell.setTag("chatsTabsToBottom");
textCheckCell.setTextAndCheck(prefix + LocaleController.getString("TabsToBottom", R.string.TabsToBottom), Theme.chatsTabsToBottom, true);
} else if (i == ThemingChatsActivity.this.tabsTextModeRow) {
textCheckCell.setTag("chatsTabTitlesMode");
textCheckCell.setTextAndCheck(prefix + LocaleController.getString("ShowTabTitle", R.string.ShowTabTitle), Theme.chatsTabTitlesMode, true);
}
} else if (itemViewType == 5) {
if (view == null) {
view = new TextDetailSettingsCell(this.mContext);
}
TextDetailSettingsCell textDetailSettingsCell = (TextDetailSettingsCell) view;
textDetailSettingsCell.setMultilineText(true);
if (i == ThemingChatsActivity.this.headerTitleRow) {
textDetailSettingsCell.setTag("chatsHeaderTitle");
textDetailSettingsCell.setMultilineDetail(false);
int i2 = sharedPreferences.getInt("chatsHeaderTitle", 0);
TLRPC.User user = MessagesController.getInstance(ThemingChatsActivity.this.currentAccount).getUser(Long.valueOf(UserConfig.getInstance(ThemingChatsActivity.this.currentAccount).getClientUserId()));
if (user == null || (str2 = user.username) == null || str2.length() == 0) {
str = "-";
} else {
str = "@" + user.username;
}
if (i2 == 0) {
textDetailSettingsCell.setTextAndValue(prefix + LocaleController.getString("HeaderTitle", R.string.HeaderTitle), LocaleController.getString("AppName", R.string.AppName), true);
} else if (i2 == 1) {
textDetailSettingsCell.setTextAndValue(prefix + LocaleController.getString("HeaderTitle", R.string.HeaderTitle), LocaleController.getString("ShortAppName", R.string.ShortAppName), true);
} else if (i2 == 2) {
textDetailSettingsCell.setTextAndValue(prefix + LocaleController.getString("HeaderTitle", R.string.HeaderTitle), ContactsController.formatName(user.first_name, user.last_name), true);
} else if (i2 == 3) {
textDetailSettingsCell.setTextAndValue(prefix + LocaleController.getString("HeaderTitle", R.string.HeaderTitle), str, true);
} else if (i2 == 4) {
textDetailSettingsCell.setTextAndValue(prefix + LocaleController.getString("HeaderTitle", R.string.HeaderTitle), "", true);
}
} else if (i == ThemingChatsActivity.this.headerGradientRow) {
textDetailSettingsCell.setTag("chatsHeaderGradient");
textDetailSettingsCell.setMultilineDetail(false);
int i3 = Theme.chatsHeaderGradient;
if (i3 == 0) {
textDetailSettingsCell.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false);
} else if (i3 == 1) {
textDetailSettingsCell.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false);
} else if (i3 == 2) {
textDetailSettingsCell.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false);
} else if (i3 == 3) {
textDetailSettingsCell.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false);
} else if (i3 == 4) {
textDetailSettingsCell.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false);
}
} else if (i == ThemingChatsActivity.this.rowGradientRow) {
textDetailSettingsCell.setTag("chatsRowGradient");
textDetailSettingsCell.setMultilineDetail(false);
int i4 = Theme.chatsRowGradient;
if (i4 == 0) {
textDetailSettingsCell.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false);
} else if (i4 == 1) {
textDetailSettingsCell.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false);
} else if (i4 == 2) {
textDetailSettingsCell.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false);
} else if (i4 == 3) {
textDetailSettingsCell.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false);
} else if (i4 == 4) {
textDetailSettingsCell.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false);
}
}
}
if (view != null) {
view.setBackgroundColor(Theme.usePlusTheme ? Theme.prefBGColor : Theme.getColor(Theme.key_windowBackgroundWhite));
}
return view;
}
@Override
public int getItemViewType(int i) {
if (i == ThemingChatsActivity.this.rowsSectionRow) {
return 0;
}
if (i == ThemingChatsActivity.this.headerSection2Row || i == ThemingChatsActivity.this.rowsSection2Row) {
return 1;
}
if (i == ThemingChatsActivity.this.avatarRadiusRow || i == ThemingChatsActivity.this.avatarSizeRow || i == ThemingChatsActivity.this.avatarMarginLeftRow || i == ThemingChatsActivity.this.nameSizeRow || i == ThemingChatsActivity.this.groupNameSizeRow || i == ThemingChatsActivity.this.messageSizeRow || i == ThemingChatsActivity.this.timeSizeRow || i == ThemingChatsActivity.this.countSizeRow || i == ThemingChatsActivity.this.tabsCounterSizeRow || i == ThemingChatsActivity.this.tabsTextSizeRow || i == ThemingChatsActivity.this.headerSubtitleSizeRow) {
return 2;
}
if (i == ThemingChatsActivity.this.headerColorRow || i == ThemingChatsActivity.this.headerGradientColorRow || i == ThemingChatsActivity.this.headerTitleColorRow || i == ThemingChatsActivity.this.headerIconsColorRow || i == ThemingChatsActivity.this.headerTabIconColorRow || i == ThemingChatsActivity.this.headerTabUnselectedIconColorRow || i == ThemingChatsActivity.this.headerTabCounterColorRow || i == ThemingChatsActivity.this.headerTabCounterBGColorRow || i == ThemingChatsActivity.this.headerTabCounterSilentBGColorRow || i == ThemingChatsActivity.this.rowColorRow || i == ThemingChatsActivity.this.rowGradientColorRow || i == ThemingChatsActivity.this.dividerColorRow || i == ThemingChatsActivity.this.nameColorRow || i == ThemingChatsActivity.this.groupNameColorRow || i == ThemingChatsActivity.this.unknownNameColorRow || i == ThemingChatsActivity.this.groupIconColorRow || i == ThemingChatsActivity.this.muteColorRow || i == ThemingChatsActivity.this.checksColorRow || i == ThemingChatsActivity.this.messageColorRow || i == ThemingChatsActivity.this.highlightSearchColorRow || i == ThemingChatsActivity.this.memberColorRow || i == ThemingChatsActivity.this.mediaColorRow || i == ThemingChatsActivity.this.typingColorRow || i == ThemingChatsActivity.this.timeColorRow || i == ThemingChatsActivity.this.countColorRow || i == ThemingChatsActivity.this.countBGColorRow || i == ThemingChatsActivity.this.countSilentBGColorRow || i == ThemingChatsActivity.this.floatingPencilColorRow || i == ThemingChatsActivity.this.floatingBGColorRow || i == ThemingChatsActivity.this.tabsBGColorRow || i == ThemingChatsActivity.this.favIndicatorColorRow || i == ThemingChatsActivity.this.pinnedMsgBGColorRow || i == ThemingChatsActivity.this.headerTabActionModeColorRow || i == ThemingChatsActivity.this.headerTabActionModeSelectedColor || i == ThemingChatsActivity.this.headerActionModeIConsColorRow) {
return 3;
}
if (i == ThemingChatsActivity.this.rowGradientListCheckRow || i == ThemingChatsActivity.this.hideHeaderShadow || i == ThemingChatsActivity.this.hideStatusIndicatorCheckRow || i == ThemingChatsActivity.this.tabsToBottomRow || i == ThemingChatsActivity.this.tabsTextModeRow) {
return 4;
}
return (i == ThemingChatsActivity.this.headerTitleRow || i == ThemingChatsActivity.this.headerGradientRow || i == ThemingChatsActivity.this.rowGradientRow) ? 5 : 2;
}
}
}