diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index cc26436bc6..5cbc148801 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -9,6 +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
-->
+ Save your tracks with one button touch on the map screen.
+ Show settings facilitating to record your trips to local GPX files or online using a web service.
+ Record your trips
h
Duration
Distance
@@ -507,9 +510,6 @@
Logging services
Configure how to record trips
- Enable tracking and navigation in sleep (screen off) mode via periodically waking up the GPS device.
- Show settings facilitating to record your trips to local GPX files or online using a web service.
- Logging services
Show settings to enable tracking and navigation in sleep (screen off) mode via periodically waking up the GPS device.
Install version
Choose application theme
diff --git a/OsmAnd/src/net/osmand/plus/NavigationService.java b/OsmAnd/src/net/osmand/plus/NavigationService.java
index bc5e4fa134..b7899029f8 100644
--- a/OsmAnd/src/net/osmand/plus/NavigationService.java
+++ b/OsmAnd/src/net/osmand/plus/NavigationService.java
@@ -123,7 +123,9 @@ public class NavigationService extends Service implements LocationListener {
}
public void stopIfNeeded(Context ctx, int usageIntent) {
- usedBy -= usageIntent;
+ if((usedBy & usageIntent) > 0) {
+ usedBy -= usageIntent;
+ }
if (usedBy == 0) {
final Intent serviceIntent = new Intent(ctx, NavigationService.class);
ctx.stopService(serviceIntent);
diff --git a/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java b/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java
index 8f1ae7cad7..80415aeee3 100644
--- a/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java
+++ b/OsmAnd/src/net/osmand/plus/OsmAndAppCustomization.java
@@ -174,4 +174,8 @@ public class OsmAndAppCustomization {
public boolean onDestinationReached() {
return true;
}
+
+ public int getWaypointSearchRadius(int searchDeviationRadius, int type) {
+ return searchDeviationRadius;
+ }
}
diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
index 708187a2d3..6c5120146b 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
@@ -792,6 +792,7 @@ public class OsmandSettings {
public final CommonPreference SAVE_GLOBAL_TRACK_TO_GPX = new BooleanPreference("save_global_track_to_gpx", false).makeGlobal().cache();
public final CommonPreference SAVE_GLOBAL_TRACK_INTERVAL = new IntPreference("save_global_track_interval", 5000).makeGlobal().cache();
+ public final CommonPreference SAVE_GLOBAL_TRACK_REMEMBER = new BooleanPreference("save_global_track_remember", false).makeGlobal().cache();
// this value string is synchronized with settings_pref.xml preference name
public final CommonPreference SAVE_TRACK_TO_GPX = new BooleanPreference("save_track_to_gpx", false).makeProfile().cache();
{
diff --git a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java
index f9137f83e5..9700e7fbea 100644
--- a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java
+++ b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java
@@ -8,7 +8,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.data.LatLon;
import net.osmand.plus.GPXUtilities;
diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java
index 17113f6ee2..f4634a0bd4 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java
@@ -289,7 +289,7 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
str = ctx.getString(R.string.waypoints);
break;
case WaypointHelper.POI:
- str = waypointHelper.getPoiFilter() == null && !checked ? ctx.getString(R.string.poi) : waypointHelper
+ str = waypointHelper.getPoiFilter() == null || !checked ? ctx.getString(R.string.poi) : waypointHelper
.getPoiFilter().getName();
break;
}
diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java
index 2f10c29f36..805a380826 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java
@@ -487,7 +487,7 @@ public class WaypointHelper {
PoiFilter pf = getPoiFilter();
if (pf != null) {
final List locs = route.getImmutableAllLocations();
- List amenities = app.getResourceManager().searchAmenitiesOnThePath(locs, searchDeviationRadius,
+ List amenities = app.getResourceManager().searchAmenitiesOnThePath(locs, getSearchRadius(POI),
pf, new ResultMatcher() {
@Override
@@ -512,6 +512,11 @@ public class WaypointHelper {
}
}
}
+
+
+ protected int getSearchRadius(int type) {
+ return app.getAppCustomization().getWaypointSearchRadius(searchDeviationRadius, type);
+ }
@@ -552,7 +557,7 @@ public class WaypointHelper {
int[] ind = new int[1];
for(LocationPoint p : points) {
float dist = dist(p, immutableAllLocations, ind);
- if(dist <= searchDeviationRadius) {
+ if(dist <= getSearchRadius(type)) {
LocationPointWrapper lpw = new LocationPointWrapper(rt, type, p, dist, ind[0]);
lpw.setAnnounce(announce);
locationPoints.add(lpw);
diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java
index 51b83d989f..4af70e37e7 100644
--- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java
@@ -38,8 +38,12 @@ import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceScreen;
import android.view.View;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.LinearLayout;
import android.widget.SeekBar;
+import android.widget.LinearLayout.LayoutParams;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
@@ -50,6 +54,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
private BaseMapWidget monitoringControl;
private LiveMonitoringHelper liveMonitoringHelper;
private boolean ADD_BG_TO_ACTION = true;
+ private boolean isSaving;
public OsmandMonitoringPlugin(OsmandApplication app) {
this.app = app;
@@ -76,12 +81,12 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
@Override
public String getDescription() {
- return app.getString(R.string.osmand_monitoring_plugin_description);
+ return app.getString(R.string.record_plugin_description);
}
@Override
public String getName() {
- return app.getString(R.string.osmand_monitoring_plugin_name);
+ return app.getString(R.string.record_plugin_name);
}
@Override
@@ -154,6 +159,11 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
long lastUpdateTime;
@Override
public boolean updateInfo(DrawSettings drawSettings) {
+ if(isSaving){
+ setText(map.getString(R.string.import_save), "");
+ setImageDrawable(monitoringBig);
+ return true;
+ }
boolean visible = true;
String txt = map.getString(R.string.monitoring_control_start);
String subtxt = null;
@@ -227,29 +237,37 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
} else {
items.add(R.string.gpx_monitoring_start);
}
- items.add(R.string.save_current_track);
+ if(app.getSavingTrackHelper().hasDataToSave()) {
+ items.add(R.string.save_current_track);
+ }
String[] strings = new String[items.size()];
for(int i =0; i < strings.length; i++) {
strings[i] = app.getString(items.get(i));
}
- bld.setItems(strings, new OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
+ final int[] holder = new int[] {0};
+ final Runnable run = new Runnable() {
+ public void run() {
+ int which = holder[0];
int item = items.get(which);
if(item == R.string.save_current_track){
app.getTaskManager().runInBackground(new OsmAndTaskRunnable() {
-
+
@Override
protected Void doInBackground(Void... params) {
- SavingTrackHelper helper = app.getSavingTrackHelper();
- helper.saveDataToGpx(app.getAppCustomization().getTracksDir());
- helper.close();
+ isSaving = true;
+ try {
+ SavingTrackHelper helper = app.getSavingTrackHelper();
+ helper.saveDataToGpx(app.getAppCustomization().getTracksDir());
+ helper.close();
+ } finally {
+ isSaving = false;
+ }
return null;
}
}, (Void) null);
} else if(item == R.string.gpx_monitoring_start) {
- startGPXMonitoring();
+ startGPXMonitoring(map);
} else if(item == R.string.gpx_monitoring_stop) {
settings.SAVE_GLOBAL_TRACK_TO_GPX.set(false);
if (app.getNavigationService() != null) {
@@ -264,7 +282,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
vs.value = settings.LIVE_MONITORING_INTERVAL.get();
showIntervalChooseDialog(map, app.getString(R.string.live_monitoring_interval) + " : %s",
app.getString(R.string.save_track_to_gpx), SECONDS, MINUTES,
- vs, new OnClickListener() {
+ null, vs, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
settings.LIVE_MONITORING_INTERVAL.set(vs.value);
@@ -274,32 +292,55 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
}
monitoringControl.updateInfo(null);
}
-
- private void startGPXMonitoring() {
- app.getSavingTrackHelper().startNewSegment();
- final ValueHolder vs = new ValueHolder();
- vs.value = settings.SAVE_GLOBAL_TRACK_INTERVAL.get();
- showIntervalChooseDialog(map, app.getString(R.string.save_track_interval) + " : %s",
- app.getString(R.string.save_track_to_gpx), SECONDS, MINUTES,
- vs, new OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- settings.SAVE_GLOBAL_TRACK_INTERVAL.set(vs.value);
- settings.SAVE_GLOBAL_TRACK_TO_GPX.set(true);
- if (app.getNavigationService() == null) {
- settings.SERVICE_OFF_INTERVAL.set(0);
- }
- app.startNavigationService(NavigationService.USED_BY_GPX);
- }
- });
-
+ };
+ if(strings.length == 1) {
+ run.run();
+ } else {
+ bld.setItems(strings, new OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ holder[0] = which;
+ run.run();
+ }
+ });
+ bld.show();
+ }
+ }
+
+ private void startGPXMonitoring(MapActivity map) {
+ app.getSavingTrackHelper().startNewSegment();
+ final ValueHolder vs = new ValueHolder();
+ final ValueHolder choice = new ValueHolder();
+ vs.value = settings.SAVE_GLOBAL_TRACK_INTERVAL.get();
+ choice.value = settings.SAVE_GLOBAL_TRACK_REMEMBER.get();
+ final Runnable runnable = new Runnable() {
+ public void run() {
+ settings.SAVE_GLOBAL_TRACK_INTERVAL.set(vs.value);
+ settings.SAVE_GLOBAL_TRACK_TO_GPX.set(true);
+ settings.SAVE_GLOBAL_TRACK_REMEMBER.set(choice.value);
+ if (app.getNavigationService() == null) {
+ settings.SERVICE_OFF_INTERVAL.set(0);
+ }
+ app.startNavigationService(NavigationService.USED_BY_GPX);
}
- });
- bld.show();
+ };
+ if(choice.value) {
+ runnable.run();
+ } else {
+ showIntervalChooseDialog(map, app.getString(R.string.save_track_interval) + " : %s",
+ app.getString(R.string.save_track_to_gpx), SECONDS, MINUTES, choice, vs,
+ new OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ runnable.run();
+ }
+ });
+ }
+
}
public static void showIntervalChooseDialog(final Context uiCtx, final String patternMsg,
- String title, final int[] seconds, final int[] minutes, final ValueHolder v, OnClickListener onclick){
+ String title, final int[] seconds, final int[] minutes, final ValueHolder choice, final ValueHolder v, OnClickListener onclick){
Builder dlg = new AlertDialog.Builder(uiCtx);
dlg.setTitle(title);
LinearLayout ll = new LinearLayout(uiCtx);
@@ -356,6 +397,23 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
ll.setOrientation(LinearLayout.VERTICAL);
ll.addView(tv);
ll.addView(sp);
+ if (choice != null) {
+ final CheckBox cb = new CheckBox(uiCtx);
+ cb.setText(R.string.remember_choice);
+ LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
+ LayoutParams.WRAP_CONTENT);
+ lp.setMargins(7, 10, 7, 0);
+ cb.setLayoutParams(lp);
+ cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
+
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ choice.value = isChecked;
+
+ }
+ });
+ ll.addView(cb);
+ }
dlg.setView(ll);
dlg.setPositiveButton(R.string.default_buttons_ok, onclick);
dlg.setNegativeButton(R.string.default_buttons_cancel, null);
@@ -375,10 +433,11 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
if (view.getApplication().getNavigationService() == null) {
final ValueHolder vs = new ValueHolder();
+ final ValueHolder choice = new ValueHolder();
vs.value = view.getSettings().SERVICE_OFF_INTERVAL.get();
showIntervalChooseDialog(view.getContext(), app.getString(R.string.gps_wakeup_interval),
app.getString(R.string.background_router_service),
- SettingsMonitoringActivity.BG_SECONDS, SettingsMonitoringActivity.BG_MINUTES, vs,
+ SettingsMonitoringActivity.BG_SECONDS, SettingsMonitoringActivity.BG_MINUTES, choice, vs,
new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
diff --git a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java
index 3451fe410c..a0b1369a65 100644
--- a/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java
+++ b/OsmAnd/src/net/osmand/plus/sherpafy/SherpafyCustomization.java
@@ -297,7 +297,9 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
public void markStageAsNotCompleted(StageInformation si) {
Integer gi = visitedStagesPref.get();
- gi = gi - (1 << si.getOrder());
+ if((gi & (1 << si.getOrder())) > 0) {
+ gi = gi - (1 << si.getOrder());
+ }
visitedStagesPref.set(gi);
}
@@ -672,4 +674,11 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
newIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
a.startActivityForResult(newIntent, 0);
}
+
+ public int getWaypointSearchRadius(int searchDeviationRadius, int type) {
+ if(type == WaypointHelper.WAYPOINTS) {
+ return searchDeviationRadius;
+ }
+ return searchDeviationRadius;
+ }
}
diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java
index 140d2557eb..1b1191d48e 100644
--- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java
+++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java
@@ -119,7 +119,7 @@ public class MapInfoWidgetsFactory {
app.getString(R.string.enable_sleep_mode),
OsmandMonitoringPlugin.SECONDS,
OsmandMonitoringPlugin.MINUTES,
- vs, new DialogInterface.OnClickListener() {
+ null, vs, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
app.getSettings().SERVICE_OFF_INTERVAL.set(vs.value);
diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/TextInfoWidget.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/TextInfoWidget.java
index f97137acb1..d323b52f57 100644
--- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/TextInfoWidget.java
+++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/TextInfoWidget.java
@@ -53,6 +53,9 @@ public class TextInfoWidget extends BaseMapWidget {
} else {
setContentDescription(subtext);
}
+ if(this.text != null && this.text.length() > 7) {
+ this.text = this.text.substring(0, 6) +"..";
+ }
updateVisibility(text != null);
requestLayout();
invalidate();