Add UI settings for #3158

This commit is contained in:
Victor Shcherb 2016-10-20 00:21:58 +02:00
parent 972ca1f834
commit a858d7d74c
4 changed files with 37 additions and 5 deletions

View file

@ -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
-->
<string name="save_track_min_speed">Logging minimal speed</string>
<string name="save_track_min_speed_descr">Choose minimal speed that logging will be triggered</string>
<string name="save_track_min_distance">Logging minimal distance</string>
<string name="save_track_min_distance_descr">Choose minimal distance that logging will be triggered</string>
<string name="save_track_precision">Logging precision</string>
<string name="save_track_precision_descr">Choose logging precision</string>
<string name="christmas_poi">Christmas POI</string>
<string name="christmas_desc">Anticipating Christmas and New Year holidays, you can choose to display the POI associated with Christmas: the Christmas tree, markets.</string>
<string name="christmas_desc_q">Show Christmas POI?</string>

View file

@ -1055,7 +1055,7 @@ public class OsmandSettings {
}
public final CommonPreference<Integer> SAVE_TRACK_PRECISION = new IntPreference("save_track_precision", 0).makeProfile();
public final CommonPreference<Float> 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<Integer> SAVE_TRACK_MIN_DISTANCE = new IntPreference("save_track_min_distance", 5).makeProfile();
public final CommonPreference<Float> 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);

View file

@ -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;
}

View file

@ -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));
}