导航菜单

页面标题

页面副标题

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

正在查看: Plus 12 v10.13.1.1 应用的 ThemingDrawerActivity.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.FileLog;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.UserConfig;
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 ThemingDrawerActivity extends BaseFragment {
    public int avatarColorRow;
    public int avatarRadiusRow;
    public int avatarSizeRow;
    public int centerAvatarRow;
    public int currentAccount;
    public boolean drawer;
    public int headerBackgroundCheckRow;
    public int headerColorRow;
    public int headerGradientColorRow;
    public int headerGradientRow;
    public int headerSection2Row;
    public int hideBackgroundShadowRow;
    public int iconColorRow;
    public ListAdapter listAdapter;
    public int listColorRow;
    public int listDividerColorRow;
    public ListView listView;
    public int nameColorRow;
    public int nameSizeRow;
    public int optionColorRow;
    public int optionSizeRow;
    public int phoneColorRow;
    public int phoneSizeRow;
    public boolean player;
    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 topShadowRow;
    public int versionColorRow;
    public int versionSizeRow;

    public ThemingDrawerActivity() {
        this.player = false;
        this.drawer = false;
        this.currentAccount = UserConfig.selectedAccount;
    }

    public ThemingDrawerActivity(Bundle args) {
        super(args);
        this.player = false;
        this.drawer = false;
        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.headerBackgroundCheckRow = i;
        int i3 = i2 + 1;
        this.rowCount = i3;
        this.topShadowRow = i2;
        int i4 = i3 + 1;
        this.rowCount = i4;
        this.hideBackgroundShadowRow = i3;
        int i5 = i4 + 1;
        this.rowCount = i5;
        this.headerColorRow = i4;
        int i6 = i5 + 1;
        this.rowCount = i6;
        this.headerGradientRow = i5;
        int i7 = i6 + 1;
        this.rowCount = i7;
        this.headerGradientColorRow = i6;
        int i8 = i7 + 1;
        this.rowCount = i8;
        this.avatarColorRow = i7;
        int i9 = i8 + 1;
        this.rowCount = i9;
        this.avatarRadiusRow = i8;
        int i10 = i9 + 1;
        this.rowCount = i10;
        this.avatarSizeRow = i9;
        int i11 = i10 + 1;
        this.rowCount = i11;
        this.nameColorRow = i10;
        int i12 = i11 + 1;
        this.rowCount = i12;
        this.nameSizeRow = i11;
        int i13 = i12 + 1;
        this.rowCount = i13;
        this.phoneColorRow = i12;
        int i14 = i13 + 1;
        this.rowCount = i14;
        this.phoneSizeRow = i13;
        int i15 = i14 + 1;
        this.rowCount = i15;
        this.centerAvatarRow = i14;
        int i16 = i15 + 1;
        this.rowCount = i16;
        this.rowsSectionRow = i15;
        int i17 = i16 + 1;
        this.rowCount = i17;
        this.rowsSection2Row = i16;
        int i18 = i17 + 1;
        this.rowCount = i18;
        this.listColorRow = i17;
        int i19 = i18 + 1;
        this.rowCount = i19;
        this.rowGradientRow = i18;
        int i20 = i19 + 1;
        this.rowCount = i20;
        this.rowGradientColorRow = i19;
        int i21 = i20 + 1;
        this.rowCount = i21;
        this.listDividerColorRow = i20;
        int i22 = i21 + 1;
        this.rowCount = i22;
        this.iconColorRow = i21;
        int i23 = i22 + 1;
        this.rowCount = i23;
        this.optionColorRow = i22;
        int i24 = i23 + 1;
        this.rowCount = i24;
        this.optionSizeRow = i23;
        int i25 = i24 + 1;
        this.rowCount = i25;
        this.versionColorRow = i24;
        this.rowCount = i25 + 1;
        this.versionSizeRow = i25;
        this.showPrefix = ApplicationLoader.applicationContext.getSharedPreferences("plusconfig", 0).getBoolean("drawerShowPrefix", true);
        Bundle bundle = ((BaseFragment) this).arguments;
        if (bundle != null) {
            this.scrollToPosition = bundle.getInt("scroll_to_position", 0);
        }
        return true;
    }

    public void onFragmentDestroy() {
        super.onFragmentDestroy();
        if (this.player && MediaController.getInstance().getPlayingMessageObject() != null) {
            NotificationCenter.getInstance(this.currentAccount).postNotificationName(NotificationCenter.messagePlayingPlayStateChanged, new Object[]{Integer.valueOf(MediaController.getInstance().getPlayingMessageObject().getId())});
        }
        if (this.drawer) {
            NotificationCenter.getInstance(this.currentAccount).postNotificationName(NotificationCenter.drawerSettingsChanged, new Object[0]);
        }
    }

    public final void clickItem(final int position) {
        try {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    ThemingDrawerActivity.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() {
                ThemingDrawerActivity.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.ThemingDrawerActivity.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 (ThemingDrawerActivity.this.getParentActivity() == null) {
                return false;
            }
            final String obj = view.getTag() != null ? view.getTag().toString() : "";
            AlertDialog.Builder builder = new AlertDialog.Builder(ThemingDrawerActivity.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 = ThemingDrawerActivity.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 (ThemingDrawerActivity.this.getParentActivity() != null) {
                                        Toast.makeText(ThemingDrawerActivity.this.getParentActivity(), format, 0).show();
                                    }
                                }
                            });
                            return;
                        } catch (Exception e) {
                            FileLog.e(e);
                            return;
                        }
                    }
                    if (intValue == 1) {
                        ThemingDrawerActivity.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);
                            ThemingDrawerActivity.this.getParentActivity().startActivityForResult(Intent.createChooser(intent, LocaleController.getString("ShareLink", R.string.ShareLink)), 500);
                        } catch (Exception e2) {
                            FileLog.e(e2);
                        }
                    }
                }
            });
            ThemingDrawerActivity.this.showDialog(builder.create());
            ThemingDrawerActivity.this.drawer = true;
            return true;
        }
    }

    public final void resetPref(String key) {
        SharedPreferences.Editor edit = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0).edit();
        edit.remove(key);
        edit.commit();
        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) ThemingDrawerActivity.this).fragmentView;
                if (view2 == null) {
                    return false;
                }
                view2.getViewTreeObserver().removeOnPreDrawListener(this);
                return false;
            }
        });
    }

    public final String getPrefix(int i) {
        if (i == this.headerSection2Row) {
            return "4.1 ";
        }
        int i2 = this.rowsSection2Row;
        if (i == i2) {
            return "4.2 ";
        }
        if (i < i2) {
            return "4.1." + i + " ";
        }
        return "4.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) {
            int intDef = AndroidUtilities.getIntDef("drawerHeaderGradient", 0);
            int intDef2 = AndroidUtilities.getIntDef("drawerRowGradient", 0);
            return i == ThemingDrawerActivity.this.headerColorRow || i == ThemingDrawerActivity.this.headerGradientRow || (intDef > 0 && i == ThemingDrawerActivity.this.headerGradientColorRow) || i == ThemingDrawerActivity.this.headerBackgroundCheckRow || i == ThemingDrawerActivity.this.hideBackgroundShadowRow || i == ThemingDrawerActivity.this.centerAvatarRow || i == ThemingDrawerActivity.this.listColorRow || i == ThemingDrawerActivity.this.rowGradientRow || ((intDef2 != 0 && i == ThemingDrawerActivity.this.rowGradientColorRow) || ((intDef2 != 0 && i == ThemingDrawerActivity.this.rowGradientListCheckRow) || i == ThemingDrawerActivity.this.listDividerColorRow || i == ThemingDrawerActivity.this.iconColorRow || i == ThemingDrawerActivity.this.optionColorRow || i == ThemingDrawerActivity.this.optionSizeRow || i == ThemingDrawerActivity.this.avatarColorRow || i == ThemingDrawerActivity.this.avatarRadiusRow || i == ThemingDrawerActivity.this.nameColorRow || i == ThemingDrawerActivity.this.avatarSizeRow || i == ThemingDrawerActivity.this.nameSizeRow || i == ThemingDrawerActivity.this.phoneColorRow || i == ThemingDrawerActivity.this.phoneSizeRow || i == ThemingDrawerActivity.this.versionColorRow || i == ThemingDrawerActivity.this.versionSizeRow || i == ThemingDrawerActivity.this.topShadowRow));
        }

        @Override
        public int getCount() {
            return ThemingDrawerActivity.this.rowCount;
        }

        @Override
        public View getView(int i, View view, ViewGroup viewGroup) {
            View textDetailSettingsCell;
            int itemViewType = getItemViewType(i);
            String prefix = ThemingDrawerActivity.this.showPrefix ? ThemingDrawerActivity.this.getPrefix(i) : "";
            SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("theme", 0);
            int i2 = sharedPreferences.getInt("themeColor", -16738680);
            if (itemViewType == 0) {
                if (view == null) {
                    textDetailSettingsCell = new ShadowSectionCell(this.mContext);
                }
                textDetailSettingsCell = view;
            } else if (itemViewType == 1) {
                if (view == null) {
                    textDetailSettingsCell = new HeaderCell(this.mContext);
                    textDetailSettingsCell.setBackgroundColor(-1);
                } else {
                    textDetailSettingsCell = view;
                }
                if (i == ThemingDrawerActivity.this.headerSection2Row) {
                    ((HeaderCell) textDetailSettingsCell).setText(prefix + LocaleController.getString("Header", R.string.Header));
                } else if (i == ThemingDrawerActivity.this.rowsSection2Row) {
                    ((HeaderCell) textDetailSettingsCell).setText(prefix + LocaleController.getString("OptionsList", R.string.OptionsList));
                }
            } else if (itemViewType == 2) {
                textDetailSettingsCell = view == null ? new TextSettingsCell(this.mContext) : view;
                TextSettingsCell textSettingsCell = (TextSettingsCell) textDetailSettingsCell;
                textSettingsCell.setMultilineText();
                if (i == ThemingDrawerActivity.this.avatarRadiusRow) {
                    textSettingsCell.setTextAndValue(prefix + LocaleController.getString("AvatarRadius", R.string.AvatarRadius), String.format("%d", Integer.valueOf(sharedPreferences.getInt("drawerAvatarRadius", AndroidUtilities.isTablet() ? 35 : 32))), true);
                } else if (i == ThemingDrawerActivity.this.avatarSizeRow) {
                    textSettingsCell.setTextAndValue(prefix + LocaleController.getString("AvatarSize", R.string.AvatarSize), String.format("%d", Integer.valueOf(sharedPreferences.getInt("drawerAvatarSize", AndroidUtilities.isTablet() ? 68 : 64))), true);
                } else {
                    if (i == ThemingDrawerActivity.this.nameSizeRow) {
                        textSettingsCell.setTextAndValue(prefix + LocaleController.getString("OwnNameSize", R.string.OwnNameSize), String.format("%d", Integer.valueOf(sharedPreferences.getInt("drawerNameSize", AndroidUtilities.isTablet() ? 17 : 15))), true);
                    } else if (i == ThemingDrawerActivity.this.optionSizeRow) {
                        textSettingsCell.setTextAndValue(prefix + LocaleController.getString("OptionSize", R.string.OptionSize), String.format("%d", Integer.valueOf(Theme.drawerOptionSize)), true);
                    } else if (i == ThemingDrawerActivity.this.phoneSizeRow) {
                        textSettingsCell.setTextAndValue(prefix + LocaleController.getString("PhoneSize", R.string.PhoneSize), String.format("%d", Integer.valueOf(sharedPreferences.getInt("drawerPhoneSize", AndroidUtilities.isTablet() ? 15 : 13))), true);
                    } else if (i == ThemingDrawerActivity.this.versionSizeRow) {
                        textSettingsCell.setTextAndValue(prefix + LocaleController.getString("VersionSize", R.string.VersionSize), String.format("%d", Integer.valueOf(sharedPreferences.getInt("drawerVersionSize", AndroidUtilities.isTablet() ? 15 : 14))), false);
                    }
                }
            } else if (itemViewType == 3) {
                textDetailSettingsCell = view == null ? new TextColorCell(this.mContext) : view;
                TextColorCell textColorCell = (TextColorCell) textDetailSettingsCell;
                textColorCell.setMultilineText();
                if (i == ThemingDrawerActivity.this.headerColorRow) {
                    textColorCell.setTag("drawerHeaderColor");
                    textColorCell.setTextAndColor(prefix + LocaleController.getString("HeaderColor", R.string.HeaderColor), Theme.drawerHeaderColor, false);
                } else if (i == ThemingDrawerActivity.this.headerGradientColorRow) {
                    textColorCell.setTag("drawerHeaderGradientColor");
                    textColorCell.setTextAndColor(prefix + LocaleController.getString("RowGradientColor", R.string.RowGradientColor), sharedPreferences.getInt("drawerHeaderGradient", 0) != 0 ? sharedPreferences.getInt("drawerHeaderGradientColor", i2) : 0, true);
                } else if (i == ThemingDrawerActivity.this.topShadowRow) {
                    textColorCell.setTag("drawerTopShadowColor");
                    textColorCell.setTextAndColor(prefix + LocaleController.getString("TopShadowColor", R.string.TopShadowColor), Theme.drawerTopShadowColor, false);
                } else if (i == ThemingDrawerActivity.this.listColorRow) {
                    textColorCell.setTag("drawerListColor");
                    textColorCell.setTextAndColor(prefix + LocaleController.getString("ListColor", R.string.ListColor), Theme.drawerListColor, false);
                } else if (i == ThemingDrawerActivity.this.rowGradientColorRow) {
                    textColorCell.setTag("drawerRowGradientColor");
                    textColorCell.setTextAndColor(prefix + LocaleController.getString("RowGradientColor", R.string.RowGradientColor), sharedPreferences.getInt("drawerRowGradient", 0) != 0 ? sharedPreferences.getInt("drawerRowGradientColor", -1) : 0, true);
                } else if (i == ThemingDrawerActivity.this.listDividerColorRow) {
                    textColorCell.setTag("drawerListDividerColor");
                    textColorCell.setTextAndColor(prefix + LocaleController.getString("ListDividerColor", R.string.ListDividerColor), Theme.drawerListDividerColor, true);
                } else if (i == ThemingDrawerActivity.this.iconColorRow) {
                    textColorCell.setTag("drawerIconColor");
                    textColorCell.setTextAndColor(prefix + LocaleController.getString("IconColor", R.string.IconColor), Theme.drawerIconColor, true);
                } else if (i == ThemingDrawerActivity.this.optionColorRow) {
                    textColorCell.setTag("drawerOptionColor");
                    textColorCell.setTextAndColor(prefix + LocaleController.getString("OptionColor", R.string.OptionColor), Theme.drawerOptionColor, true);
                } else if (i == ThemingDrawerActivity.this.versionColorRow) {
                    textColorCell.setTag("drawerVersionColor");
                    textColorCell.setTextAndColor(prefix + LocaleController.getString("VersionColor", R.string.VersionColor), sharedPreferences.getInt("drawerVersionColor", -6052957), true);
                } else if (i == ThemingDrawerActivity.this.avatarColorRow) {
                    textColorCell.setTag("drawerAvatarColor");
                    textColorCell.setTextAndColor(prefix + LocaleController.getString("AvatarColor", R.string.AvatarColor), sharedPreferences.getInt("drawerAvatarColor", Theme.darkColor), true);
                } else if (i == ThemingDrawerActivity.this.nameColorRow) {
                    textColorCell.setTag("drawerNameColor");
                    textColorCell.setTextAndColor(prefix + LocaleController.getString("NameColor", R.string.NameColor), Theme.drawerNameColor, true);
                } else if (i == ThemingDrawerActivity.this.phoneColorRow) {
                    textColorCell.setTag("drawerPhoneColor");
                    textColorCell.setTextAndColor(prefix + LocaleController.getString("PhoneColor", R.string.PhoneColor), sharedPreferences.getInt("drawerPhoneColor", AndroidUtilities.getIntDarkerColor("themeColor", -64)), true);
                }
            } else if (itemViewType == 4) {
                textDetailSettingsCell = view == null ? new TextCheckCell(this.mContext) : view;
                TextCheckCell textCheckCell = (TextCheckCell) textDetailSettingsCell;
                textCheckCell.setMultilineText();
                if (i == ThemingDrawerActivity.this.headerBackgroundCheckRow) {
                    textCheckCell.setTag("drawerHeaderBGCheck");
                    textCheckCell.setTextAndCheck(prefix + LocaleController.getString("HideBackground", R.string.HideBackground), Theme.drawerHeaderBGCheck, true);
                } else if (i == ThemingDrawerActivity.this.hideBackgroundShadowRow) {
                    textCheckCell.setTag("drawerHideBGShadowCheck");
                    textCheckCell.setTextAndCheck(prefix + LocaleController.getString("HideBackgroundShadow", R.string.HideBackgroundShadow), Theme.drawerHideBGShadowCheck, true);
                } else if (i == ThemingDrawerActivity.this.centerAvatarRow) {
                    textCheckCell.setTag("drawerCenterAvatarCheck");
                    textCheckCell.setTextAndCheck(prefix + LocaleController.getString("CenterAvatar", R.string.CenterAvatar), Theme.drawerCenterAvatarCheck, false);
                } else if (i == ThemingDrawerActivity.this.rowGradientListCheckRow) {
                    textCheckCell.setTag("drawerRowGradientListCheck");
                    textCheckCell.setTextAndCheck(prefix + LocaleController.getString("RowGradientList", R.string.RowGradientList), AndroidUtilities.getIntDef("drawerRowGradient", 0) != 0 ? sharedPreferences.getBoolean("drawerRowGradientListCheck", false) : false, true);
                }
            } else {
                if (itemViewType == 5) {
                    textDetailSettingsCell = view == null ? new TextDetailSettingsCell(this.mContext) : view;
                    TextDetailSettingsCell textDetailSettingsCell2 = (TextDetailSettingsCell) textDetailSettingsCell;
                    textDetailSettingsCell2.setMultilineText(true);
                    if (i == ThemingDrawerActivity.this.headerGradientRow) {
                        textDetailSettingsCell2.setTag("drawerHeaderGradient");
                        textDetailSettingsCell2.setMultilineDetail(false);
                        int i3 = sharedPreferences.getInt("drawerHeaderGradient", 0);
                        if (i3 == 0) {
                            textDetailSettingsCell2.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false);
                        } else if (i3 == 1) {
                            textDetailSettingsCell2.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false);
                        } else if (i3 == 2) {
                            textDetailSettingsCell2.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false);
                        } else if (i3 == 3) {
                            textDetailSettingsCell2.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false);
                        } else if (i3 == 4) {
                            textDetailSettingsCell2.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false);
                        }
                    } else if (i == ThemingDrawerActivity.this.rowGradientRow) {
                        textDetailSettingsCell2.setTag("drawerRowGradient");
                        textDetailSettingsCell2.setMultilineDetail(false);
                        int i4 = sharedPreferences.getInt("drawerRowGradient", 0);
                        if (i4 == 0) {
                            textDetailSettingsCell2.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientDisabled", R.string.RowGradientDisabled), false);
                        } else if (i4 == 1) {
                            textDetailSettingsCell2.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTopBottom", R.string.RowGradientTopBottom), false);
                        } else if (i4 == 2) {
                            textDetailSettingsCell2.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientLeftRight", R.string.RowGradientLeftRight), false);
                        } else if (i4 == 3) {
                            textDetailSettingsCell2.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientTLBR", R.string.RowGradientTLBR), false);
                        } else if (i4 == 4) {
                            textDetailSettingsCell2.setTextAndValue(prefix + LocaleController.getString("RowGradient", R.string.RowGradient), LocaleController.getString("RowGradientBLTR", R.string.RowGradientBLTR), false);
                        }
                    }
                }
                textDetailSettingsCell = view;
            }
            if (textDetailSettingsCell != null) {
                textDetailSettingsCell.setBackgroundColor(Theme.usePlusTheme ? Theme.prefBGColor : Theme.getColor(Theme.key_windowBackgroundWhite));
            }
            if (textDetailSettingsCell != null) {
                textDetailSettingsCell.setBackgroundColor(Theme.usePlusTheme ? Theme.prefBGColor : Theme.getColor(Theme.key_windowBackgroundWhite));
            }
            return textDetailSettingsCell;
        }

        @Override
        public int getItemViewType(int i) {
            if (i == ThemingDrawerActivity.this.rowsSectionRow) {
                return 0;
            }
            if (i == ThemingDrawerActivity.this.headerSection2Row || i == ThemingDrawerActivity.this.rowsSection2Row) {
                return 1;
            }
            if (i == ThemingDrawerActivity.this.avatarRadiusRow || i == ThemingDrawerActivity.this.avatarSizeRow || i == ThemingDrawerActivity.this.nameSizeRow || i == ThemingDrawerActivity.this.phoneSizeRow || i == ThemingDrawerActivity.this.optionSizeRow || i == ThemingDrawerActivity.this.versionSizeRow) {
                return 2;
            }
            if (i == ThemingDrawerActivity.this.headerColorRow || i == ThemingDrawerActivity.this.headerGradientColorRow || i == ThemingDrawerActivity.this.listColorRow || i == ThemingDrawerActivity.this.rowGradientColorRow || i == ThemingDrawerActivity.this.listDividerColorRow || i == ThemingDrawerActivity.this.iconColorRow || i == ThemingDrawerActivity.this.optionColorRow || i == ThemingDrawerActivity.this.versionColorRow || i == ThemingDrawerActivity.this.avatarColorRow || i == ThemingDrawerActivity.this.nameColorRow || i == ThemingDrawerActivity.this.phoneColorRow || i == ThemingDrawerActivity.this.topShadowRow) {
                return 3;
            }
            if (i == ThemingDrawerActivity.this.headerBackgroundCheckRow || i == ThemingDrawerActivity.this.hideBackgroundShadowRow || i == ThemingDrawerActivity.this.centerAvatarRow || i == ThemingDrawerActivity.this.rowGradientListCheckRow) {
                return 4;
            }
            return (i == ThemingDrawerActivity.this.headerGradientRow || i == ThemingDrawerActivity.this.rowGradientRow) ? 5 : 2;
        }
    }
}