diff --git a/android/src/app/organicmaps/widget/placepage/PlacePageController.java b/android/src/app/organicmaps/widget/placepage/PlacePageController.java index 531fb3041e..e0ac913f1a 100644 --- a/android/src/app/organicmaps/widget/placepage/PlacePageController.java +++ b/android/src/app/organicmaps/widget/placepage/PlacePageController.java @@ -189,14 +189,6 @@ public class PlacePageController extends Fragment implements return items; } - private void open() - { - // Only collapse the place page if the data is different from the one already available - mShouldCollapse = PlacePageUtils.isHiddenState(mPlacePageBehavior.getState()) || !MapObject.same(mPreviousMapObject, mMapObject); - mPreviousMapObject = mMapObject; - // Place page will automatically open when the bottom sheet content is loaded so we can compute the peek height - } - private void close() { mPlacePageBehavior.setState(BottomSheetBehavior.STATE_HIDDEN); @@ -306,7 +298,12 @@ public class PlacePageController extends Fragment implements mPlacePage.post(() -> { setPeekHeight(); if (mShouldCollapse && !PlacePageUtils.isCollapsedState(mPlacePageBehavior.getState())) + { mPlacePageBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); + // Make sure to reset the scroll position when opening the place page + if (mPlacePage.getScrollY() != 0) + mPlacePage.setScrollY(0); + } mShouldCollapse = false; }); } @@ -558,7 +555,10 @@ public class PlacePageController extends Fragment implements mMapObject = mapObject; if (mapObject != null) { - open(); + // Only collapse the place page if the data is different from the one already available + mShouldCollapse = PlacePageUtils.isHiddenState(mPlacePageBehavior.getState()) || !MapObject.same(mPreviousMapObject, mMapObject); + mPreviousMapObject = mMapObject; + // Place page will automatically open when the bottom sheet content is loaded so we can compute the peek height createPlacePageFragments(); updateButtons( mapObject,