.class public Landroidx/recyclerview/widget/LinearSnapHelper; .super Landroidx/recyclerview/widget/SnapHelper; .source "LinearSnapHelper.java" # static fields .field private static final INVALID_DISTANCE:F = 1.0f # instance fields .field private mHorizontalHelper:Landroidx/recyclerview/widget/OrientationHelper; .field private mVerticalHelper:Landroidx/recyclerview/widget/OrientationHelper; # direct methods .method public constructor ()V .locals 0 .line 33 invoke-direct {p0}, Landroidx/recyclerview/widget/SnapHelper;->()V return-void .end method .method private computeDistancePerChild(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroidx/recyclerview/widget/OrientationHelper;)F .locals 9 .line 226 invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getChildCount()I move-result p0 const/high16 v0, 0x3f800000 # 1.0f if-nez p0, :cond_0 return v0 :cond_0 const/4 v1, 0x0 const v2, 0x7fffffff const/high16 v3, -0x80000000 const/4 v4, 0x0 move v5, v4 move v4, v3 move v3, v2 move-object v2, v1 :goto_0 if-ge v5, p0, :cond_4 .line 232 invoke-virtual {p1, v5}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getChildAt(I)Landroid/view/View; move-result-object v6 .line 233 invoke-virtual {p1, v6}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getPosition(Landroid/view/View;)I move-result v7 const/4 v8, -0x1 if-ne v7, v8, :cond_1 goto :goto_1 :cond_1 if-ge v7, v3, :cond_2 move-object v1, v6 move v3, v7 :cond_2 if-le v7, v4, :cond_3 move-object v2, v6 move v4, v7 :cond_3 :goto_1 add-int/lit8 v5, v5, 0x1 goto :goto_0 :cond_4 if-eqz v1, :cond_7 if-nez v2, :cond_5 goto :goto_2 .line 249 :cond_5 invoke-virtual {p2, v1}, Landroidx/recyclerview/widget/OrientationHelper;->getDecoratedStart(Landroid/view/View;)I move-result p0 .line 250 invoke-virtual {p2, v2}, Landroidx/recyclerview/widget/OrientationHelper;->getDecoratedStart(Landroid/view/View;)I move-result p1 .line 249 invoke-static {p0, p1}, Ljava/lang/Math;->min(II)I move-result p0 .line 251 invoke-virtual {p2, v1}, Landroidx/recyclerview/widget/OrientationHelper;->getDecoratedEnd(Landroid/view/View;)I move-result p1 .line 252 invoke-virtual {p2, v2}, Landroidx/recyclerview/widget/OrientationHelper;->getDecoratedEnd(Landroid/view/View;)I move-result p2 .line 251 invoke-static {p1, p2}, Ljava/lang/Math;->max(II)I move-result p1 sub-int/2addr p1, p0 if-nez p1, :cond_6 return v0 :cond_6 int-to-float p0, p1 mul-float/2addr p0, v0 sub-int/2addr v4, v3 add-int/lit8 v4, v4, 0x1 int-to-float p1, v4 div-float/2addr p0, p1 return p0 :cond_7 :goto_2 return v0 .end method .method private distanceToCenter(Landroid/view/View;Landroidx/recyclerview/widget/OrientationHelper;)I .locals 0 .line 142 invoke-virtual {p2, p1}, Landroidx/recyclerview/widget/OrientationHelper;->getDecoratedStart(Landroid/view/View;)I move-result p0 .line 143 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 144 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 estimateNextPositionDiffForFling(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroidx/recyclerview/widget/OrientationHelper;II)I .locals 1 .line 161 invoke-virtual {p0, p3, p4}, Landroidx/recyclerview/widget/LinearSnapHelper;->calculateScrollDistance(II)[I move-result-object p3 .line 162 invoke-direct {p0, p1, p2}, Landroidx/recyclerview/widget/LinearSnapHelper;->computeDistancePerChild(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroidx/recyclerview/widget/OrientationHelper;)F move-result p0 const/4 p1, 0x0 cmpg-float p1, p0, p1 const/4 p2, 0x0 if-gtz p1, :cond_0 return p2 .line 167 :cond_0 aget p1, p3, p2 invoke-static {p1}, Ljava/lang/Math;->abs(I)I move-result p1 const/4 p4, 0x1 aget v0, p3, p4 invoke-static {v0}, Ljava/lang/Math;->abs(I)I move-result v0 if-le p1, v0, :cond_1 aget p1, p3, p2 goto :goto_0 :cond_1 aget p1, p3, p4 :goto_0 int-to-float p1, p1 div-float/2addr p1, p0 .line 168 invoke-static {p1}, Ljava/lang/Math;->round(F)I move-result p0 return p0 .end method .method private findCenterView(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroidx/recyclerview/widget/OrientationHelper;)Landroid/view/View; .locals 7 .line 183 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 189 :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 193 invoke-virtual {p1, v3}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getChildAt(I)Landroid/view/View; move-result-object v4 .line 194 invoke-virtual {p2, v4}, Landroidx/recyclerview/widget/OrientationHelper;->getDecoratedStart(Landroid/view/View;)I move-result v5 .line 195 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 196 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/LinearSnapHelper;->mHorizontalHelper:Landroidx/recyclerview/widget/OrientationHelper; if-eqz v0, :cond_0 .line 271 iget-object v0, v0, Landroidx/recyclerview/widget/OrientationHelper;->mLayoutManager:Landroidx/recyclerview/widget/RecyclerView$LayoutManager; if-eq v0, p1, :cond_1 .line 272 :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/LinearSnapHelper;->mHorizontalHelper:Landroidx/recyclerview/widget/OrientationHelper; :cond_1 iget-object p0, p0, Landroidx/recyclerview/widget/LinearSnapHelper;->mHorizontalHelper:Landroidx/recyclerview/widget/OrientationHelper; 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/LinearSnapHelper;->mVerticalHelper:Landroidx/recyclerview/widget/OrientationHelper; if-eqz v0, :cond_0 .line 262 iget-object v0, v0, Landroidx/recyclerview/widget/OrientationHelper;->mLayoutManager:Landroidx/recyclerview/widget/RecyclerView$LayoutManager; if-eq v0, p1, :cond_1 .line 263 :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/LinearSnapHelper;->mVerticalHelper:Landroidx/recyclerview/widget/OrientationHelper; :cond_1 iget-object p0, p0, Landroidx/recyclerview/widget/LinearSnapHelper;->mVerticalHelper:Landroidx/recyclerview/widget/OrientationHelper; return-object p0 .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 47 invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollHorizontally()Z move-result v1 const/4 v2, 0x0 if-eqz v1, :cond_0 .line 49 invoke-direct {p0, p1}, Landroidx/recyclerview/widget/LinearSnapHelper;->getHorizontalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper; move-result-object v1 .line 48 invoke-direct {p0, p2, v1}, Landroidx/recyclerview/widget/LinearSnapHelper;->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 54 :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 56 invoke-direct {p0, p1}, Landroidx/recyclerview/widget/LinearSnapHelper;->getVerticalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper; move-result-object p1 .line 55 invoke-direct {p0, p2, p1}, Landroidx/recyclerview/widget/LinearSnapHelper;->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 public findSnapView(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroid/view/View; .locals 1 .line 133 invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollVertically()Z move-result v0 if-eqz v0, :cond_0 .line 134 invoke-direct {p0, p1}, Landroidx/recyclerview/widget/LinearSnapHelper;->getVerticalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper; move-result-object v0 invoke-direct {p0, p1, v0}, Landroidx/recyclerview/widget/LinearSnapHelper;->findCenterView(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroidx/recyclerview/widget/OrientationHelper;)Landroid/view/View; move-result-object p0 return-object p0 .line 135 :cond_0 invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollHorizontally()Z move-result v0 if-eqz v0, :cond_1 .line 136 invoke-direct {p0, p1}, Landroidx/recyclerview/widget/LinearSnapHelper;->getHorizontalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper; move-result-object v0 invoke-direct {p0, p1, v0}, Landroidx/recyclerview/widget/LinearSnapHelper;->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 8 .line 66 instance-of v0, p1, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$ScrollVectorProvider; const/4 v1, -0x1 if-nez v0, :cond_0 return v1 .line 70 :cond_0 invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getItemCount()I move-result v0 if-nez v0, :cond_1 return v1 .line 75 :cond_1 invoke-virtual {p0, p1}, Landroidx/recyclerview/widget/LinearSnapHelper;->findSnapView(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroid/view/View; move-result-object v2 if-nez v2, :cond_2 return v1 .line 80 :cond_2 invoke-virtual {p1, v2}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->getPosition(Landroid/view/View;)I move-result v2 if-ne v2, v1, :cond_3 return v1 .line 85 :cond_3 move-object v3, p1 check-cast v3, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$ScrollVectorProvider; add-int/lit8 v4, v0, -0x1 .line 90 invoke-interface {v3, v4}, Landroidx/recyclerview/widget/RecyclerView$SmoothScroller$ScrollVectorProvider;->computeScrollVectorForPosition(I)Landroid/graphics/PointF; move-result-object v3 if-nez v3, :cond_4 return v1 .line 97 :cond_4 invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollHorizontally()Z move-result v5 const/4 v6, 0x0 const/4 v7, 0x0 if-eqz v5, :cond_5 .line 99 invoke-direct {p0, p1}, Landroidx/recyclerview/widget/LinearSnapHelper;->getHorizontalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper; move-result-object v5 .line 98 invoke-direct {p0, p1, v5, p2, v7}, Landroidx/recyclerview/widget/LinearSnapHelper;->estimateNextPositionDiffForFling(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroidx/recyclerview/widget/OrientationHelper;II)I move-result p2 .line 100 iget v5, v3, Landroid/graphics/PointF;->x:F cmpg-float v5, v5, v6 if-gez v5, :cond_6 neg-int p2, p2 goto :goto_0 :cond_5 move p2, v7 .line 106 :cond_6 :goto_0 invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollVertically()Z move-result v5 if-eqz v5, :cond_7 .line 108 invoke-direct {p0, p1}, Landroidx/recyclerview/widget/LinearSnapHelper;->getVerticalHelper(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;)Landroidx/recyclerview/widget/OrientationHelper; move-result-object v5 .line 107 invoke-direct {p0, p1, v5, v7, p3}, Landroidx/recyclerview/widget/LinearSnapHelper;->estimateNextPositionDiffForFling(Landroidx/recyclerview/widget/RecyclerView$LayoutManager;Landroidx/recyclerview/widget/OrientationHelper;II)I move-result p0 .line 109 iget p3, v3, Landroid/graphics/PointF;->y:F cmpg-float p3, p3, v6 if-gez p3, :cond_8 neg-int p0, p0 goto :goto_1 :cond_7 move p0, v7 .line 116 :cond_8 :goto_1 invoke-virtual {p1}, Landroidx/recyclerview/widget/RecyclerView$LayoutManager;->canScrollVertically()Z move-result p1 if-eqz p1, :cond_9 move p2, p0 :cond_9 if-nez p2, :cond_a return v1 :cond_a add-int/2addr v2, p2 if-gez v2, :cond_b goto :goto_2 :cond_b move v7, v2 :goto_2 if-lt v7, v0, :cond_c goto :goto_3 :cond_c move v4, v7 :goto_3 return v4 .end method