Add settings for #3158
This commit is contained in:
parent
1275f85fb5
commit
bd53399f53
3 changed files with 35 additions and 2 deletions
|
@ -547,7 +547,7 @@ public class SearchCoreFactory {
|
||||||
res.objectType = ObjectType.POI_TYPE;
|
res.objectType = ObjectType.POI_TYPE;
|
||||||
resultMatcher.publish(res);
|
resultMatcher.publish(res);
|
||||||
}
|
}
|
||||||
for(int i =0 ; i< customPoiFilters.size(); i++) {
|
for (int i = 0; i < customPoiFilters.size(); i++) {
|
||||||
CustomSearchPoiFilter csf = customPoiFilters.get(i);
|
CustomSearchPoiFilter csf = customPoiFilters.get(i);
|
||||||
int p = customPoiFiltersPriorites.get(i);
|
int p = customPoiFiltersPriorites.get(i);
|
||||||
if (!phrase.isUnknownSearchWordPresent() || nm.matches(csf.getName())) {
|
if (!phrase.isUnknownSearchWordPresent() || nm.matches(csf.getName())) {
|
||||||
|
|
|
@ -1053,6 +1053,26 @@ public class OsmandSettings {
|
||||||
SAVE_TRACK_INTERVAL.setModeDefaultValue(ApplicationMode.BICYCLE, 7000);
|
SAVE_TRACK_INTERVAL.setModeDefaultValue(ApplicationMode.BICYCLE, 7000);
|
||||||
SAVE_TRACK_INTERVAL.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 10000);
|
SAVE_TRACK_INTERVAL.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public final CommonPreference<Integer> SAVE_TRACK_PRECISION = new IntPreference("save_track_precision", 0).makeProfile();
|
||||||
|
{
|
||||||
|
// SAVE_TRACK_PRECISION.setModeDefaultValue(ApplicationMode.CAR, 50);
|
||||||
|
// SAVE_TRACK_PRECISION.setModeDefaultValue(ApplicationMode.BICYCLE, 50);
|
||||||
|
// SAVE_TRACK_PRECISION.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 50);
|
||||||
|
}
|
||||||
|
public final CommonPreference<Float> SAVE_TRACK_MIN_SPEED = new FloatPreference("save_track_min_speed", 0.f).makeProfile();
|
||||||
|
{
|
||||||
|
// SAVE_TRACK_MIN_SPEED.setModeDefaultValue(ApplicationMode.CAR, 1.f);
|
||||||
|
// 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();
|
||||||
|
{
|
||||||
|
// SAVE_TRACK_MIN_DISTANCE.setModeDefaultValue(ApplicationMode.CAR, 5);
|
||||||
|
// SAVE_TRACK_MIN_DISTANCE.setModeDefaultValue(ApplicationMode.BICYCLE, 5);
|
||||||
|
// SAVE_TRACK_MIN_DISTANCE.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 5);
|
||||||
|
}
|
||||||
|
|
||||||
// this value string is synchronized with settings_pref.xml preference name
|
// this value string is synchronized with settings_pref.xml preference name
|
||||||
public final CommonPreference<Boolean> LIVE_MONITORING = new BooleanPreference("live_monitoring", false).makeGlobal();
|
public final CommonPreference<Boolean> LIVE_MONITORING = new BooleanPreference("live_monitoring", false).makeGlobal();
|
||||||
|
|
|
@ -4,7 +4,6 @@ import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.GPXUtilities;
|
import net.osmand.plus.GPXUtilities;
|
||||||
|
@ -19,6 +18,7 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
|
@ -365,6 +365,19 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
&& locationTime - lastTimeUpdated > settings.SAVE_GLOBAL_TRACK_INTERVAL.get()) {
|
&& locationTime - lastTimeUpdated > settings.SAVE_GLOBAL_TRACK_INTERVAL.get()) {
|
||||||
record = true;
|
record = true;
|
||||||
}
|
}
|
||||||
|
int 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();
|
||||||
|
if(precision > 0 && (!location.hasAccuracy() || location.getAccuracy() < precision)) {
|
||||||
|
record = false;
|
||||||
|
}
|
||||||
|
int minSpeed = settings.SAVE_TRACK_MIN_SPEED.get();
|
||||||
|
if(minSpeed > 0 && (!location.hasSpeed() || location.getSpeed() < minSpeed)) {
|
||||||
|
record = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (record) {
|
if (record) {
|
||||||
|
|
Loading…
Reference in a new issue