diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index d124a55993..0326132f6b 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,7 +9,9 @@ 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> - + Confirm every run + Choose logging interval for track recording enabled by selecting widget on the map. + Default Global Logging interval GPS Wake-up interval Enable GPS sleep mode Stop GPS sleep mode? diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsBaseActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsBaseActivity.java index 108a7c979e..042560161f 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsBaseActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsBaseActivity.java @@ -13,6 +13,7 @@ import net.osmand.access.AccessibleToast; import net.osmand.plus.ApplicationMode; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; +import net.osmand.plus.OsmandSettings.CommonPreference; import net.osmand.plus.OsmandSettings.OsmandPreference; import net.osmand.plus.R; import net.osmand.plus.activities.actions.AppModeDialog; @@ -222,6 +223,12 @@ public abstract class SettingsBaseActivity extends SherlockPreferenceActivity im vals.put(names[i], values[i]); } } + + @SuppressWarnings("unused") + private void registerDisablePreference(OsmandPreference p, String value, OsmandPreference disable) { + LinkedHashMap vals = (LinkedHashMap) listPrefValues.get(p.getId()); + vals.put(value, disable); + } public void registerEditTextPreference(OsmandPreference b, PreferenceScreen screen) { EditTextPreference p = (EditTextPreference) screen.findPreference(b.getId()); @@ -258,21 +265,29 @@ public abstract class SettingsBaseActivity extends SherlockPreferenceActivity im registerListPreference(b, screen, intDescriptions, ints); } - public ListPreference createTimeListPreference(OsmandPreference b, int[] seconds, int[] minutes, int coeff, int title, + public ListPreference createTimeListPreference(OsmandPreference b, int[] seconds, int[] minutes, int coeff, int title, int summary) { + return createTimeListPreference(b, seconds, minutes, coeff, null, title, summary); + } + public ListPreference createTimeListPreference(OsmandPreference b, int[] seconds, int[] minutes, int coeff, CommonPreference disable, int title, int summary) { int minutesLength = minutes == null ? 0 : minutes.length; int secondsLength = seconds == null ? 0 : seconds.length; - Integer[] ints = new Integer[secondsLength + minutesLength]; + Integer[] ints = new Integer[secondsLength + minutesLength + (disable == null ? 0 : 1)]; String[] intDescriptions = new String[ints.length]; + int k = 0; for (int i = 0; i < secondsLength; i++) { - ints[i] = seconds[i] * coeff; - intDescriptions[i] = seconds[i] + " " + getString(R.string.int_seconds); //$NON-NLS-1$ + k++; + ints[k] = seconds[i] * coeff; + intDescriptions[k] = seconds[i] + " " + getString(R.string.int_seconds); //$NON-NLS-1$ } for (int i = 0; i < minutesLength; i++) { - ints[secondsLength + i] = (minutes[i] * 60) * coeff; - intDescriptions[secondsLength + i] = minutes[i] + " " + getString(R.string.int_min); //$NON-NLS-1$ + k++; + ints[k] = (minutes[i] * 60) * coeff; + intDescriptions[k] = minutes[i] + " " + getString(R.string.int_min); //$NON-NLS-1$ } - return createListPreference(b, intDescriptions, ints, title, summary); + ListPreference lp = createListPreference(b, intDescriptions, ints, title, summary); + registerDisablePreference(b, getString(R.string.confirm_every_run), disable); + return lp; } @@ -443,7 +458,14 @@ public abstract class SettingsBaseActivity extends SherlockPreferenceActivity im CharSequence entry = ((ListPreference) preference).getEntries()[ind]; Map map = listPrefValues.get(preference.getKey()); Object obj = map.get(entry); - boolean changed = listPref.set(obj); + boolean changed ; + if(obj instanceof OsmandPreference) { + changed = true; + ((OsmandPreference) obj).set(false); + } else { + changed = listPref.set(obj); + } + return changed; } return true; diff --git a/OsmAnd/src/net/osmand/plus/monitoring/SettingsMonitoringActivity.java b/OsmAnd/src/net/osmand/plus/monitoring/SettingsMonitoringActivity.java index 0fe746584b..3b098a48b2 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/SettingsMonitoringActivity.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/SettingsMonitoringActivity.java @@ -84,6 +84,10 @@ public class SettingsMonitoringActivity extends SettingsBaseActivity { R.string.save_track_to_gpx_descrp)); cat.addPreference(createTimeListPreference(settings.SAVE_TRACK_INTERVAL, SECONDS, MINUTES, 1000, R.string.save_track_interval, R.string.save_track_interval_descr)); + if(settings.SAVE_GLOBAL_TRACK_REMEMBER.get()) { + cat.addPreference(createTimeListPreference(settings.SAVE_GLOBAL_TRACK_INTERVAL, SECONDS, + MINUTES, 1000, settings.SAVE_GLOBAL_TRACK_REMEMBER, R.string.save_global_track_interval, R.string.save_global_track_interval_descr)); + } }