From d1d6eaeb737e0c3383269dc892340050fa9f2d0d Mon Sep 17 00:00:00 2001 From: Alex Sytnyk Date: Thu, 24 May 2018 15:48:13 +0300 Subject: [PATCH] Add route calculation progress to the map route info menu --- OsmAnd/res/layout-land/plan_route_info.xml | 11 +++++++++++ OsmAnd/res/layout/plan_route_info.xml | 11 +++++++++++ .../osmand/plus/activities/MapActivity.java | 3 ++- .../mapcontextmenu/other/MapRouteInfoMenu.java | 14 ++++++++++++++ .../other/MapRouteInfoMenuFragment.java | 18 ++++++++++++++++++ 5 files changed, 56 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/layout-land/plan_route_info.xml b/OsmAnd/res/layout-land/plan_route_info.xml index ed694f5509..0cfca0ac48 100644 --- a/OsmAnd/res/layout-land/plan_route_info.xml +++ b/OsmAnd/res/layout-land/plan_route_info.xml @@ -17,6 +17,17 @@ android:clickable="true" android:orientation="vertical"> + + + + fragmentRef = findMenuFragment(); + if (fragmentRef != null) { + fragmentRef.get().updateRouteCalculationProgress(progress); + } + } + + public void routeCalculationFinished() { + WeakReference fragmentRef = findMenuFragment(); + if (fragmentRef != null) { + fragmentRef.get().hideRouteCalculationProgressBar(); + } + } + public void updateMenu() { WeakReference fragmentRef = findMenuFragment(); if (fragmentRef != null) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenuFragment.java index ec64575323..d8c810d8bc 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenuFragment.java @@ -7,6 +7,7 @@ import android.support.v4.app.FragmentManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.ProgressBar; import android.widget.TextView; import net.osmand.AndroidUtils; @@ -106,6 +107,23 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment { } } + public void updateRouteCalculationProgress(int progress) { + ProgressBar progressBar = (ProgressBar) mainView.findViewById(R.id.progress_bar); + if (progressBar != null) { + if (progressBar.getVisibility() != View.VISIBLE) { + progressBar.setVisibility(View.VISIBLE); + } + progressBar.setProgress(progress); + } + } + + public void hideRouteCalculationProgressBar() { + View progressBar = mainView.findViewById(R.id.progress_bar); + if (progressBar != null) { + progressBar.setVisibility(View.GONE); + } + } + public void show(MapActivity mapActivity) { int slideInAnim = 0; int slideOutAnim = 0;