From 55a827b2707a18727d57e403c86bc06e768d8803 Mon Sep 17 00:00:00 2001 From: Shawn Alty Date: Tue, 27 Dec 2011 21:58:43 -0600 Subject: more renaming for device settings compatibility --- .../cyanogenmod/settings/device/AriesParts.java | 118 --------------------- .../settings/device/DeviceSettings.java | 118 +++++++++++++++++++++ .../src/com/cyanogenmod/settings/device/Hspa.java | 2 +- .../settings/device/TouchKeyBacklightTimeout.java | 2 +- .../cyanogenmod/settings/device/TvOutService.java | 2 +- 5 files changed, 121 insertions(+), 121 deletions(-) delete mode 100644 AriesParts/src/com/cyanogenmod/settings/device/AriesParts.java create mode 100644 AriesParts/src/com/cyanogenmod/settings/device/DeviceSettings.java (limited to 'AriesParts/src') diff --git a/AriesParts/src/com/cyanogenmod/settings/device/AriesParts.java b/AriesParts/src/com/cyanogenmod/settings/device/AriesParts.java deleted file mode 100644 index 37660ab..0000000 --- a/AriesParts/src/com/cyanogenmod/settings/device/AriesParts.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.cyanogenmod.settings.device; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.hardware.TvOut; -import android.os.Bundle; -import android.preference.CheckBoxPreference; -import android.preference.ListPreference; -import android.preference.Preference; -import android.preference.PreferenceActivity; - -public class AriesParts extends PreferenceActivity { - - public static final String KEY_COLOR_TUNING = "color_tuning"; - public static final String KEY_BACKLIGHT_TIMEOUT = "backlight_timeout"; - public static final String KEY_HSPA = "hspa"; - public static final String KEY_TVOUT_ENABLE = "tvout_enable"; - public static final String KEY_TVOUT_SYSTEM = "tvout_system"; - - private ColorTuningPreference mColorTuning; - private ListPreference mBacklightTimeout; - private ListPreference mHspa; - private CheckBoxPreference mTvOutEnable; - private ListPreference mTvOutSystem; - private TvOut mTvOut; - - private BroadcastReceiver mHeadsetReceiver = new BroadcastReceiver() { - - @Override - public void onReceive(Context context, Intent intent) { - int state = intent.getIntExtra("state", 0); - updateTvOutEnable(state != 0); - } - - }; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - addPreferencesFromResource(R.xml.main); - - mColorTuning = (ColorTuningPreference) findPreference(KEY_COLOR_TUNING); - mColorTuning.setEnabled(ColorTuningPreference.isSupported()); - - mBacklightTimeout = (ListPreference) findPreference(KEY_BACKLIGHT_TIMEOUT); - mBacklightTimeout.setEnabled(TouchKeyBacklightTimeout.isSupported()); - mBacklightTimeout.setOnPreferenceChangeListener(new TouchKeyBacklightTimeout()); - - mHspa = (ListPreference) findPreference(KEY_HSPA); - mHspa.setEnabled(Hspa.isSupported()); - mHspa.setOnPreferenceChangeListener(new Hspa(this)); - - mTvOut = new TvOut(); - mTvOutEnable = (CheckBoxPreference) findPreference(KEY_TVOUT_ENABLE); - mTvOutEnable.setChecked(mTvOut._isEnabled()); - - mTvOutEnable.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - boolean enable = (Boolean) newValue; - Intent i = new Intent(AriesParts.this, TvOutService.class); - i.putExtra(TvOutService.EXTRA_COMMAND, enable ? TvOutService.COMMAND_ENABLE : TvOutService.COMMAND_DISABLE); - startService(i); - return true; - } - - }); - - mTvOutSystem = (ListPreference) findPreference(KEY_TVOUT_SYSTEM); - mTvOutSystem.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (mTvOut._isEnabled()) { - int newSystem = Integer.valueOf((String) newValue); - Intent i = new Intent(AriesParts.this, TvOutService.class); - i.putExtra(TvOutService.EXTRA_COMMAND, TvOutService.COMMAND_CHANGE_SYSTEM); - i.putExtra(TvOutService.EXTRA_SYSTEM, newSystem); - startService(i); - } - return true; - } - - }); - } - - @Override - protected void onResume() { - super.onResume(); - registerReceiver(mHeadsetReceiver, new IntentFilter(Intent.ACTION_HEADSET_PLUG)); - } - - @Override - protected void onPause() { - super.onPause(); - unregisterReceiver(mHeadsetReceiver); - } - - private void updateTvOutEnable(boolean connected) { - mTvOutEnable.setEnabled(connected); - mTvOutEnable.setSummaryOff(connected ? R.string.tvout_enable_summary : R.string.tvout_enable_summary_nocable); - - if (!connected && mTvOutEnable.isChecked()) { - // Disable on unplug (UI) - mTvOutEnable.setChecked(false); - } - } - - @Override - protected void onDestroy() { - mTvOut.finalize(); - super.onDestroy(); - } - -} diff --git a/AriesParts/src/com/cyanogenmod/settings/device/DeviceSettings.java b/AriesParts/src/com/cyanogenmod/settings/device/DeviceSettings.java new file mode 100644 index 0000000..8cb2555 --- /dev/null +++ b/AriesParts/src/com/cyanogenmod/settings/device/DeviceSettings.java @@ -0,0 +1,118 @@ +package com.cyanogenmod.settings.device; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.hardware.TvOut; +import android.os.Bundle; +import android.preference.CheckBoxPreference; +import android.preference.ListPreference; +import android.preference.Preference; +import android.preference.PreferenceActivity; + +public class DeviceSettings extends PreferenceActivity { + + public static final String KEY_COLOR_TUNING = "color_tuning"; + public static final String KEY_BACKLIGHT_TIMEOUT = "backlight_timeout"; + public static final String KEY_HSPA = "hspa"; + public static final String KEY_TVOUT_ENABLE = "tvout_enable"; + public static final String KEY_TVOUT_SYSTEM = "tvout_system"; + + private ColorTuningPreference mColorTuning; + private ListPreference mBacklightTimeout; + private ListPreference mHspa; + private CheckBoxPreference mTvOutEnable; + private ListPreference mTvOutSystem; + private TvOut mTvOut; + + private BroadcastReceiver mHeadsetReceiver = new BroadcastReceiver() { + + @Override + public void onReceive(Context context, Intent intent) { + int state = intent.getIntExtra("state", 0); + updateTvOutEnable(state != 0); + } + + }; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.main); + + mColorTuning = (ColorTuningPreference) findPreference(KEY_COLOR_TUNING); + mColorTuning.setEnabled(ColorTuningPreference.isSupported()); + + mBacklightTimeout = (ListPreference) findPreference(KEY_BACKLIGHT_TIMEOUT); + mBacklightTimeout.setEnabled(TouchKeyBacklightTimeout.isSupported()); + mBacklightTimeout.setOnPreferenceChangeListener(new TouchKeyBacklightTimeout()); + + mHspa = (ListPreference) findPreference(KEY_HSPA); + mHspa.setEnabled(Hspa.isSupported()); + mHspa.setOnPreferenceChangeListener(new Hspa(this)); + + mTvOut = new TvOut(); + mTvOutEnable = (CheckBoxPreference) findPreference(KEY_TVOUT_ENABLE); + mTvOutEnable.setChecked(mTvOut._isEnabled()); + + mTvOutEnable.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { + + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + boolean enable = (Boolean) newValue; + Intent i = new Intent(DeviceSettings.this, TvOutService.class); + i.putExtra(TvOutService.EXTRA_COMMAND, enable ? TvOutService.COMMAND_ENABLE : TvOutService.COMMAND_DISABLE); + startService(i); + return true; + } + + }); + + mTvOutSystem = (ListPreference) findPreference(KEY_TVOUT_SYSTEM); + mTvOutSystem.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { + + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + if (mTvOut._isEnabled()) { + int newSystem = Integer.valueOf((String) newValue); + Intent i = new Intent(DeviceSettings.this, TvOutService.class); + i.putExtra(TvOutService.EXTRA_COMMAND, TvOutService.COMMAND_CHANGE_SYSTEM); + i.putExtra(TvOutService.EXTRA_SYSTEM, newSystem); + startService(i); + } + return true; + } + + }); + } + + @Override + protected void onResume() { + super.onResume(); + registerReceiver(mHeadsetReceiver, new IntentFilter(Intent.ACTION_HEADSET_PLUG)); + } + + @Override + protected void onPause() { + super.onPause(); + unregisterReceiver(mHeadsetReceiver); + } + + private void updateTvOutEnable(boolean connected) { + mTvOutEnable.setEnabled(connected); + mTvOutEnable.setSummaryOff(connected ? R.string.tvout_enable_summary : R.string.tvout_enable_summary_nocable); + + if (!connected && mTvOutEnable.isChecked()) { + // Disable on unplug (UI) + mTvOutEnable.setChecked(false); + } + } + + @Override + protected void onDestroy() { + mTvOut.finalize(); + super.onDestroy(); + } + +} diff --git a/AriesParts/src/com/cyanogenmod/settings/device/Hspa.java b/AriesParts/src/com/cyanogenmod/settings/device/Hspa.java index 779e733..d866309 100644 --- a/AriesParts/src/com/cyanogenmod/settings/device/Hspa.java +++ b/AriesParts/src/com/cyanogenmod/settings/device/Hspa.java @@ -30,7 +30,7 @@ public class Hspa implements OnPreferenceChangeListener { } SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); - sendIntent(context, sharedPrefs.getString(AriesParts.KEY_HSPA, "23")); + sendIntent(context, sharedPrefs.getString(DeviceSettings.KEY_HSPA, "23")); } @Override diff --git a/AriesParts/src/com/cyanogenmod/settings/device/TouchKeyBacklightTimeout.java b/AriesParts/src/com/cyanogenmod/settings/device/TouchKeyBacklightTimeout.java index 0bcb0fd..2f8beda 100644 --- a/AriesParts/src/com/cyanogenmod/settings/device/TouchKeyBacklightTimeout.java +++ b/AriesParts/src/com/cyanogenmod/settings/device/TouchKeyBacklightTimeout.java @@ -24,7 +24,7 @@ public class TouchKeyBacklightTimeout implements OnPreferenceChangeListener { } SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); - Utils.writeValue(FILE, sharedPrefs.getString(AriesParts.KEY_BACKLIGHT_TIMEOUT, "1600")); + Utils.writeValue(FILE, sharedPrefs.getString(DeviceSettings.KEY_BACKLIGHT_TIMEOUT, "1600")); } @Override diff --git a/AriesParts/src/com/cyanogenmod/settings/device/TvOutService.java b/AriesParts/src/com/cyanogenmod/settings/device/TvOutService.java index 5392669..408587d 100644 --- a/AriesParts/src/com/cyanogenmod/settings/device/TvOutService.java +++ b/AriesParts/src/com/cyanogenmod/settings/device/TvOutService.java @@ -92,7 +92,7 @@ public class TvOutService extends Service { if (intent != null) { String command = intent.getStringExtra("command"); if (COMMAND_ENABLE.equals(command)) { - mSystem = Integer.parseInt(mPref.getString(AriesParts.KEY_TVOUT_SYSTEM, "2")); // Default = PAL + mSystem = Integer.parseInt(mPref.getString(DeviceSettings.KEY_TVOUT_SYSTEM, "2")); // Default = PAL enable(); } else if (COMMAND_DISABLE.equals(command)) { -- cgit v1.1