From 36ca54f3dcb3c66dd150de75b4c97badc0e78ec1 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Thu, 7 Dec 2017 11:14:31 +0200 Subject: [PATCH 1/4] Fix #4693 --- OsmAnd/src/net/osmand/plus/activities/MapActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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()); } From c4d4d3d4f71a9fccf1eb6afd56291687beb4040b Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Thu, 7 Dec 2017 11:28:34 +0200 Subject: [PATCH 2/4] Fix #4233 --- .../osmand/plus/activities/search/GeoIntentActivity.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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(); } From 8c8366710d4ac4403e14f137743e120418013e3b Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Thu, 7 Dec 2017 12:07:36 +0200 Subject: [PATCH 3/4] Fix "view not attached to window manager" exception --- .../osmand/plus/helpers/GpxImportHelper.java | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) 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) { From 1b790bced4296c3a1fc7cff619d1243b74d713f6 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Thu, 7 Dec 2017 12:44:13 +0200 Subject: [PATCH 4/4] Add indent from status bar in landscape --- .../net/osmand/plus/mapcontextmenu/other/ShareMenuFragment.java | 1 + 1 file changed, 1 insertion(+) 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 {