street str refactoring

This commit is contained in:
simon 2020-08-17 13:39:53 +03:00
parent 58bf6d35f6
commit e19935563a
3 changed files with 10 additions and 13 deletions

View file

@ -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(", ");

View file

@ -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);

View file

@ -89,11 +89,7 @@ public class MultiSelectionArrayAdapter extends ArrayAdapter<MapMultiSelectionMe
TextView line2 = (TextView) convertView.findViewById(R.id.context_menu_line2);
((TextView) line2).setTextColor(ContextCompat.getColor(getContext(), R.color.ctx_menu_subtitle_color));
StringBuilder line2Str = new StringBuilder(item.getTypeStr());
String streetStr = "";
if (item.getPointDescription().isFavorite() &&
item.getObject() instanceof FavouritePoint){
streetStr = ((FavouritePoint)item.getObject()).getAddress();
}
String streetStr = item.getStreetStr();
if (!Algorithms.isEmpty(streetStr) && !item.displayStreetNameInTitle()) {
if (line2Str.length() > 0) {
line2Str.append(", ");