diff --git a/OsmAnd/res/layout/map_context_menu_fragment.xml b/OsmAnd/res/layout/map_context_menu_fragment.xml index 837a03a781..49c5bc6e32 100644 --- a/OsmAnd/res/layout/map_context_menu_fragment.xml +++ b/OsmAnd/res/layout/map_context_menu_fragment.xml @@ -174,6 +174,38 @@ android:paddingEnd="@dimen/context_menu_padding_margin_default" android:paddingTop="3dp"> + + + + + + + + + + - - - - - - - diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index a554d06a4d..226216be06 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -1473,7 +1473,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL return menuController != null && menuController.displayDistanceDirection(); } - public String getSubtypeStr() { + public CharSequence getSubtypeStr() { MenuController menuController = getMenuController(); if (menuController != null) { return menuController.getSubtypeStr(); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index 5721885ab6..44748e36bb 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -1835,7 +1835,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo } TextView line3 = (TextView) view.findViewById(R.id.context_menu_line3); - String subtypeStr = menu.getSubtypeStr(); + CharSequence subtypeStr = menu.getSubtypeStr(); if (TextUtils.isEmpty(subtypeStr)) { line3.setVisibility(View.GONE); } else { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java index 23f9393f22..55fc56b3b8 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java @@ -534,7 +534,7 @@ public abstract class MenuController extends BaseMenuController implements Colla } @NonNull - public String getSubtypeStr() { + public CharSequence getSubtypeStr() { return ""; } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AMapPointMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AMapPointMenuController.java index 73a43404a7..93c46908aa 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AMapPointMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AMapPointMenuController.java @@ -148,7 +148,7 @@ public class AMapPointMenuController extends MenuController { @NonNull @Override - public String getSubtypeStr() { + public CharSequence getSubtypeStr() { MapActivity activity = getMapActivity(); if (activity != null) { float bearing = getPointBearing(); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java index 65a7fa469e..d8459a2ca0 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java @@ -1,6 +1,8 @@ package net.osmand.plus.mapcontextmenu.controllers; +import android.graphics.Typeface; import android.graphics.drawable.Drawable; +import android.text.SpannableString; import androidx.annotation.NonNull; import androidx.core.content.ContextCompat; @@ -18,14 +20,15 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.PointImageDrawable; +import net.osmand.plus.helpers.FontCache; import net.osmand.plus.mapcontextmenu.MenuController; import net.osmand.plus.mapcontextmenu.builders.FavouritePointMenuBuilder; import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditor; import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragment; import net.osmand.plus.mapcontextmenu.editors.FavoritePointEditorFragmentNew; import net.osmand.plus.transport.TransportStopRoute; +import net.osmand.plus.widgets.style.CustomTypefaceSpan; import net.osmand.util.OpeningHoursParser; -import net.osmand.view.GravityDrawable; import java.util.List; @@ -155,8 +158,12 @@ public class FavouritePointMenuController extends MenuController { @NonNull @Override - public String getSubtypeStr() { - return fav.getAddress(); + public CharSequence getSubtypeStr() { + Typeface typeface = FontCache.getRobotoRegular(getMapActivity()); + SpannableString addressSpannable = new SpannableString(fav.getAddress()); + addressSpannable.setSpan(new CustomTypefaceSpan(typeface), 0, addressSpannable.length(), 0); + + return addressSpannable; } @Override @@ -167,10 +174,8 @@ public class FavouritePointMenuController extends MenuController { FavouritesDbHelper helper = app.getFavorites(); String group = fav.getCategory(); if (helper.getGroup(group) != null) { - Drawable line2icon = helper.getColoredIconForGroup(group); - GravityDrawable gravityIcon = new GravityDrawable(line2icon); - gravityIcon.setBoundsFrom(line2icon); - return gravityIcon; + int colorId = R.color.color_favorite; + return getIcon(R.drawable.ic_action_group_name_16, colorId); } else { int colorId = isLight() ? R.color.icon_color_default_light : R.color.ctx_menu_bottom_view_icon_dark; return getIcon(R.drawable.ic_action_group_name_16, colorId); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java index 813aa9a0de..918afaae29 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/PointEditorFragmentNew.java @@ -268,6 +268,8 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment { } } }); + AndroidUiHelper.updateVisibility(addressCaption, false); + addAddressBtn.setText(getAddressInitValue()); addAddressBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -279,7 +281,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment { AndroidUtils.softKeyboardDelayed(requireActivity(),addressEdit); } else { addressCaption.setVisibility(View.GONE); - addAddressBtn.setText(view.getResources().getString(R.string.add_address)); + addAddressBtn.setText(getAddressTextValue()); AndroidUtils.hideSoftKeyboard(requireActivity(), addressEdit); addressEdit.clearFocus(); } @@ -388,13 +390,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment { descriptionCaption.setVisibility(View.GONE); addDelDescription.setText(app.getString(R.string.add_description)); } - if (!addressEdit.getText().toString().isEmpty() || addressEdit.hasFocus()) { - addressCaption.setVisibility(View.VISIBLE); - addAddressBtn.setText(app.getString(R.string.delete_address)); - } else { - addressCaption.setVisibility(View.GONE); - addAddressBtn.setText(app.getString(R.string.add_address)); - } + } private void createGroupSelector() {