• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得cocoapythonrubywindowsphpgameguibathyscaphec翻訳omegatframework計画中(planning stage)twitterdombtronvb.nettestarduinodirectxpreviewerゲームエンジン

Commit MetaInfo

Revision719b93dcc613c694ca6363ca5b7bfbd943e55692 (tree)
Time2014-06-02 03:11:42
AuthorMasahiko, SAWAI <say@user...>
CommiterMasahiko, SAWAI

Log Message

Added date format preference

Change Summary

Incremental Difference

--- a/simple-battery-logger/simple-battery-logger-app/res/values-ja/strings_preferences.xml
+++ b/simple-battery-logger/simple-battery-logger-app/res/values-ja/strings_preferences.xml
@@ -15,6 +15,12 @@
1515 <string name="data_keeping_period">データ保管期間</string>
1616 <string name="data_keeping_period_title">データ保管期間</string>
1717
18+ <string name="preferences_view_category_title">表示</string>
19+ <string name="date_format">日付フォーマット</string>
20+ <string name="date_format_title">日付フォーマット</string>
21+ <string name="date_format_row">書式なし</string>
22+ <string name="date_format_system">システム書式</string>
23+
1824 <string name="preferences_csv_category_title">CSV</string>
1925 <string name="csv_auto_export_enabled_title">CSV 自動出力</string>
2026 <string name="csv_auto_export_enabled_summary_on">CSV ファイルを毎日、自動的に出力します。</string>
--- /dev/null
+++ b/simple-battery-logger/simple-battery-logger-app/res/values/arrays_date_format.xml
@@ -0,0 +1,11 @@
1+<?xml version="1.0" encoding="utf-8"?>
2+<resources>
3+ <string-array name="date_format_entries" >
4+ <item>@string/date_format_row</item>
5+ <item>@string/date_format_system</item>
6+ </string-array>
7+ <string-array name="date_format_values" >
8+ <item>DATE_FORMAT_ROW</item>
9+ <item>DATE_FORMAT_SYSTEM</item>
10+ </string-array>
11+</resources>
--- a/simple-battery-logger/simple-battery-logger-app/res/values/preferences_key_value.xml
+++ b/simple-battery-logger/simple-battery-logger-app/res/values/preferences_key_value.xml
@@ -10,6 +10,9 @@
1010 <string name="data_keeping_period_key">data_keeping_period</string>
1111 <string name="data_keeping_period_default_value">30</string>
1212
13+ <string name="date_format_key">date_format</string>
14+ <string name="date_format_default_value">DATE_FORMAT_ROW</string>
15+
1316 <string name="csv_auto_export_enabled_key">csv_auto_export_enabled</string>
1417 <bool name="csv_auto_export_enabled_default_value">true</bool>
1518
--- a/simple-battery-logger/simple-battery-logger-app/res/values/strings_preferences.xml
+++ b/simple-battery-logger/simple-battery-logger-app/res/values/strings_preferences.xml
@@ -15,6 +15,12 @@
1515 <string name="data_keeping_period">Data Keeping Period</string>
1616 <string name="data_keeping_period_title">Data Keeping Period</string>
1717
18+ <string name="preferences_view_category_title">View</string>
19+ <string name="date_format">Date Format</string>
20+ <string name="date_format_title">Date Format</string>
21+ <string name="date_format_row">Row Format</string>
22+ <string name="date_format_system">System Format</string>
23+
1824 <string name="preferences_csv_category_title">CSV</string>
1925 <string name="csv_auto_export_enabled_title">CSV Auto Export</string>
2026 <string name="csv_auto_export_enabled_summary_on">The CSV file is automatically exported every day.</string>
--- a/simple-battery-logger/simple-battery-logger-app/res/xml/preferences.xml
+++ b/simple-battery-logger/simple-battery-logger-app/res/xml/preferences.xml
@@ -31,6 +31,18 @@
3131 </PreferenceCategory>
3232
3333 <!-- CSV -->
34+ <PreferenceCategory android:title="@string/preferences_view_category_title" >
35+ <ListPreference
36+ android:key="@string/date_format_key"
37+ android:defaultValue="@string/date_format_default_value"
38+ android:title="@string/date_format"
39+ android:dialogTitle="@string/date_format_title"
40+ android:entries="@array/date_format_entries"
41+ android:entryValues="@array/date_format_values"
42+ />
43+ </PreferenceCategory>
44+
45+ <!-- CSV -->
3446 <PreferenceCategory android:title="@string/preferences_csv_category_title" >
3547
3648 <CheckBoxPreference
--- a/simple-battery-logger/simple-battery-logger-app/src/org/routine_work/simple_battery_logger/BatteryLoggerPreferenceActivity.java
+++ b/simple-battery-logger/simple-battery-logger-app/src/org/routine_work/simple_battery_logger/BatteryLoggerPreferenceActivity.java
@@ -62,6 +62,7 @@ public class BatteryLoggerPreferenceActivity extends PreferenceActivity
6262 private String loggingServiceEnabledKey;
6363 private String ignoreVoltageChangeOnlyKey;
6464 private String dataKeepingPeriodKey;
65+ private String dateFormatKey;
6566 private String csvAutoExportEnabledKey;
6667 private String csvExportDirectoryKey;
6768 private String csvSortOrderKey;
@@ -79,6 +80,7 @@ public class BatteryLoggerPreferenceActivity extends PreferenceActivity
7980 loggingServiceEnabledKey = getString(R.string.logging_service_enabled_key);
8081 ignoreVoltageChangeOnlyKey = getString(R.string.ignore_voltage_change_only_key);
8182 dataKeepingPeriodKey = getString(R.string.data_keeping_period_key);
83+ dateFormatKey = getString(R.string.date_format_key);
8284 csvAutoExportEnabledKey = getString(R.string.csv_auto_export_enabled_key);
8385 csvExportDirectoryKey = getString(R.string.csv_export_directory_key);
8486 csvSortOrderKey = getString(R.string.csv_sort_order_key);
@@ -212,6 +214,13 @@ public class BatteryLoggerPreferenceActivity extends PreferenceActivity
212214 dataKeepingPeriodPreference.setSummary(entry);
213215 }
214216
217+ if (key == null || key.equals(dateFormatKey))
218+ {
219+ ListPreference dateFormatPreference = (ListPreference) getPreferenceScreen().findPreference(dateFormatKey);
220+ CharSequence entry = dateFormatPreference.getEntry();
221+ dateFormatPreference.setSummary(entry);
222+ }
223+
215224 if (key == null || key.equals(csvExportDirectoryKey))
216225 {
217226 EditTextPreference csvExportDirectoryPreference = (EditTextPreference) getPreferenceScreen().findPreference(csvExportDirectoryKey);
--- a/simple-battery-logger/simple-battery-logger-app/src/org/routine_work/simple_battery_logger/util/PreferenceUtils.java
+++ b/simple-battery-logger/simple-battery-logger-app/src/org/routine_work/simple_battery_logger/util/PreferenceUtils.java
@@ -122,6 +122,19 @@ public class PreferenceUtils
122122 return dataKeepingPeriod;
123123 }
124124
125+ public static String getDateFormat(Context context)
126+ {
127+ SharedPreferences sharedPreferences = getPrivateSharedPreferences(context);
128+ Resources resources = context.getResources();
129+
130+ String key = resources.getString(R.string.date_format_key);
131+ String defaultValue = resources.getString(R.string.date_format_default_value);
132+ String value = sharedPreferences.getString(key, defaultValue);
133+
134+ Log.v(LOG_TAG, "dateFormat => " + value);
135+ return value;
136+ }
137+
125138 public static boolean isCsvAutoExportEnabled(Context context)
126139 {
127140 SharedPreferences sharedPreferences = getPrivateSharedPreferences(context);