961 lines
26 KiB
Smali
961 lines
26 KiB
Smali
.class public Lcom/discord/widgets/chat/input/WidgetChatInputMentions;
|
|
.super Ljava/lang/Object;
|
|
.source "WidgetChatInputMentions.java"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/discord/widgets/chat/input/WidgetChatInputMentions$OnTagsMatched;,
|
|
Lcom/discord/widgets/chat/input/WidgetChatInputMentions$TagObject;
|
|
}
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T::",
|
|
"Lcom/discord/widgets/chat/input/WidgetChatInputMentions$TagObject;",
|
|
">",
|
|
"Ljava/lang/Object;"
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field public static TAG_SYMBOLS_PATTERN:Ljava/util/regex/Pattern; = null
|
|
|
|
.field public static final TAG_SYMBOLS_PERF_LIMIT:I = 0x7d0
|
|
|
|
.field public static startIdentifiers:Ljava/util/Collection;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/Collection<",
|
|
"Ljava/lang/Character;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# instance fields
|
|
.field public final editText:Landroid/widget/EditText;
|
|
|
|
.field public final onPartialToken:Lrx/subjects/Subject;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lrx/subjects/Subject<",
|
|
"Ljava/lang/String;",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field public onTagsMatched:Lcom/discord/widgets/chat/input/WidgetChatInputMentions$OnTagsMatched;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lcom/discord/widgets/chat/input/WidgetChatInputMentions$OnTagsMatched<",
|
|
"TT;>;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field public tags:Ljava/util/Collection;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/Collection<",
|
|
"TT;>;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
const-string v0, "^(.*\\s)?[@#:].*"
|
|
|
|
invoke-static {v0}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->TAG_SYMBOLS_PATTERN:Ljava/util/regex/Pattern;
|
|
|
|
invoke-static {}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->getDefaultStartIdentifiers()Ljava/util/Collection;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->startIdentifiers:Ljava/util/Collection;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Landroid/widget/EditText;)V
|
|
.locals 4
|
|
.param p1 # Landroid/widget/EditText;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
new-instance v0, Lrx/subjects/SerializedSubject;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-static {v1}, Lrx/subjects/BehaviorSubject;->g0(Ljava/lang/Object;)Lrx/subjects/BehaviorSubject;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-direct {v0, v2}, Lrx/subjects/SerializedSubject;-><init>(Lrx/subjects/Subject;)V
|
|
|
|
iput-object v0, p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->onPartialToken:Lrx/subjects/Subject;
|
|
|
|
new-instance v0, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
iput-object v0, p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->tags:Ljava/util/Collection;
|
|
|
|
iput-object p1, p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->editText:Landroid/widget/EditText;
|
|
|
|
new-instance v0, Lcom/discord/utilities/view/text/TextWatcher;
|
|
|
|
new-instance v2, Lf/a/o/b/a/v;
|
|
|
|
invoke-direct {v2, p0, p1}, Lf/a/o/b/a/v;-><init>(Lcom/discord/widgets/chat/input/WidgetChatInputMentions;Landroid/widget/EditText;)V
|
|
|
|
invoke-direct {v0, v1, v1, v2}, Lcom/discord/utilities/view/text/TextWatcher;-><init>(Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function1;)V
|
|
|
|
invoke-virtual {p1, v0}, Landroid/widget/EditText;->addTextChangedListener(Landroid/text/TextWatcher;)V
|
|
|
|
iget-object v0, p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->onPartialToken:Lrx/subjects/Subject;
|
|
|
|
invoke-static {}, Lr0/p/a;->a()Lrx/Scheduler;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, v1}, Lrx/Observable;->S(Lrx/Scheduler;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
sget-object v1, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
|
|
|
|
const-wide/16 v2, 0xc8
|
|
|
|
invoke-virtual {v0, v2, v3, v1}, Lrx/Observable;->o(JLjava/util/concurrent/TimeUnit;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
new-instance v1, Lf/a/o/b/a/w;
|
|
|
|
invoke-direct {v1, p0}, Lf/a/o/b/a/w;-><init>(Lcom/discord/widgets/chat/input/WidgetChatInputMentions;)V
|
|
|
|
invoke-virtual {v0, v1}, Lrx/Observable;->D(Lr0/k/b;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Lrx/Observable;->I()Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Lrx/Observable;->q()Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {}, Lr0/j/b/a;->a()Lrx/Scheduler;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, v1}, Lrx/Observable;->G(Lrx/Scheduler;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
new-instance v1, Lf/a/o/b/a/u;
|
|
|
|
invoke-direct {v1, p0}, Lf/a/o/b/a/u;-><init>(Lcom/discord/widgets/chat/input/WidgetChatInputMentions;)V
|
|
|
|
invoke-virtual {v0, v1}, Lrx/Observable;->Q(Lrx/functions/Action1;)Lrx/Subscription;
|
|
|
|
invoke-virtual {p0, p1}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->processMentions(Landroid/widget/EditText;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static applyBoldSpan(Landroid/text/Spannable;II)V
|
|
.locals 2
|
|
|
|
new-instance v0, Landroid/text/style/StyleSpan;
|
|
|
|
const/4 v1, 0x1
|
|
|
|
invoke-direct {v0, v1}, Landroid/text/style/StyleSpan;-><init>(I)V
|
|
|
|
const/16 v1, 0x21
|
|
|
|
invoke-interface {p0, v0, p1, p2, v1}, Landroid/text/Spannable;->setSpan(Ljava/lang/Object;III)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private applySpan(Landroid/text/Spannable;)V
|
|
.locals 5
|
|
|
|
invoke-static {p1}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->removeSpans(Landroid/text/Spannable;)V
|
|
|
|
iget-object v0, p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->tags:Ljava/util/Collection;
|
|
|
|
invoke-interface {v0}, Ljava/util/Collection;->size()I
|
|
|
|
move-result v0
|
|
|
|
const/16 v1, 0x7d0
|
|
|
|
if-le v0, v1, :cond_0
|
|
|
|
sget-object v0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->TAG_SYMBOLS_PATTERN:Ljava/util/regex/Pattern;
|
|
|
|
invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, v1}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Ljava/util/regex/Matcher;->matches()Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
return-void
|
|
|
|
:cond_0
|
|
iget-object v0, p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->tags:Ljava/util/Collection;
|
|
|
|
invoke-interface {v0}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v0
|
|
|
|
:cond_1
|
|
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_2
|
|
|
|
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Lcom/discord/widgets/chat/input/WidgetChatInputMentions$TagObject;
|
|
|
|
invoke-interface {v1}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions$TagObject;->getDisplayTag()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
const/4 v2, 0x0
|
|
|
|
:goto_0
|
|
invoke-direct {p0, p1, v2, v1}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->indexOfTag(Landroid/text/Spannable;ILjava/lang/String;)I
|
|
|
|
move-result v3
|
|
|
|
const/4 v4, -0x1
|
|
|
|
if-eq v3, v4, :cond_1
|
|
|
|
invoke-direct {p0, p1, v2, v1}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->indexOfTag(Landroid/text/Spannable;ILjava/lang/String;)I
|
|
|
|
move-result v2
|
|
|
|
invoke-virtual {v1}, Ljava/lang/String;->length()I
|
|
|
|
move-result v3
|
|
|
|
add-int/2addr v3, v2
|
|
|
|
invoke-static {p1, v2, v3}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->applyBoldSpan(Landroid/text/Spannable;II)V
|
|
|
|
add-int/lit8 v2, v2, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
return-void
|
|
.end method
|
|
|
|
.method public static getCursorPosition(Landroid/widget/EditText;)I
|
|
.locals 1
|
|
|
|
invoke-virtual {p0}, Landroid/widget/EditText;->getSelectionEnd()I
|
|
|
|
move-result v0
|
|
|
|
if-ltz v0, :cond_0
|
|
|
|
invoke-virtual {p0}, Landroid/widget/EditText;->getSelectionEnd()I
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
|
|
:cond_0
|
|
invoke-static {p0}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->toStringSafe(Landroid/widget/TextView;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/lang/String;->length()I
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static getDefaultStartIdentifiers()Ljava/util/Collection;
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Ljava/util/Collection<",
|
|
"Ljava/lang/Character;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
new-instance v0, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
const/16 v1, 0x2f
|
|
|
|
invoke-static {v1}, Ljava/lang/Character;->valueOf(C)Ljava/lang/Character;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method private getFormattedMention(Ljava/lang/String;)Ljava/lang/String;
|
|
.locals 2
|
|
.param p1 # Ljava/lang/String;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
|
|
invoke-virtual {p1}, Ljava/lang/String;->length()I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
if-le v0, v1, :cond_0
|
|
|
|
invoke-virtual {p1, v1}, Ljava/lang/String;->substring(I)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {}, Ljava/util/Locale;->getDefault()Ljava/util/Locale;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const-string p1, ""
|
|
|
|
:goto_0
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public static getPartialMentionToken(Landroid/widget/EditText;Ljava/util/Collection;)Ljava/lang/String;
|
|
.locals 6
|
|
.param p0 # Landroid/widget/EditText;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.param p1 # Ljava/util/Collection;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.annotation build Landroidx/annotation/Nullable;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Landroid/widget/EditText;",
|
|
"Ljava/util/Collection<",
|
|
"Ljava/lang/Character;",
|
|
">;)",
|
|
"Ljava/lang/String;"
|
|
}
|
|
.end annotation
|
|
|
|
invoke-static {p0}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->toStringSafe(Landroid/widget/TextView;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v1
|
|
|
|
const/4 v2, 0x0
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
return-object v2
|
|
|
|
:cond_0
|
|
invoke-static {p0}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->getCursorPosition(Landroid/widget/EditText;)I
|
|
|
|
move-result p0
|
|
|
|
invoke-static {v0, p0}, Lcom/discord/widgets/chat/input/MentionUtilsKt;->getSelectedToken(Ljava/lang/String;I)Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-static {v1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v3
|
|
|
|
if-eqz v3, :cond_1
|
|
|
|
return-object v2
|
|
|
|
:cond_1
|
|
invoke-static {}, Lcom/discord/widgets/chat/input/MentionUtilsKt;->getDEFAULT_LEADING_IDENTIFIERS()Ljava/util/Set;
|
|
|
|
move-result-object v3
|
|
|
|
const/4 v4, 0x0
|
|
|
|
invoke-virtual {v1, v4}, Ljava/lang/String;->charAt(I)C
|
|
|
|
move-result v5
|
|
|
|
invoke-static {v5}, Ljava/lang/Character;->valueOf(C)Ljava/lang/Character;
|
|
|
|
move-result-object v5
|
|
|
|
invoke-interface {v3, v5}, Ljava/util/Set;->contains(Ljava/lang/Object;)Z
|
|
|
|
move-result v3
|
|
|
|
if-eqz v3, :cond_2
|
|
|
|
return-object v1
|
|
|
|
:cond_2
|
|
invoke-virtual {v1}, Ljava/lang/String;->length()I
|
|
|
|
move-result v3
|
|
|
|
if-ne v3, p0, :cond_3
|
|
|
|
invoke-virtual {v0, v4}, Ljava/lang/String;->charAt(I)C
|
|
|
|
move-result p0
|
|
|
|
invoke-static {p0}, Ljava/lang/Character;->valueOf(C)Ljava/lang/Character;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-interface {p1, p0}, Ljava/util/Collection;->contains(Ljava/lang/Object;)Z
|
|
|
|
move-result p0
|
|
|
|
if-eqz p0, :cond_3
|
|
|
|
return-object v1
|
|
|
|
:cond_3
|
|
return-object v2
|
|
.end method
|
|
|
|
.method private getTags(Ljava/lang/String;Ljava/util/Collection;)Ljava/util/List;
|
|
.locals 6
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/lang/String;",
|
|
"Ljava/util/Collection<",
|
|
"TT;>;)",
|
|
"Ljava/util/List<",
|
|
"TT;>;"
|
|
}
|
|
.end annotation
|
|
|
|
new-instance v0, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
if-eqz p1, :cond_2
|
|
|
|
invoke-virtual {p1}, Ljava/lang/String;->length()I
|
|
|
|
move-result v1
|
|
|
|
if-lez v1, :cond_2
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-virtual {p1, v1}, Ljava/lang/String;->charAt(I)C
|
|
|
|
move-result v2
|
|
|
|
invoke-direct {p0, p1}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->getFormattedMention(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-interface {p2}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p2
|
|
|
|
:cond_0
|
|
:goto_0
|
|
invoke-interface {p2}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v3
|
|
|
|
if-eqz v3, :cond_2
|
|
|
|
invoke-interface {p2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v3
|
|
|
|
check-cast v3, Lcom/discord/widgets/chat/input/WidgetChatInputMentions$TagObject;
|
|
|
|
invoke-interface {v3}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions$TagObject;->getTag()Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v4, v1}, Ljava/lang/String;->charAt(I)C
|
|
|
|
move-result v5
|
|
|
|
if-eq v5, v2, :cond_1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
invoke-direct {p0, v4}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->getFormattedMention(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v4, p1}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v4
|
|
|
|
if-eqz v4, :cond_0
|
|
|
|
invoke-virtual {v0, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
return-object v0
|
|
.end method
|
|
|
|
.method private indexOfTag(Landroid/text/Spannable;ILjava/lang/String;)I
|
|
.locals 0
|
|
|
|
invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1, p3, p2}, Ljava/lang/String;->indexOf(Ljava/lang/String;I)I
|
|
|
|
move-result p1
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method public static insert(Landroid/text/Editable;Ljava/lang/CharSequence;II)V
|
|
.locals 6
|
|
|
|
invoke-static {p2, p3}, Ljava/lang/Math;->min(II)I
|
|
|
|
move-result v1
|
|
|
|
invoke-static {p2, p3}, Ljava/lang/Math;->max(II)I
|
|
|
|
move-result v2
|
|
|
|
invoke-interface {p1}, Ljava/lang/CharSequence;->length()I
|
|
|
|
move-result v5
|
|
|
|
const/4 v4, 0x0
|
|
|
|
move-object v0, p0
|
|
|
|
move-object v3, p1
|
|
|
|
invoke-interface/range {v0 .. v5}, Landroid/text/Editable;->replace(IILjava/lang/CharSequence;II)Landroid/text/Editable;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static removeSpans(Landroid/text/Spannable;)V
|
|
.locals 5
|
|
|
|
invoke-interface {p0}, Landroid/text/Spannable;->length()I
|
|
|
|
move-result v0
|
|
|
|
const-class v1, Ljava/lang/Object;
|
|
|
|
const/4 v2, 0x0
|
|
|
|
invoke-interface {p0, v2, v0, v1}, Landroid/text/Spannable;->getSpans(IILjava/lang/Class;)[Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
array-length v1, v0
|
|
|
|
:goto_0
|
|
if-ge v2, v1, :cond_1
|
|
|
|
aget-object v3, v0, v2
|
|
|
|
instance-of v4, v3, Landroid/text/style/CharacterStyle;
|
|
|
|
if-eqz v4, :cond_0
|
|
|
|
invoke-interface {p0, v3}, Landroid/text/Spannable;->removeSpan(Ljava/lang/Object;)V
|
|
|
|
:cond_0
|
|
add-int/lit8 v2, v2, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
return-void
|
|
.end method
|
|
|
|
.method public static setStartIdentifiers(Ljava/util/Collection;)V
|
|
.locals 0
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/Collection<",
|
|
"Ljava/lang/Character;",
|
|
">;)V"
|
|
}
|
|
.end annotation
|
|
|
|
sput-object p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->startIdentifiers:Ljava/util/Collection;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static toStringSafe(Landroid/widget/TextView;)Ljava/lang/String;
|
|
.locals 0
|
|
|
|
:try_start_0
|
|
invoke-virtual {p0}, Landroid/widget/TextView;->getText()Ljava/lang/CharSequence;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-interface {p0}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-object p0
|
|
|
|
:catch_0
|
|
const-string p0, ""
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public synthetic a(Landroid/widget/EditText;Landroid/text/Editable;)Lkotlin/Unit;
|
|
.locals 0
|
|
|
|
invoke-direct {p0, p2}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->applySpan(Landroid/text/Spannable;)V
|
|
|
|
invoke-virtual {p0, p1}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->processMentions(Landroid/widget/EditText;)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public synthetic b(Ljava/lang/String;)Ljava/util/List;
|
|
.locals 1
|
|
|
|
iget-object v0, p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->tags:Ljava/util/Collection;
|
|
|
|
invoke-direct {p0, p1, v0}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->getTags(Ljava/lang/String;Ljava/util/Collection;)Ljava/util/List;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public synthetic c(Ljava/util/List;)V
|
|
.locals 1
|
|
|
|
iget-object v0, p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->onTagsMatched:Lcom/discord/widgets/chat/input/WidgetChatInputMentions$OnTagsMatched;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
invoke-interface {v0, p1}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions$OnTagsMatched;->onTagsMatched(Ljava/util/List;)V
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public getMentions(Ljava/lang/String;)Ljava/util/List;
|
|
.locals 5
|
|
.param p1 # Ljava/lang/String;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/lang/String;",
|
|
")",
|
|
"Ljava/util/List<",
|
|
"TT;>;"
|
|
}
|
|
.end annotation
|
|
|
|
new-instance v0, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
iget-object v1, p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->tags:Ljava/util/Collection;
|
|
|
|
invoke-interface {v1}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v1
|
|
|
|
:cond_0
|
|
:goto_0
|
|
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v2
|
|
|
|
if-eqz v2, :cond_2
|
|
|
|
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
check-cast v2, Lcom/discord/widgets/chat/input/WidgetChatInputMentions$TagObject;
|
|
|
|
invoke-interface {v2}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions$TagObject;->getTagRegex()Ljava/util/regex/Pattern;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-interface {v2}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions$TagObject;->getDisplayTag()Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
if-nez v3, :cond_1
|
|
|
|
invoke-virtual {p1, v4}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v3
|
|
|
|
if-eqz v3, :cond_0
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
invoke-virtual {v3, p1}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v3}, Ljava/util/regex/Matcher;->find()Z
|
|
|
|
move-result v3
|
|
|
|
if-eqz v3, :cond_0
|
|
|
|
:goto_1
|
|
invoke-virtual {v0, v2}, Ljava/util/ArrayList;->contains(Ljava/lang/Object;)Z
|
|
|
|
move-result v3
|
|
|
|
if-nez v3, :cond_0
|
|
|
|
invoke-virtual {v0, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public getOnPartialToken()Lrx/subjects/Subject;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Lrx/subjects/Subject<",
|
|
"Ljava/lang/String;",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
iget-object v0, p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->onPartialToken:Lrx/subjects/Subject;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public getOnTagsMatched()Lcom/discord/widgets/chat/input/WidgetChatInputMentions$OnTagsMatched;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Lcom/discord/widgets/chat/input/WidgetChatInputMentions$OnTagsMatched<",
|
|
"TT;>;"
|
|
}
|
|
.end annotation
|
|
|
|
iget-object v0, p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->onTagsMatched:Lcom/discord/widgets/chat/input/WidgetChatInputMentions$OnTagsMatched;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public insertMention(Landroid/widget/EditText;Ljava/lang/String;)V
|
|
.locals 5
|
|
.param p2 # Ljava/lang/String;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
|
|
invoke-static {p1}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->getCursorPosition(Landroid/widget/EditText;)I
|
|
|
|
move-result v0
|
|
|
|
sget-object v1, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->startIdentifiers:Ljava/util/Collection;
|
|
|
|
invoke-static {p1, v1}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->getPartialMentionToken(Landroid/widget/EditText;Ljava/util/Collection;)Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
invoke-virtual {v1}, Ljava/lang/String;->length()I
|
|
|
|
move-result v1
|
|
|
|
sub-int v1, v0, v1
|
|
|
|
invoke-virtual {p1}, Landroid/widget/EditText;->getText()Landroid/text/Editable;
|
|
|
|
move-result-object v2
|
|
|
|
new-instance v3, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
invoke-virtual {v3, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const/16 v4, 0x20
|
|
|
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-static {v2, v3, v1, v0}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->insert(Landroid/text/Editable;Ljava/lang/CharSequence;II)V
|
|
|
|
invoke-virtual {p2}, Ljava/lang/String;->length()I
|
|
|
|
move-result p2
|
|
|
|
add-int/2addr p2, v1
|
|
|
|
add-int/lit8 p2, p2, 0x1
|
|
|
|
invoke-virtual {p1, p2}, Landroid/widget/EditText;->setSelection(I)V
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public processMentions(Landroid/widget/EditText;)V
|
|
.locals 1
|
|
.param p1 # Landroid/widget/EditText;
|
|
.annotation build Landroidx/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
|
|
sget-object v0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->startIdentifiers:Ljava/util/Collection;
|
|
|
|
invoke-static {p1, v0}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->getPartialMentionToken(Landroid/widget/EditText;Ljava/util/Collection;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
iget-object v0, p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->onPartialToken:Lrx/subjects/Subject;
|
|
|
|
invoke-interface {v0, p1}, Lr0/g;->onNext(Ljava/lang/Object;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setMentionsData(Ljava/util/Collection;)V
|
|
.locals 0
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/Collection<",
|
|
"TT;>;)V"
|
|
}
|
|
.end annotation
|
|
|
|
iput-object p1, p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->tags:Ljava/util/Collection;
|
|
|
|
iget-object p1, p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->editText:Landroid/widget/EditText;
|
|
|
|
invoke-virtual {p0, p1}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->processMentions(Landroid/widget/EditText;)V
|
|
|
|
iget-object p1, p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->editText:Landroid/widget/EditText;
|
|
|
|
invoke-virtual {p1}, Landroid/widget/EditText;->getText()Landroid/text/Editable;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p0, p1}, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->applySpan(Landroid/text/Spannable;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public setOnTagsMatched(Lcom/discord/widgets/chat/input/WidgetChatInputMentions$OnTagsMatched;)V
|
|
.locals 0
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/discord/widgets/chat/input/WidgetChatInputMentions$OnTagsMatched<",
|
|
"TT;>;)V"
|
|
}
|
|
.end annotation
|
|
|
|
iput-object p1, p0, Lcom/discord/widgets/chat/input/WidgetChatInputMentions;->onTagsMatched:Lcom/discord/widgets/chat/input/WidgetChatInputMentions$OnTagsMatched;
|
|
|
|
return-void
|
|
.end method
|