diff --git a/OsmAnd/res/layout/bottom_sheet_item_with_two_text.xml b/OsmAnd/res/layout/bottom_sheet_item_with_two_text.xml new file mode 100644 index 0000000000..eb2efab2ef --- /dev/null +++ b/OsmAnd/res/layout/bottom_sheet_item_with_two_text.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/route_line_appearance.xml b/OsmAnd/res/layout/route_line_appearance.xml index e5410cdd2f..5564b3b867 100644 --- a/OsmAnd/res/layout/route_line_appearance.xml +++ b/OsmAnd/res/layout/route_line_appearance.xml @@ -19,9 +19,7 @@ android:layout_height="wrap_content" android:background="?attr/bg_color" android:minHeight="@dimen/bottom_sheet_title_height" - android:orientation="vertical" - android:paddingLeft="@dimen/content_padding" - android:paddingRight="@dimen/content_padding"> + android:orientation="vertical"> - - - - - + diff --git a/OsmAnd/res/layout/route_line_color_card.xml b/OsmAnd/res/layout/route_line_color_card.xml index c25332de88..f8db414f16 100644 --- a/OsmAnd/res/layout/route_line_color_card.xml +++ b/OsmAnd/res/layout/route_line_color_card.xml @@ -9,43 +9,8 @@ - - - - - - - - + android:orientation="horizontal" + android:paddingTop="@dimen/content_padding_small"> + + - - - - - - - - colorCard.getViewHeight() + headerTitle.getBottom()) { + header = widthCard; + } else { + header = colorCard; + } + if (header != selectedHeader) { + selectedHeader = header; + selectedHeader.onNeedUpdateHeader(); + } + } + private void initVisibleRect() { MapActivity ctx = getMapActivity(); int screenHeight = AndroidUtils.getScreenHeight(ctx); @@ -385,7 +424,6 @@ public class RouteLineAppearanceFragment extends ContextMenuScrollFragment imple colorCard.onColorSelected(prevColor, newColor); } - @Override public void onSelectedColorChanged() { updateColorItems(); } @@ -418,7 +456,6 @@ public class RouteLineAppearanceFragment extends ContextMenuScrollFragment imple } } - @Override public void onMapThemeUpdated(@NonNull DayNightMode mapTheme) { changeMapTheme(mapTheme); updateColorItems(); @@ -435,4 +472,5 @@ public class RouteLineAppearanceFragment extends ContextMenuScrollFragment imple public interface OnApplyRouteLineListener { void applyRouteLineAppearance(@NonNull RouteLineDrawInfo routeLineDrawInfo); } + } diff --git a/OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java index d7393b2cc9..71c74579a3 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/RouteLayer.java @@ -30,6 +30,7 @@ import net.osmand.data.QuadRect; import net.osmand.data.RotatedTileBox; import net.osmand.data.TransportStop; import net.osmand.plus.R; +import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.mapcontextmenu.other.TrackChartPoints; import net.osmand.plus.measurementtool.MeasurementToolFragment; @@ -105,6 +106,9 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont private LayerDrawable projectionIcon; private LayerDrawable previewIcon; + private int routeLineColor; + private Integer directionArrowsColor; + public RouteLayer(RoutingHelper helper) { this.helper = helper; this.transportHelper = helper.getTransportRoutingHelper(); @@ -326,7 +330,8 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont DrawSettings settings, RouteLineDrawInfo drawInfo) { updateAttrs(settings, tileBox); - paintRouteLinePreview.setColor(getRouteLineColor(nightMode)); + updateRouteColors(nightMode); + paintRouteLinePreview.setColor(getRouteLineColor()); paintRouteLinePreview.setStrokeWidth(getRouteLineWidth(tileBox)); int centerX = drawInfo.getCenterX(); @@ -418,6 +423,22 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont @ColorInt public int getRouteLineColor(boolean night) { + updateRouteColors(night); + return routeLineColor; + } + + @ColorInt + public int getRouteLineColor() { + return routeLineColor; + } + + @Nullable + @ColorInt + public Integer getDirectionArrowsColor() { + return directionArrowsColor; + } + + public void updateRouteColors(boolean night) { Integer color; if (routeLineDrawInfo != null) { color = routeLineDrawInfo.getColor(night); @@ -429,10 +450,13 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont color = storedValue != 0 ? storedValue : null; } if (color == null) { + directionArrowsColor = null; updateAttrs(new DrawSettings(night), view.getCurrentRotatedTileBox()); color = attrs.paint.getColor(); + } else if (routeLineColor != color) { + directionArrowsColor = UiUtilities.getContrastColor(view.getContext(), color, false); } - return color; + routeLineColor = color; } private float getRouteLineWidth(@NonNull RotatedTileBox tileBox) { @@ -500,7 +524,8 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont boolean straight = route.getRouteService() == RouteService.STRAIGHT; publicTransportRouteGeometry.clearRoute(); routeGeometry.updateRoute(tb, route); - routeGeometry.setRouteStyleParams(getRouteLineColor(nightMode), getRouteLineWidth(tb)); + updateRouteColors(nightMode); + routeGeometry.setRouteStyleParams(getRouteLineColor(), getRouteLineWidth(tb), getDirectionArrowsColor()); if (directTo) { routeGeometry.drawSegments(tb, canvas, topLatitude, leftLongitude, bottomLatitude, rightLongitude, null, 0); diff --git a/OsmAnd/src/net/osmand/plus/views/layers/geometry/RouteGeometryWay.java b/OsmAnd/src/net/osmand/plus/views/layers/geometry/RouteGeometryWay.java index f6e26b039f..d46ca8cd68 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/geometry/RouteGeometryWay.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/geometry/RouteGeometryWay.java @@ -22,15 +22,19 @@ public class RouteGeometryWay extends GeometryWay(context)); this.helper = context.getApp().getRoutingHelper(); } - public void setRouteStyleParams(@Nullable @ColorInt Integer color, @Nullable Float width) { + public void setRouteStyleParams(@Nullable @ColorInt Integer color, + @Nullable Float width, + @Nullable @ColorInt Integer pointColor) { this.customColor = color; this.customWidth = width; + this.customPointColor = pointColor; } @NonNull @@ -39,7 +43,7 @@ public class RouteGeometryWay extends GeometryWay { - GeometrySolidWayStyle(RouteGeometryWayContext context, Integer color, Float width) { + private Integer pointColor; + + GeometrySolidWayStyle(RouteGeometryWayContext context, Integer color, Float width, + Integer pointColor) { super(context, color, width); + this.pointColor = pointColor; } @Override @@ -73,6 +81,11 @@ public class RouteGeometryWay extends GeometryWay