forked from organicmaps/organicmaps
[android] Added pp moving if bookmark set/unset
This commit is contained in:
parent
f01b4f3516
commit
a504175ef3
3 changed files with 25 additions and 3 deletions
|
@ -32,7 +32,8 @@ import com.trafi.anchorbottomsheetbehavior.AnchorBottomSheetBehavior;
|
|||
public class BottomSheetPlacePageController implements PlacePageController, LocationListener,
|
||||
View.OnLayoutChangeListener,
|
||||
BannerController.BannerDetailsRequester,
|
||||
BannerController.BannerStateListener
|
||||
BannerController.BannerStateListener,
|
||||
PlacePageButtonsListener
|
||||
{
|
||||
private static final float ANCHOR_RATIO = 0.3f;
|
||||
private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC);
|
||||
|
@ -201,7 +202,7 @@ public class BottomSheetPlacePageController implements PlacePageController, Loca
|
|||
|
||||
mButtonsLayout = mActivity.findViewById(R.id.pp_buttons_layout);
|
||||
ViewGroup buttons = mButtonsLayout.findViewById(R.id.container);
|
||||
mPlacePage.initButtons(buttons);
|
||||
mPlacePage.initButtons(buttons, this);
|
||||
UiUtils.bringViewToFrontOf(mButtonsLayout, mPlacePage);
|
||||
UiUtils.bringViewToFrontOf(mActivity.findViewById(R.id.app_bar), mPlacePage);
|
||||
mPlacePageTracker = new PlacePageTracker(mPlacePage, mButtonsLayout);
|
||||
|
@ -550,4 +551,13 @@ public class BottomSheetPlacePageController implements PlacePageController, Loca
|
|||
{
|
||||
mPlacePageTracker.onBannerPreview(ad);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBookmarkSet(boolean isSet)
|
||||
{
|
||||
if (isSet)
|
||||
mPlacePageBehavior.setState(AnchorBottomSheetBehavior.STATE_ANCHORED);
|
||||
else
|
||||
mPlacePageBehavior.setState(AnchorBottomSheetBehavior.STATE_COLLAPSED);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
package com.mapswithme.maps.widget.placepage;
|
||||
|
||||
public interface PlacePageButtonsListener
|
||||
{
|
||||
void onBookmarkSet(boolean isSet);
|
||||
}
|
|
@ -306,6 +306,10 @@ public class PlacePageView extends NestedScrollView
|
|||
}
|
||||
};
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@NonNull
|
||||
private PlacePageButtonsListener mPlacePageButtonsListener;
|
||||
|
||||
void setScrollable(boolean scrollable)
|
||||
{
|
||||
mScrollable = scrollable;
|
||||
|
@ -459,8 +463,9 @@ public class PlacePageView extends NestedScrollView
|
|||
initPlaceDescriptionView();
|
||||
}
|
||||
|
||||
public void initButtons(@NonNull ViewGroup buttons)
|
||||
public void initButtons(@NonNull ViewGroup buttons, @NonNull PlacePageButtonsListener listener)
|
||||
{
|
||||
mPlacePageButtonsListener = listener;
|
||||
mButtons = new PlacePageButtons(this, buttons, new PlacePageButtons.ItemListener()
|
||||
{
|
||||
public void onPrepareVisibleView(@NonNull PlacePageButtons.PlacePageButton item,
|
||||
|
@ -526,6 +531,7 @@ public class PlacePageView extends NestedScrollView
|
|||
Statistics.INSTANCE.trackEvent(Statistics.EventName.PP_BOOKMARK);
|
||||
AlohaHelper.logClick(AlohaHelper.PP_BOOKMARK);
|
||||
toggleIsBookmark(mMapObject);
|
||||
mPlacePageButtonsListener.onBookmarkSet(mBookmarkSet);
|
||||
break;
|
||||
|
||||
case SHARE:
|
||||
|
|
Loading…
Add table
Reference in a new issue