diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/WptPtMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/WptPtMenuBuilder.java index 015bc184cd..7fae86a6dd 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/WptPtMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/WptPtMenuBuilder.java @@ -146,11 +146,11 @@ public class WptPtMenuBuilder extends MenuBuilder { List points = gpxFile.getPoints(); String selectedCategory = selectedPoint != null && selectedPoint.category != null ? selectedPoint.category : ""; - int showedCount = 0; + int showCount = 0; for (final WptPt point : points) { String currentCategory = point != null ? point.category : null; if (selectedCategory.equals(currentCategory)) { - showedCount++; + showCount++; boolean selected = selectedPoint != null && selectedPoint.equals(point); TextViewEx button = buildButtonInCollapsableView(context, selected, false); button.setText(point.name); @@ -168,7 +168,7 @@ public class WptPtMenuBuilder extends MenuBuilder { } view.addView(button); } - if (showedCount >= 10) { + if (showCount >= 10) { break; } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java index 7acf43b184..6bcf70484a 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java @@ -153,8 +153,8 @@ public class WptPtMenuController extends MenuController { Map extensions = metadata != null ? metadata.getExtensionsToRead() : null; String metadataDesc = extensions != null ? metadata.getExtensionsToRead().get("desc") : null; if (metadataDesc != null && metadataDesc.contains("wikivoyage.org/")) { - return new WikivoyageWptPtMenuController(new WikivoyageWptPtMenuBuilder(mapActivity, wpt), mapActivity, pointDescription, wpt); + return new WikivoyageWptPtMenuController(new WikivoyageWptPtMenuBuilder(mapActivity, wpt), mapActivity, pointDescription, wpt, gpxFile); } return new WptPtMenuController(new WptPtMenuBuilder(mapActivity, wpt), mapActivity, pointDescription, wpt); } -} +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/menu/WikivoyageWptPtMenuController.java b/OsmAnd/src/net/osmand/plus/wikivoyage/menu/WikivoyageWptPtMenuController.java index 7de27aaa68..10ab32b2b5 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/menu/WikivoyageWptPtMenuController.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/menu/WikivoyageWptPtMenuController.java @@ -15,19 +15,15 @@ import net.osmand.plus.wikivoyage.article.WikivoyageArticleDialogFragment; import net.osmand.plus.wikivoyage.data.TravelArticle; public class WikivoyageWptPtMenuController extends WptPtMenuController { - public WikivoyageWptPtMenuController(@NonNull MenuBuilder menuBuilder, @NonNull final MapActivity mapActivity, @NonNull PointDescription pointDescription, @NonNull GPXUtilities.WptPt wpt) { + public WikivoyageWptPtMenuController(@NonNull MenuBuilder menuBuilder, @NonNull final MapActivity mapActivity, @NonNull PointDescription pointDescription, @NonNull GPXUtilities.WptPt wpt, GPXUtilities.GPXFile gpxFile) { super(menuBuilder, mapActivity, pointDescription, wpt); - - final OsmandApplication app = mapActivity.getMyApplication(); - GpxSelectionHelper.SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().getSelectedGPXFile(wpt); - GPXUtilities.GPXFile gpxFile = selectedGpxFile != null ? selectedGpxFile.getGpxFile() : null; GPXUtilities.Metadata metadata = gpxFile != null ? gpxFile.metadata : null; final TravelArticle article = metadata != null ? getTravelArticle(metadata) : null; if (article != null) { leftTitleButtonController = new TitleButtonController() { @Override public void buttonPressed() { - WikivoyageArticleDialogFragment.showInstance(app, mapActivity.getSupportFragmentManager(), article.getTripId(), article.getLang()); + WikivoyageArticleDialogFragment.showInstance(mapActivity.getMyApplication(), mapActivity.getSupportFragmentManager(), article.getTripId(), article.getLang()); } }; leftTitleButtonController.caption = mapActivity.getString(R.string.context_menu_read_article);