From 2d872af5f15c796b1f3e80cbb1512ed02554a367 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Wed, 1 Jul 2020 15:19:37 +0300 Subject: [PATCH] Fix OSM Note UI --- .../osmand/plus/osmedit/AddOSMBugAction.java | 3 +-- .../plus/osmedit/EditPOIMenuController.java | 2 +- ...xportOptionsBottomSheetDialogFragment.java | 2 +- .../plus/osmedit/OsmBugMenuController.java | 4 ++-- .../osmand/plus/osmedit/OsmEditingPlugin.java | 4 ++-- .../osmand/plus/osmedit/OsmEditsAdapter.java | 2 +- .../osmand/plus/osmedit/OsmEditsFragment.java | 2 +- .../osmand/plus/osmedit/OsmEditsLayer.java | 21 ++++++++++++------- .../net/osmand/plus/osmedit/OsmNotesMenu.java | 2 +- .../plus/osmedit/ShowHideOSMBugAction.java | 2 +- 10 files changed, 25 insertions(+), 19 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/AddOSMBugAction.java b/OsmAnd/src/net/osmand/plus/osmedit/AddOSMBugAction.java index c6c04d0462..3d59d2aad1 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/AddOSMBugAction.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/AddOSMBugAction.java @@ -11,7 +11,6 @@ import net.osmand.data.LatLon; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; -import net.osmand.plus.osmedit.OsmEditingPlugin; import net.osmand.plus.quickaction.QuickAction; import net.osmand.plus.quickaction.QuickActionType; @@ -23,7 +22,7 @@ public class AddOSMBugAction extends QuickAction { public static final QuickActionType TYPE = new QuickActionType(12, "osmbug.add", AddOSMBugAction.class). - nameRes(R.string.quick_action_add_osm_bug).iconRes(R.drawable.ic_action_bug_dark). + nameRes(R.string.quick_action_add_osm_bug).iconRes(R.drawable.ic_action_osm_note_add). category(QuickActionType.CREATE_CATEGORY); public AddOSMBugAction() { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java index 2511dafdf2..2ef7632e19 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java @@ -182,7 +182,7 @@ public class EditPOIMenuController extends MenuController { } return iconResId; } else if (osmPoint.getGroup() == OsmPoint.Group.BUG) { - return R.drawable.ic_action_bug_dark; + return R.drawable.ic_action_osm_note_add; } else { return 0; } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/ExportOptionsBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/ExportOptionsBottomSheetDialogFragment.java index 92a65f8e01..0b1086bfc5 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/ExportOptionsBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/ExportOptionsBottomSheetDialogFragment.java @@ -58,7 +58,7 @@ public class ExportOptionsBottomSheetDialogFragment extends MenuBottomSheetDialo BaseBottomSheetItem osmNotesItem = new BottomSheetItemWithDescription.Builder() .setDescription(String.valueOf(osmNotesCount)) - .setIcon(getContentIcon(R.drawable.ic_action_bug_dark)) + .setIcon(getContentIcon(R.drawable.ic_action_osm_note)) .setTitle(getString(R.string.osm_notes)) .setLayoutId(R.layout.bottom_sheet_item_with_right_descr) .setDisabled(!(osmNotesCount > 0)) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugMenuController.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugMenuController.java index 97ffee1b2f..7e04e09c35 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugMenuController.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugMenuController.java @@ -79,9 +79,9 @@ public class OsmBugMenuController extends MenuController { @Override public Drawable getRightIcon() { if (bug.isOpened()) { - return getIcon(R.drawable.ic_action_info_dark, R.color.osm_bug_unresolved_icon_color); + return getIcon(R.drawable.ic_action_osm_note_unresolved, R.color.osm_bug_unresolved_icon_color); } else { - return getIcon(R.drawable.ic_action_info_dark, R.color.osm_bug_resolved_icon_color); + return getIcon(R.drawable.ic_action_osm_note_resolved, R.color.osm_bug_resolved_icon_color); } } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java index 157188fbb1..00ea982116 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java @@ -295,7 +295,7 @@ public class OsmEditingPlugin extends OsmandPlugin { } else { adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.context_menu_item_open_note, mapActivity) .setId(MAP_CONTEXT_MENU_OPEN_OSM_NOTE) - .setIcon(R.drawable.ic_action_bug_dark) + .setIcon(R.drawable.ic_action_osm_note_add) .setOrder(OPEN_OSM_NOTE_ITEM_ORDER) .setListener(listener) .createItem()); @@ -337,7 +337,7 @@ public class OsmEditingPlugin extends OsmandPlugin { .setId(OSM_NOTES) .setTitleId(R.string.layer_osm_bugs, mapActivity) .setSelected(settings.SHOW_OSM_BUGS.get()) - .setIcon(R.drawable.ic_action_bug_dark) + .setIcon(R.drawable.ic_action_osm_note) .setColor(settings.SHOW_OSM_BUGS.get() ? R.color.osmand_orange : ContextMenuItem.INVALID_ID) .setSecondaryIcon(R.drawable.ic_action_additional_option) .setListener(new ContextMenuAdapter.OnRowItemClick() { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java index e13629eb52..23815a8ebf 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java @@ -287,7 +287,7 @@ public class OsmEditsAdapter extends ArrayAdapter { } return app.getUIUtilities().getIcon(iconResId, colorResId); } else if (point.getGroup() == OsmPoint.Group.BUG) { - return app.getUIUtilities().getIcon(R.drawable.ic_action_bug_dark, R.color.color_distance); + return app.getUIUtilities().getIcon(R.drawable.ic_action_osm_note, R.color.color_distance); } return null; } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java index b76cd47f8d..19316d3b1b 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java @@ -123,7 +123,7 @@ public class OsmEditsFragment extends OsmAndListFragment implements SendPoiDialo if (child.getGroup() == Group.POI) { icon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_info_dark, R.color.color_distance)); } else if (child.getGroup() == Group.BUG) { - icon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_bug_dark, R.color.color_distance)); + icon.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_osm_note, R.color.color_distance)); } TextView descr = (TextView) v.findViewById(R.id.description); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java index 59b172b500..d67ae86b83 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java @@ -9,6 +9,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.content.ContextCompat; +import net.osmand.data.FavouritePoint.BackgroundType; import net.osmand.data.LatLon; import net.osmand.data.PointDescription; import net.osmand.data.RotatedTileBox; @@ -26,6 +27,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import static net.osmand.data.FavouritePoint.DEFAULT_BACKGROUND_TYPE; + public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider, ContextMenuLayer.IMoveObjectProvider { private static final int startZoom = 10; @@ -79,17 +82,21 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC } } - private void drawPoint(Canvas canvas, OsmPoint o, float x, float y) { + private void drawPoint(Canvas canvas, OsmPoint osmPoint, float x, float y) { float textScale = activity.getMyApplication().getSettings().TEXT_SCALE.get(); - int iconId = getIconId(o); + int iconId = getIconId(osmPoint); + BackgroundType backgroundType = DEFAULT_BACKGROUND_TYPE; + if (osmPoint.getGroup() == OsmPoint.Group.BUG) { + backgroundType = BackgroundType.COMMENT; + } PointImageDrawable pointImageDrawable = PointImageDrawable.getOrCreate(activity, - ContextCompat.getColor(activity, R.color.created_poi_icon_color), true, - iconId); + ContextCompat.getColor(activity, R.color.created_poi_icon_color), true, false, + iconId, backgroundType); pointImageDrawable.setAlpha(0.8f); - pointImageDrawable.drawPoint(canvas, x, y, textScale, false); + int offsetY = backgroundType.getOffsetY(activity, textScale); + pointImageDrawable.drawPoint(canvas, x, y - offsetY, textScale, false); } - public int getIconId(OsmPoint osmPoint) { if (osmPoint.getGroup() == OsmPoint.Group.POI) { OpenstreetmapPoint osmP = (OpenstreetmapPoint) osmPoint; @@ -115,7 +122,7 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC } return iconResId; } else if (osmPoint.getGroup() == OsmPoint.Group.BUG) { - return R.drawable.ic_action_bug_dark; + return R.drawable.mm_special_symbol_plus; } else { return 0; } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java index 65a2dfe3ee..80fa80a7f0 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java @@ -109,7 +109,7 @@ public class OsmNotesMenu { adapter.addItem(new ContextMenuItem.ItemBuilder() .setTitleId(osmNotesStringId, mapActivity) .setDescription(mapActivity.getString(R.string.switch_osm_notes_visibility_desc)) - .setIcon(R.drawable.ic_action_bug_dark) + .setIcon(R.drawable.ic_action_osm_note) .setColor(toggleIconColorId) .setListener(l) .setSelected(showOsmBugs) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/ShowHideOSMBugAction.java b/OsmAnd/src/net/osmand/plus/osmedit/ShowHideOSMBugAction.java index 59145ad41f..39082ea6e9 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/ShowHideOSMBugAction.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/ShowHideOSMBugAction.java @@ -16,7 +16,7 @@ public class ShowHideOSMBugAction extends QuickAction { public static final QuickActionType TYPE = new QuickActionType(24, "osmbug.showhide", ShowHideOSMBugAction.class). - nameRes(R.string.quick_action_showhide_osmbugs_title).iconRes(R.drawable.ic_action_bug_dark).nonEditable(). + nameRes(R.string.quick_action_showhide_osmbugs_title).iconRes(R.drawable.ic_action_osm_note).nonEditable(). category(QuickActionType.CONFIGURE_MAP);