Cherish: date right/left position [2/2]
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
@@ -64,6 +64,7 @@ public class ClockSettings extends SettingsPreferenceFragment implements
|
||||
public static final int CLOCK_DATE_STYLE_LOWERCASE = 1;
|
||||
public static final int CLOCK_DATE_STYLE_UPPERCASE = 2;
|
||||
private static final int CUSTOM_CLOCK_DATE_FORMAT_INDEX = 18;
|
||||
private static final String STATUS_BAR_CLOCK_DATE_POSITION = "statusbar_clock_date_position";
|
||||
|
||||
static final int DEFAULT_STATUS_CLOCK_COLOR = 0xffffffff;
|
||||
|
||||
@@ -77,6 +78,7 @@ public class ClockSettings extends SettingsPreferenceFragment implements
|
||||
private ColorPickerPreference mClockColor;
|
||||
private CustomSeekBarPreference mClockSize;
|
||||
private ListPreference mClockFontStyle;
|
||||
private ListPreference mClockDatePosition;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
@@ -95,6 +97,7 @@ public class ClockSettings extends SettingsPreferenceFragment implements
|
||||
mStatusBarAmPm = (ListPreference) findPreference(STATUS_BAR_AM_PM);
|
||||
mClockDateDisplay = (ListPreference) findPreference(STATUS_BAR_CLOCK_DATE_DISPLAY);
|
||||
mClockDateStyle = (ListPreference) findPreference(STATUS_BAR_CLOCK_DATE_STYLE);
|
||||
mClockDatePosition = (ListPreference) findPreference(STATUS_BAR_CLOCK_DATE_POSITION);
|
||||
|
||||
mStatusBarClockShow.setChecked((Settings.System.getInt(resolver,
|
||||
Settings.System.STATUS_BAR_CLOCK, 1) == 1));
|
||||
@@ -168,6 +171,18 @@ public class ClockSettings extends SettingsPreferenceFragment implements
|
||||
}
|
||||
|
||||
parseClockDateFormats();
|
||||
|
||||
mClockDatePosition.setValue(Integer.toString(Settings.System.getInt(getActivity()
|
||||
.getContentResolver(), Settings.System.STATUSBAR_CLOCK_DATE_POSITION,
|
||||
0)));
|
||||
mClockDatePosition.setSummary(mClockDatePosition.getEntry());
|
||||
mClockDatePosition.setOnPreferenceChangeListener(this);
|
||||
|
||||
int clockDatePosition = Settings.System.getInt(resolver,
|
||||
Settings.System.STATUSBAR_CLOCK_DATE_POSITION, 0);
|
||||
mClockDatePosition.setValue(String.valueOf(clockDatePosition));
|
||||
mClockDatePosition.setSummary(mClockDatePosition.getEntry());
|
||||
mClockDatePosition.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -237,9 +252,11 @@ public class ClockSettings extends SettingsPreferenceFragment implements
|
||||
if (clockDateDisplay == 0) {
|
||||
mClockDateStyle.setEnabled(false);
|
||||
mClockDateFormat.setEnabled(false);
|
||||
mClockDatePosition.setEnabled(false);
|
||||
} else {
|
||||
mClockDateStyle.setEnabled(true);
|
||||
mClockDateFormat.setEnabled(true);
|
||||
mClockDatePosition.setEnabled(true);
|
||||
}
|
||||
return true;
|
||||
} else if (preference == mClockDateStyle) {
|
||||
@@ -295,6 +312,14 @@ public class ClockSettings extends SettingsPreferenceFragment implements
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (preference == mClockDatePosition) {
|
||||
int val = Integer.parseInt((String) newValue);
|
||||
int index = mClockDatePosition.findIndexOfValue((String) newValue);
|
||||
Settings.System.putInt(getActivity().getContentResolver(),
|
||||
Settings.System.STATUSBAR_CLOCK_DATE_POSITION, val);
|
||||
mClockDatePosition.setSummary(mClockDatePosition.getEntries()[index]);
|
||||
parseClockDateFormats();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user