Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
package androidx.appcompat.app;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import androidx.appcompat.R$styleable;
import androidx.appcompat.view.ActionMode;
/* loaded from: classes.dex */
public abstract class ActionBar {
public interface OnMenuVisibilityListener {
void a(boolean z);
}
@Deprecated
public static abstract class Tab {
public abstract CharSequence a();
public abstract View b();
public abstract Drawable c();
public abstract CharSequence d();
public abstract void e();
}
public ActionMode a(ActionMode.Callback callback) {
return null;
}
public void a(Configuration configuration) {
}
public abstract void a(CharSequence charSequence);
public abstract boolean a(int i, KeyEvent keyEvent);
public boolean a(KeyEvent keyEvent) {
return false;
}
public abstract void b(boolean z);
public abstract void c(boolean z);
public abstract void d(boolean z);
public boolean e() {
return false;
}
public abstract boolean f();
public abstract int g();
public abstract Context h();
public boolean i() {
return false;
}
void j() {
}
public boolean k() {
return false;
}
public static class LayoutParams extends ViewGroup.MarginLayoutParams {
public int a;
public LayoutParams(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.a = 0;
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.ActionBarLayout);
this.a = obtainStyledAttributes.getInt(R$styleable.ActionBarLayout_android_layout_gravity, 0);
obtainStyledAttributes.recycle();
}
public LayoutParams(int i, int i2) {
super(i, i2);
this.a = 0;
this.a = 8388627;
}
public LayoutParams(LayoutParams layoutParams) {
super((ViewGroup.MarginLayoutParams) layoutParams);
this.a = 0;
this.a = layoutParams.a;
}
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
super(layoutParams);
this.a = 0;
}
}
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.app;
/* loaded from: classes.dex */
public interface ActionBarDrawerToggle$Delegate {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.app;
/* loaded from: classes.dex */
public interface ActionBarDrawerToggle$DelegateProvider {
}

View File

@@ -0,0 +1,842 @@
package androidx.appcompat.app;
import android.R;
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.appcompat.R$attr;
import androidx.appcompat.R$id;
import androidx.appcompat.R$styleable;
import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.core.view.ViewCompat;
import androidx.core.widget.NestedScrollView;
import java.lang.ref.WeakReference;
/* loaded from: classes.dex */
class AlertController {
NestedScrollView A;
private Drawable C;
private ImageView D;
private TextView E;
private TextView F;
private View G;
ListAdapter H;
private int J;
private int K;
int L;
int M;
int N;
int O;
private boolean P;
Handler R;
private final Context a;
final AppCompatDialog b;
private final Window c;
private final int d;
private CharSequence e;
private CharSequence f;
ListView g;
private View h;
private int i;
private int j;
private int k;
private int l;
private int m;
Button o;
private CharSequence p;
Message q;
private Drawable r;
Button s;
private CharSequence t;
Message u;
private Drawable v;
Button w;
private CharSequence x;
Message y;
private Drawable z;
private boolean n = false;
private int B = 0;
int I = -1;
private int Q = 0;
private final View.OnClickListener S = new View.OnClickListener() { // from class: androidx.appcompat.app.AlertController.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
Message obtain;
Message message;
Message message2;
Message message3;
AlertController alertController = AlertController.this;
if (view != alertController.o || (message3 = alertController.q) == null) {
AlertController alertController2 = AlertController.this;
if (view != alertController2.s || (message2 = alertController2.u) == null) {
AlertController alertController3 = AlertController.this;
obtain = (view != alertController3.w || (message = alertController3.y) == null) ? null : Message.obtain(message);
} else {
obtain = Message.obtain(message2);
}
} else {
obtain = Message.obtain(message3);
}
if (obtain != null) {
obtain.sendToTarget();
}
AlertController alertController4 = AlertController.this;
alertController4.R.obtainMessage(1, alertController4.b).sendToTarget();
}
};
public static class AlertParams {
public int A;
public int B;
public int C;
public int D;
public boolean[] F;
public boolean G;
public boolean H;
public DialogInterface.OnMultiChoiceClickListener J;
public Cursor K;
public String L;
public String M;
public AdapterView.OnItemSelectedListener N;
public OnPrepareListViewListener O;
public final Context a;
public final LayoutInflater b;
public Drawable d;
public CharSequence f;
public View g;
public CharSequence h;
public CharSequence i;
public Drawable j;
public DialogInterface.OnClickListener k;
public CharSequence l;
public Drawable m;
public DialogInterface.OnClickListener n;
public CharSequence o;
public Drawable p;
public DialogInterface.OnClickListener q;
public DialogInterface.OnCancelListener s;
public DialogInterface.OnDismissListener t;
public DialogInterface.OnKeyListener u;
public CharSequence[] v;
public ListAdapter w;
public DialogInterface.OnClickListener x;
public int y;
public View z;
public int c = 0;
public int e = 0;
public boolean E = false;
public int I = -1;
public boolean r = true;
public interface OnPrepareListViewListener {
void a(ListView listView);
}
public AlertParams(Context context) {
this.a = context;
this.b = (LayoutInflater) context.getSystemService("layout_inflater");
}
private void b(final AlertController alertController) {
ListAdapter listAdapter;
final RecycleListView recycleListView = (RecycleListView) this.b.inflate(alertController.L, (ViewGroup) null);
if (this.G) {
Cursor cursor = this.K;
listAdapter = cursor == null ? new ArrayAdapter<CharSequence>(this.a, alertController.M, R.id.text1, this.v) { // from class: androidx.appcompat.app.AlertController.AlertParams.1
@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.F;
if (zArr != null && zArr[i]) {
recycleListView.setItemChecked(i, true);
}
return view2;
}
} : new CursorAdapter(this.a, cursor, false) { // from class: androidx.appcompat.app.AlertController.AlertParams.2
private final int a;
private final int b;
{
Cursor cursor2 = getCursor();
this.a = cursor2.getColumnIndexOrThrow(AlertParams.this.L);
this.b = cursor2.getColumnIndexOrThrow(AlertParams.this.M);
}
@Override // android.widget.CursorAdapter
public void bindView(View view, Context context, Cursor cursor2) {
((CheckedTextView) view.findViewById(R.id.text1)).setText(cursor2.getString(this.a));
recycleListView.setItemChecked(cursor2.getPosition(), cursor2.getInt(this.b) == 1);
}
@Override // android.widget.CursorAdapter
public View newView(Context context, Cursor cursor2, ViewGroup viewGroup) {
return AlertParams.this.b.inflate(alertController.M, viewGroup, false);
}
};
} else {
int i = this.H ? alertController.N : alertController.O;
Cursor cursor2 = this.K;
if (cursor2 != null) {
listAdapter = new SimpleCursorAdapter(this.a, i, cursor2, new String[]{this.L}, new int[]{R.id.text1});
} else {
listAdapter = this.w;
if (listAdapter == null) {
listAdapter = new CheckedItemAdapter(this.a, i, R.id.text1, this.v);
}
}
}
OnPrepareListViewListener onPrepareListViewListener = this.O;
if (onPrepareListViewListener != null) {
onPrepareListViewListener.a(recycleListView);
}
alertController.H = listAdapter;
alertController.I = this.I;
if (this.x != null) {
recycleListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { // from class: androidx.appcompat.app.AlertController.AlertParams.3
@Override // android.widget.AdapterView.OnItemClickListener
public void onItemClick(AdapterView<?> adapterView, View view, int i2, long j) {
AlertParams.this.x.onClick(alertController.b, i2);
if (AlertParams.this.H) {
return;
}
alertController.b.dismiss();
}
});
} else if (this.J != null) {
recycleListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { // from class: androidx.appcompat.app.AlertController.AlertParams.4
@Override // android.widget.AdapterView.OnItemClickListener
public void onItemClick(AdapterView<?> adapterView, View view, int i2, long j) {
boolean[] zArr = AlertParams.this.F;
if (zArr != null) {
zArr[i2] = recycleListView.isItemChecked(i2);
}
AlertParams.this.J.onClick(alertController.b, i2, recycleListView.isItemChecked(i2));
}
});
}
AdapterView.OnItemSelectedListener onItemSelectedListener = this.N;
if (onItemSelectedListener != null) {
recycleListView.setOnItemSelectedListener(onItemSelectedListener);
}
if (this.H) {
recycleListView.setChoiceMode(1);
} else if (this.G) {
recycleListView.setChoiceMode(2);
}
alertController.g = recycleListView;
}
public void a(AlertController alertController) {
View view = this.g;
if (view != null) {
alertController.a(view);
} else {
CharSequence charSequence = this.f;
if (charSequence != null) {
alertController.b(charSequence);
}
Drawable drawable = this.d;
if (drawable != null) {
alertController.a(drawable);
}
int i = this.c;
if (i != 0) {
alertController.b(i);
}
int i2 = this.e;
if (i2 != 0) {
alertController.b(alertController.a(i2));
}
}
CharSequence charSequence2 = this.h;
if (charSequence2 != null) {
alertController.a(charSequence2);
}
if (this.i != null || this.j != null) {
alertController.a(-1, this.i, this.k, (Message) null, this.j);
}
if (this.l != null || this.m != null) {
alertController.a(-2, this.l, this.n, (Message) null, this.m);
}
if (this.o != null || this.p != null) {
alertController.a(-3, this.o, this.q, (Message) null, this.p);
}
if (this.v != null || this.K != null || this.w != null) {
b(alertController);
}
View view2 = this.z;
if (view2 != null) {
if (this.E) {
alertController.a(view2, this.A, this.B, this.C, this.D);
return;
} else {
alertController.b(view2);
return;
}
}
int i3 = this.y;
if (i3 != 0) {
alertController.c(i3);
}
}
}
private static final class ButtonHandler extends Handler {
private WeakReference<DialogInterface> a;
public ButtonHandler(DialogInterface dialogInterface) {
this.a = 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.a.get(), message.what);
} else {
if (i != 1) {
return;
}
((DialogInterface) message.obj).dismiss();
}
}
}
private static class CheckedItemAdapter extends ArrayAdapter<CharSequence> {
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 i;
}
@Override // android.widget.BaseAdapter, android.widget.Adapter
public boolean hasStableIds() {
return true;
}
}
public static class RecycleListView extends ListView {
private final int a;
private final int b;
public RecycleListView(Context context) {
this(context, null);
}
public void a(boolean z, boolean z2) {
if (z2 && z) {
return;
}
setPadding(getPaddingLeft(), z ? getPaddingTop() : this.a, getPaddingRight(), z2 ? getPaddingBottom() : this.b);
}
public RecycleListView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.RecycleListView);
this.b = obtainStyledAttributes.getDimensionPixelOffset(R$styleable.RecycleListView_paddingBottomNoButtons, -1);
this.a = obtainStyledAttributes.getDimensionPixelOffset(R$styleable.RecycleListView_paddingTopNoTitle, -1);
}
}
public AlertController(Context context, AppCompatDialog appCompatDialog, Window window) {
this.a = context;
this.b = appCompatDialog;
this.c = window;
this.R = new ButtonHandler(appCompatDialog);
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(null, R$styleable.AlertDialog, R$attr.alertDialogStyle, 0);
this.J = obtainStyledAttributes.getResourceId(R$styleable.AlertDialog_android_layout, 0);
this.K = obtainStyledAttributes.getResourceId(R$styleable.AlertDialog_buttonPanelSideLayout, 0);
this.L = obtainStyledAttributes.getResourceId(R$styleable.AlertDialog_listLayout, 0);
this.M = obtainStyledAttributes.getResourceId(R$styleable.AlertDialog_multiChoiceItemLayout, 0);
this.N = obtainStyledAttributes.getResourceId(R$styleable.AlertDialog_singleChoiceItemLayout, 0);
this.O = obtainStyledAttributes.getResourceId(R$styleable.AlertDialog_listItemLayout, 0);
this.P = obtainStyledAttributes.getBoolean(R$styleable.AlertDialog_showTitle, true);
this.d = obtainStyledAttributes.getDimensionPixelSize(R$styleable.AlertDialog_buttonIconDimen, 0);
obtainStyledAttributes.recycle();
appCompatDialog.a(1);
}
private static boolean a(Context context) {
TypedValue typedValue = new TypedValue();
context.getTheme().resolveAttribute(R$attr.alertDialogCenterButtons, typedValue, true);
return typedValue.data != 0;
}
private int b() {
int i = this.K;
return i == 0 ? this.J : this.Q == 1 ? i : this.J;
}
static boolean c(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 (c(viewGroup.getChildAt(childCount))) {
return true;
}
}
return false;
}
private void d(ViewGroup viewGroup) {
if (this.G != null) {
viewGroup.addView(this.G, 0, new ViewGroup.LayoutParams(-1, -2));
this.c.findViewById(R$id.title_template).setVisibility(8);
return;
}
this.D = (ImageView) this.c.findViewById(R.id.icon);
if (!(!TextUtils.isEmpty(this.e)) || !this.P) {
this.c.findViewById(R$id.title_template).setVisibility(8);
this.D.setVisibility(8);
viewGroup.setVisibility(8);
return;
}
this.E = (TextView) this.c.findViewById(R$id.alertTitle);
this.E.setText(this.e);
int i = this.B;
if (i != 0) {
this.D.setImageResource(i);
return;
}
Drawable drawable = this.C;
if (drawable != null) {
this.D.setImageDrawable(drawable);
} else {
this.E.setPadding(this.D.getPaddingLeft(), this.D.getPaddingTop(), this.D.getPaddingRight(), this.D.getPaddingBottom());
this.D.setVisibility(8);
}
}
public void a() {
this.b.setContentView(b());
c();
}
public void b(CharSequence charSequence) {
this.e = charSequence;
TextView textView = this.E;
if (textView != null) {
textView.setText(charSequence);
}
}
public void a(View view) {
this.G = view;
}
public void c(int i) {
this.h = null;
this.i = i;
this.n = false;
}
public void a(CharSequence charSequence) {
this.f = charSequence;
TextView textView = this.F;
if (textView != null) {
textView.setText(charSequence);
}
}
public void b(View view) {
this.h = view;
this.i = 0;
this.n = false;
}
/* JADX WARN: Multi-variable type inference failed */
private void c() {
View findViewById;
ListAdapter listAdapter;
View findViewById2;
View findViewById3 = this.c.findViewById(R$id.parentPanel);
View findViewById4 = findViewById3.findViewById(R$id.topPanel);
View findViewById5 = findViewById3.findViewById(R$id.contentPanel);
View findViewById6 = findViewById3.findViewById(R$id.buttonPanel);
ViewGroup viewGroup = (ViewGroup) findViewById3.findViewById(R$id.customPanel);
c(viewGroup);
View findViewById7 = viewGroup.findViewById(R$id.topPanel);
View findViewById8 = viewGroup.findViewById(R$id.contentPanel);
View findViewById9 = viewGroup.findViewById(R$id.buttonPanel);
ViewGroup a = a(findViewById7, findViewById4);
ViewGroup a2 = a(findViewById8, findViewById5);
ViewGroup a3 = a(findViewById9, findViewById6);
b(a2);
a(a3);
d(a);
boolean z = (viewGroup == null || viewGroup.getVisibility() == 8) ? false : true;
boolean z2 = (a == null || a.getVisibility() == 8) ? 0 : 1;
boolean z3 = (a3 == null || a3.getVisibility() == 8) ? false : true;
if (!z3 && a2 != null && (findViewById2 = a2.findViewById(R$id.textSpacerNoButtons)) != null) {
findViewById2.setVisibility(0);
}
if (z2 != 0) {
NestedScrollView nestedScrollView = this.A;
if (nestedScrollView != null) {
nestedScrollView.setClipToPadding(true);
}
View findViewById10 = (this.f == null && this.g == null) ? null : a.findViewById(R$id.titleDividerNoCustom);
if (findViewById10 != null) {
findViewById10.setVisibility(0);
}
} else if (a2 != null && (findViewById = a2.findViewById(R$id.textSpacerNoTitle)) != null) {
findViewById.setVisibility(0);
}
ListView listView = this.g;
if (listView instanceof RecycleListView) {
((RecycleListView) listView).a(z2, z3);
}
if (!z) {
View view = this.g;
if (view == null) {
view = this.A;
}
if (view != null) {
a(a2, view, z2 | (z3 ? 2 : 0), 3);
}
}
ListView listView2 = this.g;
if (listView2 == null || (listAdapter = this.H) == null) {
return;
}
listView2.setAdapter(listAdapter);
int i = this.I;
if (i > -1) {
listView2.setItemChecked(i, true);
listView2.setSelection(i);
}
}
public void a(View view, int i, int i2, int i3, int i4) {
this.h = view;
this.i = 0;
this.n = true;
this.j = i;
this.k = i2;
this.l = i3;
this.m = i4;
}
public void b(int i) {
this.C = null;
this.B = i;
ImageView imageView = this.D;
if (imageView != null) {
if (i != 0) {
imageView.setVisibility(0);
this.D.setImageResource(this.B);
} else {
imageView.setVisibility(8);
}
}
}
public boolean b(int i, KeyEvent keyEvent) {
NestedScrollView nestedScrollView = this.A;
return nestedScrollView != null && nestedScrollView.a(keyEvent);
}
private void b(ViewGroup viewGroup) {
this.A = (NestedScrollView) this.c.findViewById(R$id.scrollView);
this.A.setFocusable(false);
this.A.setNestedScrollingEnabled(false);
this.F = (TextView) viewGroup.findViewById(R.id.message);
TextView textView = this.F;
if (textView == null) {
return;
}
CharSequence charSequence = this.f;
if (charSequence != null) {
textView.setText(charSequence);
return;
}
textView.setVisibility(8);
this.A.removeView(this.F);
if (this.g != null) {
ViewGroup viewGroup2 = (ViewGroup) this.A.getParent();
int indexOfChild = viewGroup2.indexOfChild(this.A);
viewGroup2.removeViewAt(indexOfChild);
viewGroup2.addView(this.g, indexOfChild, new ViewGroup.LayoutParams(-1, -1));
return;
}
viewGroup.setVisibility(8);
}
public void a(int i, CharSequence charSequence, DialogInterface.OnClickListener onClickListener, Message message, Drawable drawable) {
if (message == null && onClickListener != null) {
message = this.R.obtainMessage(i, onClickListener);
}
if (i == -3) {
this.x = charSequence;
this.y = message;
this.z = drawable;
} else if (i == -2) {
this.t = charSequence;
this.u = message;
this.v = drawable;
} else {
if (i == -1) {
this.p = charSequence;
this.q = message;
this.r = drawable;
return;
}
throw new IllegalArgumentException("Button does not exist");
}
}
public void a(Drawable drawable) {
this.C = drawable;
this.B = 0;
ImageView imageView = this.D;
if (imageView != null) {
if (drawable != null) {
imageView.setVisibility(0);
this.D.setImageDrawable(drawable);
} else {
imageView.setVisibility(8);
}
}
}
public int a(int i) {
TypedValue typedValue = new TypedValue();
this.a.getTheme().resolveAttribute(i, typedValue, true);
return typedValue.resourceId;
}
public boolean a(int i, KeyEvent keyEvent) {
NestedScrollView nestedScrollView = this.A;
return nestedScrollView != null && nestedScrollView.a(keyEvent);
}
private ViewGroup a(View view, 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 void c(ViewGroup viewGroup) {
View view = this.h;
if (view == null) {
view = this.i != 0 ? LayoutInflater.from(this.a).inflate(this.i, viewGroup, false) : null;
}
boolean z = view != null;
if (!z || !c(view)) {
this.c.setFlags(131072, 131072);
}
if (z) {
FrameLayout frameLayout = (FrameLayout) this.c.findViewById(R$id.custom);
frameLayout.addView(view, new ViewGroup.LayoutParams(-1, -1));
if (this.n) {
frameLayout.setPadding(this.j, this.k, this.l, this.m);
}
if (this.g != null) {
((LinearLayoutCompat.LayoutParams) viewGroup.getLayoutParams()).a = 0.0f;
return;
}
return;
}
viewGroup.setVisibility(8);
}
private void a(ViewGroup viewGroup, View view, int i, int i2) {
final View findViewById = this.c.findViewById(R$id.scrollIndicatorUp);
View findViewById2 = this.c.findViewById(R$id.scrollIndicatorDown);
if (Build.VERSION.SDK_INT >= 23) {
ViewCompat.a(view, i, i2);
if (findViewById != null) {
viewGroup.removeView(findViewById);
}
if (findViewById2 != null) {
viewGroup.removeView(findViewById2);
return;
}
return;
}
final View view2 = null;
if (findViewById != null && (i & 1) == 0) {
viewGroup.removeView(findViewById);
findViewById = null;
}
if (findViewById2 == null || (i & 2) != 0) {
view2 = findViewById2;
} else {
viewGroup.removeView(findViewById2);
}
if (findViewById == null && view2 == null) {
return;
}
if (this.f != null) {
this.A.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener(this) { // from class: androidx.appcompat.app.AlertController.2
@Override // androidx.core.widget.NestedScrollView.OnScrollChangeListener
public void a(NestedScrollView nestedScrollView, int i3, int i4, int i5, int i6) {
AlertController.a(nestedScrollView, findViewById, view2);
}
});
this.A.post(new Runnable() { // from class: androidx.appcompat.app.AlertController.3
@Override // java.lang.Runnable
public void run() {
AlertController.a(AlertController.this.A, findViewById, view2);
}
});
return;
}
ListView listView = this.g;
if (listView != null) {
listView.setOnScrollListener(new AbsListView.OnScrollListener(this) { // from class: androidx.appcompat.app.AlertController.4
@Override // android.widget.AbsListView.OnScrollListener
public void onScroll(AbsListView absListView, int i3, int i4, int i5) {
AlertController.a(absListView, findViewById, view2);
}
@Override // android.widget.AbsListView.OnScrollListener
public void onScrollStateChanged(AbsListView absListView, int i3) {
}
});
this.g.post(new Runnable() { // from class: androidx.appcompat.app.AlertController.5
@Override // java.lang.Runnable
public void run() {
AlertController.a(AlertController.this.g, findViewById, view2);
}
});
return;
}
if (findViewById != null) {
viewGroup.removeView(findViewById);
}
if (view2 != null) {
viewGroup.removeView(view2);
}
}
static void a(View view, View view2, View view3) {
if (view2 != null) {
view2.setVisibility(view.canScrollVertically(-1) ? 0 : 4);
}
if (view3 != null) {
view3.setVisibility(view.canScrollVertically(1) ? 0 : 4);
}
}
private void a(ViewGroup viewGroup) {
int i;
this.o = (Button) viewGroup.findViewById(R.id.button1);
this.o.setOnClickListener(this.S);
if (TextUtils.isEmpty(this.p) && this.r == null) {
this.o.setVisibility(8);
i = 0;
} else {
this.o.setText(this.p);
Drawable drawable = this.r;
if (drawable != null) {
int i2 = this.d;
drawable.setBounds(0, 0, i2, i2);
this.o.setCompoundDrawables(this.r, null, null, null);
}
this.o.setVisibility(0);
i = 1;
}
this.s = (Button) viewGroup.findViewById(R.id.button2);
this.s.setOnClickListener(this.S);
if (TextUtils.isEmpty(this.t) && this.v == null) {
this.s.setVisibility(8);
} else {
this.s.setText(this.t);
Drawable drawable2 = this.v;
if (drawable2 != null) {
int i3 = this.d;
drawable2.setBounds(0, 0, i3, i3);
this.s.setCompoundDrawables(this.v, null, null, null);
}
this.s.setVisibility(0);
i |= 2;
}
this.w = (Button) viewGroup.findViewById(R.id.button3);
this.w.setOnClickListener(this.S);
if (TextUtils.isEmpty(this.x) && this.z == null) {
this.w.setVisibility(8);
} else {
this.w.setText(this.x);
Drawable drawable3 = this.r;
if (drawable3 != null) {
int i4 = this.d;
drawable3.setBounds(0, 0, i4, i4);
this.o.setCompoundDrawables(this.r, null, null, null);
}
this.w.setVisibility(0);
i |= 4;
}
if (a(this.a)) {
if (i == 1) {
a(this.o);
} else if (i == 2) {
a(this.s);
} else if (i == 4) {
a(this.w);
}
}
if (i != 0) {
return;
}
viewGroup.setVisibility(8);
}
private void a(Button button) {
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) button.getLayoutParams();
layoutParams.gravity = 1;
layoutParams.weight = 0.5f;
button.setLayoutParams(layoutParams);
}
}

View File

@@ -0,0 +1,129 @@
package androidx.appcompat.app;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ListAdapter;
import androidx.appcompat.R$attr;
import androidx.appcompat.app.AlertController;
/* loaded from: classes.dex */
public class AlertDialog extends AppCompatDialog implements DialogInterface {
final AlertController c;
public static class Builder {
private final AlertController.AlertParams a;
private final int b;
public Builder(Context context) {
this(context, AlertDialog.a(context, 0));
}
public Builder a(CharSequence charSequence) {
this.a.f = charSequence;
return this;
}
public Context b() {
return this.a.a;
}
public Builder(Context context, int i) {
this.a = new AlertController.AlertParams(new ContextThemeWrapper(context, AlertDialog.a(context, i)));
this.b = i;
}
public Builder a(View view) {
this.a.g = view;
return this;
}
public Builder b(View view) {
AlertController.AlertParams alertParams = this.a;
alertParams.z = view;
alertParams.y = 0;
alertParams.E = false;
return this;
}
public Builder a(Drawable drawable) {
this.a.d = drawable;
return this;
}
public Builder a(DialogInterface.OnKeyListener onKeyListener) {
this.a.u = onKeyListener;
return this;
}
public Builder a(ListAdapter listAdapter, DialogInterface.OnClickListener onClickListener) {
AlertController.AlertParams alertParams = this.a;
alertParams.w = listAdapter;
alertParams.x = onClickListener;
return this;
}
public AlertDialog a() {
AlertDialog alertDialog = new AlertDialog(this.a.a, this.b);
this.a.a(alertDialog.c);
alertDialog.setCancelable(this.a.r);
if (this.a.r) {
alertDialog.setCanceledOnTouchOutside(true);
}
alertDialog.setOnCancelListener(this.a.s);
alertDialog.setOnDismissListener(this.a.t);
DialogInterface.OnKeyListener onKeyListener = this.a.u;
if (onKeyListener != null) {
alertDialog.setOnKeyListener(onKeyListener);
}
return alertDialog;
}
}
protected AlertDialog(Context context, int i) {
super(context, a(context, i));
this.c = new AlertController(getContext(), this, getWindow());
}
static int a(Context context, int i) {
if (((i >>> 24) & 255) >= 1) {
return i;
}
TypedValue typedValue = new TypedValue();
context.getTheme().resolveAttribute(R$attr.alertDialogTheme, typedValue, true);
return typedValue.resourceId;
}
@Override // androidx.appcompat.app.AppCompatDialog, android.app.Dialog
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
this.c.a();
}
@Override // android.app.Dialog, android.view.KeyEvent.Callback
public boolean onKeyDown(int i, KeyEvent keyEvent) {
if (this.c.a(i, keyEvent)) {
return true;
}
return super.onKeyDown(i, keyEvent);
}
@Override // android.app.Dialog, android.view.KeyEvent.Callback
public boolean onKeyUp(int i, KeyEvent keyEvent) {
if (this.c.b(i, keyEvent)) {
return true;
}
return super.onKeyUp(i, keyEvent);
}
@Override // androidx.appcompat.app.AppCompatDialog, android.app.Dialog
public void setTitle(CharSequence charSequence) {
super.setTitle(charSequence);
this.c.b(charSequence);
}
}

View File

@@ -0,0 +1,324 @@
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);
}
}

View File

@@ -0,0 +1,12 @@
package androidx.appcompat.app;
import androidx.appcompat.view.ActionMode;
/* loaded from: classes.dex */
public interface AppCompatCallback {
void onSupportActionModeFinished(ActionMode actionMode);
void onSupportActionModeStarted(ActionMode actionMode);
ActionMode onWindowStartingSupportActionMode(ActionMode.Callback callback);
}

View File

@@ -0,0 +1,77 @@
package androidx.appcompat.app;
import android.app.Activity;
import android.app.Dialog;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.appcompat.view.ActionMode;
import androidx.appcompat.widget.Toolbar;
/* loaded from: classes.dex */
public abstract class AppCompatDelegate {
private static int a = -1;
AppCompatDelegate() {
}
public static AppCompatDelegate a(Activity activity, AppCompatCallback appCompatCallback) {
return new AppCompatDelegateImpl(activity, activity.getWindow(), appCompatCallback);
}
public static int k() {
return a;
}
public abstract <T extends View> T a(int i);
public abstract ActionMode a(ActionMode.Callback callback);
public abstract void a(Configuration configuration);
public abstract void a(Bundle bundle);
public abstract void a(View view);
public abstract void a(View view, ViewGroup.LayoutParams layoutParams);
public abstract void a(Toolbar toolbar);
public abstract void a(CharSequence charSequence);
public abstract boolean a();
public abstract ActionBarDrawerToggle$Delegate b();
public abstract void b(Bundle bundle);
public abstract void b(View view, ViewGroup.LayoutParams layoutParams);
public abstract boolean b(int i);
public abstract MenuInflater c();
public abstract void c(int i);
public abstract void c(Bundle bundle);
public abstract ActionBar d();
public abstract void e();
public abstract void f();
public abstract void g();
public abstract void h();
public abstract void i();
public abstract void j();
public static AppCompatDelegate a(Dialog dialog, AppCompatCallback appCompatCallback) {
return new AppCompatDelegateImpl(dialog.getContext(), dialog.getWindow(), appCompatCallback);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,131 @@
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 extends View> 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);
}
}

View File

@@ -0,0 +1,302 @@
package androidx.appcompat.app;
import android.R;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.TypedArray;
import android.os.Build;
import android.util.AttributeSet;
import android.util.Log;
import android.view.InflateException;
import android.view.View;
import androidx.appcompat.R$styleable;
import androidx.appcompat.view.ContextThemeWrapper;
import androidx.appcompat.widget.AppCompatAutoCompleteTextView;
import androidx.appcompat.widget.AppCompatButton;
import androidx.appcompat.widget.AppCompatCheckBox;
import androidx.appcompat.widget.AppCompatCheckedTextView;
import androidx.appcompat.widget.AppCompatEditText;
import androidx.appcompat.widget.AppCompatImageButton;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.AppCompatMultiAutoCompleteTextView;
import androidx.appcompat.widget.AppCompatRadioButton;
import androidx.appcompat.widget.AppCompatRatingBar;
import androidx.appcompat.widget.AppCompatSeekBar;
import androidx.appcompat.widget.AppCompatSpinner;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.appcompat.widget.TintContextWrapper;
import androidx.collection.ArrayMap;
import androidx.core.view.ViewCompat;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
/* loaded from: classes.dex */
public class AppCompatViewInflater {
private static final String LOG_TAG = "AppCompatViewInflater";
private final Object[] mConstructorArgs = new Object[2];
private static final Class<?>[] sConstructorSignature = {Context.class, AttributeSet.class};
private static final int[] sOnClickAttrs = {R.attr.onClick};
private static final String[] sClassPrefixList = {"android.widget.", "android.view.", "android.webkit."};
private static final Map<String, Constructor<? extends View>> sConstructorMap = new ArrayMap();
private static class DeclaredOnClickListener implements View.OnClickListener {
private final View a;
private final String b;
private Method c;
private Context d;
public DeclaredOnClickListener(View view, String str) {
this.a = view;
this.b = str;
}
private void a(Context context, String str) {
String str2;
Method method;
while (context != null) {
try {
if (!context.isRestricted() && (method = context.getClass().getMethod(this.b, View.class)) != null) {
this.c = method;
this.d = context;
return;
}
} catch (NoSuchMethodException unused) {
}
context = context instanceof ContextWrapper ? ((ContextWrapper) context).getBaseContext() : null;
}
int id = this.a.getId();
if (id == -1) {
str2 = "";
} else {
str2 = " with id '" + this.a.getContext().getResources().getResourceEntryName(id) + "'";
}
throw new IllegalStateException("Could not find method " + this.b + "(View) in a parent or ancestor Context for android:onClick attribute defined on view " + this.a.getClass() + str2);
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (this.c == null) {
a(this.a.getContext(), this.b);
}
try {
this.c.invoke(this.d, view);
} catch (IllegalAccessException e) {
throw new IllegalStateException("Could not execute non-public method for android:onClick", e);
} catch (InvocationTargetException e2) {
throw new IllegalStateException("Could not execute method for android:onClick", e2);
}
}
}
private void checkOnClickListener(View view, AttributeSet attributeSet) {
Context context = view.getContext();
if (context instanceof ContextWrapper) {
if (Build.VERSION.SDK_INT < 15 || ViewCompat.t(view)) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, sOnClickAttrs);
String string = obtainStyledAttributes.getString(0);
if (string != null) {
view.setOnClickListener(new DeclaredOnClickListener(view, string));
}
obtainStyledAttributes.recycle();
}
}
}
private View createViewByPrefix(Context context, String str, String str2) throws ClassNotFoundException, InflateException {
String str3;
Constructor<? extends View> constructor = sConstructorMap.get(str);
if (constructor == null) {
try {
ClassLoader classLoader = context.getClassLoader();
if (str2 != null) {
str3 = str2 + str;
} else {
str3 = str;
}
constructor = classLoader.loadClass(str3).asSubclass(View.class).getConstructor(sConstructorSignature);
sConstructorMap.put(str, constructor);
} catch (Exception unused) {
return null;
}
}
constructor.setAccessible(true);
return constructor.newInstance(this.mConstructorArgs);
}
private View createViewFromTag(Context context, String str, AttributeSet attributeSet) {
if (str.equals("view")) {
str = attributeSet.getAttributeValue(null, "class");
}
try {
this.mConstructorArgs[0] = context;
this.mConstructorArgs[1] = attributeSet;
if (-1 != str.indexOf(46)) {
return createViewByPrefix(context, str, null);
}
for (int i = 0; i < sClassPrefixList.length; i++) {
View createViewByPrefix = createViewByPrefix(context, str, sClassPrefixList[i]);
if (createViewByPrefix != null) {
return createViewByPrefix;
}
}
return null;
} catch (Exception unused) {
return null;
} finally {
Object[] objArr = this.mConstructorArgs;
objArr[0] = null;
objArr[1] = null;
}
}
private static Context themifyContext(Context context, AttributeSet attributeSet, boolean z, boolean z2) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.View, 0, 0);
int resourceId = z ? obtainStyledAttributes.getResourceId(R$styleable.View_android_theme, 0) : 0;
if (z2 && resourceId == 0 && (resourceId = obtainStyledAttributes.getResourceId(R$styleable.View_theme, 0)) != 0) {
Log.i(LOG_TAG, "app:theme is now deprecated. Please move to using android:theme instead.");
}
obtainStyledAttributes.recycle();
return resourceId != 0 ? ((context instanceof ContextThemeWrapper) && ((ContextThemeWrapper) context).a() == resourceId) ? context : new ContextThemeWrapper(context, resourceId) : context;
}
private void verifyNotNull(View view, String str) {
if (view != null) {
return;
}
throw new IllegalStateException(getClass().getName() + " asked to inflate view for <" + str + ">, but returned null");
}
protected AppCompatAutoCompleteTextView createAutoCompleteTextView(Context context, AttributeSet attributeSet) {
return new AppCompatAutoCompleteTextView(context, attributeSet);
}
protected AppCompatButton createButton(Context context, AttributeSet attributeSet) {
return new AppCompatButton(context, attributeSet);
}
protected AppCompatCheckBox createCheckBox(Context context, AttributeSet attributeSet) {
return new AppCompatCheckBox(context, attributeSet);
}
protected AppCompatCheckedTextView createCheckedTextView(Context context, AttributeSet attributeSet) {
return new AppCompatCheckedTextView(context, attributeSet);
}
protected AppCompatEditText createEditText(Context context, AttributeSet attributeSet) {
return new AppCompatEditText(context, attributeSet);
}
protected AppCompatImageButton createImageButton(Context context, AttributeSet attributeSet) {
return new AppCompatImageButton(context, attributeSet);
}
protected AppCompatImageView createImageView(Context context, AttributeSet attributeSet) {
return new AppCompatImageView(context, attributeSet);
}
protected AppCompatMultiAutoCompleteTextView createMultiAutoCompleteTextView(Context context, AttributeSet attributeSet) {
return new AppCompatMultiAutoCompleteTextView(context, attributeSet);
}
protected AppCompatRadioButton createRadioButton(Context context, AttributeSet attributeSet) {
return new AppCompatRadioButton(context, attributeSet);
}
protected AppCompatRatingBar createRatingBar(Context context, AttributeSet attributeSet) {
return new AppCompatRatingBar(context, attributeSet);
}
protected AppCompatSeekBar createSeekBar(Context context, AttributeSet attributeSet) {
return new AppCompatSeekBar(context, attributeSet);
}
protected AppCompatSpinner createSpinner(Context context, AttributeSet attributeSet) {
return new AppCompatSpinner(context, attributeSet);
}
protected AppCompatTextView createTextView(Context context, AttributeSet attributeSet) {
return new AppCompatTextView(context, attributeSet);
}
protected View createView(Context context, String str, AttributeSet attributeSet) {
return null;
}
final View createView(View view, String str, Context context, AttributeSet attributeSet, boolean z, boolean z2, boolean z3, boolean z4) {
Context context2;
View createTextView;
context2 = (!z || view == null) ? context : view.getContext();
if (z2 || z3) {
context2 = themifyContext(context2, attributeSet, z2, z3);
}
if (z4) {
context2 = TintContextWrapper.b(context2);
}
switch (str) {
case "TextView":
createTextView = createTextView(context2, attributeSet);
verifyNotNull(createTextView, str);
break;
case "ImageView":
createTextView = createImageView(context2, attributeSet);
verifyNotNull(createTextView, str);
break;
case "Button":
createTextView = createButton(context2, attributeSet);
verifyNotNull(createTextView, str);
break;
case "EditText":
createTextView = createEditText(context2, attributeSet);
verifyNotNull(createTextView, str);
break;
case "Spinner":
createTextView = createSpinner(context2, attributeSet);
verifyNotNull(createTextView, str);
break;
case "ImageButton":
createTextView = createImageButton(context2, attributeSet);
verifyNotNull(createTextView, str);
break;
case "CheckBox":
createTextView = createCheckBox(context2, attributeSet);
verifyNotNull(createTextView, str);
break;
case "RadioButton":
createTextView = createRadioButton(context2, attributeSet);
verifyNotNull(createTextView, str);
break;
case "CheckedTextView":
createTextView = createCheckedTextView(context2, attributeSet);
verifyNotNull(createTextView, str);
break;
case "AutoCompleteTextView":
createTextView = createAutoCompleteTextView(context2, attributeSet);
verifyNotNull(createTextView, str);
break;
case "MultiAutoCompleteTextView":
createTextView = createMultiAutoCompleteTextView(context2, attributeSet);
verifyNotNull(createTextView, str);
break;
case "RatingBar":
createTextView = createRatingBar(context2, attributeSet);
verifyNotNull(createTextView, str);
break;
case "SeekBar":
createTextView = createSeekBar(context2, attributeSet);
verifyNotNull(createTextView, str);
break;
default:
createTextView = createView(context2, str, attributeSet);
break;
}
if (createTextView == null && context != context2) {
createTextView = createViewFromTag(context2, str, attributeSet);
}
if (createTextView != null) {
checkOnClickListener(createTextView, attributeSet);
}
return createTextView;
}
}

View File

@@ -0,0 +1,169 @@
package androidx.appcompat.app;
import android.content.res.Resources;
import android.os.Build;
import android.util.Log;
import android.util.LongSparseArray;
import java.lang.reflect.Field;
import java.util.Map;
/* loaded from: classes.dex */
class ResourcesFlusher {
private static Field a;
private static boolean b;
private static Class c;
private static boolean d;
private static Field e;
private static boolean f;
private static Field g;
private static boolean h;
static void a(Resources resources) {
int i = Build.VERSION.SDK_INT;
if (i >= 28) {
return;
}
if (i >= 24) {
d(resources);
} else if (i >= 23) {
c(resources);
} else if (i >= 21) {
b(resources);
}
}
private static void b(Resources resources) {
Map map;
if (!b) {
try {
a = Resources.class.getDeclaredField("mDrawableCache");
a.setAccessible(true);
} catch (NoSuchFieldException e2) {
Log.e("ResourcesFlusher", "Could not retrieve Resources#mDrawableCache field", e2);
}
b = true;
}
Field field = a;
if (field != null) {
try {
map = (Map) field.get(resources);
} catch (IllegalAccessException e3) {
Log.e("ResourcesFlusher", "Could not retrieve value from Resources#mDrawableCache", e3);
map = null;
}
if (map != null) {
map.clear();
}
}
}
private static void c(Resources resources) {
if (!b) {
try {
a = Resources.class.getDeclaredField("mDrawableCache");
a.setAccessible(true);
} catch (NoSuchFieldException e2) {
Log.e("ResourcesFlusher", "Could not retrieve Resources#mDrawableCache field", e2);
}
b = true;
}
Object obj = null;
Field field = a;
if (field != null) {
try {
obj = field.get(resources);
} catch (IllegalAccessException e3) {
Log.e("ResourcesFlusher", "Could not retrieve value from Resources#mDrawableCache", e3);
}
}
if (obj == null) {
return;
}
a(obj);
}
private static void d(Resources resources) {
Object obj;
if (!h) {
try {
g = Resources.class.getDeclaredField("mResourcesImpl");
g.setAccessible(true);
} catch (NoSuchFieldException e2) {
Log.e("ResourcesFlusher", "Could not retrieve Resources#mResourcesImpl field", e2);
}
h = true;
}
Field field = g;
if (field == null) {
return;
}
Object obj2 = null;
try {
obj = field.get(resources);
} catch (IllegalAccessException e3) {
Log.e("ResourcesFlusher", "Could not retrieve value from Resources#mResourcesImpl", e3);
obj = null;
}
if (obj == null) {
return;
}
if (!b) {
try {
a = obj.getClass().getDeclaredField("mDrawableCache");
a.setAccessible(true);
} catch (NoSuchFieldException e4) {
Log.e("ResourcesFlusher", "Could not retrieve ResourcesImpl#mDrawableCache field", e4);
}
b = true;
}
Field field2 = a;
if (field2 != null) {
try {
obj2 = field2.get(obj);
} catch (IllegalAccessException e5) {
Log.e("ResourcesFlusher", "Could not retrieve value from ResourcesImpl#mDrawableCache", e5);
}
}
if (obj2 != null) {
a(obj2);
}
}
private static void a(Object obj) {
LongSparseArray longSparseArray;
if (!d) {
try {
c = Class.forName("android.content.res.ThemedResourceCache");
} catch (ClassNotFoundException e2) {
Log.e("ResourcesFlusher", "Could not find ThemedResourceCache class", e2);
}
d = true;
}
Class cls = c;
if (cls == null) {
return;
}
if (!f) {
try {
e = cls.getDeclaredField("mUnthemedEntries");
e.setAccessible(true);
} catch (NoSuchFieldException e3) {
Log.e("ResourcesFlusher", "Could not retrieve ThemedResourceCache#mUnthemedEntries field", e3);
}
f = true;
}
Field field = e;
if (field == null) {
return;
}
try {
longSparseArray = (LongSparseArray) field.get(obj);
} catch (IllegalAccessException e4) {
Log.e("ResourcesFlusher", "Could not retrieve value from ThemedResourceCache#mUnthemedEntries", e4);
longSparseArray = null;
}
if (longSparseArray != null) {
longSparseArray.clear();
}
}
}

View File

@@ -0,0 +1,245 @@
package androidx.appcompat.app;
import android.content.Context;
import android.content.res.Configuration;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.view.WindowCallbackWrapper;
import androidx.appcompat.view.menu.MenuBuilder;
import androidx.appcompat.view.menu.MenuPresenter;
import androidx.appcompat.widget.DecorToolbar;
import androidx.appcompat.widget.Toolbar;
import androidx.appcompat.widget.ToolbarWidgetWrapper;
import androidx.core.view.ViewCompat;
import java.util.ArrayList;
/* loaded from: classes.dex */
class ToolbarActionBar extends ActionBar {
DecorToolbar a;
boolean b;
Window.Callback c;
private boolean d;
private boolean e;
private ArrayList<ActionBar.OnMenuVisibilityListener> f = new ArrayList<>();
private final Runnable g = new Runnable() { // from class: androidx.appcompat.app.ToolbarActionBar.1
@Override // java.lang.Runnable
public void run() {
ToolbarActionBar.this.m();
}
};
private final Toolbar.OnMenuItemClickListener h = new Toolbar.OnMenuItemClickListener() { // from class: androidx.appcompat.app.ToolbarActionBar.2
@Override // androidx.appcompat.widget.Toolbar.OnMenuItemClickListener
public boolean onMenuItemClick(MenuItem menuItem) {
return ToolbarActionBar.this.c.onMenuItemSelected(0, menuItem);
}
};
private final class MenuBuilderCallback implements MenuBuilder.Callback {
MenuBuilderCallback() {
}
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
public void a(MenuBuilder menuBuilder) {
ToolbarActionBar toolbarActionBar = ToolbarActionBar.this;
if (toolbarActionBar.c != null) {
if (toolbarActionBar.a.a()) {
ToolbarActionBar.this.c.onPanelClosed(108, menuBuilder);
} else if (ToolbarActionBar.this.c.onPreparePanel(0, null, menuBuilder)) {
ToolbarActionBar.this.c.onMenuOpened(108, menuBuilder);
}
}
}
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
public boolean a(MenuBuilder menuBuilder, MenuItem menuItem) {
return false;
}
}
private class ToolbarCallbackWrapper extends WindowCallbackWrapper {
public ToolbarCallbackWrapper(Window.Callback callback) {
super(callback);
}
@Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback
public View onCreatePanelView(int i) {
return i == 0 ? new View(ToolbarActionBar.this.a.b()) : super.onCreatePanelView(i);
}
@Override // androidx.appcompat.view.WindowCallbackWrapper, android.view.Window.Callback
public boolean onPreparePanel(int i, View view, Menu menu) {
boolean onPreparePanel = super.onPreparePanel(i, view, menu);
if (onPreparePanel) {
ToolbarActionBar toolbarActionBar = ToolbarActionBar.this;
if (!toolbarActionBar.b) {
toolbarActionBar.a.c();
ToolbarActionBar.this.b = true;
}
}
return onPreparePanel;
}
}
ToolbarActionBar(Toolbar toolbar, CharSequence charSequence, Window.Callback callback) {
this.a = new ToolbarWidgetWrapper(toolbar, false);
this.c = new ToolbarCallbackWrapper(callback);
this.a.setWindowCallback(this.c);
toolbar.setOnMenuItemClickListener(this.h);
this.a.setWindowTitle(charSequence);
}
private Menu n() {
if (!this.d) {
this.a.a(new ActionMenuPresenterCallback(), new MenuBuilderCallback());
this.d = true;
}
return this.a.j();
}
@Override // androidx.appcompat.app.ActionBar
public void a(Configuration configuration) {
super.a(configuration);
}
@Override // androidx.appcompat.app.ActionBar
public void b(boolean z) {
if (z == this.e) {
return;
}
this.e = z;
int size = this.f.size();
for (int i = 0; i < size; i++) {
this.f.get(i).a(z);
}
}
@Override // androidx.appcompat.app.ActionBar
public void c(boolean z) {
}
@Override // androidx.appcompat.app.ActionBar
public void d(boolean z) {
}
@Override // androidx.appcompat.app.ActionBar
public boolean e() {
return this.a.f();
}
@Override // androidx.appcompat.app.ActionBar
public boolean f() {
if (!this.a.i()) {
return false;
}
this.a.collapseActionView();
return true;
}
@Override // androidx.appcompat.app.ActionBar
public int g() {
return this.a.m();
}
@Override // androidx.appcompat.app.ActionBar
public Context h() {
return this.a.b();
}
@Override // androidx.appcompat.app.ActionBar
public boolean i() {
this.a.l().removeCallbacks(this.g);
ViewCompat.a(this.a.l(), this.g);
return true;
}
@Override // androidx.appcompat.app.ActionBar
void j() {
this.a.l().removeCallbacks(this.g);
}
@Override // androidx.appcompat.app.ActionBar
public boolean k() {
return this.a.g();
}
public Window.Callback l() {
return this.c;
}
void m() {
Menu n = n();
MenuBuilder menuBuilder = n instanceof MenuBuilder ? (MenuBuilder) n : null;
if (menuBuilder != null) {
menuBuilder.s();
}
try {
n.clear();
if (!this.c.onCreatePanelMenu(0, n) || !this.c.onPreparePanel(0, null, n)) {
n.clear();
}
} finally {
if (menuBuilder != null) {
menuBuilder.r();
}
}
}
private final class ActionMenuPresenterCallback implements MenuPresenter.Callback {
private boolean a;
ActionMenuPresenterCallback() {
}
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
public boolean a(MenuBuilder menuBuilder) {
Window.Callback callback = ToolbarActionBar.this.c;
if (callback == null) {
return false;
}
callback.onMenuOpened(108, menuBuilder);
return true;
}
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
public void a(MenuBuilder menuBuilder, boolean z) {
if (this.a) {
return;
}
this.a = true;
ToolbarActionBar.this.a.h();
Window.Callback callback = ToolbarActionBar.this.c;
if (callback != null) {
callback.onPanelClosed(108, menuBuilder);
}
this.a = false;
}
}
@Override // androidx.appcompat.app.ActionBar
public void a(CharSequence charSequence) {
this.a.setWindowTitle(charSequence);
}
@Override // androidx.appcompat.app.ActionBar
public boolean a(KeyEvent keyEvent) {
if (keyEvent.getAction() == 1) {
k();
}
return true;
}
@Override // androidx.appcompat.app.ActionBar
public boolean a(int i, KeyEvent keyEvent) {
Menu n = n();
if (n == null) {
return false;
}
n.setQwertyMode(KeyCharacterMap.load(keyEvent != null ? keyEvent.getDeviceId() : -1).getKeyboardType() != 1);
return n.performShortcut(i, keyEvent, 0);
}
}

View File

@@ -0,0 +1,48 @@
package androidx.appcompat.app;
/* loaded from: classes.dex */
class TwilightCalculator {
private static TwilightCalculator d;
public long a;
public long b;
public int c;
TwilightCalculator() {
}
static TwilightCalculator a() {
if (d == null) {
d = new TwilightCalculator();
}
return d;
}
public void a(long j, double d2, double d3) {
double d4 = (0.01720197f * ((j - 946728000000L) / 8.64E7f)) + 6.24006f;
double sin = (Math.sin(d4) * 0.03341960161924362d) + d4 + (Math.sin(2.0f * r4) * 3.4906598739326E-4d) + (Math.sin(r4 * 3.0f) * 5.236000106378924E-6d) + 1.796593063d + 3.141592653589793d;
double round = Math.round((r3 - 9.0E-4f) - r9) + 9.0E-4f + ((-d3) / 360.0d) + (Math.sin(d4) * 0.0053d) + (Math.sin(2.0d * sin) * (-0.0069d));
double asin = Math.asin(Math.sin(sin) * Math.sin(0.4092797040939331d));
double d5 = 0.01745329238474369d * d2;
double sin2 = (Math.sin(-0.10471975803375244d) - (Math.sin(d5) * Math.sin(asin))) / (Math.cos(d5) * Math.cos(asin));
if (sin2 >= 1.0d) {
this.c = 1;
this.a = -1L;
this.b = -1L;
} else {
if (sin2 <= -1.0d) {
this.c = 0;
this.a = -1L;
this.b = -1L;
return;
}
double acos = (float) (Math.acos(sin2) / 6.283185307179586d);
this.a = Math.round((round + acos) * 8.64E7d) + 946728000000L;
this.b = Math.round((round - acos) * 8.64E7d) + 946728000000L;
if (this.b < j && this.a > j) {
this.c = 0;
} else {
this.c = 1;
}
}
}
}

View File

@@ -0,0 +1,107 @@
package androidx.appcompat.app;
import android.annotation.SuppressLint;
import android.content.Context;
import android.location.Location;
import android.location.LocationManager;
import android.util.Log;
import androidx.core.content.PermissionChecker;
import java.util.Calendar;
/* loaded from: classes.dex */
class TwilightManager {
private static TwilightManager d;
private final Context a;
private final LocationManager b;
private final TwilightState c = new TwilightState();
private static class TwilightState {
boolean a;
long b;
long c;
long d;
long e;
long f;
TwilightState() {
}
}
TwilightManager(Context context, LocationManager locationManager) {
this.a = context;
this.b = locationManager;
}
static TwilightManager a(Context context) {
if (d == null) {
Context applicationContext = context.getApplicationContext();
d = new TwilightManager(applicationContext, (LocationManager) applicationContext.getSystemService("location"));
}
return d;
}
@SuppressLint({"MissingPermission"})
private Location b() {
Location a = PermissionChecker.a(this.a, "android.permission.ACCESS_COARSE_LOCATION") == 0 ? a("network") : null;
Location a2 = PermissionChecker.a(this.a, "android.permission.ACCESS_FINE_LOCATION") == 0 ? a("gps") : null;
return (a2 == null || a == null) ? a2 != null ? a2 : a : a2.getTime() > a.getTime() ? a2 : a;
}
private boolean c() {
return this.c.f > System.currentTimeMillis();
}
boolean a() {
TwilightState twilightState = this.c;
if (c()) {
return twilightState.a;
}
Location b = b();
if (b != null) {
a(b);
return twilightState.a;
}
Log.i("TwilightManager", "Could not get last known location. This is probably because the app does not have any location permissions. Falling back to hardcoded sunrise/sunset values.");
int i = Calendar.getInstance().get(11);
return i < 6 || i >= 22;
}
private Location a(String str) {
try {
if (this.b.isProviderEnabled(str)) {
return this.b.getLastKnownLocation(str);
}
return null;
} catch (Exception e) {
Log.d("TwilightManager", "Failed to get last known location", e);
return null;
}
}
private void a(Location location) {
long j;
TwilightState twilightState = this.c;
long currentTimeMillis = System.currentTimeMillis();
TwilightCalculator a = TwilightCalculator.a();
a.a(currentTimeMillis - 86400000, location.getLatitude(), location.getLongitude());
long j2 = a.a;
a.a(currentTimeMillis, location.getLatitude(), location.getLongitude());
boolean z = a.c == 1;
long j3 = a.b;
long j4 = a.a;
boolean z2 = z;
a.a(86400000 + currentTimeMillis, location.getLatitude(), location.getLongitude());
long j5 = a.b;
if (j3 == -1 || j4 == -1) {
j = 43200000 + currentTimeMillis;
} else {
j = (currentTimeMillis > j4 ? 0 + j5 : currentTimeMillis > j3 ? 0 + j4 : 0 + j3) + 60000;
}
twilightState.a = z2;
twilightState.b = j2;
twilightState.c = j3;
twilightState.d = j4;
twilightState.e = j5;
twilightState.f = j;
}
}

View File

@@ -0,0 +1,723 @@
package androidx.appcompat.app;
import android.R;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import androidx.appcompat.R$attr;
import androidx.appcompat.R$id;
import androidx.appcompat.R$styleable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.view.ActionBarPolicy;
import androidx.appcompat.view.ActionMode;
import androidx.appcompat.view.SupportMenuInflater;
import androidx.appcompat.view.ViewPropertyAnimatorCompatSet;
import androidx.appcompat.view.menu.MenuBuilder;
import androidx.appcompat.widget.ActionBarContainer;
import androidx.appcompat.widget.ActionBarContextView;
import androidx.appcompat.widget.ActionBarOverlayLayout;
import androidx.appcompat.widget.DecorToolbar;
import androidx.appcompat.widget.ScrollingTabContainerView;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.ViewCompat;
import androidx.core.view.ViewPropertyAnimatorCompat;
import androidx.core.view.ViewPropertyAnimatorListener;
import androidx.core.view.ViewPropertyAnimatorListenerAdapter;
import androidx.core.view.ViewPropertyAnimatorUpdateListener;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
/* loaded from: classes.dex */
public class WindowDecorActionBar extends ActionBar implements ActionBarOverlayLayout.ActionBarVisibilityCallback {
private static final Interpolator B = new AccelerateInterpolator();
private static final Interpolator C = new DecelerateInterpolator();
final ViewPropertyAnimatorUpdateListener A;
Context a;
private Context b;
ActionBarOverlayLayout c;
ActionBarContainer d;
DecorToolbar e;
ActionBarContextView f;
View g;
ScrollingTabContainerView h;
private boolean i;
ActionModeImpl j;
ActionMode k;
ActionMode.Callback l;
private boolean m;
private ArrayList<ActionBar.OnMenuVisibilityListener> n;
private boolean o;
private int p;
boolean q;
boolean r;
boolean s;
private boolean t;
private boolean u;
ViewPropertyAnimatorCompatSet v;
private boolean w;
boolean x;
final ViewPropertyAnimatorListener y;
final ViewPropertyAnimatorListener z;
public class ActionModeImpl extends ActionMode implements MenuBuilder.Callback {
private final Context c;
private final MenuBuilder d;
private ActionMode.Callback e;
private WeakReference<View> f;
public ActionModeImpl(Context context, ActionMode.Callback callback) {
this.c = context;
this.e = callback;
MenuBuilder menuBuilder = new MenuBuilder(context);
menuBuilder.c(1);
this.d = menuBuilder;
this.d.a(this);
}
@Override // androidx.appcompat.view.ActionMode
public void a() {
WindowDecorActionBar windowDecorActionBar = WindowDecorActionBar.this;
if (windowDecorActionBar.j != this) {
return;
}
if (WindowDecorActionBar.a(windowDecorActionBar.r, windowDecorActionBar.s, false)) {
this.e.a(this);
} else {
WindowDecorActionBar windowDecorActionBar2 = WindowDecorActionBar.this;
windowDecorActionBar2.k = this;
windowDecorActionBar2.l = this.e;
}
this.e = null;
WindowDecorActionBar.this.e(false);
WindowDecorActionBar.this.f.a();
WindowDecorActionBar.this.e.l().sendAccessibilityEvent(32);
WindowDecorActionBar windowDecorActionBar3 = WindowDecorActionBar.this;
windowDecorActionBar3.c.setHideOnContentScrollEnabled(windowDecorActionBar3.x);
WindowDecorActionBar.this.j = null;
}
@Override // androidx.appcompat.view.ActionMode
public void b(CharSequence charSequence) {
WindowDecorActionBar.this.f.setTitle(charSequence);
}
@Override // androidx.appcompat.view.ActionMode
public Menu c() {
return this.d;
}
@Override // androidx.appcompat.view.ActionMode
public MenuInflater d() {
return new SupportMenuInflater(this.c);
}
@Override // androidx.appcompat.view.ActionMode
public CharSequence e() {
return WindowDecorActionBar.this.f.getSubtitle();
}
@Override // androidx.appcompat.view.ActionMode
public CharSequence g() {
return WindowDecorActionBar.this.f.getTitle();
}
@Override // androidx.appcompat.view.ActionMode
public void i() {
if (WindowDecorActionBar.this.j != this) {
return;
}
this.d.s();
try {
this.e.b(this, this.d);
} finally {
this.d.r();
}
}
@Override // androidx.appcompat.view.ActionMode
public boolean j() {
return WindowDecorActionBar.this.f.b();
}
public boolean k() {
this.d.s();
try {
return this.e.a(this, this.d);
} finally {
this.d.r();
}
}
@Override // androidx.appcompat.view.ActionMode
public void b(int i) {
b(WindowDecorActionBar.this.a.getResources().getString(i));
}
@Override // androidx.appcompat.view.ActionMode
public View b() {
WeakReference<View> weakReference = this.f;
if (weakReference != null) {
return weakReference.get();
}
return null;
}
@Override // androidx.appcompat.view.ActionMode
public void a(View view) {
WindowDecorActionBar.this.f.setCustomView(view);
this.f = new WeakReference<>(view);
}
@Override // androidx.appcompat.view.ActionMode
public void a(CharSequence charSequence) {
WindowDecorActionBar.this.f.setSubtitle(charSequence);
}
@Override // androidx.appcompat.view.ActionMode
public void a(int i) {
a((CharSequence) WindowDecorActionBar.this.a.getResources().getString(i));
}
@Override // androidx.appcompat.view.ActionMode
public void a(boolean z) {
super.a(z);
WindowDecorActionBar.this.f.setTitleOptional(z);
}
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
public boolean a(MenuBuilder menuBuilder, MenuItem menuItem) {
ActionMode.Callback callback = this.e;
if (callback != null) {
return callback.a(this, menuItem);
}
return false;
}
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
public void a(MenuBuilder menuBuilder) {
if (this.e == null) {
return;
}
i();
WindowDecorActionBar.this.f.d();
}
}
public WindowDecorActionBar(Activity activity, boolean z) {
new ArrayList();
this.n = new ArrayList<>();
this.p = 0;
this.q = true;
this.u = true;
this.y = new ViewPropertyAnimatorListenerAdapter() { // from class: androidx.appcompat.app.WindowDecorActionBar.1
@Override // androidx.core.view.ViewPropertyAnimatorListener
public void b(View view) {
View view2;
WindowDecorActionBar windowDecorActionBar = WindowDecorActionBar.this;
if (windowDecorActionBar.q && (view2 = windowDecorActionBar.g) != null) {
view2.setTranslationY(0.0f);
WindowDecorActionBar.this.d.setTranslationY(0.0f);
}
WindowDecorActionBar.this.d.setVisibility(8);
WindowDecorActionBar.this.d.setTransitioning(false);
WindowDecorActionBar windowDecorActionBar2 = WindowDecorActionBar.this;
windowDecorActionBar2.v = null;
windowDecorActionBar2.l();
ActionBarOverlayLayout actionBarOverlayLayout = WindowDecorActionBar.this.c;
if (actionBarOverlayLayout != null) {
ViewCompat.B(actionBarOverlayLayout);
}
}
};
this.z = new ViewPropertyAnimatorListenerAdapter() { // from class: androidx.appcompat.app.WindowDecorActionBar.2
@Override // androidx.core.view.ViewPropertyAnimatorListener
public void b(View view) {
WindowDecorActionBar windowDecorActionBar = WindowDecorActionBar.this;
windowDecorActionBar.v = null;
windowDecorActionBar.d.requestLayout();
}
};
this.A = new ViewPropertyAnimatorUpdateListener() { // from class: androidx.appcompat.app.WindowDecorActionBar.3
@Override // androidx.core.view.ViewPropertyAnimatorUpdateListener
public void a(View view) {
((View) WindowDecorActionBar.this.d.getParent()).invalidate();
}
};
View decorView = activity.getWindow().getDecorView();
b(decorView);
if (z) {
return;
}
this.g = decorView.findViewById(R.id.content);
}
/* JADX WARN: Multi-variable type inference failed */
private DecorToolbar a(View view) {
if (view instanceof DecorToolbar) {
return (DecorToolbar) view;
}
if (view instanceof Toolbar) {
return ((Toolbar) view).getWrapper();
}
StringBuilder sb = new StringBuilder();
sb.append("Can't make a decor toolbar out of ");
sb.append(view != 0 ? view.getClass().getSimpleName() : "null");
throw new IllegalStateException(sb.toString());
}
static boolean a(boolean z, boolean z2, boolean z3) {
if (z3) {
return true;
}
return (z || z2) ? false : true;
}
private void b(View view) {
this.c = (ActionBarOverlayLayout) view.findViewById(R$id.decor_content_parent);
ActionBarOverlayLayout actionBarOverlayLayout = this.c;
if (actionBarOverlayLayout != null) {
actionBarOverlayLayout.setActionBarVisibilityCallback(this);
}
this.e = a(view.findViewById(R$id.action_bar));
this.f = (ActionBarContextView) view.findViewById(R$id.action_context_bar);
this.d = (ActionBarContainer) view.findViewById(R$id.action_bar_container);
DecorToolbar decorToolbar = this.e;
if (decorToolbar == null || this.f == null || this.d == null) {
throw new IllegalStateException(WindowDecorActionBar.class.getSimpleName() + " can only be used with a compatible window decor layout");
}
this.a = decorToolbar.b();
boolean z = (this.e.m() & 4) != 0;
if (z) {
this.i = true;
}
ActionBarPolicy a = ActionBarPolicy.a(this.a);
j(a.a() || z);
k(a.f());
TypedArray obtainStyledAttributes = this.a.obtainStyledAttributes(null, R$styleable.ActionBar, R$attr.actionBarStyle, 0);
if (obtainStyledAttributes.getBoolean(R$styleable.ActionBar_hideOnContentScroll, false)) {
i(true);
}
int dimensionPixelSize = obtainStyledAttributes.getDimensionPixelSize(R$styleable.ActionBar_elevation, 0);
if (dimensionPixelSize != 0) {
a(dimensionPixelSize);
}
obtainStyledAttributes.recycle();
}
private void k(boolean z) {
this.o = z;
if (this.o) {
this.d.setTabContainer(null);
this.e.a(this.h);
} else {
this.e.a((ScrollingTabContainerView) null);
this.d.setTabContainer(this.h);
}
boolean z2 = m() == 2;
ScrollingTabContainerView scrollingTabContainerView = this.h;
if (scrollingTabContainerView != null) {
if (z2) {
scrollingTabContainerView.setVisibility(0);
ActionBarOverlayLayout actionBarOverlayLayout = this.c;
if (actionBarOverlayLayout != null) {
ViewCompat.B(actionBarOverlayLayout);
}
} else {
scrollingTabContainerView.setVisibility(8);
}
}
this.e.b(!this.o && z2);
this.c.setHasNonEmbeddedTabs(!this.o && z2);
}
private void n() {
if (this.t) {
this.t = false;
ActionBarOverlayLayout actionBarOverlayLayout = this.c;
if (actionBarOverlayLayout != null) {
actionBarOverlayLayout.setShowingForActionMode(false);
}
l(false);
}
}
private boolean o() {
return ViewCompat.x(this.d);
}
private void p() {
if (this.t) {
return;
}
this.t = true;
ActionBarOverlayLayout actionBarOverlayLayout = this.c;
if (actionBarOverlayLayout != null) {
actionBarOverlayLayout.setShowingForActionMode(true);
}
l(false);
}
@Override // androidx.appcompat.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
public void b() {
}
@Override // androidx.appcompat.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
public void c() {
if (this.s) {
return;
}
this.s = true;
l(true);
}
@Override // androidx.appcompat.app.ActionBar
public void d(boolean z) {
ViewPropertyAnimatorCompatSet viewPropertyAnimatorCompatSet;
this.w = z;
if (z || (viewPropertyAnimatorCompatSet = this.v) == null) {
return;
}
viewPropertyAnimatorCompatSet.a();
}
public void e(boolean z) {
ViewPropertyAnimatorCompat a;
ViewPropertyAnimatorCompat a2;
if (z) {
p();
} else {
n();
}
if (!o()) {
if (z) {
this.e.c(4);
this.f.setVisibility(0);
return;
} else {
this.e.c(0);
this.f.setVisibility(8);
return;
}
}
if (z) {
a2 = this.e.a(4, 100L);
a = this.f.a(0, 200L);
} else {
a = this.e.a(0, 200L);
a2 = this.f.a(8, 100L);
}
ViewPropertyAnimatorCompatSet viewPropertyAnimatorCompatSet = new ViewPropertyAnimatorCompatSet();
viewPropertyAnimatorCompatSet.a(a2, a);
viewPropertyAnimatorCompatSet.c();
}
public void f(boolean z) {
View view;
ViewPropertyAnimatorCompatSet viewPropertyAnimatorCompatSet = this.v;
if (viewPropertyAnimatorCompatSet != null) {
viewPropertyAnimatorCompatSet.a();
}
if (this.p != 0 || (!this.w && !z)) {
this.y.b(null);
return;
}
this.d.setAlpha(1.0f);
this.d.setTransitioning(true);
ViewPropertyAnimatorCompatSet viewPropertyAnimatorCompatSet2 = new ViewPropertyAnimatorCompatSet();
float f = -this.d.getHeight();
if (z) {
this.d.getLocationInWindow(new int[]{0, 0});
f -= r5[1];
}
ViewPropertyAnimatorCompat a = ViewCompat.a(this.d);
a.b(f);
a.a(this.A);
viewPropertyAnimatorCompatSet2.a(a);
if (this.q && (view = this.g) != null) {
ViewPropertyAnimatorCompat a2 = ViewCompat.a(view);
a2.b(f);
viewPropertyAnimatorCompatSet2.a(a2);
}
viewPropertyAnimatorCompatSet2.a(B);
viewPropertyAnimatorCompatSet2.a(250L);
viewPropertyAnimatorCompatSet2.a(this.y);
this.v = viewPropertyAnimatorCompatSet2;
viewPropertyAnimatorCompatSet2.c();
}
@Override // androidx.appcompat.app.ActionBar
public int g() {
return this.e.m();
}
public void h(boolean z) {
a(z ? 4 : 0, 4);
}
public void i(boolean z) {
if (z && !this.c.i()) {
throw new IllegalStateException("Action bar must be in overlay mode (Window.FEATURE_OVERLAY_ACTION_BAR) to enable hide on content scroll");
}
this.x = z;
this.c.setHideOnContentScrollEnabled(z);
}
public void j(boolean z) {
this.e.a(z);
}
void l() {
ActionMode.Callback callback = this.l;
if (callback != null) {
callback.a(this.k);
this.k = null;
this.l = null;
}
}
public int m() {
return this.e.k();
}
public void g(boolean z) {
View view;
View view2;
ViewPropertyAnimatorCompatSet viewPropertyAnimatorCompatSet = this.v;
if (viewPropertyAnimatorCompatSet != null) {
viewPropertyAnimatorCompatSet.a();
}
this.d.setVisibility(0);
if (this.p == 0 && (this.w || z)) {
this.d.setTranslationY(0.0f);
float f = -this.d.getHeight();
if (z) {
this.d.getLocationInWindow(new int[]{0, 0});
f -= r5[1];
}
this.d.setTranslationY(f);
ViewPropertyAnimatorCompatSet viewPropertyAnimatorCompatSet2 = new ViewPropertyAnimatorCompatSet();
ViewPropertyAnimatorCompat a = ViewCompat.a(this.d);
a.b(0.0f);
a.a(this.A);
viewPropertyAnimatorCompatSet2.a(a);
if (this.q && (view2 = this.g) != null) {
view2.setTranslationY(f);
ViewPropertyAnimatorCompat a2 = ViewCompat.a(this.g);
a2.b(0.0f);
viewPropertyAnimatorCompatSet2.a(a2);
}
viewPropertyAnimatorCompatSet2.a(C);
viewPropertyAnimatorCompatSet2.a(250L);
viewPropertyAnimatorCompatSet2.a(this.z);
this.v = viewPropertyAnimatorCompatSet2;
viewPropertyAnimatorCompatSet2.c();
} else {
this.d.setAlpha(1.0f);
this.d.setTranslationY(0.0f);
if (this.q && (view = this.g) != null) {
view.setTranslationY(0.0f);
}
this.z.b(null);
}
ActionBarOverlayLayout actionBarOverlayLayout = this.c;
if (actionBarOverlayLayout != null) {
ViewCompat.B(actionBarOverlayLayout);
}
}
@Override // androidx.appcompat.app.ActionBar
public Context h() {
if (this.b == null) {
TypedValue typedValue = new TypedValue();
this.a.getTheme().resolveAttribute(R$attr.actionBarWidgetTheme, typedValue, true);
int i = typedValue.resourceId;
if (i != 0) {
this.b = new ContextThemeWrapper(this.a, i);
} else {
this.b = this.a;
}
}
return this.b;
}
@Override // androidx.appcompat.app.ActionBar
public void c(boolean z) {
if (this.i) {
return;
}
h(z);
}
@Override // androidx.appcompat.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
public void d() {
ViewPropertyAnimatorCompatSet viewPropertyAnimatorCompatSet = this.v;
if (viewPropertyAnimatorCompatSet != null) {
viewPropertyAnimatorCompatSet.a();
this.v = null;
}
}
private void l(boolean z) {
if (a(this.r, this.s, this.t)) {
if (this.u) {
return;
}
this.u = true;
g(z);
return;
}
if (this.u) {
this.u = false;
f(z);
}
}
public void a(float f) {
ViewCompat.b(this.d, f);
}
@Override // androidx.appcompat.app.ActionBar
public void a(Configuration configuration) {
k(ActionBarPolicy.a(this.a).f());
}
@Override // androidx.appcompat.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
public void a(int i) {
this.p = i;
}
@Override // androidx.appcompat.app.ActionBar
public void a(CharSequence charSequence) {
this.e.setWindowTitle(charSequence);
}
public void a(int i, int i2) {
int m = this.e.m();
if ((i2 & 4) != 0) {
this.i = true;
}
this.e.a((i & i2) | ((~i2) & m));
}
public WindowDecorActionBar(Dialog dialog) {
new ArrayList();
this.n = new ArrayList<>();
this.p = 0;
this.q = true;
this.u = true;
this.y = new ViewPropertyAnimatorListenerAdapter() { // from class: androidx.appcompat.app.WindowDecorActionBar.1
@Override // androidx.core.view.ViewPropertyAnimatorListener
public void b(View view) {
View view2;
WindowDecorActionBar windowDecorActionBar = WindowDecorActionBar.this;
if (windowDecorActionBar.q && (view2 = windowDecorActionBar.g) != null) {
view2.setTranslationY(0.0f);
WindowDecorActionBar.this.d.setTranslationY(0.0f);
}
WindowDecorActionBar.this.d.setVisibility(8);
WindowDecorActionBar.this.d.setTransitioning(false);
WindowDecorActionBar windowDecorActionBar2 = WindowDecorActionBar.this;
windowDecorActionBar2.v = null;
windowDecorActionBar2.l();
ActionBarOverlayLayout actionBarOverlayLayout = WindowDecorActionBar.this.c;
if (actionBarOverlayLayout != null) {
ViewCompat.B(actionBarOverlayLayout);
}
}
};
this.z = new ViewPropertyAnimatorListenerAdapter() { // from class: androidx.appcompat.app.WindowDecorActionBar.2
@Override // androidx.core.view.ViewPropertyAnimatorListener
public void b(View view) {
WindowDecorActionBar windowDecorActionBar = WindowDecorActionBar.this;
windowDecorActionBar.v = null;
windowDecorActionBar.d.requestLayout();
}
};
this.A = new ViewPropertyAnimatorUpdateListener() { // from class: androidx.appcompat.app.WindowDecorActionBar.3
@Override // androidx.core.view.ViewPropertyAnimatorUpdateListener
public void a(View view) {
((View) WindowDecorActionBar.this.d.getParent()).invalidate();
}
};
b(dialog.getWindow().getDecorView());
}
@Override // androidx.appcompat.app.ActionBar
public ActionMode a(ActionMode.Callback callback) {
ActionModeImpl actionModeImpl = this.j;
if (actionModeImpl != null) {
actionModeImpl.a();
}
this.c.setHideOnContentScrollEnabled(false);
this.f.c();
ActionModeImpl actionModeImpl2 = new ActionModeImpl(this.f.getContext(), callback);
if (!actionModeImpl2.k()) {
return null;
}
this.j = actionModeImpl2;
actionModeImpl2.i();
this.f.a(actionModeImpl2);
e(true);
this.f.sendAccessibilityEvent(32);
return actionModeImpl2;
}
@Override // androidx.appcompat.app.ActionBar
public void b(boolean z) {
if (z == this.m) {
return;
}
this.m = z;
int size = this.n.size();
for (int i = 0; i < size; i++) {
this.n.get(i).a(z);
}
}
@Override // androidx.appcompat.app.ActionBar
public boolean f() {
DecorToolbar decorToolbar = this.e;
if (decorToolbar == null || !decorToolbar.i()) {
return false;
}
this.e.collapseActionView();
return true;
}
@Override // androidx.appcompat.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
public void a(boolean z) {
this.q = z;
}
@Override // androidx.appcompat.widget.ActionBarOverlayLayout.ActionBarVisibilityCallback
public void a() {
if (this.s) {
this.s = false;
l(true);
}
}
@Override // androidx.appcompat.app.ActionBar
public boolean a(int i, KeyEvent keyEvent) {
Menu c;
ActionModeImpl actionModeImpl = this.j;
if (actionModeImpl == null || (c = actionModeImpl.c()) == null) {
return false;
}
c.setQwertyMode(KeyCharacterMap.load(keyEvent != null ? keyEvent.getDeviceId() : -1).getKeyboardType() != 1);
return c.performShortcut(i, keyEvent, 0);
}
}