add parseLaunchIntentLink
This commit is contained in:
parent
33c47cc399
commit
f6e22b6b5d
1 changed files with 21 additions and 17 deletions
|
@ -173,23 +173,7 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
Uri data = intent.getData();
|
Uri data = intent.getData();
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
String scheme = data.getScheme();
|
parseLaunchIntentLink(data);
|
||||||
String host = data.getHost();
|
|
||||||
String path = data.getPath();
|
|
||||||
if (("http".equalsIgnoreCase(scheme) || "https".equalsIgnoreCase(scheme))
|
|
||||||
&& host != null
|
|
||||||
&& path != null
|
|
||||||
&& host.contains("osmand.net")
|
|
||||||
&& path.startsWith("/travel")) {
|
|
||||||
String title = WikiArticleHelper.decodeTitleFromTravelUrl(data.getQueryParameter("title"));
|
|
||||||
String selectedLang = data.getQueryParameter("lang");
|
|
||||||
if (!Algorithms.isEmpty(title) && !Algorithms.isEmpty(selectedLang)) {
|
|
||||||
long articleId = app.getTravelDbHelper().getArticleId(title, selectedLang);
|
|
||||||
if (articleId != -1) {
|
|
||||||
WikivoyageArticleDialogFragment.showInstance(app, getSupportFragmentManager(), articleId, selectedLang);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
int currentItem = intent.getIntExtra(TAB_SELECTED, 0);
|
int currentItem = intent.getIntExtra(TAB_SELECTED, 0);
|
||||||
if (currentItem == SAVED_ARTICLES_POSITION) {
|
if (currentItem == SAVED_ARTICLES_POSITION) {
|
||||||
|
@ -208,6 +192,26 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv
|
||||||
getMyApplication().getDownloadThread().setUiActivity(this);
|
getMyApplication().getDownloadThread().setUiActivity(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void parseLaunchIntentLink(Uri data) {
|
||||||
|
String scheme = data.getScheme();
|
||||||
|
String host = data.getHost();
|
||||||
|
String path = data.getPath();
|
||||||
|
if (("http".equalsIgnoreCase(scheme) || "https".equalsIgnoreCase(scheme))
|
||||||
|
&& host != null
|
||||||
|
&& path != null
|
||||||
|
&& host.contains("osmand.net")
|
||||||
|
&& path.startsWith("/travel")) {
|
||||||
|
String title = WikiArticleHelper.decodeTitleFromTravelUrl(data.getQueryParameter("title"));
|
||||||
|
String selectedLang = data.getQueryParameter("lang");
|
||||||
|
if (!Algorithms.isEmpty(title) && !Algorithms.isEmpty(selectedLang)) {
|
||||||
|
long articleId = app.getTravelDbHelper().getArticleId(title, selectedLang);
|
||||||
|
if (articleId != -1) {
|
||||||
|
WikivoyageArticleDialogFragment.showInstance(app, getSupportFragmentManager(), articleId, selectedLang);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
|
Loading…
Reference in a new issue