401 lines
8.7 KiB
Smali
401 lines
8.7 KiB
Smali
.class public Landroidx/core/widget/AutoScrollHelper$ClampedScroller;
|
|
.super Ljava/lang/Object;
|
|
.source "AutoScrollHelper.java"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/EnclosingClass;
|
|
value = Landroidx/core/widget/AutoScrollHelper;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/InnerClass;
|
|
accessFlags = 0x9
|
|
name = "ClampedScroller"
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field public mDeltaTime:J
|
|
|
|
.field public mDeltaX:I
|
|
|
|
.field public mDeltaY:I
|
|
|
|
.field public mEffectiveRampDown:I
|
|
|
|
.field public mRampDownDuration:I
|
|
|
|
.field public mRampUpDuration:I
|
|
|
|
.field public mStartTime:J
|
|
|
|
.field public mStopTime:J
|
|
|
|
.field public mStopValue:F
|
|
|
|
.field public mTargetVelocityX:F
|
|
|
|
.field public mTargetVelocityY:F
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>()V
|
|
.locals 2
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
const-wide/high16 v0, -0x8000000000000000L
|
|
|
|
iput-wide v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mStartTime:J
|
|
|
|
const-wide/16 v0, -0x1
|
|
|
|
iput-wide v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mStopTime:J
|
|
|
|
const-wide/16 v0, 0x0
|
|
|
|
iput-wide v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mDeltaTime:J
|
|
|
|
const/4 v0, 0x0
|
|
|
|
iput v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mDeltaX:I
|
|
|
|
iput v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mDeltaY:I
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private getValueAt(J)F
|
|
.locals 7
|
|
|
|
iget-wide v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mStartTime:J
|
|
|
|
const/4 v2, 0x0
|
|
|
|
cmp-long v3, p1, v0
|
|
|
|
if-gez v3, :cond_0
|
|
|
|
return v2
|
|
|
|
:cond_0
|
|
iget-wide v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mStopTime:J
|
|
|
|
const-wide/16 v3, 0x0
|
|
|
|
const/high16 v5, 0x3f800000 # 1.0f
|
|
|
|
cmp-long v6, v0, v3
|
|
|
|
if-ltz v6, :cond_2
|
|
|
|
cmp-long v3, p1, v0
|
|
|
|
if-gez v3, :cond_1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
sub-long/2addr p1, v0
|
|
|
|
iget v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mStopValue:F
|
|
|
|
sub-float v1, v5, v0
|
|
|
|
long-to-float p1, p1
|
|
|
|
iget p2, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mEffectiveRampDown:I
|
|
|
|
int-to-float p2, p2
|
|
|
|
div-float/2addr p1, p2
|
|
|
|
invoke-static {p1, v2, v5}, Landroidx/core/widget/AutoScrollHelper;->constrain(FFF)F
|
|
|
|
move-result p1
|
|
|
|
mul-float p1, p1, v0
|
|
|
|
add-float/2addr p1, v1
|
|
|
|
return p1
|
|
|
|
:cond_2
|
|
:goto_0
|
|
iget-wide v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mStartTime:J
|
|
|
|
sub-long/2addr p1, v0
|
|
|
|
const/high16 v0, 0x3f000000 # 0.5f
|
|
|
|
long-to-float p1, p1
|
|
|
|
iget p2, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mRampUpDuration:I
|
|
|
|
int-to-float p2, p2
|
|
|
|
div-float/2addr p1, p2
|
|
|
|
invoke-static {p1, v2, v5}, Landroidx/core/widget/AutoScrollHelper;->constrain(FFF)F
|
|
|
|
move-result p1
|
|
|
|
mul-float p1, p1, v0
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method private interpolateValue(F)F
|
|
.locals 2
|
|
|
|
const/high16 v0, -0x3f800000 # -4.0f
|
|
|
|
mul-float v0, v0, p1
|
|
|
|
mul-float v0, v0, p1
|
|
|
|
const/high16 v1, 0x40800000 # 4.0f
|
|
|
|
mul-float p1, p1, v1
|
|
|
|
add-float/2addr p1, v0
|
|
|
|
return p1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public computeScrollDelta()V
|
|
.locals 5
|
|
|
|
iget-wide v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mDeltaTime:J
|
|
|
|
const-wide/16 v2, 0x0
|
|
|
|
cmp-long v4, v0, v2
|
|
|
|
if-eqz v4, :cond_0
|
|
|
|
invoke-static {}, Landroid/view/animation/AnimationUtils;->currentAnimationTimeMillis()J
|
|
|
|
move-result-wide v0
|
|
|
|
invoke-direct {p0, v0, v1}, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->getValueAt(J)F
|
|
|
|
move-result v2
|
|
|
|
invoke-direct {p0, v2}, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->interpolateValue(F)F
|
|
|
|
move-result v2
|
|
|
|
iget-wide v3, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mDeltaTime:J
|
|
|
|
sub-long v3, v0, v3
|
|
|
|
iput-wide v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mDeltaTime:J
|
|
|
|
long-to-float v0, v3
|
|
|
|
mul-float v0, v0, v2
|
|
|
|
iget v1, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mTargetVelocityX:F
|
|
|
|
mul-float v1, v1, v0
|
|
|
|
float-to-int v1, v1
|
|
|
|
iput v1, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mDeltaX:I
|
|
|
|
iget v1, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mTargetVelocityY:F
|
|
|
|
mul-float v0, v0, v1
|
|
|
|
float-to-int v0, v0
|
|
|
|
iput v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mDeltaY:I
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
new-instance v0, Ljava/lang/RuntimeException;
|
|
|
|
const-string v1, "Cannot compute scroll delta before calling start()"
|
|
|
|
invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public getDeltaX()I
|
|
.locals 1
|
|
|
|
iget v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mDeltaX:I
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public getDeltaY()I
|
|
.locals 1
|
|
|
|
iget v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mDeltaY:I
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public getHorizontalDirection()I
|
|
.locals 2
|
|
|
|
iget v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mTargetVelocityX:F
|
|
|
|
invoke-static {v0}, Ljava/lang/Math;->abs(F)F
|
|
|
|
move-result v1
|
|
|
|
div-float/2addr v0, v1
|
|
|
|
float-to-int v0, v0
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public getVerticalDirection()I
|
|
.locals 2
|
|
|
|
iget v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mTargetVelocityY:F
|
|
|
|
invoke-static {v0}, Ljava/lang/Math;->abs(F)F
|
|
|
|
move-result v1
|
|
|
|
div-float/2addr v0, v1
|
|
|
|
float-to-int v0, v0
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public isFinished()Z
|
|
.locals 6
|
|
|
|
iget-wide v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mStopTime:J
|
|
|
|
const-wide/16 v2, 0x0
|
|
|
|
cmp-long v4, v0, v2
|
|
|
|
if-lez v4, :cond_0
|
|
|
|
invoke-static {}, Landroid/view/animation/AnimationUtils;->currentAnimationTimeMillis()J
|
|
|
|
move-result-wide v0
|
|
|
|
iget-wide v2, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mStopTime:J
|
|
|
|
iget v4, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mEffectiveRampDown:I
|
|
|
|
int-to-long v4, v4
|
|
|
|
add-long/2addr v2, v4
|
|
|
|
cmp-long v4, v0, v2
|
|
|
|
if-lez v4, :cond_0
|
|
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
return v0
|
|
.end method
|
|
|
|
.method public requestStop()V
|
|
.locals 5
|
|
|
|
invoke-static {}, Landroid/view/animation/AnimationUtils;->currentAnimationTimeMillis()J
|
|
|
|
move-result-wide v0
|
|
|
|
iget-wide v2, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mStartTime:J
|
|
|
|
sub-long v2, v0, v2
|
|
|
|
long-to-int v3, v2
|
|
|
|
iget v2, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mRampDownDuration:I
|
|
|
|
const/4 v4, 0x0
|
|
|
|
invoke-static {v3, v4, v2}, Landroidx/core/widget/AutoScrollHelper;->constrain(III)I
|
|
|
|
move-result v2
|
|
|
|
iput v2, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mEffectiveRampDown:I
|
|
|
|
invoke-direct {p0, v0, v1}, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->getValueAt(J)F
|
|
|
|
move-result v2
|
|
|
|
iput v2, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mStopValue:F
|
|
|
|
iput-wide v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mStopTime:J
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setRampDownDuration(I)V
|
|
.locals 0
|
|
|
|
iput p1, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mRampDownDuration:I
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setRampUpDuration(I)V
|
|
.locals 0
|
|
|
|
iput p1, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mRampUpDuration:I
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setTargetVelocity(FF)V
|
|
.locals 0
|
|
|
|
iput p1, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mTargetVelocityX:F
|
|
|
|
iput p2, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mTargetVelocityY:F
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public start()V
|
|
.locals 4
|
|
|
|
invoke-static {}, Landroid/view/animation/AnimationUtils;->currentAnimationTimeMillis()J
|
|
|
|
move-result-wide v0
|
|
|
|
iput-wide v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mStartTime:J
|
|
|
|
const-wide/16 v2, -0x1
|
|
|
|
iput-wide v2, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mStopTime:J
|
|
|
|
iput-wide v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mDeltaTime:J
|
|
|
|
const/high16 v0, 0x3f000000 # 0.5f
|
|
|
|
iput v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mStopValue:F
|
|
|
|
const/4 v0, 0x0
|
|
|
|
iput v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mDeltaX:I
|
|
|
|
iput v0, p0, Landroidx/core/widget/AutoScrollHelper$ClampedScroller;->mDeltaY:I
|
|
|
|
return-void
|
|
.end method
|