Initial commit
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
package com.google.android.material.transformation;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import com.google.android.material.expandable.ExpandableWidget;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class ExpandableBehavior extends CoordinatorLayout.Behavior<View> {
|
||||
private int a;
|
||||
|
||||
public ExpandableBehavior() {
|
||||
this.a = 0;
|
||||
}
|
||||
|
||||
protected abstract boolean a(View view, View view2, boolean z, boolean z2);
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
|
||||
public boolean b(CoordinatorLayout coordinatorLayout, View view, View view2) {
|
||||
ExpandableWidget expandableWidget = (ExpandableWidget) view2;
|
||||
if (!a(expandableWidget.isExpanded())) {
|
||||
return false;
|
||||
}
|
||||
this.a = expandableWidget.isExpanded() ? 1 : 2;
|
||||
return a((View) expandableWidget, view, expandableWidget.isExpanded(), true);
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
protected ExpandableWidget e(CoordinatorLayout coordinatorLayout, View view) {
|
||||
List<View> b = coordinatorLayout.b(view);
|
||||
int size = b.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
View view2 = b.get(i);
|
||||
if (a(coordinatorLayout, (CoordinatorLayout) view, view2)) {
|
||||
return (ExpandableWidget) view2;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
|
||||
public boolean a(CoordinatorLayout coordinatorLayout, final View view, int i) {
|
||||
final ExpandableWidget e;
|
||||
if (ViewCompat.x(view) || (e = e(coordinatorLayout, view)) == null || !a(e.isExpanded())) {
|
||||
return false;
|
||||
}
|
||||
this.a = e.isExpanded() ? 1 : 2;
|
||||
final int i2 = this.a;
|
||||
view.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { // from class: com.google.android.material.transformation.ExpandableBehavior.1
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // android.view.ViewTreeObserver.OnPreDrawListener
|
||||
public boolean onPreDraw() {
|
||||
view.getViewTreeObserver().removeOnPreDrawListener(this);
|
||||
if (ExpandableBehavior.this.a == i2) {
|
||||
ExpandableBehavior expandableBehavior = ExpandableBehavior.this;
|
||||
ExpandableWidget expandableWidget = e;
|
||||
expandableBehavior.a((View) expandableWidget, view, expandableWidget.isExpanded(), false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
public ExpandableBehavior(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.a = 0;
|
||||
}
|
||||
|
||||
private boolean a(boolean z) {
|
||||
if (!z) {
|
||||
return this.a == 1;
|
||||
}
|
||||
int i = this.a;
|
||||
return i == 0 || i == 2;
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
package com.google.android.material.transformation;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class ExpandableTransformationBehavior extends ExpandableBehavior {
|
||||
private AnimatorSet b;
|
||||
|
||||
public ExpandableTransformationBehavior() {
|
||||
}
|
||||
|
||||
protected abstract AnimatorSet b(View view, View view2, boolean z, boolean z2);
|
||||
|
||||
public ExpandableTransformationBehavior(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
@Override // com.google.android.material.transformation.ExpandableBehavior
|
||||
protected boolean a(View view, View view2, boolean z, boolean z2) {
|
||||
boolean z3 = this.b != null;
|
||||
if (z3) {
|
||||
this.b.cancel();
|
||||
}
|
||||
this.b = b(view, view2, z, z3);
|
||||
this.b.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.transformation.ExpandableTransformationBehavior.1
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
ExpandableTransformationBehavior.this.b = null;
|
||||
}
|
||||
});
|
||||
this.b.start();
|
||||
if (!z2) {
|
||||
this.b.end();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -0,0 +1,457 @@
|
||||
package com.google.android.material.transformation;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Property;
|
||||
import android.view.View;
|
||||
import android.view.ViewAnimationUtils;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import com.google.android.material.R$id;
|
||||
import com.google.android.material.animation.AnimationUtils;
|
||||
import com.google.android.material.animation.AnimatorSetCompat;
|
||||
import com.google.android.material.animation.ArgbEvaluatorCompat;
|
||||
import com.google.android.material.animation.ChildrenAlphaProperty;
|
||||
import com.google.android.material.animation.DrawableAlphaProperty;
|
||||
import com.google.android.material.animation.MotionSpec;
|
||||
import com.google.android.material.animation.MotionTiming;
|
||||
import com.google.android.material.animation.Positioning;
|
||||
import com.google.android.material.circularreveal.CircularRevealCompat;
|
||||
import com.google.android.material.circularreveal.CircularRevealHelper;
|
||||
import com.google.android.material.circularreveal.CircularRevealWidget;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.math.MathUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class FabTransformationBehavior extends ExpandableTransformationBehavior {
|
||||
private final Rect c;
|
||||
private final RectF d;
|
||||
private final RectF e;
|
||||
private final int[] f;
|
||||
|
||||
protected static class FabTransformationSpec {
|
||||
public MotionSpec a;
|
||||
public Positioning b;
|
||||
|
||||
protected FabTransformationSpec() {
|
||||
}
|
||||
}
|
||||
|
||||
public FabTransformationBehavior() {
|
||||
this.c = new Rect();
|
||||
this.d = new RectF();
|
||||
this.e = new RectF();
|
||||
this.f = new int[2];
|
||||
}
|
||||
|
||||
@TargetApi(21)
|
||||
private void c(View view, View view2, boolean z, boolean z2, FabTransformationSpec fabTransformationSpec, List<Animator> list, List<Animator.AnimatorListener> list2) {
|
||||
ObjectAnimator ofFloat;
|
||||
float g = ViewCompat.g(view2) - ViewCompat.g(view);
|
||||
if (z) {
|
||||
if (!z2) {
|
||||
view2.setTranslationZ(-g);
|
||||
}
|
||||
ofFloat = ObjectAnimator.ofFloat(view2, (Property<View, Float>) View.TRANSLATION_Z, 0.0f);
|
||||
} else {
|
||||
ofFloat = ObjectAnimator.ofFloat(view2, (Property<View, Float>) View.TRANSLATION_Z, -g);
|
||||
}
|
||||
fabTransformationSpec.a.a("elevation").a((Animator) ofFloat);
|
||||
list.add(ofFloat);
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
private void d(View view, final View view2, boolean z, boolean z2, FabTransformationSpec fabTransformationSpec, List<Animator> list, List<Animator.AnimatorListener> list2) {
|
||||
ObjectAnimator ofInt;
|
||||
if ((view2 instanceof CircularRevealWidget) && (view instanceof ImageView)) {
|
||||
final CircularRevealWidget circularRevealWidget = (CircularRevealWidget) view2;
|
||||
final Drawable drawable = ((ImageView) view).getDrawable();
|
||||
if (drawable == null) {
|
||||
return;
|
||||
}
|
||||
drawable.mutate();
|
||||
if (z) {
|
||||
if (!z2) {
|
||||
drawable.setAlpha(255);
|
||||
}
|
||||
ofInt = ObjectAnimator.ofInt(drawable, DrawableAlphaProperty.b, 0);
|
||||
} else {
|
||||
ofInt = ObjectAnimator.ofInt(drawable, DrawableAlphaProperty.b, 255);
|
||||
}
|
||||
ofInt.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this) { // from class: com.google.android.material.transformation.FabTransformationBehavior.2
|
||||
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
|
||||
public void onAnimationUpdate(ValueAnimator valueAnimator) {
|
||||
view2.invalidate();
|
||||
}
|
||||
});
|
||||
fabTransformationSpec.a.a("iconFade").a((Animator) ofInt);
|
||||
list.add(ofInt);
|
||||
list2.add(new AnimatorListenerAdapter(this) { // from class: com.google.android.material.transformation.FabTransformationBehavior.3
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
circularRevealWidget.setCircularRevealOverlayDrawable(null);
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationStart(Animator animator) {
|
||||
circularRevealWidget.setCircularRevealOverlayDrawable(drawable);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract FabTransformationSpec a(Context context, boolean z);
|
||||
|
||||
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
|
||||
public boolean a(CoordinatorLayout coordinatorLayout, View view, View view2) {
|
||||
if (view.getVisibility() == 8) {
|
||||
throw new IllegalStateException("This behavior cannot be attached to a GONE view. Set the view to INVISIBLE instead.");
|
||||
}
|
||||
if (!(view2 instanceof FloatingActionButton)) {
|
||||
return false;
|
||||
}
|
||||
int expandedComponentIdHint = ((FloatingActionButton) view2).getExpandedComponentIdHint();
|
||||
return expandedComponentIdHint == 0 || expandedComponentIdHint == view.getId();
|
||||
}
|
||||
|
||||
@Override // com.google.android.material.transformation.ExpandableTransformationBehavior
|
||||
protected AnimatorSet b(final View view, final View view2, final boolean z, boolean z2) {
|
||||
FabTransformationSpec a = a(view2.getContext(), z);
|
||||
ArrayList arrayList = new ArrayList();
|
||||
ArrayList arrayList2 = new ArrayList();
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
c(view, view2, z, z2, a, arrayList, arrayList2);
|
||||
}
|
||||
RectF rectF = this.d;
|
||||
a(view, view2, z, z2, a, arrayList, arrayList2, rectF);
|
||||
float width = rectF.width();
|
||||
float height = rectF.height();
|
||||
d(view, view2, z, z2, a, arrayList, arrayList2);
|
||||
a(view, view2, z, z2, a, width, height, arrayList, arrayList2);
|
||||
b(view, view2, z, z2, a, arrayList, arrayList2);
|
||||
a(view, view2, z, z2, a, arrayList, arrayList2);
|
||||
AnimatorSet animatorSet = new AnimatorSet();
|
||||
AnimatorSetCompat.a(animatorSet, arrayList);
|
||||
animatorSet.addListener(new AnimatorListenerAdapter(this) { // from class: com.google.android.material.transformation.FabTransformationBehavior.1
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
if (z) {
|
||||
return;
|
||||
}
|
||||
view2.setVisibility(4);
|
||||
view.setAlpha(1.0f);
|
||||
view.setVisibility(0);
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationStart(Animator animator) {
|
||||
if (z) {
|
||||
view2.setVisibility(0);
|
||||
view.setAlpha(0.0f);
|
||||
view.setVisibility(4);
|
||||
}
|
||||
}
|
||||
});
|
||||
int size = arrayList2.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
animatorSet.addListener(arrayList2.get(i));
|
||||
}
|
||||
return animatorSet;
|
||||
}
|
||||
|
||||
public FabTransformationBehavior(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.c = new Rect();
|
||||
this.d = new RectF();
|
||||
this.e = new RectF();
|
||||
this.f = new int[2];
|
||||
}
|
||||
|
||||
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
|
||||
public void a(CoordinatorLayout.LayoutParams layoutParams) {
|
||||
if (layoutParams.h == 0) {
|
||||
layoutParams.h = 80;
|
||||
}
|
||||
}
|
||||
|
||||
private float c(View view, View view2, Positioning positioning) {
|
||||
float centerX;
|
||||
float centerX2;
|
||||
float f;
|
||||
RectF rectF = this.d;
|
||||
RectF rectF2 = this.e;
|
||||
a(view, rectF);
|
||||
a(view2, rectF2);
|
||||
int i = positioning.a & 7;
|
||||
if (i == 1) {
|
||||
centerX = rectF2.centerX();
|
||||
centerX2 = rectF.centerX();
|
||||
} else if (i == 3) {
|
||||
centerX = rectF2.left;
|
||||
centerX2 = rectF.left;
|
||||
} else if (i == 5) {
|
||||
centerX = rectF2.right;
|
||||
centerX2 = rectF.right;
|
||||
} else {
|
||||
f = 0.0f;
|
||||
return f + positioning.b;
|
||||
}
|
||||
f = centerX - centerX2;
|
||||
return f + positioning.b;
|
||||
}
|
||||
|
||||
private void a(View view, View view2, boolean z, boolean z2, FabTransformationSpec fabTransformationSpec, List<Animator> list, List<Animator.AnimatorListener> list2, RectF rectF) {
|
||||
MotionTiming a;
|
||||
MotionTiming a2;
|
||||
ObjectAnimator ofFloat;
|
||||
ObjectAnimator ofFloat2;
|
||||
float c = c(view, view2, fabTransformationSpec.b);
|
||||
float d = d(view, view2, fabTransformationSpec.b);
|
||||
if (c == 0.0f || d == 0.0f) {
|
||||
a = fabTransformationSpec.a.a("translationXLinear");
|
||||
a2 = fabTransformationSpec.a.a("translationYLinear");
|
||||
} else if ((z && d < 0.0f) || (!z && d > 0.0f)) {
|
||||
a = fabTransformationSpec.a.a("translationXCurveUpwards");
|
||||
a2 = fabTransformationSpec.a.a("translationYCurveUpwards");
|
||||
} else {
|
||||
a = fabTransformationSpec.a.a("translationXCurveDownwards");
|
||||
a2 = fabTransformationSpec.a.a("translationYCurveDownwards");
|
||||
}
|
||||
MotionTiming motionTiming = a;
|
||||
MotionTiming motionTiming2 = a2;
|
||||
if (z) {
|
||||
if (!z2) {
|
||||
view2.setTranslationX(-c);
|
||||
view2.setTranslationY(-d);
|
||||
}
|
||||
ofFloat = ObjectAnimator.ofFloat(view2, (Property<View, Float>) View.TRANSLATION_X, 0.0f);
|
||||
ofFloat2 = ObjectAnimator.ofFloat(view2, (Property<View, Float>) View.TRANSLATION_Y, 0.0f);
|
||||
a(view2, fabTransformationSpec, motionTiming, motionTiming2, -c, -d, 0.0f, 0.0f, rectF);
|
||||
} else {
|
||||
ofFloat = ObjectAnimator.ofFloat(view2, (Property<View, Float>) View.TRANSLATION_X, -c);
|
||||
ofFloat2 = ObjectAnimator.ofFloat(view2, (Property<View, Float>) View.TRANSLATION_Y, -d);
|
||||
}
|
||||
motionTiming.a((Animator) ofFloat);
|
||||
motionTiming2.a((Animator) ofFloat2);
|
||||
list.add(ofFloat);
|
||||
list.add(ofFloat2);
|
||||
}
|
||||
|
||||
private float d(View view, View view2, Positioning positioning) {
|
||||
float centerY;
|
||||
float centerY2;
|
||||
float f;
|
||||
RectF rectF = this.d;
|
||||
RectF rectF2 = this.e;
|
||||
a(view, rectF);
|
||||
a(view2, rectF2);
|
||||
int i = positioning.a & 112;
|
||||
if (i == 16) {
|
||||
centerY = rectF2.centerY();
|
||||
centerY2 = rectF.centerY();
|
||||
} else if (i == 48) {
|
||||
centerY = rectF2.top;
|
||||
centerY2 = rectF.top;
|
||||
} else if (i == 80) {
|
||||
centerY = rectF2.bottom;
|
||||
centerY2 = rectF.bottom;
|
||||
} else {
|
||||
f = 0.0f;
|
||||
return f + positioning.c;
|
||||
}
|
||||
f = centerY - centerY2;
|
||||
return f + positioning.c;
|
||||
}
|
||||
|
||||
private ViewGroup c(View view) {
|
||||
if (view instanceof ViewGroup) {
|
||||
return (ViewGroup) view;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
private void b(View view, View view2, boolean z, boolean z2, FabTransformationSpec fabTransformationSpec, List<Animator> list, List<Animator.AnimatorListener> list2) {
|
||||
ObjectAnimator ofInt;
|
||||
if (view2 instanceof CircularRevealWidget) {
|
||||
CircularRevealWidget circularRevealWidget = (CircularRevealWidget) view2;
|
||||
int b = b(view);
|
||||
int i = 16777215 & b;
|
||||
if (z) {
|
||||
if (!z2) {
|
||||
circularRevealWidget.setCircularRevealScrimColor(b);
|
||||
}
|
||||
ofInt = ObjectAnimator.ofInt(circularRevealWidget, CircularRevealWidget.CircularRevealScrimColorProperty.a, i);
|
||||
} else {
|
||||
ofInt = ObjectAnimator.ofInt(circularRevealWidget, CircularRevealWidget.CircularRevealScrimColorProperty.a, b);
|
||||
}
|
||||
ofInt.setEvaluator(ArgbEvaluatorCompat.a());
|
||||
fabTransformationSpec.a.a("color").a((Animator) ofInt);
|
||||
list.add(ofInt);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
private void a(View view, View view2, boolean z, boolean z2, FabTransformationSpec fabTransformationSpec, float f, float f2, List<Animator> list, List<Animator.AnimatorListener> list2) {
|
||||
Animator animator;
|
||||
if (view2 instanceof CircularRevealWidget) {
|
||||
final CircularRevealWidget circularRevealWidget = (CircularRevealWidget) view2;
|
||||
float a = a(view, view2, fabTransformationSpec.b);
|
||||
float b = b(view, view2, fabTransformationSpec.b);
|
||||
((FloatingActionButton) view).a(this.c);
|
||||
float width = this.c.width() / 2.0f;
|
||||
MotionTiming a2 = fabTransformationSpec.a.a("expansion");
|
||||
if (z) {
|
||||
if (!z2) {
|
||||
circularRevealWidget.setRevealInfo(new CircularRevealWidget.RevealInfo(a, b, width));
|
||||
}
|
||||
if (z2) {
|
||||
width = circularRevealWidget.getRevealInfo().c;
|
||||
}
|
||||
animator = CircularRevealCompat.a(circularRevealWidget, a, b, MathUtils.a(a, b, 0.0f, 0.0f, f, f2));
|
||||
animator.addListener(new AnimatorListenerAdapter(this) { // from class: com.google.android.material.transformation.FabTransformationBehavior.4
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator2) {
|
||||
CircularRevealWidget.RevealInfo revealInfo = circularRevealWidget.getRevealInfo();
|
||||
revealInfo.c = Float.MAX_VALUE;
|
||||
circularRevealWidget.setRevealInfo(revealInfo);
|
||||
}
|
||||
});
|
||||
a(view2, a2.a(), (int) a, (int) b, width, list);
|
||||
} else {
|
||||
float f3 = circularRevealWidget.getRevealInfo().c;
|
||||
Animator a3 = CircularRevealCompat.a(circularRevealWidget, a, b, width);
|
||||
int i = (int) a;
|
||||
int i2 = (int) b;
|
||||
a(view2, a2.a(), i, i2, f3, list);
|
||||
a(view2, a2.a(), a2.b(), fabTransformationSpec.a.a(), i, i2, width, list);
|
||||
animator = a3;
|
||||
}
|
||||
a2.a(animator);
|
||||
list.add(animator);
|
||||
list2.add(CircularRevealCompat.a(circularRevealWidget));
|
||||
}
|
||||
}
|
||||
|
||||
private float b(View view, View view2, Positioning positioning) {
|
||||
RectF rectF = this.d;
|
||||
RectF rectF2 = this.e;
|
||||
a(view, rectF);
|
||||
a(view2, rectF2);
|
||||
rectF2.offset(0.0f, -d(view, view2, positioning));
|
||||
return rectF.centerY() - rectF2.top;
|
||||
}
|
||||
|
||||
private int b(View view) {
|
||||
ColorStateList c = ViewCompat.c(view);
|
||||
if (c != null) {
|
||||
return c.getColorForState(view.getDrawableState(), c.getDefaultColor());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void a(View view, View view2, boolean z, boolean z2, FabTransformationSpec fabTransformationSpec, List<Animator> list, List<Animator.AnimatorListener> list2) {
|
||||
ViewGroup a;
|
||||
ObjectAnimator ofFloat;
|
||||
if (view2 instanceof ViewGroup) {
|
||||
if (((view2 instanceof CircularRevealWidget) && CircularRevealHelper.a == 0) || (a = a(view2)) == null) {
|
||||
return;
|
||||
}
|
||||
if (z) {
|
||||
if (!z2) {
|
||||
ChildrenAlphaProperty.a.set(a, Float.valueOf(0.0f));
|
||||
}
|
||||
ofFloat = ObjectAnimator.ofFloat(a, ChildrenAlphaProperty.a, 1.0f);
|
||||
} else {
|
||||
ofFloat = ObjectAnimator.ofFloat(a, ChildrenAlphaProperty.a, 0.0f);
|
||||
}
|
||||
fabTransformationSpec.a.a("contentFade").a((Animator) ofFloat);
|
||||
list.add(ofFloat);
|
||||
}
|
||||
}
|
||||
|
||||
private void a(View view, RectF rectF) {
|
||||
rectF.set(0.0f, 0.0f, view.getWidth(), view.getHeight());
|
||||
view.getLocationInWindow(this.f);
|
||||
rectF.offsetTo(r0[0], r0[1]);
|
||||
rectF.offset((int) (-view.getTranslationX()), (int) (-view.getTranslationY()));
|
||||
}
|
||||
|
||||
private float a(View view, View view2, Positioning positioning) {
|
||||
RectF rectF = this.d;
|
||||
RectF rectF2 = this.e;
|
||||
a(view, rectF);
|
||||
a(view2, rectF2);
|
||||
rectF2.offset(-c(view, view2, positioning), 0.0f);
|
||||
return rectF.centerX() - rectF2.left;
|
||||
}
|
||||
|
||||
private void a(View view, FabTransformationSpec fabTransformationSpec, MotionTiming motionTiming, MotionTiming motionTiming2, float f, float f2, float f3, float f4, RectF rectF) {
|
||||
float a = a(fabTransformationSpec, motionTiming, f, f3);
|
||||
float a2 = a(fabTransformationSpec, motionTiming2, f2, f4);
|
||||
Rect rect = this.c;
|
||||
view.getWindowVisibleDisplayFrame(rect);
|
||||
RectF rectF2 = this.d;
|
||||
rectF2.set(rect);
|
||||
RectF rectF3 = this.e;
|
||||
a(view, rectF3);
|
||||
rectF3.offset(a, a2);
|
||||
rectF3.intersect(rectF2);
|
||||
rectF.set(rectF3);
|
||||
}
|
||||
|
||||
private float a(FabTransformationSpec fabTransformationSpec, MotionTiming motionTiming, float f, float f2) {
|
||||
long a = motionTiming.a();
|
||||
long b = motionTiming.b();
|
||||
MotionTiming a2 = fabTransformationSpec.a.a("expansion");
|
||||
return AnimationUtils.a(f, f2, motionTiming.c().getInterpolation((((a2.a() + a2.b()) + 17) - a) / b));
|
||||
}
|
||||
|
||||
private ViewGroup a(View view) {
|
||||
View findViewById = view.findViewById(R$id.mtrl_child_content_container);
|
||||
if (findViewById != null) {
|
||||
return c(findViewById);
|
||||
}
|
||||
if (!(view instanceof TransformationChildLayout) && !(view instanceof TransformationChildCard)) {
|
||||
return c(view);
|
||||
}
|
||||
return c(((ViewGroup) view).getChildAt(0));
|
||||
}
|
||||
|
||||
private void a(View view, long j, int i, int i2, float f, List<Animator> list) {
|
||||
if (Build.VERSION.SDK_INT < 21 || j <= 0) {
|
||||
return;
|
||||
}
|
||||
Animator createCircularReveal = ViewAnimationUtils.createCircularReveal(view, i, i2, f, f);
|
||||
createCircularReveal.setStartDelay(0L);
|
||||
createCircularReveal.setDuration(j);
|
||||
list.add(createCircularReveal);
|
||||
}
|
||||
|
||||
private void a(View view, long j, long j2, long j3, int i, int i2, float f, List<Animator> list) {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
long j4 = j + j2;
|
||||
if (j4 < j3) {
|
||||
Animator createCircularReveal = ViewAnimationUtils.createCircularReveal(view, i, i2, f, f);
|
||||
createCircularReveal.setStartDelay(j4);
|
||||
createCircularReveal.setDuration(j3 - j4);
|
||||
list.add(createCircularReveal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,84 @@
|
||||
package com.google.android.material.transformation;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Property;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import com.google.android.material.animation.AnimatorSetCompat;
|
||||
import com.google.android.material.animation.MotionTiming;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FabTransformationScrimBehavior extends ExpandableTransformationBehavior {
|
||||
private final MotionTiming c;
|
||||
private final MotionTiming d;
|
||||
|
||||
public FabTransformationScrimBehavior() {
|
||||
this.c = new MotionTiming(75L, 150L);
|
||||
this.d = new MotionTiming(0L, 150L);
|
||||
}
|
||||
|
||||
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
|
||||
public boolean a(CoordinatorLayout coordinatorLayout, View view, View view2) {
|
||||
return view2 instanceof FloatingActionButton;
|
||||
}
|
||||
|
||||
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
|
||||
public boolean b(CoordinatorLayout coordinatorLayout, View view, MotionEvent motionEvent) {
|
||||
return super.b(coordinatorLayout, (CoordinatorLayout) view, motionEvent);
|
||||
}
|
||||
|
||||
private void a(View view, boolean z, boolean z2, List<Animator> list, List<Animator.AnimatorListener> list2) {
|
||||
ObjectAnimator ofFloat;
|
||||
MotionTiming motionTiming = z ? this.c : this.d;
|
||||
if (z) {
|
||||
if (!z2) {
|
||||
view.setAlpha(0.0f);
|
||||
}
|
||||
ofFloat = ObjectAnimator.ofFloat(view, (Property<View, Float>) View.ALPHA, 1.0f);
|
||||
} else {
|
||||
ofFloat = ObjectAnimator.ofFloat(view, (Property<View, Float>) View.ALPHA, 0.0f);
|
||||
}
|
||||
motionTiming.a((Animator) ofFloat);
|
||||
list.add(ofFloat);
|
||||
}
|
||||
|
||||
@Override // com.google.android.material.transformation.ExpandableTransformationBehavior
|
||||
protected AnimatorSet b(View view, final View view2, final boolean z, boolean z2) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
a(view2, z, z2, arrayList, new ArrayList());
|
||||
AnimatorSet animatorSet = new AnimatorSet();
|
||||
AnimatorSetCompat.a(animatorSet, arrayList);
|
||||
animatorSet.addListener(new AnimatorListenerAdapter(this) { // from class: com.google.android.material.transformation.FabTransformationScrimBehavior.1
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
if (z) {
|
||||
return;
|
||||
}
|
||||
view2.setVisibility(4);
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationStart(Animator animator) {
|
||||
if (z) {
|
||||
view2.setVisibility(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
return animatorSet;
|
||||
}
|
||||
|
||||
public FabTransformationScrimBehavior(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.c = new MotionTiming(75L, 150L);
|
||||
this.d = new MotionTiming(0L, 150L);
|
||||
}
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
package com.google.android.material.transformation;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewParent;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import com.google.android.material.R$animator;
|
||||
import com.google.android.material.animation.MotionSpec;
|
||||
import com.google.android.material.animation.Positioning;
|
||||
import com.google.android.material.transformation.FabTransformationBehavior;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FabTransformationSheetBehavior extends FabTransformationBehavior {
|
||||
private Map<View, Integer> g;
|
||||
|
||||
public FabTransformationSheetBehavior() {
|
||||
}
|
||||
|
||||
@Override // com.google.android.material.transformation.FabTransformationBehavior
|
||||
protected FabTransformationBehavior.FabTransformationSpec a(Context context, boolean z) {
|
||||
int i = z ? R$animator.mtrl_fab_transformation_sheet_expand_spec : R$animator.mtrl_fab_transformation_sheet_collapse_spec;
|
||||
FabTransformationBehavior.FabTransformationSpec fabTransformationSpec = new FabTransformationBehavior.FabTransformationSpec();
|
||||
fabTransformationSpec.a = MotionSpec.a(context, i);
|
||||
fabTransformationSpec.b = new Positioning(17, 0.0f, 0.0f);
|
||||
return fabTransformationSpec;
|
||||
}
|
||||
|
||||
public FabTransformationSheetBehavior(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
|
||||
@Override // com.google.android.material.transformation.ExpandableTransformationBehavior, com.google.android.material.transformation.ExpandableBehavior
|
||||
protected boolean a(View view, View view2, boolean z, boolean z2) {
|
||||
a(view2, z);
|
||||
return super.a(view, view2, z, z2);
|
||||
}
|
||||
|
||||
private void a(View view, boolean z) {
|
||||
ViewParent parent = view.getParent();
|
||||
if (parent instanceof CoordinatorLayout) {
|
||||
CoordinatorLayout coordinatorLayout = (CoordinatorLayout) parent;
|
||||
int childCount = coordinatorLayout.getChildCount();
|
||||
if (Build.VERSION.SDK_INT >= 16 && z) {
|
||||
this.g = new HashMap(childCount);
|
||||
}
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
View childAt = coordinatorLayout.getChildAt(i);
|
||||
boolean z2 = (childAt.getLayoutParams() instanceof CoordinatorLayout.LayoutParams) && (((CoordinatorLayout.LayoutParams) childAt.getLayoutParams()).d() instanceof FabTransformationScrimBehavior);
|
||||
if (childAt != view && !z2) {
|
||||
if (!z) {
|
||||
Map<View, Integer> map = this.g;
|
||||
if (map != null && map.containsKey(childAt)) {
|
||||
ViewCompat.f(childAt, this.g.get(childAt).intValue());
|
||||
}
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
this.g.put(childAt, Integer.valueOf(childAt.getImportantForAccessibility()));
|
||||
}
|
||||
ViewCompat.f(childAt, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (z) {
|
||||
return;
|
||||
}
|
||||
this.g = null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package com.google.android.material.transformation;
|
||||
|
||||
import com.google.android.material.circularreveal.cardview.CircularRevealCardView;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TransformationChildCard extends CircularRevealCardView {
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package com.google.android.material.transformation;
|
||||
|
||||
import com.google.android.material.circularreveal.CircularRevealFrameLayout;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TransformationChildLayout extends CircularRevealFrameLayout {
|
||||
}
|
Reference in New Issue
Block a user