CrackMe.apk
Download file
package com.google.android.material.appbar;
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.View;
import android.view.ViewGroup;
import android.view.animation.Interpolator;
import android.widget.LinearLayout;
import android.widget.ListView;
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.NestedScrollingChild;
import androidx.core.view.OnApplyWindowInsetsListener;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.customview.view.AbsSavedState;
import com.google.android.material.R;
import com.google.android.material.animation.AnimationUtils;
import com.google.android.material.internal.ThemeEnforcement;
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.List;
@CoordinatorLayout.DefaultBehavior(Behavior.class)
public class AppBarLayout extends LinearLayout {
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 int currentOffset;
private int downPreScrollRange;
private int downScrollRange;
private ValueAnimator elevationOverlayAnimator;
private boolean haveChildWithInterpolator;
private WindowInsetsCompat lastInsets;
private boolean liftOnScroll;
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 int[] tmpStatesArray;
private int totalScrollRange;
public interface BaseOnOffsetChangedListener<T extends AppBarLayout> {
void onOffsetChanged(T t, int i);
}
public interface OnOffsetChangedListener extends BaseOnOffsetChangedListener<AppBarLayout> {
void onOffsetChanged(AppBarLayout appBarLayout, int i);
}
@Deprecated
public float getTargetElevation() {
return 0.0f;
}
public AppBarLayout(Context context) {
this(context, (AttributeSet) null);
}
public AppBarLayout(Context context, AttributeSet attributeSet) {
this(context, attributeSet, R.attr.appBarLayoutStyle);
}
public AppBarLayout(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.totalScrollRange = -1;
this.downPreScrollRange = -1;
this.downScrollRange = -1;
this.pendingAction = 0;
setOrientation(1);
if (Build.VERSION.SDK_INT >= 21) {
ViewUtilsLollipop.setBoundsViewOutlineProvider(this);
ViewUtilsLollipop.setStateListAnimatorFromAttrs(this, attributeSet, i, R.style.Widget_Design_AppBarLayout);
}
TypedArray obtainStyledAttributes = ThemeEnforcement.obtainStyledAttributes(context, attributeSet, R.styleable.AppBarLayout, i, R.style.Widget_Design_AppBarLayout, new int[0]);
ViewCompat.setBackground(this, obtainStyledAttributes.getDrawable(R.styleable.AppBarLayout_android_background));
if (getBackground() instanceof ColorDrawable) {
MaterialShapeDrawable materialShapeDrawable = new MaterialShapeDrawable();
materialShapeDrawable.setFillColor(ColorStateList.valueOf(((ColorDrawable) getBackground()).getColor()));
materialShapeDrawable.initializeElevationOverlay(context);
ViewCompat.setBackground(this, materialShapeDrawable);
}
if (obtainStyledAttributes.hasValue(R.styleable.AppBarLayout_expanded)) {
setExpanded(obtainStyledAttributes.getBoolean(R.styleable.AppBarLayout_expanded, false), false, false);
}
if (Build.VERSION.SDK_INT >= 21 && obtainStyledAttributes.hasValue(R.styleable.AppBarLayout_elevation)) {
ViewUtilsLollipop.setDefaultAppBarLayoutStateListAnimator(this, (float) obtainStyledAttributes.getDimensionPixelSize(R.styleable.AppBarLayout_elevation, 0));
}
if (Build.VERSION.SDK_INT >= 26) {
if (obtainStyledAttributes.hasValue(R.styleable.AppBarLayout_android_keyboardNavigationCluster)) {
setKeyboardNavigationCluster(obtainStyledAttributes.getBoolean(R.styleable.AppBarLayout_android_keyboardNavigationCluster, false));
}
if (obtainStyledAttributes.hasValue(R.styleable.AppBarLayout_android_touchscreenBlocksFocus)) {
setTouchscreenBlocksFocus(obtainStyledAttributes.getBoolean(R.styleable.AppBarLayout_android_touchscreenBlocksFocus, false));
}
}
this.liftOnScroll = obtainStyledAttributes.getBoolean(R.styleable.AppBarLayout_liftOnScroll, false);
this.liftOnScrollTargetViewId = obtainStyledAttributes.getResourceId(R.styleable.AppBarLayout_liftOnScrollTargetViewId, -1);
setStatusBarForeground(obtainStyledAttributes.getDrawable(R.styleable.AppBarLayout_statusBarForeground));
obtainStyledAttributes.recycle();
ViewCompat.setOnApplyWindowInsetsListener(this, new OnApplyWindowInsetsListener() {
public WindowInsetsCompat onApplyWindowInsets(View view, WindowInsetsCompat windowInsetsCompat) {
return AppBarLayout.this.onWindowInsetChanged(windowInsetsCompat);
}
});
}
public void addOnOffsetChangedListener(BaseOnOffsetChangedListener baseOnOffsetChangedListener) {
if (this.listeners == null) {
this.listeners = new ArrayList();
}
if (baseOnOffsetChangedListener != null && !this.listeners.contains(baseOnOffsetChangedListener)) {
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) {
list.remove(baseOnOffsetChangedListener);
}
}
public void removeOnOffsetChangedListener(OnOffsetChangedListener onOffsetChangedListener) {
removeOnOffsetChangedListener((BaseOnOffsetChangedListener) onOffsetChangedListener);
}
public void setStatusBarForeground(Drawable drawable) {
Drawable drawable2 = this.statusBarForeground;
if (drawable2 != drawable) {
Drawable drawable3 = null;
if (drawable2 != null) {
drawable2.setCallback((Drawable.Callback) null);
}
if (drawable != null) {
drawable3 = drawable.mutate();
}
this.statusBarForeground = drawable3;
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));
}
public Drawable getStatusBarForeground() {
return this.statusBarForeground;
}
public void draw(Canvas canvas) {
super.draw(canvas);
if (shouldDrawStatusBarForeground()) {
int save = canvas.save();
canvas.translate(0.0f, (float) (-this.currentOffset));
this.statusBarForeground.draw(canvas);
canvas.restoreToCount(save);
}
}
/* access modifiers changed from: protected */
public void drawableStateChanged() {
super.drawableStateChanged();
int[] drawableState = getDrawableState();
Drawable drawable = this.statusBarForeground;
if (drawable != null && drawable.isStateful() && drawable.setState(drawableState)) {
invalidateDrawable(drawable);
}
}
/* access modifiers changed from: protected */
public boolean verifyDrawable(Drawable drawable) {
return super.verifyDrawable(drawable) || drawable == this.statusBarForeground;
}
public void setVisibility(int i) {
super.setVisibility(i);
boolean z = i == 0;
Drawable drawable = this.statusBarForeground;
if (drawable != null) {
drawable.setVisible(z, false);
}
}
/* access modifiers changed from: protected */
public 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();
}
/* access modifiers changed from: protected */
public 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;
} else if (((LayoutParams) getChildAt(i5).getLayoutParams()).getScrollInterpolator() != null) {
this.haveChildWithInterpolator = true;
break;
} else {
i5++;
}
}
Drawable drawable = this.statusBarForeground;
if (drawable != null) {
drawable.setBounds(0, 0, getWidth(), getTopInset());
}
if (!this.liftableOverride) {
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() {
this.totalScrollRange = -1;
this.downPreScrollRange = -1;
this.downScrollRange = -1;
}
public void setOrientation(int i) {
if (i == 1) {
super.setOrientation(i);
return;
}
throw new IllegalArgumentException("AppBarLayout is always vertical and does not support horizontal orientation");
}
/* access modifiers changed from: protected */
public void onAttachedToWindow() {
super.onAttachedToWindow();
MaterialShapeUtils.setParentAbsoluteElevation(this);
}
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) {
int i = 0;
int i2 = (z ? 1 : 2) | (z2 ? 4 : 0);
if (z3) {
i = 8;
}
this.pendingAction = i2 | i;
requestLayout();
}
/* access modifiers changed from: protected */
public boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
return layoutParams instanceof LayoutParams;
}
/* access modifiers changed from: protected */
public LayoutParams generateDefaultLayoutParams() {
return new LayoutParams(-1, -2);
}
public LayoutParams generateLayoutParams(AttributeSet attributeSet) {
return new LayoutParams(getContext(), attributeSet);
}
/* access modifiers changed from: protected */
public LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
if (Build.VERSION.SDK_INT >= 19 && (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);
}
/* access modifiers changed from: protected */
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
clearLiftOnScrollTargetView();
}
/* access modifiers changed from: package-private */
public boolean hasChildWithInterpolator() {
return this.haveChildWithInterpolator;
}
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);
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;
}
/* access modifiers changed from: package-private */
public boolean hasScrollableChildren() {
return getTotalScrollRange() != 0;
}
/* access modifiers changed from: package-private */
public int getUpNestedPreScrollRange() {
return getTotalScrollRange();
}
/* access modifiers changed from: package-private */
public 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);
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
int measuredHeight = childAt.getMeasuredHeight();
int i4 = layoutParams.scrollFlags;
if ((i4 & 5) == 5) {
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;
i = Math.min(i, measuredHeight - getTopInset());
i3 += i;
} else if (i3 > 0) {
break;
}
}
int max = Math.max(0, i3);
this.downPreScrollRange = max;
return max;
}
/* access modifiers changed from: package-private */
public 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);
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;
}
/* access modifiers changed from: package-private */
public 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;
}
/* access modifiers changed from: protected */
public 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);
}
/* access modifiers changed from: package-private */
public boolean setLiftedState(boolean z) {
if (this.lifted == z) {
return false;
}
this.lifted = z;
refreshDrawableState();
if (!this.liftOnScroll || !(getBackground() instanceof MaterialShapeDrawable)) {
return true;
}
startLiftOnScrollElevationOverlayAnimation((MaterialShapeDrawable) getBackground(), z);
return true;
}
private void startLiftOnScrollElevationOverlayAnimation(final MaterialShapeDrawable materialShapeDrawable, boolean z) {
float dimension = getResources().getDimension(R.dimen.design_appbar_elevation);
float f = z ? 0.0f : dimension;
if (!z) {
dimension = 0.0f;
}
ValueAnimator valueAnimator = this.elevationOverlayAnimator;
if (valueAnimator != null) {
valueAnimator.cancel();
}
ValueAnimator ofFloat = ValueAnimator.ofFloat(new float[]{f, dimension});
this.elevationOverlayAnimator = ofFloat;
ofFloat.setDuration((long) getResources().getInteger(R.integer.app_bar_elevation_anim_duration));
this.elevationOverlayAnimator.setInterpolator(AnimationUtils.LINEAR_INTERPOLATOR);
this.elevationOverlayAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator valueAnimator) {
materialShapeDrawable.setElevation(((Float) valueAnimator.getAnimatedValue()).floatValue());
}
});
this.elevationOverlayAnimator.start();
}
public void setLiftOnScroll(boolean z) {
this.liftOnScroll = z;
}
public boolean isLiftOnScroll() {
return this.liftOnScroll;
}
public void setLiftOnScrollTargetViewId(int i) {
this.liftOnScrollTargetViewId = i;
clearLiftOnScrollTargetView();
}
public int getLiftOnScrollTargetViewId() {
return this.liftOnScrollTargetViewId;
}
/* access modifiers changed from: package-private */
public 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 (View) 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) {
if (Build.VERSION.SDK_INT >= 21) {
ViewUtilsLollipop.setDefaultAppBarLayoutStateListAnimator(this, f);
}
}
/* access modifiers changed from: package-private */
public int getPendingAction() {
return this.pendingAction;
}
/* access modifiers changed from: package-private */
public void resetPendingAction() {
this.pendingAction = 0;
}
/* access modifiers changed from: package-private */
public 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);
if (childAt.getVisibility() == 8 || ViewCompat.getFitsSystemWindows(childAt)) {
return false;
}
return true;
}
/* access modifiers changed from: package-private */
public 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_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;
int scrollFlags = 1;
Interpolator scrollInterpolator;
@Retention(RetentionPolicy.SOURCE)
public @interface ScrollFlags {
}
public LayoutParams(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.AppBarLayout_Layout);
this.scrollFlags = obtainStyledAttributes.getInt(R.styleable.AppBarLayout_Layout_layout_scrollFlags, 0);
if (obtainStyledAttributes.hasValue(R.styleable.AppBarLayout_Layout_layout_scrollInterpolator)) {
this.scrollInterpolator = android.view.animation.AnimationUtils.loadInterpolator(context, obtainStyledAttributes.getResourceId(R.styleable.AppBarLayout_Layout_layout_scrollInterpolator, 0));
}
obtainStyledAttributes.recycle();
}
public LayoutParams(int i, int i2) {
super(i, i2);
}
public LayoutParams(int i, int i2, float f) {
super(i, i2, f);
}
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
super(layoutParams);
}
public LayoutParams(ViewGroup.MarginLayoutParams marginLayoutParams) {
super(marginLayoutParams);
}
public LayoutParams(LinearLayout.LayoutParams layoutParams) {
super(layoutParams);
}
public LayoutParams(LayoutParams layoutParams) {
super(layoutParams);
this.scrollFlags = layoutParams.scrollFlags;
this.scrollInterpolator = layoutParams.scrollInterpolator;
}
public void setScrollFlags(int i) {
this.scrollFlags = i;
}
public int getScrollFlags() {
return this.scrollFlags;
}
public void setScrollInterpolator(Interpolator interpolator) {
this.scrollInterpolator = interpolator;
}
public Interpolator getScrollInterpolator() {
return this.scrollInterpolator;
}
/* access modifiers changed from: package-private */
public boolean isCollapsible() {
int i = this.scrollFlags;
return (i & 1) == 1 && (i & 10) != 0;
}
}
public static class Behavior extends BaseBehavior<AppBarLayout> {
public static abstract class DragCallback extends BaseBehavior.BaseDragCallback<AppBarLayout> {
}
public /* bridge */ /* synthetic */ int getLeftAndRightOffset() {
return super.getLeftAndRightOffset();
}
public /* bridge */ /* synthetic */ int getTopAndBottomOffset() {
return super.getTopAndBottomOffset();
}
public /* bridge */ /* synthetic */ boolean isHorizontalOffsetEnabled() {
return super.isHorizontalOffsetEnabled();
}
public /* bridge */ /* synthetic */ boolean isVerticalOffsetEnabled() {
return super.isVerticalOffsetEnabled();
}
public /* bridge */ /* synthetic */ boolean onLayoutChild(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, int i) {
return super.onLayoutChild(coordinatorLayout, appBarLayout, i);
}
public /* bridge */ /* synthetic */ boolean onMeasureChild(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, int i, int i2, int i3, int i4) {
return super.onMeasureChild(coordinatorLayout, appBarLayout, i, i2, i3, i4);
}
public /* bridge */ /* synthetic */ void onNestedPreScroll(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, View view, int i, int i2, int[] iArr, int i3) {
super.onNestedPreScroll(coordinatorLayout, appBarLayout, view, i, i2, iArr, i3);
}
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, appBarLayout, view, i, i2, i3, i4, i5, iArr);
}
public /* bridge */ /* synthetic */ void onRestoreInstanceState(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, Parcelable parcelable) {
super.onRestoreInstanceState(coordinatorLayout, appBarLayout, parcelable);
}
public /* bridge */ /* synthetic */ Parcelable onSaveInstanceState(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout) {
return super.onSaveInstanceState(coordinatorLayout, appBarLayout);
}
public /* bridge */ /* synthetic */ boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, View view, View view2, int i, int i2) {
return super.onStartNestedScroll(coordinatorLayout, appBarLayout, view, view2, i, i2);
}
public /* bridge */ /* synthetic */ void onStopNestedScroll(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, View view, int i) {
super.onStopNestedScroll(coordinatorLayout, appBarLayout, view, i);
}
public /* bridge */ /* synthetic */ void setDragCallback(BaseBehavior.BaseDragCallback baseDragCallback) {
super.setDragCallback(baseDragCallback);
}
public /* bridge */ /* synthetic */ void setHorizontalOffsetEnabled(boolean z) {
super.setHorizontalOffsetEnabled(z);
}
public /* bridge */ /* synthetic */ boolean setLeftAndRightOffset(int i) {
return super.setLeftAndRightOffset(i);
}
public /* bridge */ /* synthetic */ boolean setTopAndBottomOffset(int i) {
return super.setTopAndBottomOffset(i);
}
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 INVALID_POSITION = -1;
private static final int MAX_OFFSET_ANIMATION_DURATION = 600;
private WeakReference<View> lastNestedScrollingChildRef;
private int lastStartedType;
private ValueAnimator offsetAnimator;
/* access modifiers changed from: private */
public int offsetDelta;
private int offsetToChildIndexOnLayout = -1;
private boolean offsetToChildIndexOnLayoutIsMinHeight;
private float offsetToChildIndexOnLayoutPerc;
private BaseDragCallback onDragCallback;
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;
}
public BaseBehavior() {
}
public BaseBehavior(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
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();
}
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();
i5 = i6;
i4 = t.getDownNestedPreScrollRange() + i6;
} else {
i5 = -t.getUpNestedPreScrollRange();
i4 = 0;
}
if (i5 != i4) {
iArr[1] = scroll(coordinatorLayout, t, i2, i5, i4);
}
}
if (t.isLiftOnScroll()) {
t.setLiftedState(t.shouldLift(view));
}
}
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);
}
}
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);
}
public void setDragCallback(BaseDragCallback baseDragCallback) {
this.onDragCallback = baseDragCallback;
}
private void animateOffsetTo(CoordinatorLayout coordinatorLayout, T t, int i, float f) {
int i2;
int abs = Math.abs(getTopBottomOffsetForScrollingSibling() - i);
float abs2 = Math.abs(f);
if (abs2 > 0.0f) {
i2 = Math.round((((float) abs) / abs2) * 1000.0f) * 3;
} else {
i2 = (int) (((((float) abs) / ((float) t.getHeight())) + 1.0f) * 150.0f);
}
animateOffsetWithDuration(coordinatorLayout, t, i, i2);
}
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()) {
this.offsetAnimator.cancel();
return;
}
return;
}
ValueAnimator valueAnimator2 = this.offsetAnimator;
if (valueAnimator2 == null) {
ValueAnimator valueAnimator3 = new ValueAnimator();
this.offsetAnimator = valueAnimator3;
valueAnimator3.setInterpolator(AnimationUtils.DECELERATE_INTERPOLATOR);
this.offsetAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator valueAnimator) {
BaseBehavior.this.setHeaderTopBottomOffset(coordinatorLayout, t, ((Integer) valueAnimator.getAnimatedValue()).intValue());
}
});
} else {
valueAnimator2.cancel();
}
this.offsetAnimator.setDuration((long) Math.min(i2, MAX_OFFSET_ANIMATION_DURATION));
this.offsetAnimator.setIntValues(new int[]{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 topBottomOffsetForScrollingSibling = getTopBottomOffsetForScrollingSibling();
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 == t.getChildCount() - 1) {
i2 += 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;
}
if (topBottomOffsetForScrollingSibling < (i2 + i) / 2) {
i = i2;
}
animateOffsetTo(coordinatorLayout, t, MathUtils.clamp(i, -t.getTotalScrollRange(), 0), 0.0f);
}
}
}
public boolean onMeasureChild(CoordinatorLayout coordinatorLayout, T t, int i, int i2, int i3, int i4) {
if (((CoordinatorLayout.LayoutParams) t.getLayoutParams()).height != -2) {
return super.onMeasureChild(coordinatorLayout, t, i, i2, i3, i4);
}
coordinatorLayout.onMeasureChild(t, i, i2, View.MeasureSpec.makeMeasureSpec(0, 0), i4);
return true;
}
public boolean onLayoutChild(CoordinatorLayout coordinatorLayout, T t, int i) {
int i2;
boolean onLayoutChild = super.onLayoutChild(coordinatorLayout, t, i);
int pendingAction = t.getPendingAction();
int i3 = this.offsetToChildIndexOnLayout;
if (i3 >= 0 && (pendingAction & 8) == 0) {
View childAt = t.getChildAt(i3);
int i4 = -childAt.getBottom();
if (this.offsetToChildIndexOnLayoutIsMinHeight) {
i2 = ViewCompat.getMinimumHeight(childAt) + t.getTopInset();
} else {
i2 = Math.round(((float) childAt.getHeight()) * this.offsetToChildIndexOnLayoutPerc);
}
setHeaderTopBottomOffset(coordinatorLayout, t, i4 + i2);
} else if (pendingAction != 0) {
boolean z = (pendingAction & 4) != 0;
if ((pendingAction & 2) != 0) {
int i5 = -t.getUpNestedPreScrollRange();
if (z) {
animateOffsetTo(coordinatorLayout, t, i5, 0.0f);
} else {
setHeaderTopBottomOffset(coordinatorLayout, t, i5);
}
} else if ((pendingAction & 1) != 0) {
if (z) {
animateOffsetTo(coordinatorLayout, t, 0, 0.0f);
} else {
setHeaderTopBottomOffset(coordinatorLayout, t, 0);
}
}
}
t.resetPendingAction();
this.offsetToChildIndexOnLayout = -1;
setTopAndBottomOffset(MathUtils.clamp(getTopAndBottomOffset(), -t.getTotalScrollRange(), 0));
updateAppBarLayoutDrawableState(coordinatorLayout, t, getTopAndBottomOffset(), 0, true);
t.onOffsetChanged(getTopAndBottomOffset());
return onLayoutChild;
}
/* access modifiers changed from: package-private */
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 = (View) weakReference.get();
if (view == null || !view.isShown() || view.canScrollVertically(-1)) {
return false;
}
return true;
}
/* access modifiers changed from: package-private */
public void onFlingFinished(CoordinatorLayout coordinatorLayout, T t) {
snapToChildIfNeeded(coordinatorLayout, t);
if (t.isLiftOnScroll()) {
t.setLiftedState(t.shouldLift(findFirstScrollingChild(coordinatorLayout)));
}
}
/* access modifiers changed from: package-private */
public int getMaxDragOffset(T t) {
return -t.getDownNestedScrollRange();
}
/* access modifiers changed from: package-private */
public int getScrollRangeForDragFling(T t) {
return t.getTotalScrollRange();
}
/* access modifiers changed from: package-private */
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);
i4 = topBottomOffsetForScrollingSibling - clamp;
this.offsetDelta = clamp - interpolateOffset;
if (!topAndBottomOffset && t.hasChildWithInterpolator()) {
coordinatorLayout.dispatchDependentViewsChanged(t);
}
t.onOffsetChanged(getTopAndBottomOffset());
updateAppBarLayoutDrawableState(coordinatorLayout, t, clamp, clamp < topBottomOffsetForScrollingSibling ? -1 : 1, false);
}
}
return i4;
}
/* access modifiers changed from: package-private */
public 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 = 0 + 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 = (float) i2;
return Integer.signum(i) * (childAt.getTop() + Math.round(f * scrollInterpolator.getInterpolation(((float) (abs - childAt.getTop())) / f)));
}
}
}
return i;
}
private void updateAppBarLayoutDrawableState(CoordinatorLayout coordinatorLayout, T t, int i, int i2, boolean z) {
View appBarChildOnOffset = getAppBarChildOnOffset(t, i);
if (appBarChildOnOffset != null) {
int scrollFlags = ((LayoutParams) appBarChildOnOffset.getLayoutParams()).getScrollFlags();
boolean z2 = false;
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))) {
t.jumpDrawablesToCurrentState();
}
}
}
private boolean shouldJumpElevationState(CoordinatorLayout coordinatorLayout, T t) {
List<View> dependents = coordinatorLayout.getDependents(t);
int size = dependents.size();
int i = 0;
while (i < size) {
CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) dependents.get(i).getLayoutParams()).getBehavior();
if (!(behavior instanceof ScrollingViewBehavior)) {
i++;
} else if (((ScrollingViewBehavior) behavior).getOverlayTop() != 0) {
return true;
} else {
return false;
}
}
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 ListView) || (childAt instanceof ScrollView)) {
return childAt;
}
}
return null;
}
/* access modifiers changed from: package-private */
public int getTopBottomOffsetForScrollingSibling() {
return getTopAndBottomOffset() + this.offsetDelta;
}
public Parcelable onSaveInstanceState(CoordinatorLayout coordinatorLayout, T t) {
Parcelable onSaveInstanceState = super.onSaveInstanceState(coordinatorLayout, t);
int topAndBottomOffset = getTopAndBottomOffset();
int childCount = t.getChildCount();
boolean z = false;
int i = 0;
while (i < childCount) {
View childAt = t.getChildAt(i);
int bottom = childAt.getBottom() + topAndBottomOffset;
if (childAt.getTop() + topAndBottomOffset > 0 || bottom < 0) {
i++;
} else {
SavedState savedState = new SavedState(onSaveInstanceState);
savedState.firstVisibleChildIndex = i;
if (bottom == ViewCompat.getMinimumHeight(childAt) + t.getTopInset()) {
z = true;
}
savedState.firstVisibleChildAtMinimumHeight = z;
savedState.firstVisibleChildPercentageShown = ((float) bottom) / ((float) childAt.getHeight());
return savedState;
}
}
return onSaveInstanceState;
}
public void onRestoreInstanceState(CoordinatorLayout coordinatorLayout, T t, Parcelable parcelable) {
if (parcelable instanceof SavedState) {
SavedState savedState = (SavedState) parcelable;
super.onRestoreInstanceState(coordinatorLayout, t, savedState.getSuperState());
this.offsetToChildIndexOnLayout = savedState.firstVisibleChildIndex;
this.offsetToChildIndexOnLayoutPerc = savedState.firstVisibleChildPercentageShown;
this.offsetToChildIndexOnLayoutIsMinHeight = savedState.firstVisibleChildAtMinimumHeight;
return;
}
super.onRestoreInstanceState(coordinatorLayout, t, parcelable);
this.offsetToChildIndexOnLayout = -1;
}
protected static class SavedState extends AbsSavedState {
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.ClassLoaderCreator<SavedState>() {
public SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) {
return new SavedState(parcel, classLoader);
}
public SavedState createFromParcel(Parcel parcel) {
return new SavedState(parcel, (ClassLoader) null);
}
public SavedState[] newArray(int i) {
return new SavedState[i];
}
};
boolean firstVisibleChildAtMinimumHeight;
int firstVisibleChildIndex;
float firstVisibleChildPercentageShown;
public SavedState(Parcel parcel, ClassLoader classLoader) {
super(parcel, classLoader);
this.firstVisibleChildIndex = parcel.readInt();
this.firstVisibleChildPercentageShown = parcel.readFloat();
this.firstVisibleChildAtMinimumHeight = parcel.readByte() != 0;
}
public SavedState(Parcelable parcelable) {
super(parcelable);
}
public void writeToParcel(Parcel parcel, int i) {
super.writeToParcel(parcel, i);
parcel.writeInt(this.firstVisibleChildIndex);
parcel.writeFloat(this.firstVisibleChildPercentageShown);
parcel.writeByte(this.firstVisibleChildAtMinimumHeight ? (byte) 1 : 0);
}
}
}
public static class ScrollingViewBehavior extends HeaderScrollingViewBehavior {
public /* bridge */ /* synthetic */ int getLeftAndRightOffset() {
return super.getLeftAndRightOffset();
}
public /* bridge */ /* synthetic */ int getTopAndBottomOffset() {
return super.getTopAndBottomOffset();
}
public /* bridge */ /* synthetic */ boolean isHorizontalOffsetEnabled() {
return super.isHorizontalOffsetEnabled();
}
public /* bridge */ /* synthetic */ boolean isVerticalOffsetEnabled() {
return super.isVerticalOffsetEnabled();
}
public /* bridge */ /* synthetic */ boolean onLayoutChild(CoordinatorLayout coordinatorLayout, View view, int i) {
return super.onLayoutChild(coordinatorLayout, view, i);
}
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);
}
public /* bridge */ /* synthetic */ void setHorizontalOffsetEnabled(boolean z) {
super.setHorizontalOffsetEnabled(z);
}
public /* bridge */ /* synthetic */ boolean setLeftAndRightOffset(int i) {
return super.setLeftAndRightOffset(i);
}
public /* bridge */ /* synthetic */ boolean setTopAndBottomOffset(int i) {
return super.setTopAndBottomOffset(i);
}
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();
}
public boolean layoutDependsOn(CoordinatorLayout coordinatorLayout, View view, View view2) {
return view2 instanceof AppBarLayout;
}
public boolean onDependentViewChanged(CoordinatorLayout coordinatorLayout, View view, View view2) {
offsetChildAsNeeded(view, view2);
updateLiftedStateIfNeeded(view, view2);
return false;
}
public boolean onRequestChildRectangleOnScreen(CoordinatorLayout coordinatorLayout, View view, Rect rect, boolean z) {
AppBarLayout findFirstDependency = findFirstDependency((List) coordinatorLayout.getDependencies(view));
if (findFirstDependency != null) {
rect.offset(view.getLeft(), view.getTop());
Rect rect2 = this.tempRect1;
rect2.set(0, 0, coordinatorLayout.getWidth(), coordinatorLayout.getHeight());
if (!rect2.contains(rect)) {
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));
}
}
/* access modifiers changed from: package-private */
public 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 (((float) appBarLayoutOffset) / ((float) 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;
}
/* access modifiers changed from: package-private */
public 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;
}
/* access modifiers changed from: package-private */
public 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));
}
}
}
}
}
Download file