Merge pull request #6543 from osmandapp/RoutePreparation
Route preparation improvements
This commit is contained in:
commit
7ab19369a3
24 changed files with 238 additions and 106 deletions
|
@ -37,7 +37,7 @@ public class TransportRoutePlanner {
|
|||
for(TransportRouteSegment s : endStops) {
|
||||
endSegments.put(s.getId(), s);
|
||||
}
|
||||
PriorityQueue<TransportRouteSegment> queue = new PriorityQueue<TransportRouteSegment>(new SegmentsComparator(ctx));
|
||||
PriorityQueue<TransportRouteSegment> queue = new PriorityQueue<TransportRouteSegment>(startStops.size(), new SegmentsComparator(ctx));
|
||||
for(TransportRouteSegment r : startStops){
|
||||
r.walkDist = (float) MapUtils.getDistance(r.getLocation(), start);
|
||||
r.distFromStart = r.walkDist / ctx.cfg.walkSpeed;
|
||||
|
|
22
OsmAnd/res/drawable/btn_border_dark.xml
Normal file
22
OsmAnd/res/drawable/btn_border_dark.xml
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="4dp" />
|
||||
<stroke android:width="1dp" android:color="@color/route_info_go_btn_inking_dark" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_enabled="false">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/activity_background_dark" />
|
||||
<corners android:radius="4dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@null" />
|
||||
<corners android:radius="4dp" />
|
||||
<stroke android:width="1dp" android:color="@color/divider_dark" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
22
OsmAnd/res/drawable/btn_border_light.xml
Normal file
22
OsmAnd/res/drawable/btn_border_light.xml
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="4dp" />
|
||||
<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="4dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@null" />
|
||||
<corners android:radius="4dp" />
|
||||
<stroke android:width="1dp" android:color="@color/divider_light" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
10
OsmAnd/res/drawable/btn_border_pressed_trans_dark.xml
Normal file
10
OsmAnd/res/drawable/btn_border_pressed_trans_dark.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/active_buttons_and_links_trans_dark" />
|
||||
<stroke android:width="1dp" android:color="@color/active_buttons_and_links_dark" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
10
OsmAnd/res/drawable/btn_border_pressed_trans_light.xml
Normal file
10
OsmAnd/res/drawable/btn_border_pressed_trans_light.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/active_buttons_and_links_trans_light" />
|
||||
<stroke android:width="1dp" android:color="@color/active_buttons_and_links_light" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
22
OsmAnd/res/drawable/btn_border_rounded_dark.xml
Normal file
22
OsmAnd/res/drawable/btn_border_rounded_dark.xml
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="18dp" />
|
||||
<stroke android:width="1dp" android:color="@color/route_info_go_btn_inking_dark" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_enabled="false">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/activity_background_dark" />
|
||||
<corners android:radius="18dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@null" />
|
||||
<corners android:radius="18dp" />
|
||||
<stroke android:width="1dp" android:color="@color/divider_dark" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
22
OsmAnd/res/drawable/btn_border_rounded_light.xml
Normal file
22
OsmAnd/res/drawable/btn_border_rounded_light.xml
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="18dp" />
|
||||
<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" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@null" />
|
||||
<corners android:radius="18dp" />
|
||||
<stroke android:width="1dp" android:color="@color/divider_light" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -3,7 +3,8 @@
|
|||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="4dp" />
|
||||
<stroke android:width="1dp" android:color="@color/route_info_go_btn_inking_dark" />
|
||||
<solid android:color="@color/active_buttons_and_links_trans_dark" />
|
||||
<stroke android:width="1dp" android:color="@color/active_buttons_and_links_dark" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_enabled="false">
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/active_buttons_and_links_trans_light" />
|
||||
<stroke android:width="1dp" android:color="@color/active_buttons_and_links_light" />
|
||||
</shape>
|
||||
</item>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="18dp" />
|
||||
<solid android:color="@color/active_buttons_and_links_trans_dark" />
|
||||
<stroke android:width="1dp" android:color="@color/route_info_go_btn_inking_dark" />
|
||||
</shape>
|
||||
</item>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="18dp" />
|
||||
<solid android:color="@color/active_buttons_and_links_trans_light" />
|
||||
<stroke android:width="1dp" android:color="@color/active_buttons_and_links_light" />
|
||||
</shape>
|
||||
</item>
|
||||
|
|
9
OsmAnd/res/drawable/btn_pressed_trans_dark.xml
Normal file
9
OsmAnd/res/drawable/btn_pressed_trans_dark.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/active_buttons_and_links_trans_dark" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
10
OsmAnd/res/drawable/btn_pressed_trans_light.xml
Normal file
10
OsmAnd/res/drawable/btn_pressed_trans_light.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/active_buttons_and_links_trans_light" />
|
||||
<stroke android:width="1dp" android:color="@color/active_buttons_and_links_light" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -24,6 +24,6 @@
|
|||
android:layout_marginBottom="@dimen/route_info_icon_vertical_padding"
|
||||
android:layout_marginTop="@dimen/route_info_icon_vertical_padding"
|
||||
android:scaleType="center"
|
||||
tools:background="@drawable/btn_border_trans_light" />
|
||||
tools:background="@drawable/btn_border_light" />
|
||||
|
||||
</FrameLayout>
|
|
@ -145,7 +145,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_trans_rounded_dark">
|
||||
tools:background="@drawable/btn_border_rounded_dark">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/from_button_container"
|
||||
|
@ -259,7 +259,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_trans_rounded_dark">
|
||||
tools:background="@drawable/btn_border_rounded_dark">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/via_button_container"
|
||||
|
@ -370,7 +370,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_trans_rounded_dark">
|
||||
tools:background="@drawable/btn_border_rounded_dark">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/to_button_container"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:gravity="start"
|
||||
android:visibility="visible"
|
||||
tools:background="@drawable/btn_border_trans_dark">
|
||||
tools:background="@drawable/btn_border_dark">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/route_option_image_view"
|
||||
|
@ -56,6 +56,6 @@
|
|||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible"
|
||||
tools:background="@drawable/btn_border_trans_dark" />
|
||||
tools:background="@drawable/btn_border_dark" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,74 +1,68 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/route_option_button"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="32dp"
|
||||
android:orientation="horizontal"
|
||||
tools:background="@drawable/btn_border_trans_dark">
|
||||
android:visibility="visible"
|
||||
tools:background="@drawable/btn_border_dark">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/removable_option"
|
||||
<LinearLayout
|
||||
android:id="@+id/route_removable_option_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="visible">
|
||||
android:gravity="start|center_vertical"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/route_removable_option_container"
|
||||
android:layout_width="match_parent"
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/route_removable_option_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="start|center_vertical"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/route_removable_option_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:maxLines="1"
|
||||
android:paddingBottom="3dp"
|
||||
android:paddingTop="3dp"
|
||||
android:text="@string/routing_attr_avoid_motorway_name"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:ignore="UnusedAttribute"
|
||||
tools:textColor="?attr/wikivoyage_active_color" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/title_divider"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:background="@color/description_font_and_bottom_sheet_icons" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/removable_option_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginLeft="1dp"
|
||||
android:layout_marginRight="1dp"
|
||||
android:paddingBottom="3dp"
|
||||
android:paddingLeft="@dimen/route_info_icon_vertical_padding"
|
||||
android:paddingRight="@dimen/route_info_icon_vertical_padding"
|
||||
android:layout_gravity="center"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:maxLines="1"
|
||||
android:paddingTop="3dp"
|
||||
tools:src="@drawable/ic_action_remove_dark" />
|
||||
android:paddingBottom="3dp"
|
||||
android:text="@string/routing_attr_avoid_motorway_name"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:ignore="UnusedAttribute"
|
||||
tools:textColor="?attr/wikivoyage_active_color" />
|
||||
|
||||
<View
|
||||
android:id="@+id/options_divider_end"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_gravity="end|center_vertical" />
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
<View
|
||||
android:id="@+id/title_divider"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:background="@color/description_font_and_bottom_sheet_icons" />
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/removable_option_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginLeft="1dp"
|
||||
android:layout_marginRight="1dp"
|
||||
android:paddingLeft="@dimen/route_info_icon_vertical_padding"
|
||||
android:paddingTop="3dp"
|
||||
android:paddingRight="@dimen/route_info_icon_vertical_padding"
|
||||
android:paddingBottom="3dp"
|
||||
android:contentDescription="@string/shared_string_remove"
|
||||
tools:src="@drawable/ic_action_remove_dark" />
|
||||
|
||||
<View
|
||||
android:id="@+id/options_divider_end"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_gravity="end|center_vertical" />
|
||||
|
||||
</FrameLayout>
|
|
@ -127,9 +127,9 @@ public class AppModeDialog {
|
|||
}
|
||||
}
|
||||
|
||||
public static void updateButtonState2(final OsmandApplication ctx, final List<ApplicationMode> visible,
|
||||
final Set<ApplicationMode> selected, final View.OnClickListener onClickListener, final View[] buttons,
|
||||
int i, final boolean singleChoice, final boolean useMapTheme, final boolean nightMode) {
|
||||
public static void updateButtonStateForRoute(final OsmandApplication ctx, final List<ApplicationMode> visible,
|
||||
final Set<ApplicationMode> selected, final View.OnClickListener onClickListener, final View[] buttons,
|
||||
int i, final boolean singleChoice, final boolean useMapTheme, final boolean nightMode) {
|
||||
if (buttons[i] != null) {
|
||||
View tb = buttons[i];
|
||||
final ApplicationMode mode = visible.get(i);
|
||||
|
@ -143,11 +143,11 @@ public class AppModeDialog {
|
|||
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_checked)));
|
||||
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
AndroidUtils.setBackground(ctx, iv, nightMode, R.drawable.btn_border_light, R.drawable.btn_border_dark);
|
||||
AndroidUtils.setBackground(ctx, selection, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(ctx, selection, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
}
|
||||
AndroidUtils.setBackground(ctx, iv, nightMode, R.drawable.btn_border_trans_light, R.drawable.ripple_dark);
|
||||
} else {
|
||||
if (useMapTheme) {
|
||||
Drawable drawable = ctx.getUIUtilities().getIcon(mode.getSmallIconDark(), nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
||||
|
@ -157,14 +157,14 @@ public class AppModeDialog {
|
|||
}
|
||||
iv.setImageDrawable(drawable);
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
AndroidUtils.setBackground(ctx, iv, nightMode, R.drawable.btn_border_pressed_light, R.drawable.btn_border_pressed_dark);
|
||||
AndroidUtils.setBackground(ctx, selection, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(ctx, selection, nightMode, R.drawable.btn_border_pressed_light, R.drawable.btn_border_pressed_dark);
|
||||
AndroidUtils.setBackground(ctx, selection, nightMode, R.drawable.btn_border_pressed_trans_light, R.drawable.btn_border_pressed_trans_dark);
|
||||
}
|
||||
} else {
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getThemedIcon(mode.getSmallIconDark()));
|
||||
}
|
||||
AndroidUtils.setBackground(ctx, iv, nightMode, R.drawable.btn_border_pressed_light, R.drawable.btn_border_pressed_dark);
|
||||
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_unchecked)));
|
||||
}
|
||||
tb.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -188,7 +188,7 @@ public class AppModeDialog {
|
|||
onClickListener.onClick(null);
|
||||
}
|
||||
for (int i = 0; i < visible.size(); i++) {
|
||||
updateButtonState2(ctx, visible, selected, onClickListener, buttons, i, singleChoice, useMapTheme, nightMode);
|
||||
updateButtonStateForRoute(ctx, visible, selected, onClickListener, buttons, i, singleChoice, useMapTheme, nightMode);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -124,9 +124,11 @@ public class AvoidRoadsBottomSheetDialogFragment extends MenuBottomSheetDialogFr
|
|||
buttonDescription.setTextColor(getResolvedColor(nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light));
|
||||
|
||||
FrameLayout buttonContainer = buttonView.findViewById(R.id.button_container);
|
||||
AndroidUtils.setBackground(app, buttonContainer, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
AndroidUtils.setBackground(app, buttonContainer, nightMode, R.drawable.btn_border_light, R.drawable.btn_border_dark);
|
||||
AndroidUtils.setBackground(app, buttonDescription, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(app, buttonContainer, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
}
|
||||
|
||||
buttonContainer.setOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
@ -533,7 +533,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
buttons[k++] = toggle;
|
||||
}
|
||||
for (int i = 0; i < buttons.length; i++) {
|
||||
AppModeDialog.updateButtonState2((OsmandApplication) mapActivity.getApplication(), values, selected, listener, buttons, i, true, true, nightMode);
|
||||
AppModeDialog.updateButtonStateForRoute((OsmandApplication) mapActivity.getApplication(), values, selected, listener, buttons, i, true, true, nightMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -671,7 +671,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
updateOptionsButtons();
|
||||
}
|
||||
});
|
||||
AndroidUtils.setBackground(app, container, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
AndroidUtils.setBackground(app, container, nightMode, R.drawable.btn_border_light, R.drawable.btn_border_dark);
|
||||
item.addView(container, newLp);
|
||||
optionsContainer.addView(item, lp);
|
||||
}
|
||||
|
@ -685,7 +685,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
updateOptionsButtons();
|
||||
}
|
||||
});
|
||||
AndroidUtils.setBackground(app, container, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
AndroidUtils.setBackground(app, container, nightMode, R.drawable.btn_border_light, R.drawable.btn_border_dark);
|
||||
item.addView(container, newLp);
|
||||
optionsContainer.addView(item, lp);
|
||||
}
|
||||
|
@ -828,9 +828,11 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
final int colorActive = ContextCompat.getColor(app, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
final int colorDisabled = ContextCompat.getColor(app, R.color.description_font_and_bottom_sheet_icons);
|
||||
|
||||
AndroidUtils.setBackground(app, item, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
AndroidUtils.setBackground(app, item.findViewById(R.id.route_option_container), nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
AndroidUtils.setBackground(app, item, nightMode, R.drawable.btn_border_light, R.drawable.btn_border_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(app, item, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
}
|
||||
|
||||
Drawable itemDrawable = null;
|
||||
|
@ -872,7 +874,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
AndroidUtils.setForeground(app, container, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
} else {
|
||||
AndroidUtils.setForeground(app, container, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
AndroidUtils.setForeground(app, container, nightMode, R.drawable.btn_pressed_trans_light, R.drawable.btn_pressed_trans_dark);
|
||||
}
|
||||
AndroidUtils.setBackground(app, container.findViewById(R.id.options_divider_end), nightMode, R.color.divider_light, R.color.divider_dark);
|
||||
AndroidUtils.setBackground(app, routeOptionImageView, nightMode, R.drawable.route_info_trans_gradient_light, R.drawable.route_info_trans_gradient_dark);
|
||||
|
@ -939,11 +941,11 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
viaIcon.setImageDrawable(getIconOrig(R.drawable.list_intermediate));
|
||||
LinearLayout viaButtonContainer = (LinearLayout) mainView.findViewById(R.id.via_button_container);
|
||||
|
||||
AndroidUtils.setBackground(app, viaButton, nightMode, R.drawable.btn_border_trans_rounded_light, R.drawable.btn_border_trans_rounded_dark);
|
||||
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, viaButtonContainer, nightMode, R.drawable.ripple_rounded_light, R.drawable.ripple_rounded_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(app, viaButtonContainer, nightMode, R.drawable.ripple_rounded_light, R.drawable.ripple_rounded_dark);
|
||||
AndroidUtils.setBackground(app, viaButtonContainer, nightMode, R.drawable.btn_border_trans_rounded_light, R.drawable.btn_border_trans_rounded_dark);
|
||||
}
|
||||
ImageView viaButtonImageView = (ImageView) mainView.findViewById(R.id.via_button_image_view);
|
||||
|
||||
|
@ -969,11 +971,11 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
final FrameLayout toButton = (FrameLayout) mainView.findViewById(R.id.to_button);
|
||||
final LinearLayout toButtonContainer = (LinearLayout) mainView.findViewById(R.id.to_button_container);
|
||||
|
||||
AndroidUtils.setBackground(app, toButton, nightMode, R.drawable.btn_border_trans_rounded_light, R.drawable.btn_border_trans_rounded_dark);
|
||||
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, toButtonContainer, nightMode, R.drawable.ripple_rounded_light, R.drawable.ripple_rounded_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(app, toButtonContainer, nightMode, R.drawable.ripple_rounded_light, R.drawable.ripple_rounded_dark);
|
||||
AndroidUtils.setBackground(app, toButtonContainer, nightMode, R.drawable.btn_border_trans_rounded_light, R.drawable.btn_border_trans_rounded_dark);
|
||||
}
|
||||
ImageView toButtonImageView = (ImageView) mainView.findViewById(R.id.to_button_image_view);
|
||||
|
||||
|
@ -1013,11 +1015,11 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
FrameLayout fromButton = (FrameLayout) mainView.findViewById(R.id.from_button);
|
||||
final LinearLayout fromButtonContainer = (LinearLayout) mainView.findViewById(R.id.from_button_container);
|
||||
|
||||
AndroidUtils.setBackground(app, fromButton, nightMode, R.drawable.btn_border_trans_rounded_light, R.drawable.btn_border_trans_rounded_dark);
|
||||
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, fromButtonContainer, nightMode, R.drawable.ripple_rounded_light, R.drawable.ripple_rounded_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(app, fromButtonContainer, nightMode, R.drawable.ripple_rounded_light, R.drawable.ripple_rounded_dark);
|
||||
AndroidUtils.setBackground(app, fromButtonContainer, nightMode, R.drawable.btn_border_trans_rounded_light, R.drawable.btn_border_trans_rounded_dark);
|
||||
}
|
||||
|
||||
ImageView swapDirectionView = (ImageView) mainView.findViewById(R.id.from_button_image_view);
|
||||
|
@ -1448,7 +1450,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
@Override
|
||||
public long getItemId(int position) {
|
||||
RouteSpinnerRow row = getItem(position);
|
||||
return row.id;
|
||||
return row != null ? row.id : -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1460,7 +1462,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
View getRowItemView(int position, View convertView, ViewGroup parent) {
|
||||
TextView label = (TextView) super.getView(position, convertView, parent);
|
||||
RouteSpinnerRow row = getItem(position);
|
||||
label.setText(row.text);
|
||||
label.setText(row != null ? row.text : "");
|
||||
label.setTextColor(!isLight() ?
|
||||
ContextCompat.getColorStateList(mapActivity, android.R.color.primary_text_dark) : ContextCompat.getColorStateList(mapActivity, android.R.color.primary_text_light));
|
||||
return label;
|
||||
|
@ -1471,8 +1473,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
TextView label = (TextView) super.getDropDownView(position, convertView, parent);
|
||||
|
||||
RouteSpinnerRow row = getItem(position);
|
||||
label.setText(row.text);
|
||||
if (id != SPINNER_HINT_ID) {
|
||||
label.setText(row != null ? row.text : "");
|
||||
if (row != null && id != SPINNER_HINT_ID) {
|
||||
Drawable icon = null;
|
||||
if (row.icon != null) {
|
||||
icon = row.icon;
|
||||
|
|
|
@ -227,7 +227,7 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
@Override
|
||||
public String getTitle() {
|
||||
List<Object> activeObjects;
|
||||
if ((getMyApplication().getRoutingHelper().isRoutePlanningMode() || getMyApplication().getRoutingHelper().isFollowingMode())
|
||||
if ((mapActivity.getRoutingHelper().isRoutePlanningMode() || mapActivity.getRoutingHelper().isFollowingMode())
|
||||
&& item != null
|
||||
&& ((activeObjects = stableAdapter.getActiveObjects()).isEmpty() || isContainsOnlyStart(activeObjects))) {
|
||||
return mapActivity.getResources().getString(R.string.cancel_navigation);
|
||||
|
@ -247,7 +247,7 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
List<Object> activeObjects = stableAdapter.getActiveObjects();
|
||||
if (activeObjects.isEmpty() || isContainsOnlyStart(activeObjects)) {
|
||||
mapActivity.getMapActions().stopNavigationWithoutConfirm();
|
||||
getMyApplication().getTargetPointsHelper().removeAllWayPoints(false, true);
|
||||
mapActivity.getMyApplication().getTargetPointsHelper().removeAllWayPoints(false, true);
|
||||
mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().hide();
|
||||
}
|
||||
}
|
||||
|
@ -410,12 +410,12 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
}
|
||||
|
||||
addButtonDescr.setText(R.string.shared_string_add);
|
||||
addButtonDescr.setCompoundDrawablesWithIntrinsicBounds(getIcon(R.drawable.ic_action_plus, R.color.active_buttons_and_links_light), null, null, null);
|
||||
AndroidUtils.setBackground(app, addButton, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
addButtonDescr.setCompoundDrawablesWithIntrinsicBounds(getIcon(R.drawable.ic_action_plus, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light), null, null, null);
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
AndroidUtils.setBackground(app, addButton, nightMode, R.drawable.btn_border_light, R.drawable.btn_border_dark);
|
||||
AndroidUtils.setBackground(app, addButtonDescr, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(app, addButtonDescr, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
AndroidUtils.setBackground(app, addButton, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
}
|
||||
|
||||
int colorActive = ContextCompat.getColor(mapActivity, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
|
@ -425,13 +425,13 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
FrameLayout clearButton = view.findViewById(R.id.clear_all_button);
|
||||
TextView clearButtonDescr = (TextView) view.findViewById(R.id.clear_all_button_descr);
|
||||
clearButtonDescr.setText(R.string.shared_string_clear_all);
|
||||
clearButtonDescr.setCompoundDrawablesWithIntrinsicBounds(getIcon(R.drawable.ic_action_clear_all, R.color.active_buttons_and_links_light), null, null, null);
|
||||
AndroidUtils.setBackground(app, clearButton, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
clearButtonDescr.setCompoundDrawablesWithIntrinsicBounds(getIcon(R.drawable.ic_action_clear_all, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light), null, null, null);
|
||||
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
AndroidUtils.setBackground(app, clearButton, nightMode, R.drawable.btn_border_light, R.drawable.btn_border_dark);
|
||||
AndroidUtils.setBackground(app, clearButtonDescr, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(app, clearButtonDescr, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
AndroidUtils.setBackground(app, clearButtonDescr, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
}
|
||||
|
||||
AndroidUtils.setBackground(app, view.findViewById(R.id.dividerControlButtons), nightMode,
|
||||
|
@ -468,7 +468,9 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
public void onItemClick(AdapterView<?> adapterView, View view, int item, long l) {
|
||||
if (listAdapter.getItem(item) instanceof WaypointHelper.LocationPointWrapper) {
|
||||
WaypointHelper.LocationPointWrapper ps = (WaypointHelper.LocationPointWrapper) listAdapter.getItem(item);
|
||||
showOnMap(app, ctx, ps.getPoint(), false);
|
||||
if (ps != null) {
|
||||
showOnMap(app, ctx, ps.getPoint(), false);
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
@ -552,7 +554,7 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
|
||||
public void setupRouteCalculationButtonProgressBar(@NonNull ProgressBar pb) {
|
||||
int bgColor = ContextCompat.getColor(app, nightMode ? R.color.route_info_cancel_button_color_dark : R.color.activity_background_light);
|
||||
int progressColor = ContextCompat.getColor(getMyApplication(), nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
int progressColor = ContextCompat.getColor(app, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
|
||||
pb.setProgressDrawable(AndroidUtils.createProgressDrawable(bgColor, progressColor));
|
||||
}
|
||||
|
@ -565,7 +567,7 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
private void updateListAdapter() {
|
||||
List<WaypointHelper.LocationPointWrapper> deletedPoints = new ArrayList<>();
|
||||
listView.setEmptyView(null);
|
||||
StableArrayAdapter listAdapter = getWaypointsDrawerAdapter(true, deletedPoints, mapActivity, running, false, false);
|
||||
StableArrayAdapter listAdapter = getWaypointsDrawerAdapter(true, deletedPoints, mapActivity, running, false, nightMode);
|
||||
AdapterView.OnItemClickListener listener = getDrawerItemClickListener(mapActivity, running, listAdapter);
|
||||
setDynamicListItems(listView, listAdapter);
|
||||
updateListAdapter(listAdapter, listener);
|
||||
|
|
|
@ -27,6 +27,7 @@ public abstract class BaseRouteCard {
|
|||
public BaseRouteCard(MapActivity mapActivity) {
|
||||
this.mapActivity = mapActivity;
|
||||
this.app = mapActivity.getMyApplication();
|
||||
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
}
|
||||
|
||||
public abstract int getCardLayoutId();
|
||||
|
|
|
@ -96,11 +96,11 @@ public class PublicTransportCard extends BaseRouteCard {
|
|||
FrameLayout detailsButton = (FrameLayout) view.findViewById(R.id.details_button);
|
||||
TextView detailsButtonDescr = (TextView) view.findViewById(R.id.details_button_descr);
|
||||
|
||||
AndroidUtils.setBackground(app, detailsButton, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
AndroidUtils.setBackground(app, detailsButton, nightMode, R.drawable.btn_border_light, R.drawable.btn_border_dark);
|
||||
AndroidUtils.setBackground(app, detailsButtonDescr, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(app, detailsButtonDescr, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
AndroidUtils.setBackground(app, detailsButton, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
}
|
||||
int color = ContextCompat.getColor(app, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
detailsButtonDescr.setTextColor(color);
|
||||
|
@ -108,11 +108,11 @@ public class PublicTransportCard extends BaseRouteCard {
|
|||
FrameLayout showButton = (FrameLayout) view.findViewById(R.id.show_button);
|
||||
if (secondButtonVisible) {
|
||||
TextView showButtonDescr = (TextView) view.findViewById(R.id.show_button_descr);
|
||||
AndroidUtils.setBackground(app, showButton, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
AndroidUtils.setBackground(app, showButton, nightMode, R.drawable.btn_border_light, R.drawable.btn_border_dark);
|
||||
AndroidUtils.setBackground(app, showButtonDescr, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(app, showButtonDescr, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
AndroidUtils.setBackground(app, showButton, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
}
|
||||
showButtonDescr.setTextColor(color);
|
||||
showButton.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -110,11 +110,11 @@ public class SimpleRouteCard extends BaseRouteCard {
|
|||
|
||||
protected void applyDayNightMode() {
|
||||
FrameLayout detailsButton = view.findViewById(R.id.details_button);
|
||||
AndroidUtils.setBackground(app, detailsButton, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
AndroidUtils.setBackground(app, detailsButton, nightMode, R.drawable.btn_border_light, R.drawable.btn_border_dark);
|
||||
AndroidUtils.setBackground(app, view.findViewById(R.id.details_button_descr), nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(app, view.findViewById(R.id.details_button_descr), nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||
AndroidUtils.setBackground(app, view.findViewById(R.id.details_button_descr), nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
}
|
||||
int color = ContextCompat.getColor(mapActivity, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
AndroidUtils.setBackground(app, view.findViewById(R.id.dividerToDropDown), nightMode, R.color.divider_light, R.color.divider_dark);
|
||||
|
|
Loading…
Reference in a new issue