mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-13 09:27:16 +01:00
1024 lines
48 KiB
Java
1024 lines
48 KiB
Java
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.annotation.AnimatorRes;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.VisibleForTesting;
|
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
import com.facebook.react.uimanager.ViewProps;
|
|
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 defpackage.a$$ExternalSyntheticOutline0;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import rx.Single$$ExternalSyntheticBUOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes7.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 DEF_STYLE_RES = R.style.Widget_MaterialComponents_ExtendedFloatingActionButton_Icon;
|
|
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;
|
|
static final Property<View, Float> HEIGHT;
|
|
private static final int HIDE = 1;
|
|
static final Property<View, Float> PADDING_END;
|
|
static final Property<View, Float> PADDING_START;
|
|
private static final int SHOW = 0;
|
|
private static final int SHRINK = 2;
|
|
static final Property<View, Float> WIDTH;
|
|
private int animState;
|
|
private boolean animateShowBeforeLayout;
|
|
private boolean animationEnabled;
|
|
|
|
@NonNull
|
|
private final CoordinatorLayout.Behavior<ExtendedFloatingActionButton> behavior;
|
|
private final AnimatorTracker changeVisibilityTracker;
|
|
private final int collapsedSize;
|
|
|
|
@NonNull
|
|
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;
|
|
|
|
@NonNull
|
|
protected ColorStateList originalTextCsl;
|
|
private int originalWidth;
|
|
private final MotionStrategy showStrategy;
|
|
|
|
@NonNull
|
|
private final MotionStrategy shrinkStrategy;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public class ChangeSizeStrategy extends BaseMotionStrategy {
|
|
private final boolean extending;
|
|
private final Size size;
|
|
|
|
public ChangeSizeStrategy(AnimatorTracker animatorTracker, Size size, boolean z) {
|
|
super(ExtendedFloatingActionButton.this, animatorTracker);
|
|
this.size = size;
|
|
this.extending = z;
|
|
}
|
|
|
|
@Override // com.google.android.material.floatingactionbutton.BaseMotionStrategy, com.google.android.material.floatingactionbutton.MotionStrategy
|
|
@NonNull
|
|
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(ViewProps.PADDING_START)) {
|
|
PropertyValuesHolder[] propertyValues3 = currentMotionSpec.getPropertyValues(ViewProps.PADDING_START);
|
|
propertyValues3[0].setFloatValues(ExtendedFloatingActionButton.this.getPaddingStart(), this.size.getPaddingStart());
|
|
currentMotionSpec.setPropertyValues(ViewProps.PADDING_START, propertyValues3);
|
|
}
|
|
if (currentMotionSpec.hasPropertyValues(ViewProps.PADDING_END)) {
|
|
PropertyValuesHolder[] propertyValues4 = currentMotionSpec.getPropertyValues(ViewProps.PADDING_END);
|
|
propertyValues4[0].setFloatValues(ExtendedFloatingActionButton.this.getPaddingEnd(), this.size.getPaddingEnd());
|
|
currentMotionSpec.setPropertyValues(ViewProps.PADDING_END, 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.MotionStrategy
|
|
public int getDefaultMotionSpecResource() {
|
|
return this.extending ? R.animator.mtrl_extended_fab_change_size_expand_motion_spec : R.animator.mtrl_extended_fab_change_size_collapse_motion_spec;
|
|
}
|
|
|
|
@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.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.MotionStrategy
|
|
public void onChange(@Nullable OnChangedCallback onChangedCallback) {
|
|
if (onChangedCallback == null) {
|
|
return;
|
|
}
|
|
boolean z = this.extending;
|
|
ExtendedFloatingActionButton extendedFloatingActionButton = ExtendedFloatingActionButton.this;
|
|
if (z) {
|
|
onChangedCallback.onExtended(extendedFloatingActionButton);
|
|
} else {
|
|
onChangedCallback.onShrunken(extendedFloatingActionButton);
|
|
}
|
|
}
|
|
|
|
@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;
|
|
boolean z = this.extending;
|
|
ExtendedFloatingActionButton extendedFloatingActionButton = ExtendedFloatingActionButton.this;
|
|
if (z) {
|
|
extendedFloatingActionButton.silentlyUpdateTextColor(extendedFloatingActionButton.originalTextCsl);
|
|
} else if (extendedFloatingActionButton.getText() != null && ExtendedFloatingActionButton.this.getText() != "") {
|
|
ExtendedFloatingActionButton.this.silentlyUpdateTextColor(ColorStateList.valueOf(0));
|
|
}
|
|
ExtendedFloatingActionButton.this.setPaddingRelative(this.size.getPaddingStart(), ExtendedFloatingActionButton.this.getPaddingTop(), this.size.getPaddingEnd(), ExtendedFloatingActionButton.this.getPaddingBottom());
|
|
ExtendedFloatingActionButton.this.requestLayout();
|
|
}
|
|
|
|
@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());
|
|
}
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public class HideStrategy extends BaseMotionStrategy {
|
|
private boolean isCancelled;
|
|
|
|
public HideStrategy(AnimatorTracker animatorTracker) {
|
|
super(ExtendedFloatingActionButton.this, animatorTracker);
|
|
}
|
|
|
|
@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 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);
|
|
}
|
|
|
|
@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.MotionStrategy
|
|
public void onChange(@Nullable OnChangedCallback onChangedCallback) {
|
|
if (onChangedCallback != null) {
|
|
onChangedCallback.onHidden(ExtendedFloatingActionButton.this);
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.material.floatingactionbutton.MotionStrategy
|
|
public void performNow() {
|
|
ExtendedFloatingActionButton.this.setVisibility(8);
|
|
}
|
|
|
|
@Override // com.google.android.material.floatingactionbutton.MotionStrategy
|
|
public boolean shouldCancel() {
|
|
return ExtendedFloatingActionButton.this.isOrWillBeHidden();
|
|
}
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public class ShowStrategy extends BaseMotionStrategy {
|
|
public ShowStrategy(AnimatorTracker animatorTracker) {
|
|
super(ExtendedFloatingActionButton.this, animatorTracker);
|
|
}
|
|
|
|
@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 onAnimationEnd() {
|
|
super.onAnimationEnd();
|
|
ExtendedFloatingActionButton.this.animState = 0;
|
|
}
|
|
|
|
@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.MotionStrategy
|
|
public void onChange(@Nullable OnChangedCallback onChangedCallback) {
|
|
if (onChangedCallback != null) {
|
|
onChangedCallback.onShown(ExtendedFloatingActionButton.this);
|
|
}
|
|
}
|
|
|
|
@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 boolean shouldCancel() {
|
|
return ExtendedFloatingActionButton.this.isOrWillBeShown();
|
|
}
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public interface Size {
|
|
int getHeight();
|
|
|
|
ViewGroup.LayoutParams getLayoutParams();
|
|
|
|
int getPaddingEnd();
|
|
|
|
int getPaddingStart();
|
|
|
|
int getWidth();
|
|
}
|
|
|
|
static {
|
|
Class<Float> cls = Float.class;
|
|
WIDTH = new Property<View, Float>(cls, "width") { // from class: com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.6
|
|
@Override // android.util.Property
|
|
@NonNull
|
|
public Float get(@NonNull View view) {
|
|
return Float.valueOf(view.getLayoutParams().width);
|
|
}
|
|
|
|
@Override // android.util.Property
|
|
public void set(@NonNull View view, @NonNull Float f) {
|
|
view.getLayoutParams().width = f.intValue();
|
|
view.requestLayout();
|
|
}
|
|
};
|
|
HEIGHT = new Property<View, Float>(cls, "height") { // from class: com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.7
|
|
@Override // android.util.Property
|
|
@NonNull
|
|
public Float get(@NonNull View view) {
|
|
return Float.valueOf(view.getLayoutParams().height);
|
|
}
|
|
|
|
@Override // android.util.Property
|
|
public void set(@NonNull View view, @NonNull Float f) {
|
|
view.getLayoutParams().height = f.intValue();
|
|
view.requestLayout();
|
|
}
|
|
};
|
|
PADDING_START = new Property<View, Float>(cls, ViewProps.PADDING_START) { // from class: com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.8
|
|
@Override // android.util.Property
|
|
@NonNull
|
|
public Float get(@NonNull View view) {
|
|
return Float.valueOf(view.getPaddingStart());
|
|
}
|
|
|
|
@Override // android.util.Property
|
|
public void set(@NonNull View view, @NonNull Float f) {
|
|
view.setPaddingRelative(f.intValue(), view.getPaddingTop(), view.getPaddingEnd(), view.getPaddingBottom());
|
|
}
|
|
};
|
|
PADDING_END = new Property<View, Float>(cls, ViewProps.PADDING_END) { // from class: com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.9
|
|
@Override // android.util.Property
|
|
@NonNull
|
|
public Float get(@NonNull View view) {
|
|
return Float.valueOf(view.getPaddingEnd());
|
|
}
|
|
|
|
@Override // android.util.Property
|
|
public void set(@NonNull View view, @NonNull Float f) {
|
|
view.setPaddingRelative(view.getPaddingStart(), view.getPaddingTop(), f.intValue(), view.getPaddingBottom());
|
|
}
|
|
};
|
|
}
|
|
|
|
/* 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(@androidx.annotation.NonNull android.content.Context r18, @androidx.annotation.Nullable android.util.AttributeSet r19, int r20) {
|
|
/*
|
|
r17 = this;
|
|
r0 = r17
|
|
r2 = r19
|
|
r4 = r20
|
|
int r5 = com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.DEF_STYLE_RES
|
|
r1 = r18
|
|
android.content.Context r1 = com.google.android.material.theme.overlay.MaterialThemeOverlay.wrap(r1, r2, r4, r5)
|
|
r0.<init>(r1, r2, r4)
|
|
r7 = 0
|
|
r0.animState = r7
|
|
r8 = 1
|
|
r0.animationEnabled = r8
|
|
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 r9 = new com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$ShowStrategy
|
|
r9.<init>(r1)
|
|
r0.showStrategy = r9
|
|
com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$HideStrategy r10 = new com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$HideStrategy
|
|
r10.<init>(r1)
|
|
r0.hideStrategy = r10
|
|
r0.isExtended = r8
|
|
r0.isTransforming = r7
|
|
r0.animateShowBeforeLayout = r7
|
|
android.content.Context r1 = r0.getContext()
|
|
com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$ExtendedFloatingActionButtonBehavior r3 = new com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$ExtendedFloatingActionButtonBehavior
|
|
r3.<init>(r1, r2)
|
|
r0.behavior = r3
|
|
int[] r3 = com.google.android.material.R.styleable.ExtendedFloatingActionButton
|
|
int[] r6 = new int[r7]
|
|
android.content.res.TypedArray r3 = com.google.android.material.internal.ThemeEnforcement.obtainStyledAttributes(r1, r2, r3, r4, r5, r6)
|
|
int r6 = com.google.android.material.R.styleable.ExtendedFloatingActionButton_showMotionSpec
|
|
com.google.android.material.animation.MotionSpec r6 = com.google.android.material.animation.MotionSpec.createFromAttribute(r1, r3, r6)
|
|
int r11 = com.google.android.material.R.styleable.ExtendedFloatingActionButton_hideMotionSpec
|
|
com.google.android.material.animation.MotionSpec r11 = com.google.android.material.animation.MotionSpec.createFromAttribute(r1, r3, r11)
|
|
int r12 = com.google.android.material.R.styleable.ExtendedFloatingActionButton_extendMotionSpec
|
|
com.google.android.material.animation.MotionSpec r12 = com.google.android.material.animation.MotionSpec.createFromAttribute(r1, r3, r12)
|
|
int r13 = com.google.android.material.R.styleable.ExtendedFloatingActionButton_shrinkMotionSpec
|
|
com.google.android.material.animation.MotionSpec r13 = com.google.android.material.animation.MotionSpec.createFromAttribute(r1, r3, r13)
|
|
int r14 = com.google.android.material.R.styleable.ExtendedFloatingActionButton_collapsedSize
|
|
r15 = -1
|
|
int r14 = r3.getDimensionPixelSize(r14, r15)
|
|
r0.collapsedSize = r14
|
|
int r14 = com.google.android.material.R.styleable.ExtendedFloatingActionButton_extendStrategy
|
|
int r14 = r3.getInt(r14, r8)
|
|
r0.extendStrategyType = r14
|
|
int r15 = r0.getPaddingStart()
|
|
r0.extendedPaddingStart = r15
|
|
int r15 = r0.getPaddingEnd()
|
|
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 r7 = new com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$ChangeSizeStrategy
|
|
com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$Size r14 = r0.getSizeFromExtendStrategyType(r14)
|
|
r7.<init>(r15, r14, r8)
|
|
r0.extendStrategy = r7
|
|
com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$ChangeSizeStrategy r8 = new com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$ChangeSizeStrategy
|
|
com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$1 r14 = new com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton$1
|
|
r14.<init>()
|
|
r16 = r3
|
|
r3 = 0
|
|
r8.<init>(r15, r14, r3)
|
|
r0.shrinkStrategy = r8
|
|
r9.setMotionSpec(r6)
|
|
r10.setMotionSpec(r11)
|
|
r7.setMotionSpec(r12)
|
|
r8.setMotionSpec(r13)
|
|
r16.recycle()
|
|
com.google.android.material.shape.CornerSize r3 = com.google.android.material.shape.ShapeAppearanceModel.PILL
|
|
com.google.android.material.shape.ShapeAppearanceModel$Builder r1 = com.google.android.material.shape.ShapeAppearanceModel.builder(r1, r2, r4, r5, r3)
|
|
com.google.android.material.shape.ShapeAppearanceModel r1 = r1.build()
|
|
r0.setShapeAppearanceModel(r1)
|
|
r0.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 getHeight() {
|
|
return ExtendedFloatingActionButton.this.getMeasuredHeight();
|
|
}
|
|
|
|
@Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size
|
|
public ViewGroup.LayoutParams getLayoutParams() {
|
|
return new ViewGroup.LayoutParams(-2, -2);
|
|
}
|
|
|
|
@Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size
|
|
public int getPaddingEnd() {
|
|
return ExtendedFloatingActionButton.this.extendedPaddingEnd;
|
|
}
|
|
|
|
@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 getWidth() {
|
|
return ExtendedFloatingActionButton.this.extendedPaddingEnd + ExtendedFloatingActionButton.this.extendedPaddingStart + ((ExtendedFloatingActionButton.this.getMeasuredWidth() - ExtendedFloatingActionButton.this.getPaddingStart()) - ExtendedFloatingActionButton.this.getPaddingEnd());
|
|
}
|
|
};
|
|
final Size size2 = new Size() { // from class: com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.3
|
|
@Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size
|
|
public int getHeight() {
|
|
ViewGroup.MarginLayoutParams marginLayoutParams;
|
|
int i2 = ExtendedFloatingActionButton.this.originalHeight;
|
|
ExtendedFloatingActionButton extendedFloatingActionButton = ExtendedFloatingActionButton.this;
|
|
if (i2 != -1) {
|
|
return (extendedFloatingActionButton.originalHeight == 0 || ExtendedFloatingActionButton.this.originalHeight == -2) ? size.getHeight() : ExtendedFloatingActionButton.this.originalHeight;
|
|
}
|
|
if (!(extendedFloatingActionButton.getParent() instanceof View)) {
|
|
return size.getHeight();
|
|
}
|
|
View view = (View) ExtendedFloatingActionButton.this.getParent();
|
|
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
|
|
if (layoutParams == null || layoutParams.height != -2) {
|
|
return (view.getHeight() - ((!(ExtendedFloatingActionButton.this.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) || (marginLayoutParams = (ViewGroup.MarginLayoutParams) ExtendedFloatingActionButton.this.getLayoutParams()) == null) ? 0 : marginLayoutParams.topMargin + marginLayoutParams.bottomMargin)) - (view.getPaddingBottom() + view.getPaddingTop());
|
|
}
|
|
return size.getHeight();
|
|
}
|
|
|
|
@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);
|
|
}
|
|
|
|
@Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size
|
|
public int getPaddingEnd() {
|
|
return ExtendedFloatingActionButton.this.extendedPaddingEnd;
|
|
}
|
|
|
|
@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 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 (view.getWidth() - ((!(ExtendedFloatingActionButton.this.getLayoutParams() instanceof ViewGroup.MarginLayoutParams) || (marginLayoutParams = (ViewGroup.MarginLayoutParams) ExtendedFloatingActionButton.this.getLayoutParams()) == null) ? 0 : marginLayoutParams.leftMargin + marginLayoutParams.rightMargin)) - (view.getPaddingRight() + view.getPaddingLeft());
|
|
}
|
|
return size.getWidth();
|
|
}
|
|
};
|
|
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 getHeight() {
|
|
return ExtendedFloatingActionButton.this.originalHeight == -1 ? size2.getHeight() : (ExtendedFloatingActionButton.this.originalHeight == 0 || ExtendedFloatingActionButton.this.originalHeight == -2) ? size.getHeight() : ExtendedFloatingActionButton.this.originalHeight;
|
|
}
|
|
|
|
@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);
|
|
}
|
|
|
|
@Override // com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton.Size
|
|
public int getPaddingEnd() {
|
|
return ExtendedFloatingActionButton.this.extendedPaddingEnd;
|
|
}
|
|
|
|
@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 getWidth() {
|
|
return ExtendedFloatingActionButton.this.originalWidth == -1 ? size2.getWidth() : (ExtendedFloatingActionButton.this.originalWidth == 0 || ExtendedFloatingActionButton.this.originalWidth == -2) ? size.getWidth() : ExtendedFloatingActionButton.this.originalWidth;
|
|
}
|
|
} : size2 : size;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public boolean isOrWillBeHidden() {
|
|
int visibility = getVisibility();
|
|
int i = this.animState;
|
|
return visibility == 0 ? i == 1 : i != 2;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public boolean isOrWillBeShown() {
|
|
int visibility = getVisibility();
|
|
int i = this.animState;
|
|
return visibility != 0 ? i == 2 : i != 1;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void performMotion(int i, @Nullable 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) {
|
|
Single$$ExternalSyntheticBUOutline0.m$2(a$$ExternalSyntheticOutline0.m(i, "Unknown strategy type: "));
|
|
return;
|
|
}
|
|
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 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);
|
|
}
|
|
|
|
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
|
public void onAnimationStart(Animator animator) {
|
|
motionStrategy.onAnimationStart(animator);
|
|
this.cancelled = false;
|
|
}
|
|
});
|
|
Iterator<Animator.AnimatorListener> it2 = motionStrategy.getListeners().iterator();
|
|
while (it2.hasNext()) {
|
|
createAnimator.addListener(it2.next());
|
|
}
|
|
createAnimator.start();
|
|
}
|
|
|
|
private void saveOriginalTextCsl() {
|
|
this.originalTextCsl = getTextColors();
|
|
}
|
|
|
|
private boolean shouldAnimateVisibilityChange() {
|
|
if (this.animationEnabled) {
|
|
return (isLaidOut() || (!isOrWillBeShown() && this.animateShowBeforeLayout)) && !isInEditMode();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void addOnExtendAnimationListener(@NonNull Animator.AnimatorListener animatorListener) {
|
|
this.extendStrategy.addAnimationListener(animatorListener);
|
|
}
|
|
|
|
public void addOnHideAnimationListener(@NonNull Animator.AnimatorListener animatorListener) {
|
|
this.hideStrategy.addAnimationListener(animatorListener);
|
|
}
|
|
|
|
public void addOnShowAnimationListener(@NonNull Animator.AnimatorListener animatorListener) {
|
|
this.showStrategy.addAnimationListener(animatorListener);
|
|
}
|
|
|
|
public void addOnShrinkAnimationListener(@NonNull Animator.AnimatorListener animatorListener) {
|
|
this.shrinkStrategy.addAnimationListener(animatorListener);
|
|
}
|
|
|
|
public void extend() {
|
|
performMotion(3, null);
|
|
}
|
|
|
|
@Override // android.widget.Button, android.widget.TextView, android.view.View
|
|
public CharSequence getAccessibilityClassName() {
|
|
return "com.google.android.material.floatingactionbutton.FloatingActionButton";
|
|
}
|
|
|
|
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.AttachedBehavior
|
|
@NonNull
|
|
public CoordinatorLayout.Behavior<ExtendedFloatingActionButton> getBehavior() {
|
|
return this.behavior;
|
|
}
|
|
|
|
public int getCollapsedPadding() {
|
|
return (getCollapsedSize() - getIconSize()) / 2;
|
|
}
|
|
|
|
@VisibleForTesting
|
|
public int getCollapsedSize() {
|
|
int i = this.collapsedSize;
|
|
if (i >= 0) {
|
|
return i;
|
|
}
|
|
return getIconSize() + (Math.min(getPaddingStart(), getPaddingEnd()) * 2);
|
|
}
|
|
|
|
@Nullable
|
|
public MotionSpec getExtendMotionSpec() {
|
|
return this.extendStrategy.getMotionSpec();
|
|
}
|
|
|
|
@Nullable
|
|
public MotionSpec getHideMotionSpec() {
|
|
return this.hideStrategy.getMotionSpec();
|
|
}
|
|
|
|
@Nullable
|
|
public MotionSpec getShowMotionSpec() {
|
|
return this.showStrategy.getMotionSpec();
|
|
}
|
|
|
|
@Nullable
|
|
public MotionSpec getShrinkMotionSpec() {
|
|
return this.shrinkStrategy.getMotionSpec();
|
|
}
|
|
|
|
public void hide() {
|
|
performMotion(1, null);
|
|
}
|
|
|
|
public boolean isAnimationEnabled() {
|
|
return this.animationEnabled;
|
|
}
|
|
|
|
public final boolean isExtended() {
|
|
return this.isExtended;
|
|
}
|
|
|
|
@Override // com.google.android.material.button.MaterialButton, android.widget.TextView, android.view.View
|
|
public void onAttachedToWindow() {
|
|
super.onAttachedToWindow();
|
|
if (this.isExtended && TextUtils.isEmpty(getText()) && getIcon() != null) {
|
|
this.isExtended = false;
|
|
this.shrinkStrategy.performNow();
|
|
}
|
|
}
|
|
|
|
public void removeOnExtendAnimationListener(@NonNull Animator.AnimatorListener animatorListener) {
|
|
this.extendStrategy.removeAnimationListener(animatorListener);
|
|
}
|
|
|
|
public void removeOnHideAnimationListener(@NonNull Animator.AnimatorListener animatorListener) {
|
|
this.hideStrategy.removeAnimationListener(animatorListener);
|
|
}
|
|
|
|
public void removeOnShowAnimationListener(@NonNull Animator.AnimatorListener animatorListener) {
|
|
this.showStrategy.removeAnimationListener(animatorListener);
|
|
}
|
|
|
|
public void removeOnShrinkAnimationListener(@NonNull Animator.AnimatorListener animatorListener) {
|
|
this.shrinkStrategy.removeAnimationListener(animatorListener);
|
|
}
|
|
|
|
public void setAnimateShowBeforeLayout(boolean z) {
|
|
this.animateShowBeforeLayout = z;
|
|
}
|
|
|
|
public void setAnimationEnabled(boolean z) {
|
|
this.animationEnabled = z;
|
|
}
|
|
|
|
public void setExtendMotionSpec(@Nullable MotionSpec motionSpec) {
|
|
this.extendStrategy.setMotionSpec(motionSpec);
|
|
}
|
|
|
|
public void setExtendMotionSpecResource(@AnimatorRes int i) {
|
|
setExtendMotionSpec(MotionSpec.createFromResource(getContext(), i));
|
|
}
|
|
|
|
public void setExtended(boolean z) {
|
|
if (this.isExtended == z) {
|
|
return;
|
|
}
|
|
MotionStrategy motionStrategy = z ? this.extendStrategy : this.shrinkStrategy;
|
|
if (motionStrategy.shouldCancel()) {
|
|
return;
|
|
}
|
|
motionStrategy.performNow();
|
|
}
|
|
|
|
public void setHideMotionSpec(@Nullable MotionSpec motionSpec) {
|
|
this.hideStrategy.setMotionSpec(motionSpec);
|
|
}
|
|
|
|
public void setHideMotionSpecResource(@AnimatorRes int i) {
|
|
setHideMotionSpec(MotionSpec.createFromResource(getContext(), i));
|
|
}
|
|
|
|
@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 = getPaddingStart();
|
|
this.extendedPaddingEnd = getPaddingEnd();
|
|
}
|
|
|
|
@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;
|
|
}
|
|
|
|
public void setShowMotionSpec(@Nullable MotionSpec motionSpec) {
|
|
this.showStrategy.setMotionSpec(motionSpec);
|
|
}
|
|
|
|
public void setShowMotionSpecResource(@AnimatorRes int i) {
|
|
setShowMotionSpec(MotionSpec.createFromResource(getContext(), i));
|
|
}
|
|
|
|
public void setShrinkMotionSpec(@Nullable MotionSpec motionSpec) {
|
|
this.shrinkStrategy.setMotionSpec(motionSpec);
|
|
}
|
|
|
|
public void setShrinkMotionSpecResource(@AnimatorRes int i) {
|
|
setShrinkMotionSpec(MotionSpec.createFromResource(getContext(), i));
|
|
}
|
|
|
|
@Override // android.widget.TextView
|
|
public void setTextColor(int i) {
|
|
super.setTextColor(i);
|
|
saveOriginalTextCsl();
|
|
}
|
|
|
|
public void show() {
|
|
performMotion(0, null);
|
|
}
|
|
|
|
public void shrink() {
|
|
performMotion(2, null);
|
|
}
|
|
|
|
public void silentlyUpdateTextColor(@NonNull ColorStateList colorStateList) {
|
|
super.setTextColor(colorStateList);
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public 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;
|
|
|
|
@Nullable
|
|
private OnChangedCallback internalAutoHideCallback;
|
|
|
|
@Nullable
|
|
private OnChangedCallback internalAutoShrinkCallback;
|
|
private Rect tmpRect;
|
|
|
|
public ExtendedFloatingActionButtonBehavior(@NonNull Context context, @Nullable 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, true);
|
|
obtainStyledAttributes.recycle();
|
|
}
|
|
|
|
private static boolean isBottomSheet(@NonNull View view) {
|
|
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
|
|
if (layoutParams instanceof CoordinatorLayout.LayoutParams) {
|
|
return ((CoordinatorLayout.LayoutParams) layoutParams).getBehavior() instanceof BottomSheetBehavior;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private boolean shouldUpdateVisibility(@NonNull View view, @NonNull ExtendedFloatingActionButton extendedFloatingActionButton) {
|
|
return (this.autoHideEnabled || this.autoShrinkEnabled) && ((CoordinatorLayout.LayoutParams) extendedFloatingActionButton.getLayoutParams()).getAnchorId() == view.getId();
|
|
}
|
|
|
|
private boolean updateFabVisibilityForAppBarLayout(CoordinatorLayout coordinatorLayout, @NonNull AppBarLayout appBarLayout, @NonNull 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 true;
|
|
}
|
|
extendOrShow(extendedFloatingActionButton);
|
|
return true;
|
|
}
|
|
|
|
private boolean updateFabVisibilityForBottomSheet(@NonNull View view, @NonNull ExtendedFloatingActionButton extendedFloatingActionButton) {
|
|
if (!shouldUpdateVisibility(view, extendedFloatingActionButton)) {
|
|
return false;
|
|
}
|
|
if (view.getTop() < (extendedFloatingActionButton.getHeight() / 2) + ((ViewGroup.MarginLayoutParams) ((CoordinatorLayout.LayoutParams) extendedFloatingActionButton.getLayoutParams())).topMargin) {
|
|
shrinkOrHide(extendedFloatingActionButton);
|
|
return true;
|
|
}
|
|
extendOrShow(extendedFloatingActionButton);
|
|
return true;
|
|
}
|
|
|
|
public void extendOrShow(@NonNull ExtendedFloatingActionButton extendedFloatingActionButton) {
|
|
boolean z = this.autoShrinkEnabled;
|
|
extendedFloatingActionButton.performMotion(z ? 3 : 0, z ? this.internalAutoShrinkCallback : this.internalAutoHideCallback);
|
|
}
|
|
|
|
public boolean isAutoHideEnabled() {
|
|
return this.autoHideEnabled;
|
|
}
|
|
|
|
public boolean isAutoShrinkEnabled() {
|
|
return this.autoShrinkEnabled;
|
|
}
|
|
|
|
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
|
|
public void onAttachedToLayoutParams(@NonNull CoordinatorLayout.LayoutParams layoutParams) {
|
|
if (layoutParams.dodgeInsetEdges == 0) {
|
|
layoutParams.dodgeInsetEdges = 80;
|
|
}
|
|
}
|
|
|
|
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
|
|
public boolean onDependentViewChanged(CoordinatorLayout coordinatorLayout, @NonNull 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;
|
|
}
|
|
|
|
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
|
|
public boolean onLayoutChild(@NonNull CoordinatorLayout coordinatorLayout, @NonNull 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 (isBottomSheet(view) && updateFabVisibilityForBottomSheet(view, extendedFloatingActionButton)) {
|
|
break;
|
|
}
|
|
} else {
|
|
if (updateFabVisibilityForAppBarLayout(coordinatorLayout, (AppBarLayout) view, extendedFloatingActionButton)) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
coordinatorLayout.onLayoutChild(extendedFloatingActionButton, i);
|
|
return true;
|
|
}
|
|
|
|
public void setAutoHideEnabled(boolean z) {
|
|
this.autoHideEnabled = z;
|
|
}
|
|
|
|
public void setAutoShrinkEnabled(boolean z) {
|
|
this.autoShrinkEnabled = z;
|
|
}
|
|
|
|
@VisibleForTesting
|
|
public void setInternalAutoHideCallback(@Nullable OnChangedCallback onChangedCallback) {
|
|
this.internalAutoHideCallback = onChangedCallback;
|
|
}
|
|
|
|
@VisibleForTesting
|
|
public void setInternalAutoShrinkCallback(@Nullable OnChangedCallback onChangedCallback) {
|
|
this.internalAutoShrinkCallback = onChangedCallback;
|
|
}
|
|
|
|
public void shrinkOrHide(@NonNull ExtendedFloatingActionButton extendedFloatingActionButton) {
|
|
boolean z = this.autoShrinkEnabled;
|
|
extendedFloatingActionButton.performMotion(z ? 2 : 1, z ? this.internalAutoShrinkCallback : this.internalAutoHideCallback);
|
|
}
|
|
|
|
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
|
|
public boolean getInsetDodgeRect(@NonNull CoordinatorLayout coordinatorLayout, @NonNull ExtendedFloatingActionButton extendedFloatingActionButton, @NonNull Rect rect) {
|
|
return super.getInsetDodgeRect(coordinatorLayout, (CoordinatorLayout) extendedFloatingActionButton, rect);
|
|
}
|
|
|
|
public ExtendedFloatingActionButtonBehavior() {
|
|
this.autoHideEnabled = false;
|
|
this.autoShrinkEnabled = true;
|
|
}
|
|
}
|
|
|
|
public void extend(@NonNull OnChangedCallback onChangedCallback) {
|
|
performMotion(3, onChangedCallback);
|
|
}
|
|
|
|
public void hide(@NonNull OnChangedCallback onChangedCallback) {
|
|
performMotion(1, onChangedCallback);
|
|
}
|
|
|
|
public void show(@NonNull OnChangedCallback onChangedCallback) {
|
|
performMotion(0, onChangedCallback);
|
|
}
|
|
|
|
public void shrink(@NonNull OnChangedCallback onChangedCallback) {
|
|
performMotion(2, onChangedCallback);
|
|
}
|
|
|
|
@Override // android.widget.TextView
|
|
public void setTextColor(@NonNull ColorStateList colorStateList) {
|
|
super.setTextColor(colorStateList);
|
|
saveOriginalTextCsl();
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
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) {
|
|
}
|
|
}
|
|
|
|
public ExtendedFloatingActionButton(@NonNull Context context, @Nullable AttributeSet attributeSet) {
|
|
this(context, attributeSet, R.attr.extendedFloatingActionButtonStyle);
|
|
}
|
|
|
|
public ExtendedFloatingActionButton(@NonNull Context context) {
|
|
this(context, null);
|
|
}
|
|
}
|