apkfuckery/com.discord/smali/com/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener.smali

472 lines
14 KiB
Smali
Raw Normal View History

2019-05-04 02:59:52 +00:00
.class final Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;
.super Ljava/lang/Object;
.source "LinkifiedTextView.kt"
# interfaces
.implements Landroid/view/View$OnTouchListener;
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lcom/discord/utilities/view/text/LinkifiedTextView;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x18
name = "ClickableSpanOnTouchListener"
.end annotation
# instance fields
.field private isClickHandled:Ljava/util/concurrent/atomic/AtomicBoolean;
.field private job:Ljava/util/concurrent/atomic/AtomicReference;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/concurrent/atomic/AtomicReference<",
"Lkotlinx/coroutines/Job;",
">;"
}
.end annotation
.end field
.field private final longPressDelayInMs:J
.field private final onURLSpanClicked:Lkotlin/jvm/functions/Function2;
.annotation system Ldalvik/annotation/Signature;
value = {
"Lkotlin/jvm/functions/Function2<",
"Landroid/view/View;",
"Ljava/lang/String;",
"Lkotlin/Unit;",
">;"
}
.end annotation
.end field
# direct methods
.method public constructor <init>(JLkotlin/jvm/functions/Function2;)V
.locals 0
.annotation system Ldalvik/annotation/Signature;
value = {
"(J",
"Lkotlin/jvm/functions/Function2<",
"-",
"Landroid/view/View;",
"-",
"Ljava/lang/String;",
"Lkotlin/Unit;",
">;)V"
}
.end annotation
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-wide p1, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->longPressDelayInMs:J
iput-object p3, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->onURLSpanClicked:Lkotlin/jvm/functions/Function2;
new-instance p1, Ljava/util/concurrent/atomic/AtomicBoolean;
const/4 p2, 0x0
invoke-direct {p1, p2}, Ljava/util/concurrent/atomic/AtomicBoolean;-><init>(Z)V
iput-object p1, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->isClickHandled:Ljava/util/concurrent/atomic/AtomicBoolean;
new-instance p1, Ljava/util/concurrent/atomic/AtomicReference;
invoke-direct {p1}, Ljava/util/concurrent/atomic/AtomicReference;-><init>()V
iput-object p1, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->job:Ljava/util/concurrent/atomic/AtomicReference;
return-void
.end method
.method public synthetic constructor <init>(JLkotlin/jvm/functions/Function2;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
.locals 0
and-int/lit8 p4, p4, 0x1
if-eqz p4, :cond_0
const-wide/16 p1, 0x1f4
:cond_0
invoke-direct {p0, p1, p2, p3}, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;-><init>(JLkotlin/jvm/functions/Function2;)V
return-void
.end method
.method public static final synthetic access$getJob$p(Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;)Ljava/util/concurrent/atomic/AtomicReference;
.locals 0
iget-object p0, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->job:Ljava/util/concurrent/atomic/AtomicReference;
return-object p0
.end method
.method public static final synthetic access$getLongPressDelayInMs$p(Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;)J
.locals 2
iget-wide v0, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->longPressDelayInMs:J
return-wide v0
.end method
.method public static final synthetic access$isClickHandled$p(Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;)Ljava/util/concurrent/atomic/AtomicBoolean;
.locals 0
iget-object p0, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->isClickHandled:Ljava/util/concurrent/atomic/AtomicBoolean;
return-object p0
.end method
.method public static final synthetic access$setClickHandled$p(Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;Ljava/util/concurrent/atomic/AtomicBoolean;)V
.locals 0
iput-object p1, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->isClickHandled:Ljava/util/concurrent/atomic/AtomicBoolean;
return-void
.end method
.method public static final synthetic access$setJob$p(Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;Ljava/util/concurrent/atomic/AtomicReference;)V
.locals 0
iput-object p1, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->job:Ljava/util/concurrent/atomic/AtomicReference;
return-void
.end method
.method private final getTouchedClickableSpans(Landroid/widget/TextView;Landroid/view/MotionEvent;)[Landroid/text/style/ClickableSpan;
.locals 3
invoke-virtual {p1}, Landroid/widget/TextView;->getText()Ljava/lang/CharSequence;
move-result-object v0
instance-of v1, v0, Landroid/text/Spanned;
if-nez v1, :cond_0
const/4 v0, 0x0
:cond_0
check-cast v0, Landroid/text/Spanned;
if-nez v0, :cond_1
const/4 p1, 0x0
new-array p1, p1, [Landroid/text/style/ClickableSpan;
return-object p1
:cond_1
invoke-virtual {p2}, Landroid/view/MotionEvent;->getX()F
move-result v1
float-to-int v1, v1
invoke-virtual {p1}, Landroid/widget/TextView;->getTotalPaddingLeft()I
move-result v2
sub-int/2addr v1, v2
invoke-virtual {p1}, Landroid/widget/TextView;->getScrollX()I
move-result v2
add-int/2addr v1, v2
invoke-virtual {p2}, Landroid/view/MotionEvent;->getY()F
move-result p2
float-to-int p2, p2
invoke-virtual {p1}, Landroid/widget/TextView;->getTotalPaddingTop()I
move-result v2
sub-int/2addr p2, v2
invoke-virtual {p1}, Landroid/widget/TextView;->getScrollY()I
move-result v2
add-int/2addr p2, v2
invoke-virtual {p1}, Landroid/widget/TextView;->getLayout()Landroid/text/Layout;
move-result-object v2
invoke-virtual {v2, p2}, Landroid/text/Layout;->getLineForVertical(I)I
move-result p2
invoke-virtual {p1}, Landroid/widget/TextView;->getLayout()Landroid/text/Layout;
move-result-object p1
int-to-float v1, v1
invoke-virtual {p1, p2, v1}, Landroid/text/Layout;->getOffsetForHorizontal(IF)I
move-result p1
const-class p2, Landroid/text/style/ClickableSpan;
invoke-interface {v0, p1, p1, p2}, Landroid/text/Spanned;->getSpans(IILjava/lang/Class;)[Ljava/lang/Object;
move-result-object p1
const-string p2, "spanned.getSpans(off, of\u2026lickableSpan::class.java)"
2019-05-22 23:20:16 +00:00
invoke-static {p1, p2}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
2019-05-04 02:59:52 +00:00
check-cast p1, [Landroid/text/style/ClickableSpan;
return-object p1
.end method
# virtual methods
.method public final onTouch(Landroid/view/View;Landroid/view/MotionEvent;)Z
.locals 5
const-string v0, "view"
2019-05-22 23:20:16 +00:00
invoke-static {p1, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
2019-05-04 02:59:52 +00:00
const-string v0, "event"
2019-05-22 23:20:16 +00:00
invoke-static {p2, v0}, Lkotlin/jvm/internal/k;->h(Ljava/lang/Object;Ljava/lang/String;)V
2019-05-04 02:59:52 +00:00
instance-of v0, p1, Landroid/widget/TextView;
const/4 v1, 0x0
if-nez v0, :cond_0
move-object v0, v1
goto :goto_0
:cond_0
move-object v0, p1
:goto_0
check-cast v0, Landroid/widget/TextView;
if-eqz v0, :cond_1
invoke-direct {p0, v0, p2}, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->getTouchedClickableSpans(Landroid/widget/TextView;Landroid/view/MotionEvent;)[Landroid/text/style/ClickableSpan;
move-result-object v0
if-eqz v0, :cond_1
invoke-static {v0}, Lkotlin/a/g;->d([Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/text/style/ClickableSpan;
goto :goto_1
:cond_1
move-object v0, v1
:goto_1
const/4 v2, 0x0
if-nez v0, :cond_3
iget-object p1, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->job:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {p1}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object p1
check-cast p1, Lkotlinx/coroutines/Job;
if-eqz p1, :cond_2
invoke-interface {p1, v1}, Lkotlinx/coroutines/Job;->a(Ljava/util/concurrent/CancellationException;)V
:cond_2
return v2
:cond_3
invoke-virtual {p2}, Landroid/view/MotionEvent;->getAction()I
move-result p2
const/4 v3, 0x1
if-eqz p2, :cond_b
if-eq p2, v3, :cond_6
const/4 p1, 0x3
if-eq p2, p1, :cond_4
return v2
:cond_4
iget-object p1, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->job:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {p1}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object p1
check-cast p1, Lkotlinx/coroutines/Job;
if-eqz p1, :cond_5
invoke-interface {p1, v1}, Lkotlinx/coroutines/Job;->a(Ljava/util/concurrent/CancellationException;)V
:cond_5
return v3
:cond_6
iget-object p2, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->job:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {p2}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object p2
check-cast p2, Lkotlinx/coroutines/Job;
if-eqz p2, :cond_7
invoke-interface {p2, v1}, Lkotlinx/coroutines/Job;->a(Ljava/util/concurrent/CancellationException;)V
:cond_7
iget-object p2, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->isClickHandled:Ljava/util/concurrent/atomic/AtomicBoolean;
invoke-virtual {p2, v3}, Ljava/util/concurrent/atomic/AtomicBoolean;->getAndSet(Z)Z
move-result p2
if-nez p2, :cond_a
instance-of p2, v0, Landroid/text/style/URLSpan;
if-eqz p2, :cond_9
iget-object p2, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->onURLSpanClicked:Lkotlin/jvm/functions/Function2;
if-eqz p2, :cond_8
move-object v1, v0
check-cast v1, Landroid/text/style/URLSpan;
invoke-virtual {v1}, Landroid/text/style/URLSpan;->getURL()Ljava/lang/String;
move-result-object v1
const-string v2, "clickableSpan.url"
2019-05-22 23:20:16 +00:00
invoke-static {v1, v2}, Lkotlin/jvm/internal/k;->g(Ljava/lang/Object;Ljava/lang/String;)V
2019-05-04 02:59:52 +00:00
invoke-interface {p2, p1, v1}, Lkotlin/jvm/functions/Function2;->invoke(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p2
check-cast p2, Lkotlin/Unit;
if-nez p2, :cond_a
:cond_8
invoke-virtual {v0, p1}, Landroid/text/style/ClickableSpan;->onClick(Landroid/view/View;)V
2019-05-28 22:16:26 +00:00
sget-object p1, Lkotlin/Unit;->beQ:Lkotlin/Unit;
2019-05-04 02:59:52 +00:00
goto :goto_2
:cond_9
invoke-virtual {v0, p1}, Landroid/text/style/ClickableSpan;->onClick(Landroid/view/View;)V
:cond_a
:goto_2
return v3
:cond_b
iget-object p2, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->isClickHandled:Ljava/util/concurrent/atomic/AtomicBoolean;
invoke-virtual {p2, v2}, Ljava/util/concurrent/atomic/AtomicBoolean;->set(Z)V
iget-object p2, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->job:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {p2}, Ljava/util/concurrent/atomic/AtomicReference;->get()Ljava/lang/Object;
move-result-object p2
check-cast p2, Lkotlinx/coroutines/Job;
if-eqz p2, :cond_c
invoke-interface {p2, v1}, Lkotlinx/coroutines/Job;->a(Ljava/util/concurrent/CancellationException;)V
:cond_c
instance-of p2, v0, Lcom/discord/utilities/spans/ClickableSpan;
if-eqz p2, :cond_d
new-instance p2, Ljava/lang/ref/WeakReference;
invoke-direct {p2, p1}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V
2019-05-28 22:16:26 +00:00
sget-object p1, Lkotlinx/coroutines/aw;->bir:Lkotlinx/coroutines/aw;
2019-05-04 02:59:52 +00:00
check-cast p1, Lkotlinx/coroutines/CoroutineScope;
2019-05-28 22:16:26 +00:00
invoke-static {}, Lkotlinx/coroutines/ao;->Ao()Lkotlinx/coroutines/y;
2019-05-04 02:59:52 +00:00
move-result-object v2
check-cast v2, Lkotlin/coroutines/CoroutineContext;
new-instance v4, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener$onTouch$newJob$1;
invoke-direct {v4, p0, p2, v0, v1}, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener$onTouch$newJob$1;-><init>(Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;Ljava/lang/ref/WeakReference;Landroid/text/style/ClickableSpan;Lkotlin/coroutines/Continuation;)V
check-cast v4, Lkotlin/jvm/functions/Function2;
const/4 p2, 0x2
invoke-static {p1, v2, v4, p2}, Lkotlinx/coroutines/d;->a(Lkotlinx/coroutines/CoroutineScope;Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function2;I)Lkotlinx/coroutines/Job;
move-result-object p1
new-instance p2, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener$onTouch$$inlined$apply$lambda$1;
invoke-direct {p2, p1, p0}, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener$onTouch$$inlined$apply$lambda$1;-><init>(Lkotlinx/coroutines/Job;Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;)V
check-cast p2, Lkotlin/jvm/functions/Function1;
invoke-interface {p1, p2}, Lkotlinx/coroutines/Job;->i(Lkotlin/jvm/functions/Function1;)Lkotlinx/coroutines/ap;
iget-object p2, p0, Lcom/discord/utilities/view/text/LinkifiedTextView$ClickableSpanOnTouchListener;->job:Ljava/util/concurrent/atomic/AtomicReference;
invoke-virtual {p2, p1}, Ljava/util/concurrent/atomic/AtomicReference;->getAndSet(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Lkotlinx/coroutines/Job;
if-eqz p1, :cond_d
invoke-interface {p1, v1}, Lkotlinx/coroutines/Job;->a(Ljava/util/concurrent/CancellationException;)V
:cond_d
return v3
.end method