1814 lines
		
	
	
		
			80 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			1814 lines
		
	
	
		
			80 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package com.google.android.material.appbar;
 | |
| 
 | |
| import android.animation.TimeInterpolator;
 | |
| import android.animation.ValueAnimator;
 | |
| import android.content.Context;
 | |
| import android.content.res.ColorStateList;
 | |
| import android.content.res.TypedArray;
 | |
| import android.graphics.Canvas;
 | |
| import android.graphics.Rect;
 | |
| import android.graphics.drawable.ColorDrawable;
 | |
| import android.graphics.drawable.Drawable;
 | |
| import android.os.Build;
 | |
| import android.os.Parcel;
 | |
| import android.os.Parcelable;
 | |
| import android.util.AttributeSet;
 | |
| import android.view.MotionEvent;
 | |
| import android.view.View;
 | |
| import android.view.ViewGroup;
 | |
| import android.view.animation.AnimationUtils;
 | |
| import android.view.animation.Interpolator;
 | |
| import android.widget.AbsListView;
 | |
| import android.widget.LinearLayout;
 | |
| import android.widget.ScrollView;
 | |
| import androidx.appcompat.content.res.AppCompatResources;
 | |
| import androidx.coordinatorlayout.widget.CoordinatorLayout;
 | |
| import androidx.core.graphics.drawable.DrawableCompat;
 | |
| import androidx.core.math.MathUtils;
 | |
| import androidx.core.util.ObjectsCompat;
 | |
| import androidx.core.view.AccessibilityDelegateCompat;
 | |
| import androidx.core.view.NestedScrollingChild;
 | |
| import androidx.core.view.ViewCompat;
 | |
| import androidx.core.view.WindowInsetsCompat;
 | |
| import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
 | |
| import androidx.core.view.accessibility.AccessibilityViewCommand;
 | |
| import androidx.customview.view.AbsSavedState;
 | |
| import com.google.android.material.R;
 | |
| import com.google.android.material.color.MaterialColors;
 | |
| import com.google.android.material.drawable.DrawableUtils;
 | |
| import com.google.android.material.shape.MaterialShapeDrawable;
 | |
| import com.google.android.material.shape.MaterialShapeUtils;
 | |
| import java.lang.annotation.Retention;
 | |
| import java.lang.annotation.RetentionPolicy;
 | |
| import java.lang.ref.WeakReference;
 | |
| import java.util.ArrayList;
 | |
| import java.util.Iterator;
 | |
| import java.util.List;
 | |
| 
 | |
| /* loaded from: classes.dex */
 | |
| public class AppBarLayout extends LinearLayout implements CoordinatorLayout.AttachedBehavior {
 | |
|     private static final int DEF_STYLE_RES = R.style.Widget_Design_AppBarLayout;
 | |
|     private static final int INVALID_SCROLL_RANGE = -1;
 | |
|     static final int PENDING_ACTION_ANIMATE_ENABLED = 4;
 | |
|     static final int PENDING_ACTION_COLLAPSED = 2;
 | |
|     static final int PENDING_ACTION_EXPANDED = 1;
 | |
|     static final int PENDING_ACTION_FORCE = 8;
 | |
|     static final int PENDING_ACTION_NONE = 0;
 | |
|     private final float appBarElevation;
 | |
|     private Behavior behavior;
 | |
|     private int currentOffset;
 | |
|     private int downPreScrollRange;
 | |
|     private int downScrollRange;
 | |
|     private final boolean hasLiftOnScrollColor;
 | |
|     private boolean haveChildWithInterpolator;
 | |
|     private WindowInsetsCompat lastInsets;
 | |
|     private boolean liftOnScroll;
 | |
|     private ValueAnimator liftOnScrollColorAnimator;
 | |
|     private final long liftOnScrollColorDuration;
 | |
|     private final TimeInterpolator liftOnScrollColorInterpolator;
 | |
|     private ValueAnimator.AnimatorUpdateListener liftOnScrollColorUpdateListener;
 | |
|     private final List<LiftOnScrollListener> liftOnScrollListeners;
 | |
|     private WeakReference<View> liftOnScrollTargetView;
 | |
|     private int liftOnScrollTargetViewId;
 | |
|     private boolean liftable;
 | |
|     private boolean liftableOverride;
 | |
|     private boolean lifted;
 | |
|     private List<BaseOnOffsetChangedListener> listeners;
 | |
|     private int pendingAction;
 | |
|     private Drawable statusBarForeground;
 | |
|     private Integer statusBarForegroundOriginalColor;
 | |
|     private int[] tmpStatesArray;
 | |
|     private int totalScrollRange;
 | |
| 
 | |
|     public interface BaseOnOffsetChangedListener<T extends AppBarLayout> {
 | |
|         void onOffsetChanged(T t, int i);
 | |
|     }
 | |
| 
 | |
|     public static abstract class ChildScrollEffect {
 | |
|         public abstract void onOffsetChanged(AppBarLayout appBarLayout, View view, float f);
 | |
|     }
 | |
| 
 | |
|     public interface LiftOnScrollListener {
 | |
|         void onUpdate(float f, int i);
 | |
|     }
 | |
| 
 | |
|     public interface OnOffsetChangedListener extends BaseOnOffsetChangedListener<AppBarLayout> {
 | |
|         @Override // com.google.android.material.appbar.AppBarLayout.BaseOnOffsetChangedListener
 | |
|         void onOffsetChanged(AppBarLayout appBarLayout, int i);
 | |
|     }
 | |
| 
 | |
|     public int getLiftOnScrollTargetViewId() {
 | |
|         return this.liftOnScrollTargetViewId;
 | |
|     }
 | |
| 
 | |
|     int getPendingAction() {
 | |
|         return this.pendingAction;
 | |
|     }
 | |
| 
 | |
|     public Drawable getStatusBarForeground() {
 | |
|         return this.statusBarForeground;
 | |
|     }
 | |
| 
 | |
|     @Deprecated
 | |
|     public float getTargetElevation() {
 | |
|         return 0.0f;
 | |
|     }
 | |
| 
 | |
|     boolean hasChildWithInterpolator() {
 | |
|         return this.haveChildWithInterpolator;
 | |
|     }
 | |
| 
 | |
|     public boolean isLiftOnScroll() {
 | |
|         return this.liftOnScroll;
 | |
|     }
 | |
| 
 | |
|     public boolean isLifted() {
 | |
|         return this.lifted;
 | |
|     }
 | |
| 
 | |
|     void resetPendingAction() {
 | |
|         this.pendingAction = 0;
 | |
|     }
 | |
| 
 | |
|     public void setLiftOnScroll(boolean z) {
 | |
|         this.liftOnScroll = z;
 | |
|     }
 | |
| 
 | |
|     public void setLiftableOverrideEnabled(boolean z) {
 | |
|         this.liftableOverride = z;
 | |
|     }
 | |
| 
 | |
|     public AppBarLayout(Context context) {
 | |
|         this(context, null);
 | |
|     }
 | |
| 
 | |
|     public AppBarLayout(Context context, AttributeSet attributeSet) {
 | |
|         this(context, attributeSet, R.attr.appBarLayoutStyle);
 | |
|     }
 | |
| 
 | |
|     /* 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 AppBarLayout(android.content.Context r10, android.util.AttributeSet r11, int r12) {
 | |
|         /*
 | |
|             Method dump skipped, instructions count: 260
 | |
|             To view this dump add '--comments-level debug' option
 | |
|         */
 | |
|         throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.appbar.AppBarLayout.<init>(android.content.Context, android.util.AttributeSet, int):void");
 | |
|     }
 | |
| 
 | |
|     private void initializeLiftOnScrollWithColor(final MaterialShapeDrawable materialShapeDrawable, final ColorStateList colorStateList, final ColorStateList colorStateList2) {
 | |
|         final Integer colorOrNull = MaterialColors.getColorOrNull(getContext(), R.attr.colorSurface);
 | |
|         this.liftOnScrollColorUpdateListener = new ValueAnimator.AnimatorUpdateListener() { // from class: com.google.android.material.appbar.AppBarLayout$$ExternalSyntheticLambda1
 | |
|             @Override // android.animation.ValueAnimator.AnimatorUpdateListener
 | |
|             public final void onAnimationUpdate(ValueAnimator valueAnimator) {
 | |
|                 AppBarLayout.this.m190x91f594d8(colorStateList, colorStateList2, materialShapeDrawable, colorOrNull, valueAnimator);
 | |
|             }
 | |
|         };
 | |
|         ViewCompat.setBackground(this, materialShapeDrawable);
 | |
|     }
 | |
| 
 | |
|     /* renamed from: lambda$initializeLiftOnScrollWithColor$0$com-google-android-material-appbar-AppBarLayout, reason: not valid java name */
 | |
|     /* synthetic */ void m190x91f594d8(ColorStateList colorStateList, ColorStateList colorStateList2, MaterialShapeDrawable materialShapeDrawable, Integer num, ValueAnimator valueAnimator) {
 | |
|         Integer num2;
 | |
|         int layer = MaterialColors.layer(colorStateList.getDefaultColor(), colorStateList2.getDefaultColor(), ((Float) valueAnimator.getAnimatedValue()).floatValue());
 | |
|         materialShapeDrawable.setFillColor(ColorStateList.valueOf(layer));
 | |
|         if (this.statusBarForeground != null && (num2 = this.statusBarForegroundOriginalColor) != null && num2.equals(num)) {
 | |
|             DrawableCompat.setTint(this.statusBarForeground, layer);
 | |
|         }
 | |
|         if (this.liftOnScrollListeners.isEmpty()) {
 | |
|             return;
 | |
|         }
 | |
|         for (LiftOnScrollListener liftOnScrollListener : this.liftOnScrollListeners) {
 | |
|             if (materialShapeDrawable.getFillColor() != null) {
 | |
|                 liftOnScrollListener.onUpdate(0.0f, layer);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private void initializeLiftOnScrollWithElevation(Context context, final MaterialShapeDrawable materialShapeDrawable) {
 | |
|         materialShapeDrawable.initializeElevationOverlay(context);
 | |
|         this.liftOnScrollColorUpdateListener = new ValueAnimator.AnimatorUpdateListener() { // from class: com.google.android.material.appbar.AppBarLayout$$ExternalSyntheticLambda2
 | |
|             @Override // android.animation.ValueAnimator.AnimatorUpdateListener
 | |
|             public final void onAnimationUpdate(ValueAnimator valueAnimator) {
 | |
|                 AppBarLayout.this.m191x84b6053(materialShapeDrawable, valueAnimator);
 | |
|             }
 | |
|         };
 | |
|         ViewCompat.setBackground(this, materialShapeDrawable);
 | |
|     }
 | |
| 
 | |
|     /* renamed from: lambda$initializeLiftOnScrollWithElevation$1$com-google-android-material-appbar-AppBarLayout, reason: not valid java name */
 | |
|     /* synthetic */ void m191x84b6053(MaterialShapeDrawable materialShapeDrawable, ValueAnimator valueAnimator) {
 | |
|         float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
 | |
|         materialShapeDrawable.setElevation(floatValue);
 | |
|         Drawable drawable = this.statusBarForeground;
 | |
|         if (drawable instanceof MaterialShapeDrawable) {
 | |
|             ((MaterialShapeDrawable) drawable).setElevation(floatValue);
 | |
|         }
 | |
|         Iterator<LiftOnScrollListener> it = this.liftOnScrollListeners.iterator();
 | |
|         while (it.hasNext()) {
 | |
|             it.next().onUpdate(floatValue, materialShapeDrawable.getResolvedTintColor());
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void addOnOffsetChangedListener(BaseOnOffsetChangedListener baseOnOffsetChangedListener) {
 | |
|         if (this.listeners == null) {
 | |
|             this.listeners = new ArrayList();
 | |
|         }
 | |
|         if (baseOnOffsetChangedListener == null || this.listeners.contains(baseOnOffsetChangedListener)) {
 | |
|             return;
 | |
|         }
 | |
|         this.listeners.add(baseOnOffsetChangedListener);
 | |
|     }
 | |
| 
 | |
|     public void addOnOffsetChangedListener(OnOffsetChangedListener onOffsetChangedListener) {
 | |
|         addOnOffsetChangedListener((BaseOnOffsetChangedListener) onOffsetChangedListener);
 | |
|     }
 | |
| 
 | |
|     public void removeOnOffsetChangedListener(BaseOnOffsetChangedListener baseOnOffsetChangedListener) {
 | |
|         List<BaseOnOffsetChangedListener> list = this.listeners;
 | |
|         if (list == null || baseOnOffsetChangedListener == null) {
 | |
|             return;
 | |
|         }
 | |
|         list.remove(baseOnOffsetChangedListener);
 | |
|     }
 | |
| 
 | |
|     public void removeOnOffsetChangedListener(OnOffsetChangedListener onOffsetChangedListener) {
 | |
|         removeOnOffsetChangedListener((BaseOnOffsetChangedListener) onOffsetChangedListener);
 | |
|     }
 | |
| 
 | |
|     public void addLiftOnScrollListener(LiftOnScrollListener liftOnScrollListener) {
 | |
|         this.liftOnScrollListeners.add(liftOnScrollListener);
 | |
|     }
 | |
| 
 | |
|     public boolean removeLiftOnScrollListener(LiftOnScrollListener liftOnScrollListener) {
 | |
|         return this.liftOnScrollListeners.remove(liftOnScrollListener);
 | |
|     }
 | |
| 
 | |
|     public void clearLiftOnScrollListener() {
 | |
|         this.liftOnScrollListeners.clear();
 | |
|     }
 | |
| 
 | |
|     public void setStatusBarForeground(Drawable drawable) {
 | |
|         Drawable drawable2 = this.statusBarForeground;
 | |
|         if (drawable2 != drawable) {
 | |
|             if (drawable2 != null) {
 | |
|                 drawable2.setCallback(null);
 | |
|             }
 | |
|             this.statusBarForeground = drawable != null ? drawable.mutate() : null;
 | |
|             this.statusBarForegroundOriginalColor = extractStatusBarForegroundColor();
 | |
|             Drawable drawable3 = this.statusBarForeground;
 | |
|             if (drawable3 != null) {
 | |
|                 if (drawable3.isStateful()) {
 | |
|                     this.statusBarForeground.setState(getDrawableState());
 | |
|                 }
 | |
|                 DrawableCompat.setLayoutDirection(this.statusBarForeground, ViewCompat.getLayoutDirection(this));
 | |
|                 this.statusBarForeground.setVisible(getVisibility() == 0, false);
 | |
|                 this.statusBarForeground.setCallback(this);
 | |
|             }
 | |
|             updateWillNotDraw();
 | |
|             ViewCompat.postInvalidateOnAnimation(this);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setStatusBarForegroundColor(int i) {
 | |
|         setStatusBarForeground(new ColorDrawable(i));
 | |
|     }
 | |
| 
 | |
|     public void setStatusBarForegroundResource(int i) {
 | |
|         setStatusBarForeground(AppCompatResources.getDrawable(getContext(), i));
 | |
|     }
 | |
| 
 | |
|     private Integer extractStatusBarForegroundColor() {
 | |
|         Drawable drawable = this.statusBarForeground;
 | |
|         if (drawable instanceof MaterialShapeDrawable) {
 | |
|             return Integer.valueOf(((MaterialShapeDrawable) drawable).getResolvedTintColor());
 | |
|         }
 | |
|         ColorStateList colorStateListOrNull = DrawableUtils.getColorStateListOrNull(drawable);
 | |
|         if (colorStateListOrNull != null) {
 | |
|             return Integer.valueOf(colorStateListOrNull.getDefaultColor());
 | |
|         }
 | |
|         return null;
 | |
|     }
 | |
| 
 | |
|     @Override // android.view.View
 | |
|     public void draw(Canvas canvas) {
 | |
|         super.draw(canvas);
 | |
|         if (shouldDrawStatusBarForeground()) {
 | |
|             int save = canvas.save();
 | |
|             canvas.translate(0.0f, -this.currentOffset);
 | |
|             this.statusBarForeground.draw(canvas);
 | |
|             canvas.restoreToCount(save);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Override // android.view.ViewGroup, android.view.View
 | |
|     protected void drawableStateChanged() {
 | |
|         super.drawableStateChanged();
 | |
|         int[] drawableState = getDrawableState();
 | |
|         Drawable drawable = this.statusBarForeground;
 | |
|         if (drawable != null && drawable.isStateful() && drawable.setState(drawableState)) {
 | |
|             invalidateDrawable(drawable);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Override // android.view.View
 | |
|     protected boolean verifyDrawable(Drawable drawable) {
 | |
|         return super.verifyDrawable(drawable) || drawable == this.statusBarForeground;
 | |
|     }
 | |
| 
 | |
|     @Override // android.view.View
 | |
|     public void setVisibility(int i) {
 | |
|         super.setVisibility(i);
 | |
|         boolean z = i == 0;
 | |
|         Drawable drawable = this.statusBarForeground;
 | |
|         if (drawable != null) {
 | |
|             drawable.setVisible(z, false);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Override // android.widget.LinearLayout, android.view.View
 | |
|     protected void onMeasure(int i, int i2) {
 | |
|         super.onMeasure(i, i2);
 | |
|         int mode = View.MeasureSpec.getMode(i2);
 | |
|         if (mode != 1073741824 && ViewCompat.getFitsSystemWindows(this) && shouldOffsetFirstChild()) {
 | |
|             int measuredHeight = getMeasuredHeight();
 | |
|             if (mode == Integer.MIN_VALUE) {
 | |
|                 measuredHeight = MathUtils.clamp(getMeasuredHeight() + getTopInset(), 0, View.MeasureSpec.getSize(i2));
 | |
|             } else if (mode == 0) {
 | |
|                 measuredHeight += getTopInset();
 | |
|             }
 | |
|             setMeasuredDimension(getMeasuredWidth(), measuredHeight);
 | |
|         }
 | |
|         invalidateScrollRanges();
 | |
|     }
 | |
| 
 | |
|     @Override // android.widget.LinearLayout, 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);
 | |
|         boolean z2 = true;
 | |
|         if (ViewCompat.getFitsSystemWindows(this) && shouldOffsetFirstChild()) {
 | |
|             int topInset = getTopInset();
 | |
|             for (int childCount = getChildCount() - 1; childCount >= 0; childCount--) {
 | |
|                 ViewCompat.offsetTopAndBottom(getChildAt(childCount), topInset);
 | |
|             }
 | |
|         }
 | |
|         invalidateScrollRanges();
 | |
|         this.haveChildWithInterpolator = false;
 | |
|         int childCount2 = getChildCount();
 | |
|         int i5 = 0;
 | |
|         while (true) {
 | |
|             if (i5 >= childCount2) {
 | |
|                 break;
 | |
|             }
 | |
|             if (((LayoutParams) getChildAt(i5).getLayoutParams()).getScrollInterpolator() != null) {
 | |
|                 this.haveChildWithInterpolator = true;
 | |
|                 break;
 | |
|             }
 | |
|             i5++;
 | |
|         }
 | |
|         Drawable drawable = this.statusBarForeground;
 | |
|         if (drawable != null) {
 | |
|             drawable.setBounds(0, 0, getWidth(), getTopInset());
 | |
|         }
 | |
|         if (this.liftableOverride) {
 | |
|             return;
 | |
|         }
 | |
|         if (!this.liftOnScroll && !hasCollapsibleChild()) {
 | |
|             z2 = false;
 | |
|         }
 | |
|         setLiftableState(z2);
 | |
|     }
 | |
| 
 | |
|     private void updateWillNotDraw() {
 | |
|         setWillNotDraw(!shouldDrawStatusBarForeground());
 | |
|     }
 | |
| 
 | |
|     private boolean shouldDrawStatusBarForeground() {
 | |
|         return this.statusBarForeground != null && getTopInset() > 0;
 | |
|     }
 | |
| 
 | |
|     private boolean hasCollapsibleChild() {
 | |
|         int childCount = getChildCount();
 | |
|         for (int i = 0; i < childCount; i++) {
 | |
|             if (((LayoutParams) getChildAt(i).getLayoutParams()).isCollapsible()) {
 | |
|                 return true;
 | |
|             }
 | |
|         }
 | |
|         return false;
 | |
|     }
 | |
| 
 | |
|     private void invalidateScrollRanges() {
 | |
|         Behavior behavior = this.behavior;
 | |
|         BaseBehavior.SavedState saveScrollState = (behavior == null || this.totalScrollRange == -1 || this.pendingAction != 0) ? null : behavior.saveScrollState(AbsSavedState.EMPTY_STATE, this);
 | |
|         this.totalScrollRange = -1;
 | |
|         this.downPreScrollRange = -1;
 | |
|         this.downScrollRange = -1;
 | |
|         if (saveScrollState != null) {
 | |
|             this.behavior.restoreScrollState(saveScrollState, false);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @Override // android.widget.LinearLayout
 | |
|     public void setOrientation(int i) {
 | |
|         if (i != 1) {
 | |
|             throw new IllegalArgumentException("AppBarLayout is always vertical and does not support horizontal orientation");
 | |
|         }
 | |
|         super.setOrientation(i);
 | |
|     }
 | |
| 
 | |
|     @Override // android.view.ViewGroup, android.view.View
 | |
|     protected void onAttachedToWindow() {
 | |
|         super.onAttachedToWindow();
 | |
|         MaterialShapeUtils.setParentAbsoluteElevation(this);
 | |
|     }
 | |
| 
 | |
|     @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.AttachedBehavior
 | |
|     public CoordinatorLayout.Behavior<AppBarLayout> getBehavior() {
 | |
|         Behavior behavior = new Behavior();
 | |
|         this.behavior = behavior;
 | |
|         return behavior;
 | |
|     }
 | |
| 
 | |
|     public MaterialShapeDrawable getMaterialShapeBackground() {
 | |
|         Drawable background = getBackground();
 | |
|         if (background instanceof MaterialShapeDrawable) {
 | |
|             return (MaterialShapeDrawable) background;
 | |
|         }
 | |
|         return null;
 | |
|     }
 | |
| 
 | |
|     @Override // android.view.View
 | |
|     public void setElevation(float f) {
 | |
|         super.setElevation(f);
 | |
|         MaterialShapeUtils.setElevation(this, f);
 | |
|     }
 | |
| 
 | |
|     public void setExpanded(boolean z) {
 | |
|         setExpanded(z, ViewCompat.isLaidOut(this));
 | |
|     }
 | |
| 
 | |
|     public void setExpanded(boolean z, boolean z2) {
 | |
|         setExpanded(z, z2, true);
 | |
|     }
 | |
| 
 | |
|     private void setExpanded(boolean z, boolean z2, boolean z3) {
 | |
|         this.pendingAction = (z ? 1 : 2) | (z2 ? 4 : 0) | (z3 ? 8 : 0);
 | |
|         requestLayout();
 | |
|     }
 | |
| 
 | |
|     @Override // android.widget.LinearLayout, android.view.ViewGroup
 | |
|     protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
 | |
|         return layoutParams instanceof LayoutParams;
 | |
|     }
 | |
| 
 | |
|     /* JADX INFO: Access modifiers changed from: protected */
 | |
|     @Override // android.widget.LinearLayout, android.view.ViewGroup
 | |
|     public LayoutParams generateDefaultLayoutParams() {
 | |
|         return new LayoutParams(-1, -2);
 | |
|     }
 | |
| 
 | |
|     @Override // android.widget.LinearLayout, android.view.ViewGroup
 | |
|     public LayoutParams generateLayoutParams(AttributeSet attributeSet) {
 | |
|         return new LayoutParams(getContext(), attributeSet);
 | |
|     }
 | |
| 
 | |
|     /* JADX INFO: Access modifiers changed from: protected */
 | |
|     @Override // android.widget.LinearLayout, android.view.ViewGroup
 | |
|     public LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
 | |
|         if (layoutParams instanceof LinearLayout.LayoutParams) {
 | |
|             return new LayoutParams((LinearLayout.LayoutParams) layoutParams);
 | |
|         }
 | |
|         if (layoutParams instanceof ViewGroup.MarginLayoutParams) {
 | |
|             return new LayoutParams((ViewGroup.MarginLayoutParams) layoutParams);
 | |
|         }
 | |
|         return new LayoutParams(layoutParams);
 | |
|     }
 | |
| 
 | |
|     @Override // android.view.ViewGroup, android.view.View
 | |
|     protected void onDetachedFromWindow() {
 | |
|         super.onDetachedFromWindow();
 | |
|         clearLiftOnScrollTargetView();
 | |
|     }
 | |
| 
 | |
|     public final int getTotalScrollRange() {
 | |
|         int i = this.totalScrollRange;
 | |
|         if (i != -1) {
 | |
|             return i;
 | |
|         }
 | |
|         int childCount = getChildCount();
 | |
|         int i2 = 0;
 | |
|         int i3 = 0;
 | |
|         while (true) {
 | |
|             if (i2 >= childCount) {
 | |
|                 break;
 | |
|             }
 | |
|             View childAt = getChildAt(i2);
 | |
|             if (childAt.getVisibility() != 8) {
 | |
|                 LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
 | |
|                 int measuredHeight = childAt.getMeasuredHeight();
 | |
|                 int i4 = layoutParams.scrollFlags;
 | |
|                 if ((i4 & 1) == 0) {
 | |
|                     break;
 | |
|                 }
 | |
|                 i3 += measuredHeight + layoutParams.topMargin + layoutParams.bottomMargin;
 | |
|                 if (i2 == 0 && ViewCompat.getFitsSystemWindows(childAt)) {
 | |
|                     i3 -= getTopInset();
 | |
|                 }
 | |
|                 if ((i4 & 2) != 0) {
 | |
|                     i3 -= ViewCompat.getMinimumHeight(childAt);
 | |
|                     break;
 | |
|                 }
 | |
|             }
 | |
|             i2++;
 | |
|         }
 | |
|         int max = Math.max(0, i3);
 | |
|         this.totalScrollRange = max;
 | |
|         return max;
 | |
|     }
 | |
| 
 | |
|     boolean hasScrollableChildren() {
 | |
|         return getTotalScrollRange() != 0;
 | |
|     }
 | |
| 
 | |
|     int getUpNestedPreScrollRange() {
 | |
|         return getTotalScrollRange();
 | |
|     }
 | |
| 
 | |
|     int getDownNestedPreScrollRange() {
 | |
|         int i;
 | |
|         int minimumHeight;
 | |
|         int i2 = this.downPreScrollRange;
 | |
|         if (i2 != -1) {
 | |
|             return i2;
 | |
|         }
 | |
|         int i3 = 0;
 | |
|         for (int childCount = getChildCount() - 1; childCount >= 0; childCount--) {
 | |
|             View childAt = getChildAt(childCount);
 | |
|             if (childAt.getVisibility() != 8) {
 | |
|                 LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
 | |
|                 int measuredHeight = childAt.getMeasuredHeight();
 | |
|                 int i4 = layoutParams.scrollFlags;
 | |
|                 if ((i4 & 5) != 5) {
 | |
|                     if (i3 > 0) {
 | |
|                         break;
 | |
|                     }
 | |
|                 } else {
 | |
|                     int i5 = layoutParams.topMargin + layoutParams.bottomMargin;
 | |
|                     if ((i4 & 8) != 0) {
 | |
|                         minimumHeight = ViewCompat.getMinimumHeight(childAt);
 | |
|                     } else if ((i4 & 2) != 0) {
 | |
|                         minimumHeight = measuredHeight - ViewCompat.getMinimumHeight(childAt);
 | |
|                     } else {
 | |
|                         i = i5 + measuredHeight;
 | |
|                         if (childCount == 0 && ViewCompat.getFitsSystemWindows(childAt)) {
 | |
|                             i = Math.min(i, measuredHeight - getTopInset());
 | |
|                         }
 | |
|                         i3 += i;
 | |
|                     }
 | |
|                     i = i5 + minimumHeight;
 | |
|                     if (childCount == 0) {
 | |
|                         i = Math.min(i, measuredHeight - getTopInset());
 | |
|                     }
 | |
|                     i3 += i;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         int max = Math.max(0, i3);
 | |
|         this.downPreScrollRange = max;
 | |
|         return max;
 | |
|     }
 | |
| 
 | |
|     int getDownNestedScrollRange() {
 | |
|         int i = this.downScrollRange;
 | |
|         if (i != -1) {
 | |
|             return i;
 | |
|         }
 | |
|         int childCount = getChildCount();
 | |
|         int i2 = 0;
 | |
|         int i3 = 0;
 | |
|         while (true) {
 | |
|             if (i2 >= childCount) {
 | |
|                 break;
 | |
|             }
 | |
|             View childAt = getChildAt(i2);
 | |
|             if (childAt.getVisibility() != 8) {
 | |
|                 LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
 | |
|                 int measuredHeight = childAt.getMeasuredHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
 | |
|                 int i4 = layoutParams.scrollFlags;
 | |
|                 if ((i4 & 1) == 0) {
 | |
|                     break;
 | |
|                 }
 | |
|                 i3 += measuredHeight;
 | |
|                 if ((i4 & 2) != 0) {
 | |
|                     i3 -= ViewCompat.getMinimumHeight(childAt);
 | |
|                     break;
 | |
|                 }
 | |
|             }
 | |
|             i2++;
 | |
|         }
 | |
|         int max = Math.max(0, i3);
 | |
|         this.downScrollRange = max;
 | |
|         return max;
 | |
|     }
 | |
| 
 | |
|     void onOffsetChanged(int i) {
 | |
|         this.currentOffset = i;
 | |
|         if (!willNotDraw()) {
 | |
|             ViewCompat.postInvalidateOnAnimation(this);
 | |
|         }
 | |
|         List<BaseOnOffsetChangedListener> list = this.listeners;
 | |
|         if (list != null) {
 | |
|             int size = list.size();
 | |
|             for (int i2 = 0; i2 < size; i2++) {
 | |
|                 BaseOnOffsetChangedListener baseOnOffsetChangedListener = this.listeners.get(i2);
 | |
|                 if (baseOnOffsetChangedListener != null) {
 | |
|                     baseOnOffsetChangedListener.onOffsetChanged(this, i);
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public final int getMinimumHeightForVisibleOverlappingContent() {
 | |
|         int topInset = getTopInset();
 | |
|         int minimumHeight = ViewCompat.getMinimumHeight(this);
 | |
|         if (minimumHeight == 0) {
 | |
|             int childCount = getChildCount();
 | |
|             minimumHeight = childCount >= 1 ? ViewCompat.getMinimumHeight(getChildAt(childCount - 1)) : 0;
 | |
|             if (minimumHeight == 0) {
 | |
|                 return getHeight() / 3;
 | |
|             }
 | |
|         }
 | |
|         return (minimumHeight * 2) + topInset;
 | |
|     }
 | |
| 
 | |
|     @Override // android.view.ViewGroup, android.view.View
 | |
|     protected int[] onCreateDrawableState(int i) {
 | |
|         if (this.tmpStatesArray == null) {
 | |
|             this.tmpStatesArray = new int[4];
 | |
|         }
 | |
|         int[] iArr = this.tmpStatesArray;
 | |
|         int[] onCreateDrawableState = super.onCreateDrawableState(i + iArr.length);
 | |
|         iArr[0] = this.liftable ? R.attr.state_liftable : -R.attr.state_liftable;
 | |
|         iArr[1] = (this.liftable && this.lifted) ? R.attr.state_lifted : -R.attr.state_lifted;
 | |
|         iArr[2] = this.liftable ? R.attr.state_collapsible : -R.attr.state_collapsible;
 | |
|         iArr[3] = (this.liftable && this.lifted) ? R.attr.state_collapsed : -R.attr.state_collapsed;
 | |
|         return mergeDrawableStates(onCreateDrawableState, iArr);
 | |
|     }
 | |
| 
 | |
|     public boolean setLiftable(boolean z) {
 | |
|         this.liftableOverride = true;
 | |
|         return setLiftableState(z);
 | |
|     }
 | |
| 
 | |
|     private boolean setLiftableState(boolean z) {
 | |
|         if (this.liftable == z) {
 | |
|             return false;
 | |
|         }
 | |
|         this.liftable = z;
 | |
|         refreshDrawableState();
 | |
|         return true;
 | |
|     }
 | |
| 
 | |
|     public boolean setLifted(boolean z) {
 | |
|         return setLiftedState(z, true);
 | |
|     }
 | |
| 
 | |
|     boolean setLiftedState(boolean z) {
 | |
|         return setLiftedState(z, !this.liftableOverride);
 | |
|     }
 | |
| 
 | |
|     boolean setLiftedState(boolean z, boolean z2) {
 | |
|         if (!z2 || this.lifted == z) {
 | |
|             return false;
 | |
|         }
 | |
|         this.lifted = z;
 | |
|         refreshDrawableState();
 | |
|         if (!isLiftOnScrollCompatibleBackground()) {
 | |
|             return true;
 | |
|         }
 | |
|         if (this.hasLiftOnScrollColor) {
 | |
|             startLiftOnScrollColorAnimation(z ? 0.0f : 1.0f, z ? 1.0f : 0.0f);
 | |
|             return true;
 | |
|         }
 | |
|         if (!this.liftOnScroll) {
 | |
|             return true;
 | |
|         }
 | |
|         startLiftOnScrollColorAnimation(z ? 0.0f : this.appBarElevation, z ? this.appBarElevation : 0.0f);
 | |
|         return true;
 | |
|     }
 | |
| 
 | |
|     private boolean isLiftOnScrollCompatibleBackground() {
 | |
|         return getBackground() instanceof MaterialShapeDrawable;
 | |
|     }
 | |
| 
 | |
|     private void startLiftOnScrollColorAnimation(float f, float f2) {
 | |
|         ValueAnimator valueAnimator = this.liftOnScrollColorAnimator;
 | |
|         if (valueAnimator != null) {
 | |
|             valueAnimator.cancel();
 | |
|         }
 | |
|         ValueAnimator ofFloat = ValueAnimator.ofFloat(f, f2);
 | |
|         this.liftOnScrollColorAnimator = ofFloat;
 | |
|         ofFloat.setDuration(this.liftOnScrollColorDuration);
 | |
|         this.liftOnScrollColorAnimator.setInterpolator(this.liftOnScrollColorInterpolator);
 | |
|         ValueAnimator.AnimatorUpdateListener animatorUpdateListener = this.liftOnScrollColorUpdateListener;
 | |
|         if (animatorUpdateListener != null) {
 | |
|             this.liftOnScrollColorAnimator.addUpdateListener(animatorUpdateListener);
 | |
|         }
 | |
|         this.liftOnScrollColorAnimator.start();
 | |
|     }
 | |
| 
 | |
|     public void setLiftOnScrollTargetView(View view) {
 | |
|         this.liftOnScrollTargetViewId = -1;
 | |
|         if (view == null) {
 | |
|             clearLiftOnScrollTargetView();
 | |
|         } else {
 | |
|             this.liftOnScrollTargetView = new WeakReference<>(view);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public void setLiftOnScrollTargetViewId(int i) {
 | |
|         this.liftOnScrollTargetViewId = i;
 | |
|         clearLiftOnScrollTargetView();
 | |
|     }
 | |
| 
 | |
|     boolean shouldLift(View view) {
 | |
|         View findLiftOnScrollTargetView = findLiftOnScrollTargetView(view);
 | |
|         if (findLiftOnScrollTargetView != null) {
 | |
|             view = findLiftOnScrollTargetView;
 | |
|         }
 | |
|         return view != null && (view.canScrollVertically(-1) || view.getScrollY() > 0);
 | |
|     }
 | |
| 
 | |
|     private View findLiftOnScrollTargetView(View view) {
 | |
|         int i;
 | |
|         if (this.liftOnScrollTargetView == null && (i = this.liftOnScrollTargetViewId) != -1) {
 | |
|             View findViewById = view != null ? view.findViewById(i) : null;
 | |
|             if (findViewById == null && (getParent() instanceof ViewGroup)) {
 | |
|                 findViewById = ((ViewGroup) getParent()).findViewById(this.liftOnScrollTargetViewId);
 | |
|             }
 | |
|             if (findViewById != null) {
 | |
|                 this.liftOnScrollTargetView = new WeakReference<>(findViewById);
 | |
|             }
 | |
|         }
 | |
|         WeakReference<View> weakReference = this.liftOnScrollTargetView;
 | |
|         if (weakReference != null) {
 | |
|             return weakReference.get();
 | |
|         }
 | |
|         return null;
 | |
|     }
 | |
| 
 | |
|     private void clearLiftOnScrollTargetView() {
 | |
|         WeakReference<View> weakReference = this.liftOnScrollTargetView;
 | |
|         if (weakReference != null) {
 | |
|             weakReference.clear();
 | |
|         }
 | |
|         this.liftOnScrollTargetView = null;
 | |
|     }
 | |
| 
 | |
|     @Deprecated
 | |
|     public void setTargetElevation(float f) {
 | |
|         ViewUtilsLollipop.setDefaultAppBarLayoutStateListAnimator(this, f);
 | |
|     }
 | |
| 
 | |
|     final int getTopInset() {
 | |
|         WindowInsetsCompat windowInsetsCompat = this.lastInsets;
 | |
|         if (windowInsetsCompat != null) {
 | |
|             return windowInsetsCompat.getSystemWindowInsetTop();
 | |
|         }
 | |
|         return 0;
 | |
|     }
 | |
| 
 | |
|     private boolean shouldOffsetFirstChild() {
 | |
|         if (getChildCount() <= 0) {
 | |
|             return false;
 | |
|         }
 | |
|         View childAt = getChildAt(0);
 | |
|         return (childAt.getVisibility() == 8 || ViewCompat.getFitsSystemWindows(childAt)) ? false : true;
 | |
|     }
 | |
| 
 | |
|     WindowInsetsCompat onWindowInsetChanged(WindowInsetsCompat windowInsetsCompat) {
 | |
|         WindowInsetsCompat windowInsetsCompat2 = ViewCompat.getFitsSystemWindows(this) ? windowInsetsCompat : null;
 | |
|         if (!ObjectsCompat.equals(this.lastInsets, windowInsetsCompat2)) {
 | |
|             this.lastInsets = windowInsetsCompat2;
 | |
|             updateWillNotDraw();
 | |
|             requestLayout();
 | |
|         }
 | |
|         return windowInsetsCompat;
 | |
|     }
 | |
| 
 | |
|     public static class LayoutParams extends LinearLayout.LayoutParams {
 | |
|         static final int COLLAPSIBLE_FLAGS = 10;
 | |
|         static final int FLAG_QUICK_RETURN = 5;
 | |
|         static final int FLAG_SNAP = 17;
 | |
|         public static final int SCROLL_EFFECT_COMPRESS = 1;
 | |
|         public static final int SCROLL_EFFECT_NONE = 0;
 | |
|         public static final int SCROLL_FLAG_ENTER_ALWAYS = 4;
 | |
|         public static final int SCROLL_FLAG_ENTER_ALWAYS_COLLAPSED = 8;
 | |
|         public static final int SCROLL_FLAG_EXIT_UNTIL_COLLAPSED = 2;
 | |
|         public static final int SCROLL_FLAG_NO_SCROLL = 0;
 | |
|         public static final int SCROLL_FLAG_SCROLL = 1;
 | |
|         public static final int SCROLL_FLAG_SNAP = 16;
 | |
|         public static final int SCROLL_FLAG_SNAP_MARGINS = 32;
 | |
|         private ChildScrollEffect scrollEffect;
 | |
|         int scrollFlags;
 | |
|         Interpolator scrollInterpolator;
 | |
| 
 | |
|         @Retention(RetentionPolicy.SOURCE)
 | |
|         public @interface ScrollEffect {
 | |
|         }
 | |
| 
 | |
|         @Retention(RetentionPolicy.SOURCE)
 | |
|         public @interface ScrollFlags {
 | |
|         }
 | |
| 
 | |
|         public ChildScrollEffect getScrollEffect() {
 | |
|             return this.scrollEffect;
 | |
|         }
 | |
| 
 | |
|         public int getScrollFlags() {
 | |
|             return this.scrollFlags;
 | |
|         }
 | |
| 
 | |
|         public Interpolator getScrollInterpolator() {
 | |
|             return this.scrollInterpolator;
 | |
|         }
 | |
| 
 | |
|         boolean isCollapsible() {
 | |
|             int i = this.scrollFlags;
 | |
|             return (i & 1) == 1 && (i & 10) != 0;
 | |
|         }
 | |
| 
 | |
|         public void setScrollEffect(ChildScrollEffect childScrollEffect) {
 | |
|             this.scrollEffect = childScrollEffect;
 | |
|         }
 | |
| 
 | |
|         public void setScrollFlags(int i) {
 | |
|             this.scrollFlags = i;
 | |
|         }
 | |
| 
 | |
|         public void setScrollInterpolator(Interpolator interpolator) {
 | |
|             this.scrollInterpolator = interpolator;
 | |
|         }
 | |
| 
 | |
|         public LayoutParams(Context context, AttributeSet attributeSet) {
 | |
|             super(context, attributeSet);
 | |
|             this.scrollFlags = 1;
 | |
|             TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.AppBarLayout_Layout);
 | |
|             this.scrollFlags = obtainStyledAttributes.getInt(R.styleable.AppBarLayout_Layout_layout_scrollFlags, 0);
 | |
|             setScrollEffect(obtainStyledAttributes.getInt(R.styleable.AppBarLayout_Layout_layout_scrollEffect, 0));
 | |
|             if (obtainStyledAttributes.hasValue(R.styleable.AppBarLayout_Layout_layout_scrollInterpolator)) {
 | |
|                 this.scrollInterpolator = AnimationUtils.loadInterpolator(context, obtainStyledAttributes.getResourceId(R.styleable.AppBarLayout_Layout_layout_scrollInterpolator, 0));
 | |
|             }
 | |
|             obtainStyledAttributes.recycle();
 | |
|         }
 | |
| 
 | |
|         public LayoutParams(int i, int i2) {
 | |
|             super(i, i2);
 | |
|             this.scrollFlags = 1;
 | |
|         }
 | |
| 
 | |
|         public LayoutParams(int i, int i2, float f) {
 | |
|             super(i, i2, f);
 | |
|             this.scrollFlags = 1;
 | |
|         }
 | |
| 
 | |
|         public LayoutParams(ViewGroup.LayoutParams layoutParams) {
 | |
|             super(layoutParams);
 | |
|             this.scrollFlags = 1;
 | |
|         }
 | |
| 
 | |
|         public LayoutParams(ViewGroup.MarginLayoutParams marginLayoutParams) {
 | |
|             super(marginLayoutParams);
 | |
|             this.scrollFlags = 1;
 | |
|         }
 | |
| 
 | |
|         public LayoutParams(LinearLayout.LayoutParams layoutParams) {
 | |
|             super(layoutParams);
 | |
|             this.scrollFlags = 1;
 | |
|         }
 | |
| 
 | |
|         public LayoutParams(LayoutParams layoutParams) {
 | |
|             super((LinearLayout.LayoutParams) layoutParams);
 | |
|             this.scrollFlags = 1;
 | |
|             this.scrollFlags = layoutParams.scrollFlags;
 | |
|             this.scrollEffect = layoutParams.scrollEffect;
 | |
|             this.scrollInterpolator = layoutParams.scrollInterpolator;
 | |
|         }
 | |
| 
 | |
|         private ChildScrollEffect createScrollEffectFromInt(int i) {
 | |
|             if (i != 1) {
 | |
|                 return null;
 | |
|             }
 | |
|             return new CompressChildScrollEffect();
 | |
|         }
 | |
| 
 | |
|         public void setScrollEffect(int i) {
 | |
|             this.scrollEffect = createScrollEffectFromInt(i);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public static class Behavior extends BaseBehavior<AppBarLayout> {
 | |
| 
 | |
|         public static abstract class DragCallback extends BaseBehavior.BaseDragCallback<AppBarLayout> {
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior
 | |
|         public /* bridge */ /* synthetic */ int getLeftAndRightOffset() {
 | |
|             return super.getLeftAndRightOffset();
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior
 | |
|         public /* bridge */ /* synthetic */ int getTopAndBottomOffset() {
 | |
|             return super.getTopAndBottomOffset();
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior
 | |
|         public /* bridge */ /* synthetic */ boolean isHorizontalOffsetEnabled() {
 | |
|             return super.isHorizontalOffsetEnabled();
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior
 | |
|         public /* bridge */ /* synthetic */ boolean isVerticalOffsetEnabled() {
 | |
|             return super.isVerticalOffsetEnabled();
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.HeaderBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
 | |
|         public /* bridge */ /* synthetic */ boolean onInterceptTouchEvent(CoordinatorLayout coordinatorLayout, View view, MotionEvent motionEvent) {
 | |
|             return super.onInterceptTouchEvent(coordinatorLayout, view, motionEvent);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.AppBarLayout.BaseBehavior
 | |
|         public /* bridge */ /* synthetic */ boolean onLayoutChild(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, int i) {
 | |
|             return super.onLayoutChild(coordinatorLayout, (CoordinatorLayout) appBarLayout, i);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.AppBarLayout.BaseBehavior
 | |
|         public /* bridge */ /* synthetic */ boolean onMeasureChild(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, int i, int i2, int i3, int i4) {
 | |
|             return super.onMeasureChild(coordinatorLayout, (CoordinatorLayout) appBarLayout, i, i2, i3, i4);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.AppBarLayout.BaseBehavior
 | |
|         public /* bridge */ /* synthetic */ void onNestedPreScroll(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, View view, int i, int i2, int[] iArr, int i3) {
 | |
|             super.onNestedPreScroll(coordinatorLayout, (CoordinatorLayout) appBarLayout, view, i, i2, iArr, i3);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.AppBarLayout.BaseBehavior
 | |
|         public /* bridge */ /* synthetic */ void onNestedScroll(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, View view, int i, int i2, int i3, int i4, int i5, int[] iArr) {
 | |
|             super.onNestedScroll(coordinatorLayout, (CoordinatorLayout) appBarLayout, view, i, i2, i3, i4, i5, iArr);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.AppBarLayout.BaseBehavior
 | |
|         public /* bridge */ /* synthetic */ void onRestoreInstanceState(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, Parcelable parcelable) {
 | |
|             super.onRestoreInstanceState(coordinatorLayout, (CoordinatorLayout) appBarLayout, parcelable);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.AppBarLayout.BaseBehavior
 | |
|         public /* bridge */ /* synthetic */ Parcelable onSaveInstanceState(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout) {
 | |
|             return super.onSaveInstanceState(coordinatorLayout, (CoordinatorLayout) appBarLayout);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.AppBarLayout.BaseBehavior
 | |
|         public /* bridge */ /* synthetic */ boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, View view, View view2, int i, int i2) {
 | |
|             return super.onStartNestedScroll(coordinatorLayout, (CoordinatorLayout) appBarLayout, view, view2, i, i2);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.AppBarLayout.BaseBehavior
 | |
|         public /* bridge */ /* synthetic */ void onStopNestedScroll(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, View view, int i) {
 | |
|             super.onStopNestedScroll(coordinatorLayout, (CoordinatorLayout) appBarLayout, view, i);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.HeaderBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
 | |
|         public /* bridge */ /* synthetic */ boolean onTouchEvent(CoordinatorLayout coordinatorLayout, View view, MotionEvent motionEvent) {
 | |
|             return super.onTouchEvent(coordinatorLayout, view, motionEvent);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.AppBarLayout.BaseBehavior
 | |
|         public /* bridge */ /* synthetic */ void setDragCallback(BaseBehavior.BaseDragCallback baseDragCallback) {
 | |
|             super.setDragCallback(baseDragCallback);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior
 | |
|         public /* bridge */ /* synthetic */ void setHorizontalOffsetEnabled(boolean z) {
 | |
|             super.setHorizontalOffsetEnabled(z);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior
 | |
|         public /* bridge */ /* synthetic */ boolean setLeftAndRightOffset(int i) {
 | |
|             return super.setLeftAndRightOffset(i);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior
 | |
|         public /* bridge */ /* synthetic */ boolean setTopAndBottomOffset(int i) {
 | |
|             return super.setTopAndBottomOffset(i);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior
 | |
|         public /* bridge */ /* synthetic */ void setVerticalOffsetEnabled(boolean z) {
 | |
|             super.setVerticalOffsetEnabled(z);
 | |
|         }
 | |
| 
 | |
|         public Behavior() {
 | |
|         }
 | |
| 
 | |
|         public Behavior(Context context, AttributeSet attributeSet) {
 | |
|             super(context, attributeSet);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     protected static class BaseBehavior<T extends AppBarLayout> extends HeaderBehavior<T> {
 | |
|         private static final int MAX_OFFSET_ANIMATION_DURATION = 600;
 | |
|         private boolean coordinatorLayoutA11yScrollable;
 | |
|         private WeakReference<View> lastNestedScrollingChildRef;
 | |
|         private int lastStartedType;
 | |
|         private ValueAnimator offsetAnimator;
 | |
|         private int offsetDelta;
 | |
|         private BaseDragCallback onDragCallback;
 | |
|         private SavedState savedState;
 | |
| 
 | |
|         public static abstract class BaseDragCallback<T extends AppBarLayout> {
 | |
|             public abstract boolean canDrag(T t);
 | |
|         }
 | |
| 
 | |
|         private static boolean checkFlag(int i, int i2) {
 | |
|             return (i & i2) == i2;
 | |
|         }
 | |
| 
 | |
|         void restoreScrollState(SavedState savedState, boolean z) {
 | |
|             if (this.savedState == null || z) {
 | |
|                 this.savedState = savedState;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         public void setDragCallback(BaseDragCallback baseDragCallback) {
 | |
|             this.onDragCallback = baseDragCallback;
 | |
|         }
 | |
| 
 | |
|         public BaseBehavior() {
 | |
|         }
 | |
| 
 | |
|         public BaseBehavior(Context context, AttributeSet attributeSet) {
 | |
|             super(context, attributeSet);
 | |
|         }
 | |
| 
 | |
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
 | |
|         public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, T t, View view, View view2, int i, int i2) {
 | |
|             ValueAnimator valueAnimator;
 | |
|             boolean z = (i & 2) != 0 && (t.isLiftOnScroll() || canScrollChildren(coordinatorLayout, t, view));
 | |
|             if (z && (valueAnimator = this.offsetAnimator) != null) {
 | |
|                 valueAnimator.cancel();
 | |
|             }
 | |
|             this.lastNestedScrollingChildRef = null;
 | |
|             this.lastStartedType = i2;
 | |
|             return z;
 | |
|         }
 | |
| 
 | |
|         private boolean canScrollChildren(CoordinatorLayout coordinatorLayout, T t, View view) {
 | |
|             return t.hasScrollableChildren() && coordinatorLayout.getHeight() - view.getHeight() <= t.getHeight();
 | |
|         }
 | |
| 
 | |
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
 | |
|         public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, T t, View view, int i, int i2, int[] iArr, int i3) {
 | |
|             int i4;
 | |
|             int i5;
 | |
|             if (i2 != 0) {
 | |
|                 if (i2 < 0) {
 | |
|                     int i6 = -t.getTotalScrollRange();
 | |
|                     i4 = i6;
 | |
|                     i5 = t.getDownNestedPreScrollRange() + i6;
 | |
|                 } else {
 | |
|                     i4 = -t.getUpNestedPreScrollRange();
 | |
|                     i5 = 0;
 | |
|                 }
 | |
|                 if (i4 != i5) {
 | |
|                     iArr[1] = scroll(coordinatorLayout, t, i2, i4, i5);
 | |
|                 }
 | |
|             }
 | |
|             if (t.isLiftOnScroll()) {
 | |
|                 t.setLiftedState(t.shouldLift(view));
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
 | |
|         public void onNestedScroll(CoordinatorLayout coordinatorLayout, T t, View view, int i, int i2, int i3, int i4, int i5, int[] iArr) {
 | |
|             if (i4 < 0) {
 | |
|                 iArr[1] = scroll(coordinatorLayout, t, i4, -t.getDownNestedScrollRange(), 0);
 | |
|             }
 | |
|             if (i4 == 0) {
 | |
|                 updateAccessibilityActions(coordinatorLayout, t);
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
 | |
|         public void onStopNestedScroll(CoordinatorLayout coordinatorLayout, T t, View view, int i) {
 | |
|             if (this.lastStartedType == 0 || i == 1) {
 | |
|                 snapToChildIfNeeded(coordinatorLayout, t);
 | |
|                 if (t.isLiftOnScroll()) {
 | |
|                     t.setLiftedState(t.shouldLift(view));
 | |
|                 }
 | |
|             }
 | |
|             this.lastNestedScrollingChildRef = new WeakReference<>(view);
 | |
|         }
 | |
| 
 | |
|         private void animateOffsetTo(CoordinatorLayout coordinatorLayout, T t, int i, float f) {
 | |
|             int height;
 | |
|             int abs = Math.abs(getTopBottomOffsetForScrollingSibling() - i);
 | |
|             float abs2 = Math.abs(f);
 | |
|             if (abs2 > 0.0f) {
 | |
|                 height = Math.round((abs / abs2) * 1000.0f) * 3;
 | |
|             } else {
 | |
|                 height = (int) (((abs / t.getHeight()) + 1.0f) * 150.0f);
 | |
|             }
 | |
|             animateOffsetWithDuration(coordinatorLayout, t, i, height);
 | |
|         }
 | |
| 
 | |
|         private void animateOffsetWithDuration(final CoordinatorLayout coordinatorLayout, final T t, int i, int i2) {
 | |
|             int topBottomOffsetForScrollingSibling = getTopBottomOffsetForScrollingSibling();
 | |
|             if (topBottomOffsetForScrollingSibling == i) {
 | |
|                 ValueAnimator valueAnimator = this.offsetAnimator;
 | |
|                 if (valueAnimator == null || !valueAnimator.isRunning()) {
 | |
|                     return;
 | |
|                 }
 | |
|                 this.offsetAnimator.cancel();
 | |
|                 return;
 | |
|             }
 | |
|             ValueAnimator valueAnimator2 = this.offsetAnimator;
 | |
|             if (valueAnimator2 == null) {
 | |
|                 ValueAnimator valueAnimator3 = new ValueAnimator();
 | |
|                 this.offsetAnimator = valueAnimator3;
 | |
|                 valueAnimator3.setInterpolator(com.google.android.material.animation.AnimationUtils.DECELERATE_INTERPOLATOR);
 | |
|                 this.offsetAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.google.android.material.appbar.AppBarLayout.BaseBehavior.1
 | |
|                     @Override // android.animation.ValueAnimator.AnimatorUpdateListener
 | |
|                     public void onAnimationUpdate(ValueAnimator valueAnimator4) {
 | |
|                         BaseBehavior.this.setHeaderTopBottomOffset(coordinatorLayout, t, ((Integer) valueAnimator4.getAnimatedValue()).intValue());
 | |
|                     }
 | |
|                 });
 | |
|             } else {
 | |
|                 valueAnimator2.cancel();
 | |
|             }
 | |
|             this.offsetAnimator.setDuration(Math.min(i2, 600));
 | |
|             this.offsetAnimator.setIntValues(topBottomOffsetForScrollingSibling, i);
 | |
|             this.offsetAnimator.start();
 | |
|         }
 | |
| 
 | |
|         private int getChildIndexOnOffset(T t, int i) {
 | |
|             int childCount = t.getChildCount();
 | |
|             for (int i2 = 0; i2 < childCount; i2++) {
 | |
|                 View childAt = t.getChildAt(i2);
 | |
|                 int top = childAt.getTop();
 | |
|                 int bottom = childAt.getBottom();
 | |
|                 LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
 | |
|                 if (checkFlag(layoutParams.getScrollFlags(), 32)) {
 | |
|                     top -= layoutParams.topMargin;
 | |
|                     bottom += layoutParams.bottomMargin;
 | |
|                 }
 | |
|                 int i3 = -i;
 | |
|                 if (top <= i3 && bottom >= i3) {
 | |
|                     return i2;
 | |
|                 }
 | |
|             }
 | |
|             return -1;
 | |
|         }
 | |
| 
 | |
|         private void snapToChildIfNeeded(CoordinatorLayout coordinatorLayout, T t) {
 | |
|             int topInset = t.getTopInset() + t.getPaddingTop();
 | |
|             int topBottomOffsetForScrollingSibling = getTopBottomOffsetForScrollingSibling() - topInset;
 | |
|             int childIndexOnOffset = getChildIndexOnOffset(t, topBottomOffsetForScrollingSibling);
 | |
|             if (childIndexOnOffset >= 0) {
 | |
|                 View childAt = t.getChildAt(childIndexOnOffset);
 | |
|                 LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
 | |
|                 int scrollFlags = layoutParams.getScrollFlags();
 | |
|                 if ((scrollFlags & 17) == 17) {
 | |
|                     int i = -childAt.getTop();
 | |
|                     int i2 = -childAt.getBottom();
 | |
|                     if (childIndexOnOffset == 0 && ViewCompat.getFitsSystemWindows(t) && ViewCompat.getFitsSystemWindows(childAt)) {
 | |
|                         i -= t.getTopInset();
 | |
|                     }
 | |
|                     if (checkFlag(scrollFlags, 2)) {
 | |
|                         i2 += ViewCompat.getMinimumHeight(childAt);
 | |
|                     } else if (checkFlag(scrollFlags, 5)) {
 | |
|                         int minimumHeight = ViewCompat.getMinimumHeight(childAt) + i2;
 | |
|                         if (topBottomOffsetForScrollingSibling < minimumHeight) {
 | |
|                             i = minimumHeight;
 | |
|                         } else {
 | |
|                             i2 = minimumHeight;
 | |
|                         }
 | |
|                     }
 | |
|                     if (checkFlag(scrollFlags, 32)) {
 | |
|                         i += layoutParams.topMargin;
 | |
|                         i2 -= layoutParams.bottomMargin;
 | |
|                     }
 | |
|                     animateOffsetTo(coordinatorLayout, t, MathUtils.clamp(calculateSnapOffset(topBottomOffsetForScrollingSibling, i2, i) + topInset, -t.getTotalScrollRange(), 0), 0.0f);
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         private int calculateSnapOffset(int i, int i2, int i3) {
 | |
|             return i < (i2 + i3) / 2 ? i2 : i3;
 | |
|         }
 | |
| 
 | |
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
 | |
|         public boolean onMeasureChild(CoordinatorLayout coordinatorLayout, T t, int i, int i2, int i3, int i4) {
 | |
|             if (((CoordinatorLayout.LayoutParams) t.getLayoutParams()).height == -2) {
 | |
|                 coordinatorLayout.onMeasureChild(t, i, i2, View.MeasureSpec.makeMeasureSpec(0, 0), i4);
 | |
|                 return true;
 | |
|             }
 | |
|             return super.onMeasureChild(coordinatorLayout, (CoordinatorLayout) t, i, i2, i3, i4);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
 | |
|         public boolean onLayoutChild(CoordinatorLayout coordinatorLayout, T t, int i) {
 | |
|             int round;
 | |
|             boolean onLayoutChild = super.onLayoutChild(coordinatorLayout, (CoordinatorLayout) t, i);
 | |
|             int pendingAction = t.getPendingAction();
 | |
|             SavedState savedState = this.savedState;
 | |
|             if (savedState == null || (pendingAction & 8) != 0) {
 | |
|                 if (pendingAction != 0) {
 | |
|                     boolean z = (pendingAction & 4) != 0;
 | |
|                     if ((pendingAction & 2) != 0) {
 | |
|                         int i2 = -t.getUpNestedPreScrollRange();
 | |
|                         if (z) {
 | |
|                             animateOffsetTo(coordinatorLayout, t, i2, 0.0f);
 | |
|                         } else {
 | |
|                             setHeaderTopBottomOffset(coordinatorLayout, t, i2);
 | |
|                         }
 | |
|                     } else if ((pendingAction & 1) != 0) {
 | |
|                         if (z) {
 | |
|                             animateOffsetTo(coordinatorLayout, t, 0, 0.0f);
 | |
|                         } else {
 | |
|                             setHeaderTopBottomOffset(coordinatorLayout, t, 0);
 | |
|                         }
 | |
|                     }
 | |
|                 }
 | |
|             } else if (savedState.fullyScrolled) {
 | |
|                 setHeaderTopBottomOffset(coordinatorLayout, t, -t.getTotalScrollRange());
 | |
|             } else if (this.savedState.fullyExpanded) {
 | |
|                 setHeaderTopBottomOffset(coordinatorLayout, t, 0);
 | |
|             } else {
 | |
|                 View childAt = t.getChildAt(this.savedState.firstVisibleChildIndex);
 | |
|                 int i3 = -childAt.getBottom();
 | |
|                 if (this.savedState.firstVisibleChildAtMinimumHeight) {
 | |
|                     round = ViewCompat.getMinimumHeight(childAt) + t.getTopInset();
 | |
|                 } else {
 | |
|                     round = Math.round(childAt.getHeight() * this.savedState.firstVisibleChildPercentageShown);
 | |
|                 }
 | |
|                 setHeaderTopBottomOffset(coordinatorLayout, t, i3 + round);
 | |
|             }
 | |
|             t.resetPendingAction();
 | |
|             this.savedState = null;
 | |
|             setTopAndBottomOffset(MathUtils.clamp(getTopAndBottomOffset(), -t.getTotalScrollRange(), 0));
 | |
|             updateAppBarLayoutDrawableState(coordinatorLayout, t, getTopAndBottomOffset(), 0, true);
 | |
|             t.onOffsetChanged(getTopAndBottomOffset());
 | |
|             updateAccessibilityActions(coordinatorLayout, t);
 | |
|             return onLayoutChild;
 | |
|         }
 | |
| 
 | |
|         private void updateAccessibilityActions(CoordinatorLayout coordinatorLayout, T t) {
 | |
|             View childWithScrollingBehavior;
 | |
|             ViewCompat.removeAccessibilityAction(coordinatorLayout, AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_SCROLL_FORWARD.getId());
 | |
|             ViewCompat.removeAccessibilityAction(coordinatorLayout, AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_SCROLL_BACKWARD.getId());
 | |
|             if (t.getTotalScrollRange() == 0 || (childWithScrollingBehavior = getChildWithScrollingBehavior(coordinatorLayout)) == null || !childrenHaveScrollFlags(t)) {
 | |
|                 return;
 | |
|             }
 | |
|             if (!ViewCompat.hasAccessibilityDelegate(coordinatorLayout)) {
 | |
|                 ViewCompat.setAccessibilityDelegate(coordinatorLayout, new AccessibilityDelegateCompat() { // from class: com.google.android.material.appbar.AppBarLayout.BaseBehavior.2
 | |
|                     @Override // androidx.core.view.AccessibilityDelegateCompat
 | |
|                     public void onInitializeAccessibilityNodeInfo(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
 | |
|                         super.onInitializeAccessibilityNodeInfo(view, accessibilityNodeInfoCompat);
 | |
|                         accessibilityNodeInfoCompat.setScrollable(BaseBehavior.this.coordinatorLayoutA11yScrollable);
 | |
|                         accessibilityNodeInfoCompat.setClassName(ScrollView.class.getName());
 | |
|                     }
 | |
|                 });
 | |
|             }
 | |
|             this.coordinatorLayoutA11yScrollable = addAccessibilityScrollActions(coordinatorLayout, t, childWithScrollingBehavior);
 | |
|         }
 | |
| 
 | |
|         private View getChildWithScrollingBehavior(CoordinatorLayout coordinatorLayout) {
 | |
|             int childCount = coordinatorLayout.getChildCount();
 | |
|             for (int i = 0; i < childCount; i++) {
 | |
|                 View childAt = coordinatorLayout.getChildAt(i);
 | |
|                 if (((CoordinatorLayout.LayoutParams) childAt.getLayoutParams()).getBehavior() instanceof ScrollingViewBehavior) {
 | |
|                     return childAt;
 | |
|                 }
 | |
|             }
 | |
|             return null;
 | |
|         }
 | |
| 
 | |
|         private boolean childrenHaveScrollFlags(AppBarLayout appBarLayout) {
 | |
|             int childCount = appBarLayout.getChildCount();
 | |
|             for (int i = 0; i < childCount; i++) {
 | |
|                 if (((LayoutParams) appBarLayout.getChildAt(i).getLayoutParams()).scrollFlags != 0) {
 | |
|                     return true;
 | |
|                 }
 | |
|             }
 | |
|             return false;
 | |
|         }
 | |
| 
 | |
|         private boolean addAccessibilityScrollActions(final CoordinatorLayout coordinatorLayout, final T t, final View view) {
 | |
|             boolean z = false;
 | |
|             if (getTopBottomOffsetForScrollingSibling() != (-t.getTotalScrollRange())) {
 | |
|                 addActionToExpand(coordinatorLayout, t, AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_SCROLL_FORWARD, false);
 | |
|                 z = true;
 | |
|             }
 | |
|             if (getTopBottomOffsetForScrollingSibling() != 0) {
 | |
|                 if (view.canScrollVertically(-1)) {
 | |
|                     final int i = -t.getDownNestedPreScrollRange();
 | |
|                     if (i != 0) {
 | |
|                         ViewCompat.replaceAccessibilityAction(coordinatorLayout, AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_SCROLL_BACKWARD, null, new AccessibilityViewCommand() { // from class: com.google.android.material.appbar.AppBarLayout.BaseBehavior.3
 | |
|                             /* JADX WARN: Multi-variable type inference failed */
 | |
|                             @Override // androidx.core.view.accessibility.AccessibilityViewCommand
 | |
|                             public boolean perform(View view2, AccessibilityViewCommand.CommandArguments commandArguments) {
 | |
|                                 BaseBehavior.this.onNestedPreScroll(coordinatorLayout, (CoordinatorLayout) t, view, 0, i, new int[]{0, 0}, 1);
 | |
|                                 return true;
 | |
|                             }
 | |
|                         });
 | |
|                         return true;
 | |
|                     }
 | |
|                 } else {
 | |
|                     addActionToExpand(coordinatorLayout, t, AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_SCROLL_BACKWARD, true);
 | |
|                     return true;
 | |
|                 }
 | |
|             }
 | |
|             return z;
 | |
|         }
 | |
| 
 | |
|         private void addActionToExpand(CoordinatorLayout coordinatorLayout, final T t, AccessibilityNodeInfoCompat.AccessibilityActionCompat accessibilityActionCompat, final boolean z) {
 | |
|             ViewCompat.replaceAccessibilityAction(coordinatorLayout, accessibilityActionCompat, null, new AccessibilityViewCommand() { // from class: com.google.android.material.appbar.AppBarLayout.BaseBehavior.4
 | |
|                 @Override // androidx.core.view.accessibility.AccessibilityViewCommand
 | |
|                 public boolean perform(View view, AccessibilityViewCommand.CommandArguments commandArguments) {
 | |
|                     t.setExpanded(z);
 | |
|                     return true;
 | |
|                 }
 | |
|             });
 | |
|         }
 | |
| 
 | |
|         /* JADX INFO: Access modifiers changed from: package-private */
 | |
|         @Override // com.google.android.material.appbar.HeaderBehavior
 | |
|         public boolean canDragView(T t) {
 | |
|             BaseDragCallback baseDragCallback = this.onDragCallback;
 | |
|             if (baseDragCallback != null) {
 | |
|                 return baseDragCallback.canDrag(t);
 | |
|             }
 | |
|             WeakReference<View> weakReference = this.lastNestedScrollingChildRef;
 | |
|             if (weakReference == null) {
 | |
|                 return true;
 | |
|             }
 | |
|             View view = weakReference.get();
 | |
|             return (view == null || !view.isShown() || view.canScrollVertically(-1)) ? false : true;
 | |
|         }
 | |
| 
 | |
|         /* JADX INFO: Access modifiers changed from: package-private */
 | |
|         @Override // com.google.android.material.appbar.HeaderBehavior
 | |
|         public void onFlingFinished(CoordinatorLayout coordinatorLayout, T t) {
 | |
|             snapToChildIfNeeded(coordinatorLayout, t);
 | |
|             if (t.isLiftOnScroll()) {
 | |
|                 t.setLiftedState(t.shouldLift(findFirstScrollingChild(coordinatorLayout)));
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /* JADX INFO: Access modifiers changed from: package-private */
 | |
|         @Override // com.google.android.material.appbar.HeaderBehavior
 | |
|         public int getMaxDragOffset(T t) {
 | |
|             return (-t.getDownNestedScrollRange()) + t.getTopInset();
 | |
|         }
 | |
| 
 | |
|         /* JADX INFO: Access modifiers changed from: package-private */
 | |
|         @Override // com.google.android.material.appbar.HeaderBehavior
 | |
|         public int getScrollRangeForDragFling(T t) {
 | |
|             return t.getTotalScrollRange();
 | |
|         }
 | |
| 
 | |
|         /* JADX INFO: Access modifiers changed from: package-private */
 | |
|         @Override // com.google.android.material.appbar.HeaderBehavior
 | |
|         public int setHeaderTopBottomOffset(CoordinatorLayout coordinatorLayout, T t, int i, int i2, int i3) {
 | |
|             int topBottomOffsetForScrollingSibling = getTopBottomOffsetForScrollingSibling();
 | |
|             int i4 = 0;
 | |
|             if (i2 == 0 || topBottomOffsetForScrollingSibling < i2 || topBottomOffsetForScrollingSibling > i3) {
 | |
|                 this.offsetDelta = 0;
 | |
|             } else {
 | |
|                 int clamp = MathUtils.clamp(i, i2, i3);
 | |
|                 if (topBottomOffsetForScrollingSibling != clamp) {
 | |
|                     int interpolateOffset = t.hasChildWithInterpolator() ? interpolateOffset(t, clamp) : clamp;
 | |
|                     boolean topAndBottomOffset = setTopAndBottomOffset(interpolateOffset);
 | |
|                     int i5 = topBottomOffsetForScrollingSibling - clamp;
 | |
|                     this.offsetDelta = clamp - interpolateOffset;
 | |
|                     if (topAndBottomOffset) {
 | |
|                         while (i4 < t.getChildCount()) {
 | |
|                             LayoutParams layoutParams = (LayoutParams) t.getChildAt(i4).getLayoutParams();
 | |
|                             ChildScrollEffect scrollEffect = layoutParams.getScrollEffect();
 | |
|                             if (scrollEffect != null && (layoutParams.getScrollFlags() & 1) != 0) {
 | |
|                                 scrollEffect.onOffsetChanged(t, t.getChildAt(i4), getTopAndBottomOffset());
 | |
|                             }
 | |
|                             i4++;
 | |
|                         }
 | |
|                     }
 | |
|                     if (!topAndBottomOffset && t.hasChildWithInterpolator()) {
 | |
|                         coordinatorLayout.dispatchDependentViewsChanged(t);
 | |
|                     }
 | |
|                     t.onOffsetChanged(getTopAndBottomOffset());
 | |
|                     updateAppBarLayoutDrawableState(coordinatorLayout, t, clamp, clamp < topBottomOffsetForScrollingSibling ? -1 : 1, false);
 | |
|                     i4 = i5;
 | |
|                 }
 | |
|             }
 | |
|             updateAccessibilityActions(coordinatorLayout, t);
 | |
|             return i4;
 | |
|         }
 | |
| 
 | |
|         boolean isOffsetAnimatorRunning() {
 | |
|             ValueAnimator valueAnimator = this.offsetAnimator;
 | |
|             return valueAnimator != null && valueAnimator.isRunning();
 | |
|         }
 | |
| 
 | |
|         private int interpolateOffset(T t, int i) {
 | |
|             int abs = Math.abs(i);
 | |
|             int childCount = t.getChildCount();
 | |
|             int i2 = 0;
 | |
|             int i3 = 0;
 | |
|             while (true) {
 | |
|                 if (i3 >= childCount) {
 | |
|                     break;
 | |
|                 }
 | |
|                 View childAt = t.getChildAt(i3);
 | |
|                 LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
 | |
|                 Interpolator scrollInterpolator = layoutParams.getScrollInterpolator();
 | |
|                 if (abs < childAt.getTop() || abs > childAt.getBottom()) {
 | |
|                     i3++;
 | |
|                 } else if (scrollInterpolator != null) {
 | |
|                     int scrollFlags = layoutParams.getScrollFlags();
 | |
|                     if ((scrollFlags & 1) != 0) {
 | |
|                         i2 = childAt.getHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
 | |
|                         if ((scrollFlags & 2) != 0) {
 | |
|                             i2 -= ViewCompat.getMinimumHeight(childAt);
 | |
|                         }
 | |
|                     }
 | |
|                     if (ViewCompat.getFitsSystemWindows(childAt)) {
 | |
|                         i2 -= t.getTopInset();
 | |
|                     }
 | |
|                     if (i2 > 0) {
 | |
|                         float f = i2;
 | |
|                         return Integer.signum(i) * (childAt.getTop() + Math.round(f * scrollInterpolator.getInterpolation((abs - childAt.getTop()) / f)));
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
|             return i;
 | |
|         }
 | |
| 
 | |
|         private void updateAppBarLayoutDrawableState(CoordinatorLayout coordinatorLayout, T t, int i, int i2, boolean z) {
 | |
|             Drawable foreground;
 | |
|             Drawable foreground2;
 | |
|             View appBarChildOnOffset = getAppBarChildOnOffset(t, i);
 | |
|             boolean z2 = false;
 | |
|             if (appBarChildOnOffset != null) {
 | |
|                 int scrollFlags = ((LayoutParams) appBarChildOnOffset.getLayoutParams()).getScrollFlags();
 | |
|                 if ((scrollFlags & 1) != 0) {
 | |
|                     int minimumHeight = ViewCompat.getMinimumHeight(appBarChildOnOffset);
 | |
|                     if (i2 <= 0 || (scrollFlags & 12) == 0 ? !((scrollFlags & 2) == 0 || (-i) < (appBarChildOnOffset.getBottom() - minimumHeight) - t.getTopInset()) : (-i) >= (appBarChildOnOffset.getBottom() - minimumHeight) - t.getTopInset()) {
 | |
|                         z2 = true;
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
|             if (t.isLiftOnScroll()) {
 | |
|                 z2 = t.shouldLift(findFirstScrollingChild(coordinatorLayout));
 | |
|             }
 | |
|             boolean liftedState = t.setLiftedState(z2);
 | |
|             if (z || (liftedState && shouldJumpElevationState(coordinatorLayout, t))) {
 | |
|                 if (t.getBackground() != null) {
 | |
|                     t.getBackground().jumpToCurrentState();
 | |
|                 }
 | |
|                 if (Build.VERSION.SDK_INT >= 23) {
 | |
|                     foreground = t.getForeground();
 | |
|                     if (foreground != null) {
 | |
|                         foreground2 = t.getForeground();
 | |
|                         foreground2.jumpToCurrentState();
 | |
|                     }
 | |
|                 }
 | |
|                 if (t.getStateListAnimator() != null) {
 | |
|                     t.getStateListAnimator().jumpToCurrentState();
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         private boolean shouldJumpElevationState(CoordinatorLayout coordinatorLayout, T t) {
 | |
|             List<View> dependents = coordinatorLayout.getDependents(t);
 | |
|             int size = dependents.size();
 | |
|             for (int i = 0; i < size; i++) {
 | |
|                 CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) dependents.get(i).getLayoutParams()).getBehavior();
 | |
|                 if (behavior instanceof ScrollingViewBehavior) {
 | |
|                     return ((ScrollingViewBehavior) behavior).getOverlayTop() != 0;
 | |
|                 }
 | |
|             }
 | |
|             return false;
 | |
|         }
 | |
| 
 | |
|         private static View getAppBarChildOnOffset(AppBarLayout appBarLayout, int i) {
 | |
|             int abs = Math.abs(i);
 | |
|             int childCount = appBarLayout.getChildCount();
 | |
|             for (int i2 = 0; i2 < childCount; i2++) {
 | |
|                 View childAt = appBarLayout.getChildAt(i2);
 | |
|                 if (abs >= childAt.getTop() && abs <= childAt.getBottom()) {
 | |
|                     return childAt;
 | |
|                 }
 | |
|             }
 | |
|             return null;
 | |
|         }
 | |
| 
 | |
|         private View findFirstScrollingChild(CoordinatorLayout coordinatorLayout) {
 | |
|             int childCount = coordinatorLayout.getChildCount();
 | |
|             for (int i = 0; i < childCount; i++) {
 | |
|                 View childAt = coordinatorLayout.getChildAt(i);
 | |
|                 if ((childAt instanceof NestedScrollingChild) || (childAt instanceof AbsListView) || (childAt instanceof ScrollView)) {
 | |
|                     return childAt;
 | |
|                 }
 | |
|             }
 | |
|             return null;
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.HeaderBehavior
 | |
|         int getTopBottomOffsetForScrollingSibling() {
 | |
|             return getTopAndBottomOffset() + this.offsetDelta;
 | |
|         }
 | |
| 
 | |
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
 | |
|         public Parcelable onSaveInstanceState(CoordinatorLayout coordinatorLayout, T t) {
 | |
|             Parcelable onSaveInstanceState = super.onSaveInstanceState(coordinatorLayout, (CoordinatorLayout) t);
 | |
|             SavedState saveScrollState = saveScrollState(onSaveInstanceState, t);
 | |
|             return saveScrollState == null ? onSaveInstanceState : saveScrollState;
 | |
|         }
 | |
| 
 | |
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
 | |
|         public void onRestoreInstanceState(CoordinatorLayout coordinatorLayout, T t, Parcelable parcelable) {
 | |
|             if (parcelable instanceof SavedState) {
 | |
|                 restoreScrollState((SavedState) parcelable, true);
 | |
|                 super.onRestoreInstanceState(coordinatorLayout, (CoordinatorLayout) t, this.savedState.getSuperState());
 | |
|             } else {
 | |
|                 super.onRestoreInstanceState(coordinatorLayout, (CoordinatorLayout) t, parcelable);
 | |
|                 this.savedState = null;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         SavedState saveScrollState(Parcelable parcelable, T t) {
 | |
|             int topAndBottomOffset = getTopAndBottomOffset();
 | |
|             int childCount = t.getChildCount();
 | |
|             for (int i = 0; i < childCount; i++) {
 | |
|                 View childAt = t.getChildAt(i);
 | |
|                 int bottom = childAt.getBottom() + topAndBottomOffset;
 | |
|                 if (childAt.getTop() + topAndBottomOffset <= 0 && bottom >= 0) {
 | |
|                     if (parcelable == null) {
 | |
|                         parcelable = AbsSavedState.EMPTY_STATE;
 | |
|                     }
 | |
|                     SavedState savedState = new SavedState(parcelable);
 | |
|                     savedState.fullyExpanded = topAndBottomOffset == 0;
 | |
|                     savedState.fullyScrolled = !savedState.fullyExpanded && (-topAndBottomOffset) >= t.getTotalScrollRange();
 | |
|                     savedState.firstVisibleChildIndex = i;
 | |
|                     savedState.firstVisibleChildAtMinimumHeight = bottom == ViewCompat.getMinimumHeight(childAt) + t.getTopInset();
 | |
|                     savedState.firstVisibleChildPercentageShown = bottom / childAt.getHeight();
 | |
|                     return savedState;
 | |
|                 }
 | |
|             }
 | |
|             return null;
 | |
|         }
 | |
| 
 | |
|         protected static class SavedState extends AbsSavedState {
 | |
|             public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.ClassLoaderCreator<SavedState>() { // from class: com.google.android.material.appbar.AppBarLayout.BaseBehavior.SavedState.1
 | |
|                 /* 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);
 | |
|                 }
 | |
| 
 | |
|                 @Override // android.os.Parcelable.Creator
 | |
|                 public SavedState[] newArray(int i) {
 | |
|                     return new SavedState[i];
 | |
|                 }
 | |
|             };
 | |
|             boolean firstVisibleChildAtMinimumHeight;
 | |
|             int firstVisibleChildIndex;
 | |
|             float firstVisibleChildPercentageShown;
 | |
|             boolean fullyExpanded;
 | |
|             boolean fullyScrolled;
 | |
| 
 | |
|             public SavedState(Parcel parcel, ClassLoader classLoader) {
 | |
|                 super(parcel, classLoader);
 | |
|                 this.fullyScrolled = parcel.readByte() != 0;
 | |
|                 this.fullyExpanded = parcel.readByte() != 0;
 | |
|                 this.firstVisibleChildIndex = parcel.readInt();
 | |
|                 this.firstVisibleChildPercentageShown = parcel.readFloat();
 | |
|                 this.firstVisibleChildAtMinimumHeight = parcel.readByte() != 0;
 | |
|             }
 | |
| 
 | |
|             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.writeByte(this.fullyScrolled ? (byte) 1 : (byte) 0);
 | |
|                 parcel.writeByte(this.fullyExpanded ? (byte) 1 : (byte) 0);
 | |
|                 parcel.writeInt(this.firstVisibleChildIndex);
 | |
|                 parcel.writeFloat(this.firstVisibleChildPercentageShown);
 | |
|                 parcel.writeByte(this.firstVisibleChildAtMinimumHeight ? (byte) 1 : (byte) 0);
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public static class ScrollingViewBehavior extends HeaderScrollingViewBehavior {
 | |
|         @Override // com.google.android.material.appbar.HeaderScrollingViewBehavior
 | |
|         /* bridge */ /* synthetic */ View findFirstDependency(List list) {
 | |
|             return findFirstDependency((List<View>) list);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior
 | |
|         public /* bridge */ /* synthetic */ int getLeftAndRightOffset() {
 | |
|             return super.getLeftAndRightOffset();
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior
 | |
|         public /* bridge */ /* synthetic */ int getTopAndBottomOffset() {
 | |
|             return super.getTopAndBottomOffset();
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior
 | |
|         public /* bridge */ /* synthetic */ boolean isHorizontalOffsetEnabled() {
 | |
|             return super.isHorizontalOffsetEnabled();
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior
 | |
|         public /* bridge */ /* synthetic */ boolean isVerticalOffsetEnabled() {
 | |
|             return super.isVerticalOffsetEnabled();
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
 | |
|         public /* bridge */ /* synthetic */ boolean onLayoutChild(CoordinatorLayout coordinatorLayout, View view, int i) {
 | |
|             return super.onLayoutChild(coordinatorLayout, view, i);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.HeaderScrollingViewBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
 | |
|         public /* bridge */ /* synthetic */ boolean onMeasureChild(CoordinatorLayout coordinatorLayout, View view, int i, int i2, int i3, int i4) {
 | |
|             return super.onMeasureChild(coordinatorLayout, view, i, i2, i3, i4);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior
 | |
|         public /* bridge */ /* synthetic */ void setHorizontalOffsetEnabled(boolean z) {
 | |
|             super.setHorizontalOffsetEnabled(z);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior
 | |
|         public /* bridge */ /* synthetic */ boolean setLeftAndRightOffset(int i) {
 | |
|             return super.setLeftAndRightOffset(i);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior
 | |
|         public /* bridge */ /* synthetic */ boolean setTopAndBottomOffset(int i) {
 | |
|             return super.setTopAndBottomOffset(i);
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.ViewOffsetBehavior
 | |
|         public /* bridge */ /* synthetic */ void setVerticalOffsetEnabled(boolean z) {
 | |
|             super.setVerticalOffsetEnabled(z);
 | |
|         }
 | |
| 
 | |
|         public ScrollingViewBehavior() {
 | |
|         }
 | |
| 
 | |
|         public ScrollingViewBehavior(Context context, AttributeSet attributeSet) {
 | |
|             super(context, attributeSet);
 | |
|             TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.ScrollingViewBehavior_Layout);
 | |
|             setOverlayTop(obtainStyledAttributes.getDimensionPixelSize(R.styleable.ScrollingViewBehavior_Layout_behavior_overlapTop, 0));
 | |
|             obtainStyledAttributes.recycle();
 | |
|         }
 | |
| 
 | |
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
 | |
|         public boolean layoutDependsOn(CoordinatorLayout coordinatorLayout, View view, View view2) {
 | |
|             return view2 instanceof AppBarLayout;
 | |
|         }
 | |
| 
 | |
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
 | |
|         public boolean onDependentViewChanged(CoordinatorLayout coordinatorLayout, View view, View view2) {
 | |
|             offsetChildAsNeeded(view, view2);
 | |
|             updateLiftedStateIfNeeded(view, view2);
 | |
|             return false;
 | |
|         }
 | |
| 
 | |
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
 | |
|         public void onDependentViewRemoved(CoordinatorLayout coordinatorLayout, View view, View view2) {
 | |
|             if (view2 instanceof AppBarLayout) {
 | |
|                 ViewCompat.removeAccessibilityAction(coordinatorLayout, AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_SCROLL_FORWARD.getId());
 | |
|                 ViewCompat.removeAccessibilityAction(coordinatorLayout, AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_SCROLL_BACKWARD.getId());
 | |
|                 ViewCompat.setAccessibilityDelegate(coordinatorLayout, null);
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
 | |
|         public boolean onRequestChildRectangleOnScreen(CoordinatorLayout coordinatorLayout, View view, Rect rect, boolean z) {
 | |
|             AppBarLayout findFirstDependency = findFirstDependency(coordinatorLayout.getDependencies(view));
 | |
|             if (findFirstDependency != null) {
 | |
|                 Rect rect2 = new Rect(rect);
 | |
|                 rect2.offset(view.getLeft(), view.getTop());
 | |
|                 Rect rect3 = this.tempRect1;
 | |
|                 rect3.set(0, 0, coordinatorLayout.getWidth(), coordinatorLayout.getHeight());
 | |
|                 if (!rect3.contains(rect2)) {
 | |
|                     findFirstDependency.setExpanded(false, !z);
 | |
|                     return true;
 | |
|                 }
 | |
|             }
 | |
|             return false;
 | |
|         }
 | |
| 
 | |
|         private void offsetChildAsNeeded(View view, View view2) {
 | |
|             CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) view2.getLayoutParams()).getBehavior();
 | |
|             if (behavior instanceof BaseBehavior) {
 | |
|                 ViewCompat.offsetTopAndBottom(view, (((view2.getBottom() - view.getTop()) + ((BaseBehavior) behavior).offsetDelta) + getVerticalLayoutGap()) - getOverlapPixelsForOffset(view2));
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.HeaderScrollingViewBehavior
 | |
|         float getOverlapRatioForOffset(View view) {
 | |
|             int i;
 | |
|             if (view instanceof AppBarLayout) {
 | |
|                 AppBarLayout appBarLayout = (AppBarLayout) view;
 | |
|                 int totalScrollRange = appBarLayout.getTotalScrollRange();
 | |
|                 int downNestedPreScrollRange = appBarLayout.getDownNestedPreScrollRange();
 | |
|                 int appBarLayoutOffset = getAppBarLayoutOffset(appBarLayout);
 | |
|                 if ((downNestedPreScrollRange == 0 || totalScrollRange + appBarLayoutOffset > downNestedPreScrollRange) && (i = totalScrollRange - downNestedPreScrollRange) != 0) {
 | |
|                     return (appBarLayoutOffset / i) + 1.0f;
 | |
|                 }
 | |
|             }
 | |
|             return 0.0f;
 | |
|         }
 | |
| 
 | |
|         private static int getAppBarLayoutOffset(AppBarLayout appBarLayout) {
 | |
|             CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams()).getBehavior();
 | |
|             if (behavior instanceof BaseBehavior) {
 | |
|                 return ((BaseBehavior) behavior).getTopBottomOffsetForScrollingSibling();
 | |
|             }
 | |
|             return 0;
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.HeaderScrollingViewBehavior
 | |
|         AppBarLayout findFirstDependency(List<View> list) {
 | |
|             int size = list.size();
 | |
|             for (int i = 0; i < size; i++) {
 | |
|                 View view = list.get(i);
 | |
|                 if (view instanceof AppBarLayout) {
 | |
|                     return (AppBarLayout) view;
 | |
|                 }
 | |
|             }
 | |
|             return null;
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.HeaderScrollingViewBehavior
 | |
|         int getScrollRange(View view) {
 | |
|             if (view instanceof AppBarLayout) {
 | |
|                 return ((AppBarLayout) view).getTotalScrollRange();
 | |
|             }
 | |
|             return super.getScrollRange(view);
 | |
|         }
 | |
| 
 | |
|         private void updateLiftedStateIfNeeded(View view, View view2) {
 | |
|             if (view2 instanceof AppBarLayout) {
 | |
|                 AppBarLayout appBarLayout = (AppBarLayout) view2;
 | |
|                 if (appBarLayout.isLiftOnScroll()) {
 | |
|                     appBarLayout.setLiftedState(appBarLayout.shouldLift(view));
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     public static class CompressChildScrollEffect extends ChildScrollEffect {
 | |
|         private static final float COMPRESS_DISTANCE_FACTOR = 0.3f;
 | |
|         private final Rect relativeRect = new Rect();
 | |
|         private final Rect ghostRect = new Rect();
 | |
| 
 | |
|         private static void updateRelativeRect(Rect rect, AppBarLayout appBarLayout, View view) {
 | |
|             view.getDrawingRect(rect);
 | |
|             appBarLayout.offsetDescendantRectToMyCoords(view, rect);
 | |
|             rect.offset(0, -appBarLayout.getTopInset());
 | |
|         }
 | |
| 
 | |
|         @Override // com.google.android.material.appbar.AppBarLayout.ChildScrollEffect
 | |
|         public void onOffsetChanged(AppBarLayout appBarLayout, View view, float f) {
 | |
|             updateRelativeRect(this.relativeRect, appBarLayout, view);
 | |
|             float abs = this.relativeRect.top - Math.abs(f);
 | |
|             if (abs <= 0.0f) {
 | |
|                 float clamp = 1.0f - MathUtils.clamp(Math.abs(abs / this.relativeRect.height()), 0.0f, 1.0f);
 | |
|                 float height = (-abs) - ((this.relativeRect.height() * COMPRESS_DISTANCE_FACTOR) * (1.0f - (clamp * clamp)));
 | |
|                 view.setTranslationY(height);
 | |
|                 view.getDrawingRect(this.ghostRect);
 | |
|                 this.ghostRect.offset(0, (int) (-height));
 | |
|                 ViewCompat.setClipBounds(view, this.ghostRect);
 | |
|                 return;
 | |
|             }
 | |
|             ViewCompat.setClipBounds(view, null);
 | |
|             view.setTranslationY(0.0f);
 | |
|         }
 | |
|     }
 | |
| }
 |