feat: 增加是否展示菜单项图标的配置开关 (#1502)
* feat: 增加是否展示菜单项图标的配置开关 * fix(read-settings): 恢复被误删的 titleBarIconPosition 属性映射 --------- Co-authored-by: lyc <liuyichen@o-neg.com>
This commit is contained in:
@@ -318,6 +318,7 @@ object PreferKey {
|
|||||||
const val titleBarCustomIcons = "titleBarCustomIcons"
|
const val titleBarCustomIcons = "titleBarCustomIcons"
|
||||||
const val titleBarIconPosition = "titleBarIconPosition"
|
const val titleBarIconPosition = "titleBarIconPosition"
|
||||||
const val showTitleBarIcons = "showTitleBarIcons"
|
const val showTitleBarIcons = "showTitleBarIcons"
|
||||||
|
const val showMenuIcon = "showMenuIcon"
|
||||||
const val disableReturnKey = "disableReturnKey"
|
const val disableReturnKey = "disableReturnKey"
|
||||||
const val selectText = "selectText"
|
const val selectText = "selectText"
|
||||||
//我在干什么
|
//我在干什么
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ data class ReadPreferences(
|
|||||||
val titleBarIconPosition: Int = 0,
|
val titleBarIconPosition: Int = 0,
|
||||||
val showTitleBarIcons: Boolean = true,
|
val showTitleBarIcons: Boolean = true,
|
||||||
val chineseConverterType: Int = 0,
|
val chineseConverterType: Int = 0,
|
||||||
|
val showMenuIcon: Boolean = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
class ReadSettingsRepository(
|
class ReadSettingsRepository(
|
||||||
@@ -367,6 +368,9 @@ class ReadSettingsRepository(
|
|||||||
suspend fun setShowTitleBarIcons(value: Boolean) =
|
suspend fun setShowTitleBarIcons(value: Boolean) =
|
||||||
settingsRepository.putBoolean(PreferKey.showTitleBarIcons, value)
|
settingsRepository.putBoolean(PreferKey.showTitleBarIcons, value)
|
||||||
|
|
||||||
|
suspend fun setShowMenuIcon(value: Boolean) =
|
||||||
|
settingsRepository.putBoolean(PreferKey.showMenuIcon, value)
|
||||||
|
|
||||||
suspend fun setChineseConverterType(value: Int) =
|
suspend fun setChineseConverterType(value: Int) =
|
||||||
settingsRepository.putInt(PreferKey.chineseConverterType, value)
|
settingsRepository.putInt(PreferKey.chineseConverterType, value)
|
||||||
|
|
||||||
@@ -474,6 +478,7 @@ class ReadSettingsRepository(
|
|||||||
titleBarIconPosition = this[Keys.TitleBarIconPosition] ?: 0,
|
titleBarIconPosition = this[Keys.TitleBarIconPosition] ?: 0,
|
||||||
showTitleBarIcons = this[Keys.ShowTitleBarIcons] ?: false,
|
showTitleBarIcons = this[Keys.ShowTitleBarIcons] ?: false,
|
||||||
chineseConverterType = this[Keys.ChineseConverterType] ?: 0,
|
chineseConverterType = this[Keys.ChineseConverterType] ?: 0,
|
||||||
|
showMenuIcon = this[Keys.ShowMenuIcon] ?: true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -570,5 +575,6 @@ class ReadSettingsRepository(
|
|||||||
val TitleBarIconPosition = intPreferencesKey(PreferKey.titleBarIconPosition)
|
val TitleBarIconPosition = intPreferencesKey(PreferKey.titleBarIconPosition)
|
||||||
val ShowTitleBarIcons = booleanPreferencesKey(PreferKey.showTitleBarIcons)
|
val ShowTitleBarIcons = booleanPreferencesKey(PreferKey.showTitleBarIcons)
|
||||||
val ChineseConverterType = intPreferencesKey(PreferKey.chineseConverterType)
|
val ChineseConverterType = intPreferencesKey(PreferKey.chineseConverterType)
|
||||||
|
val ShowMenuIcon = booleanPreferencesKey(PreferKey.showMenuIcon)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ object ReadBookConfig {
|
|||||||
var hideNavigationBar by prefDelegate(PreferKey.hideNavigationBar, false)
|
var hideNavigationBar by prefDelegate(PreferKey.hideNavigationBar, false)
|
||||||
var useZhLayout by prefDelegate(PreferKey.useZhLayout, false)
|
var useZhLayout by prefDelegate(PreferKey.useZhLayout, false)
|
||||||
var readMenuIconShowText by prefDelegate(PreferKey.readMenuIconShowText, true)
|
var readMenuIconShowText by prefDelegate(PreferKey.readMenuIconShowText, true)
|
||||||
|
var showMenuIcon by prefDelegate(PreferKey.showMenuIcon, true)
|
||||||
var readMenuFloatingBottomBar by prefDelegate(PreferKey.readMenuFloatingBottomBar, false)
|
var readMenuFloatingBottomBar by prefDelegate(PreferKey.readMenuFloatingBottomBar, false)
|
||||||
var readMenuTopBarLiquidGlassButtons by prefDelegate(PreferKey.readMenuTopBarLiquidGlassButtons, false)
|
var readMenuTopBarLiquidGlassButtons by prefDelegate(PreferKey.readMenuTopBarLiquidGlassButtons, false)
|
||||||
var readMenuTopBarTitleCapsule by prefDelegate(PreferKey.readMenuTopBarTitleCapsule, false)
|
var readMenuTopBarTitleCapsule by prefDelegate(PreferKey.readMenuTopBarTitleCapsule, false)
|
||||||
|
|||||||
@@ -208,6 +208,7 @@ data class ReadMenuConfig(
|
|||||||
val brightnessVwPos: String = "1",
|
val brightnessVwPos: String = "1",
|
||||||
val readBrightness: Int = 100,
|
val readBrightness: Int = 100,
|
||||||
val brightnessAuto: Boolean = false,
|
val brightnessAuto: Boolean = false,
|
||||||
|
val showMenuIcon: Boolean = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
@@ -1109,6 +1110,9 @@ sealed interface ConfigUpdate {
|
|||||||
data class TitleBarMode(val value: String) : ConfigUpdate {
|
data class TitleBarMode(val value: String) : ConfigUpdate {
|
||||||
override val actions = emptySet<ConfigUpdateAction>()
|
override val actions = emptySet<ConfigUpdateAction>()
|
||||||
}
|
}
|
||||||
|
data class ShowMenuIcon(val value: Boolean) : ConfigUpdate {
|
||||||
|
override val actions = emptySet<ConfigUpdateAction>()
|
||||||
|
}
|
||||||
data class ReadBodyToLh(val value: Boolean) : ConfigUpdate {
|
data class ReadBodyToLh(val value: Boolean) : ConfigUpdate {
|
||||||
override val actions = setOf(ConfigUpdateAction.ReloadContent)
|
override val actions = setOf(ConfigUpdateAction.ReloadContent)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,19 @@ import androidx.compose.material.icons.filled.Payment
|
|||||||
import androidx.compose.material.icons.filled.Refresh
|
import androidx.compose.material.icons.filled.Refresh
|
||||||
import androidx.compose.material.icons.filled.Search
|
import androidx.compose.material.icons.filled.Search
|
||||||
import androidx.compose.material.icons.filled.SwapHoriz
|
import androidx.compose.material.icons.filled.SwapHoriz
|
||||||
|
import androidx.compose.material.icons.filled.Animation
|
||||||
|
import androidx.compose.material.icons.filled.AutoStories
|
||||||
|
import androidx.compose.material.icons.filled.Bookmark
|
||||||
|
import androidx.compose.material.icons.filled.Build
|
||||||
|
import androidx.compose.material.icons.filled.CleanHands
|
||||||
|
import androidx.compose.material.icons.filled.CloudDownload
|
||||||
|
import androidx.compose.material.icons.filled.FindReplace
|
||||||
|
import androidx.compose.material.icons.filled.Image
|
||||||
|
import androidx.compose.material.icons.filled.Rule
|
||||||
|
import androidx.compose.material.icons.filled.SwapVert
|
||||||
|
import androidx.compose.material.icons.filled.Sync
|
||||||
|
import androidx.compose.material.icons.filled.Toc
|
||||||
|
import androidx.compose.material.icons.filled.Translate
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
@@ -157,6 +170,7 @@ import io.legado.app.ui.widget.components.AppVerticalSlider
|
|||||||
import io.legado.app.ui.widget.components.bookmark.BookmarkEditContent
|
import io.legado.app.ui.widget.components.bookmark.BookmarkEditContent
|
||||||
import io.legado.app.ui.widget.components.button.series.SmallTonalButton
|
import io.legado.app.ui.widget.components.button.series.SmallTonalButton
|
||||||
import io.legado.app.ui.widget.components.divider.PillDivider
|
import io.legado.app.ui.widget.components.divider.PillDivider
|
||||||
|
import io.legado.app.ui.widget.components.icon.AppIcons
|
||||||
import io.legado.app.ui.widget.components.menuItem.MenuItemIcon
|
import io.legado.app.ui.widget.components.menuItem.MenuItemIcon
|
||||||
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenu
|
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenu
|
||||||
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenuItem
|
import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenuItem
|
||||||
@@ -1624,6 +1638,15 @@ private fun OverflowDropdownMenu(
|
|||||||
expanded: Boolean,
|
expanded: Boolean,
|
||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
) {
|
) {
|
||||||
|
val showIcon = state.menuConfig.showMenuIcon
|
||||||
|
val menuIcon: (ImageVector) -> (@Composable () -> Unit)? = { imageVector ->
|
||||||
|
if (showIcon) {
|
||||||
|
{ MenuItemIcon(imageVector = imageVector) }
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RoundDropdownMenu(
|
RoundDropdownMenu(
|
||||||
expanded = expanded,
|
expanded = expanded,
|
||||||
onDismissRequest = onDismiss,
|
onDismissRequest = onDismiss,
|
||||||
@@ -1634,6 +1657,7 @@ private fun OverflowDropdownMenu(
|
|||||||
if (!state.isLocalBook) {
|
if (!state.isLocalBook) {
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.menu_refresh_all),
|
text = stringResource(R.string.menu_refresh_all),
|
||||||
|
leadingIcon = menuIcon(AppIcons.Replay),
|
||||||
onClick = { dismiss(); onIntent(ReadBookIntent.MenuRefreshAll) },
|
onClick = { dismiss(); onIntent(ReadBookIntent.MenuRefreshAll) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1642,6 +1666,7 @@ private fun OverflowDropdownMenu(
|
|||||||
if (state.isLocalTxt) {
|
if (state.isLocalTxt) {
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.txt_toc_rule),
|
text = stringResource(R.string.txt_toc_rule),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.Toc),
|
||||||
onClick = { dismiss(); onIntent(ReadBookIntent.MenuTocRegex) },
|
onClick = { dismiss(); onIntent(ReadBookIntent.MenuTocRegex) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1650,6 +1675,7 @@ private fun OverflowDropdownMenu(
|
|||||||
if (state.isLocalBook) {
|
if (state.isLocalBook) {
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.set_charset),
|
text = stringResource(R.string.set_charset),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.Translate),
|
||||||
onClick = {
|
onClick = {
|
||||||
dismiss()
|
dismiss()
|
||||||
onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.Charset))
|
onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.Charset))
|
||||||
@@ -1662,10 +1688,12 @@ private fun OverflowDropdownMenu(
|
|||||||
// Content operations
|
// Content operations
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.bookmark_add),
|
text = stringResource(R.string.bookmark_add),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.Bookmark),
|
||||||
onClick = { dismiss(); onIntent(ReadBookIntent.AddBookmark) },
|
onClick = { dismiss(); onIntent(ReadBookIntent.AddBookmark) },
|
||||||
)
|
)
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.edit_content),
|
text = stringResource(R.string.edit_content),
|
||||||
|
leadingIcon = menuIcon(AppIcons.Edit),
|
||||||
onClick = {
|
onClick = {
|
||||||
dismiss()
|
dismiss()
|
||||||
onIntent(ReadBookIntent.OpenContentEdit)
|
onIntent(ReadBookIntent.OpenContentEdit)
|
||||||
@@ -1674,6 +1702,7 @@ private fun OverflowDropdownMenu(
|
|||||||
if (!state.isLocalBook) {
|
if (!state.isLocalBook) {
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.offline_cache),
|
text = stringResource(R.string.offline_cache),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.CloudDownload),
|
||||||
onClick = {
|
onClick = {
|
||||||
dismiss()
|
dismiss()
|
||||||
onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.Download))
|
onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.Download))
|
||||||
@@ -1682,10 +1711,12 @@ private fun OverflowDropdownMenu(
|
|||||||
}
|
}
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.update_toc),
|
text = stringResource(R.string.update_toc),
|
||||||
|
leadingIcon = menuIcon(AppIcons.Replay),
|
||||||
onClick = { dismiss(); onIntent(ReadBookIntent.MenuUpdateToc) },
|
onClick = { dismiss(); onIntent(ReadBookIntent.MenuUpdateToc) },
|
||||||
)
|
)
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.simulated_reading),
|
text = stringResource(R.string.simulated_reading),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.AutoStories),
|
||||||
onClick = {
|
onClick = {
|
||||||
dismiss()
|
dismiss()
|
||||||
onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.SimulatedReading))
|
onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.SimulatedReading))
|
||||||
@@ -1693,6 +1724,7 @@ private fun OverflowDropdownMenu(
|
|||||||
)
|
)
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.reverse_content),
|
text = stringResource(R.string.reverse_content),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.SwapVert),
|
||||||
onClick = { dismiss(); onIntent(ReadBookIntent.MenuReverseContent) },
|
onClick = { dismiss(); onIntent(ReadBookIntent.MenuReverseContent) },
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1701,15 +1733,18 @@ private fun OverflowDropdownMenu(
|
|||||||
// Checkable items
|
// Checkable items
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.replace_rule_title),
|
text = stringResource(R.string.replace_rule_title),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.FindReplace),
|
||||||
isSelected = state.useReplaceRule,
|
isSelected = state.useReplaceRule,
|
||||||
onClick = { onIntent(ReadBookIntent.MenuEnableReplace) },
|
onClick = { onIntent(ReadBookIntent.MenuEnableReplace) },
|
||||||
)
|
)
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.replace_rule_title_setting),
|
text = stringResource(R.string.replace_rule_title_setting),
|
||||||
|
leadingIcon = menuIcon(AppIcons.Settings),
|
||||||
onClick = { dismiss(); onIntent(ReadBookIntent.MenuSettingReplace) },
|
onClick = { dismiss(); onIntent(ReadBookIntent.MenuSettingReplace) },
|
||||||
)
|
)
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.effective_replaces),
|
text = stringResource(R.string.effective_replaces),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.Rule),
|
||||||
onClick = {
|
onClick = {
|
||||||
dismiss()
|
dismiss()
|
||||||
onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.EffectiveReplaces))
|
onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.EffectiveReplaces))
|
||||||
@@ -1717,11 +1752,13 @@ private fun OverflowDropdownMenu(
|
|||||||
)
|
)
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.same_title_removed),
|
text = stringResource(R.string.same_title_removed),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.CleanHands),
|
||||||
isSelected = state.sameTitleRemoved,
|
isSelected = state.sameTitleRemoved,
|
||||||
onClick = { onIntent(ReadBookIntent.MenuSameTitleRemoved) },
|
onClick = { onIntent(ReadBookIntent.MenuSameTitleRemoved) },
|
||||||
)
|
)
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.re_segment),
|
text = stringResource(R.string.re_segment),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.Toc),
|
||||||
isSelected = state.reSegment,
|
isSelected = state.reSegment,
|
||||||
onClick = { onIntent(ReadBookIntent.MenuReSegment) },
|
onClick = { onIntent(ReadBookIntent.MenuReSegment) },
|
||||||
)
|
)
|
||||||
@@ -1730,11 +1767,13 @@ private fun OverflowDropdownMenu(
|
|||||||
if (state.isEpub) {
|
if (state.isEpub) {
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.del_ruby_tag),
|
text = stringResource(R.string.del_ruby_tag),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.CleanHands),
|
||||||
isSelected = state.delRubyTag,
|
isSelected = state.delRubyTag,
|
||||||
onClick = { onIntent(ReadBookIntent.MenuDelRubyTag) },
|
onClick = { onIntent(ReadBookIntent.MenuDelRubyTag) },
|
||||||
)
|
)
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.del_h_tag),
|
text = stringResource(R.string.del_h_tag),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.CleanHands),
|
||||||
isSelected = state.delHTag,
|
isSelected = state.delHTag,
|
||||||
onClick = { onIntent(ReadBookIntent.MenuDelHTag) },
|
onClick = { onIntent(ReadBookIntent.MenuDelHTag) },
|
||||||
)
|
)
|
||||||
@@ -1746,6 +1785,7 @@ private fun OverflowDropdownMenu(
|
|||||||
Box {
|
Box {
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.image_style),
|
text = stringResource(R.string.image_style),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.Image),
|
||||||
onClick = { imageStyleExpanded = true },
|
onClick = { imageStyleExpanded = true },
|
||||||
)
|
)
|
||||||
RoundDropdownMenu(
|
RoundDropdownMenu(
|
||||||
@@ -1784,6 +1824,7 @@ private fun OverflowDropdownMenu(
|
|||||||
}
|
}
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.book_page_anim),
|
text = stringResource(R.string.book_page_anim),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.Animation),
|
||||||
onClick = {
|
onClick = {
|
||||||
dismiss()
|
dismiss()
|
||||||
onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.PageAnim))
|
onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.PageAnim))
|
||||||
@@ -1791,6 +1832,7 @@ private fun OverflowDropdownMenu(
|
|||||||
)
|
)
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.config_btn),
|
text = stringResource(R.string.config_btn),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.Build),
|
||||||
onClick = {
|
onClick = {
|
||||||
dismiss()
|
dismiss()
|
||||||
onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.ToolButtonConfig))
|
onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.ToolButtonConfig))
|
||||||
@@ -1801,10 +1843,12 @@ private fun OverflowDropdownMenu(
|
|||||||
if (state.isReadingProgressSyncConfigured) {
|
if (state.isReadingProgressSyncConfigured) {
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.get_book_progress),
|
text = stringResource(R.string.get_book_progress),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.Sync),
|
||||||
onClick = { dismiss(); onIntent(ReadBookIntent.MenuGetProgress) },
|
onClick = { dismiss(); onIntent(ReadBookIntent.MenuGetProgress) },
|
||||||
)
|
)
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.cover_book_progress),
|
text = stringResource(R.string.cover_book_progress),
|
||||||
|
leadingIcon = menuIcon(Icons.Default.Sync),
|
||||||
onClick = { dismiss(); onIntent(ReadBookIntent.MenuCoverProgress) },
|
onClick = { dismiss(); onIntent(ReadBookIntent.MenuCoverProgress) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1813,6 +1857,7 @@ private fun OverflowDropdownMenu(
|
|||||||
|
|
||||||
RoundDropdownMenuItem(
|
RoundDropdownMenuItem(
|
||||||
text = stringResource(R.string.log),
|
text = stringResource(R.string.log),
|
||||||
|
leadingIcon = menuIcon(AppIcons.BugReport),
|
||||||
onClick = {
|
onClick = {
|
||||||
dismiss()
|
dismiss()
|
||||||
onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.AppLog))
|
onIntent(ReadBookIntent.ShowSheet(ReadBookSheet.AppLog))
|
||||||
|
|||||||
@@ -1680,6 +1680,7 @@ class ReadBookViewModel(
|
|||||||
ReadConfig.syncReadPreferences(preferences)
|
ReadConfig.syncReadPreferences(preferences)
|
||||||
ReadBookConfig.readMenuPaletteStyle = preferences.readMenuPaletteStyle
|
ReadBookConfig.readMenuPaletteStyle = preferences.readMenuPaletteStyle
|
||||||
_readPreferences.value = preferences
|
_readPreferences.value = preferences
|
||||||
|
_uiState.update { syncFromReadBook(it) }
|
||||||
if (!preferences.hasMenuClickArea()) {
|
if (!preferences.hasMenuClickArea()) {
|
||||||
ReadConfig.detectClickArea()
|
ReadConfig.detectClickArea()
|
||||||
readSettingsRepository.setClickAction(PreferKey.clickActionMC, 0)
|
readSettingsRepository.setClickAction(PreferKey.clickActionMC, 0)
|
||||||
@@ -1850,6 +1851,7 @@ class ReadBookViewModel(
|
|||||||
brightnessVwPos = ReadBookConfig.brightnessVwPos,
|
brightnessVwPos = ReadBookConfig.brightnessVwPos,
|
||||||
readBrightness = ReadBookConfig.readBrightness,
|
readBrightness = ReadBookConfig.readBrightness,
|
||||||
brightnessAuto = ReadBookConfig.brightnessAuto,
|
brightnessAuto = ReadBookConfig.brightnessAuto,
|
||||||
|
showMenuIcon = ReadBookConfig.showMenuIcon,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3099,6 +3101,13 @@ class ReadBookViewModel(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
is ConfigUpdate.ShowMenuIcon -> {
|
||||||
|
ReadBookConfig.showMenuIcon = update.value
|
||||||
|
viewModelScope.launch {
|
||||||
|
readSettingsRepository.setShowMenuIcon(update.value)
|
||||||
|
}
|
||||||
|
_uiState.update { it.copy(menuConfig = it.menuConfig.copy(showMenuIcon = update.value)) }
|
||||||
|
}
|
||||||
is ConfigUpdate.MenuTopBarBlurMode -> {
|
is ConfigUpdate.MenuTopBarBlurMode -> {
|
||||||
val mode = update.value.coerceIn(0, 2).let {
|
val mode = update.value.coerceIn(0, 2).let {
|
||||||
if (it == ReadMenuBlurMode.LiquidGlass) ReadMenuBlurMode.Haze else it
|
if (it == ReadMenuBlurMode.LiquidGlass) ReadMenuBlurMode.Haze else it
|
||||||
|
|||||||
@@ -147,6 +147,9 @@ fun MoreConfigSheet(
|
|||||||
onShowReadTitleAdditionChange = {
|
onShowReadTitleAdditionChange = {
|
||||||
onIntent(ReadBookIntent.UpdateConfig(ConfigUpdate.ShowReadTitleAddition(it)))
|
onIntent(ReadBookIntent.UpdateConfig(ConfigUpdate.ShowReadTitleAddition(it)))
|
||||||
},
|
},
|
||||||
|
onShowMenuIconChange = {
|
||||||
|
onIntent(ReadBookIntent.UpdateConfig(ConfigUpdate.ShowMenuIcon(it)))
|
||||||
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -299,6 +302,7 @@ private fun OtherSettings(
|
|||||||
onOpenPageKeyConfig: () -> Unit,
|
onOpenPageKeyConfig: () -> Unit,
|
||||||
onExpandTextMenuChange: (Boolean) -> Unit,
|
onExpandTextMenuChange: (Boolean) -> Unit,
|
||||||
onShowReadTitleAdditionChange: (Boolean) -> Unit,
|
onShowReadTitleAdditionChange: (Boolean) -> Unit,
|
||||||
|
onShowMenuIconChange: (Boolean) -> Unit,
|
||||||
) {
|
) {
|
||||||
val clickImageWayEntries = stringArrayResource(R.array.click_image_way_title)
|
val clickImageWayEntries = stringArrayResource(R.array.click_image_way_title)
|
||||||
val clickImageWayValues = stringArrayResource(R.array.click_image_way_value)
|
val clickImageWayValues = stringArrayResource(R.array.click_image_way_value)
|
||||||
@@ -363,4 +367,9 @@ private fun OtherSettings(
|
|||||||
checked = preferences.showReadTitleAddition,
|
checked = preferences.showReadTitleAddition,
|
||||||
onCheckedChange = onShowReadTitleAdditionChange,
|
onCheckedChange = onShowReadTitleAdditionChange,
|
||||||
)
|
)
|
||||||
|
TinySwitchSettingItem(
|
||||||
|
title = stringResource(R.string.show_menu_icon),
|
||||||
|
checked = preferences.showMenuIcon,
|
||||||
|
onCheckedChange = onShowMenuIconChange,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,9 @@ object ReadConfig {
|
|||||||
var showReadTitleAddition
|
var showReadTitleAddition
|
||||||
get() = ReadMenuConfig.showReadTitleAddition
|
get() = ReadMenuConfig.showReadTitleAddition
|
||||||
set(value) { ReadMenuConfig.showReadTitleAddition = value }
|
set(value) { ReadMenuConfig.showReadTitleAddition = value }
|
||||||
|
var showMenuIcon
|
||||||
|
get() = ReadMenuConfig.showMenuIcon
|
||||||
|
set(value) { ReadMenuConfig.showMenuIcon = value }
|
||||||
var clickActionTL
|
var clickActionTL
|
||||||
get() = ReadMenuConfig.clickActionTL
|
get() = ReadMenuConfig.clickActionTL
|
||||||
set(value) { ReadMenuConfig.clickActionTL = value }
|
set(value) { ReadMenuConfig.clickActionTL = value }
|
||||||
@@ -262,6 +265,7 @@ object ReadConfig {
|
|||||||
progressBarBehavior = preferences.progressBarBehavior
|
progressBarBehavior = preferences.progressBarBehavior
|
||||||
expandTextMenu = preferences.expandTextMenu
|
expandTextMenu = preferences.expandTextMenu
|
||||||
showReadTitleAddition = preferences.showReadTitleAddition
|
showReadTitleAddition = preferences.showReadTitleAddition
|
||||||
|
showMenuIcon = preferences.showMenuIcon
|
||||||
clickActionTL = preferences.clickActionTL
|
clickActionTL = preferences.clickActionTL
|
||||||
clickActionTC = preferences.clickActionTC
|
clickActionTC = preferences.clickActionTC
|
||||||
clickActionTR = preferences.clickActionTR
|
clickActionTR = preferences.clickActionTR
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ data class ReadConfigUiState(
|
|||||||
val showReadTitleAddition: Boolean = true,
|
val showReadTitleAddition: Boolean = true,
|
||||||
val autoReadSpeed: Int = 10,
|
val autoReadSpeed: Int = 10,
|
||||||
val prevKeys: String = "",
|
val prevKeys: String = "",
|
||||||
val nextKeys: String = ""
|
val nextKeys: String = "",
|
||||||
|
val showMenuIcon: Boolean = true
|
||||||
)
|
)
|
||||||
|
|
||||||
sealed interface ReadConfigIntent {
|
sealed interface ReadConfigIntent {
|
||||||
@@ -76,5 +77,6 @@ sealed interface ReadConfigIntent {
|
|||||||
data class DisableReturnKeyChanged(val value: Boolean) : ReadConfigIntent
|
data class DisableReturnKeyChanged(val value: Boolean) : ReadConfigIntent
|
||||||
data class ExpandTextMenuChanged(val value: Boolean) : ReadConfigIntent
|
data class ExpandTextMenuChanged(val value: Boolean) : ReadConfigIntent
|
||||||
data class ShowReadTitleAdditionChanged(val value: Boolean) : ReadConfigIntent
|
data class ShowReadTitleAdditionChanged(val value: Boolean) : ReadConfigIntent
|
||||||
|
data class ShowMenuIconChanged(val value: Boolean) : ReadConfigIntent
|
||||||
data class PageKeysChanged(val prevKeys: String, val nextKeys: String) : ReadConfigIntent
|
data class PageKeysChanged(val prevKeys: String, val nextKeys: String) : ReadConfigIntent
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -376,6 +376,14 @@ fun ReadConfigScreen(
|
|||||||
viewModel.onIntent(ReadConfigIntent.ShowReadTitleAdditionChanged(it))
|
viewModel.onIntent(ReadConfigIntent.ShowReadTitleAdditionChanged(it))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SwitchSettingItem(
|
||||||
|
title = stringResource(R.string.show_menu_icon),
|
||||||
|
checked = state.showMenuIcon,
|
||||||
|
onCheckedChange = {
|
||||||
|
viewModel.onIntent(ReadConfigIntent.ShowMenuIconChanged(it))
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,6 +203,12 @@ class ReadConfigViewModel(
|
|||||||
postEvent(EventBus.UPDATE_READ_ACTION_BAR, true)
|
postEvent(EventBus.UPDATE_READ_ACTION_BAR, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is ReadConfigIntent.ShowMenuIconChanged -> {
|
||||||
|
ReadConfig.showMenuIcon = intent.value
|
||||||
|
readSettingsRepository.setShowMenuIcon(intent.value)
|
||||||
|
postEvent(EventBus.UPDATE_READ_ACTION_BAR, true)
|
||||||
|
}
|
||||||
|
|
||||||
is ReadConfigIntent.PageKeysChanged -> {
|
is ReadConfigIntent.PageKeysChanged -> {
|
||||||
readSettingsRepository.setPageKeys(intent.prevKeys, intent.nextKeys)
|
readSettingsRepository.setPageKeys(intent.prevKeys, intent.nextKeys)
|
||||||
}
|
}
|
||||||
@@ -260,7 +266,8 @@ class ReadConfigViewModel(
|
|||||||
showReadTitleAddition = showReadTitleAddition,
|
showReadTitleAddition = showReadTitleAddition,
|
||||||
autoReadSpeed = autoReadSpeed,
|
autoReadSpeed = autoReadSpeed,
|
||||||
prevKeys = prevKeys,
|
prevKeys = prevKeys,
|
||||||
nextKeys = nextKeys
|
nextKeys = nextKeys,
|
||||||
|
showMenuIcon = showMenuIcon
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ object ReadMenuConfig {
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var showMenuIcon by prefDelegate(
|
||||||
|
PreferKey.showMenuIcon,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
|
||||||
// --- 点击区域配置 ---
|
// --- 点击区域配置 ---
|
||||||
|
|
||||||
var clickActionTL by prefDelegate(
|
var clickActionTL by prefDelegate(
|
||||||
|
|||||||
@@ -1138,6 +1138,7 @@
|
|||||||
<string name="custom_welcome">自定义欢迎页</string>
|
<string name="custom_welcome">自定义欢迎页</string>
|
||||||
<string name="custom_welcome_summary">是否使用自定义欢迎页</string>
|
<string name="custom_welcome_summary">是否使用自定义欢迎页</string>
|
||||||
<string name="show_icon">显示图标</string>
|
<string name="show_icon">显示图标</string>
|
||||||
|
<string name="show_menu_icon">展示菜单项图标</string>
|
||||||
<string name="show_default_book_icon">显示默认书籍图标</string>
|
<string name="show_default_book_icon">显示默认书籍图标</string>
|
||||||
<string name="cache_export">书籍缓存</string>
|
<string name="cache_export">书籍缓存</string>
|
||||||
<string name="assists_key_config">辅助按键配置</string>
|
<string name="assists_key_config">辅助按键配置</string>
|
||||||
|
|||||||
@@ -906,6 +906,7 @@
|
|||||||
<string name="restore_ignore">Bypass List</string>
|
<string name="restore_ignore">Bypass List</string>
|
||||||
<string name="restore_ignore_summary">Ignore some contents while restoring</string>
|
<string name="restore_ignore_summary">Ignore some contents while restoring</string>
|
||||||
<string name="read_config">Reading Interface Settings</string>
|
<string name="read_config">Reading Interface Settings</string>
|
||||||
|
<string name="show_menu_icon">Show Menu Item Icons</string>
|
||||||
<string name="read_config_global_theme">Global & Theme</string>
|
<string name="read_config_global_theme">Global & Theme</string>
|
||||||
<string name="read_config_layout_spacing">Layout & Spacing</string>
|
<string name="read_config_layout_spacing">Layout & Spacing</string>
|
||||||
<string name="read_config_text_effects">Text & Effects</string>
|
<string name="read_config_text_effects">Text & Effects</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user