apkfuckery/com.discord/smali/androidx/dynamicanimation/animation/SpringAnimation.smali
2019-08-30 22:04:20 +02:00

588 lines
18 KiB
Smali

.class public final Landroidx/dynamicanimation/animation/SpringAnimation;
.super Landroidx/dynamicanimation/animation/DynamicAnimation;
.source "SpringAnimation.java"
# annotations
.annotation system Ldalvik/annotation/Signature;
value = {
"Landroidx/dynamicanimation/animation/DynamicAnimation<",
"Landroidx/dynamicanimation/animation/SpringAnimation;",
">;"
}
.end annotation
# static fields
.field private static final UNSET:F = 3.4028235E38f
# instance fields
.field private mEndRequested:Z
.field private mPendingPosition:F
.field private mSpring:Landroidx/dynamicanimation/animation/SpringForce;
# direct methods
.method public constructor <init>(Landroidx/dynamicanimation/animation/FloatValueHolder;)V
.locals 0
invoke-direct {p0, p1}, Landroidx/dynamicanimation/animation/DynamicAnimation;-><init>(Landroidx/dynamicanimation/animation/FloatValueHolder;)V
const/4 p1, 0x0
iput-object p1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
const p1, 0x7f7fffff # Float.MAX_VALUE
iput p1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mPendingPosition:F
const/4 p1, 0x0
iput-boolean p1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mEndRequested:Z
return-void
.end method
.method public constructor <init>(Landroidx/dynamicanimation/animation/FloatValueHolder;F)V
.locals 0
invoke-direct {p0, p1}, Landroidx/dynamicanimation/animation/DynamicAnimation;-><init>(Landroidx/dynamicanimation/animation/FloatValueHolder;)V
const/4 p1, 0x0
iput-object p1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
const p1, 0x7f7fffff # Float.MAX_VALUE
iput p1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mPendingPosition:F
const/4 p1, 0x0
iput-boolean p1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mEndRequested:Z
new-instance p1, Landroidx/dynamicanimation/animation/SpringForce;
invoke-direct {p1, p2}, Landroidx/dynamicanimation/animation/SpringForce;-><init>(F)V
iput-object p1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
return-void
.end method
.method public constructor <init>(Ljava/lang/Object;Landroidx/dynamicanimation/animation/FloatPropertyCompat;)V
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"<K:",
"Ljava/lang/Object;",
">(TK;",
"Landroidx/dynamicanimation/animation/FloatPropertyCompat<",
"TK;>;)V"
}
.end annotation
invoke-direct {p0, p1, p2}, Landroidx/dynamicanimation/animation/DynamicAnimation;-><init>(Ljava/lang/Object;Landroidx/dynamicanimation/animation/FloatPropertyCompat;)V
const/4 p1, 0x0
iput-object p1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
const p1, 0x7f7fffff # Float.MAX_VALUE
iput p1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mPendingPosition:F
const/4 p1, 0x0
iput-boolean p1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mEndRequested:Z
return-void
.end method
.method public constructor <init>(Ljava/lang/Object;Landroidx/dynamicanimation/animation/FloatPropertyCompat;F)V
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"<K:",
"Ljava/lang/Object;",
">(TK;",
"Landroidx/dynamicanimation/animation/FloatPropertyCompat<",
"TK;>;F)V"
}
.end annotation
invoke-direct {p0, p1, p2}, Landroidx/dynamicanimation/animation/DynamicAnimation;-><init>(Ljava/lang/Object;Landroidx/dynamicanimation/animation/FloatPropertyCompat;)V
const/4 p1, 0x0
iput-object p1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
const p1, 0x7f7fffff # Float.MAX_VALUE
iput p1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mPendingPosition:F
const/4 p1, 0x0
iput-boolean p1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mEndRequested:Z
new-instance p1, Landroidx/dynamicanimation/animation/SpringForce;
invoke-direct {p1, p3}, Landroidx/dynamicanimation/animation/SpringForce;-><init>(F)V
iput-object p1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
return-void
.end method
.method private sanityCheck()V
.locals 5
iget-object v0, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
if-eqz v0, :cond_2
invoke-virtual {v0}, Landroidx/dynamicanimation/animation/SpringForce;->getFinalPosition()F
move-result v0
float-to-double v0, v0
iget v2, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mMaxValue:F
float-to-double v2, v2
cmpl-double v4, v0, v2
if-gtz v4, :cond_1
iget v2, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mMinValue:F
float-to-double v2, v2
cmpg-double v4, v0, v2
if-ltz v4, :cond_0
return-void
:cond_0
new-instance v0, Ljava/lang/UnsupportedOperationException;
const-string v1, "Final position of the spring cannot be less than the min value."
invoke-direct {v0, v1}, Ljava/lang/UnsupportedOperationException;-><init>(Ljava/lang/String;)V
throw v0
:cond_1
new-instance v0, Ljava/lang/UnsupportedOperationException;
const-string v1, "Final position of the spring cannot be greater than the max value."
invoke-direct {v0, v1}, Ljava/lang/UnsupportedOperationException;-><init>(Ljava/lang/String;)V
throw v0
:cond_2
new-instance v0, Ljava/lang/UnsupportedOperationException;
const-string v1, "Incomplete SpringAnimation: Either final position or a spring force needs to be set."
invoke-direct {v0, v1}, Ljava/lang/UnsupportedOperationException;-><init>(Ljava/lang/String;)V
throw v0
.end method
# virtual methods
.method public final animateToFinalPosition(F)V
.locals 1
invoke-virtual {p0}, Landroidx/dynamicanimation/animation/SpringAnimation;->isRunning()Z
move-result v0
if-eqz v0, :cond_0
iput p1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mPendingPosition:F
return-void
:cond_0
iget-object v0, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
if-nez v0, :cond_1
new-instance v0, Landroidx/dynamicanimation/animation/SpringForce;
invoke-direct {v0, p1}, Landroidx/dynamicanimation/animation/SpringForce;-><init>(F)V
iput-object v0, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
:cond_1
iget-object v0, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
invoke-virtual {v0, p1}, Landroidx/dynamicanimation/animation/SpringForce;->setFinalPosition(F)Landroidx/dynamicanimation/animation/SpringForce;
invoke-virtual {p0}, Landroidx/dynamicanimation/animation/SpringAnimation;->start()V
return-void
.end method
.method public final canSkipToEnd()Z
.locals 5
iget-object v0, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
iget-wide v0, v0, Landroidx/dynamicanimation/animation/SpringForce;->mDampingRatio:D
const-wide/16 v2, 0x0
cmpl-double v4, v0, v2
if-lez v4, :cond_0
const/4 v0, 0x1
return v0
:cond_0
const/4 v0, 0x0
return v0
.end method
.method public final cancel()V
.locals 3
invoke-super {p0}, Landroidx/dynamicanimation/animation/DynamicAnimation;->cancel()V
iget v0, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mPendingPosition:F
const v1, 0x7f7fffff # Float.MAX_VALUE
cmpl-float v2, v0, v1
if-eqz v2, :cond_1
iget-object v2, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
if-nez v2, :cond_0
new-instance v2, Landroidx/dynamicanimation/animation/SpringForce;
invoke-direct {v2, v0}, Landroidx/dynamicanimation/animation/SpringForce;-><init>(F)V
iput-object v2, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
goto :goto_0
:cond_0
invoke-virtual {v2, v0}, Landroidx/dynamicanimation/animation/SpringForce;->setFinalPosition(F)Landroidx/dynamicanimation/animation/SpringForce;
:goto_0
iput v1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mPendingPosition:F
:cond_1
return-void
.end method
.method final getAcceleration(FF)F
.locals 1
iget-object v0, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
invoke-virtual {v0, p1, p2}, Landroidx/dynamicanimation/animation/SpringForce;->getAcceleration(FF)F
move-result p1
return p1
.end method
.method public final getSpring()Landroidx/dynamicanimation/animation/SpringForce;
.locals 1
iget-object v0, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
return-object v0
.end method
.method final isAtEquilibrium(FF)Z
.locals 1
iget-object v0, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
invoke-virtual {v0, p1, p2}, Landroidx/dynamicanimation/animation/SpringForce;->isAtEquilibrium(FF)Z
move-result p1
return p1
.end method
.method public final setSpring(Landroidx/dynamicanimation/animation/SpringForce;)Landroidx/dynamicanimation/animation/SpringAnimation;
.locals 0
iput-object p1, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
return-object p0
.end method
.method final setValueThreshold(F)V
.locals 0
return-void
.end method
.method public final skipToEnd()V
.locals 2
invoke-virtual {p0}, Landroidx/dynamicanimation/animation/SpringAnimation;->canSkipToEnd()Z
move-result v0
if-eqz v0, :cond_2
invoke-static {}, Landroid/os/Looper;->myLooper()Landroid/os/Looper;
move-result-object v0
invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;
move-result-object v1
if-ne v0, v1, :cond_1
iget-boolean v0, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mRunning:Z
if-eqz v0, :cond_0
const/4 v0, 0x1
iput-boolean v0, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mEndRequested:Z
:cond_0
return-void
:cond_1
new-instance v0, Landroid/util/AndroidRuntimeException;
const-string v1, "Animations may only be started on the main thread"
invoke-direct {v0, v1}, Landroid/util/AndroidRuntimeException;-><init>(Ljava/lang/String;)V
throw v0
:cond_2
new-instance v0, Ljava/lang/UnsupportedOperationException;
const-string v1, "Spring animations can only come to an end when there is damping"
invoke-direct {v0, v1}, Ljava/lang/UnsupportedOperationException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method public final start()V
.locals 3
invoke-direct {p0}, Landroidx/dynamicanimation/animation/SpringAnimation;->sanityCheck()V
iget-object v0, p0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
invoke-virtual {p0}, Landroidx/dynamicanimation/animation/SpringAnimation;->getValueThreshold()F
move-result v1
float-to-double v1, v1
invoke-virtual {v0, v1, v2}, Landroidx/dynamicanimation/animation/SpringForce;->setValueThreshold(D)V
invoke-super {p0}, Landroidx/dynamicanimation/animation/DynamicAnimation;->start()V
return-void
.end method
.method final updateValueAndVelocity(J)Z
.locals 20
move-object/from16 v0, p0
iget-boolean v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mEndRequested:Z
const/4 v2, 0x1
const/4 v3, 0x0
const/4 v4, 0x0
const v5, 0x7f7fffff # Float.MAX_VALUE
if-eqz v1, :cond_1
iget v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mPendingPosition:F
cmpl-float v6, v1, v5
if-eqz v6, :cond_0
iget-object v6, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
invoke-virtual {v6, v1}, Landroidx/dynamicanimation/animation/SpringForce;->setFinalPosition(F)Landroidx/dynamicanimation/animation/SpringForce;
iput v5, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mPendingPosition:F
:cond_0
iget-object v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
invoke-virtual {v1}, Landroidx/dynamicanimation/animation/SpringForce;->getFinalPosition()F
move-result v1
iput v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mValue:F
iput v4, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mVelocity:F
iput-boolean v3, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mEndRequested:Z
return v2
:cond_1
iget v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mPendingPosition:F
cmpl-float v1, v1, v5
if-eqz v1, :cond_2
iget-object v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
invoke-virtual {v1}, Landroidx/dynamicanimation/animation/SpringForce;->getFinalPosition()F
iget-object v6, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
iget v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mValue:F
float-to-double v7, v1
iget v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mVelocity:F
float-to-double v9, v1
const-wide/16 v11, 0x2
div-long v18, p1, v11
move-wide/from16 v11, v18
invoke-virtual/range {v6 .. v12}, Landroidx/dynamicanimation/animation/SpringForce;->updateValues(DDJ)Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;
move-result-object v1
iget-object v6, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
iget v7, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mPendingPosition:F
invoke-virtual {v6, v7}, Landroidx/dynamicanimation/animation/SpringForce;->setFinalPosition(F)Landroidx/dynamicanimation/animation/SpringForce;
iput v5, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mPendingPosition:F
iget-object v13, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
iget v5, v1, Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;->mValue:F
float-to-double v14, v5
iget v1, v1, Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;->mVelocity:F
float-to-double v5, v1
move-wide/from16 v16, v5
invoke-virtual/range {v13 .. v19}, Landroidx/dynamicanimation/animation/SpringForce;->updateValues(DDJ)Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;
move-result-object v1
iget v5, v1, Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;->mValue:F
iput v5, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mValue:F
iget v1, v1, Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;->mVelocity:F
iput v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mVelocity:F
goto :goto_0
:cond_2
iget-object v13, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
iget v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mValue:F
float-to-double v14, v1
iget v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mVelocity:F
float-to-double v5, v1
move-wide/from16 v16, v5
move-wide/from16 v18, p1
invoke-virtual/range {v13 .. v19}, Landroidx/dynamicanimation/animation/SpringForce;->updateValues(DDJ)Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;
move-result-object v1
iget v5, v1, Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;->mValue:F
iput v5, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mValue:F
iget v1, v1, Landroidx/dynamicanimation/animation/DynamicAnimation$MassState;->mVelocity:F
iput v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mVelocity:F
:goto_0
iget v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mValue:F
iget v5, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mMinValue:F
invoke-static {v1, v5}, Ljava/lang/Math;->max(FF)F
move-result v1
iput v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mValue:F
iget v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mValue:F
iget v5, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mMaxValue:F
invoke-static {v1, v5}, Ljava/lang/Math;->min(FF)F
move-result v1
iput v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mValue:F
iget v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mValue:F
iget v5, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mVelocity:F
invoke-virtual {v0, v1, v5}, Landroidx/dynamicanimation/animation/SpringAnimation;->isAtEquilibrium(FF)Z
move-result v1
if-eqz v1, :cond_3
iget-object v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mSpring:Landroidx/dynamicanimation/animation/SpringForce;
invoke-virtual {v1}, Landroidx/dynamicanimation/animation/SpringForce;->getFinalPosition()F
move-result v1
iput v1, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mValue:F
iput v4, v0, Landroidx/dynamicanimation/animation/SpringAnimation;->mVelocity:F
return v2
:cond_3
return v3
.end method