This commit is contained in:
Alexey Kulish 2016-08-02 17:49:28 +03:00
parent 93f05e4363
commit 619985962f
2 changed files with 16 additions and 2 deletions

View file

@ -12,8 +12,7 @@ public class DestinationReachedMenu extends BaseMenuController {
} }
public static void show(MapActivity mapActivity) { public static void show(MapActivity mapActivity) {
Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(DestinationReachedMenuFragment.TAG); if (!DestinationReachedMenuFragment.isExists()) {
if (fragment == null || fragment.isDetached()) {
DestinationReachedMenu menu = new DestinationReachedMenu(mapActivity); DestinationReachedMenu menu = new DestinationReachedMenu(mapActivity);
DestinationReachedMenuFragment.showInstance(menu); DestinationReachedMenuFragment.showInstance(menu);
} }

View file

@ -27,8 +27,14 @@ import net.osmand.plus.poi.PoiUIFilter;
public class DestinationReachedMenuFragment extends Fragment { public class DestinationReachedMenuFragment extends Fragment {
public static final String TAG = "DestinationReachedMenuFragment"; public static final String TAG = "DestinationReachedMenuFragment";
private static boolean exists = false;
private DestinationReachedMenu menu; private DestinationReachedMenu menu;
public DestinationReachedMenuFragment() {
exists = true;
}
@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -153,6 +159,15 @@ public class DestinationReachedMenuFragment extends Fragment {
getMapActivity().getContextMenu().setBaseFragmentVisibility(true); getMapActivity().getContextMenu().setBaseFragmentVisibility(true);
} }
@Override
public void onDestroy() {
super.onDestroy();
exists = false;
}
public static boolean isExists() {
return exists;
}
public static void showInstance(DestinationReachedMenu menu) { public static void showInstance(DestinationReachedMenu menu) {
int slideInAnim = menu.getSlideInAnimation(); int slideInAnim = menu.getSlideInAnimation();