content: package androidx.appcompat.app;
  
  import android.content.Context;
  import android.content.DialogInterface;
  import android.database.Cursor;
  import android.graphics.drawable.Drawable;
  import android.os.Bundle;
  import android.os.Message;
  import android.util.TypedValue;
  import android.view.ContextThemeWrapper;
  import android.view.KeyEvent;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.Button;
  import android.widget.ListAdapter;
  import android.widget.ListView;
  import androidx.appcompat.R;
  import androidx.appcompat.app.AlertController;
  
  public class AlertDialog extends AppCompatDialog implements DialogInterface {
      static final int LAYOUT_HINT_NONE = 0;
      static final int LAYOUT_HINT_SIDE = 1;
      final AlertController mAlert;
  
      public static class Builder {
          private final AlertController.AlertParams P;
          private final int mTheme;
  
          public Builder(Context context) {
              this(context, AlertDialog.resolveDialogTheme(context, 0));
          }
  
          public Builder(Context context, int themeResId) {
              this.P = new AlertController.AlertParams(new ContextThemeWrapper(context, AlertDialog.resolveDialogTheme(context, themeResId)));
              this.mTheme = themeResId;
          }
  
          public AlertDialog create() {
              AlertDialog alertDialog = new AlertDialog(this.P.mContext, this.mTheme);
              this.P.apply(alertDialog.mAlert);
              alertDialog.setCancelable(this.P.mCancelable);
              if (this.P.mCancelable) {
                  alertDialog.setCanceledOnTouchOutside(true);
              }
              alertDialog.setOnCancelListener(this.P.mOnCancelListener);
              alertDialog.setOnDismissListener(this.P.mOnDismissListener);
              if (this.P.mOnKeyListener != null) {
                  alertDialog.setOnKeyListener(this.P.mOnKeyListener);
              }
              return alertDialog;
          }
  
          public Context getContext() {
              return this.P.mContext;
          }
  
          public Builder setAdapter(ListAdapter adapter, DialogInterface.OnClickListener listener) {
              this.P.mAdapter = adapter;
              this.P.mOnClickListener = listener;
              return this;
          }
  
          public Builder setCancelable(boolean cancelable) {
              this.P.mCancelable = cancelable;
              return this;
          }
  
          public Builder setCursor(Cursor cursor, DialogInterface.OnClickListener listener, String labelColumn) {
              this.P.mCursor = cursor;
              this.P.mLabelColumn = labelColumn;
              this.P.mOnClickListener = listener;
              return this;
          }
  
          public Builder setCustomTitle(View customTitleView) {
              this.P.mCustomTitleView = customTitleView;
              return this;
          }
  
          public Builder setIcon(int iconId) {
              this.P.mIconId = iconId;
              return this;
          }
  
          public Builder setIcon(Drawable icon) {
              this.P.mIcon = icon;
              return this;
          }
  
          public Builder setIconAttribute(int attrId) {
              TypedValue typedValue = new TypedValue();
              this.P.mContext.getTheme().resolveAttribute(attrId, typedValue, true);
              this.P.mIconId = typedValue.resourceId;
              return this;
          }
  
          @Deprecated
          public Builder setInverseBackgroundForced(boolean useInverseBackground) {
              this.P.mForceInverseBackground = useInverseBackground;
              return this;
          }
  
          public Builder setItems(int itemsId, DialogInterface.OnClickListener listener) {
              AlertController.AlertParams alertParams = this.P;
              alertParams.mItems = alertParams.mContext.getResources().getTextArray(itemsId);
              this.P.mOnClickListener = listener;
              return this;
          }
  
          public Builder setItems(CharSequence[] items, DialogInterface.OnClickListener listener) {
              this.P.mItems = items;
              this.P.mOnClickListener = listener;
              return this;
          }
  
          public Builder setMessage(int messageId) {
              AlertController.AlertParams alertParams = this.P;
              alertParams.mMessage = alertParams.mContext.getText(messageId);
              return this;
          }
  
          public Builder setMessage(CharSequence message) {
              this.P.mMessage = message;
              return this;
          }
  
          public Builder setMultiChoiceItems(int itemsId, boolean[] checkedItems, DialogInterface.OnMultiChoiceClickListener listener) {
              AlertController.AlertParams alertParams = this.P;
              alertParams.mItems = alertParams.mContext.getResources().getTextArray(itemsId);
              this.P.mOnCheckboxClickListener = listener;
              this.P.mCheckedItems = checkedItems;
              this.P.mIsMultiChoice = true;
              return this;
          }
  
          public Builder setMultiChoiceItems(Cursor cursor, String isCheckedColumn, String labelColumn, DialogInterface.OnMultiChoiceClickListener listener) {
              this.P.mCursor = cursor;
              this.P.mOnCheckboxClickListener = listener;
              this.P.mIsCheckedColumn = isCheckedColumn;
              this.P.mLabelColumn = labelColumn;
              this.P.mIsMultiChoice = true;
              return this;
          }
  
          public Builder setMultiChoiceItems(CharSequence[] items, boolean[] checkedItems, DialogInterface.OnMultiChoiceClickListener listener) {
              this.P.mItems = items;
              this.P.mOnCheckboxClickListener = listener;
              this.P.mCheckedItems = checkedItems;
              this.P.mIsMultiChoice = true;
              return this;
          }
  
          public Builder setNegativeButton(int textId, DialogInterface.OnClickListener listener) {
              AlertController.AlertParams alertParams = this.P;
              alertParams.mNegativeButtonText = alertParams.mContext.getText(textId);
              this.P.mNegativeButtonListener = listener;
              return this;
          }
  
          public Builder setNegativeButton(CharSequence text, DialogInterface.OnClickListener listener) {
              this.P.mNegativeButtonText = text;
              this.P.mNegativeButtonListener = listener;
              return this;
          }
  
          public Builder setNegativeButtonIcon(Drawable icon) {
              this.P.mNegativeButtonIcon = icon;
              return this;
          }
  
          public Builder setNeutralButton(int textId, DialogInterface.OnClickListener listener) {
              AlertController.AlertParams alertParams = this.P;
              alertParams.mNeutralButtonText = alertParams.mContext.getText(textId);
              this.P.mNeutralButtonListener = listener;
              return this;
          }
  
          public Builder setNeutralButton(CharSequence text, DialogInterface.OnClickListener listener) {
              this.P.mNeutralButtonText = text;
              this.P.mNeutralButtonListener = listener;
              return this;
          }
  
          public Builder setNeutralButtonIcon(Drawable icon) {
              this.P.mNeutralButtonIcon = icon;
              return this;
          }
  
          public Builder setOnCancelListener(DialogInterface.OnCancelListener onCancelListener) {
              this.P.mOnCancelListener = onCancelListener;
              return this;
          }
  
          public Builder setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
              this.P.mOnDismissListener = onDismissListener;
              return this;
          }
  
          public Builder setOnItemSelectedListener(AdapterView.OnItemSelectedListener listener) {
              this.P.mOnItemSelectedListener = listener;
              return this;
          }
  
          public Builder setOnKeyListener(DialogInterface.OnKeyListener onKeyListener) {
              this.P.mOnKeyListener = onKeyListener;
              return this;
          }
  
          public Builder setPositiveButton(int textId, DialogInterface.OnClickListener listener) {
              AlertController.AlertParams alertParams = this.P;
              alertParams.mPositiveButtonText = alertParams.mContext.getText(textId);
              this.P.mPositiveButtonListener = listener;
              return this;
          }
  
          public Builder setPositiveButton(CharSequence text, DialogInterface.OnClickListener listener) {
              this.P.mPositiveButtonText = text;
              this.P.mPositiveButtonListener = listener;
              return this;
          }
  
          public Builder setPositiveButtonIcon(Drawable icon) {
              this.P.mPositiveButtonIcon = icon;
              return this;
          }
  
          public Builder setRecycleOnMeasureEnabled(boolean enabled) {
              this.P.mRecycleOnMeasure = enabled;
              return this;
          }
  
          public Builder setSingleChoiceItems(int itemsId, int checkedItem, DialogInterface.OnClickListener listener) {
              AlertController.AlertParams alertParams = this.P;
              alertParams.mItems = alertParams.mContext.getResources().getTextArray(itemsId);
              this.P.mOnClickListener = listener;
              this.P.mCheckedItem = checkedItem;
              this.P.mIsSingleChoice = true;
              return this;
          }
  
          public Builder setSingleChoiceItems(Cursor cursor, int checkedItem, String labelColumn, DialogInterface.OnClickListener listener) {
              this.P.mCursor = cursor;
              this.P.mOnClickListener = listener;
              this.P.mCheckedItem = checkedItem;
              this.P.mLabelColumn = labelColumn;
              this.P.mIsSingleChoice = true;
              return this;
          }
  
          public Builder setSingleChoiceItems(ListAdapter adapter, int checkedItem, DialogInterface.OnClickListener listener) {
              this.P.mAdapter = adapter;
              this.P.mOnClickListener = listener;
              this.P.mCheckedItem = checkedItem;
              this.P.mIsSingleChoice = true;
              return this;
          }
  
          public Builder setSingleChoiceItems(CharSequence[] items, int checkedItem, DialogInterface.OnClickListener listener) {
              this.P.mItems = items;
              this.P.mOnClickListener = listener;
              this.P.mCheckedItem = checkedItem;
              this.P.mIsSingleChoice = true;
              return this;
          }
  
          public Builder setTitle(int titleId) {
              AlertController.AlertParams alertParams = this.P;
              alertParams.mTitle = alertParams.mContext.getText(titleId);
              return this;
          }
  
          public Builder setTitle(CharSequence title) {
              this.P.mTitle = title;
              return this;
          }
  
          public Builder setView(int layoutResId) {
              this.P.mView = null;
              this.P.mViewLayoutResId = layoutResId;
              this.P.mViewSpacingSpecified = false;
              return this;
          }
  
          public Builder setView(View view) {
              this.P.mView = view;
              this.P.mViewLayoutResId = 0;
              this.P.mViewSpacingSpecified = false;
              return this;
          }
  
          @Deprecated
          public Builder setView(View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight, int viewSpacingBottom) {
              this.P.mView = view;
              this.P.mViewLayoutResId = 0;
              this.P.mViewSpacingSpecified = true;
              this.P.mViewSpacingLeft = viewSpacingLeft;
              this.P.mViewSpacingTop = viewSpacingTop;
              this.P.mViewSpacingRight = viewSpacingRight;
              this.P.mViewSpacingBottom = viewSpacingBottom;
              return this;
          }
  
          public AlertDialog show() {
              AlertDialog create = create();
              create.show();
              return create;
          }
      }
  
      protected AlertDialog(Context context) {
          this(context, 0);
      }
  
      protected AlertDialog(Context context, int themeResId) {
          super(context, resolveDialogTheme(context, themeResId));
          this.mAlert = new AlertController(getContext(), this, getWindow());
      }
  
      protected AlertDialog(Context context, boolean cancelable, DialogInterface.OnCancelListener cancelListener) {
          this(context, 0);
          setCancelable(cancelable);
          setOnCancelListener(cancelListener);
      }
  
      static int resolveDialogTheme(Context context, int resid) {
          if (((resid >>> 24) & 255) >= 1) {
              return resid;
          }
          TypedValue typedValue = new TypedValue();
          context.getTheme().resolveAttribute(R.attr.alertDialogTheme, typedValue, true);
          return typedValue.resourceId;
      }
  
      public Button getButton(int whichButton) {
          return this.mAlert.getButton(whichButton);
      }
  
      public ListView getListView() {
          return this.mAlert.getListView();
      }
  
      /* access modifiers changed from: protected */
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          this.mAlert.installContent();
      }
  
      public boolean onKeyDown(int keyCode, KeyEvent event) {
          if (this.mAlert.onKeyDown(keyCode, event)) {
              return true;
          }
          return super.onKeyDown(keyCode, event);
      }
  
      public boolean onKeyUp(int keyCode, KeyEvent event) {
          if (this.mAlert.onKeyUp(keyCode, event)) {
              return true;
          }
          return super.onKeyUp(keyCode, event);
      }
  
      public void setButton(int whichButton, CharSequence text, DialogInterface.OnClickListener listener) {
          this.mAlert.setButton(whichButton, text, listener, (Message) null, (Drawable) null);
      }
  
      public void setButton(int whichButton, CharSequence text, Drawable icon, DialogInterface.OnClickListener listener) {
          this.mAlert.setButton(whichButton, text, listener, (Message) null, icon);
      }
  
      public void setButton(int whichButton, CharSequence text, Message msg) {
          this.mAlert.setButton(whichButton, text, (DialogInterface.OnClickListener) null, msg, (Drawable) null);
      }
  
      /* access modifiers changed from: package-private */
      public void setButtonPanelLayoutHint(int layoutHint) {
          this.mAlert.setButtonPanelLayoutHint(layoutHint);
      }
  
      public void setCustomTitle(View customTitleView) {
          this.mAlert.setCustomTitle(customTitleView);
      }
  
      public void setIcon(int resId) {
          this.mAlert.setIcon(resId);
      }
  
      public void setIcon(Drawable icon) {
          this.mAlert.setIcon(icon);
      }
  
      public void setIconAttribute(int attrId) {
          TypedValue typedValue = new TypedValue();
          getContext().getTheme().resolveAttribute(attrId, typedValue, true);
          this.mAlert.setIcon(typedValue.resourceId);
      }
  
      public void setMessage(CharSequence message) {
          this.mAlert.setMessage(message);
      }
  
      public void setTitle(CharSequence title) {
          super.setTitle(title);
          this.mAlert.setTitle(title);
      }
  
      public void setView(View view) {
          this.mAlert.setView(view);
      }
  
      public void setView(View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight, int viewSpacingBottom) {
          this.mAlert.setView(view, viewSpacingLeft, viewSpacingTop, viewSpacingRight, viewSpacingBottom);
      }
  }
  