From 841eb28610ccbe4303af7be9abf3b6f23283d873 Mon Sep 17 00:00:00 2001 From: Chumva Date: Wed, 20 Mar 2019 18:32:47 +0200 Subject: [PATCH] Add routeCalculationStarted method --- .../osmand/plus/activities/MapActivity.java | 1 + .../routepreparationmenu/MapRouteInfoMenu.java | 18 +++++++++++------- .../MapRouteInfoMenuFragment.java | 3 --- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 1eb4f3e2c4..587f9b95a1 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -443,6 +443,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven @Override public void start() { setupRouteCalculationProgressBar(pb); + mapRouteInfoMenu.routeCalculationStarted(); } @Override diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java index 1f846e68ae..bd8072bf58 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java @@ -387,15 +387,22 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener } } + public void routeCalculationStarted() { + WeakReference fragmentRef = findMenuFragment(); + MapRouteInfoMenuFragment fragment = fragmentRef != null ? fragmentRef.get() : null; + if (fragmentRef != null && fragment.isVisible()) { + setRouteCalculationInProgress(true); + fragment.updateRouteCalculationProgress(0); + fragment.updateControlButtons(); + fragment.updateInfo(); + } + } + public void updateRouteCalculationProgress(int progress) { WeakReference fragmentRef = findMenuFragment(); MapRouteInfoMenuFragment fragment = fragmentRef != null ? fragmentRef.get() : null; if (fragmentRef != null && fragment.isVisible()) { - if (setRouteCalculationInProgress(true)) { - fragment.updateInfo(); - } fragment.updateRouteCalculationProgress(progress); - fragment.updateControlButtons(); } } @@ -705,9 +712,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener routingHelper.setAppMode(next); app.initVoiceCommandPlayer(mapActivity, next, true, null, false, false); routingHelper.recalculateRouteDueToSettingsChange(); - if (setRouteCalculationInProgress(true) || mode != next) { - updateMenu(); - } } } diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java index a84d43e2ac..6cd3fe71ed 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java @@ -841,9 +841,6 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment { } TextViewExProgress textViewExProgress = (TextViewExProgress) view.findViewById(R.id.start_button_descr); textViewExProgress.percent = progress / 100f; - int color = nightMode ? R.color.main_font_dark : R.color.card_and_list_background_light; - textViewExProgress.color1 = ContextCompat.getColor(mapActivity, color); - textViewExProgress.color2 = ContextCompat.getColor(mapActivity, R.color.description_font_and_bottom_sheet_icons); textViewExProgress.invalidate(); }