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

614 lines
15 KiB
Smali

.class public Landroidx/recyclerview/widget/PagerSnapHelper;
.super Landroidx/recyclerview/widget/SnapHelper;
.source "PagerSnapHelper.java"
# static fields
.field private static final MAX_SCROLL_ON_FLING_DURATION:I = 0x64
# instance fields
.field private mHorizontalHelper:Landroidx/recyclerview/widget/OrientationHelper;
.field private mVerticalHelper:Landroidx/recyclerview/widget/OrientationHelper;
# direct methods
.method public constructor <init>()V
.locals 0
.line 39
invoke-direct {p0}, Landroidx/recyclerview/widget/SnapHelper;-><init>()V
return-void
.end method
.method private distanceToCenter(Landroid/view/View;Landroidx/recyclerview/widget/OrientationHelper;)I
.locals 0
.line 204
invoke-virtual {p2, p1}, Landroidx/recyclerview/widget/OrientationHelper;->getDecoratedStart(Landroid/view/View;)I
move-result p0
.line 205
invoke-virtual {p2, p1}, Landroidx/recyclerview/widget/OrientationHelper;->getDecoratedMeasurement(Landroid/view/View;)I
move-result p1
div-int/lit8 p1, p1, 0x2
add-int/2addr p0, p1
.line 206
invoke-virtual {p2}, Landroidx/recyclerview/widget/OrientationHelper;->getStartAfterPadding()I
move-result p1
invoke-virtual {p2}, Landroidx/recyclerview/widget/OrientationHelper;->getTotalSpace()I
move-result p2
div-int/lit8 p2, p2, 0x2
add-int/2addr p1, p2
sub-int/2addr p0, p1
return p0
.end method
.method private findCenterView(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroidx/recyclerview/widget/OrientationHelper;)Landroid/view/View;
.locals 7
.line 222
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getChildCount()I
move-result p0
const/4 v0, 0x0
if-nez p0, :cond_0
return-object v0
.line 228
:cond_0
invoke-virtual {p2}, Landroidx/recyclerview/widget/OrientationHelper;->getStartAfterPadding()I
move-result v1
invoke-virtual {p2}, Landroidx/recyclerview/widget/OrientationHelper;->getTotalSpace()I
move-result v2
div-int/lit8 v2, v2, 0x2
add-int/2addr v1, v2
const v2, 0x7fffffff
const/4 v3, 0x0
:goto_0
if-ge v3, p0, :cond_2
.line 232
invoke-virtual {p1, v3}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getChildAt(I)Landroid/view/View;
move-result-object v4
.line 233
invoke-virtual {p2, v4}, Landroidx/recyclerview/widget/OrientationHelper;->getDecoratedStart(Landroid/view/View;)I
move-result v5
.line 234
invoke-virtual {p2, v4}, Landroidx/recyclerview/widget/OrientationHelper;->getDecoratedMeasurement(Landroid/view/View;)I
move-result v6
div-int/lit8 v6, v6, 0x2
add-int/2addr v5, v6
sub-int/2addr v5, v1
.line 235
invoke-static {v5}, Ljava/lang/Math;->abs(I)I
move-result v5
if-ge v5, v2, :cond_1
move-object v0, v4
move v2, v5
:cond_1
add-int/lit8 v3, v3, 0x1
goto :goto_0
:cond_2
return-object v0
.end method
.method private getHorizontalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
.locals 1
iget-object v0, p0, Landroidx/recyclerview/widget/PagerSnapHelper;->mHorizontalHelper:Landroidx/recyclerview/widget/OrientationHelper;
if-eqz v0, :cond_0
.line 268
iget-object v0, v0, Landroidx/recyclerview/widget/OrientationHelper;->mLayoutManager:Landroidx/recyclerview/widget/RecyclerView$LayoutManager;
if-eq v0, p1, :cond_1
.line 269
:cond_0
invoke-static {p1}, Landroidx/recyclerview/widget/OrientationHelper;->createHorizontalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
move-result-object p1
iput-object p1, p0, Landroidx/recyclerview/widget/PagerSnapHelper;->mHorizontalHelper:Landroidx/recyclerview/widget/OrientationHelper;
:cond_1
iget-object p0, p0, Landroidx/recyclerview/widget/PagerSnapHelper;->mHorizontalHelper:Landroidx/recyclerview/widget/OrientationHelper;
return-object p0
.end method
.method private getOrientationHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
.locals 1
.line 248
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollVertically()Z
move-result v0
if-eqz v0, :cond_0
.line 249
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/PagerSnapHelper;->getVerticalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
move-result-object p0
return-object p0
.line 250
:cond_0
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollHorizontally()Z
move-result v0
if-eqz v0, :cond_1
.line 251
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/PagerSnapHelper;->getHorizontalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
move-result-object p0
return-object p0
:cond_1
const/4 p0, 0x0
return-object p0
.end method
.method private getVerticalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
.locals 1
iget-object v0, p0, Landroidx/recyclerview/widget/PagerSnapHelper;->mVerticalHelper:Landroidx/recyclerview/widget/OrientationHelper;
if-eqz v0, :cond_0
.line 259
iget-object v0, v0, Landroidx/recyclerview/widget/OrientationHelper;->mLayoutManager:Landroidx/recyclerview/widget/RecyclerView$LayoutManager;
if-eq v0, p1, :cond_1
.line 260
:cond_0
invoke-static {p1}, Landroidx/recyclerview/widget/OrientationHelper;->createVerticalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
move-result-object p1
iput-object p1, p0, Landroidx/recyclerview/widget/PagerSnapHelper;->mVerticalHelper:Landroidx/recyclerview/widget/OrientationHelper;
:cond_1
iget-object p0, p0, Landroidx/recyclerview/widget/PagerSnapHelper;->mVerticalHelper:Landroidx/recyclerview/widget/OrientationHelper;
return-object p0
.end method
.method private isForwardFling(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;II)Z
.locals 1
.line 150
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollHorizontally()Z
move-result p0
const/4 p1, 0x1
const/4 v0, 0x0
if-eqz p0, :cond_1
if-lez p2, :cond_0
goto :goto_0
:cond_0
move p1, v0
:goto_0
return p1
:cond_1
if-lez p3, :cond_2
goto :goto_1
:cond_2
move p1, v0
:goto_1
return p1
.end method
.method private isReverseLayout(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Z
.locals 3
.line 158
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getItemCount()I
move-result p0
.line 159
instance-of v0, p1, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$ScrollVectorProvider;
const/4 v1, 0x0
if-eqz v0, :cond_1
.line 160
check-cast p1, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$ScrollVectorProvider;
const/4 v0, 0x1
sub-int/2addr p0, v0
.line 162
invoke-interface {p1, p0}, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$ScrollVectorProvider;->computeScrollVectorForPosition(I)Landroid/graphics/PointF;
move-result-object p0
if-eqz p0, :cond_1
.line 164
iget p1, p0, Landroid/graphics/PointF;->x:F
const/4 v2, 0x0
cmpg-float p1, p1, v2
if-ltz p1, :cond_0
iget p0, p0, Landroid/graphics/PointF;->y:F
cmpg-float p0, p0, v2
if-gez p0, :cond_1
:cond_0
move v1, v0
:cond_1
return v1
.end method
# virtual methods
.method public calculateDistanceToFinalSnap(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroid/view/View;)[I
.locals 4
const/4 v0, 0x2
new-array v0, v0, [I
.line 53
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollHorizontally()Z
move-result v1
const/4 v2, 0x0
if-eqz v1, :cond_0
.line 55
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/PagerSnapHelper;->getHorizontalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
move-result-object v1
.line 54
invoke-direct {p0, p2, v1}, Landroidx/recyclerview/widget/PagerSnapHelper;->distanceToCenter(Landroid/view/View;Landroidx/recyclerview/widget/OrientationHelper;)I
move-result v1
aput v1, v0, v2
goto :goto_0
:cond_0
aput v2, v0, v2
.line 60
:goto_0
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollVertically()Z
move-result v1
const/4 v3, 0x1
if-eqz v1, :cond_1
.line 62
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/PagerSnapHelper;->getVerticalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
move-result-object p1
.line 61
invoke-direct {p0, p2, p1}, Landroidx/recyclerview/widget/PagerSnapHelper;->distanceToCenter(Landroid/view/View;Landroidx/recyclerview/widget/OrientationHelper;)I
move-result p0
aput p0, v0, v3
goto :goto_1
:cond_1
aput v2, v0, v3
:goto_1
return-object v0
.end method
.method protected createScroller(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/RecyclerView$SmoothScroller;
.locals 1
.line 174
instance-of p1, p1, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$ScrollVectorProvider;
if-nez p1, :cond_0
const/4 p0, 0x0
return-object p0
.line 177
:cond_0
new-instance p1, Landroidx/recyclerview/widget/PagerSnapHelper$1;
iget-object v0, p0, Landroidx/recyclerview/widget/PagerSnapHelper;->mRecyclerView:Landroidx/recyclerview/widget/RecyclerView;
invoke-virtual {v0}, Landroidx/recyclerview/widget/RecyclerView;->getContext()Landroid/content/Context;
move-result-object v0
invoke-direct {p1, p0, v0}, Landroidx/recyclerview/widget/PagerSnapHelper$1;-><init>(Landroidx/recyclerview/widget/PagerSnapHelper;Landroid/content/Context;)V
return-object p1
.end method
.method public findSnapView(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroid/view/View;
.locals 1
.line 73
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollVertically()Z
move-result v0
if-eqz v0, :cond_0
.line 74
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/PagerSnapHelper;->getVerticalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
move-result-object v0
invoke-direct {p0, p1, v0}, Landroidx/recyclerview/widget/PagerSnapHelper;->findCenterView(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroidx/recyclerview/widget/OrientationHelper;)Landroid/view/View;
move-result-object p0
return-object p0
.line 75
:cond_0
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollHorizontally()Z
move-result v0
if-eqz v0, :cond_1
.line 76
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/PagerSnapHelper;->getHorizontalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
move-result-object v0
invoke-direct {p0, p1, v0}, Landroidx/recyclerview/widget/PagerSnapHelper;->findCenterView(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroidx/recyclerview/widget/OrientationHelper;)Landroid/view/View;
move-result-object p0
return-object p0
:cond_1
const/4 p0, 0x0
return-object p0
.end method
.method public findTargetSnapPosition(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;II)I
.locals 11
.line 85
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getItemCount()I
move-result v0
const/4 v1, -0x1
if-nez v0, :cond_0
return v1
.line 90
:cond_0
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/PagerSnapHelper;->getOrientationHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
move-result-object v2
if-nez v2, :cond_1
return v1
.line 102
:cond_1
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getChildCount()I
move-result v3
const/4 v4, 0x0
const/high16 v5, -0x80000000
const v6, 0x7fffffff
const/4 v7, 0x0
move v8, v7
move v7, v6
move v6, v5
move-object v5, v4
:goto_0
if-ge v8, v3, :cond_5
.line 104
invoke-virtual {p1, v8}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getChildAt(I)Landroid/view/View;
move-result-object v9
if-nez v9, :cond_2
goto :goto_1
.line 108
:cond_2
invoke-direct {p0, v9, v2}, Landroidx/recyclerview/widget/PagerSnapHelper;->distanceToCenter(Landroid/view/View;Landroidx/recyclerview/widget/OrientationHelper;)I
move-result v10
if-gtz v10, :cond_3
if-le v10, v6, :cond_3
move-object v5, v9
move v6, v10
:cond_3
if-ltz v10, :cond_4
if-ge v10, v7, :cond_4
move-object v4, v9
move v7, v10
:cond_4
:goto_1
add-int/lit8 v8, v8, 0x1
goto :goto_0
.line 123
:cond_5
invoke-direct {p0, p1, p2, p3}, Landroidx/recyclerview/widget/PagerSnapHelper;->isForwardFling(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;II)Z
move-result p2
if-eqz p2, :cond_6
if-eqz v4, :cond_6
.line 125
invoke-virtual {p1, v4}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getPosition(Landroid/view/View;)I
move-result p0
return p0
:cond_6
if-nez p2, :cond_7
if-eqz v5, :cond_7
.line 127
invoke-virtual {p1, v5}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getPosition(Landroid/view/View;)I
move-result p0
return p0
:cond_7
if-eqz p2, :cond_8
move-object v4, v5
:cond_8
if-nez v4, :cond_9
return v1
.line 138
:cond_9
invoke-virtual {p1, v4}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getPosition(Landroid/view/View;)I
move-result p3
.line 140
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/PagerSnapHelper;->isReverseLayout(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Z
move-result p0
if-ne p0, p2, :cond_a
move p0, v1
goto :goto_2
:cond_a
const/4 p0, 0x1
:goto_2
add-int/2addr p3, p0
if-ltz p3, :cond_c
if-lt p3, v0, :cond_b
goto :goto_3
:cond_b
return p3
:cond_c
:goto_3
return v1
.end method