Rabbit-R1/original r1/smali/smali_classes2/androidx/recyclerview/widget/LinearSmoothScroller.smali
2024-05-21 17:08:36 -04:00

725 lines
17 KiB
Smali

.class public Landroidx/recyclerview/widget/LinearSmoothScroller;
.super Landroidx/recyclerview/widget/RecyclerView$SmoothScroller;
.source "LinearSmoothScroller.java"
# static fields
.field private static final DEBUG:Z = false
.field private static final MILLISECONDS_PER_INCH:F = 25.0f
.field public static final SNAP_TO_ANY:I = 0x0
.field public static final SNAP_TO_END:I = 0x1
.field public static final SNAP_TO_START:I = -0x1
.field private static final TARGET_SEEK_EXTRA_SCROLL_RATIO:F = 1.2f
.field private static final TARGET_SEEK_SCROLL_DISTANCE_PX:I = 0x2710
# instance fields
.field protected final mDecelerateInterpolator:Landroid/view/animation/DecelerateInterpolator;
.field private final mDisplayMetrics:Landroid/util/DisplayMetrics;
.field private mHasCalculatedMillisPerPixel:Z
.field protected mInterimTargetDx:I
.field protected mInterimTargetDy:I
.field protected final mLinearInterpolator:Landroid/view/animation/LinearInterpolator;
.field private mMillisPerPixel:F
.field protected mTargetVector:Landroid/graphics/PointF;
# direct methods
.method public constructor <init>(Landroid/content/Context;)V
.locals 1
.line 96
invoke-direct {p0}, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller;-><init>()V
.line 80
new-instance v0, Landroid/view/animation/LinearInterpolator;
invoke-direct {v0}, Landroid/view/animation/LinearInterpolator;-><init>()V
iput-object v0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mLinearInterpolator:Landroid/view/animation/LinearInterpolator;
.line 82
new-instance v0, Landroid/view/animation/DecelerateInterpolator;
invoke-direct {v0}, Landroid/view/animation/DecelerateInterpolator;-><init>()V
iput-object v0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mDecelerateInterpolator:Landroid/view/animation/DecelerateInterpolator;
const/4 v0, 0x0
iput-boolean v0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mHasCalculatedMillisPerPixel:Z
iput v0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mInterimTargetDx:I
iput v0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mInterimTargetDy:I
.line 97
invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object p1
invoke-virtual {p1}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;
move-result-object p1
iput-object p1, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mDisplayMetrics:Landroid/util/DisplayMetrics;
return-void
.end method
.method private clampApplyScroll(II)I
.locals 0
sub-int p0, p1, p2
mul-int/2addr p1, p0
if-gtz p1, :cond_0
const/4 p0, 0x0
:cond_0
return p0
.end method
.method private getSpeedPerPixel()F
.locals 1
iget-boolean v0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mHasCalculatedMillisPerPixel:Z
if-nez v0, :cond_0
iget-object v0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mDisplayMetrics:Landroid/util/DisplayMetrics;
.line 177
invoke-virtual {p0, v0}, Landroidx/recyclerview/widget/LinearSmoothScroller;->calculateSpeedPerPixel(Landroid/util/DisplayMetrics;)F
move-result v0
iput v0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mMillisPerPixel:F
const/4 v0, 0x1
iput-boolean v0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mHasCalculatedMillisPerPixel:Z
:cond_0
iget p0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mMillisPerPixel:F
return p0
.end method
# virtual methods
.method public calculateDtToFit(IIIII)I
.locals 0
const/4 p0, -0x1
if-eq p5, p0, :cond_4
if-eqz p5, :cond_1
const/4 p0, 0x1
if-ne p5, p0, :cond_0
sub-int/2addr p4, p2
return p4
.line 303
:cond_0
new-instance p0, Ljava/lang/IllegalArgumentException;
const-string p1, "snap preference should be one of the constants defined in SmoothScroller, starting with SNAP_"
invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p0
:cond_1
sub-int/2addr p3, p1
if-lez p3, :cond_2
return p3
:cond_2
sub-int/2addr p4, p2
if-gez p4, :cond_3
return p4
:cond_3
const/4 p0, 0x0
return p0
:cond_4
sub-int/2addr p3, p1
return p3
.end method
.method public calculateDxToMakeVisible(Landroid/view/View;I)I
.locals 10
.line 348
invoke-virtual {p0}, Landroidx/recyclerview/widget/LinearSmoothScroller;->getLayoutManager()Landroidx/recyclerview/widget/RecyclerView$LayoutManager;
move-result-object v0
if-eqz v0, :cond_1
.line 349
invoke-virtual {v0}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollHorizontally()Z
move-result v1
if-nez v1, :cond_0
goto :goto_0
.line 353
:cond_0
invoke-virtual {p1}, Landroid/view/View;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;
move-result-object v1
check-cast v1, Landroidx/recyclerview/widget/RecyclerView$LayoutParams;
.line 354
invoke-virtual {v0, p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getDecoratedLeft(Landroid/view/View;)I
move-result v2
iget v3, v1, Landroidx/recyclerview/widget/RecyclerView$LayoutParams;->leftMargin:I
sub-int v5, v2, v3
.line 355
invoke-virtual {v0, p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getDecoratedRight(Landroid/view/View;)I
move-result p1
iget v1, v1, Landroidx/recyclerview/widget/RecyclerView$LayoutParams;->rightMargin:I
add-int v6, p1, v1
.line 356
invoke-virtual {v0}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getPaddingLeft()I
move-result v7
.line 357
invoke-virtual {v0}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getWidth()I
move-result p1
invoke-virtual {v0}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getPaddingRight()I
move-result v0
sub-int v8, p1, v0
move-object v4, p0
move v9, p2
.line 358
invoke-virtual/range {v4 .. v9}, Landroidx/recyclerview/widget/LinearSmoothScroller;->calculateDtToFit(IIIII)I
move-result p0
return p0
:cond_1
:goto_0
const/4 p0, 0x0
return p0
.end method
.method public calculateDyToMakeVisible(Landroid/view/View;I)I
.locals 10
.line 322
invoke-virtual {p0}, Landroidx/recyclerview/widget/LinearSmoothScroller;->getLayoutManager()Landroidx/recyclerview/widget/RecyclerView$LayoutManager;
move-result-object v0
if-eqz v0, :cond_1
.line 323
invoke-virtual {v0}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollVertically()Z
move-result v1
if-nez v1, :cond_0
goto :goto_0
.line 327
:cond_0
invoke-virtual {p1}, Landroid/view/View;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;
move-result-object v1
check-cast v1, Landroidx/recyclerview/widget/RecyclerView$LayoutParams;
.line 328
invoke-virtual {v0, p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getDecoratedTop(Landroid/view/View;)I
move-result v2
iget v3, v1, Landroidx/recyclerview/widget/RecyclerView$LayoutParams;->topMargin:I
sub-int v5, v2, v3
.line 329
invoke-virtual {v0, p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getDecoratedBottom(Landroid/view/View;)I
move-result p1
iget v1, v1, Landroidx/recyclerview/widget/RecyclerView$LayoutParams;->bottomMargin:I
add-int v6, p1, v1
.line 330
invoke-virtual {v0}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getPaddingTop()I
move-result v7
.line 331
invoke-virtual {v0}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getHeight()I
move-result p1
invoke-virtual {v0}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getPaddingBottom()I
move-result v0
sub-int v8, p1, v0
move-object v4, p0
move v9, p2
.line 332
invoke-virtual/range {v4 .. v9}, Landroidx/recyclerview/widget/LinearSmoothScroller;->calculateDtToFit(IIIII)I
move-result p0
return p0
:cond_1
:goto_0
const/4 p0, 0x0
return p0
.end method
.method protected calculateSpeedPerPixel(Landroid/util/DisplayMetrics;)F
.locals 0
.line 172
iget p0, p1, Landroid/util/DisplayMetrics;->densityDpi:I
int-to-float p0, p0
const/high16 p1, 0x41c80000 # 25.0f
div-float/2addr p1, p0
return p1
.end method
.method protected calculateTimeForDeceleration(I)I
.locals 2
.line 197
invoke-virtual {p0, p1}, Landroidx/recyclerview/widget/LinearSmoothScroller;->calculateTimeForScrolling(I)I
move-result p0
int-to-double p0, p0
const-wide v0, 0x3fd57a786c22680aL # 0.3356
div-double/2addr p0, v0
invoke-static {p0, p1}, Ljava/lang/Math;->ceil(D)D
move-result-wide p0
double-to-int p0, p0
return p0
.end method
.method protected calculateTimeForScrolling(I)I
.locals 0
.line 211
invoke-static {p1}, Ljava/lang/Math;->abs(I)I
move-result p1
int-to-float p1, p1
invoke-direct {p0}, Landroidx/recyclerview/widget/LinearSmoothScroller;->getSpeedPerPixel()F
move-result p0
mul-float/2addr p1, p0
float-to-double p0, p1
invoke-static {p0, p1}, Ljava/lang/Math;->ceil(D)D
move-result-wide p0
double-to-int p0, p0
return p0
.end method
.method protected getHorizontalSnapPreference()I
.locals 2
iget-object v0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mTargetVector:Landroid/graphics/PointF;
if-eqz v0, :cond_2
.line 224
iget v0, v0, Landroid/graphics/PointF;->x:F
const/4 v1, 0x0
cmpl-float v0, v0, v1
if-nez v0, :cond_0
goto :goto_0
:cond_0
iget-object p0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mTargetVector:Landroid/graphics/PointF;
.line 225
iget p0, p0, Landroid/graphics/PointF;->x:F
cmpl-float p0, p0, v1
if-lez p0, :cond_1
const/4 p0, 0x1
goto :goto_1
:cond_1
const/4 p0, -0x1
goto :goto_1
:cond_2
:goto_0
const/4 p0, 0x0
:goto_1
return p0
.end method
.method protected getVerticalSnapPreference()I
.locals 2
iget-object v0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mTargetVector:Landroid/graphics/PointF;
if-eqz v0, :cond_2
.line 238
iget v0, v0, Landroid/graphics/PointF;->y:F
const/4 v1, 0x0
cmpl-float v0, v0, v1
if-nez v0, :cond_0
goto :goto_0
:cond_0
iget-object p0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mTargetVector:Landroid/graphics/PointF;
.line 239
iget p0, p0, Landroid/graphics/PointF;->y:F
cmpl-float p0, p0, v1
if-lez p0, :cond_1
const/4 p0, 0x1
goto :goto_1
:cond_1
const/4 p0, -0x1
goto :goto_1
:cond_2
:goto_0
const/4 p0, 0x0
:goto_1
return p0
.end method
.method protected onSeekTargetStep(IILandroidx/recyclerview/widget/RecyclerView$State;Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$Action;)V
.locals 0
.line 132
invoke-virtual {p0}, Landroidx/recyclerview/widget/LinearSmoothScroller;->getChildCount()I
move-result p3
if-nez p3, :cond_0
.line 133
invoke-virtual {p0}, Landroidx/recyclerview/widget/LinearSmoothScroller;->stop()V
return-void
:cond_0
iget p3, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mInterimTargetDx:I
.line 142
invoke-direct {p0, p3, p1}, Landroidx/recyclerview/widget/LinearSmoothScroller;->clampApplyScroll(II)I
move-result p1
iput p1, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mInterimTargetDx:I
iget p1, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mInterimTargetDy:I
.line 143
invoke-direct {p0, p1, p2}, Landroidx/recyclerview/widget/LinearSmoothScroller;->clampApplyScroll(II)I
move-result p1
iput p1, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mInterimTargetDy:I
iget p2, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mInterimTargetDx:I
if-nez p2, :cond_1
if-nez p1, :cond_1
.line 146
invoke-virtual {p0, p4}, Landroidx/recyclerview/widget/LinearSmoothScroller;->updateActionForInterimTarget(Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$Action;)V
:cond_1
return-void
.end method
.method protected onStart()V
.locals 0
return-void
.end method
.method protected onStop()V
.locals 1
const/4 v0, 0x0
iput v0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mInterimTargetDy:I
iput v0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mInterimTargetDx:I
const/4 v0, 0x0
iput-object v0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mTargetVector:Landroid/graphics/PointF;
return-void
.end method
.method protected onTargetFound(Landroid/view/View;Landroidx/recyclerview/widget/RecyclerView$State;Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$Action;)V
.locals 2
.line 114
invoke-virtual {p0}, Landroidx/recyclerview/widget/LinearSmoothScroller;->getHorizontalSnapPreference()I
move-result p2
invoke-virtual {p0, p1, p2}, Landroidx/recyclerview/widget/LinearSmoothScroller;->calculateDxToMakeVisible(Landroid/view/View;I)I
move-result p2
.line 115
invoke-virtual {p0}, Landroidx/recyclerview/widget/LinearSmoothScroller;->getVerticalSnapPreference()I
move-result v0
invoke-virtual {p0, p1, v0}, Landroidx/recyclerview/widget/LinearSmoothScroller;->calculateDyToMakeVisible(Landroid/view/View;I)I
move-result p1
mul-int v0, p2, p2
mul-int v1, p1, p1
add-int/2addr v0, v1
int-to-double v0, v0
.line 116
invoke-static {v0, v1}, Ljava/lang/Math;->sqrt(D)D
move-result-wide v0
double-to-int v0, v0
.line 117
invoke-virtual {p0, v0}, Landroidx/recyclerview/widget/LinearSmoothScroller;->calculateTimeForDeceleration(I)I
move-result v0
if-lez v0, :cond_0
neg-int p2, p2
neg-int p1, p1
iget-object p0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mDecelerateInterpolator:Landroid/view/animation/DecelerateInterpolator;
.line 119
invoke-virtual {p3, p2, p1, v0, p0}, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$Action;->update(IIILandroid/view/animation/Interpolator;)V
:cond_0
return-void
.end method
.method protected updateActionForInterimTarget(Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$Action;)V
.locals 4
.line 251
invoke-virtual {p0}, Landroidx/recyclerview/widget/LinearSmoothScroller;->getTargetPosition()I
move-result v0
invoke-virtual {p0, v0}, Landroidx/recyclerview/widget/LinearSmoothScroller;->computeScrollVectorForPosition(I)Landroid/graphics/PointF;
move-result-object v0
if-eqz v0, :cond_1
.line 252
iget v1, v0, Landroid/graphics/PointF;->x:F
const/4 v2, 0x0
cmpl-float v1, v1, v2
if-nez v1, :cond_0
iget v1, v0, Landroid/graphics/PointF;->y:F
cmpl-float v1, v1, v2
if-nez v1, :cond_0
goto :goto_0
.line 258
:cond_0
invoke-virtual {p0, v0}, Landroidx/recyclerview/widget/LinearSmoothScroller;->normalize(Landroid/graphics/PointF;)V
iput-object v0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mTargetVector:Landroid/graphics/PointF;
.line 261
iget v1, v0, Landroid/graphics/PointF;->x:F
const v2, 0x461c4000 # 10000.0f
mul-float/2addr v1, v2
float-to-int v1, v1
iput v1, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mInterimTargetDx:I
.line 262
iget v0, v0, Landroid/graphics/PointF;->y:F
mul-float/2addr v0, v2
float-to-int v0, v0
iput v0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mInterimTargetDy:I
const/16 v0, 0x2710
.line 263
invoke-virtual {p0, v0}, Landroidx/recyclerview/widget/LinearSmoothScroller;->calculateTimeForScrolling(I)I
move-result v0
iget v1, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mInterimTargetDx:I
int-to-float v1, v1
const v2, 0x3f99999a # 1.2f
mul-float/2addr v1, v2
float-to-int v1, v1
iget v3, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mInterimTargetDy:I
int-to-float v3, v3
mul-float/2addr v3, v2
float-to-int v3, v3
int-to-float v0, v0
mul-float/2addr v0, v2
float-to-int v0, v0
iget-object p0, p0, Landroidx/recyclerview/widget/LinearSmoothScroller;->mLinearInterpolator:Landroid/view/animation/LinearInterpolator;
.line 267
invoke-virtual {p1, v1, v3, v0, p0}, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$Action;->update(IIILandroid/view/animation/Interpolator;)V
return-void
.line 253
:cond_1
:goto_0
invoke-virtual {p0}, Landroidx/recyclerview/widget/LinearSmoothScroller;->getTargetPosition()I
move-result v0
.line 254
invoke-virtual {p1, v0}, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$Action;->jumpTo(I)V
.line 255
invoke-virtual {p0}, Landroidx/recyclerview/widget/LinearSmoothScroller;->stop()V
return-void
.end method