ADD week 5
This commit is contained in:
		| @@ -0,0 +1,38 @@ | ||||
| package com.google.android.material.navigation; | ||||
|  | ||||
| import android.animation.Animator; | ||||
| import android.animation.AnimatorListenerAdapter; | ||||
| import android.animation.ValueAnimator; | ||||
| import android.graphics.Color; | ||||
| import android.view.View; | ||||
| import androidx.core.graphics.ColorUtils; | ||||
| import androidx.drawerlayout.widget.DrawerLayout; | ||||
| import com.google.android.material.animation.AnimationUtils; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class DrawerLayoutUtils { | ||||
|     private static final int DEFAULT_SCRIM_COLOR = -1728053248; | ||||
|     private static final int DEFAULT_SCRIM_ALPHA = Color.alpha(DEFAULT_SCRIM_COLOR); | ||||
|  | ||||
|     private DrawerLayoutUtils() { | ||||
|     } | ||||
|  | ||||
|     public static ValueAnimator.AnimatorUpdateListener getScrimCloseAnimatorUpdateListener(final DrawerLayout drawerLayout) { | ||||
|         return new ValueAnimator.AnimatorUpdateListener() { // from class: com.google.android.material.navigation.DrawerLayoutUtils$$ExternalSyntheticLambda0 | ||||
|             @Override // android.animation.ValueAnimator.AnimatorUpdateListener | ||||
|             public final void onAnimationUpdate(ValueAnimator valueAnimator) { | ||||
|                 DrawerLayout.this.setScrimColor(ColorUtils.setAlphaComponent(DrawerLayoutUtils.DEFAULT_SCRIM_COLOR, AnimationUtils.lerp(DrawerLayoutUtils.DEFAULT_SCRIM_ALPHA, 0, valueAnimator.getAnimatedFraction()))); | ||||
|             } | ||||
|         }; | ||||
|     } | ||||
|  | ||||
|     public static Animator.AnimatorListener getScrimCloseAnimatorListener(final DrawerLayout drawerLayout, final View view) { | ||||
|         return new AnimatorListenerAdapter() { // from class: com.google.android.material.navigation.DrawerLayoutUtils.1 | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationEnd(Animator animator) { | ||||
|                 DrawerLayout.this.closeDrawer(view, false); | ||||
|                 DrawerLayout.this.setScrimColor(DrawerLayoutUtils.DEFAULT_SCRIM_COLOR); | ||||
|             } | ||||
|         }; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,772 @@ | ||||
| package com.google.android.material.navigation; | ||||
|  | ||||
| import android.R; | ||||
| import android.animation.ValueAnimator; | ||||
| import android.content.Context; | ||||
| import android.content.res.ColorStateList; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.graphics.drawable.RippleDrawable; | ||||
| import android.os.Build; | ||||
| import android.text.TextUtils; | ||||
| import android.util.Log; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.MotionEvent; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.view.accessibility.AccessibilityNodeInfo; | ||||
| import android.widget.FrameLayout; | ||||
| import android.widget.ImageView; | ||||
| import android.widget.TextView; | ||||
| import androidx.appcompat.view.menu.MenuItemImpl; | ||||
| import androidx.appcompat.view.menu.MenuView; | ||||
| import androidx.appcompat.widget.TooltipCompat; | ||||
| import androidx.core.content.ContextCompat; | ||||
| import androidx.core.graphics.drawable.DrawableCompat; | ||||
| import androidx.core.view.PointerIconCompat; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; | ||||
| import androidx.core.widget.TextViewCompat; | ||||
| import com.google.android.material.animation.AnimationUtils; | ||||
| import com.google.android.material.badge.BadgeDrawable; | ||||
| import com.google.android.material.badge.BadgeUtils; | ||||
| import com.google.android.material.motion.MotionUtils; | ||||
| import com.google.android.material.resources.MaterialResources; | ||||
| import com.google.android.material.ripple.RippleUtils; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public abstract class NavigationBarItemView extends FrameLayout implements MenuView.ItemView { | ||||
|     private static final ActiveIndicatorTransform ACTIVE_INDICATOR_LABELED_TRANSFORM; | ||||
|     private static final ActiveIndicatorTransform ACTIVE_INDICATOR_UNLABELED_TRANSFORM; | ||||
|     private static final int[] CHECKED_STATE_SET = {R.attr.state_checked}; | ||||
|     private static final int INVALID_ITEM_POSITION = -1; | ||||
|     private ValueAnimator activeIndicatorAnimator; | ||||
|     private int activeIndicatorDesiredHeight; | ||||
|     private int activeIndicatorDesiredWidth; | ||||
|     private boolean activeIndicatorEnabled; | ||||
|     private int activeIndicatorLabelPadding; | ||||
|     private int activeIndicatorMarginHorizontal; | ||||
|     private float activeIndicatorProgress; | ||||
|     private boolean activeIndicatorResizeable; | ||||
|     private ActiveIndicatorTransform activeIndicatorTransform; | ||||
|     private final View activeIndicatorView; | ||||
|     private int activeTextAppearance; | ||||
|     private BadgeDrawable badgeDrawable; | ||||
|     private final ImageView icon; | ||||
|     private final FrameLayout iconContainer; | ||||
|     private ColorStateList iconTint; | ||||
|     private boolean initialized; | ||||
|     private boolean isShifting; | ||||
|     Drawable itemBackground; | ||||
|     private MenuItemImpl itemData; | ||||
|     private int itemPaddingBottom; | ||||
|     private int itemPaddingTop; | ||||
|     private int itemPosition; | ||||
|     private ColorStateList itemRippleColor; | ||||
|     private final ViewGroup labelGroup; | ||||
|     private int labelVisibilityMode; | ||||
|     private final TextView largeLabel; | ||||
|     private Drawable originalIconDrawable; | ||||
|     private float scaleDownFactor; | ||||
|     private float scaleUpFactor; | ||||
|     private float shiftAmount; | ||||
|     private final TextView smallLabel; | ||||
|     private Drawable wrappedIconDrawable; | ||||
|  | ||||
|     private void calculateTextScaleFactors(float f, float f2) { | ||||
|         this.shiftAmount = f - f2; | ||||
|         this.scaleUpFactor = (f2 * 1.0f) / f; | ||||
|         this.scaleDownFactor = (f * 1.0f) / f2; | ||||
|     } | ||||
|  | ||||
|     private View getIconOrContainer() { | ||||
|         FrameLayout frameLayout = this.iconContainer; | ||||
|         return frameLayout != null ? frameLayout : this.icon; | ||||
|     } | ||||
|  | ||||
|     private boolean hasBadge() { | ||||
|         return this.badgeDrawable != null; | ||||
|     } | ||||
|  | ||||
|     private boolean isActiveIndicatorResizeableAndUnlabeled() { | ||||
|         return this.activeIndicatorResizeable && this.labelVisibilityMode == 2; | ||||
|     } | ||||
|  | ||||
|     public BadgeDrawable getBadge() { | ||||
|         return this.badgeDrawable; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuView.ItemView | ||||
|     public MenuItemImpl getItemData() { | ||||
|         return this.itemData; | ||||
|     } | ||||
|  | ||||
|     protected abstract int getItemLayoutResId(); | ||||
|  | ||||
|     public int getItemPosition() { | ||||
|         return this.itemPosition; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuView.ItemView | ||||
|     public boolean prefersCondensedTitle() { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     public void setActiveIndicatorResizeable(boolean z) { | ||||
|         this.activeIndicatorResizeable = z; | ||||
|     } | ||||
|  | ||||
|     public void setItemPosition(int i) { | ||||
|         this.itemPosition = i; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuView.ItemView | ||||
|     public void setShortcut(boolean z, char c) { | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuView.ItemView | ||||
|     public boolean showsIcon() { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     static { | ||||
|         ACTIVE_INDICATOR_LABELED_TRANSFORM = new ActiveIndicatorTransform(); | ||||
|         ACTIVE_INDICATOR_UNLABELED_TRANSFORM = new ActiveIndicatorUnlabeledTransform(); | ||||
|     } | ||||
|  | ||||
|     public NavigationBarItemView(Context context) { | ||||
|         super(context); | ||||
|         this.initialized = false; | ||||
|         this.itemPosition = -1; | ||||
|         this.activeTextAppearance = 0; | ||||
|         this.activeIndicatorTransform = ACTIVE_INDICATOR_LABELED_TRANSFORM; | ||||
|         this.activeIndicatorProgress = 0.0f; | ||||
|         this.activeIndicatorEnabled = false; | ||||
|         this.activeIndicatorDesiredWidth = 0; | ||||
|         this.activeIndicatorDesiredHeight = 0; | ||||
|         this.activeIndicatorResizeable = false; | ||||
|         this.activeIndicatorMarginHorizontal = 0; | ||||
|         LayoutInflater.from(context).inflate(getItemLayoutResId(), (ViewGroup) this, true); | ||||
|         this.iconContainer = (FrameLayout) findViewById(com.google.android.material.R.id.navigation_bar_item_icon_container); | ||||
|         this.activeIndicatorView = findViewById(com.google.android.material.R.id.navigation_bar_item_active_indicator_view); | ||||
|         ImageView imageView = (ImageView) findViewById(com.google.android.material.R.id.navigation_bar_item_icon_view); | ||||
|         this.icon = imageView; | ||||
|         ViewGroup viewGroup = (ViewGroup) findViewById(com.google.android.material.R.id.navigation_bar_item_labels_group); | ||||
|         this.labelGroup = viewGroup; | ||||
|         TextView textView = (TextView) findViewById(com.google.android.material.R.id.navigation_bar_item_small_label_view); | ||||
|         this.smallLabel = textView; | ||||
|         TextView textView2 = (TextView) findViewById(com.google.android.material.R.id.navigation_bar_item_large_label_view); | ||||
|         this.largeLabel = textView2; | ||||
|         setBackgroundResource(getItemBackgroundResId()); | ||||
|         this.itemPaddingTop = getResources().getDimensionPixelSize(getItemDefaultMarginResId()); | ||||
|         this.itemPaddingBottom = viewGroup.getPaddingBottom(); | ||||
|         this.activeIndicatorLabelPadding = getResources().getDimensionPixelSize(com.google.android.material.R.dimen.m3_navigation_item_active_indicator_label_padding); | ||||
|         ViewCompat.setImportantForAccessibility(textView, 2); | ||||
|         ViewCompat.setImportantForAccessibility(textView2, 2); | ||||
|         setFocusable(true); | ||||
|         calculateTextScaleFactors(textView.getTextSize(), textView2.getTextSize()); | ||||
|         if (imageView != null) { | ||||
|             imageView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { // from class: com.google.android.material.navigation.NavigationBarItemView.1 | ||||
|                 @Override // android.view.View.OnLayoutChangeListener | ||||
|                 public void onLayoutChange(View view, int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8) { | ||||
|                     if (NavigationBarItemView.this.icon.getVisibility() == 0) { | ||||
|                         NavigationBarItemView navigationBarItemView = NavigationBarItemView.this; | ||||
|                         navigationBarItemView.tryUpdateBadgeBounds(navigationBarItemView.icon); | ||||
|                     } | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     protected int getSuggestedMinimumWidth() { | ||||
|         FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.labelGroup.getLayoutParams(); | ||||
|         return Math.max(getSuggestedIconWidth(), layoutParams.leftMargin + this.labelGroup.getMeasuredWidth() + layoutParams.rightMargin); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     protected int getSuggestedMinimumHeight() { | ||||
|         FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.labelGroup.getLayoutParams(); | ||||
|         return getSuggestedIconHeight() + (this.labelGroup.getVisibility() == 0 ? this.activeIndicatorLabelPadding : 0) + layoutParams.topMargin + this.labelGroup.getMeasuredHeight() + layoutParams.bottomMargin; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuView.ItemView | ||||
|     public void initialize(MenuItemImpl menuItemImpl, int i) { | ||||
|         CharSequence title; | ||||
|         this.itemData = menuItemImpl; | ||||
|         setCheckable(menuItemImpl.isCheckable()); | ||||
|         setChecked(menuItemImpl.isChecked()); | ||||
|         setEnabled(menuItemImpl.isEnabled()); | ||||
|         setIcon(menuItemImpl.getIcon()); | ||||
|         setTitle(menuItemImpl.getTitle()); | ||||
|         setId(menuItemImpl.getItemId()); | ||||
|         if (!TextUtils.isEmpty(menuItemImpl.getContentDescription())) { | ||||
|             setContentDescription(menuItemImpl.getContentDescription()); | ||||
|         } | ||||
|         if (!TextUtils.isEmpty(menuItemImpl.getTooltipText())) { | ||||
|             title = menuItemImpl.getTooltipText(); | ||||
|         } else { | ||||
|             title = menuItemImpl.getTitle(); | ||||
|         } | ||||
|         if (Build.VERSION.SDK_INT > 23) { | ||||
|             TooltipCompat.setTooltipText(this, title); | ||||
|         } | ||||
|         setVisibility(menuItemImpl.isVisible() ? 0 : 8); | ||||
|         this.initialized = true; | ||||
|     } | ||||
|  | ||||
|     void clear() { | ||||
|         removeBadge(); | ||||
|         this.itemData = null; | ||||
|         this.activeIndicatorProgress = 0.0f; | ||||
|         this.initialized = false; | ||||
|     } | ||||
|  | ||||
|     public void setShifting(boolean z) { | ||||
|         if (this.isShifting != z) { | ||||
|             this.isShifting = z; | ||||
|             refreshChecked(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setLabelVisibilityMode(int i) { | ||||
|         if (this.labelVisibilityMode != i) { | ||||
|             this.labelVisibilityMode = i; | ||||
|             updateActiveIndicatorTransform(); | ||||
|             updateActiveIndicatorLayoutParams(getWidth()); | ||||
|             refreshChecked(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuView.ItemView | ||||
|     public void setTitle(CharSequence charSequence) { | ||||
|         this.smallLabel.setText(charSequence); | ||||
|         this.largeLabel.setText(charSequence); | ||||
|         MenuItemImpl menuItemImpl = this.itemData; | ||||
|         if (menuItemImpl == null || TextUtils.isEmpty(menuItemImpl.getContentDescription())) { | ||||
|             setContentDescription(charSequence); | ||||
|         } | ||||
|         MenuItemImpl menuItemImpl2 = this.itemData; | ||||
|         if (menuItemImpl2 != null && !TextUtils.isEmpty(menuItemImpl2.getTooltipText())) { | ||||
|             charSequence = this.itemData.getTooltipText(); | ||||
|         } | ||||
|         if (Build.VERSION.SDK_INT > 23) { | ||||
|             TooltipCompat.setTooltipText(this, charSequence); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuView.ItemView | ||||
|     public void setCheckable(boolean z) { | ||||
|         refreshDrawableState(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     protected void onSizeChanged(final int i, int i2, int i3, int i4) { | ||||
|         super.onSizeChanged(i, i2, i3, i4); | ||||
|         post(new Runnable() { // from class: com.google.android.material.navigation.NavigationBarItemView.2 | ||||
|             @Override // java.lang.Runnable | ||||
|             public void run() { | ||||
|                 NavigationBarItemView.this.updateActiveIndicatorLayoutParams(i); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     private void updateActiveIndicatorTransform() { | ||||
|         if (isActiveIndicatorResizeableAndUnlabeled()) { | ||||
|             this.activeIndicatorTransform = ACTIVE_INDICATOR_UNLABELED_TRANSFORM; | ||||
|         } else { | ||||
|             this.activeIndicatorTransform = ACTIVE_INDICATOR_LABELED_TRANSFORM; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public void setActiveIndicatorProgress(float f, float f2) { | ||||
|         View view = this.activeIndicatorView; | ||||
|         if (view != null) { | ||||
|             this.activeIndicatorTransform.updateForProgress(f, f2, view); | ||||
|         } | ||||
|         this.activeIndicatorProgress = f; | ||||
|     } | ||||
|  | ||||
|     private void maybeAnimateActiveIndicatorToProgress(final float f) { | ||||
|         if (!this.activeIndicatorEnabled || !this.initialized || !ViewCompat.isAttachedToWindow(this)) { | ||||
|             setActiveIndicatorProgress(f, f); | ||||
|             return; | ||||
|         } | ||||
|         ValueAnimator valueAnimator = this.activeIndicatorAnimator; | ||||
|         if (valueAnimator != null) { | ||||
|             valueAnimator.cancel(); | ||||
|             this.activeIndicatorAnimator = null; | ||||
|         } | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(this.activeIndicatorProgress, f); | ||||
|         this.activeIndicatorAnimator = ofFloat; | ||||
|         ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.google.android.material.navigation.NavigationBarItemView.3 | ||||
|             @Override // android.animation.ValueAnimator.AnimatorUpdateListener | ||||
|             public void onAnimationUpdate(ValueAnimator valueAnimator2) { | ||||
|                 NavigationBarItemView.this.setActiveIndicatorProgress(((Float) valueAnimator2.getAnimatedValue()).floatValue(), f); | ||||
|             } | ||||
|         }); | ||||
|         this.activeIndicatorAnimator.setInterpolator(MotionUtils.resolveThemeInterpolator(getContext(), com.google.android.material.R.attr.motionEasingEmphasizedInterpolator, AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR)); | ||||
|         this.activeIndicatorAnimator.setDuration(MotionUtils.resolveThemeDuration(getContext(), com.google.android.material.R.attr.motionDurationLong2, getResources().getInteger(com.google.android.material.R.integer.material_motion_duration_long_1))); | ||||
|         this.activeIndicatorAnimator.start(); | ||||
|     } | ||||
|  | ||||
|     private void refreshChecked() { | ||||
|         MenuItemImpl menuItemImpl = this.itemData; | ||||
|         if (menuItemImpl != null) { | ||||
|             setChecked(menuItemImpl.isChecked()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuView.ItemView | ||||
|     public void setChecked(boolean z) { | ||||
|         this.largeLabel.setPivotX(r0.getWidth() / 2); | ||||
|         this.largeLabel.setPivotY(r0.getBaseline()); | ||||
|         this.smallLabel.setPivotX(r0.getWidth() / 2); | ||||
|         this.smallLabel.setPivotY(r0.getBaseline()); | ||||
|         maybeAnimateActiveIndicatorToProgress(z ? 1.0f : 0.0f); | ||||
|         int i = this.labelVisibilityMode; | ||||
|         if (i != -1) { | ||||
|             if (i == 0) { | ||||
|                 if (z) { | ||||
|                     setViewTopMarginAndGravity(getIconOrContainer(), this.itemPaddingTop, 49); | ||||
|                     updateViewPaddingBottom(this.labelGroup, this.itemPaddingBottom); | ||||
|                     this.largeLabel.setVisibility(0); | ||||
|                 } else { | ||||
|                     setViewTopMarginAndGravity(getIconOrContainer(), this.itemPaddingTop, 17); | ||||
|                     updateViewPaddingBottom(this.labelGroup, 0); | ||||
|                     this.largeLabel.setVisibility(4); | ||||
|                 } | ||||
|                 this.smallLabel.setVisibility(4); | ||||
|             } else if (i == 1) { | ||||
|                 updateViewPaddingBottom(this.labelGroup, this.itemPaddingBottom); | ||||
|                 if (z) { | ||||
|                     setViewTopMarginAndGravity(getIconOrContainer(), (int) (this.itemPaddingTop + this.shiftAmount), 49); | ||||
|                     setViewScaleValues(this.largeLabel, 1.0f, 1.0f, 0); | ||||
|                     TextView textView = this.smallLabel; | ||||
|                     float f = this.scaleUpFactor; | ||||
|                     setViewScaleValues(textView, f, f, 4); | ||||
|                 } else { | ||||
|                     setViewTopMarginAndGravity(getIconOrContainer(), this.itemPaddingTop, 49); | ||||
|                     TextView textView2 = this.largeLabel; | ||||
|                     float f2 = this.scaleDownFactor; | ||||
|                     setViewScaleValues(textView2, f2, f2, 4); | ||||
|                     setViewScaleValues(this.smallLabel, 1.0f, 1.0f, 0); | ||||
|                 } | ||||
|             } else if (i == 2) { | ||||
|                 setViewTopMarginAndGravity(getIconOrContainer(), this.itemPaddingTop, 17); | ||||
|                 this.largeLabel.setVisibility(8); | ||||
|                 this.smallLabel.setVisibility(8); | ||||
|             } | ||||
|         } else if (this.isShifting) { | ||||
|             if (z) { | ||||
|                 setViewTopMarginAndGravity(getIconOrContainer(), this.itemPaddingTop, 49); | ||||
|                 updateViewPaddingBottom(this.labelGroup, this.itemPaddingBottom); | ||||
|                 this.largeLabel.setVisibility(0); | ||||
|             } else { | ||||
|                 setViewTopMarginAndGravity(getIconOrContainer(), this.itemPaddingTop, 17); | ||||
|                 updateViewPaddingBottom(this.labelGroup, 0); | ||||
|                 this.largeLabel.setVisibility(4); | ||||
|             } | ||||
|             this.smallLabel.setVisibility(4); | ||||
|         } else { | ||||
|             updateViewPaddingBottom(this.labelGroup, this.itemPaddingBottom); | ||||
|             if (z) { | ||||
|                 setViewTopMarginAndGravity(getIconOrContainer(), (int) (this.itemPaddingTop + this.shiftAmount), 49); | ||||
|                 setViewScaleValues(this.largeLabel, 1.0f, 1.0f, 0); | ||||
|                 TextView textView3 = this.smallLabel; | ||||
|                 float f3 = this.scaleUpFactor; | ||||
|                 setViewScaleValues(textView3, f3, f3, 4); | ||||
|             } else { | ||||
|                 setViewTopMarginAndGravity(getIconOrContainer(), this.itemPaddingTop, 49); | ||||
|                 TextView textView4 = this.largeLabel; | ||||
|                 float f4 = this.scaleDownFactor; | ||||
|                 setViewScaleValues(textView4, f4, f4, 4); | ||||
|                 setViewScaleValues(this.smallLabel, 1.0f, 1.0f, 0); | ||||
|             } | ||||
|         } | ||||
|         refreshDrawableState(); | ||||
|         setSelected(z); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) { | ||||
|         super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo); | ||||
|         BadgeDrawable badgeDrawable = this.badgeDrawable; | ||||
|         if (badgeDrawable != null && badgeDrawable.isVisible()) { | ||||
|             CharSequence title = this.itemData.getTitle(); | ||||
|             if (!TextUtils.isEmpty(this.itemData.getContentDescription())) { | ||||
|                 title = this.itemData.getContentDescription(); | ||||
|             } | ||||
|             accessibilityNodeInfo.setContentDescription(((Object) title) + ", " + ((Object) this.badgeDrawable.getContentDescription())); | ||||
|         } | ||||
|         AccessibilityNodeInfoCompat wrap = AccessibilityNodeInfoCompat.wrap(accessibilityNodeInfo); | ||||
|         wrap.setCollectionItemInfo(AccessibilityNodeInfoCompat.CollectionItemInfoCompat.obtain(0, 1, getItemVisiblePosition(), 1, false, isSelected())); | ||||
|         if (isSelected()) { | ||||
|             wrap.setClickable(false); | ||||
|             wrap.removeAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_CLICK); | ||||
|         } | ||||
|         wrap.setRoleDescription(getResources().getString(com.google.android.material.R.string.item_view_role_description)); | ||||
|     } | ||||
|  | ||||
|     private int getItemVisiblePosition() { | ||||
|         ViewGroup viewGroup = (ViewGroup) getParent(); | ||||
|         int indexOfChild = viewGroup.indexOfChild(this); | ||||
|         int i = 0; | ||||
|         for (int i2 = 0; i2 < indexOfChild; i2++) { | ||||
|             View childAt = viewGroup.getChildAt(i2); | ||||
|             if ((childAt instanceof NavigationBarItemView) && childAt.getVisibility() == 0) { | ||||
|                 i++; | ||||
|             } | ||||
|         } | ||||
|         return i; | ||||
|     } | ||||
|  | ||||
|     private static void setViewTopMarginAndGravity(View view, int i, int i2) { | ||||
|         FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams(); | ||||
|         layoutParams.topMargin = i; | ||||
|         layoutParams.bottomMargin = i; | ||||
|         layoutParams.gravity = i2; | ||||
|         view.setLayoutParams(layoutParams); | ||||
|     } | ||||
|  | ||||
|     private static void setViewScaleValues(View view, float f, float f2, int i) { | ||||
|         view.setScaleX(f); | ||||
|         view.setScaleY(f2); | ||||
|         view.setVisibility(i); | ||||
|     } | ||||
|  | ||||
|     private static void updateViewPaddingBottom(View view, int i) { | ||||
|         view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), i); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View, androidx.appcompat.view.menu.MenuView.ItemView | ||||
|     public void setEnabled(boolean z) { | ||||
|         super.setEnabled(z); | ||||
|         this.smallLabel.setEnabled(z); | ||||
|         this.largeLabel.setEnabled(z); | ||||
|         this.icon.setEnabled(z); | ||||
|         if (z) { | ||||
|             ViewCompat.setPointerIcon(this, PointerIconCompat.getSystemIcon(getContext(), PointerIconCompat.TYPE_HAND)); | ||||
|         } else { | ||||
|             ViewCompat.setPointerIcon(this, null); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.ViewGroup, android.view.View | ||||
|     public int[] onCreateDrawableState(int i) { | ||||
|         int[] onCreateDrawableState = super.onCreateDrawableState(i + 1); | ||||
|         MenuItemImpl menuItemImpl = this.itemData; | ||||
|         if (menuItemImpl != null && menuItemImpl.isCheckable() && this.itemData.isChecked()) { | ||||
|             mergeDrawableStates(onCreateDrawableState, CHECKED_STATE_SET); | ||||
|         } | ||||
|         return onCreateDrawableState; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuView.ItemView | ||||
|     public void setIcon(Drawable drawable) { | ||||
|         if (drawable == this.originalIconDrawable) { | ||||
|             return; | ||||
|         } | ||||
|         this.originalIconDrawable = drawable; | ||||
|         if (drawable != null) { | ||||
|             Drawable.ConstantState constantState = drawable.getConstantState(); | ||||
|             if (constantState != null) { | ||||
|                 drawable = constantState.newDrawable(); | ||||
|             } | ||||
|             drawable = DrawableCompat.wrap(drawable).mutate(); | ||||
|             this.wrappedIconDrawable = drawable; | ||||
|             ColorStateList colorStateList = this.iconTint; | ||||
|             if (colorStateList != null) { | ||||
|                 DrawableCompat.setTintList(drawable, colorStateList); | ||||
|             } | ||||
|         } | ||||
|         this.icon.setImageDrawable(drawable); | ||||
|     } | ||||
|  | ||||
|     public void setIconTintList(ColorStateList colorStateList) { | ||||
|         Drawable drawable; | ||||
|         this.iconTint = colorStateList; | ||||
|         if (this.itemData == null || (drawable = this.wrappedIconDrawable) == null) { | ||||
|             return; | ||||
|         } | ||||
|         DrawableCompat.setTintList(drawable, colorStateList); | ||||
|         this.wrappedIconDrawable.invalidateSelf(); | ||||
|     } | ||||
|  | ||||
|     public void setIconSize(int i) { | ||||
|         FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.icon.getLayoutParams(); | ||||
|         layoutParams.width = i; | ||||
|         layoutParams.height = i; | ||||
|         this.icon.setLayoutParams(layoutParams); | ||||
|     } | ||||
|  | ||||
|     public void setTextAppearanceInactive(int i) { | ||||
|         setTextAppearanceWithoutFontScaling(this.smallLabel, i); | ||||
|         calculateTextScaleFactors(this.smallLabel.getTextSize(), this.largeLabel.getTextSize()); | ||||
|     } | ||||
|  | ||||
|     public void setTextAppearanceActive(int i) { | ||||
|         this.activeTextAppearance = i; | ||||
|         setTextAppearanceWithoutFontScaling(this.largeLabel, i); | ||||
|         calculateTextScaleFactors(this.smallLabel.getTextSize(), this.largeLabel.getTextSize()); | ||||
|     } | ||||
|  | ||||
|     public void setTextAppearanceActiveBoldEnabled(boolean z) { | ||||
|         setTextAppearanceActive(this.activeTextAppearance); | ||||
|         TextView textView = this.largeLabel; | ||||
|         textView.setTypeface(textView.getTypeface(), z ? 1 : 0); | ||||
|     } | ||||
|  | ||||
|     private static void setTextAppearanceWithoutFontScaling(TextView textView, int i) { | ||||
|         TextViewCompat.setTextAppearance(textView, i); | ||||
|         int unscaledTextSize = MaterialResources.getUnscaledTextSize(textView.getContext(), i, 0); | ||||
|         if (unscaledTextSize != 0) { | ||||
|             textView.setTextSize(0, unscaledTextSize); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setTextColor(ColorStateList colorStateList) { | ||||
|         if (colorStateList != null) { | ||||
|             this.smallLabel.setTextColor(colorStateList); | ||||
|             this.largeLabel.setTextColor(colorStateList); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemBackground(int i) { | ||||
|         setItemBackground(i == 0 ? null : ContextCompat.getDrawable(getContext(), i)); | ||||
|     } | ||||
|  | ||||
|     public void setItemBackground(Drawable drawable) { | ||||
|         if (drawable != null && drawable.getConstantState() != null) { | ||||
|             drawable = drawable.getConstantState().newDrawable().mutate(); | ||||
|         } | ||||
|         this.itemBackground = drawable; | ||||
|         refreshItemBackground(); | ||||
|     } | ||||
|  | ||||
|     public void setItemRippleColor(ColorStateList colorStateList) { | ||||
|         this.itemRippleColor = colorStateList; | ||||
|         refreshItemBackground(); | ||||
|     } | ||||
|  | ||||
|     private void refreshItemBackground() { | ||||
|         Drawable drawable = this.itemBackground; | ||||
|         RippleDrawable rippleDrawable = null; | ||||
|         boolean z = true; | ||||
|         if (this.itemRippleColor != null) { | ||||
|             Drawable activeIndicatorDrawable = getActiveIndicatorDrawable(); | ||||
|             if (this.activeIndicatorEnabled && getActiveIndicatorDrawable() != null && this.iconContainer != null && activeIndicatorDrawable != null) { | ||||
|                 rippleDrawable = new RippleDrawable(RippleUtils.sanitizeRippleDrawableColor(this.itemRippleColor), null, activeIndicatorDrawable); | ||||
|                 z = false; | ||||
|             } else if (drawable == null) { | ||||
|                 drawable = createItemBackgroundCompat(this.itemRippleColor); | ||||
|             } | ||||
|         } | ||||
|         FrameLayout frameLayout = this.iconContainer; | ||||
|         if (frameLayout != null) { | ||||
|             frameLayout.setPadding(0, 0, 0, 0); | ||||
|             this.iconContainer.setForeground(rippleDrawable); | ||||
|         } | ||||
|         ViewCompat.setBackground(this, drawable); | ||||
|         if (Build.VERSION.SDK_INT >= 26) { | ||||
|             setDefaultFocusHighlightEnabled(z); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static Drawable createItemBackgroundCompat(ColorStateList colorStateList) { | ||||
|         return new RippleDrawable(RippleUtils.convertToRippleDrawableColor(colorStateList), null, null); | ||||
|     } | ||||
|  | ||||
|     public void setItemPaddingTop(int i) { | ||||
|         if (this.itemPaddingTop != i) { | ||||
|             this.itemPaddingTop = i; | ||||
|             refreshChecked(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemPaddingBottom(int i) { | ||||
|         if (this.itemPaddingBottom != i) { | ||||
|             this.itemPaddingBottom = i; | ||||
|             refreshChecked(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setActiveIndicatorLabelPadding(int i) { | ||||
|         if (this.activeIndicatorLabelPadding != i) { | ||||
|             this.activeIndicatorLabelPadding = i; | ||||
|             refreshChecked(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setActiveIndicatorEnabled(boolean z) { | ||||
|         this.activeIndicatorEnabled = z; | ||||
|         refreshItemBackground(); | ||||
|         View view = this.activeIndicatorView; | ||||
|         if (view != null) { | ||||
|             view.setVisibility(z ? 0 : 8); | ||||
|             requestLayout(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setActiveIndicatorWidth(int i) { | ||||
|         this.activeIndicatorDesiredWidth = i; | ||||
|         updateActiveIndicatorLayoutParams(getWidth()); | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public void updateActiveIndicatorLayoutParams(int i) { | ||||
|         if (this.activeIndicatorView == null || i <= 0) { | ||||
|             return; | ||||
|         } | ||||
|         int min = Math.min(this.activeIndicatorDesiredWidth, i - (this.activeIndicatorMarginHorizontal * 2)); | ||||
|         FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.activeIndicatorView.getLayoutParams(); | ||||
|         layoutParams.height = isActiveIndicatorResizeableAndUnlabeled() ? min : this.activeIndicatorDesiredHeight; | ||||
|         layoutParams.width = min; | ||||
|         this.activeIndicatorView.setLayoutParams(layoutParams); | ||||
|     } | ||||
|  | ||||
|     public void setActiveIndicatorHeight(int i) { | ||||
|         this.activeIndicatorDesiredHeight = i; | ||||
|         updateActiveIndicatorLayoutParams(getWidth()); | ||||
|     } | ||||
|  | ||||
|     public void setActiveIndicatorMarginHorizontal(int i) { | ||||
|         this.activeIndicatorMarginHorizontal = i; | ||||
|         updateActiveIndicatorLayoutParams(getWidth()); | ||||
|     } | ||||
|  | ||||
|     public Drawable getActiveIndicatorDrawable() { | ||||
|         View view = this.activeIndicatorView; | ||||
|         if (view == null) { | ||||
|             return null; | ||||
|         } | ||||
|         return view.getBackground(); | ||||
|     } | ||||
|  | ||||
|     public void setActiveIndicatorDrawable(Drawable drawable) { | ||||
|         View view = this.activeIndicatorView; | ||||
|         if (view == null) { | ||||
|             return; | ||||
|         } | ||||
|         view.setBackgroundDrawable(drawable); | ||||
|         refreshItemBackground(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.ViewGroup, android.view.View | ||||
|     public boolean dispatchTouchEvent(MotionEvent motionEvent) { | ||||
|         FrameLayout frameLayout = this.iconContainer; | ||||
|         if (frameLayout != null && this.activeIndicatorEnabled) { | ||||
|             frameLayout.dispatchTouchEvent(motionEvent); | ||||
|         } | ||||
|         return super.dispatchTouchEvent(motionEvent); | ||||
|     } | ||||
|  | ||||
|     void setBadge(BadgeDrawable badgeDrawable) { | ||||
|         if (this.badgeDrawable == badgeDrawable) { | ||||
|             return; | ||||
|         } | ||||
|         if (hasBadge() && this.icon != null) { | ||||
|             Log.w("NavigationBar", "Multiple badges shouldn't be attached to one item."); | ||||
|             tryRemoveBadgeFromAnchor(this.icon); | ||||
|         } | ||||
|         this.badgeDrawable = badgeDrawable; | ||||
|         ImageView imageView = this.icon; | ||||
|         if (imageView != null) { | ||||
|             tryAttachBadgeToAnchor(imageView); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void removeBadge() { | ||||
|         tryRemoveBadgeFromAnchor(this.icon); | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public void tryUpdateBadgeBounds(View view) { | ||||
|         if (hasBadge()) { | ||||
|             BadgeUtils.setBadgeDrawableBounds(this.badgeDrawable, view, getCustomParentForBadge(view)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void tryAttachBadgeToAnchor(View view) { | ||||
|         if (hasBadge() && view != null) { | ||||
|             setClipChildren(false); | ||||
|             setClipToPadding(false); | ||||
|             BadgeUtils.attachBadgeDrawable(this.badgeDrawable, view, getCustomParentForBadge(view)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void tryRemoveBadgeFromAnchor(View view) { | ||||
|         if (hasBadge()) { | ||||
|             if (view != null) { | ||||
|                 setClipChildren(true); | ||||
|                 setClipToPadding(true); | ||||
|                 BadgeUtils.detachBadgeDrawable(this.badgeDrawable, view); | ||||
|             } | ||||
|             this.badgeDrawable = null; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private FrameLayout getCustomParentForBadge(View view) { | ||||
|         if (view == this.icon && BadgeUtils.USE_COMPAT_PARENT) { | ||||
|             return (FrameLayout) this.icon.getParent(); | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     private int getSuggestedIconWidth() { | ||||
|         BadgeDrawable badgeDrawable = this.badgeDrawable; | ||||
|         int minimumWidth = badgeDrawable == null ? 0 : badgeDrawable.getMinimumWidth() - this.badgeDrawable.getHorizontalOffset(); | ||||
|         FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) getIconOrContainer().getLayoutParams(); | ||||
|         return Math.max(minimumWidth, layoutParams.leftMargin) + this.icon.getMeasuredWidth() + Math.max(minimumWidth, layoutParams.rightMargin); | ||||
|     } | ||||
|  | ||||
|     private int getSuggestedIconHeight() { | ||||
|         return ((FrameLayout.LayoutParams) getIconOrContainer().getLayoutParams()).topMargin + getIconOrContainer().getMeasuredHeight(); | ||||
|     } | ||||
|  | ||||
|     protected int getItemBackgroundResId() { | ||||
|         return com.google.android.material.R.drawable.mtrl_navigation_bar_item_background; | ||||
|     } | ||||
|  | ||||
|     protected int getItemDefaultMarginResId() { | ||||
|         return com.google.android.material.R.dimen.mtrl_navigation_bar_item_default_margin; | ||||
|     } | ||||
|  | ||||
|     private static class ActiveIndicatorTransform { | ||||
|         private static final float ALPHA_FRACTION = 0.2f; | ||||
|         private static final float SCALE_X_HIDDEN = 0.4f; | ||||
|         private static final float SCALE_X_SHOWN = 1.0f; | ||||
|  | ||||
|         protected float calculateScaleY(float f, float f2) { | ||||
|             return 1.0f; | ||||
|         } | ||||
|  | ||||
|         private ActiveIndicatorTransform() { | ||||
|         } | ||||
|  | ||||
|         protected float calculateAlpha(float f, float f2) { | ||||
|             return AnimationUtils.lerp(0.0f, 1.0f, f2 == 0.0f ? 0.8f : 0.0f, f2 == 0.0f ? 1.0f : 0.2f, f); | ||||
|         } | ||||
|  | ||||
|         protected float calculateScaleX(float f, float f2) { | ||||
|             return AnimationUtils.lerp(SCALE_X_HIDDEN, 1.0f, f); | ||||
|         } | ||||
|  | ||||
|         public void updateForProgress(float f, float f2, View view) { | ||||
|             view.setScaleX(calculateScaleX(f, f2)); | ||||
|             view.setScaleY(calculateScaleY(f, f2)); | ||||
|             view.setAlpha(calculateAlpha(f, f2)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static class ActiveIndicatorUnlabeledTransform extends ActiveIndicatorTransform { | ||||
|         private ActiveIndicatorUnlabeledTransform() { | ||||
|             super(); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.navigation.NavigationBarItemView.ActiveIndicatorTransform | ||||
|         protected float calculateScaleY(float f, float f2) { | ||||
|             return calculateScaleX(f, f2); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,43 @@ | ||||
| package com.google.android.material.navigation; | ||||
|  | ||||
| import android.content.Context; | ||||
| import android.view.MenuItem; | ||||
| import android.view.SubMenu; | ||||
| import androidx.appcompat.view.menu.MenuBuilder; | ||||
| import androidx.appcompat.view.menu.MenuItemImpl; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public final class NavigationBarMenu extends MenuBuilder { | ||||
|     private final int maxItemCount; | ||||
|     private final Class<?> viewClass; | ||||
|  | ||||
|     public int getMaxItemCount() { | ||||
|         return this.maxItemCount; | ||||
|     } | ||||
|  | ||||
|     public NavigationBarMenu(Context context, Class<?> cls, int i) { | ||||
|         super(context); | ||||
|         this.viewClass = cls; | ||||
|         this.maxItemCount = i; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuBuilder, android.view.Menu | ||||
|     public SubMenu addSubMenu(int i, int i2, int i3, CharSequence charSequence) { | ||||
|         throw new UnsupportedOperationException(this.viewClass.getSimpleName() + " does not support submenus"); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuBuilder | ||||
|     protected MenuItem addInternal(int i, int i2, int i3, CharSequence charSequence) { | ||||
|         if (size() + 1 > this.maxItemCount) { | ||||
|             String simpleName = this.viewClass.getSimpleName(); | ||||
|             throw new IllegalArgumentException("Maximum number of items supported by " + simpleName + " is " + this.maxItemCount + ". Limit can be checked with " + simpleName + "#getMaxItemCount()"); | ||||
|         } | ||||
|         stopDispatchingItemsChanged(); | ||||
|         MenuItem addInternal = super.addInternal(i, i2, i3, charSequence); | ||||
|         if (addInternal instanceof MenuItemImpl) { | ||||
|             ((MenuItemImpl) addInternal).setExclusiveCheckable(true); | ||||
|         } | ||||
|         startDispatchingItemsChanged(); | ||||
|         return addInternal; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,691 @@ | ||||
| package com.google.android.material.navigation; | ||||
|  | ||||
| import android.R; | ||||
| import android.content.Context; | ||||
| import android.content.res.ColorStateList; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.util.SparseArray; | ||||
| import android.util.TypedValue; | ||||
| import android.view.MenuItem; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.view.accessibility.AccessibilityNodeInfo; | ||||
| import androidx.appcompat.content.res.AppCompatResources; | ||||
| import androidx.appcompat.view.menu.MenuBuilder; | ||||
| import androidx.appcompat.view.menu.MenuItemImpl; | ||||
| import androidx.appcompat.view.menu.MenuView; | ||||
| import androidx.core.util.Pools; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; | ||||
| import androidx.transition.AutoTransition; | ||||
| import androidx.transition.TransitionManager; | ||||
| import androidx.transition.TransitionSet; | ||||
| import com.google.android.material.animation.AnimationUtils; | ||||
| import com.google.android.material.badge.BadgeDrawable; | ||||
| import com.google.android.material.internal.TextScale; | ||||
| import com.google.android.material.motion.MotionUtils; | ||||
| import com.google.android.material.shape.MaterialShapeDrawable; | ||||
| import com.google.android.material.shape.ShapeAppearanceModel; | ||||
| import java.util.HashSet; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public abstract class NavigationBarMenuView extends ViewGroup implements MenuView { | ||||
|     private static final int[] CHECKED_STATE_SET = {R.attr.state_checked}; | ||||
|     private static final int[] DISABLED_STATE_SET = {-16842910}; | ||||
|     private static final int ITEM_POOL_SIZE = 5; | ||||
|     private static final int NO_PADDING = -1; | ||||
|     private final SparseArray<BadgeDrawable> badgeDrawables; | ||||
|     private NavigationBarItemView[] buttons; | ||||
|     private ColorStateList itemActiveIndicatorColor; | ||||
|     private boolean itemActiveIndicatorEnabled; | ||||
|     private int itemActiveIndicatorHeight; | ||||
|     private int itemActiveIndicatorLabelPadding; | ||||
|     private int itemActiveIndicatorMarginHorizontal; | ||||
|     private boolean itemActiveIndicatorResizeable; | ||||
|     private ShapeAppearanceModel itemActiveIndicatorShapeAppearance; | ||||
|     private int itemActiveIndicatorWidth; | ||||
|     private Drawable itemBackground; | ||||
|     private int itemBackgroundRes; | ||||
|     private int itemIconSize; | ||||
|     private ColorStateList itemIconTint; | ||||
|     private int itemPaddingBottom; | ||||
|     private int itemPaddingTop; | ||||
|     private final Pools.Pool<NavigationBarItemView> itemPool; | ||||
|     private ColorStateList itemRippleColor; | ||||
|     private int itemTextAppearanceActive; | ||||
|     private boolean itemTextAppearanceActiveBoldEnabled; | ||||
|     private int itemTextAppearanceInactive; | ||||
|     private final ColorStateList itemTextColorDefault; | ||||
|     private ColorStateList itemTextColorFromUser; | ||||
|     private int labelVisibilityMode; | ||||
|     private MenuBuilder menu; | ||||
|     private final View.OnClickListener onClickListener; | ||||
|     private final SparseArray<View.OnTouchListener> onTouchListeners; | ||||
|     private NavigationBarPresenter presenter; | ||||
|     private int selectedItemId; | ||||
|     private int selectedItemPosition; | ||||
|     private final TransitionSet set; | ||||
|  | ||||
|     private boolean isValidId(int i) { | ||||
|         return i != -1; | ||||
|     } | ||||
|  | ||||
|     protected abstract NavigationBarItemView createNavigationBarItemView(Context context); | ||||
|  | ||||
|     public int getActiveIndicatorLabelPadding() { | ||||
|         return this.itemActiveIndicatorLabelPadding; | ||||
|     } | ||||
|  | ||||
|     SparseArray<BadgeDrawable> getBadgeDrawables() { | ||||
|         return this.badgeDrawables; | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getIconTintList() { | ||||
|         return this.itemIconTint; | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getItemActiveIndicatorColor() { | ||||
|         return this.itemActiveIndicatorColor; | ||||
|     } | ||||
|  | ||||
|     public boolean getItemActiveIndicatorEnabled() { | ||||
|         return this.itemActiveIndicatorEnabled; | ||||
|     } | ||||
|  | ||||
|     public int getItemActiveIndicatorHeight() { | ||||
|         return this.itemActiveIndicatorHeight; | ||||
|     } | ||||
|  | ||||
|     public int getItemActiveIndicatorMarginHorizontal() { | ||||
|         return this.itemActiveIndicatorMarginHorizontal; | ||||
|     } | ||||
|  | ||||
|     public ShapeAppearanceModel getItemActiveIndicatorShapeAppearance() { | ||||
|         return this.itemActiveIndicatorShapeAppearance; | ||||
|     } | ||||
|  | ||||
|     public int getItemActiveIndicatorWidth() { | ||||
|         return this.itemActiveIndicatorWidth; | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public int getItemBackgroundRes() { | ||||
|         return this.itemBackgroundRes; | ||||
|     } | ||||
|  | ||||
|     public int getItemIconSize() { | ||||
|         return this.itemIconSize; | ||||
|     } | ||||
|  | ||||
|     public int getItemPaddingBottom() { | ||||
|         return this.itemPaddingBottom; | ||||
|     } | ||||
|  | ||||
|     public int getItemPaddingTop() { | ||||
|         return this.itemPaddingTop; | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getItemRippleColor() { | ||||
|         return this.itemRippleColor; | ||||
|     } | ||||
|  | ||||
|     public int getItemTextAppearanceActive() { | ||||
|         return this.itemTextAppearanceActive; | ||||
|     } | ||||
|  | ||||
|     public int getItemTextAppearanceInactive() { | ||||
|         return this.itemTextAppearanceInactive; | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getItemTextColor() { | ||||
|         return this.itemTextColorFromUser; | ||||
|     } | ||||
|  | ||||
|     public int getLabelVisibilityMode() { | ||||
|         return this.labelVisibilityMode; | ||||
|     } | ||||
|  | ||||
|     protected MenuBuilder getMenu() { | ||||
|         return this.menu; | ||||
|     } | ||||
|  | ||||
|     public int getSelectedItemId() { | ||||
|         return this.selectedItemId; | ||||
|     } | ||||
|  | ||||
|     protected int getSelectedItemPosition() { | ||||
|         return this.selectedItemPosition; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuView | ||||
|     public int getWindowAnimations() { | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuView | ||||
|     public void initialize(MenuBuilder menuBuilder) { | ||||
|         this.menu = menuBuilder; | ||||
|     } | ||||
|  | ||||
|     protected boolean isItemActiveIndicatorResizeable() { | ||||
|         return this.itemActiveIndicatorResizeable; | ||||
|     } | ||||
|  | ||||
|     protected boolean isShifting(int i, int i2) { | ||||
|         if (i == -1) { | ||||
|             if (i2 > 3) { | ||||
|                 return true; | ||||
|             } | ||||
|         } else if (i == 0) { | ||||
|             return true; | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     public void setLabelVisibilityMode(int i) { | ||||
|         this.labelVisibilityMode = i; | ||||
|     } | ||||
|  | ||||
|     public void setPresenter(NavigationBarPresenter navigationBarPresenter) { | ||||
|         this.presenter = navigationBarPresenter; | ||||
|     } | ||||
|  | ||||
|     public NavigationBarMenuView(Context context) { | ||||
|         super(context); | ||||
|         this.itemPool = new Pools.SynchronizedPool(5); | ||||
|         this.onTouchListeners = new SparseArray<>(5); | ||||
|         this.selectedItemId = 0; | ||||
|         this.selectedItemPosition = 0; | ||||
|         this.badgeDrawables = new SparseArray<>(5); | ||||
|         this.itemPaddingTop = -1; | ||||
|         this.itemPaddingBottom = -1; | ||||
|         this.itemActiveIndicatorLabelPadding = -1; | ||||
|         this.itemActiveIndicatorResizeable = false; | ||||
|         this.itemTextColorDefault = createDefaultColorStateList(R.attr.textColorSecondary); | ||||
|         if (isInEditMode()) { | ||||
|             this.set = null; | ||||
|         } else { | ||||
|             AutoTransition autoTransition = new AutoTransition(); | ||||
|             this.set = autoTransition; | ||||
|             autoTransition.setOrdering(0); | ||||
|             autoTransition.setDuration(MotionUtils.resolveThemeDuration(getContext(), com.google.android.material.R.attr.motionDurationMedium4, getResources().getInteger(com.google.android.material.R.integer.material_motion_duration_long_1))); | ||||
|             autoTransition.setInterpolator(MotionUtils.resolveThemeInterpolator(getContext(), com.google.android.material.R.attr.motionEasingStandard, AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR)); | ||||
|             autoTransition.addTransition(new TextScale()); | ||||
|         } | ||||
|         this.onClickListener = new View.OnClickListener() { // from class: com.google.android.material.navigation.NavigationBarMenuView.1 | ||||
|             @Override // android.view.View.OnClickListener | ||||
|             public void onClick(View view) { | ||||
|                 MenuItemImpl itemData = ((NavigationBarItemView) view).getItemData(); | ||||
|                 if (NavigationBarMenuView.this.menu.performItemAction(itemData, NavigationBarMenuView.this.presenter, 0)) { | ||||
|                     return; | ||||
|                 } | ||||
|                 itemData.setChecked(true); | ||||
|             } | ||||
|         }; | ||||
|         ViewCompat.setImportantForAccessibility(this, 1); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) { | ||||
|         super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo); | ||||
|         AccessibilityNodeInfoCompat.wrap(accessibilityNodeInfo).setCollectionInfo(AccessibilityNodeInfoCompat.CollectionInfoCompat.obtain(1, this.menu.getVisibleItems().size(), false, 1)); | ||||
|     } | ||||
|  | ||||
|     public void setIconTintList(ColorStateList colorStateList) { | ||||
|         this.itemIconTint = colorStateList; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setIconTintList(colorStateList); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemIconSize(int i) { | ||||
|         this.itemIconSize = i; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setIconSize(i); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemTextColor(ColorStateList colorStateList) { | ||||
|         this.itemTextColorFromUser = colorStateList; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setTextColor(colorStateList); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemTextAppearanceInactive(int i) { | ||||
|         this.itemTextAppearanceInactive = i; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setTextAppearanceInactive(i); | ||||
|                 ColorStateList colorStateList = this.itemTextColorFromUser; | ||||
|                 if (colorStateList != null) { | ||||
|                     navigationBarItemView.setTextColor(colorStateList); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemTextAppearanceActive(int i) { | ||||
|         this.itemTextAppearanceActive = i; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setTextAppearanceActive(i); | ||||
|                 ColorStateList colorStateList = this.itemTextColorFromUser; | ||||
|                 if (colorStateList != null) { | ||||
|                     navigationBarItemView.setTextColor(colorStateList); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemTextAppearanceActiveBoldEnabled(boolean z) { | ||||
|         this.itemTextAppearanceActiveBoldEnabled = z; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setTextAppearanceActiveBoldEnabled(z); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemBackgroundRes(int i) { | ||||
|         this.itemBackgroundRes = i; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setItemBackground(i); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemPaddingTop(int i) { | ||||
|         this.itemPaddingTop = i; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setItemPaddingTop(i); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemPaddingBottom(int i) { | ||||
|         this.itemPaddingBottom = i; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setItemPaddingBottom(i); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setActiveIndicatorLabelPadding(int i) { | ||||
|         this.itemActiveIndicatorLabelPadding = i; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setActiveIndicatorLabelPadding(i); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemActiveIndicatorEnabled(boolean z) { | ||||
|         this.itemActiveIndicatorEnabled = z; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setActiveIndicatorEnabled(z); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemActiveIndicatorWidth(int i) { | ||||
|         this.itemActiveIndicatorWidth = i; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setActiveIndicatorWidth(i); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemActiveIndicatorHeight(int i) { | ||||
|         this.itemActiveIndicatorHeight = i; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setActiveIndicatorHeight(i); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemActiveIndicatorMarginHorizontal(int i) { | ||||
|         this.itemActiveIndicatorMarginHorizontal = i; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setActiveIndicatorMarginHorizontal(i); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemActiveIndicatorShapeAppearance(ShapeAppearanceModel shapeAppearanceModel) { | ||||
|         this.itemActiveIndicatorShapeAppearance = shapeAppearanceModel; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setActiveIndicatorDrawable(createItemActiveIndicatorDrawable()); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     protected void setItemActiveIndicatorResizeable(boolean z) { | ||||
|         this.itemActiveIndicatorResizeable = z; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setActiveIndicatorResizeable(z); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemActiveIndicatorColor(ColorStateList colorStateList) { | ||||
|         this.itemActiveIndicatorColor = colorStateList; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setActiveIndicatorDrawable(createItemActiveIndicatorDrawable()); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private Drawable createItemActiveIndicatorDrawable() { | ||||
|         if (this.itemActiveIndicatorShapeAppearance == null || this.itemActiveIndicatorColor == null) { | ||||
|             return null; | ||||
|         } | ||||
|         MaterialShapeDrawable materialShapeDrawable = new MaterialShapeDrawable(this.itemActiveIndicatorShapeAppearance); | ||||
|         materialShapeDrawable.setFillColor(this.itemActiveIndicatorColor); | ||||
|         return materialShapeDrawable; | ||||
|     } | ||||
|  | ||||
|     public void setItemBackground(Drawable drawable) { | ||||
|         this.itemBackground = drawable; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setItemBackground(drawable); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setItemRippleColor(ColorStateList colorStateList) { | ||||
|         this.itemRippleColor = colorStateList; | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 navigationBarItemView.setItemRippleColor(colorStateList); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public Drawable getItemBackground() { | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         return (navigationBarItemViewArr == null || navigationBarItemViewArr.length <= 0) ? this.itemBackground : navigationBarItemViewArr[0].getBackground(); | ||||
|     } | ||||
|  | ||||
|     public void setItemOnTouchListener(int i, View.OnTouchListener onTouchListener) { | ||||
|         if (onTouchListener == null) { | ||||
|             this.onTouchListeners.remove(i); | ||||
|         } else { | ||||
|             this.onTouchListeners.put(i, onTouchListener); | ||||
|         } | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 if (navigationBarItemView.getItemData().getItemId() == i) { | ||||
|                     navigationBarItemView.setOnTouchListener(onTouchListener); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public ColorStateList createDefaultColorStateList(int i) { | ||||
|         TypedValue typedValue = new TypedValue(); | ||||
|         if (!getContext().getTheme().resolveAttribute(i, typedValue, true)) { | ||||
|             return null; | ||||
|         } | ||||
|         ColorStateList colorStateList = AppCompatResources.getColorStateList(getContext(), typedValue.resourceId); | ||||
|         if (!getContext().getTheme().resolveAttribute(androidx.appcompat.R.attr.colorPrimary, typedValue, true)) { | ||||
|             return null; | ||||
|         } | ||||
|         int i2 = typedValue.data; | ||||
|         int defaultColor = colorStateList.getDefaultColor(); | ||||
|         int[] iArr = DISABLED_STATE_SET; | ||||
|         return new ColorStateList(new int[][]{iArr, CHECKED_STATE_SET, EMPTY_STATE_SET}, new int[]{colorStateList.getColorForState(iArr, defaultColor), i2, defaultColor}); | ||||
|     } | ||||
|  | ||||
|     public void buildMenuView() { | ||||
|         removeAllViews(); | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 if (navigationBarItemView != null) { | ||||
|                     this.itemPool.release(navigationBarItemView); | ||||
|                     navigationBarItemView.clear(); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         if (this.menu.size() == 0) { | ||||
|             this.selectedItemId = 0; | ||||
|             this.selectedItemPosition = 0; | ||||
|             this.buttons = null; | ||||
|             return; | ||||
|         } | ||||
|         removeUnusedBadges(); | ||||
|         this.buttons = new NavigationBarItemView[this.menu.size()]; | ||||
|         boolean isShifting = isShifting(this.labelVisibilityMode, this.menu.getVisibleItems().size()); | ||||
|         for (int i = 0; i < this.menu.size(); i++) { | ||||
|             this.presenter.setUpdateSuspended(true); | ||||
|             this.menu.getItem(i).setCheckable(true); | ||||
|             this.presenter.setUpdateSuspended(false); | ||||
|             NavigationBarItemView newItem = getNewItem(); | ||||
|             this.buttons[i] = newItem; | ||||
|             newItem.setIconTintList(this.itemIconTint); | ||||
|             newItem.setIconSize(this.itemIconSize); | ||||
|             newItem.setTextColor(this.itemTextColorDefault); | ||||
|             newItem.setTextAppearanceInactive(this.itemTextAppearanceInactive); | ||||
|             newItem.setTextAppearanceActive(this.itemTextAppearanceActive); | ||||
|             newItem.setTextAppearanceActiveBoldEnabled(this.itemTextAppearanceActiveBoldEnabled); | ||||
|             newItem.setTextColor(this.itemTextColorFromUser); | ||||
|             int i2 = this.itemPaddingTop; | ||||
|             if (i2 != -1) { | ||||
|                 newItem.setItemPaddingTop(i2); | ||||
|             } | ||||
|             int i3 = this.itemPaddingBottom; | ||||
|             if (i3 != -1) { | ||||
|                 newItem.setItemPaddingBottom(i3); | ||||
|             } | ||||
|             int i4 = this.itemActiveIndicatorLabelPadding; | ||||
|             if (i4 != -1) { | ||||
|                 newItem.setActiveIndicatorLabelPadding(i4); | ||||
|             } | ||||
|             newItem.setActiveIndicatorWidth(this.itemActiveIndicatorWidth); | ||||
|             newItem.setActiveIndicatorHeight(this.itemActiveIndicatorHeight); | ||||
|             newItem.setActiveIndicatorMarginHorizontal(this.itemActiveIndicatorMarginHorizontal); | ||||
|             newItem.setActiveIndicatorDrawable(createItemActiveIndicatorDrawable()); | ||||
|             newItem.setActiveIndicatorResizeable(this.itemActiveIndicatorResizeable); | ||||
|             newItem.setActiveIndicatorEnabled(this.itemActiveIndicatorEnabled); | ||||
|             Drawable drawable = this.itemBackground; | ||||
|             if (drawable != null) { | ||||
|                 newItem.setItemBackground(drawable); | ||||
|             } else { | ||||
|                 newItem.setItemBackground(this.itemBackgroundRes); | ||||
|             } | ||||
|             newItem.setItemRippleColor(this.itemRippleColor); | ||||
|             newItem.setShifting(isShifting); | ||||
|             newItem.setLabelVisibilityMode(this.labelVisibilityMode); | ||||
|             MenuItemImpl menuItemImpl = (MenuItemImpl) this.menu.getItem(i); | ||||
|             newItem.initialize(menuItemImpl, 0); | ||||
|             newItem.setItemPosition(i); | ||||
|             int itemId = menuItemImpl.getItemId(); | ||||
|             newItem.setOnTouchListener(this.onTouchListeners.get(itemId)); | ||||
|             newItem.setOnClickListener(this.onClickListener); | ||||
|             int i5 = this.selectedItemId; | ||||
|             if (i5 != 0 && itemId == i5) { | ||||
|                 this.selectedItemPosition = i; | ||||
|             } | ||||
|             setBadgeIfNeeded(newItem); | ||||
|             addView(newItem); | ||||
|         } | ||||
|         int min = Math.min(this.menu.size() - 1, this.selectedItemPosition); | ||||
|         this.selectedItemPosition = min; | ||||
|         this.menu.getItem(min).setChecked(true); | ||||
|     } | ||||
|  | ||||
|     public void updateMenuView() { | ||||
|         TransitionSet transitionSet; | ||||
|         MenuBuilder menuBuilder = this.menu; | ||||
|         if (menuBuilder == null || this.buttons == null) { | ||||
|             return; | ||||
|         } | ||||
|         int size = menuBuilder.size(); | ||||
|         if (size != this.buttons.length) { | ||||
|             buildMenuView(); | ||||
|             return; | ||||
|         } | ||||
|         int i = this.selectedItemId; | ||||
|         for (int i2 = 0; i2 < size; i2++) { | ||||
|             MenuItem item = this.menu.getItem(i2); | ||||
|             if (item.isChecked()) { | ||||
|                 this.selectedItemId = item.getItemId(); | ||||
|                 this.selectedItemPosition = i2; | ||||
|             } | ||||
|         } | ||||
|         if (i != this.selectedItemId && (transitionSet = this.set) != null) { | ||||
|             TransitionManager.beginDelayedTransition(this, transitionSet); | ||||
|         } | ||||
|         boolean isShifting = isShifting(this.labelVisibilityMode, this.menu.getVisibleItems().size()); | ||||
|         for (int i3 = 0; i3 < size; i3++) { | ||||
|             this.presenter.setUpdateSuspended(true); | ||||
|             this.buttons[i3].setLabelVisibilityMode(this.labelVisibilityMode); | ||||
|             this.buttons[i3].setShifting(isShifting); | ||||
|             this.buttons[i3].initialize((MenuItemImpl) this.menu.getItem(i3), 0); | ||||
|             this.presenter.setUpdateSuspended(false); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private NavigationBarItemView getNewItem() { | ||||
|         NavigationBarItemView acquire = this.itemPool.acquire(); | ||||
|         return acquire == null ? createNavigationBarItemView(getContext()) : acquire; | ||||
|     } | ||||
|  | ||||
|     void tryRestoreSelectedItemId(int i) { | ||||
|         int size = this.menu.size(); | ||||
|         for (int i2 = 0; i2 < size; i2++) { | ||||
|             MenuItem item = this.menu.getItem(i2); | ||||
|             if (i == item.getItemId()) { | ||||
|                 this.selectedItemId = i; | ||||
|                 this.selectedItemPosition = i2; | ||||
|                 item.setChecked(true); | ||||
|                 return; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void restoreBadgeDrawables(SparseArray<BadgeDrawable> sparseArray) { | ||||
|         for (int i = 0; i < sparseArray.size(); i++) { | ||||
|             int keyAt = sparseArray.keyAt(i); | ||||
|             if (this.badgeDrawables.indexOfKey(keyAt) < 0) { | ||||
|                 this.badgeDrawables.append(keyAt, sparseArray.get(keyAt)); | ||||
|             } | ||||
|         } | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr != null) { | ||||
|             for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|                 BadgeDrawable badgeDrawable = this.badgeDrawables.get(navigationBarItemView.getId()); | ||||
|                 if (badgeDrawable != null) { | ||||
|                     navigationBarItemView.setBadge(badgeDrawable); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public BadgeDrawable getBadge(int i) { | ||||
|         return this.badgeDrawables.get(i); | ||||
|     } | ||||
|  | ||||
|     BadgeDrawable getOrCreateBadge(int i) { | ||||
|         validateMenuItemId(i); | ||||
|         BadgeDrawable badgeDrawable = this.badgeDrawables.get(i); | ||||
|         if (badgeDrawable == null) { | ||||
|             badgeDrawable = BadgeDrawable.create(getContext()); | ||||
|             this.badgeDrawables.put(i, badgeDrawable); | ||||
|         } | ||||
|         NavigationBarItemView findItemView = findItemView(i); | ||||
|         if (findItemView != null) { | ||||
|             findItemView.setBadge(badgeDrawable); | ||||
|         } | ||||
|         return badgeDrawable; | ||||
|     } | ||||
|  | ||||
|     void removeBadge(int i) { | ||||
|         validateMenuItemId(i); | ||||
|         NavigationBarItemView findItemView = findItemView(i); | ||||
|         if (findItemView != null) { | ||||
|             findItemView.removeBadge(); | ||||
|         } | ||||
|         this.badgeDrawables.put(i, null); | ||||
|     } | ||||
|  | ||||
|     private void setBadgeIfNeeded(NavigationBarItemView navigationBarItemView) { | ||||
|         BadgeDrawable badgeDrawable; | ||||
|         int id = navigationBarItemView.getId(); | ||||
|         if (isValidId(id) && (badgeDrawable = this.badgeDrawables.get(id)) != null) { | ||||
|             navigationBarItemView.setBadge(badgeDrawable); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void removeUnusedBadges() { | ||||
|         HashSet hashSet = new HashSet(); | ||||
|         for (int i = 0; i < this.menu.size(); i++) { | ||||
|             hashSet.add(Integer.valueOf(this.menu.getItem(i).getItemId())); | ||||
|         } | ||||
|         for (int i2 = 0; i2 < this.badgeDrawables.size(); i2++) { | ||||
|             int keyAt = this.badgeDrawables.keyAt(i2); | ||||
|             if (!hashSet.contains(Integer.valueOf(keyAt))) { | ||||
|                 this.badgeDrawables.delete(keyAt); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public NavigationBarItemView findItemView(int i) { | ||||
|         validateMenuItemId(i); | ||||
|         NavigationBarItemView[] navigationBarItemViewArr = this.buttons; | ||||
|         if (navigationBarItemViewArr == null) { | ||||
|             return null; | ||||
|         } | ||||
|         for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) { | ||||
|             if (navigationBarItemView.getId() == i) { | ||||
|                 return navigationBarItemView; | ||||
|             } | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     private void validateMenuItemId(int i) { | ||||
|         if (isValidId(i)) { | ||||
|             return; | ||||
|         } | ||||
|         throw new IllegalArgumentException(i + " is not a valid view id"); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,143 @@ | ||||
| package com.google.android.material.navigation; | ||||
|  | ||||
| import android.content.Context; | ||||
| import android.os.Parcel; | ||||
| import android.os.Parcelable; | ||||
| import android.view.ViewGroup; | ||||
| 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.view.menu.SubMenuBuilder; | ||||
| import com.google.android.material.badge.BadgeUtils; | ||||
| import com.google.android.material.internal.ParcelableSparseArray; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class NavigationBarPresenter implements MenuPresenter { | ||||
|     private int id; | ||||
|     private MenuBuilder menu; | ||||
|     private NavigationBarMenuView menuView; | ||||
|     private boolean updateSuspended = false; | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuPresenter | ||||
|     public boolean collapseItemActionView(MenuBuilder menuBuilder, MenuItemImpl menuItemImpl) { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuPresenter | ||||
|     public boolean expandItemActionView(MenuBuilder menuBuilder, MenuItemImpl menuItemImpl) { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuPresenter | ||||
|     public boolean flagActionItems() { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuPresenter | ||||
|     public int getId() { | ||||
|         return this.id; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuPresenter | ||||
|     public MenuView getMenuView(ViewGroup viewGroup) { | ||||
|         return this.menuView; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuPresenter | ||||
|     public void onCloseMenu(MenuBuilder menuBuilder, boolean z) { | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuPresenter | ||||
|     public boolean onSubMenuSelected(SubMenuBuilder subMenuBuilder) { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuPresenter | ||||
|     public void setCallback(MenuPresenter.Callback callback) { | ||||
|     } | ||||
|  | ||||
|     public void setId(int i) { | ||||
|         this.id = i; | ||||
|     } | ||||
|  | ||||
|     public void setMenuView(NavigationBarMenuView navigationBarMenuView) { | ||||
|         this.menuView = navigationBarMenuView; | ||||
|     } | ||||
|  | ||||
|     public void setUpdateSuspended(boolean z) { | ||||
|         this.updateSuspended = z; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuPresenter | ||||
|     public void initForMenu(Context context, MenuBuilder menuBuilder) { | ||||
|         this.menu = menuBuilder; | ||||
|         this.menuView.initialize(menuBuilder); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuPresenter | ||||
|     public void updateMenuView(boolean z) { | ||||
|         if (this.updateSuspended) { | ||||
|             return; | ||||
|         } | ||||
|         if (z) { | ||||
|             this.menuView.buildMenuView(); | ||||
|         } else { | ||||
|             this.menuView.updateMenuView(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuPresenter | ||||
|     public Parcelable onSaveInstanceState() { | ||||
|         SavedState savedState = new SavedState(); | ||||
|         savedState.selectedItemId = this.menuView.getSelectedItemId(); | ||||
|         savedState.badgeSavedStates = BadgeUtils.createParcelableBadgeStates(this.menuView.getBadgeDrawables()); | ||||
|         return savedState; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.view.menu.MenuPresenter | ||||
|     public void onRestoreInstanceState(Parcelable parcelable) { | ||||
|         if (parcelable instanceof SavedState) { | ||||
|             SavedState savedState = (SavedState) parcelable; | ||||
|             this.menuView.tryRestoreSelectedItemId(savedState.selectedItemId); | ||||
|             this.menuView.restoreBadgeDrawables(BadgeUtils.createBadgeDrawablesFromSavedStates(this.menuView.getContext(), savedState.badgeSavedStates)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     static class SavedState implements Parcelable { | ||||
|         public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() { // from class: com.google.android.material.navigation.NavigationBarPresenter.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]; | ||||
|             } | ||||
|         }; | ||||
|         ParcelableSparseArray badgeSavedStates; | ||||
|         int selectedItemId; | ||||
|  | ||||
|         @Override // android.os.Parcelable | ||||
|         public int describeContents() { | ||||
|             return 0; | ||||
|         } | ||||
|  | ||||
|         SavedState() { | ||||
|         } | ||||
|  | ||||
|         SavedState(Parcel parcel) { | ||||
|             this.selectedItemId = parcel.readInt(); | ||||
|             this.badgeSavedStates = (ParcelableSparseArray) parcel.readParcelable(getClass().getClassLoader()); | ||||
|         } | ||||
|  | ||||
|         @Override // android.os.Parcelable | ||||
|         public void writeToParcel(Parcel parcel, int i) { | ||||
|             parcel.writeInt(this.selectedItemId); | ||||
|             parcel.writeParcelable(this.badgeSavedStates, 0); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,446 @@ | ||||
| package com.google.android.material.navigation; | ||||
|  | ||||
| import android.content.Context; | ||||
| import android.content.res.ColorStateList; | ||||
| import android.content.res.TypedArray; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.os.Bundle; | ||||
| import android.os.Parcel; | ||||
| import android.os.Parcelable; | ||||
| import android.util.AttributeSet; | ||||
| import android.view.Menu; | ||||
| import android.view.MenuInflater; | ||||
| import android.view.MenuItem; | ||||
| import android.view.View; | ||||
| import android.widget.FrameLayout; | ||||
| import androidx.appcompat.view.SupportMenuInflater; | ||||
| import androidx.appcompat.view.menu.MenuBuilder; | ||||
| import androidx.appcompat.view.menu.MenuView; | ||||
| import androidx.appcompat.widget.TintTypedArray; | ||||
| import androidx.core.graphics.drawable.DrawableCompat; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import androidx.customview.view.AbsSavedState; | ||||
| import com.google.android.material.R; | ||||
| import com.google.android.material.badge.BadgeDrawable; | ||||
| import com.google.android.material.drawable.DrawableUtils; | ||||
| import com.google.android.material.internal.ThemeEnforcement; | ||||
| import com.google.android.material.resources.MaterialResources; | ||||
| import com.google.android.material.shape.MaterialShapeDrawable; | ||||
| import com.google.android.material.shape.MaterialShapeUtils; | ||||
| import com.google.android.material.shape.ShapeAppearanceModel; | ||||
| import com.google.android.material.theme.overlay.MaterialThemeOverlay; | ||||
| import java.lang.annotation.Retention; | ||||
| import java.lang.annotation.RetentionPolicy; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public abstract class NavigationBarView extends FrameLayout { | ||||
|     public static final int LABEL_VISIBILITY_AUTO = -1; | ||||
|     public static final int LABEL_VISIBILITY_LABELED = 1; | ||||
|     public static final int LABEL_VISIBILITY_SELECTED = 0; | ||||
|     public static final int LABEL_VISIBILITY_UNLABELED = 2; | ||||
|     private static final int MENU_PRESENTER_ID = 1; | ||||
|     private final NavigationBarMenu menu; | ||||
|     private MenuInflater menuInflater; | ||||
|     private final NavigationBarMenuView menuView; | ||||
|     private final NavigationBarPresenter presenter; | ||||
|     private OnItemReselectedListener reselectedListener; | ||||
|     private OnItemSelectedListener selectedListener; | ||||
|  | ||||
|     @Retention(RetentionPolicy.SOURCE) | ||||
|     public @interface LabelVisibility { | ||||
|     } | ||||
|  | ||||
|     public interface OnItemReselectedListener { | ||||
|         void onNavigationItemReselected(MenuItem menuItem); | ||||
|     } | ||||
|  | ||||
|     public interface OnItemSelectedListener { | ||||
|         boolean onNavigationItemSelected(MenuItem menuItem); | ||||
|     } | ||||
|  | ||||
|     protected abstract NavigationBarMenuView createNavigationBarMenuView(Context context); | ||||
|  | ||||
|     public abstract int getMaxItemCount(); | ||||
|  | ||||
|     public Menu getMenu() { | ||||
|         return this.menu; | ||||
|     } | ||||
|  | ||||
|     public MenuView getMenuView() { | ||||
|         return this.menuView; | ||||
|     } | ||||
|  | ||||
|     public NavigationBarPresenter getPresenter() { | ||||
|         return this.presenter; | ||||
|     } | ||||
|  | ||||
|     public void setOnItemReselectedListener(OnItemReselectedListener onItemReselectedListener) { | ||||
|         this.reselectedListener = onItemReselectedListener; | ||||
|     } | ||||
|  | ||||
|     public void setOnItemSelectedListener(OnItemSelectedListener onItemSelectedListener) { | ||||
|         this.selectedListener = onItemSelectedListener; | ||||
|     } | ||||
|  | ||||
|     public NavigationBarView(Context context, AttributeSet attributeSet, int i, int i2) { | ||||
|         super(MaterialThemeOverlay.wrap(context, attributeSet, i, i2), attributeSet, i); | ||||
|         NavigationBarPresenter navigationBarPresenter = new NavigationBarPresenter(); | ||||
|         this.presenter = navigationBarPresenter; | ||||
|         Context context2 = getContext(); | ||||
|         TintTypedArray obtainTintedStyledAttributes = ThemeEnforcement.obtainTintedStyledAttributes(context2, attributeSet, R.styleable.NavigationBarView, i, i2, R.styleable.NavigationBarView_itemTextAppearanceInactive, R.styleable.NavigationBarView_itemTextAppearanceActive); | ||||
|         NavigationBarMenu navigationBarMenu = new NavigationBarMenu(context2, getClass(), getMaxItemCount()); | ||||
|         this.menu = navigationBarMenu; | ||||
|         NavigationBarMenuView createNavigationBarMenuView = createNavigationBarMenuView(context2); | ||||
|         this.menuView = createNavigationBarMenuView; | ||||
|         navigationBarPresenter.setMenuView(createNavigationBarMenuView); | ||||
|         navigationBarPresenter.setId(1); | ||||
|         createNavigationBarMenuView.setPresenter(navigationBarPresenter); | ||||
|         navigationBarMenu.addMenuPresenter(navigationBarPresenter); | ||||
|         navigationBarPresenter.initForMenu(getContext(), navigationBarMenu); | ||||
|         if (obtainTintedStyledAttributes.hasValue(R.styleable.NavigationBarView_itemIconTint)) { | ||||
|             createNavigationBarMenuView.setIconTintList(obtainTintedStyledAttributes.getColorStateList(R.styleable.NavigationBarView_itemIconTint)); | ||||
|         } else { | ||||
|             createNavigationBarMenuView.setIconTintList(createNavigationBarMenuView.createDefaultColorStateList(android.R.attr.textColorSecondary)); | ||||
|         } | ||||
|         setItemIconSize(obtainTintedStyledAttributes.getDimensionPixelSize(R.styleable.NavigationBarView_itemIconSize, getResources().getDimensionPixelSize(R.dimen.mtrl_navigation_bar_item_default_icon_size))); | ||||
|         if (obtainTintedStyledAttributes.hasValue(R.styleable.NavigationBarView_itemTextAppearanceInactive)) { | ||||
|             setItemTextAppearanceInactive(obtainTintedStyledAttributes.getResourceId(R.styleable.NavigationBarView_itemTextAppearanceInactive, 0)); | ||||
|         } | ||||
|         if (obtainTintedStyledAttributes.hasValue(R.styleable.NavigationBarView_itemTextAppearanceActive)) { | ||||
|             setItemTextAppearanceActive(obtainTintedStyledAttributes.getResourceId(R.styleable.NavigationBarView_itemTextAppearanceActive, 0)); | ||||
|         } | ||||
|         setItemTextAppearanceActiveBoldEnabled(obtainTintedStyledAttributes.getBoolean(R.styleable.NavigationBarView_itemTextAppearanceActiveBoldEnabled, true)); | ||||
|         if (obtainTintedStyledAttributes.hasValue(R.styleable.NavigationBarView_itemTextColor)) { | ||||
|             setItemTextColor(obtainTintedStyledAttributes.getColorStateList(R.styleable.NavigationBarView_itemTextColor)); | ||||
|         } | ||||
|         Drawable background = getBackground(); | ||||
|         ColorStateList colorStateListOrNull = DrawableUtils.getColorStateListOrNull(background); | ||||
|         if (background == null || colorStateListOrNull != null) { | ||||
|             MaterialShapeDrawable materialShapeDrawable = new MaterialShapeDrawable(ShapeAppearanceModel.builder(context2, attributeSet, i, i2).build()); | ||||
|             if (colorStateListOrNull != null) { | ||||
|                 materialShapeDrawable.setFillColor(colorStateListOrNull); | ||||
|             } | ||||
|             materialShapeDrawable.initializeElevationOverlay(context2); | ||||
|             ViewCompat.setBackground(this, materialShapeDrawable); | ||||
|         } | ||||
|         if (obtainTintedStyledAttributes.hasValue(R.styleable.NavigationBarView_itemPaddingTop)) { | ||||
|             setItemPaddingTop(obtainTintedStyledAttributes.getDimensionPixelSize(R.styleable.NavigationBarView_itemPaddingTop, 0)); | ||||
|         } | ||||
|         if (obtainTintedStyledAttributes.hasValue(R.styleable.NavigationBarView_itemPaddingBottom)) { | ||||
|             setItemPaddingBottom(obtainTintedStyledAttributes.getDimensionPixelSize(R.styleable.NavigationBarView_itemPaddingBottom, 0)); | ||||
|         } | ||||
|         if (obtainTintedStyledAttributes.hasValue(R.styleable.NavigationBarView_activeIndicatorLabelPadding)) { | ||||
|             setActiveIndicatorLabelPadding(obtainTintedStyledAttributes.getDimensionPixelSize(R.styleable.NavigationBarView_activeIndicatorLabelPadding, 0)); | ||||
|         } | ||||
|         if (obtainTintedStyledAttributes.hasValue(R.styleable.NavigationBarView_elevation)) { | ||||
|             setElevation(obtainTintedStyledAttributes.getDimensionPixelSize(R.styleable.NavigationBarView_elevation, 0)); | ||||
|         } | ||||
|         DrawableCompat.setTintList(getBackground().mutate(), MaterialResources.getColorStateList(context2, obtainTintedStyledAttributes, R.styleable.NavigationBarView_backgroundTint)); | ||||
|         setLabelVisibilityMode(obtainTintedStyledAttributes.getInteger(R.styleable.NavigationBarView_labelVisibilityMode, -1)); | ||||
|         int resourceId = obtainTintedStyledAttributes.getResourceId(R.styleable.NavigationBarView_itemBackground, 0); | ||||
|         if (resourceId != 0) { | ||||
|             createNavigationBarMenuView.setItemBackgroundRes(resourceId); | ||||
|         } else { | ||||
|             setItemRippleColor(MaterialResources.getColorStateList(context2, obtainTintedStyledAttributes, R.styleable.NavigationBarView_itemRippleColor)); | ||||
|         } | ||||
|         int resourceId2 = obtainTintedStyledAttributes.getResourceId(R.styleable.NavigationBarView_itemActiveIndicatorStyle, 0); | ||||
|         if (resourceId2 != 0) { | ||||
|             setItemActiveIndicatorEnabled(true); | ||||
|             TypedArray obtainStyledAttributes = context2.obtainStyledAttributes(resourceId2, R.styleable.NavigationBarActiveIndicator); | ||||
|             setItemActiveIndicatorWidth(obtainStyledAttributes.getDimensionPixelSize(R.styleable.NavigationBarActiveIndicator_android_width, 0)); | ||||
|             setItemActiveIndicatorHeight(obtainStyledAttributes.getDimensionPixelSize(R.styleable.NavigationBarActiveIndicator_android_height, 0)); | ||||
|             setItemActiveIndicatorMarginHorizontal(obtainStyledAttributes.getDimensionPixelOffset(R.styleable.NavigationBarActiveIndicator_marginHorizontal, 0)); | ||||
|             setItemActiveIndicatorColor(MaterialResources.getColorStateList(context2, obtainStyledAttributes, R.styleable.NavigationBarActiveIndicator_android_color)); | ||||
|             setItemActiveIndicatorShapeAppearance(ShapeAppearanceModel.builder(context2, obtainStyledAttributes.getResourceId(R.styleable.NavigationBarActiveIndicator_shapeAppearance, 0), 0).build()); | ||||
|             obtainStyledAttributes.recycle(); | ||||
|         } | ||||
|         if (obtainTintedStyledAttributes.hasValue(R.styleable.NavigationBarView_menu)) { | ||||
|             inflateMenu(obtainTintedStyledAttributes.getResourceId(R.styleable.NavigationBarView_menu, 0)); | ||||
|         } | ||||
|         obtainTintedStyledAttributes.recycle(); | ||||
|         addView(createNavigationBarMenuView); | ||||
|         navigationBarMenu.setCallback(new MenuBuilder.Callback() { // from class: com.google.android.material.navigation.NavigationBarView.1 | ||||
|             @Override // androidx.appcompat.view.menu.MenuBuilder.Callback | ||||
|             public void onMenuModeChange(MenuBuilder menuBuilder) { | ||||
|             } | ||||
|  | ||||
|             @Override // androidx.appcompat.view.menu.MenuBuilder.Callback | ||||
|             public boolean onMenuItemSelected(MenuBuilder menuBuilder, MenuItem menuItem) { | ||||
|                 if (NavigationBarView.this.reselectedListener == null || menuItem.getItemId() != NavigationBarView.this.getSelectedItemId()) { | ||||
|                     return (NavigationBarView.this.selectedListener == null || NavigationBarView.this.selectedListener.onNavigationItemSelected(menuItem)) ? false : true; | ||||
|                 } | ||||
|                 NavigationBarView.this.reselectedListener.onNavigationItemReselected(menuItem); | ||||
|                 return true; | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.ViewGroup, android.view.View | ||||
|     protected void onAttachedToWindow() { | ||||
|         super.onAttachedToWindow(); | ||||
|         MaterialShapeUtils.setParentAbsoluteElevation(this); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setElevation(float f) { | ||||
|         super.setElevation(f); | ||||
|         MaterialShapeUtils.setElevation(this, f); | ||||
|     } | ||||
|  | ||||
|     public void inflateMenu(int i) { | ||||
|         this.presenter.setUpdateSuspended(true); | ||||
|         getMenuInflater().inflate(i, this.menu); | ||||
|         this.presenter.setUpdateSuspended(false); | ||||
|         this.presenter.updateMenuView(true); | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getItemIconTintList() { | ||||
|         return this.menuView.getIconTintList(); | ||||
|     } | ||||
|  | ||||
|     public void setItemIconTintList(ColorStateList colorStateList) { | ||||
|         this.menuView.setIconTintList(colorStateList); | ||||
|     } | ||||
|  | ||||
|     public void setItemIconSize(int i) { | ||||
|         this.menuView.setItemIconSize(i); | ||||
|     } | ||||
|  | ||||
|     public void setItemIconSizeRes(int i) { | ||||
|         setItemIconSize(getResources().getDimensionPixelSize(i)); | ||||
|     } | ||||
|  | ||||
|     public int getItemIconSize() { | ||||
|         return this.menuView.getItemIconSize(); | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getItemTextColor() { | ||||
|         return this.menuView.getItemTextColor(); | ||||
|     } | ||||
|  | ||||
|     public void setItemTextColor(ColorStateList colorStateList) { | ||||
|         this.menuView.setItemTextColor(colorStateList); | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public int getItemBackgroundResource() { | ||||
|         return this.menuView.getItemBackgroundRes(); | ||||
|     } | ||||
|  | ||||
|     public void setItemBackgroundResource(int i) { | ||||
|         this.menuView.setItemBackgroundRes(i); | ||||
|     } | ||||
|  | ||||
|     public Drawable getItemBackground() { | ||||
|         return this.menuView.getItemBackground(); | ||||
|     } | ||||
|  | ||||
|     public void setItemBackground(Drawable drawable) { | ||||
|         this.menuView.setItemBackground(drawable); | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getItemRippleColor() { | ||||
|         return this.menuView.getItemRippleColor(); | ||||
|     } | ||||
|  | ||||
|     public void setItemRippleColor(ColorStateList colorStateList) { | ||||
|         this.menuView.setItemRippleColor(colorStateList); | ||||
|     } | ||||
|  | ||||
|     public int getItemPaddingTop() { | ||||
|         return this.menuView.getItemPaddingTop(); | ||||
|     } | ||||
|  | ||||
|     public void setItemPaddingTop(int i) { | ||||
|         this.menuView.setItemPaddingTop(i); | ||||
|     } | ||||
|  | ||||
|     public int getItemPaddingBottom() { | ||||
|         return this.menuView.getItemPaddingBottom(); | ||||
|     } | ||||
|  | ||||
|     public void setItemPaddingBottom(int i) { | ||||
|         this.menuView.setItemPaddingBottom(i); | ||||
|     } | ||||
|  | ||||
|     public void setActiveIndicatorLabelPadding(int i) { | ||||
|         this.menuView.setActiveIndicatorLabelPadding(i); | ||||
|     } | ||||
|  | ||||
|     public int getActiveIndicatorLabelPadding() { | ||||
|         return this.menuView.getActiveIndicatorLabelPadding(); | ||||
|     } | ||||
|  | ||||
|     public boolean isItemActiveIndicatorEnabled() { | ||||
|         return this.menuView.getItemActiveIndicatorEnabled(); | ||||
|     } | ||||
|  | ||||
|     public void setItemActiveIndicatorEnabled(boolean z) { | ||||
|         this.menuView.setItemActiveIndicatorEnabled(z); | ||||
|     } | ||||
|  | ||||
|     public int getItemActiveIndicatorWidth() { | ||||
|         return this.menuView.getItemActiveIndicatorWidth(); | ||||
|     } | ||||
|  | ||||
|     public void setItemActiveIndicatorWidth(int i) { | ||||
|         this.menuView.setItemActiveIndicatorWidth(i); | ||||
|     } | ||||
|  | ||||
|     public int getItemActiveIndicatorHeight() { | ||||
|         return this.menuView.getItemActiveIndicatorHeight(); | ||||
|     } | ||||
|  | ||||
|     public void setItemActiveIndicatorHeight(int i) { | ||||
|         this.menuView.setItemActiveIndicatorHeight(i); | ||||
|     } | ||||
|  | ||||
|     public int getItemActiveIndicatorMarginHorizontal() { | ||||
|         return this.menuView.getItemActiveIndicatorMarginHorizontal(); | ||||
|     } | ||||
|  | ||||
|     public void setItemActiveIndicatorMarginHorizontal(int i) { | ||||
|         this.menuView.setItemActiveIndicatorMarginHorizontal(i); | ||||
|     } | ||||
|  | ||||
|     public ShapeAppearanceModel getItemActiveIndicatorShapeAppearance() { | ||||
|         return this.menuView.getItemActiveIndicatorShapeAppearance(); | ||||
|     } | ||||
|  | ||||
|     public void setItemActiveIndicatorShapeAppearance(ShapeAppearanceModel shapeAppearanceModel) { | ||||
|         this.menuView.setItemActiveIndicatorShapeAppearance(shapeAppearanceModel); | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getItemActiveIndicatorColor() { | ||||
|         return this.menuView.getItemActiveIndicatorColor(); | ||||
|     } | ||||
|  | ||||
|     public void setItemActiveIndicatorColor(ColorStateList colorStateList) { | ||||
|         this.menuView.setItemActiveIndicatorColor(colorStateList); | ||||
|     } | ||||
|  | ||||
|     public int getSelectedItemId() { | ||||
|         return this.menuView.getSelectedItemId(); | ||||
|     } | ||||
|  | ||||
|     public void setSelectedItemId(int i) { | ||||
|         MenuItem findItem = this.menu.findItem(i); | ||||
|         if (findItem == null || this.menu.performItemAction(findItem, this.presenter, 0)) { | ||||
|             return; | ||||
|         } | ||||
|         findItem.setChecked(true); | ||||
|     } | ||||
|  | ||||
|     public void setLabelVisibilityMode(int i) { | ||||
|         if (this.menuView.getLabelVisibilityMode() != i) { | ||||
|             this.menuView.setLabelVisibilityMode(i); | ||||
|             this.presenter.updateMenuView(false); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public int getLabelVisibilityMode() { | ||||
|         return this.menuView.getLabelVisibilityMode(); | ||||
|     } | ||||
|  | ||||
|     public void setItemTextAppearanceInactive(int i) { | ||||
|         this.menuView.setItemTextAppearanceInactive(i); | ||||
|     } | ||||
|  | ||||
|     public int getItemTextAppearanceInactive() { | ||||
|         return this.menuView.getItemTextAppearanceInactive(); | ||||
|     } | ||||
|  | ||||
|     public void setItemTextAppearanceActive(int i) { | ||||
|         this.menuView.setItemTextAppearanceActive(i); | ||||
|     } | ||||
|  | ||||
|     public void setItemTextAppearanceActiveBoldEnabled(boolean z) { | ||||
|         this.menuView.setItemTextAppearanceActiveBoldEnabled(z); | ||||
|     } | ||||
|  | ||||
|     public int getItemTextAppearanceActive() { | ||||
|         return this.menuView.getItemTextAppearanceActive(); | ||||
|     } | ||||
|  | ||||
|     public void setItemOnTouchListener(int i, View.OnTouchListener onTouchListener) { | ||||
|         this.menuView.setItemOnTouchListener(i, onTouchListener); | ||||
|     } | ||||
|  | ||||
|     public BadgeDrawable getBadge(int i) { | ||||
|         return this.menuView.getBadge(i); | ||||
|     } | ||||
|  | ||||
|     public BadgeDrawable getOrCreateBadge(int i) { | ||||
|         return this.menuView.getOrCreateBadge(i); | ||||
|     } | ||||
|  | ||||
|     public void removeBadge(int i) { | ||||
|         this.menuView.removeBadge(i); | ||||
|     } | ||||
|  | ||||
|     private MenuInflater getMenuInflater() { | ||||
|         if (this.menuInflater == null) { | ||||
|             this.menuInflater = new SupportMenuInflater(getContext()); | ||||
|         } | ||||
|         return this.menuInflater; | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     protected Parcelable onSaveInstanceState() { | ||||
|         SavedState savedState = new SavedState(super.onSaveInstanceState()); | ||||
|         savedState.menuPresenterState = new Bundle(); | ||||
|         this.menu.savePresenterStates(savedState.menuPresenterState); | ||||
|         return savedState; | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     protected void onRestoreInstanceState(Parcelable parcelable) { | ||||
|         if (!(parcelable instanceof SavedState)) { | ||||
|             super.onRestoreInstanceState(parcelable); | ||||
|             return; | ||||
|         } | ||||
|         SavedState savedState = (SavedState) parcelable; | ||||
|         super.onRestoreInstanceState(savedState.getSuperState()); | ||||
|         this.menu.restorePresenterStates(savedState.menuPresenterState); | ||||
|     } | ||||
|  | ||||
|     static class SavedState extends AbsSavedState { | ||||
|         public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.ClassLoaderCreator<SavedState>() { // from class: com.google.android.material.navigation.NavigationBarView.SavedState.1 | ||||
|             /* JADX WARN: Can't rename method to resolve collision */ | ||||
|             @Override // android.os.Parcelable.ClassLoaderCreator | ||||
|             public SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) { | ||||
|                 return new SavedState(parcel, classLoader); | ||||
|             } | ||||
|  | ||||
|             @Override // android.os.Parcelable.Creator | ||||
|             public SavedState createFromParcel(Parcel parcel) { | ||||
|                 return new SavedState(parcel, null); | ||||
|             } | ||||
|  | ||||
|             @Override // android.os.Parcelable.Creator | ||||
|             public SavedState[] newArray(int i) { | ||||
|                 return new SavedState[i]; | ||||
|             } | ||||
|         }; | ||||
|         Bundle menuPresenterState; | ||||
|  | ||||
|         public SavedState(Parcelable parcelable) { | ||||
|             super(parcelable); | ||||
|         } | ||||
|  | ||||
|         public SavedState(Parcel parcel, ClassLoader classLoader) { | ||||
|             super(parcel, classLoader); | ||||
|             readFromParcel(parcel, classLoader == null ? getClass().getClassLoader() : classLoader); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.customview.view.AbsSavedState, android.os.Parcelable | ||||
|         public void writeToParcel(Parcel parcel, int i) { | ||||
|             super.writeToParcel(parcel, i); | ||||
|             parcel.writeBundle(this.menuPresenterState); | ||||
|         } | ||||
|  | ||||
|         private void readFromParcel(Parcel parcel, ClassLoader classLoader) { | ||||
|             this.menuPresenterState = parcel.readBundle(classLoader); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,549 @@ | ||||
| package com.google.android.material.navigation; | ||||
|  | ||||
| import android.R; | ||||
| import android.app.Activity; | ||||
| import android.content.Context; | ||||
| import android.content.res.ColorStateList; | ||||
| import android.graphics.Canvas; | ||||
| import android.graphics.Color; | ||||
| import android.graphics.Rect; | ||||
| import android.graphics.RectF; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.graphics.drawable.InsetDrawable; | ||||
| import android.os.Build; | ||||
| import android.os.Bundle; | ||||
| import android.os.Parcel; | ||||
| import android.os.Parcelable; | ||||
| import android.util.AttributeSet; | ||||
| import android.util.Pair; | ||||
| import android.util.TypedValue; | ||||
| import android.view.Menu; | ||||
| import android.view.MenuInflater; | ||||
| import android.view.MenuItem; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.view.ViewParent; | ||||
| import android.view.ViewTreeObserver; | ||||
| import androidx.activity.BackEventCompat; | ||||
| import androidx.appcompat.content.res.AppCompatResources; | ||||
| import androidx.appcompat.view.SupportMenuInflater; | ||||
| import androidx.appcompat.view.menu.MenuItemImpl; | ||||
| import androidx.appcompat.widget.TintTypedArray; | ||||
| import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure; | ||||
| import androidx.core.content.ContextCompat; | ||||
| import androidx.core.view.GravityCompat; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import androidx.core.view.WindowInsetsCompat; | ||||
| import androidx.customview.view.AbsSavedState; | ||||
| import androidx.drawerlayout.widget.DrawerLayout; | ||||
| import com.google.android.material.canvas.CanvasCompat; | ||||
| import com.google.android.material.internal.ContextUtils; | ||||
| import com.google.android.material.internal.NavigationMenu; | ||||
| import com.google.android.material.internal.NavigationMenuPresenter; | ||||
| import com.google.android.material.internal.ScrimInsetsFrameLayout; | ||||
| import com.google.android.material.internal.WindowUtils; | ||||
| import com.google.android.material.motion.MaterialBackHandler; | ||||
| import com.google.android.material.motion.MaterialBackOrchestrator; | ||||
| import com.google.android.material.motion.MaterialSideContainerBackHelper; | ||||
| import com.google.android.material.resources.MaterialResources; | ||||
| import com.google.android.material.shape.MaterialShapeDrawable; | ||||
| import com.google.android.material.shape.MaterialShapeUtils; | ||||
| import com.google.android.material.shape.ShapeAppearanceModel; | ||||
| import com.google.android.material.shape.ShapeableDelegate; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class NavigationView extends ScrimInsetsFrameLayout implements MaterialBackHandler { | ||||
|     private static final int PRESENTER_NAVIGATION_VIEW_ID = 1; | ||||
|     private final DrawerLayout.DrawerListener backDrawerListener; | ||||
|     private final MaterialBackOrchestrator backOrchestrator; | ||||
|     private boolean bottomInsetScrimEnabled; | ||||
|     private int drawerLayoutCornerSize; | ||||
|     OnNavigationItemSelectedListener listener; | ||||
|     private final int maxWidth; | ||||
|     private final NavigationMenu menu; | ||||
|     private MenuInflater menuInflater; | ||||
|     private ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener; | ||||
|     private final NavigationMenuPresenter presenter; | ||||
|     private final ShapeableDelegate shapeableDelegate; | ||||
|     private final MaterialSideContainerBackHelper sideContainerBackHelper; | ||||
|     private final int[] tmpLocation; | ||||
|     private boolean topInsetScrimEnabled; | ||||
|     private static final int[] CHECKED_STATE_SET = {R.attr.state_checked}; | ||||
|     private static final int[] DISABLED_STATE_SET = {-16842910}; | ||||
|     private static final int DEF_STYLE_RES = com.google.android.material.R.style.Widget_Design_NavigationView; | ||||
|  | ||||
|     public interface OnNavigationItemSelectedListener { | ||||
|         boolean onNavigationItemSelected(MenuItem menuItem); | ||||
|     } | ||||
|  | ||||
|     MaterialSideContainerBackHelper getBackHelper() { | ||||
|         return this.sideContainerBackHelper; | ||||
|     } | ||||
|  | ||||
|     public Menu getMenu() { | ||||
|         return this.menu; | ||||
|     } | ||||
|  | ||||
|     public boolean isBottomInsetScrimEnabled() { | ||||
|         return this.bottomInsetScrimEnabled; | ||||
|     } | ||||
|  | ||||
|     public boolean isTopInsetScrimEnabled() { | ||||
|         return this.topInsetScrimEnabled; | ||||
|     } | ||||
|  | ||||
|     public void setBottomInsetScrimEnabled(boolean z) { | ||||
|         this.bottomInsetScrimEnabled = z; | ||||
|     } | ||||
|  | ||||
|     public void setNavigationItemSelectedListener(OnNavigationItemSelectedListener onNavigationItemSelectedListener) { | ||||
|         this.listener = onNavigationItemSelectedListener; | ||||
|     } | ||||
|  | ||||
|     public void setTopInsetScrimEnabled(boolean z) { | ||||
|         this.topInsetScrimEnabled = z; | ||||
|     } | ||||
|  | ||||
|     public NavigationView(Context context) { | ||||
|         this(context, null); | ||||
|     } | ||||
|  | ||||
|     public NavigationView(Context context, AttributeSet attributeSet) { | ||||
|         this(context, attributeSet, com.google.android.material.R.attr.navigationViewStyle); | ||||
|     } | ||||
|  | ||||
|     /* JADX WARN: Illegal instructions before constructor call */ | ||||
|     /* | ||||
|         Code decompiled incorrectly, please refer to instructions dump. | ||||
|         To view partially-correct add '--show-bad-code' argument | ||||
|     */ | ||||
|     public NavigationView(android.content.Context r17, android.util.AttributeSet r18, int r19) { | ||||
|         /* | ||||
|             Method dump skipped, instructions count: 572 | ||||
|             To view this dump add '--comments-level debug' option | ||||
|         */ | ||||
|         throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.navigation.NavigationView.<init>(android.content.Context, android.util.AttributeSet, int):void"); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setOverScrollMode(int i) { | ||||
|         super.setOverScrollMode(i); | ||||
|         NavigationMenuPresenter navigationMenuPresenter = this.presenter; | ||||
|         if (navigationMenuPresenter != null) { | ||||
|             navigationMenuPresenter.setOverScrollMode(i); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setForceCompatClippingEnabled(boolean z) { | ||||
|         this.shapeableDelegate.setForceCompatClippingEnabled(this, z); | ||||
|     } | ||||
|  | ||||
|     private void maybeUpdateCornerSizeForDrawerLayout(int i, int i2) { | ||||
|         if ((getParent() instanceof DrawerLayout) && (getLayoutParams() instanceof DrawerLayout.LayoutParams) && this.drawerLayoutCornerSize > 0 && (getBackground() instanceof MaterialShapeDrawable)) { | ||||
|             boolean z = GravityCompat.getAbsoluteGravity(((DrawerLayout.LayoutParams) getLayoutParams()).gravity, ViewCompat.getLayoutDirection(this)) == 3; | ||||
|             MaterialShapeDrawable materialShapeDrawable = (MaterialShapeDrawable) getBackground(); | ||||
|             ShapeAppearanceModel.Builder allCornerSizes = materialShapeDrawable.getShapeAppearanceModel().toBuilder().setAllCornerSizes(this.drawerLayoutCornerSize); | ||||
|             if (z) { | ||||
|                 allCornerSizes.setTopLeftCornerSize(0.0f); | ||||
|                 allCornerSizes.setBottomLeftCornerSize(0.0f); | ||||
|             } else { | ||||
|                 allCornerSizes.setTopRightCornerSize(0.0f); | ||||
|                 allCornerSizes.setBottomRightCornerSize(0.0f); | ||||
|             } | ||||
|             ShapeAppearanceModel build = allCornerSizes.build(); | ||||
|             materialShapeDrawable.setShapeAppearanceModel(build); | ||||
|             this.shapeableDelegate.onShapeAppearanceChanged(this, build); | ||||
|             this.shapeableDelegate.onMaskChanged(this, new RectF(0.0f, 0.0f, i, i2)); | ||||
|             this.shapeableDelegate.setOffsetZeroCornerEdgeBoundsEnabled(this, true); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private boolean hasShapeAppearance(TintTypedArray tintTypedArray) { | ||||
|         return tintTypedArray.hasValue(com.google.android.material.R.styleable.NavigationView_itemShapeAppearance) || tintTypedArray.hasValue(com.google.android.material.R.styleable.NavigationView_itemShapeAppearanceOverlay); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.internal.ScrimInsetsFrameLayout, android.view.ViewGroup, android.view.View | ||||
|     protected void onAttachedToWindow() { | ||||
|         super.onAttachedToWindow(); | ||||
|         MaterialShapeUtils.setParentAbsoluteElevation(this); | ||||
|         ViewParent parent = getParent(); | ||||
|         if ((parent instanceof DrawerLayout) && this.backOrchestrator.shouldListenForBackCallbacks()) { | ||||
|             DrawerLayout drawerLayout = (DrawerLayout) parent; | ||||
|             drawerLayout.removeDrawerListener(this.backDrawerListener); | ||||
|             drawerLayout.addDrawerListener(this.backDrawerListener); | ||||
|             if (drawerLayout.isDrawerOpen(this)) { | ||||
|                 this.backOrchestrator.startListeningForBackCallbacksWithPriorityOverlay(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.internal.ScrimInsetsFrameLayout, android.view.ViewGroup, android.view.View | ||||
|     protected void onDetachedFromWindow() { | ||||
|         super.onDetachedFromWindow(); | ||||
|         getViewTreeObserver().removeOnGlobalLayoutListener(this.onGlobalLayoutListener); | ||||
|         ViewParent parent = getParent(); | ||||
|         if (parent instanceof DrawerLayout) { | ||||
|             ((DrawerLayout) parent).removeDrawerListener(this.backDrawerListener); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     protected void onSizeChanged(int i, int i2, int i3, int i4) { | ||||
|         super.onSizeChanged(i, i2, i3, i4); | ||||
|         maybeUpdateCornerSizeForDrawerLayout(i, i2); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setElevation(float f) { | ||||
|         super.setElevation(f); | ||||
|         MaterialShapeUtils.setElevation(this, f); | ||||
|     } | ||||
|  | ||||
|     private Drawable createDefaultItemBackground(TintTypedArray tintTypedArray) { | ||||
|         return createDefaultItemDrawable(tintTypedArray, MaterialResources.getColorStateList(getContext(), tintTypedArray, com.google.android.material.R.styleable.NavigationView_itemShapeFillColor)); | ||||
|     } | ||||
|  | ||||
|     private Drawable createDefaultItemDrawable(TintTypedArray tintTypedArray, ColorStateList colorStateList) { | ||||
|         MaterialShapeDrawable materialShapeDrawable = new MaterialShapeDrawable(ShapeAppearanceModel.builder(getContext(), tintTypedArray.getResourceId(com.google.android.material.R.styleable.NavigationView_itemShapeAppearance, 0), tintTypedArray.getResourceId(com.google.android.material.R.styleable.NavigationView_itemShapeAppearanceOverlay, 0)).build()); | ||||
|         materialShapeDrawable.setFillColor(colorStateList); | ||||
|         return new InsetDrawable((Drawable) materialShapeDrawable, tintTypedArray.getDimensionPixelSize(com.google.android.material.R.styleable.NavigationView_itemShapeInsetStart, 0), tintTypedArray.getDimensionPixelSize(com.google.android.material.R.styleable.NavigationView_itemShapeInsetTop, 0), tintTypedArray.getDimensionPixelSize(com.google.android.material.R.styleable.NavigationView_itemShapeInsetEnd, 0), tintTypedArray.getDimensionPixelSize(com.google.android.material.R.styleable.NavigationView_itemShapeInsetBottom, 0)); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     protected Parcelable onSaveInstanceState() { | ||||
|         SavedState savedState = new SavedState(super.onSaveInstanceState()); | ||||
|         savedState.menuState = new Bundle(); | ||||
|         this.menu.savePresenterStates(savedState.menuState); | ||||
|         return savedState; | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     protected void onRestoreInstanceState(Parcelable parcelable) { | ||||
|         if (!(parcelable instanceof SavedState)) { | ||||
|             super.onRestoreInstanceState(parcelable); | ||||
|             return; | ||||
|         } | ||||
|         SavedState savedState = (SavedState) parcelable; | ||||
|         super.onRestoreInstanceState(savedState.getSuperState()); | ||||
|         this.menu.restorePresenterStates(savedState.menuState); | ||||
|     } | ||||
|  | ||||
|     @Override // android.widget.FrameLayout, android.view.View | ||||
|     protected void onMeasure(int i, int i2) { | ||||
|         int mode = View.MeasureSpec.getMode(i); | ||||
|         if (mode == Integer.MIN_VALUE) { | ||||
|             i = View.MeasureSpec.makeMeasureSpec(Math.min(View.MeasureSpec.getSize(i), this.maxWidth), BasicMeasure.EXACTLY); | ||||
|         } else if (mode == 0) { | ||||
|             i = View.MeasureSpec.makeMeasureSpec(this.maxWidth, BasicMeasure.EXACTLY); | ||||
|         } | ||||
|         super.onMeasure(i, i2); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.ViewGroup, android.view.View | ||||
|     protected void dispatchDraw(Canvas canvas) { | ||||
|         this.shapeableDelegate.maybeClip(canvas, new CanvasCompat.CanvasOperation() { // from class: com.google.android.material.navigation.NavigationView$$ExternalSyntheticLambda0 | ||||
|             @Override // com.google.android.material.canvas.CanvasCompat.CanvasOperation | ||||
|             public final void run(Canvas canvas2) { | ||||
|                 NavigationView.this.m245xb790515(canvas2); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     /* renamed from: lambda$dispatchDraw$0$com-google-android-material-navigation-NavigationView, reason: not valid java name */ | ||||
|     /* synthetic */ void m245xb790515(Canvas canvas) { | ||||
|         super.dispatchDraw(canvas); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.internal.ScrimInsetsFrameLayout | ||||
|     protected void onInsetsChanged(WindowInsetsCompat windowInsetsCompat) { | ||||
|         this.presenter.dispatchApplyWindowInsets(windowInsetsCompat); | ||||
|     } | ||||
|  | ||||
|     public void inflateMenu(int i) { | ||||
|         this.presenter.setUpdateSuspended(true); | ||||
|         getMenuInflater().inflate(i, this.menu); | ||||
|         this.presenter.setUpdateSuspended(false); | ||||
|         this.presenter.updateMenuView(false); | ||||
|     } | ||||
|  | ||||
|     public View inflateHeaderView(int i) { | ||||
|         return this.presenter.inflateHeaderView(i); | ||||
|     } | ||||
|  | ||||
|     public void addHeaderView(View view) { | ||||
|         this.presenter.addHeaderView(view); | ||||
|     } | ||||
|  | ||||
|     public void removeHeaderView(View view) { | ||||
|         this.presenter.removeHeaderView(view); | ||||
|     } | ||||
|  | ||||
|     public int getHeaderCount() { | ||||
|         return this.presenter.getHeaderCount(); | ||||
|     } | ||||
|  | ||||
|     public View getHeaderView(int i) { | ||||
|         return this.presenter.getHeaderView(i); | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getItemIconTintList() { | ||||
|         return this.presenter.getItemTintList(); | ||||
|     } | ||||
|  | ||||
|     public void setItemIconTintList(ColorStateList colorStateList) { | ||||
|         this.presenter.setItemIconTintList(colorStateList); | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getItemTextColor() { | ||||
|         return this.presenter.getItemTextColor(); | ||||
|     } | ||||
|  | ||||
|     public void setItemTextColor(ColorStateList colorStateList) { | ||||
|         this.presenter.setItemTextColor(colorStateList); | ||||
|     } | ||||
|  | ||||
|     public Drawable getItemBackground() { | ||||
|         return this.presenter.getItemBackground(); | ||||
|     } | ||||
|  | ||||
|     public void setItemBackgroundResource(int i) { | ||||
|         setItemBackground(ContextCompat.getDrawable(getContext(), i)); | ||||
|     } | ||||
|  | ||||
|     public void setItemBackground(Drawable drawable) { | ||||
|         this.presenter.setItemBackground(drawable); | ||||
|     } | ||||
|  | ||||
|     public int getItemHorizontalPadding() { | ||||
|         return this.presenter.getItemHorizontalPadding(); | ||||
|     } | ||||
|  | ||||
|     public void setItemHorizontalPadding(int i) { | ||||
|         this.presenter.setItemHorizontalPadding(i); | ||||
|     } | ||||
|  | ||||
|     public void setItemHorizontalPaddingResource(int i) { | ||||
|         this.presenter.setItemHorizontalPadding(getResources().getDimensionPixelSize(i)); | ||||
|     } | ||||
|  | ||||
|     public int getItemVerticalPadding() { | ||||
|         return this.presenter.getItemVerticalPadding(); | ||||
|     } | ||||
|  | ||||
|     public void setItemVerticalPadding(int i) { | ||||
|         this.presenter.setItemVerticalPadding(i); | ||||
|     } | ||||
|  | ||||
|     public void setItemVerticalPaddingResource(int i) { | ||||
|         this.presenter.setItemVerticalPadding(getResources().getDimensionPixelSize(i)); | ||||
|     } | ||||
|  | ||||
|     public int getItemIconPadding() { | ||||
|         return this.presenter.getItemIconPadding(); | ||||
|     } | ||||
|  | ||||
|     public void setItemIconPadding(int i) { | ||||
|         this.presenter.setItemIconPadding(i); | ||||
|     } | ||||
|  | ||||
|     public void setItemIconPaddingResource(int i) { | ||||
|         this.presenter.setItemIconPadding(getResources().getDimensionPixelSize(i)); | ||||
|     } | ||||
|  | ||||
|     public void setCheckedItem(int i) { | ||||
|         MenuItem findItem = this.menu.findItem(i); | ||||
|         if (findItem != null) { | ||||
|             this.presenter.setCheckedItem((MenuItemImpl) findItem); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setCheckedItem(MenuItem menuItem) { | ||||
|         MenuItem findItem = this.menu.findItem(menuItem.getItemId()); | ||||
|         if (findItem != null) { | ||||
|             this.presenter.setCheckedItem((MenuItemImpl) findItem); | ||||
|             return; | ||||
|         } | ||||
|         throw new IllegalArgumentException("Called setCheckedItem(MenuItem) with an item that is not in the current menu."); | ||||
|     } | ||||
|  | ||||
|     public MenuItem getCheckedItem() { | ||||
|         return this.presenter.getCheckedItem(); | ||||
|     } | ||||
|  | ||||
|     public void setItemTextAppearance(int i) { | ||||
|         this.presenter.setItemTextAppearance(i); | ||||
|     } | ||||
|  | ||||
|     public void setItemTextAppearanceActiveBoldEnabled(boolean z) { | ||||
|         this.presenter.setItemTextAppearanceActiveBoldEnabled(z); | ||||
|     } | ||||
|  | ||||
|     public void setItemIconSize(int i) { | ||||
|         this.presenter.setItemIconSize(i); | ||||
|     } | ||||
|  | ||||
|     public void setItemMaxLines(int i) { | ||||
|         this.presenter.setItemMaxLines(i); | ||||
|     } | ||||
|  | ||||
|     public int getItemMaxLines() { | ||||
|         return this.presenter.getItemMaxLines(); | ||||
|     } | ||||
|  | ||||
|     public int getDividerInsetStart() { | ||||
|         return this.presenter.getDividerInsetStart(); | ||||
|     } | ||||
|  | ||||
|     public void setDividerInsetStart(int i) { | ||||
|         this.presenter.setDividerInsetStart(i); | ||||
|     } | ||||
|  | ||||
|     public int getDividerInsetEnd() { | ||||
|         return this.presenter.getDividerInsetEnd(); | ||||
|     } | ||||
|  | ||||
|     public void setDividerInsetEnd(int i) { | ||||
|         this.presenter.setDividerInsetEnd(i); | ||||
|     } | ||||
|  | ||||
|     public int getSubheaderInsetStart() { | ||||
|         return this.presenter.getSubheaderInsetStart(); | ||||
|     } | ||||
|  | ||||
|     public void setSubheaderInsetStart(int i) { | ||||
|         this.presenter.setSubheaderInsetStart(i); | ||||
|     } | ||||
|  | ||||
|     public int getSubheaderInsetEnd() { | ||||
|         return this.presenter.getSubheaderInsetEnd(); | ||||
|     } | ||||
|  | ||||
|     public void setSubheaderInsetEnd(int i) { | ||||
|         this.presenter.setSubheaderInsetEnd(i); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.motion.MaterialBackHandler | ||||
|     public void startBackProgress(BackEventCompat backEventCompat) { | ||||
|         requireDrawerLayoutParent(); | ||||
|         this.sideContainerBackHelper.startBackProgress(backEventCompat); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.motion.MaterialBackHandler | ||||
|     public void updateBackProgress(BackEventCompat backEventCompat) { | ||||
|         this.sideContainerBackHelper.updateBackProgress(backEventCompat, ((DrawerLayout.LayoutParams) requireDrawerLayoutParent().second).gravity); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.motion.MaterialBackHandler | ||||
|     public void handleBackInvoked() { | ||||
|         Pair<DrawerLayout, DrawerLayout.LayoutParams> requireDrawerLayoutParent = requireDrawerLayoutParent(); | ||||
|         DrawerLayout drawerLayout = (DrawerLayout) requireDrawerLayoutParent.first; | ||||
|         BackEventCompat onHandleBackInvoked = this.sideContainerBackHelper.onHandleBackInvoked(); | ||||
|         if (onHandleBackInvoked == null || Build.VERSION.SDK_INT < 34) { | ||||
|             drawerLayout.closeDrawer(this); | ||||
|             return; | ||||
|         } | ||||
|         this.sideContainerBackHelper.finishBackProgress(onHandleBackInvoked, ((DrawerLayout.LayoutParams) requireDrawerLayoutParent.second).gravity, DrawerLayoutUtils.getScrimCloseAnimatorListener(drawerLayout, this), DrawerLayoutUtils.getScrimCloseAnimatorUpdateListener(drawerLayout)); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.motion.MaterialBackHandler | ||||
|     public void cancelBackProgress() { | ||||
|         requireDrawerLayoutParent(); | ||||
|         this.sideContainerBackHelper.cancelBackProgress(); | ||||
|     } | ||||
|  | ||||
|     private Pair<DrawerLayout, DrawerLayout.LayoutParams> requireDrawerLayoutParent() { | ||||
|         ViewParent parent = getParent(); | ||||
|         ViewGroup.LayoutParams layoutParams = getLayoutParams(); | ||||
|         if ((parent instanceof DrawerLayout) && (layoutParams instanceof DrawerLayout.LayoutParams)) { | ||||
|             return new Pair<>((DrawerLayout) parent, (DrawerLayout.LayoutParams) layoutParams); | ||||
|         } | ||||
|         throw new IllegalStateException("NavigationView back progress requires the direct parent view to be a DrawerLayout."); | ||||
|     } | ||||
|  | ||||
|     private MenuInflater getMenuInflater() { | ||||
|         if (this.menuInflater == null) { | ||||
|             this.menuInflater = new SupportMenuInflater(getContext()); | ||||
|         } | ||||
|         return this.menuInflater; | ||||
|     } | ||||
|  | ||||
|     private ColorStateList createDefaultColorStateList(int i) { | ||||
|         TypedValue typedValue = new TypedValue(); | ||||
|         if (!getContext().getTheme().resolveAttribute(i, typedValue, true)) { | ||||
|             return null; | ||||
|         } | ||||
|         ColorStateList colorStateList = AppCompatResources.getColorStateList(getContext(), typedValue.resourceId); | ||||
|         if (!getContext().getTheme().resolveAttribute(androidx.appcompat.R.attr.colorPrimary, typedValue, true)) { | ||||
|             return null; | ||||
|         } | ||||
|         int i2 = typedValue.data; | ||||
|         int defaultColor = colorStateList.getDefaultColor(); | ||||
|         int[] iArr = DISABLED_STATE_SET; | ||||
|         return new ColorStateList(new int[][]{iArr, CHECKED_STATE_SET, EMPTY_STATE_SET}, new int[]{colorStateList.getColorForState(iArr, defaultColor), i2, defaultColor}); | ||||
|     } | ||||
|  | ||||
|     private void setupInsetScrimsListener() { | ||||
|         this.onGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() { // from class: com.google.android.material.navigation.NavigationView.3 | ||||
|             @Override // android.view.ViewTreeObserver.OnGlobalLayoutListener | ||||
|             public void onGlobalLayout() { | ||||
|                 NavigationView navigationView = NavigationView.this; | ||||
|                 navigationView.getLocationOnScreen(navigationView.tmpLocation); | ||||
|                 boolean z = true; | ||||
|                 boolean z2 = NavigationView.this.tmpLocation[1] == 0; | ||||
|                 NavigationView.this.presenter.setBehindStatusBar(z2); | ||||
|                 NavigationView navigationView2 = NavigationView.this; | ||||
|                 navigationView2.setDrawTopInsetForeground(z2 && navigationView2.isTopInsetScrimEnabled()); | ||||
|                 NavigationView.this.setDrawLeftInsetForeground(NavigationView.this.tmpLocation[0] == 0 || NavigationView.this.tmpLocation[0] + NavigationView.this.getWidth() == 0); | ||||
|                 Activity activity = ContextUtils.getActivity(NavigationView.this.getContext()); | ||||
|                 if (activity != null) { | ||||
|                     Rect currentWindowBounds = WindowUtils.getCurrentWindowBounds(activity); | ||||
|                     boolean z3 = currentWindowBounds.height() - NavigationView.this.getHeight() == NavigationView.this.tmpLocation[1]; | ||||
|                     boolean z4 = Color.alpha(activity.getWindow().getNavigationBarColor()) != 0; | ||||
|                     NavigationView navigationView3 = NavigationView.this; | ||||
|                     navigationView3.setDrawBottomInsetForeground(z3 && z4 && navigationView3.isBottomInsetScrimEnabled()); | ||||
|                     if (currentWindowBounds.width() != NavigationView.this.tmpLocation[0] && currentWindowBounds.width() - NavigationView.this.getWidth() != NavigationView.this.tmpLocation[0]) { | ||||
|                         z = false; | ||||
|                     } | ||||
|                     NavigationView.this.setDrawRightInsetForeground(z); | ||||
|                 } | ||||
|             } | ||||
|         }; | ||||
|         getViewTreeObserver().addOnGlobalLayoutListener(this.onGlobalLayoutListener); | ||||
|     } | ||||
|  | ||||
|     public static class SavedState extends AbsSavedState { | ||||
|         public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.ClassLoaderCreator<SavedState>() { // from class: com.google.android.material.navigation.NavigationView.SavedState.1 | ||||
|             /* JADX WARN: Can't rename method to resolve collision */ | ||||
|             @Override // android.os.Parcelable.ClassLoaderCreator | ||||
|             public SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) { | ||||
|                 return new SavedState(parcel, classLoader); | ||||
|             } | ||||
|  | ||||
|             @Override // android.os.Parcelable.Creator | ||||
|             public SavedState createFromParcel(Parcel parcel) { | ||||
|                 return new SavedState(parcel, null); | ||||
|             } | ||||
|  | ||||
|             @Override // android.os.Parcelable.Creator | ||||
|             public SavedState[] newArray(int i) { | ||||
|                 return new SavedState[i]; | ||||
|             } | ||||
|         }; | ||||
|         public Bundle menuState; | ||||
|  | ||||
|         public SavedState(Parcel parcel, ClassLoader classLoader) { | ||||
|             super(parcel, classLoader); | ||||
|             this.menuState = parcel.readBundle(classLoader); | ||||
|         } | ||||
|  | ||||
|         public SavedState(Parcelable parcelable) { | ||||
|             super(parcelable); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.customview.view.AbsSavedState, android.os.Parcelable | ||||
|         public void writeToParcel(Parcel parcel, int i) { | ||||
|             super.writeToParcel(parcel, i); | ||||
|             parcel.writeBundle(this.menuState); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user