Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,203 @@
package androidx.swiperefreshlayout;
/* loaded from: classes.dex */
public final class R {
public static final class attr {
public static int alpha = 0x7f040055;
public static int font = 0x7f0400d8;
public static int fontProviderAuthority = 0x7f0400da;
public static int fontProviderCerts = 0x7f0400db;
public static int fontProviderFetchStrategy = 0x7f0400dd;
public static int fontProviderFetchTimeout = 0x7f0400de;
public static int fontProviderPackage = 0x7f0400df;
public static int fontProviderQuery = 0x7f0400e0;
public static int fontStyle = 0x7f0400e2;
public static int fontVariationSettings = 0x7f0400e3;
public static int fontWeight = 0x7f0400e4;
public static int ttcIndex = 0x7f04019c;
private attr() {
}
}
public static final class color {
public static int notification_action_color_filter = 0x7f0600e7;
public static int notification_icon_bg_color = 0x7f0600e8;
public static int ripple_material_light = 0x7f0600f3;
public static int secondary_text_default_material_light = 0x7f0600f5;
private color() {
}
}
public static final class dimen {
public static int compat_button_inset_horizontal_material = 0x7f070095;
public static int compat_button_inset_vertical_material = 0x7f070096;
public static int compat_button_padding_horizontal_material = 0x7f070097;
public static int compat_button_padding_vertical_material = 0x7f070098;
public static int compat_control_corner_material = 0x7f070099;
public static int compat_notification_large_icon_max_height = 0x7f07009a;
public static int compat_notification_large_icon_max_width = 0x7f07009b;
public static int notification_action_icon_size = 0x7f070105;
public static int notification_action_text_size = 0x7f070106;
public static int notification_big_circle_margin = 0x7f070107;
public static int notification_content_margin_start = 0x7f070108;
public static int notification_large_icon_height = 0x7f070109;
public static int notification_large_icon_width = 0x7f07010a;
public static int notification_main_column_padding_top = 0x7f07010b;
public static int notification_media_narrow_margin = 0x7f07010c;
public static int notification_right_icon_size = 0x7f07010d;
public static int notification_right_side_padding_top = 0x7f07010e;
public static int notification_small_icon_background_padding = 0x7f07010f;
public static int notification_small_icon_size_as_large = 0x7f070110;
public static int notification_subtext_size = 0x7f070111;
public static int notification_top_pad = 0x7f070112;
public static int notification_top_pad_large_text = 0x7f070113;
private dimen() {
}
}
public static final class drawable {
public static int notification_action_background = 0x7f080241;
public static int notification_bg = 0x7f080242;
public static int notification_bg_low = 0x7f080243;
public static int notification_bg_low_normal = 0x7f080244;
public static int notification_bg_low_pressed = 0x7f080245;
public static int notification_bg_normal = 0x7f080246;
public static int notification_bg_normal_pressed = 0x7f080247;
public static int notification_icon_background = 0x7f080248;
public static int notification_template_icon_bg = 0x7f08024a;
public static int notification_template_icon_low_bg = 0x7f08024b;
public static int notification_tile_bg = 0x7f08024c;
public static int notify_panel_notification_icon_bg = 0x7f08024d;
private drawable() {
}
}
public static final class id {
public static int action_container = 0x7f0a0032;
public static int action_divider = 0x7f0a0034;
public static int action_image = 0x7f0a0035;
public static int action_text = 0x7f0a003c;
public static int actions = 0x7f0a003d;
public static int async = 0x7f0a0088;
public static int blocking = 0x7f0a0091;
public static int chronometer = 0x7f0a00a6;
public static int forever = 0x7f0a0107;
public static int icon = 0x7f0a014a;
public static int icon_group = 0x7f0a014b;
public static int info = 0x7f0a0151;
public static int italic = 0x7f0a0156;
public static int line1 = 0x7f0a015d;
public static int line3 = 0x7f0a015e;
public static int normal = 0x7f0a022f;
public static int notification_background = 0x7f0a0230;
public static int notification_main_column = 0x7f0a0231;
public static int notification_main_column_container = 0x7f0a0232;
public static int right_icon = 0x7f0a0248;
public static int right_side = 0x7f0a0249;
public static int tag_transition_group = 0x7f0a0279;
public static int tag_unhandled_key_event_manager = 0x7f0a027a;
public static int tag_unhandled_key_listeners = 0x7f0a027b;
public static int text = 0x7f0a027d;
public static int text2 = 0x7f0a027e;
public static int time = 0x7f0a0283;
public static int title = 0x7f0a0284;
private id() {
}
}
public static final class integer {
public static int status_bar_notification_info_maxnum = 0x7f0b0014;
private integer() {
}
}
public static final class layout {
public static int notification_action = 0x7f0d009f;
public static int notification_action_tombstone = 0x7f0d00a0;
public static int notification_template_custom_big = 0x7f0d00a7;
public static int notification_template_icon_group = 0x7f0d00a8;
public static int notification_template_part_chronometer = 0x7f0d00ac;
public static int notification_template_part_time = 0x7f0d00ad;
private layout() {
}
}
public static final class string {
public static int status_bar_notification_info_overflow = 0x7f120187;
private string() {
}
}
public static final class style {
public static int TextAppearance_Compat_Notification = 0x7f130147;
public static int TextAppearance_Compat_Notification_Info = 0x7f130148;
public static int TextAppearance_Compat_Notification_Line2 = 0x7f13014a;
public static int TextAppearance_Compat_Notification_Time = 0x7f13014d;
public static int TextAppearance_Compat_Notification_Title = 0x7f13014f;
public static int Widget_Compat_NotificationActionContainer = 0x7f1301c1;
public static int Widget_Compat_NotificationActionText = 0x7f1301c2;
private style() {
}
}
public static final class styleable {
public static int ColorStateListItem_alpha = 0x00000003;
public static int ColorStateListItem_android_alpha = 0x00000001;
public static int ColorStateListItem_android_color = 0x00000000;
public static int ColorStateListItem_android_lStar = 0x00000002;
public static int ColorStateListItem_lStar = 0x00000004;
public static int FontFamilyFont_android_font = 0x00000000;
public static int FontFamilyFont_android_fontStyle = 0x00000002;
public static int FontFamilyFont_android_fontVariationSettings = 0x00000004;
public static int FontFamilyFont_android_fontWeight = 0x00000001;
public static int FontFamilyFont_android_ttcIndex = 0x00000003;
public static int FontFamilyFont_font = 0x00000005;
public static int FontFamilyFont_fontStyle = 0x00000006;
public static int FontFamilyFont_fontVariationSettings = 0x00000007;
public static int FontFamilyFont_fontWeight = 0x00000008;
public static int FontFamilyFont_ttcIndex = 0x00000009;
public static int FontFamily_fontProviderAuthority = 0x00000000;
public static int FontFamily_fontProviderCerts = 0x00000001;
public static int FontFamily_fontProviderFallbackQuery = 0x00000002;
public static int FontFamily_fontProviderFetchStrategy = 0x00000003;
public static int FontFamily_fontProviderFetchTimeout = 0x00000004;
public static int FontFamily_fontProviderPackage = 0x00000005;
public static int FontFamily_fontProviderQuery = 0x00000006;
public static int FontFamily_fontProviderSystemFontFamily = 0x00000007;
public static int GradientColorItem_android_color = 0x00000000;
public static int GradientColorItem_android_offset = 0x00000001;
public static int GradientColor_android_centerColor = 0x00000007;
public static int GradientColor_android_centerX = 0x00000003;
public static int GradientColor_android_centerY = 0x00000004;
public static int GradientColor_android_endColor = 0x00000001;
public static int GradientColor_android_endX = 0x0000000a;
public static int GradientColor_android_endY = 0x0000000b;
public static int GradientColor_android_gradientRadius = 0x00000005;
public static int GradientColor_android_startColor = 0x00000000;
public static int GradientColor_android_startX = 0x00000008;
public static int GradientColor_android_startY = 0x00000009;
public static int GradientColor_android_tileMode = 0x00000006;
public static int GradientColor_android_type = 0x00000002;
public static int[] ColorStateListItem = {android.R.attr.color, android.R.attr.alpha, android.R.attr.lStar, com.ea.games.r3_row.R.attr.alpha, com.ea.games.r3_row.R.attr.lStar};
public static int[] FontFamily = {com.ea.games.r3_row.R.attr.fontProviderAuthority, com.ea.games.r3_row.R.attr.fontProviderCerts, com.ea.games.r3_row.R.attr.fontProviderFallbackQuery, com.ea.games.r3_row.R.attr.fontProviderFetchStrategy, com.ea.games.r3_row.R.attr.fontProviderFetchTimeout, com.ea.games.r3_row.R.attr.fontProviderPackage, com.ea.games.r3_row.R.attr.fontProviderQuery, com.ea.games.r3_row.R.attr.fontProviderSystemFontFamily};
public static int[] FontFamilyFont = {android.R.attr.font, android.R.attr.fontWeight, android.R.attr.fontStyle, android.R.attr.ttcIndex, android.R.attr.fontVariationSettings, com.ea.games.r3_row.R.attr.font, com.ea.games.r3_row.R.attr.fontStyle, com.ea.games.r3_row.R.attr.fontVariationSettings, com.ea.games.r3_row.R.attr.fontWeight, com.ea.games.r3_row.R.attr.ttcIndex};
public static int[] GradientColor = {android.R.attr.startColor, android.R.attr.endColor, android.R.attr.type, android.R.attr.centerX, android.R.attr.centerY, android.R.attr.gradientRadius, android.R.attr.tileMode, android.R.attr.centerColor, android.R.attr.startX, android.R.attr.startY, android.R.attr.endX, android.R.attr.endY};
public static int[] GradientColorItem = {android.R.attr.color, android.R.attr.offset};
private styleable() {
}
}
private R() {
}
}

View File

@@ -0,0 +1,124 @@
package androidx.swiperefreshlayout.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RadialGradient;
import android.graphics.Shader;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.view.animation.Animation;
import android.widget.ImageView;
import androidx.core.content.ContextCompat;
import androidx.core.view.ViewCompat;
/* loaded from: classes.dex */
class CircleImageView extends ImageView {
private static final int FILL_SHADOW_COLOR = 1023410176;
private static final int KEY_SHADOW_COLOR = 503316480;
private static final int SHADOW_ELEVATION = 4;
private static final float SHADOW_RADIUS = 3.5f;
private static final float X_OFFSET = 0.0f;
private static final float Y_OFFSET = 1.75f;
private Animation.AnimationListener mListener;
int mShadowRadius;
private boolean elevationSupported() {
return true;
}
public void setAnimationListener(Animation.AnimationListener animationListener) {
this.mListener = animationListener;
}
public CircleImageView(Context context, int i) {
super(context);
ShapeDrawable shapeDrawable;
float f = getContext().getResources().getDisplayMetrics().density;
int i2 = (int) (Y_OFFSET * f);
int i3 = (int) (0.0f * f);
this.mShadowRadius = (int) (SHADOW_RADIUS * f);
if (elevationSupported()) {
shapeDrawable = new ShapeDrawable(new OvalShape());
ViewCompat.setElevation(this, f * 4.0f);
} else {
ShapeDrawable shapeDrawable2 = new ShapeDrawable(new OvalShadow(this.mShadowRadius));
setLayerType(1, shapeDrawable2.getPaint());
shapeDrawable2.getPaint().setShadowLayer(this.mShadowRadius, i3, i2, KEY_SHADOW_COLOR);
int i4 = this.mShadowRadius;
setPadding(i4, i4, i4, i4);
shapeDrawable = shapeDrawable2;
}
shapeDrawable.getPaint().setColor(i);
ViewCompat.setBackground(this, shapeDrawable);
}
@Override // android.widget.ImageView, android.view.View
public void onMeasure(int i, int i2) {
super.onMeasure(i, i2);
if (elevationSupported()) {
return;
}
setMeasuredDimension(getMeasuredWidth() + (this.mShadowRadius * 2), getMeasuredHeight() + (this.mShadowRadius * 2));
}
@Override // android.view.View
public void onAnimationStart() {
super.onAnimationStart();
Animation.AnimationListener animationListener = this.mListener;
if (animationListener != null) {
animationListener.onAnimationStart(getAnimation());
}
}
@Override // android.view.View
public void onAnimationEnd() {
super.onAnimationEnd();
Animation.AnimationListener animationListener = this.mListener;
if (animationListener != null) {
animationListener.onAnimationEnd(getAnimation());
}
}
public void setBackgroundColorRes(int i) {
setBackgroundColor(ContextCompat.getColor(getContext(), i));
}
@Override // android.view.View
public void setBackgroundColor(int i) {
if (getBackground() instanceof ShapeDrawable) {
((ShapeDrawable) getBackground()).getPaint().setColor(i);
}
}
public class OvalShadow extends OvalShape {
private RadialGradient mRadialGradient;
private Paint mShadowPaint = new Paint();
public OvalShadow(int i) {
CircleImageView.this.mShadowRadius = i;
updateRadialGradient((int) rect().width());
}
@Override // android.graphics.drawable.shapes.RectShape, android.graphics.drawable.shapes.Shape
public void onResize(float f, float f2) {
super.onResize(f, f2);
updateRadialGradient((int) f);
}
@Override // android.graphics.drawable.shapes.OvalShape, android.graphics.drawable.shapes.RectShape, android.graphics.drawable.shapes.Shape
public void draw(Canvas canvas, Paint paint) {
float width = CircleImageView.this.getWidth() / 2;
float height = CircleImageView.this.getHeight() / 2;
canvas.drawCircle(width, height, width, this.mShadowPaint);
canvas.drawCircle(width, height, r0 - CircleImageView.this.mShadowRadius, paint);
}
private void updateRadialGradient(int i) {
float f = i / 2;
RadialGradient radialGradient = new RadialGradient(f, f, CircleImageView.this.mShadowRadius, new int[]{CircleImageView.FILL_SHADOW_COLOR, 0}, (float[]) null, Shader.TileMode.CLAMP);
this.mRadialGradient = radialGradient;
this.mShadowPaint.setShader(radialGradient);
}
}
}

View File

@@ -0,0 +1,614 @@
package androidx.swiperefreshlayout.widget;
import android.animation.Animator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.core.util.Preconditions;
import androidx.core.view.ViewCompat;
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/* loaded from: classes.dex */
public class CircularProgressDrawable extends Drawable implements Animatable {
private static final int ANIMATION_DURATION = 1332;
private static final int ARROW_HEIGHT = 5;
private static final int ARROW_HEIGHT_LARGE = 6;
private static final int ARROW_WIDTH = 10;
private static final int ARROW_WIDTH_LARGE = 12;
private static final float CENTER_RADIUS = 7.5f;
private static final float CENTER_RADIUS_LARGE = 11.0f;
private static final float COLOR_CHANGE_OFFSET = 0.75f;
public static final int DEFAULT = 1;
private static final float GROUP_FULL_ROTATION = 216.0f;
public static final int LARGE = 0;
private static final float MAX_PROGRESS_ARC = 0.8f;
private static final float MIN_PROGRESS_ARC = 0.01f;
private static final float RING_ROTATION = 0.20999998f;
private static final float SHRINK_OFFSET = 0.5f;
private static final float STROKE_WIDTH = 2.5f;
private static final float STROKE_WIDTH_LARGE = 3.0f;
private Animator mAnimator;
boolean mFinishing;
private Resources mResources;
private final Ring mRing;
private float mRotation;
float mRotationCount;
private static final Interpolator LINEAR_INTERPOLATOR = new LinearInterpolator();
private static final Interpolator MATERIAL_INTERPOLATOR = new FastOutSlowInInterpolator();
private static final int[] COLORS = {ViewCompat.MEASURED_STATE_MASK};
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public @interface ProgressDrawableSize {
}
private int evaluateColorChange(float f, int i, int i2) {
return ((((i >> 24) & 255) + ((int) ((((i2 >> 24) & 255) - r0) * f))) << 24) | ((((i >> 16) & 255) + ((int) ((((i2 >> 16) & 255) - r1) * f))) << 16) | ((((i >> 8) & 255) + ((int) ((((i2 >> 8) & 255) - r2) * f))) << 8) | ((i & 255) + ((int) (f * ((i2 & 255) - r8))));
}
private float getRotation() {
return this.mRotation;
}
private void setRotation(float f) {
this.mRotation = f;
}
@Override // android.graphics.drawable.Drawable
public int getOpacity() {
return -3;
}
public CircularProgressDrawable(@NonNull Context context) {
this.mResources = ((Context) Preconditions.checkNotNull(context)).getResources();
Ring ring = new Ring();
this.mRing = ring;
ring.setColors(COLORS);
setStrokeWidth(STROKE_WIDTH);
setupAnimators();
}
private void setSizeParameters(float f, float f2, float f3, float f4) {
Ring ring = this.mRing;
float f5 = this.mResources.getDisplayMetrics().density;
ring.setStrokeWidth(f2 * f5);
ring.setCenterRadius(f * f5);
ring.setColorIndex(0);
ring.setArrowDimensions(f3 * f5, f4 * f5);
}
public void setStyle(int i) {
if (i == 0) {
setSizeParameters(CENTER_RADIUS_LARGE, STROKE_WIDTH_LARGE, 12.0f, 6.0f);
} else {
setSizeParameters(CENTER_RADIUS, STROKE_WIDTH, 10.0f, 5.0f);
}
invalidateSelf();
}
public float getStrokeWidth() {
return this.mRing.getStrokeWidth();
}
public void setStrokeWidth(float f) {
this.mRing.setStrokeWidth(f);
invalidateSelf();
}
public float getCenterRadius() {
return this.mRing.getCenterRadius();
}
public void setCenterRadius(float f) {
this.mRing.setCenterRadius(f);
invalidateSelf();
}
public void setStrokeCap(@NonNull Paint.Cap cap) {
this.mRing.setStrokeCap(cap);
invalidateSelf();
}
@NonNull
public Paint.Cap getStrokeCap() {
return this.mRing.getStrokeCap();
}
public float getArrowWidth() {
return this.mRing.getArrowWidth();
}
public float getArrowHeight() {
return this.mRing.getArrowHeight();
}
public void setArrowDimensions(float f, float f2) {
this.mRing.setArrowDimensions(f, f2);
invalidateSelf();
}
public boolean getArrowEnabled() {
return this.mRing.getShowArrow();
}
public void setArrowEnabled(boolean z) {
this.mRing.setShowArrow(z);
invalidateSelf();
}
public float getArrowScale() {
return this.mRing.getArrowScale();
}
public void setArrowScale(float f) {
this.mRing.setArrowScale(f);
invalidateSelf();
}
public float getStartTrim() {
return this.mRing.getStartTrim();
}
public float getEndTrim() {
return this.mRing.getEndTrim();
}
public void setStartEndTrim(float f, float f2) {
this.mRing.setStartTrim(f);
this.mRing.setEndTrim(f2);
invalidateSelf();
}
public float getProgressRotation() {
return this.mRing.getRotation();
}
public void setProgressRotation(float f) {
this.mRing.setRotation(f);
invalidateSelf();
}
public int getBackgroundColor() {
return this.mRing.getBackgroundColor();
}
public void setBackgroundColor(int i) {
this.mRing.setBackgroundColor(i);
invalidateSelf();
}
@NonNull
public int[] getColorSchemeColors() {
return this.mRing.getColors();
}
public void setColorSchemeColors(@NonNull int... iArr) {
this.mRing.setColors(iArr);
this.mRing.setColorIndex(0);
invalidateSelf();
}
@Override // android.graphics.drawable.Drawable
public void draw(Canvas canvas) {
Rect bounds = getBounds();
canvas.save();
canvas.rotate(this.mRotation, bounds.exactCenterX(), bounds.exactCenterY());
this.mRing.draw(canvas, bounds);
canvas.restore();
}
@Override // android.graphics.drawable.Drawable
public void setAlpha(int i) {
this.mRing.setAlpha(i);
invalidateSelf();
}
@Override // android.graphics.drawable.Drawable
public int getAlpha() {
return this.mRing.getAlpha();
}
@Override // android.graphics.drawable.Drawable
public void setColorFilter(ColorFilter colorFilter) {
this.mRing.setColorFilter(colorFilter);
invalidateSelf();
}
@Override // android.graphics.drawable.Animatable
public boolean isRunning() {
return this.mAnimator.isRunning();
}
@Override // android.graphics.drawable.Animatable
public void start() {
this.mAnimator.cancel();
this.mRing.storeOriginals();
if (this.mRing.getEndTrim() != this.mRing.getStartTrim()) {
this.mFinishing = true;
this.mAnimator.setDuration(666L);
this.mAnimator.start();
} else {
this.mRing.setColorIndex(0);
this.mRing.resetOriginals();
this.mAnimator.setDuration(1332L);
this.mAnimator.start();
}
}
@Override // android.graphics.drawable.Animatable
public void stop() {
this.mAnimator.cancel();
setRotation(0.0f);
this.mRing.setShowArrow(false);
this.mRing.setColorIndex(0);
this.mRing.resetOriginals();
invalidateSelf();
}
public void updateRingColor(float f, Ring ring) {
if (f > 0.75f) {
ring.setColor(evaluateColorChange((f - 0.75f) / 0.25f, ring.getStartingColor(), ring.getNextColor()));
} else {
ring.setColor(ring.getStartingColor());
}
}
private void applyFinishTranslation(float f, Ring ring) {
updateRingColor(f, ring);
float floor = (float) (Math.floor(ring.getStartingRotation() / MAX_PROGRESS_ARC) + 1.0d);
ring.setStartTrim(ring.getStartingStartTrim() + (((ring.getStartingEndTrim() - MIN_PROGRESS_ARC) - ring.getStartingStartTrim()) * f));
ring.setEndTrim(ring.getStartingEndTrim());
ring.setRotation(ring.getStartingRotation() + ((floor - ring.getStartingRotation()) * f));
}
public void applyTransformation(float f, Ring ring, boolean z) {
float interpolation;
float f2;
if (this.mFinishing) {
applyFinishTranslation(f, ring);
return;
}
if (f != 1.0f || z) {
float startingRotation = ring.getStartingRotation();
if (f < SHRINK_OFFSET) {
float f3 = f / SHRINK_OFFSET;
interpolation = ring.getStartingStartTrim();
f2 = (MATERIAL_INTERPOLATOR.getInterpolation(f3) * 0.79f) + MIN_PROGRESS_ARC + interpolation;
} else {
float f4 = (f - SHRINK_OFFSET) / SHRINK_OFFSET;
float startingStartTrim = ring.getStartingStartTrim() + 0.79f;
interpolation = startingStartTrim - (((1.0f - MATERIAL_INTERPOLATOR.getInterpolation(f4)) * 0.79f) + MIN_PROGRESS_ARC);
f2 = startingStartTrim;
}
float f5 = startingRotation + (RING_ROTATION * f);
float f6 = (f + this.mRotationCount) * GROUP_FULL_ROTATION;
ring.setStartTrim(interpolation);
ring.setEndTrim(f2);
ring.setRotation(f5);
setRotation(f6);
}
}
private void setupAnimators() {
final Ring ring = this.mRing;
ValueAnimator ofFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: androidx.swiperefreshlayout.widget.CircularProgressDrawable.1
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
public void onAnimationUpdate(ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
CircularProgressDrawable.this.updateRingColor(floatValue, ring);
CircularProgressDrawable.this.applyTransformation(floatValue, ring, false);
CircularProgressDrawable.this.invalidateSelf();
}
});
ofFloat.setRepeatCount(-1);
ofFloat.setRepeatMode(1);
ofFloat.setInterpolator(LINEAR_INTERPOLATOR);
ofFloat.addListener(new Animator.AnimatorListener() { // from class: androidx.swiperefreshlayout.widget.CircularProgressDrawable.2
@Override // android.animation.Animator.AnimatorListener
public void onAnimationCancel(Animator animator) {
}
@Override // android.animation.Animator.AnimatorListener
public void onAnimationEnd(Animator animator) {
}
@Override // android.animation.Animator.AnimatorListener
public void onAnimationStart(Animator animator) {
CircularProgressDrawable.this.mRotationCount = 0.0f;
}
@Override // android.animation.Animator.AnimatorListener
public void onAnimationRepeat(Animator animator) {
CircularProgressDrawable.this.applyTransformation(1.0f, ring, true);
ring.storeOriginals();
ring.goToNextColor();
CircularProgressDrawable circularProgressDrawable = CircularProgressDrawable.this;
if (circularProgressDrawable.mFinishing) {
circularProgressDrawable.mFinishing = false;
animator.cancel();
animator.setDuration(1332L);
animator.start();
ring.setShowArrow(false);
return;
}
circularProgressDrawable.mRotationCount += 1.0f;
}
});
this.mAnimator = ofFloat;
}
public static class Ring {
int mAlpha;
Path mArrow;
int mArrowHeight;
final Paint mArrowPaint;
float mArrowScale;
int mArrowWidth;
final Paint mCirclePaint;
int mColorIndex;
int[] mColors;
int mCurrentColor;
float mEndTrim;
final Paint mPaint;
float mRingCenterRadius;
float mRotation;
boolean mShowArrow;
float mStartTrim;
float mStartingEndTrim;
float mStartingRotation;
float mStartingStartTrim;
float mStrokeWidth;
final RectF mTempBounds = new RectF();
public int getAlpha() {
return this.mAlpha;
}
public float getArrowHeight() {
return this.mArrowHeight;
}
public float getArrowScale() {
return this.mArrowScale;
}
public float getArrowWidth() {
return this.mArrowWidth;
}
public float getCenterRadius() {
return this.mRingCenterRadius;
}
public int[] getColors() {
return this.mColors;
}
public float getEndTrim() {
return this.mEndTrim;
}
public float getRotation() {
return this.mRotation;
}
public boolean getShowArrow() {
return this.mShowArrow;
}
public float getStartTrim() {
return this.mStartTrim;
}
public float getStartingEndTrim() {
return this.mStartingEndTrim;
}
public float getStartingRotation() {
return this.mStartingRotation;
}
public float getStartingStartTrim() {
return this.mStartingStartTrim;
}
public float getStrokeWidth() {
return this.mStrokeWidth;
}
public void setAlpha(int i) {
this.mAlpha = i;
}
public void setArrowDimensions(float f, float f2) {
this.mArrowWidth = (int) f;
this.mArrowHeight = (int) f2;
}
public void setArrowScale(float f) {
if (f != this.mArrowScale) {
this.mArrowScale = f;
}
}
public void setCenterRadius(float f) {
this.mRingCenterRadius = f;
}
public void setColor(int i) {
this.mCurrentColor = i;
}
public void setEndTrim(float f) {
this.mEndTrim = f;
}
public void setRotation(float f) {
this.mRotation = f;
}
public void setShowArrow(boolean z) {
if (this.mShowArrow != z) {
this.mShowArrow = z;
}
}
public void setStartTrim(float f) {
this.mStartTrim = f;
}
public void storeOriginals() {
this.mStartingStartTrim = this.mStartTrim;
this.mStartingEndTrim = this.mEndTrim;
this.mStartingRotation = this.mRotation;
}
public Ring() {
Paint paint = new Paint();
this.mPaint = paint;
Paint paint2 = new Paint();
this.mArrowPaint = paint2;
Paint paint3 = new Paint();
this.mCirclePaint = paint3;
this.mStartTrim = 0.0f;
this.mEndTrim = 0.0f;
this.mRotation = 0.0f;
this.mStrokeWidth = 5.0f;
this.mArrowScale = 1.0f;
this.mAlpha = 255;
paint.setStrokeCap(Paint.Cap.SQUARE);
paint.setAntiAlias(true);
paint.setStyle(Paint.Style.STROKE);
paint2.setStyle(Paint.Style.FILL);
paint2.setAntiAlias(true);
paint3.setColor(0);
}
public void setStrokeCap(Paint.Cap cap) {
this.mPaint.setStrokeCap(cap);
}
public Paint.Cap getStrokeCap() {
return this.mPaint.getStrokeCap();
}
public void draw(Canvas canvas, Rect rect) {
RectF rectF = this.mTempBounds;
float f = this.mRingCenterRadius;
float f2 = (this.mStrokeWidth / 2.0f) + f;
if (f <= 0.0f) {
f2 = (Math.min(rect.width(), rect.height()) / 2.0f) - Math.max((this.mArrowWidth * this.mArrowScale) / 2.0f, this.mStrokeWidth / 2.0f);
}
rectF.set(rect.centerX() - f2, rect.centerY() - f2, rect.centerX() + f2, rect.centerY() + f2);
float f3 = this.mStartTrim;
float f4 = this.mRotation;
float f5 = (f3 + f4) * 360.0f;
float f6 = ((this.mEndTrim + f4) * 360.0f) - f5;
this.mPaint.setColor(this.mCurrentColor);
this.mPaint.setAlpha(this.mAlpha);
float f7 = this.mStrokeWidth / 2.0f;
rectF.inset(f7, f7);
canvas.drawCircle(rectF.centerX(), rectF.centerY(), rectF.width() / 2.0f, this.mCirclePaint);
float f8 = -f7;
rectF.inset(f8, f8);
canvas.drawArc(rectF, f5, f6, false, this.mPaint);
drawTriangle(canvas, f5, f6, rectF);
}
public void drawTriangle(Canvas canvas, float f, float f2, RectF rectF) {
if (this.mShowArrow) {
Path path = this.mArrow;
if (path == null) {
Path path2 = new Path();
this.mArrow = path2;
path2.setFillType(Path.FillType.EVEN_ODD);
} else {
path.reset();
}
float min = Math.min(rectF.width(), rectF.height()) / 2.0f;
float f3 = (this.mArrowWidth * this.mArrowScale) / 2.0f;
this.mArrow.moveTo(0.0f, 0.0f);
this.mArrow.lineTo(this.mArrowWidth * this.mArrowScale, 0.0f);
Path path3 = this.mArrow;
float f4 = this.mArrowWidth;
float f5 = this.mArrowScale;
path3.lineTo((f4 * f5) / 2.0f, this.mArrowHeight * f5);
this.mArrow.offset((min + rectF.centerX()) - f3, rectF.centerY() + (this.mStrokeWidth / 2.0f));
this.mArrow.close();
this.mArrowPaint.setColor(this.mCurrentColor);
this.mArrowPaint.setAlpha(this.mAlpha);
canvas.save();
canvas.rotate(f + f2, rectF.centerX(), rectF.centerY());
canvas.drawPath(this.mArrow, this.mArrowPaint);
canvas.restore();
}
}
public void setColors(@NonNull int[] iArr) {
this.mColors = iArr;
setColorIndex(0);
}
public void setBackgroundColor(int i) {
this.mCirclePaint.setColor(i);
}
public int getBackgroundColor() {
return this.mCirclePaint.getColor();
}
public void setColorIndex(int i) {
this.mColorIndex = i;
this.mCurrentColor = this.mColors[i];
}
public int getNextColor() {
return this.mColors[getNextColorIndex()];
}
public int getNextColorIndex() {
return (this.mColorIndex + 1) % this.mColors.length;
}
public void goToNextColor() {
setColorIndex(getNextColorIndex());
}
public void setColorFilter(ColorFilter colorFilter) {
this.mPaint.setColorFilter(colorFilter);
}
public void setStrokeWidth(float f) {
this.mStrokeWidth = f;
this.mPaint.setStrokeWidth(f);
}
public int getStartingColor() {
return this.mColors[this.mColorIndex];
}
public void resetOriginals() {
this.mStartingStartTrim = 0.0f;
this.mStartingEndTrim = 0.0f;
this.mStartingRotation = 0.0f;
setStartTrim(0.0f);
setEndTrim(0.0f);
setRotation(0.0f);
}
}
}

View File

@@ -0,0 +1,864 @@
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.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Transformation;
import android.widget.ListView;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.Px;
import androidx.annotation.VisibleForTesting;
import androidx.core.content.ContextCompat;
import androidx.core.view.NestedScrollingChild;
import androidx.core.view.NestedScrollingChildHelper;
import androidx.core.view.NestedScrollingParent;
import androidx.core.view.NestedScrollingParentHelper;
import androidx.core.view.ViewCompat;
import androidx.core.widget.ListViewCompat;
/* loaded from: classes.dex */
public class SwipeRefreshLayout extends ViewGroup implements NestedScrollingParent, NestedScrollingChild {
private static final int ALPHA_ANIMATION_DURATION = 300;
private static final int ANIMATE_TO_START_DURATION = 200;
private static final int ANIMATE_TO_TRIGGER_DURATION = 200;
private static final int CIRCLE_BG_LIGHT = -328966;
@VisibleForTesting
static final int CIRCLE_DIAMETER = 40;
@VisibleForTesting
static final int CIRCLE_DIAMETER_LARGE = 56;
private static final float DECELERATE_INTERPOLATION_FACTOR = 2.0f;
public static final int DEFAULT = 1;
private static final int DEFAULT_CIRCLE_TARGET = 64;
public static final int DEFAULT_SLINGSHOT_DISTANCE = -1;
private static final float DRAG_RATE = 0.5f;
private static final int INVALID_POINTER = -1;
public static final int LARGE = 0;
private static final int[] LAYOUT_ATTRS = {R.attr.enabled};
private static final String LOG_TAG = "SwipeRefreshLayout";
private static final int MAX_ALPHA = 255;
private static final float MAX_PROGRESS_ANGLE = 0.8f;
private static final int SCALE_DOWN_DURATION = 150;
private static final int STARTING_PROGRESS_ALPHA = 76;
private int mActivePointerId;
private Animation mAlphaMaxAnimation;
private Animation mAlphaStartAnimation;
private final Animation mAnimateToCorrectPosition;
private final Animation mAnimateToStartPosition;
private OnChildScrollUpCallback mChildScrollUpCallback;
private int mCircleDiameter;
CircleImageView mCircleView;
private int mCircleViewIndex;
int mCurrentTargetOffsetTop;
int mCustomSlingshotDistance;
private final DecelerateInterpolator mDecelerateInterpolator;
protected int mFrom;
private float mInitialDownY;
private float mInitialMotionY;
private boolean mIsBeingDragged;
OnRefreshListener mListener;
private int mMediumAnimationDuration;
private boolean mNestedScrollInProgress;
private final NestedScrollingChildHelper mNestedScrollingChildHelper;
private final NestedScrollingParentHelper mNestedScrollingParentHelper;
boolean mNotify;
protected int mOriginalOffsetTop;
private final int[] mParentOffsetInWindow;
private final int[] mParentScrollConsumed;
CircularProgressDrawable mProgress;
private Animation.AnimationListener mRefreshListener;
boolean mRefreshing;
private boolean mReturningToStart;
boolean mScale;
private Animation mScaleAnimation;
private Animation mScaleDownAnimation;
private Animation mScaleDownToStartAnimation;
int mSpinnerOffsetEnd;
float mStartingScale;
private View mTarget;
private float mTotalDragDistance;
private float mTotalUnconsumed;
private int mTouchSlop;
boolean mUsingCustomStart;
public interface OnChildScrollUpCallback {
boolean canChildScrollUp(@NonNull SwipeRefreshLayout swipeRefreshLayout, @Nullable View view);
}
public interface OnRefreshListener {
void onRefresh();
}
@Override // android.view.ViewGroup
public int getChildDrawingOrder(int i, int i2) {
int i3 = this.mCircleViewIndex;
return i3 < 0 ? i2 : i2 == i + (-1) ? i3 : i2 >= i3 ? i2 + 1 : i2;
}
public int getProgressCircleDiameter() {
return this.mCircleDiameter;
}
public int getProgressViewEndOffset() {
return this.mSpinnerOffsetEnd;
}
public int getProgressViewStartOffset() {
return this.mOriginalOffsetTop;
}
public boolean isRefreshing() {
return this.mRefreshing;
}
public void setDistanceToTriggerSync(int i) {
this.mTotalDragDistance = i;
}
public void setOnChildScrollUpCallback(@Nullable OnChildScrollUpCallback onChildScrollUpCallback) {
this.mChildScrollUpCallback = onChildScrollUpCallback;
}
public void setOnRefreshListener(@Nullable OnRefreshListener onRefreshListener) {
this.mListener = onRefreshListener;
}
public void setSlingshotDistance(@Px int i) {
this.mCustomSlingshotDistance = i;
}
public void reset() {
this.mCircleView.clearAnimation();
this.mProgress.stop();
this.mCircleView.setVisibility(8);
setColorViewAlpha(255);
if (this.mScale) {
setAnimationProgress(0.0f);
} else {
setTargetOffsetTopAndBottom(this.mOriginalOffsetTop - this.mCurrentTargetOffsetTop);
}
this.mCurrentTargetOffsetTop = this.mCircleView.getTop();
}
@Override // android.view.View
public void setEnabled(boolean z) {
super.setEnabled(z);
if (z) {
return;
}
reset();
}
@Override // android.view.ViewGroup, android.view.View
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
reset();
}
private void setColorViewAlpha(int i) {
this.mCircleView.getBackground().setAlpha(i);
this.mProgress.setAlpha(i);
}
public void setProgressViewOffset(boolean z, int i, int i2) {
this.mScale = z;
this.mOriginalOffsetTop = i;
this.mSpinnerOffsetEnd = i2;
this.mUsingCustomStart = true;
reset();
this.mRefreshing = false;
}
public void setProgressViewEndTarget(boolean z, int i) {
this.mSpinnerOffsetEnd = i;
this.mScale = z;
this.mCircleView.invalidate();
}
public void setSize(int i) {
if (i == 0 || i == 1) {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
if (i == 0) {
this.mCircleDiameter = (int) (displayMetrics.density * 56.0f);
} else {
this.mCircleDiameter = (int) (displayMetrics.density * 40.0f);
}
this.mCircleView.setImageDrawable(null);
this.mProgress.setStyle(i);
this.mCircleView.setImageDrawable(this.mProgress);
}
}
public SwipeRefreshLayout(@NonNull Context context) {
this(context, null);
}
public SwipeRefreshLayout(@NonNull Context context, @Nullable AttributeSet attributeSet) {
super(context, attributeSet);
this.mRefreshing = false;
this.mTotalDragDistance = -1.0f;
this.mParentScrollConsumed = new int[2];
this.mParentOffsetInWindow = new int[2];
this.mActivePointerId = -1;
this.mCircleViewIndex = -1;
this.mRefreshListener = new Animation.AnimationListener() { // from class: androidx.swiperefreshlayout.widget.SwipeRefreshLayout.1
@Override // android.view.animation.Animation.AnimationListener
public void onAnimationRepeat(Animation animation) {
}
@Override // android.view.animation.Animation.AnimationListener
public void onAnimationStart(Animation animation) {
}
@Override // android.view.animation.Animation.AnimationListener
public void onAnimationEnd(Animation animation) {
OnRefreshListener onRefreshListener;
SwipeRefreshLayout swipeRefreshLayout = SwipeRefreshLayout.this;
if (swipeRefreshLayout.mRefreshing) {
swipeRefreshLayout.mProgress.setAlpha(255);
SwipeRefreshLayout.this.mProgress.start();
SwipeRefreshLayout swipeRefreshLayout2 = SwipeRefreshLayout.this;
if (swipeRefreshLayout2.mNotify && (onRefreshListener = swipeRefreshLayout2.mListener) != null) {
onRefreshListener.onRefresh();
}
SwipeRefreshLayout swipeRefreshLayout3 = SwipeRefreshLayout.this;
swipeRefreshLayout3.mCurrentTargetOffsetTop = swipeRefreshLayout3.mCircleView.getTop();
return;
}
swipeRefreshLayout.reset();
}
};
this.mAnimateToCorrectPosition = new Animation() { // from class: androidx.swiperefreshlayout.widget.SwipeRefreshLayout.6
@Override // android.view.animation.Animation
public void applyTransformation(float f, Transformation transformation) {
int i;
SwipeRefreshLayout swipeRefreshLayout = SwipeRefreshLayout.this;
if (!swipeRefreshLayout.mUsingCustomStart) {
i = swipeRefreshLayout.mSpinnerOffsetEnd - Math.abs(swipeRefreshLayout.mOriginalOffsetTop);
} else {
i = swipeRefreshLayout.mSpinnerOffsetEnd;
}
SwipeRefreshLayout swipeRefreshLayout2 = SwipeRefreshLayout.this;
SwipeRefreshLayout.this.setTargetOffsetTopAndBottom((swipeRefreshLayout2.mFrom + ((int) ((i - r1) * f))) - swipeRefreshLayout2.mCircleView.getTop());
SwipeRefreshLayout.this.mProgress.setArrowScale(1.0f - f);
}
};
this.mAnimateToStartPosition = new Animation() { // from class: androidx.swiperefreshlayout.widget.SwipeRefreshLayout.7
@Override // android.view.animation.Animation
public void applyTransformation(float f, Transformation transformation) {
SwipeRefreshLayout.this.moveToStart(f);
}
};
this.mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
this.mMediumAnimationDuration = getResources().getInteger(R.integer.config_mediumAnimTime);
setWillNotDraw(false);
this.mDecelerateInterpolator = new DecelerateInterpolator(2.0f);
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
this.mCircleDiameter = (int) (displayMetrics.density * 40.0f);
createProgressView();
setChildrenDrawingOrderEnabled(true);
int i = (int) (displayMetrics.density * 64.0f);
this.mSpinnerOffsetEnd = i;
this.mTotalDragDistance = i;
this.mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
this.mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
setNestedScrollingEnabled(true);
int i2 = -this.mCircleDiameter;
this.mCurrentTargetOffsetTop = i2;
this.mOriginalOffsetTop = i2;
moveToStart(1.0f);
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, LAYOUT_ATTRS);
setEnabled(obtainStyledAttributes.getBoolean(0, true));
obtainStyledAttributes.recycle();
}
private void createProgressView() {
this.mCircleView = new CircleImageView(getContext(), CIRCLE_BG_LIGHT);
CircularProgressDrawable circularProgressDrawable = new CircularProgressDrawable(getContext());
this.mProgress = circularProgressDrawable;
circularProgressDrawable.setStyle(1);
this.mCircleView.setImageDrawable(this.mProgress);
this.mCircleView.setVisibility(8);
addView(this.mCircleView);
}
public void setRefreshing(boolean z) {
if (z && this.mRefreshing != z) {
this.mRefreshing = z;
setTargetOffsetTopAndBottom((!this.mUsingCustomStart ? this.mSpinnerOffsetEnd + this.mOriginalOffsetTop : this.mSpinnerOffsetEnd) - this.mCurrentTargetOffsetTop);
this.mNotify = false;
startScaleUpAnimation(this.mRefreshListener);
return;
}
setRefreshing(z, false);
}
private void startScaleUpAnimation(Animation.AnimationListener animationListener) {
this.mCircleView.setVisibility(0);
this.mProgress.setAlpha(255);
Animation animation = new Animation() { // from class: androidx.swiperefreshlayout.widget.SwipeRefreshLayout.2
@Override // android.view.animation.Animation
public void applyTransformation(float f, Transformation transformation) {
SwipeRefreshLayout.this.setAnimationProgress(f);
}
};
this.mScaleAnimation = animation;
animation.setDuration(this.mMediumAnimationDuration);
if (animationListener != null) {
this.mCircleView.setAnimationListener(animationListener);
}
this.mCircleView.clearAnimation();
this.mCircleView.startAnimation(this.mScaleAnimation);
}
public void setAnimationProgress(float f) {
this.mCircleView.setScaleX(f);
this.mCircleView.setScaleY(f);
}
private void setRefreshing(boolean z, boolean z2) {
if (this.mRefreshing != z) {
this.mNotify = z2;
ensureTarget();
this.mRefreshing = z;
if (z) {
animateOffsetToCorrectPosition(this.mCurrentTargetOffsetTop, this.mRefreshListener);
} else {
startScaleDownAnimation(this.mRefreshListener);
}
}
}
public void startScaleDownAnimation(Animation.AnimationListener animationListener) {
Animation animation = new Animation() { // from class: androidx.swiperefreshlayout.widget.SwipeRefreshLayout.3
@Override // android.view.animation.Animation
public void applyTransformation(float f, Transformation transformation) {
SwipeRefreshLayout.this.setAnimationProgress(1.0f - f);
}
};
this.mScaleDownAnimation = animation;
animation.setDuration(150L);
this.mCircleView.setAnimationListener(animationListener);
this.mCircleView.clearAnimation();
this.mCircleView.startAnimation(this.mScaleDownAnimation);
}
private void startProgressAlphaStartAnimation() {
this.mAlphaStartAnimation = startAlphaAnimation(this.mProgress.getAlpha(), STARTING_PROGRESS_ALPHA);
}
private void startProgressAlphaMaxAnimation() {
this.mAlphaMaxAnimation = startAlphaAnimation(this.mProgress.getAlpha(), 255);
}
private Animation startAlphaAnimation(final int i, final int i2) {
Animation animation = new Animation() { // from class: androidx.swiperefreshlayout.widget.SwipeRefreshLayout.4
@Override // android.view.animation.Animation
public void applyTransformation(float f, Transformation transformation) {
SwipeRefreshLayout.this.mProgress.setAlpha((int) (i + ((i2 - r0) * f)));
}
};
animation.setDuration(300L);
this.mCircleView.setAnimationListener(null);
this.mCircleView.clearAnimation();
this.mCircleView.startAnimation(animation);
return animation;
}
@Deprecated
public void setProgressBackgroundColor(int i) {
setProgressBackgroundColorSchemeResource(i);
}
public void setProgressBackgroundColorSchemeResource(@ColorRes int i) {
setProgressBackgroundColorSchemeColor(ContextCompat.getColor(getContext(), i));
}
public void setProgressBackgroundColorSchemeColor(@ColorInt int i) {
this.mCircleView.setBackgroundColor(i);
}
@Deprecated
public void setColorScheme(@ColorRes int... iArr) {
setColorSchemeResources(iArr);
}
public void setColorSchemeResources(@ColorRes int... iArr) {
Context context = getContext();
int[] iArr2 = new int[iArr.length];
for (int i = 0; i < iArr.length; i++) {
iArr2[i] = ContextCompat.getColor(context, iArr[i]);
}
setColorSchemeColors(iArr2);
}
public void setColorSchemeColors(@ColorInt int... iArr) {
ensureTarget();
this.mProgress.setColorSchemeColors(iArr);
}
private void ensureTarget() {
if (this.mTarget == null) {
for (int i = 0; i < getChildCount(); i++) {
View childAt = getChildAt(i);
if (!childAt.equals(this.mCircleView)) {
this.mTarget = childAt;
return;
}
}
}
}
@Override // android.view.ViewGroup, android.view.View
public void onLayout(boolean z, int i, int i2, int i3, int i4) {
int measuredWidth = getMeasuredWidth();
int measuredHeight = getMeasuredHeight();
if (getChildCount() == 0) {
return;
}
if (this.mTarget == null) {
ensureTarget();
}
View view = this.mTarget;
if (view == null) {
return;
}
int paddingLeft = getPaddingLeft();
int paddingTop = getPaddingTop();
view.layout(paddingLeft, paddingTop, ((measuredWidth - getPaddingLeft()) - getPaddingRight()) + paddingLeft, ((measuredHeight - getPaddingTop()) - getPaddingBottom()) + paddingTop);
int measuredWidth2 = this.mCircleView.getMeasuredWidth();
int measuredHeight2 = this.mCircleView.getMeasuredHeight();
int i5 = measuredWidth / 2;
int i6 = measuredWidth2 / 2;
int i7 = this.mCurrentTargetOffsetTop;
this.mCircleView.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.mTarget == null) {
ensureTarget();
}
View view = this.mTarget;
if (view == null) {
return;
}
view.measure(View.MeasureSpec.makeMeasureSpec((getMeasuredWidth() - getPaddingLeft()) - getPaddingRight(), 1073741824), View.MeasureSpec.makeMeasureSpec((getMeasuredHeight() - getPaddingTop()) - getPaddingBottom(), 1073741824));
this.mCircleView.measure(View.MeasureSpec.makeMeasureSpec(this.mCircleDiameter, 1073741824), View.MeasureSpec.makeMeasureSpec(this.mCircleDiameter, 1073741824));
this.mCircleViewIndex = -1;
for (int i3 = 0; i3 < getChildCount(); i3++) {
if (getChildAt(i3) == this.mCircleView) {
this.mCircleViewIndex = i3;
return;
}
}
}
public boolean canChildScrollUp() {
OnChildScrollUpCallback onChildScrollUpCallback = this.mChildScrollUpCallback;
if (onChildScrollUpCallback != null) {
return onChildScrollUpCallback.canChildScrollUp(this, this.mTarget);
}
View view = this.mTarget;
if (view instanceof ListView) {
return ListViewCompat.canScrollList((ListView) view, -1);
}
return view.canScrollVertically(-1);
}
@Override // android.view.ViewGroup
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
ensureTarget();
int actionMasked = motionEvent.getActionMasked();
if (this.mReturningToStart && actionMasked == 0) {
this.mReturningToStart = false;
}
if (!isEnabled() || this.mReturningToStart || canChildScrollUp() || this.mRefreshing || this.mNestedScrollInProgress) {
return false;
}
if (actionMasked != 0) {
if (actionMasked != 1) {
if (actionMasked == 2) {
int i = this.mActivePointerId;
if (i == -1) {
Log.e(LOG_TAG, "Got ACTION_MOVE event but don't have an active pointer id.");
return false;
}
int findPointerIndex = motionEvent.findPointerIndex(i);
if (findPointerIndex < 0) {
return false;
}
startDragging(motionEvent.getY(findPointerIndex));
} else if (actionMasked != 3) {
if (actionMasked == 6) {
onSecondaryPointerUp(motionEvent);
}
}
}
this.mIsBeingDragged = false;
this.mActivePointerId = -1;
} else {
setTargetOffsetTopAndBottom(this.mOriginalOffsetTop - this.mCircleView.getTop());
int pointerId = motionEvent.getPointerId(0);
this.mActivePointerId = pointerId;
this.mIsBeingDragged = false;
int findPointerIndex2 = motionEvent.findPointerIndex(pointerId);
if (findPointerIndex2 < 0) {
return false;
}
this.mInitialDownY = motionEvent.getY(findPointerIndex2);
}
return this.mIsBeingDragged;
}
@Override // android.view.ViewGroup, android.view.ViewParent
public void requestDisallowInterceptTouchEvent(boolean z) {
View view = this.mTarget;
if (view == null || ViewCompat.isNestedScrollingEnabled(view)) {
super.requestDisallowInterceptTouchEvent(z);
}
}
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
public boolean onStartNestedScroll(View view, View view2, int i) {
return (!isEnabled() || this.mReturningToStart || this.mRefreshing || (i & 2) == 0) ? false : true;
}
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
public void onNestedScrollAccepted(View view, View view2, int i) {
this.mNestedScrollingParentHelper.onNestedScrollAccepted(view, view2, i);
startNestedScroll(i & 2);
this.mTotalUnconsumed = 0.0f;
this.mNestedScrollInProgress = true;
}
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
public void onNestedPreScroll(View view, int i, int i2, int[] iArr) {
if (i2 > 0) {
float f = this.mTotalUnconsumed;
if (f > 0.0f) {
float f2 = i2;
if (f2 > f) {
iArr[1] = i2 - ((int) f);
this.mTotalUnconsumed = 0.0f;
} else {
this.mTotalUnconsumed = f - f2;
iArr[1] = i2;
}
moveSpinner(this.mTotalUnconsumed);
}
}
if (this.mUsingCustomStart && i2 > 0 && this.mTotalUnconsumed == 0.0f && Math.abs(i2 - iArr[1]) > 0) {
this.mCircleView.setVisibility(8);
}
int[] iArr2 = this.mParentScrollConsumed;
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, androidx.core.view.NestedScrollingParent
public int getNestedScrollAxes() {
return this.mNestedScrollingParentHelper.getNestedScrollAxes();
}
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
public void onStopNestedScroll(View view) {
this.mNestedScrollingParentHelper.onStopNestedScroll(view);
this.mNestedScrollInProgress = false;
float f = this.mTotalUnconsumed;
if (f > 0.0f) {
finishSpinner(f);
this.mTotalUnconsumed = 0.0f;
}
stopNestedScroll();
}
@Override // android.view.ViewGroup, android.view.ViewParent, androidx.core.view.NestedScrollingParent
public void onNestedScroll(View view, int i, int i2, int i3, int i4) {
dispatchNestedScroll(i, i2, i3, i4, this.mParentOffsetInWindow);
if (i4 + this.mParentOffsetInWindow[1] >= 0 || canChildScrollUp()) {
return;
}
float abs = this.mTotalUnconsumed + Math.abs(r11);
this.mTotalUnconsumed = abs;
moveSpinner(abs);
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public void setNestedScrollingEnabled(boolean z) {
this.mNestedScrollingChildHelper.setNestedScrollingEnabled(z);
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean isNestedScrollingEnabled() {
return this.mNestedScrollingChildHelper.isNestedScrollingEnabled();
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean startNestedScroll(int i) {
return this.mNestedScrollingChildHelper.startNestedScroll(i);
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public void stopNestedScroll() {
this.mNestedScrollingChildHelper.stopNestedScroll();
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean hasNestedScrollingParent() {
return this.mNestedScrollingChildHelper.hasNestedScrollingParent();
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean dispatchNestedScroll(int i, int i2, int i3, int i4, int[] iArr) {
return this.mNestedScrollingChildHelper.dispatchNestedScroll(i, i2, i3, i4, iArr);
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean dispatchNestedPreScroll(int i, int i2, int[] iArr, int[] iArr2) {
return this.mNestedScrollingChildHelper.dispatchNestedPreScroll(i, i2, iArr, iArr2);
}
@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 boolean onNestedFling(View view, float f, float f2, boolean z) {
return dispatchNestedFling(f, f2, z);
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean dispatchNestedFling(float f, float f2, boolean z) {
return this.mNestedScrollingChildHelper.dispatchNestedFling(f, f2, z);
}
@Override // android.view.View, androidx.core.view.NestedScrollingChild
public boolean dispatchNestedPreFling(float f, float f2) {
return this.mNestedScrollingChildHelper.dispatchNestedPreFling(f, f2);
}
private boolean isAnimationRunning(Animation animation) {
return (animation == null || !animation.hasStarted() || animation.hasEnded()) ? false : true;
}
private void moveSpinner(float f) {
this.mProgress.setArrowEnabled(true);
float min = Math.min(1.0f, Math.abs(f / this.mTotalDragDistance));
float max = (((float) Math.max(min - 0.4d, 0.0d)) * 5.0f) / 3.0f;
float abs = Math.abs(f) - this.mTotalDragDistance;
int i = this.mCustomSlingshotDistance;
if (i <= 0) {
i = this.mUsingCustomStart ? this.mSpinnerOffsetEnd - this.mOriginalOffsetTop : this.mSpinnerOffsetEnd;
}
float f2 = i;
double max2 = Math.max(0.0f, Math.min(abs, f2 * 2.0f) / f2) / 4.0f;
float pow = ((float) (max2 - Math.pow(max2, 2.0d))) * 2.0f;
int i2 = this.mOriginalOffsetTop + ((int) ((f2 * min) + (f2 * pow * 2.0f)));
if (this.mCircleView.getVisibility() != 0) {
this.mCircleView.setVisibility(0);
}
if (!this.mScale) {
this.mCircleView.setScaleX(1.0f);
this.mCircleView.setScaleY(1.0f);
}
if (this.mScale) {
setAnimationProgress(Math.min(1.0f, f / this.mTotalDragDistance));
}
if (f < this.mTotalDragDistance) {
if (this.mProgress.getAlpha() > STARTING_PROGRESS_ALPHA && !isAnimationRunning(this.mAlphaStartAnimation)) {
startProgressAlphaStartAnimation();
}
} else if (this.mProgress.getAlpha() < 255 && !isAnimationRunning(this.mAlphaMaxAnimation)) {
startProgressAlphaMaxAnimation();
}
this.mProgress.setStartEndTrim(0.0f, Math.min(MAX_PROGRESS_ANGLE, max * MAX_PROGRESS_ANGLE));
this.mProgress.setArrowScale(Math.min(1.0f, max));
this.mProgress.setProgressRotation((((max * 0.4f) - 0.25f) + (pow * 2.0f)) * DRAG_RATE);
setTargetOffsetTopAndBottom(i2 - this.mCurrentTargetOffsetTop);
}
private void finishSpinner(float f) {
if (f > this.mTotalDragDistance) {
setRefreshing(true, true);
return;
}
this.mRefreshing = false;
this.mProgress.setStartEndTrim(0.0f, 0.0f);
animateOffsetToStartPosition(this.mCurrentTargetOffsetTop, !this.mScale ? new Animation.AnimationListener() { // from class: androidx.swiperefreshlayout.widget.SwipeRefreshLayout.5
@Override // android.view.animation.Animation.AnimationListener
public void onAnimationRepeat(Animation animation) {
}
@Override // android.view.animation.Animation.AnimationListener
public void onAnimationStart(Animation animation) {
}
@Override // android.view.animation.Animation.AnimationListener
public void onAnimationEnd(Animation animation) {
SwipeRefreshLayout swipeRefreshLayout = SwipeRefreshLayout.this;
if (swipeRefreshLayout.mScale) {
return;
}
swipeRefreshLayout.startScaleDownAnimation(null);
}
} : null);
this.mProgress.setArrowEnabled(false);
}
@Override // android.view.View
public boolean onTouchEvent(MotionEvent motionEvent) {
int actionMasked = motionEvent.getActionMasked();
if (this.mReturningToStart && actionMasked == 0) {
this.mReturningToStart = false;
}
if (!isEnabled() || this.mReturningToStart || canChildScrollUp() || this.mRefreshing || this.mNestedScrollInProgress) {
return false;
}
if (actionMasked == 0) {
this.mActivePointerId = motionEvent.getPointerId(0);
this.mIsBeingDragged = false;
} else {
if (actionMasked == 1) {
int findPointerIndex = motionEvent.findPointerIndex(this.mActivePointerId);
if (findPointerIndex < 0) {
Log.e(LOG_TAG, "Got ACTION_UP event but don't have an active pointer id.");
return false;
}
if (this.mIsBeingDragged) {
float y = (motionEvent.getY(findPointerIndex) - this.mInitialMotionY) * DRAG_RATE;
this.mIsBeingDragged = false;
finishSpinner(y);
}
this.mActivePointerId = -1;
return false;
}
if (actionMasked == 2) {
int findPointerIndex2 = motionEvent.findPointerIndex(this.mActivePointerId);
if (findPointerIndex2 < 0) {
Log.e(LOG_TAG, "Got ACTION_MOVE event but have an invalid active pointer id.");
return false;
}
float y2 = motionEvent.getY(findPointerIndex2);
startDragging(y2);
if (this.mIsBeingDragged) {
float f = (y2 - this.mInitialMotionY) * DRAG_RATE;
if (f <= 0.0f) {
return false;
}
moveSpinner(f);
}
} else {
if (actionMasked == 3) {
return false;
}
if (actionMasked == 5) {
int actionIndex = motionEvent.getActionIndex();
if (actionIndex < 0) {
Log.e(LOG_TAG, "Got ACTION_POINTER_DOWN event but have an invalid action index.");
return false;
}
this.mActivePointerId = motionEvent.getPointerId(actionIndex);
} else if (actionMasked == 6) {
onSecondaryPointerUp(motionEvent);
}
}
}
return true;
}
private void startDragging(float f) {
float f2 = this.mInitialDownY;
float f3 = f - f2;
int i = this.mTouchSlop;
if (f3 <= i || this.mIsBeingDragged) {
return;
}
this.mInitialMotionY = f2 + i;
this.mIsBeingDragged = true;
this.mProgress.setAlpha(STARTING_PROGRESS_ALPHA);
}
private void animateOffsetToCorrectPosition(int i, Animation.AnimationListener animationListener) {
this.mFrom = i;
this.mAnimateToCorrectPosition.reset();
this.mAnimateToCorrectPosition.setDuration(200L);
this.mAnimateToCorrectPosition.setInterpolator(this.mDecelerateInterpolator);
if (animationListener != null) {
this.mCircleView.setAnimationListener(animationListener);
}
this.mCircleView.clearAnimation();
this.mCircleView.startAnimation(this.mAnimateToCorrectPosition);
}
private void animateOffsetToStartPosition(int i, Animation.AnimationListener animationListener) {
if (this.mScale) {
startScaleDownReturnToStartAnimation(i, animationListener);
return;
}
this.mFrom = i;
this.mAnimateToStartPosition.reset();
this.mAnimateToStartPosition.setDuration(200L);
this.mAnimateToStartPosition.setInterpolator(this.mDecelerateInterpolator);
if (animationListener != null) {
this.mCircleView.setAnimationListener(animationListener);
}
this.mCircleView.clearAnimation();
this.mCircleView.startAnimation(this.mAnimateToStartPosition);
}
public void moveToStart(float f) {
setTargetOffsetTopAndBottom((this.mFrom + ((int) ((this.mOriginalOffsetTop - r0) * f))) - this.mCircleView.getTop());
}
private void startScaleDownReturnToStartAnimation(int i, Animation.AnimationListener animationListener) {
this.mFrom = i;
this.mStartingScale = this.mCircleView.getScaleX();
Animation animation = new Animation() { // from class: androidx.swiperefreshlayout.widget.SwipeRefreshLayout.8
@Override // android.view.animation.Animation
public void applyTransformation(float f, Transformation transformation) {
SwipeRefreshLayout swipeRefreshLayout = SwipeRefreshLayout.this;
float f2 = swipeRefreshLayout.mStartingScale;
swipeRefreshLayout.setAnimationProgress(f2 + ((-f2) * f));
SwipeRefreshLayout.this.moveToStart(f);
}
};
this.mScaleDownToStartAnimation = animation;
animation.setDuration(150L);
if (animationListener != null) {
this.mCircleView.setAnimationListener(animationListener);
}
this.mCircleView.clearAnimation();
this.mCircleView.startAnimation(this.mScaleDownToStartAnimation);
}
public void setTargetOffsetTopAndBottom(int i) {
this.mCircleView.bringToFront();
ViewCompat.offsetTopAndBottom(this.mCircleView, i);
this.mCurrentTargetOffsetTop = this.mCircleView.getTop();
}
private void onSecondaryPointerUp(MotionEvent motionEvent) {
int actionIndex = motionEvent.getActionIndex();
if (motionEvent.getPointerId(actionIndex) == this.mActivePointerId) {
this.mActivePointerId = motionEvent.getPointerId(actionIndex == 0 ? 1 : 0);
}
}
}