Fix - Display route calculation progress bar in Waypoints

This commit is contained in:
Alexey Kulish 2016-01-21 20:13:51 +03:00
parent e212cace9e
commit 0a72100730
5 changed files with 109 additions and 3 deletions

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top|center"
android:orientation="horizontal">
<View
android:id="@+id/map_route_land_left_margin_external"
android:layout_width="@dimen/dashboard_land_width"
android:layout_height="0dp"
android:layout_gravity="top|left"
android:visibility="gone"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center"
android:layout_marginTop="@dimen/map_button_margin"
android:background="@drawable/btn_round"
android:orientation="vertical">
<ProgressBar
android:id="@+id/map_horizontal_progress_external"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="@dimen/map_routing_progress_width"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/map_button_margin"
android:layout_marginRight="@dimen/map_button_margin"
android:max="100"
android:progress="60"/>
</LinearLayout>
</LinearLayout>

View file

@ -49,6 +49,16 @@
<include layout="@layout/map_hud_bottom"/>
</FrameLayout>
<FrameLayout
android:id="@+id/progress_layout_external"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<include layout="@layout/map_progress_top"/>
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:gravity="top|center"
android:orientation="horizontal">
<View
android:id="@+id/map_route_land_left_margin_external"
android:layout_width="@dimen/map_route_planning_land_width_minus_shadow"
android:layout_height="0dp"
android:layout_gravity="top|left"
android:visibility="gone"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center"
android:layout_marginTop="@dimen/map_button_margin"
android:background="@drawable/btn_round"
android:orientation="vertical">
<ProgressBar
android:id="@+id/map_horizontal_progress_external"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="@dimen/map_routing_progress_width"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/map_button_margin"
android:layout_marginRight="@dimen/map_button_margin"
android:max="100"
android:progress="60"/>
</LinearLayout>
</LinearLayout>

View file

@ -333,17 +333,29 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
private void createProgressBarForRouting() {
final ProgressBar pb = (ProgressBar) findViewById(R.id.map_horizontal_progress);
final View pbExtView = findViewById(R.id.progress_layout_external);
final ProgressBar pbExt = (ProgressBar) findViewById(R.id.map_horizontal_progress_external);
app.getRoutingHelper().setProgressBar(new RouteCalculationProgressCallback() {
@Override
public void updateProgress(int progress) {
pb.setVisibility(View.VISIBLE);
pb.setProgress(progress);
pb.requestLayout();
if (findViewById(R.id.MapHudButtonsOverlay).getVisibility() == View.VISIBLE) {
pbExtView.setVisibility(View.GONE);
pb.setVisibility(View.VISIBLE);
pb.setProgress(progress);
pb.requestLayout();
} else {
pb.setVisibility(View.GONE);
pbExtView.setVisibility(View.VISIBLE);
pbExt.setProgress(progress);
pbExt.requestLayout();
}
}
@Override
public void finish() {
pbExtView.setVisibility(View.GONE);
pb.setVisibility(View.GONE);
}
});

View file

@ -620,6 +620,12 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
}
mapActivity.findViewById(R.id.toolbar_back).setVisibility(isBackButtonVisible() ? View.VISIBLE : View.GONE);
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
if (!portrait) {
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_route_land_left_margin_external), true);
mapActivity.getMapView().setMapPositionX(1);
mapActivity.refreshMap();
}
updateToolbarActions();
//fabButton.showFloatingActionButton();
@ -634,6 +640,13 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
mapActivity.getRoutingHelper().removeListener(this);
mapActivity.getMapViewTrackingUtilities().setDashboard(null);
hide(dashboardView.findViewById(R.id.animateContent), animation);
if (!mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().isVisible()) {
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_route_land_left_margin_external), false);
mapActivity.getMapView().setMapPositionX(0);
mapActivity.getMapView().refreshMap();
}
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.VISIBLE);
hideActionButton();
for (WeakReference<DashBaseFragment> df : fragList) {