diff --git a/app/src/main/kotlin/com/hippo/ehviewer/Settings.kt b/app/src/main/kotlin/com/hippo/ehviewer/Settings.kt
index 4e4e4857c..515d7ff38 100644
--- a/app/src/main/kotlin/com/hippo/ehviewer/Settings.kt
+++ b/app/src/main/kotlin/com/hippo/ehviewer/Settings.kt
@@ -169,7 +169,8 @@ object Settings : DataStorePreferences(null) {
val keepScreenOn = boolPref("pref_keep_screen_on_key", true)
val readerLongTapAction = boolPref("reader_long_tap", true)
val pageTransitions = boolPref("pref_enable_transitions_key", true)
- val readerReverseControls = boolPref("reader_volume_keys_inverted", false)
+ val readWithVolumeKeys = boolPref("reader_volume_keys", false)
+ val readWithVolumeKeysInverted = boolPref("reader_volume_keys_inverted", false)
val grayScale = boolPref("pref_grayscale", false)
val invertedColors = boolPref("pref_inverted_colors", false)
val readerWebtoonNav = intPref("reader_navigation_mode_webtoon", 0)
diff --git a/app/src/main/kotlin/com/hippo/ehviewer/ui/reader/KeyEventHandler.kt b/app/src/main/kotlin/com/hippo/ehviewer/ui/reader/KeyEventHandler.kt
index ada910322..df4daf65b 100644
--- a/app/src/main/kotlin/com/hippo/ehviewer/ui/reader/KeyEventHandler.kt
+++ b/app/src/main/kotlin/com/hippo/ehviewer/ui/reader/KeyEventHandler.kt
@@ -8,15 +8,17 @@ import androidx.compose.ui.input.key.onPreviewKeyEvent
import androidx.compose.ui.input.key.type
fun Modifier.keyEventHandler(
- enabled: () -> Boolean,
- reverse: () -> Boolean,
+ volumeKeysEnabled: () -> Boolean,
+ volumeKeysInverted: () -> Boolean,
movePrevious: () -> Unit,
moveNext: () -> Unit,
) = onPreviewKeyEvent {
- if (enabled() && it.type == KeyEventType.KeyDown) {
+ if (it.type == KeyEventType.KeyDown) {
when (it.key) {
- Key.DirectionUp, Key.PageUp, Key.VolumeUp -> if (reverse()) moveNext() else movePrevious()
- Key.DirectionDown, Key.PageDown, Key.VolumeDown -> if (reverse()) movePrevious() else moveNext()
+ Key.DirectionUp, Key.PageUp -> movePrevious()
+ Key.DirectionDown, Key.PageDown -> moveNext()
+ Key.VolumeUp if volumeKeysEnabled() -> if (volumeKeysInverted()) moveNext() else movePrevious()
+ Key.VolumeDown if volumeKeysEnabled() -> if (volumeKeysInverted()) movePrevious() else moveNext()
else -> return@onPreviewKeyEvent false
}
true
diff --git a/app/src/main/kotlin/com/hippo/ehviewer/ui/reader/ReaderGeneralSetting.kt b/app/src/main/kotlin/com/hippo/ehviewer/ui/reader/ReaderGeneralSetting.kt
index 270736193..af40e3568 100644
--- a/app/src/main/kotlin/com/hippo/ehviewer/ui/reader/ReaderGeneralSetting.kt
+++ b/app/src/main/kotlin/com/hippo/ehviewer/ui/reader/ReaderGeneralSetting.kt
@@ -63,8 +63,15 @@ fun ReaderGeneralSetting() = Column(modifier = Modifier.verticalScroll(rememberS
title = stringResource(id = R.string.pref_page_transitions),
field = Settings.pageTransitions.asMutableState(),
)
+ val volume = Settings.readWithVolumeKeys.asMutableState()
SwitchChoice(
- title = stringResource(id = R.string.settings_read_reverse_controls),
- field = Settings.readerReverseControls.asMutableState(),
+ title = stringResource(id = R.string.settings_read_volume_page),
+ field = volume,
)
+ AnimatedVisibility(visible = volume.value) {
+ SwitchChoice(
+ title = stringResource(id = R.string.settings_read_reverse_volume),
+ field = Settings.readWithVolumeKeysInverted.asMutableState(),
+ )
+ }
}
diff --git a/app/src/main/kotlin/com/hippo/ehviewer/ui/reader/ReaderScreen.kt b/app/src/main/kotlin/com/hippo/ehviewer/ui/reader/ReaderScreen.kt
index a613774e0..f5302ac54 100644
--- a/app/src/main/kotlin/com/hippo/ehviewer/ui/reader/ReaderScreen.kt
+++ b/app/src/main/kotlin/com/hippo/ehviewer/ui/reader/ReaderScreen.kt
@@ -200,7 +200,8 @@ fun ReaderScreen(pageLoader: PageLoader, info: BaseGalleryInfo?) {
}
val showSeekbar by Settings.showReaderSeekbar.collectAsState()
val readingMode by Settings.readingMode.collectAsState { ReadingModeType.fromPreference(it) }
- val reverseControls by Settings.readerReverseControls.collectAsState()
+ val volumeKeysEnabled by Settings.readWithVolumeKeys.collectAsState()
+ val volumeKeysInverted by Settings.readWithVolumeKeysInverted.collectAsState()
val fullscreen by Settings.fullscreen.collectAsState()
val cutoutShort by Settings.cutoutShort.collectAsState()
val keepScreenOn by Settings.keepScreenOn.collectAsState()
@@ -220,8 +221,8 @@ fun ReaderScreen(pageLoader: PageLoader, info: BaseGalleryInfo?) {
val focusRequester = remember { FocusRequester() }
Box(
Modifier.keyEventHandler(
- enabled = { !appbarVisible },
- reverse = { reverseControls },
+ volumeKeysEnabled = { volumeKeysEnabled && !appbarVisible },
+ volumeKeysInverted = { volumeKeysInverted },
movePrevious = { launch { if (isWebtoon) lazyListState.scrollUp() else pagerState.moveToPrevious() } },
moveNext = { launch { if (isWebtoon) lazyListState.scrollDown() else pagerState.moveToNext() } },
).focusRequester(focusRequester).focusable().thenIf(keepScreenOn) { keepScreenOn() },
diff --git a/core/i18n/src/commonMain/moko-resources/base/strings.xml b/core/i18n/src/commonMain/moko-resources/base/strings.xml
index b65047dd1..1ed6674eb 100644
--- a/core/i18n/src/commonMain/moko-resources/base/strings.xml
+++ b/core/i18n/src/commonMain/moko-resources/base/strings.xml
@@ -327,7 +327,8 @@
https://placeholder
Blockers
Block gallery or comment by title, uploader, tags and commenter
- Reverse physical key controls
+ Use volume keys to turn pages
+ Reverse volume keys
[Experimental] Block extraneous ads
[Optional] Pick placeholder to replace ads
Download
diff --git a/core/i18n/src/commonMain/moko-resources/de/strings.xml b/core/i18n/src/commonMain/moko-resources/de/strings.xml
index 1694f92cf..29994ec59 100644
--- a/core/i18n/src/commonMain/moko-resources/de/strings.xml
+++ b/core/i18n/src/commonMain/moko-resources/de/strings.xml
@@ -232,6 +232,7 @@
Japanische Titel anzeigen
Galerie-Blocker
Nach Titel, Uploader order Etiketten die unerwünschten Galerien verstecken
+ Seiten mit Lautstärketaste umblättern
Download
Downloadziel
Downloadziel konnte nicht geladen werden
diff --git a/core/i18n/src/commonMain/moko-resources/es/strings.xml b/core/i18n/src/commonMain/moko-resources/es/strings.xml
index c3d53926e..e7cea53bd 100644
--- a/core/i18n/src/commonMain/moko-resources/es/strings.xml
+++ b/core/i18n/src/commonMain/moko-resources/es/strings.xml
@@ -254,6 +254,8 @@
Filtrado de galerías
Filtrado de galerías por título, uploader y etiquetas. Para más detalles presiona el ícono (i) en la parte superior del menú
+ Pasar páginas con botón del volumen
+
Descargas
Ruta de descargas
No se puede obtener ruta de descargas
diff --git a/core/i18n/src/commonMain/moko-resources/fr/strings.xml b/core/i18n/src/commonMain/moko-resources/fr/strings.xml
index a6e1b798a..1d5e8f853 100644
--- a/core/i18n/src/commonMain/moko-resources/fr/strings.xml
+++ b/core/i18n/src/commonMain/moko-resources/fr/strings.xml
@@ -286,6 +286,8 @@
Bloqueur des galeries
Filtrer les galerie par les titres, les uploaders ou les tags
+ Tourner la page avec les Volumes
+
Tags suivis
diff --git a/core/i18n/src/commonMain/moko-resources/ja/strings.xml b/core/i18n/src/commonMain/moko-resources/ja/strings.xml
index 29185799b..5e0769dbc 100644
--- a/core/i18n/src/commonMain/moko-resources/ja/strings.xml
+++ b/core/i18n/src/commonMain/moko-resources/ja/strings.xml
@@ -314,7 +314,8 @@
https://placeholder
ギャラリーをブロック
タイトル、アップローダー、タグ、コメントの投稿者またはギャラリーをブロックします
- 物理ボタンのコントロールを反転
+ 音量ボタンでページをめくる
+ 音量ボタンを入れ替える
[試験的] 関係のない広告をブロック
[任意] 広告を置換するプレースホルダーを選択
ダウンロード
diff --git a/core/i18n/src/commonMain/moko-resources/ko/strings.xml b/core/i18n/src/commonMain/moko-resources/ko/strings.xml
index 030424363..83c1cba0b 100644
--- a/core/i18n/src/commonMain/moko-resources/ko/strings.xml
+++ b/core/i18n/src/commonMain/moko-resources/ko/strings.xml
@@ -262,6 +262,8 @@
Placeholder
https://placeholder
+ 볼륨 키로 페이지 넘기기
+
다운로드
다운로드 위치
다운로드 위치를 가져올 수 없습니다.
diff --git a/core/i18n/src/commonMain/moko-resources/th/strings.xml b/core/i18n/src/commonMain/moko-resources/th/strings.xml
index 9e94f9a9d..f135051ca 100644
--- a/core/i18n/src/commonMain/moko-resources/th/strings.xml
+++ b/core/i18n/src/commonMain/moko-resources/th/strings.xml
@@ -277,6 +277,8 @@
Placeholder
https://placeholder
+ ใช้ปุ่มปรับเสียงเพื่อเปลี่ยนหน้า
+
การดาวน์โหลด
ตำแหน่งแหล่งดาวน์โหลด
ไม่สามารถเข้าถึงแหล่งดาวน์โหลดได้
diff --git a/core/i18n/src/commonMain/moko-resources/zh-rCN/strings.xml b/core/i18n/src/commonMain/moko-resources/zh-rCN/strings.xml
index ca7be574c..90517f9cf 100644
--- a/core/i18n/src/commonMain/moko-resources/zh-rCN/strings.xml
+++ b/core/i18n/src/commonMain/moko-resources/zh-rCN/strings.xml
@@ -311,7 +311,8 @@
https://github.com/EhTagTranslation/Editor/wiki
屏蔽列表
根据标题、上传者、标签、评论者屏蔽画廊或评论
- 反转物理按键控制
+ 使用音量键翻页
+ 反转音量键
[实验性] 屏蔽外部广告
[可选] 选择替换外部广告的图片
下载
diff --git a/core/i18n/src/commonMain/moko-resources/zh-rHK/strings.xml b/core/i18n/src/commonMain/moko-resources/zh-rHK/strings.xml
index bae201597..2a2649371 100644
--- a/core/i18n/src/commonMain/moko-resources/zh-rHK/strings.xml
+++ b/core/i18n/src/commonMain/moko-resources/zh-rHK/strings.xml
@@ -312,6 +312,8 @@
屏蔽畫廊
根據標題、上傳者、標籤屏蔽畫廊
+ 使用音量鍵翻頁
+
下載
下載路徑
無法獲取下載路徑
diff --git a/core/i18n/src/commonMain/moko-resources/zh-rTW/strings.xml b/core/i18n/src/commonMain/moko-resources/zh-rTW/strings.xml
index 18980eaec..b2011a24e 100644
--- a/core/i18n/src/commonMain/moko-resources/zh-rTW/strings.xml
+++ b/core/i18n/src/commonMain/moko-resources/zh-rTW/strings.xml
@@ -309,6 +309,8 @@
https://github.com/EhTagTranslation/Editor/wiki
隱藏圖庫
根據標題、上傳者、標籤、評論者隱藏圖庫或評論
+ 使用音量鍵翻頁
+ 反轉音量鍵
下載
下載路徑
無法取得下載路徑