1907 lines
70 KiB
Java
1907 lines
70 KiB
Java
package androidx.appcompat.app;
|
|
|
|
import android.R;
|
|
import android.app.Activity;
|
|
import android.app.Dialog;
|
|
import android.app.UiModeManager;
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.ComponentName;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.IntentFilter;
|
|
import android.content.pm.PackageManager;
|
|
import android.content.res.Configuration;
|
|
import android.content.res.Resources;
|
|
import android.content.res.TypedArray;
|
|
import android.graphics.Rect;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.media.AudioManager;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import android.text.TextUtils;
|
|
import android.util.AndroidRuntimeException;
|
|
import android.util.AttributeSet;
|
|
import android.util.DisplayMetrics;
|
|
import android.util.Log;
|
|
import android.util.TypedValue;
|
|
import android.view.ActionMode;
|
|
import android.view.KeyCharacterMap;
|
|
import android.view.KeyEvent;
|
|
import android.view.KeyboardShortcutGroup;
|
|
import android.view.LayoutInflater;
|
|
import android.view.Menu;
|
|
import android.view.MenuInflater;
|
|
import android.view.MenuItem;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.view.ViewConfiguration;
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewParent;
|
|
import android.view.Window;
|
|
import android.view.WindowManager;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.PopupWindow;
|
|
import android.widget.TextView;
|
|
import androidx.appcompat.R$attr;
|
|
import androidx.appcompat.R$color;
|
|
import androidx.appcompat.R$id;
|
|
import androidx.appcompat.R$layout;
|
|
import androidx.appcompat.R$style;
|
|
import androidx.appcompat.R$styleable;
|
|
import androidx.appcompat.content.res.AppCompatResources;
|
|
import androidx.appcompat.view.ActionMode;
|
|
import androidx.appcompat.view.ContextThemeWrapper;
|
|
import androidx.appcompat.view.SupportActionModeWrapper;
|
|
import androidx.appcompat.view.SupportMenuInflater;
|
|
import androidx.appcompat.view.WindowCallbackWrapper;
|
|
import androidx.appcompat.view.menu.ListMenuPresenter;
|
|
import androidx.appcompat.view.menu.MenuBuilder;
|
|
import androidx.appcompat.view.menu.MenuPresenter;
|
|
import androidx.appcompat.view.menu.MenuView;
|
|
import androidx.appcompat.widget.ActionBarContextView;
|
|
import androidx.appcompat.widget.AppCompatDrawableManager;
|
|
import androidx.appcompat.widget.ContentFrameLayout;
|
|
import androidx.appcompat.widget.DecorContentParent;
|
|
import androidx.appcompat.widget.FitWindowsViewGroup;
|
|
import androidx.appcompat.widget.TintTypedArray;
|
|
import androidx.appcompat.widget.Toolbar;
|
|
import androidx.appcompat.widget.VectorEnabledTintResources;
|
|
import androidx.appcompat.widget.ViewUtils;
|
|
import androidx.core.app.NavUtils;
|
|
import androidx.core.view.KeyEventDispatcher;
|
|
import androidx.core.view.LayoutInflaterCompat;
|
|
import androidx.core.view.OnApplyWindowInsetsListener;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.core.view.ViewPropertyAnimatorCompat;
|
|
import androidx.core.view.ViewPropertyAnimatorListener;
|
|
import androidx.core.view.ViewPropertyAnimatorListenerAdapter;
|
|
import androidx.core.view.WindowInsetsCompat;
|
|
import com.ijm.dataencryption.de.DataDecryptTool;
|
|
import com.ubt.jimu.base.util.FileUtil;
|
|
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
|
import java.lang.Thread;
|
|
import java.util.List;
|
|
import org.xmlpull.v1.XmlPullParser;
|
|
|
|
/* loaded from: classes.dex */
|
|
class AppCompatDelegateImpl extends AppCompatDelegate implements MenuBuilder.Callback, LayoutInflater.Factory2 {
|
|
private static final boolean T;
|
|
private static final int[] U;
|
|
private static boolean V;
|
|
boolean A;
|
|
boolean B;
|
|
boolean C;
|
|
boolean D;
|
|
private boolean E;
|
|
private PanelFeatureState[] F;
|
|
private PanelFeatureState G;
|
|
private boolean H;
|
|
boolean I;
|
|
private boolean K;
|
|
private AutoNightModeManager L;
|
|
boolean M;
|
|
int N;
|
|
private boolean P;
|
|
private Rect Q;
|
|
private Rect R;
|
|
private AppCompatViewInflater S;
|
|
final Context b;
|
|
final Window c;
|
|
final Window.Callback d;
|
|
final Window.Callback e;
|
|
final AppCompatCallback f;
|
|
ActionBar g;
|
|
MenuInflater h;
|
|
private CharSequence i;
|
|
private DecorContentParent j;
|
|
private ActionMenuPresenterCallback k;
|
|
private PanelMenuPresenterCallback l;
|
|
ActionMode m;
|
|
ActionBarContextView n;
|
|
PopupWindow o;
|
|
Runnable p;
|
|
private boolean s;
|
|
private ViewGroup t;
|
|
private TextView u;
|
|
private View v;
|
|
private boolean x;
|
|
private boolean y;
|
|
boolean z;
|
|
ViewPropertyAnimatorCompat q = null;
|
|
private boolean r = true;
|
|
private int J = -100;
|
|
private final Runnable O = new Runnable() { // from class: androidx.appcompat.app.AppCompatDelegateImpl.2
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this;
|
|
if ((appCompatDelegateImpl.N & 1) != 0) {
|
|
appCompatDelegateImpl.e(0);
|
|
}
|
|
AppCompatDelegateImpl appCompatDelegateImpl2 = AppCompatDelegateImpl.this;
|
|
if ((appCompatDelegateImpl2.N & FileUtil.ZIP_BUFFER_SIZE) != 0) {
|
|
appCompatDelegateImpl2.e(108);
|
|
}
|
|
AppCompatDelegateImpl appCompatDelegateImpl3 = AppCompatDelegateImpl.this;
|
|
appCompatDelegateImpl3.M = false;
|
|
appCompatDelegateImpl3.N = 0;
|
|
}
|
|
};
|
|
|
|
private class ActionBarDrawableToggleImpl implements ActionBarDrawerToggle$Delegate {
|
|
ActionBarDrawableToggleImpl(AppCompatDelegateImpl appCompatDelegateImpl) {
|
|
}
|
|
}
|
|
|
|
class ActionModeCallbackWrapperV9 implements ActionMode.Callback {
|
|
private ActionMode.Callback a;
|
|
|
|
public ActionModeCallbackWrapperV9(ActionMode.Callback callback) {
|
|
this.a = callback;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode.Callback
|
|
public boolean a(ActionMode actionMode, Menu menu) {
|
|
return this.a.a(actionMode, menu);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode.Callback
|
|
public boolean b(ActionMode actionMode, Menu menu) {
|
|
return this.a.b(actionMode, menu);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode.Callback
|
|
public boolean a(ActionMode actionMode, MenuItem menuItem) {
|
|
return this.a.a(actionMode, menuItem);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.ActionMode.Callback
|
|
public void a(ActionMode actionMode) {
|
|
this.a.a(actionMode);
|
|
AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this;
|
|
if (appCompatDelegateImpl.o != null) {
|
|
appCompatDelegateImpl.c.getDecorView().removeCallbacks(AppCompatDelegateImpl.this.p);
|
|
}
|
|
AppCompatDelegateImpl appCompatDelegateImpl2 = AppCompatDelegateImpl.this;
|
|
if (appCompatDelegateImpl2.n != null) {
|
|
appCompatDelegateImpl2.m();
|
|
AppCompatDelegateImpl appCompatDelegateImpl3 = AppCompatDelegateImpl.this;
|
|
ViewPropertyAnimatorCompat a = ViewCompat.a(appCompatDelegateImpl3.n);
|
|
a.a(0.0f);
|
|
appCompatDelegateImpl3.q = a;
|
|
AppCompatDelegateImpl.this.q.a(new ViewPropertyAnimatorListenerAdapter() { // from class: androidx.appcompat.app.AppCompatDelegateImpl.ActionModeCallbackWrapperV9.1
|
|
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
|
public void b(View view) {
|
|
AppCompatDelegateImpl.this.n.setVisibility(8);
|
|
AppCompatDelegateImpl appCompatDelegateImpl4 = AppCompatDelegateImpl.this;
|
|
PopupWindow popupWindow = appCompatDelegateImpl4.o;
|
|
if (popupWindow != null) {
|
|
popupWindow.dismiss();
|
|
} else if (appCompatDelegateImpl4.n.getParent() instanceof View) {
|
|
ViewCompat.B((View) AppCompatDelegateImpl.this.n.getParent());
|
|
}
|
|
AppCompatDelegateImpl.this.n.removeAllViews();
|
|
AppCompatDelegateImpl.this.q.a((ViewPropertyAnimatorListener) null);
|
|
AppCompatDelegateImpl.this.q = null;
|
|
}
|
|
});
|
|
}
|
|
AppCompatDelegateImpl appCompatDelegateImpl4 = AppCompatDelegateImpl.this;
|
|
AppCompatCallback appCompatCallback = appCompatDelegateImpl4.f;
|
|
if (appCompatCallback != null) {
|
|
appCompatCallback.onSupportActionModeFinished(appCompatDelegateImpl4.m);
|
|
}
|
|
AppCompatDelegateImpl.this.m = null;
|
|
}
|
|
}
|
|
|
|
final class AutoNightModeManager {
|
|
private TwilightManager a;
|
|
private boolean b;
|
|
private BroadcastReceiver c;
|
|
private IntentFilter d;
|
|
|
|
AutoNightModeManager(TwilightManager twilightManager) {
|
|
this.a = twilightManager;
|
|
this.b = twilightManager.a();
|
|
}
|
|
|
|
void a() {
|
|
BroadcastReceiver broadcastReceiver = this.c;
|
|
if (broadcastReceiver != null) {
|
|
AppCompatDelegateImpl.this.b.unregisterReceiver(broadcastReceiver);
|
|
this.c = null;
|
|
}
|
|
}
|
|
|
|
void b() {
|
|
boolean a = this.a.a();
|
|
if (a != this.b) {
|
|
this.b = a;
|
|
AppCompatDelegateImpl.this.a();
|
|
}
|
|
}
|
|
|
|
int c() {
|
|
this.b = this.a.a();
|
|
return this.b ? 2 : 1;
|
|
}
|
|
|
|
void d() {
|
|
a();
|
|
if (this.c == null) {
|
|
this.c = new BroadcastReceiver() { // from class: androidx.appcompat.app.AppCompatDelegateImpl.AutoNightModeManager.1
|
|
@Override // android.content.BroadcastReceiver
|
|
public void onReceive(Context context, Intent intent) {
|
|
AutoNightModeManager.this.b();
|
|
}
|
|
};
|
|
}
|
|
if (this.d == null) {
|
|
this.d = new IntentFilter();
|
|
this.d.addAction("android.intent.action.TIME_SET");
|
|
this.d.addAction("android.intent.action.TIMEZONE_CHANGED");
|
|
this.d.addAction("android.intent.action.TIME_TICK");
|
|
}
|
|
AppCompatDelegateImpl.this.b.registerReceiver(this.c, this.d);
|
|
}
|
|
}
|
|
|
|
private class ListMenuDecorView extends ContentFrameLayout {
|
|
public ListMenuDecorView(Context context) {
|
|
super(context);
|
|
}
|
|
|
|
private boolean a(int i, int i2) {
|
|
return i < -5 || i2 < -5 || i > getWidth() + 5 || i2 > getHeight() + 5;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
|
|
return AppCompatDelegateImpl.this.a(keyEvent) || super.dispatchKeyEvent(keyEvent);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
|
|
if (motionEvent.getAction() != 0 || !a((int) motionEvent.getX(), (int) motionEvent.getY())) {
|
|
return super.onInterceptTouchEvent(motionEvent);
|
|
}
|
|
AppCompatDelegateImpl.this.d(0);
|
|
return true;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void setBackgroundResource(int i) {
|
|
setBackgroundDrawable(AppCompatResources.c(getContext(), i));
|
|
}
|
|
}
|
|
|
|
static {
|
|
T = Build.VERSION.SDK_INT < 21;
|
|
U = new int[]{R.attr.windowBackground};
|
|
if (!T || V) {
|
|
return;
|
|
}
|
|
final Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
|
|
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { // from class: androidx.appcompat.app.AppCompatDelegateImpl.1
|
|
private boolean a(Throwable th) {
|
|
String message;
|
|
if (!(th instanceof Resources.NotFoundException) || (message = th.getMessage()) == null) {
|
|
return false;
|
|
}
|
|
return message.contains("drawable") || message.contains("Drawable");
|
|
}
|
|
|
|
@Override // java.lang.Thread.UncaughtExceptionHandler
|
|
public void uncaughtException(Thread thread, Throwable th) {
|
|
if (!a(th)) {
|
|
defaultUncaughtExceptionHandler.uncaughtException(thread, th);
|
|
return;
|
|
}
|
|
Resources.NotFoundException notFoundException = new Resources.NotFoundException(th.getMessage() + ". If the resource you are trying to use is a vector resource, you may be referencing it in an unsupported way. See AppCompatDelegate.setCompatVectorFromResourcesEnabled() for more info.");
|
|
notFoundException.initCause(th.getCause());
|
|
notFoundException.setStackTrace(th.getStackTrace());
|
|
defaultUncaughtExceptionHandler.uncaughtException(thread, notFoundException);
|
|
}
|
|
});
|
|
V = true;
|
|
}
|
|
|
|
AppCompatDelegateImpl(Context context, Window window, AppCompatCallback appCompatCallback) {
|
|
this.b = context;
|
|
this.c = window;
|
|
this.f = appCompatCallback;
|
|
this.d = this.c.getCallback();
|
|
Window.Callback callback = this.d;
|
|
if (callback instanceof AppCompatWindowCallback) {
|
|
throw new IllegalStateException("AppCompat has already installed itself into the Window");
|
|
}
|
|
this.e = new AppCompatWindowCallback(callback);
|
|
this.c.setCallback(this.e);
|
|
TintTypedArray a = TintTypedArray.a(context, (AttributeSet) null, U);
|
|
Drawable c = a.c(0);
|
|
if (c != null) {
|
|
this.c.setBackgroundDrawable(c);
|
|
}
|
|
a.a();
|
|
}
|
|
|
|
private boolean A() {
|
|
if (this.K) {
|
|
Context context = this.b;
|
|
if (context instanceof Activity) {
|
|
try {
|
|
return (context.getPackageManager().getActivityInfo(new ComponentName(this.b, this.b.getClass()), 0).configChanges & DataDecryptTool.DECRYPT_DB_FILE) == 0;
|
|
} catch (PackageManager.NameNotFoundException e) {
|
|
Log.d("AppCompatDelegate", "Exception while getting ActivityInfo", e);
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private void B() {
|
|
if (this.s) {
|
|
throw new AndroidRuntimeException("Window feature must be requested before adding content");
|
|
}
|
|
}
|
|
|
|
private int k(int i) {
|
|
if (i == 8) {
|
|
Log.i("AppCompatDelegate", "You should now use the AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR id when requesting this feature.");
|
|
return 108;
|
|
}
|
|
if (i != 9) {
|
|
return i;
|
|
}
|
|
Log.i("AppCompatDelegate", "You should now use the AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR_OVERLAY id when requesting this feature.");
|
|
return 109;
|
|
}
|
|
|
|
private void u() {
|
|
ContentFrameLayout contentFrameLayout = (ContentFrameLayout) this.t.findViewById(R.id.content);
|
|
View decorView = this.c.getDecorView();
|
|
contentFrameLayout.a(decorView.getPaddingLeft(), decorView.getPaddingTop(), decorView.getPaddingRight(), decorView.getPaddingBottom());
|
|
TypedArray obtainStyledAttributes = this.b.obtainStyledAttributes(R$styleable.AppCompatTheme);
|
|
obtainStyledAttributes.getValue(R$styleable.AppCompatTheme_windowMinWidthMajor, contentFrameLayout.getMinWidthMajor());
|
|
obtainStyledAttributes.getValue(R$styleable.AppCompatTheme_windowMinWidthMinor, contentFrameLayout.getMinWidthMinor());
|
|
if (obtainStyledAttributes.hasValue(R$styleable.AppCompatTheme_windowFixedWidthMajor)) {
|
|
obtainStyledAttributes.getValue(R$styleable.AppCompatTheme_windowFixedWidthMajor, contentFrameLayout.getFixedWidthMajor());
|
|
}
|
|
if (obtainStyledAttributes.hasValue(R$styleable.AppCompatTheme_windowFixedWidthMinor)) {
|
|
obtainStyledAttributes.getValue(R$styleable.AppCompatTheme_windowFixedWidthMinor, contentFrameLayout.getFixedWidthMinor());
|
|
}
|
|
if (obtainStyledAttributes.hasValue(R$styleable.AppCompatTheme_windowFixedHeightMajor)) {
|
|
obtainStyledAttributes.getValue(R$styleable.AppCompatTheme_windowFixedHeightMajor, contentFrameLayout.getFixedHeightMajor());
|
|
}
|
|
if (obtainStyledAttributes.hasValue(R$styleable.AppCompatTheme_windowFixedHeightMinor)) {
|
|
obtainStyledAttributes.getValue(R$styleable.AppCompatTheme_windowFixedHeightMinor, contentFrameLayout.getFixedHeightMinor());
|
|
}
|
|
obtainStyledAttributes.recycle();
|
|
contentFrameLayout.requestLayout();
|
|
}
|
|
|
|
private ViewGroup v() {
|
|
ViewGroup viewGroup;
|
|
TypedArray obtainStyledAttributes = this.b.obtainStyledAttributes(R$styleable.AppCompatTheme);
|
|
if (!obtainStyledAttributes.hasValue(R$styleable.AppCompatTheme_windowActionBar)) {
|
|
obtainStyledAttributes.recycle();
|
|
throw new IllegalStateException("You need to use a Theme.AppCompat theme (or descendant) with this activity.");
|
|
}
|
|
if (obtainStyledAttributes.getBoolean(R$styleable.AppCompatTheme_windowNoTitle, false)) {
|
|
b(1);
|
|
} else if (obtainStyledAttributes.getBoolean(R$styleable.AppCompatTheme_windowActionBar, false)) {
|
|
b(108);
|
|
}
|
|
if (obtainStyledAttributes.getBoolean(R$styleable.AppCompatTheme_windowActionBarOverlay, false)) {
|
|
b(109);
|
|
}
|
|
if (obtainStyledAttributes.getBoolean(R$styleable.AppCompatTheme_windowActionModeOverlay, false)) {
|
|
b(10);
|
|
}
|
|
this.C = obtainStyledAttributes.getBoolean(R$styleable.AppCompatTheme_android_windowIsFloating, false);
|
|
obtainStyledAttributes.recycle();
|
|
this.c.getDecorView();
|
|
LayoutInflater from = LayoutInflater.from(this.b);
|
|
if (this.D) {
|
|
viewGroup = this.B ? (ViewGroup) from.inflate(R$layout.abc_screen_simple_overlay_action_mode, (ViewGroup) null) : (ViewGroup) from.inflate(R$layout.abc_screen_simple, (ViewGroup) null);
|
|
if (Build.VERSION.SDK_INT >= 21) {
|
|
ViewCompat.a(viewGroup, new OnApplyWindowInsetsListener() { // from class: androidx.appcompat.app.AppCompatDelegateImpl.3
|
|
@Override // androidx.core.view.OnApplyWindowInsetsListener
|
|
public WindowInsetsCompat a(View view, WindowInsetsCompat windowInsetsCompat) {
|
|
int e = windowInsetsCompat.e();
|
|
int i = AppCompatDelegateImpl.this.i(e);
|
|
if (e != i) {
|
|
windowInsetsCompat = windowInsetsCompat.a(windowInsetsCompat.c(), i, windowInsetsCompat.d(), windowInsetsCompat.b());
|
|
}
|
|
return ViewCompat.b(view, windowInsetsCompat);
|
|
}
|
|
});
|
|
} else {
|
|
((FitWindowsViewGroup) viewGroup).setOnFitSystemWindowsListener(new FitWindowsViewGroup.OnFitSystemWindowsListener() { // from class: androidx.appcompat.app.AppCompatDelegateImpl.4
|
|
@Override // androidx.appcompat.widget.FitWindowsViewGroup.OnFitSystemWindowsListener
|
|
public void a(Rect rect) {
|
|
rect.top = AppCompatDelegateImpl.this.i(rect.top);
|
|
}
|
|
});
|
|
}
|
|
} else if (this.C) {
|
|
viewGroup = (ViewGroup) from.inflate(R$layout.abc_dialog_title_material, (ViewGroup) null);
|
|
this.A = false;
|
|
this.z = false;
|
|
} else if (this.z) {
|
|
TypedValue typedValue = new TypedValue();
|
|
this.b.getTheme().resolveAttribute(R$attr.actionBarTheme, typedValue, true);
|
|
int i = typedValue.resourceId;
|
|
viewGroup = (ViewGroup) LayoutInflater.from(i != 0 ? new ContextThemeWrapper(this.b, i) : this.b).inflate(R$layout.abc_screen_toolbar, (ViewGroup) null);
|
|
this.j = (DecorContentParent) viewGroup.findViewById(R$id.decor_content_parent);
|
|
this.j.setWindowCallback(p());
|
|
if (this.A) {
|
|
this.j.a(109);
|
|
}
|
|
if (this.x) {
|
|
this.j.a(2);
|
|
}
|
|
if (this.y) {
|
|
this.j.a(5);
|
|
}
|
|
} else {
|
|
viewGroup = null;
|
|
}
|
|
if (viewGroup == null) {
|
|
throw new IllegalArgumentException("AppCompat does not support the current theme features: { windowActionBar: " + this.z + ", windowActionBarOverlay: " + this.A + ", android:windowIsFloating: " + this.C + ", windowActionModeOverlay: " + this.B + ", windowNoTitle: " + this.D + " }");
|
|
}
|
|
if (this.j == null) {
|
|
this.u = (TextView) viewGroup.findViewById(R$id.title);
|
|
}
|
|
ViewUtils.b(viewGroup);
|
|
ContentFrameLayout contentFrameLayout = (ContentFrameLayout) viewGroup.findViewById(R$id.action_bar_activity_content);
|
|
ViewGroup viewGroup2 = (ViewGroup) this.c.findViewById(R.id.content);
|
|
if (viewGroup2 != null) {
|
|
while (viewGroup2.getChildCount() > 0) {
|
|
View childAt = viewGroup2.getChildAt(0);
|
|
viewGroup2.removeViewAt(0);
|
|
contentFrameLayout.addView(childAt);
|
|
}
|
|
viewGroup2.setId(-1);
|
|
contentFrameLayout.setId(R.id.content);
|
|
if (viewGroup2 instanceof FrameLayout) {
|
|
((FrameLayout) viewGroup2).setForeground(null);
|
|
}
|
|
}
|
|
this.c.setContentView(viewGroup);
|
|
contentFrameLayout.setAttachListener(new ContentFrameLayout.OnAttachListener() { // from class: androidx.appcompat.app.AppCompatDelegateImpl.5
|
|
@Override // androidx.appcompat.widget.ContentFrameLayout.OnAttachListener
|
|
public void a() {
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.ContentFrameLayout.OnAttachListener
|
|
public void onDetachedFromWindow() {
|
|
AppCompatDelegateImpl.this.l();
|
|
}
|
|
});
|
|
return viewGroup;
|
|
}
|
|
|
|
private void w() {
|
|
if (this.L == null) {
|
|
this.L = new AutoNightModeManager(TwilightManager.a(this.b));
|
|
}
|
|
}
|
|
|
|
private void x() {
|
|
if (this.s) {
|
|
return;
|
|
}
|
|
this.t = v();
|
|
CharSequence o = o();
|
|
if (!TextUtils.isEmpty(o)) {
|
|
DecorContentParent decorContentParent = this.j;
|
|
if (decorContentParent != null) {
|
|
decorContentParent.setWindowTitle(o);
|
|
} else if (s() != null) {
|
|
s().a(o);
|
|
} else {
|
|
TextView textView = this.u;
|
|
if (textView != null) {
|
|
textView.setText(o);
|
|
}
|
|
}
|
|
}
|
|
u();
|
|
a(this.t);
|
|
this.s = true;
|
|
PanelFeatureState a = a(0, false);
|
|
if (this.I) {
|
|
return;
|
|
}
|
|
if (a == null || a.j == null) {
|
|
j(108);
|
|
}
|
|
}
|
|
|
|
private int y() {
|
|
int i = this.J;
|
|
return i != -100 ? i : AppCompatDelegate.k();
|
|
}
|
|
|
|
private void z() {
|
|
x();
|
|
if (this.z && this.g == null) {
|
|
Window.Callback callback = this.d;
|
|
if (callback instanceof Activity) {
|
|
this.g = new WindowDecorActionBar((Activity) callback, this.A);
|
|
} else if (callback instanceof Dialog) {
|
|
this.g = new WindowDecorActionBar((Dialog) callback);
|
|
}
|
|
ActionBar actionBar = this.g;
|
|
if (actionBar != null) {
|
|
actionBar.c(this.P);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public void a(Bundle bundle) {
|
|
Window.Callback callback = this.d;
|
|
if (callback instanceof Activity) {
|
|
String str = null;
|
|
try {
|
|
str = NavUtils.b((Activity) callback);
|
|
} catch (IllegalArgumentException unused) {
|
|
}
|
|
if (str != null) {
|
|
ActionBar s = s();
|
|
if (s == null) {
|
|
this.P = true;
|
|
} else {
|
|
s.c(true);
|
|
}
|
|
}
|
|
}
|
|
if (bundle == null || this.J != -100) {
|
|
return;
|
|
}
|
|
this.J = bundle.getInt("appcompat:local_night_mode", -100);
|
|
}
|
|
|
|
void a(ViewGroup viewGroup) {
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public void b(Bundle bundle) {
|
|
x();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public MenuInflater c() {
|
|
if (this.h == null) {
|
|
z();
|
|
ActionBar actionBar = this.g;
|
|
this.h = new SupportMenuInflater(actionBar != null ? actionBar.h() : this.b);
|
|
}
|
|
return this.h;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public ActionBar d() {
|
|
z();
|
|
return this.g;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public void e() {
|
|
LayoutInflater from = LayoutInflater.from(this.b);
|
|
if (from.getFactory() == null) {
|
|
LayoutInflaterCompat.b(from, this);
|
|
} else {
|
|
if (from.getFactory2() instanceof AppCompatDelegateImpl) {
|
|
return;
|
|
}
|
|
Log.i("AppCompatDelegate", "The Activity's LayoutInflater already has a Factory installed so we can not install AppCompat's");
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public void f() {
|
|
ActionBar d = d();
|
|
if (d == null || !d.i()) {
|
|
j(0);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public void g() {
|
|
if (this.M) {
|
|
this.c.getDecorView().removeCallbacks(this.O);
|
|
}
|
|
this.I = true;
|
|
ActionBar actionBar = this.g;
|
|
if (actionBar != null) {
|
|
actionBar.j();
|
|
}
|
|
AutoNightModeManager autoNightModeManager = this.L;
|
|
if (autoNightModeManager != null) {
|
|
autoNightModeManager.a();
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public void h() {
|
|
ActionBar d = d();
|
|
if (d != null) {
|
|
d.d(true);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public void i() {
|
|
a();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public void j() {
|
|
ActionBar d = d();
|
|
if (d != null) {
|
|
d.d(false);
|
|
}
|
|
AutoNightModeManager autoNightModeManager = this.L;
|
|
if (autoNightModeManager != null) {
|
|
autoNightModeManager.a();
|
|
}
|
|
}
|
|
|
|
void l() {
|
|
MenuBuilder menuBuilder;
|
|
DecorContentParent decorContentParent = this.j;
|
|
if (decorContentParent != null) {
|
|
decorContentParent.h();
|
|
}
|
|
if (this.o != null) {
|
|
this.c.getDecorView().removeCallbacks(this.p);
|
|
if (this.o.isShowing()) {
|
|
try {
|
|
this.o.dismiss();
|
|
} catch (IllegalArgumentException unused) {
|
|
}
|
|
}
|
|
this.o = null;
|
|
}
|
|
m();
|
|
PanelFeatureState a = a(0, false);
|
|
if (a == null || (menuBuilder = a.j) == null) {
|
|
return;
|
|
}
|
|
menuBuilder.close();
|
|
}
|
|
|
|
void m() {
|
|
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = this.q;
|
|
if (viewPropertyAnimatorCompat != null) {
|
|
viewPropertyAnimatorCompat.a();
|
|
}
|
|
}
|
|
|
|
final Context n() {
|
|
ActionBar d = d();
|
|
Context h = d != null ? d.h() : null;
|
|
return h == null ? this.b : h;
|
|
}
|
|
|
|
final CharSequence o() {
|
|
Window.Callback callback = this.d;
|
|
return callback instanceof Activity ? ((Activity) callback).getTitle() : this.i;
|
|
}
|
|
|
|
@Override // android.view.LayoutInflater.Factory2
|
|
public final View onCreateView(View view, String str, Context context, AttributeSet attributeSet) {
|
|
return a(view, str, context, attributeSet);
|
|
}
|
|
|
|
final Window.Callback p() {
|
|
return this.c.getCallback();
|
|
}
|
|
|
|
public boolean q() {
|
|
return this.r;
|
|
}
|
|
|
|
boolean r() {
|
|
ActionMode actionMode = this.m;
|
|
if (actionMode != null) {
|
|
actionMode.a();
|
|
return true;
|
|
}
|
|
ActionBar d = d();
|
|
return d != null && d.f();
|
|
}
|
|
|
|
final ActionBar s() {
|
|
return this.g;
|
|
}
|
|
|
|
final boolean t() {
|
|
ViewGroup viewGroup;
|
|
return this.s && (viewGroup = this.t) != null && ViewCompat.x(viewGroup);
|
|
}
|
|
|
|
private final class ActionMenuPresenterCallback implements MenuPresenter.Callback {
|
|
ActionMenuPresenterCallback() {
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
|
public boolean a(MenuBuilder menuBuilder) {
|
|
Window.Callback p = AppCompatDelegateImpl.this.p();
|
|
if (p == null) {
|
|
return true;
|
|
}
|
|
p.onMenuOpened(108, menuBuilder);
|
|
return true;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
|
public void a(MenuBuilder menuBuilder, boolean z) {
|
|
AppCompatDelegateImpl.this.b(menuBuilder);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public void b(View view, ViewGroup.LayoutParams layoutParams) {
|
|
x();
|
|
ViewGroup viewGroup = (ViewGroup) this.t.findViewById(R.id.content);
|
|
viewGroup.removeAllViews();
|
|
viewGroup.addView(view, layoutParams);
|
|
this.d.onContentChanged();
|
|
}
|
|
|
|
int i(int i) {
|
|
boolean z;
|
|
boolean z2;
|
|
ActionBarContextView actionBarContextView = this.n;
|
|
if (actionBarContextView == null || !(actionBarContextView.getLayoutParams() instanceof ViewGroup.MarginLayoutParams)) {
|
|
z = false;
|
|
} else {
|
|
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.n.getLayoutParams();
|
|
if (this.n.isShown()) {
|
|
if (this.Q == null) {
|
|
this.Q = new Rect();
|
|
this.R = new Rect();
|
|
}
|
|
Rect rect = this.Q;
|
|
Rect rect2 = this.R;
|
|
rect.set(0, i, 0, 0);
|
|
ViewUtils.a(this.t, rect, rect2);
|
|
if (marginLayoutParams.topMargin != (rect2.top == 0 ? i : 0)) {
|
|
marginLayoutParams.topMargin = i;
|
|
View view = this.v;
|
|
if (view == null) {
|
|
this.v = new View(this.b);
|
|
this.v.setBackgroundColor(this.b.getResources().getColor(R$color.abc_input_method_navigation_guard));
|
|
this.t.addView(this.v, -1, new ViewGroup.LayoutParams(-1, i));
|
|
} else {
|
|
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
|
|
if (layoutParams.height != i) {
|
|
layoutParams.height = i;
|
|
this.v.setLayoutParams(layoutParams);
|
|
}
|
|
}
|
|
z2 = true;
|
|
} else {
|
|
z2 = false;
|
|
}
|
|
z = this.v != null;
|
|
if (!this.B && z) {
|
|
i = 0;
|
|
}
|
|
} else {
|
|
if (marginLayoutParams.topMargin != 0) {
|
|
marginLayoutParams.topMargin = 0;
|
|
z2 = true;
|
|
} else {
|
|
z2 = false;
|
|
}
|
|
z = false;
|
|
}
|
|
if (z2) {
|
|
this.n.setLayoutParams(marginLayoutParams);
|
|
}
|
|
}
|
|
View view2 = this.v;
|
|
if (view2 != null) {
|
|
view2.setVisibility(z ? 0 : 8);
|
|
}
|
|
return i;
|
|
}
|
|
|
|
@Override // android.view.LayoutInflater.Factory
|
|
public View onCreateView(String str, Context context, AttributeSet attributeSet) {
|
|
return onCreateView(null, str, context, attributeSet);
|
|
}
|
|
|
|
protected static final class PanelFeatureState {
|
|
int a;
|
|
int b;
|
|
int c;
|
|
int d;
|
|
int e;
|
|
int f;
|
|
ViewGroup g;
|
|
View h;
|
|
View i;
|
|
MenuBuilder j;
|
|
ListMenuPresenter k;
|
|
Context l;
|
|
boolean m;
|
|
boolean n;
|
|
boolean o;
|
|
public boolean p;
|
|
boolean q = false;
|
|
boolean r;
|
|
Bundle s;
|
|
|
|
private static class SavedState implements Parcelable {
|
|
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.ClassLoaderCreator<SavedState>() { // from class: androidx.appcompat.app.AppCompatDelegateImpl.PanelFeatureState.SavedState.1
|
|
@Override // android.os.Parcelable.Creator
|
|
public SavedState[] newArray(int i) {
|
|
return new SavedState[i];
|
|
}
|
|
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // android.os.Parcelable.ClassLoaderCreator
|
|
public SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) {
|
|
return SavedState.readFromParcel(parcel, classLoader);
|
|
}
|
|
|
|
@Override // android.os.Parcelable.Creator
|
|
public SavedState createFromParcel(Parcel parcel) {
|
|
return SavedState.readFromParcel(parcel, null);
|
|
}
|
|
};
|
|
int featureId;
|
|
boolean isOpen;
|
|
Bundle menuState;
|
|
|
|
SavedState() {
|
|
}
|
|
|
|
static SavedState readFromParcel(Parcel parcel, ClassLoader classLoader) {
|
|
SavedState savedState = new SavedState();
|
|
savedState.featureId = parcel.readInt();
|
|
savedState.isOpen = parcel.readInt() == 1;
|
|
if (savedState.isOpen) {
|
|
savedState.menuState = parcel.readBundle(classLoader);
|
|
}
|
|
return savedState;
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public int describeContents() {
|
|
return 0;
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public void writeToParcel(Parcel parcel, int i) {
|
|
parcel.writeInt(this.featureId);
|
|
parcel.writeInt(this.isOpen ? 1 : 0);
|
|
if (this.isOpen) {
|
|
parcel.writeBundle(this.menuState);
|
|
}
|
|
}
|
|
}
|
|
|
|
PanelFeatureState(int i) {
|
|
this.a = i;
|
|
}
|
|
|
|
public boolean a() {
|
|
if (this.h == null) {
|
|
return false;
|
|
}
|
|
return this.i != null || this.k.a().getCount() > 0;
|
|
}
|
|
|
|
void a(Context context) {
|
|
TypedValue typedValue = new TypedValue();
|
|
Resources.Theme newTheme = context.getResources().newTheme();
|
|
newTheme.setTo(context.getTheme());
|
|
newTheme.resolveAttribute(R$attr.actionBarPopupTheme, typedValue, true);
|
|
int i = typedValue.resourceId;
|
|
if (i != 0) {
|
|
newTheme.applyStyle(i, true);
|
|
}
|
|
newTheme.resolveAttribute(R$attr.panelMenuListTheme, typedValue, true);
|
|
int i2 = typedValue.resourceId;
|
|
if (i2 != 0) {
|
|
newTheme.applyStyle(i2, true);
|
|
} else {
|
|
newTheme.applyStyle(R$style.Theme_AppCompat_CompactMenu, true);
|
|
}
|
|
ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(context, 0);
|
|
contextThemeWrapper.getTheme().setTo(newTheme);
|
|
this.l = contextThemeWrapper;
|
|
TypedArray obtainStyledAttributes = contextThemeWrapper.obtainStyledAttributes(R$styleable.AppCompatTheme);
|
|
this.b = obtainStyledAttributes.getResourceId(R$styleable.AppCompatTheme_panelBackground, 0);
|
|
this.f = obtainStyledAttributes.getResourceId(R$styleable.AppCompatTheme_android_windowAnimationStyle, 0);
|
|
obtainStyledAttributes.recycle();
|
|
}
|
|
|
|
void a(MenuBuilder menuBuilder) {
|
|
ListMenuPresenter listMenuPresenter;
|
|
MenuBuilder menuBuilder2 = this.j;
|
|
if (menuBuilder == menuBuilder2) {
|
|
return;
|
|
}
|
|
if (menuBuilder2 != null) {
|
|
menuBuilder2.b(this.k);
|
|
}
|
|
this.j = menuBuilder;
|
|
if (menuBuilder == null || (listMenuPresenter = this.k) == null) {
|
|
return;
|
|
}
|
|
menuBuilder.a(listMenuPresenter);
|
|
}
|
|
|
|
MenuView a(MenuPresenter.Callback callback) {
|
|
if (this.j == null) {
|
|
return null;
|
|
}
|
|
if (this.k == null) {
|
|
this.k = new ListMenuPresenter(this.l, R$layout.abc_list_menu_item_layout);
|
|
this.k.a(callback);
|
|
this.j.a(this.k);
|
|
}
|
|
return this.k.a(this.g);
|
|
}
|
|
}
|
|
|
|
void d(int i) {
|
|
a(a(i, true), true);
|
|
}
|
|
|
|
void h(int i) {
|
|
if (i == 108) {
|
|
ActionBar d = d();
|
|
if (d != null) {
|
|
d.b(false);
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
if (i == 0) {
|
|
PanelFeatureState a = a(i, true);
|
|
if (a.o) {
|
|
a(a, false);
|
|
}
|
|
}
|
|
}
|
|
|
|
class AppCompatWindowCallback extends WindowCallbackWrapper {
|
|
AppCompatWindowCallback(Window.Callback callback) {
|
|
super(callback);
|
|
}
|
|
|
|
final android.view.ActionMode a(ActionMode.Callback callback) {
|
|
SupportActionModeWrapper.CallbackWrapper callbackWrapper = new SupportActionModeWrapper.CallbackWrapper(AppCompatDelegateImpl.this.b, callback);
|
|
androidx.appcompat.view.ActionMode a = AppCompatDelegateImpl.this.a(callbackWrapper);
|
|
if (a != null) {
|
|
return callbackWrapper.b(a);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback
|
|
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
|
|
return AppCompatDelegateImpl.this.a(keyEvent) || super.dispatchKeyEvent(keyEvent);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback
|
|
public boolean dispatchKeyShortcutEvent(KeyEvent keyEvent) {
|
|
return super.dispatchKeyShortcutEvent(keyEvent) || AppCompatDelegateImpl.this.b(keyEvent.getKeyCode(), keyEvent);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback
|
|
public void onContentChanged() {
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback
|
|
public boolean onCreatePanelMenu(int i, Menu menu) {
|
|
if (i != 0 || (menu instanceof MenuBuilder)) {
|
|
return super.onCreatePanelMenu(i, menu);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback
|
|
public boolean onMenuOpened(int i, Menu menu) {
|
|
super.onMenuOpened(i, menu);
|
|
AppCompatDelegateImpl.this.g(i);
|
|
return true;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback
|
|
public void onPanelClosed(int i, Menu menu) {
|
|
super.onPanelClosed(i, menu);
|
|
AppCompatDelegateImpl.this.h(i);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback
|
|
public boolean onPreparePanel(int i, View view, Menu menu) {
|
|
MenuBuilder menuBuilder = menu instanceof MenuBuilder ? (MenuBuilder) menu : null;
|
|
if (i == 0 && menuBuilder == null) {
|
|
return false;
|
|
}
|
|
if (menuBuilder != null) {
|
|
menuBuilder.c(true);
|
|
}
|
|
boolean onPreparePanel = super.onPreparePanel(i, view, menu);
|
|
if (menuBuilder != null) {
|
|
menuBuilder.c(false);
|
|
}
|
|
return onPreparePanel;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback
|
|
public void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> list, Menu menu, int i) {
|
|
MenuBuilder menuBuilder;
|
|
PanelFeatureState a = AppCompatDelegateImpl.this.a(0, true);
|
|
if (a == null || (menuBuilder = a.j) == null) {
|
|
super.onProvideKeyboardShortcuts(list, menu, i);
|
|
} else {
|
|
super.onProvideKeyboardShortcuts(list, menuBuilder, i);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback
|
|
public android.view.ActionMode onWindowStartingActionMode(ActionMode.Callback callback) {
|
|
if (Build.VERSION.SDK_INT >= 23) {
|
|
return null;
|
|
}
|
|
return AppCompatDelegateImpl.this.q() ? a(callback) : super.onWindowStartingActionMode(callback);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback
|
|
public android.view.ActionMode onWindowStartingActionMode(ActionMode.Callback callback, int i) {
|
|
if (AppCompatDelegateImpl.this.q() && i == 0) {
|
|
return a(callback);
|
|
}
|
|
return super.onWindowStartingActionMode(callback, i);
|
|
}
|
|
}
|
|
|
|
private boolean d(int i, KeyEvent keyEvent) {
|
|
if (keyEvent.getRepeatCount() != 0) {
|
|
return false;
|
|
}
|
|
PanelFeatureState a = a(i, true);
|
|
if (a.o) {
|
|
return false;
|
|
}
|
|
return b(a, keyEvent);
|
|
}
|
|
|
|
int f(int i) {
|
|
if (i == -100) {
|
|
return -1;
|
|
}
|
|
if (i != 0) {
|
|
return i;
|
|
}
|
|
if (Build.VERSION.SDK_INT >= 23 && ((UiModeManager) this.b.getSystemService(UiModeManager.class)).getNightMode() == 0) {
|
|
return -1;
|
|
}
|
|
w();
|
|
return this.L.c();
|
|
}
|
|
|
|
private final class PanelMenuPresenterCallback implements MenuPresenter.Callback {
|
|
PanelMenuPresenterCallback() {
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
|
public void a(MenuBuilder menuBuilder, boolean z) {
|
|
MenuBuilder m = menuBuilder.m();
|
|
boolean z2 = m != menuBuilder;
|
|
AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this;
|
|
if (z2) {
|
|
menuBuilder = m;
|
|
}
|
|
PanelFeatureState a = appCompatDelegateImpl.a((Menu) menuBuilder);
|
|
if (a != null) {
|
|
if (!z2) {
|
|
AppCompatDelegateImpl.this.a(a, z);
|
|
} else {
|
|
AppCompatDelegateImpl.this.a(a.a, a, m);
|
|
AppCompatDelegateImpl.this.a(a, true);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
|
public boolean a(MenuBuilder menuBuilder) {
|
|
Window.Callback p;
|
|
if (menuBuilder != null) {
|
|
return true;
|
|
}
|
|
AppCompatDelegateImpl appCompatDelegateImpl = AppCompatDelegateImpl.this;
|
|
if (!appCompatDelegateImpl.z || (p = appCompatDelegateImpl.p()) == null || AppCompatDelegateImpl.this.I) {
|
|
return true;
|
|
}
|
|
p.onMenuOpened(108, menuBuilder);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
private void j(int i) {
|
|
this.N = (1 << i) | this.N;
|
|
if (this.M) {
|
|
return;
|
|
}
|
|
ViewCompat.a(this.c.getDecorView(), this.O);
|
|
this.M = true;
|
|
}
|
|
|
|
private boolean e(int i, KeyEvent keyEvent) {
|
|
boolean z;
|
|
boolean z2;
|
|
DecorContentParent decorContentParent;
|
|
if (this.m != null) {
|
|
return false;
|
|
}
|
|
PanelFeatureState a = a(i, true);
|
|
if (i == 0 && (decorContentParent = this.j) != null && decorContentParent.d() && !ViewConfiguration.get(this.b).hasPermanentMenuKey()) {
|
|
if (!this.j.a()) {
|
|
if (!this.I && b(a, keyEvent)) {
|
|
z = this.j.g();
|
|
}
|
|
z = false;
|
|
} else {
|
|
z = this.j.f();
|
|
}
|
|
} else if (!a.o && !a.n) {
|
|
if (a.m) {
|
|
if (a.r) {
|
|
a.m = false;
|
|
z2 = b(a, keyEvent);
|
|
} else {
|
|
z2 = true;
|
|
}
|
|
if (z2) {
|
|
a(a, keyEvent);
|
|
z = true;
|
|
}
|
|
}
|
|
z = false;
|
|
} else {
|
|
z = a.o;
|
|
a(a, true);
|
|
}
|
|
if (z) {
|
|
AudioManager audioManager = (AudioManager) this.b.getSystemService("audio");
|
|
if (audioManager != null) {
|
|
audioManager.playSoundEffect(0);
|
|
} else {
|
|
Log.w("AppCompatDelegate", "Couldn't get audio manager");
|
|
}
|
|
}
|
|
return z;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public void c(int i) {
|
|
x();
|
|
ViewGroup viewGroup = (ViewGroup) this.t.findViewById(R.id.content);
|
|
viewGroup.removeAllViews();
|
|
LayoutInflater.from(this.b).inflate(i, viewGroup);
|
|
this.d.onContentChanged();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public boolean b(int i) {
|
|
int k = k(i);
|
|
if (this.D && k == 108) {
|
|
return false;
|
|
}
|
|
if (this.z && k == 1) {
|
|
this.z = false;
|
|
}
|
|
if (k == 1) {
|
|
B();
|
|
this.D = true;
|
|
return true;
|
|
}
|
|
if (k == 2) {
|
|
B();
|
|
this.x = true;
|
|
return true;
|
|
}
|
|
if (k == 5) {
|
|
B();
|
|
this.y = true;
|
|
return true;
|
|
}
|
|
if (k == 10) {
|
|
B();
|
|
this.B = true;
|
|
return true;
|
|
}
|
|
if (k == 108) {
|
|
B();
|
|
this.z = true;
|
|
return true;
|
|
}
|
|
if (k != 109) {
|
|
return this.c.requestFeature(k);
|
|
}
|
|
B();
|
|
this.A = true;
|
|
return true;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public void a(Toolbar toolbar) {
|
|
if (this.d instanceof Activity) {
|
|
ActionBar d = d();
|
|
if (!(d instanceof WindowDecorActionBar)) {
|
|
this.h = null;
|
|
if (d != null) {
|
|
d.j();
|
|
}
|
|
if (toolbar != null) {
|
|
ToolbarActionBar toolbarActionBar = new ToolbarActionBar(toolbar, ((Activity) this.d).getTitle(), this.e);
|
|
this.g = toolbarActionBar;
|
|
this.c.setCallback(toolbarActionBar.l());
|
|
} else {
|
|
this.g = null;
|
|
this.c.setCallback(this.e);
|
|
}
|
|
f();
|
|
return;
|
|
}
|
|
throw new IllegalStateException("This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_SUPPORT_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.");
|
|
}
|
|
}
|
|
|
|
void g(int i) {
|
|
ActionBar d;
|
|
if (i != 108 || (d = d()) == null) {
|
|
return;
|
|
}
|
|
d.b(true);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public void c(Bundle bundle) {
|
|
int i = this.J;
|
|
if (i != -100) {
|
|
bundle.putInt("appcompat:local_night_mode", i);
|
|
}
|
|
}
|
|
|
|
private boolean l(int i) {
|
|
Resources resources = this.b.getResources();
|
|
Configuration configuration = resources.getConfiguration();
|
|
int i2 = configuration.uiMode & 48;
|
|
int i3 = i == 2 ? 32 : 16;
|
|
if (i2 == i3) {
|
|
return false;
|
|
}
|
|
if (A()) {
|
|
((Activity) this.b).recreate();
|
|
return true;
|
|
}
|
|
Configuration configuration2 = new Configuration(configuration);
|
|
DisplayMetrics displayMetrics = resources.getDisplayMetrics();
|
|
configuration2.uiMode = i3 | (configuration2.uiMode & (-49));
|
|
resources.updateConfiguration(configuration2, displayMetrics);
|
|
if (Build.VERSION.SDK_INT >= 26) {
|
|
return true;
|
|
}
|
|
ResourcesFlusher.a(resources);
|
|
return true;
|
|
}
|
|
|
|
boolean c(int i, KeyEvent keyEvent) {
|
|
if (i == 4) {
|
|
boolean z = this.H;
|
|
this.H = false;
|
|
PanelFeatureState a = a(0, false);
|
|
if (a != null && a.o) {
|
|
if (!z) {
|
|
a(a, true);
|
|
}
|
|
return true;
|
|
}
|
|
if (r()) {
|
|
return true;
|
|
}
|
|
} else if (i == 82) {
|
|
e(0, keyEvent);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private boolean c(PanelFeatureState panelFeatureState) {
|
|
Context context = this.b;
|
|
int i = panelFeatureState.a;
|
|
if ((i == 0 || i == 108) && this.j != null) {
|
|
TypedValue typedValue = new TypedValue();
|
|
Resources.Theme theme = context.getTheme();
|
|
theme.resolveAttribute(R$attr.actionBarTheme, typedValue, true);
|
|
Resources.Theme theme2 = null;
|
|
if (typedValue.resourceId != 0) {
|
|
theme2 = context.getResources().newTheme();
|
|
theme2.setTo(theme);
|
|
theme2.applyStyle(typedValue.resourceId, true);
|
|
theme2.resolveAttribute(R$attr.actionBarWidgetTheme, typedValue, true);
|
|
} else {
|
|
theme.resolveAttribute(R$attr.actionBarWidgetTheme, typedValue, true);
|
|
}
|
|
if (typedValue.resourceId != 0) {
|
|
if (theme2 == null) {
|
|
theme2 = context.getResources().newTheme();
|
|
theme2.setTo(theme);
|
|
}
|
|
theme2.applyStyle(typedValue.resourceId, true);
|
|
}
|
|
if (theme2 != null) {
|
|
ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(context, 0);
|
|
contextThemeWrapper.getTheme().setTo(theme2);
|
|
context = contextThemeWrapper;
|
|
}
|
|
}
|
|
MenuBuilder menuBuilder = new MenuBuilder(context);
|
|
menuBuilder.a(this);
|
|
panelFeatureState.a(menuBuilder);
|
|
return true;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public <T extends View> T a(int i) {
|
|
x();
|
|
return (T) this.c.findViewById(i);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public void a(Configuration configuration) {
|
|
ActionBar d;
|
|
if (this.z && this.s && (d = d()) != null) {
|
|
d.a(configuration);
|
|
}
|
|
AppCompatDrawableManager.a().a(this.b);
|
|
a();
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:14:0x0025 */
|
|
/* JADX WARN: Removed duplicated region for block: B:23:0x0029 */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
|
*/
|
|
androidx.appcompat.view.ActionMode b(androidx.appcompat.view.ActionMode.Callback r8) {
|
|
/*
|
|
Method dump skipped, instructions count: 371
|
|
To view this dump change 'Code comments level' option to 'DEBUG'
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.app.AppCompatDelegateImpl.b(androidx.appcompat.view.ActionMode$Callback):androidx.appcompat.view.ActionMode");
|
|
}
|
|
|
|
void e(int i) {
|
|
PanelFeatureState a;
|
|
PanelFeatureState a2 = a(i, true);
|
|
if (a2.j != null) {
|
|
Bundle bundle = new Bundle();
|
|
a2.j.b(bundle);
|
|
if (bundle.size() > 0) {
|
|
a2.s = bundle;
|
|
}
|
|
a2.j.s();
|
|
a2.j.clear();
|
|
}
|
|
a2.r = true;
|
|
a2.q = true;
|
|
if ((i != 108 && i != 0) || this.j == null || (a = a(0, false)) == null) {
|
|
return;
|
|
}
|
|
a.m = false;
|
|
b(a, (KeyEvent) null);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public void a(View view) {
|
|
x();
|
|
ViewGroup viewGroup = (ViewGroup) this.t.findViewById(R.id.content);
|
|
viewGroup.removeAllViews();
|
|
viewGroup.addView(view);
|
|
this.d.onContentChanged();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public void a(View view, ViewGroup.LayoutParams layoutParams) {
|
|
x();
|
|
((ViewGroup) this.t.findViewById(R.id.content)).addView(view, layoutParams);
|
|
this.d.onContentChanged();
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public final void a(CharSequence charSequence) {
|
|
this.i = charSequence;
|
|
DecorContentParent decorContentParent = this.j;
|
|
if (decorContentParent != null) {
|
|
decorContentParent.setWindowTitle(charSequence);
|
|
return;
|
|
}
|
|
if (s() != null) {
|
|
s().a(charSequence);
|
|
return;
|
|
}
|
|
TextView textView = this.u;
|
|
if (textView != null) {
|
|
textView.setText(charSequence);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
|
public boolean a(MenuBuilder menuBuilder, MenuItem menuItem) {
|
|
PanelFeatureState a;
|
|
Window.Callback p = p();
|
|
if (p == null || this.I || (a = a((Menu) menuBuilder.m())) == null) {
|
|
return false;
|
|
}
|
|
return p.onMenuItemSelected(a.a, menuItem);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
|
public void a(MenuBuilder menuBuilder) {
|
|
a(menuBuilder, true);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public androidx.appcompat.view.ActionMode a(ActionMode.Callback callback) {
|
|
AppCompatCallback appCompatCallback;
|
|
if (callback != null) {
|
|
androidx.appcompat.view.ActionMode actionMode = this.m;
|
|
if (actionMode != null) {
|
|
actionMode.a();
|
|
}
|
|
ActionModeCallbackWrapperV9 actionModeCallbackWrapperV9 = new ActionModeCallbackWrapperV9(callback);
|
|
ActionBar d = d();
|
|
if (d != null) {
|
|
this.m = d.a(actionModeCallbackWrapperV9);
|
|
androidx.appcompat.view.ActionMode actionMode2 = this.m;
|
|
if (actionMode2 != null && (appCompatCallback = this.f) != null) {
|
|
appCompatCallback.onSupportActionModeStarted(actionMode2);
|
|
}
|
|
}
|
|
if (this.m == null) {
|
|
this.m = b(actionModeCallbackWrapperV9);
|
|
}
|
|
return this.m;
|
|
}
|
|
throw new IllegalArgumentException("ActionMode callback can not be null.");
|
|
}
|
|
|
|
boolean a(KeyEvent keyEvent) {
|
|
View decorView;
|
|
Window.Callback callback = this.d;
|
|
if (((callback instanceof KeyEventDispatcher.Component) || (callback instanceof AppCompatDialog)) && (decorView = this.c.getDecorView()) != null && KeyEventDispatcher.a(decorView, keyEvent)) {
|
|
return true;
|
|
}
|
|
if (keyEvent.getKeyCode() == 82 && this.d.dispatchKeyEvent(keyEvent)) {
|
|
return true;
|
|
}
|
|
int keyCode = keyEvent.getKeyCode();
|
|
return keyEvent.getAction() == 0 ? a(keyCode, keyEvent) : c(keyCode, keyEvent);
|
|
}
|
|
|
|
boolean a(int i, KeyEvent keyEvent) {
|
|
if (i == 4) {
|
|
this.H = (keyEvent.getFlags() & PeripheralType.SERVO) != 0;
|
|
} else if (i == 82) {
|
|
d(0, keyEvent);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public View a(View view, String str, Context context, AttributeSet attributeSet) {
|
|
boolean z;
|
|
boolean z2 = false;
|
|
if (this.S == null) {
|
|
String string = this.b.obtainStyledAttributes(R$styleable.AppCompatTheme).getString(R$styleable.AppCompatTheme_viewInflaterClass);
|
|
if (string != null && !AppCompatViewInflater.class.getName().equals(string)) {
|
|
try {
|
|
this.S = (AppCompatViewInflater) Class.forName(string).getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
|
|
} catch (Throwable th) {
|
|
Log.i("AppCompatDelegate", "Failed to instantiate custom view inflater " + string + ". Falling back to default.", th);
|
|
this.S = new AppCompatViewInflater();
|
|
}
|
|
} else {
|
|
this.S = new AppCompatViewInflater();
|
|
}
|
|
}
|
|
if (T) {
|
|
if (attributeSet instanceof XmlPullParser) {
|
|
if (((XmlPullParser) attributeSet).getDepth() > 1) {
|
|
z2 = true;
|
|
}
|
|
} else {
|
|
z2 = a((ViewParent) view);
|
|
}
|
|
z = z2;
|
|
} else {
|
|
z = false;
|
|
}
|
|
return this.S.createView(view, str, context, attributeSet, z, T, true, VectorEnabledTintResources.b());
|
|
}
|
|
|
|
boolean b(int i, KeyEvent keyEvent) {
|
|
ActionBar d = d();
|
|
if (d != null && d.a(i, keyEvent)) {
|
|
return true;
|
|
}
|
|
PanelFeatureState panelFeatureState = this.G;
|
|
if (panelFeatureState != null && a(panelFeatureState, keyEvent.getKeyCode(), keyEvent, 1)) {
|
|
PanelFeatureState panelFeatureState2 = this.G;
|
|
if (panelFeatureState2 != null) {
|
|
panelFeatureState2.n = true;
|
|
}
|
|
return true;
|
|
}
|
|
if (this.G == null) {
|
|
PanelFeatureState a = a(0, true);
|
|
b(a, keyEvent);
|
|
boolean a2 = a(a, keyEvent.getKeyCode(), keyEvent, 1);
|
|
a.m = false;
|
|
if (a2) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private boolean a(ViewParent viewParent) {
|
|
if (viewParent == null) {
|
|
return false;
|
|
}
|
|
View decorView = this.c.getDecorView();
|
|
while (viewParent != null) {
|
|
if (viewParent == decorView || !(viewParent instanceof View) || ViewCompat.w((View) viewParent)) {
|
|
return false;
|
|
}
|
|
viewParent = viewParent.getParent();
|
|
}
|
|
return true;
|
|
}
|
|
|
|
private void a(PanelFeatureState panelFeatureState, KeyEvent keyEvent) {
|
|
int i;
|
|
ViewGroup.LayoutParams layoutParams;
|
|
if (panelFeatureState.o || this.I) {
|
|
return;
|
|
}
|
|
if (panelFeatureState.a == 0) {
|
|
if ((this.b.getResources().getConfiguration().screenLayout & 15) == 4) {
|
|
return;
|
|
}
|
|
}
|
|
Window.Callback p = p();
|
|
if (p != null && !p.onMenuOpened(panelFeatureState.a, panelFeatureState.j)) {
|
|
a(panelFeatureState, true);
|
|
return;
|
|
}
|
|
WindowManager windowManager = (WindowManager) this.b.getSystemService("window");
|
|
if (windowManager != null && b(panelFeatureState, keyEvent)) {
|
|
if (panelFeatureState.g != null && !panelFeatureState.q) {
|
|
View view = panelFeatureState.i;
|
|
if (view != null && (layoutParams = view.getLayoutParams()) != null && layoutParams.width == -1) {
|
|
i = -1;
|
|
panelFeatureState.n = false;
|
|
WindowManager.LayoutParams layoutParams2 = new WindowManager.LayoutParams(i, -2, panelFeatureState.d, panelFeatureState.e, 1002, 8519680, -3);
|
|
layoutParams2.gravity = panelFeatureState.c;
|
|
layoutParams2.windowAnimations = panelFeatureState.f;
|
|
windowManager.addView(panelFeatureState.g, layoutParams2);
|
|
panelFeatureState.o = true;
|
|
}
|
|
} else {
|
|
ViewGroup viewGroup = panelFeatureState.g;
|
|
if (viewGroup == null) {
|
|
if (!b(panelFeatureState) || panelFeatureState.g == null) {
|
|
return;
|
|
}
|
|
} else if (panelFeatureState.q && viewGroup.getChildCount() > 0) {
|
|
panelFeatureState.g.removeAllViews();
|
|
}
|
|
if (!a(panelFeatureState) || !panelFeatureState.a()) {
|
|
return;
|
|
}
|
|
ViewGroup.LayoutParams layoutParams3 = panelFeatureState.h.getLayoutParams();
|
|
if (layoutParams3 == null) {
|
|
layoutParams3 = new ViewGroup.LayoutParams(-2, -2);
|
|
}
|
|
panelFeatureState.g.setBackgroundResource(panelFeatureState.b);
|
|
ViewParent parent = panelFeatureState.h.getParent();
|
|
if (parent != null && (parent instanceof ViewGroup)) {
|
|
((ViewGroup) parent).removeView(panelFeatureState.h);
|
|
}
|
|
panelFeatureState.g.addView(panelFeatureState.h, layoutParams3);
|
|
if (!panelFeatureState.h.hasFocus()) {
|
|
panelFeatureState.h.requestFocus();
|
|
}
|
|
}
|
|
i = -2;
|
|
panelFeatureState.n = false;
|
|
WindowManager.LayoutParams layoutParams22 = new WindowManager.LayoutParams(i, -2, panelFeatureState.d, panelFeatureState.e, 1002, 8519680, -3);
|
|
layoutParams22.gravity = panelFeatureState.c;
|
|
layoutParams22.windowAnimations = panelFeatureState.f;
|
|
windowManager.addView(panelFeatureState.g, layoutParams22);
|
|
panelFeatureState.o = true;
|
|
}
|
|
}
|
|
|
|
private boolean b(PanelFeatureState panelFeatureState) {
|
|
panelFeatureState.a(n());
|
|
panelFeatureState.g = new ListMenuDecorView(panelFeatureState.l);
|
|
panelFeatureState.c = 81;
|
|
return true;
|
|
}
|
|
|
|
private boolean b(PanelFeatureState panelFeatureState, KeyEvent keyEvent) {
|
|
DecorContentParent decorContentParent;
|
|
DecorContentParent decorContentParent2;
|
|
DecorContentParent decorContentParent3;
|
|
if (this.I) {
|
|
return false;
|
|
}
|
|
if (panelFeatureState.m) {
|
|
return true;
|
|
}
|
|
PanelFeatureState panelFeatureState2 = this.G;
|
|
if (panelFeatureState2 != null && panelFeatureState2 != panelFeatureState) {
|
|
a(panelFeatureState2, false);
|
|
}
|
|
Window.Callback p = p();
|
|
if (p != null) {
|
|
panelFeatureState.i = p.onCreatePanelView(panelFeatureState.a);
|
|
}
|
|
int i = panelFeatureState.a;
|
|
boolean z = i == 0 || i == 108;
|
|
if (z && (decorContentParent3 = this.j) != null) {
|
|
decorContentParent3.c();
|
|
}
|
|
if (panelFeatureState.i == null && (!z || !(s() instanceof ToolbarActionBar))) {
|
|
if (panelFeatureState.j == null || panelFeatureState.r) {
|
|
if (panelFeatureState.j == null && (!c(panelFeatureState) || panelFeatureState.j == null)) {
|
|
return false;
|
|
}
|
|
if (z && this.j != null) {
|
|
if (this.k == null) {
|
|
this.k = new ActionMenuPresenterCallback();
|
|
}
|
|
this.j.a(panelFeatureState.j, this.k);
|
|
}
|
|
panelFeatureState.j.s();
|
|
if (!p.onCreatePanelMenu(panelFeatureState.a, panelFeatureState.j)) {
|
|
panelFeatureState.a((MenuBuilder) null);
|
|
if (z && (decorContentParent = this.j) != null) {
|
|
decorContentParent.a(null, this.k);
|
|
}
|
|
return false;
|
|
}
|
|
panelFeatureState.r = false;
|
|
}
|
|
panelFeatureState.j.s();
|
|
Bundle bundle = panelFeatureState.s;
|
|
if (bundle != null) {
|
|
panelFeatureState.j.a(bundle);
|
|
panelFeatureState.s = null;
|
|
}
|
|
if (!p.onPreparePanel(0, panelFeatureState.i, panelFeatureState.j)) {
|
|
if (z && (decorContentParent2 = this.j) != null) {
|
|
decorContentParent2.a(null, this.k);
|
|
}
|
|
panelFeatureState.j.r();
|
|
return false;
|
|
}
|
|
panelFeatureState.p = KeyCharacterMap.load(keyEvent != null ? keyEvent.getDeviceId() : -1).getKeyboardType() != 1;
|
|
panelFeatureState.j.setQwertyMode(panelFeatureState.p);
|
|
panelFeatureState.j.r();
|
|
}
|
|
panelFeatureState.m = true;
|
|
panelFeatureState.n = false;
|
|
this.G = panelFeatureState;
|
|
return true;
|
|
}
|
|
|
|
private void a(MenuBuilder menuBuilder, boolean z) {
|
|
DecorContentParent decorContentParent = this.j;
|
|
if (decorContentParent != null && decorContentParent.d() && (!ViewConfiguration.get(this.b).hasPermanentMenuKey() || this.j.e())) {
|
|
Window.Callback p = p();
|
|
if (this.j.a() && z) {
|
|
this.j.f();
|
|
if (this.I) {
|
|
return;
|
|
}
|
|
p.onPanelClosed(108, a(0, true).j);
|
|
return;
|
|
}
|
|
if (p == null || this.I) {
|
|
return;
|
|
}
|
|
if (this.M && (this.N & 1) != 0) {
|
|
this.c.getDecorView().removeCallbacks(this.O);
|
|
this.O.run();
|
|
}
|
|
PanelFeatureState a = a(0, true);
|
|
MenuBuilder menuBuilder2 = a.j;
|
|
if (menuBuilder2 == null || a.r || !p.onPreparePanel(0, a.i, menuBuilder2)) {
|
|
return;
|
|
}
|
|
p.onMenuOpened(108, a.j);
|
|
this.j.g();
|
|
return;
|
|
}
|
|
PanelFeatureState a2 = a(0, true);
|
|
a2.q = true;
|
|
a(a2, false);
|
|
a(a2, (KeyEvent) null);
|
|
}
|
|
|
|
void b(MenuBuilder menuBuilder) {
|
|
if (this.E) {
|
|
return;
|
|
}
|
|
this.E = true;
|
|
this.j.h();
|
|
Window.Callback p = p();
|
|
if (p != null && !this.I) {
|
|
p.onPanelClosed(108, menuBuilder);
|
|
}
|
|
this.E = false;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public final ActionBarDrawerToggle$Delegate b() {
|
|
return new ActionBarDrawableToggleImpl(this);
|
|
}
|
|
|
|
private boolean a(PanelFeatureState panelFeatureState) {
|
|
View view = panelFeatureState.i;
|
|
if (view != null) {
|
|
panelFeatureState.h = view;
|
|
return true;
|
|
}
|
|
if (panelFeatureState.j == null) {
|
|
return false;
|
|
}
|
|
if (this.l == null) {
|
|
this.l = new PanelMenuPresenterCallback();
|
|
}
|
|
panelFeatureState.h = (View) panelFeatureState.a(this.l);
|
|
return panelFeatureState.h != null;
|
|
}
|
|
|
|
void a(PanelFeatureState panelFeatureState, boolean z) {
|
|
ViewGroup viewGroup;
|
|
DecorContentParent decorContentParent;
|
|
if (z && panelFeatureState.a == 0 && (decorContentParent = this.j) != null && decorContentParent.a()) {
|
|
b(panelFeatureState.j);
|
|
return;
|
|
}
|
|
WindowManager windowManager = (WindowManager) this.b.getSystemService("window");
|
|
if (windowManager != null && panelFeatureState.o && (viewGroup = panelFeatureState.g) != null) {
|
|
windowManager.removeView(viewGroup);
|
|
if (z) {
|
|
a(panelFeatureState.a, panelFeatureState, null);
|
|
}
|
|
}
|
|
panelFeatureState.m = false;
|
|
panelFeatureState.n = false;
|
|
panelFeatureState.o = false;
|
|
panelFeatureState.h = null;
|
|
panelFeatureState.q = true;
|
|
if (this.G == panelFeatureState) {
|
|
this.G = null;
|
|
}
|
|
}
|
|
|
|
void a(int i, PanelFeatureState panelFeatureState, Menu menu) {
|
|
if (menu == null) {
|
|
if (panelFeatureState == null && i >= 0) {
|
|
PanelFeatureState[] panelFeatureStateArr = this.F;
|
|
if (i < panelFeatureStateArr.length) {
|
|
panelFeatureState = panelFeatureStateArr[i];
|
|
}
|
|
}
|
|
if (panelFeatureState != null) {
|
|
menu = panelFeatureState.j;
|
|
}
|
|
}
|
|
if ((panelFeatureState == null || panelFeatureState.o) && !this.I) {
|
|
this.d.onPanelClosed(i, menu);
|
|
}
|
|
}
|
|
|
|
PanelFeatureState a(Menu menu) {
|
|
PanelFeatureState[] panelFeatureStateArr = this.F;
|
|
int length = panelFeatureStateArr != null ? panelFeatureStateArr.length : 0;
|
|
for (int i = 0; i < length; i++) {
|
|
PanelFeatureState panelFeatureState = panelFeatureStateArr[i];
|
|
if (panelFeatureState != null && panelFeatureState.j == menu) {
|
|
return panelFeatureState;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
protected PanelFeatureState a(int i, boolean z) {
|
|
PanelFeatureState[] panelFeatureStateArr = this.F;
|
|
if (panelFeatureStateArr == null || panelFeatureStateArr.length <= i) {
|
|
PanelFeatureState[] panelFeatureStateArr2 = new PanelFeatureState[i + 1];
|
|
if (panelFeatureStateArr != null) {
|
|
System.arraycopy(panelFeatureStateArr, 0, panelFeatureStateArr2, 0, panelFeatureStateArr.length);
|
|
}
|
|
this.F = panelFeatureStateArr2;
|
|
panelFeatureStateArr = panelFeatureStateArr2;
|
|
}
|
|
PanelFeatureState panelFeatureState = panelFeatureStateArr[i];
|
|
if (panelFeatureState != null) {
|
|
return panelFeatureState;
|
|
}
|
|
PanelFeatureState panelFeatureState2 = new PanelFeatureState(i);
|
|
panelFeatureStateArr[i] = panelFeatureState2;
|
|
return panelFeatureState2;
|
|
}
|
|
|
|
private boolean a(PanelFeatureState panelFeatureState, int i, KeyEvent keyEvent, int i2) {
|
|
MenuBuilder menuBuilder;
|
|
boolean z = false;
|
|
if (keyEvent.isSystem()) {
|
|
return false;
|
|
}
|
|
if ((panelFeatureState.m || b(panelFeatureState, keyEvent)) && (menuBuilder = panelFeatureState.j) != null) {
|
|
z = menuBuilder.performShortcut(i, keyEvent, i2);
|
|
}
|
|
if (z && (i2 & 1) == 0 && this.j == null) {
|
|
a(panelFeatureState, true);
|
|
}
|
|
return z;
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatDelegate
|
|
public boolean a() {
|
|
int y = y();
|
|
int f = f(y);
|
|
boolean l = f != -1 ? l(f) : false;
|
|
if (y == 0) {
|
|
w();
|
|
this.L.d();
|
|
}
|
|
this.K = true;
|
|
return l;
|
|
}
|
|
}
|