1993 lines
85 KiB
Java
1993 lines
85 KiB
Java
package androidx.coordinatorlayout.widget;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.Resources;
|
|
import android.content.res.TypedArray;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.Paint;
|
|
import android.graphics.Rect;
|
|
import android.graphics.Region;
|
|
import android.graphics.drawable.ColorDrawable;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.os.Build;
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import android.os.SystemClock;
|
|
import android.text.TextUtils;
|
|
import android.util.AttributeSet;
|
|
import android.util.Log;
|
|
import android.util.SparseArray;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewParent;
|
|
import android.view.ViewTreeObserver;
|
|
import androidx.annotation.AttrRes;
|
|
import androidx.annotation.ColorInt;
|
|
import androidx.annotation.DrawableRes;
|
|
import androidx.annotation.FloatRange;
|
|
import androidx.annotation.IdRes;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.annotation.VisibleForTesting;
|
|
import androidx.coordinatorlayout.R;
|
|
import androidx.core.content.ContextCompat;
|
|
import androidx.core.graphics.drawable.DrawableCompat;
|
|
import androidx.core.util.ObjectsCompat;
|
|
import androidx.core.util.Pools;
|
|
import androidx.core.view.GravityCompat;
|
|
import androidx.core.view.NestedScrollingParent2;
|
|
import androidx.core.view.NestedScrollingParent3;
|
|
import androidx.core.view.NestedScrollingParentHelper;
|
|
import androidx.core.view.OnApplyWindowInsetsListener;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.core.view.WindowInsetsCompat;
|
|
import androidx.customview.view.AbsSavedState;
|
|
import c.d.b.a.a;
|
|
import java.lang.annotation.Retention;
|
|
import java.lang.annotation.RetentionPolicy;
|
|
import java.lang.reflect.Constructor;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
public class CoordinatorLayout extends ViewGroup implements NestedScrollingParent2, NestedScrollingParent3 {
|
|
public static final Class<?>[] CONSTRUCTOR_PARAMS = {Context.class, AttributeSet.class};
|
|
public static final int EVENT_NESTED_SCROLL = 1;
|
|
public static final int EVENT_PRE_DRAW = 0;
|
|
public static final int EVENT_VIEW_REMOVED = 2;
|
|
public static final String TAG = "CoordinatorLayout";
|
|
public static final Comparator<View> TOP_SORTED_CHILDREN_COMPARATOR = new ViewElevationComparator();
|
|
private static final int TYPE_ON_INTERCEPT = 0;
|
|
private static final int TYPE_ON_TOUCH = 1;
|
|
public static final String WIDGET_PACKAGE_NAME;
|
|
public static final ThreadLocal<Map<String, Constructor<Behavior>>> sConstructors = new ThreadLocal<>();
|
|
private static final Pools.Pool<Rect> sRectPool = new Pools.SynchronizedPool(12);
|
|
private OnApplyWindowInsetsListener mApplyWindowInsetsListener;
|
|
private final int[] mBehaviorConsumed;
|
|
private View mBehaviorTouchView;
|
|
private final DirectedAcyclicGraph<View> mChildDag;
|
|
private final List<View> mDependencySortedChildren;
|
|
private boolean mDisallowInterceptReset;
|
|
private boolean mDrawStatusBarBackground;
|
|
private boolean mIsAttachedToWindow;
|
|
private int[] mKeylines;
|
|
private WindowInsetsCompat mLastInsets;
|
|
private boolean mNeedsPreDrawListener;
|
|
private final NestedScrollingParentHelper mNestedScrollingParentHelper;
|
|
private View mNestedScrollingTarget;
|
|
private final int[] mNestedScrollingV2ConsumedCompat;
|
|
public ViewGroup.OnHierarchyChangeListener mOnHierarchyChangeListener;
|
|
private OnPreDrawListener mOnPreDrawListener;
|
|
private Paint mScrimPaint;
|
|
private Drawable mStatusBarBackground;
|
|
private final List<View> mTempDependenciesList;
|
|
private final List<View> mTempList1;
|
|
|
|
/* renamed from: androidx.coordinatorlayout.widget.CoordinatorLayout$1 reason: invalid class name */
|
|
public class AnonymousClass1 implements OnApplyWindowInsetsListener {
|
|
public AnonymousClass1() {
|
|
}
|
|
|
|
@Override // androidx.core.view.OnApplyWindowInsetsListener
|
|
public WindowInsetsCompat onApplyWindowInsets(View view, WindowInsetsCompat windowInsetsCompat) {
|
|
return CoordinatorLayout.this.setWindowInsets(windowInsetsCompat);
|
|
}
|
|
}
|
|
|
|
public interface AttachedBehavior {
|
|
@NonNull
|
|
Behavior getBehavior();
|
|
}
|
|
|
|
public static abstract class Behavior<V extends View> {
|
|
public Behavior() {
|
|
}
|
|
|
|
public Behavior(Context context, AttributeSet attributeSet) {
|
|
}
|
|
|
|
@Nullable
|
|
public static Object getTag(@NonNull View view) {
|
|
return ((LayoutParams) view.getLayoutParams()).mBehaviorTag;
|
|
}
|
|
|
|
public static void setTag(@NonNull View view, @Nullable Object obj) {
|
|
((LayoutParams) view.getLayoutParams()).mBehaviorTag = obj;
|
|
}
|
|
|
|
public boolean blocksInteractionBelow(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v) {
|
|
return getScrimOpacity(coordinatorLayout, v) > 0.0f;
|
|
}
|
|
|
|
public boolean getInsetDodgeRect(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull Rect rect) {
|
|
return false;
|
|
}
|
|
|
|
@ColorInt
|
|
public int getScrimColor(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v) {
|
|
return -16777216;
|
|
}
|
|
|
|
@FloatRange(from = 0.0d, to = 1.0d)
|
|
public float getScrimOpacity(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v) {
|
|
return 0.0f;
|
|
}
|
|
|
|
public boolean layoutDependsOn(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull View view) {
|
|
return false;
|
|
}
|
|
|
|
@NonNull
|
|
public WindowInsetsCompat onApplyWindowInsets(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull WindowInsetsCompat windowInsetsCompat) {
|
|
return windowInsetsCompat;
|
|
}
|
|
|
|
public void onAttachedToLayoutParams(@NonNull LayoutParams layoutParams) {
|
|
}
|
|
|
|
public boolean onDependentViewChanged(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull View view) {
|
|
return false;
|
|
}
|
|
|
|
public void onDependentViewRemoved(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull View view) {
|
|
}
|
|
|
|
public void onDetachedFromLayoutParams() {
|
|
}
|
|
|
|
public boolean onInterceptTouchEvent(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull MotionEvent motionEvent) {
|
|
return false;
|
|
}
|
|
|
|
public boolean onLayoutChild(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, int i) {
|
|
return false;
|
|
}
|
|
|
|
public boolean onMeasureChild(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, int i, int i2, int i3, int i4) {
|
|
return false;
|
|
}
|
|
|
|
public boolean onNestedFling(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull View view, float f, float f2, boolean z2) {
|
|
return false;
|
|
}
|
|
|
|
public boolean onNestedPreFling(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull View view, float f, float f2) {
|
|
return false;
|
|
}
|
|
|
|
@Deprecated
|
|
public void onNestedPreScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull View view, int i, int i2, @NonNull int[] iArr) {
|
|
}
|
|
|
|
public void onNestedPreScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull View view, int i, int i2, @NonNull int[] iArr, int i3) {
|
|
if (i3 == 0) {
|
|
onNestedPreScroll(coordinatorLayout, v, view, i, i2, iArr);
|
|
}
|
|
}
|
|
|
|
@Deprecated
|
|
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull View view, int i, int i2, int i3, int i4) {
|
|
}
|
|
|
|
@Deprecated
|
|
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull View view, int i, int i2, int i3, int i4, int i5) {
|
|
if (i5 == 0) {
|
|
onNestedScroll(coordinatorLayout, v, view, i, i2, i3, i4);
|
|
}
|
|
}
|
|
|
|
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull View view, int i, int i2, int i3, int i4, int i5, @NonNull int[] iArr) {
|
|
iArr[0] = iArr[0] + i3;
|
|
iArr[1] = iArr[1] + i4;
|
|
onNestedScroll(coordinatorLayout, v, view, i, i2, i3, i4, i5);
|
|
}
|
|
|
|
@Deprecated
|
|
public void onNestedScrollAccepted(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull View view, @NonNull View view2, int i) {
|
|
}
|
|
|
|
public void onNestedScrollAccepted(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull View view, @NonNull View view2, int i, int i2) {
|
|
if (i2 == 0) {
|
|
onNestedScrollAccepted(coordinatorLayout, v, view, view2, i);
|
|
}
|
|
}
|
|
|
|
public boolean onRequestChildRectangleOnScreen(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull Rect rect, boolean z2) {
|
|
return false;
|
|
}
|
|
|
|
public void onRestoreInstanceState(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull Parcelable parcelable) {
|
|
}
|
|
|
|
@Nullable
|
|
public Parcelable onSaveInstanceState(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v) {
|
|
return View.BaseSavedState.EMPTY_STATE;
|
|
}
|
|
|
|
@Deprecated
|
|
public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull View view, @NonNull View view2, int i) {
|
|
return false;
|
|
}
|
|
|
|
public boolean onStartNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull View view, @NonNull View view2, int i, int i2) {
|
|
if (i2 == 0) {
|
|
return onStartNestedScroll(coordinatorLayout, v, view, view2, i);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Deprecated
|
|
public void onStopNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull View view) {
|
|
}
|
|
|
|
public void onStopNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull View view, int i) {
|
|
if (i == 0) {
|
|
onStopNestedScroll(coordinatorLayout, v, view);
|
|
}
|
|
}
|
|
|
|
public boolean onTouchEvent(@NonNull CoordinatorLayout coordinatorLayout, @NonNull V v, @NonNull MotionEvent motionEvent) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
@Deprecated
|
|
@Retention(RetentionPolicy.RUNTIME)
|
|
public @interface DefaultBehavior {
|
|
Class<? extends Behavior> value();
|
|
}
|
|
|
|
@Retention(RetentionPolicy.SOURCE)
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
public @interface DispatchChangeEvent {
|
|
}
|
|
|
|
public class HierarchyChangeListener implements ViewGroup.OnHierarchyChangeListener {
|
|
public HierarchyChangeListener() {
|
|
}
|
|
|
|
@Override // android.view.ViewGroup.OnHierarchyChangeListener
|
|
public void onChildViewAdded(View view, View view2) {
|
|
ViewGroup.OnHierarchyChangeListener onHierarchyChangeListener = CoordinatorLayout.this.mOnHierarchyChangeListener;
|
|
if (onHierarchyChangeListener != null) {
|
|
onHierarchyChangeListener.onChildViewAdded(view, view2);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup.OnHierarchyChangeListener
|
|
public void onChildViewRemoved(View view, View view2) {
|
|
CoordinatorLayout.this.onChildViewsChanged(2);
|
|
ViewGroup.OnHierarchyChangeListener onHierarchyChangeListener = CoordinatorLayout.this.mOnHierarchyChangeListener;
|
|
if (onHierarchyChangeListener != null) {
|
|
onHierarchyChangeListener.onChildViewRemoved(view, view2);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static class LayoutParams extends ViewGroup.MarginLayoutParams {
|
|
public int anchorGravity = 0;
|
|
public int dodgeInsetEdges = 0;
|
|
public int gravity = 0;
|
|
public int insetEdge = 0;
|
|
public int keyline = -1;
|
|
public View mAnchorDirectChild;
|
|
public int mAnchorId = -1;
|
|
public View mAnchorView;
|
|
public Behavior mBehavior;
|
|
public boolean mBehaviorResolved = false;
|
|
public Object mBehaviorTag;
|
|
private boolean mDidAcceptNestedScrollNonTouch;
|
|
private boolean mDidAcceptNestedScrollTouch;
|
|
private boolean mDidBlockInteraction;
|
|
private boolean mDidChangeAfterNestedScroll;
|
|
public int mInsetOffsetX;
|
|
public int mInsetOffsetY;
|
|
public final Rect mLastChildRect = new Rect();
|
|
|
|
public LayoutParams(int i, int i2) {
|
|
super(i, i2);
|
|
}
|
|
|
|
public LayoutParams(@NonNull Context context, @Nullable AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.styleable.CoordinatorLayout_Layout);
|
|
this.gravity = obtainStyledAttributes.getInteger(R.styleable.CoordinatorLayout_Layout_android_layout_gravity, 0);
|
|
this.mAnchorId = obtainStyledAttributes.getResourceId(R.styleable.CoordinatorLayout_Layout_layout_anchor, -1);
|
|
this.anchorGravity = obtainStyledAttributes.getInteger(R.styleable.CoordinatorLayout_Layout_layout_anchorGravity, 0);
|
|
this.keyline = obtainStyledAttributes.getInteger(R.styleable.CoordinatorLayout_Layout_layout_keyline, -1);
|
|
this.insetEdge = obtainStyledAttributes.getInt(R.styleable.CoordinatorLayout_Layout_layout_insetEdge, 0);
|
|
this.dodgeInsetEdges = obtainStyledAttributes.getInt(R.styleable.CoordinatorLayout_Layout_layout_dodgeInsetEdges, 0);
|
|
int i = R.styleable.CoordinatorLayout_Layout_layout_behavior;
|
|
boolean hasValue = obtainStyledAttributes.hasValue(i);
|
|
this.mBehaviorResolved = hasValue;
|
|
if (hasValue) {
|
|
this.mBehavior = CoordinatorLayout.parseBehavior(context, attributeSet, obtainStyledAttributes.getString(i));
|
|
}
|
|
obtainStyledAttributes.recycle();
|
|
Behavior behavior = this.mBehavior;
|
|
if (behavior != null) {
|
|
behavior.onAttachedToLayoutParams(this);
|
|
}
|
|
}
|
|
|
|
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
|
|
super(layoutParams);
|
|
}
|
|
|
|
public LayoutParams(ViewGroup.MarginLayoutParams marginLayoutParams) {
|
|
super(marginLayoutParams);
|
|
}
|
|
|
|
public LayoutParams(LayoutParams layoutParams) {
|
|
super((ViewGroup.MarginLayoutParams) layoutParams);
|
|
}
|
|
|
|
private void resolveAnchorView(View view, CoordinatorLayout coordinatorLayout) {
|
|
View findViewById = coordinatorLayout.findViewById(this.mAnchorId);
|
|
this.mAnchorView = findViewById;
|
|
if (findViewById != null) {
|
|
if (findViewById != coordinatorLayout) {
|
|
ViewParent parent = findViewById.getParent();
|
|
while (parent != coordinatorLayout && parent != null) {
|
|
if (parent != view) {
|
|
if (parent instanceof View) {
|
|
findViewById = (View) parent;
|
|
}
|
|
parent = parent.getParent();
|
|
} else if (coordinatorLayout.isInEditMode()) {
|
|
this.mAnchorDirectChild = null;
|
|
this.mAnchorView = null;
|
|
return;
|
|
} else {
|
|
throw new IllegalStateException("Anchor must not be a descendant of the anchored view");
|
|
}
|
|
}
|
|
this.mAnchorDirectChild = findViewById;
|
|
} else if (coordinatorLayout.isInEditMode()) {
|
|
this.mAnchorDirectChild = null;
|
|
this.mAnchorView = null;
|
|
} else {
|
|
throw new IllegalStateException("View can not be anchored to the the parent CoordinatorLayout");
|
|
}
|
|
} else if (coordinatorLayout.isInEditMode()) {
|
|
this.mAnchorDirectChild = null;
|
|
this.mAnchorView = null;
|
|
} else {
|
|
StringBuilder L = a.L("Could not find CoordinatorLayout descendant view with id ");
|
|
L.append(coordinatorLayout.getResources().getResourceName(this.mAnchorId));
|
|
L.append(" to anchor view ");
|
|
L.append(view);
|
|
throw new IllegalStateException(L.toString());
|
|
}
|
|
}
|
|
|
|
private boolean shouldDodge(View view, int i) {
|
|
int absoluteGravity = GravityCompat.getAbsoluteGravity(((LayoutParams) view.getLayoutParams()).insetEdge, i);
|
|
return absoluteGravity != 0 && (GravityCompat.getAbsoluteGravity(this.dodgeInsetEdges, i) & absoluteGravity) == absoluteGravity;
|
|
}
|
|
|
|
private boolean verifyAnchorView(View view, CoordinatorLayout coordinatorLayout) {
|
|
if (this.mAnchorView.getId() != this.mAnchorId) {
|
|
return false;
|
|
}
|
|
View view2 = this.mAnchorView;
|
|
for (ViewParent parent = view2.getParent(); parent != coordinatorLayout; parent = parent.getParent()) {
|
|
if (parent == null || parent == view) {
|
|
this.mAnchorDirectChild = null;
|
|
this.mAnchorView = null;
|
|
return false;
|
|
}
|
|
if (parent instanceof View) {
|
|
view2 = (View) parent;
|
|
}
|
|
}
|
|
this.mAnchorDirectChild = view2;
|
|
return true;
|
|
}
|
|
|
|
public boolean checkAnchorChanged() {
|
|
return this.mAnchorView == null && this.mAnchorId != -1;
|
|
}
|
|
|
|
public boolean dependsOn(CoordinatorLayout coordinatorLayout, View view, View view2) {
|
|
Behavior behavior;
|
|
return view2 == this.mAnchorDirectChild || shouldDodge(view2, ViewCompat.getLayoutDirection(coordinatorLayout)) || ((behavior = this.mBehavior) != null && behavior.layoutDependsOn(coordinatorLayout, view, view2));
|
|
}
|
|
|
|
public boolean didBlockInteraction() {
|
|
if (this.mBehavior == null) {
|
|
this.mDidBlockInteraction = false;
|
|
}
|
|
return this.mDidBlockInteraction;
|
|
}
|
|
|
|
public View findAnchorView(CoordinatorLayout coordinatorLayout, View view) {
|
|
if (this.mAnchorId == -1) {
|
|
this.mAnchorDirectChild = null;
|
|
this.mAnchorView = null;
|
|
return null;
|
|
}
|
|
if (this.mAnchorView == null || !verifyAnchorView(view, coordinatorLayout)) {
|
|
resolveAnchorView(view, coordinatorLayout);
|
|
}
|
|
return this.mAnchorView;
|
|
}
|
|
|
|
@IdRes
|
|
public int getAnchorId() {
|
|
return this.mAnchorId;
|
|
}
|
|
|
|
@Nullable
|
|
public Behavior getBehavior() {
|
|
return this.mBehavior;
|
|
}
|
|
|
|
public boolean getChangedAfterNestedScroll() {
|
|
return this.mDidChangeAfterNestedScroll;
|
|
}
|
|
|
|
public Rect getLastChildRect() {
|
|
return this.mLastChildRect;
|
|
}
|
|
|
|
public void invalidateAnchor() {
|
|
this.mAnchorDirectChild = null;
|
|
this.mAnchorView = null;
|
|
}
|
|
|
|
public boolean isBlockingInteractionBelow(CoordinatorLayout coordinatorLayout, View view) {
|
|
boolean z2 = this.mDidBlockInteraction;
|
|
if (z2) {
|
|
return true;
|
|
}
|
|
Behavior behavior = this.mBehavior;
|
|
boolean blocksInteractionBelow = (behavior != null ? behavior.blocksInteractionBelow(coordinatorLayout, view) : false) | z2;
|
|
this.mDidBlockInteraction = blocksInteractionBelow;
|
|
return blocksInteractionBelow;
|
|
}
|
|
|
|
public boolean isNestedScrollAccepted(int i) {
|
|
if (i == 0) {
|
|
return this.mDidAcceptNestedScrollTouch;
|
|
}
|
|
if (i != 1) {
|
|
return false;
|
|
}
|
|
return this.mDidAcceptNestedScrollNonTouch;
|
|
}
|
|
|
|
public void resetChangedAfterNestedScroll() {
|
|
this.mDidChangeAfterNestedScroll = false;
|
|
}
|
|
|
|
public void resetNestedScroll(int i) {
|
|
setNestedScrollAccepted(i, false);
|
|
}
|
|
|
|
public void resetTouchBehaviorTracking() {
|
|
this.mDidBlockInteraction = false;
|
|
}
|
|
|
|
public void setAnchorId(@IdRes int i) {
|
|
invalidateAnchor();
|
|
this.mAnchorId = i;
|
|
}
|
|
|
|
public void setBehavior(@Nullable Behavior behavior) {
|
|
Behavior behavior2 = this.mBehavior;
|
|
if (behavior2 != behavior) {
|
|
if (behavior2 != null) {
|
|
behavior2.onDetachedFromLayoutParams();
|
|
}
|
|
this.mBehavior = behavior;
|
|
this.mBehaviorTag = null;
|
|
this.mBehaviorResolved = true;
|
|
if (behavior != null) {
|
|
behavior.onAttachedToLayoutParams(this);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void setChangedAfterNestedScroll(boolean z2) {
|
|
this.mDidChangeAfterNestedScroll = z2;
|
|
}
|
|
|
|
public void setLastChildRect(Rect rect) {
|
|
this.mLastChildRect.set(rect);
|
|
}
|
|
|
|
public void setNestedScrollAccepted(int i, boolean z2) {
|
|
if (i == 0) {
|
|
this.mDidAcceptNestedScrollTouch = z2;
|
|
} else if (i == 1) {
|
|
this.mDidAcceptNestedScrollNonTouch = z2;
|
|
}
|
|
}
|
|
}
|
|
|
|
public class OnPreDrawListener implements ViewTreeObserver.OnPreDrawListener {
|
|
public OnPreDrawListener() {
|
|
}
|
|
|
|
@Override // android.view.ViewTreeObserver.OnPreDrawListener
|
|
public boolean onPreDraw() {
|
|
CoordinatorLayout.this.onChildViewsChanged(0);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public static class SavedState extends AbsSavedState {
|
|
public static final Parcelable.Creator<SavedState> CREATOR = new AnonymousClass1();
|
|
public SparseArray<Parcelable> behaviorStates;
|
|
|
|
/* renamed from: androidx.coordinatorlayout.widget.CoordinatorLayout$SavedState$1 reason: invalid class name */
|
|
public static class AnonymousClass1 implements Parcelable.ClassLoaderCreator<SavedState> {
|
|
@Override // android.os.Parcelable.Creator
|
|
public SavedState createFromParcel(Parcel parcel) {
|
|
return new SavedState(parcel, null);
|
|
}
|
|
|
|
@Override // android.os.Parcelable.ClassLoaderCreator
|
|
public SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) {
|
|
return new SavedState(parcel, classLoader);
|
|
}
|
|
|
|
@Override // android.os.Parcelable.Creator
|
|
public SavedState[] newArray(int i) {
|
|
return new SavedState[i];
|
|
}
|
|
}
|
|
|
|
public SavedState(Parcel parcel, ClassLoader classLoader) {
|
|
super(parcel, classLoader);
|
|
int readInt = parcel.readInt();
|
|
int[] iArr = new int[readInt];
|
|
parcel.readIntArray(iArr);
|
|
Parcelable[] readParcelableArray = parcel.readParcelableArray(classLoader);
|
|
this.behaviorStates = new SparseArray<>(readInt);
|
|
for (int i = 0; i < readInt; i++) {
|
|
this.behaviorStates.append(iArr[i], readParcelableArray[i]);
|
|
}
|
|
}
|
|
|
|
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);
|
|
SparseArray<Parcelable> sparseArray = this.behaviorStates;
|
|
int size = sparseArray != null ? sparseArray.size() : 0;
|
|
parcel.writeInt(size);
|
|
int[] iArr = new int[size];
|
|
Parcelable[] parcelableArr = new Parcelable[size];
|
|
for (int i2 = 0; i2 < size; i2++) {
|
|
iArr[i2] = this.behaviorStates.keyAt(i2);
|
|
parcelableArr[i2] = this.behaviorStates.valueAt(i2);
|
|
}
|
|
parcel.writeIntArray(iArr);
|
|
parcel.writeParcelableArray(parcelableArr, i);
|
|
}
|
|
}
|
|
|
|
public static class ViewElevationComparator implements Comparator<View> {
|
|
public int compare(View view, View view2) {
|
|
float z2 = ViewCompat.getZ(view);
|
|
float z3 = ViewCompat.getZ(view2);
|
|
if (z2 > z3) {
|
|
return -1;
|
|
}
|
|
return z2 < z3 ? 1 : 0;
|
|
}
|
|
}
|
|
|
|
static {
|
|
Package r0 = CoordinatorLayout.class.getPackage();
|
|
WIDGET_PACKAGE_NAME = r0 != null ? r0.getName() : null;
|
|
}
|
|
|
|
public CoordinatorLayout(@NonNull Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
public CoordinatorLayout(@NonNull Context context, @Nullable AttributeSet attributeSet) {
|
|
this(context, attributeSet, R.attr.coordinatorLayoutStyle);
|
|
}
|
|
|
|
public CoordinatorLayout(@NonNull Context context, @Nullable AttributeSet attributeSet, @AttrRes int i) {
|
|
super(context, attributeSet, i);
|
|
this.mDependencySortedChildren = new ArrayList();
|
|
this.mChildDag = new DirectedAcyclicGraph<>();
|
|
this.mTempList1 = new ArrayList();
|
|
this.mTempDependenciesList = new ArrayList();
|
|
this.mBehaviorConsumed = new int[2];
|
|
this.mNestedScrollingV2ConsumedCompat = new int[2];
|
|
this.mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
|
|
TypedArray obtainStyledAttributes = i == 0 ? context.obtainStyledAttributes(attributeSet, R.styleable.CoordinatorLayout, 0, R.style.Widget_Support_CoordinatorLayout) : context.obtainStyledAttributes(attributeSet, R.styleable.CoordinatorLayout, i, 0);
|
|
if (Build.VERSION.SDK_INT >= 29) {
|
|
if (i == 0) {
|
|
saveAttributeDataForStyleable(context, R.styleable.CoordinatorLayout, attributeSet, obtainStyledAttributes, 0, R.style.Widget_Support_CoordinatorLayout);
|
|
} else {
|
|
saveAttributeDataForStyleable(context, R.styleable.CoordinatorLayout, attributeSet, obtainStyledAttributes, i, 0);
|
|
}
|
|
}
|
|
int resourceId = obtainStyledAttributes.getResourceId(R.styleable.CoordinatorLayout_keylines, 0);
|
|
if (resourceId != 0) {
|
|
Resources resources = context.getResources();
|
|
this.mKeylines = resources.getIntArray(resourceId);
|
|
float f = resources.getDisplayMetrics().density;
|
|
int length = this.mKeylines.length;
|
|
for (int i2 = 0; i2 < length; i2++) {
|
|
int[] iArr = this.mKeylines;
|
|
iArr[i2] = (int) (((float) iArr[i2]) * f);
|
|
}
|
|
}
|
|
this.mStatusBarBackground = obtainStyledAttributes.getDrawable(R.styleable.CoordinatorLayout_statusBarBackground);
|
|
obtainStyledAttributes.recycle();
|
|
setupForInsets();
|
|
super.setOnHierarchyChangeListener(new HierarchyChangeListener());
|
|
if (ViewCompat.getImportantForAccessibility(this) == 0) {
|
|
ViewCompat.setImportantForAccessibility(this, 1);
|
|
}
|
|
}
|
|
|
|
@NonNull
|
|
private static Rect acquireTempRect() {
|
|
Rect acquire = sRectPool.acquire();
|
|
return acquire == null ? new Rect() : acquire;
|
|
}
|
|
|
|
private static int clamp(int i, int i2, int i3) {
|
|
return i < i2 ? i2 : i > i3 ? i3 : i;
|
|
}
|
|
|
|
private void constrainChildRect(LayoutParams layoutParams, Rect rect, int i, int i2) {
|
|
int width = getWidth();
|
|
int height = getHeight();
|
|
int max = Math.max(getPaddingLeft() + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin, Math.min(rect.left, ((width - getPaddingRight()) - i) - ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin));
|
|
int max2 = Math.max(getPaddingTop() + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin, Math.min(rect.top, ((height - getPaddingBottom()) - i2) - ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin));
|
|
rect.set(max, max2, i + max, i2 + max2);
|
|
}
|
|
|
|
private WindowInsetsCompat dispatchApplyWindowInsetsToBehaviors(WindowInsetsCompat windowInsetsCompat) {
|
|
Behavior behavior;
|
|
if (windowInsetsCompat.isConsumed()) {
|
|
return windowInsetsCompat;
|
|
}
|
|
int childCount = getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
View childAt = getChildAt(i);
|
|
if (ViewCompat.getFitsSystemWindows(childAt) && (behavior = ((LayoutParams) childAt.getLayoutParams()).getBehavior()) != null) {
|
|
windowInsetsCompat = behavior.onApplyWindowInsets(this, childAt, windowInsetsCompat);
|
|
if (windowInsetsCompat.isConsumed()) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return windowInsetsCompat;
|
|
}
|
|
|
|
private void getDesiredAnchoredChildRectWithoutConstraints(View view, int i, Rect rect, Rect rect2, LayoutParams layoutParams, int i2, int i3) {
|
|
int absoluteGravity = GravityCompat.getAbsoluteGravity(resolveAnchoredChildGravity(layoutParams.gravity), i);
|
|
int absoluteGravity2 = GravityCompat.getAbsoluteGravity(resolveGravity(layoutParams.anchorGravity), i);
|
|
int i4 = absoluteGravity & 7;
|
|
int i5 = absoluteGravity & 112;
|
|
int i6 = absoluteGravity2 & 7;
|
|
int i7 = absoluteGravity2 & 112;
|
|
int width = i6 != 1 ? i6 != 5 ? rect.left : rect.right : rect.left + (rect.width() / 2);
|
|
int height = i7 != 16 ? i7 != 80 ? rect.top : rect.bottom : rect.top + (rect.height() / 2);
|
|
if (i4 == 1) {
|
|
width -= i2 / 2;
|
|
} else if (i4 != 5) {
|
|
width -= i2;
|
|
}
|
|
if (i5 == 16) {
|
|
height -= i3 / 2;
|
|
} else if (i5 != 80) {
|
|
height -= i3;
|
|
}
|
|
rect2.set(width, height, i2 + width, i3 + height);
|
|
}
|
|
|
|
private int getKeyline(int i) {
|
|
int[] iArr = this.mKeylines;
|
|
if (iArr == null) {
|
|
Log.e("CoordinatorLayout", "No keylines defined for " + this + " - attempted index lookup " + i);
|
|
return 0;
|
|
} else if (i >= 0 && i < iArr.length) {
|
|
return iArr[i];
|
|
} else {
|
|
Log.e("CoordinatorLayout", "Keyline index " + i + " out of range for " + this);
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
private void getTopSortedChildren(List<View> list) {
|
|
list.clear();
|
|
boolean isChildrenDrawingOrderEnabled = isChildrenDrawingOrderEnabled();
|
|
int childCount = getChildCount();
|
|
for (int i = childCount - 1; i >= 0; i--) {
|
|
list.add(getChildAt(isChildrenDrawingOrderEnabled ? getChildDrawingOrder(childCount, i) : i));
|
|
}
|
|
Comparator<View> comparator = TOP_SORTED_CHILDREN_COMPARATOR;
|
|
if (comparator != null) {
|
|
Collections.sort(list, comparator);
|
|
}
|
|
}
|
|
|
|
private boolean hasDependencies(View view) {
|
|
return this.mChildDag.hasOutgoingEdges(view);
|
|
}
|
|
|
|
private void layoutChild(View view, int i) {
|
|
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
|
Rect acquireTempRect = acquireTempRect();
|
|
acquireTempRect.set(getPaddingLeft() + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin, getPaddingTop() + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin, (getWidth() - getPaddingRight()) - ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin, (getHeight() - getPaddingBottom()) - ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin);
|
|
if (this.mLastInsets != null && ViewCompat.getFitsSystemWindows(this) && !ViewCompat.getFitsSystemWindows(view)) {
|
|
acquireTempRect.left = this.mLastInsets.getSystemWindowInsetLeft() + acquireTempRect.left;
|
|
acquireTempRect.top = this.mLastInsets.getSystemWindowInsetTop() + acquireTempRect.top;
|
|
acquireTempRect.right -= this.mLastInsets.getSystemWindowInsetRight();
|
|
acquireTempRect.bottom -= this.mLastInsets.getSystemWindowInsetBottom();
|
|
}
|
|
Rect acquireTempRect2 = acquireTempRect();
|
|
GravityCompat.apply(resolveGravity(layoutParams.gravity), view.getMeasuredWidth(), view.getMeasuredHeight(), acquireTempRect, acquireTempRect2, i);
|
|
view.layout(acquireTempRect2.left, acquireTempRect2.top, acquireTempRect2.right, acquireTempRect2.bottom);
|
|
releaseTempRect(acquireTempRect);
|
|
releaseTempRect(acquireTempRect2);
|
|
}
|
|
|
|
private void layoutChildWithAnchor(View view, View view2, int i) {
|
|
Rect acquireTempRect = acquireTempRect();
|
|
Rect acquireTempRect2 = acquireTempRect();
|
|
try {
|
|
getDescendantRect(view2, acquireTempRect);
|
|
getDesiredAnchoredChildRect(view, i, acquireTempRect, acquireTempRect2);
|
|
view.layout(acquireTempRect2.left, acquireTempRect2.top, acquireTempRect2.right, acquireTempRect2.bottom);
|
|
} finally {
|
|
releaseTempRect(acquireTempRect);
|
|
releaseTempRect(acquireTempRect2);
|
|
}
|
|
}
|
|
|
|
private void layoutChildWithKeyline(View view, int i, int i2) {
|
|
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
|
int absoluteGravity = GravityCompat.getAbsoluteGravity(resolveKeylineGravity(layoutParams.gravity), i2);
|
|
int i3 = absoluteGravity & 7;
|
|
int i4 = absoluteGravity & 112;
|
|
int width = getWidth();
|
|
int height = getHeight();
|
|
int measuredWidth = view.getMeasuredWidth();
|
|
int measuredHeight = view.getMeasuredHeight();
|
|
if (i2 == 1) {
|
|
i = width - i;
|
|
}
|
|
int keyline = getKeyline(i) - measuredWidth;
|
|
int i5 = 0;
|
|
if (i3 == 1) {
|
|
keyline += measuredWidth / 2;
|
|
} else if (i3 == 5) {
|
|
keyline += measuredWidth;
|
|
}
|
|
if (i4 == 16) {
|
|
i5 = 0 + (measuredHeight / 2);
|
|
} else if (i4 == 80) {
|
|
i5 = measuredHeight + 0;
|
|
}
|
|
int max = Math.max(getPaddingLeft() + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin, Math.min(keyline, ((width - getPaddingRight()) - measuredWidth) - ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin));
|
|
int max2 = Math.max(getPaddingTop() + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin, Math.min(i5, ((height - getPaddingBottom()) - measuredHeight) - ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin));
|
|
view.layout(max, max2, measuredWidth + max, measuredHeight + max2);
|
|
}
|
|
|
|
private void offsetChildByInset(View view, Rect rect, int i) {
|
|
boolean z2;
|
|
boolean z3;
|
|
int width;
|
|
int i2;
|
|
int i3;
|
|
int i4;
|
|
int height;
|
|
int i5;
|
|
int i6;
|
|
int i7;
|
|
if (ViewCompat.isLaidOut(view) && view.getWidth() > 0 && view.getHeight() > 0) {
|
|
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
|
Behavior behavior = layoutParams.getBehavior();
|
|
Rect acquireTempRect = acquireTempRect();
|
|
Rect acquireTempRect2 = acquireTempRect();
|
|
acquireTempRect2.set(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
|
|
if (behavior == null || !behavior.getInsetDodgeRect(this, view, acquireTempRect)) {
|
|
acquireTempRect.set(acquireTempRect2);
|
|
} else if (!acquireTempRect2.contains(acquireTempRect)) {
|
|
StringBuilder L = a.L("Rect should be within the child's bounds. Rect:");
|
|
L.append(acquireTempRect.toShortString());
|
|
L.append(" | Bounds:");
|
|
L.append(acquireTempRect2.toShortString());
|
|
throw new IllegalArgumentException(L.toString());
|
|
}
|
|
releaseTempRect(acquireTempRect2);
|
|
if (acquireTempRect.isEmpty()) {
|
|
releaseTempRect(acquireTempRect);
|
|
return;
|
|
}
|
|
int absoluteGravity = GravityCompat.getAbsoluteGravity(layoutParams.dodgeInsetEdges, i);
|
|
boolean z4 = true;
|
|
if ((absoluteGravity & 48) != 48 || (i6 = (acquireTempRect.top - ((ViewGroup.MarginLayoutParams) layoutParams).topMargin) - layoutParams.mInsetOffsetY) >= (i7 = rect.top)) {
|
|
z2 = false;
|
|
} else {
|
|
setInsetOffsetY(view, i7 - i6);
|
|
z2 = true;
|
|
}
|
|
if ((absoluteGravity & 80) == 80 && (height = ((getHeight() - acquireTempRect.bottom) - ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin) + layoutParams.mInsetOffsetY) < (i5 = rect.bottom)) {
|
|
setInsetOffsetY(view, height - i5);
|
|
z2 = true;
|
|
}
|
|
if (!z2) {
|
|
setInsetOffsetY(view, 0);
|
|
}
|
|
if ((absoluteGravity & 3) != 3 || (i3 = (acquireTempRect.left - ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin) - layoutParams.mInsetOffsetX) >= (i4 = rect.left)) {
|
|
z3 = false;
|
|
} else {
|
|
setInsetOffsetX(view, i4 - i3);
|
|
z3 = true;
|
|
}
|
|
if ((absoluteGravity & 5) != 5 || (width = ((getWidth() - acquireTempRect.right) - ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin) + layoutParams.mInsetOffsetX) >= (i2 = rect.right)) {
|
|
z4 = z3;
|
|
} else {
|
|
setInsetOffsetX(view, width - i2);
|
|
}
|
|
if (!z4) {
|
|
setInsetOffsetX(view, 0);
|
|
}
|
|
releaseTempRect(acquireTempRect);
|
|
}
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r0v9, resolved type: java.lang.Class<?> */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static Behavior parseBehavior(Context context, AttributeSet attributeSet, String str) {
|
|
if (TextUtils.isEmpty(str)) {
|
|
return null;
|
|
}
|
|
if (str.startsWith(".")) {
|
|
str = context.getPackageName() + str;
|
|
} else if (str.indexOf(46) < 0) {
|
|
String str2 = WIDGET_PACKAGE_NAME;
|
|
if (!TextUtils.isEmpty(str2)) {
|
|
str = str2 + '.' + str;
|
|
}
|
|
}
|
|
try {
|
|
ThreadLocal<Map<String, Constructor<Behavior>>> threadLocal = sConstructors;
|
|
Map<String, Constructor<Behavior>> map = threadLocal.get();
|
|
if (map == null) {
|
|
map = new HashMap<>();
|
|
threadLocal.set(map);
|
|
}
|
|
Constructor<Behavior> constructor = map.get(str);
|
|
if (constructor == null) {
|
|
constructor = Class.forName(str, false, context.getClassLoader()).getConstructor(CONSTRUCTOR_PARAMS);
|
|
constructor.setAccessible(true);
|
|
map.put(str, constructor);
|
|
}
|
|
return constructor.newInstance(context, attributeSet);
|
|
} catch (Exception e) {
|
|
throw new RuntimeException(a.t("Could not inflate Behavior subclass ", str), e);
|
|
}
|
|
}
|
|
|
|
private boolean performIntercept(MotionEvent motionEvent, int i) {
|
|
int actionMasked = motionEvent.getActionMasked();
|
|
List<View> list = this.mTempList1;
|
|
getTopSortedChildren(list);
|
|
int size = list.size();
|
|
MotionEvent motionEvent2 = null;
|
|
boolean z2 = false;
|
|
boolean z3 = false;
|
|
for (int i2 = 0; i2 < size; i2++) {
|
|
View view = list.get(i2);
|
|
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
|
Behavior behavior = layoutParams.getBehavior();
|
|
if (!(z2 || z3) || actionMasked == 0) {
|
|
if (!z2 && behavior != null) {
|
|
if (i == 0) {
|
|
z2 = behavior.onInterceptTouchEvent(this, view, motionEvent);
|
|
} else if (i == 1) {
|
|
z2 = behavior.onTouchEvent(this, view, motionEvent);
|
|
}
|
|
if (z2) {
|
|
this.mBehaviorTouchView = view;
|
|
}
|
|
}
|
|
boolean didBlockInteraction = layoutParams.didBlockInteraction();
|
|
boolean isBlockingInteractionBelow = layoutParams.isBlockingInteractionBelow(this, view);
|
|
z3 = isBlockingInteractionBelow && !didBlockInteraction;
|
|
if (isBlockingInteractionBelow && !z3) {
|
|
break;
|
|
}
|
|
} else if (behavior != null) {
|
|
if (motionEvent2 == null) {
|
|
long uptimeMillis = SystemClock.uptimeMillis();
|
|
motionEvent2 = MotionEvent.obtain(uptimeMillis, uptimeMillis, 3, 0.0f, 0.0f, 0);
|
|
}
|
|
if (i == 0) {
|
|
behavior.onInterceptTouchEvent(this, view, motionEvent2);
|
|
} else if (i == 1) {
|
|
behavior.onTouchEvent(this, view, motionEvent2);
|
|
}
|
|
}
|
|
}
|
|
list.clear();
|
|
return z2;
|
|
}
|
|
|
|
private void prepareChildren() {
|
|
this.mDependencySortedChildren.clear();
|
|
this.mChildDag.clear();
|
|
int childCount = getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
View childAt = getChildAt(i);
|
|
LayoutParams resolvedLayoutParams = getResolvedLayoutParams(childAt);
|
|
resolvedLayoutParams.findAnchorView(this, childAt);
|
|
this.mChildDag.addNode(childAt);
|
|
for (int i2 = 0; i2 < childCount; i2++) {
|
|
if (i2 != i) {
|
|
View childAt2 = getChildAt(i2);
|
|
if (resolvedLayoutParams.dependsOn(this, childAt, childAt2)) {
|
|
if (!this.mChildDag.contains(childAt2)) {
|
|
this.mChildDag.addNode(childAt2);
|
|
}
|
|
this.mChildDag.addEdge(childAt2, childAt);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.mDependencySortedChildren.addAll(this.mChildDag.getSortedList());
|
|
Collections.reverse(this.mDependencySortedChildren);
|
|
}
|
|
|
|
private static void releaseTempRect(@NonNull Rect rect) {
|
|
rect.setEmpty();
|
|
sRectPool.release(rect);
|
|
}
|
|
|
|
private void resetTouchBehaviors(boolean z2) {
|
|
int childCount = getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
View childAt = getChildAt(i);
|
|
Behavior behavior = ((LayoutParams) childAt.getLayoutParams()).getBehavior();
|
|
if (behavior != null) {
|
|
long uptimeMillis = SystemClock.uptimeMillis();
|
|
MotionEvent obtain = MotionEvent.obtain(uptimeMillis, uptimeMillis, 3, 0.0f, 0.0f, 0);
|
|
if (z2) {
|
|
behavior.onInterceptTouchEvent(this, childAt, obtain);
|
|
} else {
|
|
behavior.onTouchEvent(this, childAt, obtain);
|
|
}
|
|
obtain.recycle();
|
|
}
|
|
}
|
|
for (int i2 = 0; i2 < childCount; i2++) {
|
|
((LayoutParams) getChildAt(i2).getLayoutParams()).resetTouchBehaviorTracking();
|
|
}
|
|
this.mBehaviorTouchView = null;
|
|
this.mDisallowInterceptReset = false;
|
|
}
|
|
|
|
private static int resolveAnchoredChildGravity(int i) {
|
|
if (i == 0) {
|
|
return 17;
|
|
}
|
|
return i;
|
|
}
|
|
|
|
private static int resolveGravity(int i) {
|
|
if ((i & 7) == 0) {
|
|
i |= 8388611;
|
|
}
|
|
return (i & 112) == 0 ? i | 48 : i;
|
|
}
|
|
|
|
private static int resolveKeylineGravity(int i) {
|
|
if (i == 0) {
|
|
return 8388661;
|
|
}
|
|
return i;
|
|
}
|
|
|
|
private void setInsetOffsetX(View view, int i) {
|
|
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
|
int i2 = layoutParams.mInsetOffsetX;
|
|
if (i2 != i) {
|
|
ViewCompat.offsetLeftAndRight(view, i - i2);
|
|
layoutParams.mInsetOffsetX = i;
|
|
}
|
|
}
|
|
|
|
private void setInsetOffsetY(View view, int i) {
|
|
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
|
int i2 = layoutParams.mInsetOffsetY;
|
|
if (i2 != i) {
|
|
ViewCompat.offsetTopAndBottom(view, i - i2);
|
|
layoutParams.mInsetOffsetY = i;
|
|
}
|
|
}
|
|
|
|
private void setupForInsets() {
|
|
if (ViewCompat.getFitsSystemWindows(this)) {
|
|
if (this.mApplyWindowInsetsListener == null) {
|
|
this.mApplyWindowInsetsListener = new AnonymousClass1();
|
|
}
|
|
ViewCompat.setOnApplyWindowInsetsListener(this, this.mApplyWindowInsetsListener);
|
|
setSystemUiVisibility(1280);
|
|
return;
|
|
}
|
|
ViewCompat.setOnApplyWindowInsetsListener(this, null);
|
|
}
|
|
|
|
public void addPreDrawListener() {
|
|
if (this.mIsAttachedToWindow) {
|
|
if (this.mOnPreDrawListener == null) {
|
|
this.mOnPreDrawListener = new OnPreDrawListener();
|
|
}
|
|
getViewTreeObserver().addOnPreDrawListener(this.mOnPreDrawListener);
|
|
}
|
|
this.mNeedsPreDrawListener = true;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
|
return (layoutParams instanceof LayoutParams) && super.checkLayoutParams(layoutParams);
|
|
}
|
|
|
|
public void dispatchDependentViewsChanged(@NonNull View view) {
|
|
List incomingEdges = this.mChildDag.getIncomingEdges(view);
|
|
if (!(incomingEdges == null || incomingEdges.isEmpty())) {
|
|
for (int i = 0; i < incomingEdges.size(); i++) {
|
|
View view2 = (View) incomingEdges.get(i);
|
|
Behavior behavior = ((LayoutParams) view2.getLayoutParams()).getBehavior();
|
|
if (behavior != null) {
|
|
behavior.onDependentViewChanged(this, view2, view);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public boolean doViewsOverlap(@NonNull View view, @NonNull View view2) {
|
|
boolean z2 = false;
|
|
if (view.getVisibility() != 0 || view2.getVisibility() != 0) {
|
|
return false;
|
|
}
|
|
Rect acquireTempRect = acquireTempRect();
|
|
getChildRect(view, view.getParent() != this, acquireTempRect);
|
|
Rect acquireTempRect2 = acquireTempRect();
|
|
getChildRect(view2, view2.getParent() != this, acquireTempRect2);
|
|
try {
|
|
if (acquireTempRect.left <= acquireTempRect2.right && acquireTempRect.top <= acquireTempRect2.bottom && acquireTempRect.right >= acquireTempRect2.left && acquireTempRect.bottom >= acquireTempRect2.top) {
|
|
z2 = true;
|
|
}
|
|
return z2;
|
|
} finally {
|
|
releaseTempRect(acquireTempRect);
|
|
releaseTempRect(acquireTempRect2);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public boolean drawChild(Canvas canvas, View view, long j) {
|
|
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
|
Behavior behavior = layoutParams.mBehavior;
|
|
if (behavior != null) {
|
|
float scrimOpacity = behavior.getScrimOpacity(this, view);
|
|
if (scrimOpacity > 0.0f) {
|
|
if (this.mScrimPaint == null) {
|
|
this.mScrimPaint = new Paint();
|
|
}
|
|
this.mScrimPaint.setColor(layoutParams.mBehavior.getScrimColor(this, view));
|
|
this.mScrimPaint.setAlpha(clamp(Math.round(scrimOpacity * 255.0f), 0, 255));
|
|
int save = canvas.save();
|
|
if (view.isOpaque()) {
|
|
canvas.clipRect((float) view.getLeft(), (float) view.getTop(), (float) view.getRight(), (float) view.getBottom(), Region.Op.DIFFERENCE);
|
|
}
|
|
canvas.drawRect((float) getPaddingLeft(), (float) getPaddingTop(), (float) (getWidth() - getPaddingRight()), (float) (getHeight() - getPaddingBottom()), this.mScrimPaint);
|
|
canvas.restoreToCount(save);
|
|
}
|
|
}
|
|
return super.drawChild(canvas, view, j);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void drawableStateChanged() {
|
|
super.drawableStateChanged();
|
|
int[] drawableState = getDrawableState();
|
|
Drawable drawable = this.mStatusBarBackground;
|
|
boolean z2 = false;
|
|
if (drawable != null && drawable.isStateful()) {
|
|
z2 = false | drawable.setState(drawableState);
|
|
}
|
|
if (z2) {
|
|
invalidate();
|
|
}
|
|
}
|
|
|
|
public void ensurePreDrawListener() {
|
|
int childCount = getChildCount();
|
|
boolean z2 = false;
|
|
int i = 0;
|
|
while (true) {
|
|
if (i >= childCount) {
|
|
break;
|
|
} else if (hasDependencies(getChildAt(i))) {
|
|
z2 = true;
|
|
break;
|
|
} else {
|
|
i++;
|
|
}
|
|
}
|
|
if (z2 == this.mNeedsPreDrawListener) {
|
|
return;
|
|
}
|
|
if (z2) {
|
|
addPreDrawListener();
|
|
} else {
|
|
removePreDrawListener();
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public LayoutParams generateDefaultLayoutParams() {
|
|
return new LayoutParams(-2, -2);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public LayoutParams generateLayoutParams(AttributeSet attributeSet) {
|
|
return new LayoutParams(getContext(), attributeSet);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
|
return layoutParams instanceof LayoutParams ? new LayoutParams((LayoutParams) layoutParams) : layoutParams instanceof ViewGroup.MarginLayoutParams ? new LayoutParams((ViewGroup.MarginLayoutParams) layoutParams) : new LayoutParams(layoutParams);
|
|
}
|
|
|
|
public void getChildRect(View view, boolean z2, Rect rect) {
|
|
if (view.isLayoutRequested() || view.getVisibility() == 8) {
|
|
rect.setEmpty();
|
|
} else if (z2) {
|
|
getDescendantRect(view, rect);
|
|
} else {
|
|
rect.set(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
|
|
}
|
|
}
|
|
|
|
@NonNull
|
|
public List<View> getDependencies(@NonNull View view) {
|
|
List<View> outgoingEdges = this.mChildDag.getOutgoingEdges(view);
|
|
this.mTempDependenciesList.clear();
|
|
if (outgoingEdges != null) {
|
|
this.mTempDependenciesList.addAll(outgoingEdges);
|
|
}
|
|
return this.mTempDependenciesList;
|
|
}
|
|
|
|
@VisibleForTesting
|
|
public final List<View> getDependencySortedChildren() {
|
|
prepareChildren();
|
|
return Collections.unmodifiableList(this.mDependencySortedChildren);
|
|
}
|
|
|
|
@NonNull
|
|
public List<View> getDependents(@NonNull View view) {
|
|
List incomingEdges = this.mChildDag.getIncomingEdges(view);
|
|
this.mTempDependenciesList.clear();
|
|
if (incomingEdges != null) {
|
|
this.mTempDependenciesList.addAll(incomingEdges);
|
|
}
|
|
return this.mTempDependenciesList;
|
|
}
|
|
|
|
public void getDescendantRect(View view, Rect rect) {
|
|
ViewGroupUtils.getDescendantRect(this, view, rect);
|
|
}
|
|
|
|
public void getDesiredAnchoredChildRect(View view, int i, Rect rect, Rect rect2) {
|
|
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
|
int measuredWidth = view.getMeasuredWidth();
|
|
int measuredHeight = view.getMeasuredHeight();
|
|
getDesiredAnchoredChildRectWithoutConstraints(view, i, rect, rect2, layoutParams, measuredWidth, measuredHeight);
|
|
constrainChildRect(layoutParams, rect2, measuredWidth, measuredHeight);
|
|
}
|
|
|
|
public void getLastChildRect(View view, Rect rect) {
|
|
rect.set(((LayoutParams) view.getLayoutParams()).getLastChildRect());
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
public final WindowInsetsCompat getLastWindowInsets() {
|
|
return this.mLastInsets;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, androidx.core.view.NestedScrollingParent
|
|
public int getNestedScrollAxes() {
|
|
return this.mNestedScrollingParentHelper.getNestedScrollAxes();
|
|
}
|
|
|
|
public LayoutParams getResolvedLayoutParams(View view) {
|
|
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
|
if (!layoutParams.mBehaviorResolved) {
|
|
if (view instanceof AttachedBehavior) {
|
|
Behavior behavior = ((AttachedBehavior) view).getBehavior();
|
|
if (behavior == null) {
|
|
Log.e("CoordinatorLayout", "Attached behavior class is null");
|
|
}
|
|
layoutParams.setBehavior(behavior);
|
|
layoutParams.mBehaviorResolved = true;
|
|
} else {
|
|
DefaultBehavior defaultBehavior = null;
|
|
for (Class<?> cls = view.getClass(); cls != null; cls = cls.getSuperclass()) {
|
|
defaultBehavior = (DefaultBehavior) cls.getAnnotation(DefaultBehavior.class);
|
|
if (defaultBehavior != null) {
|
|
break;
|
|
}
|
|
}
|
|
if (defaultBehavior != null) {
|
|
try {
|
|
layoutParams.setBehavior((Behavior) defaultBehavior.value().getDeclaredConstructor(new Class[0]).newInstance(new Object[0]));
|
|
} catch (Exception e) {
|
|
StringBuilder L = a.L("Default behavior class ");
|
|
L.append(defaultBehavior.value().getName());
|
|
L.append(" could not be instantiated. Did you forget a default constructor?");
|
|
Log.e("CoordinatorLayout", L.toString(), e);
|
|
}
|
|
}
|
|
layoutParams.mBehaviorResolved = true;
|
|
}
|
|
}
|
|
return layoutParams;
|
|
}
|
|
|
|
@Nullable
|
|
public Drawable getStatusBarBackground() {
|
|
return this.mStatusBarBackground;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public int getSuggestedMinimumHeight() {
|
|
return Math.max(super.getSuggestedMinimumHeight(), getPaddingBottom() + getPaddingTop());
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public int getSuggestedMinimumWidth() {
|
|
return Math.max(super.getSuggestedMinimumWidth(), getPaddingRight() + getPaddingLeft());
|
|
}
|
|
|
|
public boolean isPointInChildBounds(@NonNull View view, int i, int i2) {
|
|
Rect acquireTempRect = acquireTempRect();
|
|
getDescendantRect(view, acquireTempRect);
|
|
try {
|
|
return acquireTempRect.contains(i, i2);
|
|
} finally {
|
|
releaseTempRect(acquireTempRect);
|
|
}
|
|
}
|
|
|
|
public void offsetChildToAnchor(View view, int i) {
|
|
Behavior behavior;
|
|
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
|
if (layoutParams.mAnchorView != null) {
|
|
Rect acquireTempRect = acquireTempRect();
|
|
Rect acquireTempRect2 = acquireTempRect();
|
|
Rect acquireTempRect3 = acquireTempRect();
|
|
getDescendantRect(layoutParams.mAnchorView, acquireTempRect);
|
|
boolean z2 = false;
|
|
getChildRect(view, false, acquireTempRect2);
|
|
int measuredWidth = view.getMeasuredWidth();
|
|
int measuredHeight = view.getMeasuredHeight();
|
|
getDesiredAnchoredChildRectWithoutConstraints(view, i, acquireTempRect, acquireTempRect3, layoutParams, measuredWidth, measuredHeight);
|
|
if (!(acquireTempRect3.left == acquireTempRect2.left && acquireTempRect3.top == acquireTempRect2.top)) {
|
|
z2 = true;
|
|
}
|
|
constrainChildRect(layoutParams, acquireTempRect3, measuredWidth, measuredHeight);
|
|
int i2 = acquireTempRect3.left - acquireTempRect2.left;
|
|
int i3 = acquireTempRect3.top - acquireTempRect2.top;
|
|
if (i2 != 0) {
|
|
ViewCompat.offsetLeftAndRight(view, i2);
|
|
}
|
|
if (i3 != 0) {
|
|
ViewCompat.offsetTopAndBottom(view, i3);
|
|
}
|
|
if (z2 && (behavior = layoutParams.getBehavior()) != null) {
|
|
behavior.onDependentViewChanged(this, view, layoutParams.mAnchorView);
|
|
}
|
|
releaseTempRect(acquireTempRect);
|
|
releaseTempRect(acquireTempRect2);
|
|
releaseTempRect(acquireTempRect3);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onAttachedToWindow() {
|
|
super.onAttachedToWindow();
|
|
resetTouchBehaviors(false);
|
|
if (this.mNeedsPreDrawListener) {
|
|
if (this.mOnPreDrawListener == null) {
|
|
this.mOnPreDrawListener = new OnPreDrawListener();
|
|
}
|
|
getViewTreeObserver().addOnPreDrawListener(this.mOnPreDrawListener);
|
|
}
|
|
if (this.mLastInsets == null && ViewCompat.getFitsSystemWindows(this)) {
|
|
ViewCompat.requestApplyInsets(this);
|
|
}
|
|
this.mIsAttachedToWindow = true;
|
|
}
|
|
|
|
public final void onChildViewsChanged(int i) {
|
|
boolean z2;
|
|
int layoutDirection = ViewCompat.getLayoutDirection(this);
|
|
int size = this.mDependencySortedChildren.size();
|
|
Rect acquireTempRect = acquireTempRect();
|
|
Rect acquireTempRect2 = acquireTempRect();
|
|
Rect acquireTempRect3 = acquireTempRect();
|
|
for (int i2 = 0; i2 < size; i2++) {
|
|
View view = this.mDependencySortedChildren.get(i2);
|
|
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
|
if (i != 0 || view.getVisibility() != 8) {
|
|
for (int i3 = 0; i3 < i2; i3++) {
|
|
if (layoutParams.mAnchorDirectChild == this.mDependencySortedChildren.get(i3)) {
|
|
offsetChildToAnchor(view, layoutDirection);
|
|
}
|
|
}
|
|
getChildRect(view, true, acquireTempRect2);
|
|
if (layoutParams.insetEdge != 0 && !acquireTempRect2.isEmpty()) {
|
|
int absoluteGravity = GravityCompat.getAbsoluteGravity(layoutParams.insetEdge, layoutDirection);
|
|
int i4 = absoluteGravity & 112;
|
|
if (i4 == 48) {
|
|
acquireTempRect.top = Math.max(acquireTempRect.top, acquireTempRect2.bottom);
|
|
} else if (i4 == 80) {
|
|
acquireTempRect.bottom = Math.max(acquireTempRect.bottom, getHeight() - acquireTempRect2.top);
|
|
}
|
|
int i5 = absoluteGravity & 7;
|
|
if (i5 == 3) {
|
|
acquireTempRect.left = Math.max(acquireTempRect.left, acquireTempRect2.right);
|
|
} else if (i5 == 5) {
|
|
acquireTempRect.right = Math.max(acquireTempRect.right, getWidth() - acquireTempRect2.left);
|
|
}
|
|
}
|
|
if (layoutParams.dodgeInsetEdges != 0 && view.getVisibility() == 0) {
|
|
offsetChildByInset(view, acquireTempRect, layoutDirection);
|
|
}
|
|
if (i != 2) {
|
|
getLastChildRect(view, acquireTempRect3);
|
|
if (!acquireTempRect3.equals(acquireTempRect2)) {
|
|
recordLastChildRect(view, acquireTempRect2);
|
|
}
|
|
}
|
|
for (int i6 = i2 + 1; i6 < size; i6++) {
|
|
View view2 = this.mDependencySortedChildren.get(i6);
|
|
LayoutParams layoutParams2 = (LayoutParams) view2.getLayoutParams();
|
|
Behavior behavior = layoutParams2.getBehavior();
|
|
if (behavior != null && behavior.layoutDependsOn(this, view2, view)) {
|
|
if (i != 0 || !layoutParams2.getChangedAfterNestedScroll()) {
|
|
if (i != 2) {
|
|
z2 = behavior.onDependentViewChanged(this, view2, view);
|
|
} else {
|
|
behavior.onDependentViewRemoved(this, view2, view);
|
|
z2 = true;
|
|
}
|
|
if (i == 1) {
|
|
layoutParams2.setChangedAfterNestedScroll(z2);
|
|
}
|
|
} else {
|
|
layoutParams2.resetChangedAfterNestedScroll();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
releaseTempRect(acquireTempRect);
|
|
releaseTempRect(acquireTempRect2);
|
|
releaseTempRect(acquireTempRect3);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onDetachedFromWindow() {
|
|
super.onDetachedFromWindow();
|
|
resetTouchBehaviors(false);
|
|
if (this.mNeedsPreDrawListener && this.mOnPreDrawListener != null) {
|
|
getViewTreeObserver().removeOnPreDrawListener(this.mOnPreDrawListener);
|
|
}
|
|
View view = this.mNestedScrollingTarget;
|
|
if (view != null) {
|
|
onStopNestedScroll(view);
|
|
}
|
|
this.mIsAttachedToWindow = false;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onDraw(Canvas canvas) {
|
|
super.onDraw(canvas);
|
|
if (this.mDrawStatusBarBackground && this.mStatusBarBackground != null) {
|
|
WindowInsetsCompat windowInsetsCompat = this.mLastInsets;
|
|
int systemWindowInsetTop = windowInsetsCompat != null ? windowInsetsCompat.getSystemWindowInsetTop() : 0;
|
|
if (systemWindowInsetTop > 0) {
|
|
this.mStatusBarBackground.setBounds(0, 0, getWidth(), systemWindowInsetTop);
|
|
this.mStatusBarBackground.draw(canvas);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
|
|
int actionMasked = motionEvent.getActionMasked();
|
|
if (actionMasked == 0) {
|
|
resetTouchBehaviors(true);
|
|
}
|
|
boolean performIntercept = performIntercept(motionEvent, 0);
|
|
if (actionMasked == 1 || actionMasked == 3) {
|
|
resetTouchBehaviors(true);
|
|
}
|
|
return performIntercept;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onLayout(boolean z2, int i, int i2, int i3, int i4) {
|
|
Behavior behavior;
|
|
int layoutDirection = ViewCompat.getLayoutDirection(this);
|
|
int size = this.mDependencySortedChildren.size();
|
|
for (int i5 = 0; i5 < size; i5++) {
|
|
View view = this.mDependencySortedChildren.get(i5);
|
|
if (view.getVisibility() != 8 && ((behavior = ((LayoutParams) view.getLayoutParams()).getBehavior()) == null || !behavior.onLayoutChild(this, view, layoutDirection))) {
|
|
onLayoutChild(view, layoutDirection);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void onLayoutChild(@NonNull View view, int i) {
|
|
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
|
if (!layoutParams.checkAnchorChanged()) {
|
|
View view2 = layoutParams.mAnchorView;
|
|
if (view2 != null) {
|
|
layoutChildWithAnchor(view, view2, i);
|
|
return;
|
|
}
|
|
int i2 = layoutParams.keyline;
|
|
if (i2 >= 0) {
|
|
layoutChildWithKeyline(view, i2, i);
|
|
} else {
|
|
layoutChild(view, i);
|
|
}
|
|
} else {
|
|
throw new IllegalStateException("An anchor may not be changed after CoordinatorLayout measurement begins before layout is complete.");
|
|
}
|
|
}
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:41:0x011a, code lost:
|
|
if (r0.onMeasureChild(r30, r20, r11, r21, r23, 0) == false) goto L_0x012a;
|
|
*/
|
|
/* JADX WARNING: Removed duplicated region for block: B:34:0x00c1 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:40:0x00fb */
|
|
/* JADX WARNING: Removed duplicated region for block: B:42:0x011d */
|
|
@Override // android.view.View
|
|
public void onMeasure(int i, int i2) {
|
|
int i3;
|
|
int i4;
|
|
int i5;
|
|
int i6;
|
|
int i7;
|
|
int i8;
|
|
int i9;
|
|
Behavior behavior;
|
|
int i10;
|
|
LayoutParams layoutParams;
|
|
int i11;
|
|
int i12;
|
|
prepareChildren();
|
|
ensurePreDrawListener();
|
|
int paddingLeft = getPaddingLeft();
|
|
int paddingTop = getPaddingTop();
|
|
int paddingRight = getPaddingRight();
|
|
int paddingBottom = getPaddingBottom();
|
|
int layoutDirection = ViewCompat.getLayoutDirection(this);
|
|
boolean z2 = layoutDirection == 1;
|
|
int mode = View.MeasureSpec.getMode(i);
|
|
int size = View.MeasureSpec.getSize(i);
|
|
int mode2 = View.MeasureSpec.getMode(i2);
|
|
int size2 = View.MeasureSpec.getSize(i2);
|
|
int i13 = paddingLeft + paddingRight;
|
|
int i14 = paddingTop + paddingBottom;
|
|
int suggestedMinimumWidth = getSuggestedMinimumWidth();
|
|
int suggestedMinimumHeight = getSuggestedMinimumHeight();
|
|
boolean z3 = this.mLastInsets != null && ViewCompat.getFitsSystemWindows(this);
|
|
int size3 = this.mDependencySortedChildren.size();
|
|
int i15 = suggestedMinimumWidth;
|
|
int i16 = suggestedMinimumHeight;
|
|
int i17 = 0;
|
|
int i18 = 0;
|
|
while (i18 < size3) {
|
|
View view = this.mDependencySortedChildren.get(i18);
|
|
if (view.getVisibility() == 8) {
|
|
i5 = i18;
|
|
i3 = size3;
|
|
i4 = paddingLeft;
|
|
} else {
|
|
LayoutParams layoutParams2 = (LayoutParams) view.getLayoutParams();
|
|
int i19 = layoutParams2.keyline;
|
|
if (i19 < 0 || mode == 0) {
|
|
i6 = i17;
|
|
} else {
|
|
int keyline = getKeyline(i19);
|
|
int absoluteGravity = GravityCompat.getAbsoluteGravity(resolveKeylineGravity(layoutParams2.gravity), layoutDirection) & 7;
|
|
i6 = i17;
|
|
if ((absoluteGravity == 3 && !z2) || (absoluteGravity == 5 && z2)) {
|
|
i7 = Math.max(0, (size - paddingRight) - keyline);
|
|
if (z3) {
|
|
}
|
|
i9 = i;
|
|
i8 = i2;
|
|
behavior = layoutParams2.getBehavior();
|
|
if (behavior != null) {
|
|
}
|
|
onMeasureChild(view, i9, i7, i8, 0);
|
|
int max = Math.max(i12, view.getMeasuredWidth() + i13 + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin);
|
|
int max2 = Math.max(i10, view.getMeasuredHeight() + i14 + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin);
|
|
i17 = View.combineMeasuredStates(i11, view.getMeasuredState());
|
|
i15 = max;
|
|
i16 = max2;
|
|
} else if ((absoluteGravity == 5 && !z2) || (absoluteGravity == 3 && z2)) {
|
|
i7 = Math.max(0, keyline - paddingLeft);
|
|
if (z3 || ViewCompat.getFitsSystemWindows(view)) {
|
|
i9 = i;
|
|
i8 = i2;
|
|
} else {
|
|
int systemWindowInsetRight = this.mLastInsets.getSystemWindowInsetRight() + this.mLastInsets.getSystemWindowInsetLeft();
|
|
int systemWindowInsetBottom = this.mLastInsets.getSystemWindowInsetBottom() + this.mLastInsets.getSystemWindowInsetTop();
|
|
i9 = View.MeasureSpec.makeMeasureSpec(size - systemWindowInsetRight, mode);
|
|
i8 = View.MeasureSpec.makeMeasureSpec(size2 - systemWindowInsetBottom, mode2);
|
|
}
|
|
behavior = layoutParams2.getBehavior();
|
|
if (behavior != null) {
|
|
layoutParams = layoutParams2;
|
|
i11 = i6;
|
|
i5 = i18;
|
|
i10 = i16;
|
|
i4 = paddingLeft;
|
|
i12 = i15;
|
|
i3 = size3;
|
|
} else {
|
|
layoutParams = layoutParams2;
|
|
i10 = i16;
|
|
i3 = size3;
|
|
i4 = paddingLeft;
|
|
i11 = i6;
|
|
i5 = i18;
|
|
i12 = i15;
|
|
}
|
|
onMeasureChild(view, i9, i7, i8, 0);
|
|
int max = Math.max(i12, view.getMeasuredWidth() + i13 + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin);
|
|
int max2 = Math.max(i10, view.getMeasuredHeight() + i14 + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin);
|
|
i17 = View.combineMeasuredStates(i11, view.getMeasuredState());
|
|
i15 = max;
|
|
i16 = max2;
|
|
}
|
|
}
|
|
i7 = 0;
|
|
if (z3) {
|
|
}
|
|
i9 = i;
|
|
i8 = i2;
|
|
behavior = layoutParams2.getBehavior();
|
|
if (behavior != null) {
|
|
}
|
|
onMeasureChild(view, i9, i7, i8, 0);
|
|
int max = Math.max(i12, view.getMeasuredWidth() + i13 + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin);
|
|
int max2 = Math.max(i10, view.getMeasuredHeight() + i14 + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin);
|
|
i17 = View.combineMeasuredStates(i11, view.getMeasuredState());
|
|
i15 = max;
|
|
i16 = max2;
|
|
}
|
|
i18 = i5 + 1;
|
|
paddingLeft = i4;
|
|
size3 = i3;
|
|
}
|
|
setMeasuredDimension(View.resolveSizeAndState(i15, i, -16777216 & i17), View.resolveSizeAndState(i16, i2, i17 << 16));
|
|
}
|
|
|
|
public void onMeasureChild(View view, int i, int i2, int i3, int i4) {
|
|
measureChildWithMargins(view, i, i2, i3, i4);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
|
public boolean onNestedFling(View view, float f, float f2, boolean z2) {
|
|
Behavior behavior;
|
|
int childCount = getChildCount();
|
|
boolean z3 = false;
|
|
for (int i = 0; i < childCount; i++) {
|
|
View childAt = getChildAt(i);
|
|
if (childAt.getVisibility() != 8) {
|
|
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
|
if (layoutParams.isNestedScrollAccepted(0) && (behavior = layoutParams.getBehavior()) != null) {
|
|
z3 |= behavior.onNestedFling(this, childAt, view, f, f2, z2);
|
|
}
|
|
}
|
|
}
|
|
if (z3) {
|
|
onChildViewsChanged(1);
|
|
}
|
|
return z3;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
|
public boolean onNestedPreFling(View view, float f, float f2) {
|
|
Behavior behavior;
|
|
int childCount = getChildCount();
|
|
boolean z2 = false;
|
|
for (int i = 0; i < childCount; i++) {
|
|
View childAt = getChildAt(i);
|
|
if (childAt.getVisibility() != 8) {
|
|
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
|
if (layoutParams.isNestedScrollAccepted(0) && (behavior = layoutParams.getBehavior()) != null) {
|
|
z2 |= behavior.onNestedPreFling(this, childAt, view, f, f2);
|
|
}
|
|
}
|
|
}
|
|
return z2;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
|
public void onNestedPreScroll(View view, int i, int i2, int[] iArr) {
|
|
onNestedPreScroll(view, i, i2, iArr, 0);
|
|
}
|
|
|
|
@Override // androidx.core.view.NestedScrollingParent2
|
|
public void onNestedPreScroll(View view, int i, int i2, int[] iArr, int i3) {
|
|
Behavior behavior;
|
|
int childCount = getChildCount();
|
|
boolean z2 = false;
|
|
int i4 = 0;
|
|
int i5 = 0;
|
|
for (int i6 = 0; i6 < childCount; i6++) {
|
|
View childAt = getChildAt(i6);
|
|
if (childAt.getVisibility() != 8) {
|
|
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
|
if (layoutParams.isNestedScrollAccepted(i3) && (behavior = layoutParams.getBehavior()) != null) {
|
|
int[] iArr2 = this.mBehaviorConsumed;
|
|
iArr2[0] = 0;
|
|
iArr2[1] = 0;
|
|
behavior.onNestedPreScroll(this, childAt, view, i, i2, iArr2, i3);
|
|
int[] iArr3 = this.mBehaviorConsumed;
|
|
i4 = i > 0 ? Math.max(i4, iArr3[0]) : Math.min(i4, iArr3[0]);
|
|
int[] iArr4 = this.mBehaviorConsumed;
|
|
i5 = i2 > 0 ? Math.max(i5, iArr4[1]) : Math.min(i5, iArr4[1]);
|
|
z2 = true;
|
|
}
|
|
}
|
|
}
|
|
iArr[0] = i4;
|
|
iArr[1] = i5;
|
|
if (z2) {
|
|
onChildViewsChanged(1);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
|
public void onNestedScroll(View view, int i, int i2, int i3, int i4) {
|
|
onNestedScroll(view, i, i2, i3, i4, 0);
|
|
}
|
|
|
|
@Override // androidx.core.view.NestedScrollingParent2
|
|
public void onNestedScroll(View view, int i, int i2, int i3, int i4, int i5) {
|
|
onNestedScroll(view, i, i2, i3, i4, 0, this.mNestedScrollingV2ConsumedCompat);
|
|
}
|
|
|
|
@Override // androidx.core.view.NestedScrollingParent3
|
|
public void onNestedScroll(@NonNull View view, int i, int i2, int i3, int i4, int i5, @NonNull int[] iArr) {
|
|
Behavior behavior;
|
|
int childCount = getChildCount();
|
|
boolean z2 = false;
|
|
int i6 = 0;
|
|
int i7 = 0;
|
|
for (int i8 = 0; i8 < childCount; i8++) {
|
|
View childAt = getChildAt(i8);
|
|
if (childAt.getVisibility() != 8) {
|
|
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
|
if (layoutParams.isNestedScrollAccepted(i5) && (behavior = layoutParams.getBehavior()) != null) {
|
|
int[] iArr2 = this.mBehaviorConsumed;
|
|
iArr2[0] = 0;
|
|
iArr2[1] = 0;
|
|
behavior.onNestedScroll(this, childAt, view, i, i2, i3, i4, i5, iArr2);
|
|
int[] iArr3 = this.mBehaviorConsumed;
|
|
i6 = i3 > 0 ? Math.max(i6, iArr3[0]) : Math.min(i6, iArr3[0]);
|
|
i7 = i4 > 0 ? Math.max(i7, this.mBehaviorConsumed[1]) : Math.min(i7, this.mBehaviorConsumed[1]);
|
|
z2 = true;
|
|
}
|
|
}
|
|
}
|
|
iArr[0] = iArr[0] + i6;
|
|
iArr[1] = iArr[1] + i7;
|
|
if (z2) {
|
|
onChildViewsChanged(1);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
|
public void onNestedScrollAccepted(View view, View view2, int i) {
|
|
onNestedScrollAccepted(view, view2, i, 0);
|
|
}
|
|
|
|
@Override // androidx.core.view.NestedScrollingParent2
|
|
public void onNestedScrollAccepted(View view, View view2, int i, int i2) {
|
|
Behavior behavior;
|
|
this.mNestedScrollingParentHelper.onNestedScrollAccepted(view, view2, i, i2);
|
|
this.mNestedScrollingTarget = view2;
|
|
int childCount = getChildCount();
|
|
for (int i3 = 0; i3 < childCount; i3++) {
|
|
View childAt = getChildAt(i3);
|
|
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
|
if (layoutParams.isNestedScrollAccepted(i2) && (behavior = layoutParams.getBehavior()) != null) {
|
|
behavior.onNestedScrollAccepted(this, childAt, view, view2, i, i2);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onRestoreInstanceState(Parcelable parcelable) {
|
|
Parcelable parcelable2;
|
|
if (!(parcelable instanceof SavedState)) {
|
|
super.onRestoreInstanceState(parcelable);
|
|
return;
|
|
}
|
|
SavedState savedState = (SavedState) parcelable;
|
|
super.onRestoreInstanceState(savedState.getSuperState());
|
|
SparseArray<Parcelable> sparseArray = savedState.behaviorStates;
|
|
int childCount = getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
View childAt = getChildAt(i);
|
|
int id2 = childAt.getId();
|
|
Behavior behavior = getResolvedLayoutParams(childAt).getBehavior();
|
|
if (!(id2 == -1 || behavior == null || (parcelable2 = sparseArray.get(id2)) == null)) {
|
|
behavior.onRestoreInstanceState(this, childAt, parcelable2);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public Parcelable onSaveInstanceState() {
|
|
Parcelable onSaveInstanceState;
|
|
SavedState savedState = new SavedState(super.onSaveInstanceState());
|
|
SparseArray<Parcelable> sparseArray = new SparseArray<>();
|
|
int childCount = getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
View childAt = getChildAt(i);
|
|
int id2 = childAt.getId();
|
|
Behavior behavior = ((LayoutParams) childAt.getLayoutParams()).getBehavior();
|
|
if (!(id2 == -1 || behavior == null || (onSaveInstanceState = behavior.onSaveInstanceState(this, childAt)) == null)) {
|
|
sparseArray.append(id2, onSaveInstanceState);
|
|
}
|
|
}
|
|
savedState.behaviorStates = sparseArray;
|
|
return savedState;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
|
public boolean onStartNestedScroll(View view, View view2, int i) {
|
|
return onStartNestedScroll(view, view2, i, 0);
|
|
}
|
|
|
|
@Override // androidx.core.view.NestedScrollingParent2
|
|
public boolean onStartNestedScroll(View view, View view2, int i, int i2) {
|
|
int childCount = getChildCount();
|
|
boolean z2 = false;
|
|
for (int i3 = 0; i3 < childCount; i3++) {
|
|
View childAt = getChildAt(i3);
|
|
if (childAt.getVisibility() != 8) {
|
|
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
|
Behavior behavior = layoutParams.getBehavior();
|
|
if (behavior != null) {
|
|
boolean onStartNestedScroll = behavior.onStartNestedScroll(this, childAt, view, view2, i, i2);
|
|
z2 |= onStartNestedScroll;
|
|
layoutParams.setNestedScrollAccepted(i2, onStartNestedScroll);
|
|
} else {
|
|
layoutParams.setNestedScrollAccepted(i2, false);
|
|
}
|
|
}
|
|
}
|
|
return z2;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
|
public void onStopNestedScroll(View view) {
|
|
onStopNestedScroll(view, 0);
|
|
}
|
|
|
|
@Override // androidx.core.view.NestedScrollingParent2
|
|
public void onStopNestedScroll(View view, int i) {
|
|
this.mNestedScrollingParentHelper.onStopNestedScroll(view, i);
|
|
int childCount = getChildCount();
|
|
for (int i2 = 0; i2 < childCount; i2++) {
|
|
View childAt = getChildAt(i2);
|
|
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
|
if (layoutParams.isNestedScrollAccepted(i)) {
|
|
Behavior behavior = layoutParams.getBehavior();
|
|
if (behavior != null) {
|
|
behavior.onStopNestedScroll(this, childAt, view, i);
|
|
}
|
|
layoutParams.resetNestedScroll(i);
|
|
layoutParams.resetChangedAfterNestedScroll();
|
|
}
|
|
}
|
|
this.mNestedScrollingTarget = null;
|
|
}
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:3:0x0012, code lost:
|
|
if (r3 != false) goto L_0x0016;
|
|
*/
|
|
/* JADX WARNING: Removed duplicated region for block: B:11:0x0031 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:12:0x0037 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:15:0x004c */
|
|
@Override // android.view.View
|
|
public boolean onTouchEvent(MotionEvent motionEvent) {
|
|
boolean z2;
|
|
boolean z3;
|
|
MotionEvent motionEvent2;
|
|
int actionMasked = motionEvent.getActionMasked();
|
|
if (this.mBehaviorTouchView == null) {
|
|
z3 = performIntercept(motionEvent, 1);
|
|
} else {
|
|
z3 = false;
|
|
}
|
|
Behavior behavior = ((LayoutParams) this.mBehaviorTouchView.getLayoutParams()).getBehavior();
|
|
if (behavior != null) {
|
|
z2 = behavior.onTouchEvent(this, this.mBehaviorTouchView, motionEvent);
|
|
motionEvent2 = null;
|
|
if (this.mBehaviorTouchView != null) {
|
|
z2 |= super.onTouchEvent(motionEvent);
|
|
} else if (z3) {
|
|
long uptimeMillis = SystemClock.uptimeMillis();
|
|
motionEvent2 = MotionEvent.obtain(uptimeMillis, uptimeMillis, 3, 0.0f, 0.0f, 0);
|
|
super.onTouchEvent(motionEvent2);
|
|
}
|
|
if (motionEvent2 != null) {
|
|
motionEvent2.recycle();
|
|
}
|
|
if (actionMasked == 1 || actionMasked == 3) {
|
|
resetTouchBehaviors(false);
|
|
}
|
|
return z2;
|
|
}
|
|
z2 = false;
|
|
motionEvent2 = null;
|
|
if (this.mBehaviorTouchView != null) {
|
|
}
|
|
if (motionEvent2 != null) {
|
|
}
|
|
resetTouchBehaviors(false);
|
|
return z2;
|
|
}
|
|
|
|
public void recordLastChildRect(View view, Rect rect) {
|
|
((LayoutParams) view.getLayoutParams()).setLastChildRect(rect);
|
|
}
|
|
|
|
public void removePreDrawListener() {
|
|
if (this.mIsAttachedToWindow && this.mOnPreDrawListener != null) {
|
|
getViewTreeObserver().removeOnPreDrawListener(this.mOnPreDrawListener);
|
|
}
|
|
this.mNeedsPreDrawListener = false;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent
|
|
public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z2) {
|
|
Behavior behavior = ((LayoutParams) view.getLayoutParams()).getBehavior();
|
|
if (behavior == null || !behavior.onRequestChildRectangleOnScreen(this, view, rect, z2)) {
|
|
return super.requestChildRectangleOnScreen(view, rect, z2);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent
|
|
public void requestDisallowInterceptTouchEvent(boolean z2) {
|
|
super.requestDisallowInterceptTouchEvent(z2);
|
|
if (z2 && !this.mDisallowInterceptReset) {
|
|
resetTouchBehaviors(false);
|
|
this.mDisallowInterceptReset = true;
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void setFitsSystemWindows(boolean z2) {
|
|
super.setFitsSystemWindows(z2);
|
|
setupForInsets();
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public void setOnHierarchyChangeListener(ViewGroup.OnHierarchyChangeListener onHierarchyChangeListener) {
|
|
this.mOnHierarchyChangeListener = onHierarchyChangeListener;
|
|
}
|
|
|
|
public void setStatusBarBackground(@Nullable Drawable drawable) {
|
|
Drawable drawable2 = this.mStatusBarBackground;
|
|
if (drawable2 != drawable) {
|
|
Drawable drawable3 = null;
|
|
if (drawable2 != null) {
|
|
drawable2.setCallback(null);
|
|
}
|
|
if (drawable != null) {
|
|
drawable3 = drawable.mutate();
|
|
}
|
|
this.mStatusBarBackground = drawable3;
|
|
if (drawable3 != null) {
|
|
if (drawable3.isStateful()) {
|
|
this.mStatusBarBackground.setState(getDrawableState());
|
|
}
|
|
DrawableCompat.setLayoutDirection(this.mStatusBarBackground, ViewCompat.getLayoutDirection(this));
|
|
this.mStatusBarBackground.setVisible(getVisibility() == 0, false);
|
|
this.mStatusBarBackground.setCallback(this);
|
|
}
|
|
ViewCompat.postInvalidateOnAnimation(this);
|
|
}
|
|
}
|
|
|
|
public void setStatusBarBackgroundColor(@ColorInt int i) {
|
|
setStatusBarBackground(new ColorDrawable(i));
|
|
}
|
|
|
|
public void setStatusBarBackgroundResource(@DrawableRes int i) {
|
|
setStatusBarBackground(i != 0 ? ContextCompat.getDrawable(getContext(), i) : null);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void setVisibility(int i) {
|
|
super.setVisibility(i);
|
|
boolean z2 = i == 0;
|
|
Drawable drawable = this.mStatusBarBackground;
|
|
if (drawable != null && drawable.isVisible() != z2) {
|
|
this.mStatusBarBackground.setVisible(z2, false);
|
|
}
|
|
}
|
|
|
|
public final WindowInsetsCompat setWindowInsets(WindowInsetsCompat windowInsetsCompat) {
|
|
if (ObjectsCompat.equals(this.mLastInsets, windowInsetsCompat)) {
|
|
return windowInsetsCompat;
|
|
}
|
|
this.mLastInsets = windowInsetsCompat;
|
|
boolean z2 = true;
|
|
boolean z3 = windowInsetsCompat != null && windowInsetsCompat.getSystemWindowInsetTop() > 0;
|
|
this.mDrawStatusBarBackground = z3;
|
|
if (z3 || getBackground() != null) {
|
|
z2 = false;
|
|
}
|
|
setWillNotDraw(z2);
|
|
WindowInsetsCompat dispatchApplyWindowInsetsToBehaviors = dispatchApplyWindowInsetsToBehaviors(windowInsetsCompat);
|
|
requestLayout();
|
|
return dispatchApplyWindowInsetsToBehaviors;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean verifyDrawable(Drawable drawable) {
|
|
return super.verifyDrawable(drawable) || drawable == this.mStatusBarBackground;
|
|
}
|
|
}
|