Improve accesibility in reader
This commit is contained in:
@@ -220,7 +220,7 @@ class ReaderActivity : BaseFullscreenActivity<ActivityReaderBinding>(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onGridTouch(area: Int) {
|
override fun onGridTouch(area: Int) {
|
||||||
controlDelegate.onGridTouch(area)
|
controlDelegate.onGridTouch(area, binding.container)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onProcessTouch(rawX: Int, rawY: Int): Boolean {
|
override fun onProcessTouch(rawX: Int, rawY: Int): Boolean {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package org.koitharu.kotatsu.reader.ui
|
package org.koitharu.kotatsu.reader.ui
|
||||||
|
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
|
import android.view.SoundEffectConstants
|
||||||
|
import android.view.View
|
||||||
import androidx.lifecycle.LifecycleCoroutineScope
|
import androidx.lifecycle.LifecycleCoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
@@ -30,18 +32,27 @@ class ReaderControlDelegate(
|
|||||||
}.launchIn(scope)
|
}.launchIn(scope)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onGridTouch(area: Int) {
|
fun onGridTouch(area: Int, view: View) {
|
||||||
when (area) {
|
when (area) {
|
||||||
GridTouchHelper.AREA_CENTER -> {
|
GridTouchHelper.AREA_CENTER -> {
|
||||||
listener.toggleUiVisibility()
|
listener.toggleUiVisibility()
|
||||||
|
view.playSoundEffect(SoundEffectConstants.CLICK)
|
||||||
|
}
|
||||||
|
GridTouchHelper.AREA_TOP -> if (isTapSwitchEnabled) {
|
||||||
|
listener.switchPageBy(-1)
|
||||||
|
view.playSoundEffect(SoundEffectConstants.NAVIGATION_UP)
|
||||||
}
|
}
|
||||||
GridTouchHelper.AREA_TOP,
|
|
||||||
GridTouchHelper.AREA_LEFT -> if (isTapSwitchEnabled) {
|
GridTouchHelper.AREA_LEFT -> if (isTapSwitchEnabled) {
|
||||||
listener.switchPageBy(-1)
|
listener.switchPageBy(-1)
|
||||||
|
view.playSoundEffect(SoundEffectConstants.NAVIGATION_LEFT)
|
||||||
|
}
|
||||||
|
GridTouchHelper.AREA_BOTTOM -> if (isTapSwitchEnabled) {
|
||||||
|
listener.switchPageBy(1)
|
||||||
|
view.playSoundEffect(SoundEffectConstants.NAVIGATION_DOWN)
|
||||||
}
|
}
|
||||||
GridTouchHelper.AREA_BOTTOM,
|
|
||||||
GridTouchHelper.AREA_RIGHT -> if (isTapSwitchEnabled) {
|
GridTouchHelper.AREA_RIGHT -> if (isTapSwitchEnabled) {
|
||||||
listener.switchPageBy(1)
|
listener.switchPageBy(1)
|
||||||
|
view.playSoundEffect(SoundEffectConstants.NAVIGATION_RIGHT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user