mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 04:11:48 +01:00
Add option to reverse tapping
This commit is contained in:
parent
ca75400467
commit
c54b8e62d7
@ -55,6 +55,8 @@ object PreferenceKeys {
|
|||||||
|
|
||||||
const val readWithTapping = "reader_tap"
|
const val readWithTapping = "reader_tap"
|
||||||
|
|
||||||
|
const val readWithTappingInverted = "reader_volume_keys_inverted"
|
||||||
|
|
||||||
const val readWithLongTap = "reader_long_tap"
|
const val readWithLongTap = "reader_long_tap"
|
||||||
|
|
||||||
const val readWithVolumeKeys = "reader_volume_keys"
|
const val readWithVolumeKeys = "reader_volume_keys"
|
||||||
|
@ -121,6 +121,8 @@ class PreferencesHelper(val context: Context) {
|
|||||||
|
|
||||||
fun readWithTapping() = flowPrefs.getBoolean(Keys.readWithTapping, true)
|
fun readWithTapping() = flowPrefs.getBoolean(Keys.readWithTapping, true)
|
||||||
|
|
||||||
|
fun readWithTappingInverted() = flowPrefs.getBoolean(Keys.readWithTappingInverted, false)
|
||||||
|
|
||||||
fun readWithLongTap() = flowPrefs.getBoolean(Keys.readWithLongTap, true)
|
fun readWithLongTap() = flowPrefs.getBoolean(Keys.readWithLongTap, true)
|
||||||
|
|
||||||
fun readWithVolumeKeys() = flowPrefs.getBoolean(Keys.readWithVolumeKeys, false)
|
fun readWithVolumeKeys() = flowPrefs.getBoolean(Keys.readWithVolumeKeys, false)
|
||||||
|
@ -20,6 +20,7 @@ abstract class ViewerConfig(preferences: PreferencesHelper) {
|
|||||||
|
|
||||||
var tappingEnabled = true
|
var tappingEnabled = true
|
||||||
var longTapEnabled = true
|
var longTapEnabled = true
|
||||||
|
var tappingInverted = false
|
||||||
var doubleTapAnimDuration = 500
|
var doubleTapAnimDuration = 500
|
||||||
var volumeKeysEnabled = false
|
var volumeKeysEnabled = false
|
||||||
var volumeKeysInverted = false
|
var volumeKeysInverted = false
|
||||||
@ -30,6 +31,9 @@ abstract class ViewerConfig(preferences: PreferencesHelper) {
|
|||||||
preferences.readWithTapping()
|
preferences.readWithTapping()
|
||||||
.register({ tappingEnabled = it })
|
.register({ tappingEnabled = it })
|
||||||
|
|
||||||
|
preferences.readWithTappingInverted()
|
||||||
|
.register({ tappingInverted = it })
|
||||||
|
|
||||||
preferences.readWithLongTap()
|
preferences.readWithLongTap()
|
||||||
.register({ longTapEnabled = it })
|
.register({ longTapEnabled = it })
|
||||||
|
|
||||||
|
@ -81,9 +81,14 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
})
|
})
|
||||||
pager.tapListener = { event ->
|
pager.tapListener = { event ->
|
||||||
val positionX = event.x
|
val positionX = event.x
|
||||||
|
val tappingInverted = config.tappingInverted
|
||||||
|
|
||||||
|
val leftSideTap = positionX < pager.width * 0.33f && config.tappingEnabled
|
||||||
|
val rightSideTap = positionX > pager.width * 0.66f && config.tappingEnabled
|
||||||
|
|
||||||
when {
|
when {
|
||||||
positionX < pager.width * 0.33f && config.tappingEnabled -> moveLeft()
|
leftSideTap && !tappingInverted || rightSideTap && tappingInverted -> moveLeft()
|
||||||
positionX > pager.width * 0.66f && config.tappingEnabled -> moveRight()
|
rightSideTap && !tappingInverted || leftSideTap && tappingInverted -> moveRight()
|
||||||
else -> activity.toggleMenu()
|
else -> activity.toggleMenu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,6 +190,11 @@ class SettingsReaderController : SettingsController() {
|
|||||||
titleRes = R.string.pref_read_with_tapping
|
titleRes = R.string.pref_read_with_tapping
|
||||||
defaultValue = true
|
defaultValue = true
|
||||||
}
|
}
|
||||||
|
switchPreference {
|
||||||
|
key = Keys.readWithTappingInverted
|
||||||
|
titleRes = R.string.pref_read_with_tapping_inverted
|
||||||
|
defaultValue = false
|
||||||
|
}.apply { dependency = Keys.readWithTapping }
|
||||||
switchPreference {
|
switchPreference {
|
||||||
key = Keys.readWithLongTap
|
key = Keys.readWithLongTap
|
||||||
titleRes = R.string.pref_read_with_long_tap
|
titleRes = R.string.pref_read_with_long_tap
|
||||||
|
@ -665,5 +665,6 @@
|
|||||||
<string name="channel_backup_restore">Backup and restore</string>
|
<string name="channel_backup_restore">Backup and restore</string>
|
||||||
<string name="channel_backup_restore_progress">Progress</string>
|
<string name="channel_backup_restore_progress">Progress</string>
|
||||||
<string name="channel_backup_restore_complete">Complete</string>
|
<string name="channel_backup_restore_complete">Complete</string>
|
||||||
|
<string name="pref_read_with_tapping_inverted">Invert tapping</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user