mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-20 05:19:16 +01:00
Manga app shortcuts now return back main activity on up button press
This commit is contained in:
parent
a30e4ebcbc
commit
f5aafebc91
@ -895,6 +895,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
||||
const val SHORTCUT_BROWSE = "eu.kanade.tachiyomi.SHOW_BROWSE"
|
||||
const val SHORTCUT_DOWNLOADS = "eu.kanade.tachiyomi.SHOW_DOWNLOADS"
|
||||
const val SHORTCUT_MANGA = "eu.kanade.tachiyomi.SHOW_MANGA"
|
||||
const val SHORTCUT_MANGA_BACK = "eu.kanade.tachiyomi.SHOW_MANGA_BACK"
|
||||
const val SHORTCUT_UPDATE_NOTES = "eu.kanade.tachiyomi.SHOW_UPDATE_NOTES"
|
||||
const val SHORTCUT_SOURCE = "eu.kanade.tachiyomi.SHOW_SOURCE"
|
||||
const val SHORTCUT_READER_SETTINGS = "eu.kanade.tachiyomi.READER_SETTINGS"
|
||||
|
@ -107,7 +107,7 @@ class SearchActivity : MainActivity() {
|
||||
router.replaceTopController(GlobalSearchController(query, filter).withFadeTransaction())
|
||||
}
|
||||
}
|
||||
SHORTCUT_MANGA -> {
|
||||
SHORTCUT_MANGA, SHORTCUT_MANGA_BACK -> {
|
||||
val extras = intent.extras ?: return false
|
||||
router.replaceTopController(
|
||||
RouterTransaction.with(MangaDetailsController(extras))
|
||||
@ -136,13 +136,13 @@ class SearchActivity : MainActivity() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun openMangaIntent(context: Context, id: Long) = Intent(
|
||||
fun openMangaIntent(context: Context, id: Long?, canReturnToMain: Boolean = false) = Intent(
|
||||
context,
|
||||
SearchActivity::class
|
||||
.java
|
||||
)
|
||||
.apply {
|
||||
action = SHORTCUT_MANGA
|
||||
action = if (canReturnToMain) SHORTCUT_MANGA_BACK else SHORTCUT_MANGA
|
||||
putExtra(MangaDetailsController.MANGA_EXTRA, id)
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.icon
|
||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||
import eu.kanade.tachiyomi.ui.main.SearchActivity
|
||||
import eu.kanade.tachiyomi.ui.manga.MangaDetailsController
|
||||
import eu.kanade.tachiyomi.ui.recents.RecentsPresenter
|
||||
import eu.kanade.tachiyomi.ui.source.browse.BrowseSourceController
|
||||
import eu.kanade.tachiyomi.util.system.launchIO
|
||||
@ -79,12 +78,8 @@ class MangaShortcutManager(
|
||||
else Icon.createWithResource(context, R.drawable.ic_book_24dp)
|
||||
)
|
||||
.setIntent(
|
||||
Intent(
|
||||
context,
|
||||
SearchActivity::class.java
|
||||
).setAction(MainActivity.SHORTCUT_MANGA)
|
||||
SearchActivity.openMangaIntent(context, item.id, true)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
||||
.putExtra(MangaDetailsController.MANGA_EXTRA, item.id)
|
||||
)
|
||||
.build()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user