From 4e8937459a4687e02f17718e58e4a31d3475e3b4 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Tue, 29 Aug 2017 16:46:14 +0300 Subject: [PATCH] Fix animation in route info --- .../other/MapRouteInfoMenuFragment.java | 54 ++++++++++--------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenuFragment.java index 6a647437ec..6ebf0ee420 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenuFragment.java @@ -95,17 +95,19 @@ public class MapRouteInfoMenuFragment extends Fragment { } public void show(MapActivity mapActivity) { - int slideInAnim = R.anim.slide_in_bottom; - int slideOutAnim = R.anim.slide_out_bottom; - - FragmentTransaction transaction = mapActivity.getSupportFragmentManager() - .beginTransaction() - .add(R.id.routeMenuContainer, this, TAG) - .addToBackStack(TAG); + int slideInAnim = 0; + int slideOutAnim = 0; if (!mapActivity.getMyApplication().getSettings().DO_NOT_USE_ANIMATIONS.get()) { - transaction.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim); + slideInAnim = R.anim.slide_in_bottom; + slideOutAnim = R.anim.slide_out_bottom; } - transaction.commitAllowingStateLoss(); + + mapActivity.getSupportFragmentManager() + .beginTransaction() + .setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim) + .add(R.id.routeMenuContainer, this, TAG) + .addToBackStack(TAG) + .commitAllowingStateLoss(); } public void dismiss() { @@ -169,29 +171,29 @@ public class MapRouteInfoMenuFragment extends Fragment { } public static boolean showInstance(final MapActivity mapActivity) { + boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity); + int slideInAnim = 0; + int slideOutAnim = 0; + if (!mapActivity.getMyApplication().getSettings().DO_NOT_USE_ANIMATIONS.get()) { + if (portrait) { + slideInAnim = R.anim.slide_in_bottom; + slideOutAnim = R.anim.slide_out_bottom; + } else { + slideInAnim = R.anim.slide_in_left; + slideOutAnim = R.anim.slide_out_left; + } + } + try { mapActivity.getContextMenu().hideMenues(); MapRouteInfoMenuFragment fragment = new MapRouteInfoMenuFragment(); - FragmentTransaction transaction = mapActivity.getSupportFragmentManager() + mapActivity.getSupportFragmentManager() .beginTransaction() + .setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim) .add(R.id.routeMenuContainer, fragment, TAG) - .addToBackStack(TAG); - if (!mapActivity.getMyApplication().getSettings().DO_NOT_USE_ANIMATIONS.get()) { - boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity); - int slideInAnim; - int slideOutAnim; - if (portrait) { - slideInAnim = R.anim.slide_in_bottom; - slideOutAnim = R.anim.slide_out_bottom; - } else { - slideInAnim = R.anim.slide_in_left; - slideOutAnim = R.anim.slide_out_left; - } - - transaction.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim); - } - transaction.commitAllowingStateLoss(); + .addToBackStack(TAG) + .commitAllowingStateLoss(); return true;