From 61f733a8e2170f73c05da07381fb62731dbae0d3 Mon Sep 17 00:00:00 2001 From: Chumva Date: Fri, 29 Mar 2019 16:11:05 +0200 Subject: [PATCH] Route preparation ui fixes --- ..._rounded_dark.xml => btn_rounded_dark.xml} | 8 +++---- ...ounded_light.xml => btn_rounded_light.xml} | 8 +++---- .../bottom_sheet_item_with_descr_56dp.xml | 4 ++-- ...heet_item_with_descr_and_checkbox_56dp.xml | 4 ++-- ..._sheet_item_with_descr_and_switch_56dp.xml | 4 ++-- .../bottom_sheet_item_with_radio_btn.xml | 4 ++-- .../layout/bottom_sheet_item_with_switch.xml | 4 ++-- OsmAnd/res/layout/plan_route_info.xml | 23 ++++++++++--------- .../route_info_menu_control_buttons.xml | 2 +- OsmAnd/res/layout/route_info_statistic.xml | 4 ++-- OsmAnd/res/layout/transport_route_card.xml | 8 +++---- OsmAnd/res/values-large/sizes.xml | 3 +++ OsmAnd/res/values/sizes.xml | 2 ++ .../MapRouteInfoMenu.java | 6 ++--- .../RouteOptionsBottomSheet.java | 10 ++++---- .../RoutingOptionsHelper.java | 7 ++++++ 16 files changed, 58 insertions(+), 43 deletions(-) rename OsmAnd/res/drawable/{btn_border_rounded_dark.xml => btn_rounded_dark.xml} (67%) rename OsmAnd/res/drawable/{btn_border_rounded_light.xml => btn_rounded_light.xml} (67%) diff --git a/OsmAnd/res/drawable/btn_border_rounded_dark.xml b/OsmAnd/res/drawable/btn_rounded_dark.xml similarity index 67% rename from OsmAnd/res/drawable/btn_border_rounded_dark.xml rename to OsmAnd/res/drawable/btn_rounded_dark.xml index e823922421..fddd00c115 100644 --- a/OsmAnd/res/drawable/btn_border_rounded_dark.xml +++ b/OsmAnd/res/drawable/btn_rounded_dark.xml @@ -2,20 +2,20 @@ - + - + - - + + diff --git a/OsmAnd/res/drawable/btn_border_rounded_light.xml b/OsmAnd/res/drawable/btn_rounded_light.xml similarity index 67% rename from OsmAnd/res/drawable/btn_border_rounded_light.xml rename to OsmAnd/res/drawable/btn_rounded_light.xml index aee8c9de9d..cdcd101e5f 100644 --- a/OsmAnd/res/drawable/btn_border_rounded_light.xml +++ b/OsmAnd/res/drawable/btn_rounded_light.xml @@ -2,20 +2,20 @@ - + - + - - + + diff --git a/OsmAnd/res/layout/bottom_sheet_item_with_descr_56dp.xml b/OsmAnd/res/layout/bottom_sheet_item_with_descr_56dp.xml index 25ee93e4e2..98076a4b5c 100644 --- a/OsmAnd/res/layout/bottom_sheet_item_with_descr_56dp.xml +++ b/OsmAnd/res/layout/bottom_sheet_item_with_descr_56dp.xml @@ -11,8 +11,8 @@ diff --git a/OsmAnd/res/layout/bottom_sheet_item_with_switch.xml b/OsmAnd/res/layout/bottom_sheet_item_with_switch.xml index 365bc4a467..82a642ce8c 100644 --- a/OsmAnd/res/layout/bottom_sheet_item_with_switch.xml +++ b/OsmAnd/res/layout/bottom_sheet_item_with_switch.xml @@ -12,8 +12,8 @@ diff --git a/OsmAnd/res/layout/plan_route_info.xml b/OsmAnd/res/layout/plan_route_info.xml index ab628df9c0..c66bc4cee4 100644 --- a/OsmAnd/res/layout/plan_route_info.xml +++ b/OsmAnd/res/layout/plan_route_info.xml @@ -148,12 +148,12 @@ + tools:background="@drawable/btn_rounded_dark"> + tools:background="@drawable/btn_rounded_dark"> + tools:background="@drawable/btn_rounded_dark"> diff --git a/OsmAnd/res/layout/route_info_menu_control_buttons.xml b/OsmAnd/res/layout/route_info_menu_control_buttons.xml index e0f86e4a31..ccf67f27c3 100644 --- a/OsmAnd/res/layout/route_info_menu_control_buttons.xml +++ b/OsmAnd/res/layout/route_info_menu_control_buttons.xml @@ -3,7 +3,7 @@ xmlns:osmand="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="48dp" + android:layout_height="@dimen/route_info_control_buttons_height" android:orientation="horizontal"> @@ -85,7 +85,7 @@ 3dp + 36dp 30dp @@ -191,6 +192,8 @@ 12dp 27dp 78dp + 72dp + 27dp 78dp diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml index ad32bfe78b..3a6be2934d 100644 --- a/OsmAnd/res/values/sizes.xml +++ b/OsmAnd/res/values/sizes.xml @@ -286,6 +286,8 @@ 18dp 52dp 40dp + 48dp + 18dp 52dp diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java index 6d2c09300b..4ebb4c47a9 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java @@ -1360,7 +1360,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener LinearLayout viaButtonContainer = (LinearLayout) mainView.findViewById(R.id.via_button_container); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { - AndroidUtils.setBackground(app, viaButton, nightMode, R.drawable.btn_border_rounded_light, R.drawable.btn_border_rounded_dark); + AndroidUtils.setBackground(app, viaButton, nightMode, R.drawable.btn_rounded_light, R.drawable.btn_rounded_dark); AndroidUtils.setBackground(app, viaButtonContainer, nightMode, R.drawable.ripple_rounded_light, R.drawable.ripple_rounded_dark); } else { AndroidUtils.setBackground(app, viaButtonContainer, nightMode, R.drawable.btn_border_trans_rounded_light, R.drawable.btn_border_trans_rounded_dark); @@ -1420,7 +1420,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener final LinearLayout toButtonContainer = (LinearLayout) mainView.findViewById(R.id.to_button_container); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { - AndroidUtils.setBackground(app, toButton, nightMode, R.drawable.btn_border_rounded_light, R.drawable.btn_border_rounded_dark); + AndroidUtils.setBackground(app, toButton, nightMode, R.drawable.btn_rounded_light, R.drawable.btn_rounded_dark); AndroidUtils.setBackground(app, toButtonContainer, nightMode, R.drawable.ripple_rounded_light, R.drawable.ripple_rounded_dark); } else { AndroidUtils.setBackground(app, toButtonContainer, nightMode, R.drawable.btn_border_trans_rounded_light, R.drawable.btn_border_trans_rounded_dark); @@ -1492,7 +1492,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener final LinearLayout fromButtonContainer = (LinearLayout) mainView.findViewById(R.id.from_button_container); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { - AndroidUtils.setBackground(app, fromButton, nightMode, R.drawable.btn_border_rounded_light, R.drawable.btn_border_rounded_dark); + AndroidUtils.setBackground(app, fromButton, nightMode, R.drawable.btn_rounded_light, R.drawable.btn_rounded_dark); AndroidUtils.setBackground(app, fromButtonContainer, nightMode, R.drawable.ripple_rounded_light, R.drawable.ripple_rounded_dark); } else { AndroidUtils.setBackground(app, fromButtonContainer, nightMode, R.drawable.btn_border_trans_rounded_light, R.drawable.btn_border_trans_rounded_dark); diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java index a2d10852d2..5fe6c0a59c 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java @@ -284,16 +284,15 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment { if (parameter != null) { final BottomSheetItemWithCompoundButton[] item = new BottomSheetItemWithCompoundButton[1]; BottomSheetItemWithCompoundButton.Builder builder = new BottomSheetItemWithCompoundButton.Builder(); + int iconId = -1; if (parameter.routingParameter != null || parameter instanceof RoutingOptionsHelper.OtherLocalRoutingParameter) { builder.setTitle(parameter.getText(mapActivity)); - int iconId = parameter.isSelected(settings) ? parameter.getActiveIconId() : parameter.getDisabledIconId(); - if (iconId != -1) { - builder.setIcon(getContentIcon(iconId)); - } + iconId = parameter.isSelected(settings) ? parameter.getActiveIconId() : parameter.getDisabledIconId(); } if (parameter instanceof LocalRoutingParameterGroup) { final LocalRoutingParameterGroup group = (LocalRoutingParameterGroup) parameter; LocalRoutingParameter selected = group.getSelected(settings); + iconId = selected != null ? parameter.getActiveIconId() : parameter.getDisabledIconId(); if (selected != null) { builder.setTitle(group.getText(mapActivity)); builder.setDescription(selected.getText(mapActivity)); @@ -338,6 +337,9 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment { } }); } + if (iconId != -1) { + builder.setIcon(getContentIcon(iconId)); + } item[0] = builder.create(); items.add(item[0]); } diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java index cee04499fc..7e176b8210 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java @@ -474,6 +474,13 @@ public class RoutingOptionsHelper { } private static void updateRoutingParameterIcons(LocalRoutingParameter rp) { + if (rp instanceof LocalRoutingParameterGroup) { + LocalRoutingParameterGroup group = (LocalRoutingParameterGroup) rp; + if (group.groupName.equals(DRIVING_STYLE)) { + rp.activeIconId = R.drawable.ic_action_bicycle_dark; + rp.disabledIconId = R.drawable.ic_action_bicycle_dark; + } + } if (rp.routingParameter == null) { return; }