ADD week 5
This commit is contained in:
		| @@ -0,0 +1,27 @@ | ||||
| package com.google.android.material.floatingactionbutton; | ||||
|  | ||||
| import android.animation.Animator; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| class AnimatorTracker { | ||||
|     private Animator currentAnimator; | ||||
|  | ||||
|     public void clear() { | ||||
|         this.currentAnimator = null; | ||||
|     } | ||||
|  | ||||
|     AnimatorTracker() { | ||||
|     } | ||||
|  | ||||
|     public void onNextAnimationStart(Animator animator) { | ||||
|         cancelCurrent(); | ||||
|         this.currentAnimator = animator; | ||||
|     } | ||||
|  | ||||
|     public void cancelCurrent() { | ||||
|         Animator animator = this.currentAnimator; | ||||
|         if (animator != null) { | ||||
|             animator.cancel(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,133 @@ | ||||
| package com.google.android.material.floatingactionbutton; | ||||
|  | ||||
| import android.animation.Animator; | ||||
| import android.animation.AnimatorSet; | ||||
| import android.content.Context; | ||||
| import android.content.res.ColorStateList; | ||||
| import android.graphics.Color; | ||||
| import android.util.Property; | ||||
| import android.view.View; | ||||
| import androidx.core.util.Preconditions; | ||||
| import com.google.android.material.animation.AnimationUtils; | ||||
| import com.google.android.material.animation.AnimatorSetCompat; | ||||
| import com.google.android.material.animation.MotionSpec; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| abstract class BaseMotionStrategy implements MotionStrategy { | ||||
|     private final Context context; | ||||
|     private MotionSpec defaultMotionSpec; | ||||
|     private final ExtendedFloatingActionButton fab; | ||||
|     private final ArrayList<Animator.AnimatorListener> listeners = new ArrayList<>(); | ||||
|     private MotionSpec motionSpec; | ||||
|     private final AnimatorTracker tracker; | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|     public final List<Animator.AnimatorListener> getListeners() { | ||||
|         return this.listeners; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|     public MotionSpec getMotionSpec() { | ||||
|         return this.motionSpec; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|     public final void setMotionSpec(MotionSpec motionSpec) { | ||||
|         this.motionSpec = motionSpec; | ||||
|     } | ||||
|  | ||||
|     BaseMotionStrategy(ExtendedFloatingActionButton extendedFloatingActionButton, AnimatorTracker animatorTracker) { | ||||
|         this.fab = extendedFloatingActionButton; | ||||
|         this.context = extendedFloatingActionButton.getContext(); | ||||
|         this.tracker = animatorTracker; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|     public final MotionSpec getCurrentMotionSpec() { | ||||
|         MotionSpec motionSpec = this.motionSpec; | ||||
|         if (motionSpec != null) { | ||||
|             return motionSpec; | ||||
|         } | ||||
|         if (this.defaultMotionSpec == null) { | ||||
|             this.defaultMotionSpec = MotionSpec.createFromResource(this.context, getDefaultMotionSpecResource()); | ||||
|         } | ||||
|         return (MotionSpec) Preconditions.checkNotNull(this.defaultMotionSpec); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|     public final void addAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         this.listeners.add(animatorListener); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|     public final void removeAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         this.listeners.remove(animatorListener); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|     public void onAnimationStart(Animator animator) { | ||||
|         this.tracker.onNextAnimationStart(animator); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|     public void onAnimationEnd() { | ||||
|         this.tracker.clear(); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|     public void onAnimationCancel() { | ||||
|         this.tracker.clear(); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|     public AnimatorSet createAnimator() { | ||||
|         return createAnimator(getCurrentMotionSpec()); | ||||
|     } | ||||
|  | ||||
|     AnimatorSet createAnimator(MotionSpec motionSpec) { | ||||
|         ArrayList arrayList = new ArrayList(); | ||||
|         if (motionSpec.hasPropertyValues("opacity")) { | ||||
|             arrayList.add(motionSpec.getAnimator("opacity", this.fab, View.ALPHA)); | ||||
|         } | ||||
|         if (motionSpec.hasPropertyValues("scale")) { | ||||
|             arrayList.add(motionSpec.getAnimator("scale", this.fab, View.SCALE_Y)); | ||||
|             arrayList.add(motionSpec.getAnimator("scale", this.fab, View.SCALE_X)); | ||||
|         } | ||||
|         if (motionSpec.hasPropertyValues("width")) { | ||||
|             arrayList.add(motionSpec.getAnimator("width", this.fab, ExtendedFloatingActionButton.WIDTH)); | ||||
|         } | ||||
|         if (motionSpec.hasPropertyValues("height")) { | ||||
|             arrayList.add(motionSpec.getAnimator("height", this.fab, ExtendedFloatingActionButton.HEIGHT)); | ||||
|         } | ||||
|         if (motionSpec.hasPropertyValues("paddingStart")) { | ||||
|             arrayList.add(motionSpec.getAnimator("paddingStart", this.fab, ExtendedFloatingActionButton.PADDING_START)); | ||||
|         } | ||||
|         if (motionSpec.hasPropertyValues("paddingEnd")) { | ||||
|             arrayList.add(motionSpec.getAnimator("paddingEnd", this.fab, ExtendedFloatingActionButton.PADDING_END)); | ||||
|         } | ||||
|         if (motionSpec.hasPropertyValues("labelOpacity")) { | ||||
|             arrayList.add(motionSpec.getAnimator("labelOpacity", this.fab, new Property<ExtendedFloatingActionButton, Float>(Float.class, "LABEL_OPACITY_PROPERTY") { // from class: com.google.android.material.floatingactionbutton.BaseMotionStrategy.1 | ||||
|                 @Override // android.util.Property | ||||
|                 public Float get(ExtendedFloatingActionButton extendedFloatingActionButton) { | ||||
|                     return Float.valueOf(AnimationUtils.lerp(0.0f, 1.0f, (Color.alpha(extendedFloatingActionButton.getCurrentTextColor()) / 255.0f) / Color.alpha(extendedFloatingActionButton.originalTextCsl.getColorForState(extendedFloatingActionButton.getDrawableState(), BaseMotionStrategy.this.fab.originalTextCsl.getDefaultColor())))); | ||||
|                 } | ||||
|  | ||||
|                 @Override // android.util.Property | ||||
|                 public void set(ExtendedFloatingActionButton extendedFloatingActionButton, Float f) { | ||||
|                     int colorForState = extendedFloatingActionButton.originalTextCsl.getColorForState(extendedFloatingActionButton.getDrawableState(), BaseMotionStrategy.this.fab.originalTextCsl.getDefaultColor()); | ||||
|                     ColorStateList valueOf = ColorStateList.valueOf(Color.argb((int) (AnimationUtils.lerp(0.0f, Color.alpha(colorForState) / 255.0f, f.floatValue()) * 255.0f), Color.red(colorForState), Color.green(colorForState), Color.blue(colorForState))); | ||||
|                     if (f.floatValue() == 1.0f) { | ||||
|                         extendedFloatingActionButton.silentlyUpdateTextColor(extendedFloatingActionButton.originalTextCsl); | ||||
|                     } else { | ||||
|                         extendedFloatingActionButton.silentlyUpdateTextColor(valueOf); | ||||
|                     } | ||||
|                 } | ||||
|             })); | ||||
|         } | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         AnimatorSetCompat.playTogether(animatorSet, arrayList); | ||||
|         return animatorSet; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,190 @@ | ||||
| package com.google.android.material.floatingactionbutton; | ||||
|  | ||||
| import android.content.res.ColorStateList; | ||||
| import android.graphics.Canvas; | ||||
| import android.graphics.ColorFilter; | ||||
| import android.graphics.LinearGradient; | ||||
| import android.graphics.Outline; | ||||
| import android.graphics.Paint; | ||||
| import android.graphics.Path; | ||||
| import android.graphics.Rect; | ||||
| import android.graphics.RectF; | ||||
| import android.graphics.Shader; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import androidx.core.graphics.ColorUtils; | ||||
| import com.google.android.material.drawable.DrawableUtils; | ||||
| import com.google.android.material.shape.ShapeAppearanceModel; | ||||
| import com.google.android.material.shape.ShapeAppearancePathProvider; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| class BorderDrawable extends Drawable { | ||||
|     private static final float DRAW_STROKE_WIDTH_MULTIPLE = 1.3333f; | ||||
|     private ColorStateList borderTint; | ||||
|     float borderWidth; | ||||
|     private int bottomInnerStrokeColor; | ||||
|     private int bottomOuterStrokeColor; | ||||
|     private int currentBorderTintColor; | ||||
|     private final Paint paint; | ||||
|     private ShapeAppearanceModel shapeAppearanceModel; | ||||
|     private int topInnerStrokeColor; | ||||
|     private int topOuterStrokeColor; | ||||
|     private final ShapeAppearancePathProvider pathProvider = ShapeAppearancePathProvider.getInstance(); | ||||
|     private final Path shapePath = new Path(); | ||||
|     private final Rect rect = new Rect(); | ||||
|     private final RectF rectF = new RectF(); | ||||
|     private final RectF boundsRectF = new RectF(); | ||||
|     private final BorderState state = new BorderState(); | ||||
|     private boolean invalidateShader = true; | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public Drawable.ConstantState getConstantState() { | ||||
|         return this.state; | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public int getOpacity() { | ||||
|         return this.borderWidth > 0.0f ? -3 : -2; | ||||
|     } | ||||
|  | ||||
|     public ShapeAppearanceModel getShapeAppearanceModel() { | ||||
|         return this.shapeAppearanceModel; | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     protected void onBoundsChange(Rect rect) { | ||||
|         this.invalidateShader = true; | ||||
|     } | ||||
|  | ||||
|     void setGradientColors(int i, int i2, int i3, int i4) { | ||||
|         this.topOuterStrokeColor = i; | ||||
|         this.topInnerStrokeColor = i2; | ||||
|         this.bottomOuterStrokeColor = i3; | ||||
|         this.bottomInnerStrokeColor = i4; | ||||
|     } | ||||
|  | ||||
|     BorderDrawable(ShapeAppearanceModel shapeAppearanceModel) { | ||||
|         this.shapeAppearanceModel = shapeAppearanceModel; | ||||
|         Paint paint = new Paint(1); | ||||
|         this.paint = paint; | ||||
|         paint.setStyle(Paint.Style.STROKE); | ||||
|     } | ||||
|  | ||||
|     public void setBorderWidth(float f) { | ||||
|         if (this.borderWidth != f) { | ||||
|             this.borderWidth = f; | ||||
|             this.paint.setStrokeWidth(f * DRAW_STROKE_WIDTH_MULTIPLE); | ||||
|             this.invalidateShader = true; | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void setBorderTint(ColorStateList colorStateList) { | ||||
|         if (colorStateList != null) { | ||||
|             this.currentBorderTintColor = colorStateList.getColorForState(getState(), this.currentBorderTintColor); | ||||
|         } | ||||
|         this.borderTint = colorStateList; | ||||
|         this.invalidateShader = true; | ||||
|         invalidateSelf(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setColorFilter(ColorFilter colorFilter) { | ||||
|         this.paint.setColorFilter(colorFilter); | ||||
|         invalidateSelf(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void draw(Canvas canvas) { | ||||
|         if (this.invalidateShader) { | ||||
|             this.paint.setShader(createGradientShader()); | ||||
|             this.invalidateShader = false; | ||||
|         } | ||||
|         float strokeWidth = this.paint.getStrokeWidth() / 2.0f; | ||||
|         copyBounds(this.rect); | ||||
|         this.rectF.set(this.rect); | ||||
|         float min = Math.min(this.shapeAppearanceModel.getTopLeftCornerSize().getCornerSize(getBoundsAsRectF()), this.rectF.width() / 2.0f); | ||||
|         if (this.shapeAppearanceModel.isRoundRect(getBoundsAsRectF())) { | ||||
|             this.rectF.inset(strokeWidth, strokeWidth); | ||||
|             canvas.drawRoundRect(this.rectF, min, min, this.paint); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void getOutline(Outline outline) { | ||||
|         if (this.shapeAppearanceModel.isRoundRect(getBoundsAsRectF())) { | ||||
|             outline.setRoundRect(getBounds(), this.shapeAppearanceModel.getTopLeftCornerSize().getCornerSize(getBoundsAsRectF())); | ||||
|         } else { | ||||
|             copyBounds(this.rect); | ||||
|             this.rectF.set(this.rect); | ||||
|             this.pathProvider.calculatePath(this.shapeAppearanceModel, 1.0f, this.rectF, this.shapePath); | ||||
|             DrawableUtils.setOutlineToPath(outline, this.shapePath); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public boolean getPadding(Rect rect) { | ||||
|         if (!this.shapeAppearanceModel.isRoundRect(getBoundsAsRectF())) { | ||||
|             return true; | ||||
|         } | ||||
|         int round = Math.round(this.borderWidth); | ||||
|         rect.set(round, round, round, round); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     protected RectF getBoundsAsRectF() { | ||||
|         this.boundsRectF.set(getBounds()); | ||||
|         return this.boundsRectF; | ||||
|     } | ||||
|  | ||||
|     public void setShapeAppearanceModel(ShapeAppearanceModel shapeAppearanceModel) { | ||||
|         this.shapeAppearanceModel = shapeAppearanceModel; | ||||
|         invalidateSelf(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public void setAlpha(int i) { | ||||
|         this.paint.setAlpha(i); | ||||
|         invalidateSelf(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     public boolean isStateful() { | ||||
|         ColorStateList colorStateList = this.borderTint; | ||||
|         return (colorStateList != null && colorStateList.isStateful()) || super.isStateful(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.graphics.drawable.Drawable | ||||
|     protected boolean onStateChange(int[] iArr) { | ||||
|         int colorForState; | ||||
|         ColorStateList colorStateList = this.borderTint; | ||||
|         if (colorStateList != null && (colorForState = colorStateList.getColorForState(iArr, this.currentBorderTintColor)) != this.currentBorderTintColor) { | ||||
|             this.invalidateShader = true; | ||||
|             this.currentBorderTintColor = colorForState; | ||||
|         } | ||||
|         if (this.invalidateShader) { | ||||
|             invalidateSelf(); | ||||
|         } | ||||
|         return this.invalidateShader; | ||||
|     } | ||||
|  | ||||
|     private Shader createGradientShader() { | ||||
|         copyBounds(this.rect); | ||||
|         float height = this.borderWidth / r0.height(); | ||||
|         return new LinearGradient(0.0f, r0.top, 0.0f, r0.bottom, new int[]{ColorUtils.compositeColors(this.topOuterStrokeColor, this.currentBorderTintColor), ColorUtils.compositeColors(this.topInnerStrokeColor, this.currentBorderTintColor), ColorUtils.compositeColors(ColorUtils.setAlphaComponent(this.topInnerStrokeColor, 0), this.currentBorderTintColor), ColorUtils.compositeColors(ColorUtils.setAlphaComponent(this.bottomInnerStrokeColor, 0), this.currentBorderTintColor), ColorUtils.compositeColors(this.bottomInnerStrokeColor, this.currentBorderTintColor), ColorUtils.compositeColors(this.bottomOuterStrokeColor, this.currentBorderTintColor)}, new float[]{0.0f, height, 0.5f, 0.5f, 1.0f - height, 1.0f}, Shader.TileMode.CLAMP); | ||||
|     } | ||||
|  | ||||
|     private class BorderState extends Drawable.ConstantState { | ||||
|         @Override // android.graphics.drawable.Drawable.ConstantState | ||||
|         public int getChangingConfigurations() { | ||||
|             return 0; | ||||
|         } | ||||
|  | ||||
|         @Override // android.graphics.drawable.Drawable.ConstantState | ||||
|         public Drawable newDrawable() { | ||||
|             return BorderDrawable.this; | ||||
|         } | ||||
|  | ||||
|         private BorderState() { | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,967 @@ | ||||
| package com.google.android.material.floatingactionbutton; | ||||
|  | ||||
| import android.animation.Animator; | ||||
| import android.animation.AnimatorListenerAdapter; | ||||
| import android.animation.AnimatorSet; | ||||
| import android.animation.PropertyValuesHolder; | ||||
| import android.content.Context; | ||||
| import android.content.res.ColorStateList; | ||||
| import android.content.res.TypedArray; | ||||
| import android.graphics.Rect; | ||||
| import android.text.TextUtils; | ||||
| import android.util.AttributeSet; | ||||
| import android.util.Property; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import androidx.coordinatorlayout.widget.CoordinatorLayout; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import com.google.android.material.R; | ||||
| import com.google.android.material.animation.MotionSpec; | ||||
| import com.google.android.material.appbar.AppBarLayout; | ||||
| import com.google.android.material.bottomsheet.BottomSheetBehavior; | ||||
| import com.google.android.material.button.MaterialButton; | ||||
| import com.google.android.material.internal.DescendantOffsetUtils; | ||||
| import java.util.Iterator; | ||||
| import java.util.List; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class ExtendedFloatingActionButton extends MaterialButton implements CoordinatorLayout.AttachedBehavior { | ||||
|     private static final int ANIM_STATE_HIDING = 1; | ||||
|     private static final int ANIM_STATE_NONE = 0; | ||||
|     private static final int ANIM_STATE_SHOWING = 2; | ||||
|     private static final int EXTEND = 3; | ||||
|     private static final int EXTEND_STRATEGY_AUTO = 0; | ||||
|     private static final int EXTEND_STRATEGY_MATCH_PARENT = 2; | ||||
|     private static final int EXTEND_STRATEGY_WRAP_CONTENT = 1; | ||||
|     private static final int HIDE = 1; | ||||
|     private static final int SHOW = 0; | ||||
|     private static final int SHRINK = 2; | ||||
|     private int animState; | ||||
|     private boolean animateShowBeforeLayout; | ||||
|     private final CoordinatorLayout.Behavior<ExtendedFloatingActionButton> behavior; | ||||
|     private final AnimatorTracker changeVisibilityTracker; | ||||
|     private final int collapsedSize; | ||||
|     private final MotionStrategy extendStrategy; | ||||
|     private final int extendStrategyType; | ||||
|     private int extendedPaddingEnd; | ||||
|     private int extendedPaddingStart; | ||||
|     private final MotionStrategy hideStrategy; | ||||
|     private boolean isExtended; | ||||
|     private boolean isTransforming; | ||||
|     private int originalHeight; | ||||
|     protected ColorStateList originalTextCsl; | ||||
|     private int originalWidth; | ||||
|     private final MotionStrategy showStrategy; | ||||
|     private final MotionStrategy shrinkStrategy; | ||||
|     private static final int DEF_STYLE_RES = R.style.Widget_MaterialComponents_ExtendedFloatingActionButton_Icon; | ||||
|     static final Property<View, Float> WIDTH = new Property<View, Float>(Float.class, "width") { // from class: com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.6 | ||||
|         @Override // android.util.Property | ||||
|         public void set(View view, Float f) { | ||||
|             view.getLayoutParams().width = f.intValue(); | ||||
|             view.requestLayout(); | ||||
|         } | ||||
|  | ||||
|         @Override // android.util.Property | ||||
|         public Float get(View view) { | ||||
|             return Float.valueOf(view.getLayoutParams().width); | ||||
|         } | ||||
|     }; | ||||
|     static final Property<View, Float> HEIGHT = new Property<View, Float>(Float.class, "height") { // from class: com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.7 | ||||
|         @Override // android.util.Property | ||||
|         public void set(View view, Float f) { | ||||
|             view.getLayoutParams().height = f.intValue(); | ||||
|             view.requestLayout(); | ||||
|         } | ||||
|  | ||||
|         @Override // android.util.Property | ||||
|         public Float get(View view) { | ||||
|             return Float.valueOf(view.getLayoutParams().height); | ||||
|         } | ||||
|     }; | ||||
|     static final Property<View, Float> PADDING_START = new Property<View, Float>(Float.class, "paddingStart") { // from class: com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.8 | ||||
|         @Override // android.util.Property | ||||
|         public void set(View view, Float f) { | ||||
|             ViewCompat.setPaddingRelative(view, f.intValue(), view.getPaddingTop(), ViewCompat.getPaddingEnd(view), view.getPaddingBottom()); | ||||
|         } | ||||
|  | ||||
|         @Override // android.util.Property | ||||
|         public Float get(View view) { | ||||
|             return Float.valueOf(ViewCompat.getPaddingStart(view)); | ||||
|         } | ||||
|     }; | ||||
|     static final Property<View, Float> PADDING_END = new Property<View, Float>(Float.class, "paddingEnd") { // from class: com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.9 | ||||
|         @Override // android.util.Property | ||||
|         public void set(View view, Float f) { | ||||
|             ViewCompat.setPaddingRelative(view, ViewCompat.getPaddingStart(view), view.getPaddingTop(), f.intValue(), view.getPaddingBottom()); | ||||
|         } | ||||
|  | ||||
|         @Override // android.util.Property | ||||
|         public Float get(View view) { | ||||
|             return Float.valueOf(ViewCompat.getPaddingEnd(view)); | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     public static abstract class OnChangedCallback { | ||||
|         public void onExtended(ExtendedFloatingActionButton extendedFloatingActionButton) { | ||||
|         } | ||||
|  | ||||
|         public void onHidden(ExtendedFloatingActionButton extendedFloatingActionButton) { | ||||
|         } | ||||
|  | ||||
|         public void onShown(ExtendedFloatingActionButton extendedFloatingActionButton) { | ||||
|         } | ||||
|  | ||||
|         public void onShrunken(ExtendedFloatingActionButton extendedFloatingActionButton) { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     interface Size { | ||||
|         int getHeight(); | ||||
|  | ||||
|         ViewGroup.LayoutParams getLayoutParams(); | ||||
|  | ||||
|         int getPaddingEnd(); | ||||
|  | ||||
|         int getPaddingStart(); | ||||
|  | ||||
|         int getWidth(); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.AttachedBehavior | ||||
|     public CoordinatorLayout.Behavior<ExtendedFloatingActionButton> getBehavior() { | ||||
|         return this.behavior; | ||||
|     } | ||||
|  | ||||
|     public final boolean isExtended() { | ||||
|         return this.isExtended; | ||||
|     } | ||||
|  | ||||
|     public void setAnimateShowBeforeLayout(boolean z) { | ||||
|         this.animateShowBeforeLayout = z; | ||||
|     } | ||||
|  | ||||
|     public ExtendedFloatingActionButton(Context context) { | ||||
|         this(context, null); | ||||
|     } | ||||
|  | ||||
|     public ExtendedFloatingActionButton(Context context, AttributeSet attributeSet) { | ||||
|         this(context, attributeSet, R.attr.extendedFloatingActionButtonStyle); | ||||
|     } | ||||
|  | ||||
|     /* 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 ExtendedFloatingActionButton(android.content.Context r17, android.util.AttributeSet r18, int r19) { | ||||
|         /* | ||||
|             r16 = this; | ||||
|             r0 = r16 | ||||
|             r7 = r18 | ||||
|             r8 = r19 | ||||
|             int r9 = com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.DEF_STYLE_RES | ||||
|             r1 = r17 | ||||
|             android.content.Context r1 = com.google.android.material.theme.overlay.MaterialThemeOverlay.wrap(r1, r7, r8, r9) | ||||
|             r0.<init>(r1, r7, r8) | ||||
|             r10 = 0 | ||||
|             r0.animState = r10 | ||||
|             com.google.android.material.floatingactionbutton.AnimatorTracker r1 = new com.google.android.material.floatingactionbutton.AnimatorTracker | ||||
|             r1.<init>() | ||||
|             r0.changeVisibilityTracker = r1 | ||||
|             com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$ShowStrategy r11 = new com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$ShowStrategy | ||||
|             r11.<init>(r1) | ||||
|             r0.showStrategy = r11 | ||||
|             com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$HideStrategy r12 = new com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$HideStrategy | ||||
|             r12.<init>(r1) | ||||
|             r0.hideStrategy = r12 | ||||
|             r13 = 1 | ||||
|             r0.isExtended = r13 | ||||
|             r0.isTransforming = r10 | ||||
|             r0.animateShowBeforeLayout = r10 | ||||
|             android.content.Context r14 = r16.getContext() | ||||
|             com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$ExtendedFloatingActionButtonBehavior r1 = new com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$ExtendedFloatingActionButtonBehavior | ||||
|             r1.<init>(r14, r7) | ||||
|             r0.behavior = r1 | ||||
|             int[] r3 = com.google.android.material.R.styleable.ExtendedFloatingActionButton | ||||
|             int[] r6 = new int[r10] | ||||
|             r1 = r14 | ||||
|             r2 = r18 | ||||
|             r4 = r19 | ||||
|             r5 = r9 | ||||
|             android.content.res.TypedArray r1 = com.google.android.material.internal.ThemeEnforcement.obtainStyledAttributes(r1, r2, r3, r4, r5, r6) | ||||
|             int r2 = com.google.android.material.R.styleable.ExtendedFloatingActionButton_showMotionSpec | ||||
|             com.google.android.material.animation.MotionSpec r2 = com.google.android.material.animation.MotionSpec.createFromAttribute(r14, r1, r2) | ||||
|             int r3 = com.google.android.material.R.styleable.ExtendedFloatingActionButton_hideMotionSpec | ||||
|             com.google.android.material.animation.MotionSpec r3 = com.google.android.material.animation.MotionSpec.createFromAttribute(r14, r1, r3) | ||||
|             int r4 = com.google.android.material.R.styleable.ExtendedFloatingActionButton_extendMotionSpec | ||||
|             com.google.android.material.animation.MotionSpec r4 = com.google.android.material.animation.MotionSpec.createFromAttribute(r14, r1, r4) | ||||
|             int r5 = com.google.android.material.R.styleable.ExtendedFloatingActionButton_shrinkMotionSpec | ||||
|             com.google.android.material.animation.MotionSpec r5 = com.google.android.material.animation.MotionSpec.createFromAttribute(r14, r1, r5) | ||||
|             int r6 = com.google.android.material.R.styleable.ExtendedFloatingActionButton_collapsedSize | ||||
|             r15 = -1 | ||||
|             int r6 = r1.getDimensionPixelSize(r6, r15) | ||||
|             r0.collapsedSize = r6 | ||||
|             int r6 = com.google.android.material.R.styleable.ExtendedFloatingActionButton_extendStrategy | ||||
|             int r6 = r1.getInt(r6, r13) | ||||
|             r0.extendStrategyType = r6 | ||||
|             int r15 = androidx.core.view.ViewCompat.getPaddingStart(r16) | ||||
|             r0.extendedPaddingStart = r15 | ||||
|             int r15 = androidx.core.view.ViewCompat.getPaddingEnd(r16) | ||||
|             r0.extendedPaddingEnd = r15 | ||||
|             com.google.android.material.floatingactionbutton.AnimatorTracker r15 = new com.google.android.material.floatingactionbutton.AnimatorTracker | ||||
|             r15.<init>() | ||||
|             com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$ChangeSizeStrategy r10 = new com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$ChangeSizeStrategy | ||||
|             com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$Size r6 = r0.getSizeFromExtendStrategyType(r6) | ||||
|             r10.<init>(r15, r6, r13) | ||||
|             r0.extendStrategy = r10 | ||||
|             com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$ChangeSizeStrategy r6 = new com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$ChangeSizeStrategy | ||||
|             com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$1 r13 = new com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$1 | ||||
|             r13.<init>() | ||||
|             r7 = 0 | ||||
|             r6.<init>(r15, r13, r7) | ||||
|             r0.shrinkStrategy = r6 | ||||
|             r11.setMotionSpec(r2) | ||||
|             r12.setMotionSpec(r3) | ||||
|             r10.setMotionSpec(r4) | ||||
|             r6.setMotionSpec(r5) | ||||
|             r1.recycle() | ||||
|             com.google.android.material.shape.CornerSize r1 = com.google.android.material.shape.ShapeAppearanceModel.PILL | ||||
|             r2 = r18 | ||||
|             com.google.android.material.shape.ShapeAppearanceModel$Builder r1 = com.google.android.material.shape.ShapeAppearanceModel.builder(r14, r2, r8, r9, r1) | ||||
|             com.google.android.material.shape.ShapeAppearanceModel r1 = r1.build() | ||||
|             r0.setShapeAppearanceModel(r1) | ||||
|             r16.saveOriginalTextCsl() | ||||
|             return | ||||
|         */ | ||||
|         throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.<init>(android.content.Context, android.util.AttributeSet, int):void"); | ||||
|     } | ||||
|  | ||||
|     private Size getSizeFromExtendStrategyType(int i) { | ||||
|         final Size size = new Size() { // from class: com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.2 | ||||
|             @Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size | ||||
|             public int getWidth() { | ||||
|                 return (ExtendedFloatingActionButton.this.getMeasuredWidth() - (ExtendedFloatingActionButton.this.getCollapsedPadding() * 2)) + ExtendedFloatingActionButton.this.extendedPaddingStart + ExtendedFloatingActionButton.this.extendedPaddingEnd; | ||||
|             } | ||||
|  | ||||
|             @Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size | ||||
|             public int getHeight() { | ||||
|                 return ExtendedFloatingActionButton.this.getMeasuredHeight(); | ||||
|             } | ||||
|  | ||||
|             @Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size | ||||
|             public int getPaddingStart() { | ||||
|                 return ExtendedFloatingActionButton.this.extendedPaddingStart; | ||||
|             } | ||||
|  | ||||
|             @Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size | ||||
|             public int getPaddingEnd() { | ||||
|                 return ExtendedFloatingActionButton.this.extendedPaddingEnd; | ||||
|             } | ||||
|  | ||||
|             @Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size | ||||
|             public ViewGroup.LayoutParams getLayoutParams() { | ||||
|                 return new ViewGroup.LayoutParams(-2, -2); | ||||
|             } | ||||
|         }; | ||||
|         final Size size2 = new Size() { // from class: com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.3 | ||||
|             @Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size | ||||
|             public int getWidth() { | ||||
|                 ViewGroup.MarginLayoutParams marginLayoutParams; | ||||
|                 if (!(ExtendedFloatingActionButton.this.getParent() instanceof View)) { | ||||
|                     return size.getWidth(); | ||||
|                 } | ||||
|                 View view = (View) ExtendedFloatingActionButton.this.getParent(); | ||||
|                 ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); | ||||
|                 if (layoutParams != null && layoutParams.width == -2) { | ||||
|                     return size.getWidth(); | ||||
|                 } | ||||
|                 return (view.getWidth() - ((!(ExtendedFloatingActionButton.this.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) || (marginLayoutParams = (ViewGroup.MarginLayoutParams) ExtendedFloatingActionButton.this.getLayoutParams()) == null) ? 0 : marginLayoutParams.leftMargin + marginLayoutParams.rightMargin)) - (view.getPaddingLeft() + view.getPaddingRight()); | ||||
|             } | ||||
|  | ||||
|             @Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size | ||||
|             public int getHeight() { | ||||
|                 ViewGroup.MarginLayoutParams marginLayoutParams; | ||||
|                 if (ExtendedFloatingActionButton.this.originalHeight != -1) { | ||||
|                     if (ExtendedFloatingActionButton.this.originalHeight != 0 && ExtendedFloatingActionButton.this.originalHeight != -2) { | ||||
|                         return ExtendedFloatingActionButton.this.originalHeight; | ||||
|                     } | ||||
|                     return size.getHeight(); | ||||
|                 } | ||||
|                 if (!(ExtendedFloatingActionButton.this.getParent() instanceof View)) { | ||||
|                     return size.getHeight(); | ||||
|                 } | ||||
|                 View view = (View) ExtendedFloatingActionButton.this.getParent(); | ||||
|                 ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); | ||||
|                 if (layoutParams != null && layoutParams.height == -2) { | ||||
|                     return size.getHeight(); | ||||
|                 } | ||||
|                 return (view.getHeight() - ((!(ExtendedFloatingActionButton.this.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) || (marginLayoutParams = (ViewGroup.MarginLayoutParams) ExtendedFloatingActionButton.this.getLayoutParams()) == null) ? 0 : marginLayoutParams.topMargin + marginLayoutParams.bottomMargin)) - (view.getPaddingTop() + view.getPaddingBottom()); | ||||
|             } | ||||
|  | ||||
|             @Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size | ||||
|             public int getPaddingStart() { | ||||
|                 return ExtendedFloatingActionButton.this.extendedPaddingStart; | ||||
|             } | ||||
|  | ||||
|             @Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size | ||||
|             public int getPaddingEnd() { | ||||
|                 return ExtendedFloatingActionButton.this.extendedPaddingEnd; | ||||
|             } | ||||
|  | ||||
|             @Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size | ||||
|             public ViewGroup.LayoutParams getLayoutParams() { | ||||
|                 return new ViewGroup.LayoutParams(-1, ExtendedFloatingActionButton.this.originalHeight == 0 ? -2 : ExtendedFloatingActionButton.this.originalHeight); | ||||
|             } | ||||
|         }; | ||||
|         return i != 1 ? i != 2 ? new Size() { // from class: com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.4 | ||||
|             @Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size | ||||
|             public int getWidth() { | ||||
|                 if (ExtendedFloatingActionButton.this.originalWidth != -1) { | ||||
|                     if (ExtendedFloatingActionButton.this.originalWidth != 0 && ExtendedFloatingActionButton.this.originalWidth != -2) { | ||||
|                         return ExtendedFloatingActionButton.this.originalWidth; | ||||
|                     } | ||||
|                     return size.getWidth(); | ||||
|                 } | ||||
|                 return size2.getWidth(); | ||||
|             } | ||||
|  | ||||
|             @Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size | ||||
|             public int getHeight() { | ||||
|                 if (ExtendedFloatingActionButton.this.originalHeight != -1) { | ||||
|                     if (ExtendedFloatingActionButton.this.originalHeight != 0 && ExtendedFloatingActionButton.this.originalHeight != -2) { | ||||
|                         return ExtendedFloatingActionButton.this.originalHeight; | ||||
|                     } | ||||
|                     return size.getHeight(); | ||||
|                 } | ||||
|                 return size2.getHeight(); | ||||
|             } | ||||
|  | ||||
|             @Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size | ||||
|             public int getPaddingStart() { | ||||
|                 return ExtendedFloatingActionButton.this.extendedPaddingStart; | ||||
|             } | ||||
|  | ||||
|             @Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size | ||||
|             public int getPaddingEnd() { | ||||
|                 return ExtendedFloatingActionButton.this.extendedPaddingEnd; | ||||
|             } | ||||
|  | ||||
|             @Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size | ||||
|             public ViewGroup.LayoutParams getLayoutParams() { | ||||
|                 return new ViewGroup.LayoutParams(ExtendedFloatingActionButton.this.originalWidth == 0 ? -2 : ExtendedFloatingActionButton.this.originalWidth, ExtendedFloatingActionButton.this.originalHeight != 0 ? ExtendedFloatingActionButton.this.originalHeight : -2); | ||||
|             } | ||||
|         } : size2 : size; | ||||
|     } | ||||
|  | ||||
|     @Override // android.widget.TextView | ||||
|     public void setTextColor(int i) { | ||||
|         super.setTextColor(i); | ||||
|         saveOriginalTextCsl(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.widget.TextView | ||||
|     public void setTextColor(ColorStateList colorStateList) { | ||||
|         super.setTextColor(colorStateList); | ||||
|         saveOriginalTextCsl(); | ||||
|     } | ||||
|  | ||||
|     private void saveOriginalTextCsl() { | ||||
|         this.originalTextCsl = getTextColors(); | ||||
|     } | ||||
|  | ||||
|     protected void silentlyUpdateTextColor(ColorStateList colorStateList) { | ||||
|         super.setTextColor(colorStateList); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.button.MaterialButton, android.widget.TextView, android.view.View | ||||
|     protected void onAttachedToWindow() { | ||||
|         super.onAttachedToWindow(); | ||||
|         if (this.isExtended && TextUtils.isEmpty(getText()) && getIcon() != null) { | ||||
|             this.isExtended = false; | ||||
|             this.shrinkStrategy.performNow(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setExtended(boolean z) { | ||||
|         if (this.isExtended == z) { | ||||
|             return; | ||||
|         } | ||||
|         MotionStrategy motionStrategy = z ? this.extendStrategy : this.shrinkStrategy; | ||||
|         if (motionStrategy.shouldCancel()) { | ||||
|             return; | ||||
|         } | ||||
|         motionStrategy.performNow(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.widget.TextView, android.view.View | ||||
|     public void setPaddingRelative(int i, int i2, int i3, int i4) { | ||||
|         super.setPaddingRelative(i, i2, i3, i4); | ||||
|         if (!this.isExtended || this.isTransforming) { | ||||
|             return; | ||||
|         } | ||||
|         this.extendedPaddingStart = i; | ||||
|         this.extendedPaddingEnd = i3; | ||||
|     } | ||||
|  | ||||
|     @Override // android.widget.TextView, android.view.View | ||||
|     public void setPadding(int i, int i2, int i3, int i4) { | ||||
|         super.setPadding(i, i2, i3, i4); | ||||
|         if (!this.isExtended || this.isTransforming) { | ||||
|             return; | ||||
|         } | ||||
|         this.extendedPaddingStart = ViewCompat.getPaddingStart(this); | ||||
|         this.extendedPaddingEnd = ViewCompat.getPaddingEnd(this); | ||||
|     } | ||||
|  | ||||
|     public void addOnShowAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         this.showStrategy.addAnimationListener(animatorListener); | ||||
|     } | ||||
|  | ||||
|     public void removeOnShowAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         this.showStrategy.removeAnimationListener(animatorListener); | ||||
|     } | ||||
|  | ||||
|     public void addOnHideAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         this.hideStrategy.addAnimationListener(animatorListener); | ||||
|     } | ||||
|  | ||||
|     public void removeOnHideAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         this.hideStrategy.removeAnimationListener(animatorListener); | ||||
|     } | ||||
|  | ||||
|     public void addOnShrinkAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         this.shrinkStrategy.addAnimationListener(animatorListener); | ||||
|     } | ||||
|  | ||||
|     public void removeOnShrinkAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         this.shrinkStrategy.removeAnimationListener(animatorListener); | ||||
|     } | ||||
|  | ||||
|     public void addOnExtendAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         this.extendStrategy.addAnimationListener(animatorListener); | ||||
|     } | ||||
|  | ||||
|     public void removeOnExtendAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         this.extendStrategy.removeAnimationListener(animatorListener); | ||||
|     } | ||||
|  | ||||
|     public void hide() { | ||||
|         performMotion(1, null); | ||||
|     } | ||||
|  | ||||
|     public void hide(OnChangedCallback onChangedCallback) { | ||||
|         performMotion(1, onChangedCallback); | ||||
|     } | ||||
|  | ||||
|     public void show() { | ||||
|         performMotion(0, null); | ||||
|     } | ||||
|  | ||||
|     public void show(OnChangedCallback onChangedCallback) { | ||||
|         performMotion(0, onChangedCallback); | ||||
|     } | ||||
|  | ||||
|     public void extend() { | ||||
|         performMotion(3, null); | ||||
|     } | ||||
|  | ||||
|     public void extend(OnChangedCallback onChangedCallback) { | ||||
|         performMotion(3, onChangedCallback); | ||||
|     } | ||||
|  | ||||
|     public void shrink() { | ||||
|         performMotion(2, null); | ||||
|     } | ||||
|  | ||||
|     public void shrink(OnChangedCallback onChangedCallback) { | ||||
|         performMotion(2, onChangedCallback); | ||||
|     } | ||||
|  | ||||
|     public MotionSpec getShowMotionSpec() { | ||||
|         return this.showStrategy.getMotionSpec(); | ||||
|     } | ||||
|  | ||||
|     public void setShowMotionSpec(MotionSpec motionSpec) { | ||||
|         this.showStrategy.setMotionSpec(motionSpec); | ||||
|     } | ||||
|  | ||||
|     public void setShowMotionSpecResource(int i) { | ||||
|         setShowMotionSpec(MotionSpec.createFromResource(getContext(), i)); | ||||
|     } | ||||
|  | ||||
|     public MotionSpec getHideMotionSpec() { | ||||
|         return this.hideStrategy.getMotionSpec(); | ||||
|     } | ||||
|  | ||||
|     public void setHideMotionSpec(MotionSpec motionSpec) { | ||||
|         this.hideStrategy.setMotionSpec(motionSpec); | ||||
|     } | ||||
|  | ||||
|     public void setHideMotionSpecResource(int i) { | ||||
|         setHideMotionSpec(MotionSpec.createFromResource(getContext(), i)); | ||||
|     } | ||||
|  | ||||
|     public MotionSpec getExtendMotionSpec() { | ||||
|         return this.extendStrategy.getMotionSpec(); | ||||
|     } | ||||
|  | ||||
|     public void setExtendMotionSpec(MotionSpec motionSpec) { | ||||
|         this.extendStrategy.setMotionSpec(motionSpec); | ||||
|     } | ||||
|  | ||||
|     public void setExtendMotionSpecResource(int i) { | ||||
|         setExtendMotionSpec(MotionSpec.createFromResource(getContext(), i)); | ||||
|     } | ||||
|  | ||||
|     public MotionSpec getShrinkMotionSpec() { | ||||
|         return this.shrinkStrategy.getMotionSpec(); | ||||
|     } | ||||
|  | ||||
|     public void setShrinkMotionSpec(MotionSpec motionSpec) { | ||||
|         this.shrinkStrategy.setMotionSpec(motionSpec); | ||||
|     } | ||||
|  | ||||
|     public void setShrinkMotionSpecResource(int i) { | ||||
|         setShrinkMotionSpec(MotionSpec.createFromResource(getContext(), i)); | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public void performMotion(int i, final OnChangedCallback onChangedCallback) { | ||||
|         final MotionStrategy motionStrategy; | ||||
|         if (i == 0) { | ||||
|             motionStrategy = this.showStrategy; | ||||
|         } else if (i == 1) { | ||||
|             motionStrategy = this.hideStrategy; | ||||
|         } else if (i == 2) { | ||||
|             motionStrategy = this.shrinkStrategy; | ||||
|         } else { | ||||
|             if (i != 3) { | ||||
|                 throw new IllegalStateException("Unknown strategy type: " + i); | ||||
|             } | ||||
|             motionStrategy = this.extendStrategy; | ||||
|         } | ||||
|         if (motionStrategy.shouldCancel()) { | ||||
|             return; | ||||
|         } | ||||
|         if (!shouldAnimateVisibilityChange()) { | ||||
|             motionStrategy.performNow(); | ||||
|             motionStrategy.onChange(onChangedCallback); | ||||
|             return; | ||||
|         } | ||||
|         if (i == 2) { | ||||
|             ViewGroup.LayoutParams layoutParams = getLayoutParams(); | ||||
|             if (layoutParams != null) { | ||||
|                 this.originalWidth = layoutParams.width; | ||||
|                 this.originalHeight = layoutParams.height; | ||||
|             } else { | ||||
|                 this.originalWidth = getWidth(); | ||||
|                 this.originalHeight = getHeight(); | ||||
|             } | ||||
|         } | ||||
|         measure(0, 0); | ||||
|         AnimatorSet createAnimator = motionStrategy.createAnimator(); | ||||
|         createAnimator.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.5 | ||||
|             private boolean cancelled; | ||||
|  | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationStart(Animator animator) { | ||||
|                 motionStrategy.onAnimationStart(animator); | ||||
|                 this.cancelled = false; | ||||
|             } | ||||
|  | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationCancel(Animator animator) { | ||||
|                 this.cancelled = true; | ||||
|                 motionStrategy.onAnimationCancel(); | ||||
|             } | ||||
|  | ||||
|             @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|             public void onAnimationEnd(Animator animator) { | ||||
|                 motionStrategy.onAnimationEnd(); | ||||
|                 if (this.cancelled) { | ||||
|                     return; | ||||
|                 } | ||||
|                 motionStrategy.onChange(onChangedCallback); | ||||
|             } | ||||
|         }); | ||||
|         Iterator<Animator.AnimatorListener> it = motionStrategy.getListeners().iterator(); | ||||
|         while (it.hasNext()) { | ||||
|             createAnimator.addListener(it.next()); | ||||
|         } | ||||
|         createAnimator.start(); | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public boolean isOrWillBeShown() { | ||||
|         return getVisibility() != 0 ? this.animState == 2 : this.animState != 1; | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public boolean isOrWillBeHidden() { | ||||
|         return getVisibility() == 0 ? this.animState == 1 : this.animState != 2; | ||||
|     } | ||||
|  | ||||
|     private boolean shouldAnimateVisibilityChange() { | ||||
|         return (ViewCompat.isLaidOut(this) || (!isOrWillBeShown() && this.animateShowBeforeLayout)) && !isInEditMode(); | ||||
|     } | ||||
|  | ||||
|     int getCollapsedSize() { | ||||
|         int i = this.collapsedSize; | ||||
|         return i < 0 ? (Math.min(ViewCompat.getPaddingStart(this), ViewCompat.getPaddingEnd(this)) * 2) + getIconSize() : i; | ||||
|     } | ||||
|  | ||||
|     int getCollapsedPadding() { | ||||
|         return (getCollapsedSize() - getIconSize()) / 2; | ||||
|     } | ||||
|  | ||||
|     protected static class ExtendedFloatingActionButtonBehavior<T extends ExtendedFloatingActionButton> extends CoordinatorLayout.Behavior<T> { | ||||
|         private static final boolean AUTO_HIDE_DEFAULT = false; | ||||
|         private static final boolean AUTO_SHRINK_DEFAULT = true; | ||||
|         private boolean autoHideEnabled; | ||||
|         private boolean autoShrinkEnabled; | ||||
|         private OnChangedCallback internalAutoHideCallback; | ||||
|         private OnChangedCallback internalAutoShrinkCallback; | ||||
|         private Rect tmpRect; | ||||
|  | ||||
|         public boolean isAutoHideEnabled() { | ||||
|             return this.autoHideEnabled; | ||||
|         } | ||||
|  | ||||
|         public boolean isAutoShrinkEnabled() { | ||||
|             return this.autoShrinkEnabled; | ||||
|         } | ||||
|  | ||||
|         public void setAutoHideEnabled(boolean z) { | ||||
|             this.autoHideEnabled = z; | ||||
|         } | ||||
|  | ||||
|         public void setAutoShrinkEnabled(boolean z) { | ||||
|             this.autoShrinkEnabled = z; | ||||
|         } | ||||
|  | ||||
|         void setInternalAutoHideCallback(OnChangedCallback onChangedCallback) { | ||||
|             this.internalAutoHideCallback = onChangedCallback; | ||||
|         } | ||||
|  | ||||
|         void setInternalAutoShrinkCallback(OnChangedCallback onChangedCallback) { | ||||
|             this.internalAutoShrinkCallback = onChangedCallback; | ||||
|         } | ||||
|  | ||||
|         public ExtendedFloatingActionButtonBehavior() { | ||||
|             this.autoHideEnabled = false; | ||||
|             this.autoShrinkEnabled = AUTO_SHRINK_DEFAULT; | ||||
|         } | ||||
|  | ||||
|         public ExtendedFloatingActionButtonBehavior(Context context, AttributeSet attributeSet) { | ||||
|             super(context, attributeSet); | ||||
|             TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.ExtendedFloatingActionButton_Behavior_Layout); | ||||
|             this.autoHideEnabled = obtainStyledAttributes.getBoolean(R.styleable.ExtendedFloatingActionButton_Behavior_Layout_behavior_autoHide, false); | ||||
|             this.autoShrinkEnabled = obtainStyledAttributes.getBoolean(R.styleable.ExtendedFloatingActionButton_Behavior_Layout_behavior_autoShrink, AUTO_SHRINK_DEFAULT); | ||||
|             obtainStyledAttributes.recycle(); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|         public boolean getInsetDodgeRect(CoordinatorLayout coordinatorLayout, ExtendedFloatingActionButton extendedFloatingActionButton, Rect rect) { | ||||
|             return super.getInsetDodgeRect(coordinatorLayout, (CoordinatorLayout) extendedFloatingActionButton, rect); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|         public void onAttachedToLayoutParams(CoordinatorLayout.LayoutParams layoutParams) { | ||||
|             if (layoutParams.dodgeInsetEdges == 0) { | ||||
|                 layoutParams.dodgeInsetEdges = 80; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|         public boolean onDependentViewChanged(CoordinatorLayout coordinatorLayout, ExtendedFloatingActionButton extendedFloatingActionButton, View view) { | ||||
|             if (view instanceof AppBarLayout) { | ||||
|                 updateFabVisibilityForAppBarLayout(coordinatorLayout, (AppBarLayout) view, extendedFloatingActionButton); | ||||
|                 return false; | ||||
|             } | ||||
|             if (!isBottomSheet(view)) { | ||||
|                 return false; | ||||
|             } | ||||
|             updateFabVisibilityForBottomSheet(view, extendedFloatingActionButton); | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         private static boolean isBottomSheet(View view) { | ||||
|             ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); | ||||
|             if (layoutParams instanceof CoordinatorLayout.LayoutParams) { | ||||
|                 return ((CoordinatorLayout.LayoutParams) layoutParams).getBehavior() instanceof BottomSheetBehavior; | ||||
|             } | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         private boolean shouldUpdateVisibility(View view, ExtendedFloatingActionButton extendedFloatingActionButton) { | ||||
|             CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) extendedFloatingActionButton.getLayoutParams(); | ||||
|             if ((this.autoHideEnabled || this.autoShrinkEnabled) && layoutParams.getAnchorId() == view.getId()) { | ||||
|                 return AUTO_SHRINK_DEFAULT; | ||||
|             } | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         private boolean updateFabVisibilityForAppBarLayout(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, ExtendedFloatingActionButton extendedFloatingActionButton) { | ||||
|             if (!shouldUpdateVisibility(appBarLayout, extendedFloatingActionButton)) { | ||||
|                 return false; | ||||
|             } | ||||
|             if (this.tmpRect == null) { | ||||
|                 this.tmpRect = new Rect(); | ||||
|             } | ||||
|             Rect rect = this.tmpRect; | ||||
|             DescendantOffsetUtils.getDescendantRect(coordinatorLayout, appBarLayout, rect); | ||||
|             if (rect.bottom <= appBarLayout.getMinimumHeightForVisibleOverlappingContent()) { | ||||
|                 shrinkOrHide(extendedFloatingActionButton); | ||||
|                 return AUTO_SHRINK_DEFAULT; | ||||
|             } | ||||
|             extendOrShow(extendedFloatingActionButton); | ||||
|             return AUTO_SHRINK_DEFAULT; | ||||
|         } | ||||
|  | ||||
|         private boolean updateFabVisibilityForBottomSheet(View view, ExtendedFloatingActionButton extendedFloatingActionButton) { | ||||
|             if (!shouldUpdateVisibility(view, extendedFloatingActionButton)) { | ||||
|                 return false; | ||||
|             } | ||||
|             if (view.getTop() < (extendedFloatingActionButton.getHeight() / 2) + ((CoordinatorLayout.LayoutParams) extendedFloatingActionButton.getLayoutParams()).topMargin) { | ||||
|                 shrinkOrHide(extendedFloatingActionButton); | ||||
|                 return AUTO_SHRINK_DEFAULT; | ||||
|             } | ||||
|             extendOrShow(extendedFloatingActionButton); | ||||
|             return AUTO_SHRINK_DEFAULT; | ||||
|         } | ||||
|  | ||||
|         protected void shrinkOrHide(ExtendedFloatingActionButton extendedFloatingActionButton) { | ||||
|             boolean z = this.autoShrinkEnabled; | ||||
|             extendedFloatingActionButton.performMotion(z ? 2 : 1, z ? this.internalAutoShrinkCallback : this.internalAutoHideCallback); | ||||
|         } | ||||
|  | ||||
|         protected void extendOrShow(ExtendedFloatingActionButton extendedFloatingActionButton) { | ||||
|             boolean z = this.autoShrinkEnabled; | ||||
|             extendedFloatingActionButton.performMotion(z ? 3 : 0, z ? this.internalAutoShrinkCallback : this.internalAutoHideCallback); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|         public boolean onLayoutChild(CoordinatorLayout coordinatorLayout, ExtendedFloatingActionButton extendedFloatingActionButton, int i) { | ||||
|             List<View> dependencies = coordinatorLayout.getDependencies(extendedFloatingActionButton); | ||||
|             int size = dependencies.size(); | ||||
|             for (int i2 = 0; i2 < size; i2++) { | ||||
|                 View view = dependencies.get(i2); | ||||
|                 if (view instanceof AppBarLayout) { | ||||
|                     if (updateFabVisibilityForAppBarLayout(coordinatorLayout, (AppBarLayout) view, extendedFloatingActionButton)) { | ||||
|                         break; | ||||
|                     } | ||||
|                 } else { | ||||
|                     if (isBottomSheet(view) && updateFabVisibilityForBottomSheet(view, extendedFloatingActionButton)) { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             coordinatorLayout.onLayoutChild(extendedFloatingActionButton, i); | ||||
|             return AUTO_SHRINK_DEFAULT; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     class ChangeSizeStrategy extends BaseMotionStrategy { | ||||
|         private final boolean extending; | ||||
|         private final Size size; | ||||
|  | ||||
|         ChangeSizeStrategy(AnimatorTracker animatorTracker, Size size, boolean z) { | ||||
|             super(ExtendedFloatingActionButton.this, animatorTracker); | ||||
|             this.size = size; | ||||
|             this.extending = z; | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public void performNow() { | ||||
|             ExtendedFloatingActionButton.this.isExtended = this.extending; | ||||
|             ViewGroup.LayoutParams layoutParams = ExtendedFloatingActionButton.this.getLayoutParams(); | ||||
|             if (layoutParams == null) { | ||||
|                 return; | ||||
|             } | ||||
|             if (!this.extending) { | ||||
|                 ExtendedFloatingActionButton.this.originalWidth = layoutParams.width; | ||||
|                 ExtendedFloatingActionButton.this.originalHeight = layoutParams.height; | ||||
|             } | ||||
|             layoutParams.width = this.size.getLayoutParams().width; | ||||
|             layoutParams.height = this.size.getLayoutParams().height; | ||||
|             ViewCompat.setPaddingRelative(ExtendedFloatingActionButton.this, this.size.getPaddingStart(), ExtendedFloatingActionButton.this.getPaddingTop(), this.size.getPaddingEnd(), ExtendedFloatingActionButton.this.getPaddingBottom()); | ||||
|             ExtendedFloatingActionButton.this.requestLayout(); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public void onChange(OnChangedCallback onChangedCallback) { | ||||
|             if (onChangedCallback == null) { | ||||
|                 return; | ||||
|             } | ||||
|             if (this.extending) { | ||||
|                 onChangedCallback.onExtended(ExtendedFloatingActionButton.this); | ||||
|             } else { | ||||
|                 onChangedCallback.onShrunken(ExtendedFloatingActionButton.this); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public int getDefaultMotionSpecResource() { | ||||
|             if (this.extending) { | ||||
|                 return R.animator.mtrl_extended_fab_change_size_expand_motion_spec; | ||||
|             } | ||||
|             return R.animator.mtrl_extended_fab_change_size_collapse_motion_spec; | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.BaseMotionStrategy, com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public AnimatorSet createAnimator() { | ||||
|             MotionSpec currentMotionSpec = getCurrentMotionSpec(); | ||||
|             if (currentMotionSpec.hasPropertyValues("width")) { | ||||
|                 PropertyValuesHolder[] propertyValues = currentMotionSpec.getPropertyValues("width"); | ||||
|                 propertyValues[0].setFloatValues(ExtendedFloatingActionButton.this.getWidth(), this.size.getWidth()); | ||||
|                 currentMotionSpec.setPropertyValues("width", propertyValues); | ||||
|             } | ||||
|             if (currentMotionSpec.hasPropertyValues("height")) { | ||||
|                 PropertyValuesHolder[] propertyValues2 = currentMotionSpec.getPropertyValues("height"); | ||||
|                 propertyValues2[0].setFloatValues(ExtendedFloatingActionButton.this.getHeight(), this.size.getHeight()); | ||||
|                 currentMotionSpec.setPropertyValues("height", propertyValues2); | ||||
|             } | ||||
|             if (currentMotionSpec.hasPropertyValues("paddingStart")) { | ||||
|                 PropertyValuesHolder[] propertyValues3 = currentMotionSpec.getPropertyValues("paddingStart"); | ||||
|                 propertyValues3[0].setFloatValues(ViewCompat.getPaddingStart(ExtendedFloatingActionButton.this), this.size.getPaddingStart()); | ||||
|                 currentMotionSpec.setPropertyValues("paddingStart", propertyValues3); | ||||
|             } | ||||
|             if (currentMotionSpec.hasPropertyValues("paddingEnd")) { | ||||
|                 PropertyValuesHolder[] propertyValues4 = currentMotionSpec.getPropertyValues("paddingEnd"); | ||||
|                 propertyValues4[0].setFloatValues(ViewCompat.getPaddingEnd(ExtendedFloatingActionButton.this), this.size.getPaddingEnd()); | ||||
|                 currentMotionSpec.setPropertyValues("paddingEnd", propertyValues4); | ||||
|             } | ||||
|             if (currentMotionSpec.hasPropertyValues("labelOpacity")) { | ||||
|                 PropertyValuesHolder[] propertyValues5 = currentMotionSpec.getPropertyValues("labelOpacity"); | ||||
|                 boolean z = this.extending; | ||||
|                 propertyValues5[0].setFloatValues(z ? 0.0f : 1.0f, z ? 1.0f : 0.0f); | ||||
|                 currentMotionSpec.setPropertyValues("labelOpacity", propertyValues5); | ||||
|             } | ||||
|             return super.createAnimator(currentMotionSpec); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.BaseMotionStrategy, com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public void onAnimationStart(Animator animator) { | ||||
|             super.onAnimationStart(animator); | ||||
|             ExtendedFloatingActionButton.this.isExtended = this.extending; | ||||
|             ExtendedFloatingActionButton.this.isTransforming = true; | ||||
|             ExtendedFloatingActionButton.this.setHorizontallyScrolling(true); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.BaseMotionStrategy, com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public void onAnimationEnd() { | ||||
|             super.onAnimationEnd(); | ||||
|             ExtendedFloatingActionButton.this.isTransforming = false; | ||||
|             ExtendedFloatingActionButton.this.setHorizontallyScrolling(false); | ||||
|             ViewGroup.LayoutParams layoutParams = ExtendedFloatingActionButton.this.getLayoutParams(); | ||||
|             if (layoutParams == null) { | ||||
|                 return; | ||||
|             } | ||||
|             layoutParams.width = this.size.getLayoutParams().width; | ||||
|             layoutParams.height = this.size.getLayoutParams().height; | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public boolean shouldCancel() { | ||||
|             return this.extending == ExtendedFloatingActionButton.this.isExtended || ExtendedFloatingActionButton.this.getIcon() == null || TextUtils.isEmpty(ExtendedFloatingActionButton.this.getText()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     class ShowStrategy extends BaseMotionStrategy { | ||||
|         public ShowStrategy(AnimatorTracker animatorTracker) { | ||||
|             super(ExtendedFloatingActionButton.this, animatorTracker); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public void performNow() { | ||||
|             ExtendedFloatingActionButton.this.setVisibility(0); | ||||
|             ExtendedFloatingActionButton.this.setAlpha(1.0f); | ||||
|             ExtendedFloatingActionButton.this.setScaleY(1.0f); | ||||
|             ExtendedFloatingActionButton.this.setScaleX(1.0f); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public void onChange(OnChangedCallback onChangedCallback) { | ||||
|             if (onChangedCallback != null) { | ||||
|                 onChangedCallback.onShown(ExtendedFloatingActionButton.this); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public int getDefaultMotionSpecResource() { | ||||
|             return R.animator.mtrl_extended_fab_show_motion_spec; | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.BaseMotionStrategy, com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public void onAnimationStart(Animator animator) { | ||||
|             super.onAnimationStart(animator); | ||||
|             ExtendedFloatingActionButton.this.setVisibility(0); | ||||
|             ExtendedFloatingActionButton.this.animState = 2; | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.BaseMotionStrategy, com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public void onAnimationEnd() { | ||||
|             super.onAnimationEnd(); | ||||
|             ExtendedFloatingActionButton.this.animState = 0; | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public boolean shouldCancel() { | ||||
|             return ExtendedFloatingActionButton.this.isOrWillBeShown(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     class HideStrategy extends BaseMotionStrategy { | ||||
|         private boolean isCancelled; | ||||
|  | ||||
|         public HideStrategy(AnimatorTracker animatorTracker) { | ||||
|             super(ExtendedFloatingActionButton.this, animatorTracker); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public void performNow() { | ||||
|             ExtendedFloatingActionButton.this.setVisibility(8); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public void onChange(OnChangedCallback onChangedCallback) { | ||||
|             if (onChangedCallback != null) { | ||||
|                 onChangedCallback.onHidden(ExtendedFloatingActionButton.this); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public boolean shouldCancel() { | ||||
|             return ExtendedFloatingActionButton.this.isOrWillBeHidden(); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public int getDefaultMotionSpecResource() { | ||||
|             return R.animator.mtrl_extended_fab_hide_motion_spec; | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.BaseMotionStrategy, com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public void onAnimationStart(Animator animator) { | ||||
|             super.onAnimationStart(animator); | ||||
|             this.isCancelled = false; | ||||
|             ExtendedFloatingActionButton.this.setVisibility(0); | ||||
|             ExtendedFloatingActionButton.this.animState = 1; | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.BaseMotionStrategy, com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public void onAnimationCancel() { | ||||
|             super.onAnimationCancel(); | ||||
|             this.isCancelled = true; | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.BaseMotionStrategy, com.google.android.material.floatingactionbutton.MotionStrategy | ||||
|         public void onAnimationEnd() { | ||||
|             super.onAnimationEnd(); | ||||
|             ExtendedFloatingActionButton.this.animState = 0; | ||||
|             if (this.isCancelled) { | ||||
|                 return; | ||||
|             } | ||||
|             ExtendedFloatingActionButton.this.setVisibility(8); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,898 @@ | ||||
| package com.google.android.material.floatingactionbutton; | ||||
|  | ||||
| import android.animation.Animator; | ||||
| import android.content.Context; | ||||
| import android.content.res.ColorStateList; | ||||
| import android.content.res.Resources; | ||||
| import android.content.res.TypedArray; | ||||
| import android.graphics.PorterDuff; | ||||
| import android.graphics.Rect; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.os.Bundle; | ||||
| import android.os.Parcelable; | ||||
| import android.util.AttributeSet; | ||||
| import android.util.Log; | ||||
| import android.view.MotionEvent; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import androidx.appcompat.widget.AppCompatDrawableManager; | ||||
| import androidx.appcompat.widget.AppCompatImageHelper; | ||||
| import androidx.coordinatorlayout.widget.CoordinatorLayout; | ||||
| import androidx.core.graphics.drawable.DrawableCompat; | ||||
| import androidx.core.util.Preconditions; | ||||
| import androidx.core.view.TintableBackgroundView; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import androidx.core.widget.TintableImageSourceView; | ||||
| import com.google.android.material.R; | ||||
| import com.google.android.material.animation.MotionSpec; | ||||
| import com.google.android.material.animation.TransformationCallback; | ||||
| import com.google.android.material.appbar.AppBarLayout; | ||||
| import com.google.android.material.bottomsheet.BottomSheetBehavior; | ||||
| import com.google.android.material.expandable.ExpandableTransformationWidget; | ||||
| import com.google.android.material.expandable.ExpandableWidgetHelper; | ||||
| import com.google.android.material.floatingactionbutton.FloatingActionButtonImpl; | ||||
| import com.google.android.material.internal.DescendantOffsetUtils; | ||||
| import com.google.android.material.internal.VisibilityAwareImageButton; | ||||
| import com.google.android.material.shadow.ShadowViewDelegate; | ||||
| import com.google.android.material.shape.ShapeAppearanceModel; | ||||
| import com.google.android.material.shape.Shapeable; | ||||
| import com.google.android.material.stateful.ExtendableSavedState; | ||||
| import java.lang.annotation.Retention; | ||||
| import java.lang.annotation.RetentionPolicy; | ||||
| import java.util.List; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| public class FloatingActionButton extends VisibilityAwareImageButton implements TintableBackgroundView, TintableImageSourceView, ExpandableTransformationWidget, Shapeable, CoordinatorLayout.AttachedBehavior { | ||||
|     private static final int AUTO_MINI_LARGEST_SCREEN_WIDTH = 470; | ||||
|     private static final int DEF_STYLE_RES = R.style.Widget_Design_FloatingActionButton; | ||||
|     private static final String EXPANDABLE_WIDGET_HELPER_KEY = "expandableWidgetHelper"; | ||||
|     private static final String LOG_TAG = "FloatingActionButton"; | ||||
|     public static final int NO_CUSTOM_SIZE = 0; | ||||
|     public static final int SIZE_AUTO = -1; | ||||
|     public static final int SIZE_MINI = 1; | ||||
|     public static final int SIZE_NORMAL = 0; | ||||
|     private ColorStateList backgroundTint; | ||||
|     private PorterDuff.Mode backgroundTintMode; | ||||
|     private int borderWidth; | ||||
|     boolean compatPadding; | ||||
|     private int customSize; | ||||
|     private final ExpandableWidgetHelper expandableWidgetHelper; | ||||
|     private final AppCompatImageHelper imageHelper; | ||||
|     private PorterDuff.Mode imageMode; | ||||
|     private int imagePadding; | ||||
|     private ColorStateList imageTint; | ||||
|     private FloatingActionButtonImpl impl; | ||||
|     private int maxImageSize; | ||||
|     private ColorStateList rippleColor; | ||||
|     final Rect shadowPadding; | ||||
|     private int size; | ||||
|     private final Rect touchArea; | ||||
|  | ||||
|     public static abstract class OnVisibilityChangedListener { | ||||
|         public void onHidden(FloatingActionButton floatingActionButton) { | ||||
|         } | ||||
|  | ||||
|         public void onShown(FloatingActionButton floatingActionButton) { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Retention(RetentionPolicy.SOURCE) | ||||
|     public @interface Size { | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public ColorStateList getBackgroundTintList() { | ||||
|         return this.backgroundTint; | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public PorterDuff.Mode getBackgroundTintMode() { | ||||
|         return this.backgroundTintMode; | ||||
|     } | ||||
|  | ||||
|     public int getCustomSize() { | ||||
|         return this.customSize; | ||||
|     } | ||||
|  | ||||
|     public ColorStateList getRippleColorStateList() { | ||||
|         return this.rippleColor; | ||||
|     } | ||||
|  | ||||
|     public int getSize() { | ||||
|         return this.size; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.core.widget.TintableImageSourceView | ||||
|     public ColorStateList getSupportImageTintList() { | ||||
|         return this.imageTint; | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.core.widget.TintableImageSourceView | ||||
|     public PorterDuff.Mode getSupportImageTintMode() { | ||||
|         return this.imageMode; | ||||
|     } | ||||
|  | ||||
|     public boolean getUseCompatPadding() { | ||||
|         return this.compatPadding; | ||||
|     } | ||||
|  | ||||
|     public FloatingActionButton(Context context) { | ||||
|         this(context, null); | ||||
|     } | ||||
|  | ||||
|     public FloatingActionButton(Context context, AttributeSet attributeSet) { | ||||
|         this(context, attributeSet, R.attr.floatingActionButtonStyle); | ||||
|     } | ||||
|  | ||||
|     /* 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 FloatingActionButton(android.content.Context r11, android.util.AttributeSet r12, int r13) { | ||||
|         /* | ||||
|             Method dump skipped, instructions count: 275 | ||||
|             To view this dump add '--comments-level debug' option | ||||
|         */ | ||||
|         throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.floatingactionbutton.FloatingActionButton.<init>(android.content.Context, android.util.AttributeSet, int):void"); | ||||
|     } | ||||
|  | ||||
|     @Override // android.widget.ImageView, android.view.View | ||||
|     protected void onMeasure(int i, int i2) { | ||||
|         int sizeDimension = getSizeDimension(); | ||||
|         this.imagePadding = (sizeDimension - this.maxImageSize) / 2; | ||||
|         getImpl().updatePadding(); | ||||
|         int min = Math.min(View.resolveSize(sizeDimension, i), View.resolveSize(sizeDimension, i2)); | ||||
|         setMeasuredDimension(this.shadowPadding.left + min + this.shadowPadding.right, min + this.shadowPadding.top + this.shadowPadding.bottom); | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public int getRippleColor() { | ||||
|         ColorStateList colorStateList = this.rippleColor; | ||||
|         if (colorStateList != null) { | ||||
|             return colorStateList.getDefaultColor(); | ||||
|         } | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     public void setRippleColor(int i) { | ||||
|         setRippleColor(ColorStateList.valueOf(i)); | ||||
|     } | ||||
|  | ||||
|     public void setRippleColor(ColorStateList colorStateList) { | ||||
|         if (this.rippleColor != colorStateList) { | ||||
|             this.rippleColor = colorStateList; | ||||
|             getImpl().setRippleColor(this.rippleColor); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.AttachedBehavior | ||||
|     public CoordinatorLayout.Behavior<FloatingActionButton> getBehavior() { | ||||
|         return new Behavior(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setBackgroundTintList(ColorStateList colorStateList) { | ||||
|         if (this.backgroundTint != colorStateList) { | ||||
|             this.backgroundTint = colorStateList; | ||||
|             getImpl().setBackgroundTintList(colorStateList); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setBackgroundTintMode(PorterDuff.Mode mode) { | ||||
|         if (this.backgroundTintMode != mode) { | ||||
|             this.backgroundTintMode = mode; | ||||
|             getImpl().setBackgroundTintMode(mode); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.core.view.TintableBackgroundView | ||||
|     public void setSupportBackgroundTintList(ColorStateList colorStateList) { | ||||
|         setBackgroundTintList(colorStateList); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.core.view.TintableBackgroundView | ||||
|     public ColorStateList getSupportBackgroundTintList() { | ||||
|         return getBackgroundTintList(); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.core.view.TintableBackgroundView | ||||
|     public void setSupportBackgroundTintMode(PorterDuff.Mode mode) { | ||||
|         setBackgroundTintMode(mode); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.core.view.TintableBackgroundView | ||||
|     public PorterDuff.Mode getSupportBackgroundTintMode() { | ||||
|         return getBackgroundTintMode(); | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.core.widget.TintableImageSourceView | ||||
|     public void setSupportImageTintList(ColorStateList colorStateList) { | ||||
|         if (this.imageTint != colorStateList) { | ||||
|             this.imageTint = colorStateList; | ||||
|             onApplySupportImageTint(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // androidx.core.widget.TintableImageSourceView | ||||
|     public void setSupportImageTintMode(PorterDuff.Mode mode) { | ||||
|         if (this.imageMode != mode) { | ||||
|             this.imageMode = mode; | ||||
|             onApplySupportImageTint(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void onApplySupportImageTint() { | ||||
|         Drawable drawable = getDrawable(); | ||||
|         if (drawable == null) { | ||||
|             return; | ||||
|         } | ||||
|         ColorStateList colorStateList = this.imageTint; | ||||
|         if (colorStateList == null) { | ||||
|             DrawableCompat.clearColorFilter(drawable); | ||||
|             return; | ||||
|         } | ||||
|         int colorForState = colorStateList.getColorForState(getDrawableState(), 0); | ||||
|         PorterDuff.Mode mode = this.imageMode; | ||||
|         if (mode == null) { | ||||
|             mode = PorterDuff.Mode.SRC_IN; | ||||
|         } | ||||
|         drawable.mutate().setColorFilter(AppCompatDrawableManager.getPorterDuffColorFilter(colorForState, mode)); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setBackgroundDrawable(Drawable drawable) { | ||||
|         Log.i(LOG_TAG, "Setting a custom background is not supported."); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setBackgroundResource(int i) { | ||||
|         Log.i(LOG_TAG, "Setting a custom background is not supported."); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setBackgroundColor(int i) { | ||||
|         Log.i(LOG_TAG, "Setting a custom background is not supported."); | ||||
|     } | ||||
|  | ||||
|     @Override // android.widget.ImageView | ||||
|     public void setImageResource(int i) { | ||||
|         this.imageHelper.setImageResource(i); | ||||
|         onApplySupportImageTint(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.widget.ImageView | ||||
|     public void setImageDrawable(Drawable drawable) { | ||||
|         if (getDrawable() != drawable) { | ||||
|             super.setImageDrawable(drawable); | ||||
|             getImpl().updateImageMatrixScale(); | ||||
|             if (this.imageTint != null) { | ||||
|                 onApplySupportImageTint(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.Shapeable | ||||
|     public void setShapeAppearanceModel(ShapeAppearanceModel shapeAppearanceModel) { | ||||
|         getImpl().setShapeAppearance(shapeAppearanceModel); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.shape.Shapeable | ||||
|     public ShapeAppearanceModel getShapeAppearanceModel() { | ||||
|         return (ShapeAppearanceModel) Preconditions.checkNotNull(getImpl().getShapeAppearance()); | ||||
|     } | ||||
|  | ||||
|     public boolean shouldEnsureMinTouchTargetSize() { | ||||
|         return getImpl().getEnsureMinTouchTargetSize(); | ||||
|     } | ||||
|  | ||||
|     public void setEnsureMinTouchTargetSize(boolean z) { | ||||
|         if (z != getImpl().getEnsureMinTouchTargetSize()) { | ||||
|             getImpl().setEnsureMinTouchTargetSize(z); | ||||
|             requestLayout(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.internal.VisibilityAwareImageButton, android.widget.ImageView, android.view.View | ||||
|     public void setVisibility(int i) { | ||||
|         super.setVisibility(i); | ||||
|     } | ||||
|  | ||||
|     public void setMaxImageSize(int i) { | ||||
|         this.maxImageSize = i; | ||||
|         getImpl().setMaxImageSize(i); | ||||
|     } | ||||
|  | ||||
|     public void show() { | ||||
|         show(null); | ||||
|     } | ||||
|  | ||||
|     public void show(OnVisibilityChangedListener onVisibilityChangedListener) { | ||||
|         show(onVisibilityChangedListener, true); | ||||
|     } | ||||
|  | ||||
|     void show(OnVisibilityChangedListener onVisibilityChangedListener, boolean z) { | ||||
|         getImpl().show(wrapOnVisibilityChangedListener(onVisibilityChangedListener), z); | ||||
|     } | ||||
|  | ||||
|     public void addOnShowAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         getImpl().addOnShowAnimationListener(animatorListener); | ||||
|     } | ||||
|  | ||||
|     public void removeOnShowAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         getImpl().removeOnShowAnimationListener(animatorListener); | ||||
|     } | ||||
|  | ||||
|     public void hide() { | ||||
|         hide(null); | ||||
|     } | ||||
|  | ||||
|     public void hide(OnVisibilityChangedListener onVisibilityChangedListener) { | ||||
|         hide(onVisibilityChangedListener, true); | ||||
|     } | ||||
|  | ||||
|     void hide(OnVisibilityChangedListener onVisibilityChangedListener, boolean z) { | ||||
|         getImpl().hide(wrapOnVisibilityChangedListener(onVisibilityChangedListener), z); | ||||
|     } | ||||
|  | ||||
|     public void addOnHideAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         getImpl().addOnHideAnimationListener(animatorListener); | ||||
|     } | ||||
|  | ||||
|     public void removeOnHideAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         getImpl().removeOnHideAnimationListener(animatorListener); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.expandable.ExpandableWidget | ||||
|     public boolean setExpanded(boolean z) { | ||||
|         return this.expandableWidgetHelper.setExpanded(z); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.expandable.ExpandableWidget | ||||
|     public boolean isExpanded() { | ||||
|         return this.expandableWidgetHelper.isExpanded(); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.expandable.ExpandableTransformationWidget | ||||
|     public void setExpandedComponentIdHint(int i) { | ||||
|         this.expandableWidgetHelper.setExpandedComponentIdHint(i); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.expandable.ExpandableTransformationWidget | ||||
|     public int getExpandedComponentIdHint() { | ||||
|         return this.expandableWidgetHelper.getExpandedComponentIdHint(); | ||||
|     } | ||||
|  | ||||
|     public void setUseCompatPadding(boolean z) { | ||||
|         if (this.compatPadding != z) { | ||||
|             this.compatPadding = z; | ||||
|             getImpl().onCompatShadowChanged(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void setSize(int i) { | ||||
|         this.customSize = 0; | ||||
|         if (i != this.size) { | ||||
|             this.size = i; | ||||
|             requestLayout(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private FloatingActionButtonImpl.InternalVisibilityChangedListener wrapOnVisibilityChangedListener(final OnVisibilityChangedListener onVisibilityChangedListener) { | ||||
|         if (onVisibilityChangedListener == null) { | ||||
|             return null; | ||||
|         } | ||||
|         return new FloatingActionButtonImpl.InternalVisibilityChangedListener() { // from class: com.google.android.material.floatingactionbutton.FloatingActionButton.1 | ||||
|             @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl.InternalVisibilityChangedListener | ||||
|             public void onShown() { | ||||
|                 onVisibilityChangedListener.onShown(FloatingActionButton.this); | ||||
|             } | ||||
|  | ||||
|             @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl.InternalVisibilityChangedListener | ||||
|             public void onHidden() { | ||||
|                 onVisibilityChangedListener.onHidden(FloatingActionButton.this); | ||||
|             } | ||||
|         }; | ||||
|     } | ||||
|  | ||||
|     public boolean isOrWillBeHidden() { | ||||
|         return getImpl().isOrWillBeHidden(); | ||||
|     } | ||||
|  | ||||
|     public boolean isOrWillBeShown() { | ||||
|         return getImpl().isOrWillBeShown(); | ||||
|     } | ||||
|  | ||||
|     public void setCustomSize(int i) { | ||||
|         if (i < 0) { | ||||
|             throw new IllegalArgumentException("Custom size must be non-negative"); | ||||
|         } | ||||
|         if (i != this.customSize) { | ||||
|             this.customSize = i; | ||||
|             requestLayout(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void clearCustomSize() { | ||||
|         setCustomSize(0); | ||||
|     } | ||||
|  | ||||
|     int getSizeDimension() { | ||||
|         return getSizeDimension(this.size); | ||||
|     } | ||||
|  | ||||
|     private int getSizeDimension(int i) { | ||||
|         int i2 = this.customSize; | ||||
|         if (i2 != 0) { | ||||
|             return i2; | ||||
|         } | ||||
|         Resources resources = getResources(); | ||||
|         if (i != -1) { | ||||
|             if (i == 1) { | ||||
|                 return resources.getDimensionPixelSize(R.dimen.design_fab_size_mini); | ||||
|             } | ||||
|             return resources.getDimensionPixelSize(R.dimen.design_fab_size_normal); | ||||
|         } | ||||
|         if (Math.max(resources.getConfiguration().screenWidthDp, resources.getConfiguration().screenHeightDp) < AUTO_MINI_LARGEST_SCREEN_WIDTH) { | ||||
|             return getSizeDimension(1); | ||||
|         } | ||||
|         return getSizeDimension(0); | ||||
|     } | ||||
|  | ||||
|     @Override // android.widget.ImageView, android.view.View | ||||
|     protected void onAttachedToWindow() { | ||||
|         super.onAttachedToWindow(); | ||||
|         getImpl().onAttachedToWindow(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.widget.ImageView, android.view.View | ||||
|     protected void onDetachedFromWindow() { | ||||
|         super.onDetachedFromWindow(); | ||||
|         getImpl().onDetachedFromWindow(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.widget.ImageView, android.view.View | ||||
|     protected void drawableStateChanged() { | ||||
|         super.drawableStateChanged(); | ||||
|         getImpl().onDrawableStateChanged(getDrawableState()); | ||||
|     } | ||||
|  | ||||
|     @Override // android.widget.ImageView, android.view.View | ||||
|     public void jumpDrawablesToCurrentState() { | ||||
|         super.jumpDrawablesToCurrentState(); | ||||
|         getImpl().jumpDrawableToCurrentState(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     protected Parcelable onSaveInstanceState() { | ||||
|         Parcelable onSaveInstanceState = super.onSaveInstanceState(); | ||||
|         if (onSaveInstanceState == null) { | ||||
|             onSaveInstanceState = new Bundle(); | ||||
|         } | ||||
|         ExtendableSavedState extendableSavedState = new ExtendableSavedState(onSaveInstanceState); | ||||
|         extendableSavedState.extendableStates.put(EXPANDABLE_WIDGET_HELPER_KEY, this.expandableWidgetHelper.onSaveInstanceState()); | ||||
|         return extendableSavedState; | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     protected void onRestoreInstanceState(Parcelable parcelable) { | ||||
|         if (!(parcelable instanceof ExtendableSavedState)) { | ||||
|             super.onRestoreInstanceState(parcelable); | ||||
|             return; | ||||
|         } | ||||
|         ExtendableSavedState extendableSavedState = (ExtendableSavedState) parcelable; | ||||
|         super.onRestoreInstanceState(extendableSavedState.getSuperState()); | ||||
|         this.expandableWidgetHelper.onRestoreInstanceState((Bundle) Preconditions.checkNotNull(extendableSavedState.extendableStates.get(EXPANDABLE_WIDGET_HELPER_KEY))); | ||||
|     } | ||||
|  | ||||
|     @Deprecated | ||||
|     public boolean getContentRect(Rect rect) { | ||||
|         if (!ViewCompat.isLaidOut(this)) { | ||||
|             return false; | ||||
|         } | ||||
|         rect.set(0, 0, getWidth(), getHeight()); | ||||
|         offsetRectWithShadow(rect); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     public void getMeasuredContentRect(Rect rect) { | ||||
|         rect.set(0, 0, getMeasuredWidth(), getMeasuredHeight()); | ||||
|         offsetRectWithShadow(rect); | ||||
|     } | ||||
|  | ||||
|     private void getTouchTargetRect(Rect rect) { | ||||
|         getMeasuredContentRect(rect); | ||||
|         int i = -this.impl.getTouchTargetPadding(); | ||||
|         rect.inset(i, i); | ||||
|     } | ||||
|  | ||||
|     private void offsetRectWithShadow(Rect rect) { | ||||
|         rect.left += this.shadowPadding.left; | ||||
|         rect.top += this.shadowPadding.top; | ||||
|         rect.right -= this.shadowPadding.right; | ||||
|         rect.bottom -= this.shadowPadding.bottom; | ||||
|     } | ||||
|  | ||||
|     public Drawable getContentBackground() { | ||||
|         return getImpl().getContentBackground(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public boolean onTouchEvent(MotionEvent motionEvent) { | ||||
|         if (motionEvent.getAction() == 0) { | ||||
|             getTouchTargetRect(this.touchArea); | ||||
|             if (!this.touchArea.contains((int) motionEvent.getX(), (int) motionEvent.getY())) { | ||||
|                 return false; | ||||
|             } | ||||
|         } | ||||
|         return super.onTouchEvent(motionEvent); | ||||
|     } | ||||
|  | ||||
|     public static class Behavior extends BaseBehavior<FloatingActionButton> { | ||||
|         @Override // com.google.android.material.floatingactionbutton.FloatingActionButton.BaseBehavior | ||||
|         public /* bridge */ /* synthetic */ boolean getInsetDodgeRect(CoordinatorLayout coordinatorLayout, FloatingActionButton floatingActionButton, Rect rect) { | ||||
|             return super.getInsetDodgeRect(coordinatorLayout, floatingActionButton, rect); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.FloatingActionButton.BaseBehavior | ||||
|         public /* bridge */ /* synthetic */ boolean isAutoHideEnabled() { | ||||
|             return super.isAutoHideEnabled(); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.FloatingActionButton.BaseBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|         public /* bridge */ /* synthetic */ void onAttachedToLayoutParams(CoordinatorLayout.LayoutParams layoutParams) { | ||||
|             super.onAttachedToLayoutParams(layoutParams); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.FloatingActionButton.BaseBehavior | ||||
|         public /* bridge */ /* synthetic */ boolean onDependentViewChanged(CoordinatorLayout coordinatorLayout, FloatingActionButton floatingActionButton, View view) { | ||||
|             return super.onDependentViewChanged(coordinatorLayout, floatingActionButton, view); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.FloatingActionButton.BaseBehavior | ||||
|         public /* bridge */ /* synthetic */ boolean onLayoutChild(CoordinatorLayout coordinatorLayout, FloatingActionButton floatingActionButton, int i) { | ||||
|             return super.onLayoutChild(coordinatorLayout, floatingActionButton, i); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.FloatingActionButton.BaseBehavior | ||||
|         public /* bridge */ /* synthetic */ void setAutoHideEnabled(boolean z) { | ||||
|             super.setAutoHideEnabled(z); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.FloatingActionButton.BaseBehavior | ||||
|         public /* bridge */ /* synthetic */ void setInternalAutoHideListener(OnVisibilityChangedListener onVisibilityChangedListener) { | ||||
|             super.setInternalAutoHideListener(onVisibilityChangedListener); | ||||
|         } | ||||
|  | ||||
|         public Behavior() { | ||||
|         } | ||||
|  | ||||
|         public Behavior(Context context, AttributeSet attributeSet) { | ||||
|             super(context, attributeSet); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     protected static class BaseBehavior<T extends FloatingActionButton> extends CoordinatorLayout.Behavior<T> { | ||||
|         private static final boolean AUTO_HIDE_DEFAULT = true; | ||||
|         private boolean autoHideEnabled; | ||||
|         private OnVisibilityChangedListener internalAutoHideListener; | ||||
|         private Rect tmpRect; | ||||
|  | ||||
|         public boolean isAutoHideEnabled() { | ||||
|             return this.autoHideEnabled; | ||||
|         } | ||||
|  | ||||
|         public void setAutoHideEnabled(boolean z) { | ||||
|             this.autoHideEnabled = z; | ||||
|         } | ||||
|  | ||||
|         public void setInternalAutoHideListener(OnVisibilityChangedListener onVisibilityChangedListener) { | ||||
|             this.internalAutoHideListener = onVisibilityChangedListener; | ||||
|         } | ||||
|  | ||||
|         public BaseBehavior() { | ||||
|             this.autoHideEnabled = AUTO_HIDE_DEFAULT; | ||||
|         } | ||||
|  | ||||
|         public BaseBehavior(Context context, AttributeSet attributeSet) { | ||||
|             super(context, attributeSet); | ||||
|             TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.FloatingActionButton_Behavior_Layout); | ||||
|             this.autoHideEnabled = obtainStyledAttributes.getBoolean(R.styleable.FloatingActionButton_Behavior_Layout_behavior_autoHide, AUTO_HIDE_DEFAULT); | ||||
|             obtainStyledAttributes.recycle(); | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|         public void onAttachedToLayoutParams(CoordinatorLayout.LayoutParams layoutParams) { | ||||
|             if (layoutParams.dodgeInsetEdges == 0) { | ||||
|                 layoutParams.dodgeInsetEdges = 80; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|         public boolean onDependentViewChanged(CoordinatorLayout coordinatorLayout, FloatingActionButton floatingActionButton, View view) { | ||||
|             if (view instanceof AppBarLayout) { | ||||
|                 updateFabVisibilityForAppBarLayout(coordinatorLayout, (AppBarLayout) view, floatingActionButton); | ||||
|                 return false; | ||||
|             } | ||||
|             if (!isBottomSheet(view)) { | ||||
|                 return false; | ||||
|             } | ||||
|             updateFabVisibilityForBottomSheet(view, floatingActionButton); | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         private static boolean isBottomSheet(View view) { | ||||
|             ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); | ||||
|             if (layoutParams instanceof CoordinatorLayout.LayoutParams) { | ||||
|                 return ((CoordinatorLayout.LayoutParams) layoutParams).getBehavior() instanceof BottomSheetBehavior; | ||||
|             } | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         private boolean shouldUpdateVisibility(View view, FloatingActionButton floatingActionButton) { | ||||
|             CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) floatingActionButton.getLayoutParams(); | ||||
|             if (this.autoHideEnabled && layoutParams.getAnchorId() == view.getId() && floatingActionButton.getUserSetVisibility() == 0) { | ||||
|                 return AUTO_HIDE_DEFAULT; | ||||
|             } | ||||
|             return false; | ||||
|         } | ||||
|  | ||||
|         private boolean updateFabVisibilityForAppBarLayout(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, FloatingActionButton floatingActionButton) { | ||||
|             if (!shouldUpdateVisibility(appBarLayout, floatingActionButton)) { | ||||
|                 return false; | ||||
|             } | ||||
|             if (this.tmpRect == null) { | ||||
|                 this.tmpRect = new Rect(); | ||||
|             } | ||||
|             Rect rect = this.tmpRect; | ||||
|             DescendantOffsetUtils.getDescendantRect(coordinatorLayout, appBarLayout, rect); | ||||
|             if (rect.bottom <= appBarLayout.getMinimumHeightForVisibleOverlappingContent()) { | ||||
|                 floatingActionButton.hide(this.internalAutoHideListener, false); | ||||
|                 return AUTO_HIDE_DEFAULT; | ||||
|             } | ||||
|             floatingActionButton.show(this.internalAutoHideListener, false); | ||||
|             return AUTO_HIDE_DEFAULT; | ||||
|         } | ||||
|  | ||||
|         private boolean updateFabVisibilityForBottomSheet(View view, FloatingActionButton floatingActionButton) { | ||||
|             if (!shouldUpdateVisibility(view, floatingActionButton)) { | ||||
|                 return false; | ||||
|             } | ||||
|             if (view.getTop() < (floatingActionButton.getHeight() / 2) + ((CoordinatorLayout.LayoutParams) floatingActionButton.getLayoutParams()).topMargin) { | ||||
|                 floatingActionButton.hide(this.internalAutoHideListener, false); | ||||
|                 return AUTO_HIDE_DEFAULT; | ||||
|             } | ||||
|             floatingActionButton.show(this.internalAutoHideListener, false); | ||||
|             return AUTO_HIDE_DEFAULT; | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|         public boolean onLayoutChild(CoordinatorLayout coordinatorLayout, FloatingActionButton floatingActionButton, int i) { | ||||
|             List<View> dependencies = coordinatorLayout.getDependencies(floatingActionButton); | ||||
|             int size = dependencies.size(); | ||||
|             for (int i2 = 0; i2 < size; i2++) { | ||||
|                 View view = dependencies.get(i2); | ||||
|                 if (view instanceof AppBarLayout) { | ||||
|                     if (updateFabVisibilityForAppBarLayout(coordinatorLayout, (AppBarLayout) view, floatingActionButton)) { | ||||
|                         break; | ||||
|                     } | ||||
|                 } else { | ||||
|                     if (isBottomSheet(view) && updateFabVisibilityForBottomSheet(view, floatingActionButton)) { | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             coordinatorLayout.onLayoutChild(floatingActionButton, i); | ||||
|             offsetIfNeeded(coordinatorLayout, floatingActionButton); | ||||
|             return AUTO_HIDE_DEFAULT; | ||||
|         } | ||||
|  | ||||
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior | ||||
|         public boolean getInsetDodgeRect(CoordinatorLayout coordinatorLayout, FloatingActionButton floatingActionButton, Rect rect) { | ||||
|             Rect rect2 = floatingActionButton.shadowPadding; | ||||
|             rect.set(floatingActionButton.getLeft() + rect2.left, floatingActionButton.getTop() + rect2.top, floatingActionButton.getRight() - rect2.right, floatingActionButton.getBottom() - rect2.bottom); | ||||
|             return AUTO_HIDE_DEFAULT; | ||||
|         } | ||||
|  | ||||
|         private void offsetIfNeeded(CoordinatorLayout coordinatorLayout, FloatingActionButton floatingActionButton) { | ||||
|             int i; | ||||
|             Rect rect = floatingActionButton.shadowPadding; | ||||
|             if (rect == null || rect.centerX() <= 0 || rect.centerY() <= 0) { | ||||
|                 return; | ||||
|             } | ||||
|             CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) floatingActionButton.getLayoutParams(); | ||||
|             int i2 = 0; | ||||
|             if (floatingActionButton.getRight() >= coordinatorLayout.getWidth() - layoutParams.rightMargin) { | ||||
|                 i = rect.right; | ||||
|             } else { | ||||
|                 i = floatingActionButton.getLeft() <= layoutParams.leftMargin ? -rect.left : 0; | ||||
|             } | ||||
|             if (floatingActionButton.getBottom() >= coordinatorLayout.getHeight() - layoutParams.bottomMargin) { | ||||
|                 i2 = rect.bottom; | ||||
|             } else if (floatingActionButton.getTop() <= layoutParams.topMargin) { | ||||
|                 i2 = -rect.top; | ||||
|             } | ||||
|             if (i2 != 0) { | ||||
|                 ViewCompat.offsetTopAndBottom(floatingActionButton, i2); | ||||
|             } | ||||
|             if (i != 0) { | ||||
|                 ViewCompat.offsetLeftAndRight(floatingActionButton, i); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setElevation(float f) { | ||||
|         super.setElevation(f); | ||||
|         getImpl().updateShapeElevation(f); | ||||
|     } | ||||
|  | ||||
|     public float getCompatElevation() { | ||||
|         return getImpl().getElevation(); | ||||
|     } | ||||
|  | ||||
|     public void setCompatElevation(float f) { | ||||
|         getImpl().setElevation(f); | ||||
|     } | ||||
|  | ||||
|     public void setCompatElevationResource(int i) { | ||||
|         setCompatElevation(getResources().getDimension(i)); | ||||
|     } | ||||
|  | ||||
|     public float getCompatHoveredFocusedTranslationZ() { | ||||
|         return getImpl().getHoveredFocusedTranslationZ(); | ||||
|     } | ||||
|  | ||||
|     public void setCompatHoveredFocusedTranslationZ(float f) { | ||||
|         getImpl().setHoveredFocusedTranslationZ(f); | ||||
|     } | ||||
|  | ||||
|     public void setCompatHoveredFocusedTranslationZResource(int i) { | ||||
|         setCompatHoveredFocusedTranslationZ(getResources().getDimension(i)); | ||||
|     } | ||||
|  | ||||
|     public float getCompatPressedTranslationZ() { | ||||
|         return getImpl().getPressedTranslationZ(); | ||||
|     } | ||||
|  | ||||
|     public void setCompatPressedTranslationZ(float f) { | ||||
|         getImpl().setPressedTranslationZ(f); | ||||
|     } | ||||
|  | ||||
|     public void setCompatPressedTranslationZResource(int i) { | ||||
|         setCompatPressedTranslationZ(getResources().getDimension(i)); | ||||
|     } | ||||
|  | ||||
|     public MotionSpec getShowMotionSpec() { | ||||
|         return getImpl().getShowMotionSpec(); | ||||
|     } | ||||
|  | ||||
|     public void setShowMotionSpec(MotionSpec motionSpec) { | ||||
|         getImpl().setShowMotionSpec(motionSpec); | ||||
|     } | ||||
|  | ||||
|     public void setShowMotionSpecResource(int i) { | ||||
|         setShowMotionSpec(MotionSpec.createFromResource(getContext(), i)); | ||||
|     } | ||||
|  | ||||
|     public MotionSpec getHideMotionSpec() { | ||||
|         return getImpl().getHideMotionSpec(); | ||||
|     } | ||||
|  | ||||
|     public void setHideMotionSpec(MotionSpec motionSpec) { | ||||
|         getImpl().setHideMotionSpec(motionSpec); | ||||
|     } | ||||
|  | ||||
|     public void setHideMotionSpecResource(int i) { | ||||
|         setHideMotionSpec(MotionSpec.createFromResource(getContext(), i)); | ||||
|     } | ||||
|  | ||||
|     public void addTransformationCallback(TransformationCallback<? extends FloatingActionButton> transformationCallback) { | ||||
|         getImpl().addTransformationCallback(new TransformationCallbackWrapper(transformationCallback)); | ||||
|     } | ||||
|  | ||||
|     public void removeTransformationCallback(TransformationCallback<? extends FloatingActionButton> transformationCallback) { | ||||
|         getImpl().removeTransformationCallback(new TransformationCallbackWrapper(transformationCallback)); | ||||
|     } | ||||
|  | ||||
|     class TransformationCallbackWrapper<T extends FloatingActionButton> implements FloatingActionButtonImpl.InternalTransformationCallback { | ||||
|         private final TransformationCallback<T> listener; | ||||
|  | ||||
|         TransformationCallbackWrapper(TransformationCallback<T> transformationCallback) { | ||||
|             this.listener = transformationCallback; | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl.InternalTransformationCallback | ||||
|         public void onTranslationChanged() { | ||||
|             this.listener.onTranslationChanged(FloatingActionButton.this); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl.InternalTransformationCallback | ||||
|         public void onScaleChanged() { | ||||
|             this.listener.onScaleChanged(FloatingActionButton.this); | ||||
|         } | ||||
|  | ||||
|         public boolean equals(Object obj) { | ||||
|             return (obj instanceof TransformationCallbackWrapper) && ((TransformationCallbackWrapper) obj).listener.equals(this.listener); | ||||
|         } | ||||
|  | ||||
|         public int hashCode() { | ||||
|             return this.listener.hashCode(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setTranslationX(float f) { | ||||
|         super.setTranslationX(f); | ||||
|         getImpl().onTranslationChanged(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setTranslationY(float f) { | ||||
|         super.setTranslationY(f); | ||||
|         getImpl().onTranslationChanged(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setTranslationZ(float f) { | ||||
|         super.setTranslationZ(f); | ||||
|         getImpl().onTranslationChanged(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setScaleX(float f) { | ||||
|         super.setScaleX(f); | ||||
|         getImpl().onScaleChanged(); | ||||
|     } | ||||
|  | ||||
|     @Override // android.view.View | ||||
|     public void setScaleY(float f) { | ||||
|         super.setScaleY(f); | ||||
|         getImpl().onScaleChanged(); | ||||
|     } | ||||
|  | ||||
|     public void setShadowPaddingEnabled(boolean z) { | ||||
|         getImpl().setShadowPaddingEnabled(z); | ||||
|     } | ||||
|  | ||||
|     private FloatingActionButtonImpl getImpl() { | ||||
|         if (this.impl == null) { | ||||
|             this.impl = createImpl(); | ||||
|         } | ||||
|         return this.impl; | ||||
|     } | ||||
|  | ||||
|     private FloatingActionButtonImpl createImpl() { | ||||
|         return new FloatingActionButtonImplLollipop(this, new ShadowDelegateImpl()); | ||||
|     } | ||||
|  | ||||
|     private class ShadowDelegateImpl implements ShadowViewDelegate { | ||||
|         ShadowDelegateImpl() { | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.shadow.ShadowViewDelegate | ||||
|         public float getRadius() { | ||||
|             return FloatingActionButton.this.getSizeDimension() / 2.0f; | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.shadow.ShadowViewDelegate | ||||
|         public void setShadowPadding(int i, int i2, int i3, int i4) { | ||||
|             FloatingActionButton.this.shadowPadding.set(i, i2, i3, i4); | ||||
|             FloatingActionButton floatingActionButton = FloatingActionButton.this; | ||||
|             floatingActionButton.setPadding(i + floatingActionButton.imagePadding, i2 + FloatingActionButton.this.imagePadding, i3 + FloatingActionButton.this.imagePadding, i4 + FloatingActionButton.this.imagePadding); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.shadow.ShadowViewDelegate | ||||
|         public void setBackgroundDrawable(Drawable drawable) { | ||||
|             if (drawable != null) { | ||||
|                 FloatingActionButton.super.setBackgroundDrawable(drawable); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.shadow.ShadowViewDelegate | ||||
|         public boolean isCompatPaddingEnabled() { | ||||
|             return FloatingActionButton.this.compatPadding; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,767 @@ | ||||
| package com.google.android.material.floatingactionbutton; | ||||
|  | ||||
| import android.animation.Animator; | ||||
| import android.animation.AnimatorListenerAdapter; | ||||
| import android.animation.AnimatorSet; | ||||
| import android.animation.FloatEvaluator; | ||||
| import android.animation.ObjectAnimator; | ||||
| import android.animation.TimeInterpolator; | ||||
| import android.animation.TypeEvaluator; | ||||
| import android.animation.ValueAnimator; | ||||
| import android.content.res.ColorStateList; | ||||
| import android.graphics.Matrix; | ||||
| import android.graphics.PorterDuff; | ||||
| import android.graphics.Rect; | ||||
| import android.graphics.RectF; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.graphics.drawable.InsetDrawable; | ||||
| import android.graphics.drawable.LayerDrawable; | ||||
| import android.os.Build; | ||||
| import android.util.Property; | ||||
| import android.view.View; | ||||
| import android.view.ViewTreeObserver; | ||||
| import androidx.core.graphics.drawable.DrawableCompat; | ||||
| import androidx.core.util.Preconditions; | ||||
| import androidx.core.view.ViewCompat; | ||||
| import com.google.android.material.R; | ||||
| import com.google.android.material.animation.AnimationUtils; | ||||
| import com.google.android.material.animation.AnimatorSetCompat; | ||||
| import com.google.android.material.animation.ImageMatrixProperty; | ||||
| import com.google.android.material.animation.MatrixEvaluator; | ||||
| import com.google.android.material.animation.MotionSpec; | ||||
| import com.google.android.material.internal.StateListAnimator; | ||||
| import com.google.android.material.motion.MotionUtils; | ||||
| import com.google.android.material.ripple.RippleDrawableCompat; | ||||
| import com.google.android.material.ripple.RippleUtils; | ||||
| import com.google.android.material.shadow.ShadowViewDelegate; | ||||
| 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.Shapeable; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Iterator; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| class FloatingActionButtonImpl { | ||||
|     static final int ANIM_STATE_HIDING = 1; | ||||
|     static final int ANIM_STATE_NONE = 0; | ||||
|     static final int ANIM_STATE_SHOWING = 2; | ||||
|     static final long ELEVATION_ANIM_DELAY = 100; | ||||
|     static final long ELEVATION_ANIM_DURATION = 100; | ||||
|     private static final float HIDE_ICON_SCALE = 0.4f; | ||||
|     private static final float HIDE_OPACITY = 0.0f; | ||||
|     private static final float HIDE_SCALE = 0.4f; | ||||
|     static final float SHADOW_MULTIPLIER = 1.5f; | ||||
|     private static final float SHOW_ICON_SCALE = 1.0f; | ||||
|     private static final float SHOW_OPACITY = 1.0f; | ||||
|     private static final float SHOW_SCALE = 1.0f; | ||||
|     private static final float SPEC_HIDE_ICON_SCALE = 0.0f; | ||||
|     private static final float SPEC_HIDE_SCALE = 0.0f; | ||||
|     BorderDrawable borderDrawable; | ||||
|     Drawable contentBackground; | ||||
|     private Animator currentAnimator; | ||||
|     float elevation; | ||||
|     boolean ensureMinTouchTargetSize; | ||||
|     private ArrayList<Animator.AnimatorListener> hideListeners; | ||||
|     private MotionSpec hideMotionSpec; | ||||
|     float hoveredFocusedTranslationZ; | ||||
|     private int maxImageSize; | ||||
|     int minTouchTargetSize; | ||||
|     private ViewTreeObserver.OnPreDrawListener preDrawListener; | ||||
|     float pressedTranslationZ; | ||||
|     Drawable rippleDrawable; | ||||
|     private float rotation; | ||||
|     final ShadowViewDelegate shadowViewDelegate; | ||||
|     ShapeAppearanceModel shapeAppearance; | ||||
|     MaterialShapeDrawable shapeDrawable; | ||||
|     private ArrayList<Animator.AnimatorListener> showListeners; | ||||
|     private MotionSpec showMotionSpec; | ||||
|     private final StateListAnimator stateListAnimator; | ||||
|     private ArrayList<InternalTransformationCallback> transformationCallbacks; | ||||
|     final FloatingActionButton view; | ||||
|     static final TimeInterpolator ELEVATION_ANIM_INTERPOLATOR = AnimationUtils.FAST_OUT_LINEAR_IN_INTERPOLATOR; | ||||
|     private static final int SHOW_ANIM_DURATION_ATTR = R.attr.motionDurationLong2; | ||||
|     private static final int SHOW_ANIM_EASING_ATTR = R.attr.motionEasingEmphasizedInterpolator; | ||||
|     private static final int HIDE_ANIM_DURATION_ATTR = R.attr.motionDurationMedium1; | ||||
|     private static final int HIDE_ANIM_EASING_ATTR = R.attr.motionEasingEmphasizedAccelerateInterpolator; | ||||
|     static final int[] PRESSED_ENABLED_STATE_SET = {android.R.attr.state_pressed, android.R.attr.state_enabled}; | ||||
|     static final int[] HOVERED_FOCUSED_ENABLED_STATE_SET = {android.R.attr.state_hovered, android.R.attr.state_focused, android.R.attr.state_enabled}; | ||||
|     static final int[] FOCUSED_ENABLED_STATE_SET = {android.R.attr.state_focused, android.R.attr.state_enabled}; | ||||
|     static final int[] HOVERED_ENABLED_STATE_SET = {android.R.attr.state_hovered, android.R.attr.state_enabled}; | ||||
|     static final int[] ENABLED_STATE_SET = {android.R.attr.state_enabled}; | ||||
|     static final int[] EMPTY_STATE_SET = new int[0]; | ||||
|     boolean shadowPaddingEnabled = true; | ||||
|     private float imageMatrixScale = 1.0f; | ||||
|     private int animState = 0; | ||||
|     private final Rect tmpRect = new Rect(); | ||||
|     private final RectF tmpRectF1 = new RectF(); | ||||
|     private final RectF tmpRectF2 = new RectF(); | ||||
|     private final Matrix tmpMatrix = new Matrix(); | ||||
|  | ||||
|     interface InternalTransformationCallback { | ||||
|         void onScaleChanged(); | ||||
|  | ||||
|         void onTranslationChanged(); | ||||
|     } | ||||
|  | ||||
|     interface InternalVisibilityChangedListener { | ||||
|         void onHidden(); | ||||
|  | ||||
|         void onShown(); | ||||
|     } | ||||
|  | ||||
|     final Drawable getContentBackground() { | ||||
|         return this.contentBackground; | ||||
|     } | ||||
|  | ||||
|     float getElevation() { | ||||
|         return this.elevation; | ||||
|     } | ||||
|  | ||||
|     boolean getEnsureMinTouchTargetSize() { | ||||
|         return this.ensureMinTouchTargetSize; | ||||
|     } | ||||
|  | ||||
|     final MotionSpec getHideMotionSpec() { | ||||
|         return this.hideMotionSpec; | ||||
|     } | ||||
|  | ||||
|     float getHoveredFocusedTranslationZ() { | ||||
|         return this.hoveredFocusedTranslationZ; | ||||
|     } | ||||
|  | ||||
|     float getPressedTranslationZ() { | ||||
|         return this.pressedTranslationZ; | ||||
|     } | ||||
|  | ||||
|     final ShapeAppearanceModel getShapeAppearance() { | ||||
|         return this.shapeAppearance; | ||||
|     } | ||||
|  | ||||
|     final MotionSpec getShowMotionSpec() { | ||||
|         return this.showMotionSpec; | ||||
|     } | ||||
|  | ||||
|     void onCompatShadowChanged() { | ||||
|     } | ||||
|  | ||||
|     boolean requirePreDrawListener() { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     void setEnsureMinTouchTargetSize(boolean z) { | ||||
|         this.ensureMinTouchTargetSize = z; | ||||
|     } | ||||
|  | ||||
|     final void setHideMotionSpec(MotionSpec motionSpec) { | ||||
|         this.hideMotionSpec = motionSpec; | ||||
|     } | ||||
|  | ||||
|     void setMinTouchTargetSize(int i) { | ||||
|         this.minTouchTargetSize = i; | ||||
|     } | ||||
|  | ||||
|     final void setShowMotionSpec(MotionSpec motionSpec) { | ||||
|         this.showMotionSpec = motionSpec; | ||||
|     } | ||||
|  | ||||
|     boolean shouldAddPadding() { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     FloatingActionButtonImpl(FloatingActionButton floatingActionButton, ShadowViewDelegate shadowViewDelegate) { | ||||
|         this.view = floatingActionButton; | ||||
|         this.shadowViewDelegate = shadowViewDelegate; | ||||
|         StateListAnimator stateListAnimator = new StateListAnimator(); | ||||
|         this.stateListAnimator = stateListAnimator; | ||||
|         stateListAnimator.addState(PRESSED_ENABLED_STATE_SET, createElevationAnimator(new ElevateToPressedTranslationZAnimation())); | ||||
|         stateListAnimator.addState(HOVERED_FOCUSED_ENABLED_STATE_SET, createElevationAnimator(new ElevateToHoveredFocusedTranslationZAnimation())); | ||||
|         stateListAnimator.addState(FOCUSED_ENABLED_STATE_SET, createElevationAnimator(new ElevateToHoveredFocusedTranslationZAnimation())); | ||||
|         stateListAnimator.addState(HOVERED_ENABLED_STATE_SET, createElevationAnimator(new ElevateToHoveredFocusedTranslationZAnimation())); | ||||
|         stateListAnimator.addState(ENABLED_STATE_SET, createElevationAnimator(new ResetElevationAnimation())); | ||||
|         stateListAnimator.addState(EMPTY_STATE_SET, createElevationAnimator(new DisabledElevationAnimation())); | ||||
|         this.rotation = floatingActionButton.getRotation(); | ||||
|     } | ||||
|  | ||||
|     void initializeBackgroundDrawable(ColorStateList colorStateList, PorterDuff.Mode mode, ColorStateList colorStateList2, int i) { | ||||
|         MaterialShapeDrawable createShapeDrawable = createShapeDrawable(); | ||||
|         this.shapeDrawable = createShapeDrawable; | ||||
|         createShapeDrawable.setTintList(colorStateList); | ||||
|         if (mode != null) { | ||||
|             this.shapeDrawable.setTintMode(mode); | ||||
|         } | ||||
|         this.shapeDrawable.setShadowColor(-12303292); | ||||
|         this.shapeDrawable.initializeElevationOverlay(this.view.getContext()); | ||||
|         RippleDrawableCompat rippleDrawableCompat = new RippleDrawableCompat(this.shapeDrawable.getShapeAppearanceModel()); | ||||
|         rippleDrawableCompat.setTintList(RippleUtils.sanitizeRippleDrawableColor(colorStateList2)); | ||||
|         this.rippleDrawable = rippleDrawableCompat; | ||||
|         this.contentBackground = new LayerDrawable(new Drawable[]{(Drawable) Preconditions.checkNotNull(this.shapeDrawable), rippleDrawableCompat}); | ||||
|     } | ||||
|  | ||||
|     void setBackgroundTintList(ColorStateList colorStateList) { | ||||
|         MaterialShapeDrawable materialShapeDrawable = this.shapeDrawable; | ||||
|         if (materialShapeDrawable != null) { | ||||
|             materialShapeDrawable.setTintList(colorStateList); | ||||
|         } | ||||
|         BorderDrawable borderDrawable = this.borderDrawable; | ||||
|         if (borderDrawable != null) { | ||||
|             borderDrawable.setBorderTint(colorStateList); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void setBackgroundTintMode(PorterDuff.Mode mode) { | ||||
|         MaterialShapeDrawable materialShapeDrawable = this.shapeDrawable; | ||||
|         if (materialShapeDrawable != null) { | ||||
|             materialShapeDrawable.setTintMode(mode); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void setRippleColor(ColorStateList colorStateList) { | ||||
|         Drawable drawable = this.rippleDrawable; | ||||
|         if (drawable != null) { | ||||
|             DrawableCompat.setTintList(drawable, RippleUtils.sanitizeRippleDrawableColor(colorStateList)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     final void setElevation(float f) { | ||||
|         if (this.elevation != f) { | ||||
|             this.elevation = f; | ||||
|             onElevationsChanged(f, this.hoveredFocusedTranslationZ, this.pressedTranslationZ); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     final void setHoveredFocusedTranslationZ(float f) { | ||||
|         if (this.hoveredFocusedTranslationZ != f) { | ||||
|             this.hoveredFocusedTranslationZ = f; | ||||
|             onElevationsChanged(this.elevation, f, this.pressedTranslationZ); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     final void setPressedTranslationZ(float f) { | ||||
|         if (this.pressedTranslationZ != f) { | ||||
|             this.pressedTranslationZ = f; | ||||
|             onElevationsChanged(this.elevation, this.hoveredFocusedTranslationZ, f); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     final void setMaxImageSize(int i) { | ||||
|         if (this.maxImageSize != i) { | ||||
|             this.maxImageSize = i; | ||||
|             updateImageMatrixScale(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     final void updateImageMatrixScale() { | ||||
|         setImageMatrixScale(this.imageMatrixScale); | ||||
|     } | ||||
|  | ||||
|     final void setImageMatrixScale(float f) { | ||||
|         this.imageMatrixScale = f; | ||||
|         Matrix matrix = this.tmpMatrix; | ||||
|         calculateImageMatrixFromScale(f, matrix); | ||||
|         this.view.setImageMatrix(matrix); | ||||
|     } | ||||
|  | ||||
|     /* JADX INFO: Access modifiers changed from: private */ | ||||
|     public void calculateImageMatrixFromScale(float f, Matrix matrix) { | ||||
|         matrix.reset(); | ||||
|         if (this.view.getDrawable() == null || this.maxImageSize == 0) { | ||||
|             return; | ||||
|         } | ||||
|         RectF rectF = this.tmpRectF1; | ||||
|         RectF rectF2 = this.tmpRectF2; | ||||
|         rectF.set(0.0f, 0.0f, r0.getIntrinsicWidth(), r0.getIntrinsicHeight()); | ||||
|         int i = this.maxImageSize; | ||||
|         rectF2.set(0.0f, 0.0f, i, i); | ||||
|         matrix.setRectToRect(rectF, rectF2, Matrix.ScaleToFit.CENTER); | ||||
|         int i2 = this.maxImageSize; | ||||
|         matrix.postScale(f, f, i2 / 2.0f, i2 / 2.0f); | ||||
|     } | ||||
|  | ||||
|     final void setShapeAppearance(ShapeAppearanceModel shapeAppearanceModel) { | ||||
|         this.shapeAppearance = shapeAppearanceModel; | ||||
|         MaterialShapeDrawable materialShapeDrawable = this.shapeDrawable; | ||||
|         if (materialShapeDrawable != null) { | ||||
|             materialShapeDrawable.setShapeAppearanceModel(shapeAppearanceModel); | ||||
|         } | ||||
|         Object obj = this.rippleDrawable; | ||||
|         if (obj instanceof Shapeable) { | ||||
|             ((Shapeable) obj).setShapeAppearanceModel(shapeAppearanceModel); | ||||
|         } | ||||
|         BorderDrawable borderDrawable = this.borderDrawable; | ||||
|         if (borderDrawable != null) { | ||||
|             borderDrawable.setShapeAppearanceModel(shapeAppearanceModel); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     final boolean shouldExpandBoundsForA11y() { | ||||
|         return !this.ensureMinTouchTargetSize || this.view.getSizeDimension() >= this.minTouchTargetSize; | ||||
|     } | ||||
|  | ||||
|     void setShadowPaddingEnabled(boolean z) { | ||||
|         this.shadowPaddingEnabled = z; | ||||
|         updatePadding(); | ||||
|     } | ||||
|  | ||||
|     void onElevationsChanged(float f, float f2, float f3) { | ||||
|         jumpDrawableToCurrentState(); | ||||
|         updatePadding(); | ||||
|         updateShapeElevation(f); | ||||
|     } | ||||
|  | ||||
|     void updateShapeElevation(float f) { | ||||
|         MaterialShapeDrawable materialShapeDrawable = this.shapeDrawable; | ||||
|         if (materialShapeDrawable != null) { | ||||
|             materialShapeDrawable.setElevation(f); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void onDrawableStateChanged(int[] iArr) { | ||||
|         this.stateListAnimator.setState(iArr); | ||||
|     } | ||||
|  | ||||
|     void jumpDrawableToCurrentState() { | ||||
|         this.stateListAnimator.jumpToCurrentState(); | ||||
|     } | ||||
|  | ||||
|     void addOnShowAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         if (this.showListeners == null) { | ||||
|             this.showListeners = new ArrayList<>(); | ||||
|         } | ||||
|         this.showListeners.add(animatorListener); | ||||
|     } | ||||
|  | ||||
|     void removeOnShowAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         ArrayList<Animator.AnimatorListener> arrayList = this.showListeners; | ||||
|         if (arrayList == null) { | ||||
|             return; | ||||
|         } | ||||
|         arrayList.remove(animatorListener); | ||||
|     } | ||||
|  | ||||
|     public void addOnHideAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         if (this.hideListeners == null) { | ||||
|             this.hideListeners = new ArrayList<>(); | ||||
|         } | ||||
|         this.hideListeners.add(animatorListener); | ||||
|     } | ||||
|  | ||||
|     public void removeOnHideAnimationListener(Animator.AnimatorListener animatorListener) { | ||||
|         ArrayList<Animator.AnimatorListener> arrayList = this.hideListeners; | ||||
|         if (arrayList == null) { | ||||
|             return; | ||||
|         } | ||||
|         arrayList.remove(animatorListener); | ||||
|     } | ||||
|  | ||||
|     void hide(final InternalVisibilityChangedListener internalVisibilityChangedListener, final boolean z) { | ||||
|         AnimatorSet createDefaultAnimator; | ||||
|         if (isOrWillBeHidden()) { | ||||
|             return; | ||||
|         } | ||||
|         Animator animator = this.currentAnimator; | ||||
|         if (animator != null) { | ||||
|             animator.cancel(); | ||||
|         } | ||||
|         if (shouldAnimateVisibilityChange()) { | ||||
|             MotionSpec motionSpec = this.hideMotionSpec; | ||||
|             if (motionSpec != null) { | ||||
|                 createDefaultAnimator = createAnimator(motionSpec, 0.0f, 0.0f, 0.0f); | ||||
|             } else { | ||||
|                 createDefaultAnimator = createDefaultAnimator(0.0f, 0.4f, 0.4f, HIDE_ANIM_DURATION_ATTR, HIDE_ANIM_EASING_ATTR); | ||||
|             } | ||||
|             createDefaultAnimator.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.floatingactionbutton.FloatingActionButtonImpl.1 | ||||
|                 private boolean cancelled; | ||||
|  | ||||
|                 @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|                 public void onAnimationCancel(Animator animator2) { | ||||
|                     this.cancelled = true; | ||||
|                 } | ||||
|  | ||||
|                 @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|                 public void onAnimationStart(Animator animator2) { | ||||
|                     FloatingActionButtonImpl.this.view.internalSetVisibility(0, z); | ||||
|                     FloatingActionButtonImpl.this.animState = 1; | ||||
|                     FloatingActionButtonImpl.this.currentAnimator = animator2; | ||||
|                     this.cancelled = false; | ||||
|                 } | ||||
|  | ||||
|                 @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|                 public void onAnimationEnd(Animator animator2) { | ||||
|                     FloatingActionButtonImpl.this.animState = 0; | ||||
|                     FloatingActionButtonImpl.this.currentAnimator = null; | ||||
|                     if (this.cancelled) { | ||||
|                         return; | ||||
|                     } | ||||
|                     FloatingActionButton floatingActionButton = FloatingActionButtonImpl.this.view; | ||||
|                     boolean z2 = z; | ||||
|                     floatingActionButton.internalSetVisibility(z2 ? 8 : 4, z2); | ||||
|                     InternalVisibilityChangedListener internalVisibilityChangedListener2 = internalVisibilityChangedListener; | ||||
|                     if (internalVisibilityChangedListener2 != null) { | ||||
|                         internalVisibilityChangedListener2.onHidden(); | ||||
|                     } | ||||
|                 } | ||||
|             }); | ||||
|             ArrayList<Animator.AnimatorListener> arrayList = this.hideListeners; | ||||
|             if (arrayList != null) { | ||||
|                 Iterator<Animator.AnimatorListener> it = arrayList.iterator(); | ||||
|                 while (it.hasNext()) { | ||||
|                     createDefaultAnimator.addListener(it.next()); | ||||
|                 } | ||||
|             } | ||||
|             createDefaultAnimator.start(); | ||||
|             return; | ||||
|         } | ||||
|         this.view.internalSetVisibility(z ? 8 : 4, z); | ||||
|         if (internalVisibilityChangedListener != null) { | ||||
|             internalVisibilityChangedListener.onHidden(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void show(final InternalVisibilityChangedListener internalVisibilityChangedListener, final boolean z) { | ||||
|         AnimatorSet createDefaultAnimator; | ||||
|         if (isOrWillBeShown()) { | ||||
|             return; | ||||
|         } | ||||
|         Animator animator = this.currentAnimator; | ||||
|         if (animator != null) { | ||||
|             animator.cancel(); | ||||
|         } | ||||
|         boolean z2 = this.showMotionSpec == null; | ||||
|         if (shouldAnimateVisibilityChange()) { | ||||
|             if (this.view.getVisibility() != 0) { | ||||
|                 this.view.setAlpha(0.0f); | ||||
|                 this.view.setScaleY(z2 ? 0.4f : 0.0f); | ||||
|                 this.view.setScaleX(z2 ? 0.4f : 0.0f); | ||||
|                 setImageMatrixScale(z2 ? 0.4f : 0.0f); | ||||
|             } | ||||
|             MotionSpec motionSpec = this.showMotionSpec; | ||||
|             if (motionSpec != null) { | ||||
|                 createDefaultAnimator = createAnimator(motionSpec, 1.0f, 1.0f, 1.0f); | ||||
|             } else { | ||||
|                 createDefaultAnimator = createDefaultAnimator(1.0f, 1.0f, 1.0f, SHOW_ANIM_DURATION_ATTR, SHOW_ANIM_EASING_ATTR); | ||||
|             } | ||||
|             createDefaultAnimator.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.floatingactionbutton.FloatingActionButtonImpl.2 | ||||
|                 @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|                 public void onAnimationStart(Animator animator2) { | ||||
|                     FloatingActionButtonImpl.this.view.internalSetVisibility(0, z); | ||||
|                     FloatingActionButtonImpl.this.animState = 2; | ||||
|                     FloatingActionButtonImpl.this.currentAnimator = animator2; | ||||
|                 } | ||||
|  | ||||
|                 @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|                 public void onAnimationEnd(Animator animator2) { | ||||
|                     FloatingActionButtonImpl.this.animState = 0; | ||||
|                     FloatingActionButtonImpl.this.currentAnimator = null; | ||||
|                     InternalVisibilityChangedListener internalVisibilityChangedListener2 = internalVisibilityChangedListener; | ||||
|                     if (internalVisibilityChangedListener2 != null) { | ||||
|                         internalVisibilityChangedListener2.onShown(); | ||||
|                     } | ||||
|                 } | ||||
|             }); | ||||
|             ArrayList<Animator.AnimatorListener> arrayList = this.showListeners; | ||||
|             if (arrayList != null) { | ||||
|                 Iterator<Animator.AnimatorListener> it = arrayList.iterator(); | ||||
|                 while (it.hasNext()) { | ||||
|                     createDefaultAnimator.addListener(it.next()); | ||||
|                 } | ||||
|             } | ||||
|             createDefaultAnimator.start(); | ||||
|             return; | ||||
|         } | ||||
|         this.view.internalSetVisibility(0, z); | ||||
|         this.view.setAlpha(1.0f); | ||||
|         this.view.setScaleY(1.0f); | ||||
|         this.view.setScaleX(1.0f); | ||||
|         setImageMatrixScale(1.0f); | ||||
|         if (internalVisibilityChangedListener != null) { | ||||
|             internalVisibilityChangedListener.onShown(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private AnimatorSet createAnimator(MotionSpec motionSpec, float f, float f2, float f3) { | ||||
|         ArrayList arrayList = new ArrayList(); | ||||
|         ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.view, (Property<FloatingActionButton, Float>) View.ALPHA, f); | ||||
|         motionSpec.getTiming("opacity").apply(ofFloat); | ||||
|         arrayList.add(ofFloat); | ||||
|         ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(this.view, (Property<FloatingActionButton, Float>) View.SCALE_X, f2); | ||||
|         motionSpec.getTiming("scale").apply(ofFloat2); | ||||
|         workAroundOreoBug(ofFloat2); | ||||
|         arrayList.add(ofFloat2); | ||||
|         ObjectAnimator ofFloat3 = ObjectAnimator.ofFloat(this.view, (Property<FloatingActionButton, Float>) View.SCALE_Y, f2); | ||||
|         motionSpec.getTiming("scale").apply(ofFloat3); | ||||
|         workAroundOreoBug(ofFloat3); | ||||
|         arrayList.add(ofFloat3); | ||||
|         calculateImageMatrixFromScale(f3, this.tmpMatrix); | ||||
|         ObjectAnimator ofObject = ObjectAnimator.ofObject(this.view, new ImageMatrixProperty(), new MatrixEvaluator() { // from class: com.google.android.material.floatingactionbutton.FloatingActionButtonImpl.3 | ||||
|             /* JADX WARN: Can't rename method to resolve collision */ | ||||
|             @Override // com.google.android.material.animation.MatrixEvaluator, android.animation.TypeEvaluator | ||||
|             public Matrix evaluate(float f4, Matrix matrix, Matrix matrix2) { | ||||
|                 FloatingActionButtonImpl.this.imageMatrixScale = f4; | ||||
|                 return super.evaluate(f4, matrix, matrix2); | ||||
|             } | ||||
|         }, new Matrix(this.tmpMatrix)); | ||||
|         motionSpec.getTiming("iconScale").apply(ofObject); | ||||
|         arrayList.add(ofObject); | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         AnimatorSetCompat.playTogether(animatorSet, arrayList); | ||||
|         return animatorSet; | ||||
|     } | ||||
|  | ||||
|     private AnimatorSet createDefaultAnimator(final float f, final float f2, final float f3, int i, int i2) { | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         ArrayList arrayList = new ArrayList(); | ||||
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f); | ||||
|         final float alpha = this.view.getAlpha(); | ||||
|         final float scaleX = this.view.getScaleX(); | ||||
|         final float scaleY = this.view.getScaleY(); | ||||
|         final float f4 = this.imageMatrixScale; | ||||
|         final Matrix matrix = new Matrix(this.tmpMatrix); | ||||
|         ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.google.android.material.floatingactionbutton.FloatingActionButtonImpl.4 | ||||
|             @Override // android.animation.ValueAnimator.AnimatorUpdateListener | ||||
|             public void onAnimationUpdate(ValueAnimator valueAnimator) { | ||||
|                 float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue(); | ||||
|                 FloatingActionButtonImpl.this.view.setAlpha(AnimationUtils.lerp(alpha, f, 0.0f, 0.2f, floatValue)); | ||||
|                 FloatingActionButtonImpl.this.view.setScaleX(AnimationUtils.lerp(scaleX, f2, floatValue)); | ||||
|                 FloatingActionButtonImpl.this.view.setScaleY(AnimationUtils.lerp(scaleY, f2, floatValue)); | ||||
|                 FloatingActionButtonImpl.this.imageMatrixScale = AnimationUtils.lerp(f4, f3, floatValue); | ||||
|                 FloatingActionButtonImpl.this.calculateImageMatrixFromScale(AnimationUtils.lerp(f4, f3, floatValue), matrix); | ||||
|                 FloatingActionButtonImpl.this.view.setImageMatrix(matrix); | ||||
|             } | ||||
|         }); | ||||
|         arrayList.add(ofFloat); | ||||
|         AnimatorSetCompat.playTogether(animatorSet, arrayList); | ||||
|         animatorSet.setDuration(MotionUtils.resolveThemeDuration(this.view.getContext(), i, this.view.getContext().getResources().getInteger(R.integer.material_motion_duration_long_1))); | ||||
|         animatorSet.setInterpolator(MotionUtils.resolveThemeInterpolator(this.view.getContext(), i2, AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR)); | ||||
|         return animatorSet; | ||||
|     } | ||||
|  | ||||
|     private void workAroundOreoBug(ObjectAnimator objectAnimator) { | ||||
|         if (Build.VERSION.SDK_INT != 26) { | ||||
|             return; | ||||
|         } | ||||
|         objectAnimator.setEvaluator(new TypeEvaluator<Float>() { // from class: com.google.android.material.floatingactionbutton.FloatingActionButtonImpl.5 | ||||
|             FloatEvaluator floatEvaluator = new FloatEvaluator(); | ||||
|  | ||||
|             @Override // android.animation.TypeEvaluator | ||||
|             public Float evaluate(float f, Float f2, Float f3) { | ||||
|                 float floatValue = this.floatEvaluator.evaluate(f, (Number) f2, (Number) f3).floatValue(); | ||||
|                 if (floatValue < 0.1f) { | ||||
|                     floatValue = 0.0f; | ||||
|                 } | ||||
|                 return Float.valueOf(floatValue); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     void addTransformationCallback(InternalTransformationCallback internalTransformationCallback) { | ||||
|         if (this.transformationCallbacks == null) { | ||||
|             this.transformationCallbacks = new ArrayList<>(); | ||||
|         } | ||||
|         this.transformationCallbacks.add(internalTransformationCallback); | ||||
|     } | ||||
|  | ||||
|     void removeTransformationCallback(InternalTransformationCallback internalTransformationCallback) { | ||||
|         ArrayList<InternalTransformationCallback> arrayList = this.transformationCallbacks; | ||||
|         if (arrayList == null) { | ||||
|             return; | ||||
|         } | ||||
|         arrayList.remove(internalTransformationCallback); | ||||
|     } | ||||
|  | ||||
|     void onTranslationChanged() { | ||||
|         ArrayList<InternalTransformationCallback> arrayList = this.transformationCallbacks; | ||||
|         if (arrayList != null) { | ||||
|             Iterator<InternalTransformationCallback> it = arrayList.iterator(); | ||||
|             while (it.hasNext()) { | ||||
|                 it.next().onTranslationChanged(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void onScaleChanged() { | ||||
|         ArrayList<InternalTransformationCallback> arrayList = this.transformationCallbacks; | ||||
|         if (arrayList != null) { | ||||
|             Iterator<InternalTransformationCallback> it = arrayList.iterator(); | ||||
|             while (it.hasNext()) { | ||||
|                 it.next().onScaleChanged(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     final void updatePadding() { | ||||
|         Rect rect = this.tmpRect; | ||||
|         getPadding(rect); | ||||
|         onPaddingUpdated(rect); | ||||
|         this.shadowViewDelegate.setShadowPadding(rect.left, rect.top, rect.right, rect.bottom); | ||||
|     } | ||||
|  | ||||
|     void getPadding(Rect rect) { | ||||
|         int touchTargetPadding = getTouchTargetPadding(); | ||||
|         int max = Math.max(touchTargetPadding, (int) Math.ceil(this.shadowPaddingEnabled ? getElevation() + this.pressedTranslationZ : 0.0f)); | ||||
|         int max2 = Math.max(touchTargetPadding, (int) Math.ceil(r1 * SHADOW_MULTIPLIER)); | ||||
|         rect.set(max, max2, max, max2); | ||||
|     } | ||||
|  | ||||
|     int getTouchTargetPadding() { | ||||
|         if (this.ensureMinTouchTargetSize) { | ||||
|             return Math.max((this.minTouchTargetSize - this.view.getSizeDimension()) / 2, 0); | ||||
|         } | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     void onPaddingUpdated(Rect rect) { | ||||
|         Preconditions.checkNotNull(this.contentBackground, "Didn't initialize content background"); | ||||
|         if (shouldAddPadding()) { | ||||
|             this.shadowViewDelegate.setBackgroundDrawable(new InsetDrawable(this.contentBackground, rect.left, rect.top, rect.right, rect.bottom)); | ||||
|         } else { | ||||
|             this.shadowViewDelegate.setBackgroundDrawable(this.contentBackground); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void onAttachedToWindow() { | ||||
|         MaterialShapeDrawable materialShapeDrawable = this.shapeDrawable; | ||||
|         if (materialShapeDrawable != null) { | ||||
|             MaterialShapeUtils.setParentAbsoluteElevation(this.view, materialShapeDrawable); | ||||
|         } | ||||
|         if (requirePreDrawListener()) { | ||||
|             this.view.getViewTreeObserver().addOnPreDrawListener(getOrCreatePreDrawListener()); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void onDetachedFromWindow() { | ||||
|         ViewTreeObserver viewTreeObserver = this.view.getViewTreeObserver(); | ||||
|         ViewTreeObserver.OnPreDrawListener onPreDrawListener = this.preDrawListener; | ||||
|         if (onPreDrawListener != null) { | ||||
|             viewTreeObserver.removeOnPreDrawListener(onPreDrawListener); | ||||
|             this.preDrawListener = null; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void onPreDraw() { | ||||
|         float rotation = this.view.getRotation(); | ||||
|         if (this.rotation != rotation) { | ||||
|             this.rotation = rotation; | ||||
|             updateFromViewRotation(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private ViewTreeObserver.OnPreDrawListener getOrCreatePreDrawListener() { | ||||
|         if (this.preDrawListener == null) { | ||||
|             this.preDrawListener = new ViewTreeObserver.OnPreDrawListener() { // from class: com.google.android.material.floatingactionbutton.FloatingActionButtonImpl.6 | ||||
|                 @Override // android.view.ViewTreeObserver.OnPreDrawListener | ||||
|                 public boolean onPreDraw() { | ||||
|                     FloatingActionButtonImpl.this.onPreDraw(); | ||||
|                     return true; | ||||
|                 } | ||||
|             }; | ||||
|         } | ||||
|         return this.preDrawListener; | ||||
|     } | ||||
|  | ||||
|     MaterialShapeDrawable createShapeDrawable() { | ||||
|         return new MaterialShapeDrawable((ShapeAppearanceModel) Preconditions.checkNotNull(this.shapeAppearance)); | ||||
|     } | ||||
|  | ||||
|     boolean isOrWillBeShown() { | ||||
|         return this.view.getVisibility() != 0 ? this.animState == 2 : this.animState != 1; | ||||
|     } | ||||
|  | ||||
|     boolean isOrWillBeHidden() { | ||||
|         return this.view.getVisibility() == 0 ? this.animState == 1 : this.animState != 2; | ||||
|     } | ||||
|  | ||||
|     private ValueAnimator createElevationAnimator(ShadowAnimatorImpl shadowAnimatorImpl) { | ||||
|         ValueAnimator valueAnimator = new ValueAnimator(); | ||||
|         valueAnimator.setInterpolator(ELEVATION_ANIM_INTERPOLATOR); | ||||
|         valueAnimator.setDuration(100L); | ||||
|         valueAnimator.addListener(shadowAnimatorImpl); | ||||
|         valueAnimator.addUpdateListener(shadowAnimatorImpl); | ||||
|         valueAnimator.setFloatValues(0.0f, 1.0f); | ||||
|         return valueAnimator; | ||||
|     } | ||||
|  | ||||
|     private abstract class ShadowAnimatorImpl extends AnimatorListenerAdapter implements ValueAnimator.AnimatorUpdateListener { | ||||
|         private float shadowSizeEnd; | ||||
|         private float shadowSizeStart; | ||||
|         private boolean validValues; | ||||
|  | ||||
|         protected abstract float getTargetShadowSize(); | ||||
|  | ||||
|         private ShadowAnimatorImpl() { | ||||
|         } | ||||
|  | ||||
|         @Override // android.animation.ValueAnimator.AnimatorUpdateListener | ||||
|         public void onAnimationUpdate(ValueAnimator valueAnimator) { | ||||
|             if (!this.validValues) { | ||||
|                 this.shadowSizeStart = FloatingActionButtonImpl.this.shapeDrawable == null ? 0.0f : FloatingActionButtonImpl.this.shapeDrawable.getElevation(); | ||||
|                 this.shadowSizeEnd = getTargetShadowSize(); | ||||
|                 this.validValues = true; | ||||
|             } | ||||
|             FloatingActionButtonImpl floatingActionButtonImpl = FloatingActionButtonImpl.this; | ||||
|             float f = this.shadowSizeStart; | ||||
|             floatingActionButtonImpl.updateShapeElevation((int) (f + ((this.shadowSizeEnd - f) * valueAnimator.getAnimatedFraction()))); | ||||
|         } | ||||
|  | ||||
|         @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener | ||||
|         public void onAnimationEnd(Animator animator) { | ||||
|             FloatingActionButtonImpl.this.updateShapeElevation((int) this.shadowSizeEnd); | ||||
|             this.validValues = false; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private class ResetElevationAnimation extends ShadowAnimatorImpl { | ||||
|         ResetElevationAnimation() { | ||||
|             super(); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl.ShadowAnimatorImpl | ||||
|         protected float getTargetShadowSize() { | ||||
|             return FloatingActionButtonImpl.this.elevation; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private class ElevateToHoveredFocusedTranslationZAnimation extends ShadowAnimatorImpl { | ||||
|         ElevateToHoveredFocusedTranslationZAnimation() { | ||||
|             super(); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl.ShadowAnimatorImpl | ||||
|         protected float getTargetShadowSize() { | ||||
|             return FloatingActionButtonImpl.this.elevation + FloatingActionButtonImpl.this.hoveredFocusedTranslationZ; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private class ElevateToPressedTranslationZAnimation extends ShadowAnimatorImpl { | ||||
|         ElevateToPressedTranslationZAnimation() { | ||||
|             super(); | ||||
|         } | ||||
|  | ||||
|         @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl.ShadowAnimatorImpl | ||||
|         protected float getTargetShadowSize() { | ||||
|             return FloatingActionButtonImpl.this.elevation + FloatingActionButtonImpl.this.pressedTranslationZ; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private class DisabledElevationAnimation extends ShadowAnimatorImpl { | ||||
|         @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl.ShadowAnimatorImpl | ||||
|         protected float getTargetShadowSize() { | ||||
|             return 0.0f; | ||||
|         } | ||||
|  | ||||
|         DisabledElevationAnimation() { | ||||
|             super(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private boolean shouldAnimateVisibilityChange() { | ||||
|         return ViewCompat.isLaidOut(this.view) && !this.view.isInEditMode(); | ||||
|     } | ||||
|  | ||||
|     void updateFromViewRotation() { | ||||
|         MaterialShapeDrawable materialShapeDrawable = this.shapeDrawable; | ||||
|         if (materialShapeDrawable != null) { | ||||
|             materialShapeDrawable.setShadowCompatRotation((int) this.rotation); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,188 @@ | ||||
| package com.google.android.material.floatingactionbutton; | ||||
|  | ||||
| import android.animation.Animator; | ||||
| import android.animation.AnimatorSet; | ||||
| import android.animation.ObjectAnimator; | ||||
| import android.animation.StateListAnimator; | ||||
| import android.content.Context; | ||||
| import android.content.res.ColorStateList; | ||||
| import android.graphics.PorterDuff; | ||||
| import android.graphics.Rect; | ||||
| import android.graphics.drawable.Drawable; | ||||
| import android.graphics.drawable.LayerDrawable; | ||||
| import android.graphics.drawable.RippleDrawable; | ||||
| import android.os.Build; | ||||
| import android.util.Property; | ||||
| import android.view.View; | ||||
| import androidx.core.content.ContextCompat; | ||||
| import androidx.core.util.Preconditions; | ||||
| import com.google.android.material.R; | ||||
| import com.google.android.material.ripple.RippleUtils; | ||||
| import com.google.android.material.shadow.ShadowViewDelegate; | ||||
| import com.google.android.material.shape.MaterialShapeDrawable; | ||||
| import com.google.android.material.shape.ShapeAppearanceModel; | ||||
| import java.util.ArrayList; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| class FloatingActionButtonImplLollipop extends FloatingActionButtonImpl { | ||||
|     private StateListAnimator stateListAnimator; | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl | ||||
|     void jumpDrawableToCurrentState() { | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl | ||||
|     boolean requirePreDrawListener() { | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl | ||||
|     void updateFromViewRotation() { | ||||
|     } | ||||
|  | ||||
|     FloatingActionButtonImplLollipop(FloatingActionButton floatingActionButton, ShadowViewDelegate shadowViewDelegate) { | ||||
|         super(floatingActionButton, shadowViewDelegate); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl | ||||
|     void initializeBackgroundDrawable(ColorStateList colorStateList, PorterDuff.Mode mode, ColorStateList colorStateList2, int i) { | ||||
|         Drawable drawable; | ||||
|         this.shapeDrawable = createShapeDrawable(); | ||||
|         this.shapeDrawable.setTintList(colorStateList); | ||||
|         if (mode != null) { | ||||
|             this.shapeDrawable.setTintMode(mode); | ||||
|         } | ||||
|         this.shapeDrawable.initializeElevationOverlay(this.view.getContext()); | ||||
|         if (i > 0) { | ||||
|             this.borderDrawable = createBorderDrawable(i, colorStateList); | ||||
|             drawable = new LayerDrawable(new Drawable[]{(Drawable) Preconditions.checkNotNull(this.borderDrawable), (Drawable) Preconditions.checkNotNull(this.shapeDrawable)}); | ||||
|         } else { | ||||
|             this.borderDrawable = null; | ||||
|             drawable = this.shapeDrawable; | ||||
|         } | ||||
|         this.rippleDrawable = new RippleDrawable(RippleUtils.sanitizeRippleDrawableColor(colorStateList2), drawable, null); | ||||
|         this.contentBackground = this.rippleDrawable; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl | ||||
|     void setRippleColor(ColorStateList colorStateList) { | ||||
|         if (this.rippleDrawable instanceof RippleDrawable) { | ||||
|             ((RippleDrawable) this.rippleDrawable).setColor(RippleUtils.sanitizeRippleDrawableColor(colorStateList)); | ||||
|         } else { | ||||
|             super.setRippleColor(colorStateList); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl | ||||
|     void onElevationsChanged(float f, float f2, float f3) { | ||||
|         if (Build.VERSION.SDK_INT == 21) { | ||||
|             this.view.refreshDrawableState(); | ||||
|         } else if (this.view.getStateListAnimator() == this.stateListAnimator) { | ||||
|             this.stateListAnimator = createDefaultStateListAnimator(f, f2, f3); | ||||
|             this.view.setStateListAnimator(this.stateListAnimator); | ||||
|         } | ||||
|         if (shouldAddPadding()) { | ||||
|             updatePadding(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private StateListAnimator createDefaultStateListAnimator(float f, float f2, float f3) { | ||||
|         StateListAnimator stateListAnimator = new StateListAnimator(); | ||||
|         stateListAnimator.addState(PRESSED_ENABLED_STATE_SET, createElevationAnimator(f, f3)); | ||||
|         stateListAnimator.addState(HOVERED_FOCUSED_ENABLED_STATE_SET, createElevationAnimator(f, f2)); | ||||
|         stateListAnimator.addState(FOCUSED_ENABLED_STATE_SET, createElevationAnimator(f, f2)); | ||||
|         stateListAnimator.addState(HOVERED_ENABLED_STATE_SET, createElevationAnimator(f, f2)); | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         ArrayList arrayList = new ArrayList(); | ||||
|         arrayList.add(ObjectAnimator.ofFloat(this.view, "elevation", f).setDuration(0L)); | ||||
|         if (Build.VERSION.SDK_INT >= 22 && Build.VERSION.SDK_INT <= 24) { | ||||
|             arrayList.add(ObjectAnimator.ofFloat(this.view, (Property<FloatingActionButton, Float>) View.TRANSLATION_Z, this.view.getTranslationZ()).setDuration(100L)); | ||||
|         } | ||||
|         arrayList.add(ObjectAnimator.ofFloat(this.view, (Property<FloatingActionButton, Float>) View.TRANSLATION_Z, 0.0f).setDuration(100L)); | ||||
|         animatorSet.playSequentially((Animator[]) arrayList.toArray(new Animator[0])); | ||||
|         animatorSet.setInterpolator(ELEVATION_ANIM_INTERPOLATOR); | ||||
|         stateListAnimator.addState(ENABLED_STATE_SET, animatorSet); | ||||
|         stateListAnimator.addState(EMPTY_STATE_SET, createElevationAnimator(0.0f, 0.0f)); | ||||
|         return stateListAnimator; | ||||
|     } | ||||
|  | ||||
|     private Animator createElevationAnimator(float f, float f2) { | ||||
|         AnimatorSet animatorSet = new AnimatorSet(); | ||||
|         animatorSet.play(ObjectAnimator.ofFloat(this.view, "elevation", f).setDuration(0L)).with(ObjectAnimator.ofFloat(this.view, (Property<FloatingActionButton, Float>) View.TRANSLATION_Z, f2).setDuration(100L)); | ||||
|         animatorSet.setInterpolator(ELEVATION_ANIM_INTERPOLATOR); | ||||
|         return animatorSet; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl | ||||
|     public float getElevation() { | ||||
|         return this.view.getElevation(); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl | ||||
|     void onCompatShadowChanged() { | ||||
|         updatePadding(); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl | ||||
|     boolean shouldAddPadding() { | ||||
|         return this.shadowViewDelegate.isCompatPaddingEnabled() || !shouldExpandBoundsForA11y(); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl | ||||
|     void onDrawableStateChanged(int[] iArr) { | ||||
|         if (Build.VERSION.SDK_INT == 21) { | ||||
|             if (this.view.isEnabled()) { | ||||
|                 this.view.setElevation(this.elevation); | ||||
|                 if (this.view.isPressed()) { | ||||
|                     this.view.setTranslationZ(this.pressedTranslationZ); | ||||
|                     return; | ||||
|                 } else if (this.view.isFocused() || this.view.isHovered()) { | ||||
|                     this.view.setTranslationZ(this.hoveredFocusedTranslationZ); | ||||
|                     return; | ||||
|                 } else { | ||||
|                     this.view.setTranslationZ(0.0f); | ||||
|                     return; | ||||
|                 } | ||||
|             } | ||||
|             this.view.setElevation(0.0f); | ||||
|             this.view.setTranslationZ(0.0f); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     BorderDrawable createBorderDrawable(int i, ColorStateList colorStateList) { | ||||
|         Context context = this.view.getContext(); | ||||
|         BorderDrawable borderDrawable = new BorderDrawable((ShapeAppearanceModel) Preconditions.checkNotNull(this.shapeAppearance)); | ||||
|         borderDrawable.setGradientColors(ContextCompat.getColor(context, R.color.design_fab_stroke_top_outer_color), ContextCompat.getColor(context, R.color.design_fab_stroke_top_inner_color), ContextCompat.getColor(context, R.color.design_fab_stroke_end_inner_color), ContextCompat.getColor(context, R.color.design_fab_stroke_end_outer_color)); | ||||
|         borderDrawable.setBorderWidth(i); | ||||
|         borderDrawable.setBorderTint(colorStateList); | ||||
|         return borderDrawable; | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl | ||||
|     MaterialShapeDrawable createShapeDrawable() { | ||||
|         return new AlwaysStatefulMaterialShapeDrawable((ShapeAppearanceModel) Preconditions.checkNotNull(this.shapeAppearance)); | ||||
|     } | ||||
|  | ||||
|     @Override // com.google.android.material.floatingactionbutton.FloatingActionButtonImpl | ||||
|     void getPadding(Rect rect) { | ||||
|         if (this.shadowViewDelegate.isCompatPaddingEnabled()) { | ||||
|             super.getPadding(rect); | ||||
|         } else if (!shouldExpandBoundsForA11y()) { | ||||
|             int sizeDimension = (this.minTouchTargetSize - this.view.getSizeDimension()) / 2; | ||||
|             rect.set(sizeDimension, sizeDimension, sizeDimension, sizeDimension); | ||||
|         } else { | ||||
|             rect.set(0, 0, 0, 0); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     static class AlwaysStatefulMaterialShapeDrawable extends MaterialShapeDrawable { | ||||
|         @Override // com.google.android.material.shape.MaterialShapeDrawable, android.graphics.drawable.Drawable | ||||
|         public boolean isStateful() { | ||||
|             return true; | ||||
|         } | ||||
|  | ||||
|         AlwaysStatefulMaterialShapeDrawable(ShapeAppearanceModel shapeAppearanceModel) { | ||||
|             super(shapeAppearanceModel); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,38 @@ | ||||
| package com.google.android.material.floatingactionbutton; | ||||
|  | ||||
| import android.animation.Animator; | ||||
| import android.animation.AnimatorSet; | ||||
| import com.google.android.material.animation.MotionSpec; | ||||
| import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton; | ||||
| import java.util.List; | ||||
|  | ||||
| /* loaded from: classes.dex */ | ||||
| interface MotionStrategy { | ||||
|     void addAnimationListener(Animator.AnimatorListener animatorListener); | ||||
|  | ||||
|     AnimatorSet createAnimator(); | ||||
|  | ||||
|     MotionSpec getCurrentMotionSpec(); | ||||
|  | ||||
|     int getDefaultMotionSpecResource(); | ||||
|  | ||||
|     List<Animator.AnimatorListener> getListeners(); | ||||
|  | ||||
|     MotionSpec getMotionSpec(); | ||||
|  | ||||
|     void onAnimationCancel(); | ||||
|  | ||||
|     void onAnimationEnd(); | ||||
|  | ||||
|     void onAnimationStart(Animator animator); | ||||
|  | ||||
|     void onChange(ExtendedFloatingActionButton.OnChangedCallback onChangedCallback); | ||||
|  | ||||
|     void performNow(); | ||||
|  | ||||
|     void removeAnimationListener(Animator.AnimatorListener animatorListener); | ||||
|  | ||||
|     void setMotionSpec(MotionSpec motionSpec); | ||||
|  | ||||
|     boolean shouldCancel(); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user