508 lines
12 KiB
Smali
508 lines
12 KiB
Smali
.class Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;
|
|
.super Ljava/lang/Object;
|
|
|
|
# interfaces
|
|
.implements Landroid/content/SharedPreferences;
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences$REditor;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field private static final TAG:Ljava/lang/String; = "MicroMsg.SDK.SharedPreferences"
|
|
|
|
|
|
# instance fields
|
|
.field private final columns:[Ljava/lang/String;
|
|
|
|
.field private final cr:Landroid/content/ContentResolver;
|
|
|
|
.field private editor:Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences$REditor;
|
|
|
|
.field private final values:Ljava/util/HashMap;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/HashMap<",
|
|
"Ljava/lang/String;",
|
|
"Ljava/lang/Object;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Landroid/content/Context;)V
|
|
.locals 3
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
const/4 v0, 0x4
|
|
|
|
new-array v0, v0, [Ljava/lang/String;
|
|
|
|
const-string v1, "_id"
|
|
|
|
const/4 v2, 0x0
|
|
|
|
aput-object v1, v0, v2
|
|
|
|
const-string v1, "key"
|
|
|
|
const/4 v2, 0x1
|
|
|
|
aput-object v1, v0, v2
|
|
|
|
const-string v1, "type"
|
|
|
|
const/4 v2, 0x2
|
|
|
|
aput-object v1, v0, v2
|
|
|
|
const-string v1, "value"
|
|
|
|
const/4 v2, 0x3
|
|
|
|
aput-object v1, v0, v2
|
|
|
|
iput-object v0, p0, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->columns:[Ljava/lang/String;
|
|
|
|
new-instance v0, Ljava/util/HashMap;
|
|
|
|
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
|
|
|
|
iput-object v0, p0, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->values:Ljava/util/HashMap;
|
|
|
|
const/4 v0, 0x0
|
|
|
|
iput-object v0, p0, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->editor:Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences$REditor;
|
|
|
|
invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
|
|
|
|
move-result-object p1
|
|
|
|
iput-object p1, p0, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->cr:Landroid/content/ContentResolver;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private getValue(Ljava/lang/String;)Ljava/lang/Object;
|
|
.locals 7
|
|
|
|
const/4 v0, 0x0
|
|
|
|
:try_start_0
|
|
iget-object v1, p0, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->cr:Landroid/content/ContentResolver;
|
|
|
|
sget-object v2, Lcom/tencent/mm/opensdk/utils/c$b;->CONTENT_URI:Landroid/net/Uri;
|
|
|
|
iget-object v3, p0, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->columns:[Ljava/lang/String;
|
|
|
|
const-string v4, "key = ?"
|
|
|
|
const/4 v5, 0x1
|
|
|
|
new-array v5, v5, [Ljava/lang/String;
|
|
|
|
const/4 v6, 0x0
|
|
|
|
aput-object p1, v5, v6
|
|
|
|
const/4 v6, 0x0
|
|
|
|
invoke-virtual/range {v1 .. v6}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;
|
|
|
|
move-result-object p1
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
return-object v0
|
|
|
|
:cond_0
|
|
const-string v1, "type"
|
|
|
|
invoke-interface {p1, v1}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I
|
|
|
|
move-result v1
|
|
|
|
const-string v2, "value"
|
|
|
|
invoke-interface {p1, v2}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I
|
|
|
|
move-result v2
|
|
|
|
invoke-interface {p1}, Landroid/database/Cursor;->moveToFirst()Z
|
|
|
|
move-result v3
|
|
|
|
if-eqz v3, :cond_1
|
|
|
|
invoke-interface {p1, v1}, Landroid/database/Cursor;->getInt(I)I
|
|
|
|
move-result v1
|
|
|
|
invoke-interface {p1, v2}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-static {v1, v2}, Lcom/tencent/mm/opensdk/utils/c$a;->a(ILjava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
move-object v1, v0
|
|
|
|
:goto_0
|
|
invoke-interface {p1}, Landroid/database/Cursor;->close()V
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-object v1
|
|
|
|
:catch_0
|
|
move-exception p1
|
|
|
|
const-string v1, "MicroMsg.SDK.SharedPreferences"
|
|
|
|
new-instance v2, Ljava/lang/StringBuilder;
|
|
|
|
const-string v3, "getValue exception:"
|
|
|
|
invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p1}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {v1, p1}, Lcom/tencent/mm/opensdk/utils/Log;->e(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public contains(Ljava/lang/String;)Z
|
|
.locals 0
|
|
|
|
invoke-direct {p0, p1}, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->getValue(Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
const/4 p1, 0x1
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
const/4 p1, 0x0
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method public edit()Landroid/content/SharedPreferences$Editor;
|
|
.locals 2
|
|
|
|
iget-object v0, p0, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->editor:Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences$REditor;
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
new-instance v0, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences$REditor;
|
|
|
|
iget-object v1, p0, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->cr:Landroid/content/ContentResolver;
|
|
|
|
invoke-direct {v0, v1}, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences$REditor;-><init>(Landroid/content/ContentResolver;)V
|
|
|
|
iput-object v0, p0, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->editor:Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences$REditor;
|
|
|
|
:cond_0
|
|
iget-object v0, p0, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->editor:Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences$REditor;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public getAll()Ljava/util/Map;
|
|
.locals 7
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Ljava/util/Map<",
|
|
"Ljava/lang/String;",
|
|
"*>;"
|
|
}
|
|
.end annotation
|
|
|
|
:try_start_0
|
|
iget-object v0, p0, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->cr:Landroid/content/ContentResolver;
|
|
|
|
sget-object v1, Lcom/tencent/mm/opensdk/utils/c$b;->CONTENT_URI:Landroid/net/Uri;
|
|
|
|
iget-object v2, p0, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->columns:[Ljava/lang/String;
|
|
|
|
const/4 v3, 0x0
|
|
|
|
const/4 v4, 0x0
|
|
|
|
const/4 v5, 0x0
|
|
|
|
invoke-virtual/range {v0 .. v5}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;
|
|
|
|
move-result-object v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
return-object v0
|
|
|
|
:cond_0
|
|
const-string v1, "key"
|
|
|
|
invoke-interface {v0, v1}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I
|
|
|
|
move-result v1
|
|
|
|
const-string v2, "type"
|
|
|
|
invoke-interface {v0, v2}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I
|
|
|
|
move-result v2
|
|
|
|
const-string v3, "value"
|
|
|
|
invoke-interface {v0, v3}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I
|
|
|
|
move-result v3
|
|
|
|
:goto_0
|
|
invoke-interface {v0}, Landroid/database/Cursor;->moveToNext()Z
|
|
|
|
move-result v4
|
|
|
|
if-eqz v4, :cond_1
|
|
|
|
invoke-interface {v0, v2}, Landroid/database/Cursor;->getInt(I)I
|
|
|
|
move-result v4
|
|
|
|
invoke-interface {v0, v3}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object v5
|
|
|
|
invoke-static {v4, v5}, Lcom/tencent/mm/opensdk/utils/c$a;->a(ILjava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object v4
|
|
|
|
iget-object v5, p0, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->values:Ljava/util/HashMap;
|
|
|
|
invoke-interface {v0, v1}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object v6
|
|
|
|
invoke-virtual {v5, v6, v4}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
invoke-interface {v0}, Landroid/database/Cursor;->close()V
|
|
|
|
iget-object v0, p0, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->values:Ljava/util/HashMap;
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-object v0
|
|
|
|
:catch_0
|
|
move-exception v0
|
|
|
|
const-string v1, "MicroMsg.SDK.SharedPreferences"
|
|
|
|
new-instance v2, Ljava/lang/StringBuilder;
|
|
|
|
const-string v3, "getAll exception:"
|
|
|
|
invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v0}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v1, v0}, Lcom/tencent/mm/opensdk/utils/Log;->e(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
iget-object v0, p0, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->values:Ljava/util/HashMap;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public getBoolean(Ljava/lang/String;Z)Z
|
|
.locals 1
|
|
|
|
invoke-direct {p0, p1}, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->getValue(Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
instance-of v0, p1, Ljava/lang/Boolean;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
check-cast p1, Ljava/lang/Boolean;
|
|
|
|
invoke-virtual {p1}, Ljava/lang/Boolean;->booleanValue()Z
|
|
|
|
move-result p1
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
return p2
|
|
.end method
|
|
|
|
.method public getFloat(Ljava/lang/String;F)F
|
|
.locals 1
|
|
|
|
invoke-direct {p0, p1}, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->getValue(Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
instance-of v0, p1, Ljava/lang/Float;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
check-cast p1, Ljava/lang/Float;
|
|
|
|
invoke-virtual {p1}, Ljava/lang/Float;->floatValue()F
|
|
|
|
move-result p1
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
return p2
|
|
.end method
|
|
|
|
.method public getInt(Ljava/lang/String;I)I
|
|
.locals 1
|
|
|
|
invoke-direct {p0, p1}, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->getValue(Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
instance-of v0, p1, Ljava/lang/Integer;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
check-cast p1, Ljava/lang/Integer;
|
|
|
|
invoke-virtual {p1}, Ljava/lang/Integer;->intValue()I
|
|
|
|
move-result p1
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
return p2
|
|
.end method
|
|
|
|
.method public getLong(Ljava/lang/String;J)J
|
|
.locals 1
|
|
|
|
invoke-direct {p0, p1}, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->getValue(Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
instance-of v0, p1, Ljava/lang/Long;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
check-cast p1, Ljava/lang/Long;
|
|
|
|
invoke-virtual {p1}, Ljava/lang/Long;->longValue()J
|
|
|
|
move-result-wide p1
|
|
|
|
return-wide p1
|
|
|
|
:cond_0
|
|
return-wide p2
|
|
.end method
|
|
|
|
.method public getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
|
|
.locals 1
|
|
|
|
invoke-direct {p0, p1}, Lcom/tencent/mm/opensdk/openapi/MMSharedPreferences;->getValue(Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
instance-of v0, p1, Ljava/lang/String;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
check-cast p1, Ljava/lang/String;
|
|
|
|
return-object p1
|
|
|
|
:cond_0
|
|
return-object p2
|
|
.end method
|
|
|
|
.method public getStringSet(Ljava/lang/String;Ljava/util/Set;)Ljava/util/Set;
|
|
.locals 0
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/lang/String;",
|
|
"Ljava/util/Set<",
|
|
"Ljava/lang/String;",
|
|
">;)",
|
|
"Ljava/util/Set<",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
const/4 p1, 0x0
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public registerOnSharedPreferenceChangeListener(Landroid/content/SharedPreferences$OnSharedPreferenceChangeListener;)V
|
|
.locals 0
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public unregisterOnSharedPreferenceChangeListener(Landroid/content/SharedPreferences$OnSharedPreferenceChangeListener;)V
|
|
.locals 0
|
|
|
|
return-void
|
|
.end method
|