[android] Fixed possible crashes.

This commit is contained in:
Dmitry Yunitsky 2015-08-11 14:09:17 +03:00 committed by Alex Zolotarev
parent b95fc5602c
commit 3d8126cdf5
3 changed files with 8 additions and 2 deletions

View file

@ -705,10 +705,12 @@ public class MWMActivity extends BaseMwmFragmentActivity
{
mLayoutRouting.updateRouteInfo();
// TODO think about moving TtsPlayer logic to RoutingLayout to minimyze native calls.
// TODO think about moving TtsPlayer logic to RoutingLayout to minimize native calls.
if (state == RoutingLayout.State.TURN_INSTRUCTIONS)
{
RoutingInfo info = Framework.nativeGetRouteFollowingInfo();
if (info == null)
return;
TtsPlayer.INSTANCE.speakNotifications(info.turnNotifications);
}
}

View file

@ -274,6 +274,8 @@ public class RoutingLayout extends FrameLayout implements CompoundButton.OnCheck
private void refreshTurnInstructions()
{
RoutingInfo info = Framework.nativeGetRouteFollowingInfo();
if (info == null)
return;
if (Framework.getRouter() == Framework.ROUTER_TYPE_VEHICLE)
{
@ -305,6 +307,8 @@ public class RoutingLayout extends FrameLayout implements CompoundButton.OnCheck
private void refreshRouteSetup()
{
RoutingInfo info = Framework.nativeGetRouteFollowingInfo();
if (info == null)
return;
mTvPrepareDistance.setText(info.distToTarget + " " + info.targetUnits.toUpperCase());
mTvPrepareTime.setText(formatTime(info.totalTimeInSeconds));

View file

@ -634,7 +634,7 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
if (ParsedMwmRequest.hasRequest())
{
final ParsedMwmRequest request = ParsedMwmRequest.getCurrentRequest();
if (request.isPickPointMode())
if (ParsedMwmRequest.isPickPointMode())
request.setPointData(mMapObject.getLat(), mMapObject.getLon(), mMapObject.getName(), "");
request.sendResponseAndFinish(activity, true);
}