From 8bb69c455b3af3c90340c8969f2c0f474daedbcb Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 13 Feb 2021 10:26:59 -0500 Subject: [PATCH] Allow clicking the toolbar to go to the manga Co-authored-by: Jobobby04 --- .../kanade/tachiyomi/ui/reader/ReaderActivity.kt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 3b6b4e2f1..e060d1cab 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -37,6 +37,8 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.asImmediateFlow import eu.kanade.tachiyomi.databinding.ReaderActivityBinding import eu.kanade.tachiyomi.ui.base.activity.BaseRxActivity +import eu.kanade.tachiyomi.ui.main.MainActivity +import eu.kanade.tachiyomi.ui.manga.MangaController import eu.kanade.tachiyomi.ui.reader.ReaderPresenter.SetAsCoverResult.AddToLibraryFirst import eu.kanade.tachiyomi.ui.reader.ReaderPresenter.SetAsCoverResult.Error import eu.kanade.tachiyomi.ui.reader.ReaderPresenter.SetAsCoverResult.Success @@ -294,7 +296,6 @@ class ReaderActivity : BaseRxActivity() * Initializes the reader menu. It sets up click listeners and the initial visibility. */ private fun initializeMenu() { - // Set toolbar setSupportActionBar(binding.toolbar) supportActionBar?.setDisplayHomeAsUpEnabled(true) binding.toolbar.setNavigationOnClickListener { @@ -314,6 +315,18 @@ class ReaderActivity : BaseRxActivity() insets } + binding.toolbar.setOnClickListener { + presenter.manga?.id?.let { id -> + startActivity( + Intent(this, MainActivity::class.java).apply { + action = MainActivity.SHORTCUT_MANGA + putExtra(MangaController.MANGA_EXTRA, id) + addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) + } + ) + } + } + // Init listeners on bottom menu binding.pageSeekbar.setOnSeekBarChangeListener( object : SimpleSeekBarListener() {