[android] More back press handler simplifications

Signed-off-by: Arnaud Vergnet <arnaud.vergnet@mailo.com>
This commit is contained in:
Arnaud Vergnet 2022-02-06 18:10:59 +01:00 committed by Viktor Govako
parent 25964f41ef
commit 00a4bb46e0
2 changed files with 16 additions and 18 deletions

View file

@ -1135,20 +1135,10 @@ public class MwmActivity extends BaseMwmFragmentActivity
return;
}
if (closeMenu() || closePlacePage() || closeSearchToolbar(true, true) ||
closeBookmarkCategoryToolbar() || closeSidePanel() || closePositionChooser())
{
return;
}
RoutingController routingController = RoutingController.get();
if (routingController.isNavigating())
{
routingController.resetToPlanningState();
return;
}
if (!routingController.cancel())
if (!closeMenu() && !closePlacePage() && !closeSearchToolbar(true, true) &&
!closeBookmarkCategoryToolbar() && !closeSidePanel() && !closePositionChooser() &&
!routingController.resetToPlanningStateIfNavigating() && !routingController.cancel())
{
try
{

View file

@ -514,12 +514,20 @@ public class RoutingController implements Initializable<Void>
backToPlaningStateIfNavigating();
}
public void resetToPlanningState()
/**
* @return False if not navigating, true otherwise
*/
public boolean resetToPlanningStateIfNavigating()
{
build();
if (mContainer != null)
mContainer.onResetToPlanningState();
backToPlaningStateIfNavigating();
if (isNavigating())
{
build();
if (mContainer != null)
mContainer.onResetToPlanningState();
backToPlaningStateIfNavigating();
return true;
}
return false;
}
private void backToPlaningStateIfNavigating()