forked from organicmaps/organicmaps
[android] Added ignoring of pp state change if map object is not changed or pp already opened
This commit is contained in:
parent
1d1adecd7c
commit
7369792c34
2 changed files with 16 additions and 6 deletions
|
@ -218,7 +218,17 @@ public class BottomSheetPlacePageController implements PlacePageController, Loca
|
|||
@Override
|
||||
public void openFor(@NonNull MapObject object)
|
||||
{
|
||||
mPlacePage.setMapObject(object, false, policy -> {
|
||||
mPlacePage.setMapObject(object, false, (policy, isSameObject) -> {
|
||||
@AnchorBottomSheetBehavior.State
|
||||
int state = mPlacePageBehavior.getState();
|
||||
// The method openFor could be invoked many times, e.g. when we leave the map and come back
|
||||
// on it. So, we should do nothing if the map object is not changed or place page is already
|
||||
// opened. Otherwise, the place page discards its current state to collapsed state
|
||||
// and it's wrong. This behavior possibly will be refactored, so that the framework doesn't call
|
||||
// 'ActivateMapSelection' method from 'UpdatePlacePageInfoForCurrentSelection'.
|
||||
if (isSameObject && !isHiddenState(state))
|
||||
return;
|
||||
|
||||
if (object.isExtendedView())
|
||||
{
|
||||
mPlacePageBehavior.setState(AnchorBottomSheetBehavior.STATE_EXPANDED);
|
||||
|
@ -446,7 +456,7 @@ public class BottomSheetPlacePageController implements PlacePageController, Loca
|
|||
if (object == null)
|
||||
return;
|
||||
|
||||
mPlacePage.setMapObject(object, true, policy -> {
|
||||
mPlacePage.setMapObject(object, true, (policy, isSameObject) -> {
|
||||
restorePlacePage(object, policy);
|
||||
});
|
||||
mToolbar.setTitle(object.getTitle());
|
||||
|
|
|
@ -335,7 +335,7 @@ public class PlacePageView extends NestedScrollView
|
|||
|
||||
public interface SetMapObjectListener
|
||||
{
|
||||
void onSetMapObjectComplete(@NonNull NetworkPolicy policy);
|
||||
void onSetMapObjectComplete(@NonNull NetworkPolicy policy, boolean isSameObject);
|
||||
}
|
||||
|
||||
public PlacePageView(Context context)
|
||||
|
@ -999,7 +999,7 @@ public class PlacePageView extends NestedScrollView
|
|||
if (listener != null)
|
||||
{
|
||||
NetworkPolicy policy = NetworkPolicy.newInstance(NetworkPolicy.getCurrentNetworkUsageStatus());
|
||||
listener.onSetMapObjectComplete(policy);
|
||||
listener.onSetMapObjectComplete(policy, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1017,7 +1017,7 @@ public class PlacePageView extends NestedScrollView
|
|||
{
|
||||
setMapObjectInternal(policy);
|
||||
if (listener != null)
|
||||
listener.onSetMapObjectComplete(policy);
|
||||
listener.onSetMapObjectComplete(policy, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1026,7 +1026,7 @@ public class PlacePageView extends NestedScrollView
|
|||
NetworkPolicy policy = NetworkPolicy.newInstance(false);
|
||||
setMapObjectInternal(policy);
|
||||
if (listener != null)
|
||||
listener.onSetMapObjectComplete(policy);
|
||||
listener.onSetMapObjectComplete(policy, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue