Fix #5620
This commit is contained in:
parent
b9a2996d6b
commit
e22167f98d
6 changed files with 55 additions and 118 deletions
|
@ -1,35 +0,0 @@
|
|||
<?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>
|
|
@ -56,16 +56,6 @@
|
|||
android:id="@+id/MapHudButtonsOverlayQuickActions"/>
|
||||
</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"
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
<?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>
|
18
OsmAnd/res/layout/plan_route_progress_bar.xml
Normal file
18
OsmAnd/res/layout/plan_route_progress_bar.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="4dp"
|
||||
android:max="100"
|
||||
android:visibility="gone"
|
||||
tools:progress="60"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
</FrameLayout>
|
|
@ -429,8 +429,6 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
|
||||
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() {
|
||||
|
||||
|
@ -446,11 +444,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
@Override
|
||||
public void updateProgress(int progress) {
|
||||
mapLayers.getMapControlsLayer().getMapRouteInfoMenu().updateRouteCalculationProgress(progress);
|
||||
dashboardOnMap.updateRouteCalculationProgress(progress);
|
||||
if (findViewById(R.id.MapHudButtonsOverlay).getVisibility() == View.VISIBLE) {
|
||||
if (pbExtView.getVisibility() == View.VISIBLE) {
|
||||
pbExtView.setVisibility(View.GONE);
|
||||
}
|
||||
if (MapRouteInfoMenu.isVisible()) {
|
||||
if (MapRouteInfoMenu.isVisible() || dashboardOnMap.isVisible()) {
|
||||
pb.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
|
@ -460,16 +456,6 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
pb.setProgress(progress);
|
||||
pb.invalidate();
|
||||
pb.requestLayout();
|
||||
} else {
|
||||
if (pb.getVisibility() == View.VISIBLE) {
|
||||
pb.setVisibility(View.GONE);
|
||||
}
|
||||
if (pbExtView.getVisibility() == View.GONE) {
|
||||
pbExtView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
pbExt.setProgress(progress);
|
||||
pbExt.invalidate();
|
||||
pbExt.requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -507,7 +493,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
@Override
|
||||
public void finish() {
|
||||
mapLayers.getMapControlsLayer().getMapRouteInfoMenu().routeCalculationFinished();
|
||||
pbExtView.setVisibility(View.GONE);
|
||||
dashboardOnMap.routeCalculationFinished();
|
||||
pb.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.support.v4.view.ViewCompat;
|
|||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewAnimationUtils;
|
||||
|
@ -35,6 +36,7 @@ import android.widget.FrameLayout;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.ImageView.ScaleType;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -164,6 +166,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
private long lastUpOrCancelMotionEventTime;
|
||||
private TextView listEmptyTextView;
|
||||
private int[] animationCoordinates;
|
||||
private ProgressBar planRouteProgressBar;
|
||||
|
||||
int baseColor;
|
||||
|
||||
|
@ -215,6 +218,21 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
return waypointDialogHelper;
|
||||
}
|
||||
|
||||
public void updateRouteCalculationProgress(int progress) {
|
||||
if (planRouteProgressBar != null) {
|
||||
if (planRouteProgressBar.getVisibility() != View.VISIBLE) {
|
||||
planRouteProgressBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
planRouteProgressBar.setProgress(progress);
|
||||
}
|
||||
}
|
||||
|
||||
public void routeCalculationFinished() {
|
||||
if (planRouteProgressBar != null) {
|
||||
planRouteProgressBar.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public void createDashboardView() {
|
||||
baseColor = ContextCompat.getColor(mapActivity, R.color.osmand_orange) & 0x00ffffff;
|
||||
waypointDialogHelper = new WaypointDialogHelper(mapActivity);
|
||||
|
@ -382,6 +400,10 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
dashboardView.findViewById(R.id.animateContent).setOnClickListener(listener);
|
||||
dashboardView.findViewById(R.id.map_part_dashboard).setOnClickListener(listener);
|
||||
|
||||
View pbContainer = LayoutInflater.from(mapActivity).inflate(R.layout.plan_route_progress_bar, null);
|
||||
planRouteProgressBar = (ProgressBar) pbContainer.findViewById(R.id.progress_bar);
|
||||
listView.addHeaderView(pbContainer);
|
||||
|
||||
initActionButtons();
|
||||
dashboardView.addView(actionButton);
|
||||
}
|
||||
|
@ -756,12 +778,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
}
|
||||
mapActivity.findViewById(R.id.toolbar_back).setVisibility(isBackButtonVisible() ? View.VISIBLE : View.GONE);
|
||||
mapActivity.getMapLayers().getMapControlsLayer().hideMapControls();
|
||||
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();
|
||||
|
@ -772,13 +788,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
} else {
|
||||
mapActivity.getMapViewTrackingUtilities().setDashboard(null);
|
||||
hide(animation);
|
||||
|
||||
if (!MapRouteInfoMenu.isVisible()) {
|
||||
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_route_land_left_margin_external), false);
|
||||
mapActivity.getMapView().setMapPositionX(0);
|
||||
mapActivity.getMapView().refreshMap();
|
||||
}
|
||||
|
||||
mapActivity.getMapLayers().getMapControlsLayer().showMapControlsIfHidden();
|
||||
hideActionButton();
|
||||
for (WeakReference<DashBaseFragment> df : fragList) {
|
||||
|
@ -829,6 +838,14 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
listView.setDivider(null);
|
||||
}
|
||||
AndroidUtils.setTextSecondaryColor(mapActivity, listEmptyTextView, nightMode);
|
||||
|
||||
if (planRouteProgressBar != null) {
|
||||
int bgColor = ContextCompat.getColor(mapActivity, nightMode
|
||||
? R.color.map_progress_bar_bg_dark : R.color.map_progress_bar_bg_light);
|
||||
planRouteProgressBar.setProgressDrawable(AndroidUtils.createProgressDrawable(
|
||||
bgColor, mapActivity.getMapLayers().getRouteLayer().getRouteLineColor(nightMode)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private int dpToPx(float dp) {
|
||||
|
@ -1372,17 +1389,14 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
|||
|
||||
private void updateListAdapter(ArrayAdapter<?> listAdapter, OnItemClickListener listener) {
|
||||
this.listAdapter = listAdapter;
|
||||
this.listAdapterOnClickListener = listener;
|
||||
if (this.listView != null) {
|
||||
listAdapterOnClickListener = listener;
|
||||
if (listView != null) {
|
||||
listView.setAdapter(listAdapter);
|
||||
if (!portrait) {
|
||||
listView.setOnItemClickListener(this.listAdapterOnClickListener);
|
||||
} else if (this.listAdapterOnClickListener != null) {
|
||||
if (listAdapterOnClickListener != null) {
|
||||
listView.setOnItemClickListener(new OnItemClickListener() {
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
listAdapterOnClickListener.onItemClick(parent, view, position - 1, id);
|
||||
listAdapterOnClickListener.onItemClick(parent, view, position - listView.getHeaderViewsCount(), id);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue