unnecessary fixes

This commit is contained in:
Nazar 2019-07-16 10:28:49 +03:00 committed by crimean
parent 1b184ad999
commit a7172cdd04
3 changed files with 7 additions and 11 deletions

View file

@ -146,11 +146,11 @@ public class WptPtMenuBuilder extends MenuBuilder {
List<WptPt> 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;
}
}

View file

@ -153,8 +153,8 @@ public class WptPtMenuController extends MenuController {
Map<String, String> 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);
}
}
}

View file

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