Fix #7789
This commit is contained in:
parent
934d0e8ab9
commit
816882d086
7 changed files with 35 additions and 48 deletions
|
@ -38,7 +38,6 @@ import net.osmand.plus.inapp.InAppPurchaseHelper;
|
|||
import net.osmand.plus.liveupdates.LiveUpdatesHelper;
|
||||
import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
|
||||
import net.osmand.plus.monitoring.LiveMonitoringHelper;
|
||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||
import net.osmand.plus.render.MapRenderRepositories;
|
||||
import net.osmand.plus.render.NativeOsmandLibrary;
|
||||
|
@ -766,7 +765,7 @@ public class AppInitializer implements IProgress {
|
|||
app.savingTrackHelper.loadGpxFromDatabase();
|
||||
}
|
||||
}
|
||||
if(app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get() && OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null){
|
||||
if (app.savingTrackHelper.getIsRecording()) {
|
||||
int interval = app.getSettings().SAVE_GLOBAL_TRACK_INTERVAL.get();
|
||||
app.startNavigationService(NavigationService.USED_BY_GPX, app.navigationServiceGpsInterval(interval));
|
||||
}
|
||||
|
|
|
@ -182,8 +182,8 @@ public abstract class OsmandPlugin {
|
|||
LOG.error("Plugin initialization failed " + plugin.getId(), e);
|
||||
}
|
||||
} else if (plugin.isActive()) {
|
||||
plugin.disable(app);
|
||||
plugin.setActive(false);
|
||||
plugin.disable(app);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1499,6 +1499,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
}
|
||||
});
|
||||
getMapView().refreshMap(true);
|
||||
getMyApplication().getNotificationHelper().refreshNotifications();
|
||||
}
|
||||
|
||||
public void updateMapSettings() {
|
||||
|
|
|
@ -5,22 +5,20 @@ import android.database.sqlite.SQLiteDatabase;
|
|||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.text.format.DateFormat;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
||||
import net.osmand.GPXUtilities;
|
||||
import net.osmand.GPXUtilities.GPXFile;
|
||||
import net.osmand.GPXUtilities.GPXTrackAnalysis;
|
||||
import net.osmand.GPXUtilities.Track;
|
||||
import net.osmand.GPXUtilities.TrkSegment;
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.OsmAndLocationProvider;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
import net.osmand.plus.notifications.OsmandNotification.NotificationType;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
|
@ -409,9 +407,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
|||
long locationTime = System.currentTimeMillis();
|
||||
OsmandSettings settings = ctx.getSettings();
|
||||
boolean record = false;
|
||||
if(location != null &&
|
||||
OsmAndLocationProvider.isNotSimulatedLocation(location) ) {
|
||||
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
|
||||
if (location != null && OsmAndLocationProvider.isNotSimulatedLocation(location)) {
|
||||
if (settings.SAVE_TRACK_TO_GPX.get()
|
||||
&& locationTime - lastTimeUpdated > settings.SAVE_TRACK_INTERVAL.get()
|
||||
&& ctx.getRoutingHelper().isFollowingMode()) {
|
||||
|
@ -434,7 +430,6 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
|||
record = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (record) {
|
||||
insertData(location.getLatitude(), location.getLongitude(), location.getAltitude(), location.getSpeed(),
|
||||
location.getAccuracy(), locationTime, settings);
|
||||
|
@ -654,13 +649,8 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
|||
}
|
||||
|
||||
public boolean getIsRecording() {
|
||||
if (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
|
||||
if (ctx.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get() ||
|
||||
(ctx.getSettings().SAVE_TRACK_TO_GPX.get() && ctx.getRoutingHelper().isFollowingMode())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return ctx.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get() ||
|
||||
(ctx.getSettings().SAVE_TRACK_TO_GPX.get() && ctx.getRoutingHelper().isFollowingMode());
|
||||
}
|
||||
|
||||
public float getDistance() {
|
||||
|
|
|
@ -7,7 +7,6 @@ import net.osmand.PlatformUtil;
|
|||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.OsmAndLocationProvider;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
|
@ -47,9 +46,7 @@ public class LiveMonitoringHelper {
|
|||
public void updateLocation(net.osmand.Location location) {
|
||||
boolean record = false;
|
||||
long locationTime = System.currentTimeMillis();
|
||||
if (location != null && isLiveMonitoringEnabled()
|
||||
&& OsmAndLocationProvider.isNotSimulatedLocation(location)
|
||||
&& OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null) {
|
||||
if (location != null && isLiveMonitoringEnabled() && OsmAndLocationProvider.isNotSimulatedLocation(location)) {
|
||||
if (locationTime - lastTimeUpdated > settings.LIVE_MONITORING_INTERVAL.get()) {
|
||||
record = true;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class ErrorNotification extends OsmandNotification {
|
|||
boolean planning = routingHelper.isRoutePlanningMode();
|
||||
boolean pause = routingHelper.isPauseNavigation();
|
||||
|
||||
boolean gpxEnabled = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null;
|
||||
boolean gpxEnabled = app.getSavingTrackHelper().getIsRecording() || OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null;
|
||||
String usedBy = service != null ? "" + service.getUsedBy() : "X";
|
||||
|
||||
notificationText = "Info: " + (following ? "1" : "") + (planning ? "2" : "") + (pause ? "3" : "") + (gpxEnabled ? "4" : "") + "-" + usedBy + ". "
|
||||
|
|
|
@ -40,7 +40,7 @@ public class GpxNotification extends OsmandNotification {
|
|||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
|
||||
final OsmandMonitoringPlugin plugin = OsmandPlugin.getPlugin(OsmandMonitoringPlugin.class);
|
||||
if (plugin != null) {
|
||||
plugin.saveCurrentTrack();
|
||||
if (!app.getSettings().SAVE_GLOBAL_TRACK_TO_GPX.get()) {
|
||||
|
@ -54,7 +54,7 @@ public class GpxNotification extends OsmandNotification {
|
|||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
|
||||
final OsmandMonitoringPlugin plugin = OsmandPlugin.getPlugin(OsmandMonitoringPlugin.class);
|
||||
if (plugin != null) {
|
||||
plugin.startGPXMonitoring(null);
|
||||
plugin.updateControl();
|
||||
|
@ -66,7 +66,7 @@ public class GpxNotification extends OsmandNotification {
|
|||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
|
||||
final OsmandMonitoringPlugin plugin = OsmandPlugin.getPlugin(OsmandMonitoringPlugin.class);
|
||||
if (plugin != null) {
|
||||
plugin.stopRecording();
|
||||
plugin.updateControl();
|
||||
|
@ -95,7 +95,7 @@ public class GpxNotification extends OsmandNotification {
|
|||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null;
|
||||
return app.getSavingTrackHelper().getIsRecording() || OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue