[android] Added saving/restoring the route if app was in navigaton/planing mode

This commit is contained in:
Александр Зацепин 2017-08-01 18:40:27 +03:00 committed by Roman Kuznetsov
parent 39d664755c
commit 5292178c28
2 changed files with 30 additions and 0 deletions

View file

@ -520,6 +520,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
// }
//});
//getWindow().getDecorView().addOnLayoutChangeListener(mVisibleRectMeasurer);
mTasks.add(new RestoreRouteTask());
}
private void initViews()
@ -952,6 +953,9 @@ public class MwmActivity extends BaseMwmFragmentActivity
if (mFilterController != null)
mFilterController.onSaveState(outState);
if (!isChangingConfigurations())
RoutingController.get().saveRoute();
super.onSaveInstanceState(outState);
}
@ -2314,4 +2318,15 @@ public class MwmActivity extends BaseMwmFragmentActivity
return true;
}
}
private static class RestoreRouteTask implements MapTask
{
@Override
public boolean run(MwmActivity target)
{
RoutingController.get().restoreRoute();
return true;
}
}
}

View file

@ -361,6 +361,21 @@ public class RoutingController implements TaxiManager.TaxiListener
}).show();
}
public void restoreRoute()
{
if (Framework.nativeHasSavedRoutePoints())
{
Framework.nativeLoadRoutePoints();
prepare(getStartPoint(), getEndPoint());
}
}
public void saveRoute()
{
if (isNavigating() || (isPlanning() && isBuilt()))
Framework.nativeSaveRoutePoints();
}
public void prepare(@Nullable MapObject endPoint)
{
prepare(endPoint, false);