2020-11-12 02:11:44 +00:00
|
|
|
.class public final Landroidx/dynamicanimation/animation/FlingAnimation$DragForce;
|
|
|
|
.super Ljava/lang/Object;
|
|
|
|
.source "FlingAnimation.java"
|
|
|
|
|
|
|
|
# interfaces
|
|
|
|
.implements Landroidx/dynamicanimation/animation/Force;
|
|
|
|
|
|
|
|
|
|
|
|
# annotations
|
|
|
|
.annotation system Ldalvik/annotation/EnclosingClass;
|
|
|
|
value = Landroidx/dynamicanimation/animation/FlingAnimation;
|
|
|
|
.end annotation
|
|
|
|
|
|
|
|
.annotation system Ldalvik/annotation/InnerClass;
|
|
|
|
accessFlags = 0x19
|
|
|
|
name = "DragForce"
|
|
|
|
.end annotation
|
|
|
|
|
|
|
|
|
|
|
|
# static fields
|
2020-11-21 22:11:07 +00:00
|
|
|
.field private static final DEFAULT_FRICTION:F = -4.2f
|
2020-11-12 02:11:44 +00:00
|
|
|
|
2020-11-21 22:11:07 +00:00
|
|
|
.field private static final VELOCITY_THRESHOLD_MULTIPLIER:F = 62.5f
|
2020-11-12 02:11:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
# instance fields
|
2020-11-21 22:11:07 +00:00
|
|
|
.field private mFriction:F
|
2020-11-12 02:11:44 +00:00
|
|
|
|
2020-11-21 22:11:07 +00:00
|
|
|
.field private final mMassState:Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;
|
2020-11-12 02:11:44 +00:00
|
|
|
|
2020-11-21 22:11:07 +00:00
|
|
|
.field private mVelocityThreshold:F
|
2020-11-12 02:11:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
# direct methods
|
|
|
|
.method public constructor <init>()V
|
|
|
|
.locals 1
|
|
|
|
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
|
|
|
|
const v0, -0x3f79999a # -4.2f
|
|
|
|
|
|
|
|
iput v0, p0, Landroidx/dynamicanimation/animation/FlingAnimation$DragForce;->mFriction:F
|
|
|
|
|
|
|
|
new-instance v0, Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;
|
|
|
|
|
|
|
|
invoke-direct {v0}, Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;-><init>()V
|
|
|
|
|
|
|
|
iput-object v0, p0, Landroidx/dynamicanimation/animation/FlingAnimation$DragForce;->mMassState:Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;
|
|
|
|
|
|
|
|
return-void
|
|
|
|
.end method
|
|
|
|
|
|
|
|
|
|
|
|
# virtual methods
|
|
|
|
.method public getAcceleration(FF)F
|
|
|
|
.locals 0
|
|
|
|
|
|
|
|
iget p1, p0, Landroidx/dynamicanimation/animation/FlingAnimation$DragForce;->mFriction:F
|
|
|
|
|
|
|
|
mul-float p2, p2, p1
|
|
|
|
|
|
|
|
return p2
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public getFrictionScalar()F
|
|
|
|
.locals 2
|
|
|
|
|
|
|
|
iget v0, p0, Landroidx/dynamicanimation/animation/FlingAnimation$DragForce;->mFriction:F
|
|
|
|
|
|
|
|
const v1, -0x3f79999a # -4.2f
|
|
|
|
|
|
|
|
div-float/2addr v0, v1
|
|
|
|
|
|
|
|
return v0
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public isAtEquilibrium(FF)Z
|
|
|
|
.locals 0
|
|
|
|
|
|
|
|
invoke-static {p2}, Ljava/lang/Math;->abs(F)F
|
|
|
|
|
|
|
|
move-result p1
|
|
|
|
|
|
|
|
iget p2, p0, Landroidx/dynamicanimation/animation/FlingAnimation$DragForce;->mVelocityThreshold:F
|
|
|
|
|
|
|
|
cmpg-float p1, p1, p2
|
|
|
|
|
|
|
|
if-gez p1, :cond_0
|
|
|
|
|
|
|
|
const/4 p1, 0x1
|
|
|
|
|
|
|
|
goto :goto_0
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
const/4 p1, 0x0
|
|
|
|
|
|
|
|
:goto_0
|
|
|
|
return p1
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public setFrictionScalar(F)V
|
|
|
|
.locals 1
|
|
|
|
|
|
|
|
const v0, -0x3f79999a # -4.2f
|
|
|
|
|
|
|
|
mul-float p1, p1, v0
|
|
|
|
|
|
|
|
iput p1, p0, Landroidx/dynamicanimation/animation/FlingAnimation$DragForce;->mFriction:F
|
|
|
|
|
|
|
|
return-void
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public setValueThreshold(F)V
|
|
|
|
.locals 1
|
|
|
|
|
|
|
|
const/high16 v0, 0x427a0000 # 62.5f
|
|
|
|
|
|
|
|
mul-float p1, p1, v0
|
|
|
|
|
|
|
|
iput p1, p0, Landroidx/dynamicanimation/animation/FlingAnimation$DragForce;->mVelocityThreshold:F
|
|
|
|
|
|
|
|
return-void
|
|
|
|
.end method
|
|
|
|
|
|
|
|
.method public updateValueAndVelocity(FFJ)Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;
|
|
|
|
.locals 5
|
|
|
|
|
|
|
|
iget-object v0, p0, Landroidx/dynamicanimation/animation/FlingAnimation$DragForce;->mMassState:Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;
|
|
|
|
|
|
|
|
float-to-double v1, p2
|
|
|
|
|
|
|
|
long-to-float p3, p3
|
|
|
|
|
|
|
|
const/high16 p4, 0x447a0000 # 1000.0f
|
|
|
|
|
|
|
|
div-float v3, p3, p4
|
|
|
|
|
|
|
|
iget v4, p0, Landroidx/dynamicanimation/animation/FlingAnimation$DragForce;->mFriction:F
|
|
|
|
|
|
|
|
mul-float v3, v3, v4
|
|
|
|
|
|
|
|
float-to-double v3, v3
|
|
|
|
|
|
|
|
invoke-static {v3, v4}, Ljava/lang/Math;->exp(D)D
|
|
|
|
|
|
|
|
move-result-wide v3
|
|
|
|
|
|
|
|
mul-double v3, v3, v1
|
|
|
|
|
|
|
|
double-to-float v1, v3
|
|
|
|
|
|
|
|
iput v1, v0, Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;->mVelocity:F
|
|
|
|
|
|
|
|
iget-object v0, p0, Landroidx/dynamicanimation/animation/FlingAnimation$DragForce;->mMassState:Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;
|
|
|
|
|
|
|
|
iget v1, p0, Landroidx/dynamicanimation/animation/FlingAnimation$DragForce;->mFriction:F
|
|
|
|
|
|
|
|
div-float v2, p2, v1
|
|
|
|
|
|
|
|
sub-float/2addr p1, v2
|
|
|
|
|
|
|
|
float-to-double v2, p1
|
|
|
|
|
|
|
|
div-float/2addr p2, v1
|
|
|
|
|
|
|
|
float-to-double p1, p2
|
|
|
|
|
|
|
|
mul-float v1, v1, p3
|
|
|
|
|
|
|
|
div-float/2addr v1, p4
|
|
|
|
|
|
|
|
float-to-double p3, v1
|
|
|
|
|
|
|
|
invoke-static {p3, p4}, Ljava/lang/Math;->exp(D)D
|
|
|
|
|
|
|
|
move-result-wide p3
|
|
|
|
|
|
|
|
mul-double p3, p3, p1
|
|
|
|
|
|
|
|
add-double/2addr p3, v2
|
|
|
|
|
|
|
|
double-to-float p1, p3
|
|
|
|
|
|
|
|
iput p1, v0, Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;->mValue:F
|
|
|
|
|
|
|
|
iget-object p1, p0, Landroidx/dynamicanimation/animation/FlingAnimation$DragForce;->mMassState:Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;
|
|
|
|
|
|
|
|
iget p2, p1, Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;->mValue:F
|
|
|
|
|
|
|
|
iget p1, p1, Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;->mVelocity:F
|
|
|
|
|
|
|
|
invoke-virtual {p0, p2, p1}, Landroidx/dynamicanimation/animation/FlingAnimation$DragForce;->isAtEquilibrium(FF)Z
|
|
|
|
|
|
|
|
move-result p1
|
|
|
|
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
|
|
|
|
iget-object p1, p0, Landroidx/dynamicanimation/animation/FlingAnimation$DragForce;->mMassState:Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;
|
|
|
|
|
|
|
|
const/4 p2, 0x0
|
|
|
|
|
|
|
|
iput p2, p1, Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;->mVelocity:F
|
|
|
|
|
|
|
|
:cond_0
|
|
|
|
iget-object p1, p0, Landroidx/dynamicanimation/animation/FlingAnimation$DragForce;->mMassState:Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;
|
|
|
|
|
|
|
|
return-object p1
|
|
|
|
.end method
|