RNShadowTextGradient.smali

.class public abstract Liyegoroff/RNTextGradient/RNShadowTextGradient;
.super Lcom/facebook/react/views/text/ReactTextShadowNode;
.source "SourceFile"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Liyegoroff/RNTextGradient/RNShadowTextGradient$LayoutChangeListener;,
        Liyegoroff/RNTextGradient/RNShadowTextGradient$TextChangeListener;
    }
.end annotation


# static fields
.field private static final sSpannableField:Ljava/lang/String; = "mPreparedSpannableText"


# instance fields
.field public mColors:[I

.field private mContext:Ljava/lang/ref/WeakReference;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/lang/ref/WeakReference<",
            "Lcom/facebook/react/bridge/ReactApplicationContext;",
            ">;"
        }
    .end annotation
.end field

.field public mLocations:[F

.field public mUseViewFrame:Z


# direct methods
.method public constructor <init>(Lcom/facebook/react/bridge/ReactApplicationContext;)V
    .registers 3

    .line 1
    invoke-direct {p0}, Lcom/facebook/react/views/text/ReactTextShadowNode;-><init>()V

    .line 2
    new-instance v0, Ljava/lang/ref/WeakReference;

    invoke-direct {v0, p1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V

    iput-object v0, p0, Liyegoroff/RNTextGradient/RNShadowTextGradient;->mContext:Ljava/lang/ref/WeakReference;

    return-void
.end method

.method public static synthetic access$000(Liyegoroff/RNTextGradient/RNShadowTextGradient;I)Landroid/view/View;
    .registers 2

    invoke-direct {p0, p1}, Liyegoroff/RNTextGradient/RNShadowTextGradient;->resolveView(I)Landroid/view/View;

    move-result-object p0

    return-object p0
.end method

.method public static synthetic access$100(Liyegoroff/RNTextGradient/RNShadowTextGradient;Landroid/text/Layout;)Landroid/text/Spannable;
    .registers 2

    invoke-direct {p0, p1}, Liyegoroff/RNTextGradient/RNShadowTextGradient;->updatedSpannable(Landroid/text/Layout;)Landroid/text/Spannable;

    move-result-object p0

    return-object p0
.end method

.method public static synthetic access$200(Liyegoroff/RNTextGradient/RNShadowTextGradient;)Z
    .registers 1

    iget-boolean p0, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mContainsImages:Z

    return p0
.end method

.method public static synthetic access$300(Liyegoroff/RNTextGradient/RNShadowTextGradient;)I
    .registers 1

    iget p0, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mTextBreakStrategy:I

    return p0
.end method

.method public static synthetic access$400(Liyegoroff/RNTextGradient/RNShadowTextGradient;)I
    .registers 1

    iget p0, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mJustificationMode:I

    return p0
.end method

.method public static synthetic access$500(Liyegoroff/RNTextGradient/RNShadowTextGradient;)Z
    .registers 1

    iget-boolean p0, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mContainsImages:Z

    return p0
.end method

.method public static synthetic access$600(Liyegoroff/RNTextGradient/RNShadowTextGradient;)I
    .registers 1

    iget p0, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mTextBreakStrategy:I

    return p0
.end method

.method public static synthetic access$700(Liyegoroff/RNTextGradient/RNShadowTextGradient;)I
    .registers 1

    iget p0, p0, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;->mJustificationMode:I

    return p0
.end method

.method private static buildSpannedGradientFromTextCSSNode(Lcom/facebook/react/views/text/ReactBaseTextShadowNode;Landroid/text/SpannableStringBuilder;Ljava/util/List;FFLandroid/text/Layout;)V
    .registers 16
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lcom/facebook/react/views/text/ReactBaseTextShadowNode;",
            "Landroid/text/SpannableStringBuilder;",
            "Ljava/util/List<",
            "Liyegoroff/RNTextGradient/RNSetGradientSpanOperation;",
            ">;FF",
            "Landroid/text/Layout;",
            ")V"
        }
    .end annotation

    .line 1
    invoke-virtual {p1}, Landroid/text/SpannableStringBuilder;->length()I

    move-result v2

    const/4 v0, 0x0

    .line 2
    :goto_5
    invoke-virtual {p0}, Lcom/facebook/react/uimanager/ReactShadowNodeImpl;->getChildCount()I

    move-result v1

    if-ge v0, v1, :cond_45

    .line 3
    invoke-virtual {p0, v0}, Lcom/facebook/react/uimanager/ReactShadowNodeImpl;->getChildAt(I)Lcom/facebook/react/uimanager/ReactShadowNodeImpl;

    move-result-object v1

    .line 4
    instance-of v3, v1, Lcom/facebook/react/views/text/ReactRawTextShadowNode;

    if-eqz v3, :cond_1e

    .line 5
    move-object v3, v1

    check-cast v3, Lcom/facebook/react/views/text/ReactRawTextShadowNode;

    invoke-virtual {v3}, Lcom/facebook/react/views/text/ReactRawTextShadowNode;->getText()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {p1, v3}, Landroid/text/SpannableStringBuilder;->append(Ljava/lang/CharSequence;)Landroid/text/SpannableStringBuilder;

    goto :goto_3f

    .line 6
    :cond_1e
    instance-of v3, v1, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;

    if-eqz v3, :cond_2e

    .line 7
    move-object v4, v1

    check-cast v4, Lcom/facebook/react/views/text/ReactBaseTextShadowNode;

    move-object v5, p1

    move-object v6, p2

    move v7, p3

    move v8, p4

    move-object v9, p5

    invoke-static/range {v4 .. v9}, Liyegoroff/RNTextGradient/RNShadowTextGradient;->buildSpannedGradientFromTextCSSNode(Lcom/facebook/react/views/text/ReactBaseTextShadowNode;Landroid/text/SpannableStringBuilder;Ljava/util/List;FFLandroid/text/Layout;)V

    goto :goto_3f

    .line 8
    :cond_2e
    instance-of v3, v1, Lcom/facebook/react/views/text/ReactTextInlineImageShadowNode;

    if-eqz v3, :cond_3f

    .line 9
    const-class v3, Lcom/facebook/react/views/text/ReactTextShadowNode;

    const-string v4, "INLINE_IMAGE_PLACEHOLDER"

    .line 10
    invoke-static {p0, v4, v3}, Liyegoroff/RNTextGradient/ReflectUtils;->getFieldValue(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Ljava/lang/String;

    .line 11
    invoke-virtual {p1, v3}, Landroid/text/SpannableStringBuilder;->append(Ljava/lang/CharSequence;)Landroid/text/SpannableStringBuilder;

    .line 12
    :cond_3f
    :goto_3f
    invoke-interface {v1}, Lcom/facebook/react/uimanager/ReactShadowNode;->markUpdateSeen()V

    add-int/lit8 v0, v0, 0x1

    goto :goto_5

    .line 13
    :cond_45
    invoke-virtual {p1}, Landroid/text/SpannableStringBuilder;->length()I

    move-result v3

    if-lt v3, v2, :cond_5d

    .line 14
    instance-of v0, p0, Liyegoroff/RNTextGradient/RNShadowTextGradient;

    if-eqz v0, :cond_5d

    .line 15
    move-object v0, p0

    check-cast v0, Liyegoroff/RNTextGradient/RNShadowTextGradient;

    move-object v1, p1

    move v4, p3

    move v5, p4

    move-object v6, p5

    .line 16
    invoke-virtual/range {v0 .. v6}, Liyegoroff/RNTextGradient/RNShadowTextGradient;->createSpan(Landroid/text/SpannableStringBuilder;IIFFLandroid/text/Layout;)Liyegoroff/RNTextGradient/RNSetGradientSpanOperation;

    move-result-object p0

    .line 17
    invoke-interface {p2, p0}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    :cond_5d
    return-void
.end method

.method private getSpannable()Landroid/text/Spannable;
    .registers 3

    const-class v0, Lcom/facebook/react/views/text/ReactTextShadowNode;

    const-string v1, "mPreparedSpannableText"

    invoke-static {p0, v1, v0}, Liyegoroff/RNTextGradient/ReflectUtils;->getFieldValue(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/text/Spannable;

    return-object v0
.end method

.method private resolveView(I)Landroid/view/View;
    .registers 5

    .line 1
    invoke-static {}, Lcom/facebook/react/bridge/UiThreadUtil;->assertOnUiThread()V

    .line 2
    iget-object v0, p0, Liyegoroff/RNTextGradient/RNShadowTextGradient;->mContext:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/Reference;->get()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/facebook/react/bridge/ReactApplicationContext;

    const/4 v1, 0x0

    if-eqz v0, :cond_2f

    .line 3
    const-class v2, Lcom/facebook/react/uimanager/UIManagerModule;

    invoke-virtual {v0, v2}, Lcom/facebook/react/bridge/ReactContext;->getNativeModule(Ljava/lang/Class;)Lcom/facebook/react/bridge/NativeModule;

    move-result-object v0

    check-cast v0, Lcom/facebook/react/uimanager/UIManagerModule;

    .line 4
    invoke-virtual {v0}, Lcom/facebook/react/uimanager/UIManagerModule;->getUIImplementation()Lcom/facebook/react/uimanager/UIImplementation;

    move-result-object v0

    const-string v2, "mOperationsQueue"

    .line 5
    invoke-static {v0, v2, v1}, Liyegoroff/RNTextGradient/ReflectUtils;->getFieldValue(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v0

    const-string v2, "mNativeViewHierarchyManager"

    .line 6
    invoke-static {v0, v2, v1}, Liyegoroff/RNTextGradient/ReflectUtils;->getFieldValue(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/facebook/react/uimanager/NativeViewHierarchyManager;

    if-eqz v0, :cond_2f

    .line 7
    invoke-virtual {v0, p1}, Lcom/facebook/react/uimanager/NativeViewHierarchyManager;->resolveView(I)Landroid/view/View;

    move-result-object p1

    return-object p1

    :cond_2f
    return-object v1
.end method

.method private static spannableWithGradient(Landroid/text/Spannable;Liyegoroff/RNTextGradient/RNShadowTextGradient;FFLandroid/text/Layout;)Landroid/text/Spannable;
    .registers 12

    .line 1
    new-instance v6, Ljava/util/ArrayList;

    invoke-direct {v6}, Ljava/util/ArrayList;-><init>()V

    .line 2
    new-instance v1, Landroid/text/SpannableStringBuilder;

    invoke-direct {v1}, Landroid/text/SpannableStringBuilder;-><init>()V

    move-object v0, p1

    move-object v2, v6

    move v3, p2

    move v4, p3

    move-object v5, p4

    .line 3
    invoke-static/range {v0 .. v5}, Liyegoroff/RNTextGradient/RNShadowTextGradient;->buildSpannedGradientFromTextCSSNode(Lcom/facebook/react/views/text/ReactBaseTextShadowNode;Landroid/text/SpannableStringBuilder;Ljava/util/List;FFLandroid/text/Layout;)V

    .line 4
    invoke-virtual {v6}, Ljava/util/ArrayList;->size()I

    move-result p1

    add-int/lit8 p1, p1, -0x1

    :goto_18
    if-ltz p1, :cond_29

    .line 5
    invoke-virtual {v6, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object p2

    check-cast p2, Liyegoroff/RNTextGradient/RNSetGradientSpanOperation;

    move-object p3, p0

    check-cast p3, Landroid/text/SpannableStringBuilder;

    invoke-virtual {p2, p3}, Liyegoroff/RNTextGradient/RNSetGradientSpanOperation;->execute(Landroid/text/SpannableStringBuilder;)V

    add-int/lit8 p1, p1, -0x1

    goto :goto_18

    :cond_29
    return-object p0
.end method

.method private updatedSpannable(Landroid/text/Layout;)Landroid/text/Spannable;
    .registers 5

    .line 1
    invoke-direct {p0}, Liyegoroff/RNTextGradient/RNShadowTextGradient;->getSpannable()Landroid/text/Spannable;

    move-result-object v0

    .line 2
    invoke-virtual {p0}, Lcom/facebook/react/uimanager/ReactShadowNodeImpl;->getLayoutWidth()F

    move-result v1

    .line 3
    invoke-virtual {p0}, Lcom/facebook/react/uimanager/ReactShadowNodeImpl;->getLayoutHeight()F

    move-result v2

    .line 4
    invoke-static {v0, p0, v1, v2, p1}, Liyegoroff/RNTextGradient/RNShadowTextGradient;->spannableWithGradient(Landroid/text/Spannable;Liyegoroff/RNTextGradient/RNShadowTextGradient;FFLandroid/text/Layout;)Landroid/text/Spannable;

    move-result-object p1

    return-object p1
.end method


# virtual methods
.method public abstract createSpan(Landroid/text/SpannableStringBuilder;IIFFLandroid/text/Layout;)Liyegoroff/RNTextGradient/RNSetGradientSpanOperation;
.end method

.method public dispatchUpdates(FFLcom/facebook/react/uimanager/UIViewOperationQueue;Lcom/facebook/react/uimanager/NativeViewHierarchyOptimizer;)Z
    .registers 5

    .line 1
    invoke-super {p0, p1, p2, p3, p4}, Lcom/facebook/react/uimanager/ReactShadowNodeImpl;->dispatchUpdates(FFLcom/facebook/react/uimanager/UIViewOperationQueue;Lcom/facebook/react/uimanager/NativeViewHierarchyOptimizer;)Z

    move-result p1

    if-eqz p1, :cond_9

    .line 2
    invoke-virtual {p0}, Lcom/facebook/react/views/text/ReactTextShadowNode;->markUpdated()V

    :cond_9
    return p1
.end method

.method public onCollectExtraUpdates(Lcom/facebook/react/uimanager/UIViewOperationQueue;)V
    .registers 3

    .line 1
    new-instance v0, Liyegoroff/RNTextGradient/RNShadowTextGradient$1;

    invoke-direct {v0, p0, p0}, Liyegoroff/RNTextGradient/RNShadowTextGradient$1;-><init>(Liyegoroff/RNTextGradient/RNShadowTextGradient;Liyegoroff/RNTextGradient/RNShadowTextGradient;)V

    invoke-virtual {p1, v0}, Lcom/facebook/react/uimanager/UIViewOperationQueue;->enqueueUIBlock(Lcom/facebook/react/uimanager/UIBlock;)V

    .line 2
    invoke-super {p0, p1}, Lcom/facebook/react/views/text/ReactTextShadowNode;->onCollectExtraUpdates(Lcom/facebook/react/uimanager/UIViewOperationQueue;)V

    return-void
.end method

.method public setColors(Lcom/facebook/react/bridge/ReadableArray;)V
    .registers 6
    .annotation runtime Lcom/facebook/react/uimanager/annotations/ReactProp;
        name = "colors"
    .end annotation

    if-eqz p1, :cond_17

    .line 1
    invoke-interface {p1}, Lcom/facebook/react/bridge/ReadableArray;->size()I

    move-result v0

    new-array v1, v0, [I

    const/4 v2, 0x0

    :goto_9
    if-ge v2, v0, :cond_14

    .line 2
    invoke-interface {p1, v2}, Lcom/facebook/react/bridge/ReadableArray;->getInt(I)I

    move-result v3

    aput v3, v1, v2

    add-int/lit8 v2, v2, 0x1

    goto :goto_9

    .line 3
    :cond_14
    iput-object v1, p0, Liyegoroff/RNTextGradient/RNShadowTextGradient;->mColors:[I

    goto :goto_1a

    :cond_17
    const/4 p1, 0x0

    .line 4
    iput-object p1, p0, Liyegoroff/RNTextGradient/RNShadowTextGradient;->mColors:[I

    .line 5
    :goto_1a
    invoke-virtual {p0}, Lcom/facebook/react/views/text/ReactTextShadowNode;->markUpdated()V

    return-void
.end method

.method public setLocations(Lcom/facebook/react/bridge/ReadableArray;)V
    .registers 7
    .annotation runtime Lcom/facebook/react/uimanager/annotations/ReactProp;
        name = "locations"
    .end annotation

    if-eqz p1, :cond_18

    .line 1
    invoke-interface {p1}, Lcom/facebook/react/bridge/ReadableArray;->size()I

    move-result v0

    new-array v1, v0, [F

    const/4 v2, 0x0

    :goto_9
    if-ge v2, v0, :cond_15

    .line 2
    invoke-interface {p1, v2}, Lcom/facebook/react/bridge/ReadableArray;->getDouble(I)D

    move-result-wide v3

    double-to-float v3, v3

    aput v3, v1, v2

    add-int/lit8 v2, v2, 0x1

    goto :goto_9

    .line 3
    :cond_15
    iput-object v1, p0, Liyegoroff/RNTextGradient/RNShadowTextGradient;->mLocations:[F

    goto :goto_1b

    :cond_18
    const/4 p1, 0x0

    .line 4
    iput-object p1, p0, Liyegoroff/RNTextGradient/RNShadowTextGradient;->mLocations:[F

    .line 5
    :goto_1b
    invoke-virtual {p0}, Lcom/facebook/react/views/text/ReactTextShadowNode;->markUpdated()V

    return-void
.end method

.method public setUseViewFrame(Z)V
    .registers 2
    .annotation runtime Lcom/facebook/react/uimanager/annotations/ReactProp;
        name = "useViewFrame"
    .end annotation

    .line 1
    iput-boolean p1, p0, Liyegoroff/RNTextGradient/RNShadowTextGradient;->mUseViewFrame:Z

    .line 2
    invoke-virtual {p0}, Lcom/facebook/react/views/text/ReactTextShadowNode;->markUpdated()V

    return-void
.end method