apkfuckery/com.discord/smali/androidx/recyclerview/widget/PagerSnapHelper.smali

605 lines
16 KiB
Smali
Raw Normal View History

2020-05-17 12:40:10 +00:00
.class public Landroidx/recyclerview/widget/PagerSnapHelper;
.super Landroidx/recyclerview/widget/SnapHelper;
.source "PagerSnapHelper.java"
# static fields
.field public static final MAX_SCROLL_ON_FLING_DURATION:I = 0x64
# instance fields
.field public mHorizontalHelper:Landroidx/recyclerview/widget/OrientationHelper;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end field
.field public mVerticalHelper:Landroidx/recyclerview/widget/OrientationHelper;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end field
# direct methods
.method public constructor <init>()V
.locals 0
invoke-direct {p0}, Landroidx/recyclerview/widget/SnapHelper;-><init>()V
return-void
.end method
.method private distanceToCenter(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroid/view/View;Landroidx/recyclerview/widget/OrientationHelper;)I
.locals 0
.param p1 # Landroidx/recyclerview/widget/RecyclerView$LayoutManager;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2 # Landroid/view/View;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
invoke-virtual {p3, p2}, Landroidx/recyclerview/widget/OrientationHelper;->getDecoratedStart(Landroid/view/View;)I
move-result p1
invoke-virtual {p3, p2}, Landroidx/recyclerview/widget/OrientationHelper;->getDecoratedMeasurement(Landroid/view/View;)I
move-result p2
div-int/lit8 p2, p2, 0x2
add-int/2addr p2, p1
invoke-virtual {p3}, Landroidx/recyclerview/widget/OrientationHelper;->getStartAfterPadding()I
move-result p1
invoke-virtual {p3}, Landroidx/recyclerview/widget/OrientationHelper;->getTotalSpace()I
move-result p3
div-int/lit8 p3, p3, 0x2
add-int/2addr p3, p1
sub-int/2addr p2, p3
return p2
.end method
.method private findCenterView(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroidx/recyclerview/widget/OrientationHelper;)Landroid/view/View;
.locals 8
.annotation build Landroidx/annotation/Nullable;
.end annotation
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getChildCount()I
move-result v0
const/4 v1, 0x0
if-nez v0, :cond_0
return-object v1
:cond_0
invoke-virtual {p2}, Landroidx/recyclerview/widget/OrientationHelper;->getStartAfterPadding()I
move-result v2
invoke-virtual {p2}, Landroidx/recyclerview/widget/OrientationHelper;->getTotalSpace()I
move-result v3
div-int/lit8 v3, v3, 0x2
add-int/2addr v3, v2
const v2, 0x7fffffff
const/4 v4, 0x0
:goto_0
if-ge v4, v0, :cond_2
invoke-virtual {p1, v4}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getChildAt(I)Landroid/view/View;
move-result-object v5
invoke-virtual {p2, v5}, Landroidx/recyclerview/widget/OrientationHelper;->getDecoratedStart(Landroid/view/View;)I
move-result v6
invoke-virtual {p2, v5}, Landroidx/recyclerview/widget/OrientationHelper;->getDecoratedMeasurement(Landroid/view/View;)I
move-result v7
div-int/lit8 v7, v7, 0x2
add-int/2addr v7, v6
sub-int/2addr v7, v3
invoke-static {v7}, Ljava/lang/Math;->abs(I)I
move-result v6
if-ge v6, v2, :cond_1
move-object v1, v5
move v2, v6
:cond_1
add-int/lit8 v4, v4, 0x1
goto :goto_0
:cond_2
return-object v1
.end method
.method private getHorizontalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
.locals 1
.param p1 # Landroidx/recyclerview/widget/RecyclerView$LayoutManager;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/NonNull;
.end annotation
iget-object v0, p0, Landroidx/recyclerview/widget/PagerSnapHelper;->mHorizontalHelper:Landroidx/recyclerview/widget/OrientationHelper;
if-eqz v0, :cond_0
iget-object v0, v0, Landroidx/recyclerview/widget/OrientationHelper;->mLayoutManager:Landroidx/recyclerview/widget/RecyclerView$LayoutManager;
if-eq v0, p1, :cond_1
: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 p1, p0, Landroidx/recyclerview/widget/PagerSnapHelper;->mHorizontalHelper:Landroidx/recyclerview/widget/OrientationHelper;
return-object p1
.end method
.method private getOrientationHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
.locals 1
.annotation build Landroidx/annotation/Nullable;
.end annotation
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollVertically()Z
move-result v0
if-eqz v0, :cond_0
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/PagerSnapHelper;->getVerticalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
move-result-object p1
return-object p1
:cond_0
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollHorizontally()Z
move-result v0
if-eqz v0, :cond_1
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/PagerSnapHelper;->getHorizontalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
move-result-object p1
return-object p1
:cond_1
const/4 p1, 0x0
return-object p1
.end method
.method private getVerticalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
.locals 1
.param p1 # Landroidx/recyclerview/widget/RecyclerView$LayoutManager;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/NonNull;
.end annotation
iget-object v0, p0, Landroidx/recyclerview/widget/PagerSnapHelper;->mVerticalHelper:Landroidx/recyclerview/widget/OrientationHelper;
if-eqz v0, :cond_0
iget-object v0, v0, Landroidx/recyclerview/widget/OrientationHelper;->mLayoutManager:Landroidx/recyclerview/widget/RecyclerView$LayoutManager;
if-eq v0, p1, :cond_1
: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 p1, p0, Landroidx/recyclerview/widget/PagerSnapHelper;->mVerticalHelper:Landroidx/recyclerview/widget/OrientationHelper;
return-object p1
.end method
.method private isForwardFling(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;II)Z
.locals 2
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollHorizontally()Z
move-result p1
const/4 v0, 0x1
const/4 v1, 0x0
if-eqz p1, :cond_1
if-lez p2, :cond_0
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
return v0
:cond_1
if-lez p3, :cond_2
goto :goto_1
:cond_2
const/4 v0, 0x0
:goto_1
return v0
.end method
.method private isReverseLayout(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Z
.locals 4
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getItemCount()I
move-result v0
instance-of v1, p1, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$ScrollVectorProvider;
const/4 v2, 0x0
2020-07-08 16:44:49 +00:00
if-eqz v1, :cond_1
2020-05-17 12:40:10 +00:00
check-cast p1, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$ScrollVectorProvider;
const/4 v1, 0x1
sub-int/2addr v0, v1
invoke-interface {p1, v0}, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$ScrollVectorProvider;->computeScrollVectorForPosition(I)Landroid/graphics/PointF;
move-result-object p1
2020-07-08 16:44:49 +00:00
if-eqz p1, :cond_1
2020-05-17 12:40:10 +00:00
iget v0, p1, Landroid/graphics/PointF;->x:F
const/4 v3, 0x0
cmpg-float v0, v0, v3
2020-07-08 16:44:49 +00:00
if-ltz v0, :cond_0
2020-05-17 12:40:10 +00:00
iget p1, p1, Landroid/graphics/PointF;->y:F
cmpg-float p1, p1, v3
2020-07-08 16:44:49 +00:00
if-gez p1, :cond_1
2020-05-17 12:40:10 +00:00
:cond_0
2020-07-08 16:44:49 +00:00
const/4 v2, 0x1
2020-05-17 12:40:10 +00:00
:cond_1
return v2
.end method
# virtual methods
.method public calculateDistanceToFinalSnap(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroid/view/View;)[I
.locals 4
.param p1 # Landroidx/recyclerview/widget/RecyclerView$LayoutManager;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2 # Landroid/view/View;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/Nullable;
.end annotation
const/4 v0, 0x2
new-array v0, v0, [I
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollHorizontally()Z
move-result v1
const/4 v2, 0x0
if-eqz v1, :cond_0
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/PagerSnapHelper;->getHorizontalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
move-result-object v1
invoke-direct {p0, p1, p2, v1}, Landroidx/recyclerview/widget/PagerSnapHelper;->distanceToCenter(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroid/view/View;Landroidx/recyclerview/widget/OrientationHelper;)I
move-result v1
aput v1, v0, v2
goto :goto_0
:cond_0
aput v2, v0, v2
:goto_0
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollVertically()Z
move-result v1
const/4 v3, 0x1
if-eqz v1, :cond_1
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/PagerSnapHelper;->getVerticalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
move-result-object v1
invoke-direct {p0, p1, p2, v1}, Landroidx/recyclerview/widget/PagerSnapHelper;->distanceToCenter(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroid/view/View;Landroidx/recyclerview/widget/OrientationHelper;)I
move-result p1
aput p1, v0, v3
goto :goto_1
:cond_1
aput v2, v0, v3
:goto_1
return-object v0
.end method
.method public createSnapScroller(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/LinearSmoothScroller;
.locals 1
instance-of p1, p1, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$ScrollVectorProvider;
if-nez p1, :cond_0
const/4 p1, 0x0
return-object p1
:cond_0
new-instance p1, Landroidx/recyclerview/widget/PagerSnapHelper$1;
iget-object v0, p0, Landroidx/recyclerview/widget/SnapHelper;->mRecyclerView:Landroidx/recyclerview/widget/RecyclerView;
invoke-virtual {v0}, Landroid/view/ViewGroup;->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
.annotation build Landroidx/annotation/Nullable;
.end annotation
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollVertically()Z
move-result v0
if-eqz v0, :cond_0
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 p1
return-object p1
:cond_0
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollHorizontally()Z
move-result v0
if-eqz v0, :cond_1
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 p1
return-object p1
:cond_1
const/4 p1, 0x0
return-object p1
.end method
.method public findTargetSnapPosition(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;II)I
.locals 11
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getItemCount()I
move-result v0
const/4 v1, -0x1
if-nez v0, :cond_0
return v1
: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
:cond_1
const/high16 v3, -0x80000000
const v4, 0x7fffffff
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getChildCount()I
move-result v5
const/4 v6, 0x0
const/4 v7, 0x0
2020-07-08 16:44:49 +00:00
move-object v8, v7
2020-05-17 12:40:10 +00:00
:goto_0
if-ge v6, v5, :cond_5
invoke-virtual {p1, v6}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getChildAt(I)Landroid/view/View;
move-result-object v9
if-nez v9, :cond_2
goto :goto_1
:cond_2
invoke-direct {p0, p1, v9, v2}, Landroidx/recyclerview/widget/PagerSnapHelper;->distanceToCenter(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroid/view/View;Landroidx/recyclerview/widget/OrientationHelper;)I
move-result v10
if-gtz v10, :cond_3
2020-07-08 16:44:49 +00:00
if-le v10, v3, :cond_3
2020-05-17 12:40:10 +00:00
2020-07-08 16:44:49 +00:00
move-object v8, v9
2020-05-17 12:40:10 +00:00
2020-07-08 16:44:49 +00:00
move v3, v10
2020-05-17 12:40:10 +00:00
:cond_3
if-ltz v10, :cond_4
2020-07-08 16:44:49 +00:00
if-ge v10, v4, :cond_4
2020-05-17 12:40:10 +00:00
move-object v7, v9
2020-07-08 16:44:49 +00:00
move v4, v10
2020-05-17 12:40:10 +00:00
:cond_4
:goto_1
add-int/lit8 v6, v6, 0x1
goto :goto_0
: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 v7, :cond_6
invoke-virtual {p1, v7}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getPosition(Landroid/view/View;)I
move-result p1
return p1
:cond_6
if-nez p2, :cond_7
2020-07-08 16:44:49 +00:00
if-eqz v8, :cond_7
2020-05-17 12:40:10 +00:00
2020-07-08 16:44:49 +00:00
invoke-virtual {p1, v8}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getPosition(Landroid/view/View;)I
2020-05-17 12:40:10 +00:00
move-result p1
return p1
:cond_7
if-eqz p2, :cond_8
2020-07-08 16:44:49 +00:00
move-object v7, v8
2020-05-17 12:40:10 +00:00
:cond_8
2020-07-08 16:44:49 +00:00
if-nez v7, :cond_9
2020-05-17 12:40:10 +00:00
return v1
:cond_9
2020-07-08 16:44:49 +00:00
invoke-virtual {p1, v7}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getPosition(Landroid/view/View;)I
2020-05-17 12:40:10 +00:00
move-result p3
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/PagerSnapHelper;->isReverseLayout(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Z
move-result p1
if-ne p1, p2, :cond_a
const/4 p1, -0x1
2020-07-08 16:44:49 +00:00
goto :goto_2
2020-05-17 12:40:10 +00:00
:cond_a
const/4 p1, 0x1
2020-07-08 16:44:49 +00:00
:goto_2
2020-05-17 12:40:10 +00:00
add-int/2addr p3, p1
if-ltz p3, :cond_c
if-lt p3, v0, :cond_b
2020-07-08 16:44:49 +00:00
goto :goto_3
2020-05-17 12:40:10 +00:00
:cond_b
return p3
:cond_c
2020-07-08 16:44:49 +00:00
:goto_3
2020-05-17 12:40:10 +00:00
return v1
.end method