diff options
| author | Wysie <sohyuanchin@gmail.com> | 2010-05-23 18:46:43 +0800 |
|---|---|---|
| committer | Wysie <sohyuanchin@gmail.com> | 2010-05-23 18:46:43 +0800 |
| commit | bde93944d161026a93e7f6f40309ef02aab6ae95 (patch) | |
| tree | 822bde5822e7f0cfbd641a03994ab42c81e63e65 | |
| parent | ee43e18edb00f42f334425e90ac480c57c49754d (diff) | |
| download | android_development-bde93944d161026a93e7f6f40309ef02aab6ae95.tar.gz android_development-bde93944d161026a93e7f6f40309ef02aab6ae95.tar.bz2 android_development-bde93944d161026a93e7f6f40309ef02aab6ae95.zip | |
Added settings to change notification items colours. Also re-organized the options a little.
| -rw-r--r-- | apps/SpareParts/res/values/strings.xml | 30 | ||||
| -rw-r--r-- | apps/SpareParts/res/xml/spare_parts.xml | 155 | ||||
| -rw-r--r-- | apps/SpareParts/src/com/android/spare_parts/SpareParts.java | 44 |
3 files changed, 159 insertions, 70 deletions
diff --git a/apps/SpareParts/res/values/strings.xml b/apps/SpareParts/res/values/strings.xml index 349c941bd..6f89e91cc 100644 --- a/apps/SpareParts/res/values/strings.xml +++ b/apps/SpareParts/res/values/strings.xml @@ -87,16 +87,26 @@ <!-- Sound & display settings screen, compatibility mode option summary text when check box is clear --> <string name="compatibility_mode_summary_off">Run older apps in Compatibility mode. This require rebooting. </string> - <string name="title_ui_tweaks">User interface tweaks</string> - <string name="title_clock_color">Clock color</string> - <string name="title_date_color">Date color</string> - <string name="title_notifications_ticker_color">New notifications ticker color</string> - <string name="title_no_notifications_color">No notification color</string> - <string name="title_ongoing_notifications_color">Ongoing notifications title color</string> - <string name="title_latest_notifications_color">Latest notifications title color</string> - <string name="title_spn_label_color">SPN label color</string> - <string name="title_plmn_label_color">PLMN label color</string> - <string name="title_clear_button_label_color">Clear label color</string> + <string name="title_ui_tweaks">User interface color tweaks</string> + + <string name="title_general_color_tweaks">General</string> + <string name="summary_general_color_tweaks">Clock, date, carrier, etc.</string> + <string name="title_clock_color">Clock</string> + <string name="title_date_color">Date</string> + <string name="title_spn_label_color">Carrier SPN label</string> + <string name="title_plmn_label_color">Carrier PLMN label</string> + + <string name="title_notifications_color_tweaks">Notifications</string> + <string name="summary_notifications_color_tweaks">Notifications ticker, ongoing notifications, latest notifications, clear notifications, etc.</string> + <string name="title_notifications_ticker_color">Notifications ticker</string> + <string name="title_no_notifications_color">No notification title</string> + <string name="title_clear_button_label_color">Clear notifications label</string> + <string name="title_ongoing_notifications_color">Ongoing notifications title</string> + <string name="title_latest_notifications_color">Latest notifications title</string> + <string name="title_notifications_items">Notification items</string> + <string name="title_notifications_items_title">Items title</string> + <string name="title_notifications_items_text">Items text</string> + <string name="title_notifications_items_time">Items time</string> <string name="dialog_title_color">Select a color</string> diff --git a/apps/SpareParts/res/xml/spare_parts.xml b/apps/SpareParts/res/xml/spare_parts.xml index 0a66501bd..b376e194d 100644 --- a/apps/SpareParts/res/xml/spare_parts.xml +++ b/apps/SpareParts/res/xml/spare_parts.xml @@ -153,68 +153,105 @@ <PreferenceCategory android:title="@string/title_ui_tweaks"> - <ListPreference - android:key="clock_color" - android:title="@string/title_clock_color" - android:dialogTitle="@string/dialog_title_color" - android:entries="@array/colors" - android:entryValues="@array/colors_values" /> + <PreferenceScreen + android:title="@string/title_general_color_tweaks" + android:summary="@string/summary_general_color_tweaks"> + + <ListPreference + android:key="clock_color" + android:title="@string/title_clock_color" + android:dialogTitle="@string/dialog_title_color" + android:entries="@array/colors" + android:entryValues="@array/colors_values" /> - <ListPreference - android:key="date_color" - android:title="@string/title_date_color" - android:dialogTitle="@string/dialog_title_color" - android:entries="@array/colors" - android:entryValues="@array/colors_values" /> - - <ListPreference - android:key="new_notifications_ticker_color" - android:title="@string/title_notifications_ticker_color" - android:dialogTitle="@string/dialog_title_color" - android:entries="@array/colors" - android:entryValues="@array/colors_values" /> - - <ListPreference - android:key="no_notifications_color" - android:title="@string/title_no_notifications_color" - android:dialogTitle="@string/dialog_title_color" - android:entries="@array/colors" - android:entryValues="@array/colors_values" /> - - <ListPreference - android:key="ongoing_notifications_color" - android:title="@string/title_ongoing_notifications_color" - android:dialogTitle="@string/dialog_title_color" - android:entries="@array/colors" - android:entryValues="@array/colors_values" /> - - <ListPreference - android:key="latest_notifications_color" - android:title="@string/title_latest_notifications_color" - android:dialogTitle="@string/dialog_title_color" - android:entries="@array/colors" - android:entryValues="@array/colors_values" /> - - <ListPreference - android:key="spn_label_color" - android:title="@string/title_spn_label_color" - android:dialogTitle="@string/dialog_title_color" - android:entries="@array/colors" - android:entryValues="@array/colors_values" /> + <ListPreference + android:key="date_color" + android:title="@string/title_date_color" + android:dialogTitle="@string/dialog_title_color" + android:entries="@array/colors" + android:entryValues="@array/colors_values" /> + + <ListPreference + android:key="spn_label_color" + android:title="@string/title_spn_label_color" + android:dialogTitle="@string/dialog_title_color" + android:entries="@array/colors" + android:entryValues="@array/colors_values" /> - <ListPreference - android:key="plmn_label_color" - android:title="@string/title_plmn_label_color" - android:dialogTitle="@string/dialog_title_color" - android:entries="@array/colors" - android:entryValues="@array/colors_values" /> + <ListPreference + android:key="plmn_label_color" + android:title="@string/title_plmn_label_color" + android:dialogTitle="@string/dialog_title_color" + android:entries="@array/colors" + android:entryValues="@array/colors_values" /> + + </PreferenceScreen> + + <PreferenceScreen + android:title="@string/title_notifications_color_tweaks" + android:summary="@string/summary_notifications_color_tweaks"> - <ListPreference - android:key="clear_button_label_color" - android:title="@string/title_clear_button_label_color" - android:dialogTitle="@string/dialog_title_color" - android:entries="@array/colors" - android:entryValues="@array/colors_values" /> + <ListPreference + android:key="new_notifications_ticker_color" + android:title="@string/title_notifications_ticker_color" + android:dialogTitle="@string/dialog_title_color" + android:entries="@array/colors" + android:entryValues="@array/colors_values" /> + + <ListPreference + android:key="no_notifications_color" + android:title="@string/title_no_notifications_color" + android:dialogTitle="@string/dialog_title_color" + android:entries="@array/colors" + android:entryValues="@array/colors_values" /> + + <ListPreference + android:key="clear_button_label_color" + android:title="@string/title_clear_button_label_color" + android:dialogTitle="@string/dialog_title_color" + android:entries="@array/colors" + android:entryValues="@array/colors_values" /> + + <ListPreference + android:key="ongoing_notifications_color" + android:title="@string/title_ongoing_notifications_color" + android:dialogTitle="@string/dialog_title_color" + android:entries="@array/colors" + android:entryValues="@array/colors_values" /> + + <ListPreference + android:key="latest_notifications_color" + android:title="@string/title_latest_notifications_color" + android:dialogTitle="@string/dialog_title_color" + android:entries="@array/colors" + android:entryValues="@array/colors_values" /> + + <PreferenceCategory + android:title="@string/title_notifications_items"> + + <ListPreference + android:key="notifications_title_color" + android:title="@string/title_notifications_items_title" + android:dialogTitle="@string/dialog_title_color" + android:entries="@array/colors" + android:entryValues="@array/colors_values" /> + + <ListPreference + android:key="notifications_text_color" + android:title="@string/title_notifications_items_text" + android:dialogTitle="@string/dialog_title_color" + android:entries="@array/colors" + android:entryValues="@array/colors_values" /> + + <ListPreference + android:key="notifications_time_color" + android:title="@string/title_notifications_items_time" + android:dialogTitle="@string/dialog_title_color" + android:entries="@array/colors" + android:entryValues="@array/colors_values" /> + + </PreferenceCategory> + </PreferenceScreen> </PreferenceCategory> diff --git a/apps/SpareParts/src/com/android/spare_parts/SpareParts.java b/apps/SpareParts/src/com/android/spare_parts/SpareParts.java index aa1fafcc7..bc91cbfd8 100644 --- a/apps/SpareParts/src/com/android/spare_parts/SpareParts.java +++ b/apps/SpareParts/src/com/android/spare_parts/SpareParts.java @@ -73,6 +73,9 @@ public class SpareParts extends PreferenceActivity private static final String UI_CLEAR_LABEL_COLOR = "clear_button_label_color"; //private static final String UI_BATTERY_PERCENT_COLOR = "battery_status_color_title"; private static final String UI_NOTIF_TICKER_COLOR = "new_notifications_ticker_color"; + private static final String UI_NOTIF_ITEM_TITLE_COLOR = "notifications_title_color"; + private static final String UI_NOTIF_ITEM_TEXT_COLOR = "notifications_text_color"; + private static final String UI_NOTIF_ITEM_TIME_COLOR = "notifications_time_color"; private final Configuration mCurConfig = new Configuration(); @@ -88,6 +91,9 @@ public class SpareParts extends PreferenceActivity private ListPreference mClearLabelColorPref; private ListPreference mNotifTickerColor; //private ListPreference mBatteryPercentColorPreference; + private ListPreference mNotifItemTitlePref; + private ListPreference mNotifItemTextPref; + private ListPreference mNotifItemTimePref; private ListPreference mWindowAnimationsPref; private ListPreference mTransitionAnimationsPref; @@ -188,7 +194,13 @@ public class SpareParts extends PreferenceActivity //mBatteryPercentColorPreference = (ListPreference) prefSet.findPreference(UI_BATTERY_PERCENT_COLOR); //mBatteryPercentColorPreference.setOnPreferenceChangeListener(this); mNotifTickerColor = (ListPreference) prefSet.findPreference(UI_NOTIF_TICKER_COLOR); - mNotifTickerColor.setOnPreferenceChangeListener(this); + mNotifTickerColor.setOnPreferenceChangeListener(this); + mNotifItemTitlePref = (ListPreference) prefSet.findPreference(UI_NOTIF_ITEM_TITLE_COLOR); + mNotifItemTitlePref.setOnPreferenceChangeListener(this); + mNotifItemTextPref = (ListPreference) prefSet.findPreference(UI_NOTIF_ITEM_TEXT_COLOR); + mNotifItemTextPref.setOnPreferenceChangeListener(this); + mNotifItemTimePref = (ListPreference) prefSet.findPreference(UI_NOTIF_ITEM_TIME_COLOR); + mNotifItemTimePref.setOnPreferenceChangeListener(this); if (!isSwapEnabled()) { prefSet.removePreference(mCompcachePref); @@ -265,6 +277,12 @@ public class SpareParts extends PreferenceActivity // writeBatteryPercentColorPreference(objValue); } else if (preference == mNotifTickerColor) { writeTickerNotifColorPreference(objValue); + } else if (preference == mNotifItemTitlePref) { + writeNotifItemTitleColorPreference(objValue); + } else if (preference == mNotifItemTextPref) { + writeNotifItemTextColorPreference(objValue); + } else if (preference == mNotifItemTimePref) { + writeNotifItemTimeColorPreference(objValue); } // always let the preference setting proceed. @@ -392,6 +410,30 @@ public class SpareParts extends PreferenceActivity } } + public void writeNotifItemTitleColorPreference(Object objValue) { + try { + int val = Integer.parseInt(objValue.toString()); + Settings.System.putInt(getContentResolver(), Settings.System.NOTIF_ITEM_TITLE_COLOR, val); + } catch (NumberFormatException e) { + } + } + + public void writeNotifItemTextColorPreference(Object objValue) { + try { + int val = Integer.parseInt(objValue.toString()); + Settings.System.putInt(getContentResolver(), Settings.System.NOTIF_ITEM_TEXT_COLOR, val); + } catch (NumberFormatException e) { + } + } + + public void writeNotifItemTimeColorPreference(Object objValue) { + try { + int val = Integer.parseInt(objValue.toString()); + Settings.System.putInt(getContentResolver(), Settings.System.NOTIF_ITEM_TIME_COLOR, val); + } catch (NumberFormatException e) { + } + } + int floatToIndex(float val, int resid) { String[] indices = getResources().getStringArray(resid); float lastVal = Float.parseFloat(indices[0]); |
