Add tooltips to bottom reader menu items

This commit is contained in:
arkon 2021-03-27 10:53:31 -04:00
parent c255f57d95
commit bff73b1b40

View file

@ -59,6 +59,7 @@ import eu.kanade.tachiyomi.util.system.toast
import eu.kanade.tachiyomi.util.view.defaultBar
import eu.kanade.tachiyomi.util.view.hideBar
import eu.kanade.tachiyomi.util.view.isDefaultBar
import eu.kanade.tachiyomi.util.view.setTooltip
import eu.kanade.tachiyomi.util.view.showBar
import eu.kanade.tachiyomi.util.view.snack
import eu.kanade.tachiyomi.widget.SimpleAnimationListener
@ -341,16 +342,25 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
}
}
binding.actionReaderMode.setOnClickListener {
val newReadingMode = ReadingModeType.getNextReadingMode(presenter.getMangaViewer(resolveDefault = false))
with(binding.actionReaderMode) {
setTooltip(R.string.viewer)
setOnClickListener {
val newReadingMode =
ReadingModeType.getNextReadingMode(presenter.getMangaViewer(resolveDefault = false))
presenter.setMangaViewer(newReadingMode.prefValue)
menuToggleToast?.cancel()
menuToggleToast = toast(newReadingMode.stringRes)
}
}
binding.actionRotation.setOnClickListener {
val newOrientation = OrientationType.getNextOrientation(preferences.rotation().get(), resources)
with(binding.actionRotation) {
setTooltip(R.string.pref_rotation_type)
setOnClickListener {
val newOrientation =
OrientationType.getNextOrientation(preferences.rotation().get(), resources)
preferences.rotation().set(newOrientation.prefValue)
setOrientation(newOrientation.flag)
@ -358,14 +368,19 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
menuToggleToast?.cancel()
menuToggleToast = toast(newOrientation.stringRes)
}
}
preferences.rotation().asImmediateFlow { updateRotationShortcut(it) }
.onEach {
updateRotationShortcut(it)
}
.launchIn(lifecycleScope)
binding.actionSettings.setOnClickListener {
ReaderSettingsSheet(this).show()
with(binding.actionSettings) {
setTooltip(R.string.action_settings)
setOnClickListener {
ReaderSettingsSheet(this@ReaderActivity).show()
}
}
// Set initial visibility