mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 02:49:18 +01:00
Main activity now uses single task. Fixes #850. Actually use new support library
This commit is contained in:
parent
1794782323
commit
5fec956ce6
@ -237,7 +237,7 @@ configurations.all {
|
|||||||
def requested = details.requested
|
def requested = details.requested
|
||||||
if (requested.group == 'com.android.support') {
|
if (requested.group == 'com.android.support') {
|
||||||
if (!requested.name.startsWith("multidex")) {
|
if (!requested.name.startsWith("multidex")) {
|
||||||
details.useVersion '25.3.1'
|
details.useVersion '25.4.0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,9 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:largeHeap="true"
|
android:largeHeap="true"
|
||||||
android:theme="@style/Theme.Tachiyomi">
|
android:theme="@style/Theme.Tachiyomi">
|
||||||
<activity android:name=".ui.main.MainActivity">
|
<activity
|
||||||
|
android:name=".ui.main.MainActivity"
|
||||||
|
android:launchMode="singleTask">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package eu.kanade.tachiyomi.ui.main
|
package eu.kanade.tachiyomi.ui.main
|
||||||
|
|
||||||
import android.animation.ObjectAnimator
|
import android.animation.ObjectAnimator
|
||||||
|
import android.content.Intent
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.support.v4.view.GravityCompat
|
import android.support.v4.view.GravityCompat
|
||||||
@ -105,15 +106,8 @@ class MainActivity : BaseActivity() {
|
|||||||
router = Conductor.attachRouter(this, container, savedInstanceState)
|
router = Conductor.attachRouter(this, container, savedInstanceState)
|
||||||
if (!router.hasRootController()) {
|
if (!router.hasRootController()) {
|
||||||
// Set start screen
|
// Set start screen
|
||||||
when (intent.action) {
|
if (!handleIntentAction(intent)) {
|
||||||
SHORTCUT_LIBRARY -> setSelectedDrawerItem(R.id.nav_drawer_library)
|
setSelectedDrawerItem(startScreenId)
|
||||||
SHORTCUT_RECENTLY_UPDATED -> setSelectedDrawerItem(R.id.nav_drawer_recent_updates)
|
|
||||||
SHORTCUT_RECENTLY_READ -> setSelectedDrawerItem(R.id.nav_drawer_recently_read)
|
|
||||||
SHORTCUT_CATALOGUES -> setSelectedDrawerItem(R.id.nav_drawer_catalogues)
|
|
||||||
SHORTCUT_MANGA -> router.setRoot(
|
|
||||||
RouterTransaction.with(MangaController(intent.extras)))
|
|
||||||
SHORTCUT_DOWNLOADS -> setSelectedDrawerItem(R.id.nav_drawer_downloads)
|
|
||||||
else -> setSelectedDrawerItem(startScreenId)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,6 +143,29 @@ class MainActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onNewIntent(intent: Intent) {
|
||||||
|
if (!handleIntentAction(intent)) {
|
||||||
|
super.onNewIntent(intent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun handleIntentAction(intent: Intent): Boolean {
|
||||||
|
when (intent.action) {
|
||||||
|
SHORTCUT_LIBRARY -> setSelectedDrawerItem(R.id.nav_drawer_library)
|
||||||
|
SHORTCUT_RECENTLY_UPDATED -> setSelectedDrawerItem(R.id.nav_drawer_recent_updates)
|
||||||
|
SHORTCUT_RECENTLY_READ -> setSelectedDrawerItem(R.id.nav_drawer_recently_read)
|
||||||
|
SHORTCUT_CATALOGUES -> setSelectedDrawerItem(R.id.nav_drawer_catalogues)
|
||||||
|
SHORTCUT_MANGA -> router.setRoot(RouterTransaction.with(MangaController(intent.extras)))
|
||||||
|
SHORTCUT_DOWNLOADS -> {
|
||||||
|
if (router.backstack.none { it.controller() is DownloadController }) {
|
||||||
|
setSelectedDrawerItem(R.id.nav_drawer_downloads)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
nav_view?.setNavigationItemSelectedListener(null)
|
nav_view?.setNavigationItemSelectedListener(null)
|
||||||
|
Loading…
Reference in New Issue
Block a user