Route planning menu in progress. Revert fav icon.

This commit is contained in:
Alexey Kulish 2015-12-10 16:50:55 +03:00
parent 2e1f895804
commit 2ca9484cd6
13 changed files with 869 additions and 604 deletions

View file

@ -1,9 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/plan_route_info"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
<FrameLayout android:id="@+id/plan_route_info"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:background="@color/color_transparent">
<LinearLayout
android:id="@+id/main_view"
android:layout_width="@dimen/map_route_planning_land_width"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:background="?attr/left_menu_view_bg"
android:clickable="true"
android:orientation="vertical">
<LinearLayout
@ -42,8 +51,8 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="@dimen/list_content_padding"
android:visibility="gone"
android:orientation="horizontal">
android:orientation="horizontal"
android:visibility="gone">
<ImageView
android:id="@+id/waypoints"
@ -72,38 +81,75 @@
android:id="@+id/FromLayout"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
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"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginBottom="3dp"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:layout_marginTop="5dp"
android:text="@string/route_from"
android:textSize="@dimen/default_sub_text_size"/>
<Spinner
android:id="@+id/FromSpinner"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="-8dp"
android:background="@null"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<ImageView
android:id="@+id/fromDropDownIcon"
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"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:focusable="false"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ViaLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
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"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
@ -111,9 +157,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:layout_marginTop="5dp"
android:gravity="left"
android:text="@string/route_via"
android:textSize="@dimen/default_sub_text_size"/>
@ -122,32 +166,48 @@
android:id="@+id/ViaView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:gravity="left"
android:textSize="@dimen/default_desc_text_size" />
android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/viaLayoutDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:focusable="false"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ToLayout"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
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"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
android:layout_marginTop="5dp"
android:text="@string/route_to"
android:textSize="@dimen/default_sub_text_size">
</TextView>
@ -155,19 +215,27 @@
<Spinner
android:id="@+id/ToSpinner"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="-8dp"
android:background="@null"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<ImageView
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"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:focusable="false"/>
</LinearLayout>
<LinearLayout
android:id="@+id/RouteInfoControls"
@ -219,12 +287,6 @@
android:src="@drawable/ic_next"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:focusable="false" />
</LinearLayout>
</LinearLayout>
@ -240,3 +302,5 @@
<include layout="@layout/map_route_prepare_bottom"/>
</LinearLayout>
</FrameLayout>

View file

@ -48,15 +48,23 @@
<include layout="@layout/map_hud_bottom"/>
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<View
android:layout_width="match_parent"
android:layout_height="1px"/>
</FrameLayout>
<FrameLayout
android:id="@+id/routeMenuContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<include
layout="@layout/dashboard_over_map"
android:layout_width="match_parent"
@ -66,9 +74,11 @@
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<View
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
<ListView

View file

@ -1,9 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/plan_route_info"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
<FrameLayout android:id="@+id/plan_route_info"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:background="@color/color_transparent">
<LinearLayout
android:id="@+id/main_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?attr/bottom_menu_view_bg"
android:clickable="true"
android:orientation="vertical">
<LinearLayout
@ -42,8 +51,8 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="@dimen/list_content_padding"
android:visibility="gone"
android:orientation="horizontal">
android:orientation="horizontal"
android:visibility="gone">
<ImageView
android:id="@+id/waypoints"
@ -72,38 +81,75 @@
android:id="@+id/FromLayout"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
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"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginBottom="3dp"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:layout_marginTop="5dp"
android:text="@string/route_from"
android:textSize="@dimen/default_sub_text_size"/>
<Spinner
android:id="@+id/FromSpinner"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="-8dp"
android:background="@null"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<ImageView
android:id="@+id/fromDropDownIcon"
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"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:focusable="false"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ViaLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
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"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
@ -111,9 +157,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:layout_marginTop="5dp"
android:gravity="left"
android:text="@string/route_via"
android:textSize="@dimen/default_sub_text_size"/>
@ -122,32 +166,48 @@
android:id="@+id/ViaView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:gravity="left"
android:textSize="@dimen/default_desc_text_size" />
android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/viaLayoutDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:focusable="false"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ToLayout"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_height"
android:orientation="horizontal">
<ImageView
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"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
android:layout_marginTop="5dp"
android:text="@string/route_to"
android:textSize="@dimen/default_sub_text_size">
</TextView>
@ -155,19 +215,27 @@
<Spinner
android:id="@+id/ToSpinner"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginTop="3dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="-8dp"
android:background="@null"
android:textSize="@dimen/default_list_text_size"/>
</LinearLayout>
<ImageView
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"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"
android:focusable="false"/>
</LinearLayout>
<LinearLayout
android:id="@+id/RouteInfoControls"
@ -234,3 +302,5 @@
<include layout="@layout/map_route_prepare_bottom"/>
</LinearLayout>
</FrameLayout>

View file

@ -7,7 +7,7 @@
<dimen name="map_route_buttons_width">90dp</dimen>
<dimen name="map_route_buttons_height">81dp</dimen>
<dimen name="map_route_buttons_height_land">72dp</dimen>
<dimen name="map_route_planning_max_height">400dp</dimen>
<dimen name="map_route_planning_max_height">450dp</dimen>
<dimen name="map_minwidth_widget">160dp</dimen>
<dimen name="map_route_planning_land_width">510dp</dimen>

View file

@ -86,7 +86,7 @@
<dimen name="map_button_stroke">1dp</dimen>
<dimen name="map_button_stroke_dark">1dp</dimen>
<dimen name="map_route_planning_land_width">320dp</dimen>
<dimen name="map_route_planning_max_height">280dp</dimen>
<dimen name="map_route_planning_max_height">330dp</dimen>
<dimen name="map_minwidth_widget">100dp</dimen>

View file

@ -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()),

View file

@ -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);
}

View file

@ -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 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();
@ -82,7 +81,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
getTargets().setStartPoint(latlon, true, null);
}
contextMenu.showMinimized(latlon, null, null);
showDialog();
show();
return true;
}
return false;
@ -90,35 +89,33 @@ public class MapRouteInfoControl implements IRouteInformationListener {
public void setVisible(boolean visible) {
if (visible) {
if (showDialog){
//if (getTargets().getPointToNavigate() == null){
showDialog();
//}
showDialog = false;
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<MapRouteInfoMenuFragment> 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);
@ -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<ApplicationMode> selected = new HashSet<ApplicationMode>();
final Set<ApplicationMode> selected = new HashSet<>();
selected.add(am);
ViewGroup vg = (ViewGroup) parentView.findViewById(R.id.app_modes);
vg.removeAllViews();
@ -172,10 +169,19 @@ public class MapRouteInfoControl implements IRouteInformationListener {
String via = generateViaDescription();
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) {
@ -186,7 +192,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
if (position == 1) {
selectFavorite(parentView, true);
} else if (position == 2) {
selectOnScreen(parentView, true);
selectOnScreen(true);
} else if (position == 3) {
Intent intent = new Intent(mapActivity, SearchAddressActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
@ -199,8 +205,25 @@ public class MapRouteInfoControl implements IRouteInformationListener {
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);
@ -215,7 +238,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
} else if (position == 1) {
selectFavorite(parentView, false);
} else if (position == 2) {
selectOnScreen(parentView, false);
selectOnScreen(false);
} else if (position == 3) {
Intent intent = new Intent(mapActivity, SearchAddressActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
@ -228,12 +251,25 @@ public class MapRouteInfoControl implements IRouteInformationListener {
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();
hide();
}
public void selectAddress(String name, LatLon l, final boolean target) {
@ -243,8 +279,8 @@ public class MapRouteInfoControl implements IRouteInformationListener {
} else {
getTargets().setStartPoint(l, true, pd);
}
hideDialog();
showDialog();
hide();
show();
}
protected void selectFavorite(final View parentView, final boolean target) {
@ -267,6 +303,14 @@ 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) {
@ -285,8 +329,8 @@ public class MapRouteInfoControl implements IRouteInformationListener {
dlg[0].dismiss();
}
//Next 2 lines ensure Dialog is shown in the right correct position after a selection been made
hideDialog();
showDialog();
hide();
show();
}
};
}
@ -295,8 +339,17 @@ public class MapRouteInfoControl implements IRouteInformationListener {
return directionInfo;
}
public boolean isDialogVisible() {
return dialog != null && dialog.isShowing();
public boolean isVisible() {
return findMenuFragment() != null;
}
public WeakReference<MapRouteInfoMenuFragment> 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() {
@ -379,58 +432,29 @@ 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<Boolean> showToast) {
directionInfo = -1;
updateDialog();
if(isDialogVisible()) {
updateMenu();
if (isVisible()) {
showToast.value = false;
}
}
public String generateViaDescription() {
TargetPointsHelper targets = getTargets();
String via = "";
List<TargetPoint> 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) {
@ -448,7 +472,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
}
private Spinner setupFromSpinner(View view) {
ArrayList<String> fromActions = new ArrayList<String>();
ArrayList<String> 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));
@ -461,7 +485,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
fromActions.add(oname);
}
final Spinner fromSpinner = ((Spinner) view.findViewById(R.id.FromSpinner));
ArrayAdapter<String> fromAdapter = new ArrayAdapter<String>(view.getContext(),
ArrayAdapter<String> fromAdapter = new ArrayAdapter<>(view.getContext(),
android.R.layout.simple_spinner_item,
fromActions
);
@ -481,7 +505,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
private Spinner setupToSpinner(View view) {
final Spinner toSpinner = ((Spinner) view.findViewById(R.id.ToSpinner));
final TargetPointsHelper targets = getTargets();
ArrayList<String> toActions = new ArrayList<String>();
ArrayList<String> toActions = new ArrayList<>();
if (targets.getPointToNavigate() != null) {
toActions.add(mapActivity.getString(R.string.route_descr_destination) + " "
+ getRoutePointDescription(targets.getPointToNavigate().point,
@ -494,7 +518,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
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<String> toAdapter = new ArrayAdapter<String>(view.getContext(),
ArrayAdapter<String> toAdapter = new ArrayAdapter<>(view.getContext(),
android.R.layout.simple_spinner_item,
toActions
);
@ -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<MapRouteInfoMenuFragment> fragmentRef = findMenuFragment();
if (fragmentRef != null) {
fragmentRef.get().dismiss();
}
}
public void setShowDialog() {
showDialog = true;
public void setShowMenu() {
showMenu = true;
}
}

View file

@ -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;
}
}
}

View file

@ -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);

View file

@ -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();
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);
}
}
}

View file

@ -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);

View file

@ -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) {