diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java index a8a2b8d8c6..d69e913699 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java @@ -1379,7 +1379,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener public WeakReference findMenuFragment() { Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(MapRouteInfoMenuFragment.TAG); - if (fragment != null && !fragment.isDetached()) { + if (fragment instanceof MapRouteInfoMenuFragment && !((MapRouteInfoMenuFragment) fragment).isPaused()) { return new WeakReference<>((MapRouteInfoMenuFragment) fragment); } else { return null; diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java index d0b93df2a3..82c5b1e547 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java @@ -84,6 +84,8 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment { private int screenHeight; private int viewHeight; + private boolean paused; + @Nullable private MapActivity getMapActivity() { FragmentActivity activity = getActivity(); @@ -322,6 +324,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment { @Override public void onResume() { super.onResume(); + paused = false; if (menu == null) { dismiss(); } @@ -343,6 +346,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment { @Override public void onPause() { super.onPause(); + paused = true; if (view != null) { ViewParent parent = view.getParent(); if (parent != null && containerLayoutListener != null) { @@ -380,6 +384,10 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment { return -1; } + public boolean isPaused() { + return paused; + } + private void buildBottomView() { if (cardsContainer != null) { menu.build(cardsContainer); @@ -777,7 +785,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment { public void setBottomShadowVisible(boolean visible) { MapActivity mapActivity = getMapActivity(); - if (mapActivity != null) { + if (mapActivity != null && bottomContainer != null) { if (visible) { AndroidUtils.setForeground(mapActivity, bottomContainer, nightMode, R.drawable.bg_contextmenu_shadow, R.drawable.bg_contextmenu_shadow);