Merge pull request #5402 from osmandapp/Fix_5391

Fix #5391
This commit is contained in:
Alexander Sytnyk 2018-05-14 20:56:36 +03:00 committed by GitHub
commit 690e15bc49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -56,6 +56,8 @@ import java.util.Map;
public class AmenityMenuBuilder extends MenuBuilder {
private static final String WIKI_LINK = ".wikipedia.org/w";
private final Amenity amenity;
public AmenityMenuBuilder(MapActivity mapActivity, final Amenity amenity) {
@ -100,7 +102,12 @@ public class AmenityMenuBuilder extends MenuBuilder {
ll.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
String textToCopy = !Algorithms.isEmpty(textPrefix) ? textPrefix + ": " + txt : txt;
String textToCopy;
if (txt.contains(WIKI_LINK)) {
textToCopy = txt;
} else {
textToCopy = !Algorithms.isEmpty(textPrefix) ? textPrefix + ": " + txt : txt;
}
copyToClipboard(textToCopy, view.getContext());
return true;
}
@ -293,7 +300,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
ll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (text.contains(".wikipedia.org/w")) {
if (text.contains(WIKI_LINK)) {
if (Version.isPaidVersion(app)) {
WikiArticleHelper wikiArticleHelper = new WikiArticleHelper(mapActivity, !light);
wikiArticleHelper.showWikiArticle(amenity.getLocation(), text);