diff options
author | Dmitry Yunitsky <dmitry.yunitsky@gmail.com> | 2016-09-28 15:38:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-28 15:38:15 +0300 |
commit | f3bac4d92c11b2712f0022fd697cb45b465765b9 (patch) | |
tree | 2d3954508e00e0e54d2859ec2d5230e755afb9c8 | |
parent | c7b0247ec1c8c2a41126ab00460d19b046b5a852 (diff) | |
parent | 01c2ea6353acb656870b098a1d9a4c2451c3dff0 (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.java | 2 | ||||
-rw-r--r-- | android/src/com/mapswithme/maps/routing/RoutingPlanController.java | 20 |
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)) |