Explorar el Código

feat:阅读界面更多设置里补充按钮切换新旧目录显示

todoXu hace 3 meses
padre
commit
9157eb6750

+ 3 - 0
app/src/main/java/io/legado/app/ui/book/read/ReadBookContract.kt

@@ -1561,6 +1561,9 @@ sealed interface ConfigUpdate {
     data class SliderVibrator(val value: Boolean) : ConfigUpdate {
     data class SliderVibrator(val value: Boolean) : ConfigUpdate {
         override val actions = emptySet<ConfigUpdateAction>()
         override val actions = emptySet<ConfigUpdateAction>()
     }
     }
+    data class UseNewTocSheet(val value: Boolean) : ConfigUpdate {
+        override val actions = emptySet<ConfigUpdateAction>()
+    }
     data class SelectVibrator(val value: Boolean) : ConfigUpdate {
     data class SelectVibrator(val value: Boolean) : ConfigUpdate {
         override val actions = emptySet<ConfigUpdateAction>()
         override val actions = emptySet<ConfigUpdateAction>()
     }
     }

+ 5 - 0
app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt

@@ -5526,6 +5526,11 @@ class ReadBookViewModel(
                     readSettingsRepository.setSliderVibrator(update.value)
                     readSettingsRepository.setSliderVibrator(update.value)
                 }
                 }
             }
             }
+            is ConfigUpdate.UseNewTocSheet -> {
+                viewModelScope.launch {
+                    readSettingsRepository.setUseNewTocSheet(update.value)
+                }
+            }
             is ConfigUpdate.SelectVibrator -> {
             is ConfigUpdate.SelectVibrator -> {
                 viewModelScope.launch {
                 viewModelScope.launch {
                     readSettingsRepository.setSelectVibrator(update.value)
                     readSettingsRepository.setSelectVibrator(update.value)

+ 11 - 0
app/src/main/java/io/legado/app/ui/book/read/sheet/MoreConfigSheet.kt

@@ -123,6 +123,9 @@ fun MoreConfigSheet(
                 onSliderVibratorChange = {
                 onSliderVibratorChange = {
                     onIntent(ReadBookIntent.UpdateConfig(ConfigUpdate.SliderVibrator(it)))
                     onIntent(ReadBookIntent.UpdateConfig(ConfigUpdate.SliderVibrator(it)))
                 },
                 },
+                onUseNewTocSheetChange = {
+                    onIntent(ReadBookIntent.UpdateConfig(ConfigUpdate.UseNewTocSheet(it)))
+                },
                 onSelectVibratorChange = {
                 onSelectVibratorChange = {
                     onIntent(ReadBookIntent.UpdateConfig(ConfigUpdate.SelectVibrator(it)))
                     onIntent(ReadBookIntent.UpdateConfig(ConfigUpdate.SelectVibrator(it)))
                 },
                 },
@@ -305,6 +308,7 @@ private fun PageControlSettings(
 private fun OtherSettings(
 private fun OtherSettings(
     preferences: ReadPreferences,
     preferences: ReadPreferences,
     onSliderVibratorChange: (Boolean) -> Unit,
     onSliderVibratorChange: (Boolean) -> Unit,
+    onUseNewTocSheetChange: (Boolean) -> Unit,
     onSelectVibratorChange: (Boolean) -> Unit,
     onSelectVibratorChange: (Boolean) -> Unit,
     onAutoChangeSourceChange: (Boolean) -> Unit,
     onAutoChangeSourceChange: (Boolean) -> Unit,
     onDefaultSourceChangeAllChange: (Boolean) -> Unit,
     onDefaultSourceChangeAllChange: (Boolean) -> Unit,
@@ -328,6 +332,13 @@ private fun OtherSettings(
         checked = preferences.sliderVibrator,
         checked = preferences.sliderVibrator,
         onCheckedChange = onSliderVibratorChange,
         onCheckedChange = onSliderVibratorChange,
     )
     )
+
+    TinySwitchSettingItem(
+        title = stringResource(R.string.use_new_toc_sheet),
+        checked = preferences.useNewTocSheet,
+        onCheckedChange = onUseNewTocSheetChange,
+    )
+
     TinySwitchSettingItem(
     TinySwitchSettingItem(
         title = stringResource(R.string.enable_select_vibrator),
         title = stringResource(R.string.enable_select_vibrator),
         checked = preferences.selectVibrator,
         checked = preferences.selectVibrator,