.class public Lcom/scaleasw/powercalc/PreferencesActivity;
.super Landroid/preference/PreferenceActivity;
.source "PreferencesActivity.java"

# interfaces
.implements Landroid/content/SharedPreferences$OnSharedPreferenceChangeListener;


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 12
    invoke-direct {p0}, Landroid/preference/PreferenceActivity;-><init>()V

    return-void
.end method


# virtual methods
.method public applyScreenOrientation()V
    .locals 7

    .prologue
    const/4 v6, 0x6

    const/4 v5, 0x4

    const/4 v4, 0x1

    .line 46
    invoke-static {p0}, Landroid/preference/PreferenceManager;->getDefaultSharedPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v1

    .line 47
    .local v1, "prefs":Landroid/content/SharedPreferences;
    const-string v2, "prefScreenRotation"

    const-string v3, "1"

    invoke-interface {v1, v2, v3}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-static {v2}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v0

    .line 50
    .local v0, "orientation":I
    const/4 v0, 0x1

    .line 52
    if-nez v0, :cond_1

    .line 53
    invoke-virtual {p0, v5}, Lcom/scaleasw/powercalc/PreferencesActivity;->setRequestedOrientation(I)V

    .line 66
    :cond_0
    :goto_0
    return-void

    .line 54
    :cond_1
    if-ne v0, v4, :cond_2

    .line 55
    invoke-virtual {p0, v4}, Lcom/scaleasw/powercalc/PreferencesActivity;->setRequestedOrientation(I)V

    goto :goto_0

    .line 56
    :cond_2
    const/4 v2, 0x2

    if-ne v0, v2, :cond_3

    .line 57
    const/16 v2, 0x9

    invoke-virtual {p0, v2}, Lcom/scaleasw/powercalc/PreferencesActivity;->setRequestedOrientation(I)V

    goto :goto_0

    .line 58
    :cond_3
    const/4 v2, 0x3

    if-ne v0, v2, :cond_4

    .line 59
    const/4 v2, 0x7

    invoke-virtual {p0, v2}, Lcom/scaleasw/powercalc/PreferencesActivity;->setRequestedOrientation(I)V

    goto :goto_0

    .line 60
    :cond_4
    if-ne v0, v5, :cond_5

    .line 61
    const/4 v2, 0x0

    invoke-virtual {p0, v2}, Lcom/scaleasw/powercalc/PreferencesActivity;->setRequestedOrientation(I)V

    goto :goto_0

    .line 62
    :cond_5
    const/4 v2, 0x5

    if-ne v0, v2, :cond_6

    .line 63
    const/16 v2, 0x8

    invoke-virtual {p0, v2}, Lcom/scaleasw/powercalc/PreferencesActivity;->setRequestedOrientation(I)V

    goto :goto_0

    .line 64
    :cond_6
    if-ne v0, v6, :cond_0

    .line 65
    invoke-virtual {p0, v6}, Lcom/scaleasw/powercalc/PreferencesActivity;->setRequestedOrientation(I)V

    goto :goto_0
.end method

.method protected onCreate(Landroid/os/Bundle;)V
    .locals 4
    .param p1, "savedInstanceState"    # Landroid/os/Bundle;

    .prologue
    const/4 v3, 0x0

    .line 16
    invoke-super {p0, p1}, Landroid/preference/PreferenceActivity;->onCreate(Landroid/os/Bundle;)V

    .line 17
    const v1, 0x7f040001

    invoke-virtual {p0, v1}, Lcom/scaleasw/powercalc/PreferencesActivity;->addPreferencesFromResource(I)V

    .line 18
    invoke-virtual {p0}, Lcom/scaleasw/powercalc/PreferencesActivity;->getPreferenceScreen()Landroid/preference/PreferenceScreen;

    move-result-object v1

    invoke-virtual {v1}, Landroid/preference/PreferenceScreen;->getSharedPreferences()Landroid/content/SharedPreferences;

    move-result-object v1

    invoke-interface {v1, p0}, Landroid/content/SharedPreferences;->registerOnSharedPreferenceChangeListener(Landroid/content/SharedPreferences$OnSharedPreferenceChangeListener;)V

    .line 22
    const-string v1, "prefFontScale"

    invoke-virtual {p0, v1}, Lcom/scaleasw/powercalc/PreferencesActivity;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v0

    check-cast v0, Landroid/preference/ListPreference;

    .line 23
    .local v0, "orientation":Landroid/preference/ListPreference;
#    invoke-virtual {v0, v3}, Landroid/preference/ListPreference;->setEnabled(Z)V

    .line 24
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v0}, Landroid/preference/ListPreference;->getSummary()Ljava/lang/CharSequence;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

#    const-string v2, " (Pro version only)"
    const-string v2, ""

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/preference/ListPreference;->setSummary(Ljava/lang/CharSequence;)V

    .line 26
    const-string v1, "prefScreenRotation"

    invoke-virtual {p0, v1}, Lcom/scaleasw/powercalc/PreferencesActivity;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

    move-result-object v0

    .end local v0    # "orientation":Landroid/preference/ListPreference;
    check-cast v0, Landroid/preference/ListPreference;

    .line 27
    .restart local v0    # "orientation":Landroid/preference/ListPreference;
#    invoke-virtual {v0, v3}, Landroid/preference/ListPreference;->setEnabled(Z)V

    .line 28
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v0}, Landroid/preference/ListPreference;->getSummary()Ljava/lang/CharSequence;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

#    const-string v2, " (Pro version only)"
    const-string v2, ""

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/preference/ListPreference;->setSummary(Ljava/lang/CharSequence;)V

    .line 31
    invoke-virtual {p0}, Lcom/scaleasw/powercalc/PreferencesActivity;->applyScreenOrientation()V

    .line 32
    return-void
.end method

.method public onSharedPreferenceChanged(Landroid/content/SharedPreferences;Ljava/lang/String;)V
    .locals 2
    .param p1, "sharedPreferences"    # Landroid/content/SharedPreferences;
    .param p2, "key"    # Ljava/lang/String;

    .prologue
    .line 36
    new-instance v0, Landroid/content/Intent;

    invoke-direct {v0}, Landroid/content/Intent;-><init>()V

    .line 37
    .local v0, "returnIntent":Landroid/content/Intent;
    const/4 v1, -0x1

    invoke-virtual {p0, v1, v0}, Lcom/scaleasw/powercalc/PreferencesActivity;->setResult(ILandroid/content/Intent;)V

    .line 38
    const-string v1, "prefScreenRotation"

    invoke-virtual {p2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 40
    invoke-virtual {p0}, Lcom/scaleasw/powercalc/PreferencesActivity;->applyScreenOrientation()V

    .line 42
    :cond_0
    return-void
.end method
