package androidx.appcompat.app; import android.app.Dialog; import android.content.Context; import android.os.Bundle; import android.util.TypedValue; import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; import androidx.appcompat.R$attr; import androidx.appcompat.view.ActionMode; import androidx.core.view.KeyEventDispatcher; /* loaded from: classes.dex */ public class AppCompatDialog extends Dialog implements AppCompatCallback { private AppCompatDelegate a; private final KeyEventDispatcher.Component b; public AppCompatDialog(Context context) { this(context, 0); } public boolean a(int i) { return a().b(i); } @Override // android.app.Dialog public void addContentView(View view, ViewGroup.LayoutParams layoutParams) { a().a(view, layoutParams); } @Override // android.app.Dialog, android.view.Window.Callback public boolean dispatchKeyEvent(KeyEvent keyEvent) { return KeyEventDispatcher.a(this.b, getWindow().getDecorView(), this, keyEvent); } @Override // android.app.Dialog public T findViewById(int i) { return (T) a().a(i); } @Override // android.app.Dialog public void invalidateOptionsMenu() { a().f(); } @Override // android.app.Dialog protected void onCreate(Bundle bundle) { a().e(); super.onCreate(bundle); a().a(bundle); } @Override // android.app.Dialog protected void onStop() { super.onStop(); a().j(); } @Override // androidx.appcompat.app.AppCompatCallback public void onSupportActionModeFinished(ActionMode actionMode) { } @Override // androidx.appcompat.app.AppCompatCallback public void onSupportActionModeStarted(ActionMode actionMode) { } @Override // androidx.appcompat.app.AppCompatCallback public ActionMode onWindowStartingSupportActionMode(ActionMode.Callback callback) { return null; } @Override // android.app.Dialog public void setContentView(int i) { a().c(i); } @Override // android.app.Dialog public void setTitle(CharSequence charSequence) { super.setTitle(charSequence); a().a(charSequence); } public AppCompatDialog(Context context, int i) { super(context, a(context, i)); this.b = new KeyEventDispatcher.Component() { // from class: androidx.appcompat.app.AppCompatDialog.1 @Override // androidx.core.view.KeyEventDispatcher.Component public boolean superDispatchKeyEvent(KeyEvent keyEvent) { return AppCompatDialog.this.a(keyEvent); } }; a().a((Bundle) null); a().a(); } public AppCompatDelegate a() { if (this.a == null) { this.a = AppCompatDelegate.a(this, this); } return this.a; } @Override // android.app.Dialog public void setContentView(View view) { a().a(view); } @Override // android.app.Dialog public void setContentView(View view, ViewGroup.LayoutParams layoutParams) { a().b(view, layoutParams); } @Override // android.app.Dialog public void setTitle(int i) { super.setTitle(i); a().a(getContext().getString(i)); } private static int a(Context context, int i) { if (i != 0) { return i; } TypedValue typedValue = new TypedValue(); context.getTheme().resolveAttribute(R$attr.dialogTheme, typedValue, true); return typedValue.resourceId; } boolean a(KeyEvent keyEvent) { return super.dispatchKeyEvent(keyEvent); } }