diff options
author | Daniel Hillenbrand <daniel.hillenbrand@codeworkx.de> | 2012-08-12 10:22:54 +0200 |
---|---|---|
committer | Daniel Hillenbrand <daniel.hillenbrand@codeworkx.de> | 2012-08-12 10:22:54 +0200 |
commit | 22ba1240ca35f1ad01def030bac8eaab6466bd48 (patch) | |
tree | c10e55c98291e3e65e2095d3db6101c8bf3ae0c1 | |
parent | 85f71d2490d58892928684a8b30fda691c5f2e90 (diff) | |
download | device_samsung_i9300-22ba1240ca35f1ad01def030bac8eaab6466bd48.zip device_samsung_i9300-22ba1240ca35f1ad01def030bac8eaab6466bd48.tar.gz device_samsung_i9300-22ba1240ca35f1ad01def030bac8eaab6466bd48.tar.bz2 |
settings: code cleanup
Change-Id: Ife53e5334832994d5299fda183ad4d6a15832480
3 files changed, 15 insertions, 27 deletions
diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/HapticFragmentActivity.java b/DeviceSettings/src/com/cyanogenmod/settings/device/HapticFragmentActivity.java index 59047fa..0f3313d 100644 --- a/DeviceSettings/src/com/cyanogenmod/settings/device/HapticFragmentActivity.java +++ b/DeviceSettings/src/com/cyanogenmod/settings/device/HapticFragmentActivity.java @@ -33,7 +33,7 @@ import com.cyanogenmod.settings.device.R; public class HapticFragmentActivity extends PreferenceFragment { private static final String PREF_ENABLED = "1"; - private static final String TAG = "GalaxyS3Settings_General"; + private static final String TAG = "GalaxyS3Settings_Haptic"; @Override public void onCreate(Bundle savedInstanceState) { diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/RadioFragmentActivity.java b/DeviceSettings/src/com/cyanogenmod/settings/device/RadioFragmentActivity.java index 4d830b8..62b855c 100644 --- a/DeviceSettings/src/com/cyanogenmod/settings/device/RadioFragmentActivity.java +++ b/DeviceSettings/src/com/cyanogenmod/settings/device/RadioFragmentActivity.java @@ -33,7 +33,7 @@ import com.cyanogenmod.settings.device.R; public class RadioFragmentActivity extends PreferenceFragment { private static final String PREF_ENABLED = "1"; - private static final String TAG = "GalaxyS2Parts_General"; + private static final String TAG = "GalaxyS2Parts_Radio"; @Override public void onCreate(Bundle savedInstanceState) { diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java b/DeviceSettings/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java index 2c171a5..36180ae 100644 --- a/DeviceSettings/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java +++ b/DeviceSettings/src/com/cyanogenmod/settings/device/ScreenFragmentActivity.java @@ -33,7 +33,7 @@ import com.cyanogenmod.settings.device.R; public class ScreenFragmentActivity extends PreferenceFragment { private static final String PREF_ENABLED = "1"; - private static final String TAG = "GalaxyS3Settings_General"; + private static final String TAG = "GalaxyS3Settings_Screen"; private mDNIeScenario mmDNIeScenario; private mDNIeMode mmDNIeMode; private mDNIeNegative mmDNIeNegative; @@ -72,19 +72,18 @@ public class ScreenFragmentActivity extends PreferenceFragment { public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { String key = preference.getKey(); - Log.w(TAG, "key: " + key); if (key.compareTo(DeviceSettings.KEY_TOUCHKEY_LIGHT) == 0) { - if (((CheckBoxPreference)preference).isChecked()) { - Utils.writeValue(FILE_TOUCHKEY_DISABLE, "0"); - Utils.writeValue(FILE_TOUCHKEY_BRIGHTNESS, "1"); - preferenceScreen.findPreference(DeviceSettings.KEY_TOUCHKEY_TIMEOUT).setEnabled(true); - } else { - Utils.writeValue(FILE_TOUCHKEY_DISABLE, "1"); - Utils.writeValue(FILE_TOUCHKEY_BRIGHTNESS, "2"); - preferenceScreen.findPreference(DeviceSettings.KEY_TOUCHKEY_TIMEOUT).setEnabled(false); - } + if (((CheckBoxPreference)preference).isChecked()) { + Utils.writeValue(FILE_TOUCHKEY_DISABLE, "0"); + Utils.writeValue(FILE_TOUCHKEY_BRIGHTNESS, "1"); + preferenceScreen.findPreference(DeviceSettings.KEY_TOUCHKEY_TIMEOUT).setEnabled(true); + } else { + Utils.writeValue(FILE_TOUCHKEY_DISABLE, "1"); + Utils.writeValue(FILE_TOUCHKEY_BRIGHTNESS, "2"); + preferenceScreen.findPreference(DeviceSettings.KEY_TOUCHKEY_TIMEOUT).setEnabled(false); + } } return true; } @@ -95,20 +94,9 @@ public class ScreenFragmentActivity extends PreferenceFragment { public static void restore(Context context) { SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + boolean light = sharedPrefs.getBoolean(DeviceSettings.KEY_TOUCHKEY_LIGHT, true); - Boolean light = sharedPrefs.getBoolean(DeviceSettings.KEY_TOUCHKEY_LIGHT, true); - String disabled; - String brightness; - - if (light == true) { - disabled = "0"; - brightness = "1"; - } else { - disabled = "1"; - brightness = "2"; - } - - Utils.writeValue(FILE_TOUCHKEY_DISABLE, disabled); - Utils.writeValue(FILE_TOUCHKEY_BRIGHTNESS, brightness); + Utils.writeValue(FILE_TOUCHKEY_DISABLE, light ? "0" : "1"); + Utils.writeValue(FILE_TOUCHKEY_BRIGHTNESS, light ? "1" : "2"); } } |