diff --git a/android/src/com/mapswithme/maps/MwmActivity.java b/android/src/com/mapswithme/maps/MwmActivity.java index 61cf0e6573..4da0aa6eb4 100644 --- a/android/src/com/mapswithme/maps/MwmActivity.java +++ b/android/src/com/mapswithme/maps/MwmActivity.java @@ -1364,6 +1364,7 @@ public class MwmActivity extends BaseMwmFragmentActivity return true; } + // Called from JNI. @Override public void onMapObjectActivated(final MapObject object) { @@ -1385,6 +1386,7 @@ public class MwmActivity extends BaseMwmFragmentActivity mFadeView.fadeOut(); } + // Called from JNI. @Override public void onDismiss(boolean switchFullScreenMode) { diff --git a/android/src/com/mapswithme/maps/widget/placepage/BottomSheetPlacePageController.java b/android/src/com/mapswithme/maps/widget/placepage/BottomSheetPlacePageController.java index 8fce8f53bb..30288dc4cf 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/BottomSheetPlacePageController.java +++ b/android/src/com/mapswithme/maps/widget/placepage/BottomSheetPlacePageController.java @@ -33,7 +33,8 @@ public class BottomSheetPlacePageController implements PlacePageController, Loca View.OnLayoutChangeListener, BannerController.BannerDetailsRequester, BannerController.BannerStateListener, - PlacePageButtonsListener + PlacePageButtonsListener, + Closable { private static final float ANCHOR_RATIO = 0.3f; private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC); @@ -192,6 +193,7 @@ public class BottomSheetPlacePageController implements PlacePageController, Loca mPlacePageBehavior = AnchorBottomSheetBehavior.from(mPlacePage); mPlacePageBehavior.addBottomSheetCallback(mSheetCallback); mPlacePage.addOnLayoutChangeListener(this); + mPlacePage.addClosable(this); ViewGroup bannerContainer = mPlacePage.findViewById(R.id.banner_container); DefaultAdTracker tracker = new DefaultAdTracker(); @@ -350,7 +352,7 @@ public class BottomSheetPlacePageController implements PlacePageController, Loca public void close() { mPlacePageBehavior.setState(AnchorBottomSheetBehavior.STATE_HIDDEN); - mPlacePage.hide(); + mPlacePage.reset(); } @Override @@ -581,4 +583,10 @@ public class BottomSheetPlacePageController implements PlacePageController, Loca mPlacePageBehavior.setState(AnchorBottomSheetBehavior.STATE_ANCHORED); } + + @Override + public void closePlacePage() + { + close(); + } } diff --git a/android/src/com/mapswithme/maps/widget/placepage/Closable.java b/android/src/com/mapswithme/maps/widget/placepage/Closable.java new file mode 100644 index 0000000000..beab9a4f73 --- /dev/null +++ b/android/src/com/mapswithme/maps/widget/placepage/Closable.java @@ -0,0 +1,6 @@ +package com.mapswithme.maps.widget.placepage; + +public interface Closable +{ + void closePlacePage(); +} diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index 2c52bbd333..297f2aa918 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -309,12 +309,19 @@ public class PlacePageView extends NestedScrollView @SuppressWarnings("NullableProblems") @NonNull private PlacePageButtonsListener mPlacePageButtonsListener; + @Nullable + private Closable mClosable; void setScrollable(boolean scrollable) { mScrollable = scrollable; } + void addClosable(@NonNull Closable closable) + { + mClosable = closable; + } + @Override public boolean onTouchEvent(MotionEvent ev) { @@ -570,11 +577,11 @@ public class PlacePageView extends NestedScrollView if (!controller.isPlanning()) { controller.prepare(mMapObject, null); - hide(); + close(); } else if (controller.setStartPoint(mMapObject)) { - hide(); + close(); } break; @@ -582,7 +589,7 @@ public class PlacePageView extends NestedScrollView if (RoutingController.get().isPlanning()) { RoutingController.get().setEndPoint(mMapObject); - hide(); + close(); } else { @@ -1687,7 +1694,7 @@ public class PlacePageView extends NestedScrollView case R.id.tv__place_page_order_taxi: RoutingController.get().prepare(LocationHelper.INSTANCE.getMyPosition(), mMapObject, Framework.ROUTER_TYPE_TAXI); - hide(); + close(); if (mMapObject != null) { List types = mMapObject.getReachableByTaxiTypes(); @@ -1806,9 +1813,16 @@ public class PlacePageView extends NestedScrollView return true; } - public void hide() + private void close() + { + if (mClosable != null) + mClosable.closePlacePage(); + } + + void reset() { scrollTo(0, 0); + clearBookmarkWebView(); detachCountry(); }