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

564 lines
15 KiB
Smali
Raw Normal View History

2019-02-04 20:08:30 +00:00
.class public Landroidx/recyclerview/widget/PagerSnapHelper;
.super Landroidx/recyclerview/widget/SnapHelper;
2019-02-04 20:29:01 +00:00
.source "PagerSnapHelper.java"
2019-02-04 20:08:30 +00:00
# static fields
.field private static final MAX_SCROLL_ON_FLING_DURATION:I = 0x64
# instance fields
.field private mHorizontalHelper:Landroidx/recyclerview/widget/OrientationHelper;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end field
.field private 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 1
.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 v0
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 v0, p2
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getClipToPadding()Z
move-result p1
if-eqz p1, :cond_0
invoke-virtual {p3}, Landroidx/recyclerview/widget/OrientationHelper;->getStartAfterPadding()I
move-result p1
invoke-virtual {p3}, Landroidx/recyclerview/widget/OrientationHelper;->getTotalSpace()I
move-result p2
div-int/lit8 p2, p2, 0x2
add-int/2addr p1, p2
goto :goto_0
:cond_0
invoke-virtual {p3}, Landroidx/recyclerview/widget/OrientationHelper;->getEnd()I
move-result p1
div-int/lit8 p1, p1, 0x2
:goto_0
sub-int/2addr v0, p1
return v0
.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 {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getClipToPadding()Z
move-result v2
if-eqz v2, :cond_1
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 v2, v3
goto :goto_0
:cond_1
invoke-virtual {p2}, Landroidx/recyclerview/widget/OrientationHelper;->getEnd()I
move-result v2
div-int/lit8 v2, v2, 0x2
:goto_0
const v3, 0x7fffffff
const/4 v4, 0x0
:goto_1
if-ge v4, v0, :cond_3
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 v6, v7
sub-int/2addr v6, v2
invoke-static {v6}, Ljava/lang/Math;->abs(I)I
move-result v6
if-ge v6, v3, :cond_2
move-object v1, v5
move v3, v6
:cond_2
add-int/lit8 v4, v4, 0x1
goto :goto_1
:cond_3
return-object v1
.end method
.method private findStartView(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroidx/recyclerview/widget/OrientationHelper;)Landroid/view/View;
.locals 6
.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
const v2, 0x7fffffff
const/4 v3, 0x0
:goto_0
if-ge v3, v0, :cond_2
invoke-virtual {p1, v3}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getChildAt(I)Landroid/view/View;
move-result-object v4
invoke-virtual {p2, v4}, Landroidx/recyclerview/widget/OrientationHelper;->getDecoratedStart(Landroid/view/View;)I
move-result v5
if-ge v5, v2, :cond_1
move-object v1, v4
move v2, v5
:cond_1
add-int/lit8 v3, v3, 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 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
# 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 protected 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/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
.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
2019-02-04 20:29:01 +00:00
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
2019-02-04 20:08:30 +00:00
:cond_1
const/4 p1, 0x0
return-object p1
.end method
.method public findTargetSnapPosition(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;II)I
.locals 5
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
const/4 v2, 0x0
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollVertically()Z
move-result v3
if-eqz v3, :cond_1
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/PagerSnapHelper;->getVerticalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
move-result-object v2
invoke-direct {p0, p1, v2}, Landroidx/recyclerview/widget/PagerSnapHelper;->findStartView(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroidx/recyclerview/widget/OrientationHelper;)Landroid/view/View;
move-result-object v2
2019-02-04 20:29:01 +00:00
goto :goto_0
2019-02-04 20:08:30 +00:00
:cond_1
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollHorizontally()Z
move-result v3
if-eqz v3, :cond_2
invoke-direct {p0, p1}, Landroidx/recyclerview/widget/PagerSnapHelper;->getHorizontalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper;
move-result-object v2
2019-02-04 20:29:01 +00:00
invoke-direct {p0, p1, v2}, Landroidx/recyclerview/widget/PagerSnapHelper;->findStartView(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroidx/recyclerview/widget/OrientationHelper;)Landroid/view/View;
move-result-object v2
2019-02-04 20:08:30 +00:00
:cond_2
2019-02-04 20:29:01 +00:00
:goto_0
2019-02-04 20:08:30 +00:00
if-nez v2, :cond_3
return v1
:cond_3
invoke-virtual {p1, v2}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getPosition(Landroid/view/View;)I
move-result v2
if-ne v2, v1, :cond_4
return v1
:cond_4
invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollHorizontally()Z
move-result v1
const/4 v3, 0x0
const/4 v4, 0x1
if-eqz v1, :cond_6
if-lez p2, :cond_5
const/4 p2, 0x1
2019-02-04 20:29:01 +00:00
goto :goto_1
2019-02-04 20:08:30 +00:00
:cond_5
const/4 p2, 0x0
2019-02-04 20:29:01 +00:00
goto :goto_1
2019-02-04 20:08:30 +00:00
:cond_6
2019-02-04 20:29:01 +00:00
if-lez p3, :cond_7
const/4 p2, 0x1
2019-02-04 20:08:30 +00:00
2019-02-04 20:29:01 +00:00
goto :goto_1
2019-02-04 20:08:30 +00:00
2019-02-04 20:29:01 +00:00
:cond_7
const/4 p2, 0x0
:goto_1
2019-02-04 20:08:30 +00:00
instance-of p3, p1, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$ScrollVectorProvider;
2019-02-04 20:29:01 +00:00
if-eqz p3, :cond_9
2019-02-04 20:08:30 +00:00
check-cast p1, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$ScrollVectorProvider;
sub-int/2addr v0, v4
invoke-interface {p1, v0}, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$ScrollVectorProvider;->computeScrollVectorForPosition(I)Landroid/graphics/PointF;
move-result-object p1
2019-02-04 20:29:01 +00:00
if-eqz p1, :cond_9
2019-02-04 20:08:30 +00:00
iget p3, p1, Landroid/graphics/PointF;->x:F
const/4 v0, 0x0
cmpg-float p3, p3, v0
2019-02-04 20:29:01 +00:00
if-ltz p3, :cond_8
2019-02-04 20:08:30 +00:00
iget p1, p1, Landroid/graphics/PointF;->y:F
cmpg-float p1, p1, v0
2019-02-04 20:29:01 +00:00
if-gez p1, :cond_9
2019-02-04 20:08:30 +00:00
2019-02-04 20:29:01 +00:00
:cond_8
2019-02-04 20:08:30 +00:00
const/4 v3, 0x1
2019-02-04 20:29:01 +00:00
:cond_9
if-eqz v3, :cond_b
2019-02-04 20:08:30 +00:00
2019-02-04 20:29:01 +00:00
if-eqz p2, :cond_a
2019-02-04 20:08:30 +00:00
sub-int/2addr v2, v4
2019-02-04 20:29:01 +00:00
:cond_a
2019-02-04 20:08:30 +00:00
return v2
2019-02-04 20:29:01 +00:00
:cond_b
if-eqz p2, :cond_c
2019-02-04 20:08:30 +00:00
add-int/2addr v2, v4
2019-02-04 20:29:01 +00:00
:cond_c
2019-02-04 20:08:30 +00:00
return v2
.end method