193 lines
3.5 KiB
Smali
193 lines
3.5 KiB
Smali
.class public Lcom/moji/mjweather/ipc/utils/EmojiUtils;
|
|
.super Ljava/lang/Object;
|
|
.source "EmojiUtils.java"
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
.line 19
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static a(Landroid/content/Context;Ljava/lang/String;)Landroid/text/SpannableString;
|
|
.locals 5
|
|
|
|
.line 41
|
|
invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
.line 42
|
|
new-instance p0, Landroid/text/SpannableString;
|
|
|
|
const-string p1, ""
|
|
|
|
invoke-direct {p0, p1}, Landroid/text/SpannableString;-><init>(Ljava/lang/CharSequence;)V
|
|
|
|
return-object p0
|
|
|
|
.line 45
|
|
:cond_0
|
|
new-instance v0, Landroid/text/SpannableString;
|
|
|
|
invoke-direct {v0, p1}, Landroid/text/SpannableString;-><init>(Ljava/lang/CharSequence;)V
|
|
|
|
const-string v1, "\\[[^]]{2,4}\\]"
|
|
|
|
.line 47
|
|
invoke-static {v1}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;
|
|
|
|
move-result-object v1
|
|
|
|
.line 48
|
|
invoke-virtual {v1, p1}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
|
|
|
|
move-result-object p1
|
|
|
|
.line 49
|
|
:cond_1
|
|
:goto_0
|
|
invoke-virtual {p1}, Ljava/util/regex/Matcher;->find()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_2
|
|
|
|
.line 50
|
|
invoke-static {}, Lcom/moji/tool/SnsMgr;->a()Lcom/moji/tool/SnsMgr;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {p1}, Ljava/util/regex/Matcher;->group()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v1, v2}, Lcom/moji/tool/SnsMgr;->a(Ljava/lang/String;)Landroid/graphics/Bitmap;
|
|
|
|
move-result-object v1
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
.line 52
|
|
new-instance v2, Landroid/text/style/ImageSpan;
|
|
|
|
invoke-direct {v2, p0, v1}, Landroid/text/style/ImageSpan;-><init>(Landroid/content/Context;Landroid/graphics/Bitmap;)V
|
|
|
|
.line 53
|
|
invoke-virtual {p1}, Ljava/util/regex/Matcher;->start()I
|
|
|
|
move-result v1
|
|
|
|
invoke-virtual {p1}, Ljava/util/regex/Matcher;->end()I
|
|
|
|
move-result v3
|
|
|
|
const/16 v4, 0x21
|
|
|
|
invoke-virtual {v0, v2, v1, v3, v4}, Landroid/text/SpannableString;->setSpan(Ljava/lang/Object;III)V
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static a(C)Z
|
|
.locals 2
|
|
|
|
const/4 v0, 0x1
|
|
|
|
if-eqz p0, :cond_2
|
|
|
|
const/16 v1, 0x9
|
|
|
|
if-eq p0, v1, :cond_2
|
|
|
|
const/16 v1, 0xa
|
|
|
|
if-eq p0, v1, :cond_2
|
|
|
|
const/16 v1, 0xd
|
|
|
|
if-eq p0, v1, :cond_2
|
|
|
|
const/16 v1, 0x20
|
|
|
|
if-lt p0, v1, :cond_0
|
|
|
|
const v1, 0xd7ff
|
|
|
|
if-le p0, v1, :cond_2
|
|
|
|
:cond_0
|
|
const v1, 0xe000
|
|
|
|
if-lt p0, v1, :cond_1
|
|
|
|
const v1, 0xfffd
|
|
|
|
if-gt p0, v1, :cond_1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
const/4 p0, 0x0
|
|
|
|
goto :goto_1
|
|
|
|
:cond_2
|
|
:goto_0
|
|
const/4 p0, 0x1
|
|
|
|
:goto_1
|
|
xor-int/2addr p0, v0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static a(Ljava/lang/String;)Z
|
|
.locals 4
|
|
|
|
.line 21
|
|
invoke-virtual {p0}, Ljava/lang/String;->length()I
|
|
|
|
move-result v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
const/4 v2, 0x0
|
|
|
|
:goto_0
|
|
if-ge v2, v0, :cond_1
|
|
|
|
.line 23
|
|
invoke-virtual {p0, v2}, Ljava/lang/String;->charAt(I)C
|
|
|
|
move-result v3
|
|
|
|
.line 24
|
|
invoke-static {v3}, Lcom/moji/mjweather/ipc/utils/EmojiUtils;->a(C)Z
|
|
|
|
move-result v3
|
|
|
|
if-eqz v3, :cond_0
|
|
|
|
const/4 p0, 0x1
|
|
|
|
return p0
|
|
|
|
:cond_0
|
|
add-int/lit8 v2, v2, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
return v1
|
|
.end method
|