Cherish: date right/left position [2/2]
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
@@ -757,4 +757,14 @@
|
||||
<item>EEEE MM/dd</item>
|
||||
<item>@string/clock_date_format_custom</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="clock_date_position_entries" translatable="false">
|
||||
<item>@string/clock_date_left</item>
|
||||
<item>@string/clock_date_right</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="clock_date_position_values" translatable="false">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
||||
@@ -783,5 +783,8 @@
|
||||
<string name="status_bar_clock_font_style_title">Clock font style</string>
|
||||
<string name="status_bar_clock_font_size_title">Clock font size</string>
|
||||
<string name="status_bar_clock_color_title">Clock font color</string>
|
||||
|
||||
<string name="clock_date_right">Right of time</string>
|
||||
<string name="clock_date_left">Left of time</string>
|
||||
<string name="clock_date_position">Date position</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -58,6 +58,14 @@
|
||||
android:entryValues="@array/clock_date_display_values"
|
||||
android:dependency="status_bar_clock" />
|
||||
|
||||
<ListPreference
|
||||
android:key="statusbar_clock_date_position"
|
||||
android:title="@string/clock_date_position"
|
||||
android:icon="@drawable/ic_qs"
|
||||
android:entries="@array/clock_date_position_entries"
|
||||
android:entryValues="@array/clock_date_position_values"
|
||||
android:dependency="clock_date_display" />
|
||||
|
||||
<ListPreference
|
||||
android:key="clock_date_style"
|
||||
android:icon="@drawable/ic_font"
|
||||
|
||||
@@ -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