mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-28 23:53:16 -05:00
Replace library sheet display modes with FlowRow of Chips
This commit is contained in:
parent
09e4b5a9cd
commit
30bea8b753
1 changed files with 18 additions and 13 deletions
|
@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.ColumnScope
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
|
@ -25,10 +26,11 @@ import tachiyomi.domain.library.model.sort
|
||||||
import tachiyomi.domain.library.service.LibraryPreferences
|
import tachiyomi.domain.library.service.LibraryPreferences
|
||||||
import tachiyomi.presentation.core.components.CheckboxItem
|
import tachiyomi.presentation.core.components.CheckboxItem
|
||||||
import tachiyomi.presentation.core.components.HeadingItem
|
import tachiyomi.presentation.core.components.HeadingItem
|
||||||
import tachiyomi.presentation.core.components.RadioItem
|
import tachiyomi.presentation.core.components.SettingsFlowRow
|
||||||
import tachiyomi.presentation.core.components.SliderItem
|
import tachiyomi.presentation.core.components.SliderItem
|
||||||
import tachiyomi.presentation.core.components.SortItem
|
import tachiyomi.presentation.core.components.SortItem
|
||||||
import tachiyomi.presentation.core.components.TriStateItem
|
import tachiyomi.presentation.core.components.TriStateItem
|
||||||
|
import tachiyomi.presentation.core.components.material.ChoiceChip
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LibrarySettingsDialog(
|
fun LibrarySettingsDialog(
|
||||||
|
@ -167,23 +169,26 @@ private fun ColumnScope.SortPage(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val displayModes = listOf(
|
||||||
|
R.string.action_display_grid to LibraryDisplayMode.CompactGrid,
|
||||||
|
R.string.action_display_comfortable_grid to LibraryDisplayMode.ComfortableGrid,
|
||||||
|
R.string.action_display_cover_only_grid to LibraryDisplayMode.CoverOnlyGrid,
|
||||||
|
R.string.action_display_list to LibraryDisplayMode.List,
|
||||||
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ColumnScope.DisplayPage(
|
private fun ColumnScope.DisplayPage(
|
||||||
screenModel: LibrarySettingsScreenModel,
|
screenModel: LibrarySettingsScreenModel,
|
||||||
) {
|
) {
|
||||||
HeadingItem(R.string.action_display_mode)
|
|
||||||
val displayMode by screenModel.libraryPreferences.libraryDisplayMode().collectAsState()
|
val displayMode by screenModel.libraryPreferences.libraryDisplayMode().collectAsState()
|
||||||
listOf(
|
SettingsFlowRow(R.string.action_display_mode) {
|
||||||
R.string.action_display_grid to LibraryDisplayMode.CompactGrid,
|
displayModes.map { (titleRes, mode) ->
|
||||||
R.string.action_display_comfortable_grid to LibraryDisplayMode.ComfortableGrid,
|
ChoiceChip(
|
||||||
R.string.action_display_cover_only_grid to LibraryDisplayMode.CoverOnlyGrid,
|
isSelected = displayMode == mode,
|
||||||
R.string.action_display_list to LibraryDisplayMode.List,
|
onClick = { screenModel.setDisplayMode(mode) },
|
||||||
).map { (titleRes, mode) ->
|
content = { Text(stringResource(titleRes)) },
|
||||||
RadioItem(
|
)
|
||||||
label = stringResource(titleRes),
|
}
|
||||||
selected = displayMode == mode,
|
|
||||||
onClick = { screenModel.setDisplayMode(mode) },
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (displayMode != LibraryDisplayMode.List) {
|
if (displayMode != LibraryDisplayMode.List) {
|
||||||
|
|
Loading…
Reference in a new issue