Allow clicking the toolbar to go to the manga

Co-authored-by: Jobobby04 <jobobby04@users.noreply.github.com>
(cherry picked from commit 8bb69c455b3af3c90340c8969f2c0f474daedbcb)
This commit is contained in:
arkon 2021-02-13 10:26:59 -05:00 committed by Jobobby04
parent 0185d5f7d6
commit 2845d8cc98

View File

@ -367,7 +367,6 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
* 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 {
@ -387,6 +386,18 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
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() {
@ -593,19 +604,6 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
}
.launchIn(lifecycleScope)
binding.toolbar.clicks()
.onEach {
presenter.manga?.id?.let { id ->
startActivity(
Intent(this, MainActivity::class.java)
.setAction(MainActivity.SHORTCUT_MANGA)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
.putExtra(MangaController.MANGA_EXTRA, id)
)
}
}
.launchIn(lifecycleScope)
autoScrollFlow
.onEach {
viewer.let { v ->