mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-12 03:58:56 +01:00
Tweak flag classes for Library (#7829)
* Tweak flag classes for Library - Add interface for Flag and Mask - Merge Sort Type and Direction into one class - Use custom serializers for preferences - Mainly to not break the old * Review changes
This commit is contained in:
@@ -24,7 +24,7 @@ import eu.kanade.presentation.library.LibraryState
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.database.models.LibraryManga
|
||||
import eu.kanade.tachiyomi.ui.library.LibraryItem
|
||||
import eu.kanade.tachiyomi.ui.library.setting.DisplayModeSetting
|
||||
import eu.kanade.tachiyomi.ui.library.setting.LibraryDisplayMode
|
||||
import eu.kanade.tachiyomi.widget.EmptyView
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -45,7 +45,7 @@ fun LibraryContent(
|
||||
onRefresh: (Category?) -> Boolean,
|
||||
onGlobalSearchClicked: () -> Unit,
|
||||
getNumberOfMangaForCategory: @Composable (Long) -> State<Int?>,
|
||||
getDisplayModeForPage: @Composable (Int) -> State<DisplayModeSetting>,
|
||||
getDisplayModeForPage: @Composable (Int) -> State<LibraryDisplayMode>,
|
||||
getColumnsForOrientation: (Boolean) -> PreferenceMutableState<Int>,
|
||||
getLibraryForPage: @Composable (Int) -> State<List<LibraryItem>>,
|
||||
) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import com.google.accompanist.pager.PagerState
|
||||
import eu.kanade.core.prefs.PreferenceMutableState
|
||||
import eu.kanade.tachiyomi.data.database.models.LibraryManga
|
||||
import eu.kanade.tachiyomi.ui.library.LibraryItem
|
||||
import eu.kanade.tachiyomi.ui.library.setting.DisplayModeSetting
|
||||
import eu.kanade.tachiyomi.ui.library.setting.LibraryDisplayMode
|
||||
|
||||
@Composable
|
||||
fun LibraryPager(
|
||||
@@ -24,7 +24,7 @@ fun LibraryPager(
|
||||
selectedManga: List<LibraryManga>,
|
||||
searchQuery: String?,
|
||||
onGlobalSearchClicked: () -> Unit,
|
||||
getDisplayModeForPage: @Composable (Int) -> State<DisplayModeSetting>,
|
||||
getDisplayModeForPage: @Composable (Int) -> State<LibraryDisplayMode>,
|
||||
getColumnsForOrientation: (Boolean) -> PreferenceMutableState<Int>,
|
||||
getLibraryForPage: @Composable (Int) -> State<List<LibraryItem>>,
|
||||
onClickManga: (LibraryManga) -> Unit,
|
||||
@@ -42,7 +42,7 @@ fun LibraryPager(
|
||||
}
|
||||
val library by getLibraryForPage(page)
|
||||
val displayMode by getDisplayModeForPage(page)
|
||||
val columns by if (displayMode != DisplayModeSetting.LIST) {
|
||||
val columns by if (displayMode != LibraryDisplayMode.List) {
|
||||
val configuration = LocalConfiguration.current
|
||||
val isLandscape = configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
|
||||
|
||||
@@ -52,7 +52,7 @@ fun LibraryPager(
|
||||
}
|
||||
|
||||
when (displayMode) {
|
||||
DisplayModeSetting.LIST -> {
|
||||
LibraryDisplayMode.List -> {
|
||||
LibraryList(
|
||||
items = library,
|
||||
selection = selectedManga,
|
||||
@@ -62,7 +62,7 @@ fun LibraryPager(
|
||||
onGlobalSearchClicked = onGlobalSearchClicked,
|
||||
)
|
||||
}
|
||||
DisplayModeSetting.COMPACT_GRID -> {
|
||||
LibraryDisplayMode.CompactGrid -> {
|
||||
LibraryCompactGrid(
|
||||
items = library,
|
||||
columns = columns,
|
||||
@@ -73,7 +73,7 @@ fun LibraryPager(
|
||||
onGlobalSearchClicked = onGlobalSearchClicked,
|
||||
)
|
||||
}
|
||||
DisplayModeSetting.COMFORTABLE_GRID -> {
|
||||
LibraryDisplayMode.ComfortableGrid -> {
|
||||
LibraryComfortableGrid(
|
||||
items = library,
|
||||
columns = columns,
|
||||
@@ -84,7 +84,7 @@ fun LibraryPager(
|
||||
onGlobalSearchClicked = onGlobalSearchClicked,
|
||||
)
|
||||
}
|
||||
DisplayModeSetting.COVER_ONLY_GRID -> {
|
||||
LibraryDisplayMode.CoverOnlyGrid -> {
|
||||
LibraryCoverOnlyGrid(
|
||||
items = library,
|
||||
columns = columns,
|
||||
|
||||
Reference in New Issue
Block a user