@@ -54,6 +54,8 @@ public class SpareParts extends PreferenceActivity
54
54
//extra
55
55
private static final String MENU_UNLOCK_SCREEN_PREF = "menu_unlock_screen" ;
56
56
private static final String LAUNCHER_ORIENTATION_PREF = "launcher_orientation" ;
57
+ private static final String CLOCK_COLOR_PREF = "clock_color" ;
58
+ private static final String BATTERY_COLOR_PREF = "battery_color" ;
57
59
//end extra
58
60
59
61
private static final String WINDOW_ANIMATIONS_PREF = "window_animations" ;
@@ -69,6 +71,8 @@ public class SpareParts extends PreferenceActivity
69
71
//extra
70
72
private CheckBoxPreference mMenuUnlockScreenPref ;
71
73
private CheckBoxPreference mLauncherOrientationPref ;
74
+ private Preference mClockColorPref ;
75
+ private Preference mBatteryColorPref ;
72
76
//end extra
73
77
74
78
private ListPreference mWindowAnimationsPref ;
@@ -126,6 +130,8 @@ public void onCreate(Bundle icicle) {
126
130
//extra
127
131
mMenuUnlockScreenPref = (CheckBoxPreference ) prefSet .findPreference (MENU_UNLOCK_SCREEN_PREF );
128
132
mLauncherOrientationPref = (CheckBoxPreference ) prefSet .findPreference (LAUNCHER_ORIENTATION_PREF );
133
+ mClockColorPref = prefSet .findPreference (CLOCK_COLOR_PREF );
134
+ mBatteryColorPref = prefSet .findPreference (BATTERY_COLOR_PREF );
129
135
//end extra
130
136
131
137
mWindowAnimationsPref = (ListPreference ) prefSet .findPreference (WINDOW_ANIMATIONS_PREF );
@@ -195,6 +201,20 @@ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preferen
195
201
mCompatibilityMode .isChecked () ? 1 : 0 );
196
202
return true ;
197
203
}
204
+ //extra
205
+ else if (preference == mClockColorPref ) {
206
+ ColorPickerDialog cp = new ColorPickerDialog (this ,
207
+ mClockFontColorListener ,
208
+ readClockFontColor ());
209
+ cp .show ();
210
+ }
211
+ else if (preference == mBatteryColorPref ) {
212
+ ColorPickerDialog cp = new ColorPickerDialog (this ,
213
+ mBatteryFontColorListener ,
214
+ readBatteryFontColor ());
215
+ cp .show ();
216
+ }
217
+ //end extra
198
218
return false ;
199
219
}
200
220
@@ -264,6 +284,37 @@ public void readEndButtonPreference(ListPreference pref) {
264
284
}
265
285
}
266
286
287
+ //extra
288
+ private int readClockFontColor () {
289
+ try {
290
+ return Settings .System .getInt (getContentResolver (), Settings .System .CLOCK_COLOR );
291
+ }
292
+ catch (SettingNotFoundException e ) {
293
+ return -16777216 ;
294
+ }
295
+ }
296
+ ColorPickerDialog .OnColorChangedListener mClockFontColorListener =
297
+ new ColorPickerDialog .OnColorChangedListener () {
298
+ public void colorChanged (int color ) {
299
+ Settings .System .putInt (getContentResolver (), Settings .System .CLOCK_COLOR , color );
300
+ }
301
+ };
302
+ private int readBatteryFontColor () {
303
+ try {
304
+ return Settings .System .getInt (getContentResolver (), Settings .System .BATTERY_COLOR );
305
+ }
306
+ catch (SettingNotFoundException e ) {
307
+ return -1 ;
308
+ }
309
+ }
310
+ ColorPickerDialog .OnColorChangedListener mBatteryFontColorListener =
311
+ new ColorPickerDialog .OnColorChangedListener () {
312
+ public void colorChanged (int color ) {
313
+ Settings .System .putInt (getContentResolver (), Settings .System .BATTERY_COLOR , color );
314
+ }
315
+ };
316
+ //end extra
317
+
267
318
public void onSharedPreferenceChanged (SharedPreferences preferences , String key ) {
268
319
//extra
269
320
if (MENU_UNLOCK_SCREEN_PREF .equals (key )) {
0 commit comments