415 lines
11 KiB
Smali
415 lines
11 KiB
Smali
.class public Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;
|
|
.super Lcom/moji/mjweather/settingpreference/pref/MJTwoStatePreference;
|
|
.source "MJPreferenceWithSwitchButton.java"
|
|
|
|
|
|
# instance fields
|
|
.field private b:Z
|
|
|
|
.field private c:Z
|
|
|
|
.field private d:Landroid/widget/ToggleButton;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Landroid/content/Context;)V
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 29
|
|
invoke-direct {p0, p1, v0}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
|
|
.locals 1
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 33
|
|
invoke-direct {p0, p1, p2, v0}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
|
|
.locals 0
|
|
|
|
.line 37
|
|
invoke-direct {p0, p1, p2, p3}, Lcom/moji/mjweather/settingpreference/pref/MJTwoStatePreference;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
|
|
|
|
.line 38
|
|
invoke-direct {p0, p1, p2, p3}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->a(Landroid/content/Context;Landroid/util/AttributeSet;I)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private a(Landroid/content/Context;Landroid/util/AttributeSet;I)V
|
|
.locals 3
|
|
|
|
const/4 v0, 0x3
|
|
|
|
.line 44
|
|
new-array v0, v0, [I
|
|
|
|
fill-array-data v0, :array_0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-virtual {p1, p2, v0, p3, v1}, Landroid/content/Context;->obtainStyledAttributes(Landroid/util/AttributeSet;[III)Landroid/content/res/TypedArray;
|
|
|
|
move-result-object p1
|
|
|
|
.line 48
|
|
invoke-virtual {p1, v1}, Landroid/content/res/TypedArray;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object p3
|
|
|
|
invoke-virtual {p0, p3}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->a(Ljava/lang/CharSequence;)V
|
|
|
|
const/4 p3, 0x1
|
|
|
|
.line 49
|
|
invoke-virtual {p1, p3}, Landroid/content/res/TypedArray;->getString(I)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p0, v0}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->b(Ljava/lang/CharSequence;)V
|
|
|
|
const/4 v0, 0x2
|
|
|
|
.line 50
|
|
invoke-virtual {p1, v0, v1}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z
|
|
|
|
move-result v0
|
|
|
|
invoke-virtual {p0, v0}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->b(Z)V
|
|
|
|
.line 51
|
|
invoke-virtual {p1}, Landroid/content/res/TypedArray;->recycle()V
|
|
|
|
.line 54
|
|
invoke-virtual {p0}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->getContext()Landroid/content/Context;
|
|
|
|
move-result-object p1
|
|
|
|
sget-object v0, Lcom/moji/widget/R$styleable;->MJPreferenceWithSwitchButton:[I
|
|
|
|
invoke-virtual {p1, p2, v0}, Landroid/content/Context;->obtainStyledAttributes(Landroid/util/AttributeSet;[I)Landroid/content/res/TypedArray;
|
|
|
|
move-result-object p1
|
|
|
|
.line 56
|
|
invoke-virtual {p1}, Landroid/content/res/TypedArray;->getIndexCount()I
|
|
|
|
move-result p2
|
|
|
|
sub-int/2addr p2, p3
|
|
|
|
:goto_0
|
|
if-ltz p2, :cond_2
|
|
|
|
.line 57
|
|
invoke-virtual {p1, p2}, Landroid/content/res/TypedArray;->getIndex(I)I
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
.line 59
|
|
invoke-virtual {p1, v0, v1}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z
|
|
|
|
move-result v2
|
|
|
|
iput-boolean v2, p0, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->b:Z
|
|
|
|
:cond_0
|
|
if-ne v0, p3, :cond_1
|
|
|
|
.line 62
|
|
invoke-virtual {p1, v0, v1}, Landroid/content/res/TypedArray;->getBoolean(IZ)Z
|
|
|
|
move-result v0
|
|
|
|
iput-boolean v0, p0, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->c:Z
|
|
|
|
:cond_1
|
|
add-int/lit8 p2, p2, -0x1
|
|
|
|
goto :goto_0
|
|
|
|
.line 65
|
|
:cond_2
|
|
invoke-virtual {p1}, Landroid/content/res/TypedArray;->recycle()V
|
|
|
|
return-void
|
|
|
|
nop
|
|
|
|
:array_0
|
|
.array-data 4
|
|
0x10101ef
|
|
0x10101f0
|
|
0x10101f1
|
|
.end array-data
|
|
.end method
|
|
|
|
.method static synthetic a(Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;Ljava/lang/Object;)Z
|
|
.locals 0
|
|
|
|
.line 22
|
|
invoke-virtual {p0, p1}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->callChangeListener(Ljava/lang/Object;)Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method protected onBindView(Landroid/view/View;)V
|
|
.locals 5
|
|
|
|
.line 77
|
|
invoke-super {p0, p1}, Lcom/moji/mjweather/settingpreference/pref/MJTwoStatePreference;->onBindView(Landroid/view/View;)V
|
|
|
|
const v0, 0x1020016
|
|
|
|
.line 78
|
|
invoke-virtual {p1, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Landroid/widget/TextView;
|
|
|
|
const/16 v1, 0x8
|
|
|
|
const/4 v2, 0x0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
.line 80
|
|
invoke-virtual {p0}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->getTitle()Ljava/lang/CharSequence;
|
|
|
|
move-result-object v3
|
|
|
|
.line 81
|
|
invoke-static {v3}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v4
|
|
|
|
if-nez v4, :cond_0
|
|
|
|
.line 82
|
|
invoke-virtual {v0, v3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V
|
|
|
|
.line 83
|
|
invoke-virtual {v0, v2}, Landroid/widget/TextView;->setVisibility(I)V
|
|
|
|
.line 84
|
|
invoke-virtual {p0}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->a()Landroid/content/res/Resources;
|
|
|
|
move-result-object v3
|
|
|
|
const v4, 0x7f0601d4
|
|
|
|
invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getColor(I)I
|
|
|
|
move-result v3
|
|
|
|
invoke-virtual {v0, v3}, Landroid/widget/TextView;->setTextColor(I)V
|
|
|
|
goto :goto_0
|
|
|
|
.line 86
|
|
:cond_0
|
|
invoke-virtual {v0, v1}, Landroid/widget/TextView;->setVisibility(I)V
|
|
|
|
:cond_1
|
|
:goto_0
|
|
const v0, 0x1020001
|
|
|
|
.line 90
|
|
invoke-virtual {p1, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Landroid/widget/ToggleButton;
|
|
|
|
iput-object v0, p0, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->d:Landroid/widget/ToggleButton;
|
|
|
|
.line 91
|
|
iget-object v0, p0, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->d:Landroid/widget/ToggleButton;
|
|
|
|
const/4 v3, 0x1
|
|
|
|
invoke-virtual {v0, v3}, Landroid/widget/ToggleButton;->setFocusable(Z)V
|
|
|
|
.line 92
|
|
iget-object v0, p0, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->d:Landroid/widget/ToggleButton;
|
|
|
|
invoke-virtual {p0}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->b()Z
|
|
|
|
move-result v3
|
|
|
|
invoke-virtual {v0, v3}, Landroid/widget/ToggleButton;->setChecked(Z)V
|
|
|
|
.line 93
|
|
iget-object v0, p0, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->d:Landroid/widget/ToggleButton;
|
|
|
|
new-instance v3, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton$1;
|
|
|
|
invoke-direct {v3, p0}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton$1;-><init>(Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;)V
|
|
|
|
invoke-virtual {v0, v3}, Landroid/widget/ToggleButton;->setOnCheckedChangeListener(Landroid/widget/CompoundButton$OnCheckedChangeListener;)V
|
|
|
|
const v0, 0x7f090c85
|
|
|
|
.line 102
|
|
invoke-virtual {p1, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;
|
|
|
|
move-result-object v0
|
|
|
|
.line 103
|
|
iget-boolean v3, p0, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->b:Z
|
|
|
|
if-eqz v3, :cond_2
|
|
|
|
.line 104
|
|
invoke-virtual {v0}, Landroid/view/View;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;
|
|
|
|
move-result-object v3
|
|
|
|
check-cast v3, Landroid/widget/LinearLayout$LayoutParams;
|
|
|
|
.line 105
|
|
invoke-virtual {v3, v2, v2, v2, v2}, Landroid/widget/LinearLayout$LayoutParams;->setMargins(IIII)V
|
|
|
|
.line 106
|
|
invoke-virtual {v0, v3}, Landroid/view/View;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V
|
|
|
|
:cond_2
|
|
const v0, 0x1020010
|
|
|
|
.line 110
|
|
invoke-virtual {p1, v0}, Landroid/view/View;->findViewById(I)Landroid/view/View;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Landroid/widget/TextView;
|
|
|
|
if-eqz v0, :cond_4
|
|
|
|
.line 112
|
|
invoke-virtual {p0}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->getSummary()Ljava/lang/CharSequence;
|
|
|
|
move-result-object v3
|
|
|
|
.line 113
|
|
invoke-static {v3}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v4
|
|
|
|
if-nez v4, :cond_3
|
|
|
|
.line 114
|
|
invoke-virtual {v0, v3}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V
|
|
|
|
.line 115
|
|
invoke-virtual {v0, v2}, Landroid/widget/TextView;->setVisibility(I)V
|
|
|
|
goto :goto_1
|
|
|
|
.line 117
|
|
:cond_3
|
|
invoke-virtual {v0, v1}, Landroid/widget/TextView;->setVisibility(I)V
|
|
|
|
.line 122
|
|
:cond_4
|
|
:goto_1
|
|
invoke-virtual {p0, p1}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->a(Landroid/view/View;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method protected onCreateView(Landroid/view/ViewGroup;)Landroid/view/View;
|
|
.locals 3
|
|
|
|
.line 69
|
|
invoke-super {p0, p1}, Lcom/moji/mjweather/settingpreference/pref/MJTwoStatePreference;->onCreateView(Landroid/view/ViewGroup;)Landroid/view/View;
|
|
|
|
.line 70
|
|
invoke-virtual {p0}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->getContext()Landroid/content/Context;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "layout_inflater"
|
|
|
|
invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Landroid/view/LayoutInflater;
|
|
|
|
const v1, 0x7f0b02d2
|
|
|
|
const/4 v2, 0x0
|
|
|
|
.line 71
|
|
invoke-virtual {v0, v1, p1, v2}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;Z)Landroid/view/View;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method protected persistBoolean(Z)Z
|
|
.locals 2
|
|
|
|
.line 132
|
|
invoke-super {p0, p1}, Lcom/moji/mjweather/settingpreference/pref/MJTwoStatePreference;->persistBoolean(Z)Z
|
|
|
|
.line 133
|
|
invoke-virtual {p0}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->shouldPersist()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
iget-boolean v0, p0, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->c:Z
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
.line 134
|
|
invoke-static {}, Lcom/moji/preferences/SettingNotificationPrefer;->c()Lcom/moji/preferences/SettingNotificationPrefer;
|
|
|
|
move-result-object v0
|
|
|
|
.line 135
|
|
invoke-virtual {p0}, Lcom/moji/mjweather/settingpreference/pref/MJPreferenceWithSwitchButton;->getKey()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Ljava/lang/String;->toUpperCase()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-static {v1}, Lcom/moji/preferences/SettingNotificationPrefer$KeyConstant;->valueOf(Ljava/lang/String;)Lcom/moji/preferences/SettingNotificationPrefer$KeyConstant;
|
|
|
|
move-result-object v1
|
|
|
|
.line 136
|
|
invoke-virtual {v0, v1, p1}, Lcom/moji/preferences/SettingNotificationPrefer;->a(Lcom/moji/preferences/SettingNotificationPrefer$KeyConstant;Z)V
|
|
|
|
const/4 p1, 0x1
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
const/4 p1, 0x0
|
|
|
|
return p1
|
|
.end method
|