[android] Recovered pp closing from the click on views contained in pp

This commit is contained in:
Александр Зацепин 2019-02-12 17:46:50 +03:00 committed by yoksnod
parent c8a1af24f0
commit 8056d5ab73
4 changed files with 37 additions and 7 deletions

View file

@ -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)
{

View file

@ -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();
}
}

View file

@ -0,0 +1,6 @@
package com.mapswithme.maps.widget.placepage;
public interface Closable
{
void closePlacePage();
}

View file

@ -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<TaxiType> 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();
}