Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
90841ca1ec
8 changed files with 60 additions and 24 deletions
|
@ -9,6 +9,7 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="avoid_road">Avoid road</string>
|
||||
<string name="storage_directory_readonly_desc">Currently selected Data storage folder is readonly. The storage folder was temporarily switched to Internal memory. Please choose valid storage directory.</string>
|
||||
<string name="storage_directory_shared">Shared memory</string>
|
||||
<string name="shared_string_topbar">Topbar</string>
|
||||
|
|
|
@ -635,8 +635,8 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void populateObjectContextMenu(Object o, ContextMenuAdapter adapter) {
|
||||
if(o instanceof WptPt) {
|
||||
public void populateObjectContextMenu(LatLon latLon, Object o, ContextMenuAdapter adapter) {
|
||||
if (o != null && o instanceof WptPt) {
|
||||
final WptPt p = (WptPt) o;
|
||||
boolean containsPoint = false;
|
||||
for (int i = 0; i < measurementPoints.size(); i++) {
|
||||
|
|
|
@ -20,6 +20,7 @@ import net.osmand.plus.OsmAndFormatter;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.views.AnimateDraggingMapThread;
|
||||
import net.osmand.plus.views.ContextMenuLayer;
|
||||
|
@ -137,13 +138,14 @@ public class AvoidSpecificRoads {
|
|||
|
||||
@Override
|
||||
public boolean processResult(LatLon result) {
|
||||
findRoad(mapActivity, result);
|
||||
addImpassableRoad(mapActivity, result, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
private void findRoad(final MapActivity activity, final LatLon loc) {
|
||||
|
||||
public void addImpassableRoad(final MapActivity activity, final LatLon loc, final boolean showDialog) {
|
||||
final Location ll = new Location("");
|
||||
ll.setLatitude(loc.getLatitude());
|
||||
ll.setLongitude(loc.getLongitude());
|
||||
|
@ -159,8 +161,14 @@ public class AvoidSpecificRoads {
|
|||
if(rh.isRouteCalculated() || rh.isRouteBeingCalculated()) {
|
||||
rh.recalculateRouteDueToSettingsChange();
|
||||
}
|
||||
if (showDialog) {
|
||||
showDialog(activity);
|
||||
}
|
||||
MapContextMenu menu = activity.getContextMenu();
|
||||
if (menu.isActive() && menu.getLatLon().equals(loc)) {
|
||||
menu.close();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -554,10 +554,8 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
|
||||
public void buttonMorePressed() {
|
||||
final ContextMenuAdapter menuAdapter = new ContextMenuAdapter(mapActivity);
|
||||
if (object != null) {
|
||||
for (OsmandMapLayer layer : mapActivity.getMapView().getLayers()) {
|
||||
layer.populateObjectContextMenu(object, menuAdapter);
|
||||
}
|
||||
layer.populateObjectContextMenu(latLon, object, menuAdapter);
|
||||
}
|
||||
|
||||
mapActivity.getMapActions().contextMenuPoint(latLon.getLatitude(), latLon.getLongitude(), menuAdapter, object);
|
||||
|
|
|
@ -81,8 +81,8 @@ public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLaye
|
|||
}
|
||||
|
||||
@Override
|
||||
public void populateObjectContextMenu(Object o, ContextMenuAdapter adapter) {
|
||||
if (o instanceof GPXUtilities.WptPt && plugin.getCurrentRoute() != null){
|
||||
public void populateObjectContextMenu(LatLon latLon, Object o, ContextMenuAdapter adapter) {
|
||||
if (o != null && o instanceof GPXUtilities.WptPt && plugin.getCurrentRoute() != null){
|
||||
final GPXUtilities.WptPt point = (GPXUtilities.WptPt) o;
|
||||
ContextMenuAdapter.OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||
@Override
|
||||
|
|
|
@ -102,7 +102,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void populateObjectContextMenu(Object o, ContextMenuAdapter adapter) {
|
||||
public void populateObjectContextMenu(LatLon latLon, Object o, ContextMenuAdapter adapter) {
|
||||
if (menu.hasHiddenBottomInfo()) {
|
||||
ContextMenuAdapter.OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||
@Override
|
||||
|
|
|
@ -5,14 +5,18 @@ import android.graphics.BitmapFactory;
|
|||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PointF;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.binary.RouteDataObject;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.LocationPoint;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -26,6 +30,7 @@ public class ImpassableRoadsLayer extends OsmandMapLayer implements ContextMenuL
|
|||
private Paint paint;
|
||||
private Map<Long, Location> missingRoadLocations;
|
||||
private List<RouteDataObject> missingRoads;
|
||||
private RoutingHelper routingHelper;
|
||||
|
||||
public ImpassableRoadsLayer(MapActivity activity) {
|
||||
this.activity = activity;
|
||||
|
@ -36,6 +41,7 @@ public class ImpassableRoadsLayer extends OsmandMapLayer implements ContextMenuL
|
|||
this.view = view;
|
||||
roadWorkIcon = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_pin_avoid_road);
|
||||
paint = new Paint();
|
||||
routingHelper = activity.getRoutingHelper();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -147,4 +153,25 @@ public class ImpassableRoadsLayer extends OsmandMapLayer implements ContextMenuL
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populateObjectContextMenu(final LatLon latLon, final Object o, ContextMenuAdapter adapter) {
|
||||
if (latLon != null && o == null
|
||||
&& (routingHelper.isRoutePlanningMode() || routingHelper.isFollowingMode())) {
|
||||
|
||||
ContextMenuAdapter.OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
if (itemId == R.string.avoid_road) {
|
||||
activity.getMyApplication().getAvoidSpecificRoads().addImpassableRoad(
|
||||
activity, latLon, false);
|
||||
}
|
||||
activity.refreshMap();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
adapter.item(R.string.avoid_road).iconColor(
|
||||
R.drawable.ic_action_road_works_dark).listen(listener).reg();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.QuadTree;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
|
@ -16,6 +17,7 @@ import android.graphics.Path;
|
|||
import android.graphics.PointF;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
public abstract class OsmandMapLayer {
|
||||
|
@ -32,7 +34,7 @@ public abstract class OsmandMapLayer {
|
|||
|
||||
public void onRetainNonConfigurationInstance(Map<String, Object> map) {}
|
||||
|
||||
public void populateObjectContextMenu(Object o, ContextMenuAdapter adapter) {}
|
||||
public void populateObjectContextMenu(LatLon latLon, Object o, ContextMenuAdapter adapter) {}
|
||||
|
||||
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue