Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
06bc6ad22e
10 changed files with 89 additions and 23 deletions
|
@ -108,6 +108,7 @@
|
|||
<string name="shared_string_map">Map</string>
|
||||
<string name="shared_string_favorite">Favorite</string>
|
||||
<string name="shared_string_favorites">Favorites</string>
|
||||
<string name="shared_string_address">Address</string>
|
||||
<string name="shared_string_add">Add</string>
|
||||
<string name="shared_string_add_to_favorites">Add to Favorites</string>
|
||||
<string name="shared_string_my_location">My Location</string>
|
||||
|
|
|
@ -992,6 +992,9 @@ public class OsmandSettings {
|
|||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final CommonPreference<Boolean> SHOW_DESTINATION_ARROW = new BooleanPreference("show_destination_arrow", false).makeProfile();
|
||||
{
|
||||
SHOW_DESTINATION_ARROW.setModeDefaultValue(ApplicationMode.PEDESTRIAN, true);
|
||||
}
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final CommonPreference<String> MAP_OVERLAY = new StringPreference("map_overlay", null).makeGlobal().cache();
|
||||
|
@ -1763,6 +1766,14 @@ public class OsmandSettings {
|
|||
TRANSPARENT_MAP_THEME.setModeDefaultValue(ApplicationMode.PEDESTRIAN, true);
|
||||
}
|
||||
|
||||
public final CommonPreference<Boolean> SHOW_STREET_NAME =
|
||||
new BooleanPreference("show_street_name", false).makeProfile();
|
||||
{
|
||||
SHOW_STREET_NAME.setModeDefaultValue(ApplicationMode.CAR, true);
|
||||
SHOW_STREET_NAME.setModeDefaultValue(ApplicationMode.BICYCLE, false);
|
||||
SHOW_STREET_NAME.setModeDefaultValue(ApplicationMode.PEDESTRIAN, false);
|
||||
}
|
||||
|
||||
public static final int OSMAND_DARK_THEME = 0;
|
||||
public static final int OSMAND_LIGHT_THEME = 1;
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ import net.osmand.plus.TargetPointsHelper;
|
|||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.activities.search.SearchAddressFragment;
|
||||
import net.osmand.plus.base.FailSafeFuntions;
|
||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||
|
@ -46,6 +47,7 @@ import net.osmand.plus.resources.ResourceManager;
|
|||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.routing.RoutingHelper.RouteCalculationProgressCallback;
|
||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||
import net.osmand.plus.views.MapControlsLayer;
|
||||
import net.osmand.plus.views.OsmAndMapLayersView;
|
||||
import net.osmand.plus.views.OsmAndMapSurfaceView;
|
||||
import net.osmand.plus.views.OsmandMapLayer;
|
||||
|
@ -890,6 +892,10 @@ public class MapActivity extends AccessibleActivity {
|
|||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
OsmandPlugin.onMapActivityResult(requestCode, resultCode, data);
|
||||
MapControlsLayer mcl = mapView.getLayerByClass(MapControlsLayer.class);
|
||||
if(mcl != null) {
|
||||
mcl.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshMap() {
|
||||
|
|
|
@ -223,6 +223,17 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
});
|
||||
|
||||
if (waypointsVisible && getMyApplication().getWaypointHelper().getAllPoints().size() > 0) {
|
||||
if (mapActivity.getMyApplication().getTargetPointsHelper().getIntermediatePoints().size() > 0) {
|
||||
sort.setVisibility(View.VISIBLE);
|
||||
sort.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
hideDashboard();
|
||||
IntermediatePointsDialog.openIntermediatePointsDialog(mapActivity, getMyApplication(), true);
|
||||
}
|
||||
});
|
||||
}
|
||||
edit.setVisibility(View.VISIBLE);
|
||||
edit.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
|
@ -256,17 +267,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
hideDashboard();
|
||||
}
|
||||
});
|
||||
if (mapActivity.getMyApplication().getTargetPointsHelper().getIntermediatePoints().size() > 0) {
|
||||
sort.setVisibility(View.VISIBLE);
|
||||
sort.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
hideDashboard();
|
||||
IntermediatePointsDialog.openIntermediatePointsDialog(mapActivity, getMyApplication(), true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (visibleType == DashboardType.DASHBOARD || visibleType == DashboardType.LIST_MENU) {
|
||||
settings.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -689,7 +689,7 @@ public class WaypointHelper {
|
|||
return null;
|
||||
} else if(type == TARGETS) {
|
||||
int i = !((TargetPoint)point).intermediate? R.drawable.list_destination :
|
||||
R.drawable.list_destination;
|
||||
R.drawable.list_intermediate;
|
||||
return uiCtx.getResources().getDrawable(i);
|
||||
} else if(type == FAVORITES || type == WAYPOINTS) {
|
||||
return FavoriteImageDrawable.getOrCreate(uiCtx, point.getColor());
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||
import net.londatiga.android.ActionItem;
|
||||
import net.londatiga.android.QuickAction;
|
||||
import net.osmand.core.android.MapRendererContext;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -16,6 +17,7 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.search.SearchAddressFragment;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.views.controls.MapRouteInfoControl;
|
||||
|
@ -23,6 +25,7 @@ import net.osmand.plus.views.controls.MapRoutePreferencesControl;
|
|||
import net.osmand.plus.views.corenative.NativeCoreContext;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorFilter;
|
||||
|
@ -41,6 +44,7 @@ import android.widget.TextView;
|
|||
public class MapControlsLayer extends OsmandMapLayer {
|
||||
|
||||
private static final int TIMEOUT_TO_SHOW_BUTTONS = 7000;
|
||||
public static final int REQUEST_ADDRESS_SELECT = 2;
|
||||
|
||||
public MapHudButton createHudButton(View iv, int resId) {
|
||||
MapHudButton mc = new MapHudButton();
|
||||
|
@ -810,4 +814,18 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
};
|
||||
return listener;
|
||||
}
|
||||
|
||||
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);
|
||||
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, false);
|
||||
} else {
|
||||
mapRouteInfoControlDialog.selectAddress("", latLon, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,8 +78,10 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu
|
|||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas, RotatedTileBox tb, DrawSettings nightMode) {
|
||||
if(tb.getZoom() < 3) {
|
||||
return;
|
||||
}
|
||||
int index = 0;
|
||||
|
||||
TargetPointsHelper targetPoints = map.getMyApplication().getTargetPointsHelper();
|
||||
for (TargetPoint ip : targetPoints.getIntermediatePoints()) {
|
||||
index ++;
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.OsmAndLocationProvider;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -13,6 +14,9 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
import net.osmand.plus.activities.FavoritesListFragment.FavouritesAdapter;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.activities.search.SearchAddressActivity;
|
||||
import net.osmand.plus.activities.search.SearchAddressFragment;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.ShowRouteInfoActivity;
|
||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||
|
@ -20,6 +24,7 @@ import net.osmand.plus.routing.RouteDirectionInfo;
|
|||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
|
||||
import net.osmand.plus.views.ContextMenuLayer;
|
||||
import net.osmand.plus.views.MapControlsLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
|
@ -172,6 +177,11 @@ public class MapRouteInfoControl implements IRouteInformationListener {
|
|||
selectFavorite(parentView, false);
|
||||
} else if(position == 2) {
|
||||
selectOnScreen(parentView, false);
|
||||
} else if(position == 3) {
|
||||
Intent intent = new Intent(mapActivity, SearchAddressActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
intent.putExtra(SearchAddressFragment.SELECT_ADDRESS_POINT_INTENT_KEY, (String) null);
|
||||
mapActivity.startActivityForResult(intent, MapControlsLayer.REQUEST_ADDRESS_SELECT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,6 +196,11 @@ public class MapRouteInfoControl implements IRouteInformationListener {
|
|||
selectFavorite(parentView, true);
|
||||
} else if(position == 2) {
|
||||
selectOnScreen(parentView, true);
|
||||
} else if(position == 3) {
|
||||
Intent intent = new Intent(mapActivity, SearchAddressActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
intent.putExtra(SearchAddressFragment.SELECT_ADDRESS_POINT_INTENT_KEY, (String) null);
|
||||
mapActivity.startActivityForResult(intent, MapControlsLayer.REQUEST_ADDRESS_SELECT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,6 +216,17 @@ public class MapRouteInfoControl implements IRouteInformationListener {
|
|||
selectFromMapForTarget = target;
|
||||
hideDialog();
|
||||
}
|
||||
|
||||
public void selectAddress(String name, LatLon l, final boolean target) {
|
||||
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_ADDRESS, name);
|
||||
if(target) {
|
||||
getTargets().navigateToPoint(l, true, -1, pd);
|
||||
} else {
|
||||
getTargets().setStartPoint(l, true, pd);
|
||||
}
|
||||
hideDialog();
|
||||
showDialog();
|
||||
}
|
||||
|
||||
protected void selectFavorite(final View parentView, final boolean target) {
|
||||
Builder bld = new AlertDialog.Builder(mapActivity);
|
||||
|
@ -361,6 +387,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
|
|||
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) {
|
||||
|
@ -400,6 +427,7 @@ public class MapRouteInfoControl implements IRouteInformationListener {
|
|||
}
|
||||
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<String> toAdapter = new ArrayAdapter<String>(view.getContext(),
|
||||
android.R.layout.simple_spinner_item,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package net.osmand.plus.views.mapwidgets;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.binary.RouteDataObject;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.NavigationService;
|
||||
|
@ -23,7 +22,6 @@ import net.osmand.plus.monitoring.ValueHolder;
|
|||
import net.osmand.plus.routing.RouteDirectionInfo;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.controls.MapRouteInfoControl;
|
||||
import net.osmand.plus.views.mapwidgets.NextTurnInfoWidget.TurnDrawable;
|
||||
import net.osmand.router.TurnType;
|
||||
|
@ -33,18 +31,12 @@ import android.content.Context;
|
|||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class MapInfoWidgetsFactory {
|
||||
|
||||
|
@ -237,7 +229,9 @@ public class MapInfoWidgetsFactory {
|
|||
boolean showNextTurn = false;
|
||||
if (routingHelper != null && routingHelper.isRouteCalculated()) {
|
||||
if (routingHelper.isFollowingMode()) {
|
||||
text = routingHelper.getCurrentName(type);
|
||||
if(settings.SHOW_STREET_NAME.get()) {
|
||||
text = routingHelper.getCurrentName(type);
|
||||
}
|
||||
} else {
|
||||
int di = MapRouteInfoControl.getDirectionInfo();
|
||||
if (di >= 0 && MapRouteInfoControl.isControlVisible() &&
|
||||
|
@ -253,7 +247,8 @@ public class MapInfoWidgetsFactory {
|
|||
}
|
||||
}
|
||||
} else if(settings.getApplicationMode() != ApplicationMode.DEFAULT &&
|
||||
map.getMapViewTrackingUtilities().isMapLinkedToLocation()) {
|
||||
map.getMapViewTrackingUtilities().isMapLinkedToLocation() &&
|
||||
settings.SHOW_STREET_NAME.get()) {
|
||||
RouteDataObject rt = locationProvider.getLastKnownRouteSegment();
|
||||
if(rt != null) {
|
||||
text = RoutingHelper.formatStreetName(rt.getName(), rt.getRef(), rt.getDestinationName());
|
||||
|
|
|
@ -211,6 +211,7 @@ public class MapWidgetRegistry {
|
|||
// settings.SHOW_RULER.resetToDefault();
|
||||
settings.SHOW_DESTINATION_ARROW.resetToDefault();
|
||||
settings.TRANSPARENT_MAP_THEME.resetToDefault();
|
||||
settings.SHOW_STREET_NAME.resetToDefault();
|
||||
settings.CENTER_POSITION_ON_MAP.resetToDefault();
|
||||
}
|
||||
|
||||
|
@ -219,6 +220,10 @@ public class MapWidgetRegistry {
|
|||
addControlId(mil, cm, R.string.map_widget_show_destination_arrow, settings.SHOW_DESTINATION_ARROW);
|
||||
addControlId(mil, cm, R.string.map_widget_transparent, settings.TRANSPARENT_MAP_THEME);
|
||||
addControlId(mil, cm, R.string.always_center_position_on_map, settings.CENTER_POSITION_ON_MAP);
|
||||
if(mode != ApplicationMode.DEFAULT) {
|
||||
addControlId(mil, cm, R.string.map_widget_top_text, settings.SHOW_STREET_NAME);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addControlId(final MapInfoLayer mil, ContextMenuAdapter cm, int stringId, OsmandPreference<Boolean> pref) {
|
||||
|
|
Loading…
Reference in a new issue