mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
903 lines
34 KiB
Java
903 lines
34 KiB
Java
|
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: classes2.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;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public static abstract class OnVisibilityChangedListener {
|
||
|
public void onHidden(FloatingActionButton floatingActionButton) {
|
||
|
}
|
||
|
|
||
|
public void onShown(FloatingActionButton floatingActionButton) {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Retention(RetentionPolicy.SOURCE)
|
||
|
/* loaded from: classes2.dex */
|
||
|
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);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public 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);
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
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);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
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 = true;
|
||
|
}
|
||
|
|
||
|
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, true);
|
||
|
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) {
|
||
|
return this.autoHideEnabled && ((CoordinatorLayout.LayoutParams) floatingActionButton.getLayoutParams()).getAnchorId() == view.getId() && floatingActionButton.getUserSetVisibility() == 0;
|
||
|
}
|
||
|
|
||
|
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 true;
|
||
|
}
|
||
|
floatingActionButton.show(this.internalAutoHideListener, false);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
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 true;
|
||
|
}
|
||
|
floatingActionButton.show(this.internalAutoHideListener, false);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@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 true;
|
||
|
}
|
||
|
|
||
|
@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 true;
|
||
|
}
|
||
|
|
||
|
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));
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
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());
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
/* loaded from: classes2.dex */
|
||
|
public 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;
|
||
|
}
|
||
|
}
|
||
|
}
|