Merge pull request #5341 from osmandapp/PaulsBranch

Fixed an issue with incorrect dialog in cologne
This commit is contained in:
vshcherb 2018-05-04 10:02:50 +02:00 committed by GitHub
commit 7ebce6878e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -80,7 +80,8 @@ public class WikivoyageWebViewClient extends WebViewClient implements RegionCall
@Override @Override
public boolean shouldOverrideUrlLoading(WebView view, String url) { public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.contains(WIKIVOAYAGE_DOMAIN)) { boolean isWebPage = url.startsWith(PAGE_PREFIX_HTTP) || url.startsWith(PAGE_PREFIX_HTTPS);
if (url.contains(WIKIVOAYAGE_DOMAIN) && isWebPage) {
String lang = getLang(url); String lang = getLang(url);
String articleName = getArticleNameFromUrl(url, lang); String articleName = getArticleNameFromUrl(url, lang);
long articleId = app.getTravelDbHelper().getArticleId(articleName, lang); long articleId = app.getTravelDbHelper().getArticleId(articleName, lang);
@ -90,11 +91,11 @@ public class WikivoyageWebViewClient extends WebViewClient implements RegionCall
warnAboutExternalLoad(url, context, nightMode); warnAboutExternalLoad(url, context, nightMode);
} }
return true; return true;
} else if (url.contains(WIKI_DOMAIN)) { } else if (url.contains(WIKI_DOMAIN) && isWebPage) {
String lang = getLang(url); String lang = getLang(url);
String articleName = getArticleNameFromUrl(url, lang); String articleName = getArticleNameFromUrl(url, lang);
getWikiArticle(articleName, lang, url); getWikiArticle(articleName, lang, url);
} else if (url.startsWith(PAGE_PREFIX_HTTP) || url.startsWith(PAGE_PREFIX_HTTPS)) { } else if (isWebPage) {
warnAboutExternalLoad(url, context, nightMode); warnAboutExternalLoad(url, context, nightMode);
} else if (url.startsWith(PREFIX_GEO)) { } else if (url.startsWith(PREFIX_GEO)) {
if (article != null) { if (article != null) {