mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 05:05:06 +01:00
Tapping on reader toolbar title now opens manga page
This commit is contained in:
parent
cd570feb1b
commit
70105110b5
@ -1,11 +1,16 @@
|
|||||||
package eu.kanade.tachiyomi.ui.main
|
package eu.kanade.tachiyomi.ui.main
|
||||||
|
|
||||||
import android.app.SearchManager
|
import android.app.SearchManager
|
||||||
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import com.bluelinelabs.conductor.Controller
|
import com.bluelinelabs.conductor.Controller
|
||||||
|
import com.bluelinelabs.conductor.RouterTransaction
|
||||||
|
import com.bluelinelabs.conductor.changehandler.FadeChangeHandler
|
||||||
|
import com.bluelinelabs.conductor.changehandler.SimpleSwapChangeHandler
|
||||||
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
|
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||||
|
import eu.kanade.tachiyomi.ui.manga.MangaDetailsController
|
||||||
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
|
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
|
||||||
import eu.kanade.tachiyomi.ui.source.global_search.GlobalSearchController
|
import eu.kanade.tachiyomi.ui.source.global_search.GlobalSearchController
|
||||||
import eu.kanade.tachiyomi.util.view.gone
|
import eu.kanade.tachiyomi.util.view.gone
|
||||||
@ -30,7 +35,9 @@ class SearchActivity : MainActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun popToRoot() {
|
private fun popToRoot() {
|
||||||
if (!router.handleBack()) {
|
if (intent.action == SHORTCUT_MANGA) {
|
||||||
|
onBackPressed()
|
||||||
|
} else if (!router.handleBack()) {
|
||||||
val intent = Intent(this, MainActivity::class.java).apply {
|
val intent = Intent(this, MainActivity::class.java).apply {
|
||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
}
|
}
|
||||||
@ -80,8 +87,24 @@ class SearchActivity : MainActivity() {
|
|||||||
router.replaceTopController(GlobalSearchController(query, filter).withFadeTransaction())
|
router.replaceTopController(GlobalSearchController(query, filter).withFadeTransaction())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SHORTCUT_MANGA -> {
|
||||||
|
val extras = intent.extras ?: return false
|
||||||
|
router.replaceTopController(
|
||||||
|
RouterTransaction.with(MangaDetailsController(extras))
|
||||||
|
.pushChangeHandler(SimpleSwapChangeHandler())
|
||||||
|
.popChangeHandler(FadeChangeHandler()))
|
||||||
|
}
|
||||||
else -> return false
|
else -> return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun openMangaIntent(context: Context, id: Long) = Intent(context, SearchActivity::class
|
||||||
|
.java)
|
||||||
|
.apply {
|
||||||
|
action = SHORTCUT_MANGA
|
||||||
|
putExtra(MangaDetailsController.MANGA_EXTRA, id)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
|||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
import eu.kanade.tachiyomi.ui.base.MaterialMenuSheet
|
import eu.kanade.tachiyomi.ui.base.MaterialMenuSheet
|
||||||
import eu.kanade.tachiyomi.ui.base.activity.BaseRxActivity
|
import eu.kanade.tachiyomi.ui.base.activity.BaseRxActivity
|
||||||
|
import eu.kanade.tachiyomi.ui.main.SearchActivity
|
||||||
import eu.kanade.tachiyomi.ui.reader.ReaderPresenter.SetAsCoverResult.AddToLibraryFirst
|
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.Error
|
||||||
import eu.kanade.tachiyomi.ui.reader.ReaderPresenter.SetAsCoverResult.Success
|
import eu.kanade.tachiyomi.ui.reader.ReaderPresenter.SetAsCoverResult.Success
|
||||||
@ -327,6 +328,13 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
onBackPressed()
|
onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toolbar.setOnClickListener {
|
||||||
|
presenter.manga?.id?.let { id ->
|
||||||
|
SearchActivity.openMangaIntent(this, id)
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Init listeners on bottom menu
|
// Init listeners on bottom menu
|
||||||
page_seekbar.setOnSeekBarChangeListener(object : SimpleSeekBarListener() {
|
page_seekbar.setOnSeekBarChangeListener(object : SimpleSeekBarListener() {
|
||||||
override fun onProgressChanged(seekBar: SeekBar, value: Int, fromUser: Boolean) {
|
override fun onProgressChanged(seekBar: SeekBar, value: Int, fromUser: Boolean) {
|
||||||
|
Loading…
Reference in New Issue
Block a user