From 3bded67e1e76fcfdf71cfaed42eac47033c0d2d3 Mon Sep 17 00:00:00 2001 From: Roman Inflianskas Date: Tue, 5 Apr 2016 12:58:05 +0300 Subject: [PATCH 1/2] Support three turn options for one segment in the result route description --- .../net/osmand/router/RouteResultPreparation.java | 8 ++++++-- OsmAnd-java/src/net/osmand/router/TurnType.java | 4 ++-- OsmAnd-java/test/resources/test_turn_lanes.json | 15 +++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java b/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java index ef5331547b..64e094645a 100644 --- a/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java +++ b/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java @@ -1006,6 +1006,7 @@ public class RouteResultPreparation { int[] lanes = new int[splitLaneOptions.length]; for (int i = 0; i < splitLaneOptions.length; i++) { String[] laneOptions = splitLaneOptions[i].split(";"); + boolean isTertiaryTurn = false; for (int j = 0; j < laneOptions.length; j++) { int turn; @@ -1039,10 +1040,13 @@ public class RouteResultPreparation { (TurnType.isLeftTurn(calcTurnType) && TurnType.isLeftTurn(turn)) ) { TurnType.setPrimaryTurnShiftOthers(lanes, i, turn); - } else { + } else if (!isTertiaryTurn) { TurnType.setSecondaryTurnShiftOthers(lanes, i, turn); + isTertiaryTurn = true; + } else { + TurnType.setTertiaryTurn(lanes, i, turn); + break; } - break; // Move on to the next lane } } } diff --git a/OsmAnd-java/src/net/osmand/router/TurnType.java b/OsmAnd-java/src/net/osmand/router/TurnType.java index 8fea638dd7..e7928a6b19 100644 --- a/OsmAnd-java/src/net/osmand/router/TurnType.java +++ b/OsmAnd-java/src/net/osmand/router/TurnType.java @@ -180,7 +180,7 @@ public class TurnType { } public static int getSecondaryTurn(int laneValue) { - // Get the primary turn modifier for the lane + // Get the secondary turn modifier for the lane return (laneValue >> 5); } @@ -206,7 +206,7 @@ public class TurnType { } public static int getTertiaryTurn(int laneValue) { - // Get the primary turn modifier for the lane + // Get the tertiary turn modifier for the lane return (laneValue >> 10); } diff --git a/OsmAnd-java/test/resources/test_turn_lanes.json b/OsmAnd-java/test/resources/test_turn_lanes.json index 65908a4011..67ea477150 100644 --- a/OsmAnd-java/test/resources/test_turn_lanes.json +++ b/OsmAnd-java/test/resources/test_turn_lanes.json @@ -216,6 +216,21 @@ "expectedResults": { "14418": "TL, +TL, C, C, TR" } + }, + { + "testName": "11.Figure 8 TL", + "startPoint": { + "latitude": 45.69816447596442, + "longitude": 35.74885922431952 + }, + "endPoint": { + "latitude": 45.700075267731705, + "longitude": 35.7467134571076 + }, + "expectedResults": { + "43906": null, + "43905": "+TL;C;TR" + } } ] \ No newline at end of file From 599294f948d7dab23fd654baa3f3adfec5a10dda Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Tue, 5 Apr 2016 13:57:27 +0300 Subject: [PATCH 2/2] Removed bold for categories and added light sensor icon. --- .../net/osmand/plus/ContextMenuAdapter.java | 10 +--------- .../src/net/osmand/plus/OsmandSettings.java | 20 ++++++++++++++----- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java index 0bb0029d3e..7338010a41 100644 --- a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java +++ b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java @@ -1,7 +1,6 @@ package net.osmand.plus; import android.app.Activity; -import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.support.annotation.DrawableRes; import android.support.annotation.IdRes; @@ -133,14 +132,7 @@ public class ContextMenuAdapter { convertView.setTag(layoutId); } TextView tv = (TextView) convertView.findViewById(R.id.title); - - if (item.isCategory()) { - tv.setTypeface(Typeface.DEFAULT_BOLD); - } else { - AndroidUtils.setTextPrimaryColor(getContext(), tv, !holoLight); - tv.setTypeface(null); - } - tv.setText(item.isCategory() ? item.getTitle().toUpperCase() : item.getTitle()); + tv.setText(item.getTitle()); if (this.layoutId == R.layout.simple_list_menu_item) { int color = ContextCompat.getColor(getContext(), diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 5a70a0ff31..86e4bd2287 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -11,7 +11,9 @@ import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Build; import android.os.Environment; +import android.support.annotation.DrawableRes; import android.support.annotation.Nullable; +import android.support.annotation.StringRes; import net.osmand.IndexConstants; import net.osmand.StateChangedListener; @@ -2526,21 +2528,29 @@ public class OsmandSettings { public enum DayNightMode { - AUTO(R.string.daynight_mode_auto), - DAY(R.string.daynight_mode_day), - NIGHT(R.string.daynight_mode_night), - SENSOR(R.string.daynight_mode_sensor); + AUTO(R.string.daynight_mode_auto, R.drawable.ic_action_map_sunst), + DAY(R.string.daynight_mode_day, R.drawable.ic_action_map_day), + NIGHT(R.string.daynight_mode_night, R.drawable.ic_action_map_night), + SENSOR(R.string.daynight_mode_sensor, R.drawable.ic_action_map_light_sensor); private final int key; + @DrawableRes + private final int drawableRes; - DayNightMode(int key) { + DayNightMode(@StringRes int key, @DrawableRes int drawableRes) { this.key = key; + this.drawableRes = drawableRes; } public String toHumanString(Context ctx) { return ctx.getString(key); } + @DrawableRes + public int getIconRes() { + return drawableRes; + } + public boolean isSensor() { return this == SENSOR; }