diff --git a/OsmAnd/res/layout/plan_route_info.xml b/OsmAnd/res/layout/plan_route_info.xml index c2b927037e..9757e28b1a 100644 --- a/OsmAnd/res/layout/plan_route_info.xml +++ b/OsmAnd/res/layout/plan_route_info.xml @@ -587,7 +587,7 @@ diff --git a/OsmAnd/res/layout/route_info_menu_control_buttons.xml b/OsmAnd/res/layout/route_info_menu_control_buttons.xml index 3261c200a6..fbdce267b2 100644 --- a/OsmAnd/res/layout/route_info_menu_control_buttons.xml +++ b/OsmAnd/res/layout/route_info_menu_control_buttons.xml @@ -30,6 +30,11 @@ + + - - diff --git a/OsmAnd/src/net/osmand/plus/activities/ShowRouteInfoDialogFragment.java b/OsmAnd/src/net/osmand/plus/activities/ShowRouteInfoDialogFragment.java index 9b3e26351f..fe9e6efee8 100644 --- a/OsmAnd/src/net/osmand/plus/activities/ShowRouteInfoDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/ShowRouteInfoDialogFragment.java @@ -664,7 +664,8 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment { spannable.append(OsmAndFormatter.getFormattedDistance((float) segment.getTravelDist(), app)); spannable.setSpan(new CustomTypefaceSpan(typeface), startIndex, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - SpannableString textType = new SpannableString(getString(R.string.by_transport_type, transportStopRoute.type.name().toLowerCase())); + String type = getString(transportStopRoute.getTypeStrRes()).toLowerCase(); + SpannableString textType = new SpannableString(getString(R.string.by_transport_type, type)); buildCollapsableRow(stopsContainer, spannable, textType, true, collapsableView, null); final TransportStop endStop = stops.get(stops.size() - 1); diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java index dc90ca9256..03f009c3c3 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java @@ -777,18 +777,24 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener View startButton = mainView.findViewById(R.id.start_button); TextView startButtonText = (TextView) mainView.findViewById(R.id.start_button_descr); + boolean publicTransportMode = routingHelper.getAppMode() == ApplicationMode.PUBLIC_TRANSPORT; + int iconId = publicTransportMode ? R.drawable.ic_map : R.drawable.ic_action_start_navigation; if (isRouteCalculated()) { AndroidUtils.setBackground(app, startButton, nightMode, R.color.active_buttons_and_links_light, R.color.active_buttons_and_links_dark); int color = nightMode ? R.color.main_font_dark : R.color.card_and_list_background_light; startButtonText.setTextColor(ContextCompat.getColor(app, color)); - ((ImageView) mainView.findViewById(R.id.start_icon)).setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_start_navigation, color)); + Drawable icon = app.getUIUtilities().getIcon(iconId, color); + startButtonText.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); } else { AndroidUtils.setBackground(app, startButton, nightMode, R.color.activity_background_light, R.color.route_info_cancel_button_color_dark); int color = R.color.description_font_and_bottom_sheet_icons; startButtonText.setTextColor(ContextCompat.getColor(app, color)); - ((ImageView) mainView.findViewById(R.id.start_icon)).setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_start_navigation, color)); + Drawable icon = app.getUIUtilities().getIcon(iconId, color); + startButtonText.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); } - if (routingHelper.isFollowingMode() || routingHelper.isPauseNavigation()) { + if (publicTransportMode) { + startButtonText.setText(R.string.shared_string_show_on_map); + } else if (routingHelper.isFollowingMode() || routingHelper.isPauseNavigation()) { startButtonText.setText(R.string.shared_string_continue); } else { startButtonText.setText(R.string.shared_string_control_start); diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java index c1a8383666..366d3613b5 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenuFragment.java @@ -23,7 +23,6 @@ import android.view.ViewParent; import android.view.ViewTreeObserver; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; -import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.OverScroller; import android.widget.ProgressBar; @@ -33,6 +32,7 @@ import net.osmand.AndroidUtils; import net.osmand.Location; import net.osmand.data.RotatedTileBox; import net.osmand.osm.edit.Node; +import net.osmand.plus.ApplicationMode; import net.osmand.plus.LockableScrollView; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; @@ -335,6 +335,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment { } MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { + updateInfo(); mapActivity.getMapLayers().getMapControlsLayer().showMapControlsIfHidden(); wasDrawerDisabled = mapActivity.isDrawerDisabled(); if (!wasDrawerDisabled) { @@ -841,11 +842,6 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment { textViewExProgress.color1 = ContextCompat.getColor(mapActivity, color); textViewExProgress.color2 = ContextCompat.getColor(mapActivity, R.color.description_font_and_bottom_sheet_icons); textViewExProgress.invalidate(); - ImageViewExProgress imageViewExProgress = (ImageViewExProgress) view.findViewById(R.id.start_icon); - imageViewExProgress.percent = progress / 100f; - imageViewExProgress.color1 = ContextCompat.getColor(mapActivity, color); - imageViewExProgress.color2 = ContextCompat.getColor(mapActivity, R.color.description_font_and_bottom_sheet_icons); - imageViewExProgress.invalidate(); } public void hideRouteCalculationProgressBar() { @@ -874,14 +870,16 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment { textViewExProgress.color1 = ContextCompat.getColor(mapActivity, nightMode ? R.color.main_font_dark : R.color.card_and_list_background_light); textViewExProgress.color2 = ContextCompat.getColor(mapActivity, R.color.description_font_and_bottom_sheet_icons); - ImageViewExProgress imageViewExProgress = (ImageViewExProgress) view.findViewById(R.id.start_icon); - imageViewExProgress.color1 = ContextCompat.getColor(mapActivity, nightMode ? R.color.main_font_dark : R.color.card_and_list_background_light); - imageViewExProgress.color2 = ContextCompat.getColor(mapActivity, R.color.description_font_and_bottom_sheet_icons); - ((ImageView) view.findViewById(R.id.start_icon)).setImageResource(R.drawable.ic_action_start_navigation); + boolean publicTransportMode = app.getRoutingHelper().getAppMode() == ApplicationMode.PUBLIC_TRANSPORT; if (menu.isRouteCalculated()) { - AndroidUtils.setBackground(app, view.findViewById(R.id.start_button), nightMode, R.color.active_buttons_and_links_light, R.color.active_buttons_and_links_dark); + if (publicTransportMode) { + AndroidUtils.setBackground(app, view.findViewById(R.id.start_button), nightMode, R.color.card_and_list_background_light, R.color.card_and_list_background_dark); + textViewExProgress.color1 = ContextCompat.getColor(mapActivity, nightMode ? R.color.active_buttons_and_links_dark : R.color.route_info_cancel_button_color_light); + } else { + AndroidUtils.setBackground(app, view.findViewById(R.id.start_button), nightMode, R.color.active_buttons_and_links_light, R.color.active_buttons_and_links_dark); + textViewExProgress.color1 = ContextCompat.getColor(mapActivity, nightMode ? R.color.main_font_dark : R.color.card_and_list_background_light); + } textViewExProgress.percent = 1; - imageViewExProgress.percent = 1; } } } @@ -936,6 +934,8 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment { R.color.divider_light, R.color.divider_dark); AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerButtons), nightMode, R.color.divider_light, R.color.divider_dark); + AndroidUtils.setBackground(ctx, view.findViewById(R.id.controls_divider), nightMode, + R.color.divider_light, R.color.divider_dark); AndroidUtils.setBackground(ctx, view.findViewById(R.id.app_modes_options_container), nightMode, R.drawable.route_info_trans_gradient_light, R.drawable.route_info_trans_gradient_dark); AndroidUtils.setBackground(ctx, view.findViewById(R.id.app_modes_fold_container), nightMode, diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/WaypointsFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/WaypointsFragment.java index 75aafea57c..bd15106e18 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/WaypointsFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/WaypointsFragment.java @@ -543,11 +543,6 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS textViewExProgress.color1 = ContextCompat.getColor(mapActivity, color); textViewExProgress.color2 = ContextCompat.getColor(mapActivity, R.color.description_font_and_bottom_sheet_icons); textViewExProgress.invalidate(); - ImageViewExProgress imageViewExProgress = (ImageViewExProgress) view.findViewById(R.id.start_icon); - imageViewExProgress.percent = progress / 100f; - imageViewExProgress.color1 = ContextCompat.getColor(mapActivity, color); - imageViewExProgress.color2 = ContextCompat.getColor(mapActivity, R.color.description_font_and_bottom_sheet_icons); - imageViewExProgress.invalidate(); } public void setupRouteCalculationButtonProgressBar(@NonNull ProgressBar pb) { diff --git a/OsmAnd/src/net/osmand/plus/widgets/TextViewExProgress.java b/OsmAnd/src/net/osmand/plus/widgets/TextViewExProgress.java index 46ea3511fe..d3dcd1089e 100644 --- a/OsmAnd/src/net/osmand/plus/widgets/TextViewExProgress.java +++ b/OsmAnd/src/net/osmand/plus/widgets/TextViewExProgress.java @@ -2,7 +2,9 @@ package net.osmand.plus.widgets; import android.content.Context; import android.graphics.Canvas; +import android.graphics.PorterDuff; import android.graphics.Rect; +import android.graphics.drawable.Drawable; import android.util.AttributeSet; public class TextViewExProgress extends TextViewEx { @@ -30,6 +32,15 @@ public class TextViewExProgress extends TextViewEx { public void draw(Canvas canvas) { canvas.save(); setTextColor(color1); + Drawable[] icons = getCompoundDrawables(); + for (int i = 0; i < icons.length; i++) { + Drawable drawable = icons[i]; + if (drawable != null) { + drawable.setColorFilter(color1, PorterDuff.Mode.SRC_ATOP); + icons[i] = drawable; + } + } + setCompoundDrawables(icons[0], icons[1], icons[2], icons[3]); int width = getWidth(); int widthP = (int) (width * percent); int height = getHeight(); @@ -39,6 +50,14 @@ public class TextViewExProgress extends TextViewEx { canvas.save(); setTextColor(color2); + for (int i = 0; i < icons.length; i++) { + Drawable drawable = icons[i]; + if (drawable != null) { + drawable.setColorFilter(color2, PorterDuff.Mode.SRC_ATOP); + icons[i] = drawable; + } + } + setCompoundDrawables(icons[0], icons[1], icons[2], icons[3]); int width2 = getWidth(); int widthP2 = (int) (width2 * percent); int height2 = getHeight();