Merge pull request #4514 from osmandapp/long_favourite_string
Fix #4466
This commit is contained in:
commit
8a3b849a6c
6 changed files with 30 additions and 1 deletions
|
@ -486,7 +486,7 @@
|
|||
<style name="TextAppearance.ContextMenuTitle" parent="TextAppearance.AppCompat">
|
||||
<item name="android:textColor">?android:textColorPrimary</item>
|
||||
<item name="android:textSize">@dimen/default_list_text_size_large</item>
|
||||
<item name="android:maxLines">6</item>
|
||||
<item name="android:maxLines">3</item>
|
||||
<item name="android:ellipsize">end</item>
|
||||
</style>
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ public class AudioVideoNoteMenuController extends MenuController {
|
|||
this.mRecording = recording;
|
||||
mPlugin = OsmandPlugin.getPlugin(AudioVideoNotesPlugin.class);
|
||||
mIsFileAvailable = mRecording.getFile().exists();
|
||||
builder.setShowTitleIfTruncated(false);
|
||||
|
||||
if (mIsFileAvailable) {
|
||||
leftTitleButtonController = new TitleButtonController() {
|
||||
|
|
|
@ -59,8 +59,10 @@ 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 MapContextMenu mapContextMenu;
|
||||
protected OsmandApplication app;
|
||||
protected LinkedList<PlainMenuItem> plainMenuItems;
|
||||
private boolean firstRow;
|
||||
|
@ -68,6 +70,7 @@ public class MenuBuilder {
|
|||
private long objectId;
|
||||
private LatLon latLon;
|
||||
private boolean hidden;
|
||||
private boolean showTitleIfTruncated = true;
|
||||
private boolean showNearestWiki = false;
|
||||
private boolean showOnlinePhotos = true;
|
||||
protected List<Amenity> nearestWiki = new ArrayList<>();
|
||||
|
@ -200,6 +203,10 @@ public class MenuBuilder {
|
|||
this.latLon = objectLocation;
|
||||
}
|
||||
|
||||
public void setMapContextMenu(MapContextMenu mapContextMenu) {
|
||||
this.mapContextMenu = mapContextMenu;
|
||||
}
|
||||
|
||||
public boolean isShowNearestWiki() {
|
||||
return showNearestWiki;
|
||||
}
|
||||
|
@ -208,6 +215,10 @@ public class MenuBuilder {
|
|||
this.showNearestWiki = showNearestWiki;
|
||||
}
|
||||
|
||||
public void setShowTitleIfTruncated(boolean showTitleIfTruncated) {
|
||||
this.showTitleIfTruncated = showTitleIfTruncated;
|
||||
}
|
||||
|
||||
public boolean isShowOnlinePhotos() {
|
||||
return showOnlinePhotos;
|
||||
}
|
||||
|
@ -232,6 +243,9 @@ public class MenuBuilder {
|
|||
public void build(View view) {
|
||||
firstRow = true;
|
||||
hidden = false;
|
||||
if (showTitleIfTruncated) {
|
||||
buildTitleRow(view);
|
||||
}
|
||||
buildNearestWikiRow(view);
|
||||
if (needBuildPlainMenuItems()) {
|
||||
buildPlainMenuItems(view);
|
||||
|
@ -281,6 +295,15 @@ public class MenuBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
public void buildTitleRow(View view) {
|
||||
if (mapContextMenu != null) {
|
||||
String title = mapContextMenu.getTitleStr();
|
||||
if (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,
|
||||
|
|
|
@ -121,6 +121,7 @@ public abstract class MenuController extends BaseMenuController {
|
|||
|
||||
public void setMapContextMenu(MapContextMenu mapContextMenu) {
|
||||
this.mapContextMenu = mapContextMenu;
|
||||
builder.setMapContextMenu(mapContextMenu);
|
||||
}
|
||||
|
||||
public void build(View rootView) {
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.osmand.data.FavouritePoint;
|
|||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.TransportStop;
|
||||
import net.osmand.osm.PoiCategory;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||
import net.osmand.plus.mapillary.MapillaryPlugin;
|
||||
|
|
|
@ -23,6 +23,9 @@ public class EditPOIMenuController extends MenuController {
|
|||
super(new EditPOIMenuBuilder(mapActivity, osmPoint), pointDescription, mapActivity);
|
||||
this.osmPoint = osmPoint;
|
||||
plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
|
||||
if (osmPoint instanceof OsmNotesPoint) {
|
||||
builder.setShowTitleIfTruncated(false);
|
||||
}
|
||||
|
||||
leftTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue