[Galaxy Note 3 Themes and Apps] kpirnie:
[MENTION=3931450]dr.ketan[/MENTION]

So I'm making an attempt at building a CSC Manager settings "page" for DomPop, and I figured I'd ask the master since you built an app that already does this LOL

And tho I am re-inventing the wheel, I'd really like to know....

Is there a way to dynamically add/process the csc settings without having to add each individual item?

For instance I currently have 3 done, but of course I have to and want to add alot more

But for each item I had to create a seperate section, etc...

.class public Lcom/android/settings/CscSettings;

.super Lcom/android/settings/SettingsPreferenceFragment;

.source "CscSettings.java"

# interfaces

.implements Landroid/preference/Preference$OnPreferenceChangeListener;

# instance fields

.field private mCamGpsMenuPref:Landroid/preference/CheckBoxPreference;

.field private mCamPauseMusicPref:Landroid/preference/CheckBoxPreference;

.field private mCamShutterSoundPref:Landroid/preference/CheckBoxPreference;

# direct methods

.method public constructor <init>()V

.locals 0

invoke-direct {p0}, Lcom/android/settings/SettingsPreferenceFragment;-><init>()V

return-void

.end method

# virtual methods

.method public onCreate(Landroid/os/Bundle;)V

.locals 7

const/4 v2, 0x1

const/4 v3, 0x0

invoke-super {p0, p1}, Lcom/android/settings/SettingsPreferenceFragment;->onCreate(Landroid/os/Bundle;)V

const v1, 0x7f070107

invoke-virtual {p0, v1}, Lcom/android/settings/CscSettings;->addPreferencesFromResource(I)V

const-string v1, "csc_gps_menu"

invoke-virtual {p0, v1}, Lcom/android/settings/CscSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v1

check-cast v1, Landroid/preference/CheckBoxPreference;

iput-object v1, p0, Lcom/android/settings/CscSettings;->mCamGpsMenuPref:Landroid/preference/CheckBoxPreference;

iget-object v4, p0, Lcom/android/settings/CscSettings;->mCamGpsMenuPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p0}, Lcom/android/settings/CscSettings;->getActivity()Landroid/app/Activity;

move-result-object v1

invoke-virtual {v1}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v1

const-string v5, "csc_gps_menu"

invoke-static {v1, v5, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v1

if-ne v1, v2, :cond_0

move v1, v2

:goto_0

const-string v1, "csc_shutter_menu"

invoke-virtual {p0, v1}, Lcom/android/settings/CscSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v1

check-cast v1, Landroid/preference/CheckBoxPreference;

iput-object v1, p0, Lcom/android/settings/CscSettings;->mCamShutterSoundPref:Landroid/preference/CheckBoxPreference;

iget-object v4, p0, Lcom/android/settings/CscSettings;->mCamShutterSoundPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p0}, Lcom/android/settings/CscSettings;->getActivity()Landroid/app/Activity;

move-result-object v1

invoke-virtual {v1}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v1

const-string v5, "csc_shutter_menu"

invoke-static {v1, v5, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v1

if-ne v1, v2, :cond_1

move v1, v2

:goto_1

const-string v1, "csc_pause_music"

invoke-virtual {p0, v1}, Lcom/android/settings/CscSettings;->findPreference(Ljava/lang/CharSequence;)Landroid/preference/Preference;

move-result-object v1

check-cast v1, Landroid/preference/CheckBoxPreference;

iput-object v1, p0, Lcom/android/settings/CscSettings;->mCamPauseMusicPref:Landroid/preference/CheckBoxPreference;

iget-object v4, p0, Lcom/android/settings/CscSettings;->mCamPauseMusicPref:Landroid/preference/CheckBoxPreference;

invoke-virtual {p0}, Lcom/android/settings/CscSettings;->getActivity()Landroid/app/Activity;

move-result-object v1

invoke-virtual {v1}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v1

const-string v5, "csc_pause_music"

invoke-static {v1, v5, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v1

if-ne v1, v2, :cond_2

move v1, v2

:goto_2

invoke-virtual {v4, v1}, Landroid/preference/CheckBoxPreference;->setChecked(Z)V

return-void

:cond_0

move v1, v3

goto :goto_0

:cond_1

move v1, v3

goto :goto_1

:cond_2

move v1, v3

goto :goto_2

.end method

.method public onPreferenceChange(Landroid/preference/Preference;Ljava/lang/Object;)Z

.locals 7

const/4 v2, 0x0

move v5, v2

return v5

.end method

.method public onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z

.locals 5

const/4 v0, 0x0

const/4 v1, 0x1

iget-object v2, p0, Lcom/android/settings/CscSettings;->mCamGpsMenuPref:Landroid/preference/CheckBoxPreference;

if-ne p2, v2, :cond_2

invoke-virtual {p0}, Lcom/android/settings/CscSettings;->getActivity()Landroid/app/Activity;

move-result-object v2

invoke-virtual {v2}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v2

const-string v3, "csc_gps_menu"

check-cast p2, Landroid/preference/CheckBoxPreference;

invoke-virtual {p2}, Landroid/preference/CheckBoxPreference;->isChecked()Z

move-result v4

if-eqz v4, :cond_0

move v0, v1

:cond_0

invoke-static {v2, v3, v0}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

:goto_0

return v1

:cond_1

invoke-super {p0, p1, p2}, Lcom/android/settings/SettingsPreferenceFragment;->onPreferenceTreeClick(Landroid/preference/PreferenceScreen;Landroid/preference/Preference;)Z

move-result v1

goto/16 :goto_0

:cond_2

iget-object v2, p0, Lcom/android/settings/CscSettings;->mCamShutterSoundPref:Landroid/preference/CheckBoxPreference;

if-ne p2, v2, :cond_4

invoke-virtual {p0}, Lcom/android/settings/CscSettings;->getActivity()Landroid/app/Activity;

move-result-object v2

invoke-virtual {v2}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v2

const-string v3, "csc_shutter_menu"

check-cast p2, Landroid/preference/CheckBoxPreference;

invoke-virtual {p2}, Landroid/preference/CheckBoxPreference;->isChecked()Z

move-result v4

if-eqz v4, :cond_3

move v0, v1

:cond_3

invoke-static {v2, v3, v0}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

goto/16 :goto_0

:cond_4

iget-object v2, p0, Lcom/android/settings/CscSettings;->mCamPauseMusicPref:Landroid/preference/CheckBoxPreference;

if-ne p2, v2, :cond_1

invoke-virtual {p0}, Lcom/android/settings/CscSettings;->getActivity()Landroid/app/Activity;

move-result-object v2

invoke-virtual {v2}, Landroid/app/Activity;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v2

const-string v3, "csc_pause_music"

check-cast p2, Landroid/preference/CheckBoxPreference;

invoke-virtual {p2}, Landroid/preference/CheckBoxPreference;->isChecked()Z

move-result v4

if-eqz v4, :cond_5

move v0, v1

:cond_5

invoke-static {v2, v3, v0}, Landroid/provider/Settings$System;->putInt(Landroid/content/ContentResolver;Ljava/lang/String;I)Z

goto/16 :goto_0

.end method

What I'm wondering is, if I change something in the .xml (say, the key or something), can the .smali be forced to read that info and update the CSC to the value? for instance

<CheckBoxPreference android:title="GPS Menu" android:key="csc_gps_menu" android:summaryOn="@string/csc_on" android:summaryOff="@string/csc_off" />

If I change this to something like

<CheckBoxPreference android:title="GPS Menu" android:key="CscFeature_Camera_DisableGPSMenu" android:summaryOn="@string/csc_on" android:summaryOff="@string/csc_off" />

Is .smali smart enough to be able to change it?

I appreciate any guidance you could send me, even if it's just a link bro...