From a858d7d74cb048d0753c416c0732f3a969dffec9 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 20 Oct 2016 00:21:58 +0200 Subject: [PATCH] Add UI settings for #3158 --- OsmAnd/res/values/strings.xml | 6 +++++ .../src/net/osmand/plus/OsmandSettings.java | 4 +-- .../plus/activities/SavingTrackHelper.java | 6 ++--- .../SettingsMonitoringActivity.java | 26 +++++++++++++++++++ 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 2a490816a2..855249fb05 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,12 @@ 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 --> + Logging minimal speed + Choose minimal speed that logging will be triggered + Logging minimal distance + Choose minimal distance that logging will be triggered + Logging precision + Choose logging precision Christmas POI Anticipating Christmas and New Year holidays, you can choose to display the POI associated with Christmas: the Christmas tree, markets. Show Christmas POI? diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index e003119db3..aa2f9d14fc 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -1055,7 +1055,7 @@ public class OsmandSettings { } - public final CommonPreference SAVE_TRACK_PRECISION = new IntPreference("save_track_precision", 0).makeProfile(); + public final CommonPreference SAVE_TRACK_PRECISION = new FloatPreference("save_track_precision", 0).makeProfile(); { // SAVE_TRACK_PRECISION.setModeDefaultValue(ApplicationMode.CAR, 50); // SAVE_TRACK_PRECISION.setModeDefaultValue(ApplicationMode.BICYCLE, 50); @@ -1067,7 +1067,7 @@ public class OsmandSettings { // SAVE_TRACK_MIN_SPEED.setModeDefaultValue(ApplicationMode.BICYCLE, 1.f); // SAVE_TRACK_MIN_SPEED.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 0.f); } - public final CommonPreference SAVE_TRACK_MIN_DISTANCE = new IntPreference("save_track_min_distance", 5).makeProfile(); + public final CommonPreference SAVE_TRACK_MIN_DISTANCE = new FloatPreference("save_track_min_distance", 5).makeProfile(); { // SAVE_TRACK_MIN_DISTANCE.setModeDefaultValue(ApplicationMode.CAR, 5); // SAVE_TRACK_MIN_DISTANCE.setModeDefaultValue(ApplicationMode.BICYCLE, 5); diff --git a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java index b1096b0d14..9b0c65a3e2 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java +++ b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java @@ -365,16 +365,16 @@ public class SavingTrackHelper extends SQLiteOpenHelper { && locationTime - lastTimeUpdated > settings.SAVE_GLOBAL_TRACK_INTERVAL.get()) { record = true; } - int minDistance = settings.SAVE_TRACK_MIN_DISTANCE.get(); + float minDistance = settings.SAVE_TRACK_MIN_DISTANCE.get(); if(minDistance > 0 && lastPoint != null && MapUtils.getDistance(lastPoint, location.getLatitude(), location.getLongitude()) < minDistance) { record = false; } - int precision = settings.SAVE_TRACK_PRECISION.get(); + float precision = settings.SAVE_TRACK_PRECISION.get(); if(precision > 0 && (!location.hasAccuracy() || location.getAccuracy() < precision)) { record = false; } - int minSpeed = settings.SAVE_TRACK_MIN_SPEED.get(); + float minSpeed = settings.SAVE_TRACK_MIN_SPEED.get(); if(minSpeed > 0 && (!location.hasSpeed() || location.getSpeed() < minSpeed)) { record = false; } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/SettingsMonitoringActivity.java b/OsmAnd/src/net/osmand/plus/monitoring/SettingsMonitoringActivity.java index 302799b12a..b3873eef5b 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/SettingsMonitoringActivity.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/SettingsMonitoringActivity.java @@ -85,6 +85,32 @@ 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)); + String[] names; + Float[] floatValues; + floatValues = new Float[] {0.f, 2.0f, 5.0f, 10.0f, 15.0f, 20.0f, 30.0f}; + names = new String[floatValues.length]; + names[0] = getString(R.string.shared_string_not_selected); + for(int i = 1; i < floatValues.length; i++) { + names[i] = floatValues[i].intValue() + " " + getString(R.string.m); + } + cat.addPreference(createListPreference(settings.SAVE_TRACK_MIN_DISTANCE, names, floatValues, + R.string.save_track_min_distance, R.string.save_track_min_distance_descr)); + floatValues = new Float[] {0.f, 2.0f, 5.0f, 10.0f, 15.0f, 20.0f, 30.0f, 50.0f}; + names = new String[floatValues.length]; + names[0] = getString(R.string.shared_string_not_selected); + for(int i = 1; i < floatValues.length; i++) { + names[i] = floatValues[i].intValue() + " " + getString(R.string.m); + } + cat.addPreference(createListPreference(settings.SAVE_TRACK_PRECISION, names, floatValues, + R.string.save_track_precision, R.string.save_track_precision_descr)); + floatValues = new Float[] {0.f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f}; + names = new String[floatValues.length]; + names[0] = getString(R.string.shared_string_not_selected); + for(int i = 1; i < floatValues.length; i++) { + names[i] = floatValues[i].intValue() + " " + getString(R.string.m_s); + } + cat.addPreference(createListPreference(settings.SAVE_TRACK_MIN_SPEED, names, floatValues, + R.string.save_track_min_speed, R.string.save_track_min_speed_descr)); cat.addPreference(createCheckBoxPreference(settings.DISABLE_RECORDING_ONCE_APP_KILLED, R.string.disable_recording_once_app_killed, R.string.disable_recording_once_app_killed_descrp)); }