OmniGears: statusbar clock and date customization (2/2)
Change-Id: Ifcfd582215ba337efb4d63c19e780b88889f66a8
diff --git a/res/values/custom_arrays.xml b/res/values/custom_arrays.xml
index d8621aa..d858e75 100644
--- a/res/values/custom_arrays.xml
+++ b/res/values/custom_arrays.xml
@@ -540,64 +540,48 @@
<item>2</item>
</string-array>
- <!-- Statusbar Clock options -->
- <string-array name="clock_style_entries" translatable="false">
- <item>@string/right_clock</item>
- <item>@string/left_clock</item>
+ <!-- Statusbar Clock -->
+ <string-array name="status_bar_clock_style_entries" translatable="false">
+ <item>@string/status_bar_clock_style_left</item>
+ <item>@string/status_bar_clock_style_center</item>
+ <item>@string/status_bar_clock_style_right</item>
</string-array>
-
- <string-array name="clock_style_values" translatable="false">
- <item>0</item>
- <item>1</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>
-
- <string-array name="entries_status_bar_am_pm">
- <item>@string/am_pm_clock_none</item>
- <item>@string/am_pm_clock_small</item>
- <item>@string/am_pm_clock_normal</item>
- </string-array>
-
- <string-array name="values_status_bar_am_pm" translatable="false">
+ <string-array name="status_bar_clock_style_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
-
- <string-array name="clock_date_display_entries">
+ <string-array name="status_bar_am_pm_entries" translatable="false">
+ <item>@string/status_bar_am_pm_hidden</item>
+ <item>@string/status_bar_am_pm_small</item>
+ <item>@string/status_bar_am_pm_normal</item>
+ </string-array>
+ <string-array name="status_bar_am_pm_values" translatable="false">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ </string-array>
+ <string-array name="clock_date_display_entries">
<item>@string/clock_date_display_none</item>
<item>@string/clock_date_display_small</item>
<item>@string/clock_date_display_normal</item>
</string-array>
-
- <string-array name="clock_date_display_values" translatable="false">
+ <string-array name="clock_date_display_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
-
- <string-array name="clock_date_style_entries">
+ <string-array name="clock_date_style_entries">
<item>@string/clock_date_style_normal</item>
<item>@string/clock_date_style_lowercase</item>
<item>@string/clock_date_style_uppercase</item>
</string-array>
-
- <string-array name="clock_date_style_values" translatable="false">
+ <string-array name="clock_date_style_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
-
- <string-array name="clock_date_format_entries_values">
+ <string-array name="clock_date_format_entries_values">
<item>dd/MM/yy</item>
<item>MM/dd/yy</item>
<item>yyyy-MM-dd</item>
diff --git a/res/values/custom_strings.xml b/res/values/custom_strings.xml
index a75b527..d8d9ce3 100644
--- a/res/values/custom_strings.xml
+++ b/res/values/custom_strings.xml
@@ -655,39 +655,32 @@
<string name="battery_percent_always">Always</string>
<string name="battery_percent_expanded">Only when expanded</string>
- <string name="status_bar_clock">Clock & Date</string>
- <string name="clock_title_enable">Alignment</string>
- <string name="clock_enabled">Enabled</string>
- <string name="clock_disabled">Disabled</string>
- <string name="status_bar_clock_style_reset">Reset color</string>
- <string name="status_bar_show_clock_title">Show clock & date</string>
- <string name="status_bar_am_pm_title">AM/PM</string>
+ <!-- Statusbar Clock -->
+ <string name="status_bar_clock_title">Clock settings</string>
+ <string name="status_bar_clock_show">Show clock and date</string>
+ <string name="status_bar_clock_style_title">Clock style</string>
+ <string name="status_bar_clock_style_right">Right</string>
+ <string name="status_bar_clock_style_center">Center</string>
+ <string name="status_bar_clock_style_left">Left</string>
+ <string name="status_bar_am_pm_title">AM/PM style</string>
<string name="status_bar_am_pm_info">24-hour clock is enabled</string>
- <string name="enable_clock_weekday">Day of the week</string>
- <string name="enable_clock_weekday_summary">Abbreviated day of the week before the time</string>
- <string name="right_clock">Right clock</string>
- <string name="left_clock">Left clock</string>
- <string name="dont_show">Don\'t show</string>
+ <string name="status_bar_am_pm_normal">Normal</string>
+ <string name="status_bar_am_pm_small">Small</string>
+ <string name="status_bar_am_pm_hidden">Hidden (default)</string>
+ <string name="clock_seconds_display">Show seconds</string>
<string name="clock_date_display">Date</string>
<string name="clock_date_display_summary">Display custom date before the clock</string>
- <string name="clock_date_style">Date style</string>
- <string name="clock_date_position">Date position</string>
- <string name="clock_date_format">Date format</string>
- <string name="clock_date_string_edittext_title">Must be in DateFormat eg. MM/dd/yy</string>
- <string name="clock_date_string_edittext_summary">Enter string</string>
- <string name="clock_date_right">Right of time</string>
- <string name="clock_date_left">Left of time</string>
- <string name="am_pm_clock_normal">Normal font size</string>
- <string name="am_pm_clock_small">Small font size</string>
- <string name="am_pm_clock_none">Don\'t show</string>
<string name="clock_date_display_none">Don\'t show</string>
<string name="clock_date_display_small">Small font size</string>
<string name="clock_date_display_normal">Normal font size</string>
+ <string name="clock_date_style">Date style</string>
<string name="clock_date_style_normal">Normal</string>
<string name="clock_date_style_lowercase">Lowercase</string>
<string name="clock_date_style_uppercase">Uppercase</string>
<string name="clock_date_format_custom">Custom java format</string>
- <string name="status_bar_clock_seconds_title">Show seconds</string>
+ <string name="clock_date_format">Date format</string>
+ <string name="clock_date_string_edittext_title">Must be in DateFormat eg. MM/dd/yy</string>
+ <string name="clock_date_string_edittext_summary">Enter string</string>
<!-- fingerprint authentication vibration -->
<string name="fprint_sucess_vib_title">Fingerprint authentication vibration</string>
diff --git a/res/xml/bars_settings.xml b/res/xml/bars_settings.xml
index 32d0cde..93c82dd 100644
--- a/res/xml/bars_settings.xml
+++ b/res/xml/bars_settings.xml
@@ -20,18 +20,58 @@
android:key="bars_settings"
android:title="@string/custom_bars_settings_title" >
- <PreferenceCategory
- android:key="quick_settings_category"
- android:title="@string/quick_settings_category">
+ <PreferenceCategory
+ android:title="@string/status_bar_clock_title">
- <org.omnirom.omnilib.preference.SeekBarPreference
- android:key="qs_panel_alpha"
- android:title="@string/qs_panel_alpha_title"
- android:summary="@string/qs_panel_alpha_summary"
- android:max="100"
- settings:min="0"
- settings:unitsRight="@string/unit_percent"
- android:persistent="false" />
+ <org.omnirom.omnilib.preference.SystemSettingSwitchPreference
+ android:key="status_bar_clock"
+ android:title="@string/status_bar_clock_show"
+ android:defaultValue="true" />
+
+ <ListPreference
+ android:key="statusbar_clock_style"
+ android:title="@string/status_bar_clock_style_title"
+ android:dialogTitle="@string/status_bar_clock_style_title"
+ android:entries="@array/status_bar_clock_style_entries"
+ android:entryValues="@array/status_bar_clock_style_values"
+ android:dependency="status_bar_clock" />
+
+ <ListPreference
+ android:key="status_bar_am_pm"
+ android:title="@string/status_bar_am_pm_title"
+ android:dialogTitle="@string/status_bar_am_pm_title"
+ android:entries="@array/status_bar_am_pm_entries"
+ android:entryValues="@array/status_bar_am_pm_values"
+ android:dependency="status_bar_clock" />
+
+ <org.omnirom.omnilib.preference.SystemSettingSwitchPreference
+ android:key="status_bar_clock_seconds"
+ android:title="@string/clock_seconds_display"
+ android:dependency="status_bar_clock"
+ android:defaultValue="false" />
+
+ <ListPreference
+ android:key="clock_date_display"
+ android:title="@string/clock_date_display"
+ android:summary="@string/clock_date_display_summary"
+ android:entries="@array/clock_date_display_entries"
+ android:entryValues="@array/clock_date_display_values"
+ android:dependency="status_bar_clock" />
+
+ <ListPreference
+ android:key="clock_date_style"
+ android:title="@string/clock_date_style"
+ android:entries="@array/clock_date_style_entries"
+ android:entryValues="@array/clock_date_style_values"
+ android:dependency="clock_date_display" />
+
+ <ListPreference
+ android:key="clock_date_format"
+ android:title="@string/clock_date_format"
+ android:entries="@array/clock_date_format_entries_values"
+ android:entryValues="@array/clock_date_format_entries_values"
+ android:dependency="clock_date_display" />
+
</PreferenceCategory>
<PreferenceCategory
@@ -55,6 +95,20 @@
</PreferenceCategory>
<PreferenceCategory
+ android:key="quick_settings_category"
+ android:title="@string/quick_settings_category">
+
+ <org.omnirom.omnilib.preference.SeekBarPreference
+ android:key="qs_panel_alpha"
+ android:title="@string/qs_panel_alpha_title"
+ android:summary="@string/qs_panel_alpha_summary"
+ android:max="100"
+ settings:min="0"
+ settings:unitsRight="@string/unit_percent"
+ android:persistent="false" />
+ </PreferenceCategory>
+
+ <PreferenceCategory
android:key="statusbar_settings_category"
android:title="@string/statusbar_settings_category">
diff --git a/src/org/omnirom/omnigears/interfacesettings/BarsSettings.java b/src/org/omnirom/omnigears/interfacesettings/BarsSettings.java
index 704982a..2a7a592 100644
--- a/src/org/omnirom/omnigears/interfacesettings/BarsSettings.java
+++ b/src/org/omnirom/omnigears/interfacesettings/BarsSettings.java
@@ -17,12 +17,23 @@
*/
package org.omnirom.omnigears.interfacesettings;
+import android.app.AlertDialog;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnCancelListener;
+import android.content.res.Resources;
+import android.database.ContentObserver;
import android.content.Context;
import android.content.res.Resources;
import android.net.TrafficStats;
import android.os.Bundle;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
+import android.text.format.DateFormat;
+import android.util.Log;
+import android.view.View;
+import android.widget.EditText;
import android.text.TextUtils;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -36,14 +47,17 @@
import com.android.settings.R;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import com.android.settings.Utils;
import org.omnirom.omnilib.preference.AppMultiSelectListPreference;
import org.omnirom.omnilib.preference.ScrollAppsViewPreference;
import org.omnirom.omnilib.preference.SeekBarPreference;
+import org.omnirom.omnilib.preference.SystemSettingSwitchPreference;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Date;
import java.util.List;
public class BarsSettings extends SettingsPreferenceFragment implements
@@ -56,6 +70,17 @@
private static final String KEY_QS_PANEL_ALPHA = "qs_panel_alpha";
private static final String STATUS_BAR_BATTERY_STYLE = "status_bar_battery_style";
private static final String BATTERY_PERCENT = "show_battery_percent";
+ private static final String STATUS_BAR_CLOCK = "status_bar_clock";
+ private static final String STATUS_BAR_CLOCK_SECONDS = "status_bar_clock_seconds";
+ private static final String STATUS_BAR_CLOCK_STYLE = "statusbar_clock_style";
+ private static final String STATUS_BAR_AM_PM = "status_bar_am_pm";
+ private static final String STATUS_BAR_CLOCK_DATE_DISPLAY = "clock_date_display";
+ private static final String STATUS_BAR_CLOCK_DATE_STYLE = "clock_date_style";
+ private static final String STATUS_BAR_CLOCK_DATE_FORMAT = "clock_date_format";
+ 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 AppMultiSelectListPreference mAspectRatioAppsSelect;
private ScrollAppsViewPreference mAspectRatioApps;
@@ -63,6 +88,13 @@
private ListPreference mStatusBarBattery;
private ListPreference mBatteryPercentage;
+ private SystemSettingSwitchPreference mStatusBarClockShow;
+ private SystemSettingSwitchPreference mStatusBarSecondsShow;
+ private ListPreference mStatusBarClock;
+ private ListPreference mStatusBarAmPm;
+ private ListPreference mClockDateDisplay;
+ private ListPreference mClockDateStyle;
+ private ListPreference mClockDateFormat;
@Override
public int getMetricsCategory() {
@@ -75,23 +107,24 @@
addPreferencesFromResource(R.xml.bars_settings);
PreferenceScreen prefScreen = getPreferenceScreen();
+ ContentResolver resolver = getActivity().getContentResolver();
mQsPanelAlpha = (SeekBarPreference) findPreference(KEY_QS_PANEL_ALPHA);
- int qsPanelAlpha = Settings.System.getInt(getContentResolver(),
+ int qsPanelAlpha = Settings.System.getInt(resolver,
Settings.System.OMNI_QS_PANEL_BG_ALPHA, 255);
mQsPanelAlpha.setValue((int)(((double) qsPanelAlpha / 255) * 100));
mQsPanelAlpha.setOnPreferenceChangeListener(this);
// Battery styles
mStatusBarBattery = (ListPreference) findPreference(STATUS_BAR_BATTERY_STYLE);
- int batteryStyle = Settings.Secure.getInt(getContentResolver(),
+ int batteryStyle = Settings.Secure.getInt(resolver,
Settings.Secure.STATUS_BAR_BATTERY_STYLE, 0);
mStatusBarBattery.setValue(String.valueOf(batteryStyle));
mStatusBarBattery.setSummary(mStatusBarBattery.getEntry());
mStatusBarBattery.setOnPreferenceChangeListener(this);
mBatteryPercentage = (ListPreference) findPreference(BATTERY_PERCENT);
- int showPercent = Settings.System.getInt(getContentResolver(),
+ int showPercent = Settings.System.getInt(resolver,
Settings.System.SHOW_BATTERY_PERCENT, 1);
mBatteryPercentage.setValue(Integer.toString(showPercent));
int valueIndex = mBatteryPercentage.findIndexOfValue(String.valueOf(showPercent));
@@ -100,6 +133,59 @@
boolean hideForcePercentage = batteryStyle == 8; /*text*/
mBatteryPercentage.setEnabled(!hideForcePercentage);
+ // clock settings
+ mStatusBarClockShow = (SystemSettingSwitchPreference) findPreference(STATUS_BAR_CLOCK);
+ mStatusBarSecondsShow = (SystemSettingSwitchPreference) findPreference(STATUS_BAR_CLOCK_SECONDS);
+ mStatusBarClock = (ListPreference) findPreference(STATUS_BAR_CLOCK_STYLE);
+ mStatusBarAmPm = (ListPreference) findPreference(STATUS_BAR_AM_PM);
+ mClockDateDisplay = (ListPreference) findPreference(STATUS_BAR_CLOCK_DATE_DISPLAY);
+ mClockDateStyle = (ListPreference) findPreference(STATUS_BAR_CLOCK_DATE_STYLE);
+ mStatusBarClockShow.setChecked((Settings.System.getInt(resolver,
+ Settings.System.STATUS_BAR_CLOCK, 1) == 1));
+ mStatusBarClockShow.setOnPreferenceChangeListener(this);
+ mStatusBarSecondsShow.setChecked((Settings.System.getInt(resolver,
+ Settings.System.STATUS_BAR_CLOCK_SECONDS, 0) == 1));
+ mStatusBarSecondsShow.setOnPreferenceChangeListener(this);
+ int clockStyle = Settings.System.getInt(resolver,
+ Settings.System.STATUSBAR_CLOCK_STYLE, 0);
+ mStatusBarClock.setValue(String.valueOf(clockStyle));
+ mStatusBarClock.setSummary(mStatusBarClock.getEntry());
+ mStatusBarClock.setOnPreferenceChangeListener(this);
+ if (DateFormat.is24HourFormat(getActivity())) {
+ mStatusBarAmPm.setEnabled(false);
+ mStatusBarAmPm.setSummary(R.string.status_bar_am_pm_info);
+ } else {
+ int statusBarAmPm = Settings.System.getInt(resolver,
+ Settings.System.STATUSBAR_CLOCK_AM_PM_STYLE, 2);
+ mStatusBarAmPm.setValue(String.valueOf(statusBarAmPm));
+ mStatusBarAmPm.setSummary(mStatusBarAmPm.getEntry());
+ mStatusBarAmPm.setOnPreferenceChangeListener(this);
+ }
+ int clockDateDisplay = Settings.System.getInt(resolver,
+ Settings.System.STATUSBAR_CLOCK_DATE_DISPLAY, 0);
+ mClockDateDisplay.setValue(String.valueOf(clockDateDisplay));
+ mClockDateDisplay.setSummary(mClockDateDisplay.getEntry());
+ mClockDateDisplay.setOnPreferenceChangeListener(this);
+ int clockDateStyle = Settings.System.getInt(resolver,
+ Settings.System.STATUSBAR_CLOCK_DATE_STYLE, 0);
+ mClockDateStyle.setValue(String.valueOf(clockDateStyle));
+ mClockDateStyle.setSummary(mClockDateStyle.getEntry());
+ mClockDateStyle.setOnPreferenceChangeListener(this);
+ mClockDateFormat = (ListPreference) findPreference(STATUS_BAR_CLOCK_DATE_FORMAT);
+ mClockDateFormat.setOnPreferenceChangeListener(this);
+ String value = Settings.System.getString(getActivity().getContentResolver(),
+ Settings.System.STATUSBAR_CLOCK_DATE_FORMAT);
+ if (value == null || value.isEmpty()) {
+ value = "EEE";
+ }
+ int index = mClockDateFormat.findIndexOfValue((String) value);
+ if (index == -1) {
+ mClockDateFormat.setValueIndex(CUSTOM_CLOCK_DATE_FORMAT_INDEX);
+ } else {
+ mClockDateFormat.setValue(value);
+ }
+ parseClockDateFormats();
+
final PreferenceCategory aspectRatioCategory =
(PreferenceCategory) getPreferenceScreen().findPreference(KEY_ASPECT_RATIO_CATEGORY);
final boolean supportMaxAspectRatio = getResources().getBoolean(com.android.internal.R.bool.config_haveHigherAspectRatioScreen);
@@ -129,6 +215,7 @@
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
+ AlertDialog dialog;
if (preference == mAspectRatioAppsSelect) {
Collection<String> valueList = (Collection<String>) newValue;
mAspectRatioApps.setVisible(false);
@@ -161,10 +248,123 @@
Settings.System.SHOW_BATTERY_PERCENT, showPercent);
mBatteryPercentage.setSummary(mBatteryPercentage.getEntries()[index]);
return true;
+ } else if (preference == mStatusBarClockShow) {
+ boolean value = (Boolean) newValue;
+ Settings.System.putInt(getActivity().getContentResolver(),
+ Settings.System.STATUS_BAR_CLOCK, value ? 1 : 0);
+ return true;
+ } else if (preference == mStatusBarSecondsShow) {
+ boolean value = (Boolean) newValue;
+ Settings.System.putInt(getActivity().getContentResolver(),
+ Settings.System.STATUS_BAR_CLOCK_SECONDS, value ? 1 : 0);
+ return true;
+ } else if (preference == mStatusBarClock) {
+ int clockStyle = Integer.parseInt((String) newValue);
+ int index = mStatusBarClock.findIndexOfValue((String) newValue);
+ Settings.System.putInt(getActivity().getContentResolver(),
+ Settings.System.STATUSBAR_CLOCK_STYLE, clockStyle);
+ mStatusBarClock.setSummary(mStatusBarClock.getEntries()[index]);
+ return true;
+ } else if (preference == mStatusBarAmPm) {
+ int statusBarAmPm = Integer.valueOf((String) newValue);
+ int index = mStatusBarAmPm.findIndexOfValue((String) newValue);
+ Settings.System.putInt(getActivity().getContentResolver(),
+ Settings.System.STATUSBAR_CLOCK_AM_PM_STYLE, statusBarAmPm);
+ mStatusBarAmPm.setSummary(mStatusBarAmPm.getEntries()[index]);
+ return true;
+ } else if (preference == mClockDateDisplay) {
+ int clockDateDisplay = Integer.valueOf((String) newValue);
+ int index = mClockDateDisplay.findIndexOfValue((String) newValue);
+ Settings.System.putInt(getActivity().getContentResolver(),
+ Settings.System.STATUSBAR_CLOCK_DATE_DISPLAY, clockDateDisplay);
+ mClockDateDisplay.setSummary(mClockDateDisplay.getEntries()[index]);
+ if (clockDateDisplay == 0) {
+ mClockDateStyle.setEnabled(false);
+ mClockDateFormat.setEnabled(false);
+ } else {
+ mClockDateStyle.setEnabled(true);
+ mClockDateFormat.setEnabled(true);
+ }
+ return true;
+ } else if (preference == mClockDateStyle) {
+ int clockDateStyle = Integer.valueOf((String) newValue);
+ int index = mClockDateStyle.findIndexOfValue((String) newValue);
+ Settings.System.putInt(getActivity().getContentResolver(),
+ Settings.System.STATUSBAR_CLOCK_DATE_STYLE, clockDateStyle);
+ mClockDateStyle.setSummary(mClockDateStyle.getEntries()[index]);
+ parseClockDateFormats();
+ return true;
+ } else if (preference == mClockDateFormat) {
+ int index = mClockDateFormat.findIndexOfValue((String) newValue);
+ if (index == CUSTOM_CLOCK_DATE_FORMAT_INDEX) {
+ AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());
+ alert.setTitle(R.string.clock_date_string_edittext_title);
+ alert.setMessage(R.string.clock_date_string_edittext_summary);
+ final EditText input = new EditText(getActivity());
+ String oldText = Settings.System.getString(
+ getActivity().getContentResolver(),
+ Settings.System.STATUSBAR_CLOCK_DATE_FORMAT);
+ if (oldText != null) {
+ input.setText(oldText);
+ }
+ alert.setView(input);
+ alert.setPositiveButton(R.string.menu_save, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialogInterface, int whichButton) {
+ String value = input.getText().toString();
+ if (value.equals("")) {
+ return;
+ }
+ Settings.System.putString(getActivity().getContentResolver(),
+ Settings.System.STATUSBAR_CLOCK_DATE_FORMAT, value);
+ return;
+ }
+ });
+ alert.setNegativeButton(R.string.menu_cancel,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialogInterface, int which) {
+ return;
+ }
+ });
+ dialog = alert.create();
+ dialog.show();
+ } else {
+ if ((String) newValue != null) {
+ Settings.System.putString(getActivity().getContentResolver(),
+ Settings.System.STATUSBAR_CLOCK_DATE_FORMAT, (String) newValue);
+ }
+ }
+ return true;
}
return false;
}
+ private void parseClockDateFormats() {
+ String[] dateEntries = getResources().getStringArray(R.array.clock_date_format_entries_values);
+ CharSequence parsedDateEntries[];
+ parsedDateEntries = new String[dateEntries.length];
+ Date now = new Date();
+ int lastEntry = dateEntries.length - 1;
+ int dateFormat = Settings.System.getInt(getActivity()
+ .getContentResolver(), Settings.System.STATUSBAR_CLOCK_DATE_STYLE, 0);
+ for (int i = 0; i < dateEntries.length; i++) {
+ if (i == lastEntry) {
+ parsedDateEntries[i] = dateEntries[i];
+ } else {
+ String newDate;
+ CharSequence dateString = DateFormat.format(dateEntries[i], now);
+ if (dateFormat == CLOCK_DATE_STYLE_LOWERCASE) {
+ newDate = dateString.toString().toLowerCase();
+ } else if (dateFormat == CLOCK_DATE_STYLE_UPPERCASE) {
+ newDate = dateString.toString().toUpperCase();
+ } else {
+ newDate = dateString.toString();
+ }
+ parsedDateEntries[i] = newDate;
+ }
+ }
+ mClockDateFormat.setEntries(parsedDateEntries);
+ }
+
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider() {
@Override