mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-09 18:48:55 +01:00
Remove per-category display mode
There seems to be little value in this feature, and juggling flag masks is annoying. Per-category sorting is still a thing, but could be refactored away from the flag in the feature.
This commit is contained in:
@@ -29,7 +29,6 @@ import eu.kanade.tachiyomi.ui.library.LibrarySettingsScreenModel
|
||||
import tachiyomi.domain.category.model.Category
|
||||
import tachiyomi.domain.library.model.LibraryDisplayMode
|
||||
import tachiyomi.domain.library.model.LibrarySort
|
||||
import tachiyomi.domain.library.model.display
|
||||
import tachiyomi.domain.library.model.sort
|
||||
import tachiyomi.domain.library.service.LibraryPreferences
|
||||
import tachiyomi.domain.manga.model.TriStateFilter
|
||||
@@ -43,7 +42,7 @@ import tachiyomi.presentation.core.components.SortItem
|
||||
fun LibrarySettingsDialog(
|
||||
onDismissRequest: () -> Unit,
|
||||
screenModel: LibrarySettingsScreenModel,
|
||||
category: Category,
|
||||
category: Category?,
|
||||
) {
|
||||
TabbedDialog(
|
||||
onDismissRequest = onDismissRequest,
|
||||
@@ -67,7 +66,6 @@ fun LibrarySettingsDialog(
|
||||
screenModel = screenModel,
|
||||
)
|
||||
2 -> DisplayPage(
|
||||
category = category,
|
||||
screenModel = screenModel,
|
||||
)
|
||||
}
|
||||
@@ -146,7 +144,7 @@ private fun ColumnScope.FilterPage(
|
||||
|
||||
@Composable
|
||||
private fun ColumnScope.SortPage(
|
||||
category: Category,
|
||||
category: Category?,
|
||||
screenModel: LibrarySettingsScreenModel,
|
||||
) {
|
||||
val sortingMode = category.sort.type
|
||||
@@ -179,10 +177,10 @@ private fun ColumnScope.SortPage(
|
||||
|
||||
@Composable
|
||||
private fun ColumnScope.DisplayPage(
|
||||
category: Category,
|
||||
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_comfortable_grid to LibraryDisplayMode.ComfortableGrid,
|
||||
@@ -191,12 +189,12 @@ private fun ColumnScope.DisplayPage(
|
||||
).map { (titleRes, mode) ->
|
||||
RadioItem(
|
||||
label = stringResource(titleRes),
|
||||
selected = category.display == mode,
|
||||
onClick = { screenModel.setDisplayMode(category, mode) },
|
||||
selected = displayMode == mode,
|
||||
onClick = { screenModel.setDisplayMode(mode) },
|
||||
)
|
||||
}
|
||||
|
||||
if (category.display != LibraryDisplayMode.List) {
|
||||
if (displayMode != LibraryDisplayMode.List) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
|
||||
@@ -42,7 +42,7 @@ fun LibraryContent(
|
||||
onRefresh: (Category?) -> Boolean,
|
||||
onGlobalSearchClicked: () -> Unit,
|
||||
getNumberOfMangaForCategory: (Category) -> Int?,
|
||||
getDisplayModeForPage: @Composable (Int) -> LibraryDisplayMode,
|
||||
getDisplayMode: (Int) -> PreferenceMutableState<LibraryDisplayMode>,
|
||||
getColumnsForOrientation: (Boolean) -> PreferenceMutableState<Int>,
|
||||
getLibraryForPage: (Int) -> List<LibraryItem>,
|
||||
) {
|
||||
@@ -102,7 +102,7 @@ fun LibraryContent(
|
||||
selectedManga = selection,
|
||||
searchQuery = searchQuery,
|
||||
onGlobalSearchClicked = onGlobalSearchClicked,
|
||||
getDisplayModeForPage = getDisplayModeForPage,
|
||||
getDisplayMode = getDisplayMode,
|
||||
getColumnsForOrientation = getColumnsForOrientation,
|
||||
getLibraryForPage = getLibraryForPage,
|
||||
onClickManga = onClickManga,
|
||||
|
||||
@@ -34,7 +34,7 @@ fun LibraryPager(
|
||||
selectedManga: List<LibraryManga>,
|
||||
searchQuery: String?,
|
||||
onGlobalSearchClicked: () -> Unit,
|
||||
getDisplayModeForPage: @Composable (Int) -> LibraryDisplayMode,
|
||||
getDisplayMode: (Int) -> PreferenceMutableState<LibraryDisplayMode>,
|
||||
getColumnsForOrientation: (Boolean) -> PreferenceMutableState<Int>,
|
||||
getLibraryForPage: (Int) -> List<LibraryItem>,
|
||||
onClickManga: (LibraryManga) -> Unit,
|
||||
@@ -62,7 +62,7 @@ fun LibraryPager(
|
||||
return@HorizontalPager
|
||||
}
|
||||
|
||||
val displayMode = getDisplayModeForPage(page)
|
||||
val displayMode by getDisplayMode(page)
|
||||
val columns by if (displayMode != LibraryDisplayMode.List) {
|
||||
val configuration = LocalConfiguration.current
|
||||
val isLandscape = configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
|
||||
|
||||
Reference in New Issue
Block a user