diff --git a/OsmAnd/res/drawable-large-hdpi/map_pin_destination.png b/OsmAnd/res/drawable-large-hdpi/map_pin_destination.png new file mode 100644 index 0000000000..abb6ac89f8 Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/map_pin_destination.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/map_pin_origin.png b/OsmAnd/res/drawable-large-hdpi/map_pin_origin.png new file mode 100644 index 0000000000..d3e53732ff Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/map_pin_origin.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/widget_osmo_connected_day.png b/OsmAnd/res/drawable-large-hdpi/widget_osmo_connected_day.png new file mode 100644 index 0000000000..60881fd2a7 Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/widget_osmo_connected_day.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/widget_osmo_connected_location_day.png b/OsmAnd/res/drawable-large-hdpi/widget_osmo_connected_location_day.png new file mode 100644 index 0000000000..af614f1450 Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/widget_osmo_connected_location_day.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/widget_osmo_connected_location_night.png b/OsmAnd/res/drawable-large-hdpi/widget_osmo_connected_location_night.png new file mode 100644 index 0000000000..5b357ec345 Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/widget_osmo_connected_location_night.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/widget_osmo_connected_night.png b/OsmAnd/res/drawable-large-hdpi/widget_osmo_connected_night.png new file mode 100644 index 0000000000..3c93330d54 Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/widget_osmo_connected_night.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/widget_osmo_inactive_day.png b/OsmAnd/res/drawable-large-hdpi/widget_osmo_inactive_day.png new file mode 100644 index 0000000000..75214f5687 Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/widget_osmo_inactive_day.png differ diff --git a/OsmAnd/res/drawable-large-hdpi/widget_osmo_inactive_night.png b/OsmAnd/res/drawable-large-hdpi/widget_osmo_inactive_night.png new file mode 100644 index 0000000000..8535bf2b73 Binary files /dev/null and b/OsmAnd/res/drawable-large-hdpi/widget_osmo_inactive_night.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_pin_destination.png b/OsmAnd/res/drawable-large-xhdpi/map_pin_destination.png new file mode 100644 index 0000000000..10adc01c2f Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/map_pin_destination.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/map_pin_origin.png b/OsmAnd/res/drawable-large-xhdpi/map_pin_origin.png new file mode 100644 index 0000000000..a234377be6 Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/map_pin_origin.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/widget_osmo_connected_day.png b/OsmAnd/res/drawable-large-xhdpi/widget_osmo_connected_day.png new file mode 100644 index 0000000000..3cf9633170 Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/widget_osmo_connected_day.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/widget_osmo_connected_location_day.png b/OsmAnd/res/drawable-large-xhdpi/widget_osmo_connected_location_day.png new file mode 100644 index 0000000000..055f98e3e3 Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/widget_osmo_connected_location_day.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/widget_osmo_connected_location_night.png b/OsmAnd/res/drawable-large-xhdpi/widget_osmo_connected_location_night.png new file mode 100644 index 0000000000..bd34d8eb74 Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/widget_osmo_connected_location_night.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/widget_osmo_connected_night.png b/OsmAnd/res/drawable-large-xhdpi/widget_osmo_connected_night.png new file mode 100644 index 0000000000..004ffc9ebe Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/widget_osmo_connected_night.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/widget_osmo_inactive_day.png b/OsmAnd/res/drawable-large-xhdpi/widget_osmo_inactive_day.png new file mode 100644 index 0000000000..af474f2501 Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/widget_osmo_inactive_day.png differ diff --git a/OsmAnd/res/drawable-large-xhdpi/widget_osmo_inactive_night.png b/OsmAnd/res/drawable-large-xhdpi/widget_osmo_inactive_night.png new file mode 100644 index 0000000000..d08d62e650 Binary files /dev/null and b/OsmAnd/res/drawable-large-xhdpi/widget_osmo_inactive_night.png differ diff --git a/OsmAnd/res/drawable-large/map_pin_destination.png b/OsmAnd/res/drawable-large/map_pin_destination.png index 0a3f498ed4..56ef29b090 100644 Binary files a/OsmAnd/res/drawable-large/map_pin_destination.png and b/OsmAnd/res/drawable-large/map_pin_destination.png differ diff --git a/OsmAnd/res/drawable-large/map_pin_origin.png b/OsmAnd/res/drawable-large/map_pin_origin.png index 5d6dce52eb..fe5a345d51 100644 Binary files a/OsmAnd/res/drawable-large/map_pin_origin.png and b/OsmAnd/res/drawable-large/map_pin_origin.png differ diff --git a/OsmAnd/res/drawable-large/widget_osmo_connected_day.png b/OsmAnd/res/drawable-large/widget_osmo_connected_day.png new file mode 100644 index 0000000000..ffa765c491 Binary files /dev/null and b/OsmAnd/res/drawable-large/widget_osmo_connected_day.png differ diff --git a/OsmAnd/res/drawable-large/widget_osmo_connected_location_day.png b/OsmAnd/res/drawable-large/widget_osmo_connected_location_day.png new file mode 100644 index 0000000000..e9cd647697 Binary files /dev/null and b/OsmAnd/res/drawable-large/widget_osmo_connected_location_day.png differ diff --git a/OsmAnd/res/drawable-large/widget_osmo_connected_location_night.png b/OsmAnd/res/drawable-large/widget_osmo_connected_location_night.png new file mode 100644 index 0000000000..a30902b069 Binary files /dev/null and b/OsmAnd/res/drawable-large/widget_osmo_connected_location_night.png differ diff --git a/OsmAnd/res/drawable-large/widget_osmo_connected_night.png b/OsmAnd/res/drawable-large/widget_osmo_connected_night.png new file mode 100644 index 0000000000..6b7f7568e1 Binary files /dev/null and b/OsmAnd/res/drawable-large/widget_osmo_connected_night.png differ diff --git a/OsmAnd/res/drawable-large/widget_osmo_inactive_day.png b/OsmAnd/res/drawable-large/widget_osmo_inactive_day.png new file mode 100644 index 0000000000..8432e8bcf1 Binary files /dev/null and b/OsmAnd/res/drawable-large/widget_osmo_inactive_day.png differ diff --git a/OsmAnd/res/drawable-large/widget_osmo_inactive_night.png b/OsmAnd/res/drawable-large/widget_osmo_inactive_night.png new file mode 100644 index 0000000000..c5e27b6d62 Binary files /dev/null and b/OsmAnd/res/drawable-large/widget_osmo_inactive_night.png differ diff --git a/OsmAnd/res/values/styles.xml b/OsmAnd/res/values/styles.xml index e7bf063e21..fff9262283 100644 --- a/OsmAnd/res/values/styles.xml +++ b/OsmAnd/res/values/styles.xml @@ -8,22 +8,7 @@ false - - - diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java index cb1c135931..dcc22819ce 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java @@ -388,16 +388,31 @@ public class MapControlsLayer extends OsmandMapLayer { if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) { mapActivity.getMapActions().enterRoutePlanningMode(null, null, false); } else { - mapActivity.getRoutingHelper().setRoutePlanningMode(true); - mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode(); - mapActivity.refreshMap(); + switchToRoutePlanningLayout(); } } + + }); } + public void switchToRouteFollowingLayout() { + touchEvent = 0; + mapActivity.getMyApplication().getRoutingHelper().setRoutePlanningMode(false); + mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode(); + mapActivity.refreshMap(); + } + public boolean switchToRoutePlanningLayout() { + if (!mapActivity.getRoutingHelper().isRoutePlanningMode() && mapActivity.getRoutingHelper().isFollowingMode()) { + mapActivity.getRoutingHelper().setRoutePlanningMode(true); + mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode(); + mapActivity.refreshMap(); + return true; + } + return false; + } private void initZooms() { final OsmandMapTileView view = mapActivity.getMapView(); @@ -436,12 +451,12 @@ public class MapControlsLayer extends OsmandMapLayer { OsmandApplication app = mapActivity.getMyApplication(); RoutingHelper routingHelper = app.getRoutingHelper(); if (routingHelper.isFollowingMode()) { - routingHelper.setRoutePlanningMode(false); - mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode(); + switchToRouteFollowingLayout(); } else { if (!app.getTargetPointsHelper().checkPointToNavigateShort()) { mapRouteInfoControlDialog.showDialog(); } else { + touchEvent = 0; mapActivity.getMapViewTrackingUtilities().backToLocationImpl(); app.getSettings().FOLLOW_THE_ROUTE.set(true); routingHelper.setFollowingMode(true); @@ -453,6 +468,8 @@ public class MapControlsLayer extends OsmandMapLayer { } } + + private void stopCounter() { startCounter = 0; @@ -534,14 +551,14 @@ public class MapControlsLayer extends OsmandMapLayer { boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode(); boolean showRouteCalculationControls = routePlanningMode || ((System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS) && routeFollowingMode); - boolean showButtons = routePlanningMode || !routeFollowingMode; + boolean showMenuButton = showRouteCalculationControls || !routeFollowingMode; updateMyLocation(rh); // routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions ); // routePlanningBtn.updateVisibility(showButtons && !routePlanningMode); routePlanningBtn.setIconResId(R.drawable.map_directions ); routePlanningBtn.updateVisibility(!routeFollowingMode && !routePlanningMode); - menuControl.updateVisibility(showButtons); + menuControl.updateVisibility(showMenuButton); if(routeFollowingMode || routePlanningMode) { mapAppModeShadow.setVisibility(View.GONE); diff --git a/OsmAnd/src/net/osmand/plus/views/controls/MapRouteInfoControl.java b/OsmAnd/src/net/osmand/plus/views/controls/MapRouteInfoControl.java index 9d03054cb4..fee41e0557 100644 --- a/OsmAnd/src/net/osmand/plus/views/controls/MapRouteInfoControl.java +++ b/OsmAnd/src/net/osmand/plus/views/controls/MapRouteInfoControl.java @@ -41,9 +41,10 @@ import android.graphics.PointF; import android.util.TypedValue; import android.view.Gravity; import android.view.View; -import android.view.ViewGroup; import android.view.View.MeasureSpec; +import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; +import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.view.Window; import android.view.WindowManager; import android.widget.AdapterView; @@ -119,34 +120,44 @@ public class MapRouteInfoControl implements IRouteInformationListener { } private Dialog createDialog() { - Dialog dialog = new Dialog(mapActivity); - View ll = mapActivity.getLayoutInflater().inflate(R.layout.plan_route_info, null); + final Dialog dialog = new Dialog(mapActivity); + final View ll = mapActivity.getLayoutInflater().inflate(R.layout.plan_route_info, null); updateInfo(ll); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); //lp.copyFrom(dialog.getWindow().getAttributes()); lp.width = WindowManager.LayoutParams.MATCH_PARENT; ll.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(0, MeasureSpec.EXACTLY)); - int h = ll.getHeight(); + final int maxHeight ; if(ScreenOrientationHelper.isOrientationPortrait(mapActivity)) { - lp.height = //Math.max(h, - (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 280, mapActivity.getResources().getDisplayMetrics()); + maxHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 280, mapActivity.getResources().getDisplayMetrics()); } else { - lp.height = WindowManager.LayoutParams.WRAP_CONTENT; + maxHeight = -1; } + lp.height = WindowManager.LayoutParams.WRAP_CONTENT; lp.gravity = Gravity.BOTTOM; - if(mapActivity.getMyApplication().getDaynightHelper().isNightMode()) { - dialog.getContext().setTheme(R.style.Dialog_Fullscreen_Dark); - } else { - dialog.getContext().setTheme(R.style.Dialog_Fullscreen_Light); - } - + dialog.getContext().setTheme(R.style.Dialog_Fullscreen); dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(ll, new LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT)); dialog.setCanceledOnTouchOutside(true); dialog.getWindow().setAttributes(lp); + ll.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { + boolean wrap = true; + @Override + public void onGlobalLayout() { + if(ll.getHeight() > maxHeight && maxHeight != -1) { + dialog.setContentView(ll, new LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, + maxHeight)); + wrap = false; + } else if(ll.getHeight() < maxHeight && !wrap){ + dialog.setContentView(ll, new LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, + ll.getHeight())); + wrap = true; + } + } + }); return dialog; } @@ -569,10 +580,14 @@ public class MapRouteInfoControl implements IRouteInformationListener { public void showDialog() { dialog = createDialog(); + final boolean switched = mapControlsLayer.switchToRoutePlanningLayout(); dialog.show(); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dlg) { + if(switched) { + mapControlsLayer.switchToRouteFollowingLayout(); + } dialog = null; } }); diff --git a/OsmAnd/src/net/osmand/plus/views/controls/MapRoutePreferencesControl.java b/OsmAnd/src/net/osmand/plus/views/controls/MapRoutePreferencesControl.java index 09292c79d7..de029b3363 100644 --- a/OsmAnd/src/net/osmand/plus/views/controls/MapRoutePreferencesControl.java +++ b/OsmAnd/src/net/osmand/plus/views/controls/MapRoutePreferencesControl.java @@ -44,6 +44,7 @@ import android.view.View; import android.view.View.MeasureSpec; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; +import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.view.Window; import android.view.WindowManager; import android.widget.AdapterView; @@ -132,45 +133,57 @@ public class MapRoutePreferencesControl { dialog.hide(); dialog = null; } else { - dialog = showDialog(); + final boolean switched = controlsLayer.switchToRoutePlanningLayout(); + dialog = createDialog(); dialog.show(); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface dlg) { dialog = null; + if(switched) { + controlsLayer.switchToRouteFollowingLayout(); + } } }); } } - private Dialog showDialog() { - Dialog dialog = new Dialog(mapActivity); - View ll = createLayout(); + private Dialog createDialog() { + final Dialog dialog = new Dialog(mapActivity); + final View ll = createLayout(); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); //lp.copyFrom(dialog.getWindow().getAttributes()); lp.width = WindowManager.LayoutParams.MATCH_PARENT; - ll.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.EXACTLY), - MeasureSpec.makeMeasureSpec(0, MeasureSpec.EXACTLY)); - int h = ll.getHeight(); - if (ScreenOrientationHelper.isOrientationPortrait(mapActivity)) { - lp.height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 260, mapActivity.getResources() - .getDisplayMetrics()); + final int maxHeight ; + if(ScreenOrientationHelper.isOrientationPortrait(mapActivity)) { + maxHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 280, mapActivity.getResources().getDisplayMetrics()); } else { - lp.height = WindowManager.LayoutParams.WRAP_CONTENT; + maxHeight = -1; } + lp.height = WindowManager.LayoutParams.WRAP_CONTENT; lp.gravity = Gravity.BOTTOM; - if(mapActivity.getMyApplication().getDaynightHelper().isNightMode()) { - dialog.getContext().setTheme(R.style.Dialog_Fullscreen_Dark); - } else { - dialog.getContext().setTheme(R.style.Dialog_Fullscreen_Light); - } - + dialog.getContext().setTheme(R.style.Dialog_Fullscreen); dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(ll, new LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT)); dialog.setCanceledOnTouchOutside(true); dialog.getWindow().setAttributes(lp); + ll.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { + boolean wrap = true; + @Override + public void onGlobalLayout() { + if(ll.getHeight() > maxHeight && maxHeight != -1) { + dialog.setContentView(ll, new LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, + maxHeight)); + wrap = false; + } else if(ll.getHeight() < maxHeight && !wrap){ + dialog.setContentView(ll, new LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, + ll.getHeight())); + wrap = true; + } + } + }); return dialog; } diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java index 7ee7387b87..cd2630ac31 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java @@ -30,7 +30,6 @@ import android.app.AlertDialog.Builder; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; -import android.graphics.Typeface; import android.util.DisplayMetrics; import android.view.View; import android.view.WindowManager; @@ -175,6 +174,7 @@ public class MapInfoWidgetsFactory { private View waypointInfoBar; private LocationPointWrapper lastPoint; private TurnDrawable turnDrawable; + private int shadowRad; public TopTextView(OsmandApplication app, MapActivity map) { topBar = map.findViewById(R.id.map_top_bar); @@ -208,6 +208,7 @@ public class MapInfoWidgetsFactory { } public void updateTextColor(boolean nightMode, int textColor, int textShadowColor, boolean bold, int rad) { + this.shadowRad = rad; TextInfoWidget.updateTextColor(addressText, addressTextShadow, textColor, textShadowColor, bold, rad); TextInfoWidget.updateTextColor((TextView) waypointInfoBar.findViewById(R.id.waypoint_text), (TextView) waypointInfoBar.findViewById(R.id.waypoint_text_shadow), @@ -263,7 +264,7 @@ public class MapInfoWidgetsFactory { text = ""; } } - if(!showNextTurn && updateWaypoint()) { + if (!showNextTurn && updateWaypoint()) { updateVisibility(true); updateVisibility(addressText, false); updateVisibility(addressTextShadow, false); @@ -273,7 +274,7 @@ public class MapInfoWidgetsFactory { updateVisibility(true); updateVisibility(waypointInfoBar, false); updateVisibility(addressText, true); - updateVisibility(addressTextShadow, true); + updateVisibility(addressTextShadow, shadowRad > 0); boolean update = turnDrawable.setTurnType(type[0]); int h = addressText.getHeight() / 4 * 3; diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java index a2d49a107f..12361fa57c 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java @@ -41,7 +41,6 @@ import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.Matrix; import android.graphics.Paint; -import android.graphics.Typeface; import android.graphics.Paint.Style; import android.graphics.Path; import android.graphics.drawable.Drawable; @@ -49,8 +48,6 @@ import android.text.format.DateFormat; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.LinearLayout.LayoutParams; import android.widget.TextView; public class RouteInfoWidgetsFactory { @@ -526,6 +523,7 @@ public class RouteInfoWidgetsFactory { private LanesDrawable lanesDrawable; private View centerInfo; private View progress; + private int shadowRadius; public LanesControl(final MapActivity map, final OsmandMapTileView view) { lanesView = (ImageView) map.findViewById(R.id.map_lanes); @@ -543,6 +541,7 @@ public class RouteInfoWidgetsFactory { } public void updateTextSize(boolean isNight, int textColor, int textShadowColor, boolean textBold, int shadowRadius) { + this.shadowRadius = shadowRadius; TextInfoWidget.updateTextColor(lanesText, lanesShadowText, textColor, textShadowColor, textBold, shadowRadius); } @@ -613,7 +612,7 @@ public class RouteInfoWidgetsFactory { lanesText.invalidate(); } } - updateVisibility(lanesShadowText, visible); + updateVisibility(lanesShadowText, visible && shadowRadius > 0); updateVisibility(lanesText, visible); updateVisibility(lanesView, visible); updateVisibility(centerInfo, visible || progress.getVisibility() == View.VISIBLE);