1480 lines
52 KiB
Java
1480 lines
52 KiB
Java
package androidx.core.widget;
|
|
|
|
import android.R;
|
|
import android.content.Context;
|
|
import android.content.res.TypedArray;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.Rect;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import android.util.AttributeSet;
|
|
import android.util.Log;
|
|
import android.util.TypedValue;
|
|
import android.view.FocusFinder;
|
|
import android.view.KeyEvent;
|
|
import android.view.MotionEvent;
|
|
import android.view.VelocityTracker;
|
|
import android.view.View;
|
|
import android.view.ViewConfiguration;
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewParent;
|
|
import android.view.accessibility.AccessibilityEvent;
|
|
import android.view.animation.AnimationUtils;
|
|
import android.widget.EdgeEffect;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.OverScroller;
|
|
import android.widget.ScrollView;
|
|
import androidx.core.view.AccessibilityDelegateCompat;
|
|
import androidx.core.view.NestedScrollingChild2;
|
|
import androidx.core.view.NestedScrollingChildHelper;
|
|
import androidx.core.view.NestedScrollingParent2;
|
|
import androidx.core.view.NestedScrollingParentHelper;
|
|
import androidx.core.view.ScrollingView;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
|
|
import androidx.core.view.accessibility.AccessibilityRecordCompat;
|
|
import com.ubt.jimu.base.util.FileUtil;
|
|
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
|
import java.util.ArrayList;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class NestedScrollView extends FrameLayout implements NestedScrollingParent2, NestedScrollingChild2, ScrollingView {
|
|
private static final AccessibilityDelegate B = new AccessibilityDelegate();
|
|
private static final int[] C = {R.attr.fillViewport};
|
|
private OnScrollChangeListener A;
|
|
private long a;
|
|
private final Rect b;
|
|
private OverScroller c;
|
|
private EdgeEffect d;
|
|
private EdgeEffect e;
|
|
private int f;
|
|
private boolean g;
|
|
private boolean h;
|
|
private View i;
|
|
private boolean j;
|
|
private VelocityTracker k;
|
|
private boolean l;
|
|
private boolean m;
|
|
private int n;
|
|
private int o;
|
|
private int p;
|
|
private int q;
|
|
private final int[] r;
|
|
private final int[] s;
|
|
private int t;
|
|
private int u;
|
|
private SavedState v;
|
|
private final NestedScrollingParentHelper x;
|
|
private final NestedScrollingChildHelper y;
|
|
private float z;
|
|
|
|
public interface OnScrollChangeListener {
|
|
void a(NestedScrollView nestedScrollView, int i, int i2, int i3, int i4);
|
|
}
|
|
|
|
static class SavedState extends View.BaseSavedState {
|
|
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() { // from class: androidx.core.widget.NestedScrollView.SavedState.1
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // android.os.Parcelable.Creator
|
|
public SavedState createFromParcel(Parcel parcel) {
|
|
return new SavedState(parcel);
|
|
}
|
|
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // android.os.Parcelable.Creator
|
|
public SavedState[] newArray(int i) {
|
|
return new SavedState[i];
|
|
}
|
|
};
|
|
public int scrollPosition;
|
|
|
|
SavedState(Parcelable parcelable) {
|
|
super(parcelable);
|
|
}
|
|
|
|
public String toString() {
|
|
return "HorizontalScrollView.SavedState{" + Integer.toHexString(System.identityHashCode(this)) + " scrollPosition=" + this.scrollPosition + "}";
|
|
}
|
|
|
|
@Override // android.view.View.BaseSavedState, android.view.AbsSavedState, android.os.Parcelable
|
|
public void writeToParcel(Parcel parcel, int i) {
|
|
super.writeToParcel(parcel, i);
|
|
parcel.writeInt(this.scrollPosition);
|
|
}
|
|
|
|
SavedState(Parcel parcel) {
|
|
super(parcel);
|
|
this.scrollPosition = parcel.readInt();
|
|
}
|
|
}
|
|
|
|
public NestedScrollView(Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
private static int a(int i, int i2, int i3) {
|
|
if (i2 >= i3 || i < 0) {
|
|
return 0;
|
|
}
|
|
return i2 + i > i3 ? i3 - i2 : i;
|
|
}
|
|
|
|
private boolean d(int i, int i2) {
|
|
if (getChildCount() <= 0) {
|
|
return false;
|
|
}
|
|
int scrollY = getScrollY();
|
|
View childAt = getChildAt(0);
|
|
return i2 >= childAt.getTop() - scrollY && i2 < childAt.getBottom() - scrollY && i >= childAt.getLeft() && i < childAt.getRight();
|
|
}
|
|
|
|
private void f() {
|
|
if (this.k == null) {
|
|
this.k = VelocityTracker.obtain();
|
|
}
|
|
}
|
|
|
|
private void g() {
|
|
VelocityTracker velocityTracker = this.k;
|
|
if (velocityTracker != null) {
|
|
velocityTracker.recycle();
|
|
this.k = null;
|
|
}
|
|
}
|
|
|
|
private float getVerticalScrollFactorCompat() {
|
|
if (this.z == 0.0f) {
|
|
TypedValue typedValue = new TypedValue();
|
|
Context context = getContext();
|
|
if (!context.getTheme().resolveAttribute(R.attr.listPreferredItemHeight, typedValue, true)) {
|
|
throw new IllegalStateException("Expected theme to define listPreferredItemHeight.");
|
|
}
|
|
this.z = typedValue.getDimension(context.getResources().getDisplayMetrics());
|
|
}
|
|
return this.z;
|
|
}
|
|
|
|
private void h(int i) {
|
|
int scrollY = getScrollY();
|
|
boolean z = (scrollY > 0 || i > 0) && (scrollY < getScrollRange() || i < 0);
|
|
float f = i;
|
|
if (dispatchNestedPreFling(0.0f, f)) {
|
|
return;
|
|
}
|
|
dispatchNestedFling(0.0f, f, z);
|
|
c(i);
|
|
}
|
|
|
|
@Override // androidx.core.view.NestedScrollingChild2
|
|
public void a(int i) {
|
|
this.y.c(i);
|
|
}
|
|
|
|
@Override // androidx.core.view.NestedScrollingParent2
|
|
public boolean a(View view, View view2, int i, int i2) {
|
|
return (i & 2) != 0;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public void addView(View view) {
|
|
if (getChildCount() > 0) {
|
|
throw new IllegalStateException("ScrollView can host only one direct child");
|
|
}
|
|
super.addView(view);
|
|
}
|
|
|
|
@Override // androidx.core.view.NestedScrollingParent2
|
|
public void b(View view, View view2, int i, int i2) {
|
|
this.x.a(view, view2, i, i2);
|
|
c(2, i2);
|
|
}
|
|
|
|
public boolean c(int i, int i2) {
|
|
return this.y.a(i, i2);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public int computeHorizontalScrollExtent() {
|
|
return super.computeHorizontalScrollExtent();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public int computeHorizontalScrollOffset() {
|
|
return super.computeHorizontalScrollOffset();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public int computeHorizontalScrollRange() {
|
|
return super.computeHorizontalScrollRange();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void computeScroll() {
|
|
if (!this.c.computeScrollOffset()) {
|
|
if (e(1)) {
|
|
a(1);
|
|
}
|
|
this.u = 0;
|
|
return;
|
|
}
|
|
this.c.getCurrX();
|
|
int currY = this.c.getCurrY();
|
|
int i = currY - this.u;
|
|
if (a(0, i, this.s, (int[]) null, 1)) {
|
|
i -= this.s[1];
|
|
}
|
|
int i2 = i;
|
|
if (i2 != 0) {
|
|
int scrollRange = getScrollRange();
|
|
int scrollY = getScrollY();
|
|
a(0, i2, getScrollX(), scrollY, 0, scrollRange, 0, 0, false);
|
|
int scrollY2 = getScrollY() - scrollY;
|
|
if (!a(0, scrollY2, 0, i2 - scrollY2, (int[]) null, 1)) {
|
|
int overScrollMode = getOverScrollMode();
|
|
if (overScrollMode == 0 || (overScrollMode == 1 && scrollRange > 0)) {
|
|
c();
|
|
if (currY <= 0 && scrollY > 0) {
|
|
this.d.onAbsorb((int) this.c.getCurrVelocity());
|
|
} else if (currY >= scrollRange && scrollY < scrollRange) {
|
|
this.e.onAbsorb((int) this.c.getCurrVelocity());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.u = currY;
|
|
ViewCompat.A(this);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public int computeVerticalScrollExtent() {
|
|
return super.computeVerticalScrollExtent();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public int computeVerticalScrollOffset() {
|
|
return Math.max(0, super.computeVerticalScrollOffset());
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public int computeVerticalScrollRange() {
|
|
int childCount = getChildCount();
|
|
int height = (getHeight() - getPaddingBottom()) - getPaddingTop();
|
|
if (childCount == 0) {
|
|
return height;
|
|
}
|
|
View childAt = getChildAt(0);
|
|
int bottom = childAt.getBottom() + ((FrameLayout.LayoutParams) childAt.getLayoutParams()).bottomMargin;
|
|
int scrollY = getScrollY();
|
|
int max = Math.max(0, bottom - height);
|
|
return scrollY < 0 ? bottom - scrollY : scrollY > max ? bottom + (scrollY - max) : bottom;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
|
|
return super.dispatchKeyEvent(keyEvent) || a(keyEvent);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean dispatchNestedFling(float f, float f2, boolean z) {
|
|
return this.y.a(f, f2, z);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean dispatchNestedPreFling(float f, float f2) {
|
|
return this.y.a(f, f2);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean dispatchNestedPreScroll(int i, int i2, int[] iArr, int[] iArr2) {
|
|
return a(i, i2, iArr, iArr2, 0);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean dispatchNestedScroll(int i, int i2, int i3, int i4, int[] iArr) {
|
|
return a(i, i2, i3, i4, iArr, 0);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void draw(Canvas canvas) {
|
|
int paddingLeft;
|
|
super.draw(canvas);
|
|
if (this.d != null) {
|
|
int scrollY = getScrollY();
|
|
int i = 0;
|
|
if (!this.d.isFinished()) {
|
|
int save = canvas.save();
|
|
int width = getWidth();
|
|
int height = getHeight();
|
|
int min = Math.min(0, scrollY);
|
|
if (Build.VERSION.SDK_INT < 21 || getClipToPadding()) {
|
|
width -= getPaddingLeft() + getPaddingRight();
|
|
paddingLeft = getPaddingLeft() + 0;
|
|
} else {
|
|
paddingLeft = 0;
|
|
}
|
|
if (Build.VERSION.SDK_INT >= 21 && getClipToPadding()) {
|
|
height -= getPaddingTop() + getPaddingBottom();
|
|
min += getPaddingTop();
|
|
}
|
|
canvas.translate(paddingLeft, min);
|
|
this.d.setSize(width, height);
|
|
if (this.d.draw(canvas)) {
|
|
ViewCompat.A(this);
|
|
}
|
|
canvas.restoreToCount(save);
|
|
}
|
|
if (this.e.isFinished()) {
|
|
return;
|
|
}
|
|
int save2 = canvas.save();
|
|
int width2 = getWidth();
|
|
int height2 = getHeight();
|
|
int max = Math.max(getScrollRange(), scrollY) + height2;
|
|
if (Build.VERSION.SDK_INT < 21 || getClipToPadding()) {
|
|
width2 -= getPaddingLeft() + getPaddingRight();
|
|
i = 0 + getPaddingLeft();
|
|
}
|
|
if (Build.VERSION.SDK_INT >= 21 && getClipToPadding()) {
|
|
height2 -= getPaddingTop() + getPaddingBottom();
|
|
max -= getPaddingBottom();
|
|
}
|
|
canvas.translate(i - width2, max);
|
|
canvas.rotate(180.0f, width2, 0.0f);
|
|
this.e.setSize(width2, height2);
|
|
if (this.e.draw(canvas)) {
|
|
ViewCompat.A(this);
|
|
}
|
|
canvas.restoreToCount(save2);
|
|
}
|
|
}
|
|
|
|
public boolean e(int i) {
|
|
return this.y.a(i);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
protected float getBottomFadingEdgeStrength() {
|
|
if (getChildCount() == 0) {
|
|
return 0.0f;
|
|
}
|
|
View childAt = getChildAt(0);
|
|
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
|
|
int verticalFadingEdgeLength = getVerticalFadingEdgeLength();
|
|
int bottom = ((childAt.getBottom() + layoutParams.bottomMargin) - getScrollY()) - (getHeight() - getPaddingBottom());
|
|
if (bottom < verticalFadingEdgeLength) {
|
|
return bottom / verticalFadingEdgeLength;
|
|
}
|
|
return 1.0f;
|
|
}
|
|
|
|
public int getMaxScrollAmount() {
|
|
return (int) (getHeight() * 0.5f);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public int getNestedScrollAxes() {
|
|
return this.x.a();
|
|
}
|
|
|
|
int getScrollRange() {
|
|
if (getChildCount() <= 0) {
|
|
return 0;
|
|
}
|
|
View childAt = getChildAt(0);
|
|
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
|
|
return Math.max(0, ((childAt.getHeight() + layoutParams.topMargin) + layoutParams.bottomMargin) - ((getHeight() - getPaddingTop()) - getPaddingBottom()));
|
|
}
|
|
|
|
@Override // android.view.View
|
|
protected float getTopFadingEdgeStrength() {
|
|
if (getChildCount() == 0) {
|
|
return 0.0f;
|
|
}
|
|
int verticalFadingEdgeLength = getVerticalFadingEdgeLength();
|
|
int scrollY = getScrollY();
|
|
if (scrollY < verticalFadingEdgeLength) {
|
|
return scrollY / verticalFadingEdgeLength;
|
|
}
|
|
return 1.0f;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean hasNestedScrollingParent() {
|
|
return e(0);
|
|
}
|
|
|
|
@Override // android.view.View, androidx.core.view.NestedScrollingChild
|
|
public boolean isNestedScrollingEnabled() {
|
|
return this.y.b();
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
protected void measureChild(View view, int i, int i2) {
|
|
view.measure(FrameLayout.getChildMeasureSpec(i, getPaddingLeft() + getPaddingRight(), view.getLayoutParams().width), View.MeasureSpec.makeMeasureSpec(0, 0));
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
protected void measureChildWithMargins(View view, int i, int i2, int i3, int i4) {
|
|
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
|
|
view.measure(FrameLayout.getChildMeasureSpec(i, getPaddingLeft() + getPaddingRight() + marginLayoutParams.leftMargin + marginLayoutParams.rightMargin + i2, marginLayoutParams.width), View.MeasureSpec.makeMeasureSpec(marginLayoutParams.topMargin + marginLayoutParams.bottomMargin, 0));
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onAttachedToWindow() {
|
|
super.onAttachedToWindow();
|
|
this.h = false;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean onGenericMotionEvent(MotionEvent motionEvent) {
|
|
if ((motionEvent.getSource() & 2) != 0 && motionEvent.getAction() == 8 && !this.j) {
|
|
float axisValue = motionEvent.getAxisValue(9);
|
|
if (axisValue != 0.0f) {
|
|
int verticalScrollFactorCompat = (int) (axisValue * getVerticalScrollFactorCompat());
|
|
int scrollRange = getScrollRange();
|
|
int scrollY = getScrollY();
|
|
int i = scrollY - verticalScrollFactorCompat;
|
|
if (i < 0) {
|
|
i = 0;
|
|
} else if (i > scrollRange) {
|
|
i = scrollRange;
|
|
}
|
|
if (i != scrollY) {
|
|
super.scrollTo(getScrollX(), i);
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
|
|
int action = motionEvent.getAction();
|
|
if (action == 2 && this.j) {
|
|
return true;
|
|
}
|
|
int i = action & 255;
|
|
if (i != 0) {
|
|
if (i != 1) {
|
|
if (i == 2) {
|
|
int i2 = this.q;
|
|
if (i2 != -1) {
|
|
int findPointerIndex = motionEvent.findPointerIndex(i2);
|
|
if (findPointerIndex == -1) {
|
|
Log.e("NestedScrollView", "Invalid pointerId=" + i2 + " in onInterceptTouchEvent");
|
|
} else {
|
|
int y = (int) motionEvent.getY(findPointerIndex);
|
|
if (Math.abs(y - this.f) > this.n && (2 & getNestedScrollAxes()) == 0) {
|
|
this.j = true;
|
|
this.f = y;
|
|
f();
|
|
this.k.addMovement(motionEvent);
|
|
this.t = 0;
|
|
ViewParent parent = getParent();
|
|
if (parent != null) {
|
|
parent.requestDisallowInterceptTouchEvent(true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if (i != 3) {
|
|
if (i == 6) {
|
|
a(motionEvent);
|
|
}
|
|
}
|
|
}
|
|
this.j = false;
|
|
this.q = -1;
|
|
g();
|
|
if (this.c.springBack(getScrollX(), getScrollY(), 0, 0, 0, getScrollRange())) {
|
|
ViewCompat.A(this);
|
|
}
|
|
a(0);
|
|
} else {
|
|
int y2 = (int) motionEvent.getY();
|
|
if (d((int) motionEvent.getX(), y2)) {
|
|
this.f = y2;
|
|
this.q = motionEvent.getPointerId(0);
|
|
d();
|
|
this.k.addMovement(motionEvent);
|
|
this.c.computeScrollOffset();
|
|
this.j = !this.c.isFinished();
|
|
c(2, 0);
|
|
} else {
|
|
this.j = false;
|
|
g();
|
|
}
|
|
}
|
|
return this.j;
|
|
}
|
|
|
|
@Override // android.widget.FrameLayout, android.view.ViewGroup, android.view.View
|
|
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
|
super.onLayout(z, i, i2, i3, i4);
|
|
int i5 = 0;
|
|
this.g = false;
|
|
View view = this.i;
|
|
if (view != null && a(view, this)) {
|
|
b(this.i);
|
|
}
|
|
this.i = null;
|
|
if (!this.h) {
|
|
if (this.v != null) {
|
|
scrollTo(getScrollX(), this.v.scrollPosition);
|
|
this.v = null;
|
|
}
|
|
if (getChildCount() > 0) {
|
|
View childAt = getChildAt(0);
|
|
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
|
|
i5 = childAt.getMeasuredHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
|
|
}
|
|
int paddingTop = ((i4 - i2) - getPaddingTop()) - getPaddingBottom();
|
|
int scrollY = getScrollY();
|
|
int a = a(scrollY, paddingTop, i5);
|
|
if (a != scrollY) {
|
|
scrollTo(getScrollX(), a);
|
|
}
|
|
}
|
|
scrollTo(getScrollX(), getScrollY());
|
|
this.h = true;
|
|
}
|
|
|
|
@Override // android.widget.FrameLayout, android.view.View
|
|
protected void onMeasure(int i, int i2) {
|
|
super.onMeasure(i, i2);
|
|
if (this.l && View.MeasureSpec.getMode(i2) != 0 && getChildCount() > 0) {
|
|
View childAt = getChildAt(0);
|
|
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
|
|
int measuredHeight = childAt.getMeasuredHeight();
|
|
int measuredHeight2 = (((getMeasuredHeight() - getPaddingTop()) - getPaddingBottom()) - layoutParams.topMargin) - layoutParams.bottomMargin;
|
|
if (measuredHeight < measuredHeight2) {
|
|
childAt.measure(FrameLayout.getChildMeasureSpec(i, getPaddingLeft() + getPaddingRight() + layoutParams.leftMargin + layoutParams.rightMargin, layoutParams.width), View.MeasureSpec.makeMeasureSpec(measuredHeight2, 1073741824));
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
|
public boolean onNestedFling(View view, float f, float f2, boolean z) {
|
|
if (z) {
|
|
return false;
|
|
}
|
|
h((int) f2);
|
|
return true;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
|
public boolean onNestedPreFling(View view, float f, float f2) {
|
|
return dispatchNestedPreFling(f, f2);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
|
public void onNestedPreScroll(View view, int i, int i2, int[] iArr) {
|
|
a(view, i, i2, iArr, 0);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
|
public void onNestedScroll(View view, int i, int i2, int i3, int i4) {
|
|
a(view, i, i2, i3, i4, 0);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
|
public void onNestedScrollAccepted(View view, View view2, int i) {
|
|
b(view, view2, i, 0);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
protected void onOverScrolled(int i, int i2, boolean z, boolean z2) {
|
|
super.scrollTo(i, i2);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
protected boolean onRequestFocusInDescendants(int i, Rect rect) {
|
|
if (i == 2) {
|
|
i = 130;
|
|
} else if (i == 1) {
|
|
i = 33;
|
|
}
|
|
View findNextFocus = rect == null ? FocusFinder.getInstance().findNextFocus(this, null, i) : FocusFinder.getInstance().findNextFocusFromRect(this, rect, i);
|
|
if (findNextFocus == null || a(findNextFocus)) {
|
|
return false;
|
|
}
|
|
return findNextFocus.requestFocus(i, rect);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
protected void onRestoreInstanceState(Parcelable parcelable) {
|
|
if (!(parcelable instanceof SavedState)) {
|
|
super.onRestoreInstanceState(parcelable);
|
|
return;
|
|
}
|
|
SavedState savedState = (SavedState) parcelable;
|
|
super.onRestoreInstanceState(savedState.getSuperState());
|
|
this.v = savedState;
|
|
requestLayout();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
protected Parcelable onSaveInstanceState() {
|
|
SavedState savedState = new SavedState(super.onSaveInstanceState());
|
|
savedState.scrollPosition = getScrollY();
|
|
return savedState;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
protected void onScrollChanged(int i, int i2, int i3, int i4) {
|
|
super.onScrollChanged(i, i2, i3, i4);
|
|
OnScrollChangeListener onScrollChangeListener = this.A;
|
|
if (onScrollChangeListener != null) {
|
|
onScrollChangeListener.a(this, i, i2, i3, i4);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
protected void onSizeChanged(int i, int i2, int i3, int i4) {
|
|
super.onSizeChanged(i, i2, i3, i4);
|
|
View findFocus = findFocus();
|
|
if (findFocus == null || this == findFocus || !a(findFocus, 0, i4)) {
|
|
return;
|
|
}
|
|
findFocus.getDrawingRect(this.b);
|
|
offsetDescendantRectToMyCoords(findFocus, this.b);
|
|
g(a(this.b));
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
|
public boolean onStartNestedScroll(View view, View view2, int i) {
|
|
return a(view, view2, i, 0);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
|
|
public void onStopNestedScroll(View view) {
|
|
a(view, 0);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean onTouchEvent(MotionEvent motionEvent) {
|
|
ViewParent parent;
|
|
f();
|
|
MotionEvent obtain = MotionEvent.obtain(motionEvent);
|
|
int actionMasked = motionEvent.getActionMasked();
|
|
if (actionMasked == 0) {
|
|
this.t = 0;
|
|
}
|
|
obtain.offsetLocation(0.0f, this.t);
|
|
if (actionMasked != 0) {
|
|
if (actionMasked == 1) {
|
|
VelocityTracker velocityTracker = this.k;
|
|
velocityTracker.computeCurrentVelocity(1000, this.p);
|
|
int yVelocity = (int) velocityTracker.getYVelocity(this.q);
|
|
if (Math.abs(yVelocity) > this.o) {
|
|
h(-yVelocity);
|
|
} else if (this.c.springBack(getScrollX(), getScrollY(), 0, 0, 0, getScrollRange())) {
|
|
ViewCompat.A(this);
|
|
}
|
|
this.q = -1;
|
|
b();
|
|
} else if (actionMasked == 2) {
|
|
int findPointerIndex = motionEvent.findPointerIndex(this.q);
|
|
if (findPointerIndex == -1) {
|
|
Log.e("NestedScrollView", "Invalid pointerId=" + this.q + " in onTouchEvent");
|
|
} else {
|
|
int y = (int) motionEvent.getY(findPointerIndex);
|
|
int i = this.f - y;
|
|
if (a(0, i, this.s, this.r, 0)) {
|
|
i -= this.s[1];
|
|
obtain.offsetLocation(0.0f, this.r[1]);
|
|
this.t += this.r[1];
|
|
}
|
|
if (!this.j && Math.abs(i) > this.n) {
|
|
ViewParent parent2 = getParent();
|
|
if (parent2 != null) {
|
|
parent2.requestDisallowInterceptTouchEvent(true);
|
|
}
|
|
this.j = true;
|
|
i = i > 0 ? i - this.n : i + this.n;
|
|
}
|
|
int i2 = i;
|
|
if (this.j) {
|
|
this.f = y - this.r[1];
|
|
int scrollY = getScrollY();
|
|
int scrollRange = getScrollRange();
|
|
int overScrollMode = getOverScrollMode();
|
|
boolean z = overScrollMode == 0 || (overScrollMode == 1 && scrollRange > 0);
|
|
if (a(0, i2, 0, getScrollY(), 0, scrollRange, 0, 0, true) && !e(0)) {
|
|
this.k.clear();
|
|
}
|
|
int scrollY2 = getScrollY() - scrollY;
|
|
if (a(0, scrollY2, 0, i2 - scrollY2, this.r, 0)) {
|
|
this.f = this.f - this.r[1];
|
|
obtain.offsetLocation(0.0f, r1[1]);
|
|
this.t += this.r[1];
|
|
} else if (z) {
|
|
c();
|
|
int i3 = scrollY + i2;
|
|
if (i3 < 0) {
|
|
EdgeEffectCompat.a(this.d, i2 / getHeight(), motionEvent.getX(findPointerIndex) / getWidth());
|
|
if (!this.e.isFinished()) {
|
|
this.e.onRelease();
|
|
}
|
|
} else if (i3 > scrollRange) {
|
|
EdgeEffectCompat.a(this.e, i2 / getHeight(), 1.0f - (motionEvent.getX(findPointerIndex) / getWidth()));
|
|
if (!this.d.isFinished()) {
|
|
this.d.onRelease();
|
|
}
|
|
}
|
|
EdgeEffect edgeEffect = this.d;
|
|
if (edgeEffect != null && (!edgeEffect.isFinished() || !this.e.isFinished())) {
|
|
ViewCompat.A(this);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if (actionMasked == 3) {
|
|
if (this.j && getChildCount() > 0 && this.c.springBack(getScrollX(), getScrollY(), 0, 0, 0, getScrollRange())) {
|
|
ViewCompat.A(this);
|
|
}
|
|
this.q = -1;
|
|
b();
|
|
} else if (actionMasked == 5) {
|
|
int actionIndex = motionEvent.getActionIndex();
|
|
this.f = (int) motionEvent.getY(actionIndex);
|
|
this.q = motionEvent.getPointerId(actionIndex);
|
|
} else if (actionMasked == 6) {
|
|
a(motionEvent);
|
|
this.f = (int) motionEvent.getY(motionEvent.findPointerIndex(this.q));
|
|
}
|
|
} else {
|
|
if (getChildCount() == 0) {
|
|
return false;
|
|
}
|
|
boolean z2 = !this.c.isFinished();
|
|
this.j = z2;
|
|
if (z2 && (parent = getParent()) != null) {
|
|
parent.requestDisallowInterceptTouchEvent(true);
|
|
}
|
|
if (!this.c.isFinished()) {
|
|
this.c.abortAnimation();
|
|
}
|
|
this.f = (int) motionEvent.getY();
|
|
this.q = motionEvent.getPointerId(0);
|
|
c(2, 0);
|
|
}
|
|
VelocityTracker velocityTracker2 = this.k;
|
|
if (velocityTracker2 != null) {
|
|
velocityTracker2.addMovement(obtain);
|
|
}
|
|
obtain.recycle();
|
|
return true;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent
|
|
public void requestChildFocus(View view, View view2) {
|
|
if (this.g) {
|
|
this.i = view2;
|
|
} else {
|
|
b(view2);
|
|
}
|
|
super.requestChildFocus(view, view2);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent
|
|
public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z) {
|
|
rect.offset(view.getLeft() - view.getScrollX(), view.getTop() - view.getScrollY());
|
|
return a(rect, z);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent
|
|
public void requestDisallowInterceptTouchEvent(boolean z) {
|
|
if (z) {
|
|
g();
|
|
}
|
|
super.requestDisallowInterceptTouchEvent(z);
|
|
}
|
|
|
|
@Override // android.view.View, android.view.ViewParent
|
|
public void requestLayout() {
|
|
this.g = true;
|
|
super.requestLayout();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void scrollTo(int i, int i2) {
|
|
if (getChildCount() > 0) {
|
|
View childAt = getChildAt(0);
|
|
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
|
|
int width = (getWidth() - getPaddingLeft()) - getPaddingRight();
|
|
int width2 = childAt.getWidth() + layoutParams.leftMargin + layoutParams.rightMargin;
|
|
int height = (getHeight() - getPaddingTop()) - getPaddingBottom();
|
|
int height2 = childAt.getHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
|
|
int a = a(i, width, width2);
|
|
int a2 = a(i2, height, height2);
|
|
if (a == getScrollX() && a2 == getScrollY()) {
|
|
return;
|
|
}
|
|
super.scrollTo(a, a2);
|
|
}
|
|
}
|
|
|
|
public void setFillViewport(boolean z) {
|
|
if (z != this.l) {
|
|
this.l = z;
|
|
requestLayout();
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void setNestedScrollingEnabled(boolean z) {
|
|
this.y.a(z);
|
|
}
|
|
|
|
public void setOnScrollChangeListener(OnScrollChangeListener onScrollChangeListener) {
|
|
this.A = onScrollChangeListener;
|
|
}
|
|
|
|
public void setSmoothScrollingEnabled(boolean z) {
|
|
this.m = z;
|
|
}
|
|
|
|
@Override // android.widget.FrameLayout, android.view.ViewGroup
|
|
public boolean shouldDelayChildPressedState() {
|
|
return true;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean startNestedScroll(int i) {
|
|
return c(i, 0);
|
|
}
|
|
|
|
@Override // android.view.View, androidx.core.view.NestedScrollingChild
|
|
public void stopNestedScroll() {
|
|
a(0);
|
|
}
|
|
|
|
public NestedScrollView(Context context, AttributeSet attributeSet) {
|
|
this(context, attributeSet, 0);
|
|
}
|
|
|
|
private void e() {
|
|
this.c = new OverScroller(getContext());
|
|
setFocusable(true);
|
|
setDescendantFocusability(262144);
|
|
setWillNotDraw(false);
|
|
ViewConfiguration viewConfiguration = ViewConfiguration.get(getContext());
|
|
this.n = viewConfiguration.getScaledTouchSlop();
|
|
this.o = viewConfiguration.getScaledMinimumFlingVelocity();
|
|
this.p = viewConfiguration.getScaledMaximumFlingVelocity();
|
|
}
|
|
|
|
public boolean a(int i, int i2, int i3, int i4, int[] iArr, int i5) {
|
|
return this.y.a(i, i2, i3, i4, iArr, i5);
|
|
}
|
|
|
|
public void c(int i) {
|
|
if (getChildCount() > 0) {
|
|
c(2, 1);
|
|
this.c.fling(getScrollX(), getScrollY(), 0, i, 0, 0, Integer.MIN_VALUE, Integer.MAX_VALUE, 0, 0);
|
|
this.u = getScrollY();
|
|
ViewCompat.A(this);
|
|
}
|
|
}
|
|
|
|
public NestedScrollView(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
this.b = new Rect();
|
|
this.g = true;
|
|
this.h = false;
|
|
this.i = null;
|
|
this.j = false;
|
|
this.m = true;
|
|
this.q = -1;
|
|
this.r = new int[2];
|
|
this.s = new int[2];
|
|
e();
|
|
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, C, i, 0);
|
|
setFillViewport(obtainStyledAttributes.getBoolean(0, false));
|
|
obtainStyledAttributes.recycle();
|
|
this.x = new NestedScrollingParentHelper(this);
|
|
this.y = new NestedScrollingChildHelper(this);
|
|
setNestedScrollingEnabled(true);
|
|
ViewCompat.a(this, B);
|
|
}
|
|
|
|
private boolean b(int i, int i2, int i3) {
|
|
int height = getHeight();
|
|
int scrollY = getScrollY();
|
|
int i4 = height + scrollY;
|
|
boolean z = false;
|
|
boolean z2 = i == 33;
|
|
View a = a(z2, i2, i3);
|
|
if (a == null) {
|
|
a = this;
|
|
}
|
|
if (i2 < scrollY || i3 > i4) {
|
|
g(z2 ? i2 - scrollY : i3 - i4);
|
|
z = true;
|
|
}
|
|
if (a != findFocus()) {
|
|
a.requestFocus(i);
|
|
}
|
|
return z;
|
|
}
|
|
|
|
public boolean a(int i, int i2, int[] iArr, int[] iArr2, int i3) {
|
|
return this.y.a(i, i2, iArr, iArr2, i3);
|
|
}
|
|
|
|
public boolean f(int i) {
|
|
boolean z = i == 130;
|
|
int height = getHeight();
|
|
if (z) {
|
|
this.b.top = getScrollY() + height;
|
|
int childCount = getChildCount();
|
|
if (childCount > 0) {
|
|
View childAt = getChildAt(childCount - 1);
|
|
int bottom = childAt.getBottom() + ((FrameLayout.LayoutParams) childAt.getLayoutParams()).bottomMargin + getPaddingBottom();
|
|
Rect rect = this.b;
|
|
if (rect.top + height > bottom) {
|
|
rect.top = bottom - height;
|
|
}
|
|
}
|
|
} else {
|
|
this.b.top = getScrollY() - height;
|
|
Rect rect2 = this.b;
|
|
if (rect2.top < 0) {
|
|
rect2.top = 0;
|
|
}
|
|
}
|
|
Rect rect3 = this.b;
|
|
int i2 = rect3.top;
|
|
rect3.bottom = height + i2;
|
|
return b(i, i2, rect3.bottom);
|
|
}
|
|
|
|
private void g(int i) {
|
|
if (i != 0) {
|
|
if (this.m) {
|
|
a(0, i);
|
|
} else {
|
|
scrollBy(0, i);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // androidx.core.view.NestedScrollingParent2
|
|
public void a(View view, int i) {
|
|
this.x.a(view, i);
|
|
a(i);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public void addView(View view, int i) {
|
|
if (getChildCount() <= 0) {
|
|
super.addView(view, i);
|
|
return;
|
|
}
|
|
throw new IllegalStateException("ScrollView can host only one direct child");
|
|
}
|
|
|
|
@Override // androidx.core.view.NestedScrollingParent2
|
|
public void a(View view, int i, int i2, int i3, int i4, int i5) {
|
|
int scrollY = getScrollY();
|
|
scrollBy(0, i4);
|
|
int scrollY2 = getScrollY() - scrollY;
|
|
a(0, scrollY2, 0, i4 - scrollY2, (int[]) null, i5);
|
|
}
|
|
|
|
private void c() {
|
|
if (getOverScrollMode() != 2) {
|
|
if (this.d == null) {
|
|
Context context = getContext();
|
|
this.d = new EdgeEffect(context);
|
|
this.e = new EdgeEffect(context);
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
this.d = null;
|
|
this.e = null;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewManager
|
|
public void addView(View view, ViewGroup.LayoutParams layoutParams) {
|
|
if (getChildCount() <= 0) {
|
|
super.addView(view, layoutParams);
|
|
return;
|
|
}
|
|
throw new IllegalStateException("ScrollView can host only one direct child");
|
|
}
|
|
|
|
private void d() {
|
|
VelocityTracker velocityTracker = this.k;
|
|
if (velocityTracker == null) {
|
|
this.k = VelocityTracker.obtain();
|
|
} else {
|
|
velocityTracker.clear();
|
|
}
|
|
}
|
|
|
|
public boolean b(int i) {
|
|
View findFocus = findFocus();
|
|
if (findFocus == this) {
|
|
findFocus = null;
|
|
}
|
|
View findNextFocus = FocusFinder.getInstance().findNextFocus(this, findFocus, i);
|
|
int maxScrollAmount = getMaxScrollAmount();
|
|
if (findNextFocus != null && a(findNextFocus, maxScrollAmount, getHeight())) {
|
|
findNextFocus.getDrawingRect(this.b);
|
|
offsetDescendantRectToMyCoords(findNextFocus, this.b);
|
|
g(a(this.b));
|
|
findNextFocus.requestFocus(i);
|
|
} else {
|
|
if (i == 33 && getScrollY() < maxScrollAmount) {
|
|
maxScrollAmount = getScrollY();
|
|
} else if (i == 130 && getChildCount() > 0) {
|
|
View childAt = getChildAt(0);
|
|
maxScrollAmount = Math.min((childAt.getBottom() + ((FrameLayout.LayoutParams) childAt.getLayoutParams()).bottomMargin) - ((getScrollY() + getHeight()) - getPaddingBottom()), maxScrollAmount);
|
|
}
|
|
if (maxScrollAmount == 0) {
|
|
return false;
|
|
}
|
|
if (i != 130) {
|
|
maxScrollAmount = -maxScrollAmount;
|
|
}
|
|
g(maxScrollAmount);
|
|
}
|
|
if (findFocus == null || !findFocus.isFocused() || !a(findFocus)) {
|
|
return true;
|
|
}
|
|
int descendantFocusability = getDescendantFocusability();
|
|
setDescendantFocusability(131072);
|
|
requestFocus();
|
|
setDescendantFocusability(descendantFocusability);
|
|
return true;
|
|
}
|
|
|
|
@Override // androidx.core.view.NestedScrollingParent2
|
|
public void a(View view, int i, int i2, int[] iArr, int i3) {
|
|
a(i, i2, iArr, (int[]) null, i3);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
|
|
if (getChildCount() <= 0) {
|
|
super.addView(view, i, layoutParams);
|
|
return;
|
|
}
|
|
throw new IllegalStateException("ScrollView can host only one direct child");
|
|
}
|
|
|
|
private boolean a() {
|
|
if (getChildCount() <= 0) {
|
|
return false;
|
|
}
|
|
View childAt = getChildAt(0);
|
|
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
|
|
return (childAt.getHeight() + layoutParams.topMargin) + layoutParams.bottomMargin > (getHeight() - getPaddingTop()) - getPaddingBottom();
|
|
}
|
|
|
|
public boolean d(int i) {
|
|
int childCount;
|
|
boolean z = i == 130;
|
|
int height = getHeight();
|
|
Rect rect = this.b;
|
|
rect.top = 0;
|
|
rect.bottom = height;
|
|
if (z && (childCount = getChildCount()) > 0) {
|
|
View childAt = getChildAt(childCount - 1);
|
|
this.b.bottom = childAt.getBottom() + ((FrameLayout.LayoutParams) childAt.getLayoutParams()).bottomMargin + getPaddingBottom();
|
|
Rect rect2 = this.b;
|
|
rect2.top = rect2.bottom - height;
|
|
}
|
|
Rect rect3 = this.b;
|
|
return b(i, rect3.top, rect3.bottom);
|
|
}
|
|
|
|
static class AccessibilityDelegate extends AccessibilityDelegateCompat {
|
|
AccessibilityDelegate() {
|
|
}
|
|
|
|
@Override // androidx.core.view.AccessibilityDelegateCompat
|
|
public boolean a(View view, int i, Bundle bundle) {
|
|
if (super.a(view, i, bundle)) {
|
|
return true;
|
|
}
|
|
NestedScrollView nestedScrollView = (NestedScrollView) view;
|
|
if (!nestedScrollView.isEnabled()) {
|
|
return false;
|
|
}
|
|
if (i == 4096) {
|
|
int min = Math.min(nestedScrollView.getScrollY() + ((nestedScrollView.getHeight() - nestedScrollView.getPaddingBottom()) - nestedScrollView.getPaddingTop()), nestedScrollView.getScrollRange());
|
|
if (min == nestedScrollView.getScrollY()) {
|
|
return false;
|
|
}
|
|
nestedScrollView.b(0, min);
|
|
return true;
|
|
}
|
|
if (i != 8192) {
|
|
return false;
|
|
}
|
|
int max = Math.max(nestedScrollView.getScrollY() - ((nestedScrollView.getHeight() - nestedScrollView.getPaddingBottom()) - nestedScrollView.getPaddingTop()), 0);
|
|
if (max == nestedScrollView.getScrollY()) {
|
|
return false;
|
|
}
|
|
nestedScrollView.b(0, max);
|
|
return true;
|
|
}
|
|
|
|
@Override // androidx.core.view.AccessibilityDelegateCompat
|
|
public void b(View view, AccessibilityEvent accessibilityEvent) {
|
|
super.b(view, accessibilityEvent);
|
|
NestedScrollView nestedScrollView = (NestedScrollView) view;
|
|
accessibilityEvent.setClassName(ScrollView.class.getName());
|
|
accessibilityEvent.setScrollable(nestedScrollView.getScrollRange() > 0);
|
|
accessibilityEvent.setScrollX(nestedScrollView.getScrollX());
|
|
accessibilityEvent.setScrollY(nestedScrollView.getScrollY());
|
|
AccessibilityRecordCompat.a(accessibilityEvent, nestedScrollView.getScrollX());
|
|
AccessibilityRecordCompat.b(accessibilityEvent, nestedScrollView.getScrollRange());
|
|
}
|
|
|
|
@Override // androidx.core.view.AccessibilityDelegateCompat
|
|
public void a(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
|
|
int scrollRange;
|
|
super.a(view, accessibilityNodeInfoCompat);
|
|
NestedScrollView nestedScrollView = (NestedScrollView) view;
|
|
accessibilityNodeInfoCompat.a((CharSequence) ScrollView.class.getName());
|
|
if (!nestedScrollView.isEnabled() || (scrollRange = nestedScrollView.getScrollRange()) <= 0) {
|
|
return;
|
|
}
|
|
accessibilityNodeInfoCompat.d(true);
|
|
if (nestedScrollView.getScrollY() > 0) {
|
|
accessibilityNodeInfoCompat.a(UnityActivity.BLOCKLY_TYPE_NONE);
|
|
}
|
|
if (nestedScrollView.getScrollY() < scrollRange) {
|
|
accessibilityNodeInfoCompat.a(FileUtil.ZIP_BUFFER_SIZE);
|
|
}
|
|
}
|
|
}
|
|
|
|
public boolean a(KeyEvent keyEvent) {
|
|
this.b.setEmpty();
|
|
if (!a()) {
|
|
if (!isFocused() || keyEvent.getKeyCode() == 4) {
|
|
return false;
|
|
}
|
|
View findFocus = findFocus();
|
|
if (findFocus == this) {
|
|
findFocus = null;
|
|
}
|
|
View findNextFocus = FocusFinder.getInstance().findNextFocus(this, findFocus, 130);
|
|
return (findNextFocus == null || findNextFocus == this || !findNextFocus.requestFocus(130)) ? false : true;
|
|
}
|
|
if (keyEvent.getAction() != 0) {
|
|
return false;
|
|
}
|
|
int keyCode = keyEvent.getKeyCode();
|
|
if (keyCode == 19) {
|
|
if (!keyEvent.isAltPressed()) {
|
|
return b(33);
|
|
}
|
|
return d(33);
|
|
}
|
|
if (keyCode == 20) {
|
|
if (!keyEvent.isAltPressed()) {
|
|
return b(130);
|
|
}
|
|
return d(130);
|
|
}
|
|
if (keyCode != 62) {
|
|
return false;
|
|
}
|
|
f(keyEvent.isShiftPressed() ? 33 : 130);
|
|
return false;
|
|
}
|
|
|
|
private void a(MotionEvent motionEvent) {
|
|
int actionIndex = motionEvent.getActionIndex();
|
|
if (motionEvent.getPointerId(actionIndex) == this.q) {
|
|
int i = actionIndex == 0 ? 1 : 0;
|
|
this.f = (int) motionEvent.getY(i);
|
|
this.q = motionEvent.getPointerId(i);
|
|
VelocityTracker velocityTracker = this.k;
|
|
if (velocityTracker != null) {
|
|
velocityTracker.clear();
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void b(int i, int i2) {
|
|
a(i - getScrollX(), i2 - getScrollY());
|
|
}
|
|
|
|
private void b(View view) {
|
|
view.getDrawingRect(this.b);
|
|
offsetDescendantRectToMyCoords(view, this.b);
|
|
int a = a(this.b);
|
|
if (a != 0) {
|
|
scrollBy(0, a);
|
|
}
|
|
}
|
|
|
|
private void b() {
|
|
this.j = false;
|
|
g();
|
|
a(0);
|
|
EdgeEffect edgeEffect = this.d;
|
|
if (edgeEffect != null) {
|
|
edgeEffect.onRelease();
|
|
this.e.onRelease();
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:26:0x0057 */
|
|
/* JADX WARN: Removed duplicated region for block: B:29:0x0061 */
|
|
/* JADX WARN: Removed duplicated region for block: B:34:0x0083 A[ADDED_TO_REGION] */
|
|
/* JADX WARN: Removed duplicated region for block: B:38:0x005a */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
|
*/
|
|
boolean a(int r13, int r14, int r15, int r16, int r17, int r18, int r19, int r20, boolean r21) {
|
|
/*
|
|
r12 = this;
|
|
r0 = r12
|
|
int r1 = r12.getOverScrollMode()
|
|
int r2 = r12.computeHorizontalScrollRange()
|
|
int r3 = r12.computeHorizontalScrollExtent()
|
|
r4 = 0
|
|
r5 = 1
|
|
if (r2 <= r3) goto L13
|
|
r2 = 1
|
|
goto L14
|
|
L13:
|
|
r2 = 0
|
|
L14:
|
|
int r3 = r12.computeVerticalScrollRange()
|
|
int r6 = r12.computeVerticalScrollExtent()
|
|
if (r3 <= r6) goto L20
|
|
r3 = 1
|
|
goto L21
|
|
L20:
|
|
r3 = 0
|
|
L21:
|
|
if (r1 == 0) goto L2a
|
|
if (r1 != r5) goto L28
|
|
if (r2 == 0) goto L28
|
|
goto L2a
|
|
L28:
|
|
r2 = 0
|
|
goto L2b
|
|
L2a:
|
|
r2 = 1
|
|
L2b:
|
|
if (r1 == 0) goto L34
|
|
if (r1 != r5) goto L32
|
|
if (r3 == 0) goto L32
|
|
goto L34
|
|
L32:
|
|
r1 = 0
|
|
goto L35
|
|
L34:
|
|
r1 = 1
|
|
L35:
|
|
int r3 = r15 + r13
|
|
if (r2 != 0) goto L3b
|
|
r2 = 0
|
|
goto L3d
|
|
L3b:
|
|
r2 = r19
|
|
L3d:
|
|
int r6 = r16 + r14
|
|
if (r1 != 0) goto L43
|
|
r1 = 0
|
|
goto L45
|
|
L43:
|
|
r1 = r20
|
|
L45:
|
|
int r7 = -r2
|
|
int r2 = r2 + r17
|
|
int r8 = -r1
|
|
int r1 = r1 + r18
|
|
if (r3 <= r2) goto L50
|
|
r7 = r2
|
|
L4e:
|
|
r2 = 1
|
|
goto L55
|
|
L50:
|
|
if (r3 >= r7) goto L53
|
|
goto L4e
|
|
L53:
|
|
r7 = r3
|
|
r2 = 0
|
|
L55:
|
|
if (r6 <= r1) goto L5a
|
|
r6 = r1
|
|
L58:
|
|
r1 = 1
|
|
goto L5f
|
|
L5a:
|
|
if (r6 >= r8) goto L5e
|
|
r6 = r8
|
|
goto L58
|
|
L5e:
|
|
r1 = 0
|
|
L5f:
|
|
if (r1 == 0) goto L7e
|
|
boolean r3 = r12.e(r5)
|
|
if (r3 != 0) goto L7e
|
|
android.widget.OverScroller r3 = r0.c
|
|
r8 = 0
|
|
r9 = 0
|
|
r10 = 0
|
|
int r11 = r12.getScrollRange()
|
|
r13 = r3
|
|
r14 = r7
|
|
r15 = r6
|
|
r16 = r8
|
|
r17 = r9
|
|
r18 = r10
|
|
r19 = r11
|
|
r13.springBack(r14, r15, r16, r17, r18, r19)
|
|
L7e:
|
|
r12.onOverScrolled(r7, r6, r2, r1)
|
|
if (r2 != 0) goto L85
|
|
if (r1 == 0) goto L86
|
|
L85:
|
|
r4 = 1
|
|
L86:
|
|
return r4
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: androidx.core.widget.NestedScrollView.a(int, int, int, int, int, int, int, int, boolean):boolean");
|
|
}
|
|
|
|
private View a(boolean z, int i, int i2) {
|
|
ArrayList focusables = getFocusables(2);
|
|
int size = focusables.size();
|
|
View view = null;
|
|
boolean z2 = false;
|
|
for (int i3 = 0; i3 < size; i3++) {
|
|
View view2 = (View) focusables.get(i3);
|
|
int top = view2.getTop();
|
|
int bottom = view2.getBottom();
|
|
if (i < bottom && top < i2) {
|
|
boolean z3 = i < top && bottom < i2;
|
|
if (view == null) {
|
|
view = view2;
|
|
z2 = z3;
|
|
} else {
|
|
boolean z4 = (z && top < view.getTop()) || (!z && bottom > view.getBottom());
|
|
if (z2) {
|
|
if (z3) {
|
|
if (!z4) {
|
|
}
|
|
view = view2;
|
|
}
|
|
} else if (z3) {
|
|
view = view2;
|
|
z2 = true;
|
|
} else {
|
|
if (!z4) {
|
|
}
|
|
view = view2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return view;
|
|
}
|
|
|
|
private boolean a(View view) {
|
|
return !a(view, 0, getHeight());
|
|
}
|
|
|
|
private boolean a(View view, int i, int i2) {
|
|
view.getDrawingRect(this.b);
|
|
offsetDescendantRectToMyCoords(view, this.b);
|
|
return this.b.bottom + i >= getScrollY() && this.b.top - i <= getScrollY() + i2;
|
|
}
|
|
|
|
public final void a(int i, int i2) {
|
|
if (getChildCount() == 0) {
|
|
return;
|
|
}
|
|
if (AnimationUtils.currentAnimationTimeMillis() - this.a > 250) {
|
|
View childAt = getChildAt(0);
|
|
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
|
|
int height = childAt.getHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
|
|
int height2 = (getHeight() - getPaddingTop()) - getPaddingBottom();
|
|
int scrollY = getScrollY();
|
|
int max = Math.max(0, Math.min(i2 + scrollY, Math.max(0, height - height2))) - scrollY;
|
|
this.u = getScrollY();
|
|
this.c.startScroll(getScrollX(), scrollY, 0, max);
|
|
ViewCompat.A(this);
|
|
} else {
|
|
if (!this.c.isFinished()) {
|
|
this.c.abortAnimation();
|
|
}
|
|
scrollBy(i, i2);
|
|
}
|
|
this.a = AnimationUtils.currentAnimationTimeMillis();
|
|
}
|
|
|
|
private boolean a(Rect rect, boolean z) {
|
|
int a = a(rect);
|
|
boolean z2 = a != 0;
|
|
if (z2) {
|
|
if (z) {
|
|
scrollBy(0, a);
|
|
} else {
|
|
a(0, a);
|
|
}
|
|
}
|
|
return z2;
|
|
}
|
|
|
|
protected int a(Rect rect) {
|
|
int i;
|
|
int i2;
|
|
if (getChildCount() == 0) {
|
|
return 0;
|
|
}
|
|
int height = getHeight();
|
|
int scrollY = getScrollY();
|
|
int i3 = scrollY + height;
|
|
int verticalFadingEdgeLength = getVerticalFadingEdgeLength();
|
|
if (rect.top > 0) {
|
|
scrollY += verticalFadingEdgeLength;
|
|
}
|
|
View childAt = getChildAt(0);
|
|
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
|
|
int i4 = rect.bottom < (childAt.getHeight() + layoutParams.topMargin) + layoutParams.bottomMargin ? i3 - verticalFadingEdgeLength : i3;
|
|
if (rect.bottom > i4 && rect.top > scrollY) {
|
|
if (rect.height() > height) {
|
|
i2 = rect.top - scrollY;
|
|
} else {
|
|
i2 = rect.bottom - i4;
|
|
}
|
|
return Math.min(i2 + 0, (childAt.getBottom() + layoutParams.bottomMargin) - i3);
|
|
}
|
|
if (rect.top >= scrollY || rect.bottom >= i4) {
|
|
return 0;
|
|
}
|
|
if (rect.height() > height) {
|
|
i = 0 - (i4 - rect.bottom);
|
|
} else {
|
|
i = 0 - (scrollY - rect.top);
|
|
}
|
|
return Math.max(i, -getScrollY());
|
|
}
|
|
|
|
private static boolean a(View view, View view2) {
|
|
if (view == view2) {
|
|
return true;
|
|
}
|
|
Object parent = view.getParent();
|
|
return (parent instanceof ViewGroup) && a((View) parent, view2);
|
|
}
|
|
}
|