add parseLaunchIntentLink

This commit is contained in:
Chumva 2018-05-25 14:24:10 +03:00
parent 33c47cc399
commit f6e22b6b5d

View file

@ -173,6 +173,26 @@ 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) {
parseLaunchIntentLink(data);
} else {
int currentItem = intent.getIntExtra(TAB_SELECTED, 0);
if (currentItem == SAVED_ARTICLES_POSITION) {
BottomNavigationView bottomNav = (BottomNavigationView) findViewById(R.id.bottom_navigation);
bottomNav.setSelectedItemId(R.id.action_saved_articles);
}
long articleId = intent.getLongExtra(CITY_ID_KEY, -1);
String selectedLang = intent.getStringExtra(SELECTED_LANG_KEY);
if (articleId != -1) {
WikivoyageArticleDialogFragment.showInstance(app, getSupportFragmentManager(), articleId, selectedLang);
}
}
setIntent(null);
}
getMyApplication().getDownloadThread().setUiActivity(this);
}
protected void parseLaunchIntentLink(Uri data) {
String scheme = data.getScheme(); String scheme = data.getScheme();
String host = data.getHost(); String host = data.getHost();
String path = data.getPath(); String path = data.getPath();
@ -190,22 +210,6 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv
} }
} }
} }
} else {
int currentItem = intent.getIntExtra(TAB_SELECTED, 0);
if (currentItem == SAVED_ARTICLES_POSITION) {
BottomNavigationView bottomNav = (BottomNavigationView) findViewById(R.id.bottom_navigation);
bottomNav.setSelectedItemId(R.id.action_saved_articles);
}
long articleId = intent.getLongExtra(CITY_ID_KEY, -1);
String selectedLang = intent.getStringExtra(SELECTED_LANG_KEY);
if (articleId != -1) {
WikivoyageArticleDialogFragment.showInstance(app, getSupportFragmentManager(), articleId, selectedLang);
}
}
setIntent(null);
}
getMyApplication().getDownloadThread().setUiActivity(this);
} }
@Override @Override