forked from organicmaps/organicmaps
[android] add: DisableFollowMode() passed to Java.
This commit is contained in:
parent
8340bfae46
commit
767df7076b
4 changed files with 25 additions and 1 deletions
|
@ -1275,6 +1275,15 @@ extern "C"
|
|||
android::Platform::RunOnGuiThreadImpl(bind(&::Framework::FollowRoute, frm()));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_Framework_nativeDisableFollowing(JNIEnv * env, jclass thiz)
|
||||
{
|
||||
android::Platform::RunOnGuiThreadImpl([]()
|
||||
{
|
||||
(void)g_framework->NativeFramework()->DisableFollowMode();
|
||||
});
|
||||
}
|
||||
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
Java_com_mapswithme_maps_Framework_nativeGenerateTurnNotifications(JNIEnv * env, jclass thiz)
|
||||
{
|
||||
|
|
|
@ -134,6 +134,8 @@ public class Framework
|
|||
|
||||
public native static void nativeFollowRoute();
|
||||
|
||||
public native static void nativeDisableFollowing();
|
||||
|
||||
public native static RoutingInfo nativeGetRouteFollowingInfo();
|
||||
|
||||
// When an end user is going to a turn he gets sound turn instructions.
|
||||
|
|
|
@ -75,6 +75,7 @@ public class RoutingController
|
|||
|
||||
private int mLastBuildProgress;
|
||||
private int mLastRouterType = Framework.nativeGetLastUsedRouter();
|
||||
private RoutingInfo mCachedRoutingInfo;
|
||||
|
||||
@SuppressWarnings("FieldCanBeLocal")
|
||||
private final Framework.RoutingListener mRoutingListener = new Framework.RoutingListener()
|
||||
|
@ -91,12 +92,15 @@ public class RoutingController
|
|||
{
|
||||
if (resultCode == ResultCodesHelper.NO_ERROR)
|
||||
{
|
||||
mCachedRoutingInfo = Framework.nativeGetRouteFollowingInfo();
|
||||
setBuildState(BuildState.BUILT);
|
||||
mLastBuildProgress = 100;
|
||||
updatePlan();
|
||||
return;
|
||||
}
|
||||
|
||||
mCachedRoutingInfo = null;
|
||||
|
||||
if (mContainer == null)
|
||||
return;
|
||||
|
||||
|
@ -182,6 +186,10 @@ public class RoutingController
|
|||
{
|
||||
Log.d(TAG, "[B] State: " + mState + ", BuildState: " + mBuildState + " -> " + newState);
|
||||
mBuildState = newState;
|
||||
|
||||
if (mBuildState == BuildState.BUILT &&
|
||||
!(mStartPoint instanceof MapObject.MyPosition))
|
||||
Framework.nativeDisableFollowing();
|
||||
}
|
||||
|
||||
private void updateProgress()
|
||||
|
@ -486,6 +494,11 @@ public class RoutingController
|
|||
return mEndPoint;
|
||||
}
|
||||
|
||||
public RoutingInfo getCachedRoutingInfo()
|
||||
{
|
||||
return mCachedRoutingInfo;
|
||||
}
|
||||
|
||||
private void checkAndBuildRoute()
|
||||
{
|
||||
if (mContainer != null)
|
||||
|
|
|
@ -120,7 +120,7 @@ public class RoutingPlanController extends ToolbarController
|
|||
if (!ready)
|
||||
return;
|
||||
|
||||
RoutingInfo rinfo = Framework.nativeGetRouteFollowingInfo();
|
||||
RoutingInfo rinfo = RoutingController.get().getCachedRoutingInfo();
|
||||
mNumbersTime.setText(RoutingController.formatRoutingTime(rinfo.totalTimeInSeconds));
|
||||
mNumbersDistance.setText(Utils.formatUnitsText(R.dimen.text_size_routing_number, R.dimen.text_size_routing_dimension,
|
||||
rinfo.distToTarget, rinfo.targetUnits));
|
||||
|
|
Loading…
Add table
Reference in a new issue