From 48010fa99f13d000015ad8bac10eafdf14f2bd30 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 12 Jan 2018 11:51:33 +0200 Subject: [PATCH 01/11] Change button icon color on tap in wikipedia context menu --- .../plus/mapcontextmenu/builders/AmenityMenuBuilder.java | 7 +++++-- .../mapcontextmenu/controllers/AmenityMenuController.java | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java index ce158b58b1..6fec9e2f51 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java @@ -234,8 +234,11 @@ public class AmenityMenuBuilder extends MenuBuilder { }); button.setAllCaps(true); button.setText(R.string.context_menu_read_full_article); - Drawable compoundDrawable = app.getIconsCache().getIcon(R.drawable.ic_action_read_text, light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n); - button.setCompoundDrawablesWithIntrinsicBounds(compoundDrawable, null, null, null); + Drawable normal = app.getIconsCache().getIcon(R.drawable.ic_action_read_text, + light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n); + Drawable pressed = app.getIconsCache().getIcon(R.drawable.ic_action_read_text, + light ? R.color.ctx_menu_controller_button_text_color_light_p : R.color.ctx_menu_controller_button_text_color_dark_p); + button.setCompoundDrawablesWithIntrinsicBounds(AndroidUtils.createStateListDrawable(normal, pressed), null, null, null); button.setCompoundDrawablePadding(dpToPx(8f)); llText.addView(button); } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java index ec3460ba28..1fdef001f4 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java @@ -73,7 +73,7 @@ public class AmenityMenuController extends MenuController { } }; leftTitleButtonController.caption = getMapActivity().getString(R.string.context_menu_read_article); - leftTitleButtonController.leftIcon = getIcon(R.drawable.ic_action_read_text, isLight() ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n); + leftTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_read_text, true); } openingHoursInfo = processOpeningHours(amenity); From 45aafbf88479c561da6be7cd2494f5e8d1eb6a9c Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 12 Jan 2018 12:13:42 +0200 Subject: [PATCH 02/11] Change button icon color on tap in osm bug context menu --- OsmAnd/src/net/osmand/plus/osmedit/OsmBugMenuController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugMenuController.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugMenuController.java index 02df976545..c97d9354c8 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugMenuController.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugMenuController.java @@ -39,7 +39,7 @@ public class OsmBugMenuController extends MenuController { } else { leftTitleButtonController.caption = getMapActivity().getString(R.string.poi_dialog_reopen); } - leftTitleButtonController.leftIconId = R.drawable.ic_action_note_dark; + leftTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_note_dark, true); rightTitleButtonController = new TitleButtonController() { @Override @@ -50,7 +50,7 @@ public class OsmBugMenuController extends MenuController { } }; rightTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_close); - rightTitleButtonController.leftIconId = R.drawable.ic_action_remove_dark; + rightTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_remove_dark, true); updateData(); } From 62607944eea171b51517e8c68d990e7453213b7a Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 12 Jan 2018 12:26:18 +0200 Subject: [PATCH 03/11] Fix NPE --- OsmAnd/res/layout-land/menu_obj_selection_fragment.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/res/layout-land/menu_obj_selection_fragment.xml b/OsmAnd/res/layout-land/menu_obj_selection_fragment.xml index 600e297f8c..5102244cbd 100644 --- a/OsmAnd/res/layout-land/menu_obj_selection_fragment.xml +++ b/OsmAnd/res/layout-land/menu_obj_selection_fragment.xml @@ -26,6 +26,7 @@ android:dividerHeight="0dp"/> From a69e44a7c158e065aaf2d1728728b642136a8f06 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 12 Jan 2018 15:07:56 +0200 Subject: [PATCH 04/11] Change button icon color on tap in map data context menu --- .../net/osmand/plus/mapcontextmenu/MenuController.java | 10 ++++++++++ .../controllers/MapDataMenuController.java | 10 +++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java index 385b600190..4bda4d120e 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java @@ -583,6 +583,16 @@ public abstract class MenuController extends BaseMenuController { return null; } + public void clearIcon(boolean left) { + if (left) { + leftIcon = null; + leftIconId = 0; + } else { + rightIcon = null; + rightIconId = 0; + } + } + public void updateStateListDrawableIcon(@DrawableRes int resId, boolean left) { if (left) { leftIcon = enabled ? getStateListDrawable(resId) : null; diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java index a0735a80b2..c46251e66c 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java @@ -115,7 +115,7 @@ public class MapDataMenuController extends MenuController { } }; leftDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_download); - leftDownloadButtonController.leftIconId = R.drawable.ic_action_import; + leftDownloadButtonController.updateStateListDrawableIcon(R.drawable.ic_action_import, true); rightDownloadButtonController = new TitleButtonController() { @Override @@ -142,7 +142,7 @@ public class MapDataMenuController extends MenuController { } }; rightDownloadButtonController.caption = getMapActivity().getString(R.string.download_select_map_types); - rightDownloadButtonController.leftIconId = R.drawable.ic_plugin_srtm; + rightDownloadButtonController.updateStateListDrawableIcon(R.drawable.ic_plugin_srtm, true); bottomTitleButtonController = new TitleButtonController() { @Override @@ -159,7 +159,7 @@ public class MapDataMenuController extends MenuController { } }; bottomTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_delete); - bottomTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark; + bottomTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_delete_dark, true); titleProgressController = new TitleProgressController() { @Override @@ -367,7 +367,7 @@ public class MapDataMenuController extends MenuController { } leftDownloadButtonController.visible = true; - leftDownloadButtonController.leftIconId = R.drawable.ic_action_import; + leftDownloadButtonController.updateStateListDrawableIcon(R.drawable.ic_action_import, true); if (backuped) { leftDownloadButtonController.caption = getMapActivity().getString(R.string.local_index_mi_restore); } else if (indexItem != null) { @@ -375,7 +375,7 @@ public class MapDataMenuController extends MenuController { || indexItem.getType() == DownloadActivityType.HILLSHADE_FILE) && srtmDisabled) { leftDownloadButtonController.caption = getMapActivity().getString(R.string.get_plugin); - leftDownloadButtonController.leftIconId = 0; + leftDownloadButtonController.clearIcon(true); } else if (indexItem.isOutdated()) { leftDownloadButtonController.caption = getMapActivity().getString(R.string.shared_string_update); } else if (!downloaded) { From c4325392098058b88bf5f6c39eabccc34eea53ab Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 12 Jan 2018 15:14:16 +0200 Subject: [PATCH 05/11] Fix additional options menu width in landscape --- .../AdditionalActionsBottomSheetDialogFragment.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/AdditionalActionsBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/AdditionalActionsBottomSheetDialogFragment.java index 4af9abc7c7..cd5da18e10 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/AdditionalActionsBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/AdditionalActionsBottomSheetDialogFragment.java @@ -140,7 +140,8 @@ public class AdditionalActionsBottomSheetDialogFragment extends net.osmand.plus. if (!portrait) { final Window window = getDialog().getWindow(); WindowManager.LayoutParams params = window.getAttributes(); - params.width = getActivity().getResources().getDimensionPixelSize(R.dimen.landscape_bottom_sheet_dialog_fragment_width); + params.width = getResources().getDimensionPixelSize(R.dimen.landscape_bottom_sheet_dialog_fragment_width) + + AndroidUtils.dpToPx(getContext(), 16); // 8 dp is shadow width on each side window.setAttributes(params); } } From dafdc3d9d28ceb39b1168774df9868ead89c5cb2 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 12 Jan 2018 16:47:29 +0200 Subject: [PATCH 06/11] Change button icon color on tap in osm edits context menu --- .../src/net/osmand/plus/osmedit/EditPOIMenuController.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java index 4808a06256..0daa3cbb6a 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java @@ -1,7 +1,6 @@ package net.osmand.plus.osmedit; import android.content.DialogInterface; -import android.graphics.drawable.Drawable; import android.support.v7.app.AlertDialog; import net.osmand.data.PointDescription; @@ -43,7 +42,7 @@ public class EditPOIMenuController extends MenuController { } }; leftTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_upload); - leftTitleButtonController.leftIconId = R.drawable.ic_action_export; + leftTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_export, true); rightTitleButtonController = new TitleButtonController() { @Override @@ -73,7 +72,7 @@ public class EditPOIMenuController extends MenuController { } }; rightTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_delete); - rightTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark; + rightTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_delete_dark, true); category = getCategory(); From f12e9f7d311bffebb76a7b3b339dbe0b5edb9a7a Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Fri, 12 Jan 2018 16:52:33 +0200 Subject: [PATCH 07/11] Change button icon color on tap in parking context menu --- .../plus/parkingpoint/ParkingPositionMenuController.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionMenuController.java b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionMenuController.java index 61badd42bb..4d1351c1ec 100644 --- a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionMenuController.java +++ b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionMenuController.java @@ -1,7 +1,6 @@ package net.osmand.plus.parkingpoint; import android.graphics.drawable.Drawable; -import android.text.TextUtils; import net.osmand.data.PointDescription; import net.osmand.plus.OsmandPlugin; @@ -32,7 +31,7 @@ public class ParkingPositionMenuController extends MenuController { } }; leftTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_delete); - leftTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark; + leftTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_delete_dark, true); } private void buildParkingDescription(MapActivity mapActivity) { From c45e8b0162d8a0bbbd3a17778e9e2ebdf256da1f Mon Sep 17 00:00:00 2001 From: PavelRatushnyi Date: Fri, 12 Jan 2018 17:52:28 +0200 Subject: [PATCH 08/11] Fix NPE in osm point category --- OsmAnd/res/values/strings.xml | 1 + .../osmand/plus/osmedit/EditPOIMenuController.java | 8 +------- .../net/osmand/plus/osmedit/OsmEditingPlugin.java | 13 +++++++++++++ .../net/osmand/plus/osmedit/OsmEditsAdapter.java | 14 +------------- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 2780b25267..d4552f4772 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -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 --> + Without name What\'s here: parked at Pick up until diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java index 4808a06256..15327f3b8e 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java @@ -196,12 +196,6 @@ public class EditPOIMenuController extends MenuController { } private String getCategory() { - String category = ""; - if (osmPoint.getGroup() == OsmPoint.Group.POI) { - category = ((OpenstreetmapPoint) osmPoint).getEntity().getTag(EditPoiData.POI_TYPE_TAG); - } else if (osmPoint.getGroup() == OsmPoint.Group.BUG) { - category = getMapActivity().getString(R.string.osn_bug_name); - } - return category; + return OsmEditingPlugin.getCategory(osmPoint, getMapActivity()); } } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java index 7c3aa390ab..4c63bcb5cf 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java @@ -445,6 +445,19 @@ public class OsmEditingPlugin extends OsmandPlugin { } } + public static String getCategory(OsmPoint osmPoint, Context context) { + String category = ""; + if (osmPoint.getGroup() == OsmPoint.Group.POI) { + category = ((OpenstreetmapPoint) osmPoint).getEntity().getTag(EditPoiData.POI_TYPE_TAG); + if (Algorithms.isEmpty(category)) { + category = context.getString(R.string.shared_string_without_name); + } + } else if (osmPoint.getGroup() == OsmPoint.Group.BUG) { + category = context.getString(R.string.osn_bug_name); + } + return category; + } + public static String getPrefix(OsmPoint osmPoint) { return (osmPoint.getGroup() == OsmPoint.Group.POI ? "POI" : "Bug") + " id: " + osmPoint.getId() + " "; } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java index 1a88db662c..450a9ce993 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java @@ -301,11 +301,7 @@ public class OsmEditsAdapter extends ArrayAdapter { } private String getCategory(OsmPoint point) { - String category = ""; - if (point.getGroup() == OsmPoint.Group.POI) { - category = ((OpenstreetmapPoint) point).getEntity().getTag(EditPoiData.POI_TYPE_TAG); - } - return category; + return OsmEditingPlugin.getCategory(point, getContext()); } private String getDescription(OsmPoint point) { @@ -322,20 +318,12 @@ public class OsmEditsAdapter extends ArrayAdapter { String category = getCategory(point); - String comment = ""; - if (point.getGroup() == OsmPoint.Group.BUG) { - comment = getContext().getString(R.string.osn_bug_name); - } - String prefix = OsmEditingPlugin.getPrefix(point); String description = ""; if (!Algorithms.isEmpty(action)) { description += action + " • "; } - if (!Algorithms.isEmpty(comment)) { - description += comment + " • "; - } if (!Algorithms.isEmpty(category)) { description += category + " • "; } From 7c06a00ed0ba36255bc7fec6e6d24272dab2946b Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Fri, 12 Jan 2018 19:30:37 +0300 Subject: [PATCH 09/11] Fix #4776 --- OsmAnd/src/net/osmand/plus/mapillary/MapillaryVectorLayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryVectorLayer.java b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryVectorLayer.java index 2fb5cf0407..abc928ba8b 100644 --- a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryVectorLayer.java +++ b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryVectorLayer.java @@ -199,7 +199,7 @@ class MapillaryVectorLayer extends MapTileLayer implements MapillaryLayer, ICont } String userKey = settings.MAPILLARY_FILTER_USER_KEY.get(); HashMap userData = (HashMap) data; - long capturedAt = (long) userData.get("captured_at"); + long capturedAt = ((Number) userData.get("captured_at")).longValue(); long from = settings.MAPILLARY_FILTER_FROM_DATE.get(); long to = settings.MAPILLARY_FILTER_TO_DATE.get(); From 98e97c8c8f092fdc1ef553b474ef22f6d2d83f22 Mon Sep 17 00:00:00 2001 From: PavelRatushnyi Date: Fri, 12 Jan 2018 23:52:52 +0200 Subject: [PATCH 10/11] Fix osm point category --- .../osmand/plus/osmedit/EditPOIMenuController.java | 6 +++++- .../net/osmand/plus/osmedit/OsmEditingPlugin.java | 13 ------------- .../net/osmand/plus/osmedit/OsmEditsAdapter.java | 13 +++++++++++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java index 7d0d3b90e2..3d6422991e 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java @@ -195,6 +195,10 @@ public class EditPOIMenuController extends MenuController { } private String getCategory() { - return OsmEditingPlugin.getCategory(osmPoint, getMapActivity()); + String category = ((OpenstreetmapPoint) osmPoint).getEntity().getTag(EditPoiData.POI_TYPE_TAG); + if (Algorithms.isEmpty(category)) { + category = getMapActivity().getString(R.string.shared_string_without_name); + } + return category; } } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java index 4c63bcb5cf..7c3aa390ab 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java @@ -445,19 +445,6 @@ public class OsmEditingPlugin extends OsmandPlugin { } } - public static String getCategory(OsmPoint osmPoint, Context context) { - String category = ""; - if (osmPoint.getGroup() == OsmPoint.Group.POI) { - category = ((OpenstreetmapPoint) osmPoint).getEntity().getTag(EditPoiData.POI_TYPE_TAG); - if (Algorithms.isEmpty(category)) { - category = context.getString(R.string.shared_string_without_name); - } - } else if (osmPoint.getGroup() == OsmPoint.Group.BUG) { - category = context.getString(R.string.osn_bug_name); - } - return category; - } - public static String getPrefix(OsmPoint osmPoint) { return (osmPoint.getGroup() == OsmPoint.Group.POI ? "POI" : "Bug") + " id: " + osmPoint.getId() + " "; } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java index 450a9ce993..a2318d9ede 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java @@ -300,8 +300,17 @@ public class OsmEditsAdapter extends ArrayAdapter { return true; } - private String getCategory(OsmPoint point) { - return OsmEditingPlugin.getCategory(point, getContext()); + private String getCategory(OsmPoint osmPoint) { + String category = ""; + if (osmPoint.getGroup() == OsmPoint.Group.POI) { + category = ((OpenstreetmapPoint) osmPoint).getEntity().getTag(EditPoiData.POI_TYPE_TAG); + if (Algorithms.isEmpty(category)) { + category = getContext().getString(R.string.shared_string_without_name); + } + } else if (osmPoint.getGroup() == OsmPoint.Group.BUG) { + category = getContext().getString(R.string.osn_bug_name); + } + return category; } private String getDescription(OsmPoint point) { From 20acdf9193855e59b0896d1596b7b891e442805f Mon Sep 17 00:00:00 2001 From: PavelRatushnyi Date: Fri, 12 Jan 2018 23:53:58 +0200 Subject: [PATCH 11/11] Revert --- .../osmand/plus/osmedit/EditPOIMenuController.java | 6 +----- .../net/osmand/plus/osmedit/OsmEditingPlugin.java | 13 +++++++++++++ .../net/osmand/plus/osmedit/OsmEditsAdapter.java | 13 ++----------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java index 3d6422991e..7d0d3b90e2 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuController.java @@ -195,10 +195,6 @@ public class EditPOIMenuController extends MenuController { } private String getCategory() { - String category = ((OpenstreetmapPoint) osmPoint).getEntity().getTag(EditPoiData.POI_TYPE_TAG); - if (Algorithms.isEmpty(category)) { - category = getMapActivity().getString(R.string.shared_string_without_name); - } - return category; + return OsmEditingPlugin.getCategory(osmPoint, getMapActivity()); } } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java index 7c3aa390ab..4c63bcb5cf 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java @@ -445,6 +445,19 @@ public class OsmEditingPlugin extends OsmandPlugin { } } + public static String getCategory(OsmPoint osmPoint, Context context) { + String category = ""; + if (osmPoint.getGroup() == OsmPoint.Group.POI) { + category = ((OpenstreetmapPoint) osmPoint).getEntity().getTag(EditPoiData.POI_TYPE_TAG); + if (Algorithms.isEmpty(category)) { + category = context.getString(R.string.shared_string_without_name); + } + } else if (osmPoint.getGroup() == OsmPoint.Group.BUG) { + category = context.getString(R.string.osn_bug_name); + } + return category; + } + public static String getPrefix(OsmPoint osmPoint) { return (osmPoint.getGroup() == OsmPoint.Group.POI ? "POI" : "Bug") + " id: " + osmPoint.getId() + " "; } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java index a2318d9ede..450a9ce993 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java @@ -300,17 +300,8 @@ public class OsmEditsAdapter extends ArrayAdapter { return true; } - private String getCategory(OsmPoint osmPoint) { - String category = ""; - if (osmPoint.getGroup() == OsmPoint.Group.POI) { - category = ((OpenstreetmapPoint) osmPoint).getEntity().getTag(EditPoiData.POI_TYPE_TAG); - if (Algorithms.isEmpty(category)) { - category = getContext().getString(R.string.shared_string_without_name); - } - } else if (osmPoint.getGroup() == OsmPoint.Group.BUG) { - category = getContext().getString(R.string.osn_bug_name); - } - return category; + private String getCategory(OsmPoint point) { + return OsmEditingPlugin.getCategory(point, getContext()); } private String getDescription(OsmPoint point) {