325 lines
11 KiB
Java
325 lines
11 KiB
Java
package androidx.appcompat.app;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.res.Configuration;
|
|
import android.content.res.Resources;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.view.KeyEvent;
|
|
import android.view.Menu;
|
|
import android.view.MenuInflater;
|
|
import android.view.MenuItem;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.Window;
|
|
import androidx.appcompat.view.ActionMode;
|
|
import androidx.appcompat.widget.Toolbar;
|
|
import androidx.appcompat.widget.VectorEnabledTintResources;
|
|
import androidx.core.app.ActivityCompat;
|
|
import androidx.core.app.NavUtils;
|
|
import androidx.core.app.TaskStackBuilder;
|
|
import androidx.fragment.app.FragmentActivity;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class AppCompatActivity extends FragmentActivity implements AppCompatCallback, TaskStackBuilder.SupportParentable, ActionBarDrawerToggle$DelegateProvider {
|
|
private AppCompatDelegate mDelegate;
|
|
private Resources mResources;
|
|
private int mThemeId = 0;
|
|
|
|
private boolean performMenuItemShortcut(int i, KeyEvent keyEvent) {
|
|
Window window;
|
|
return (Build.VERSION.SDK_INT >= 26 || keyEvent.isCtrlPressed() || KeyEvent.metaStateHasNoModifiers(keyEvent.getMetaState()) || keyEvent.getRepeatCount() != 0 || KeyEvent.isModifierKey(keyEvent.getKeyCode()) || (window = getWindow()) == null || window.getDecorView() == null || !window.getDecorView().dispatchKeyShortcutEvent(keyEvent)) ? false : true;
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void addContentView(View view, ViewGroup.LayoutParams layoutParams) {
|
|
getDelegate().a(view, layoutParams);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void closeOptionsMenu() {
|
|
ActionBar supportActionBar = getSupportActionBar();
|
|
if (getWindow().hasFeature(0)) {
|
|
if (supportActionBar == null || !supportActionBar.e()) {
|
|
super.closeOptionsMenu();
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // androidx.core.app.ComponentActivity, android.app.Activity, android.view.Window.Callback
|
|
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
|
|
int keyCode = keyEvent.getKeyCode();
|
|
ActionBar supportActionBar = getSupportActionBar();
|
|
if (keyCode == 82 && supportActionBar != null && supportActionBar.a(keyEvent)) {
|
|
return true;
|
|
}
|
|
return super.dispatchKeyEvent(keyEvent);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public <T extends View> T findViewById(int i) {
|
|
return (T) getDelegate().a(i);
|
|
}
|
|
|
|
public AppCompatDelegate getDelegate() {
|
|
if (this.mDelegate == null) {
|
|
this.mDelegate = AppCompatDelegate.a(this, this);
|
|
}
|
|
return this.mDelegate;
|
|
}
|
|
|
|
public ActionBarDrawerToggle$Delegate getDrawerToggleDelegate() {
|
|
return getDelegate().b();
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public MenuInflater getMenuInflater() {
|
|
return getDelegate().c();
|
|
}
|
|
|
|
@Override // android.view.ContextThemeWrapper, android.content.ContextWrapper, android.content.Context
|
|
public Resources getResources() {
|
|
if (this.mResources == null && VectorEnabledTintResources.b()) {
|
|
this.mResources = new VectorEnabledTintResources(this, super.getResources());
|
|
}
|
|
Resources resources = this.mResources;
|
|
return resources == null ? super.getResources() : resources;
|
|
}
|
|
|
|
public ActionBar getSupportActionBar() {
|
|
return getDelegate().d();
|
|
}
|
|
|
|
@Override // androidx.core.app.TaskStackBuilder.SupportParentable
|
|
public Intent getSupportParentActivityIntent() {
|
|
return NavUtils.a(this);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void invalidateOptionsMenu() {
|
|
getDelegate().f();
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity, android.content.ComponentCallbacks
|
|
public void onConfigurationChanged(Configuration configuration) {
|
|
super.onConfigurationChanged(configuration);
|
|
getDelegate().a(configuration);
|
|
if (this.mResources != null) {
|
|
this.mResources.updateConfiguration(configuration, super.getResources().getDisplayMetrics());
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity, android.view.Window.Callback
|
|
public void onContentChanged() {
|
|
onSupportContentChanged();
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
|
protected void onCreate(Bundle bundle) {
|
|
int i;
|
|
AppCompatDelegate delegate = getDelegate();
|
|
delegate.e();
|
|
delegate.a(bundle);
|
|
if (delegate.a() && (i = this.mThemeId) != 0) {
|
|
if (Build.VERSION.SDK_INT >= 23) {
|
|
onApplyThemeResource(getTheme(), this.mThemeId, false);
|
|
} else {
|
|
setTheme(i);
|
|
}
|
|
}
|
|
super.onCreate(bundle);
|
|
}
|
|
|
|
public void onCreateSupportNavigateUpTaskStack(TaskStackBuilder taskStackBuilder) {
|
|
taskStackBuilder.a((Activity) this);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
|
protected void onDestroy() {
|
|
super.onDestroy();
|
|
getDelegate().g();
|
|
}
|
|
|
|
@Override // android.app.Activity, android.view.KeyEvent.Callback
|
|
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
|
if (performMenuItemShortcut(i, keyEvent)) {
|
|
return true;
|
|
}
|
|
return super.onKeyDown(i, keyEvent);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity, android.view.Window.Callback
|
|
public final boolean onMenuItemSelected(int i, MenuItem menuItem) {
|
|
if (super.onMenuItemSelected(i, menuItem)) {
|
|
return true;
|
|
}
|
|
ActionBar supportActionBar = getSupportActionBar();
|
|
if (menuItem.getItemId() != 16908332 || supportActionBar == null || (supportActionBar.g() & 4) == 0) {
|
|
return false;
|
|
}
|
|
return onSupportNavigateUp();
|
|
}
|
|
|
|
@Override // android.app.Activity, android.view.Window.Callback
|
|
public boolean onMenuOpened(int i, Menu menu) {
|
|
return super.onMenuOpened(i, menu);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity, android.view.Window.Callback
|
|
public void onPanelClosed(int i, Menu menu) {
|
|
super.onPanelClosed(i, menu);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onPostCreate(Bundle bundle) {
|
|
super.onPostCreate(bundle);
|
|
getDelegate().b(bundle);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
|
protected void onPostResume() {
|
|
super.onPostResume();
|
|
getDelegate().h();
|
|
}
|
|
|
|
public void onPrepareSupportNavigateUpTaskStack(TaskStackBuilder taskStackBuilder) {
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
|
protected void onSaveInstanceState(Bundle bundle) {
|
|
super.onSaveInstanceState(bundle);
|
|
getDelegate().c(bundle);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
|
protected void onStart() {
|
|
super.onStart();
|
|
getDelegate().i();
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
|
|
protected void onStop() {
|
|
super.onStop();
|
|
getDelegate().j();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatCallback
|
|
public void onSupportActionModeFinished(ActionMode actionMode) {
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatCallback
|
|
public void onSupportActionModeStarted(ActionMode actionMode) {
|
|
}
|
|
|
|
@Deprecated
|
|
public void onSupportContentChanged() {
|
|
}
|
|
|
|
public boolean onSupportNavigateUp() {
|
|
Intent supportParentActivityIntent = getSupportParentActivityIntent();
|
|
if (supportParentActivityIntent == null) {
|
|
return false;
|
|
}
|
|
if (!supportShouldUpRecreateTask(supportParentActivityIntent)) {
|
|
supportNavigateUpTo(supportParentActivityIntent);
|
|
return true;
|
|
}
|
|
TaskStackBuilder a = TaskStackBuilder.a((Context) this);
|
|
onCreateSupportNavigateUpTaskStack(a);
|
|
onPrepareSupportNavigateUpTaskStack(a);
|
|
a.a();
|
|
try {
|
|
ActivityCompat.a((Activity) this);
|
|
return true;
|
|
} catch (IllegalStateException unused) {
|
|
finish();
|
|
return true;
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
protected void onTitleChanged(CharSequence charSequence, int i) {
|
|
super.onTitleChanged(charSequence, i);
|
|
getDelegate().a(charSequence);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatCallback
|
|
public ActionMode onWindowStartingSupportActionMode(ActionMode.Callback callback) {
|
|
return null;
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void openOptionsMenu() {
|
|
ActionBar supportActionBar = getSupportActionBar();
|
|
if (getWindow().hasFeature(0)) {
|
|
if (supportActionBar == null || !supportActionBar.k()) {
|
|
super.openOptionsMenu();
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void setContentView(int i) {
|
|
getDelegate().c(i);
|
|
}
|
|
|
|
public void setSupportActionBar(Toolbar toolbar) {
|
|
getDelegate().a(toolbar);
|
|
}
|
|
|
|
@Deprecated
|
|
public void setSupportProgress(int i) {
|
|
}
|
|
|
|
@Deprecated
|
|
public void setSupportProgressBarIndeterminate(boolean z) {
|
|
}
|
|
|
|
@Deprecated
|
|
public void setSupportProgressBarIndeterminateVisibility(boolean z) {
|
|
}
|
|
|
|
@Deprecated
|
|
public void setSupportProgressBarVisibility(boolean z) {
|
|
}
|
|
|
|
@Override // android.app.Activity, android.view.ContextThemeWrapper, android.content.ContextWrapper, android.content.Context
|
|
public void setTheme(int i) {
|
|
super.setTheme(i);
|
|
this.mThemeId = i;
|
|
}
|
|
|
|
public ActionMode startSupportActionMode(ActionMode.Callback callback) {
|
|
return getDelegate().a(callback);
|
|
}
|
|
|
|
@Override // androidx.fragment.app.FragmentActivity
|
|
public void supportInvalidateOptionsMenu() {
|
|
getDelegate().f();
|
|
}
|
|
|
|
public void supportNavigateUpTo(Intent intent) {
|
|
NavUtils.a(this, intent);
|
|
}
|
|
|
|
public boolean supportRequestWindowFeature(int i) {
|
|
return getDelegate().b(i);
|
|
}
|
|
|
|
public boolean supportShouldUpRecreateTask(Intent intent) {
|
|
return NavUtils.b(this, intent);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void setContentView(View view) {
|
|
getDelegate().a(view);
|
|
}
|
|
|
|
@Override // android.app.Activity
|
|
public void setContentView(View view, ViewGroup.LayoutParams layoutParams) {
|
|
getDelegate().b(view, layoutParams);
|
|
}
|
|
}
|