diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 0771bb5cf9..7971a70091 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -1258,7 +1258,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven settings.setLastKnownMapLocation((float) mapView.getLatitude(), (float) mapView.getLongitude()); AnimateDraggingMapThread animatedThread = mapView.getAnimatedDraggingThread(); - if (animatedThread.isAnimating() && animatedThread.getTargetIntZoom() != 0) { + if (animatedThread.isAnimating() && animatedThread.getTargetIntZoom() != 0 && !mapViewTrackingUtilities.isMapLinkedToLocation()) { settings.setMapLocationToShow(animatedThread.getTargetLatitude(), animatedThread.getTargetLongitude(), animatedThread.getTargetIntZoom()); } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java index 71dc479bc8..9eb8591733 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java @@ -138,11 +138,12 @@ public class GeoIntentActivity extends OsmandListActivity { settings.setMapLocationToShow(p.getLatitude(), p.getLongitude(), settings.getLastKnownMapZoom(), pd); //$NON-NLS-1$ MapActivity.launchMapActivityMoveToTop(GeoIntentActivity.this); + } else { + Uri uri = intent.getData(); + String searchString = p != null && p.isGeoAddress() ? p.getQuery() : uri.toString(); + settings.setSearchRequestToShow(searchString); + MapActivity.launchMapActivityMoveToTop(GeoIntentActivity.this); } - Uri uri = intent.getData(); - String searchString = p != null && p.isGeoAddress() ? p.getQuery() : uri.toString(); - settings.setSearchRequestToShow(searchString); - MapActivity.launchMapActivityMoveToTop(GeoIntentActivity.this); } catch (Exception e) { e.printStackTrace(); } diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxImportHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxImportHelper.java index f67eb0beb7..4c905a3f5b 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxImportHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxImportHelper.java @@ -1,11 +1,13 @@ package net.osmand.plus.helpers; +import android.app.Activity; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.AsyncTask; +import android.os.Build; import android.os.Bundle; import android.os.ParcelFileDescriptor; import android.provider.OpenableColumns; @@ -183,7 +185,9 @@ public class GpxImportHelper { @Override protected void onPostExecute(GPXFile result) { - progress.dismiss(); + if (isActivityNotDestroyed(activity)) { + progress.dismiss(); + } handleResult(result, fileName, save, useImportDir, false); } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); @@ -221,7 +225,9 @@ public class GpxImportHelper { @Override protected void onPostExecute(final GPXFile result) { - progress.dismiss(); + if (isActivityNotDestroyed(activity)) { + progress.dismiss(); + } importFavourites(result, fileName, save, useImportDir, forceImportFavourites); } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); @@ -251,7 +257,9 @@ public class GpxImportHelper { @Override protected void onPostExecute(GPXFile result) { - progress.dismiss(); + if (isActivityNotDestroyed(activity)) { + progress.dismiss(); + } Toast.makeText(activity, R.string.fav_imported_sucessfully, Toast.LENGTH_LONG).show(); final Intent newIntent = new Intent(activity, app.getAppCustomization().getFavoritesActivity()); newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); @@ -307,7 +315,9 @@ public class GpxImportHelper { @Override protected void onPostExecute(GPXFile result) { - progress.dismiss(); + if (isActivityNotDestroyed(activity)) { + progress.dismiss(); + } handleResult(result, name, save, useImportDir, false); } @@ -352,12 +362,21 @@ public class GpxImportHelper { @Override protected void onPostExecute(GPXFile result) { - progress.dismiss(); + if (isActivityNotDestroyed(activity)) { + progress.dismiss(); + } handleResult(result, name, save, useImportDir, false); } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } + private boolean isActivityNotDestroyed(Activity activity) { + if (Build.VERSION.SDK_INT >= 17) { + return !activity.isFinishing() && !activity.isDestroyed(); + } + return !activity.isFinishing(); + } + private void handleResult(final GPXFile result, final String name, final boolean save, final boolean useImportDir, boolean forceImportFavourites) { if (result != null) { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenuFragment.java index b969ae5076..b4878e9144 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/ShareMenuFragment.java @@ -44,6 +44,7 @@ public class ShareMenuFragment extends Fragment implements OnItemClickListener { View mainView = view.findViewById(R.id.main_view); if (menu.isLandscapeLayout()) { + AndroidUtils.addStatusBarPadding21v(getContext(), view); AndroidUtils.setBackground(view.getContext(), mainView, !menu.isLight(), R.drawable.bg_left_menu_light, R.drawable.bg_left_menu_dark); } else {