Initial commit
This commit is contained in:
@@ -0,0 +1,476 @@
|
||||
package com.google.android.material.bottomappbar;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import androidx.appcompat.widget.ActionMenuView;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.customview.view.AbsSavedState;
|
||||
import com.google.android.material.animation.AnimationUtils;
|
||||
import com.google.android.material.behavior.HideBottomViewOnScrollBehavior;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.shape.MaterialShapeDrawable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class BottomAppBar extends Toolbar implements CoordinatorLayout.AttachedBehavior {
|
||||
private final int Q;
|
||||
private final MaterialShapeDrawable R;
|
||||
private final BottomAppBarTopEdgeTreatment S;
|
||||
private Animator T;
|
||||
private Animator U;
|
||||
private Animator V;
|
||||
private int W;
|
||||
private boolean a0;
|
||||
private boolean b0;
|
||||
AnimatorListenerAdapter c0;
|
||||
|
||||
static class SavedState extends AbsSavedState {
|
||||
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.ClassLoaderCreator<SavedState>() { // from class: com.google.android.material.bottomappbar.BottomAppBar.SavedState.1
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public SavedState[] newArray(int i) {
|
||||
return new SavedState[i];
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // android.os.Parcelable.ClassLoaderCreator
|
||||
public SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) {
|
||||
return new SavedState(parcel, classLoader);
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public SavedState createFromParcel(Parcel parcel) {
|
||||
return new SavedState(parcel, null);
|
||||
}
|
||||
};
|
||||
int fabAlignmentMode;
|
||||
boolean fabAttached;
|
||||
|
||||
public SavedState(Parcelable parcelable) {
|
||||
super(parcelable);
|
||||
}
|
||||
|
||||
@Override // androidx.customview.view.AbsSavedState, android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
super.writeToParcel(parcel, i);
|
||||
parcel.writeInt(this.fabAlignmentMode);
|
||||
parcel.writeInt(this.fabAttached ? 1 : 0);
|
||||
}
|
||||
|
||||
public SavedState(Parcel parcel, ClassLoader classLoader) {
|
||||
super(parcel, classLoader);
|
||||
this.fabAlignmentMode = parcel.readInt();
|
||||
this.fabAttached = parcel.readInt() != 0;
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ void c(BottomAppBar bottomAppBar) {
|
||||
bottomAppBar.p();
|
||||
throw null;
|
||||
}
|
||||
|
||||
private ActionMenuView getActionMenuView() {
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
View childAt = getChildAt(i);
|
||||
if (childAt instanceof ActionMenuView) {
|
||||
return (ActionMenuView) childAt;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private float getFabTranslationX() {
|
||||
return a(this.W);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public float getFabTranslationY() {
|
||||
return a(this.b0);
|
||||
}
|
||||
|
||||
private void l() {
|
||||
Animator animator = this.T;
|
||||
if (animator != null) {
|
||||
animator.cancel();
|
||||
}
|
||||
Animator animator2 = this.V;
|
||||
if (animator2 != null) {
|
||||
animator2.cancel();
|
||||
}
|
||||
Animator animator3 = this.U;
|
||||
if (animator3 != null) {
|
||||
animator3.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public FloatingActionButton m() {
|
||||
if (!(getParent() instanceof CoordinatorLayout)) {
|
||||
return null;
|
||||
}
|
||||
for (View view : ((CoordinatorLayout) getParent()).c(this)) {
|
||||
if (view instanceof FloatingActionButton) {
|
||||
return (FloatingActionButton) view;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public boolean n() {
|
||||
Animator animator;
|
||||
Animator animator2;
|
||||
Animator animator3 = this.T;
|
||||
return (animator3 != null && animator3.isRunning()) || ((animator = this.V) != null && animator.isRunning()) || ((animator2 = this.U) != null && animator2.isRunning());
|
||||
}
|
||||
|
||||
private boolean o() {
|
||||
FloatingActionButton m = m();
|
||||
return m != null && m.a();
|
||||
}
|
||||
|
||||
private void p() {
|
||||
this.S.d(getFabTranslationX());
|
||||
throw null;
|
||||
}
|
||||
|
||||
public ColorStateList getBackgroundTint() {
|
||||
this.R.a();
|
||||
throw null;
|
||||
}
|
||||
|
||||
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.AttachedBehavior
|
||||
public CoordinatorLayout.Behavior<BottomAppBar> getBehavior() {
|
||||
return new Behavior();
|
||||
}
|
||||
|
||||
public float getCradleVerticalOffset() {
|
||||
this.S.a();
|
||||
throw null;
|
||||
}
|
||||
|
||||
public int getFabAlignmentMode() {
|
||||
return this.W;
|
||||
}
|
||||
|
||||
public float getFabCradleMargin() {
|
||||
this.S.b();
|
||||
throw null;
|
||||
}
|
||||
|
||||
public float getFabCradleRoundedCornerRadius() {
|
||||
this.S.c();
|
||||
throw null;
|
||||
}
|
||||
|
||||
public boolean getHideOnScroll() {
|
||||
return this.a0;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.Toolbar, android.view.ViewGroup, android.view.View
|
||||
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
||||
super.onLayout(z, i, i2, i3, i4);
|
||||
l();
|
||||
p();
|
||||
throw null;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.Toolbar, android.view.View
|
||||
protected void onRestoreInstanceState(Parcelable parcelable) {
|
||||
if (!(parcelable instanceof SavedState)) {
|
||||
super.onRestoreInstanceState(parcelable);
|
||||
return;
|
||||
}
|
||||
SavedState savedState = (SavedState) parcelable;
|
||||
super.onRestoreInstanceState(savedState.getSuperState());
|
||||
this.W = savedState.fabAlignmentMode;
|
||||
this.b0 = savedState.fabAttached;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.Toolbar, android.view.View
|
||||
protected Parcelable onSaveInstanceState() {
|
||||
SavedState savedState = new SavedState(super.onSaveInstanceState());
|
||||
savedState.fabAlignmentMode = this.W;
|
||||
savedState.fabAttached = this.b0;
|
||||
return savedState;
|
||||
}
|
||||
|
||||
public void setBackgroundTint(ColorStateList colorStateList) {
|
||||
DrawableCompat.a(this.R, colorStateList);
|
||||
}
|
||||
|
||||
public void setCradleVerticalOffset(float f) {
|
||||
if (f == getCradleVerticalOffset()) {
|
||||
return;
|
||||
}
|
||||
this.S.a(f);
|
||||
throw null;
|
||||
}
|
||||
|
||||
public void setFabAlignmentMode(int i) {
|
||||
b(i);
|
||||
a(i, this.b0);
|
||||
this.W = i;
|
||||
}
|
||||
|
||||
public void setFabCradleMargin(float f) {
|
||||
if (f == getFabCradleMargin()) {
|
||||
return;
|
||||
}
|
||||
this.S.b(f);
|
||||
throw null;
|
||||
}
|
||||
|
||||
public void setFabCradleRoundedCornerRadius(float f) {
|
||||
if (f == getFabCradleRoundedCornerRadius()) {
|
||||
return;
|
||||
}
|
||||
this.S.c(f);
|
||||
throw null;
|
||||
}
|
||||
|
||||
void setFabDiameter(int i) {
|
||||
this.S.d();
|
||||
throw null;
|
||||
}
|
||||
|
||||
public void setHideOnScroll(boolean z) {
|
||||
this.a0 = z;
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.Toolbar
|
||||
public void setSubtitle(CharSequence charSequence) {
|
||||
}
|
||||
|
||||
@Override // androidx.appcompat.widget.Toolbar
|
||||
public void setTitle(CharSequence charSequence) {
|
||||
}
|
||||
|
||||
public static class Behavior extends HideBottomViewOnScrollBehavior<BottomAppBar> {
|
||||
private final Rect d;
|
||||
|
||||
public Behavior() {
|
||||
this.d = new Rect();
|
||||
}
|
||||
|
||||
public Behavior(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.d = new Rect();
|
||||
}
|
||||
|
||||
private boolean a(FloatingActionButton floatingActionButton, BottomAppBar bottomAppBar) {
|
||||
((CoordinatorLayout.LayoutParams) floatingActionButton.getLayoutParams()).d = 17;
|
||||
bottomAppBar.a(floatingActionButton);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // com.google.android.material.behavior.HideBottomViewOnScrollBehavior
|
||||
public void b(BottomAppBar bottomAppBar) {
|
||||
super.b((Behavior) bottomAppBar);
|
||||
FloatingActionButton m = bottomAppBar.m();
|
||||
if (m != null) {
|
||||
m.clearAnimation();
|
||||
m.animate().translationY(bottomAppBar.getFabTranslationY()).setInterpolator(AnimationUtils.d).setDuration(225L);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.google.android.material.behavior.HideBottomViewOnScrollBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
|
||||
public boolean a(CoordinatorLayout coordinatorLayout, BottomAppBar bottomAppBar, int i) {
|
||||
FloatingActionButton m = bottomAppBar.m();
|
||||
if (m != null) {
|
||||
a(m, bottomAppBar);
|
||||
m.b(this.d);
|
||||
bottomAppBar.setFabDiameter(this.d.height());
|
||||
}
|
||||
if (bottomAppBar.n()) {
|
||||
coordinatorLayout.c(bottomAppBar, i);
|
||||
return super.a(coordinatorLayout, (CoordinatorLayout) bottomAppBar, i);
|
||||
}
|
||||
BottomAppBar.c(bottomAppBar);
|
||||
throw null;
|
||||
}
|
||||
|
||||
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public boolean b(CoordinatorLayout coordinatorLayout, BottomAppBar bottomAppBar, View view, View view2, int i, int i2) {
|
||||
return bottomAppBar.getHideOnScroll() && super.b(coordinatorLayout, bottomAppBar, view, view2, i, i2);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // com.google.android.material.behavior.HideBottomViewOnScrollBehavior
|
||||
public void a(BottomAppBar bottomAppBar) {
|
||||
super.a((Behavior) bottomAppBar);
|
||||
FloatingActionButton m = bottomAppBar.m();
|
||||
if (m != null) {
|
||||
m.a(this.d);
|
||||
float measuredHeight = m.getMeasuredHeight() - this.d.height();
|
||||
m.clearAnimation();
|
||||
m.animate().translationY((-m.getPaddingBottom()) + measuredHeight).setInterpolator(AnimationUtils.c).setDuration(175L);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void b(int i) {
|
||||
if (this.W == i || !ViewCompat.x(this)) {
|
||||
return;
|
||||
}
|
||||
Animator animator = this.U;
|
||||
if (animator != null) {
|
||||
animator.cancel();
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
a(i, arrayList);
|
||||
b(i, arrayList);
|
||||
AnimatorSet animatorSet = new AnimatorSet();
|
||||
animatorSet.playTogether(arrayList);
|
||||
this.U = animatorSet;
|
||||
this.U.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.bottomappbar.BottomAppBar.1
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator2) {
|
||||
BottomAppBar.this.U = null;
|
||||
}
|
||||
});
|
||||
this.U.start();
|
||||
}
|
||||
|
||||
private void a(int i, List<Animator> list) {
|
||||
if (this.b0) {
|
||||
this.S.e();
|
||||
throw null;
|
||||
}
|
||||
}
|
||||
|
||||
private void a(int i, boolean z) {
|
||||
if (ViewCompat.x(this)) {
|
||||
Animator animator = this.V;
|
||||
if (animator != null) {
|
||||
animator.cancel();
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (!o()) {
|
||||
i = 0;
|
||||
z = false;
|
||||
}
|
||||
a(i, z, arrayList);
|
||||
AnimatorSet animatorSet = new AnimatorSet();
|
||||
animatorSet.playTogether(arrayList);
|
||||
this.V = animatorSet;
|
||||
this.V.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.bottomappbar.BottomAppBar.3
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator2) {
|
||||
BottomAppBar.this.V = null;
|
||||
}
|
||||
});
|
||||
this.V.start();
|
||||
}
|
||||
}
|
||||
|
||||
private void b(int i, List<Animator> list) {
|
||||
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(m(), "translationX", a(i));
|
||||
ofFloat.setDuration(300L);
|
||||
list.add(ofFloat);
|
||||
}
|
||||
|
||||
private void b(FloatingActionButton floatingActionButton) {
|
||||
floatingActionButton.c(this.c0);
|
||||
floatingActionButton.d(this.c0);
|
||||
}
|
||||
|
||||
private void a(final int i, final boolean z, List<Animator> list) {
|
||||
final ActionMenuView actionMenuView = getActionMenuView();
|
||||
if (actionMenuView == null) {
|
||||
return;
|
||||
}
|
||||
Animator ofFloat = ObjectAnimator.ofFloat(actionMenuView, "alpha", 1.0f);
|
||||
if ((!this.b0 && (!z || !o())) || (this.W != 1 && i != 1)) {
|
||||
if (actionMenuView.getAlpha() < 1.0f) {
|
||||
list.add(ofFloat);
|
||||
}
|
||||
} else {
|
||||
ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(actionMenuView, "alpha", 0.0f);
|
||||
ofFloat2.addListener(new AnimatorListenerAdapter() { // from class: com.google.android.material.bottomappbar.BottomAppBar.4
|
||||
public boolean a;
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationCancel(Animator animator) {
|
||||
this.a = true;
|
||||
}
|
||||
|
||||
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
if (this.a) {
|
||||
return;
|
||||
}
|
||||
BottomAppBar.this.a(actionMenuView, i, z);
|
||||
}
|
||||
});
|
||||
AnimatorSet animatorSet = new AnimatorSet();
|
||||
animatorSet.setDuration(150L);
|
||||
animatorSet.playSequentially(ofFloat2, ofFloat);
|
||||
list.add(animatorSet);
|
||||
}
|
||||
}
|
||||
|
||||
private float a(boolean z) {
|
||||
FloatingActionButton m = m();
|
||||
if (m == null) {
|
||||
return 0.0f;
|
||||
}
|
||||
Rect rect = new Rect();
|
||||
m.a(rect);
|
||||
float height = rect.height();
|
||||
if (height == 0.0f) {
|
||||
height = m.getMeasuredHeight();
|
||||
}
|
||||
float height2 = m.getHeight() - rect.bottom;
|
||||
float height3 = m.getHeight() - rect.height();
|
||||
float f = (-getCradleVerticalOffset()) + (height / 2.0f) + height2;
|
||||
float paddingBottom = height3 - m.getPaddingBottom();
|
||||
float f2 = -getMeasuredHeight();
|
||||
if (z) {
|
||||
paddingBottom = f;
|
||||
}
|
||||
return f2 + paddingBottom;
|
||||
}
|
||||
|
||||
private int a(int i) {
|
||||
boolean z = ViewCompat.k(this) == 1;
|
||||
if (i == 1) {
|
||||
return ((getMeasuredWidth() / 2) - this.Q) * (z ? -1 : 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void a(ActionMenuView actionMenuView, int i, boolean z) {
|
||||
boolean z2 = ViewCompat.k(this) == 1;
|
||||
int i2 = 0;
|
||||
for (int i3 = 0; i3 < getChildCount(); i3++) {
|
||||
View childAt = getChildAt(i3);
|
||||
if ((childAt.getLayoutParams() instanceof Toolbar.LayoutParams) && (((Toolbar.LayoutParams) childAt.getLayoutParams()).a & 8388615) == 8388611) {
|
||||
i2 = Math.max(i2, z2 ? childAt.getLeft() : childAt.getRight());
|
||||
}
|
||||
}
|
||||
actionMenuView.setTranslationX((i == 1 && z) ? i2 - (z2 ? actionMenuView.getRight() : actionMenuView.getLeft()) : 0.0f);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void a(FloatingActionButton floatingActionButton) {
|
||||
b(floatingActionButton);
|
||||
floatingActionButton.a(this.c0);
|
||||
floatingActionButton.b(this.c0);
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
package com.google.android.material.bottomappbar;
|
||||
|
||||
import com.google.android.material.shape.EdgeTreatment;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class BottomAppBarTopEdgeTreatment extends EdgeTreatment {
|
||||
float a() {
|
||||
throw null;
|
||||
}
|
||||
|
||||
void a(float f) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
float b() {
|
||||
throw null;
|
||||
}
|
||||
|
||||
void b(float f) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
float c() {
|
||||
throw null;
|
||||
}
|
||||
|
||||
void c(float f) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
float d() {
|
||||
throw null;
|
||||
}
|
||||
|
||||
void d(float f) {
|
||||
throw null;
|
||||
}
|
||||
|
||||
float e() {
|
||||
throw null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user