mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
517 lines
13 KiB
Smali
517 lines
13 KiB
Smali
.class public final Ltech/rabbit/common/utils/SPUtils;
|
|
.super Ljava/lang/Object;
|
|
.source "SPUtils.kt"
|
|
|
|
|
|
# annotations
|
|
.annotation runtime Lkotlin/Metadata;
|
|
d1 = {
|
|
"\u0000*\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0008\u0002\n\u0002\u0010\u000e\n\u0002\u0008\u0002\n\u0002\u0010\u0002\n\u0002\u0008\u0007\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\u0008\u0004\u0008\u00c6\u0002\u0018\u00002\u00020\u0001B\u0007\u0008\u0002\u00a2\u0006\u0002\u0010\u0002J\u0006\u0010\u0006\u001a\u00020\u0007J\u0008\u0010\u0008\u001a\u00020\u0007H\u0007J!\u0010\t\u001a\u0002H\n\"\u0004\u0008\u0000\u0010\n2\u0006\u0010\u000b\u001a\u00020\u00042\u0006\u0010\u000c\u001a\u00020\u0001\u00a2\u0006\u0002\u0010\rJ\u0008\u0010\u000e\u001a\u00020\u000fH\u0002J\u000e\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u000b\u001a\u00020\u0004J\u0018\u0010\u0012\u001a\u00020\u00072\u0006\u0010\u000b\u001a\u00020\u00042\u0008\u0010\u0013\u001a\u0004\u0018\u00010\u0001J\u000e\u0010\u0014\u001a\u00020\u00072\u0006\u0010\u000b\u001a\u00020\u0004R\u000e\u0010\u0003\u001a\u00020\u0004X\u0086T\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0082T\u00a2\u0006\u0002\n\u0000\u00a8\u0006\u0015"
|
|
}
|
|
d2 = {
|
|
"Ltech/rabbit/common/utils/SPUtils;",
|
|
"",
|
|
"()V",
|
|
"KEY_IS_FIRST_START_MACHINE",
|
|
"",
|
|
"SP_NAME",
|
|
"clearApply",
|
|
"",
|
|
"clearCommit",
|
|
"get",
|
|
"T",
|
|
"key",
|
|
"def",
|
|
"(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;",
|
|
"getSP",
|
|
"Landroid/content/SharedPreferences;",
|
|
"has",
|
|
"",
|
|
"put",
|
|
"value",
|
|
"remove",
|
|
"common_release"
|
|
}
|
|
k = 0x1
|
|
mv = {
|
|
0x1,
|
|
0x9,
|
|
0x0
|
|
}
|
|
xi = 0x30
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field public static final INSTANCE:Ltech/rabbit/common/utils/SPUtils;
|
|
|
|
.field public static final KEY_IS_FIRST_START_MACHINE:Ljava/lang/String; = "is_first_start_machine"
|
|
|
|
.field private static final SP_NAME:Ljava/lang/String; = "rabbit-sp"
|
|
|
|
|
|
# direct methods
|
|
.method static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
new-instance v0, Ltech/rabbit/common/utils/SPUtils;
|
|
|
|
invoke-direct {v0}, Ltech/rabbit/common/utils/SPUtils;-><init>()V
|
|
|
|
sput-object v0, Ltech/rabbit/common/utils/SPUtils;->INSTANCE:Ltech/rabbit/common/utils/SPUtils;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private constructor <init>()V
|
|
.locals 0
|
|
|
|
.line 12
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private final getSP()Landroid/content/SharedPreferences;
|
|
.locals 2
|
|
|
|
.line 89
|
|
sget-object p0, Ltech/rabbit/common/utils/RabbitCommon;->INSTANCE:Ltech/rabbit/common/utils/RabbitCommon;
|
|
|
|
invoke-virtual {p0}, Ltech/rabbit/common/utils/RabbitCommon;->getSContext()Landroid/content/Context;
|
|
|
|
move-result-object p0
|
|
|
|
const-string v0, "rabbit-sp"
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-virtual {p0, v0, v1}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;
|
|
|
|
move-result-object p0
|
|
|
|
const-string v0, "getSharedPreferences(...)"
|
|
|
|
invoke-static {p0, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final clearApply()V
|
|
.locals 0
|
|
|
|
.line 93
|
|
invoke-direct {p0}, Ltech/rabbit/common/utils/SPUtils;->getSP()Landroid/content/SharedPreferences;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-interface {p0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
|
|
|
|
move-result-object p0
|
|
|
|
.line 95
|
|
:try_start_0
|
|
invoke-interface {p0}, Landroid/content/SharedPreferences$Editor;->clear()Landroid/content/SharedPreferences$Editor;
|
|
|
|
.line 96
|
|
invoke-interface {p0}, Landroid/content/SharedPreferences$Editor;->apply()V
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
.line 98
|
|
invoke-virtual {p0}, Ljava/lang/Exception;->printStackTrace()V
|
|
|
|
:goto_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public final clearCommit()V
|
|
.locals 0
|
|
|
|
.line 104
|
|
invoke-direct {p0}, Ltech/rabbit/common/utils/SPUtils;->getSP()Landroid/content/SharedPreferences;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-interface {p0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
|
|
|
|
move-result-object p0
|
|
|
|
.line 106
|
|
:try_start_0
|
|
invoke-interface {p0}, Landroid/content/SharedPreferences$Editor;->clear()Landroid/content/SharedPreferences$Editor;
|
|
|
|
.line 107
|
|
invoke-interface {p0}, Landroid/content/SharedPreferences$Editor;->commit()Z
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
.line 109
|
|
invoke-virtual {p0}, Ljava/lang/Exception;->printStackTrace()V
|
|
|
|
:goto_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public final get(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"<T:",
|
|
"Ljava/lang/Object;",
|
|
">(",
|
|
"Ljava/lang/String;",
|
|
"Ljava/lang/Object;",
|
|
")TT;"
|
|
}
|
|
.end annotation
|
|
|
|
const-string v0, "key"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "def"
|
|
|
|
invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
.line 23
|
|
:try_start_0
|
|
instance-of v0, p2, Ljava/lang/Integer;
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
.line 24
|
|
invoke-direct {p0}, Ltech/rabbit/common/utils/SPUtils;->getSP()Landroid/content/SharedPreferences;
|
|
|
|
move-result-object p0
|
|
|
|
move-object v0, p2
|
|
|
|
check-cast v0, Ljava/lang/Number;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/Number;->intValue()I
|
|
|
|
move-result v0
|
|
|
|
invoke-interface {p0, p1, v0}, Landroid/content/SharedPreferences;->getInt(Ljava/lang/String;I)I
|
|
|
|
move-result p0
|
|
|
|
invoke-static {p0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
|
|
|
move-result-object p0
|
|
|
|
:cond_0
|
|
:goto_0
|
|
move-object p2, p0
|
|
|
|
goto :goto_1
|
|
|
|
.line 26
|
|
:cond_1
|
|
instance-of v0, p2, Ljava/lang/Boolean;
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
.line 27
|
|
invoke-direct {p0}, Ltech/rabbit/common/utils/SPUtils;->getSP()Landroid/content/SharedPreferences;
|
|
|
|
move-result-object p0
|
|
|
|
move-object v0, p2
|
|
|
|
check-cast v0, Ljava/lang/Boolean;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z
|
|
|
|
move-result v0
|
|
|
|
invoke-interface {p0, p1, v0}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z
|
|
|
|
move-result p0
|
|
|
|
invoke-static {p0}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
|
|
|
|
move-result-object p0
|
|
|
|
goto :goto_0
|
|
|
|
.line 29
|
|
:cond_2
|
|
instance-of v0, p2, Ljava/lang/String;
|
|
|
|
if-eqz v0, :cond_3
|
|
|
|
.line 30
|
|
invoke-direct {p0}, Ltech/rabbit/common/utils/SPUtils;->getSP()Landroid/content/SharedPreferences;
|
|
|
|
move-result-object p0
|
|
|
|
move-object v0, p2
|
|
|
|
check-cast v0, Ljava/lang/String;
|
|
|
|
invoke-interface {p0, p1, v0}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
if-nez p0, :cond_0
|
|
|
|
move-object p0, p2
|
|
|
|
check-cast p0, Ljava/lang/String;
|
|
|
|
goto :goto_0
|
|
|
|
.line 32
|
|
:cond_3
|
|
instance-of v0, p2, Ljava/lang/Float;
|
|
|
|
if-eqz v0, :cond_4
|
|
|
|
.line 33
|
|
invoke-direct {p0}, Ltech/rabbit/common/utils/SPUtils;->getSP()Landroid/content/SharedPreferences;
|
|
|
|
move-result-object p0
|
|
|
|
move-object v0, p2
|
|
|
|
check-cast v0, Ljava/lang/Number;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/Number;->floatValue()F
|
|
|
|
move-result v0
|
|
|
|
invoke-interface {p0, p1, v0}, Landroid/content/SharedPreferences;->getFloat(Ljava/lang/String;F)F
|
|
|
|
move-result p0
|
|
|
|
invoke-static {p0}, Ljava/lang/Float;->valueOf(F)Ljava/lang/Float;
|
|
|
|
move-result-object p0
|
|
|
|
goto :goto_0
|
|
|
|
.line 35
|
|
:cond_4
|
|
instance-of v0, p2, Ljava/lang/Long;
|
|
|
|
if-eqz v0, :cond_5
|
|
|
|
.line 36
|
|
invoke-direct {p0}, Ltech/rabbit/common/utils/SPUtils;->getSP()Landroid/content/SharedPreferences;
|
|
|
|
move-result-object p0
|
|
|
|
move-object v0, p2
|
|
|
|
check-cast v0, Ljava/lang/Number;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/Number;->longValue()J
|
|
|
|
move-result-wide v0
|
|
|
|
invoke-interface {p0, p1, v0, v1}, Landroid/content/SharedPreferences;->getLong(Ljava/lang/String;J)J
|
|
|
|
move-result-wide p0
|
|
|
|
invoke-static {p0, p1}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object p0
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
.line 43
|
|
invoke-virtual {p0}, Ljava/lang/Exception;->printStackTrace()V
|
|
|
|
:cond_5
|
|
:goto_1
|
|
return-object p2
|
|
.end method
|
|
|
|
.method public final has(Ljava/lang/String;)Z
|
|
.locals 1
|
|
|
|
const-string v0, "key"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
.line 75
|
|
invoke-direct {p0}, Ltech/rabbit/common/utils/SPUtils;->getSP()Landroid/content/SharedPreferences;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-interface {p0, p1}, Landroid/content/SharedPreferences;->contains(Ljava/lang/String;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public final put(Ljava/lang/String;Ljava/lang/Object;)V
|
|
.locals 2
|
|
|
|
const-string v0, "key"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
.line 50
|
|
:try_start_0
|
|
invoke-direct {p0}, Ltech/rabbit/common/utils/SPUtils;->getSP()Landroid/content/SharedPreferences;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-interface {p0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
|
|
|
|
move-result-object p0
|
|
|
|
.line 52
|
|
instance-of v0, p2, Ljava/lang/Integer;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
.line 53
|
|
check-cast p2, Ljava/lang/Number;
|
|
|
|
invoke-virtual {p2}, Ljava/lang/Number;->intValue()I
|
|
|
|
move-result p2
|
|
|
|
invoke-interface {p0, p1, p2}, Landroid/content/SharedPreferences$Editor;->putInt(Ljava/lang/String;I)Landroid/content/SharedPreferences$Editor;
|
|
|
|
goto :goto_0
|
|
|
|
.line 55
|
|
:cond_0
|
|
instance-of v0, p2, Ljava/lang/Boolean;
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
.line 56
|
|
check-cast p2, Ljava/lang/Boolean;
|
|
|
|
invoke-virtual {p2}, Ljava/lang/Boolean;->booleanValue()Z
|
|
|
|
move-result p2
|
|
|
|
invoke-interface {p0, p1, p2}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;
|
|
|
|
goto :goto_0
|
|
|
|
.line 58
|
|
:cond_1
|
|
instance-of v0, p2, Ljava/lang/String;
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
.line 59
|
|
check-cast p2, Ljava/lang/String;
|
|
|
|
invoke-interface {p0, p1, p2}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
|
|
|
|
goto :goto_0
|
|
|
|
.line 61
|
|
:cond_2
|
|
instance-of v0, p2, Ljava/lang/Float;
|
|
|
|
if-eqz v0, :cond_3
|
|
|
|
.line 62
|
|
check-cast p2, Ljava/lang/Number;
|
|
|
|
invoke-virtual {p2}, Ljava/lang/Number;->floatValue()F
|
|
|
|
move-result p2
|
|
|
|
invoke-interface {p0, p1, p2}, Landroid/content/SharedPreferences$Editor;->putFloat(Ljava/lang/String;F)Landroid/content/SharedPreferences$Editor;
|
|
|
|
goto :goto_0
|
|
|
|
.line 64
|
|
:cond_3
|
|
instance-of v0, p2, Ljava/lang/Long;
|
|
|
|
if-eqz v0, :cond_4
|
|
|
|
.line 65
|
|
check-cast p2, Ljava/lang/Number;
|
|
|
|
invoke-virtual {p2}, Ljava/lang/Number;->longValue()J
|
|
|
|
move-result-wide v0
|
|
|
|
invoke-interface {p0, p1, v0, v1}, Landroid/content/SharedPreferences$Editor;->putLong(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;
|
|
|
|
.line 68
|
|
:cond_4
|
|
:goto_0
|
|
invoke-interface {p0}, Landroid/content/SharedPreferences$Editor;->apply()V
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
goto :goto_1
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
.line 70
|
|
invoke-virtual {p0}, Ljava/lang/Exception;->printStackTrace()V
|
|
|
|
:goto_1
|
|
return-void
|
|
.end method
|
|
|
|
.method public final remove(Ljava/lang/String;)V
|
|
.locals 1
|
|
|
|
const-string v0, "key"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
.line 80
|
|
:try_start_0
|
|
invoke-direct {p0}, Ltech/rabbit/common/utils/SPUtils;->getSP()Landroid/content/SharedPreferences;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-interface {p0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
|
|
|
|
move-result-object p0
|
|
|
|
.line 81
|
|
invoke-interface {p0, p1}, Landroid/content/SharedPreferences$Editor;->remove(Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;
|
|
|
|
.line 82
|
|
invoke-interface {p0}, Landroid/content/SharedPreferences$Editor;->apply()V
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
.line 84
|
|
invoke-virtual {p0}, Ljava/lang/Exception;->printStackTrace()V
|
|
|
|
:goto_0
|
|
return-void
|
|
.end method
|