[android] reset place page scroll on open #5159
1 changed files with 9 additions and 9 deletions
|
@ -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,
|
||||
|
|
Reference in a new issue