From e19935563ac7e051525eb5ce39528d8f65d82c6a Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 17 Aug 2020 13:39:53 +0300 Subject: [PATCH] street str refactoring --- .../plus/mapcontextmenu/MapContextMenuFragment.java | 11 +++-------- .../controllers/FavouritePointMenuController.java | 6 ++++++ .../other/MultiSelectionArrayAdapter.java | 6 +----- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index ff38d8441c..1fb45a0c88 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -1804,12 +1804,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo private void setAddressLocation() { if (view != null) { // Text line 1 - TextView line1 = (TextView) view.findViewById(R.id.context_menu_line1); + TextView line1 = view.findViewById(R.id.context_menu_line1); line1.setText(menu.getTitleStr()); toolbarTextView.setText(menu.getTitleStr()); // Text line 2 - LinearLayout line2layout = (LinearLayout) view.findViewById(R.id.context_menu_line2_layout); - TextView line2 = (TextView) view.findViewById(R.id.context_menu_line2); + LinearLayout line2layout = view.findViewById(R.id.context_menu_line2_layout); + TextView line2 = view.findViewById(R.id.context_menu_line2); if (menu.hasCustomAddressLine()) { line2layout.removeAllViews(); menu.buildCustomAddressLine(line2layout); @@ -1819,7 +1819,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo StringBuilder line2Str = new StringBuilder(); if (!Algorithms.isEmpty(typeStr)) { line2Str.append(typeStr); - Drawable icon = menu.getTypeIcon(); if (icon != null){ GravityDrawable gravityIcon = new GravityDrawable(icon); @@ -1840,10 +1839,6 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo } line2.setCompoundDrawablePadding(dpToPx(5f)); } - if (menu.getPointDescription().isFavorite() && - menu.getObject() instanceof FavouritePoint){ - streetStr = ((FavouritePoint)menu.getObject()).getAddress(); - } if (!Algorithms.isEmpty(streetStr) && !menu.displayStreetNameInTitle()) { if (line2Str.length() > 0) { line2Str.append(", "); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java index 7dea6105ef..ca01bf246e 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java @@ -150,6 +150,12 @@ public class FavouritePointMenuController extends MenuController { } } + @NonNull + @Override + public String getSubtypeStr() { + return fav.getAddress(); + } + @Override public Drawable getSecondLineTypeIcon() { return getIcon(R.drawable.ic_action_group_name_16, isLight() ? R.color.icon_color_default_light : R.color.ctx_menu_bottom_view_icon_dark); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MultiSelectionArrayAdapter.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MultiSelectionArrayAdapter.java index 36262e2fb8..299a23f95a 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MultiSelectionArrayAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MultiSelectionArrayAdapter.java @@ -89,11 +89,7 @@ public class MultiSelectionArrayAdapter extends ArrayAdapter 0) { line2Str.append(", ");