mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 03:07:25 +01:00
Replace library sheet display modes with FlowRow of Chips
This commit is contained in:
parent
09e4b5a9cd
commit
30bea8b753
@ -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,24 +169,27 @@ private fun ColumnScope.SortPage(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
private val displayModes = listOf(
|
||||||
private fun ColumnScope.DisplayPage(
|
|
||||||
screenModel: LibrarySettingsScreenModel,
|
|
||||||
) {
|
|
||||||
HeadingItem(R.string.action_display_mode)
|
|
||||||
val displayMode by screenModel.libraryPreferences.libraryDisplayMode().collectAsState()
|
|
||||||
listOf(
|
|
||||||
R.string.action_display_grid to LibraryDisplayMode.CompactGrid,
|
R.string.action_display_grid to LibraryDisplayMode.CompactGrid,
|
||||||
R.string.action_display_comfortable_grid to LibraryDisplayMode.ComfortableGrid,
|
R.string.action_display_comfortable_grid to LibraryDisplayMode.ComfortableGrid,
|
||||||
R.string.action_display_cover_only_grid to LibraryDisplayMode.CoverOnlyGrid,
|
R.string.action_display_cover_only_grid to LibraryDisplayMode.CoverOnlyGrid,
|
||||||
R.string.action_display_list to LibraryDisplayMode.List,
|
R.string.action_display_list to LibraryDisplayMode.List,
|
||||||
).map { (titleRes, mode) ->
|
)
|
||||||
RadioItem(
|
|
||||||
label = stringResource(titleRes),
|
@Composable
|
||||||
selected = displayMode == mode,
|
private fun ColumnScope.DisplayPage(
|
||||||
|
screenModel: LibrarySettingsScreenModel,
|
||||||
|
) {
|
||||||
|
val displayMode by screenModel.libraryPreferences.libraryDisplayMode().collectAsState()
|
||||||
|
SettingsFlowRow(R.string.action_display_mode) {
|
||||||
|
displayModes.map { (titleRes, mode) ->
|
||||||
|
ChoiceChip(
|
||||||
|
isSelected = displayMode == mode,
|
||||||
onClick = { screenModel.setDisplayMode(mode) },
|
onClick = { screenModel.setDisplayMode(mode) },
|
||||||
|
content = { Text(stringResource(titleRes)) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (displayMode != LibraryDisplayMode.List) {
|
if (displayMode != LibraryDisplayMode.List) {
|
||||||
val configuration = LocalConfiguration.current
|
val configuration = LocalConfiguration.current
|
||||||
|
Loading…
Reference in New Issue
Block a user