apkfuckery/com.discord/smali/androidx/transition/ViewUtilsBase.smali

690 lines
16 KiB
Smali
Raw Normal View History

2019-12-06 03:29:40 +00:00
.class public Landroidx/transition/ViewUtilsBase;
2019-07-24 11:27:29 +00:00
.super Ljava/lang/Object;
.source "ViewUtilsBase.java"
2020-01-07 02:40:43 +00:00
# static fields
.field public static final TAG:Ljava/lang/String; = "ViewUtilsBase"
.field public static final VISIBILITY_MASK:I = 0xc
.field public static sSetFrameFetched:Z
.field public static sSetFrameMethod:Ljava/lang/reflect/Method;
.field public static sViewFlagsField:Ljava/lang/reflect/Field;
.field public static sViewFlagsFieldFetched:Z
2019-07-24 11:27:29 +00:00
# instance fields
2019-12-06 03:29:40 +00:00
.field public mMatrixValues:[F
2019-07-24 11:27:29 +00:00
# direct methods
2019-12-06 03:29:40 +00:00
.method public constructor <init>()V
2019-07-24 11:27:29 +00:00
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
2020-01-07 02:40:43 +00:00
.method private fetchSetFrame()V
.locals 6
.annotation build Landroid/annotation/SuppressLint;
value = {
"PrivateApi"
}
.end annotation
sget-boolean v0, Landroidx/transition/ViewUtilsBase;->sSetFrameFetched:Z
if-nez v0, :cond_0
const/4 v0, 0x1
:try_start_0
const-class v1, Landroid/view/View;
const-string v2, "setFrame"
const/4 v3, 0x4
new-array v3, v3, [Ljava/lang/Class;
const/4 v4, 0x0
sget-object v5, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;
aput-object v5, v3, v4
sget-object v4, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;
aput-object v4, v3, v0
const/4 v4, 0x2
sget-object v5, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;
aput-object v5, v3, v4
const/4 v4, 0x3
sget-object v5, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;
aput-object v5, v3, v4
invoke-virtual {v1, v2, v3}, Ljava/lang/Class;->getDeclaredMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
move-result-object v1
sput-object v1, Landroidx/transition/ViewUtilsBase;->sSetFrameMethod:Ljava/lang/reflect/Method;
sget-object v1, Landroidx/transition/ViewUtilsBase;->sSetFrameMethod:Ljava/lang/reflect/Method;
invoke-virtual {v1, v0}, Ljava/lang/reflect/Method;->setAccessible(Z)V
:try_end_0
.catch Ljava/lang/NoSuchMethodException; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
move-exception v1
const-string v2, "ViewUtilsBase"
const-string v3, "Failed to retrieve setFrame method"
invoke-static {v2, v3, v1}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:goto_0
sput-boolean v0, Landroidx/transition/ViewUtilsBase;->sSetFrameFetched:Z
:cond_0
return-void
.end method
2019-07-24 11:27:29 +00:00
# virtual methods
.method public clearNonTransitionAlpha(Landroid/view/View;)V
.locals 2
2019-12-06 03:29:40 +00:00
.param p1 # Landroid/view/View;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
2019-07-24 11:27:29 +00:00
invoke-virtual {p1}, Landroid/view/View;->getVisibility()I
move-result v0
if-nez v0, :cond_0
sget v0, Landroidx/transition/R$id;->save_non_transition_alpha:I
const/4 v1, 0x0
invoke-virtual {p1, v0, v1}, Landroid/view/View;->setTag(ILjava/lang/Object;)V
:cond_0
return-void
.end method
.method public getTransitionAlpha(Landroid/view/View;)F
.locals 1
2019-12-06 03:29:40 +00:00
.param p1 # Landroid/view/View;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
2019-07-24 11:27:29 +00:00
sget v0, Landroidx/transition/R$id;->save_non_transition_alpha:I
invoke-virtual {p1, v0}, Landroid/view/View;->getTag(I)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/lang/Float;
if-eqz v0, :cond_0
invoke-virtual {p1}, Landroid/view/View;->getAlpha()F
move-result p1
invoke-virtual {v0}, Ljava/lang/Float;->floatValue()F
move-result v0
div-float/2addr p1, v0
return p1
:cond_0
invoke-virtual {p1}, Landroid/view/View;->getAlpha()F
move-result p1
return p1
.end method
.method public saveNonTransitionAlpha(Landroid/view/View;)V
.locals 2
2019-12-06 03:29:40 +00:00
.param p1 # Landroid/view/View;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
2019-07-24 11:27:29 +00:00
sget v0, Landroidx/transition/R$id;->save_non_transition_alpha:I
invoke-virtual {p1, v0}, Landroid/view/View;->getTag(I)Ljava/lang/Object;
move-result-object v0
if-nez v0, :cond_0
sget v0, Landroidx/transition/R$id;->save_non_transition_alpha:I
invoke-virtual {p1}, Landroid/view/View;->getAlpha()F
move-result v1
invoke-static {v1}, Ljava/lang/Float;->valueOf(F)Ljava/lang/Float;
move-result-object v1
invoke-virtual {p1, v0, v1}, Landroid/view/View;->setTag(ILjava/lang/Object;)V
:cond_0
return-void
.end method
.method public setAnimationMatrix(Landroid/view/View;Landroid/graphics/Matrix;)V
.locals 9
2019-12-06 03:29:40 +00:00
.param p1 # Landroid/view/View;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
2020-01-07 02:40:43 +00:00
.param p2 # Landroid/graphics/Matrix;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
2019-07-24 11:27:29 +00:00
const/high16 v0, 0x3f800000 # 1.0f
const/4 v1, 0x2
const/4 v2, 0x0
if-eqz p2, :cond_3
invoke-virtual {p2}, Landroid/graphics/Matrix;->isIdentity()Z
move-result v3
if-eqz v3, :cond_0
goto :goto_1
:cond_0
iget-object v3, p0, Landroidx/transition/ViewUtilsBase;->mMatrixValues:[F
if-nez v3, :cond_1
const/16 v3, 0x9
new-array v3, v3, [F
iput-object v3, p0, Landroidx/transition/ViewUtilsBase;->mMatrixValues:[F
:cond_1
invoke-virtual {p2, v3}, Landroid/graphics/Matrix;->getValues([F)V
const/4 p2, 0x3
aget p2, v3, p2
mul-float v4, p2, p2
sub-float/2addr v0, v4
float-to-double v4, v0
invoke-static {v4, v5}, Ljava/lang/Math;->sqrt(D)D
move-result-wide v4
double-to-float v0, v4
const/4 v4, 0x0
aget v5, v3, v4
cmpg-float v5, v5, v2
if-gez v5, :cond_2
const/4 v5, -0x1
goto :goto_0
:cond_2
const/4 v5, 0x1
:goto_0
int-to-float v5, v5
mul-float v0, v0, v5
float-to-double v5, p2
float-to-double v7, v0
invoke-static {v5, v6, v7, v8}, Ljava/lang/Math;->atan2(DD)D
move-result-wide v5
invoke-static {v5, v6}, Ljava/lang/Math;->toDegrees(D)D
move-result-wide v5
double-to-float p2, v5
aget v4, v3, v4
div-float/2addr v4, v0
const/4 v5, 0x4
aget v5, v3, v5
div-float/2addr v5, v0
aget v0, v3, v1
const/4 v1, 0x5
aget v1, v3, v1
invoke-virtual {p1, v2}, Landroid/view/View;->setPivotX(F)V
invoke-virtual {p1, v2}, Landroid/view/View;->setPivotY(F)V
invoke-virtual {p1, v0}, Landroid/view/View;->setTranslationX(F)V
invoke-virtual {p1, v1}, Landroid/view/View;->setTranslationY(F)V
invoke-virtual {p1, p2}, Landroid/view/View;->setRotation(F)V
invoke-virtual {p1, v4}, Landroid/view/View;->setScaleX(F)V
invoke-virtual {p1, v5}, Landroid/view/View;->setScaleY(F)V
2019-12-06 03:29:40 +00:00
goto :goto_2
2019-07-24 11:27:29 +00:00
:cond_3
:goto_1
invoke-virtual {p1}, Landroid/view/View;->getWidth()I
move-result p2
div-int/2addr p2, v1
int-to-float p2, p2
invoke-virtual {p1, p2}, Landroid/view/View;->setPivotX(F)V
invoke-virtual {p1}, Landroid/view/View;->getHeight()I
move-result p2
div-int/2addr p2, v1
int-to-float p2, p2
invoke-virtual {p1, p2}, Landroid/view/View;->setPivotY(F)V
invoke-virtual {p1, v2}, Landroid/view/View;->setTranslationX(F)V
invoke-virtual {p1, v2}, Landroid/view/View;->setTranslationY(F)V
invoke-virtual {p1, v0}, Landroid/view/View;->setScaleX(F)V
invoke-virtual {p1, v0}, Landroid/view/View;->setScaleY(F)V
invoke-virtual {p1, v2}, Landroid/view/View;->setRotation(F)V
2019-12-06 03:29:40 +00:00
:goto_2
2019-07-24 11:27:29 +00:00
return-void
.end method
.method public setLeftTopRightBottom(Landroid/view/View;IIII)V
2020-01-07 02:40:43 +00:00
.locals 3
.param p1 # Landroid/view/View;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
invoke-direct {p0}, Landroidx/transition/ViewUtilsBase;->fetchSetFrame()V
sget-object v0, Landroidx/transition/ViewUtilsBase;->sSetFrameMethod:Ljava/lang/reflect/Method;
if-eqz v0, :cond_0
const/4 v1, 0x4
:try_start_0
new-array v1, v1, [Ljava/lang/Object;
const/4 v2, 0x0
invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object p2
2019-07-24 11:27:29 +00:00
2020-01-07 02:40:43 +00:00
aput-object p2, v1, v2
2019-07-24 11:27:29 +00:00
2020-01-07 02:40:43 +00:00
const/4 p2, 0x1
2019-07-24 11:27:29 +00:00
2020-01-07 02:40:43 +00:00
invoke-static {p3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
2019-07-24 11:27:29 +00:00
2020-01-07 02:40:43 +00:00
move-result-object p3
2019-07-24 11:27:29 +00:00
2020-01-07 02:40:43 +00:00
aput-object p3, v1, p2
const/4 p2, 0x2
invoke-static {p4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object p3
aput-object p3, v1, p2
const/4 p2, 0x3
invoke-static {p5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object p3
aput-object p3, v1, p2
invoke-virtual {v0, p1, v1}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
:try_end_0
.catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_0} :catch_1
.catch Ljava/lang/reflect/InvocationTargetException; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
move-exception p1
new-instance p2, Ljava/lang/RuntimeException;
invoke-virtual {p1}, Ljava/lang/reflect/InvocationTargetException;->getCause()Ljava/lang/Throwable;
move-result-object p1
invoke-direct {p2, p1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/Throwable;)V
throw p2
:catch_1
:cond_0
:goto_0
2019-07-24 11:27:29 +00:00
return-void
.end method
.method public setTransitionAlpha(Landroid/view/View;F)V
.locals 1
2019-12-06 03:29:40 +00:00
.param p1 # Landroid/view/View;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
2019-07-24 11:27:29 +00:00
sget v0, Landroidx/transition/R$id;->save_non_transition_alpha:I
invoke-virtual {p1, v0}, Landroid/view/View;->getTag(I)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/lang/Float;
if-eqz v0, :cond_0
invoke-virtual {v0}, Ljava/lang/Float;->floatValue()F
move-result v0
mul-float v0, v0, p2
invoke-virtual {p1, v0}, Landroid/view/View;->setAlpha(F)V
2019-12-06 03:29:40 +00:00
goto :goto_0
2019-07-24 11:27:29 +00:00
:cond_0
invoke-virtual {p1, p2}, Landroid/view/View;->setAlpha(F)V
2019-12-06 03:29:40 +00:00
:goto_0
2019-07-24 11:27:29 +00:00
return-void
.end method
2020-01-07 02:40:43 +00:00
.method public setTransitionVisibility(Landroid/view/View;I)V
.locals 3
.param p1 # Landroid/view/View;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
sget-boolean v0, Landroidx/transition/ViewUtilsBase;->sViewFlagsFieldFetched:Z
if-nez v0, :cond_0
const/4 v0, 0x1
:try_start_0
const-class v1, Landroid/view/View;
const-string v2, "mViewFlags"
invoke-virtual {v1, v2}, Ljava/lang/Class;->getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;
move-result-object v1
sput-object v1, Landroidx/transition/ViewUtilsBase;->sViewFlagsField:Ljava/lang/reflect/Field;
sget-object v1, Landroidx/transition/ViewUtilsBase;->sViewFlagsField:Ljava/lang/reflect/Field;
invoke-virtual {v1, v0}, Ljava/lang/reflect/Field;->setAccessible(Z)V
:try_end_0
.catch Ljava/lang/NoSuchFieldException; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
const-string v1, "ViewUtilsBase"
const-string v2, "fetchViewFlagsField: "
invoke-static {v1, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
:goto_0
sput-boolean v0, Landroidx/transition/ViewUtilsBase;->sViewFlagsFieldFetched:Z
:cond_0
sget-object v0, Landroidx/transition/ViewUtilsBase;->sViewFlagsField:Ljava/lang/reflect/Field;
if-eqz v0, :cond_1
:try_start_1
invoke-virtual {v0, p1}, Ljava/lang/reflect/Field;->getInt(Ljava/lang/Object;)I
move-result v0
sget-object v1, Landroidx/transition/ViewUtilsBase;->sViewFlagsField:Ljava/lang/reflect/Field;
and-int/lit8 v0, v0, -0xd
or-int/2addr p2, v0
invoke-virtual {v1, p1, p2}, Ljava/lang/reflect/Field;->setInt(Ljava/lang/Object;I)V
:try_end_1
.catch Ljava/lang/IllegalAccessException; {:try_start_1 .. :try_end_1} :catch_1
:catch_1
:cond_1
return-void
.end method
2019-07-24 11:27:29 +00:00
.method public transformMatrixToGlobal(Landroid/view/View;Landroid/graphics/Matrix;)V
.locals 2
2019-12-06 03:29:40 +00:00
.param p1 # Landroid/view/View;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2 # Landroid/graphics/Matrix;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
2019-07-24 11:27:29 +00:00
invoke-virtual {p1}, Landroid/view/View;->getParent()Landroid/view/ViewParent;
move-result-object v0
instance-of v1, v0, Landroid/view/View;
if-eqz v1, :cond_0
check-cast v0, Landroid/view/View;
invoke-virtual {p0, v0, p2}, Landroidx/transition/ViewUtilsBase;->transformMatrixToGlobal(Landroid/view/View;Landroid/graphics/Matrix;)V
invoke-virtual {v0}, Landroid/view/View;->getScrollX()I
move-result v1
neg-int v1, v1
int-to-float v1, v1
invoke-virtual {v0}, Landroid/view/View;->getScrollY()I
move-result v0
neg-int v0, v0
int-to-float v0, v0
invoke-virtual {p2, v1, v0}, Landroid/graphics/Matrix;->preTranslate(FF)Z
:cond_0
invoke-virtual {p1}, Landroid/view/View;->getLeft()I
move-result v0
int-to-float v0, v0
invoke-virtual {p1}, Landroid/view/View;->getTop()I
move-result v1
int-to-float v1, v1
invoke-virtual {p2, v0, v1}, Landroid/graphics/Matrix;->preTranslate(FF)Z
invoke-virtual {p1}, Landroid/view/View;->getMatrix()Landroid/graphics/Matrix;
move-result-object p1
invoke-virtual {p1}, Landroid/graphics/Matrix;->isIdentity()Z
move-result v0
if-nez v0, :cond_1
invoke-virtual {p2, p1}, Landroid/graphics/Matrix;->preConcat(Landroid/graphics/Matrix;)Z
:cond_1
return-void
.end method
.method public transformMatrixToLocal(Landroid/view/View;Landroid/graphics/Matrix;)V
.locals 2
2019-12-06 03:29:40 +00:00
.param p1 # Landroid/view/View;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2 # Landroid/graphics/Matrix;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
2019-07-24 11:27:29 +00:00
invoke-virtual {p1}, Landroid/view/View;->getParent()Landroid/view/ViewParent;
move-result-object v0
instance-of v1, v0, Landroid/view/View;
if-eqz v1, :cond_0
check-cast v0, Landroid/view/View;
invoke-virtual {p0, v0, p2}, Landroidx/transition/ViewUtilsBase;->transformMatrixToLocal(Landroid/view/View;Landroid/graphics/Matrix;)V
invoke-virtual {v0}, Landroid/view/View;->getScrollX()I
move-result v1
int-to-float v1, v1
invoke-virtual {v0}, Landroid/view/View;->getScrollY()I
move-result v0
int-to-float v0, v0
invoke-virtual {p2, v1, v0}, Landroid/graphics/Matrix;->postTranslate(FF)Z
:cond_0
invoke-virtual {p1}, Landroid/view/View;->getLeft()I
move-result v0
2020-01-07 02:40:43 +00:00
neg-int v0, v0
2019-07-24 11:27:29 +00:00
int-to-float v0, v0
invoke-virtual {p1}, Landroid/view/View;->getTop()I
move-result v1
2020-01-07 02:40:43 +00:00
neg-int v1, v1
2019-07-24 11:27:29 +00:00
int-to-float v1, v1
invoke-virtual {p2, v0, v1}, Landroid/graphics/Matrix;->postTranslate(FF)Z
invoke-virtual {p1}, Landroid/view/View;->getMatrix()Landroid/graphics/Matrix;
move-result-object p1
invoke-virtual {p1}, Landroid/graphics/Matrix;->isIdentity()Z
move-result v0
if-nez v0, :cond_1
new-instance v0, Landroid/graphics/Matrix;
invoke-direct {v0}, Landroid/graphics/Matrix;-><init>()V
invoke-virtual {p1, v0}, Landroid/graphics/Matrix;->invert(Landroid/graphics/Matrix;)Z
move-result p1
if-eqz p1, :cond_1
invoke-virtual {p2, v0}, Landroid/graphics/Matrix;->postConcat(Landroid/graphics/Matrix;)Z
:cond_1
return-void
.end method