apkfuckery/com.discord/smali/androidx/transition/TransitionUtils.smali
2019-05-03 20:53:54 +02:00

431 lines
9.6 KiB
Smali

.class Landroidx/transition/TransitionUtils;
.super Ljava/lang/Object;
.source "TransitionUtils.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Landroidx/transition/TransitionUtils$MatrixEvaluator;
}
.end annotation
# static fields
.field private static final HAS_IS_ATTACHED_TO_WINDOW:Z
.field private static final HAS_OVERLAY:Z
.field private static final HAS_PICTURE_BITMAP:Z
.field private static final MAX_IMAGE_SIZE:I = 0x100000
# direct methods
.method static constructor <clinit>()V
.locals 4
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/4 v1, 0x1
const/4 v2, 0x0
const/16 v3, 0x13
if-lt v0, v3, :cond_0
const/4 v0, 0x1
goto :goto_0
:cond_0
const/4 v0, 0x0
:goto_0
sput-boolean v0, Landroidx/transition/TransitionUtils;->HAS_IS_ATTACHED_TO_WINDOW:Z
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v3, 0x12
if-lt v0, v3, :cond_1
const/4 v0, 0x1
goto :goto_1
:cond_1
const/4 v0, 0x0
:goto_1
sput-boolean v0, Landroidx/transition/TransitionUtils;->HAS_OVERLAY:Z
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v3, 0x1c
if-lt v0, v3, :cond_2
goto :goto_2
:cond_2
const/4 v1, 0x0
:goto_2
sput-boolean v1, Landroidx/transition/TransitionUtils;->HAS_PICTURE_BITMAP:Z
return-void
.end method
.method private constructor <init>()V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method static copyViewImage(Landroid/view/ViewGroup;Landroid/view/View;Landroid/view/View;)Landroid/view/View;
.locals 7
new-instance v0, Landroid/graphics/Matrix;
invoke-direct {v0}, Landroid/graphics/Matrix;-><init>()V
invoke-virtual {p2}, Landroid/view/View;->getScrollX()I
move-result v1
neg-int v1, v1
int-to-float v1, v1
invoke-virtual {p2}, Landroid/view/View;->getScrollY()I
move-result p2
neg-int p2, p2
int-to-float p2, p2
invoke-virtual {v0, v1, p2}, Landroid/graphics/Matrix;->setTranslate(FF)V
invoke-static {p1, v0}, Landroidx/transition/ViewUtils;->transformMatrixToGlobal(Landroid/view/View;Landroid/graphics/Matrix;)V
invoke-static {p0, v0}, Landroidx/transition/ViewUtils;->transformMatrixToLocal(Landroid/view/View;Landroid/graphics/Matrix;)V
new-instance p2, Landroid/graphics/RectF;
invoke-virtual {p1}, Landroid/view/View;->getWidth()I
move-result v1
int-to-float v1, v1
invoke-virtual {p1}, Landroid/view/View;->getHeight()I
move-result v2
int-to-float v2, v2
const/4 v3, 0x0
invoke-direct {p2, v3, v3, v1, v2}, Landroid/graphics/RectF;-><init>(FFFF)V
invoke-virtual {v0, p2}, Landroid/graphics/Matrix;->mapRect(Landroid/graphics/RectF;)Z
iget v1, p2, Landroid/graphics/RectF;->left:F
invoke-static {v1}, Ljava/lang/Math;->round(F)I
move-result v1
iget v2, p2, Landroid/graphics/RectF;->top:F
invoke-static {v2}, Ljava/lang/Math;->round(F)I
move-result v2
iget v3, p2, Landroid/graphics/RectF;->right:F
invoke-static {v3}, Ljava/lang/Math;->round(F)I
move-result v3
iget v4, p2, Landroid/graphics/RectF;->bottom:F
invoke-static {v4}, Ljava/lang/Math;->round(F)I
move-result v4
new-instance v5, Landroid/widget/ImageView;
invoke-virtual {p1}, Landroid/view/View;->getContext()Landroid/content/Context;
move-result-object v6
invoke-direct {v5, v6}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V
sget-object v6, Landroid/widget/ImageView$ScaleType;->CENTER_CROP:Landroid/widget/ImageView$ScaleType;
invoke-virtual {v5, v6}, Landroid/widget/ImageView;->setScaleType(Landroid/widget/ImageView$ScaleType;)V
invoke-static {p1, v0, p2, p0}, Landroidx/transition/TransitionUtils;->createViewBitmap(Landroid/view/View;Landroid/graphics/Matrix;Landroid/graphics/RectF;Landroid/view/ViewGroup;)Landroid/graphics/Bitmap;
move-result-object p0
if-eqz p0, :cond_0
invoke-virtual {v5, p0}, Landroid/widget/ImageView;->setImageBitmap(Landroid/graphics/Bitmap;)V
:cond_0
sub-int p0, v3, v1
const/high16 p1, 0x40000000 # 2.0f
invoke-static {p0, p1}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I
move-result p0
sub-int p2, v4, v2
invoke-static {p2, p1}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I
move-result p1
invoke-virtual {v5, p0, p1}, Landroid/widget/ImageView;->measure(II)V
invoke-virtual {v5, v1, v2, v3, v4}, Landroid/widget/ImageView;->layout(IIII)V
return-object v5
.end method
.method private static createViewBitmap(Landroid/view/View;Landroid/graphics/Matrix;Landroid/graphics/RectF;Landroid/view/ViewGroup;)Landroid/graphics/Bitmap;
.locals 9
sget-boolean v0, Landroidx/transition/TransitionUtils;->HAS_IS_ATTACHED_TO_WINDOW:Z
const/4 v1, 0x0
if-eqz v0, :cond_1
invoke-virtual {p0}, Landroid/view/View;->isAttachedToWindow()Z
move-result v0
xor-int/lit8 v0, v0, 0x1
if-nez p3, :cond_0
goto :goto_0
:cond_0
invoke-virtual {p3}, Landroid/view/ViewGroup;->isAttachedToWindow()Z
move-result v2
goto :goto_1
:cond_1
const/4 v0, 0x0
:goto_0
const/4 v2, 0x0
:goto_1
sget-boolean v3, Landroidx/transition/TransitionUtils;->HAS_OVERLAY:Z
const/4 v4, 0x0
if-eqz v3, :cond_3
if-eqz v0, :cond_3
if-nez v2, :cond_2
return-object v4
:cond_2
invoke-virtual {p0}, Landroid/view/View;->getParent()Landroid/view/ViewParent;
move-result-object v1
check-cast v1, Landroid/view/ViewGroup;
invoke-virtual {v1, p0}, Landroid/view/ViewGroup;->indexOfChild(Landroid/view/View;)I
move-result v2
invoke-virtual {p3}, Landroid/view/ViewGroup;->getOverlay()Landroid/view/ViewGroupOverlay;
move-result-object v3
invoke-virtual {v3, p0}, Landroid/view/ViewGroupOverlay;->add(Landroid/view/View;)V
move v8, v2
move-object v2, v1
move v1, v8
goto :goto_2
:cond_3
move-object v2, v4
:goto_2
invoke-virtual {p2}, Landroid/graphics/RectF;->width()F
move-result v3
invoke-static {v3}, Ljava/lang/Math;->round(F)I
move-result v3
invoke-virtual {p2}, Landroid/graphics/RectF;->height()F
move-result v5
invoke-static {v5}, Ljava/lang/Math;->round(F)I
move-result v5
if-lez v3, :cond_5
if-lez v5, :cond_5
const/high16 v4, 0x3f800000 # 1.0f
const/high16 v6, 0x49800000 # 1048576.0f
mul-int v7, v3, v5
int-to-float v7, v7
div-float/2addr v6, v7
invoke-static {v4, v6}, Ljava/lang/Math;->min(FF)F
move-result v4
int-to-float v3, v3
mul-float v3, v3, v4
invoke-static {v3}, Ljava/lang/Math;->round(F)I
move-result v3
int-to-float v5, v5
mul-float v5, v5, v4
invoke-static {v5}, Ljava/lang/Math;->round(F)I
move-result v5
iget v6, p2, Landroid/graphics/RectF;->left:F
neg-float v6, v6
iget p2, p2, Landroid/graphics/RectF;->top:F
neg-float p2, p2
invoke-virtual {p1, v6, p2}, Landroid/graphics/Matrix;->postTranslate(FF)Z
invoke-virtual {p1, v4, v4}, Landroid/graphics/Matrix;->postScale(FF)Z
sget-boolean p2, Landroidx/transition/TransitionUtils;->HAS_PICTURE_BITMAP:Z
if-eqz p2, :cond_4
new-instance p2, Landroid/graphics/Picture;
invoke-direct {p2}, Landroid/graphics/Picture;-><init>()V
invoke-virtual {p2, v3, v5}, Landroid/graphics/Picture;->beginRecording(II)Landroid/graphics/Canvas;
move-result-object v3
invoke-virtual {v3, p1}, Landroid/graphics/Canvas;->concat(Landroid/graphics/Matrix;)V
invoke-virtual {p0, v3}, Landroid/view/View;->draw(Landroid/graphics/Canvas;)V
invoke-virtual {p2}, Landroid/graphics/Picture;->endRecording()V
invoke-static {p2}, Landroid/graphics/Bitmap;->createBitmap(Landroid/graphics/Picture;)Landroid/graphics/Bitmap;
move-result-object v4
goto :goto_3
:cond_4
sget-object p2, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config;
invoke-static {v3, v5, p2}, Landroid/graphics/Bitmap;->createBitmap(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;
move-result-object v4
new-instance p2, Landroid/graphics/Canvas;
invoke-direct {p2, v4}, Landroid/graphics/Canvas;-><init>(Landroid/graphics/Bitmap;)V
invoke-virtual {p2, p1}, Landroid/graphics/Canvas;->concat(Landroid/graphics/Matrix;)V
invoke-virtual {p0, p2}, Landroid/view/View;->draw(Landroid/graphics/Canvas;)V
:cond_5
:goto_3
sget-boolean p1, Landroidx/transition/TransitionUtils;->HAS_OVERLAY:Z
if-eqz p1, :cond_6
if-eqz v0, :cond_6
invoke-virtual {p3}, Landroid/view/ViewGroup;->getOverlay()Landroid/view/ViewGroupOverlay;
move-result-object p1
invoke-virtual {p1, p0}, Landroid/view/ViewGroupOverlay;->remove(Landroid/view/View;)V
invoke-virtual {v2, p0, v1}, Landroid/view/ViewGroup;->addView(Landroid/view/View;I)V
:cond_6
return-object v4
.end method
.method static mergeAnimators(Landroid/animation/Animator;Landroid/animation/Animator;)Landroid/animation/Animator;
.locals 3
if-nez p0, :cond_0
return-object p1
:cond_0
if-nez p1, :cond_1
return-object p0
:cond_1
new-instance v0, Landroid/animation/AnimatorSet;
invoke-direct {v0}, Landroid/animation/AnimatorSet;-><init>()V
const/4 v1, 0x2
new-array v1, v1, [Landroid/animation/Animator;
const/4 v2, 0x0
aput-object p0, v1, v2
const/4 p0, 0x1
aput-object p1, v1, p0
invoke-virtual {v0, v1}, Landroid/animation/AnimatorSet;->playTogether([Landroid/animation/Animator;)V
return-object v0
.end method