ADD week 5
This commit is contained in:
		| @@ -0,0 +1,920 @@ | ||||
| package com.google.android.material.bottomappbar; | ||||
|  | ||||
| import android.animation.Animator; | ||||
| import android.animation.AnimatorListenerAdapter; | ||||
| import android.animation.AnimatorSet; | ||||
| import android.animation.ObjectAnimator; | ||||
| import android.content.Context; | ||||
| import android.content.res.ColorStateList; | ||||
| import android.graphics.Rect; | ||||
| import android.graphics.RectF; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.os.Parcel; | ||||
| import android.os.Parcelable; | ||||
| import android.util.AttributeSet; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import androidx.appcompat.widget.ActionMenuView; | ||||
| import androidx.appcompat.widget.Toolbar; | ||||
| import androidx.coordinatorlayout.widget.CoordinatorLayout; | ||||
| import androidx.core.graphics.drawable.DrawableCompat; | ||||
| import androidx.core.view.GravityCompat; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import androidx.customview.view.AbsSavedState; | ||||
| import com.google.android.material.R; | ||||
| import com.google.android.material.animation.AnimationUtils; | ||||
| import com.google.android.material.animation.TransformationCallback; | ||||
| import com.google.android.material.behavior.HideBottomViewOnScrollBehavior; | ||||
| import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton; | ||||
| import com.google.android.material.floatingactionbutton.FloatingActionButton; | ||||
| import com.google.android.material.internal.ViewUtils; | ||||
| import com.google.android.material.motion.MotionUtils; | ||||
| import com.google.android.material.shape.MaterialShapeDrawable; | ||||
| import com.google.android.material.shape.MaterialShapeUtils; | ||||
| import java.lang.annotation.Retention; | ||||
| import java.lang.annotation.RetentionPolicy; | ||||
| import java.lang.ref.WeakReference; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Iterator; | ||||
| import java.util.List; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class BottomAppBar extends Toolbar implements CoordinatorLayout.AttachedBehavior { | ||||
|     private static final int FAB_ALIGNMENT_ANIM_DURATION_DEFAULT = 300; | ||||
|     private static final float FAB_ALIGNMENT_ANIM_EASING_MIDPOINT = 0.2f; | ||||
|     public static final int FAB_ALIGNMENT_MODE_CENTER = 0; | ||||
|     public static final int FAB_ALIGNMENT_MODE_END = 1; | ||||
|     public static final int FAB_ANCHOR_MODE_CRADLE = 1; | ||||
|     public static final int FAB_ANCHOR_MODE_EMBED = 0; | ||||
|     public static final int FAB_ANIMATION_MODE_SCALE = 0; | ||||
|     public static final int FAB_ANIMATION_MODE_SLIDE = 1; | ||||
|     public static final int MENU_ALIGNMENT_MODE_AUTO = 0; | ||||
|     public static final int MENU_ALIGNMENT_MODE_START = 1; | ||||
|     private static final int NO_FAB_END_MARGIN = -1; | ||||
|     private static final int NO_MENU_RES_ID = 0; | ||||
|     private int animatingModeChangeCounter; | ||||
|     private ArrayList<AnimationListener> animationListeners; | ||||
|     private Behavior behavior; | ||||
|     private int bottomInset; | ||||
|     private int fabAlignmentMode; | ||||
|     private int fabAlignmentModeEndMargin; | ||||
|     private int fabAnchorMode; | ||||
|     AnimatorListenerAdapter fabAnimationListener; | ||||
|     private int fabAnimationMode; | ||||
|     private boolean fabAttached; | ||||
|     private final int fabOffsetEndMode; | ||||
|     TransformationCallback<FloatingActionButton> fabTransformationCallback; | ||||
|     private boolean hideOnScroll; | ||||
|     private int leftInset; | ||||
|     private final MaterialShapeDrawable materialShapeDrawable; | ||||
|     private int menuAlignmentMode; | ||||
|     private boolean menuAnimatingWithFabAlignmentMode; | ||||
|     private Animator menuAnimator; | ||||
|     private Animator modeAnimator; | ||||
|     private Integer navigationIconTint; | ||||
|     private final boolean paddingBottomSystemWindowInsets; | ||||
|     private final boolean paddingLeftSystemWindowInsets; | ||||
|     private final boolean paddingRightSystemWindowInsets; | ||||
|     private int pendingMenuResId; | ||||
|     private final boolean removeEmbeddedFabElevation; | ||||
|     private int rightInset; | ||||
|     private static final int DEF_STYLE_RES = R.style.Widget_MaterialComponents_BottomAppBar; | ||||
|     private static final int FAB_ALIGNMENT_ANIM_DURATION_ATTR = R.attr.motionDurationLong2; | ||||
|     private static final int FAB_ALIGNMENT_ANIM_EASING_ATTR = R.attr.motionEasingEmphasizedInterpolator; | ||||
|  | ||||
|     interface AnimationListener { | ||||
|         void onAnimationEnd(BottomAppBar bottomAppBar); | ||||
|  | ||||
|         void onAnimationStart(BottomAppBar bottomAppBar); | ||||
|     } | ||||
|  | ||||
|     @Retention(RetentionPolicy.SOURCE) | ||||
|     public @interface FabAlignmentMode { | ||||
|     } | ||||
|  | ||||
|     @Retention(RetentionPolicy.SOURCE) | ||||
|     public @interface FabAnchorMode { | ||||
|     } | ||||
|  | ||||
|     @Retention(RetentionPolicy.SOURCE) | ||||
|     public @interface FabAnimationMode { | ||||
|     } | ||||
|  | ||||
|     @Retention(RetentionPolicy.SOURCE) | ||||
|     public @interface MenuAlignmentMode { | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public int getBottomInset() { | ||||
|         return this.bottomInset; | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public int getLeftInset() { | ||||
|         return this.leftInset; | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public int getRightInset() { | ||||
|         return this.rightInset; | ||||
|     } | ||||
|  | ||||
|     public int getFabAlignmentMode() { | ||||
|         return this.fabAlignmentMode; | ||||
|     } | ||||
|  | ||||
|     public int getFabAlignmentModeEndMargin() { | ||||
|         return this.fabAlignmentModeEndMargin; | ||||
|     } | ||||
|  | ||||
|     public int getFabAnchorMode() { | ||||
|         return this.fabAnchorMode; | ||||
|     } | ||||
|  | ||||
|     public int getFabAnimationMode() { | ||||
|         return this.fabAnimationMode; | ||||
|     } | ||||
|  | ||||
|     public boolean getHideOnScroll() { | ||||
|         return this.hideOnScroll; | ||||
|     } | ||||
|  | ||||
|     public int getMenuAlignmentMode() { | ||||
|         return this.menuAlignmentMode; | ||||
|     } | ||||
|  | ||||
|     public void setFabAnimationMode(int i) { | ||||
|         this.fabAnimationMode = i; | ||||
|     } | ||||
|  | ||||
|     public void setHideOnScroll(boolean z) { | ||||
|         this.hideOnScroll = z; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar | ||||
|     public void setSubtitle(CharSequence charSequence) { | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar | ||||
|     public void setTitle(CharSequence charSequence) { | ||||
|     } | ||||
|  | ||||
|     public BottomAppBar(Context context) { | ||||
|         this(context, null); | ||||
|     } | ||||
|  | ||||
|     public BottomAppBar(Context context, AttributeSet attributeSet) { | ||||
|         this(context, attributeSet, R.attr.bottomAppBarStyle); | ||||
|     } | ||||
|  | ||||
|     /* 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 BottomAppBar(android.content.Context r13, android.util.AttributeSet r14, int r15) { | ||||
|         /* | ||||
|             Method dump skipped, instructions count: 277 | ||||
|             To view this dump add '--comments-level debug' option | ||||
|         */ | ||||
|         throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.bottomappbar.BottomAppBar.<init>(android.content.Context, android.util.AttributeSet, int):void"); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar | ||||
|     public void setNavigationIcon(Drawable drawable) { | ||||
|         super.setNavigationIcon(maybeTintNavigationIcon(drawable)); | ||||
|     } | ||||
|  | ||||
|     public void setNavigationIconTint(int i) { | ||||
|         this.navigationIconTint = Integer.valueOf(i); | ||||
|         Drawable navigationIcon = getNavigationIcon(); | ||||
|         if (navigationIcon != null) { | ||||
|             setNavigationIcon(navigationIcon); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setFabAlignmentMode(int i) { | ||||
|         setFabAlignmentModeAndReplaceMenu(i, 0); | ||||
|     } | ||||
|  | ||||
|     public void setFabAlignmentModeAndReplaceMenu(int i, int i2) { | ||||
|         this.pendingMenuResId = i2; | ||||
|         this.menuAnimatingWithFabAlignmentMode = true; | ||||
|         maybeAnimateMenuView(i, this.fabAttached); | ||||
|         maybeAnimateModeChange(i); | ||||
|         this.fabAlignmentMode = i; | ||||
|     } | ||||
|  | ||||
|     public void setFabAnchorMode(int i) { | ||||
|         this.fabAnchorMode = i; | ||||
|         setCutoutStateAndTranslateFab(); | ||||
|         View findDependentView = findDependentView(); | ||||
|         if (findDependentView != null) { | ||||
|             updateFabAnchorGravity(this, findDependentView); | ||||
|             findDependentView.requestLayout(); | ||||
|             this.materialShapeDrawable.invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public static void updateFabAnchorGravity(BottomAppBar bottomAppBar, View view) { | ||||
|         CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) view.getLayoutParams(); | ||||
|         layoutParams.anchorGravity = 17; | ||||
|         if (bottomAppBar.fabAnchorMode == 1) { | ||||
|             layoutParams.anchorGravity |= 48; | ||||
|         } | ||||
|         if (bottomAppBar.fabAnchorMode == 0) { | ||||
|             layoutParams.anchorGravity |= 80; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setMenuAlignmentMode(int i) { | ||||
|         if (this.menuAlignmentMode != i) { | ||||
|             this.menuAlignmentMode = i; | ||||
|             ActionMenuView actionMenuView = getActionMenuView(); | ||||
|             if (actionMenuView != null) { | ||||
|                 translateActionMenuView(actionMenuView, this.fabAlignmentMode, isFabVisibleOrWillBeShown()); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setBackgroundTint(ColorStateList colorStateList) { | ||||
|         DrawableCompat.setTintList(this.materialShapeDrawable, colorStateList); | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getBackgroundTint() { | ||||
|         return this.materialShapeDrawable.getTintList(); | ||||
|     } | ||||
|  | ||||
|     public float getFabCradleMargin() { | ||||
|         return getTopEdgeTreatment().getFabCradleMargin(); | ||||
|     } | ||||
|  | ||||
|     public void setFabCradleMargin(float f) { | ||||
|         if (f != getFabCradleMargin()) { | ||||
|             getTopEdgeTreatment().setFabCradleMargin(f); | ||||
|             this.materialShapeDrawable.invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public float getFabCradleRoundedCornerRadius() { | ||||
|         return getTopEdgeTreatment().getFabCradleRoundedCornerRadius(); | ||||
|     } | ||||
|  | ||||
|     public void setFabCradleRoundedCornerRadius(float f) { | ||||
|         if (f != getFabCradleRoundedCornerRadius()) { | ||||
|             getTopEdgeTreatment().setFabCradleRoundedCornerRadius(f); | ||||
|             this.materialShapeDrawable.invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public float getCradleVerticalOffset() { | ||||
|         return getTopEdgeTreatment().getCradleVerticalOffset(); | ||||
|     } | ||||
|  | ||||
|     public void setCradleVerticalOffset(float f) { | ||||
|         if (f != getCradleVerticalOffset()) { | ||||
|             getTopEdgeTreatment().setCradleVerticalOffset(f); | ||||
|             this.materialShapeDrawable.invalidateSelf(); | ||||
|             setCutoutStateAndTranslateFab(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setFabAlignmentModeEndMargin(int i) { | ||||
|         if (this.fabAlignmentModeEndMargin != i) { | ||||
|             this.fabAlignmentModeEndMargin = i; | ||||
|             setCutoutStateAndTranslateFab(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void performHide() { | ||||
|         performHide(true); | ||||
|     } | ||||
|  | ||||
|     public void performHide(boolean z) { | ||||
|         getBehavior().slideDown(this, z); | ||||
|     } | ||||
|  | ||||
|     public void performShow() { | ||||
|         performShow(true); | ||||
|     } | ||||
|  | ||||
|     public void performShow(boolean z) { | ||||
|         getBehavior().slideUp(this, z); | ||||
|     } | ||||
|  | ||||
|     public boolean isScrolledDown() { | ||||
|         return getBehavior().isScrolledDown(); | ||||
|     } | ||||
|  | ||||
|     public boolean isScrolledUp() { | ||||
|         return getBehavior().isScrolledUp(); | ||||
|     } | ||||
|  | ||||
|     public void addOnScrollStateChangedListener(HideBottomViewOnScrollBehavior.OnScrollStateChangedListener onScrollStateChangedListener) { | ||||
|         getBehavior().addOnScrollStateChangedListener(onScrollStateChangedListener); | ||||
|     } | ||||
|  | ||||
|     public void removeOnScrollStateChangedListener(HideBottomViewOnScrollBehavior.OnScrollStateChangedListener onScrollStateChangedListener) { | ||||
|         getBehavior().removeOnScrollStateChangedListener(onScrollStateChangedListener); | ||||
|     } | ||||
|  | ||||
|     public void clearOnScrollStateChangedListeners() { | ||||
|         getBehavior().clearOnScrollStateChangedListeners(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setElevation(float f) { | ||||
|         this.materialShapeDrawable.setElevation(f); | ||||
|         getBehavior().setAdditionalHiddenOffsetY(this, this.materialShapeDrawable.getShadowRadius() - this.materialShapeDrawable.getShadowOffsetY()); | ||||
|     } | ||||
|  | ||||
|     public void replaceMenu(int i) { | ||||
|         if (i != 0) { | ||||
|             this.pendingMenuResId = 0; | ||||
|             getMenu().clear(); | ||||
|             inflateMenu(i); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void addAnimationListener(AnimationListener animationListener) { | ||||
|         if (this.animationListeners == null) { | ||||
|             this.animationListeners = new ArrayList<>(); | ||||
|         } | ||||
|         this.animationListeners.add(animationListener); | ||||
|     } | ||||
|  | ||||
|     void removeAnimationListener(AnimationListener animationListener) { | ||||
|         ArrayList<AnimationListener> arrayList = this.animationListeners; | ||||
|         if (arrayList == null) { | ||||
|             return; | ||||
|         } | ||||
|         arrayList.remove(animationListener); | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public void dispatchAnimationStart() { | ||||
|         ArrayList<AnimationListener> arrayList; | ||||
|         int i = this.animatingModeChangeCounter; | ||||
|         this.animatingModeChangeCounter = i + 1; | ||||
|         if (i != 0 || (arrayList = this.animationListeners) == null) { | ||||
|             return; | ||||
|         } | ||||
|         Iterator<AnimationListener> it = arrayList.iterator(); | ||||
|         while (it.hasNext()) { | ||||
|             it.next().onAnimationStart(this); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public void dispatchAnimationEnd() { | ||||
|         ArrayList<AnimationListener> arrayList; | ||||
|         int i = this.animatingModeChangeCounter - 1; | ||||
|         this.animatingModeChangeCounter = i; | ||||
|         if (i != 0 || (arrayList = this.animationListeners) == null) { | ||||
|             return; | ||||
|         } | ||||
|         Iterator<AnimationListener> it = arrayList.iterator(); | ||||
|         while (it.hasNext()) { | ||||
|             it.next().onAnimationEnd(this); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     boolean setFabDiameter(int i) { | ||||
|         float f = i; | ||||
|         if (f == getTopEdgeTreatment().getFabDiameter()) { | ||||
|             return false; | ||||
|         } | ||||
|         getTopEdgeTreatment().setFabDiameter(f); | ||||
|         this.materialShapeDrawable.invalidateSelf(); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     void setFabCornerSize(float f) { | ||||
|         if (f != getTopEdgeTreatment().getFabCornerRadius()) { | ||||
|             getTopEdgeTreatment().setFabCornerSize(f); | ||||
|             this.materialShapeDrawable.invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void maybeAnimateModeChange(int i) { | ||||
|         if (this.fabAlignmentMode == i || !ViewCompat.isLaidOut(this)) { | ||||
|             return; | ||||
|         } | ||||
|         Animator animator = this.modeAnimator; | ||||
|         if (animator != null) { | ||||
|             animator.cancel(); | ||||
|         } | ||||
|         ArrayList arrayList = new ArrayList(); | ||||
|         if (this.fabAnimationMode == 1) { | ||||
|             createFabTranslationXAnimation(i, arrayList); | ||||
|         } else { | ||||
|             createFabDefaultXAnimation(i, arrayList); | ||||
|         } | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         animatorSet.playTogether(arrayList); | ||||
|         animatorSet.setInterpolator(MotionUtils.resolveThemeInterpolator(getContext(), FAB_ALIGNMENT_ANIM_EASING_ATTR, AnimationUtils.LINEAR_INTERPOLATOR)); | ||||
|         this.modeAnimator = animatorSet; | ||||
|         animatorSet.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.bottomappbar.BottomAppBar.4 | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationStart(Animator animator2) { | ||||
|                 BottomAppBar.this.dispatchAnimationStart(); | ||||
|             } | ||||
|  | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationEnd(Animator animator2) { | ||||
|                 BottomAppBar.this.dispatchAnimationEnd(); | ||||
|                 BottomAppBar.this.modeAnimator = null; | ||||
|             } | ||||
|         }); | ||||
|         this.modeAnimator.start(); | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public FloatingActionButton findDependentFab() { | ||||
|         View findDependentView = findDependentView(); | ||||
|         if (findDependentView instanceof FloatingActionButton) { | ||||
|             return (FloatingActionButton) findDependentView; | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public View findDependentView() { | ||||
|         if (!(getParent() instanceof CoordinatorLayout)) { | ||||
|             return null; | ||||
|         } | ||||
|         for (View view : ((CoordinatorLayout) getParent()).getDependents(this)) { | ||||
|             if ((view instanceof FloatingActionButton) || (view instanceof ExtendedFloatingActionButton)) { | ||||
|                 return view; | ||||
|             } | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     private boolean isFabVisibleOrWillBeShown() { | ||||
|         FloatingActionButton findDependentFab = findDependentFab(); | ||||
|         return findDependentFab != null && findDependentFab.isOrWillBeShown(); | ||||
|     } | ||||
|  | ||||
|     protected void createFabDefaultXAnimation(final int i, List<Animator> list) { | ||||
|         FloatingActionButton findDependentFab = findDependentFab(); | ||||
|         if (findDependentFab == null || findDependentFab.isOrWillBeHidden()) { | ||||
|             return; | ||||
|         } | ||||
|         dispatchAnimationStart(); | ||||
|         findDependentFab.hide(new FloatingActionButton.OnVisibilityChangedListener() { // from class: com.google.android.material.bottomappbar.BottomAppBar.5 | ||||
|             @Override // com.google.android.material.floatingactionbutton.FloatingActionButton.OnVisibilityChangedListener | ||||
|             public void onHidden(FloatingActionButton floatingActionButton) { | ||||
|                 floatingActionButton.setTranslationX(BottomAppBar.this.getFabTranslationX(i)); | ||||
|                 floatingActionButton.show(new FloatingActionButton.OnVisibilityChangedListener() { // from class: com.google.android.material.bottomappbar.BottomAppBar.5.1 | ||||
|                     @Override // com.google.android.material.floatingactionbutton.FloatingActionButton.OnVisibilityChangedListener | ||||
|                     public void onShown(FloatingActionButton floatingActionButton2) { | ||||
|                         BottomAppBar.this.dispatchAnimationEnd(); | ||||
|                     } | ||||
|                 }); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     private void createFabTranslationXAnimation(int i, List<Animator> list) { | ||||
|         ObjectAnimator ofFloat = ObjectAnimator.ofFloat(findDependentFab(), "translationX", getFabTranslationX(i)); | ||||
|         ofFloat.setDuration(getFabAlignmentAnimationDuration()); | ||||
|         list.add(ofFloat); | ||||
|     } | ||||
|  | ||||
|     private int getFabAlignmentAnimationDuration() { | ||||
|         return MotionUtils.resolveThemeDuration(getContext(), FAB_ALIGNMENT_ANIM_DURATION_ATTR, 300); | ||||
|     } | ||||
|  | ||||
|     private Drawable maybeTintNavigationIcon(Drawable drawable) { | ||||
|         if (drawable == null || this.navigationIconTint == null) { | ||||
|             return drawable; | ||||
|         } | ||||
|         Drawable wrap = DrawableCompat.wrap(drawable.mutate()); | ||||
|         DrawableCompat.setTint(wrap, this.navigationIconTint.intValue()); | ||||
|         return wrap; | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public void maybeAnimateMenuView(int i, boolean z) { | ||||
|         if (!ViewCompat.isLaidOut(this)) { | ||||
|             this.menuAnimatingWithFabAlignmentMode = false; | ||||
|             replaceMenu(this.pendingMenuResId); | ||||
|             return; | ||||
|         } | ||||
|         Animator animator = this.menuAnimator; | ||||
|         if (animator != null) { | ||||
|             animator.cancel(); | ||||
|         } | ||||
|         ArrayList arrayList = new ArrayList(); | ||||
|         if (!isFabVisibleOrWillBeShown()) { | ||||
|             i = 0; | ||||
|             z = false; | ||||
|         } | ||||
|         createMenuViewTranslationAnimation(i, z, arrayList); | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         animatorSet.playTogether(arrayList); | ||||
|         this.menuAnimator = animatorSet; | ||||
|         animatorSet.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.bottomappbar.BottomAppBar.6 | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationStart(Animator animator2) { | ||||
|                 BottomAppBar.this.dispatchAnimationStart(); | ||||
|             } | ||||
|  | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationEnd(Animator animator2) { | ||||
|                 BottomAppBar.this.dispatchAnimationEnd(); | ||||
|                 BottomAppBar.this.menuAnimatingWithFabAlignmentMode = false; | ||||
|                 BottomAppBar.this.menuAnimator = null; | ||||
|             } | ||||
|         }); | ||||
|         this.menuAnimator.start(); | ||||
|     } | ||||
|  | ||||
|     private void createMenuViewTranslationAnimation(final int i, final boolean z, List<Animator> list) { | ||||
|         final ActionMenuView actionMenuView = getActionMenuView(); | ||||
|         if (actionMenuView == null) { | ||||
|             return; | ||||
|         } | ||||
|         float fabAlignmentAnimationDuration = getFabAlignmentAnimationDuration(); | ||||
|         Animator ofFloat = ObjectAnimator.ofFloat(actionMenuView, "alpha", 1.0f); | ||||
|         ofFloat.setDuration((long) (0.8f * fabAlignmentAnimationDuration)); | ||||
|         if (Math.abs(actionMenuView.getTranslationX() - getActionMenuViewTranslationX(actionMenuView, i, z)) <= 1.0f) { | ||||
|             if (actionMenuView.getAlpha() < 1.0f) { | ||||
|                 list.add(ofFloat); | ||||
|             } | ||||
|         } else { | ||||
|             ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(actionMenuView, "alpha", 0.0f); | ||||
|             ofFloat2.setDuration((long) (fabAlignmentAnimationDuration * 0.2f)); | ||||
|             ofFloat2.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.bottomappbar.BottomAppBar.7 | ||||
|                 public boolean cancelled; | ||||
|  | ||||
|                 @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|                 public void onAnimationCancel(Animator animator) { | ||||
|                     this.cancelled = true; | ||||
|                 } | ||||
|  | ||||
|                 @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|                 public void onAnimationEnd(Animator animator) { | ||||
|                     if (this.cancelled) { | ||||
|                         return; | ||||
|                     } | ||||
|                     boolean z2 = BottomAppBar.this.pendingMenuResId != 0; | ||||
|                     BottomAppBar bottomAppBar = BottomAppBar.this; | ||||
|                     bottomAppBar.replaceMenu(bottomAppBar.pendingMenuResId); | ||||
|                     BottomAppBar.this.translateActionMenuView(actionMenuView, i, z, z2); | ||||
|                 } | ||||
|             }); | ||||
|             AnimatorSet animatorSet = new AnimatorSet(); | ||||
|             animatorSet.playSequentially(ofFloat2, ofFloat); | ||||
|             list.add(animatorSet); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private float getFabTranslationY() { | ||||
|         if (this.fabAnchorMode == 1) { | ||||
|             return -getTopEdgeTreatment().getCradleVerticalOffset(); | ||||
|         } | ||||
|         return findDependentView() != null ? (-((getMeasuredHeight() + getBottomInset()) - r0.getMeasuredHeight())) / 2 : 0; | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public float getFabTranslationX(int i) { | ||||
|         boolean isLayoutRtl = ViewUtils.isLayoutRtl(this); | ||||
|         if (i != 1) { | ||||
|             return 0.0f; | ||||
|         } | ||||
|         return ((getMeasuredWidth() / 2) - ((isLayoutRtl ? this.leftInset : this.rightInset) + ((this.fabAlignmentModeEndMargin == -1 || findDependentView() == null) ? this.fabOffsetEndMode : (r6.getMeasuredWidth() / 2) + this.fabAlignmentModeEndMargin))) * (isLayoutRtl ? -1 : 1); | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public float getFabTranslationX() { | ||||
|         return getFabTranslationX(this.fabAlignmentMode); | ||||
|     } | ||||
|  | ||||
|     private ActionMenuView getActionMenuView() { | ||||
|         for (int i = 0; i < getChildCount(); i++) { | ||||
|             View childAt = getChildAt(i); | ||||
|             if (childAt instanceof ActionMenuView) { | ||||
|                 return (ActionMenuView) childAt; | ||||
|             } | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     private void translateActionMenuView(ActionMenuView actionMenuView, int i, boolean z) { | ||||
|         translateActionMenuView(actionMenuView, i, z, false); | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public void translateActionMenuView(final ActionMenuView actionMenuView, final int i, final boolean z, boolean z2) { | ||||
|         Runnable runnable = new Runnable() { // from class: com.google.android.material.bottomappbar.BottomAppBar.8 | ||||
|             @Override // java.lang.Runnable | ||||
|             public void run() { | ||||
|                 actionMenuView.setTranslationX(BottomAppBar.this.getActionMenuViewTranslationX(r0, i, z)); | ||||
|             } | ||||
|         }; | ||||
|         if (z2) { | ||||
|             actionMenuView.post(runnable); | ||||
|         } else { | ||||
|             runnable.run(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     protected int getActionMenuViewTranslationX(ActionMenuView actionMenuView, int i, boolean z) { | ||||
|         int i2 = 0; | ||||
|         if (this.menuAlignmentMode != 1 && (i != 1 || !z)) { | ||||
|             return 0; | ||||
|         } | ||||
|         boolean isLayoutRtl = ViewUtils.isLayoutRtl(this); | ||||
|         int measuredWidth = isLayoutRtl ? getMeasuredWidth() : 0; | ||||
|         for (int i3 = 0; i3 < getChildCount(); i3++) { | ||||
|             View childAt = getChildAt(i3); | ||||
|             if ((childAt.getLayoutParams() instanceof Toolbar.LayoutParams) && (((Toolbar.LayoutParams) childAt.getLayoutParams()).gravity & GravityCompat.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 8388611) { | ||||
|                 if (isLayoutRtl) { | ||||
|                     measuredWidth = Math.min(measuredWidth, childAt.getLeft()); | ||||
|                 } else { | ||||
|                     measuredWidth = Math.max(measuredWidth, childAt.getRight()); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         int right = isLayoutRtl ? actionMenuView.getRight() : actionMenuView.getLeft(); | ||||
|         int i4 = isLayoutRtl ? this.rightInset : -this.leftInset; | ||||
|         if (getNavigationIcon() == null) { | ||||
|             i2 = getResources().getDimensionPixelOffset(R.dimen.m3_bottomappbar_horizontal_padding); | ||||
|             if (!isLayoutRtl) { | ||||
|                 i2 = -i2; | ||||
|             } | ||||
|         } | ||||
|         return measuredWidth - ((right + i4) + i2); | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public void cancelAnimations() { | ||||
|         Animator animator = this.menuAnimator; | ||||
|         if (animator != null) { | ||||
|             animator.cancel(); | ||||
|         } | ||||
|         Animator animator2 = this.modeAnimator; | ||||
|         if (animator2 != null) { | ||||
|             animator2.cancel(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar, android.view.ViewGroup, android.view.View | ||||
|     protected void onLayout(boolean z, int i, int i2, int i3, int i4) { | ||||
|         super.onLayout(z, i, i2, i3, i4); | ||||
|         if (z) { | ||||
|             cancelAnimations(); | ||||
|             setCutoutStateAndTranslateFab(); | ||||
|             final View findDependentView = findDependentView(); | ||||
|             if (findDependentView != null && ViewCompat.isLaidOut(findDependentView)) { | ||||
|                 findDependentView.post(new Runnable() { // from class: com.google.android.material.bottomappbar.BottomAppBar$$ExternalSyntheticLambda2 | ||||
|                     @Override // java.lang.Runnable | ||||
|                     public final void run() { | ||||
|                         findDependentView.requestLayout(); | ||||
|                     } | ||||
|                 }); | ||||
|             } | ||||
|         } | ||||
|         setActionMenuViewPosition(); | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public BottomAppBarTopEdgeTreatment getTopEdgeTreatment() { | ||||
|         return (BottomAppBarTopEdgeTreatment) this.materialShapeDrawable.getShapeAppearanceModel().getTopEdge(); | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public void setCutoutStateAndTranslateFab() { | ||||
|         getTopEdgeTreatment().setHorizontalOffset(getFabTranslationX()); | ||||
|         this.materialShapeDrawable.setInterpolation((this.fabAttached && isFabVisibleOrWillBeShown() && this.fabAnchorMode == 1) ? 1.0f : 0.0f); | ||||
|         View findDependentView = findDependentView(); | ||||
|         if (findDependentView != null) { | ||||
|             findDependentView.setTranslationY(getFabTranslationY()); | ||||
|             findDependentView.setTranslationX(getFabTranslationX()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public void setActionMenuViewPosition() { | ||||
|         ActionMenuView actionMenuView = getActionMenuView(); | ||||
|         if (actionMenuView == null || this.menuAnimator != null) { | ||||
|             return; | ||||
|         } | ||||
|         actionMenuView.setAlpha(1.0f); | ||||
|         if (!isFabVisibleOrWillBeShown()) { | ||||
|             translateActionMenuView(actionMenuView, 0, false); | ||||
|         } else { | ||||
|             translateActionMenuView(actionMenuView, this.fabAlignmentMode, this.fabAttached); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public void addFabAnimationListeners(FloatingActionButton floatingActionButton) { | ||||
|         floatingActionButton.addOnHideAnimationListener(this.fabAnimationListener); | ||||
|         floatingActionButton.addOnShowAnimationListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.bottomappbar.BottomAppBar.9 | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationStart(Animator animator) { | ||||
|                 BottomAppBar.this.fabAnimationListener.onAnimationStart(animator); | ||||
|                 FloatingActionButton findDependentFab = BottomAppBar.this.findDependentFab(); | ||||
|                 if (findDependentFab != null) { | ||||
|                     findDependentFab.setTranslationX(BottomAppBar.this.getFabTranslationX()); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
|         floatingActionButton.addTransformationCallback(this.fabTransformationCallback); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.AttachedBehavior | ||||
|     public Behavior getBehavior() { | ||||
|         if (this.behavior == null) { | ||||
|             this.behavior = new Behavior(); | ||||
|         } | ||||
|         return this.behavior; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar, android.view.ViewGroup, android.view.View | ||||
|     protected void onAttachedToWindow() { | ||||
|         super.onAttachedToWindow(); | ||||
|         MaterialShapeUtils.setParentAbsoluteElevation(this, this.materialShapeDrawable); | ||||
|         if (getParent() instanceof ViewGroup) { | ||||
|             ((ViewGroup) getParent()).setClipChildren(false); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static class Behavior extends HideBottomViewOnScrollBehavior<BottomAppBar> { | ||||
|         private final Rect fabContentRect; | ||||
|         private final View.OnLayoutChangeListener fabLayoutListener; | ||||
|         private int originalBottomMargin; | ||||
|         private WeakReference<BottomAppBar> viewRef; | ||||
|  | ||||
|         public Behavior() { | ||||
|             this.fabLayoutListener = new View.OnLayoutChangeListener() { // from class: com.google.android.material.bottomappbar.BottomAppBar.Behavior.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) { | ||||
|                     boolean z; | ||||
|                     BottomAppBar bottomAppBar = (BottomAppBar) Behavior.this.viewRef.get(); | ||||
|                     if (bottomAppBar == null || (!((z = view instanceof FloatingActionButton)) && !(view instanceof ExtendedFloatingActionButton))) { | ||||
|                         view.removeOnLayoutChangeListener(this); | ||||
|                         return; | ||||
|                     } | ||||
|                     int height = view.getHeight(); | ||||
|                     if (z) { | ||||
|                         FloatingActionButton floatingActionButton = (FloatingActionButton) view; | ||||
|                         floatingActionButton.getMeasuredContentRect(Behavior.this.fabContentRect); | ||||
|                         height = Behavior.this.fabContentRect.height(); | ||||
|                         bottomAppBar.setFabDiameter(height); | ||||
|                         bottomAppBar.setFabCornerSize(floatingActionButton.getShapeAppearanceModel().getTopLeftCornerSize().getCornerSize(new RectF(Behavior.this.fabContentRect))); | ||||
|                     } | ||||
|                     CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) view.getLayoutParams(); | ||||
|                     if (Behavior.this.originalBottomMargin == 0) { | ||||
|                         if (bottomAppBar.fabAnchorMode == 1) { | ||||
|                             layoutParams.bottomMargin = bottomAppBar.getBottomInset() + (bottomAppBar.getResources().getDimensionPixelOffset(R.dimen.mtrl_bottomappbar_fab_bottom_margin) - ((view.getMeasuredHeight() - height) / 2)); | ||||
|                         } | ||||
|                         layoutParams.leftMargin = bottomAppBar.getLeftInset(); | ||||
|                         layoutParams.rightMargin = bottomAppBar.getRightInset(); | ||||
|                         if (ViewUtils.isLayoutRtl(view)) { | ||||
|                             layoutParams.leftMargin += bottomAppBar.fabOffsetEndMode; | ||||
|                         } else { | ||||
|                             layoutParams.rightMargin += bottomAppBar.fabOffsetEndMode; | ||||
|                         } | ||||
|                     } | ||||
|                     bottomAppBar.setCutoutStateAndTranslateFab(); | ||||
|                 } | ||||
|             }; | ||||
|             this.fabContentRect = new Rect(); | ||||
|         } | ||||
|  | ||||
|         public Behavior(Context context, AttributeSet attributeSet) { | ||||
|             super(context, attributeSet); | ||||
|             this.fabLayoutListener = new View.OnLayoutChangeListener() { // from class: com.google.android.material.bottomappbar.BottomAppBar.Behavior.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) { | ||||
|                     boolean z; | ||||
|                     BottomAppBar bottomAppBar = (BottomAppBar) Behavior.this.viewRef.get(); | ||||
|                     if (bottomAppBar == null || (!((z = view instanceof FloatingActionButton)) && !(view instanceof ExtendedFloatingActionButton))) { | ||||
|                         view.removeOnLayoutChangeListener(this); | ||||
|                         return; | ||||
|                     } | ||||
|                     int height = view.getHeight(); | ||||
|                     if (z) { | ||||
|                         FloatingActionButton floatingActionButton = (FloatingActionButton) view; | ||||
|                         floatingActionButton.getMeasuredContentRect(Behavior.this.fabContentRect); | ||||
|                         height = Behavior.this.fabContentRect.height(); | ||||
|                         bottomAppBar.setFabDiameter(height); | ||||
|                         bottomAppBar.setFabCornerSize(floatingActionButton.getShapeAppearanceModel().getTopLeftCornerSize().getCornerSize(new RectF(Behavior.this.fabContentRect))); | ||||
|                     } | ||||
|                     CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) view.getLayoutParams(); | ||||
|                     if (Behavior.this.originalBottomMargin == 0) { | ||||
|                         if (bottomAppBar.fabAnchorMode == 1) { | ||||
|                             layoutParams.bottomMargin = bottomAppBar.getBottomInset() + (bottomAppBar.getResources().getDimensionPixelOffset(R.dimen.mtrl_bottomappbar_fab_bottom_margin) - ((view.getMeasuredHeight() - height) / 2)); | ||||
|                         } | ||||
|                         layoutParams.leftMargin = bottomAppBar.getLeftInset(); | ||||
|                         layoutParams.rightMargin = bottomAppBar.getRightInset(); | ||||
|                         if (ViewUtils.isLayoutRtl(view)) { | ||||
|                             layoutParams.leftMargin += bottomAppBar.fabOffsetEndMode; | ||||
|                         } else { | ||||
|                             layoutParams.rightMargin += bottomAppBar.fabOffsetEndMode; | ||||
|                         } | ||||
|                     } | ||||
|                     bottomAppBar.setCutoutStateAndTranslateFab(); | ||||
|                 } | ||||
|             }; | ||||
|             this.fabContentRect = new Rect(); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.behavior.HideBottomViewOnScrollBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|         public boolean onLayoutChild(CoordinatorLayout coordinatorLayout, BottomAppBar bottomAppBar, int i) { | ||||
|             this.viewRef = new WeakReference<>(bottomAppBar); | ||||
|             View findDependentView = bottomAppBar.findDependentView(); | ||||
|             if (findDependentView != null && !ViewCompat.isLaidOut(findDependentView)) { | ||||
|                 BottomAppBar.updateFabAnchorGravity(bottomAppBar, findDependentView); | ||||
|                 this.originalBottomMargin = ((CoordinatorLayout.LayoutParams) findDependentView.getLayoutParams()).bottomMargin; | ||||
|                 if (findDependentView instanceof FloatingActionButton) { | ||||
|                     FloatingActionButton floatingActionButton = (FloatingActionButton) findDependentView; | ||||
|                     if (bottomAppBar.fabAnchorMode == 0 && bottomAppBar.removeEmbeddedFabElevation) { | ||||
|                         ViewCompat.setElevation(floatingActionButton, 0.0f); | ||||
|                         floatingActionButton.setCompatElevation(0.0f); | ||||
|                     } | ||||
|                     if (floatingActionButton.getShowMotionSpec() == null) { | ||||
|                         floatingActionButton.setShowMotionSpecResource(R.animator.mtrl_fab_show_motion_spec); | ||||
|                     } | ||||
|                     if (floatingActionButton.getHideMotionSpec() == null) { | ||||
|                         floatingActionButton.setHideMotionSpecResource(R.animator.mtrl_fab_hide_motion_spec); | ||||
|                     } | ||||
|                     bottomAppBar.addFabAnimationListeners(floatingActionButton); | ||||
|                 } | ||||
|                 findDependentView.addOnLayoutChangeListener(this.fabLayoutListener); | ||||
|                 bottomAppBar.setCutoutStateAndTranslateFab(); | ||||
|             } | ||||
|             coordinatorLayout.onLayoutChild(bottomAppBar, i); | ||||
|             return super.onLayoutChild(coordinatorLayout, (CoordinatorLayout) bottomAppBar, i); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.behavior.HideBottomViewOnScrollBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|         public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, BottomAppBar bottomAppBar, View view, View view2, int i, int i2) { | ||||
|             return bottomAppBar.getHideOnScroll() && super.onStartNestedScroll(coordinatorLayout, (CoordinatorLayout) bottomAppBar, view, view2, i, i2); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar, android.view.View | ||||
|     protected Parcelable onSaveInstanceState() { | ||||
|         SavedState savedState = new SavedState(super.onSaveInstanceState()); | ||||
|         savedState.fabAlignmentMode = this.fabAlignmentMode; | ||||
|         savedState.fabAttached = this.fabAttached; | ||||
|         return savedState; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.appcompat.widget.Toolbar, 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.fabAlignmentMode = savedState.fabAlignmentMode; | ||||
|         this.fabAttached = savedState.fabAttached; | ||||
|     } | ||||
|  | ||||
|     static class SavedState extends AbsSavedState { | ||||
|         public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.ClassLoaderCreator<SavedState>() { // from class: com.google.android.material.bottomappbar.BottomAppBar.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]; | ||||
|             } | ||||
|         }; | ||||
|         int fabAlignmentMode; | ||||
|         boolean fabAttached; | ||||
|  | ||||
|         public SavedState(Parcelable parcelable) { | ||||
|             super(parcelable); | ||||
|         } | ||||
|  | ||||
|         public SavedState(Parcel parcel, ClassLoader classLoader) { | ||||
|             super(parcel, classLoader); | ||||
|             this.fabAlignmentMode = parcel.readInt(); | ||||
|             this.fabAttached = parcel.readInt() != 0; | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.customview.view.AbsSavedState, android.os.Parcelable | ||||
|         public void writeToParcel(Parcel parcel, int i) { | ||||
|             super.writeToParcel(parcel, i); | ||||
|             parcel.writeInt(this.fabAlignmentMode); | ||||
|             parcel.writeInt(this.fabAttached ? 1 : 0); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,131 @@ | ||||
| package com.google.android.material.bottomappbar; | ||||
|  | ||||
| import com.google.android.material.shape.EdgeTreatment; | ||||
| import com.google.android.material.shape.ShapePath; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class BottomAppBarTopEdgeTreatment extends EdgeTreatment implements Cloneable { | ||||
|     private static final int ANGLE_LEFT = 180; | ||||
|     private static final int ANGLE_UP = 270; | ||||
|     private static final int ARC_HALF = 180; | ||||
|     private static final int ARC_QUARTER = 90; | ||||
|     private static final float ROUNDED_CORNER_FAB_OFFSET = 1.75f; | ||||
|     private float cradleVerticalOffset; | ||||
|     private float fabCornerSize = -1.0f; | ||||
|     private float fabDiameter; | ||||
|     private float fabMargin; | ||||
|     private float horizontalOffset; | ||||
|     private float roundedCornerRadius; | ||||
|  | ||||
|     float getCradleVerticalOffset() { | ||||
|         return this.cradleVerticalOffset; | ||||
|     } | ||||
|  | ||||
|     public float getFabCornerRadius() { | ||||
|         return this.fabCornerSize; | ||||
|     } | ||||
|  | ||||
|     float getFabCradleMargin() { | ||||
|         return this.fabMargin; | ||||
|     } | ||||
|  | ||||
|     float getFabCradleRoundedCornerRadius() { | ||||
|         return this.roundedCornerRadius; | ||||
|     } | ||||
|  | ||||
|     public float getFabDiameter() { | ||||
|         return this.fabDiameter; | ||||
|     } | ||||
|  | ||||
|     public float getHorizontalOffset() { | ||||
|         return this.horizontalOffset; | ||||
|     } | ||||
|  | ||||
|     public void setFabCornerSize(float f) { | ||||
|         this.fabCornerSize = f; | ||||
|     } | ||||
|  | ||||
|     void setFabCradleMargin(float f) { | ||||
|         this.fabMargin = f; | ||||
|     } | ||||
|  | ||||
|     void setFabCradleRoundedCornerRadius(float f) { | ||||
|         this.roundedCornerRadius = f; | ||||
|     } | ||||
|  | ||||
|     public void setFabDiameter(float f) { | ||||
|         this.fabDiameter = f; | ||||
|     } | ||||
|  | ||||
|     void setHorizontalOffset(float f) { | ||||
|         this.horizontalOffset = f; | ||||
|     } | ||||
|  | ||||
|     public BottomAppBarTopEdgeTreatment(float f, float f2, float f3) { | ||||
|         this.fabMargin = f; | ||||
|         this.roundedCornerRadius = f2; | ||||
|         setCradleVerticalOffset(f3); | ||||
|         this.horizontalOffset = 0.0f; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.EdgeTreatment | ||||
|     public void getEdgePath(float f, float f2, float f3, ShapePath shapePath) { | ||||
|         float f4; | ||||
|         float f5; | ||||
|         float f6 = this.fabDiameter; | ||||
|         if (f6 == 0.0f) { | ||||
|             shapePath.lineTo(f, 0.0f); | ||||
|             return; | ||||
|         } | ||||
|         float f7 = ((this.fabMargin * 2.0f) + f6) / 2.0f; | ||||
|         float f8 = f3 * this.roundedCornerRadius; | ||||
|         float f9 = f2 + this.horizontalOffset; | ||||
|         float f10 = (this.cradleVerticalOffset * f3) + ((1.0f - f3) * f7); | ||||
|         if (f10 / f7 >= 1.0f) { | ||||
|             shapePath.lineTo(f, 0.0f); | ||||
|             return; | ||||
|         } | ||||
|         float f11 = this.fabCornerSize; | ||||
|         float f12 = f11 * f3; | ||||
|         boolean z = f11 == -1.0f || Math.abs((f11 * 2.0f) - f6) < 0.1f; | ||||
|         if (z) { | ||||
|             f4 = f10; | ||||
|             f5 = 0.0f; | ||||
|         } else { | ||||
|             f5 = ROUNDED_CORNER_FAB_OFFSET; | ||||
|             f4 = 0.0f; | ||||
|         } | ||||
|         float f13 = f7 + f8; | ||||
|         float f14 = f4 + f8; | ||||
|         float sqrt = (float) Math.sqrt((f13 * f13) - (f14 * f14)); | ||||
|         float f15 = f9 - sqrt; | ||||
|         float f16 = f9 + sqrt; | ||||
|         float degrees = (float) Math.toDegrees(Math.atan(sqrt / f14)); | ||||
|         float f17 = (90.0f - degrees) + f5; | ||||
|         shapePath.lineTo(f15, 0.0f); | ||||
|         float f18 = f8 * 2.0f; | ||||
|         shapePath.addArc(f15 - f8, 0.0f, f15 + f8, f18, 270.0f, degrees); | ||||
|         if (z) { | ||||
|             shapePath.addArc(f9 - f7, (-f7) - f4, f9 + f7, f7 - f4, 180.0f - f17, (f17 * 2.0f) - 180.0f); | ||||
|         } else { | ||||
|             float f19 = this.fabMargin; | ||||
|             float f20 = f12 * 2.0f; | ||||
|             float f21 = f9 - f7; | ||||
|             shapePath.addArc(f21, -(f12 + f19), f21 + f19 + f20, f19 + f12, 180.0f - f17, ((f17 * 2.0f) - 180.0f) / 2.0f); | ||||
|             float f22 = f9 + f7; | ||||
|             float f23 = this.fabMargin; | ||||
|             shapePath.lineTo(f22 - ((f23 / 2.0f) + f12), f23 + f12); | ||||
|             float f24 = this.fabMargin; | ||||
|             shapePath.addArc(f22 - (f20 + f24), -(f12 + f24), f22, f24 + f12, 90.0f, f17 - 90.0f); | ||||
|         } | ||||
|         shapePath.addArc(f16 - f8, 0.0f, f16 + f8, f18, 270.0f - degrees, degrees); | ||||
|         shapePath.lineTo(f, 0.0f); | ||||
|     } | ||||
|  | ||||
|     void setCradleVerticalOffset(float f) { | ||||
|         if (f < 0.0f) { | ||||
|             throw new IllegalArgumentException("cradleVerticalOffset must be positive."); | ||||
|         } | ||||
|         this.cradleVerticalOffset = f; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user