Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Yunitsky <dmitry.yunitsky@gmail.com>2016-09-28 15:38:15 +0300
committerGitHub <noreply@github.com>2016-09-28 15:38:15 +0300
commitf3bac4d92c11b2712f0022fd697cb45b465765b9 (patch)
tree2d3954508e00e0e54d2859ec2d5230e755afb9c8
parentc7b0247ec1c8c2a41126ab00460d19b046b5a852 (diff)
parent01c2ea6353acb656870b098a1d9a4c2451c3dff0 (diff)
Merge pull request #4368 from alexzatsepin/release-64
[android] Fixed the NPE exception in RoutingPlanController while retr…
-rw-r--r--android/src/com/mapswithme/maps/routing/RoutingController.java2
-rw-r--r--android/src/com/mapswithme/maps/routing/RoutingPlanController.java20
2 files changed, 17 insertions, 5 deletions
diff --git a/android/src/com/mapswithme/maps/routing/RoutingController.java b/android/src/com/mapswithme/maps/routing/RoutingController.java
index 27d1682885..4dc809cfd4 100644
--- a/android/src/com/mapswithme/maps/routing/RoutingController.java
+++ b/android/src/com/mapswithme/maps/routing/RoutingController.java
@@ -92,6 +92,7 @@ public class RoutingController
private boolean mContainsCachedResult;
private int mLastResultCode;
private String[] mLastMissingMaps;
+ @Nullable
private RoutingInfo mCachedRoutingInfo;
@SuppressWarnings("FieldCanBeLocal")
@@ -525,6 +526,7 @@ public class RoutingController
return mEndPoint;
}
+ @Nullable
RoutingInfo getCachedRoutingInfo()
{
return mCachedRoutingInfo;
diff --git a/android/src/com/mapswithme/maps/routing/RoutingPlanController.java b/android/src/com/mapswithme/maps/routing/RoutingPlanController.java
index 4d136618e1..46b354457a 100644
--- a/android/src/com/mapswithme/maps/routing/RoutingPlanController.java
+++ b/android/src/com/mapswithme/maps/routing/RoutingPlanController.java
@@ -178,11 +178,24 @@ public class RoutingPlanController extends ToolbarController
private void showAltitudeChartAndRoutingDetails()
{
+ UiUtils.show(mAltitudeChartFrame);
+ mAltitudeChartShown = true;
+ showRoutingDetails();
+ }
+
+ private void showRoutingDetails()
+ {
final View numbersFrame = mAltitudeChartFrame.findViewById(R.id.numbers);
+ final RoutingInfo rinfo = RoutingController.get().getCachedRoutingInfo();
+ if (rinfo == null)
+ {
+ UiUtils.hide(numbersFrame);
+ return;
+ }
+
TextView numbersTime = (TextView) numbersFrame.findViewById(R.id.time);
TextView numbersDistance = (TextView) numbersFrame.findViewById(R.id.distance);
TextView numbersArrival = (TextView) numbersFrame.findViewById(R.id.arrival);
- RoutingInfo rinfo = RoutingController.get().getCachedRoutingInfo();
numbersTime.setText(RoutingController.formatRoutingTime(mFrame.getContext(), rinfo.totalTimeInSeconds,
R.dimen.text_size_routing_number));
numbersDistance.setText(rinfo.distToTarget + " " + rinfo.targetUnits);
@@ -192,11 +205,8 @@ public class RoutingPlanController extends ToolbarController
String arrivalTime = RoutingController.formatArrivalTime(rinfo.totalTimeInSeconds);
numbersArrival.setText(arrivalTime);
}
-
- UiUtils.show(mAltitudeChartFrame);
- mAltitudeChartShown = true;
}
-
+
private void hideAltitudeChartAndRoutingDetails()
{
if (UiUtils.isHidden(mAltitudeChartFrame))