Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,261 @@
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.annotation.NonNull;
import androidx.annotation.Nullable;
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;
public static int next(int i, int i2, boolean z) {
return z ? i - i2 : i + i2;
}
public int getContentHeight() {
return this.mContentHeight;
}
public AbsActionBarView(@NonNull Context context) {
this(context, null);
}
public AbsActionBarView(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public AbsActionBarView(@NonNull Context context, @Nullable 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
public 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();
}
}
public 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);
}
public 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;
}
public class VisibilityAnimListener implements ViewPropertyAnimatorListener {
private boolean mCanceled = false;
int mFinalVisibility;
@Override // androidx.core.view.ViewPropertyAnimatorListener
public void onAnimationCancel(View view) {
this.mCanceled = true;
}
public 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 absActionBarView = AbsActionBarView.this;
absActionBarView.mVisibilityAnim = null;
AbsActionBarView.super.setVisibility(this.mFinalVisibility);
}
}
}

View File

@@ -0,0 +1,79 @@
package androidx.appcompat.widget;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Outline;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
/* 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(@NonNull Canvas canvas) {
ActionBarContainer actionBarContainer = this.mContainer;
if (actionBarContainer.mIsSplit) {
Drawable drawable = actionBarContainer.mSplitBackground;
if (drawable != null) {
drawable.draw(canvas);
return;
}
return;
}
Drawable drawable2 = actionBarContainer.mBackground;
if (drawable2 != null) {
drawable2.draw(canvas);
}
ActionBarContainer actionBarContainer2 = this.mContainer;
Drawable drawable3 = actionBarContainer2.mStackedBackground;
if (drawable3 == null || !actionBarContainer2.mIsStacked) {
return;
}
drawable3.draw(canvas);
}
@Override // android.graphics.drawable.Drawable
@RequiresApi(21)
public void getOutline(@NonNull Outline outline) {
ActionBarContainer actionBarContainer = this.mContainer;
if (actionBarContainer.mIsSplit) {
if (actionBarContainer.mSplitBackground != null) {
Api21Impl.getOutline(actionBarContainer.mBackground, outline);
}
} else {
Drawable drawable = actionBarContainer.mBackground;
if (drawable != null) {
Api21Impl.getOutline(drawable, outline);
}
}
}
@RequiresApi(21)
public static class Api21Impl {
private Api21Impl() {
}
public static void getOutline(Drawable drawable, Outline outline) {
drawable.getOutline(outline);
}
}
}

View File

@@ -0,0 +1,329 @@
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.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import com.google.ar.core.ImageMetadata;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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);
setBackground(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 = false;
if (!this.mIsSplit ? !(this.mBackground != null || this.mStackedBackground != null) : this.mSplitBackground == null) {
z = true;
}
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 = false;
if (!this.mIsSplit ? !(this.mBackground != null || this.mStackedBackground != null) : this.mSplitBackground == null) {
z = true;
}
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
public boolean verifyDrawable(@NonNull 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
public 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 ? ImageMetadata.HOT_PIXEL_MODE : 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();
int measuredHeight2 = measuredHeight - view.getMeasuredHeight();
int i5 = layoutParams.bottomMargin;
view.layout(i, measuredHeight2 - i5, i3, measuredHeight - i5);
}
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();
}
@RequiresApi(21)
public static class Api21Impl {
private Api21Impl() {
}
public static void invalidateOutline(ActionBarContainer actionBarContainer) {
actionBarContainer.invalidateOutline();
}
}
}

View File

@@ -0,0 +1,396 @@
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.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import androidx.appcompat.view.ActionMode;
import androidx.appcompat.view.menu.MenuBuilder;
import androidx.core.view.ViewCompat;
import androidx.core.view.ViewPropertyAnimatorCompat;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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 // androidx.appcompat.widget.AbsActionBarView
public void setContentHeight(int i) {
this.mContentHeight = i;
}
@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(@NonNull Context context) {
this(context, null);
}
public ActionBarContextView(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, R.attr.actionModeStyle);
}
public ActionBarContextView(@NonNull Context context, @Nullable AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
TintTypedArray obtainStyledAttributes = TintTypedArray.obtainStyledAttributes(context, attributeSet, R.styleable.ActionMode, i, 0);
setBackground(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();
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
if (actionMenuPresenter != null) {
actionMenuPresenter.hideOverflowMenu();
this.mActionMenuPresenter.hideSubMenus();
}
}
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);
this.mSubtitleView.setVisibility(z2 ? 0 : 8);
this.mTitleLayout.setVisibility((z || z2) ? 0 : 8);
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();
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
if (actionMenuPresenter != null) {
actionMenuPresenter.dismissPopupMenus();
}
ActionMenuPresenter actionMenuPresenter2 = new ActionMenuPresenter(getContext());
this.mActionMenuPresenter = actionMenuPresenter2;
actionMenuPresenter2.setReserveOverflow(true);
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(-2, -1);
menuBuilder.addMenuPresenter(this.mActionMenuPresenter, this.mPopupContext);
ActionMenuView actionMenuView = (ActionMenuView) this.mActionMenuPresenter.getMenuView(this);
this.mMenuView = actionMenuView;
actionMenuView.setBackground(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() {
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
if (actionMenuPresenter != null) {
return actionMenuPresenter.showOverflowMenu();
}
return false;
}
@Override // androidx.appcompat.widget.AbsActionBarView
public boolean hideOverflowMenu() {
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
if (actionMenuPresenter != null) {
return actionMenuPresenter.hideOverflowMenu();
}
return false;
}
@Override // androidx.appcompat.widget.AbsActionBarView
public boolean isOverflowMenuShowing() {
ActionMenuPresenter actionMenuPresenter = this.mActionMenuPresenter;
if (actionMenuPresenter != null) {
return actionMenuPresenter.isOverflowMenuShowing();
}
return false;
}
@Override // android.view.ViewGroup
public 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
public void onMeasure(int i, int i2) {
if (View.MeasureSpec.getMode(i) != 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 i3 = this.mContentHeight;
if (i3 <= 0) {
i3 = View.MeasureSpec.getSize(i2);
}
int paddingTop = getPaddingTop() + getPaddingBottom();
int paddingLeft = (size - getPaddingLeft()) - getPaddingRight();
int i4 = i3 - paddingTop;
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i4, Integer.MIN_VALUE);
View view = this.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);
}
ActionMenuView actionMenuView = this.mMenuView;
if (actionMenuView != null && actionMenuView.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;
int i6 = i5 != -2 ? 1073741824 : Integer.MIN_VALUE;
if (i5 >= 0) {
paddingLeft = Math.min(i5, paddingLeft);
}
int i7 = layoutParams.height;
int i8 = i7 == -2 ? Integer.MIN_VALUE : 1073741824;
if (i7 >= 0) {
i4 = Math.min(i7, i4);
}
this.mCustomView.measure(View.MeasureSpec.makeMeasureSpec(paddingLeft, i6), View.MeasureSpec.makeMeasureSpec(i4, i8));
}
if (this.mContentHeight <= 0) {
int childCount = getChildCount();
int i9 = 0;
for (int i10 = 0; i10 < childCount; i10++) {
int measuredHeight = getChildAt(i10).getMeasuredHeight() + paddingTop;
if (measuredHeight > i9) {
i9 = measuredHeight;
}
}
setMeasuredDimension(size, i9);
return;
}
setMeasuredDimension(size, i3);
}
@Override // android.view.ViewGroup, android.view.View
public 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 = AbsActionBarView.next(paddingRight, i5, isLayoutRtl);
paddingRight = AbsActionBarView.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();
ActionMenuView actionMenuView = this.mMenuView;
if (actionMenuView != null) {
positionChild(actionMenuView, paddingLeft, paddingTop, paddingTop2, !isLayoutRtl);
}
}
public void setTitleOptional(boolean z) {
if (z != this.mTitleOptional) {
requestLayout();
}
this.mTitleOptional = z;
}
}

View File

@@ -0,0 +1,806 @@
package androidx.appcompat.widget;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.SuppressLint;
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.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
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;
@SuppressLint({"UnknownNullness"})
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public class ActionBarOverlayLayout extends ViewGroup implements DecorContentParent, NestedScrollingParent, NestedScrollingParent2, NestedScrollingParent3 {
private static final int ACTION_BAR_ANIMATE_DELAY = 600;
private static final String TAG = "ActionBarOverlayLayout";
private int mActionBarHeight;
ActionBarContainer mActionBarTop;
private ActionBarVisibilityCallback mActionBarVisibilityCallback;
private final Runnable mAddActionBarHideOffset;
boolean mAnimatingForFling;
private final Rect mBaseContentInsets;
@NonNull
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;
@NonNull
private WindowInsetsCompat mInnerInsets;
private final Rect mInnerInsetsRect;
private final Rect mLastBaseContentInsets;
@NonNull
private WindowInsetsCompat mLastBaseInnerInsets;
private final Rect mLastBaseInnerInsetsRect;
@NonNull
private WindowInsetsCompat mLastInnerInsets;
private final Rect mLastInnerInsetsRect;
private int mLastSystemUiVisibility;
private final NoSystemUiLayoutFlagView mNoSystemUiLayoutFlagView;
private boolean mOverlayMode;
private final NestedScrollingParentHelper mParentHelper;
private final Runnable mRemoveActionBarHideOffset;
private final Rect mTmpRect;
final AnimatorListenerAdapter mTopAnimatorListener;
private Drawable mWindowContentOverlay;
private int mWindowVisibility;
static final int[] ATTRS = {R.attr.actionBarSize, android.R.attr.windowContentOverlay};
private static final WindowInsetsCompat NON_EMPTY_SYSTEM_WINDOW_INSETS = new WindowInsetsCompat.Builder().setSystemWindowInsets(Insets.of(0, 1, 0, 1)).build();
private static final Rect ZERO_INSETS = new Rect();
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 setOverlayMode(boolean z) {
this.mOverlayMode = 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 static final class NoSystemUiLayoutFlagView extends View {
@Override // android.view.View
public int getWindowSystemUiVisibility() {
return 0;
}
public NoSystemUiLayoutFlagView(Context context) {
super(context);
setWillNotDraw(true);
}
}
public ActionBarOverlayLayout(@NonNull Context context) {
this(context, null);
}
public ActionBarOverlayLayout(@NonNull Context context, @Nullable AttributeSet attributeSet) {
super(context, attributeSet);
this.mWindowVisibility = 0;
this.mBaseContentInsets = new Rect();
this.mLastBaseContentInsets = new Rect();
this.mContentInsets = new Rect();
this.mTmpRect = new Rect();
this.mBaseInnerInsetsRect = new Rect();
this.mLastBaseInnerInsetsRect = new Rect();
this.mInnerInsetsRect = new Rect();
this.mLastInnerInsetsRect = new Rect();
WindowInsetsCompat windowInsetsCompat = WindowInsetsCompat.CONSUMED;
this.mBaseInnerInsets = windowInsetsCompat;
this.mLastBaseInnerInsets = windowInsetsCompat;
this.mInnerInsets = windowInsetsCompat;
this.mLastInnerInsets = windowInsetsCompat;
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 actionBarOverlayLayout = ActionBarOverlayLayout.this;
actionBarOverlayLayout.mCurrentActionBarTopAnimator = null;
actionBarOverlayLayout.mAnimatingForFling = false;
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public void onAnimationCancel(Animator animator) {
ActionBarOverlayLayout actionBarOverlayLayout = ActionBarOverlayLayout.this;
actionBarOverlayLayout.mCurrentActionBarTopAnimator = null;
actionBarOverlayLayout.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);
NoSystemUiLayoutFlagView noSystemUiLayoutFlagView = new NoSystemUiLayoutFlagView(context);
this.mNoSystemUiLayoutFlagView = noSystemUiLayoutFlagView;
addView(noSystemUiLayoutFlagView);
}
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.mFlingEstimator = new OverScroller(context);
}
@Override // android.view.ViewGroup, android.view.View
public 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);
}
}
}
@Override // android.view.View
public 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
public void onWindowVisibilityChanged(int i) {
super.onWindowVisibilityChanged(i);
this.mWindowVisibility = i;
ActionBarVisibilityCallback actionBarVisibilityCallback = this.mActionBarVisibilityCallback;
if (actionBarVisibilityCallback != null) {
actionBarVisibilityCallback.onWindowVisibilityChanged(i);
}
}
/* JADX WARN: Removed duplicated region for block: B:11:0x0021 */
/* JADX WARN: Removed duplicated region for block: B:15:0x002c */
/* JADX WARN: Removed duplicated region for block: B:7:0x0016 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private boolean applyInsets(@androidx.annotation.NonNull android.view.View r3, @androidx.annotation.NonNull android.graphics.Rect r4, boolean r5, boolean r6, boolean r7, boolean r8) {
/*
r2 = this;
android.view.ViewGroup$LayoutParams r3 = r3.getLayoutParams()
androidx.appcompat.widget.ActionBarOverlayLayout$LayoutParams r3 = (androidx.appcompat.widget.ActionBarOverlayLayout.LayoutParams) r3
r0 = 1
if (r5 == 0) goto L13
int r5 = r3.leftMargin
int r1 = r4.left
if (r5 == r1) goto L13
r3.leftMargin = r1
r5 = r0
goto L14
L13:
r5 = 0
L14:
if (r6 == 0) goto L1f
int r6 = r3.topMargin
int r1 = r4.top
if (r6 == r1) goto L1f
r3.topMargin = r1
r5 = r0
L1f:
if (r8 == 0) goto L2a
int r6 = r3.rightMargin
int r8 = r4.right
if (r6 == r8) goto L2a
r3.rightMargin = r8
r5 = r0
L2a:
if (r7 == 0) goto L35
int r6 = r3.bottomMargin
int r4 = r4.bottom
if (r6 == r4) goto L35
r3.bottomMargin = r4
goto L36
L35:
r0 = r5
L36:
return r0
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.ActionBarOverlayLayout.applyInsets(android.view.View, android.graphics.Rect, boolean, boolean, boolean, boolean):boolean");
}
@Override // android.view.View
public boolean fitSystemWindows(Rect rect) {
return super.fitSystemWindows(rect);
}
private boolean decorFitsSystemWindows() {
ViewCompat.computeSystemWindowInsets(this.mNoSystemUiLayoutFlagView, NON_EMPTY_SYSTEM_WINDOW_INSETS, this.mTmpRect);
return !this.mTmpRect.equals(ZERO_INSETS);
}
/* JADX WARN: Code restructure failed: missing block: B:11:0x005b, code lost:
if (r0 != false) goto L9;
*/
@Override // android.view.View
@androidx.annotation.RequiresApi(21)
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public android.view.WindowInsets onApplyWindowInsets(@androidx.annotation.NonNull 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 r2 = r1.left
int r3 = r1.top
int r4 = r1.right
int r1 = r1.bottom
androidx.core.view.WindowInsetsCompat r1 = r8.inset(r2, r3, r4, r1)
r7.mBaseInnerInsets = r1
androidx.core.view.WindowInsetsCompat r2 = r7.mLastBaseInnerInsets
boolean r1 = r2.equals(r1)
if (r1 != 0) goto L49
androidx.core.view.WindowInsetsCompat r0 = r7.mBaseInnerInsets
r7.mLastBaseInnerInsets = r0
r0 = 1
L49:
android.graphics.Rect r1 = r7.mLastBaseContentInsets
android.graphics.Rect r2 = r7.mBaseContentInsets
boolean r1 = r1.equals(r2)
if (r1 != 0) goto L5b
android.graphics.Rect r0 = r7.mLastBaseContentInsets
android.graphics.Rect r1 = r7.mBaseContentInsets
r0.set(r1)
goto L5d
L5b:
if (r0 == 0) goto L60
L5d:
r7.requestLayout()
L60:
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");
}
@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
public ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
return new LayoutParams(layoutParams);
}
@Override // android.view.ViewGroup
public boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
return layoutParams instanceof LayoutParams;
}
@Override // android.view.View
public 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() + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin);
int max2 = Math.max(0, this.mActionBarTop.getMeasuredHeight() + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin + ((ViewGroup.MarginLayoutParams) 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 && decorFitsSystemWindows()) {
Rect rect = this.mContentInsets;
rect.top += measuredHeight;
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() + ((ViewGroup.MarginLayoutParams) layoutParams2).leftMargin + ((ViewGroup.MarginLayoutParams) layoutParams2).rightMargin);
int max4 = Math.max(max2, this.mContent.getMeasuredHeight() + ((ViewGroup.MarginLayoutParams) layoutParams2).topMargin + ((ViewGroup.MarginLayoutParams) 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
public 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 = ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin + paddingLeft;
int i7 = ((ViewGroup.MarginLayoutParams) layoutParams).topMargin + paddingTop;
childAt.layout(i6, i7, measuredWidth + i6, measuredHeight + i7);
}
}
}
@Override // android.view.View
public void draw(@NonNull Canvas canvas) {
super.draw(canvas);
if (this.mWindowContentOverlay != null) {
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();
}
public 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())));
}
public 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);
}
}
}

View File

@@ -0,0 +1,729 @@
package androidx.appcompat.widget;
import android.annotation.SuppressLint;
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.annotation.NonNull;
import androidx.annotation.Nullable;
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(@NonNull Context context, @Nullable 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();
}
MenuBuilder menuBuilder = this.mMenu;
if (menuBuilder != null) {
menuBuilder.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();
MenuBuilder menuBuilder = this.mMenu;
if (menuBuilder != null) {
ArrayList<MenuItemImpl> actionItems = menuBuilder.getActionItems();
int size2 = actionItems.size();
for (int i = 0; i < size2; i++) {
ActionProvider supportActionProvider = actionItems.get(i).getSupportActionProvider();
if (supportActionProvider != null) {
supportActionProvider.setSubUiVisibilityListener(this);
}
}
}
MenuBuilder menuBuilder2 = this.mMenu;
ArrayList<MenuItemImpl> nonActionItems = menuBuilder2 != null ? menuBuilder2.getNonActionItems() : null;
if (!this.mReserveOverflow || nonActionItems == null || ((size = nonActionItems.size()) != 1 ? size <= 0 : !(!nonActionItems.get(0).isActionViewExpanded()))) {
OverflowMenuButton overflowMenuButton = this.mOverflowButton;
if (overflowMenuButton != null) {
Object parent = overflowMenuButton.getParent();
Object obj = this.mMenuView;
if (parent == obj) {
((ViewGroup) obj).removeView(this.mOverflowButton);
}
}
} else {
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());
}
}
((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() {
MenuBuilder menuBuilder;
if (!this.mReserveOverflow || isOverflowMenuShowing() || (menuBuilder = this.mMenu) == null || this.mMenuView == null || this.mPostedOpenRunnable != null || menuBuilder.getNonActionItems().isEmpty()) {
return false;
}
OpenOverflowRunnable openOverflowRunnable = new OpenOverflowRunnable(new OverflowPopup(this.mContext, this.mMenu, this.mOverflowButton, true));
this.mPostedOpenRunnable = openOverflowRunnable;
((View) this.mMenuView).post(openOverflowRunnable);
return true;
}
public boolean hideOverflowMenu() {
Object obj;
OpenOverflowRunnable openOverflowRunnable = this.mPostedOpenRunnable;
if (openOverflowRunnable != null && (obj = this.mMenuView) != null) {
((View) obj).removeCallbacks(openOverflowRunnable);
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();
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r3v0 */
/* JADX WARN: Type inference failed for: r3v1, types: [int] */
/* JADX WARN: Type inference failed for: r3v12 */
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
public boolean flagActionItems() {
ArrayList<MenuItemImpl> arrayList;
int i;
int i2;
int i3;
boolean z;
int i4;
ActionMenuPresenter actionMenuPresenter = this;
MenuBuilder menuBuilder = actionMenuPresenter.mMenu;
View view = null;
?? r3 = 0;
if (menuBuilder != null) {
arrayList = menuBuilder.getVisibleItems();
i = arrayList.size();
} else {
arrayList = null;
i = 0;
}
int i5 = actionMenuPresenter.mMaxItems;
int i6 = actionMenuPresenter.mActionItemWidthLimit;
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
ViewGroup viewGroup = (ViewGroup) actionMenuPresenter.mMenuView;
boolean z2 = false;
int i7 = 0;
int i8 = 0;
for (int i9 = 0; i9 < i; i9++) {
MenuItemImpl menuItemImpl = arrayList.get(i9);
if (menuItemImpl.requiresActionButton()) {
i7++;
} else if (menuItemImpl.requestsActionButton()) {
i8++;
} else {
z2 = true;
}
if (actionMenuPresenter.mExpandedActionViewsExclusive && menuItemImpl.isActionViewExpanded()) {
i5 = 0;
}
}
if (actionMenuPresenter.mReserveOverflow && (z2 || i8 + i7 > i5)) {
i5--;
}
int i10 = i5 - i7;
SparseBooleanArray sparseBooleanArray = actionMenuPresenter.mActionButtonGroups;
sparseBooleanArray.clear();
if (actionMenuPresenter.mStrictWidthLimit) {
int i11 = actionMenuPresenter.mMinCellSize;
i3 = i6 / i11;
i2 = i11 + ((i6 % i11) / i3);
} else {
i2 = 0;
i3 = 0;
}
int i12 = 0;
int i13 = 0;
while (i12 < i) {
MenuItemImpl menuItemImpl2 = arrayList.get(i12);
if (menuItemImpl2.requiresActionButton()) {
View itemView = actionMenuPresenter.getItemView(menuItemImpl2, view, viewGroup);
if (actionMenuPresenter.mStrictWidthLimit) {
i3 -= ActionMenuView.measureChildForCells(itemView, i2, i3, makeMeasureSpec, r3);
} else {
itemView.measure(makeMeasureSpec, makeMeasureSpec);
}
int measuredWidth = itemView.getMeasuredWidth();
i6 -= measuredWidth;
if (i13 == 0) {
i13 = measuredWidth;
}
int groupId = menuItemImpl2.getGroupId();
if (groupId != 0) {
sparseBooleanArray.put(groupId, true);
}
menuItemImpl2.setIsActionButton(true);
z = r3;
i4 = i;
} else if (menuItemImpl2.requestsActionButton()) {
int groupId2 = menuItemImpl2.getGroupId();
boolean z3 = sparseBooleanArray.get(groupId2);
boolean z4 = (i10 > 0 || z3) && i6 > 0 && (!actionMenuPresenter.mStrictWidthLimit || i3 > 0);
boolean z5 = z4;
i4 = i;
if (z4) {
View itemView2 = actionMenuPresenter.getItemView(menuItemImpl2, null, viewGroup);
if (actionMenuPresenter.mStrictWidthLimit) {
int measureChildForCells = ActionMenuView.measureChildForCells(itemView2, i2, i3, makeMeasureSpec, 0);
i3 -= measureChildForCells;
if (measureChildForCells == 0) {
z5 = false;
}
} else {
itemView2.measure(makeMeasureSpec, makeMeasureSpec);
}
boolean z6 = z5;
int measuredWidth2 = itemView2.getMeasuredWidth();
i6 -= measuredWidth2;
if (i13 == 0) {
i13 = measuredWidth2;
}
z4 = z6 & (!actionMenuPresenter.mStrictWidthLimit ? i6 + i13 <= 0 : i6 < 0);
}
if (z4 && groupId2 != 0) {
sparseBooleanArray.put(groupId2, true);
} else if (z3) {
sparseBooleanArray.put(groupId2, false);
for (int i14 = 0; i14 < i12; i14++) {
MenuItemImpl menuItemImpl3 = arrayList.get(i14);
if (menuItemImpl3.getGroupId() == groupId2) {
if (menuItemImpl3.isActionButton()) {
i10++;
}
menuItemImpl3.setIsActionButton(false);
}
}
}
if (z4) {
i10--;
}
menuItemImpl2.setIsActionButton(z4);
z = false;
} else {
z = r3;
i4 = i;
menuItemImpl2.setIsActionButton(z);
}
i12++;
r3 = z;
i = i4;
view = null;
actionMenuPresenter = this;
}
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) {
int i;
MenuItem findItem;
if ((parcelable instanceof SavedState) && (i = ((SavedState) parcelable).openSubMenuId) > 0 && (findItem = this.mMenu.findItem(i)) != null) {
onSubMenuSelected((SubMenuBuilder) findItem.getSubMenu());
}
}
@Override // androidx.core.view.ActionProvider.SubUiVisibilityListener
public void onSubUiVisibilityChanged(boolean z) {
if (z) {
super.onSubMenuSelected(null);
return;
}
MenuBuilder menuBuilder = this.mMenu;
if (menuBuilder != null) {
menuBuilder.close(false);
}
}
public void setMenuView(ActionMenuView actionMenuView) {
this.mMenuView = actionMenuView;
actionMenuView.initialize(this.mMenu);
}
@SuppressLint({"BanParcelableUsage"})
public 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;
}
public SavedState() {
}
public SavedState(Parcel parcel) {
this.openSubMenuId = parcel.readInt();
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
parcel.writeInt(this.openSubMenuId);
}
}
public 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() {
OverflowPopup overflowPopup = ActionMenuPresenter.this.mOverflowPopup;
if (overflowPopup == null) {
return null;
}
return overflowPopup.getPopup();
}
@Override // androidx.appcompat.widget.ForwardingListener
public boolean onForwardingStarted() {
ActionMenuPresenter.this.showOverflowMenu();
return true;
}
@Override // androidx.appcompat.widget.ForwardingListener
public boolean onForwardingStopped() {
ActionMenuPresenter actionMenuPresenter = ActionMenuPresenter.this;
if (actionMenuPresenter.mPostedOpenRunnable != null) {
return false;
}
actionMenuPresenter.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
public 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;
}
}
public 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
public void onDismiss() {
if (((BaseMenuPresenter) ActionMenuPresenter.this).mMenu != null) {
((BaseMenuPresenter) ActionMenuPresenter.this).mMenu.close();
}
ActionMenuPresenter.this.mOverflowPopup = null;
super.onDismiss();
}
}
public 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()) {
View view2 = ActionMenuPresenter.this.mOverflowButton;
setAnchorView(view2 == null ? (View) ((BaseMenuPresenter) ActionMenuPresenter.this).mMenuView : view2);
}
setPresenterCallback(ActionMenuPresenter.this.mPopupPresenterCallback);
}
@Override // androidx.appcompat.view.menu.MenuPopupHelper
public void onDismiss() {
ActionMenuPresenter actionMenuPresenter = ActionMenuPresenter.this;
actionMenuPresenter.mActionButtonPopup = null;
actionMenuPresenter.mOpenSubMenuId = 0;
super.onDismiss();
}
}
public class PopupPresenterCallback implements MenuPresenter.Callback {
public PopupPresenterCallback() {
}
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
public boolean onOpenSubMenu(@NonNull MenuBuilder menuBuilder) {
if (menuBuilder == ((BaseMenuPresenter) 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(@NonNull 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);
}
}
}
public class OpenOverflowRunnable implements Runnable {
private OverflowPopup mPopup;
public OpenOverflowRunnable(OverflowPopup overflowPopup) {
this.mPopup = overflowPopup;
}
@Override // java.lang.Runnable
public void run() {
if (((BaseMenuPresenter) ActionMenuPresenter.this).mMenu != null) {
((BaseMenuPresenter) ActionMenuPresenter.this).mMenu.changeMenuMode();
}
View view = (View) ((BaseMenuPresenter) ActionMenuPresenter.this).mMenuView;
if (view != null && view.getWindowToken() != null && this.mPopup.tryShow()) {
ActionMenuPresenter.this.mOverflowPopup = this.mPopup;
}
ActionMenuPresenter.this.mPostedOpenRunnable = null;
}
}
public class ActionMenuPopupCallback extends ActionMenuItemView.PopupCallback {
public ActionMenuPopupCallback() {
}
@Override // androidx.appcompat.view.menu.ActionMenuItemView.PopupCallback
public ShowableListMenu getPopup() {
ActionButtonSubmenu actionButtonSubmenu = ActionMenuPresenter.this.mActionButtonPopup;
if (actionButtonSubmenu != null) {
return actionButtonSubmenu.getPopup();
}
return null;
}
}
}

View File

@@ -0,0 +1,709 @@
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 android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.StyleRes;
import androidx.appcompat.view.menu.ActionMenuItemView;
import androidx.appcompat.view.menu.MenuBuilder;
import androidx.appcompat.view.menu.MenuItemImpl;
import androidx.appcompat.view.menu.MenuPresenter;
import androidx.appcompat.view.menu.MenuView;
import androidx.appcompat.widget.LinearLayoutCompat;
/* loaded from: classes.dex */
public class ActionMenuView extends LinearLayoutCompat implements MenuBuilder.ItemInvoker, MenuView {
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;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public interface ActionMenuChildView {
boolean needsDividerAfter();
boolean needsDividerBefore();
}
public static class ActionMenuPresenterCallback implements MenuPresenter.Callback {
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
public void onCloseMenu(@NonNull MenuBuilder menuBuilder, boolean z) {
}
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
public boolean onOpenSubMenu(@NonNull MenuBuilder menuBuilder) {
return false;
}
}
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
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public int getWindowAnimations() {
return 0;
}
@Override // androidx.appcompat.view.menu.MenuView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void initialize(MenuBuilder menuBuilder) {
this.mMenu = menuBuilder;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public boolean isOverflowReserved() {
return this.mReserveOverflow;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public MenuBuilder peekMenu() {
return this.mMenu;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setMenuCallbacks(MenuPresenter.Callback callback, MenuBuilder.Callback callback2) {
this.mActionMenuPresenterCallback = callback;
this.mMenuBuilderCallback = callback2;
}
public void setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener) {
this.mOnMenuItemClickListener = onMenuItemClickListener;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setOverflowReserved(boolean z) {
this.mReserveOverflow = z;
}
public ActionMenuView(@NonNull Context context) {
this(context, null);
}
public ActionMenuView(@NonNull Context context, @Nullable 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(@StyleRes int i) {
if (this.mPopupTheme != i) {
this.mPopupTheme = i;
if (i == 0) {
this.mPopupContext = getContext();
} else {
this.mPopupContext = new ContextThemeWrapper(getContext(), i);
}
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
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
public 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();
((LinearLayout.LayoutParams) layoutParams).rightMargin = 0;
((LinearLayout.LayoutParams) layoutParams).leftMargin = 0;
}
super.onMeasure(i, i2);
}
/* JADX WARN: Type inference failed for: r14v10 */
/* JADX WARN: Type inference failed for: r14v11, types: [boolean, int] */
/* JADX WARN: Type inference failed for: r14v14 */
private void onMeasureExactFormat(int i, int i2) {
int i3;
int i4;
boolean z;
int i5;
int i6;
boolean z2;
boolean z3;
int i7;
?? 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 = ViewGroup.getChildMeasureSpec(i2, paddingTop, -2);
int i8 = size - paddingLeft;
int i9 = this.mMinCellSize;
int i10 = i8 / i9;
int i11 = i8 % i9;
if (i10 == 0) {
setMeasuredDimension(i8, 0);
return;
}
int i12 = i9 + (i11 / i10);
int childCount = getChildCount();
int i13 = 0;
int i14 = 0;
boolean z4 = false;
int i15 = 0;
int i16 = 0;
int i17 = 0;
long j = 0;
while (i14 < childCount) {
View childAt = getChildAt(i14);
int i18 = size2;
if (childAt.getVisibility() != 8) {
boolean z5 = childAt instanceof ActionMenuItemView;
int i19 = i15 + 1;
if (z5) {
int i20 = this.mGeneratedItemPadding;
i7 = i19;
r14 = 0;
childAt.setPadding(i20, 0, i20, 0);
} else {
i7 = i19;
r14 = 0;
}
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
layoutParams.expanded = r14;
layoutParams.extraPixels = r14;
layoutParams.cellsUsed = r14;
layoutParams.expandable = r14;
((LinearLayout.LayoutParams) layoutParams).leftMargin = r14;
((LinearLayout.LayoutParams) layoutParams).rightMargin = r14;
layoutParams.preventEdgeOffset = z5 && ((ActionMenuItemView) childAt).hasText();
int measureChildForCells = measureChildForCells(childAt, i12, layoutParams.isOverflowButton ? 1 : i10, childMeasureSpec, paddingTop);
i16 = Math.max(i16, measureChildForCells);
if (layoutParams.expandable) {
i17++;
}
if (layoutParams.isOverflowButton) {
z4 = true;
}
i10 -= measureChildForCells;
i13 = Math.max(i13, childAt.getMeasuredHeight());
if (measureChildForCells == 1) {
j |= 1 << i14;
i13 = i13;
}
i15 = i7;
}
i14++;
size2 = i18;
}
int i21 = size2;
boolean z6 = z4 && i15 == 2;
boolean z7 = false;
while (i17 > 0 && i10 > 0) {
int i22 = Integer.MAX_VALUE;
int i23 = 0;
int i24 = 0;
long j2 = 0;
while (i24 < childCount) {
boolean z8 = z7;
LayoutParams layoutParams2 = (LayoutParams) getChildAt(i24).getLayoutParams();
int i25 = i13;
if (layoutParams2.expandable) {
int i26 = layoutParams2.cellsUsed;
if (i26 < i22) {
j2 = 1 << i24;
i22 = i26;
i23 = 1;
} else if (i26 == i22) {
i23++;
j2 |= 1 << i24;
}
}
i24++;
i13 = i25;
z7 = z8;
}
z = z7;
i5 = i13;
j |= j2;
if (i23 > i10) {
i3 = mode;
i4 = i8;
break;
}
int i27 = i22 + 1;
int i28 = 0;
while (i28 < childCount) {
View childAt2 = getChildAt(i28);
LayoutParams layoutParams3 = (LayoutParams) childAt2.getLayoutParams();
int i29 = i8;
int i30 = mode;
long j3 = 1 << i28;
if ((j2 & j3) == 0) {
if (layoutParams3.cellsUsed == i27) {
j |= j3;
}
z3 = z6;
} else {
if (z6 && layoutParams3.preventEdgeOffset && i10 == 1) {
int i31 = this.mGeneratedItemPadding;
z3 = z6;
childAt2.setPadding(i31 + i12, 0, i31, 0);
} else {
z3 = z6;
}
layoutParams3.cellsUsed++;
layoutParams3.expanded = true;
i10--;
}
i28++;
mode = i30;
i8 = i29;
z6 = z3;
}
i13 = i5;
z7 = true;
}
i3 = mode;
i4 = i8;
z = z7;
i5 = i13;
boolean z9 = !z4 && i15 == 1;
if (i10 <= 0 || j == 0 || (i10 >= i15 - 1 && !z9 && i16 <= 1)) {
i6 = 0;
z2 = z;
} else {
float bitCount = Long.bitCount(j);
if (z9) {
i6 = 0;
} else {
i6 = 0;
if ((j & 1) != 0 && !((LayoutParams) getChildAt(0).getLayoutParams()).preventEdgeOffset) {
bitCount -= 0.5f;
}
int i32 = childCount - 1;
if ((j & (1 << i32)) != 0 && !((LayoutParams) getChildAt(i32).getLayoutParams()).preventEdgeOffset) {
bitCount -= 0.5f;
}
}
int i33 = bitCount > 0.0f ? (int) ((i10 * i12) / bitCount) : i6;
z2 = z;
for (int i34 = i6; i34 < childCount; i34++) {
if ((j & (1 << i34)) != 0) {
View childAt3 = getChildAt(i34);
LayoutParams layoutParams4 = (LayoutParams) childAt3.getLayoutParams();
if (childAt3 instanceof ActionMenuItemView) {
layoutParams4.extraPixels = i33;
layoutParams4.expanded = true;
if (i34 == 0 && !layoutParams4.preventEdgeOffset) {
((LinearLayout.LayoutParams) layoutParams4).leftMargin = (-i33) / 2;
}
z2 = true;
} else if (layoutParams4.isOverflowButton) {
layoutParams4.extraPixels = i33;
layoutParams4.expanded = true;
((LinearLayout.LayoutParams) layoutParams4).rightMargin = (-i33) / 2;
z2 = true;
} else {
if (i34 != 0) {
((LinearLayout.LayoutParams) layoutParams4).leftMargin = i33 / 2;
}
if (i34 != childCount - 1) {
((LinearLayout.LayoutParams) layoutParams4).rightMargin = i33 / 2;
}
}
}
}
}
if (z2) {
for (int i35 = i6; i35 < childCount; i35++) {
View childAt4 = getChildAt(i35);
LayoutParams layoutParams5 = (LayoutParams) childAt4.getLayoutParams();
if (layoutParams5.expanded) {
childAt4.measure(View.MeasureSpec.makeMeasureSpec((layoutParams5.cellsUsed * i12) + layoutParams5.extraPixels, 1073741824), childMeasureSpec);
}
}
}
setMeasuredDimension(i4, i3 != 1073741824 ? i5 : i21);
}
public 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 = false;
boolean z2 = actionMenuItemView != null && actionMenuItemView.hasText();
if (i2 > 0) {
i5 = 2;
if (!z2 || 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 (!z2 || i6 >= 2) {
i5 = i6;
}
if (!layoutParams.isOverflowButton && z2) {
z = true;
}
layoutParams.expandable = z;
layoutParams.cellsUsed = i5;
view.measure(View.MeasureSpec.makeMeasureSpec(i * i5, 1073741824), makeMeasureSpec);
return i5;
}
}
i5 = 0;
if (!layoutParams.isOverflowButton) {
z = true;
}
layoutParams.expandable = z;
layoutParams.cellsUsed = i5;
view.measure(View.MeasureSpec.makeMeasureSpec(i * i5, 1073741824), makeMeasureSpec);
return i5;
}
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup, android.view.View
public 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() + ((LinearLayout.LayoutParams) layoutParams).leftMargin;
width = i5 + measuredWidth;
} else {
width = (getWidth() - getPaddingRight()) - ((LinearLayout.LayoutParams) 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() + ((LinearLayout.LayoutParams) layoutParams).leftMargin) + ((LinearLayout.LayoutParams) 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 - ((LinearLayout.LayoutParams) 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 + ((LinearLayout.LayoutParams) 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 + ((LinearLayout.LayoutParams) 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 + ((LinearLayout.LayoutParams) layoutParams3).rightMargin + max;
}
}
}
@Override // android.view.ViewGroup, android.view.View
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
dismissPopupMenus();
}
public void setOverflowIcon(@Nullable Drawable drawable) {
getMenu();
this.mPresenter.setOverflowIcon(drawable);
}
@Nullable
public Drawable getOverflowIcon() {
getMenu();
return this.mPresenter.getOverflowIcon();
}
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
public LayoutParams generateDefaultLayoutParams() {
LayoutParams layoutParams = new LayoutParams(-2, -2);
((LinearLayout.LayoutParams) layoutParams).gravity = 16;
return layoutParams;
}
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
public LayoutParams generateLayoutParams(AttributeSet attributeSet) {
return new LayoutParams(getContext(), attributeSet);
}
@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 (((LinearLayout.LayoutParams) layoutParams2).gravity <= 0) {
((LinearLayout.LayoutParams) layoutParams2).gravity = 16;
}
return layoutParams2;
}
return generateDefaultLayoutParams();
}
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
public boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
return layoutParams instanceof LayoutParams;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public LayoutParams generateOverflowButtonLayoutParams() {
LayoutParams generateDefaultLayoutParams = generateDefaultLayoutParams();
generateDefaultLayoutParams.isOverflowButton = true;
return generateDefaultLayoutParams;
}
@Override // androidx.appcompat.view.menu.MenuBuilder.ItemInvoker
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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();
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public boolean isOverflowMenuShowPending() {
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
return actionMenuPresenter != null && actionMenuPresenter.isOverflowMenuShowPending();
}
public void dismissPopupMenus() {
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
if (actionMenuPresenter != null) {
actionMenuPresenter.dismissPopupMenus();
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public 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();
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setExpandedActionViewsExclusive(boolean z) {
this.mPresenter.setExpandedActionViewsExclusive(z);
}
public class MenuBuilderCallback implements MenuBuilder.Callback {
public MenuBuilderCallback() {
}
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
public boolean onMenuItemSelected(@NonNull MenuBuilder menuBuilder, @NonNull MenuItem menuItem) {
OnMenuItemClickListener onMenuItemClickListener = ActionMenuView.this.mOnMenuItemClickListener;
return onMenuItemClickListener != null && onMenuItemClickListener.onMenuItemClick(menuItem);
}
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
public void onMenuModeChange(@NonNull MenuBuilder menuBuilder) {
MenuBuilder.Callback callback = ActionMenuView.this.mMenuBuilderCallback;
if (callback != null) {
callback.onMenuModeChange(menuBuilder);
}
}
}
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;
}
public LayoutParams(int i, int i2, boolean z) {
super(i, i2);
this.isOverflowButton = z;
}
}
}

View File

@@ -0,0 +1,537 @@
package androidx.appcompat.widget;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
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 com.ironsource.v8;
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) {
try {
Map<String, ActivityChooserModel> map = sDataModelRegistry;
activityChooserModel = map.get(str);
if (activityChooserModel == null) {
activityChooserModel = new ActivityChooserModel(context, str);
map.put(str, activityChooserModel);
}
} catch (Throwable th) {
throw th;
}
}
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) {
try {
if (this.mIntent == intent) {
return;
}
this.mIntent = intent;
this.mReloadActivities = true;
ensureConsistentState();
} catch (Throwable th) {
throw th;
}
}
}
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) {
try {
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;
} catch (Throwable th) {
throw th;
}
}
}
public Intent chooseActivity(int i) {
synchronized (this.mInstanceLock) {
try {
if (this.mIntent == null) {
return null;
}
ensureConsistentState();
ActivityInfo activityInfo = this.mActivities.get(i).resolveInfo.activityInfo;
ComponentName componentName = new ComponentName(activityInfo.packageName, 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(), DEFAULT_HISTORICAL_RECORD_WEIGHT));
return intent;
} catch (Throwable th) {
throw th;
}
}
}
public void setOnChooseActivityListener(OnChooseActivityListener onChooseActivityListener) {
synchronized (this.mInstanceLock) {
this.mActivityChoserModelPolicy = onChooseActivityListener;
}
}
public ResolveInfo getDefaultActivity() {
synchronized (this.mInstanceLock) {
try {
ensureConsistentState();
if (this.mActivities.isEmpty()) {
return null;
}
return this.mActivities.get(0).resolveInfo;
} catch (Throwable th) {
throw th;
}
}
}
public void setDefaultActivity(int i) {
synchronized (this.mInstanceLock) {
try {
ensureConsistentState();
ActivityResolveInfo activityResolveInfo = this.mActivities.get(i);
ActivityResolveInfo activityResolveInfo2 = this.mActivities.get(0);
float f = activityResolveInfo2 != null ? (activityResolveInfo2.weight - activityResolveInfo.weight) + 5.0f : DEFAULT_HISTORICAL_RECORD_WEIGHT;
ActivityInfo activityInfo = activityResolveInfo.resolveInfo.activityInfo;
addHistoricalRecord(new HistoricalRecord(new ComponentName(activityInfo.packageName, activityInfo.name), System.currentTimeMillis(), f));
} catch (Throwable th) {
throw th;
}
}
}
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) {
try {
if (this.mActivitySorter == activitySorter) {
return;
}
this.mActivitySorter = activitySorter;
if (sortActivitiesIfNeeded()) {
notifyChanged();
}
} catch (Throwable th) {
throw th;
}
}
}
public void setHistoryMaxSize(int i) {
synchronized (this.mInstanceLock) {
try {
if (this.mHistoryMaxSize == i) {
return;
}
this.mHistoryMaxSize = i;
pruneExcessiveHistoricalRecordsIfNeeded();
if (sortActivitiesIfNeeded()) {
notifyChanged();
}
} catch (Throwable th) {
throw th;
}
}
}
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 || HistoricalRecord.class != 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 v8.i.d + "; activity:" + this.activity + "; time:" + this.time + "; weight:" + new BigDecimal(this.weight) + v8.i.e;
}
}
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 && ActivityResolveInfo.class == 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 v8.i.d + "resolveInfo:" + this.resolveInfo.toString() + "; weight:" + new BigDecimal(this.weight) + v8.i.e;
}
}
public static final class DefaultSorter implements ActivitySorter {
private static final float WEIGHT_DECAY_COEFFICIENT = 0.95f;
private final Map<ComponentName, ActivityResolveInfo> mPackageNameToActivityMap = new HashMap();
@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;
ActivityInfo activityInfo = activityResolveInfo.resolveInfo.activityInfo;
map.put(new ComponentName(activityInfo.packageName, activityInfo.name), activityResolveInfo);
}
float f = ActivityChooserModel.DEFAULT_HISTORICAL_RECORD_WEIGHT;
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() {
FileInputStream openFileInput;
XmlPullParser newPullParser;
try {
try {
openFileInput = this.mContext.openFileInput(this.mHistoryFileName);
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 (FileNotFoundException unused2) {
}
} catch (Throwable th) {
if (openFileInput != null) {
try {
openFileInput.close();
} catch (IOException unused3) {
}
}
throw th;
}
}
public final class PersistHistoryAsyncTask extends AsyncTask<Object, Void, Void> {
public PersistHistoryAsyncTask() {
}
/* JADX WARN: Code restructure failed: missing block: B:12:0x0074, code lost:
if (r15 != null) goto L44;
*/
/* JADX WARN: Code restructure failed: missing block: B:16:0x0076, code lost:
r15.close();
*/
/* JADX WARN: Code restructure failed: missing block: B:33:0x0096, code lost:
if (r15 == null) goto L33;
*/
/* JADX WARN: Code restructure failed: missing block: B:38:0x00b5, code lost:
if (r15 == null) goto L33;
*/
/* JADX WARN: Code restructure failed: missing block: B:43:0x00d4, code lost:
if (r15 == null) goto L33;
*/
@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: 248
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");
}
}
}

View File

@@ -0,0 +1,600 @@
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.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import androidx.appcompat.view.menu.ShowableListMenu;
import androidx.appcompat.widget.ActivityChooserModel;
import androidx.core.view.ActionProvider;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setProvider(ActionProvider actionProvider) {
this.mProvider = actionProvider;
}
public ActivityChooserView(@NonNull Context context) {
this(context, null);
}
public ActivityChooserView(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public ActivityChooserView(@NonNull Context context, @Nullable 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();
ActionProvider actionProvider = ActivityChooserView.this.mProvider;
if (actionProvider != null) {
actionProvider.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
public boolean onForwardingStarted() {
ActivityChooserView.this.showPopup();
return true;
}
@Override // androidx.appcompat.widget.ForwardingListener
public 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
@RestrictTo({RestrictTo.Scope.LIBRARY})
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] */
public 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
public 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
public 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
public void onMeasure(int i, int i2) {
View view = this.mActivityChooserContent;
if (this.mDefaultActivityButton.getVisibility() != 0) {
i2 = View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(i2), 1073741824);
}
measureChild(view, i, i2);
setMeasuredDimension(view.getMeasuredWidth(), view.getMeasuredHeight());
}
@Override // android.view.ViewGroup, android.view.View
public 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();
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public ActivityChooserModel getDataModel() {
return this.mAdapter.getDataModel();
}
public 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;
}
public 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);
}
}
public class Callbacks implements AdapterView.OnItemClickListener, View.OnClickListener, View.OnLongClickListener, PopupWindow.OnDismissListener {
public 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();
ActivityChooserView activityChooserView = ActivityChooserView.this;
if (activityChooserView.mIsSelectingDefaultActivity) {
if (i > 0) {
activityChooserView.mAdapter.getDataModel().setDefaultActivity(i);
return;
}
return;
}
if (!activityChooserView.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) {
ActivityChooserView activityChooserView = ActivityChooserView.this;
if (view == activityChooserView.mDefaultActivityButton) {
activityChooserView.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.mExpandActivityOverflowButton) {
activityChooserView.mIsSelectingDefaultActivity = false;
activityChooserView.showPopupUnchecked(activityChooserView.mInitialActivityCount);
return;
}
throw new IllegalArgumentException();
}
@Override // android.view.View.OnLongClickListener
public boolean onLongClick(View view) {
ActivityChooserView activityChooserView = ActivityChooserView.this;
if (view == activityChooserView.mDefaultActivityButton) {
if (activityChooserView.mAdapter.getCount() > 0) {
ActivityChooserView activityChooserView2 = ActivityChooserView.this;
activityChooserView2.mIsSelectingDefaultActivity = true;
activityChooserView2.showPopupUnchecked(activityChooserView2.mInitialActivityCount);
}
return true;
}
throw new IllegalArgumentException();
}
@Override // android.widget.PopupWindow.OnDismissListener
public void onDismiss() {
notifyOnDismissListener();
ActionProvider actionProvider = ActivityChooserView.this.mProvider;
if (actionProvider != null) {
actionProvider.subUiVisibilityChanged(false);
}
}
private void notifyOnDismissListener() {
PopupWindow.OnDismissListener onDismissListener = ActivityChooserView.this.mOnDismissListener;
if (onDismissListener != null) {
onDismissListener.onDismiss();
}
}
}
public 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;
}
public 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();
int i2 = 0;
View view = null;
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();
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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();
}
}
}

View File

@@ -0,0 +1,268 @@
package androidx.appcompat.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.core.view.ViewCompat;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public class AlertDialogLayout extends LinearLayoutCompat {
public AlertDialogLayout(@Nullable Context context) {
super(context);
}
public AlertDialogLayout(@Nullable Context context, @Nullable AttributeSet attributeSet) {
super(context, attributeSet);
}
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.View
public 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, 1073741824));
paddingTop = i9 + view2.getMeasuredHeight();
i3 = View.combineMeasuredStates(i3, view2.getMeasuredState());
}
if (view3 != null && i8 > 0) {
view3.measure(i, View.MeasureSpec.makeMeasureSpec(i6 + i8, mode));
paddingTop = (paddingTop - i6) + view3.getMeasuredHeight();
i3 = View.combineMeasuredStates(i3, view3.getMeasuredState());
}
int i10 = 0;
for (int i11 = 0; i11 < childCount; i11++) {
View childAt2 = getChildAt(i11);
if (childAt2.getVisibility() != 8) {
i10 = Math.max(i10, childAt2.getMeasuredWidth());
}
}
setMeasuredDimension(View.resolveSizeAndState(i10 + getPaddingLeft() + getPaddingRight(), i, i3), View.resolveSizeAndState(paddingTop, i2, 0));
if (mode2 == 1073741824) {
return true;
}
forceUniformWidth(childCount, i2);
return true;
}
private void forceUniformWidth(int i, int i2) {
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 1073741824);
for (int i3 = 0; i3 < i; i3++) {
View childAt = getChildAt(i3);
if (childAt.getVisibility() != 8) {
LinearLayoutCompat.LayoutParams layoutParams = (LinearLayoutCompat.LayoutParams) childAt.getLayoutParams();
if (((LinearLayout.LayoutParams) layoutParams).width == -1) {
int i4 = ((LinearLayout.LayoutParams) layoutParams).height;
((LinearLayout.LayoutParams) layoutParams).height = childAt.getMeasuredHeight();
measureChildWithMargins(childAt, makeMeasureSpec, 0, i2, 0);
((LinearLayout.LayoutParams) 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:0x00a9 */
@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
*/
public 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 = r2
goto L59
L54:
int r1 = r1.getIntrinsicHeight()
r12 = r1
L59:
r13 = r2
L5a:
if (r13 >= r10) goto Lc0
android.view.View r1 = r6.getChildAt(r13)
if (r1 == 0) goto Lbd
int r2 = r1.getVisibility()
r3 = 8
if (r2 == r3) goto Lbd
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 = r17.getLayoutDirection()
int r2 = androidx.core.view.GravityCompat.getAbsoluteGravity(r2, r3)
r2 = r2 & 7
r3 = 1
if (r2 == r3) goto L98
r3 = 5
if (r2 == r3) goto L92
int r2 = r15.leftMargin
int r2 = r2 + r7
goto La3
L92:
int r2 = r8 - r4
int r3 = r15.rightMargin
L96:
int r2 = r2 - r3
goto La3
L98:
int r2 = r9 - r4
int r2 = r2 / 2
int r2 = r2 + r7
int r3 = r15.leftMargin
int r2 = r2 + r3
int r3 = r15.rightMargin
goto L96
La3:
boolean r3 = r6.hasDividerBeforeChildAt(r13)
if (r3 == 0) goto Laa
int r0 = r0 + r12
Laa:
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
Lbd:
int r13 = r13 + 1
goto L5a
Lc0:
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);
}
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class AppCompatAutoCompleteTextView$InspectionCompanion$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class AppCompatAutoCompleteTextView$InspectionCompanion$$ExternalSyntheticApiModelOutline1 {
}

View File

@@ -0,0 +1,10 @@
package androidx.appcompat.widget;
import android.view.inspector.InspectionCompanion;
/* loaded from: classes.dex */
public abstract /* synthetic */ class AppCompatAutoCompleteTextView$InspectionCompanion$$ExternalSyntheticApiModelOutline2 {
public static /* synthetic */ InspectionCompanion.UninitializedPropertyMapException m() {
return new InspectionCompanion.UninitializedPropertyMapException();
}
}

View File

@@ -0,0 +1,280 @@
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.view.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
import android.widget.AutoCompleteTextView;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
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};
@NonNull
private final AppCompatEmojiEditTextHelper mAppCompatEmojiEditTextHelper;
private final AppCompatBackgroundHelper mBackgroundTintHelper;
private final AppCompatTextHelper mTextHelper;
@RequiresApi(29)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final class InspectionCompanion implements android.view.inspector.InspectionCompanion {
private int mBackgroundTintId;
private int mBackgroundTintModeId;
private int mDrawableTintId;
private int mDrawableTintModeId;
private boolean mPropertiesMapped = false;
public void mapProperties(@NonNull PropertyMapper propertyMapper) {
int mapObject;
int mapObject2;
int mapObject3;
int mapObject4;
mapObject = propertyMapper.mapObject("backgroundTint", androidx.appcompat.R.attr.backgroundTint);
this.mBackgroundTintId = mapObject;
mapObject2 = propertyMapper.mapObject("backgroundTintMode", androidx.appcompat.R.attr.backgroundTintMode);
this.mBackgroundTintModeId = mapObject2;
mapObject3 = propertyMapper.mapObject("drawableTint", androidx.appcompat.R.attr.drawableTint);
this.mDrawableTintId = mapObject3;
mapObject4 = propertyMapper.mapObject("drawableTintMode", androidx.appcompat.R.attr.drawableTintMode);
this.mDrawableTintModeId = mapObject4;
this.mPropertiesMapped = true;
}
public void readProperties(@NonNull AppCompatAutoCompleteTextView appCompatAutoCompleteTextView, @NonNull PropertyReader propertyReader) {
if (!this.mPropertiesMapped) {
throw AppCompatAutoCompleteTextView$InspectionCompanion$$ExternalSyntheticApiModelOutline2.m();
}
propertyReader.readObject(this.mBackgroundTintId, appCompatAutoCompleteTextView.getBackgroundTintList());
propertyReader.readObject(this.mBackgroundTintModeId, appCompatAutoCompleteTextView.getBackgroundTintMode());
propertyReader.readObject(this.mDrawableTintId, appCompatAutoCompleteTextView.getCompoundDrawableTintList());
propertyReader.readObject(this.mDrawableTintModeId, appCompatAutoCompleteTextView.getCompoundDrawableTintMode());
}
}
public AppCompatAutoCompleteTextView(@NonNull Context context) {
this(context, null);
}
public AppCompatAutoCompleteTextView(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, androidx.appcompat.R.attr.autoCompleteTextViewStyle);
}
public AppCompatAutoCompleteTextView(@NonNull Context context, @Nullable 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);
}
public 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(@DrawableRes int i) {
setDropDownBackgroundDrawable(AppCompatResources.getDrawable(getContext(), i));
}
@Override // android.view.View
public void setBackgroundResource(@DrawableRes int i) {
super.setBackgroundResource(i);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundResource(i);
}
}
@Override // android.view.View
public void setBackgroundDrawable(@Nullable Drawable drawable) {
super.setBackgroundDrawable(drawable);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
}
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintList(@Nullable ColorStateList colorStateList) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportBackgroundTintList() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintList();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportBackgroundTintMode() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
}
return null;
}
@Override // android.widget.TextView, android.view.View
public 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(@Nullable ActionMode.Callback callback) {
super.setCustomSelectionActionModeCallback(TextViewCompat.wrapCustomSelectionActionModeCallback(this, callback));
}
@Override // android.widget.TextView
@Nullable
public ActionMode.Callback getCustomSelectionActionModeCallback() {
return TextViewCompat.unwrapCustomSelectionActionModeCallback(super.getCustomSelectionActionModeCallback());
}
@Override // android.widget.TextView
public void setKeyListener(@Nullable 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(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper != null) {
appCompatTextHelper.onSetCompoundDrawables();
}
}
@Override // android.widget.TextView
public void setCompoundDrawablesRelative(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper != null) {
appCompatTextHelper.onSetCompoundDrawables();
}
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportCompoundDrawablesTintList() {
return this.mTextHelper.getCompoundDrawableTintList();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList colorStateList) {
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
this.mTextHelper.applyCompoundDrawablesTints();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
return this.mTextHelper.getCompoundDrawableTintMode();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode mode) {
this.mTextHelper.setCompoundDrawableTintMode(mode);
this.mTextHelper.applyCompoundDrawablesTints();
}
}

View File

@@ -0,0 +1,160 @@
package androidx.appcompat.widget;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.R;
import androidx.core.view.ViewCompat;
/* loaded from: classes.dex */
class AppCompatBackgroundHelper {
private TintInfo mBackgroundTint;
private TintInfo mInternalBackgroundTint;
private TintInfo mTmpInfo;
@NonNull
private final View mView;
private int mBackgroundResId = -1;
private final AppCompatDrawableManager mDrawableManager = AppCompatDrawableManager.get();
private boolean shouldApplyFrameworkTintUsingColorFilter() {
return this.mInternalBackgroundTint != null;
}
public AppCompatBackgroundHelper(@NonNull View view) {
this.mView = view;
}
public void loadFromAttributes(@Nullable 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));
}
obtainStyledAttributes.recycle();
} catch (Throwable th) {
obtainStyledAttributes.recycle();
throw th;
}
}
public void onSetBackgroundResource(int i) {
this.mBackgroundResId = i;
AppCompatDrawableManager appCompatDrawableManager = this.mDrawableManager;
setInternalBackgroundTint(appCompatDrawableManager != null ? appCompatDrawableManager.getTintList(this.mView.getContext(), i) : null);
applySupportBackgroundTint();
}
public void onSetBackgroundDrawable(Drawable drawable) {
this.mBackgroundResId = -1;
setInternalBackgroundTint(null);
applySupportBackgroundTint();
}
public void setSupportBackgroundTintList(ColorStateList colorStateList) {
if (this.mBackgroundTint == null) {
this.mBackgroundTint = new TintInfo();
}
TintInfo tintInfo = this.mBackgroundTint;
tintInfo.mTintList = colorStateList;
tintInfo.mHasTintList = true;
applySupportBackgroundTint();
}
public ColorStateList getSupportBackgroundTintList() {
TintInfo tintInfo = this.mBackgroundTint;
if (tintInfo != null) {
return tintInfo.mTintList;
}
return null;
}
public void setSupportBackgroundTintMode(PorterDuff.Mode mode) {
if (this.mBackgroundTint == null) {
this.mBackgroundTint = new TintInfo();
}
TintInfo tintInfo = this.mBackgroundTint;
tintInfo.mTintMode = mode;
tintInfo.mHasTintMode = true;
applySupportBackgroundTint();
}
public PorterDuff.Mode getSupportBackgroundTintMode() {
TintInfo tintInfo = this.mBackgroundTint;
if (tintInfo != null) {
return tintInfo.mTintMode;
}
return null;
}
public 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());
}
}
}
public void setInternalBackgroundTint(ColorStateList colorStateList) {
if (colorStateList != null) {
if (this.mInternalBackgroundTint == null) {
this.mInternalBackgroundTint = new TintInfo();
}
TintInfo tintInfo = this.mInternalBackgroundTint;
tintInfo.mTintList = colorStateList;
tintInfo.mHasTintList = true;
} else {
this.mInternalBackgroundTint = null;
}
applySupportBackgroundTint();
}
private boolean applyFrameworkTintUsingColorFilter(@NonNull 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;
}
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class AppCompatButton$InspectionCompanion$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class AppCompatButton$InspectionCompanion$$ExternalSyntheticApiModelOutline1 {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class AppCompatButton$InspectionCompanion$$ExternalSyntheticApiModelOutline2 {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class AppCompatButton$InspectionCompanion$$ExternalSyntheticApiModelOutline3 {
}

View File

@@ -0,0 +1,417 @@
package androidx.appcompat.widget;
import android.annotation.SuppressLint;
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.view.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
import android.widget.Button;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import androidx.core.view.TintableBackgroundView;
import androidx.core.widget.AutoSizeableTextView;
import androidx.core.widget.TextViewCompat;
import androidx.core.widget.TintableCompoundDrawablesView;
import java.util.function.IntFunction;
/* loaded from: classes.dex */
public class AppCompatButton extends Button implements TintableBackgroundView, AutoSizeableTextView, TintableCompoundDrawablesView, EmojiCompatConfigurationView {
@NonNull
private AppCompatEmojiTextHelper mAppCompatEmojiTextHelper;
private final AppCompatBackgroundHelper mBackgroundTintHelper;
private final AppCompatTextHelper mTextHelper;
@RequiresApi(29)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final class InspectionCompanion implements android.view.inspector.InspectionCompanion {
private int mAutoSizeMaxTextSizeId;
private int mAutoSizeMinTextSizeId;
private int mAutoSizeStepGranularityId;
private int mAutoSizeTextTypeId;
private int mBackgroundTintId;
private int mBackgroundTintModeId;
private int mDrawableTintId;
private int mDrawableTintModeId;
private boolean mPropertiesMapped = false;
public void mapProperties(@NonNull PropertyMapper propertyMapper) {
int mapInt;
int mapInt2;
int mapInt3;
int mapIntEnum;
int mapObject;
int mapObject2;
int mapObject3;
int mapObject4;
mapInt = propertyMapper.mapInt("autoSizeMaxTextSize", R.attr.autoSizeMaxTextSize);
this.mAutoSizeMaxTextSizeId = mapInt;
mapInt2 = propertyMapper.mapInt("autoSizeMinTextSize", R.attr.autoSizeMinTextSize);
this.mAutoSizeMinTextSizeId = mapInt2;
mapInt3 = propertyMapper.mapInt("autoSizeStepGranularity", R.attr.autoSizeStepGranularity);
this.mAutoSizeStepGranularityId = mapInt3;
mapIntEnum = propertyMapper.mapIntEnum("autoSizeTextType", R.attr.autoSizeTextType, new IntFunction<String>() { // from class: androidx.appcompat.widget.AppCompatButton.InspectionCompanion.1
@Override // java.util.function.IntFunction
public String apply(int i) {
return i != 0 ? i != 1 ? String.valueOf(i) : "uniform" : "none";
}
});
this.mAutoSizeTextTypeId = mapIntEnum;
mapObject = propertyMapper.mapObject("backgroundTint", R.attr.backgroundTint);
this.mBackgroundTintId = mapObject;
mapObject2 = propertyMapper.mapObject("backgroundTintMode", R.attr.backgroundTintMode);
this.mBackgroundTintModeId = mapObject2;
mapObject3 = propertyMapper.mapObject("drawableTint", R.attr.drawableTint);
this.mDrawableTintId = mapObject3;
mapObject4 = propertyMapper.mapObject("drawableTintMode", R.attr.drawableTintMode);
this.mDrawableTintModeId = mapObject4;
this.mPropertiesMapped = true;
}
public void readProperties(@NonNull AppCompatButton appCompatButton, @NonNull PropertyReader propertyReader) {
if (!this.mPropertiesMapped) {
throw AppCompatAutoCompleteTextView$InspectionCompanion$$ExternalSyntheticApiModelOutline2.m();
}
propertyReader.readInt(this.mAutoSizeMaxTextSizeId, appCompatButton.getAutoSizeMaxTextSize());
propertyReader.readInt(this.mAutoSizeMinTextSizeId, appCompatButton.getAutoSizeMinTextSize());
propertyReader.readInt(this.mAutoSizeStepGranularityId, appCompatButton.getAutoSizeStepGranularity());
propertyReader.readIntEnum(this.mAutoSizeTextTypeId, appCompatButton.getAutoSizeTextType());
propertyReader.readObject(this.mBackgroundTintId, appCompatButton.getBackgroundTintList());
propertyReader.readObject(this.mBackgroundTintModeId, appCompatButton.getBackgroundTintMode());
propertyReader.readObject(this.mDrawableTintId, appCompatButton.getCompoundDrawableTintList());
propertyReader.readObject(this.mDrawableTintModeId, appCompatButton.getCompoundDrawableTintMode());
}
}
public AppCompatButton(@NonNull Context context) {
this(context, null);
}
public AppCompatButton(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, R.attr.buttonStyle);
}
public AppCompatButton(@NonNull Context context, @Nullable 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(@DrawableRes int i) {
super.setBackgroundResource(i);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundResource(i);
}
}
@Override // android.view.View
public void setBackgroundDrawable(@Nullable Drawable drawable) {
super.setBackgroundDrawable(drawable);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
}
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintList(@Nullable ColorStateList colorStateList) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportBackgroundTintList() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintList();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportBackgroundTintMode() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
}
return null;
}
@Override // android.widget.TextView, android.view.View
public 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
public 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
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
super.onTextChanged(charSequence, i, i2, i3);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper == null || ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE || !appCompatTextHelper.isAutoSizeEnabled()) {
return;
}
this.mTextHelper.autoSizeText();
}
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setAutoSizeTextTypeUniformWithPresetSizes(@NonNull 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
@SuppressLint({"WrongConstant"})
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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(@Nullable ActionMode.Callback callback) {
super.setCustomSelectionActionModeCallback(TextViewCompat.wrapCustomSelectionActionModeCallback(this, callback));
}
@Override // android.widget.TextView
@Nullable
public ActionMode.Callback getCustomSelectionActionModeCallback() {
return TextViewCompat.unwrapCustomSelectionActionModeCallback(super.getCustomSelectionActionModeCallback());
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList colorStateList) {
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
this.mTextHelper.applyCompoundDrawablesTints();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportCompoundDrawablesTintList() {
return this.mTextHelper.getCompoundDrawableTintList();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode mode) {
this.mTextHelper.setCompoundDrawableTintMode(mode);
this.mTextHelper.applyCompoundDrawablesTints();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
return this.mTextHelper.getCompoundDrawableTintMode();
}
@Override // android.widget.TextView
public void setFilters(@NonNull InputFilter[] inputFilterArr) {
super.setFilters(getEmojiTextViewHelper().getFilters(inputFilterArr));
}
@NonNull
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();
}
}

View File

@@ -0,0 +1,298 @@
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.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
import android.widget.CheckBox;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
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;
@RequiresApi(29)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final class InspectionCompanion implements android.view.inspector.InspectionCompanion {
private int mBackgroundTintId;
private int mBackgroundTintModeId;
private int mButtonTintId;
private int mButtonTintModeId;
private int mDrawableTintId;
private int mDrawableTintModeId;
private boolean mPropertiesMapped = false;
public void mapProperties(@NonNull PropertyMapper propertyMapper) {
int mapObject;
int mapObject2;
int mapObject3;
int mapObject4;
int mapObject5;
int mapObject6;
mapObject = propertyMapper.mapObject("backgroundTint", R.attr.backgroundTint);
this.mBackgroundTintId = mapObject;
mapObject2 = propertyMapper.mapObject("backgroundTintMode", R.attr.backgroundTintMode);
this.mBackgroundTintModeId = mapObject2;
mapObject3 = propertyMapper.mapObject("buttonTint", R.attr.buttonTint);
this.mButtonTintId = mapObject3;
mapObject4 = propertyMapper.mapObject("buttonTintMode", R.attr.buttonTintMode);
this.mButtonTintModeId = mapObject4;
mapObject5 = propertyMapper.mapObject("drawableTint", R.attr.drawableTint);
this.mDrawableTintId = mapObject5;
mapObject6 = propertyMapper.mapObject("drawableTintMode", R.attr.drawableTintMode);
this.mDrawableTintModeId = mapObject6;
this.mPropertiesMapped = true;
}
public void readProperties(@NonNull AppCompatCheckBox appCompatCheckBox, @NonNull PropertyReader propertyReader) {
if (!this.mPropertiesMapped) {
throw AppCompatAutoCompleteTextView$InspectionCompanion$$ExternalSyntheticApiModelOutline2.m();
}
propertyReader.readObject(this.mBackgroundTintId, appCompatCheckBox.getBackgroundTintList());
propertyReader.readObject(this.mBackgroundTintModeId, appCompatCheckBox.getBackgroundTintMode());
propertyReader.readObject(this.mButtonTintId, appCompatCheckBox.getButtonTintList());
propertyReader.readObject(this.mButtonTintModeId, appCompatCheckBox.getButtonTintMode());
propertyReader.readObject(this.mDrawableTintId, appCompatCheckBox.getCompoundDrawableTintList());
propertyReader.readObject(this.mDrawableTintModeId, appCompatCheckBox.getCompoundDrawableTintMode());
}
}
public AppCompatCheckBox(@NonNull Context context) {
this(context, null);
}
public AppCompatCheckBox(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, R.attr.checkboxStyle);
}
public AppCompatCheckBox(@NonNull Context context, @Nullable 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);
}
@NonNull
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(@DrawableRes int i) {
setButtonDrawable(AppCompatResources.getDrawable(getContext(), i));
}
@Override // androidx.core.widget.TintableCompoundButton
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportButtonTintList(@Nullable ColorStateList colorStateList) {
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
if (appCompatCompoundButtonHelper != null) {
appCompatCompoundButtonHelper.setSupportButtonTintList(colorStateList);
}
}
@Override // androidx.core.widget.TintableCompoundButton
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportButtonTintList() {
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
if (appCompatCompoundButtonHelper != null) {
return appCompatCompoundButtonHelper.getSupportButtonTintList();
}
return null;
}
@Override // androidx.core.widget.TintableCompoundButton
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportButtonTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
if (appCompatCompoundButtonHelper != null) {
appCompatCompoundButtonHelper.setSupportButtonTintMode(mode);
}
}
@Override // androidx.core.widget.TintableCompoundButton
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportButtonTintMode() {
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
if (appCompatCompoundButtonHelper != null) {
return appCompatCompoundButtonHelper.getSupportButtonTintMode();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintList(@Nullable ColorStateList colorStateList) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportBackgroundTintList() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintList();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportBackgroundTintMode() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
}
return null;
}
@Override // android.view.View
public void setBackgroundDrawable(@Nullable Drawable drawable) {
super.setBackgroundDrawable(drawable);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
}
}
@Override // android.view.View
public void setBackgroundResource(@DrawableRes 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
public 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(@NonNull 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(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper != null) {
appCompatTextHelper.onSetCompoundDrawables();
}
}
@Override // android.widget.TextView
public void setCompoundDrawablesRelative(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper != null) {
appCompatTextHelper.onSetCompoundDrawables();
}
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportCompoundDrawablesTintList() {
return this.mTextHelper.getCompoundDrawableTintList();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList colorStateList) {
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
this.mTextHelper.applyCompoundDrawablesTints();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
return this.mTextHelper.getCompoundDrawableTintMode();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode mode) {
this.mTextHelper.setCompoundDrawableTintMode(mode);
this.mTextHelper.applyCompoundDrawablesTints();
}
}

View File

@@ -0,0 +1,329 @@
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.view.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
import android.widget.CheckedTextView;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
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 {
@NonNull
private AppCompatEmojiTextHelper mAppCompatEmojiTextHelper;
private final AppCompatBackgroundHelper mBackgroundTintHelper;
private final AppCompatCheckedTextViewHelper mCheckedHelper;
private final AppCompatTextHelper mTextHelper;
@RequiresApi(29)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final class InspectionCompanion implements android.view.inspector.InspectionCompanion {
private int mBackgroundTintId;
private int mBackgroundTintModeId;
private int mCheckMarkTintId;
private int mCheckMarkTintModeId;
private int mDrawableTintId;
private int mDrawableTintModeId;
private boolean mPropertiesMapped = false;
public void mapProperties(@NonNull PropertyMapper propertyMapper) {
int mapObject;
int mapObject2;
int mapObject3;
int mapObject4;
int mapObject5;
int mapObject6;
mapObject = propertyMapper.mapObject("backgroundTint", R.attr.backgroundTint);
this.mBackgroundTintId = mapObject;
mapObject2 = propertyMapper.mapObject("backgroundTintMode", R.attr.backgroundTintMode);
this.mBackgroundTintModeId = mapObject2;
mapObject3 = propertyMapper.mapObject("checkMarkTint", R.attr.checkMarkTint);
this.mCheckMarkTintId = mapObject3;
mapObject4 = propertyMapper.mapObject("checkMarkTintMode", R.attr.checkMarkTintMode);
this.mCheckMarkTintModeId = mapObject4;
mapObject5 = propertyMapper.mapObject("drawableTint", R.attr.drawableTint);
this.mDrawableTintId = mapObject5;
mapObject6 = propertyMapper.mapObject("drawableTintMode", R.attr.drawableTintMode);
this.mDrawableTintModeId = mapObject6;
this.mPropertiesMapped = true;
}
public void readProperties(@NonNull AppCompatCheckedTextView appCompatCheckedTextView, @NonNull PropertyReader propertyReader) {
if (!this.mPropertiesMapped) {
throw AppCompatAutoCompleteTextView$InspectionCompanion$$ExternalSyntheticApiModelOutline2.m();
}
propertyReader.readObject(this.mBackgroundTintId, appCompatCheckedTextView.getBackgroundTintList());
propertyReader.readObject(this.mBackgroundTintModeId, appCompatCheckedTextView.getBackgroundTintMode());
propertyReader.readObject(this.mCheckMarkTintId, appCompatCheckedTextView.getCheckMarkTintList());
propertyReader.readObject(this.mCheckMarkTintModeId, appCompatCheckedTextView.getCheckMarkTintMode());
propertyReader.readObject(this.mDrawableTintId, appCompatCheckedTextView.getCompoundDrawableTintList());
propertyReader.readObject(this.mDrawableTintModeId, appCompatCheckedTextView.getCompoundDrawableTintMode());
}
}
public AppCompatCheckedTextView(@NonNull Context context) {
this(context, null);
}
public AppCompatCheckedTextView(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, R.attr.checkedTextViewStyle);
}
public AppCompatCheckedTextView(@NonNull Context context, @Nullable 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(@Nullable Drawable drawable) {
super.setCheckMarkDrawable(drawable);
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
if (appCompatCheckedTextViewHelper != null) {
appCompatCheckedTextViewHelper.onSetCheckMarkDrawable();
}
}
@Override // android.widget.CheckedTextView
public void setCheckMarkDrawable(@DrawableRes int i) {
setCheckMarkDrawable(AppCompatResources.getDrawable(getContext(), i));
}
@Override // androidx.core.widget.TintableCheckedTextView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCheckMarkTintList(@Nullable ColorStateList colorStateList) {
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
if (appCompatCheckedTextViewHelper != null) {
appCompatCheckedTextViewHelper.setSupportCheckMarkTintList(colorStateList);
}
}
@Override // androidx.core.widget.TintableCheckedTextView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportCheckMarkTintList() {
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
if (appCompatCheckedTextViewHelper != null) {
return appCompatCheckedTextViewHelper.getSupportCheckMarkTintList();
}
return null;
}
@Override // androidx.core.widget.TintableCheckedTextView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCheckMarkTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
if (appCompatCheckedTextViewHelper != null) {
appCompatCheckedTextViewHelper.setSupportCheckMarkTintMode(mode);
}
}
@Override // androidx.core.widget.TintableCheckedTextView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportCheckMarkTintMode() {
AppCompatCheckedTextViewHelper appCompatCheckedTextViewHelper = this.mCheckedHelper;
if (appCompatCheckedTextViewHelper != null) {
return appCompatCheckedTextViewHelper.getSupportCheckMarkTintMode();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintList(@Nullable ColorStateList colorStateList) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportBackgroundTintList() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintList();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportBackgroundTintMode() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
}
return null;
}
@Override // android.view.View
public void setBackgroundDrawable(@Nullable Drawable drawable) {
super.setBackgroundDrawable(drawable);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
}
}
@Override // android.view.View
public void setBackgroundResource(@DrawableRes int i) {
super.setBackgroundResource(i);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundResource(i);
}
}
@Override // android.widget.TextView
public void setTextAppearance(@NonNull 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
public 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
@Nullable
public InputConnection onCreateInputConnection(@NonNull EditorInfo editorInfo) {
return AppCompatHintHelper.onCreateInputConnection(super.onCreateInputConnection(editorInfo), editorInfo, this);
}
@Override // android.widget.TextView
public void setCustomSelectionActionModeCallback(@Nullable ActionMode.Callback callback) {
super.setCustomSelectionActionModeCallback(TextViewCompat.wrapCustomSelectionActionModeCallback(this, callback));
}
@Override // android.widget.TextView
@Nullable
public ActionMode.Callback getCustomSelectionActionModeCallback() {
return TextViewCompat.unwrapCustomSelectionActionModeCallback(super.getCustomSelectionActionModeCallback());
}
@NonNull
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(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper != null) {
appCompatTextHelper.onSetCompoundDrawables();
}
}
@Override // android.widget.TextView
public void setCompoundDrawablesRelative(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper != null) {
appCompatTextHelper.onSetCompoundDrawables();
}
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportCompoundDrawablesTintList() {
return this.mTextHelper.getCompoundDrawableTintList();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList colorStateList) {
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
this.mTextHelper.applyCompoundDrawablesTints();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
return this.mTextHelper.getCompoundDrawableTintMode();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode mode) {
this.mTextHelper.setCompoundDrawableTintMode(mode);
this.mTextHelper.applyCompoundDrawablesTints();
}
}

View File

@@ -0,0 +1,152 @@
package androidx.appcompat.widget;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.widget.CheckedTextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.widget.CheckedTextViewCompat;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* 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;
@NonNull
private final CheckedTextView mView;
public ColorStateList getSupportCheckMarkTintList() {
return this.mCheckMarkTintList;
}
public PorterDuff.Mode getSupportCheckMarkTintMode() {
return this.mCheckMarkTintMode;
}
public AppCompatCheckedTextViewHelper(@NonNull CheckedTextView checkedTextView) {
this.mView = checkedTextView;
}
/* JADX WARN: Removed duplicated region for block: B:11:0x0064 A[Catch: all -> 0x003d, TryCatch #1 {all -> 0x003d, blocks: (B:3:0x001f, B:5:0x0027, B:8:0x002f, B:9:0x005c, B:11:0x0064, B:12:0x006f, B:14:0x0077, B:21:0x003f, B:23:0x0047, B:25:0x004f), top: B:2:0x001f }] */
/* JADX WARN: Removed duplicated region for block: B:14:0x0077 A[Catch: all -> 0x003d, TRY_LEAVE, TryCatch #1 {all -> 0x003d, blocks: (B:3:0x001f, B:5:0x0027, B:8:0x002f, B:9:0x005c, B:11:0x0064, B:12:0x006f, B:14:0x0077, B:21:0x003f, B:23:0x0047, B:25:0x004f), top: B:2:0x001f }] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void loadFromAttributes(@androidx.annotation.Nullable 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 -> L3d
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L3d
if (r11 == 0) goto L3f
int r11 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkCompat // Catch: java.lang.Throwable -> L3d
int r11 = r0.getResourceId(r11, r2) // Catch: java.lang.Throwable -> L3d
if (r11 == 0) goto L3f
android.widget.CheckedTextView r12 = r10.mView // Catch: java.lang.Throwable -> L3d android.content.res.Resources.NotFoundException -> L3f
android.content.Context r1 = r12.getContext() // Catch: java.lang.Throwable -> L3d android.content.res.Resources.NotFoundException -> L3f
android.graphics.drawable.Drawable r11 = androidx.appcompat.content.res.AppCompatResources.getDrawable(r1, r11) // Catch: java.lang.Throwable -> L3d android.content.res.Resources.NotFoundException -> L3f
r12.setCheckMarkDrawable(r11) // Catch: java.lang.Throwable -> L3d android.content.res.Resources.NotFoundException -> L3f
goto L5c
L3d:
r11 = move-exception
goto L8c
L3f:
int r11 = androidx.appcompat.R.styleable.CheckedTextView_android_checkMark // Catch: java.lang.Throwable -> L3d
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L3d
if (r11 == 0) goto L5c
int r11 = androidx.appcompat.R.styleable.CheckedTextView_android_checkMark // Catch: java.lang.Throwable -> L3d
int r11 = r0.getResourceId(r11, r2) // Catch: java.lang.Throwable -> L3d
if (r11 == 0) goto L5c
android.widget.CheckedTextView r12 = r10.mView // Catch: java.lang.Throwable -> L3d
android.content.Context r1 = r12.getContext() // Catch: java.lang.Throwable -> L3d
android.graphics.drawable.Drawable r11 = androidx.appcompat.content.res.AppCompatResources.getDrawable(r1, r11) // Catch: java.lang.Throwable -> L3d
r12.setCheckMarkDrawable(r11) // Catch: java.lang.Throwable -> L3d
L5c:
int r11 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkTint // Catch: java.lang.Throwable -> L3d
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L3d
if (r11 == 0) goto L6f
android.widget.CheckedTextView r11 = r10.mView // Catch: java.lang.Throwable -> L3d
int r12 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkTint // Catch: java.lang.Throwable -> L3d
android.content.res.ColorStateList r12 = r0.getColorStateList(r12) // Catch: java.lang.Throwable -> L3d
androidx.core.widget.CheckedTextViewCompat.setCheckMarkTintList(r11, r12) // Catch: java.lang.Throwable -> L3d
L6f:
int r11 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkTintMode // Catch: java.lang.Throwable -> L3d
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L3d
if (r11 == 0) goto L88
android.widget.CheckedTextView r11 = r10.mView // Catch: java.lang.Throwable -> L3d
int r12 = androidx.appcompat.R.styleable.CheckedTextView_checkMarkTintMode // Catch: java.lang.Throwable -> L3d
r1 = -1
int r12 = r0.getInt(r12, r1) // Catch: java.lang.Throwable -> L3d
r1 = 0
android.graphics.PorterDuff$Mode r12 = androidx.appcompat.widget.DrawableUtils.parseTintMode(r12, r1) // Catch: java.lang.Throwable -> L3d
androidx.core.widget.CheckedTextViewCompat.setCheckMarkTintMode(r11, r12) // Catch: java.lang.Throwable -> L3d
L88:
r0.recycle()
return
L8c:
r0.recycle()
throw r11
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AppCompatCheckedTextViewHelper.loadFromAttributes(android.util.AttributeSet, int):void");
}
public void setSupportCheckMarkTintList(ColorStateList colorStateList) {
this.mCheckMarkTintList = colorStateList;
this.mHasCheckMarkTint = true;
applyCheckMarkTint();
}
public void setSupportCheckMarkTintMode(@Nullable PorterDuff.Mode mode) {
this.mCheckMarkTintMode = mode;
this.mHasCheckMarkTintMode = true;
applyCheckMarkTint();
}
public void onSetCheckMarkDrawable() {
if (this.mSkipNextApply) {
this.mSkipNextApply = false;
} else {
this.mSkipNextApply = true;
applyCheckMarkTint();
}
}
public 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);
}
}
}
}

View File

@@ -0,0 +1,150 @@
package androidx.appcompat.widget;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.widget.CompoundButton;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
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;
@NonNull
private final CompoundButton mView;
public ColorStateList getSupportButtonTintList() {
return this.mButtonTintList;
}
public PorterDuff.Mode getSupportButtonTintMode() {
return this.mButtonTintMode;
}
public AppCompatCompoundButtonHelper(@NonNull CompoundButton compoundButton) {
this.mView = compoundButton;
}
/* JADX WARN: Removed duplicated region for block: B:11:0x0064 A[Catch: all -> 0x003d, TryCatch #1 {all -> 0x003d, blocks: (B:3:0x001f, B:5:0x0027, B:8:0x002f, B:9:0x005c, B:11:0x0064, B:12:0x006f, B:14:0x0077, B:21:0x003f, B:23:0x0047, B:25:0x004f), top: B:2:0x001f }] */
/* JADX WARN: Removed duplicated region for block: B:14:0x0077 A[Catch: all -> 0x003d, TRY_LEAVE, TryCatch #1 {all -> 0x003d, blocks: (B:3:0x001f, B:5:0x0027, B:8:0x002f, B:9:0x005c, B:11:0x0064, B:12:0x006f, B:14:0x0077, B:21:0x003f, B:23:0x0047, B:25:0x004f), top: B:2:0x001f }] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void loadFromAttributes(@androidx.annotation.Nullable 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 -> L3d
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L3d
if (r11 == 0) goto L3f
int r11 = androidx.appcompat.R.styleable.CompoundButton_buttonCompat // Catch: java.lang.Throwable -> L3d
int r11 = r0.getResourceId(r11, r2) // Catch: java.lang.Throwable -> L3d
if (r11 == 0) goto L3f
android.widget.CompoundButton r12 = r10.mView // Catch: java.lang.Throwable -> L3d android.content.res.Resources.NotFoundException -> L3f
android.content.Context r1 = r12.getContext() // Catch: java.lang.Throwable -> L3d android.content.res.Resources.NotFoundException -> L3f
android.graphics.drawable.Drawable r11 = androidx.appcompat.content.res.AppCompatResources.getDrawable(r1, r11) // Catch: java.lang.Throwable -> L3d android.content.res.Resources.NotFoundException -> L3f
r12.setButtonDrawable(r11) // Catch: java.lang.Throwable -> L3d android.content.res.Resources.NotFoundException -> L3f
goto L5c
L3d:
r11 = move-exception
goto L8c
L3f:
int r11 = androidx.appcompat.R.styleable.CompoundButton_android_button // Catch: java.lang.Throwable -> L3d
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L3d
if (r11 == 0) goto L5c
int r11 = androidx.appcompat.R.styleable.CompoundButton_android_button // Catch: java.lang.Throwable -> L3d
int r11 = r0.getResourceId(r11, r2) // Catch: java.lang.Throwable -> L3d
if (r11 == 0) goto L5c
android.widget.CompoundButton r12 = r10.mView // Catch: java.lang.Throwable -> L3d
android.content.Context r1 = r12.getContext() // Catch: java.lang.Throwable -> L3d
android.graphics.drawable.Drawable r11 = androidx.appcompat.content.res.AppCompatResources.getDrawable(r1, r11) // Catch: java.lang.Throwable -> L3d
r12.setButtonDrawable(r11) // Catch: java.lang.Throwable -> L3d
L5c:
int r11 = androidx.appcompat.R.styleable.CompoundButton_buttonTint // Catch: java.lang.Throwable -> L3d
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L3d
if (r11 == 0) goto L6f
android.widget.CompoundButton r11 = r10.mView // Catch: java.lang.Throwable -> L3d
int r12 = androidx.appcompat.R.styleable.CompoundButton_buttonTint // Catch: java.lang.Throwable -> L3d
android.content.res.ColorStateList r12 = r0.getColorStateList(r12) // Catch: java.lang.Throwable -> L3d
androidx.core.widget.CompoundButtonCompat.setButtonTintList(r11, r12) // Catch: java.lang.Throwable -> L3d
L6f:
int r11 = androidx.appcompat.R.styleable.CompoundButton_buttonTintMode // Catch: java.lang.Throwable -> L3d
boolean r11 = r0.hasValue(r11) // Catch: java.lang.Throwable -> L3d
if (r11 == 0) goto L88
android.widget.CompoundButton r11 = r10.mView // Catch: java.lang.Throwable -> L3d
int r12 = androidx.appcompat.R.styleable.CompoundButton_buttonTintMode // Catch: java.lang.Throwable -> L3d
r1 = -1
int r12 = r0.getInt(r12, r1) // Catch: java.lang.Throwable -> L3d
r1 = 0
android.graphics.PorterDuff$Mode r12 = androidx.appcompat.widget.DrawableUtils.parseTintMode(r12, r1) // Catch: java.lang.Throwable -> L3d
androidx.core.widget.CompoundButtonCompat.setButtonTintMode(r11, r12) // Catch: java.lang.Throwable -> L3d
L88:
r0.recycle()
return
L8c:
r0.recycle()
throw r11
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AppCompatCompoundButtonHelper.loadFromAttributes(android.util.AttributeSet, int):void");
}
public void setSupportButtonTintList(ColorStateList colorStateList) {
this.mButtonTintList = colorStateList;
this.mHasButtonTint = true;
applyButtonTint();
}
public void setSupportButtonTintMode(@Nullable PorterDuff.Mode mode) {
this.mButtonTintMode = mode;
this.mHasButtonTintMode = true;
applyButtonTint();
}
public void onSetButtonDrawable() {
if (this.mSkipNextApply) {
this.mSkipNextApply = false;
} else {
this.mSkipNextApply = true;
applyButtonTint();
}
}
public 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);
}
}
}
}

View File

@@ -0,0 +1,353 @@
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.annotation.ColorInt;
import androidx.annotation.DimenRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.ResourceManagerInternal;
import androidx.core.graphics.ColorUtils;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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(@NonNull Context context) {
return createButtonColorStateList(context, ThemeUtils.getThemeAttrColor(context, R.attr.colorButtonNormal));
}
private ColorStateList createBorderlessButtonColorStateList(@NonNull Context context) {
return createButtonColorStateList(context, 0);
}
private ColorStateList createColoredButtonColorStateList(@NonNull Context context) {
return createButtonColorStateList(context, ThemeUtils.getThemeAttrColor(context, R.attr.colorAccent));
}
private ColorStateList createButtonColorStateList(@NonNull Context context, @ColorInt 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(@NonNull ResourceManagerInternal resourceManagerInternal, @NonNull 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(@NonNull ResourceManagerInternal resourceManagerInternal, @NonNull Context context, @DimenRes 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) {
Drawable mutate = drawable.mutate();
if (mode == null) {
mode = AppCompatDrawableManager.DEFAULT_MODE;
}
mutate.setColorFilter(AppCompatDrawableManager.getPorterDuffColorFilter(i, mode));
}
@Override // androidx.appcompat.widget.ResourceManagerInternal.ResourceManagerHooks
public boolean tintDrawable(@NonNull Context context, int i, @NonNull 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(@NonNull 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:12:0x0066 A[RETURN] */
/* JADX WARN: Removed duplicated region for block: B:7:0x0051 */
@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(@androidx.annotation.NonNull android.content.Context r8, int r9, @androidx.annotation.NonNull android.graphics.drawable.Drawable r10) {
/*
r7 = this;
android.graphics.PorterDuff$Mode r0 = androidx.appcompat.widget.AppCompatDrawableManager.access$000()
int[] r1 = r7.COLORFILTER_TINT_COLOR_CONTROL_NORMAL
boolean r1 = r7.arrayContains(r1, r9)
r2 = 1
r3 = 0
r4 = -1
if (r1 == 0) goto L15
int r9 = androidx.appcompat.R.attr.colorControlNormal
L11:
r1 = r0
r5 = r2
L13:
r0 = r4
goto L4f
L15:
int[] r1 = r7.COLORFILTER_COLOR_CONTROL_ACTIVATED
boolean r1 = r7.arrayContains(r1, r9)
if (r1 == 0) goto L20
int r9 = androidx.appcompat.R.attr.colorControlActivated
goto L11
L20:
int[] r1 = r7.COLORFILTER_COLOR_BACKGROUND_MULTIPLY
boolean r1 = r7.arrayContains(r1, r9)
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
r0 = r4
r9 = r5
r5 = r2
goto L4f
L32:
int r1 = androidx.appcompat.R.drawable.abc_list_divider_mtrl_alpha
if (r9 != r1) goto L46
r9 = 1109603123(0x42233333, float:40.8)
int r9 = java.lang.Math.round(r9)
r1 = 16842800(0x1010030, float:2.3693693E-38)
r5 = r2
r6 = r0
r0 = r9
r9 = r1
r1 = r6
goto L4f
L46:
int r1 = androidx.appcompat.R.drawable.abc_dialog_material_background
if (r9 != r1) goto L4b
goto L2d
L4b:
r1 = r0
r9 = r3
r5 = r9
goto L13
L4f:
if (r5 == 0) goto L66
android.graphics.drawable.Drawable r10 = r10.mutate()
int r8 = androidx.appcompat.widget.ThemeUtils.getThemeAttrColor(r8, r9)
android.graphics.PorterDuffColorFilter r8 = androidx.appcompat.widget.AppCompatDrawableManager.getPorterDuffColorFilter(r8, r1)
r10.setColorFilter(r8)
if (r0 == r4) goto L65
r10.setAlpha(r0)
L65:
return r2
L66:
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) {
try {
if (INSTANCE == null) {
preload();
}
appCompatDrawableManager = INSTANCE;
} catch (Throwable th) {
throw th;
}
}
return appCompatDrawableManager;
}
public synchronized Drawable getDrawable(@NonNull Context context, @DrawableRes int i) {
return this.mResourceManager.getDrawable(context, i);
}
public synchronized Drawable getDrawable(@NonNull Context context, @DrawableRes int i, boolean z) {
return this.mResourceManager.getDrawable(context, i, z);
}
public synchronized void onConfigurationChanged(@NonNull Context context) {
this.mResourceManager.onConfigurationChanged(context);
}
public synchronized Drawable onDrawableLoadedFromResources(@NonNull Context context, @NonNull VectorEnabledTintResources vectorEnabledTintResources, @DrawableRes int i) {
return this.mResourceManager.onDrawableLoadedFromResources(context, vectorEnabledTintResources, i);
}
public boolean tintDrawableUsingColorFilter(@NonNull Context context, @DrawableRes int i, @NonNull Drawable drawable) {
return this.mResourceManager.tintDrawableUsingColorFilter(context, i, drawable);
}
public synchronized ColorStateList getTintList(@NonNull Context context, @DrawableRes int i) {
return this.mResourceManager.getTintList(context, i);
}
public 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;
}
}

View File

@@ -0,0 +1,384 @@
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.inputmethod.InputMethodManager;
import android.view.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
import android.view.textclassifier.TextClassifier;
import android.widget.EditText;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.annotation.UiThread;
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 {
@NonNull
private final AppCompatEmojiEditTextHelper mAppCompatEmojiEditTextHelper;
private final AppCompatBackgroundHelper mBackgroundTintHelper;
private final TextViewOnReceiveContentListener mDefaultOnReceiveContentListener;
@Nullable
private SuperCaller mSuperCaller;
private final AppCompatTextClassifierHelper mTextClassifierHelper;
private final AppCompatTextHelper mTextHelper;
@RequiresApi(29)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final class InspectionCompanion implements android.view.inspector.InspectionCompanion {
private int mBackgroundTintId;
private int mBackgroundTintModeId;
private int mDrawableTintId;
private int mDrawableTintModeId;
private boolean mPropertiesMapped = false;
public void mapProperties(@NonNull PropertyMapper propertyMapper) {
int mapObject;
int mapObject2;
int mapObject3;
int mapObject4;
mapObject = propertyMapper.mapObject("backgroundTint", R.attr.backgroundTint);
this.mBackgroundTintId = mapObject;
mapObject2 = propertyMapper.mapObject("backgroundTintMode", R.attr.backgroundTintMode);
this.mBackgroundTintModeId = mapObject2;
mapObject3 = propertyMapper.mapObject("drawableTint", R.attr.drawableTint);
this.mDrawableTintId = mapObject3;
mapObject4 = propertyMapper.mapObject("drawableTintMode", R.attr.drawableTintMode);
this.mDrawableTintModeId = mapObject4;
this.mPropertiesMapped = true;
}
public void readProperties(@NonNull AppCompatEditText appCompatEditText, @NonNull PropertyReader propertyReader) {
if (!this.mPropertiesMapped) {
throw AppCompatAutoCompleteTextView$InspectionCompanion$$ExternalSyntheticApiModelOutline2.m();
}
propertyReader.readObject(this.mBackgroundTintId, appCompatEditText.getBackgroundTintList());
propertyReader.readObject(this.mBackgroundTintModeId, appCompatEditText.getBackgroundTintMode());
propertyReader.readObject(this.mDrawableTintId, appCompatEditText.getCompoundDrawableTintList());
propertyReader.readObject(this.mDrawableTintModeId, appCompatEditText.getCompoundDrawableTintMode());
}
}
public AppCompatEditText(@NonNull Context context) {
this(context, null);
}
public AppCompatEditText(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, R.attr.editTextStyle);
}
public AppCompatEditText(@NonNull Context context, @Nullable 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);
}
public 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
@Nullable
public Editable getText() {
if (Build.VERSION.SDK_INT >= 28) {
return super.getText();
}
return super.getEditableText();
}
@Override // android.view.View
public void setBackgroundResource(@DrawableRes int i) {
super.setBackgroundResource(i);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundResource(i);
}
}
@Override // android.view.View
public void setBackgroundDrawable(@Nullable Drawable drawable) {
super.setBackgroundDrawable(drawable);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
}
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintList(@Nullable ColorStateList colorStateList) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportBackgroundTintList() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintList();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportBackgroundTintMode() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
}
return null;
}
@Override // android.widget.TextView, android.view.View
public 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
@Nullable
public InputConnection onCreateInputConnection(@NonNull 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(@Nullable ActionMode.Callback callback) {
super.setCustomSelectionActionModeCallback(TextViewCompat.wrapCustomSelectionActionModeCallback(this, callback));
}
@Override // android.widget.TextView
@Nullable
public ActionMode.Callback getCustomSelectionActionModeCallback() {
return TextViewCompat.unwrapCustomSelectionActionModeCallback(super.getCustomSelectionActionModeCallback());
}
@Override // android.view.View
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
int i = Build.VERSION.SDK_INT;
if (i < 30 || i >= 33) {
return;
}
((InputMethodManager) getContext().getSystemService("input_method")).isActive(this);
}
@NonNull
@RequiresApi(26)
@UiThread
private SuperCaller getSuperCaller() {
if (this.mSuperCaller == null) {
this.mSuperCaller = new SuperCaller();
}
return this.mSuperCaller;
}
@Override // android.widget.TextView
@RequiresApi(api = 26)
public void setTextClassifier(@Nullable 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
@NonNull
@RequiresApi(api = 26)
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
@Nullable
public ContentInfoCompat onReceiveContent(@NonNull ContentInfoCompat contentInfoCompat) {
return this.mDefaultOnReceiveContentListener.onReceiveContent(this, contentInfoCompat);
}
@Override // android.widget.TextView
public void setKeyListener(@Nullable 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(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper != null) {
appCompatTextHelper.onSetCompoundDrawables();
}
}
@Override // android.widget.TextView
public void setCompoundDrawablesRelative(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper != null) {
appCompatTextHelper.onSetCompoundDrawables();
}
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportCompoundDrawablesTintList() {
return this.mTextHelper.getCompoundDrawableTintList();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList colorStateList) {
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
this.mTextHelper.applyCompoundDrawablesTints();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
return this.mTextHelper.getCompoundDrawableTintMode();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode mode) {
this.mTextHelper.setCompoundDrawableTintMode(mode);
this.mTextHelper.applyCompoundDrawablesTints();
}
@RequiresApi(api = 26)
public class SuperCaller {
public SuperCaller() {
}
@Nullable
public TextClassifier getTextClassifier() {
return AppCompatEditText.super.getTextClassifier();
}
public void setTextClassifier(TextClassifier textClassifier) {
AppCompatEditText.super.setTextClassifier(textClassifier);
}
}
}

View File

@@ -0,0 +1,62 @@
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.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.R;
import androidx.emoji2.viewsintegration.EmojiEditTextHelper;
/* loaded from: classes.dex */
class AppCompatEmojiEditTextHelper {
@NonNull
private final EmojiEditTextHelper mEmojiEditTextHelper;
@NonNull
private final EditText mView;
public AppCompatEmojiEditTextHelper(@NonNull EditText editText) {
this.mView = editText;
this.mEmojiEditTextHelper = new EmojiEditTextHelper(editText, false);
}
public void loadFromAttributes(@Nullable 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;
}
}
public boolean isEmojiCapableKeyListener(KeyListener keyListener) {
return !(keyListener instanceof NumberKeyListener);
}
public void setEnabled(boolean z) {
this.mEmojiEditTextHelper.setEnabled(z);
}
public boolean isEnabled() {
return this.mEmojiEditTextHelper.isEnabled();
}
@Nullable
public KeyListener getKeyListener(@Nullable KeyListener keyListener) {
return isEmojiCapableKeyListener(keyListener) ? this.mEmojiEditTextHelper.getKeyListener(keyListener) : keyListener;
}
@Nullable
public InputConnection onCreateInputConnection(@Nullable InputConnection inputConnection, @NonNull EditorInfo editorInfo) {
return this.mEmojiEditTextHelper.onCreateInputConnection(inputConnection, editorInfo);
}
}

View File

@@ -0,0 +1,60 @@
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.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.R;
import androidx.emoji2.viewsintegration.EmojiTextViewHelper;
/* loaded from: classes.dex */
class AppCompatEmojiTextHelper {
@NonNull
private final EmojiTextViewHelper mEmojiTextViewHelper;
@NonNull
private final TextView mView;
public AppCompatEmojiTextHelper(@NonNull TextView textView) {
this.mView = textView;
this.mEmojiTextViewHelper = new EmojiTextViewHelper(textView, false);
}
public void loadFromAttributes(@Nullable 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;
}
}
public void setEnabled(boolean z) {
this.mEmojiTextViewHelper.setEnabled(z);
}
public boolean isEnabled() {
return this.mEmojiTextViewHelper.isEnabled();
}
@NonNull
public InputFilter[] getFilters(@NonNull InputFilter[] inputFilterArr) {
return this.mEmojiTextViewHelper.getFilters(inputFilterArr);
}
public void setAllCaps(boolean z) {
this.mEmojiTextViewHelper.setAllCaps(z);
}
@Nullable
public TransformationMethod wrapTransformationMethod(@Nullable TransformationMethod transformationMethod) {
return this.mEmojiTextViewHelper.wrapTransformationMethod(transformationMethod);
}
}

View File

@@ -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 {
public 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() {
}
}

View File

@@ -0,0 +1,245 @@
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.view.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
import android.widget.ImageButton;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
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;
@RequiresApi(29)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final class InspectionCompanion implements android.view.inspector.InspectionCompanion {
private int mBackgroundTintId;
private int mBackgroundTintModeId;
private boolean mPropertiesMapped = false;
private int mTintId;
private int mTintModeId;
public void mapProperties(@NonNull PropertyMapper propertyMapper) {
int mapObject;
int mapObject2;
int mapObject3;
int mapObject4;
mapObject = propertyMapper.mapObject("backgroundTint", R.attr.backgroundTint);
this.mBackgroundTintId = mapObject;
mapObject2 = propertyMapper.mapObject("backgroundTintMode", R.attr.backgroundTintMode);
this.mBackgroundTintModeId = mapObject2;
mapObject3 = propertyMapper.mapObject("tint", R.attr.tint);
this.mTintId = mapObject3;
mapObject4 = propertyMapper.mapObject("tintMode", R.attr.tintMode);
this.mTintModeId = mapObject4;
this.mPropertiesMapped = true;
}
public void readProperties(@NonNull AppCompatImageButton appCompatImageButton, @NonNull PropertyReader propertyReader) {
if (!this.mPropertiesMapped) {
throw AppCompatAutoCompleteTextView$InspectionCompanion$$ExternalSyntheticApiModelOutline2.m();
}
propertyReader.readObject(this.mBackgroundTintId, appCompatImageButton.getBackgroundTintList());
propertyReader.readObject(this.mBackgroundTintModeId, appCompatImageButton.getBackgroundTintMode());
propertyReader.readObject(this.mTintId, appCompatImageButton.getImageTintList());
propertyReader.readObject(this.mTintModeId, appCompatImageButton.getImageTintMode());
}
}
public AppCompatImageButton(@NonNull Context context) {
this(context, null);
}
public AppCompatImageButton(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, R.attr.imageButtonStyle);
}
public AppCompatImageButton(@NonNull Context context, @Nullable 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(@DrawableRes int i) {
this.mImageHelper.setImageResource(i);
}
@Override // android.widget.ImageView
public void setImageDrawable(@Nullable 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(@Nullable Uri uri) {
super.setImageURI(uri);
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
appCompatImageHelper.applySupportImageTint();
}
}
@Override // android.view.View
public void setBackgroundResource(@DrawableRes int i) {
super.setBackgroundResource(i);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundResource(i);
}
}
@Override // android.view.View
public void setBackgroundDrawable(@Nullable Drawable drawable) {
super.setBackgroundDrawable(drawable);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
}
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintList(@Nullable ColorStateList colorStateList) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportBackgroundTintList() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintList();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportBackgroundTintMode() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
}
return null;
}
@Override // androidx.core.widget.TintableImageSourceView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportImageTintList(@Nullable ColorStateList colorStateList) {
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
appCompatImageHelper.setSupportImageTintList(colorStateList);
}
}
@Override // androidx.core.widget.TintableImageSourceView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportImageTintList() {
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
return appCompatImageHelper.getSupportImageTintList();
}
return null;
}
@Override // androidx.core.widget.TintableImageSourceView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportImageTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
appCompatImageHelper.setSupportImageTintMode(mode);
}
}
@Override // androidx.core.widget.TintableImageSourceView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportImageTintMode() {
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
return appCompatImageHelper.getSupportImageTintMode();
}
return null;
}
@Override // android.widget.ImageView, android.view.View
public 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;
}
}

View File

@@ -0,0 +1,181 @@
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.util.AttributeSet;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.view.ViewCompat;
import androidx.core.widget.ImageViewCompat;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public class AppCompatImageHelper {
private TintInfo mImageTint;
private TintInfo mInternalImageTint;
private int mLevel = 0;
private TintInfo mTmpInfo;
@NonNull
private final ImageView mView;
private boolean shouldApplyFrameworkTintUsingColorFilter() {
return this.mInternalImageTint != null;
}
public AppCompatImageHelper(@NonNull 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));
}
obtainStyledAttributes.recycle();
} catch (Throwable th) {
obtainStyledAttributes.recycle();
throw th;
}
}
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();
}
public boolean hasOverlappingRendering() {
return !(this.mView.getBackground() instanceof RippleDrawable);
}
public void setSupportImageTintList(ColorStateList colorStateList) {
if (this.mImageTint == null) {
this.mImageTint = new TintInfo();
}
TintInfo tintInfo = this.mImageTint;
tintInfo.mTintList = colorStateList;
tintInfo.mHasTintList = true;
applySupportImageTint();
}
public ColorStateList getSupportImageTintList() {
TintInfo tintInfo = this.mImageTint;
if (tintInfo != null) {
return tintInfo.mTintList;
}
return null;
}
public void setSupportImageTintMode(PorterDuff.Mode mode) {
if (this.mImageTint == null) {
this.mImageTint = new TintInfo();
}
TintInfo tintInfo = this.mImageTint;
tintInfo.mTintMode = mode;
tintInfo.mHasTintMode = true;
applySupportImageTint();
}
public PorterDuff.Mode getSupportImageTintMode() {
TintInfo tintInfo = this.mImageTint;
if (tintInfo != null) {
return tintInfo.mTintMode;
}
return null;
}
public 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());
}
}
}
public void setInternalImageTint(ColorStateList colorStateList) {
if (colorStateList != null) {
if (this.mInternalImageTint == null) {
this.mInternalImageTint = new TintInfo();
}
TintInfo tintInfo = this.mInternalImageTint;
tintInfo.mTintList = colorStateList;
tintInfo.mHasTintList = true;
} else {
this.mInternalImageTint = null;
}
applySupportImageTint();
}
private boolean applyFrameworkTintUsingColorFilter(@NonNull 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;
}
public void obtainLevelFromDrawable(@NonNull Drawable drawable) {
this.mLevel = drawable.getLevel();
}
public void applyImageLevel() {
if (this.mView.getDrawable() != null) {
this.mView.getDrawable().setLevel(this.mLevel);
}
}
}

View File

@@ -0,0 +1,248 @@
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.view.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
import android.widget.ImageView;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
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;
@RequiresApi(29)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final class InspectionCompanion implements android.view.inspector.InspectionCompanion {
private int mBackgroundTintId;
private int mBackgroundTintModeId;
private boolean mPropertiesMapped = false;
private int mTintId;
private int mTintModeId;
public void mapProperties(@NonNull PropertyMapper propertyMapper) {
int mapObject;
int mapObject2;
int mapObject3;
int mapObject4;
mapObject = propertyMapper.mapObject("backgroundTint", R.attr.backgroundTint);
this.mBackgroundTintId = mapObject;
mapObject2 = propertyMapper.mapObject("backgroundTintMode", R.attr.backgroundTintMode);
this.mBackgroundTintModeId = mapObject2;
mapObject3 = propertyMapper.mapObject("tint", R.attr.tint);
this.mTintId = mapObject3;
mapObject4 = propertyMapper.mapObject("tintMode", R.attr.tintMode);
this.mTintModeId = mapObject4;
this.mPropertiesMapped = true;
}
public void readProperties(@NonNull AppCompatImageView appCompatImageView, @NonNull PropertyReader propertyReader) {
if (!this.mPropertiesMapped) {
throw AppCompatAutoCompleteTextView$InspectionCompanion$$ExternalSyntheticApiModelOutline2.m();
}
propertyReader.readObject(this.mBackgroundTintId, appCompatImageView.getBackgroundTintList());
propertyReader.readObject(this.mBackgroundTintModeId, appCompatImageView.getBackgroundTintMode());
propertyReader.readObject(this.mTintId, appCompatImageView.getImageTintList());
propertyReader.readObject(this.mTintModeId, appCompatImageView.getImageTintMode());
}
}
public AppCompatImageView(@NonNull Context context) {
this(context, null);
}
public AppCompatImageView(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public AppCompatImageView(@NonNull Context context, @Nullable 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(@DrawableRes int i) {
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
appCompatImageHelper.setImageResource(i);
}
}
@Override // android.widget.ImageView
public void setImageDrawable(@Nullable 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(@Nullable Uri uri) {
super.setImageURI(uri);
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
appCompatImageHelper.applySupportImageTint();
}
}
@Override // android.view.View
public void setBackgroundResource(@DrawableRes int i) {
super.setBackgroundResource(i);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundResource(i);
}
}
@Override // android.view.View
public void setBackgroundDrawable(@Nullable Drawable drawable) {
super.setBackgroundDrawable(drawable);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
}
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintList(@Nullable ColorStateList colorStateList) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportBackgroundTintList() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintList();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportBackgroundTintMode() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
}
return null;
}
@Override // androidx.core.widget.TintableImageSourceView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportImageTintList(@Nullable ColorStateList colorStateList) {
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
appCompatImageHelper.setSupportImageTintList(colorStateList);
}
}
@Override // androidx.core.widget.TintableImageSourceView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportImageTintList() {
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
return appCompatImageHelper.getSupportImageTintList();
}
return null;
}
@Override // androidx.core.widget.TintableImageSourceView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportImageTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
appCompatImageHelper.setSupportImageTintMode(mode);
}
}
@Override // androidx.core.widget.TintableImageSourceView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportImageTintMode() {
AppCompatImageHelper appCompatImageHelper = this.mImageHelper;
if (appCompatImageHelper != null) {
return appCompatImageHelper.getSupportImageTintMode();
}
return null;
}
@Override // android.widget.ImageView, android.view.View
public 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;
}
}

View File

@@ -0,0 +1,267 @@
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.view.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
import android.widget.MultiAutoCompleteTextView;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
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};
@NonNull
private final AppCompatEmojiEditTextHelper mAppCompatEmojiEditTextHelper;
private final AppCompatBackgroundHelper mBackgroundTintHelper;
private final AppCompatTextHelper mTextHelper;
@RequiresApi(29)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final class InspectionCompanion implements android.view.inspector.InspectionCompanion {
private int mBackgroundTintId;
private int mBackgroundTintModeId;
private int mDrawableTintId;
private int mDrawableTintModeId;
private boolean mPropertiesMapped = false;
public void mapProperties(@NonNull PropertyMapper propertyMapper) {
int mapObject;
int mapObject2;
int mapObject3;
int mapObject4;
mapObject = propertyMapper.mapObject("backgroundTint", androidx.appcompat.R.attr.backgroundTint);
this.mBackgroundTintId = mapObject;
mapObject2 = propertyMapper.mapObject("backgroundTintMode", androidx.appcompat.R.attr.backgroundTintMode);
this.mBackgroundTintModeId = mapObject2;
mapObject3 = propertyMapper.mapObject("drawableTint", androidx.appcompat.R.attr.drawableTint);
this.mDrawableTintId = mapObject3;
mapObject4 = propertyMapper.mapObject("drawableTintMode", androidx.appcompat.R.attr.drawableTintMode);
this.mDrawableTintModeId = mapObject4;
this.mPropertiesMapped = true;
}
public void readProperties(@NonNull AppCompatMultiAutoCompleteTextView appCompatMultiAutoCompleteTextView, @NonNull PropertyReader propertyReader) {
if (!this.mPropertiesMapped) {
throw AppCompatAutoCompleteTextView$InspectionCompanion$$ExternalSyntheticApiModelOutline2.m();
}
propertyReader.readObject(this.mBackgroundTintId, appCompatMultiAutoCompleteTextView.getBackgroundTintList());
propertyReader.readObject(this.mBackgroundTintModeId, appCompatMultiAutoCompleteTextView.getBackgroundTintMode());
propertyReader.readObject(this.mDrawableTintId, appCompatMultiAutoCompleteTextView.getCompoundDrawableTintList());
propertyReader.readObject(this.mDrawableTintModeId, appCompatMultiAutoCompleteTextView.getCompoundDrawableTintMode());
}
}
public AppCompatMultiAutoCompleteTextView(@NonNull Context context) {
this(context, null);
}
public AppCompatMultiAutoCompleteTextView(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, androidx.appcompat.R.attr.autoCompleteTextViewStyle);
}
public AppCompatMultiAutoCompleteTextView(@NonNull Context context, @Nullable 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);
}
public 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(@DrawableRes int i) {
setDropDownBackgroundDrawable(AppCompatResources.getDrawable(getContext(), i));
}
@Override // android.view.View
public void setBackgroundResource(@DrawableRes int i) {
super.setBackgroundResource(i);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundResource(i);
}
}
@Override // android.view.View
public void setBackgroundDrawable(@Nullable Drawable drawable) {
super.setBackgroundDrawable(drawable);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
}
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintList(@Nullable ColorStateList colorStateList) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportBackgroundTintList() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintList();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportBackgroundTintMode() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
}
return null;
}
@Override // android.widget.TextView, android.view.View
public 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(@Nullable 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(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper != null) {
appCompatTextHelper.onSetCompoundDrawables();
}
}
@Override // android.widget.TextView
public void setCompoundDrawablesRelative(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper != null) {
appCompatTextHelper.onSetCompoundDrawables();
}
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportCompoundDrawablesTintList() {
return this.mTextHelper.getCompoundDrawableTintList();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList colorStateList) {
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
this.mTextHelper.applyCompoundDrawablesTints();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
return this.mTextHelper.getCompoundDrawableTintMode();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode mode) {
this.mTextHelper.setCompoundDrawableTintMode(mode);
this.mTextHelper.applyCompoundDrawablesTints();
}
}

View File

@@ -0,0 +1,69 @@
package androidx.appcompat.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.PopupWindow;
import androidx.annotation.AttrRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StyleRes;
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(@NonNull Context context, @Nullable AttributeSet attributeSet, @AttrRes int i) {
super(context, attributeSet, i);
init(context, attributeSet, i, 0);
}
public AppCompatPopupWindow(@NonNull Context context, @Nullable AttributeSet attributeSet, @AttrRes int i, @StyleRes 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);
}
}
}

View File

@@ -0,0 +1,126 @@
package androidx.appcompat.widget;
import android.R;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Shader;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RoundRectShape;
import android.graphics.drawable.shapes.Shape;
import android.util.AttributeSet;
import android.widget.ProgressBar;
import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;
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;
public Bitmap getSampleTile() {
return this.mSampleTile;
}
public AppCompatProgressBarHelper(ProgressBar progressBar) {
this.mView = progressBar;
}
public 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 */
@VisibleForTesting
public 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));
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);
}
@RequiresApi(23)
public 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));
}
}
}

View File

@@ -0,0 +1,298 @@
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.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
import android.widget.RadioButton;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
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;
@RequiresApi(29)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final class InspectionCompanion implements android.view.inspector.InspectionCompanion {
private int mBackgroundTintId;
private int mBackgroundTintModeId;
private int mButtonTintId;
private int mButtonTintModeId;
private int mDrawableTintId;
private int mDrawableTintModeId;
private boolean mPropertiesMapped = false;
public void mapProperties(@NonNull PropertyMapper propertyMapper) {
int mapObject;
int mapObject2;
int mapObject3;
int mapObject4;
int mapObject5;
int mapObject6;
mapObject = propertyMapper.mapObject("backgroundTint", R.attr.backgroundTint);
this.mBackgroundTintId = mapObject;
mapObject2 = propertyMapper.mapObject("backgroundTintMode", R.attr.backgroundTintMode);
this.mBackgroundTintModeId = mapObject2;
mapObject3 = propertyMapper.mapObject("buttonTint", R.attr.buttonTint);
this.mButtonTintId = mapObject3;
mapObject4 = propertyMapper.mapObject("buttonTintMode", R.attr.buttonTintMode);
this.mButtonTintModeId = mapObject4;
mapObject5 = propertyMapper.mapObject("drawableTint", R.attr.drawableTint);
this.mDrawableTintId = mapObject5;
mapObject6 = propertyMapper.mapObject("drawableTintMode", R.attr.drawableTintMode);
this.mDrawableTintModeId = mapObject6;
this.mPropertiesMapped = true;
}
public void readProperties(@NonNull AppCompatRadioButton appCompatRadioButton, @NonNull PropertyReader propertyReader) {
if (!this.mPropertiesMapped) {
throw AppCompatAutoCompleteTextView$InspectionCompanion$$ExternalSyntheticApiModelOutline2.m();
}
propertyReader.readObject(this.mBackgroundTintId, appCompatRadioButton.getBackgroundTintList());
propertyReader.readObject(this.mBackgroundTintModeId, appCompatRadioButton.getBackgroundTintMode());
propertyReader.readObject(this.mButtonTintId, appCompatRadioButton.getButtonTintList());
propertyReader.readObject(this.mButtonTintModeId, appCompatRadioButton.getButtonTintMode());
propertyReader.readObject(this.mDrawableTintId, appCompatRadioButton.getCompoundDrawableTintList());
propertyReader.readObject(this.mDrawableTintModeId, appCompatRadioButton.getCompoundDrawableTintMode());
}
}
public AppCompatRadioButton(Context context) {
this(context, null);
}
public AppCompatRadioButton(Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, R.attr.radioButtonStyle);
}
public AppCompatRadioButton(Context context, @Nullable 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);
}
@NonNull
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(@DrawableRes int i) {
setButtonDrawable(AppCompatResources.getDrawable(getContext(), i));
}
@Override // androidx.core.widget.TintableCompoundButton
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportButtonTintList(@Nullable ColorStateList colorStateList) {
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
if (appCompatCompoundButtonHelper != null) {
appCompatCompoundButtonHelper.setSupportButtonTintList(colorStateList);
}
}
@Override // androidx.core.widget.TintableCompoundButton
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportButtonTintList() {
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
if (appCompatCompoundButtonHelper != null) {
return appCompatCompoundButtonHelper.getSupportButtonTintList();
}
return null;
}
@Override // androidx.core.widget.TintableCompoundButton
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportButtonTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
if (appCompatCompoundButtonHelper != null) {
appCompatCompoundButtonHelper.setSupportButtonTintMode(mode);
}
}
@Override // androidx.core.widget.TintableCompoundButton
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportButtonTintMode() {
AppCompatCompoundButtonHelper appCompatCompoundButtonHelper = this.mCompoundButtonHelper;
if (appCompatCompoundButtonHelper != null) {
return appCompatCompoundButtonHelper.getSupportButtonTintMode();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintList(@Nullable ColorStateList colorStateList) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportBackgroundTintList() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintList();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportBackgroundTintMode() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
}
return null;
}
@Override // android.view.View
public void setBackgroundDrawable(@Nullable Drawable drawable) {
super.setBackgroundDrawable(drawable);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
}
}
@Override // android.view.View
public void setBackgroundResource(@DrawableRes 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
public 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(@NonNull 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(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper != null) {
appCompatTextHelper.onSetCompoundDrawables();
}
}
@Override // android.widget.TextView
public void setCompoundDrawablesRelative(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper != null) {
appCompatTextHelper.onSetCompoundDrawables();
}
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportCompoundDrawablesTintList() {
return this.mTextHelper.getCompoundDrawableTintList();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList colorStateList) {
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
this.mTextHelper.applyCompoundDrawablesTints();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
return this.mTextHelper.getCompoundDrawableTintMode();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode mode) {
this.mTextHelper.setCompoundDrawableTintMode(mode);
this.mTextHelper.applyCompoundDrawablesTints();
}
}

View File

@@ -0,0 +1,40 @@
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.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.R;
/* loaded from: classes.dex */
public class AppCompatRatingBar extends RatingBar {
private final AppCompatProgressBarHelper mAppCompatProgressBarHelper;
public AppCompatRatingBar(@NonNull Context context) {
this(context, null);
}
public AppCompatRatingBar(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, R.attr.ratingBarStyle);
}
public AppCompatRatingBar(@NonNull Context context, @Nullable 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
public 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());
}
}
}

View File

@@ -0,0 +1,100 @@
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.view.DragEvent;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
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() {
}
public static boolean maybeHandleMenuActionViaPerformReceiveContent(@NonNull 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;
}
public static boolean maybeHandleDragEventViaPerformReceiveContent(@NonNull View view, @NonNull DragEvent dragEvent) {
if (Build.VERSION.SDK_INT < 31 && dragEvent.getLocalState() == null && ViewCompat.getOnReceiveContentMimeTypes(view) != null) {
Activity tryGetActivity = tryGetActivity(view);
if (tryGetActivity == null) {
StringBuilder sb = new StringBuilder();
sb.append("Can't handle drop: no activity: view=");
sb.append(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;
}
@RequiresApi(24)
public static final class OnDropApi24Impl {
private OnDropApi24Impl() {
}
@DoNotInline
public static boolean onDropForTextView(@NonNull DragEvent dragEvent, @NonNull TextView textView, @NonNull 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;
}
}
@DoNotInline
public static boolean onDropForView(@NonNull DragEvent dragEvent, @NonNull View view, @NonNull Activity activity) {
activity.requestDragAndDropPermissions(dragEvent);
ViewCompat.performReceiveContent(view, new ContentInfoCompat.Builder(dragEvent.getClipData(), 3).build());
return true;
}
}
@Nullable
public static Activity tryGetActivity(@NonNull View view) {
for (Context context = view.getContext(); context instanceof ContextWrapper; context = ((ContextWrapper) context).getBaseContext()) {
if (context instanceof Activity) {
return (Activity) context;
}
}
return null;
}
}

View File

@@ -0,0 +1,48 @@
package androidx.appcompat.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.widget.SeekBar;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.R;
/* loaded from: classes.dex */
public class AppCompatSeekBar extends SeekBar {
private final AppCompatSeekBarHelper mAppCompatSeekBarHelper;
public AppCompatSeekBar(@NonNull Context context) {
this(context, null);
}
public AppCompatSeekBar(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, R.attr.seekBarStyle);
}
public AppCompatSeekBar(@NonNull Context context, @Nullable 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
public synchronized void onDraw(Canvas canvas) {
super.onDraw(canvas);
this.mAppCompatSeekBarHelper.drawTickMarks(canvas);
}
@Override // android.widget.AbsSeekBar, android.widget.ProgressBar, android.view.View
public 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();
}
}

View File

@@ -0,0 +1,152 @@
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.annotation.Nullable;
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;
@Nullable
public Drawable getTickMark() {
return this.mTickMark;
}
@Nullable
public ColorStateList getTickMarkTintList() {
return this.mTickMarkTintList;
}
@Nullable
public PorterDuff.Mode getTickMarkTintMode() {
return this.mTickMarkTintMode;
}
public 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
public 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();
}
public void setTickMark(@Nullable 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, this.mView.getLayoutDirection());
if (drawable.isStateful()) {
drawable.setState(this.mView.getDrawableState());
}
applyTickMarkTint();
}
this.mView.invalidate();
}
public void setTickMarkTintList(@Nullable ColorStateList colorStateList) {
this.mTickMarkTintList = colorStateList;
this.mHasTickMarkTint = true;
applyTickMarkTint();
}
public void setTickMarkTintMode(@Nullable 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());
}
}
}
}
public void jumpDrawablesToCurrentState() {
Drawable drawable = this.mTickMark;
if (drawable != null) {
drawable.jumpToCurrentState();
}
}
public void drawableStateChanged() {
Drawable drawable = this.mTickMark;
if (drawable != null && drawable.isStateful() && drawable.setState(this.mView.getDrawableState())) {
this.mView.invalidateDrawable(drawable);
}
}
public 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);
}
}
}
}

View File

@@ -0,0 +1,972 @@
package androidx.appcompat.widget;
import android.R;
import android.annotation.SuppressLint;
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.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.view.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
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.annotation.DoNotInline;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.annotation.StyleableRes;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.util.ObjectsCompat;
import androidx.core.view.TintableBackgroundView;
/* loaded from: classes.dex */
public class AppCompatSpinner extends Spinner implements TintableBackgroundView {
@SuppressLint({"ResourceType"})
@StyleableRes
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;
@VisibleForTesting
public 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);
}
@VisibleForTesting
public final SpinnerPopup getInternalPopup() {
return this.mPopup;
}
@Override // android.widget.Spinner
public Context getPopupContext() {
return this.mPopupContext;
}
@RequiresApi(29)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final class InspectionCompanion implements android.view.inspector.InspectionCompanion {
private int mBackgroundTintId;
private int mBackgroundTintModeId;
private boolean mPropertiesMapped = false;
public void mapProperties(@NonNull PropertyMapper propertyMapper) {
int mapObject;
int mapObject2;
mapObject = propertyMapper.mapObject("backgroundTint", androidx.appcompat.R.attr.backgroundTint);
this.mBackgroundTintId = mapObject;
mapObject2 = propertyMapper.mapObject("backgroundTintMode", androidx.appcompat.R.attr.backgroundTintMode);
this.mBackgroundTintModeId = mapObject2;
this.mPropertiesMapped = true;
}
public void readProperties(@NonNull AppCompatSpinner appCompatSpinner, @NonNull PropertyReader propertyReader) {
if (!this.mPropertiesMapped) {
throw AppCompatAutoCompleteTextView$InspectionCompanion$$ExternalSyntheticApiModelOutline2.m();
}
propertyReader.readObject(this.mBackgroundTintId, appCompatSpinner.getBackgroundTintList());
propertyReader.readObject(this.mBackgroundTintModeId, appCompatSpinner.getBackgroundTintMode());
}
}
public AppCompatSpinner(@NonNull Context context) {
this(context, (AttributeSet) null);
}
public AppCompatSpinner(@NonNull Context context, int i) {
this(context, null, androidx.appcompat.R.attr.spinnerStyle, i);
}
public AppCompatSpinner(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, androidx.appcompat.R.attr.spinnerStyle);
}
public AppCompatSpinner(@NonNull Context context, @Nullable AttributeSet attributeSet, int i) {
this(context, attributeSet, i, -1);
}
public AppCompatSpinner(@NonNull Context context, @Nullable AttributeSet attributeSet, int i, int i2) {
this(context, attributeSet, i, i2, null);
}
/* JADX WARN: Code restructure failed: missing block: B:29:0x0061, code lost:
if (r10 == null) goto L27;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public AppCompatSpinner(@androidx.annotation.NonNull android.content.Context r6, @androidx.annotation.Nullable android.util.AttributeSet r7, int r8, int r9, android.content.res.Resources.Theme r10) {
/*
r5 = this;
r5.<init>(r6, r7, r8)
android.graphics.Rect r0 = new android.graphics.Rect
r0.<init>()
r5.mTempRect = r0
android.content.Context r0 = r5.getContext()
androidx.appcompat.widget.ThemeUtils.checkAppCompatTheme(r5, r0)
int[] r0 = androidx.appcompat.R.styleable.Spinner
r1 = 0
androidx.appcompat.widget.TintTypedArray r0 = androidx.appcompat.widget.TintTypedArray.obtainStyledAttributes(r6, r7, r0, r8, r1)
androidx.appcompat.widget.AppCompatBackgroundHelper r2 = new androidx.appcompat.widget.AppCompatBackgroundHelper
r2.<init>(r5)
r5.mBackgroundTintHelper = r2
if (r10 == 0) goto L29
androidx.appcompat.view.ContextThemeWrapper r2 = new androidx.appcompat.view.ContextThemeWrapper
r2.<init>(r6, r10)
r5.mPopupContext = r2
goto L3b
L29:
int r10 = androidx.appcompat.R.styleable.Spinner_popupTheme
int r10 = r0.getResourceId(r10, r1)
if (r10 == 0) goto L39
androidx.appcompat.view.ContextThemeWrapper r2 = new androidx.appcompat.view.ContextThemeWrapper
r2.<init>(r6, r10)
r5.mPopupContext = r2
goto L3b
L39:
r5.mPopupContext = r6
L3b:
r10 = -1
r2 = 0
if (r9 != r10) goto L64
int[] r10 = androidx.appcompat.widget.AppCompatSpinner.ATTRS_ANDROID_SPINNERMODE // Catch: java.lang.Throwable -> L57 java.lang.Exception -> L59
android.content.res.TypedArray r10 = r6.obtainStyledAttributes(r7, r10, r8, r1) // Catch: java.lang.Throwable -> L57 java.lang.Exception -> L59
boolean r3 = r10.hasValue(r1) // Catch: java.lang.Throwable -> L50 java.lang.Exception -> L61
if (r3 == 0) goto L53
int r9 = r10.getInt(r1, r1) // Catch: java.lang.Throwable -> L50 java.lang.Exception -> L61
goto L53
L50:
r6 = move-exception
r2 = r10
goto L5b
L53:
r10.recycle()
goto L64
L57:
r6 = move-exception
goto L5b
L59:
r10 = r2
goto L61
L5b:
if (r2 == 0) goto L60
r2.recycle()
L60:
throw r6
L61:
if (r10 == 0) goto L64
goto L53
L64:
r10 = 1
if (r9 == 0) goto La1
if (r9 == r10) goto L6a
goto Lb1
L6a:
androidx.appcompat.widget.AppCompatSpinner$DropdownPopup r9 = new androidx.appcompat.widget.AppCompatSpinner$DropdownPopup
android.content.Context r3 = r5.mPopupContext
r9.<init>(r3, r7, r8)
android.content.Context r3 = r5.mPopupContext
int[] r4 = androidx.appcompat.R.styleable.Spinner
androidx.appcompat.widget.TintTypedArray r1 = androidx.appcompat.widget.TintTypedArray.obtainStyledAttributes(r3, r7, r4, r8, r1)
int r3 = androidx.appcompat.R.styleable.Spinner_android_dropDownWidth
r4 = -2
int r3 = r1.getLayoutDimension(r3, r4)
r5.mDropDownWidth = r3
int r3 = androidx.appcompat.R.styleable.Spinner_android_popupBackground
android.graphics.drawable.Drawable r3 = r1.getDrawable(r3)
r9.setBackgroundDrawable(r3)
int r3 = androidx.appcompat.R.styleable.Spinner_android_prompt
java.lang.String r3 = r0.getString(r3)
r9.setPromptText(r3)
r1.recycle()
r5.mPopup = r9
androidx.appcompat.widget.AppCompatSpinner$1 r1 = new androidx.appcompat.widget.AppCompatSpinner$1
r1.<init>(r5)
r5.mForwardingListener = r1
goto Lb1
La1:
androidx.appcompat.widget.AppCompatSpinner$DialogPopup r9 = new androidx.appcompat.widget.AppCompatSpinner$DialogPopup
r9.<init>()
r5.mPopup = r9
int r1 = androidx.appcompat.R.styleable.Spinner_android_prompt
java.lang.String r1 = r0.getString(r1)
r9.setPromptText(r1)
Lb1:
int r9 = androidx.appcompat.R.styleable.Spinner_android_entries
java.lang.CharSequence[] r9 = r0.getTextArray(r9)
if (r9 == 0) goto Lc9
android.widget.ArrayAdapter r1 = new android.widget.ArrayAdapter
r3 = 17367048(0x1090008, float:2.5162948E-38)
r1.<init>(r6, r3, r9)
int r6 = androidx.appcompat.R.layout.support_simple_spinner_dropdown_item
r1.setDropDownViewResource(r6)
r5.setAdapter(r1)
Lc9:
r0.recycle()
r5.mPopupSet = r10
android.widget.SpinnerAdapter r6 = r5.mTempAdapter
if (r6 == 0) goto Ld7
r5.setAdapter(r6)
r5.mTempAdapter = r2
Ld7:
androidx.appcompat.widget.AppCompatBackgroundHelper r6 = r5.mBackgroundTintHelper
r6.loadFromAttributes(r7, r8)
return
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AppCompatSpinner.<init>(android.content.Context, android.util.AttributeSet, int, int, android.content.res.Resources$Theme):void");
}
@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(@DrawableRes 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
public 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
public 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(@DrawableRes int i) {
super.setBackgroundResource(i);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundResource(i);
}
}
@Override // android.view.View
public void setBackgroundDrawable(@Nullable Drawable drawable) {
super.setBackgroundDrawable(drawable);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
}
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintList(@Nullable ColorStateList colorStateList) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportBackgroundTintList() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintList();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportBackgroundTintMode() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintMode();
}
return null;
}
@Override // android.view.ViewGroup, android.view.View
public void drawableStateChanged() {
super.drawableStateChanged();
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.applySupportBackgroundTint();
}
}
public 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);
Rect rect = this.mTempRect;
return i2 + rect.left + rect.right;
}
public void showPopup() {
this.mPopup.show(getTextDirection(), getTextAlignment());
}
@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) {
viewTreeObserver2.removeOnGlobalLayoutListener(this);
}
}
});
}
public 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;
public SavedState(Parcelable parcelable) {
super(parcelable);
}
public 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);
}
}
public 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(@Nullable SpinnerAdapter spinnerAdapter, @Nullable Resources.Theme theme) {
this.mAdapter = spinnerAdapter;
if (spinnerAdapter instanceof ListAdapter) {
this.mListAdapter = (ListAdapter) spinnerAdapter;
}
if (theme != null) {
if (spinnerAdapter instanceof android.widget.ThemedSpinnerAdapter) {
Api23Impl.setDropDownViewTheme((android.widget.ThemedSpinnerAdapter) 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;
}
}
@VisibleForTesting
public class DialogPopup implements SpinnerPopup, DialogInterface.OnClickListener {
private ListAdapter mListAdapter;
@VisibleForTesting
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;
}
public 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();
listView.setTextDirection(i);
listView.setTextAlignment(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");
}
}
@VisibleForTesting
public 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) {
DropdownPopup dropdownPopup = DropdownPopup.this;
AppCompatSpinner.this.performItemClick(view, i2, dropdownPopup.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;
}
public 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;
rect.right = 0;
rect.left = 0;
i = 0;
}
int paddingLeft = AppCompatSpinner.this.getPaddingLeft();
int paddingRight = AppCompatSpinner.this.getPaddingRight();
int width = AppCompatSpinner.this.getWidth();
AppCompatSpinner appCompatSpinner = AppCompatSpinner.this;
int i2 = appCompatSpinner.mDropDownWidth;
if (i2 == -2) {
int compatMeasureContentWidth = appCompatSpinner.compatMeasureContentWidth((SpinnerAdapter) this.mAdapter, getBackground());
int i3 = AppCompatSpinner.this.getContext().getResources().getDisplayMetrics().widthPixels;
Rect rect2 = AppCompatSpinner.this.mTempRect;
int i4 = (i3 - rect2.left) - rect2.right;
if (compatMeasureContentWidth > i4) {
compatMeasureContentWidth = i4;
}
setContentWidth(Math.max(compatMeasureContentWidth, (width - paddingLeft) - paddingRight));
} else if (i2 == -1) {
setContentWidth((width - paddingLeft) - paddingRight);
} else {
setContentWidth(i2);
}
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);
listView.setTextDirection(i);
listView.setTextAlignment(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);
}
}
});
}
public boolean isVisibleToUser(View view) {
return view.isAttachedToWindow() && view.getGlobalVisibleRect(this.mVisibleRect);
}
}
@RequiresApi(23)
public static final class Api23Impl {
private Api23Impl() {
}
@DoNotInline
public static void setDropDownViewTheme(@NonNull android.widget.ThemedSpinnerAdapter themedSpinnerAdapter, @Nullable Resources.Theme theme) {
if (ObjectsCompat.equals(themedSpinnerAdapter.getDropDownViewTheme(), theme)) {
return;
}
themedSpinnerAdapter.setDropDownViewTheme(theme);
}
}
}

View File

@@ -0,0 +1,49 @@
package androidx.appcompat.widget;
import android.view.textclassifier.TextClassificationManager;
import android.view.textclassifier.TextClassifier;
import android.widget.TextView;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.util.Preconditions;
/* loaded from: classes.dex */
final class AppCompatTextClassifierHelper {
@Nullable
private TextClassifier mTextClassifier;
@NonNull
private TextView mTextView;
@RequiresApi(api = 26)
public void setTextClassifier(@Nullable TextClassifier textClassifier) {
this.mTextClassifier = textClassifier;
}
public AppCompatTextClassifierHelper(@NonNull TextView textView) {
this.mTextView = (TextView) Preconditions.checkNotNull(textView);
}
@NonNull
@RequiresApi(api = 26)
public TextClassifier getTextClassifier() {
TextClassifier textClassifier = this.mTextClassifier;
return textClassifier == null ? Api26Impl.getTextClassifier(this.mTextView) : textClassifier;
}
@RequiresApi(26)
public static final class Api26Impl {
private Api26Impl() {
}
@NonNull
@DoNotInline
public static TextClassifier getTextClassifier(@NonNull TextView textView) {
TextClassificationManager textClassificationManager = (TextClassificationManager) textView.getContext().getSystemService(TextClassificationManager.class);
return textClassificationManager != null ? textClassificationManager.getTextClassifier() : TextClassifier.NO_OP;
}
}
}

View File

@@ -0,0 +1,462 @@
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.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.widget.TextView;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.view.inputmethod.EditorInfoCompat;
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;
@NonNull
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;
@NonNull
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;
}
public AppCompatTextHelper(@NonNull TextView textView) {
this.mView = textView;
this.mAutoSizeTextHelper = new AppCompatTextViewAutoSizeHelper(textView);
}
/* JADX WARN: Removed duplicated region for block: B:108:0x0293 */
/* JADX WARN: Removed duplicated region for block: B:110:0x029a */
/* JADX WARN: Removed duplicated region for block: B:113:0x02a3 */
/* JADX WARN: Removed duplicated region for block: B:119:? A[RETURN, SYNTHETIC] */
@android.annotation.SuppressLint({"NewApi"})
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void loadFromAttributes(@androidx.annotation.Nullable android.util.AttributeSet r17, int r18) {
/*
Method dump skipped, instructions count: 690
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.AppCompatTextHelper.loadFromAttributes(android.util.AttributeSet, int):void");
}
private void updateTypefaceAndStyle(Context context, TintTypedArray tintTypedArray) {
int i;
String string;
this.mStyle = tintTypedArray.getInt(R.styleable.TextAppearance_android_textStyle, this.mStyle);
int i2 = Build.VERSION.SDK_INT;
if (i2 >= 28) {
int i3 = tintTypedArray.getInt(R.styleable.TextAppearance_android_textFontWeight, -1);
this.mFontWeight = i3;
if (i3 != -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 i4 = this.mFontWeight;
final int i5 = 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 lambda$callbackFailAsync$1(int i6) {
}
@Override // androidx.core.content.res.ResourcesCompat.FontCallback
/* renamed from: onFontRetrieved */
public void lambda$callbackSuccessAsync$0(@NonNull Typeface typeface) {
int i6;
if (Build.VERSION.SDK_INT >= 28 && (i6 = i4) != -1) {
typeface = Api28Impl.create(typeface, i6, (i5 & 2) != 0);
}
AppCompatTextHelper.this.onAsyncTypefaceReceived(weakReference, typeface);
}
});
if (font != null) {
if (i2 < 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 i6 = tintTypedArray.getInt(R.styleable.TextAppearance_android_typeface, 1);
if (i6 == 1) {
this.mFontTypeface = Typeface.SANS_SERIF;
} else if (i6 == 2) {
this.mFontTypeface = Typeface.SERIF;
} else {
if (i6 != 3) {
return;
}
this.mFontTypeface = Typeface.MONOSPACE;
}
}
}
public void onAsyncTypefaceReceived(WeakReference<TextView> weakReference, final Typeface typeface) {
if (this.mAsyncFontPending) {
this.mFontTypeface = typeface;
final TextView textView = weakReference.get();
if (textView != null) {
if (textView.isAttachedToWindow()) {
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);
}
}
}
}
public void onSetTextAppearance(Context context, int i) {
String string;
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 (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 (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);
}
}
public void setAllCaps(boolean z) {
this.mView.setAllCaps(z);
}
public void onSetCompoundDrawables() {
applyCompoundDrawablesTints();
}
public 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 = this.mView.getCompoundDrawablesRelative();
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;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void onLayout(boolean z, int i, int i2, int i3, int i4) {
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE) {
return;
}
autoSizeText();
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setTextSize(int i, float f) {
if (ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE || isAutoSizeEnabled()) {
return;
}
setTextSizeInternal(i, f);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void autoSizeText() {
this.mAutoSizeTextHelper.autoSizeText();
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public boolean isAutoSizeEnabled() {
return this.mAutoSizeTextHelper.isAutoSizeEnabled();
}
private void setTextSizeInternal(int i, float f) {
this.mAutoSizeTextHelper.setTextSizeInternal(i, f);
}
public void setAutoSizeTextTypeWithDefaults(int i) {
this.mAutoSizeTextHelper.setAutoSizeTextTypeWithDefaults(i);
}
public void setAutoSizeTextTypeUniformWithConfiguration(int i, int i2, int i3, int i4) throws IllegalArgumentException {
this.mAutoSizeTextHelper.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
}
public void setAutoSizeTextTypeUniformWithPresetSizes(@NonNull int[] iArr, int i) throws IllegalArgumentException {
this.mAutoSizeTextHelper.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
}
public int getAutoSizeTextType() {
return this.mAutoSizeTextHelper.getAutoSizeTextType();
}
public int getAutoSizeStepGranularity() {
return this.mAutoSizeTextHelper.getAutoSizeStepGranularity();
}
public int getAutoSizeMinTextSize() {
return this.mAutoSizeTextHelper.getAutoSizeMinTextSize();
}
public int getAutoSizeMaxTextSize() {
return this.mAutoSizeTextHelper.getAutoSizeMaxTextSize();
}
public int[] getAutoSizeTextAvailableSizes() {
return this.mAutoSizeTextHelper.getAutoSizeTextAvailableSizes();
}
@Nullable
public ColorStateList getCompoundDrawableTintList() {
TintInfo tintInfo = this.mDrawableTint;
if (tintInfo != null) {
return tintInfo.mTintList;
}
return null;
}
public void setCompoundDrawableTintList(@Nullable ColorStateList colorStateList) {
if (this.mDrawableTint == null) {
this.mDrawableTint = new TintInfo();
}
TintInfo tintInfo = this.mDrawableTint;
tintInfo.mTintList = colorStateList;
tintInfo.mHasTintList = colorStateList != null;
setCompoundTints();
}
@Nullable
public PorterDuff.Mode getCompoundDrawableTintMode() {
TintInfo tintInfo = this.mDrawableTint;
if (tintInfo != null) {
return tintInfo.mTintMode;
}
return null;
}
public void setCompoundDrawableTintMode(@Nullable PorterDuff.Mode mode) {
if (this.mDrawableTint == null) {
this.mDrawableTint = new TintInfo();
}
TintInfo tintInfo = this.mDrawableTint;
tintInfo.mTintMode = mode;
tintInfo.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 = this.mView.getCompoundDrawablesRelative();
if (drawable5 == null) {
drawable5 = compoundDrawablesRelative[0];
}
if (drawable2 == null) {
drawable2 = compoundDrawablesRelative[1];
}
if (drawable6 == null) {
drawable6 = compoundDrawablesRelative[2];
}
TextView textView = this.mView;
if (drawable4 == null) {
drawable4 = compoundDrawablesRelative[3];
}
textView.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable5, drawable2, drawable6, drawable4);
return;
}
if (drawable == null && drawable2 == null && drawable3 == null && drawable4 == null) {
return;
}
Drawable[] compoundDrawablesRelative2 = this.mView.getCompoundDrawablesRelative();
Drawable drawable7 = compoundDrawablesRelative2[0];
if (drawable7 != null || compoundDrawablesRelative2[2] != null) {
if (drawable2 == null) {
drawable2 = compoundDrawablesRelative2[1];
}
if (drawable4 == null) {
drawable4 = compoundDrawablesRelative2[3];
}
this.mView.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable7, drawable2, compoundDrawablesRelative2[2], drawable4);
return;
}
Drawable[] compoundDrawables = this.mView.getCompoundDrawables();
TextView textView2 = 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];
}
textView2.setCompoundDrawablesWithIntrinsicBounds(drawable, drawable2, drawable3, drawable4);
}
public void populateSurroundingTextIfNeeded(@NonNull TextView textView, @Nullable InputConnection inputConnection, @NonNull EditorInfo editorInfo) {
if (Build.VERSION.SDK_INT >= 30 || inputConnection == null) {
return;
}
EditorInfoCompat.setInitialSurroundingText(editorInfo, textView.getText());
}
@RequiresApi(26)
public static class Api26Impl {
private Api26Impl() {
}
@DoNotInline
public static boolean setFontVariationSettings(TextView textView, String str) {
return textView.setFontVariationSettings(str);
}
@DoNotInline
public static int getAutoSizeStepGranularity(TextView textView) {
return textView.getAutoSizeStepGranularity();
}
@DoNotInline
public static void setAutoSizeTextTypeUniformWithConfiguration(TextView textView, int i, int i2, int i3, int i4) {
textView.setAutoSizeTextTypeUniformWithConfiguration(i, i2, i3, i4);
}
@DoNotInline
public static void setAutoSizeTextTypeUniformWithPresetSizes(TextView textView, int[] iArr, int i) {
textView.setAutoSizeTextTypeUniformWithPresetSizes(iArr, i);
}
}
@RequiresApi(24)
public static class Api24Impl {
private Api24Impl() {
}
@DoNotInline
public static void setTextLocales(TextView textView, LocaleList localeList) {
textView.setTextLocales(localeList);
}
@DoNotInline
public static LocaleList forLanguageTags(String str) {
return LocaleList.forLanguageTags(str);
}
}
@RequiresApi(21)
public static class Api21Impl {
private Api21Impl() {
}
@DoNotInline
public static Locale forLanguageTag(String str) {
return Locale.forLanguageTag(str);
}
}
@RequiresApi(28)
public static class Api28Impl {
private Api28Impl() {
}
@DoNotInline
public static Typeface create(Typeface typeface, int i, boolean z) {
return Typeface.create(typeface, i, z);
}
}
}

View File

@@ -0,0 +1,760 @@
package androidx.appcompat.widget;
import android.annotation.SuppressLint;
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.inputmethod.InputMethodManager;
import android.view.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
import android.view.textclassifier.TextClassifier;
import android.widget.TextView;
import androidx.annotation.DrawableRes;
import androidx.annotation.FloatRange;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.Px;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.annotation.UiThread;
import androidx.appcompat.R;
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;
import java.util.function.IntFunction;
/* loaded from: classes.dex */
public class AppCompatTextView extends TextView implements TintableBackgroundView, TintableCompoundDrawablesView, AutoSizeableTextView, EmojiCompatConfigurationView {
private final AppCompatBackgroundHelper mBackgroundTintHelper;
@NonNull
private AppCompatEmojiTextHelper mEmojiTextViewHelper;
private boolean mIsSetTypefaceProcessing;
@Nullable
private Future<PrecomputedTextCompat> mPrecomputedTextFuture;
@Nullable
private SuperCaller mSuperCaller;
private final AppCompatTextClassifierHelper mTextClassifierHelper;
private final AppCompatTextHelper mTextHelper;
public 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(@Px int i);
void setLastBaselineToBottomHeight(@Px int i);
void setLineHeight(int i, @FloatRange(from = 0.0d) float f);
void setTextClassifier(@Nullable TextClassifier textClassifier);
}
@RequiresApi(29)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final class InspectionCompanion implements android.view.inspector.InspectionCompanion {
private int mAutoSizeMaxTextSizeId;
private int mAutoSizeMinTextSizeId;
private int mAutoSizeStepGranularityId;
private int mAutoSizeTextTypeId;
private int mBackgroundTintId;
private int mBackgroundTintModeId;
private int mDrawableTintId;
private int mDrawableTintModeId;
private boolean mPropertiesMapped = false;
public void mapProperties(@NonNull PropertyMapper propertyMapper) {
int mapInt;
int mapInt2;
int mapInt3;
int mapIntEnum;
int mapObject;
int mapObject2;
int mapObject3;
int mapObject4;
mapInt = propertyMapper.mapInt("autoSizeMaxTextSize", R.attr.autoSizeMaxTextSize);
this.mAutoSizeMaxTextSizeId = mapInt;
mapInt2 = propertyMapper.mapInt("autoSizeMinTextSize", R.attr.autoSizeMinTextSize);
this.mAutoSizeMinTextSizeId = mapInt2;
mapInt3 = propertyMapper.mapInt("autoSizeStepGranularity", R.attr.autoSizeStepGranularity);
this.mAutoSizeStepGranularityId = mapInt3;
mapIntEnum = propertyMapper.mapIntEnum("autoSizeTextType", R.attr.autoSizeTextType, new IntFunction<String>() { // from class: androidx.appcompat.widget.AppCompatTextView.InspectionCompanion.1
@Override // java.util.function.IntFunction
public String apply(int i) {
return i != 0 ? i != 1 ? String.valueOf(i) : "uniform" : "none";
}
});
this.mAutoSizeTextTypeId = mapIntEnum;
mapObject = propertyMapper.mapObject("backgroundTint", R.attr.backgroundTint);
this.mBackgroundTintId = mapObject;
mapObject2 = propertyMapper.mapObject("backgroundTintMode", R.attr.backgroundTintMode);
this.mBackgroundTintModeId = mapObject2;
mapObject3 = propertyMapper.mapObject("drawableTint", R.attr.drawableTint);
this.mDrawableTintId = mapObject3;
mapObject4 = propertyMapper.mapObject("drawableTintMode", R.attr.drawableTintMode);
this.mDrawableTintModeId = mapObject4;
this.mPropertiesMapped = true;
}
public void readProperties(@NonNull AppCompatTextView appCompatTextView, @NonNull PropertyReader propertyReader) {
if (!this.mPropertiesMapped) {
throw AppCompatAutoCompleteTextView$InspectionCompanion$$ExternalSyntheticApiModelOutline2.m();
}
propertyReader.readInt(this.mAutoSizeMaxTextSizeId, appCompatTextView.getAutoSizeMaxTextSize());
propertyReader.readInt(this.mAutoSizeMinTextSizeId, appCompatTextView.getAutoSizeMinTextSize());
propertyReader.readInt(this.mAutoSizeStepGranularityId, appCompatTextView.getAutoSizeStepGranularity());
propertyReader.readIntEnum(this.mAutoSizeTextTypeId, appCompatTextView.getAutoSizeTextType());
propertyReader.readObject(this.mBackgroundTintId, appCompatTextView.getBackgroundTintList());
propertyReader.readObject(this.mBackgroundTintModeId, appCompatTextView.getBackgroundTintMode());
propertyReader.readObject(this.mDrawableTintId, appCompatTextView.getCompoundDrawableTintList());
propertyReader.readObject(this.mDrawableTintModeId, appCompatTextView.getCompoundDrawableTintMode());
}
}
public AppCompatTextView(@NonNull Context context) {
this(context, null);
}
public AppCompatTextView(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, android.R.attr.textViewStyle);
}
public AppCompatTextView(@NonNull Context context, @Nullable 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);
}
@NonNull
private AppCompatEmojiTextHelper getEmojiTextViewHelper() {
if (this.mEmojiTextViewHelper == null) {
this.mEmojiTextViewHelper = new AppCompatEmojiTextHelper(this);
}
return this.mEmojiTextViewHelper;
}
@Override // android.view.View
public void setBackgroundResource(@DrawableRes int i) {
super.setBackgroundResource(i);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundResource(i);
}
}
@Override // android.view.View
public void setBackgroundDrawable(@Nullable Drawable drawable) {
super.setBackgroundDrawable(drawable);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
}
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintList(@Nullable ColorStateList colorStateList) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportBackgroundTintList() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintList();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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(@NonNull 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
public 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
public 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
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
super.onTextChanged(charSequence, i, i2, i3);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper == null || ViewUtils.SDK_LEVEL_SUPPORTS_AUTOSIZE || !appCompatTextHelper.isAutoSizeEnabled()) {
return;
}
this.mTextHelper.autoSizeText();
}
@Override // android.widget.TextView, androidx.core.widget.AutoSizeableTextView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setAutoSizeTextTypeUniformWithPresetSizes(@NonNull 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
@SuppressLint({"WrongConstant"})
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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(@IntRange(from = 0) @Px int i) {
if (Build.VERSION.SDK_INT >= 28) {
getSuperCaller().setFirstBaselineToTopHeight(i);
} else {
TextViewCompat.setFirstBaselineToTopHeight(this, i);
}
}
@Override // android.widget.TextView
public void setLastBaselineToBottomHeight(@IntRange(from = 0) @Px 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(@IntRange(from = 0) @Px int i) {
TextViewCompat.setLineHeight(this, i);
}
@Override // android.widget.TextView
public void setLineHeight(int i, @FloatRange(from = 0.0d) float f) {
if (Build.VERSION.SDK_INT >= 34) {
getSuperCaller().setLineHeight(i, f);
} else {
TextViewCompat.setLineHeight(this, i, f);
}
}
@Override // android.widget.TextView
public void setCustomSelectionActionModeCallback(@Nullable ActionMode.Callback callback) {
super.setCustomSelectionActionModeCallback(TextViewCompat.wrapCustomSelectionActionModeCallback(this, callback));
}
@Override // android.widget.TextView
@Nullable
public ActionMode.Callback getCustomSelectionActionModeCallback() {
return TextViewCompat.unwrapCustomSelectionActionModeCallback(super.getCustomSelectionActionModeCallback());
}
@NonNull
public PrecomputedTextCompat.Params getTextMetricsParamsCompat() {
return TextViewCompat.getTextMetricsParams(this);
}
public void setTextMetricsParamsCompat(@NonNull PrecomputedTextCompat.Params params) {
TextViewCompat.setTextMetricsParams(this, params);
}
public void setPrecomputedText(@NonNull 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
@RequiresApi(api = 26)
public void setTextClassifier(@Nullable 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
@NonNull
@RequiresApi(api = 26)
public TextClassifier getTextClassifier() {
AppCompatTextClassifierHelper appCompatTextClassifierHelper;
if (Build.VERSION.SDK_INT >= 28 || (appCompatTextClassifierHelper = this.mTextClassifierHelper) == null) {
return getSuperCaller().getTextClassifier();
}
return appCompatTextClassifierHelper.getTextClassifier();
}
public void setTextFuture(@Nullable Future<PrecomputedTextCompat> future) {
this.mPrecomputedTextFuture = future;
if (future != null) {
requestLayout();
}
}
@Override // android.widget.TextView, android.view.View
public void onMeasure(int i, int i2) {
consumeTextFutureAndSetBlocking();
super.onMeasure(i, i2);
}
@Override // android.widget.TextView
public void setCompoundDrawables(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper != null) {
appCompatTextHelper.onSetCompoundDrawables();
}
}
@Override // android.widget.TextView
public void setCompoundDrawablesRelative(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper != null) {
appCompatTextHelper.onSetCompoundDrawables();
}
}
@Override // android.widget.TextView
public void setCompoundDrawablesWithIntrinsicBounds(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable 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(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable 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
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportCompoundDrawablesTintList() {
return this.mTextHelper.getCompoundDrawableTintList();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList colorStateList) {
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
this.mTextHelper.applyCompoundDrawablesTints();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
return this.mTextHelper.getCompoundDrawableTintMode();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode mode) {
this.mTextHelper.setCompoundDrawableTintMode(mode);
this.mTextHelper.applyCompoundDrawablesTints();
}
@Override // android.widget.TextView
public void setTypeface(@Nullable 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;
}
}
@Override // android.view.View
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
int i = Build.VERSION.SDK_INT;
if (i < 30 || i >= 33 || !onCheckIsTextEditor()) {
return;
}
((InputMethodManager) getContext().getSystemService("input_method")).isActive(this);
}
@RequiresApi(api = 26)
@UiThread
public SuperCaller getSuperCaller() {
if (this.mSuperCaller == null) {
int i = Build.VERSION.SDK_INT;
if (i >= 34) {
this.mSuperCaller = new SuperCallerApi34();
} else if (i >= 28) {
this.mSuperCaller = new SuperCallerApi28();
} else {
this.mSuperCaller = new SuperCallerApi26();
}
}
return this.mSuperCaller;
}
@RequiresApi(api = 26)
public 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) {
}
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCaller
public void setLineHeight(int i, float f) {
}
public 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(@Nullable TextClassifier textClassifier) {
AppCompatTextView.super.setTextClassifier(textClassifier);
}
}
@RequiresApi(api = 28)
public class SuperCallerApi28 extends SuperCallerApi26 {
public SuperCallerApi28() {
super();
}
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCallerApi26, androidx.appcompat.widget.AppCompatTextView.SuperCaller
public void setFirstBaselineToTopHeight(@Px int i) {
AppCompatTextView.super.setFirstBaselineToTopHeight(i);
}
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCallerApi26, androidx.appcompat.widget.AppCompatTextView.SuperCaller
public void setLastBaselineToBottomHeight(@Px int i) {
AppCompatTextView.super.setLastBaselineToBottomHeight(i);
}
}
@RequiresApi(api = 34)
public class SuperCallerApi34 extends SuperCallerApi28 {
public SuperCallerApi34() {
super();
}
@Override // androidx.appcompat.widget.AppCompatTextView.SuperCallerApi26, androidx.appcompat.widget.AppCompatTextView.SuperCaller
public void setLineHeight(int i, float f) {
AppCompatTextView.super.setLineHeight(i, f);
}
}
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class AppCompatTextViewAutoSizeHelper$Impl29$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class AppCompatTextViewAutoSizeHelper$Impl29$$ExternalSyntheticApiModelOutline1 {
}

View File

@@ -0,0 +1,492 @@
package androidx.appcompat.widget;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.RectF;
import android.os.Build;
import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextDirectionHeuristic;
import android.text.TextDirectionHeuristics;
import android.text.TextPaint;
import android.text.method.TransformationMethod;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.widget.TextView;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.R;
import androidx.core.view.ViewCompat;
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;
@NonNull
private final TextView mTextView;
private static final RectF TEMP_RECTF = new RectF();
@SuppressLint({"BanConcurrentHashMap"})
private static ConcurrentHashMap<String, Method> sTextViewMethodByNameCache = new ConcurrentHashMap<>();
private int mAutoSizeTextType = 0;
private boolean mNeedsAutoSizeText = false;
private float mAutoSizeStepGranularityInPx = -1.0f;
private float mAutoSizeMinTextSizeInPx = -1.0f;
private float mAutoSizeMaxTextSizeInPx = -1.0f;
private int[] mAutoSizeTextSizesInPx = new int[0];
private boolean mHasPresetAutoSizeValues = false;
private void clearAutoSizeConfiguration() {
this.mAutoSizeTextType = 0;
this.mAutoSizeMinTextSizeInPx = -1.0f;
this.mAutoSizeMaxTextSizeInPx = -1.0f;
this.mAutoSizeStepGranularityInPx = -1.0f;
this.mAutoSizeTextSizesInPx = new int[0];
this.mNeedsAutoSizeText = false;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public int[] getAutoSizeTextAvailableSizes() {
return this.mAutoSizeTextSizesInPx;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public int getAutoSizeTextType() {
return this.mAutoSizeTextType;
}
public static class Impl {
public void computeAndSetTextDirection(StaticLayout.Builder builder, TextView textView) {
}
public boolean isHorizontallyScrollable(TextView textView) {
return ((Boolean) AppCompatTextViewAutoSizeHelper.invokeAndReturnWithDefault(textView, "getHorizontallyScrolling", Boolean.FALSE)).booleanValue();
}
}
@RequiresApi(23)
public static class Impl23 extends Impl {
@Override // androidx.appcompat.widget.AppCompatTextViewAutoSizeHelper.Impl
public void computeAndSetTextDirection(StaticLayout.Builder builder, TextView textView) {
builder.setTextDirection((TextDirectionHeuristic) AppCompatTextViewAutoSizeHelper.invokeAndReturnWithDefault(textView, "getTextDirectionHeuristic", TextDirectionHeuristics.FIRSTSTRONG_LTR));
}
}
@RequiresApi(29)
public static class Impl29 extends Impl23 {
@Override // androidx.appcompat.widget.AppCompatTextViewAutoSizeHelper.Impl
public boolean isHorizontallyScrollable(TextView textView) {
boolean isHorizontallyScrollable;
isHorizontallyScrollable = textView.isHorizontallyScrollable();
return isHorizontallyScrollable;
}
@Override // androidx.appcompat.widget.AppCompatTextViewAutoSizeHelper.Impl23, androidx.appcompat.widget.AppCompatTextViewAutoSizeHelper.Impl
public void computeAndSetTextDirection(StaticLayout.Builder builder, TextView textView) {
TextDirectionHeuristic textDirectionHeuristic;
textDirectionHeuristic = textView.getTextDirectionHeuristic();
builder.setTextDirection(textDirectionHeuristic);
}
}
public AppCompatTextViewAutoSizeHelper(@NonNull TextView textView) {
this.mTextView = textView;
this.mContext = textView.getContext();
if (Build.VERSION.SDK_INT >= 29) {
this.mImpl = new Impl29();
} else {
this.mImpl = new Impl23();
}
}
public void loadFromAttributes(@Nullable 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, -1.0f) : -1.0f;
float dimension2 = obtainStyledAttributes.hasValue(R.styleable.AppCompatTextView_autoSizeMinTextSize) ? obtainStyledAttributes.getDimension(R.styleable.AppCompatTextView_autoSizeMinTextSize, -1.0f) : -1.0f;
float dimension3 = obtainStyledAttributes.hasValue(R.styleable.AppCompatTextView_autoSizeMaxTextSize) ? obtainStyledAttributes.getDimension(R.styleable.AppCompatTextView_autoSizeMaxTextSize, -1.0f) : -1.0f;
if (obtainStyledAttributes.hasValue(R.styleable.AppCompatTextView_autoSizePresetSizes) && (resourceId = obtainStyledAttributes.getResourceId(R.styleable.AppCompatTextView_autoSizePresetSizes, 0)) > 0) {
TypedArray obtainTypedArray = obtainStyledAttributes.getResources().obtainTypedArray(resourceId);
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 == -1.0f) {
dimension2 = TypedValue.applyDimension(2, 12.0f, displayMetrics);
}
if (dimension3 == -1.0f) {
dimension3 = TypedValue.applyDimension(2, 112.0f, displayMetrics);
}
if (dimension == -1.0f) {
dimension = 1.0f;
}
validateAndSetAutoSizeTextTypeUniformConfiguration(dimension2, dimension3, dimension);
}
setupAutoSizeText();
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public 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);
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public 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();
}
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setAutoSizeTextTypeUniformWithPresetSizes(@NonNull 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();
}
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public int getAutoSizeStepGranularity() {
return Math.round(this.mAutoSizeStepGranularityInPx);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public int getAutoSizeMinTextSize() {
return Math.round(this.mAutoSizeMinTextSizeInPx);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public 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 = -1.0f;
}
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;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public 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) {
try {
rectF.setEmpty();
rectF.right = measuredWidth;
rectF.bottom = height;
float findLargestTextSizeWhichFits = findLargestTextSizeWhichFits(rectF);
if (findLargestTextSizeWhichFits != this.mTextView.getTextSize()) {
setTextSizeInternal(0, findLargestTextSizeWhichFits);
}
} finally {
}
}
}
this.mNeedsAutoSizeText = true;
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public 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()));
}
@SuppressLint({"BanUncheckedReflection"})
private void setRawTextSize(float f) {
if (f != this.mTextView.getPaint().getTextSize()) {
this.mTextView.getPaint().setTextSize(f);
boolean isInLayout = this.mTextView.isInLayout();
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];
}
@VisibleForTesting
public 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);
}
@NonNull
@VisibleForTesting
public StaticLayout createLayout(@NonNull CharSequence charSequence, @NonNull Layout.Alignment alignment, int i, int i2) {
return Api23Impl.createStaticLayoutForMeasuring(charSequence, alignment, i, i2, this.mTextView, this.mTempTextPaint, this.mImpl);
}
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 = this.mTextView.getMaxLines();
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;
}
@SuppressLint({"BanUncheckedReflection"})
public static <T> T invokeAndReturnWithDefault(@NonNull Object obj, @NonNull String str, @NonNull 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;
}
}
@Nullable
private static Method getTextViewMethod(@NonNull 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;
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public boolean isAutoSizeEnabled() {
return supportsAutoSizeText() && this.mAutoSizeTextType != 0;
}
private boolean supportsAutoSizeText() {
return !(this.mTextView instanceof AppCompatEditText);
}
@RequiresApi(23)
public static final class Api23Impl {
private Api23Impl() {
}
@NonNull
@DoNotInline
public static StaticLayout createStaticLayoutForMeasuring(@NonNull CharSequence charSequence, @NonNull Layout.Alignment alignment, int i, int i2, @NonNull TextView textView, @NonNull TextPaint textPaint, @NonNull 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();
}
}
}

View File

@@ -0,0 +1,228 @@
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.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
import android.widget.ToggleButton;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
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;
@RequiresApi(29)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final class InspectionCompanion implements android.view.inspector.InspectionCompanion {
private int mBackgroundTintId;
private int mBackgroundTintModeId;
private int mDrawableTintId;
private int mDrawableTintModeId;
private boolean mPropertiesMapped = false;
public void mapProperties(@NonNull PropertyMapper propertyMapper) {
int mapObject;
int mapObject2;
int mapObject3;
int mapObject4;
mapObject = propertyMapper.mapObject("backgroundTint", R.attr.backgroundTint);
this.mBackgroundTintId = mapObject;
mapObject2 = propertyMapper.mapObject("backgroundTintMode", R.attr.backgroundTintMode);
this.mBackgroundTintModeId = mapObject2;
mapObject3 = propertyMapper.mapObject("drawableTint", R.attr.drawableTint);
this.mDrawableTintId = mapObject3;
mapObject4 = propertyMapper.mapObject("drawableTintMode", R.attr.drawableTintMode);
this.mDrawableTintModeId = mapObject4;
this.mPropertiesMapped = true;
}
public void readProperties(@NonNull AppCompatToggleButton appCompatToggleButton, @NonNull PropertyReader propertyReader) {
if (!this.mPropertiesMapped) {
throw AppCompatAutoCompleteTextView$InspectionCompanion$$ExternalSyntheticApiModelOutline2.m();
}
propertyReader.readObject(this.mBackgroundTintId, appCompatToggleButton.getBackgroundTintList());
propertyReader.readObject(this.mBackgroundTintModeId, appCompatToggleButton.getBackgroundTintMode());
propertyReader.readObject(this.mDrawableTintId, appCompatToggleButton.getCompoundDrawableTintList());
propertyReader.readObject(this.mDrawableTintModeId, appCompatToggleButton.getCompoundDrawableTintMode());
}
}
public AppCompatToggleButton(@NonNull Context context) {
this(context, null);
}
public AppCompatToggleButton(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, android.R.attr.buttonStyleToggle);
}
public AppCompatToggleButton(@NonNull Context context, @Nullable 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(@DrawableRes 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(@Nullable Drawable drawable) {
super.setBackgroundDrawable(drawable);
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.onSetBackgroundDrawable(drawable);
}
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintList(@Nullable ColorStateList colorStateList) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintList(colorStateList);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportBackgroundTintList() {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
return appCompatBackgroundHelper.getSupportBackgroundTintList();
}
return null;
}
@Override // androidx.core.view.TintableBackgroundView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportBackgroundTintMode(@Nullable PorterDuff.Mode mode) {
AppCompatBackgroundHelper appCompatBackgroundHelper = this.mBackgroundTintHelper;
if (appCompatBackgroundHelper != null) {
appCompatBackgroundHelper.setSupportBackgroundTintMode(mode);
}
}
@Override // androidx.core.view.TintableBackgroundView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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
public 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(@NonNull InputFilter[] inputFilterArr) {
super.setFilters(getEmojiTextViewHelper().getFilters(inputFilterArr));
}
@NonNull
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(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
super.setCompoundDrawables(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper != null) {
appCompatTextHelper.onSetCompoundDrawables();
}
}
@Override // android.widget.TextView
public void setCompoundDrawablesRelative(@Nullable Drawable drawable, @Nullable Drawable drawable2, @Nullable Drawable drawable3, @Nullable Drawable drawable4) {
super.setCompoundDrawablesRelative(drawable, drawable2, drawable3, drawable4);
AppCompatTextHelper appCompatTextHelper = this.mTextHelper;
if (appCompatTextHelper != null) {
appCompatTextHelper.onSetCompoundDrawables();
}
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ColorStateList getSupportCompoundDrawablesTintList() {
return this.mTextHelper.getCompoundDrawableTintList();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintList(@Nullable ColorStateList colorStateList) {
this.mTextHelper.setCompoundDrawableTintList(colorStateList);
this.mTextHelper.applyCompoundDrawablesTints();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public PorterDuff.Mode getSupportCompoundDrawablesTintMode() {
return this.mTextHelper.getCompoundDrawableTintMode();
}
@Override // androidx.core.widget.TintableCompoundDrawablesView
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setSupportCompoundDrawablesTintMode(@Nullable PorterDuff.Mode mode) {
this.mTextHelper.setCompoundDrawableTintMode(mode);
this.mTextHelper.applyCompoundDrawablesTints();
}
}

View File

@@ -0,0 +1,176 @@
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.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import androidx.core.view.GravityCompat;
import androidx.core.view.ViewCompat;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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(@NonNull Context context, @Nullable 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
*/
public 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 = r3
goto L31
L2f:
r0 = r6
r1 = r2
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 L9e
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 L98
int r0 = r0 + r3
int r0 = r5.getNextVisibleChildIndex(r0)
if (r0 < 0) goto L96
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
L96:
r2 = r4
goto L9e
L98:
int r0 = r5.getPaddingBottom()
int r2 = r4 + r0
L9e:
int r0 = androidx.core.view.ViewCompat.getMinimumHeight(r5)
if (r0 == r2) goto Lac
r5.setMinimumHeight(r2)
if (r7 != 0) goto Lac
super.onMeasure(r6, r7)
Lac:
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));
}
}
}
}
}

View File

@@ -0,0 +1,143 @@
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.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* 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(@NonNull Context context) {
this(context, null);
}
public ContentFrameLayout(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public ContentFrameLayout(@NonNull Context context, @Nullable AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.mDecorPadding = new Rect();
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public void dispatchFitSystemWindows(Rect rect) {
fitSystemWindows(rect);
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public void setDecorPadding(int i, int i2, int i3, int i4) {
this.mDecorPadding.set(i, i2, i3, i4);
if (isLaidOut()) {
requestLayout();
}
}
/* JADX WARN: Removed duplicated region for block: B:15:0x004a */
/* JADX WARN: Removed duplicated region for block: B:17:0x0063 */
/* JADX WARN: Removed duplicated region for block: B:26:0x0086 */
/* JADX WARN: Removed duplicated region for block: B:35:0x00ab */
/* JADX WARN: Removed duplicated region for block: B:40:0x00b8 */
/* JADX WARN: Removed duplicated region for block: B:43:0x00cc */
/* JADX WARN: Removed duplicated region for block: B:45:0x00d6 */
/* JADX WARN: Removed duplicated region for block: B:47:0x00de */
/* JADX WARN: Removed duplicated region for block: B:50:? A[RETURN, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:51:0x00be */
/* JADX WARN: Removed duplicated region for block: B:54:0x00ae */
@Override // android.widget.FrameLayout, android.view.View
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void onMeasure(int r14, int r15) {
/*
Method dump skipped, instructions count: 226
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
public void onAttachedToWindow() {
super.onAttachedToWindow();
OnAttachListener onAttachListener = this.mAttachListener;
if (onAttachListener != null) {
onAttachListener.onAttachedFromWindow();
}
}
@Override // android.view.ViewGroup, android.view.View
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
OnAttachListener onAttachListener = this.mAttachListener;
if (onAttachListener != null) {
onAttachListener.onDetachedFromWindow();
}
}
}

View File

@@ -0,0 +1,53 @@
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.annotation.RestrictTo;
import androidx.appcompat.view.menu.MenuPresenter;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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();
}

View File

@@ -0,0 +1,134 @@
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.annotation.RestrictTo;
import androidx.appcompat.view.menu.MenuBuilder;
import androidx.appcompat.view.menu.MenuPresenter;
import androidx.core.view.ViewPropertyAnimatorCompat;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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();
}

View File

@@ -0,0 +1,45 @@
package androidx.appcompat.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.Layout;
import android.util.AttributeSet;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public class DialogTitle extends AppCompatTextView {
public DialogTitle(@NonNull Context context, @Nullable AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
}
public DialogTitle(@NonNull Context context, @Nullable AttributeSet attributeSet) {
super(context, attributeSet);
}
public DialogTitle(@NonNull Context context) {
super(context);
}
@Override // androidx.appcompat.widget.AppCompatTextView, android.widget.TextView, android.view.View
public 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);
}
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class DrawableUtils$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class DrawableUtils$$ExternalSyntheticApiModelOutline1 {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class DrawableUtils$$ExternalSyntheticApiModelOutline2 {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class DrawableUtils$$ExternalSyntheticApiModelOutline3 {
}

View File

@@ -0,0 +1,216 @@
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.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.graphics.drawable.DrawableCompat;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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();
@Deprecated
public static boolean canSafelyMutateDrawable(@NonNull Drawable drawable) {
return true;
}
private DrawableUtils() {
}
@NonNull
public static Rect getOpticalBounds(@NonNull 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));
}
public static void fixDrawable(@NonNull Drawable drawable) {
String name = drawable.getClass().getName();
int i = Build.VERSION.SDK_INT;
if (i < 29 || i >= 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;
}
}
public 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:16:0x004c */
/* JADX WARN: Removed duplicated region for block: B:19:0x0059 */
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 -> L3f java.lang.ClassNotFoundException -> L42 java.lang.NoSuchMethodException -> L45
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 -> L3f java.lang.ClassNotFoundException -> L42 java.lang.NoSuchMethodException -> L45
java.lang.reflect.Method r4 = r4.getMethod(r5, r6) // Catch: java.lang.NoSuchFieldException -> L3f java.lang.ClassNotFoundException -> L42 java.lang.NoSuchMethodException -> L45
java.lang.String r5 = "left"
java.lang.reflect.Field r5 = r3.getField(r5) // Catch: java.lang.NoSuchFieldException -> L36 java.lang.ClassNotFoundException -> L39 java.lang.NoSuchMethodException -> L3c
java.lang.String r6 = "top"
java.lang.reflect.Field r6 = r3.getField(r6) // Catch: java.lang.NoSuchFieldException -> L2f java.lang.ClassNotFoundException -> L32 java.lang.NoSuchMethodException -> L34
java.lang.String r7 = "right"
java.lang.reflect.Field r7 = r3.getField(r7) // Catch: java.lang.Throwable -> L2d
java.lang.String r8 = "bottom"
java.lang.reflect.Field r3 = r3.getField(r8) // Catch: java.lang.Throwable -> L48
r8 = r0
goto L4a
L2d:
r7 = r1
goto L48
L2f:
r6 = r1
L30:
r7 = r6
goto L48
L32:
r6 = r1
goto L30
L34:
r6 = r1
goto L30
L36:
r5 = r1
L37:
r6 = r5
goto L30
L39:
r5 = r1
L3a:
r6 = r5
goto L30
L3c:
r5 = r1
L3d:
r6 = r5
goto L30
L3f:
r4 = r1
r5 = r4
goto L37
L42:
r4 = r1
r5 = r4
goto L3a
L45:
r4 = r1
r5 = r4
goto L3d
L48:
r3 = r1
r8 = r2
L4a:
if (r8 == 0) goto L59
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 L65
L59:
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
L65:
return
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.DrawableUtils.Api18Impl.<clinit>():void");
}
private Api18Impl() {
}
@NonNull
public static Rect getOpticalInsets(@NonNull 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;
}
}
@RequiresApi(29)
public static class Api29Impl {
private Api29Impl() {
}
@DoNotInline
public static Insets getOpticalInsets(Drawable drawable) {
return drawable.getOpticalInsets();
}
}
}

View File

@@ -0,0 +1,641 @@
package androidx.appcompat.widget;
import android.annotation.SuppressLint;
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.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.R;
import androidx.appcompat.graphics.drawable.DrawableWrapperCompat;
import androidx.core.graphics.drawable.DrawableCompat;
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;
}
public void setListSelectionHidden(boolean z) {
this.mListSelectionHidden = z;
}
public DropDownListView(@NonNull 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 (Build.VERSION.SDK_INT >= 33) {
return Api33Impl.isSelectedChildViewEnabled(this);
}
return PreApi33Impl.isSelectedChildViewEnabled(this);
}
private void superSetSelectedChildViewEnabled(boolean z) {
if (Build.VERSION.SDK_INT >= 33) {
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
public 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
public 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();
int i7 = 0;
int i8 = 0;
int i9 = 0;
View view = null;
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);
}
int i10 = layoutParams.height;
if (i10 > 0) {
makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i10, 1073741824);
} 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);
}
}
public static class GateKeeperDrawable extends DrawableWrapperCompat {
private boolean mEnabled;
public void setEnabled(boolean z) {
this.mEnabled = z;
}
public 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(@NonNull 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(@NonNull MotionEvent motionEvent) {
int i = Build.VERSION.SDK_INT;
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 (i >= 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
public 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:
r3 = r1
r9 = r2
goto L46
L11:
r9 = r2
r3 = r9
goto L46
L14:
r3 = r1
goto L17
L16:
r3 = r2
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 = r1
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();
}
public class ResolveHoverRunnable implements Runnable {
public ResolveHoverRunnable() {
}
@Override // java.lang.Runnable
public void run() {
DropDownListView dropDownListView = DropDownListView.this;
dropDownListView.mResolveHoverRunnable = null;
dropDownListView.drawableStateChanged();
}
public void cancel() {
DropDownListView dropDownListView = DropDownListView.this;
dropDownListView.mResolveHoverRunnable = null;
dropDownListView.removeCallbacks(this);
}
public void post() {
DropDownListView.this.post(this);
}
}
@RequiresApi(30)
public static class Api30Impl {
private static boolean sHasMethods;
private static Method sPositionSelector;
private static Method sSetNextSelectedPositionInt;
private static Method sSetSelectedPositionInt;
public static boolean canPositionSelectorForHoveredItem() {
return sHasMethods;
}
static {
try {
Class cls = Integer.TYPE;
Class cls2 = Float.TYPE;
Method declaredMethod = AbsListView.class.getDeclaredMethod("positionSelector", cls, View.class, Boolean.TYPE, cls2, cls2);
sPositionSelector = declaredMethod;
declaredMethod.setAccessible(true);
Method declaredMethod2 = AdapterView.class.getDeclaredMethod("setSelectedPositionInt", cls);
sSetSelectedPositionInt = declaredMethod2;
declaredMethod2.setAccessible(true);
Method declaredMethod3 = AdapterView.class.getDeclaredMethod("setNextSelectedPositionInt", cls);
sSetNextSelectedPositionInt = declaredMethod3;
declaredMethod3.setAccessible(true);
sHasMethods = true;
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
}
private Api30Impl() {
}
@SuppressLint({"BanUncheckedReflection"})
public static void positionSelectorForHoveredItem(DropDownListView dropDownListView, int i, View view) {
try {
sPositionSelector.invoke(dropDownListView, Integer.valueOf(i), view, Boolean.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();
}
}
}
@RequiresApi(21)
public static class Api21Impl {
private Api21Impl() {
}
@DoNotInline
public static void drawableHotspotChanged(View view, float f, float f2) {
view.drawableHotspotChanged(f, f2);
}
}
public 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() {
}
public 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;
}
}
public 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();
}
}
}
}
@RequiresApi(33)
public static class Api33Impl {
private Api33Impl() {
}
@DoNotInline
public static boolean isSelectedChildViewEnabled(AbsListView absListView) {
return absListView.isSelectedChildViewEnabled();
}
@DoNotInline
public static void setSelectedChildViewEnabled(AbsListView absListView, boolean z) {
absListView.setSelectedChildViewEnabled(z);
}
}
}

View File

@@ -0,0 +1,8 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public interface EmojiCompatConfigurationView {
boolean isEmojiCompatEnabled();
void setEmojiCompatEnabled(boolean z);
}

View File

@@ -0,0 +1,38 @@
package androidx.appcompat.widget;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.appcompat.widget.FitWindowsViewGroup;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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(@NonNull Context context) {
super(context);
}
public FitWindowsFrameLayout(@NonNull Context context, @Nullable AttributeSet attributeSet) {
super(context, attributeSet);
}
@Override // android.view.View
public boolean fitSystemWindows(Rect rect) {
FitWindowsViewGroup.OnFitSystemWindowsListener onFitSystemWindowsListener = this.mListener;
if (onFitSystemWindowsListener != null) {
onFitSystemWindowsListener.onFitSystemWindows(rect);
}
return super.fitSystemWindows(rect);
}
}

View File

@@ -0,0 +1,38 @@
package androidx.appcompat.widget;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.appcompat.widget.FitWindowsViewGroup;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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(@NonNull Context context) {
super(context);
}
public FitWindowsLinearLayout(@NonNull Context context, @Nullable AttributeSet attributeSet) {
super(context, attributeSet);
}
@Override // android.view.View
public boolean fitSystemWindows(Rect rect) {
FitWindowsViewGroup.OnFitSystemWindowsListener onFitSystemWindowsListener = this.mListener;
if (onFitSystemWindowsListener != null) {
onFitSystemWindowsListener.onFitSystemWindows(rect);
}
return super.fitSystemWindows(rect);
}
}

View File

@@ -0,0 +1,15 @@
package androidx.appcompat.widget;
import android.graphics.Rect;
import androidx.annotation.RestrictTo;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public interface FitWindowsViewGroup {
public interface OnFitSystemWindowsListener {
void onFitSystemWindows(Rect rect);
}
void setOnFitSystemWindowsListener(OnFitSystemWindowsListener onFitSystemWindowsListener);
}

View File

@@ -0,0 +1,237 @@
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.annotation.RestrictTo;
import androidx.appcompat.view.menu.ShowableListMenu;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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);
}
}
public boolean onForwardingStarted() {
ShowableListMenu popup = getPopup();
if (popup == null || popup.isShowing()) {
return true;
}
popup.show();
return true;
}
public 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);
}
}
public 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;
}
public class DisallowIntercept implements Runnable {
public DisallowIntercept() {
}
@Override // java.lang.Runnable
public void run() {
ViewParent parent = ForwardingListener.this.mSrc.getParent();
if (parent != null) {
parent.requestDisallowInterceptTouchEvent(true);
}
}
}
public class TriggerLongPress implements Runnable {
public TriggerLongPress() {
}
@Override // java.lang.Runnable
public void run() {
ForwardingListener.this.onLongPress();
}
}
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class LinearLayoutCompat$InspectionCompanion$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class LinearLayoutCompat$InspectionCompanion$$ExternalSyntheticApiModelOutline1 {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class LinearLayoutCompat$InspectionCompanion$$ExternalSyntheticApiModelOutline2 {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class LinearLayoutCompat$InspectionCompanion$$ExternalSyntheticApiModelOutline3 {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class LinearLayoutCompat$InspectionCompanion$$ExternalSyntheticApiModelOutline4 {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class LinearLayoutCompat$InspectionCompanion$$ExternalSyntheticApiModelOutline5 {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class LinearLayoutCompat$InspectionCompanion$$ExternalSyntheticApiModelOutline6 {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class LinearLayoutCompat$InspectionCompanion$$ExternalSyntheticApiModelOutline7 {
}

View File

@@ -0,0 +1,775 @@
package androidx.appcompat.widget;
import android.R;
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.view.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
import android.widget.LinearLayout;
import androidx.annotation.GravityInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.view.GravityCompat;
import androidx.core.view.ViewCompat;
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.HashSet;
import java.util.Set;
import java.util.function.IntFunction;
/* 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)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public @interface DividerMode {
}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public @interface OrientationMode {
}
public int getBaselineAlignedChildIndex() {
return this.mBaselineAlignedChildIndex;
}
public int getChildrenSkipCount(View view, int i) {
return 0;
}
public Drawable getDividerDrawable() {
return this.mDivider;
}
public int getDividerPadding() {
return this.mDividerPadding;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public int getDividerWidth() {
return this.mDividerWidth;
}
@GravityInt
public int getGravity() {
return this.mGravity;
}
public int getLocationOffset(View view) {
return 0;
}
public 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;
}
public 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;
}
@RequiresApi(29)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final class InspectionCompanion implements android.view.inspector.InspectionCompanion {
private int mBaselineAlignedChildIndexId;
private int mBaselineAlignedId;
private int mDividerId;
private int mDividerPaddingId;
private int mGravityId;
private int mMeasureWithLargestChildId;
private int mOrientationId;
private boolean mPropertiesMapped = false;
private int mShowDividersId;
private int mWeightSumId;
public void mapProperties(@NonNull PropertyMapper propertyMapper) {
int mapBoolean;
int mapInt;
int mapGravity;
int mapIntEnum;
int mapFloat;
int mapObject;
int mapInt2;
int mapBoolean2;
int mapIntFlag;
mapBoolean = propertyMapper.mapBoolean("baselineAligned", R.attr.baselineAligned);
this.mBaselineAlignedId = mapBoolean;
mapInt = propertyMapper.mapInt("baselineAlignedChildIndex", R.attr.baselineAlignedChildIndex);
this.mBaselineAlignedChildIndexId = mapInt;
mapGravity = propertyMapper.mapGravity("gravity", R.attr.gravity);
this.mGravityId = mapGravity;
mapIntEnum = propertyMapper.mapIntEnum("orientation", R.attr.orientation, new IntFunction<String>() { // from class: androidx.appcompat.widget.LinearLayoutCompat.InspectionCompanion.1
@Override // java.util.function.IntFunction
public String apply(int i) {
return i != 0 ? i != 1 ? String.valueOf(i) : "vertical" : "horizontal";
}
});
this.mOrientationId = mapIntEnum;
mapFloat = propertyMapper.mapFloat("weightSum", R.attr.weightSum);
this.mWeightSumId = mapFloat;
mapObject = propertyMapper.mapObject("divider", androidx.appcompat.R.attr.divider);
this.mDividerId = mapObject;
mapInt2 = propertyMapper.mapInt("dividerPadding", androidx.appcompat.R.attr.dividerPadding);
this.mDividerPaddingId = mapInt2;
mapBoolean2 = propertyMapper.mapBoolean("measureWithLargestChild", androidx.appcompat.R.attr.measureWithLargestChild);
this.mMeasureWithLargestChildId = mapBoolean2;
mapIntFlag = propertyMapper.mapIntFlag("showDividers", androidx.appcompat.R.attr.showDividers, new IntFunction<Set<String>>() { // from class: androidx.appcompat.widget.LinearLayoutCompat.InspectionCompanion.2
@Override // java.util.function.IntFunction
public Set<String> apply(int i) {
HashSet hashSet = new HashSet();
if (i == 0) {
hashSet.add("none");
}
if (i == 1) {
hashSet.add("beginning");
}
if (i == 2) {
hashSet.add("middle");
}
if (i == 4) {
hashSet.add(TtmlNode.END);
}
return hashSet;
}
});
this.mShowDividersId = mapIntFlag;
this.mPropertiesMapped = true;
}
public void readProperties(@NonNull LinearLayoutCompat linearLayoutCompat, @NonNull PropertyReader propertyReader) {
if (!this.mPropertiesMapped) {
throw AppCompatAutoCompleteTextView$InspectionCompanion$$ExternalSyntheticApiModelOutline2.m();
}
propertyReader.readBoolean(this.mBaselineAlignedId, linearLayoutCompat.isBaselineAligned());
propertyReader.readInt(this.mBaselineAlignedChildIndexId, linearLayoutCompat.getBaselineAlignedChildIndex());
propertyReader.readGravity(this.mGravityId, linearLayoutCompat.getGravity());
propertyReader.readIntEnum(this.mOrientationId, linearLayoutCompat.getOrientation());
propertyReader.readFloat(this.mWeightSumId, linearLayoutCompat.getWeightSum());
propertyReader.readObject(this.mDividerId, linearLayoutCompat.getDividerDrawable());
propertyReader.readInt(this.mDividerPaddingId, linearLayoutCompat.getDividerPadding());
propertyReader.readBoolean(this.mMeasureWithLargestChildId, linearLayoutCompat.isMeasureWithLargestChildEnabled());
propertyReader.readIntFlag(this.mShowDividersId, linearLayoutCompat.getShowDividers());
}
}
public LinearLayoutCompat(@NonNull Context context) {
this(context, null);
}
public LinearLayoutCompat(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public LinearLayoutCompat(@NonNull Context context, @Nullable 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, androidx.appcompat.R.styleable.LinearLayoutCompat, i, 0);
ViewCompat.saveAttributeDataForStyleable(this, context, androidx.appcompat.R.styleable.LinearLayoutCompat, attributeSet, obtainStyledAttributes.getWrappedTypeArray(), i, 0);
int i2 = obtainStyledAttributes.getInt(androidx.appcompat.R.styleable.LinearLayoutCompat_android_orientation, -1);
if (i2 >= 0) {
setOrientation(i2);
}
int i3 = obtainStyledAttributes.getInt(androidx.appcompat.R.styleable.LinearLayoutCompat_android_gravity, -1);
if (i3 >= 0) {
setGravity(i3);
}
boolean z = obtainStyledAttributes.getBoolean(androidx.appcompat.R.styleable.LinearLayoutCompat_android_baselineAligned, true);
if (!z) {
setBaselineAligned(z);
}
this.mWeightSum = obtainStyledAttributes.getFloat(androidx.appcompat.R.styleable.LinearLayoutCompat_android_weightSum, -1.0f);
this.mBaselineAlignedChildIndex = obtainStyledAttributes.getInt(androidx.appcompat.R.styleable.LinearLayoutCompat_android_baselineAlignedChildIndex, -1);
this.mUseLargestChild = obtainStyledAttributes.getBoolean(androidx.appcompat.R.styleable.LinearLayoutCompat_measureWithLargestChild, false);
setDividerDrawable(obtainStyledAttributes.getDrawable(androidx.appcompat.R.styleable.LinearLayoutCompat_divider));
this.mShowDividers = obtainStyledAttributes.getInt(androidx.appcompat.R.styleable.LinearLayoutCompat_showDividers, 0);
this.mDividerPadding = obtainStyledAttributes.getDimensionPixelSize(androidx.appcompat.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
public void onDraw(@NonNull Canvas canvas) {
if (this.mDivider == null) {
return;
}
if (this.mOrientation == 1) {
drawDividersVertical(canvas);
} else {
drawDividersHorizontal(canvas);
}
}
public 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() - ((LinearLayout.LayoutParams) ((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() + ((LinearLayout.LayoutParams) ((LayoutParams) virtualChildAt2.getLayoutParams())).bottomMargin;
}
drawHorizontalDivider(canvas, bottom);
}
}
public 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() + ((LinearLayout.LayoutParams) layoutParams).rightMargin;
} else {
left2 = (virtualChildAt.getLeft() - ((LinearLayout.LayoutParams) 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() - ((LinearLayout.LayoutParams) layoutParams2).leftMargin;
i = this.mDividerWidth;
right = left - i;
} else {
right = virtualChildAt2.getRight() + ((LinearLayout.LayoutParams) layoutParams2).rightMargin;
}
} else if (isLayoutRtl) {
right = getPaddingLeft();
} else {
left = getWidth() - getPaddingRight();
i = this.mDividerWidth;
right = left - i;
}
drawVerticalDivider(canvas, right);
}
}
public void drawHorizontalDivider(Canvas canvas, int i) {
this.mDivider.setBounds(getPaddingLeft() + this.mDividerPadding, i, (getWidth() - getPaddingRight()) - this.mDividerPadding, this.mDividerHeight + i);
this.mDivider.draw(canvas);
}
public 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 + ((LinearLayout.LayoutParams) ((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() + ")");
}
public View getVirtualChildAt(int i) {
return getChildAt(i);
}
public int getVirtualChildCount() {
return getChildCount();
}
public void setWeightSum(float f) {
this.mWeightSum = Math.max(0.0f, f);
}
@Override // android.view.View
public void onMeasure(int i, int i2) {
if (this.mOrientation == 1) {
measureVertical(i, i2);
} else {
measureHorizontal(i, i2);
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public 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:157:0x031c, code lost:
if (((android.widget.LinearLayout.LayoutParams) r14).width == (-1)) goto L148;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void measureVertical(int r34, int r35) {
/*
Method dump skipped, instructions count: 911
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(), 1073741824);
for (int i3 = 0; i3 < i; i3++) {
View virtualChildAt = getVirtualChildAt(i3);
if (virtualChildAt.getVisibility() != 8) {
LayoutParams layoutParams = (LayoutParams) virtualChildAt.getLayoutParams();
if (((LinearLayout.LayoutParams) layoutParams).width == -1) {
int i4 = ((LinearLayout.LayoutParams) layoutParams).height;
((LinearLayout.LayoutParams) layoutParams).height = virtualChildAt.getMeasuredHeight();
measureChildWithMargins(virtualChildAt, makeMeasureSpec, 0, i2, 0);
((LinearLayout.LayoutParams) layoutParams).height = i4;
}
}
}
}
/* JADX WARN: Removed duplicated region for block: B:200:0x045b */
/* JADX WARN: Removed duplicated region for block: B:44:0x0197 */
/* JADX WARN: Removed duplicated region for block: B:53:0x01cb */
/* JADX WARN: Removed duplicated region for block: B:60:0x01d9 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void measureHorizontal(int r40, int r41) {
/*
Method dump skipped, instructions count: 1293
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(), 1073741824);
for (int i3 = 0; i3 < i; i3++) {
View virtualChildAt = getVirtualChildAt(i3);
if (virtualChildAt.getVisibility() != 8) {
LayoutParams layoutParams = (LayoutParams) virtualChildAt.getLayoutParams();
if (((LinearLayout.LayoutParams) layoutParams).height == -1) {
int i4 = ((LinearLayout.LayoutParams) layoutParams).width;
((LinearLayout.LayoutParams) layoutParams).width = virtualChildAt.getMeasuredWidth();
measureChildWithMargins(virtualChildAt, i2, 0, makeMeasureSpec, 0);
((LinearLayout.LayoutParams) layoutParams).width = i4;
}
}
}
}
public 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
public 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:27:0x00a1 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public 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 = r1
L49:
if (r12 >= r10) goto Lcb
android.view.View r13 = r6.getVirtualChildAt(r12)
r14 = 1
if (r13 != 0) goto L5a
int r1 = r6.measureNullChild(r12)
int r0 = r0 + r1
L57:
r1 = r14
goto Lc8
L5a:
int r1 = r13.getVisibility()
r2 = 8
if (r1 == r2) goto L57
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 L76
r1 = r11
L76:
int r2 = r17.getLayoutDirection()
int r1 = androidx.core.view.GravityCompat.getAbsoluteGravity(r1, r2)
r1 = r1 & 7
if (r1 == r14) goto L90
r2 = 5
if (r1 == r2) goto L8a
int r1 = r5.leftMargin
int r1 = r1 + r7
L88:
r2 = r1
goto L9b
L8a:
int r1 = r8 - r4
int r2 = r5.rightMargin
L8e:
int r1 = r1 - r2
goto L88
L90:
int r1 = r9 - r4
int r1 = r1 / 2
int r1 = r1 + r7
int r2 = r5.leftMargin
int r1 = r1 + r2
int r2 = r5.rightMargin
goto L8e
L9b:
boolean r1 = r6.hasDividerBeforeChildAt(r12)
if (r1 == 0) goto La4
int r1 = r6.mDividerHeight
int r0 = r0 + r1
La4:
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
r1 = 1
Lc8:
int r12 = r12 + r1
goto L49
Lcb:
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:0x00b1 */
/* JADX WARN: Removed duplicated region for block: B:29:0x00ba */
/* JADX WARN: Removed duplicated region for block: B:37:0x0100 */
/* JADX WARN: Removed duplicated region for block: B:46:0x00ec */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void layoutHorizontal(int r25, int r26, int r27, int r28) {
/*
Method dump skipped, instructions count: 331
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(@GravityInt 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);
}
@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;
}
@Override // android.view.ViewGroup
public LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
if (layoutParams instanceof LayoutParams) {
return new LayoutParams((ViewGroup.MarginLayoutParams) layoutParams);
}
if (layoutParams instanceof ViewGroup.MarginLayoutParams) {
return new LayoutParams((ViewGroup.MarginLayoutParams) layoutParams);
}
return new LayoutParams(layoutParams);
}
@Override // android.view.ViewGroup
public 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);
}
}
}

View File

@@ -0,0 +1,870 @@
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.annotation.AttrRes;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.annotation.StyleRes;
import androidx.appcompat.R;
import androidx.appcompat.view.menu.ShowableListMenu;
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;
}
@Nullable
public View getAnchorView() {
return this.mDropDownAnchorView;
}
public int getHeight() {
return this.mDropDownHeight;
}
public int getHorizontalOffset() {
return this.mDropDownHorizontalOffset;
}
@Override // androidx.appcompat.view.menu.ShowableListMenu
@Nullable
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;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public boolean isDropDownAlwaysVisible() {
return this.mDropDownAlwaysVisible;
}
public boolean isModal() {
return this.mModal;
}
public void setAnchorView(@Nullable View view) {
this.mDropDownAnchorView = view;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setDropDownAlwaysVisible(boolean z) {
this.mDropDownAlwaysVisible = z;
}
public void setDropDownGravity(int i) {
this.mDropDownGravity = i;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public void setForceIgnoreOutsideTouch(boolean z) {
this.mForceIgnoreOutsideTouch = z;
}
public void setHorizontalOffset(int i) {
this.mDropDownHorizontalOffset = i;
}
public void setListItemExpandMax(int i) {
this.mListItemExpandMaximum = i;
}
public void setListSelector(Drawable drawable) {
this.mDropDownListHighlight = drawable;
}
public void setOnItemClickListener(@Nullable AdapterView.OnItemClickListener onItemClickListener) {
this.mItemClickListener = onItemClickListener;
}
public void setOnItemSelectedListener(@Nullable AdapterView.OnItemSelectedListener onItemSelectedListener) {
this.mItemSelectedListener = onItemSelectedListener;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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) {
}
try {
sSetEpicenterBoundsMethod = PopupWindow.class.getDeclaredMethod("setEpicenterBounds", Rect.class);
} catch (NoSuchMethodException unused2) {
}
}
}
public ListPopupWindow(@NonNull Context context) {
this(context, null, R.attr.listPopupWindowStyle);
}
public ListPopupWindow(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, R.attr.listPopupWindowStyle);
}
public ListPopupWindow(@NonNull Context context, @Nullable AttributeSet attributeSet, @AttrRes int i) {
this(context, attributeSet, i, 0);
}
public ListPopupWindow(@NonNull Context context, @Nullable AttributeSet attributeSet, @AttrRes int i, @StyleRes int i2) {
this.mDropDownHeight = -2;
this.mDropDownWidth = -2;
this.mDropDownWindowLayoutType = 1002;
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(@Nullable 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();
}
@Nullable
public Drawable getBackground() {
return this.mPopup.getBackground();
}
public void setBackgroundDrawable(@Nullable Drawable drawable) {
this.mPopup.setBackgroundDrawable(drawable);
}
public void setAnimationStyle(@StyleRes int i) {
this.mPopup.setAnimationStyle(i);
}
@StyleRes
public int getAnimationStyle() {
return this.mPopup.getAnimationStyle();
}
public void setEpicenterBounds(@Nullable Rect rect) {
this.mEpicenterBounds = rect != null ? new Rect(rect) : null;
}
@Nullable
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);
Rect rect = this.mTempRect;
this.mDropDownWidth = rect.left + rect.right + i;
return;
}
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(@Nullable 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 (getAnchorView().isAttachedToWindow()) {
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(@Nullable 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;
}
@Nullable
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;
}
@Nullable
public View getSelectedView() {
if (isShowing()) {
return this.mDropDownList.getSelectedView();
}
return null;
}
@NonNull
public DropDownListView createDropDownListView(Context context, boolean z) {
return new DropDownListView(context, z);
}
public boolean onKeyDown(int i, @NonNull 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, @NonNull 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, @NonNull 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);
Rect rect = this.mTempRect;
int i6 = rect.top;
i2 = rect.bottom + i6;
if (!this.mDropDownVerticalOffsetSet) {
this.mDropDownVerticalOffset = -i6;
}
} 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 i7 = this.mDropDownWidth;
if (i7 == -2) {
int i8 = this.mContext.getResources().getDisplayMetrics().widthPixels;
Rect rect2 = this.mTempRect;
makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i8 - (rect2.left + rect2.right), Integer.MIN_VALUE);
} else if (i7 == -1) {
int i9 = this.mContext.getResources().getDisplayMetrics().widthPixels;
Rect rect3 = this.mTempRect;
makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i9 - (rect3.left + rect3.right), 1073741824);
} else {
makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(i7, 1073741824);
}
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;
}
public class PopupDataSetObserver extends DataSetObserver {
public 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();
}
}
public class ListSelectorHider implements Runnable {
public ListSelectorHider() {
}
@Override // java.lang.Runnable
public void run() {
ListPopupWindow.this.clearListSelection();
}
}
public class ResizePopupRunnable implements Runnable {
public ResizePopupRunnable() {
}
@Override // java.lang.Runnable
public void run() {
DropDownListView dropDownListView = ListPopupWindow.this.mDropDownList;
if (dropDownListView == null || !dropDownListView.isAttachedToWindow() || ListPopupWindow.this.mDropDownList.getCount() <= ListPopupWindow.this.mDropDownList.getChildCount()) {
return;
}
int childCount = ListPopupWindow.this.mDropDownList.getChildCount();
ListPopupWindow listPopupWindow = ListPopupWindow.this;
if (childCount <= listPopupWindow.mListItemExpandMaximum) {
listPopupWindow.mPopup.setInputMethodMode(2);
ListPopupWindow.this.show();
}
}
}
public class PopupTouchInterceptor implements View.OnTouchListener {
public PopupTouchInterceptor() {
}
@Override // android.view.View.OnTouchListener
public boolean onTouch(View view, MotionEvent motionEvent) {
PopupWindow popupWindow;
int action = motionEvent.getAction();
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
if (action == 0 && (popupWindow = ListPopupWindow.this.mPopup) != null && popupWindow.isShowing() && x >= 0 && x < ListPopupWindow.this.mPopup.getWidth() && y >= 0 && y < ListPopupWindow.this.mPopup.getHeight()) {
ListPopupWindow listPopupWindow = ListPopupWindow.this;
listPopupWindow.mHandler.postDelayed(listPopupWindow.mResizePopupRunnable, 250L);
return false;
}
if (action != 1) {
return false;
}
ListPopupWindow listPopupWindow2 = ListPopupWindow.this;
listPopupWindow2.mHandler.removeCallbacks(listPopupWindow2.mResizePopupRunnable);
return false;
}
}
public class PopupScrollListener implements AbsListView.OnScrollListener {
@Override // android.widget.AbsListView.OnScrollListener
public void onScroll(AbsListView absListView, int i, int i2, int i3) {
}
public 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 listPopupWindow = ListPopupWindow.this;
listPopupWindow.mHandler.removeCallbacks(listPopupWindow.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) {
}
}
}
private int getMaxAvailableHeight(View view, int i, boolean z) {
return Api24Impl.getMaxAvailableHeight(this.mPopup, view, i, z);
}
@RequiresApi(29)
public static class Api29Impl {
private Api29Impl() {
}
@DoNotInline
public static void setEpicenterBounds(PopupWindow popupWindow, Rect rect) {
popupWindow.setEpicenterBounds(rect);
}
@DoNotInline
public static void setIsClippedToScreen(PopupWindow popupWindow, boolean z) {
popupWindow.setIsClippedToScreen(z);
}
}
@RequiresApi(24)
public static class Api24Impl {
private Api24Impl() {
}
@DoNotInline
public static int getMaxAvailableHeight(PopupWindow popupWindow, View view, int i, boolean z) {
return popupWindow.getMaxAvailableHeight(view, i, z);
}
}
}

View File

@@ -0,0 +1,14 @@
package androidx.appcompat.widget;
import android.view.MenuItem;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.appcompat.view.menu.MenuBuilder;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public interface MenuItemHoverListener {
void onItemHoverEnter(@NonNull MenuBuilder menuBuilder, @NonNull MenuItem menuItem);
void onItemHoverExit(@NonNull MenuBuilder menuBuilder, @NonNull MenuItem menuItem);
}

View File

@@ -0,0 +1,249 @@
package androidx.appcompat.widget;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.transition.Transition;
import android.util.AttributeSet;
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.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
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;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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) {
}
}
public MenuPopupWindow(@NonNull Context context, @Nullable AttributeSet attributeSet, int i, int i2) {
super(context, attributeSet, i, i2);
}
@Override // androidx.appcompat.widget.ListPopupWindow
@NonNull
public DropDownListView createDropDownListView(Context context, boolean z) {
MenuDropDownListView menuDropDownListView = new MenuDropDownListView(context, z);
menuDropDownListView.setHoverListener(this);
return menuDropDownListView;
}
public void setEnterTransition(Object obj) {
Api23Impl.setEnterTransition(this.mPopup, (Transition) obj);
}
public void setExitTransition(Object obj) {
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) {
}
}
}
@Override // androidx.appcompat.widget.MenuItemHoverListener
public void onItemHoverEnter(@NonNull MenuBuilder menuBuilder, @NonNull MenuItem menuItem) {
MenuItemHoverListener menuItemHoverListener = this.mHoverListener;
if (menuItemHoverListener != null) {
menuItemHoverListener.onItemHoverEnter(menuBuilder, menuItem);
}
}
@Override // androidx.appcompat.widget.MenuItemHoverListener
public void onItemHoverExit(@NonNull MenuBuilder menuBuilder, @NonNull MenuItem menuItem) {
MenuItemHoverListener menuItemHoverListener = this.mHoverListener;
if (menuItemHoverListener != null) {
menuItemHoverListener.onItemHoverExit(menuBuilder, menuItem);
}
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
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 == context.getResources().getConfiguration().getLayoutDirection()) {
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);
}
}
@RequiresApi(23)
public static class Api23Impl {
private Api23Impl() {
}
@DoNotInline
public static void setEnterTransition(PopupWindow popupWindow, Transition transition) {
popupWindow.setEnterTransition(transition);
}
@DoNotInline
public static void setExitTransition(PopupWindow popupWindow, Transition transition) {
popupWindow.setExitTransition(transition);
}
}
@RequiresApi(29)
public static class Api29Impl {
private Api29Impl() {
}
@DoNotInline
public static void setTouchModal(PopupWindow popupWindow, boolean z) {
popupWindow.setTouchModal(z);
}
}
}

View File

@@ -0,0 +1,156 @@
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.annotation.AttrRes;
import androidx.annotation.MenuRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.StyleRes;
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);
}
@NonNull
public Menu getMenu() {
return this.mMenu;
}
public void setOnDismissListener(@Nullable OnDismissListener onDismissListener) {
this.mOnDismissListener = onDismissListener;
}
public void setOnMenuItemClickListener(@Nullable OnMenuItemClickListener onMenuItemClickListener) {
this.mMenuItemClickListener = onMenuItemClickListener;
}
public PopupMenu(@NonNull Context context, @NonNull View view) {
this(context, view, 0);
}
public PopupMenu(@NonNull Context context, @NonNull View view, int i) {
this(context, view, i, R.attr.popupMenuStyle, 0);
}
public PopupMenu(@NonNull Context context, @NonNull View view, int i, @AttrRes int i2, @StyleRes 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(@NonNull MenuBuilder menuBuilder2) {
}
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
public boolean onMenuItemSelected(@NonNull MenuBuilder menuBuilder2, @NonNull MenuItem menuItem) {
OnMenuItemClickListener onMenuItemClickListener = PopupMenu.this.mMenuItemClickListener;
if (onMenuItemClickListener != null) {
return onMenuItemClickListener.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() {
PopupMenu popupMenu = PopupMenu.this;
OnDismissListener onDismissListener = popupMenu.mOnDismissListener;
if (onDismissListener != null) {
onDismissListener.onDismiss(popupMenu);
}
}
});
}
public void setGravity(int i) {
this.mPopup.setGravity(i);
}
public int getGravity() {
return this.mPopup.getGravity();
}
@NonNull
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
public boolean onForwardingStarted() {
PopupMenu.this.show();
return true;
}
@Override // androidx.appcompat.widget.ForwardingListener
public boolean onForwardingStopped() {
PopupMenu.this.dismiss();
return true;
}
@Override // androidx.appcompat.widget.ForwardingListener
public ShowableListMenu getPopup() {
return PopupMenu.this.mPopup.getPopup();
}
};
}
return this.mDragListener;
}
@NonNull
public MenuInflater getMenuInflater() {
return new SupportMenuInflater(this.mContext);
}
public void inflate(@MenuRes 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);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public ListView getMenuListView() {
if (this.mPopup.isShowing()) {
return this.mPopup.getListView();
}
return null;
}
}

View File

@@ -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.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.util.Xml;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
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;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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);
public interface InflateDelegate {
Drawable createFromXmlInner(@NonNull Context context, @NonNull XmlPullParser xmlPullParser, @NonNull AttributeSet attributeSet, @Nullable Resources.Theme theme);
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public interface ResourceManagerHooks {
@Nullable
Drawable createDrawableFor(@NonNull ResourceManagerInternal resourceManagerInternal, @NonNull Context context, @DrawableRes int i);
@Nullable
ColorStateList getTintListForDrawableRes(@NonNull Context context, @DrawableRes int i);
@Nullable
PorterDuff.Mode getTintModeForDrawableRes(int i);
boolean tintDrawable(@NonNull Context context, @DrawableRes int i, @NonNull Drawable drawable);
boolean tintDrawableUsingColorFilter(@NonNull Context context, @DrawableRes int i, @NonNull Drawable drawable);
}
private static void installDefaultInflateDelegates(@NonNull ResourceManagerInternal resourceManagerInternal) {
}
public static synchronized ResourceManagerInternal get() {
ResourceManagerInternal resourceManagerInternal;
synchronized (ResourceManagerInternal.class) {
try {
if (INSTANCE == null) {
ResourceManagerInternal resourceManagerInternal2 = new ResourceManagerInternal();
INSTANCE = resourceManagerInternal2;
installDefaultInflateDelegates(resourceManagerInternal2);
}
resourceManagerInternal = INSTANCE;
} catch (Throwable th) {
throw th;
}
}
return resourceManagerInternal;
}
public synchronized void setHooks(ResourceManagerHooks resourceManagerHooks) {
this.mHooks = resourceManagerHooks;
}
public synchronized Drawable getDrawable(@NonNull Context context, @DrawableRes int i) {
return getDrawable(context, i, false);
}
public synchronized Drawable getDrawable(@NonNull Context context, @DrawableRes int i, boolean z) {
Drawable loadDrawableFromDelegates;
try {
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);
}
} catch (Throwable th) {
throw th;
}
return loadDrawableFromDelegates;
}
public synchronized void onConfigurationChanged(@NonNull 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(@NonNull Context context, @DrawableRes 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(@NonNull Context context, @DrawableRes int i, boolean z, @NonNull Drawable drawable) {
ColorStateList tintList = getTintList(context, i);
if (tintList != null) {
Drawable wrap = DrawableCompat.wrap(drawable.mutate());
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(@NonNull Context context, @DrawableRes 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;
}
CharSequence charSequence = typedValue.string;
if (charSequence != null && charSequence.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(@NonNull 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(@NonNull Context context, long j, @NonNull Drawable drawable) {
try {
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;
} catch (Throwable th) {
throw th;
}
}
public synchronized Drawable onDrawableLoadedFromResources(@NonNull Context context, @NonNull VectorEnabledTintResources vectorEnabledTintResources, @DrawableRes int i) {
try {
Drawable loadDrawableFromDelegates = loadDrawableFromDelegates(context, i);
if (loadDrawableFromDelegates == null) {
loadDrawableFromDelegates = vectorEnabledTintResources.getDrawableCanonical(i);
}
if (loadDrawableFromDelegates == null) {
return null;
}
return tintDrawable(context, i, false, loadDrawableFromDelegates);
} catch (Throwable th) {
throw th;
}
}
public boolean tintDrawableUsingColorFilter(@NonNull Context context, @DrawableRes int i, @NonNull Drawable drawable) {
ResourceManagerHooks resourceManagerHooks = this.mHooks;
return resourceManagerHooks != null && resourceManagerHooks.tintDrawableUsingColorFilter(context, i, drawable);
}
private void addDelegate(@NonNull String str, @NonNull InflateDelegate inflateDelegate) {
if (this.mDelegates == null) {
this.mDelegates = new SimpleArrayMap<>();
}
this.mDelegates.put(str, inflateDelegate);
}
public PorterDuff.Mode getTintMode(int i) {
ResourceManagerHooks resourceManagerHooks = this.mHooks;
if (resourceManagerHooks == null) {
return null;
}
return resourceManagerHooks.getTintModeForDrawableRes(i);
}
public synchronized ColorStateList getTintList(@NonNull Context context, @DrawableRes 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(@NonNull Context context, @DrawableRes 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(@NonNull Context context, @DrawableRes int i, @NonNull 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);
}
public static class ColorFilterLruCache extends LruCache<Integer, PorterDuffColorFilter> {
public ColorFilterLruCache(int i) {
super(i);
}
public PorterDuffColorFilter get(int i, PorterDuff.Mode mode) {
return get(Integer.valueOf(generateCacheKey(i, mode)));
}
public 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();
}
}
public static void tintDrawable(Drawable drawable, TintInfo tintInfo, int[] iArr) {
int[] state = drawable.getState();
if (drawable.mutate() == drawable) {
if ((drawable instanceof LayerDrawable) && drawable.isStateful()) {
drawable.setState(new int[0]);
drawable.setState(state);
}
boolean z = tintInfo.mHasTintList;
if (z || tintInfo.mHasTintMode) {
drawable.setColorFilter(createTintFilter(z ? tintInfo.mTintList : null, tintInfo.mHasTintMode ? tintInfo.mTintMode : DEFAULT_MODE, iArr));
} else {
drawable.clearColorFilter();
}
}
}
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(@NonNull 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(@NonNull Drawable drawable) {
return (drawable instanceof VectorDrawableCompat) || PLATFORM_VD_CLAZZ.equals(drawable.getClass().getName());
}
public static class VdcInflateDelegate implements InflateDelegate {
@Override // androidx.appcompat.widget.ResourceManagerInternal.InflateDelegate
public Drawable createFromXmlInner(@NonNull Context context, @NonNull XmlPullParser xmlPullParser, @NonNull AttributeSet attributeSet, @Nullable Resources.Theme theme) {
try {
return VectorDrawableCompat.createFromXmlInner(context.getResources(), xmlPullParser, attributeSet, theme);
} catch (Exception e) {
Log.e("VdcInflateDelegate", "Exception while inflating <vector>", e);
return null;
}
}
}
public static class AvdcInflateDelegate implements InflateDelegate {
@Override // androidx.appcompat.widget.ResourceManagerInternal.InflateDelegate
public Drawable createFromXmlInner(@NonNull Context context, @NonNull XmlPullParser xmlPullParser, @NonNull AttributeSet attributeSet, @Nullable 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;
}
}
}
public static class AsldcInflateDelegate implements InflateDelegate {
@Override // androidx.appcompat.widget.ResourceManagerInternal.InflateDelegate
public Drawable createFromXmlInner(@NonNull Context context, @NonNull XmlPullParser xmlPullParser, @NonNull AttributeSet attributeSet, @Nullable 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;
}
}
}
public static class DrawableDelegate implements InflateDelegate {
@Override // androidx.appcompat.widget.ResourceManagerInternal.InflateDelegate
public Drawable createFromXmlInner(@NonNull Context context, @NonNull XmlPullParser xmlPullParser, @NonNull AttributeSet attributeSet, @Nullable 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;
}
}
}

View File

@@ -0,0 +1,259 @@
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.annotation.RequiresApi;
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);
}
public final Drawable getDrawableCanonical(int i) throws Resources.NotFoundException {
return super.getDrawable(i);
}
@Override // android.content.res.Resources
@RequiresApi(21)
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
@RequiresApi(21)
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 {
this.mResources.getValueForDensity(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);
}
}

View File

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

View File

@@ -0,0 +1,552 @@
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.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.view.ActionBarPolicy;
import androidx.appcompat.widget.LinearLayoutCompat;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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(@NonNull 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, 1073741824);
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
public 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);
}
}
public 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();
}
public 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) {
int measuredWidth = getMeasuredWidth();
int i3 = ScrollingTabContainerView.this.mMaxTabWidth;
if (measuredWidth > i3) {
super.onMeasure(View.MeasureSpec.makeMeasureSpec(i3, 1073741824), 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());
}
}
public class TabAdapter extends BaseAdapter {
@Override // android.widget.Adapter
public long getItemId(int i) {
return i;
}
public 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;
}
}
public class TabClickListener implements View.OnClickListener {
public 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);
}
}
}
public 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;
}
public 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 scrollingTabContainerView = ScrollingTabContainerView.this;
scrollingTabContainerView.mVisibilityAnim = null;
scrollingTabContainerView.setVisibility(this.mFinalVisibility);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,148 @@
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);
}
public class ShareMenuItemOnMenuItemClickListener implements MenuItem.OnMenuItemClickListener {
public ShareMenuItemOnMenuItemClickListener() {
}
@Override // android.view.MenuItem.OnMenuItemClickListener
public boolean onMenuItemClick(MenuItem menuItem) {
ShareActionProvider shareActionProvider = ShareActionProvider.this;
Intent chooseActivity = ActivityChooserModel.get(shareActionProvider.mContext, shareActionProvider.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);
}
public class ShareActivityChooserModelPolicy implements ActivityChooserModel.OnChooseActivityListener {
public ShareActivityChooserModelPolicy() {
}
@Override // androidx.appcompat.widget.ActivityChooserModel.OnChooseActivityListener
public boolean onChooseActivity(ActivityChooserModel activityChooserModel, Intent intent) {
ShareActionProvider shareActionProvider = ShareActionProvider.this;
OnShareTargetSelectedListener onShareTargetSelectedListener = shareActionProvider.mOnShareTargetSelectedListener;
if (onShareTargetSelectedListener == null) {
return false;
}
onShareTargetSelectedListener.onShareTargetSelected(shareActionProvider, intent);
return false;
}
}
public void updateIntent(Intent intent) {
intent.addFlags(134742016);
}
}

View File

@@ -0,0 +1,513 @@
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;
}
public 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)) {
TextView textView = childViewCache.mText1;
if (textView != null) {
textView.setSingleLine(false);
childViewCache.mText1.setMaxLines(2);
}
} else {
TextView textView2 = childViewCache.mText1;
if (textView2 != null) {
textView2.setSingleLine(true);
childViewCache.mText1.setMaxLines(1);
}
}
setViewText(childViewCache.mText2, stringOrNull);
}
ImageView imageView = childViewCache.mIcon1;
if (imageView != null) {
setViewDrawable(imageView, getIcon1(cursor), 4);
}
ImageView imageView2 = childViewCache.mIcon2;
if (imageView2 != null) {
setViewDrawable(imageView2, 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;
}
}
public 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);
}
}
public 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);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,98 @@
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.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.core.graphics.ColorUtils;
@RestrictTo({RestrictTo.Scope.LIBRARY})
/* 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];
@NonNull
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(@NonNull 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();
}
}
@Nullable
public static ColorStateList getThemeAttrColorStateList(@NonNull 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(@NonNull 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;
}
public static int getThemeAttrColor(@NonNull Context context, int i, float f) {
return ColorUtils.setAlphaComponent(getThemeAttrColor(context, i), Math.round(Color.alpha(r0) * f));
}
public static void checkAppCompatTheme(@NonNull View view, @NonNull 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() {
}
}

View File

@@ -0,0 +1,53 @@
package androidx.appcompat.widget;
import android.content.Context;
import android.content.res.Resources;
import android.view.LayoutInflater;
import android.widget.SpinnerAdapter;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.view.ContextThemeWrapper;
/* loaded from: classes.dex */
public interface ThemedSpinnerAdapter extends SpinnerAdapter {
@Nullable
Resources.Theme getDropDownViewTheme();
void setDropDownViewTheme(@Nullable Resources.Theme theme);
public static final class Helper {
private final Context mContext;
private LayoutInflater mDropDownInflater;
private final LayoutInflater mInflater;
@NonNull
public LayoutInflater getDropDownViewInflater() {
LayoutInflater layoutInflater = this.mDropDownInflater;
return layoutInflater != null ? layoutInflater : this.mInflater;
}
public Helper(@NonNull Context context) {
this.mContext = context;
this.mInflater = LayoutInflater.from(context);
}
public void setDropDownViewTheme(@Nullable 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));
}
}
@Nullable
public Resources.Theme getDropDownViewTheme() {
LayoutInflater layoutInflater = this.mDropDownInflater;
if (layoutInflater == null) {
return null;
}
return layoutInflater.getContext().getTheme();
}
}
}

View File

@@ -0,0 +1,99 @@
package androidx.appcompat.widget;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.AssetManager;
import android.content.res.Resources;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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(@NonNull Context context) {
if (!shouldWrap(context)) {
return context;
}
synchronized (CACHE_LOCK) {
try {
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;
} catch (Throwable th) {
throw th;
}
}
}
private static boolean shouldWrap(@NonNull Context context) {
if ((context instanceof TintContextWrapper) || (context.getResources() instanceof TintResources) || (context.getResources() instanceof VectorEnabledTintResources)) {
return false;
}
return VectorEnabledTintResources.shouldBeUsed();
}
private TintContextWrapper(@NonNull 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();
}
}

View File

@@ -0,0 +1,21 @@
package androidx.appcompat.widget;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import androidx.annotation.RestrictTo;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public class TintInfo {
public boolean mHasTintList;
public boolean mHasTintMode;
public ColorStateList mTintList;
public PorterDuff.Mode mTintMode;
public void clear() {
this.mTintList = null;
this.mHasTintList = false;
this.mTintMode = null;
this.mHasTintMode = false;
}
}

View File

@@ -0,0 +1,27 @@
package androidx.appcompat.widget;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import java.lang.ref.WeakReference;
/* loaded from: classes.dex */
class TintResources extends ResourcesWrapper {
private final WeakReference<Context> mContextRef;
public TintResources(@NonNull Context context, @NonNull 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;
}
}

View File

@@ -0,0 +1,205 @@
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.annotation.DoNotInline;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.annotation.StyleableRes;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.res.ResourcesCompat;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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);
}
@Nullable
public Typeface getFont(@StyleableRes int i, int i2, @Nullable 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();
}
@RequiresApi(21)
public int getChangingConfigurations() {
return Api21Impl.getChangingConfigurations(this.mWrapped);
}
@RequiresApi(21)
public static class Api21Impl {
private Api21Impl() {
}
@DoNotInline
public static int getType(TypedArray typedArray, int i) {
return typedArray.getType(i);
}
@DoNotInline
public static int getChangingConfigurations(TypedArray typedArray) {
return typedArray.getChangingConfigurations();
}
}
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class Toolbar$InspectionCompanion$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,5 @@
package androidx.appcompat.widget;
/* loaded from: classes.dex */
public abstract /* synthetic */ class Toolbar$InspectionCompanion$$ExternalSyntheticApiModelOutline1 {
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,645 @@
package androidx.appcompat.widget;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Parcelable;
import android.text.TextUtils;
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.annotation.RestrictTo;
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;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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 initIndeterminateProgress() {
}
@Override // androidx.appcompat.widget.DecorToolbar
public void initProgress() {
}
@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) {
ToolbarWidgetWrapper toolbarWidgetWrapper = ToolbarWidgetWrapper.this;
Window.Callback callback = toolbarWidgetWrapper.mWindowCallback;
if (callback == null || !toolbarWidgetWrapper.mMenuPrepared) {
return;
}
callback.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 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();
((ViewGroup.MarginLayoutParams) layoutParams).width = -2;
((ViewGroup.MarginLayoutParams) 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();
((ViewGroup.MarginLayoutParams) layoutParams).width = -2;
((ViewGroup.MarginLayoutParams) 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) {
this.mToolbar.setBackground(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();
}
}

View File

@@ -0,0 +1,28 @@
package androidx.appcompat.widget;
import android.view.View;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
/* loaded from: classes.dex */
public class TooltipCompat {
public static void setTooltipText(@NonNull View view, @Nullable CharSequence charSequence) {
Api26Impl.setTooltipText(view, charSequence);
}
private TooltipCompat() {
}
@RequiresApi(26)
public static class Api26Impl {
private Api26Impl() {
}
@DoNotInline
public static void setTooltipText(View view, CharSequence charSequence) {
view.setTooltipText(charSequence);
}
}
}

View File

@@ -0,0 +1,199 @@
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.annotation.RestrictTo;
import androidx.core.view.ViewCompat;
import androidx.core.view.ViewConfigurationCompat;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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.lambda$new$0();
}
};
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) {
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void lambda$new$0() {
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();
}
public void show(boolean z) {
long longPressTimeout;
long j;
long j2;
if (this.mAnchor.isAttachedToWindow()) {
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 = 15000;
}
j2 = j - longPressTimeout;
}
this.mAnchor.removeCallbacks(this.mHideRunnable);
this.mAnchor.postDelayed(this.mHideRunnable, j2);
}
}
public 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;
}
}

View File

@@ -0,0 +1,146 @@
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.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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;
public TooltipPopup(@NonNull 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 = 1002;
layoutParams.width = -2;
layoutParams.height = -2;
layoutParams.format = -3;
layoutParams.windowAnimations = R.style.Animation_AppCompat_Tooltip;
layoutParams.flags = 24;
}
public 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);
}
public void hide() {
if (isShowing()) {
((WindowManager) this.mContext.getSystemService("window")).removeView(this.mContentView);
}
}
public 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);
Rect rect = this.mTmpDisplayFrame;
if (rect.left < 0 && rect.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;
}
}

View File

@@ -0,0 +1,274 @@
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 androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.WeakReference;
import org.xmlpull.v1.XmlPullParserException;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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
@RequiresApi(21)
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
@RequiresApi(21)
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(@NonNull Context context, @NonNull 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);
}
}

View File

@@ -0,0 +1,139 @@
package androidx.appcompat.widget;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
import java.lang.ref.WeakReference;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* 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
public void dispatchDraw(Canvas canvas) {
}
@Override // android.view.View
@SuppressLint({"MissingSuperCall"})
public void draw(@NonNull 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(@NonNull Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public ViewStubCompat(@NonNull Context context, @Nullable 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
public 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");
}
}

Some files were not shown because too many files have changed in this diff Show More