From ab96fe684e57397593f8d5d43ba558c8ae9bcd23 Mon Sep 17 00:00:00 2001 From: madwasp79 Date: Tue, 9 Jul 2019 12:32:24 +0300 Subject: [PATCH] pr cleanup --- .../src/net/osmand/plus/activities/MapActivity.java | 4 ---- .../plus/monitoring/OsmandMonitoringPlugin.java | 13 +++++++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index c2099dab6d..11fb488f19 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -1032,10 +1032,6 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven return mIsDestroyed; } - public boolean isActivityStopped() { - return stopped; - } - private void restartApp() { AlertDialog.Builder bld = new AlertDialog.Builder(this); bld.setMessage(R.string.storage_permission_restart_is_required); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java index 4b3e65c3ea..9efc14030d 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -372,13 +372,14 @@ public class OsmandMonitoringPlugin extends OsmandPlugin { isSaving = false; app.getNotificationHelper().refreshNotifications(); updateControl(); - if (weakReferenceToActivity != null && weakReferenceToActivity.get() instanceof MapActivity - && !((MapActivity) weakReferenceToActivity.get()).isActivityStopped() - && !((MapActivity) weakReferenceToActivity.get()).isActivityDestroyed() - && !Algorithms.isEmpty(result.getFilenames())) { - OnSaveCurrentTrackFragment.showInstance(((MapActivity) weakReferenceToActivity.get()) - .getSupportFragmentManager(), result.getFilenames().get(0)); + if (weakReferenceToActivity != null) { + final Activity a = weakReferenceToActivity.get(); + if (a instanceof MapActivity && !a.isFinishing() && !Algorithms.isEmpty(result.getFilenames())) { + OnSaveCurrentTrackFragment.showInstance(((MapActivity) a) + .getSupportFragmentManager(), result.getFilenames().get(0)); + } } + if (onComplete != null) { onComplete.run(); }