Fix finding object name

This commit is contained in:
PavelRatushny 2017-10-03 14:31:04 +03:00
parent dc664c131e
commit cd5ed4d4b0
6 changed files with 18 additions and 19 deletions

View file

@ -59,6 +59,7 @@ import static android.util.TypedValue.COMPLEX_UNIT_DIP;
public class MenuBuilder {
public static final float SHADOW_HEIGHT_TOP_DP = 17f;
public static final int TITLE_LIMIT = 60;
protected MapActivity mapActivity;
protected OsmandApplication app;
@ -285,6 +286,12 @@ public class MenuBuilder {
protected void buildTitleRow(View view) {
}
public void buildTitleRow(View view, String title) {
if (title != null && title.length() > TITLE_LIMIT) {
buildRow(view, R.drawable.ic_action_note_dark, title, 0, false, null, false, 0, false, null);
}
}
protected void buildNearestWikiRow(View view) {
if (processNearstWiki() && nearestWiki.size() > 0) {
buildRow(view, R.drawable.ic_action_wikipedia, app.getString(R.string.wiki_around) + " (" + nearestWiki.size()+")", 0,

View file

@ -58,10 +58,8 @@ public class AmenityMenuBuilder extends MenuBuilder {
@Override
protected void buildTitleRow(View view) {
String title = mapActivity.getContextMenu().getTitleStr();
if (title.length() > 60) {
buildRow(view, R.drawable.ic_action_note_dark, title, 0, false, null, false, 0, false, null);
}
String title = amenity.getName();
buildTitleRow(view, title);
}
private void buildRow(View view, int iconId, String text, String textPrefix,

View file

@ -54,10 +54,8 @@ public class FavouritePointMenuBuilder extends MenuBuilder {
@Override
protected void buildTitleRow(View view) {
String title = mapActivity.getContextMenu().getTitleStr();
if (title.length() > 60) {
buildRow(view, R.drawable.ic_action_note_dark, title, 0, false, null, false, 0, false, null);
}
String title = fav.getName();
buildTitleRow(view, title);
}
@Override

View file

@ -40,10 +40,8 @@ public class GpxItemMenuBuilder extends MenuBuilder {
@Override
protected void buildTitleRow(View view) {
String title = mapActivity.getContextMenu().getTitleStr();
if (title.length() > 60) {
buildRow(view, R.drawable.ic_action_note_dark, title, 0, false, null, false, 0, false, null);
}
String title = item.name;
buildTitleRow(view, title);
}
@Override

View file

@ -31,10 +31,8 @@ public class WptPtMenuBuilder extends MenuBuilder {
@Override
protected void buildTitleRow(View view) {
String title = mapActivity.getContextMenu().getTitleStr();
if (title.length() > 60) {
buildRow(view, R.drawable.ic_action_note_dark, title, 0, false, null, false, 0, false, null);
}
String title = wpt.name;
buildTitleRow(view, title);
}
@Override

View file

@ -27,9 +27,9 @@ public class EditPOIMenuBuilder extends MenuBuilder {
@Override
protected void buildTitleRow(View view) {
String title = mapActivity.getContextMenu().getTitleStr();
if (title.length() > 60) {
buildRow(view, R.drawable.ic_action_note_dark, title, 0, false, null, false, 0, false, null);
if (osmPoint instanceof OpenstreetmapPoint) {
String title = ((OpenstreetmapPoint) osmPoint).getName();
buildTitleRow(view, title);
}
}