add const WIKI_LINK

This commit is contained in:
Chumva 2018-05-14 16:07:46 +03:00
parent cebb6001d4
commit decfaa850c

View file

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