Move route name to shield

This commit is contained in:
crimean 2019-07-09 20:41:56 +03:00
parent 8d4a8c4f84
commit 3067c7b038
2 changed files with 9 additions and 17 deletions

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="wrap_content"
android:layout_height="28dp"
android:layout_height="wrap_content"
android:background="@drawable/transport_stop_route_bg"
android:orientation="horizontal">
@ -11,6 +11,7 @@
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:background="?attr/selectableItemBackgroundBorderless">
<ImageView
@ -24,14 +25,15 @@
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/transport_stop_route_text"
android:layout_width="wrap_content"
android:layout_height="28dp"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:gravity="center"
android:textColor="@color/color_white"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium"
tools:text="3" />
tools:text="MT231: Start - Stop" />
</LinearLayout>

View file

@ -928,7 +928,6 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT
if (mapActivity == null) {
return;
}
OsmandApplication app = mapActivity.getMyApplication();
FrameLayout baseItemView = new FrameLayout(view.getContext());
FrameLayout.LayoutParams baseViewLayoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
@ -1026,16 +1025,7 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT
LinearLayout llText = buildTextContainerView(view.getContext());
ll.addView(llText);
TextView routeTypeView = new TextView(view.getContext());
LinearLayout.LayoutParams routeTypeParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
routeTypeParams.setMargins(0, dpToPx(4), 0, 0);
routeTypeView.setLayoutParams(routeTypeParams);
routeTypeView.setTextSize(16);
routeTypeView.setTextColor(getSecondaryColor());
routeTypeView.setText(routeDescription);
llText.addView(routeTypeView);
View routeBadge = createRouteBadge(mapActivity, transportStopRoute, isNightMode());
View routeBadge = createRouteBadge(mapActivity, transportStopRoute, routeDescription);
LinearLayout.LayoutParams routeBadgeParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
routeBadgeParams.setMargins(0, dpToPx(6), 0, dpToPx(8));
routeBadge.setLayoutParams(routeBadgeParams);
@ -1440,7 +1430,7 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT
return ll;
}
public View createRouteBadge(@NonNull MapActivity mapActivity, TransportStopRoute transportStopRoute, boolean isNightMode) {
public View createRouteBadge(@NonNull MapActivity mapActivity, TransportStopRoute transportStopRoute, String routeDescription) {
OsmandApplication app = mapActivity.getMyApplication();
LinearLayout convertView = (LinearLayout) mapActivity.getLayoutInflater().inflate(R.layout.transport_stop_route_item_with_icon, null, false);
if (transportStopRoute != null) {
@ -1452,7 +1442,7 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT
int drawableResId = transportStopRoute.type == null ? R.drawable.ic_action_bus_dark : transportStopRoute.type.getResourceId();
transportStopRouteImageView.setImageDrawable(app.getUIUtilities().getPaintedIcon(drawableResId, UiUtilities.getContrastColor(mapActivity, bgColor, true)));
transportStopRouteTextView.setText(routeRef);
transportStopRouteTextView.setText(routeRef + ": " + routeDescription);
GradientDrawable gradientDrawableBg = (GradientDrawable) convertView.getBackground();
gradientDrawableBg.setColor(bgColor);
transportStopRouteTextView.setTextColor(UiUtilities.getContrastColor(mapActivity, bgColor, true));