Clear cards at RP while calculating a route

This commit is contained in:
crimean 2019-02-23 23:16:35 +03:00
parent 176132f504
commit 722475ab5b
2 changed files with 26 additions and 10 deletions

View file

@ -97,6 +97,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
private final TransportRoutingHelper transportHelper;
private final RoutingOptionsHelper routingOptionsHelper;
private GeocodingLookupService geocodingLookupService;
private boolean routeCalculationInProgress;
private boolean selectFromMapTouch;
private PointType selectFromMapPointType;
@ -304,21 +305,36 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
}
}
private boolean setRouteCalculationInProgress(boolean routeCalculationInProgress) {
if (this.routeCalculationInProgress != routeCalculationInProgress) {
this.routeCalculationInProgress = routeCalculationInProgress;
return true;
} else {
return false;
}
}
public void updateRouteCalculationProgress(int progress) {
WeakReference<MapRouteInfoMenuFragment> fragmentRef = findMenuFragment();
if (fragmentRef != null && fragmentRef.get().isVisible()) {
fragmentRef.get().updateRouteCalculationProgress(progress);
fragmentRef.get().updateControlButtons();
MapRouteInfoMenuFragment fragment = fragmentRef != null ? fragmentRef.get() : null;
if (fragmentRef != null && fragment.isVisible()) {
if (setRouteCalculationInProgress(true)) {
fragment.updateInfo();
}
fragment.updateRouteCalculationProgress(progress);
fragment.updateControlButtons();
}
}
public void routeCalculationFinished() {
WeakReference<MapRouteInfoMenuFragment> fragmentRef = findMenuFragment();
if (fragmentRef != null && fragmentRef.get().isVisible()) {
fragmentRef.get().hideRouteCalculationProgressBar();
fragmentRef.get().updateControlButtons();
fragmentRef.get().updateInfo();
fragmentRef.get().openMenuHalfScreen();
MapRouteInfoMenuFragment fragment = fragmentRef != null ? fragmentRef.get() : null;
if (fragmentRef != null && fragment.isVisible()) {
setRouteCalculationInProgress(false);
fragment.hideRouteCalculationProgressBar();
fragment.updateControlButtons();
fragment.updateInfo();
fragment.openMenuHalfScreen();
}
}
@ -397,7 +413,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
menuCards.add(card);
}
bottomShadowVisible = routes.size() == 0;
} else {
} else if (!routeCalculationInProgress) {
HomeWorkCard homeWorkCard = new HomeWorkCard(mapActivity);
menuCards.add(homeWorkCard);

View file

@ -443,7 +443,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
private int getHeaderOnlyTopY() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
return viewHeight - menuTitleHeight - AndroidUtils.dpToPx(mapActivity, 48f);
return viewHeight - menuTitleHeight - AndroidUtils.dpToPx(mapActivity, 50f);
} else {
return 0;
}