Merge pull request #6754 from osmandapp/RoutePreparationUiFixes

Route preparation ui fixes
This commit is contained in:
Alexey 2019-03-29 17:18:12 +03:00 committed by GitHub
commit f96da6e335
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 58 additions and 43 deletions

View file

@ -2,20 +2,20 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="18dp" />
<corners android:radius="@dimen/route_info_button_bg_line_radius" />
<stroke android:width="1dp" android:color="@color/active_buttons_and_links_dark" />
</shape>
</item>
<item android:state_enabled="false">
<shape android:shape="rectangle">
<solid android:color="@color/activity_background_dark" />
<corners android:radius="18dp" />
<corners android:radius="@dimen/route_info_button_bg_line_radius" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@null" />
<corners android:radius="18dp" />
<solid android:color="@color/card_and_list_background_dark" />
<corners android:radius="@dimen/route_info_button_bg_line_radius" />
<stroke android:width="1dp" android:color="@color/divider_dark" />
</shape>
</item>

View file

@ -2,20 +2,20 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="18dp" />
<corners android:radius="@dimen/route_info_button_bg_line_radius" />
<stroke android:width="1dp" android:color="@color/active_buttons_and_links_light" />
</shape>
</item>
<item android:state_enabled="false">
<shape android:shape="rectangle">
<solid android:color="@color/activity_background_light" />
<corners android:radius="18dp" />
<corners android:radius="@dimen/route_info_button_bg_line_radius" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@null" />
<corners android:radius="18dp" />
<solid android:color="@color/card_and_list_background_light" />
<corners android:radius="@dimen/route_info_button_bg_line_radius" />
<stroke android:width="1dp" android:color="@color/divider_light" />
</shape>
</item>

View file

@ -11,8 +11,8 @@
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"

View file

@ -12,8 +12,8 @@
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"

View file

@ -12,8 +12,8 @@
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"

View file

@ -14,8 +14,8 @@
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_coordinates_latitude"/>

View file

@ -12,8 +12,8 @@
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
tools:src="@drawable/ic_action_coordinates_latitude"/>

View file

@ -148,12 +148,12 @@
<FrameLayout
android:id="@+id/from_button"
android:layout_width="wrap_content"
android:layout_height="@dimen/route_info_buttons_height"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/context_menu_padding_margin_medium"
android:layout_marginTop="@dimen/route_info_icon_vertical_padding"
android:layout_marginRight="@dimen/context_menu_padding_margin_medium"
android:layout_marginBottom="@dimen/route_info_icon_vertical_padding"
tools:background="@drawable/btn_border_rounded_dark">
tools:background="@drawable/btn_rounded_dark">
<LinearLayout
android:id="@+id/from_button_container"
@ -178,12 +178,13 @@
android:textColor="?attr/active_color_basic"
android:textSize="@dimen/text_button_text_size"
osmand:typeface="@string/font_roboto_medium"
android:visibility="gone"
tools:ignore="UnusedAttribute" />
<ImageView
android:id="@+id/from_button_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_marginLeft="@dimen/route_info_icon_vertical_padding"
android:layout_marginTop="@dimen/route_info_icon_vertical_padding"
android:layout_marginRight="@dimen/route_info_icon_vertical_padding"
@ -269,7 +270,7 @@
android:layout_marginTop="@dimen/route_info_icon_vertical_padding"
android:layout_marginRight="@dimen/context_menu_padding_margin_medium"
android:layout_marginBottom="@dimen/route_info_icon_vertical_padding"
tools:background="@drawable/btn_border_rounded_dark">
tools:background="@drawable/btn_rounded_dark">
<LinearLayout
android:id="@+id/via_button_container"
@ -298,8 +299,8 @@
<ImageView
android:id="@+id/via_button_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_marginLeft="@dimen/route_info_icon_vertical_padding"
android:layout_marginTop="@dimen/route_info_icon_vertical_padding"
android:layout_marginRight="@dimen/route_info_icon_vertical_padding"
@ -382,7 +383,7 @@
android:layout_marginTop="@dimen/route_info_icon_vertical_padding"
android:layout_marginRight="@dimen/context_menu_padding_margin_medium"
android:layout_marginBottom="@dimen/route_info_icon_vertical_padding"
tools:background="@drawable/btn_border_rounded_dark">
tools:background="@drawable/btn_rounded_dark">
<LinearLayout
android:id="@+id/to_button_container"
@ -411,8 +412,8 @@
<ImageView
android:id="@+id/to_button_image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_marginLeft="@dimen/route_info_icon_vertical_padding"
android:layout_marginTop="@dimen/route_info_icon_vertical_padding"
android:layout_marginRight="@dimen/route_info_icon_vertical_padding"
@ -583,7 +584,7 @@
<include
layout="@layout/route_info_menu_control_buttons"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="@dimen/route_info_control_buttons_height"
android:layout_gravity="bottom" />
</LinearLayout>

View file

@ -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">
<FrameLayout

View file

@ -150,7 +150,7 @@
<FrameLayout
android:id="@+id/details_button"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_height="@dimen/route_info_buttons_height"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/route_info_buttons_padding_top_bottom"
android:layout_marginTop="@dimen/route_info_details_padding"
@ -161,7 +161,7 @@
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/details_button_descr"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:ellipsize="end"
android:gravity="center"

View file

@ -77,7 +77,7 @@
<FrameLayout
android:id="@+id/details_button"
android:layout_width="0dp"
android:layout_height="36dp"
android:layout_height="@dimen/route_info_buttons_height"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="horizontal">
@ -85,7 +85,7 @@
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/details_button_descr"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:ellipsize="end"
android:gravity="center"
@ -102,7 +102,7 @@
<FrameLayout
android:id="@+id/show_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="@dimen/route_info_buttons_height"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
@ -112,7 +112,7 @@
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/show_button_descr"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:ellipsize="end"
android:gravity="center"

View file

@ -46,6 +46,7 @@
<dimen name="map_widget_icon_margin">3dp</dimen>
<dimen name="standard_icon_size">36dp</dimen>
<!-- ContextMenu -->
<dimen name="context_menu_top_shadow_h">30dp</dimen>
@ -191,6 +192,8 @@
<dimen name="route_info_legend_padding">12dp</dimen>
<dimen name="route_info_warning_padding">27dp</dimen>
<dimen name="route_info_chart_height">78dp</dimen>
<dimen name="route_info_control_buttons_height">72dp</dimen>
<dimen name="route_info_button_bg_line_radius">27dp</dimen>
<dimen name="multi_selection_header_height">78dp</dimen>

View file

@ -286,6 +286,8 @@
<dimen name="route_info_warning_padding">18dp</dimen>
<dimen name="route_info_chart_height">52dp</dimen>
<dimen name="route_info_toolbar_button_size">40dp</dimen>
<dimen name="route_info_control_buttons_height">48dp</dimen>
<dimen name="route_info_button_bg_line_radius">18dp</dimen>
<dimen name="multi_selection_header_height">52dp</dimen>

View file

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

View file

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

View file

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