Commons.smali
.class public final Lcom/cmcm/locker/sdk/notificationhelper/impl/util/Commons;
.super Ljava/lang/Object;
.source "Commons.java"
# static fields
.field private static sContext:Landroid/content/Context; = null
.field public static final ss_guide_count:Ljava/lang/String; = "ss_guide_count"
.field public static final ss_guide_editor:Ljava/lang/String; = "ss_guide_editor"
.field public static final ss_guide_time:Ljava/lang/String; = "ss_guide_time"
# direct methods
.method public constructor <init>()V
.registers 1
.prologue
.line 11
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static dip2px(Landroid/content/Context;F)I
.registers 4
.prologue
.line 45
invoke-virtual {p0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v0
invoke-virtual {v0}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;
move-result-object v0
iget v0, v0, Landroid/util/DisplayMetrics;->density:F
.line 46
mul-float/2addr v0, p1
const/high16 v1, 0x3f000000 # 0.5f
add-float/2addr v0, v1
float-to-int v0, v0
return v0
.end method
.method public static getBaseContext()Landroid/content/Context;
.registers 1
.prologue
.line 120
sget-object v0, Lcom/cmcm/locker/sdk/notificationhelper/impl/util/Commons;->sContext:Landroid/content/Context;
return-object v0
.end method
.method public static getGuideShowCount(Landroid/content/Context;)J
.registers 3
.prologue
.line 113
const-string v0, "ss_guide_editor"
const-string v1, "ss_guide_count"
invoke-static {p0, v0, v1}, Lcom/cmcm/locker/sdk/notificationhelper/impl/util/Commons;->getGuideSpByKey(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)J
move-result-wide v0
return-wide v0
.end method
.method public static getGuideSpByKey(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)J
.registers 9
.prologue
const-wide/16 v0, 0x0
.line 62
const/4 v2, 0x0
:try_start_3
invoke-virtual {p0, p1, v2}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;
move-result-object v2
.line 63
const-wide/16 v4, 0x0
invoke-interface {v2, p2, v4, v5}, Landroid/content/SharedPreferences;->getLong(Ljava/lang/String;J)J
:try_end_c
.catch Ljava/lang/Exception; {:try_start_3 .. :try_end_c} :catch_e
move-result-wide v0
.line 67
:goto_d
return-wide v0
.line 64
:catch_e
move-exception v2
.line 65
invoke-virtual {v2}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_d
.end method
.method public static getGuideTime(Landroid/content/Context;)J
.registers 3
.prologue
.line 105
const-string v0, "ss_guide_editor"
const-string v1, "ss_guide_time"
invoke-static {p0, v0, v1}, Lcom/cmcm/locker/sdk/notificationhelper/impl/util/Commons;->getGuideSpByKey(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)J
move-result-wide v0
return-wide v0
.end method
.method public static getNotificationServiceSettingIntent()Landroid/content/Intent;
.registers 2
.prologue
.line 72
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x12
if-lt v0, v1, :cond_14
.line 73
new-instance v0, Landroid/content/Intent;
const-string v1, "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"
invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
.line 77
:goto_d
const v1, 0x8000
invoke-virtual {v0, v1}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;
.line 78
return-object v0
.line 75
:cond_14
new-instance v0, Landroid/content/Intent;
const-string v1, "android.settings.ACCESSIBILITY_SETTINGS"
invoke-direct {v0, v1}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
goto :goto_d
.end method
.method public static isFirstIntall(Landroid/content/Context;)Z
.registers 5
.prologue
.line 53
invoke-static {p0}, Lcom/cmcm/locker/sdk/notificationhelper/impl/util/Commons;->getGuideTime(Landroid/content/Context;)J
move-result-wide v0
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-nez v0, :cond_c
const/4 v0, 0x1
:goto_b
return v0
:cond_c
const/4 v0, 0x0
goto :goto_b
.end method
.method public static setBaseContext(Landroid/content/Context;)V
.registers 1
.prologue
.line 123
sput-object p0, Lcom/cmcm/locker/sdk/notificationhelper/impl/util/Commons;->sContext:Landroid/content/Context;
.line 124
return-void
.end method
.method public static setGudieSpByKey(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;J)V
.registers 6
.prologue
.line 84
const/4 v0, 0x0
:try_start_1
invoke-virtual {p0, p1, v0}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;
move-result-object v0
.line 85
invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object v0
.line 86
invoke-interface {v0, p2, p3, p4}, Landroid/content/SharedPreferences$Editor;->putLong(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;
.line 87
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z
:try_end_f
.catch Ljava/lang/Exception; {:try_start_1 .. :try_end_f} :catch_10
.line 91
:goto_f
return-void
.line 88
:catch_10
move-exception v0
.line 89
invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_f
.end method
.method public static setGuideShowCount(Landroid/content/Context;J)V
.registers 6
.prologue
.line 117
const-string v0, "ss_guide_editor"
const-string v1, "ss_guide_count"
invoke-static {p0, v0, v1, p1, p2}, Lcom/cmcm/locker/sdk/notificationhelper/impl/util/Commons;->setGudieSpByKey(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;J)V
.line 118
return-void
.end method
.method public static setGuideTime(Landroid/content/Context;J)V
.registers 6
.prologue
.line 109
const-string v0, "ss_guide_editor"
const-string v1, "ss_guide_time"
invoke-static {p0, v0, v1, p1, p2}, Lcom/cmcm/locker/sdk/notificationhelper/impl/util/Commons;->setGudieSpByKey(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;J)V
.line 110
return-void
.end method
.method public static setIntValue(Landroid/content/Context;Ljava/lang/String;I)V
.registers 7
.prologue
.line 95
:try_start_0
const-string v0, "ss_guide_editor"
const/4 v1, 0x0
invoke-virtual {p0, v0, v1}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;
move-result-object v0
.line 96
invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object v0
.line 97
int-to-long v2, p2
invoke-interface {v0, p1, v2, v3}, Landroid/content/SharedPreferences$Editor;->putLong(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;
.line 98
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z
:try_end_12
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_12} :catch_13
.line 102
:goto_12
return-void
.line 99
:catch_13
move-exception v0
.line 100
invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_12
.end method
.method public static startActivity(Landroid/content/Context;Landroid/content/Intent;)Z
.registers 4
.prologue
const/4 v1, 0x0
.line 15
if-eqz p0, :cond_5
if-nez p1, :cond_7
:cond_5
move v0, v1
.line 27
:goto_6
return v0
.line 18
:cond_7
const/4 v0, 0x1
.line 20
:try_start_8
invoke-virtual {p0, p1}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V
:try_end_b
.catch Landroid/content/ActivityNotFoundException; {:try_start_8 .. :try_end_b} :catch_c
.catch Ljava/lang/IllegalArgumentException; {:try_start_8 .. :try_end_b} :catch_12
goto :goto_6
.line 21
:catch_c
move-exception v0
.line 23
invoke-virtual {v0}, Landroid/content/ActivityNotFoundException;->printStackTrace()V
move v0, v1
.line 26
goto :goto_6
.line 24
:catch_12
move-exception v1
.line 25
invoke-virtual {v1}, Ljava/lang/IllegalArgumentException;->printStackTrace()V
goto :goto_6
.end method
.method public static startActivityForResult(Landroid/app/Activity;Landroid/content/Intent;I)Z
.registers 5
.prologue
const/4 v1, 0x0
.line 32
if-eqz p0, :cond_5
if-nez p1, :cond_7
:cond_5
move v0, v1
.line 41
:goto_6
return v0
.line 35
:cond_7
const/4 v0, 0x1
.line 37
:try_start_8
invoke-virtual {p0, p1, p2}, Landroid/app/Activity;->startActivityForResult(Landroid/content/Intent;I)V
:try_end_b
.catch Ljava/lang/Exception; {:try_start_8 .. :try_end_b} :catch_c
goto :goto_6
.line 38
:catch_c
move-exception v0
move v0, v1
.line 39
goto :goto_6
.end method
# virtual methods
.method public px2dip(Landroid/content/Context;F)I
.registers 5
.prologue
.line 49
invoke-virtual {p1}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;
move-result-object v0
invoke-virtual {v0}, Landroid/content/res/Resources;->getDisplayMetrics()Landroid/util/DisplayMetrics;
move-result-object v0
iget v0, v0, Landroid/util/DisplayMetrics;->density:F
.line 50
div-float v0, p2, v0
const/high16 v1, 0x3f000000 # 0.5f
add-float/2addr v0, v1
float-to-int v0, v0
return v0
.end method