Initial commit
This commit is contained in:
200
sources/androidx/appcompat/widget/AbsActionBarView.java
Normal file
200
sources/androidx/appcompat/widget/AbsActionBarView.java
Normal file
@@ -0,0 +1,200 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.appcompat.R$styleable;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorListener;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AbsActionBarView extends ViewGroup {
|
||||
protected final VisibilityAnimListener a;
|
||||
protected final Context b;
|
||||
protected ActionMenuView c;
|
||||
protected ActionMenuPresenter d;
|
||||
protected int e;
|
||||
protected ViewPropertyAnimatorCompat f;
|
||||
private boolean g;
|
||||
private boolean h;
|
||||
|
||||
AbsActionBarView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
protected static int a(int i, int i2, boolean z) {
|
||||
return z ? i - i2 : i + i2;
|
||||
}
|
||||
|
||||
public int getAnimatedVisibility() {
|
||||
return this.f != null ? this.a.b : getVisibility();
|
||||
}
|
||||
|
||||
public int getContentHeight() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onConfigurationChanged(Configuration configuration) {
|
||||
super.onConfigurationChanged(configuration);
|
||||
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(null, R$styleable.ActionBar, R$attr.actionBarStyle, 0);
|
||||
setContentHeight(obtainStyledAttributes.getLayoutDimension(R$styleable.ActionBar_height, 0));
|
||||
obtainStyledAttributes.recycle();
|
||||
ActionMenuPresenter actionMenuPresenter = this.d;
|
||||
if (actionMenuPresenter != null) {
|
||||
actionMenuPresenter.a(configuration);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean onHoverEvent(MotionEvent motionEvent) {
|
||||
int actionMasked = motionEvent.getActionMasked();
|
||||
if (actionMasked == 9) {
|
||||
this.h = false;
|
||||
}
|
||||
if (!this.h) {
|
||||
boolean onHoverEvent = super.onHoverEvent(motionEvent);
|
||||
if (actionMasked == 9 && !onHoverEvent) {
|
||||
this.h = true;
|
||||
}
|
||||
}
|
||||
if (actionMasked == 10 || actionMasked == 3) {
|
||||
this.h = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
int actionMasked = motionEvent.getActionMasked();
|
||||
if (actionMasked == 0) {
|
||||
this.g = false;
|
||||
}
|
||||
if (!this.g) {
|
||||
boolean onTouchEvent = super.onTouchEvent(motionEvent);
|
||||
if (actionMasked == 0 && !onTouchEvent) {
|
||||
this.g = true;
|
||||
}
|
||||
}
|
||||
if (actionMasked == 1 || actionMasked == 3) {
|
||||
this.g = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract void setContentHeight(int i);
|
||||
|
||||
@Override // android.view.View
|
||||
public void setVisibility(int i) {
|
||||
if (i != getVisibility()) {
|
||||
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = this.f;
|
||||
if (viewPropertyAnimatorCompat != null) {
|
||||
viewPropertyAnimatorCompat.a();
|
||||
}
|
||||
super.setVisibility(i);
|
||||
}
|
||||
}
|
||||
|
||||
protected class VisibilityAnimListener implements ViewPropertyAnimatorListener {
|
||||
private boolean a = false;
|
||||
int b;
|
||||
|
||||
protected VisibilityAnimListener() {
|
||||
}
|
||||
|
||||
public VisibilityAnimListener a(ViewPropertyAnimatorCompat viewPropertyAnimatorCompat, int i) {
|
||||
AbsActionBarView.this.f = viewPropertyAnimatorCompat;
|
||||
this.b = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void b(View view) {
|
||||
if (this.a) {
|
||||
return;
|
||||
}
|
||||
AbsActionBarView absActionBarView = AbsActionBarView.this;
|
||||
absActionBarView.f = null;
|
||||
AbsActionBarView.super.setVisibility(this.b);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void c(View view) {
|
||||
AbsActionBarView.super.setVisibility(0);
|
||||
this.a = false;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void a(View view) {
|
||||
this.a = true;
|
||||
}
|
||||
}
|
||||
|
||||
AbsActionBarView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public ViewPropertyAnimatorCompat a(int i, long j) {
|
||||
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = this.f;
|
||||
if (viewPropertyAnimatorCompat != null) {
|
||||
viewPropertyAnimatorCompat.a();
|
||||
}
|
||||
if (i != 0) {
|
||||
ViewPropertyAnimatorCompat a = ViewCompat.a(this);
|
||||
a.a(0.0f);
|
||||
a.a(j);
|
||||
VisibilityAnimListener visibilityAnimListener = this.a;
|
||||
visibilityAnimListener.a(a, i);
|
||||
a.a(visibilityAnimListener);
|
||||
return a;
|
||||
}
|
||||
if (getVisibility() != 0) {
|
||||
setAlpha(0.0f);
|
||||
}
|
||||
ViewPropertyAnimatorCompat a2 = ViewCompat.a(this);
|
||||
a2.a(1.0f);
|
||||
a2.a(j);
|
||||
VisibilityAnimListener visibilityAnimListener2 = this.a;
|
||||
visibilityAnimListener2.a(a2, i);
|
||||
a2.a(visibilityAnimListener2);
|
||||
return a2;
|
||||
}
|
||||
|
||||
AbsActionBarView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
int i2;
|
||||
this.a = new VisibilityAnimListener();
|
||||
TypedValue typedValue = new TypedValue();
|
||||
if (context.getTheme().resolveAttribute(R$attr.actionBarPopupTheme, typedValue, true) && (i2 = typedValue.resourceId) != 0) {
|
||||
this.b = new ContextThemeWrapper(context, i2);
|
||||
} else {
|
||||
this.b = context;
|
||||
}
|
||||
}
|
||||
|
||||
protected int a(View view, int i, int i2, int i3) {
|
||||
view.measure(View.MeasureSpec.makeMeasureSpec(i, Integer.MIN_VALUE), i2);
|
||||
return Math.max(0, (i - view.getMeasuredWidth()) - i3);
|
||||
}
|
||||
|
||||
protected int a(View view, int i, int i2, int i3, boolean z) {
|
||||
int measuredWidth = view.getMeasuredWidth();
|
||||
int measuredHeight = view.getMeasuredHeight();
|
||||
int i4 = i2 + ((i3 - measuredHeight) / 2);
|
||||
if (z) {
|
||||
view.layout(i - measuredWidth, i4, i, measuredHeight + i4);
|
||||
} else {
|
||||
view.layout(i, i4, i + measuredWidth, measuredHeight + i4);
|
||||
}
|
||||
return z ? -measuredWidth : measuredWidth;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ActionBarBackgroundDrawable extends Drawable {
|
||||
final ActionBarContainer a;
|
||||
|
||||
public ActionBarBackgroundDrawable(ActionBarContainer actionBarContainer) {
|
||||
this.a = actionBarContainer;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void draw(Canvas canvas) {
|
||||
ActionBarContainer actionBarContainer = this.a;
|
||||
if (actionBarContainer.h) {
|
||||
Drawable drawable = actionBarContainer.g;
|
||||
if (drawable != null) {
|
||||
drawable.draw(canvas);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
Drawable drawable2 = actionBarContainer.e;
|
||||
if (drawable2 != null) {
|
||||
drawable2.draw(canvas);
|
||||
}
|
||||
ActionBarContainer actionBarContainer2 = this.a;
|
||||
Drawable drawable3 = actionBarContainer2.f;
|
||||
if (drawable3 == null || !actionBarContainer2.i) {
|
||||
return;
|
||||
}
|
||||
drawable3.draw(canvas);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getOpacity() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void getOutline(Outline outline) {
|
||||
ActionBarContainer actionBarContainer = this.a;
|
||||
if (actionBarContainer.h) {
|
||||
Drawable drawable = actionBarContainer.g;
|
||||
if (drawable != null) {
|
||||
drawable.getOutline(outline);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
Drawable drawable2 = actionBarContainer.e;
|
||||
if (drawable2 != null) {
|
||||
drawable2.getOutline(outline);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setAlpha(int i) {
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setColorFilter(ColorFilter colorFilter) {
|
||||
}
|
||||
}
|
||||
309
sources/androidx/appcompat/widget/ActionBarContainer.java
Normal file
309
sources/androidx/appcompat/widget/ActionBarContainer.java
Normal file
@@ -0,0 +1,309 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ActionMode;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import androidx.appcompat.R$id;
|
||||
import androidx.appcompat.R$styleable;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionBarContainer extends FrameLayout {
|
||||
private boolean a;
|
||||
private View b;
|
||||
private View c;
|
||||
private View d;
|
||||
Drawable e;
|
||||
Drawable f;
|
||||
Drawable g;
|
||||
boolean h;
|
||||
boolean i;
|
||||
private int j;
|
||||
|
||||
public ActionBarContainer(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
private int a(View view) {
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams();
|
||||
return view.getMeasuredHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
|
||||
}
|
||||
|
||||
private boolean b(View view) {
|
||||
return view == null || view.getVisibility() == 8 || view.getMeasuredHeight() == 0;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
Drawable drawable = this.e;
|
||||
if (drawable != null && drawable.isStateful()) {
|
||||
this.e.setState(getDrawableState());
|
||||
}
|
||||
Drawable drawable2 = this.f;
|
||||
if (drawable2 != null && drawable2.isStateful()) {
|
||||
this.f.setState(getDrawableState());
|
||||
}
|
||||
Drawable drawable3 = this.g;
|
||||
if (drawable3 == null || !drawable3.isStateful()) {
|
||||
return;
|
||||
}
|
||||
this.g.setState(getDrawableState());
|
||||
}
|
||||
|
||||
public View getTabContainer() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
public void jumpDrawablesToCurrentState() {
|
||||
super.jumpDrawablesToCurrentState();
|
||||
Drawable drawable = this.e;
|
||||
if (drawable != null) {
|
||||
drawable.jumpToCurrentState();
|
||||
}
|
||||
Drawable drawable2 = this.f;
|
||||
if (drawable2 != null) {
|
||||
drawable2.jumpToCurrentState();
|
||||
}
|
||||
Drawable drawable3 = this.g;
|
||||
if (drawable3 != null) {
|
||||
drawable3.jumpToCurrentState();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
this.c = findViewById(R$id.action_bar);
|
||||
this.d = findViewById(R$id.action_context_bar);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean onHoverEvent(MotionEvent motionEvent) {
|
||||
super.onHoverEvent(motionEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
|
||||
return this.a || super.onInterceptTouchEvent(motionEvent);
|
||||
}
|
||||
|
||||
@Override // android.widget.FrameLayout, android.view.ViewGroup, android.view.View
|
||||
public void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
Drawable drawable;
|
||||
super.onLayout(z, i, i2, i3, i4);
|
||||
View view = this.b;
|
||||
boolean z2 = true;
|
||||
boolean z3 = false;
|
||||
boolean z4 = (view == null || view.getVisibility() == 8) ? false : true;
|
||||
if (view != null && view.getVisibility() != 8) {
|
||||
int measuredHeight = getMeasuredHeight();
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams();
|
||||
view.layout(i, (measuredHeight - view.getMeasuredHeight()) - layoutParams.bottomMargin, i3, measuredHeight - layoutParams.bottomMargin);
|
||||
}
|
||||
if (this.h) {
|
||||
Drawable drawable2 = this.g;
|
||||
if (drawable2 != null) {
|
||||
drawable2.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
|
||||
} else {
|
||||
z2 = false;
|
||||
}
|
||||
} else {
|
||||
if (this.e != null) {
|
||||
if (this.c.getVisibility() == 0) {
|
||||
this.e.setBounds(this.c.getLeft(), this.c.getTop(), this.c.getRight(), this.c.getBottom());
|
||||
} else {
|
||||
View view2 = this.d;
|
||||
if (view2 == null || view2.getVisibility() != 0) {
|
||||
this.e.setBounds(0, 0, 0, 0);
|
||||
} else {
|
||||
this.e.setBounds(this.d.getLeft(), this.d.getTop(), this.d.getRight(), this.d.getBottom());
|
||||
}
|
||||
}
|
||||
z3 = true;
|
||||
}
|
||||
this.i = z4;
|
||||
if (!z4 || (drawable = this.f) == null) {
|
||||
z2 = z3;
|
||||
} else {
|
||||
drawable.setBounds(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
|
||||
}
|
||||
}
|
||||
if (z2) {
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.FrameLayout, android.view.View
|
||||
public void onMeasure(int i, int i2) {
|
||||
int i3;
|
||||
if (this.c == null && View.MeasureSpec.getMode(i2) == Integer.MIN_VALUE && (i3 = this.j) >= 0) {
|
||||
i2 = View.MeasureSpec.makeMeasureSpec(Math.min(i3, View.MeasureSpec.getSize(i2)), Integer.MIN_VALUE);
|
||||
}
|
||||
super.onMeasure(i, i2);
|
||||
if (this.c == null) {
|
||||
return;
|
||||
}
|
||||
int mode = View.MeasureSpec.getMode(i2);
|
||||
View view = this.b;
|
||||
if (view == null || view.getVisibility() == 8 || mode == 1073741824) {
|
||||
return;
|
||||
}
|
||||
setMeasuredDimension(getMeasuredWidth(), Math.min((!b(this.c) ? a(this.c) : !b(this.d) ? a(this.d) : 0) + a(this.b), mode == Integer.MIN_VALUE ? View.MeasureSpec.getSize(i2) : Integer.MAX_VALUE));
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
super.onTouchEvent(motionEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setPrimaryBackground(Drawable drawable) {
|
||||
Drawable drawable2 = this.e;
|
||||
if (drawable2 != null) {
|
||||
drawable2.setCallback(null);
|
||||
unscheduleDrawable(this.e);
|
||||
}
|
||||
this.e = drawable;
|
||||
if (drawable != null) {
|
||||
drawable.setCallback(this);
|
||||
View view = this.c;
|
||||
if (view != null) {
|
||||
this.e.setBounds(view.getLeft(), this.c.getTop(), this.c.getRight(), this.c.getBottom());
|
||||
}
|
||||
}
|
||||
boolean z = true;
|
||||
if (!this.h ? this.e != null || this.f != null : this.g != null) {
|
||||
z = false;
|
||||
}
|
||||
setWillNotDraw(z);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setSplitBackground(Drawable drawable) {
|
||||
Drawable drawable2;
|
||||
Drawable drawable3 = this.g;
|
||||
if (drawable3 != null) {
|
||||
drawable3.setCallback(null);
|
||||
unscheduleDrawable(this.g);
|
||||
}
|
||||
this.g = drawable;
|
||||
boolean z = false;
|
||||
if (drawable != null) {
|
||||
drawable.setCallback(this);
|
||||
if (this.h && (drawable2 = this.g) != null) {
|
||||
drawable2.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
|
||||
}
|
||||
}
|
||||
if (!this.h ? !(this.e != null || this.f != null) : this.g == null) {
|
||||
z = true;
|
||||
}
|
||||
setWillNotDraw(z);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setStackedBackground(Drawable drawable) {
|
||||
Drawable drawable2;
|
||||
Drawable drawable3 = this.f;
|
||||
if (drawable3 != null) {
|
||||
drawable3.setCallback(null);
|
||||
unscheduleDrawable(this.f);
|
||||
}
|
||||
this.f = drawable;
|
||||
if (drawable != null) {
|
||||
drawable.setCallback(this);
|
||||
if (this.i && (drawable2 = this.f) != null) {
|
||||
drawable2.setBounds(this.b.getLeft(), this.b.getTop(), this.b.getRight(), this.b.getBottom());
|
||||
}
|
||||
}
|
||||
boolean z = true;
|
||||
if (!this.h ? this.e != null || this.f != null : this.g != null) {
|
||||
z = false;
|
||||
}
|
||||
setWillNotDraw(z);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setTabContainer(ScrollingTabContainerView scrollingTabContainerView) {
|
||||
View view = this.b;
|
||||
if (view != null) {
|
||||
removeView(view);
|
||||
}
|
||||
this.b = scrollingTabContainerView;
|
||||
if (scrollingTabContainerView != null) {
|
||||
addView(scrollingTabContainerView);
|
||||
ViewGroup.LayoutParams layoutParams = scrollingTabContainerView.getLayoutParams();
|
||||
layoutParams.width = -1;
|
||||
layoutParams.height = -2;
|
||||
scrollingTabContainerView.setAllowCollapse(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTransitioning(boolean z) {
|
||||
this.a = z;
|
||||
setDescendantFocusability(z ? 393216 : 262144);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setVisibility(int i) {
|
||||
super.setVisibility(i);
|
||||
boolean z = i == 0;
|
||||
Drawable drawable = this.e;
|
||||
if (drawable != null) {
|
||||
drawable.setVisible(z, false);
|
||||
}
|
||||
Drawable drawable2 = this.f;
|
||||
if (drawable2 != null) {
|
||||
drawable2.setVisible(z, false);
|
||||
}
|
||||
Drawable drawable3 = this.g;
|
||||
if (drawable3 != null) {
|
||||
drawable3.setVisible(z, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent
|
||||
public ActionMode startActionModeForChild(View view, ActionMode.Callback callback) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent
|
||||
public ActionMode startActionModeForChild(View view, ActionMode.Callback callback, int i) {
|
||||
if (i != 0) {
|
||||
return super.startActionModeForChild(view, callback, i);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected boolean verifyDrawable(Drawable drawable) {
|
||||
return (drawable == this.e && !this.h) || (drawable == this.f && this.i) || ((drawable == this.g && this.h) || super.verifyDrawable(drawable));
|
||||
}
|
||||
|
||||
public ActionBarContainer(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
ViewCompat.a(this, new ActionBarBackgroundDrawable(this));
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.ActionBar);
|
||||
this.e = obtainStyledAttributes.getDrawable(R$styleable.ActionBar_background);
|
||||
this.f = obtainStyledAttributes.getDrawable(R$styleable.ActionBar_backgroundStacked);
|
||||
this.j = obtainStyledAttributes.getDimensionPixelSize(R$styleable.ActionBar_height, -1);
|
||||
if (getId() == R$id.split_action_bar) {
|
||||
this.h = true;
|
||||
this.g = obtainStyledAttributes.getDrawable(R$styleable.ActionBar_backgroundSplit);
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
boolean z = false;
|
||||
if (!this.h ? !(this.e != null || this.f != null) : this.g == null) {
|
||||
z = true;
|
||||
}
|
||||
setWillNotDraw(z);
|
||||
}
|
||||
}
|
||||
337
sources/androidx/appcompat/widget/ActionBarContextView.java
Normal file
337
sources/androidx/appcompat/widget/ActionBarContextView.java
Normal file
@@ -0,0 +1,337 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.appcompat.R$id;
|
||||
import androidx.appcompat.R$layout;
|
||||
import androidx.appcompat.R$styleable;
|
||||
import androidx.appcompat.view.ActionMode;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionBarContextView extends AbsActionBarView {
|
||||
private CharSequence i;
|
||||
private CharSequence j;
|
||||
private View k;
|
||||
private View l;
|
||||
private LinearLayout m;
|
||||
private TextView n;
|
||||
private TextView o;
|
||||
private int p;
|
||||
private int q;
|
||||
private boolean r;
|
||||
private int s;
|
||||
|
||||
public ActionBarContextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
private void e() {
|
||||
if (this.m == null) {
|
||||
LayoutInflater.from(getContext()).inflate(R$layout.abc_action_bar_title_item, this);
|
||||
this.m = (LinearLayout) getChildAt(getChildCount() - 1);
|
||||
this.n = (TextView) this.m.findViewById(R$id.action_bar_title);
|
||||
this.o = (TextView) this.m.findViewById(R$id.action_bar_subtitle);
|
||||
if (this.p != 0) {
|
||||
this.n.setTextAppearance(getContext(), this.p);
|
||||
}
|
||||
if (this.q != 0) {
|
||||
this.o.setTextAppearance(getContext(), this.q);
|
||||
}
|
||||
}
|
||||
this.n.setText(this.i);
|
||||
this.o.setText(this.j);
|
||||
boolean z = !TextUtils.isEmpty(this.i);
|
||||
boolean z2 = !TextUtils.isEmpty(this.j);
|
||||
int i = 0;
|
||||
this.o.setVisibility(z2 ? 0 : 8);
|
||||
LinearLayout linearLayout = this.m;
|
||||
if (!z && !z2) {
|
||||
i = 8;
|
||||
}
|
||||
linearLayout.setVisibility(i);
|
||||
if (this.m.getParent() == null) {
|
||||
addView(this.m);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return this.r;
|
||||
}
|
||||
|
||||
public void c() {
|
||||
removeAllViews();
|
||||
this.l = null;
|
||||
this.c = null;
|
||||
}
|
||||
|
||||
public boolean d() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.d;
|
||||
if (actionMenuPresenter != null) {
|
||||
return actionMenuPresenter.i();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
protected ViewGroup.LayoutParams generateDefaultLayoutParams() {
|
||||
return new ViewGroup.MarginLayoutParams(-1, -2);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
|
||||
return new ViewGroup.MarginLayoutParams(getContext(), attributeSet);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ int getAnimatedVisibility() {
|
||||
return super.getAnimatedVisibility();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ int getContentHeight() {
|
||||
return super.getContentHeight();
|
||||
}
|
||||
|
||||
public CharSequence getSubtitle() {
|
||||
return this.j;
|
||||
}
|
||||
|
||||
public CharSequence getTitle() {
|
||||
return this.i;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
ActionMenuPresenter actionMenuPresenter = this.d;
|
||||
if (actionMenuPresenter != null) {
|
||||
actionMenuPresenter.e();
|
||||
this.d.f();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
|
||||
if (accessibilityEvent.getEventType() != 32) {
|
||||
super.onInitializeAccessibilityEvent(accessibilityEvent);
|
||||
return;
|
||||
}
|
||||
accessibilityEvent.setSource(this);
|
||||
accessibilityEvent.setClassName(ActionBarContextView.class.getName());
|
||||
accessibilityEvent.setPackageName(getContext().getPackageName());
|
||||
accessibilityEvent.setContentDescription(this.i);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
int i5;
|
||||
boolean a = ViewUtils.a(this);
|
||||
int paddingRight = a ? (i3 - i) - getPaddingRight() : getPaddingLeft();
|
||||
int paddingTop = getPaddingTop();
|
||||
int paddingTop2 = ((i4 - i2) - getPaddingTop()) - getPaddingBottom();
|
||||
View view = this.k;
|
||||
if (view == null || view.getVisibility() == 8) {
|
||||
i5 = paddingRight;
|
||||
} else {
|
||||
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.k.getLayoutParams();
|
||||
int i6 = a ? marginLayoutParams.rightMargin : marginLayoutParams.leftMargin;
|
||||
int i7 = a ? marginLayoutParams.leftMargin : marginLayoutParams.rightMargin;
|
||||
int a2 = AbsActionBarView.a(paddingRight, i6, a);
|
||||
i5 = AbsActionBarView.a(a2 + a(this.k, a2, paddingTop, paddingTop2, a), i7, a);
|
||||
}
|
||||
LinearLayout linearLayout = this.m;
|
||||
if (linearLayout != null && this.l == null && linearLayout.getVisibility() != 8) {
|
||||
i5 += a(this.m, i5, paddingTop, paddingTop2, a);
|
||||
}
|
||||
int i8 = i5;
|
||||
View view2 = this.l;
|
||||
if (view2 != null) {
|
||||
a(view2, i8, paddingTop, paddingTop2, a);
|
||||
}
|
||||
int paddingLeft = a ? getPaddingLeft() : (i3 - i) - getPaddingRight();
|
||||
ActionMenuView actionMenuView = this.c;
|
||||
if (actionMenuView != null) {
|
||||
a(actionMenuView, paddingLeft, paddingTop, paddingTop2, !a);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
if (View.MeasureSpec.getMode(i) != 1073741824) {
|
||||
throw new IllegalStateException(ActionBarContextView.class.getSimpleName() + " can only be used with android:layout_width=\"match_parent\" (or fill_parent)");
|
||||
}
|
||||
if (View.MeasureSpec.getMode(i2) == 0) {
|
||||
throw new IllegalStateException(ActionBarContextView.class.getSimpleName() + " can only be used with android:layout_height=\"wrap_content\"");
|
||||
}
|
||||
int size = View.MeasureSpec.getSize(i);
|
||||
int i3 = this.e;
|
||||
if (i3 <= 0) {
|
||||
i3 = View.MeasureSpec.getSize(i2);
|
||||
}
|
||||
int paddingTop = getPaddingTop() + getPaddingBottom();
|
||||
int paddingLeft = (size - getPaddingLeft()) - getPaddingRight();
|
||||
int i4 = i3 - paddingTop;
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i4, Integer.MIN_VALUE);
|
||||
View view = this.k;
|
||||
if (view != null) {
|
||||
int a = a(view, paddingLeft, makeMeasureSpec, 0);
|
||||
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.k.getLayoutParams();
|
||||
paddingLeft = a - (marginLayoutParams.leftMargin + marginLayoutParams.rightMargin);
|
||||
}
|
||||
ActionMenuView actionMenuView = this.c;
|
||||
if (actionMenuView != null && actionMenuView.getParent() == this) {
|
||||
paddingLeft = a(this.c, paddingLeft, makeMeasureSpec, 0);
|
||||
}
|
||||
LinearLayout linearLayout = this.m;
|
||||
if (linearLayout != null && this.l == null) {
|
||||
if (this.r) {
|
||||
this.m.measure(View.MeasureSpec.makeMeasureSpec(0, 0), makeMeasureSpec);
|
||||
int measuredWidth = this.m.getMeasuredWidth();
|
||||
boolean z = measuredWidth <= paddingLeft;
|
||||
if (z) {
|
||||
paddingLeft -= measuredWidth;
|
||||
}
|
||||
this.m.setVisibility(z ? 0 : 8);
|
||||
} else {
|
||||
paddingLeft = a(linearLayout, paddingLeft, makeMeasureSpec, 0);
|
||||
}
|
||||
}
|
||||
View view2 = this.l;
|
||||
if (view2 != null) {
|
||||
ViewGroup.LayoutParams layoutParams = view2.getLayoutParams();
|
||||
int i5 = layoutParams.width != -2 ? 1073741824 : Integer.MIN_VALUE;
|
||||
int i6 = layoutParams.width;
|
||||
if (i6 >= 0) {
|
||||
paddingLeft = Math.min(i6, paddingLeft);
|
||||
}
|
||||
int i7 = layoutParams.height == -2 ? Integer.MIN_VALUE : 1073741824;
|
||||
int i8 = layoutParams.height;
|
||||
if (i8 >= 0) {
|
||||
i4 = Math.min(i8, i4);
|
||||
}
|
||||
this.l.measure(View.MeasureSpec.makeMeasureSpec(paddingLeft, i5), View.MeasureSpec.makeMeasureSpec(i4, i7));
|
||||
}
|
||||
if (this.e > 0) {
|
||||
setMeasuredDimension(size, i3);
|
||||
return;
|
||||
}
|
||||
int childCount = getChildCount();
|
||||
int i9 = 0;
|
||||
for (int i10 = 0; i10 < childCount; i10++) {
|
||||
int measuredHeight = getChildAt(i10).getMeasuredHeight() + paddingTop;
|
||||
if (measuredHeight > i9) {
|
||||
i9 = measuredHeight;
|
||||
}
|
||||
}
|
||||
setMeasuredDimension(size, i9);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public void setContentHeight(int i) {
|
||||
this.e = i;
|
||||
}
|
||||
|
||||
public void setCustomView(View view) {
|
||||
LinearLayout linearLayout;
|
||||
View view2 = this.l;
|
||||
if (view2 != null) {
|
||||
removeView(view2);
|
||||
}
|
||||
this.l = view;
|
||||
if (view != null && (linearLayout = this.m) != null) {
|
||||
removeView(linearLayout);
|
||||
this.m = null;
|
||||
}
|
||||
if (view != null) {
|
||||
addView(view);
|
||||
}
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public void setSubtitle(CharSequence charSequence) {
|
||||
this.j = charSequence;
|
||||
e();
|
||||
}
|
||||
|
||||
public void setTitle(CharSequence charSequence) {
|
||||
this.i = charSequence;
|
||||
e();
|
||||
}
|
||||
|
||||
public void setTitleOptional(boolean z) {
|
||||
if (z != this.r) {
|
||||
requestLayout();
|
||||
}
|
||||
this.r = z;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView, android.view.View
|
||||
public /* bridge */ /* synthetic */ void setVisibility(int i) {
|
||||
super.setVisibility(i);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public boolean shouldDelayChildPressedState() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ActionBarContextView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R$attr.actionModeStyle);
|
||||
}
|
||||
|
||||
public void a(final ActionMode actionMode) {
|
||||
View view = this.k;
|
||||
if (view == null) {
|
||||
this.k = LayoutInflater.from(getContext()).inflate(this.s, (ViewGroup) this, false);
|
||||
addView(this.k);
|
||||
} else if (view.getParent() == null) {
|
||||
addView(this.k);
|
||||
}
|
||||
this.k.findViewById(R$id.action_mode_close_button).setOnClickListener(new View.OnClickListener(this) { // from class: androidx.appcompat.widget.ActionBarContextView.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view2) {
|
||||
actionMode.a();
|
||||
}
|
||||
});
|
||||
MenuBuilder menuBuilder = (MenuBuilder) actionMode.c();
|
||||
ActionMenuPresenter actionMenuPresenter = this.d;
|
||||
if (actionMenuPresenter != null) {
|
||||
actionMenuPresenter.c();
|
||||
}
|
||||
this.d = new ActionMenuPresenter(getContext());
|
||||
this.d.c(true);
|
||||
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(-2, -1);
|
||||
menuBuilder.a(this.d, this.b);
|
||||
this.c = (ActionMenuView) this.d.b(this);
|
||||
ViewCompat.a(this.c, (Drawable) null);
|
||||
addView(this.c, layoutParams);
|
||||
}
|
||||
|
||||
public ActionBarContextView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
TintTypedArray a = TintTypedArray.a(context, attributeSet, R$styleable.ActionMode, i, 0);
|
||||
ViewCompat.a(this, a.b(R$styleable.ActionMode_background));
|
||||
this.p = a.g(R$styleable.ActionMode_titleTextStyle, 0);
|
||||
this.q = a.g(R$styleable.ActionMode_subtitleTextStyle, 0);
|
||||
this.e = a.f(R$styleable.ActionMode_height, 0);
|
||||
this.s = a.g(R$styleable.ActionMode_closeItemLayout, R$layout.abc_action_mode_close_item_material);
|
||||
a.a();
|
||||
}
|
||||
|
||||
public void a() {
|
||||
if (this.k == null) {
|
||||
c();
|
||||
}
|
||||
}
|
||||
}
|
||||
634
sources/androidx/appcompat/widget/ActionBarOverlayLayout.java
Normal file
634
sources/androidx/appcompat/widget/ActionBarOverlayLayout.java
Normal file
@@ -0,0 +1,634 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewPropertyAnimator;
|
||||
import android.view.Window;
|
||||
import android.widget.OverScroller;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.appcompat.R$id;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.core.view.NestedScrollingParent;
|
||||
import androidx.core.view.NestedScrollingParentHelper;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionBarOverlayLayout extends ViewGroup implements DecorContentParent, NestedScrollingParent {
|
||||
static final int[] C = {R$attr.actionBarSize, R.attr.windowContentOverlay};
|
||||
private final Runnable A;
|
||||
private final NestedScrollingParentHelper B;
|
||||
private int a;
|
||||
private int b;
|
||||
private ContentFrameLayout c;
|
||||
ActionBarContainer d;
|
||||
private DecorToolbar e;
|
||||
private Drawable f;
|
||||
private boolean g;
|
||||
private boolean h;
|
||||
private boolean i;
|
||||
private boolean j;
|
||||
boolean k;
|
||||
private int l;
|
||||
private int m;
|
||||
private final Rect n;
|
||||
private final Rect o;
|
||||
private final Rect p;
|
||||
private final Rect q;
|
||||
private final Rect r;
|
||||
private final Rect s;
|
||||
private final Rect t;
|
||||
private ActionBarVisibilityCallback u;
|
||||
private OverScroller v;
|
||||
ViewPropertyAnimator x;
|
||||
final AnimatorListenerAdapter y;
|
||||
private final Runnable z;
|
||||
|
||||
public interface ActionBarVisibilityCallback {
|
||||
void a();
|
||||
|
||||
void a(int i);
|
||||
|
||||
void a(boolean z);
|
||||
|
||||
void b();
|
||||
|
||||
void c();
|
||||
|
||||
void d();
|
||||
}
|
||||
|
||||
public static class LayoutParams extends ViewGroup.MarginLayoutParams {
|
||||
public LayoutParams(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
public LayoutParams(int i, int i2) {
|
||||
super(i, i2);
|
||||
}
|
||||
|
||||
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
super(layoutParams);
|
||||
}
|
||||
}
|
||||
|
||||
public ActionBarOverlayLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
private void a(Context context) {
|
||||
TypedArray obtainStyledAttributes = getContext().getTheme().obtainStyledAttributes(C);
|
||||
this.a = obtainStyledAttributes.getDimensionPixelSize(0, 0);
|
||||
this.f = obtainStyledAttributes.getDrawable(1);
|
||||
setWillNotDraw(this.f == null);
|
||||
obtainStyledAttributes.recycle();
|
||||
this.g = context.getApplicationInfo().targetSdkVersion < 19;
|
||||
this.v = new OverScroller(context);
|
||||
}
|
||||
|
||||
private void k() {
|
||||
b();
|
||||
this.A.run();
|
||||
}
|
||||
|
||||
private void l() {
|
||||
b();
|
||||
postDelayed(this.A, 600L);
|
||||
}
|
||||
|
||||
private void m() {
|
||||
b();
|
||||
postDelayed(this.z, 600L);
|
||||
}
|
||||
|
||||
private void n() {
|
||||
b();
|
||||
this.z.run();
|
||||
}
|
||||
|
||||
void b() {
|
||||
removeCallbacks(this.z);
|
||||
removeCallbacks(this.A);
|
||||
ViewPropertyAnimator viewPropertyAnimator = this.x;
|
||||
if (viewPropertyAnimator != null) {
|
||||
viewPropertyAnimator.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void c() {
|
||||
j();
|
||||
this.e.c();
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
return layoutParams instanceof LayoutParams;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean d() {
|
||||
j();
|
||||
return this.e.d();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void draw(Canvas canvas) {
|
||||
super.draw(canvas);
|
||||
if (this.f == null || this.g) {
|
||||
return;
|
||||
}
|
||||
int bottom = this.d.getVisibility() == 0 ? (int) (this.d.getBottom() + this.d.getTranslationY() + 0.5f) : 0;
|
||||
this.f.setBounds(0, bottom, getWidth(), this.f.getIntrinsicHeight() + bottom);
|
||||
this.f.draw(canvas);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean e() {
|
||||
j();
|
||||
return this.e.e();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean f() {
|
||||
j();
|
||||
return this.e.f();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected boolean fitSystemWindows(Rect rect) {
|
||||
j();
|
||||
int q = ViewCompat.q(this) & DataDecryptTool.DECRYPT_ALL_FILE;
|
||||
boolean a = a(this.d, rect, true, true, false, true);
|
||||
this.q.set(rect);
|
||||
ViewUtils.a(this, this.q, this.n);
|
||||
if (!this.r.equals(this.q)) {
|
||||
this.r.set(this.q);
|
||||
a = true;
|
||||
}
|
||||
if (!this.o.equals(this.n)) {
|
||||
this.o.set(this.n);
|
||||
a = true;
|
||||
}
|
||||
if (a) {
|
||||
requestLayout();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean g() {
|
||||
j();
|
||||
return this.e.g();
|
||||
}
|
||||
|
||||
public int getActionBarHideOffset() {
|
||||
ActionBarContainer actionBarContainer = this.d;
|
||||
if (actionBarContainer != null) {
|
||||
return -((int) actionBarContainer.getTranslationY());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public int getNestedScrollAxes() {
|
||||
return this.B.a();
|
||||
}
|
||||
|
||||
public CharSequence getTitle() {
|
||||
j();
|
||||
return this.e.getTitle();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void h() {
|
||||
j();
|
||||
this.e.h();
|
||||
}
|
||||
|
||||
public boolean i() {
|
||||
return this.h;
|
||||
}
|
||||
|
||||
void j() {
|
||||
if (this.c == null) {
|
||||
this.c = (ContentFrameLayout) findViewById(R$id.action_bar_activity_content);
|
||||
this.d = (ActionBarContainer) findViewById(R$id.action_bar_container);
|
||||
this.e = a(findViewById(R$id.action_bar));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onConfigurationChanged(Configuration configuration) {
|
||||
super.onConfigurationChanged(configuration);
|
||||
a(getContext());
|
||||
ViewCompat.B(this);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
b();
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
int childCount = getChildCount();
|
||||
int paddingLeft = getPaddingLeft();
|
||||
getPaddingRight();
|
||||
int paddingTop = getPaddingTop();
|
||||
getPaddingBottom();
|
||||
for (int i5 = 0; i5 < childCount; i5++) {
|
||||
View childAt = getChildAt(i5);
|
||||
if (childAt.getVisibility() != 8) {
|
||||
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
||||
int measuredWidth = childAt.getMeasuredWidth();
|
||||
int measuredHeight = childAt.getMeasuredHeight();
|
||||
int i6 = ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin + paddingLeft;
|
||||
int i7 = ((ViewGroup.MarginLayoutParams) layoutParams).topMargin + paddingTop;
|
||||
childAt.layout(i6, i7, measuredWidth + i6, measuredHeight + i7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
int measuredHeight;
|
||||
j();
|
||||
measureChildWithMargins(this.d, i, 0, i2, 0);
|
||||
LayoutParams layoutParams = (LayoutParams) this.d.getLayoutParams();
|
||||
int max = Math.max(0, this.d.getMeasuredWidth() + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin);
|
||||
int max2 = Math.max(0, this.d.getMeasuredHeight() + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin);
|
||||
int combineMeasuredStates = View.combineMeasuredStates(0, this.d.getMeasuredState());
|
||||
boolean z = (ViewCompat.q(this) & DataDecryptTool.DECRYPT_ALL_FILE) != 0;
|
||||
if (z) {
|
||||
measuredHeight = this.a;
|
||||
if (this.i && this.d.getTabContainer() != null) {
|
||||
measuredHeight += this.a;
|
||||
}
|
||||
} else {
|
||||
measuredHeight = this.d.getVisibility() != 8 ? this.d.getMeasuredHeight() : 0;
|
||||
}
|
||||
this.p.set(this.n);
|
||||
this.s.set(this.q);
|
||||
if (this.h || z) {
|
||||
Rect rect = this.s;
|
||||
rect.top += measuredHeight;
|
||||
rect.bottom += 0;
|
||||
} else {
|
||||
Rect rect2 = this.p;
|
||||
rect2.top += measuredHeight;
|
||||
rect2.bottom += 0;
|
||||
}
|
||||
a(this.c, this.p, true, true, true, true);
|
||||
if (!this.t.equals(this.s)) {
|
||||
this.t.set(this.s);
|
||||
this.c.a(this.s);
|
||||
}
|
||||
measureChildWithMargins(this.c, i, 0, i2, 0);
|
||||
LayoutParams layoutParams2 = (LayoutParams) this.c.getLayoutParams();
|
||||
int max3 = Math.max(max, this.c.getMeasuredWidth() + ((ViewGroup.MarginLayoutParams) layoutParams2).leftMargin + ((ViewGroup.MarginLayoutParams) layoutParams2).rightMargin);
|
||||
int max4 = Math.max(max2, this.c.getMeasuredHeight() + ((ViewGroup.MarginLayoutParams) layoutParams2).topMargin + ((ViewGroup.MarginLayoutParams) layoutParams2).bottomMargin);
|
||||
int combineMeasuredStates2 = View.combineMeasuredStates(combineMeasuredStates, this.c.getMeasuredState());
|
||||
setMeasuredDimension(View.resolveSizeAndState(Math.max(max3 + getPaddingLeft() + getPaddingRight(), getSuggestedMinimumWidth()), i, combineMeasuredStates2), View.resolveSizeAndState(Math.max(max4 + getPaddingTop() + getPaddingBottom(), getSuggestedMinimumHeight()), i2, combineMeasuredStates2 << 16));
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public boolean onNestedFling(View view, float f, float f2, boolean z) {
|
||||
if (!this.j || !z) {
|
||||
return false;
|
||||
}
|
||||
if (a(f, f2)) {
|
||||
k();
|
||||
} else {
|
||||
n();
|
||||
}
|
||||
this.k = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public boolean onNestedPreFling(View view, float f, float f2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public void onNestedPreScroll(View view, int i, int i2, int[] iArr) {
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public void onNestedScroll(View view, int i, int i2, int i3, int i4) {
|
||||
this.l += i2;
|
||||
setActionBarHideOffset(this.l);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public void onNestedScrollAccepted(View view, View view2, int i) {
|
||||
this.B.a(view, view2, i);
|
||||
this.l = getActionBarHideOffset();
|
||||
b();
|
||||
ActionBarVisibilityCallback actionBarVisibilityCallback = this.u;
|
||||
if (actionBarVisibilityCallback != null) {
|
||||
actionBarVisibilityCallback.d();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public boolean onStartNestedScroll(View view, View view2, int i) {
|
||||
if ((i & 2) == 0 || this.d.getVisibility() != 0) {
|
||||
return false;
|
||||
}
|
||||
return this.j;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public void onStopNestedScroll(View view) {
|
||||
if (this.j && !this.k) {
|
||||
if (this.l <= this.d.getHeight()) {
|
||||
m();
|
||||
} else {
|
||||
l();
|
||||
}
|
||||
}
|
||||
ActionBarVisibilityCallback actionBarVisibilityCallback = this.u;
|
||||
if (actionBarVisibilityCallback != null) {
|
||||
actionBarVisibilityCallback.b();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onWindowSystemUiVisibilityChanged(int i) {
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
super.onWindowSystemUiVisibilityChanged(i);
|
||||
}
|
||||
j();
|
||||
int i2 = this.m ^ i;
|
||||
this.m = i;
|
||||
boolean z = (i & 4) == 0;
|
||||
boolean z2 = (i & DataDecryptTool.DECRYPT_ALL_FILE) != 0;
|
||||
ActionBarVisibilityCallback actionBarVisibilityCallback = this.u;
|
||||
if (actionBarVisibilityCallback != null) {
|
||||
actionBarVisibilityCallback.a(!z2);
|
||||
if (z || !z2) {
|
||||
this.u.a();
|
||||
} else {
|
||||
this.u.c();
|
||||
}
|
||||
}
|
||||
if ((i2 & DataDecryptTool.DECRYPT_ALL_FILE) == 0 || this.u == null) {
|
||||
return;
|
||||
}
|
||||
ViewCompat.B(this);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onWindowVisibilityChanged(int i) {
|
||||
super.onWindowVisibilityChanged(i);
|
||||
this.b = i;
|
||||
ActionBarVisibilityCallback actionBarVisibilityCallback = this.u;
|
||||
if (actionBarVisibilityCallback != null) {
|
||||
actionBarVisibilityCallback.a(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void setActionBarHideOffset(int i) {
|
||||
b();
|
||||
this.d.setTranslationY(-Math.max(0, Math.min(i, this.d.getHeight())));
|
||||
}
|
||||
|
||||
public void setActionBarVisibilityCallback(ActionBarVisibilityCallback actionBarVisibilityCallback) {
|
||||
this.u = actionBarVisibilityCallback;
|
||||
if (getWindowToken() != null) {
|
||||
this.u.a(this.b);
|
||||
int i = this.m;
|
||||
if (i != 0) {
|
||||
onWindowSystemUiVisibilityChanged(i);
|
||||
ViewCompat.B(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setHasNonEmbeddedTabs(boolean z) {
|
||||
this.i = z;
|
||||
}
|
||||
|
||||
public void setHideOnContentScrollEnabled(boolean z) {
|
||||
if (z != this.j) {
|
||||
this.j = z;
|
||||
if (z) {
|
||||
return;
|
||||
}
|
||||
b();
|
||||
setActionBarHideOffset(0);
|
||||
}
|
||||
}
|
||||
|
||||
public void setIcon(int i) {
|
||||
j();
|
||||
this.e.setIcon(i);
|
||||
}
|
||||
|
||||
public void setLogo(int i) {
|
||||
j();
|
||||
this.e.b(i);
|
||||
}
|
||||
|
||||
public void setOverlayMode(boolean z) {
|
||||
this.h = z;
|
||||
this.g = z && getContext().getApplicationInfo().targetSdkVersion < 19;
|
||||
}
|
||||
|
||||
public void setShowingForActionMode(boolean z) {
|
||||
}
|
||||
|
||||
public void setUiOptions(int i) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setWindowCallback(Window.Callback callback) {
|
||||
j();
|
||||
this.e.setWindowCallback(callback);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setWindowTitle(CharSequence charSequence) {
|
||||
j();
|
||||
this.e.setWindowTitle(charSequence);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public boolean shouldDelayChildPressedState() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ActionBarOverlayLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.b = 0;
|
||||
this.n = new Rect();
|
||||
this.o = new Rect();
|
||||
this.p = new Rect();
|
||||
this.q = new Rect();
|
||||
this.r = new Rect();
|
||||
this.s = new Rect();
|
||||
this.t = new Rect();
|
||||
this.y = new AnimatorListenerAdapter() { // from class: androidx.appcompat.widget.ActionBarOverlayLayout.1
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationCancel(Animator animator) {
|
||||
ActionBarOverlayLayout actionBarOverlayLayout = ActionBarOverlayLayout.this;
|
||||
actionBarOverlayLayout.x = null;
|
||||
actionBarOverlayLayout.k = false;
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
ActionBarOverlayLayout actionBarOverlayLayout = ActionBarOverlayLayout.this;
|
||||
actionBarOverlayLayout.x = null;
|
||||
actionBarOverlayLayout.k = false;
|
||||
}
|
||||
};
|
||||
this.z = new Runnable() { // from class: androidx.appcompat.widget.ActionBarOverlayLayout.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ActionBarOverlayLayout.this.b();
|
||||
ActionBarOverlayLayout actionBarOverlayLayout = ActionBarOverlayLayout.this;
|
||||
actionBarOverlayLayout.x = actionBarOverlayLayout.d.animate().translationY(0.0f).setListener(ActionBarOverlayLayout.this.y);
|
||||
}
|
||||
};
|
||||
this.A = new Runnable() { // from class: androidx.appcompat.widget.ActionBarOverlayLayout.3
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ActionBarOverlayLayout.this.b();
|
||||
ActionBarOverlayLayout actionBarOverlayLayout = ActionBarOverlayLayout.this;
|
||||
actionBarOverlayLayout.x = actionBarOverlayLayout.d.animate().translationY(-ActionBarOverlayLayout.this.d.getHeight()).setListener(ActionBarOverlayLayout.this.y);
|
||||
}
|
||||
};
|
||||
a(context);
|
||||
this.B = new NestedScrollingParentHelper(this);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // android.view.ViewGroup
|
||||
public LayoutParams generateDefaultLayoutParams() {
|
||||
return new LayoutParams(-1, -1);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public LayoutParams generateLayoutParams(AttributeSet attributeSet) {
|
||||
return new LayoutParams(getContext(), attributeSet);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
return new LayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
public void setIcon(Drawable drawable) {
|
||||
j();
|
||||
this.e.setIcon(drawable);
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:11:0x0021 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:15:0x002c */
|
||||
/* JADX WARN: Removed duplicated region for block: B:21:? A[RETURN, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:7:0x0016 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private boolean a(android.view.View r3, android.graphics.Rect r4, boolean r5, boolean r6, boolean r7, boolean r8) {
|
||||
/*
|
||||
r2 = this;
|
||||
android.view.ViewGroup$LayoutParams r3 = r3.getLayoutParams()
|
||||
androidx.appcompat.widget.ActionBarOverlayLayout$LayoutParams r3 = (androidx.appcompat.widget.ActionBarOverlayLayout.LayoutParams) r3
|
||||
r0 = 1
|
||||
if (r5 == 0) goto L13
|
||||
int r5 = r3.leftMargin
|
||||
int r1 = r4.left
|
||||
if (r5 == r1) goto L13
|
||||
r3.leftMargin = r1
|
||||
r5 = 1
|
||||
goto L14
|
||||
L13:
|
||||
r5 = 0
|
||||
L14:
|
||||
if (r6 == 0) goto L1f
|
||||
int r6 = r3.topMargin
|
||||
int r1 = r4.top
|
||||
if (r6 == r1) goto L1f
|
||||
r3.topMargin = r1
|
||||
r5 = 1
|
||||
L1f:
|
||||
if (r8 == 0) goto L2a
|
||||
int r6 = r3.rightMargin
|
||||
int r8 = r4.right
|
||||
if (r6 == r8) goto L2a
|
||||
r3.rightMargin = r8
|
||||
r5 = 1
|
||||
L2a:
|
||||
if (r7 == 0) goto L35
|
||||
int r6 = r3.bottomMargin
|
||||
int r4 = r4.bottom
|
||||
if (r6 == r4) goto L35
|
||||
r3.bottomMargin = r4
|
||||
r5 = 1
|
||||
L35:
|
||||
return r5
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ActionBarOverlayLayout.a(android.view.View, android.graphics.Rect, boolean, boolean, boolean, boolean):boolean");
|
||||
}
|
||||
|
||||
/* 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();
|
||||
}
|
||||
throw new IllegalStateException("Can't make a decor toolbar out of " + view.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
private boolean a(float f, float f2) {
|
||||
this.v.fling(0, 0, 0, (int) f2, 0, 0, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
return this.v.getFinalY() > this.d.getHeight();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void a(int i) {
|
||||
j();
|
||||
if (i == 2) {
|
||||
this.e.n();
|
||||
} else if (i == 5) {
|
||||
this.e.o();
|
||||
} else {
|
||||
if (i != 109) {
|
||||
return;
|
||||
}
|
||||
setOverlayMode(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean a() {
|
||||
j();
|
||||
return this.e.a();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void a(Menu menu, MenuPresenter.Callback callback) {
|
||||
j();
|
||||
this.e.a(menu, callback);
|
||||
}
|
||||
}
|
||||
693
sources/androidx/appcompat/widget/ActionMenuPresenter.java
Normal file
693
sources/androidx/appcompat/widget/ActionMenuPresenter.java
Normal file
@@ -0,0 +1,693 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.SparseBooleanArray;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.appcompat.R$layout;
|
||||
import androidx.appcompat.view.ActionBarPolicy;
|
||||
import androidx.appcompat.view.menu.ActionMenuItemView;
|
||||
import androidx.appcompat.view.menu.BaseMenuPresenter;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
import androidx.appcompat.view.menu.MenuItemImpl;
|
||||
import androidx.appcompat.view.menu.MenuPopupHelper;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.appcompat.view.menu.MenuView;
|
||||
import androidx.appcompat.view.menu.ShowableListMenu;
|
||||
import androidx.appcompat.view.menu.SubMenuBuilder;
|
||||
import androidx.appcompat.widget.ActionMenuView;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.view.ActionProvider;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ActionMenuPresenter extends BaseMenuPresenter implements ActionProvider.SubUiVisibilityListener {
|
||||
OpenOverflowRunnable A;
|
||||
private ActionMenuPopupCallback B;
|
||||
final PopupPresenterCallback C;
|
||||
int D;
|
||||
OverflowMenuButton i;
|
||||
private Drawable j;
|
||||
private boolean k;
|
||||
private boolean l;
|
||||
private boolean m;
|
||||
private int n;
|
||||
private int o;
|
||||
private int p;
|
||||
private boolean q;
|
||||
private boolean r;
|
||||
private boolean s;
|
||||
private boolean t;
|
||||
private int u;
|
||||
private final SparseBooleanArray v;
|
||||
private View x;
|
||||
OverflowPopup y;
|
||||
ActionButtonSubmenu z;
|
||||
|
||||
private class ActionButtonSubmenu extends MenuPopupHelper {
|
||||
public ActionButtonSubmenu(Context context, SubMenuBuilder subMenuBuilder, View view) {
|
||||
super(context, subMenuBuilder, view, false, R$attr.actionOverflowMenuStyle);
|
||||
if (!((MenuItemImpl) subMenuBuilder.getItem()).h()) {
|
||||
View view2 = ActionMenuPresenter.this.i;
|
||||
a(view2 == null ? (View) ((BaseMenuPresenter) ActionMenuPresenter.this).h : view2);
|
||||
}
|
||||
a(ActionMenuPresenter.this.C);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopupHelper
|
||||
protected void d() {
|
||||
ActionMenuPresenter actionMenuPresenter = ActionMenuPresenter.this;
|
||||
actionMenuPresenter.z = null;
|
||||
actionMenuPresenter.D = 0;
|
||||
super.d();
|
||||
}
|
||||
}
|
||||
|
||||
private class ActionMenuPopupCallback extends ActionMenuItemView.PopupCallback {
|
||||
ActionMenuPopupCallback() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ActionMenuItemView.PopupCallback
|
||||
public ShowableListMenu a() {
|
||||
ActionButtonSubmenu actionButtonSubmenu = ActionMenuPresenter.this.z;
|
||||
if (actionButtonSubmenu != null) {
|
||||
return actionButtonSubmenu.b();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private class OpenOverflowRunnable implements Runnable {
|
||||
private OverflowPopup a;
|
||||
|
||||
public OpenOverflowRunnable(OverflowPopup overflowPopup) {
|
||||
this.a = overflowPopup;
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
if (((BaseMenuPresenter) ActionMenuPresenter.this).c != null) {
|
||||
((BaseMenuPresenter) ActionMenuPresenter.this).c.a();
|
||||
}
|
||||
View view = (View) ((BaseMenuPresenter) ActionMenuPresenter.this).h;
|
||||
if (view != null && view.getWindowToken() != null && this.a.f()) {
|
||||
ActionMenuPresenter.this.y = this.a;
|
||||
}
|
||||
ActionMenuPresenter.this.A = null;
|
||||
}
|
||||
}
|
||||
|
||||
private class OverflowMenuButton extends AppCompatImageView implements ActionMenuView.ActionMenuChildView {
|
||||
public OverflowMenuButton(Context context) {
|
||||
super(context, null, R$attr.actionOverflowButtonStyle);
|
||||
setClickable(true);
|
||||
setFocusable(true);
|
||||
setVisibility(0);
|
||||
setEnabled(true);
|
||||
TooltipCompat.a(this, getContentDescription());
|
||||
setOnTouchListener(new ForwardingListener(this, ActionMenuPresenter.this) { // from class: androidx.appcompat.widget.ActionMenuPresenter.OverflowMenuButton.1
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
public ShowableListMenu a() {
|
||||
OverflowPopup overflowPopup = ActionMenuPresenter.this.y;
|
||||
if (overflowPopup == null) {
|
||||
return null;
|
||||
}
|
||||
return overflowPopup.b();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
public boolean b() {
|
||||
ActionMenuPresenter.this.i();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
public boolean c() {
|
||||
ActionMenuPresenter actionMenuPresenter = ActionMenuPresenter.this;
|
||||
if (actionMenuPresenter.A != null) {
|
||||
return false;
|
||||
}
|
||||
actionMenuPresenter.e();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ActionMenuView.ActionMenuChildView
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ActionMenuView.ActionMenuChildView
|
||||
public boolean c() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean performClick() {
|
||||
if (super.performClick()) {
|
||||
return true;
|
||||
}
|
||||
playSoundEffect(0);
|
||||
ActionMenuPresenter.this.i();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
protected boolean setFrame(int i, int i2, int i3, int i4) {
|
||||
boolean frame = super.setFrame(i, i2, i3, i4);
|
||||
Drawable drawable = getDrawable();
|
||||
Drawable background = getBackground();
|
||||
if (drawable != null && background != null) {
|
||||
int width = getWidth();
|
||||
int height = getHeight();
|
||||
int max = Math.max(width, height) / 2;
|
||||
int paddingLeft = (width + (getPaddingLeft() - getPaddingRight())) / 2;
|
||||
int paddingTop = (height + (getPaddingTop() - getPaddingBottom())) / 2;
|
||||
DrawableCompat.a(background, paddingLeft - max, paddingTop - max, paddingLeft + max, paddingTop + max);
|
||||
}
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
private class OverflowPopup extends MenuPopupHelper {
|
||||
public OverflowPopup(Context context, MenuBuilder menuBuilder, View view, boolean z) {
|
||||
super(context, menuBuilder, view, z, R$attr.actionOverflowMenuStyle);
|
||||
a(8388613);
|
||||
a(ActionMenuPresenter.this.C);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopupHelper
|
||||
protected void d() {
|
||||
if (((BaseMenuPresenter) ActionMenuPresenter.this).c != null) {
|
||||
((BaseMenuPresenter) ActionMenuPresenter.this).c.close();
|
||||
}
|
||||
ActionMenuPresenter.this.y = null;
|
||||
super.d();
|
||||
}
|
||||
}
|
||||
|
||||
private static class SavedState implements Parcelable {
|
||||
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() { // from class: androidx.appcompat.widget.ActionMenuPresenter.SavedState.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public SavedState createFromParcel(Parcel parcel) {
|
||||
return new SavedState(parcel);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public SavedState[] newArray(int i) {
|
||||
return new SavedState[i];
|
||||
}
|
||||
};
|
||||
public int openSubMenuId;
|
||||
|
||||
SavedState() {
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeInt(this.openSubMenuId);
|
||||
}
|
||||
|
||||
SavedState(Parcel parcel) {
|
||||
this.openSubMenuId = parcel.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
public ActionMenuPresenter(Context context) {
|
||||
super(context, R$layout.abc_action_menu_layout, R$layout.abc_action_menu_item_layout);
|
||||
this.v = new SparseBooleanArray();
|
||||
this.C = new PopupPresenterCallback();
|
||||
}
|
||||
|
||||
public boolean g() {
|
||||
return this.A != null || h();
|
||||
}
|
||||
|
||||
public boolean h() {
|
||||
OverflowPopup overflowPopup = this.y;
|
||||
return overflowPopup != null && overflowPopup.c();
|
||||
}
|
||||
|
||||
public boolean i() {
|
||||
MenuBuilder menuBuilder;
|
||||
if (!this.l || h() || (menuBuilder = this.c) == null || this.h == null || this.A != null || menuBuilder.j().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
this.A = new OpenOverflowRunnable(new OverflowPopup(this.b, this.c, this.i, true));
|
||||
((View) this.h).post(this.A);
|
||||
super.a((SubMenuBuilder) null);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
||||
public void a(Context context, MenuBuilder menuBuilder) {
|
||||
super.a(context, menuBuilder);
|
||||
Resources resources = context.getResources();
|
||||
ActionBarPolicy a = ActionBarPolicy.a(context);
|
||||
if (!this.m) {
|
||||
this.l = a.g();
|
||||
}
|
||||
if (!this.s) {
|
||||
this.n = a.b();
|
||||
}
|
||||
if (!this.q) {
|
||||
this.p = a.c();
|
||||
}
|
||||
int i = this.n;
|
||||
if (this.l) {
|
||||
if (this.i == null) {
|
||||
this.i = new OverflowMenuButton(this.a);
|
||||
if (this.k) {
|
||||
this.i.setImageDrawable(this.j);
|
||||
this.j = null;
|
||||
this.k = false;
|
||||
}
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
|
||||
this.i.measure(makeMeasureSpec, makeMeasureSpec);
|
||||
}
|
||||
i -= this.i.getMeasuredWidth();
|
||||
} else {
|
||||
this.i = null;
|
||||
}
|
||||
this.o = i;
|
||||
this.u = (int) (resources.getDisplayMetrics().density * 56.0f);
|
||||
this.x = null;
|
||||
}
|
||||
|
||||
public void b(boolean z) {
|
||||
this.t = z;
|
||||
}
|
||||
|
||||
public void c(boolean z) {
|
||||
this.l = z;
|
||||
this.m = true;
|
||||
}
|
||||
|
||||
public Drawable d() {
|
||||
OverflowMenuButton overflowMenuButton = this.i;
|
||||
if (overflowMenuButton != null) {
|
||||
return overflowMenuButton.getDrawable();
|
||||
}
|
||||
if (this.k) {
|
||||
return this.j;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean e() {
|
||||
Object obj;
|
||||
OpenOverflowRunnable openOverflowRunnable = this.A;
|
||||
if (openOverflowRunnable != null && (obj = this.h) != null) {
|
||||
((View) obj).removeCallbacks(openOverflowRunnable);
|
||||
this.A = null;
|
||||
return true;
|
||||
}
|
||||
OverflowPopup overflowPopup = this.y;
|
||||
if (overflowPopup == null) {
|
||||
return false;
|
||||
}
|
||||
overflowPopup.a();
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean f() {
|
||||
ActionButtonSubmenu actionButtonSubmenu = this.z;
|
||||
if (actionButtonSubmenu == null) {
|
||||
return false;
|
||||
}
|
||||
actionButtonSubmenu.a();
|
||||
return true;
|
||||
}
|
||||
|
||||
private class PopupPresenterCallback implements MenuPresenter.Callback {
|
||||
PopupPresenterCallback() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
||||
public boolean a(MenuBuilder menuBuilder) {
|
||||
if (menuBuilder == null) {
|
||||
return false;
|
||||
}
|
||||
ActionMenuPresenter.this.D = ((SubMenuBuilder) menuBuilder).getItem().getItemId();
|
||||
MenuPresenter.Callback a = ActionMenuPresenter.this.a();
|
||||
if (a != null) {
|
||||
return a.a(menuBuilder);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
||||
public void a(MenuBuilder menuBuilder, boolean z) {
|
||||
if (menuBuilder instanceof SubMenuBuilder) {
|
||||
menuBuilder.m().a(false);
|
||||
}
|
||||
MenuPresenter.Callback a = ActionMenuPresenter.this.a();
|
||||
if (a != null) {
|
||||
a.a(menuBuilder, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
||||
public MenuView b(ViewGroup viewGroup) {
|
||||
MenuView menuView = this.h;
|
||||
MenuView b = super.b(viewGroup);
|
||||
if (menuView != b) {
|
||||
((ActionMenuView) b).setPresenter(this);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
return e() | f();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean b() {
|
||||
ArrayList<MenuItemImpl> arrayList;
|
||||
int i;
|
||||
int i2;
|
||||
int i3;
|
||||
int i4;
|
||||
ActionMenuPresenter actionMenuPresenter = this;
|
||||
MenuBuilder menuBuilder = actionMenuPresenter.c;
|
||||
int i5 = 0;
|
||||
if (menuBuilder != null) {
|
||||
arrayList = menuBuilder.n();
|
||||
i = arrayList.size();
|
||||
} else {
|
||||
arrayList = null;
|
||||
i = 0;
|
||||
}
|
||||
int i6 = actionMenuPresenter.p;
|
||||
int i7 = actionMenuPresenter.o;
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
|
||||
ViewGroup viewGroup = (ViewGroup) actionMenuPresenter.h;
|
||||
int i8 = i6;
|
||||
boolean z = false;
|
||||
int i9 = 0;
|
||||
int i10 = 0;
|
||||
for (int i11 = 0; i11 < i; i11++) {
|
||||
MenuItemImpl menuItemImpl = arrayList.get(i11);
|
||||
if (menuItemImpl.k()) {
|
||||
i9++;
|
||||
} else if (menuItemImpl.j()) {
|
||||
i10++;
|
||||
} else {
|
||||
z = true;
|
||||
}
|
||||
if (actionMenuPresenter.t && menuItemImpl.isActionViewExpanded()) {
|
||||
i8 = 0;
|
||||
}
|
||||
}
|
||||
if (actionMenuPresenter.l && (z || i10 + i9 > i8)) {
|
||||
i8--;
|
||||
}
|
||||
int i12 = i8 - i9;
|
||||
SparseBooleanArray sparseBooleanArray = actionMenuPresenter.v;
|
||||
sparseBooleanArray.clear();
|
||||
if (actionMenuPresenter.r) {
|
||||
int i13 = actionMenuPresenter.u;
|
||||
i3 = i7 / i13;
|
||||
i2 = i13 + ((i7 % i13) / i3);
|
||||
} else {
|
||||
i2 = 0;
|
||||
i3 = 0;
|
||||
}
|
||||
int i14 = i7;
|
||||
int i15 = 0;
|
||||
int i16 = 0;
|
||||
while (i15 < i) {
|
||||
MenuItemImpl menuItemImpl2 = arrayList.get(i15);
|
||||
if (menuItemImpl2.k()) {
|
||||
View a = actionMenuPresenter.a(menuItemImpl2, actionMenuPresenter.x, viewGroup);
|
||||
if (actionMenuPresenter.x == null) {
|
||||
actionMenuPresenter.x = a;
|
||||
}
|
||||
if (actionMenuPresenter.r) {
|
||||
i3 -= ActionMenuView.a(a, i2, i3, makeMeasureSpec, i5);
|
||||
} else {
|
||||
a.measure(makeMeasureSpec, makeMeasureSpec);
|
||||
}
|
||||
int measuredWidth = a.getMeasuredWidth();
|
||||
i14 -= measuredWidth;
|
||||
if (i16 != 0) {
|
||||
measuredWidth = i16;
|
||||
}
|
||||
int groupId = menuItemImpl2.getGroupId();
|
||||
if (groupId != 0) {
|
||||
sparseBooleanArray.put(groupId, true);
|
||||
}
|
||||
menuItemImpl2.d(true);
|
||||
i4 = i;
|
||||
i16 = measuredWidth;
|
||||
} else if (menuItemImpl2.j()) {
|
||||
int groupId2 = menuItemImpl2.getGroupId();
|
||||
boolean z2 = sparseBooleanArray.get(groupId2);
|
||||
boolean z3 = (i12 > 0 || z2) && i14 > 0 && (!actionMenuPresenter.r || i3 > 0);
|
||||
boolean z4 = z3;
|
||||
if (z3) {
|
||||
View a2 = actionMenuPresenter.a(menuItemImpl2, actionMenuPresenter.x, viewGroup);
|
||||
i4 = i;
|
||||
if (actionMenuPresenter.x == null) {
|
||||
actionMenuPresenter.x = a2;
|
||||
}
|
||||
if (actionMenuPresenter.r) {
|
||||
int a3 = ActionMenuView.a(a2, i2, i3, makeMeasureSpec, 0);
|
||||
i3 -= a3;
|
||||
if (a3 == 0) {
|
||||
z4 = false;
|
||||
}
|
||||
} else {
|
||||
a2.measure(makeMeasureSpec, makeMeasureSpec);
|
||||
}
|
||||
int measuredWidth2 = a2.getMeasuredWidth();
|
||||
i14 -= measuredWidth2;
|
||||
if (i16 == 0) {
|
||||
i16 = measuredWidth2;
|
||||
}
|
||||
z3 = z4 & (!actionMenuPresenter.r ? i14 + i16 <= 0 : i14 < 0);
|
||||
} else {
|
||||
i4 = i;
|
||||
}
|
||||
if (z3 && groupId2 != 0) {
|
||||
sparseBooleanArray.put(groupId2, true);
|
||||
} else if (z2) {
|
||||
sparseBooleanArray.put(groupId2, false);
|
||||
for (int i17 = 0; i17 < i15; i17++) {
|
||||
MenuItemImpl menuItemImpl3 = arrayList.get(i17);
|
||||
if (menuItemImpl3.getGroupId() == groupId2) {
|
||||
if (menuItemImpl3.h()) {
|
||||
i12++;
|
||||
}
|
||||
menuItemImpl3.d(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (z3) {
|
||||
i12--;
|
||||
}
|
||||
menuItemImpl2.d(z3);
|
||||
} else {
|
||||
i4 = i;
|
||||
menuItemImpl2.d(false);
|
||||
i15++;
|
||||
i5 = 0;
|
||||
actionMenuPresenter = this;
|
||||
i = i4;
|
||||
}
|
||||
i15++;
|
||||
i5 = 0;
|
||||
actionMenuPresenter = this;
|
||||
i = i4;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void a(Configuration configuration) {
|
||||
if (!this.q) {
|
||||
this.p = ActionBarPolicy.a(this.b).c();
|
||||
}
|
||||
MenuBuilder menuBuilder = this.c;
|
||||
if (menuBuilder != null) {
|
||||
menuBuilder.b(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Drawable drawable) {
|
||||
OverflowMenuButton overflowMenuButton = this.i;
|
||||
if (overflowMenuButton != null) {
|
||||
overflowMenuButton.setImageDrawable(drawable);
|
||||
} else {
|
||||
this.k = true;
|
||||
this.j = drawable;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
||||
public View a(MenuItemImpl menuItemImpl, View view, ViewGroup viewGroup) {
|
||||
View actionView = menuItemImpl.getActionView();
|
||||
if (actionView == null || menuItemImpl.f()) {
|
||||
actionView = super.a(menuItemImpl, view, viewGroup);
|
||||
}
|
||||
actionView.setVisibility(menuItemImpl.isActionViewExpanded() ? 8 : 0);
|
||||
ActionMenuView actionMenuView = (ActionMenuView) viewGroup;
|
||||
ViewGroup.LayoutParams layoutParams = actionView.getLayoutParams();
|
||||
if (!actionMenuView.checkLayoutParams(layoutParams)) {
|
||||
actionView.setLayoutParams(actionMenuView.generateLayoutParams(layoutParams));
|
||||
}
|
||||
return actionView;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
||||
public void a(MenuItemImpl menuItemImpl, MenuView.ItemView itemView) {
|
||||
itemView.a(menuItemImpl, 0);
|
||||
ActionMenuItemView actionMenuItemView = (ActionMenuItemView) itemView;
|
||||
actionMenuItemView.setItemInvoker((ActionMenuView) this.h);
|
||||
if (this.B == null) {
|
||||
this.B = new ActionMenuPopupCallback();
|
||||
}
|
||||
actionMenuItemView.setPopupCallback(this.B);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
||||
public boolean a(int i, MenuItemImpl menuItemImpl) {
|
||||
return menuItemImpl.h();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
||||
public void a(boolean z) {
|
||||
super.a(z);
|
||||
((View) this.h).requestLayout();
|
||||
MenuBuilder menuBuilder = this.c;
|
||||
boolean z2 = false;
|
||||
if (menuBuilder != null) {
|
||||
ArrayList<MenuItemImpl> c = menuBuilder.c();
|
||||
int size = c.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
ActionProvider a = c.get(i).a();
|
||||
if (a != null) {
|
||||
a.a(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
MenuBuilder menuBuilder2 = this.c;
|
||||
ArrayList<MenuItemImpl> j = menuBuilder2 != null ? menuBuilder2.j() : null;
|
||||
if (this.l && j != null) {
|
||||
int size2 = j.size();
|
||||
if (size2 == 1) {
|
||||
z2 = !j.get(0).isActionViewExpanded();
|
||||
} else if (size2 > 0) {
|
||||
z2 = true;
|
||||
}
|
||||
}
|
||||
if (z2) {
|
||||
if (this.i == null) {
|
||||
this.i = new OverflowMenuButton(this.a);
|
||||
}
|
||||
ViewGroup viewGroup = (ViewGroup) this.i.getParent();
|
||||
if (viewGroup != this.h) {
|
||||
if (viewGroup != null) {
|
||||
viewGroup.removeView(this.i);
|
||||
}
|
||||
ActionMenuView actionMenuView = (ActionMenuView) this.h;
|
||||
actionMenuView.addView(this.i, actionMenuView.e());
|
||||
}
|
||||
} else {
|
||||
OverflowMenuButton overflowMenuButton = this.i;
|
||||
if (overflowMenuButton != null) {
|
||||
Object parent = overflowMenuButton.getParent();
|
||||
Object obj = this.h;
|
||||
if (parent == obj) {
|
||||
((ViewGroup) obj).removeView(this.i);
|
||||
}
|
||||
}
|
||||
}
|
||||
((ActionMenuView) this.h).setOverflowReserved(this.l);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
||||
public boolean a(ViewGroup viewGroup, int i) {
|
||||
if (viewGroup.getChildAt(i) == this.i) {
|
||||
return false;
|
||||
}
|
||||
return super.a(viewGroup, i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean a(SubMenuBuilder subMenuBuilder) {
|
||||
boolean z = false;
|
||||
if (!subMenuBuilder.hasVisibleItems()) {
|
||||
return false;
|
||||
}
|
||||
SubMenuBuilder subMenuBuilder2 = subMenuBuilder;
|
||||
while (subMenuBuilder2.t() != this.c) {
|
||||
subMenuBuilder2 = (SubMenuBuilder) subMenuBuilder2.t();
|
||||
}
|
||||
View a = a(subMenuBuilder2.getItem());
|
||||
if (a == null) {
|
||||
return false;
|
||||
}
|
||||
subMenuBuilder.getItem().getItemId();
|
||||
int size = subMenuBuilder.size();
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (i >= size) {
|
||||
break;
|
||||
}
|
||||
MenuItem item = subMenuBuilder.getItem(i);
|
||||
if (item.isVisible() && item.getIcon() != null) {
|
||||
z = true;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
this.z = new ActionButtonSubmenu(this.b, subMenuBuilder, a);
|
||||
this.z.a(z);
|
||||
this.z.e();
|
||||
super.a(subMenuBuilder);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
private View a(MenuItem menuItem) {
|
||||
ViewGroup viewGroup = (ViewGroup) this.h;
|
||||
if (viewGroup == null) {
|
||||
return null;
|
||||
}
|
||||
int childCount = viewGroup.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View childAt = viewGroup.getChildAt(i);
|
||||
if ((childAt instanceof MenuView.ItemView) && ((MenuView.ItemView) childAt).getItemData() == menuItem) {
|
||||
return childAt;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
||||
public void a(MenuBuilder menuBuilder, boolean z) {
|
||||
c();
|
||||
super.a(menuBuilder, z);
|
||||
}
|
||||
|
||||
public void a(ActionMenuView actionMenuView) {
|
||||
this.h = actionMenuView;
|
||||
actionMenuView.a(this.c);
|
||||
}
|
||||
}
|
||||
676
sources/androidx/appcompat/widget/ActionMenuView.java
Normal file
676
sources/androidx/appcompat/widget/ActionMenuView.java
Normal file
@@ -0,0 +1,676 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewDebug;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import androidx.appcompat.view.menu.ActionMenuItemView;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
import androidx.appcompat.view.menu.MenuItemImpl;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.appcompat.view.menu.MenuView;
|
||||
import androidx.appcompat.widget.LinearLayoutCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionMenuView extends LinearLayoutCompat implements MenuBuilder.ItemInvoker, MenuView {
|
||||
private int A;
|
||||
OnMenuItemClickListener B;
|
||||
private MenuBuilder p;
|
||||
private Context q;
|
||||
private int r;
|
||||
private boolean s;
|
||||
private ActionMenuPresenter t;
|
||||
private MenuPresenter.Callback u;
|
||||
MenuBuilder.Callback v;
|
||||
private boolean x;
|
||||
private int y;
|
||||
private int z;
|
||||
|
||||
public interface ActionMenuChildView {
|
||||
boolean b();
|
||||
|
||||
boolean c();
|
||||
}
|
||||
|
||||
private static class ActionMenuPresenterCallback implements MenuPresenter.Callback {
|
||||
ActionMenuPresenterCallback() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
||||
public void a(MenuBuilder menuBuilder, boolean z) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
||||
public boolean a(MenuBuilder menuBuilder) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static class LayoutParams extends LinearLayoutCompat.LayoutParams {
|
||||
|
||||
@ViewDebug.ExportedProperty
|
||||
public boolean c;
|
||||
|
||||
@ViewDebug.ExportedProperty
|
||||
public int d;
|
||||
|
||||
@ViewDebug.ExportedProperty
|
||||
public int e;
|
||||
|
||||
@ViewDebug.ExportedProperty
|
||||
public boolean f;
|
||||
|
||||
@ViewDebug.ExportedProperty
|
||||
public boolean g;
|
||||
boolean h;
|
||||
|
||||
public LayoutParams(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
super(layoutParams);
|
||||
}
|
||||
|
||||
public LayoutParams(LayoutParams layoutParams) {
|
||||
super(layoutParams);
|
||||
this.c = layoutParams.c;
|
||||
}
|
||||
|
||||
public LayoutParams(int i, int i2) {
|
||||
super(i, i2);
|
||||
this.c = false;
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnMenuItemClickListener {
|
||||
boolean onMenuItemClick(MenuItem menuItem);
|
||||
}
|
||||
|
||||
public ActionMenuView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
static int a(View view, int i, int i2, int i3, int i4) {
|
||||
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(i3) - i4, View.MeasureSpec.getMode(i3));
|
||||
ActionMenuItemView actionMenuItemView = view instanceof ActionMenuItemView ? (ActionMenuItemView) view : null;
|
||||
boolean z = actionMenuItemView != null && actionMenuItemView.d();
|
||||
int i5 = 2;
|
||||
if (i2 <= 0 || (z && i2 < 2)) {
|
||||
i5 = 0;
|
||||
} else {
|
||||
view.measure(View.MeasureSpec.makeMeasureSpec(i2 * i, Integer.MIN_VALUE), makeMeasureSpec);
|
||||
int measuredWidth = view.getMeasuredWidth();
|
||||
int i6 = measuredWidth / i;
|
||||
if (measuredWidth % i != 0) {
|
||||
i6++;
|
||||
}
|
||||
if (!z || i6 >= 2) {
|
||||
i5 = i6;
|
||||
}
|
||||
}
|
||||
layoutParams.f = !layoutParams.c && z;
|
||||
layoutParams.d = i5;
|
||||
view.measure(View.MeasureSpec.makeMeasureSpec(i * i5, 1073741824), makeMeasureSpec);
|
||||
return i5;
|
||||
}
|
||||
|
||||
/* JADX WARN: Type inference failed for: r13v12 */
|
||||
/* JADX WARN: Type inference failed for: r13v13, types: [boolean, int] */
|
||||
/* JADX WARN: Type inference failed for: r13v16 */
|
||||
private void c(int i, int i2) {
|
||||
int i3;
|
||||
int i4;
|
||||
boolean z;
|
||||
int i5;
|
||||
int i6;
|
||||
int i7;
|
||||
int i8;
|
||||
?? r13;
|
||||
int mode = View.MeasureSpec.getMode(i2);
|
||||
int size = View.MeasureSpec.getSize(i);
|
||||
int size2 = View.MeasureSpec.getSize(i2);
|
||||
int paddingLeft = getPaddingLeft() + getPaddingRight();
|
||||
int paddingTop = getPaddingTop() + getPaddingBottom();
|
||||
int childMeasureSpec = ViewGroup.getChildMeasureSpec(i2, paddingTop, -2);
|
||||
int i9 = size - paddingLeft;
|
||||
int i10 = this.z;
|
||||
int i11 = i9 / i10;
|
||||
int i12 = i9 % i10;
|
||||
if (i11 == 0) {
|
||||
setMeasuredDimension(i9, 0);
|
||||
return;
|
||||
}
|
||||
int i13 = i10 + (i12 / i11);
|
||||
int childCount = getChildCount();
|
||||
int i14 = i11;
|
||||
int i15 = 0;
|
||||
int i16 = 0;
|
||||
boolean z2 = false;
|
||||
int i17 = 0;
|
||||
int i18 = 0;
|
||||
int i19 = 0;
|
||||
long j = 0;
|
||||
while (i15 < childCount) {
|
||||
View childAt = getChildAt(i15);
|
||||
int i20 = size2;
|
||||
if (childAt.getVisibility() != 8) {
|
||||
boolean z3 = childAt instanceof ActionMenuItemView;
|
||||
int i21 = i17 + 1;
|
||||
if (z3) {
|
||||
int i22 = this.A;
|
||||
i8 = i21;
|
||||
r13 = 0;
|
||||
childAt.setPadding(i22, 0, i22, 0);
|
||||
} else {
|
||||
i8 = i21;
|
||||
r13 = 0;
|
||||
}
|
||||
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
||||
layoutParams.h = r13;
|
||||
layoutParams.e = r13;
|
||||
layoutParams.d = r13;
|
||||
layoutParams.f = r13;
|
||||
((ViewGroup.MarginLayoutParams) layoutParams).leftMargin = r13;
|
||||
((ViewGroup.MarginLayoutParams) layoutParams).rightMargin = r13;
|
||||
layoutParams.g = z3 && ((ActionMenuItemView) childAt).d();
|
||||
int a = a(childAt, i13, layoutParams.c ? 1 : i14, childMeasureSpec, paddingTop);
|
||||
int max = Math.max(i18, a);
|
||||
if (layoutParams.f) {
|
||||
i19++;
|
||||
}
|
||||
if (layoutParams.c) {
|
||||
z2 = true;
|
||||
}
|
||||
i14 -= a;
|
||||
i16 = Math.max(i16, childAt.getMeasuredHeight());
|
||||
if (a == 1) {
|
||||
j |= 1 << i15;
|
||||
i16 = i16;
|
||||
}
|
||||
i18 = max;
|
||||
i17 = i8;
|
||||
}
|
||||
i15++;
|
||||
size2 = i20;
|
||||
}
|
||||
int i23 = size2;
|
||||
boolean z4 = z2 && i17 == 2;
|
||||
boolean z5 = false;
|
||||
while (i19 > 0 && i14 > 0) {
|
||||
int i24 = Integer.MAX_VALUE;
|
||||
int i25 = 0;
|
||||
int i26 = 0;
|
||||
long j2 = 0;
|
||||
while (i25 < childCount) {
|
||||
boolean z6 = z5;
|
||||
LayoutParams layoutParams2 = (LayoutParams) getChildAt(i25).getLayoutParams();
|
||||
int i27 = i16;
|
||||
if (layoutParams2.f) {
|
||||
int i28 = layoutParams2.d;
|
||||
if (i28 < i24) {
|
||||
i24 = i28;
|
||||
j2 = 1 << i25;
|
||||
i26 = 1;
|
||||
} else if (i28 == i24) {
|
||||
j2 |= 1 << i25;
|
||||
i26++;
|
||||
}
|
||||
}
|
||||
i25++;
|
||||
i16 = i27;
|
||||
z5 = z6;
|
||||
}
|
||||
z = z5;
|
||||
i5 = i16;
|
||||
j |= j2;
|
||||
if (i26 > i14) {
|
||||
i3 = mode;
|
||||
i4 = i9;
|
||||
break;
|
||||
}
|
||||
int i29 = i24 + 1;
|
||||
int i30 = 0;
|
||||
while (i30 < childCount) {
|
||||
View childAt2 = getChildAt(i30);
|
||||
LayoutParams layoutParams3 = (LayoutParams) childAt2.getLayoutParams();
|
||||
int i31 = i9;
|
||||
int i32 = mode;
|
||||
long j3 = 1 << i30;
|
||||
if ((j2 & j3) == 0) {
|
||||
if (layoutParams3.d == i29) {
|
||||
j |= j3;
|
||||
}
|
||||
i7 = i29;
|
||||
} else {
|
||||
if (z4 && layoutParams3.g && i14 == 1) {
|
||||
int i33 = this.A;
|
||||
i7 = i29;
|
||||
childAt2.setPadding(i33 + i13, 0, i33, 0);
|
||||
} else {
|
||||
i7 = i29;
|
||||
}
|
||||
layoutParams3.d++;
|
||||
layoutParams3.h = true;
|
||||
i14--;
|
||||
}
|
||||
i30++;
|
||||
mode = i32;
|
||||
i29 = i7;
|
||||
i9 = i31;
|
||||
}
|
||||
i16 = i5;
|
||||
z5 = true;
|
||||
}
|
||||
i3 = mode;
|
||||
i4 = i9;
|
||||
z = z5;
|
||||
i5 = i16;
|
||||
boolean z7 = !z2 && i17 == 1;
|
||||
if (i14 <= 0 || j == 0 || (i14 >= i17 - 1 && !z7 && i18 <= 1)) {
|
||||
i6 = 0;
|
||||
} else {
|
||||
float bitCount = Long.bitCount(j);
|
||||
if (z7) {
|
||||
i6 = 0;
|
||||
} else {
|
||||
i6 = 0;
|
||||
if ((j & 1) != 0 && !((LayoutParams) getChildAt(0).getLayoutParams()).g) {
|
||||
bitCount -= 0.5f;
|
||||
}
|
||||
int i34 = childCount - 1;
|
||||
if ((j & (1 << i34)) != 0 && !((LayoutParams) getChildAt(i34).getLayoutParams()).g) {
|
||||
bitCount -= 0.5f;
|
||||
}
|
||||
}
|
||||
int i35 = bitCount > 0.0f ? (int) ((i14 * i13) / bitCount) : 0;
|
||||
for (int i36 = 0; i36 < childCount; i36++) {
|
||||
if ((j & (1 << i36)) != 0) {
|
||||
View childAt3 = getChildAt(i36);
|
||||
LayoutParams layoutParams4 = (LayoutParams) childAt3.getLayoutParams();
|
||||
if (childAt3 instanceof ActionMenuItemView) {
|
||||
layoutParams4.e = i35;
|
||||
layoutParams4.h = true;
|
||||
if (i36 == 0 && !layoutParams4.g) {
|
||||
((ViewGroup.MarginLayoutParams) layoutParams4).leftMargin = (-i35) / 2;
|
||||
}
|
||||
} else if (layoutParams4.c) {
|
||||
layoutParams4.e = i35;
|
||||
layoutParams4.h = true;
|
||||
((ViewGroup.MarginLayoutParams) layoutParams4).rightMargin = (-i35) / 2;
|
||||
} else {
|
||||
if (i36 != 0) {
|
||||
((ViewGroup.MarginLayoutParams) layoutParams4).leftMargin = i35 / 2;
|
||||
}
|
||||
if (i36 != childCount - 1) {
|
||||
((ViewGroup.MarginLayoutParams) layoutParams4).rightMargin = i35 / 2;
|
||||
}
|
||||
}
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (z) {
|
||||
while (i6 < childCount) {
|
||||
View childAt4 = getChildAt(i6);
|
||||
LayoutParams layoutParams5 = (LayoutParams) childAt4.getLayoutParams();
|
||||
if (layoutParams5.h) {
|
||||
childAt4.measure(View.MeasureSpec.makeMeasureSpec((layoutParams5.d * i13) + layoutParams5.e, 1073741824), childMeasureSpec);
|
||||
}
|
||||
i6++;
|
||||
}
|
||||
}
|
||||
setMeasuredDimension(i4, i3 != 1073741824 ? i5 : i23);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
|
||||
protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
return layoutParams != null && (layoutParams instanceof LayoutParams);
|
||||
}
|
||||
|
||||
public void d() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.t;
|
||||
if (actionMenuPresenter != null) {
|
||||
actionMenuPresenter.c();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public LayoutParams e() {
|
||||
LayoutParams generateDefaultLayoutParams = generateDefaultLayoutParams();
|
||||
generateDefaultLayoutParams.c = true;
|
||||
return generateDefaultLayoutParams;
|
||||
}
|
||||
|
||||
public boolean f() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.t;
|
||||
return actionMenuPresenter != null && actionMenuPresenter.e();
|
||||
}
|
||||
|
||||
public boolean g() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.t;
|
||||
return actionMenuPresenter != null && actionMenuPresenter.g();
|
||||
}
|
||||
|
||||
public Menu getMenu() {
|
||||
if (this.p == null) {
|
||||
Context context = getContext();
|
||||
this.p = new MenuBuilder(context);
|
||||
this.p.a(new MenuBuilderCallback());
|
||||
this.t = new ActionMenuPresenter(context);
|
||||
this.t.c(true);
|
||||
ActionMenuPresenter actionMenuPresenter = this.t;
|
||||
MenuPresenter.Callback callback = this.u;
|
||||
if (callback == null) {
|
||||
callback = new ActionMenuPresenterCallback();
|
||||
}
|
||||
actionMenuPresenter.a(callback);
|
||||
this.p.a(this.t, this.q);
|
||||
this.t.a(this);
|
||||
}
|
||||
return this.p;
|
||||
}
|
||||
|
||||
public Drawable getOverflowIcon() {
|
||||
getMenu();
|
||||
return this.t.d();
|
||||
}
|
||||
|
||||
public int getPopupTheme() {
|
||||
return this.r;
|
||||
}
|
||||
|
||||
public int getWindowAnimations() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean h() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.t;
|
||||
return actionMenuPresenter != null && actionMenuPresenter.h();
|
||||
}
|
||||
|
||||
public boolean i() {
|
||||
return this.s;
|
||||
}
|
||||
|
||||
public MenuBuilder j() {
|
||||
return this.p;
|
||||
}
|
||||
|
||||
public boolean k() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.t;
|
||||
return actionMenuPresenter != null && actionMenuPresenter.i();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onConfigurationChanged(Configuration configuration) {
|
||||
super.onConfigurationChanged(configuration);
|
||||
ActionMenuPresenter actionMenuPresenter = this.t;
|
||||
if (actionMenuPresenter != null) {
|
||||
actionMenuPresenter.a(false);
|
||||
if (this.t.h()) {
|
||||
this.t.e();
|
||||
this.t.i();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
d();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
int i5;
|
||||
int i6;
|
||||
int width;
|
||||
int i7;
|
||||
if (!this.x) {
|
||||
super.onLayout(z, i, i2, i3, i4);
|
||||
return;
|
||||
}
|
||||
int childCount = getChildCount();
|
||||
int i8 = (i4 - i2) / 2;
|
||||
int dividerWidth = getDividerWidth();
|
||||
int i9 = i3 - i;
|
||||
int paddingRight = (i9 - getPaddingRight()) - getPaddingLeft();
|
||||
boolean a = ViewUtils.a(this);
|
||||
int i10 = paddingRight;
|
||||
int i11 = 0;
|
||||
int i12 = 0;
|
||||
for (int i13 = 0; i13 < childCount; i13++) {
|
||||
View childAt = getChildAt(i13);
|
||||
if (childAt.getVisibility() != 8) {
|
||||
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
||||
if (layoutParams.c) {
|
||||
int measuredWidth = childAt.getMeasuredWidth();
|
||||
if (d(i13)) {
|
||||
measuredWidth += dividerWidth;
|
||||
}
|
||||
int measuredHeight = childAt.getMeasuredHeight();
|
||||
if (a) {
|
||||
i7 = getPaddingLeft() + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin;
|
||||
width = i7 + measuredWidth;
|
||||
} else {
|
||||
width = (getWidth() - getPaddingRight()) - ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin;
|
||||
i7 = width - measuredWidth;
|
||||
}
|
||||
int i14 = i8 - (measuredHeight / 2);
|
||||
childAt.layout(i7, i14, width, measuredHeight + i14);
|
||||
i10 -= measuredWidth;
|
||||
i11 = 1;
|
||||
} else {
|
||||
i10 -= (childAt.getMeasuredWidth() + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin) + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin;
|
||||
d(i13);
|
||||
i12++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (childCount == 1 && i11 == 0) {
|
||||
View childAt2 = getChildAt(0);
|
||||
int measuredWidth2 = childAt2.getMeasuredWidth();
|
||||
int measuredHeight2 = childAt2.getMeasuredHeight();
|
||||
int i15 = (i9 / 2) - (measuredWidth2 / 2);
|
||||
int i16 = i8 - (measuredHeight2 / 2);
|
||||
childAt2.layout(i15, i16, measuredWidth2 + i15, measuredHeight2 + i16);
|
||||
return;
|
||||
}
|
||||
int i17 = i12 - (i11 ^ 1);
|
||||
if (i17 > 0) {
|
||||
i6 = i10 / i17;
|
||||
i5 = 0;
|
||||
} else {
|
||||
i5 = 0;
|
||||
i6 = 0;
|
||||
}
|
||||
int max = Math.max(i5, i6);
|
||||
if (a) {
|
||||
int width2 = getWidth() - getPaddingRight();
|
||||
while (i5 < childCount) {
|
||||
View childAt3 = getChildAt(i5);
|
||||
LayoutParams layoutParams2 = (LayoutParams) childAt3.getLayoutParams();
|
||||
if (childAt3.getVisibility() != 8 && !layoutParams2.c) {
|
||||
int i18 = width2 - ((ViewGroup.MarginLayoutParams) layoutParams2).rightMargin;
|
||||
int measuredWidth3 = childAt3.getMeasuredWidth();
|
||||
int measuredHeight3 = childAt3.getMeasuredHeight();
|
||||
int i19 = i8 - (measuredHeight3 / 2);
|
||||
childAt3.layout(i18 - measuredWidth3, i19, i18, measuredHeight3 + i19);
|
||||
width2 = i18 - ((measuredWidth3 + ((ViewGroup.MarginLayoutParams) layoutParams2).leftMargin) + max);
|
||||
}
|
||||
i5++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
int paddingLeft = getPaddingLeft();
|
||||
while (i5 < childCount) {
|
||||
View childAt4 = getChildAt(i5);
|
||||
LayoutParams layoutParams3 = (LayoutParams) childAt4.getLayoutParams();
|
||||
if (childAt4.getVisibility() != 8 && !layoutParams3.c) {
|
||||
int i20 = paddingLeft + ((ViewGroup.MarginLayoutParams) layoutParams3).leftMargin;
|
||||
int measuredWidth4 = childAt4.getMeasuredWidth();
|
||||
int measuredHeight4 = childAt4.getMeasuredHeight();
|
||||
int i21 = i8 - (measuredHeight4 / 2);
|
||||
childAt4.layout(i20, i21, i20 + measuredWidth4, measuredHeight4 + i21);
|
||||
paddingLeft = i20 + measuredWidth4 + ((ViewGroup.MarginLayoutParams) layoutParams3).rightMargin + max;
|
||||
}
|
||||
i5++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
MenuBuilder menuBuilder;
|
||||
boolean z = this.x;
|
||||
this.x = View.MeasureSpec.getMode(i) == 1073741824;
|
||||
if (z != this.x) {
|
||||
this.y = 0;
|
||||
}
|
||||
int size = View.MeasureSpec.getSize(i);
|
||||
if (this.x && (menuBuilder = this.p) != null && size != this.y) {
|
||||
this.y = size;
|
||||
menuBuilder.b(true);
|
||||
}
|
||||
int childCount = getChildCount();
|
||||
if (this.x && childCount > 0) {
|
||||
c(i, i2);
|
||||
return;
|
||||
}
|
||||
for (int i3 = 0; i3 < childCount; i3++) {
|
||||
LayoutParams layoutParams = (LayoutParams) getChildAt(i3).getLayoutParams();
|
||||
((ViewGroup.MarginLayoutParams) layoutParams).rightMargin = 0;
|
||||
((ViewGroup.MarginLayoutParams) layoutParams).leftMargin = 0;
|
||||
}
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
|
||||
public void setExpandedActionViewsExclusive(boolean z) {
|
||||
this.t.b(z);
|
||||
}
|
||||
|
||||
public void setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener) {
|
||||
this.B = onMenuItemClickListener;
|
||||
}
|
||||
|
||||
public void setOverflowIcon(Drawable drawable) {
|
||||
getMenu();
|
||||
this.t.a(drawable);
|
||||
}
|
||||
|
||||
public void setOverflowReserved(boolean z) {
|
||||
this.s = z;
|
||||
}
|
||||
|
||||
public void setPopupTheme(int i) {
|
||||
if (this.r != i) {
|
||||
this.r = i;
|
||||
if (i == 0) {
|
||||
this.q = getContext();
|
||||
} else {
|
||||
this.q = new ContextThemeWrapper(getContext(), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setPresenter(ActionMenuPresenter actionMenuPresenter) {
|
||||
this.t = actionMenuPresenter;
|
||||
this.t.a(this);
|
||||
}
|
||||
|
||||
private class MenuBuilderCallback implements MenuBuilder.Callback {
|
||||
MenuBuilderCallback() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
||||
public boolean a(MenuBuilder menuBuilder, MenuItem menuItem) {
|
||||
OnMenuItemClickListener onMenuItemClickListener = ActionMenuView.this.B;
|
||||
return onMenuItemClickListener != null && onMenuItemClickListener.onMenuItemClick(menuItem);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
||||
public void a(MenuBuilder menuBuilder) {
|
||||
MenuBuilder.Callback callback = ActionMenuView.this.v;
|
||||
if (callback != null) {
|
||||
callback.a(menuBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ActionMenuView(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
setBaselineAligned(false);
|
||||
float f = context.getResources().getDisplayMetrics().density;
|
||||
this.z = (int) (56.0f * f);
|
||||
this.A = (int) (f * 4.0f);
|
||||
this.q = context;
|
||||
this.r = 0;
|
||||
}
|
||||
|
||||
protected boolean d(int i) {
|
||||
boolean z = false;
|
||||
if (i == 0) {
|
||||
return false;
|
||||
}
|
||||
KeyEvent.Callback childAt = getChildAt(i - 1);
|
||||
KeyEvent.Callback childAt2 = getChildAt(i);
|
||||
if (i < getChildCount() && (childAt instanceof ActionMenuChildView)) {
|
||||
z = false | ((ActionMenuChildView) childAt).b();
|
||||
}
|
||||
return (i <= 0 || !(childAt2 instanceof ActionMenuChildView)) ? z : z | ((ActionMenuChildView) childAt2).c();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
|
||||
public LayoutParams generateDefaultLayoutParams() {
|
||||
LayoutParams layoutParams = new LayoutParams(-2, -2);
|
||||
layoutParams.b = 16;
|
||||
return layoutParams;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
|
||||
public LayoutParams generateLayoutParams(AttributeSet attributeSet) {
|
||||
return new LayoutParams(getContext(), attributeSet);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
|
||||
public LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
if (layoutParams != null) {
|
||||
LayoutParams layoutParams2 = layoutParams instanceof LayoutParams ? new LayoutParams((LayoutParams) layoutParams) : new LayoutParams(layoutParams);
|
||||
if (layoutParams2.b <= 0) {
|
||||
layoutParams2.b = 16;
|
||||
}
|
||||
return layoutParams2;
|
||||
}
|
||||
return generateDefaultLayoutParams();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder.ItemInvoker
|
||||
public boolean a(MenuItemImpl menuItemImpl) {
|
||||
return this.p.a(menuItemImpl, 0);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView
|
||||
public void a(MenuBuilder menuBuilder) {
|
||||
this.p = menuBuilder;
|
||||
}
|
||||
|
||||
public void a(MenuPresenter.Callback callback, MenuBuilder.Callback callback2) {
|
||||
this.u = callback;
|
||||
this.v = callback2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActivityChooserView$InnerLayout extends LinearLayout {
|
||||
private static final int[] a = {R.attr.background};
|
||||
|
||||
public ActivityChooserView$InnerLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
TintTypedArray a2 = TintTypedArray.a(context, attributeSet, a);
|
||||
setBackgroundDrawable(a2.b(0));
|
||||
a2.a();
|
||||
}
|
||||
}
|
||||
263
sources/androidx/appcompat/widget/AlertDialogLayout.java
Normal file
263
sources/androidx/appcompat/widget/AlertDialogLayout.java
Normal file
@@ -0,0 +1,263 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.appcompat.R$id;
|
||||
import androidx.appcompat.widget.LinearLayoutCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AlertDialogLayout extends LinearLayoutCompat {
|
||||
public AlertDialogLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
private void a(View view, int i, int i2, int i3, int i4) {
|
||||
view.layout(i, i2, i3 + i, i4 + i2);
|
||||
}
|
||||
|
||||
private void c(int i, int i2) {
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 1073741824);
|
||||
for (int i3 = 0; i3 < i; i3++) {
|
||||
View childAt = getChildAt(i3);
|
||||
if (childAt.getVisibility() != 8) {
|
||||
LinearLayoutCompat.LayoutParams layoutParams = (LinearLayoutCompat.LayoutParams) childAt.getLayoutParams();
|
||||
if (((ViewGroup.MarginLayoutParams) layoutParams).width == -1) {
|
||||
int i4 = ((ViewGroup.MarginLayoutParams) layoutParams).height;
|
||||
((ViewGroup.MarginLayoutParams) layoutParams).height = childAt.getMeasuredHeight();
|
||||
measureChildWithMargins(childAt, makeMeasureSpec, 0, i2, 0);
|
||||
((ViewGroup.MarginLayoutParams) layoutParams).height = i4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean d(int i, int i2) {
|
||||
int i3;
|
||||
int i4;
|
||||
int i5;
|
||||
int i6;
|
||||
int childCount = getChildCount();
|
||||
View view = null;
|
||||
View view2 = null;
|
||||
View view3 = null;
|
||||
for (int i7 = 0; i7 < childCount; i7++) {
|
||||
View childAt = getChildAt(i7);
|
||||
if (childAt.getVisibility() != 8) {
|
||||
int id = childAt.getId();
|
||||
if (id == R$id.topPanel) {
|
||||
view = childAt;
|
||||
} else if (id == R$id.buttonPanel) {
|
||||
view2 = childAt;
|
||||
} else {
|
||||
if ((id != R$id.contentPanel && id != R$id.customPanel) || view3 != null) {
|
||||
return false;
|
||||
}
|
||||
view3 = childAt;
|
||||
}
|
||||
}
|
||||
}
|
||||
int mode = View.MeasureSpec.getMode(i2);
|
||||
int size = View.MeasureSpec.getSize(i2);
|
||||
int mode2 = View.MeasureSpec.getMode(i);
|
||||
int paddingTop = getPaddingTop() + getPaddingBottom();
|
||||
if (view != null) {
|
||||
view.measure(i, 0);
|
||||
paddingTop += view.getMeasuredHeight();
|
||||
i3 = View.combineMeasuredStates(0, view.getMeasuredState());
|
||||
} else {
|
||||
i3 = 0;
|
||||
}
|
||||
if (view2 != null) {
|
||||
view2.measure(i, 0);
|
||||
i4 = c(view2);
|
||||
i5 = view2.getMeasuredHeight() - i4;
|
||||
paddingTop += i4;
|
||||
i3 = View.combineMeasuredStates(i3, view2.getMeasuredState());
|
||||
} else {
|
||||
i4 = 0;
|
||||
i5 = 0;
|
||||
}
|
||||
if (view3 != null) {
|
||||
view3.measure(i, mode == 0 ? 0 : View.MeasureSpec.makeMeasureSpec(Math.max(0, size - paddingTop), mode));
|
||||
i6 = view3.getMeasuredHeight();
|
||||
paddingTop += i6;
|
||||
i3 = View.combineMeasuredStates(i3, view3.getMeasuredState());
|
||||
} else {
|
||||
i6 = 0;
|
||||
}
|
||||
int i8 = size - paddingTop;
|
||||
if (view2 != null) {
|
||||
int i9 = paddingTop - i4;
|
||||
int min = Math.min(i8, i5);
|
||||
if (min > 0) {
|
||||
i8 -= min;
|
||||
i4 += min;
|
||||
}
|
||||
view2.measure(i, View.MeasureSpec.makeMeasureSpec(i4, 1073741824));
|
||||
paddingTop = i9 + view2.getMeasuredHeight();
|
||||
i3 = View.combineMeasuredStates(i3, view2.getMeasuredState());
|
||||
}
|
||||
if (view3 != null && i8 > 0) {
|
||||
view3.measure(i, View.MeasureSpec.makeMeasureSpec(i6 + i8, mode));
|
||||
paddingTop = (paddingTop - i6) + view3.getMeasuredHeight();
|
||||
i3 = View.combineMeasuredStates(i3, view3.getMeasuredState());
|
||||
}
|
||||
int i10 = 0;
|
||||
for (int i11 = 0; i11 < childCount; i11++) {
|
||||
View childAt2 = getChildAt(i11);
|
||||
if (childAt2.getVisibility() != 8) {
|
||||
i10 = Math.max(i10, childAt2.getMeasuredWidth());
|
||||
}
|
||||
}
|
||||
setMeasuredDimension(View.resolveSizeAndState(i10 + getPaddingLeft() + getPaddingRight(), i, i3), View.resolveSizeAndState(paddingTop, i2, 0));
|
||||
if (mode2 == 1073741824) {
|
||||
return true;
|
||||
}
|
||||
c(childCount, i2);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:25:0x00a8 */
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup, android.view.View
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
protected void onLayout(boolean r18, int r19, int r20, int r21, int r22) {
|
||||
/*
|
||||
r17 = this;
|
||||
r6 = r17
|
||||
int r7 = r17.getPaddingLeft()
|
||||
int r0 = r21 - r19
|
||||
int r1 = r17.getPaddingRight()
|
||||
int r8 = r0 - r1
|
||||
int r0 = r0 - r7
|
||||
int r1 = r17.getPaddingRight()
|
||||
int r9 = r0 - r1
|
||||
int r0 = r17.getMeasuredHeight()
|
||||
int r10 = r17.getChildCount()
|
||||
int r1 = r17.getGravity()
|
||||
r2 = r1 & 112(0x70, float:1.57E-43)
|
||||
r3 = 8388615(0x800007, float:1.1754953E-38)
|
||||
r11 = r1 & r3
|
||||
r1 = 16
|
||||
if (r2 == r1) goto L40
|
||||
r1 = 80
|
||||
if (r2 == r1) goto L35
|
||||
int r0 = r17.getPaddingTop()
|
||||
goto L4b
|
||||
L35:
|
||||
int r1 = r17.getPaddingTop()
|
||||
int r1 = r1 + r22
|
||||
int r1 = r1 - r20
|
||||
int r0 = r1 - r0
|
||||
goto L4b
|
||||
L40:
|
||||
int r1 = r17.getPaddingTop()
|
||||
int r2 = r22 - r20
|
||||
int r2 = r2 - r0
|
||||
int r2 = r2 / 2
|
||||
int r0 = r1 + r2
|
||||
L4b:
|
||||
android.graphics.drawable.Drawable r1 = r17.getDividerDrawable()
|
||||
r2 = 0
|
||||
if (r1 != 0) goto L54
|
||||
r12 = 0
|
||||
goto L59
|
||||
L54:
|
||||
int r1 = r1.getIntrinsicHeight()
|
||||
r12 = r1
|
||||
L59:
|
||||
r13 = 0
|
||||
L5a:
|
||||
if (r13 >= r10) goto Lbf
|
||||
android.view.View r1 = r6.getChildAt(r13)
|
||||
if (r1 == 0) goto Lbc
|
||||
int r2 = r1.getVisibility()
|
||||
r3 = 8
|
||||
if (r2 == r3) goto Lbc
|
||||
int r4 = r1.getMeasuredWidth()
|
||||
int r14 = r1.getMeasuredHeight()
|
||||
android.view.ViewGroup$LayoutParams r2 = r1.getLayoutParams()
|
||||
r15 = r2
|
||||
androidx.appcompat.widget.LinearLayoutCompat$LayoutParams r15 = (androidx.appcompat.widget.LinearLayoutCompat.LayoutParams) r15
|
||||
int r2 = r15.b
|
||||
if (r2 >= 0) goto L7e
|
||||
r2 = r11
|
||||
L7e:
|
||||
int r3 = androidx.core.view.ViewCompat.k(r17)
|
||||
int r2 = androidx.core.view.GravityCompat.a(r2, r3)
|
||||
r2 = r2 & 7
|
||||
r3 = 1
|
||||
if (r2 == r3) goto L97
|
||||
r3 = 5
|
||||
if (r2 == r3) goto L92
|
||||
int r2 = r15.leftMargin
|
||||
int r2 = r2 + r7
|
||||
goto La2
|
||||
L92:
|
||||
int r2 = r8 - r4
|
||||
int r3 = r15.rightMargin
|
||||
goto La1
|
||||
L97:
|
||||
int r2 = r9 - r4
|
||||
int r2 = r2 / 2
|
||||
int r2 = r2 + r7
|
||||
int r3 = r15.leftMargin
|
||||
int r2 = r2 + r3
|
||||
int r3 = r15.rightMargin
|
||||
La1:
|
||||
int r2 = r2 - r3
|
||||
La2:
|
||||
boolean r3 = r6.b(r13)
|
||||
if (r3 == 0) goto La9
|
||||
int r0 = r0 + r12
|
||||
La9:
|
||||
int r3 = r15.topMargin
|
||||
int r16 = r0 + r3
|
||||
r0 = r17
|
||||
r3 = r16
|
||||
r5 = r14
|
||||
r0.a(r1, r2, r3, r4, r5)
|
||||
int r0 = r15.bottomMargin
|
||||
int r14 = r14 + r0
|
||||
int r16 = r16 + r14
|
||||
r0 = r16
|
||||
Lbc:
|
||||
int r13 = r13 + 1
|
||||
goto L5a
|
||||
Lbf:
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AlertDialogLayout.onLayout(boolean, int, int, int, int):void");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
if (d(i, i2)) {
|
||||
return;
|
||||
}
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
|
||||
public AlertDialogLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
private static int c(View view) {
|
||||
int l = ViewCompat.l(view);
|
||||
if (l > 0) {
|
||||
return l;
|
||||
}
|
||||
if (view instanceof ViewGroup) {
|
||||
ViewGroup viewGroup = (ViewGroup) view;
|
||||
if (viewGroup.getChildCount() == 1) {
|
||||
return c(viewGroup.getChildAt(0));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ActionMode;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatAutoCompleteTextView extends AutoCompleteTextView implements TintableBackgroundView {
|
||||
private static final int[] c = {R.attr.popupBackground};
|
||||
private final AppCompatBackgroundHelper a;
|
||||
private final AppCompatTextHelper b;
|
||||
|
||||
public AppCompatAutoCompleteTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.b();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.c();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
|
||||
InputConnection onCreateInputConnection = super.onCreateInputConnection(editorInfo);
|
||||
AppCompatHintHelper.a(onCreateInputConnection, editorInfo, this);
|
||||
return onCreateInputConnection;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
|
||||
super.setCustomSelectionActionModeCallback(TextViewCompat.a(this, callback));
|
||||
}
|
||||
|
||||
@Override // android.widget.AutoCompleteTextView
|
||||
public void setDropDownBackgroundResource(int i) {
|
||||
setDropDownBackgroundDrawable(AppCompatResources.c(getContext(), i));
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.b(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
public AppCompatAutoCompleteTextView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R$attr.autoCompleteTextViewStyle);
|
||||
}
|
||||
|
||||
public AppCompatAutoCompleteTextView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.b(context), attributeSet, i);
|
||||
TintTypedArray a = TintTypedArray.a(getContext(), attributeSet, c, i, 0);
|
||||
if (a.g(0)) {
|
||||
setDropDownBackgroundDrawable(a.b(0));
|
||||
}
|
||||
a.a();
|
||||
this.a = new AppCompatBackgroundHelper(this);
|
||||
this.a.a(attributeSet, i);
|
||||
this.b = new AppCompatTextHelper(this);
|
||||
this.b.a(attributeSet, i);
|
||||
this.b.a();
|
||||
}
|
||||
}
|
||||
154
sources/androidx/appcompat/widget/AppCompatBackgroundHelper.java
Normal file
154
sources/androidx/appcompat/widget/AppCompatBackgroundHelper.java
Normal file
@@ -0,0 +1,154 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import androidx.appcompat.R$styleable;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatBackgroundHelper {
|
||||
private final View a;
|
||||
private TintInfo d;
|
||||
private TintInfo e;
|
||||
private TintInfo f;
|
||||
private int c = -1;
|
||||
private final AppCompatDrawableManager b = AppCompatDrawableManager.a();
|
||||
|
||||
AppCompatBackgroundHelper(View view) {
|
||||
this.a = view;
|
||||
}
|
||||
|
||||
private boolean d() {
|
||||
int i = Build.VERSION.SDK_INT;
|
||||
return i > 21 ? this.d != null : i == 21;
|
||||
}
|
||||
|
||||
void a(AttributeSet attributeSet, int i) {
|
||||
TintTypedArray a = TintTypedArray.a(this.a.getContext(), attributeSet, R$styleable.ViewBackgroundHelper, i, 0);
|
||||
try {
|
||||
if (a.g(R$styleable.ViewBackgroundHelper_android_background)) {
|
||||
this.c = a.g(R$styleable.ViewBackgroundHelper_android_background, -1);
|
||||
ColorStateList b = this.b.b(this.a.getContext(), this.c);
|
||||
if (b != null) {
|
||||
a(b);
|
||||
}
|
||||
}
|
||||
if (a.g(R$styleable.ViewBackgroundHelper_backgroundTint)) {
|
||||
ViewCompat.a(this.a, a.a(R$styleable.ViewBackgroundHelper_backgroundTint));
|
||||
}
|
||||
if (a.g(R$styleable.ViewBackgroundHelper_backgroundTintMode)) {
|
||||
ViewCompat.a(this.a, DrawableUtils.a(a.d(R$styleable.ViewBackgroundHelper_backgroundTintMode, -1), null));
|
||||
}
|
||||
} finally {
|
||||
a.a();
|
||||
}
|
||||
}
|
||||
|
||||
void b(ColorStateList colorStateList) {
|
||||
if (this.e == null) {
|
||||
this.e = new TintInfo();
|
||||
}
|
||||
TintInfo tintInfo = this.e;
|
||||
tintInfo.a = colorStateList;
|
||||
tintInfo.d = true;
|
||||
a();
|
||||
}
|
||||
|
||||
PorterDuff.Mode c() {
|
||||
TintInfo tintInfo = this.e;
|
||||
if (tintInfo != null) {
|
||||
return tintInfo.b;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
ColorStateList b() {
|
||||
TintInfo tintInfo = this.e;
|
||||
if (tintInfo != null) {
|
||||
return tintInfo.a;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean b(Drawable drawable) {
|
||||
if (this.f == null) {
|
||||
this.f = new TintInfo();
|
||||
}
|
||||
TintInfo tintInfo = this.f;
|
||||
tintInfo.a();
|
||||
ColorStateList c = ViewCompat.c(this.a);
|
||||
if (c != null) {
|
||||
tintInfo.d = true;
|
||||
tintInfo.a = c;
|
||||
}
|
||||
PorterDuff.Mode d = ViewCompat.d(this.a);
|
||||
if (d != null) {
|
||||
tintInfo.c = true;
|
||||
tintInfo.b = d;
|
||||
}
|
||||
if (!tintInfo.d && !tintInfo.c) {
|
||||
return false;
|
||||
}
|
||||
AppCompatDrawableManager.a(drawable, tintInfo, this.a.getDrawableState());
|
||||
return true;
|
||||
}
|
||||
|
||||
void a(int i) {
|
||||
this.c = i;
|
||||
AppCompatDrawableManager appCompatDrawableManager = this.b;
|
||||
a(appCompatDrawableManager != null ? appCompatDrawableManager.b(this.a.getContext(), i) : null);
|
||||
a();
|
||||
}
|
||||
|
||||
void a(Drawable drawable) {
|
||||
this.c = -1;
|
||||
a((ColorStateList) null);
|
||||
a();
|
||||
}
|
||||
|
||||
void a(PorterDuff.Mode mode) {
|
||||
if (this.e == null) {
|
||||
this.e = new TintInfo();
|
||||
}
|
||||
TintInfo tintInfo = this.e;
|
||||
tintInfo.b = mode;
|
||||
tintInfo.c = true;
|
||||
a();
|
||||
}
|
||||
|
||||
void a() {
|
||||
Drawable background = this.a.getBackground();
|
||||
if (background != null) {
|
||||
if (d() && b(background)) {
|
||||
return;
|
||||
}
|
||||
TintInfo tintInfo = this.e;
|
||||
if (tintInfo != null) {
|
||||
AppCompatDrawableManager.a(background, tintInfo, this.a.getDrawableState());
|
||||
return;
|
||||
}
|
||||
TintInfo tintInfo2 = this.d;
|
||||
if (tintInfo2 != null) {
|
||||
AppCompatDrawableManager.a(background, tintInfo2, this.a.getDrawableState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void a(ColorStateList colorStateList) {
|
||||
if (colorStateList != null) {
|
||||
if (this.d == null) {
|
||||
this.d = new TintInfo();
|
||||
}
|
||||
TintInfo tintInfo = this.d;
|
||||
tintInfo.a = colorStateList;
|
||||
tintInfo.d = true;
|
||||
} else {
|
||||
this.d = null;
|
||||
}
|
||||
a();
|
||||
}
|
||||
}
|
||||
260
sources/androidx/appcompat/widget/AppCompatButton.java
Normal file
260
sources/androidx/appcompat/widget/AppCompatButton.java
Normal file
@@ -0,0 +1,260 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ActionMode;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.widget.Button;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.AutoSizeableTextView;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatButton extends Button implements TintableBackgroundView, AutoSizeableTextView {
|
||||
private final AppCompatBackgroundHelper a;
|
||||
private final AppCompatTextHelper b;
|
||||
|
||||
public AppCompatButton(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public int getAutoSizeMaxTextSize() {
|
||||
if (AutoSizeableTextView.w) {
|
||||
return super.getAutoSizeMaxTextSize();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.c();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public int getAutoSizeMinTextSize() {
|
||||
if (AutoSizeableTextView.w) {
|
||||
return super.getAutoSizeMinTextSize();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.d();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public int getAutoSizeStepGranularity() {
|
||||
if (AutoSizeableTextView.w) {
|
||||
return super.getAutoSizeStepGranularity();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.e();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public int[] getAutoSizeTextAvailableSizes() {
|
||||
if (AutoSizeableTextView.w) {
|
||||
return super.getAutoSizeTextAvailableSizes();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
return appCompatTextHelper != null ? appCompatTextHelper.f() : new int[0];
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public int getAutoSizeTextType() {
|
||||
if (AutoSizeableTextView.w) {
|
||||
return super.getAutoSizeTextType() == 1 ? 1 : 0;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.g();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.b();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.c();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
|
||||
super.onInitializeAccessibilityEvent(accessibilityEvent);
|
||||
accessibilityEvent.setClassName(Button.class.getName());
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
|
||||
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
|
||||
accessibilityNodeInfo.setClassName(Button.class.getName());
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
super.onLayout(z, i, i2, i3, i4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(z, i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
protected void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
||||
super.onTextChanged(charSequence, i, i2, i3);
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper == null || AutoSizeableTextView.w || !appCompatTextHelper.h()) {
|
||||
return;
|
||||
}
|
||||
this.b.b();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setAutoSizeTextTypeUniformWithConfiguration(int i, int i2, int i3, int i4) throws IllegalArgumentException {
|
||||
if (AutoSizeableTextView.w) {
|
||||
super.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setAutoSizeTextTypeUniformWithPresetSizes(int[] iArr, int i) throws IllegalArgumentException {
|
||||
if (AutoSizeableTextView.w) {
|
||||
super.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(iArr, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setAutoSizeTextTypeWithDefaults(int i) {
|
||||
if (AutoSizeableTextView.w) {
|
||||
super.setAutoSizeTextTypeWithDefaults(i);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
|
||||
super.setCustomSelectionActionModeCallback(TextViewCompat.a(this, callback));
|
||||
}
|
||||
|
||||
public void setSupportAllCaps(boolean z) {
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.b(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextSize(int i, float f) {
|
||||
if (AutoSizeableTextView.w) {
|
||||
super.setTextSize(i, f);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(i, f);
|
||||
}
|
||||
}
|
||||
|
||||
public AppCompatButton(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R$attr.buttonStyle);
|
||||
}
|
||||
|
||||
public AppCompatButton(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.b(context), attributeSet, i);
|
||||
this.a = new AppCompatBackgroundHelper(this);
|
||||
this.a.a(attributeSet, i);
|
||||
this.b = new AppCompatTextHelper(this);
|
||||
this.b.a(attributeSet, i);
|
||||
this.b.a();
|
||||
}
|
||||
}
|
||||
79
sources/androidx/appcompat/widget/AppCompatCheckBox.java
Normal file
79
sources/androidx/appcompat/widget/AppCompatCheckBox.java
Normal file
@@ -0,0 +1,79 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.CheckBox;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.widget.TintableCompoundButton;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatCheckBox extends CheckBox implements TintableCompoundButton {
|
||||
private final AppCompatCompoundButtonHelper a;
|
||||
|
||||
public AppCompatCheckBox(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R$attr.checkboxStyle);
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton, android.widget.TextView
|
||||
public int getCompoundPaddingLeft() {
|
||||
int compoundPaddingLeft = super.getCompoundPaddingLeft();
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.a;
|
||||
return appCompatCompoundButtonHelper != null ? appCompatCompoundButtonHelper.a(compoundPaddingLeft) : compoundPaddingLeft;
|
||||
}
|
||||
|
||||
public ColorStateList getSupportButtonTintList() {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.a;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
return appCompatCompoundButtonHelper.b();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PorterDuff.Mode getSupportButtonTintMode() {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.a;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
return appCompatCompoundButtonHelper.c();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton
|
||||
public void setButtonDrawable(Drawable drawable) {
|
||||
super.setButtonDrawable(drawable);
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.a;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.d();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public void setSupportButtonTintList(ColorStateList colorStateList) {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.a;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.a(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public void setSupportButtonTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.a;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.a(mode);
|
||||
}
|
||||
}
|
||||
|
||||
public AppCompatCheckBox(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.b(context), attributeSet, i);
|
||||
this.a = new AppCompatCompoundButtonHelper(this);
|
||||
this.a.a(attributeSet, i);
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton
|
||||
public void setButtonDrawable(int i) {
|
||||
setButtonDrawable(AppCompatResources.c(getContext(), i));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ActionMode;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.widget.CheckedTextView;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatCheckedTextView extends CheckedTextView {
|
||||
private static final int[] b = {R.attr.checkMark};
|
||||
private final AppCompatTextHelper a;
|
||||
|
||||
public AppCompatCheckedTextView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.checkedTextViewStyle);
|
||||
}
|
||||
|
||||
@Override // android.widget.CheckedTextView, android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatTextHelper appCompatTextHelper = this.a;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
|
||||
InputConnection onCreateInputConnection = super.onCreateInputConnection(editorInfo);
|
||||
AppCompatHintHelper.a(onCreateInputConnection, editorInfo, this);
|
||||
return onCreateInputConnection;
|
||||
}
|
||||
|
||||
@Override // android.widget.CheckedTextView
|
||||
public void setCheckMarkDrawable(int i) {
|
||||
setCheckMarkDrawable(AppCompatResources.c(getContext(), i));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
|
||||
super.setCustomSelectionActionModeCallback(TextViewCompat.a(this, callback));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.a;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
public AppCompatCheckedTextView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.b(context), attributeSet, i);
|
||||
this.a = new AppCompatTextHelper(this);
|
||||
this.a.a(attributeSet, i);
|
||||
this.a.a();
|
||||
TintTypedArray a = TintTypedArray.a(getContext(), attributeSet, b, i, 0);
|
||||
setCheckMarkDrawable(a.b(0));
|
||||
a.a();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.CompoundButton;
|
||||
import androidx.appcompat.R$styleable;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.widget.CompoundButtonCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatCompoundButtonHelper {
|
||||
private final CompoundButton a;
|
||||
private ColorStateList b = null;
|
||||
private PorterDuff.Mode c = null;
|
||||
private boolean d = false;
|
||||
private boolean e = false;
|
||||
private boolean f;
|
||||
|
||||
AppCompatCompoundButtonHelper(CompoundButton compoundButton) {
|
||||
this.a = compoundButton;
|
||||
}
|
||||
|
||||
void a(AttributeSet attributeSet, int i) {
|
||||
int resourceId;
|
||||
TypedArray obtainStyledAttributes = this.a.getContext().obtainStyledAttributes(attributeSet, R$styleable.CompoundButton, i, 0);
|
||||
try {
|
||||
if (obtainStyledAttributes.hasValue(R$styleable.CompoundButton_android_button) && (resourceId = obtainStyledAttributes.getResourceId(R$styleable.CompoundButton_android_button, 0)) != 0) {
|
||||
this.a.setButtonDrawable(AppCompatResources.c(this.a.getContext(), resourceId));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R$styleable.CompoundButton_buttonTint)) {
|
||||
CompoundButtonCompat.a(this.a, obtainStyledAttributes.getColorStateList(R$styleable.CompoundButton_buttonTint));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R$styleable.CompoundButton_buttonTintMode)) {
|
||||
CompoundButtonCompat.a(this.a, DrawableUtils.a(obtainStyledAttributes.getInt(R$styleable.CompoundButton_buttonTintMode, -1), null));
|
||||
}
|
||||
} finally {
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
ColorStateList b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
PorterDuff.Mode c() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
void d() {
|
||||
if (this.f) {
|
||||
this.f = false;
|
||||
} else {
|
||||
this.f = true;
|
||||
a();
|
||||
}
|
||||
}
|
||||
|
||||
void a(ColorStateList colorStateList) {
|
||||
this.b = colorStateList;
|
||||
this.d = true;
|
||||
a();
|
||||
}
|
||||
|
||||
void a(PorterDuff.Mode mode) {
|
||||
this.c = mode;
|
||||
this.e = true;
|
||||
a();
|
||||
}
|
||||
|
||||
void a() {
|
||||
Drawable a = CompoundButtonCompat.a(this.a);
|
||||
if (a != null) {
|
||||
if (this.d || this.e) {
|
||||
Drawable mutate = DrawableCompat.h(a).mutate();
|
||||
if (this.d) {
|
||||
DrawableCompat.a(mutate, this.b);
|
||||
}
|
||||
if (this.e) {
|
||||
DrawableCompat.a(mutate, this.c);
|
||||
}
|
||||
if (mutate.isStateful()) {
|
||||
mutate.setState(this.a.getDrawableState());
|
||||
}
|
||||
this.a.setButtonDrawable(mutate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int a(int i) {
|
||||
Drawable a;
|
||||
return (Build.VERSION.SDK_INT >= 17 || (a = CompoundButtonCompat.a(this.a)) == null) ? i : i + a.getIntrinsicWidth();
|
||||
}
|
||||
}
|
||||
580
sources/androidx/appcompat/widget/AppCompatDrawableManager.java
Normal file
580
sources/androidx/appcompat/widget/AppCompatDrawableManager.java
Normal file
@@ -0,0 +1,580 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.util.Xml;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.appcompat.R$color;
|
||||
import androidx.appcompat.R$drawable;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.appcompat.graphics.drawable.AnimatedStateListDrawableCompat;
|
||||
import androidx.collection.ArrayMap;
|
||||
import androidx.collection.LongSparseArray;
|
||||
import androidx.collection.LruCache;
|
||||
import androidx.collection.SparseArrayCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat;
|
||||
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.WeakHashMap;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class AppCompatDrawableManager {
|
||||
private static AppCompatDrawableManager h;
|
||||
private WeakHashMap<Context, SparseArrayCompat<ColorStateList>> a;
|
||||
private ArrayMap<String, InflateDelegate> b;
|
||||
private SparseArrayCompat<String> c;
|
||||
private final WeakHashMap<Context, LongSparseArray<WeakReference<Drawable.ConstantState>>> d = new WeakHashMap<>(0);
|
||||
private TypedValue e;
|
||||
private boolean f;
|
||||
private static final PorterDuff.Mode g = PorterDuff.Mode.SRC_IN;
|
||||
private static final ColorFilterLruCache i = new ColorFilterLruCache(6);
|
||||
private static final int[] j = {R$drawable.abc_textfield_search_default_mtrl_alpha, R$drawable.abc_textfield_default_mtrl_alpha, R$drawable.abc_ab_share_pack_mtrl_alpha};
|
||||
private static final int[] k = {R$drawable.abc_ic_commit_search_api_mtrl_alpha, R$drawable.abc_seekbar_tick_mark_material, R$drawable.abc_ic_menu_share_mtrl_alpha, R$drawable.abc_ic_menu_copy_mtrl_am_alpha, R$drawable.abc_ic_menu_cut_mtrl_alpha, R$drawable.abc_ic_menu_selectall_mtrl_alpha, R$drawable.abc_ic_menu_paste_mtrl_am_alpha};
|
||||
private static final int[] l = {R$drawable.abc_textfield_activated_mtrl_alpha, R$drawable.abc_textfield_search_activated_mtrl_alpha, R$drawable.abc_cab_background_top_mtrl_alpha, R$drawable.abc_text_cursor_material, R$drawable.abc_text_select_handle_left_mtrl_dark, R$drawable.abc_text_select_handle_middle_mtrl_dark, R$drawable.abc_text_select_handle_right_mtrl_dark, R$drawable.abc_text_select_handle_left_mtrl_light, R$drawable.abc_text_select_handle_middle_mtrl_light, R$drawable.abc_text_select_handle_right_mtrl_light};
|
||||
private static final int[] m = {R$drawable.abc_popup_background_mtrl_mult, R$drawable.abc_cab_background_internal_bg, R$drawable.abc_menu_hardkey_panel_mtrl_mult};
|
||||
private static final int[] n = {R$drawable.abc_tab_indicator_material, R$drawable.abc_textfield_search_material};
|
||||
private static final int[] o = {R$drawable.abc_btn_check_material, R$drawable.abc_btn_radio_material};
|
||||
|
||||
static class AsldcInflateDelegate implements InflateDelegate {
|
||||
AsldcInflateDelegate() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatDrawableManager.InflateDelegate
|
||||
public Drawable a(Context context, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) {
|
||||
try {
|
||||
return AnimatedStateListDrawableCompat.b(context, context.getResources(), xmlPullParser, attributeSet, theme);
|
||||
} catch (Exception e) {
|
||||
Log.e("AsldcInflateDelegate", "Exception while inflating <animated-selector>", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class AvdcInflateDelegate implements InflateDelegate {
|
||||
AvdcInflateDelegate() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatDrawableManager.InflateDelegate
|
||||
public Drawable a(Context context, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) {
|
||||
try {
|
||||
return AnimatedVectorDrawableCompat.a(context, context.getResources(), xmlPullParser, attributeSet, theme);
|
||||
} catch (Exception e) {
|
||||
Log.e("AvdcInflateDelegate", "Exception while inflating <animated-vector>", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class ColorFilterLruCache extends LruCache<Integer, PorterDuffColorFilter> {
|
||||
public ColorFilterLruCache(int i) {
|
||||
super(i);
|
||||
}
|
||||
|
||||
private static int b(int i, PorterDuff.Mode mode) {
|
||||
return ((i + 31) * 31) + mode.hashCode();
|
||||
}
|
||||
|
||||
PorterDuffColorFilter a(int i, PorterDuff.Mode mode) {
|
||||
return b(Integer.valueOf(b(i, mode)));
|
||||
}
|
||||
|
||||
PorterDuffColorFilter a(int i, PorterDuff.Mode mode, PorterDuffColorFilter porterDuffColorFilter) {
|
||||
return a((ColorFilterLruCache) Integer.valueOf(b(i, mode)), (Integer) porterDuffColorFilter);
|
||||
}
|
||||
}
|
||||
|
||||
private interface InflateDelegate {
|
||||
Drawable a(Context context, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme);
|
||||
}
|
||||
|
||||
private static class VdcInflateDelegate implements InflateDelegate {
|
||||
VdcInflateDelegate() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatDrawableManager.InflateDelegate
|
||||
public Drawable a(Context context, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) {
|
||||
try {
|
||||
return VectorDrawableCompat.createFromXmlInner(context.getResources(), xmlPullParser, attributeSet, theme);
|
||||
} catch (Exception e) {
|
||||
Log.e("VdcInflateDelegate", "Exception while inflating <vector>", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized AppCompatDrawableManager a() {
|
||||
AppCompatDrawableManager appCompatDrawableManager;
|
||||
synchronized (AppCompatDrawableManager.class) {
|
||||
if (h == null) {
|
||||
h = new AppCompatDrawableManager();
|
||||
a(h);
|
||||
}
|
||||
appCompatDrawableManager = h;
|
||||
}
|
||||
return appCompatDrawableManager;
|
||||
}
|
||||
|
||||
private ColorStateList c(Context context) {
|
||||
return c(context, 0);
|
||||
}
|
||||
|
||||
private Drawable d(Context context, int i2) {
|
||||
if (this.e == null) {
|
||||
this.e = new TypedValue();
|
||||
}
|
||||
TypedValue typedValue = this.e;
|
||||
context.getResources().getValue(i2, typedValue, true);
|
||||
long a = a(typedValue);
|
||||
Drawable a2 = a(context, a);
|
||||
if (a2 != null) {
|
||||
return a2;
|
||||
}
|
||||
if (i2 == R$drawable.abc_cab_background_top_material) {
|
||||
a2 = new LayerDrawable(new Drawable[]{a(context, R$drawable.abc_cab_background_internal_bg), a(context, R$drawable.abc_cab_background_top_mtrl_alpha)});
|
||||
}
|
||||
if (a2 != null) {
|
||||
a2.setChangingConfigurations(typedValue.changingConfigurations);
|
||||
a(context, a, a2);
|
||||
}
|
||||
return a2;
|
||||
}
|
||||
|
||||
private ColorStateList e(Context context, int i2) {
|
||||
SparseArrayCompat<ColorStateList> sparseArrayCompat;
|
||||
WeakHashMap<Context, SparseArrayCompat<ColorStateList>> weakHashMap = this.a;
|
||||
if (weakHashMap == null || (sparseArrayCompat = weakHashMap.get(context)) == null) {
|
||||
return null;
|
||||
}
|
||||
return sparseArrayCompat.b(i2);
|
||||
}
|
||||
|
||||
private Drawable f(Context context, int i2) {
|
||||
int next;
|
||||
ArrayMap<String, InflateDelegate> arrayMap = this.b;
|
||||
if (arrayMap == null || arrayMap.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
SparseArrayCompat<String> sparseArrayCompat = this.c;
|
||||
if (sparseArrayCompat != null) {
|
||||
String b = sparseArrayCompat.b(i2);
|
||||
if ("appcompat_skip_skip".equals(b) || (b != null && this.b.get(b) == null)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
this.c = new SparseArrayCompat<>();
|
||||
}
|
||||
if (this.e == null) {
|
||||
this.e = new TypedValue();
|
||||
}
|
||||
TypedValue typedValue = this.e;
|
||||
Resources resources = context.getResources();
|
||||
resources.getValue(i2, typedValue, true);
|
||||
long a = a(typedValue);
|
||||
Drawable a2 = a(context, a);
|
||||
if (a2 != null) {
|
||||
return a2;
|
||||
}
|
||||
CharSequence charSequence = typedValue.string;
|
||||
if (charSequence != null && charSequence.toString().endsWith(".xml")) {
|
||||
try {
|
||||
XmlResourceParser xml = resources.getXml(i2);
|
||||
AttributeSet asAttributeSet = Xml.asAttributeSet(xml);
|
||||
do {
|
||||
next = xml.next();
|
||||
if (next == 2) {
|
||||
break;
|
||||
}
|
||||
} while (next != 1);
|
||||
if (next != 2) {
|
||||
throw new XmlPullParserException("No start tag found");
|
||||
}
|
||||
String name = xml.getName();
|
||||
this.c.a(i2, name);
|
||||
InflateDelegate inflateDelegate = this.b.get(name);
|
||||
if (inflateDelegate != null) {
|
||||
a2 = inflateDelegate.a(context, xml, asAttributeSet, context.getTheme());
|
||||
}
|
||||
if (a2 != null) {
|
||||
a2.setChangingConfigurations(typedValue.changingConfigurations);
|
||||
a(context, a, a2);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("AppCompatDrawableManag", "Exception while inflating drawable", e);
|
||||
}
|
||||
}
|
||||
if (a2 == null) {
|
||||
this.c.a(i2, "appcompat_skip_skip");
|
||||
}
|
||||
return a2;
|
||||
}
|
||||
|
||||
synchronized ColorStateList b(Context context, int i2) {
|
||||
ColorStateList e;
|
||||
e = e(context, i2);
|
||||
if (e == null) {
|
||||
if (i2 == R$drawable.abc_edit_text_material) {
|
||||
e = AppCompatResources.b(context, R$color.abc_tint_edittext);
|
||||
} else if (i2 == R$drawable.abc_switch_track_mtrl_alpha) {
|
||||
e = AppCompatResources.b(context, R$color.abc_tint_switch_track);
|
||||
} else if (i2 == R$drawable.abc_switch_thumb_material) {
|
||||
e = f(context);
|
||||
} else if (i2 == R$drawable.abc_btn_default_mtrl_shape) {
|
||||
e = e(context);
|
||||
} else if (i2 == R$drawable.abc_btn_borderless_material) {
|
||||
e = c(context);
|
||||
} else if (i2 == R$drawable.abc_btn_colored_material) {
|
||||
e = d(context);
|
||||
} else {
|
||||
if (i2 != R$drawable.abc_spinner_mtrl_am_alpha && i2 != R$drawable.abc_spinner_textfield_background_material) {
|
||||
if (a(k, i2)) {
|
||||
e = ThemeUtils.c(context, R$attr.colorControlNormal);
|
||||
} else if (a(n, i2)) {
|
||||
e = AppCompatResources.b(context, R$color.abc_tint_default);
|
||||
} else if (a(o, i2)) {
|
||||
e = AppCompatResources.b(context, R$color.abc_tint_btn_checkable);
|
||||
} else if (i2 == R$drawable.abc_seekbar_thumb_material) {
|
||||
e = AppCompatResources.b(context, R$color.abc_tint_seek_thumb);
|
||||
}
|
||||
}
|
||||
e = AppCompatResources.b(context, R$color.abc_tint_spinner);
|
||||
}
|
||||
if (e != null) {
|
||||
a(context, i2, e);
|
||||
}
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
private ColorStateList c(Context context, int i2) {
|
||||
int b = ThemeUtils.b(context, R$attr.colorControlHighlight);
|
||||
return new ColorStateList(new int[][]{ThemeUtils.b, ThemeUtils.d, ThemeUtils.c, ThemeUtils.f}, new int[]{ThemeUtils.a(context, R$attr.colorButtonNormal), ColorUtils.b(b, i2), ColorUtils.b(b, i2), i2});
|
||||
}
|
||||
|
||||
private ColorStateList e(Context context) {
|
||||
return c(context, ThemeUtils.b(context, R$attr.colorButtonNormal));
|
||||
}
|
||||
|
||||
private static void a(AppCompatDrawableManager appCompatDrawableManager) {
|
||||
if (Build.VERSION.SDK_INT < 24) {
|
||||
appCompatDrawableManager.a("vector", new VdcInflateDelegate());
|
||||
appCompatDrawableManager.a("animated-vector", new AvdcInflateDelegate());
|
||||
appCompatDrawableManager.a("animated-selector", new AsldcInflateDelegate());
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized Drawable a(Context context, int i2) {
|
||||
return a(context, i2, false);
|
||||
}
|
||||
|
||||
synchronized Drawable a(Context context, int i2, boolean z) {
|
||||
Drawable f;
|
||||
b(context);
|
||||
f = f(context, i2);
|
||||
if (f == null) {
|
||||
f = d(context, i2);
|
||||
}
|
||||
if (f == null) {
|
||||
f = ContextCompat.c(context, i2);
|
||||
}
|
||||
if (f != null) {
|
||||
f = a(context, i2, z, f);
|
||||
}
|
||||
if (f != null) {
|
||||
DrawableUtils.b(f);
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
private ColorStateList d(Context context) {
|
||||
return c(context, ThemeUtils.b(context, R$attr.colorAccent));
|
||||
}
|
||||
|
||||
public synchronized void a(Context context) {
|
||||
LongSparseArray<WeakReference<Drawable.ConstantState>> longSparseArray = this.d.get(context);
|
||||
if (longSparseArray != null) {
|
||||
longSparseArray.a();
|
||||
}
|
||||
}
|
||||
|
||||
private static long a(TypedValue typedValue) {
|
||||
return (typedValue.assetCookie << 32) | typedValue.data;
|
||||
}
|
||||
|
||||
private Drawable a(Context context, int i2, boolean z, Drawable drawable) {
|
||||
ColorStateList b = b(context, i2);
|
||||
if (b != null) {
|
||||
if (DrawableUtils.a(drawable)) {
|
||||
drawable = drawable.mutate();
|
||||
}
|
||||
Drawable h2 = DrawableCompat.h(drawable);
|
||||
DrawableCompat.a(h2, b);
|
||||
PorterDuff.Mode a = a(i2);
|
||||
if (a == null) {
|
||||
return h2;
|
||||
}
|
||||
DrawableCompat.a(h2, a);
|
||||
return h2;
|
||||
}
|
||||
if (i2 == R$drawable.abc_seekbar_track_material) {
|
||||
LayerDrawable layerDrawable = (LayerDrawable) drawable;
|
||||
a(layerDrawable.findDrawableByLayerId(R.id.background), ThemeUtils.b(context, R$attr.colorControlNormal), g);
|
||||
a(layerDrawable.findDrawableByLayerId(R.id.secondaryProgress), ThemeUtils.b(context, R$attr.colorControlNormal), g);
|
||||
a(layerDrawable.findDrawableByLayerId(R.id.progress), ThemeUtils.b(context, R$attr.colorControlActivated), g);
|
||||
return drawable;
|
||||
}
|
||||
if (i2 != R$drawable.abc_ratingbar_material && i2 != R$drawable.abc_ratingbar_indicator_material && i2 != R$drawable.abc_ratingbar_small_material) {
|
||||
if (a(context, i2, drawable) || !z) {
|
||||
return drawable;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
LayerDrawable layerDrawable2 = (LayerDrawable) drawable;
|
||||
a(layerDrawable2.findDrawableByLayerId(R.id.background), ThemeUtils.a(context, R$attr.colorControlNormal), g);
|
||||
a(layerDrawable2.findDrawableByLayerId(R.id.secondaryProgress), ThemeUtils.b(context, R$attr.colorControlActivated), g);
|
||||
a(layerDrawable2.findDrawableByLayerId(R.id.progress), ThemeUtils.b(context, R$attr.colorControlActivated), g);
|
||||
return drawable;
|
||||
}
|
||||
|
||||
private void b(Context context) {
|
||||
if (this.f) {
|
||||
return;
|
||||
}
|
||||
this.f = true;
|
||||
Drawable a = a(context, R$drawable.abc_vector_test);
|
||||
if (a == null || !a(a)) {
|
||||
this.f = false;
|
||||
throw new IllegalStateException("This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat.");
|
||||
}
|
||||
}
|
||||
|
||||
private ColorStateList f(Context context) {
|
||||
int[][] iArr = new int[3][];
|
||||
int[] iArr2 = new int[3];
|
||||
ColorStateList c = ThemeUtils.c(context, R$attr.colorSwitchThumbNormal);
|
||||
if (c != null && c.isStateful()) {
|
||||
iArr[0] = ThemeUtils.b;
|
||||
iArr2[0] = c.getColorForState(iArr[0], 0);
|
||||
iArr[1] = ThemeUtils.e;
|
||||
iArr2[1] = ThemeUtils.b(context, R$attr.colorControlActivated);
|
||||
iArr[2] = ThemeUtils.f;
|
||||
iArr2[2] = c.getDefaultColor();
|
||||
} else {
|
||||
iArr[0] = ThemeUtils.b;
|
||||
iArr2[0] = ThemeUtils.a(context, R$attr.colorSwitchThumbNormal);
|
||||
iArr[1] = ThemeUtils.e;
|
||||
iArr2[1] = ThemeUtils.b(context, R$attr.colorControlActivated);
|
||||
iArr[2] = ThemeUtils.f;
|
||||
iArr2[2] = ThemeUtils.b(context, R$attr.colorSwitchThumbNormal);
|
||||
}
|
||||
return new ColorStateList(iArr, iArr2);
|
||||
}
|
||||
|
||||
private synchronized Drawable a(Context context, long j2) {
|
||||
LongSparseArray<WeakReference<Drawable.ConstantState>> longSparseArray = this.d.get(context);
|
||||
if (longSparseArray == null) {
|
||||
return null;
|
||||
}
|
||||
WeakReference<Drawable.ConstantState> b = longSparseArray.b(j2);
|
||||
if (b != null) {
|
||||
Drawable.ConstantState constantState = b.get();
|
||||
if (constantState != null) {
|
||||
return constantState.newDrawable(context.getResources());
|
||||
}
|
||||
longSparseArray.a(j2);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private synchronized boolean a(Context context, long j2, Drawable drawable) {
|
||||
Drawable.ConstantState constantState = drawable.getConstantState();
|
||||
if (constantState == null) {
|
||||
return false;
|
||||
}
|
||||
LongSparseArray<WeakReference<Drawable.ConstantState>> longSparseArray = this.d.get(context);
|
||||
if (longSparseArray == null) {
|
||||
longSparseArray = new LongSparseArray<>();
|
||||
this.d.put(context, longSparseArray);
|
||||
}
|
||||
longSparseArray.c(j2, new WeakReference<>(constantState));
|
||||
return true;
|
||||
}
|
||||
|
||||
synchronized Drawable a(Context context, VectorEnabledTintResources vectorEnabledTintResources, int i2) {
|
||||
Drawable f = f(context, i2);
|
||||
if (f == null) {
|
||||
f = vectorEnabledTintResources.a(i2);
|
||||
}
|
||||
if (f == null) {
|
||||
return null;
|
||||
}
|
||||
return a(context, i2, false, f);
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:14:0x0061 A[RETURN] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:6:0x0046 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
static boolean a(android.content.Context r6, int r7, android.graphics.drawable.Drawable r8) {
|
||||
/*
|
||||
android.graphics.PorterDuff$Mode r0 = androidx.appcompat.widget.AppCompatDrawableManager.g
|
||||
int[] r1 = androidx.appcompat.widget.AppCompatDrawableManager.j
|
||||
boolean r1 = a(r1, r7)
|
||||
r2 = 16842801(0x1010031, float:2.3693695E-38)
|
||||
r3 = -1
|
||||
r4 = 0
|
||||
r5 = 1
|
||||
if (r1 == 0) goto L15
|
||||
int r2 = androidx.appcompat.R$attr.colorControlNormal
|
||||
L12:
|
||||
r7 = 1
|
||||
r1 = -1
|
||||
goto L44
|
||||
L15:
|
||||
int[] r1 = androidx.appcompat.widget.AppCompatDrawableManager.l
|
||||
boolean r1 = a(r1, r7)
|
||||
if (r1 == 0) goto L20
|
||||
int r2 = androidx.appcompat.R$attr.colorControlActivated
|
||||
goto L12
|
||||
L20:
|
||||
int[] r1 = androidx.appcompat.widget.AppCompatDrawableManager.m
|
||||
boolean r1 = a(r1, r7)
|
||||
if (r1 == 0) goto L2b
|
||||
android.graphics.PorterDuff$Mode r0 = android.graphics.PorterDuff.Mode.MULTIPLY
|
||||
goto L12
|
||||
L2b:
|
||||
int r1 = androidx.appcompat.R$drawable.abc_list_divider_mtrl_alpha
|
||||
if (r7 != r1) goto L3c
|
||||
r2 = 16842800(0x1010030, float:2.3693693E-38)
|
||||
r7 = 1109603123(0x42233333, float:40.8)
|
||||
int r7 = java.lang.Math.round(r7)
|
||||
r1 = r7
|
||||
r7 = 1
|
||||
goto L44
|
||||
L3c:
|
||||
int r1 = androidx.appcompat.R$drawable.abc_dialog_material_background
|
||||
if (r7 != r1) goto L41
|
||||
goto L12
|
||||
L41:
|
||||
r7 = 0
|
||||
r1 = -1
|
||||
r2 = 0
|
||||
L44:
|
||||
if (r7 == 0) goto L61
|
||||
boolean r7 = androidx.appcompat.widget.DrawableUtils.a(r8)
|
||||
if (r7 == 0) goto L50
|
||||
android.graphics.drawable.Drawable r8 = r8.mutate()
|
||||
L50:
|
||||
int r6 = androidx.appcompat.widget.ThemeUtils.b(r6, r2)
|
||||
android.graphics.PorterDuffColorFilter r6 = a(r6, r0)
|
||||
r8.setColorFilter(r6)
|
||||
if (r1 == r3) goto L60
|
||||
r8.setAlpha(r1)
|
||||
L60:
|
||||
return r5
|
||||
L61:
|
||||
return r4
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AppCompatDrawableManager.a(android.content.Context, int, android.graphics.drawable.Drawable):boolean");
|
||||
}
|
||||
|
||||
private void a(String str, InflateDelegate inflateDelegate) {
|
||||
if (this.b == null) {
|
||||
this.b = new ArrayMap<>();
|
||||
}
|
||||
this.b.put(str, inflateDelegate);
|
||||
}
|
||||
|
||||
private static boolean a(int[] iArr, int i2) {
|
||||
for (int i3 : iArr) {
|
||||
if (i3 == i2) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static PorterDuff.Mode a(int i2) {
|
||||
if (i2 == R$drawable.abc_switch_thumb_material) {
|
||||
return PorterDuff.Mode.MULTIPLY;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void a(Context context, int i2, ColorStateList colorStateList) {
|
||||
if (this.a == null) {
|
||||
this.a = new WeakHashMap<>();
|
||||
}
|
||||
SparseArrayCompat<ColorStateList> sparseArrayCompat = this.a.get(context);
|
||||
if (sparseArrayCompat == null) {
|
||||
sparseArrayCompat = new SparseArrayCompat<>();
|
||||
this.a.put(context, sparseArrayCompat);
|
||||
}
|
||||
sparseArrayCompat.a(i2, colorStateList);
|
||||
}
|
||||
|
||||
static void a(Drawable drawable, TintInfo tintInfo, int[] iArr) {
|
||||
if (DrawableUtils.a(drawable) && drawable.mutate() != drawable) {
|
||||
Log.d("AppCompatDrawableManag", "Mutated drawable is not the same instance as the input.");
|
||||
return;
|
||||
}
|
||||
if (tintInfo.d || tintInfo.c) {
|
||||
drawable.setColorFilter(a(tintInfo.d ? tintInfo.a : null, tintInfo.c ? tintInfo.b : g, iArr));
|
||||
} else {
|
||||
drawable.clearColorFilter();
|
||||
}
|
||||
if (Build.VERSION.SDK_INT <= 23) {
|
||||
drawable.invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
private static PorterDuffColorFilter a(ColorStateList colorStateList, PorterDuff.Mode mode, int[] iArr) {
|
||||
if (colorStateList == null || mode == null) {
|
||||
return null;
|
||||
}
|
||||
return a(colorStateList.getColorForState(iArr, 0), mode);
|
||||
}
|
||||
|
||||
public static synchronized PorterDuffColorFilter a(int i2, PorterDuff.Mode mode) {
|
||||
PorterDuffColorFilter a;
|
||||
synchronized (AppCompatDrawableManager.class) {
|
||||
a = i.a(i2, mode);
|
||||
if (a == null) {
|
||||
a = new PorterDuffColorFilter(i2, mode);
|
||||
i.a(i2, mode, a);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
private static void a(Drawable drawable, int i2, PorterDuff.Mode mode) {
|
||||
if (DrawableUtils.a(drawable)) {
|
||||
drawable = drawable.mutate();
|
||||
}
|
||||
if (mode == null) {
|
||||
mode = g;
|
||||
}
|
||||
drawable.setColorFilter(a(i2, mode));
|
||||
}
|
||||
|
||||
private static boolean a(Drawable drawable) {
|
||||
return (drawable instanceof VectorDrawableCompat) || "android.graphics.drawable.VectorDrawable".equals(drawable.getClass().getName());
|
||||
}
|
||||
}
|
||||
130
sources/androidx/appcompat/widget/AppCompatEditText.java
Normal file
130
sources/androidx/appcompat/widget/AppCompatEditText.java
Normal file
@@ -0,0 +1,130 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.text.Editable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ActionMode;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.widget.EditText;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatEditText extends EditText implements TintableBackgroundView {
|
||||
private final AppCompatBackgroundHelper a;
|
||||
private final AppCompatTextHelper b;
|
||||
|
||||
public AppCompatEditText(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.b();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.c();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
|
||||
InputConnection onCreateInputConnection = super.onCreateInputConnection(editorInfo);
|
||||
AppCompatHintHelper.a(onCreateInputConnection, editorInfo, this);
|
||||
return onCreateInputConnection;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
|
||||
super.setCustomSelectionActionModeCallback(TextViewCompat.a(this, callback));
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.b(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
public AppCompatEditText(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R$attr.editTextStyle);
|
||||
}
|
||||
|
||||
@Override // android.widget.EditText, android.widget.TextView
|
||||
public Editable getText() {
|
||||
return Build.VERSION.SDK_INT >= 28 ? super.getText() : super.getEditableText();
|
||||
}
|
||||
|
||||
public AppCompatEditText(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.b(context), attributeSet, i);
|
||||
this.a = new AppCompatBackgroundHelper(this);
|
||||
this.a.a(attributeSet, i);
|
||||
this.b = new AppCompatTextHelper(this);
|
||||
this.b.a(attributeSet, i);
|
||||
this.b.a();
|
||||
}
|
||||
}
|
||||
26
sources/androidx/appcompat/widget/AppCompatHintHelper.java
Normal file
26
sources/androidx/appcompat/widget/AppCompatHintHelper.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewParent;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatHintHelper {
|
||||
static InputConnection a(InputConnection inputConnection, EditorInfo editorInfo, View view) {
|
||||
if (inputConnection != null && editorInfo.hintText == null) {
|
||||
ViewParent parent = view.getParent();
|
||||
while (true) {
|
||||
if (!(parent instanceof View)) {
|
||||
break;
|
||||
}
|
||||
if (parent instanceof WithHint) {
|
||||
editorInfo.hintText = ((WithHint) parent).a();
|
||||
break;
|
||||
}
|
||||
parent = parent.getParent();
|
||||
}
|
||||
}
|
||||
return inputConnection;
|
||||
}
|
||||
}
|
||||
171
sources/androidx/appcompat/widget/AppCompatImageButton.java
Normal file
171
sources/androidx/appcompat/widget/AppCompatImageButton.java
Normal file
@@ -0,0 +1,171 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageButton;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TintableImageSourceView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatImageButton extends ImageButton implements TintableBackgroundView, TintableImageSourceView {
|
||||
private final AppCompatBackgroundHelper a;
|
||||
private final AppCompatImageHelper b;
|
||||
|
||||
public AppCompatImageButton(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a();
|
||||
}
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.b();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.c();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public ColorStateList getSupportImageTintList() {
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
return appCompatImageHelper.b();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public PorterDuff.Mode getSupportImageTintMode() {
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
return appCompatImageHelper.c();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView, android.view.View
|
||||
public boolean hasOverlappingRendering() {
|
||||
return this.b.d() && super.hasOverlappingRendering();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageBitmap(Bitmap bitmap) {
|
||||
super.setImageBitmap(bitmap);
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageDrawable(Drawable drawable) {
|
||||
super.setImageDrawable(drawable);
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageResource(int i) {
|
||||
this.b.a(i);
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageURI(Uri uri) {
|
||||
super.setImageURI(uri);
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.b(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public void setSupportImageTintList(ColorStateList colorStateList) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public void setSupportImageTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a(mode);
|
||||
}
|
||||
}
|
||||
|
||||
public AppCompatImageButton(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R$attr.imageButtonStyle);
|
||||
}
|
||||
|
||||
public AppCompatImageButton(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.b(context), attributeSet, i);
|
||||
this.a = new AppCompatBackgroundHelper(this);
|
||||
this.a.a(attributeSet, i);
|
||||
this.b = new AppCompatImageHelper(this);
|
||||
this.b.a(attributeSet, i);
|
||||
}
|
||||
}
|
||||
148
sources/androidx/appcompat/widget/AppCompatImageHelper.java
Normal file
148
sources/androidx/appcompat/widget/AppCompatImageHelper.java
Normal file
@@ -0,0 +1,148 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.RippleDrawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
import androidx.appcompat.R$styleable;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.widget.ImageViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatImageHelper {
|
||||
private final ImageView a;
|
||||
private TintInfo b;
|
||||
private TintInfo c;
|
||||
private TintInfo d;
|
||||
|
||||
public AppCompatImageHelper(ImageView imageView) {
|
||||
this.a = imageView;
|
||||
}
|
||||
|
||||
private boolean e() {
|
||||
int i = Build.VERSION.SDK_INT;
|
||||
return i > 21 ? this.b != null : i == 21;
|
||||
}
|
||||
|
||||
public void a(AttributeSet attributeSet, int i) {
|
||||
int g;
|
||||
TintTypedArray a = TintTypedArray.a(this.a.getContext(), attributeSet, R$styleable.AppCompatImageView, i, 0);
|
||||
try {
|
||||
Drawable drawable = this.a.getDrawable();
|
||||
if (drawable == null && (g = a.g(R$styleable.AppCompatImageView_srcCompat, -1)) != -1 && (drawable = AppCompatResources.c(this.a.getContext(), g)) != null) {
|
||||
this.a.setImageDrawable(drawable);
|
||||
}
|
||||
if (drawable != null) {
|
||||
DrawableUtils.b(drawable);
|
||||
}
|
||||
if (a.g(R$styleable.AppCompatImageView_tint)) {
|
||||
ImageViewCompat.a(this.a, a.a(R$styleable.AppCompatImageView_tint));
|
||||
}
|
||||
if (a.g(R$styleable.AppCompatImageView_tintMode)) {
|
||||
ImageViewCompat.a(this.a, DrawableUtils.a(a.d(R$styleable.AppCompatImageView_tintMode, -1), null));
|
||||
}
|
||||
} finally {
|
||||
a.a();
|
||||
}
|
||||
}
|
||||
|
||||
ColorStateList b() {
|
||||
TintInfo tintInfo = this.c;
|
||||
if (tintInfo != null) {
|
||||
return tintInfo.a;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
PorterDuff.Mode c() {
|
||||
TintInfo tintInfo = this.c;
|
||||
if (tintInfo != null) {
|
||||
return tintInfo.b;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
boolean d() {
|
||||
return Build.VERSION.SDK_INT < 21 || !(this.a.getBackground() instanceof RippleDrawable);
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
if (i != 0) {
|
||||
Drawable c = AppCompatResources.c(this.a.getContext(), i);
|
||||
if (c != null) {
|
||||
DrawableUtils.b(c);
|
||||
}
|
||||
this.a.setImageDrawable(c);
|
||||
} else {
|
||||
this.a.setImageDrawable(null);
|
||||
}
|
||||
a();
|
||||
}
|
||||
|
||||
void a(ColorStateList colorStateList) {
|
||||
if (this.c == null) {
|
||||
this.c = new TintInfo();
|
||||
}
|
||||
TintInfo tintInfo = this.c;
|
||||
tintInfo.a = colorStateList;
|
||||
tintInfo.d = true;
|
||||
a();
|
||||
}
|
||||
|
||||
void a(PorterDuff.Mode mode) {
|
||||
if (this.c == null) {
|
||||
this.c = new TintInfo();
|
||||
}
|
||||
TintInfo tintInfo = this.c;
|
||||
tintInfo.b = mode;
|
||||
tintInfo.c = true;
|
||||
a();
|
||||
}
|
||||
|
||||
void a() {
|
||||
Drawable drawable = this.a.getDrawable();
|
||||
if (drawable != null) {
|
||||
DrawableUtils.b(drawable);
|
||||
}
|
||||
if (drawable != null) {
|
||||
if (e() && a(drawable)) {
|
||||
return;
|
||||
}
|
||||
TintInfo tintInfo = this.c;
|
||||
if (tintInfo != null) {
|
||||
AppCompatDrawableManager.a(drawable, tintInfo, this.a.getDrawableState());
|
||||
return;
|
||||
}
|
||||
TintInfo tintInfo2 = this.b;
|
||||
if (tintInfo2 != null) {
|
||||
AppCompatDrawableManager.a(drawable, tintInfo2, this.a.getDrawableState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean a(Drawable drawable) {
|
||||
if (this.d == null) {
|
||||
this.d = new TintInfo();
|
||||
}
|
||||
TintInfo tintInfo = this.d;
|
||||
tintInfo.a();
|
||||
ColorStateList a = ImageViewCompat.a(this.a);
|
||||
if (a != null) {
|
||||
tintInfo.d = true;
|
||||
tintInfo.a = a;
|
||||
}
|
||||
PorterDuff.Mode b = ImageViewCompat.b(this.a);
|
||||
if (b != null) {
|
||||
tintInfo.c = true;
|
||||
tintInfo.b = b;
|
||||
}
|
||||
if (!tintInfo.d && !tintInfo.c) {
|
||||
return false;
|
||||
}
|
||||
AppCompatDrawableManager.a(drawable, tintInfo, this.a.getDrawableState());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
173
sources/androidx/appcompat/widget/AppCompatImageView.java
Normal file
173
sources/androidx/appcompat/widget/AppCompatImageView.java
Normal file
@@ -0,0 +1,173 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TintableImageSourceView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatImageView extends ImageView implements TintableBackgroundView, TintableImageSourceView {
|
||||
private final AppCompatBackgroundHelper a;
|
||||
private final AppCompatImageHelper b;
|
||||
|
||||
public AppCompatImageView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a();
|
||||
}
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.b();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.c();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public ColorStateList getSupportImageTintList() {
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
return appCompatImageHelper.b();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public PorterDuff.Mode getSupportImageTintMode() {
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
return appCompatImageHelper.c();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView, android.view.View
|
||||
public boolean hasOverlappingRendering() {
|
||||
return this.b.d() && super.hasOverlappingRendering();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageBitmap(Bitmap bitmap) {
|
||||
super.setImageBitmap(bitmap);
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageDrawable(Drawable drawable) {
|
||||
super.setImageDrawable(drawable);
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageResource(int i) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageURI(Uri uri) {
|
||||
super.setImageURI(uri);
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.b(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public void setSupportImageTintList(ColorStateList colorStateList) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public void setSupportImageTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.b;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.a(mode);
|
||||
}
|
||||
}
|
||||
|
||||
public AppCompatImageView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public AppCompatImageView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.b(context), attributeSet, i);
|
||||
this.a = new AppCompatBackgroundHelper(this);
|
||||
this.a.a(attributeSet, i);
|
||||
this.b = new AppCompatImageHelper(this);
|
||||
this.b.a(attributeSet, i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.widget.MultiAutoCompleteTextView;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatMultiAutoCompleteTextView extends MultiAutoCompleteTextView implements TintableBackgroundView {
|
||||
private static final int[] c = {R.attr.popupBackground};
|
||||
private final AppCompatBackgroundHelper a;
|
||||
private final AppCompatTextHelper b;
|
||||
|
||||
public AppCompatMultiAutoCompleteTextView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R$attr.autoCompleteTextViewStyle);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.b();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.c();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
|
||||
InputConnection onCreateInputConnection = super.onCreateInputConnection(editorInfo);
|
||||
AppCompatHintHelper.a(onCreateInputConnection, editorInfo, this);
|
||||
return onCreateInputConnection;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.AutoCompleteTextView
|
||||
public void setDropDownBackgroundResource(int i) {
|
||||
setDropDownBackgroundDrawable(AppCompatResources.c(getContext(), i));
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.b(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
public AppCompatMultiAutoCompleteTextView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.b(context), attributeSet, i);
|
||||
TintTypedArray a = TintTypedArray.a(getContext(), attributeSet, c, i, 0);
|
||||
if (a.g(0)) {
|
||||
setDropDownBackgroundDrawable(a.b(0));
|
||||
}
|
||||
a.a();
|
||||
this.a = new AppCompatBackgroundHelper(this);
|
||||
this.a.a(attributeSet, i);
|
||||
this.b = new AppCompatTextHelper(this);
|
||||
this.b.a(attributeSet, i);
|
||||
this.b.a();
|
||||
}
|
||||
}
|
||||
65
sources/androidx/appcompat/widget/AppCompatPopupWindow.java
Normal file
65
sources/androidx/appcompat/widget/AppCompatPopupWindow.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.PopupWindow;
|
||||
import androidx.appcompat.R$styleable;
|
||||
import androidx.core.widget.PopupWindowCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatPopupWindow extends PopupWindow {
|
||||
private static final boolean b;
|
||||
private boolean a;
|
||||
|
||||
static {
|
||||
b = Build.VERSION.SDK_INT < 21;
|
||||
}
|
||||
|
||||
public AppCompatPopupWindow(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
super(context, attributeSet, i, i2);
|
||||
a(context, attributeSet, i, i2);
|
||||
}
|
||||
|
||||
private void a(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
TintTypedArray a = TintTypedArray.a(context, attributeSet, R$styleable.PopupWindow, i, i2);
|
||||
if (a.g(R$styleable.PopupWindow_overlapAnchor)) {
|
||||
a(a.a(R$styleable.PopupWindow_overlapAnchor, false));
|
||||
}
|
||||
setBackgroundDrawable(a.b(R$styleable.PopupWindow_android_popupBackground));
|
||||
a.a();
|
||||
}
|
||||
|
||||
@Override // android.widget.PopupWindow
|
||||
public void showAsDropDown(View view, int i, int i2) {
|
||||
if (b && this.a) {
|
||||
i2 -= view.getHeight();
|
||||
}
|
||||
super.showAsDropDown(view, i, i2);
|
||||
}
|
||||
|
||||
@Override // android.widget.PopupWindow
|
||||
public void update(View view, int i, int i2, int i3, int i4) {
|
||||
if (b && this.a) {
|
||||
i2 -= view.getHeight();
|
||||
}
|
||||
super.update(view, i, i2, i3, i4);
|
||||
}
|
||||
|
||||
@Override // android.widget.PopupWindow
|
||||
public void showAsDropDown(View view, int i, int i2, int i3) {
|
||||
if (b && this.a) {
|
||||
i2 -= view.getHeight();
|
||||
}
|
||||
super.showAsDropDown(view, i, i2, i3);
|
||||
}
|
||||
|
||||
private void a(boolean z) {
|
||||
if (b) {
|
||||
this.a = z;
|
||||
} else {
|
||||
PopupWindowCompat.a(this, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.ClipDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.graphics.drawable.ShapeDrawable;
|
||||
import android.graphics.drawable.shapes.RoundRectShape;
|
||||
import android.graphics.drawable.shapes.Shape;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ProgressBar;
|
||||
import androidx.core.graphics.drawable.WrappedDrawable;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatProgressBarHelper {
|
||||
private static final int[] c = {R.attr.indeterminateDrawable, R.attr.progressDrawable};
|
||||
private final ProgressBar a;
|
||||
private Bitmap b;
|
||||
|
||||
AppCompatProgressBarHelper(ProgressBar progressBar) {
|
||||
this.a = progressBar;
|
||||
}
|
||||
|
||||
private Shape b() {
|
||||
return new RoundRectShape(new float[]{5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f}, null, null);
|
||||
}
|
||||
|
||||
void a(AttributeSet attributeSet, int i) {
|
||||
TintTypedArray a = TintTypedArray.a(this.a.getContext(), attributeSet, c, i, 0);
|
||||
Drawable c2 = a.c(0);
|
||||
if (c2 != null) {
|
||||
this.a.setIndeterminateDrawable(a(c2));
|
||||
}
|
||||
Drawable c3 = a.c(1);
|
||||
if (c3 != null) {
|
||||
this.a.setProgressDrawable(a(c3, false));
|
||||
}
|
||||
a.a();
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
private Drawable a(Drawable drawable, boolean z) {
|
||||
if (drawable instanceof WrappedDrawable) {
|
||||
WrappedDrawable wrappedDrawable = (WrappedDrawable) drawable;
|
||||
Drawable a = wrappedDrawable.a();
|
||||
if (a == null) {
|
||||
return drawable;
|
||||
}
|
||||
wrappedDrawable.a(a(a, z));
|
||||
return drawable;
|
||||
}
|
||||
if (drawable instanceof LayerDrawable) {
|
||||
LayerDrawable layerDrawable = (LayerDrawable) drawable;
|
||||
int numberOfLayers = layerDrawable.getNumberOfLayers();
|
||||
Drawable[] drawableArr = new Drawable[numberOfLayers];
|
||||
for (int i = 0; i < numberOfLayers; i++) {
|
||||
int id = layerDrawable.getId(i);
|
||||
drawableArr[i] = a(layerDrawable.getDrawable(i), id == 16908301 || id == 16908303);
|
||||
}
|
||||
LayerDrawable layerDrawable2 = new LayerDrawable(drawableArr);
|
||||
for (int i2 = 0; i2 < numberOfLayers; i2++) {
|
||||
layerDrawable2.setId(i2, layerDrawable.getId(i2));
|
||||
}
|
||||
return layerDrawable2;
|
||||
}
|
||||
if (!(drawable instanceof BitmapDrawable)) {
|
||||
return drawable;
|
||||
}
|
||||
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
|
||||
Bitmap bitmap = bitmapDrawable.getBitmap();
|
||||
if (this.b == null) {
|
||||
this.b = bitmap;
|
||||
}
|
||||
ShapeDrawable shapeDrawable = new ShapeDrawable(b());
|
||||
shapeDrawable.getPaint().setShader(new BitmapShader(bitmap, Shader.TileMode.REPEAT, Shader.TileMode.CLAMP));
|
||||
shapeDrawable.getPaint().setColorFilter(bitmapDrawable.getPaint().getColorFilter());
|
||||
return z ? new ClipDrawable(shapeDrawable, 3, 1) : shapeDrawable;
|
||||
}
|
||||
|
||||
private Drawable a(Drawable drawable) {
|
||||
if (!(drawable instanceof AnimationDrawable)) {
|
||||
return drawable;
|
||||
}
|
||||
AnimationDrawable animationDrawable = (AnimationDrawable) drawable;
|
||||
int numberOfFrames = animationDrawable.getNumberOfFrames();
|
||||
AnimationDrawable animationDrawable2 = new AnimationDrawable();
|
||||
animationDrawable2.setOneShot(animationDrawable.isOneShot());
|
||||
for (int i = 0; i < numberOfFrames; i++) {
|
||||
Drawable a = a(animationDrawable.getFrame(i), true);
|
||||
a.setLevel(XStream.PRIORITY_VERY_HIGH);
|
||||
animationDrawable2.addFrame(a, animationDrawable.getDuration(i));
|
||||
}
|
||||
animationDrawable2.setLevel(XStream.PRIORITY_VERY_HIGH);
|
||||
return animationDrawable2;
|
||||
}
|
||||
|
||||
Bitmap a() {
|
||||
return this.b;
|
||||
}
|
||||
}
|
||||
82
sources/androidx/appcompat/widget/AppCompatRadioButton.java
Normal file
82
sources/androidx/appcompat/widget/AppCompatRadioButton.java
Normal file
@@ -0,0 +1,82 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.RadioButton;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.widget.TintableCompoundButton;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatRadioButton extends RadioButton implements TintableCompoundButton {
|
||||
private final AppCompatCompoundButtonHelper a;
|
||||
private final AppCompatTextHelper b;
|
||||
|
||||
public AppCompatRadioButton(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R$attr.radioButtonStyle);
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton, android.widget.TextView
|
||||
public int getCompoundPaddingLeft() {
|
||||
int compoundPaddingLeft = super.getCompoundPaddingLeft();
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.a;
|
||||
return appCompatCompoundButtonHelper != null ? appCompatCompoundButtonHelper.a(compoundPaddingLeft) : compoundPaddingLeft;
|
||||
}
|
||||
|
||||
public ColorStateList getSupportButtonTintList() {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.a;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
return appCompatCompoundButtonHelper.b();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PorterDuff.Mode getSupportButtonTintMode() {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.a;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
return appCompatCompoundButtonHelper.c();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton
|
||||
public void setButtonDrawable(Drawable drawable) {
|
||||
super.setButtonDrawable(drawable);
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.a;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.d();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public void setSupportButtonTintList(ColorStateList colorStateList) {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.a;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.a(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public void setSupportButtonTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.a;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.a(mode);
|
||||
}
|
||||
}
|
||||
|
||||
public AppCompatRadioButton(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.b(context), attributeSet, i);
|
||||
this.a = new AppCompatCompoundButtonHelper(this);
|
||||
this.a.a(attributeSet, i);
|
||||
this.b = new AppCompatTextHelper(this);
|
||||
this.b.a(attributeSet, i);
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton
|
||||
public void setButtonDrawable(int i) {
|
||||
setButtonDrawable(AppCompatResources.c(getContext(), i));
|
||||
}
|
||||
}
|
||||
32
sources/androidx/appcompat/widget/AppCompatRatingBar.java
Normal file
32
sources/androidx/appcompat/widget/AppCompatRatingBar.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.RatingBar;
|
||||
import androidx.appcompat.R$attr;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatRatingBar extends RatingBar {
|
||||
private final AppCompatProgressBarHelper a;
|
||||
|
||||
public AppCompatRatingBar(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R$attr.ratingBarStyle);
|
||||
}
|
||||
|
||||
@Override // android.widget.RatingBar, android.widget.AbsSeekBar, android.widget.ProgressBar, android.view.View
|
||||
protected synchronized void onMeasure(int i, int i2) {
|
||||
super.onMeasure(i, i2);
|
||||
Bitmap a = this.a.a();
|
||||
if (a != null) {
|
||||
setMeasuredDimension(View.resolveSizeAndState(a.getWidth() * getNumStars(), i, 0), getMeasuredHeight());
|
||||
}
|
||||
}
|
||||
|
||||
public AppCompatRatingBar(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.a = new AppCompatProgressBarHelper(this);
|
||||
this.a.a(attributeSet, i);
|
||||
}
|
||||
}
|
||||
40
sources/androidx/appcompat/widget/AppCompatSeekBar.java
Normal file
40
sources/androidx/appcompat/widget/AppCompatSeekBar.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.SeekBar;
|
||||
import androidx.appcompat.R$attr;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatSeekBar extends SeekBar {
|
||||
private final AppCompatSeekBarHelper a;
|
||||
|
||||
public AppCompatSeekBar(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R$attr.seekBarStyle);
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsSeekBar, android.widget.ProgressBar, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
this.a.b();
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsSeekBar, android.widget.ProgressBar, android.view.View
|
||||
public void jumpDrawablesToCurrentState() {
|
||||
super.jumpDrawablesToCurrentState();
|
||||
this.a.c();
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsSeekBar, android.widget.ProgressBar, android.view.View
|
||||
protected synchronized void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
this.a.a(canvas);
|
||||
}
|
||||
|
||||
public AppCompatSeekBar(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.a = new AppCompatSeekBarHelper(this);
|
||||
this.a.a(attributeSet, i);
|
||||
}
|
||||
}
|
||||
120
sources/androidx/appcompat/widget/AppCompatSeekBarHelper.java
Normal file
120
sources/androidx/appcompat/widget/AppCompatSeekBarHelper.java
Normal file
@@ -0,0 +1,120 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.SeekBar;
|
||||
import androidx.appcompat.R$styleable;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatSeekBarHelper extends AppCompatProgressBarHelper {
|
||||
private final SeekBar d;
|
||||
private Drawable e;
|
||||
private ColorStateList f;
|
||||
private PorterDuff.Mode g;
|
||||
private boolean h;
|
||||
private boolean i;
|
||||
|
||||
AppCompatSeekBarHelper(SeekBar seekBar) {
|
||||
super(seekBar);
|
||||
this.f = null;
|
||||
this.g = null;
|
||||
this.h = false;
|
||||
this.i = false;
|
||||
this.d = seekBar;
|
||||
}
|
||||
|
||||
private void d() {
|
||||
if (this.e != null) {
|
||||
if (this.h || this.i) {
|
||||
this.e = DrawableCompat.h(this.e.mutate());
|
||||
if (this.h) {
|
||||
DrawableCompat.a(this.e, this.f);
|
||||
}
|
||||
if (this.i) {
|
||||
DrawableCompat.a(this.e, this.g);
|
||||
}
|
||||
if (this.e.isStateful()) {
|
||||
this.e.setState(this.d.getDrawableState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatProgressBarHelper
|
||||
void a(AttributeSet attributeSet, int i) {
|
||||
super.a(attributeSet, i);
|
||||
TintTypedArray a = TintTypedArray.a(this.d.getContext(), attributeSet, R$styleable.AppCompatSeekBar, i, 0);
|
||||
Drawable c = a.c(R$styleable.AppCompatSeekBar_android_thumb);
|
||||
if (c != null) {
|
||||
this.d.setThumb(c);
|
||||
}
|
||||
a(a.b(R$styleable.AppCompatSeekBar_tickMark));
|
||||
if (a.g(R$styleable.AppCompatSeekBar_tickMarkTintMode)) {
|
||||
this.g = DrawableUtils.a(a.d(R$styleable.AppCompatSeekBar_tickMarkTintMode, -1), this.g);
|
||||
this.i = true;
|
||||
}
|
||||
if (a.g(R$styleable.AppCompatSeekBar_tickMarkTint)) {
|
||||
this.f = a.a(R$styleable.AppCompatSeekBar_tickMarkTint);
|
||||
this.h = true;
|
||||
}
|
||||
a.a();
|
||||
d();
|
||||
}
|
||||
|
||||
void b() {
|
||||
Drawable drawable = this.e;
|
||||
if (drawable != null && drawable.isStateful() && drawable.setState(this.d.getDrawableState())) {
|
||||
this.d.invalidateDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
void c() {
|
||||
Drawable drawable = this.e;
|
||||
if (drawable != null) {
|
||||
drawable.jumpToCurrentState();
|
||||
}
|
||||
}
|
||||
|
||||
void a(Drawable drawable) {
|
||||
Drawable drawable2 = this.e;
|
||||
if (drawable2 != null) {
|
||||
drawable2.setCallback(null);
|
||||
}
|
||||
this.e = drawable;
|
||||
if (drawable != null) {
|
||||
drawable.setCallback(this.d);
|
||||
DrawableCompat.a(drawable, ViewCompat.k(this.d));
|
||||
if (drawable.isStateful()) {
|
||||
drawable.setState(this.d.getDrawableState());
|
||||
}
|
||||
d();
|
||||
}
|
||||
this.d.invalidate();
|
||||
}
|
||||
|
||||
void a(Canvas canvas) {
|
||||
if (this.e != null) {
|
||||
int max = this.d.getMax();
|
||||
if (max > 1) {
|
||||
int intrinsicWidth = this.e.getIntrinsicWidth();
|
||||
int intrinsicHeight = this.e.getIntrinsicHeight();
|
||||
int i = intrinsicWidth >= 0 ? intrinsicWidth / 2 : 1;
|
||||
int i2 = intrinsicHeight >= 0 ? intrinsicHeight / 2 : 1;
|
||||
this.e.setBounds(-i, -i2, i, i2);
|
||||
float width = ((this.d.getWidth() - this.d.getPaddingLeft()) - this.d.getPaddingRight()) / max;
|
||||
int save = canvas.save();
|
||||
canvas.translate(this.d.getPaddingLeft(), this.d.getHeight() / 2);
|
||||
for (int i3 = 0; i3 <= max; i3++) {
|
||||
this.e.draw(canvas);
|
||||
canvas.translate(width, 0.0f);
|
||||
}
|
||||
canvas.restoreToCount(save);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
695
sources/androidx/appcompat/widget/AppCompatSpinner.java
Normal file
695
sources/androidx/appcompat/widget/AppCompatSpinner.java
Normal file
@@ -0,0 +1,695 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.database.DataSetObserver;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.SpinnerAdapter;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatSpinner extends Spinner implements TintableBackgroundView {
|
||||
private static final int[] i = {R.attr.spinnerMode};
|
||||
private final AppCompatBackgroundHelper a;
|
||||
private final Context b;
|
||||
private ForwardingListener c;
|
||||
private SpinnerAdapter d;
|
||||
private final boolean e;
|
||||
DropdownPopup f;
|
||||
int g;
|
||||
final Rect h;
|
||||
|
||||
private static class DropDownAdapter implements ListAdapter, SpinnerAdapter {
|
||||
private SpinnerAdapter a;
|
||||
private ListAdapter b;
|
||||
|
||||
public DropDownAdapter(SpinnerAdapter spinnerAdapter, Resources.Theme theme) {
|
||||
this.a = spinnerAdapter;
|
||||
if (spinnerAdapter instanceof ListAdapter) {
|
||||
this.b = (ListAdapter) spinnerAdapter;
|
||||
}
|
||||
if (theme != null) {
|
||||
if (Build.VERSION.SDK_INT >= 23 && (spinnerAdapter instanceof android.widget.ThemedSpinnerAdapter)) {
|
||||
android.widget.ThemedSpinnerAdapter themedSpinnerAdapter = (android.widget.ThemedSpinnerAdapter) spinnerAdapter;
|
||||
if (themedSpinnerAdapter.getDropDownViewTheme() != theme) {
|
||||
themedSpinnerAdapter.setDropDownViewTheme(theme);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (spinnerAdapter instanceof ThemedSpinnerAdapter) {
|
||||
ThemedSpinnerAdapter themedSpinnerAdapter2 = (ThemedSpinnerAdapter) spinnerAdapter;
|
||||
if (themedSpinnerAdapter2.getDropDownViewTheme() == null) {
|
||||
themedSpinnerAdapter2.setDropDownViewTheme(theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ListAdapter
|
||||
public boolean areAllItemsEnabled() {
|
||||
ListAdapter listAdapter = this.b;
|
||||
if (listAdapter != null) {
|
||||
return listAdapter.areAllItemsEnabled();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getCount() {
|
||||
SpinnerAdapter spinnerAdapter = this.a;
|
||||
if (spinnerAdapter == null) {
|
||||
return 0;
|
||||
}
|
||||
return spinnerAdapter.getCount();
|
||||
}
|
||||
|
||||
@Override // android.widget.SpinnerAdapter
|
||||
public View getDropDownView(int i, View view, ViewGroup viewGroup) {
|
||||
SpinnerAdapter spinnerAdapter = this.a;
|
||||
if (spinnerAdapter == null) {
|
||||
return null;
|
||||
}
|
||||
return spinnerAdapter.getDropDownView(i, view, viewGroup);
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public Object getItem(int i) {
|
||||
SpinnerAdapter spinnerAdapter = this.a;
|
||||
if (spinnerAdapter == null) {
|
||||
return null;
|
||||
}
|
||||
return spinnerAdapter.getItem(i);
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public long getItemId(int i) {
|
||||
SpinnerAdapter spinnerAdapter = this.a;
|
||||
if (spinnerAdapter == null) {
|
||||
return -1L;
|
||||
}
|
||||
return spinnerAdapter.getItemId(i);
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getItemViewType(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
return getDropDownView(i, view, viewGroup);
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getViewTypeCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public boolean hasStableIds() {
|
||||
SpinnerAdapter spinnerAdapter = this.a;
|
||||
return spinnerAdapter != null && spinnerAdapter.hasStableIds();
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public boolean isEmpty() {
|
||||
return getCount() == 0;
|
||||
}
|
||||
|
||||
@Override // android.widget.ListAdapter
|
||||
public boolean isEnabled(int i) {
|
||||
ListAdapter listAdapter = this.b;
|
||||
if (listAdapter != null) {
|
||||
return listAdapter.isEnabled(i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public void registerDataSetObserver(DataSetObserver dataSetObserver) {
|
||||
SpinnerAdapter spinnerAdapter = this.a;
|
||||
if (spinnerAdapter != null) {
|
||||
spinnerAdapter.registerDataSetObserver(dataSetObserver);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public void unregisterDataSetObserver(DataSetObserver dataSetObserver) {
|
||||
SpinnerAdapter spinnerAdapter = this.a;
|
||||
if (spinnerAdapter != null) {
|
||||
spinnerAdapter.unregisterDataSetObserver(dataSetObserver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class DropdownPopup extends ListPopupWindow {
|
||||
private CharSequence J;
|
||||
ListAdapter K;
|
||||
private final Rect L;
|
||||
|
||||
public DropdownPopup(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.L = new Rect();
|
||||
a(AppCompatSpinner.this);
|
||||
a(true);
|
||||
f(0);
|
||||
a(new AdapterView.OnItemClickListener(AppCompatSpinner.this) { // from class: androidx.appcompat.widget.AppCompatSpinner.DropdownPopup.1
|
||||
@Override // android.widget.AdapterView.OnItemClickListener
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i2, long j) {
|
||||
AppCompatSpinner.this.setSelection(i2);
|
||||
if (AppCompatSpinner.this.getOnItemClickListener() != null) {
|
||||
DropdownPopup dropdownPopup = DropdownPopup.this;
|
||||
AppCompatSpinner.this.performItemClick(view, i2, dropdownPopup.K.getItemId(i2));
|
||||
}
|
||||
DropdownPopup.this.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
boolean b(View view) {
|
||||
return ViewCompat.w(view) && view.getGlobalVisibleRect(this.L);
|
||||
}
|
||||
|
||||
void l() {
|
||||
Drawable f = f();
|
||||
int i = 0;
|
||||
if (f != null) {
|
||||
f.getPadding(AppCompatSpinner.this.h);
|
||||
i = ViewUtils.a(AppCompatSpinner.this) ? AppCompatSpinner.this.h.right : -AppCompatSpinner.this.h.left;
|
||||
} else {
|
||||
Rect rect = AppCompatSpinner.this.h;
|
||||
rect.right = 0;
|
||||
rect.left = 0;
|
||||
}
|
||||
int paddingLeft = AppCompatSpinner.this.getPaddingLeft();
|
||||
int paddingRight = AppCompatSpinner.this.getPaddingRight();
|
||||
int width = AppCompatSpinner.this.getWidth();
|
||||
AppCompatSpinner appCompatSpinner = AppCompatSpinner.this;
|
||||
int i2 = appCompatSpinner.g;
|
||||
if (i2 == -2) {
|
||||
int a = appCompatSpinner.a((SpinnerAdapter) this.K, f());
|
||||
int i3 = AppCompatSpinner.this.getContext().getResources().getDisplayMetrics().widthPixels;
|
||||
Rect rect2 = AppCompatSpinner.this.h;
|
||||
int i4 = (i3 - rect2.left) - rect2.right;
|
||||
if (a > i4) {
|
||||
a = i4;
|
||||
}
|
||||
b(Math.max(a, (width - paddingLeft) - paddingRight));
|
||||
} else if (i2 == -1) {
|
||||
b((width - paddingLeft) - paddingRight);
|
||||
} else {
|
||||
b(i2);
|
||||
}
|
||||
d(ViewUtils.a(AppCompatSpinner.this) ? i + ((width - paddingRight) - i()) : i + paddingLeft);
|
||||
}
|
||||
|
||||
public CharSequence m() {
|
||||
return this.J;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ListPopupWindow
|
||||
public void a(ListAdapter listAdapter) {
|
||||
super.a(listAdapter);
|
||||
this.K = listAdapter;
|
||||
}
|
||||
|
||||
public void a(CharSequence charSequence) {
|
||||
this.J = charSequence;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ListPopupWindow, androidx.appcompat.view.menu.ShowableListMenu
|
||||
public void a() {
|
||||
ViewTreeObserver viewTreeObserver;
|
||||
boolean c = c();
|
||||
l();
|
||||
e(2);
|
||||
super.a();
|
||||
d().setChoiceMode(1);
|
||||
g(AppCompatSpinner.this.getSelectedItemPosition());
|
||||
if (c || (viewTreeObserver = AppCompatSpinner.this.getViewTreeObserver()) == null) {
|
||||
return;
|
||||
}
|
||||
final ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() { // from class: androidx.appcompat.widget.AppCompatSpinner.DropdownPopup.2
|
||||
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
|
||||
public void onGlobalLayout() {
|
||||
DropdownPopup dropdownPopup = DropdownPopup.this;
|
||||
if (!dropdownPopup.b(AppCompatSpinner.this)) {
|
||||
DropdownPopup.this.dismiss();
|
||||
} else {
|
||||
DropdownPopup.this.l();
|
||||
DropdownPopup.super.a();
|
||||
}
|
||||
}
|
||||
};
|
||||
viewTreeObserver.addOnGlobalLayoutListener(onGlobalLayoutListener);
|
||||
a(new PopupWindow.OnDismissListener() { // from class: androidx.appcompat.widget.AppCompatSpinner.DropdownPopup.3
|
||||
@Override // android.widget.PopupWindow.OnDismissListener
|
||||
public void onDismiss() {
|
||||
ViewTreeObserver viewTreeObserver2 = AppCompatSpinner.this.getViewTreeObserver();
|
||||
if (viewTreeObserver2 != null) {
|
||||
viewTreeObserver2.removeGlobalOnLayoutListener(onGlobalLayoutListener);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public AppCompatSpinner(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R$attr.spinnerStyle);
|
||||
}
|
||||
|
||||
int a(SpinnerAdapter spinnerAdapter, Drawable drawable) {
|
||||
int i2 = 0;
|
||||
if (spinnerAdapter == null) {
|
||||
return 0;
|
||||
}
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 0);
|
||||
int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(getMeasuredHeight(), 0);
|
||||
int max = Math.max(0, getSelectedItemPosition());
|
||||
int min = Math.min(spinnerAdapter.getCount(), max + 15);
|
||||
View view = null;
|
||||
int i3 = 0;
|
||||
for (int max2 = Math.max(0, max - (15 - (min - max))); max2 < min; max2++) {
|
||||
int itemViewType = spinnerAdapter.getItemViewType(max2);
|
||||
if (itemViewType != i2) {
|
||||
view = null;
|
||||
i2 = itemViewType;
|
||||
}
|
||||
view = spinnerAdapter.getView(max2, view, this);
|
||||
if (view.getLayoutParams() == null) {
|
||||
view.setLayoutParams(new ViewGroup.LayoutParams(-2, -2));
|
||||
}
|
||||
view.measure(makeMeasureSpec, makeMeasureSpec2);
|
||||
i3 = Math.max(i3, view.getMeasuredWidth());
|
||||
}
|
||||
if (drawable == null) {
|
||||
return i3;
|
||||
}
|
||||
drawable.getPadding(this.h);
|
||||
Rect rect = this.h;
|
||||
return i3 + rect.left + rect.right;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public int getDropDownHorizontalOffset() {
|
||||
DropdownPopup dropdownPopup = this.f;
|
||||
if (dropdownPopup != null) {
|
||||
return dropdownPopup.g();
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
return super.getDropDownHorizontalOffset();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public int getDropDownVerticalOffset() {
|
||||
DropdownPopup dropdownPopup = this.f;
|
||||
if (dropdownPopup != null) {
|
||||
return dropdownPopup.h();
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
return super.getDropDownVerticalOffset();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public int getDropDownWidth() {
|
||||
if (this.f != null) {
|
||||
return this.g;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
return super.getDropDownWidth();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public Drawable getPopupBackground() {
|
||||
DropdownPopup dropdownPopup = this.f;
|
||||
if (dropdownPopup != null) {
|
||||
return dropdownPopup.f();
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
return super.getPopupBackground();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public Context getPopupContext() {
|
||||
if (this.f != null) {
|
||||
return this.b;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
return super.getPopupContext();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public CharSequence getPrompt() {
|
||||
DropdownPopup dropdownPopup = this.f;
|
||||
return dropdownPopup != null ? dropdownPopup.m() : super.getPrompt();
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.b();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.c();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner, android.widget.AdapterView, android.view.ViewGroup, android.view.View
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
DropdownPopup dropdownPopup = this.f;
|
||||
if (dropdownPopup == null || !dropdownPopup.c()) {
|
||||
return;
|
||||
}
|
||||
this.f.dismiss();
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner, android.widget.AbsSpinner, android.view.View
|
||||
protected void onMeasure(int i2, int i3) {
|
||||
super.onMeasure(i2, i3);
|
||||
if (this.f == null || View.MeasureSpec.getMode(i2) != Integer.MIN_VALUE) {
|
||||
return;
|
||||
}
|
||||
setMeasuredDimension(Math.min(Math.max(getMeasuredWidth(), a(getAdapter(), getBackground())), View.MeasureSpec.getSize(i2)), getMeasuredHeight());
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner, android.view.View
|
||||
public boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
ForwardingListener forwardingListener = this.c;
|
||||
if (forwardingListener == null || !forwardingListener.onTouch(this, motionEvent)) {
|
||||
return super.onTouchEvent(motionEvent);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner, android.view.View
|
||||
public boolean performClick() {
|
||||
DropdownPopup dropdownPopup = this.f;
|
||||
if (dropdownPopup == null) {
|
||||
return super.performClick();
|
||||
}
|
||||
if (dropdownPopup.c()) {
|
||||
return true;
|
||||
}
|
||||
this.f.a();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i2) {
|
||||
super.setBackgroundResource(i2);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(i2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setDropDownHorizontalOffset(int i2) {
|
||||
DropdownPopup dropdownPopup = this.f;
|
||||
if (dropdownPopup != null) {
|
||||
dropdownPopup.d(i2);
|
||||
} else if (Build.VERSION.SDK_INT >= 16) {
|
||||
super.setDropDownHorizontalOffset(i2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setDropDownVerticalOffset(int i2) {
|
||||
DropdownPopup dropdownPopup = this.f;
|
||||
if (dropdownPopup != null) {
|
||||
dropdownPopup.h(i2);
|
||||
} else if (Build.VERSION.SDK_INT >= 16) {
|
||||
super.setDropDownVerticalOffset(i2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setDropDownWidth(int i2) {
|
||||
if (this.f != null) {
|
||||
this.g = i2;
|
||||
} else if (Build.VERSION.SDK_INT >= 16) {
|
||||
super.setDropDownWidth(i2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setPopupBackgroundDrawable(Drawable drawable) {
|
||||
DropdownPopup dropdownPopup = this.f;
|
||||
if (dropdownPopup != null) {
|
||||
dropdownPopup.a(drawable);
|
||||
} else if (Build.VERSION.SDK_INT >= 16) {
|
||||
super.setPopupBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setPopupBackgroundResource(int i2) {
|
||||
setPopupBackgroundDrawable(AppCompatResources.c(getPopupContext(), i2));
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setPrompt(CharSequence charSequence) {
|
||||
DropdownPopup dropdownPopup = this.f;
|
||||
if (dropdownPopup != null) {
|
||||
dropdownPopup.a(charSequence);
|
||||
} else {
|
||||
super.setPrompt(charSequence);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.b(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(mode);
|
||||
}
|
||||
}
|
||||
|
||||
public AppCompatSpinner(Context context, AttributeSet attributeSet, int i2) {
|
||||
this(context, attributeSet, i2, -1);
|
||||
}
|
||||
|
||||
@Override // android.widget.AdapterView
|
||||
public void setAdapter(SpinnerAdapter spinnerAdapter) {
|
||||
if (!this.e) {
|
||||
this.d = spinnerAdapter;
|
||||
return;
|
||||
}
|
||||
super.setAdapter(spinnerAdapter);
|
||||
if (this.f != null) {
|
||||
Context context = this.b;
|
||||
if (context == null) {
|
||||
context = getContext();
|
||||
}
|
||||
this.f.a(new DropDownAdapter(spinnerAdapter, context.getTheme()));
|
||||
}
|
||||
}
|
||||
|
||||
public AppCompatSpinner(Context context, AttributeSet attributeSet, int i2, int i3) {
|
||||
this(context, attributeSet, i2, i3, null);
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:17:0x0056, code lost:
|
||||
|
||||
if (r12 != null) goto L22;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:18:0x0058, code lost:
|
||||
|
||||
r12.recycle();
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:21:0x006a, code lost:
|
||||
|
||||
if (r12 == null) goto L36;
|
||||
*/
|
||||
/* JADX WARN: Removed duplicated region for block: B:25:0x0070 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public AppCompatSpinner(android.content.Context r8, android.util.AttributeSet r9, int r10, int r11, android.content.res.Resources.Theme r12) {
|
||||
/*
|
||||
r7 = this;
|
||||
r7.<init>(r8, r9, r10)
|
||||
android.graphics.Rect r0 = new android.graphics.Rect
|
||||
r0.<init>()
|
||||
r7.h = r0
|
||||
int[] r0 = androidx.appcompat.R$styleable.Spinner
|
||||
r1 = 0
|
||||
androidx.appcompat.widget.TintTypedArray r0 = androidx.appcompat.widget.TintTypedArray.a(r8, r9, r0, r10, r1)
|
||||
androidx.appcompat.widget.AppCompatBackgroundHelper r2 = new androidx.appcompat.widget.AppCompatBackgroundHelper
|
||||
r2.<init>(r7)
|
||||
r7.a = r2
|
||||
r2 = 0
|
||||
if (r12 == 0) goto L23
|
||||
androidx.appcompat.view.ContextThemeWrapper r3 = new androidx.appcompat.view.ContextThemeWrapper
|
||||
r3.<init>(r8, r12)
|
||||
r7.b = r3
|
||||
goto L3e
|
||||
L23:
|
||||
int r12 = androidx.appcompat.R$styleable.Spinner_popupTheme
|
||||
int r12 = r0.g(r12, r1)
|
||||
if (r12 == 0) goto L33
|
||||
androidx.appcompat.view.ContextThemeWrapper r3 = new androidx.appcompat.view.ContextThemeWrapper
|
||||
r3.<init>(r8, r12)
|
||||
r7.b = r3
|
||||
goto L3e
|
||||
L33:
|
||||
int r12 = android.os.Build.VERSION.SDK_INT
|
||||
r3 = 23
|
||||
if (r12 >= r3) goto L3b
|
||||
r12 = r8
|
||||
goto L3c
|
||||
L3b:
|
||||
r12 = r2
|
||||
L3c:
|
||||
r7.b = r12
|
||||
L3e:
|
||||
android.content.Context r12 = r7.b
|
||||
r3 = 1
|
||||
if (r12 == 0) goto Lac
|
||||
r12 = -1
|
||||
if (r11 != r12) goto L74
|
||||
int[] r12 = androidx.appcompat.widget.AppCompatSpinner.i // Catch: java.lang.Throwable -> L5e java.lang.Exception -> L61
|
||||
android.content.res.TypedArray r12 = r8.obtainStyledAttributes(r9, r12, r10, r1) // Catch: java.lang.Throwable -> L5e java.lang.Exception -> L61
|
||||
boolean r4 = r12.hasValue(r1) // Catch: java.lang.Exception -> L5c java.lang.Throwable -> L6d
|
||||
if (r4 == 0) goto L56
|
||||
int r11 = r12.getInt(r1, r1) // Catch: java.lang.Exception -> L5c java.lang.Throwable -> L6d
|
||||
L56:
|
||||
if (r12 == 0) goto L74
|
||||
L58:
|
||||
r12.recycle()
|
||||
goto L74
|
||||
L5c:
|
||||
r4 = move-exception
|
||||
goto L63
|
||||
L5e:
|
||||
r8 = move-exception
|
||||
r12 = r2
|
||||
goto L6e
|
||||
L61:
|
||||
r4 = move-exception
|
||||
r12 = r2
|
||||
L63:
|
||||
java.lang.String r5 = "AppCompatSpinner"
|
||||
java.lang.String r6 = "Could not read android:spinnerMode"
|
||||
android.util.Log.i(r5, r6, r4) // Catch: java.lang.Throwable -> L6d
|
||||
if (r12 == 0) goto L74
|
||||
goto L58
|
||||
L6d:
|
||||
r8 = move-exception
|
||||
L6e:
|
||||
if (r12 == 0) goto L73
|
||||
r12.recycle()
|
||||
L73:
|
||||
throw r8
|
||||
L74:
|
||||
if (r11 != r3) goto Lac
|
||||
androidx.appcompat.widget.AppCompatSpinner$DropdownPopup r11 = new androidx.appcompat.widget.AppCompatSpinner$DropdownPopup
|
||||
android.content.Context r12 = r7.b
|
||||
r11.<init>(r12, r9, r10)
|
||||
android.content.Context r12 = r7.b
|
||||
int[] r4 = androidx.appcompat.R$styleable.Spinner
|
||||
androidx.appcompat.widget.TintTypedArray r12 = androidx.appcompat.widget.TintTypedArray.a(r12, r9, r4, r10, r1)
|
||||
int r1 = androidx.appcompat.R$styleable.Spinner_android_dropDownWidth
|
||||
r4 = -2
|
||||
int r1 = r12.f(r1, r4)
|
||||
r7.g = r1
|
||||
int r1 = androidx.appcompat.R$styleable.Spinner_android_popupBackground
|
||||
android.graphics.drawable.Drawable r1 = r12.b(r1)
|
||||
r11.a(r1)
|
||||
int r1 = androidx.appcompat.R$styleable.Spinner_android_prompt
|
||||
java.lang.String r1 = r0.d(r1)
|
||||
r11.a(r1)
|
||||
r12.a()
|
||||
r7.f = r11
|
||||
androidx.appcompat.widget.AppCompatSpinner$1 r12 = new androidx.appcompat.widget.AppCompatSpinner$1
|
||||
r12.<init>(r7)
|
||||
r7.c = r12
|
||||
Lac:
|
||||
int r11 = androidx.appcompat.R$styleable.Spinner_android_entries
|
||||
java.lang.CharSequence[] r11 = r0.f(r11)
|
||||
if (r11 == 0) goto Lc4
|
||||
android.widget.ArrayAdapter r12 = new android.widget.ArrayAdapter
|
||||
r1 = 17367048(0x1090008, float:2.5162948E-38)
|
||||
r12.<init>(r8, r1, r11)
|
||||
int r8 = androidx.appcompat.R$layout.support_simple_spinner_dropdown_item
|
||||
r12.setDropDownViewResource(r8)
|
||||
r7.setAdapter(r12)
|
||||
Lc4:
|
||||
r0.a()
|
||||
r7.e = r3
|
||||
android.widget.SpinnerAdapter r8 = r7.d
|
||||
if (r8 == 0) goto Ld2
|
||||
r7.setAdapter(r8)
|
||||
r7.d = r2
|
||||
Ld2:
|
||||
androidx.appcompat.widget.AppCompatBackgroundHelper r8 = r7.a
|
||||
r8.a(r9, r10)
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AppCompatSpinner.<init>(android.content.Context, android.util.AttributeSet, int, int, android.content.res.Resources$Theme):void");
|
||||
}
|
||||
}
|
||||
338
sources/androidx/appcompat/widget/AppCompatTextHelper.java
Normal file
338
sources/androidx/appcompat/widget/AppCompatTextHelper.java
Normal file
@@ -0,0 +1,338 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R$styleable;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.core.widget.AutoSizeableTextView;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatTextHelper {
|
||||
private final TextView a;
|
||||
private TintInfo b;
|
||||
private TintInfo c;
|
||||
private TintInfo d;
|
||||
private TintInfo e;
|
||||
private TintInfo f;
|
||||
private TintInfo g;
|
||||
private final AppCompatTextViewAutoSizeHelper h;
|
||||
private int i = 0;
|
||||
private Typeface j;
|
||||
private boolean k;
|
||||
|
||||
AppCompatTextHelper(TextView textView) {
|
||||
this.a = textView;
|
||||
this.h = new AppCompatTextViewAutoSizeHelper(this.a);
|
||||
}
|
||||
|
||||
@SuppressLint({"NewApi"})
|
||||
void a(AttributeSet attributeSet, int i) {
|
||||
ColorStateList colorStateList;
|
||||
ColorStateList colorStateList2;
|
||||
boolean z;
|
||||
boolean z2;
|
||||
Context context = this.a.getContext();
|
||||
AppCompatDrawableManager a = AppCompatDrawableManager.a();
|
||||
TintTypedArray a2 = TintTypedArray.a(context, attributeSet, R$styleable.AppCompatTextHelper, i, 0);
|
||||
int g = a2.g(R$styleable.AppCompatTextHelper_android_textAppearance, -1);
|
||||
if (a2.g(R$styleable.AppCompatTextHelper_android_drawableLeft)) {
|
||||
this.b = a(context, a, a2.g(R$styleable.AppCompatTextHelper_android_drawableLeft, 0));
|
||||
}
|
||||
if (a2.g(R$styleable.AppCompatTextHelper_android_drawableTop)) {
|
||||
this.c = a(context, a, a2.g(R$styleable.AppCompatTextHelper_android_drawableTop, 0));
|
||||
}
|
||||
if (a2.g(R$styleable.AppCompatTextHelper_android_drawableRight)) {
|
||||
this.d = a(context, a, a2.g(R$styleable.AppCompatTextHelper_android_drawableRight, 0));
|
||||
}
|
||||
if (a2.g(R$styleable.AppCompatTextHelper_android_drawableBottom)) {
|
||||
this.e = a(context, a, a2.g(R$styleable.AppCompatTextHelper_android_drawableBottom, 0));
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 17) {
|
||||
if (a2.g(R$styleable.AppCompatTextHelper_android_drawableStart)) {
|
||||
this.f = a(context, a, a2.g(R$styleable.AppCompatTextHelper_android_drawableStart, 0));
|
||||
}
|
||||
if (a2.g(R$styleable.AppCompatTextHelper_android_drawableEnd)) {
|
||||
this.g = a(context, a, a2.g(R$styleable.AppCompatTextHelper_android_drawableEnd, 0));
|
||||
}
|
||||
}
|
||||
a2.a();
|
||||
boolean z3 = this.a.getTransformationMethod() instanceof PasswordTransformationMethod;
|
||||
boolean z4 = true;
|
||||
if (g != -1) {
|
||||
TintTypedArray a3 = TintTypedArray.a(context, g, R$styleable.TextAppearance);
|
||||
if (z3 || !a3.g(R$styleable.TextAppearance_textAllCaps)) {
|
||||
z = false;
|
||||
z2 = false;
|
||||
} else {
|
||||
z2 = a3.a(R$styleable.TextAppearance_textAllCaps, false);
|
||||
z = true;
|
||||
}
|
||||
a(context, a3);
|
||||
if (Build.VERSION.SDK_INT < 23) {
|
||||
ColorStateList a4 = a3.g(R$styleable.TextAppearance_android_textColor) ? a3.a(R$styleable.TextAppearance_android_textColor) : null;
|
||||
colorStateList2 = a3.g(R$styleable.TextAppearance_android_textColorHint) ? a3.a(R$styleable.TextAppearance_android_textColorHint) : null;
|
||||
ColorStateList colorStateList3 = a4;
|
||||
colorStateList = a3.g(R$styleable.TextAppearance_android_textColorLink) ? a3.a(R$styleable.TextAppearance_android_textColorLink) : null;
|
||||
r10 = colorStateList3;
|
||||
} else {
|
||||
colorStateList = null;
|
||||
colorStateList2 = null;
|
||||
}
|
||||
a3.a();
|
||||
} else {
|
||||
colorStateList = null;
|
||||
colorStateList2 = null;
|
||||
z = false;
|
||||
z2 = false;
|
||||
}
|
||||
TintTypedArray a5 = TintTypedArray.a(context, attributeSet, R$styleable.TextAppearance, i, 0);
|
||||
if (z3 || !a5.g(R$styleable.TextAppearance_textAllCaps)) {
|
||||
z4 = z;
|
||||
} else {
|
||||
z2 = a5.a(R$styleable.TextAppearance_textAllCaps, false);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT < 23) {
|
||||
if (a5.g(R$styleable.TextAppearance_android_textColor)) {
|
||||
r10 = a5.a(R$styleable.TextAppearance_android_textColor);
|
||||
}
|
||||
if (a5.g(R$styleable.TextAppearance_android_textColorHint)) {
|
||||
colorStateList2 = a5.a(R$styleable.TextAppearance_android_textColorHint);
|
||||
}
|
||||
if (a5.g(R$styleable.TextAppearance_android_textColorLink)) {
|
||||
colorStateList = a5.a(R$styleable.TextAppearance_android_textColorLink);
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 28 && a5.g(R$styleable.TextAppearance_android_textSize) && a5.c(R$styleable.TextAppearance_android_textSize, -1) == 0) {
|
||||
this.a.setTextSize(0, 0.0f);
|
||||
}
|
||||
a(context, a5);
|
||||
a5.a();
|
||||
if (r10 != null) {
|
||||
this.a.setTextColor(r10);
|
||||
}
|
||||
if (colorStateList2 != null) {
|
||||
this.a.setHintTextColor(colorStateList2);
|
||||
}
|
||||
if (colorStateList != null) {
|
||||
this.a.setLinkTextColor(colorStateList);
|
||||
}
|
||||
if (!z3 && z4) {
|
||||
a(z2);
|
||||
}
|
||||
Typeface typeface = this.j;
|
||||
if (typeface != null) {
|
||||
this.a.setTypeface(typeface, this.i);
|
||||
}
|
||||
this.h.a(attributeSet, i);
|
||||
if (AutoSizeableTextView.w && this.h.f() != 0) {
|
||||
int[] e = this.h.e();
|
||||
if (e.length > 0) {
|
||||
if (this.a.getAutoSizeStepGranularity() != -1.0f) {
|
||||
this.a.setAutoSizeTextTypeUniformWithConfiguration(this.h.c(), this.h.b(), this.h.d(), 0);
|
||||
} else {
|
||||
this.a.setAutoSizeTextTypeUniformWithPresetSizes(e, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
TintTypedArray a6 = TintTypedArray.a(context, attributeSet, R$styleable.AppCompatTextView);
|
||||
int c = a6.c(R$styleable.AppCompatTextView_firstBaselineToTopHeight, -1);
|
||||
int c2 = a6.c(R$styleable.AppCompatTextView_lastBaselineToBottomHeight, -1);
|
||||
int c3 = a6.c(R$styleable.AppCompatTextView_lineHeight, -1);
|
||||
a6.a();
|
||||
if (c != -1) {
|
||||
TextViewCompat.a(this.a, c);
|
||||
}
|
||||
if (c2 != -1) {
|
||||
TextViewCompat.b(this.a, c2);
|
||||
}
|
||||
if (c3 != -1) {
|
||||
TextViewCompat.c(this.a, c3);
|
||||
}
|
||||
}
|
||||
|
||||
void b() {
|
||||
this.h.a();
|
||||
}
|
||||
|
||||
int c() {
|
||||
return this.h.b();
|
||||
}
|
||||
|
||||
int d() {
|
||||
return this.h.c();
|
||||
}
|
||||
|
||||
int e() {
|
||||
return this.h.d();
|
||||
}
|
||||
|
||||
int[] f() {
|
||||
return this.h.e();
|
||||
}
|
||||
|
||||
int g() {
|
||||
return this.h.f();
|
||||
}
|
||||
|
||||
boolean h() {
|
||||
return this.h.g();
|
||||
}
|
||||
|
||||
private void b(int i, float f) {
|
||||
this.h.a(i, f);
|
||||
}
|
||||
|
||||
private void a(Context context, TintTypedArray tintTypedArray) {
|
||||
String d;
|
||||
this.i = tintTypedArray.d(R$styleable.TextAppearance_android_textStyle, this.i);
|
||||
if (!tintTypedArray.g(R$styleable.TextAppearance_android_fontFamily) && !tintTypedArray.g(R$styleable.TextAppearance_fontFamily)) {
|
||||
if (tintTypedArray.g(R$styleable.TextAppearance_android_typeface)) {
|
||||
this.k = false;
|
||||
int d2 = tintTypedArray.d(R$styleable.TextAppearance_android_typeface, 1);
|
||||
if (d2 == 1) {
|
||||
this.j = Typeface.SANS_SERIF;
|
||||
return;
|
||||
} else if (d2 == 2) {
|
||||
this.j = Typeface.SERIF;
|
||||
return;
|
||||
} else {
|
||||
if (d2 != 3) {
|
||||
return;
|
||||
}
|
||||
this.j = Typeface.MONOSPACE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.j = null;
|
||||
int i = tintTypedArray.g(R$styleable.TextAppearance_fontFamily) ? R$styleable.TextAppearance_fontFamily : R$styleable.TextAppearance_android_fontFamily;
|
||||
if (!context.isRestricted()) {
|
||||
final WeakReference weakReference = new WeakReference(this.a);
|
||||
try {
|
||||
this.j = tintTypedArray.a(i, this.i, new ResourcesCompat.FontCallback() { // from class: androidx.appcompat.widget.AppCompatTextHelper.1
|
||||
@Override // androidx.core.content.res.ResourcesCompat.FontCallback
|
||||
public void a(int i2) {
|
||||
}
|
||||
|
||||
@Override // androidx.core.content.res.ResourcesCompat.FontCallback
|
||||
public void a(Typeface typeface) {
|
||||
AppCompatTextHelper.this.a(weakReference, typeface);
|
||||
}
|
||||
});
|
||||
this.k = this.j == null;
|
||||
} catch (Resources.NotFoundException | UnsupportedOperationException unused) {
|
||||
}
|
||||
}
|
||||
if (this.j != null || (d = tintTypedArray.d(i)) == null) {
|
||||
return;
|
||||
}
|
||||
this.j = Typeface.create(d, this.i);
|
||||
}
|
||||
|
||||
void a(WeakReference<TextView> weakReference, Typeface typeface) {
|
||||
if (this.k) {
|
||||
this.j = typeface;
|
||||
TextView textView = weakReference.get();
|
||||
if (textView != null) {
|
||||
textView.setTypeface(typeface, this.i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void a(Context context, int i) {
|
||||
ColorStateList a;
|
||||
TintTypedArray a2 = TintTypedArray.a(context, i, R$styleable.TextAppearance);
|
||||
if (a2.g(R$styleable.TextAppearance_textAllCaps)) {
|
||||
a(a2.a(R$styleable.TextAppearance_textAllCaps, false));
|
||||
}
|
||||
if (Build.VERSION.SDK_INT < 23 && a2.g(R$styleable.TextAppearance_android_textColor) && (a = a2.a(R$styleable.TextAppearance_android_textColor)) != null) {
|
||||
this.a.setTextColor(a);
|
||||
}
|
||||
if (a2.g(R$styleable.TextAppearance_android_textSize) && a2.c(R$styleable.TextAppearance_android_textSize, -1) == 0) {
|
||||
this.a.setTextSize(0, 0.0f);
|
||||
}
|
||||
a(context, a2);
|
||||
a2.a();
|
||||
Typeface typeface = this.j;
|
||||
if (typeface != null) {
|
||||
this.a.setTypeface(typeface, this.i);
|
||||
}
|
||||
}
|
||||
|
||||
void a(boolean z) {
|
||||
this.a.setAllCaps(z);
|
||||
}
|
||||
|
||||
void a() {
|
||||
if (this.b != null || this.c != null || this.d != null || this.e != null) {
|
||||
Drawable[] compoundDrawables = this.a.getCompoundDrawables();
|
||||
a(compoundDrawables[0], this.b);
|
||||
a(compoundDrawables[1], this.c);
|
||||
a(compoundDrawables[2], this.d);
|
||||
a(compoundDrawables[3], this.e);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 17) {
|
||||
if (this.f == null && this.g == null) {
|
||||
return;
|
||||
}
|
||||
Drawable[] compoundDrawablesRelative = this.a.getCompoundDrawablesRelative();
|
||||
a(compoundDrawablesRelative[0], this.f);
|
||||
a(compoundDrawablesRelative[2], this.g);
|
||||
}
|
||||
}
|
||||
|
||||
private void a(Drawable drawable, TintInfo tintInfo) {
|
||||
if (drawable == null || tintInfo == null) {
|
||||
return;
|
||||
}
|
||||
AppCompatDrawableManager.a(drawable, tintInfo, this.a.getDrawableState());
|
||||
}
|
||||
|
||||
private static TintInfo a(Context context, AppCompatDrawableManager appCompatDrawableManager, int i) {
|
||||
ColorStateList b = appCompatDrawableManager.b(context, i);
|
||||
if (b == null) {
|
||||
return null;
|
||||
}
|
||||
TintInfo tintInfo = new TintInfo();
|
||||
tintInfo.d = true;
|
||||
tintInfo.a = b;
|
||||
return tintInfo;
|
||||
}
|
||||
|
||||
void a(boolean z, int i, int i2, int i3, int i4) {
|
||||
if (AutoSizeableTextView.w) {
|
||||
return;
|
||||
}
|
||||
b();
|
||||
}
|
||||
|
||||
void a(int i, float f) {
|
||||
if (AutoSizeableTextView.w || h()) {
|
||||
return;
|
||||
}
|
||||
b(i, f);
|
||||
}
|
||||
|
||||
void a(int i) {
|
||||
this.h.a(i);
|
||||
}
|
||||
|
||||
void a(int i, int i2, int i3, int i4) throws IllegalArgumentException {
|
||||
this.h.a(i, i2, i3, i4);
|
||||
}
|
||||
|
||||
void a(int[] iArr, int i) throws IllegalArgumentException {
|
||||
this.h.a(iArr, i);
|
||||
}
|
||||
}
|
||||
326
sources/androidx/appcompat/widget/AppCompatTextView.java
Normal file
326
sources/androidx/appcompat/widget/AppCompatTextView.java
Normal file
@@ -0,0 +1,326 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ActionMode;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.widget.TextView;
|
||||
import androidx.core.text.PrecomputedTextCompat;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.AutoSizeableTextView;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatTextView extends TextView implements TintableBackgroundView, AutoSizeableTextView {
|
||||
private final AppCompatBackgroundHelper a;
|
||||
private final AppCompatTextHelper b;
|
||||
private Future<PrecomputedTextCompat> c;
|
||||
|
||||
public AppCompatTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
private void d() {
|
||||
Future<PrecomputedTextCompat> future = this.c;
|
||||
if (future != null) {
|
||||
try {
|
||||
this.c = null;
|
||||
TextViewCompat.a(this, future.get());
|
||||
} catch (InterruptedException | ExecutionException unused) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public int getAutoSizeMaxTextSize() {
|
||||
if (AutoSizeableTextView.w) {
|
||||
return super.getAutoSizeMaxTextSize();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.c();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public int getAutoSizeMinTextSize() {
|
||||
if (AutoSizeableTextView.w) {
|
||||
return super.getAutoSizeMinTextSize();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.d();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public int getAutoSizeStepGranularity() {
|
||||
if (AutoSizeableTextView.w) {
|
||||
return super.getAutoSizeStepGranularity();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.e();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public int[] getAutoSizeTextAvailableSizes() {
|
||||
if (AutoSizeableTextView.w) {
|
||||
return super.getAutoSizeTextAvailableSizes();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
return appCompatTextHelper != null ? appCompatTextHelper.f() : new int[0];
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public int getAutoSizeTextType() {
|
||||
if (AutoSizeableTextView.w) {
|
||||
return super.getAutoSizeTextType() == 1 ? 1 : 0;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.g();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public int getFirstBaselineToTopHeight() {
|
||||
return TextViewCompat.b(this);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public int getLastBaselineToBottomHeight() {
|
||||
return TextViewCompat.c(this);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.b();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.c();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public CharSequence getText() {
|
||||
d();
|
||||
return super.getText();
|
||||
}
|
||||
|
||||
public PrecomputedTextCompat.Params getTextMetricsParamsCompat() {
|
||||
return TextViewCompat.f(this);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
|
||||
InputConnection onCreateInputConnection = super.onCreateInputConnection(editorInfo);
|
||||
AppCompatHintHelper.a(onCreateInputConnection, editorInfo, this);
|
||||
return onCreateInputConnection;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
super.onLayout(z, i, i2, i3, i4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(z, i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
d();
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
protected void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
||||
super.onTextChanged(charSequence, i, i2, i3);
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper == null || AutoSizeableTextView.w || !appCompatTextHelper.h()) {
|
||||
return;
|
||||
}
|
||||
this.b.b();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setAutoSizeTextTypeUniformWithConfiguration(int i, int i2, int i3, int i4) throws IllegalArgumentException {
|
||||
if (AutoSizeableTextView.w) {
|
||||
super.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setAutoSizeTextTypeUniformWithPresetSizes(int[] iArr, int i) throws IllegalArgumentException {
|
||||
if (AutoSizeableTextView.w) {
|
||||
super.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(iArr, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setAutoSizeTextTypeWithDefaults(int i) {
|
||||
if (AutoSizeableTextView.w) {
|
||||
super.setAutoSizeTextTypeWithDefaults(i);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
|
||||
super.setCustomSelectionActionModeCallback(TextViewCompat.a(this, callback));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setFirstBaselineToTopHeight(int i) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
super.setFirstBaselineToTopHeight(i);
|
||||
} else {
|
||||
TextViewCompat.a(this, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setLastBaselineToBottomHeight(int i) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
super.setLastBaselineToBottomHeight(i);
|
||||
} else {
|
||||
TextViewCompat.b(this, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setLineHeight(int i) {
|
||||
TextViewCompat.c(this, i);
|
||||
}
|
||||
|
||||
public void setPrecomputedText(PrecomputedTextCompat precomputedTextCompat) {
|
||||
TextViewCompat.a(this, precomputedTextCompat);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.b(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.a;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.a(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTextFuture(Future<PrecomputedTextCompat> future) {
|
||||
this.c = future;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public void setTextMetricsParamsCompat(PrecomputedTextCompat.Params params) {
|
||||
TextViewCompat.a(this, params);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextSize(int i, float f) {
|
||||
if (AutoSizeableTextView.w) {
|
||||
super.setTextSize(i, f);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.b;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.a(i, f);
|
||||
}
|
||||
}
|
||||
|
||||
public AppCompatTextView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.textViewStyle);
|
||||
}
|
||||
|
||||
public AppCompatTextView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.b(context), attributeSet, i);
|
||||
this.a = new AppCompatBackgroundHelper(this);
|
||||
this.a.a(attributeSet, i);
|
||||
this.b = new AppCompatTextHelper(this);
|
||||
this.b.a(attributeSet, i);
|
||||
this.b.a();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,419 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.RectF;
|
||||
import android.os.Build;
|
||||
import android.text.Layout;
|
||||
import android.text.StaticLayout;
|
||||
import android.text.TextDirectionHeuristic;
|
||||
import android.text.TextDirectionHeuristics;
|
||||
import android.text.TextPaint;
|
||||
import android.text.method.TransformationMethod;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R$styleable;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatTextViewAutoSizeHelper {
|
||||
private static final RectF k = new RectF();
|
||||
private static ConcurrentHashMap<String, Method> l = new ConcurrentHashMap<>();
|
||||
private int a = 0;
|
||||
private boolean b = false;
|
||||
private float c = -1.0f;
|
||||
private float d = -1.0f;
|
||||
private float e = -1.0f;
|
||||
private int[] f = new int[0];
|
||||
private boolean g = false;
|
||||
private TextPaint h;
|
||||
private final TextView i;
|
||||
private final Context j;
|
||||
|
||||
AppCompatTextViewAutoSizeHelper(TextView textView) {
|
||||
this.i = textView;
|
||||
this.j = this.i.getContext();
|
||||
}
|
||||
|
||||
private void h() {
|
||||
this.a = 0;
|
||||
this.d = -1.0f;
|
||||
this.e = -1.0f;
|
||||
this.c = -1.0f;
|
||||
this.f = new int[0];
|
||||
this.b = false;
|
||||
}
|
||||
|
||||
private boolean i() {
|
||||
if (k() && this.a == 1) {
|
||||
if (!this.g || this.f.length == 0) {
|
||||
float round = Math.round(this.d);
|
||||
int i = 1;
|
||||
while (Math.round(this.c + round) <= Math.round(this.e)) {
|
||||
i++;
|
||||
round += this.c;
|
||||
}
|
||||
int[] iArr = new int[i];
|
||||
float f = this.d;
|
||||
for (int i2 = 0; i2 < i; i2++) {
|
||||
iArr[i2] = Math.round(f);
|
||||
f += this.c;
|
||||
}
|
||||
this.f = a(iArr);
|
||||
}
|
||||
this.b = true;
|
||||
} else {
|
||||
this.b = false;
|
||||
}
|
||||
return this.b;
|
||||
}
|
||||
|
||||
private boolean j() {
|
||||
this.g = this.f.length > 0;
|
||||
if (this.g) {
|
||||
this.a = 1;
|
||||
int[] iArr = this.f;
|
||||
this.d = iArr[0];
|
||||
this.e = iArr[r0 - 1];
|
||||
this.c = -1.0f;
|
||||
}
|
||||
return this.g;
|
||||
}
|
||||
|
||||
private boolean k() {
|
||||
return !(this.i instanceof AppCompatEditText);
|
||||
}
|
||||
|
||||
void a(AttributeSet attributeSet, int i) {
|
||||
int resourceId;
|
||||
TypedArray obtainStyledAttributes = this.j.obtainStyledAttributes(attributeSet, R$styleable.AppCompatTextView, i, 0);
|
||||
if (obtainStyledAttributes.hasValue(R$styleable.AppCompatTextView_autoSizeTextType)) {
|
||||
this.a = obtainStyledAttributes.getInt(R$styleable.AppCompatTextView_autoSizeTextType, 0);
|
||||
}
|
||||
float dimension = obtainStyledAttributes.hasValue(R$styleable.AppCompatTextView_autoSizeStepGranularity) ? obtainStyledAttributes.getDimension(R$styleable.AppCompatTextView_autoSizeStepGranularity, -1.0f) : -1.0f;
|
||||
float dimension2 = obtainStyledAttributes.hasValue(R$styleable.AppCompatTextView_autoSizeMinTextSize) ? obtainStyledAttributes.getDimension(R$styleable.AppCompatTextView_autoSizeMinTextSize, -1.0f) : -1.0f;
|
||||
float dimension3 = obtainStyledAttributes.hasValue(R$styleable.AppCompatTextView_autoSizeMaxTextSize) ? obtainStyledAttributes.getDimension(R$styleable.AppCompatTextView_autoSizeMaxTextSize, -1.0f) : -1.0f;
|
||||
if (obtainStyledAttributes.hasValue(R$styleable.AppCompatTextView_autoSizePresetSizes) && (resourceId = obtainStyledAttributes.getResourceId(R$styleable.AppCompatTextView_autoSizePresetSizes, 0)) > 0) {
|
||||
TypedArray obtainTypedArray = obtainStyledAttributes.getResources().obtainTypedArray(resourceId);
|
||||
a(obtainTypedArray);
|
||||
obtainTypedArray.recycle();
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
if (!k()) {
|
||||
this.a = 0;
|
||||
return;
|
||||
}
|
||||
if (this.a == 1) {
|
||||
if (!this.g) {
|
||||
DisplayMetrics displayMetrics = this.j.getResources().getDisplayMetrics();
|
||||
if (dimension2 == -1.0f) {
|
||||
dimension2 = TypedValue.applyDimension(2, 12.0f, displayMetrics);
|
||||
}
|
||||
if (dimension3 == -1.0f) {
|
||||
dimension3 = TypedValue.applyDimension(2, 112.0f, displayMetrics);
|
||||
}
|
||||
if (dimension == -1.0f) {
|
||||
dimension = 1.0f;
|
||||
}
|
||||
a(dimension2, dimension3, dimension);
|
||||
}
|
||||
i();
|
||||
}
|
||||
}
|
||||
|
||||
int b() {
|
||||
return Math.round(this.e);
|
||||
}
|
||||
|
||||
int c() {
|
||||
return Math.round(this.d);
|
||||
}
|
||||
|
||||
int d() {
|
||||
return Math.round(this.c);
|
||||
}
|
||||
|
||||
int[] e() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
int f() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
boolean g() {
|
||||
return k() && this.a != 0;
|
||||
}
|
||||
|
||||
void a(int i) {
|
||||
if (k()) {
|
||||
if (i == 0) {
|
||||
h();
|
||||
return;
|
||||
}
|
||||
if (i == 1) {
|
||||
DisplayMetrics displayMetrics = this.j.getResources().getDisplayMetrics();
|
||||
a(TypedValue.applyDimension(2, 12.0f, displayMetrics), TypedValue.applyDimension(2, 112.0f, displayMetrics), 1.0f);
|
||||
if (i()) {
|
||||
a();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown auto-size text type: " + i);
|
||||
}
|
||||
}
|
||||
|
||||
void a(int i, int i2, int i3, int i4) throws IllegalArgumentException {
|
||||
if (k()) {
|
||||
DisplayMetrics displayMetrics = this.j.getResources().getDisplayMetrics();
|
||||
a(TypedValue.applyDimension(i4, i, displayMetrics), TypedValue.applyDimension(i4, i2, displayMetrics), TypedValue.applyDimension(i4, i3, displayMetrics));
|
||||
if (i()) {
|
||||
a();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void a(int[] iArr, int i) throws IllegalArgumentException {
|
||||
if (k()) {
|
||||
int length = iArr.length;
|
||||
if (length > 0) {
|
||||
int[] iArr2 = new int[length];
|
||||
if (i == 0) {
|
||||
iArr2 = Arrays.copyOf(iArr, length);
|
||||
} else {
|
||||
DisplayMetrics displayMetrics = this.j.getResources().getDisplayMetrics();
|
||||
for (int i2 = 0; i2 < length; i2++) {
|
||||
iArr2[i2] = Math.round(TypedValue.applyDimension(i, iArr[i2], displayMetrics));
|
||||
}
|
||||
}
|
||||
this.f = a(iArr2);
|
||||
if (!j()) {
|
||||
throw new IllegalArgumentException("None of the preset sizes is valid: " + Arrays.toString(iArr));
|
||||
}
|
||||
} else {
|
||||
this.g = false;
|
||||
}
|
||||
if (i()) {
|
||||
a();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void a(TypedArray typedArray) {
|
||||
int length = typedArray.length();
|
||||
int[] iArr = new int[length];
|
||||
if (length > 0) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
iArr[i] = typedArray.getDimensionPixelSize(i, -1);
|
||||
}
|
||||
this.f = a(iArr);
|
||||
j();
|
||||
}
|
||||
}
|
||||
|
||||
private int[] a(int[] iArr) {
|
||||
int length = iArr.length;
|
||||
if (length == 0) {
|
||||
return iArr;
|
||||
}
|
||||
Arrays.sort(iArr);
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (int i : iArr) {
|
||||
if (i > 0 && Collections.binarySearch(arrayList, Integer.valueOf(i)) < 0) {
|
||||
arrayList.add(Integer.valueOf(i));
|
||||
}
|
||||
}
|
||||
if (length == arrayList.size()) {
|
||||
return iArr;
|
||||
}
|
||||
int size = arrayList.size();
|
||||
int[] iArr2 = new int[size];
|
||||
for (int i2 = 0; i2 < size; i2++) {
|
||||
iArr2[i2] = ((Integer) arrayList.get(i2)).intValue();
|
||||
}
|
||||
return iArr2;
|
||||
}
|
||||
|
||||
private void a(float f, float f2, float f3) throws IllegalArgumentException {
|
||||
if (f <= 0.0f) {
|
||||
throw new IllegalArgumentException("Minimum auto-size text size (" + f + "px) is less or equal to (0px)");
|
||||
}
|
||||
if (f2 <= f) {
|
||||
throw new IllegalArgumentException("Maximum auto-size text size (" + f2 + "px) is less or equal to minimum auto-size text size (" + f + "px)");
|
||||
}
|
||||
if (f3 > 0.0f) {
|
||||
this.a = 1;
|
||||
this.d = f;
|
||||
this.e = f2;
|
||||
this.c = f3;
|
||||
this.g = false;
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException("The auto-size step granularity (" + f3 + "px) is less or equal to (0px)");
|
||||
}
|
||||
|
||||
void a() {
|
||||
if (g()) {
|
||||
if (this.b) {
|
||||
if (this.i.getMeasuredHeight() <= 0 || this.i.getMeasuredWidth() <= 0) {
|
||||
return;
|
||||
}
|
||||
int measuredWidth = ((Boolean) a((Object) this.i, "getHorizontallyScrolling", (String) false)).booleanValue() ? 1048576 : (this.i.getMeasuredWidth() - this.i.getTotalPaddingLeft()) - this.i.getTotalPaddingRight();
|
||||
int height = (this.i.getHeight() - this.i.getCompoundPaddingBottom()) - this.i.getCompoundPaddingTop();
|
||||
if (measuredWidth <= 0 || height <= 0) {
|
||||
return;
|
||||
}
|
||||
synchronized (k) {
|
||||
k.setEmpty();
|
||||
k.right = measuredWidth;
|
||||
k.bottom = height;
|
||||
float a = a(k);
|
||||
if (a != this.i.getTextSize()) {
|
||||
a(0, a);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.b = true;
|
||||
}
|
||||
}
|
||||
|
||||
void a(int i, float f) {
|
||||
Resources resources;
|
||||
Context context = this.j;
|
||||
if (context == null) {
|
||||
resources = Resources.getSystem();
|
||||
} else {
|
||||
resources = context.getResources();
|
||||
}
|
||||
a(TypedValue.applyDimension(i, f, resources.getDisplayMetrics()));
|
||||
}
|
||||
|
||||
private void a(float f) {
|
||||
if (f != this.i.getPaint().getTextSize()) {
|
||||
this.i.getPaint().setTextSize(f);
|
||||
boolean isInLayout = Build.VERSION.SDK_INT >= 18 ? this.i.isInLayout() : false;
|
||||
if (this.i.getLayout() != null) {
|
||||
this.b = false;
|
||||
try {
|
||||
Method a = a("nullLayouts");
|
||||
if (a != null) {
|
||||
a.invoke(this.i, new Object[0]);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.w("ACTVAutoSizeHelper", "Failed to invoke TextView#nullLayouts() method", e);
|
||||
}
|
||||
if (!isInLayout) {
|
||||
this.i.requestLayout();
|
||||
} else {
|
||||
this.i.forceLayout();
|
||||
}
|
||||
this.i.invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int a(RectF rectF) {
|
||||
int length = this.f.length;
|
||||
if (length != 0) {
|
||||
int i = length - 1;
|
||||
int i2 = 1;
|
||||
int i3 = 0;
|
||||
while (i2 <= i) {
|
||||
int i4 = (i2 + i) / 2;
|
||||
if (a(this.f[i4], rectF)) {
|
||||
int i5 = i4 + 1;
|
||||
i3 = i2;
|
||||
i2 = i5;
|
||||
} else {
|
||||
i3 = i4 - 1;
|
||||
i = i3;
|
||||
}
|
||||
}
|
||||
return this.f[i3];
|
||||
}
|
||||
throw new IllegalStateException("No available text sizes to choose from.");
|
||||
}
|
||||
|
||||
private boolean a(int i, RectF rectF) {
|
||||
StaticLayout a;
|
||||
CharSequence transformation;
|
||||
CharSequence text = this.i.getText();
|
||||
TransformationMethod transformationMethod = this.i.getTransformationMethod();
|
||||
if (transformationMethod != null && (transformation = transformationMethod.getTransformation(text, this.i)) != null) {
|
||||
text = transformation;
|
||||
}
|
||||
int maxLines = Build.VERSION.SDK_INT >= 16 ? this.i.getMaxLines() : -1;
|
||||
TextPaint textPaint = this.h;
|
||||
if (textPaint == null) {
|
||||
this.h = new TextPaint();
|
||||
} else {
|
||||
textPaint.reset();
|
||||
}
|
||||
this.h.set(this.i.getPaint());
|
||||
this.h.setTextSize(i);
|
||||
Layout.Alignment alignment = (Layout.Alignment) a((Object) this.i, "getLayoutAlignment", (String) Layout.Alignment.ALIGN_NORMAL);
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
a = a(text, alignment, Math.round(rectF.right), maxLines);
|
||||
} else {
|
||||
a = a(text, alignment, Math.round(rectF.right));
|
||||
}
|
||||
return (maxLines == -1 || (a.getLineCount() <= maxLines && a.getLineEnd(a.getLineCount() - 1) == text.length())) && ((float) a.getHeight()) <= rectF.bottom;
|
||||
}
|
||||
|
||||
private StaticLayout a(CharSequence charSequence, Layout.Alignment alignment, int i, int i2) {
|
||||
TextDirectionHeuristic textDirectionHeuristic = (TextDirectionHeuristic) a((Object) this.i, "getTextDirectionHeuristic", (String) TextDirectionHeuristics.FIRSTSTRONG_LTR);
|
||||
StaticLayout.Builder hyphenationFrequency = StaticLayout.Builder.obtain(charSequence, 0, charSequence.length(), this.h, i).setAlignment(alignment).setLineSpacing(this.i.getLineSpacingExtra(), this.i.getLineSpacingMultiplier()).setIncludePad(this.i.getIncludeFontPadding()).setBreakStrategy(this.i.getBreakStrategy()).setHyphenationFrequency(this.i.getHyphenationFrequency());
|
||||
if (i2 == -1) {
|
||||
i2 = Integer.MAX_VALUE;
|
||||
}
|
||||
return hyphenationFrequency.setMaxLines(i2).setTextDirection(textDirectionHeuristic).build();
|
||||
}
|
||||
|
||||
private StaticLayout a(CharSequence charSequence, Layout.Alignment alignment, int i) {
|
||||
float floatValue;
|
||||
float floatValue2;
|
||||
boolean booleanValue;
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
floatValue = this.i.getLineSpacingMultiplier();
|
||||
floatValue2 = this.i.getLineSpacingExtra();
|
||||
booleanValue = this.i.getIncludeFontPadding();
|
||||
} else {
|
||||
floatValue = ((Float) a((Object) this.i, "getLineSpacingMultiplier", (String) Float.valueOf(1.0f))).floatValue();
|
||||
floatValue2 = ((Float) a((Object) this.i, "getLineSpacingExtra", (String) Float.valueOf(0.0f))).floatValue();
|
||||
booleanValue = ((Boolean) a((Object) this.i, "getIncludeFontPadding", (String) true)).booleanValue();
|
||||
}
|
||||
return new StaticLayout(charSequence, this.h, i, alignment, floatValue, floatValue2, booleanValue);
|
||||
}
|
||||
|
||||
private <T> T a(Object obj, String str, T t) {
|
||||
try {
|
||||
return (T) a(str).invoke(obj, new Object[0]);
|
||||
} catch (Exception e) {
|
||||
Log.w("ACTVAutoSizeHelper", "Failed to invoke TextView#" + str + "() method", e);
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
private Method a(String str) {
|
||||
try {
|
||||
Method method = l.get(str);
|
||||
if (method == null && (method = TextView.class.getDeclaredMethod(str, new Class[0])) != null) {
|
||||
method.setAccessible(true);
|
||||
l.put(str, method);
|
||||
}
|
||||
return method;
|
||||
} catch (Exception e) {
|
||||
Log.w("ACTVAutoSizeHelper", "Failed to retrieve TextView#" + str + "() method", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
117
sources/androidx/appcompat/widget/ButtonBarLayout.java
Normal file
117
sources/androidx/appcompat/widget/ButtonBarLayout.java
Normal file
@@ -0,0 +1,117 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import androidx.appcompat.R$id;
|
||||
import androidx.appcompat.R$styleable;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ButtonBarLayout extends LinearLayout {
|
||||
private boolean a;
|
||||
private int b;
|
||||
private int c;
|
||||
|
||||
public ButtonBarLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.b = -1;
|
||||
this.c = 0;
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.ButtonBarLayout);
|
||||
this.a = obtainStyledAttributes.getBoolean(R$styleable.ButtonBarLayout_allowStacking, true);
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
private int a(int i) {
|
||||
int childCount = getChildCount();
|
||||
while (i < childCount) {
|
||||
if (getChildAt(i).getVisibility() == 0) {
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void setStacked(boolean z) {
|
||||
setOrientation(z ? 1 : 0);
|
||||
setGravity(z ? 5 : 80);
|
||||
View findViewById = findViewById(R$id.spacer);
|
||||
if (findViewById != null) {
|
||||
findViewById.setVisibility(z ? 8 : 4);
|
||||
}
|
||||
for (int childCount = getChildCount() - 2; childCount >= 0; childCount--) {
|
||||
bringChildToFront(getChildAt(childCount));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public int getMinimumHeight() {
|
||||
return Math.max(this.c, super.getMinimumHeight());
|
||||
}
|
||||
|
||||
@Override // android.widget.LinearLayout, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
int i3;
|
||||
boolean z;
|
||||
int size = View.MeasureSpec.getSize(i);
|
||||
int i4 = 0;
|
||||
if (this.a) {
|
||||
if (size > this.b && a()) {
|
||||
setStacked(false);
|
||||
}
|
||||
this.b = size;
|
||||
}
|
||||
if (a() || View.MeasureSpec.getMode(i) != 1073741824) {
|
||||
i3 = i;
|
||||
z = false;
|
||||
} else {
|
||||
i3 = View.MeasureSpec.makeMeasureSpec(size, Integer.MIN_VALUE);
|
||||
z = true;
|
||||
}
|
||||
super.onMeasure(i3, i2);
|
||||
if (this.a && !a()) {
|
||||
if ((getMeasuredWidthAndState() & (-16777216)) == 16777216) {
|
||||
setStacked(true);
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
if (z) {
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
int a = a(0);
|
||||
if (a >= 0) {
|
||||
View childAt = getChildAt(a);
|
||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) childAt.getLayoutParams();
|
||||
int paddingTop = getPaddingTop() + childAt.getMeasuredHeight() + layoutParams.topMargin + layoutParams.bottomMargin + 0;
|
||||
if (a()) {
|
||||
int a2 = a(a + 1);
|
||||
if (a2 >= 0) {
|
||||
paddingTop += getChildAt(a2).getPaddingTop() + ((int) (getResources().getDisplayMetrics().density * 16.0f));
|
||||
}
|
||||
i4 = paddingTop;
|
||||
} else {
|
||||
i4 = paddingTop + getPaddingBottom();
|
||||
}
|
||||
}
|
||||
if (ViewCompat.l(this) != i4) {
|
||||
setMinimumHeight(i4);
|
||||
}
|
||||
}
|
||||
|
||||
public void setAllowStacking(boolean z) {
|
||||
if (this.a != z) {
|
||||
this.a = z;
|
||||
if (!this.a && getOrientation() == 1) {
|
||||
setStacked(false);
|
||||
}
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean a() {
|
||||
return getOrientation() == 1;
|
||||
}
|
||||
}
|
||||
138
sources/androidx/appcompat/widget/ContentFrameLayout.java
Normal file
138
sources/androidx/appcompat/widget/ContentFrameLayout.java
Normal file
@@ -0,0 +1,138 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.FrameLayout;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ContentFrameLayout extends FrameLayout {
|
||||
private TypedValue a;
|
||||
private TypedValue b;
|
||||
private TypedValue c;
|
||||
private TypedValue d;
|
||||
private TypedValue e;
|
||||
private TypedValue f;
|
||||
private final Rect g;
|
||||
private OnAttachListener h;
|
||||
|
||||
public interface OnAttachListener {
|
||||
void a();
|
||||
|
||||
void onDetachedFromWindow();
|
||||
}
|
||||
|
||||
public ContentFrameLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public void a(Rect rect) {
|
||||
fitSystemWindows(rect);
|
||||
}
|
||||
|
||||
public TypedValue getFixedHeightMajor() {
|
||||
if (this.e == null) {
|
||||
this.e = new TypedValue();
|
||||
}
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public TypedValue getFixedHeightMinor() {
|
||||
if (this.f == null) {
|
||||
this.f = new TypedValue();
|
||||
}
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public TypedValue getFixedWidthMajor() {
|
||||
if (this.c == null) {
|
||||
this.c = new TypedValue();
|
||||
}
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public TypedValue getFixedWidthMinor() {
|
||||
if (this.d == null) {
|
||||
this.d = new TypedValue();
|
||||
}
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public TypedValue getMinWidthMajor() {
|
||||
if (this.a == null) {
|
||||
this.a = new TypedValue();
|
||||
}
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public TypedValue getMinWidthMinor() {
|
||||
if (this.b == null) {
|
||||
this.b = new TypedValue();
|
||||
}
|
||||
return this.b;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
OnAttachListener onAttachListener = this.h;
|
||||
if (onAttachListener != null) {
|
||||
onAttachListener.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
OnAttachListener onAttachListener = this.h;
|
||||
if (onAttachListener != null) {
|
||||
onAttachListener.onDetachedFromWindow();
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:15:0x004a */
|
||||
/* JADX WARN: Removed duplicated region for block: B:17:0x0065 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:26:0x0088 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:35:0x00ad */
|
||||
/* JADX WARN: Removed duplicated region for block: B:40:0x00ba */
|
||||
/* JADX WARN: Removed duplicated region for block: B:43:0x00ce */
|
||||
/* JADX WARN: Removed duplicated region for block: B:45:0x00d8 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:47:0x00e0 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:50:? A[RETURN, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:51:0x00c0 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:54:0x00b0 */
|
||||
@Override // android.widget.FrameLayout, android.view.View
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
protected void onMeasure(int r14, int r15) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 228
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ContentFrameLayout.onMeasure(int, int):void");
|
||||
}
|
||||
|
||||
public void setAttachListener(OnAttachListener onAttachListener) {
|
||||
this.h = onAttachListener;
|
||||
}
|
||||
|
||||
public ContentFrameLayout(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public void a(int i, int i2, int i3, int i4) {
|
||||
this.g.set(i, i2, i3, i4);
|
||||
if (ViewCompat.x(this)) {
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public ContentFrameLayout(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.g = new Rect();
|
||||
}
|
||||
}
|
||||
30
sources/androidx/appcompat/widget/DecorContentParent.java
Normal file
30
sources/androidx/appcompat/widget/DecorContentParent.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.view.Menu;
|
||||
import android.view.Window;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface DecorContentParent {
|
||||
void a(int i);
|
||||
|
||||
void a(Menu menu, MenuPresenter.Callback callback);
|
||||
|
||||
boolean a();
|
||||
|
||||
void c();
|
||||
|
||||
boolean d();
|
||||
|
||||
boolean e();
|
||||
|
||||
boolean f();
|
||||
|
||||
boolean g();
|
||||
|
||||
void h();
|
||||
|
||||
void setWindowCallback(Window.Callback callback);
|
||||
|
||||
void setWindowTitle(CharSequence charSequence);
|
||||
}
|
||||
73
sources/androidx/appcompat/widget/DecorToolbar.java
Normal file
73
sources/androidx/appcompat/widget/DecorToolbar.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.Menu;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.core.view.ViewPropertyAnimatorCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface DecorToolbar {
|
||||
ViewPropertyAnimatorCompat a(int i, long j);
|
||||
|
||||
void a(int i);
|
||||
|
||||
void a(Menu menu, MenuPresenter.Callback callback);
|
||||
|
||||
void a(MenuPresenter.Callback callback, MenuBuilder.Callback callback2);
|
||||
|
||||
void a(ScrollingTabContainerView scrollingTabContainerView);
|
||||
|
||||
void a(boolean z);
|
||||
|
||||
boolean a();
|
||||
|
||||
Context b();
|
||||
|
||||
void b(int i);
|
||||
|
||||
void b(boolean z);
|
||||
|
||||
void c();
|
||||
|
||||
void c(int i);
|
||||
|
||||
void collapseActionView();
|
||||
|
||||
boolean d();
|
||||
|
||||
boolean e();
|
||||
|
||||
boolean f();
|
||||
|
||||
boolean g();
|
||||
|
||||
CharSequence getTitle();
|
||||
|
||||
void h();
|
||||
|
||||
boolean i();
|
||||
|
||||
Menu j();
|
||||
|
||||
int k();
|
||||
|
||||
ViewGroup l();
|
||||
|
||||
int m();
|
||||
|
||||
void n();
|
||||
|
||||
void o();
|
||||
|
||||
void setIcon(int i);
|
||||
|
||||
void setIcon(Drawable drawable);
|
||||
|
||||
void setWindowCallback(Window.Callback callback);
|
||||
|
||||
void setWindowTitle(CharSequence charSequence);
|
||||
}
|
||||
50
sources/androidx/appcompat/widget/DialogTitle.java
Normal file
50
sources/androidx/appcompat/widget/DialogTitle.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.text.Layout;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ActionMode;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R$styleable;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DialogTitle extends TextView {
|
||||
public DialogTitle(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
int lineCount;
|
||||
super.onMeasure(i, i2);
|
||||
Layout layout = getLayout();
|
||||
if (layout == null || (lineCount = layout.getLineCount()) <= 0 || layout.getEllipsisCount(lineCount - 1) <= 0) {
|
||||
return;
|
||||
}
|
||||
setSingleLine(false);
|
||||
setMaxLines(2);
|
||||
TypedArray obtainStyledAttributes = getContext().obtainStyledAttributes(null, R$styleable.TextAppearance, R.attr.textAppearanceMedium, R.style.TextAppearance.Medium);
|
||||
int dimensionPixelSize = obtainStyledAttributes.getDimensionPixelSize(R$styleable.TextAppearance_android_textSize, 0);
|
||||
if (dimensionPixelSize != 0) {
|
||||
setTextSize(0, dimensionPixelSize);
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
|
||||
super.setCustomSelectionActionModeCallback(TextViewCompat.a(this, callback));
|
||||
}
|
||||
|
||||
public DialogTitle(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
public DialogTitle(Context context) {
|
||||
super(context);
|
||||
}
|
||||
}
|
||||
99
sources/androidx/appcompat/widget/DrawableUtils.java
Normal file
99
sources/androidx/appcompat/widget/DrawableUtils.java
Normal file
@@ -0,0 +1,99 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.DrawableContainer;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.graphics.drawable.InsetDrawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.graphics.drawable.ScaleDrawable;
|
||||
import android.os.Build;
|
||||
import androidx.appcompat.graphics.drawable.DrawableWrapper;
|
||||
import androidx.core.graphics.drawable.WrappedDrawable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DrawableUtils {
|
||||
static {
|
||||
new Rect();
|
||||
if (Build.VERSION.SDK_INT >= 18) {
|
||||
try {
|
||||
Class.forName("android.graphics.Insets");
|
||||
} catch (ClassNotFoundException unused) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
public static boolean a(Drawable drawable) {
|
||||
if (Build.VERSION.SDK_INT < 15 && (drawable instanceof InsetDrawable)) {
|
||||
return false;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT < 15 && (drawable instanceof GradientDrawable)) {
|
||||
return false;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT < 17 && (drawable instanceof LayerDrawable)) {
|
||||
return false;
|
||||
}
|
||||
if (!(drawable instanceof DrawableContainer)) {
|
||||
if (drawable instanceof WrappedDrawable) {
|
||||
return a(((WrappedDrawable) drawable).a());
|
||||
}
|
||||
if (drawable instanceof DrawableWrapper) {
|
||||
return a(((DrawableWrapper) drawable).a());
|
||||
}
|
||||
if (drawable instanceof ScaleDrawable) {
|
||||
return a(((ScaleDrawable) drawable).getDrawable());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Drawable.ConstantState constantState = drawable.getConstantState();
|
||||
if (!(constantState instanceof DrawableContainer.DrawableContainerState)) {
|
||||
return true;
|
||||
}
|
||||
for (Drawable drawable2 : ((DrawableContainer.DrawableContainerState) constantState).getChildren()) {
|
||||
if (!a(drawable2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void b(Drawable drawable) {
|
||||
if (Build.VERSION.SDK_INT == 21 && "android.graphics.drawable.VectorDrawable".equals(drawable.getClass().getName())) {
|
||||
c(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
private static void c(Drawable drawable) {
|
||||
int[] state = drawable.getState();
|
||||
if (state == null || state.length == 0) {
|
||||
drawable.setState(ThemeUtils.e);
|
||||
} else {
|
||||
drawable.setState(ThemeUtils.f);
|
||||
}
|
||||
drawable.setState(state);
|
||||
}
|
||||
|
||||
public static PorterDuff.Mode a(int i, PorterDuff.Mode mode) {
|
||||
if (i == 3) {
|
||||
return PorterDuff.Mode.SRC_OVER;
|
||||
}
|
||||
if (i == 5) {
|
||||
return PorterDuff.Mode.SRC_IN;
|
||||
}
|
||||
if (i != 9) {
|
||||
switch (i) {
|
||||
case 14:
|
||||
return PorterDuff.Mode.MULTIPLY;
|
||||
case 15:
|
||||
return PorterDuff.Mode.SCREEN;
|
||||
case 16:
|
||||
return PorterDuff.Mode.ADD;
|
||||
default:
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
return PorterDuff.Mode.SRC_ATOP;
|
||||
}
|
||||
}
|
||||
481
sources/androidx/appcompat/widget/DropDownListView.java
Normal file
481
sources/androidx/appcompat/widget/DropDownListView.java
Normal file
@@ -0,0 +1,481 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.appcompat.graphics.drawable.DrawableWrapper;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorCompat;
|
||||
import androidx.core.widget.ListViewAutoScrollHelper;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class DropDownListView extends ListView {
|
||||
private final Rect a;
|
||||
private int b;
|
||||
private int c;
|
||||
private int d;
|
||||
private int e;
|
||||
private int f;
|
||||
private Field g;
|
||||
private GateKeeperDrawable h;
|
||||
private boolean i;
|
||||
private boolean j;
|
||||
private boolean k;
|
||||
private ViewPropertyAnimatorCompat l;
|
||||
private ListViewAutoScrollHelper m;
|
||||
ResolveHoverRunnable n;
|
||||
|
||||
private static class GateKeeperDrawable extends DrawableWrapper {
|
||||
private boolean b;
|
||||
|
||||
GateKeeperDrawable(Drawable drawable) {
|
||||
super(drawable);
|
||||
this.b = true;
|
||||
}
|
||||
|
||||
void a(boolean z) {
|
||||
this.b = z;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableWrapper, android.graphics.drawable.Drawable
|
||||
public void draw(Canvas canvas) {
|
||||
if (this.b) {
|
||||
super.draw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableWrapper, android.graphics.drawable.Drawable
|
||||
public void setHotspot(float f, float f2) {
|
||||
if (this.b) {
|
||||
super.setHotspot(f, f2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableWrapper, android.graphics.drawable.Drawable
|
||||
public void setHotspotBounds(int i, int i2, int i3, int i4) {
|
||||
if (this.b) {
|
||||
super.setHotspotBounds(i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableWrapper, android.graphics.drawable.Drawable
|
||||
public boolean setState(int[] iArr) {
|
||||
if (this.b) {
|
||||
return super.setState(iArr);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableWrapper, android.graphics.drawable.Drawable
|
||||
public boolean setVisible(boolean z, boolean z2) {
|
||||
if (this.b) {
|
||||
return super.setVisible(z, z2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private class ResolveHoverRunnable implements Runnable {
|
||||
ResolveHoverRunnable() {
|
||||
}
|
||||
|
||||
public void a() {
|
||||
DropDownListView.this.post(this);
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
DropDownListView dropDownListView = DropDownListView.this;
|
||||
dropDownListView.n = null;
|
||||
dropDownListView.removeCallbacks(this);
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
DropDownListView dropDownListView = DropDownListView.this;
|
||||
dropDownListView.n = null;
|
||||
dropDownListView.drawableStateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
DropDownListView(Context context, boolean z) {
|
||||
super(context, null, R$attr.dropDownListViewStyle);
|
||||
this.a = new Rect();
|
||||
this.b = 0;
|
||||
this.c = 0;
|
||||
this.d = 0;
|
||||
this.e = 0;
|
||||
this.j = z;
|
||||
setCacheColorHint(0);
|
||||
try {
|
||||
this.g = AbsListView.class.getDeclaredField("mIsChildViewEnabled");
|
||||
this.g.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void b(int i, View view) {
|
||||
Drawable selector = getSelector();
|
||||
boolean z = (selector == null || i == -1) ? false : true;
|
||||
if (z) {
|
||||
selector.setVisible(false, false);
|
||||
}
|
||||
a(i, view);
|
||||
if (z) {
|
||||
Rect rect = this.a;
|
||||
float exactCenterX = rect.exactCenterX();
|
||||
float exactCenterY = rect.exactCenterY();
|
||||
selector.setVisible(getVisibility() == 0, false);
|
||||
DrawableCompat.a(selector, exactCenterX, exactCenterY);
|
||||
}
|
||||
}
|
||||
|
||||
private void c() {
|
||||
Drawable selector = getSelector();
|
||||
if (selector != null && b() && isPressed()) {
|
||||
selector.setState(getDrawableState());
|
||||
}
|
||||
}
|
||||
|
||||
private void setSelectorEnabled(boolean z) {
|
||||
GateKeeperDrawable gateKeeperDrawable = this.h;
|
||||
if (gateKeeperDrawable != null) {
|
||||
gateKeeperDrawable.a(z);
|
||||
}
|
||||
}
|
||||
|
||||
public int a(int i, int i2, int i3, int i4, int i5) {
|
||||
int listPaddingTop = getListPaddingTop();
|
||||
int listPaddingBottom = getListPaddingBottom();
|
||||
getListPaddingLeft();
|
||||
getListPaddingRight();
|
||||
int dividerHeight = getDividerHeight();
|
||||
Drawable divider = getDivider();
|
||||
ListAdapter adapter = getAdapter();
|
||||
if (adapter == null) {
|
||||
return listPaddingTop + listPaddingBottom;
|
||||
}
|
||||
int i6 = listPaddingTop + listPaddingBottom;
|
||||
if (dividerHeight <= 0 || divider == null) {
|
||||
dividerHeight = 0;
|
||||
}
|
||||
int count = adapter.getCount();
|
||||
int i7 = i6;
|
||||
View view = null;
|
||||
int i8 = 0;
|
||||
int i9 = 0;
|
||||
int i10 = 0;
|
||||
while (i8 < count) {
|
||||
int itemViewType = adapter.getItemViewType(i8);
|
||||
if (itemViewType != i9) {
|
||||
view = null;
|
||||
i9 = itemViewType;
|
||||
}
|
||||
view = adapter.getView(i8, view, this);
|
||||
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
|
||||
if (layoutParams == null) {
|
||||
layoutParams = generateDefaultLayoutParams();
|
||||
view.setLayoutParams(layoutParams);
|
||||
}
|
||||
int i11 = layoutParams.height;
|
||||
view.measure(i, i11 > 0 ? View.MeasureSpec.makeMeasureSpec(i11, 1073741824) : View.MeasureSpec.makeMeasureSpec(0, 0));
|
||||
view.forceLayout();
|
||||
if (i8 > 0) {
|
||||
i7 += dividerHeight;
|
||||
}
|
||||
i7 += view.getMeasuredHeight();
|
||||
if (i7 >= i4) {
|
||||
return (i5 < 0 || i8 <= i5 || i10 <= 0 || i7 == i4) ? i4 : i10;
|
||||
}
|
||||
if (i5 >= 0 && i8 >= i5) {
|
||||
i10 = i7;
|
||||
}
|
||||
i8++;
|
||||
}
|
||||
return i7;
|
||||
}
|
||||
|
||||
@Override // android.widget.ListView, android.widget.AbsListView, android.view.ViewGroup, android.view.View
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
a(canvas);
|
||||
super.dispatchDraw(canvas);
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsListView, android.view.ViewGroup, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
if (this.n != null) {
|
||||
return;
|
||||
}
|
||||
super.drawableStateChanged();
|
||||
setSelectorEnabled(true);
|
||||
c();
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
public boolean hasFocus() {
|
||||
return this.j || super.hasFocus();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean hasWindowFocus() {
|
||||
return this.j || super.hasWindowFocus();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean isFocused() {
|
||||
return this.j || super.isFocused();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean isInTouchMode() {
|
||||
return (this.j && this.i) || super.isInTouchMode();
|
||||
}
|
||||
|
||||
@Override // android.widget.ListView, android.widget.AbsListView, android.widget.AdapterView, android.view.ViewGroup, android.view.View
|
||||
protected void onDetachedFromWindow() {
|
||||
this.n = null;
|
||||
super.onDetachedFromWindow();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean onHoverEvent(MotionEvent motionEvent) {
|
||||
if (Build.VERSION.SDK_INT < 26) {
|
||||
return super.onHoverEvent(motionEvent);
|
||||
}
|
||||
int actionMasked = motionEvent.getActionMasked();
|
||||
if (actionMasked == 10 && this.n == null) {
|
||||
this.n = new ResolveHoverRunnable();
|
||||
this.n.a();
|
||||
}
|
||||
boolean onHoverEvent = super.onHoverEvent(motionEvent);
|
||||
if (actionMasked == 9 || actionMasked == 7) {
|
||||
int pointToPosition = pointToPosition((int) motionEvent.getX(), (int) motionEvent.getY());
|
||||
if (pointToPosition != -1 && pointToPosition != getSelectedItemPosition()) {
|
||||
View childAt = getChildAt(pointToPosition - getFirstVisiblePosition());
|
||||
if (childAt.isEnabled()) {
|
||||
setSelectionFromTop(pointToPosition, childAt.getTop() - getTop());
|
||||
}
|
||||
c();
|
||||
}
|
||||
} else {
|
||||
setSelection(-1);
|
||||
}
|
||||
return onHoverEvent;
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsListView, android.view.View
|
||||
public boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
if (motionEvent.getAction() == 0) {
|
||||
this.f = pointToPosition((int) motionEvent.getX(), (int) motionEvent.getY());
|
||||
}
|
||||
ResolveHoverRunnable resolveHoverRunnable = this.n;
|
||||
if (resolveHoverRunnable != null) {
|
||||
resolveHoverRunnable.cancel();
|
||||
}
|
||||
return super.onTouchEvent(motionEvent);
|
||||
}
|
||||
|
||||
void setListSelectionHidden(boolean z) {
|
||||
this.i = z;
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsListView
|
||||
public void setSelector(Drawable drawable) {
|
||||
this.h = drawable != null ? new GateKeeperDrawable(drawable) : null;
|
||||
super.setSelector(this.h);
|
||||
Rect rect = new Rect();
|
||||
if (drawable != null) {
|
||||
drawable.getPadding(rect);
|
||||
}
|
||||
this.b = rect.left;
|
||||
this.c = rect.top;
|
||||
this.d = rect.right;
|
||||
this.e = rect.bottom;
|
||||
}
|
||||
|
||||
private boolean b() {
|
||||
return this.k;
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:6:0x000c, code lost:
|
||||
|
||||
if (r0 != 3) goto L8;
|
||||
*/
|
||||
/* JADX WARN: Removed duplicated region for block: B:11:0x004f */
|
||||
/* JADX WARN: Removed duplicated region for block: B:17:0x0065 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:9:0x0048 A[ADDED_TO_REGION] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public boolean a(android.view.MotionEvent r8, int r9) {
|
||||
/*
|
||||
r7 = this;
|
||||
int r0 = r8.getActionMasked()
|
||||
r1 = 0
|
||||
r2 = 1
|
||||
if (r0 == r2) goto L16
|
||||
r3 = 2
|
||||
if (r0 == r3) goto L14
|
||||
r9 = 3
|
||||
if (r0 == r9) goto L11
|
||||
Le:
|
||||
r9 = 0
|
||||
r3 = 1
|
||||
goto L46
|
||||
L11:
|
||||
r9 = 0
|
||||
r3 = 0
|
||||
goto L46
|
||||
L14:
|
||||
r3 = 1
|
||||
goto L17
|
||||
L16:
|
||||
r3 = 0
|
||||
L17:
|
||||
int r9 = r8.findPointerIndex(r9)
|
||||
if (r9 >= 0) goto L1e
|
||||
goto L11
|
||||
L1e:
|
||||
float r4 = r8.getX(r9)
|
||||
int r4 = (int) r4
|
||||
float r9 = r8.getY(r9)
|
||||
int r9 = (int) r9
|
||||
int r5 = r7.pointToPosition(r4, r9)
|
||||
r6 = -1
|
||||
if (r5 != r6) goto L31
|
||||
r9 = 1
|
||||
goto L46
|
||||
L31:
|
||||
int r3 = r7.getFirstVisiblePosition()
|
||||
int r3 = r5 - r3
|
||||
android.view.View r3 = r7.getChildAt(r3)
|
||||
float r4 = (float) r4
|
||||
float r9 = (float) r9
|
||||
r7.a(r3, r5, r4, r9)
|
||||
if (r0 != r2) goto Le
|
||||
r7.a(r3, r5)
|
||||
goto Le
|
||||
L46:
|
||||
if (r3 == 0) goto L4a
|
||||
if (r9 == 0) goto L4d
|
||||
L4a:
|
||||
r7.a()
|
||||
L4d:
|
||||
if (r3 == 0) goto L65
|
||||
androidx.core.widget.ListViewAutoScrollHelper r9 = r7.m
|
||||
if (r9 != 0) goto L5a
|
||||
androidx.core.widget.ListViewAutoScrollHelper r9 = new androidx.core.widget.ListViewAutoScrollHelper
|
||||
r9.<init>(r7)
|
||||
r7.m = r9
|
||||
L5a:
|
||||
androidx.core.widget.ListViewAutoScrollHelper r9 = r7.m
|
||||
r9.a(r2)
|
||||
androidx.core.widget.ListViewAutoScrollHelper r9 = r7.m
|
||||
r9.onTouch(r7, r8)
|
||||
goto L6c
|
||||
L65:
|
||||
androidx.core.widget.ListViewAutoScrollHelper r8 = r7.m
|
||||
if (r8 == 0) goto L6c
|
||||
r8.a(r1)
|
||||
L6c:
|
||||
return r3
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.DropDownListView.a(android.view.MotionEvent, int):boolean");
|
||||
}
|
||||
|
||||
private void a(View view, int i) {
|
||||
performItemClick(view, i, getItemIdAtPosition(i));
|
||||
}
|
||||
|
||||
private void a(Canvas canvas) {
|
||||
Drawable selector;
|
||||
if (this.a.isEmpty() || (selector = getSelector()) == null) {
|
||||
return;
|
||||
}
|
||||
selector.setBounds(this.a);
|
||||
selector.draw(canvas);
|
||||
}
|
||||
|
||||
private void a(int i, View view, float f, float f2) {
|
||||
b(i, view);
|
||||
Drawable selector = getSelector();
|
||||
if (selector == null || i == -1) {
|
||||
return;
|
||||
}
|
||||
DrawableCompat.a(selector, f, f2);
|
||||
}
|
||||
|
||||
private void a(int i, View view) {
|
||||
Rect rect = this.a;
|
||||
rect.set(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
|
||||
rect.left -= this.b;
|
||||
rect.top -= this.c;
|
||||
rect.right += this.d;
|
||||
rect.bottom += this.e;
|
||||
try {
|
||||
boolean z = this.g.getBoolean(this);
|
||||
if (view.isEnabled() != z) {
|
||||
this.g.set(this, Boolean.valueOf(!z));
|
||||
if (i != -1) {
|
||||
refreshDrawableState();
|
||||
}
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void a() {
|
||||
this.k = false;
|
||||
setPressed(false);
|
||||
drawableStateChanged();
|
||||
View childAt = getChildAt(this.f - getFirstVisiblePosition());
|
||||
if (childAt != null) {
|
||||
childAt.setPressed(false);
|
||||
}
|
||||
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = this.l;
|
||||
if (viewPropertyAnimatorCompat != null) {
|
||||
viewPropertyAnimatorCompat.a();
|
||||
this.l = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void a(View view, int i, float f, float f2) {
|
||||
View childAt;
|
||||
this.k = true;
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
drawableHotspotChanged(f, f2);
|
||||
}
|
||||
if (!isPressed()) {
|
||||
setPressed(true);
|
||||
}
|
||||
layoutChildren();
|
||||
int i2 = this.f;
|
||||
if (i2 != -1 && (childAt = getChildAt(i2 - getFirstVisiblePosition())) != null && childAt != view && childAt.isPressed()) {
|
||||
childAt.setPressed(false);
|
||||
}
|
||||
this.f = i;
|
||||
float left = f - view.getLeft();
|
||||
float top = f2 - view.getTop();
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
view.drawableHotspotChanged(left, top);
|
||||
}
|
||||
if (!view.isPressed()) {
|
||||
view.setPressed(true);
|
||||
}
|
||||
a(i, view, f, f2);
|
||||
setSelectorEnabled(false);
|
||||
refreshDrawableState();
|
||||
}
|
||||
}
|
||||
34
sources/androidx/appcompat/widget/FitWindowsFrameLayout.java
Normal file
34
sources/androidx/appcompat/widget/FitWindowsFrameLayout.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.FrameLayout;
|
||||
import androidx.appcompat.widget.FitWindowsViewGroup;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FitWindowsFrameLayout extends FrameLayout implements FitWindowsViewGroup {
|
||||
private FitWindowsViewGroup.OnFitSystemWindowsListener a;
|
||||
|
||||
public FitWindowsFrameLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected boolean fitSystemWindows(Rect rect) {
|
||||
FitWindowsViewGroup.OnFitSystemWindowsListener onFitSystemWindowsListener = this.a;
|
||||
if (onFitSystemWindowsListener != null) {
|
||||
onFitSystemWindowsListener.a(rect);
|
||||
}
|
||||
return super.fitSystemWindows(rect);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.FitWindowsViewGroup
|
||||
public void setOnFitSystemWindowsListener(FitWindowsViewGroup.OnFitSystemWindowsListener onFitSystemWindowsListener) {
|
||||
this.a = onFitSystemWindowsListener;
|
||||
}
|
||||
|
||||
public FitWindowsFrameLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.LinearLayout;
|
||||
import androidx.appcompat.widget.FitWindowsViewGroup;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FitWindowsLinearLayout extends LinearLayout implements FitWindowsViewGroup {
|
||||
private FitWindowsViewGroup.OnFitSystemWindowsListener a;
|
||||
|
||||
public FitWindowsLinearLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected boolean fitSystemWindows(Rect rect) {
|
||||
FitWindowsViewGroup.OnFitSystemWindowsListener onFitSystemWindowsListener = this.a;
|
||||
if (onFitSystemWindowsListener != null) {
|
||||
onFitSystemWindowsListener.a(rect);
|
||||
}
|
||||
return super.fitSystemWindows(rect);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.FitWindowsViewGroup
|
||||
public void setOnFitSystemWindowsListener(FitWindowsViewGroup.OnFitSystemWindowsListener onFitSystemWindowsListener) {
|
||||
this.a = onFitSystemWindowsListener;
|
||||
}
|
||||
|
||||
public FitWindowsLinearLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
}
|
||||
13
sources/androidx/appcompat/widget/FitWindowsViewGroup.java
Normal file
13
sources/androidx/appcompat/widget/FitWindowsViewGroup.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.graphics.Rect;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface FitWindowsViewGroup {
|
||||
|
||||
public interface OnFitSystemWindowsListener {
|
||||
void a(Rect rect);
|
||||
}
|
||||
|
||||
void setOnFitSystemWindowsListener(OnFitSystemWindowsListener onFitSystemWindowsListener);
|
||||
}
|
||||
227
sources/androidx/appcompat/widget/ForwardingListener.java
Normal file
227
sources/androidx/appcompat/widget/ForwardingListener.java
Normal file
@@ -0,0 +1,227 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.os.SystemClock;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.ViewParent;
|
||||
import androidx.appcompat.view.menu.ShowableListMenu;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class ForwardingListener implements View.OnTouchListener, View.OnAttachStateChangeListener {
|
||||
private final float a;
|
||||
private final int b;
|
||||
private final int c;
|
||||
final View d;
|
||||
private Runnable e;
|
||||
private Runnable f;
|
||||
private boolean g;
|
||||
private int h;
|
||||
private final int[] i = new int[2];
|
||||
|
||||
private class DisallowIntercept implements Runnable {
|
||||
DisallowIntercept() {
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ViewParent parent = ForwardingListener.this.d.getParent();
|
||||
if (parent != null) {
|
||||
parent.requestDisallowInterceptTouchEvent(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class TriggerLongPress implements Runnable {
|
||||
TriggerLongPress() {
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ForwardingListener.this.d();
|
||||
}
|
||||
}
|
||||
|
||||
public ForwardingListener(View view) {
|
||||
this.d = view;
|
||||
view.setLongClickable(true);
|
||||
view.addOnAttachStateChangeListener(this);
|
||||
this.a = ViewConfiguration.get(view.getContext()).getScaledTouchSlop();
|
||||
this.b = ViewConfiguration.getTapTimeout();
|
||||
this.c = (this.b + ViewConfiguration.getLongPressTimeout()) / 2;
|
||||
}
|
||||
|
||||
private boolean a(MotionEvent motionEvent) {
|
||||
DropDownListView dropDownListView;
|
||||
View view = this.d;
|
||||
ShowableListMenu a = a();
|
||||
if (a == null || !a.c() || (dropDownListView = (DropDownListView) a.d()) == null || !dropDownListView.isShown()) {
|
||||
return false;
|
||||
}
|
||||
MotionEvent obtainNoHistory = MotionEvent.obtainNoHistory(motionEvent);
|
||||
a(view, obtainNoHistory);
|
||||
b(dropDownListView, obtainNoHistory);
|
||||
boolean a2 = dropDownListView.a(obtainNoHistory, this.h);
|
||||
obtainNoHistory.recycle();
|
||||
int actionMasked = motionEvent.getActionMasked();
|
||||
return a2 && (actionMasked != 1 && actionMasked != 3);
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:12:0x0017, code lost:
|
||||
|
||||
if (r1 != 3) goto L28;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private boolean b(android.view.MotionEvent r6) {
|
||||
/*
|
||||
r5 = this;
|
||||
android.view.View r0 = r5.d
|
||||
boolean r1 = r0.isEnabled()
|
||||
r2 = 0
|
||||
if (r1 != 0) goto La
|
||||
return r2
|
||||
La:
|
||||
int r1 = r6.getActionMasked()
|
||||
if (r1 == 0) goto L41
|
||||
r3 = 1
|
||||
if (r1 == r3) goto L3d
|
||||
r4 = 2
|
||||
if (r1 == r4) goto L1a
|
||||
r6 = 3
|
||||
if (r1 == r6) goto L3d
|
||||
goto L6d
|
||||
L1a:
|
||||
int r1 = r5.h
|
||||
int r1 = r6.findPointerIndex(r1)
|
||||
if (r1 < 0) goto L6d
|
||||
float r4 = r6.getX(r1)
|
||||
float r6 = r6.getY(r1)
|
||||
float r1 = r5.a
|
||||
boolean r6 = a(r0, r4, r6, r1)
|
||||
if (r6 != 0) goto L6d
|
||||
r5.e()
|
||||
android.view.ViewParent r6 = r0.getParent()
|
||||
r6.requestDisallowInterceptTouchEvent(r3)
|
||||
return r3
|
||||
L3d:
|
||||
r5.e()
|
||||
goto L6d
|
||||
L41:
|
||||
int r6 = r6.getPointerId(r2)
|
||||
r5.h = r6
|
||||
java.lang.Runnable r6 = r5.e
|
||||
if (r6 != 0) goto L52
|
||||
androidx.appcompat.widget.ForwardingListener$DisallowIntercept r6 = new androidx.appcompat.widget.ForwardingListener$DisallowIntercept
|
||||
r6.<init>()
|
||||
r5.e = r6
|
||||
L52:
|
||||
java.lang.Runnable r6 = r5.e
|
||||
int r1 = r5.b
|
||||
long r3 = (long) r1
|
||||
r0.postDelayed(r6, r3)
|
||||
java.lang.Runnable r6 = r5.f
|
||||
if (r6 != 0) goto L65
|
||||
androidx.appcompat.widget.ForwardingListener$TriggerLongPress r6 = new androidx.appcompat.widget.ForwardingListener$TriggerLongPress
|
||||
r6.<init>()
|
||||
r5.f = r6
|
||||
L65:
|
||||
java.lang.Runnable r6 = r5.f
|
||||
int r1 = r5.c
|
||||
long r3 = (long) r1
|
||||
r0.postDelayed(r6, r3)
|
||||
L6d:
|
||||
return r2
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ForwardingListener.b(android.view.MotionEvent):boolean");
|
||||
}
|
||||
|
||||
private void e() {
|
||||
Runnable runnable = this.f;
|
||||
if (runnable != null) {
|
||||
this.d.removeCallbacks(runnable);
|
||||
}
|
||||
Runnable runnable2 = this.e;
|
||||
if (runnable2 != null) {
|
||||
this.d.removeCallbacks(runnable2);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract ShowableListMenu a();
|
||||
|
||||
protected abstract boolean b();
|
||||
|
||||
protected boolean c() {
|
||||
ShowableListMenu a = a();
|
||||
if (a == null || !a.c()) {
|
||||
return true;
|
||||
}
|
||||
a.dismiss();
|
||||
return true;
|
||||
}
|
||||
|
||||
void d() {
|
||||
e();
|
||||
View view = this.d;
|
||||
if (view.isEnabled() && !view.isLongClickable() && b()) {
|
||||
view.getParent().requestDisallowInterceptTouchEvent(true);
|
||||
long uptimeMillis = SystemClock.uptimeMillis();
|
||||
MotionEvent obtain = MotionEvent.obtain(uptimeMillis, uptimeMillis, 3, 0.0f, 0.0f, 0);
|
||||
view.onTouchEvent(obtain);
|
||||
obtain.recycle();
|
||||
this.g = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnTouchListener
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
boolean z;
|
||||
boolean z2 = this.g;
|
||||
if (z2) {
|
||||
z = a(motionEvent) || !c();
|
||||
} else {
|
||||
z = b(motionEvent) && b();
|
||||
if (z) {
|
||||
long uptimeMillis = SystemClock.uptimeMillis();
|
||||
MotionEvent obtain = MotionEvent.obtain(uptimeMillis, uptimeMillis, 3, 0.0f, 0.0f, 0);
|
||||
this.d.onTouchEvent(obtain);
|
||||
obtain.recycle();
|
||||
}
|
||||
}
|
||||
this.g = z;
|
||||
return z || z2;
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnAttachStateChangeListener
|
||||
public void onViewAttachedToWindow(View view) {
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnAttachStateChangeListener
|
||||
public void onViewDetachedFromWindow(View view) {
|
||||
this.g = false;
|
||||
this.h = -1;
|
||||
Runnable runnable = this.e;
|
||||
if (runnable != null) {
|
||||
this.d.removeCallbacks(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean a(View view, float f, float f2, float f3) {
|
||||
float f4 = -f3;
|
||||
return f >= f4 && f2 >= f4 && f < ((float) (view.getRight() - view.getLeft())) + f3 && f2 < ((float) (view.getBottom() - view.getTop())) + f3;
|
||||
}
|
||||
|
||||
private boolean a(View view, MotionEvent motionEvent) {
|
||||
view.getLocationOnScreen(this.i);
|
||||
motionEvent.offsetLocation(r0[0], r0[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean b(View view, MotionEvent motionEvent) {
|
||||
view.getLocationOnScreen(this.i);
|
||||
motionEvent.offsetLocation(-r0[0], -r0[1]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
623
sources/androidx/appcompat/widget/LinearLayoutCompat.java
Normal file
623
sources/androidx/appcompat/widget/LinearLayoutCompat.java
Normal file
@@ -0,0 +1,623 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import androidx.appcompat.R$styleable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class LinearLayoutCompat extends ViewGroup {
|
||||
private boolean a;
|
||||
private int b;
|
||||
private int c;
|
||||
private int d;
|
||||
private int e;
|
||||
private int f;
|
||||
private float g;
|
||||
private boolean h;
|
||||
private int[] i;
|
||||
private int[] j;
|
||||
private Drawable k;
|
||||
private int l;
|
||||
private int m;
|
||||
private int n;
|
||||
private int o;
|
||||
|
||||
public LinearLayoutCompat(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
private void c(int i, int i2) {
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(getMeasuredHeight(), 1073741824);
|
||||
for (int i3 = 0; i3 < i; i3++) {
|
||||
View a = a(i3);
|
||||
if (a.getVisibility() != 8) {
|
||||
LayoutParams layoutParams = (LayoutParams) a.getLayoutParams();
|
||||
if (((ViewGroup.MarginLayoutParams) layoutParams).height == -1) {
|
||||
int i4 = ((ViewGroup.MarginLayoutParams) layoutParams).width;
|
||||
((ViewGroup.MarginLayoutParams) layoutParams).width = a.getMeasuredWidth();
|
||||
measureChildWithMargins(a, i2, 0, makeMeasureSpec, 0);
|
||||
((ViewGroup.MarginLayoutParams) layoutParams).width = i4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void d(int i, int i2) {
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 1073741824);
|
||||
for (int i3 = 0; i3 < i; i3++) {
|
||||
View a = a(i3);
|
||||
if (a.getVisibility() != 8) {
|
||||
LayoutParams layoutParams = (LayoutParams) a.getLayoutParams();
|
||||
if (((ViewGroup.MarginLayoutParams) layoutParams).width == -1) {
|
||||
int i4 = ((ViewGroup.MarginLayoutParams) layoutParams).height;
|
||||
((ViewGroup.MarginLayoutParams) layoutParams).height = a.getMeasuredHeight();
|
||||
measureChildWithMargins(a, makeMeasureSpec, 0, i2, 0);
|
||||
((ViewGroup.MarginLayoutParams) layoutParams).height = i4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int a(View view) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int a(View view, int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void a(Canvas canvas) {
|
||||
int right;
|
||||
int left;
|
||||
int i;
|
||||
int virtualChildCount = getVirtualChildCount();
|
||||
boolean a = ViewUtils.a(this);
|
||||
for (int i2 = 0; i2 < virtualChildCount; i2++) {
|
||||
View a2 = a(i2);
|
||||
if (a2 != null && a2.getVisibility() != 8 && b(i2)) {
|
||||
LayoutParams layoutParams = (LayoutParams) a2.getLayoutParams();
|
||||
b(canvas, a ? a2.getRight() + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin : (a2.getLeft() - ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin) - this.l);
|
||||
}
|
||||
}
|
||||
if (b(virtualChildCount)) {
|
||||
View a3 = a(virtualChildCount - 1);
|
||||
if (a3 != null) {
|
||||
LayoutParams layoutParams2 = (LayoutParams) a3.getLayoutParams();
|
||||
if (a) {
|
||||
left = a3.getLeft() - ((ViewGroup.MarginLayoutParams) layoutParams2).leftMargin;
|
||||
i = this.l;
|
||||
right = left - i;
|
||||
} else {
|
||||
right = a3.getRight() + ((ViewGroup.MarginLayoutParams) layoutParams2).rightMargin;
|
||||
}
|
||||
} else if (a) {
|
||||
right = getPaddingLeft();
|
||||
} else {
|
||||
left = getWidth() - getPaddingRight();
|
||||
i = this.l;
|
||||
right = left - i;
|
||||
}
|
||||
b(canvas, right);
|
||||
}
|
||||
}
|
||||
|
||||
int b(View view) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void b(Canvas canvas) {
|
||||
int virtualChildCount = getVirtualChildCount();
|
||||
for (int i = 0; i < virtualChildCount; i++) {
|
||||
View a = a(i);
|
||||
if (a != null && a.getVisibility() != 8 && b(i)) {
|
||||
a(canvas, (a.getTop() - ((ViewGroup.MarginLayoutParams) ((LayoutParams) a.getLayoutParams())).topMargin) - this.m);
|
||||
}
|
||||
}
|
||||
if (b(virtualChildCount)) {
|
||||
View a2 = a(virtualChildCount - 1);
|
||||
a(canvas, a2 == null ? (getHeight() - getPaddingBottom()) - this.m : a2.getBottom() + ((ViewGroup.MarginLayoutParams) ((LayoutParams) a2.getLayoutParams())).bottomMargin);
|
||||
}
|
||||
}
|
||||
|
||||
int c(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
return layoutParams instanceof LayoutParams;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public int getBaseline() {
|
||||
int i;
|
||||
if (this.b < 0) {
|
||||
return super.getBaseline();
|
||||
}
|
||||
int childCount = getChildCount();
|
||||
int i2 = this.b;
|
||||
if (childCount <= i2) {
|
||||
throw new RuntimeException("mBaselineAlignedChildIndex of LinearLayout set to an index that is out of bounds.");
|
||||
}
|
||||
View childAt = getChildAt(i2);
|
||||
int baseline = childAt.getBaseline();
|
||||
if (baseline == -1) {
|
||||
if (this.b == 0) {
|
||||
return -1;
|
||||
}
|
||||
throw new RuntimeException("mBaselineAlignedChildIndex of LinearLayout points to a View that doesn't know how to get its baseline.");
|
||||
}
|
||||
int i3 = this.c;
|
||||
if (this.d == 1 && (i = this.e & 112) != 48) {
|
||||
if (i == 16) {
|
||||
i3 += ((((getBottom() - getTop()) - getPaddingTop()) - getPaddingBottom()) - this.f) / 2;
|
||||
} else if (i == 80) {
|
||||
i3 = ((getBottom() - getTop()) - getPaddingBottom()) - this.f;
|
||||
}
|
||||
}
|
||||
return i3 + ((ViewGroup.MarginLayoutParams) ((LayoutParams) childAt.getLayoutParams())).topMargin + baseline;
|
||||
}
|
||||
|
||||
public int getBaselineAlignedChildIndex() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public Drawable getDividerDrawable() {
|
||||
return this.k;
|
||||
}
|
||||
|
||||
public int getDividerPadding() {
|
||||
return this.o;
|
||||
}
|
||||
|
||||
public int getDividerWidth() {
|
||||
return this.l;
|
||||
}
|
||||
|
||||
public int getGravity() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public int getOrientation() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public int getShowDividers() {
|
||||
return this.n;
|
||||
}
|
||||
|
||||
int getVirtualChildCount() {
|
||||
return getChildCount();
|
||||
}
|
||||
|
||||
public float getWeightSum() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onDraw(Canvas canvas) {
|
||||
if (this.k == null) {
|
||||
return;
|
||||
}
|
||||
if (this.d == 1) {
|
||||
b(canvas);
|
||||
} else {
|
||||
a(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
|
||||
super.onInitializeAccessibilityEvent(accessibilityEvent);
|
||||
accessibilityEvent.setClassName(LinearLayoutCompat.class.getName());
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
|
||||
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
|
||||
accessibilityNodeInfo.setClassName(LinearLayoutCompat.class.getName());
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
if (this.d == 1) {
|
||||
b(i, i2, i3, i4);
|
||||
} else {
|
||||
a(i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
if (this.d == 1) {
|
||||
b(i, i2);
|
||||
} else {
|
||||
a(i, i2);
|
||||
}
|
||||
}
|
||||
|
||||
public void setBaselineAligned(boolean z) {
|
||||
this.a = z;
|
||||
}
|
||||
|
||||
public void setBaselineAlignedChildIndex(int i) {
|
||||
if (i >= 0 && i < getChildCount()) {
|
||||
this.b = i;
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException("base aligned child index out of range (0, " + getChildCount() + ")");
|
||||
}
|
||||
|
||||
public void setDividerDrawable(Drawable drawable) {
|
||||
if (drawable == this.k) {
|
||||
return;
|
||||
}
|
||||
this.k = drawable;
|
||||
if (drawable != null) {
|
||||
this.l = drawable.getIntrinsicWidth();
|
||||
this.m = drawable.getIntrinsicHeight();
|
||||
} else {
|
||||
this.l = 0;
|
||||
this.m = 0;
|
||||
}
|
||||
setWillNotDraw(drawable == null);
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public void setDividerPadding(int i) {
|
||||
this.o = i;
|
||||
}
|
||||
|
||||
public void setGravity(int i) {
|
||||
if (this.e != i) {
|
||||
if ((8388615 & i) == 0) {
|
||||
i |= 8388611;
|
||||
}
|
||||
if ((i & 112) == 0) {
|
||||
i |= 48;
|
||||
}
|
||||
this.e = i;
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void setHorizontalGravity(int i) {
|
||||
int i2 = i & 8388615;
|
||||
int i3 = this.e;
|
||||
if ((8388615 & i3) != i2) {
|
||||
this.e = i2 | ((-8388616) & i3);
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void setMeasureWithLargestChildEnabled(boolean z) {
|
||||
this.h = z;
|
||||
}
|
||||
|
||||
public void setOrientation(int i) {
|
||||
if (this.d != i) {
|
||||
this.d = i;
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void setShowDividers(int i) {
|
||||
if (i != this.n) {
|
||||
requestLayout();
|
||||
}
|
||||
this.n = i;
|
||||
}
|
||||
|
||||
public void setVerticalGravity(int i) {
|
||||
int i2 = i & 112;
|
||||
int i3 = this.e;
|
||||
if ((i3 & 112) != i2) {
|
||||
this.e = i2 | (i3 & (-113));
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void setWeightSum(float f) {
|
||||
this.g = Math.max(0.0f, f);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public boolean shouldDelayChildPressedState() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public LinearLayoutCompat(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // android.view.ViewGroup
|
||||
public LayoutParams generateDefaultLayoutParams() {
|
||||
int i = this.d;
|
||||
if (i == 0) {
|
||||
return new LayoutParams(-2, -2);
|
||||
}
|
||||
if (i == 1) {
|
||||
return new LayoutParams(-1, -2);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public LinearLayoutCompat(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.a = true;
|
||||
this.b = -1;
|
||||
this.c = 0;
|
||||
this.e = 8388659;
|
||||
TintTypedArray a = TintTypedArray.a(context, attributeSet, R$styleable.LinearLayoutCompat, i, 0);
|
||||
int d = a.d(R$styleable.LinearLayoutCompat_android_orientation, -1);
|
||||
if (d >= 0) {
|
||||
setOrientation(d);
|
||||
}
|
||||
int d2 = a.d(R$styleable.LinearLayoutCompat_android_gravity, -1);
|
||||
if (d2 >= 0) {
|
||||
setGravity(d2);
|
||||
}
|
||||
boolean a2 = a.a(R$styleable.LinearLayoutCompat_android_baselineAligned, true);
|
||||
if (!a2) {
|
||||
setBaselineAligned(a2);
|
||||
}
|
||||
this.g = a.b(R$styleable.LinearLayoutCompat_android_weightSum, -1.0f);
|
||||
this.b = a.d(R$styleable.LinearLayoutCompat_android_baselineAlignedChildIndex, -1);
|
||||
this.h = a.a(R$styleable.LinearLayoutCompat_measureWithLargestChild, false);
|
||||
setDividerDrawable(a.b(R$styleable.LinearLayoutCompat_divider));
|
||||
this.n = a.d(R$styleable.LinearLayoutCompat_showDividers, 0);
|
||||
this.o = a.c(R$styleable.LinearLayoutCompat_dividerPadding, 0);
|
||||
a.a();
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public LayoutParams generateLayoutParams(AttributeSet attributeSet) {
|
||||
return new LayoutParams(getContext(), attributeSet);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // android.view.ViewGroup
|
||||
public LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
return new LayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
public static class LayoutParams extends ViewGroup.MarginLayoutParams {
|
||||
public float a;
|
||||
public int b;
|
||||
|
||||
public LayoutParams(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.b = -1;
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.LinearLayoutCompat_Layout);
|
||||
this.a = obtainStyledAttributes.getFloat(R$styleable.LinearLayoutCompat_Layout_android_layout_weight, 0.0f);
|
||||
this.b = obtainStyledAttributes.getInt(R$styleable.LinearLayoutCompat_Layout_android_layout_gravity, -1);
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
public LayoutParams(int i, int i2) {
|
||||
super(i, i2);
|
||||
this.b = -1;
|
||||
this.a = 0.0f;
|
||||
}
|
||||
|
||||
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
super(layoutParams);
|
||||
this.b = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void b(Canvas canvas, int i) {
|
||||
this.k.setBounds(i, getPaddingTop() + this.o, this.l + i, (getHeight() - getPaddingBottom()) - this.o);
|
||||
this.k.draw(canvas);
|
||||
}
|
||||
|
||||
void a(Canvas canvas, int i) {
|
||||
this.k.setBounds(getPaddingLeft() + this.o, i, (getWidth() - getPaddingRight()) - this.o, this.m + i);
|
||||
this.k.draw(canvas);
|
||||
}
|
||||
|
||||
protected boolean b(int i) {
|
||||
if (i == 0) {
|
||||
return (this.n & 1) != 0;
|
||||
}
|
||||
if (i == getChildCount()) {
|
||||
return (this.n & 4) != 0;
|
||||
}
|
||||
if ((this.n & 2) == 0) {
|
||||
return false;
|
||||
}
|
||||
for (int i2 = i - 1; i2 >= 0; i2--) {
|
||||
if (getChildAt(i2).getVisibility() != 8) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
View a(int i) {
|
||||
return getChildAt(i);
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:44:0x0196 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:53:0x01ca */
|
||||
/* JADX WARN: Removed duplicated region for block: B:58:0x01d5 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
void a(int r39, int r40) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 1300
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.LinearLayoutCompat.a(int, int):void");
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:158:0x032e */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
void b(int r34, int r35) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 921
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.LinearLayoutCompat.b(int, int):void");
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:26:0x00a0 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
void b(int r18, int r19, int r20, int r21) {
|
||||
/*
|
||||
r17 = this;
|
||||
r6 = r17
|
||||
int r7 = r17.getPaddingLeft()
|
||||
int r0 = r20 - r18
|
||||
int r1 = r17.getPaddingRight()
|
||||
int r8 = r0 - r1
|
||||
int r0 = r0 - r7
|
||||
int r1 = r17.getPaddingRight()
|
||||
int r9 = r0 - r1
|
||||
int r10 = r17.getVirtualChildCount()
|
||||
int r0 = r6.e
|
||||
r1 = r0 & 112(0x70, float:1.57E-43)
|
||||
r2 = 8388615(0x800007, float:1.1754953E-38)
|
||||
r11 = r0 & r2
|
||||
r0 = 16
|
||||
if (r1 == r0) goto L3b
|
||||
r0 = 80
|
||||
if (r1 == r0) goto L2f
|
||||
int r0 = r17.getPaddingTop()
|
||||
goto L47
|
||||
L2f:
|
||||
int r0 = r17.getPaddingTop()
|
||||
int r0 = r0 + r21
|
||||
int r0 = r0 - r19
|
||||
int r1 = r6.f
|
||||
int r0 = r0 - r1
|
||||
goto L47
|
||||
L3b:
|
||||
int r0 = r17.getPaddingTop()
|
||||
int r1 = r21 - r19
|
||||
int r2 = r6.f
|
||||
int r1 = r1 - r2
|
||||
int r1 = r1 / 2
|
||||
int r0 = r0 + r1
|
||||
L47:
|
||||
r1 = 0
|
||||
r12 = 0
|
||||
L49:
|
||||
if (r12 >= r10) goto Lc9
|
||||
android.view.View r13 = r6.a(r12)
|
||||
r14 = 1
|
||||
if (r13 != 0) goto L59
|
||||
int r1 = r6.c(r12)
|
||||
int r0 = r0 + r1
|
||||
goto Lc6
|
||||
L59:
|
||||
int r1 = r13.getVisibility()
|
||||
r2 = 8
|
||||
if (r1 == r2) goto Lc6
|
||||
int r4 = r13.getMeasuredWidth()
|
||||
int r15 = r13.getMeasuredHeight()
|
||||
android.view.ViewGroup$LayoutParams r1 = r13.getLayoutParams()
|
||||
r5 = r1
|
||||
androidx.appcompat.widget.LinearLayoutCompat$LayoutParams r5 = (androidx.appcompat.widget.LinearLayoutCompat.LayoutParams) r5
|
||||
int r1 = r5.b
|
||||
if (r1 >= 0) goto L75
|
||||
r1 = r11
|
||||
L75:
|
||||
int r2 = androidx.core.view.ViewCompat.k(r17)
|
||||
int r1 = androidx.core.view.GravityCompat.a(r1, r2)
|
||||
r1 = r1 & 7
|
||||
if (r1 == r14) goto L8e
|
||||
r2 = 5
|
||||
if (r1 == r2) goto L89
|
||||
int r1 = r5.leftMargin
|
||||
int r1 = r1 + r7
|
||||
L87:
|
||||
r2 = r1
|
||||
goto L9a
|
||||
L89:
|
||||
int r1 = r8 - r4
|
||||
int r2 = r5.rightMargin
|
||||
goto L98
|
||||
L8e:
|
||||
int r1 = r9 - r4
|
||||
int r1 = r1 / 2
|
||||
int r1 = r1 + r7
|
||||
int r2 = r5.leftMargin
|
||||
int r1 = r1 + r2
|
||||
int r2 = r5.rightMargin
|
||||
L98:
|
||||
int r1 = r1 - r2
|
||||
goto L87
|
||||
L9a:
|
||||
boolean r1 = r6.b(r12)
|
||||
if (r1 == 0) goto La3
|
||||
int r1 = r6.m
|
||||
int r0 = r0 + r1
|
||||
La3:
|
||||
int r1 = r5.topMargin
|
||||
int r16 = r0 + r1
|
||||
int r0 = r6.a(r13)
|
||||
int r3 = r16 + r0
|
||||
r0 = r17
|
||||
r1 = r13
|
||||
r14 = r5
|
||||
r5 = r15
|
||||
r0.a(r1, r2, r3, r4, r5)
|
||||
int r0 = r14.bottomMargin
|
||||
int r15 = r15 + r0
|
||||
int r0 = r6.b(r13)
|
||||
int r15 = r15 + r0
|
||||
int r16 = r16 + r15
|
||||
int r0 = r6.a(r13, r12)
|
||||
int r12 = r12 + r0
|
||||
r0 = r16
|
||||
Lc6:
|
||||
r1 = 1
|
||||
int r12 = r12 + r1
|
||||
goto L49
|
||||
Lc9:
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.LinearLayoutCompat.b(int, int, int, int):void");
|
||||
}
|
||||
|
||||
void a(View view, int i, int i2, int i3, int i4, int i5) {
|
||||
measureChildWithMargins(view, i2, i3, i4, i5);
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:26:0x00a7 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:29:0x00b0 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:37:0x00f8 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:48:0x00e4 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
void a(int r25, int r26, int r27, int r28) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 321
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.LinearLayoutCompat.a(int, int, int, int):void");
|
||||
}
|
||||
|
||||
private void a(View view, int i, int i2, int i3, int i4) {
|
||||
view.layout(i, i2, i3 + i, i4 + i2);
|
||||
}
|
||||
}
|
||||
592
sources/androidx/appcompat/widget/ListPopupWindow.java
Normal file
592
sources/androidx/appcompat/widget/ListPopupWindow.java
Normal file
@@ -0,0 +1,592 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.database.DataSetObserver;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.PopupWindow;
|
||||
import androidx.appcompat.R$styleable;
|
||||
import androidx.appcompat.view.menu.ShowableListMenu;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.widget.PopupWindowCompat;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ListPopupWindow implements ShowableListMenu {
|
||||
private static Method G;
|
||||
private static Method H;
|
||||
private static Method I;
|
||||
private final ListSelectorHider A;
|
||||
final Handler B;
|
||||
private final Rect C;
|
||||
private Rect D;
|
||||
private boolean E;
|
||||
PopupWindow F;
|
||||
private Context a;
|
||||
private ListAdapter b;
|
||||
DropDownListView c;
|
||||
private int d;
|
||||
private int e;
|
||||
private int f;
|
||||
private int g;
|
||||
private int h;
|
||||
private boolean i;
|
||||
private boolean j;
|
||||
private boolean k;
|
||||
private int l;
|
||||
private boolean m;
|
||||
private boolean n;
|
||||
int o;
|
||||
private View p;
|
||||
private int q;
|
||||
private DataSetObserver r;
|
||||
private View s;
|
||||
private Drawable t;
|
||||
private AdapterView.OnItemClickListener u;
|
||||
private AdapterView.OnItemSelectedListener v;
|
||||
final ResizePopupRunnable x;
|
||||
private final PopupTouchInterceptor y;
|
||||
private final PopupScrollListener z;
|
||||
|
||||
private class ListSelectorHider implements Runnable {
|
||||
ListSelectorHider() {
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ListPopupWindow.this.b();
|
||||
}
|
||||
}
|
||||
|
||||
private class PopupDataSetObserver extends DataSetObserver {
|
||||
PopupDataSetObserver() {
|
||||
}
|
||||
|
||||
@Override // android.database.DataSetObserver
|
||||
public void onChanged() {
|
||||
if (ListPopupWindow.this.c()) {
|
||||
ListPopupWindow.this.a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.database.DataSetObserver
|
||||
public void onInvalidated() {
|
||||
ListPopupWindow.this.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
private class PopupScrollListener implements AbsListView.OnScrollListener {
|
||||
PopupScrollListener() {
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsListView.OnScrollListener
|
||||
public void onScroll(AbsListView absListView, int i, int i2, int i3) {
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsListView.OnScrollListener
|
||||
public void onScrollStateChanged(AbsListView absListView, int i) {
|
||||
if (i != 1 || ListPopupWindow.this.j() || ListPopupWindow.this.F.getContentView() == null) {
|
||||
return;
|
||||
}
|
||||
ListPopupWindow listPopupWindow = ListPopupWindow.this;
|
||||
listPopupWindow.B.removeCallbacks(listPopupWindow.x);
|
||||
ListPopupWindow.this.x.run();
|
||||
}
|
||||
}
|
||||
|
||||
private class PopupTouchInterceptor implements View.OnTouchListener {
|
||||
PopupTouchInterceptor() {
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnTouchListener
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
PopupWindow popupWindow;
|
||||
int action = motionEvent.getAction();
|
||||
int x = (int) motionEvent.getX();
|
||||
int y = (int) motionEvent.getY();
|
||||
if (action == 0 && (popupWindow = ListPopupWindow.this.F) != null && popupWindow.isShowing() && x >= 0 && x < ListPopupWindow.this.F.getWidth() && y >= 0 && y < ListPopupWindow.this.F.getHeight()) {
|
||||
ListPopupWindow listPopupWindow = ListPopupWindow.this;
|
||||
listPopupWindow.B.postDelayed(listPopupWindow.x, 250L);
|
||||
return false;
|
||||
}
|
||||
if (action != 1) {
|
||||
return false;
|
||||
}
|
||||
ListPopupWindow listPopupWindow2 = ListPopupWindow.this;
|
||||
listPopupWindow2.B.removeCallbacks(listPopupWindow2.x);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private class ResizePopupRunnable implements Runnable {
|
||||
ResizePopupRunnable() {
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
DropDownListView dropDownListView = ListPopupWindow.this.c;
|
||||
if (dropDownListView == null || !ViewCompat.w(dropDownListView) || ListPopupWindow.this.c.getCount() <= ListPopupWindow.this.c.getChildCount()) {
|
||||
return;
|
||||
}
|
||||
int childCount = ListPopupWindow.this.c.getChildCount();
|
||||
ListPopupWindow listPopupWindow = ListPopupWindow.this;
|
||||
if (childCount <= listPopupWindow.o) {
|
||||
listPopupWindow.F.setInputMethodMode(2);
|
||||
ListPopupWindow.this.a();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
try {
|
||||
G = PopupWindow.class.getDeclaredMethod("setClipToScreenEnabled", Boolean.TYPE);
|
||||
} catch (NoSuchMethodException unused) {
|
||||
Log.i("ListPopupWindow", "Could not find method setClipToScreenEnabled() on PopupWindow. Oh well.");
|
||||
}
|
||||
try {
|
||||
H = PopupWindow.class.getDeclaredMethod("getMaxAvailableHeight", View.class, Integer.TYPE, Boolean.TYPE);
|
||||
} catch (NoSuchMethodException unused2) {
|
||||
Log.i("ListPopupWindow", "Could not find method getMaxAvailableHeight(View, int, boolean) on PopupWindow. Oh well.");
|
||||
}
|
||||
try {
|
||||
I = PopupWindow.class.getDeclaredMethod("setEpicenterBounds", Rect.class);
|
||||
} catch (NoSuchMethodException unused3) {
|
||||
Log.i("ListPopupWindow", "Could not find method setEpicenterBounds(Rect) on PopupWindow. Oh well.");
|
||||
}
|
||||
}
|
||||
|
||||
public ListPopupWindow(Context context, AttributeSet attributeSet, int i) {
|
||||
this(context, attributeSet, i, 0);
|
||||
}
|
||||
|
||||
private int l() {
|
||||
int i;
|
||||
int i2;
|
||||
int makeMeasureSpec;
|
||||
int i3;
|
||||
if (this.c == null) {
|
||||
Context context = this.a;
|
||||
new Runnable() { // from class: androidx.appcompat.widget.ListPopupWindow.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
View e = ListPopupWindow.this.e();
|
||||
if (e == null || e.getWindowToken() == null) {
|
||||
return;
|
||||
}
|
||||
ListPopupWindow.this.a();
|
||||
}
|
||||
};
|
||||
this.c = a(context, !this.E);
|
||||
Drawable drawable = this.t;
|
||||
if (drawable != null) {
|
||||
this.c.setSelector(drawable);
|
||||
}
|
||||
this.c.setAdapter(this.b);
|
||||
this.c.setOnItemClickListener(this.u);
|
||||
this.c.setFocusable(true);
|
||||
this.c.setFocusableInTouchMode(true);
|
||||
this.c.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { // from class: androidx.appcompat.widget.ListPopupWindow.3
|
||||
@Override // android.widget.AdapterView.OnItemSelectedListener
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int i4, long j) {
|
||||
DropDownListView dropDownListView;
|
||||
if (i4 == -1 || (dropDownListView = ListPopupWindow.this.c) == null) {
|
||||
return;
|
||||
}
|
||||
dropDownListView.setListSelectionHidden(false);
|
||||
}
|
||||
|
||||
@Override // android.widget.AdapterView.OnItemSelectedListener
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
}
|
||||
});
|
||||
this.c.setOnScrollListener(this.z);
|
||||
AdapterView.OnItemSelectedListener onItemSelectedListener = this.v;
|
||||
if (onItemSelectedListener != null) {
|
||||
this.c.setOnItemSelectedListener(onItemSelectedListener);
|
||||
}
|
||||
View view = this.c;
|
||||
View view2 = this.p;
|
||||
if (view2 != null) {
|
||||
LinearLayout linearLayout = new LinearLayout(context);
|
||||
linearLayout.setOrientation(1);
|
||||
ViewGroup.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, 0, 1.0f);
|
||||
int i4 = this.q;
|
||||
if (i4 == 0) {
|
||||
linearLayout.addView(view2);
|
||||
linearLayout.addView(view, layoutParams);
|
||||
} else if (i4 != 1) {
|
||||
Log.e("ListPopupWindow", "Invalid hint position " + this.q);
|
||||
} else {
|
||||
linearLayout.addView(view, layoutParams);
|
||||
linearLayout.addView(view2);
|
||||
}
|
||||
int i5 = this.e;
|
||||
if (i5 >= 0) {
|
||||
i3 = Integer.MIN_VALUE;
|
||||
} else {
|
||||
i5 = 0;
|
||||
i3 = 0;
|
||||
}
|
||||
view2.measure(View.MeasureSpec.makeMeasureSpec(i5, i3), 0);
|
||||
LinearLayout.LayoutParams layoutParams2 = (LinearLayout.LayoutParams) view2.getLayoutParams();
|
||||
i = view2.getMeasuredHeight() + layoutParams2.topMargin + layoutParams2.bottomMargin;
|
||||
view = linearLayout;
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
this.F.setContentView(view);
|
||||
} else {
|
||||
View view3 = this.p;
|
||||
if (view3 != null) {
|
||||
LinearLayout.LayoutParams layoutParams3 = (LinearLayout.LayoutParams) view3.getLayoutParams();
|
||||
i = view3.getMeasuredHeight() + layoutParams3.topMargin + layoutParams3.bottomMargin;
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
Drawable background = this.F.getBackground();
|
||||
if (background != null) {
|
||||
background.getPadding(this.C);
|
||||
Rect rect = this.C;
|
||||
int i6 = rect.top;
|
||||
i2 = rect.bottom + i6;
|
||||
if (!this.i) {
|
||||
this.g = -i6;
|
||||
}
|
||||
} else {
|
||||
this.C.setEmpty();
|
||||
i2 = 0;
|
||||
}
|
||||
int a = a(e(), this.g, this.F.getInputMethodMode() == 2);
|
||||
if (this.m || this.d == -1) {
|
||||
return a + i2;
|
||||
}
|
||||
int i7 = this.e;
|
||||
if (i7 == -2) {
|
||||
int i8 = this.a.getResources().getDisplayMetrics().widthPixels;
|
||||
Rect rect2 = this.C;
|
||||
makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i8 - (rect2.left + rect2.right), Integer.MIN_VALUE);
|
||||
} else if (i7 != -1) {
|
||||
makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i7, 1073741824);
|
||||
} else {
|
||||
int i9 = this.a.getResources().getDisplayMetrics().widthPixels;
|
||||
Rect rect3 = this.C;
|
||||
makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i9 - (rect3.left + rect3.right), 1073741824);
|
||||
}
|
||||
int a2 = this.c.a(makeMeasureSpec, 0, -1, a - i, -1);
|
||||
if (a2 > 0) {
|
||||
i += i2 + this.c.getPaddingTop() + this.c.getPaddingBottom();
|
||||
}
|
||||
return a2 + i;
|
||||
}
|
||||
|
||||
private void m() {
|
||||
View view = this.p;
|
||||
if (view != null) {
|
||||
ViewParent parent = view.getParent();
|
||||
if (parent instanceof ViewGroup) {
|
||||
((ViewGroup) parent).removeView(this.p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(ListAdapter listAdapter) {
|
||||
DataSetObserver dataSetObserver = this.r;
|
||||
if (dataSetObserver == null) {
|
||||
this.r = new PopupDataSetObserver();
|
||||
} else {
|
||||
ListAdapter listAdapter2 = this.b;
|
||||
if (listAdapter2 != null) {
|
||||
listAdapter2.unregisterDataSetObserver(dataSetObserver);
|
||||
}
|
||||
}
|
||||
this.b = listAdapter;
|
||||
if (listAdapter != null) {
|
||||
listAdapter.registerDataSetObserver(this.r);
|
||||
}
|
||||
DropDownListView dropDownListView = this.c;
|
||||
if (dropDownListView != null) {
|
||||
dropDownListView.setAdapter(this.b);
|
||||
}
|
||||
}
|
||||
|
||||
public void b(int i) {
|
||||
Drawable background = this.F.getBackground();
|
||||
if (background == null) {
|
||||
i(i);
|
||||
return;
|
||||
}
|
||||
background.getPadding(this.C);
|
||||
Rect rect = this.C;
|
||||
this.e = rect.left + rect.right + i;
|
||||
}
|
||||
|
||||
public void c(int i) {
|
||||
this.l = i;
|
||||
}
|
||||
|
||||
public void d(int i) {
|
||||
this.f = i;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ShowableListMenu
|
||||
public void dismiss() {
|
||||
this.F.dismiss();
|
||||
m();
|
||||
this.F.setContentView(null);
|
||||
this.c = null;
|
||||
this.B.removeCallbacks(this.x);
|
||||
}
|
||||
|
||||
public View e() {
|
||||
return this.s;
|
||||
}
|
||||
|
||||
public void f(int i) {
|
||||
this.q = i;
|
||||
}
|
||||
|
||||
public int g() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public int h() {
|
||||
if (this.i) {
|
||||
return this.g;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int i() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public boolean j() {
|
||||
return this.F.getInputMethodMode() == 2;
|
||||
}
|
||||
|
||||
public boolean k() {
|
||||
return this.E;
|
||||
}
|
||||
|
||||
public ListPopupWindow(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
this.d = -2;
|
||||
this.e = -2;
|
||||
this.h = 1002;
|
||||
this.l = 0;
|
||||
this.m = false;
|
||||
this.n = false;
|
||||
this.o = Integer.MAX_VALUE;
|
||||
this.q = 0;
|
||||
this.x = new ResizePopupRunnable();
|
||||
this.y = new PopupTouchInterceptor();
|
||||
this.z = new PopupScrollListener();
|
||||
this.A = new ListSelectorHider();
|
||||
this.C = new Rect();
|
||||
this.a = context;
|
||||
this.B = new Handler(context.getMainLooper());
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.ListPopupWindow, i, i2);
|
||||
this.f = obtainStyledAttributes.getDimensionPixelOffset(R$styleable.ListPopupWindow_android_dropDownHorizontalOffset, 0);
|
||||
this.g = obtainStyledAttributes.getDimensionPixelOffset(R$styleable.ListPopupWindow_android_dropDownVerticalOffset, 0);
|
||||
if (this.g != 0) {
|
||||
this.i = true;
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
this.F = new AppCompatPopupWindow(context, attributeSet, i, i2);
|
||||
this.F.setInputMethodMode(1);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ShowableListMenu
|
||||
public boolean c() {
|
||||
return this.F.isShowing();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ShowableListMenu
|
||||
public ListView d() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public void e(int i) {
|
||||
this.F.setInputMethodMode(i);
|
||||
}
|
||||
|
||||
public Drawable f() {
|
||||
return this.F.getBackground();
|
||||
}
|
||||
|
||||
public void g(int i) {
|
||||
DropDownListView dropDownListView = this.c;
|
||||
if (!c() || dropDownListView == null) {
|
||||
return;
|
||||
}
|
||||
dropDownListView.setListSelectionHidden(false);
|
||||
dropDownListView.setSelection(i);
|
||||
if (dropDownListView.getChoiceMode() != 0) {
|
||||
dropDownListView.setItemChecked(i, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void i(int i) {
|
||||
this.e = i;
|
||||
}
|
||||
|
||||
private void c(boolean z) {
|
||||
Method method = G;
|
||||
if (method != null) {
|
||||
try {
|
||||
method.invoke(this.F, Boolean.valueOf(z));
|
||||
} catch (Exception unused) {
|
||||
Log.i("ListPopupWindow", "Could not call setClipToScreenEnabled() on PopupWindow. Oh well.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void h(int i) {
|
||||
this.g = i;
|
||||
this.i = true;
|
||||
}
|
||||
|
||||
public void b() {
|
||||
DropDownListView dropDownListView = this.c;
|
||||
if (dropDownListView != null) {
|
||||
dropDownListView.setListSelectionHidden(true);
|
||||
dropDownListView.requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void b(boolean z) {
|
||||
this.k = true;
|
||||
this.j = z;
|
||||
}
|
||||
|
||||
public void a(boolean z) {
|
||||
this.E = z;
|
||||
this.F.setFocusable(z);
|
||||
}
|
||||
|
||||
public void a(Drawable drawable) {
|
||||
this.F.setBackgroundDrawable(drawable);
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
this.F.setAnimationStyle(i);
|
||||
}
|
||||
|
||||
public void a(View view) {
|
||||
this.s = view;
|
||||
}
|
||||
|
||||
public void a(Rect rect) {
|
||||
this.D = rect;
|
||||
}
|
||||
|
||||
public void a(AdapterView.OnItemClickListener onItemClickListener) {
|
||||
this.u = onItemClickListener;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ShowableListMenu
|
||||
public void a() {
|
||||
int l = l();
|
||||
boolean j = j();
|
||||
PopupWindowCompat.a(this.F, this.h);
|
||||
if (this.F.isShowing()) {
|
||||
if (ViewCompat.w(e())) {
|
||||
int i = this.e;
|
||||
if (i == -1) {
|
||||
i = -1;
|
||||
} else if (i == -2) {
|
||||
i = e().getWidth();
|
||||
}
|
||||
int i2 = this.d;
|
||||
if (i2 == -1) {
|
||||
if (!j) {
|
||||
l = -1;
|
||||
}
|
||||
if (j) {
|
||||
this.F.setWidth(this.e == -1 ? -1 : 0);
|
||||
this.F.setHeight(0);
|
||||
} else {
|
||||
this.F.setWidth(this.e == -1 ? -1 : 0);
|
||||
this.F.setHeight(-1);
|
||||
}
|
||||
} else if (i2 != -2) {
|
||||
l = i2;
|
||||
}
|
||||
this.F.setOutsideTouchable((this.n || this.m) ? false : true);
|
||||
this.F.update(e(), this.f, this.g, i < 0 ? -1 : i, l < 0 ? -1 : l);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
int i3 = this.e;
|
||||
if (i3 == -1) {
|
||||
i3 = -1;
|
||||
} else if (i3 == -2) {
|
||||
i3 = e().getWidth();
|
||||
}
|
||||
int i4 = this.d;
|
||||
if (i4 == -1) {
|
||||
l = -1;
|
||||
} else if (i4 != -2) {
|
||||
l = i4;
|
||||
}
|
||||
this.F.setWidth(i3);
|
||||
this.F.setHeight(l);
|
||||
c(true);
|
||||
this.F.setOutsideTouchable((this.n || this.m) ? false : true);
|
||||
this.F.setTouchInterceptor(this.y);
|
||||
if (this.k) {
|
||||
PopupWindowCompat.a(this.F, this.j);
|
||||
}
|
||||
Method method = I;
|
||||
if (method != null) {
|
||||
try {
|
||||
method.invoke(this.F, this.D);
|
||||
} catch (Exception e) {
|
||||
Log.e("ListPopupWindow", "Could not invoke setEpicenterBounds on PopupWindow", e);
|
||||
}
|
||||
}
|
||||
PopupWindowCompat.a(this.F, e(), this.f, this.g, this.l);
|
||||
this.c.setSelection(-1);
|
||||
if (!this.E || this.c.isInTouchMode()) {
|
||||
b();
|
||||
}
|
||||
if (this.E) {
|
||||
return;
|
||||
}
|
||||
this.B.post(this.A);
|
||||
}
|
||||
|
||||
public void a(PopupWindow.OnDismissListener onDismissListener) {
|
||||
this.F.setOnDismissListener(onDismissListener);
|
||||
}
|
||||
|
||||
DropDownListView a(Context context, boolean z) {
|
||||
return new DropDownListView(context, z);
|
||||
}
|
||||
|
||||
private int a(View view, int i, boolean z) {
|
||||
Method method = H;
|
||||
if (method != null) {
|
||||
try {
|
||||
return ((Integer) method.invoke(this.F, view, Integer.valueOf(i), Boolean.valueOf(z))).intValue();
|
||||
} catch (Exception unused) {
|
||||
Log.i("ListPopupWindow", "Could not call getMaxAvailableHeightMethod(View, int, boolean) on PopupWindow. Using the public version.");
|
||||
}
|
||||
}
|
||||
return this.F.getMaxAvailableHeight(view, i);
|
||||
}
|
||||
}
|
||||
11
sources/androidx/appcompat/widget/MenuItemHoverListener.java
Normal file
11
sources/androidx/appcompat/widget/MenuItemHoverListener.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.view.MenuItem;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface MenuItemHoverListener {
|
||||
void a(MenuBuilder menuBuilder, MenuItem menuItem);
|
||||
|
||||
void b(MenuBuilder menuBuilder, MenuItem menuItem);
|
||||
}
|
||||
168
sources/androidx/appcompat/widget/MenuPopupWindow.java
Normal file
168
sources/androidx/appcompat/widget/MenuPopupWindow.java
Normal file
@@ -0,0 +1,168 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.transition.Transition;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.HeaderViewListAdapter;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.PopupWindow;
|
||||
import androidx.appcompat.view.menu.ListMenuItemView;
|
||||
import androidx.appcompat.view.menu.MenuAdapter;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
import androidx.appcompat.view.menu.MenuItemImpl;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MenuPopupWindow extends ListPopupWindow implements MenuItemHoverListener {
|
||||
private static Method K;
|
||||
private MenuItemHoverListener J;
|
||||
|
||||
public static class MenuDropDownListView extends DropDownListView {
|
||||
final int o;
|
||||
final int p;
|
||||
private MenuItemHoverListener q;
|
||||
private MenuItem r;
|
||||
|
||||
public MenuDropDownListView(Context context, boolean z) {
|
||||
super(context, z);
|
||||
Configuration configuration = context.getResources().getConfiguration();
|
||||
if (Build.VERSION.SDK_INT < 17 || 1 != configuration.getLayoutDirection()) {
|
||||
this.o = 22;
|
||||
this.p = 21;
|
||||
} else {
|
||||
this.o = 21;
|
||||
this.p = 22;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DropDownListView, android.view.View
|
||||
public boolean onHoverEvent(MotionEvent motionEvent) {
|
||||
int i;
|
||||
MenuAdapter menuAdapter;
|
||||
int pointToPosition;
|
||||
int i2;
|
||||
if (this.q != null) {
|
||||
ListAdapter adapter = getAdapter();
|
||||
if (adapter instanceof HeaderViewListAdapter) {
|
||||
HeaderViewListAdapter headerViewListAdapter = (HeaderViewListAdapter) adapter;
|
||||
i = headerViewListAdapter.getHeadersCount();
|
||||
menuAdapter = (MenuAdapter) headerViewListAdapter.getWrappedAdapter();
|
||||
} else {
|
||||
i = 0;
|
||||
menuAdapter = (MenuAdapter) adapter;
|
||||
}
|
||||
MenuItemImpl menuItemImpl = null;
|
||||
if (motionEvent.getAction() != 10 && (pointToPosition = pointToPosition((int) motionEvent.getX(), (int) motionEvent.getY())) != -1 && (i2 = pointToPosition - i) >= 0 && i2 < menuAdapter.getCount()) {
|
||||
menuItemImpl = menuAdapter.getItem(i2);
|
||||
}
|
||||
MenuItem menuItem = this.r;
|
||||
if (menuItem != menuItemImpl) {
|
||||
MenuBuilder b = menuAdapter.b();
|
||||
if (menuItem != null) {
|
||||
this.q.b(b, menuItem);
|
||||
}
|
||||
this.r = menuItemImpl;
|
||||
if (menuItemImpl != null) {
|
||||
this.q.a(b, menuItemImpl);
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onHoverEvent(motionEvent);
|
||||
}
|
||||
|
||||
@Override // android.widget.ListView, android.widget.AbsListView, android.view.View, android.view.KeyEvent.Callback
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
ListMenuItemView listMenuItemView = (ListMenuItemView) getSelectedView();
|
||||
if (listMenuItemView != null && i == this.o) {
|
||||
if (listMenuItemView.isEnabled() && listMenuItemView.getItemData().hasSubMenu()) {
|
||||
performItemClick(listMenuItemView, getSelectedItemPosition(), getSelectedItemId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (listMenuItemView == null || i != this.p) {
|
||||
return super.onKeyDown(i, keyEvent);
|
||||
}
|
||||
setSelection(-1);
|
||||
((MenuAdapter) getAdapter()).b().a(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setHoverListener(MenuItemHoverListener menuItemHoverListener) {
|
||||
this.q = menuItemHoverListener;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DropDownListView, android.widget.AbsListView
|
||||
public /* bridge */ /* synthetic */ void setSelector(Drawable drawable) {
|
||||
super.setSelector(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
try {
|
||||
K = PopupWindow.class.getDeclaredMethod("setTouchModal", Boolean.TYPE);
|
||||
} catch (NoSuchMethodException unused) {
|
||||
Log.i("MenuPopupWindow", "Could not find method setTouchModal() on PopupWindow. Oh well.");
|
||||
}
|
||||
}
|
||||
|
||||
public MenuPopupWindow(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
super(context, attributeSet, i, i2);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ListPopupWindow
|
||||
DropDownListView a(Context context, boolean z) {
|
||||
MenuDropDownListView menuDropDownListView = new MenuDropDownListView(context, z);
|
||||
menuDropDownListView.setHoverListener(this);
|
||||
return menuDropDownListView;
|
||||
}
|
||||
|
||||
public void b(Object obj) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
this.F.setExitTransition((Transition) obj);
|
||||
}
|
||||
}
|
||||
|
||||
public void c(boolean z) {
|
||||
Method method = K;
|
||||
if (method != null) {
|
||||
try {
|
||||
method.invoke(this.F, Boolean.valueOf(z));
|
||||
} catch (Exception unused) {
|
||||
Log.i("MenuPopupWindow", "Could not invoke setTouchModal() on PopupWindow. Oh well.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Object obj) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
this.F.setEnterTransition((Transition) obj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.MenuItemHoverListener
|
||||
public void b(MenuBuilder menuBuilder, MenuItem menuItem) {
|
||||
MenuItemHoverListener menuItemHoverListener = this.J;
|
||||
if (menuItemHoverListener != null) {
|
||||
menuItemHoverListener.b(menuBuilder, menuItem);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(MenuItemHoverListener menuItemHoverListener) {
|
||||
this.J = menuItemHoverListener;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.MenuItemHoverListener
|
||||
public void a(MenuBuilder menuBuilder, MenuItem menuItem) {
|
||||
MenuItemHoverListener menuItemHoverListener = this.J;
|
||||
if (menuItemHoverListener != null) {
|
||||
menuItemHoverListener.a(menuBuilder, menuItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
251
sources/androidx/appcompat/widget/ResourcesWrapper.java
Normal file
251
sources/androidx/appcompat/widget/ResourcesWrapper.java
Normal file
@@ -0,0 +1,251 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import android.graphics.Movie;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ResourcesWrapper extends Resources {
|
||||
private final Resources a;
|
||||
|
||||
public ResourcesWrapper(Resources resources) {
|
||||
super(resources.getAssets(), resources.getDisplayMetrics(), resources.getConfiguration());
|
||||
this.a = resources;
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public XmlResourceParser getAnimation(int i) throws Resources.NotFoundException {
|
||||
return this.a.getAnimation(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public boolean getBoolean(int i) throws Resources.NotFoundException {
|
||||
return this.a.getBoolean(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public int getColor(int i) throws Resources.NotFoundException {
|
||||
return this.a.getColor(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public ColorStateList getColorStateList(int i) throws Resources.NotFoundException {
|
||||
return this.a.getColorStateList(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public Configuration getConfiguration() {
|
||||
return this.a.getConfiguration();
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public float getDimension(int i) throws Resources.NotFoundException {
|
||||
return this.a.getDimension(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public int getDimensionPixelOffset(int i) throws Resources.NotFoundException {
|
||||
return this.a.getDimensionPixelOffset(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public int getDimensionPixelSize(int i) throws Resources.NotFoundException {
|
||||
return this.a.getDimensionPixelSize(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public DisplayMetrics getDisplayMetrics() {
|
||||
return this.a.getDisplayMetrics();
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public Drawable getDrawable(int i) throws Resources.NotFoundException {
|
||||
return this.a.getDrawable(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public Drawable getDrawableForDensity(int i, int i2) throws Resources.NotFoundException {
|
||||
return this.a.getDrawableForDensity(i, i2);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public float getFraction(int i, int i2, int i3) {
|
||||
return this.a.getFraction(i, i2, i3);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public int getIdentifier(String str, String str2, String str3) {
|
||||
return this.a.getIdentifier(str, str2, str3);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public int[] getIntArray(int i) throws Resources.NotFoundException {
|
||||
return this.a.getIntArray(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public int getInteger(int i) throws Resources.NotFoundException {
|
||||
return this.a.getInteger(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public XmlResourceParser getLayout(int i) throws Resources.NotFoundException {
|
||||
return this.a.getLayout(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public Movie getMovie(int i) throws Resources.NotFoundException {
|
||||
return this.a.getMovie(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String getQuantityString(int i, int i2, Object... objArr) throws Resources.NotFoundException {
|
||||
return this.a.getQuantityString(i, i2, objArr);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public CharSequence getQuantityText(int i, int i2) throws Resources.NotFoundException {
|
||||
return this.a.getQuantityText(i, i2);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String getResourceEntryName(int i) throws Resources.NotFoundException {
|
||||
return this.a.getResourceEntryName(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String getResourceName(int i) throws Resources.NotFoundException {
|
||||
return this.a.getResourceName(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String getResourcePackageName(int i) throws Resources.NotFoundException {
|
||||
return this.a.getResourcePackageName(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String getResourceTypeName(int i) throws Resources.NotFoundException {
|
||||
return this.a.getResourceTypeName(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String getString(int i) throws Resources.NotFoundException {
|
||||
return this.a.getString(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String[] getStringArray(int i) throws Resources.NotFoundException {
|
||||
return this.a.getStringArray(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public CharSequence getText(int i) throws Resources.NotFoundException {
|
||||
return this.a.getText(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public CharSequence[] getTextArray(int i) throws Resources.NotFoundException {
|
||||
return this.a.getTextArray(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public void getValue(int i, TypedValue typedValue, boolean z) throws Resources.NotFoundException {
|
||||
this.a.getValue(i, typedValue, z);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public void getValueForDensity(int i, int i2, TypedValue typedValue, boolean z) throws Resources.NotFoundException {
|
||||
this.a.getValueForDensity(i, i2, typedValue, z);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public XmlResourceParser getXml(int i) throws Resources.NotFoundException {
|
||||
return this.a.getXml(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public TypedArray obtainAttributes(AttributeSet attributeSet, int[] iArr) {
|
||||
return this.a.obtainAttributes(attributeSet, iArr);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public TypedArray obtainTypedArray(int i) throws Resources.NotFoundException {
|
||||
return this.a.obtainTypedArray(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public InputStream openRawResource(int i) throws Resources.NotFoundException {
|
||||
return this.a.openRawResource(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public AssetFileDescriptor openRawResourceFd(int i) throws Resources.NotFoundException {
|
||||
return this.a.openRawResourceFd(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public void parseBundleExtra(String str, AttributeSet attributeSet, Bundle bundle) throws XmlPullParserException {
|
||||
this.a.parseBundleExtra(str, attributeSet, bundle);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public void parseBundleExtras(XmlResourceParser xmlResourceParser, Bundle bundle) throws XmlPullParserException, IOException {
|
||||
this.a.parseBundleExtras(xmlResourceParser, bundle);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public void updateConfiguration(Configuration configuration, DisplayMetrics displayMetrics) {
|
||||
super.updateConfiguration(configuration, displayMetrics);
|
||||
Resources resources = this.a;
|
||||
if (resources != null) {
|
||||
resources.updateConfiguration(configuration, displayMetrics);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public Drawable getDrawable(int i, Resources.Theme theme) throws Resources.NotFoundException {
|
||||
return this.a.getDrawable(i, theme);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public Drawable getDrawableForDensity(int i, int i2, Resources.Theme theme) {
|
||||
return this.a.getDrawableForDensity(i, i2, theme);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String getQuantityString(int i, int i2) throws Resources.NotFoundException {
|
||||
return this.a.getQuantityString(i, i2);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String getString(int i, Object... objArr) throws Resources.NotFoundException {
|
||||
return this.a.getString(i, objArr);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public CharSequence getText(int i, CharSequence charSequence) {
|
||||
return this.a.getText(i, charSequence);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public void getValue(String str, TypedValue typedValue, boolean z) throws Resources.NotFoundException {
|
||||
this.a.getValue(str, typedValue, z);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public InputStream openRawResource(int i, TypedValue typedValue) throws Resources.NotFoundException {
|
||||
return this.a.openRawResource(i, typedValue);
|
||||
}
|
||||
}
|
||||
101
sources/androidx/appcompat/widget/RtlSpacingHelper.java
Normal file
101
sources/androidx/appcompat/widget/RtlSpacingHelper.java
Normal file
@@ -0,0 +1,101 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class RtlSpacingHelper {
|
||||
private int a = 0;
|
||||
private int b = 0;
|
||||
private int c = Integer.MIN_VALUE;
|
||||
private int d = Integer.MIN_VALUE;
|
||||
private int e = 0;
|
||||
private int f = 0;
|
||||
private boolean g = false;
|
||||
private boolean h = false;
|
||||
|
||||
RtlSpacingHelper() {
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return this.g ? this.a : this.b;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return this.g ? this.b : this.a;
|
||||
}
|
||||
|
||||
public void a(int i, int i2) {
|
||||
this.h = false;
|
||||
if (i != Integer.MIN_VALUE) {
|
||||
this.e = i;
|
||||
this.a = i;
|
||||
}
|
||||
if (i2 != Integer.MIN_VALUE) {
|
||||
this.f = i2;
|
||||
this.b = i2;
|
||||
}
|
||||
}
|
||||
|
||||
public void b(int i, int i2) {
|
||||
this.c = i;
|
||||
this.d = i2;
|
||||
this.h = true;
|
||||
if (this.g) {
|
||||
if (i2 != Integer.MIN_VALUE) {
|
||||
this.a = i2;
|
||||
}
|
||||
if (i != Integer.MIN_VALUE) {
|
||||
this.b = i;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (i != Integer.MIN_VALUE) {
|
||||
this.a = i;
|
||||
}
|
||||
if (i2 != Integer.MIN_VALUE) {
|
||||
this.b = i2;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(boolean z) {
|
||||
if (z == this.g) {
|
||||
return;
|
||||
}
|
||||
this.g = z;
|
||||
if (!this.h) {
|
||||
this.a = this.e;
|
||||
this.b = this.f;
|
||||
return;
|
||||
}
|
||||
if (z) {
|
||||
int i = this.d;
|
||||
if (i == Integer.MIN_VALUE) {
|
||||
i = this.e;
|
||||
}
|
||||
this.a = i;
|
||||
int i2 = this.c;
|
||||
if (i2 == Integer.MIN_VALUE) {
|
||||
i2 = this.f;
|
||||
}
|
||||
this.b = i2;
|
||||
return;
|
||||
}
|
||||
int i3 = this.c;
|
||||
if (i3 == Integer.MIN_VALUE) {
|
||||
i3 = this.e;
|
||||
}
|
||||
this.a = i3;
|
||||
int i4 = this.d;
|
||||
if (i4 == Integer.MIN_VALUE) {
|
||||
i4 = this.f;
|
||||
}
|
||||
this.b = i4;
|
||||
}
|
||||
}
|
||||
401
sources/androidx/appcompat/widget/ScrollingTabContainerView.java
Normal file
401
sources/androidx/appcompat/widget/ScrollingTabContainerView.java
Normal file
@@ -0,0 +1,401 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.HorizontalScrollView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.SpinnerAdapter;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.view.ActionBarPolicy;
|
||||
import androidx.appcompat.widget.LinearLayoutCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ScrollingTabContainerView extends HorizontalScrollView implements AdapterView.OnItemSelectedListener {
|
||||
Runnable a;
|
||||
private TabClickListener b;
|
||||
LinearLayoutCompat c;
|
||||
private Spinner d;
|
||||
private boolean e;
|
||||
int f;
|
||||
int g;
|
||||
private int h;
|
||||
private int i;
|
||||
|
||||
private class TabAdapter extends BaseAdapter {
|
||||
TabAdapter() {
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getCount() {
|
||||
return ScrollingTabContainerView.this.c.getChildCount();
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public Object getItem(int i) {
|
||||
return ((TabView) ScrollingTabContainerView.this.c.getChildAt(i)).a();
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
if (view == null) {
|
||||
return ScrollingTabContainerView.this.a((ActionBar.Tab) getItem(i), true);
|
||||
}
|
||||
((TabView) view).a((ActionBar.Tab) getItem(i));
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
||||
private class TabClickListener implements View.OnClickListener {
|
||||
TabClickListener() {
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
((TabView) view).a().e();
|
||||
int childCount = ScrollingTabContainerView.this.c.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View childAt = ScrollingTabContainerView.this.c.getChildAt(i);
|
||||
childAt.setSelected(childAt == view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
new DecelerateInterpolator();
|
||||
}
|
||||
|
||||
private Spinner a() {
|
||||
AppCompatSpinner appCompatSpinner = new AppCompatSpinner(getContext(), null, R$attr.actionDropDownStyle);
|
||||
appCompatSpinner.setLayoutParams(new LinearLayoutCompat.LayoutParams(-2, -1));
|
||||
appCompatSpinner.setOnItemSelectedListener(this);
|
||||
return appCompatSpinner;
|
||||
}
|
||||
|
||||
private boolean b() {
|
||||
Spinner spinner = this.d;
|
||||
return spinner != null && spinner.getParent() == this;
|
||||
}
|
||||
|
||||
private void c() {
|
||||
if (b()) {
|
||||
return;
|
||||
}
|
||||
if (this.d == null) {
|
||||
this.d = a();
|
||||
}
|
||||
removeView(this.c);
|
||||
addView(this.d, new ViewGroup.LayoutParams(-2, -1));
|
||||
if (this.d.getAdapter() == null) {
|
||||
this.d.setAdapter((SpinnerAdapter) new TabAdapter());
|
||||
}
|
||||
Runnable runnable = this.a;
|
||||
if (runnable != null) {
|
||||
removeCallbacks(runnable);
|
||||
this.a = null;
|
||||
}
|
||||
this.d.setSelection(this.i);
|
||||
}
|
||||
|
||||
private boolean d() {
|
||||
if (!b()) {
|
||||
return false;
|
||||
}
|
||||
removeView(this.d);
|
||||
addView(this.c, new ViewGroup.LayoutParams(-2, -1));
|
||||
setTabSelected(this.d.getSelectedItemPosition());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
public void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
Runnable runnable = this.a;
|
||||
if (runnable != null) {
|
||||
post(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onConfigurationChanged(Configuration configuration) {
|
||||
super.onConfigurationChanged(configuration);
|
||||
ActionBarPolicy a = ActionBarPolicy.a(getContext());
|
||||
setContentHeight(a.e());
|
||||
this.g = a.d();
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
Runnable runnable = this.a;
|
||||
if (runnable != null) {
|
||||
removeCallbacks(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.AdapterView.OnItemSelectedListener
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
|
||||
((TabView) view).a().e();
|
||||
}
|
||||
|
||||
@Override // android.widget.HorizontalScrollView, android.widget.FrameLayout, android.view.View
|
||||
public void onMeasure(int i, int i2) {
|
||||
int mode = View.MeasureSpec.getMode(i);
|
||||
boolean z = mode == 1073741824;
|
||||
setFillViewport(z);
|
||||
int childCount = this.c.getChildCount();
|
||||
if (childCount <= 1 || !(mode == 1073741824 || mode == Integer.MIN_VALUE)) {
|
||||
this.f = -1;
|
||||
} else {
|
||||
if (childCount > 2) {
|
||||
this.f = (int) (View.MeasureSpec.getSize(i) * 0.4f);
|
||||
} else {
|
||||
this.f = View.MeasureSpec.getSize(i) / 2;
|
||||
}
|
||||
this.f = Math.min(this.f, this.g);
|
||||
}
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(this.h, 1073741824);
|
||||
if (!z && this.e) {
|
||||
this.c.measure(0, makeMeasureSpec);
|
||||
if (this.c.getMeasuredWidth() > View.MeasureSpec.getSize(i)) {
|
||||
c();
|
||||
} else {
|
||||
d();
|
||||
}
|
||||
} else {
|
||||
d();
|
||||
}
|
||||
int measuredWidth = getMeasuredWidth();
|
||||
super.onMeasure(i, makeMeasureSpec);
|
||||
int measuredWidth2 = getMeasuredWidth();
|
||||
if (!z || measuredWidth == measuredWidth2) {
|
||||
return;
|
||||
}
|
||||
setTabSelected(this.i);
|
||||
}
|
||||
|
||||
@Override // android.widget.AdapterView.OnItemSelectedListener
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
}
|
||||
|
||||
public void setAllowCollapse(boolean z) {
|
||||
this.e = z;
|
||||
}
|
||||
|
||||
public void setContentHeight(int i) {
|
||||
this.h = i;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public void setTabSelected(int i) {
|
||||
this.i = i;
|
||||
int childCount = this.c.getChildCount();
|
||||
int i2 = 0;
|
||||
while (i2 < childCount) {
|
||||
View childAt = this.c.getChildAt(i2);
|
||||
boolean z = i2 == i;
|
||||
childAt.setSelected(z);
|
||||
if (z) {
|
||||
a(i);
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
Spinner spinner = this.d;
|
||||
if (spinner == null || i < 0) {
|
||||
return;
|
||||
}
|
||||
spinner.setSelection(i);
|
||||
}
|
||||
|
||||
private class TabView extends LinearLayout {
|
||||
private final int[] a;
|
||||
private ActionBar.Tab b;
|
||||
private TextView c;
|
||||
private ImageView d;
|
||||
private View e;
|
||||
|
||||
public TabView(Context context, ActionBar.Tab tab, boolean z) {
|
||||
super(context, null, R$attr.actionBarTabStyle);
|
||||
this.a = new int[]{R.attr.background};
|
||||
this.b = tab;
|
||||
TintTypedArray a = TintTypedArray.a(context, null, this.a, R$attr.actionBarTabStyle, 0);
|
||||
if (a.g(0)) {
|
||||
setBackgroundDrawable(a.b(0));
|
||||
}
|
||||
a.a();
|
||||
if (z) {
|
||||
setGravity(8388627);
|
||||
}
|
||||
b();
|
||||
}
|
||||
|
||||
public void a(ActionBar.Tab tab) {
|
||||
this.b = tab;
|
||||
b();
|
||||
}
|
||||
|
||||
public void b() {
|
||||
ActionBar.Tab tab = this.b;
|
||||
View b = tab.b();
|
||||
if (b != null) {
|
||||
ViewParent parent = b.getParent();
|
||||
if (parent != this) {
|
||||
if (parent != null) {
|
||||
((ViewGroup) parent).removeView(b);
|
||||
}
|
||||
addView(b);
|
||||
}
|
||||
this.e = b;
|
||||
TextView textView = this.c;
|
||||
if (textView != null) {
|
||||
textView.setVisibility(8);
|
||||
}
|
||||
ImageView imageView = this.d;
|
||||
if (imageView != null) {
|
||||
imageView.setVisibility(8);
|
||||
this.d.setImageDrawable(null);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
View view = this.e;
|
||||
if (view != null) {
|
||||
removeView(view);
|
||||
this.e = null;
|
||||
}
|
||||
Drawable c = tab.c();
|
||||
CharSequence d = tab.d();
|
||||
if (c != null) {
|
||||
if (this.d == null) {
|
||||
AppCompatImageView appCompatImageView = new AppCompatImageView(getContext());
|
||||
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
|
||||
layoutParams.gravity = 16;
|
||||
appCompatImageView.setLayoutParams(layoutParams);
|
||||
addView(appCompatImageView, 0);
|
||||
this.d = appCompatImageView;
|
||||
}
|
||||
this.d.setImageDrawable(c);
|
||||
this.d.setVisibility(0);
|
||||
} else {
|
||||
ImageView imageView2 = this.d;
|
||||
if (imageView2 != null) {
|
||||
imageView2.setVisibility(8);
|
||||
this.d.setImageDrawable(null);
|
||||
}
|
||||
}
|
||||
boolean z = !TextUtils.isEmpty(d);
|
||||
if (z) {
|
||||
if (this.c == null) {
|
||||
AppCompatTextView appCompatTextView = new AppCompatTextView(getContext(), null, R$attr.actionBarTabTextStyle);
|
||||
appCompatTextView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-2, -2);
|
||||
layoutParams2.gravity = 16;
|
||||
appCompatTextView.setLayoutParams(layoutParams2);
|
||||
addView(appCompatTextView);
|
||||
this.c = appCompatTextView;
|
||||
}
|
||||
this.c.setText(d);
|
||||
this.c.setVisibility(0);
|
||||
} else {
|
||||
TextView textView2 = this.c;
|
||||
if (textView2 != null) {
|
||||
textView2.setVisibility(8);
|
||||
this.c.setText((CharSequence) null);
|
||||
}
|
||||
}
|
||||
ImageView imageView3 = this.d;
|
||||
if (imageView3 != null) {
|
||||
imageView3.setContentDescription(tab.a());
|
||||
}
|
||||
TooltipCompat.a(this, z ? null : tab.a());
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
|
||||
super.onInitializeAccessibilityEvent(accessibilityEvent);
|
||||
accessibilityEvent.setClassName(ActionBar.Tab.class.getName());
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
|
||||
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
|
||||
accessibilityNodeInfo.setClassName(ActionBar.Tab.class.getName());
|
||||
}
|
||||
|
||||
@Override // android.widget.LinearLayout, android.view.View
|
||||
public void onMeasure(int i, int i2) {
|
||||
super.onMeasure(i, i2);
|
||||
if (ScrollingTabContainerView.this.f > 0) {
|
||||
int measuredWidth = getMeasuredWidth();
|
||||
int i3 = ScrollingTabContainerView.this.f;
|
||||
if (measuredWidth > i3) {
|
||||
super.onMeasure(View.MeasureSpec.makeMeasureSpec(i3, 1073741824), i2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setSelected(boolean z) {
|
||||
boolean z2 = isSelected() != z;
|
||||
super.setSelected(z);
|
||||
if (z2 && z) {
|
||||
sendAccessibilityEvent(4);
|
||||
}
|
||||
}
|
||||
|
||||
public ActionBar.Tab a() {
|
||||
return this.b;
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
final View childAt = this.c.getChildAt(i);
|
||||
Runnable runnable = this.a;
|
||||
if (runnable != null) {
|
||||
removeCallbacks(runnable);
|
||||
}
|
||||
this.a = new Runnable() { // from class: androidx.appcompat.widget.ScrollingTabContainerView.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ScrollingTabContainerView.this.smoothScrollTo(childAt.getLeft() - ((ScrollingTabContainerView.this.getWidth() - childAt.getWidth()) / 2), 0);
|
||||
ScrollingTabContainerView.this.a = null;
|
||||
}
|
||||
};
|
||||
post(this.a);
|
||||
}
|
||||
|
||||
TabView a(ActionBar.Tab tab, boolean z) {
|
||||
TabView tabView = new TabView(getContext(), tab, z);
|
||||
if (z) {
|
||||
tabView.setBackgroundDrawable(null);
|
||||
tabView.setLayoutParams(new AbsListView.LayoutParams(-1, this.h));
|
||||
} else {
|
||||
tabView.setFocusable(true);
|
||||
if (this.b == null) {
|
||||
this.b = new TabClickListener();
|
||||
}
|
||||
tabView.setOnClickListener(this.b);
|
||||
}
|
||||
return tabView;
|
||||
}
|
||||
}
|
||||
1312
sources/androidx/appcompat/widget/SearchView.java
Normal file
1312
sources/androidx/appcompat/widget/SearchView.java
Normal file
File diff suppressed because it is too large
Load Diff
499
sources/androidx/appcompat/widget/SuggestionsAdapter.java
Normal file
499
sources/androidx/appcompat/widget/SuggestionsAdapter.java
Normal file
@@ -0,0 +1,499 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.app.SearchableInfo;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.TextAppearanceSpan;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.appcompat.R$id;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.cursoradapter.widget.ResourceCursorAdapter;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class SuggestionsAdapter extends ResourceCursorAdapter implements View.OnClickListener {
|
||||
private final SearchView l;
|
||||
private final SearchableInfo m;
|
||||
private final Context n;
|
||||
private final WeakHashMap<String, Drawable.ConstantState> o;
|
||||
private final int p;
|
||||
private boolean q;
|
||||
private int r;
|
||||
private ColorStateList s;
|
||||
private int t;
|
||||
private int u;
|
||||
private int v;
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
|
||||
private static final class ChildViewCache {
|
||||
public final TextView a;
|
||||
public final TextView b;
|
||||
public final ImageView c;
|
||||
public final ImageView d;
|
||||
public final ImageView e;
|
||||
|
||||
public ChildViewCache(View view) {
|
||||
this.a = (TextView) view.findViewById(R.id.text1);
|
||||
this.b = (TextView) view.findViewById(R.id.text2);
|
||||
this.c = (ImageView) view.findViewById(R.id.icon1);
|
||||
this.d = (ImageView) view.findViewById(R.id.icon2);
|
||||
this.e = (ImageView) view.findViewById(R$id.edit_query);
|
||||
}
|
||||
}
|
||||
|
||||
public SuggestionsAdapter(Context context, SearchView searchView, SearchableInfo searchableInfo, WeakHashMap<String, Drawable.ConstantState> weakHashMap) {
|
||||
super(context, searchView.getSuggestionRowLayout(), null, true);
|
||||
this.q = false;
|
||||
this.r = 1;
|
||||
this.t = -1;
|
||||
this.u = -1;
|
||||
this.v = -1;
|
||||
this.x = -1;
|
||||
this.y = -1;
|
||||
this.z = -1;
|
||||
this.l = searchView;
|
||||
this.m = searchableInfo;
|
||||
this.p = searchView.getSuggestionCommitIconResId();
|
||||
this.n = context;
|
||||
this.o = weakHashMap;
|
||||
}
|
||||
|
||||
private Drawable d(Cursor cursor) {
|
||||
Drawable b = b(this.m.getSearchActivity());
|
||||
return b != null ? b : this.d.getPackageManager().getDefaultActivityIcon();
|
||||
}
|
||||
|
||||
private Drawable e(Cursor cursor) {
|
||||
int i = this.x;
|
||||
if (i == -1) {
|
||||
return null;
|
||||
}
|
||||
Drawable b = b(cursor.getString(i));
|
||||
return b != null ? b : d(cursor);
|
||||
}
|
||||
|
||||
private Drawable f(Cursor cursor) {
|
||||
int i = this.y;
|
||||
if (i == -1) {
|
||||
return null;
|
||||
}
|
||||
return b(cursor.getString(i));
|
||||
}
|
||||
|
||||
private void g(Cursor cursor) {
|
||||
Bundle extras = cursor != null ? cursor.getExtras() : null;
|
||||
if (extras == null || extras.getBoolean("in_progress")) {
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
this.r = i;
|
||||
}
|
||||
|
||||
@Override // androidx.cursoradapter.widget.ResourceCursorAdapter, androidx.cursoradapter.widget.CursorAdapter
|
||||
public View b(Context context, Cursor cursor, ViewGroup viewGroup) {
|
||||
View b = super.b(context, cursor, viewGroup);
|
||||
b.setTag(new ChildViewCache(b));
|
||||
((ImageView) b.findViewById(R$id.edit_query)).setImageResource(this.p);
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override // androidx.cursoradapter.widget.CursorAdapter, android.widget.BaseAdapter, android.widget.SpinnerAdapter
|
||||
public View getDropDownView(int i, View view, ViewGroup viewGroup) {
|
||||
try {
|
||||
return super.getDropDownView(i, view, viewGroup);
|
||||
} catch (RuntimeException e) {
|
||||
Log.w("SuggestionsAdapter", "Search suggestions cursor threw exception.", e);
|
||||
View a = a(this.d, this.c, viewGroup);
|
||||
if (a != null) {
|
||||
((ChildViewCache) a.getTag()).a.setText(e.toString());
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.cursoradapter.widget.CursorAdapter, android.widget.Adapter
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
try {
|
||||
return super.getView(i, view, viewGroup);
|
||||
} catch (RuntimeException e) {
|
||||
Log.w("SuggestionsAdapter", "Search suggestions cursor threw exception.", e);
|
||||
View b = b(this.d, this.c, viewGroup);
|
||||
if (b != null) {
|
||||
((ChildViewCache) b.getTag()).a.setText(e.toString());
|
||||
}
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.BaseAdapter, android.widget.Adapter
|
||||
public boolean hasStableIds() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // android.widget.BaseAdapter
|
||||
public void notifyDataSetChanged() {
|
||||
super.notifyDataSetChanged();
|
||||
g(a());
|
||||
}
|
||||
|
||||
@Override // android.widget.BaseAdapter
|
||||
public void notifyDataSetInvalidated() {
|
||||
super.notifyDataSetInvalidated();
|
||||
g(a());
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
Object tag = view.getTag();
|
||||
if (tag instanceof CharSequence) {
|
||||
this.l.a((CharSequence) tag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.cursoradapter.widget.CursorFilter.CursorFilterClient
|
||||
public Cursor a(CharSequence charSequence) {
|
||||
String charSequence2 = charSequence == null ? "" : charSequence.toString();
|
||||
if (this.l.getVisibility() == 0 && this.l.getWindowVisibility() == 0) {
|
||||
try {
|
||||
Cursor a = a(this.m, charSequence2, 50);
|
||||
if (a != null) {
|
||||
a.getCount();
|
||||
return a;
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
Log.w("SuggestionsAdapter", "Search suggestions query threw an exception.", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private CharSequence b(CharSequence charSequence) {
|
||||
if (this.s == null) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
this.d.getTheme().resolveAttribute(R$attr.textColorSearchUrl, typedValue, true);
|
||||
this.s = this.d.getResources().getColorStateList(typedValue.resourceId);
|
||||
}
|
||||
SpannableString spannableString = new SpannableString(charSequence);
|
||||
spannableString.setSpan(new TextAppearanceSpan(null, 0, 0, this.s, null), 0, charSequence.length(), 33);
|
||||
return spannableString;
|
||||
}
|
||||
|
||||
@Override // androidx.cursoradapter.widget.CursorAdapter, androidx.cursoradapter.widget.CursorFilter.CursorFilterClient
|
||||
public void a(Cursor cursor) {
|
||||
if (this.q) {
|
||||
Log.w("SuggestionsAdapter", "Tried to change cursor after adapter was closed.");
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
try {
|
||||
super.a(cursor);
|
||||
if (cursor != null) {
|
||||
this.t = cursor.getColumnIndex("suggest_text_1");
|
||||
this.u = cursor.getColumnIndex("suggest_text_2");
|
||||
this.v = cursor.getColumnIndex("suggest_text_2_url");
|
||||
this.x = cursor.getColumnIndex("suggest_icon_1");
|
||||
this.y = cursor.getColumnIndex("suggest_icon_2");
|
||||
this.z = cursor.getColumnIndex("suggest_flags");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("SuggestionsAdapter", "error changing cursor and caching columns", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.cursoradapter.widget.CursorAdapter, androidx.cursoradapter.widget.CursorFilter.CursorFilterClient
|
||||
public CharSequence b(Cursor cursor) {
|
||||
String a;
|
||||
String a2;
|
||||
if (cursor == null) {
|
||||
return null;
|
||||
}
|
||||
String a3 = a(cursor, "suggest_intent_query");
|
||||
if (a3 != null) {
|
||||
return a3;
|
||||
}
|
||||
if (this.m.shouldRewriteQueryFromData() && (a2 = a(cursor, "suggest_intent_data")) != null) {
|
||||
return a2;
|
||||
}
|
||||
if (!this.m.shouldRewriteQueryFromText() || (a = a(cursor, "suggest_text_1")) == null) {
|
||||
return null;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
private Drawable b(String str) {
|
||||
if (str == null || str.isEmpty() || "0".equals(str)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
int parseInt = Integer.parseInt(str);
|
||||
String str2 = "android.resource://" + this.n.getPackageName() + "/" + parseInt;
|
||||
Drawable a = a(str2);
|
||||
if (a != null) {
|
||||
return a;
|
||||
}
|
||||
Drawable c = ContextCompat.c(this.n, parseInt);
|
||||
a(str2, c);
|
||||
return c;
|
||||
} catch (Resources.NotFoundException unused) {
|
||||
Log.w("SuggestionsAdapter", "Icon resource not found: " + str);
|
||||
return null;
|
||||
} catch (NumberFormatException unused2) {
|
||||
Drawable a2 = a(str);
|
||||
if (a2 != null) {
|
||||
return a2;
|
||||
}
|
||||
Drawable b = b(Uri.parse(str));
|
||||
a(str, b);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.cursoradapter.widget.CursorAdapter
|
||||
public void a(View view, Context context, Cursor cursor) {
|
||||
CharSequence a;
|
||||
ChildViewCache childViewCache = (ChildViewCache) view.getTag();
|
||||
int i = this.z;
|
||||
int i2 = i != -1 ? cursor.getInt(i) : 0;
|
||||
if (childViewCache.a != null) {
|
||||
a(childViewCache.a, a(cursor, this.t));
|
||||
}
|
||||
if (childViewCache.b != null) {
|
||||
String a2 = a(cursor, this.v);
|
||||
if (a2 != null) {
|
||||
a = b((CharSequence) a2);
|
||||
} else {
|
||||
a = a(cursor, this.u);
|
||||
}
|
||||
if (TextUtils.isEmpty(a)) {
|
||||
TextView textView = childViewCache.a;
|
||||
if (textView != null) {
|
||||
textView.setSingleLine(false);
|
||||
childViewCache.a.setMaxLines(2);
|
||||
}
|
||||
} else {
|
||||
TextView textView2 = childViewCache.a;
|
||||
if (textView2 != null) {
|
||||
textView2.setSingleLine(true);
|
||||
childViewCache.a.setMaxLines(1);
|
||||
}
|
||||
}
|
||||
a(childViewCache.b, a);
|
||||
}
|
||||
ImageView imageView = childViewCache.c;
|
||||
if (imageView != null) {
|
||||
a(imageView, e(cursor), 4);
|
||||
}
|
||||
ImageView imageView2 = childViewCache.d;
|
||||
if (imageView2 != null) {
|
||||
a(imageView2, f(cursor), 8);
|
||||
}
|
||||
int i3 = this.r;
|
||||
if (i3 != 2 && (i3 != 1 || (i2 & 1) == 0)) {
|
||||
childViewCache.e.setVisibility(8);
|
||||
return;
|
||||
}
|
||||
childViewCache.e.setVisibility(0);
|
||||
childViewCache.e.setTag(childViewCache.a.getText());
|
||||
childViewCache.e.setOnClickListener(this);
|
||||
}
|
||||
|
||||
private Drawable b(Uri uri) {
|
||||
try {
|
||||
if ("android.resource".equals(uri.getScheme())) {
|
||||
try {
|
||||
return a(uri);
|
||||
} catch (Resources.NotFoundException unused) {
|
||||
throw new FileNotFoundException("Resource does not exist: " + uri);
|
||||
}
|
||||
}
|
||||
InputStream openInputStream = this.n.getContentResolver().openInputStream(uri);
|
||||
if (openInputStream != null) {
|
||||
try {
|
||||
return Drawable.createFromStream(openInputStream, null);
|
||||
} finally {
|
||||
try {
|
||||
openInputStream.close();
|
||||
} catch (IOException e) {
|
||||
Log.e("SuggestionsAdapter", "Error closing icon stream for " + uri, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new FileNotFoundException("Failed to open " + uri);
|
||||
} catch (FileNotFoundException e2) {
|
||||
Log.w("SuggestionsAdapter", "Icon not found: " + uri + ", " + e2.getMessage());
|
||||
return null;
|
||||
}
|
||||
Log.w("SuggestionsAdapter", "Icon not found: " + uri + ", " + e2.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
private Drawable b(ComponentName componentName) {
|
||||
String flattenToShortString = componentName.flattenToShortString();
|
||||
if (this.o.containsKey(flattenToShortString)) {
|
||||
Drawable.ConstantState constantState = this.o.get(flattenToShortString);
|
||||
if (constantState == null) {
|
||||
return null;
|
||||
}
|
||||
return constantState.newDrawable(this.n.getResources());
|
||||
}
|
||||
Drawable a = a(componentName);
|
||||
this.o.put(flattenToShortString, a != null ? a.getConstantState() : null);
|
||||
return a;
|
||||
}
|
||||
|
||||
private void a(TextView textView, CharSequence charSequence) {
|
||||
textView.setText(charSequence);
|
||||
if (TextUtils.isEmpty(charSequence)) {
|
||||
textView.setVisibility(8);
|
||||
} else {
|
||||
textView.setVisibility(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void a(ImageView imageView, Drawable drawable, int i) {
|
||||
imageView.setImageDrawable(drawable);
|
||||
if (drawable == null) {
|
||||
imageView.setVisibility(i);
|
||||
return;
|
||||
}
|
||||
imageView.setVisibility(0);
|
||||
drawable.setVisible(false, false);
|
||||
drawable.setVisible(true, false);
|
||||
}
|
||||
|
||||
private Drawable a(String str) {
|
||||
Drawable.ConstantState constantState = this.o.get(str);
|
||||
if (constantState == null) {
|
||||
return null;
|
||||
}
|
||||
return constantState.newDrawable();
|
||||
}
|
||||
|
||||
private void a(String str, Drawable drawable) {
|
||||
if (drawable != null) {
|
||||
this.o.put(str, drawable.getConstantState());
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable a(ComponentName componentName) {
|
||||
PackageManager packageManager = this.d.getPackageManager();
|
||||
try {
|
||||
ActivityInfo activityInfo = packageManager.getActivityInfo(componentName, PeripheralType.SERVO);
|
||||
int iconResource = activityInfo.getIconResource();
|
||||
if (iconResource == 0) {
|
||||
return null;
|
||||
}
|
||||
Drawable drawable = packageManager.getDrawable(componentName.getPackageName(), iconResource, activityInfo.applicationInfo);
|
||||
if (drawable != null) {
|
||||
return drawable;
|
||||
}
|
||||
Log.w("SuggestionsAdapter", "Invalid icon resource " + iconResource + " for " + componentName.flattenToShortString());
|
||||
return null;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.w("SuggestionsAdapter", e.toString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String a(Cursor cursor, String str) {
|
||||
return a(cursor, cursor.getColumnIndex(str));
|
||||
}
|
||||
|
||||
private static String a(Cursor cursor, int i) {
|
||||
if (i == -1) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return cursor.getString(i);
|
||||
} catch (Exception e) {
|
||||
Log.e("SuggestionsAdapter", "unexpected error retrieving valid column from cursor, did the remote process die?", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Drawable a(Uri uri) throws FileNotFoundException {
|
||||
int parseInt;
|
||||
String authority = uri.getAuthority();
|
||||
if (!TextUtils.isEmpty(authority)) {
|
||||
try {
|
||||
Resources resourcesForApplication = this.d.getPackageManager().getResourcesForApplication(authority);
|
||||
List<String> pathSegments = uri.getPathSegments();
|
||||
if (pathSegments != null) {
|
||||
int size = pathSegments.size();
|
||||
if (size == 1) {
|
||||
try {
|
||||
parseInt = Integer.parseInt(pathSegments.get(0));
|
||||
} catch (NumberFormatException unused) {
|
||||
throw new FileNotFoundException("Single path segment is not a resource ID: " + uri);
|
||||
}
|
||||
} else if (size == 2) {
|
||||
parseInt = resourcesForApplication.getIdentifier(pathSegments.get(1), pathSegments.get(0), authority);
|
||||
} else {
|
||||
throw new FileNotFoundException("More than two path segments: " + uri);
|
||||
}
|
||||
if (parseInt != 0) {
|
||||
return resourcesForApplication.getDrawable(parseInt);
|
||||
}
|
||||
throw new FileNotFoundException("No resource found for: " + uri);
|
||||
}
|
||||
throw new FileNotFoundException("No path: " + uri);
|
||||
} catch (PackageManager.NameNotFoundException unused2) {
|
||||
throw new FileNotFoundException("No package found for authority: " + uri);
|
||||
}
|
||||
}
|
||||
throw new FileNotFoundException("No authority: " + uri);
|
||||
}
|
||||
|
||||
Cursor a(SearchableInfo searchableInfo, String str, int i) {
|
||||
String suggestAuthority;
|
||||
String[] strArr = null;
|
||||
if (searchableInfo == null || (suggestAuthority = searchableInfo.getSuggestAuthority()) == null) {
|
||||
return null;
|
||||
}
|
||||
Uri.Builder fragment = new Uri.Builder().scheme("content").authority(suggestAuthority).query("").fragment("");
|
||||
String suggestPath = searchableInfo.getSuggestPath();
|
||||
if (suggestPath != null) {
|
||||
fragment.appendEncodedPath(suggestPath);
|
||||
}
|
||||
fragment.appendPath("search_suggest_query");
|
||||
String suggestSelection = searchableInfo.getSuggestSelection();
|
||||
if (suggestSelection != null) {
|
||||
strArr = new String[]{str};
|
||||
} else {
|
||||
fragment.appendPath(str);
|
||||
}
|
||||
String[] strArr2 = strArr;
|
||||
if (i > 0) {
|
||||
fragment.appendQueryParameter("limit", String.valueOf(i));
|
||||
}
|
||||
return this.d.getContentResolver().query(fragment.build(), null, suggestSelection, strArr2, null);
|
||||
}
|
||||
}
|
||||
75
sources/androidx/appcompat/widget/ThemeUtils.java
Normal file
75
sources/androidx/appcompat/widget/ThemeUtils.java
Normal file
@@ -0,0 +1,75 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ThemeUtils {
|
||||
private static final ThreadLocal<TypedValue> a = new ThreadLocal<>();
|
||||
static final int[] b = {-16842910};
|
||||
static final int[] c = {R.attr.state_focused};
|
||||
static final int[] d;
|
||||
static final int[] e;
|
||||
static final int[] f;
|
||||
private static final int[] g;
|
||||
|
||||
static {
|
||||
new int[1][0] = 16843518;
|
||||
d = new int[]{R.attr.state_pressed};
|
||||
e = new int[]{R.attr.state_checked};
|
||||
new int[1][0] = 16842913;
|
||||
f = new int[0];
|
||||
g = new int[1];
|
||||
}
|
||||
|
||||
public static int a(Context context, int i) {
|
||||
ColorStateList c2 = c(context, i);
|
||||
if (c2 != null && c2.isStateful()) {
|
||||
return c2.getColorForState(b, c2.getDefaultColor());
|
||||
}
|
||||
TypedValue a2 = a();
|
||||
context.getTheme().resolveAttribute(R.attr.disabledAlpha, a2, true);
|
||||
return a(context, i, a2.getFloat());
|
||||
}
|
||||
|
||||
public static int b(Context context, int i) {
|
||||
int[] iArr = g;
|
||||
iArr[0] = i;
|
||||
TintTypedArray a2 = TintTypedArray.a(context, (AttributeSet) null, iArr);
|
||||
try {
|
||||
return a2.a(0, 0);
|
||||
} finally {
|
||||
a2.a();
|
||||
}
|
||||
}
|
||||
|
||||
public static ColorStateList c(Context context, int i) {
|
||||
int[] iArr = g;
|
||||
iArr[0] = i;
|
||||
TintTypedArray a2 = TintTypedArray.a(context, (AttributeSet) null, iArr);
|
||||
try {
|
||||
return a2.a(0);
|
||||
} finally {
|
||||
a2.a();
|
||||
}
|
||||
}
|
||||
|
||||
private static TypedValue a() {
|
||||
TypedValue typedValue = a.get();
|
||||
if (typedValue != null) {
|
||||
return typedValue;
|
||||
}
|
||||
TypedValue typedValue2 = new TypedValue();
|
||||
a.set(typedValue2);
|
||||
return typedValue2;
|
||||
}
|
||||
|
||||
static int a(Context context, int i, float f2) {
|
||||
return ColorUtils.c(b(context, i), Math.round(Color.alpha(r0) * f2));
|
||||
}
|
||||
}
|
||||
11
sources/androidx/appcompat/widget/ThemedSpinnerAdapter.java
Normal file
11
sources/androidx/appcompat/widget/ThemedSpinnerAdapter.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.widget.SpinnerAdapter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ThemedSpinnerAdapter extends SpinnerAdapter {
|
||||
Resources.Theme getDropDownViewTheme();
|
||||
|
||||
void setDropDownViewTheme(Resources.Theme theme);
|
||||
}
|
||||
90
sources/androidx/appcompat/widget/TintContextWrapper.java
Normal file
90
sources/androidx/appcompat/widget/TintContextWrapper.java
Normal file
@@ -0,0 +1,90 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TintContextWrapper extends ContextWrapper {
|
||||
private static final Object c = new Object();
|
||||
private static ArrayList<WeakReference<TintContextWrapper>> d;
|
||||
private final Resources a;
|
||||
private final Resources.Theme b;
|
||||
|
||||
private TintContextWrapper(Context context) {
|
||||
super(context);
|
||||
if (!VectorEnabledTintResources.b()) {
|
||||
this.a = new TintResources(this, context.getResources());
|
||||
this.b = null;
|
||||
} else {
|
||||
this.a = new VectorEnabledTintResources(this, context.getResources());
|
||||
this.b = this.a.newTheme();
|
||||
this.b.setTo(context.getTheme());
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean a(Context context) {
|
||||
if ((context instanceof TintContextWrapper) || (context.getResources() instanceof TintResources) || (context.getResources() instanceof VectorEnabledTintResources)) {
|
||||
return false;
|
||||
}
|
||||
return Build.VERSION.SDK_INT < 21 || VectorEnabledTintResources.b();
|
||||
}
|
||||
|
||||
public static Context b(Context context) {
|
||||
if (!a(context)) {
|
||||
return context;
|
||||
}
|
||||
synchronized (c) {
|
||||
if (d == null) {
|
||||
d = new ArrayList<>();
|
||||
} else {
|
||||
for (int size = d.size() - 1; size >= 0; size--) {
|
||||
WeakReference<TintContextWrapper> weakReference = d.get(size);
|
||||
if (weakReference == null || weakReference.get() == null) {
|
||||
d.remove(size);
|
||||
}
|
||||
}
|
||||
for (int size2 = d.size() - 1; size2 >= 0; size2--) {
|
||||
WeakReference<TintContextWrapper> weakReference2 = d.get(size2);
|
||||
TintContextWrapper tintContextWrapper = weakReference2 != null ? weakReference2.get() : null;
|
||||
if (tintContextWrapper != null && tintContextWrapper.getBaseContext() == context) {
|
||||
return tintContextWrapper;
|
||||
}
|
||||
}
|
||||
}
|
||||
TintContextWrapper tintContextWrapper2 = new TintContextWrapper(context);
|
||||
d.add(new WeakReference<>(tintContextWrapper2));
|
||||
return tintContextWrapper2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.content.ContextWrapper, android.content.Context
|
||||
public AssetManager getAssets() {
|
||||
return this.a.getAssets();
|
||||
}
|
||||
|
||||
@Override // android.content.ContextWrapper, android.content.Context
|
||||
public Resources getResources() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@Override // android.content.ContextWrapper, android.content.Context
|
||||
public Resources.Theme getTheme() {
|
||||
Resources.Theme theme = this.b;
|
||||
return theme == null ? super.getTheme() : theme;
|
||||
}
|
||||
|
||||
@Override // android.content.ContextWrapper, android.content.Context
|
||||
public void setTheme(int i) {
|
||||
Resources.Theme theme = this.b;
|
||||
if (theme == null) {
|
||||
super.setTheme(i);
|
||||
} else {
|
||||
theme.applyStyle(i, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
22
sources/androidx/appcompat/widget/TintInfo.java
Normal file
22
sources/androidx/appcompat/widget/TintInfo.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class TintInfo {
|
||||
public ColorStateList a;
|
||||
public PorterDuff.Mode b;
|
||||
public boolean c;
|
||||
public boolean d;
|
||||
|
||||
TintInfo() {
|
||||
}
|
||||
|
||||
void a() {
|
||||
this.a = null;
|
||||
this.d = false;
|
||||
this.b = null;
|
||||
this.c = false;
|
||||
}
|
||||
}
|
||||
27
sources/androidx/appcompat/widget/TintResources.java
Normal file
27
sources/androidx/appcompat/widget/TintResources.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class TintResources extends ResourcesWrapper {
|
||||
private final WeakReference<Context> b;
|
||||
|
||||
public TintResources(Context context, Resources resources) {
|
||||
super(resources);
|
||||
this.b = new WeakReference<>(context);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public Drawable getDrawable(int i) throws Resources.NotFoundException {
|
||||
Drawable drawable = super.getDrawable(i);
|
||||
Context context = this.b.get();
|
||||
if (drawable != null && context != null) {
|
||||
AppCompatDrawableManager.a();
|
||||
AppCompatDrawableManager.a(context, i, drawable);
|
||||
}
|
||||
return drawable;
|
||||
}
|
||||
}
|
||||
125
sources/androidx/appcompat/widget/TintTypedArray.java
Normal file
125
sources/androidx/appcompat/widget/TintTypedArray.java
Normal file
@@ -0,0 +1,125 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TintTypedArray {
|
||||
private final Context a;
|
||||
private final TypedArray b;
|
||||
private TypedValue c;
|
||||
|
||||
private TintTypedArray(Context context, TypedArray typedArray) {
|
||||
this.a = context;
|
||||
this.b = typedArray;
|
||||
}
|
||||
|
||||
public static TintTypedArray a(Context context, AttributeSet attributeSet, int[] iArr) {
|
||||
return new TintTypedArray(context, context.obtainStyledAttributes(attributeSet, iArr));
|
||||
}
|
||||
|
||||
public Drawable b(int i) {
|
||||
int resourceId;
|
||||
return (!this.b.hasValue(i) || (resourceId = this.b.getResourceId(i, 0)) == 0) ? this.b.getDrawable(i) : AppCompatResources.c(this.a, resourceId);
|
||||
}
|
||||
|
||||
public Drawable c(int i) {
|
||||
int resourceId;
|
||||
if (!this.b.hasValue(i) || (resourceId = this.b.getResourceId(i, 0)) == 0) {
|
||||
return null;
|
||||
}
|
||||
return AppCompatDrawableManager.a().a(this.a, resourceId, true);
|
||||
}
|
||||
|
||||
public String d(int i) {
|
||||
return this.b.getString(i);
|
||||
}
|
||||
|
||||
public CharSequence e(int i) {
|
||||
return this.b.getText(i);
|
||||
}
|
||||
|
||||
public int f(int i, int i2) {
|
||||
return this.b.getLayoutDimension(i, i2);
|
||||
}
|
||||
|
||||
public int g(int i, int i2) {
|
||||
return this.b.getResourceId(i, i2);
|
||||
}
|
||||
|
||||
public static TintTypedArray a(Context context, AttributeSet attributeSet, int[] iArr, int i, int i2) {
|
||||
return new TintTypedArray(context, context.obtainStyledAttributes(attributeSet, iArr, i, i2));
|
||||
}
|
||||
|
||||
public int d(int i, int i2) {
|
||||
return this.b.getInt(i, i2);
|
||||
}
|
||||
|
||||
public int e(int i, int i2) {
|
||||
return this.b.getInteger(i, i2);
|
||||
}
|
||||
|
||||
public CharSequence[] f(int i) {
|
||||
return this.b.getTextArray(i);
|
||||
}
|
||||
|
||||
public boolean g(int i) {
|
||||
return this.b.hasValue(i);
|
||||
}
|
||||
|
||||
public static TintTypedArray a(Context context, int i, int[] iArr) {
|
||||
return new TintTypedArray(context, context.obtainStyledAttributes(i, iArr));
|
||||
}
|
||||
|
||||
public int c(int i, int i2) {
|
||||
return this.b.getDimensionPixelSize(i, i2);
|
||||
}
|
||||
|
||||
public Typeface a(int i, int i2, ResourcesCompat.FontCallback fontCallback) {
|
||||
int resourceId = this.b.getResourceId(i, 0);
|
||||
if (resourceId == 0) {
|
||||
return null;
|
||||
}
|
||||
if (this.c == null) {
|
||||
this.c = new TypedValue();
|
||||
}
|
||||
return ResourcesCompat.a(this.a, resourceId, this.c, i2, fontCallback);
|
||||
}
|
||||
|
||||
public float b(int i, float f) {
|
||||
return this.b.getFloat(i, f);
|
||||
}
|
||||
|
||||
public int b(int i, int i2) {
|
||||
return this.b.getDimensionPixelOffset(i, i2);
|
||||
}
|
||||
|
||||
public boolean a(int i, boolean z) {
|
||||
return this.b.getBoolean(i, z);
|
||||
}
|
||||
|
||||
public int a(int i, int i2) {
|
||||
return this.b.getColor(i, i2);
|
||||
}
|
||||
|
||||
public ColorStateList a(int i) {
|
||||
int resourceId;
|
||||
ColorStateList b;
|
||||
return (!this.b.hasValue(i) || (resourceId = this.b.getResourceId(i, 0)) == 0 || (b = AppCompatResources.b(this.a, resourceId)) == null) ? this.b.getColorStateList(i) : b;
|
||||
}
|
||||
|
||||
public float a(int i, float f) {
|
||||
return this.b.getDimension(i, f);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.b.recycle();
|
||||
}
|
||||
}
|
||||
1406
sources/androidx/appcompat/widget/Toolbar.java
Normal file
1406
sources/androidx/appcompat/widget/Toolbar.java
Normal file
File diff suppressed because it is too large
Load Diff
474
sources/androidx/appcompat/widget/ToolbarWidgetWrapper.java
Normal file
474
sources/androidx/appcompat/widget/ToolbarWidgetWrapper.java
Normal file
@@ -0,0 +1,474 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.view.Window;
|
||||
import androidx.appcompat.R$attr;
|
||||
import androidx.appcompat.R$drawable;
|
||||
import androidx.appcompat.R$id;
|
||||
import androidx.appcompat.R$string;
|
||||
import androidx.appcompat.R$styleable;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.appcompat.view.menu.ActionMenuItem;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorListenerAdapter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ToolbarWidgetWrapper implements DecorToolbar {
|
||||
Toolbar a;
|
||||
private int b;
|
||||
private View c;
|
||||
private View d;
|
||||
private Drawable e;
|
||||
private Drawable f;
|
||||
private Drawable g;
|
||||
private boolean h;
|
||||
CharSequence i;
|
||||
private CharSequence j;
|
||||
private CharSequence k;
|
||||
Window.Callback l;
|
||||
boolean m;
|
||||
private ActionMenuPresenter n;
|
||||
private int o;
|
||||
private int p;
|
||||
private Drawable q;
|
||||
|
||||
public ToolbarWidgetWrapper(Toolbar toolbar, boolean z) {
|
||||
this(toolbar, z, R$string.abc_action_bar_up_description, R$drawable.abc_ic_ab_back_material);
|
||||
}
|
||||
|
||||
private int p() {
|
||||
if (this.a.getNavigationIcon() == null) {
|
||||
return 11;
|
||||
}
|
||||
this.q = this.a.getNavigationIcon();
|
||||
return 15;
|
||||
}
|
||||
|
||||
private void q() {
|
||||
if ((this.b & 4) != 0) {
|
||||
if (TextUtils.isEmpty(this.k)) {
|
||||
this.a.setNavigationContentDescription(this.p);
|
||||
} else {
|
||||
this.a.setNavigationContentDescription(this.k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void r() {
|
||||
if ((this.b & 4) == 0) {
|
||||
this.a.setNavigationIcon((Drawable) null);
|
||||
return;
|
||||
}
|
||||
Toolbar toolbar = this.a;
|
||||
Drawable drawable = this.g;
|
||||
if (drawable == null) {
|
||||
drawable = this.q;
|
||||
}
|
||||
toolbar.setNavigationIcon(drawable);
|
||||
}
|
||||
|
||||
private void s() {
|
||||
Drawable drawable;
|
||||
int i = this.b;
|
||||
if ((i & 2) == 0) {
|
||||
drawable = null;
|
||||
} else if ((i & 1) != 0) {
|
||||
drawable = this.f;
|
||||
if (drawable == null) {
|
||||
drawable = this.e;
|
||||
}
|
||||
} else {
|
||||
drawable = this.e;
|
||||
}
|
||||
this.a.setLogo(drawable);
|
||||
}
|
||||
|
||||
public void a(Drawable drawable) {
|
||||
this.f = drawable;
|
||||
s();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void a(boolean z) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public Context b() {
|
||||
return this.a.getContext();
|
||||
}
|
||||
|
||||
public void c(CharSequence charSequence) {
|
||||
this.h = true;
|
||||
d(charSequence);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void collapseActionView() {
|
||||
this.a.c();
|
||||
}
|
||||
|
||||
public void d(int i) {
|
||||
if (i == this.p) {
|
||||
return;
|
||||
}
|
||||
this.p = i;
|
||||
if (TextUtils.isEmpty(this.a.getNavigationContentDescription())) {
|
||||
e(this.p);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public boolean e() {
|
||||
return this.a.h();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public boolean f() {
|
||||
return this.a.g();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public boolean g() {
|
||||
return this.a.k();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public CharSequence getTitle() {
|
||||
return this.a.getTitle();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void h() {
|
||||
this.a.d();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public boolean i() {
|
||||
return this.a.f();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public Menu j() {
|
||||
return this.a.getMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public int k() {
|
||||
return this.o;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public ViewGroup l() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public int m() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void n() {
|
||||
Log.i("ToolbarWidgetWrapper", "Progress display unsupported");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void o() {
|
||||
Log.i("ToolbarWidgetWrapper", "Progress display unsupported");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setIcon(int i) {
|
||||
setIcon(i != 0 ? AppCompatResources.c(b(), i) : null);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setWindowCallback(Window.Callback callback) {
|
||||
this.l = callback;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setWindowTitle(CharSequence charSequence) {
|
||||
if (this.h) {
|
||||
return;
|
||||
}
|
||||
d(charSequence);
|
||||
}
|
||||
|
||||
public ToolbarWidgetWrapper(Toolbar toolbar, boolean z, int i, int i2) {
|
||||
Drawable drawable;
|
||||
this.o = 0;
|
||||
this.p = 0;
|
||||
this.a = toolbar;
|
||||
this.i = toolbar.getTitle();
|
||||
this.j = toolbar.getSubtitle();
|
||||
this.h = this.i != null;
|
||||
this.g = toolbar.getNavigationIcon();
|
||||
TintTypedArray a = TintTypedArray.a(toolbar.getContext(), null, R$styleable.ActionBar, R$attr.actionBarStyle, 0);
|
||||
this.q = a.b(R$styleable.ActionBar_homeAsUpIndicator);
|
||||
if (z) {
|
||||
CharSequence e = a.e(R$styleable.ActionBar_title);
|
||||
if (!TextUtils.isEmpty(e)) {
|
||||
c(e);
|
||||
}
|
||||
CharSequence e2 = a.e(R$styleable.ActionBar_subtitle);
|
||||
if (!TextUtils.isEmpty(e2)) {
|
||||
b(e2);
|
||||
}
|
||||
Drawable b = a.b(R$styleable.ActionBar_logo);
|
||||
if (b != null) {
|
||||
a(b);
|
||||
}
|
||||
Drawable b2 = a.b(R$styleable.ActionBar_icon);
|
||||
if (b2 != null) {
|
||||
setIcon(b2);
|
||||
}
|
||||
if (this.g == null && (drawable = this.q) != null) {
|
||||
b(drawable);
|
||||
}
|
||||
a(a.d(R$styleable.ActionBar_displayOptions, 0));
|
||||
int g = a.g(R$styleable.ActionBar_customNavigationLayout, 0);
|
||||
if (g != 0) {
|
||||
a(LayoutInflater.from(this.a.getContext()).inflate(g, (ViewGroup) this.a, false));
|
||||
a(this.b | 16);
|
||||
}
|
||||
int f = a.f(R$styleable.ActionBar_height, 0);
|
||||
if (f > 0) {
|
||||
ViewGroup.LayoutParams layoutParams = this.a.getLayoutParams();
|
||||
layoutParams.height = f;
|
||||
this.a.setLayoutParams(layoutParams);
|
||||
}
|
||||
int b3 = a.b(R$styleable.ActionBar_contentInsetStart, -1);
|
||||
int b4 = a.b(R$styleable.ActionBar_contentInsetEnd, -1);
|
||||
if (b3 >= 0 || b4 >= 0) {
|
||||
this.a.a(Math.max(b3, 0), Math.max(b4, 0));
|
||||
}
|
||||
int g2 = a.g(R$styleable.ActionBar_titleTextStyle, 0);
|
||||
if (g2 != 0) {
|
||||
Toolbar toolbar2 = this.a;
|
||||
toolbar2.b(toolbar2.getContext(), g2);
|
||||
}
|
||||
int g3 = a.g(R$styleable.ActionBar_subtitleTextStyle, 0);
|
||||
if (g3 != 0) {
|
||||
Toolbar toolbar3 = this.a;
|
||||
toolbar3.a(toolbar3.getContext(), g3);
|
||||
}
|
||||
int g4 = a.g(R$styleable.ActionBar_popupTheme, 0);
|
||||
if (g4 != 0) {
|
||||
this.a.setPopupTheme(g4);
|
||||
}
|
||||
} else {
|
||||
this.b = p();
|
||||
}
|
||||
a.a();
|
||||
d(i);
|
||||
this.k = this.a.getNavigationContentDescription();
|
||||
this.a.setNavigationOnClickListener(new View.OnClickListener() { // from class: androidx.appcompat.widget.ToolbarWidgetWrapper.1
|
||||
final ActionMenuItem a;
|
||||
|
||||
{
|
||||
this.a = new ActionMenuItem(ToolbarWidgetWrapper.this.a.getContext(), 0, R.id.home, 0, 0, ToolbarWidgetWrapper.this.i);
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
ToolbarWidgetWrapper toolbarWidgetWrapper = ToolbarWidgetWrapper.this;
|
||||
Window.Callback callback = toolbarWidgetWrapper.l;
|
||||
if (callback == null || !toolbarWidgetWrapper.m) {
|
||||
return;
|
||||
}
|
||||
callback.onMenuItemSelected(0, this.a);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void b(CharSequence charSequence) {
|
||||
this.j = charSequence;
|
||||
if ((this.b & 8) != 0) {
|
||||
this.a.setSubtitle(charSequence);
|
||||
}
|
||||
}
|
||||
|
||||
public void e(int i) {
|
||||
a(i == 0 ? null : b().getString(i));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setIcon(Drawable drawable) {
|
||||
this.e = drawable;
|
||||
s();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public boolean a() {
|
||||
return this.a.i();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void c() {
|
||||
this.m = true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void a(Menu menu, MenuPresenter.Callback callback) {
|
||||
if (this.n == null) {
|
||||
this.n = new ActionMenuPresenter(this.a.getContext());
|
||||
this.n.a(R$id.action_menu_presenter);
|
||||
}
|
||||
this.n.a(callback);
|
||||
this.a.a((MenuBuilder) menu, this.n);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void c(int i) {
|
||||
this.a.setVisibility(i);
|
||||
}
|
||||
|
||||
private void d(CharSequence charSequence) {
|
||||
this.i = charSequence;
|
||||
if ((this.b & 8) != 0) {
|
||||
this.a.setTitle(charSequence);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void b(int i) {
|
||||
a(i != 0 ? AppCompatResources.c(b(), i) : null);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void b(boolean z) {
|
||||
this.a.setCollapsible(z);
|
||||
}
|
||||
|
||||
public void b(Drawable drawable) {
|
||||
this.g = drawable;
|
||||
r();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public boolean d() {
|
||||
return this.a.b();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void a(int i) {
|
||||
View view;
|
||||
int i2 = this.b ^ i;
|
||||
this.b = i;
|
||||
if (i2 != 0) {
|
||||
if ((i2 & 4) != 0) {
|
||||
if ((i & 4) != 0) {
|
||||
q();
|
||||
}
|
||||
r();
|
||||
}
|
||||
if ((i2 & 3) != 0) {
|
||||
s();
|
||||
}
|
||||
if ((i2 & 8) != 0) {
|
||||
if ((i & 8) != 0) {
|
||||
this.a.setTitle(this.i);
|
||||
this.a.setSubtitle(this.j);
|
||||
} else {
|
||||
this.a.setTitle((CharSequence) null);
|
||||
this.a.setSubtitle((CharSequence) null);
|
||||
}
|
||||
}
|
||||
if ((i2 & 16) == 0 || (view = this.d) == null) {
|
||||
return;
|
||||
}
|
||||
if ((i & 16) != 0) {
|
||||
this.a.addView(view);
|
||||
} else {
|
||||
this.a.removeView(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void a(ScrollingTabContainerView scrollingTabContainerView) {
|
||||
View view = this.c;
|
||||
if (view != null) {
|
||||
ViewParent parent = view.getParent();
|
||||
Toolbar toolbar = this.a;
|
||||
if (parent == toolbar) {
|
||||
toolbar.removeView(this.c);
|
||||
}
|
||||
}
|
||||
this.c = scrollingTabContainerView;
|
||||
if (scrollingTabContainerView == null || this.o != 2) {
|
||||
return;
|
||||
}
|
||||
this.a.addView(this.c, 0);
|
||||
Toolbar.LayoutParams layoutParams = (Toolbar.LayoutParams) this.c.getLayoutParams();
|
||||
((ViewGroup.MarginLayoutParams) layoutParams).width = -2;
|
||||
((ViewGroup.MarginLayoutParams) layoutParams).height = -2;
|
||||
layoutParams.a = 8388691;
|
||||
scrollingTabContainerView.setAllowCollapse(true);
|
||||
}
|
||||
|
||||
public void a(View view) {
|
||||
View view2 = this.d;
|
||||
if (view2 != null && (this.b & 16) != 0) {
|
||||
this.a.removeView(view2);
|
||||
}
|
||||
this.d = view;
|
||||
if (view == null || (this.b & 16) == 0) {
|
||||
return;
|
||||
}
|
||||
this.a.addView(this.d);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public ViewPropertyAnimatorCompat a(final int i, long j) {
|
||||
ViewPropertyAnimatorCompat a = ViewCompat.a(this.a);
|
||||
a.a(i == 0 ? 1.0f : 0.0f);
|
||||
a.a(j);
|
||||
a.a(new ViewPropertyAnimatorListenerAdapter() { // from class: androidx.appcompat.widget.ToolbarWidgetWrapper.2
|
||||
private boolean a = false;
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void a(View view) {
|
||||
this.a = true;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void b(View view) {
|
||||
if (this.a) {
|
||||
return;
|
||||
}
|
||||
ToolbarWidgetWrapper.this.a.setVisibility(i);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void c(View view) {
|
||||
ToolbarWidgetWrapper.this.a.setVisibility(0);
|
||||
}
|
||||
});
|
||||
return a;
|
||||
}
|
||||
|
||||
public void a(CharSequence charSequence) {
|
||||
this.k = charSequence;
|
||||
q();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void a(MenuPresenter.Callback callback, MenuBuilder.Callback callback2) {
|
||||
this.a.a(callback, callback2);
|
||||
}
|
||||
}
|
||||
15
sources/androidx/appcompat/widget/TooltipCompat.java
Normal file
15
sources/androidx/appcompat/widget/TooltipCompat.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TooltipCompat {
|
||||
public static void a(View view, CharSequence charSequence) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
view.setTooltipText(charSequence);
|
||||
} else {
|
||||
TooltipCompatHandler.a(view, charSequence);
|
||||
}
|
||||
}
|
||||
}
|
||||
187
sources/androidx/appcompat/widget/TooltipCompatHandler.java
Normal file
187
sources/androidx/appcompat/widget/TooltipCompatHandler.java
Normal file
@@ -0,0 +1,187 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.ViewConfigurationCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class TooltipCompatHandler implements View.OnLongClickListener, View.OnHoverListener, View.OnAttachStateChangeListener {
|
||||
private static TooltipCompatHandler j;
|
||||
private static TooltipCompatHandler k;
|
||||
private final View a;
|
||||
private final CharSequence b;
|
||||
private final int c;
|
||||
private final Runnable d = new Runnable() { // from class: androidx.appcompat.widget.TooltipCompatHandler.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
TooltipCompatHandler.this.a(false);
|
||||
}
|
||||
};
|
||||
private final Runnable e = new Runnable() { // from class: androidx.appcompat.widget.TooltipCompatHandler.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
TooltipCompatHandler.this.a();
|
||||
}
|
||||
};
|
||||
private int f;
|
||||
private int g;
|
||||
private TooltipPopup h;
|
||||
private boolean i;
|
||||
|
||||
private TooltipCompatHandler(View view, CharSequence charSequence) {
|
||||
this.a = view;
|
||||
this.b = charSequence;
|
||||
this.c = ViewConfigurationCompat.a(ViewConfiguration.get(this.a.getContext()));
|
||||
c();
|
||||
this.a.setOnLongClickListener(this);
|
||||
this.a.setOnHoverListener(this);
|
||||
}
|
||||
|
||||
public static void a(View view, CharSequence charSequence) {
|
||||
TooltipCompatHandler tooltipCompatHandler = j;
|
||||
if (tooltipCompatHandler != null && tooltipCompatHandler.a == view) {
|
||||
a((TooltipCompatHandler) null);
|
||||
}
|
||||
if (!TextUtils.isEmpty(charSequence)) {
|
||||
new TooltipCompatHandler(view, charSequence);
|
||||
return;
|
||||
}
|
||||
TooltipCompatHandler tooltipCompatHandler2 = k;
|
||||
if (tooltipCompatHandler2 != null && tooltipCompatHandler2.a == view) {
|
||||
tooltipCompatHandler2.a();
|
||||
}
|
||||
view.setOnLongClickListener(null);
|
||||
view.setLongClickable(false);
|
||||
view.setOnHoverListener(null);
|
||||
}
|
||||
|
||||
private void b() {
|
||||
this.a.removeCallbacks(this.d);
|
||||
}
|
||||
|
||||
private void c() {
|
||||
this.f = Integer.MAX_VALUE;
|
||||
this.g = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
private void d() {
|
||||
this.a.postDelayed(this.d, ViewConfiguration.getLongPressTimeout());
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnHoverListener
|
||||
public boolean onHover(View view, MotionEvent motionEvent) {
|
||||
if (this.h != null && this.i) {
|
||||
return false;
|
||||
}
|
||||
AccessibilityManager accessibilityManager = (AccessibilityManager) this.a.getContext().getSystemService("accessibility");
|
||||
if (accessibilityManager.isEnabled() && accessibilityManager.isTouchExplorationEnabled()) {
|
||||
return false;
|
||||
}
|
||||
int action = motionEvent.getAction();
|
||||
if (action != 7) {
|
||||
if (action == 10) {
|
||||
c();
|
||||
a();
|
||||
}
|
||||
} else if (this.a.isEnabled() && this.h == null && a(motionEvent)) {
|
||||
a(this);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnLongClickListener
|
||||
public boolean onLongClick(View view) {
|
||||
this.f = view.getWidth() / 2;
|
||||
this.g = view.getHeight() / 2;
|
||||
a(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnAttachStateChangeListener
|
||||
public void onViewAttachedToWindow(View view) {
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnAttachStateChangeListener
|
||||
public void onViewDetachedFromWindow(View view) {
|
||||
a();
|
||||
}
|
||||
|
||||
void a(boolean z) {
|
||||
long j2;
|
||||
int longPressTimeout;
|
||||
long j3;
|
||||
if (ViewCompat.w(this.a)) {
|
||||
a((TooltipCompatHandler) null);
|
||||
TooltipCompatHandler tooltipCompatHandler = k;
|
||||
if (tooltipCompatHandler != null) {
|
||||
tooltipCompatHandler.a();
|
||||
}
|
||||
k = this;
|
||||
this.i = z;
|
||||
this.h = new TooltipPopup(this.a.getContext());
|
||||
this.h.a(this.a, this.f, this.g, this.i, this.b);
|
||||
this.a.addOnAttachStateChangeListener(this);
|
||||
if (this.i) {
|
||||
j3 = 2500;
|
||||
} else {
|
||||
if ((ViewCompat.q(this.a) & 1) == 1) {
|
||||
j2 = 3000;
|
||||
longPressTimeout = ViewConfiguration.getLongPressTimeout();
|
||||
} else {
|
||||
j2 = 15000;
|
||||
longPressTimeout = ViewConfiguration.getLongPressTimeout();
|
||||
}
|
||||
j3 = j2 - longPressTimeout;
|
||||
}
|
||||
this.a.removeCallbacks(this.e);
|
||||
this.a.postDelayed(this.e, j3);
|
||||
}
|
||||
}
|
||||
|
||||
void a() {
|
||||
if (k == this) {
|
||||
k = null;
|
||||
TooltipPopup tooltipPopup = this.h;
|
||||
if (tooltipPopup != null) {
|
||||
tooltipPopup.a();
|
||||
this.h = null;
|
||||
c();
|
||||
this.a.removeOnAttachStateChangeListener(this);
|
||||
} else {
|
||||
Log.e("TooltipCompatHandler", "sActiveHandler.mPopup == null");
|
||||
}
|
||||
}
|
||||
if (j == this) {
|
||||
a((TooltipCompatHandler) null);
|
||||
}
|
||||
this.a.removeCallbacks(this.e);
|
||||
}
|
||||
|
||||
private static void a(TooltipCompatHandler tooltipCompatHandler) {
|
||||
TooltipCompatHandler tooltipCompatHandler2 = j;
|
||||
if (tooltipCompatHandler2 != null) {
|
||||
tooltipCompatHandler2.b();
|
||||
}
|
||||
j = tooltipCompatHandler;
|
||||
TooltipCompatHandler tooltipCompatHandler3 = j;
|
||||
if (tooltipCompatHandler3 != null) {
|
||||
tooltipCompatHandler3.d();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean a(MotionEvent motionEvent) {
|
||||
int x = (int) motionEvent.getX();
|
||||
int y = (int) motionEvent.getY();
|
||||
if (Math.abs(x - this.f) <= this.c && Math.abs(y - this.g) <= this.c) {
|
||||
return false;
|
||||
}
|
||||
this.f = x;
|
||||
this.g = y;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
139
sources/androidx/appcompat/widget/TooltipPopup.java
Normal file
139
sources/androidx/appcompat/widget/TooltipPopup.java
Normal file
@@ -0,0 +1,139 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R$dimen;
|
||||
import androidx.appcompat.R$id;
|
||||
import androidx.appcompat.R$layout;
|
||||
import androidx.appcompat.R$style;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class TooltipPopup {
|
||||
private final Context a;
|
||||
private final View b;
|
||||
private final TextView c;
|
||||
private final WindowManager.LayoutParams d = new WindowManager.LayoutParams();
|
||||
private final Rect e = new Rect();
|
||||
private final int[] f = new int[2];
|
||||
private final int[] g = new int[2];
|
||||
|
||||
TooltipPopup(Context context) {
|
||||
this.a = context;
|
||||
this.b = LayoutInflater.from(this.a).inflate(R$layout.abc_tooltip, (ViewGroup) null);
|
||||
this.c = (TextView) this.b.findViewById(R$id.message);
|
||||
this.d.setTitle(TooltipPopup.class.getSimpleName());
|
||||
this.d.packageName = this.a.getPackageName();
|
||||
WindowManager.LayoutParams layoutParams = this.d;
|
||||
layoutParams.type = 1002;
|
||||
layoutParams.width = -2;
|
||||
layoutParams.height = -2;
|
||||
layoutParams.format = -3;
|
||||
layoutParams.windowAnimations = R$style.Animation_AppCompat_Tooltip;
|
||||
layoutParams.flags = 24;
|
||||
}
|
||||
|
||||
void a(View view, int i, int i2, boolean z, CharSequence charSequence) {
|
||||
if (b()) {
|
||||
a();
|
||||
}
|
||||
this.c.setText(charSequence);
|
||||
a(view, i, i2, z, this.d);
|
||||
((WindowManager) this.a.getSystemService("window")).addView(this.b, this.d);
|
||||
}
|
||||
|
||||
boolean b() {
|
||||
return this.b.getParent() != null;
|
||||
}
|
||||
|
||||
void a() {
|
||||
if (b()) {
|
||||
((WindowManager) this.a.getSystemService("window")).removeView(this.b);
|
||||
}
|
||||
}
|
||||
|
||||
private void a(View view, int i, int i2, boolean z, WindowManager.LayoutParams layoutParams) {
|
||||
int height;
|
||||
int i3;
|
||||
layoutParams.token = view.getApplicationWindowToken();
|
||||
int dimensionPixelOffset = this.a.getResources().getDimensionPixelOffset(R$dimen.tooltip_precise_anchor_threshold);
|
||||
if (view.getWidth() < dimensionPixelOffset) {
|
||||
i = view.getWidth() / 2;
|
||||
}
|
||||
if (view.getHeight() >= dimensionPixelOffset) {
|
||||
int dimensionPixelOffset2 = this.a.getResources().getDimensionPixelOffset(R$dimen.tooltip_precise_anchor_extra_offset);
|
||||
height = i2 + dimensionPixelOffset2;
|
||||
i3 = i2 - dimensionPixelOffset2;
|
||||
} else {
|
||||
height = view.getHeight();
|
||||
i3 = 0;
|
||||
}
|
||||
layoutParams.gravity = 49;
|
||||
int dimensionPixelOffset3 = this.a.getResources().getDimensionPixelOffset(z ? R$dimen.tooltip_y_offset_touch : R$dimen.tooltip_y_offset_non_touch);
|
||||
View a = a(view);
|
||||
if (a == null) {
|
||||
Log.e("TooltipPopup", "Cannot find app view");
|
||||
return;
|
||||
}
|
||||
a.getWindowVisibleDisplayFrame(this.e);
|
||||
Rect rect = this.e;
|
||||
if (rect.left < 0 && rect.top < 0) {
|
||||
Resources resources = this.a.getResources();
|
||||
int identifier = resources.getIdentifier("status_bar_height", "dimen", "android");
|
||||
int dimensionPixelSize = identifier != 0 ? resources.getDimensionPixelSize(identifier) : 0;
|
||||
DisplayMetrics displayMetrics = resources.getDisplayMetrics();
|
||||
this.e.set(0, dimensionPixelSize, displayMetrics.widthPixels, displayMetrics.heightPixels);
|
||||
}
|
||||
a.getLocationOnScreen(this.g);
|
||||
view.getLocationOnScreen(this.f);
|
||||
int[] iArr = this.f;
|
||||
int i4 = iArr[0];
|
||||
int[] iArr2 = this.g;
|
||||
iArr[0] = i4 - iArr2[0];
|
||||
iArr[1] = iArr[1] - iArr2[1];
|
||||
layoutParams.x = (iArr[0] + i) - (a.getWidth() / 2);
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
|
||||
this.b.measure(makeMeasureSpec, makeMeasureSpec);
|
||||
int measuredHeight = this.b.getMeasuredHeight();
|
||||
int[] iArr3 = this.f;
|
||||
int i5 = ((iArr3[1] + i3) - dimensionPixelOffset3) - measuredHeight;
|
||||
int i6 = iArr3[1] + height + dimensionPixelOffset3;
|
||||
if (z) {
|
||||
if (i5 >= 0) {
|
||||
layoutParams.y = i5;
|
||||
return;
|
||||
} else {
|
||||
layoutParams.y = i6;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (measuredHeight + i6 <= this.e.height()) {
|
||||
layoutParams.y = i6;
|
||||
} else {
|
||||
layoutParams.y = i5;
|
||||
}
|
||||
}
|
||||
|
||||
private static View a(View view) {
|
||||
View rootView = view.getRootView();
|
||||
ViewGroup.LayoutParams layoutParams = rootView.getLayoutParams();
|
||||
if ((layoutParams instanceof WindowManager.LayoutParams) && ((WindowManager.LayoutParams) layoutParams).type == 2) {
|
||||
return rootView;
|
||||
}
|
||||
for (Context context = view.getContext(); context instanceof ContextWrapper; context = ((ContextWrapper) context).getBaseContext()) {
|
||||
if (context instanceof Activity) {
|
||||
return ((Activity) context).getWindow().getDecorView();
|
||||
}
|
||||
}
|
||||
return rootView;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class VectorEnabledTintResources extends Resources {
|
||||
private static boolean b = false;
|
||||
private final WeakReference<Context> a;
|
||||
|
||||
public VectorEnabledTintResources(Context context, Resources resources) {
|
||||
super(resources.getAssets(), resources.getDisplayMetrics(), resources.getConfiguration());
|
||||
this.a = new WeakReference<>(context);
|
||||
}
|
||||
|
||||
public static boolean b() {
|
||||
return a() && Build.VERSION.SDK_INT <= 20;
|
||||
}
|
||||
|
||||
final Drawable a(int i) {
|
||||
return super.getDrawable(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public Drawable getDrawable(int i) throws Resources.NotFoundException {
|
||||
Context context = this.a.get();
|
||||
return context != null ? AppCompatDrawableManager.a().a(context, this, i) : super.getDrawable(i);
|
||||
}
|
||||
|
||||
public static boolean a() {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
135
sources/androidx/appcompat/widget/ViewStubCompat.java
Normal file
135
sources/androidx/appcompat/widget/ViewStubCompat.java
Normal file
@@ -0,0 +1,135 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import androidx.appcompat.R$styleable;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ViewStubCompat extends View {
|
||||
private int a;
|
||||
private int b;
|
||||
private WeakReference<View> c;
|
||||
private LayoutInflater d;
|
||||
private OnInflateListener e;
|
||||
|
||||
public interface OnInflateListener {
|
||||
void a(ViewStubCompat viewStubCompat, View view);
|
||||
}
|
||||
|
||||
public ViewStubCompat(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public View a() {
|
||||
ViewParent parent = getParent();
|
||||
if (parent == null || !(parent instanceof ViewGroup)) {
|
||||
throw new IllegalStateException("ViewStub must have a non-null ViewGroup viewParent");
|
||||
}
|
||||
if (this.a == 0) {
|
||||
throw new IllegalArgumentException("ViewStub must have a valid layoutResource");
|
||||
}
|
||||
ViewGroup viewGroup = (ViewGroup) parent;
|
||||
LayoutInflater layoutInflater = this.d;
|
||||
if (layoutInflater == null) {
|
||||
layoutInflater = LayoutInflater.from(getContext());
|
||||
}
|
||||
View inflate = layoutInflater.inflate(this.a, viewGroup, false);
|
||||
int i = this.b;
|
||||
if (i != -1) {
|
||||
inflate.setId(i);
|
||||
}
|
||||
int indexOfChild = viewGroup.indexOfChild(this);
|
||||
viewGroup.removeViewInLayout(this);
|
||||
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
if (layoutParams != null) {
|
||||
viewGroup.addView(inflate, indexOfChild, layoutParams);
|
||||
} else {
|
||||
viewGroup.addView(inflate, indexOfChild);
|
||||
}
|
||||
this.c = new WeakReference<>(inflate);
|
||||
OnInflateListener onInflateListener = this.e;
|
||||
if (onInflateListener != null) {
|
||||
onInflateListener.a(this, inflate);
|
||||
}
|
||||
return inflate;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
@SuppressLint({"MissingSuperCall"})
|
||||
public void draw(Canvas canvas) {
|
||||
}
|
||||
|
||||
public int getInflatedId() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public LayoutInflater getLayoutInflater() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public int getLayoutResource() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
setMeasuredDimension(0, 0);
|
||||
}
|
||||
|
||||
public void setInflatedId(int i) {
|
||||
this.b = i;
|
||||
}
|
||||
|
||||
public void setLayoutInflater(LayoutInflater layoutInflater) {
|
||||
this.d = layoutInflater;
|
||||
}
|
||||
|
||||
public void setLayoutResource(int i) {
|
||||
this.a = i;
|
||||
}
|
||||
|
||||
public void setOnInflateListener(OnInflateListener onInflateListener) {
|
||||
this.e = onInflateListener;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setVisibility(int i) {
|
||||
WeakReference<View> weakReference = this.c;
|
||||
if (weakReference != null) {
|
||||
View view = weakReference.get();
|
||||
if (view == null) {
|
||||
throw new IllegalStateException("setVisibility called on un-referenced view");
|
||||
}
|
||||
view.setVisibility(i);
|
||||
return;
|
||||
}
|
||||
super.setVisibility(i);
|
||||
if (i == 0 || i == 4) {
|
||||
a();
|
||||
}
|
||||
}
|
||||
|
||||
public ViewStubCompat(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.a = 0;
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.ViewStubCompat, i, 0);
|
||||
this.b = obtainStyledAttributes.getResourceId(R$styleable.ViewStubCompat_android_inflatedId, -1);
|
||||
this.a = obtainStyledAttributes.getResourceId(R$styleable.ViewStubCompat_android_layout, 0);
|
||||
setId(obtainStyledAttributes.getResourceId(R$styleable.ViewStubCompat_android_id, -1));
|
||||
obtainStyledAttributes.recycle();
|
||||
setVisibility(8);
|
||||
setWillNotDraw(true);
|
||||
}
|
||||
}
|
||||
61
sources/androidx/appcompat/widget/ViewUtils.java
Normal file
61
sources/androidx/appcompat/widget/ViewUtils.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ViewUtils {
|
||||
private static Method a;
|
||||
|
||||
static {
|
||||
if (Build.VERSION.SDK_INT >= 18) {
|
||||
try {
|
||||
a = View.class.getDeclaredMethod("computeFitSystemWindows", Rect.class, Rect.class);
|
||||
if (a.isAccessible()) {
|
||||
return;
|
||||
}
|
||||
a.setAccessible(true);
|
||||
} catch (NoSuchMethodException unused) {
|
||||
Log.d("ViewUtils", "Could not find method computeFitSystemWindows. Oh well.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean a(View view) {
|
||||
return ViewCompat.k(view) == 1;
|
||||
}
|
||||
|
||||
public static void b(View view) {
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
try {
|
||||
Method method = view.getClass().getMethod("makeOptionalFitsSystemWindows", new Class[0]);
|
||||
if (!method.isAccessible()) {
|
||||
method.setAccessible(true);
|
||||
}
|
||||
method.invoke(view, new Object[0]);
|
||||
} catch (IllegalAccessException e) {
|
||||
Log.d("ViewUtils", "Could not invoke makeOptionalFitsSystemWindows", e);
|
||||
} catch (NoSuchMethodException unused) {
|
||||
Log.d("ViewUtils", "Could not find method makeOptionalFitsSystemWindows. Oh well...");
|
||||
} catch (InvocationTargetException e2) {
|
||||
Log.d("ViewUtils", "Could not invoke makeOptionalFitsSystemWindows", e2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(View view, Rect rect, Rect rect2) {
|
||||
Method method = a;
|
||||
if (method != null) {
|
||||
try {
|
||||
method.invoke(view, rect, rect2);
|
||||
} catch (Exception e) {
|
||||
Log.d("ViewUtils", "Could not invoke computeFitSystemWindows", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
6
sources/androidx/appcompat/widget/WithHint.java
Normal file
6
sources/androidx/appcompat/widget/WithHint.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface WithHint {
|
||||
CharSequence a();
|
||||
}
|
||||
Reference in New Issue
Block a user