906 lines
29 KiB
Java
906 lines
29 KiB
Java
package androidx.swiperefreshlayout.widget;
|
|
|
|
import android.R;
|
|
import android.content.Context;
|
|
import android.content.res.TypedArray;
|
|
import android.util.AttributeSet;
|
|
import android.util.DisplayMetrics;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.view.ViewConfiguration;
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewParent;
|
|
import android.view.animation.Animation;
|
|
import android.view.animation.DecelerateInterpolator;
|
|
import android.view.animation.Transformation;
|
|
import android.widget.ListView;
|
|
import androidx.core.view.ViewCompat;
|
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
import o.C16515owF;
|
|
import o.FgG;
|
|
import o.JXX;
|
|
import o.USI;
|
|
import o.nMh;
|
|
import o.sVs;
|
|
import o.uto;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class SwipeRefreshLayout extends ViewGroup implements sVs {
|
|
private static final int[] m = {R.attr.enabled};
|
|
private final JXX A;
|
|
private final FgG B;
|
|
private boolean C;
|
|
private boolean D;
|
|
private boolean E;
|
|
private Animation F;
|
|
private final int[] G;
|
|
private Animation.AnimationListener H;
|
|
private final int[] I;
|
|
private View J;
|
|
private Animation K;
|
|
private float L;
|
|
private float M;
|
|
private Animation N;
|
|
private int Q;
|
|
protected int a;
|
|
Sts b;
|
|
boolean c;
|
|
int d;
|
|
CircleImageView e;
|
|
protected int f;
|
|
public boolean g;
|
|
int h;
|
|
uto i;
|
|
boolean j;
|
|
private Animation k;
|
|
private int l;
|
|
float n;
|
|
|
|
/* renamed from: o, reason: collision with root package name */
|
|
boolean f6397o;
|
|
private Animation p;
|
|
private final Animation q;
|
|
private final Animation r;
|
|
private RVV s;
|
|
private int t;
|
|
private int u;
|
|
private float v;
|
|
private final DecelerateInterpolator w;
|
|
private int x;
|
|
private float y;
|
|
private int z;
|
|
|
|
/* loaded from: classes.dex */
|
|
public interface RVV {
|
|
boolean e();
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public interface Sts {
|
|
void e();
|
|
}
|
|
|
|
final void b() {
|
|
this.e.clearAnimation();
|
|
this.i.stop();
|
|
this.e.setVisibility(8);
|
|
this.e.getBackground().setAlpha(255);
|
|
this.i.setAlpha(255);
|
|
if (!this.j) {
|
|
int i = this.f - this.d;
|
|
this.e.bringToFront();
|
|
ViewCompat.d(this.e, i);
|
|
this.d = this.e.getTop();
|
|
} else {
|
|
this.e.setScaleX(BitmapDescriptorFactory.HUE_RED);
|
|
this.e.setScaleY(BitmapDescriptorFactory.HUE_RED);
|
|
}
|
|
this.d = this.e.getTop();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void setEnabled(boolean z) {
|
|
super.setEnabled(z);
|
|
if (z) {
|
|
return;
|
|
}
|
|
b();
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
protected void onDetachedFromWindow() {
|
|
super.onDetachedFromWindow();
|
|
b();
|
|
}
|
|
|
|
public void setProgressViewOffset(boolean z, int i, int i2) {
|
|
this.j = z;
|
|
this.f = i;
|
|
this.h = i2;
|
|
this.f6397o = true;
|
|
b();
|
|
this.g = false;
|
|
}
|
|
|
|
public void setProgressViewEndTarget(boolean z, int i) {
|
|
this.h = i;
|
|
this.j = z;
|
|
this.e.invalidate();
|
|
}
|
|
|
|
public void setSize(int i) {
|
|
if (i == 0 || i == 1) {
|
|
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
|
|
if (i == 0) {
|
|
this.t = (int) (displayMetrics.density * 56.0f);
|
|
} else {
|
|
this.t = (int) (displayMetrics.density * 40.0f);
|
|
}
|
|
this.e.setImageDrawable(null);
|
|
this.i.c(i);
|
|
this.e.setImageDrawable(this.i);
|
|
}
|
|
}
|
|
|
|
public SwipeRefreshLayout(Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
public SwipeRefreshLayout(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
this.g = false;
|
|
this.L = -1.0f;
|
|
this.G = new int[2];
|
|
this.I = new int[2];
|
|
this.l = -1;
|
|
this.u = -1;
|
|
this.H = new Animation.AnimationListener(this) { // from class: androidx.swiperefreshlayout.widget.SwipeRefreshLayout.2
|
|
final SwipeRefreshLayout b;
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public final void onAnimationRepeat(Animation animation) {
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public final void onAnimationStart(Animation animation) {
|
|
}
|
|
|
|
{
|
|
this.b = this;
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public final void onAnimationEnd(Animation animation) {
|
|
if (this.b.g) {
|
|
this.b.i.setAlpha(255);
|
|
this.b.i.start();
|
|
if (this.b.c && this.b.b != null) {
|
|
this.b.b.e();
|
|
}
|
|
SwipeRefreshLayout swipeRefreshLayout = this.b;
|
|
swipeRefreshLayout.d = swipeRefreshLayout.e.getTop();
|
|
return;
|
|
}
|
|
this.b.b();
|
|
}
|
|
};
|
|
this.r = new Animation(this) { // from class: androidx.swiperefreshlayout.widget.SwipeRefreshLayout.9
|
|
final SwipeRefreshLayout a;
|
|
|
|
{
|
|
this.a = this;
|
|
}
|
|
|
|
@Override // android.view.animation.Animation
|
|
public final void applyTransformation(float f, Transformation transformation) {
|
|
int i;
|
|
if (!this.a.f6397o) {
|
|
i = this.a.h - Math.abs(this.a.f);
|
|
} else {
|
|
i = this.a.h;
|
|
}
|
|
int top = this.a.e.getTop();
|
|
SwipeRefreshLayout swipeRefreshLayout = this.a;
|
|
swipeRefreshLayout.e.bringToFront();
|
|
ViewCompat.d(swipeRefreshLayout.e, (this.a.a + ((int) ((i - this.a.a) * f))) - top);
|
|
swipeRefreshLayout.d = swipeRefreshLayout.e.getTop();
|
|
uto utoVar = this.a.i;
|
|
float f2 = 1.0f - f;
|
|
uto.IeS ieS = utoVar.b;
|
|
if (f2 != ieS.b) {
|
|
ieS.b = f2;
|
|
}
|
|
utoVar.invalidateSelf();
|
|
}
|
|
};
|
|
this.q = new Animation(this) { // from class: androidx.swiperefreshlayout.widget.SwipeRefreshLayout.8
|
|
final SwipeRefreshLayout d;
|
|
|
|
{
|
|
this.d = this;
|
|
}
|
|
|
|
@Override // android.view.animation.Animation
|
|
public final void applyTransformation(float f, Transformation transformation) {
|
|
this.d.d(f);
|
|
}
|
|
};
|
|
this.Q = ViewConfiguration.get(context).getScaledTouchSlop();
|
|
this.z = getResources().getInteger(R.integer.config_mediumAnimTime);
|
|
setWillNotDraw(false);
|
|
this.w = new DecelerateInterpolator(2.0f);
|
|
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
|
|
this.t = (int) (displayMetrics.density * 40.0f);
|
|
this.e = new CircleImageView(getContext());
|
|
uto utoVar = new uto(getContext());
|
|
this.i = utoVar;
|
|
utoVar.c(1);
|
|
this.e.setImageDrawable(this.i);
|
|
this.e.setVisibility(8);
|
|
addView(this.e);
|
|
setChildrenDrawingOrderEnabled(true);
|
|
int i = (int) (displayMetrics.density * 64.0f);
|
|
this.h = i;
|
|
this.L = i;
|
|
this.A = new JXX();
|
|
this.B = new FgG(this);
|
|
setNestedScrollingEnabled(true);
|
|
int i2 = -this.t;
|
|
this.d = i2;
|
|
this.f = i2;
|
|
d(1.0f);
|
|
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, m);
|
|
setEnabled(obtainStyledAttributes.getBoolean(0, true));
|
|
obtainStyledAttributes.recycle();
|
|
}
|
|
|
|
public void setRefreshing(boolean z) {
|
|
if (!z || this.g == z) {
|
|
c(z, false);
|
|
return;
|
|
}
|
|
this.g = z;
|
|
int i = (!this.f6397o ? this.h + this.f : this.h) - this.d;
|
|
this.e.bringToFront();
|
|
ViewCompat.d(this.e, i);
|
|
this.d = this.e.getTop();
|
|
this.c = false;
|
|
Animation.AnimationListener animationListener = this.H;
|
|
this.e.setVisibility(0);
|
|
this.i.setAlpha(255);
|
|
Animation animation = new Animation(this) { // from class: androidx.swiperefreshlayout.widget.SwipeRefreshLayout.1
|
|
final SwipeRefreshLayout e;
|
|
|
|
{
|
|
this.e = this;
|
|
}
|
|
|
|
@Override // android.view.animation.Animation
|
|
public final void applyTransformation(float f, Transformation transformation) {
|
|
SwipeRefreshLayout swipeRefreshLayout = this.e;
|
|
swipeRefreshLayout.e.setScaleX(f);
|
|
swipeRefreshLayout.e.setScaleY(f);
|
|
}
|
|
};
|
|
this.F = animation;
|
|
animation.setDuration(this.z);
|
|
if (animationListener != null) {
|
|
this.e.setAnimationListener(animationListener);
|
|
}
|
|
this.e.clearAnimation();
|
|
this.e.startAnimation(this.F);
|
|
}
|
|
|
|
private void c(boolean z, boolean z2) {
|
|
if (this.g != z) {
|
|
this.c = z2;
|
|
c();
|
|
this.g = z;
|
|
if (z) {
|
|
AP_(this.d, this.H);
|
|
} else {
|
|
AS_(this.H);
|
|
}
|
|
}
|
|
}
|
|
|
|
final void AS_(Animation.AnimationListener animationListener) {
|
|
Animation animation = new Animation(this) { // from class: androidx.swiperefreshlayout.widget.SwipeRefreshLayout.5
|
|
final SwipeRefreshLayout a;
|
|
|
|
{
|
|
this.a = this;
|
|
}
|
|
|
|
@Override // android.view.animation.Animation
|
|
public final void applyTransformation(float f, Transformation transformation) {
|
|
SwipeRefreshLayout swipeRefreshLayout = this.a;
|
|
float f2 = 1.0f - f;
|
|
swipeRefreshLayout.e.setScaleX(f2);
|
|
swipeRefreshLayout.e.setScaleY(f2);
|
|
}
|
|
};
|
|
this.N = animation;
|
|
animation.setDuration(150L);
|
|
this.e.setAnimationListener(animationListener);
|
|
this.e.clearAnimation();
|
|
this.e.startAnimation(this.N);
|
|
}
|
|
|
|
private Animation AR_(int i, int i2) {
|
|
Animation animation = new Animation(this, i, i2) { // from class: androidx.swiperefreshlayout.widget.SwipeRefreshLayout.3
|
|
final int a;
|
|
final SwipeRefreshLayout b;
|
|
final int c;
|
|
|
|
{
|
|
this.b = this;
|
|
this.a = i;
|
|
this.c = i2;
|
|
}
|
|
|
|
@Override // android.view.animation.Animation
|
|
public final void applyTransformation(float f, Transformation transformation) {
|
|
this.b.i.setAlpha((int) (this.a + ((this.c - r0) * f)));
|
|
}
|
|
};
|
|
animation.setDuration(300L);
|
|
this.e.setAnimationListener(null);
|
|
this.e.clearAnimation();
|
|
this.e.startAnimation(animation);
|
|
return animation;
|
|
}
|
|
|
|
@Deprecated
|
|
public void setProgressBackgroundColor(int i) {
|
|
setProgressBackgroundColorSchemeResource(i);
|
|
}
|
|
|
|
public void setProgressBackgroundColorSchemeResource(int i) {
|
|
setProgressBackgroundColorSchemeColor(nMh.getColor(getContext(), i));
|
|
}
|
|
|
|
public void setProgressBackgroundColorSchemeColor(int i) {
|
|
this.e.setBackgroundColor(i);
|
|
}
|
|
|
|
@Deprecated
|
|
public void setColorScheme(int... iArr) {
|
|
setColorSchemeResources(iArr);
|
|
}
|
|
|
|
public void setColorSchemeResources(int... iArr) {
|
|
Context context = getContext();
|
|
int[] iArr2 = new int[iArr.length];
|
|
for (int i = 0; i < iArr.length; i++) {
|
|
iArr2[i] = nMh.getColor(context, iArr[i]);
|
|
}
|
|
setColorSchemeColors(iArr2);
|
|
}
|
|
|
|
public void setColorSchemeColors(int... iArr) {
|
|
c();
|
|
uto utoVar = this.i;
|
|
uto.IeS ieS = utoVar.b;
|
|
ieS.g = iArr;
|
|
ieS.i = 0;
|
|
ieS.h = ieS.g[0];
|
|
uto.IeS ieS2 = utoVar.b;
|
|
ieS2.i = 0;
|
|
ieS2.h = ieS2.g[0];
|
|
utoVar.invalidateSelf();
|
|
}
|
|
|
|
private void c() {
|
|
if (this.J == null) {
|
|
for (int i = 0; i < getChildCount(); i++) {
|
|
View childAt = getChildAt(i);
|
|
if (!childAt.equals(this.e)) {
|
|
this.J = childAt;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
|
int measuredWidth = getMeasuredWidth();
|
|
int measuredHeight = getMeasuredHeight();
|
|
if (getChildCount() == 0) {
|
|
return;
|
|
}
|
|
if (this.J == null) {
|
|
c();
|
|
}
|
|
View view = this.J;
|
|
if (view == null) {
|
|
return;
|
|
}
|
|
int paddingLeft = getPaddingLeft();
|
|
int paddingTop = getPaddingTop();
|
|
int paddingLeft2 = getPaddingLeft();
|
|
view.layout(paddingLeft, paddingTop, ((measuredWidth - paddingLeft2) - getPaddingRight()) + paddingLeft, ((measuredHeight - getPaddingTop()) - getPaddingBottom()) + paddingTop);
|
|
int measuredWidth2 = this.e.getMeasuredWidth();
|
|
int measuredHeight2 = this.e.getMeasuredHeight();
|
|
CircleImageView circleImageView = this.e;
|
|
int i5 = measuredWidth / 2;
|
|
int i6 = measuredWidth2 / 2;
|
|
int i7 = this.d;
|
|
circleImageView.layout(i5 - i6, i7, i5 + i6, measuredHeight2 + i7);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onMeasure(int i, int i2) {
|
|
super.onMeasure(i, i2);
|
|
if (this.J == null) {
|
|
c();
|
|
}
|
|
View view = this.J;
|
|
if (view == null) {
|
|
return;
|
|
}
|
|
view.measure(View.MeasureSpec.makeMeasureSpec((getMeasuredWidth() - getPaddingLeft()) - getPaddingRight(), 1073741824), View.MeasureSpec.makeMeasureSpec((getMeasuredHeight() - getPaddingTop()) - getPaddingBottom(), 1073741824));
|
|
this.e.measure(View.MeasureSpec.makeMeasureSpec(this.t, 1073741824), View.MeasureSpec.makeMeasureSpec(this.t, 1073741824));
|
|
this.u = -1;
|
|
for (int i3 = 0; i3 < getChildCount(); i3++) {
|
|
if (getChildAt(i3) == this.e) {
|
|
this.u = i3;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
private boolean d() {
|
|
RVV rvv = this.s;
|
|
if (rvv != null) {
|
|
return rvv.e();
|
|
}
|
|
View view = this.J;
|
|
if (view instanceof ListView) {
|
|
return USI.vy_((ListView) view, -1);
|
|
}
|
|
return view.canScrollVertically(-1);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
|
|
int findPointerIndex;
|
|
c();
|
|
int actionMasked = motionEvent.getActionMasked();
|
|
if (!isEnabled() || d() || this.g || this.D) {
|
|
return false;
|
|
}
|
|
if (actionMasked != 0) {
|
|
if (actionMasked != 1) {
|
|
if (actionMasked == 2) {
|
|
int i = this.l;
|
|
if (i == -1 || (findPointerIndex = motionEvent.findPointerIndex(i)) < 0) {
|
|
return false;
|
|
}
|
|
b(motionEvent.getY(findPointerIndex));
|
|
} else if (actionMasked != 3) {
|
|
if (actionMasked == 6) {
|
|
AQ_(motionEvent);
|
|
}
|
|
}
|
|
}
|
|
this.C = false;
|
|
this.l = -1;
|
|
} else {
|
|
int top = this.f - this.e.getTop();
|
|
this.e.bringToFront();
|
|
ViewCompat.d(this.e, top);
|
|
this.d = this.e.getTop();
|
|
int pointerId = motionEvent.getPointerId(0);
|
|
this.l = pointerId;
|
|
this.C = false;
|
|
int findPointerIndex2 = motionEvent.findPointerIndex(pointerId);
|
|
if (findPointerIndex2 < 0) {
|
|
return false;
|
|
}
|
|
this.v = motionEvent.getY(findPointerIndex2);
|
|
}
|
|
return this.C;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent
|
|
public void requestDisallowInterceptTouchEvent(boolean z) {
|
|
View view = this.J;
|
|
if (view == null || ViewCompat.I(view)) {
|
|
super.requestDisallowInterceptTouchEvent(z);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent
|
|
public boolean onStartNestedScroll(View view, View view2, int i) {
|
|
return (!isEnabled() || this.g || (i & 2) == 0) ? false : true;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent
|
|
public void onNestedPreScroll(View view, int i, int i2, int[] iArr) {
|
|
if (i2 > 0) {
|
|
float f = this.M;
|
|
if (f > BitmapDescriptorFactory.HUE_RED) {
|
|
float f2 = i2;
|
|
if (f2 > f) {
|
|
iArr[1] = i2 - ((int) f);
|
|
this.M = BitmapDescriptorFactory.HUE_RED;
|
|
} else {
|
|
this.M = f - f2;
|
|
iArr[1] = i2;
|
|
}
|
|
a(this.M);
|
|
}
|
|
}
|
|
if (this.f6397o && i2 > 0 && this.M == BitmapDescriptorFactory.HUE_RED && Math.abs(i2 - iArr[1]) > 0) {
|
|
this.e.setVisibility(8);
|
|
}
|
|
int[] iArr2 = this.G;
|
|
if (dispatchNestedPreScroll(i - iArr[0], i2 - iArr[1], iArr2, null)) {
|
|
iArr[0] = iArr[0] + iArr2[0];
|
|
iArr[1] = iArr[1] + iArr2[1];
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent
|
|
public void onNestedScroll(View view, int i, int i2, int i3, int i4) {
|
|
dispatchNestedScroll(i, i2, i3, i4, this.I);
|
|
if (i4 + this.I[1] >= 0 || d()) {
|
|
return;
|
|
}
|
|
float abs = this.M + Math.abs(r11);
|
|
this.M = abs;
|
|
a(abs);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void setNestedScrollingEnabled(boolean z) {
|
|
FgG fgG = this.B;
|
|
if (fgG.c) {
|
|
ViewCompat.K(fgG.d);
|
|
}
|
|
fgG.c = z;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent
|
|
public boolean onNestedPreFling(View view, float f, float f2) {
|
|
return dispatchNestedPreFling(f, f2);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent
|
|
public boolean onNestedFling(View view, float f, float f2, boolean z) {
|
|
return dispatchNestedFling(f, f2, z);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean dispatchNestedFling(float f, float f2, boolean z) {
|
|
return this.B.d(f, f2, z);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean dispatchNestedPreFling(float f, float f2) {
|
|
return this.B.b(f, f2);
|
|
}
|
|
|
|
private void a(float f) {
|
|
Animation animation;
|
|
Animation animation2;
|
|
uto utoVar = this.i;
|
|
uto.IeS ieS = utoVar.b;
|
|
if (!ieS.k) {
|
|
ieS.k = true;
|
|
}
|
|
utoVar.invalidateSelf();
|
|
float min = Math.min(1.0f, Math.abs(f / this.L));
|
|
float max = (Math.max((float) (min - 0.4d), BitmapDescriptorFactory.HUE_RED) * 5.0f) / 3.0f;
|
|
float abs = Math.abs(f);
|
|
float f2 = this.L;
|
|
int i = this.x;
|
|
if (i <= 0) {
|
|
i = this.f6397o ? this.h - this.f : this.h;
|
|
}
|
|
float f3 = i;
|
|
double max2 = Math.max(BitmapDescriptorFactory.HUE_RED, Math.min(abs - f2, f3 * 2.0f) / f3) / 4.0f;
|
|
float pow = ((float) (max2 - Math.pow(max2, 2.0d))) * 2.0f;
|
|
int i2 = this.f;
|
|
int i3 = (int) ((min * f3) + (f3 * pow * 2.0f));
|
|
if (this.e.getVisibility() != 0) {
|
|
this.e.setVisibility(0);
|
|
}
|
|
if (!this.j) {
|
|
this.e.setScaleX(1.0f);
|
|
this.e.setScaleY(1.0f);
|
|
}
|
|
if (this.j) {
|
|
float min2 = Math.min(1.0f, f / this.L);
|
|
this.e.setScaleX(min2);
|
|
this.e.setScaleY(min2);
|
|
}
|
|
if (f < this.L) {
|
|
if (this.i.getAlpha() > 76 && ((animation2 = this.p) == null || !animation2.hasStarted() || animation2.hasEnded())) {
|
|
this.p = AR_(this.i.getAlpha(), 76);
|
|
}
|
|
} else if (this.i.getAlpha() < 255 && ((animation = this.k) == null || !animation.hasStarted() || animation.hasEnded())) {
|
|
this.k = AR_(this.i.getAlpha(), 255);
|
|
}
|
|
uto utoVar2 = this.i;
|
|
float min3 = Math.min(0.8f, max * 0.8f);
|
|
utoVar2.b.p = BitmapDescriptorFactory.HUE_RED;
|
|
utoVar2.b.m = min3;
|
|
utoVar2.invalidateSelf();
|
|
uto utoVar3 = this.i;
|
|
float min4 = Math.min(1.0f, max);
|
|
uto.IeS ieS2 = utoVar3.b;
|
|
if (min4 != ieS2.b) {
|
|
ieS2.b = min4;
|
|
}
|
|
utoVar3.invalidateSelf();
|
|
uto utoVar4 = this.i;
|
|
utoVar4.b.l = (((max * 0.4f) - 0.25f) + (pow * 2.0f)) * 0.5f;
|
|
utoVar4.invalidateSelf();
|
|
int i4 = (i2 + i3) - this.d;
|
|
this.e.bringToFront();
|
|
ViewCompat.d(this.e, i4);
|
|
this.d = this.e.getTop();
|
|
}
|
|
|
|
private void e(float f) {
|
|
if (f > this.L) {
|
|
c(true, true);
|
|
return;
|
|
}
|
|
this.g = false;
|
|
uto utoVar = this.i;
|
|
utoVar.b.p = BitmapDescriptorFactory.HUE_RED;
|
|
utoVar.b.m = BitmapDescriptorFactory.HUE_RED;
|
|
utoVar.invalidateSelf();
|
|
Animation.AnimationListener animationListener = !this.j ? new Animation.AnimationListener(this) { // from class: androidx.swiperefreshlayout.widget.SwipeRefreshLayout.4
|
|
final SwipeRefreshLayout a;
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public final void onAnimationRepeat(Animation animation) {
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public final void onAnimationStart(Animation animation) {
|
|
}
|
|
|
|
{
|
|
this.a = this;
|
|
}
|
|
|
|
@Override // android.view.animation.Animation.AnimationListener
|
|
public final void onAnimationEnd(Animation animation) {
|
|
if (this.a.j) {
|
|
return;
|
|
}
|
|
this.a.AS_(null);
|
|
}
|
|
} : null;
|
|
int i = this.d;
|
|
if (this.j) {
|
|
this.a = i;
|
|
this.n = this.e.getScaleX();
|
|
Animation animation = new Animation(this) { // from class: androidx.swiperefreshlayout.widget.SwipeRefreshLayout.10
|
|
final SwipeRefreshLayout b;
|
|
|
|
{
|
|
this.b = this;
|
|
}
|
|
|
|
@Override // android.view.animation.Animation
|
|
public final void applyTransformation(float f2, Transformation transformation) {
|
|
float f3 = this.b.n;
|
|
float f4 = -this.b.n;
|
|
SwipeRefreshLayout swipeRefreshLayout = this.b;
|
|
float f5 = f3 + (f4 * f2);
|
|
swipeRefreshLayout.e.setScaleX(f5);
|
|
swipeRefreshLayout.e.setScaleY(f5);
|
|
this.b.d(f2);
|
|
}
|
|
};
|
|
this.K = animation;
|
|
animation.setDuration(150L);
|
|
if (animationListener != null) {
|
|
this.e.setAnimationListener(animationListener);
|
|
}
|
|
this.e.clearAnimation();
|
|
this.e.startAnimation(this.K);
|
|
} else {
|
|
this.a = i;
|
|
this.q.reset();
|
|
this.q.setDuration(200L);
|
|
this.q.setInterpolator(this.w);
|
|
if (animationListener != null) {
|
|
this.e.setAnimationListener(animationListener);
|
|
}
|
|
this.e.clearAnimation();
|
|
this.e.startAnimation(this.q);
|
|
}
|
|
uto utoVar2 = this.i;
|
|
uto.IeS ieS = utoVar2.b;
|
|
if (ieS.k) {
|
|
ieS.k = false;
|
|
}
|
|
utoVar2.invalidateSelf();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean onTouchEvent(MotionEvent motionEvent) {
|
|
int actionMasked = motionEvent.getActionMasked();
|
|
if (!isEnabled() || d() || this.g || this.D) {
|
|
return false;
|
|
}
|
|
if (actionMasked == 0) {
|
|
this.l = motionEvent.getPointerId(0);
|
|
this.C = false;
|
|
} else {
|
|
if (actionMasked == 1) {
|
|
int findPointerIndex = motionEvent.findPointerIndex(this.l);
|
|
if (findPointerIndex < 0) {
|
|
return false;
|
|
}
|
|
if (this.C) {
|
|
float y = motionEvent.getY(findPointerIndex);
|
|
float f = this.y;
|
|
this.C = false;
|
|
e((y - f) * 0.5f);
|
|
}
|
|
this.l = -1;
|
|
return false;
|
|
}
|
|
if (actionMasked == 2) {
|
|
int findPointerIndex2 = motionEvent.findPointerIndex(this.l);
|
|
if (findPointerIndex2 < 0) {
|
|
return false;
|
|
}
|
|
float y2 = motionEvent.getY(findPointerIndex2);
|
|
b(y2);
|
|
if (this.C) {
|
|
float f2 = (y2 - this.y) * 0.5f;
|
|
if (f2 <= BitmapDescriptorFactory.HUE_RED) {
|
|
return false;
|
|
}
|
|
a(f2);
|
|
}
|
|
} else {
|
|
if (actionMasked == 3) {
|
|
return false;
|
|
}
|
|
if (actionMasked == 5) {
|
|
int actionIndex = motionEvent.getActionIndex();
|
|
if (actionIndex < 0) {
|
|
return false;
|
|
}
|
|
this.l = motionEvent.getPointerId(actionIndex);
|
|
} else if (actionMasked == 6) {
|
|
AQ_(motionEvent);
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
private void b(float f) {
|
|
float f2 = this.v;
|
|
float f3 = f - f2;
|
|
float f4 = this.Q;
|
|
if (f3 <= f4 || this.C) {
|
|
return;
|
|
}
|
|
this.y = f2 + f4;
|
|
this.C = true;
|
|
this.i.setAlpha(76);
|
|
}
|
|
|
|
private void AP_(int i, Animation.AnimationListener animationListener) {
|
|
this.a = i;
|
|
this.r.reset();
|
|
this.r.setDuration(200L);
|
|
this.r.setInterpolator(this.w);
|
|
if (animationListener != null) {
|
|
this.e.setAnimationListener(animationListener);
|
|
}
|
|
this.e.clearAnimation();
|
|
this.e.startAnimation(this.r);
|
|
}
|
|
|
|
final void d(float f) {
|
|
int top = (this.a + ((int) ((this.f - r0) * f))) - this.e.getTop();
|
|
this.e.bringToFront();
|
|
ViewCompat.d(this.e, top);
|
|
this.d = this.e.getTop();
|
|
}
|
|
|
|
private void AQ_(MotionEvent motionEvent) {
|
|
int actionIndex = motionEvent.getActionIndex();
|
|
if (motionEvent.getPointerId(actionIndex) == this.l) {
|
|
this.l = motionEvent.getPointerId(actionIndex == 0 ? 1 : 0);
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean dispatchNestedPreScroll(int i, int i2, int[] iArr, int[] iArr2) {
|
|
return this.B.a(i, i2, iArr, iArr2, 0);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean dispatchNestedScroll(int i, int i2, int i3, int i4, int[] iArr) {
|
|
return this.B.c(i, i2, i3, i4, iArr, 0, null);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
public int getNestedScrollAxes() {
|
|
JXX jxx = this.A;
|
|
return jxx.d | jxx.c;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean hasNestedScrollingParent() {
|
|
return this.B.a != null;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean isNestedScrollingEnabled() {
|
|
return this.B.c;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent
|
|
public void onNestedScrollAccepted(View view, View view2, int i) {
|
|
this.A.c = i;
|
|
startNestedScroll(i & 2);
|
|
this.M = BitmapDescriptorFactory.HUE_RED;
|
|
this.D = true;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.ViewParent
|
|
public void onStopNestedScroll(View view) {
|
|
this.A.c = 0;
|
|
this.D = false;
|
|
float f = this.M;
|
|
if (f > BitmapDescriptorFactory.HUE_RED) {
|
|
e(f);
|
|
this.M = BitmapDescriptorFactory.HUE_RED;
|
|
}
|
|
stopNestedScroll();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean startNestedScroll(int i) {
|
|
return this.B.a(i, 0);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void stopNestedScroll() {
|
|
FgG fgG = this.B;
|
|
ViewParent viewParent = fgG.a;
|
|
if (viewParent != null) {
|
|
C16515owF.tg_(viewParent, fgG.d, 0);
|
|
fgG.a = null;
|
|
}
|
|
}
|
|
|
|
public void setSlingshotDistance(int i) {
|
|
this.x = i;
|
|
}
|
|
|
|
public void setOnRefreshListener(Sts sts) {
|
|
this.b = sts;
|
|
}
|
|
|
|
public void setOnChildScrollUpCallback(RVV rvv) {
|
|
this.s = rvv;
|
|
}
|
|
|
|
public void setDistanceToTriggerSync(int i) {
|
|
this.L = i;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup
|
|
protected int getChildDrawingOrder(int i, int i2) {
|
|
int i3 = this.u;
|
|
return i3 < 0 ? i2 : i2 == i + (-1) ? i3 : i2 >= i3 ? i2 + 1 : i2;
|
|
}
|
|
}
|