diff --git a/OsmAnd/res/layout-land/plan_route_info.xml b/OsmAnd/res/layout-land/plan_route_info.xml
index 2df39c0bba..fdd26eefd5 100644
--- a/OsmAnd/res/layout-land/plan_route_info.xml
+++ b/OsmAnd/res/layout-land/plan_route_info.xml
@@ -1,242 +1,306 @@
-
+
-
+
-
+ android:layout_height="wrap_content">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:orientation="vertical">
-
-
+ android:id="@+id/fromIcon"
+ android:layout_width="24dp"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="@dimen/list_content_padding"
+ android:layout_marginRight="@dimen/list_content_padding"
+ android:src="@drawable/map_default_location"/>
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:focusable="false"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:orientation="horizontal">
+ android:id="@+id/toIcon"
+ android:layout_width="24dp"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="@dimen/list_content_padding"
+ android:layout_marginRight="@dimen/list_content_padding"
+ android:src="@drawable/map_default_location"/>
-
-
-
+ android:orientation="vertical">
+
+
+
+
+
+
+
+ android:id="@+id/toDropDownIcon"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_marginRight="@dimen/list_header_text_left_margin"
+ android:src="@drawable/ic_action_arrow_drop_down"/>
+
+ android:focusable="false"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
-
+
-
+
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/main.xml b/OsmAnd/res/layout/main.xml
index 7e7015367b..8dcfe6554b 100644
--- a/OsmAnd/res/layout/main.xml
+++ b/OsmAnd/res/layout/main.xml
@@ -48,15 +48,23 @@
+
+
+
+
+
+
+
-
+
-
+
-
+ android:layout_height="wrap_content">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:orientation="vertical">
-
-
+ android:id="@+id/fromIcon"
+ android:layout_width="24dp"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="@dimen/list_content_padding"
+ android:layout_marginRight="@dimen/list_content_padding"
+ android:src="@drawable/map_default_location"/>
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:focusable="false"/>
+ android:orientation="horizontal">
+ android:id="@+id/viaIcon"
+ android:layout_width="24dp"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="@dimen/list_content_padding"
+ android:layout_marginRight="@dimen/list_content_padding"
+ android:src="@drawable/map_default_location"/>
-
-
-
+ android:orientation="vertical">
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
-
+
-
\ No newline at end of file
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/values-large/sizes.xml b/OsmAnd/res/values-large/sizes.xml
index 1187d4062d..e87db739d8 100644
--- a/OsmAnd/res/values-large/sizes.xml
+++ b/OsmAnd/res/values-large/sizes.xml
@@ -7,7 +7,7 @@
90dp
81dp
72dp
- 400dp
+ 450dp
160dp
510dp
diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml
index e21f98920e..68eb36dd58 100644
--- a/OsmAnd/res/values/sizes.xml
+++ b/OsmAnd/res/values/sizes.xml
@@ -86,7 +86,7 @@
1dp
1dp
320dp
- 280dp
+ 330dp
100dp
diff --git a/OsmAnd/src/net/osmand/plus/activities/ShowRouteInfoActivity.java b/OsmAnd/src/net/osmand/plus/activities/ShowRouteInfoActivity.java
index 81dccaf93c..e7b5a0e263 100644
--- a/OsmAnd/src/net/osmand/plus/activities/ShowRouteInfoActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/ShowRouteInfoActivity.java
@@ -22,7 +22,7 @@ import net.osmand.plus.R;
import net.osmand.plus.routing.RouteDirectionInfo;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.TurnPathHelper;
-import net.osmand.plus.mapcontextmenu.other.MapRouteInfoControl;
+import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.util.Algorithms;
import android.content.Intent;
import android.net.Uri;
@@ -144,7 +144,7 @@ public class ShowRouteInfoActivity extends OsmandListActivity {
RouteDirectionInfo item = ((RouteInfoAdapter)getListAdapter()).getItem(position - 1);
Location loc = helper.getLocationFromRouteDirection(item);
if(loc != null){
- MapRouteInfoControl.directionInfo = position - 1;
+ MapRouteInfoMenu.directionInfo = position - 1;
OsmandSettings settings = ((OsmandApplication) getApplication()).getSettings();
settings.setMapLocationToShow(loc.getLatitude(),loc.getLongitude(),
Math.max(13, settings.getLastKnownMapZoom()),
diff --git a/OsmAnd/src/net/osmand/plus/base/FavoriteImageDrawable.java b/OsmAnd/src/net/osmand/plus/base/FavoriteImageDrawable.java
index a0cfd4079d..4a676e8bfb 100644
--- a/OsmAnd/src/net/osmand/plus/base/FavoriteImageDrawable.java
+++ b/OsmAnd/src/net/osmand/plus/base/FavoriteImageDrawable.java
@@ -13,7 +13,6 @@ import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
-import android.util.DisplayMetrics;
import net.osmand.plus.R;
@@ -36,30 +35,22 @@ public class FavoriteImageDrawable extends Drawable {
this.withShadow = withShadow;
this.resources = ctx.getResources();
this.color = color;
- paintIcon = new Paint();
- int col = color == 0 || color == Color.BLACK ? getResources().getColor(R.color.color_favorite) : color;
- paintIcon.setColorFilter(new PorterDuffColorFilter(col, PorterDuff.Mode.SRC_IN));
paintBackground = new Paint();
+ int col = color == 0 || color == Color.BLACK ? getResources().getColor(R.color.color_favorite) : color;
+ paintBackground.setColorFilter(new PorterDuffColorFilter(col, PorterDuff.Mode.MULTIPLY));
+ paintIcon = new Paint();
favIcon = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.map_favorite);
favBackground = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.map_white_favorite_shield);
-
-
listDrawable = getResources().getDrawable(R.drawable.ic_action_fav_dark).mutate();
- listDrawable.setColorFilter(new PorterDuffColorFilter(col, PorterDuff.Mode.SRC_IN));
- DisplayMetrics metrics = getResources().getDisplayMetrics();
+
paintOuter = new Paint();
paintOuter.setAntiAlias(true);
paintOuter.setStyle(Style.FILL_AND_STROKE);
paintInnerCircle = new Paint();
paintInnerCircle.setStyle(Style.FILL_AND_STROKE);
- if(metrics != null && metrics.density > 0) {
- paintOuter.setStrokeWidth(metrics.density * 1);
- } else {
- paintOuter.setStrokeWidth(1);
- }
-// paintOuter.setColor(color == 0 || color == Color.BLACK ? 0x88555555 : color);
- paintOuter.setColor(0xffbbbbbb);
- paintInnerCircle.setColor(Color.WHITE);
+ paintOuter.setColor(color == 0 || color == Color.BLACK ? 0x88555555 : color);
+ paintInnerCircle.setColor(color == 0 || color == Color.BLACK ? getResources().getColor(R.color.color_favorite)
+ : color);
paintInnerCircle.setAntiAlias(true);
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoControl.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java
similarity index 73%
rename from OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoControl.java
rename to OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java
index 763bacd5f4..866d8ea90d 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoControl.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java
@@ -5,12 +5,13 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.content.Intent;
import android.graphics.PointF;
+import android.graphics.drawable.Drawable;
+import android.support.v4.app.Fragment;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
-import android.widget.Button;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
@@ -21,10 +22,9 @@ import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.RotatedTileBox;
import net.osmand.plus.ApplicationMode;
+import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmAndFormatter;
-import net.osmand.plus.OsmAndLocationProvider;
import net.osmand.plus.OsmandApplication;
-import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
@@ -34,7 +34,6 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.ShowRouteInfoActivity;
import net.osmand.plus.activities.actions.AppModeDialog;
import net.osmand.plus.activities.search.SearchAddressActivity;
-import net.osmand.plus.development.OsmandDevelopmentPlugin;
import net.osmand.plus.dialogs.FavoriteDialogs;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.routing.RouteDirectionInfo;
@@ -43,27 +42,27 @@ import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
import net.osmand.plus.views.MapControlsLayer;
import net.osmand.plus.views.OsmandMapTileView;
+import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-public class MapRouteInfoControl implements IRouteInformationListener {
+public class MapRouteInfoMenu implements IRouteInformationListener {
public static int directionInfo = -1;
public static boolean controlVisible = false;
private final MapContextMenu contextMenu;
private final RoutingHelper routingHelper;
private OsmandMapTileView mapView;
- private Dialog dialog;
- private boolean selectFromMapTouch;
+ private boolean selectFromMapTouch;
private boolean selectFromMapForTarget;
- private boolean showDialog = false;
+ private boolean showMenu = false;
private MapActivity mapActivity;
private MapControlsLayer mapControlsLayer;
public static final String TARGET_SELECT = "TARGET_SELECT";
- public MapRouteInfoControl(MapActivity mapActivity, MapControlsLayer mapControlsLayer) {
+ public MapRouteInfoMenu(MapActivity mapActivity, MapControlsLayer mapControlsLayer) {
this.mapActivity = mapActivity;
this.mapControlsLayer = mapControlsLayer;
contextMenu = mapActivity.getContextMenu();
@@ -71,61 +70,59 @@ public class MapRouteInfoControl implements IRouteInformationListener {
mapView = mapActivity.getMapView();
routingHelper.addListener(this);
}
-
+
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
- if(selectFromMapTouch) {
+ if (selectFromMapTouch) {
LatLon latlon = tileBox.getLatLonFromPixel(point.x, point.y);
selectFromMapTouch = false;
- if(selectFromMapForTarget) {
+ if (selectFromMapForTarget) {
getTargets().navigateToPoint(latlon, true, -1);
} else {
getTargets().setStartPoint(latlon, true, null);
}
contextMenu.showMinimized(latlon, null, null);
- showDialog();
+ show();
return true;
}
return false;
}
-
+
public void setVisible(boolean visible) {
- if(visible) {
- if (showDialog){
- //if (getTargets().getPointToNavigate() == null){
- showDialog();
- //}
- showDialog = false;
+ if (visible) {
+ if (showMenu) {
+ show();
+ showMenu = false;
}
controlVisible = true;
} else {
- hideDialog();
+ hide();
controlVisible = false;
}
}
-
-
- public void showHideDialog() {
- if(dialog != null) {
- hideDialog();
+
+
+ public void showHideMenu() {
+ if (isVisible()) {
+ hide();
} else {
- showDialog();
+ show();
}
}
-
- public void updateDialog() {
- if(dialog != null) {
- updateInfo(dialog.findViewById(R.id.plan_route_info));
- }
+
+ public void updateMenu() {
+ WeakReference fragmentRef = findMenuFragment();
+ if (fragmentRef != null)
+ fragmentRef.get().updateInfo();
}
-
- private void updateInfo(final View main) {
+
+ public void updateInfo(final View main) {
updateViaView(main);
updateFromSpinner(main);
updateToSpinner(main);
updateApplicationModes(main);
mapControlsLayer.updateRouteButtons(main, true);
boolean addButtons = routingHelper.isRouteCalculated();
- if(addButtons) {
+ if (addButtons) {
updateRouteButtons(main);
} else {
updateRouteCalcProgress(main);
@@ -134,7 +131,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
private void updateRouteCalcProgress(final View main) {
TargetPointsHelper targets = getTargets();
- if(targets.hasTooLongDistanceToNavigate()) {
+ if (targets.hasTooLongDistanceToNavigate()) {
main.findViewById(R.id.RouteInfoControls).setVisibility(View.VISIBLE);
TextView textView = (TextView) main.findViewById(R.id.InfoTextView);
ImageView iconView = (ImageView) main.findViewById(R.id.InfoIcon);
@@ -143,7 +140,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
textView.setText(R.string.route_is_too_long);
textView.setVisibility(View.VISIBLE);
iconView.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_warning));
- } else{
+ } else {
main.findViewById(R.id.RouteInfoControls).setVisibility(View.GONE);
}
}
@@ -151,7 +148,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
private void updateApplicationModes(final View parentView) {
final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
ApplicationMode am = settings.APPLICATION_MODE.get();
- final Set selected = new HashSet();
+ final Set selected = new HashSet<>();
selected.add(am);
ViewGroup vg = (ViewGroup) parentView.findViewById(R.id.app_modes);
vg.removeAllViews();
@@ -165,17 +162,26 @@ public class MapRouteInfoControl implements IRouteInformationListener {
mapActivity.getRoutingHelper().recalculateRouteDueToSettingsChange();
}
}
- });
+ });
}
private void updateViaView(final View parentView) {
String via = generateViaDescription();
- if(via.length() == 0){
+ if (via.length() == 0) {
parentView.findViewById(R.id.ViaLayout).setVisibility(View.GONE);
+ parentView.findViewById(R.id.viaLayoutDivider).setVisibility(View.GONE);
} else {
parentView.findViewById(R.id.ViaLayout).setVisibility(View.VISIBLE);
+ parentView.findViewById(R.id.viaLayoutDivider).setVisibility(View.VISIBLE);
((TextView) parentView.findViewById(R.id.ViaView)).setText(via);
}
+
+ ImageView viaIcon = (ImageView) parentView.findViewById(R.id.viaIcon);
+ if (isLight()) {
+ viaIcon.setImageDrawable(getIconOrig(R.drawable.widget_intermediate_day));
+ } else {
+ viaIcon.setImageDrawable(getIconOrig(R.drawable.widget_intermediate_night));
+ }
}
private void updateToSpinner(final View parentView) {
@@ -183,24 +189,41 @@ public class MapRouteInfoControl implements IRouteInformationListener {
toSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView> parent, View view, int position, long id) {
- if(position == 1) {
+ if (position == 1) {
selectFavorite(parentView, true);
- } else if(position == 2) {
- selectOnScreen(parentView, true);
- } else if(position == 3) {
+ } else if (position == 2) {
+ selectOnScreen(true);
+ } else if (position == 3) {
Intent intent = new Intent(mapActivity, SearchAddressActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.putExtra(TARGET_SELECT, true);
mapActivity.startActivityForResult(intent, MapControlsLayer.REQUEST_ADDRESS_SELECT);
- }
+ }
}
@Override
public void onNothingSelected(AdapterView> parent) {
}
});
+
+ ImageView toIcon = (ImageView) parentView.findViewById(R.id.toIcon);
+ if (isLight()) {
+ toIcon.setImageDrawable(getIconOrig(R.drawable.widget_target_day));
+ } else {
+ toIcon.setImageDrawable(getIconOrig(R.drawable.widget_target_night));
+ }
+
+ ImageView toDropDownIcon = (ImageView) parentView.findViewById(R.id.toDropDownIcon);
+ toDropDownIcon.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_arrow_drop_down));
+ toDropDownIcon.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ toSpinner.performClick();
+ }
+ });
}
+ @SuppressWarnings("deprecation")
private void updateFromSpinner(final View parentView) {
final TargetPointsHelper targets = getTargets();
final Spinner fromSpinner = setupFromSpinner(parentView);
@@ -208,43 +231,56 @@ public class MapRouteInfoControl implements IRouteInformationListener {
@Override
public void onItemSelected(AdapterView> parent, View view, int position, long id) {
- if(position == 0) {
- if(targets.getPointToStart() != null) {
+ if (position == 0) {
+ if (targets.getPointToStart() != null) {
targets.clearStartPoint(true);
}
- } else if(position == 1) {
+ } else if (position == 1) {
selectFavorite(parentView, false);
- } else if(position == 2) {
- selectOnScreen(parentView, false);
- } else if(position == 3) {
+ } else if (position == 2) {
+ selectOnScreen(false);
+ } else if (position == 3) {
Intent intent = new Intent(mapActivity, SearchAddressActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.putExtra(TARGET_SELECT, false);
mapActivity.startActivityForResult(intent, MapControlsLayer.REQUEST_ADDRESS_SELECT);
- }
+ }
}
@Override
public void onNothingSelected(AdapterView> parent) {
}
});
+
+ ImageView fromIcon = (ImageView) parentView.findViewById(R.id.fromIcon);
+ ApplicationMode appMode = mapActivity.getMyApplication().getSettings().getApplicationMode();
+ fromIcon.setImageDrawable(mapActivity.getResources().getDrawable(appMode.getResourceLocationDay()));
+
+ ImageView fromDropDownIcon = (ImageView) parentView.findViewById(R.id.fromDropDownIcon);
+ fromDropDownIcon.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_arrow_drop_down));
+ fromDropDownIcon.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ fromSpinner.performClick();
+ }
+ });
}
- protected void selectOnScreen(View parentView, boolean target) {
+ protected void selectOnScreen(boolean target) {
selectFromMapTouch = true;
- selectFromMapForTarget = target;
- hideDialog();
+ selectFromMapForTarget = target;
+ hide();
}
-
+
public void selectAddress(String name, LatLon l, final boolean target) {
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_ADDRESS, name);
- if(target) {
+ if (target) {
getTargets().navigateToPoint(l, true, -1, pd);
} else {
getTargets().setStartPoint(l, true, pd);
}
- hideDialog();
- showDialog();
+ hide();
+ show();
}
protected void selectFavorite(final View parentView, final boolean target) {
@@ -267,26 +303,34 @@ public class MapRouteInfoControl implements IRouteInformationListener {
FavoriteDialogs.showFavoritesDialog(mapActivity, favouritesAdapter, click, dismissListener, dlgHolder, true);
}
+ private boolean isLight() {
+ return mapActivity.getMyApplication().getSettings().isLightContent();
+ }
+
+ private Drawable getIconOrig(int iconId) {
+ IconsCache iconsCache = mapActivity.getMyApplication().getIconsCache();
+ return iconsCache.getIcon(iconId, 0, 0f);
+ }
private OnItemClickListener getOnClickListener(final boolean target, final FavouritesAdapter favouritesAdapter,
- final Dialog[] dlg) {
+ final Dialog[] dlg) {
return new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView> parent, View view, int position, long id) {
FavouritePoint fp = favouritesAdapter.getItem(position);
LatLon point = new LatLon(fp.getLatitude(), fp.getLongitude());
- if(target) {
+ if (target) {
getTargets().navigateToPoint(point, true, -1, fp.getPointDescription());
} else {
getTargets().setStartPoint(point, true, fp.getPointDescription());
}
- if(dlg != null && dlg.length > 0 && dlg[0] != null) {
+ if (dlg != null && dlg.length > 0 && dlg[0] != null) {
dlg[0].dismiss();
}
//Next 2 lines ensure Dialog is shown in the right correct position after a selection been made
- hideDialog();
- showDialog();
+ hide();
+ show();
}
};
}
@@ -294,15 +338,24 @@ public class MapRouteInfoControl implements IRouteInformationListener {
public static int getDirectionInfo() {
return directionInfo;
}
-
- public boolean isDialogVisible() {
- return dialog != null && dialog.isShowing();
+
+ public boolean isVisible() {
+ return findMenuFragment() != null;
+ }
+
+ public WeakReference findMenuFragment() {
+ Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(MapRouteInfoMenuFragment.TAG);
+ if (fragment != null && !fragment.isDetached()) {
+ return new WeakReference<>((MapRouteInfoMenuFragment) fragment);
+ } else {
+ return null;
+ }
}
public static boolean isControlVisible() {
return controlVisible;
}
-
+
private void updateRouteButtons(final View mainView) {
mainView.findViewById(R.id.RouteInfoControls).setVisibility(View.VISIBLE);
final OsmandApplication ctx = mapActivity.getMyApplication();
@@ -337,10 +390,10 @@ public class MapRouteInfoControl implements IRouteInformationListener {
ImageView next = (ImageView) mainView.findViewById(R.id.Next);
next.setVisibility(View.VISIBLE);
next.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_next));
- next.setOnClickListener(new View.OnClickListener(){
+ next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- if(routingHelper.getRouteDirections() != null && directionInfo < routingHelper.getRouteDirections().size() - 1){
+ if (routingHelper.getRouteDirections() != null && directionInfo < routingHelper.getRouteDirections().size() - 1) {
directionInfo++;
RouteDirectionInfo info = routingHelper.getRouteDirections().get(directionInfo);
net.osmand.Location l = routingHelper.getLocationFromRouteDirection(info);
@@ -350,10 +403,10 @@ public class MapRouteInfoControl implements IRouteInformationListener {
mapView.refreshMap();
updateInfo(mainView);
}
-
+
});
View info = mainView.findViewById(R.id.Info);
- info.setOnClickListener(new View.OnClickListener(){
+ info.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mapView.getContext(), ShowRouteInfoActivity.class);
@@ -361,10 +414,10 @@ public class MapRouteInfoControl implements IRouteInformationListener {
mapView.getContext().startActivity(intent);
}
});
-
+
TextView textView = (TextView) mainView.findViewById(R.id.InfoTextView);
ImageView iconView = (ImageView) mainView.findViewById(R.id.InfoIcon);
- if(directionInfo >= 0) {
+ if (directionInfo >= 0) {
iconView.setVisibility(View.GONE);
} else {
iconView.setImageDrawable(ctx.getIconsCache().getContentIcon(R.drawable.ic_action_info_dark));
@@ -379,81 +432,52 @@ public class MapRouteInfoControl implements IRouteInformationListener {
}
}
- private Button attachSimulateRoute(final View mainView, final OsmandApplication ctx) {
- final Button simulateRoute = null;//(Button) mainView.findViewById(R.id.SimulateRoute);
- final OsmAndLocationProvider loc = ctx.getLocationProvider();
- if(mapActivity.getRoutingHelper().isFollowingMode()) {
- simulateRoute.setVisibility(View.GONE);
- }
- if (OsmandPlugin.getEnabledPlugin(OsmandDevelopmentPlugin.class) == null) {
- simulateRoute.setVisibility(View.GONE);
- }
- simulateRoute.setText(loc.getLocationSimulation().isRouteAnimating() ? R.string.animate_route_off : R.string.animate_route);
- simulateRoute.setOnClickListener(new View.OnClickListener() {
-
- @Override
- public void onClick(View v) {
- mainView.findViewById(R.id.RouteInfoControls).setVisibility(View.GONE);
- if(loc.getLocationSimulation().isRouteAnimating()) {
- loc.getLocationSimulation().startStopRouteAnimation(mapActivity);
- hideDialog();
- } else {
- simulateRoute.setText(R.string.animate_route_off);
- loc.getLocationSimulation().startStopRouteAnimation(mapActivity);
- }
-
- }
- });
- return simulateRoute;
- }
-
-
@Override
public void newRouteIsCalculated(boolean newRoute, ValueHolder showToast) {
directionInfo = -1;
- updateDialog();
- if(isDialogVisible()) {
+ updateMenu();
+ if (isVisible()) {
showToast.value = false;
}
}
-
+
public String generateViaDescription() {
TargetPointsHelper targets = getTargets();
- String via = "";
List points = targets.getIntermediatePointsNavigation();
if (points.size() == 0) {
- return via;
+ return "";
}
+ StringBuilder via = new StringBuilder();
for (int i = 0; i < points.size(); i++) {
if (i > 0) {
- via += "\n";
+ via.append(" ");
}
- via += " " + getRoutePointDescription(points.get(i).point, points.get(i).getOnlyName());
+ via.append(getRoutePointDescription(points.get(i).point, points.get(i).getOnlyName()));
}
- return via;
+ return via.toString();
}
-
+
public String getRoutePointDescription(double lat, double lon) {
return mapActivity.getString(R.string.route_descr_lat_lon, lat, lon);
}
-
+
public String getRoutePointDescription(LatLon l, String d) {
- if(d != null && d.length() > 0) {
+ if (d != null && d.length() > 0) {
return d.replace(':', ' ');
}
- if(l != null) {
+ if (l != null) {
return mapActivity.getString(R.string.route_descr_lat_lon, l.getLatitude(), l.getLongitude());
}
return "";
}
-
- private Spinner setupFromSpinner( View view) {
- ArrayList fromActions = new ArrayList();
+
+ private Spinner setupFromSpinner(View view) {
+ ArrayList fromActions = new ArrayList<>();
fromActions.add(mapActivity.getString(R.string.route_descr_current_location));
fromActions.add(mapActivity.getString(R.string.shared_string_favorite) + mapActivity.getString(R.string.shared_string_ellipsis));
fromActions.add(mapActivity.getString(R.string.shared_string_select_on_map));
fromActions.add(mapActivity.getString(R.string.shared_string_address) + mapActivity.getString(R.string.shared_string_ellipsis));
-
+
TargetPoint start = getTargets().getPointToStart();
if (start != null) {
String oname = start.getOnlyName().length() > 0 ? start.getOnlyName()
@@ -461,43 +485,43 @@ public class MapRouteInfoControl implements IRouteInformationListener {
fromActions.add(oname);
}
final Spinner fromSpinner = ((Spinner) view.findViewById(R.id.FromSpinner));
- ArrayAdapter fromAdapter = new ArrayAdapter(view.getContext(),
- android.R.layout.simple_spinner_item,
+ ArrayAdapter fromAdapter = new ArrayAdapter<>(view.getContext(),
+ android.R.layout.simple_spinner_item,
fromActions
- );
+ );
fromAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
fromSpinner.setAdapter(fromAdapter);
- if(start != null) {
+ if (start != null) {
fromSpinner.setSelection(fromActions.size() - 1);
} else {
- if(mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation() == null) {
+ if (mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation() == null) {
fromSpinner.setPromptId(R.string.search_poi_location);
}
//fromSpinner.setSelection(0);
}
return fromSpinner;
}
-
+
private Spinner setupToSpinner(View view) {
final Spinner toSpinner = ((Spinner) view.findViewById(R.id.ToSpinner));
final TargetPointsHelper targets = getTargets();
- ArrayList toActions = new ArrayList();
+ ArrayList toActions = new ArrayList<>();
if (targets.getPointToNavigate() != null) {
toActions.add(mapActivity.getString(R.string.route_descr_destination) + " "
- + getRoutePointDescription(targets.getPointToNavigate().point,
- targets.getPointToNavigate().getOnlyName()));
+ + getRoutePointDescription(targets.getPointToNavigate().point,
+ targets.getPointToNavigate().getOnlyName()));
} else {
toSpinner.setPromptId(R.string.route_descr_select_destination);
- toActions.add(mapActivity.getString(R.string.route_descr_select_destination));
+ toActions.add(mapActivity.getString(R.string.route_descr_select_destination));
}
toActions.add(mapActivity.getString(R.string.shared_string_favorite) + mapActivity.getString(R.string.shared_string_ellipsis));
toActions.add(mapActivity.getString(R.string.shared_string_select_on_map));
toActions.add(mapActivity.getString(R.string.shared_string_address) + mapActivity.getString(R.string.shared_string_ellipsis));
-
- ArrayAdapter toAdapter = new ArrayAdapter(view.getContext(),
- android.R.layout.simple_spinner_item,
+
+ ArrayAdapter toAdapter = new ArrayAdapter<>(view.getContext(),
+ android.R.layout.simple_spinner_item,
toActions
- );
+ );
toAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
toSpinner.setAdapter(toAdapter);
return toSpinner;
@@ -510,36 +534,22 @@ public class MapRouteInfoControl implements IRouteInformationListener {
@Override
public void routeWasCancelled() {
directionInfo = -1;
- // do not hide dialog (needed for use case entering Planning mode without destination)
+ // do not hide fragment (needed for use case entering Planning mode without destination)
}
-
-
- public void showDialog() {
- final View ll = mapActivity.getLayoutInflater().inflate(R.layout.plan_route_info, null);
- updateInfo(ll);
- dialog = MapRoutePreferencesControl.showDialog(mapControlsLayer, mapActivity, ll, new OnDismissListener() {
- @Override
- public void onDismiss(DialogInterface d) {
- dialog = null;
- }
- });
+
+ public void show() {
+ MapRouteInfoMenuFragment.showInstance(mapActivity);
}
-
- public void hideDialog() {
- Dialog dialog = this.dialog;
- if (dialog != null) {
- if(dialog instanceof MapRoutePreferencesControl.RoutePrepareDialog &&
- ((MapRoutePreferencesControl.RoutePrepareDialog) dialog).getListener() != null) {
- ((MapRoutePreferencesControl.RoutePrepareDialog) dialog).getListener().onDismiss(dialog);
- ((MapRoutePreferencesControl.RoutePrepareDialog) dialog).cancelDismissListener();
- }
- dialog.dismiss();
- this.dialog = null;
+
+ public void hide() {
+ WeakReference fragmentRef = findMenuFragment();
+ if (fragmentRef != null) {
+ fragmentRef.get().dismiss();
}
}
- public void setShowDialog() {
- showDialog = true;
+ public void setShowMenu() {
+ showMenu = true;
}
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenuFragment.java
new file mode 100644
index 0000000000..207c851810
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenuFragment.java
@@ -0,0 +1,109 @@
+package net.osmand.plus.mapcontextmenu.other;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentActivity;
+import android.support.v4.app.FragmentManager;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import net.osmand.plus.R;
+import net.osmand.plus.activities.MapActivity;
+import net.osmand.plus.helpers.AndroidUiHelper;
+
+public class MapRouteInfoMenuFragment extends Fragment {
+ public static final String TAG = "MapRouteInfoMenuFragment";
+
+ private MapRouteInfoMenu menu;
+ private View mainView;
+
+ private MapActivity getMapActivity() {
+ return (MapActivity) getActivity();
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ MapActivity mapActivity = getMapActivity();
+
+ menu = mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
+ View view = inflater.inflate(R.layout.plan_route_info, container, false);
+ if (menu == null) {
+ return view;
+ }
+
+ view.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ dismiss();
+ }
+ });
+
+ mainView = view.findViewById(R.id.main_view);
+ updateInfo();
+
+ return view;
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ if (menu == null) {
+ dismiss();
+ }
+ }
+
+ public void updateInfo() {
+ menu.updateInfo(mainView);
+ }
+
+ public void show(MapActivity mapActivity) {
+ int slideInAnim = R.anim.slide_in_bottom;
+ int slideOutAnim = R.anim.slide_out_bottom;
+
+ mapActivity.getSupportFragmentManager().beginTransaction()
+ .setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
+ .add(R.id.routeMenuContainer, this, TAG)
+ .addToBackStack(TAG)
+ .commitAllowingStateLoss();
+ }
+
+ public void dismiss() {
+ FragmentActivity activity = getActivity();
+ if (activity != null) {
+ try {
+ activity.getSupportFragmentManager().popBackStack(TAG,
+ FragmentManager.POP_BACK_STACK_INCLUSIVE);
+ } catch (Exception e) {
+ //
+ }
+ }
+ }
+
+ public static boolean showInstance(final MapActivity mapActivity) {
+ try {
+ boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
+ int slideInAnim;
+ int slideOutAnim;
+ if (portrait) {
+ slideInAnim = R.anim.slide_in_bottom;
+ slideOutAnim = R.anim.slide_out_bottom;
+ } else {
+ slideInAnim = R.anim.slide_in_left;
+ slideOutAnim = R.anim.slide_out_left;
+ }
+
+ MapRouteInfoMenuFragment fragment = new MapRouteInfoMenuFragment();
+ mapActivity.getSupportFragmentManager().beginTransaction()
+ .setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
+ .add(R.id.routeMenuContainer, fragment, TAG)
+ .addToBackStack(TAG).commitAllowingStateLoss();
+
+ return true;
+
+ } catch (RuntimeException e) {
+ return false;
+ }
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/views/FavoritesLayer.java b/OsmAnd/src/net/osmand/plus/views/FavoritesLayer.java
index fc38eb62b4..52df922fbe 100644
--- a/OsmAnd/src/net/osmand/plus/views/FavoritesLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/FavoritesLayer.java
@@ -3,8 +3,11 @@ package net.osmand.plus.views;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
+import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PointF;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
@@ -33,6 +36,7 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.
private MapTextLayer textLayer;
private Paint paintIcon;
private Bitmap pointSmall;
+ private int defaultColor;
private OsmandSettings settings;
@@ -60,6 +64,7 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.
textLayer = view.getLayerByClass(MapTextLayer.class);
paintIcon = new Paint();
pointSmall = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_white_shield_small);
+ defaultColor = view.getResources().getColor(R.color.color_favorite);
}
private boolean calculateBelongs(int ex, int ey, int objx, int objy, int radius) {
@@ -101,6 +106,8 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.
float y = tileBox.getPixYFromLatLon(o.getLatitude(), o.getLongitude());
if (intersects(boundIntersections, x, y, iconSize, iconSize)) {
+ int col = o.getColor() == 0 || o.getColor() == Color.BLACK ? defaultColor : o.getColor();
+ paintIcon.setColorFilter(new PorterDuffColorFilter(col, PorterDuff.Mode.MULTIPLY));
canvas.drawBitmap(pointSmall, x - pointSmall.getWidth() / 2, y - pointSmall.getHeight() / 2, paintIcon);
} else {
fullObjects.add(o);
diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java
index 6bb0d6e9cf..6497bef979 100644
--- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java
@@ -41,7 +41,7 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.search.SearchAddressFragment;
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.helpers.AndroidUiHelper;
-import net.osmand.plus.mapcontextmenu.other.MapRouteInfoControl;
+import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.mapcontextmenu.other.MapRoutePreferencesControl;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.corenative.NativeCoreContext;
@@ -76,7 +76,7 @@ public class MapControlsLayer extends OsmandMapLayer {
private OsmandSettings settings;
private MapRoutePreferencesControl optionsRouteControlDialog;
- private MapRouteInfoControl mapRouteInfoControlDialog;
+ private MapRouteInfoMenu mapRouteInfoMenu;
private MapHudButton backToLocationControl;
private MapHudButton menuControl;
private MapHudButton compassHud;
@@ -103,6 +103,10 @@ public class MapControlsLayer extends OsmandMapLayer {
mapView = mapActivity.getMapView();
}
+ public MapRouteInfoMenu getMapRouteInfoMenu() {
+ return mapRouteInfoMenu;
+ }
+
@Override
public boolean drawInScreenPixels() {
return true;
@@ -217,7 +221,7 @@ public class MapControlsLayer extends OsmandMapLayer {
}
private void initRouteControls() {
- mapRouteInfoControlDialog = new MapRouteInfoControl(mapActivity, this);
+ mapRouteInfoMenu = new MapRouteInfoMenu(mapActivity, this);
optionsRouteControlDialog = new MapRoutePreferencesControl(mapActivity, this);
}
@@ -252,8 +256,8 @@ public class MapControlsLayer extends OsmandMapLayer {
TextView routeGoButton = (TextView) main.findViewById(R.id.map_go_route_button);
routeGoButton.setCompoundDrawablesWithIntrinsicBounds(app.getIconsCache().getIcon(R.drawable.map_start_navigation, R.color.color_myloc_distance), null, null, null);
- routeGoButton.setText(AndroidUiHelper.isOrientationPortrait(mapActivity) ?
- mapActivity.getString(R.string.shared_string_go) : "");
+ routeGoButton.setText(/*AndroidUiHelper.isOrientationPortrait(mapActivity) ?*/
+ mapActivity.getString(R.string.shared_string_go) /*: ""*/);
routeGoButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -274,25 +278,25 @@ public class MapControlsLayer extends OsmandMapLayer {
protected void clickRouteParams() {
notifyClicked();
- mapRouteInfoControlDialog.hideDialog();
- optionsRouteControlDialog.showAndHideDialog();
+ if (optionsRouteControlDialog.isDialogVisible()) {
+ optionsRouteControlDialog.hideDialog();
+ mapRouteInfoMenu.showHideMenu();
+ } else {
+ mapRouteInfoMenu.hide();
+ optionsRouteControlDialog.showAndHideDialog();
+ }
}
protected void clickRouteWaypoints() {
if (getTargets().checkPointToNavigateShort()) {
notifyClicked();
- if (optionsRouteControlDialog.isDialogVisible()) {
- optionsRouteControlDialog.hideDialog();
- } else if (mapRouteInfoControlDialog.isDialogVisible()) {
- mapRouteInfoControlDialog.hideDialog();
- }
mapActivity.getMapActions().openIntermediatePointsDialog();
}
}
protected void clickRouteCancel() {
notifyClicked();
- mapRouteInfoControlDialog.hideDialog();
+ mapRouteInfoMenu.hide();
optionsRouteControlDialog.hideDialog();
if (mapActivity.getRoutingHelper().isFollowingMode()) {
mapActivity.getMapActions().stopNavigationActionConfirm();
@@ -303,7 +307,7 @@ public class MapControlsLayer extends OsmandMapLayer {
protected void clickRouteGo() {
notifyClicked();
- mapRouteInfoControlDialog.hideDialog();
+ mapRouteInfoMenu.hide();
optionsRouteControlDialog.hideDialog();
// RoutingHelper routingHelper = mapActivity.getMyApplication().getRoutingHelper();
// if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
@@ -315,11 +319,11 @@ public class MapControlsLayer extends OsmandMapLayer {
}
public void showRouteInfoControlDialog() {
- mapRouteInfoControlDialog.showHideDialog();
+ mapRouteInfoMenu.showHideMenu();
}
public void showDialog() {
- mapRouteInfoControlDialog.setShowDialog();
+ mapRouteInfoMenu.setShowMenu();
}
private void initControls() {
@@ -462,7 +466,7 @@ public class MapControlsLayer extends OsmandMapLayer {
switchToRouteFollowingLayout();
} else {
if (!app.getTargetPointsHelper().checkPointToNavigateShort()) {
- mapRouteInfoControlDialog.showDialog();
+ mapRouteInfoMenu.show();
} else {
touchEvent = 0;
mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
@@ -531,7 +535,7 @@ public class MapControlsLayer extends OsmandMapLayer {
int textColor = isNight ? mapActivity.getResources().getColor(R.color.widgettext_night) : Color.BLACK;
if (shadowColor != shadw) {
shadowColor = shadw;
- // TODO
+ // TODOnightMode
// updatextColor(textColor, shadw, rulerControl, zoomControls, mapMenuControls);
}
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
@@ -544,7 +548,7 @@ public class MapControlsLayer extends OsmandMapLayer {
routePlanningMode = true;
}
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
- boolean dialogOpened = optionsRouteControlDialog.isDialogVisible() || mapRouteInfoControlDialog.isDialogVisible();
+ boolean dialogOpened = optionsRouteControlDialog.isDialogVisible() || mapRouteInfoMenu.isVisible();
boolean showRouteCalculationControls = routePlanningMode ||
((System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS) && routeFollowingMode);
updateMyLocation(rh, dialogOpened);
@@ -581,7 +585,7 @@ public class MapControlsLayer extends OsmandMapLayer {
}
}
- mapRouteInfoControlDialog.setVisible(showRouteCalculationControls);
+ mapRouteInfoMenu.setVisible(showRouteCalculationControls);
if (showRouteCalculationControls) {
if (!mapActivity.getRoutingHelper().isFollowingMode()
&& !mapActivity.getRoutingHelper().isPauseNavigation()) {
@@ -634,7 +638,7 @@ public class MapControlsLayer extends OsmandMapLayer {
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
- if (mapRouteInfoControlDialog.onSingleTap(point, tileBox)) {
+ if (mapRouteInfoMenu.onSingleTap(point, tileBox)) {
return true;
}
stopCounter();
@@ -933,14 +937,14 @@ public class MapControlsLayer extends OsmandMapLayer {
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_ADDRESS_SELECT && resultCode == SearchAddressFragment.SELECT_ADDRESS_POINT_RESULT_OK) {
String name = data.getStringExtra(SearchAddressFragment.SELECT_ADDRESS_POINT_INTENT_KEY);
- boolean target = data.getBooleanExtra(MapRouteInfoControl.TARGET_SELECT, true);
+ boolean target = data.getBooleanExtra(MapRouteInfoMenu.TARGET_SELECT, true);
LatLon latLon = new LatLon(
data.getDoubleExtra(SearchAddressFragment.SELECT_ADDRESS_POINT_LAT, 0),
data.getDoubleExtra(SearchAddressFragment.SELECT_ADDRESS_POINT_LON, 0));
if (name != null) {
- mapRouteInfoControlDialog.selectAddress(name, latLon, target);
+ mapRouteInfoMenu.selectAddress(name, latLon, target);
} else {
- mapRouteInfoControlDialog.selectAddress("", latLon, target);
+ mapRouteInfoMenu.selectAddress("", latLon, target);
}
}
}
diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java
index 8973ad6940..2ee086a761 100644
--- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java
+++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java
@@ -33,7 +33,7 @@ import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.routing.RouteDirectionInfo;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
-import net.osmand.plus.mapcontextmenu.other.MapRouteInfoControl;
+import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.views.mapwidgets.NextTurnInfoWidget.TurnDrawable;
import net.osmand.router.TurnType;
@@ -237,8 +237,8 @@ public class MapInfoWidgetsFactory {
}
}
} else {
- int di = MapRouteInfoControl.getDirectionInfo();
- if (di >= 0 && MapRouteInfoControl.isControlVisible() &&
+ int di = MapRouteInfoMenu.getDirectionInfo();
+ if (di >= 0 && MapRouteInfoMenu.isControlVisible() &&
di < routingHelper.getRouteDirections().size()) {
showNextTurn = true;
RouteDirectionInfo next = routingHelper.getRouteDirections().get(di);
diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java
index 94c63a80f2..b89b255e68 100644
--- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java
+++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java
@@ -30,7 +30,7 @@ import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.TurnPathHelper;
-import net.osmand.plus.mapcontextmenu.other.MapRouteInfoControl;
+import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.router.RouteResultPreparation;
import net.osmand.router.TurnType;
import net.osmand.util.Algorithms;
@@ -583,8 +583,8 @@ public class RouteInfoWidgetsFactory {
dist = r.distanceTo;
}
} else {
- int di = MapRouteInfoControl.getDirectionInfo();
- if (di >= 0 && MapRouteInfoControl.isControlVisible()
+ int di = MapRouteInfoMenu.getDirectionInfo();
+ if (di >= 0 && MapRouteInfoMenu.isControlVisible()
&& di < rh.getRouteDirections().size()) {
RouteDirectionInfo next = rh.getRouteDirections().get(di);
if (next != null) {