ADD week 5
This commit is contained in:
@@ -0,0 +1,258 @@
|
||||
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;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorListener;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
abstract class AbsActionBarView extends ViewGroup {
|
||||
private static final int FADE_DURATION = 200;
|
||||
protected ActionMenuPresenter mActionMenuPresenter;
|
||||
protected int mContentHeight;
|
||||
private boolean mEatingHover;
|
||||
private boolean mEatingTouch;
|
||||
protected ActionMenuView mMenuView;
|
||||
protected final Context mPopupContext;
|
||||
protected final VisibilityAnimListener mVisAnimListener;
|
||||
protected ViewPropertyAnimatorCompat mVisibilityAnim;
|
||||
|
||||
protected static int next(int i, int i2, boolean z) {
|
||||
return z ? i - i2 : i + i2;
|
||||
}
|
||||
|
||||
public int getContentHeight() {
|
||||
return this.mContentHeight;
|
||||
}
|
||||
|
||||
AbsActionBarView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
AbsActionBarView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
AbsActionBarView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.mVisAnimListener = new VisibilityAnimListener();
|
||||
TypedValue typedValue = new TypedValue();
|
||||
if (!context.getTheme().resolveAttribute(R.attr.actionBarPopupTheme, typedValue, true) || typedValue.resourceId == 0) {
|
||||
this.mPopupContext = context;
|
||||
} else {
|
||||
this.mPopupContext = new ContextThemeWrapper(context, typedValue.resourceId);
|
||||
}
|
||||
}
|
||||
|
||||
@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.mActionMenuPresenter;
|
||||
if (actionMenuPresenter != null) {
|
||||
actionMenuPresenter.onConfigurationChanged(configuration);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
int actionMasked = motionEvent.getActionMasked();
|
||||
if (actionMasked == 0) {
|
||||
this.mEatingTouch = false;
|
||||
}
|
||||
if (!this.mEatingTouch) {
|
||||
boolean onTouchEvent = super.onTouchEvent(motionEvent);
|
||||
if (actionMasked == 0 && !onTouchEvent) {
|
||||
this.mEatingTouch = true;
|
||||
}
|
||||
}
|
||||
if (actionMasked == 1 || actionMasked == 3) {
|
||||
this.mEatingTouch = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean onHoverEvent(MotionEvent motionEvent) {
|
||||
int actionMasked = motionEvent.getActionMasked();
|
||||
if (actionMasked == 9) {
|
||||
this.mEatingHover = false;
|
||||
}
|
||||
if (!this.mEatingHover) {
|
||||
boolean onHoverEvent = super.onHoverEvent(motionEvent);
|
||||
if (actionMasked == 9 && !onHoverEvent) {
|
||||
this.mEatingHover = true;
|
||||
}
|
||||
}
|
||||
if (actionMasked == 10 || actionMasked == 3) {
|
||||
this.mEatingHover = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setContentHeight(int i) {
|
||||
this.mContentHeight = i;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public int getAnimatedVisibility() {
|
||||
if (this.mVisibilityAnim != null) {
|
||||
return this.mVisAnimListener.mFinalVisibility;
|
||||
}
|
||||
return getVisibility();
|
||||
}
|
||||
|
||||
public ViewPropertyAnimatorCompat setupAnimatorToVisibility(int i, long j) {
|
||||
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = this.mVisibilityAnim;
|
||||
if (viewPropertyAnimatorCompat != null) {
|
||||
viewPropertyAnimatorCompat.cancel();
|
||||
}
|
||||
if (i == 0) {
|
||||
if (getVisibility() != 0) {
|
||||
setAlpha(0.0f);
|
||||
}
|
||||
ViewPropertyAnimatorCompat alpha = ViewCompat.animate(this).alpha(1.0f);
|
||||
alpha.setDuration(j);
|
||||
alpha.setListener(this.mVisAnimListener.withFinalVisibility(alpha, i));
|
||||
return alpha;
|
||||
}
|
||||
ViewPropertyAnimatorCompat alpha2 = ViewCompat.animate(this).alpha(0.0f);
|
||||
alpha2.setDuration(j);
|
||||
alpha2.setListener(this.mVisAnimListener.withFinalVisibility(alpha2, i));
|
||||
return alpha2;
|
||||
}
|
||||
|
||||
public void animateToVisibility(int i) {
|
||||
setupAnimatorToVisibility(i, 200L).start();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setVisibility(int i) {
|
||||
if (i != getVisibility()) {
|
||||
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = this.mVisibilityAnim;
|
||||
if (viewPropertyAnimatorCompat != null) {
|
||||
viewPropertyAnimatorCompat.cancel();
|
||||
}
|
||||
super.setVisibility(i);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean showOverflowMenu() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
|
||||
if (actionMenuPresenter != null) {
|
||||
return actionMenuPresenter.showOverflowMenu();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void postShowOverflowMenu() {
|
||||
post(new Runnable() { // from class: androidx.appcompat.widget.AbsActionBarView.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
AbsActionBarView.this.showOverflowMenu();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean hideOverflowMenu() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
|
||||
if (actionMenuPresenter != null) {
|
||||
return actionMenuPresenter.hideOverflowMenu();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOverflowMenuShowing() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
|
||||
if (actionMenuPresenter != null) {
|
||||
return actionMenuPresenter.isOverflowMenuShowing();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOverflowMenuShowPending() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
|
||||
if (actionMenuPresenter != null) {
|
||||
return actionMenuPresenter.isOverflowMenuShowPending();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOverflowReserved() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
|
||||
return actionMenuPresenter != null && actionMenuPresenter.isOverflowReserved();
|
||||
}
|
||||
|
||||
public boolean canShowOverflowMenu() {
|
||||
return isOverflowReserved() && getVisibility() == 0;
|
||||
}
|
||||
|
||||
public void dismissPopupMenus() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
|
||||
if (actionMenuPresenter != null) {
|
||||
actionMenuPresenter.dismissPopupMenus();
|
||||
}
|
||||
}
|
||||
|
||||
protected int measureChildView(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 positionChild(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;
|
||||
}
|
||||
|
||||
protected class VisibilityAnimListener implements ViewPropertyAnimatorListener {
|
||||
private boolean mCanceled = false;
|
||||
int mFinalVisibility;
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void onAnimationCancel(View view) {
|
||||
this.mCanceled = true;
|
||||
}
|
||||
|
||||
protected VisibilityAnimListener() {
|
||||
}
|
||||
|
||||
public VisibilityAnimListener withFinalVisibility(ViewPropertyAnimatorCompat viewPropertyAnimatorCompat, int i) {
|
||||
AbsActionBarView.this.mVisibilityAnim = viewPropertyAnimatorCompat;
|
||||
this.mFinalVisibility = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void onAnimationStart(View view) {
|
||||
AbsActionBarView.super.setVisibility(0);
|
||||
this.mCanceled = false;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void onAnimationEnd(View view) {
|
||||
if (this.mCanceled) {
|
||||
return;
|
||||
}
|
||||
AbsActionBarView.this.mVisibilityAnim = null;
|
||||
AbsActionBarView.super.setVisibility(this.mFinalVisibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
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 mContainer;
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getOpacity() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setAlpha(int i) {
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setColorFilter(ColorFilter colorFilter) {
|
||||
}
|
||||
|
||||
public ActionBarBackgroundDrawable(ActionBarContainer actionBarContainer) {
|
||||
this.mContainer = actionBarContainer;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void draw(Canvas canvas) {
|
||||
if (this.mContainer.mIsSplit) {
|
||||
if (this.mContainer.mSplitBackground != null) {
|
||||
this.mContainer.mSplitBackground.draw(canvas);
|
||||
}
|
||||
} else {
|
||||
if (this.mContainer.mBackground != null) {
|
||||
this.mContainer.mBackground.draw(canvas);
|
||||
}
|
||||
if (this.mContainer.mStackedBackground == null || !this.mContainer.mIsStacked) {
|
||||
return;
|
||||
}
|
||||
this.mContainer.mStackedBackground.draw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void getOutline(Outline outline) {
|
||||
if (this.mContainer.mIsSplit) {
|
||||
if (this.mContainer.mSplitBackground != null) {
|
||||
Api21Impl.getOutline(this.mContainer.mBackground, outline);
|
||||
}
|
||||
} else if (this.mContainer.mBackground != null) {
|
||||
Api21Impl.getOutline(this.mContainer.mBackground, outline);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Api21Impl {
|
||||
private Api21Impl() {
|
||||
}
|
||||
|
||||
public static void getOutline(Drawable drawable, Outline outline) {
|
||||
drawable.getOutline(outline);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,322 @@
|
||||
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;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionBarContainer extends FrameLayout {
|
||||
private View mActionBarView;
|
||||
Drawable mBackground;
|
||||
private View mContextView;
|
||||
private int mHeight;
|
||||
boolean mIsSplit;
|
||||
boolean mIsStacked;
|
||||
private boolean mIsTransitioning;
|
||||
Drawable mSplitBackground;
|
||||
Drawable mStackedBackground;
|
||||
private View mTabContainer;
|
||||
|
||||
public View getTabContainer() {
|
||||
return this.mTabContainer;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent
|
||||
public ActionMode startActionModeForChild(View view, ActionMode.Callback callback) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ActionBarContainer(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ActionBarContainer(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
ViewCompat.setBackground(this, new ActionBarBackgroundDrawable(this));
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.ActionBar);
|
||||
this.mBackground = obtainStyledAttributes.getDrawable(R.styleable.ActionBar_background);
|
||||
this.mStackedBackground = obtainStyledAttributes.getDrawable(R.styleable.ActionBar_backgroundStacked);
|
||||
this.mHeight = obtainStyledAttributes.getDimensionPixelSize(R.styleable.ActionBar_height, -1);
|
||||
boolean z = true;
|
||||
if (getId() == R.id.split_action_bar) {
|
||||
this.mIsSplit = true;
|
||||
this.mSplitBackground = obtainStyledAttributes.getDrawable(R.styleable.ActionBar_backgroundSplit);
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
if (!this.mIsSplit ? this.mBackground != null || this.mStackedBackground != null : this.mSplitBackground != null) {
|
||||
z = false;
|
||||
}
|
||||
setWillNotDraw(z);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
this.mActionBarView = findViewById(R.id.action_bar);
|
||||
this.mContextView = findViewById(R.id.action_context_bar);
|
||||
}
|
||||
|
||||
public void setPrimaryBackground(Drawable drawable) {
|
||||
Drawable drawable2 = this.mBackground;
|
||||
if (drawable2 != null) {
|
||||
drawable2.setCallback(null);
|
||||
unscheduleDrawable(this.mBackground);
|
||||
}
|
||||
this.mBackground = drawable;
|
||||
if (drawable != null) {
|
||||
drawable.setCallback(this);
|
||||
View view = this.mActionBarView;
|
||||
if (view != null) {
|
||||
this.mBackground.setBounds(view.getLeft(), this.mActionBarView.getTop(), this.mActionBarView.getRight(), this.mActionBarView.getBottom());
|
||||
}
|
||||
}
|
||||
boolean z = true;
|
||||
if (!this.mIsSplit ? this.mBackground != null || this.mStackedBackground != null : this.mSplitBackground != null) {
|
||||
z = false;
|
||||
}
|
||||
setWillNotDraw(z);
|
||||
invalidate();
|
||||
Api21Impl.invalidateOutline(this);
|
||||
}
|
||||
|
||||
public void setStackedBackground(Drawable drawable) {
|
||||
Drawable drawable2;
|
||||
Drawable drawable3 = this.mStackedBackground;
|
||||
if (drawable3 != null) {
|
||||
drawable3.setCallback(null);
|
||||
unscheduleDrawable(this.mStackedBackground);
|
||||
}
|
||||
this.mStackedBackground = drawable;
|
||||
if (drawable != null) {
|
||||
drawable.setCallback(this);
|
||||
if (this.mIsStacked && (drawable2 = this.mStackedBackground) != null) {
|
||||
drawable2.setBounds(this.mTabContainer.getLeft(), this.mTabContainer.getTop(), this.mTabContainer.getRight(), this.mTabContainer.getBottom());
|
||||
}
|
||||
}
|
||||
boolean z = true;
|
||||
if (!this.mIsSplit ? this.mBackground != null || this.mStackedBackground != null : this.mSplitBackground != null) {
|
||||
z = false;
|
||||
}
|
||||
setWillNotDraw(z);
|
||||
invalidate();
|
||||
Api21Impl.invalidateOutline(this);
|
||||
}
|
||||
|
||||
public void setSplitBackground(Drawable drawable) {
|
||||
Drawable drawable2;
|
||||
Drawable drawable3 = this.mSplitBackground;
|
||||
if (drawable3 != null) {
|
||||
drawable3.setCallback(null);
|
||||
unscheduleDrawable(this.mSplitBackground);
|
||||
}
|
||||
this.mSplitBackground = drawable;
|
||||
boolean z = false;
|
||||
if (drawable != null) {
|
||||
drawable.setCallback(this);
|
||||
if (this.mIsSplit && (drawable2 = this.mSplitBackground) != null) {
|
||||
drawable2.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
|
||||
}
|
||||
}
|
||||
if (!this.mIsSplit ? !(this.mBackground != null || this.mStackedBackground != null) : this.mSplitBackground == null) {
|
||||
z = true;
|
||||
}
|
||||
setWillNotDraw(z);
|
||||
invalidate();
|
||||
Api21Impl.invalidateOutline(this);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setVisibility(int i) {
|
||||
super.setVisibility(i);
|
||||
boolean z = i == 0;
|
||||
Drawable drawable = this.mBackground;
|
||||
if (drawable != null) {
|
||||
drawable.setVisible(z, false);
|
||||
}
|
||||
Drawable drawable2 = this.mStackedBackground;
|
||||
if (drawable2 != null) {
|
||||
drawable2.setVisible(z, false);
|
||||
}
|
||||
Drawable drawable3 = this.mSplitBackground;
|
||||
if (drawable3 != null) {
|
||||
drawable3.setVisible(z, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected boolean verifyDrawable(Drawable drawable) {
|
||||
return (drawable == this.mBackground && !this.mIsSplit) || (drawable == this.mStackedBackground && this.mIsStacked) || ((drawable == this.mSplitBackground && this.mIsSplit) || super.verifyDrawable(drawable));
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
Drawable drawable = this.mBackground;
|
||||
if (drawable != null && drawable.isStateful()) {
|
||||
this.mBackground.setState(getDrawableState());
|
||||
}
|
||||
Drawable drawable2 = this.mStackedBackground;
|
||||
if (drawable2 != null && drawable2.isStateful()) {
|
||||
this.mStackedBackground.setState(getDrawableState());
|
||||
}
|
||||
Drawable drawable3 = this.mSplitBackground;
|
||||
if (drawable3 == null || !drawable3.isStateful()) {
|
||||
return;
|
||||
}
|
||||
this.mSplitBackground.setState(getDrawableState());
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
public void jumpDrawablesToCurrentState() {
|
||||
super.jumpDrawablesToCurrentState();
|
||||
Drawable drawable = this.mBackground;
|
||||
if (drawable != null) {
|
||||
drawable.jumpToCurrentState();
|
||||
}
|
||||
Drawable drawable2 = this.mStackedBackground;
|
||||
if (drawable2 != null) {
|
||||
drawable2.jumpToCurrentState();
|
||||
}
|
||||
Drawable drawable3 = this.mSplitBackground;
|
||||
if (drawable3 != null) {
|
||||
drawable3.jumpToCurrentState();
|
||||
}
|
||||
}
|
||||
|
||||
public void setTransitioning(boolean z) {
|
||||
this.mIsTransitioning = z;
|
||||
setDescendantFocusability(z ? 393216 : 262144);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
|
||||
return this.mIsTransitioning || super.onInterceptTouchEvent(motionEvent);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
super.onTouchEvent(motionEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean onHoverEvent(MotionEvent motionEvent) {
|
||||
super.onHoverEvent(motionEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setTabContainer(ScrollingTabContainerView scrollingTabContainerView) {
|
||||
View view = this.mTabContainer;
|
||||
if (view != null) {
|
||||
removeView(view);
|
||||
}
|
||||
this.mTabContainer = scrollingTabContainerView;
|
||||
if (scrollingTabContainerView != null) {
|
||||
addView(scrollingTabContainerView);
|
||||
ViewGroup.LayoutParams layoutParams = scrollingTabContainerView.getLayoutParams();
|
||||
layoutParams.width = -1;
|
||||
layoutParams.height = -2;
|
||||
scrollingTabContainerView.setAllowCollapse(false);
|
||||
}
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
private boolean isCollapsed(View view) {
|
||||
return view == null || view.getVisibility() == 8 || view.getMeasuredHeight() == 0;
|
||||
}
|
||||
|
||||
private int getMeasuredHeightWithMargins(View view) {
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams();
|
||||
return view.getMeasuredHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
|
||||
}
|
||||
|
||||
@Override // android.widget.FrameLayout, android.view.View
|
||||
public void onMeasure(int i, int i2) {
|
||||
int measuredHeightWithMargins;
|
||||
int i3;
|
||||
if (this.mActionBarView == null && View.MeasureSpec.getMode(i2) == Integer.MIN_VALUE && (i3 = this.mHeight) >= 0) {
|
||||
i2 = View.MeasureSpec.makeMeasureSpec(Math.min(i3, View.MeasureSpec.getSize(i2)), Integer.MIN_VALUE);
|
||||
}
|
||||
super.onMeasure(i, i2);
|
||||
if (this.mActionBarView == null) {
|
||||
return;
|
||||
}
|
||||
int mode = View.MeasureSpec.getMode(i2);
|
||||
View view = this.mTabContainer;
|
||||
if (view == null || view.getVisibility() == 8 || mode == 1073741824) {
|
||||
return;
|
||||
}
|
||||
if (!isCollapsed(this.mActionBarView)) {
|
||||
measuredHeightWithMargins = getMeasuredHeightWithMargins(this.mActionBarView);
|
||||
} else {
|
||||
measuredHeightWithMargins = !isCollapsed(this.mContextView) ? getMeasuredHeightWithMargins(this.mContextView) : 0;
|
||||
}
|
||||
setMeasuredDimension(getMeasuredWidth(), Math.min(measuredHeightWithMargins + getMeasuredHeightWithMargins(this.mTabContainer), mode == Integer.MIN_VALUE ? View.MeasureSpec.getSize(i2) : Integer.MAX_VALUE));
|
||||
}
|
||||
|
||||
@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.mTabContainer;
|
||||
boolean z2 = true;
|
||||
boolean z3 = (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.mIsSplit) {
|
||||
Drawable drawable2 = this.mSplitBackground;
|
||||
if (drawable2 == null) {
|
||||
return;
|
||||
} else {
|
||||
drawable2.setBounds(0, 0, getMeasuredWidth(), getMeasuredHeight());
|
||||
}
|
||||
} else {
|
||||
if (this.mBackground == null) {
|
||||
z2 = false;
|
||||
} else if (this.mActionBarView.getVisibility() == 0) {
|
||||
this.mBackground.setBounds(this.mActionBarView.getLeft(), this.mActionBarView.getTop(), this.mActionBarView.getRight(), this.mActionBarView.getBottom());
|
||||
} else {
|
||||
View view2 = this.mContextView;
|
||||
if (view2 != null && view2.getVisibility() == 0) {
|
||||
this.mBackground.setBounds(this.mContextView.getLeft(), this.mContextView.getTop(), this.mContextView.getRight(), this.mContextView.getBottom());
|
||||
} else {
|
||||
this.mBackground.setBounds(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
this.mIsStacked = z3;
|
||||
if (z3 && (drawable = this.mStackedBackground) != null) {
|
||||
drawable.setBounds(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
|
||||
} else if (!z2) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
|
||||
private static class Api21Impl {
|
||||
private Api21Impl() {
|
||||
}
|
||||
|
||||
public static void invalidateOutline(ActionBarContainer actionBarContainer) {
|
||||
actionBarContainer.invalidateOutline();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,388 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.view.ActionMode;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionBarContextView extends AbsActionBarView {
|
||||
private View mClose;
|
||||
private View mCloseButton;
|
||||
private int mCloseItemLayout;
|
||||
private View mCustomView;
|
||||
private CharSequence mSubtitle;
|
||||
private int mSubtitleStyleRes;
|
||||
private TextView mSubtitleView;
|
||||
private CharSequence mTitle;
|
||||
private LinearLayout mTitleLayout;
|
||||
private boolean mTitleOptional;
|
||||
private int mTitleStyleRes;
|
||||
private TextView mTitleView;
|
||||
|
||||
public CharSequence getSubtitle() {
|
||||
return this.mSubtitle;
|
||||
}
|
||||
|
||||
public CharSequence getTitle() {
|
||||
return this.mTitle;
|
||||
}
|
||||
|
||||
public boolean isTitleOptional() {
|
||||
return this.mTitleOptional;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public boolean shouldDelayChildPressedState() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ void animateToVisibility(int i) {
|
||||
super.animateToVisibility(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ boolean canShowOverflowMenu() {
|
||||
return super.canShowOverflowMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ void dismissPopupMenus() {
|
||||
super.dismissPopupMenus();
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ boolean isOverflowMenuShowPending() {
|
||||
return super.isOverflowMenuShowPending();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ boolean isOverflowReserved() {
|
||||
return super.isOverflowReserved();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView, android.view.View
|
||||
public /* bridge */ /* synthetic */ boolean onHoverEvent(MotionEvent motionEvent) {
|
||||
return super.onHoverEvent(motionEvent);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView, android.view.View
|
||||
public /* bridge */ /* synthetic */ boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
return super.onTouchEvent(motionEvent);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ void postShowOverflowMenu() {
|
||||
super.postShowOverflowMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView, android.view.View
|
||||
public /* bridge */ /* synthetic */ void setVisibility(int i) {
|
||||
super.setVisibility(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public /* bridge */ /* synthetic */ ViewPropertyAnimatorCompat setupAnimatorToVisibility(int i, long j) {
|
||||
return super.setupAnimatorToVisibility(i, j);
|
||||
}
|
||||
|
||||
public ActionBarContextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ActionBarContextView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.actionModeStyle);
|
||||
}
|
||||
|
||||
public ActionBarContextView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, attributeSet, R.styleable.ActionMode, i, 0);
|
||||
ViewCompat.setBackground(this, obtainStyledAttributes.getDrawable(R.styleable.ActionMode_background));
|
||||
this.mTitleStyleRes = obtainStyledAttributes.getResourceId(R.styleable.ActionMode_titleTextStyle, 0);
|
||||
this.mSubtitleStyleRes = obtainStyledAttributes.getResourceId(R.styleable.ActionMode_subtitleTextStyle, 0);
|
||||
this.mContentHeight = obtainStyledAttributes.getLayoutDimension(R.styleable.ActionMode_height, 0);
|
||||
this.mCloseItemLayout = obtainStyledAttributes.getResourceId(R.styleable.ActionMode_closeItemLayout, R.layout.abc_action_mode_close_item_material);
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
if (this.mActionMenuPresenter != null) {
|
||||
this.mActionMenuPresenter.hideOverflowMenu();
|
||||
this.mActionMenuPresenter.hideSubMenus();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public void setContentHeight(int i) {
|
||||
this.mContentHeight = i;
|
||||
}
|
||||
|
||||
public void setCustomView(View view) {
|
||||
LinearLayout linearLayout;
|
||||
View view2 = this.mCustomView;
|
||||
if (view2 != null) {
|
||||
removeView(view2);
|
||||
}
|
||||
this.mCustomView = view;
|
||||
if (view != null && (linearLayout = this.mTitleLayout) != null) {
|
||||
removeView(linearLayout);
|
||||
this.mTitleLayout = null;
|
||||
}
|
||||
if (view != null) {
|
||||
addView(view);
|
||||
}
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public void setTitle(CharSequence charSequence) {
|
||||
this.mTitle = charSequence;
|
||||
initTitle();
|
||||
ViewCompat.setAccessibilityPaneTitle(this, charSequence);
|
||||
}
|
||||
|
||||
public void setSubtitle(CharSequence charSequence) {
|
||||
this.mSubtitle = charSequence;
|
||||
initTitle();
|
||||
}
|
||||
|
||||
private void initTitle() {
|
||||
if (this.mTitleLayout == null) {
|
||||
LayoutInflater.from(getContext()).inflate(R.layout.abc_action_bar_title_item, this);
|
||||
LinearLayout linearLayout = (LinearLayout) getChildAt(getChildCount() - 1);
|
||||
this.mTitleLayout = linearLayout;
|
||||
this.mTitleView = (TextView) linearLayout.findViewById(R.id.action_bar_title);
|
||||
this.mSubtitleView = (TextView) this.mTitleLayout.findViewById(R.id.action_bar_subtitle);
|
||||
if (this.mTitleStyleRes != 0) {
|
||||
this.mTitleView.setTextAppearance(getContext(), this.mTitleStyleRes);
|
||||
}
|
||||
if (this.mSubtitleStyleRes != 0) {
|
||||
this.mSubtitleView.setTextAppearance(getContext(), this.mSubtitleStyleRes);
|
||||
}
|
||||
}
|
||||
this.mTitleView.setText(this.mTitle);
|
||||
this.mSubtitleView.setText(this.mSubtitle);
|
||||
boolean z = !TextUtils.isEmpty(this.mTitle);
|
||||
boolean z2 = !TextUtils.isEmpty(this.mSubtitle);
|
||||
int i = 0;
|
||||
this.mSubtitleView.setVisibility(z2 ? 0 : 8);
|
||||
LinearLayout linearLayout2 = this.mTitleLayout;
|
||||
if (!z && !z2) {
|
||||
i = 8;
|
||||
}
|
||||
linearLayout2.setVisibility(i);
|
||||
if (this.mTitleLayout.getParent() == null) {
|
||||
addView(this.mTitleLayout);
|
||||
}
|
||||
}
|
||||
|
||||
public void initForMode(final ActionMode actionMode) {
|
||||
View view = this.mClose;
|
||||
if (view == null) {
|
||||
View inflate = LayoutInflater.from(getContext()).inflate(this.mCloseItemLayout, (ViewGroup) this, false);
|
||||
this.mClose = inflate;
|
||||
addView(inflate);
|
||||
} else if (view.getParent() == null) {
|
||||
addView(this.mClose);
|
||||
}
|
||||
View findViewById = this.mClose.findViewById(R.id.action_mode_close_button);
|
||||
this.mCloseButton = findViewById;
|
||||
findViewById.setOnClickListener(new View.OnClickListener() { // from class: androidx.appcompat.widget.ActionBarContextView.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view2) {
|
||||
actionMode.finish();
|
||||
}
|
||||
});
|
||||
MenuBuilder menuBuilder = (MenuBuilder) actionMode.getMenu();
|
||||
if (this.mActionMenuPresenter != null) {
|
||||
this.mActionMenuPresenter.dismissPopupMenus();
|
||||
}
|
||||
this.mActionMenuPresenter = new ActionMenuPresenter(getContext());
|
||||
this.mActionMenuPresenter.setReserveOverflow(true);
|
||||
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(-2, -1);
|
||||
menuBuilder.addMenuPresenter(this.mActionMenuPresenter, this.mPopupContext);
|
||||
this.mMenuView = (ActionMenuView) this.mActionMenuPresenter.getMenuView(this);
|
||||
ViewCompat.setBackground(this.mMenuView, null);
|
||||
addView(this.mMenuView, layoutParams);
|
||||
}
|
||||
|
||||
public void closeMode() {
|
||||
if (this.mClose == null) {
|
||||
killMode();
|
||||
}
|
||||
}
|
||||
|
||||
public void killMode() {
|
||||
removeAllViews();
|
||||
this.mCustomView = null;
|
||||
this.mMenuView = null;
|
||||
this.mActionMenuPresenter = null;
|
||||
View view = this.mCloseButton;
|
||||
if (view != null) {
|
||||
view.setOnClickListener(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public boolean showOverflowMenu() {
|
||||
if (this.mActionMenuPresenter != null) {
|
||||
return this.mActionMenuPresenter.showOverflowMenu();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public boolean hideOverflowMenu() {
|
||||
if (this.mActionMenuPresenter != null) {
|
||||
return this.mActionMenuPresenter.hideOverflowMenu();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AbsActionBarView
|
||||
public boolean isOverflowMenuShowing() {
|
||||
if (this.mActionMenuPresenter != null) {
|
||||
return this.mActionMenuPresenter.isOverflowMenuShowing();
|
||||
}
|
||||
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 // android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
int mode = View.MeasureSpec.getMode(i);
|
||||
int i3 = BasicMeasure.EXACTLY;
|
||||
if (mode != 1073741824) {
|
||||
throw new IllegalStateException(getClass().getSimpleName() + " can only be used with android:layout_width=\"match_parent\" (or fill_parent)");
|
||||
}
|
||||
if (View.MeasureSpec.getMode(i2) == 0) {
|
||||
throw new IllegalStateException(getClass().getSimpleName() + " can only be used with android:layout_height=\"wrap_content\"");
|
||||
}
|
||||
int size = View.MeasureSpec.getSize(i);
|
||||
int size2 = this.mContentHeight > 0 ? this.mContentHeight : View.MeasureSpec.getSize(i2);
|
||||
int paddingTop = getPaddingTop() + getPaddingBottom();
|
||||
int paddingLeft = (size - getPaddingLeft()) - getPaddingRight();
|
||||
int i4 = size2 - paddingTop;
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i4, Integer.MIN_VALUE);
|
||||
View view = this.mClose;
|
||||
if (view != null) {
|
||||
int measureChildView = measureChildView(view, paddingLeft, makeMeasureSpec, 0);
|
||||
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.mClose.getLayoutParams();
|
||||
paddingLeft = measureChildView - (marginLayoutParams.leftMargin + marginLayoutParams.rightMargin);
|
||||
}
|
||||
if (this.mMenuView != null && this.mMenuView.getParent() == this) {
|
||||
paddingLeft = measureChildView(this.mMenuView, paddingLeft, makeMeasureSpec, 0);
|
||||
}
|
||||
LinearLayout linearLayout = this.mTitleLayout;
|
||||
if (linearLayout != null && this.mCustomView == null) {
|
||||
if (this.mTitleOptional) {
|
||||
this.mTitleLayout.measure(View.MeasureSpec.makeMeasureSpec(0, 0), makeMeasureSpec);
|
||||
int measuredWidth = this.mTitleLayout.getMeasuredWidth();
|
||||
boolean z = measuredWidth <= paddingLeft;
|
||||
if (z) {
|
||||
paddingLeft -= measuredWidth;
|
||||
}
|
||||
this.mTitleLayout.setVisibility(z ? 0 : 8);
|
||||
} else {
|
||||
paddingLeft = measureChildView(linearLayout, paddingLeft, makeMeasureSpec, 0);
|
||||
}
|
||||
}
|
||||
View view2 = this.mCustomView;
|
||||
if (view2 != null) {
|
||||
ViewGroup.LayoutParams layoutParams = view2.getLayoutParams();
|
||||
int i5 = layoutParams.width != -2 ? BasicMeasure.EXACTLY : Integer.MIN_VALUE;
|
||||
if (layoutParams.width >= 0) {
|
||||
paddingLeft = Math.min(layoutParams.width, paddingLeft);
|
||||
}
|
||||
if (layoutParams.height == -2) {
|
||||
i3 = Integer.MIN_VALUE;
|
||||
}
|
||||
if (layoutParams.height >= 0) {
|
||||
i4 = Math.min(layoutParams.height, i4);
|
||||
}
|
||||
this.mCustomView.measure(View.MeasureSpec.makeMeasureSpec(paddingLeft, i5), View.MeasureSpec.makeMeasureSpec(i4, i3));
|
||||
}
|
||||
if (this.mContentHeight <= 0) {
|
||||
int childCount = getChildCount();
|
||||
int i6 = 0;
|
||||
for (int i7 = 0; i7 < childCount; i7++) {
|
||||
int measuredHeight = getChildAt(i7).getMeasuredHeight() + paddingTop;
|
||||
if (measuredHeight > i6) {
|
||||
i6 = measuredHeight;
|
||||
}
|
||||
}
|
||||
setMeasuredDimension(size, i6);
|
||||
return;
|
||||
}
|
||||
setMeasuredDimension(size, size2);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
boolean isLayoutRtl = ViewUtils.isLayoutRtl(this);
|
||||
int paddingRight = isLayoutRtl ? (i3 - i) - getPaddingRight() : getPaddingLeft();
|
||||
int paddingTop = getPaddingTop();
|
||||
int paddingTop2 = ((i4 - i2) - getPaddingTop()) - getPaddingBottom();
|
||||
View view = this.mClose;
|
||||
if (view != null && view.getVisibility() != 8) {
|
||||
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.mClose.getLayoutParams();
|
||||
int i5 = isLayoutRtl ? marginLayoutParams.rightMargin : marginLayoutParams.leftMargin;
|
||||
int i6 = isLayoutRtl ? marginLayoutParams.leftMargin : marginLayoutParams.rightMargin;
|
||||
int next = next(paddingRight, i5, isLayoutRtl);
|
||||
paddingRight = next(next + positionChild(this.mClose, next, paddingTop, paddingTop2, isLayoutRtl), i6, isLayoutRtl);
|
||||
}
|
||||
int i7 = paddingRight;
|
||||
LinearLayout linearLayout = this.mTitleLayout;
|
||||
if (linearLayout != null && this.mCustomView == null && linearLayout.getVisibility() != 8) {
|
||||
i7 += positionChild(this.mTitleLayout, i7, paddingTop, paddingTop2, isLayoutRtl);
|
||||
}
|
||||
int i8 = i7;
|
||||
View view2 = this.mCustomView;
|
||||
if (view2 != null) {
|
||||
positionChild(view2, i8, paddingTop, paddingTop2, isLayoutRtl);
|
||||
}
|
||||
int paddingLeft = isLayoutRtl ? getPaddingLeft() : (i3 - i) - getPaddingRight();
|
||||
if (this.mMenuView != null) {
|
||||
positionChild(this.mMenuView, paddingLeft, paddingTop, paddingTop2, !isLayoutRtl);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTitleOptional(boolean z) {
|
||||
if (z != this.mTitleOptional) {
|
||||
requestLayout();
|
||||
}
|
||||
this.mTitleOptional = z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,744 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
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.Parcelable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.SparseArray;
|
||||
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;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.NestedScrollingParent;
|
||||
import androidx.core.view.NestedScrollingParent2;
|
||||
import androidx.core.view.NestedScrollingParent3;
|
||||
import androidx.core.view.NestedScrollingParentHelper;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionBarOverlayLayout extends ViewGroup implements DecorContentParent, NestedScrollingParent, NestedScrollingParent2, NestedScrollingParent3 {
|
||||
private static final int ACTION_BAR_ANIMATE_DELAY = 600;
|
||||
static final int[] ATTRS = {R.attr.actionBarSize, android.R.attr.windowContentOverlay};
|
||||
private static final String TAG = "ActionBarOverlayLayout";
|
||||
private int mActionBarHeight;
|
||||
ActionBarContainer mActionBarTop;
|
||||
private ActionBarVisibilityCallback mActionBarVisibilityCallback;
|
||||
private final Runnable mAddActionBarHideOffset;
|
||||
boolean mAnimatingForFling;
|
||||
private final Rect mBaseContentInsets;
|
||||
private WindowInsetsCompat mBaseInnerInsets;
|
||||
private final Rect mBaseInnerInsetsRect;
|
||||
private ContentFrameLayout mContent;
|
||||
private final Rect mContentInsets;
|
||||
ViewPropertyAnimator mCurrentActionBarTopAnimator;
|
||||
private DecorToolbar mDecorToolbar;
|
||||
private OverScroller mFlingEstimator;
|
||||
private boolean mHasNonEmbeddedTabs;
|
||||
private boolean mHideOnContentScroll;
|
||||
private int mHideOnContentScrollReference;
|
||||
private boolean mIgnoreWindowContentOverlay;
|
||||
private WindowInsetsCompat mInnerInsets;
|
||||
private final Rect mInnerInsetsRect;
|
||||
private final Rect mLastBaseContentInsets;
|
||||
private WindowInsetsCompat mLastBaseInnerInsets;
|
||||
private final Rect mLastBaseInnerInsetsRect;
|
||||
private WindowInsetsCompat mLastInnerInsets;
|
||||
private final Rect mLastInnerInsetsRect;
|
||||
private int mLastSystemUiVisibility;
|
||||
private boolean mOverlayMode;
|
||||
private final NestedScrollingParentHelper mParentHelper;
|
||||
private final Runnable mRemoveActionBarHideOffset;
|
||||
final AnimatorListenerAdapter mTopAnimatorListener;
|
||||
private Drawable mWindowContentOverlay;
|
||||
private int mWindowVisibility;
|
||||
|
||||
public interface ActionBarVisibilityCallback {
|
||||
void enableContentAnimations(boolean z);
|
||||
|
||||
void hideForSystem();
|
||||
|
||||
void onContentScrollStarted();
|
||||
|
||||
void onContentScrollStopped();
|
||||
|
||||
void onWindowVisibilityChanged(int i);
|
||||
|
||||
void showForSystem();
|
||||
}
|
||||
|
||||
public boolean isHideOnContentScrollEnabled() {
|
||||
return this.mHideOnContentScroll;
|
||||
}
|
||||
|
||||
public boolean isInOverlayMode() {
|
||||
return this.mOverlayMode;
|
||||
}
|
||||
|
||||
@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) {
|
||||
}
|
||||
|
||||
public void setHasNonEmbeddedTabs(boolean z) {
|
||||
this.mHasNonEmbeddedTabs = z;
|
||||
}
|
||||
|
||||
public void setShowingForActionMode(boolean z) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setUiOptions(int i) {
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public boolean shouldDelayChildPressedState() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ActionBarOverlayLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ActionBarOverlayLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.mWindowVisibility = 0;
|
||||
this.mBaseContentInsets = new Rect();
|
||||
this.mLastBaseContentInsets = new Rect();
|
||||
this.mContentInsets = new Rect();
|
||||
this.mBaseInnerInsetsRect = new Rect();
|
||||
this.mLastBaseInnerInsetsRect = new Rect();
|
||||
this.mInnerInsetsRect = new Rect();
|
||||
this.mLastInnerInsetsRect = new Rect();
|
||||
this.mBaseInnerInsets = WindowInsetsCompat.CONSUMED;
|
||||
this.mLastBaseInnerInsets = WindowInsetsCompat.CONSUMED;
|
||||
this.mInnerInsets = WindowInsetsCompat.CONSUMED;
|
||||
this.mLastInnerInsets = WindowInsetsCompat.CONSUMED;
|
||||
this.mTopAnimatorListener = new AnimatorListenerAdapter() { // from class: androidx.appcompat.widget.ActionBarOverlayLayout.1
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
ActionBarOverlayLayout.this.mCurrentActionBarTopAnimator = null;
|
||||
ActionBarOverlayLayout.this.mAnimatingForFling = false;
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationCancel(Animator animator) {
|
||||
ActionBarOverlayLayout.this.mCurrentActionBarTopAnimator = null;
|
||||
ActionBarOverlayLayout.this.mAnimatingForFling = false;
|
||||
}
|
||||
};
|
||||
this.mRemoveActionBarHideOffset = new Runnable() { // from class: androidx.appcompat.widget.ActionBarOverlayLayout.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ActionBarOverlayLayout.this.haltActionBarHideOffsetAnimations();
|
||||
ActionBarOverlayLayout actionBarOverlayLayout = ActionBarOverlayLayout.this;
|
||||
actionBarOverlayLayout.mCurrentActionBarTopAnimator = actionBarOverlayLayout.mActionBarTop.animate().translationY(0.0f).setListener(ActionBarOverlayLayout.this.mTopAnimatorListener);
|
||||
}
|
||||
};
|
||||
this.mAddActionBarHideOffset = new Runnable() { // from class: androidx.appcompat.widget.ActionBarOverlayLayout.3
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ActionBarOverlayLayout.this.haltActionBarHideOffsetAnimations();
|
||||
ActionBarOverlayLayout actionBarOverlayLayout = ActionBarOverlayLayout.this;
|
||||
actionBarOverlayLayout.mCurrentActionBarTopAnimator = actionBarOverlayLayout.mActionBarTop.animate().translationY(-ActionBarOverlayLayout.this.mActionBarTop.getHeight()).setListener(ActionBarOverlayLayout.this.mTopAnimatorListener);
|
||||
}
|
||||
};
|
||||
init(context);
|
||||
this.mParentHelper = new NestedScrollingParentHelper(this);
|
||||
}
|
||||
|
||||
private void init(Context context) {
|
||||
TypedArray obtainStyledAttributes = getContext().getTheme().obtainStyledAttributes(ATTRS);
|
||||
this.mActionBarHeight = obtainStyledAttributes.getDimensionPixelSize(0, 0);
|
||||
Drawable drawable = obtainStyledAttributes.getDrawable(1);
|
||||
this.mWindowContentOverlay = drawable;
|
||||
setWillNotDraw(drawable == null);
|
||||
obtainStyledAttributes.recycle();
|
||||
this.mIgnoreWindowContentOverlay = context.getApplicationInfo().targetSdkVersion < 19;
|
||||
this.mFlingEstimator = new OverScroller(context);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
haltActionBarHideOffsetAnimations();
|
||||
}
|
||||
|
||||
public void setActionBarVisibilityCallback(ActionBarVisibilityCallback actionBarVisibilityCallback) {
|
||||
this.mActionBarVisibilityCallback = actionBarVisibilityCallback;
|
||||
if (getWindowToken() != null) {
|
||||
this.mActionBarVisibilityCallback.onWindowVisibilityChanged(this.mWindowVisibility);
|
||||
int i = this.mLastSystemUiVisibility;
|
||||
if (i != 0) {
|
||||
onWindowSystemUiVisibilityChanged(i);
|
||||
ViewCompat.requestApplyInsets(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setOverlayMode(boolean z) {
|
||||
this.mOverlayMode = z;
|
||||
this.mIgnoreWindowContentOverlay = z && getContext().getApplicationInfo().targetSdkVersion < 19;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onConfigurationChanged(Configuration configuration) {
|
||||
super.onConfigurationChanged(configuration);
|
||||
init(getContext());
|
||||
ViewCompat.requestApplyInsets(this);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
@Deprecated
|
||||
public void onWindowSystemUiVisibilityChanged(int i) {
|
||||
super.onWindowSystemUiVisibilityChanged(i);
|
||||
pullChildren();
|
||||
int i2 = this.mLastSystemUiVisibility ^ i;
|
||||
this.mLastSystemUiVisibility = i;
|
||||
boolean z = (i & 4) == 0;
|
||||
boolean z2 = (i & 256) != 0;
|
||||
ActionBarVisibilityCallback actionBarVisibilityCallback = this.mActionBarVisibilityCallback;
|
||||
if (actionBarVisibilityCallback != null) {
|
||||
actionBarVisibilityCallback.enableContentAnimations(!z2);
|
||||
if (z || !z2) {
|
||||
this.mActionBarVisibilityCallback.showForSystem();
|
||||
} else {
|
||||
this.mActionBarVisibilityCallback.hideForSystem();
|
||||
}
|
||||
}
|
||||
if ((i2 & 256) == 0 || this.mActionBarVisibilityCallback == null) {
|
||||
return;
|
||||
}
|
||||
ViewCompat.requestApplyInsets(this);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onWindowVisibilityChanged(int i) {
|
||||
super.onWindowVisibilityChanged(i);
|
||||
this.mWindowVisibility = i;
|
||||
ActionBarVisibilityCallback actionBarVisibilityCallback = this.mActionBarVisibilityCallback;
|
||||
if (actionBarVisibilityCallback != null) {
|
||||
actionBarVisibilityCallback.onWindowVisibilityChanged(i);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean applyInsets(View view, Rect rect, boolean z, boolean z2, boolean z3, boolean z4) {
|
||||
boolean z5;
|
||||
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
||||
if (!z || layoutParams.leftMargin == rect.left) {
|
||||
z5 = false;
|
||||
} else {
|
||||
layoutParams.leftMargin = rect.left;
|
||||
z5 = true;
|
||||
}
|
||||
if (z2 && layoutParams.topMargin != rect.top) {
|
||||
layoutParams.topMargin = rect.top;
|
||||
z5 = true;
|
||||
}
|
||||
if (z4 && layoutParams.rightMargin != rect.right) {
|
||||
layoutParams.rightMargin = rect.right;
|
||||
z5 = true;
|
||||
}
|
||||
if (!z3 || layoutParams.bottomMargin == rect.bottom) {
|
||||
return z5;
|
||||
}
|
||||
layoutParams.bottomMargin = rect.bottom;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected boolean fitSystemWindows(Rect rect) {
|
||||
return super.fitSystemWindows(rect);
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:11:0x0061, code lost:
|
||||
|
||||
if (r0 != false) goto L9;
|
||||
*/
|
||||
@Override // android.view.View
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
public android.view.WindowInsets onApplyWindowInsets(android.view.WindowInsets r8) {
|
||||
/*
|
||||
r7 = this;
|
||||
r7.pullChildren()
|
||||
androidx.core.view.WindowInsetsCompat r8 = androidx.core.view.WindowInsetsCompat.toWindowInsetsCompat(r8, r7)
|
||||
android.graphics.Rect r2 = new android.graphics.Rect
|
||||
int r0 = r8.getSystemWindowInsetLeft()
|
||||
int r1 = r8.getSystemWindowInsetTop()
|
||||
int r3 = r8.getSystemWindowInsetRight()
|
||||
int r4 = r8.getSystemWindowInsetBottom()
|
||||
r2.<init>(r0, r1, r3, r4)
|
||||
androidx.appcompat.widget.ActionBarContainer r1 = r7.mActionBarTop
|
||||
r3 = 1
|
||||
r4 = 1
|
||||
r5 = 0
|
||||
r6 = 1
|
||||
r0 = r7
|
||||
boolean r0 = r0.applyInsets(r1, r2, r3, r4, r5, r6)
|
||||
android.graphics.Rect r1 = r7.mBaseContentInsets
|
||||
androidx.core.view.ViewCompat.computeSystemWindowInsets(r7, r8, r1)
|
||||
android.graphics.Rect r1 = r7.mBaseContentInsets
|
||||
int r1 = r1.left
|
||||
android.graphics.Rect r2 = r7.mBaseContentInsets
|
||||
int r2 = r2.top
|
||||
android.graphics.Rect r3 = r7.mBaseContentInsets
|
||||
int r3 = r3.right
|
||||
android.graphics.Rect r4 = r7.mBaseContentInsets
|
||||
int r4 = r4.bottom
|
||||
androidx.core.view.WindowInsetsCompat r1 = r8.inset(r1, r2, r3, r4)
|
||||
r7.mBaseInnerInsets = r1
|
||||
androidx.core.view.WindowInsetsCompat r2 = r7.mLastBaseInnerInsets
|
||||
boolean r1 = r2.equals(r1)
|
||||
if (r1 != 0) goto L4f
|
||||
androidx.core.view.WindowInsetsCompat r0 = r7.mBaseInnerInsets
|
||||
r7.mLastBaseInnerInsets = r0
|
||||
r0 = 1
|
||||
L4f:
|
||||
android.graphics.Rect r1 = r7.mLastBaseContentInsets
|
||||
android.graphics.Rect r2 = r7.mBaseContentInsets
|
||||
boolean r1 = r1.equals(r2)
|
||||
if (r1 != 0) goto L61
|
||||
android.graphics.Rect r0 = r7.mLastBaseContentInsets
|
||||
android.graphics.Rect r1 = r7.mBaseContentInsets
|
||||
r0.set(r1)
|
||||
goto L63
|
||||
L61:
|
||||
if (r0 == 0) goto L66
|
||||
L63:
|
||||
r7.requestLayout()
|
||||
L66:
|
||||
androidx.core.view.WindowInsetsCompat r8 = r8.consumeDisplayCutout()
|
||||
androidx.core.view.WindowInsetsCompat r8 = r8.consumeSystemWindowInsets()
|
||||
androidx.core.view.WindowInsetsCompat r8 = r8.consumeStableInsets()
|
||||
android.view.WindowInsets r8 = r8.toWindowInsets()
|
||||
return r8
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ActionBarOverlayLayout.onApplyWindowInsets(android.view.WindowInsets):android.view.WindowInsets");
|
||||
}
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
return layoutParams instanceof LayoutParams;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
int measuredHeight;
|
||||
pullChildren();
|
||||
measureChildWithMargins(this.mActionBarTop, i, 0, i2, 0);
|
||||
LayoutParams layoutParams = (LayoutParams) this.mActionBarTop.getLayoutParams();
|
||||
int max = Math.max(0, this.mActionBarTop.getMeasuredWidth() + layoutParams.leftMargin + layoutParams.rightMargin);
|
||||
int max2 = Math.max(0, this.mActionBarTop.getMeasuredHeight() + layoutParams.topMargin + layoutParams.bottomMargin);
|
||||
int combineMeasuredStates = View.combineMeasuredStates(0, this.mActionBarTop.getMeasuredState());
|
||||
boolean z = (ViewCompat.getWindowSystemUiVisibility(this) & 256) != 0;
|
||||
if (z) {
|
||||
measuredHeight = this.mActionBarHeight;
|
||||
if (this.mHasNonEmbeddedTabs && this.mActionBarTop.getTabContainer() != null) {
|
||||
measuredHeight += this.mActionBarHeight;
|
||||
}
|
||||
} else {
|
||||
measuredHeight = this.mActionBarTop.getVisibility() != 8 ? this.mActionBarTop.getMeasuredHeight() : 0;
|
||||
}
|
||||
this.mContentInsets.set(this.mBaseContentInsets);
|
||||
this.mInnerInsets = this.mBaseInnerInsets;
|
||||
if (!this.mOverlayMode && !z) {
|
||||
this.mContentInsets.top += measuredHeight;
|
||||
Rect rect = this.mContentInsets;
|
||||
rect.bottom = rect.bottom;
|
||||
this.mInnerInsets = this.mInnerInsets.inset(0, measuredHeight, 0, 0);
|
||||
} else {
|
||||
this.mInnerInsets = new WindowInsetsCompat.Builder(this.mInnerInsets).setSystemWindowInsets(Insets.of(this.mInnerInsets.getSystemWindowInsetLeft(), this.mInnerInsets.getSystemWindowInsetTop() + measuredHeight, this.mInnerInsets.getSystemWindowInsetRight(), this.mInnerInsets.getSystemWindowInsetBottom())).build();
|
||||
}
|
||||
applyInsets(this.mContent, this.mContentInsets, true, true, true, true);
|
||||
if (!this.mLastInnerInsets.equals(this.mInnerInsets)) {
|
||||
WindowInsetsCompat windowInsetsCompat = this.mInnerInsets;
|
||||
this.mLastInnerInsets = windowInsetsCompat;
|
||||
ViewCompat.dispatchApplyWindowInsets(this.mContent, windowInsetsCompat);
|
||||
}
|
||||
measureChildWithMargins(this.mContent, i, 0, i2, 0);
|
||||
LayoutParams layoutParams2 = (LayoutParams) this.mContent.getLayoutParams();
|
||||
int max3 = Math.max(max, this.mContent.getMeasuredWidth() + layoutParams2.leftMargin + layoutParams2.rightMargin);
|
||||
int max4 = Math.max(max2, this.mContent.getMeasuredHeight() + layoutParams2.topMargin + layoutParams2.bottomMargin);
|
||||
int combineMeasuredStates2 = View.combineMeasuredStates(combineMeasuredStates, this.mContent.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.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
int childCount = getChildCount();
|
||||
int paddingLeft = getPaddingLeft();
|
||||
int paddingTop = getPaddingTop();
|
||||
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 = layoutParams.leftMargin + paddingLeft;
|
||||
int i7 = layoutParams.topMargin + paddingTop;
|
||||
childAt.layout(i6, i7, measuredWidth + i6, measuredHeight + i7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void draw(Canvas canvas) {
|
||||
super.draw(canvas);
|
||||
if (this.mWindowContentOverlay == null || this.mIgnoreWindowContentOverlay) {
|
||||
return;
|
||||
}
|
||||
int bottom = this.mActionBarTop.getVisibility() == 0 ? (int) (this.mActionBarTop.getBottom() + this.mActionBarTop.getTranslationY() + 0.5f) : 0;
|
||||
this.mWindowContentOverlay.setBounds(0, bottom, getWidth(), this.mWindowContentOverlay.getIntrinsicHeight() + bottom);
|
||||
this.mWindowContentOverlay.draw(canvas);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.NestedScrollingParent3
|
||||
public void onNestedScroll(View view, int i, int i2, int i3, int i4, int i5, int[] iArr) {
|
||||
onNestedScroll(view, i, i2, i3, i4, i5);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.NestedScrollingParent2
|
||||
public boolean onStartNestedScroll(View view, View view2, int i, int i2) {
|
||||
return i2 == 0 && onStartNestedScroll(view, view2, i);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.NestedScrollingParent2
|
||||
public void onNestedScrollAccepted(View view, View view2, int i, int i2) {
|
||||
if (i2 == 0) {
|
||||
onNestedScrollAccepted(view, view2, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.NestedScrollingParent2
|
||||
public void onStopNestedScroll(View view, int i) {
|
||||
if (i == 0) {
|
||||
onStopNestedScroll(view);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.NestedScrollingParent2
|
||||
public void onNestedScroll(View view, int i, int i2, int i3, int i4, int i5) {
|
||||
if (i5 == 0) {
|
||||
onNestedScroll(view, i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.NestedScrollingParent2
|
||||
public void onNestedPreScroll(View view, int i, int i2, int[] iArr, int i3) {
|
||||
if (i3 == 0) {
|
||||
onNestedPreScroll(view, i, i2, iArr);
|
||||
}
|
||||
}
|
||||
|
||||
@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.mActionBarTop.getVisibility() != 0) {
|
||||
return false;
|
||||
}
|
||||
return this.mHideOnContentScroll;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public void onNestedScrollAccepted(View view, View view2, int i) {
|
||||
this.mParentHelper.onNestedScrollAccepted(view, view2, i);
|
||||
this.mHideOnContentScrollReference = getActionBarHideOffset();
|
||||
haltActionBarHideOffsetAnimations();
|
||||
ActionBarVisibilityCallback actionBarVisibilityCallback = this.mActionBarVisibilityCallback;
|
||||
if (actionBarVisibilityCallback != null) {
|
||||
actionBarVisibilityCallback.onContentScrollStarted();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public void onNestedScroll(View view, int i, int i2, int i3, int i4) {
|
||||
int i5 = this.mHideOnContentScrollReference + i2;
|
||||
this.mHideOnContentScrollReference = i5;
|
||||
setActionBarHideOffset(i5);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public void onStopNestedScroll(View view) {
|
||||
if (this.mHideOnContentScroll && !this.mAnimatingForFling) {
|
||||
if (this.mHideOnContentScrollReference <= this.mActionBarTop.getHeight()) {
|
||||
postRemoveActionBarHideOffset();
|
||||
} else {
|
||||
postAddActionBarHideOffset();
|
||||
}
|
||||
}
|
||||
ActionBarVisibilityCallback actionBarVisibilityCallback = this.mActionBarVisibilityCallback;
|
||||
if (actionBarVisibilityCallback != null) {
|
||||
actionBarVisibilityCallback.onContentScrollStopped();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
||||
public boolean onNestedFling(View view, float f, float f2, boolean z) {
|
||||
if (!this.mHideOnContentScroll || !z) {
|
||||
return false;
|
||||
}
|
||||
if (shouldHideActionBarOnFling(f2)) {
|
||||
addActionBarHideOffset();
|
||||
} else {
|
||||
removeActionBarHideOffset();
|
||||
}
|
||||
this.mAnimatingForFling = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, androidx.core.view.NestedScrollingParent
|
||||
public int getNestedScrollAxes() {
|
||||
return this.mParentHelper.getNestedScrollAxes();
|
||||
}
|
||||
|
||||
void pullChildren() {
|
||||
if (this.mContent == null) {
|
||||
this.mContent = (ContentFrameLayout) findViewById(R.id.action_bar_activity_content);
|
||||
this.mActionBarTop = (ActionBarContainer) findViewById(R.id.action_bar_container);
|
||||
this.mDecorToolbar = getDecorToolbar(findViewById(R.id.action_bar));
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
private DecorToolbar getDecorToolbar(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());
|
||||
}
|
||||
|
||||
public void setHideOnContentScrollEnabled(boolean z) {
|
||||
if (z != this.mHideOnContentScroll) {
|
||||
this.mHideOnContentScroll = z;
|
||||
if (z) {
|
||||
return;
|
||||
}
|
||||
haltActionBarHideOffsetAnimations();
|
||||
setActionBarHideOffset(0);
|
||||
}
|
||||
}
|
||||
|
||||
public int getActionBarHideOffset() {
|
||||
ActionBarContainer actionBarContainer = this.mActionBarTop;
|
||||
if (actionBarContainer != null) {
|
||||
return -((int) actionBarContainer.getTranslationY());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setActionBarHideOffset(int i) {
|
||||
haltActionBarHideOffsetAnimations();
|
||||
this.mActionBarTop.setTranslationY(-Math.max(0, Math.min(i, this.mActionBarTop.getHeight())));
|
||||
}
|
||||
|
||||
void haltActionBarHideOffsetAnimations() {
|
||||
removeCallbacks(this.mRemoveActionBarHideOffset);
|
||||
removeCallbacks(this.mAddActionBarHideOffset);
|
||||
ViewPropertyAnimator viewPropertyAnimator = this.mCurrentActionBarTopAnimator;
|
||||
if (viewPropertyAnimator != null) {
|
||||
viewPropertyAnimator.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private void postRemoveActionBarHideOffset() {
|
||||
haltActionBarHideOffsetAnimations();
|
||||
postDelayed(this.mRemoveActionBarHideOffset, 600L);
|
||||
}
|
||||
|
||||
private void postAddActionBarHideOffset() {
|
||||
haltActionBarHideOffsetAnimations();
|
||||
postDelayed(this.mAddActionBarHideOffset, 600L);
|
||||
}
|
||||
|
||||
private void removeActionBarHideOffset() {
|
||||
haltActionBarHideOffsetAnimations();
|
||||
this.mRemoveActionBarHideOffset.run();
|
||||
}
|
||||
|
||||
private void addActionBarHideOffset() {
|
||||
haltActionBarHideOffsetAnimations();
|
||||
this.mAddActionBarHideOffset.run();
|
||||
}
|
||||
|
||||
private boolean shouldHideActionBarOnFling(float f) {
|
||||
this.mFlingEstimator.fling(0, 0, 0, (int) f, 0, 0, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||
return this.mFlingEstimator.getFinalY() > this.mActionBarTop.getHeight();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setWindowCallback(Window.Callback callback) {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.setWindowCallback(callback);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setWindowTitle(CharSequence charSequence) {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.setWindowTitle(charSequence);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public CharSequence getTitle() {
|
||||
pullChildren();
|
||||
return this.mDecorToolbar.getTitle();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void initFeature(int i) {
|
||||
pullChildren();
|
||||
if (i == 2) {
|
||||
this.mDecorToolbar.initProgress();
|
||||
} else if (i == 5) {
|
||||
this.mDecorToolbar.initIndeterminateProgress();
|
||||
} else {
|
||||
if (i != 109) {
|
||||
return;
|
||||
}
|
||||
setOverlayMode(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean hasIcon() {
|
||||
pullChildren();
|
||||
return this.mDecorToolbar.hasIcon();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean hasLogo() {
|
||||
pullChildren();
|
||||
return this.mDecorToolbar.hasLogo();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setIcon(int i) {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.setIcon(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setIcon(Drawable drawable) {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.setIcon(drawable);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setLogo(int i) {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.setLogo(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean canShowOverflowMenu() {
|
||||
pullChildren();
|
||||
return this.mDecorToolbar.canShowOverflowMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean isOverflowMenuShowing() {
|
||||
pullChildren();
|
||||
return this.mDecorToolbar.isOverflowMenuShowing();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean isOverflowMenuShowPending() {
|
||||
pullChildren();
|
||||
return this.mDecorToolbar.isOverflowMenuShowPending();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean showOverflowMenu() {
|
||||
pullChildren();
|
||||
return this.mDecorToolbar.showOverflowMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public boolean hideOverflowMenu() {
|
||||
pullChildren();
|
||||
return this.mDecorToolbar.hideOverflowMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setMenuPrepared() {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.setMenuPrepared();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void setMenu(Menu menu, MenuPresenter.Callback callback) {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.setMenu(menu, callback);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void saveToolbarHierarchyState(SparseArray<Parcelable> sparseArray) {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.saveHierarchyState(sparseArray);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void restoreToolbarHierarchyState(SparseArray<Parcelable> sparseArray) {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.restoreHierarchyState(sparseArray);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorContentParent
|
||||
public void dismissPopups() {
|
||||
pullChildren();
|
||||
this.mDecorToolbar.dismissPopupMenus();
|
||||
}
|
||||
|
||||
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 LayoutParams(ViewGroup.MarginLayoutParams marginLayoutParams) {
|
||||
super(marginLayoutParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,705 @@
|
||||
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;
|
||||
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 androidx.core.view.GravityCompat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ActionMenuPresenter extends BaseMenuPresenter implements ActionProvider.SubUiVisibilityListener {
|
||||
private static final String TAG = "ActionMenuPresenter";
|
||||
private final SparseBooleanArray mActionButtonGroups;
|
||||
ActionButtonSubmenu mActionButtonPopup;
|
||||
private int mActionItemWidthLimit;
|
||||
private boolean mExpandedActionViewsExclusive;
|
||||
private int mMaxItems;
|
||||
private boolean mMaxItemsSet;
|
||||
private int mMinCellSize;
|
||||
int mOpenSubMenuId;
|
||||
OverflowMenuButton mOverflowButton;
|
||||
OverflowPopup mOverflowPopup;
|
||||
private Drawable mPendingOverflowIcon;
|
||||
private boolean mPendingOverflowIconSet;
|
||||
private ActionMenuPopupCallback mPopupCallback;
|
||||
final PopupPresenterCallback mPopupPresenterCallback;
|
||||
OpenOverflowRunnable mPostedOpenRunnable;
|
||||
private boolean mReserveOverflow;
|
||||
private boolean mReserveOverflowSet;
|
||||
private boolean mStrictWidthLimit;
|
||||
private int mWidthLimit;
|
||||
private boolean mWidthLimitSet;
|
||||
|
||||
public boolean isOverflowReserved() {
|
||||
return this.mReserveOverflow;
|
||||
}
|
||||
|
||||
public void setExpandedActionViewsExclusive(boolean z) {
|
||||
this.mExpandedActionViewsExclusive = z;
|
||||
}
|
||||
|
||||
public void setItemLimit(int i) {
|
||||
this.mMaxItems = i;
|
||||
this.mMaxItemsSet = true;
|
||||
}
|
||||
|
||||
public void setReserveOverflow(boolean z) {
|
||||
this.mReserveOverflow = z;
|
||||
this.mReserveOverflowSet = true;
|
||||
}
|
||||
|
||||
public void setWidthLimit(int i, boolean z) {
|
||||
this.mWidthLimit = i;
|
||||
this.mStrictWidthLimit = z;
|
||||
this.mWidthLimitSet = true;
|
||||
}
|
||||
|
||||
public ActionMenuPresenter(Context context) {
|
||||
super(context, R.layout.abc_action_menu_layout, R.layout.abc_action_menu_item_layout);
|
||||
this.mActionButtonGroups = new SparseBooleanArray();
|
||||
this.mPopupPresenterCallback = new PopupPresenterCallback();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
||||
public void initForMenu(Context context, MenuBuilder menuBuilder) {
|
||||
super.initForMenu(context, menuBuilder);
|
||||
Resources resources = context.getResources();
|
||||
ActionBarPolicy actionBarPolicy = ActionBarPolicy.get(context);
|
||||
if (!this.mReserveOverflowSet) {
|
||||
this.mReserveOverflow = actionBarPolicy.showsOverflowMenuButton();
|
||||
}
|
||||
if (!this.mWidthLimitSet) {
|
||||
this.mWidthLimit = actionBarPolicy.getEmbeddedMenuWidthLimit();
|
||||
}
|
||||
if (!this.mMaxItemsSet) {
|
||||
this.mMaxItems = actionBarPolicy.getMaxActionButtons();
|
||||
}
|
||||
int i = this.mWidthLimit;
|
||||
if (this.mReserveOverflow) {
|
||||
if (this.mOverflowButton == null) {
|
||||
OverflowMenuButton overflowMenuButton = new OverflowMenuButton(this.mSystemContext);
|
||||
this.mOverflowButton = overflowMenuButton;
|
||||
if (this.mPendingOverflowIconSet) {
|
||||
overflowMenuButton.setImageDrawable(this.mPendingOverflowIcon);
|
||||
this.mPendingOverflowIcon = null;
|
||||
this.mPendingOverflowIconSet = false;
|
||||
}
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
|
||||
this.mOverflowButton.measure(makeMeasureSpec, makeMeasureSpec);
|
||||
}
|
||||
i -= this.mOverflowButton.getMeasuredWidth();
|
||||
} else {
|
||||
this.mOverflowButton = null;
|
||||
}
|
||||
this.mActionItemWidthLimit = i;
|
||||
this.mMinCellSize = (int) (resources.getDisplayMetrics().density * 56.0f);
|
||||
}
|
||||
|
||||
public void onConfigurationChanged(Configuration configuration) {
|
||||
if (!this.mMaxItemsSet) {
|
||||
this.mMaxItems = ActionBarPolicy.get(this.mContext).getMaxActionButtons();
|
||||
}
|
||||
if (this.mMenu != null) {
|
||||
this.mMenu.onItemsChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOverflowIcon(Drawable drawable) {
|
||||
OverflowMenuButton overflowMenuButton = this.mOverflowButton;
|
||||
if (overflowMenuButton != null) {
|
||||
overflowMenuButton.setImageDrawable(drawable);
|
||||
} else {
|
||||
this.mPendingOverflowIconSet = true;
|
||||
this.mPendingOverflowIcon = drawable;
|
||||
}
|
||||
}
|
||||
|
||||
public Drawable getOverflowIcon() {
|
||||
OverflowMenuButton overflowMenuButton = this.mOverflowButton;
|
||||
if (overflowMenuButton != null) {
|
||||
return overflowMenuButton.getDrawable();
|
||||
}
|
||||
if (this.mPendingOverflowIconSet) {
|
||||
return this.mPendingOverflowIcon;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
||||
public MenuView getMenuView(ViewGroup viewGroup) {
|
||||
MenuView menuView = this.mMenuView;
|
||||
MenuView menuView2 = super.getMenuView(viewGroup);
|
||||
if (menuView != menuView2) {
|
||||
((ActionMenuView) menuView2).setPresenter(this);
|
||||
}
|
||||
return menuView2;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
||||
public View getItemView(MenuItemImpl menuItemImpl, View view, ViewGroup viewGroup) {
|
||||
View actionView = menuItemImpl.getActionView();
|
||||
if (actionView == null || menuItemImpl.hasCollapsibleActionView()) {
|
||||
actionView = super.getItemView(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 bindItemView(MenuItemImpl menuItemImpl, MenuView.ItemView itemView) {
|
||||
itemView.initialize(menuItemImpl, 0);
|
||||
ActionMenuItemView actionMenuItemView = (ActionMenuItemView) itemView;
|
||||
actionMenuItemView.setItemInvoker((ActionMenuView) this.mMenuView);
|
||||
if (this.mPopupCallback == null) {
|
||||
this.mPopupCallback = new ActionMenuPopupCallback();
|
||||
}
|
||||
actionMenuItemView.setPopupCallback(this.mPopupCallback);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
||||
public boolean shouldIncludeItem(int i, MenuItemImpl menuItemImpl) {
|
||||
return menuItemImpl.isActionButton();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
||||
public void updateMenuView(boolean z) {
|
||||
int size;
|
||||
super.updateMenuView(z);
|
||||
((View) this.mMenuView).requestLayout();
|
||||
if (this.mMenu != null) {
|
||||
ArrayList<MenuItemImpl> actionItems = this.mMenu.getActionItems();
|
||||
int size2 = actionItems.size();
|
||||
for (int i = 0; i < size2; i++) {
|
||||
ActionProvider supportActionProvider = actionItems.get(i).getSupportActionProvider();
|
||||
if (supportActionProvider != null) {
|
||||
supportActionProvider.setSubUiVisibilityListener(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
ArrayList<MenuItemImpl> nonActionItems = this.mMenu != null ? this.mMenu.getNonActionItems() : null;
|
||||
if (this.mReserveOverflow && nonActionItems != null && ((size = nonActionItems.size()) != 1 ? size > 0 : (!nonActionItems.get(0).isActionViewExpanded()))) {
|
||||
if (this.mOverflowButton == null) {
|
||||
this.mOverflowButton = new OverflowMenuButton(this.mSystemContext);
|
||||
}
|
||||
ViewGroup viewGroup = (ViewGroup) this.mOverflowButton.getParent();
|
||||
if (viewGroup != this.mMenuView) {
|
||||
if (viewGroup != null) {
|
||||
viewGroup.removeView(this.mOverflowButton);
|
||||
}
|
||||
ActionMenuView actionMenuView = (ActionMenuView) this.mMenuView;
|
||||
actionMenuView.addView(this.mOverflowButton, actionMenuView.generateOverflowButtonLayoutParams());
|
||||
}
|
||||
} else {
|
||||
OverflowMenuButton overflowMenuButton = this.mOverflowButton;
|
||||
if (overflowMenuButton != null && overflowMenuButton.getParent() == this.mMenuView) {
|
||||
((ViewGroup) this.mMenuView).removeView(this.mOverflowButton);
|
||||
}
|
||||
}
|
||||
((ActionMenuView) this.mMenuView).setOverflowReserved(this.mReserveOverflow);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
||||
public boolean filterLeftoverView(ViewGroup viewGroup, int i) {
|
||||
if (viewGroup.getChildAt(i) == this.mOverflowButton) {
|
||||
return false;
|
||||
}
|
||||
return super.filterLeftoverView(viewGroup, i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean onSubMenuSelected(SubMenuBuilder subMenuBuilder) {
|
||||
boolean z = false;
|
||||
if (!subMenuBuilder.hasVisibleItems()) {
|
||||
return false;
|
||||
}
|
||||
SubMenuBuilder subMenuBuilder2 = subMenuBuilder;
|
||||
while (subMenuBuilder2.getParentMenu() != this.mMenu) {
|
||||
subMenuBuilder2 = (SubMenuBuilder) subMenuBuilder2.getParentMenu();
|
||||
}
|
||||
View findViewForItem = findViewForItem(subMenuBuilder2.getItem());
|
||||
if (findViewForItem == null) {
|
||||
return false;
|
||||
}
|
||||
this.mOpenSubMenuId = 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++;
|
||||
}
|
||||
ActionButtonSubmenu actionButtonSubmenu = new ActionButtonSubmenu(this.mContext, subMenuBuilder, findViewForItem);
|
||||
this.mActionButtonPopup = actionButtonSubmenu;
|
||||
actionButtonSubmenu.setForceShowIcon(z);
|
||||
this.mActionButtonPopup.show();
|
||||
super.onSubMenuSelected(subMenuBuilder);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
private View findViewForItem(MenuItem menuItem) {
|
||||
ViewGroup viewGroup = (ViewGroup) this.mMenuView;
|
||||
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;
|
||||
}
|
||||
|
||||
public boolean showOverflowMenu() {
|
||||
if (!this.mReserveOverflow || isOverflowMenuShowing() || this.mMenu == null || this.mMenuView == null || this.mPostedOpenRunnable != null || this.mMenu.getNonActionItems().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
this.mPostedOpenRunnable = new OpenOverflowRunnable(new OverflowPopup(this.mContext, this.mMenu, this.mOverflowButton, true));
|
||||
((View) this.mMenuView).post(this.mPostedOpenRunnable);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hideOverflowMenu() {
|
||||
if (this.mPostedOpenRunnable != null && this.mMenuView != null) {
|
||||
((View) this.mMenuView).removeCallbacks(this.mPostedOpenRunnable);
|
||||
this.mPostedOpenRunnable = null;
|
||||
return true;
|
||||
}
|
||||
OverflowPopup overflowPopup = this.mOverflowPopup;
|
||||
if (overflowPopup == null) {
|
||||
return false;
|
||||
}
|
||||
overflowPopup.dismiss();
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean dismissPopupMenus() {
|
||||
return hideOverflowMenu() | hideSubMenus();
|
||||
}
|
||||
|
||||
public boolean hideSubMenus() {
|
||||
ActionButtonSubmenu actionButtonSubmenu = this.mActionButtonPopup;
|
||||
if (actionButtonSubmenu == null) {
|
||||
return false;
|
||||
}
|
||||
actionButtonSubmenu.dismiss();
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isOverflowMenuShowing() {
|
||||
OverflowPopup overflowPopup = this.mOverflowPopup;
|
||||
return overflowPopup != null && overflowPopup.isShowing();
|
||||
}
|
||||
|
||||
public boolean isOverflowMenuShowPending() {
|
||||
return this.mPostedOpenRunnable != null || isOverflowMenuShowing();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
||||
public boolean flagActionItems() {
|
||||
ArrayList<MenuItemImpl> arrayList;
|
||||
int i;
|
||||
int i2;
|
||||
int i3;
|
||||
int i4;
|
||||
ActionMenuPresenter actionMenuPresenter = this;
|
||||
View view = null;
|
||||
int i5 = 0;
|
||||
if (actionMenuPresenter.mMenu != null) {
|
||||
arrayList = actionMenuPresenter.mMenu.getVisibleItems();
|
||||
i = arrayList.size();
|
||||
} else {
|
||||
arrayList = null;
|
||||
i = 0;
|
||||
}
|
||||
int i6 = actionMenuPresenter.mMaxItems;
|
||||
int i7 = actionMenuPresenter.mActionItemWidthLimit;
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
|
||||
ViewGroup viewGroup = (ViewGroup) actionMenuPresenter.mMenuView;
|
||||
boolean z = false;
|
||||
int i8 = 0;
|
||||
int i9 = 0;
|
||||
for (int i10 = 0; i10 < i; i10++) {
|
||||
MenuItemImpl menuItemImpl = arrayList.get(i10);
|
||||
if (menuItemImpl.requiresActionButton()) {
|
||||
i8++;
|
||||
} else if (menuItemImpl.requestsActionButton()) {
|
||||
i9++;
|
||||
} else {
|
||||
z = true;
|
||||
}
|
||||
if (actionMenuPresenter.mExpandedActionViewsExclusive && menuItemImpl.isActionViewExpanded()) {
|
||||
i6 = 0;
|
||||
}
|
||||
}
|
||||
if (actionMenuPresenter.mReserveOverflow && (z || i9 + i8 > i6)) {
|
||||
i6--;
|
||||
}
|
||||
int i11 = i6 - i8;
|
||||
SparseBooleanArray sparseBooleanArray = actionMenuPresenter.mActionButtonGroups;
|
||||
sparseBooleanArray.clear();
|
||||
if (actionMenuPresenter.mStrictWidthLimit) {
|
||||
int i12 = actionMenuPresenter.mMinCellSize;
|
||||
i3 = i7 / i12;
|
||||
i2 = i12 + ((i7 % i12) / i3);
|
||||
} else {
|
||||
i2 = 0;
|
||||
i3 = 0;
|
||||
}
|
||||
int i13 = 0;
|
||||
int i14 = 0;
|
||||
while (i13 < i) {
|
||||
MenuItemImpl menuItemImpl2 = arrayList.get(i13);
|
||||
if (menuItemImpl2.requiresActionButton()) {
|
||||
View itemView = actionMenuPresenter.getItemView(menuItemImpl2, view, viewGroup);
|
||||
if (actionMenuPresenter.mStrictWidthLimit) {
|
||||
i3 -= ActionMenuView.measureChildForCells(itemView, i2, i3, makeMeasureSpec, i5);
|
||||
} else {
|
||||
itemView.measure(makeMeasureSpec, makeMeasureSpec);
|
||||
}
|
||||
int measuredWidth = itemView.getMeasuredWidth();
|
||||
i7 -= measuredWidth;
|
||||
if (i14 == 0) {
|
||||
i14 = measuredWidth;
|
||||
}
|
||||
int groupId = menuItemImpl2.getGroupId();
|
||||
if (groupId != 0) {
|
||||
sparseBooleanArray.put(groupId, true);
|
||||
}
|
||||
menuItemImpl2.setIsActionButton(true);
|
||||
i4 = i;
|
||||
} else if (menuItemImpl2.requestsActionButton()) {
|
||||
int groupId2 = menuItemImpl2.getGroupId();
|
||||
boolean z2 = sparseBooleanArray.get(groupId2);
|
||||
boolean z3 = (i11 > 0 || z2) && i7 > 0 && (!actionMenuPresenter.mStrictWidthLimit || i3 > 0);
|
||||
boolean z4 = z3;
|
||||
i4 = i;
|
||||
if (z3) {
|
||||
View itemView2 = actionMenuPresenter.getItemView(menuItemImpl2, null, viewGroup);
|
||||
if (actionMenuPresenter.mStrictWidthLimit) {
|
||||
int measureChildForCells = ActionMenuView.measureChildForCells(itemView2, i2, i3, makeMeasureSpec, 0);
|
||||
i3 -= measureChildForCells;
|
||||
if (measureChildForCells == 0) {
|
||||
z4 = false;
|
||||
}
|
||||
} else {
|
||||
itemView2.measure(makeMeasureSpec, makeMeasureSpec);
|
||||
}
|
||||
boolean z5 = z4;
|
||||
int measuredWidth2 = itemView2.getMeasuredWidth();
|
||||
i7 -= measuredWidth2;
|
||||
if (i14 == 0) {
|
||||
i14 = measuredWidth2;
|
||||
}
|
||||
z3 = z5 & (!actionMenuPresenter.mStrictWidthLimit ? i7 + i14 <= 0 : i7 < 0);
|
||||
}
|
||||
if (z3 && groupId2 != 0) {
|
||||
sparseBooleanArray.put(groupId2, true);
|
||||
} else if (z2) {
|
||||
sparseBooleanArray.put(groupId2, false);
|
||||
for (int i15 = 0; i15 < i13; i15++) {
|
||||
MenuItemImpl menuItemImpl3 = arrayList.get(i15);
|
||||
if (menuItemImpl3.getGroupId() == groupId2) {
|
||||
if (menuItemImpl3.isActionButton()) {
|
||||
i11++;
|
||||
}
|
||||
menuItemImpl3.setIsActionButton(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (z3) {
|
||||
i11--;
|
||||
}
|
||||
menuItemImpl2.setIsActionButton(z3);
|
||||
} else {
|
||||
i4 = i;
|
||||
menuItemImpl2.setIsActionButton(false);
|
||||
i13++;
|
||||
view = null;
|
||||
actionMenuPresenter = this;
|
||||
i = i4;
|
||||
i5 = 0;
|
||||
}
|
||||
i13++;
|
||||
view = null;
|
||||
actionMenuPresenter = this;
|
||||
i = i4;
|
||||
i5 = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
||||
public void onCloseMenu(MenuBuilder menuBuilder, boolean z) {
|
||||
dismissPopupMenus();
|
||||
super.onCloseMenu(menuBuilder, z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public Parcelable onSaveInstanceState() {
|
||||
SavedState savedState = new SavedState();
|
||||
savedState.openSubMenuId = this.mOpenSubMenuId;
|
||||
return savedState;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter
|
||||
public void onRestoreInstanceState(Parcelable parcelable) {
|
||||
MenuItem findItem;
|
||||
if (parcelable instanceof SavedState) {
|
||||
SavedState savedState = (SavedState) parcelable;
|
||||
if (savedState.openSubMenuId <= 0 || (findItem = this.mMenu.findItem(savedState.openSubMenuId)) == null) {
|
||||
return;
|
||||
}
|
||||
onSubMenuSelected((SubMenuBuilder) findItem.getSubMenu());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ActionProvider.SubUiVisibilityListener
|
||||
public void onSubUiVisibilityChanged(boolean z) {
|
||||
if (z) {
|
||||
super.onSubMenuSelected(null);
|
||||
} else if (this.mMenu != null) {
|
||||
this.mMenu.close(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void setMenuView(ActionMenuView actionMenuView) {
|
||||
this.mMenuView = actionMenuView;
|
||||
actionMenuView.initialize(this.mMenu);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
SavedState() {
|
||||
}
|
||||
|
||||
SavedState(Parcel parcel) {
|
||||
this.openSubMenuId = parcel.readInt();
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeInt(this.openSubMenuId);
|
||||
}
|
||||
}
|
||||
|
||||
private class OverflowMenuButton extends AppCompatImageView implements ActionMenuView.ActionMenuChildView {
|
||||
@Override // androidx.appcompat.widget.ActionMenuView.ActionMenuChildView
|
||||
public boolean needsDividerAfter() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ActionMenuView.ActionMenuChildView
|
||||
public boolean needsDividerBefore() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public OverflowMenuButton(Context context) {
|
||||
super(context, null, R.attr.actionOverflowButtonStyle);
|
||||
setClickable(true);
|
||||
setFocusable(true);
|
||||
setVisibility(0);
|
||||
setEnabled(true);
|
||||
TooltipCompat.setTooltipText(this, getContentDescription());
|
||||
setOnTouchListener(new ForwardingListener(this) { // from class: androidx.appcompat.widget.ActionMenuPresenter.OverflowMenuButton.1
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
public ShowableListMenu getPopup() {
|
||||
if (ActionMenuPresenter.this.mOverflowPopup == null) {
|
||||
return null;
|
||||
}
|
||||
return ActionMenuPresenter.this.mOverflowPopup.getPopup();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
public boolean onForwardingStarted() {
|
||||
ActionMenuPresenter.this.showOverflowMenu();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
public boolean onForwardingStopped() {
|
||||
if (ActionMenuPresenter.this.mPostedOpenRunnable != null) {
|
||||
return false;
|
||||
}
|
||||
ActionMenuPresenter.this.hideOverflowMenu();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean performClick() {
|
||||
if (super.performClick()) {
|
||||
return true;
|
||||
}
|
||||
playSoundEffect(0);
|
||||
ActionMenuPresenter.this.showOverflowMenu();
|
||||
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.setHotspotBounds(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);
|
||||
setGravity(GravityCompat.END);
|
||||
setPresenterCallback(ActionMenuPresenter.this.mPopupPresenterCallback);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopupHelper
|
||||
protected void onDismiss() {
|
||||
if (ActionMenuPresenter.this.mMenu != null) {
|
||||
ActionMenuPresenter.this.mMenu.close();
|
||||
}
|
||||
ActionMenuPresenter.this.mOverflowPopup = null;
|
||||
super.onDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
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()).isActionButton()) {
|
||||
setAnchorView(ActionMenuPresenter.this.mOverflowButton == null ? (View) ActionMenuPresenter.this.mMenuView : ActionMenuPresenter.this.mOverflowButton);
|
||||
}
|
||||
setPresenterCallback(ActionMenuPresenter.this.mPopupPresenterCallback);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPopupHelper
|
||||
protected void onDismiss() {
|
||||
ActionMenuPresenter.this.mActionButtonPopup = null;
|
||||
ActionMenuPresenter.this.mOpenSubMenuId = 0;
|
||||
super.onDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
private class PopupPresenterCallback implements MenuPresenter.Callback {
|
||||
PopupPresenterCallback() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
||||
public boolean onOpenSubMenu(MenuBuilder menuBuilder) {
|
||||
if (menuBuilder == ActionMenuPresenter.this.mMenu) {
|
||||
return false;
|
||||
}
|
||||
ActionMenuPresenter.this.mOpenSubMenuId = ((SubMenuBuilder) menuBuilder).getItem().getItemId();
|
||||
MenuPresenter.Callback callback = ActionMenuPresenter.this.getCallback();
|
||||
if (callback != null) {
|
||||
return callback.onOpenSubMenu(menuBuilder);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
||||
public void onCloseMenu(MenuBuilder menuBuilder, boolean z) {
|
||||
if (menuBuilder instanceof SubMenuBuilder) {
|
||||
menuBuilder.getRootMenu().close(false);
|
||||
}
|
||||
MenuPresenter.Callback callback = ActionMenuPresenter.this.getCallback();
|
||||
if (callback != null) {
|
||||
callback.onCloseMenu(menuBuilder, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class OpenOverflowRunnable implements Runnable {
|
||||
private OverflowPopup mPopup;
|
||||
|
||||
public OpenOverflowRunnable(OverflowPopup overflowPopup) {
|
||||
this.mPopup = overflowPopup;
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
if (ActionMenuPresenter.this.mMenu != null) {
|
||||
ActionMenuPresenter.this.mMenu.changeMenuMode();
|
||||
}
|
||||
View view = (View) ActionMenuPresenter.this.mMenuView;
|
||||
if (view != null && view.getWindowToken() != null && this.mPopup.tryShow()) {
|
||||
ActionMenuPresenter.this.mOverflowPopup = this.mPopup;
|
||||
}
|
||||
ActionMenuPresenter.this.mPostedOpenRunnable = null;
|
||||
}
|
||||
}
|
||||
|
||||
private class ActionMenuPopupCallback extends ActionMenuItemView.PopupCallback {
|
||||
ActionMenuPopupCallback() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ActionMenuItemView.PopupCallback
|
||||
public ShowableListMenu getPopup() {
|
||||
if (ActionMenuPresenter.this.mActionButtonPopup != null) {
|
||||
return ActionMenuPresenter.this.mActionButtonPopup.getPopup();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,680 @@
|
||||
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;
|
||||
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActionMenuView extends LinearLayoutCompat implements MenuBuilder.ItemInvoker, MenuView {
|
||||
static final int GENERATED_ITEM_PADDING = 4;
|
||||
static final int MIN_CELL_SIZE = 56;
|
||||
private static final String TAG = "ActionMenuView";
|
||||
private MenuPresenter.Callback mActionMenuPresenterCallback;
|
||||
private boolean mFormatItems;
|
||||
private int mFormatItemsWidth;
|
||||
private int mGeneratedItemPadding;
|
||||
private MenuBuilder mMenu;
|
||||
MenuBuilder.Callback mMenuBuilderCallback;
|
||||
private int mMinCellSize;
|
||||
OnMenuItemClickListener mOnMenuItemClickListener;
|
||||
private Context mPopupContext;
|
||||
private int mPopupTheme;
|
||||
private ActionMenuPresenter mPresenter;
|
||||
private boolean mReserveOverflow;
|
||||
|
||||
public interface ActionMenuChildView {
|
||||
boolean needsDividerAfter();
|
||||
|
||||
boolean needsDividerBefore();
|
||||
}
|
||||
|
||||
public interface OnMenuItemClickListener {
|
||||
boolean onMenuItemClick(MenuItem menuItem);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getPopupTheme() {
|
||||
return this.mPopupTheme;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView
|
||||
public int getWindowAnimations() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuView
|
||||
public void initialize(MenuBuilder menuBuilder) {
|
||||
this.mMenu = menuBuilder;
|
||||
}
|
||||
|
||||
public boolean isOverflowReserved() {
|
||||
return this.mReserveOverflow;
|
||||
}
|
||||
|
||||
public MenuBuilder peekMenu() {
|
||||
return this.mMenu;
|
||||
}
|
||||
|
||||
public void setMenuCallbacks(MenuPresenter.Callback callback, MenuBuilder.Callback callback2) {
|
||||
this.mActionMenuPresenterCallback = callback;
|
||||
this.mMenuBuilderCallback = callback2;
|
||||
}
|
||||
|
||||
public void setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener) {
|
||||
this.mOnMenuItemClickListener = onMenuItemClickListener;
|
||||
}
|
||||
|
||||
public void setOverflowReserved(boolean z) {
|
||||
this.mReserveOverflow = z;
|
||||
}
|
||||
|
||||
public ActionMenuView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ActionMenuView(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
setBaselineAligned(false);
|
||||
float f = context.getResources().getDisplayMetrics().density;
|
||||
this.mMinCellSize = (int) (56.0f * f);
|
||||
this.mGeneratedItemPadding = (int) (f * 4.0f);
|
||||
this.mPopupContext = context;
|
||||
this.mPopupTheme = 0;
|
||||
}
|
||||
|
||||
public void setPopupTheme(int i) {
|
||||
if (this.mPopupTheme != i) {
|
||||
this.mPopupTheme = i;
|
||||
if (i == 0) {
|
||||
this.mPopupContext = getContext();
|
||||
} else {
|
||||
this.mPopupContext = new ContextThemeWrapper(getContext(), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setPresenter(ActionMenuPresenter actionMenuPresenter) {
|
||||
this.mPresenter = actionMenuPresenter;
|
||||
actionMenuPresenter.setMenuView(this);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onConfigurationChanged(Configuration configuration) {
|
||||
super.onConfigurationChanged(configuration);
|
||||
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
||||
if (actionMenuPresenter != null) {
|
||||
actionMenuPresenter.updateMenuView(false);
|
||||
if (this.mPresenter.isOverflowMenuShowing()) {
|
||||
this.mPresenter.hideOverflowMenu();
|
||||
this.mPresenter.showOverflowMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
MenuBuilder menuBuilder;
|
||||
boolean z = this.mFormatItems;
|
||||
boolean z2 = View.MeasureSpec.getMode(i) == 1073741824;
|
||||
this.mFormatItems = z2;
|
||||
if (z != z2) {
|
||||
this.mFormatItemsWidth = 0;
|
||||
}
|
||||
int size = View.MeasureSpec.getSize(i);
|
||||
if (this.mFormatItems && (menuBuilder = this.mMenu) != null && size != this.mFormatItemsWidth) {
|
||||
this.mFormatItemsWidth = size;
|
||||
menuBuilder.onItemsChanged(true);
|
||||
}
|
||||
int childCount = getChildCount();
|
||||
if (this.mFormatItems && childCount > 0) {
|
||||
onMeasureExactFormat(i, i2);
|
||||
return;
|
||||
}
|
||||
for (int i3 = 0; i3 < childCount; i3++) {
|
||||
LayoutParams layoutParams = (LayoutParams) getChildAt(i3).getLayoutParams();
|
||||
layoutParams.rightMargin = 0;
|
||||
layoutParams.leftMargin = 0;
|
||||
}
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
|
||||
/* JADX WARN: Type inference failed for: r14v12 */
|
||||
/* JADX WARN: Type inference failed for: r14v8 */
|
||||
/* JADX WARN: Type inference failed for: r14v9, types: [boolean, int] */
|
||||
private void onMeasureExactFormat(int i, int i2) {
|
||||
int i3;
|
||||
int i4;
|
||||
boolean z;
|
||||
int i5;
|
||||
boolean z2;
|
||||
boolean z3;
|
||||
int i6;
|
||||
?? r14;
|
||||
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 = getChildMeasureSpec(i2, paddingTop, -2);
|
||||
int i7 = size - paddingLeft;
|
||||
int i8 = this.mMinCellSize;
|
||||
int i9 = i7 / i8;
|
||||
int i10 = i7 % i8;
|
||||
if (i9 == 0) {
|
||||
setMeasuredDimension(i7, 0);
|
||||
return;
|
||||
}
|
||||
int i11 = i8 + (i10 / i9);
|
||||
int childCount = getChildCount();
|
||||
int i12 = 0;
|
||||
int i13 = 0;
|
||||
boolean z4 = false;
|
||||
int i14 = 0;
|
||||
int i15 = 0;
|
||||
int i16 = 0;
|
||||
long j = 0;
|
||||
while (i13 < childCount) {
|
||||
View childAt = getChildAt(i13);
|
||||
int i17 = size2;
|
||||
if (childAt.getVisibility() != 8) {
|
||||
boolean z5 = childAt instanceof ActionMenuItemView;
|
||||
int i18 = i14 + 1;
|
||||
if (z5) {
|
||||
int i19 = this.mGeneratedItemPadding;
|
||||
i6 = i18;
|
||||
r14 = 0;
|
||||
childAt.setPadding(i19, 0, i19, 0);
|
||||
} else {
|
||||
i6 = i18;
|
||||
r14 = 0;
|
||||
}
|
||||
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
||||
layoutParams.expanded = r14;
|
||||
layoutParams.extraPixels = r14;
|
||||
layoutParams.cellsUsed = r14;
|
||||
layoutParams.expandable = r14;
|
||||
layoutParams.leftMargin = r14;
|
||||
layoutParams.rightMargin = r14;
|
||||
layoutParams.preventEdgeOffset = z5 && ((ActionMenuItemView) childAt).hasText();
|
||||
int measureChildForCells = measureChildForCells(childAt, i11, layoutParams.isOverflowButton ? 1 : i9, childMeasureSpec, paddingTop);
|
||||
i15 = Math.max(i15, measureChildForCells);
|
||||
if (layoutParams.expandable) {
|
||||
i16++;
|
||||
}
|
||||
if (layoutParams.isOverflowButton) {
|
||||
z4 = true;
|
||||
}
|
||||
i9 -= measureChildForCells;
|
||||
i12 = Math.max(i12, childAt.getMeasuredHeight());
|
||||
if (measureChildForCells == 1) {
|
||||
j |= 1 << i13;
|
||||
i12 = i12;
|
||||
}
|
||||
i14 = i6;
|
||||
}
|
||||
i13++;
|
||||
size2 = i17;
|
||||
}
|
||||
int i20 = size2;
|
||||
boolean z6 = z4 && i14 == 2;
|
||||
boolean z7 = false;
|
||||
while (i16 > 0 && i9 > 0) {
|
||||
int i21 = 0;
|
||||
int i22 = 0;
|
||||
int i23 = Integer.MAX_VALUE;
|
||||
long j2 = 0;
|
||||
while (i22 < childCount) {
|
||||
boolean z8 = z7;
|
||||
LayoutParams layoutParams2 = (LayoutParams) getChildAt(i22).getLayoutParams();
|
||||
int i24 = i12;
|
||||
if (layoutParams2.expandable) {
|
||||
if (layoutParams2.cellsUsed < i23) {
|
||||
i23 = layoutParams2.cellsUsed;
|
||||
j2 = 1 << i22;
|
||||
i21 = 1;
|
||||
} else if (layoutParams2.cellsUsed == i23) {
|
||||
i21++;
|
||||
j2 |= 1 << i22;
|
||||
}
|
||||
}
|
||||
i22++;
|
||||
i12 = i24;
|
||||
z7 = z8;
|
||||
}
|
||||
z = z7;
|
||||
i5 = i12;
|
||||
j |= j2;
|
||||
if (i21 > i9) {
|
||||
i3 = mode;
|
||||
i4 = i7;
|
||||
break;
|
||||
}
|
||||
int i25 = i23 + 1;
|
||||
int i26 = 0;
|
||||
while (i26 < childCount) {
|
||||
View childAt2 = getChildAt(i26);
|
||||
LayoutParams layoutParams3 = (LayoutParams) childAt2.getLayoutParams();
|
||||
int i27 = i7;
|
||||
int i28 = mode;
|
||||
long j3 = 1 << i26;
|
||||
if ((j2 & j3) == 0) {
|
||||
if (layoutParams3.cellsUsed == i25) {
|
||||
j |= j3;
|
||||
}
|
||||
z3 = z6;
|
||||
} else {
|
||||
if (z6 && layoutParams3.preventEdgeOffset && i9 == 1) {
|
||||
int i29 = this.mGeneratedItemPadding;
|
||||
z3 = z6;
|
||||
childAt2.setPadding(i29 + i11, 0, i29, 0);
|
||||
} else {
|
||||
z3 = z6;
|
||||
}
|
||||
layoutParams3.cellsUsed++;
|
||||
layoutParams3.expanded = true;
|
||||
i9--;
|
||||
}
|
||||
i26++;
|
||||
mode = i28;
|
||||
i7 = i27;
|
||||
z6 = z3;
|
||||
}
|
||||
i12 = i5;
|
||||
z7 = true;
|
||||
}
|
||||
i3 = mode;
|
||||
i4 = i7;
|
||||
z = z7;
|
||||
i5 = i12;
|
||||
boolean z9 = !z4 && i14 == 1;
|
||||
if (i9 <= 0 || j == 0 || (i9 >= i14 - 1 && !z9 && i15 <= 1)) {
|
||||
z2 = z;
|
||||
} else {
|
||||
float bitCount = Long.bitCount(j);
|
||||
if (!z9) {
|
||||
if ((j & 1) != 0 && !((LayoutParams) getChildAt(0).getLayoutParams()).preventEdgeOffset) {
|
||||
bitCount -= 0.5f;
|
||||
}
|
||||
int i30 = childCount - 1;
|
||||
if ((j & (1 << i30)) != 0 && !((LayoutParams) getChildAt(i30).getLayoutParams()).preventEdgeOffset) {
|
||||
bitCount -= 0.5f;
|
||||
}
|
||||
}
|
||||
int i31 = bitCount > 0.0f ? (int) ((i9 * i11) / bitCount) : 0;
|
||||
z2 = z;
|
||||
for (int i32 = 0; i32 < childCount; i32++) {
|
||||
if ((j & (1 << i32)) != 0) {
|
||||
View childAt3 = getChildAt(i32);
|
||||
LayoutParams layoutParams4 = (LayoutParams) childAt3.getLayoutParams();
|
||||
if (childAt3 instanceof ActionMenuItemView) {
|
||||
layoutParams4.extraPixels = i31;
|
||||
layoutParams4.expanded = true;
|
||||
if (i32 == 0 && !layoutParams4.preventEdgeOffset) {
|
||||
layoutParams4.leftMargin = (-i31) / 2;
|
||||
}
|
||||
} else if (layoutParams4.isOverflowButton) {
|
||||
layoutParams4.extraPixels = i31;
|
||||
layoutParams4.expanded = true;
|
||||
layoutParams4.rightMargin = (-i31) / 2;
|
||||
} else {
|
||||
if (i32 != 0) {
|
||||
layoutParams4.leftMargin = i31 / 2;
|
||||
}
|
||||
if (i32 != childCount - 1) {
|
||||
layoutParams4.rightMargin = i31 / 2;
|
||||
}
|
||||
}
|
||||
z2 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (z2) {
|
||||
for (int i33 = 0; i33 < childCount; i33++) {
|
||||
View childAt4 = getChildAt(i33);
|
||||
LayoutParams layoutParams5 = (LayoutParams) childAt4.getLayoutParams();
|
||||
if (layoutParams5.expanded) {
|
||||
childAt4.measure(View.MeasureSpec.makeMeasureSpec((layoutParams5.cellsUsed * i11) + layoutParams5.extraPixels, BasicMeasure.EXACTLY), childMeasureSpec);
|
||||
}
|
||||
}
|
||||
}
|
||||
setMeasuredDimension(i4, i3 != 1073741824 ? i5 : i20);
|
||||
}
|
||||
|
||||
static int measureChildForCells(View view, int i, int i2, int i3, int i4) {
|
||||
int i5;
|
||||
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.hasText();
|
||||
if (i2 > 0) {
|
||||
i5 = 2;
|
||||
if (!z || i2 >= 2) {
|
||||
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.expandable = layoutParams.isOverflowButton && z;
|
||||
layoutParams.cellsUsed = i5;
|
||||
view.measure(View.MeasureSpec.makeMeasureSpec(i * i5, BasicMeasure.EXACTLY), makeMeasureSpec);
|
||||
return i5;
|
||||
}
|
||||
}
|
||||
i5 = 0;
|
||||
layoutParams.expandable = layoutParams.isOverflowButton && z;
|
||||
layoutParams.cellsUsed = i5;
|
||||
view.measure(View.MeasureSpec.makeMeasureSpec(i * i5, BasicMeasure.EXACTLY), makeMeasureSpec);
|
||||
return i5;
|
||||
}
|
||||
|
||||
@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 width;
|
||||
int i5;
|
||||
if (!this.mFormatItems) {
|
||||
super.onLayout(z, i, i2, i3, i4);
|
||||
return;
|
||||
}
|
||||
int childCount = getChildCount();
|
||||
int i6 = (i4 - i2) / 2;
|
||||
int dividerWidth = getDividerWidth();
|
||||
int i7 = i3 - i;
|
||||
int paddingRight = (i7 - getPaddingRight()) - getPaddingLeft();
|
||||
boolean isLayoutRtl = ViewUtils.isLayoutRtl(this);
|
||||
int i8 = 0;
|
||||
int i9 = 0;
|
||||
for (int i10 = 0; i10 < childCount; i10++) {
|
||||
View childAt = getChildAt(i10);
|
||||
if (childAt.getVisibility() != 8) {
|
||||
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
||||
if (layoutParams.isOverflowButton) {
|
||||
int measuredWidth = childAt.getMeasuredWidth();
|
||||
if (hasSupportDividerBeforeChildAt(i10)) {
|
||||
measuredWidth += dividerWidth;
|
||||
}
|
||||
int measuredHeight = childAt.getMeasuredHeight();
|
||||
if (isLayoutRtl) {
|
||||
i5 = getPaddingLeft() + layoutParams.leftMargin;
|
||||
width = i5 + measuredWidth;
|
||||
} else {
|
||||
width = (getWidth() - getPaddingRight()) - layoutParams.rightMargin;
|
||||
i5 = width - measuredWidth;
|
||||
}
|
||||
int i11 = i6 - (measuredHeight / 2);
|
||||
childAt.layout(i5, i11, width, measuredHeight + i11);
|
||||
paddingRight -= measuredWidth;
|
||||
i8 = 1;
|
||||
} else {
|
||||
paddingRight -= (childAt.getMeasuredWidth() + layoutParams.leftMargin) + layoutParams.rightMargin;
|
||||
hasSupportDividerBeforeChildAt(i10);
|
||||
i9++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (childCount == 1 && i8 == 0) {
|
||||
View childAt2 = getChildAt(0);
|
||||
int measuredWidth2 = childAt2.getMeasuredWidth();
|
||||
int measuredHeight2 = childAt2.getMeasuredHeight();
|
||||
int i12 = (i7 / 2) - (measuredWidth2 / 2);
|
||||
int i13 = i6 - (measuredHeight2 / 2);
|
||||
childAt2.layout(i12, i13, measuredWidth2 + i12, measuredHeight2 + i13);
|
||||
return;
|
||||
}
|
||||
int i14 = i9 - (i8 ^ 1);
|
||||
int max = Math.max(0, i14 > 0 ? paddingRight / i14 : 0);
|
||||
if (isLayoutRtl) {
|
||||
int width2 = getWidth() - getPaddingRight();
|
||||
for (int i15 = 0; i15 < childCount; i15++) {
|
||||
View childAt3 = getChildAt(i15);
|
||||
LayoutParams layoutParams2 = (LayoutParams) childAt3.getLayoutParams();
|
||||
if (childAt3.getVisibility() != 8 && !layoutParams2.isOverflowButton) {
|
||||
int i16 = width2 - layoutParams2.rightMargin;
|
||||
int measuredWidth3 = childAt3.getMeasuredWidth();
|
||||
int measuredHeight3 = childAt3.getMeasuredHeight();
|
||||
int i17 = i6 - (measuredHeight3 / 2);
|
||||
childAt3.layout(i16 - measuredWidth3, i17, i16, measuredHeight3 + i17);
|
||||
width2 = i16 - ((measuredWidth3 + layoutParams2.leftMargin) + max);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
int paddingLeft = getPaddingLeft();
|
||||
for (int i18 = 0; i18 < childCount; i18++) {
|
||||
View childAt4 = getChildAt(i18);
|
||||
LayoutParams layoutParams3 = (LayoutParams) childAt4.getLayoutParams();
|
||||
if (childAt4.getVisibility() != 8 && !layoutParams3.isOverflowButton) {
|
||||
int i19 = paddingLeft + layoutParams3.leftMargin;
|
||||
int measuredWidth4 = childAt4.getMeasuredWidth();
|
||||
int measuredHeight4 = childAt4.getMeasuredHeight();
|
||||
int i20 = i6 - (measuredHeight4 / 2);
|
||||
childAt4.layout(i19, i20, i19 + measuredWidth4, measuredHeight4 + i20);
|
||||
paddingLeft = i19 + measuredWidth4 + layoutParams3.rightMargin + max;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
dismissPopupMenus();
|
||||
}
|
||||
|
||||
public void setOverflowIcon(Drawable drawable) {
|
||||
getMenu();
|
||||
this.mPresenter.setOverflowIcon(drawable);
|
||||
}
|
||||
|
||||
public Drawable getOverflowIcon() {
|
||||
getMenu();
|
||||
return this.mPresenter.getOverflowIcon();
|
||||
}
|
||||
|
||||
/* 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.gravity = 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) {
|
||||
LayoutParams layoutParams2;
|
||||
if (layoutParams != null) {
|
||||
if (layoutParams instanceof LayoutParams) {
|
||||
layoutParams2 = new LayoutParams((LayoutParams) layoutParams);
|
||||
} else {
|
||||
layoutParams2 = new LayoutParams(layoutParams);
|
||||
}
|
||||
if (layoutParams2.gravity <= 0) {
|
||||
layoutParams2.gravity = 16;
|
||||
}
|
||||
return layoutParams2;
|
||||
}
|
||||
return generateDefaultLayoutParams();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
|
||||
protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
return layoutParams instanceof LayoutParams;
|
||||
}
|
||||
|
||||
public LayoutParams generateOverflowButtonLayoutParams() {
|
||||
LayoutParams generateDefaultLayoutParams = generateDefaultLayoutParams();
|
||||
generateDefaultLayoutParams.isOverflowButton = true;
|
||||
return generateDefaultLayoutParams;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder.ItemInvoker
|
||||
public boolean invokeItem(MenuItemImpl menuItemImpl) {
|
||||
return this.mMenu.performItemAction(menuItemImpl, 0);
|
||||
}
|
||||
|
||||
public Menu getMenu() {
|
||||
if (this.mMenu == null) {
|
||||
Context context = getContext();
|
||||
MenuBuilder menuBuilder = new MenuBuilder(context);
|
||||
this.mMenu = menuBuilder;
|
||||
menuBuilder.setCallback(new MenuBuilderCallback());
|
||||
ActionMenuPresenter actionMenuPresenter = new ActionMenuPresenter(context);
|
||||
this.mPresenter = actionMenuPresenter;
|
||||
actionMenuPresenter.setReserveOverflow(true);
|
||||
ActionMenuPresenter actionMenuPresenter2 = this.mPresenter;
|
||||
MenuPresenter.Callback callback = this.mActionMenuPresenterCallback;
|
||||
if (callback == null) {
|
||||
callback = new ActionMenuPresenterCallback();
|
||||
}
|
||||
actionMenuPresenter2.setCallback(callback);
|
||||
this.mMenu.addMenuPresenter(this.mPresenter, this.mPopupContext);
|
||||
this.mPresenter.setMenuView(this);
|
||||
}
|
||||
return this.mMenu;
|
||||
}
|
||||
|
||||
public boolean showOverflowMenu() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
||||
return actionMenuPresenter != null && actionMenuPresenter.showOverflowMenu();
|
||||
}
|
||||
|
||||
public boolean hideOverflowMenu() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
||||
return actionMenuPresenter != null && actionMenuPresenter.hideOverflowMenu();
|
||||
}
|
||||
|
||||
public boolean isOverflowMenuShowing() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
||||
return actionMenuPresenter != null && actionMenuPresenter.isOverflowMenuShowing();
|
||||
}
|
||||
|
||||
public boolean isOverflowMenuShowPending() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
||||
return actionMenuPresenter != null && actionMenuPresenter.isOverflowMenuShowPending();
|
||||
}
|
||||
|
||||
public void dismissPopupMenus() {
|
||||
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
||||
if (actionMenuPresenter != null) {
|
||||
actionMenuPresenter.dismissPopupMenus();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean hasSupportDividerBeforeChildAt(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 = ((ActionMenuChildView) childAt).needsDividerAfter();
|
||||
}
|
||||
return (i <= 0 || !(childAt2 instanceof ActionMenuChildView)) ? z : z | ((ActionMenuChildView) childAt2).needsDividerBefore();
|
||||
}
|
||||
|
||||
public void setExpandedActionViewsExclusive(boolean z) {
|
||||
this.mPresenter.setExpandedActionViewsExclusive(z);
|
||||
}
|
||||
|
||||
private class MenuBuilderCallback implements MenuBuilder.Callback {
|
||||
MenuBuilderCallback() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
||||
public boolean onMenuItemSelected(MenuBuilder menuBuilder, MenuItem menuItem) {
|
||||
return ActionMenuView.this.mOnMenuItemClickListener != null && ActionMenuView.this.mOnMenuItemClickListener.onMenuItemClick(menuItem);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
||||
public void onMenuModeChange(MenuBuilder menuBuilder) {
|
||||
if (ActionMenuView.this.mMenuBuilderCallback != null) {
|
||||
ActionMenuView.this.mMenuBuilderCallback.onMenuModeChange(menuBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class ActionMenuPresenterCallback implements MenuPresenter.Callback {
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
||||
public void onCloseMenu(MenuBuilder menuBuilder, boolean z) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
||||
public boolean onOpenSubMenu(MenuBuilder menuBuilder) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ActionMenuPresenterCallback() {
|
||||
}
|
||||
}
|
||||
|
||||
public static class LayoutParams extends LinearLayoutCompat.LayoutParams {
|
||||
|
||||
@ViewDebug.ExportedProperty
|
||||
public int cellsUsed;
|
||||
|
||||
@ViewDebug.ExportedProperty
|
||||
public boolean expandable;
|
||||
boolean expanded;
|
||||
|
||||
@ViewDebug.ExportedProperty
|
||||
public int extraPixels;
|
||||
|
||||
@ViewDebug.ExportedProperty
|
||||
public boolean isOverflowButton;
|
||||
|
||||
@ViewDebug.ExportedProperty
|
||||
public boolean preventEdgeOffset;
|
||||
|
||||
public LayoutParams(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
super(layoutParams);
|
||||
}
|
||||
|
||||
public LayoutParams(LayoutParams layoutParams) {
|
||||
super((ViewGroup.LayoutParams) layoutParams);
|
||||
this.isOverflowButton = layoutParams.isOverflowButton;
|
||||
}
|
||||
|
||||
public LayoutParams(int i, int i2) {
|
||||
super(i, i2);
|
||||
this.isOverflowButton = false;
|
||||
}
|
||||
|
||||
LayoutParams(int i, int i2, boolean z) {
|
||||
super(i, i2);
|
||||
this.isOverflowButton = z;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,504 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.database.DataSetObservable;
|
||||
import android.os.AsyncTask;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.Xml;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ActivityChooserModel extends DataSetObservable {
|
||||
static final String ATTRIBUTE_ACTIVITY = "activity";
|
||||
static final String ATTRIBUTE_TIME = "time";
|
||||
static final String ATTRIBUTE_WEIGHT = "weight";
|
||||
static final boolean DEBUG = false;
|
||||
private static final int DEFAULT_ACTIVITY_INFLATION = 5;
|
||||
private static final float DEFAULT_HISTORICAL_RECORD_WEIGHT = 1.0f;
|
||||
public static final String DEFAULT_HISTORY_FILE_NAME = "activity_choser_model_history.xml";
|
||||
public static final int DEFAULT_HISTORY_MAX_LENGTH = 50;
|
||||
private static final String HISTORY_FILE_EXTENSION = ".xml";
|
||||
private static final int INVALID_INDEX = -1;
|
||||
static final String LOG_TAG = "ActivityChooserModel";
|
||||
static final String TAG_HISTORICAL_RECORD = "historical-record";
|
||||
static final String TAG_HISTORICAL_RECORDS = "historical-records";
|
||||
private OnChooseActivityListener mActivityChoserModelPolicy;
|
||||
final Context mContext;
|
||||
final String mHistoryFileName;
|
||||
private Intent mIntent;
|
||||
private static final Object sRegistryLock = new Object();
|
||||
private static final Map<String, ActivityChooserModel> sDataModelRegistry = new HashMap();
|
||||
private final Object mInstanceLock = new Object();
|
||||
private final List<ActivityResolveInfo> mActivities = new ArrayList();
|
||||
private final List<HistoricalRecord> mHistoricalRecords = new ArrayList();
|
||||
private ActivitySorter mActivitySorter = new DefaultSorter();
|
||||
private int mHistoryMaxSize = 50;
|
||||
boolean mCanReadHistoricalData = true;
|
||||
private boolean mReadShareHistoryCalled = false;
|
||||
private boolean mHistoricalRecordsChanged = true;
|
||||
private boolean mReloadActivities = false;
|
||||
|
||||
public interface ActivityChooserModelClient {
|
||||
void setActivityChooserModel(ActivityChooserModel activityChooserModel);
|
||||
}
|
||||
|
||||
public interface ActivitySorter {
|
||||
void sort(Intent intent, List<ActivityResolveInfo> list, List<HistoricalRecord> list2);
|
||||
}
|
||||
|
||||
public interface OnChooseActivityListener {
|
||||
boolean onChooseActivity(ActivityChooserModel activityChooserModel, Intent intent);
|
||||
}
|
||||
|
||||
public static ActivityChooserModel get(Context context, String str) {
|
||||
ActivityChooserModel activityChooserModel;
|
||||
synchronized (sRegistryLock) {
|
||||
Map<String, ActivityChooserModel> map = sDataModelRegistry;
|
||||
activityChooserModel = map.get(str);
|
||||
if (activityChooserModel == null) {
|
||||
activityChooserModel = new ActivityChooserModel(context, str);
|
||||
map.put(str, activityChooserModel);
|
||||
}
|
||||
}
|
||||
return activityChooserModel;
|
||||
}
|
||||
|
||||
private ActivityChooserModel(Context context, String str) {
|
||||
this.mContext = context.getApplicationContext();
|
||||
if (TextUtils.isEmpty(str) || str.endsWith(HISTORY_FILE_EXTENSION)) {
|
||||
this.mHistoryFileName = str;
|
||||
return;
|
||||
}
|
||||
this.mHistoryFileName = str + HISTORY_FILE_EXTENSION;
|
||||
}
|
||||
|
||||
public void setIntent(Intent intent) {
|
||||
synchronized (this.mInstanceLock) {
|
||||
if (this.mIntent == intent) {
|
||||
return;
|
||||
}
|
||||
this.mIntent = intent;
|
||||
this.mReloadActivities = true;
|
||||
ensureConsistentState();
|
||||
}
|
||||
}
|
||||
|
||||
public Intent getIntent() {
|
||||
Intent intent;
|
||||
synchronized (this.mInstanceLock) {
|
||||
intent = this.mIntent;
|
||||
}
|
||||
return intent;
|
||||
}
|
||||
|
||||
public int getActivityCount() {
|
||||
int size;
|
||||
synchronized (this.mInstanceLock) {
|
||||
ensureConsistentState();
|
||||
size = this.mActivities.size();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
public ResolveInfo getActivity(int i) {
|
||||
ResolveInfo resolveInfo;
|
||||
synchronized (this.mInstanceLock) {
|
||||
ensureConsistentState();
|
||||
resolveInfo = this.mActivities.get(i).resolveInfo;
|
||||
}
|
||||
return resolveInfo;
|
||||
}
|
||||
|
||||
public int getActivityIndex(ResolveInfo resolveInfo) {
|
||||
synchronized (this.mInstanceLock) {
|
||||
ensureConsistentState();
|
||||
List<ActivityResolveInfo> list = this.mActivities;
|
||||
int size = list.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (list.get(i).resolveInfo == resolveInfo) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public Intent chooseActivity(int i) {
|
||||
synchronized (this.mInstanceLock) {
|
||||
if (this.mIntent == null) {
|
||||
return null;
|
||||
}
|
||||
ensureConsistentState();
|
||||
ActivityResolveInfo activityResolveInfo = this.mActivities.get(i);
|
||||
ComponentName componentName = new ComponentName(activityResolveInfo.resolveInfo.activityInfo.packageName, activityResolveInfo.resolveInfo.activityInfo.name);
|
||||
Intent intent = new Intent(this.mIntent);
|
||||
intent.setComponent(componentName);
|
||||
if (this.mActivityChoserModelPolicy != null) {
|
||||
if (this.mActivityChoserModelPolicy.onChooseActivity(this, new Intent(intent))) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
addHistoricalRecord(new HistoricalRecord(componentName, System.currentTimeMillis(), 1.0f));
|
||||
return intent;
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnChooseActivityListener(OnChooseActivityListener onChooseActivityListener) {
|
||||
synchronized (this.mInstanceLock) {
|
||||
this.mActivityChoserModelPolicy = onChooseActivityListener;
|
||||
}
|
||||
}
|
||||
|
||||
public ResolveInfo getDefaultActivity() {
|
||||
synchronized (this.mInstanceLock) {
|
||||
ensureConsistentState();
|
||||
if (this.mActivities.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return this.mActivities.get(0).resolveInfo;
|
||||
}
|
||||
}
|
||||
|
||||
public void setDefaultActivity(int i) {
|
||||
synchronized (this.mInstanceLock) {
|
||||
ensureConsistentState();
|
||||
ActivityResolveInfo activityResolveInfo = this.mActivities.get(i);
|
||||
ActivityResolveInfo activityResolveInfo2 = this.mActivities.get(0);
|
||||
addHistoricalRecord(new HistoricalRecord(new ComponentName(activityResolveInfo.resolveInfo.activityInfo.packageName, activityResolveInfo.resolveInfo.activityInfo.name), System.currentTimeMillis(), activityResolveInfo2 != null ? (activityResolveInfo2.weight - activityResolveInfo.weight) + 5.0f : 1.0f));
|
||||
}
|
||||
}
|
||||
|
||||
private void persistHistoricalDataIfNeeded() {
|
||||
if (!this.mReadShareHistoryCalled) {
|
||||
throw new IllegalStateException("No preceding call to #readHistoricalData");
|
||||
}
|
||||
if (this.mHistoricalRecordsChanged) {
|
||||
this.mHistoricalRecordsChanged = false;
|
||||
if (TextUtils.isEmpty(this.mHistoryFileName)) {
|
||||
return;
|
||||
}
|
||||
new PersistHistoryAsyncTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new ArrayList(this.mHistoricalRecords), this.mHistoryFileName);
|
||||
}
|
||||
}
|
||||
|
||||
public void setActivitySorter(ActivitySorter activitySorter) {
|
||||
synchronized (this.mInstanceLock) {
|
||||
if (this.mActivitySorter == activitySorter) {
|
||||
return;
|
||||
}
|
||||
this.mActivitySorter = activitySorter;
|
||||
if (sortActivitiesIfNeeded()) {
|
||||
notifyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setHistoryMaxSize(int i) {
|
||||
synchronized (this.mInstanceLock) {
|
||||
if (this.mHistoryMaxSize == i) {
|
||||
return;
|
||||
}
|
||||
this.mHistoryMaxSize = i;
|
||||
pruneExcessiveHistoricalRecordsIfNeeded();
|
||||
if (sortActivitiesIfNeeded()) {
|
||||
notifyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getHistoryMaxSize() {
|
||||
int i;
|
||||
synchronized (this.mInstanceLock) {
|
||||
i = this.mHistoryMaxSize;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
public int getHistorySize() {
|
||||
int size;
|
||||
synchronized (this.mInstanceLock) {
|
||||
ensureConsistentState();
|
||||
size = this.mHistoricalRecords.size();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
private void ensureConsistentState() {
|
||||
boolean loadActivitiesIfNeeded = loadActivitiesIfNeeded() | readHistoricalDataIfNeeded();
|
||||
pruneExcessiveHistoricalRecordsIfNeeded();
|
||||
if (loadActivitiesIfNeeded) {
|
||||
sortActivitiesIfNeeded();
|
||||
notifyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean sortActivitiesIfNeeded() {
|
||||
if (this.mActivitySorter == null || this.mIntent == null || this.mActivities.isEmpty() || this.mHistoricalRecords.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
this.mActivitySorter.sort(this.mIntent, this.mActivities, Collections.unmodifiableList(this.mHistoricalRecords));
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean loadActivitiesIfNeeded() {
|
||||
if (!this.mReloadActivities || this.mIntent == null) {
|
||||
return false;
|
||||
}
|
||||
this.mReloadActivities = false;
|
||||
this.mActivities.clear();
|
||||
List<ResolveInfo> queryIntentActivities = this.mContext.getPackageManager().queryIntentActivities(this.mIntent, 0);
|
||||
int size = queryIntentActivities.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
this.mActivities.add(new ActivityResolveInfo(queryIntentActivities.get(i)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean readHistoricalDataIfNeeded() {
|
||||
if (!this.mCanReadHistoricalData || !this.mHistoricalRecordsChanged || TextUtils.isEmpty(this.mHistoryFileName)) {
|
||||
return false;
|
||||
}
|
||||
this.mCanReadHistoricalData = false;
|
||||
this.mReadShareHistoryCalled = true;
|
||||
readHistoricalDataImpl();
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean addHistoricalRecord(HistoricalRecord historicalRecord) {
|
||||
boolean add = this.mHistoricalRecords.add(historicalRecord);
|
||||
if (add) {
|
||||
this.mHistoricalRecordsChanged = true;
|
||||
pruneExcessiveHistoricalRecordsIfNeeded();
|
||||
persistHistoricalDataIfNeeded();
|
||||
sortActivitiesIfNeeded();
|
||||
notifyChanged();
|
||||
}
|
||||
return add;
|
||||
}
|
||||
|
||||
private void pruneExcessiveHistoricalRecordsIfNeeded() {
|
||||
int size = this.mHistoricalRecords.size() - this.mHistoryMaxSize;
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
this.mHistoricalRecordsChanged = true;
|
||||
for (int i = 0; i < size; i++) {
|
||||
this.mHistoricalRecords.remove(0);
|
||||
}
|
||||
}
|
||||
|
||||
public static final class HistoricalRecord {
|
||||
public final ComponentName activity;
|
||||
public final long time;
|
||||
public final float weight;
|
||||
|
||||
public HistoricalRecord(String str, long j, float f) {
|
||||
this(ComponentName.unflattenFromString(str), j, f);
|
||||
}
|
||||
|
||||
public HistoricalRecord(ComponentName componentName, long j, float f) {
|
||||
this.activity = componentName;
|
||||
this.time = j;
|
||||
this.weight = f;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
ComponentName componentName = this.activity;
|
||||
int hashCode = componentName == null ? 0 : componentName.hashCode();
|
||||
long j = this.time;
|
||||
return ((((hashCode + 31) * 31) + ((int) (j ^ (j >>> 32)))) * 31) + Float.floatToIntBits(this.weight);
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
HistoricalRecord historicalRecord = (HistoricalRecord) obj;
|
||||
ComponentName componentName = this.activity;
|
||||
if (componentName == null) {
|
||||
if (historicalRecord.activity != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!componentName.equals(historicalRecord.activity)) {
|
||||
return false;
|
||||
}
|
||||
return this.time == historicalRecord.time && Float.floatToIntBits(this.weight) == Float.floatToIntBits(historicalRecord.weight);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "[; activity:" + this.activity + "; time:" + this.time + "; weight:" + new BigDecimal(this.weight) + "]";
|
||||
}
|
||||
}
|
||||
|
||||
public static final class ActivityResolveInfo implements Comparable<ActivityResolveInfo> {
|
||||
public final ResolveInfo resolveInfo;
|
||||
public float weight;
|
||||
|
||||
public ActivityResolveInfo(ResolveInfo resolveInfo) {
|
||||
this.resolveInfo = resolveInfo;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return Float.floatToIntBits(this.weight) + 31;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
return obj != null && getClass() == obj.getClass() && Float.floatToIntBits(this.weight) == Float.floatToIntBits(((ActivityResolveInfo) obj).weight);
|
||||
}
|
||||
|
||||
@Override // java.lang.Comparable
|
||||
public int compareTo(ActivityResolveInfo activityResolveInfo) {
|
||||
return Float.floatToIntBits(activityResolveInfo.weight) - Float.floatToIntBits(this.weight);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "[resolveInfo:" + this.resolveInfo.toString() + "; weight:" + new BigDecimal(this.weight) + "]";
|
||||
}
|
||||
}
|
||||
|
||||
private static final class DefaultSorter implements ActivitySorter {
|
||||
private static final float WEIGHT_DECAY_COEFFICIENT = 0.95f;
|
||||
private final Map<ComponentName, ActivityResolveInfo> mPackageNameToActivityMap = new HashMap();
|
||||
|
||||
DefaultSorter() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ActivityChooserModel.ActivitySorter
|
||||
public void sort(Intent intent, List<ActivityResolveInfo> list, List<HistoricalRecord> list2) {
|
||||
Map<ComponentName, ActivityResolveInfo> map = this.mPackageNameToActivityMap;
|
||||
map.clear();
|
||||
int size = list.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
ActivityResolveInfo activityResolveInfo = list.get(i);
|
||||
activityResolveInfo.weight = 0.0f;
|
||||
map.put(new ComponentName(activityResolveInfo.resolveInfo.activityInfo.packageName, activityResolveInfo.resolveInfo.activityInfo.name), activityResolveInfo);
|
||||
}
|
||||
float f = 1.0f;
|
||||
for (int size2 = list2.size() - 1; size2 >= 0; size2--) {
|
||||
HistoricalRecord historicalRecord = list2.get(size2);
|
||||
ActivityResolveInfo activityResolveInfo2 = map.get(historicalRecord.activity);
|
||||
if (activityResolveInfo2 != null) {
|
||||
activityResolveInfo2.weight += historicalRecord.weight * f;
|
||||
f *= WEIGHT_DECAY_COEFFICIENT;
|
||||
}
|
||||
}
|
||||
Collections.sort(list);
|
||||
}
|
||||
}
|
||||
|
||||
private void readHistoricalDataImpl() {
|
||||
XmlPullParser newPullParser;
|
||||
try {
|
||||
FileInputStream openFileInput = this.mContext.openFileInput(this.mHistoryFileName);
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
newPullParser = Xml.newPullParser();
|
||||
newPullParser.setInput(openFileInput, "UTF-8");
|
||||
for (int i = 0; i != 1 && i != 2; i = newPullParser.next()) {
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.e(LOG_TAG, "Error reading historical recrod file: " + this.mHistoryFileName, e);
|
||||
if (openFileInput == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (XmlPullParserException e2) {
|
||||
Log.e(LOG_TAG, "Error reading historical recrod file: " + this.mHistoryFileName, e2);
|
||||
if (openFileInput == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!TAG_HISTORICAL_RECORDS.equals(newPullParser.getName())) {
|
||||
throw new XmlPullParserException("Share records file does not start with historical-records tag.");
|
||||
}
|
||||
List<HistoricalRecord> list = this.mHistoricalRecords;
|
||||
list.clear();
|
||||
while (true) {
|
||||
int next = newPullParser.next();
|
||||
if (next == 1) {
|
||||
if (openFileInput == null) {
|
||||
return;
|
||||
}
|
||||
} else if (next != 3 && next != 4) {
|
||||
if (!TAG_HISTORICAL_RECORD.equals(newPullParser.getName())) {
|
||||
throw new XmlPullParserException("Share records file not well-formed.");
|
||||
}
|
||||
list.add(new HistoricalRecord(newPullParser.getAttributeValue(null, ATTRIBUTE_ACTIVITY), Long.parseLong(newPullParser.getAttributeValue(null, ATTRIBUTE_TIME)), Float.parseFloat(newPullParser.getAttributeValue(null, ATTRIBUTE_WEIGHT))));
|
||||
}
|
||||
}
|
||||
try {
|
||||
openFileInput.close();
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
if (openFileInput != null) {
|
||||
try {
|
||||
openFileInput.close();
|
||||
} catch (IOException unused2) {
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
} catch (FileNotFoundException unused3) {
|
||||
}
|
||||
}
|
||||
|
||||
private final class PersistHistoryAsyncTask extends AsyncTask<Object, Void, Void> {
|
||||
PersistHistoryAsyncTask() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:12:0x006d, code lost:
|
||||
|
||||
if (r15 != null) goto L43;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:16:0x006f, code lost:
|
||||
|
||||
r15.close();
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:31:0x00b2, code lost:
|
||||
|
||||
if (r15 == null) goto L30;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:35:0x0092, code lost:
|
||||
|
||||
if (r15 == null) goto L30;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:39:0x00d2, code lost:
|
||||
|
||||
if (r15 == null) goto L30;
|
||||
*/
|
||||
@Override // android.os.AsyncTask
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
public java.lang.Void doInBackground(java.lang.Object... r15) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 243
|
||||
To view this dump add '--comments-level debug' option
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ActivityChooserModel.PersistHistoryAsyncTask.doInBackground(java.lang.Object[]):java.lang.Void");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,588 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.database.DataSetObserver;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.view.menu.ShowableListMenu;
|
||||
import androidx.appcompat.widget.ActivityChooserModel;
|
||||
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
|
||||
import androidx.core.view.ActionProvider;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ActivityChooserView extends ViewGroup implements ActivityChooserModel.ActivityChooserModelClient {
|
||||
private final View mActivityChooserContent;
|
||||
private final Drawable mActivityChooserContentBackground;
|
||||
final ActivityChooserViewAdapter mAdapter;
|
||||
private final Callbacks mCallbacks;
|
||||
private int mDefaultActionButtonContentDescription;
|
||||
final FrameLayout mDefaultActivityButton;
|
||||
private final ImageView mDefaultActivityButtonImage;
|
||||
final FrameLayout mExpandActivityOverflowButton;
|
||||
private final ImageView mExpandActivityOverflowButtonImage;
|
||||
int mInitialActivityCount;
|
||||
private boolean mIsAttachedToWindow;
|
||||
boolean mIsSelectingDefaultActivity;
|
||||
private final int mListPopupMaxWidth;
|
||||
private ListPopupWindow mListPopupWindow;
|
||||
final DataSetObserver mModelDataSetObserver;
|
||||
PopupWindow.OnDismissListener mOnDismissListener;
|
||||
private final ViewTreeObserver.OnGlobalLayoutListener mOnGlobalLayoutListener;
|
||||
ActionProvider mProvider;
|
||||
|
||||
public void setDefaultActionButtonContentDescription(int i) {
|
||||
this.mDefaultActionButtonContentDescription = i;
|
||||
}
|
||||
|
||||
public void setInitialActivityCount(int i) {
|
||||
this.mInitialActivityCount = i;
|
||||
}
|
||||
|
||||
public void setOnDismissListener(PopupWindow.OnDismissListener onDismissListener) {
|
||||
this.mOnDismissListener = onDismissListener;
|
||||
}
|
||||
|
||||
public void setProvider(ActionProvider actionProvider) {
|
||||
this.mProvider = actionProvider;
|
||||
}
|
||||
|
||||
public ActivityChooserView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ActivityChooserView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public ActivityChooserView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.mModelDataSetObserver = new DataSetObserver() { // from class: androidx.appcompat.widget.ActivityChooserView.1
|
||||
@Override // android.database.DataSetObserver
|
||||
public void onChanged() {
|
||||
super.onChanged();
|
||||
ActivityChooserView.this.mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override // android.database.DataSetObserver
|
||||
public void onInvalidated() {
|
||||
super.onInvalidated();
|
||||
ActivityChooserView.this.mAdapter.notifyDataSetInvalidated();
|
||||
}
|
||||
};
|
||||
this.mOnGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() { // from class: androidx.appcompat.widget.ActivityChooserView.2
|
||||
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
|
||||
public void onGlobalLayout() {
|
||||
if (ActivityChooserView.this.isShowingPopup()) {
|
||||
if (!ActivityChooserView.this.isShown()) {
|
||||
ActivityChooserView.this.getListPopupWindow().dismiss();
|
||||
return;
|
||||
}
|
||||
ActivityChooserView.this.getListPopupWindow().show();
|
||||
if (ActivityChooserView.this.mProvider != null) {
|
||||
ActivityChooserView.this.mProvider.subUiVisibilityChanged(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
this.mInitialActivityCount = 4;
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.ActivityChooserView, i, 0);
|
||||
ViewCompat.saveAttributeDataForStyleable(this, context, R.styleable.ActivityChooserView, attributeSet, obtainStyledAttributes, i, 0);
|
||||
this.mInitialActivityCount = obtainStyledAttributes.getInt(R.styleable.ActivityChooserView_initialActivityCount, 4);
|
||||
Drawable drawable = obtainStyledAttributes.getDrawable(R.styleable.ActivityChooserView_expandActivityOverflowButtonDrawable);
|
||||
obtainStyledAttributes.recycle();
|
||||
LayoutInflater.from(getContext()).inflate(R.layout.abc_activity_chooser_view, (ViewGroup) this, true);
|
||||
Callbacks callbacks = new Callbacks();
|
||||
this.mCallbacks = callbacks;
|
||||
View findViewById = findViewById(R.id.activity_chooser_view_content);
|
||||
this.mActivityChooserContent = findViewById;
|
||||
this.mActivityChooserContentBackground = findViewById.getBackground();
|
||||
FrameLayout frameLayout = (FrameLayout) findViewById(R.id.default_activity_button);
|
||||
this.mDefaultActivityButton = frameLayout;
|
||||
frameLayout.setOnClickListener(callbacks);
|
||||
frameLayout.setOnLongClickListener(callbacks);
|
||||
this.mDefaultActivityButtonImage = (ImageView) frameLayout.findViewById(R.id.image);
|
||||
FrameLayout frameLayout2 = (FrameLayout) findViewById(R.id.expand_activities_button);
|
||||
frameLayout2.setOnClickListener(callbacks);
|
||||
frameLayout2.setAccessibilityDelegate(new View.AccessibilityDelegate() { // from class: androidx.appcompat.widget.ActivityChooserView.3
|
||||
@Override // android.view.View.AccessibilityDelegate
|
||||
public void onInitializeAccessibilityNodeInfo(View view, AccessibilityNodeInfo accessibilityNodeInfo) {
|
||||
super.onInitializeAccessibilityNodeInfo(view, accessibilityNodeInfo);
|
||||
AccessibilityNodeInfoCompat.wrap(accessibilityNodeInfo).setCanOpenPopup(true);
|
||||
}
|
||||
});
|
||||
frameLayout2.setOnTouchListener(new ForwardingListener(frameLayout2) { // from class: androidx.appcompat.widget.ActivityChooserView.4
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
public ShowableListMenu getPopup() {
|
||||
return ActivityChooserView.this.getListPopupWindow();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
protected boolean onForwardingStarted() {
|
||||
ActivityChooserView.this.showPopup();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
protected boolean onForwardingStopped() {
|
||||
ActivityChooserView.this.dismissPopup();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
this.mExpandActivityOverflowButton = frameLayout2;
|
||||
ImageView imageView = (ImageView) frameLayout2.findViewById(R.id.image);
|
||||
this.mExpandActivityOverflowButtonImage = imageView;
|
||||
imageView.setImageDrawable(drawable);
|
||||
ActivityChooserViewAdapter activityChooserViewAdapter = new ActivityChooserViewAdapter();
|
||||
this.mAdapter = activityChooserViewAdapter;
|
||||
activityChooserViewAdapter.registerDataSetObserver(new DataSetObserver() { // from class: androidx.appcompat.widget.ActivityChooserView.5
|
||||
@Override // android.database.DataSetObserver
|
||||
public void onChanged() {
|
||||
super.onChanged();
|
||||
ActivityChooserView.this.updateAppearance();
|
||||
}
|
||||
});
|
||||
Resources resources = context.getResources();
|
||||
this.mListPopupMaxWidth = Math.max(resources.getDisplayMetrics().widthPixels / 2, resources.getDimensionPixelSize(R.dimen.abc_config_prefDialogWidth));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ActivityChooserModel.ActivityChooserModelClient
|
||||
public void setActivityChooserModel(ActivityChooserModel activityChooserModel) {
|
||||
this.mAdapter.setDataModel(activityChooserModel);
|
||||
if (isShowingPopup()) {
|
||||
dismissPopup();
|
||||
showPopup();
|
||||
}
|
||||
}
|
||||
|
||||
public void setExpandActivityOverflowButtonDrawable(Drawable drawable) {
|
||||
this.mExpandActivityOverflowButtonImage.setImageDrawable(drawable);
|
||||
}
|
||||
|
||||
public void setExpandActivityOverflowButtonContentDescription(int i) {
|
||||
this.mExpandActivityOverflowButtonImage.setContentDescription(getContext().getString(i));
|
||||
}
|
||||
|
||||
public boolean showPopup() {
|
||||
if (isShowingPopup() || !this.mIsAttachedToWindow) {
|
||||
return false;
|
||||
}
|
||||
this.mIsSelectingDefaultActivity = false;
|
||||
showPopupUnchecked(this.mInitialActivityCount);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
/* JADX WARN: Type inference failed for: r0v15 */
|
||||
/* JADX WARN: Type inference failed for: r0v6 */
|
||||
/* JADX WARN: Type inference failed for: r0v7, types: [boolean, int] */
|
||||
void showPopupUnchecked(int i) {
|
||||
if (this.mAdapter.getDataModel() == null) {
|
||||
throw new IllegalStateException("No data model. Did you call #setDataModel?");
|
||||
}
|
||||
getViewTreeObserver().addOnGlobalLayoutListener(this.mOnGlobalLayoutListener);
|
||||
?? r0 = this.mDefaultActivityButton.getVisibility() == 0 ? 1 : 0;
|
||||
int activityCount = this.mAdapter.getActivityCount();
|
||||
if (i != Integer.MAX_VALUE && activityCount > i + r0) {
|
||||
this.mAdapter.setShowFooterView(true);
|
||||
this.mAdapter.setMaxActivityCount(i - 1);
|
||||
} else {
|
||||
this.mAdapter.setShowFooterView(false);
|
||||
this.mAdapter.setMaxActivityCount(i);
|
||||
}
|
||||
ListPopupWindow listPopupWindow = getListPopupWindow();
|
||||
if (listPopupWindow.isShowing()) {
|
||||
return;
|
||||
}
|
||||
if (this.mIsSelectingDefaultActivity || r0 == 0) {
|
||||
this.mAdapter.setShowDefaultActivity(true, r0);
|
||||
} else {
|
||||
this.mAdapter.setShowDefaultActivity(false, false);
|
||||
}
|
||||
listPopupWindow.setContentWidth(Math.min(this.mAdapter.measureContentWidth(), this.mListPopupMaxWidth));
|
||||
listPopupWindow.show();
|
||||
ActionProvider actionProvider = this.mProvider;
|
||||
if (actionProvider != null) {
|
||||
actionProvider.subUiVisibilityChanged(true);
|
||||
}
|
||||
listPopupWindow.getListView().setContentDescription(getContext().getString(R.string.abc_activitychooserview_choose_application));
|
||||
listPopupWindow.getListView().setSelector(new ColorDrawable(0));
|
||||
}
|
||||
|
||||
public boolean dismissPopup() {
|
||||
if (!isShowingPopup()) {
|
||||
return true;
|
||||
}
|
||||
getListPopupWindow().dismiss();
|
||||
ViewTreeObserver viewTreeObserver = getViewTreeObserver();
|
||||
if (!viewTreeObserver.isAlive()) {
|
||||
return true;
|
||||
}
|
||||
viewTreeObserver.removeGlobalOnLayoutListener(this.mOnGlobalLayoutListener);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isShowingPopup() {
|
||||
return getListPopupWindow().isShowing();
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
ActivityChooserModel dataModel = this.mAdapter.getDataModel();
|
||||
if (dataModel != null) {
|
||||
dataModel.registerObserver(this.mModelDataSetObserver);
|
||||
}
|
||||
this.mIsAttachedToWindow = true;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
ActivityChooserModel dataModel = this.mAdapter.getDataModel();
|
||||
if (dataModel != null) {
|
||||
dataModel.unregisterObserver(this.mModelDataSetObserver);
|
||||
}
|
||||
ViewTreeObserver viewTreeObserver = getViewTreeObserver();
|
||||
if (viewTreeObserver.isAlive()) {
|
||||
viewTreeObserver.removeGlobalOnLayoutListener(this.mOnGlobalLayoutListener);
|
||||
}
|
||||
if (isShowingPopup()) {
|
||||
dismissPopup();
|
||||
}
|
||||
this.mIsAttachedToWindow = false;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
View view = this.mActivityChooserContent;
|
||||
if (this.mDefaultActivityButton.getVisibility() != 0) {
|
||||
i2 = View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(i2), BasicMeasure.EXACTLY);
|
||||
}
|
||||
measureChild(view, i, i2);
|
||||
setMeasuredDimension(view.getMeasuredWidth(), view.getMeasuredHeight());
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
this.mActivityChooserContent.layout(0, 0, i3 - i, i4 - i2);
|
||||
if (isShowingPopup()) {
|
||||
return;
|
||||
}
|
||||
dismissPopup();
|
||||
}
|
||||
|
||||
public ActivityChooserModel getDataModel() {
|
||||
return this.mAdapter.getDataModel();
|
||||
}
|
||||
|
||||
ListPopupWindow getListPopupWindow() {
|
||||
if (this.mListPopupWindow == null) {
|
||||
ListPopupWindow listPopupWindow = new ListPopupWindow(getContext());
|
||||
this.mListPopupWindow = listPopupWindow;
|
||||
listPopupWindow.setAdapter(this.mAdapter);
|
||||
this.mListPopupWindow.setAnchorView(this);
|
||||
this.mListPopupWindow.setModal(true);
|
||||
this.mListPopupWindow.setOnItemClickListener(this.mCallbacks);
|
||||
this.mListPopupWindow.setOnDismissListener(this.mCallbacks);
|
||||
}
|
||||
return this.mListPopupWindow;
|
||||
}
|
||||
|
||||
void updateAppearance() {
|
||||
if (this.mAdapter.getCount() > 0) {
|
||||
this.mExpandActivityOverflowButton.setEnabled(true);
|
||||
} else {
|
||||
this.mExpandActivityOverflowButton.setEnabled(false);
|
||||
}
|
||||
int activityCount = this.mAdapter.getActivityCount();
|
||||
int historySize = this.mAdapter.getHistorySize();
|
||||
if (activityCount == 1 || (activityCount > 1 && historySize > 0)) {
|
||||
this.mDefaultActivityButton.setVisibility(0);
|
||||
ResolveInfo defaultActivity = this.mAdapter.getDefaultActivity();
|
||||
PackageManager packageManager = getContext().getPackageManager();
|
||||
this.mDefaultActivityButtonImage.setImageDrawable(defaultActivity.loadIcon(packageManager));
|
||||
if (this.mDefaultActionButtonContentDescription != 0) {
|
||||
this.mDefaultActivityButton.setContentDescription(getContext().getString(this.mDefaultActionButtonContentDescription, defaultActivity.loadLabel(packageManager)));
|
||||
}
|
||||
} else {
|
||||
this.mDefaultActivityButton.setVisibility(8);
|
||||
}
|
||||
if (this.mDefaultActivityButton.getVisibility() == 0) {
|
||||
this.mActivityChooserContent.setBackgroundDrawable(this.mActivityChooserContentBackground);
|
||||
} else {
|
||||
this.mActivityChooserContent.setBackgroundDrawable(null);
|
||||
}
|
||||
}
|
||||
|
||||
private class Callbacks implements AdapterView.OnItemClickListener, View.OnClickListener, View.OnLongClickListener, PopupWindow.OnDismissListener {
|
||||
Callbacks() {
|
||||
}
|
||||
|
||||
@Override // android.widget.AdapterView.OnItemClickListener
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
|
||||
int itemViewType = ((ActivityChooserViewAdapter) adapterView.getAdapter()).getItemViewType(i);
|
||||
if (itemViewType != 0) {
|
||||
if (itemViewType == 1) {
|
||||
ActivityChooserView.this.showPopupUnchecked(Integer.MAX_VALUE);
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
ActivityChooserView.this.dismissPopup();
|
||||
if (ActivityChooserView.this.mIsSelectingDefaultActivity) {
|
||||
if (i > 0) {
|
||||
ActivityChooserView.this.mAdapter.getDataModel().setDefaultActivity(i);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!ActivityChooserView.this.mAdapter.getShowDefaultActivity()) {
|
||||
i++;
|
||||
}
|
||||
Intent chooseActivity = ActivityChooserView.this.mAdapter.getDataModel().chooseActivity(i);
|
||||
if (chooseActivity != null) {
|
||||
chooseActivity.addFlags(524288);
|
||||
ActivityChooserView.this.getContext().startActivity(chooseActivity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (view == ActivityChooserView.this.mDefaultActivityButton) {
|
||||
ActivityChooserView.this.dismissPopup();
|
||||
Intent chooseActivity = ActivityChooserView.this.mAdapter.getDataModel().chooseActivity(ActivityChooserView.this.mAdapter.getDataModel().getActivityIndex(ActivityChooserView.this.mAdapter.getDefaultActivity()));
|
||||
if (chooseActivity != null) {
|
||||
chooseActivity.addFlags(524288);
|
||||
ActivityChooserView.this.getContext().startActivity(chooseActivity);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (view == ActivityChooserView.this.mExpandActivityOverflowButton) {
|
||||
ActivityChooserView.this.mIsSelectingDefaultActivity = false;
|
||||
ActivityChooserView activityChooserView = ActivityChooserView.this;
|
||||
activityChooserView.showPopupUnchecked(activityChooserView.mInitialActivityCount);
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnLongClickListener
|
||||
public boolean onLongClick(View view) {
|
||||
if (view == ActivityChooserView.this.mDefaultActivityButton) {
|
||||
if (ActivityChooserView.this.mAdapter.getCount() > 0) {
|
||||
ActivityChooserView.this.mIsSelectingDefaultActivity = true;
|
||||
ActivityChooserView activityChooserView = ActivityChooserView.this;
|
||||
activityChooserView.showPopupUnchecked(activityChooserView.mInitialActivityCount);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
@Override // android.widget.PopupWindow.OnDismissListener
|
||||
public void onDismiss() {
|
||||
notifyOnDismissListener();
|
||||
if (ActivityChooserView.this.mProvider != null) {
|
||||
ActivityChooserView.this.mProvider.subUiVisibilityChanged(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyOnDismissListener() {
|
||||
if (ActivityChooserView.this.mOnDismissListener != null) {
|
||||
ActivityChooserView.this.mOnDismissListener.onDismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class ActivityChooserViewAdapter extends BaseAdapter {
|
||||
private static final int ITEM_VIEW_TYPE_ACTIVITY = 0;
|
||||
private static final int ITEM_VIEW_TYPE_COUNT = 3;
|
||||
private static final int ITEM_VIEW_TYPE_FOOTER = 1;
|
||||
public static final int MAX_ACTIVITY_COUNT_DEFAULT = 4;
|
||||
public static final int MAX_ACTIVITY_COUNT_UNLIMITED = Integer.MAX_VALUE;
|
||||
private ActivityChooserModel mDataModel;
|
||||
private boolean mHighlightDefaultActivity;
|
||||
private int mMaxActivityCount = 4;
|
||||
private boolean mShowDefaultActivity;
|
||||
private boolean mShowFooterView;
|
||||
|
||||
public ActivityChooserModel getDataModel() {
|
||||
return this.mDataModel;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
public boolean getShowDefaultActivity() {
|
||||
return this.mShowDefaultActivity;
|
||||
}
|
||||
|
||||
@Override // android.widget.BaseAdapter, android.widget.Adapter
|
||||
public int getViewTypeCount() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
ActivityChooserViewAdapter() {
|
||||
}
|
||||
|
||||
public void setDataModel(ActivityChooserModel activityChooserModel) {
|
||||
ActivityChooserModel dataModel = ActivityChooserView.this.mAdapter.getDataModel();
|
||||
if (dataModel != null && ActivityChooserView.this.isShown()) {
|
||||
dataModel.unregisterObserver(ActivityChooserView.this.mModelDataSetObserver);
|
||||
}
|
||||
this.mDataModel = activityChooserModel;
|
||||
if (activityChooserModel != null && ActivityChooserView.this.isShown()) {
|
||||
activityChooserModel.registerObserver(ActivityChooserView.this.mModelDataSetObserver);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override // android.widget.BaseAdapter, android.widget.Adapter
|
||||
public int getItemViewType(int i) {
|
||||
return (this.mShowFooterView && i == getCount() - 1) ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getCount() {
|
||||
int activityCount = this.mDataModel.getActivityCount();
|
||||
if (!this.mShowDefaultActivity && this.mDataModel.getDefaultActivity() != null) {
|
||||
activityCount--;
|
||||
}
|
||||
int min = Math.min(activityCount, this.mMaxActivityCount);
|
||||
return this.mShowFooterView ? min + 1 : min;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public Object getItem(int i) {
|
||||
int itemViewType = getItemViewType(i);
|
||||
if (itemViewType != 0) {
|
||||
if (itemViewType == 1) {
|
||||
return null;
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (!this.mShowDefaultActivity && this.mDataModel.getDefaultActivity() != null) {
|
||||
i++;
|
||||
}
|
||||
return this.mDataModel.getActivity(i);
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
int itemViewType = getItemViewType(i);
|
||||
if (itemViewType != 0) {
|
||||
if (itemViewType == 1) {
|
||||
if (view != null && view.getId() == 1) {
|
||||
return view;
|
||||
}
|
||||
View inflate = LayoutInflater.from(ActivityChooserView.this.getContext()).inflate(R.layout.abc_activity_chooser_view_list_item, viewGroup, false);
|
||||
inflate.setId(1);
|
||||
((TextView) inflate.findViewById(R.id.title)).setText(ActivityChooserView.this.getContext().getString(R.string.abc_activity_chooser_view_see_all));
|
||||
return inflate;
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (view == null || view.getId() != R.id.list_item) {
|
||||
view = LayoutInflater.from(ActivityChooserView.this.getContext()).inflate(R.layout.abc_activity_chooser_view_list_item, viewGroup, false);
|
||||
}
|
||||
PackageManager packageManager = ActivityChooserView.this.getContext().getPackageManager();
|
||||
ImageView imageView = (ImageView) view.findViewById(R.id.icon);
|
||||
ResolveInfo resolveInfo = (ResolveInfo) getItem(i);
|
||||
imageView.setImageDrawable(resolveInfo.loadIcon(packageManager));
|
||||
((TextView) view.findViewById(R.id.title)).setText(resolveInfo.loadLabel(packageManager));
|
||||
if (this.mShowDefaultActivity && i == 0 && this.mHighlightDefaultActivity) {
|
||||
view.setActivated(true);
|
||||
} else {
|
||||
view.setActivated(false);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
public int measureContentWidth() {
|
||||
int i = this.mMaxActivityCount;
|
||||
this.mMaxActivityCount = Integer.MAX_VALUE;
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
|
||||
int makeMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(0, 0);
|
||||
int count = getCount();
|
||||
View view = null;
|
||||
int i2 = 0;
|
||||
for (int i3 = 0; i3 < count; i3++) {
|
||||
view = getView(i3, view, null);
|
||||
view.measure(makeMeasureSpec, makeMeasureSpec2);
|
||||
i2 = Math.max(i2, view.getMeasuredWidth());
|
||||
}
|
||||
this.mMaxActivityCount = i;
|
||||
return i2;
|
||||
}
|
||||
|
||||
public void setMaxActivityCount(int i) {
|
||||
if (this.mMaxActivityCount != i) {
|
||||
this.mMaxActivityCount = i;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ResolveInfo getDefaultActivity() {
|
||||
return this.mDataModel.getDefaultActivity();
|
||||
}
|
||||
|
||||
public void setShowFooterView(boolean z) {
|
||||
if (this.mShowFooterView != z) {
|
||||
this.mShowFooterView = z;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public int getActivityCount() {
|
||||
return this.mDataModel.getActivityCount();
|
||||
}
|
||||
|
||||
public int getHistorySize() {
|
||||
return this.mDataModel.getHistorySize();
|
||||
}
|
||||
|
||||
public void setShowDefaultActivity(boolean z, boolean z2) {
|
||||
if (this.mShowDefaultActivity == z && this.mHighlightDefaultActivity == z2) {
|
||||
return;
|
||||
}
|
||||
this.mShowDefaultActivity = z;
|
||||
this.mHighlightDefaultActivity = z2;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public static class InnerLayout extends LinearLayout {
|
||||
private static final int[] TINT_ATTRS = {android.R.attr.background};
|
||||
|
||||
public InnerLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, attributeSet, TINT_ATTRS);
|
||||
setBackgroundDrawable(obtainStyledAttributes.getDrawable(0));
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.widget.LinearLayoutCompat;
|
||||
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AlertDialogLayout extends LinearLayoutCompat {
|
||||
public AlertDialogLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public AlertDialogLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
if (tryOnMeasure(i, i2)) {
|
||||
return;
|
||||
}
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
|
||||
private boolean tryOnMeasure(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 = resolveMinimumHeight(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, BasicMeasure.EXACTLY));
|
||||
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;
|
||||
}
|
||||
forceUniformWidth(childCount, i2);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void forceUniformWidth(int i, int i2) {
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), BasicMeasure.EXACTLY);
|
||||
for (int i3 = 0; i3 < i; i3++) {
|
||||
View childAt = getChildAt(i3);
|
||||
if (childAt.getVisibility() != 8) {
|
||||
LinearLayoutCompat.LayoutParams layoutParams = (LinearLayoutCompat.LayoutParams) childAt.getLayoutParams();
|
||||
if (layoutParams.width == -1) {
|
||||
int i4 = layoutParams.height;
|
||||
layoutParams.height = childAt.getMeasuredHeight();
|
||||
measureChildWithMargins(childAt, makeMeasureSpec, 0, i2, 0);
|
||||
layoutParams.height = i4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int resolveMinimumHeight(View view) {
|
||||
int minimumHeight = ViewCompat.getMinimumHeight(view);
|
||||
if (minimumHeight > 0) {
|
||||
return minimumHeight;
|
||||
}
|
||||
if (view instanceof ViewGroup) {
|
||||
ViewGroup viewGroup = (ViewGroup) view;
|
||||
if (viewGroup.getChildCount() == 1) {
|
||||
return resolveMinimumHeight(viewGroup.getChildAt(0));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 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 add '--show-bad-code' argument
|
||||
*/
|
||||
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.gravity
|
||||
if (r2 >= 0) goto L7e
|
||||
r2 = r11
|
||||
L7e:
|
||||
int r3 = androidx.core.view.ViewCompat.getLayoutDirection(r17)
|
||||
int r2 = androidx.core.view.GravityCompat.getAbsoluteGravity(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.hasDividerBeforeChildAt(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.setChildFrame(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");
|
||||
}
|
||||
|
||||
private void setChildFrame(View view, int i, int i2, int i3, int i4) {
|
||||
view.layout(i, i2, i3 + i, i4 + i2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
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.text.method.KeyListener;
|
||||
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.content.res.AppCompatResources;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
import androidx.core.widget.TintableCompoundDrawablesView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatAutoCompleteTextView extends AutoCompleteTextView implements TintableBackgroundView, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
|
||||
private static final int[] TINT_ATTRS = {R.attr.popupBackground};
|
||||
private final AppCompatEmojiEditTextHelper mAppCompatEmojiEditTextHelper;
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private final AppCompatTextHelper mTextHelper;
|
||||
|
||||
public AppCompatAutoCompleteTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatAutoCompleteTextView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, androidx.appcompat.R.attr.autoCompleteTextViewStyle);
|
||||
}
|
||||
|
||||
public AppCompatAutoCompleteTextView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(getContext(), attributeSet, TINT_ATTRS, i, 0);
|
||||
if (obtainStyledAttributes.hasValue(0)) {
|
||||
setDropDownBackgroundDrawable(obtainStyledAttributes.getDrawable(0));
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
|
||||
this.mTextHelper = appCompatTextHelper;
|
||||
appCompatTextHelper.loadFromAttributes(attributeSet, i);
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
AppCompatEmojiEditTextHelper appCompatEmojiEditTextHelper = new AppCompatEmojiEditTextHelper(this);
|
||||
this.mAppCompatEmojiEditTextHelper = appCompatEmojiEditTextHelper;
|
||||
appCompatEmojiEditTextHelper.loadFromAttributes(attributeSet, i);
|
||||
initEmojiKeyListener(appCompatEmojiEditTextHelper);
|
||||
}
|
||||
|
||||
void initEmojiKeyListener(AppCompatEmojiEditTextHelper appCompatEmojiEditTextHelper) {
|
||||
KeyListener keyListener = getKeyListener();
|
||||
if (appCompatEmojiEditTextHelper.isEmojiCapableKeyListener(keyListener)) {
|
||||
boolean isFocusable = super.isFocusable();
|
||||
boolean isClickable = super.isClickable();
|
||||
boolean isLongClickable = super.isLongClickable();
|
||||
int inputType = super.getInputType();
|
||||
KeyListener keyListener2 = appCompatEmojiEditTextHelper.getKeyListener(keyListener);
|
||||
if (keyListener2 == keyListener) {
|
||||
return;
|
||||
}
|
||||
super.setKeyListener(keyListener2);
|
||||
super.setRawInputType(inputType);
|
||||
super.setFocusable(isFocusable);
|
||||
super.setClickable(isClickable);
|
||||
super.setLongClickable(isLongClickable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.AutoCompleteTextView
|
||||
public void setDropDownBackgroundResource(int i) {
|
||||
setDropDownBackgroundDrawable(AppCompatResources.getDrawable(getContext(), i));
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetTextAppearance(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
|
||||
return this.mAppCompatEmojiEditTextHelper.onCreateInputConnection(AppCompatHintHelper.onCreateInputConnection(super.onCreateInputConnection(editorInfo), editorInfo, this), editorInfo);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
|
||||
super.setCustomSelectionActionModeCallback(TextViewCompat.wrapCustomSelectionActionModeCallback(this, callback));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public ActionMode.Callback getCustomSelectionActionModeCallback() {
|
||||
return TextViewCompat.unwrapCustomSelectionActionModeCallback(super.getCustomSelectionActionModeCallback());
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setKeyListener(KeyListener keyListener) {
|
||||
super.setKeyListener(this.mAppCompatEmojiEditTextHelper.getKeyListener(keyListener));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public void setEmojiCompatEnabled(boolean z) {
|
||||
this.mAppCompatEmojiEditTextHelper.setEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public boolean isEmojiCompatEnabled() {
|
||||
return this.mAppCompatEmojiEditTextHelper.isEnabled();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public ColorStateList getSupportCompoundDrawablesTintList() {
|
||||
return this.mTextHelper.getCompoundDrawableTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
|
||||
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
|
||||
return this.mTextHelper.getCompoundDrawableTintMode();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
|
||||
this.mTextHelper.setCompoundDrawableTintMode(mode);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
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;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatBackgroundHelper {
|
||||
private TintInfo mBackgroundTint;
|
||||
private TintInfo mInternalBackgroundTint;
|
||||
private TintInfo mTmpInfo;
|
||||
private final View mView;
|
||||
private int mBackgroundResId = -1;
|
||||
private final AppCompatDrawableManager mDrawableManager = AppCompatDrawableManager.get();
|
||||
|
||||
private boolean shouldApplyFrameworkTintUsingColorFilter() {
|
||||
int i = Build.VERSION.SDK_INT;
|
||||
return i > 21 ? this.mInternalBackgroundTint != null : i == 21;
|
||||
}
|
||||
|
||||
AppCompatBackgroundHelper(View view) {
|
||||
this.mView = view;
|
||||
}
|
||||
|
||||
void loadFromAttributes(AttributeSet attributeSet, int i) {
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(this.mView.getContext(), attributeSet, R.styleable.ViewBackgroundHelper, i, 0);
|
||||
View view = this.mView;
|
||||
ViewCompat.saveAttributeDataForStyleable(view, view.getContext(), R.styleable.ViewBackgroundHelper, attributeSet, obtainStyledAttributes.getWrappedTypeArray(), i, 0);
|
||||
try {
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.ViewBackgroundHelper_android_background)) {
|
||||
this.mBackgroundResId = obtainStyledAttributes.getResourceId(R.styleable.ViewBackgroundHelper_android_background, -1);
|
||||
ColorStateList tintList = this.mDrawableManager.getTintList(this.mView.getContext(), this.mBackgroundResId);
|
||||
if (tintList != null) {
|
||||
setInternalBackgroundTint(tintList);
|
||||
}
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.ViewBackgroundHelper_backgroundTint)) {
|
||||
ViewCompat.setBackgroundTintList(this.mView, obtainStyledAttributes.getColorStateList(R.styleable.ViewBackgroundHelper_backgroundTint));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.ViewBackgroundHelper_backgroundTintMode)) {
|
||||
ViewCompat.setBackgroundTintMode(this.mView, DrawableUtils.parseTintMode(obtainStyledAttributes.getInt(R.styleable.ViewBackgroundHelper_backgroundTintMode, -1), null));
|
||||
}
|
||||
} finally {
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
void onSetBackgroundResource(int i) {
|
||||
this.mBackgroundResId = i;
|
||||
AppCompatDrawableManager appCompatDrawableManager = this.mDrawableManager;
|
||||
setInternalBackgroundTint(appCompatDrawableManager != null ? appCompatDrawableManager.getTintList(this.mView.getContext(), i) : null);
|
||||
applySupportBackgroundTint();
|
||||
}
|
||||
|
||||
void onSetBackgroundDrawable(Drawable drawable) {
|
||||
this.mBackgroundResId = -1;
|
||||
setInternalBackgroundTint(null);
|
||||
applySupportBackgroundTint();
|
||||
}
|
||||
|
||||
void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
if (this.mBackgroundTint == null) {
|
||||
this.mBackgroundTint = new TintInfo();
|
||||
}
|
||||
this.mBackgroundTint.mTintList = colorStateList;
|
||||
this.mBackgroundTint.mHasTintList = true;
|
||||
applySupportBackgroundTint();
|
||||
}
|
||||
|
||||
ColorStateList getSupportBackgroundTintList() {
|
||||
TintInfo tintInfo = this.mBackgroundTint;
|
||||
if (tintInfo != null) {
|
||||
return tintInfo.mTintList;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
if (this.mBackgroundTint == null) {
|
||||
this.mBackgroundTint = new TintInfo();
|
||||
}
|
||||
this.mBackgroundTint.mTintMode = mode;
|
||||
this.mBackgroundTint.mHasTintMode = true;
|
||||
applySupportBackgroundTint();
|
||||
}
|
||||
|
||||
PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
TintInfo tintInfo = this.mBackgroundTint;
|
||||
if (tintInfo != null) {
|
||||
return tintInfo.mTintMode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void applySupportBackgroundTint() {
|
||||
Drawable background = this.mView.getBackground();
|
||||
if (background != null) {
|
||||
if (shouldApplyFrameworkTintUsingColorFilter() && applyFrameworkTintUsingColorFilter(background)) {
|
||||
return;
|
||||
}
|
||||
TintInfo tintInfo = this.mBackgroundTint;
|
||||
if (tintInfo != null) {
|
||||
AppCompatDrawableManager.tintDrawable(background, tintInfo, this.mView.getDrawableState());
|
||||
return;
|
||||
}
|
||||
TintInfo tintInfo2 = this.mInternalBackgroundTint;
|
||||
if (tintInfo2 != null) {
|
||||
AppCompatDrawableManager.tintDrawable(background, tintInfo2, this.mView.getDrawableState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setInternalBackgroundTint(ColorStateList colorStateList) {
|
||||
if (colorStateList != null) {
|
||||
if (this.mInternalBackgroundTint == null) {
|
||||
this.mInternalBackgroundTint = new TintInfo();
|
||||
}
|
||||
this.mInternalBackgroundTint.mTintList = colorStateList;
|
||||
this.mInternalBackgroundTint.mHasTintList = true;
|
||||
} else {
|
||||
this.mInternalBackgroundTint = null;
|
||||
}
|
||||
applySupportBackgroundTint();
|
||||
}
|
||||
|
||||
private boolean applyFrameworkTintUsingColorFilter(Drawable drawable) {
|
||||
if (this.mTmpInfo == null) {
|
||||
this.mTmpInfo = new TintInfo();
|
||||
}
|
||||
TintInfo tintInfo = this.mTmpInfo;
|
||||
tintInfo.clear();
|
||||
ColorStateList backgroundTintList = ViewCompat.getBackgroundTintList(this.mView);
|
||||
if (backgroundTintList != null) {
|
||||
tintInfo.mHasTintList = true;
|
||||
tintInfo.mTintList = backgroundTintList;
|
||||
}
|
||||
PorterDuff.Mode backgroundTintMode = ViewCompat.getBackgroundTintMode(this.mView);
|
||||
if (backgroundTintMode != null) {
|
||||
tintInfo.mHasTintMode = true;
|
||||
tintInfo.mTintMode = backgroundTintMode;
|
||||
}
|
||||
if (!tintInfo.mHasTintList && !tintInfo.mHasTintMode) {
|
||||
return false;
|
||||
}
|
||||
AppCompatDrawableManager.tintDrawable(drawable, tintInfo, this.mView.getDrawableState());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.InputFilter;
|
||||
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;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.AutoSizeableTextView;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
import androidx.core.widget.TintableCompoundDrawablesView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatButton extends Button implements TintableBackgroundView, AutoSizeableTextView, TintableCompoundDrawablesView, EmojiCompatConfigurationView {
|
||||
private AppCompatEmojiTextHelper mAppCompatEmojiTextHelper;
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private final AppCompatTextHelper mTextHelper;
|
||||
|
||||
public AppCompatButton(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatButton(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.buttonStyle);
|
||||
}
|
||||
|
||||
public AppCompatButton(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
|
||||
this.mTextHelper = appCompatTextHelper;
|
||||
appCompatTextHelper.loadFromAttributes(attributeSet, i);
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
getEmojiTextViewHelper().loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetTextAppearance(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
@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.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onLayout(z, i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextSize(int i, float f) {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
super.setTextSize(i, f);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.setTextSize(i, f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
protected void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
||||
super.onTextChanged(charSequence, i, i2, i3);
|
||||
if (this.mTextHelper == null || ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE || !this.mTextHelper.isAutoSizeEnabled()) {
|
||||
return;
|
||||
}
|
||||
this.mTextHelper.autoSizeText();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public void setAutoSizeTextTypeWithDefaults(int i) {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
super.setAutoSizeTextTypeWithDefaults(i);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.setAutoSizeTextTypeWithDefaults(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public void setAutoSizeTextTypeUniformWithConfiguration(int i, int i2, int i3, int i4) throws IllegalArgumentException {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
super.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public void setAutoSizeTextTypeUniformWithPresetSizes(int[] iArr, int i) throws IllegalArgumentException {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
super.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public int getAutoSizeTextType() {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return super.getAutoSizeTextType() == 1 ? 1 : 0;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.getAutoSizeTextType();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public int getAutoSizeStepGranularity() {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return super.getAutoSizeStepGranularity();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.getAutoSizeStepGranularity();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public int getAutoSizeMinTextSize() {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return super.getAutoSizeMinTextSize();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.getAutoSizeMinTextSize();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public int getAutoSizeMaxTextSize() {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return super.getAutoSizeMaxTextSize();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.getAutoSizeMaxTextSize();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public int[] getAutoSizeTextAvailableSizes() {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return super.getAutoSizeTextAvailableSizes();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
return appCompatTextHelper != null ? appCompatTextHelper.getAutoSizeTextAvailableSizes() : new int[0];
|
||||
}
|
||||
|
||||
public void setSupportAllCaps(boolean z) {
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.setAllCaps(z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
|
||||
super.setCustomSelectionActionModeCallback(TextViewCompat.wrapCustomSelectionActionModeCallback(this, callback));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public ActionMode.Callback getCustomSelectionActionModeCallback() {
|
||||
return TextViewCompat.unwrapCustomSelectionActionModeCallback(super.getCustomSelectionActionModeCallback());
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
|
||||
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public ColorStateList getSupportCompoundDrawablesTintList() {
|
||||
return this.mTextHelper.getCompoundDrawableTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
|
||||
this.mTextHelper.setCompoundDrawableTintMode(mode);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
|
||||
return this.mTextHelper.getCompoundDrawableTintMode();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setFilters(InputFilter[] inputFilterArr) {
|
||||
super.setFilters(getEmojiTextViewHelper().getFilters(inputFilterArr));
|
||||
}
|
||||
|
||||
private AppCompatEmojiTextHelper getEmojiTextViewHelper() {
|
||||
if (this.mAppCompatEmojiTextHelper == null) {
|
||||
this.mAppCompatEmojiTextHelper = new AppCompatEmojiTextHelper(this);
|
||||
}
|
||||
return this.mAppCompatEmojiTextHelper;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setAllCaps(boolean z) {
|
||||
super.setAllCaps(z);
|
||||
getEmojiTextViewHelper().setAllCaps(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public void setEmojiCompatEnabled(boolean z) {
|
||||
getEmojiTextViewHelper().setEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public boolean isEmojiCompatEnabled() {
|
||||
return getEmojiTextViewHelper().isEnabled();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.InputFilter;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.CheckBox;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TintableCompoundButton;
|
||||
import androidx.core.widget.TintableCompoundDrawablesView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatCheckBox extends CheckBox implements TintableCompoundButton, TintableBackgroundView, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
|
||||
private AppCompatEmojiTextHelper mAppCompatEmojiTextHelper;
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private final AppCompatCompoundButtonHelper mCompoundButtonHelper;
|
||||
private final AppCompatTextHelper mTextHelper;
|
||||
|
||||
public AppCompatCheckBox(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatCheckBox(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.checkboxStyle);
|
||||
}
|
||||
|
||||
public AppCompatCheckBox(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = new AppCompatCompoundButtonHelper(this);
|
||||
this.mCompoundButtonHelper = appCompatCompoundButtonHelper;
|
||||
appCompatCompoundButtonHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
|
||||
this.mTextHelper = appCompatTextHelper;
|
||||
appCompatTextHelper.loadFromAttributes(attributeSet, i);
|
||||
getEmojiTextViewHelper().loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
private AppCompatEmojiTextHelper getEmojiTextViewHelper() {
|
||||
if (this.mAppCompatEmojiTextHelper == null) {
|
||||
this.mAppCompatEmojiTextHelper = new AppCompatEmojiTextHelper(this);
|
||||
}
|
||||
return this.mAppCompatEmojiTextHelper;
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton
|
||||
public void setButtonDrawable(Drawable drawable) {
|
||||
super.setButtonDrawable(drawable);
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.onSetButtonDrawable();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton
|
||||
public void setButtonDrawable(int i) {
|
||||
setButtonDrawable(AppCompatResources.getDrawable(getContext(), i));
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton, android.widget.TextView
|
||||
public int getCompoundPaddingLeft() {
|
||||
int compoundPaddingLeft = super.getCompoundPaddingLeft();
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
return appCompatCompoundButtonHelper != null ? appCompatCompoundButtonHelper.getCompoundPaddingLeft(compoundPaddingLeft) : compoundPaddingLeft;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public void setSupportButtonTintList(ColorStateList colorStateList) {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.setSupportButtonTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public ColorStateList getSupportButtonTintList() {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
return appCompatCompoundButtonHelper.getSupportButtonTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public void setSupportButtonTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.setSupportButtonTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public PorterDuff.Mode getSupportButtonTintMode() {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
return appCompatCompoundButtonHelper.getSupportButtonTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setFilters(InputFilter[] inputFilterArr) {
|
||||
super.setFilters(getEmojiTextViewHelper().getFilters(inputFilterArr));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setAllCaps(boolean z) {
|
||||
super.setAllCaps(z);
|
||||
getEmojiTextViewHelper().setAllCaps(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public void setEmojiCompatEnabled(boolean z) {
|
||||
getEmojiTextViewHelper().setEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public boolean isEmojiCompatEnabled() {
|
||||
return getEmojiTextViewHelper().isEnabled();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public ColorStateList getSupportCompoundDrawablesTintList() {
|
||||
return this.mTextHelper.getCompoundDrawableTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
|
||||
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
|
||||
return this.mTextHelper.getCompoundDrawableTintMode();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
|
||||
this.mTextHelper.setCompoundDrawableTintMode(mode);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
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.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.widget.CheckedTextView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
import androidx.core.widget.TintableCheckedTextView;
|
||||
import androidx.core.widget.TintableCompoundDrawablesView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatCheckedTextView extends CheckedTextView implements TintableCheckedTextView, TintableBackgroundView, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
|
||||
private AppCompatEmojiTextHelper mAppCompatEmojiTextHelper;
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private final AppCompatCheckedTextViewHelper mCheckedHelper;
|
||||
private final AppCompatTextHelper mTextHelper;
|
||||
|
||||
public AppCompatCheckedTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatCheckedTextView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.checkedTextViewStyle);
|
||||
}
|
||||
|
||||
public AppCompatCheckedTextView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
|
||||
this.mTextHelper = appCompatTextHelper;
|
||||
appCompatTextHelper.loadFromAttributes(attributeSet, i);
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = new AppCompatCheckedTextViewHelper(this);
|
||||
this.mCheckedHelper = appCompatCheckedTextViewHelper;
|
||||
appCompatCheckedTextViewHelper.loadFromAttributes(attributeSet, i);
|
||||
getEmojiTextViewHelper().loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
@Override // android.widget.CheckedTextView
|
||||
public void setCheckMarkDrawable(Drawable drawable) {
|
||||
super.setCheckMarkDrawable(drawable);
|
||||
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
|
||||
if (appCompatCheckedTextViewHelper != null) {
|
||||
appCompatCheckedTextViewHelper.onSetCheckMarkDrawable();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.CheckedTextView
|
||||
public void setCheckMarkDrawable(int i) {
|
||||
setCheckMarkDrawable(AppCompatResources.getDrawable(getContext(), i));
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCheckedTextView
|
||||
public void setSupportCheckMarkTintList(ColorStateList colorStateList) {
|
||||
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
|
||||
if (appCompatCheckedTextViewHelper != null) {
|
||||
appCompatCheckedTextViewHelper.setSupportCheckMarkTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCheckedTextView
|
||||
public ColorStateList getSupportCheckMarkTintList() {
|
||||
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
|
||||
if (appCompatCheckedTextViewHelper != null) {
|
||||
return appCompatCheckedTextViewHelper.getSupportCheckMarkTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCheckedTextView
|
||||
public void setSupportCheckMarkTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
|
||||
if (appCompatCheckedTextViewHelper != null) {
|
||||
appCompatCheckedTextViewHelper.setSupportCheckMarkTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCheckedTextView
|
||||
public PorterDuff.Mode getSupportCheckMarkTintMode() {
|
||||
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
|
||||
if (appCompatCheckedTextViewHelper != null) {
|
||||
return appCompatCheckedTextViewHelper.getSupportCheckMarkTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetTextAppearance(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.CheckedTextView, android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
|
||||
if (appCompatCheckedTextViewHelper != null) {
|
||||
appCompatCheckedTextViewHelper.applyCheckMarkTint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
|
||||
return AppCompatHintHelper.onCreateInputConnection(super.onCreateInputConnection(editorInfo), editorInfo, this);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
|
||||
super.setCustomSelectionActionModeCallback(TextViewCompat.wrapCustomSelectionActionModeCallback(this, callback));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public ActionMode.Callback getCustomSelectionActionModeCallback() {
|
||||
return TextViewCompat.unwrapCustomSelectionActionModeCallback(super.getCustomSelectionActionModeCallback());
|
||||
}
|
||||
|
||||
private AppCompatEmojiTextHelper getEmojiTextViewHelper() {
|
||||
if (this.mAppCompatEmojiTextHelper == null) {
|
||||
this.mAppCompatEmojiTextHelper = new AppCompatEmojiTextHelper(this);
|
||||
}
|
||||
return this.mAppCompatEmojiTextHelper;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setAllCaps(boolean z) {
|
||||
super.setAllCaps(z);
|
||||
getEmojiTextViewHelper().setAllCaps(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public void setEmojiCompatEnabled(boolean z) {
|
||||
getEmojiTextViewHelper().setEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public boolean isEmojiCompatEnabled() {
|
||||
return getEmojiTextViewHelper().isEnabled();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public ColorStateList getSupportCompoundDrawablesTintList() {
|
||||
return this.mTextHelper.getCompoundDrawableTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
|
||||
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
|
||||
return this.mTextHelper.getCompoundDrawableTintMode();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
|
||||
this.mTextHelper.setCompoundDrawableTintMode(mode);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.widget.CheckedTextView;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.widget.CheckedTextViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatCheckedTextViewHelper {
|
||||
private ColorStateList mCheckMarkTintList = null;
|
||||
private PorterDuff.Mode mCheckMarkTintMode = null;
|
||||
private boolean mHasCheckMarkTint = false;
|
||||
private boolean mHasCheckMarkTintMode = false;
|
||||
private boolean mSkipNextApply;
|
||||
private final CheckedTextView mView;
|
||||
|
||||
ColorStateList getSupportCheckMarkTintList() {
|
||||
return this.mCheckMarkTintList;
|
||||
}
|
||||
|
||||
PorterDuff.Mode getSupportCheckMarkTintMode() {
|
||||
return this.mCheckMarkTintMode;
|
||||
}
|
||||
|
||||
AppCompatCheckedTextViewHelper(CheckedTextView checkedTextView) {
|
||||
this.mView = checkedTextView;
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:11:0x0062 A[Catch: all -> 0x008a, TryCatch #1 {all -> 0x008a, blocks: (B:3:0x001f, B:5:0x0027, B:8:0x002f, B:9:0x005a, B:11:0x0062, B:12:0x006d, B:14:0x0075, B:21:0x003d, B:23:0x0045, B:25:0x004d), top: B:2:0x001f }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:14:0x0075 A[Catch: all -> 0x008a, TRY_LEAVE, TryCatch #1 {all -> 0x008a, blocks: (B:3:0x001f, B:5:0x0027, B:8:0x002f, B:9:0x005a, B:11:0x0062, B:12:0x006d, B:14:0x0075, B:21:0x003d, B:23:0x0045, B:25:0x004d), top: B:2:0x001f }] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
void loadFromAttributes(android.util.AttributeSet r11, int r12) {
|
||||
/*
|
||||
r10 = this;
|
||||
android.widget.CheckedTextView r0 = r10.mView
|
||||
android.content.Context r0 = r0.getContext()
|
||||
int[] r1 = androidx.appcompat.R.styleable.CheckedTextView
|
||||
r2 = 0
|
||||
androidx.appcompat.widget.TintTypedArray r0 = androidx.appcompat.widget.TintTypedArray.obtainStyledAttributes(r0, r11, r1, r12, r2)
|
||||
android.widget.CheckedTextView r3 = r10.mView
|
||||
android.content.Context r4 = r3.getContext()
|
||||
int[] r5 = androidx.appcompat.R.styleable.CheckedTextView
|
||||
android.content.res.TypedArray r7 = r0.getWrappedTypeArray()
|
||||
r9 = 0
|
||||
r6 = r11
|
||||
r8 = r12
|
||||
androidx.core.view.ViewCompat.saveAttributeDataForStyleable(r3, r4, r5, r6, r7, r8, r9)
|
||||
int r11 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkCompat // Catch: java.lang.Throwable -> L8a
|
||||
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L3d
|
||||
int r11 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkCompat // Catch: java.lang.Throwable -> L8a
|
||||
int r11 = r0.getResourceId(r11, r2) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L3d
|
||||
android.widget.CheckedTextView r12 = r10.mView // Catch: android.content.res.Resources.NotFoundException -> L3d java.lang.Throwable -> L8a
|
||||
android.content.Context r1 = r12.getContext() // Catch: android.content.res.Resources.NotFoundException -> L3d java.lang.Throwable -> L8a
|
||||
android.graphics.drawable.Drawable r11 = androidx.appcompat.content.res.AppCompatResources.getDrawable(r1, r11) // Catch: android.content.res.Resources.NotFoundException -> L3d java.lang.Throwable -> L8a
|
||||
r12.setCheckMarkDrawable(r11) // Catch: android.content.res.Resources.NotFoundException -> L3d java.lang.Throwable -> L8a
|
||||
goto L5a
|
||||
L3d:
|
||||
int r11 = androidx.appcompat.R.styleable.CheckedTextView_android_checkMark // Catch: java.lang.Throwable -> L8a
|
||||
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L5a
|
||||
int r11 = androidx.appcompat.R.styleable.CheckedTextView_android_checkMark // Catch: java.lang.Throwable -> L8a
|
||||
int r11 = r0.getResourceId(r11, r2) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L5a
|
||||
android.widget.CheckedTextView r12 = r10.mView // Catch: java.lang.Throwable -> L8a
|
||||
android.content.Context r1 = r12.getContext() // Catch: java.lang.Throwable -> L8a
|
||||
android.graphics.drawable.Drawable r11 = androidx.appcompat.content.res.AppCompatResources.getDrawable(r1, r11) // Catch: java.lang.Throwable -> L8a
|
||||
r12.setCheckMarkDrawable(r11) // Catch: java.lang.Throwable -> L8a
|
||||
L5a:
|
||||
int r11 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkTint // Catch: java.lang.Throwable -> L8a
|
||||
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L6d
|
||||
android.widget.CheckedTextView r11 = r10.mView // Catch: java.lang.Throwable -> L8a
|
||||
int r12 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkTint // Catch: java.lang.Throwable -> L8a
|
||||
android.content.res.ColorStateList r12 = r0.getColorStateList(r12) // Catch: java.lang.Throwable -> L8a
|
||||
androidx.core.widget.CheckedTextViewCompat.setCheckMarkTintList(r11, r12) // Catch: java.lang.Throwable -> L8a
|
||||
L6d:
|
||||
int r11 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkTintMode // Catch: java.lang.Throwable -> L8a
|
||||
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L86
|
||||
android.widget.CheckedTextView r11 = r10.mView // Catch: java.lang.Throwable -> L8a
|
||||
int r12 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkTintMode // Catch: java.lang.Throwable -> L8a
|
||||
r1 = -1
|
||||
int r12 = r0.getInt(r12, r1) // Catch: java.lang.Throwable -> L8a
|
||||
r1 = 0
|
||||
android.graphics.PorterDuff$Mode r12 = androidx.appcompat.widget.DrawableUtils.parseTintMode(r12, r1) // Catch: java.lang.Throwable -> L8a
|
||||
androidx.core.widget.CheckedTextViewCompat.setCheckMarkTintMode(r11, r12) // Catch: java.lang.Throwable -> L8a
|
||||
L86:
|
||||
r0.recycle()
|
||||
return
|
||||
L8a:
|
||||
r11 = move-exception
|
||||
r0.recycle()
|
||||
throw r11
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AppCompatCheckedTextViewHelper.loadFromAttributes(android.util.AttributeSet, int):void");
|
||||
}
|
||||
|
||||
void setSupportCheckMarkTintList(ColorStateList colorStateList) {
|
||||
this.mCheckMarkTintList = colorStateList;
|
||||
this.mHasCheckMarkTint = true;
|
||||
applyCheckMarkTint();
|
||||
}
|
||||
|
||||
void setSupportCheckMarkTintMode(PorterDuff.Mode mode) {
|
||||
this.mCheckMarkTintMode = mode;
|
||||
this.mHasCheckMarkTintMode = true;
|
||||
applyCheckMarkTint();
|
||||
}
|
||||
|
||||
void onSetCheckMarkDrawable() {
|
||||
if (this.mSkipNextApply) {
|
||||
this.mSkipNextApply = false;
|
||||
} else {
|
||||
this.mSkipNextApply = true;
|
||||
applyCheckMarkTint();
|
||||
}
|
||||
}
|
||||
|
||||
void applyCheckMarkTint() {
|
||||
Drawable checkMarkDrawable = CheckedTextViewCompat.getCheckMarkDrawable(this.mView);
|
||||
if (checkMarkDrawable != null) {
|
||||
if (this.mHasCheckMarkTint || this.mHasCheckMarkTintMode) {
|
||||
Drawable mutate = DrawableCompat.wrap(checkMarkDrawable).mutate();
|
||||
if (this.mHasCheckMarkTint) {
|
||||
DrawableCompat.setTintList(mutate, this.mCheckMarkTintList);
|
||||
}
|
||||
if (this.mHasCheckMarkTintMode) {
|
||||
DrawableCompat.setTintMode(mutate, this.mCheckMarkTintMode);
|
||||
}
|
||||
if (mutate.isStateful()) {
|
||||
mutate.setState(this.mView.getDrawableState());
|
||||
}
|
||||
this.mView.setCheckMarkDrawable(mutate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.widget.CompoundButton;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.widget.CompoundButtonCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatCompoundButtonHelper {
|
||||
private ColorStateList mButtonTintList = null;
|
||||
private PorterDuff.Mode mButtonTintMode = null;
|
||||
private boolean mHasButtonTint = false;
|
||||
private boolean mHasButtonTintMode = false;
|
||||
private boolean mSkipNextApply;
|
||||
private final CompoundButton mView;
|
||||
|
||||
int getCompoundPaddingLeft(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
ColorStateList getSupportButtonTintList() {
|
||||
return this.mButtonTintList;
|
||||
}
|
||||
|
||||
PorterDuff.Mode getSupportButtonTintMode() {
|
||||
return this.mButtonTintMode;
|
||||
}
|
||||
|
||||
AppCompatCompoundButtonHelper(CompoundButton compoundButton) {
|
||||
this.mView = compoundButton;
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:11:0x0062 A[Catch: all -> 0x008a, TryCatch #1 {all -> 0x008a, blocks: (B:3:0x001f, B:5:0x0027, B:8:0x002f, B:9:0x005a, B:11:0x0062, B:12:0x006d, B:14:0x0075, B:21:0x003d, B:23:0x0045, B:25:0x004d), top: B:2:0x001f }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:14:0x0075 A[Catch: all -> 0x008a, TRY_LEAVE, TryCatch #1 {all -> 0x008a, blocks: (B:3:0x001f, B:5:0x0027, B:8:0x002f, B:9:0x005a, B:11:0x0062, B:12:0x006d, B:14:0x0075, B:21:0x003d, B:23:0x0045, B:25:0x004d), top: B:2:0x001f }] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
void loadFromAttributes(android.util.AttributeSet r11, int r12) {
|
||||
/*
|
||||
r10 = this;
|
||||
android.widget.CompoundButton r0 = r10.mView
|
||||
android.content.Context r0 = r0.getContext()
|
||||
int[] r1 = androidx.appcompat.R.styleable.CompoundButton
|
||||
r2 = 0
|
||||
androidx.appcompat.widget.TintTypedArray r0 = androidx.appcompat.widget.TintTypedArray.obtainStyledAttributes(r0, r11, r1, r12, r2)
|
||||
android.widget.CompoundButton r3 = r10.mView
|
||||
android.content.Context r4 = r3.getContext()
|
||||
int[] r5 = androidx.appcompat.R.styleable.CompoundButton
|
||||
android.content.res.TypedArray r7 = r0.getWrappedTypeArray()
|
||||
r9 = 0
|
||||
r6 = r11
|
||||
r8 = r12
|
||||
androidx.core.view.ViewCompat.saveAttributeDataForStyleable(r3, r4, r5, r6, r7, r8, r9)
|
||||
int r11 = androidx.appcompat.R.styleable.CompoundButton_buttonCompat // Catch: java.lang.Throwable -> L8a
|
||||
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L3d
|
||||
int r11 = androidx.appcompat.R.styleable.CompoundButton_buttonCompat // Catch: java.lang.Throwable -> L8a
|
||||
int r11 = r0.getResourceId(r11, r2) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L3d
|
||||
android.widget.CompoundButton r12 = r10.mView // Catch: android.content.res.Resources.NotFoundException -> L3d java.lang.Throwable -> L8a
|
||||
android.content.Context r1 = r12.getContext() // Catch: android.content.res.Resources.NotFoundException -> L3d java.lang.Throwable -> L8a
|
||||
android.graphics.drawable.Drawable r11 = androidx.appcompat.content.res.AppCompatResources.getDrawable(r1, r11) // Catch: android.content.res.Resources.NotFoundException -> L3d java.lang.Throwable -> L8a
|
||||
r12.setButtonDrawable(r11) // Catch: android.content.res.Resources.NotFoundException -> L3d java.lang.Throwable -> L8a
|
||||
goto L5a
|
||||
L3d:
|
||||
int r11 = androidx.appcompat.R.styleable.CompoundButton_android_button // Catch: java.lang.Throwable -> L8a
|
||||
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L5a
|
||||
int r11 = androidx.appcompat.R.styleable.CompoundButton_android_button // Catch: java.lang.Throwable -> L8a
|
||||
int r11 = r0.getResourceId(r11, r2) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L5a
|
||||
android.widget.CompoundButton r12 = r10.mView // Catch: java.lang.Throwable -> L8a
|
||||
android.content.Context r1 = r12.getContext() // Catch: java.lang.Throwable -> L8a
|
||||
android.graphics.drawable.Drawable r11 = androidx.appcompat.content.res.AppCompatResources.getDrawable(r1, r11) // Catch: java.lang.Throwable -> L8a
|
||||
r12.setButtonDrawable(r11) // Catch: java.lang.Throwable -> L8a
|
||||
L5a:
|
||||
int r11 = androidx.appcompat.R.styleable.CompoundButton_buttonTint // Catch: java.lang.Throwable -> L8a
|
||||
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L6d
|
||||
android.widget.CompoundButton r11 = r10.mView // Catch: java.lang.Throwable -> L8a
|
||||
int r12 = androidx.appcompat.R.styleable.CompoundButton_buttonTint // Catch: java.lang.Throwable -> L8a
|
||||
android.content.res.ColorStateList r12 = r0.getColorStateList(r12) // Catch: java.lang.Throwable -> L8a
|
||||
androidx.core.widget.CompoundButtonCompat.setButtonTintList(r11, r12) // Catch: java.lang.Throwable -> L8a
|
||||
L6d:
|
||||
int r11 = androidx.appcompat.R.styleable.CompoundButton_buttonTintMode // Catch: java.lang.Throwable -> L8a
|
||||
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L8a
|
||||
if (r11 == 0) goto L86
|
||||
android.widget.CompoundButton r11 = r10.mView // Catch: java.lang.Throwable -> L8a
|
||||
int r12 = androidx.appcompat.R.styleable.CompoundButton_buttonTintMode // Catch: java.lang.Throwable -> L8a
|
||||
r1 = -1
|
||||
int r12 = r0.getInt(r12, r1) // Catch: java.lang.Throwable -> L8a
|
||||
r1 = 0
|
||||
android.graphics.PorterDuff$Mode r12 = androidx.appcompat.widget.DrawableUtils.parseTintMode(r12, r1) // Catch: java.lang.Throwable -> L8a
|
||||
androidx.core.widget.CompoundButtonCompat.setButtonTintMode(r11, r12) // Catch: java.lang.Throwable -> L8a
|
||||
L86:
|
||||
r0.recycle()
|
||||
return
|
||||
L8a:
|
||||
r11 = move-exception
|
||||
r0.recycle()
|
||||
throw r11
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AppCompatCompoundButtonHelper.loadFromAttributes(android.util.AttributeSet, int):void");
|
||||
}
|
||||
|
||||
void setSupportButtonTintList(ColorStateList colorStateList) {
|
||||
this.mButtonTintList = colorStateList;
|
||||
this.mHasButtonTint = true;
|
||||
applyButtonTint();
|
||||
}
|
||||
|
||||
void setSupportButtonTintMode(PorterDuff.Mode mode) {
|
||||
this.mButtonTintMode = mode;
|
||||
this.mHasButtonTintMode = true;
|
||||
applyButtonTint();
|
||||
}
|
||||
|
||||
void onSetButtonDrawable() {
|
||||
if (this.mSkipNextApply) {
|
||||
this.mSkipNextApply = false;
|
||||
} else {
|
||||
this.mSkipNextApply = true;
|
||||
applyButtonTint();
|
||||
}
|
||||
}
|
||||
|
||||
void applyButtonTint() {
|
||||
Drawable buttonDrawable = CompoundButtonCompat.getButtonDrawable(this.mView);
|
||||
if (buttonDrawable != null) {
|
||||
if (this.mHasButtonTint || this.mHasButtonTintMode) {
|
||||
Drawable mutate = DrawableCompat.wrap(buttonDrawable).mutate();
|
||||
if (this.mHasButtonTint) {
|
||||
DrawableCompat.setTintList(mutate, this.mButtonTintList);
|
||||
}
|
||||
if (this.mHasButtonTintMode) {
|
||||
DrawableCompat.setTintMode(mutate, this.mButtonTintMode);
|
||||
}
|
||||
if (mutate.isStateful()) {
|
||||
mutate.setState(this.mView.getDrawableState());
|
||||
}
|
||||
this.mView.setButtonDrawable(mutate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,345 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.appcompat.widget.ResourceManagerInternal;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class AppCompatDrawableManager {
|
||||
private static final boolean DEBUG = false;
|
||||
private static final PorterDuff.Mode DEFAULT_MODE = PorterDuff.Mode.SRC_IN;
|
||||
private static AppCompatDrawableManager INSTANCE = null;
|
||||
private static final String TAG = "AppCompatDrawableManag";
|
||||
private ResourceManagerInternal mResourceManager;
|
||||
|
||||
public static synchronized void preload() {
|
||||
synchronized (AppCompatDrawableManager.class) {
|
||||
if (INSTANCE == null) {
|
||||
AppCompatDrawableManager appCompatDrawableManager = new AppCompatDrawableManager();
|
||||
INSTANCE = appCompatDrawableManager;
|
||||
appCompatDrawableManager.mResourceManager = ResourceManagerInternal.get();
|
||||
INSTANCE.mResourceManager.setHooks(new ResourceManagerInternal.ResourceManagerHooks() { // from class: androidx.appcompat.widget.AppCompatDrawableManager.1
|
||||
private final int[] COLORFILTER_TINT_COLOR_CONTROL_NORMAL = {R.drawable.abc_textfield_search_default_mtrl_alpha, R.drawable.abc_textfield_default_mtrl_alpha, R.drawable.abc_ab_share_pack_mtrl_alpha};
|
||||
private final int[] TINT_COLOR_CONTROL_NORMAL = {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 final int[] COLORFILTER_COLOR_CONTROL_ACTIVATED = {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, R.drawable.abc_text_select_handle_middle_mtrl, R.drawable.abc_text_select_handle_right_mtrl};
|
||||
private final int[] COLORFILTER_COLOR_BACKGROUND_MULTIPLY = {R.drawable.abc_popup_background_mtrl_mult, R.drawable.abc_cab_background_internal_bg, R.drawable.abc_menu_hardkey_panel_mtrl_mult};
|
||||
private final int[] TINT_COLOR_CONTROL_STATE_LIST = {R.drawable.abc_tab_indicator_material, R.drawable.abc_textfield_search_material};
|
||||
private final int[] TINT_CHECKABLE_BUTTON_LIST = {R.drawable.abc_btn_check_material, R.drawable.abc_btn_radio_material, R.drawable.abc_btn_check_material_anim, R.drawable.abc_btn_radio_material_anim};
|
||||
|
||||
private ColorStateList createDefaultButtonColorStateList(Context context) {
|
||||
return createButtonColorStateList(context, ThemeUtils.getThemeAttrColor(context, R.attr.colorButtonNormal));
|
||||
}
|
||||
|
||||
private ColorStateList createBorderlessButtonColorStateList(Context context) {
|
||||
return createButtonColorStateList(context, 0);
|
||||
}
|
||||
|
||||
private ColorStateList createColoredButtonColorStateList(Context context) {
|
||||
return createButtonColorStateList(context, ThemeUtils.getThemeAttrColor(context, R.attr.colorAccent));
|
||||
}
|
||||
|
||||
private ColorStateList createButtonColorStateList(Context context, int i) {
|
||||
int themeAttrColor = ThemeUtils.getThemeAttrColor(context, R.attr.colorControlHighlight);
|
||||
return new ColorStateList(new int[][]{ThemeUtils.DISABLED_STATE_SET, ThemeUtils.PRESSED_STATE_SET, ThemeUtils.FOCUSED_STATE_SET, ThemeUtils.EMPTY_STATE_SET}, new int[]{ThemeUtils.getDisabledThemeAttrColor(context, R.attr.colorButtonNormal), ColorUtils.compositeColors(themeAttrColor, i), ColorUtils.compositeColors(themeAttrColor, i), i});
|
||||
}
|
||||
|
||||
private ColorStateList createSwitchThumbColorStateList(Context context) {
|
||||
int[][] iArr = new int[3][];
|
||||
int[] iArr2 = new int[3];
|
||||
ColorStateList themeAttrColorStateList = ThemeUtils.getThemeAttrColorStateList(context, R.attr.colorSwitchThumbNormal);
|
||||
if (themeAttrColorStateList != null && themeAttrColorStateList.isStateful()) {
|
||||
int[] iArr3 = ThemeUtils.DISABLED_STATE_SET;
|
||||
iArr[0] = iArr3;
|
||||
iArr2[0] = themeAttrColorStateList.getColorForState(iArr3, 0);
|
||||
iArr[1] = ThemeUtils.CHECKED_STATE_SET;
|
||||
iArr2[1] = ThemeUtils.getThemeAttrColor(context, R.attr.colorControlActivated);
|
||||
iArr[2] = ThemeUtils.EMPTY_STATE_SET;
|
||||
iArr2[2] = themeAttrColorStateList.getDefaultColor();
|
||||
} else {
|
||||
iArr[0] = ThemeUtils.DISABLED_STATE_SET;
|
||||
iArr2[0] = ThemeUtils.getDisabledThemeAttrColor(context, R.attr.colorSwitchThumbNormal);
|
||||
iArr[1] = ThemeUtils.CHECKED_STATE_SET;
|
||||
iArr2[1] = ThemeUtils.getThemeAttrColor(context, R.attr.colorControlActivated);
|
||||
iArr[2] = ThemeUtils.EMPTY_STATE_SET;
|
||||
iArr2[2] = ThemeUtils.getThemeAttrColor(context, R.attr.colorSwitchThumbNormal);
|
||||
}
|
||||
return new ColorStateList(iArr, iArr2);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourceManagerInternal.ResourceManagerHooks
|
||||
public Drawable createDrawableFor(ResourceManagerInternal resourceManagerInternal, Context context, int i) {
|
||||
if (i == R.drawable.abc_cab_background_top_material) {
|
||||
return new LayerDrawable(new Drawable[]{resourceManagerInternal.getDrawable(context, R.drawable.abc_cab_background_internal_bg), resourceManagerInternal.getDrawable(context, R.drawable.abc_cab_background_top_mtrl_alpha)});
|
||||
}
|
||||
if (i == R.drawable.abc_ratingbar_material) {
|
||||
return getRatingBarLayerDrawable(resourceManagerInternal, context, R.dimen.abc_star_big);
|
||||
}
|
||||
if (i == R.drawable.abc_ratingbar_indicator_material) {
|
||||
return getRatingBarLayerDrawable(resourceManagerInternal, context, R.dimen.abc_star_medium);
|
||||
}
|
||||
if (i == R.drawable.abc_ratingbar_small_material) {
|
||||
return getRatingBarLayerDrawable(resourceManagerInternal, context, R.dimen.abc_star_small);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private LayerDrawable getRatingBarLayerDrawable(ResourceManagerInternal resourceManagerInternal, Context context, int i) {
|
||||
BitmapDrawable bitmapDrawable;
|
||||
BitmapDrawable bitmapDrawable2;
|
||||
BitmapDrawable bitmapDrawable3;
|
||||
int dimensionPixelSize = context.getResources().getDimensionPixelSize(i);
|
||||
Drawable drawable = resourceManagerInternal.getDrawable(context, R.drawable.abc_star_black_48dp);
|
||||
Drawable drawable2 = resourceManagerInternal.getDrawable(context, R.drawable.abc_star_half_black_48dp);
|
||||
if ((drawable instanceof BitmapDrawable) && drawable.getIntrinsicWidth() == dimensionPixelSize && drawable.getIntrinsicHeight() == dimensionPixelSize) {
|
||||
bitmapDrawable = (BitmapDrawable) drawable;
|
||||
bitmapDrawable2 = new BitmapDrawable(bitmapDrawable.getBitmap());
|
||||
} else {
|
||||
Bitmap createBitmap = Bitmap.createBitmap(dimensionPixelSize, dimensionPixelSize, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(createBitmap);
|
||||
drawable.setBounds(0, 0, dimensionPixelSize, dimensionPixelSize);
|
||||
drawable.draw(canvas);
|
||||
bitmapDrawable = new BitmapDrawable(createBitmap);
|
||||
bitmapDrawable2 = new BitmapDrawable(createBitmap);
|
||||
}
|
||||
bitmapDrawable2.setTileModeX(Shader.TileMode.REPEAT);
|
||||
if ((drawable2 instanceof BitmapDrawable) && drawable2.getIntrinsicWidth() == dimensionPixelSize && drawable2.getIntrinsicHeight() == dimensionPixelSize) {
|
||||
bitmapDrawable3 = (BitmapDrawable) drawable2;
|
||||
} else {
|
||||
Bitmap createBitmap2 = Bitmap.createBitmap(dimensionPixelSize, dimensionPixelSize, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas2 = new Canvas(createBitmap2);
|
||||
drawable2.setBounds(0, 0, dimensionPixelSize, dimensionPixelSize);
|
||||
drawable2.draw(canvas2);
|
||||
bitmapDrawable3 = new BitmapDrawable(createBitmap2);
|
||||
}
|
||||
LayerDrawable layerDrawable = new LayerDrawable(new Drawable[]{bitmapDrawable, bitmapDrawable3, bitmapDrawable2});
|
||||
layerDrawable.setId(0, android.R.id.background);
|
||||
layerDrawable.setId(1, android.R.id.secondaryProgress);
|
||||
layerDrawable.setId(2, android.R.id.progress);
|
||||
return layerDrawable;
|
||||
}
|
||||
|
||||
private void setPorterDuffColorFilter(Drawable drawable, int i, PorterDuff.Mode mode) {
|
||||
if (DrawableUtils.canSafelyMutateDrawable(drawable)) {
|
||||
drawable = drawable.mutate();
|
||||
}
|
||||
if (mode == null) {
|
||||
mode = AppCompatDrawableManager.DEFAULT_MODE;
|
||||
}
|
||||
drawable.setColorFilter(AppCompatDrawableManager.getPorterDuffColorFilter(i, mode));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourceManagerInternal.ResourceManagerHooks
|
||||
public boolean tintDrawable(Context context, int i, Drawable drawable) {
|
||||
if (i == R.drawable.abc_seekbar_track_material) {
|
||||
LayerDrawable layerDrawable = (LayerDrawable) drawable;
|
||||
setPorterDuffColorFilter(layerDrawable.findDrawableByLayerId(android.R.id.background), ThemeUtils.getThemeAttrColor(context, R.attr.colorControlNormal), AppCompatDrawableManager.DEFAULT_MODE);
|
||||
setPorterDuffColorFilter(layerDrawable.findDrawableByLayerId(android.R.id.secondaryProgress), ThemeUtils.getThemeAttrColor(context, R.attr.colorControlNormal), AppCompatDrawableManager.DEFAULT_MODE);
|
||||
setPorterDuffColorFilter(layerDrawable.findDrawableByLayerId(android.R.id.progress), ThemeUtils.getThemeAttrColor(context, R.attr.colorControlActivated), AppCompatDrawableManager.DEFAULT_MODE);
|
||||
return true;
|
||||
}
|
||||
if (i != R.drawable.abc_ratingbar_material && i != R.drawable.abc_ratingbar_indicator_material && i != R.drawable.abc_ratingbar_small_material) {
|
||||
return false;
|
||||
}
|
||||
LayerDrawable layerDrawable2 = (LayerDrawable) drawable;
|
||||
setPorterDuffColorFilter(layerDrawable2.findDrawableByLayerId(android.R.id.background), ThemeUtils.getDisabledThemeAttrColor(context, R.attr.colorControlNormal), AppCompatDrawableManager.DEFAULT_MODE);
|
||||
setPorterDuffColorFilter(layerDrawable2.findDrawableByLayerId(android.R.id.secondaryProgress), ThemeUtils.getThemeAttrColor(context, R.attr.colorControlActivated), AppCompatDrawableManager.DEFAULT_MODE);
|
||||
setPorterDuffColorFilter(layerDrawable2.findDrawableByLayerId(android.R.id.progress), ThemeUtils.getThemeAttrColor(context, R.attr.colorControlActivated), AppCompatDrawableManager.DEFAULT_MODE);
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean arrayContains(int[] iArr, int i) {
|
||||
for (int i2 : iArr) {
|
||||
if (i2 == i) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourceManagerInternal.ResourceManagerHooks
|
||||
public ColorStateList getTintListForDrawableRes(Context context, int i) {
|
||||
if (i == R.drawable.abc_edit_text_material) {
|
||||
return AppCompatResources.getColorStateList(context, R.color.abc_tint_edittext);
|
||||
}
|
||||
if (i == R.drawable.abc_switch_track_mtrl_alpha) {
|
||||
return AppCompatResources.getColorStateList(context, R.color.abc_tint_switch_track);
|
||||
}
|
||||
if (i == R.drawable.abc_switch_thumb_material) {
|
||||
return createSwitchThumbColorStateList(context);
|
||||
}
|
||||
if (i == R.drawable.abc_btn_default_mtrl_shape) {
|
||||
return createDefaultButtonColorStateList(context);
|
||||
}
|
||||
if (i == R.drawable.abc_btn_borderless_material) {
|
||||
return createBorderlessButtonColorStateList(context);
|
||||
}
|
||||
if (i == R.drawable.abc_btn_colored_material) {
|
||||
return createColoredButtonColorStateList(context);
|
||||
}
|
||||
if (i == R.drawable.abc_spinner_mtrl_am_alpha || i == R.drawable.abc_spinner_textfield_background_material) {
|
||||
return AppCompatResources.getColorStateList(context, R.color.abc_tint_spinner);
|
||||
}
|
||||
if (arrayContains(this.TINT_COLOR_CONTROL_NORMAL, i)) {
|
||||
return ThemeUtils.getThemeAttrColorStateList(context, R.attr.colorControlNormal);
|
||||
}
|
||||
if (arrayContains(this.TINT_COLOR_CONTROL_STATE_LIST, i)) {
|
||||
return AppCompatResources.getColorStateList(context, R.color.abc_tint_default);
|
||||
}
|
||||
if (arrayContains(this.TINT_CHECKABLE_BUTTON_LIST, i)) {
|
||||
return AppCompatResources.getColorStateList(context, R.color.abc_tint_btn_checkable);
|
||||
}
|
||||
if (i == R.drawable.abc_seekbar_thumb_material) {
|
||||
return AppCompatResources.getColorStateList(context, R.color.abc_tint_seek_thumb);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:15:0x006d A[RETURN] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:7:0x0052 */
|
||||
@Override // androidx.appcompat.widget.ResourceManagerInternal.ResourceManagerHooks
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
public boolean tintDrawableUsingColorFilter(android.content.Context r7, int r8, android.graphics.drawable.Drawable r9) {
|
||||
/*
|
||||
r6 = this;
|
||||
android.graphics.PorterDuff$Mode r0 = androidx.appcompat.widget.AppCompatDrawableManager.access$000()
|
||||
int[] r1 = r6.COLORFILTER_TINT_COLOR_CONTROL_NORMAL
|
||||
boolean r1 = r6.arrayContains(r1, r8)
|
||||
r2 = 1
|
||||
r3 = 0
|
||||
r4 = -1
|
||||
if (r1 == 0) goto L15
|
||||
int r8 = androidx.appcompat.R.attr.colorControlNormal
|
||||
L11:
|
||||
r1 = r0
|
||||
L12:
|
||||
r0 = -1
|
||||
r5 = 1
|
||||
goto L50
|
||||
L15:
|
||||
int[] r1 = r6.COLORFILTER_COLOR_CONTROL_ACTIVATED
|
||||
boolean r1 = r6.arrayContains(r1, r8)
|
||||
if (r1 == 0) goto L20
|
||||
int r8 = androidx.appcompat.R.attr.colorControlActivated
|
||||
goto L11
|
||||
L20:
|
||||
int[] r1 = r6.COLORFILTER_COLOR_BACKGROUND_MULTIPLY
|
||||
boolean r1 = r6.arrayContains(r1, r8)
|
||||
r5 = 16842801(0x1010031, float:2.3693695E-38)
|
||||
if (r1 == 0) goto L32
|
||||
android.graphics.PorterDuff$Mode r0 = android.graphics.PorterDuff.Mode.MULTIPLY
|
||||
L2d:
|
||||
r1 = r0
|
||||
r8 = 16842801(0x1010031, float:2.3693695E-38)
|
||||
goto L12
|
||||
L32:
|
||||
int r1 = androidx.appcompat.R.drawable.abc_list_divider_mtrl_alpha
|
||||
if (r8 != r1) goto L47
|
||||
r8 = 1109603123(0x42233333, float:40.8)
|
||||
int r8 = java.lang.Math.round(r8)
|
||||
r1 = 16842800(0x1010030, float:2.3693693E-38)
|
||||
r1 = r0
|
||||
r5 = 1
|
||||
r0 = r8
|
||||
r8 = 16842800(0x1010030, float:2.3693693E-38)
|
||||
goto L50
|
||||
L47:
|
||||
int r1 = androidx.appcompat.R.drawable.abc_dialog_material_background
|
||||
if (r8 != r1) goto L4c
|
||||
goto L2d
|
||||
L4c:
|
||||
r1 = r0
|
||||
r8 = 0
|
||||
r0 = -1
|
||||
r5 = 0
|
||||
L50:
|
||||
if (r5 == 0) goto L6d
|
||||
boolean r3 = androidx.appcompat.widget.DrawableUtils.canSafelyMutateDrawable(r9)
|
||||
if (r3 == 0) goto L5c
|
||||
android.graphics.drawable.Drawable r9 = r9.mutate()
|
||||
L5c:
|
||||
int r7 = androidx.appcompat.widget.ThemeUtils.getThemeAttrColor(r7, r8)
|
||||
android.graphics.PorterDuffColorFilter r7 = androidx.appcompat.widget.AppCompatDrawableManager.getPorterDuffColorFilter(r7, r1)
|
||||
r9.setColorFilter(r7)
|
||||
if (r0 == r4) goto L6c
|
||||
r9.setAlpha(r0)
|
||||
L6c:
|
||||
return r2
|
||||
L6d:
|
||||
return r3
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AppCompatDrawableManager.AnonymousClass1.tintDrawableUsingColorFilter(android.content.Context, int, android.graphics.drawable.Drawable):boolean");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourceManagerInternal.ResourceManagerHooks
|
||||
public PorterDuff.Mode getTintModeForDrawableRes(int i) {
|
||||
if (i == R.drawable.abc_switch_thumb_material) {
|
||||
return PorterDuff.Mode.MULTIPLY;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized AppCompatDrawableManager get() {
|
||||
AppCompatDrawableManager appCompatDrawableManager;
|
||||
synchronized (AppCompatDrawableManager.class) {
|
||||
if (INSTANCE == null) {
|
||||
preload();
|
||||
}
|
||||
appCompatDrawableManager = INSTANCE;
|
||||
}
|
||||
return appCompatDrawableManager;
|
||||
}
|
||||
|
||||
public synchronized Drawable getDrawable(Context context, int i) {
|
||||
return this.mResourceManager.getDrawable(context, i);
|
||||
}
|
||||
|
||||
synchronized Drawable getDrawable(Context context, int i, boolean z) {
|
||||
return this.mResourceManager.getDrawable(context, i, z);
|
||||
}
|
||||
|
||||
public synchronized void onConfigurationChanged(Context context) {
|
||||
this.mResourceManager.onConfigurationChanged(context);
|
||||
}
|
||||
|
||||
synchronized Drawable onDrawableLoadedFromResources(Context context, VectorEnabledTintResources vectorEnabledTintResources, int i) {
|
||||
return this.mResourceManager.onDrawableLoadedFromResources(context, vectorEnabledTintResources, i);
|
||||
}
|
||||
|
||||
boolean tintDrawableUsingColorFilter(Context context, int i, Drawable drawable) {
|
||||
return this.mResourceManager.tintDrawableUsingColorFilter(context, i, drawable);
|
||||
}
|
||||
|
||||
synchronized ColorStateList getTintList(Context context, int i) {
|
||||
return this.mResourceManager.getTintList(context, i);
|
||||
}
|
||||
|
||||
static void tintDrawable(Drawable drawable, TintInfo tintInfo, int[] iArr) {
|
||||
ResourceManagerInternal.tintDrawable(drawable, tintInfo, iArr);
|
||||
}
|
||||
|
||||
public static synchronized PorterDuffColorFilter getPorterDuffColorFilter(int i, PorterDuff.Mode mode) {
|
||||
PorterDuffColorFilter porterDuffColorFilter;
|
||||
synchronized (AppCompatDrawableManager.class) {
|
||||
porterDuffColorFilter = ResourceManagerInternal.getPorterDuffColorFilter(i, mode);
|
||||
}
|
||||
return porterDuffColorFilter;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
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.text.method.KeyListener;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ActionMode;
|
||||
import android.view.DragEvent;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.view.textclassifier.TextClassifier;
|
||||
import android.widget.EditText;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.core.view.ContentInfoCompat;
|
||||
import androidx.core.view.OnReceiveContentViewBehavior;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.inputmethod.EditorInfoCompat;
|
||||
import androidx.core.view.inputmethod.InputConnectionCompat;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
import androidx.core.widget.TextViewOnReceiveContentListener;
|
||||
import androidx.core.widget.TintableCompoundDrawablesView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatEditText extends EditText implements TintableBackgroundView, OnReceiveContentViewBehavior, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
|
||||
private final AppCompatEmojiEditTextHelper mAppCompatEmojiEditTextHelper;
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private final TextViewOnReceiveContentListener mDefaultOnReceiveContentListener;
|
||||
private SuperCaller mSuperCaller;
|
||||
private final AppCompatTextClassifierHelper mTextClassifierHelper;
|
||||
private final AppCompatTextHelper mTextHelper;
|
||||
|
||||
public AppCompatEditText(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatEditText(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.editTextStyle);
|
||||
}
|
||||
|
||||
public AppCompatEditText(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
|
||||
this.mTextHelper = appCompatTextHelper;
|
||||
appCompatTextHelper.loadFromAttributes(attributeSet, i);
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
this.mTextClassifierHelper = new AppCompatTextClassifierHelper(this);
|
||||
this.mDefaultOnReceiveContentListener = new TextViewOnReceiveContentListener();
|
||||
AppCompatEmojiEditTextHelper appCompatEmojiEditTextHelper = new AppCompatEmojiEditTextHelper(this);
|
||||
this.mAppCompatEmojiEditTextHelper = appCompatEmojiEditTextHelper;
|
||||
appCompatEmojiEditTextHelper.loadFromAttributes(attributeSet, i);
|
||||
initEmojiKeyListener(appCompatEmojiEditTextHelper);
|
||||
}
|
||||
|
||||
void initEmojiKeyListener(AppCompatEmojiEditTextHelper appCompatEmojiEditTextHelper) {
|
||||
KeyListener keyListener = getKeyListener();
|
||||
if (appCompatEmojiEditTextHelper.isEmojiCapableKeyListener(keyListener)) {
|
||||
boolean isFocusable = super.isFocusable();
|
||||
boolean isClickable = super.isClickable();
|
||||
boolean isLongClickable = super.isLongClickable();
|
||||
int inputType = super.getInputType();
|
||||
KeyListener keyListener2 = appCompatEmojiEditTextHelper.getKeyListener(keyListener);
|
||||
if (keyListener2 == keyListener) {
|
||||
return;
|
||||
}
|
||||
super.setKeyListener(keyListener2);
|
||||
super.setRawInputType(inputType);
|
||||
super.setFocusable(isFocusable);
|
||||
super.setClickable(isClickable);
|
||||
super.setLongClickable(isLongClickable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.EditText, android.widget.TextView
|
||||
public Editable getText() {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
return super.getText();
|
||||
}
|
||||
return super.getEditableText();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetTextAppearance(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
|
||||
String[] onReceiveContentMimeTypes;
|
||||
InputConnection onCreateInputConnection = super.onCreateInputConnection(editorInfo);
|
||||
this.mTextHelper.populateSurroundingTextIfNeeded(this, onCreateInputConnection, editorInfo);
|
||||
InputConnection onCreateInputConnection2 = AppCompatHintHelper.onCreateInputConnection(onCreateInputConnection, editorInfo, this);
|
||||
if (onCreateInputConnection2 != null && Build.VERSION.SDK_INT <= 30 && (onReceiveContentMimeTypes = ViewCompat.getOnReceiveContentMimeTypes(this)) != null) {
|
||||
EditorInfoCompat.setContentMimeTypes(editorInfo, onReceiveContentMimeTypes);
|
||||
onCreateInputConnection2 = InputConnectionCompat.createWrapper(this, onCreateInputConnection2, editorInfo);
|
||||
}
|
||||
return this.mAppCompatEmojiEditTextHelper.onCreateInputConnection(onCreateInputConnection2, editorInfo);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
|
||||
super.setCustomSelectionActionModeCallback(TextViewCompat.wrapCustomSelectionActionModeCallback(this, callback));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public ActionMode.Callback getCustomSelectionActionModeCallback() {
|
||||
return TextViewCompat.unwrapCustomSelectionActionModeCallback(super.getCustomSelectionActionModeCallback());
|
||||
}
|
||||
|
||||
private SuperCaller getSuperCaller() {
|
||||
if (this.mSuperCaller == null) {
|
||||
this.mSuperCaller = new SuperCaller();
|
||||
}
|
||||
return this.mSuperCaller;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextClassifier(TextClassifier textClassifier) {
|
||||
AppCompatTextClassifierHelper appCompatTextClassifierHelper;
|
||||
if (Build.VERSION.SDK_INT >= 28 || (appCompatTextClassifierHelper = this.mTextClassifierHelper) == null) {
|
||||
getSuperCaller().setTextClassifier(textClassifier);
|
||||
} else {
|
||||
appCompatTextClassifierHelper.setTextClassifier(textClassifier);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public TextClassifier getTextClassifier() {
|
||||
AppCompatTextClassifierHelper appCompatTextClassifierHelper;
|
||||
if (Build.VERSION.SDK_INT >= 28 || (appCompatTextClassifierHelper = this.mTextClassifierHelper) == null) {
|
||||
return getSuperCaller().getTextClassifier();
|
||||
}
|
||||
return appCompatTextClassifierHelper.getTextClassifier();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public boolean onDragEvent(DragEvent dragEvent) {
|
||||
if (AppCompatReceiveContentHelper.maybeHandleDragEventViaPerformReceiveContent(this, dragEvent)) {
|
||||
return true;
|
||||
}
|
||||
return super.onDragEvent(dragEvent);
|
||||
}
|
||||
|
||||
@Override // android.widget.EditText, android.widget.TextView
|
||||
public boolean onTextContextMenuItem(int i) {
|
||||
if (AppCompatReceiveContentHelper.maybeHandleMenuActionViaPerformReceiveContent(this, i)) {
|
||||
return true;
|
||||
}
|
||||
return super.onTextContextMenuItem(i);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.OnReceiveContentViewBehavior
|
||||
public ContentInfoCompat onReceiveContent(ContentInfoCompat contentInfoCompat) {
|
||||
return this.mDefaultOnReceiveContentListener.onReceiveContent(this, contentInfoCompat);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setKeyListener(KeyListener keyListener) {
|
||||
super.setKeyListener(this.mAppCompatEmojiEditTextHelper.getKeyListener(keyListener));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public void setEmojiCompatEnabled(boolean z) {
|
||||
this.mAppCompatEmojiEditTextHelper.setEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public boolean isEmojiCompatEnabled() {
|
||||
return this.mAppCompatEmojiEditTextHelper.isEnabled();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public ColorStateList getSupportCompoundDrawablesTintList() {
|
||||
return this.mTextHelper.getCompoundDrawableTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
|
||||
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
|
||||
return this.mTextHelper.getCompoundDrawableTintMode();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
|
||||
this.mTextHelper.setCompoundDrawableTintMode(mode);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
class SuperCaller {
|
||||
SuperCaller() {
|
||||
}
|
||||
|
||||
public TextClassifier getTextClassifier() {
|
||||
return AppCompatEditText.super.getTextClassifier();
|
||||
}
|
||||
|
||||
public void setTextClassifier(TextClassifier textClassifier) {
|
||||
AppCompatEditText.super.setTextClassifier(textClassifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.TypedArray;
|
||||
import android.text.method.KeyListener;
|
||||
import android.text.method.NumberKeyListener;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.widget.EditText;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.emoji2.viewsintegration.EmojiEditTextHelper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatEmojiEditTextHelper {
|
||||
private final EmojiEditTextHelper mEmojiEditTextHelper;
|
||||
private final EditText mView;
|
||||
|
||||
AppCompatEmojiEditTextHelper(EditText editText) {
|
||||
this.mView = editText;
|
||||
this.mEmojiEditTextHelper = new EmojiEditTextHelper(editText, false);
|
||||
}
|
||||
|
||||
void loadFromAttributes(AttributeSet attributeSet, int i) {
|
||||
TypedArray obtainStyledAttributes = this.mView.getContext().obtainStyledAttributes(attributeSet, R.styleable.AppCompatTextView, i, 0);
|
||||
try {
|
||||
boolean z = obtainStyledAttributes.hasValue(R.styleable.AppCompatTextView_emojiCompatEnabled) ? obtainStyledAttributes.getBoolean(R.styleable.AppCompatTextView_emojiCompatEnabled, true) : true;
|
||||
obtainStyledAttributes.recycle();
|
||||
setEnabled(z);
|
||||
} catch (Throwable th) {
|
||||
obtainStyledAttributes.recycle();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
boolean isEmojiCapableKeyListener(KeyListener keyListener) {
|
||||
return !(keyListener instanceof NumberKeyListener);
|
||||
}
|
||||
|
||||
void setEnabled(boolean z) {
|
||||
this.mEmojiEditTextHelper.setEnabled(z);
|
||||
}
|
||||
|
||||
boolean isEnabled() {
|
||||
return this.mEmojiEditTextHelper.isEnabled();
|
||||
}
|
||||
|
||||
KeyListener getKeyListener(KeyListener keyListener) {
|
||||
return isEmojiCapableKeyListener(keyListener) ? this.mEmojiEditTextHelper.getKeyListener(keyListener) : keyListener;
|
||||
}
|
||||
|
||||
InputConnection onCreateInputConnection(InputConnection inputConnection, EditorInfo editorInfo) {
|
||||
return this.mEmojiEditTextHelper.onCreateInputConnection(inputConnection, editorInfo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.TypedArray;
|
||||
import android.text.InputFilter;
|
||||
import android.text.method.TransformationMethod;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.emoji2.viewsintegration.EmojiTextViewHelper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatEmojiTextHelper {
|
||||
private final EmojiTextViewHelper mEmojiTextViewHelper;
|
||||
private final TextView mView;
|
||||
|
||||
AppCompatEmojiTextHelper(TextView textView) {
|
||||
this.mView = textView;
|
||||
this.mEmojiTextViewHelper = new EmojiTextViewHelper(textView, false);
|
||||
}
|
||||
|
||||
void loadFromAttributes(AttributeSet attributeSet, int i) {
|
||||
TypedArray obtainStyledAttributes = this.mView.getContext().obtainStyledAttributes(attributeSet, R.styleable.AppCompatTextView, i, 0);
|
||||
try {
|
||||
boolean z = obtainStyledAttributes.hasValue(R.styleable.AppCompatTextView_emojiCompatEnabled) ? obtainStyledAttributes.getBoolean(R.styleable.AppCompatTextView_emojiCompatEnabled, true) : true;
|
||||
obtainStyledAttributes.recycle();
|
||||
setEnabled(z);
|
||||
} catch (Throwable th) {
|
||||
obtainStyledAttributes.recycle();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
void setEnabled(boolean z) {
|
||||
this.mEmojiTextViewHelper.setEnabled(z);
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return this.mEmojiTextViewHelper.isEnabled();
|
||||
}
|
||||
|
||||
InputFilter[] getFilters(InputFilter[] inputFilterArr) {
|
||||
return this.mEmojiTextViewHelper.getFilters(inputFilterArr);
|
||||
}
|
||||
|
||||
void setAllCaps(boolean z) {
|
||||
this.mEmojiTextViewHelper.setAllCaps(z);
|
||||
}
|
||||
|
||||
public TransformationMethod wrapTransformationMethod(TransformationMethod transformationMethod) {
|
||||
return this.mEmojiTextViewHelper.wrapTransformationMethod(transformationMethod);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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 onCreateInputConnection(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).getHint();
|
||||
break;
|
||||
}
|
||||
parent = parent.getParent();
|
||||
}
|
||||
}
|
||||
return inputConnection;
|
||||
}
|
||||
|
||||
private AppCompatHintHelper() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
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;
|
||||
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 mBackgroundTintHelper;
|
||||
private boolean mHasLevel;
|
||||
private final AppCompatImageHelper mImageHelper;
|
||||
|
||||
public AppCompatImageButton(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatImageButton(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.imageButtonStyle);
|
||||
}
|
||||
|
||||
public AppCompatImageButton(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
this.mHasLevel = false;
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatImageHelper appCompatImageHelper = new AppCompatImageHelper(this);
|
||||
this.mImageHelper = appCompatImageHelper;
|
||||
appCompatImageHelper.loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageResource(int i) {
|
||||
this.mImageHelper.setImageResource(i);
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageDrawable(Drawable drawable) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null && drawable != null && !this.mHasLevel) {
|
||||
appCompatImageHelper.obtainLevelFromDrawable(drawable);
|
||||
}
|
||||
super.setImageDrawable(drawable);
|
||||
AppCompatImageHelper appCompatImageHelper2 = this.mImageHelper;
|
||||
if (appCompatImageHelper2 != null) {
|
||||
appCompatImageHelper2.applySupportImageTint();
|
||||
if (this.mHasLevel) {
|
||||
return;
|
||||
}
|
||||
this.mImageHelper.applyImageLevel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageBitmap(Bitmap bitmap) {
|
||||
super.setImageBitmap(bitmap);
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.applySupportImageTint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageURI(Uri uri) {
|
||||
super.setImageURI(uri);
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.applySupportImageTint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public void setSupportImageTintList(ColorStateList colorStateList) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.setSupportImageTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public ColorStateList getSupportImageTintList() {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
return appCompatImageHelper.getSupportImageTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public void setSupportImageTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.setSupportImageTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public PorterDuff.Mode getSupportImageTintMode() {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
return appCompatImageHelper.getSupportImageTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.applySupportImageTint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView, android.view.View
|
||||
public boolean hasOverlappingRendering() {
|
||||
return this.mImageHelper.hasOverlappingRendering() && super.hasOverlappingRendering();
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageLevel(int i) {
|
||||
super.setImageLevel(i);
|
||||
this.mHasLevel = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
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;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.widget.ImageViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatImageHelper {
|
||||
private TintInfo mImageTint;
|
||||
private TintInfo mInternalImageTint;
|
||||
private int mLevel = 0;
|
||||
private TintInfo mTmpInfo;
|
||||
private final ImageView mView;
|
||||
|
||||
private boolean shouldApplyFrameworkTintUsingColorFilter() {
|
||||
int i = Build.VERSION.SDK_INT;
|
||||
return i > 21 ? this.mInternalImageTint != null : i == 21;
|
||||
}
|
||||
|
||||
public AppCompatImageHelper(ImageView imageView) {
|
||||
this.mView = imageView;
|
||||
}
|
||||
|
||||
public void loadFromAttributes(AttributeSet attributeSet, int i) {
|
||||
int resourceId;
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(this.mView.getContext(), attributeSet, R.styleable.AppCompatImageView, i, 0);
|
||||
ImageView imageView = this.mView;
|
||||
ViewCompat.saveAttributeDataForStyleable(imageView, imageView.getContext(), R.styleable.AppCompatImageView, attributeSet, obtainStyledAttributes.getWrappedTypeArray(), i, 0);
|
||||
try {
|
||||
Drawable drawable = this.mView.getDrawable();
|
||||
if (drawable == null && (resourceId = obtainStyledAttributes.getResourceId(R.styleable.AppCompatImageView_srcCompat, -1)) != -1 && (drawable = AppCompatResources.getDrawable(this.mView.getContext(), resourceId)) != null) {
|
||||
this.mView.setImageDrawable(drawable);
|
||||
}
|
||||
if (drawable != null) {
|
||||
DrawableUtils.fixDrawable(drawable);
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatImageView_tint)) {
|
||||
ImageViewCompat.setImageTintList(this.mView, obtainStyledAttributes.getColorStateList(R.styleable.AppCompatImageView_tint));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatImageView_tintMode)) {
|
||||
ImageViewCompat.setImageTintMode(this.mView, DrawableUtils.parseTintMode(obtainStyledAttributes.getInt(R.styleable.AppCompatImageView_tintMode, -1), null));
|
||||
}
|
||||
} finally {
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
public void setImageResource(int i) {
|
||||
if (i != 0) {
|
||||
Drawable drawable = AppCompatResources.getDrawable(this.mView.getContext(), i);
|
||||
if (drawable != null) {
|
||||
DrawableUtils.fixDrawable(drawable);
|
||||
}
|
||||
this.mView.setImageDrawable(drawable);
|
||||
} else {
|
||||
this.mView.setImageDrawable(null);
|
||||
}
|
||||
applySupportImageTint();
|
||||
}
|
||||
|
||||
boolean hasOverlappingRendering() {
|
||||
return !(this.mView.getBackground() instanceof RippleDrawable);
|
||||
}
|
||||
|
||||
void setSupportImageTintList(ColorStateList colorStateList) {
|
||||
if (this.mImageTint == null) {
|
||||
this.mImageTint = new TintInfo();
|
||||
}
|
||||
this.mImageTint.mTintList = colorStateList;
|
||||
this.mImageTint.mHasTintList = true;
|
||||
applySupportImageTint();
|
||||
}
|
||||
|
||||
ColorStateList getSupportImageTintList() {
|
||||
TintInfo tintInfo = this.mImageTint;
|
||||
if (tintInfo != null) {
|
||||
return tintInfo.mTintList;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void setSupportImageTintMode(PorterDuff.Mode mode) {
|
||||
if (this.mImageTint == null) {
|
||||
this.mImageTint = new TintInfo();
|
||||
}
|
||||
this.mImageTint.mTintMode = mode;
|
||||
this.mImageTint.mHasTintMode = true;
|
||||
applySupportImageTint();
|
||||
}
|
||||
|
||||
PorterDuff.Mode getSupportImageTintMode() {
|
||||
TintInfo tintInfo = this.mImageTint;
|
||||
if (tintInfo != null) {
|
||||
return tintInfo.mTintMode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void applySupportImageTint() {
|
||||
Drawable drawable = this.mView.getDrawable();
|
||||
if (drawable != null) {
|
||||
DrawableUtils.fixDrawable(drawable);
|
||||
}
|
||||
if (drawable != null) {
|
||||
if (shouldApplyFrameworkTintUsingColorFilter() && applyFrameworkTintUsingColorFilter(drawable)) {
|
||||
return;
|
||||
}
|
||||
TintInfo tintInfo = this.mImageTint;
|
||||
if (tintInfo != null) {
|
||||
AppCompatDrawableManager.tintDrawable(drawable, tintInfo, this.mView.getDrawableState());
|
||||
return;
|
||||
}
|
||||
TintInfo tintInfo2 = this.mInternalImageTint;
|
||||
if (tintInfo2 != null) {
|
||||
AppCompatDrawableManager.tintDrawable(drawable, tintInfo2, this.mView.getDrawableState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setInternalImageTint(ColorStateList colorStateList) {
|
||||
if (colorStateList != null) {
|
||||
if (this.mInternalImageTint == null) {
|
||||
this.mInternalImageTint = new TintInfo();
|
||||
}
|
||||
this.mInternalImageTint.mTintList = colorStateList;
|
||||
this.mInternalImageTint.mHasTintList = true;
|
||||
} else {
|
||||
this.mInternalImageTint = null;
|
||||
}
|
||||
applySupportImageTint();
|
||||
}
|
||||
|
||||
private boolean applyFrameworkTintUsingColorFilter(Drawable drawable) {
|
||||
if (this.mTmpInfo == null) {
|
||||
this.mTmpInfo = new TintInfo();
|
||||
}
|
||||
TintInfo tintInfo = this.mTmpInfo;
|
||||
tintInfo.clear();
|
||||
ColorStateList imageTintList = ImageViewCompat.getImageTintList(this.mView);
|
||||
if (imageTintList != null) {
|
||||
tintInfo.mHasTintList = true;
|
||||
tintInfo.mTintList = imageTintList;
|
||||
}
|
||||
PorterDuff.Mode imageTintMode = ImageViewCompat.getImageTintMode(this.mView);
|
||||
if (imageTintMode != null) {
|
||||
tintInfo.mHasTintMode = true;
|
||||
tintInfo.mTintMode = imageTintMode;
|
||||
}
|
||||
if (!tintInfo.mHasTintList && !tintInfo.mHasTintMode) {
|
||||
return false;
|
||||
}
|
||||
AppCompatDrawableManager.tintDrawable(drawable, tintInfo, this.mView.getDrawableState());
|
||||
return true;
|
||||
}
|
||||
|
||||
void obtainLevelFromDrawable(Drawable drawable) {
|
||||
this.mLevel = drawable.getLevel();
|
||||
}
|
||||
|
||||
void applyImageLevel() {
|
||||
if (this.mView.getDrawable() != null) {
|
||||
this.mView.getDrawable().setLevel(this.mLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
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 mBackgroundTintHelper;
|
||||
private boolean mHasLevel;
|
||||
private final AppCompatImageHelper mImageHelper;
|
||||
|
||||
public AppCompatImageView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatImageView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public AppCompatImageView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
this.mHasLevel = false;
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatImageHelper appCompatImageHelper = new AppCompatImageHelper(this);
|
||||
this.mImageHelper = appCompatImageHelper;
|
||||
appCompatImageHelper.loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageResource(int i) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.setImageResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageDrawable(Drawable drawable) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null && drawable != null && !this.mHasLevel) {
|
||||
appCompatImageHelper.obtainLevelFromDrawable(drawable);
|
||||
}
|
||||
super.setImageDrawable(drawable);
|
||||
AppCompatImageHelper appCompatImageHelper2 = this.mImageHelper;
|
||||
if (appCompatImageHelper2 != null) {
|
||||
appCompatImageHelper2.applySupportImageTint();
|
||||
if (this.mHasLevel) {
|
||||
return;
|
||||
}
|
||||
this.mImageHelper.applyImageLevel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageBitmap(Bitmap bitmap) {
|
||||
super.setImageBitmap(bitmap);
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.applySupportImageTint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageURI(Uri uri) {
|
||||
super.setImageURI(uri);
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.applySupportImageTint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public void setSupportImageTintList(ColorStateList colorStateList) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.setSupportImageTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public ColorStateList getSupportImageTintList() {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
return appCompatImageHelper.getSupportImageTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public void setSupportImageTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.setSupportImageTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableImageSourceView
|
||||
public PorterDuff.Mode getSupportImageTintMode() {
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
return appCompatImageHelper.getSupportImageTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
|
||||
if (appCompatImageHelper != null) {
|
||||
appCompatImageHelper.applySupportImageTint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView, android.view.View
|
||||
public boolean hasOverlappingRendering() {
|
||||
return this.mImageHelper.hasOverlappingRendering() && super.hasOverlappingRendering();
|
||||
}
|
||||
|
||||
@Override // android.widget.ImageView
|
||||
public void setImageLevel(int i) {
|
||||
super.setImageLevel(i);
|
||||
this.mHasLevel = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
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.text.method.KeyListener;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.widget.MultiAutoCompleteTextView;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TintableCompoundDrawablesView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatMultiAutoCompleteTextView extends MultiAutoCompleteTextView implements TintableBackgroundView, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
|
||||
private static final int[] TINT_ATTRS = {R.attr.popupBackground};
|
||||
private final AppCompatEmojiEditTextHelper mAppCompatEmojiEditTextHelper;
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private final AppCompatTextHelper mTextHelper;
|
||||
|
||||
public AppCompatMultiAutoCompleteTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatMultiAutoCompleteTextView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, androidx.appcompat.R.attr.autoCompleteTextViewStyle);
|
||||
}
|
||||
|
||||
public AppCompatMultiAutoCompleteTextView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(getContext(), attributeSet, TINT_ATTRS, i, 0);
|
||||
if (obtainStyledAttributes.hasValue(0)) {
|
||||
setDropDownBackgroundDrawable(obtainStyledAttributes.getDrawable(0));
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
|
||||
this.mTextHelper = appCompatTextHelper;
|
||||
appCompatTextHelper.loadFromAttributes(attributeSet, i);
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
AppCompatEmojiEditTextHelper appCompatEmojiEditTextHelper = new AppCompatEmojiEditTextHelper(this);
|
||||
this.mAppCompatEmojiEditTextHelper = appCompatEmojiEditTextHelper;
|
||||
appCompatEmojiEditTextHelper.loadFromAttributes(attributeSet, i);
|
||||
initEmojiKeyListener(appCompatEmojiEditTextHelper);
|
||||
}
|
||||
|
||||
void initEmojiKeyListener(AppCompatEmojiEditTextHelper appCompatEmojiEditTextHelper) {
|
||||
KeyListener keyListener = getKeyListener();
|
||||
if (appCompatEmojiEditTextHelper.isEmojiCapableKeyListener(keyListener)) {
|
||||
boolean isFocusable = super.isFocusable();
|
||||
boolean isClickable = super.isClickable();
|
||||
boolean isLongClickable = super.isLongClickable();
|
||||
int inputType = super.getInputType();
|
||||
KeyListener keyListener2 = appCompatEmojiEditTextHelper.getKeyListener(keyListener);
|
||||
if (keyListener2 == keyListener) {
|
||||
return;
|
||||
}
|
||||
super.setKeyListener(keyListener2);
|
||||
super.setRawInputType(inputType);
|
||||
super.setFocusable(isFocusable);
|
||||
super.setClickable(isClickable);
|
||||
super.setLongClickable(isLongClickable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.AutoCompleteTextView
|
||||
public void setDropDownBackgroundResource(int i) {
|
||||
setDropDownBackgroundDrawable(AppCompatResources.getDrawable(getContext(), i));
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetTextAppearance(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
|
||||
return this.mAppCompatEmojiEditTextHelper.onCreateInputConnection(AppCompatHintHelper.onCreateInputConnection(super.onCreateInputConnection(editorInfo), editorInfo, this), editorInfo);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setKeyListener(KeyListener keyListener) {
|
||||
super.setKeyListener(this.mAppCompatEmojiEditTextHelper.getKeyListener(keyListener));
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public void setEmojiCompatEnabled(boolean z) {
|
||||
this.mAppCompatEmojiEditTextHelper.setEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public boolean isEmojiCompatEnabled() {
|
||||
return this.mAppCompatEmojiEditTextHelper.isEnabled();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public ColorStateList getSupportCompoundDrawablesTintList() {
|
||||
return this.mTextHelper.getCompoundDrawableTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
|
||||
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
|
||||
return this.mTextHelper.getCompoundDrawableTintMode();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
|
||||
this.mTextHelper.setCompoundDrawableTintMode(mode);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.PopupWindow;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.core.widget.PopupWindowCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatPopupWindow extends PopupWindow {
|
||||
private static final boolean COMPAT_OVERLAP_ANCHOR = false;
|
||||
private boolean mOverlapAnchor;
|
||||
|
||||
public AppCompatPopupWindow(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
init(context, attributeSet, i, 0);
|
||||
}
|
||||
|
||||
public AppCompatPopupWindow(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
super(context, attributeSet, i, i2);
|
||||
init(context, attributeSet, i, i2);
|
||||
}
|
||||
|
||||
private void init(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, attributeSet, R.styleable.PopupWindow, i, i2);
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.PopupWindow_overlapAnchor)) {
|
||||
setSupportOverlapAnchor(obtainStyledAttributes.getBoolean(R.styleable.PopupWindow_overlapAnchor, false));
|
||||
}
|
||||
setBackgroundDrawable(obtainStyledAttributes.getDrawable(R.styleable.PopupWindow_android_popupBackground));
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
@Override // android.widget.PopupWindow
|
||||
public void showAsDropDown(View view, int i, int i2) {
|
||||
if (COMPAT_OVERLAP_ANCHOR && this.mOverlapAnchor) {
|
||||
i2 -= view.getHeight();
|
||||
}
|
||||
super.showAsDropDown(view, i, i2);
|
||||
}
|
||||
|
||||
@Override // android.widget.PopupWindow
|
||||
public void showAsDropDown(View view, int i, int i2, int i3) {
|
||||
if (COMPAT_OVERLAP_ANCHOR && this.mOverlapAnchor) {
|
||||
i2 -= view.getHeight();
|
||||
}
|
||||
super.showAsDropDown(view, i, i2, i3);
|
||||
}
|
||||
|
||||
@Override // android.widget.PopupWindow
|
||||
public void update(View view, int i, int i2, int i3, int i4) {
|
||||
if (COMPAT_OVERLAP_ANCHOR && this.mOverlapAnchor) {
|
||||
i2 -= view.getHeight();
|
||||
}
|
||||
super.update(view, i, i2, i3, i4);
|
||||
}
|
||||
|
||||
private void setSupportOverlapAnchor(boolean z) {
|
||||
if (COMPAT_OVERLAP_ANCHOR) {
|
||||
this.mOverlapAnchor = z;
|
||||
} else {
|
||||
PopupWindowCompat.setOverlapAnchor(this, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
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.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ProgressBar;
|
||||
import androidx.core.graphics.drawable.WrappedDrawable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatProgressBarHelper {
|
||||
private static final int[] TINT_ATTRS = {R.attr.indeterminateDrawable, R.attr.progressDrawable};
|
||||
private Bitmap mSampleTile;
|
||||
private final ProgressBar mView;
|
||||
|
||||
Bitmap getSampleTile() {
|
||||
return this.mSampleTile;
|
||||
}
|
||||
|
||||
AppCompatProgressBarHelper(ProgressBar progressBar) {
|
||||
this.mView = progressBar;
|
||||
}
|
||||
|
||||
void loadFromAttributes(AttributeSet attributeSet, int i) {
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(this.mView.getContext(), attributeSet, TINT_ATTRS, i, 0);
|
||||
Drawable drawableIfKnown = obtainStyledAttributes.getDrawableIfKnown(0);
|
||||
if (drawableIfKnown != null) {
|
||||
this.mView.setIndeterminateDrawable(tileifyIndeterminate(drawableIfKnown));
|
||||
}
|
||||
Drawable drawableIfKnown2 = obtainStyledAttributes.getDrawableIfKnown(1);
|
||||
if (drawableIfKnown2 != null) {
|
||||
this.mView.setProgressDrawable(tileify(drawableIfKnown2, false));
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
Drawable tileify(Drawable drawable, boolean z) {
|
||||
if (drawable instanceof WrappedDrawable) {
|
||||
WrappedDrawable wrappedDrawable = (WrappedDrawable) drawable;
|
||||
Drawable wrappedDrawable2 = wrappedDrawable.getWrappedDrawable();
|
||||
if (wrappedDrawable2 != null) {
|
||||
wrappedDrawable.setWrappedDrawable(tileify(wrappedDrawable2, z));
|
||||
}
|
||||
} else {
|
||||
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] = tileify(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));
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
Api23Impl.transferLayerProperties(layerDrawable, layerDrawable2, i2);
|
||||
}
|
||||
}
|
||||
return layerDrawable2;
|
||||
}
|
||||
if (drawable instanceof BitmapDrawable) {
|
||||
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
|
||||
Bitmap bitmap = bitmapDrawable.getBitmap();
|
||||
if (this.mSampleTile == null) {
|
||||
this.mSampleTile = bitmap;
|
||||
}
|
||||
ShapeDrawable shapeDrawable = new ShapeDrawable(getDrawableShape());
|
||||
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;
|
||||
}
|
||||
}
|
||||
return drawable;
|
||||
}
|
||||
|
||||
private Drawable tileifyIndeterminate(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 tileify = tileify(animationDrawable.getFrame(i), true);
|
||||
tileify.setLevel(10000);
|
||||
animationDrawable2.addFrame(tileify, animationDrawable.getDuration(i));
|
||||
}
|
||||
animationDrawable2.setLevel(10000);
|
||||
return animationDrawable2;
|
||||
}
|
||||
|
||||
private Shape getDrawableShape() {
|
||||
return new RoundRectShape(new float[]{5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f}, null, null);
|
||||
}
|
||||
|
||||
private static class Api23Impl {
|
||||
private Api23Impl() {
|
||||
}
|
||||
|
||||
public static void transferLayerProperties(LayerDrawable layerDrawable, LayerDrawable layerDrawable2, int i) {
|
||||
layerDrawable2.setLayerGravity(i, layerDrawable.getLayerGravity(i));
|
||||
layerDrawable2.setLayerWidth(i, layerDrawable.getLayerWidth(i));
|
||||
layerDrawable2.setLayerHeight(i, layerDrawable.getLayerHeight(i));
|
||||
layerDrawable2.setLayerInsetLeft(i, layerDrawable.getLayerInsetLeft(i));
|
||||
layerDrawable2.setLayerInsetRight(i, layerDrawable.getLayerInsetRight(i));
|
||||
layerDrawable2.setLayerInsetTop(i, layerDrawable.getLayerInsetTop(i));
|
||||
layerDrawable2.setLayerInsetBottom(i, layerDrawable.getLayerInsetBottom(i));
|
||||
layerDrawable2.setLayerInsetStart(i, layerDrawable.getLayerInsetStart(i));
|
||||
layerDrawable2.setLayerInsetEnd(i, layerDrawable.getLayerInsetEnd(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.InputFilter;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.RadioButton;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TintableCompoundButton;
|
||||
import androidx.core.widget.TintableCompoundDrawablesView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatRadioButton extends RadioButton implements TintableCompoundButton, TintableBackgroundView, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
|
||||
private AppCompatEmojiTextHelper mAppCompatEmojiTextHelper;
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private final AppCompatCompoundButtonHelper mCompoundButtonHelper;
|
||||
private final AppCompatTextHelper mTextHelper;
|
||||
|
||||
public AppCompatRadioButton(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatRadioButton(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.radioButtonStyle);
|
||||
}
|
||||
|
||||
public AppCompatRadioButton(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = new AppCompatCompoundButtonHelper(this);
|
||||
this.mCompoundButtonHelper = appCompatCompoundButtonHelper;
|
||||
appCompatCompoundButtonHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
|
||||
this.mTextHelper = appCompatTextHelper;
|
||||
appCompatTextHelper.loadFromAttributes(attributeSet, i);
|
||||
getEmojiTextViewHelper().loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
private AppCompatEmojiTextHelper getEmojiTextViewHelper() {
|
||||
if (this.mAppCompatEmojiTextHelper == null) {
|
||||
this.mAppCompatEmojiTextHelper = new AppCompatEmojiTextHelper(this);
|
||||
}
|
||||
return this.mAppCompatEmojiTextHelper;
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton
|
||||
public void setButtonDrawable(Drawable drawable) {
|
||||
super.setButtonDrawable(drawable);
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.onSetButtonDrawable();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton
|
||||
public void setButtonDrawable(int i) {
|
||||
setButtonDrawable(AppCompatResources.getDrawable(getContext(), i));
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton, android.widget.TextView
|
||||
public int getCompoundPaddingLeft() {
|
||||
int compoundPaddingLeft = super.getCompoundPaddingLeft();
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
return appCompatCompoundButtonHelper != null ? appCompatCompoundButtonHelper.getCompoundPaddingLeft(compoundPaddingLeft) : compoundPaddingLeft;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public void setSupportButtonTintList(ColorStateList colorStateList) {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.setSupportButtonTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public ColorStateList getSupportButtonTintList() {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
return appCompatCompoundButtonHelper.getSupportButtonTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public void setSupportButtonTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
appCompatCompoundButtonHelper.setSupportButtonTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundButton
|
||||
public PorterDuff.Mode getSupportButtonTintMode() {
|
||||
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
|
||||
if (appCompatCompoundButtonHelper != null) {
|
||||
return appCompatCompoundButtonHelper.getSupportButtonTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setFilters(InputFilter[] inputFilterArr) {
|
||||
super.setFilters(getEmojiTextViewHelper().getFilters(inputFilterArr));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setAllCaps(boolean z) {
|
||||
super.setAllCaps(z);
|
||||
getEmojiTextViewHelper().setAllCaps(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public void setEmojiCompatEnabled(boolean z) {
|
||||
getEmojiTextViewHelper().setEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public boolean isEmojiCompatEnabled() {
|
||||
return getEmojiTextViewHelper().isEnabled();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public ColorStateList getSupportCompoundDrawablesTintList() {
|
||||
return this.mTextHelper.getCompoundDrawableTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
|
||||
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
|
||||
return this.mTextHelper.getCompoundDrawableTintMode();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
|
||||
this.mTextHelper.setCompoundDrawableTintMode(mode);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
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;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatRatingBar extends RatingBar {
|
||||
private final AppCompatProgressBarHelper mAppCompatProgressBarHelper;
|
||||
|
||||
public AppCompatRatingBar(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatRatingBar(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.ratingBarStyle);
|
||||
}
|
||||
|
||||
public AppCompatRatingBar(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatProgressBarHelper appCompatProgressBarHelper = new AppCompatProgressBarHelper(this);
|
||||
this.mAppCompatProgressBarHelper = appCompatProgressBarHelper;
|
||||
appCompatProgressBarHelper.loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
@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 sampleTile = this.mAppCompatProgressBarHelper.getSampleTile();
|
||||
if (sampleTile != null) {
|
||||
setMeasuredDimension(View.resolveSizeAndState(sampleTile.getWidth() * getNumStars(), i, 0), getMeasuredHeight());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.os.Build;
|
||||
import android.text.Selection;
|
||||
import android.text.Spannable;
|
||||
import android.util.Log;
|
||||
import android.view.DragEvent;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import androidx.core.view.ContentInfoCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class AppCompatReceiveContentHelper {
|
||||
private static final String LOG_TAG = "ReceiveContent";
|
||||
|
||||
private AppCompatReceiveContentHelper() {
|
||||
}
|
||||
|
||||
static boolean maybeHandleMenuActionViaPerformReceiveContent(TextView textView, int i) {
|
||||
if (Build.VERSION.SDK_INT >= 31 || ViewCompat.getOnReceiveContentMimeTypes(textView) == null || !(i == 16908322 || i == 16908337)) {
|
||||
return false;
|
||||
}
|
||||
ClipboardManager clipboardManager = (ClipboardManager) textView.getContext().getSystemService("clipboard");
|
||||
ClipData primaryClip = clipboardManager == null ? null : clipboardManager.getPrimaryClip();
|
||||
if (primaryClip != null && primaryClip.getItemCount() > 0) {
|
||||
ViewCompat.performReceiveContent(textView, new ContentInfoCompat.Builder(primaryClip, 1).setFlags(i != 16908322 ? 1 : 0).build());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean maybeHandleDragEventViaPerformReceiveContent(View view, DragEvent dragEvent) {
|
||||
if (Build.VERSION.SDK_INT < 31 && Build.VERSION.SDK_INT >= 24 && dragEvent.getLocalState() == null && ViewCompat.getOnReceiveContentMimeTypes(view) != null) {
|
||||
Activity tryGetActivity = tryGetActivity(view);
|
||||
if (tryGetActivity == null) {
|
||||
Log.i(LOG_TAG, "Can't handle drop: no activity: view=" + view);
|
||||
return false;
|
||||
}
|
||||
if (dragEvent.getAction() == 1) {
|
||||
return !(view instanceof TextView);
|
||||
}
|
||||
if (dragEvent.getAction() == 3) {
|
||||
if (view instanceof TextView) {
|
||||
return OnDropApi24Impl.onDropForTextView(dragEvent, (TextView) view, tryGetActivity);
|
||||
}
|
||||
return OnDropApi24Impl.onDropForView(dragEvent, view, tryGetActivity);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final class OnDropApi24Impl {
|
||||
private OnDropApi24Impl() {
|
||||
}
|
||||
|
||||
static boolean onDropForTextView(DragEvent dragEvent, TextView textView, Activity activity) {
|
||||
activity.requestDragAndDropPermissions(dragEvent);
|
||||
int offsetForPosition = textView.getOffsetForPosition(dragEvent.getX(), dragEvent.getY());
|
||||
textView.beginBatchEdit();
|
||||
try {
|
||||
Selection.setSelection((Spannable) textView.getText(), offsetForPosition);
|
||||
ViewCompat.performReceiveContent(textView, new ContentInfoCompat.Builder(dragEvent.getClipData(), 3).build());
|
||||
textView.endBatchEdit();
|
||||
return true;
|
||||
} catch (Throwable th) {
|
||||
textView.endBatchEdit();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
static boolean onDropForView(DragEvent dragEvent, View view, Activity activity) {
|
||||
activity.requestDragAndDropPermissions(dragEvent);
|
||||
ViewCompat.performReceiveContent(view, new ContentInfoCompat.Builder(dragEvent.getClipData(), 3).build());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static Activity tryGetActivity(View view) {
|
||||
for (Context context = view.getContext(); context instanceof ContextWrapper; context = ((ContextWrapper) context).getBaseContext()) {
|
||||
if (context instanceof Activity) {
|
||||
return (Activity) context;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.SeekBar;
|
||||
import androidx.appcompat.R;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatSeekBar extends SeekBar {
|
||||
private final AppCompatSeekBarHelper mAppCompatSeekBarHelper;
|
||||
|
||||
public AppCompatSeekBar(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatSeekBar(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.seekBarStyle);
|
||||
}
|
||||
|
||||
public AppCompatSeekBar(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatSeekBarHelper appCompatSeekBarHelper = new AppCompatSeekBarHelper(this);
|
||||
this.mAppCompatSeekBarHelper = appCompatSeekBarHelper;
|
||||
appCompatSeekBarHelper.loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsSeekBar, android.widget.ProgressBar, android.view.View
|
||||
protected synchronized void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
this.mAppCompatSeekBarHelper.drawTickMarks(canvas);
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsSeekBar, android.widget.ProgressBar, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
this.mAppCompatSeekBarHelper.drawableStateChanged();
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsSeekBar, android.widget.ProgressBar, android.view.View
|
||||
public void jumpDrawablesToCurrentState() {
|
||||
super.jumpDrawablesToCurrentState();
|
||||
this.mAppCompatSeekBarHelper.jumpDrawablesToCurrentState();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
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;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatSeekBarHelper extends AppCompatProgressBarHelper {
|
||||
private boolean mHasTickMarkTint;
|
||||
private boolean mHasTickMarkTintMode;
|
||||
private Drawable mTickMark;
|
||||
private ColorStateList mTickMarkTintList;
|
||||
private PorterDuff.Mode mTickMarkTintMode;
|
||||
private final SeekBar mView;
|
||||
|
||||
Drawable getTickMark() {
|
||||
return this.mTickMark;
|
||||
}
|
||||
|
||||
ColorStateList getTickMarkTintList() {
|
||||
return this.mTickMarkTintList;
|
||||
}
|
||||
|
||||
PorterDuff.Mode getTickMarkTintMode() {
|
||||
return this.mTickMarkTintMode;
|
||||
}
|
||||
|
||||
AppCompatSeekBarHelper(SeekBar seekBar) {
|
||||
super(seekBar);
|
||||
this.mTickMarkTintList = null;
|
||||
this.mTickMarkTintMode = null;
|
||||
this.mHasTickMarkTint = false;
|
||||
this.mHasTickMarkTintMode = false;
|
||||
this.mView = seekBar;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatProgressBarHelper
|
||||
void loadFromAttributes(AttributeSet attributeSet, int i) {
|
||||
super.loadFromAttributes(attributeSet, i);
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(this.mView.getContext(), attributeSet, R.styleable.AppCompatSeekBar, i, 0);
|
||||
SeekBar seekBar = this.mView;
|
||||
ViewCompat.saveAttributeDataForStyleable(seekBar, seekBar.getContext(), R.styleable.AppCompatSeekBar, attributeSet, obtainStyledAttributes.getWrappedTypeArray(), i, 0);
|
||||
Drawable drawableIfKnown = obtainStyledAttributes.getDrawableIfKnown(R.styleable.AppCompatSeekBar_android_thumb);
|
||||
if (drawableIfKnown != null) {
|
||||
this.mView.setThumb(drawableIfKnown);
|
||||
}
|
||||
setTickMark(obtainStyledAttributes.getDrawable(R.styleable.AppCompatSeekBar_tickMark));
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatSeekBar_tickMarkTintMode)) {
|
||||
this.mTickMarkTintMode = DrawableUtils.parseTintMode(obtainStyledAttributes.getInt(R.styleable.AppCompatSeekBar_tickMarkTintMode, -1), this.mTickMarkTintMode);
|
||||
this.mHasTickMarkTintMode = true;
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatSeekBar_tickMarkTint)) {
|
||||
this.mTickMarkTintList = obtainStyledAttributes.getColorStateList(R.styleable.AppCompatSeekBar_tickMarkTint);
|
||||
this.mHasTickMarkTint = true;
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
applyTickMarkTint();
|
||||
}
|
||||
|
||||
void setTickMark(Drawable drawable) {
|
||||
Drawable drawable2 = this.mTickMark;
|
||||
if (drawable2 != null) {
|
||||
drawable2.setCallback(null);
|
||||
}
|
||||
this.mTickMark = drawable;
|
||||
if (drawable != null) {
|
||||
drawable.setCallback(this.mView);
|
||||
DrawableCompat.setLayoutDirection(drawable, ViewCompat.getLayoutDirection(this.mView));
|
||||
if (drawable.isStateful()) {
|
||||
drawable.setState(this.mView.getDrawableState());
|
||||
}
|
||||
applyTickMarkTint();
|
||||
}
|
||||
this.mView.invalidate();
|
||||
}
|
||||
|
||||
void setTickMarkTintList(ColorStateList colorStateList) {
|
||||
this.mTickMarkTintList = colorStateList;
|
||||
this.mHasTickMarkTint = true;
|
||||
applyTickMarkTint();
|
||||
}
|
||||
|
||||
void setTickMarkTintMode(PorterDuff.Mode mode) {
|
||||
this.mTickMarkTintMode = mode;
|
||||
this.mHasTickMarkTintMode = true;
|
||||
applyTickMarkTint();
|
||||
}
|
||||
|
||||
private void applyTickMarkTint() {
|
||||
Drawable drawable = this.mTickMark;
|
||||
if (drawable != null) {
|
||||
if (this.mHasTickMarkTint || this.mHasTickMarkTintMode) {
|
||||
Drawable wrap = DrawableCompat.wrap(drawable.mutate());
|
||||
this.mTickMark = wrap;
|
||||
if (this.mHasTickMarkTint) {
|
||||
DrawableCompat.setTintList(wrap, this.mTickMarkTintList);
|
||||
}
|
||||
if (this.mHasTickMarkTintMode) {
|
||||
DrawableCompat.setTintMode(this.mTickMark, this.mTickMarkTintMode);
|
||||
}
|
||||
if (this.mTickMark.isStateful()) {
|
||||
this.mTickMark.setState(this.mView.getDrawableState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void jumpDrawablesToCurrentState() {
|
||||
Drawable drawable = this.mTickMark;
|
||||
if (drawable != null) {
|
||||
drawable.jumpToCurrentState();
|
||||
}
|
||||
}
|
||||
|
||||
void drawableStateChanged() {
|
||||
Drawable drawable = this.mTickMark;
|
||||
if (drawable != null && drawable.isStateful() && drawable.setState(this.mView.getDrawableState())) {
|
||||
this.mView.invalidateDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
void drawTickMarks(Canvas canvas) {
|
||||
if (this.mTickMark != null) {
|
||||
int max = this.mView.getMax();
|
||||
if (max > 1) {
|
||||
int intrinsicWidth = this.mTickMark.getIntrinsicWidth();
|
||||
int intrinsicHeight = this.mTickMark.getIntrinsicHeight();
|
||||
int i = intrinsicWidth >= 0 ? intrinsicWidth / 2 : 1;
|
||||
int i2 = intrinsicHeight >= 0 ? intrinsicHeight / 2 : 1;
|
||||
this.mTickMark.setBounds(-i, -i2, i, i2);
|
||||
float width = ((this.mView.getWidth() - this.mView.getPaddingLeft()) - this.mView.getPaddingRight()) / max;
|
||||
int save = canvas.save();
|
||||
canvas.translate(this.mView.getPaddingLeft(), this.mView.getHeight() / 2);
|
||||
for (int i3 = 0; i3 <= max; i3++) {
|
||||
this.mTickMark.draw(canvas);
|
||||
canvas.translate(width, 0.0f);
|
||||
}
|
||||
canvas.restoreToCount(save);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,840 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
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.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
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.ListView;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.SpinnerAdapter;
|
||||
import androidx.activity.ComponentDialog$$ExternalSyntheticApiModelOutline0;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.util.ObjectsCompat;
|
||||
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[] ATTRS_ANDROID_SPINNERMODE = {R.attr.spinnerMode};
|
||||
private static final int MAX_ITEMS_MEASURED = 15;
|
||||
private static final int MODE_DIALOG = 0;
|
||||
private static final int MODE_DROPDOWN = 1;
|
||||
private static final int MODE_THEME = -1;
|
||||
private static final String TAG = "AppCompatSpinner";
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
int mDropDownWidth;
|
||||
private ForwardingListener mForwardingListener;
|
||||
private SpinnerPopup mPopup;
|
||||
private final Context mPopupContext;
|
||||
private final boolean mPopupSet;
|
||||
private SpinnerAdapter mTempAdapter;
|
||||
final Rect mTempRect;
|
||||
|
||||
interface SpinnerPopup {
|
||||
void dismiss();
|
||||
|
||||
Drawable getBackground();
|
||||
|
||||
CharSequence getHintText();
|
||||
|
||||
int getHorizontalOffset();
|
||||
|
||||
int getHorizontalOriginalOffset();
|
||||
|
||||
int getVerticalOffset();
|
||||
|
||||
boolean isShowing();
|
||||
|
||||
void setAdapter(ListAdapter listAdapter);
|
||||
|
||||
void setBackgroundDrawable(Drawable drawable);
|
||||
|
||||
void setHorizontalOffset(int i);
|
||||
|
||||
void setHorizontalOriginalOffset(int i);
|
||||
|
||||
void setPromptText(CharSequence charSequence);
|
||||
|
||||
void setVerticalOffset(int i);
|
||||
|
||||
void show(int i, int i2);
|
||||
}
|
||||
|
||||
final SpinnerPopup getInternalPopup() {
|
||||
return this.mPopup;
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public Context getPopupContext() {
|
||||
return this.mPopupContext;
|
||||
}
|
||||
|
||||
public AppCompatSpinner(Context context) {
|
||||
this(context, (AttributeSet) null);
|
||||
}
|
||||
|
||||
public AppCompatSpinner(Context context, int i) {
|
||||
this(context, null, androidx.appcompat.R.attr.spinnerStyle, i);
|
||||
}
|
||||
|
||||
public AppCompatSpinner(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, androidx.appcompat.R.attr.spinnerStyle);
|
||||
}
|
||||
|
||||
public AppCompatSpinner(Context context, AttributeSet attributeSet, int i) {
|
||||
this(context, attributeSet, i, -1);
|
||||
}
|
||||
|
||||
public AppCompatSpinner(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
this(context, attributeSet, i, i2, null);
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:28:0x004f, code lost:
|
||||
|
||||
if (r11 != null) goto L16;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:29:0x0051, code lost:
|
||||
|
||||
r11.recycle();
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:32:0x0062, code lost:
|
||||
|
||||
if (r11 == null) goto L31;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
public AppCompatSpinner(android.content.Context r7, android.util.AttributeSet r8, int r9, int r10, android.content.res.Resources.Theme r11) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 230
|
||||
To view this dump add '--comments-level debug' option
|
||||
*/
|
||||
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");
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setPopupBackgroundDrawable(Drawable drawable) {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup != null) {
|
||||
spinnerPopup.setBackgroundDrawable(drawable);
|
||||
} else {
|
||||
super.setPopupBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setPopupBackgroundResource(int i) {
|
||||
setPopupBackgroundDrawable(AppCompatResources.getDrawable(getPopupContext(), i));
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public Drawable getPopupBackground() {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup != null) {
|
||||
return spinnerPopup.getBackground();
|
||||
}
|
||||
return super.getPopupBackground();
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setDropDownVerticalOffset(int i) {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup != null) {
|
||||
spinnerPopup.setVerticalOffset(i);
|
||||
} else {
|
||||
super.setDropDownVerticalOffset(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public int getDropDownVerticalOffset() {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup != null) {
|
||||
return spinnerPopup.getVerticalOffset();
|
||||
}
|
||||
return super.getDropDownVerticalOffset();
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setDropDownHorizontalOffset(int i) {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup != null) {
|
||||
spinnerPopup.setHorizontalOriginalOffset(i);
|
||||
this.mPopup.setHorizontalOffset(i);
|
||||
} else {
|
||||
super.setDropDownHorizontalOffset(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public int getDropDownHorizontalOffset() {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup != null) {
|
||||
return spinnerPopup.getHorizontalOffset();
|
||||
}
|
||||
return super.getDropDownHorizontalOffset();
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setDropDownWidth(int i) {
|
||||
if (this.mPopup != null) {
|
||||
this.mDropDownWidth = i;
|
||||
} else {
|
||||
super.setDropDownWidth(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public int getDropDownWidth() {
|
||||
return this.mPopup != null ? this.mDropDownWidth : super.getDropDownWidth();
|
||||
}
|
||||
|
||||
@Override // android.widget.AdapterView
|
||||
public void setAdapter(SpinnerAdapter spinnerAdapter) {
|
||||
if (!this.mPopupSet) {
|
||||
this.mTempAdapter = spinnerAdapter;
|
||||
return;
|
||||
}
|
||||
super.setAdapter(spinnerAdapter);
|
||||
if (this.mPopup != null) {
|
||||
Context context = this.mPopupContext;
|
||||
if (context == null) {
|
||||
context = getContext();
|
||||
}
|
||||
this.mPopup.setAdapter(new DropDownAdapter(spinnerAdapter, context.getTheme()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner, android.widget.AdapterView, android.view.ViewGroup, android.view.View
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup == null || !spinnerPopup.isShowing()) {
|
||||
return;
|
||||
}
|
||||
this.mPopup.dismiss();
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner, android.view.View
|
||||
public boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
ForwardingListener forwardingListener = this.mForwardingListener;
|
||||
if (forwardingListener == null || !forwardingListener.onTouch(this, motionEvent)) {
|
||||
return super.onTouchEvent(motionEvent);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner, android.widget.AbsSpinner, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
super.onMeasure(i, i2);
|
||||
if (this.mPopup == null || View.MeasureSpec.getMode(i) != Integer.MIN_VALUE) {
|
||||
return;
|
||||
}
|
||||
setMeasuredDimension(Math.min(Math.max(getMeasuredWidth(), compatMeasureContentWidth(getAdapter(), getBackground())), View.MeasureSpec.getSize(i)), getMeasuredHeight());
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner, android.view.View
|
||||
public boolean performClick() {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup != null) {
|
||||
if (spinnerPopup.isShowing()) {
|
||||
return true;
|
||||
}
|
||||
showPopup();
|
||||
return true;
|
||||
}
|
||||
return super.performClick();
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public void setPrompt(CharSequence charSequence) {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
if (spinnerPopup != null) {
|
||||
spinnerPopup.setPromptText(charSequence);
|
||||
} else {
|
||||
super.setPrompt(charSequence);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner
|
||||
public CharSequence getPrompt() {
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
return spinnerPopup != null ? spinnerPopup.getHintText() : super.getPrompt();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
}
|
||||
|
||||
int compatMeasureContentWidth(SpinnerAdapter spinnerAdapter, Drawable drawable) {
|
||||
int i = 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 i2 = 0;
|
||||
for (int max2 = Math.max(0, max - (15 - (min - max))); max2 < min; max2++) {
|
||||
int itemViewType = spinnerAdapter.getItemViewType(max2);
|
||||
if (itemViewType != i) {
|
||||
view = null;
|
||||
i = itemViewType;
|
||||
}
|
||||
view = spinnerAdapter.getView(max2, view, this);
|
||||
if (view.getLayoutParams() == null) {
|
||||
view.setLayoutParams(new ViewGroup.LayoutParams(-2, -2));
|
||||
}
|
||||
view.measure(makeMeasureSpec, makeMeasureSpec2);
|
||||
i2 = Math.max(i2, view.getMeasuredWidth());
|
||||
}
|
||||
if (drawable == null) {
|
||||
return i2;
|
||||
}
|
||||
drawable.getPadding(this.mTempRect);
|
||||
return i2 + this.mTempRect.left + this.mTempRect.right;
|
||||
}
|
||||
|
||||
void showPopup() {
|
||||
this.mPopup.show(Api17Impl.getTextDirection(this), Api17Impl.getTextAlignment(this));
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner, android.widget.AbsSpinner, android.view.View
|
||||
public Parcelable onSaveInstanceState() {
|
||||
SavedState savedState = new SavedState(super.onSaveInstanceState());
|
||||
SpinnerPopup spinnerPopup = this.mPopup;
|
||||
savedState.mShowDropdown = spinnerPopup != null && spinnerPopup.isShowing();
|
||||
return savedState;
|
||||
}
|
||||
|
||||
@Override // android.widget.Spinner, android.widget.AbsSpinner, android.view.View
|
||||
public void onRestoreInstanceState(Parcelable parcelable) {
|
||||
ViewTreeObserver viewTreeObserver;
|
||||
SavedState savedState = (SavedState) parcelable;
|
||||
super.onRestoreInstanceState(savedState.getSuperState());
|
||||
if (!savedState.mShowDropdown || (viewTreeObserver = getViewTreeObserver()) == null) {
|
||||
return;
|
||||
}
|
||||
viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { // from class: androidx.appcompat.widget.AppCompatSpinner.2
|
||||
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
|
||||
public void onGlobalLayout() {
|
||||
if (!AppCompatSpinner.this.getInternalPopup().isShowing()) {
|
||||
AppCompatSpinner.this.showPopup();
|
||||
}
|
||||
ViewTreeObserver viewTreeObserver2 = AppCompatSpinner.this.getViewTreeObserver();
|
||||
if (viewTreeObserver2 != null) {
|
||||
Api16Impl.removeOnGlobalLayoutListener(viewTreeObserver2, this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static class SavedState extends View.BaseSavedState {
|
||||
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() { // from class: androidx.appcompat.widget.AppCompatSpinner.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];
|
||||
}
|
||||
};
|
||||
boolean mShowDropdown;
|
||||
|
||||
SavedState(Parcelable parcelable) {
|
||||
super(parcelable);
|
||||
}
|
||||
|
||||
SavedState(Parcel parcel) {
|
||||
super(parcel);
|
||||
this.mShowDropdown = parcel.readByte() != 0;
|
||||
}
|
||||
|
||||
@Override // android.view.View.BaseSavedState, android.view.AbsSavedState, android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
super.writeToParcel(parcel, i);
|
||||
parcel.writeByte(this.mShowDropdown ? (byte) 1 : (byte) 0);
|
||||
}
|
||||
}
|
||||
|
||||
private static class DropDownAdapter implements ListAdapter, SpinnerAdapter {
|
||||
private SpinnerAdapter mAdapter;
|
||||
private ListAdapter mListAdapter;
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getItemViewType(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getViewTypeCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public DropDownAdapter(SpinnerAdapter spinnerAdapter, Resources.Theme theme) {
|
||||
this.mAdapter = spinnerAdapter;
|
||||
if (spinnerAdapter instanceof ListAdapter) {
|
||||
this.mListAdapter = (ListAdapter) spinnerAdapter;
|
||||
}
|
||||
if (theme != null) {
|
||||
if (Build.VERSION.SDK_INT >= 23 && ComponentDialog$$ExternalSyntheticApiModelOutline0.m33m((Object) spinnerAdapter)) {
|
||||
Api23Impl.setDropDownViewTheme(ComponentDialog$$ExternalSyntheticApiModelOutline0.m16m((Object) spinnerAdapter), theme);
|
||||
} else if (spinnerAdapter instanceof ThemedSpinnerAdapter) {
|
||||
ThemedSpinnerAdapter themedSpinnerAdapter = (ThemedSpinnerAdapter) spinnerAdapter;
|
||||
if (themedSpinnerAdapter.getDropDownViewTheme() == null) {
|
||||
themedSpinnerAdapter.setDropDownViewTheme(theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getCount() {
|
||||
SpinnerAdapter spinnerAdapter = this.mAdapter;
|
||||
if (spinnerAdapter == null) {
|
||||
return 0;
|
||||
}
|
||||
return spinnerAdapter.getCount();
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public Object getItem(int i) {
|
||||
SpinnerAdapter spinnerAdapter = this.mAdapter;
|
||||
if (spinnerAdapter == null) {
|
||||
return null;
|
||||
}
|
||||
return spinnerAdapter.getItem(i);
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public long getItemId(int i) {
|
||||
SpinnerAdapter spinnerAdapter = this.mAdapter;
|
||||
if (spinnerAdapter == null) {
|
||||
return -1L;
|
||||
}
|
||||
return spinnerAdapter.getItemId(i);
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
return getDropDownView(i, view, viewGroup);
|
||||
}
|
||||
|
||||
@Override // android.widget.SpinnerAdapter
|
||||
public View getDropDownView(int i, View view, ViewGroup viewGroup) {
|
||||
SpinnerAdapter spinnerAdapter = this.mAdapter;
|
||||
if (spinnerAdapter == null) {
|
||||
return null;
|
||||
}
|
||||
return spinnerAdapter.getDropDownView(i, view, viewGroup);
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public boolean hasStableIds() {
|
||||
SpinnerAdapter spinnerAdapter = this.mAdapter;
|
||||
return spinnerAdapter != null && spinnerAdapter.hasStableIds();
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public void registerDataSetObserver(DataSetObserver dataSetObserver) {
|
||||
SpinnerAdapter spinnerAdapter = this.mAdapter;
|
||||
if (spinnerAdapter != null) {
|
||||
spinnerAdapter.registerDataSetObserver(dataSetObserver);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public void unregisterDataSetObserver(DataSetObserver dataSetObserver) {
|
||||
SpinnerAdapter spinnerAdapter = this.mAdapter;
|
||||
if (spinnerAdapter != null) {
|
||||
spinnerAdapter.unregisterDataSetObserver(dataSetObserver);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ListAdapter
|
||||
public boolean areAllItemsEnabled() {
|
||||
ListAdapter listAdapter = this.mListAdapter;
|
||||
if (listAdapter != null) {
|
||||
return listAdapter.areAllItemsEnabled();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.widget.ListAdapter
|
||||
public boolean isEnabled(int i) {
|
||||
ListAdapter listAdapter = this.mListAdapter;
|
||||
if (listAdapter != null) {
|
||||
return listAdapter.isEnabled(i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public boolean isEmpty() {
|
||||
return getCount() == 0;
|
||||
}
|
||||
}
|
||||
|
||||
class DialogPopup implements SpinnerPopup, DialogInterface.OnClickListener {
|
||||
private ListAdapter mListAdapter;
|
||||
AlertDialog mPopup;
|
||||
private CharSequence mPrompt;
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public Drawable getBackground() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public CharSequence getHintText() {
|
||||
return this.mPrompt;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public int getHorizontalOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public int getHorizontalOriginalOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public int getVerticalOffset() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setAdapter(ListAdapter listAdapter) {
|
||||
this.mListAdapter = listAdapter;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setPromptText(CharSequence charSequence) {
|
||||
this.mPrompt = charSequence;
|
||||
}
|
||||
|
||||
DialogPopup() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void dismiss() {
|
||||
AlertDialog alertDialog = this.mPopup;
|
||||
if (alertDialog != null) {
|
||||
alertDialog.dismiss();
|
||||
this.mPopup = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public boolean isShowing() {
|
||||
AlertDialog alertDialog = this.mPopup;
|
||||
if (alertDialog != null) {
|
||||
return alertDialog.isShowing();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void show(int i, int i2) {
|
||||
if (this.mListAdapter == null) {
|
||||
return;
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(AppCompatSpinner.this.getPopupContext());
|
||||
CharSequence charSequence = this.mPrompt;
|
||||
if (charSequence != null) {
|
||||
builder.setTitle(charSequence);
|
||||
}
|
||||
AlertDialog create = builder.setSingleChoiceItems(this.mListAdapter, AppCompatSpinner.this.getSelectedItemPosition(), this).create();
|
||||
this.mPopup = create;
|
||||
ListView listView = create.getListView();
|
||||
Api17Impl.setTextDirection(listView, i);
|
||||
Api17Impl.setTextAlignment(listView, i2);
|
||||
this.mPopup.show();
|
||||
}
|
||||
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
AppCompatSpinner.this.setSelection(i);
|
||||
if (AppCompatSpinner.this.getOnItemClickListener() != null) {
|
||||
AppCompatSpinner.this.performItemClick(null, i, this.mListAdapter.getItemId(i));
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
Log.e(AppCompatSpinner.TAG, "Cannot set popup background for MODE_DIALOG, ignoring");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setVerticalOffset(int i) {
|
||||
Log.e(AppCompatSpinner.TAG, "Cannot set vertical offset for MODE_DIALOG, ignoring");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setHorizontalOffset(int i) {
|
||||
Log.e(AppCompatSpinner.TAG, "Cannot set horizontal offset for MODE_DIALOG, ignoring");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setHorizontalOriginalOffset(int i) {
|
||||
Log.e(AppCompatSpinner.TAG, "Cannot set horizontal (original) offset for MODE_DIALOG, ignoring");
|
||||
}
|
||||
}
|
||||
|
||||
class DropdownPopup extends ListPopupWindow implements SpinnerPopup {
|
||||
ListAdapter mAdapter;
|
||||
private CharSequence mHintText;
|
||||
private int mOriginalHorizontalOffset;
|
||||
private final Rect mVisibleRect;
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public CharSequence getHintText() {
|
||||
return this.mHintText;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public int getHorizontalOriginalOffset() {
|
||||
return this.mOriginalHorizontalOffset;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setHorizontalOriginalOffset(int i) {
|
||||
this.mOriginalHorizontalOffset = i;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setPromptText(CharSequence charSequence) {
|
||||
this.mHintText = charSequence;
|
||||
}
|
||||
|
||||
public DropdownPopup(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.mVisibleRect = new Rect();
|
||||
setAnchorView(AppCompatSpinner.this);
|
||||
setModal(true);
|
||||
setPromptPosition(0);
|
||||
setOnItemClickListener(new AdapterView.OnItemClickListener() { // 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) {
|
||||
AppCompatSpinner.this.performItemClick(view, i2, DropdownPopup.this.mAdapter.getItemId(i2));
|
||||
}
|
||||
DropdownPopup.this.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ListPopupWindow, androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void setAdapter(ListAdapter listAdapter) {
|
||||
super.setAdapter(listAdapter);
|
||||
this.mAdapter = listAdapter;
|
||||
}
|
||||
|
||||
void computeContentWidth() {
|
||||
int i;
|
||||
int horizontalOriginalOffset;
|
||||
Drawable background = getBackground();
|
||||
if (background != null) {
|
||||
background.getPadding(AppCompatSpinner.this.mTempRect);
|
||||
i = ViewUtils.isLayoutRtl(AppCompatSpinner.this) ? AppCompatSpinner.this.mTempRect.right : -AppCompatSpinner.this.mTempRect.left;
|
||||
} else {
|
||||
Rect rect = AppCompatSpinner.this.mTempRect;
|
||||
AppCompatSpinner.this.mTempRect.right = 0;
|
||||
rect.left = 0;
|
||||
i = 0;
|
||||
}
|
||||
int paddingLeft = AppCompatSpinner.this.getPaddingLeft();
|
||||
int paddingRight = AppCompatSpinner.this.getPaddingRight();
|
||||
int width = AppCompatSpinner.this.getWidth();
|
||||
if (AppCompatSpinner.this.mDropDownWidth == -2) {
|
||||
int compatMeasureContentWidth = AppCompatSpinner.this.compatMeasureContentWidth((SpinnerAdapter) this.mAdapter, getBackground());
|
||||
int i2 = (AppCompatSpinner.this.getContext().getResources().getDisplayMetrics().widthPixels - AppCompatSpinner.this.mTempRect.left) - AppCompatSpinner.this.mTempRect.right;
|
||||
if (compatMeasureContentWidth > i2) {
|
||||
compatMeasureContentWidth = i2;
|
||||
}
|
||||
setContentWidth(Math.max(compatMeasureContentWidth, (width - paddingLeft) - paddingRight));
|
||||
} else if (AppCompatSpinner.this.mDropDownWidth == -1) {
|
||||
setContentWidth((width - paddingLeft) - paddingRight);
|
||||
} else {
|
||||
setContentWidth(AppCompatSpinner.this.mDropDownWidth);
|
||||
}
|
||||
if (ViewUtils.isLayoutRtl(AppCompatSpinner.this)) {
|
||||
horizontalOriginalOffset = i + (((width - paddingRight) - getWidth()) - getHorizontalOriginalOffset());
|
||||
} else {
|
||||
horizontalOriginalOffset = i + paddingLeft + getHorizontalOriginalOffset();
|
||||
}
|
||||
setHorizontalOffset(horizontalOriginalOffset);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatSpinner.SpinnerPopup
|
||||
public void show(int i, int i2) {
|
||||
ViewTreeObserver viewTreeObserver;
|
||||
boolean isShowing = isShowing();
|
||||
computeContentWidth();
|
||||
setInputMethodMode(2);
|
||||
super.show();
|
||||
ListView listView = getListView();
|
||||
listView.setChoiceMode(1);
|
||||
Api17Impl.setTextDirection(listView, i);
|
||||
Api17Impl.setTextAlignment(listView, i2);
|
||||
setSelection(AppCompatSpinner.this.getSelectedItemPosition());
|
||||
if (isShowing || (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.isVisibleToUser(AppCompatSpinner.this)) {
|
||||
DropdownPopup.this.dismiss();
|
||||
} else {
|
||||
DropdownPopup.this.computeContentWidth();
|
||||
DropdownPopup.super.show();
|
||||
}
|
||||
}
|
||||
};
|
||||
viewTreeObserver.addOnGlobalLayoutListener(onGlobalLayoutListener);
|
||||
setOnDismissListener(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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
boolean isVisibleToUser(View view) {
|
||||
return ViewCompat.isAttachedToWindow(view) && view.getGlobalVisibleRect(this.mVisibleRect);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class Api23Impl {
|
||||
private Api23Impl() {
|
||||
}
|
||||
|
||||
static void setDropDownViewTheme(android.widget.ThemedSpinnerAdapter themedSpinnerAdapter, Resources.Theme theme) {
|
||||
if (ObjectsCompat.equals(themedSpinnerAdapter.getDropDownViewTheme(), theme)) {
|
||||
return;
|
||||
}
|
||||
themedSpinnerAdapter.setDropDownViewTheme(theme);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class Api17Impl {
|
||||
private Api17Impl() {
|
||||
}
|
||||
|
||||
static int getTextAlignment(View view) {
|
||||
return view.getTextAlignment();
|
||||
}
|
||||
|
||||
static void setTextAlignment(View view, int i) {
|
||||
view.setTextAlignment(i);
|
||||
}
|
||||
|
||||
static int getTextDirection(View view) {
|
||||
return view.getTextDirection();
|
||||
}
|
||||
|
||||
static void setTextDirection(View view, int i) {
|
||||
view.setTextDirection(i);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class Api16Impl {
|
||||
private Api16Impl() {
|
||||
}
|
||||
|
||||
static void removeOnGlobalLayoutListener(ViewTreeObserver viewTreeObserver, ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener) {
|
||||
viewTreeObserver.removeOnGlobalLayoutListener(onGlobalLayoutListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.view.textclassifier.TextClassificationManager;
|
||||
import android.view.textclassifier.TextClassifier;
|
||||
import android.widget.TextView;
|
||||
import androidx.core.util.Preconditions;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class AppCompatTextClassifierHelper {
|
||||
private TextClassifier mTextClassifier;
|
||||
private TextView mTextView;
|
||||
|
||||
public void setTextClassifier(TextClassifier textClassifier) {
|
||||
this.mTextClassifier = textClassifier;
|
||||
}
|
||||
|
||||
AppCompatTextClassifierHelper(TextView textView) {
|
||||
this.mTextView = (TextView) Preconditions.checkNotNull(textView);
|
||||
}
|
||||
|
||||
public TextClassifier getTextClassifier() {
|
||||
TextClassifier textClassifier = this.mTextClassifier;
|
||||
return textClassifier == null ? Api26Impl.getTextClassifier(this.mTextView) : textClassifier;
|
||||
}
|
||||
|
||||
private static final class Api26Impl {
|
||||
private Api26Impl() {
|
||||
}
|
||||
|
||||
static TextClassifier getTextClassifier(TextView textView) {
|
||||
TextClassificationManager textClassificationManager = (TextClassificationManager) textView.getContext().getSystemService(TextClassificationManager.class);
|
||||
if (textClassificationManager != null) {
|
||||
return textClassificationManager.getTextClassifier();
|
||||
}
|
||||
return TextClassifier.NO_OP;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,626 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.LocaleList;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.inputmethod.EditorInfoCompat;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Locale;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AppCompatTextHelper {
|
||||
private static final int MONOSPACE = 3;
|
||||
private static final int SANS = 1;
|
||||
private static final int SERIF = 2;
|
||||
private static final int TEXT_FONT_WEIGHT_UNSPECIFIED = -1;
|
||||
private boolean mAsyncFontPending;
|
||||
private final AppCompatTextViewAutoSizeHelper mAutoSizeTextHelper;
|
||||
private TintInfo mDrawableBottomTint;
|
||||
private TintInfo mDrawableEndTint;
|
||||
private TintInfo mDrawableLeftTint;
|
||||
private TintInfo mDrawableRightTint;
|
||||
private TintInfo mDrawableStartTint;
|
||||
private TintInfo mDrawableTint;
|
||||
private TintInfo mDrawableTopTint;
|
||||
private Typeface mFontTypeface;
|
||||
private final TextView mView;
|
||||
private int mStyle = 0;
|
||||
private int mFontWeight = -1;
|
||||
|
||||
private void setCompoundTints() {
|
||||
TintInfo tintInfo = this.mDrawableTint;
|
||||
this.mDrawableLeftTint = tintInfo;
|
||||
this.mDrawableTopTint = tintInfo;
|
||||
this.mDrawableRightTint = tintInfo;
|
||||
this.mDrawableBottomTint = tintInfo;
|
||||
this.mDrawableStartTint = tintInfo;
|
||||
this.mDrawableEndTint = tintInfo;
|
||||
}
|
||||
|
||||
AppCompatTextHelper(TextView textView) {
|
||||
this.mView = textView;
|
||||
this.mAutoSizeTextHelper = new AppCompatTextViewAutoSizeHelper(textView);
|
||||
}
|
||||
|
||||
void loadFromAttributes(AttributeSet attributeSet, int i) {
|
||||
ColorStateList colorStateList;
|
||||
String str;
|
||||
boolean z;
|
||||
boolean z2;
|
||||
ColorStateList colorStateList2;
|
||||
String str2;
|
||||
ColorStateList colorStateList3;
|
||||
boolean z3;
|
||||
int i2;
|
||||
Context context = this.mView.getContext();
|
||||
AppCompatDrawableManager appCompatDrawableManager = AppCompatDrawableManager.get();
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, attributeSet, R.styleable.AppCompatTextHelper, i, 0);
|
||||
TextView textView = this.mView;
|
||||
ViewCompat.saveAttributeDataForStyleable(textView, textView.getContext(), R.styleable.AppCompatTextHelper, attributeSet, obtainStyledAttributes.getWrappedTypeArray(), i, 0);
|
||||
int resourceId = obtainStyledAttributes.getResourceId(R.styleable.AppCompatTextHelper_android_textAppearance, -1);
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTextHelper_android_drawableLeft)) {
|
||||
this.mDrawableLeftTint = createTintInfo(context, appCompatDrawableManager, obtainStyledAttributes.getResourceId(R.styleable.AppCompatTextHelper_android_drawableLeft, 0));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTextHelper_android_drawableTop)) {
|
||||
this.mDrawableTopTint = createTintInfo(context, appCompatDrawableManager, obtainStyledAttributes.getResourceId(R.styleable.AppCompatTextHelper_android_drawableTop, 0));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTextHelper_android_drawableRight)) {
|
||||
this.mDrawableRightTint = createTintInfo(context, appCompatDrawableManager, obtainStyledAttributes.getResourceId(R.styleable.AppCompatTextHelper_android_drawableRight, 0));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTextHelper_android_drawableBottom)) {
|
||||
this.mDrawableBottomTint = createTintInfo(context, appCompatDrawableManager, obtainStyledAttributes.getResourceId(R.styleable.AppCompatTextHelper_android_drawableBottom, 0));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTextHelper_android_drawableStart)) {
|
||||
this.mDrawableStartTint = createTintInfo(context, appCompatDrawableManager, obtainStyledAttributes.getResourceId(R.styleable.AppCompatTextHelper_android_drawableStart, 0));
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTextHelper_android_drawableEnd)) {
|
||||
this.mDrawableEndTint = createTintInfo(context, appCompatDrawableManager, obtainStyledAttributes.getResourceId(R.styleable.AppCompatTextHelper_android_drawableEnd, 0));
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
boolean z4 = this.mView.getTransformationMethod() instanceof PasswordTransformationMethod;
|
||||
if (resourceId != -1) {
|
||||
TintTypedArray obtainStyledAttributes2 = TintTypedArray.obtainStyledAttributes(context, resourceId, R.styleable.TextAppearance);
|
||||
if (z4 || !obtainStyledAttributes2.hasValue(R.styleable.TextAppearance_textAllCaps)) {
|
||||
z = false;
|
||||
z2 = false;
|
||||
} else {
|
||||
z = obtainStyledAttributes2.getBoolean(R.styleable.TextAppearance_textAllCaps, false);
|
||||
z2 = true;
|
||||
}
|
||||
updateTypefaceAndStyle(context, obtainStyledAttributes2);
|
||||
if (Build.VERSION.SDK_INT < 23) {
|
||||
colorStateList3 = obtainStyledAttributes2.hasValue(R.styleable.TextAppearance_android_textColor) ? obtainStyledAttributes2.getColorStateList(R.styleable.TextAppearance_android_textColor) : null;
|
||||
colorStateList = obtainStyledAttributes2.hasValue(R.styleable.TextAppearance_android_textColorHint) ? obtainStyledAttributes2.getColorStateList(R.styleable.TextAppearance_android_textColorHint) : null;
|
||||
colorStateList2 = obtainStyledAttributes2.hasValue(R.styleable.TextAppearance_android_textColorLink) ? obtainStyledAttributes2.getColorStateList(R.styleable.TextAppearance_android_textColorLink) : null;
|
||||
} else {
|
||||
colorStateList = null;
|
||||
colorStateList2 = null;
|
||||
colorStateList3 = null;
|
||||
}
|
||||
str2 = obtainStyledAttributes2.hasValue(R.styleable.TextAppearance_textLocale) ? obtainStyledAttributes2.getString(R.styleable.TextAppearance_textLocale) : null;
|
||||
str = (Build.VERSION.SDK_INT < 26 || !obtainStyledAttributes2.hasValue(R.styleable.TextAppearance_fontVariationSettings)) ? null : obtainStyledAttributes2.getString(R.styleable.TextAppearance_fontVariationSettings);
|
||||
obtainStyledAttributes2.recycle();
|
||||
} else {
|
||||
colorStateList = null;
|
||||
str = null;
|
||||
z = false;
|
||||
z2 = false;
|
||||
colorStateList2 = null;
|
||||
str2 = null;
|
||||
colorStateList3 = null;
|
||||
}
|
||||
TintTypedArray obtainStyledAttributes3 = TintTypedArray.obtainStyledAttributes(context, attributeSet, R.styleable.TextAppearance, i, 0);
|
||||
if (z4 || !obtainStyledAttributes3.hasValue(R.styleable.TextAppearance_textAllCaps)) {
|
||||
z3 = z2;
|
||||
} else {
|
||||
z = obtainStyledAttributes3.getBoolean(R.styleable.TextAppearance_textAllCaps, false);
|
||||
z3 = true;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT < 23) {
|
||||
if (obtainStyledAttributes3.hasValue(R.styleable.TextAppearance_android_textColor)) {
|
||||
colorStateList3 = obtainStyledAttributes3.getColorStateList(R.styleable.TextAppearance_android_textColor);
|
||||
}
|
||||
if (obtainStyledAttributes3.hasValue(R.styleable.TextAppearance_android_textColorHint)) {
|
||||
colorStateList = obtainStyledAttributes3.getColorStateList(R.styleable.TextAppearance_android_textColorHint);
|
||||
}
|
||||
if (obtainStyledAttributes3.hasValue(R.styleable.TextAppearance_android_textColorLink)) {
|
||||
colorStateList2 = obtainStyledAttributes3.getColorStateList(R.styleable.TextAppearance_android_textColorLink);
|
||||
}
|
||||
}
|
||||
if (obtainStyledAttributes3.hasValue(R.styleable.TextAppearance_textLocale)) {
|
||||
str2 = obtainStyledAttributes3.getString(R.styleable.TextAppearance_textLocale);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 26 && obtainStyledAttributes3.hasValue(R.styleable.TextAppearance_fontVariationSettings)) {
|
||||
str = obtainStyledAttributes3.getString(R.styleable.TextAppearance_fontVariationSettings);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 28 && obtainStyledAttributes3.hasValue(R.styleable.TextAppearance_android_textSize) && obtainStyledAttributes3.getDimensionPixelSize(R.styleable.TextAppearance_android_textSize, -1) == 0) {
|
||||
this.mView.setTextSize(0, 0.0f);
|
||||
}
|
||||
updateTypefaceAndStyle(context, obtainStyledAttributes3);
|
||||
obtainStyledAttributes3.recycle();
|
||||
if (colorStateList3 != null) {
|
||||
this.mView.setTextColor(colorStateList3);
|
||||
}
|
||||
if (colorStateList != null) {
|
||||
this.mView.setHintTextColor(colorStateList);
|
||||
}
|
||||
if (colorStateList2 != null) {
|
||||
this.mView.setLinkTextColor(colorStateList2);
|
||||
}
|
||||
if (!z4 && z3) {
|
||||
setAllCaps(z);
|
||||
}
|
||||
Typeface typeface = this.mFontTypeface;
|
||||
if (typeface != null) {
|
||||
if (this.mFontWeight == -1) {
|
||||
this.mView.setTypeface(typeface, this.mStyle);
|
||||
} else {
|
||||
this.mView.setTypeface(typeface);
|
||||
}
|
||||
}
|
||||
if (str != null) {
|
||||
Api26Impl.setFontVariationSettings(this.mView, str);
|
||||
}
|
||||
if (str2 != null) {
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
Api24Impl.setTextLocales(this.mView, Api24Impl.forLanguageTags(str2));
|
||||
} else {
|
||||
Api17Impl.setTextLocale(this.mView, Api21Impl.forLanguageTag(str2.split(",")[0]));
|
||||
}
|
||||
}
|
||||
this.mAutoSizeTextHelper.loadFromAttributes(attributeSet, i);
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE && this.mAutoSizeTextHelper.getAutoSizeTextType() != 0) {
|
||||
int[] autoSizeTextAvailableSizes = this.mAutoSizeTextHelper.getAutoSizeTextAvailableSizes();
|
||||
if (autoSizeTextAvailableSizes.length > 0) {
|
||||
if (Api26Impl.getAutoSizeStepGranularity(this.mView) != -1.0f) {
|
||||
Api26Impl.setAutoSizeTextTypeUniformWithConfiguration(this.mView, this.mAutoSizeTextHelper.getAutoSizeMinTextSize(), this.mAutoSizeTextHelper.getAutoSizeMaxTextSize(), this.mAutoSizeTextHelper.getAutoSizeStepGranularity(), 0);
|
||||
} else {
|
||||
Api26Impl.setAutoSizeTextTypeUniformWithPresetSizes(this.mView, autoSizeTextAvailableSizes, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
TintTypedArray obtainStyledAttributes4 = TintTypedArray.obtainStyledAttributes(context, attributeSet, R.styleable.AppCompatTextView);
|
||||
int resourceId2 = obtainStyledAttributes4.getResourceId(R.styleable.AppCompatTextView_drawableLeftCompat, -1);
|
||||
Drawable drawable = resourceId2 != -1 ? appCompatDrawableManager.getDrawable(context, resourceId2) : null;
|
||||
int resourceId3 = obtainStyledAttributes4.getResourceId(R.styleable.AppCompatTextView_drawableTopCompat, -1);
|
||||
Drawable drawable2 = resourceId3 != -1 ? appCompatDrawableManager.getDrawable(context, resourceId3) : null;
|
||||
int resourceId4 = obtainStyledAttributes4.getResourceId(R.styleable.AppCompatTextView_drawableRightCompat, -1);
|
||||
Drawable drawable3 = resourceId4 != -1 ? appCompatDrawableManager.getDrawable(context, resourceId4) : null;
|
||||
int resourceId5 = obtainStyledAttributes4.getResourceId(R.styleable.AppCompatTextView_drawableBottomCompat, -1);
|
||||
Drawable drawable4 = resourceId5 != -1 ? appCompatDrawableManager.getDrawable(context, resourceId5) : null;
|
||||
int resourceId6 = obtainStyledAttributes4.getResourceId(R.styleable.AppCompatTextView_drawableStartCompat, -1);
|
||||
Drawable drawable5 = resourceId6 != -1 ? appCompatDrawableManager.getDrawable(context, resourceId6) : null;
|
||||
int resourceId7 = obtainStyledAttributes4.getResourceId(R.styleable.AppCompatTextView_drawableEndCompat, -1);
|
||||
setCompoundDrawables(drawable, drawable2, drawable3, drawable4, drawable5, resourceId7 != -1 ? appCompatDrawableManager.getDrawable(context, resourceId7) : null);
|
||||
if (obtainStyledAttributes4.hasValue(R.styleable.AppCompatTextView_drawableTint)) {
|
||||
TextViewCompat.setCompoundDrawableTintList(this.mView, obtainStyledAttributes4.getColorStateList(R.styleable.AppCompatTextView_drawableTint));
|
||||
}
|
||||
if (obtainStyledAttributes4.hasValue(R.styleable.AppCompatTextView_drawableTintMode)) {
|
||||
i2 = -1;
|
||||
TextViewCompat.setCompoundDrawableTintMode(this.mView, DrawableUtils.parseTintMode(obtainStyledAttributes4.getInt(R.styleable.AppCompatTextView_drawableTintMode, -1), null));
|
||||
} else {
|
||||
i2 = -1;
|
||||
}
|
||||
int dimensionPixelSize = obtainStyledAttributes4.getDimensionPixelSize(R.styleable.AppCompatTextView_firstBaselineToTopHeight, i2);
|
||||
int dimensionPixelSize2 = obtainStyledAttributes4.getDimensionPixelSize(R.styleable.AppCompatTextView_lastBaselineToBottomHeight, i2);
|
||||
int dimensionPixelSize3 = obtainStyledAttributes4.getDimensionPixelSize(R.styleable.AppCompatTextView_lineHeight, i2);
|
||||
obtainStyledAttributes4.recycle();
|
||||
if (dimensionPixelSize != i2) {
|
||||
TextViewCompat.setFirstBaselineToTopHeight(this.mView, dimensionPixelSize);
|
||||
}
|
||||
if (dimensionPixelSize2 != i2) {
|
||||
TextViewCompat.setLastBaselineToBottomHeight(this.mView, dimensionPixelSize2);
|
||||
}
|
||||
if (dimensionPixelSize3 != i2) {
|
||||
TextViewCompat.setLineHeight(this.mView, dimensionPixelSize3);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTypefaceAndStyle(Context context, TintTypedArray tintTypedArray) {
|
||||
int i;
|
||||
String string;
|
||||
this.mStyle = tintTypedArray.getInt(R.styleable.TextAppearance_android_textStyle, this.mStyle);
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
int i2 = tintTypedArray.getInt(R.styleable.TextAppearance_android_textFontWeight, -1);
|
||||
this.mFontWeight = i2;
|
||||
if (i2 != -1) {
|
||||
this.mStyle &= 2;
|
||||
}
|
||||
}
|
||||
if (tintTypedArray.hasValue(R.styleable.TextAppearance_android_fontFamily) || tintTypedArray.hasValue(R.styleable.TextAppearance_fontFamily)) {
|
||||
this.mFontTypeface = null;
|
||||
if (tintTypedArray.hasValue(R.styleable.TextAppearance_fontFamily)) {
|
||||
i = R.styleable.TextAppearance_fontFamily;
|
||||
} else {
|
||||
i = R.styleable.TextAppearance_android_fontFamily;
|
||||
}
|
||||
final int i3 = this.mFontWeight;
|
||||
final int i4 = this.mStyle;
|
||||
if (!context.isRestricted()) {
|
||||
final WeakReference weakReference = new WeakReference(this.mView);
|
||||
try {
|
||||
Typeface font = tintTypedArray.getFont(i, this.mStyle, new ResourcesCompat.FontCallback() { // from class: androidx.appcompat.widget.AppCompatTextHelper.1
|
||||
@Override // androidx.core.content.res.ResourcesCompat.FontCallback
|
||||
/* renamed from: onFontRetrievalFailed */
|
||||
public void m80xb24343b7(int i5) {
|
||||
}
|
||||
|
||||
@Override // androidx.core.content.res.ResourcesCompat.FontCallback
|
||||
/* renamed from: onFontRetrieved */
|
||||
public void m81x46c88379(Typeface typeface) {
|
||||
int i5;
|
||||
if (Build.VERSION.SDK_INT >= 28 && (i5 = i3) != -1) {
|
||||
typeface = Api28Impl.create(typeface, i5, (i4 & 2) != 0);
|
||||
}
|
||||
AppCompatTextHelper.this.onAsyncTypefaceReceived(weakReference, typeface);
|
||||
}
|
||||
});
|
||||
if (font != null) {
|
||||
if (Build.VERSION.SDK_INT < 28 || this.mFontWeight == -1) {
|
||||
this.mFontTypeface = font;
|
||||
} else {
|
||||
this.mFontTypeface = Api28Impl.create(Typeface.create(font, 0), this.mFontWeight, (this.mStyle & 2) != 0);
|
||||
}
|
||||
}
|
||||
this.mAsyncFontPending = this.mFontTypeface == null;
|
||||
} catch (Resources.NotFoundException | UnsupportedOperationException unused) {
|
||||
}
|
||||
}
|
||||
if (this.mFontTypeface != null || (string = tintTypedArray.getString(i)) == null) {
|
||||
return;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 28 && this.mFontWeight != -1) {
|
||||
this.mFontTypeface = Api28Impl.create(Typeface.create(string, 0), this.mFontWeight, (this.mStyle & 2) != 0);
|
||||
return;
|
||||
} else {
|
||||
this.mFontTypeface = Typeface.create(string, this.mStyle);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (tintTypedArray.hasValue(R.styleable.TextAppearance_android_typeface)) {
|
||||
this.mAsyncFontPending = false;
|
||||
int i5 = tintTypedArray.getInt(R.styleable.TextAppearance_android_typeface, 1);
|
||||
if (i5 == 1) {
|
||||
this.mFontTypeface = Typeface.SANS_SERIF;
|
||||
} else if (i5 == 2) {
|
||||
this.mFontTypeface = Typeface.SERIF;
|
||||
} else {
|
||||
if (i5 != 3) {
|
||||
return;
|
||||
}
|
||||
this.mFontTypeface = Typeface.MONOSPACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onAsyncTypefaceReceived(WeakReference<TextView> weakReference, final Typeface typeface) {
|
||||
if (this.mAsyncFontPending) {
|
||||
this.mFontTypeface = typeface;
|
||||
final TextView textView = weakReference.get();
|
||||
if (textView != null) {
|
||||
if (ViewCompat.isAttachedToWindow(textView)) {
|
||||
final int i = this.mStyle;
|
||||
textView.post(new Runnable() { // from class: androidx.appcompat.widget.AppCompatTextHelper.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
textView.setTypeface(typeface, i);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
textView.setTypeface(typeface, this.mStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onSetTextAppearance(Context context, int i) {
|
||||
String string;
|
||||
ColorStateList colorStateList;
|
||||
ColorStateList colorStateList2;
|
||||
ColorStateList colorStateList3;
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, i, R.styleable.TextAppearance);
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.TextAppearance_textAllCaps)) {
|
||||
setAllCaps(obtainStyledAttributes.getBoolean(R.styleable.TextAppearance_textAllCaps, false));
|
||||
}
|
||||
if (Build.VERSION.SDK_INT < 23) {
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.TextAppearance_android_textColor) && (colorStateList3 = obtainStyledAttributes.getColorStateList(R.styleable.TextAppearance_android_textColor)) != null) {
|
||||
this.mView.setTextColor(colorStateList3);
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.TextAppearance_android_textColorLink) && (colorStateList2 = obtainStyledAttributes.getColorStateList(R.styleable.TextAppearance_android_textColorLink)) != null) {
|
||||
this.mView.setLinkTextColor(colorStateList2);
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.TextAppearance_android_textColorHint) && (colorStateList = obtainStyledAttributes.getColorStateList(R.styleable.TextAppearance_android_textColorHint)) != null) {
|
||||
this.mView.setHintTextColor(colorStateList);
|
||||
}
|
||||
}
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.TextAppearance_android_textSize) && obtainStyledAttributes.getDimensionPixelSize(R.styleable.TextAppearance_android_textSize, -1) == 0) {
|
||||
this.mView.setTextSize(0, 0.0f);
|
||||
}
|
||||
updateTypefaceAndStyle(context, obtainStyledAttributes);
|
||||
if (Build.VERSION.SDK_INT >= 26 && obtainStyledAttributes.hasValue(R.styleable.TextAppearance_fontVariationSettings) && (string = obtainStyledAttributes.getString(R.styleable.TextAppearance_fontVariationSettings)) != null) {
|
||||
Api26Impl.setFontVariationSettings(this.mView, string);
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
Typeface typeface = this.mFontTypeface;
|
||||
if (typeface != null) {
|
||||
this.mView.setTypeface(typeface, this.mStyle);
|
||||
}
|
||||
}
|
||||
|
||||
void setAllCaps(boolean z) {
|
||||
this.mView.setAllCaps(z);
|
||||
}
|
||||
|
||||
void onSetCompoundDrawables() {
|
||||
applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
void applyCompoundDrawablesTints() {
|
||||
if (this.mDrawableLeftTint != null || this.mDrawableTopTint != null || this.mDrawableRightTint != null || this.mDrawableBottomTint != null) {
|
||||
Drawable[] compoundDrawables = this.mView.getCompoundDrawables();
|
||||
applyCompoundDrawableTint(compoundDrawables[0], this.mDrawableLeftTint);
|
||||
applyCompoundDrawableTint(compoundDrawables[1], this.mDrawableTopTint);
|
||||
applyCompoundDrawableTint(compoundDrawables[2], this.mDrawableRightTint);
|
||||
applyCompoundDrawableTint(compoundDrawables[3], this.mDrawableBottomTint);
|
||||
}
|
||||
if (this.mDrawableStartTint == null && this.mDrawableEndTint == null) {
|
||||
return;
|
||||
}
|
||||
Drawable[] compoundDrawablesRelative = Api17Impl.getCompoundDrawablesRelative(this.mView);
|
||||
applyCompoundDrawableTint(compoundDrawablesRelative[0], this.mDrawableStartTint);
|
||||
applyCompoundDrawableTint(compoundDrawablesRelative[2], this.mDrawableEndTint);
|
||||
}
|
||||
|
||||
private void applyCompoundDrawableTint(Drawable drawable, TintInfo tintInfo) {
|
||||
if (drawable == null || tintInfo == null) {
|
||||
return;
|
||||
}
|
||||
AppCompatDrawableManager.tintDrawable(drawable, tintInfo, this.mView.getDrawableState());
|
||||
}
|
||||
|
||||
private static TintInfo createTintInfo(Context context, AppCompatDrawableManager appCompatDrawableManager, int i) {
|
||||
ColorStateList tintList = appCompatDrawableManager.getTintList(context, i);
|
||||
if (tintList == null) {
|
||||
return null;
|
||||
}
|
||||
TintInfo tintInfo = new TintInfo();
|
||||
tintInfo.mHasTintList = true;
|
||||
tintInfo.mTintList = tintList;
|
||||
return tintInfo;
|
||||
}
|
||||
|
||||
void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return;
|
||||
}
|
||||
autoSizeText();
|
||||
}
|
||||
|
||||
void setTextSize(int i, float f) {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE || isAutoSizeEnabled()) {
|
||||
return;
|
||||
}
|
||||
setTextSizeInternal(i, f);
|
||||
}
|
||||
|
||||
void autoSizeText() {
|
||||
this.mAutoSizeTextHelper.autoSizeText();
|
||||
}
|
||||
|
||||
boolean isAutoSizeEnabled() {
|
||||
return this.mAutoSizeTextHelper.isAutoSizeEnabled();
|
||||
}
|
||||
|
||||
private void setTextSizeInternal(int i, float f) {
|
||||
this.mAutoSizeTextHelper.setTextSizeInternal(i, f);
|
||||
}
|
||||
|
||||
void setAutoSizeTextTypeWithDefaults(int i) {
|
||||
this.mAutoSizeTextHelper.setAutoSizeTextTypeWithDefaults(i);
|
||||
}
|
||||
|
||||
void setAutoSizeTextTypeUniformWithConfiguration(int i, int i2, int i3, int i4) throws IllegalArgumentException {
|
||||
this.mAutoSizeTextHelper.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
|
||||
}
|
||||
|
||||
void setAutoSizeTextTypeUniformWithPresetSizes(int[] iArr, int i) throws IllegalArgumentException {
|
||||
this.mAutoSizeTextHelper.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
|
||||
}
|
||||
|
||||
int getAutoSizeTextType() {
|
||||
return this.mAutoSizeTextHelper.getAutoSizeTextType();
|
||||
}
|
||||
|
||||
int getAutoSizeStepGranularity() {
|
||||
return this.mAutoSizeTextHelper.getAutoSizeStepGranularity();
|
||||
}
|
||||
|
||||
int getAutoSizeMinTextSize() {
|
||||
return this.mAutoSizeTextHelper.getAutoSizeMinTextSize();
|
||||
}
|
||||
|
||||
int getAutoSizeMaxTextSize() {
|
||||
return this.mAutoSizeTextHelper.getAutoSizeMaxTextSize();
|
||||
}
|
||||
|
||||
int[] getAutoSizeTextAvailableSizes() {
|
||||
return this.mAutoSizeTextHelper.getAutoSizeTextAvailableSizes();
|
||||
}
|
||||
|
||||
ColorStateList getCompoundDrawableTintList() {
|
||||
TintInfo tintInfo = this.mDrawableTint;
|
||||
if (tintInfo != null) {
|
||||
return tintInfo.mTintList;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void setCompoundDrawableTintList(ColorStateList colorStateList) {
|
||||
if (this.mDrawableTint == null) {
|
||||
this.mDrawableTint = new TintInfo();
|
||||
}
|
||||
this.mDrawableTint.mTintList = colorStateList;
|
||||
this.mDrawableTint.mHasTintList = colorStateList != null;
|
||||
setCompoundTints();
|
||||
}
|
||||
|
||||
PorterDuff.Mode getCompoundDrawableTintMode() {
|
||||
TintInfo tintInfo = this.mDrawableTint;
|
||||
if (tintInfo != null) {
|
||||
return tintInfo.mTintMode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void setCompoundDrawableTintMode(PorterDuff.Mode mode) {
|
||||
if (this.mDrawableTint == null) {
|
||||
this.mDrawableTint = new TintInfo();
|
||||
}
|
||||
this.mDrawableTint.mTintMode = mode;
|
||||
this.mDrawableTint.mHasTintMode = mode != null;
|
||||
setCompoundTints();
|
||||
}
|
||||
|
||||
private void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4, Drawable drawable5, Drawable drawable6) {
|
||||
if (drawable5 != null || drawable6 != null) {
|
||||
Drawable[] compoundDrawablesRelative = Api17Impl.getCompoundDrawablesRelative(this.mView);
|
||||
TextView textView = this.mView;
|
||||
if (drawable5 == null) {
|
||||
drawable5 = compoundDrawablesRelative[0];
|
||||
}
|
||||
if (drawable2 == null) {
|
||||
drawable2 = compoundDrawablesRelative[1];
|
||||
}
|
||||
if (drawable6 == null) {
|
||||
drawable6 = compoundDrawablesRelative[2];
|
||||
}
|
||||
if (drawable4 == null) {
|
||||
drawable4 = compoundDrawablesRelative[3];
|
||||
}
|
||||
Api17Impl.setCompoundDrawablesRelativeWithIntrinsicBounds(textView, drawable5, drawable2, drawable6, drawable4);
|
||||
return;
|
||||
}
|
||||
if (drawable == null && drawable2 == null && drawable3 == null && drawable4 == null) {
|
||||
return;
|
||||
}
|
||||
Drawable[] compoundDrawablesRelative2 = Api17Impl.getCompoundDrawablesRelative(this.mView);
|
||||
Drawable drawable7 = compoundDrawablesRelative2[0];
|
||||
if (drawable7 != null || compoundDrawablesRelative2[2] != null) {
|
||||
TextView textView2 = this.mView;
|
||||
if (drawable2 == null) {
|
||||
drawable2 = compoundDrawablesRelative2[1];
|
||||
}
|
||||
Drawable drawable8 = compoundDrawablesRelative2[2];
|
||||
if (drawable4 == null) {
|
||||
drawable4 = compoundDrawablesRelative2[3];
|
||||
}
|
||||
Api17Impl.setCompoundDrawablesRelativeWithIntrinsicBounds(textView2, drawable7, drawable2, drawable8, drawable4);
|
||||
return;
|
||||
}
|
||||
Drawable[] compoundDrawables = this.mView.getCompoundDrawables();
|
||||
TextView textView3 = this.mView;
|
||||
if (drawable == null) {
|
||||
drawable = compoundDrawables[0];
|
||||
}
|
||||
if (drawable2 == null) {
|
||||
drawable2 = compoundDrawables[1];
|
||||
}
|
||||
if (drawable3 == null) {
|
||||
drawable3 = compoundDrawables[2];
|
||||
}
|
||||
if (drawable4 == null) {
|
||||
drawable4 = compoundDrawables[3];
|
||||
}
|
||||
textView3.setCompoundDrawablesWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4);
|
||||
}
|
||||
|
||||
void populateSurroundingTextIfNeeded(TextView textView, InputConnection inputConnection, EditorInfo editorInfo) {
|
||||
if (Build.VERSION.SDK_INT >= 30 || inputConnection == null) {
|
||||
return;
|
||||
}
|
||||
EditorInfoCompat.setInitialSurroundingText(editorInfo, textView.getText());
|
||||
}
|
||||
|
||||
static class Api26Impl {
|
||||
private Api26Impl() {
|
||||
}
|
||||
|
||||
static boolean setFontVariationSettings(TextView textView, String str) {
|
||||
return textView.setFontVariationSettings(str);
|
||||
}
|
||||
|
||||
static int getAutoSizeStepGranularity(TextView textView) {
|
||||
return textView.getAutoSizeStepGranularity();
|
||||
}
|
||||
|
||||
static void setAutoSizeTextTypeUniformWithConfiguration(TextView textView, int i, int i2, int i3, int i4) {
|
||||
textView.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
|
||||
}
|
||||
|
||||
static void setAutoSizeTextTypeUniformWithPresetSizes(TextView textView, int[] iArr, int i) {
|
||||
textView.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api24Impl {
|
||||
private Api24Impl() {
|
||||
}
|
||||
|
||||
static void setTextLocales(TextView textView, LocaleList localeList) {
|
||||
textView.setTextLocales(localeList);
|
||||
}
|
||||
|
||||
static LocaleList forLanguageTags(String str) {
|
||||
return LocaleList.forLanguageTags(str);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api17Impl {
|
||||
private Api17Impl() {
|
||||
}
|
||||
|
||||
static void setTextLocale(TextView textView, Locale locale) {
|
||||
textView.setTextLocale(locale);
|
||||
}
|
||||
|
||||
static void setCompoundDrawablesRelativeWithIntrinsicBounds(TextView textView, Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
textView.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4);
|
||||
}
|
||||
|
||||
static Drawable[] getCompoundDrawablesRelative(TextView textView) {
|
||||
return textView.getCompoundDrawablesRelative();
|
||||
}
|
||||
}
|
||||
|
||||
static class Api21Impl {
|
||||
private Api21Impl() {
|
||||
}
|
||||
|
||||
static Locale forLanguageTag(String str) {
|
||||
return Locale.forLanguageTag(str);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api28Impl {
|
||||
private Api28Impl() {
|
||||
}
|
||||
|
||||
static Typeface create(Typeface typeface, int i, boolean z) {
|
||||
return Typeface.create(typeface, i, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,607 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.text.InputFilter;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ActionMode;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.view.textclassifier.TextClassifier;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.graphics.TypefaceCompat;
|
||||
import androidx.core.text.PrecomputedTextCompat;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.AutoSizeableTextView;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
import androidx.core.widget.TintableCompoundDrawablesView;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatTextView extends TextView implements TintableBackgroundView, TintableCompoundDrawablesView, AutoSizeableTextView, EmojiCompatConfigurationView {
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private AppCompatEmojiTextHelper mEmojiTextViewHelper;
|
||||
private boolean mIsSetTypefaceProcessing;
|
||||
private Future<PrecomputedTextCompat> mPrecomputedTextFuture;
|
||||
private SuperCaller mSuperCaller;
|
||||
private final AppCompatTextClassifierHelper mTextClassifierHelper;
|
||||
private final AppCompatTextHelper mTextHelper;
|
||||
|
||||
private interface SuperCaller {
|
||||
int getAutoSizeMaxTextSize();
|
||||
|
||||
int getAutoSizeMinTextSize();
|
||||
|
||||
int getAutoSizeStepGranularity();
|
||||
|
||||
int[] getAutoSizeTextAvailableSizes();
|
||||
|
||||
int getAutoSizeTextType();
|
||||
|
||||
TextClassifier getTextClassifier();
|
||||
|
||||
void setAutoSizeTextTypeUniformWithConfiguration(int i, int i2, int i3, int i4);
|
||||
|
||||
void setAutoSizeTextTypeUniformWithPresetSizes(int[] iArr, int i);
|
||||
|
||||
void setAutoSizeTextTypeWithDefaults(int i);
|
||||
|
||||
void setFirstBaselineToTopHeight(int i);
|
||||
|
||||
void setLastBaselineToBottomHeight(int i);
|
||||
|
||||
void setTextClassifier(TextClassifier textClassifier);
|
||||
}
|
||||
|
||||
public AppCompatTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatTextView(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.textViewStyle);
|
||||
}
|
||||
|
||||
public AppCompatTextView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(TintContextWrapper.wrap(context), attributeSet, i);
|
||||
this.mIsSetTypefaceProcessing = false;
|
||||
this.mSuperCaller = null;
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
|
||||
this.mTextHelper = appCompatTextHelper;
|
||||
appCompatTextHelper.loadFromAttributes(attributeSet, i);
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
this.mTextClassifierHelper = new AppCompatTextClassifierHelper(this);
|
||||
getEmojiTextViewHelper().loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
private AppCompatEmojiTextHelper getEmojiTextViewHelper() {
|
||||
if (this.mEmojiTextViewHelper == null) {
|
||||
this.mEmojiTextViewHelper = new AppCompatEmojiTextHelper(this);
|
||||
}
|
||||
return this.mEmojiTextViewHelper;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
super.setTextAppearance(context, i);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetTextAppearance(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setFilters(InputFilter[] inputFilterArr) {
|
||||
super.setFilters(getEmojiTextViewHelper().getFilters(inputFilterArr));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setAllCaps(boolean z) {
|
||||
super.setAllCaps(z);
|
||||
getEmojiTextViewHelper().setAllCaps(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public void setEmojiCompatEnabled(boolean z) {
|
||||
getEmojiTextViewHelper().setEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public boolean isEmojiCompatEnabled() {
|
||||
return getEmojiTextViewHelper().isEnabled();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
|
||||
@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.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onLayout(z, i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextSize(int i, float f) {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
super.setTextSize(i, f);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.setTextSize(i, f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
protected void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
||||
super.onTextChanged(charSequence, i, i2, i3);
|
||||
if (this.mTextHelper == null || ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE || !this.mTextHelper.isAutoSizeEnabled()) {
|
||||
return;
|
||||
}
|
||||
this.mTextHelper.autoSizeText();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public void setAutoSizeTextTypeWithDefaults(int i) {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
getSuperCaller().setAutoSizeTextTypeWithDefaults(i);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.setAutoSizeTextTypeWithDefaults(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public void setAutoSizeTextTypeUniformWithConfiguration(int i, int i2, int i3, int i4) throws IllegalArgumentException {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
getSuperCaller().setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public void setAutoSizeTextTypeUniformWithPresetSizes(int[] iArr, int i) throws IllegalArgumentException {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
getSuperCaller().setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
|
||||
return;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public int getAutoSizeTextType() {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return getSuperCaller().getAutoSizeTextType() == 1 ? 1 : 0;
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.getAutoSizeTextType();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public int getAutoSizeStepGranularity() {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return getSuperCaller().getAutoSizeStepGranularity();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.getAutoSizeStepGranularity();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public int getAutoSizeMinTextSize() {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return getSuperCaller().getAutoSizeMinTextSize();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.getAutoSizeMinTextSize();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public int getAutoSizeMaxTextSize() {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return getSuperCaller().getAutoSizeMaxTextSize();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
return appCompatTextHelper.getAutoSizeMaxTextSize();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
|
||||
public int[] getAutoSizeTextAvailableSizes() {
|
||||
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
|
||||
return getSuperCaller().getAutoSizeTextAvailableSizes();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
return appCompatTextHelper != null ? appCompatTextHelper.getAutoSizeTextAvailableSizes() : new int[0];
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
|
||||
InputConnection onCreateInputConnection = super.onCreateInputConnection(editorInfo);
|
||||
this.mTextHelper.populateSurroundingTextIfNeeded(this, onCreateInputConnection, editorInfo);
|
||||
return AppCompatHintHelper.onCreateInputConnection(onCreateInputConnection, editorInfo, this);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setFirstBaselineToTopHeight(int i) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
getSuperCaller().setFirstBaselineToTopHeight(i);
|
||||
} else {
|
||||
TextViewCompat.setFirstBaselineToTopHeight(this, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setLastBaselineToBottomHeight(int i) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
getSuperCaller().setLastBaselineToBottomHeight(i);
|
||||
} else {
|
||||
TextViewCompat.setLastBaselineToBottomHeight(this, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public int getFirstBaselineToTopHeight() {
|
||||
return TextViewCompat.getFirstBaselineToTopHeight(this);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public int getLastBaselineToBottomHeight() {
|
||||
return TextViewCompat.getLastBaselineToBottomHeight(this);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setLineHeight(int i) {
|
||||
TextViewCompat.setLineHeight(this, i);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCustomSelectionActionModeCallback(ActionMode.Callback callback) {
|
||||
super.setCustomSelectionActionModeCallback(TextViewCompat.wrapCustomSelectionActionModeCallback(this, callback));
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public ActionMode.Callback getCustomSelectionActionModeCallback() {
|
||||
return TextViewCompat.unwrapCustomSelectionActionModeCallback(super.getCustomSelectionActionModeCallback());
|
||||
}
|
||||
|
||||
public PrecomputedTextCompat.Params getTextMetricsParamsCompat() {
|
||||
return TextViewCompat.getTextMetricsParams(this);
|
||||
}
|
||||
|
||||
public void setTextMetricsParamsCompat(PrecomputedTextCompat.Params params) {
|
||||
TextViewCompat.setTextMetricsParams(this, params);
|
||||
}
|
||||
|
||||
public void setPrecomputedText(PrecomputedTextCompat precomputedTextCompat) {
|
||||
TextViewCompat.setPrecomputedText(this, precomputedTextCompat);
|
||||
}
|
||||
|
||||
private void consumeTextFutureAndSetBlocking() {
|
||||
Future<PrecomputedTextCompat> future = this.mPrecomputedTextFuture;
|
||||
if (future != null) {
|
||||
try {
|
||||
this.mPrecomputedTextFuture = null;
|
||||
TextViewCompat.setPrecomputedText(this, future.get());
|
||||
} catch (InterruptedException | ExecutionException unused) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public CharSequence getText() {
|
||||
consumeTextFutureAndSetBlocking();
|
||||
return super.getText();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTextClassifier(TextClassifier textClassifier) {
|
||||
AppCompatTextClassifierHelper appCompatTextClassifierHelper;
|
||||
if (Build.VERSION.SDK_INT >= 28 || (appCompatTextClassifierHelper = this.mTextClassifierHelper) == null) {
|
||||
getSuperCaller().setTextClassifier(textClassifier);
|
||||
} else {
|
||||
appCompatTextClassifierHelper.setTextClassifier(textClassifier);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public TextClassifier getTextClassifier() {
|
||||
AppCompatTextClassifierHelper appCompatTextClassifierHelper;
|
||||
if (Build.VERSION.SDK_INT >= 28 || (appCompatTextClassifierHelper = this.mTextClassifierHelper) == null) {
|
||||
return getSuperCaller().getTextClassifier();
|
||||
}
|
||||
return appCompatTextClassifierHelper.getTextClassifier();
|
||||
}
|
||||
|
||||
public void setTextFuture(Future<PrecomputedTextCompat> future) {
|
||||
this.mPrecomputedTextFuture = future;
|
||||
if (future != null) {
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
consumeTextFutureAndSetBlocking();
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesWithIntrinsicBounds(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawablesWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesWithIntrinsicBounds(int i, int i2, int i3, int i4) {
|
||||
Context context = getContext();
|
||||
setCompoundDrawablesWithIntrinsicBounds(i != 0 ? AppCompatResources.getDrawable(context, i) : null, i2 != 0 ? AppCompatResources.getDrawable(context, i2) : null, i3 != 0 ? AppCompatResources.getDrawable(context, i3) : null, i4 != 0 ? AppCompatResources.getDrawable(context, i4) : null);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesRelativeWithIntrinsicBounds(int i, int i2, int i3, int i4) {
|
||||
Context context = getContext();
|
||||
setCompoundDrawablesRelativeWithIntrinsicBounds(i != 0 ? AppCompatResources.getDrawable(context, i) : null, i2 != 0 ? AppCompatResources.getDrawable(context, i2) : null, i3 != 0 ? AppCompatResources.getDrawable(context, i3) : null, i4 != 0 ? AppCompatResources.getDrawable(context, i4) : null);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public ColorStateList getSupportCompoundDrawablesTintList() {
|
||||
return this.mTextHelper.getCompoundDrawableTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
|
||||
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
|
||||
return this.mTextHelper.getCompoundDrawableTintMode();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
|
||||
this.mTextHelper.setCompoundDrawableTintMode(mode);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setTypeface(Typeface typeface, int i) {
|
||||
if (this.mIsSetTypefaceProcessing) {
|
||||
return;
|
||||
}
|
||||
Typeface create = (typeface == null || i <= 0) ? null : TypefaceCompat.create(getContext(), typeface, i);
|
||||
this.mIsSetTypefaceProcessing = true;
|
||||
if (create != null) {
|
||||
typeface = create;
|
||||
}
|
||||
try {
|
||||
super.setTypeface(typeface, i);
|
||||
} finally {
|
||||
this.mIsSetTypefaceProcessing = false;
|
||||
}
|
||||
}
|
||||
|
||||
SuperCaller getSuperCaller() {
|
||||
if (this.mSuperCaller == null) {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
this.mSuperCaller = new SuperCallerApi28();
|
||||
} else if (Build.VERSION.SDK_INT >= 26) {
|
||||
this.mSuperCaller = new SuperCallerApi26();
|
||||
}
|
||||
}
|
||||
return this.mSuperCaller;
|
||||
}
|
||||
|
||||
class SuperCallerApi26 implements SuperCaller {
|
||||
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCaller
|
||||
public void setFirstBaselineToTopHeight(int i) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCaller
|
||||
public void setLastBaselineToBottomHeight(int i) {
|
||||
}
|
||||
|
||||
SuperCallerApi26() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCaller
|
||||
public int getAutoSizeMaxTextSize() {
|
||||
return AppCompatTextView.super.getAutoSizeMaxTextSize();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCaller
|
||||
public int getAutoSizeMinTextSize() {
|
||||
return AppCompatTextView.super.getAutoSizeMinTextSize();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCaller
|
||||
public int getAutoSizeStepGranularity() {
|
||||
return AppCompatTextView.super.getAutoSizeStepGranularity();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCaller
|
||||
public int[] getAutoSizeTextAvailableSizes() {
|
||||
return AppCompatTextView.super.getAutoSizeTextAvailableSizes();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCaller
|
||||
public int getAutoSizeTextType() {
|
||||
return AppCompatTextView.super.getAutoSizeTextType();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCaller
|
||||
public TextClassifier getTextClassifier() {
|
||||
return AppCompatTextView.super.getTextClassifier();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCaller
|
||||
public void setAutoSizeTextTypeUniformWithConfiguration(int i, int i2, int i3, int i4) {
|
||||
AppCompatTextView.super.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCaller
|
||||
public void setAutoSizeTextTypeUniformWithPresetSizes(int[] iArr, int i) {
|
||||
AppCompatTextView.super.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCaller
|
||||
public void setAutoSizeTextTypeWithDefaults(int i) {
|
||||
AppCompatTextView.super.setAutoSizeTextTypeWithDefaults(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCaller
|
||||
public void setTextClassifier(TextClassifier textClassifier) {
|
||||
AppCompatTextView.super.setTextClassifier(textClassifier);
|
||||
}
|
||||
}
|
||||
|
||||
class SuperCallerApi28 extends SuperCallerApi26 {
|
||||
SuperCallerApi28() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCallerApi26, androidx.appcompat.widget.AppCompatTextView.SuperCaller
|
||||
public void setFirstBaselineToTopHeight(int i) {
|
||||
AppCompatTextView.super.setFirstBaselineToTopHeight(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCallerApi26, androidx.appcompat.widget.AppCompatTextView.SuperCaller
|
||||
public void setLastBaselineToBottomHeight(int i) {
|
||||
AppCompatTextView.super.setLastBaselineToBottomHeight(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,523 @@
|
||||
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.view.View;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import java.lang.reflect.Field;
|
||||
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 int DEFAULT_AUTO_SIZE_GRANULARITY_IN_PX = 1;
|
||||
private static final int DEFAULT_AUTO_SIZE_MAX_TEXT_SIZE_IN_SP = 112;
|
||||
private static final int DEFAULT_AUTO_SIZE_MIN_TEXT_SIZE_IN_SP = 12;
|
||||
private static final String TAG = "ACTVAutoSizeHelper";
|
||||
static final float UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE = -1.0f;
|
||||
private static final int VERY_WIDE = 1048576;
|
||||
private final Context mContext;
|
||||
private final Impl mImpl;
|
||||
private TextPaint mTempTextPaint;
|
||||
private final TextView mTextView;
|
||||
private static final RectF TEMP_RECTF = new RectF();
|
||||
private static ConcurrentHashMap<String, Method> sTextViewMethodByNameCache = new ConcurrentHashMap<>();
|
||||
private static ConcurrentHashMap<String, Field> sTextViewFieldByNameCache = new ConcurrentHashMap<>();
|
||||
private int mAutoSizeTextType = 0;
|
||||
private boolean mNeedsAutoSizeText = false;
|
||||
private float mAutoSizeStepGranularityInPx = UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE;
|
||||
private float mAutoSizeMinTextSizeInPx = UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE;
|
||||
private float mAutoSizeMaxTextSizeInPx = UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE;
|
||||
private int[] mAutoSizeTextSizesInPx = new int[0];
|
||||
private boolean mHasPresetAutoSizeValues = false;
|
||||
|
||||
private void clearAutoSizeConfiguration() {
|
||||
this.mAutoSizeTextType = 0;
|
||||
this.mAutoSizeMinTextSizeInPx = UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE;
|
||||
this.mAutoSizeMaxTextSizeInPx = UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE;
|
||||
this.mAutoSizeStepGranularityInPx = UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE;
|
||||
this.mAutoSizeTextSizesInPx = new int[0];
|
||||
this.mNeedsAutoSizeText = false;
|
||||
}
|
||||
|
||||
int[] getAutoSizeTextAvailableSizes() {
|
||||
return this.mAutoSizeTextSizesInPx;
|
||||
}
|
||||
|
||||
int getAutoSizeTextType() {
|
||||
return this.mAutoSizeTextType;
|
||||
}
|
||||
|
||||
private static class Impl {
|
||||
void computeAndSetTextDirection(StaticLayout.Builder builder, TextView textView) {
|
||||
}
|
||||
|
||||
Impl() {
|
||||
}
|
||||
|
||||
boolean isHorizontallyScrollable(TextView textView) {
|
||||
return ((Boolean) AppCompatTextViewAutoSizeHelper.invokeAndReturnWithDefault(textView, "getHorizontallyScrolling", false)).booleanValue();
|
||||
}
|
||||
}
|
||||
|
||||
private static class Impl23 extends Impl {
|
||||
Impl23() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextViewAutoSizeHelper.Impl
|
||||
void computeAndSetTextDirection(StaticLayout.Builder builder, TextView textView) {
|
||||
builder.setTextDirection((TextDirectionHeuristic) AppCompatTextViewAutoSizeHelper.invokeAndReturnWithDefault(textView, "getTextDirectionHeuristic", TextDirectionHeuristics.FIRSTSTRONG_LTR));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Impl29 extends Impl23 {
|
||||
Impl29() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextViewAutoSizeHelper.Impl
|
||||
boolean isHorizontallyScrollable(TextView textView) {
|
||||
boolean isHorizontallyScrollable;
|
||||
isHorizontallyScrollable = textView.isHorizontallyScrollable();
|
||||
return isHorizontallyScrollable;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextViewAutoSizeHelper.Impl23, androidx.appcompat.widget.AppCompatTextViewAutoSizeHelper.Impl
|
||||
void computeAndSetTextDirection(StaticLayout.Builder builder, TextView textView) {
|
||||
TextDirectionHeuristic textDirectionHeuristic;
|
||||
textDirectionHeuristic = textView.getTextDirectionHeuristic();
|
||||
builder.setTextDirection(textDirectionHeuristic);
|
||||
}
|
||||
}
|
||||
|
||||
AppCompatTextViewAutoSizeHelper(TextView textView) {
|
||||
this.mTextView = textView;
|
||||
this.mContext = textView.getContext();
|
||||
if (Build.VERSION.SDK_INT >= 29) {
|
||||
this.mImpl = new Impl29();
|
||||
} else if (Build.VERSION.SDK_INT >= 23) {
|
||||
this.mImpl = new Impl23();
|
||||
} else {
|
||||
this.mImpl = new Impl();
|
||||
}
|
||||
}
|
||||
|
||||
void loadFromAttributes(AttributeSet attributeSet, int i) {
|
||||
int resourceId;
|
||||
TypedArray obtainStyledAttributes = this.mContext.obtainStyledAttributes(attributeSet, R.styleable.AppCompatTextView, i, 0);
|
||||
TextView textView = this.mTextView;
|
||||
ViewCompat.saveAttributeDataForStyleable(textView, textView.getContext(), R.styleable.AppCompatTextView, attributeSet, obtainStyledAttributes, i, 0);
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTextView_autoSizeTextType)) {
|
||||
this.mAutoSizeTextType = obtainStyledAttributes.getInt(R.styleable.AppCompatTextView_autoSizeTextType, 0);
|
||||
}
|
||||
float dimension = obtainStyledAttributes.hasValue(R.styleable.AppCompatTextView_autoSizeStepGranularity) ? obtainStyledAttributes.getDimension(R.styleable.AppCompatTextView_autoSizeStepGranularity, UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE) : UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE;
|
||||
float dimension2 = obtainStyledAttributes.hasValue(R.styleable.AppCompatTextView_autoSizeMinTextSize) ? obtainStyledAttributes.getDimension(R.styleable.AppCompatTextView_autoSizeMinTextSize, UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE) : UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE;
|
||||
float dimension3 = obtainStyledAttributes.hasValue(R.styleable.AppCompatTextView_autoSizeMaxTextSize) ? obtainStyledAttributes.getDimension(R.styleable.AppCompatTextView_autoSizeMaxTextSize, UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE) : UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE;
|
||||
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTextView_autoSizePresetSizes) && (resourceId = obtainStyledAttributes.getResourceId(R.styleable.AppCompatTextView_autoSizePresetSizes, 0)) > 0) {
|
||||
TypedArray obtainTypedArray = obtainStyledAttributes.getResources().obtainTypedArray(resourceId);
|
||||
setupAutoSizeUniformPresetSizes(obtainTypedArray);
|
||||
obtainTypedArray.recycle();
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
if (!supportsAutoSizeText()) {
|
||||
this.mAutoSizeTextType = 0;
|
||||
return;
|
||||
}
|
||||
if (this.mAutoSizeTextType == 1) {
|
||||
if (!this.mHasPresetAutoSizeValues) {
|
||||
DisplayMetrics displayMetrics = this.mContext.getResources().getDisplayMetrics();
|
||||
if (dimension2 == UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE) {
|
||||
dimension2 = TypedValue.applyDimension(2, 12.0f, displayMetrics);
|
||||
}
|
||||
if (dimension3 == UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE) {
|
||||
dimension3 = TypedValue.applyDimension(2, 112.0f, displayMetrics);
|
||||
}
|
||||
if (dimension == UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE) {
|
||||
dimension = 1.0f;
|
||||
}
|
||||
validateAndSetAutoSizeTextTypeUniformConfiguration(dimension2, dimension3, dimension);
|
||||
}
|
||||
setupAutoSizeText();
|
||||
}
|
||||
}
|
||||
|
||||
void setAutoSizeTextTypeWithDefaults(int i) {
|
||||
if (supportsAutoSizeText()) {
|
||||
if (i == 0) {
|
||||
clearAutoSizeConfiguration();
|
||||
return;
|
||||
}
|
||||
if (i == 1) {
|
||||
DisplayMetrics displayMetrics = this.mContext.getResources().getDisplayMetrics();
|
||||
validateAndSetAutoSizeTextTypeUniformConfiguration(TypedValue.applyDimension(2, 12.0f, displayMetrics), TypedValue.applyDimension(2, 112.0f, displayMetrics), 1.0f);
|
||||
if (setupAutoSizeText()) {
|
||||
autoSizeText();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown auto-size text type: " + i);
|
||||
}
|
||||
}
|
||||
|
||||
void setAutoSizeTextTypeUniformWithConfiguration(int i, int i2, int i3, int i4) throws IllegalArgumentException {
|
||||
if (supportsAutoSizeText()) {
|
||||
DisplayMetrics displayMetrics = this.mContext.getResources().getDisplayMetrics();
|
||||
validateAndSetAutoSizeTextTypeUniformConfiguration(TypedValue.applyDimension(i4, i, displayMetrics), TypedValue.applyDimension(i4, i2, displayMetrics), TypedValue.applyDimension(i4, i3, displayMetrics));
|
||||
if (setupAutoSizeText()) {
|
||||
autoSizeText();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setAutoSizeTextTypeUniformWithPresetSizes(int[] iArr, int i) throws IllegalArgumentException {
|
||||
if (supportsAutoSizeText()) {
|
||||
int length = iArr.length;
|
||||
if (length > 0) {
|
||||
int[] iArr2 = new int[length];
|
||||
if (i == 0) {
|
||||
iArr2 = Arrays.copyOf(iArr, length);
|
||||
} else {
|
||||
DisplayMetrics displayMetrics = this.mContext.getResources().getDisplayMetrics();
|
||||
for (int i2 = 0; i2 < length; i2++) {
|
||||
iArr2[i2] = Math.round(TypedValue.applyDimension(i, iArr[i2], displayMetrics));
|
||||
}
|
||||
}
|
||||
this.mAutoSizeTextSizesInPx = cleanupAutoSizePresetSizes(iArr2);
|
||||
if (!setupAutoSizeUniformPresetSizesConfiguration()) {
|
||||
throw new IllegalArgumentException("None of the preset sizes is valid: " + Arrays.toString(iArr));
|
||||
}
|
||||
} else {
|
||||
this.mHasPresetAutoSizeValues = false;
|
||||
}
|
||||
if (setupAutoSizeText()) {
|
||||
autoSizeText();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int getAutoSizeStepGranularity() {
|
||||
return Math.round(this.mAutoSizeStepGranularityInPx);
|
||||
}
|
||||
|
||||
int getAutoSizeMinTextSize() {
|
||||
return Math.round(this.mAutoSizeMinTextSizeInPx);
|
||||
}
|
||||
|
||||
int getAutoSizeMaxTextSize() {
|
||||
return Math.round(this.mAutoSizeMaxTextSizeInPx);
|
||||
}
|
||||
|
||||
private void setupAutoSizeUniformPresetSizes(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.mAutoSizeTextSizesInPx = cleanupAutoSizePresetSizes(iArr);
|
||||
setupAutoSizeUniformPresetSizesConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean setupAutoSizeUniformPresetSizesConfiguration() {
|
||||
boolean z = this.mAutoSizeTextSizesInPx.length > 0;
|
||||
this.mHasPresetAutoSizeValues = z;
|
||||
if (z) {
|
||||
this.mAutoSizeTextType = 1;
|
||||
this.mAutoSizeMinTextSizeInPx = r0[0];
|
||||
this.mAutoSizeMaxTextSizeInPx = r0[r1 - 1];
|
||||
this.mAutoSizeStepGranularityInPx = UNSET_AUTO_SIZE_UNIFORM_CONFIGURATION_VALUE;
|
||||
}
|
||||
return z;
|
||||
}
|
||||
|
||||
private int[] cleanupAutoSizePresetSizes(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 validateAndSetAutoSizeTextTypeUniformConfiguration(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) {
|
||||
throw new IllegalArgumentException("The auto-size step granularity (" + f3 + "px) is less or equal to (0px)");
|
||||
}
|
||||
this.mAutoSizeTextType = 1;
|
||||
this.mAutoSizeMinTextSizeInPx = f;
|
||||
this.mAutoSizeMaxTextSizeInPx = f2;
|
||||
this.mAutoSizeStepGranularityInPx = f3;
|
||||
this.mHasPresetAutoSizeValues = false;
|
||||
}
|
||||
|
||||
private boolean setupAutoSizeText() {
|
||||
if (supportsAutoSizeText() && this.mAutoSizeTextType == 1) {
|
||||
if (!this.mHasPresetAutoSizeValues || this.mAutoSizeTextSizesInPx.length == 0) {
|
||||
int floor = ((int) Math.floor((this.mAutoSizeMaxTextSizeInPx - this.mAutoSizeMinTextSizeInPx) / this.mAutoSizeStepGranularityInPx)) + 1;
|
||||
int[] iArr = new int[floor];
|
||||
for (int i = 0; i < floor; i++) {
|
||||
iArr[i] = Math.round(this.mAutoSizeMinTextSizeInPx + (i * this.mAutoSizeStepGranularityInPx));
|
||||
}
|
||||
this.mAutoSizeTextSizesInPx = cleanupAutoSizePresetSizes(iArr);
|
||||
}
|
||||
this.mNeedsAutoSizeText = true;
|
||||
} else {
|
||||
this.mNeedsAutoSizeText = false;
|
||||
}
|
||||
return this.mNeedsAutoSizeText;
|
||||
}
|
||||
|
||||
void autoSizeText() {
|
||||
if (isAutoSizeEnabled()) {
|
||||
if (this.mNeedsAutoSizeText) {
|
||||
if (this.mTextView.getMeasuredHeight() <= 0 || this.mTextView.getMeasuredWidth() <= 0) {
|
||||
return;
|
||||
}
|
||||
int measuredWidth = this.mImpl.isHorizontallyScrollable(this.mTextView) ? 1048576 : (this.mTextView.getMeasuredWidth() - this.mTextView.getTotalPaddingLeft()) - this.mTextView.getTotalPaddingRight();
|
||||
int height = (this.mTextView.getHeight() - this.mTextView.getCompoundPaddingBottom()) - this.mTextView.getCompoundPaddingTop();
|
||||
if (measuredWidth <= 0 || height <= 0) {
|
||||
return;
|
||||
}
|
||||
RectF rectF = TEMP_RECTF;
|
||||
synchronized (rectF) {
|
||||
rectF.setEmpty();
|
||||
rectF.right = measuredWidth;
|
||||
rectF.bottom = height;
|
||||
float findLargestTextSizeWhichFits = findLargestTextSizeWhichFits(rectF);
|
||||
if (findLargestTextSizeWhichFits != this.mTextView.getTextSize()) {
|
||||
setTextSizeInternal(0, findLargestTextSizeWhichFits);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.mNeedsAutoSizeText = true;
|
||||
}
|
||||
}
|
||||
|
||||
void setTextSizeInternal(int i, float f) {
|
||||
Resources resources;
|
||||
Context context = this.mContext;
|
||||
if (context == null) {
|
||||
resources = Resources.getSystem();
|
||||
} else {
|
||||
resources = context.getResources();
|
||||
}
|
||||
setRawTextSize(TypedValue.applyDimension(i, f, resources.getDisplayMetrics()));
|
||||
}
|
||||
|
||||
private void setRawTextSize(float f) {
|
||||
if (f != this.mTextView.getPaint().getTextSize()) {
|
||||
this.mTextView.getPaint().setTextSize(f);
|
||||
boolean isInLayout = Api18Impl.isInLayout(this.mTextView);
|
||||
if (this.mTextView.getLayout() != null) {
|
||||
this.mNeedsAutoSizeText = false;
|
||||
try {
|
||||
Method textViewMethod = getTextViewMethod("nullLayouts");
|
||||
if (textViewMethod != null) {
|
||||
textViewMethod.invoke(this.mTextView, new Object[0]);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Failed to invoke TextView#nullLayouts() method", e);
|
||||
}
|
||||
if (!isInLayout) {
|
||||
this.mTextView.requestLayout();
|
||||
} else {
|
||||
this.mTextView.forceLayout();
|
||||
}
|
||||
this.mTextView.invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int findLargestTextSizeWhichFits(RectF rectF) {
|
||||
int length = this.mAutoSizeTextSizesInPx.length;
|
||||
if (length == 0) {
|
||||
throw new IllegalStateException("No available text sizes to choose from.");
|
||||
}
|
||||
int i = 1;
|
||||
int i2 = length - 1;
|
||||
int i3 = 0;
|
||||
while (i <= i2) {
|
||||
int i4 = (i + i2) / 2;
|
||||
if (suggestedSizeFitsInSpace(this.mAutoSizeTextSizesInPx[i4], rectF)) {
|
||||
int i5 = i4 + 1;
|
||||
i3 = i;
|
||||
i = i5;
|
||||
} else {
|
||||
i3 = i4 - 1;
|
||||
i2 = i3;
|
||||
}
|
||||
}
|
||||
return this.mAutoSizeTextSizesInPx[i3];
|
||||
}
|
||||
|
||||
void initTempTextPaint(int i) {
|
||||
TextPaint textPaint = this.mTempTextPaint;
|
||||
if (textPaint == null) {
|
||||
this.mTempTextPaint = new TextPaint();
|
||||
} else {
|
||||
textPaint.reset();
|
||||
}
|
||||
this.mTempTextPaint.set(this.mTextView.getPaint());
|
||||
this.mTempTextPaint.setTextSize(i);
|
||||
}
|
||||
|
||||
StaticLayout createLayout(CharSequence charSequence, Layout.Alignment alignment, int i, int i2) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
return Api23Impl.createStaticLayoutForMeasuring(charSequence, alignment, i, i2, this.mTextView, this.mTempTextPaint, this.mImpl);
|
||||
}
|
||||
return Api16Impl.createStaticLayoutForMeasuring(charSequence, alignment, i, this.mTextView, this.mTempTextPaint);
|
||||
}
|
||||
|
||||
private boolean suggestedSizeFitsInSpace(int i, RectF rectF) {
|
||||
CharSequence transformation;
|
||||
CharSequence text = this.mTextView.getText();
|
||||
TransformationMethod transformationMethod = this.mTextView.getTransformationMethod();
|
||||
if (transformationMethod != null && (transformation = transformationMethod.getTransformation(text, this.mTextView)) != null) {
|
||||
text = transformation;
|
||||
}
|
||||
int maxLines = Api16Impl.getMaxLines(this.mTextView);
|
||||
initTempTextPaint(i);
|
||||
StaticLayout createLayout = createLayout(text, (Layout.Alignment) invokeAndReturnWithDefault(this.mTextView, "getLayoutAlignment", Layout.Alignment.ALIGN_NORMAL), Math.round(rectF.right), maxLines);
|
||||
return (maxLines == -1 || (createLayout.getLineCount() <= maxLines && createLayout.getLineEnd(createLayout.getLineCount() - 1) == text.length())) && ((float) createLayout.getHeight()) <= rectF.bottom;
|
||||
}
|
||||
|
||||
private StaticLayout createStaticLayoutForMeasuringPre16(CharSequence charSequence, Layout.Alignment alignment, int i) {
|
||||
return new StaticLayout(charSequence, this.mTempTextPaint, i, alignment, ((Float) accessAndReturnWithDefault(this.mTextView, "mSpacingMult", Float.valueOf(1.0f))).floatValue(), ((Float) accessAndReturnWithDefault(this.mTextView, "mSpacingAdd", Float.valueOf(0.0f))).floatValue(), ((Boolean) accessAndReturnWithDefault(this.mTextView, "mIncludePad", true)).booleanValue());
|
||||
}
|
||||
|
||||
static <T> T invokeAndReturnWithDefault(Object obj, String str, T t) {
|
||||
try {
|
||||
return (T) getTextViewMethod(str).invoke(obj, new Object[0]);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Failed to invoke TextView#" + str + "() method", e);
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> T accessAndReturnWithDefault(Object obj, String str, T t) {
|
||||
try {
|
||||
Field textViewField = getTextViewField(str);
|
||||
return textViewField == null ? t : (T) textViewField.get(obj);
|
||||
} catch (IllegalAccessException e) {
|
||||
Log.w(TAG, "Failed to access TextView#" + str + " member", e);
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
private static Method getTextViewMethod(String str) {
|
||||
try {
|
||||
Method method = sTextViewMethodByNameCache.get(str);
|
||||
if (method == null && (method = TextView.class.getDeclaredMethod(str, new Class[0])) != null) {
|
||||
method.setAccessible(true);
|
||||
sTextViewMethodByNameCache.put(str, method);
|
||||
}
|
||||
return method;
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Failed to retrieve TextView#" + str + "() method", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static Field getTextViewField(String str) {
|
||||
try {
|
||||
Field field = sTextViewFieldByNameCache.get(str);
|
||||
if (field == null && (field = TextView.class.getDeclaredField(str)) != null) {
|
||||
field.setAccessible(true);
|
||||
sTextViewFieldByNameCache.put(str, field);
|
||||
}
|
||||
return field;
|
||||
} catch (NoSuchFieldException e) {
|
||||
Log.w(TAG, "Failed to access TextView#" + str + " member", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
boolean isAutoSizeEnabled() {
|
||||
return supportsAutoSizeText() && this.mAutoSizeTextType != 0;
|
||||
}
|
||||
|
||||
private boolean supportsAutoSizeText() {
|
||||
return !(this.mTextView instanceof AppCompatEditText);
|
||||
}
|
||||
|
||||
private static final class Api23Impl {
|
||||
private Api23Impl() {
|
||||
}
|
||||
|
||||
static StaticLayout createStaticLayoutForMeasuring(CharSequence charSequence, Layout.Alignment alignment, int i, int i2, TextView textView, TextPaint textPaint, Impl impl) {
|
||||
StaticLayout.Builder obtain = StaticLayout.Builder.obtain(charSequence, 0, charSequence.length(), textPaint, i);
|
||||
StaticLayout.Builder hyphenationFrequency = obtain.setAlignment(alignment).setLineSpacing(textView.getLineSpacingExtra(), textView.getLineSpacingMultiplier()).setIncludePad(textView.getIncludeFontPadding()).setBreakStrategy(textView.getBreakStrategy()).setHyphenationFrequency(textView.getHyphenationFrequency());
|
||||
if (i2 == -1) {
|
||||
i2 = Integer.MAX_VALUE;
|
||||
}
|
||||
hyphenationFrequency.setMaxLines(i2);
|
||||
try {
|
||||
impl.computeAndSetTextDirection(obtain, textView);
|
||||
} catch (ClassCastException unused) {
|
||||
Log.w(AppCompatTextViewAutoSizeHelper.TAG, "Failed to obtain TextDirectionHeuristic, auto size may be incorrect");
|
||||
}
|
||||
return obtain.build();
|
||||
}
|
||||
}
|
||||
|
||||
private static final class Api18Impl {
|
||||
private Api18Impl() {
|
||||
}
|
||||
|
||||
static boolean isInLayout(View view) {
|
||||
return view.isInLayout();
|
||||
}
|
||||
}
|
||||
|
||||
private static final class Api16Impl {
|
||||
private Api16Impl() {
|
||||
}
|
||||
|
||||
static int getMaxLines(TextView textView) {
|
||||
return textView.getMaxLines();
|
||||
}
|
||||
|
||||
static StaticLayout createStaticLayoutForMeasuring(CharSequence charSequence, Layout.Alignment alignment, int i, TextView textView, TextPaint textPaint) {
|
||||
return new StaticLayout(charSequence, textPaint, i, alignment, textView.getLineSpacingMultiplier(), textView.getLineSpacingExtra(), textView.getIncludeFontPadding());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
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.text.InputFilter;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ToggleButton;
|
||||
import androidx.core.view.TintableBackgroundView;
|
||||
import androidx.core.widget.TintableCompoundDrawablesView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AppCompatToggleButton extends ToggleButton implements TintableBackgroundView, EmojiCompatConfigurationView, TintableCompoundDrawablesView {
|
||||
private AppCompatEmojiTextHelper mAppCompatEmojiTextHelper;
|
||||
private final AppCompatBackgroundHelper mBackgroundTintHelper;
|
||||
private final AppCompatTextHelper mTextHelper;
|
||||
|
||||
public AppCompatToggleButton(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public AppCompatToggleButton(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.buttonStyleToggle);
|
||||
}
|
||||
|
||||
public AppCompatToggleButton(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
ThemeUtils.checkAppCompatTheme(this, getContext());
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = new AppCompatBackgroundHelper(this);
|
||||
this.mBackgroundTintHelper = appCompatBackgroundHelper;
|
||||
appCompatBackgroundHelper.loadFromAttributes(attributeSet, i);
|
||||
AppCompatTextHelper appCompatTextHelper = new AppCompatTextHelper(this);
|
||||
this.mTextHelper = appCompatTextHelper;
|
||||
appCompatTextHelper.loadFromAttributes(attributeSet, i);
|
||||
getEmojiTextViewHelper().loadFromAttributes(attributeSet, i);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setBackgroundResource(int i) {
|
||||
super.setBackgroundResource(i);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundResource(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.ToggleButton, android.view.View
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
super.setBackgroundDrawable(drawable);
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public ColorStateList getSupportBackgroundTintList() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.TintableBackgroundView
|
||||
public PorterDuff.Mode getSupportBackgroundTintMode() {
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // android.widget.ToggleButton, android.widget.CompoundButton, android.widget.TextView, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
super.drawableStateChanged();
|
||||
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
|
||||
if (appCompatBackgroundHelper != null) {
|
||||
appCompatBackgroundHelper.applySupportBackgroundTint();
|
||||
}
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setFilters(InputFilter[] inputFilterArr) {
|
||||
super.setFilters(getEmojiTextViewHelper().getFilters(inputFilterArr));
|
||||
}
|
||||
|
||||
private AppCompatEmojiTextHelper getEmojiTextViewHelper() {
|
||||
if (this.mAppCompatEmojiTextHelper == null) {
|
||||
this.mAppCompatEmojiTextHelper = new AppCompatEmojiTextHelper(this);
|
||||
}
|
||||
return this.mAppCompatEmojiTextHelper;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setAllCaps(boolean z) {
|
||||
super.setAllCaps(z);
|
||||
getEmojiTextViewHelper().setAllCaps(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public void setEmojiCompatEnabled(boolean z) {
|
||||
getEmojiTextViewHelper().setEnabled(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.EmojiCompatConfigurationView
|
||||
public boolean isEmojiCompatEnabled() {
|
||||
return getEmojiTextViewHelper().isEnabled();
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawables(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView
|
||||
public void setCompoundDrawablesRelative(Drawable drawable, Drawable drawable2, Drawable drawable3, Drawable drawable4) {
|
||||
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
|
||||
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
|
||||
if (appCompatTextHelper != null) {
|
||||
appCompatTextHelper.onSetCompoundDrawables();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public ColorStateList getSupportCompoundDrawablesTintList() {
|
||||
return this.mTextHelper.getCompoundDrawableTintList();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintList(ColorStateList colorStateList) {
|
||||
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
|
||||
return this.mTextHelper.getCompoundDrawableTintMode();
|
||||
}
|
||||
|
||||
@Override // androidx.core.widget.TintableCompoundDrawablesView
|
||||
public void setSupportCompoundDrawablesTintMode(PorterDuff.Mode mode) {
|
||||
this.mTextHelper.setCompoundDrawableTintMode(mode);
|
||||
this.mTextHelper.applyCompoundDrawablesTints();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
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;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ButtonBarLayout extends LinearLayout {
|
||||
private static final int PEEK_BUTTON_DP = 16;
|
||||
private boolean mAllowStacking;
|
||||
private int mLastWidthSize;
|
||||
private boolean mStacked;
|
||||
|
||||
private boolean isStacked() {
|
||||
return this.mStacked;
|
||||
}
|
||||
|
||||
public ButtonBarLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.mLastWidthSize = -1;
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.ButtonBarLayout);
|
||||
ViewCompat.saveAttributeDataForStyleable(this, context, R.styleable.ButtonBarLayout, attributeSet, obtainStyledAttributes, 0, 0);
|
||||
this.mAllowStacking = obtainStyledAttributes.getBoolean(R.styleable.ButtonBarLayout_allowStacking, true);
|
||||
obtainStyledAttributes.recycle();
|
||||
if (getOrientation() == 1) {
|
||||
setStacked(this.mAllowStacking);
|
||||
}
|
||||
}
|
||||
|
||||
public void setAllowStacking(boolean z) {
|
||||
if (this.mAllowStacking != z) {
|
||||
this.mAllowStacking = z;
|
||||
if (!z && isStacked()) {
|
||||
setStacked(false);
|
||||
}
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:40:0x004d, code lost:
|
||||
|
||||
if (r1 != false) goto L24;
|
||||
*/
|
||||
@Override // android.widget.LinearLayout, android.view.View
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
protected void onMeasure(int r6, int r7) {
|
||||
/*
|
||||
r5 = this;
|
||||
int r0 = android.view.View.MeasureSpec.getSize(r6)
|
||||
boolean r1 = r5.mAllowStacking
|
||||
r2 = 0
|
||||
if (r1 == 0) goto L18
|
||||
int r1 = r5.mLastWidthSize
|
||||
if (r0 <= r1) goto L16
|
||||
boolean r1 = r5.isStacked()
|
||||
if (r1 == 0) goto L16
|
||||
r5.setStacked(r2)
|
||||
L16:
|
||||
r5.mLastWidthSize = r0
|
||||
L18:
|
||||
boolean r1 = r5.isStacked()
|
||||
r3 = 1
|
||||
if (r1 != 0) goto L2f
|
||||
int r1 = android.view.View.MeasureSpec.getMode(r6)
|
||||
r4 = 1073741824(0x40000000, float:2.0)
|
||||
if (r1 != r4) goto L2f
|
||||
r1 = -2147483648(0xffffffff80000000, float:-0.0)
|
||||
int r0 = android.view.View.MeasureSpec.makeMeasureSpec(r0, r1)
|
||||
r1 = 1
|
||||
goto L31
|
||||
L2f:
|
||||
r0 = r6
|
||||
r1 = 0
|
||||
L31:
|
||||
super.onMeasure(r0, r7)
|
||||
boolean r0 = r5.mAllowStacking
|
||||
if (r0 == 0) goto L4d
|
||||
boolean r0 = r5.isStacked()
|
||||
if (r0 != 0) goto L4d
|
||||
int r0 = r5.getMeasuredWidthAndState()
|
||||
r4 = -16777216(0xffffffffff000000, float:-1.7014118E38)
|
||||
r0 = r0 & r4
|
||||
r4 = 16777216(0x1000000, float:2.3509887E-38)
|
||||
if (r0 != r4) goto L4d
|
||||
r5.setStacked(r3)
|
||||
goto L4f
|
||||
L4d:
|
||||
if (r1 == 0) goto L52
|
||||
L4f:
|
||||
super.onMeasure(r6, r7)
|
||||
L52:
|
||||
int r0 = r5.getNextVisibleChildIndex(r2)
|
||||
if (r0 < 0) goto L9f
|
||||
android.view.View r1 = r5.getChildAt(r0)
|
||||
android.view.ViewGroup$LayoutParams r2 = r1.getLayoutParams()
|
||||
android.widget.LinearLayout$LayoutParams r2 = (android.widget.LinearLayout.LayoutParams) r2
|
||||
int r4 = r5.getPaddingTop()
|
||||
int r1 = r1.getMeasuredHeight()
|
||||
int r4 = r4 + r1
|
||||
int r1 = r2.topMargin
|
||||
int r4 = r4 + r1
|
||||
int r1 = r2.bottomMargin
|
||||
int r4 = r4 + r1
|
||||
boolean r1 = r5.isStacked()
|
||||
if (r1 == 0) goto L99
|
||||
int r0 = r0 + r3
|
||||
int r0 = r5.getNextVisibleChildIndex(r0)
|
||||
if (r0 < 0) goto L97
|
||||
android.view.View r0 = r5.getChildAt(r0)
|
||||
int r0 = r0.getPaddingTop()
|
||||
android.content.res.Resources r1 = r5.getResources()
|
||||
android.util.DisplayMetrics r1 = r1.getDisplayMetrics()
|
||||
float r1 = r1.density
|
||||
r2 = 1098907648(0x41800000, float:16.0)
|
||||
float r1 = r1 * r2
|
||||
int r1 = (int) r1
|
||||
int r0 = r0 + r1
|
||||
int r4 = r4 + r0
|
||||
L97:
|
||||
r2 = r4
|
||||
goto L9f
|
||||
L99:
|
||||
int r0 = r5.getPaddingBottom()
|
||||
int r2 = r4 + r0
|
||||
L9f:
|
||||
int r0 = androidx.core.view.ViewCompat.getMinimumHeight(r5)
|
||||
if (r0 == r2) goto Lad
|
||||
r5.setMinimumHeight(r2)
|
||||
if (r7 != 0) goto Lad
|
||||
super.onMeasure(r6, r7)
|
||||
Lad:
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ButtonBarLayout.onMeasure(int, int):void");
|
||||
}
|
||||
|
||||
private int getNextVisibleChildIndex(int i) {
|
||||
int childCount = getChildCount();
|
||||
while (i < childCount) {
|
||||
if (getChildAt(i).getVisibility() == 0) {
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void setStacked(boolean z) {
|
||||
if (this.mStacked != z) {
|
||||
if (!z || this.mAllowStacking) {
|
||||
this.mStacked = z;
|
||||
setOrientation(z ? 1 : 0);
|
||||
setGravity(z ? GravityCompat.END : 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 OnAttachListener mAttachListener;
|
||||
private final Rect mDecorPadding;
|
||||
private TypedValue mFixedHeightMajor;
|
||||
private TypedValue mFixedHeightMinor;
|
||||
private TypedValue mFixedWidthMajor;
|
||||
private TypedValue mFixedWidthMinor;
|
||||
private TypedValue mMinWidthMajor;
|
||||
private TypedValue mMinWidthMinor;
|
||||
|
||||
public interface OnAttachListener {
|
||||
void onAttachedFromWindow();
|
||||
|
||||
void onDetachedFromWindow();
|
||||
}
|
||||
|
||||
public void setAttachListener(OnAttachListener onAttachListener) {
|
||||
this.mAttachListener = onAttachListener;
|
||||
}
|
||||
|
||||
public ContentFrameLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ContentFrameLayout(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public ContentFrameLayout(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.mDecorPadding = new Rect();
|
||||
}
|
||||
|
||||
public void dispatchFitSystemWindows(Rect rect) {
|
||||
fitSystemWindows(rect);
|
||||
}
|
||||
|
||||
public void setDecorPadding(int i, int i2, int i3, int i4) {
|
||||
this.mDecorPadding.set(i, i2, i3, i4);
|
||||
if (ViewCompat.isLaidOut(this)) {
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:16:0x0050 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:18:0x006b */
|
||||
/* JADX WARN: Removed duplicated region for block: B:28:0x0094 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:38:0x00bb */
|
||||
/* JADX WARN: Removed duplicated region for block: B:44:0x00ca */
|
||||
/* JADX WARN: Removed duplicated region for block: B:47:0x00e2 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:49:0x00ee */
|
||||
/* JADX WARN: Removed duplicated region for block: B:51:0x00f6 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:54:? A[RETURN, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:55:0x00d0 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:59:0x00be */
|
||||
@Override // android.widget.FrameLayout, android.view.View
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
protected void onMeasure(int r14, int r15) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 250
|
||||
To view this dump add '--comments-level debug' option
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ContentFrameLayout.onMeasure(int, int):void");
|
||||
}
|
||||
|
||||
public TypedValue getMinWidthMajor() {
|
||||
if (this.mMinWidthMajor == null) {
|
||||
this.mMinWidthMajor = new TypedValue();
|
||||
}
|
||||
return this.mMinWidthMajor;
|
||||
}
|
||||
|
||||
public TypedValue getMinWidthMinor() {
|
||||
if (this.mMinWidthMinor == null) {
|
||||
this.mMinWidthMinor = new TypedValue();
|
||||
}
|
||||
return this.mMinWidthMinor;
|
||||
}
|
||||
|
||||
public TypedValue getFixedWidthMajor() {
|
||||
if (this.mFixedWidthMajor == null) {
|
||||
this.mFixedWidthMajor = new TypedValue();
|
||||
}
|
||||
return this.mFixedWidthMajor;
|
||||
}
|
||||
|
||||
public TypedValue getFixedWidthMinor() {
|
||||
if (this.mFixedWidthMinor == null) {
|
||||
this.mFixedWidthMinor = new TypedValue();
|
||||
}
|
||||
return this.mFixedWidthMinor;
|
||||
}
|
||||
|
||||
public TypedValue getFixedHeightMajor() {
|
||||
if (this.mFixedHeightMajor == null) {
|
||||
this.mFixedHeightMajor = new TypedValue();
|
||||
}
|
||||
return this.mFixedHeightMajor;
|
||||
}
|
||||
|
||||
public TypedValue getFixedHeightMinor() {
|
||||
if (this.mFixedHeightMinor == null) {
|
||||
this.mFixedHeightMinor = new TypedValue();
|
||||
}
|
||||
return this.mFixedHeightMinor;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
OnAttachListener onAttachListener = this.mAttachListener;
|
||||
if (onAttachListener != null) {
|
||||
onAttachListener.onAttachedFromWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
OnAttachListener onAttachListener = this.mAttachListener;
|
||||
if (onAttachListener != null) {
|
||||
onAttachListener.onDetachedFromWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Parcelable;
|
||||
import android.util.SparseArray;
|
||||
import android.view.Menu;
|
||||
import android.view.Window;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface DecorContentParent {
|
||||
boolean canShowOverflowMenu();
|
||||
|
||||
void dismissPopups();
|
||||
|
||||
CharSequence getTitle();
|
||||
|
||||
boolean hasIcon();
|
||||
|
||||
boolean hasLogo();
|
||||
|
||||
boolean hideOverflowMenu();
|
||||
|
||||
void initFeature(int i);
|
||||
|
||||
boolean isOverflowMenuShowPending();
|
||||
|
||||
boolean isOverflowMenuShowing();
|
||||
|
||||
void restoreToolbarHierarchyState(SparseArray<Parcelable> sparseArray);
|
||||
|
||||
void saveToolbarHierarchyState(SparseArray<Parcelable> sparseArray);
|
||||
|
||||
void setIcon(int i);
|
||||
|
||||
void setIcon(Drawable drawable);
|
||||
|
||||
void setLogo(int i);
|
||||
|
||||
void setMenu(Menu menu, MenuPresenter.Callback callback);
|
||||
|
||||
void setMenuPrepared();
|
||||
|
||||
void setUiOptions(int i);
|
||||
|
||||
void setWindowCallback(Window.Callback callback);
|
||||
|
||||
void setWindowTitle(CharSequence charSequence);
|
||||
|
||||
boolean showOverflowMenu();
|
||||
}
|
||||
132
02-Easy5/E5/sources/androidx/appcompat/widget/DecorToolbar.java
Normal file
132
02-Easy5/E5/sources/androidx/appcompat/widget/DecorToolbar.java
Normal file
@@ -0,0 +1,132 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Parcelable;
|
||||
import android.util.SparseArray;
|
||||
import android.view.Menu;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.SpinnerAdapter;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
import androidx.appcompat.view.menu.MenuPresenter;
|
||||
import androidx.core.view.ViewPropertyAnimatorCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface DecorToolbar {
|
||||
void animateToVisibility(int i);
|
||||
|
||||
boolean canShowOverflowMenu();
|
||||
|
||||
void collapseActionView();
|
||||
|
||||
void dismissPopupMenus();
|
||||
|
||||
Context getContext();
|
||||
|
||||
View getCustomView();
|
||||
|
||||
int getDisplayOptions();
|
||||
|
||||
int getDropdownItemCount();
|
||||
|
||||
int getDropdownSelectedPosition();
|
||||
|
||||
int getHeight();
|
||||
|
||||
Menu getMenu();
|
||||
|
||||
int getNavigationMode();
|
||||
|
||||
CharSequence getSubtitle();
|
||||
|
||||
CharSequence getTitle();
|
||||
|
||||
ViewGroup getViewGroup();
|
||||
|
||||
int getVisibility();
|
||||
|
||||
boolean hasEmbeddedTabs();
|
||||
|
||||
boolean hasExpandedActionView();
|
||||
|
||||
boolean hasIcon();
|
||||
|
||||
boolean hasLogo();
|
||||
|
||||
boolean hideOverflowMenu();
|
||||
|
||||
void initIndeterminateProgress();
|
||||
|
||||
void initProgress();
|
||||
|
||||
boolean isOverflowMenuShowPending();
|
||||
|
||||
boolean isOverflowMenuShowing();
|
||||
|
||||
boolean isTitleTruncated();
|
||||
|
||||
void restoreHierarchyState(SparseArray<Parcelable> sparseArray);
|
||||
|
||||
void saveHierarchyState(SparseArray<Parcelable> sparseArray);
|
||||
|
||||
void setBackgroundDrawable(Drawable drawable);
|
||||
|
||||
void setCollapsible(boolean z);
|
||||
|
||||
void setCustomView(View view);
|
||||
|
||||
void setDefaultNavigationContentDescription(int i);
|
||||
|
||||
void setDefaultNavigationIcon(Drawable drawable);
|
||||
|
||||
void setDisplayOptions(int i);
|
||||
|
||||
void setDropdownParams(SpinnerAdapter spinnerAdapter, AdapterView.OnItemSelectedListener onItemSelectedListener);
|
||||
|
||||
void setDropdownSelectedPosition(int i);
|
||||
|
||||
void setEmbeddedTabView(ScrollingTabContainerView scrollingTabContainerView);
|
||||
|
||||
void setHomeButtonEnabled(boolean z);
|
||||
|
||||
void setIcon(int i);
|
||||
|
||||
void setIcon(Drawable drawable);
|
||||
|
||||
void setLogo(int i);
|
||||
|
||||
void setLogo(Drawable drawable);
|
||||
|
||||
void setMenu(Menu menu, MenuPresenter.Callback callback);
|
||||
|
||||
void setMenuCallbacks(MenuPresenter.Callback callback, MenuBuilder.Callback callback2);
|
||||
|
||||
void setMenuPrepared();
|
||||
|
||||
void setNavigationContentDescription(int i);
|
||||
|
||||
void setNavigationContentDescription(CharSequence charSequence);
|
||||
|
||||
void setNavigationIcon(int i);
|
||||
|
||||
void setNavigationIcon(Drawable drawable);
|
||||
|
||||
void setNavigationMode(int i);
|
||||
|
||||
void setSubtitle(CharSequence charSequence);
|
||||
|
||||
void setTitle(CharSequence charSequence);
|
||||
|
||||
void setVisibility(int i);
|
||||
|
||||
void setWindowCallback(Window.Callback callback);
|
||||
|
||||
void setWindowTitle(CharSequence charSequence);
|
||||
|
||||
ViewPropertyAnimatorCompat setupAnimatorToVisibility(int i, long j);
|
||||
|
||||
boolean showOverflowMenu();
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.text.Layout;
|
||||
import android.util.AttributeSet;
|
||||
import androidx.appcompat.R;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DialogTitle extends AppCompatTextView {
|
||||
public DialogTitle(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
}
|
||||
|
||||
public DialogTitle(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
public DialogTitle(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.AppCompatTextView, 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, android.R.attr.textAppearanceMedium, android.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);
|
||||
}
|
||||
}
|
||||
210
02-Easy5/E5/sources/androidx/appcompat/widget/DrawableUtils.java
Normal file
210
02-Easy5/E5/sources/androidx/appcompat/widget/DrawableUtils.java
Normal file
@@ -0,0 +1,210 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DrawableUtils {
|
||||
private static final int[] CHECKED_STATE_SET = {R.attr.state_checked};
|
||||
private static final int[] EMPTY_STATE_SET = new int[0];
|
||||
public static final Rect INSETS_NONE = new Rect();
|
||||
|
||||
public static boolean canSafelyMutateDrawable(Drawable drawable) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private DrawableUtils() {
|
||||
}
|
||||
|
||||
public static Rect getOpticalBounds(Drawable drawable) {
|
||||
int i;
|
||||
int i2;
|
||||
int i3;
|
||||
int i4;
|
||||
if (Build.VERSION.SDK_INT >= 29) {
|
||||
Insets opticalInsets = Api29Impl.getOpticalInsets(drawable);
|
||||
i = opticalInsets.left;
|
||||
i2 = opticalInsets.top;
|
||||
i3 = opticalInsets.right;
|
||||
i4 = opticalInsets.bottom;
|
||||
return new Rect(i, i2, i3, i4);
|
||||
}
|
||||
return Api18Impl.getOpticalInsets(DrawableCompat.unwrap(drawable));
|
||||
}
|
||||
|
||||
static void fixDrawable(Drawable drawable) {
|
||||
String name = drawable.getClass().getName();
|
||||
if (Build.VERSION.SDK_INT == 21 && "android.graphics.drawable.VectorDrawable".equals(name)) {
|
||||
forceDrawableStateChange(drawable);
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT < 29 || Build.VERSION.SDK_INT >= 31 || !"android.graphics.drawable.ColorStateListDrawable".equals(name)) {
|
||||
return;
|
||||
}
|
||||
forceDrawableStateChange(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
private static void forceDrawableStateChange(Drawable drawable) {
|
||||
int[] state = drawable.getState();
|
||||
if (state == null || state.length == 0) {
|
||||
drawable.setState(CHECKED_STATE_SET);
|
||||
} else {
|
||||
drawable.setState(EMPTY_STATE_SET);
|
||||
}
|
||||
drawable.setState(state);
|
||||
}
|
||||
|
||||
public static PorterDuff.Mode parseTintMode(int i, PorterDuff.Mode mode) {
|
||||
if (i == 3) {
|
||||
return PorterDuff.Mode.SRC_OVER;
|
||||
}
|
||||
if (i == 5) {
|
||||
return PorterDuff.Mode.SRC_IN;
|
||||
}
|
||||
if (i == 9) {
|
||||
return PorterDuff.Mode.SRC_ATOP;
|
||||
}
|
||||
switch (i) {
|
||||
case 14:
|
||||
return PorterDuff.Mode.MULTIPLY;
|
||||
case 15:
|
||||
return PorterDuff.Mode.SCREEN;
|
||||
case 16:
|
||||
return PorterDuff.Mode.ADD;
|
||||
default:
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
|
||||
static class Api18Impl {
|
||||
private static final Field sBottom;
|
||||
private static final Method sGetOpticalInsets;
|
||||
private static final Field sLeft;
|
||||
private static final boolean sReflectionSuccessful;
|
||||
private static final Field sRight;
|
||||
private static final Field sTop;
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:14:0x0057 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:17:0x0064 */
|
||||
static {
|
||||
/*
|
||||
r0 = 1
|
||||
r1 = 0
|
||||
r2 = 0
|
||||
java.lang.String r3 = "android.graphics.Insets"
|
||||
java.lang.Class r3 = java.lang.Class.forName(r3) // Catch: java.lang.NoSuchFieldException -> L44 java.lang.ClassNotFoundException -> L49 java.lang.NoSuchMethodException -> L4e
|
||||
java.lang.Class<android.graphics.drawable.Drawable> r4 = android.graphics.drawable.Drawable.class
|
||||
java.lang.String r5 = "getOpticalInsets"
|
||||
java.lang.Class[] r6 = new java.lang.Class[r2] // Catch: java.lang.NoSuchFieldException -> L44 java.lang.ClassNotFoundException -> L49 java.lang.NoSuchMethodException -> L4e
|
||||
java.lang.reflect.Method r4 = r4.getMethod(r5, r6) // Catch: java.lang.NoSuchFieldException -> L44 java.lang.ClassNotFoundException -> L49 java.lang.NoSuchMethodException -> L4e
|
||||
java.lang.String r5 = "left"
|
||||
java.lang.reflect.Field r5 = r3.getField(r5) // Catch: java.lang.NoSuchFieldException -> L3b java.lang.ClassNotFoundException -> L3e java.lang.NoSuchMethodException -> L41
|
||||
java.lang.String r6 = "top"
|
||||
java.lang.reflect.Field r6 = r3.getField(r6) // Catch: java.lang.NoSuchFieldException -> L32 java.lang.ClassNotFoundException -> L35 java.lang.NoSuchMethodException -> L38
|
||||
java.lang.String r7 = "right"
|
||||
java.lang.reflect.Field r7 = r3.getField(r7) // Catch: java.lang.Throwable -> L2f
|
||||
java.lang.String r8 = "bottom"
|
||||
java.lang.reflect.Field r3 = r3.getField(r8) // Catch: java.lang.Throwable -> L2d
|
||||
r8 = 1
|
||||
goto L55
|
||||
L2d:
|
||||
goto L53
|
||||
L2f:
|
||||
r7 = r1
|
||||
goto L53
|
||||
L32:
|
||||
r6 = r1
|
||||
goto L52
|
||||
L35:
|
||||
r6 = r1
|
||||
goto L52
|
||||
L38:
|
||||
r6 = r1
|
||||
goto L52
|
||||
L3b:
|
||||
r5 = r1
|
||||
goto L47
|
||||
L3e:
|
||||
r5 = r1
|
||||
goto L4c
|
||||
L41:
|
||||
r5 = r1
|
||||
goto L51
|
||||
L44:
|
||||
r4 = r1
|
||||
r5 = r4
|
||||
L47:
|
||||
r6 = r5
|
||||
goto L52
|
||||
L49:
|
||||
r4 = r1
|
||||
r5 = r4
|
||||
L4c:
|
||||
r6 = r5
|
||||
goto L52
|
||||
L4e:
|
||||
r4 = r1
|
||||
r5 = r4
|
||||
L51:
|
||||
r6 = r5
|
||||
L52:
|
||||
r7 = r6
|
||||
L53:
|
||||
r3 = r1
|
||||
r8 = 0
|
||||
L55:
|
||||
if (r8 == 0) goto L64
|
||||
androidx.appcompat.widget.DrawableUtils.Api18Impl.sGetOpticalInsets = r4
|
||||
androidx.appcompat.widget.DrawableUtils.Api18Impl.sLeft = r5
|
||||
androidx.appcompat.widget.DrawableUtils.Api18Impl.sTop = r6
|
||||
androidx.appcompat.widget.DrawableUtils.Api18Impl.sRight = r7
|
||||
androidx.appcompat.widget.DrawableUtils.Api18Impl.sBottom = r3
|
||||
androidx.appcompat.widget.DrawableUtils.Api18Impl.sReflectionSuccessful = r0
|
||||
goto L70
|
||||
L64:
|
||||
androidx.appcompat.widget.DrawableUtils.Api18Impl.sGetOpticalInsets = r1
|
||||
androidx.appcompat.widget.DrawableUtils.Api18Impl.sLeft = r1
|
||||
androidx.appcompat.widget.DrawableUtils.Api18Impl.sTop = r1
|
||||
androidx.appcompat.widget.DrawableUtils.Api18Impl.sRight = r1
|
||||
androidx.appcompat.widget.DrawableUtils.Api18Impl.sBottom = r1
|
||||
androidx.appcompat.widget.DrawableUtils.Api18Impl.sReflectionSuccessful = r2
|
||||
L70:
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.DrawableUtils.Api18Impl.<clinit>():void");
|
||||
}
|
||||
|
||||
private Api18Impl() {
|
||||
}
|
||||
|
||||
static Rect getOpticalInsets(Drawable drawable) {
|
||||
if (Build.VERSION.SDK_INT < 29 && sReflectionSuccessful) {
|
||||
try {
|
||||
Object invoke = sGetOpticalInsets.invoke(drawable, new Object[0]);
|
||||
if (invoke != null) {
|
||||
return new Rect(sLeft.getInt(invoke), sTop.getInt(invoke), sRight.getInt(invoke), sBottom.getInt(invoke));
|
||||
}
|
||||
} catch (IllegalAccessException | InvocationTargetException unused) {
|
||||
}
|
||||
}
|
||||
return DrawableUtils.INSETS_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
static class Api29Impl {
|
||||
private Api29Impl() {
|
||||
}
|
||||
|
||||
static Insets getOpticalInsets(Drawable drawable) {
|
||||
return drawable.getOpticalInsets();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,629 @@
|
||||
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.AdapterView;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.ListView;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.graphics.drawable.DrawableWrapperCompat;
|
||||
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.os.BuildCompat;
|
||||
import androidx.core.view.ViewPropertyAnimatorCompat;
|
||||
import androidx.core.widget.ListViewAutoScrollHelper;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class DropDownListView extends ListView {
|
||||
public static final int INVALID_POSITION = -1;
|
||||
public static final int NO_POSITION = -1;
|
||||
private ViewPropertyAnimatorCompat mClickAnimation;
|
||||
private boolean mDrawsInPressedState;
|
||||
private boolean mHijackFocus;
|
||||
private boolean mListSelectionHidden;
|
||||
private int mMotionPosition;
|
||||
ResolveHoverRunnable mResolveHoverRunnable;
|
||||
private ListViewAutoScrollHelper mScrollHelper;
|
||||
private int mSelectionBottomPadding;
|
||||
private int mSelectionLeftPadding;
|
||||
private int mSelectionRightPadding;
|
||||
private int mSelectionTopPadding;
|
||||
private GateKeeperDrawable mSelector;
|
||||
private final Rect mSelectorRect;
|
||||
|
||||
private boolean touchModeDrawsInPressedStateCompat() {
|
||||
return this.mDrawsInPressedState;
|
||||
}
|
||||
|
||||
void setListSelectionHidden(boolean z) {
|
||||
this.mListSelectionHidden = z;
|
||||
}
|
||||
|
||||
DropDownListView(Context context, boolean z) {
|
||||
super(context, null, R.attr.dropDownListViewStyle);
|
||||
this.mSelectorRect = new Rect();
|
||||
this.mSelectionLeftPadding = 0;
|
||||
this.mSelectionTopPadding = 0;
|
||||
this.mSelectionRightPadding = 0;
|
||||
this.mSelectionBottomPadding = 0;
|
||||
this.mHijackFocus = z;
|
||||
setCacheColorHint(0);
|
||||
}
|
||||
|
||||
private boolean superIsSelectedChildViewEnabled() {
|
||||
if (BuildCompat.isAtLeastT()) {
|
||||
return Api33Impl.isSelectedChildViewEnabled(this);
|
||||
}
|
||||
return PreApi33Impl.isSelectedChildViewEnabled(this);
|
||||
}
|
||||
|
||||
private void superSetSelectedChildViewEnabled(boolean z) {
|
||||
if (BuildCompat.isAtLeastT()) {
|
||||
Api33Impl.setSelectedChildViewEnabled(this, z);
|
||||
} else {
|
||||
PreApi33Impl.setSelectedChildViewEnabled(this, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean isInTouchMode() {
|
||||
return (this.mHijackFocus && this.mListSelectionHidden) || super.isInTouchMode();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean hasWindowFocus() {
|
||||
return this.mHijackFocus || super.hasWindowFocus();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public boolean isFocused() {
|
||||
return this.mHijackFocus || super.isFocused();
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
public boolean hasFocus() {
|
||||
return this.mHijackFocus || super.hasFocus();
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsListView
|
||||
public void setSelector(Drawable drawable) {
|
||||
GateKeeperDrawable gateKeeperDrawable = drawable != null ? new GateKeeperDrawable(drawable) : null;
|
||||
this.mSelector = gateKeeperDrawable;
|
||||
super.setSelector(gateKeeperDrawable);
|
||||
Rect rect = new Rect();
|
||||
if (drawable != null) {
|
||||
drawable.getPadding(rect);
|
||||
}
|
||||
this.mSelectionLeftPadding = rect.left;
|
||||
this.mSelectionTopPadding = rect.top;
|
||||
this.mSelectionRightPadding = rect.right;
|
||||
this.mSelectionBottomPadding = rect.bottom;
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsListView, android.view.ViewGroup, android.view.View
|
||||
protected void drawableStateChanged() {
|
||||
if (this.mResolveHoverRunnable != null) {
|
||||
return;
|
||||
}
|
||||
super.drawableStateChanged();
|
||||
setSelectorEnabled(true);
|
||||
updateSelectorStateCompat();
|
||||
}
|
||||
|
||||
@Override // android.widget.ListView, android.widget.AbsListView, android.view.ViewGroup, android.view.View
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
drawSelectorCompat(canvas);
|
||||
super.dispatchDraw(canvas);
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsListView, android.view.View
|
||||
public boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
if (motionEvent.getAction() == 0) {
|
||||
this.mMotionPosition = pointToPosition((int) motionEvent.getX(), (int) motionEvent.getY());
|
||||
}
|
||||
ResolveHoverRunnable resolveHoverRunnable = this.mResolveHoverRunnable;
|
||||
if (resolveHoverRunnable != null) {
|
||||
resolveHoverRunnable.cancel();
|
||||
}
|
||||
return super.onTouchEvent(motionEvent);
|
||||
}
|
||||
|
||||
public int lookForSelectablePosition(int i, boolean z) {
|
||||
int min;
|
||||
ListAdapter adapter = getAdapter();
|
||||
if (adapter != null && !isInTouchMode()) {
|
||||
int count = adapter.getCount();
|
||||
if (!getAdapter().areAllItemsEnabled()) {
|
||||
if (z) {
|
||||
min = Math.max(0, i);
|
||||
while (min < count && !adapter.isEnabled(min)) {
|
||||
min++;
|
||||
}
|
||||
} else {
|
||||
min = Math.min(i, count - 1);
|
||||
while (min >= 0 && !adapter.isEnabled(min)) {
|
||||
min--;
|
||||
}
|
||||
}
|
||||
if (min < 0 || min >= count) {
|
||||
return -1;
|
||||
}
|
||||
return min;
|
||||
}
|
||||
if (i >= 0 && i < count) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int measureHeightOfChildrenCompat(int i, int i2, int i3, int i4, int i5) {
|
||||
int makeMeasureSpec;
|
||||
int listPaddingTop = getListPaddingTop();
|
||||
int listPaddingBottom = getListPaddingBottom();
|
||||
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();
|
||||
View view = null;
|
||||
int i7 = 0;
|
||||
int i8 = 0;
|
||||
int i9 = 0;
|
||||
while (i7 < count) {
|
||||
int itemViewType = adapter.getItemViewType(i7);
|
||||
if (itemViewType != i8) {
|
||||
view = null;
|
||||
i8 = itemViewType;
|
||||
}
|
||||
view = adapter.getView(i7, view, this);
|
||||
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
|
||||
if (layoutParams == null) {
|
||||
layoutParams = generateDefaultLayoutParams();
|
||||
view.setLayoutParams(layoutParams);
|
||||
}
|
||||
if (layoutParams.height > 0) {
|
||||
makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(layoutParams.height, BasicMeasure.EXACTLY);
|
||||
} else {
|
||||
makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
|
||||
}
|
||||
view.measure(i, makeMeasureSpec);
|
||||
view.forceLayout();
|
||||
if (i7 > 0) {
|
||||
i6 += dividerHeight;
|
||||
}
|
||||
i6 += view.getMeasuredHeight();
|
||||
if (i6 >= i4) {
|
||||
return (i5 < 0 || i7 <= i5 || i9 <= 0 || i6 == i4) ? i4 : i9;
|
||||
}
|
||||
if (i5 >= 0 && i7 >= i5) {
|
||||
i9 = i6;
|
||||
}
|
||||
i7++;
|
||||
}
|
||||
return i6;
|
||||
}
|
||||
|
||||
private void setSelectorEnabled(boolean z) {
|
||||
GateKeeperDrawable gateKeeperDrawable = this.mSelector;
|
||||
if (gateKeeperDrawable != null) {
|
||||
gateKeeperDrawable.setEnabled(z);
|
||||
}
|
||||
}
|
||||
|
||||
private static class GateKeeperDrawable extends DrawableWrapperCompat {
|
||||
private boolean mEnabled;
|
||||
|
||||
void setEnabled(boolean z) {
|
||||
this.mEnabled = z;
|
||||
}
|
||||
|
||||
GateKeeperDrawable(Drawable drawable) {
|
||||
super(drawable);
|
||||
this.mEnabled = true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableWrapperCompat, android.graphics.drawable.Drawable
|
||||
public boolean setState(int[] iArr) {
|
||||
if (this.mEnabled) {
|
||||
return super.setState(iArr);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableWrapperCompat, android.graphics.drawable.Drawable
|
||||
public void draw(Canvas canvas) {
|
||||
if (this.mEnabled) {
|
||||
super.draw(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableWrapperCompat, android.graphics.drawable.Drawable
|
||||
public void setHotspot(float f, float f2) {
|
||||
if (this.mEnabled) {
|
||||
super.setHotspot(f, f2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableWrapperCompat, android.graphics.drawable.Drawable
|
||||
public void setHotspotBounds(int i, int i2, int i3, int i4) {
|
||||
if (this.mEnabled) {
|
||||
super.setHotspotBounds(i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.graphics.drawable.DrawableWrapperCompat, android.graphics.drawable.Drawable
|
||||
public boolean setVisible(boolean z, boolean z2) {
|
||||
if (this.mEnabled) {
|
||||
return super.setVisible(z, z2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@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.mResolveHoverRunnable == null) {
|
||||
ResolveHoverRunnable resolveHoverRunnable = new ResolveHoverRunnable();
|
||||
this.mResolveHoverRunnable = resolveHoverRunnable;
|
||||
resolveHoverRunnable.post();
|
||||
}
|
||||
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()) {
|
||||
requestFocus();
|
||||
if (Build.VERSION.SDK_INT >= 30 && Api30Impl.canPositionSelectorForHoveredItem()) {
|
||||
Api30Impl.positionSelectorForHoveredItem(this, pointToPosition, childAt);
|
||||
} else {
|
||||
setSelectionFromTop(pointToPosition, childAt.getTop() - getTop());
|
||||
}
|
||||
}
|
||||
updateSelectorStateCompat();
|
||||
}
|
||||
} else {
|
||||
setSelection(-1);
|
||||
}
|
||||
return onHoverEvent;
|
||||
}
|
||||
|
||||
@Override // android.widget.ListView, android.widget.AbsListView, android.widget.AdapterView, android.view.ViewGroup, android.view.View
|
||||
protected void onDetachedFromWindow() {
|
||||
this.mResolveHoverRunnable = null;
|
||||
super.onDetachedFromWindow();
|
||||
}
|
||||
|
||||
/* 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 add '--show-bad-code' argument
|
||||
*/
|
||||
public boolean onForwardedEvent(android.view.MotionEvent r8, int r9) {
|
||||
/*
|
||||
r7 = this;
|
||||
int r0 = r8.getActionMasked()
|
||||
r1 = 1
|
||||
r2 = 0
|
||||
if (r0 == r1) 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.setPressedItem(r3, r5, r4, r9)
|
||||
if (r0 != r1) goto Le
|
||||
r7.clickPressedItem(r3, r5)
|
||||
goto Le
|
||||
L46:
|
||||
if (r3 == 0) goto L4a
|
||||
if (r9 == 0) goto L4d
|
||||
L4a:
|
||||
r7.clearPressedItem()
|
||||
L4d:
|
||||
if (r3 == 0) goto L65
|
||||
androidx.core.widget.ListViewAutoScrollHelper r9 = r7.mScrollHelper
|
||||
if (r9 != 0) goto L5a
|
||||
androidx.core.widget.ListViewAutoScrollHelper r9 = new androidx.core.widget.ListViewAutoScrollHelper
|
||||
r9.<init>(r7)
|
||||
r7.mScrollHelper = r9
|
||||
L5a:
|
||||
androidx.core.widget.ListViewAutoScrollHelper r9 = r7.mScrollHelper
|
||||
r9.setEnabled(r1)
|
||||
androidx.core.widget.ListViewAutoScrollHelper r9 = r7.mScrollHelper
|
||||
r9.onTouch(r7, r8)
|
||||
goto L6c
|
||||
L65:
|
||||
androidx.core.widget.ListViewAutoScrollHelper r8 = r7.mScrollHelper
|
||||
if (r8 == 0) goto L6c
|
||||
r8.setEnabled(r2)
|
||||
L6c:
|
||||
return r3
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.DropDownListView.onForwardedEvent(android.view.MotionEvent, int):boolean");
|
||||
}
|
||||
|
||||
private void clickPressedItem(View view, int i) {
|
||||
performItemClick(view, i, getItemIdAtPosition(i));
|
||||
}
|
||||
|
||||
private void updateSelectorStateCompat() {
|
||||
Drawable selector = getSelector();
|
||||
if (selector != null && touchModeDrawsInPressedStateCompat() && isPressed()) {
|
||||
selector.setState(getDrawableState());
|
||||
}
|
||||
}
|
||||
|
||||
private void drawSelectorCompat(Canvas canvas) {
|
||||
Drawable selector;
|
||||
if (this.mSelectorRect.isEmpty() || (selector = getSelector()) == null) {
|
||||
return;
|
||||
}
|
||||
selector.setBounds(this.mSelectorRect);
|
||||
selector.draw(canvas);
|
||||
}
|
||||
|
||||
private void positionSelectorLikeTouchCompat(int i, View view, float f, float f2) {
|
||||
positionSelectorLikeFocusCompat(i, view);
|
||||
Drawable selector = getSelector();
|
||||
if (selector == null || i == -1) {
|
||||
return;
|
||||
}
|
||||
DrawableCompat.setHotspot(selector, f, f2);
|
||||
}
|
||||
|
||||
private void positionSelectorLikeFocusCompat(int i, View view) {
|
||||
Drawable selector = getSelector();
|
||||
boolean z = (selector == null || i == -1) ? false : true;
|
||||
if (z) {
|
||||
selector.setVisible(false, false);
|
||||
}
|
||||
positionSelectorCompat(i, view);
|
||||
if (z) {
|
||||
Rect rect = this.mSelectorRect;
|
||||
float exactCenterX = rect.exactCenterX();
|
||||
float exactCenterY = rect.exactCenterY();
|
||||
selector.setVisible(getVisibility() == 0, false);
|
||||
DrawableCompat.setHotspot(selector, exactCenterX, exactCenterY);
|
||||
}
|
||||
}
|
||||
|
||||
private void positionSelectorCompat(int i, View view) {
|
||||
Rect rect = this.mSelectorRect;
|
||||
rect.set(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
|
||||
rect.left -= this.mSelectionLeftPadding;
|
||||
rect.top -= this.mSelectionTopPadding;
|
||||
rect.right += this.mSelectionRightPadding;
|
||||
rect.bottom += this.mSelectionBottomPadding;
|
||||
boolean superIsSelectedChildViewEnabled = superIsSelectedChildViewEnabled();
|
||||
if (view.isEnabled() != superIsSelectedChildViewEnabled) {
|
||||
superSetSelectedChildViewEnabled(!superIsSelectedChildViewEnabled);
|
||||
if (i != -1) {
|
||||
refreshDrawableState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clearPressedItem() {
|
||||
this.mDrawsInPressedState = false;
|
||||
setPressed(false);
|
||||
drawableStateChanged();
|
||||
View childAt = getChildAt(this.mMotionPosition - getFirstVisiblePosition());
|
||||
if (childAt != null) {
|
||||
childAt.setPressed(false);
|
||||
}
|
||||
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = this.mClickAnimation;
|
||||
if (viewPropertyAnimatorCompat != null) {
|
||||
viewPropertyAnimatorCompat.cancel();
|
||||
this.mClickAnimation = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void setPressedItem(View view, int i, float f, float f2) {
|
||||
View childAt;
|
||||
this.mDrawsInPressedState = true;
|
||||
Api21Impl.drawableHotspotChanged(this, f, f2);
|
||||
if (!isPressed()) {
|
||||
setPressed(true);
|
||||
}
|
||||
layoutChildren();
|
||||
int i2 = this.mMotionPosition;
|
||||
if (i2 != -1 && (childAt = getChildAt(i2 - getFirstVisiblePosition())) != null && childAt != view && childAt.isPressed()) {
|
||||
childAt.setPressed(false);
|
||||
}
|
||||
this.mMotionPosition = i;
|
||||
Api21Impl.drawableHotspotChanged(view, f - view.getLeft(), f2 - view.getTop());
|
||||
if (!view.isPressed()) {
|
||||
view.setPressed(true);
|
||||
}
|
||||
positionSelectorLikeTouchCompat(i, view, f, f2);
|
||||
setSelectorEnabled(false);
|
||||
refreshDrawableState();
|
||||
}
|
||||
|
||||
private class ResolveHoverRunnable implements Runnable {
|
||||
ResolveHoverRunnable() {
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
DropDownListView.this.mResolveHoverRunnable = null;
|
||||
DropDownListView.this.drawableStateChanged();
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
DropDownListView.this.mResolveHoverRunnable = null;
|
||||
DropDownListView.this.removeCallbacks(this);
|
||||
}
|
||||
|
||||
public void post() {
|
||||
DropDownListView.this.post(this);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api30Impl {
|
||||
private static boolean sHasMethods;
|
||||
private static Method sPositionSelector;
|
||||
private static Method sSetNextSelectedPositionInt;
|
||||
private static Method sSetSelectedPositionInt;
|
||||
|
||||
static boolean canPositionSelectorForHoveredItem() {
|
||||
return sHasMethods;
|
||||
}
|
||||
|
||||
static {
|
||||
try {
|
||||
Method declaredMethod = AbsListView.class.getDeclaredMethod("positionSelector", Integer.TYPE, View.class, Boolean.TYPE, Float.TYPE, Float.TYPE);
|
||||
sPositionSelector = declaredMethod;
|
||||
declaredMethod.setAccessible(true);
|
||||
Method declaredMethod2 = AdapterView.class.getDeclaredMethod("setSelectedPositionInt", Integer.TYPE);
|
||||
sSetSelectedPositionInt = declaredMethod2;
|
||||
declaredMethod2.setAccessible(true);
|
||||
Method declaredMethod3 = AdapterView.class.getDeclaredMethod("setNextSelectedPositionInt", Integer.TYPE);
|
||||
sSetNextSelectedPositionInt = declaredMethod3;
|
||||
declaredMethod3.setAccessible(true);
|
||||
sHasMethods = true;
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private Api30Impl() {
|
||||
}
|
||||
|
||||
static void positionSelectorForHoveredItem(DropDownListView dropDownListView, int i, View view) {
|
||||
try {
|
||||
sPositionSelector.invoke(dropDownListView, Integer.valueOf(i), view, false, -1, -1);
|
||||
sSetSelectedPositionInt.invoke(dropDownListView, Integer.valueOf(i));
|
||||
sSetNextSelectedPositionInt.invoke(dropDownListView, Integer.valueOf(i));
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class Api21Impl {
|
||||
private Api21Impl() {
|
||||
}
|
||||
|
||||
static void drawableHotspotChanged(View view, float f, float f2) {
|
||||
view.drawableHotspotChanged(f, f2);
|
||||
}
|
||||
}
|
||||
|
||||
static class PreApi33Impl {
|
||||
private static final Field sIsChildViewEnabled;
|
||||
|
||||
static {
|
||||
Field field = null;
|
||||
try {
|
||||
field = AbsListView.class.getDeclaredField("mIsChildViewEnabled");
|
||||
field.setAccessible(true);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
sIsChildViewEnabled = field;
|
||||
}
|
||||
|
||||
private PreApi33Impl() {
|
||||
}
|
||||
|
||||
static boolean isSelectedChildViewEnabled(AbsListView absListView) {
|
||||
Field field = sIsChildViewEnabled;
|
||||
if (field == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return field.getBoolean(absListView);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void setSelectedChildViewEnabled(AbsListView absListView, boolean z) {
|
||||
Field field = sIsChildViewEnabled;
|
||||
if (field != null) {
|
||||
try {
|
||||
field.set(absListView, Boolean.valueOf(z));
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class Api33Impl {
|
||||
private Api33Impl() {
|
||||
}
|
||||
|
||||
static boolean isSelectedChildViewEnabled(AbsListView absListView) {
|
||||
return absListView.isSelectedChildViewEnabled();
|
||||
}
|
||||
|
||||
static void setSelectedChildViewEnabled(AbsListView absListView, boolean z) {
|
||||
absListView.setSelectedChildViewEnabled(z);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface EmojiCompatConfigurationView {
|
||||
boolean isEmojiCompatEnabled();
|
||||
|
||||
void setEmojiCompatEnabled(boolean z);
|
||||
}
|
||||
@@ -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 mListener;
|
||||
|
||||
@Override // androidx.appcompat.widget.FitWindowsViewGroup
|
||||
public void setOnFitSystemWindowsListener(FitWindowsViewGroup.OnFitSystemWindowsListener onFitSystemWindowsListener) {
|
||||
this.mListener = onFitSystemWindowsListener;
|
||||
}
|
||||
|
||||
public FitWindowsFrameLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public FitWindowsFrameLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected boolean fitSystemWindows(Rect rect) {
|
||||
FitWindowsViewGroup.OnFitSystemWindowsListener onFitSystemWindowsListener = this.mListener;
|
||||
if (onFitSystemWindowsListener != null) {
|
||||
onFitSystemWindowsListener.onFitSystemWindows(rect);
|
||||
}
|
||||
return super.fitSystemWindows(rect);
|
||||
}
|
||||
}
|
||||
@@ -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 mListener;
|
||||
|
||||
@Override // androidx.appcompat.widget.FitWindowsViewGroup
|
||||
public void setOnFitSystemWindowsListener(FitWindowsViewGroup.OnFitSystemWindowsListener onFitSystemWindowsListener) {
|
||||
this.mListener = onFitSystemWindowsListener;
|
||||
}
|
||||
|
||||
public FitWindowsLinearLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public FitWindowsLinearLayout(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected boolean fitSystemWindows(Rect rect) {
|
||||
FitWindowsViewGroup.OnFitSystemWindowsListener onFitSystemWindowsListener = this.mListener;
|
||||
if (onFitSystemWindowsListener != null) {
|
||||
onFitSystemWindowsListener.onFitSystemWindows(rect);
|
||||
}
|
||||
return super.fitSystemWindows(rect);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.graphics.Rect;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface FitWindowsViewGroup {
|
||||
|
||||
public interface OnFitSystemWindowsListener {
|
||||
void onFitSystemWindows(Rect rect);
|
||||
}
|
||||
|
||||
void setOnFitSystemWindowsListener(OnFitSystemWindowsListener onFitSystemWindowsListener);
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
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 int mActivePointerId;
|
||||
private Runnable mDisallowIntercept;
|
||||
private boolean mForwarding;
|
||||
private final int mLongPressTimeout;
|
||||
private final float mScaledTouchSlop;
|
||||
final View mSrc;
|
||||
private final int mTapTimeout;
|
||||
private final int[] mTmpLocation = new int[2];
|
||||
private Runnable mTriggerLongPress;
|
||||
|
||||
public abstract ShowableListMenu getPopup();
|
||||
|
||||
@Override // android.view.View.OnAttachStateChangeListener
|
||||
public void onViewAttachedToWindow(View view) {
|
||||
}
|
||||
|
||||
public ForwardingListener(View view) {
|
||||
this.mSrc = view;
|
||||
view.setLongClickable(true);
|
||||
view.addOnAttachStateChangeListener(this);
|
||||
this.mScaledTouchSlop = ViewConfiguration.get(view.getContext()).getScaledTouchSlop();
|
||||
int tapTimeout = ViewConfiguration.getTapTimeout();
|
||||
this.mTapTimeout = tapTimeout;
|
||||
this.mLongPressTimeout = (tapTimeout + ViewConfiguration.getLongPressTimeout()) / 2;
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnTouchListener
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
boolean z;
|
||||
boolean z2 = this.mForwarding;
|
||||
if (z2) {
|
||||
z = onTouchForwarded(motionEvent) || !onForwardingStopped();
|
||||
} else {
|
||||
z = onTouchObserved(motionEvent) && onForwardingStarted();
|
||||
if (z) {
|
||||
long uptimeMillis = SystemClock.uptimeMillis();
|
||||
MotionEvent obtain = MotionEvent.obtain(uptimeMillis, uptimeMillis, 3, 0.0f, 0.0f, 0);
|
||||
this.mSrc.onTouchEvent(obtain);
|
||||
obtain.recycle();
|
||||
}
|
||||
}
|
||||
this.mForwarding = z;
|
||||
return z || z2;
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnAttachStateChangeListener
|
||||
public void onViewDetachedFromWindow(View view) {
|
||||
this.mForwarding = false;
|
||||
this.mActivePointerId = -1;
|
||||
Runnable runnable = this.mDisallowIntercept;
|
||||
if (runnable != null) {
|
||||
this.mSrc.removeCallbacks(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean onForwardingStarted() {
|
||||
ShowableListMenu popup = getPopup();
|
||||
if (popup == null || popup.isShowing()) {
|
||||
return true;
|
||||
}
|
||||
popup.show();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean onForwardingStopped() {
|
||||
ShowableListMenu popup = getPopup();
|
||||
if (popup == null || !popup.isShowing()) {
|
||||
return true;
|
||||
}
|
||||
popup.dismiss();
|
||||
return true;
|
||||
}
|
||||
|
||||
/* 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 add '--show-bad-code' argument
|
||||
*/
|
||||
private boolean onTouchObserved(android.view.MotionEvent r6) {
|
||||
/*
|
||||
r5 = this;
|
||||
android.view.View r0 = r5.mSrc
|
||||
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.mActivePointerId
|
||||
int r1 = r6.findPointerIndex(r1)
|
||||
if (r1 < 0) goto L6d
|
||||
float r4 = r6.getX(r1)
|
||||
float r6 = r6.getY(r1)
|
||||
float r1 = r5.mScaledTouchSlop
|
||||
boolean r6 = pointInView(r0, r4, r6, r1)
|
||||
if (r6 != 0) goto L6d
|
||||
r5.clearCallbacks()
|
||||
android.view.ViewParent r6 = r0.getParent()
|
||||
r6.requestDisallowInterceptTouchEvent(r3)
|
||||
return r3
|
||||
L3d:
|
||||
r5.clearCallbacks()
|
||||
goto L6d
|
||||
L41:
|
||||
int r6 = r6.getPointerId(r2)
|
||||
r5.mActivePointerId = r6
|
||||
java.lang.Runnable r6 = r5.mDisallowIntercept
|
||||
if (r6 != 0) goto L52
|
||||
androidx.appcompat.widget.ForwardingListener$DisallowIntercept r6 = new androidx.appcompat.widget.ForwardingListener$DisallowIntercept
|
||||
r6.<init>()
|
||||
r5.mDisallowIntercept = r6
|
||||
L52:
|
||||
java.lang.Runnable r6 = r5.mDisallowIntercept
|
||||
int r1 = r5.mTapTimeout
|
||||
long r3 = (long) r1
|
||||
r0.postDelayed(r6, r3)
|
||||
java.lang.Runnable r6 = r5.mTriggerLongPress
|
||||
if (r6 != 0) goto L65
|
||||
androidx.appcompat.widget.ForwardingListener$TriggerLongPress r6 = new androidx.appcompat.widget.ForwardingListener$TriggerLongPress
|
||||
r6.<init>()
|
||||
r5.mTriggerLongPress = r6
|
||||
L65:
|
||||
java.lang.Runnable r6 = r5.mTriggerLongPress
|
||||
int r1 = r5.mLongPressTimeout
|
||||
long r3 = (long) r1
|
||||
r0.postDelayed(r6, r3)
|
||||
L6d:
|
||||
return r2
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ForwardingListener.onTouchObserved(android.view.MotionEvent):boolean");
|
||||
}
|
||||
|
||||
private void clearCallbacks() {
|
||||
Runnable runnable = this.mTriggerLongPress;
|
||||
if (runnable != null) {
|
||||
this.mSrc.removeCallbacks(runnable);
|
||||
}
|
||||
Runnable runnable2 = this.mDisallowIntercept;
|
||||
if (runnable2 != null) {
|
||||
this.mSrc.removeCallbacks(runnable2);
|
||||
}
|
||||
}
|
||||
|
||||
void onLongPress() {
|
||||
clearCallbacks();
|
||||
View view = this.mSrc;
|
||||
if (view.isEnabled() && !view.isLongClickable() && onForwardingStarted()) {
|
||||
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.mForwarding = true;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean onTouchForwarded(MotionEvent motionEvent) {
|
||||
DropDownListView dropDownListView;
|
||||
View view = this.mSrc;
|
||||
ShowableListMenu popup = getPopup();
|
||||
if (popup == null || !popup.isShowing() || (dropDownListView = (DropDownListView) popup.getListView()) == null || !dropDownListView.isShown()) {
|
||||
return false;
|
||||
}
|
||||
MotionEvent obtainNoHistory = MotionEvent.obtainNoHistory(motionEvent);
|
||||
toGlobalMotionEvent(view, obtainNoHistory);
|
||||
toLocalMotionEvent(dropDownListView, obtainNoHistory);
|
||||
boolean onForwardedEvent = dropDownListView.onForwardedEvent(obtainNoHistory, this.mActivePointerId);
|
||||
obtainNoHistory.recycle();
|
||||
int actionMasked = motionEvent.getActionMasked();
|
||||
return onForwardedEvent && (actionMasked != 1 && actionMasked != 3);
|
||||
}
|
||||
|
||||
private static boolean pointInView(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 toLocalMotionEvent(View view, MotionEvent motionEvent) {
|
||||
view.getLocationOnScreen(this.mTmpLocation);
|
||||
motionEvent.offsetLocation(-r0[0], -r0[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean toGlobalMotionEvent(View view, MotionEvent motionEvent) {
|
||||
view.getLocationOnScreen(this.mTmpLocation);
|
||||
motionEvent.offsetLocation(r0[0], r0[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
private class DisallowIntercept implements Runnable {
|
||||
DisallowIntercept() {
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ViewParent parent = ForwardingListener.this.mSrc.getParent();
|
||||
if (parent != null) {
|
||||
parent.requestDisallowInterceptTouchEvent(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class TriggerLongPress implements Runnable {
|
||||
TriggerLongPress() {
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ForwardingListener.this.onLongPress();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,670 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
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 android.widget.LinearLayout;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class LinearLayoutCompat extends ViewGroup {
|
||||
private static final String ACCESSIBILITY_CLASS_NAME = "androidx.appcompat.widget.LinearLayoutCompat";
|
||||
public static final int HORIZONTAL = 0;
|
||||
private static final int INDEX_BOTTOM = 2;
|
||||
private static final int INDEX_CENTER_VERTICAL = 0;
|
||||
private static final int INDEX_FILL = 3;
|
||||
private static final int INDEX_TOP = 1;
|
||||
public static final int SHOW_DIVIDER_BEGINNING = 1;
|
||||
public static final int SHOW_DIVIDER_END = 4;
|
||||
public static final int SHOW_DIVIDER_MIDDLE = 2;
|
||||
public static final int SHOW_DIVIDER_NONE = 0;
|
||||
public static final int VERTICAL = 1;
|
||||
private static final int VERTICAL_GRAVITY_COUNT = 4;
|
||||
private boolean mBaselineAligned;
|
||||
private int mBaselineAlignedChildIndex;
|
||||
private int mBaselineChildTop;
|
||||
private Drawable mDivider;
|
||||
private int mDividerHeight;
|
||||
private int mDividerPadding;
|
||||
private int mDividerWidth;
|
||||
private int mGravity;
|
||||
private int[] mMaxAscent;
|
||||
private int[] mMaxDescent;
|
||||
private int mOrientation;
|
||||
private int mShowDividers;
|
||||
private int mTotalLength;
|
||||
private boolean mUseLargestChild;
|
||||
private float mWeightSum;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface DividerMode {
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface OrientationMode {
|
||||
}
|
||||
|
||||
public int getBaselineAlignedChildIndex() {
|
||||
return this.mBaselineAlignedChildIndex;
|
||||
}
|
||||
|
||||
int getChildrenSkipCount(View view, int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Drawable getDividerDrawable() {
|
||||
return this.mDivider;
|
||||
}
|
||||
|
||||
public int getDividerPadding() {
|
||||
return this.mDividerPadding;
|
||||
}
|
||||
|
||||
public int getDividerWidth() {
|
||||
return this.mDividerWidth;
|
||||
}
|
||||
|
||||
public int getGravity() {
|
||||
return this.mGravity;
|
||||
}
|
||||
|
||||
int getLocationOffset(View view) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getNextLocationOffset(View view) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getOrientation() {
|
||||
return this.mOrientation;
|
||||
}
|
||||
|
||||
public int getShowDividers() {
|
||||
return this.mShowDividers;
|
||||
}
|
||||
|
||||
public float getWeightSum() {
|
||||
return this.mWeightSum;
|
||||
}
|
||||
|
||||
public boolean isBaselineAligned() {
|
||||
return this.mBaselineAligned;
|
||||
}
|
||||
|
||||
public boolean isMeasureWithLargestChildEnabled() {
|
||||
return this.mUseLargestChild;
|
||||
}
|
||||
|
||||
int measureNullChild(int i) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setBaselineAligned(boolean z) {
|
||||
this.mBaselineAligned = z;
|
||||
}
|
||||
|
||||
public void setDividerPadding(int i) {
|
||||
this.mDividerPadding = i;
|
||||
}
|
||||
|
||||
public void setMeasureWithLargestChildEnabled(boolean z) {
|
||||
this.mUseLargestChild = z;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
public boolean shouldDelayChildPressedState() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public LinearLayoutCompat(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public LinearLayoutCompat(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public LinearLayoutCompat(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.mBaselineAligned = true;
|
||||
this.mBaselineAlignedChildIndex = -1;
|
||||
this.mBaselineChildTop = 0;
|
||||
this.mGravity = 8388659;
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, attributeSet, R.styleable.LinearLayoutCompat, i, 0);
|
||||
ViewCompat.saveAttributeDataForStyleable(this, context, R.styleable.LinearLayoutCompat, attributeSet, obtainStyledAttributes.getWrappedTypeArray(), i, 0);
|
||||
int i2 = obtainStyledAttributes.getInt(R.styleable.LinearLayoutCompat_android_orientation, -1);
|
||||
if (i2 >= 0) {
|
||||
setOrientation(i2);
|
||||
}
|
||||
int i3 = obtainStyledAttributes.getInt(R.styleable.LinearLayoutCompat_android_gravity, -1);
|
||||
if (i3 >= 0) {
|
||||
setGravity(i3);
|
||||
}
|
||||
boolean z = obtainStyledAttributes.getBoolean(R.styleable.LinearLayoutCompat_android_baselineAligned, true);
|
||||
if (!z) {
|
||||
setBaselineAligned(z);
|
||||
}
|
||||
this.mWeightSum = obtainStyledAttributes.getFloat(R.styleable.LinearLayoutCompat_android_weightSum, -1.0f);
|
||||
this.mBaselineAlignedChildIndex = obtainStyledAttributes.getInt(R.styleable.LinearLayoutCompat_android_baselineAlignedChildIndex, -1);
|
||||
this.mUseLargestChild = obtainStyledAttributes.getBoolean(R.styleable.LinearLayoutCompat_measureWithLargestChild, false);
|
||||
setDividerDrawable(obtainStyledAttributes.getDrawable(R.styleable.LinearLayoutCompat_divider));
|
||||
this.mShowDividers = obtainStyledAttributes.getInt(R.styleable.LinearLayoutCompat_showDividers, 0);
|
||||
this.mDividerPadding = obtainStyledAttributes.getDimensionPixelSize(R.styleable.LinearLayoutCompat_dividerPadding, 0);
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
|
||||
public void setShowDividers(int i) {
|
||||
if (i != this.mShowDividers) {
|
||||
requestLayout();
|
||||
}
|
||||
this.mShowDividers = i;
|
||||
}
|
||||
|
||||
public void setDividerDrawable(Drawable drawable) {
|
||||
if (drawable == this.mDivider) {
|
||||
return;
|
||||
}
|
||||
this.mDivider = drawable;
|
||||
if (drawable != null) {
|
||||
this.mDividerWidth = drawable.getIntrinsicWidth();
|
||||
this.mDividerHeight = drawable.getIntrinsicHeight();
|
||||
} else {
|
||||
this.mDividerWidth = 0;
|
||||
this.mDividerHeight = 0;
|
||||
}
|
||||
setWillNotDraw(drawable == null);
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onDraw(Canvas canvas) {
|
||||
if (this.mDivider == null) {
|
||||
return;
|
||||
}
|
||||
if (this.mOrientation == 1) {
|
||||
drawDividersVertical(canvas);
|
||||
} else {
|
||||
drawDividersHorizontal(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
void drawDividersVertical(Canvas canvas) {
|
||||
int bottom;
|
||||
int virtualChildCount = getVirtualChildCount();
|
||||
for (int i = 0; i < virtualChildCount; i++) {
|
||||
View virtualChildAt = getVirtualChildAt(i);
|
||||
if (virtualChildAt != null && virtualChildAt.getVisibility() != 8 && hasDividerBeforeChildAt(i)) {
|
||||
drawHorizontalDivider(canvas, (virtualChildAt.getTop() - ((LayoutParams) virtualChildAt.getLayoutParams()).topMargin) - this.mDividerHeight);
|
||||
}
|
||||
}
|
||||
if (hasDividerBeforeChildAt(virtualChildCount)) {
|
||||
View virtualChildAt2 = getVirtualChildAt(virtualChildCount - 1);
|
||||
if (virtualChildAt2 == null) {
|
||||
bottom = (getHeight() - getPaddingBottom()) - this.mDividerHeight;
|
||||
} else {
|
||||
bottom = virtualChildAt2.getBottom() + ((LayoutParams) virtualChildAt2.getLayoutParams()).bottomMargin;
|
||||
}
|
||||
drawHorizontalDivider(canvas, bottom);
|
||||
}
|
||||
}
|
||||
|
||||
void drawDividersHorizontal(Canvas canvas) {
|
||||
int right;
|
||||
int left;
|
||||
int i;
|
||||
int left2;
|
||||
int virtualChildCount = getVirtualChildCount();
|
||||
boolean isLayoutRtl = ViewUtils.isLayoutRtl(this);
|
||||
for (int i2 = 0; i2 < virtualChildCount; i2++) {
|
||||
View virtualChildAt = getVirtualChildAt(i2);
|
||||
if (virtualChildAt != null && virtualChildAt.getVisibility() != 8 && hasDividerBeforeChildAt(i2)) {
|
||||
LayoutParams layoutParams = (LayoutParams) virtualChildAt.getLayoutParams();
|
||||
if (isLayoutRtl) {
|
||||
left2 = virtualChildAt.getRight() + layoutParams.rightMargin;
|
||||
} else {
|
||||
left2 = (virtualChildAt.getLeft() - layoutParams.leftMargin) - this.mDividerWidth;
|
||||
}
|
||||
drawVerticalDivider(canvas, left2);
|
||||
}
|
||||
}
|
||||
if (hasDividerBeforeChildAt(virtualChildCount)) {
|
||||
View virtualChildAt2 = getVirtualChildAt(virtualChildCount - 1);
|
||||
if (virtualChildAt2 != null) {
|
||||
LayoutParams layoutParams2 = (LayoutParams) virtualChildAt2.getLayoutParams();
|
||||
if (isLayoutRtl) {
|
||||
left = virtualChildAt2.getLeft() - layoutParams2.leftMargin;
|
||||
i = this.mDividerWidth;
|
||||
right = left - i;
|
||||
} else {
|
||||
right = virtualChildAt2.getRight() + layoutParams2.rightMargin;
|
||||
}
|
||||
} else if (isLayoutRtl) {
|
||||
right = getPaddingLeft();
|
||||
} else {
|
||||
left = getWidth() - getPaddingRight();
|
||||
i = this.mDividerWidth;
|
||||
right = left - i;
|
||||
}
|
||||
drawVerticalDivider(canvas, right);
|
||||
}
|
||||
}
|
||||
|
||||
void drawHorizontalDivider(Canvas canvas, int i) {
|
||||
this.mDivider.setBounds(getPaddingLeft() + this.mDividerPadding, i, (getWidth() - getPaddingRight()) - this.mDividerPadding, this.mDividerHeight + i);
|
||||
this.mDivider.draw(canvas);
|
||||
}
|
||||
|
||||
void drawVerticalDivider(Canvas canvas, int i) {
|
||||
this.mDivider.setBounds(i, getPaddingTop() + this.mDividerPadding, this.mDividerWidth + i, (getHeight() - getPaddingBottom()) - this.mDividerPadding);
|
||||
this.mDivider.draw(canvas);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public int getBaseline() {
|
||||
int i;
|
||||
if (this.mBaselineAlignedChildIndex < 0) {
|
||||
return super.getBaseline();
|
||||
}
|
||||
int childCount = getChildCount();
|
||||
int i2 = this.mBaselineAlignedChildIndex;
|
||||
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.mBaselineAlignedChildIndex == 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.mBaselineChildTop;
|
||||
if (this.mOrientation == 1 && (i = this.mGravity & 112) != 48) {
|
||||
if (i == 16) {
|
||||
i3 += ((((getBottom() - getTop()) - getPaddingTop()) - getPaddingBottom()) - this.mTotalLength) / 2;
|
||||
} else if (i == 80) {
|
||||
i3 = ((getBottom() - getTop()) - getPaddingBottom()) - this.mTotalLength;
|
||||
}
|
||||
}
|
||||
return i3 + ((LayoutParams) childAt.getLayoutParams()).topMargin + baseline;
|
||||
}
|
||||
|
||||
public void setBaselineAlignedChildIndex(int i) {
|
||||
if (i >= 0 && i < getChildCount()) {
|
||||
this.mBaselineAlignedChildIndex = i;
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException("base aligned child index out of range (0, " + getChildCount() + ")");
|
||||
}
|
||||
|
||||
View getVirtualChildAt(int i) {
|
||||
return getChildAt(i);
|
||||
}
|
||||
|
||||
int getVirtualChildCount() {
|
||||
return getChildCount();
|
||||
}
|
||||
|
||||
public void setWeightSum(float f) {
|
||||
this.mWeightSum = Math.max(0.0f, f);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
if (this.mOrientation == 1) {
|
||||
measureVertical(i, i2);
|
||||
} else {
|
||||
measureHorizontal(i, i2);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean hasDividerBeforeChildAt(int i) {
|
||||
if (i == 0) {
|
||||
return (this.mShowDividers & 1) != 0;
|
||||
}
|
||||
if (i == getChildCount()) {
|
||||
return (this.mShowDividers & 4) != 0;
|
||||
}
|
||||
if ((this.mShowDividers & 2) == 0) {
|
||||
return false;
|
||||
}
|
||||
for (int i2 = i - 1; i2 >= 0; i2--) {
|
||||
if (getChildAt(i2).getVisibility() != 8) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:155:0x031c, code lost:
|
||||
|
||||
if (r14.width == (-1)) goto L148;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
void measureVertical(int r34, int r35) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 910
|
||||
To view this dump add '--comments-level debug' option
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.LinearLayoutCompat.measureVertical(int, int):void");
|
||||
}
|
||||
|
||||
private void forceUniformWidth(int i, int i2) {
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), BasicMeasure.EXACTLY);
|
||||
for (int i3 = 0; i3 < i; i3++) {
|
||||
View virtualChildAt = getVirtualChildAt(i3);
|
||||
if (virtualChildAt.getVisibility() != 8) {
|
||||
LayoutParams layoutParams = (LayoutParams) virtualChildAt.getLayoutParams();
|
||||
if (layoutParams.width == -1) {
|
||||
int i4 = layoutParams.height;
|
||||
layoutParams.height = virtualChildAt.getMeasuredHeight();
|
||||
measureChildWithMargins(virtualChildAt, makeMeasureSpec, 0, i2, 0);
|
||||
layoutParams.height = i4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:196:0x0453 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:198:0x0456 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:44:0x0199 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:46:0x019c */
|
||||
/* JADX WARN: Removed duplicated region for block: B:54:0x01d0 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:59:0x01db */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
void measureHorizontal(int r38, int r39) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 1295
|
||||
To view this dump add '--comments-level debug' option
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.LinearLayoutCompat.measureHorizontal(int, int):void");
|
||||
}
|
||||
|
||||
private void forceUniformHeight(int i, int i2) {
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(getMeasuredHeight(), BasicMeasure.EXACTLY);
|
||||
for (int i3 = 0; i3 < i; i3++) {
|
||||
View virtualChildAt = getVirtualChildAt(i3);
|
||||
if (virtualChildAt.getVisibility() != 8) {
|
||||
LayoutParams layoutParams = (LayoutParams) virtualChildAt.getLayoutParams();
|
||||
if (layoutParams.height == -1) {
|
||||
int i4 = layoutParams.width;
|
||||
layoutParams.width = virtualChildAt.getMeasuredWidth();
|
||||
measureChildWithMargins(virtualChildAt, i2, 0, makeMeasureSpec, 0);
|
||||
layoutParams.width = i4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void measureChildBeforeLayout(View view, int i, int i2, int i3, int i4, int i5) {
|
||||
measureChildWithMargins(view, i2, i3, i4, i5);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
if (this.mOrientation == 1) {
|
||||
layoutVertical(i, i2, i3, i4);
|
||||
} else {
|
||||
layoutHorizontal(i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:25:0x009f */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
void layoutVertical(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.mGravity
|
||||
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.mTotalLength
|
||||
int r0 = r0 - r1
|
||||
goto L47
|
||||
L3b:
|
||||
int r0 = r17.getPaddingTop()
|
||||
int r1 = r21 - r19
|
||||
int r2 = r6.mTotalLength
|
||||
int r1 = r1 - r2
|
||||
int r1 = r1 / 2
|
||||
int r0 = r0 + r1
|
||||
L47:
|
||||
r1 = 0
|
||||
r12 = 0
|
||||
L49:
|
||||
if (r12 >= r10) goto Lc8
|
||||
android.view.View r13 = r6.getVirtualChildAt(r12)
|
||||
r14 = 1
|
||||
if (r13 != 0) goto L59
|
||||
int r1 = r6.measureNullChild(r12)
|
||||
int r0 = r0 + r1
|
||||
goto Lc5
|
||||
L59:
|
||||
int r1 = r13.getVisibility()
|
||||
r2 = 8
|
||||
if (r1 == r2) goto Lc5
|
||||
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.gravity
|
||||
if (r1 >= 0) goto L75
|
||||
r1 = r11
|
||||
L75:
|
||||
int r2 = androidx.core.view.ViewCompat.getLayoutDirection(r17)
|
||||
int r1 = androidx.core.view.GravityCompat.getAbsoluteGravity(r1, r2)
|
||||
r1 = r1 & 7
|
||||
if (r1 == r14) goto L8d
|
||||
r2 = 5
|
||||
if (r1 == r2) goto L88
|
||||
int r1 = r5.leftMargin
|
||||
int r1 = r1 + r7
|
||||
goto L98
|
||||
L88:
|
||||
int r1 = r8 - r4
|
||||
int r2 = r5.rightMargin
|
||||
goto L97
|
||||
L8d:
|
||||
int r1 = r9 - r4
|
||||
int r1 = r1 / 2
|
||||
int r1 = r1 + r7
|
||||
int r2 = r5.leftMargin
|
||||
int r1 = r1 + r2
|
||||
int r2 = r5.rightMargin
|
||||
L97:
|
||||
int r1 = r1 - r2
|
||||
L98:
|
||||
r2 = r1
|
||||
boolean r1 = r6.hasDividerBeforeChildAt(r12)
|
||||
if (r1 == 0) goto La2
|
||||
int r1 = r6.mDividerHeight
|
||||
int r0 = r0 + r1
|
||||
La2:
|
||||
int r1 = r5.topMargin
|
||||
int r16 = r0 + r1
|
||||
int r0 = r6.getLocationOffset(r13)
|
||||
int r3 = r16 + r0
|
||||
r0 = r17
|
||||
r1 = r13
|
||||
r14 = r5
|
||||
r5 = r15
|
||||
r0.setChildFrame(r1, r2, r3, r4, r5)
|
||||
int r0 = r14.bottomMargin
|
||||
int r15 = r15 + r0
|
||||
int r0 = r6.getNextLocationOffset(r13)
|
||||
int r15 = r15 + r0
|
||||
int r16 = r16 + r15
|
||||
int r0 = r6.getChildrenSkipCount(r13, r12)
|
||||
int r12 = r12 + r0
|
||||
r0 = r16
|
||||
Lc5:
|
||||
r1 = 1
|
||||
int r12 = r12 + r1
|
||||
goto L49
|
||||
Lc8:
|
||||
return
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.LinearLayoutCompat.layoutVertical(int, int, int, int):void");
|
||||
}
|
||||
|
||||
/* 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:0x00f7 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:46:0x00e3 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
void layoutHorizontal(int r25, int r26, int r27, int r28) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 321
|
||||
To view this dump add '--comments-level debug' option
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.LinearLayoutCompat.layoutHorizontal(int, int, int, int):void");
|
||||
}
|
||||
|
||||
private void setChildFrame(View view, int i, int i2, int i3, int i4) {
|
||||
view.layout(i, i2, i3 + i, i4 + i2);
|
||||
}
|
||||
|
||||
public void setOrientation(int i) {
|
||||
if (this.mOrientation != i) {
|
||||
this.mOrientation = i;
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void setGravity(int i) {
|
||||
if (this.mGravity != i) {
|
||||
if ((8388615 & i) == 0) {
|
||||
i |= GravityCompat.START;
|
||||
}
|
||||
if ((i & 112) == 0) {
|
||||
i |= 48;
|
||||
}
|
||||
this.mGravity = i;
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void setHorizontalGravity(int i) {
|
||||
int i2 = i & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK;
|
||||
int i3 = this.mGravity;
|
||||
if ((8388615 & i3) != i2) {
|
||||
this.mGravity = i2 | ((-8388616) & i3);
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void setVerticalGravity(int i) {
|
||||
int i2 = i & 112;
|
||||
int i3 = this.mGravity;
|
||||
if ((i3 & 112) != i2) {
|
||||
this.mGravity = i2 | (i3 & (-113));
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@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 generateDefaultLayoutParams() {
|
||||
int i = this.mOrientation;
|
||||
if (i == 0) {
|
||||
return new LayoutParams(-2, -2);
|
||||
}
|
||||
if (i == 1) {
|
||||
return new LayoutParams(-1, -2);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // android.view.ViewGroup
|
||||
public LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
return new LayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup
|
||||
protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
return layoutParams instanceof LayoutParams;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
|
||||
super.onInitializeAccessibilityEvent(accessibilityEvent);
|
||||
accessibilityEvent.setClassName(ACCESSIBILITY_CLASS_NAME);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
|
||||
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
|
||||
accessibilityNodeInfo.setClassName(ACCESSIBILITY_CLASS_NAME);
|
||||
}
|
||||
|
||||
public static class LayoutParams extends LinearLayout.LayoutParams {
|
||||
public LayoutParams(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
public LayoutParams(int i, int i2) {
|
||||
super(i, i2);
|
||||
}
|
||||
|
||||
public LayoutParams(int i, int i2, float f) {
|
||||
super(i, i2, f);
|
||||
}
|
||||
|
||||
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
|
||||
super(layoutParams);
|
||||
}
|
||||
|
||||
public LayoutParams(ViewGroup.MarginLayoutParams marginLayoutParams) {
|
||||
super(marginLayoutParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,854 @@
|
||||
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.Build;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
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;
|
||||
import androidx.appcompat.view.menu.ShowableListMenu;
|
||||
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
|
||||
import androidx.core.view.PointerIconCompat;
|
||||
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 final boolean DEBUG = false;
|
||||
static final int EXPAND_LIST_TIMEOUT = 250;
|
||||
public static final int INPUT_METHOD_FROM_FOCUSABLE = 0;
|
||||
public static final int INPUT_METHOD_NEEDED = 1;
|
||||
public static final int INPUT_METHOD_NOT_NEEDED = 2;
|
||||
public static final int MATCH_PARENT = -1;
|
||||
public static final int POSITION_PROMPT_ABOVE = 0;
|
||||
public static final int POSITION_PROMPT_BELOW = 1;
|
||||
private static final String TAG = "ListPopupWindow";
|
||||
public static final int WRAP_CONTENT = -2;
|
||||
private static Method sGetMaxAvailableHeightMethod;
|
||||
private static Method sSetClipToWindowEnabledMethod;
|
||||
private static Method sSetEpicenterBoundsMethod;
|
||||
private ListAdapter mAdapter;
|
||||
private Context mContext;
|
||||
private boolean mDropDownAlwaysVisible;
|
||||
private View mDropDownAnchorView;
|
||||
private int mDropDownGravity;
|
||||
private int mDropDownHeight;
|
||||
private int mDropDownHorizontalOffset;
|
||||
DropDownListView mDropDownList;
|
||||
private Drawable mDropDownListHighlight;
|
||||
private int mDropDownVerticalOffset;
|
||||
private boolean mDropDownVerticalOffsetSet;
|
||||
private int mDropDownWidth;
|
||||
private int mDropDownWindowLayoutType;
|
||||
private Rect mEpicenterBounds;
|
||||
private boolean mForceIgnoreOutsideTouch;
|
||||
final Handler mHandler;
|
||||
private final ListSelectorHider mHideSelector;
|
||||
private AdapterView.OnItemClickListener mItemClickListener;
|
||||
private AdapterView.OnItemSelectedListener mItemSelectedListener;
|
||||
int mListItemExpandMaximum;
|
||||
private boolean mModal;
|
||||
private DataSetObserver mObserver;
|
||||
private boolean mOverlapAnchor;
|
||||
private boolean mOverlapAnchorSet;
|
||||
PopupWindow mPopup;
|
||||
private int mPromptPosition;
|
||||
private View mPromptView;
|
||||
final ResizePopupRunnable mResizePopupRunnable;
|
||||
private final PopupScrollListener mScrollListener;
|
||||
private Runnable mShowDropDownRunnable;
|
||||
private final Rect mTempRect;
|
||||
private final PopupTouchInterceptor mTouchInterceptor;
|
||||
|
||||
private static boolean isConfirmKey(int i) {
|
||||
return i == 66 || i == 23;
|
||||
}
|
||||
|
||||
public View getAnchorView() {
|
||||
return this.mDropDownAnchorView;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return this.mDropDownHeight;
|
||||
}
|
||||
|
||||
public int getHorizontalOffset() {
|
||||
return this.mDropDownHorizontalOffset;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ShowableListMenu
|
||||
public ListView getListView() {
|
||||
return this.mDropDownList;
|
||||
}
|
||||
|
||||
public int getPromptPosition() {
|
||||
return this.mPromptPosition;
|
||||
}
|
||||
|
||||
public int getVerticalOffset() {
|
||||
if (this.mDropDownVerticalOffsetSet) {
|
||||
return this.mDropDownVerticalOffset;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return this.mDropDownWidth;
|
||||
}
|
||||
|
||||
public boolean isDropDownAlwaysVisible() {
|
||||
return this.mDropDownAlwaysVisible;
|
||||
}
|
||||
|
||||
public boolean isModal() {
|
||||
return this.mModal;
|
||||
}
|
||||
|
||||
public void setAnchorView(View view) {
|
||||
this.mDropDownAnchorView = view;
|
||||
}
|
||||
|
||||
public void setDropDownAlwaysVisible(boolean z) {
|
||||
this.mDropDownAlwaysVisible = z;
|
||||
}
|
||||
|
||||
public void setDropDownGravity(int i) {
|
||||
this.mDropDownGravity = i;
|
||||
}
|
||||
|
||||
public void setForceIgnoreOutsideTouch(boolean z) {
|
||||
this.mForceIgnoreOutsideTouch = z;
|
||||
}
|
||||
|
||||
public void setHorizontalOffset(int i) {
|
||||
this.mDropDownHorizontalOffset = i;
|
||||
}
|
||||
|
||||
void setListItemExpandMax(int i) {
|
||||
this.mListItemExpandMaximum = i;
|
||||
}
|
||||
|
||||
public void setListSelector(Drawable drawable) {
|
||||
this.mDropDownListHighlight = drawable;
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(AdapterView.OnItemClickListener onItemClickListener) {
|
||||
this.mItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
public void setOnItemSelectedListener(AdapterView.OnItemSelectedListener onItemSelectedListener) {
|
||||
this.mItemSelectedListener = onItemSelectedListener;
|
||||
}
|
||||
|
||||
public void setOverlapAnchor(boolean z) {
|
||||
this.mOverlapAnchorSet = true;
|
||||
this.mOverlapAnchor = z;
|
||||
}
|
||||
|
||||
public void setPromptPosition(int i) {
|
||||
this.mPromptPosition = i;
|
||||
}
|
||||
|
||||
public void setVerticalOffset(int i) {
|
||||
this.mDropDownVerticalOffset = i;
|
||||
this.mDropDownVerticalOffsetSet = true;
|
||||
}
|
||||
|
||||
public void setWidth(int i) {
|
||||
this.mDropDownWidth = i;
|
||||
}
|
||||
|
||||
public void setWindowLayoutType(int i) {
|
||||
this.mDropDownWindowLayoutType = i;
|
||||
}
|
||||
|
||||
static {
|
||||
if (Build.VERSION.SDK_INT <= 28) {
|
||||
try {
|
||||
sSetClipToWindowEnabledMethod = PopupWindow.class.getDeclaredMethod("setClipToScreenEnabled", Boolean.TYPE);
|
||||
} catch (NoSuchMethodException unused) {
|
||||
Log.i(TAG, "Could not find method setClipToScreenEnabled() on PopupWindow. Oh well.");
|
||||
}
|
||||
try {
|
||||
sSetEpicenterBoundsMethod = PopupWindow.class.getDeclaredMethod("setEpicenterBounds", Rect.class);
|
||||
} catch (NoSuchMethodException unused2) {
|
||||
Log.i(TAG, "Could not find method setEpicenterBounds(Rect) on PopupWindow. Oh well.");
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT <= 23) {
|
||||
try {
|
||||
sGetMaxAvailableHeightMethod = PopupWindow.class.getDeclaredMethod("getMaxAvailableHeight", View.class, Integer.TYPE, Boolean.TYPE);
|
||||
} catch (NoSuchMethodException unused3) {
|
||||
Log.i(TAG, "Could not find method getMaxAvailableHeight(View, int, boolean) on PopupWindow. Oh well.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ListPopupWindow(Context context) {
|
||||
this(context, null, R.attr.listPopupWindowStyle);
|
||||
}
|
||||
|
||||
public ListPopupWindow(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, R.attr.listPopupWindowStyle);
|
||||
}
|
||||
|
||||
public ListPopupWindow(Context context, AttributeSet attributeSet, int i) {
|
||||
this(context, attributeSet, i, 0);
|
||||
}
|
||||
|
||||
public ListPopupWindow(Context context, AttributeSet attributeSet, int i, int i2) {
|
||||
this.mDropDownHeight = -2;
|
||||
this.mDropDownWidth = -2;
|
||||
this.mDropDownWindowLayoutType = PointerIconCompat.TYPE_HAND;
|
||||
this.mDropDownGravity = 0;
|
||||
this.mDropDownAlwaysVisible = false;
|
||||
this.mForceIgnoreOutsideTouch = false;
|
||||
this.mListItemExpandMaximum = Integer.MAX_VALUE;
|
||||
this.mPromptPosition = 0;
|
||||
this.mResizePopupRunnable = new ResizePopupRunnable();
|
||||
this.mTouchInterceptor = new PopupTouchInterceptor();
|
||||
this.mScrollListener = new PopupScrollListener();
|
||||
this.mHideSelector = new ListSelectorHider();
|
||||
this.mTempRect = new Rect();
|
||||
this.mContext = context;
|
||||
this.mHandler = new Handler(context.getMainLooper());
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.ListPopupWindow, i, i2);
|
||||
this.mDropDownHorizontalOffset = obtainStyledAttributes.getDimensionPixelOffset(R.styleable.ListPopupWindow_android_dropDownHorizontalOffset, 0);
|
||||
int dimensionPixelOffset = obtainStyledAttributes.getDimensionPixelOffset(R.styleable.ListPopupWindow_android_dropDownVerticalOffset, 0);
|
||||
this.mDropDownVerticalOffset = dimensionPixelOffset;
|
||||
if (dimensionPixelOffset != 0) {
|
||||
this.mDropDownVerticalOffsetSet = true;
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
AppCompatPopupWindow appCompatPopupWindow = new AppCompatPopupWindow(context, attributeSet, i, i2);
|
||||
this.mPopup = appCompatPopupWindow;
|
||||
appCompatPopupWindow.setInputMethodMode(1);
|
||||
}
|
||||
|
||||
public void setAdapter(ListAdapter listAdapter) {
|
||||
DataSetObserver dataSetObserver = this.mObserver;
|
||||
if (dataSetObserver == null) {
|
||||
this.mObserver = new PopupDataSetObserver();
|
||||
} else {
|
||||
ListAdapter listAdapter2 = this.mAdapter;
|
||||
if (listAdapter2 != null) {
|
||||
listAdapter2.unregisterDataSetObserver(dataSetObserver);
|
||||
}
|
||||
}
|
||||
this.mAdapter = listAdapter;
|
||||
if (listAdapter != null) {
|
||||
listAdapter.registerDataSetObserver(this.mObserver);
|
||||
}
|
||||
DropDownListView dropDownListView = this.mDropDownList;
|
||||
if (dropDownListView != null) {
|
||||
dropDownListView.setAdapter(this.mAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
public void setModal(boolean z) {
|
||||
this.mModal = z;
|
||||
this.mPopup.setFocusable(z);
|
||||
}
|
||||
|
||||
public void setSoftInputMode(int i) {
|
||||
this.mPopup.setSoftInputMode(i);
|
||||
}
|
||||
|
||||
public int getSoftInputMode() {
|
||||
return this.mPopup.getSoftInputMode();
|
||||
}
|
||||
|
||||
public Drawable getBackground() {
|
||||
return this.mPopup.getBackground();
|
||||
}
|
||||
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
this.mPopup.setBackgroundDrawable(drawable);
|
||||
}
|
||||
|
||||
public void setAnimationStyle(int i) {
|
||||
this.mPopup.setAnimationStyle(i);
|
||||
}
|
||||
|
||||
public int getAnimationStyle() {
|
||||
return this.mPopup.getAnimationStyle();
|
||||
}
|
||||
|
||||
public void setEpicenterBounds(Rect rect) {
|
||||
this.mEpicenterBounds = rect != null ? new Rect(rect) : null;
|
||||
}
|
||||
|
||||
public Rect getEpicenterBounds() {
|
||||
if (this.mEpicenterBounds != null) {
|
||||
return new Rect(this.mEpicenterBounds);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setContentWidth(int i) {
|
||||
Drawable background = this.mPopup.getBackground();
|
||||
if (background != null) {
|
||||
background.getPadding(this.mTempRect);
|
||||
this.mDropDownWidth = this.mTempRect.left + this.mTempRect.right + i;
|
||||
} else {
|
||||
setWidth(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void setHeight(int i) {
|
||||
if (i < 0 && -2 != i && -1 != i) {
|
||||
throw new IllegalArgumentException("Invalid height. Must be a positive value, MATCH_PARENT, or WRAP_CONTENT.");
|
||||
}
|
||||
this.mDropDownHeight = i;
|
||||
}
|
||||
|
||||
public void setPromptView(View view) {
|
||||
boolean isShowing = isShowing();
|
||||
if (isShowing) {
|
||||
removePromptView();
|
||||
}
|
||||
this.mPromptView = view;
|
||||
if (isShowing) {
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
public void postShow() {
|
||||
this.mHandler.post(this.mShowDropDownRunnable);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ShowableListMenu
|
||||
public void show() {
|
||||
int buildDropDown = buildDropDown();
|
||||
boolean isInputMethodNotNeeded = isInputMethodNotNeeded();
|
||||
PopupWindowCompat.setWindowLayoutType(this.mPopup, this.mDropDownWindowLayoutType);
|
||||
if (this.mPopup.isShowing()) {
|
||||
if (ViewCompat.isAttachedToWindow(getAnchorView())) {
|
||||
int i = this.mDropDownWidth;
|
||||
if (i == -1) {
|
||||
i = -1;
|
||||
} else if (i == -2) {
|
||||
i = getAnchorView().getWidth();
|
||||
}
|
||||
int i2 = this.mDropDownHeight;
|
||||
if (i2 == -1) {
|
||||
if (!isInputMethodNotNeeded) {
|
||||
buildDropDown = -1;
|
||||
}
|
||||
if (isInputMethodNotNeeded) {
|
||||
this.mPopup.setWidth(this.mDropDownWidth == -1 ? -1 : 0);
|
||||
this.mPopup.setHeight(0);
|
||||
} else {
|
||||
this.mPopup.setWidth(this.mDropDownWidth == -1 ? -1 : 0);
|
||||
this.mPopup.setHeight(-1);
|
||||
}
|
||||
} else if (i2 != -2) {
|
||||
buildDropDown = i2;
|
||||
}
|
||||
this.mPopup.setOutsideTouchable((this.mForceIgnoreOutsideTouch || this.mDropDownAlwaysVisible) ? false : true);
|
||||
this.mPopup.update(getAnchorView(), this.mDropDownHorizontalOffset, this.mDropDownVerticalOffset, i < 0 ? -1 : i, buildDropDown < 0 ? -1 : buildDropDown);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
int i3 = this.mDropDownWidth;
|
||||
if (i3 == -1) {
|
||||
i3 = -1;
|
||||
} else if (i3 == -2) {
|
||||
i3 = getAnchorView().getWidth();
|
||||
}
|
||||
int i4 = this.mDropDownHeight;
|
||||
if (i4 == -1) {
|
||||
buildDropDown = -1;
|
||||
} else if (i4 != -2) {
|
||||
buildDropDown = i4;
|
||||
}
|
||||
this.mPopup.setWidth(i3);
|
||||
this.mPopup.setHeight(buildDropDown);
|
||||
setPopupClipToScreenEnabled(true);
|
||||
this.mPopup.setOutsideTouchable((this.mForceIgnoreOutsideTouch || this.mDropDownAlwaysVisible) ? false : true);
|
||||
this.mPopup.setTouchInterceptor(this.mTouchInterceptor);
|
||||
if (this.mOverlapAnchorSet) {
|
||||
PopupWindowCompat.setOverlapAnchor(this.mPopup, this.mOverlapAnchor);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT <= 28) {
|
||||
Method method = sSetEpicenterBoundsMethod;
|
||||
if (method != null) {
|
||||
try {
|
||||
method.invoke(this.mPopup, this.mEpicenterBounds);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Could not invoke setEpicenterBounds on PopupWindow", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Api29Impl.setEpicenterBounds(this.mPopup, this.mEpicenterBounds);
|
||||
}
|
||||
PopupWindowCompat.showAsDropDown(this.mPopup, getAnchorView(), this.mDropDownHorizontalOffset, this.mDropDownVerticalOffset, this.mDropDownGravity);
|
||||
this.mDropDownList.setSelection(-1);
|
||||
if (!this.mModal || this.mDropDownList.isInTouchMode()) {
|
||||
clearListSelection();
|
||||
}
|
||||
if (this.mModal) {
|
||||
return;
|
||||
}
|
||||
this.mHandler.post(this.mHideSelector);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ShowableListMenu
|
||||
public void dismiss() {
|
||||
this.mPopup.dismiss();
|
||||
removePromptView();
|
||||
this.mPopup.setContentView(null);
|
||||
this.mDropDownList = null;
|
||||
this.mHandler.removeCallbacks(this.mResizePopupRunnable);
|
||||
}
|
||||
|
||||
public void setOnDismissListener(PopupWindow.OnDismissListener onDismissListener) {
|
||||
this.mPopup.setOnDismissListener(onDismissListener);
|
||||
}
|
||||
|
||||
private void removePromptView() {
|
||||
View view = this.mPromptView;
|
||||
if (view != null) {
|
||||
ViewParent parent = view.getParent();
|
||||
if (parent instanceof ViewGroup) {
|
||||
((ViewGroup) parent).removeView(this.mPromptView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setInputMethodMode(int i) {
|
||||
this.mPopup.setInputMethodMode(i);
|
||||
}
|
||||
|
||||
public int getInputMethodMode() {
|
||||
return this.mPopup.getInputMethodMode();
|
||||
}
|
||||
|
||||
public void setSelection(int i) {
|
||||
DropDownListView dropDownListView = this.mDropDownList;
|
||||
if (!isShowing() || dropDownListView == null) {
|
||||
return;
|
||||
}
|
||||
dropDownListView.setListSelectionHidden(false);
|
||||
dropDownListView.setSelection(i);
|
||||
if (dropDownListView.getChoiceMode() != 0) {
|
||||
dropDownListView.setItemChecked(i, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearListSelection() {
|
||||
DropDownListView dropDownListView = this.mDropDownList;
|
||||
if (dropDownListView != null) {
|
||||
dropDownListView.setListSelectionHidden(true);
|
||||
dropDownListView.requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.ShowableListMenu
|
||||
public boolean isShowing() {
|
||||
return this.mPopup.isShowing();
|
||||
}
|
||||
|
||||
public boolean isInputMethodNotNeeded() {
|
||||
return this.mPopup.getInputMethodMode() == 2;
|
||||
}
|
||||
|
||||
public boolean performItemClick(int i) {
|
||||
if (!isShowing()) {
|
||||
return false;
|
||||
}
|
||||
if (this.mItemClickListener == null) {
|
||||
return true;
|
||||
}
|
||||
DropDownListView dropDownListView = this.mDropDownList;
|
||||
this.mItemClickListener.onItemClick(dropDownListView, dropDownListView.getChildAt(i - dropDownListView.getFirstVisiblePosition()), i, dropDownListView.getAdapter().getItemId(i));
|
||||
return true;
|
||||
}
|
||||
|
||||
public Object getSelectedItem() {
|
||||
if (isShowing()) {
|
||||
return this.mDropDownList.getSelectedItem();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getSelectedItemPosition() {
|
||||
if (isShowing()) {
|
||||
return this.mDropDownList.getSelectedItemPosition();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public long getSelectedItemId() {
|
||||
if (isShowing()) {
|
||||
return this.mDropDownList.getSelectedItemId();
|
||||
}
|
||||
return Long.MIN_VALUE;
|
||||
}
|
||||
|
||||
public View getSelectedView() {
|
||||
if (isShowing()) {
|
||||
return this.mDropDownList.getSelectedView();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
DropDownListView createDropDownListView(Context context, boolean z) {
|
||||
return new DropDownListView(context, z);
|
||||
}
|
||||
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
int i2;
|
||||
int i3;
|
||||
if (isShowing() && i != 62 && (this.mDropDownList.getSelectedItemPosition() >= 0 || !isConfirmKey(i))) {
|
||||
int selectedItemPosition = this.mDropDownList.getSelectedItemPosition();
|
||||
boolean z = !this.mPopup.isAboveAnchor();
|
||||
ListAdapter listAdapter = this.mAdapter;
|
||||
if (listAdapter != null) {
|
||||
boolean areAllItemsEnabled = listAdapter.areAllItemsEnabled();
|
||||
i2 = areAllItemsEnabled ? 0 : this.mDropDownList.lookForSelectablePosition(0, true);
|
||||
if (areAllItemsEnabled) {
|
||||
i3 = listAdapter.getCount() - 1;
|
||||
} else {
|
||||
i3 = this.mDropDownList.lookForSelectablePosition(listAdapter.getCount() - 1, false);
|
||||
}
|
||||
} else {
|
||||
i2 = Integer.MAX_VALUE;
|
||||
i3 = Integer.MIN_VALUE;
|
||||
}
|
||||
if ((z && i == 19 && selectedItemPosition <= i2) || (!z && i == 20 && selectedItemPosition >= i3)) {
|
||||
clearListSelection();
|
||||
this.mPopup.setInputMethodMode(1);
|
||||
show();
|
||||
return true;
|
||||
}
|
||||
this.mDropDownList.setListSelectionHidden(false);
|
||||
if (this.mDropDownList.onKeyDown(i, keyEvent)) {
|
||||
this.mPopup.setInputMethodMode(2);
|
||||
this.mDropDownList.requestFocusFromTouch();
|
||||
show();
|
||||
if (i == 19 || i == 20 || i == 23 || i == 66) {
|
||||
return true;
|
||||
}
|
||||
} else if (z && i == 20) {
|
||||
if (selectedItemPosition == i3) {
|
||||
return true;
|
||||
}
|
||||
} else if (!z && i == 19 && selectedItemPosition == i2) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onKeyUp(int i, KeyEvent keyEvent) {
|
||||
if (!isShowing() || this.mDropDownList.getSelectedItemPosition() < 0) {
|
||||
return false;
|
||||
}
|
||||
boolean onKeyUp = this.mDropDownList.onKeyUp(i, keyEvent);
|
||||
if (onKeyUp && isConfirmKey(i)) {
|
||||
dismiss();
|
||||
}
|
||||
return onKeyUp;
|
||||
}
|
||||
|
||||
public boolean onKeyPreIme(int i, KeyEvent keyEvent) {
|
||||
if (i != 4 || !isShowing()) {
|
||||
return false;
|
||||
}
|
||||
View view = this.mDropDownAnchorView;
|
||||
if (keyEvent.getAction() == 0 && keyEvent.getRepeatCount() == 0) {
|
||||
KeyEvent.DispatcherState keyDispatcherState = view.getKeyDispatcherState();
|
||||
if (keyDispatcherState != null) {
|
||||
keyDispatcherState.startTracking(keyEvent, this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (keyEvent.getAction() != 1) {
|
||||
return false;
|
||||
}
|
||||
KeyEvent.DispatcherState keyDispatcherState2 = view.getKeyDispatcherState();
|
||||
if (keyDispatcherState2 != null) {
|
||||
keyDispatcherState2.handleUpEvent(keyEvent);
|
||||
}
|
||||
if (!keyEvent.isTracking() || keyEvent.isCanceled()) {
|
||||
return false;
|
||||
}
|
||||
dismiss();
|
||||
return true;
|
||||
}
|
||||
|
||||
public View.OnTouchListener createDragToOpenListener(View view) {
|
||||
return new ForwardingListener(view) { // from class: androidx.appcompat.widget.ListPopupWindow.1
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
public ListPopupWindow getPopup() {
|
||||
return ListPopupWindow.this;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private int buildDropDown() {
|
||||
int i;
|
||||
int i2;
|
||||
int makeMeasureSpec;
|
||||
int i3;
|
||||
if (this.mDropDownList == null) {
|
||||
Context context = this.mContext;
|
||||
this.mShowDropDownRunnable = new Runnable() { // from class: androidx.appcompat.widget.ListPopupWindow.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
View anchorView = ListPopupWindow.this.getAnchorView();
|
||||
if (anchorView == null || anchorView.getWindowToken() == null) {
|
||||
return;
|
||||
}
|
||||
ListPopupWindow.this.show();
|
||||
}
|
||||
};
|
||||
DropDownListView createDropDownListView = createDropDownListView(context, !this.mModal);
|
||||
this.mDropDownList = createDropDownListView;
|
||||
Drawable drawable = this.mDropDownListHighlight;
|
||||
if (drawable != null) {
|
||||
createDropDownListView.setSelector(drawable);
|
||||
}
|
||||
this.mDropDownList.setAdapter(this.mAdapter);
|
||||
this.mDropDownList.setOnItemClickListener(this.mItemClickListener);
|
||||
this.mDropDownList.setFocusable(true);
|
||||
this.mDropDownList.setFocusableInTouchMode(true);
|
||||
this.mDropDownList.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { // from class: androidx.appcompat.widget.ListPopupWindow.3
|
||||
@Override // android.widget.AdapterView.OnItemSelectedListener
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
}
|
||||
|
||||
@Override // android.widget.AdapterView.OnItemSelectedListener
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int i4, long j) {
|
||||
DropDownListView dropDownListView;
|
||||
if (i4 == -1 || (dropDownListView = ListPopupWindow.this.mDropDownList) == null) {
|
||||
return;
|
||||
}
|
||||
dropDownListView.setListSelectionHidden(false);
|
||||
}
|
||||
});
|
||||
this.mDropDownList.setOnScrollListener(this.mScrollListener);
|
||||
AdapterView.OnItemSelectedListener onItemSelectedListener = this.mItemSelectedListener;
|
||||
if (onItemSelectedListener != null) {
|
||||
this.mDropDownList.setOnItemSelectedListener(onItemSelectedListener);
|
||||
}
|
||||
View view = this.mDropDownList;
|
||||
View view2 = this.mPromptView;
|
||||
if (view2 != null) {
|
||||
LinearLayout linearLayout = new LinearLayout(context);
|
||||
linearLayout.setOrientation(1);
|
||||
ViewGroup.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, 0, 1.0f);
|
||||
int i4 = this.mPromptPosition;
|
||||
if (i4 == 0) {
|
||||
linearLayout.addView(view2);
|
||||
linearLayout.addView(view, layoutParams);
|
||||
} else if (i4 == 1) {
|
||||
linearLayout.addView(view, layoutParams);
|
||||
linearLayout.addView(view2);
|
||||
} else {
|
||||
Log.e(TAG, "Invalid hint position " + this.mPromptPosition);
|
||||
}
|
||||
int i5 = this.mDropDownWidth;
|
||||
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.mPopup.setContentView(view);
|
||||
} else {
|
||||
View view3 = this.mPromptView;
|
||||
if (view3 != null) {
|
||||
LinearLayout.LayoutParams layoutParams3 = (LinearLayout.LayoutParams) view3.getLayoutParams();
|
||||
i = view3.getMeasuredHeight() + layoutParams3.topMargin + layoutParams3.bottomMargin;
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
Drawable background = this.mPopup.getBackground();
|
||||
if (background != null) {
|
||||
background.getPadding(this.mTempRect);
|
||||
i2 = this.mTempRect.top + this.mTempRect.bottom;
|
||||
if (!this.mDropDownVerticalOffsetSet) {
|
||||
this.mDropDownVerticalOffset = -this.mTempRect.top;
|
||||
}
|
||||
} else {
|
||||
this.mTempRect.setEmpty();
|
||||
i2 = 0;
|
||||
}
|
||||
int maxAvailableHeight = getMaxAvailableHeight(getAnchorView(), this.mDropDownVerticalOffset, this.mPopup.getInputMethodMode() == 2);
|
||||
if (this.mDropDownAlwaysVisible || this.mDropDownHeight == -1) {
|
||||
return maxAvailableHeight + i2;
|
||||
}
|
||||
int i6 = this.mDropDownWidth;
|
||||
if (i6 == -2) {
|
||||
makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(this.mContext.getResources().getDisplayMetrics().widthPixels - (this.mTempRect.left + this.mTempRect.right), Integer.MIN_VALUE);
|
||||
} else if (i6 == -1) {
|
||||
makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(this.mContext.getResources().getDisplayMetrics().widthPixels - (this.mTempRect.left + this.mTempRect.right), BasicMeasure.EXACTLY);
|
||||
} else {
|
||||
makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i6, BasicMeasure.EXACTLY);
|
||||
}
|
||||
int measureHeightOfChildrenCompat = this.mDropDownList.measureHeightOfChildrenCompat(makeMeasureSpec, 0, -1, maxAvailableHeight - i, -1);
|
||||
if (measureHeightOfChildrenCompat > 0) {
|
||||
i += i2 + this.mDropDownList.getPaddingTop() + this.mDropDownList.getPaddingBottom();
|
||||
}
|
||||
return measureHeightOfChildrenCompat + i;
|
||||
}
|
||||
|
||||
private class PopupDataSetObserver extends DataSetObserver {
|
||||
PopupDataSetObserver() {
|
||||
}
|
||||
|
||||
@Override // android.database.DataSetObserver
|
||||
public void onChanged() {
|
||||
if (ListPopupWindow.this.isShowing()) {
|
||||
ListPopupWindow.this.show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.database.DataSetObserver
|
||||
public void onInvalidated() {
|
||||
ListPopupWindow.this.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
private class ListSelectorHider implements Runnable {
|
||||
ListSelectorHider() {
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
ListPopupWindow.this.clearListSelection();
|
||||
}
|
||||
}
|
||||
|
||||
private class ResizePopupRunnable implements Runnable {
|
||||
ResizePopupRunnable() {
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
if (ListPopupWindow.this.mDropDownList == null || !ViewCompat.isAttachedToWindow(ListPopupWindow.this.mDropDownList) || ListPopupWindow.this.mDropDownList.getCount() <= ListPopupWindow.this.mDropDownList.getChildCount() || ListPopupWindow.this.mDropDownList.getChildCount() > ListPopupWindow.this.mListItemExpandMaximum) {
|
||||
return;
|
||||
}
|
||||
ListPopupWindow.this.mPopup.setInputMethodMode(2);
|
||||
ListPopupWindow.this.show();
|
||||
}
|
||||
}
|
||||
|
||||
private class PopupTouchInterceptor implements View.OnTouchListener {
|
||||
PopupTouchInterceptor() {
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnTouchListener
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
int action = motionEvent.getAction();
|
||||
int x = (int) motionEvent.getX();
|
||||
int y = (int) motionEvent.getY();
|
||||
if (action == 0 && ListPopupWindow.this.mPopup != null && ListPopupWindow.this.mPopup.isShowing() && x >= 0 && x < ListPopupWindow.this.mPopup.getWidth() && y >= 0 && y < ListPopupWindow.this.mPopup.getHeight()) {
|
||||
ListPopupWindow.this.mHandler.postDelayed(ListPopupWindow.this.mResizePopupRunnable, 250L);
|
||||
return false;
|
||||
}
|
||||
if (action != 1) {
|
||||
return false;
|
||||
}
|
||||
ListPopupWindow.this.mHandler.removeCallbacks(ListPopupWindow.this.mResizePopupRunnable);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private class PopupScrollListener implements AbsListView.OnScrollListener {
|
||||
@Override // android.widget.AbsListView.OnScrollListener
|
||||
public void onScroll(AbsListView absListView, int i, int i2, int i3) {
|
||||
}
|
||||
|
||||
PopupScrollListener() {
|
||||
}
|
||||
|
||||
@Override // android.widget.AbsListView.OnScrollListener
|
||||
public void onScrollStateChanged(AbsListView absListView, int i) {
|
||||
if (i != 1 || ListPopupWindow.this.isInputMethodNotNeeded() || ListPopupWindow.this.mPopup.getContentView() == null) {
|
||||
return;
|
||||
}
|
||||
ListPopupWindow.this.mHandler.removeCallbacks(ListPopupWindow.this.mResizePopupRunnable);
|
||||
ListPopupWindow.this.mResizePopupRunnable.run();
|
||||
}
|
||||
}
|
||||
|
||||
private void setPopupClipToScreenEnabled(boolean z) {
|
||||
if (Build.VERSION.SDK_INT > 28) {
|
||||
Api29Impl.setIsClippedToScreen(this.mPopup, z);
|
||||
return;
|
||||
}
|
||||
Method method = sSetClipToWindowEnabledMethod;
|
||||
if (method != null) {
|
||||
try {
|
||||
method.invoke(this.mPopup, Boolean.valueOf(z));
|
||||
} catch (Exception unused) {
|
||||
Log.i(TAG, "Could not call setClipToScreenEnabled() on PopupWindow. Oh well.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getMaxAvailableHeight(View view, int i, boolean z) {
|
||||
if (Build.VERSION.SDK_INT <= 23) {
|
||||
Method method = sGetMaxAvailableHeightMethod;
|
||||
if (method != null) {
|
||||
try {
|
||||
return ((Integer) method.invoke(this.mPopup, view, Integer.valueOf(i), Boolean.valueOf(z))).intValue();
|
||||
} catch (Exception unused) {
|
||||
Log.i(TAG, "Could not call getMaxAvailableHeightMethod(View, int, boolean) on PopupWindow. Using the public version.");
|
||||
}
|
||||
}
|
||||
return this.mPopup.getMaxAvailableHeight(view, i);
|
||||
}
|
||||
return Api24Impl.getMaxAvailableHeight(this.mPopup, view, i, z);
|
||||
}
|
||||
|
||||
static class Api29Impl {
|
||||
private Api29Impl() {
|
||||
}
|
||||
|
||||
static void setEpicenterBounds(PopupWindow popupWindow, Rect rect) {
|
||||
popupWindow.setEpicenterBounds(rect);
|
||||
}
|
||||
|
||||
static void setIsClippedToScreen(PopupWindow popupWindow, boolean z) {
|
||||
popupWindow.setIsClippedToScreen(z);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api24Impl {
|
||||
private Api24Impl() {
|
||||
}
|
||||
|
||||
static int getMaxAvailableHeight(PopupWindow popupWindow, View view, int i, boolean z) {
|
||||
return popupWindow.getMaxAvailableHeight(view, i, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 onItemHoverEnter(MenuBuilder menuBuilder, MenuItem menuItem);
|
||||
|
||||
void onItemHoverExit(MenuBuilder menuBuilder, MenuItem menuItem);
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
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 final String TAG = "MenuPopupWindow";
|
||||
private static Method sSetTouchModalMethod;
|
||||
private MenuItemHoverListener mHoverListener;
|
||||
|
||||
public void setHoverListener(MenuItemHoverListener menuItemHoverListener) {
|
||||
this.mHoverListener = menuItemHoverListener;
|
||||
}
|
||||
|
||||
static {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT <= 28) {
|
||||
sSetTouchModalMethod = PopupWindow.class.getDeclaredMethod("setTouchModal", Boolean.TYPE);
|
||||
}
|
||||
} catch (NoSuchMethodException unused) {
|
||||
Log.i(TAG, "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 createDropDownListView(Context context, boolean z) {
|
||||
MenuDropDownListView menuDropDownListView = new MenuDropDownListView(context, z);
|
||||
menuDropDownListView.setHoverListener(this);
|
||||
return menuDropDownListView;
|
||||
}
|
||||
|
||||
public void setEnterTransition(Object obj) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
Api23Impl.setEnterTransition(this.mPopup, (Transition) obj);
|
||||
}
|
||||
}
|
||||
|
||||
public void setExitTransition(Object obj) {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
Api23Impl.setExitTransition(this.mPopup, (Transition) obj);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTouchModal(boolean z) {
|
||||
if (Build.VERSION.SDK_INT > 28) {
|
||||
Api29Impl.setTouchModal(this.mPopup, z);
|
||||
return;
|
||||
}
|
||||
Method method = sSetTouchModalMethod;
|
||||
if (method != null) {
|
||||
try {
|
||||
method.invoke(this.mPopup, Boolean.valueOf(z));
|
||||
} catch (Exception unused) {
|
||||
Log.i(TAG, "Could not invoke setTouchModal() on PopupWindow. Oh well.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.MenuItemHoverListener
|
||||
public void onItemHoverEnter(MenuBuilder menuBuilder, MenuItem menuItem) {
|
||||
MenuItemHoverListener menuItemHoverListener = this.mHoverListener;
|
||||
if (menuItemHoverListener != null) {
|
||||
menuItemHoverListener.onItemHoverEnter(menuBuilder, menuItem);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.MenuItemHoverListener
|
||||
public void onItemHoverExit(MenuBuilder menuBuilder, MenuItem menuItem) {
|
||||
MenuItemHoverListener menuItemHoverListener = this.mHoverListener;
|
||||
if (menuItemHoverListener != null) {
|
||||
menuItemHoverListener.onItemHoverExit(menuBuilder, menuItem);
|
||||
}
|
||||
}
|
||||
|
||||
public static class MenuDropDownListView extends DropDownListView {
|
||||
final int mAdvanceKey;
|
||||
private MenuItemHoverListener mHoverListener;
|
||||
private MenuItem mHoveredMenuItem;
|
||||
final int mRetreatKey;
|
||||
|
||||
public void setHoverListener(MenuItemHoverListener menuItemHoverListener) {
|
||||
this.mHoverListener = menuItemHoverListener;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DropDownListView, android.view.ViewGroup, android.view.View
|
||||
public /* bridge */ /* synthetic */ boolean hasFocus() {
|
||||
return super.hasFocus();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DropDownListView, android.view.View
|
||||
public /* bridge */ /* synthetic */ boolean hasWindowFocus() {
|
||||
return super.hasWindowFocus();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DropDownListView, android.view.View
|
||||
public /* bridge */ /* synthetic */ boolean isFocused() {
|
||||
return super.isFocused();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DropDownListView, android.view.View
|
||||
public /* bridge */ /* synthetic */ boolean isInTouchMode() {
|
||||
return super.isInTouchMode();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DropDownListView
|
||||
public /* bridge */ /* synthetic */ int lookForSelectablePosition(int i, boolean z) {
|
||||
return super.lookForSelectablePosition(i, z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DropDownListView
|
||||
public /* bridge */ /* synthetic */ int measureHeightOfChildrenCompat(int i, int i2, int i3, int i4, int i5) {
|
||||
return super.measureHeightOfChildrenCompat(i, i2, i3, i4, i5);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DropDownListView
|
||||
public /* bridge */ /* synthetic */ boolean onForwardedEvent(MotionEvent motionEvent, int i) {
|
||||
return super.onForwardedEvent(motionEvent, i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DropDownListView, android.widget.AbsListView, android.view.View
|
||||
public /* bridge */ /* synthetic */ boolean onTouchEvent(MotionEvent motionEvent) {
|
||||
return super.onTouchEvent(motionEvent);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DropDownListView, android.widget.AbsListView
|
||||
public /* bridge */ /* synthetic */ void setSelector(Drawable drawable) {
|
||||
super.setSelector(drawable);
|
||||
}
|
||||
|
||||
public MenuDropDownListView(Context context, boolean z) {
|
||||
super(context, z);
|
||||
if (1 == Api17Impl.getLayoutDirection(context.getResources().getConfiguration())) {
|
||||
this.mAdvanceKey = 21;
|
||||
this.mRetreatKey = 22;
|
||||
} else {
|
||||
this.mAdvanceKey = 22;
|
||||
this.mRetreatKey = 21;
|
||||
}
|
||||
}
|
||||
|
||||
public void clearSelection() {
|
||||
setSelection(-1);
|
||||
}
|
||||
|
||||
@Override // android.widget.ListView, android.widget.AbsListView, android.view.View, android.view.KeyEvent.Callback
|
||||
public boolean onKeyDown(int i, KeyEvent keyEvent) {
|
||||
MenuAdapter menuAdapter;
|
||||
ListMenuItemView listMenuItemView = (ListMenuItemView) getSelectedView();
|
||||
if (listMenuItemView != null && i == this.mAdvanceKey) {
|
||||
if (listMenuItemView.isEnabled() && listMenuItemView.getItemData().hasSubMenu()) {
|
||||
performItemClick(listMenuItemView, getSelectedItemPosition(), getSelectedItemId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (listMenuItemView != null && i == this.mRetreatKey) {
|
||||
setSelection(-1);
|
||||
ListAdapter adapter = getAdapter();
|
||||
if (adapter instanceof HeaderViewListAdapter) {
|
||||
menuAdapter = (MenuAdapter) ((HeaderViewListAdapter) adapter).getWrappedAdapter();
|
||||
} else {
|
||||
menuAdapter = (MenuAdapter) adapter;
|
||||
}
|
||||
menuAdapter.getAdapterMenu().close(false);
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(i, keyEvent);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DropDownListView, android.view.View
|
||||
public boolean onHoverEvent(MotionEvent motionEvent) {
|
||||
MenuAdapter menuAdapter;
|
||||
int i;
|
||||
int pointToPosition;
|
||||
int i2;
|
||||
if (this.mHoverListener != null) {
|
||||
ListAdapter adapter = getAdapter();
|
||||
if (adapter instanceof HeaderViewListAdapter) {
|
||||
HeaderViewListAdapter headerViewListAdapter = (HeaderViewListAdapter) adapter;
|
||||
i = headerViewListAdapter.getHeadersCount();
|
||||
menuAdapter = (MenuAdapter) headerViewListAdapter.getWrappedAdapter();
|
||||
} else {
|
||||
menuAdapter = (MenuAdapter) adapter;
|
||||
i = 0;
|
||||
}
|
||||
MenuItemImpl item = (motionEvent.getAction() == 10 || (pointToPosition = pointToPosition((int) motionEvent.getX(), (int) motionEvent.getY())) == -1 || (i2 = pointToPosition - i) < 0 || i2 >= menuAdapter.getCount()) ? null : menuAdapter.getItem(i2);
|
||||
MenuItem menuItem = this.mHoveredMenuItem;
|
||||
if (menuItem != item) {
|
||||
MenuBuilder adapterMenu = menuAdapter.getAdapterMenu();
|
||||
if (menuItem != null) {
|
||||
this.mHoverListener.onItemHoverExit(adapterMenu, menuItem);
|
||||
}
|
||||
this.mHoveredMenuItem = item;
|
||||
if (item != null) {
|
||||
this.mHoverListener.onItemHoverEnter(adapterMenu, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onHoverEvent(motionEvent);
|
||||
}
|
||||
|
||||
static class Api17Impl {
|
||||
private Api17Impl() {
|
||||
}
|
||||
|
||||
static int getLayoutDirection(Configuration configuration) {
|
||||
return configuration.getLayoutDirection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class Api23Impl {
|
||||
private Api23Impl() {
|
||||
}
|
||||
|
||||
static void setEnterTransition(PopupWindow popupWindow, Transition transition) {
|
||||
popupWindow.setEnterTransition(transition);
|
||||
}
|
||||
|
||||
static void setExitTransition(PopupWindow popupWindow, Transition transition) {
|
||||
popupWindow.setExitTransition(transition);
|
||||
}
|
||||
}
|
||||
|
||||
static class Api29Impl {
|
||||
private Api29Impl() {
|
||||
}
|
||||
|
||||
static void setTouchModal(PopupWindow popupWindow, boolean z) {
|
||||
popupWindow.setTouchModal(z);
|
||||
}
|
||||
}
|
||||
}
|
||||
143
02-Easy5/E5/sources/androidx/appcompat/widget/PopupMenu.java
Normal file
143
02-Easy5/E5/sources/androidx/appcompat/widget/PopupMenu.java
Normal file
@@ -0,0 +1,143 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ListView;
|
||||
import android.widget.PopupWindow;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.view.SupportMenuInflater;
|
||||
import androidx.appcompat.view.menu.MenuBuilder;
|
||||
import androidx.appcompat.view.menu.MenuPopupHelper;
|
||||
import androidx.appcompat.view.menu.ShowableListMenu;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PopupMenu {
|
||||
private final View mAnchor;
|
||||
private final Context mContext;
|
||||
private View.OnTouchListener mDragListener;
|
||||
private final MenuBuilder mMenu;
|
||||
OnMenuItemClickListener mMenuItemClickListener;
|
||||
OnDismissListener mOnDismissListener;
|
||||
final MenuPopupHelper mPopup;
|
||||
|
||||
public interface OnDismissListener {
|
||||
void onDismiss(PopupMenu popupMenu);
|
||||
}
|
||||
|
||||
public interface OnMenuItemClickListener {
|
||||
boolean onMenuItemClick(MenuItem menuItem);
|
||||
}
|
||||
|
||||
public Menu getMenu() {
|
||||
return this.mMenu;
|
||||
}
|
||||
|
||||
public void setOnDismissListener(OnDismissListener onDismissListener) {
|
||||
this.mOnDismissListener = onDismissListener;
|
||||
}
|
||||
|
||||
public void setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener) {
|
||||
this.mMenuItemClickListener = onMenuItemClickListener;
|
||||
}
|
||||
|
||||
public PopupMenu(Context context, View view) {
|
||||
this(context, view, 0);
|
||||
}
|
||||
|
||||
public PopupMenu(Context context, View view, int i) {
|
||||
this(context, view, i, R.attr.popupMenuStyle, 0);
|
||||
}
|
||||
|
||||
public PopupMenu(Context context, View view, int i, int i2, int i3) {
|
||||
this.mContext = context;
|
||||
this.mAnchor = view;
|
||||
MenuBuilder menuBuilder = new MenuBuilder(context);
|
||||
this.mMenu = menuBuilder;
|
||||
menuBuilder.setCallback(new MenuBuilder.Callback() { // from class: androidx.appcompat.widget.PopupMenu.1
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
||||
public void onMenuModeChange(MenuBuilder menuBuilder2) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
||||
public boolean onMenuItemSelected(MenuBuilder menuBuilder2, MenuItem menuItem) {
|
||||
if (PopupMenu.this.mMenuItemClickListener != null) {
|
||||
return PopupMenu.this.mMenuItemClickListener.onMenuItemClick(menuItem);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
MenuPopupHelper menuPopupHelper = new MenuPopupHelper(context, menuBuilder, view, false, i2, i3);
|
||||
this.mPopup = menuPopupHelper;
|
||||
menuPopupHelper.setGravity(i);
|
||||
menuPopupHelper.setOnDismissListener(new PopupWindow.OnDismissListener() { // from class: androidx.appcompat.widget.PopupMenu.2
|
||||
@Override // android.widget.PopupWindow.OnDismissListener
|
||||
public void onDismiss() {
|
||||
if (PopupMenu.this.mOnDismissListener != null) {
|
||||
PopupMenu.this.mOnDismissListener.onDismiss(PopupMenu.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setGravity(int i) {
|
||||
this.mPopup.setGravity(i);
|
||||
}
|
||||
|
||||
public int getGravity() {
|
||||
return this.mPopup.getGravity();
|
||||
}
|
||||
|
||||
public View.OnTouchListener getDragToOpenListener() {
|
||||
if (this.mDragListener == null) {
|
||||
this.mDragListener = new ForwardingListener(this.mAnchor) { // from class: androidx.appcompat.widget.PopupMenu.3
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
protected boolean onForwardingStarted() {
|
||||
PopupMenu.this.show();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
protected boolean onForwardingStopped() {
|
||||
PopupMenu.this.dismiss();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ForwardingListener
|
||||
public ShowableListMenu getPopup() {
|
||||
return PopupMenu.this.mPopup.getPopup();
|
||||
}
|
||||
};
|
||||
}
|
||||
return this.mDragListener;
|
||||
}
|
||||
|
||||
public MenuInflater getMenuInflater() {
|
||||
return new SupportMenuInflater(this.mContext);
|
||||
}
|
||||
|
||||
public void inflate(int i) {
|
||||
getMenuInflater().inflate(i, this.mMenu);
|
||||
}
|
||||
|
||||
public void show() {
|
||||
this.mPopup.show();
|
||||
}
|
||||
|
||||
public void dismiss() {
|
||||
this.mPopup.dismiss();
|
||||
}
|
||||
|
||||
public void setForceShowIcon(boolean z) {
|
||||
this.mPopup.setForceShowIcon(z);
|
||||
}
|
||||
|
||||
ListView getMenuListView() {
|
||||
if (this.mPopup.isShowing()) {
|
||||
return this.mPopup.getListView();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,459 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
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.graphics.drawable.AnimatedStateListDrawableCompat;
|
||||
import androidx.appcompat.resources.Compatibility;
|
||||
import androidx.appcompat.resources.R;
|
||||
import androidx.collection.LongSparseArray;
|
||||
import androidx.collection.LruCache;
|
||||
import androidx.collection.SimpleArrayMap;
|
||||
import androidx.collection.SparseArrayCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
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 ResourceManagerInternal {
|
||||
private static final boolean DEBUG = false;
|
||||
private static ResourceManagerInternal INSTANCE = null;
|
||||
private static final String PLATFORM_VD_CLAZZ = "android.graphics.drawable.VectorDrawable";
|
||||
private static final String SKIP_DRAWABLE_TAG = "appcompat_skip_skip";
|
||||
private static final String TAG = "ResourceManagerInternal";
|
||||
private SimpleArrayMap<String, InflateDelegate> mDelegates;
|
||||
private final WeakHashMap<Context, LongSparseArray<WeakReference<Drawable.ConstantState>>> mDrawableCaches = new WeakHashMap<>(0);
|
||||
private boolean mHasCheckedVectorDrawableSetup;
|
||||
private ResourceManagerHooks mHooks;
|
||||
private SparseArrayCompat<String> mKnownDrawableIdTags;
|
||||
private WeakHashMap<Context, SparseArrayCompat<ColorStateList>> mTintLists;
|
||||
private TypedValue mTypedValue;
|
||||
private static final PorterDuff.Mode DEFAULT_MODE = PorterDuff.Mode.SRC_IN;
|
||||
private static final ColorFilterLruCache COLOR_FILTER_CACHE = new ColorFilterLruCache(6);
|
||||
|
||||
private interface InflateDelegate {
|
||||
Drawable createFromXmlInner(Context context, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme);
|
||||
}
|
||||
|
||||
public interface ResourceManagerHooks {
|
||||
Drawable createDrawableFor(ResourceManagerInternal resourceManagerInternal, Context context, int i);
|
||||
|
||||
ColorStateList getTintListForDrawableRes(Context context, int i);
|
||||
|
||||
PorterDuff.Mode getTintModeForDrawableRes(int i);
|
||||
|
||||
boolean tintDrawable(Context context, int i, Drawable drawable);
|
||||
|
||||
boolean tintDrawableUsingColorFilter(Context context, int i, Drawable drawable);
|
||||
}
|
||||
|
||||
public static synchronized ResourceManagerInternal get() {
|
||||
ResourceManagerInternal resourceManagerInternal;
|
||||
synchronized (ResourceManagerInternal.class) {
|
||||
if (INSTANCE == null) {
|
||||
ResourceManagerInternal resourceManagerInternal2 = new ResourceManagerInternal();
|
||||
INSTANCE = resourceManagerInternal2;
|
||||
installDefaultInflateDelegates(resourceManagerInternal2);
|
||||
}
|
||||
resourceManagerInternal = INSTANCE;
|
||||
}
|
||||
return resourceManagerInternal;
|
||||
}
|
||||
|
||||
private static void installDefaultInflateDelegates(ResourceManagerInternal resourceManagerInternal) {
|
||||
if (Build.VERSION.SDK_INT < 24) {
|
||||
resourceManagerInternal.addDelegate("vector", new VdcInflateDelegate());
|
||||
resourceManagerInternal.addDelegate("animated-vector", new AvdcInflateDelegate());
|
||||
resourceManagerInternal.addDelegate("animated-selector", new AsldcInflateDelegate());
|
||||
resourceManagerInternal.addDelegate("drawable", new DrawableDelegate());
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void setHooks(ResourceManagerHooks resourceManagerHooks) {
|
||||
this.mHooks = resourceManagerHooks;
|
||||
}
|
||||
|
||||
public synchronized Drawable getDrawable(Context context, int i) {
|
||||
return getDrawable(context, i, false);
|
||||
}
|
||||
|
||||
synchronized Drawable getDrawable(Context context, int i, boolean z) {
|
||||
Drawable loadDrawableFromDelegates;
|
||||
checkVectorDrawableSetup(context);
|
||||
loadDrawableFromDelegates = loadDrawableFromDelegates(context, i);
|
||||
if (loadDrawableFromDelegates == null) {
|
||||
loadDrawableFromDelegates = createDrawableIfNeeded(context, i);
|
||||
}
|
||||
if (loadDrawableFromDelegates == null) {
|
||||
loadDrawableFromDelegates = ContextCompat.getDrawable(context, i);
|
||||
}
|
||||
if (loadDrawableFromDelegates != null) {
|
||||
loadDrawableFromDelegates = tintDrawable(context, i, z, loadDrawableFromDelegates);
|
||||
}
|
||||
if (loadDrawableFromDelegates != null) {
|
||||
DrawableUtils.fixDrawable(loadDrawableFromDelegates);
|
||||
}
|
||||
return loadDrawableFromDelegates;
|
||||
}
|
||||
|
||||
public synchronized void onConfigurationChanged(Context context) {
|
||||
LongSparseArray<WeakReference<Drawable.ConstantState>> longSparseArray = this.mDrawableCaches.get(context);
|
||||
if (longSparseArray != null) {
|
||||
longSparseArray.clear();
|
||||
}
|
||||
}
|
||||
|
||||
private static long createCacheKey(TypedValue typedValue) {
|
||||
return (typedValue.assetCookie << 32) | typedValue.data;
|
||||
}
|
||||
|
||||
private Drawable createDrawableIfNeeded(Context context, int i) {
|
||||
if (this.mTypedValue == null) {
|
||||
this.mTypedValue = new TypedValue();
|
||||
}
|
||||
TypedValue typedValue = this.mTypedValue;
|
||||
context.getResources().getValue(i, typedValue, true);
|
||||
long createCacheKey = createCacheKey(typedValue);
|
||||
Drawable cachedDrawable = getCachedDrawable(context, createCacheKey);
|
||||
if (cachedDrawable != null) {
|
||||
return cachedDrawable;
|
||||
}
|
||||
ResourceManagerHooks resourceManagerHooks = this.mHooks;
|
||||
Drawable createDrawableFor = resourceManagerHooks == null ? null : resourceManagerHooks.createDrawableFor(this, context, i);
|
||||
if (createDrawableFor != null) {
|
||||
createDrawableFor.setChangingConfigurations(typedValue.changingConfigurations);
|
||||
addDrawableToCache(context, createCacheKey, createDrawableFor);
|
||||
}
|
||||
return createDrawableFor;
|
||||
}
|
||||
|
||||
private Drawable tintDrawable(Context context, int i, boolean z, Drawable drawable) {
|
||||
ColorStateList tintList = getTintList(context, i);
|
||||
if (tintList != null) {
|
||||
if (DrawableUtils.canSafelyMutateDrawable(drawable)) {
|
||||
drawable = drawable.mutate();
|
||||
}
|
||||
Drawable wrap = DrawableCompat.wrap(drawable);
|
||||
DrawableCompat.setTintList(wrap, tintList);
|
||||
PorterDuff.Mode tintMode = getTintMode(i);
|
||||
if (tintMode == null) {
|
||||
return wrap;
|
||||
}
|
||||
DrawableCompat.setTintMode(wrap, tintMode);
|
||||
return wrap;
|
||||
}
|
||||
ResourceManagerHooks resourceManagerHooks = this.mHooks;
|
||||
if ((resourceManagerHooks == null || !resourceManagerHooks.tintDrawable(context, i, drawable)) && !tintDrawableUsingColorFilter(context, i, drawable) && z) {
|
||||
return null;
|
||||
}
|
||||
return drawable;
|
||||
}
|
||||
|
||||
private Drawable loadDrawableFromDelegates(Context context, int i) {
|
||||
int next;
|
||||
SimpleArrayMap<String, InflateDelegate> simpleArrayMap = this.mDelegates;
|
||||
if (simpleArrayMap == null || simpleArrayMap.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
SparseArrayCompat<String> sparseArrayCompat = this.mKnownDrawableIdTags;
|
||||
if (sparseArrayCompat != null) {
|
||||
String str = sparseArrayCompat.get(i);
|
||||
if (SKIP_DRAWABLE_TAG.equals(str) || (str != null && this.mDelegates.get(str) == null)) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
this.mKnownDrawableIdTags = new SparseArrayCompat<>();
|
||||
}
|
||||
if (this.mTypedValue == null) {
|
||||
this.mTypedValue = new TypedValue();
|
||||
}
|
||||
TypedValue typedValue = this.mTypedValue;
|
||||
Resources resources = context.getResources();
|
||||
resources.getValue(i, typedValue, true);
|
||||
long createCacheKey = createCacheKey(typedValue);
|
||||
Drawable cachedDrawable = getCachedDrawable(context, createCacheKey);
|
||||
if (cachedDrawable != null) {
|
||||
return cachedDrawable;
|
||||
}
|
||||
if (typedValue.string != null && typedValue.string.toString().endsWith(".xml")) {
|
||||
try {
|
||||
XmlResourceParser xml = resources.getXml(i);
|
||||
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.mKnownDrawableIdTags.append(i, name);
|
||||
InflateDelegate inflateDelegate = this.mDelegates.get(name);
|
||||
if (inflateDelegate != null) {
|
||||
cachedDrawable = inflateDelegate.createFromXmlInner(context, xml, asAttributeSet, context.getTheme());
|
||||
}
|
||||
if (cachedDrawable != null) {
|
||||
cachedDrawable.setChangingConfigurations(typedValue.changingConfigurations);
|
||||
addDrawableToCache(context, createCacheKey, cachedDrawable);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Exception while inflating drawable", e);
|
||||
}
|
||||
}
|
||||
if (cachedDrawable == null) {
|
||||
this.mKnownDrawableIdTags.append(i, SKIP_DRAWABLE_TAG);
|
||||
}
|
||||
return cachedDrawable;
|
||||
}
|
||||
|
||||
private synchronized Drawable getCachedDrawable(Context context, long j) {
|
||||
LongSparseArray<WeakReference<Drawable.ConstantState>> longSparseArray = this.mDrawableCaches.get(context);
|
||||
if (longSparseArray == null) {
|
||||
return null;
|
||||
}
|
||||
WeakReference<Drawable.ConstantState> weakReference = longSparseArray.get(j);
|
||||
if (weakReference != null) {
|
||||
Drawable.ConstantState constantState = weakReference.get();
|
||||
if (constantState != null) {
|
||||
return constantState.newDrawable(context.getResources());
|
||||
}
|
||||
longSparseArray.remove(j);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private synchronized boolean addDrawableToCache(Context context, long j, Drawable drawable) {
|
||||
Drawable.ConstantState constantState = drawable.getConstantState();
|
||||
if (constantState == null) {
|
||||
return false;
|
||||
}
|
||||
LongSparseArray<WeakReference<Drawable.ConstantState>> longSparseArray = this.mDrawableCaches.get(context);
|
||||
if (longSparseArray == null) {
|
||||
longSparseArray = new LongSparseArray<>();
|
||||
this.mDrawableCaches.put(context, longSparseArray);
|
||||
}
|
||||
longSparseArray.put(j, new WeakReference<>(constantState));
|
||||
return true;
|
||||
}
|
||||
|
||||
synchronized Drawable onDrawableLoadedFromResources(Context context, VectorEnabledTintResources vectorEnabledTintResources, int i) {
|
||||
Drawable loadDrawableFromDelegates = loadDrawableFromDelegates(context, i);
|
||||
if (loadDrawableFromDelegates == null) {
|
||||
loadDrawableFromDelegates = vectorEnabledTintResources.getDrawableCanonical(i);
|
||||
}
|
||||
if (loadDrawableFromDelegates == null) {
|
||||
return null;
|
||||
}
|
||||
return tintDrawable(context, i, false, loadDrawableFromDelegates);
|
||||
}
|
||||
|
||||
boolean tintDrawableUsingColorFilter(Context context, int i, Drawable drawable) {
|
||||
ResourceManagerHooks resourceManagerHooks = this.mHooks;
|
||||
return resourceManagerHooks != null && resourceManagerHooks.tintDrawableUsingColorFilter(context, i, drawable);
|
||||
}
|
||||
|
||||
private void addDelegate(String str, InflateDelegate inflateDelegate) {
|
||||
if (this.mDelegates == null) {
|
||||
this.mDelegates = new SimpleArrayMap<>();
|
||||
}
|
||||
this.mDelegates.put(str, inflateDelegate);
|
||||
}
|
||||
|
||||
PorterDuff.Mode getTintMode(int i) {
|
||||
ResourceManagerHooks resourceManagerHooks = this.mHooks;
|
||||
if (resourceManagerHooks == null) {
|
||||
return null;
|
||||
}
|
||||
return resourceManagerHooks.getTintModeForDrawableRes(i);
|
||||
}
|
||||
|
||||
synchronized ColorStateList getTintList(Context context, int i) {
|
||||
ColorStateList tintListFromCache;
|
||||
tintListFromCache = getTintListFromCache(context, i);
|
||||
if (tintListFromCache == null) {
|
||||
ResourceManagerHooks resourceManagerHooks = this.mHooks;
|
||||
tintListFromCache = resourceManagerHooks == null ? null : resourceManagerHooks.getTintListForDrawableRes(context, i);
|
||||
if (tintListFromCache != null) {
|
||||
addTintListToCache(context, i, tintListFromCache);
|
||||
}
|
||||
}
|
||||
return tintListFromCache;
|
||||
}
|
||||
|
||||
private ColorStateList getTintListFromCache(Context context, int i) {
|
||||
SparseArrayCompat<ColorStateList> sparseArrayCompat;
|
||||
WeakHashMap<Context, SparseArrayCompat<ColorStateList>> weakHashMap = this.mTintLists;
|
||||
if (weakHashMap == null || (sparseArrayCompat = weakHashMap.get(context)) == null) {
|
||||
return null;
|
||||
}
|
||||
return sparseArrayCompat.get(i);
|
||||
}
|
||||
|
||||
private void addTintListToCache(Context context, int i, ColorStateList colorStateList) {
|
||||
if (this.mTintLists == null) {
|
||||
this.mTintLists = new WeakHashMap<>();
|
||||
}
|
||||
SparseArrayCompat<ColorStateList> sparseArrayCompat = this.mTintLists.get(context);
|
||||
if (sparseArrayCompat == null) {
|
||||
sparseArrayCompat = new SparseArrayCompat<>();
|
||||
this.mTintLists.put(context, sparseArrayCompat);
|
||||
}
|
||||
sparseArrayCompat.append(i, colorStateList);
|
||||
}
|
||||
|
||||
private static class ColorFilterLruCache extends LruCache<Integer, PorterDuffColorFilter> {
|
||||
public ColorFilterLruCache(int i) {
|
||||
super(i);
|
||||
}
|
||||
|
||||
PorterDuffColorFilter get(int i, PorterDuff.Mode mode) {
|
||||
return get(Integer.valueOf(generateCacheKey(i, mode)));
|
||||
}
|
||||
|
||||
PorterDuffColorFilter put(int i, PorterDuff.Mode mode, PorterDuffColorFilter porterDuffColorFilter) {
|
||||
return put(Integer.valueOf(generateCacheKey(i, mode)), porterDuffColorFilter);
|
||||
}
|
||||
|
||||
private static int generateCacheKey(int i, PorterDuff.Mode mode) {
|
||||
return ((i + 31) * 31) + mode.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
static void tintDrawable(Drawable drawable, TintInfo tintInfo, int[] iArr) {
|
||||
int[] state = drawable.getState();
|
||||
if (DrawableUtils.canSafelyMutateDrawable(drawable) && drawable.mutate() != drawable) {
|
||||
Log.d(TAG, "Mutated drawable is not the same instance as the input.");
|
||||
return;
|
||||
}
|
||||
if ((drawable instanceof LayerDrawable) && drawable.isStateful()) {
|
||||
drawable.setState(new int[0]);
|
||||
drawable.setState(state);
|
||||
}
|
||||
if (tintInfo.mHasTintList || tintInfo.mHasTintMode) {
|
||||
drawable.setColorFilter(createTintFilter(tintInfo.mHasTintList ? tintInfo.mTintList : null, tintInfo.mHasTintMode ? tintInfo.mTintMode : DEFAULT_MODE, iArr));
|
||||
} else {
|
||||
drawable.clearColorFilter();
|
||||
}
|
||||
if (Build.VERSION.SDK_INT <= 23) {
|
||||
drawable.invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
private static PorterDuffColorFilter createTintFilter(ColorStateList colorStateList, PorterDuff.Mode mode, int[] iArr) {
|
||||
if (colorStateList == null || mode == null) {
|
||||
return null;
|
||||
}
|
||||
return getPorterDuffColorFilter(colorStateList.getColorForState(iArr, 0), mode);
|
||||
}
|
||||
|
||||
public static synchronized PorterDuffColorFilter getPorterDuffColorFilter(int i, PorterDuff.Mode mode) {
|
||||
PorterDuffColorFilter porterDuffColorFilter;
|
||||
synchronized (ResourceManagerInternal.class) {
|
||||
ColorFilterLruCache colorFilterLruCache = COLOR_FILTER_CACHE;
|
||||
porterDuffColorFilter = colorFilterLruCache.get(i, mode);
|
||||
if (porterDuffColorFilter == null) {
|
||||
porterDuffColorFilter = new PorterDuffColorFilter(i, mode);
|
||||
colorFilterLruCache.put(i, mode, porterDuffColorFilter);
|
||||
}
|
||||
}
|
||||
return porterDuffColorFilter;
|
||||
}
|
||||
|
||||
private void checkVectorDrawableSetup(Context context) {
|
||||
if (this.mHasCheckedVectorDrawableSetup) {
|
||||
return;
|
||||
}
|
||||
this.mHasCheckedVectorDrawableSetup = true;
|
||||
Drawable drawable = getDrawable(context, R.drawable.abc_vector_test);
|
||||
if (drawable == null || !isVectorDrawable(drawable)) {
|
||||
this.mHasCheckedVectorDrawableSetup = false;
|
||||
throw new IllegalStateException("This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat.");
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isVectorDrawable(Drawable drawable) {
|
||||
return (drawable instanceof VectorDrawableCompat) || PLATFORM_VD_CLAZZ.equals(drawable.getClass().getName());
|
||||
}
|
||||
|
||||
private static class VdcInflateDelegate implements InflateDelegate {
|
||||
VdcInflateDelegate() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourceManagerInternal.InflateDelegate
|
||||
public Drawable createFromXmlInner(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class AvdcInflateDelegate implements InflateDelegate {
|
||||
AvdcInflateDelegate() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourceManagerInternal.InflateDelegate
|
||||
public Drawable createFromXmlInner(Context context, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) {
|
||||
try {
|
||||
return AnimatedVectorDrawableCompat.createFromXmlInner(context, context.getResources(), xmlPullParser, attributeSet, theme);
|
||||
} catch (Exception e) {
|
||||
Log.e("AvdcInflateDelegate", "Exception while inflating <animated-vector>", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class AsldcInflateDelegate implements InflateDelegate {
|
||||
AsldcInflateDelegate() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourceManagerInternal.InflateDelegate
|
||||
public Drawable createFromXmlInner(Context context, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) {
|
||||
try {
|
||||
return AnimatedStateListDrawableCompat.createFromXmlInner(context, context.getResources(), xmlPullParser, attributeSet, theme);
|
||||
} catch (Exception e) {
|
||||
Log.e("AsldcInflateDelegate", "Exception while inflating <animated-selector>", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class DrawableDelegate implements InflateDelegate {
|
||||
DrawableDelegate() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourceManagerInternal.InflateDelegate
|
||||
public Drawable createFromXmlInner(Context context, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) {
|
||||
String classAttribute = attributeSet.getClassAttribute();
|
||||
if (classAttribute != null) {
|
||||
try {
|
||||
Drawable drawable = (Drawable) DrawableDelegate.class.getClassLoader().loadClass(classAttribute).asSubclass(Drawable.class).getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
|
||||
Compatibility.Api21Impl.inflate(drawable, context.getResources(), xmlPullParser, attributeSet, theme);
|
||||
return drawable;
|
||||
} catch (Exception e) {
|
||||
Log.e("DrawableDelegate", "Exception while inflating <drawable>", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
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 androidx.appcompat.resources.Compatibility;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ResourcesWrapper extends Resources {
|
||||
private final Resources mResources;
|
||||
|
||||
public ResourcesWrapper(Resources resources) {
|
||||
super(resources.getAssets(), resources.getDisplayMetrics(), resources.getConfiguration());
|
||||
this.mResources = resources;
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public CharSequence getText(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getText(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public CharSequence getQuantityText(int i, int i2) throws Resources.NotFoundException {
|
||||
return this.mResources.getQuantityText(i, i2);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String getString(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getString(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String getString(int i, Object... objArr) throws Resources.NotFoundException {
|
||||
return this.mResources.getString(i, objArr);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String getQuantityString(int i, int i2, Object... objArr) throws Resources.NotFoundException {
|
||||
return this.mResources.getQuantityString(i, i2, objArr);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String getQuantityString(int i, int i2) throws Resources.NotFoundException {
|
||||
return this.mResources.getQuantityString(i, i2);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public CharSequence getText(int i, CharSequence charSequence) {
|
||||
return this.mResources.getText(i, charSequence);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public CharSequence[] getTextArray(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getTextArray(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String[] getStringArray(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getStringArray(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public int[] getIntArray(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getIntArray(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public TypedArray obtainTypedArray(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.obtainTypedArray(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public float getDimension(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getDimension(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public int getDimensionPixelOffset(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getDimensionPixelOffset(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public int getDimensionPixelSize(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getDimensionPixelSize(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public float getFraction(int i, int i2, int i3) {
|
||||
return this.mResources.getFraction(i, i2, i3);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public Drawable getDrawable(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getDrawable(i);
|
||||
}
|
||||
|
||||
final Drawable getDrawableCanonical(int i) throws Resources.NotFoundException {
|
||||
return super.getDrawable(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public Drawable getDrawable(int i, Resources.Theme theme) throws Resources.NotFoundException {
|
||||
return ResourcesCompat.getDrawable(this.mResources, i, theme);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public Drawable getDrawableForDensity(int i, int i2) throws Resources.NotFoundException {
|
||||
return ResourcesCompat.getDrawableForDensity(this.mResources, i, i2, null);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public Drawable getDrawableForDensity(int i, int i2, Resources.Theme theme) {
|
||||
return ResourcesCompat.getDrawableForDensity(this.mResources, i, i2, theme);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public Movie getMovie(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getMovie(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public int getColor(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getColor(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public ColorStateList getColorStateList(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getColorStateList(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public boolean getBoolean(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getBoolean(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public int getInteger(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getInteger(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public XmlResourceParser getLayout(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getLayout(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public XmlResourceParser getAnimation(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getAnimation(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public XmlResourceParser getXml(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getXml(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public InputStream openRawResource(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.openRawResource(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public InputStream openRawResource(int i, TypedValue typedValue) throws Resources.NotFoundException {
|
||||
return this.mResources.openRawResource(i, typedValue);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public AssetFileDescriptor openRawResourceFd(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.openRawResourceFd(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public void getValue(int i, TypedValue typedValue, boolean z) throws Resources.NotFoundException {
|
||||
this.mResources.getValue(i, typedValue, z);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public void getValueForDensity(int i, int i2, TypedValue typedValue, boolean z) throws Resources.NotFoundException {
|
||||
Compatibility.Api15Impl.getValueForDensity(this.mResources, i, i2, typedValue, z);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public void getValue(String str, TypedValue typedValue, boolean z) throws Resources.NotFoundException {
|
||||
this.mResources.getValue(str, typedValue, z);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public TypedArray obtainAttributes(AttributeSet attributeSet, int[] iArr) {
|
||||
return this.mResources.obtainAttributes(attributeSet, iArr);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public void updateConfiguration(Configuration configuration, DisplayMetrics displayMetrics) {
|
||||
super.updateConfiguration(configuration, displayMetrics);
|
||||
Resources resources = this.mResources;
|
||||
if (resources != null) {
|
||||
resources.updateConfiguration(configuration, displayMetrics);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public DisplayMetrics getDisplayMetrics() {
|
||||
return this.mResources.getDisplayMetrics();
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public Configuration getConfiguration() {
|
||||
return this.mResources.getConfiguration();
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public int getIdentifier(String str, String str2, String str3) {
|
||||
return this.mResources.getIdentifier(str, str2, str3);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String getResourceName(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getResourceName(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String getResourcePackageName(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getResourcePackageName(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String getResourceTypeName(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getResourceTypeName(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public String getResourceEntryName(int i) throws Resources.NotFoundException {
|
||||
return this.mResources.getResourceEntryName(i);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public void parseBundleExtras(XmlResourceParser xmlResourceParser, Bundle bundle) throws XmlPullParserException, IOException {
|
||||
this.mResources.parseBundleExtras(xmlResourceParser, bundle);
|
||||
}
|
||||
|
||||
@Override // android.content.res.Resources
|
||||
public void parseBundleExtra(String str, AttributeSet attributeSet, Bundle bundle) throws XmlPullParserException {
|
||||
this.mResources.parseBundleExtra(str, attributeSet, bundle);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class RtlSpacingHelper {
|
||||
public static final int UNDEFINED = Integer.MIN_VALUE;
|
||||
private int mLeft = 0;
|
||||
private int mRight = 0;
|
||||
private int mStart = Integer.MIN_VALUE;
|
||||
private int mEnd = Integer.MIN_VALUE;
|
||||
private int mExplicitLeft = 0;
|
||||
private int mExplicitRight = 0;
|
||||
private boolean mIsRtl = false;
|
||||
private boolean mIsRelative = false;
|
||||
|
||||
public int getEnd() {
|
||||
return this.mIsRtl ? this.mLeft : this.mRight;
|
||||
}
|
||||
|
||||
public int getLeft() {
|
||||
return this.mLeft;
|
||||
}
|
||||
|
||||
public int getRight() {
|
||||
return this.mRight;
|
||||
}
|
||||
|
||||
public int getStart() {
|
||||
return this.mIsRtl ? this.mRight : this.mLeft;
|
||||
}
|
||||
|
||||
public void setAbsolute(int i, int i2) {
|
||||
this.mIsRelative = false;
|
||||
if (i != Integer.MIN_VALUE) {
|
||||
this.mExplicitLeft = i;
|
||||
this.mLeft = i;
|
||||
}
|
||||
if (i2 != Integer.MIN_VALUE) {
|
||||
this.mExplicitRight = i2;
|
||||
this.mRight = i2;
|
||||
}
|
||||
}
|
||||
|
||||
public void setDirection(boolean z) {
|
||||
if (z == this.mIsRtl) {
|
||||
return;
|
||||
}
|
||||
this.mIsRtl = z;
|
||||
if (!this.mIsRelative) {
|
||||
this.mLeft = this.mExplicitLeft;
|
||||
this.mRight = this.mExplicitRight;
|
||||
return;
|
||||
}
|
||||
if (z) {
|
||||
int i = this.mEnd;
|
||||
if (i == Integer.MIN_VALUE) {
|
||||
i = this.mExplicitLeft;
|
||||
}
|
||||
this.mLeft = i;
|
||||
int i2 = this.mStart;
|
||||
if (i2 == Integer.MIN_VALUE) {
|
||||
i2 = this.mExplicitRight;
|
||||
}
|
||||
this.mRight = i2;
|
||||
return;
|
||||
}
|
||||
int i3 = this.mStart;
|
||||
if (i3 == Integer.MIN_VALUE) {
|
||||
i3 = this.mExplicitLeft;
|
||||
}
|
||||
this.mLeft = i3;
|
||||
int i4 = this.mEnd;
|
||||
if (i4 == Integer.MIN_VALUE) {
|
||||
i4 = this.mExplicitRight;
|
||||
}
|
||||
this.mRight = i4;
|
||||
}
|
||||
|
||||
public void setRelative(int i, int i2) {
|
||||
this.mStart = i;
|
||||
this.mEnd = i2;
|
||||
this.mIsRelative = true;
|
||||
if (this.mIsRtl) {
|
||||
if (i2 != Integer.MIN_VALUE) {
|
||||
this.mLeft = i2;
|
||||
}
|
||||
if (i != Integer.MIN_VALUE) {
|
||||
this.mRight = i;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (i != Integer.MIN_VALUE) {
|
||||
this.mLeft = i;
|
||||
}
|
||||
if (i2 != Integer.MIN_VALUE) {
|
||||
this.mRight = i2;
|
||||
}
|
||||
}
|
||||
|
||||
RtlSpacingHelper() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,546 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
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.ViewPropertyAnimator;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.Interpolator;
|
||||
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;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.view.ActionBarPolicy;
|
||||
import androidx.appcompat.widget.LinearLayoutCompat;
|
||||
import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ScrollingTabContainerView extends HorizontalScrollView implements AdapterView.OnItemSelectedListener {
|
||||
private static final int FADE_DURATION = 200;
|
||||
private static final String TAG = "ScrollingTabContainerView";
|
||||
private static final Interpolator sAlphaInterpolator = new DecelerateInterpolator();
|
||||
private boolean mAllowCollapse;
|
||||
private int mContentHeight;
|
||||
int mMaxTabWidth;
|
||||
private int mSelectedTabIndex;
|
||||
int mStackedTabMaxWidth;
|
||||
private TabClickListener mTabClickListener;
|
||||
LinearLayoutCompat mTabLayout;
|
||||
Runnable mTabSelector;
|
||||
private Spinner mTabSpinner;
|
||||
protected final VisibilityAnimListener mVisAnimListener;
|
||||
protected ViewPropertyAnimator mVisibilityAnim;
|
||||
|
||||
@Override // android.widget.AdapterView.OnItemSelectedListener
|
||||
public void onNothingSelected(AdapterView<?> adapterView) {
|
||||
}
|
||||
|
||||
public void setAllowCollapse(boolean z) {
|
||||
this.mAllowCollapse = z;
|
||||
}
|
||||
|
||||
public ScrollingTabContainerView(Context context) {
|
||||
super(context);
|
||||
this.mVisAnimListener = new VisibilityAnimListener();
|
||||
setHorizontalScrollBarEnabled(false);
|
||||
ActionBarPolicy actionBarPolicy = ActionBarPolicy.get(context);
|
||||
setContentHeight(actionBarPolicy.getTabContainerHeight());
|
||||
this.mStackedTabMaxWidth = actionBarPolicy.getStackedTabMaxWidth();
|
||||
LinearLayoutCompat createTabLayout = createTabLayout();
|
||||
this.mTabLayout = createTabLayout;
|
||||
addView(createTabLayout, new ViewGroup.LayoutParams(-2, -1));
|
||||
}
|
||||
|
||||
@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.mTabLayout.getChildCount();
|
||||
if (childCount <= 1 || !(mode == 1073741824 || mode == Integer.MIN_VALUE)) {
|
||||
this.mMaxTabWidth = -1;
|
||||
} else {
|
||||
if (childCount > 2) {
|
||||
this.mMaxTabWidth = (int) (View.MeasureSpec.getSize(i) * 0.4f);
|
||||
} else {
|
||||
this.mMaxTabWidth = View.MeasureSpec.getSize(i) / 2;
|
||||
}
|
||||
this.mMaxTabWidth = Math.min(this.mMaxTabWidth, this.mStackedTabMaxWidth);
|
||||
}
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(this.mContentHeight, BasicMeasure.EXACTLY);
|
||||
if (!z && this.mAllowCollapse) {
|
||||
this.mTabLayout.measure(0, makeMeasureSpec);
|
||||
if (this.mTabLayout.getMeasuredWidth() > View.MeasureSpec.getSize(i)) {
|
||||
performCollapse();
|
||||
} else {
|
||||
performExpand();
|
||||
}
|
||||
} else {
|
||||
performExpand();
|
||||
}
|
||||
int measuredWidth = getMeasuredWidth();
|
||||
super.onMeasure(i, makeMeasureSpec);
|
||||
int measuredWidth2 = getMeasuredWidth();
|
||||
if (!z || measuredWidth == measuredWidth2) {
|
||||
return;
|
||||
}
|
||||
setTabSelected(this.mSelectedTabIndex);
|
||||
}
|
||||
|
||||
private boolean isCollapsed() {
|
||||
Spinner spinner = this.mTabSpinner;
|
||||
return spinner != null && spinner.getParent() == this;
|
||||
}
|
||||
|
||||
private void performCollapse() {
|
||||
if (isCollapsed()) {
|
||||
return;
|
||||
}
|
||||
if (this.mTabSpinner == null) {
|
||||
this.mTabSpinner = createSpinner();
|
||||
}
|
||||
removeView(this.mTabLayout);
|
||||
addView(this.mTabSpinner, new ViewGroup.LayoutParams(-2, -1));
|
||||
if (this.mTabSpinner.getAdapter() == null) {
|
||||
this.mTabSpinner.setAdapter((SpinnerAdapter) new TabAdapter());
|
||||
}
|
||||
Runnable runnable = this.mTabSelector;
|
||||
if (runnable != null) {
|
||||
removeCallbacks(runnable);
|
||||
this.mTabSelector = null;
|
||||
}
|
||||
this.mTabSpinner.setSelection(this.mSelectedTabIndex);
|
||||
}
|
||||
|
||||
private boolean performExpand() {
|
||||
if (!isCollapsed()) {
|
||||
return false;
|
||||
}
|
||||
removeView(this.mTabSpinner);
|
||||
addView(this.mTabLayout, new ViewGroup.LayoutParams(-2, -1));
|
||||
setTabSelected(this.mTabSpinner.getSelectedItemPosition());
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setTabSelected(int i) {
|
||||
this.mSelectedTabIndex = i;
|
||||
int childCount = this.mTabLayout.getChildCount();
|
||||
int i2 = 0;
|
||||
while (i2 < childCount) {
|
||||
View childAt = this.mTabLayout.getChildAt(i2);
|
||||
boolean z = i2 == i;
|
||||
childAt.setSelected(z);
|
||||
if (z) {
|
||||
animateToTab(i);
|
||||
}
|
||||
i2++;
|
||||
}
|
||||
Spinner spinner = this.mTabSpinner;
|
||||
if (spinner == null || i < 0) {
|
||||
return;
|
||||
}
|
||||
spinner.setSelection(i);
|
||||
}
|
||||
|
||||
public void setContentHeight(int i) {
|
||||
this.mContentHeight = i;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
private LinearLayoutCompat createTabLayout() {
|
||||
LinearLayoutCompat linearLayoutCompat = new LinearLayoutCompat(getContext(), null, R.attr.actionBarTabBarStyle);
|
||||
linearLayoutCompat.setMeasureWithLargestChildEnabled(true);
|
||||
linearLayoutCompat.setGravity(17);
|
||||
linearLayoutCompat.setLayoutParams(new LinearLayoutCompat.LayoutParams(-2, -1));
|
||||
return linearLayoutCompat;
|
||||
}
|
||||
|
||||
private Spinner createSpinner() {
|
||||
AppCompatSpinner appCompatSpinner = new AppCompatSpinner(getContext(), null, R.attr.actionDropDownStyle);
|
||||
appCompatSpinner.setLayoutParams(new LinearLayoutCompat.LayoutParams(-2, -1));
|
||||
appCompatSpinner.setOnItemSelectedListener(this);
|
||||
return appCompatSpinner;
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onConfigurationChanged(Configuration configuration) {
|
||||
super.onConfigurationChanged(configuration);
|
||||
ActionBarPolicy actionBarPolicy = ActionBarPolicy.get(getContext());
|
||||
setContentHeight(actionBarPolicy.getTabContainerHeight());
|
||||
this.mStackedTabMaxWidth = actionBarPolicy.getStackedTabMaxWidth();
|
||||
}
|
||||
|
||||
public void animateToVisibility(int i) {
|
||||
ViewPropertyAnimator viewPropertyAnimator = this.mVisibilityAnim;
|
||||
if (viewPropertyAnimator != null) {
|
||||
viewPropertyAnimator.cancel();
|
||||
}
|
||||
if (i == 0) {
|
||||
if (getVisibility() != 0) {
|
||||
setAlpha(0.0f);
|
||||
}
|
||||
ViewPropertyAnimator alpha = animate().alpha(1.0f);
|
||||
alpha.setDuration(200L);
|
||||
alpha.setInterpolator(sAlphaInterpolator);
|
||||
alpha.setListener(this.mVisAnimListener.withFinalVisibility(alpha, i));
|
||||
alpha.start();
|
||||
return;
|
||||
}
|
||||
ViewPropertyAnimator alpha2 = animate().alpha(0.0f);
|
||||
alpha2.setDuration(200L);
|
||||
alpha2.setInterpolator(sAlphaInterpolator);
|
||||
alpha2.setListener(this.mVisAnimListener.withFinalVisibility(alpha2, i));
|
||||
alpha2.start();
|
||||
}
|
||||
|
||||
public void animateToTab(int i) {
|
||||
final View childAt = this.mTabLayout.getChildAt(i);
|
||||
Runnable runnable = this.mTabSelector;
|
||||
if (runnable != null) {
|
||||
removeCallbacks(runnable);
|
||||
}
|
||||
Runnable runnable2 = 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.mTabSelector = null;
|
||||
}
|
||||
};
|
||||
this.mTabSelector = runnable2;
|
||||
post(runnable2);
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
public void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
Runnable runnable = this.mTabSelector;
|
||||
if (runnable != null) {
|
||||
post(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
Runnable runnable = this.mTabSelector;
|
||||
if (runnable != null) {
|
||||
removeCallbacks(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
TabView createTabView(ActionBar.Tab tab, boolean z) {
|
||||
TabView tabView = new TabView(getContext(), tab, z);
|
||||
if (z) {
|
||||
tabView.setBackgroundDrawable(null);
|
||||
tabView.setLayoutParams(new AbsListView.LayoutParams(-1, this.mContentHeight));
|
||||
} else {
|
||||
tabView.setFocusable(true);
|
||||
if (this.mTabClickListener == null) {
|
||||
this.mTabClickListener = new TabClickListener();
|
||||
}
|
||||
tabView.setOnClickListener(this.mTabClickListener);
|
||||
}
|
||||
return tabView;
|
||||
}
|
||||
|
||||
public void addTab(ActionBar.Tab tab, boolean z) {
|
||||
TabView createTabView = createTabView(tab, false);
|
||||
this.mTabLayout.addView(createTabView, new LinearLayoutCompat.LayoutParams(0, -1, 1.0f));
|
||||
Spinner spinner = this.mTabSpinner;
|
||||
if (spinner != null) {
|
||||
((TabAdapter) spinner.getAdapter()).notifyDataSetChanged();
|
||||
}
|
||||
if (z) {
|
||||
createTabView.setSelected(true);
|
||||
}
|
||||
if (this.mAllowCollapse) {
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void addTab(ActionBar.Tab tab, int i, boolean z) {
|
||||
TabView createTabView = createTabView(tab, false);
|
||||
this.mTabLayout.addView(createTabView, i, new LinearLayoutCompat.LayoutParams(0, -1, 1.0f));
|
||||
Spinner spinner = this.mTabSpinner;
|
||||
if (spinner != null) {
|
||||
((TabAdapter) spinner.getAdapter()).notifyDataSetChanged();
|
||||
}
|
||||
if (z) {
|
||||
createTabView.setSelected(true);
|
||||
}
|
||||
if (this.mAllowCollapse) {
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateTab(int i) {
|
||||
((TabView) this.mTabLayout.getChildAt(i)).update();
|
||||
Spinner spinner = this.mTabSpinner;
|
||||
if (spinner != null) {
|
||||
((TabAdapter) spinner.getAdapter()).notifyDataSetChanged();
|
||||
}
|
||||
if (this.mAllowCollapse) {
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeTabAt(int i) {
|
||||
this.mTabLayout.removeViewAt(i);
|
||||
Spinner spinner = this.mTabSpinner;
|
||||
if (spinner != null) {
|
||||
((TabAdapter) spinner.getAdapter()).notifyDataSetChanged();
|
||||
}
|
||||
if (this.mAllowCollapse) {
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAllTabs() {
|
||||
this.mTabLayout.removeAllViews();
|
||||
Spinner spinner = this.mTabSpinner;
|
||||
if (spinner != null) {
|
||||
((TabAdapter) spinner.getAdapter()).notifyDataSetChanged();
|
||||
}
|
||||
if (this.mAllowCollapse) {
|
||||
requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.widget.AdapterView.OnItemSelectedListener
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
|
||||
((TabView) view).getTab().select();
|
||||
}
|
||||
|
||||
private class TabView extends LinearLayout {
|
||||
private static final String ACCESSIBILITY_CLASS_NAME = "androidx.appcompat.app.ActionBar$Tab";
|
||||
private final int[] BG_ATTRS;
|
||||
private View mCustomView;
|
||||
private ImageView mIconView;
|
||||
private ActionBar.Tab mTab;
|
||||
private TextView mTextView;
|
||||
|
||||
public ActionBar.Tab getTab() {
|
||||
return this.mTab;
|
||||
}
|
||||
|
||||
public TabView(Context context, ActionBar.Tab tab, boolean z) {
|
||||
super(context, null, R.attr.actionBarTabStyle);
|
||||
int[] iArr = {android.R.attr.background};
|
||||
this.BG_ATTRS = iArr;
|
||||
this.mTab = tab;
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, null, iArr, R.attr.actionBarTabStyle, 0);
|
||||
if (obtainStyledAttributes.hasValue(0)) {
|
||||
setBackgroundDrawable(obtainStyledAttributes.getDrawable(0));
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
if (z) {
|
||||
setGravity(8388627);
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
public void bindTab(ActionBar.Tab tab) {
|
||||
this.mTab = tab;
|
||||
update();
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setSelected(boolean z) {
|
||||
boolean z2 = isSelected() != z;
|
||||
super.setSelected(z);
|
||||
if (z2 && z) {
|
||||
sendAccessibilityEvent(4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
|
||||
super.onInitializeAccessibilityEvent(accessibilityEvent);
|
||||
accessibilityEvent.setClassName(ACCESSIBILITY_CLASS_NAME);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
|
||||
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
|
||||
accessibilityNodeInfo.setClassName(ACCESSIBILITY_CLASS_NAME);
|
||||
}
|
||||
|
||||
@Override // android.widget.LinearLayout, android.view.View
|
||||
public void onMeasure(int i, int i2) {
|
||||
super.onMeasure(i, i2);
|
||||
if (ScrollingTabContainerView.this.mMaxTabWidth <= 0 || getMeasuredWidth() <= ScrollingTabContainerView.this.mMaxTabWidth) {
|
||||
return;
|
||||
}
|
||||
super.onMeasure(View.MeasureSpec.makeMeasureSpec(ScrollingTabContainerView.this.mMaxTabWidth, BasicMeasure.EXACTLY), i2);
|
||||
}
|
||||
|
||||
public void update() {
|
||||
ActionBar.Tab tab = this.mTab;
|
||||
View customView = tab.getCustomView();
|
||||
if (customView != null) {
|
||||
ViewParent parent = customView.getParent();
|
||||
if (parent != this) {
|
||||
if (parent != null) {
|
||||
((ViewGroup) parent).removeView(customView);
|
||||
}
|
||||
addView(customView);
|
||||
}
|
||||
this.mCustomView = customView;
|
||||
TextView textView = this.mTextView;
|
||||
if (textView != null) {
|
||||
textView.setVisibility(8);
|
||||
}
|
||||
ImageView imageView = this.mIconView;
|
||||
if (imageView != null) {
|
||||
imageView.setVisibility(8);
|
||||
this.mIconView.setImageDrawable(null);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
View view = this.mCustomView;
|
||||
if (view != null) {
|
||||
removeView(view);
|
||||
this.mCustomView = null;
|
||||
}
|
||||
Drawable icon = tab.getIcon();
|
||||
CharSequence text = tab.getText();
|
||||
if (icon != null) {
|
||||
if (this.mIconView == null) {
|
||||
AppCompatImageView appCompatImageView = new AppCompatImageView(getContext());
|
||||
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
|
||||
layoutParams.gravity = 16;
|
||||
appCompatImageView.setLayoutParams(layoutParams);
|
||||
addView(appCompatImageView, 0);
|
||||
this.mIconView = appCompatImageView;
|
||||
}
|
||||
this.mIconView.setImageDrawable(icon);
|
||||
this.mIconView.setVisibility(0);
|
||||
} else {
|
||||
ImageView imageView2 = this.mIconView;
|
||||
if (imageView2 != null) {
|
||||
imageView2.setVisibility(8);
|
||||
this.mIconView.setImageDrawable(null);
|
||||
}
|
||||
}
|
||||
boolean z = !TextUtils.isEmpty(text);
|
||||
if (z) {
|
||||
if (this.mTextView == 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.mTextView = appCompatTextView;
|
||||
}
|
||||
this.mTextView.setText(text);
|
||||
this.mTextView.setVisibility(0);
|
||||
} else {
|
||||
TextView textView2 = this.mTextView;
|
||||
if (textView2 != null) {
|
||||
textView2.setVisibility(8);
|
||||
this.mTextView.setText((CharSequence) null);
|
||||
}
|
||||
}
|
||||
ImageView imageView3 = this.mIconView;
|
||||
if (imageView3 != null) {
|
||||
imageView3.setContentDescription(tab.getContentDescription());
|
||||
}
|
||||
TooltipCompat.setTooltipText(this, z ? null : tab.getContentDescription());
|
||||
}
|
||||
}
|
||||
|
||||
private class TabAdapter extends BaseAdapter {
|
||||
@Override // android.widget.Adapter
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
TabAdapter() {
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public int getCount() {
|
||||
return ScrollingTabContainerView.this.mTabLayout.getChildCount();
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public Object getItem(int i) {
|
||||
return ((TabView) ScrollingTabContainerView.this.mTabLayout.getChildAt(i)).getTab();
|
||||
}
|
||||
|
||||
@Override // android.widget.Adapter
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
if (view == null) {
|
||||
return ScrollingTabContainerView.this.createTabView((ActionBar.Tab) getItem(i), true);
|
||||
}
|
||||
((TabView) view).bindTab((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).getTab().select();
|
||||
int childCount = ScrollingTabContainerView.this.mTabLayout.getChildCount();
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View childAt = ScrollingTabContainerView.this.mTabLayout.getChildAt(i);
|
||||
childAt.setSelected(childAt == view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected class VisibilityAnimListener extends AnimatorListenerAdapter {
|
||||
private boolean mCanceled = false;
|
||||
private int mFinalVisibility;
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationCancel(Animator animator) {
|
||||
this.mCanceled = true;
|
||||
}
|
||||
|
||||
protected VisibilityAnimListener() {
|
||||
}
|
||||
|
||||
public VisibilityAnimListener withFinalVisibility(ViewPropertyAnimator viewPropertyAnimator, int i) {
|
||||
this.mFinalVisibility = i;
|
||||
ScrollingTabContainerView.this.mVisibilityAnim = viewPropertyAnimator;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationStart(Animator animator) {
|
||||
ScrollingTabContainerView.this.setVisibility(0);
|
||||
this.mCanceled = false;
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
if (this.mCanceled) {
|
||||
return;
|
||||
}
|
||||
ScrollingTabContainerView.this.mVisibilityAnim = null;
|
||||
ScrollingTabContainerView.this.setVisibility(this.mFinalVisibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
1395
02-Easy5/E5/sources/androidx/appcompat/widget/SearchView.java
Normal file
1395
02-Easy5/E5/sources/androidx/appcompat/widget/SearchView.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,145 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.util.TypedValue;
|
||||
import android.view.MenuItem;
|
||||
import android.view.SubMenu;
|
||||
import android.view.View;
|
||||
import androidx.appcompat.R;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.appcompat.widget.ActivityChooserModel;
|
||||
import androidx.core.view.ActionProvider;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ShareActionProvider extends ActionProvider {
|
||||
private static final int DEFAULT_INITIAL_ACTIVITY_COUNT = 4;
|
||||
public static final String DEFAULT_SHARE_HISTORY_FILE_NAME = "share_history.xml";
|
||||
final Context mContext;
|
||||
private int mMaxShownActivityCount;
|
||||
private ActivityChooserModel.OnChooseActivityListener mOnChooseActivityListener;
|
||||
private final ShareMenuItemOnMenuItemClickListener mOnMenuItemClickListener;
|
||||
OnShareTargetSelectedListener mOnShareTargetSelectedListener;
|
||||
String mShareHistoryFileName;
|
||||
|
||||
public interface OnShareTargetSelectedListener {
|
||||
boolean onShareTargetSelected(ShareActionProvider shareActionProvider, Intent intent);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ActionProvider
|
||||
public boolean hasSubMenu() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public ShareActionProvider(Context context) {
|
||||
super(context);
|
||||
this.mMaxShownActivityCount = 4;
|
||||
this.mOnMenuItemClickListener = new ShareMenuItemOnMenuItemClickListener();
|
||||
this.mShareHistoryFileName = DEFAULT_SHARE_HISTORY_FILE_NAME;
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
public void setOnShareTargetSelectedListener(OnShareTargetSelectedListener onShareTargetSelectedListener) {
|
||||
this.mOnShareTargetSelectedListener = onShareTargetSelectedListener;
|
||||
setActivityChooserPolicyIfNeeded();
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ActionProvider
|
||||
public View onCreateActionView() {
|
||||
ActivityChooserView activityChooserView = new ActivityChooserView(this.mContext);
|
||||
if (!activityChooserView.isInEditMode()) {
|
||||
activityChooserView.setActivityChooserModel(ActivityChooserModel.get(this.mContext, this.mShareHistoryFileName));
|
||||
}
|
||||
TypedValue typedValue = new TypedValue();
|
||||
this.mContext.getTheme().resolveAttribute(R.attr.actionModeShareDrawable, typedValue, true);
|
||||
activityChooserView.setExpandActivityOverflowButtonDrawable(AppCompatResources.getDrawable(this.mContext, typedValue.resourceId));
|
||||
activityChooserView.setProvider(this);
|
||||
activityChooserView.setDefaultActionButtonContentDescription(R.string.abc_shareactionprovider_share_with_application);
|
||||
activityChooserView.setExpandActivityOverflowButtonContentDescription(R.string.abc_shareactionprovider_share_with);
|
||||
return activityChooserView;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ActionProvider
|
||||
public void onPrepareSubMenu(SubMenu subMenu) {
|
||||
subMenu.clear();
|
||||
ActivityChooserModel activityChooserModel = ActivityChooserModel.get(this.mContext, this.mShareHistoryFileName);
|
||||
PackageManager packageManager = this.mContext.getPackageManager();
|
||||
int activityCount = activityChooserModel.getActivityCount();
|
||||
int min = Math.min(activityCount, this.mMaxShownActivityCount);
|
||||
for (int i = 0; i < min; i++) {
|
||||
ResolveInfo activity = activityChooserModel.getActivity(i);
|
||||
subMenu.add(0, i, i, activity.loadLabel(packageManager)).setIcon(activity.loadIcon(packageManager)).setOnMenuItemClickListener(this.mOnMenuItemClickListener);
|
||||
}
|
||||
if (min < activityCount) {
|
||||
SubMenu addSubMenu = subMenu.addSubMenu(0, min, min, this.mContext.getString(R.string.abc_activity_chooser_view_see_all));
|
||||
for (int i2 = 0; i2 < activityCount; i2++) {
|
||||
ResolveInfo activity2 = activityChooserModel.getActivity(i2);
|
||||
addSubMenu.add(0, i2, i2, activity2.loadLabel(packageManager)).setIcon(activity2.loadIcon(packageManager)).setOnMenuItemClickListener(this.mOnMenuItemClickListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setShareHistoryFileName(String str) {
|
||||
this.mShareHistoryFileName = str;
|
||||
setActivityChooserPolicyIfNeeded();
|
||||
}
|
||||
|
||||
public void setShareIntent(Intent intent) {
|
||||
if (intent != null) {
|
||||
String action = intent.getAction();
|
||||
if ("android.intent.action.SEND".equals(action) || "android.intent.action.SEND_MULTIPLE".equals(action)) {
|
||||
updateIntent(intent);
|
||||
}
|
||||
}
|
||||
ActivityChooserModel.get(this.mContext, this.mShareHistoryFileName).setIntent(intent);
|
||||
}
|
||||
|
||||
private class ShareMenuItemOnMenuItemClickListener implements MenuItem.OnMenuItemClickListener {
|
||||
ShareMenuItemOnMenuItemClickListener() {
|
||||
}
|
||||
|
||||
@Override // android.view.MenuItem.OnMenuItemClickListener
|
||||
public boolean onMenuItemClick(MenuItem menuItem) {
|
||||
Intent chooseActivity = ActivityChooserModel.get(ShareActionProvider.this.mContext, ShareActionProvider.this.mShareHistoryFileName).chooseActivity(menuItem.getItemId());
|
||||
if (chooseActivity == null) {
|
||||
return true;
|
||||
}
|
||||
String action = chooseActivity.getAction();
|
||||
if ("android.intent.action.SEND".equals(action) || "android.intent.action.SEND_MULTIPLE".equals(action)) {
|
||||
ShareActionProvider.this.updateIntent(chooseActivity);
|
||||
}
|
||||
ShareActionProvider.this.mContext.startActivity(chooseActivity);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void setActivityChooserPolicyIfNeeded() {
|
||||
if (this.mOnShareTargetSelectedListener == null) {
|
||||
return;
|
||||
}
|
||||
if (this.mOnChooseActivityListener == null) {
|
||||
this.mOnChooseActivityListener = new ShareActivityChooserModelPolicy();
|
||||
}
|
||||
ActivityChooserModel.get(this.mContext, this.mShareHistoryFileName).setOnChooseActivityListener(this.mOnChooseActivityListener);
|
||||
}
|
||||
|
||||
private class ShareActivityChooserModelPolicy implements ActivityChooserModel.OnChooseActivityListener {
|
||||
ShareActivityChooserModelPolicy() {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ActivityChooserModel.OnChooseActivityListener
|
||||
public boolean onChooseActivity(ActivityChooserModel activityChooserModel, Intent intent) {
|
||||
if (ShareActionProvider.this.mOnShareTargetSelectedListener == null) {
|
||||
return false;
|
||||
}
|
||||
ShareActionProvider.this.mOnShareTargetSelectedListener.onShareTargetSelected(ShareActionProvider.this, intent);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void updateIntent(Intent intent) {
|
||||
intent.addFlags(134742016);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,507 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
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;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.cursoradapter.widget.ResourceCursorAdapter;
|
||||
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 static final boolean DBG = false;
|
||||
static final int INVALID_INDEX = -1;
|
||||
private static final String LOG_TAG = "SuggestionsAdapter";
|
||||
private static final int QUERY_LIMIT = 50;
|
||||
static final int REFINE_ALL = 2;
|
||||
static final int REFINE_BY_ENTRY = 1;
|
||||
static final int REFINE_NONE = 0;
|
||||
private boolean mClosed;
|
||||
private final int mCommitIconResId;
|
||||
private int mFlagsCol;
|
||||
private int mIconName1Col;
|
||||
private int mIconName2Col;
|
||||
private final WeakHashMap<String, Drawable.ConstantState> mOutsideDrawablesCache;
|
||||
private final Context mProviderContext;
|
||||
private int mQueryRefinement;
|
||||
private final SearchView mSearchView;
|
||||
private final SearchableInfo mSearchable;
|
||||
private int mText1Col;
|
||||
private int mText2Col;
|
||||
private int mText2UrlCol;
|
||||
private ColorStateList mUrlColor;
|
||||
|
||||
public int getQueryRefinement() {
|
||||
return this.mQueryRefinement;
|
||||
}
|
||||
|
||||
@Override // androidx.cursoradapter.widget.CursorAdapter, android.widget.BaseAdapter, android.widget.Adapter
|
||||
public boolean hasStableIds() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setQueryRefinement(int i) {
|
||||
this.mQueryRefinement = i;
|
||||
}
|
||||
|
||||
public SuggestionsAdapter(Context context, SearchView searchView, SearchableInfo searchableInfo, WeakHashMap<String, Drawable.ConstantState> weakHashMap) {
|
||||
super(context, searchView.getSuggestionRowLayout(), (Cursor) null, true);
|
||||
this.mClosed = false;
|
||||
this.mQueryRefinement = 1;
|
||||
this.mText1Col = -1;
|
||||
this.mText2Col = -1;
|
||||
this.mText2UrlCol = -1;
|
||||
this.mIconName1Col = -1;
|
||||
this.mIconName2Col = -1;
|
||||
this.mFlagsCol = -1;
|
||||
this.mSearchView = searchView;
|
||||
this.mSearchable = searchableInfo;
|
||||
this.mCommitIconResId = searchView.getSuggestionCommitIconResId();
|
||||
this.mProviderContext = context;
|
||||
this.mOutsideDrawablesCache = weakHashMap;
|
||||
}
|
||||
|
||||
@Override // androidx.cursoradapter.widget.CursorAdapter, androidx.cursoradapter.widget.CursorFilter.CursorFilterClient
|
||||
public Cursor runQueryOnBackgroundThread(CharSequence charSequence) {
|
||||
String charSequence2 = charSequence == null ? "" : charSequence.toString();
|
||||
if (this.mSearchView.getVisibility() == 0 && this.mSearchView.getWindowVisibility() == 0) {
|
||||
try {
|
||||
Cursor searchManagerSuggestions = getSearchManagerSuggestions(this.mSearchable, charSequence2, 50);
|
||||
if (searchManagerSuggestions != null) {
|
||||
searchManagerSuggestions.getCount();
|
||||
return searchManagerSuggestions;
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
Log.w(LOG_TAG, "Search suggestions query threw an exception.", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
changeCursor(null);
|
||||
this.mClosed = true;
|
||||
}
|
||||
|
||||
@Override // android.widget.BaseAdapter
|
||||
public void notifyDataSetChanged() {
|
||||
super.notifyDataSetChanged();
|
||||
updateSpinnerState(getCursor());
|
||||
}
|
||||
|
||||
@Override // android.widget.BaseAdapter
|
||||
public void notifyDataSetInvalidated() {
|
||||
super.notifyDataSetInvalidated();
|
||||
updateSpinnerState(getCursor());
|
||||
}
|
||||
|
||||
private void updateSpinnerState(Cursor cursor) {
|
||||
Bundle extras = cursor != null ? cursor.getExtras() : null;
|
||||
if (extras != null) {
|
||||
extras.getBoolean("in_progress");
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.cursoradapter.widget.CursorAdapter, androidx.cursoradapter.widget.CursorFilter.CursorFilterClient
|
||||
public void changeCursor(Cursor cursor) {
|
||||
if (this.mClosed) {
|
||||
Log.w(LOG_TAG, "Tried to change cursor after adapter was closed.");
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
try {
|
||||
super.changeCursor(cursor);
|
||||
if (cursor != null) {
|
||||
this.mText1Col = cursor.getColumnIndex("suggest_text_1");
|
||||
this.mText2Col = cursor.getColumnIndex("suggest_text_2");
|
||||
this.mText2UrlCol = cursor.getColumnIndex("suggest_text_2_url");
|
||||
this.mIconName1Col = cursor.getColumnIndex("suggest_icon_1");
|
||||
this.mIconName2Col = cursor.getColumnIndex("suggest_icon_2");
|
||||
this.mFlagsCol = cursor.getColumnIndex("suggest_flags");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(LOG_TAG, "error changing cursor and caching columns", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.cursoradapter.widget.ResourceCursorAdapter, androidx.cursoradapter.widget.CursorAdapter
|
||||
public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
|
||||
View newView = super.newView(context, cursor, viewGroup);
|
||||
newView.setTag(new ChildViewCache(newView));
|
||||
((ImageView) newView.findViewById(R.id.edit_query)).setImageResource(this.mCommitIconResId);
|
||||
return newView;
|
||||
}
|
||||
|
||||
private static final class ChildViewCache {
|
||||
public final ImageView mIcon1;
|
||||
public final ImageView mIcon2;
|
||||
public final ImageView mIconRefine;
|
||||
public final TextView mText1;
|
||||
public final TextView mText2;
|
||||
|
||||
public ChildViewCache(View view) {
|
||||
this.mText1 = (TextView) view.findViewById(android.R.id.text1);
|
||||
this.mText2 = (TextView) view.findViewById(android.R.id.text2);
|
||||
this.mIcon1 = (ImageView) view.findViewById(android.R.id.icon1);
|
||||
this.mIcon2 = (ImageView) view.findViewById(android.R.id.icon2);
|
||||
this.mIconRefine = (ImageView) view.findViewById(R.id.edit_query);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.cursoradapter.widget.CursorAdapter
|
||||
public void bindView(View view, Context context, Cursor cursor) {
|
||||
CharSequence stringOrNull;
|
||||
ChildViewCache childViewCache = (ChildViewCache) view.getTag();
|
||||
int i = this.mFlagsCol;
|
||||
int i2 = i != -1 ? cursor.getInt(i) : 0;
|
||||
if (childViewCache.mText1 != null) {
|
||||
setViewText(childViewCache.mText1, getStringOrNull(cursor, this.mText1Col));
|
||||
}
|
||||
if (childViewCache.mText2 != null) {
|
||||
String stringOrNull2 = getStringOrNull(cursor, this.mText2UrlCol);
|
||||
if (stringOrNull2 != null) {
|
||||
stringOrNull = formatUrl(stringOrNull2);
|
||||
} else {
|
||||
stringOrNull = getStringOrNull(cursor, this.mText2Col);
|
||||
}
|
||||
if (TextUtils.isEmpty(stringOrNull)) {
|
||||
if (childViewCache.mText1 != null) {
|
||||
childViewCache.mText1.setSingleLine(false);
|
||||
childViewCache.mText1.setMaxLines(2);
|
||||
}
|
||||
} else if (childViewCache.mText1 != null) {
|
||||
childViewCache.mText1.setSingleLine(true);
|
||||
childViewCache.mText1.setMaxLines(1);
|
||||
}
|
||||
setViewText(childViewCache.mText2, stringOrNull);
|
||||
}
|
||||
if (childViewCache.mIcon1 != null) {
|
||||
setViewDrawable(childViewCache.mIcon1, getIcon1(cursor), 4);
|
||||
}
|
||||
if (childViewCache.mIcon2 != null) {
|
||||
setViewDrawable(childViewCache.mIcon2, getIcon2(cursor), 8);
|
||||
}
|
||||
int i3 = this.mQueryRefinement;
|
||||
if (i3 == 2 || (i3 == 1 && (i2 & 1) != 0)) {
|
||||
childViewCache.mIconRefine.setVisibility(0);
|
||||
childViewCache.mIconRefine.setTag(childViewCache.mText1.getText());
|
||||
childViewCache.mIconRefine.setOnClickListener(this);
|
||||
return;
|
||||
}
|
||||
childViewCache.mIconRefine.setVisibility(8);
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
Object tag = view.getTag();
|
||||
if (tag instanceof CharSequence) {
|
||||
this.mSearchView.onQueryRefine((CharSequence) tag);
|
||||
}
|
||||
}
|
||||
|
||||
private CharSequence formatUrl(CharSequence charSequence) {
|
||||
if (this.mUrlColor == null) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
this.mProviderContext.getTheme().resolveAttribute(R.attr.textColorSearchUrl, typedValue, true);
|
||||
this.mUrlColor = this.mProviderContext.getResources().getColorStateList(typedValue.resourceId);
|
||||
}
|
||||
SpannableString spannableString = new SpannableString(charSequence);
|
||||
spannableString.setSpan(new TextAppearanceSpan(null, 0, 0, this.mUrlColor, null), 0, charSequence.length(), 33);
|
||||
return spannableString;
|
||||
}
|
||||
|
||||
private void setViewText(TextView textView, CharSequence charSequence) {
|
||||
textView.setText(charSequence);
|
||||
if (TextUtils.isEmpty(charSequence)) {
|
||||
textView.setVisibility(8);
|
||||
} else {
|
||||
textView.setVisibility(0);
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable getIcon1(Cursor cursor) {
|
||||
int i = this.mIconName1Col;
|
||||
if (i == -1) {
|
||||
return null;
|
||||
}
|
||||
Drawable drawableFromResourceValue = getDrawableFromResourceValue(cursor.getString(i));
|
||||
return drawableFromResourceValue != null ? drawableFromResourceValue : getDefaultIcon1();
|
||||
}
|
||||
|
||||
private Drawable getIcon2(Cursor cursor) {
|
||||
int i = this.mIconName2Col;
|
||||
if (i == -1) {
|
||||
return null;
|
||||
}
|
||||
return getDrawableFromResourceValue(cursor.getString(i));
|
||||
}
|
||||
|
||||
private void setViewDrawable(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);
|
||||
}
|
||||
|
||||
@Override // androidx.cursoradapter.widget.CursorAdapter, androidx.cursoradapter.widget.CursorFilter.CursorFilterClient
|
||||
public CharSequence convertToString(Cursor cursor) {
|
||||
String columnString;
|
||||
String columnString2;
|
||||
if (cursor == null) {
|
||||
return null;
|
||||
}
|
||||
String columnString3 = getColumnString(cursor, "suggest_intent_query");
|
||||
if (columnString3 != null) {
|
||||
return columnString3;
|
||||
}
|
||||
if (this.mSearchable.shouldRewriteQueryFromData() && (columnString2 = getColumnString(cursor, "suggest_intent_data")) != null) {
|
||||
return columnString2;
|
||||
}
|
||||
if (!this.mSearchable.shouldRewriteQueryFromText() || (columnString = getColumnString(cursor, "suggest_text_1")) == null) {
|
||||
return null;
|
||||
}
|
||||
return columnString;
|
||||
}
|
||||
|
||||
@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(LOG_TAG, "Search suggestions cursor threw exception.", e);
|
||||
View newView = newView(this.mProviderContext, getCursor(), viewGroup);
|
||||
if (newView != null) {
|
||||
((ChildViewCache) newView.getTag()).mText1.setText(e.toString());
|
||||
}
|
||||
return newView;
|
||||
}
|
||||
}
|
||||
|
||||
@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(LOG_TAG, "Search suggestions cursor threw exception.", e);
|
||||
View newDropDownView = newDropDownView(this.mProviderContext, getCursor(), viewGroup);
|
||||
if (newDropDownView != null) {
|
||||
((ChildViewCache) newDropDownView.getTag()).mText1.setText(e.toString());
|
||||
}
|
||||
return newDropDownView;
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable getDrawableFromResourceValue(String str) {
|
||||
if (str == null || str.isEmpty() || "0".equals(str)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
int parseInt = Integer.parseInt(str);
|
||||
String str2 = "android.resource://" + this.mProviderContext.getPackageName() + "/" + parseInt;
|
||||
Drawable checkIconCache = checkIconCache(str2);
|
||||
if (checkIconCache != null) {
|
||||
return checkIconCache;
|
||||
}
|
||||
Drawable drawable = ContextCompat.getDrawable(this.mProviderContext, parseInt);
|
||||
storeInIconCache(str2, drawable);
|
||||
return drawable;
|
||||
} catch (Resources.NotFoundException unused) {
|
||||
Log.w(LOG_TAG, "Icon resource not found: " + str);
|
||||
return null;
|
||||
} catch (NumberFormatException unused2) {
|
||||
Drawable checkIconCache2 = checkIconCache(str);
|
||||
if (checkIconCache2 != null) {
|
||||
return checkIconCache2;
|
||||
}
|
||||
Drawable drawable2 = getDrawable(Uri.parse(str));
|
||||
storeInIconCache(str, drawable2);
|
||||
return drawable2;
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable getDrawable(Uri uri) {
|
||||
try {
|
||||
if ("android.resource".equals(uri.getScheme())) {
|
||||
try {
|
||||
return getDrawableFromResourceUri(uri);
|
||||
} catch (Resources.NotFoundException unused) {
|
||||
throw new FileNotFoundException("Resource does not exist: " + uri);
|
||||
}
|
||||
}
|
||||
InputStream openInputStream = this.mProviderContext.getContentResolver().openInputStream(uri);
|
||||
if (openInputStream == null) {
|
||||
throw new FileNotFoundException("Failed to open " + uri);
|
||||
}
|
||||
try {
|
||||
return Drawable.createFromStream(openInputStream, null);
|
||||
} finally {
|
||||
try {
|
||||
openInputStream.close();
|
||||
} catch (IOException e) {
|
||||
Log.e(LOG_TAG, "Error closing icon stream for " + uri, e);
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e2) {
|
||||
Log.w(LOG_TAG, "Icon not found: " + uri + ", " + e2.getMessage());
|
||||
return null;
|
||||
}
|
||||
Log.w(LOG_TAG, "Icon not found: " + uri + ", " + e2.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
private Drawable checkIconCache(String str) {
|
||||
Drawable.ConstantState constantState = this.mOutsideDrawablesCache.get(str);
|
||||
if (constantState == null) {
|
||||
return null;
|
||||
}
|
||||
return constantState.newDrawable();
|
||||
}
|
||||
|
||||
private void storeInIconCache(String str, Drawable drawable) {
|
||||
if (drawable != null) {
|
||||
this.mOutsideDrawablesCache.put(str, drawable.getConstantState());
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable getDefaultIcon1() {
|
||||
Drawable activityIconWithCache = getActivityIconWithCache(this.mSearchable.getSearchActivity());
|
||||
return activityIconWithCache != null ? activityIconWithCache : this.mProviderContext.getPackageManager().getDefaultActivityIcon();
|
||||
}
|
||||
|
||||
private Drawable getActivityIconWithCache(ComponentName componentName) {
|
||||
String flattenToShortString = componentName.flattenToShortString();
|
||||
if (this.mOutsideDrawablesCache.containsKey(flattenToShortString)) {
|
||||
Drawable.ConstantState constantState = this.mOutsideDrawablesCache.get(flattenToShortString);
|
||||
if (constantState == null) {
|
||||
return null;
|
||||
}
|
||||
return constantState.newDrawable(this.mProviderContext.getResources());
|
||||
}
|
||||
Drawable activityIcon = getActivityIcon(componentName);
|
||||
this.mOutsideDrawablesCache.put(flattenToShortString, activityIcon != null ? activityIcon.getConstantState() : null);
|
||||
return activityIcon;
|
||||
}
|
||||
|
||||
private Drawable getActivityIcon(ComponentName componentName) {
|
||||
PackageManager packageManager = this.mProviderContext.getPackageManager();
|
||||
try {
|
||||
ActivityInfo activityInfo = packageManager.getActivityInfo(componentName, 128);
|
||||
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(LOG_TAG, "Invalid icon resource " + iconResource + " for " + componentName.flattenToShortString());
|
||||
return null;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.w(LOG_TAG, e.toString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getColumnString(Cursor cursor, String str) {
|
||||
return getStringOrNull(cursor, cursor.getColumnIndex(str));
|
||||
}
|
||||
|
||||
private static String getStringOrNull(Cursor cursor, int i) {
|
||||
if (i == -1) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return cursor.getString(i);
|
||||
} catch (Exception e) {
|
||||
Log.e(LOG_TAG, "unexpected error retrieving valid column from cursor, did the remote process die?", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Drawable getDrawableFromResourceUri(Uri uri) throws FileNotFoundException {
|
||||
int parseInt;
|
||||
String authority = uri.getAuthority();
|
||||
if (TextUtils.isEmpty(authority)) {
|
||||
throw new FileNotFoundException("No authority: " + uri);
|
||||
}
|
||||
try {
|
||||
Resources resourcesForApplication = this.mProviderContext.getPackageManager().getResourcesForApplication(authority);
|
||||
List<String> pathSegments = uri.getPathSegments();
|
||||
if (pathSegments == null) {
|
||||
throw new FileNotFoundException("No path: " + uri);
|
||||
}
|
||||
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) {
|
||||
throw new FileNotFoundException("No resource found for: " + uri);
|
||||
}
|
||||
return resourcesForApplication.getDrawable(parseInt);
|
||||
} catch (PackageManager.NameNotFoundException unused2) {
|
||||
throw new FileNotFoundException("No package found for authority: " + uri);
|
||||
}
|
||||
}
|
||||
|
||||
Cursor getSearchManagerSuggestions(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.mProviderContext.getContentResolver().query(fragment.build(), null, suggestSelection, strArr2, null);
|
||||
}
|
||||
}
|
||||
1157
02-Easy5/E5/sources/androidx/appcompat/widget/SwitchCompat.java
Normal file
1157
02-Easy5/E5/sources/androidx/appcompat/widget/SwitchCompat.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,92 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ThemeUtils {
|
||||
private static final String TAG = "ThemeUtils";
|
||||
private static final ThreadLocal<TypedValue> TL_TYPED_VALUE = new ThreadLocal<>();
|
||||
static final int[] DISABLED_STATE_SET = {-16842910};
|
||||
static final int[] FOCUSED_STATE_SET = {R.attr.state_focused};
|
||||
static final int[] ACTIVATED_STATE_SET = {R.attr.state_activated};
|
||||
static final int[] PRESSED_STATE_SET = {R.attr.state_pressed};
|
||||
static final int[] CHECKED_STATE_SET = {R.attr.state_checked};
|
||||
static final int[] SELECTED_STATE_SET = {R.attr.state_selected};
|
||||
static final int[] NOT_PRESSED_OR_FOCUSED_STATE_SET = {-16842919, -16842908};
|
||||
static final int[] EMPTY_STATE_SET = new int[0];
|
||||
private static final int[] TEMP_ARRAY = new int[1];
|
||||
|
||||
public static ColorStateList createDisabledStateList(int i, int i2) {
|
||||
return new ColorStateList(new int[][]{DISABLED_STATE_SET, EMPTY_STATE_SET}, new int[]{i2, i});
|
||||
}
|
||||
|
||||
public static int getThemeAttrColor(Context context, int i) {
|
||||
int[] iArr = TEMP_ARRAY;
|
||||
iArr[0] = i;
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, (AttributeSet) null, iArr);
|
||||
try {
|
||||
return obtainStyledAttributes.getColor(0, 0);
|
||||
} finally {
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
public static ColorStateList getThemeAttrColorStateList(Context context, int i) {
|
||||
int[] iArr = TEMP_ARRAY;
|
||||
iArr[0] = i;
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, (AttributeSet) null, iArr);
|
||||
try {
|
||||
return obtainStyledAttributes.getColorStateList(0);
|
||||
} finally {
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
public static int getDisabledThemeAttrColor(Context context, int i) {
|
||||
ColorStateList themeAttrColorStateList = getThemeAttrColorStateList(context, i);
|
||||
if (themeAttrColorStateList != null && themeAttrColorStateList.isStateful()) {
|
||||
return themeAttrColorStateList.getColorForState(DISABLED_STATE_SET, themeAttrColorStateList.getDefaultColor());
|
||||
}
|
||||
TypedValue typedValue = getTypedValue();
|
||||
context.getTheme().resolveAttribute(R.attr.disabledAlpha, typedValue, true);
|
||||
return getThemeAttrColor(context, i, typedValue.getFloat());
|
||||
}
|
||||
|
||||
private static TypedValue getTypedValue() {
|
||||
ThreadLocal<TypedValue> threadLocal = TL_TYPED_VALUE;
|
||||
TypedValue typedValue = threadLocal.get();
|
||||
if (typedValue != null) {
|
||||
return typedValue;
|
||||
}
|
||||
TypedValue typedValue2 = new TypedValue();
|
||||
threadLocal.set(typedValue2);
|
||||
return typedValue2;
|
||||
}
|
||||
|
||||
static int getThemeAttrColor(Context context, int i, float f) {
|
||||
return ColorUtils.setAlphaComponent(getThemeAttrColor(context, i), Math.round(Color.alpha(r0) * f));
|
||||
}
|
||||
|
||||
public static void checkAppCompatTheme(View view, Context context) {
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(androidx.appcompat.R.styleable.AppCompatTheme);
|
||||
try {
|
||||
if (!obtainStyledAttributes.hasValue(androidx.appcompat.R.styleable.AppCompatTheme_windowActionBar)) {
|
||||
Log.e(TAG, "View " + view.getClass() + " is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).");
|
||||
}
|
||||
} finally {
|
||||
obtainStyledAttributes.recycle();
|
||||
}
|
||||
}
|
||||
|
||||
private ThemeUtils() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.SpinnerAdapter;
|
||||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ThemedSpinnerAdapter extends SpinnerAdapter {
|
||||
Resources.Theme getDropDownViewTheme();
|
||||
|
||||
void setDropDownViewTheme(Resources.Theme theme);
|
||||
|
||||
public static final class Helper {
|
||||
private final Context mContext;
|
||||
private LayoutInflater mDropDownInflater;
|
||||
private final LayoutInflater mInflater;
|
||||
|
||||
public LayoutInflater getDropDownViewInflater() {
|
||||
LayoutInflater layoutInflater = this.mDropDownInflater;
|
||||
return layoutInflater != null ? layoutInflater : this.mInflater;
|
||||
}
|
||||
|
||||
public Helper(Context context) {
|
||||
this.mContext = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
public void setDropDownViewTheme(Resources.Theme theme) {
|
||||
if (theme == null) {
|
||||
this.mDropDownInflater = null;
|
||||
} else if (theme.equals(this.mContext.getTheme())) {
|
||||
this.mDropDownInflater = this.mInflater;
|
||||
} else {
|
||||
this.mDropDownInflater = LayoutInflater.from(new ContextThemeWrapper(this.mContext, theme));
|
||||
}
|
||||
}
|
||||
|
||||
public Resources.Theme getDropDownViewTheme() {
|
||||
LayoutInflater layoutInflater = this.mDropDownInflater;
|
||||
if (layoutInflater == null) {
|
||||
return null;
|
||||
}
|
||||
return layoutInflater.getContext().getTheme();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.res.Resources;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TintContextWrapper extends ContextWrapper {
|
||||
private static final Object CACHE_LOCK = new Object();
|
||||
private static ArrayList<WeakReference<TintContextWrapper>> sCache;
|
||||
private final Resources mResources;
|
||||
private final Resources.Theme mTheme;
|
||||
|
||||
@Override // android.content.ContextWrapper, android.content.Context
|
||||
public Resources getResources() {
|
||||
return this.mResources;
|
||||
}
|
||||
|
||||
public static Context wrap(Context context) {
|
||||
if (!shouldWrap(context)) {
|
||||
return context;
|
||||
}
|
||||
synchronized (CACHE_LOCK) {
|
||||
ArrayList<WeakReference<TintContextWrapper>> arrayList = sCache;
|
||||
if (arrayList == null) {
|
||||
sCache = new ArrayList<>();
|
||||
} else {
|
||||
for (int size = arrayList.size() - 1; size >= 0; size--) {
|
||||
WeakReference<TintContextWrapper> weakReference = sCache.get(size);
|
||||
if (weakReference == null || weakReference.get() == null) {
|
||||
sCache.remove(size);
|
||||
}
|
||||
}
|
||||
for (int size2 = sCache.size() - 1; size2 >= 0; size2--) {
|
||||
WeakReference<TintContextWrapper> weakReference2 = sCache.get(size2);
|
||||
TintContextWrapper tintContextWrapper = weakReference2 != null ? weakReference2.get() : null;
|
||||
if (tintContextWrapper != null && tintContextWrapper.getBaseContext() == context) {
|
||||
return tintContextWrapper;
|
||||
}
|
||||
}
|
||||
}
|
||||
TintContextWrapper tintContextWrapper2 = new TintContextWrapper(context);
|
||||
sCache.add(new WeakReference<>(tintContextWrapper2));
|
||||
return tintContextWrapper2;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean shouldWrap(Context context) {
|
||||
if ((context instanceof TintContextWrapper) || (context.getResources() instanceof TintResources) || (context.getResources() instanceof VectorEnabledTintResources)) {
|
||||
return false;
|
||||
}
|
||||
return VectorEnabledTintResources.shouldBeUsed();
|
||||
}
|
||||
|
||||
private TintContextWrapper(Context context) {
|
||||
super(context);
|
||||
if (VectorEnabledTintResources.shouldBeUsed()) {
|
||||
VectorEnabledTintResources vectorEnabledTintResources = new VectorEnabledTintResources(this, context.getResources());
|
||||
this.mResources = vectorEnabledTintResources;
|
||||
Resources.Theme newTheme = vectorEnabledTintResources.newTheme();
|
||||
this.mTheme = newTheme;
|
||||
newTheme.setTo(context.getTheme());
|
||||
return;
|
||||
}
|
||||
this.mResources = new TintResources(this, context.getResources());
|
||||
this.mTheme = null;
|
||||
}
|
||||
|
||||
@Override // android.content.ContextWrapper, android.content.Context
|
||||
public Resources.Theme getTheme() {
|
||||
Resources.Theme theme = this.mTheme;
|
||||
return theme == null ? super.getTheme() : theme;
|
||||
}
|
||||
|
||||
@Override // android.content.ContextWrapper, android.content.Context
|
||||
public void setTheme(int i) {
|
||||
Resources.Theme theme = this.mTheme;
|
||||
if (theme == null) {
|
||||
super.setTheme(i);
|
||||
} else {
|
||||
theme.applyStyle(i, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // android.content.ContextWrapper, android.content.Context
|
||||
public AssetManager getAssets() {
|
||||
return this.mResources.getAssets();
|
||||
}
|
||||
}
|
||||
19
02-Easy5/E5/sources/androidx/appcompat/widget/TintInfo.java
Normal file
19
02-Easy5/E5/sources/androidx/appcompat/widget/TintInfo.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PorterDuff;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TintInfo {
|
||||
public boolean mHasTintList;
|
||||
public boolean mHasTintMode;
|
||||
public ColorStateList mTintList;
|
||||
public PorterDuff.Mode mTintMode;
|
||||
|
||||
void clear() {
|
||||
this.mTintList = null;
|
||||
this.mHasTintList = false;
|
||||
this.mTintMode = null;
|
||||
this.mHasTintMode = false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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> mContextRef;
|
||||
|
||||
public TintResources(Context context, Resources resources) {
|
||||
super(resources);
|
||||
this.mContextRef = new WeakReference<>(context);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public Drawable getDrawable(int i) throws Resources.NotFoundException {
|
||||
Drawable drawableCanonical = getDrawableCanonical(i);
|
||||
Context context = this.mContextRef.get();
|
||||
if (drawableCanonical != null && context != null) {
|
||||
ResourceManagerInternal.get().tintDrawableUsingColorFilter(context, i, drawableCanonical);
|
||||
}
|
||||
return drawableCanonical;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
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 mContext;
|
||||
private TypedValue mTypedValue;
|
||||
private final TypedArray mWrapped;
|
||||
|
||||
public TypedArray getWrappedTypeArray() {
|
||||
return this.mWrapped;
|
||||
}
|
||||
|
||||
public static TintTypedArray obtainStyledAttributes(Context context, AttributeSet attributeSet, int[] iArr) {
|
||||
return new TintTypedArray(context, context.obtainStyledAttributes(attributeSet, iArr));
|
||||
}
|
||||
|
||||
public static TintTypedArray obtainStyledAttributes(Context context, AttributeSet attributeSet, int[] iArr, int i, int i2) {
|
||||
return new TintTypedArray(context, context.obtainStyledAttributes(attributeSet, iArr, i, i2));
|
||||
}
|
||||
|
||||
public static TintTypedArray obtainStyledAttributes(Context context, int i, int[] iArr) {
|
||||
return new TintTypedArray(context, context.obtainStyledAttributes(i, iArr));
|
||||
}
|
||||
|
||||
private TintTypedArray(Context context, TypedArray typedArray) {
|
||||
this.mContext = context;
|
||||
this.mWrapped = typedArray;
|
||||
}
|
||||
|
||||
public Drawable getDrawable(int i) {
|
||||
int resourceId;
|
||||
if (this.mWrapped.hasValue(i) && (resourceId = this.mWrapped.getResourceId(i, 0)) != 0) {
|
||||
return AppCompatResources.getDrawable(this.mContext, resourceId);
|
||||
}
|
||||
return this.mWrapped.getDrawable(i);
|
||||
}
|
||||
|
||||
public Drawable getDrawableIfKnown(int i) {
|
||||
int resourceId;
|
||||
if (!this.mWrapped.hasValue(i) || (resourceId = this.mWrapped.getResourceId(i, 0)) == 0) {
|
||||
return null;
|
||||
}
|
||||
return AppCompatDrawableManager.get().getDrawable(this.mContext, resourceId, true);
|
||||
}
|
||||
|
||||
public Typeface getFont(int i, int i2, ResourcesCompat.FontCallback fontCallback) {
|
||||
int resourceId = this.mWrapped.getResourceId(i, 0);
|
||||
if (resourceId == 0) {
|
||||
return null;
|
||||
}
|
||||
if (this.mTypedValue == null) {
|
||||
this.mTypedValue = new TypedValue();
|
||||
}
|
||||
return ResourcesCompat.getFont(this.mContext, resourceId, this.mTypedValue, i2, fontCallback);
|
||||
}
|
||||
|
||||
public int length() {
|
||||
return this.mWrapped.length();
|
||||
}
|
||||
|
||||
public int getIndexCount() {
|
||||
return this.mWrapped.getIndexCount();
|
||||
}
|
||||
|
||||
public int getIndex(int i) {
|
||||
return this.mWrapped.getIndex(i);
|
||||
}
|
||||
|
||||
public Resources getResources() {
|
||||
return this.mWrapped.getResources();
|
||||
}
|
||||
|
||||
public CharSequence getText(int i) {
|
||||
return this.mWrapped.getText(i);
|
||||
}
|
||||
|
||||
public String getString(int i) {
|
||||
return this.mWrapped.getString(i);
|
||||
}
|
||||
|
||||
public String getNonResourceString(int i) {
|
||||
return this.mWrapped.getNonResourceString(i);
|
||||
}
|
||||
|
||||
public boolean getBoolean(int i, boolean z) {
|
||||
return this.mWrapped.getBoolean(i, z);
|
||||
}
|
||||
|
||||
public int getInt(int i, int i2) {
|
||||
return this.mWrapped.getInt(i, i2);
|
||||
}
|
||||
|
||||
public float getFloat(int i, float f) {
|
||||
return this.mWrapped.getFloat(i, f);
|
||||
}
|
||||
|
||||
public int getColor(int i, int i2) {
|
||||
return this.mWrapped.getColor(i, i2);
|
||||
}
|
||||
|
||||
public ColorStateList getColorStateList(int i) {
|
||||
int resourceId;
|
||||
ColorStateList colorStateList;
|
||||
return (!this.mWrapped.hasValue(i) || (resourceId = this.mWrapped.getResourceId(i, 0)) == 0 || (colorStateList = AppCompatResources.getColorStateList(this.mContext, resourceId)) == null) ? this.mWrapped.getColorStateList(i) : colorStateList;
|
||||
}
|
||||
|
||||
public int getInteger(int i, int i2) {
|
||||
return this.mWrapped.getInteger(i, i2);
|
||||
}
|
||||
|
||||
public float getDimension(int i, float f) {
|
||||
return this.mWrapped.getDimension(i, f);
|
||||
}
|
||||
|
||||
public int getDimensionPixelOffset(int i, int i2) {
|
||||
return this.mWrapped.getDimensionPixelOffset(i, i2);
|
||||
}
|
||||
|
||||
public int getDimensionPixelSize(int i, int i2) {
|
||||
return this.mWrapped.getDimensionPixelSize(i, i2);
|
||||
}
|
||||
|
||||
public int getLayoutDimension(int i, String str) {
|
||||
return this.mWrapped.getLayoutDimension(i, str);
|
||||
}
|
||||
|
||||
public int getLayoutDimension(int i, int i2) {
|
||||
return this.mWrapped.getLayoutDimension(i, i2);
|
||||
}
|
||||
|
||||
public float getFraction(int i, int i2, int i3, float f) {
|
||||
return this.mWrapped.getFraction(i, i2, i3, f);
|
||||
}
|
||||
|
||||
public int getResourceId(int i, int i2) {
|
||||
return this.mWrapped.getResourceId(i, i2);
|
||||
}
|
||||
|
||||
public CharSequence[] getTextArray(int i) {
|
||||
return this.mWrapped.getTextArray(i);
|
||||
}
|
||||
|
||||
public boolean getValue(int i, TypedValue typedValue) {
|
||||
return this.mWrapped.getValue(i, typedValue);
|
||||
}
|
||||
|
||||
public int getType(int i) {
|
||||
return Api21Impl.getType(this.mWrapped, i);
|
||||
}
|
||||
|
||||
public boolean hasValue(int i) {
|
||||
return this.mWrapped.hasValue(i);
|
||||
}
|
||||
|
||||
public TypedValue peekValue(int i) {
|
||||
return this.mWrapped.peekValue(i);
|
||||
}
|
||||
|
||||
public String getPositionDescription() {
|
||||
return this.mWrapped.getPositionDescription();
|
||||
}
|
||||
|
||||
public void recycle() {
|
||||
this.mWrapped.recycle();
|
||||
}
|
||||
|
||||
public int getChangingConfigurations() {
|
||||
return Api21Impl.getChangingConfigurations(this.mWrapped);
|
||||
}
|
||||
|
||||
static class Api21Impl {
|
||||
private Api21Impl() {
|
||||
}
|
||||
|
||||
static int getType(TypedArray typedArray, int i) {
|
||||
return typedArray.getType(i);
|
||||
}
|
||||
|
||||
static int getChangingConfigurations(TypedArray typedArray) {
|
||||
return typedArray.getChangingConfigurations();
|
||||
}
|
||||
}
|
||||
}
|
||||
1687
02-Easy5/E5/sources/androidx/appcompat/widget/Toolbar.java
Normal file
1687
02-Easy5/E5/sources/androidx/appcompat/widget/Toolbar.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,644 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
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 android.widget.AdapterView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.SpinnerAdapter;
|
||||
import androidx.appcompat.R;
|
||||
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 {
|
||||
private static final int AFFECTS_LOGO_MASK = 3;
|
||||
private static final long DEFAULT_FADE_DURATION_MS = 200;
|
||||
private static final String TAG = "ToolbarWidgetWrapper";
|
||||
private ActionMenuPresenter mActionMenuPresenter;
|
||||
private View mCustomView;
|
||||
private int mDefaultNavigationContentDescription;
|
||||
private Drawable mDefaultNavigationIcon;
|
||||
private int mDisplayOpts;
|
||||
private CharSequence mHomeDescription;
|
||||
private Drawable mIcon;
|
||||
private Drawable mLogo;
|
||||
boolean mMenuPrepared;
|
||||
private Drawable mNavIcon;
|
||||
private int mNavigationMode;
|
||||
private Spinner mSpinner;
|
||||
private CharSequence mSubtitle;
|
||||
private View mTabView;
|
||||
CharSequence mTitle;
|
||||
private boolean mTitleSet;
|
||||
Toolbar mToolbar;
|
||||
Window.Callback mWindowCallback;
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public View getCustomView() {
|
||||
return this.mCustomView;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public int getDisplayOptions() {
|
||||
return this.mDisplayOpts;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public int getNavigationMode() {
|
||||
return this.mNavigationMode;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public ViewGroup getViewGroup() {
|
||||
return this.mToolbar;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public boolean hasEmbeddedTabs() {
|
||||
return this.mTabView != null;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public boolean hasIcon() {
|
||||
return this.mIcon != null;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public boolean hasLogo() {
|
||||
return this.mLogo != null;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setHomeButtonEnabled(boolean z) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setMenuPrepared() {
|
||||
this.mMenuPrepared = true;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setWindowCallback(Window.Callback callback) {
|
||||
this.mWindowCallback = callback;
|
||||
}
|
||||
|
||||
public ToolbarWidgetWrapper(Toolbar toolbar, boolean z) {
|
||||
this(toolbar, z, R.string.abc_action_bar_up_description, R.drawable.abc_ic_ab_back_material);
|
||||
}
|
||||
|
||||
public ToolbarWidgetWrapper(Toolbar toolbar, boolean z, int i, int i2) {
|
||||
Drawable drawable;
|
||||
this.mNavigationMode = 0;
|
||||
this.mDefaultNavigationContentDescription = 0;
|
||||
this.mToolbar = toolbar;
|
||||
this.mTitle = toolbar.getTitle();
|
||||
this.mSubtitle = toolbar.getSubtitle();
|
||||
this.mTitleSet = this.mTitle != null;
|
||||
this.mNavIcon = toolbar.getNavigationIcon();
|
||||
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(toolbar.getContext(), null, R.styleable.ActionBar, R.attr.actionBarStyle, 0);
|
||||
this.mDefaultNavigationIcon = obtainStyledAttributes.getDrawable(R.styleable.ActionBar_homeAsUpIndicator);
|
||||
if (z) {
|
||||
CharSequence text = obtainStyledAttributes.getText(R.styleable.ActionBar_title);
|
||||
if (!TextUtils.isEmpty(text)) {
|
||||
setTitle(text);
|
||||
}
|
||||
CharSequence text2 = obtainStyledAttributes.getText(R.styleable.ActionBar_subtitle);
|
||||
if (!TextUtils.isEmpty(text2)) {
|
||||
setSubtitle(text2);
|
||||
}
|
||||
Drawable drawable2 = obtainStyledAttributes.getDrawable(R.styleable.ActionBar_logo);
|
||||
if (drawable2 != null) {
|
||||
setLogo(drawable2);
|
||||
}
|
||||
Drawable drawable3 = obtainStyledAttributes.getDrawable(R.styleable.ActionBar_icon);
|
||||
if (drawable3 != null) {
|
||||
setIcon(drawable3);
|
||||
}
|
||||
if (this.mNavIcon == null && (drawable = this.mDefaultNavigationIcon) != null) {
|
||||
setNavigationIcon(drawable);
|
||||
}
|
||||
setDisplayOptions(obtainStyledAttributes.getInt(R.styleable.ActionBar_displayOptions, 0));
|
||||
int resourceId = obtainStyledAttributes.getResourceId(R.styleable.ActionBar_customNavigationLayout, 0);
|
||||
if (resourceId != 0) {
|
||||
setCustomView(LayoutInflater.from(this.mToolbar.getContext()).inflate(resourceId, (ViewGroup) this.mToolbar, false));
|
||||
setDisplayOptions(this.mDisplayOpts | 16);
|
||||
}
|
||||
int layoutDimension = obtainStyledAttributes.getLayoutDimension(R.styleable.ActionBar_height, 0);
|
||||
if (layoutDimension > 0) {
|
||||
ViewGroup.LayoutParams layoutParams = this.mToolbar.getLayoutParams();
|
||||
layoutParams.height = layoutDimension;
|
||||
this.mToolbar.setLayoutParams(layoutParams);
|
||||
}
|
||||
int dimensionPixelOffset = obtainStyledAttributes.getDimensionPixelOffset(R.styleable.ActionBar_contentInsetStart, -1);
|
||||
int dimensionPixelOffset2 = obtainStyledAttributes.getDimensionPixelOffset(R.styleable.ActionBar_contentInsetEnd, -1);
|
||||
if (dimensionPixelOffset >= 0 || dimensionPixelOffset2 >= 0) {
|
||||
this.mToolbar.setContentInsetsRelative(Math.max(dimensionPixelOffset, 0), Math.max(dimensionPixelOffset2, 0));
|
||||
}
|
||||
int resourceId2 = obtainStyledAttributes.getResourceId(R.styleable.ActionBar_titleTextStyle, 0);
|
||||
if (resourceId2 != 0) {
|
||||
Toolbar toolbar2 = this.mToolbar;
|
||||
toolbar2.setTitleTextAppearance(toolbar2.getContext(), resourceId2);
|
||||
}
|
||||
int resourceId3 = obtainStyledAttributes.getResourceId(R.styleable.ActionBar_subtitleTextStyle, 0);
|
||||
if (resourceId3 != 0) {
|
||||
Toolbar toolbar3 = this.mToolbar;
|
||||
toolbar3.setSubtitleTextAppearance(toolbar3.getContext(), resourceId3);
|
||||
}
|
||||
int resourceId4 = obtainStyledAttributes.getResourceId(R.styleable.ActionBar_popupTheme, 0);
|
||||
if (resourceId4 != 0) {
|
||||
this.mToolbar.setPopupTheme(resourceId4);
|
||||
}
|
||||
} else {
|
||||
this.mDisplayOpts = detectDisplayOptions();
|
||||
}
|
||||
obtainStyledAttributes.recycle();
|
||||
setDefaultNavigationContentDescription(i);
|
||||
this.mHomeDescription = this.mToolbar.getNavigationContentDescription();
|
||||
this.mToolbar.setNavigationOnClickListener(new View.OnClickListener() { // from class: androidx.appcompat.widget.ToolbarWidgetWrapper.1
|
||||
final ActionMenuItem mNavItem;
|
||||
|
||||
{
|
||||
this.mNavItem = new ActionMenuItem(ToolbarWidgetWrapper.this.mToolbar.getContext(), 0, android.R.id.home, 0, 0, ToolbarWidgetWrapper.this.mTitle);
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (ToolbarWidgetWrapper.this.mWindowCallback == null || !ToolbarWidgetWrapper.this.mMenuPrepared) {
|
||||
return;
|
||||
}
|
||||
ToolbarWidgetWrapper.this.mWindowCallback.onMenuItemSelected(0, this.mNavItem);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setDefaultNavigationContentDescription(int i) {
|
||||
if (i == this.mDefaultNavigationContentDescription) {
|
||||
return;
|
||||
}
|
||||
this.mDefaultNavigationContentDescription = i;
|
||||
if (TextUtils.isEmpty(this.mToolbar.getNavigationContentDescription())) {
|
||||
setNavigationContentDescription(this.mDefaultNavigationContentDescription);
|
||||
}
|
||||
}
|
||||
|
||||
private int detectDisplayOptions() {
|
||||
if (this.mToolbar.getNavigationIcon() == null) {
|
||||
return 11;
|
||||
}
|
||||
this.mDefaultNavigationIcon = this.mToolbar.getNavigationIcon();
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public Context getContext() {
|
||||
return this.mToolbar.getContext();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public boolean hasExpandedActionView() {
|
||||
return this.mToolbar.hasExpandedActionView();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void collapseActionView() {
|
||||
this.mToolbar.collapseActionView();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setWindowTitle(CharSequence charSequence) {
|
||||
if (this.mTitleSet) {
|
||||
return;
|
||||
}
|
||||
setTitleInt(charSequence);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public CharSequence getTitle() {
|
||||
return this.mToolbar.getTitle();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setTitle(CharSequence charSequence) {
|
||||
this.mTitleSet = true;
|
||||
setTitleInt(charSequence);
|
||||
}
|
||||
|
||||
private void setTitleInt(CharSequence charSequence) {
|
||||
this.mTitle = charSequence;
|
||||
if ((this.mDisplayOpts & 8) != 0) {
|
||||
this.mToolbar.setTitle(charSequence);
|
||||
if (this.mTitleSet) {
|
||||
ViewCompat.setAccessibilityPaneTitle(this.mToolbar.getRootView(), charSequence);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public CharSequence getSubtitle() {
|
||||
return this.mToolbar.getSubtitle();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setSubtitle(CharSequence charSequence) {
|
||||
this.mSubtitle = charSequence;
|
||||
if ((this.mDisplayOpts & 8) != 0) {
|
||||
this.mToolbar.setSubtitle(charSequence);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void initProgress() {
|
||||
Log.i(TAG, "Progress display unsupported");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void initIndeterminateProgress() {
|
||||
Log.i(TAG, "Progress display unsupported");
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setIcon(int i) {
|
||||
setIcon(i != 0 ? AppCompatResources.getDrawable(getContext(), i) : null);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setIcon(Drawable drawable) {
|
||||
this.mIcon = drawable;
|
||||
updateToolbarLogo();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setLogo(int i) {
|
||||
setLogo(i != 0 ? AppCompatResources.getDrawable(getContext(), i) : null);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setLogo(Drawable drawable) {
|
||||
this.mLogo = drawable;
|
||||
updateToolbarLogo();
|
||||
}
|
||||
|
||||
private void updateToolbarLogo() {
|
||||
Drawable drawable;
|
||||
int i = this.mDisplayOpts;
|
||||
if ((i & 2) == 0) {
|
||||
drawable = null;
|
||||
} else if ((i & 1) != 0) {
|
||||
drawable = this.mLogo;
|
||||
if (drawable == null) {
|
||||
drawable = this.mIcon;
|
||||
}
|
||||
} else {
|
||||
drawable = this.mIcon;
|
||||
}
|
||||
this.mToolbar.setLogo(drawable);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public boolean canShowOverflowMenu() {
|
||||
return this.mToolbar.canShowOverflowMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public boolean isOverflowMenuShowing() {
|
||||
return this.mToolbar.isOverflowMenuShowing();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public boolean isOverflowMenuShowPending() {
|
||||
return this.mToolbar.isOverflowMenuShowPending();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public boolean showOverflowMenu() {
|
||||
return this.mToolbar.showOverflowMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public boolean hideOverflowMenu() {
|
||||
return this.mToolbar.hideOverflowMenu();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setMenu(Menu menu, MenuPresenter.Callback callback) {
|
||||
if (this.mActionMenuPresenter == null) {
|
||||
ActionMenuPresenter actionMenuPresenter = new ActionMenuPresenter(this.mToolbar.getContext());
|
||||
this.mActionMenuPresenter = actionMenuPresenter;
|
||||
actionMenuPresenter.setId(R.id.action_menu_presenter);
|
||||
}
|
||||
this.mActionMenuPresenter.setCallback(callback);
|
||||
this.mToolbar.setMenu((MenuBuilder) menu, this.mActionMenuPresenter);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void dismissPopupMenus() {
|
||||
this.mToolbar.dismissPopupMenus();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setDisplayOptions(int i) {
|
||||
View view;
|
||||
int i2 = this.mDisplayOpts ^ i;
|
||||
this.mDisplayOpts = i;
|
||||
if (i2 != 0) {
|
||||
if ((i2 & 4) != 0) {
|
||||
if ((i & 4) != 0) {
|
||||
updateHomeAccessibility();
|
||||
}
|
||||
updateNavigationIcon();
|
||||
}
|
||||
if ((i2 & 3) != 0) {
|
||||
updateToolbarLogo();
|
||||
}
|
||||
if ((i2 & 8) != 0) {
|
||||
if ((i & 8) != 0) {
|
||||
this.mToolbar.setTitle(this.mTitle);
|
||||
this.mToolbar.setSubtitle(this.mSubtitle);
|
||||
} else {
|
||||
this.mToolbar.setTitle((CharSequence) null);
|
||||
this.mToolbar.setSubtitle((CharSequence) null);
|
||||
}
|
||||
}
|
||||
if ((i2 & 16) == 0 || (view = this.mCustomView) == null) {
|
||||
return;
|
||||
}
|
||||
if ((i & 16) != 0) {
|
||||
this.mToolbar.addView(view);
|
||||
} else {
|
||||
this.mToolbar.removeView(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setEmbeddedTabView(ScrollingTabContainerView scrollingTabContainerView) {
|
||||
View view = this.mTabView;
|
||||
if (view != null) {
|
||||
ViewParent parent = view.getParent();
|
||||
Toolbar toolbar = this.mToolbar;
|
||||
if (parent == toolbar) {
|
||||
toolbar.removeView(this.mTabView);
|
||||
}
|
||||
}
|
||||
this.mTabView = scrollingTabContainerView;
|
||||
if (scrollingTabContainerView == null || this.mNavigationMode != 2) {
|
||||
return;
|
||||
}
|
||||
this.mToolbar.addView(scrollingTabContainerView, 0);
|
||||
Toolbar.LayoutParams layoutParams = (Toolbar.LayoutParams) this.mTabView.getLayoutParams();
|
||||
layoutParams.width = -2;
|
||||
layoutParams.height = -2;
|
||||
layoutParams.gravity = 8388691;
|
||||
scrollingTabContainerView.setAllowCollapse(true);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public boolean isTitleTruncated() {
|
||||
return this.mToolbar.isTitleTruncated();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setCollapsible(boolean z) {
|
||||
this.mToolbar.setCollapsible(z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setNavigationMode(int i) {
|
||||
View view;
|
||||
int i2 = this.mNavigationMode;
|
||||
if (i != i2) {
|
||||
if (i2 == 1) {
|
||||
Spinner spinner = this.mSpinner;
|
||||
if (spinner != null) {
|
||||
ViewParent parent = spinner.getParent();
|
||||
Toolbar toolbar = this.mToolbar;
|
||||
if (parent == toolbar) {
|
||||
toolbar.removeView(this.mSpinner);
|
||||
}
|
||||
}
|
||||
} else if (i2 == 2 && (view = this.mTabView) != null) {
|
||||
ViewParent parent2 = view.getParent();
|
||||
Toolbar toolbar2 = this.mToolbar;
|
||||
if (parent2 == toolbar2) {
|
||||
toolbar2.removeView(this.mTabView);
|
||||
}
|
||||
}
|
||||
this.mNavigationMode = i;
|
||||
if (i != 0) {
|
||||
if (i == 1) {
|
||||
ensureSpinner();
|
||||
this.mToolbar.addView(this.mSpinner, 0);
|
||||
return;
|
||||
}
|
||||
if (i != 2) {
|
||||
throw new IllegalArgumentException("Invalid navigation mode " + i);
|
||||
}
|
||||
View view2 = this.mTabView;
|
||||
if (view2 != null) {
|
||||
this.mToolbar.addView(view2, 0);
|
||||
Toolbar.LayoutParams layoutParams = (Toolbar.LayoutParams) this.mTabView.getLayoutParams();
|
||||
layoutParams.width = -2;
|
||||
layoutParams.height = -2;
|
||||
layoutParams.gravity = 8388691;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ensureSpinner() {
|
||||
if (this.mSpinner == null) {
|
||||
this.mSpinner = new AppCompatSpinner(getContext(), null, R.attr.actionDropDownStyle);
|
||||
this.mSpinner.setLayoutParams(new Toolbar.LayoutParams(-2, -2, 8388627));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setDropdownParams(SpinnerAdapter spinnerAdapter, AdapterView.OnItemSelectedListener onItemSelectedListener) {
|
||||
ensureSpinner();
|
||||
this.mSpinner.setAdapter(spinnerAdapter);
|
||||
this.mSpinner.setOnItemSelectedListener(onItemSelectedListener);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setDropdownSelectedPosition(int i) {
|
||||
Spinner spinner = this.mSpinner;
|
||||
if (spinner == null) {
|
||||
throw new IllegalStateException("Can't set dropdown selected position without an adapter");
|
||||
}
|
||||
spinner.setSelection(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public int getDropdownSelectedPosition() {
|
||||
Spinner spinner = this.mSpinner;
|
||||
if (spinner != null) {
|
||||
return spinner.getSelectedItemPosition();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public int getDropdownItemCount() {
|
||||
Spinner spinner = this.mSpinner;
|
||||
if (spinner != null) {
|
||||
return spinner.getCount();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setCustomView(View view) {
|
||||
View view2 = this.mCustomView;
|
||||
if (view2 != null && (this.mDisplayOpts & 16) != 0) {
|
||||
this.mToolbar.removeView(view2);
|
||||
}
|
||||
this.mCustomView = view;
|
||||
if (view == null || (this.mDisplayOpts & 16) == 0) {
|
||||
return;
|
||||
}
|
||||
this.mToolbar.addView(view);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void animateToVisibility(int i) {
|
||||
ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = setupAnimatorToVisibility(i, DEFAULT_FADE_DURATION_MS);
|
||||
if (viewPropertyAnimatorCompat != null) {
|
||||
viewPropertyAnimatorCompat.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public ViewPropertyAnimatorCompat setupAnimatorToVisibility(final int i, long j) {
|
||||
return ViewCompat.animate(this.mToolbar).alpha(i == 0 ? 1.0f : 0.0f).setDuration(j).setListener(new ViewPropertyAnimatorListenerAdapter() { // from class: androidx.appcompat.widget.ToolbarWidgetWrapper.2
|
||||
private boolean mCanceled = false;
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void onAnimationCancel(View view) {
|
||||
this.mCanceled = true;
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void onAnimationStart(View view) {
|
||||
ToolbarWidgetWrapper.this.mToolbar.setVisibility(0);
|
||||
}
|
||||
|
||||
@Override // androidx.core.view.ViewPropertyAnimatorListenerAdapter, androidx.core.view.ViewPropertyAnimatorListener
|
||||
public void onAnimationEnd(View view) {
|
||||
if (this.mCanceled) {
|
||||
return;
|
||||
}
|
||||
ToolbarWidgetWrapper.this.mToolbar.setVisibility(i);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setNavigationIcon(Drawable drawable) {
|
||||
this.mNavIcon = drawable;
|
||||
updateNavigationIcon();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setNavigationIcon(int i) {
|
||||
setNavigationIcon(i != 0 ? AppCompatResources.getDrawable(getContext(), i) : null);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setDefaultNavigationIcon(Drawable drawable) {
|
||||
if (this.mDefaultNavigationIcon != drawable) {
|
||||
this.mDefaultNavigationIcon = drawable;
|
||||
updateNavigationIcon();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateNavigationIcon() {
|
||||
if ((this.mDisplayOpts & 4) != 0) {
|
||||
Toolbar toolbar = this.mToolbar;
|
||||
Drawable drawable = this.mNavIcon;
|
||||
if (drawable == null) {
|
||||
drawable = this.mDefaultNavigationIcon;
|
||||
}
|
||||
toolbar.setNavigationIcon(drawable);
|
||||
return;
|
||||
}
|
||||
this.mToolbar.setNavigationIcon((Drawable) null);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setNavigationContentDescription(CharSequence charSequence) {
|
||||
this.mHomeDescription = charSequence;
|
||||
updateHomeAccessibility();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setNavigationContentDescription(int i) {
|
||||
setNavigationContentDescription(i == 0 ? null : getContext().getString(i));
|
||||
}
|
||||
|
||||
private void updateHomeAccessibility() {
|
||||
if ((this.mDisplayOpts & 4) != 0) {
|
||||
if (TextUtils.isEmpty(this.mHomeDescription)) {
|
||||
this.mToolbar.setNavigationContentDescription(this.mDefaultNavigationContentDescription);
|
||||
} else {
|
||||
this.mToolbar.setNavigationContentDescription(this.mHomeDescription);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void saveHierarchyState(SparseArray<Parcelable> sparseArray) {
|
||||
this.mToolbar.saveHierarchyState(sparseArray);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void restoreHierarchyState(SparseArray<Parcelable> sparseArray) {
|
||||
this.mToolbar.restoreHierarchyState(sparseArray);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setBackgroundDrawable(Drawable drawable) {
|
||||
ViewCompat.setBackground(this.mToolbar, drawable);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public int getHeight() {
|
||||
return this.mToolbar.getHeight();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setVisibility(int i) {
|
||||
this.mToolbar.setVisibility(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public int getVisibility() {
|
||||
return this.mToolbar.getVisibility();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public void setMenuCallbacks(MenuPresenter.Callback callback, MenuBuilder.Callback callback2) {
|
||||
this.mToolbar.setMenuCallbacks(callback, callback2);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.DecorToolbar
|
||||
public Menu getMenu() {
|
||||
return this.mToolbar.getMenu();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TooltipCompat {
|
||||
public static void setTooltipText(View view, CharSequence charSequence) {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
Api26Impl.setTooltipText(view, charSequence);
|
||||
} else {
|
||||
TooltipCompatHandler.setTooltipText(view, charSequence);
|
||||
}
|
||||
}
|
||||
|
||||
private TooltipCompat() {
|
||||
}
|
||||
|
||||
static class Api26Impl {
|
||||
private Api26Impl() {
|
||||
}
|
||||
|
||||
static void setTooltipText(View view, CharSequence charSequence) {
|
||||
view.setTooltipText(charSequence);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
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 final long HOVER_HIDE_TIMEOUT_MS = 15000;
|
||||
private static final long HOVER_HIDE_TIMEOUT_SHORT_MS = 3000;
|
||||
private static final long LONG_CLICK_HIDE_TIMEOUT_MS = 2500;
|
||||
private static final String TAG = "TooltipCompatHandler";
|
||||
private static TooltipCompatHandler sActiveHandler;
|
||||
private static TooltipCompatHandler sPendingHandler;
|
||||
private final View mAnchor;
|
||||
private int mAnchorX;
|
||||
private int mAnchorY;
|
||||
private boolean mForceNextChangeSignificant;
|
||||
private boolean mFromTouch;
|
||||
private final int mHoverSlop;
|
||||
private TooltipPopup mPopup;
|
||||
private final CharSequence mTooltipText;
|
||||
private final Runnable mShowRunnable = new Runnable() { // from class: androidx.appcompat.widget.TooltipCompatHandler$$ExternalSyntheticLambda0
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
TooltipCompatHandler.this.m44lambda$new$0$androidxappcompatwidgetTooltipCompatHandler();
|
||||
}
|
||||
};
|
||||
private final Runnable mHideRunnable = new Runnable() { // from class: androidx.appcompat.widget.TooltipCompatHandler$$ExternalSyntheticLambda1
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
TooltipCompatHandler.this.hide();
|
||||
}
|
||||
};
|
||||
|
||||
private void forceNextChangeSignificant() {
|
||||
this.mForceNextChangeSignificant = true;
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnAttachStateChangeListener
|
||||
public void onViewAttachedToWindow(View view) {
|
||||
}
|
||||
|
||||
/* renamed from: lambda$new$0$androidx-appcompat-widget-TooltipCompatHandler, reason: not valid java name */
|
||||
/* synthetic */ void m44lambda$new$0$androidxappcompatwidgetTooltipCompatHandler() {
|
||||
show(false);
|
||||
}
|
||||
|
||||
public static void setTooltipText(View view, CharSequence charSequence) {
|
||||
TooltipCompatHandler tooltipCompatHandler = sPendingHandler;
|
||||
if (tooltipCompatHandler != null && tooltipCompatHandler.mAnchor == view) {
|
||||
setPendingHandler(null);
|
||||
}
|
||||
if (TextUtils.isEmpty(charSequence)) {
|
||||
TooltipCompatHandler tooltipCompatHandler2 = sActiveHandler;
|
||||
if (tooltipCompatHandler2 != null && tooltipCompatHandler2.mAnchor == view) {
|
||||
tooltipCompatHandler2.hide();
|
||||
}
|
||||
view.setOnLongClickListener(null);
|
||||
view.setLongClickable(false);
|
||||
view.setOnHoverListener(null);
|
||||
return;
|
||||
}
|
||||
new TooltipCompatHandler(view, charSequence);
|
||||
}
|
||||
|
||||
private TooltipCompatHandler(View view, CharSequence charSequence) {
|
||||
this.mAnchor = view;
|
||||
this.mTooltipText = charSequence;
|
||||
this.mHoverSlop = ViewConfigurationCompat.getScaledHoverSlop(ViewConfiguration.get(view.getContext()));
|
||||
forceNextChangeSignificant();
|
||||
view.setOnLongClickListener(this);
|
||||
view.setOnHoverListener(this);
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnLongClickListener
|
||||
public boolean onLongClick(View view) {
|
||||
this.mAnchorX = view.getWidth() / 2;
|
||||
this.mAnchorY = view.getHeight() / 2;
|
||||
show(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnHoverListener
|
||||
public boolean onHover(View view, MotionEvent motionEvent) {
|
||||
if (this.mPopup != null && this.mFromTouch) {
|
||||
return false;
|
||||
}
|
||||
AccessibilityManager accessibilityManager = (AccessibilityManager) this.mAnchor.getContext().getSystemService("accessibility");
|
||||
if (accessibilityManager.isEnabled() && accessibilityManager.isTouchExplorationEnabled()) {
|
||||
return false;
|
||||
}
|
||||
int action = motionEvent.getAction();
|
||||
if (action != 7) {
|
||||
if (action == 10) {
|
||||
forceNextChangeSignificant();
|
||||
hide();
|
||||
}
|
||||
} else if (this.mAnchor.isEnabled() && this.mPopup == null && updateAnchorPos(motionEvent)) {
|
||||
setPendingHandler(this);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // android.view.View.OnAttachStateChangeListener
|
||||
public void onViewDetachedFromWindow(View view) {
|
||||
hide();
|
||||
}
|
||||
|
||||
void show(boolean z) {
|
||||
long longPressTimeout;
|
||||
long j;
|
||||
long j2;
|
||||
if (ViewCompat.isAttachedToWindow(this.mAnchor)) {
|
||||
setPendingHandler(null);
|
||||
TooltipCompatHandler tooltipCompatHandler = sActiveHandler;
|
||||
if (tooltipCompatHandler != null) {
|
||||
tooltipCompatHandler.hide();
|
||||
}
|
||||
sActiveHandler = this;
|
||||
this.mFromTouch = z;
|
||||
TooltipPopup tooltipPopup = new TooltipPopup(this.mAnchor.getContext());
|
||||
this.mPopup = tooltipPopup;
|
||||
tooltipPopup.show(this.mAnchor, this.mAnchorX, this.mAnchorY, this.mFromTouch, this.mTooltipText);
|
||||
this.mAnchor.addOnAttachStateChangeListener(this);
|
||||
if (this.mFromTouch) {
|
||||
j2 = LONG_CLICK_HIDE_TIMEOUT_MS;
|
||||
} else {
|
||||
if ((ViewCompat.getWindowSystemUiVisibility(this.mAnchor) & 1) == 1) {
|
||||
longPressTimeout = ViewConfiguration.getLongPressTimeout();
|
||||
j = HOVER_HIDE_TIMEOUT_SHORT_MS;
|
||||
} else {
|
||||
longPressTimeout = ViewConfiguration.getLongPressTimeout();
|
||||
j = HOVER_HIDE_TIMEOUT_MS;
|
||||
}
|
||||
j2 = j - longPressTimeout;
|
||||
}
|
||||
this.mAnchor.removeCallbacks(this.mHideRunnable);
|
||||
this.mAnchor.postDelayed(this.mHideRunnable, j2);
|
||||
}
|
||||
}
|
||||
|
||||
void hide() {
|
||||
if (sActiveHandler == this) {
|
||||
sActiveHandler = null;
|
||||
TooltipPopup tooltipPopup = this.mPopup;
|
||||
if (tooltipPopup != null) {
|
||||
tooltipPopup.hide();
|
||||
this.mPopup = null;
|
||||
forceNextChangeSignificant();
|
||||
this.mAnchor.removeOnAttachStateChangeListener(this);
|
||||
} else {
|
||||
Log.e(TAG, "sActiveHandler.mPopup == null");
|
||||
}
|
||||
}
|
||||
if (sPendingHandler == this) {
|
||||
setPendingHandler(null);
|
||||
}
|
||||
this.mAnchor.removeCallbacks(this.mHideRunnable);
|
||||
}
|
||||
|
||||
private static void setPendingHandler(TooltipCompatHandler tooltipCompatHandler) {
|
||||
TooltipCompatHandler tooltipCompatHandler2 = sPendingHandler;
|
||||
if (tooltipCompatHandler2 != null) {
|
||||
tooltipCompatHandler2.cancelPendingShow();
|
||||
}
|
||||
sPendingHandler = tooltipCompatHandler;
|
||||
if (tooltipCompatHandler != null) {
|
||||
tooltipCompatHandler.scheduleShow();
|
||||
}
|
||||
}
|
||||
|
||||
private void scheduleShow() {
|
||||
this.mAnchor.postDelayed(this.mShowRunnable, ViewConfiguration.getLongPressTimeout());
|
||||
}
|
||||
|
||||
private void cancelPendingShow() {
|
||||
this.mAnchor.removeCallbacks(this.mShowRunnable);
|
||||
}
|
||||
|
||||
private boolean updateAnchorPos(MotionEvent motionEvent) {
|
||||
int x = (int) motionEvent.getX();
|
||||
int y = (int) motionEvent.getY();
|
||||
if (!this.mForceNextChangeSignificant && Math.abs(x - this.mAnchorX) <= this.mHoverSlop && Math.abs(y - this.mAnchorY) <= this.mHoverSlop) {
|
||||
return false;
|
||||
}
|
||||
this.mAnchorX = x;
|
||||
this.mAnchorY = y;
|
||||
this.mForceNextChangeSignificant = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
143
02-Easy5/E5/sources/androidx/appcompat/widget/TooltipPopup.java
Normal file
143
02-Easy5/E5/sources/androidx/appcompat/widget/TooltipPopup.java
Normal file
@@ -0,0 +1,143 @@
|
||||
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;
|
||||
import androidx.core.view.PointerIconCompat;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class TooltipPopup {
|
||||
private static final String TAG = "TooltipPopup";
|
||||
private final View mContentView;
|
||||
private final Context mContext;
|
||||
private final WindowManager.LayoutParams mLayoutParams;
|
||||
private final TextView mMessageView;
|
||||
private final int[] mTmpAnchorPos;
|
||||
private final int[] mTmpAppPos;
|
||||
private final Rect mTmpDisplayFrame;
|
||||
|
||||
TooltipPopup(Context context) {
|
||||
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
|
||||
this.mLayoutParams = layoutParams;
|
||||
this.mTmpDisplayFrame = new Rect();
|
||||
this.mTmpAnchorPos = new int[2];
|
||||
this.mTmpAppPos = new int[2];
|
||||
this.mContext = context;
|
||||
View inflate = LayoutInflater.from(context).inflate(R.layout.abc_tooltip, (ViewGroup) null);
|
||||
this.mContentView = inflate;
|
||||
this.mMessageView = (TextView) inflate.findViewById(R.id.message);
|
||||
layoutParams.setTitle(getClass().getSimpleName());
|
||||
layoutParams.packageName = context.getPackageName();
|
||||
layoutParams.type = PointerIconCompat.TYPE_HAND;
|
||||
layoutParams.width = -2;
|
||||
layoutParams.height = -2;
|
||||
layoutParams.format = -3;
|
||||
layoutParams.windowAnimations = R.style.Animation_AppCompat_Tooltip;
|
||||
layoutParams.flags = 24;
|
||||
}
|
||||
|
||||
void show(View view, int i, int i2, boolean z, CharSequence charSequence) {
|
||||
if (isShowing()) {
|
||||
hide();
|
||||
}
|
||||
this.mMessageView.setText(charSequence);
|
||||
computePosition(view, i, i2, z, this.mLayoutParams);
|
||||
((WindowManager) this.mContext.getSystemService("window")).addView(this.mContentView, this.mLayoutParams);
|
||||
}
|
||||
|
||||
void hide() {
|
||||
if (isShowing()) {
|
||||
((WindowManager) this.mContext.getSystemService("window")).removeView(this.mContentView);
|
||||
}
|
||||
}
|
||||
|
||||
boolean isShowing() {
|
||||
return this.mContentView.getParent() != null;
|
||||
}
|
||||
|
||||
private void computePosition(View view, int i, int i2, boolean z, WindowManager.LayoutParams layoutParams) {
|
||||
int height;
|
||||
int i3;
|
||||
layoutParams.token = view.getApplicationWindowToken();
|
||||
int dimensionPixelOffset = this.mContext.getResources().getDimensionPixelOffset(R.dimen.tooltip_precise_anchor_threshold);
|
||||
if (view.getWidth() < dimensionPixelOffset) {
|
||||
i = view.getWidth() / 2;
|
||||
}
|
||||
if (view.getHeight() >= dimensionPixelOffset) {
|
||||
int dimensionPixelOffset2 = this.mContext.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.mContext.getResources().getDimensionPixelOffset(z ? R.dimen.tooltip_y_offset_touch : R.dimen.tooltip_y_offset_non_touch);
|
||||
View appRootView = getAppRootView(view);
|
||||
if (appRootView == null) {
|
||||
Log.e(TAG, "Cannot find app view");
|
||||
return;
|
||||
}
|
||||
appRootView.getWindowVisibleDisplayFrame(this.mTmpDisplayFrame);
|
||||
if (this.mTmpDisplayFrame.left < 0 && this.mTmpDisplayFrame.top < 0) {
|
||||
Resources resources = this.mContext.getResources();
|
||||
int identifier = resources.getIdentifier("status_bar_height", "dimen", "android");
|
||||
int dimensionPixelSize = identifier != 0 ? resources.getDimensionPixelSize(identifier) : 0;
|
||||
DisplayMetrics displayMetrics = resources.getDisplayMetrics();
|
||||
this.mTmpDisplayFrame.set(0, dimensionPixelSize, displayMetrics.widthPixels, displayMetrics.heightPixels);
|
||||
}
|
||||
appRootView.getLocationOnScreen(this.mTmpAppPos);
|
||||
view.getLocationOnScreen(this.mTmpAnchorPos);
|
||||
int[] iArr = this.mTmpAnchorPos;
|
||||
int i4 = iArr[0];
|
||||
int[] iArr2 = this.mTmpAppPos;
|
||||
int i5 = i4 - iArr2[0];
|
||||
iArr[0] = i5;
|
||||
iArr[1] = iArr[1] - iArr2[1];
|
||||
layoutParams.x = (i5 + i) - (appRootView.getWidth() / 2);
|
||||
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
|
||||
this.mContentView.measure(makeMeasureSpec, makeMeasureSpec);
|
||||
int measuredHeight = this.mContentView.getMeasuredHeight();
|
||||
int i6 = this.mTmpAnchorPos[1];
|
||||
int i7 = ((i3 + i6) - dimensionPixelOffset3) - measuredHeight;
|
||||
int i8 = i6 + height + dimensionPixelOffset3;
|
||||
if (z) {
|
||||
if (i7 >= 0) {
|
||||
layoutParams.y = i7;
|
||||
return;
|
||||
} else {
|
||||
layoutParams.y = i8;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (measuredHeight + i8 <= this.mTmpDisplayFrame.height()) {
|
||||
layoutParams.y = i8;
|
||||
} else {
|
||||
layoutParams.y = i7;
|
||||
}
|
||||
}
|
||||
|
||||
private static View getAppRootView(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,268 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
import android.content.Context;
|
||||
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 java.lang.ref.WeakReference;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class VectorEnabledTintResources extends ResourcesWrapper {
|
||||
public static final int MAX_SDK_WHERE_REQUIRED = 20;
|
||||
private static boolean sCompatVectorFromResourcesEnabled = false;
|
||||
private final WeakReference<Context> mContextRef;
|
||||
|
||||
public static boolean isCompatVectorFromResourcesEnabled() {
|
||||
return sCompatVectorFromResourcesEnabled;
|
||||
}
|
||||
|
||||
public static void setCompatVectorFromResourcesEnabled(boolean z) {
|
||||
sCompatVectorFromResourcesEnabled = z;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ XmlResourceParser getAnimation(int i) throws Resources.NotFoundException {
|
||||
return super.getAnimation(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ boolean getBoolean(int i) throws Resources.NotFoundException {
|
||||
return super.getBoolean(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ int getColor(int i) throws Resources.NotFoundException {
|
||||
return super.getColor(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ ColorStateList getColorStateList(int i) throws Resources.NotFoundException {
|
||||
return super.getColorStateList(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ Configuration getConfiguration() {
|
||||
return super.getConfiguration();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ float getDimension(int i) throws Resources.NotFoundException {
|
||||
return super.getDimension(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ int getDimensionPixelOffset(int i) throws Resources.NotFoundException {
|
||||
return super.getDimensionPixelOffset(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ int getDimensionPixelSize(int i) throws Resources.NotFoundException {
|
||||
return super.getDimensionPixelSize(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ DisplayMetrics getDisplayMetrics() {
|
||||
return super.getDisplayMetrics();
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ Drawable getDrawable(int i, Resources.Theme theme) throws Resources.NotFoundException {
|
||||
return super.getDrawable(i, theme);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ Drawable getDrawableForDensity(int i, int i2) throws Resources.NotFoundException {
|
||||
return super.getDrawableForDensity(i, i2);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ Drawable getDrawableForDensity(int i, int i2, Resources.Theme theme) {
|
||||
return super.getDrawableForDensity(i, i2, theme);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ float getFraction(int i, int i2, int i3) {
|
||||
return super.getFraction(i, i2, i3);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ int getIdentifier(String str, String str2, String str3) {
|
||||
return super.getIdentifier(str, str2, str3);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ int[] getIntArray(int i) throws Resources.NotFoundException {
|
||||
return super.getIntArray(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ int getInteger(int i) throws Resources.NotFoundException {
|
||||
return super.getInteger(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ XmlResourceParser getLayout(int i) throws Resources.NotFoundException {
|
||||
return super.getLayout(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ Movie getMovie(int i) throws Resources.NotFoundException {
|
||||
return super.getMovie(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ String getQuantityString(int i, int i2) throws Resources.NotFoundException {
|
||||
return super.getQuantityString(i, i2);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ String getQuantityString(int i, int i2, Object[] objArr) throws Resources.NotFoundException {
|
||||
return super.getQuantityString(i, i2, objArr);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ CharSequence getQuantityText(int i, int i2) throws Resources.NotFoundException {
|
||||
return super.getQuantityText(i, i2);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ String getResourceEntryName(int i) throws Resources.NotFoundException {
|
||||
return super.getResourceEntryName(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ String getResourceName(int i) throws Resources.NotFoundException {
|
||||
return super.getResourceName(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ String getResourcePackageName(int i) throws Resources.NotFoundException {
|
||||
return super.getResourcePackageName(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ String getResourceTypeName(int i) throws Resources.NotFoundException {
|
||||
return super.getResourceTypeName(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ String getString(int i) throws Resources.NotFoundException {
|
||||
return super.getString(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ String getString(int i, Object[] objArr) throws Resources.NotFoundException {
|
||||
return super.getString(i, objArr);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ String[] getStringArray(int i) throws Resources.NotFoundException {
|
||||
return super.getStringArray(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ CharSequence getText(int i) throws Resources.NotFoundException {
|
||||
return super.getText(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ CharSequence getText(int i, CharSequence charSequence) {
|
||||
return super.getText(i, charSequence);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ CharSequence[] getTextArray(int i) throws Resources.NotFoundException {
|
||||
return super.getTextArray(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ void getValue(int i, TypedValue typedValue, boolean z) throws Resources.NotFoundException {
|
||||
super.getValue(i, typedValue, z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ void getValue(String str, TypedValue typedValue, boolean z) throws Resources.NotFoundException {
|
||||
super.getValue(str, typedValue, z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ void getValueForDensity(int i, int i2, TypedValue typedValue, boolean z) throws Resources.NotFoundException {
|
||||
super.getValueForDensity(i, i2, typedValue, z);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ XmlResourceParser getXml(int i) throws Resources.NotFoundException {
|
||||
return super.getXml(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ TypedArray obtainAttributes(AttributeSet attributeSet, int[] iArr) {
|
||||
return super.obtainAttributes(attributeSet, iArr);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ TypedArray obtainTypedArray(int i) throws Resources.NotFoundException {
|
||||
return super.obtainTypedArray(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ InputStream openRawResource(int i) throws Resources.NotFoundException {
|
||||
return super.openRawResource(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ InputStream openRawResource(int i, TypedValue typedValue) throws Resources.NotFoundException {
|
||||
return super.openRawResource(i, typedValue);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ AssetFileDescriptor openRawResourceFd(int i) throws Resources.NotFoundException {
|
||||
return super.openRawResourceFd(i);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ void parseBundleExtra(String str, AttributeSet attributeSet, Bundle bundle) throws XmlPullParserException {
|
||||
super.parseBundleExtra(str, attributeSet, bundle);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ void parseBundleExtras(XmlResourceParser xmlResourceParser, Bundle bundle) throws XmlPullParserException, IOException {
|
||||
super.parseBundleExtras(xmlResourceParser, bundle);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public /* bridge */ /* synthetic */ void updateConfiguration(Configuration configuration, DisplayMetrics displayMetrics) {
|
||||
super.updateConfiguration(configuration, displayMetrics);
|
||||
}
|
||||
|
||||
public static boolean shouldBeUsed() {
|
||||
isCompatVectorFromResourcesEnabled();
|
||||
return false;
|
||||
}
|
||||
|
||||
public VectorEnabledTintResources(Context context, Resources resources) {
|
||||
super(resources);
|
||||
this.mContextRef = new WeakReference<>(context);
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.ResourcesWrapper, android.content.res.Resources
|
||||
public Drawable getDrawable(int i) throws Resources.NotFoundException {
|
||||
Context context = this.mContextRef.get();
|
||||
if (context != null) {
|
||||
return ResourceManagerInternal.get().onDrawableLoadedFromResources(context, this, i);
|
||||
}
|
||||
return getDrawableCanonical(i);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
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;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ViewStubCompat extends View {
|
||||
private OnInflateListener mInflateListener;
|
||||
private int mInflatedId;
|
||||
private WeakReference<View> mInflatedViewRef;
|
||||
private LayoutInflater mInflater;
|
||||
private int mLayoutResource;
|
||||
|
||||
public interface OnInflateListener {
|
||||
void onInflate(ViewStubCompat viewStubCompat, View view);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void draw(Canvas canvas) {
|
||||
}
|
||||
|
||||
public int getInflatedId() {
|
||||
return this.mInflatedId;
|
||||
}
|
||||
|
||||
public LayoutInflater getLayoutInflater() {
|
||||
return this.mInflater;
|
||||
}
|
||||
|
||||
public int getLayoutResource() {
|
||||
return this.mLayoutResource;
|
||||
}
|
||||
|
||||
public void setInflatedId(int i) {
|
||||
this.mInflatedId = i;
|
||||
}
|
||||
|
||||
public void setLayoutInflater(LayoutInflater layoutInflater) {
|
||||
this.mInflater = layoutInflater;
|
||||
}
|
||||
|
||||
public void setLayoutResource(int i) {
|
||||
this.mLayoutResource = i;
|
||||
}
|
||||
|
||||
public void setOnInflateListener(OnInflateListener onInflateListener) {
|
||||
this.mInflateListener = onInflateListener;
|
||||
}
|
||||
|
||||
public ViewStubCompat(Context context, AttributeSet attributeSet) {
|
||||
this(context, attributeSet, 0);
|
||||
}
|
||||
|
||||
public ViewStubCompat(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.mLayoutResource = 0;
|
||||
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.ViewStubCompat, i, 0);
|
||||
this.mInflatedId = obtainStyledAttributes.getResourceId(R.styleable.ViewStubCompat_android_inflatedId, -1);
|
||||
this.mLayoutResource = obtainStyledAttributes.getResourceId(R.styleable.ViewStubCompat_android_layout, 0);
|
||||
setId(obtainStyledAttributes.getResourceId(R.styleable.ViewStubCompat_android_id, -1));
|
||||
obtainStyledAttributes.recycle();
|
||||
setVisibility(8);
|
||||
setWillNotDraw(true);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
setMeasuredDimension(0, 0);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void setVisibility(int i) {
|
||||
WeakReference<View> weakReference = this.mInflatedViewRef;
|
||||
if (weakReference != null) {
|
||||
View view = weakReference.get();
|
||||
if (view != null) {
|
||||
view.setVisibility(i);
|
||||
return;
|
||||
}
|
||||
throw new IllegalStateException("setVisibility called on un-referenced view");
|
||||
}
|
||||
super.setVisibility(i);
|
||||
if (i == 0 || i == 4) {
|
||||
inflate();
|
||||
}
|
||||
}
|
||||
|
||||
public View inflate() {
|
||||
ViewParent parent = getParent();
|
||||
if (!(parent instanceof ViewGroup)) {
|
||||
throw new IllegalStateException("ViewStub must have a non-null ViewGroup viewParent");
|
||||
}
|
||||
if (this.mLayoutResource != 0) {
|
||||
ViewGroup viewGroup = (ViewGroup) parent;
|
||||
LayoutInflater layoutInflater = this.mInflater;
|
||||
if (layoutInflater == null) {
|
||||
layoutInflater = LayoutInflater.from(getContext());
|
||||
}
|
||||
View inflate = layoutInflater.inflate(this.mLayoutResource, viewGroup, false);
|
||||
int i = this.mInflatedId;
|
||||
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.mInflatedViewRef = new WeakReference<>(inflate);
|
||||
OnInflateListener onInflateListener = this.mInflateListener;
|
||||
if (onInflateListener != null) {
|
||||
onInflateListener.onInflate(this, inflate);
|
||||
}
|
||||
return inflate;
|
||||
}
|
||||
throw new IllegalArgumentException("ViewStub must have a valid layoutResource");
|
||||
}
|
||||
}
|
||||
64
02-Easy5/E5/sources/androidx/appcompat/widget/ViewUtils.java
Normal file
64
02-Easy5/E5/sources/androidx/appcompat/widget/ViewUtils.java
Normal file
@@ -0,0 +1,64 @@
|
||||
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 {
|
||||
static final boolean SDK_LEVEL_SUPPORTS_AUTOSIZE;
|
||||
private static final String TAG = "ViewUtils";
|
||||
private static Method sComputeFitSystemWindowsMethod;
|
||||
|
||||
static {
|
||||
SDK_LEVEL_SUPPORTS_AUTOSIZE = Build.VERSION.SDK_INT >= 27;
|
||||
try {
|
||||
Method declaredMethod = View.class.getDeclaredMethod("computeFitSystemWindows", Rect.class, Rect.class);
|
||||
sComputeFitSystemWindowsMethod = declaredMethod;
|
||||
if (declaredMethod.isAccessible()) {
|
||||
return;
|
||||
}
|
||||
sComputeFitSystemWindowsMethod.setAccessible(true);
|
||||
} catch (NoSuchMethodException unused) {
|
||||
Log.d(TAG, "Could not find method computeFitSystemWindows. Oh well.");
|
||||
}
|
||||
}
|
||||
|
||||
private ViewUtils() {
|
||||
}
|
||||
|
||||
public static boolean isLayoutRtl(View view) {
|
||||
return ViewCompat.getLayoutDirection(view) == 1;
|
||||
}
|
||||
|
||||
public static void computeFitSystemWindows(View view, Rect rect, Rect rect2) {
|
||||
Method method = sComputeFitSystemWindowsMethod;
|
||||
if (method != null) {
|
||||
try {
|
||||
method.invoke(view, rect, rect2);
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, "Could not invoke computeFitSystemWindows", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void makeOptionalFitsSystemWindows(View view) {
|
||||
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(TAG, "Could not invoke makeOptionalFitsSystemWindows", e);
|
||||
} catch (NoSuchMethodException unused) {
|
||||
Log.d(TAG, "Could not find method makeOptionalFitsSystemWindows. Oh well...");
|
||||
} catch (InvocationTargetException e2) {
|
||||
Log.d(TAG, "Could not invoke makeOptionalFitsSystemWindows", e2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package androidx.appcompat.widget;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface WithHint {
|
||||
CharSequence getHint();
|
||||
}
|
||||
Reference in New Issue
Block a user