Skip to content

Commit

Permalink
Use single task activity
Browse files Browse the repository at this point in the history
  • Loading branch information
inorichi committed Apr 13, 2019
1 parent 0a988d1 commit 3533359
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
android:theme="@style/Theme.Tachiyomi">
<activity
android:name=".ui.main.MainActivity"
android:launchMode="singleTop">
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,19 @@ class MainActivity : BaseActivity() {
//Get the search query provided in extras, and if not null, perform a global search with it.
val query = intent.getStringExtra(SearchManager.QUERY)
if (query != null && !query.isEmpty()) {
setSelectedDrawerItem(R.id.nav_drawer_catalogues)
if (router.backstackSize > 1) {
router.popToRoot()
}
router.pushController(CatalogueSearchController(query).withFadeTransaction())
}
}
INTENT_SEARCH -> {
val query = intent.getStringExtra(INTENT_SEARCH_QUERY)
val filter = intent.getStringExtra(INTENT_SEARCH_FILTER)
if (query != null && !query.isEmpty()) {
setSelectedDrawerItem(R.id.nav_drawer_catalogues)
if (router.backstackSize > 1) {
router.popToRoot()
}
router.pushController(CatalogueSearchController(query, filter).withFadeTransaction())
}
}
Expand Down

0 comments on commit 3533359

Please sign in to comment.