add OSM notes shape and fix tap shape
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.4 KiB |
9
OsmAnd/res/drawable/bg_point_comment.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="36dp"
|
||||
android:height="36dp"
|
||||
android:viewportWidth="36"
|
||||
android:viewportHeight="36">
|
||||
<path
|
||||
android:pathData="M5,2L31,2A3,3 0,0 1,34 5L34,31A3,3 0,0 5,31 34L5,34A3,3 0,0 1,2 31L2,5A3,3 0,0 1,5 2z"
|
||||
android:fillColor="#727272" />
|
||||
</vector>
|
|
@ -310,8 +310,8 @@ public class FavouritePoint implements Serializable, LocationPoint {
|
|||
public enum BackgroundType {
|
||||
CIRCLE("circle", R.string.shared_string_circle, R.drawable.bg_point_circle),
|
||||
OCTAGON("octagon", R.string.shared_string_octagon, R.drawable.bg_point_octagon),
|
||||
SQUARE("square", R.string.shared_string_square, R.drawable.bg_point_square);
|
||||
|
||||
SQUARE("square", R.string.shared_string_square, R.drawable.bg_point_square),
|
||||
COMMENT("comment", -1, R.drawable.bg_point_comment);
|
||||
private String typeName;
|
||||
@StringRes
|
||||
private int nameId;
|
||||
|
|
|
@ -380,7 +380,10 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
|||
private void createShapeSelector() {
|
||||
FlowLayout selectShape = view.findViewById(R.id.select_shape);
|
||||
for (BackgroundType backgroundType : BackgroundType.values()) {
|
||||
selectShape.addView(createShapeItemView(backgroundType, selectShape), new FlowLayout.LayoutParams(0, 0));
|
||||
if (backgroundType.getNameId() != -1) {
|
||||
selectShape.addView(createShapeItemView(backgroundType, selectShape),
|
||||
new FlowLayout.LayoutParams(0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import androidx.core.content.ContextCompat;
|
|||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadRect;
|
||||
|
@ -155,7 +156,8 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
|||
backgroundColorRes = R.color.osm_bug_resolved_icon_color;
|
||||
}
|
||||
PointImageDrawable pointImageDrawable = PointImageDrawable.getOrCreate(activity,
|
||||
ContextCompat.getColor(activity, backgroundColorRes), true, iconId);
|
||||
ContextCompat.getColor(activity, backgroundColorRes), true, false, iconId,
|
||||
FavouritePoint.BackgroundType.COMMENT);
|
||||
pointImageDrawable.drawPoint(canvas, x, y, textScale, false);
|
||||
}
|
||||
this.fullObjectsLatLon = fullObjectsLatLon;
|
||||
|
|
|
@ -78,9 +78,10 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC
|
|||
|
||||
private void drawPoint(Canvas canvas, OsmPoint o, float x, float y) {
|
||||
float textScale = activity.getMyApplication().getSettings().TEXT_SCALE.get();
|
||||
int iconId = R.drawable.mx_special_information;
|
||||
PointImageDrawable pointImageDrawable = PointImageDrawable.getOrCreate(activity,
|
||||
ContextCompat.getColor(activity, R.color.created_poi_icon_color), true,
|
||||
R.drawable.mx_special_information);
|
||||
iconId);
|
||||
pointImageDrawable.setAlpha(0.8f);
|
||||
pointImageDrawable.drawPoint(canvas, x, y, textScale, false);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.views;
|
|||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
|
@ -24,6 +25,7 @@ import androidx.appcompat.content.res.AppCompatResources;
|
|||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.CallbackWithObject;
|
||||
import net.osmand.GPXUtilities;
|
||||
import net.osmand.NativeLibrary.RenderedObject;
|
||||
import net.osmand.RenderingContext;
|
||||
import net.osmand.aidl.AidlMapPointWrapper;
|
||||
|
@ -40,8 +42,10 @@ import net.osmand.core.jni.ObfMapObject;
|
|||
import net.osmand.core.jni.PointI;
|
||||
import net.osmand.core.jni.QStringList;
|
||||
import net.osmand.core.jni.QStringStringHash;
|
||||
import net.osmand.core.jni.ResourcesManager;
|
||||
import net.osmand.core.jni.Utilities;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
|
@ -58,6 +62,7 @@ import net.osmand.plus.activities.MapActivityActions;
|
|||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
|
||||
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
|
||||
import net.osmand.plus.osmedit.OsmBugsLayer;
|
||||
import net.osmand.plus.render.MapRenderRepositories;
|
||||
import net.osmand.plus.render.NativeOsmandLibrary;
|
||||
import net.osmand.plus.routepreparationmenu.ChooseRouteFragment;
|
||||
|
@ -78,6 +83,7 @@ import java.util.Set;
|
|||
import gnu.trove.list.array.TIntArrayList;
|
||||
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_CHANGE_MARKER_POSITION;
|
||||
import static net.osmand.data.FavouritePoint.DEFAULT_BACKGROUND_TYPE;
|
||||
|
||||
public class ContextMenuLayer extends OsmandMapLayer {
|
||||
//private static final Log LOG = PlatformUtil.getLog(ContextMenuLayer.class);
|
||||
|
@ -95,10 +101,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
private ImageView contextMarker;
|
||||
private Paint paint;
|
||||
private Paint outlinePaint;
|
||||
private Bitmap pressedBitmap;
|
||||
private Bitmap pressedBitmapSmall;
|
||||
private List<LatLon> pressedLatLonFull = new ArrayList<>();
|
||||
private List<LatLon> pressedLatLonSmall = new ArrayList<>();
|
||||
private Map<LatLon, FavouritePoint.BackgroundType> pressedLatLonFull = new HashMap<>();
|
||||
private Map<LatLon, FavouritePoint.BackgroundType> pressedLatLonSmall = new HashMap<>();
|
||||
|
||||
private GestureDetector movementListener;
|
||||
|
||||
|
@ -146,8 +150,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
contextMarker.layout(0, 0, minw, minh);
|
||||
|
||||
paint = new Paint();
|
||||
pressedBitmap = BitmapFactory.decodeResource(view.getResources(), R.drawable.ic_shield_tap);
|
||||
pressedBitmapSmall = BitmapFactory.decodeResource(view.getResources(), R.drawable.ic_shield_tap_small);
|
||||
paint.setColor(0x7f000000);
|
||||
|
||||
outlinePaint = new Paint();
|
||||
outlinePaint.setStyle(Paint.Style.STROKE);
|
||||
|
@ -226,15 +229,17 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
if (!pressedLatLonSmall.isEmpty() || !pressedLatLonFull.isEmpty()) {
|
||||
scale = activity.getMyApplication().getSettings().TEXT_SCALE.get();
|
||||
}
|
||||
for (LatLon latLon : pressedLatLonSmall) {
|
||||
for (LatLon latLon : pressedLatLonSmall.keySet()) {
|
||||
int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
||||
int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
||||
Bitmap pressedBitmapSmall = getBackground(pressedLatLonSmall.get(latLon), true);
|
||||
Rect destRect = getIconDestinationRect(x, y, pressedBitmapSmall.getWidth(), pressedBitmapSmall.getHeight(), scale);
|
||||
canvas.drawBitmap(pressedBitmapSmall, null, destRect, paint);
|
||||
}
|
||||
for (LatLon latLon : pressedLatLonFull) {
|
||||
for (LatLon latLon : pressedLatLonFull.keySet()) {
|
||||
int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
||||
int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
||||
Bitmap pressedBitmap = getBackground(pressedLatLonFull.get(latLon), false);
|
||||
Rect destRect = getIconDestinationRect(x, y, pressedBitmap.getWidth(), pressedBitmap.getHeight(), scale);
|
||||
canvas.drawBitmap(pressedBitmap, null, destRect, paint);
|
||||
}
|
||||
|
@ -261,6 +266,15 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
}
|
||||
}
|
||||
|
||||
private Bitmap getBackground(FavouritePoint.BackgroundType backgroundType, boolean isSmall) {
|
||||
Context ctx = view.getContext();
|
||||
Resources res = view.getResources();
|
||||
String iconName = res.getResourceEntryName(backgroundType.getIconId());
|
||||
String suffix = isSmall ? "_small" : "";
|
||||
return BitmapFactory.decodeResource(res, res.getIdentifier("ic_" + iconName + "_center" + suffix,
|
||||
"drawable", ctx.getPackageName()));
|
||||
}
|
||||
|
||||
public void setSelectOnMap(CallbackWithObject<LatLon> selectOnMap) {
|
||||
this.selectOnMap = selectOnMap;
|
||||
}
|
||||
|
@ -884,8 +898,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
private Map<Object, IContextMenuProvider> selectObjectsForContextMenu(RotatedTileBox tileBox,
|
||||
PointF point, boolean acquireObjLatLon,
|
||||
boolean unknownLocation) {
|
||||
List<LatLon> pressedLatLonFull = new ArrayList<>();
|
||||
List<LatLon> pressedLatLonSmall = new ArrayList<>();
|
||||
Map<LatLon, FavouritePoint.BackgroundType> pressedLatLonFull = new HashMap<>();
|
||||
Map<LatLon, FavouritePoint.BackgroundType> pressedLatLonSmall = new HashMap<>();
|
||||
Map<Object, IContextMenuProvider> selectedObjects = new HashMap<>();
|
||||
List<Object> s = new ArrayList<>();
|
||||
for (OsmandMapLayer lt : view.getLayers()) {
|
||||
|
@ -897,10 +911,21 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
selectedObjects.put(o, l);
|
||||
if (acquireObjLatLon && l.isObjectClickable(o)) {
|
||||
LatLon latLon = l.getObjectLocation(o);
|
||||
if (lt.isPresentInFullObjects(latLon) && !pressedLatLonFull.contains(latLon)) {
|
||||
pressedLatLonFull.add(latLon);
|
||||
} else if (lt.isPresentInSmallObjects(latLon) && !pressedLatLonSmall.contains(latLon)) {
|
||||
pressedLatLonSmall.add(latLon);
|
||||
FavouritePoint.BackgroundType backgroundType = DEFAULT_BACKGROUND_TYPE;
|
||||
if (o instanceof OsmBugsLayer.OpenStreetNote) {
|
||||
backgroundType = FavouritePoint.BackgroundType.COMMENT;
|
||||
}
|
||||
if (o instanceof FavouritePoint) {
|
||||
backgroundType = ((FavouritePoint) o).getBackgroundType();
|
||||
}
|
||||
if (o instanceof GPXUtilities.WptPt) {
|
||||
backgroundType = FavouritePoint.BackgroundType.getByTypeName(
|
||||
((GPXUtilities.WptPt) o).getBackgroundType(), DEFAULT_BACKGROUND_TYPE);
|
||||
}
|
||||
if (lt.isPresentInFullObjects(latLon) && !pressedLatLonFull.keySet().contains(latLon)) {
|
||||
pressedLatLonFull.put(latLon, backgroundType);
|
||||
} else if (lt.isPresentInSmallObjects(latLon) && !pressedLatLonSmall.keySet().contains(latLon)) {
|
||||
pressedLatLonSmall.put(latLon, backgroundType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|