package androidx.appcompat.app; import android.content.Context; import android.content.DialogInterface; import android.content.res.TypedArray; import android.database.Cursor; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Handler; import android.os.Message; import android.text.TextUtils; import android.util.AttributeSet; import android.util.TypedValue; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; import android.view.ViewStub; import android.view.Window; import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.CheckedTextView; import android.widget.CursorAdapter; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleCursorAdapter; import android.widget.TextView; import androidx.annotation.Nullable; import androidx.appcompat.R; import androidx.appcompat.widget.LinearLayoutCompat; import androidx.core.view.ViewCompat; import androidx.core.widget.NestedScrollView; import java.lang.ref.WeakReference; public class AlertController { public ListAdapter mAdapter; private int mAlertDialogLayout; private final View.OnClickListener mButtonHandler = new AnonymousClass1(); private final int mButtonIconDimen; public Button mButtonNegative; private Drawable mButtonNegativeIcon; public Message mButtonNegativeMessage; private CharSequence mButtonNegativeText; public Button mButtonNeutral; private Drawable mButtonNeutralIcon; public Message mButtonNeutralMessage; private CharSequence mButtonNeutralText; private int mButtonPanelLayoutHint = 0; private int mButtonPanelSideLayout; public Button mButtonPositive; private Drawable mButtonPositiveIcon; public Message mButtonPositiveMessage; private CharSequence mButtonPositiveText; public int mCheckedItem = -1; private final Context mContext; private View mCustomTitleView; public final AppCompatDialog mDialog; public Handler mHandler; private Drawable mIcon; private int mIconId = 0; private ImageView mIconView; public int mListItemLayout; public int mListLayout; public ListView mListView; private CharSequence mMessage; private TextView mMessageView; public int mMultiChoiceItemLayout; public NestedScrollView mScrollView; private boolean mShowTitle; public int mSingleChoiceItemLayout; private CharSequence mTitle; private TextView mTitleView; private View mView; private int mViewLayoutResId; private int mViewSpacingBottom; private int mViewSpacingLeft; private int mViewSpacingRight; private boolean mViewSpacingSpecified = false; private int mViewSpacingTop; private final Window mWindow; /* renamed from: androidx.appcompat.app.AlertController$1 reason: invalid class name */ public class AnonymousClass1 implements View.OnClickListener { public AnonymousClass1() { } @Override // android.view.View.OnClickListener public void onClick(View view) { Message message; Message message2; Message message3; AlertController alertController = AlertController.this; Message obtain = (view != alertController.mButtonPositive || (message3 = alertController.mButtonPositiveMessage) == null) ? (view != alertController.mButtonNegative || (message2 = alertController.mButtonNegativeMessage) == null) ? (view != alertController.mButtonNeutral || (message = alertController.mButtonNeutralMessage) == null) ? null : Message.obtain(message) : Message.obtain(message2) : Message.obtain(message3); if (obtain != null) { obtain.sendToTarget(); } AlertController alertController2 = AlertController.this; alertController2.mHandler.obtainMessage(1, alertController2.mDialog).sendToTarget(); } } /* renamed from: androidx.appcompat.app.AlertController$2 reason: invalid class name */ public class AnonymousClass2 implements NestedScrollView.OnScrollChangeListener { public final /* synthetic */ View val$bottom; public final /* synthetic */ View val$top; public AnonymousClass2(View view, View view2) { this.val$top = view; this.val$bottom = view2; } @Override // androidx.core.widget.NestedScrollView.OnScrollChangeListener public void onScrollChange(NestedScrollView nestedScrollView, int i, int i2, int i3, int i4) { AlertController.manageScrollIndicators(nestedScrollView, this.val$top, this.val$bottom); } } /* renamed from: androidx.appcompat.app.AlertController$3 reason: invalid class name */ public class AnonymousClass3 implements Runnable { public final /* synthetic */ View val$bottom; public final /* synthetic */ View val$top; public AnonymousClass3(View view, View view2) { this.val$top = view; this.val$bottom = view2; } @Override // java.lang.Runnable public void run() { AlertController.manageScrollIndicators(AlertController.this.mScrollView, this.val$top, this.val$bottom); } } /* renamed from: androidx.appcompat.app.AlertController$4 reason: invalid class name */ public class AnonymousClass4 implements AbsListView.OnScrollListener { public final /* synthetic */ View val$bottom; public final /* synthetic */ View val$top; public AnonymousClass4(View view, View view2) { this.val$top = view; this.val$bottom = view2; } @Override // android.widget.AbsListView.OnScrollListener public void onScroll(AbsListView absListView, int i, int i2, int i3) { AlertController.manageScrollIndicators(absListView, this.val$top, this.val$bottom); } @Override // android.widget.AbsListView.OnScrollListener public void onScrollStateChanged(AbsListView absListView, int i) { } } /* renamed from: androidx.appcompat.app.AlertController$5 reason: invalid class name */ public class AnonymousClass5 implements Runnable { public final /* synthetic */ View val$bottom; public final /* synthetic */ View val$top; public AnonymousClass5(View view, View view2) { this.val$top = view; this.val$bottom = view2; } @Override // java.lang.Runnable public void run() { AlertController.manageScrollIndicators(AlertController.this.mListView, this.val$top, this.val$bottom); } } public static class AlertParams { public ListAdapter mAdapter; public boolean mCancelable; public int mCheckedItem = -1; public boolean[] mCheckedItems; public final Context mContext; public Cursor mCursor; public View mCustomTitleView; public boolean mForceInverseBackground; public Drawable mIcon; public int mIconAttrId = 0; public int mIconId = 0; public final LayoutInflater mInflater; public String mIsCheckedColumn; public boolean mIsMultiChoice; public boolean mIsSingleChoice; public CharSequence[] mItems; public String mLabelColumn; public CharSequence mMessage; public Drawable mNegativeButtonIcon; public DialogInterface.OnClickListener mNegativeButtonListener; public CharSequence mNegativeButtonText; public Drawable mNeutralButtonIcon; public DialogInterface.OnClickListener mNeutralButtonListener; public CharSequence mNeutralButtonText; public DialogInterface.OnCancelListener mOnCancelListener; public DialogInterface.OnMultiChoiceClickListener mOnCheckboxClickListener; public DialogInterface.OnClickListener mOnClickListener; public DialogInterface.OnDismissListener mOnDismissListener; public AdapterView.OnItemSelectedListener mOnItemSelectedListener; public DialogInterface.OnKeyListener mOnKeyListener; public OnPrepareListViewListener mOnPrepareListViewListener; public Drawable mPositiveButtonIcon; public DialogInterface.OnClickListener mPositiveButtonListener; public CharSequence mPositiveButtonText; public boolean mRecycleOnMeasure = true; public CharSequence mTitle; public View mView; public int mViewLayoutResId; public int mViewSpacingBottom; public int mViewSpacingLeft; public int mViewSpacingRight; public boolean mViewSpacingSpecified = false; public int mViewSpacingTop; /* renamed from: androidx.appcompat.app.AlertController$AlertParams$1 reason: invalid class name */ public class AnonymousClass1 extends ArrayAdapter { public final /* synthetic */ RecycleListView val$listView; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public AnonymousClass1(Context context, int i, int i2, CharSequence[] charSequenceArr, RecycleListView recycleListView) { super(context, i, i2, charSequenceArr); this.val$listView = recycleListView; } @Override // android.widget.ArrayAdapter, android.widget.Adapter public View getView(int i, View view, ViewGroup viewGroup) { View view2 = super.getView(i, view, viewGroup); boolean[] zArr = AlertParams.this.mCheckedItems; if (zArr != null && zArr[i]) { this.val$listView.setItemChecked(i, true); } return view2; } } /* renamed from: androidx.appcompat.app.AlertController$AlertParams$2 reason: invalid class name */ public class AnonymousClass2 extends CursorAdapter { private final int mIsCheckedIndex; private final int mLabelIndex; public final /* synthetic */ AlertController val$dialog; public final /* synthetic */ RecycleListView val$listView; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public AnonymousClass2(Context context, Cursor cursor, boolean z2, RecycleListView recycleListView, AlertController alertController) { super(context, cursor, z2); this.val$listView = recycleListView; this.val$dialog = alertController; Cursor cursor2 = getCursor(); this.mLabelIndex = cursor2.getColumnIndexOrThrow(AlertParams.this.mLabelColumn); this.mIsCheckedIndex = cursor2.getColumnIndexOrThrow(AlertParams.this.mIsCheckedColumn); } @Override // android.widget.CursorAdapter public void bindView(View view, Context context, Cursor cursor) { ((CheckedTextView) view.findViewById(16908308)).setText(cursor.getString(this.mLabelIndex)); RecycleListView recycleListView = this.val$listView; int position = cursor.getPosition(); boolean z2 = true; if (cursor.getInt(this.mIsCheckedIndex) != 1) { z2 = false; } recycleListView.setItemChecked(position, z2); } @Override // android.widget.CursorAdapter public View newView(Context context, Cursor cursor, ViewGroup viewGroup) { return AlertParams.this.mInflater.inflate(this.val$dialog.mMultiChoiceItemLayout, viewGroup, false); } } /* renamed from: androidx.appcompat.app.AlertController$AlertParams$3 reason: invalid class name */ public class AnonymousClass3 implements AdapterView.OnItemClickListener { public final /* synthetic */ AlertController val$dialog; public AnonymousClass3(AlertController alertController) { this.val$dialog = alertController; } @Override // android.widget.AdapterView.OnItemClickListener public void onItemClick(AdapterView adapterView, View view, int i, long j) { AlertParams.this.mOnClickListener.onClick(this.val$dialog.mDialog, i); if (!AlertParams.this.mIsSingleChoice) { this.val$dialog.mDialog.dismiss(); } } } /* renamed from: androidx.appcompat.app.AlertController$AlertParams$4 reason: invalid class name */ public class AnonymousClass4 implements AdapterView.OnItemClickListener { public final /* synthetic */ AlertController val$dialog; public final /* synthetic */ RecycleListView val$listView; public AnonymousClass4(RecycleListView recycleListView, AlertController alertController) { this.val$listView = recycleListView; this.val$dialog = alertController; } @Override // android.widget.AdapterView.OnItemClickListener public void onItemClick(AdapterView adapterView, View view, int i, long j) { boolean[] zArr = AlertParams.this.mCheckedItems; if (zArr != null) { zArr[i] = this.val$listView.isItemChecked(i); } AlertParams.this.mOnCheckboxClickListener.onClick(this.val$dialog.mDialog, i, this.val$listView.isItemChecked(i)); } } public interface OnPrepareListViewListener { void onPrepareListView(ListView listView); } public AlertParams(Context context) { this.mContext = context; this.mCancelable = true; this.mInflater = (LayoutInflater) context.getSystemService("layout_inflater"); } private void createListView(AlertController alertController) { ListAdapter listAdapter; RecycleListView recycleListView = (RecycleListView) this.mInflater.inflate(alertController.mListLayout, (ViewGroup) null); if (this.mIsMultiChoice) { listAdapter = this.mCursor == null ? new AnonymousClass1(this.mContext, alertController.mMultiChoiceItemLayout, 16908308, this.mItems, recycleListView) : new AnonymousClass2(this.mContext, this.mCursor, false, recycleListView, alertController); } else { int i = this.mIsSingleChoice ? alertController.mSingleChoiceItemLayout : alertController.mListItemLayout; if (this.mCursor != null) { listAdapter = new SimpleCursorAdapter(this.mContext, i, this.mCursor, new String[]{this.mLabelColumn}, new int[]{16908308}); } else { listAdapter = this.mAdapter; if (listAdapter == null) { listAdapter = new CheckedItemAdapter(this.mContext, i, 16908308, this.mItems); } } } OnPrepareListViewListener onPrepareListViewListener = this.mOnPrepareListViewListener; if (onPrepareListViewListener != null) { onPrepareListViewListener.onPrepareListView(recycleListView); } alertController.mAdapter = listAdapter; alertController.mCheckedItem = this.mCheckedItem; if (this.mOnClickListener != null) { recycleListView.setOnItemClickListener(new AnonymousClass3(alertController)); } else if (this.mOnCheckboxClickListener != null) { recycleListView.setOnItemClickListener(new AnonymousClass4(recycleListView, alertController)); } AdapterView.OnItemSelectedListener onItemSelectedListener = this.mOnItemSelectedListener; if (onItemSelectedListener != null) { recycleListView.setOnItemSelectedListener(onItemSelectedListener); } if (this.mIsSingleChoice) { recycleListView.setChoiceMode(1); } else if (this.mIsMultiChoice) { recycleListView.setChoiceMode(2); } alertController.mListView = recycleListView; } public void apply(AlertController alertController) { View view = this.mCustomTitleView; if (view != null) { alertController.setCustomTitle(view); } else { CharSequence charSequence = this.mTitle; if (charSequence != null) { alertController.setTitle(charSequence); } Drawable drawable = this.mIcon; if (drawable != null) { alertController.setIcon(drawable); } int i = this.mIconId; if (i != 0) { alertController.setIcon(i); } int i2 = this.mIconAttrId; if (i2 != 0) { alertController.setIcon(alertController.getIconAttributeResId(i2)); } } CharSequence charSequence2 = this.mMessage; if (charSequence2 != null) { alertController.setMessage(charSequence2); } CharSequence charSequence3 = this.mPositiveButtonText; if (!(charSequence3 == null && this.mPositiveButtonIcon == null)) { alertController.setButton(-1, charSequence3, this.mPositiveButtonListener, null, this.mPositiveButtonIcon); } CharSequence charSequence4 = this.mNegativeButtonText; if (!(charSequence4 == null && this.mNegativeButtonIcon == null)) { alertController.setButton(-2, charSequence4, this.mNegativeButtonListener, null, this.mNegativeButtonIcon); } CharSequence charSequence5 = this.mNeutralButtonText; if (!(charSequence5 == null && this.mNeutralButtonIcon == null)) { alertController.setButton(-3, charSequence5, this.mNeutralButtonListener, null, this.mNeutralButtonIcon); } if (!(this.mItems == null && this.mCursor == null && this.mAdapter == null)) { createListView(alertController); } View view2 = this.mView; if (view2 == null) { int i3 = this.mViewLayoutResId; if (i3 != 0) { alertController.setView(i3); } } else if (this.mViewSpacingSpecified) { alertController.setView(view2, this.mViewSpacingLeft, this.mViewSpacingTop, this.mViewSpacingRight, this.mViewSpacingBottom); } else { alertController.setView(view2); } } } public static final class ButtonHandler extends Handler { private static final int MSG_DISMISS_DIALOG = 1; private WeakReference mDialog; public ButtonHandler(DialogInterface dialogInterface) { this.mDialog = new WeakReference<>(dialogInterface); } @Override // android.os.Handler public void handleMessage(Message message) { int i = message.what; if (i == -3 || i == -2 || i == -1) { ((DialogInterface.OnClickListener) message.obj).onClick(this.mDialog.get(), message.what); } else if (i == 1) { ((DialogInterface) message.obj).dismiss(); } } } public static class CheckedItemAdapter extends ArrayAdapter { public CheckedItemAdapter(Context context, int i, int i2, CharSequence[] charSequenceArr) { super(context, i, i2, charSequenceArr); } @Override // android.widget.ArrayAdapter, android.widget.Adapter public long getItemId(int i) { return (long) i; } @Override // android.widget.Adapter, android.widget.BaseAdapter public boolean hasStableIds() { return true; } } public static class RecycleListView extends ListView { private final int mPaddingBottomNoButtons; private final int mPaddingTopNoTitle; public RecycleListView(Context context) { this(context, null); } public RecycleListView(Context context, AttributeSet attributeSet) { super(context, attributeSet); TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.RecycleListView); this.mPaddingBottomNoButtons = obtainStyledAttributes.getDimensionPixelOffset(R.styleable.RecycleListView_paddingBottomNoButtons, -1); this.mPaddingTopNoTitle = obtainStyledAttributes.getDimensionPixelOffset(R.styleable.RecycleListView_paddingTopNoTitle, -1); } public void setHasDecor(boolean z2, boolean z3) { if (!z3 || !z2) { setPadding(getPaddingLeft(), z2 ? getPaddingTop() : this.mPaddingTopNoTitle, getPaddingRight(), z3 ? getPaddingBottom() : this.mPaddingBottomNoButtons); } } } public AlertController(Context context, AppCompatDialog appCompatDialog, Window window) { this.mContext = context; this.mDialog = appCompatDialog; this.mWindow = window; this.mHandler = new ButtonHandler(appCompatDialog); TypedArray obtainStyledAttributes = context.obtainStyledAttributes(null, R.styleable.AlertDialog, R.attr.alertDialogStyle, 0); this.mAlertDialogLayout = obtainStyledAttributes.getResourceId(R.styleable.AlertDialog_android_layout, 0); this.mButtonPanelSideLayout = obtainStyledAttributes.getResourceId(R.styleable.AlertDialog_buttonPanelSideLayout, 0); this.mListLayout = obtainStyledAttributes.getResourceId(R.styleable.AlertDialog_listLayout, 0); this.mMultiChoiceItemLayout = obtainStyledAttributes.getResourceId(R.styleable.AlertDialog_multiChoiceItemLayout, 0); this.mSingleChoiceItemLayout = obtainStyledAttributes.getResourceId(R.styleable.AlertDialog_singleChoiceItemLayout, 0); this.mListItemLayout = obtainStyledAttributes.getResourceId(R.styleable.AlertDialog_listItemLayout, 0); this.mShowTitle = obtainStyledAttributes.getBoolean(R.styleable.AlertDialog_showTitle, true); this.mButtonIconDimen = obtainStyledAttributes.getDimensionPixelSize(R.styleable.AlertDialog_buttonIconDimen, 0); obtainStyledAttributes.recycle(); appCompatDialog.supportRequestWindowFeature(1); } public static boolean canTextInput(View view) { if (view.onCheckIsTextEditor()) { return true; } if (!(view instanceof ViewGroup)) { return false; } ViewGroup viewGroup = (ViewGroup) view; int childCount = viewGroup.getChildCount(); while (childCount > 0) { childCount--; if (canTextInput(viewGroup.getChildAt(childCount))) { return true; } } return false; } private void centerButton(Button button) { LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) button.getLayoutParams(); layoutParams.gravity = 1; layoutParams.weight = 0.5f; button.setLayoutParams(layoutParams); } public static void manageScrollIndicators(View view, View view2, View view3) { int i = 0; if (view2 != null) { view2.setVisibility(view.canScrollVertically(-1) ? 0 : 4); } if (view3 != null) { if (!view.canScrollVertically(1)) { i = 4; } view3.setVisibility(i); } } @Nullable private ViewGroup resolvePanel(@Nullable View view, @Nullable View view2) { if (view == null) { if (view2 instanceof ViewStub) { view2 = ((ViewStub) view2).inflate(); } return (ViewGroup) view2; } if (view2 != null) { ViewParent parent = view2.getParent(); if (parent instanceof ViewGroup) { ((ViewGroup) parent).removeView(view2); } } if (view instanceof ViewStub) { view = ((ViewStub) view).inflate(); } return (ViewGroup) view; } private int selectContentView() { int i = this.mButtonPanelSideLayout; return i == 0 ? this.mAlertDialogLayout : this.mButtonPanelLayoutHint == 1 ? i : this.mAlertDialogLayout; } private void setScrollIndicators(ViewGroup viewGroup, View view, int i, int i2) { View findViewById = this.mWindow.findViewById(R.id.scrollIndicatorUp); View findViewById2 = this.mWindow.findViewById(R.id.scrollIndicatorDown); if (Build.VERSION.SDK_INT >= 23) { ViewCompat.setScrollIndicators(view, i, i2); if (findViewById != null) { viewGroup.removeView(findViewById); } if (findViewById2 != null) { viewGroup.removeView(findViewById2); return; } return; } if (findViewById != null && (i & 1) == 0) { viewGroup.removeView(findViewById); findViewById = null; } if (findViewById2 != null && (i & 2) == 0) { viewGroup.removeView(findViewById2); findViewById2 = null; } if (findViewById != null || findViewById2 != null) { if (this.mMessage != null) { this.mScrollView.setOnScrollChangeListener(new AnonymousClass2(findViewById, findViewById2)); this.mScrollView.post(new AnonymousClass3(findViewById, findViewById2)); return; } ListView listView = this.mListView; if (listView != null) { listView.setOnScrollListener(new AnonymousClass4(findViewById, findViewById2)); this.mListView.post(new AnonymousClass5(findViewById, findViewById2)); return; } if (findViewById != null) { viewGroup.removeView(findViewById); } if (findViewById2 != null) { viewGroup.removeView(findViewById2); } } } private void setupButtons(ViewGroup viewGroup) { boolean z2; Button button = (Button) viewGroup.findViewById(16908313); this.mButtonPositive = button; button.setOnClickListener(this.mButtonHandler); boolean z3 = true; if (!TextUtils.isEmpty(this.mButtonPositiveText) || this.mButtonPositiveIcon != null) { this.mButtonPositive.setText(this.mButtonPositiveText); Drawable drawable = this.mButtonPositiveIcon; if (drawable != null) { int i = this.mButtonIconDimen; drawable.setBounds(0, 0, i, i); this.mButtonPositive.setCompoundDrawables(this.mButtonPositiveIcon, null, null, null); } this.mButtonPositive.setVisibility(0); z2 = true; } else { this.mButtonPositive.setVisibility(8); z2 = false; } Button button2 = (Button) viewGroup.findViewById(16908314); this.mButtonNegative = button2; button2.setOnClickListener(this.mButtonHandler); if (!TextUtils.isEmpty(this.mButtonNegativeText) || this.mButtonNegativeIcon != null) { this.mButtonNegative.setText(this.mButtonNegativeText); Drawable drawable2 = this.mButtonNegativeIcon; if (drawable2 != null) { int i2 = this.mButtonIconDimen; drawable2.setBounds(0, 0, i2, i2); this.mButtonNegative.setCompoundDrawables(this.mButtonNegativeIcon, null, null, null); } this.mButtonNegative.setVisibility(0); z2 |= true; } else { this.mButtonNegative.setVisibility(8); } Button button3 = (Button) viewGroup.findViewById(16908315); this.mButtonNeutral = button3; button3.setOnClickListener(this.mButtonHandler); if (!TextUtils.isEmpty(this.mButtonNeutralText) || this.mButtonNeutralIcon != null) { this.mButtonNeutral.setText(this.mButtonNeutralText); Drawable drawable3 = this.mButtonNeutralIcon; if (drawable3 != null) { int i3 = this.mButtonIconDimen; drawable3.setBounds(0, 0, i3, i3); this.mButtonNeutral.setCompoundDrawables(this.mButtonNeutralIcon, null, null, null); } this.mButtonNeutral.setVisibility(0); z2 |= true; } else { this.mButtonNeutral.setVisibility(8); } if (shouldCenterSingleButton(this.mContext)) { if (z2) { centerButton(this.mButtonPositive); } else if (z2) { centerButton(this.mButtonNegative); } else if (z2) { centerButton(this.mButtonNeutral); } } if (!z2) { z3 = false; } if (!z3) { viewGroup.setVisibility(8); } } private void setupContent(ViewGroup viewGroup) { NestedScrollView nestedScrollView = (NestedScrollView) this.mWindow.findViewById(R.id.scrollView); this.mScrollView = nestedScrollView; nestedScrollView.setFocusable(false); this.mScrollView.setNestedScrollingEnabled(false); TextView textView = (TextView) viewGroup.findViewById(16908299); this.mMessageView = textView; if (textView != null) { CharSequence charSequence = this.mMessage; if (charSequence != null) { textView.setText(charSequence); return; } textView.setVisibility(8); this.mScrollView.removeView(this.mMessageView); if (this.mListView != null) { ViewGroup viewGroup2 = (ViewGroup) this.mScrollView.getParent(); int indexOfChild = viewGroup2.indexOfChild(this.mScrollView); viewGroup2.removeViewAt(indexOfChild); viewGroup2.addView(this.mListView, indexOfChild, new ViewGroup.LayoutParams(-1, -1)); return; } viewGroup.setVisibility(8); } } private void setupCustomContent(ViewGroup viewGroup) { View view = this.mView; boolean z2 = false; if (view == null) { view = this.mViewLayoutResId != 0 ? LayoutInflater.from(this.mContext).inflate(this.mViewLayoutResId, viewGroup, false) : null; } if (view != null) { z2 = true; } if (!z2 || !canTextInput(view)) { this.mWindow.setFlags(131072, 131072); } if (z2) { FrameLayout frameLayout = (FrameLayout) this.mWindow.findViewById(R.id.custom); frameLayout.addView(view, new ViewGroup.LayoutParams(-1, -1)); if (this.mViewSpacingSpecified) { frameLayout.setPadding(this.mViewSpacingLeft, this.mViewSpacingTop, this.mViewSpacingRight, this.mViewSpacingBottom); } if (this.mListView != null) { ((LinearLayoutCompat.LayoutParams) viewGroup.getLayoutParams()).weight = 0.0f; return; } return; } viewGroup.setVisibility(8); } private void setupTitle(ViewGroup viewGroup) { if (this.mCustomTitleView != null) { viewGroup.addView(this.mCustomTitleView, 0, new ViewGroup.LayoutParams(-1, -2)); this.mWindow.findViewById(R.id.title_template).setVisibility(8); return; } this.mIconView = (ImageView) this.mWindow.findViewById(16908294); if (!(!TextUtils.isEmpty(this.mTitle)) || !this.mShowTitle) { this.mWindow.findViewById(R.id.title_template).setVisibility(8); this.mIconView.setVisibility(8); viewGroup.setVisibility(8); return; } TextView textView = (TextView) this.mWindow.findViewById(R.id.alertTitle); this.mTitleView = textView; textView.setText(this.mTitle); int i = this.mIconId; if (i != 0) { this.mIconView.setImageResource(i); return; } Drawable drawable = this.mIcon; if (drawable != null) { this.mIconView.setImageDrawable(drawable); return; } this.mTitleView.setPadding(this.mIconView.getPaddingLeft(), this.mIconView.getPaddingTop(), this.mIconView.getPaddingRight(), this.mIconView.getPaddingBottom()); this.mIconView.setVisibility(8); } private void setupView() { ListAdapter listAdapter; View findViewById; View findViewById2; View findViewById3 = this.mWindow.findViewById(R.id.parentPanel); int i = R.id.topPanel; View findViewById4 = findViewById3.findViewById(i); int i2 = R.id.contentPanel; View findViewById5 = findViewById3.findViewById(i2); int i3 = R.id.buttonPanel; View findViewById6 = findViewById3.findViewById(i3); ViewGroup viewGroup = (ViewGroup) findViewById3.findViewById(R.id.customPanel); setupCustomContent(viewGroup); View findViewById7 = viewGroup.findViewById(i); View findViewById8 = viewGroup.findViewById(i2); View findViewById9 = viewGroup.findViewById(i3); ViewGroup resolvePanel = resolvePanel(findViewById7, findViewById4); ViewGroup resolvePanel2 = resolvePanel(findViewById8, findViewById5); ViewGroup resolvePanel3 = resolvePanel(findViewById9, findViewById6); setupContent(resolvePanel2); setupButtons(resolvePanel3); setupTitle(resolvePanel); int i4 = 0; boolean z2 = viewGroup.getVisibility() != 8; boolean z3 = (resolvePanel == null || resolvePanel.getVisibility() == 8) ? false : true; boolean z4 = (resolvePanel3 == null || resolvePanel3.getVisibility() == 8) ? false : true; if (!(z4 || resolvePanel2 == null || (findViewById2 = resolvePanel2.findViewById(R.id.textSpacerNoButtons)) == null)) { findViewById2.setVisibility(0); } if (z3) { NestedScrollView nestedScrollView = this.mScrollView; if (nestedScrollView != null) { nestedScrollView.setClipToPadding(true); } View view = null; if (!(this.mMessage == null && this.mListView == null)) { view = resolvePanel.findViewById(R.id.titleDividerNoCustom); } if (view != null) { view.setVisibility(0); } } else if (!(resolvePanel2 == null || (findViewById = resolvePanel2.findViewById(R.id.textSpacerNoTitle)) == null)) { findViewById.setVisibility(0); } ListView listView = this.mListView; if (listView instanceof RecycleListView) { ((RecycleListView) listView).setHasDecor(z3, z4); } if (!z2) { View view2 = this.mListView; if (view2 == null) { view2 = this.mScrollView; } if (view2 != null) { if (z4) { i4 = 2; } int i5 = z3 ? 1 : 0; char c = z3 ? 1 : 0; char c2 = z3 ? 1 : 0; setScrollIndicators(resolvePanel2, view2, i5 | i4, 3); } } ListView listView2 = this.mListView; if (listView2 != null && (listAdapter = this.mAdapter) != null) { listView2.setAdapter(listAdapter); int i6 = this.mCheckedItem; if (i6 > -1) { listView2.setItemChecked(i6, true); listView2.setSelection(i6); } } } private static boolean shouldCenterSingleButton(Context context) { TypedValue typedValue = new TypedValue(); context.getTheme().resolveAttribute(R.attr.alertDialogCenterButtons, typedValue, true); return typedValue.data != 0; } public Button getButton(int i) { if (i == -3) { return this.mButtonNeutral; } if (i == -2) { return this.mButtonNegative; } if (i != -1) { return null; } return this.mButtonPositive; } public int getIconAttributeResId(int i) { TypedValue typedValue = new TypedValue(); this.mContext.getTheme().resolveAttribute(i, typedValue, true); return typedValue.resourceId; } public ListView getListView() { return this.mListView; } public void installContent() { this.mDialog.setContentView(selectContentView()); setupView(); } public boolean onKeyDown(int i, KeyEvent keyEvent) { NestedScrollView nestedScrollView = this.mScrollView; return nestedScrollView != null && nestedScrollView.executeKeyEvent(keyEvent); } public boolean onKeyUp(int i, KeyEvent keyEvent) { NestedScrollView nestedScrollView = this.mScrollView; return nestedScrollView != null && nestedScrollView.executeKeyEvent(keyEvent); } public void setButton(int i, CharSequence charSequence, DialogInterface.OnClickListener onClickListener, Message message, Drawable drawable) { if (message == null && onClickListener != null) { message = this.mHandler.obtainMessage(i, onClickListener); } if (i == -3) { this.mButtonNeutralText = charSequence; this.mButtonNeutralMessage = message; this.mButtonNeutralIcon = drawable; } else if (i == -2) { this.mButtonNegativeText = charSequence; this.mButtonNegativeMessage = message; this.mButtonNegativeIcon = drawable; } else if (i == -1) { this.mButtonPositiveText = charSequence; this.mButtonPositiveMessage = message; this.mButtonPositiveIcon = drawable; } else { throw new IllegalArgumentException("Button does not exist"); } } public void setButtonPanelLayoutHint(int i) { this.mButtonPanelLayoutHint = i; } public void setCustomTitle(View view) { this.mCustomTitleView = view; } public void setIcon(int i) { this.mIcon = null; this.mIconId = i; ImageView imageView = this.mIconView; if (imageView == null) { return; } if (i != 0) { imageView.setVisibility(0); this.mIconView.setImageResource(this.mIconId); return; } imageView.setVisibility(8); } public void setIcon(Drawable drawable) { this.mIcon = drawable; this.mIconId = 0; ImageView imageView = this.mIconView; if (imageView == null) { return; } if (drawable != null) { imageView.setVisibility(0); this.mIconView.setImageDrawable(drawable); return; } imageView.setVisibility(8); } public void setMessage(CharSequence charSequence) { this.mMessage = charSequence; TextView textView = this.mMessageView; if (textView != null) { textView.setText(charSequence); } } public void setTitle(CharSequence charSequence) { this.mTitle = charSequence; TextView textView = this.mTitleView; if (textView != null) { textView.setText(charSequence); } } public void setView(int i) { this.mView = null; this.mViewLayoutResId = i; this.mViewSpacingSpecified = false; } public void setView(View view) { this.mView = view; this.mViewLayoutResId = 0; this.mViewSpacingSpecified = false; } public void setView(View view, int i, int i2, int i3, int i4) { this.mView = view; this.mViewLayoutResId = 0; this.mViewSpacingSpecified = true; this.mViewSpacingLeft = i; this.mViewSpacingTop = i2; this.mViewSpacingRight = i3; this.mViewSpacingBottom = i4; } }