Add routeCalculationStarted method

This commit is contained in:
Chumva 2019-03-20 18:32:47 +02:00
parent 3d156cc033
commit 841eb28610
3 changed files with 12 additions and 10 deletions

View file

@ -443,6 +443,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
@Override
public void start() {
setupRouteCalculationProgressBar(pb);
mapRouteInfoMenu.routeCalculationStarted();
}
@Override

View file

@ -387,15 +387,22 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
}
}
public void routeCalculationStarted() {
WeakReference<MapRouteInfoMenuFragment> 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<MapRouteInfoMenuFragment> 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();
}
}
}

View file

@ -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();
}