Drop kotlinx-collections-immutable usage (#3380)
This commit is contained in:
@@ -199,7 +199,6 @@ dependencies {
|
|||||||
implementation(libs.androidx.sqlite.bundled)
|
implementation(libs.androidx.sqlite.bundled)
|
||||||
|
|
||||||
implementation(libs.kotlin.reflect)
|
implementation(libs.kotlin.reflect)
|
||||||
implementation(libs.kotlinx.collections.immutable)
|
|
||||||
|
|
||||||
implementation(libs.bundles.kotlinx.coroutines)
|
implementation(libs.bundles.kotlinx.coroutines)
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import eu.kanade.presentation.browse.components.BrowseSourceList
|
|||||||
import eu.kanade.presentation.components.AppBar
|
import eu.kanade.presentation.components.AppBar
|
||||||
import eu.kanade.presentation.util.formattedMessage
|
import eu.kanade.presentation.util.formattedMessage
|
||||||
import eu.kanade.tachiyomi.source.Source
|
import eu.kanade.tachiyomi.source.Source
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import tachiyomi.core.common.i18n.stringResource
|
import tachiyomi.core.common.i18n.stringResource
|
||||||
import tachiyomi.domain.library.model.LibraryDisplayMode
|
import tachiyomi.domain.library.model.LibraryDisplayMode
|
||||||
@@ -86,7 +85,7 @@ fun BrowseSourceContent(
|
|||||||
else -> stringResource(MR.strings.no_results_found)
|
else -> stringResource(MR.strings.no_results_found)
|
||||||
},
|
},
|
||||||
actions = if (source is LocalSource) {
|
actions = if (source is LocalSource) {
|
||||||
persistentListOf(
|
listOf(
|
||||||
EmptyScreenAction(
|
EmptyScreenAction(
|
||||||
stringRes = MR.strings.local_source_help_guide,
|
stringRes = MR.strings.local_source_help_guide,
|
||||||
icon = Icons.AutoMirrored.Outlined.HelpOutline,
|
icon = Icons.AutoMirrored.Outlined.HelpOutline,
|
||||||
@@ -94,7 +93,7 @@ fun BrowseSourceContent(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
persistentListOf(
|
listOf(
|
||||||
EmptyScreenAction(
|
EmptyScreenAction(
|
||||||
stringRes = MR.strings.action_retry,
|
stringRes = MR.strings.action_retry,
|
||||||
icon = Icons.Outlined.Refresh,
|
icon = Icons.Outlined.Refresh,
|
||||||
|
|||||||
@@ -56,8 +56,6 @@ import eu.kanade.tachiyomi.source.ConfigurableSource
|
|||||||
import eu.kanade.tachiyomi.ui.browse.extension.details.ExtensionDetailsScreenModel
|
import eu.kanade.tachiyomi.ui.browse.extension.details.ExtensionDetailsScreenModel
|
||||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
|
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
|
||||||
import tachiyomi.presentation.core.components.material.Scaffold
|
import tachiyomi.presentation.core.components.material.Scaffold
|
||||||
@@ -95,37 +93,35 @@ fun ExtensionDetailsScreen(
|
|||||||
navigateUp = navigateUp,
|
navigateUp = navigateUp,
|
||||||
actions = {
|
actions = {
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
actions = persistentListOf<AppBar.AppBarAction>().builder()
|
actions = buildList {
|
||||||
.apply {
|
if (url != null) {
|
||||||
if (url != null) {
|
add(
|
||||||
add(
|
AppBar.Action(
|
||||||
AppBar.Action(
|
title = stringResource(MR.strings.action_open_repo),
|
||||||
title = stringResource(MR.strings.action_open_repo),
|
icon = Icons.AutoMirrored.Outlined.Launch,
|
||||||
icon = Icons.AutoMirrored.Outlined.Launch,
|
onClick = {
|
||||||
onClick = {
|
uriHandler.openUri(url)
|
||||||
uriHandler.openUri(url)
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
addAll(
|
|
||||||
listOf(
|
|
||||||
AppBar.OverflowAction(
|
|
||||||
title = stringResource(MR.strings.action_enable_all),
|
|
||||||
onClick = onClickEnableAll,
|
|
||||||
),
|
|
||||||
AppBar.OverflowAction(
|
|
||||||
title = stringResource(MR.strings.action_disable_all),
|
|
||||||
onClick = onClickDisableAll,
|
|
||||||
),
|
|
||||||
AppBar.OverflowAction(
|
|
||||||
title = stringResource(MR.strings.pref_clear_cookies),
|
|
||||||
onClick = onClickClearCookies,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.build(),
|
addAll(
|
||||||
|
listOf(
|
||||||
|
AppBar.OverflowAction(
|
||||||
|
title = stringResource(MR.strings.action_enable_all),
|
||||||
|
onClick = onClickEnableAll,
|
||||||
|
),
|
||||||
|
AppBar.OverflowAction(
|
||||||
|
title = stringResource(MR.strings.action_disable_all),
|
||||||
|
onClick = onClickDisableAll,
|
||||||
|
),
|
||||||
|
AppBar.OverflowAction(
|
||||||
|
title = stringResource(MR.strings.pref_clear_cookies),
|
||||||
|
onClick = onClickClearCookies,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
@@ -157,7 +153,7 @@ fun ExtensionDetailsScreen(
|
|||||||
private fun ExtensionDetails(
|
private fun ExtensionDetails(
|
||||||
contentPadding: PaddingValues,
|
contentPadding: PaddingValues,
|
||||||
extension: Extension.Installed,
|
extension: Extension.Installed,
|
||||||
sources: ImmutableList<ExtensionSourceItem>,
|
sources: List<ExtensionSourceItem>,
|
||||||
incognitoMode: Boolean,
|
incognitoMode: Boolean,
|
||||||
onClickSourcePreferences: (sourceId: Long) -> Unit,
|
onClickSourcePreferences: (sourceId: Long) -> Unit,
|
||||||
onClickUninstall: () -> Unit,
|
onClickUninstall: () -> Unit,
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ import eu.kanade.tachiyomi.ui.browse.extension.ExtensionUiModel
|
|||||||
import eu.kanade.tachiyomi.ui.browse.extension.ExtensionsScreenModel
|
import eu.kanade.tachiyomi.ui.browse.extension.ExtensionsScreenModel
|
||||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||||
import eu.kanade.tachiyomi.util.system.launchRequestPackageInstallsPermission
|
import eu.kanade.tachiyomi.util.system.launchRequestPackageInstallsPermission
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.FastScrollLazyColumn
|
import tachiyomi.presentation.core.components.FastScrollLazyColumn
|
||||||
import tachiyomi.presentation.core.components.material.PullRefresh
|
import tachiyomi.presentation.core.components.material.PullRefresh
|
||||||
@@ -104,7 +103,7 @@ fun ExtensionScreen(
|
|||||||
EmptyScreen(
|
EmptyScreen(
|
||||||
stringRes = msg,
|
stringRes = msg,
|
||||||
modifier = Modifier.padding(contentPadding),
|
modifier = Modifier.padding(contentPadding),
|
||||||
actions = persistentListOf(
|
actions = listOf(
|
||||||
EmptyScreenAction(
|
EmptyScreenAction(
|
||||||
stringRes = MR.strings.extensionStores,
|
stringRes = MR.strings.extensionStores,
|
||||||
icon = Icons.Outlined.Settings,
|
icon = Icons.Outlined.Settings,
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import eu.kanade.presentation.browse.components.BaseSourceItem
|
|||||||
import eu.kanade.presentation.browse.components.SourceIcon
|
import eu.kanade.presentation.browse.components.SourceIcon
|
||||||
import eu.kanade.tachiyomi.ui.browse.migration.sources.MigrateSourceScreenModel
|
import eu.kanade.tachiyomi.ui.browse.migration.sources.MigrateSourceScreenModel
|
||||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import tachiyomi.domain.source.model.Source
|
import tachiyomi.domain.source.model.Source
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.Badge
|
import tachiyomi.presentation.core.components.Badge
|
||||||
@@ -76,7 +75,7 @@ fun MigrateSourceScreen(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun MigrateSourceList(
|
private fun MigrateSourceList(
|
||||||
list: ImmutableList<Pair<Source, Long>>,
|
list: List<Pair<Source, Long>>,
|
||||||
contentPadding: PaddingValues,
|
contentPadding: PaddingValues,
|
||||||
onClickItem: (Source) -> Unit,
|
onClickItem: (Source) -> Unit,
|
||||||
onLongClickItem: (Source) -> Unit,
|
onLongClickItem: (Source) -> Unit,
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import eu.kanade.presentation.components.RadioMenuItem
|
|||||||
import eu.kanade.presentation.components.SearchToolbar
|
import eu.kanade.presentation.components.SearchToolbar
|
||||||
import eu.kanade.tachiyomi.source.ConfigurableSource
|
import eu.kanade.tachiyomi.source.ConfigurableSource
|
||||||
import eu.kanade.tachiyomi.source.Source
|
import eu.kanade.tachiyomi.source.Source
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.domain.library.model.LibraryDisplayMode
|
import tachiyomi.domain.library.model.LibraryDisplayMode
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
@@ -54,44 +53,42 @@ fun BrowseSourceToolbar(
|
|||||||
onClickCloseSearch = navigateUp,
|
onClickCloseSearch = navigateUp,
|
||||||
actions = {
|
actions = {
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
actions = persistentListOf<AppBar.AppBarAction>().builder()
|
actions = buildList {
|
||||||
.apply {
|
add(
|
||||||
|
AppBar.Action(
|
||||||
|
title = stringResource(MR.strings.action_display_mode),
|
||||||
|
icon = if (displayMode == LibraryDisplayMode.List) {
|
||||||
|
Icons.AutoMirrored.Filled.ViewList
|
||||||
|
} else {
|
||||||
|
Icons.Filled.ViewModule
|
||||||
|
},
|
||||||
|
onClick = { selectingDisplayMode = true },
|
||||||
|
),
|
||||||
|
)
|
||||||
|
if (isLocalSource) {
|
||||||
add(
|
add(
|
||||||
AppBar.Action(
|
AppBar.OverflowAction(
|
||||||
title = stringResource(MR.strings.action_display_mode),
|
title = stringResource(MR.strings.label_help),
|
||||||
icon = if (displayMode == LibraryDisplayMode.List) {
|
onClick = onHelpClick,
|
||||||
Icons.AutoMirrored.Filled.ViewList
|
),
|
||||||
} else {
|
)
|
||||||
Icons.Filled.ViewModule
|
} else {
|
||||||
},
|
add(
|
||||||
onClick = { selectingDisplayMode = true },
|
AppBar.OverflowAction(
|
||||||
|
title = stringResource(MR.strings.action_open_in_web_view),
|
||||||
|
onClick = onWebViewClick,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
if (isLocalSource) {
|
|
||||||
add(
|
|
||||||
AppBar.OverflowAction(
|
|
||||||
title = stringResource(MR.strings.label_help),
|
|
||||||
onClick = onHelpClick,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
add(
|
|
||||||
AppBar.OverflowAction(
|
|
||||||
title = stringResource(MR.strings.action_open_in_web_view),
|
|
||||||
onClick = onWebViewClick,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if (isConfigurableSource) {
|
|
||||||
add(
|
|
||||||
AppBar.OverflowAction(
|
|
||||||
title = stringResource(MR.strings.action_settings),
|
|
||||||
onClick = onSettingsClick,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.build(),
|
if (isConfigurableSource) {
|
||||||
|
add(
|
||||||
|
AppBar.OverflowAction(
|
||||||
|
title = stringResource(MR.strings.action_settings),
|
||||||
|
onClick = onSettingsClick,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
DropdownMenu(
|
DropdownMenu(
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ import androidx.compose.ui.focus.FocusRequester
|
|||||||
import androidx.compose.ui.focus.focusRequester
|
import androidx.compose.ui.focus.focusRequester
|
||||||
import eu.kanade.core.preference.asToggleableState
|
import eu.kanade.core.preference.asToggleableState
|
||||||
import eu.kanade.presentation.category.visualName
|
import eu.kanade.presentation.category.visualName
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import tachiyomi.core.common.preference.CheckboxState
|
import tachiyomi.core.common.preference.CheckboxState
|
||||||
import tachiyomi.domain.category.model.Category
|
import tachiyomi.domain.category.model.Category
|
||||||
@@ -41,7 +39,7 @@ import kotlin.time.Duration.Companion.seconds
|
|||||||
fun CategoryCreateDialog(
|
fun CategoryCreateDialog(
|
||||||
onDismissRequest: () -> Unit,
|
onDismissRequest: () -> Unit,
|
||||||
onCreate: (String) -> Unit,
|
onCreate: (String) -> Unit,
|
||||||
categories: ImmutableList<String>,
|
categories: List<String>,
|
||||||
) {
|
) {
|
||||||
var name by remember { mutableStateOf("") }
|
var name by remember { mutableStateOf("") }
|
||||||
|
|
||||||
@@ -103,7 +101,7 @@ fun CategoryCreateDialog(
|
|||||||
fun CategoryRenameDialog(
|
fun CategoryRenameDialog(
|
||||||
onDismissRequest: () -> Unit,
|
onDismissRequest: () -> Unit,
|
||||||
onRename: (String) -> Unit,
|
onRename: (String) -> Unit,
|
||||||
categories: ImmutableList<String>,
|
categories: List<String>,
|
||||||
category: String,
|
category: String,
|
||||||
) {
|
) {
|
||||||
var name by remember { mutableStateOf(category) }
|
var name by remember { mutableStateOf(category) }
|
||||||
@@ -195,7 +193,7 @@ fun CategoryDeleteDialog(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ChangeCategoryDialog(
|
fun ChangeCategoryDialog(
|
||||||
initialSelection: ImmutableList<CheckboxState<Category>>,
|
initialSelection: List<CheckboxState<Category>>,
|
||||||
onDismissRequest: () -> Unit,
|
onDismissRequest: () -> Unit,
|
||||||
onEditCategories: () -> Unit,
|
onEditCategories: () -> Unit,
|
||||||
onConfirm: (List<Long>, List<Long>) -> Unit,
|
onConfirm: (List<Long>, List<Long>) -> Unit,
|
||||||
@@ -267,7 +265,7 @@ fun ChangeCategoryDialog(
|
|||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
val mutableList = selection.toMutableList()
|
val mutableList = selection.toMutableList()
|
||||||
mutableList[index] = it.next()
|
mutableList[index] = it.next()
|
||||||
selection = mutableList.toList().toImmutableList()
|
selection = mutableList.toList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Row(
|
Row(
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ import androidx.compose.ui.text.input.VisualTransformation
|
|||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
import tachiyomi.presentation.core.util.clearFocusOnSoftKeyboardHide
|
import tachiyomi.presentation.core.util.clearFocusOnSoftKeyboardHide
|
||||||
@@ -190,7 +189,7 @@ fun AppBarTitle(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AppBarActions(
|
fun AppBarActions(
|
||||||
actions: ImmutableList<AppBar.AppBarAction>,
|
actions: List<AppBar.AppBarAction>,
|
||||||
) {
|
) {
|
||||||
var showMenu by remember { mutableStateOf(false) }
|
var showMenu by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.DpOffset
|
import androidx.compose.ui.unit.DpOffset
|
||||||
import eu.kanade.presentation.manga.DownloadAction
|
import eu.kanade.presentation.manga.DownloadAction
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.pluralStringResource
|
import tachiyomi.presentation.core.i18n.pluralStringResource
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
@@ -52,7 +51,7 @@ private fun DownloadDropdownMenuItems(
|
|||||||
onDismissRequest: () -> Unit,
|
onDismissRequest: () -> Unit,
|
||||||
onDownloadClicked: (DownloadAction) -> Unit,
|
onDownloadClicked: (DownloadAction) -> Unit,
|
||||||
) {
|
) {
|
||||||
val options = persistentListOf(
|
val options = listOf(
|
||||||
DownloadAction.NEXT_1_CHAPTER to pluralStringResource(MR.plurals.download_amount, 1, 1),
|
DownloadAction.NEXT_1_CHAPTER to pluralStringResource(MR.plurals.download_amount, 1, 1),
|
||||||
DownloadAction.NEXT_5_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 5, 5),
|
DownloadAction.NEXT_5_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 5, 5),
|
||||||
DownloadAction.NEXT_10_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 10, 10),
|
DownloadAction.NEXT_10_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 10, 10),
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import androidx.compose.material3.Surface
|
|||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.screens.EmptyScreen
|
import tachiyomi.presentation.core.screens.EmptyScreen
|
||||||
import tachiyomi.presentation.core.screens.EmptyScreenAction
|
import tachiyomi.presentation.core.screens.EmptyScreenAction
|
||||||
@@ -31,7 +30,7 @@ private fun WithActionPreview() {
|
|||||||
Surface {
|
Surface {
|
||||||
EmptyScreen(
|
EmptyScreen(
|
||||||
stringRes = MR.strings.empty_screen,
|
stringRes = MR.strings.empty_screen,
|
||||||
actions = persistentListOf(
|
actions = listOf(
|
||||||
EmptyScreenAction(
|
EmptyScreenAction(
|
||||||
stringRes = MR.strings.action_retry,
|
stringRes = MR.strings.action_retry,
|
||||||
icon = Icons.Outlined.Refresh,
|
icon = Icons.Outlined.Refresh,
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.util.fastForEachIndexed
|
import androidx.compose.ui.util.fastForEachIndexed
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.material.TabText
|
import tachiyomi.presentation.core.components.material.TabText
|
||||||
@@ -41,7 +40,7 @@ object TabbedDialogPaddings {
|
|||||||
@Composable
|
@Composable
|
||||||
fun TabbedDialog(
|
fun TabbedDialog(
|
||||||
onDismissRequest: () -> Unit,
|
onDismissRequest: () -> Unit,
|
||||||
tabTitles: ImmutableList<String>,
|
tabTitles: List<String>,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
tabOverflowMenuContent: (@Composable ColumnScope.(() -> Unit) -> Unit)? = null,
|
tabOverflowMenuContent: (@Composable ColumnScope.(() -> Unit) -> Unit)? = null,
|
||||||
pagerState: PagerState = rememberPagerState { tabTitles.size },
|
pagerState: PagerState = rememberPagerState { tabTitles.size },
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.platform.LocalLayoutDirection
|
import androidx.compose.ui.platform.LocalLayoutDirection
|
||||||
import androidx.compose.ui.zIndex
|
import androidx.compose.ui.zIndex
|
||||||
import dev.icerock.moko.resources.StringResource
|
import dev.icerock.moko.resources.StringResource
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import tachiyomi.presentation.core.components.material.Scaffold
|
import tachiyomi.presentation.core.components.material.Scaffold
|
||||||
import tachiyomi.presentation.core.components.material.TabText
|
import tachiyomi.presentation.core.components.material.TabText
|
||||||
@@ -32,7 +30,7 @@ import tachiyomi.presentation.core.i18n.stringResource
|
|||||||
@Composable
|
@Composable
|
||||||
fun TabbedScreen(
|
fun TabbedScreen(
|
||||||
titleRes: StringResource,
|
titleRes: StringResource,
|
||||||
tabs: ImmutableList<TabContent>,
|
tabs: List<TabContent>,
|
||||||
state: PagerState = rememberPagerState { tabs.size },
|
state: PagerState = rememberPagerState { tabs.size },
|
||||||
searchQuery: String? = null,
|
searchQuery: String? = null,
|
||||||
onChangeSearchQuery: (String?) -> Unit = {},
|
onChangeSearchQuery: (String?) -> Unit = {},
|
||||||
@@ -94,6 +92,6 @@ data class TabContent(
|
|||||||
val titleRes: StringResource,
|
val titleRes: StringResource,
|
||||||
val badgeNumber: Int? = null,
|
val badgeNumber: Int? = null,
|
||||||
val searchEnabled: Boolean = false,
|
val searchEnabled: Boolean = false,
|
||||||
val actions: ImmutableList<AppBar.AppBarAction> = persistentListOf(),
|
val actions: List<AppBar.AppBarAction> = listOf(),
|
||||||
val content: @Composable (contentPadding: PaddingValues, snackbarHostState: SnackbarHostState) -> Unit,
|
val content: @Composable (contentPadding: PaddingValues, snackbarHostState: SnackbarHostState) -> Unit,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import eu.kanade.presentation.history.components.HistoryItem
|
|||||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||||
import eu.kanade.presentation.util.animateItemFastScroll
|
import eu.kanade.presentation.util.animateItemFastScroll
|
||||||
import eu.kanade.tachiyomi.ui.history.HistoryScreenModel
|
import eu.kanade.tachiyomi.ui.history.HistoryScreenModel
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.domain.history.model.HistoryWithRelations
|
import tachiyomi.domain.history.model.HistoryWithRelations
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.FastScrollLazyColumn
|
import tachiyomi.presentation.core.components.FastScrollLazyColumn
|
||||||
@@ -49,7 +48,7 @@ fun HistoryScreen(
|
|||||||
onChangeSearchQuery = onSearchQueryChange,
|
onChangeSearchQuery = onSearchQueryChange,
|
||||||
actions = {
|
actions = {
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
persistentListOf(
|
listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.pref_clear_history),
|
title = stringResource(MR.strings.pref_clear_history),
|
||||||
icon = Icons.Outlined.DeleteSweep,
|
icon = Icons.Outlined.DeleteSweep,
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import eu.kanade.presentation.components.TabbedDialog
|
|||||||
import eu.kanade.presentation.components.TabbedDialogPaddings
|
import eu.kanade.presentation.components.TabbedDialogPaddings
|
||||||
import eu.kanade.tachiyomi.ui.library.LibrarySettingsScreenModel
|
import eu.kanade.tachiyomi.ui.library.LibrarySettingsScreenModel
|
||||||
import eu.kanade.tachiyomi.util.system.isReleaseBuildType
|
import eu.kanade.tachiyomi.util.system.isReleaseBuildType
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.core.common.preference.TriState
|
import tachiyomi.core.common.preference.TriState
|
||||||
import tachiyomi.domain.category.model.Category
|
import tachiyomi.domain.category.model.Category
|
||||||
import tachiyomi.domain.library.model.LibraryDisplayMode
|
import tachiyomi.domain.library.model.LibraryDisplayMode
|
||||||
@@ -47,7 +46,7 @@ fun LibrarySettingsDialog(
|
|||||||
) {
|
) {
|
||||||
TabbedDialog(
|
TabbedDialog(
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
tabTitles = persistentListOf(
|
tabTitles = listOf(
|
||||||
stringResource(MR.strings.action_filter),
|
stringResource(MR.strings.action_filter),
|
||||||
stringResource(MR.strings.action_sort),
|
stringResource(MR.strings.action_sort),
|
||||||
stringResource(MR.strings.action_display),
|
stringResource(MR.strings.action_display),
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import androidx.compose.ui.unit.sp
|
|||||||
import eu.kanade.presentation.components.AppBar
|
import eu.kanade.presentation.components.AppBar
|
||||||
import eu.kanade.presentation.components.AppBarActions
|
import eu.kanade.presentation.components.AppBarActions
|
||||||
import eu.kanade.presentation.components.SearchToolbar
|
import eu.kanade.presentation.components.SearchToolbar
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.Pill
|
import tachiyomi.presentation.core.components.Pill
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
@@ -96,7 +95,7 @@ private fun LibraryRegularToolbar(
|
|||||||
actions = {
|
actions = {
|
||||||
val filterTint = if (hasFilters) MaterialTheme.colorScheme.active else LocalContentColor.current
|
val filterTint = if (hasFilters) MaterialTheme.colorScheme.active else LocalContentColor.current
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
persistentListOf(
|
listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.action_filter),
|
title = stringResource(MR.strings.action_filter),
|
||||||
icon = Icons.Outlined.FilterList,
|
icon = Icons.Outlined.FilterList,
|
||||||
@@ -133,7 +132,7 @@ private fun LibrarySelectionToolbar(
|
|||||||
titleContent = { Text(text = "$selectedCount") },
|
titleContent = { Text(text = "$selectedCount") },
|
||||||
actions = {
|
actions = {
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
persistentListOf(
|
listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.action_select_all),
|
title = stringResource(MR.strings.action_select_all),
|
||||||
icon = Icons.Outlined.SelectAll,
|
icon = Icons.Outlined.SelectAll,
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import eu.kanade.domain.base.BasePreferences
|
|||||||
import eu.kanade.domain.manga.model.downloadedFilter
|
import eu.kanade.domain.manga.model.downloadedFilter
|
||||||
import eu.kanade.presentation.components.TabbedDialog
|
import eu.kanade.presentation.components.TabbedDialog
|
||||||
import eu.kanade.presentation.components.TabbedDialogPaddings
|
import eu.kanade.presentation.components.TabbedDialogPaddings
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.core.common.preference.TriState
|
import tachiyomi.core.common.preference.TriState
|
||||||
import tachiyomi.domain.manga.model.Manga
|
import tachiyomi.domain.manga.model.Manga
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
@@ -70,7 +69,7 @@ fun ChapterSettingsDialog(
|
|||||||
|
|
||||||
TabbedDialog(
|
TabbedDialog(
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
tabTitles = persistentListOf(
|
tabTitles = listOf(
|
||||||
stringResource(MR.strings.action_filter),
|
stringResource(MR.strings.action_filter),
|
||||||
stringResource(MR.strings.action_sort),
|
stringResource(MR.strings.action_sort),
|
||||||
stringResource(MR.strings.action_display),
|
stringResource(MR.strings.action_display),
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ import eu.kanade.presentation.components.AppBarActions
|
|||||||
import eu.kanade.presentation.components.DropdownMenu
|
import eu.kanade.presentation.components.DropdownMenu
|
||||||
import eu.kanade.presentation.manga.EditCoverAction
|
import eu.kanade.presentation.manga.EditCoverAction
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.ReaderPageImageView
|
import eu.kanade.tachiyomi.ui.reader.viewer.ReaderPageImageView
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.domain.manga.model.Manga
|
import tachiyomi.domain.manga.model.Manga
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.material.Scaffold
|
import tachiyomi.presentation.core.components.material.Scaffold
|
||||||
@@ -93,7 +92,7 @@ fun MangaCoverDialog(
|
|||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
ActionsPill {
|
ActionsPill {
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
actions = persistentListOf(
|
actions = listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.action_share),
|
title = stringResource(MR.strings.action_share),
|
||||||
icon = Icons.Outlined.Share,
|
icon = Icons.Outlined.Share,
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.unit.DpSize
|
import androidx.compose.ui.unit.DpSize
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import eu.kanade.tachiyomi.util.system.isReleaseBuildType
|
import eu.kanade.tachiyomi.util.system.isReleaseBuildType
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import tachiyomi.domain.manga.interactor.FetchInterval
|
import tachiyomi.domain.manga.interactor.FetchInterval
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.WheelTextPicker
|
import tachiyomi.presentation.core.components.WheelTextPicker
|
||||||
@@ -124,7 +123,7 @@ fun SetIntervalDialog(
|
|||||||
it.toString()
|
it.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.toImmutableList()
|
|
||||||
WheelTextPicker(
|
WheelTextPicker(
|
||||||
items = items,
|
items = items,
|
||||||
size = size,
|
size = size,
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import eu.kanade.presentation.components.AppBarActions
|
|||||||
import eu.kanade.presentation.components.AppBarTitle
|
import eu.kanade.presentation.components.AppBarTitle
|
||||||
import eu.kanade.presentation.components.DownloadDropdownMenu
|
import eu.kanade.presentation.components.DownloadDropdownMenu
|
||||||
import eu.kanade.presentation.manga.DownloadAction
|
import eu.kanade.presentation.manga.DownloadAction
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
import tachiyomi.presentation.core.theme.active
|
import tachiyomi.presentation.core.theme.active
|
||||||
@@ -76,7 +75,7 @@ fun MangaToolbar(
|
|||||||
|
|
||||||
val filterTint = if (hasFilters) MaterialTheme.colorScheme.active else LocalContentColor.current
|
val filterTint = if (hasFilters) MaterialTheme.colorScheme.active else LocalContentColor.current
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
actions = persistentListOf<AppBar.AppBarAction>().builder().apply {
|
actions = buildList {
|
||||||
if (isActionMode) {
|
if (isActionMode) {
|
||||||
add(
|
add(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
@@ -92,7 +91,7 @@ fun MangaToolbar(
|
|||||||
onClick = onInvertSelection,
|
onClick = onInvertSelection,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
return@apply
|
return@buildList
|
||||||
}
|
}
|
||||||
if (onClickDownload != null) {
|
if (onClickDownload != null) {
|
||||||
add(
|
add(
|
||||||
@@ -147,8 +146,7 @@ fun MangaToolbar(
|
|||||||
onClick = onClickEditNotes,
|
onClick = onClickEditNotes,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
.build(),
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
isActionMode = isActionMode,
|
isActionMode = isActionMode,
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import eu.kanade.tachiyomi.data.track.Tracker
|
import eu.kanade.tachiyomi.data.track.Tracker
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.ImmutableMap
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
import tachiyomi.core.common.preference.Preference as PreferenceData
|
import tachiyomi.core.common.preference.Preference as PreferenceData
|
||||||
@@ -69,10 +67,10 @@ sealed class Preference {
|
|||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
data class ListPreference<T>(
|
data class ListPreference<T>(
|
||||||
val preference: PreferenceData<T>,
|
val preference: PreferenceData<T>,
|
||||||
val entries: ImmutableMap<T, String>,
|
val entries: Map<T, String>,
|
||||||
override val title: String,
|
override val title: String,
|
||||||
override val subtitle: String? = "%s",
|
override val subtitle: String? = "%s",
|
||||||
val subtitleProvider: @Composable (value: T, entries: ImmutableMap<T, String>) -> String? =
|
val subtitleProvider: @Composable (value: T, entries: Map<T, String>) -> String? =
|
||||||
{ v, e -> subtitle?.format(e[v]) },
|
{ v, e -> subtitle?.format(e[v]) },
|
||||||
override val icon: ImageVector? = null,
|
override val icon: ImageVector? = null,
|
||||||
override val enabled: Boolean = true,
|
override val enabled: Boolean = true,
|
||||||
@@ -82,8 +80,8 @@ sealed class Preference {
|
|||||||
internal suspend fun internalOnValueChanged(value: Any) = onValueChanged(value as T)
|
internal suspend fun internalOnValueChanged(value: Any) = onValueChanged(value as T)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
internal fun internalSubtitleProvider(value: Any?, entries: ImmutableMap<out Any?, String>) =
|
internal fun internalSubtitleProvider(value: Any?, entries: Map<out Any?, String>) =
|
||||||
subtitleProvider(value as T, entries as ImmutableMap<T, String>)
|
subtitleProvider(value as T, entries as Map<T, String>)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,10 +89,10 @@ sealed class Preference {
|
|||||||
*/
|
*/
|
||||||
data class BasicListPreference(
|
data class BasicListPreference(
|
||||||
val value: String,
|
val value: String,
|
||||||
val entries: ImmutableMap<String, String>,
|
val entries: Map<String, String>,
|
||||||
override val title: String,
|
override val title: String,
|
||||||
override val subtitle: String? = "%s",
|
override val subtitle: String? = "%s",
|
||||||
val subtitleProvider: @Composable (value: String, entries: ImmutableMap<String, String>) -> String? =
|
val subtitleProvider: @Composable (value: String, entries: Map<String, String>) -> String? =
|
||||||
{ v, e -> subtitle?.format(e[v]) },
|
{ v, e -> subtitle?.format(e[v]) },
|
||||||
override val icon: ImageVector? = null,
|
override val icon: ImageVector? = null,
|
||||||
override val enabled: Boolean = true,
|
override val enabled: Boolean = true,
|
||||||
@@ -107,10 +105,10 @@ sealed class Preference {
|
|||||||
*/
|
*/
|
||||||
data class MultiSelectListPreference(
|
data class MultiSelectListPreference(
|
||||||
val preference: PreferenceData<Set<String>>,
|
val preference: PreferenceData<Set<String>>,
|
||||||
val entries: ImmutableMap<String, String>,
|
val entries: Map<String, String>,
|
||||||
override val title: String,
|
override val title: String,
|
||||||
override val subtitle: String? = "%s",
|
override val subtitle: String? = "%s",
|
||||||
val subtitleProvider: @Composable (value: Set<String>, entries: ImmutableMap<String, String>) -> String? =
|
val subtitleProvider: @Composable (value: Set<String>, entries: Map<String, String>) -> String? =
|
||||||
{ v, e ->
|
{ v, e ->
|
||||||
val combined = remember(v, e) {
|
val combined = remember(v, e) {
|
||||||
v.mapNotNull { e[it] }
|
v.mapNotNull { e[it] }
|
||||||
@@ -177,6 +175,6 @@ sealed class Preference {
|
|||||||
override val title: String,
|
override val title: String,
|
||||||
override val enabled: Boolean = true,
|
override val enabled: Boolean = true,
|
||||||
|
|
||||||
val preferenceItems: ImmutableList<PreferenceItem<out Any, out Any>>,
|
val preferenceItems: List<PreferenceItem<out Any, out Any>>,
|
||||||
) : Preference()
|
) : Preference()
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-14
@@ -53,9 +53,6 @@ import eu.kanade.tachiyomi.util.system.isShizukuInstalled
|
|||||||
import eu.kanade.tachiyomi.util.system.powerManager
|
import eu.kanade.tachiyomi.util.system.powerManager
|
||||||
import eu.kanade.tachiyomi.util.system.setDefaultSettings
|
import eu.kanade.tachiyomi.util.system.setDefaultSettings
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.persistentMapOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableMap
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import logcat.LogPriority
|
import logcat.LogPriority
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
@@ -140,7 +137,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.label_background_activity),
|
title = stringResource(MR.strings.label_background_activity),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(MR.strings.pref_disable_battery_optimization),
|
title = stringResource(MR.strings.pref_disable_battery_optimization),
|
||||||
subtitle = stringResource(MR.strings.pref_disable_battery_optimization_summary),
|
subtitle = stringResource(MR.strings.pref_disable_battery_optimization_summary),
|
||||||
@@ -179,7 +176,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.label_data),
|
title = stringResource(MR.strings.label_data),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(MR.strings.pref_invalidate_download_cache),
|
title = stringResource(MR.strings.pref_invalidate_download_cache),
|
||||||
subtitle = stringResource(MR.strings.pref_invalidate_download_cache_summary),
|
subtitle = stringResource(MR.strings.pref_invalidate_download_cache_summary),
|
||||||
@@ -209,7 +206,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.label_network),
|
title = stringResource(MR.strings.label_network),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(MR.strings.pref_clear_cookies),
|
title = stringResource(MR.strings.pref_clear_cookies),
|
||||||
onClick = {
|
onClick = {
|
||||||
@@ -239,7 +236,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = networkPreferences.dohProvider,
|
preference = networkPreferences.dohProvider,
|
||||||
entries = persistentMapOf(
|
entries = mapOf(
|
||||||
-1 to stringResource(MR.strings.disabled),
|
-1 to stringResource(MR.strings.disabled),
|
||||||
PREF_DOH_CLOUDFLARE to "Cloudflare",
|
PREF_DOH_CLOUDFLARE to "Cloudflare",
|
||||||
PREF_DOH_GOOGLE to "Google",
|
PREF_DOH_GOOGLE to "Google",
|
||||||
@@ -296,7 +293,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.label_library),
|
title = stringResource(MR.strings.label_library),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(MR.strings.pref_refresh_library_covers),
|
title = stringResource(MR.strings.pref_refresh_library_covers),
|
||||||
onClick = { MetadataUpdateJob.startNow(context) },
|
onClick = { MetadataUpdateJob.startNow(context) },
|
||||||
@@ -348,7 +345,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
}
|
}
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_category_reader),
|
title = stringResource(MR.strings.pref_category_reader),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = basePreferences.hardwareBitmapThreshold,
|
preference = basePreferences.hardwareBitmapThreshold,
|
||||||
entries = GLUtil.CUSTOM_TEXTURE_LIMIT_OPTIONS
|
entries = GLUtil.CUSTOM_TEXTURE_LIMIT_OPTIONS
|
||||||
@@ -360,8 +357,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
}
|
}
|
||||||
option to display
|
option to display
|
||||||
}
|
}
|
||||||
.toMap()
|
.toMap(),
|
||||||
.toImmutableMap(),
|
|
||||||
title = stringResource(MR.strings.pref_hardware_bitmap_threshold),
|
title = stringResource(MR.strings.pref_hardware_bitmap_threshold),
|
||||||
subtitleProvider = { value, options ->
|
subtitleProvider = { value, options ->
|
||||||
stringResource(MR.strings.pref_hardware_bitmap_threshold_summary, options[value].orEmpty())
|
stringResource(MR.strings.pref_hardware_bitmap_threshold_summary, options[value].orEmpty())
|
||||||
@@ -420,7 +416,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
}
|
}
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.label_extensions),
|
title = stringResource(MR.strings.label_extensions),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = extensionInstallerPref,
|
preference = extensionInstallerPref,
|
||||||
entries = extensionInstallerPref.entries
|
entries = extensionInstallerPref.entries
|
||||||
@@ -432,8 +428,7 @@ object SettingsAdvancedScreen : SearchableSettings {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.associateWith { stringResource(it.titleRes) }
|
.associateWith { stringResource(it.titleRes) },
|
||||||
.toImmutableMap(),
|
|
||||||
title = stringResource(MR.strings.ext_installer_pref),
|
title = stringResource(MR.strings.ext_installer_pref),
|
||||||
onValueChanged = {
|
onValueChanged = {
|
||||||
if (it == BasePreferences.ExtensionInstaller.SHIZUKU &&
|
if (it == BasePreferences.ExtensionInstaller.SHIZUKU &&
|
||||||
|
|||||||
+4
-8
@@ -19,8 +19,6 @@ import eu.kanade.presentation.more.settings.screen.appearance.AppLanguageScreen
|
|||||||
import eu.kanade.presentation.more.settings.widget.AppThemeModePreferenceWidget
|
import eu.kanade.presentation.more.settings.widget.AppThemeModePreferenceWidget
|
||||||
import eu.kanade.presentation.more.settings.widget.AppThemePreferenceWidget
|
import eu.kanade.presentation.more.settings.widget.AppThemePreferenceWidget
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableMap
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
import tachiyomi.presentation.core.util.collectAsState
|
import tachiyomi.presentation.core.util.collectAsState
|
||||||
@@ -61,7 +59,7 @@ object SettingsAppearanceScreen : SearchableSettings {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_category_theme),
|
title = stringResource(MR.strings.pref_category_theme),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.CustomPreference(
|
Preference.PreferenceItem.CustomPreference(
|
||||||
title = stringResource(MR.strings.pref_app_theme),
|
title = stringResource(MR.strings.pref_app_theme),
|
||||||
) {
|
) {
|
||||||
@@ -110,7 +108,7 @@ object SettingsAppearanceScreen : SearchableSettings {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_category_display),
|
title = stringResource(MR.strings.pref_category_display),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(MR.strings.pref_app_language),
|
title = stringResource(MR.strings.pref_app_language),
|
||||||
onClick = { navigator.push(AppLanguageScreen()) },
|
onClick = { navigator.push(AppLanguageScreen()) },
|
||||||
@@ -118,8 +116,7 @@ object SettingsAppearanceScreen : SearchableSettings {
|
|||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = uiPreferences.tabletUiMode,
|
preference = uiPreferences.tabletUiMode,
|
||||||
entries = TabletUiMode.entries
|
entries = TabletUiMode.entries
|
||||||
.associateWith { stringResource(it.titleRes) }
|
.associateWith { stringResource(it.titleRes) },
|
||||||
.toImmutableMap(),
|
|
||||||
title = stringResource(MR.strings.pref_tablet_ui_mode),
|
title = stringResource(MR.strings.pref_tablet_ui_mode),
|
||||||
onValueChanged = {
|
onValueChanged = {
|
||||||
context.toast(MR.strings.requires_app_restart)
|
context.toast(MR.strings.requires_app_restart)
|
||||||
@@ -132,8 +129,7 @@ object SettingsAppearanceScreen : SearchableSettings {
|
|||||||
.associateWith {
|
.associateWith {
|
||||||
val formattedDate = UiPreferences.dateFormat(it).format(now)
|
val formattedDate = UiPreferences.dateFormat(it).format(now)
|
||||||
"${it.ifEmpty { stringResource(MR.strings.label_default) }} ($formattedDate)"
|
"${it.ifEmpty { stringResource(MR.strings.label_default) }} ($formattedDate)"
|
||||||
}
|
},
|
||||||
.toImmutableMap(),
|
|
||||||
title = stringResource(MR.strings.pref_date_format),
|
title = stringResource(MR.strings.pref_date_format),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
|
|||||||
+2
-3
@@ -13,7 +13,6 @@ import eu.kanade.domain.source.service.SourcePreferences
|
|||||||
import eu.kanade.presentation.more.settings.Preference
|
import eu.kanade.presentation.more.settings.Preference
|
||||||
import eu.kanade.presentation.more.settings.screen.browse.ExtensionStoresScreen
|
import eu.kanade.presentation.more.settings.screen.browse.ExtensionStoresScreen
|
||||||
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.authenticate
|
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.authenticate
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import mihon.domain.extension.interactor.GetExtensionStoreCountAsFlow
|
import mihon.domain.extension.interactor.GetExtensionStoreCountAsFlow
|
||||||
import tachiyomi.core.common.i18n.stringResource
|
import tachiyomi.core.common.i18n.stringResource
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
@@ -41,7 +40,7 @@ object SettingsBrowseScreen : SearchableSettings {
|
|||||||
return listOf(
|
return listOf(
|
||||||
Preference.PreferenceGroup(
|
Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.label_sources),
|
title = stringResource(MR.strings.label_sources),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = sourcePreferences.hideInLibraryItems,
|
preference = sourcePreferences.hideInLibraryItems,
|
||||||
title = stringResource(MR.strings.pref_hide_in_library_items),
|
title = stringResource(MR.strings.pref_hide_in_library_items),
|
||||||
@@ -57,7 +56,7 @@ object SettingsBrowseScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
Preference.PreferenceGroup(
|
Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_category_nsfw_content),
|
title = stringResource(MR.strings.pref_category_nsfw_content),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = sourcePreferences.showNsfwSource,
|
preference = sourcePreferences.showNsfwSource,
|
||||||
title = stringResource(MR.strings.pref_show_nsfw_source),
|
title = stringResource(MR.strings.pref_show_nsfw_source),
|
||||||
|
|||||||
@@ -56,8 +56,6 @@ import eu.kanade.tachiyomi.data.export.LibraryExporter
|
|||||||
import eu.kanade.tachiyomi.data.export.LibraryExporter.ExportOptions
|
import eu.kanade.tachiyomi.data.export.LibraryExporter.ExportOptions
|
||||||
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.persistentMapOf
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import logcat.LogPriority
|
import logcat.LogPriority
|
||||||
@@ -103,7 +101,7 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
val backupPreferences = Injekt.get<BackupPreferences>()
|
val backupPreferences = Injekt.get<BackupPreferences>()
|
||||||
val storagePreferences = Injekt.get<StoragePreferences>()
|
val storagePreferences = Injekt.get<StoragePreferences>()
|
||||||
|
|
||||||
return persistentListOf(
|
return listOf(
|
||||||
getStorageLocationPref(storagePreferences = storagePreferences),
|
getStorageLocationPref(storagePreferences = storagePreferences),
|
||||||
Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.pref_storage_location_info)),
|
Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.pref_storage_location_info)),
|
||||||
|
|
||||||
@@ -207,7 +205,7 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.label_backup),
|
title = stringResource(MR.strings.label_backup),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
// Manual actions
|
// Manual actions
|
||||||
Preference.PreferenceItem.CustomPreference(
|
Preference.PreferenceItem.CustomPreference(
|
||||||
title = stringResource(restorePreferenceKeyString),
|
title = stringResource(restorePreferenceKeyString),
|
||||||
@@ -255,7 +253,7 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
// Automatic backups
|
// Automatic backups
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = backupPreferences.backupInterval,
|
preference = backupPreferences.backupInterval,
|
||||||
entries = persistentMapOf(
|
entries = mapOf(
|
||||||
0 to stringResource(MR.strings.off),
|
0 to stringResource(MR.strings.off),
|
||||||
6 to stringResource(MR.strings.update_6hour),
|
6 to stringResource(MR.strings.update_6hour),
|
||||||
12 to stringResource(MR.strings.update_12hour),
|
12 to stringResource(MR.strings.update_12hour),
|
||||||
@@ -289,7 +287,7 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_storage_usage),
|
title = stringResource(MR.strings.pref_storage_usage),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.CustomPreference(
|
Preference.PreferenceItem.CustomPreference(
|
||||||
title = stringResource(MR.strings.pref_storage_usage),
|
title = stringResource(MR.strings.pref_storage_usage),
|
||||||
) {
|
) {
|
||||||
@@ -382,7 +380,7 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.export),
|
title = stringResource(MR.strings.export),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(MR.strings.library_list),
|
title = stringResource(MR.strings.library_list),
|
||||||
onClick = { showDialog = true },
|
onClick = { showDialog = true },
|
||||||
|
|||||||
+6
-11
@@ -12,9 +12,6 @@ import androidx.compose.ui.util.fastMap
|
|||||||
import eu.kanade.presentation.category.visualName
|
import eu.kanade.presentation.category.visualName
|
||||||
import eu.kanade.presentation.more.settings.Preference
|
import eu.kanade.presentation.more.settings.Preference
|
||||||
import eu.kanade.presentation.more.settings.widget.TriStateListDialog
|
import eu.kanade.presentation.more.settings.widget.TriStateListDialog
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.persistentMapOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableMap
|
|
||||||
import tachiyomi.domain.category.interactor.GetCategories
|
import tachiyomi.domain.category.interactor.GetCategories
|
||||||
import tachiyomi.domain.category.model.Category
|
import tachiyomi.domain.category.model.Category
|
||||||
import tachiyomi.domain.download.service.DownloadPreferences
|
import tachiyomi.domain.download.service.DownloadPreferences
|
||||||
@@ -85,14 +82,14 @@ object SettingsDownloadScreen : SearchableSettings {
|
|||||||
): Preference.PreferenceGroup {
|
): Preference.PreferenceGroup {
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_category_delete_chapters),
|
title = stringResource(MR.strings.pref_category_delete_chapters),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = downloadPreferences.removeAfterMarkedAsRead,
|
preference = downloadPreferences.removeAfterMarkedAsRead,
|
||||||
title = stringResource(MR.strings.pref_remove_after_marked_as_read),
|
title = stringResource(MR.strings.pref_remove_after_marked_as_read),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = downloadPreferences.removeAfterReadSlots,
|
preference = downloadPreferences.removeAfterReadSlots,
|
||||||
entries = persistentMapOf(
|
entries = mapOf(
|
||||||
-1 to stringResource(MR.strings.disabled),
|
-1 to stringResource(MR.strings.disabled),
|
||||||
0 to stringResource(MR.strings.last_read_chapter),
|
0 to stringResource(MR.strings.last_read_chapter),
|
||||||
1 to stringResource(MR.strings.second_to_last),
|
1 to stringResource(MR.strings.second_to_last),
|
||||||
@@ -122,8 +119,7 @@ object SettingsDownloadScreen : SearchableSettings {
|
|||||||
return Preference.PreferenceItem.MultiSelectListPreference(
|
return Preference.PreferenceItem.MultiSelectListPreference(
|
||||||
preference = downloadPreferences.removeExcludeCategories,
|
preference = downloadPreferences.removeExcludeCategories,
|
||||||
entries = categories()
|
entries = categories()
|
||||||
.associate { it.id.toString() to it.visualName }
|
.associate { it.id.toString() to it.visualName },
|
||||||
.toImmutableMap(),
|
|
||||||
title = stringResource(MR.strings.pref_remove_exclude_categories),
|
title = stringResource(MR.strings.pref_remove_exclude_categories),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -162,7 +158,7 @@ object SettingsDownloadScreen : SearchableSettings {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_category_auto_download),
|
title = stringResource(MR.strings.pref_category_auto_download),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = downloadNewChaptersPref,
|
preference = downloadNewChaptersPref,
|
||||||
title = stringResource(MR.strings.pref_download_new),
|
title = stringResource(MR.strings.pref_download_new),
|
||||||
@@ -192,7 +188,7 @@ object SettingsDownloadScreen : SearchableSettings {
|
|||||||
): Preference.PreferenceGroup {
|
): Preference.PreferenceGroup {
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.download_ahead),
|
title = stringResource(MR.strings.download_ahead),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = downloadPreferences.autoDownloadWhileReading,
|
preference = downloadPreferences.autoDownloadWhileReading,
|
||||||
entries = listOf(0, 2, 3, 5, 10)
|
entries = listOf(0, 2, 3, 5, 10)
|
||||||
@@ -202,8 +198,7 @@ object SettingsDownloadScreen : SearchableSettings {
|
|||||||
} else {
|
} else {
|
||||||
pluralStringResource(MR.plurals.next_unread_chapters, count = it, it)
|
pluralStringResource(MR.plurals.next_unread_chapters, count = it, it)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
.toImmutableMap(),
|
|
||||||
title = stringResource(MR.strings.auto_download_while_reading),
|
title = stringResource(MR.strings.auto_download_while_reading),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.download_ahead_info)),
|
Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.download_ahead_info)),
|
||||||
|
|||||||
+10
-13
@@ -20,9 +20,6 @@ import eu.kanade.presentation.more.settings.Preference
|
|||||||
import eu.kanade.presentation.more.settings.widget.TriStateListDialog
|
import eu.kanade.presentation.more.settings.widget.TriStateListDialog
|
||||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
||||||
import eu.kanade.tachiyomi.ui.category.CategoryScreen
|
import eu.kanade.tachiyomi.ui.category.CategoryScreen
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.persistentMapOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableMap
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import tachiyomi.domain.category.interactor.GetCategories
|
import tachiyomi.domain.category.interactor.GetCategories
|
||||||
import tachiyomi.domain.category.interactor.ResetCategoryFlags
|
import tachiyomi.domain.category.interactor.ResetCategoryFlags
|
||||||
@@ -80,7 +77,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.categories),
|
title = stringResource(MR.strings.categories),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(MR.strings.action_edit_categories),
|
title = stringResource(MR.strings.action_edit_categories),
|
||||||
subtitle = pluralStringResource(
|
subtitle = pluralStringResource(
|
||||||
@@ -92,7 +89,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = libraryPreferences.defaultCategory,
|
preference = libraryPreferences.defaultCategory,
|
||||||
entries = ids.zip(labels).toMap().toImmutableMap(),
|
entries = ids.zip(labels).toMap(),
|
||||||
title = stringResource(MR.strings.default_category),
|
title = stringResource(MR.strings.default_category),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
@@ -146,10 +143,10 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_category_library_update),
|
title = stringResource(MR.strings.pref_category_library_update),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = autoUpdateIntervalPref,
|
preference = autoUpdateIntervalPref,
|
||||||
entries = persistentMapOf(
|
entries = mapOf(
|
||||||
0 to stringResource(MR.strings.update_never),
|
0 to stringResource(MR.strings.update_never),
|
||||||
12 to stringResource(MR.strings.update_12hour),
|
12 to stringResource(MR.strings.update_12hour),
|
||||||
24 to stringResource(MR.strings.update_24hour),
|
24 to stringResource(MR.strings.update_24hour),
|
||||||
@@ -165,7 +162,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
Preference.PreferenceItem.MultiSelectListPreference(
|
Preference.PreferenceItem.MultiSelectListPreference(
|
||||||
preference = libraryPreferences.autoUpdateDeviceRestrictions,
|
preference = libraryPreferences.autoUpdateDeviceRestrictions,
|
||||||
entries = persistentMapOf(
|
entries = mapOf(
|
||||||
DEVICE_ONLY_ON_WIFI to stringResource(MR.strings.connected_to_wifi),
|
DEVICE_ONLY_ON_WIFI to stringResource(MR.strings.connected_to_wifi),
|
||||||
DEVICE_NETWORK_NOT_METERED to stringResource(MR.strings.network_not_metered),
|
DEVICE_NETWORK_NOT_METERED to stringResource(MR.strings.network_not_metered),
|
||||||
DEVICE_CHARGING to stringResource(MR.strings.charging),
|
DEVICE_CHARGING to stringResource(MR.strings.charging),
|
||||||
@@ -195,7 +192,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
Preference.PreferenceItem.MultiSelectListPreference(
|
Preference.PreferenceItem.MultiSelectListPreference(
|
||||||
preference = libraryPreferences.autoUpdateMangaRestrictions,
|
preference = libraryPreferences.autoUpdateMangaRestrictions,
|
||||||
entries = persistentMapOf(
|
entries = mapOf(
|
||||||
MANGA_HAS_UNREAD to stringResource(MR.strings.pref_update_only_completely_read),
|
MANGA_HAS_UNREAD to stringResource(MR.strings.pref_update_only_completely_read),
|
||||||
MANGA_NON_READ to stringResource(MR.strings.pref_update_only_started),
|
MANGA_NON_READ to stringResource(MR.strings.pref_update_only_started),
|
||||||
MANGA_NON_COMPLETED to stringResource(MR.strings.pref_update_only_non_completed),
|
MANGA_NON_COMPLETED to stringResource(MR.strings.pref_update_only_non_completed),
|
||||||
@@ -217,10 +214,10 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
): Preference.PreferenceGroup {
|
): Preference.PreferenceGroup {
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_behavior),
|
title = stringResource(MR.strings.pref_behavior),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = libraryPreferences.swipeToStartAction,
|
preference = libraryPreferences.swipeToStartAction,
|
||||||
entries = persistentMapOf(
|
entries = mapOf(
|
||||||
LibraryPreferences.ChapterSwipeAction.Disabled to
|
LibraryPreferences.ChapterSwipeAction.Disabled to
|
||||||
stringResource(MR.strings.disabled),
|
stringResource(MR.strings.disabled),
|
||||||
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to
|
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to
|
||||||
@@ -234,7 +231,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = libraryPreferences.swipeToEndAction,
|
preference = libraryPreferences.swipeToEndAction,
|
||||||
entries = persistentMapOf(
|
entries = mapOf(
|
||||||
LibraryPreferences.ChapterSwipeAction.Disabled to
|
LibraryPreferences.ChapterSwipeAction.Disabled to
|
||||||
stringResource(MR.strings.disabled),
|
stringResource(MR.strings.disabled),
|
||||||
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to
|
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to
|
||||||
@@ -248,7 +245,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
Preference.PreferenceItem.MultiSelectListPreference(
|
Preference.PreferenceItem.MultiSelectListPreference(
|
||||||
preference = libraryPreferences.markDuplicateReadChapterAsRead,
|
preference = libraryPreferences.markDuplicateReadChapterAsRead,
|
||||||
entries = persistentMapOf(
|
entries = mapOf(
|
||||||
MARK_DUPLICATE_CHAPTER_READ_EXISTING to
|
MARK_DUPLICATE_CHAPTER_READ_EXISTING to
|
||||||
stringResource(MR.strings.pref_mark_duplicate_read_chapter_read_existing),
|
stringResource(MR.strings.pref_mark_duplicate_read_chapter_read_existing),
|
||||||
MARK_DUPLICATE_CHAPTER_READ_NEW to
|
MARK_DUPLICATE_CHAPTER_READ_NEW to
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ import eu.kanade.presentation.more.settings.screen.about.AboutScreen
|
|||||||
import eu.kanade.presentation.more.settings.widget.TextPreferenceWidget
|
import eu.kanade.presentation.more.settings.widget.TextPreferenceWidget
|
||||||
import eu.kanade.presentation.util.LocalBackPress
|
import eu.kanade.presentation.util.LocalBackPress
|
||||||
import eu.kanade.presentation.util.Screen
|
import eu.kanade.presentation.util.Screen
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.material.Scaffold
|
import tachiyomi.presentation.core.components.material.Scaffold
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
@@ -88,7 +87,7 @@ object SettingsMainScreen : Screen() {
|
|||||||
navigateUp = backPress::invoke,
|
navigateUp = backPress::invoke,
|
||||||
actions = {
|
actions = {
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
persistentListOf(
|
listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.action_search),
|
title = stringResource(MR.strings.action_search),
|
||||||
icon = Icons.Outlined.Search,
|
icon = Icons.Outlined.Search,
|
||||||
|
|||||||
+21
-32
@@ -10,9 +10,6 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation
|
|||||||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
||||||
import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
|
import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
|
||||||
import eu.kanade.tachiyomi.util.system.hasDisplayCutout
|
import eu.kanade.tachiyomi.util.system.hasDisplayCutout
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.persistentMapOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableMap
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.pluralStringResource
|
import tachiyomi.presentation.core.i18n.pluralStringResource
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
@@ -35,13 +32,12 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPref.defaultReadingMode,
|
preference = readerPref.defaultReadingMode,
|
||||||
entries = ReadingMode.entries.drop(1)
|
entries = ReadingMode.entries.drop(1)
|
||||||
.associate { it.flagValue to stringResource(it.stringRes) }
|
.associate { it.flagValue to stringResource(it.stringRes) },
|
||||||
.toImmutableMap(),
|
|
||||||
title = stringResource(MR.strings.pref_viewer_type),
|
title = stringResource(MR.strings.pref_viewer_type),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPref.doubleTapAnimSpeed,
|
preference = readerPref.doubleTapAnimSpeed,
|
||||||
entries = persistentMapOf(
|
entries = mapOf(
|
||||||
1 to stringResource(MR.strings.double_tap_anim_speed_0),
|
1 to stringResource(MR.strings.double_tap_anim_speed_0),
|
||||||
500 to stringResource(MR.strings.double_tap_anim_speed_normal),
|
500 to stringResource(MR.strings.double_tap_anim_speed_normal),
|
||||||
250 to stringResource(MR.strings.double_tap_anim_speed_fast),
|
250 to stringResource(MR.strings.double_tap_anim_speed_fast),
|
||||||
@@ -78,17 +74,16 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
val verticalNavigatorForLongStrip by readerPreferences.verticalNavigatorForLongStrip.collectAsState()
|
val verticalNavigatorForLongStrip by readerPreferences.verticalNavigatorForLongStrip.collectAsState()
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_category_display),
|
title = stringResource(MR.strings.pref_category_display),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.defaultOrientationType,
|
preference = readerPreferences.defaultOrientationType,
|
||||||
entries = ReaderOrientation.entries.drop(1)
|
entries = ReaderOrientation.entries.drop(1)
|
||||||
.associate { it.flagValue to stringResource(it.stringRes) }
|
.associate { it.flagValue to stringResource(it.stringRes) },
|
||||||
.toImmutableMap(),
|
|
||||||
title = stringResource(MR.strings.pref_rotation_type),
|
title = stringResource(MR.strings.pref_rotation_type),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.readerTheme,
|
preference = readerPreferences.readerTheme,
|
||||||
entries = persistentMapOf(
|
entries = mapOf(
|
||||||
1 to stringResource(MR.strings.black_background),
|
1 to stringResource(MR.strings.black_background),
|
||||||
2 to stringResource(MR.strings.gray_background),
|
2 to stringResource(MR.strings.gray_background),
|
||||||
0 to stringResource(MR.strings.white_background),
|
0 to stringResource(MR.strings.white_background),
|
||||||
@@ -140,7 +135,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = "E-Ink",
|
title = "E-Ink",
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.flashOnPageChange,
|
preference = readerPreferences.flashOnPageChange,
|
||||||
title = stringResource(MR.strings.pref_flash_page),
|
title = stringResource(MR.strings.pref_flash_page),
|
||||||
@@ -164,7 +159,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = flashColorPref,
|
preference = flashColorPref,
|
||||||
entries = persistentMapOf(
|
entries = mapOf(
|
||||||
ReaderPreferences.FlashColor.BLACK to stringResource(MR.strings.pref_flash_style_black),
|
ReaderPreferences.FlashColor.BLACK to stringResource(MR.strings.pref_flash_style_black),
|
||||||
ReaderPreferences.FlashColor.WHITE to stringResource(MR.strings.pref_flash_style_white),
|
ReaderPreferences.FlashColor.WHITE to stringResource(MR.strings.pref_flash_style_white),
|
||||||
ReaderPreferences.FlashColor.WHITE_BLACK
|
ReaderPreferences.FlashColor.WHITE_BLACK
|
||||||
@@ -181,7 +176,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
private fun getReadingGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
private fun getReadingGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_category_reading),
|
title = stringResource(MR.strings.pref_category_reading),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.skipRead,
|
preference = readerPreferences.skipRead,
|
||||||
title = stringResource(MR.strings.pref_skip_read_chapters),
|
title = stringResource(MR.strings.pref_skip_read_chapters),
|
||||||
@@ -216,25 +211,23 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pager_viewer),
|
title = stringResource(MR.strings.pager_viewer),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = navModePref,
|
preference = navModePref,
|
||||||
entries = ReaderPreferences.TapZones
|
entries = ReaderPreferences.TapZones
|
||||||
.mapIndexed { index, it -> index to stringResource(it) }
|
.mapIndexed { index, it -> index to stringResource(it) }
|
||||||
.toMap()
|
.toMap(),
|
||||||
.toImmutableMap(),
|
|
||||||
title = stringResource(MR.strings.pref_viewer_nav),
|
title = stringResource(MR.strings.pref_viewer_nav),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.pagerNavInverted,
|
preference = readerPreferences.pagerNavInverted,
|
||||||
entries = persistentListOf(
|
entries = listOf(
|
||||||
ReaderPreferences.TappingInvertMode.NONE,
|
ReaderPreferences.TappingInvertMode.NONE,
|
||||||
ReaderPreferences.TappingInvertMode.HORIZONTAL,
|
ReaderPreferences.TappingInvertMode.HORIZONTAL,
|
||||||
ReaderPreferences.TappingInvertMode.VERTICAL,
|
ReaderPreferences.TappingInvertMode.VERTICAL,
|
||||||
ReaderPreferences.TappingInvertMode.BOTH,
|
ReaderPreferences.TappingInvertMode.BOTH,
|
||||||
)
|
)
|
||||||
.associateWith { stringResource(it.titleRes) }
|
.associateWith { stringResource(it.titleRes) },
|
||||||
.toImmutableMap(),
|
|
||||||
title = stringResource(MR.strings.pref_read_with_tapping_inverted),
|
title = stringResource(MR.strings.pref_read_with_tapping_inverted),
|
||||||
enabled = navMode != 5,
|
enabled = navMode != 5,
|
||||||
),
|
),
|
||||||
@@ -242,16 +235,14 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
preference = imageScaleTypePref,
|
preference = imageScaleTypePref,
|
||||||
entries = ReaderPreferences.ImageScaleType
|
entries = ReaderPreferences.ImageScaleType
|
||||||
.mapIndexed { index, it -> index + 1 to stringResource(it) }
|
.mapIndexed { index, it -> index + 1 to stringResource(it) }
|
||||||
.toMap()
|
.toMap(),
|
||||||
.toImmutableMap(),
|
|
||||||
title = stringResource(MR.strings.pref_image_scale_type),
|
title = stringResource(MR.strings.pref_image_scale_type),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.zoomStart,
|
preference = readerPreferences.zoomStart,
|
||||||
entries = ReaderPreferences.ZoomStart
|
entries = ReaderPreferences.ZoomStart
|
||||||
.mapIndexed { index, it -> index + 1 to stringResource(it) }
|
.mapIndexed { index, it -> index + 1 to stringResource(it) }
|
||||||
.toMap()
|
.toMap(),
|
||||||
.toImmutableMap(),
|
|
||||||
title = stringResource(MR.strings.pref_zoom_start),
|
title = stringResource(MR.strings.pref_zoom_start),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
@@ -315,25 +306,23 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.webtoon_viewer),
|
title = stringResource(MR.strings.webtoon_viewer),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = navModePref,
|
preference = navModePref,
|
||||||
entries = ReaderPreferences.TapZones
|
entries = ReaderPreferences.TapZones
|
||||||
.mapIndexed { index, it -> index to stringResource(it) }
|
.mapIndexed { index, it -> index to stringResource(it) }
|
||||||
.toMap()
|
.toMap(),
|
||||||
.toImmutableMap(),
|
|
||||||
title = stringResource(MR.strings.pref_viewer_nav),
|
title = stringResource(MR.strings.pref_viewer_nav),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.webtoonNavInverted,
|
preference = readerPreferences.webtoonNavInverted,
|
||||||
entries = persistentListOf(
|
entries = listOf(
|
||||||
ReaderPreferences.TappingInvertMode.NONE,
|
ReaderPreferences.TappingInvertMode.NONE,
|
||||||
ReaderPreferences.TappingInvertMode.HORIZONTAL,
|
ReaderPreferences.TappingInvertMode.HORIZONTAL,
|
||||||
ReaderPreferences.TappingInvertMode.VERTICAL,
|
ReaderPreferences.TappingInvertMode.VERTICAL,
|
||||||
ReaderPreferences.TappingInvertMode.BOTH,
|
ReaderPreferences.TappingInvertMode.BOTH,
|
||||||
)
|
)
|
||||||
.associateWith { stringResource(it.titleRes) }
|
.associateWith { stringResource(it.titleRes) },
|
||||||
.toImmutableMap(),
|
|
||||||
title = stringResource(MR.strings.pref_read_with_tapping_inverted),
|
title = stringResource(MR.strings.pref_read_with_tapping_inverted),
|
||||||
enabled = navMode != 5,
|
enabled = navMode != 5,
|
||||||
),
|
),
|
||||||
@@ -348,7 +337,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
),
|
),
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = readerPreferences.readerHideThreshold,
|
preference = readerPreferences.readerHideThreshold,
|
||||||
entries = persistentMapOf(
|
entries = mapOf(
|
||||||
ReaderPreferences.ReaderHideThreshold.HIGHEST to stringResource(MR.strings.pref_highest),
|
ReaderPreferences.ReaderHideThreshold.HIGHEST to stringResource(MR.strings.pref_highest),
|
||||||
ReaderPreferences.ReaderHideThreshold.HIGH to stringResource(MR.strings.pref_high),
|
ReaderPreferences.ReaderHideThreshold.HIGH to stringResource(MR.strings.pref_high),
|
||||||
ReaderPreferences.ReaderHideThreshold.LOW to stringResource(MR.strings.pref_low),
|
ReaderPreferences.ReaderHideThreshold.LOW to stringResource(MR.strings.pref_low),
|
||||||
@@ -405,7 +394,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
val readWithVolumeKeys by readWithVolumeKeysPref.collectAsState()
|
val readWithVolumeKeys by readWithVolumeKeysPref.collectAsState()
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_reader_navigation),
|
title = stringResource(MR.strings.pref_reader_navigation),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readWithVolumeKeysPref,
|
preference = readWithVolumeKeysPref,
|
||||||
title = stringResource(MR.strings.pref_read_with_volume_keys),
|
title = stringResource(MR.strings.pref_read_with_volume_keys),
|
||||||
@@ -423,7 +412,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
private fun getActionsGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
private fun getActionsGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_reader_actions),
|
title = stringResource(MR.strings.pref_reader_actions),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = readerPreferences.readWithLongTap,
|
preference = readerPreferences.readWithLongTap,
|
||||||
title = stringResource(MR.strings.pref_read_with_long_tap),
|
title = stringResource(MR.strings.pref_read_with_long_tap),
|
||||||
|
|||||||
+5
-9
@@ -12,8 +12,6 @@ import eu.kanade.tachiyomi.core.security.SecurityPreferences
|
|||||||
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.authenticate
|
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.authenticate
|
||||||
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.isAuthenticationSupported
|
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.isAuthenticationSupported
|
||||||
import eu.kanade.tachiyomi.util.system.telemetryIncluded
|
import eu.kanade.tachiyomi.util.system.telemetryIncluded
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableMap
|
|
||||||
import tachiyomi.core.common.i18n.stringResource
|
import tachiyomi.core.common.i18n.stringResource
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.pluralStringResource
|
import tachiyomi.presentation.core.i18n.pluralStringResource
|
||||||
@@ -50,7 +48,7 @@ object SettingsSecurityScreen : SearchableSettings {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_security),
|
title = stringResource(MR.strings.pref_security),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = useAuthPref,
|
preference = useAuthPref,
|
||||||
title = stringResource(MR.strings.lock_with_biometrics),
|
title = stringResource(MR.strings.lock_with_biometrics),
|
||||||
@@ -70,8 +68,7 @@ object SettingsSecurityScreen : SearchableSettings {
|
|||||||
0 -> stringResource(MR.strings.lock_always)
|
0 -> stringResource(MR.strings.lock_always)
|
||||||
else -> pluralStringResource(MR.plurals.lock_after_mins, count = it, it)
|
else -> pluralStringResource(MR.plurals.lock_after_mins, count = it, it)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
.toImmutableMap(),
|
|
||||||
title = stringResource(MR.strings.lock_when_idle),
|
title = stringResource(MR.strings.lock_when_idle),
|
||||||
enabled = authSupported && useAuth,
|
enabled = authSupported && useAuth,
|
||||||
onValueChanged = {
|
onValueChanged = {
|
||||||
@@ -88,8 +85,7 @@ object SettingsSecurityScreen : SearchableSettings {
|
|||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = securityPreferences.secureScreen,
|
preference = securityPreferences.secureScreen,
|
||||||
entries = SecurityPreferences.SecureScreenMode.entries
|
entries = SecurityPreferences.SecureScreenMode.entries
|
||||||
.associateWith { stringResource(it.titleRes) }
|
.associateWith { stringResource(it.titleRes) },
|
||||||
.toImmutableMap(),
|
|
||||||
title = stringResource(MR.strings.secure_screen),
|
title = stringResource(MR.strings.secure_screen),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.secure_screen_summary)),
|
Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.secure_screen_summary)),
|
||||||
@@ -103,7 +99,7 @@ object SettingsSecurityScreen : SearchableSettings {
|
|||||||
): Preference.PreferenceGroup {
|
): Preference.PreferenceGroup {
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_firebase),
|
title = stringResource(MR.strings.pref_firebase),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.SwitchPreference(
|
Preference.PreferenceItem.SwitchPreference(
|
||||||
preference = privacyPreferences.crashlytics,
|
preference = privacyPreferences.crashlytics,
|
||||||
title = stringResource(MR.strings.onboarding_permission_crashlytics),
|
title = stringResource(MR.strings.onboarding_permission_crashlytics),
|
||||||
@@ -120,7 +116,7 @@ object SettingsSecurityScreen : SearchableSettings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val LockAfterValues = persistentListOf(
|
private val LockAfterValues = listOf(
|
||||||
0, // Always
|
0, // Always
|
||||||
1,
|
1,
|
||||||
2,
|
2,
|
||||||
|
|||||||
+3
-7
@@ -55,9 +55,6 @@ import eu.kanade.tachiyomi.data.track.myanimelist.MyAnimeListApi
|
|||||||
import eu.kanade.tachiyomi.data.track.shikimori.ShikimoriApi
|
import eu.kanade.tachiyomi.data.track.shikimori.ShikimoriApi
|
||||||
import eu.kanade.tachiyomi.util.system.openInBrowser
|
import eu.kanade.tachiyomi.util.system.openInBrowser
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.collections.immutable.toPersistentMap
|
|
||||||
import tachiyomi.core.common.util.lang.launchIO
|
import tachiyomi.core.common.util.lang.launchIO
|
||||||
import tachiyomi.core.common.util.lang.withUIContext
|
import tachiyomi.core.common.util.lang.withUIContext
|
||||||
import tachiyomi.domain.source.service.SourceManager
|
import tachiyomi.domain.source.service.SourceManager
|
||||||
@@ -134,13 +131,12 @@ object SettingsTrackingScreen : SearchableSettings {
|
|||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
preference = trackPreferences.autoUpdateTrackOnMarkRead,
|
preference = trackPreferences.autoUpdateTrackOnMarkRead,
|
||||||
entries = AutoTrackState.entries
|
entries = AutoTrackState.entries
|
||||||
.associateWith { stringResource(it.titleRes) }
|
.associateWith { stringResource(it.titleRes) },
|
||||||
.toPersistentMap(),
|
|
||||||
title = stringResource(MR.strings.pref_auto_update_manga_on_mark_read),
|
title = stringResource(MR.strings.pref_auto_update_manga_on_mark_read),
|
||||||
),
|
),
|
||||||
Preference.PreferenceGroup(
|
Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.services),
|
title = stringResource(MR.strings.services),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.TrackerPreference(
|
Preference.PreferenceItem.TrackerPreference(
|
||||||
tracker = trackerManager.myAnimeList,
|
tracker = trackerManager.myAnimeList,
|
||||||
login = { context.openInBrowser(MyAnimeListApi.authUrl(), forceDefaultBrowser = true) },
|
login = { context.openInBrowser(MyAnimeListApi.authUrl(), forceDefaultBrowser = true) },
|
||||||
@@ -185,7 +181,7 @@ object SettingsTrackingScreen : SearchableSettings {
|
|||||||
logout = service::logout,
|
logout = service::logout,
|
||||||
)
|
)
|
||||||
} + listOf(Preference.PreferenceItem.InfoPreference(enhancedTrackerInfo))
|
} + listOf(Preference.PreferenceItem.InfoPreference(enhancedTrackerInfo))
|
||||||
).toImmutableList(),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -18,7 +18,6 @@ import com.google.android.material.textview.MaterialTextView
|
|||||||
import eu.kanade.presentation.components.AppBar
|
import eu.kanade.presentation.components.AppBar
|
||||||
import eu.kanade.presentation.components.AppBarActions
|
import eu.kanade.presentation.components.AppBarActions
|
||||||
import eu.kanade.presentation.util.Screen
|
import eu.kanade.presentation.util.Screen
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.material.Scaffold
|
import tachiyomi.presentation.core.components.material.Scaffold
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
@@ -42,7 +41,7 @@ class OpenSourceLibraryLicenseScreen(
|
|||||||
actions = {
|
actions = {
|
||||||
if (!website.isNullOrEmpty()) {
|
if (!website.isNullOrEmpty()) {
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
persistentListOf(
|
listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.website),
|
title = stringResource(MR.strings.website),
|
||||||
icon = Icons.Default.Public,
|
icon = Icons.Default.Public,
|
||||||
|
|||||||
+1
-2
@@ -40,7 +40,6 @@ import eu.kanade.presentation.components.AppBar
|
|||||||
import eu.kanade.presentation.components.AppBarActions
|
import eu.kanade.presentation.components.AppBarActions
|
||||||
import eu.kanade.presentation.util.Screen
|
import eu.kanade.presentation.util.Screen
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.flow.update
|
import kotlinx.coroutines.flow.update
|
||||||
import tachiyomi.core.common.util.lang.launchIO
|
import tachiyomi.core.common.util.lang.launchIO
|
||||||
@@ -140,7 +139,7 @@ class ClearDatabaseScreen : Screen() {
|
|||||||
actions = {
|
actions = {
|
||||||
if (s.items.isNotEmpty()) {
|
if (s.items.isNotEmpty()) {
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
actions = persistentListOf(
|
actions = listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.action_select_all),
|
title = stringResource(MR.strings.action_select_all),
|
||||||
icon = Icons.Outlined.SelectAll,
|
icon = Icons.Outlined.SelectAll,
|
||||||
|
|||||||
+4
-9
@@ -27,8 +27,6 @@ import eu.kanade.presentation.components.AppBar
|
|||||||
import eu.kanade.presentation.util.Screen
|
import eu.kanade.presentation.util.Screen
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import org.xmlpull.v1.XmlPullParser
|
import org.xmlpull.v1.XmlPullParser
|
||||||
import tachiyomi.core.common.i18n.stringResource
|
import tachiyomi.core.common.i18n.stringResource
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
@@ -94,8 +92,7 @@ class AppLanguageScreen : Screen() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getLangs(context: Context): ImmutableList<Language> {
|
private fun getLangs(context: Context): List<Language> = buildList {
|
||||||
val langs = mutableListOf<Language>()
|
|
||||||
val parser = context.resources.getXml(R.xml.locales_config)
|
val parser = context.resources.getXml(R.xml.locales_config)
|
||||||
var eventType = parser.eventType
|
var eventType = parser.eventType
|
||||||
while (eventType != XmlPullParser.END_DOCUMENT) {
|
while (eventType != XmlPullParser.END_DOCUMENT) {
|
||||||
@@ -105,7 +102,7 @@ class AppLanguageScreen : Screen() {
|
|||||||
val langTag = parser.getAttributeValue(i)
|
val langTag = parser.getAttributeValue(i)
|
||||||
val displayName = LocaleHelper.getLocalizedDisplayName(langTag)
|
val displayName = LocaleHelper.getLocalizedDisplayName(langTag)
|
||||||
if (displayName.isNotEmpty()) {
|
if (displayName.isNotEmpty()) {
|
||||||
langs.add(Language(langTag, displayName, LocaleHelper.getDisplayName(langTag)))
|
add(Language(langTag, displayName, LocaleHelper.getDisplayName(langTag)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,10 +110,8 @@ class AppLanguageScreen : Screen() {
|
|||||||
eventType = parser.next()
|
eventType = parser.next()
|
||||||
}
|
}
|
||||||
|
|
||||||
langs.sortBy { it.displayName }
|
sortBy { it.displayName }
|
||||||
langs.add(0, Language("", context.stringResource(MR.strings.label_default), null))
|
add(0, Language("", context.stringResource(MR.strings.label_default), null))
|
||||||
|
|
||||||
return langs.toImmutableList()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private data class Language(
|
private data class Language(
|
||||||
|
|||||||
+1
-2
@@ -23,7 +23,6 @@ import eu.kanade.tachiyomi.data.backup.create.BackupCreator
|
|||||||
import eu.kanade.tachiyomi.data.backup.create.BackupOptions
|
import eu.kanade.tachiyomi.data.backup.create.BackupOptions
|
||||||
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.coroutines.flow.update
|
import kotlinx.coroutines.flow.update
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.LabeledCheckbox
|
import tachiyomi.presentation.core.components.LabeledCheckbox
|
||||||
@@ -103,7 +102,7 @@ class CreateBackupScreen : Screen() {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Options(
|
private fun Options(
|
||||||
options: ImmutableList<BackupOptions.Entry>,
|
options: List<BackupOptions.Entry>,
|
||||||
state: CreateBackupScreenModel.State,
|
state: CreateBackupScreenModel.State,
|
||||||
model: CreateBackupScreenModel,
|
model: CreateBackupScreenModel,
|
||||||
) {
|
) {
|
||||||
|
|||||||
+1
-2
@@ -19,7 +19,6 @@ import eu.kanade.presentation.components.AppBarActions
|
|||||||
import eu.kanade.presentation.util.Screen
|
import eu.kanade.presentation.util.Screen
|
||||||
import eu.kanade.tachiyomi.data.backup.models.Backup
|
import eu.kanade.tachiyomi.data.backup.models.Backup
|
||||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.serialization.protobuf.schema.ProtoBufSchemaGenerator
|
import kotlinx.serialization.protobuf.schema.ProtoBufSchemaGenerator
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.material.Scaffold
|
import tachiyomi.presentation.core.components.material.Scaffold
|
||||||
@@ -45,7 +44,7 @@ class BackupSchemaScreen : Screen() {
|
|||||||
navigateUp = navigator::pop,
|
navigateUp = navigator::pop,
|
||||||
actions = {
|
actions = {
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
persistentListOf(
|
listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.action_copy_to_clipboard),
|
title = stringResource(MR.strings.action_copy_to_clipboard),
|
||||||
icon = Icons.Default.ContentCopy,
|
icon = Icons.Default.ContentCopy,
|
||||||
|
|||||||
+6
-8
@@ -24,8 +24,6 @@ import eu.kanade.presentation.util.Screen
|
|||||||
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||||
import eu.kanade.tachiyomi.util.system.WebViewUtil
|
import eu.kanade.tachiyomi.util.system.WebViewUtil
|
||||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||||
import kotlinx.collections.immutable.mutate
|
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.coroutines.guava.await
|
import kotlinx.coroutines.guava.await
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import mihon.core.common.FeatureFlags
|
import mihon.core.common.FeatureFlags
|
||||||
@@ -69,7 +67,7 @@ class DebugInfoScreen : Screen() {
|
|||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = "App info",
|
title = "App info",
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = "Version",
|
title = "Version",
|
||||||
subtitle = AboutScreen.getVersionName(false),
|
subtitle = AboutScreen.getVersionName(false),
|
||||||
@@ -141,8 +139,8 @@ class DebugInfoScreen : Screen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getDeviceInfoGroup(): Preference.PreferenceGroup {
|
private fun getDeviceInfoGroup(): Preference.PreferenceGroup {
|
||||||
val items = persistentListOf<Preference.PreferenceItem<out Any, out Any>>().mutate {
|
val items = buildList {
|
||||||
it.add(
|
add(
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = "Model",
|
title = "Model",
|
||||||
subtitle = "${Build.MANUFACTURER} ${Build.MODEL} (${Build.DEVICE})",
|
subtitle = "${Build.MANUFACTURER} ${Build.MODEL} (${Build.DEVICE})",
|
||||||
@@ -150,14 +148,14 @@ class DebugInfoScreen : Screen() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (DeviceUtil.oneUiVersion != null) {
|
if (DeviceUtil.oneUiVersion != null) {
|
||||||
it.add(
|
add(
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = "OneUI version",
|
title = "OneUI version",
|
||||||
subtitle = "${DeviceUtil.oneUiVersion}",
|
subtitle = "${DeviceUtil.oneUiVersion}",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
} else if (DeviceUtil.miuiMajorVersion != null) {
|
} else if (DeviceUtil.miuiMajorVersion != null) {
|
||||||
it.add(
|
add(
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = "MIUI version",
|
title = "MIUI version",
|
||||||
subtitle = "${DeviceUtil.miuiMajorVersion}",
|
subtitle = "${DeviceUtil.miuiMajorVersion}",
|
||||||
@@ -172,7 +170,7 @@ class DebugInfoScreen : Screen() {
|
|||||||
} else {
|
} else {
|
||||||
Build.VERSION.RELEASE
|
Build.VERSION.RELEASE
|
||||||
}
|
}
|
||||||
it.add(
|
add(
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = "Android version",
|
title = "Android version",
|
||||||
subtitle = "$androidVersion (${Build.DISPLAY})",
|
subtitle = "$androidVersion (${Build.DISPLAY})",
|
||||||
|
|||||||
+1
-2
@@ -32,7 +32,6 @@ import eu.kanade.presentation.util.ioCoroutineScope
|
|||||||
import eu.kanade.tachiyomi.util.lang.toDateTimestampString
|
import eu.kanade.tachiyomi.util.lang.toDateTimestampString
|
||||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||||
import eu.kanade.tachiyomi.util.system.workManager
|
import eu.kanade.tachiyomi.util.system.workManager
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.coroutines.flow.SharingStarted
|
import kotlinx.coroutines.flow.SharingStarted
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import kotlinx.coroutines.flow.stateIn
|
import kotlinx.coroutines.flow.stateIn
|
||||||
@@ -69,7 +68,7 @@ class WorkerInfoScreen : Screen() {
|
|||||||
navigateUp = navigator::pop,
|
navigateUp = navigator::pop,
|
||||||
actions = {
|
actions = {
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
persistentListOf(
|
listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.action_copy_to_clipboard),
|
title = stringResource(MR.strings.action_copy_to_clipboard),
|
||||||
icon = Icons.Default.ContentCopy,
|
icon = Icons.Default.ContentCopy,
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
|||||||
import eu.kanade.tachiyomi.data.database.models.toDomainChapter
|
import eu.kanade.tachiyomi.data.database.models.toDomainChapter
|
||||||
import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition
|
import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition
|
||||||
import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter
|
import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter
|
||||||
import kotlinx.collections.immutable.persistentMapOf
|
|
||||||
import tachiyomi.domain.chapter.model.Chapter
|
import tachiyomi.domain.chapter.model.Chapter
|
||||||
import tachiyomi.domain.chapter.service.calculateChapterGap
|
import tachiyomi.domain.chapter.service.calculateChapterGap
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
@@ -235,7 +234,7 @@ private fun ChapterText(
|
|||||||
maxLines = 5,
|
maxLines = 5,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
style = MaterialTheme.typography.titleLarge,
|
style = MaterialTheme.typography.titleLarge,
|
||||||
inlineContent = persistentMapOf(
|
inlineContent = mapOf(
|
||||||
DOWNLOADED_ICON_ID to InlineTextContent(
|
DOWNLOADED_ICON_ID to InlineTextContent(
|
||||||
Placeholder(
|
Placeholder(
|
||||||
width = 22.sp,
|
width = 22.sp,
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import eu.kanade.presentation.components.AppBar
|
import eu.kanade.presentation.components.AppBar
|
||||||
import eu.kanade.presentation.components.AppBarActions
|
import eu.kanade.presentation.components.AppBarActions
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
|
|
||||||
@@ -32,51 +31,49 @@ fun ReaderTopBar(
|
|||||||
navigateUp = navigateUp,
|
navigateUp = navigateUp,
|
||||||
actions = {
|
actions = {
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
actions = persistentListOf<AppBar.AppBarAction>().builder()
|
actions = buildList {
|
||||||
.apply {
|
add(
|
||||||
add(
|
AppBar.Action(
|
||||||
AppBar.Action(
|
title = stringResource(
|
||||||
title = stringResource(
|
if (bookmarked) {
|
||||||
if (bookmarked) {
|
MR.strings.action_remove_bookmark
|
||||||
MR.strings.action_remove_bookmark
|
|
||||||
} else {
|
|
||||||
MR.strings.action_bookmark
|
|
||||||
},
|
|
||||||
),
|
|
||||||
icon = if (bookmarked) {
|
|
||||||
Icons.Outlined.Bookmark
|
|
||||||
} else {
|
} else {
|
||||||
Icons.Outlined.BookmarkBorder
|
MR.strings.action_bookmark
|
||||||
},
|
},
|
||||||
onClick = onToggleBookmarked,
|
),
|
||||||
|
icon = if (bookmarked) {
|
||||||
|
Icons.Outlined.Bookmark
|
||||||
|
} else {
|
||||||
|
Icons.Outlined.BookmarkBorder
|
||||||
|
},
|
||||||
|
onClick = onToggleBookmarked,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
onOpenInWebView?.let {
|
||||||
|
add(
|
||||||
|
AppBar.OverflowAction(
|
||||||
|
title = stringResource(MR.strings.action_open_in_web_view),
|
||||||
|
onClick = it,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
onOpenInWebView?.let {
|
|
||||||
add(
|
|
||||||
AppBar.OverflowAction(
|
|
||||||
title = stringResource(MR.strings.action_open_in_web_view),
|
|
||||||
onClick = it,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
onOpenInBrowser?.let {
|
|
||||||
add(
|
|
||||||
AppBar.OverflowAction(
|
|
||||||
title = stringResource(MR.strings.action_open_in_browser),
|
|
||||||
onClick = it,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
onShare?.let {
|
|
||||||
add(
|
|
||||||
AppBar.OverflowAction(
|
|
||||||
title = stringResource(MR.strings.action_share),
|
|
||||||
onClick = it,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.build(),
|
onOpenInBrowser?.let {
|
||||||
|
add(
|
||||||
|
AppBar.OverflowAction(
|
||||||
|
title = stringResource(MR.strings.action_open_in_browser),
|
||||||
|
onClick = it,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
onShare?.let {
|
||||||
|
add(
|
||||||
|
AppBar.OverflowAction(
|
||||||
|
title = stringResource(MR.strings.action_share),
|
||||||
|
onClick = it,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import androidx.compose.ui.window.DialogWindowProvider
|
|||||||
import eu.kanade.presentation.components.TabbedDialog
|
import eu.kanade.presentation.components.TabbedDialog
|
||||||
import eu.kanade.presentation.components.TabbedDialogPaddings
|
import eu.kanade.presentation.components.TabbedDialogPaddings
|
||||||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
|
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
|
|
||||||
@@ -26,7 +25,7 @@ fun ReaderSettingsDialog(
|
|||||||
onHideMenus: () -> Unit,
|
onHideMenus: () -> Unit,
|
||||||
screenModel: ReaderSettingsScreenModel,
|
screenModel: ReaderSettingsScreenModel,
|
||||||
) {
|
) {
|
||||||
val tabTitles = persistentListOf(
|
val tabTitles = listOf(
|
||||||
stringResource(MR.strings.pref_category_reading_mode),
|
stringResource(MR.strings.pref_category_reading_mode),
|
||||||
stringResource(MR.strings.pref_category_general),
|
stringResource(MR.strings.pref_category_general),
|
||||||
stringResource(MR.strings.custom_filter),
|
stringResource(MR.strings.custom_filter),
|
||||||
|
|||||||
@@ -33,9 +33,6 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import dev.icerock.moko.resources.StringResource
|
import dev.icerock.moko.resources.StringResource
|
||||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.persistentMapOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
|
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
|
||||||
import tachiyomi.presentation.core.components.WheelNumberPicker
|
import tachiyomi.presentation.core.components.WheelNumberPicker
|
||||||
@@ -104,7 +101,7 @@ fun TrackChapterSelector(
|
|||||||
title = stringResource(MR.strings.chapters),
|
title = stringResource(MR.strings.chapters),
|
||||||
content = {
|
content = {
|
||||||
WheelNumberPicker(
|
WheelNumberPicker(
|
||||||
items = range.toImmutableList(),
|
items = range.toList(),
|
||||||
modifier = Modifier.align(Alignment.Center),
|
modifier = Modifier.align(Alignment.Center),
|
||||||
startIndex = selection,
|
startIndex = selection,
|
||||||
onSelectionChanged = { onSelectionChange(it) },
|
onSelectionChanged = { onSelectionChange(it) },
|
||||||
@@ -119,7 +116,7 @@ fun TrackChapterSelector(
|
|||||||
fun TrackScoreSelector(
|
fun TrackScoreSelector(
|
||||||
selection: String,
|
selection: String,
|
||||||
onSelectionChange: (String) -> Unit,
|
onSelectionChange: (String) -> Unit,
|
||||||
selections: ImmutableList<String>,
|
selections: List<String>,
|
||||||
onConfirm: () -> Unit,
|
onConfirm: () -> Unit,
|
||||||
onDismissRequest: () -> Unit,
|
onDismissRequest: () -> Unit,
|
||||||
) {
|
) {
|
||||||
@@ -232,7 +229,7 @@ private fun TrackStatusSelectorPreviews() {
|
|||||||
TrackStatusSelector(
|
TrackStatusSelector(
|
||||||
selection = 1,
|
selection = 1,
|
||||||
onSelectionChange = {},
|
onSelectionChange = {},
|
||||||
selections = persistentMapOf(
|
selections = mapOf(
|
||||||
// Anilist values
|
// Anilist values
|
||||||
1L to MR.strings.reading,
|
1L to MR.strings.reading,
|
||||||
2L to MR.strings.plan_to_read,
|
2L to MR.strings.plan_to_read,
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import androidx.compose.ui.Modifier
|
|||||||
import eu.kanade.presentation.components.TabbedDialog
|
import eu.kanade.presentation.components.TabbedDialog
|
||||||
import eu.kanade.presentation.components.TabbedDialogPaddings
|
import eu.kanade.presentation.components.TabbedDialogPaddings
|
||||||
import eu.kanade.tachiyomi.ui.updates.UpdatesSettingsScreenModel
|
import eu.kanade.tachiyomi.ui.updates.UpdatesSettingsScreenModel
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.core.common.preference.getAndSet
|
import tachiyomi.core.common.preference.getAndSet
|
||||||
import tachiyomi.domain.updates.service.UpdatesPreferences
|
import tachiyomi.domain.updates.service.UpdatesPreferences
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
@@ -37,7 +36,7 @@ fun UpdatesFilterDialog(
|
|||||||
) {
|
) {
|
||||||
TabbedDialog(
|
TabbedDialog(
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
tabTitles = persistentListOf(
|
tabTitles = listOf(
|
||||||
stringResource(MR.strings.action_filter),
|
stringResource(MR.strings.action_filter),
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import eu.kanade.presentation.manga.components.MangaBottomActionMenu
|
|||||||
import eu.kanade.tachiyomi.data.download.model.Download
|
import eu.kanade.tachiyomi.data.download.model.Download
|
||||||
import eu.kanade.tachiyomi.ui.updates.UpdatesItem
|
import eu.kanade.tachiyomi.ui.updates.UpdatesItem
|
||||||
import eu.kanade.tachiyomi.ui.updates.UpdatesScreenModel
|
import eu.kanade.tachiyomi.ui.updates.UpdatesScreenModel
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
@@ -156,7 +155,7 @@ private fun UpdatesAppBar(
|
|||||||
title = stringResource(MR.strings.label_recent_updates),
|
title = stringResource(MR.strings.label_recent_updates),
|
||||||
actions = {
|
actions = {
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
persistentListOf(
|
listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.action_filter),
|
title = stringResource(MR.strings.action_filter),
|
||||||
icon = Icons.Outlined.FilterList,
|
icon = Icons.Outlined.FilterList,
|
||||||
@@ -180,7 +179,7 @@ private fun UpdatesAppBar(
|
|||||||
onCancelActionMode = onCancelActionMode,
|
onCancelActionMode = onCancelActionMode,
|
||||||
actionModeActions = {
|
actionModeActions = {
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
persistentListOf(
|
listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.action_select_all),
|
title = stringResource(MR.strings.action_select_all),
|
||||||
icon = Icons.Outlined.SelectAll,
|
icon = Icons.Outlined.SelectAll,
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ import eu.kanade.tachiyomi.BuildConfig
|
|||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.util.system.getHtml
|
import eu.kanade.tachiyomi.util.system.getHtml
|
||||||
import eu.kanade.tachiyomi.util.system.setDefaultSettings
|
import eu.kanade.tachiyomi.util.system.setDefaultSettings
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.material.Scaffold
|
import tachiyomi.presentation.core.components.material.Scaffold
|
||||||
@@ -234,7 +233,7 @@ fun WebViewScreenContent(
|
|||||||
navigationIcon = Icons.Outlined.Close,
|
navigationIcon = Icons.Outlined.Close,
|
||||||
actions = {
|
actions = {
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
persistentListOf(
|
listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.action_webview_back),
|
title = stringResource(MR.strings.action_webview_back),
|
||||||
icon = Icons.AutoMirrored.Outlined.ArrowBack,
|
icon = Icons.AutoMirrored.Outlined.ArrowBack,
|
||||||
@@ -271,7 +270,7 @@ fun WebViewScreenContent(
|
|||||||
title = stringResource(MR.strings.pref_clear_cookies),
|
title = stringResource(MR.strings.pref_clear_cookies),
|
||||||
onClick = { onClearCookies(currentUrl) },
|
onClick = { onClearCookies(currentUrl) },
|
||||||
),
|
),
|
||||||
).builder().apply {
|
).toMutableList().apply {
|
||||||
if (windowStack.size > 1) {
|
if (windowStack.size > 1) {
|
||||||
add(
|
add(
|
||||||
0,
|
0,
|
||||||
@@ -282,7 +281,7 @@ fun WebViewScreenContent(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}.build(),
|
},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package eu.kanade.tachiyomi.data.backup.create
|
package eu.kanade.tachiyomi.data.backup.create
|
||||||
|
|
||||||
import dev.icerock.moko.resources.StringResource
|
import dev.icerock.moko.resources.StringResource
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
|
|
||||||
data class BackupOptions(
|
data class BackupOptions(
|
||||||
@@ -33,7 +32,7 @@ data class BackupOptions(
|
|||||||
fun canCreate() = libraryEntries || categories || appSettings || extensionStores || sourceSettings
|
fun canCreate() = libraryEntries || categories || appSettings || extensionStores || sourceSettings
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val libraryOptions = persistentListOf(
|
val libraryOptions = listOf(
|
||||||
Entry(
|
Entry(
|
||||||
label = MR.strings.manga,
|
label = MR.strings.manga,
|
||||||
getter = BackupOptions::libraryEntries,
|
getter = BackupOptions::libraryEntries,
|
||||||
@@ -70,7 +69,7 @@ data class BackupOptions(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
val settingsOptions = persistentListOf(
|
val settingsOptions = listOf(
|
||||||
Entry(
|
Entry(
|
||||||
label = MR.strings.app_settings,
|
label = MR.strings.app_settings,
|
||||||
getter = BackupOptions::appSettings,
|
getter = BackupOptions::appSettings,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package eu.kanade.tachiyomi.data.backup.restore
|
package eu.kanade.tachiyomi.data.backup.restore
|
||||||
|
|
||||||
import dev.icerock.moko.resources.StringResource
|
import dev.icerock.moko.resources.StringResource
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
|
|
||||||
data class RestoreOptions(
|
data class RestoreOptions(
|
||||||
@@ -23,7 +22,7 @@ data class RestoreOptions(
|
|||||||
fun canRestore() = libraryEntries || categories || appSettings || extensionStores || sourceSettings
|
fun canRestore() = libraryEntries || categories || appSettings || extensionStores || sourceSettings
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val options = persistentListOf(
|
val options = listOf(
|
||||||
Entry(
|
Entry(
|
||||||
label = MR.strings.label_library,
|
label = MR.strings.label_library,
|
||||||
getter = RestoreOptions::libraryEntries,
|
getter = RestoreOptions::libraryEntries,
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import androidx.annotation.DrawableRes
|
|||||||
import dev.icerock.moko.resources.StringResource
|
import dev.icerock.moko.resources.StringResource
|
||||||
import eu.kanade.tachiyomi.data.database.models.Track
|
import eu.kanade.tachiyomi.data.database.models.Track
|
||||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import tachiyomi.domain.track.model.Track as DomainTrack
|
import tachiyomi.domain.track.model.Track as DomainTrack
|
||||||
@@ -36,7 +35,7 @@ interface Tracker {
|
|||||||
|
|
||||||
fun getCompletionStatus(): Long
|
fun getCompletionStatus(): Long
|
||||||
|
|
||||||
fun getScoreList(): ImmutableList<String>
|
fun getScoreList(): List<String>
|
||||||
|
|
||||||
// TODO: Store all scores as 10 point in the future maybe?
|
// TODO: Store all scores as 10 point in the future maybe?
|
||||||
fun get10PointScore(track: DomainTrack): Double
|
fun get10PointScore(track: DomainTrack): Double
|
||||||
|
|||||||
@@ -8,9 +8,6 @@ import eu.kanade.tachiyomi.data.track.BaseTracker
|
|||||||
import eu.kanade.tachiyomi.data.track.DeletableTracker
|
import eu.kanade.tachiyomi.data.track.DeletableTracker
|
||||||
import eu.kanade.tachiyomi.data.track.anilist.dto.ALOAuth
|
import eu.kanade.tachiyomi.data.track.anilist.dto.ALOAuth
|
||||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
@@ -77,18 +74,18 @@ class Anilist(id: Long) : BaseTracker(id, "AniList"), DeletableTracker {
|
|||||||
|
|
||||||
override fun getCompletionStatus(): Long = COMPLETED
|
override fun getCompletionStatus(): Long = COMPLETED
|
||||||
|
|
||||||
override fun getScoreList(): ImmutableList<String> {
|
override fun getScoreList(): List<String> {
|
||||||
return when (scorePreference.get()) {
|
return when (scorePreference.get()) {
|
||||||
// 10 point
|
// 10 point
|
||||||
POINT_10 -> IntRange(0, 10).map(Int::toString).toImmutableList()
|
POINT_10 -> IntRange(0, 10).map(Int::toString)
|
||||||
// 100 point
|
// 100 point
|
||||||
POINT_100 -> IntRange(0, 100).map(Int::toString).toImmutableList()
|
POINT_100 -> IntRange(0, 100).map(Int::toString)
|
||||||
// 5 stars
|
// 5 stars
|
||||||
POINT_5 -> IntRange(0, 5).map { "$it ★" }.toImmutableList()
|
POINT_5 -> IntRange(0, 5).map { "$it ★" }
|
||||||
// Smiley
|
// Smiley
|
||||||
POINT_3 -> persistentListOf("-", "😦", "😐", "😊")
|
POINT_3 -> listOf("-", "😦", "😐", "😊")
|
||||||
// 10 point decimal
|
// 10 point decimal
|
||||||
POINT_10_DECIMAL -> IntRange(0, 100).map { (it / 10f).toString() }.toImmutableList()
|
POINT_10_DECIMAL -> IntRange(0, 100).map { (it / 10f).toString() }
|
||||||
else -> throw Exception("Unknown score type")
|
else -> throw Exception("Unknown score type")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import eu.kanade.tachiyomi.data.database.models.Track
|
|||||||
import eu.kanade.tachiyomi.data.track.BaseTracker
|
import eu.kanade.tachiyomi.data.track.BaseTracker
|
||||||
import eu.kanade.tachiyomi.data.track.bangumi.dto.BGMOAuth
|
import eu.kanade.tachiyomi.data.track.bangumi.dto.BGMOAuth
|
||||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
@@ -23,7 +21,7 @@ class Bangumi(id: Long) : BaseTracker(id, "Bangumi") {
|
|||||||
|
|
||||||
override val supportsPrivateTracking: Boolean = true
|
override val supportsPrivateTracking: Boolean = true
|
||||||
|
|
||||||
override fun getScoreList(): ImmutableList<String> = SCORE_LIST
|
override fun getScoreList(): List<String> = SCORE_LIST
|
||||||
|
|
||||||
override fun displayScore(track: DomainTrack): String {
|
override fun displayScore(track: DomainTrack): String {
|
||||||
return track.score.toInt().toString()
|
return track.score.toInt().toString()
|
||||||
@@ -142,6 +140,5 @@ class Bangumi(id: Long) : BaseTracker(id, "Bangumi") {
|
|||||||
|
|
||||||
private val SCORE_LIST = IntRange(0, 10)
|
private val SCORE_LIST = IntRange(0, 10)
|
||||||
.map(Int::toString)
|
.map(Int::toString)
|
||||||
.toImmutableList()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
|||||||
import eu.kanade.tachiyomi.source.ConfigurableSource
|
import eu.kanade.tachiyomi.source.ConfigurableSource
|
||||||
import eu.kanade.tachiyomi.source.Source
|
import eu.kanade.tachiyomi.source.Source
|
||||||
import eu.kanade.tachiyomi.source.sourcePreferences
|
import eu.kanade.tachiyomi.source.sourcePreferences
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.domain.manga.model.Manga
|
import tachiyomi.domain.manga.model.Manga
|
||||||
import tachiyomi.domain.source.service.SourceManager
|
import tachiyomi.domain.source.service.SourceManager
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
@@ -50,7 +48,7 @@ class Kavita(id: Long) : BaseTracker(id, "Kavita"), EnhancedTracker {
|
|||||||
|
|
||||||
override fun getCompletionStatus(): Long = COMPLETED
|
override fun getCompletionStatus(): Long = COMPLETED
|
||||||
|
|
||||||
override fun getScoreList(): ImmutableList<String> = persistentListOf()
|
override fun getScoreList(): List<String> = listOf()
|
||||||
|
|
||||||
override fun displayScore(track: DomainTrack): String = ""
|
override fun displayScore(track: DomainTrack): String = ""
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import eu.kanade.tachiyomi.data.track.BaseTracker
|
|||||||
import eu.kanade.tachiyomi.data.track.DeletableTracker
|
import eu.kanade.tachiyomi.data.track.DeletableTracker
|
||||||
import eu.kanade.tachiyomi.data.track.kitsu.dto.KitsuOAuth
|
import eu.kanade.tachiyomi.data.track.kitsu.dto.KitsuOAuth
|
||||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
@@ -56,9 +54,9 @@ class Kitsu(id: Long) : BaseTracker(id, "Kitsu"), DeletableTracker {
|
|||||||
|
|
||||||
override fun getCompletionStatus(): Long = COMPLETED
|
override fun getCompletionStatus(): Long = COMPLETED
|
||||||
|
|
||||||
override fun getScoreList(): ImmutableList<String> {
|
override fun getScoreList(): List<String> {
|
||||||
val df = DecimalFormat("0.#")
|
val df = DecimalFormat("0.#")
|
||||||
return (listOf("0") + IntRange(2, 20).map { df.format(it / 2f) }).toImmutableList()
|
return (listOf("0") + IntRange(2, 20).map { df.format(it / 2f) })
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun indexToScore(index: Int): Double {
|
override fun indexToScore(index: Int): Double {
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import eu.kanade.tachiyomi.data.track.BaseTracker
|
|||||||
import eu.kanade.tachiyomi.data.track.EnhancedTracker
|
import eu.kanade.tachiyomi.data.track.EnhancedTracker
|
||||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||||
import eu.kanade.tachiyomi.source.Source
|
import eu.kanade.tachiyomi.source.Source
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import okhttp3.Dns
|
import okhttp3.Dns
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import tachiyomi.domain.manga.model.Manga
|
import tachiyomi.domain.manga.model.Manga
|
||||||
@@ -47,7 +45,7 @@ class Komga(id: Long) : BaseTracker(id, "Komga"), EnhancedTracker {
|
|||||||
|
|
||||||
override fun getCompletionStatus(): Long = COMPLETED
|
override fun getCompletionStatus(): Long = COMPLETED
|
||||||
|
|
||||||
override fun getScoreList(): ImmutableList<String> = persistentListOf()
|
override fun getScoreList(): List<String> = listOf()
|
||||||
|
|
||||||
override fun displayScore(track: DomainTrack): String = ""
|
override fun displayScore(track: DomainTrack): String = ""
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import eu.kanade.tachiyomi.data.track.mangaupdates.dto.MURating
|
|||||||
import eu.kanade.tachiyomi.data.track.mangaupdates.dto.copyTo
|
import eu.kanade.tachiyomi.data.track.mangaupdates.dto.copyTo
|
||||||
import eu.kanade.tachiyomi.data.track.mangaupdates.dto.toTrackSearch
|
import eu.kanade.tachiyomi.data.track.mangaupdates.dto.toTrackSearch
|
||||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.domain.track.model.Track as DomainTrack
|
import tachiyomi.domain.track.model.Track as DomainTrack
|
||||||
|
|
||||||
@@ -34,7 +32,6 @@ class MangaUpdates(id: Long) : BaseTracker(id, "MangaUpdates"), DeletableTracker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.toImmutableList()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val interceptor by lazy { MangaUpdatesInterceptor(this) }
|
private val interceptor by lazy { MangaUpdatesInterceptor(this) }
|
||||||
@@ -62,7 +59,7 @@ class MangaUpdates(id: Long) : BaseTracker(id, "MangaUpdates"), DeletableTracker
|
|||||||
|
|
||||||
override fun getCompletionStatus(): Long = COMPLETE_LIST
|
override fun getCompletionStatus(): Long = COMPLETE_LIST
|
||||||
|
|
||||||
override fun getScoreList(): ImmutableList<String> = SCORE_LIST
|
override fun getScoreList(): List<String> = SCORE_LIST
|
||||||
|
|
||||||
override fun indexToScore(index: Int): Double = if (index == 0) 0.0 else SCORE_LIST[index].toDouble()
|
override fun indexToScore(index: Int): Double = if (index == 0) 0.0 else SCORE_LIST[index].toDouble()
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import eu.kanade.tachiyomi.data.track.BaseTracker
|
|||||||
import eu.kanade.tachiyomi.data.track.DeletableTracker
|
import eu.kanade.tachiyomi.data.track.DeletableTracker
|
||||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||||
import eu.kanade.tachiyomi.data.track.myanimelist.dto.MALOAuth
|
import eu.kanade.tachiyomi.data.track.myanimelist.dto.MALOAuth
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
@@ -29,7 +27,6 @@ class MyAnimeList(id: Long) : BaseTracker(id, "MyAnimeList"), DeletableTracker {
|
|||||||
|
|
||||||
private val SCORE_LIST = IntRange(0, 10)
|
private val SCORE_LIST = IntRange(0, 10)
|
||||||
.map(Int::toString)
|
.map(Int::toString)
|
||||||
.toImmutableList()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val json: Json by injectLazy()
|
private val json: Json by injectLazy()
|
||||||
@@ -61,7 +58,7 @@ class MyAnimeList(id: Long) : BaseTracker(id, "MyAnimeList"), DeletableTracker {
|
|||||||
|
|
||||||
override fun getCompletionStatus(): Long = COMPLETED
|
override fun getCompletionStatus(): Long = COMPLETED
|
||||||
|
|
||||||
override fun getScoreList(): ImmutableList<String> = SCORE_LIST
|
override fun getScoreList(): List<String> = SCORE_LIST
|
||||||
|
|
||||||
override fun displayScore(track: DomainTrack): String {
|
override fun displayScore(track: DomainTrack): String {
|
||||||
return track.score.toInt().toString()
|
return track.score.toInt().toString()
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import eu.kanade.tachiyomi.data.track.BaseTracker
|
|||||||
import eu.kanade.tachiyomi.data.track.DeletableTracker
|
import eu.kanade.tachiyomi.data.track.DeletableTracker
|
||||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||||
import eu.kanade.tachiyomi.data.track.shikimori.dto.SMOAuth
|
import eu.kanade.tachiyomi.data.track.shikimori.dto.SMOAuth
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
@@ -26,7 +24,6 @@ class Shikimori(id: Long) : BaseTracker(id, "Shikimori"), DeletableTracker {
|
|||||||
|
|
||||||
private val SCORE_LIST = IntRange(0, 10)
|
private val SCORE_LIST = IntRange(0, 10)
|
||||||
.map(Int::toString)
|
.map(Int::toString)
|
||||||
.toImmutableList()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val json: Json by injectLazy()
|
private val json: Json by injectLazy()
|
||||||
@@ -35,7 +32,7 @@ class Shikimori(id: Long) : BaseTracker(id, "Shikimori"), DeletableTracker {
|
|||||||
|
|
||||||
private val api by lazy { ShikimoriApi(id, client, interceptor) }
|
private val api by lazy { ShikimoriApi(id, client, interceptor) }
|
||||||
|
|
||||||
override fun getScoreList(): ImmutableList<String> = SCORE_LIST
|
override fun getScoreList(): List<String> = SCORE_LIST
|
||||||
|
|
||||||
override fun displayScore(track: DomainTrack): String {
|
override fun displayScore(track: DomainTrack): String {
|
||||||
return track.score.toInt().toString()
|
return track.score.toInt().toString()
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import eu.kanade.tachiyomi.data.track.BaseTracker
|
|||||||
import eu.kanade.tachiyomi.data.track.EnhancedTracker
|
import eu.kanade.tachiyomi.data.track.EnhancedTracker
|
||||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||||
import eu.kanade.tachiyomi.source.Source
|
import eu.kanade.tachiyomi.source.Source
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.domain.manga.model.Manga as DomainManga
|
import tachiyomi.domain.manga.model.Manga as DomainManga
|
||||||
import tachiyomi.domain.track.model.Track as DomainTrack
|
import tachiyomi.domain.track.model.Track as DomainTrack
|
||||||
@@ -43,7 +41,7 @@ class Suwayomi(id: Long) : BaseTracker(id, "Suwayomi"), EnhancedTracker {
|
|||||||
|
|
||||||
override fun getCompletionStatus(): Long = COMPLETED
|
override fun getCompletionStatus(): Long = COMPLETED
|
||||||
|
|
||||||
override fun getScoreList(): ImmutableList<String> = persistentListOf()
|
override fun getScoreList(): List<String> = listOf()
|
||||||
|
|
||||||
override fun displayScore(track: DomainTrack): String = ""
|
override fun displayScore(track: DomainTrack): String = ""
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import eu.kanade.tachiyomi.ui.browse.migration.sources.migrateSourceTab
|
|||||||
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchScreen
|
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchScreen
|
||||||
import eu.kanade.tachiyomi.ui.browse.source.sourcesTab
|
import eu.kanade.tachiyomi.ui.browse.source.sourcesTab
|
||||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.coroutines.channels.BufferOverflow
|
import kotlinx.coroutines.channels.BufferOverflow
|
||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
@@ -62,7 +61,7 @@ data object BrowseTab : Tab {
|
|||||||
val extensionsScreenModel = rememberScreenModel { ExtensionsScreenModel() }
|
val extensionsScreenModel = rememberScreenModel { ExtensionsScreenModel() }
|
||||||
val extensionsState by extensionsScreenModel.state.collectAsState()
|
val extensionsState by extensionsScreenModel.state.collectAsState()
|
||||||
|
|
||||||
val tabs = persistentListOf(
|
val tabs = listOf(
|
||||||
sourcesTab(),
|
sourcesTab(),
|
||||||
extensionsTab(extensionsScreenModel),
|
extensionsTab(extensionsScreenModel),
|
||||||
migrateSourceTab(),
|
migrateSourceTab(),
|
||||||
|
|||||||
+4
-9
@@ -6,11 +6,6 @@ import cafe.adriel.voyager.core.model.screenModelScope
|
|||||||
import eu.kanade.domain.extension.interactor.GetExtensionLanguages
|
import eu.kanade.domain.extension.interactor.GetExtensionLanguages
|
||||||
import eu.kanade.domain.source.interactor.ToggleLanguage
|
import eu.kanade.domain.source.interactor.ToggleLanguage
|
||||||
import eu.kanade.domain.source.service.SourcePreferences
|
import eu.kanade.domain.source.service.SourcePreferences
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.ImmutableSet
|
|
||||||
import kotlinx.collections.immutable.persistentSetOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.collections.immutable.toImmutableSet
|
|
||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
@@ -46,8 +41,8 @@ class ExtensionFilterScreenModel(
|
|||||||
.collectLatest { (extensionLanguages, enabledLanguages) ->
|
.collectLatest { (extensionLanguages, enabledLanguages) ->
|
||||||
mutableState.update {
|
mutableState.update {
|
||||||
ExtensionFilterState.Success(
|
ExtensionFilterState.Success(
|
||||||
languages = extensionLanguages.toImmutableList(),
|
languages = extensionLanguages,
|
||||||
enabledLanguages = enabledLanguages.toImmutableSet(),
|
enabledLanguages = enabledLanguages,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,8 +65,8 @@ sealed interface ExtensionFilterState {
|
|||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
data class Success(
|
data class Success(
|
||||||
val languages: ImmutableList<String>,
|
val languages: List<String>,
|
||||||
val enabledLanguages: ImmutableSet<String> = persistentSetOf(),
|
val enabledLanguages: Set<String> = setOf(),
|
||||||
) : ExtensionFilterState {
|
) : ExtensionFilterState {
|
||||||
|
|
||||||
val isEmpty: Boolean
|
val isEmpty: Boolean
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import eu.kanade.tachiyomi.extension.model.Extension
|
|||||||
import eu.kanade.tachiyomi.ui.browse.extension.details.ExtensionDetailsScreen
|
import eu.kanade.tachiyomi.ui.browse.extension.details.ExtensionDetailsScreen
|
||||||
import eu.kanade.tachiyomi.ui.webview.WebViewScreen
|
import eu.kanade.tachiyomi.ui.webview.WebViewScreen
|
||||||
import eu.kanade.tachiyomi.util.system.isPackageInstalled
|
import eu.kanade.tachiyomi.util.system.isPackageInstalled
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
|
|
||||||
@@ -39,7 +38,7 @@ fun extensionsTab(
|
|||||||
titleRes = MR.strings.label_extensions,
|
titleRes = MR.strings.label_extensions,
|
||||||
badgeNumber = state.updates.takeIf { it > 0 },
|
badgeNumber = state.updates.takeIf { it > 0 },
|
||||||
searchEnabled = true,
|
searchEnabled = true,
|
||||||
actions = persistentListOf(
|
actions = listOf(
|
||||||
AppBar.OverflowAction(
|
AppBar.OverflowAction(
|
||||||
title = stringResource(MR.strings.action_filter),
|
title = stringResource(MR.strings.action_filter),
|
||||||
onClick = { navigator.push(ExtensionFilterScreen()) },
|
onClick = { navigator.push(ExtensionFilterScreen()) },
|
||||||
|
|||||||
+5
-8
@@ -14,9 +14,6 @@ import eu.kanade.tachiyomi.extension.model.Extension
|
|||||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
@@ -78,10 +75,10 @@ class ExtensionDetailsScreenModel(
|
|||||||
}
|
}
|
||||||
.catch { throwable ->
|
.catch { throwable ->
|
||||||
logcat(LogPriority.ERROR, throwable)
|
logcat(LogPriority.ERROR, throwable)
|
||||||
mutableState.update { it.copy(_sources = persistentListOf()) }
|
mutableState.update { it.copy(_sources = listOf()) }
|
||||||
}
|
}
|
||||||
.collectLatest { sources ->
|
.collectLatest { sources ->
|
||||||
mutableState.update { it.copy(_sources = sources.toImmutableList()) }
|
mutableState.update { it.copy(_sources = sources) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -142,11 +139,11 @@ class ExtensionDetailsScreenModel(
|
|||||||
data class State(
|
data class State(
|
||||||
val extension: Extension.Installed? = null,
|
val extension: Extension.Installed? = null,
|
||||||
val isIncognito: Boolean = false,
|
val isIncognito: Boolean = false,
|
||||||
private val _sources: ImmutableList<ExtensionSourceItem>? = null,
|
private val _sources: List<ExtensionSourceItem>? = null,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val sources: ImmutableList<ExtensionSourceItem>
|
val sources: List<ExtensionSourceItem>
|
||||||
get() = _sources ?: persistentListOf()
|
get() = _sources ?: listOf()
|
||||||
|
|
||||||
val isLoading: Boolean
|
val isLoading: Boolean
|
||||||
get() = extension == null || _sources == null
|
get() = extension == null || _sources == null
|
||||||
|
|||||||
+4
-8
@@ -4,9 +4,6 @@ import androidx.compose.runtime.Immutable
|
|||||||
import cafe.adriel.voyager.core.model.StateScreenModel
|
import cafe.adriel.voyager.core.model.StateScreenModel
|
||||||
import cafe.adriel.voyager.core.model.screenModelScope
|
import cafe.adriel.voyager.core.model.screenModelScope
|
||||||
import eu.kanade.tachiyomi.source.Source
|
import eu.kanade.tachiyomi.source.Source
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
@@ -44,13 +41,12 @@ class MigrateMangaScreenModel(
|
|||||||
logcat(LogPriority.ERROR, it)
|
logcat(LogPriority.ERROR, it)
|
||||||
_events.send(MigrationMangaEvent.FailedFetchingFavorites)
|
_events.send(MigrationMangaEvent.FailedFetchingFavorites)
|
||||||
mutableState.update { state ->
|
mutableState.update { state ->
|
||||||
state.copy(titleList = persistentListOf())
|
state.copy(titleList = listOf())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.map { manga ->
|
.map { manga ->
|
||||||
manga
|
manga
|
||||||
.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.title })
|
.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.title })
|
||||||
.toImmutableList()
|
|
||||||
}
|
}
|
||||||
.collectLatest { list ->
|
.collectLatest { list ->
|
||||||
mutableState.update { it.copy(titleList = list) }
|
mutableState.update { it.copy(titleList = list) }
|
||||||
@@ -75,11 +71,11 @@ class MigrateMangaScreenModel(
|
|||||||
data class State(
|
data class State(
|
||||||
val source: Source? = null,
|
val source: Source? = null,
|
||||||
val selection: Set<Long> = emptySet(),
|
val selection: Set<Long> = emptySet(),
|
||||||
private val titleList: ImmutableList<Manga>? = null,
|
private val titleList: List<Manga>? = null,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val titles: ImmutableList<Manga>
|
val titles: List<Manga>
|
||||||
get() = titleList ?: persistentListOf()
|
get() = titleList ?: listOf()
|
||||||
|
|
||||||
val isLoading: Boolean
|
val isLoading: Boolean
|
||||||
get() = source == null || titleList == null
|
get() = source == null || titleList == null
|
||||||
|
|||||||
+2
-5
@@ -6,9 +6,6 @@ import cafe.adriel.voyager.core.model.screenModelScope
|
|||||||
import eu.kanade.domain.source.interactor.GetSourcesWithFavoriteCount
|
import eu.kanade.domain.source.interactor.GetSourcesWithFavoriteCount
|
||||||
import eu.kanade.domain.source.interactor.SetMigrateSorting
|
import eu.kanade.domain.source.interactor.SetMigrateSorting
|
||||||
import eu.kanade.domain.source.service.SourcePreferences
|
import eu.kanade.domain.source.service.SourcePreferences
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
@@ -43,7 +40,7 @@ class MigrateSourceScreenModel(
|
|||||||
mutableState.update {
|
mutableState.update {
|
||||||
it.copy(
|
it.copy(
|
||||||
isLoading = false,
|
isLoading = false,
|
||||||
items = sources.toImmutableList(),
|
items = sources,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,7 +80,7 @@ class MigrateSourceScreenModel(
|
|||||||
@Immutable
|
@Immutable
|
||||||
data class State(
|
data class State(
|
||||||
val isLoading: Boolean = true,
|
val isLoading: Boolean = true,
|
||||||
val items: ImmutableList<Pair<Source, Long>> = persistentListOf(),
|
val items: List<Pair<Source, Long>> = listOf(),
|
||||||
val sortingMode: SetMigrateSorting.Mode = SetMigrateSorting.Mode.ALPHABETICAL,
|
val sortingMode: SetMigrateSorting.Mode = SetMigrateSorting.Mode.ALPHABETICAL,
|
||||||
val sortingDirection: SetMigrateSorting.Direction = SetMigrateSorting.Direction.ASCENDING,
|
val sortingDirection: SetMigrateSorting.Direction = SetMigrateSorting.Direction.ASCENDING,
|
||||||
) {
|
) {
|
||||||
|
|||||||
+1
-2
@@ -14,7 +14,6 @@ import eu.kanade.presentation.browse.MigrateSourceScreen
|
|||||||
import eu.kanade.presentation.components.AppBar
|
import eu.kanade.presentation.components.AppBar
|
||||||
import eu.kanade.presentation.components.TabContent
|
import eu.kanade.presentation.components.TabContent
|
||||||
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaScreen
|
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaScreen
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
|
|
||||||
@@ -27,7 +26,7 @@ fun Screen.migrateSourceTab(): TabContent {
|
|||||||
|
|
||||||
return TabContent(
|
return TabContent(
|
||||||
titleRes = MR.strings.label_migration,
|
titleRes = MR.strings.label_migration,
|
||||||
actions = persistentListOf(
|
actions = listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.migration_help_guide),
|
title = stringResource(MR.strings.migration_help_guide),
|
||||||
icon = Icons.AutoMirrored.Outlined.HelpOutline,
|
icon = Icons.AutoMirrored.Outlined.HelpOutline,
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ import eu.kanade.domain.source.interactor.GetEnabledSources
|
|||||||
import eu.kanade.domain.source.interactor.ToggleSource
|
import eu.kanade.domain.source.interactor.ToggleSource
|
||||||
import eu.kanade.domain.source.interactor.ToggleSourcePin
|
import eu.kanade.domain.source.interactor.ToggleSourcePin
|
||||||
import eu.kanade.presentation.browse.SourceUiModel
|
import eu.kanade.presentation.browse.SourceUiModel
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
@@ -76,8 +73,7 @@ class SourcesScreenModel(
|
|||||||
SourceUiModel.Item(source)
|
SourceUiModel.Item(source)
|
||||||
}.toTypedArray(),
|
}.toTypedArray(),
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
.toImmutableList(),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,7 +104,7 @@ class SourcesScreenModel(
|
|||||||
data class State(
|
data class State(
|
||||||
val dialog: Dialog? = null,
|
val dialog: Dialog? = null,
|
||||||
val isLoading: Boolean = true,
|
val isLoading: Boolean = true,
|
||||||
val items: ImmutableList<SourceUiModel> = persistentListOf(),
|
val items: List<SourceUiModel> = listOf(),
|
||||||
) {
|
) {
|
||||||
val isEmpty = items.isEmpty()
|
val isEmpty = items.isEmpty()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import eu.kanade.presentation.components.AppBar
|
|||||||
import eu.kanade.presentation.components.TabContent
|
import eu.kanade.presentation.components.TabContent
|
||||||
import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceScreen
|
import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceScreen
|
||||||
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchScreen
|
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchScreen
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
@@ -31,7 +30,7 @@ fun Screen.sourcesTab(): TabContent {
|
|||||||
|
|
||||||
return TabContent(
|
return TabContent(
|
||||||
titleRes = MR.strings.label_sources,
|
titleRes = MR.strings.label_sources,
|
||||||
actions = persistentListOf(
|
actions = listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.action_global_search),
|
title = stringResource(MR.strings.action_global_search),
|
||||||
icon = Icons.Outlined.TravelExplore,
|
icon = Icons.Outlined.TravelExplore,
|
||||||
|
|||||||
+2
-4
@@ -23,8 +23,6 @@ import eu.kanade.tachiyomi.data.cache.CoverCache
|
|||||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
import eu.kanade.tachiyomi.util.removeCovers
|
import eu.kanade.tachiyomi.util.removeCovers
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.coroutines.flow.SharingStarted
|
import kotlinx.coroutines.flow.SharingStarted
|
||||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||||
import kotlinx.coroutines.flow.emptyFlow
|
import kotlinx.coroutines.flow.emptyFlow
|
||||||
@@ -265,7 +263,7 @@ class BrowseSourceScreenModel(
|
|||||||
setDialog(
|
setDialog(
|
||||||
Dialog.ChangeMangaCategory(
|
Dialog.ChangeMangaCategory(
|
||||||
manga,
|
manga,
|
||||||
categories.mapAsCheckboxState { it.id in preselectedIds }.toImmutableList(),
|
categories.mapAsCheckboxState { it.id in preselectedIds },
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -339,7 +337,7 @@ class BrowseSourceScreenModel(
|
|||||||
data class AddDuplicateManga(val manga: Manga, val duplicates: List<MangaWithChapterCount>) : Dialog
|
data class AddDuplicateManga(val manga: Manga, val duplicates: List<MangaWithChapterCount>) : Dialog
|
||||||
data class ChangeMangaCategory(
|
data class ChangeMangaCategory(
|
||||||
val manga: Manga,
|
val manga: Manga,
|
||||||
val initialSelection: ImmutableList<CheckboxState.State<Category>>,
|
val initialSelection: List<CheckboxState.State<Category>>,
|
||||||
) : Dialog
|
) : Dialog
|
||||||
data class Migrate(val target: Manga, val current: Manga) : Dialog
|
data class Migrate(val target: Manga, val current: Manga) : Dialog
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-16
@@ -9,10 +9,6 @@ import eu.kanade.domain.source.service.SourcePreferences
|
|||||||
import eu.kanade.presentation.util.ioCoroutineScope
|
import eu.kanade.presentation.util.ioCoroutineScope
|
||||||
import eu.kanade.tachiyomi.extension.ExtensionManager
|
import eu.kanade.tachiyomi.extension.ExtensionManager
|
||||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||||
import kotlinx.collections.immutable.PersistentMap
|
|
||||||
import kotlinx.collections.immutable.mutate
|
|
||||||
import kotlinx.collections.immutable.persistentMapOf
|
|
||||||
import kotlinx.collections.immutable.toPersistentMap
|
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.asCoroutineDispatcher
|
import kotlinx.coroutines.asCoroutineDispatcher
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
@@ -143,14 +139,12 @@ abstract class SearchScreenModel(
|
|||||||
val existingResults = state.value.items
|
val existingResults = state.value.items
|
||||||
updateItems(
|
updateItems(
|
||||||
sources
|
sources
|
||||||
.associateWith { existingResults[it] ?: SearchItemResult.Loading }
|
.associateWith { existingResults[it] ?: SearchItemResult.Loading },
|
||||||
.toPersistentMap(),
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
updateItems(
|
updateItems(
|
||||||
sources
|
sources
|
||||||
.associateWith { SearchItemResult.Loading }
|
.associateWith { SearchItemResult.Loading },
|
||||||
.toPersistentMap(),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,21 +179,17 @@ abstract class SearchScreenModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateItems(items: PersistentMap<CatalogueSource, SearchItemResult>) {
|
private fun updateItems(items: Map<CatalogueSource, SearchItemResult>) {
|
||||||
mutableState.update {
|
mutableState.update {
|
||||||
it.copy(
|
it.copy(
|
||||||
items = items
|
items = items
|
||||||
.toSortedMap(sortComparator(items))
|
.toSortedMap(sortComparator(items)),
|
||||||
.toPersistentMap(),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateItem(source: CatalogueSource, result: SearchItemResult) {
|
private fun updateItem(source: CatalogueSource, result: SearchItemResult) {
|
||||||
val newItems = state.value.items.mutate {
|
updateItems(state.value.items + (source to result))
|
||||||
it[source] = result
|
|
||||||
}
|
|
||||||
updateItems(newItems)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setMigrateDialog(currentId: Long, target: Manga) {
|
fun setMigrateDialog(currentId: Long, target: Manga) {
|
||||||
@@ -219,7 +209,7 @@ abstract class SearchScreenModel(
|
|||||||
val searchQuery: String? = null,
|
val searchQuery: String? = null,
|
||||||
val sourceFilter: SourceFilter = SourceFilter.PinnedOnly,
|
val sourceFilter: SourceFilter = SourceFilter.PinnedOnly,
|
||||||
val onlyShowHasResults: Boolean = false,
|
val onlyShowHasResults: Boolean = false,
|
||||||
val items: PersistentMap<CatalogueSource, SearchItemResult> = persistentMapOf(),
|
val items: Map<CatalogueSource, SearchItemResult> = mapOf(),
|
||||||
val dialog: Dialog? = null,
|
val dialog: Dialog? = null,
|
||||||
) {
|
) {
|
||||||
val progress: Int = items.count { it.value !is SearchItemResult.Loading }
|
val progress: Int = items.count { it.value !is SearchItemResult.Loading }
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import eu.kanade.presentation.category.components.CategoryDeleteDialog
|
|||||||
import eu.kanade.presentation.category.components.CategoryRenameDialog
|
import eu.kanade.presentation.category.components.CategoryRenameDialog
|
||||||
import eu.kanade.presentation.util.Screen
|
import eu.kanade.presentation.util.Screen
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import tachiyomi.presentation.core.screens.LoadingScreen
|
import tachiyomi.presentation.core.screens.LoadingScreen
|
||||||
|
|
||||||
@@ -51,14 +50,14 @@ class CategoryScreen : Screen() {
|
|||||||
CategoryCreateDialog(
|
CategoryCreateDialog(
|
||||||
onDismissRequest = screenModel::dismissDialog,
|
onDismissRequest = screenModel::dismissDialog,
|
||||||
onCreate = screenModel::createCategory,
|
onCreate = screenModel::createCategory,
|
||||||
categories = successState.categories.fastMap { it.name }.toImmutableList(),
|
categories = successState.categories.fastMap { it.name },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
is CategoryDialog.Rename -> {
|
is CategoryDialog.Rename -> {
|
||||||
CategoryRenameDialog(
|
CategoryRenameDialog(
|
||||||
onDismissRequest = screenModel::dismissDialog,
|
onDismissRequest = screenModel::dismissDialog,
|
||||||
onRename = { screenModel.renameCategory(dialog.category, it) },
|
onRename = { screenModel.renameCategory(dialog.category, it) },
|
||||||
categories = successState.categories.fastMap { it.name }.toImmutableList(),
|
categories = successState.categories.fastMap { it.name },
|
||||||
category = dialog.category.name,
|
category = dialog.category.name,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import androidx.compose.runtime.Immutable
|
|||||||
import cafe.adriel.voyager.core.model.StateScreenModel
|
import cafe.adriel.voyager.core.model.StateScreenModel
|
||||||
import cafe.adriel.voyager.core.model.screenModelScope
|
import cafe.adriel.voyager.core.model.screenModelScope
|
||||||
import dev.icerock.moko.resources.StringResource
|
import dev.icerock.moko.resources.StringResource
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.flow.receiveAsFlow
|
import kotlinx.coroutines.flow.receiveAsFlow
|
||||||
@@ -39,8 +37,7 @@ class CategoryScreenModel(
|
|||||||
mutableState.update {
|
mutableState.update {
|
||||||
CategoryScreenState.Success(
|
CategoryScreenState.Success(
|
||||||
categories = categories
|
categories = categories
|
||||||
.filterNot(Category::isSystemCategory)
|
.filterNot(Category::isSystemCategory),
|
||||||
.toImmutableList(),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,7 +117,7 @@ sealed interface CategoryScreenState {
|
|||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
data class Success(
|
data class Success(
|
||||||
val categories: ImmutableList<Category>,
|
val categories: List<Category>,
|
||||||
val dialog: CategoryDialog? = null,
|
val dialog: CategoryDialog? = null,
|
||||||
) : CategoryScreenState {
|
) : CategoryScreenState {
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ import eu.kanade.presentation.components.DropdownMenu
|
|||||||
import eu.kanade.presentation.components.NestedMenuItem
|
import eu.kanade.presentation.components.NestedMenuItem
|
||||||
import eu.kanade.presentation.util.Screen
|
import eu.kanade.presentation.util.Screen
|
||||||
import eu.kanade.tachiyomi.databinding.DownloadListBinding
|
import eu.kanade.tachiyomi.databinding.DownloadListBinding
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import tachiyomi.core.common.util.lang.launchUI
|
import tachiyomi.core.common.util.lang.launchUI
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.components.Pill
|
import tachiyomi.presentation.core.components.Pill
|
||||||
@@ -181,7 +180,7 @@ object DownloadQueueScreen : Screen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
persistentListOf(
|
listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.action_sort),
|
title = stringResource(MR.strings.action_sort),
|
||||||
icon = Icons.AutoMirrored.Outlined.Sort,
|
icon = Icons.AutoMirrored.Outlined.Sort,
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import eu.kanade.domain.manga.interactor.UpdateManga
|
|||||||
import eu.kanade.domain.track.interactor.AddTracks
|
import eu.kanade.domain.track.interactor.AddTracks
|
||||||
import eu.kanade.presentation.history.HistoryUiModel
|
import eu.kanade.presentation.history.HistoryUiModel
|
||||||
import eu.kanade.tachiyomi.util.lang.toLocalDate
|
import eu.kanade.tachiyomi.util.lang.toLocalDate
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
@@ -230,7 +228,7 @@ class HistoryScreenModel(
|
|||||||
currentState.copy(
|
currentState.copy(
|
||||||
dialog = Dialog.ChangeCategory(
|
dialog = Dialog.ChangeCategory(
|
||||||
manga = manga,
|
manga = manga,
|
||||||
initialSelection = categories.mapAsCheckboxState { it.id in selection }.toImmutableList(),
|
initialSelection = categories.mapAsCheckboxState { it.id in selection },
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -250,7 +248,7 @@ class HistoryScreenModel(
|
|||||||
data class DuplicateManga(val manga: Manga, val duplicates: List<MangaWithChapterCount>) : Dialog
|
data class DuplicateManga(val manga: Manga, val duplicates: List<MangaWithChapterCount>) : Dialog
|
||||||
data class ChangeCategory(
|
data class ChangeCategory(
|
||||||
val manga: Manga,
|
val manga: Manga,
|
||||||
val initialSelection: ImmutableList<CheckboxState<Category>>,
|
val initialSelection: List<CheckboxState<Category>>,
|
||||||
) : Dialog
|
) : Dialog
|
||||||
data class Migrate(val target: Manga, val current: Manga) : Dialog
|
data class Migrate(val target: Manga, val current: Manga) : Dialog
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ import eu.kanade.tachiyomi.source.model.SManga
|
|||||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||||
import eu.kanade.tachiyomi.util.chapter.getNextUnread
|
import eu.kanade.tachiyomi.util.chapter.getNextUnread
|
||||||
import eu.kanade.tachiyomi.util.removeCovers
|
import eu.kanade.tachiyomi.util.removeCovers
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.flow.combine
|
import kotlinx.coroutines.flow.combine
|
||||||
@@ -709,7 +707,7 @@ class LibraryScreenModel(
|
|||||||
else -> CheckboxState.State.None(it)
|
else -> CheckboxState.State.None(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.toImmutableList()
|
|
||||||
mutableState.update { it.copy(dialog = Dialog.ChangeCategory(mangaList, preselected)) }
|
mutableState.update { it.copy(dialog = Dialog.ChangeCategory(mangaList, preselected)) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -726,7 +724,7 @@ class LibraryScreenModel(
|
|||||||
data object SettingsSheet : Dialog
|
data object SettingsSheet : Dialog
|
||||||
data class ChangeCategory(
|
data class ChangeCategory(
|
||||||
val manga: List<Manga>,
|
val manga: List<Manga>,
|
||||||
val initialSelection: ImmutableList<CheckboxState<Category>>,
|
val initialSelection: List<CheckboxState<Category>>,
|
||||||
) : Dialog
|
) : Dialog
|
||||||
data class DeleteManga(val manga: List<Manga>) : Dialog
|
data class DeleteManga(val manga: List<Manga>) : Dialog
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ import eu.kanade.tachiyomi.ui.home.HomeScreen
|
|||||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||||
import eu.kanade.tachiyomi.ui.manga.MangaScreen
|
import eu.kanade.tachiyomi.ui.manga.MangaScreen
|
||||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.flow.receiveAsFlow
|
import kotlinx.coroutines.flow.receiveAsFlow
|
||||||
@@ -168,7 +167,7 @@ data object LibraryTab : Tab {
|
|||||||
EmptyScreen(
|
EmptyScreen(
|
||||||
stringRes = MR.strings.information_empty_library,
|
stringRes = MR.strings.information_empty_library,
|
||||||
modifier = Modifier.padding(contentPadding),
|
modifier = Modifier.padding(contentPadding),
|
||||||
actions = persistentListOf(
|
actions = listOf(
|
||||||
EmptyScreenAction(
|
EmptyScreenAction(
|
||||||
stringRes = MR.strings.getting_started_guide,
|
stringRes = MR.strings.getting_started_guide,
|
||||||
icon = Icons.AutoMirrored.Outlined.HelpOutline,
|
icon = Icons.AutoMirrored.Outlined.HelpOutline,
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
|||||||
import eu.kanade.tachiyomi.util.chapter.getNextUnread
|
import eu.kanade.tachiyomi.util.chapter.getNextUnread
|
||||||
import eu.kanade.tachiyomi.util.removeCovers
|
import eu.kanade.tachiyomi.util.removeCovers
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
import kotlinx.coroutines.awaitAll
|
import kotlinx.coroutines.awaitAll
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
@@ -374,7 +372,7 @@ class MangaScreenModel(
|
|||||||
successState.copy(
|
successState.copy(
|
||||||
dialog = Dialog.ChangeCategory(
|
dialog = Dialog.ChangeCategory(
|
||||||
manga = manga,
|
manga = manga,
|
||||||
initialSelection = categories.mapAsCheckboxState { it.id in selection }.toImmutableList(),
|
initialSelection = categories.mapAsCheckboxState { it.id in selection },
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1081,7 +1079,7 @@ class MangaScreenModel(
|
|||||||
sealed interface Dialog {
|
sealed interface Dialog {
|
||||||
data class ChangeCategory(
|
data class ChangeCategory(
|
||||||
val manga: Manga,
|
val manga: Manga,
|
||||||
val initialSelection: ImmutableList<CheckboxState<Category>>,
|
val initialSelection: List<CheckboxState<Category>>,
|
||||||
) : Dialog
|
) : Dialog
|
||||||
data class DeleteChapters(val chapters: List<Chapter>) : Dialog
|
data class DeleteChapters(val chapters: List<Chapter>) : Dialog
|
||||||
data class DuplicateManga(val manga: Manga, val duplicates: List<MangaWithChapterCount>) : Dialog
|
data class DuplicateManga(val manga: Manga, val duplicates: List<MangaWithChapterCount>) : Dialog
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ import eu.kanade.tachiyomi.util.lang.toLocalDate
|
|||||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||||
import eu.kanade.tachiyomi.util.system.openInBrowser
|
import eu.kanade.tachiyomi.util.system.openInBrowser
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||||
@@ -416,7 +415,7 @@ private data class TrackScoreSelectorScreen(
|
|||||||
private val tracker: Tracker,
|
private val tracker: Tracker,
|
||||||
) : StateScreenModel<Model.State>(State(tracker.displayScore(track))) {
|
) : StateScreenModel<Model.State>(State(tracker.displayScore(track))) {
|
||||||
|
|
||||||
fun getSelections(): ImmutableList<String> {
|
fun getSelections(): List<String> {
|
||||||
return tracker.getScoreList()
|
return tracker.getScoreList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,6 @@ import eu.kanade.tachiyomi.data.download.DownloadManager
|
|||||||
import eu.kanade.tachiyomi.data.download.model.Download
|
import eu.kanade.tachiyomi.data.download.model.Download
|
||||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
||||||
import eu.kanade.tachiyomi.util.lang.toLocalDate
|
import eu.kanade.tachiyomi.util.lang.toLocalDate
|
||||||
import kotlinx.collections.immutable.PersistentList
|
|
||||||
import kotlinx.collections.immutable.mutate
|
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.toPersistentList
|
|
||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
@@ -106,7 +102,6 @@ class UpdatesScreenModel(
|
|||||||
updates
|
updates
|
||||||
.toUpdateItems()
|
.toUpdateItems()
|
||||||
.applyFilters(itemPreferences)
|
.applyFilters(itemPreferences)
|
||||||
.toPersistentList()
|
|
||||||
}
|
}
|
||||||
.collectLatest { updateItems ->
|
.collectLatest { updateItems ->
|
||||||
mutableState.update {
|
mutableState.update {
|
||||||
@@ -199,9 +194,9 @@ class UpdatesScreenModel(
|
|||||||
*/
|
*/
|
||||||
private fun updateDownloadState(download: Download) {
|
private fun updateDownloadState(download: Download) {
|
||||||
mutableState.update { state ->
|
mutableState.update { state ->
|
||||||
val newItems = state.items.mutate { list ->
|
val newItems = state.items.toMutableList().also { list ->
|
||||||
val modifiedIndex = list.indexOfFirst { it.update.chapterId == download.chapter.id }
|
val modifiedIndex = list.indexOfFirst { it.update.chapterId == download.chapter.id }
|
||||||
if (modifiedIndex < 0) return@mutate
|
if (modifiedIndex < 0) return@also
|
||||||
|
|
||||||
val item = list[modifiedIndex]
|
val item = list[modifiedIndex]
|
||||||
list[modifiedIndex] = item.copy(
|
list[modifiedIndex] = item.copy(
|
||||||
@@ -381,7 +376,7 @@ class UpdatesScreenModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state.copy(items = newItems.toPersistentList())
|
state.copy(items = newItems)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,7 +386,7 @@ class UpdatesScreenModel(
|
|||||||
selectedChapterIds.addOrRemove(it.update.chapterId, selected)
|
selectedChapterIds.addOrRemove(it.update.chapterId, selected)
|
||||||
it.copy(selected = selected)
|
it.copy(selected = selected)
|
||||||
}
|
}
|
||||||
state.copy(items = newItems.toPersistentList())
|
state.copy(items = newItems)
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedPositions[0] = -1
|
selectedPositions[0] = -1
|
||||||
@@ -404,7 +399,7 @@ class UpdatesScreenModel(
|
|||||||
selectedChapterIds.addOrRemove(it.update.chapterId, !it.selected)
|
selectedChapterIds.addOrRemove(it.update.chapterId, !it.selected)
|
||||||
it.copy(selected = !it.selected)
|
it.copy(selected = !it.selected)
|
||||||
}
|
}
|
||||||
state.copy(items = newItems.toPersistentList())
|
state.copy(items = newItems)
|
||||||
}
|
}
|
||||||
selectedPositions[0] = -1
|
selectedPositions[0] = -1
|
||||||
selectedPositions[1] = -1
|
selectedPositions[1] = -1
|
||||||
@@ -453,7 +448,7 @@ class UpdatesScreenModel(
|
|||||||
data class State(
|
data class State(
|
||||||
val isLoading: Boolean = true,
|
val isLoading: Boolean = true,
|
||||||
val hasActiveFilters: Boolean = false,
|
val hasActiveFilters: Boolean = false,
|
||||||
val items: PersistentList<UpdatesItem> = persistentListOf(),
|
val items: List<UpdatesItem> = listOf(),
|
||||||
val dialog: Dialog? = null,
|
val dialog: Dialog? = null,
|
||||||
) {
|
) {
|
||||||
val selected = items.filter { it.selected }
|
val selected = items.filter { it.selected }
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import dev.icerock.moko.resources.StringResource
|
|||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.track.Tracker
|
import eu.kanade.tachiyomi.data.track.Tracker
|
||||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.flowOf
|
import kotlinx.coroutines.flow.flowOf
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
@@ -24,7 +22,7 @@ data class DummyTracker(
|
|||||||
val valReadingStatus: Long = 1L,
|
val valReadingStatus: Long = 1L,
|
||||||
val valRereadingStatus: Long = 1L,
|
val valRereadingStatus: Long = 1L,
|
||||||
val valCompletionStatus: Long = 2L,
|
val valCompletionStatus: Long = 2L,
|
||||||
val valScoreList: ImmutableList<String> = (0..10).map(Int::toString).toImmutableList(),
|
val valScoreList: List<String> = (0..10).map(Int::toString),
|
||||||
val val10PointScore: Double = 5.4,
|
val val10PointScore: Double = 5.4,
|
||||||
val valSearchResults: List<TrackSearch> = listOf(),
|
val valSearchResults: List<TrackSearch> = listOf(),
|
||||||
) : Tracker {
|
) : Tracker {
|
||||||
@@ -52,7 +50,7 @@ data class DummyTracker(
|
|||||||
|
|
||||||
override fun getCompletionStatus(): Long = valCompletionStatus
|
override fun getCompletionStatus(): Long = valCompletionStatus
|
||||||
|
|
||||||
override fun getScoreList(): ImmutableList<String> = valScoreList
|
override fun getScoreList(): List<String> = valScoreList
|
||||||
|
|
||||||
override fun get10PointScore(track: Track): Double = val10PointScore
|
override fun get10PointScore(track: Track): Double = val10PointScore
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ import eu.kanade.presentation.util.Screen
|
|||||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||||
import eu.kanade.tachiyomi.ui.browse.migration.search.MigrateSearchScreen
|
import eu.kanade.tachiyomi.ui.browse.migration.search.MigrateSearchScreen
|
||||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.coroutines.flow.update
|
import kotlinx.coroutines.flow.update
|
||||||
import mihon.feature.migration.list.MigrationListScreen
|
import mihon.feature.migration.list.MigrationListScreen
|
||||||
import sh.calvin.reorderable.ReorderableCollectionItemScope
|
import sh.calvin.reorderable.ReorderableCollectionItemScope
|
||||||
@@ -118,7 +117,7 @@ class MigrationConfigScreen(private val mangaIds: Collection<Long>) : Screen() {
|
|||||||
scrollBehavior = it,
|
scrollBehavior = it,
|
||||||
actions = {
|
actions = {
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
persistentListOf(
|
listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.migrationConfigScreen_selectAllLabel),
|
title = stringResource(MR.strings.migrationConfigScreen_selectAllLabel),
|
||||||
icon = Icons.Outlined.SelectAll,
|
icon = Icons.Outlined.SelectAll,
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ import eu.kanade.presentation.util.animateItemFastScroll
|
|||||||
import eu.kanade.presentation.util.formatChapterNumber
|
import eu.kanade.presentation.util.formatChapterNumber
|
||||||
import eu.kanade.presentation.util.rememberResourceBitmapPainter
|
import eu.kanade.presentation.util.rememberResourceBitmapPainter
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import mihon.feature.migration.list.models.MigratingManga
|
import mihon.feature.migration.list.models.MigratingManga
|
||||||
import tachiyomi.domain.manga.model.Manga
|
import tachiyomi.domain.manga.model.Manga
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
@@ -71,7 +69,7 @@ import tachiyomi.presentation.core.util.plus
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MigrationListScreenContent(
|
fun MigrationListScreenContent(
|
||||||
items: ImmutableList<MigratingManga>,
|
items: List<MigratingManga>,
|
||||||
migrationComplete: Boolean,
|
migrationComplete: Boolean,
|
||||||
finishedCount: Int,
|
finishedCount: Int,
|
||||||
onItemClick: (Manga) -> Unit,
|
onItemClick: (Manga) -> Unit,
|
||||||
@@ -91,7 +89,7 @@ fun MigrationListScreenContent(
|
|||||||
},
|
},
|
||||||
actions = {
|
actions = {
|
||||||
AppBarActions(
|
AppBarActions(
|
||||||
persistentListOf(
|
listOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.migrationListScreen_copyActionLabel),
|
title = stringResource(MR.strings.migrationListScreen_copyActionLabel),
|
||||||
icon = if (items.size == 1) Icons.Outlined.ContentCopy else Icons.Outlined.CopyAll,
|
icon = if (items.size == 1) Icons.Outlined.ContentCopy else Icons.Outlined.CopyAll,
|
||||||
|
|||||||
@@ -9,10 +9,6 @@ import eu.kanade.domain.manga.model.toSManga
|
|||||||
import eu.kanade.domain.source.service.SourcePreferences
|
import eu.kanade.domain.source.service.SourcePreferences
|
||||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||||
import eu.kanade.tachiyomi.source.getNameForMangaInfo
|
import eu.kanade.tachiyomi.source.getNameForMangaInfo
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.collections.immutable.toPersistentList
|
|
||||||
import kotlinx.coroutines.CancellationException
|
import kotlinx.coroutines.CancellationException
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
@@ -86,7 +82,7 @@ class MigrationListScreenModel(
|
|||||||
}
|
}
|
||||||
.awaitAll()
|
.awaitAll()
|
||||||
.filterNotNull()
|
.filterNotNull()
|
||||||
mutableState.update { it.copy(items = manga.toImmutableList()) }
|
mutableState.update { it.copy(items = manga) }
|
||||||
runMigrations(manga)
|
runMigrations(manga)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -327,7 +323,7 @@ class MigrationListScreenModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun removeManga(item: MigratingManga) {
|
private fun removeManga(item: MigratingManga) {
|
||||||
mutableState.update { it.copy(items = items.toPersistentList().remove(item)) }
|
mutableState.update { it.copy(items = items.toMutableList().apply { remove(item) }) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDispose() {
|
override fun onDispose() {
|
||||||
@@ -371,7 +367,7 @@ class MigrationListScreenModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
data class State(
|
data class State(
|
||||||
val items: ImmutableList<MigratingManga> = persistentListOf(),
|
val items: List<MigratingManga> = listOf(),
|
||||||
val finishedCount: Int = 0,
|
val finishedCount: Int = 0,
|
||||||
val migrationComplete: Boolean = false,
|
val migrationComplete: Boolean = false,
|
||||||
val dialog: Dialog? = null,
|
val dialog: Dialog? = null,
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ import cafe.adriel.voyager.navigator.currentOrThrow
|
|||||||
import eu.kanade.presentation.components.AppBar
|
import eu.kanade.presentation.components.AppBar
|
||||||
import eu.kanade.presentation.components.relativeDateText
|
import eu.kanade.presentation.components.relativeDateText
|
||||||
import eu.kanade.presentation.util.isTabletUi
|
import eu.kanade.presentation.util.isTabletUi
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.ImmutableMap
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import mihon.feature.upcoming.components.UpcomingItem
|
import mihon.feature.upcoming.components.UpcomingItem
|
||||||
import mihon.feature.upcoming.components.calendar.Calendar
|
import mihon.feature.upcoming.components.calendar.Calendar
|
||||||
@@ -136,8 +134,8 @@ private fun DateHeading(
|
|||||||
@Composable
|
@Composable
|
||||||
private fun UpcomingScreenSmallImpl(
|
private fun UpcomingScreenSmallImpl(
|
||||||
listState: LazyListState,
|
listState: LazyListState,
|
||||||
items: ImmutableList<UpcomingUIModel>,
|
items: List<UpcomingUIModel>,
|
||||||
events: ImmutableMap<LocalDate, Int>,
|
events: Map<LocalDate, Int>,
|
||||||
paddingValues: PaddingValues,
|
paddingValues: PaddingValues,
|
||||||
selectedYearMonth: YearMonth,
|
selectedYearMonth: YearMonth,
|
||||||
setSelectedYearMonth: (YearMonth) -> Unit,
|
setSelectedYearMonth: (YearMonth) -> Unit,
|
||||||
@@ -187,8 +185,8 @@ private fun UpcomingScreenSmallImpl(
|
|||||||
@Composable
|
@Composable
|
||||||
private fun UpcomingScreenLargeImpl(
|
private fun UpcomingScreenLargeImpl(
|
||||||
listState: LazyListState,
|
listState: LazyListState,
|
||||||
items: ImmutableList<UpcomingUIModel>,
|
items: List<UpcomingUIModel>,
|
||||||
events: ImmutableMap<LocalDate, Int>,
|
events: Map<LocalDate, Int>,
|
||||||
paddingValues: PaddingValues,
|
paddingValues: PaddingValues,
|
||||||
selectedYearMonth: YearMonth,
|
selectedYearMonth: YearMonth,
|
||||||
setSelectedYearMonth: (YearMonth) -> Unit,
|
setSelectedYearMonth: (YearMonth) -> Unit,
|
||||||
|
|||||||
@@ -6,12 +6,6 @@ import cafe.adriel.voyager.core.model.StateScreenModel
|
|||||||
import cafe.adriel.voyager.core.model.screenModelScope
|
import cafe.adriel.voyager.core.model.screenModelScope
|
||||||
import eu.kanade.core.util.insertSeparatorsReversed
|
import eu.kanade.core.util.insertSeparatorsReversed
|
||||||
import eu.kanade.tachiyomi.util.lang.toLocalDate
|
import eu.kanade.tachiyomi.util.lang.toLocalDate
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.ImmutableMap
|
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
|
||||||
import kotlinx.collections.immutable.persistentMapOf
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.collections.immutable.toImmutableMap
|
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.flow.update
|
import kotlinx.coroutines.flow.update
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -41,7 +35,7 @@ class UpcomingScreenModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun List<Manga>.toUpcomingUIModels(): ImmutableList<UpcomingUIModel> {
|
private fun List<Manga>.toUpcomingUIModels(): List<UpcomingUIModel> {
|
||||||
var mangaCount = 0
|
var mangaCount = 0
|
||||||
return fastMap { UpcomingUIModel.Item(it) }
|
return fastMap { UpcomingUIModel.Item(it) }
|
||||||
.insertSeparatorsReversed { before, after ->
|
.insertSeparatorsReversed { before, after ->
|
||||||
@@ -56,16 +50,14 @@ class UpcomingScreenModel(
|
|||||||
null
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.toImmutableList()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun List<UpcomingUIModel>.toEvents(): ImmutableMap<LocalDate, Int> {
|
private fun List<UpcomingUIModel>.toEvents(): Map<LocalDate, Int> {
|
||||||
return filterIsInstance<UpcomingUIModel.Header>()
|
return filterIsInstance<UpcomingUIModel.Header>()
|
||||||
.associate { it.date to it.mangaCount }
|
.associate { it.date to it.mangaCount }
|
||||||
.toImmutableMap()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun List<UpcomingUIModel>.getHeaderIndexes(): ImmutableMap<LocalDate, Int> {
|
private fun List<UpcomingUIModel>.getHeaderIndexes(): Map<LocalDate, Int> {
|
||||||
return fastMapIndexedNotNull { index, upcomingUIModel ->
|
return fastMapIndexedNotNull { index, upcomingUIModel ->
|
||||||
if (upcomingUIModel is UpcomingUIModel.Header) {
|
if (upcomingUIModel is UpcomingUIModel.Header) {
|
||||||
upcomingUIModel.date to index
|
upcomingUIModel.date to index
|
||||||
@@ -74,7 +66,6 @@ class UpcomingScreenModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.toMap()
|
.toMap()
|
||||||
.toImmutableMap()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setSelectedYearMonth(yearMonth: YearMonth) {
|
fun setSelectedYearMonth(yearMonth: YearMonth) {
|
||||||
@@ -83,8 +74,8 @@ class UpcomingScreenModel(
|
|||||||
|
|
||||||
data class State(
|
data class State(
|
||||||
val selectedYearMonth: YearMonth = YearMonth.now(),
|
val selectedYearMonth: YearMonth = YearMonth.now(),
|
||||||
val items: ImmutableList<UpcomingUIModel> = persistentListOf(),
|
val items: List<UpcomingUIModel> = listOf(),
|
||||||
val events: ImmutableMap<LocalDate, Int> = persistentMapOf(),
|
val events: Map<LocalDate, Int> = mapOf(),
|
||||||
val headerIndexes: ImmutableMap<LocalDate, Int> = persistentMapOf(),
|
val headerIndexes: Map<LocalDate, Int> = mapOf(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ import androidx.compose.ui.unit.sp
|
|||||||
import androidx.compose.ui.util.fastForEach
|
import androidx.compose.ui.util.fastForEach
|
||||||
import io.woong.compose.grid.SimpleGridCells
|
import io.woong.compose.grid.SimpleGridCells
|
||||||
import io.woong.compose.grid.VerticalGrid
|
import io.woong.compose.grid.VerticalGrid
|
||||||
import kotlinx.collections.immutable.ImmutableMap
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import mihon.core.designsystem.utils.isExpandedWidthWindow
|
import mihon.core.designsystem.utils.isExpandedWidthWindow
|
||||||
import mihon.core.designsystem.utils.isMediumWidthWindow
|
import mihon.core.designsystem.utils.isMediumWidthWindow
|
||||||
import tachiyomi.presentation.core.components.material.padding
|
import tachiyomi.presentation.core.components.material.padding
|
||||||
@@ -37,7 +35,7 @@ private const val DAYS_OF_WEEK = 7
|
|||||||
@Composable
|
@Composable
|
||||||
fun Calendar(
|
fun Calendar(
|
||||||
selectedYearMonth: YearMonth,
|
selectedYearMonth: YearMonth,
|
||||||
events: ImmutableMap<LocalDate, Int>,
|
events: Map<LocalDate, Int>,
|
||||||
setSelectedYearMonth: (YearMonth) -> Unit,
|
setSelectedYearMonth: (YearMonth) -> Unit,
|
||||||
onClickDay: (day: LocalDate) -> Unit,
|
onClickDay: (day: LocalDate) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
@@ -67,14 +65,13 @@ fun Calendar(
|
|||||||
@Composable
|
@Composable
|
||||||
private fun CalendarGrid(
|
private fun CalendarGrid(
|
||||||
selectedYearMonth: YearMonth,
|
selectedYearMonth: YearMonth,
|
||||||
events: ImmutableMap<LocalDate, Int>,
|
events: Map<LocalDate, Int>,
|
||||||
onClickDay: (day: LocalDate) -> Unit,
|
onClickDay: (day: LocalDate) -> Unit,
|
||||||
) {
|
) {
|
||||||
val localeFirstDayOfWeek = WeekFields.of(Locale.getDefault()).firstDayOfWeek.value
|
val localeFirstDayOfWeek = WeekFields.of(Locale.getDefault()).firstDayOfWeek.value
|
||||||
val weekDays = remember {
|
val weekDays = remember {
|
||||||
(0 until DAYS_OF_WEEK)
|
(0 until DAYS_OF_WEEK)
|
||||||
.map { DayOfWeek.of((localeFirstDayOfWeek - 1 + it) % DAYS_OF_WEEK + 1) }
|
.map { DayOfWeek.of((localeFirstDayOfWeek - 1 + it) % DAYS_OF_WEEK + 1) }
|
||||||
.toImmutableList()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val emptyFieldCount = weekDays.indexOf(selectedYearMonth.atDay(1).dayOfWeek)
|
val emptyFieldCount = weekDays.indexOf(selectedYearMonth.atDay(1).dayOfWeek)
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ jsoup = "1.22.2"
|
|||||||
junit = "6.1.0"
|
junit = "6.1.0"
|
||||||
kotest-assertions = "6.1.11"
|
kotest-assertions = "6.1.11"
|
||||||
kotlin-gradle = "2.4.0"
|
kotlin-gradle = "2.4.0"
|
||||||
kotlinx-collections-immutable = "0.4.0"
|
|
||||||
kotlinx-coroutines = "1.11.0"
|
kotlinx-coroutines = "1.11.0"
|
||||||
kotlinx-serialization = "1.11.0"
|
kotlinx-serialization = "1.11.0"
|
||||||
ktlint = "1.8.0"
|
ktlint = "1.8.0"
|
||||||
@@ -136,7 +135,6 @@ kotest-assertions = { module = "io.kotest:kotest-assertions-core", version.ref =
|
|||||||
kotlin-compose-compiler-gradle = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlin-gradle" }
|
kotlin-compose-compiler-gradle = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlin-gradle" }
|
||||||
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin-gradle" }
|
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin-gradle" }
|
||||||
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin-gradle" }
|
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin-gradle" }
|
||||||
kotlinx-collections-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version.ref = "kotlinx-collections-immutable" }
|
|
||||||
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
|
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
|
||||||
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
|
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
|
||||||
kotlinx-coroutines-guava = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-guava", version.ref = "kotlinx-coroutines" }
|
kotlinx-coroutines-guava = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-guava", version.ref = "kotlinx-coroutines" }
|
||||||
|
|||||||
@@ -40,5 +40,4 @@ dependencies {
|
|||||||
|
|
||||||
implementation(libs.androidx.paging.runtime)
|
implementation(libs.androidx.paging.runtime)
|
||||||
implementation(libs.androidx.paging.compose)
|
implementation(libs.androidx.paging.compose)
|
||||||
implementation(libs.kotlinx.collections.immutable)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import androidx.compose.ui.text.PlaceholderVerticalAlign
|
|||||||
import androidx.compose.ui.text.buildAnnotatedString
|
import androidx.compose.ui.text.buildAnnotatedString
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import kotlinx.collections.immutable.persistentMapOf
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun BadgeGroup(
|
fun BadgeGroup(
|
||||||
@@ -67,7 +66,7 @@ fun Badge(
|
|||||||
val text = buildAnnotatedString {
|
val text = buildAnnotatedString {
|
||||||
appendInlineContent(iconContentPlaceholder)
|
appendInlineContent(iconContentPlaceholder)
|
||||||
}
|
}
|
||||||
val inlineContent = persistentMapOf(
|
val inlineContent = mapOf(
|
||||||
Pair(
|
Pair(
|
||||||
iconContentPlaceholder,
|
iconContentPlaceholder,
|
||||||
InlineTextContent(
|
InlineTextContent(
|
||||||
|
|||||||
+3
-4
@@ -43,7 +43,6 @@ import androidx.compose.ui.text.input.KeyboardType
|
|||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.DpSize
|
import androidx.compose.ui.unit.DpSize
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
@@ -56,7 +55,7 @@ import kotlin.math.absoluteValue
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun WheelNumberPicker(
|
fun WheelNumberPicker(
|
||||||
items: ImmutableList<Number>,
|
items: List<Number>,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
startIndex: Int = 0,
|
startIndex: Int = 0,
|
||||||
size: DpSize = DpSize(128.dp, 128.dp),
|
size: DpSize = DpSize(128.dp, 128.dp),
|
||||||
@@ -80,7 +79,7 @@ fun WheelNumberPicker(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun WheelTextPicker(
|
fun WheelTextPicker(
|
||||||
items: ImmutableList<String>,
|
items: List<String>,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
startIndex: Int = 0,
|
startIndex: Int = 0,
|
||||||
size: DpSize = DpSize(128.dp, 128.dp),
|
size: DpSize = DpSize(128.dp, 128.dp),
|
||||||
@@ -103,7 +102,7 @@ fun WheelTextPicker(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun <T> WheelPicker(
|
private fun <T> WheelPicker(
|
||||||
items: ImmutableList<T>,
|
items: List<T>,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
startIndex: Int = 0,
|
startIndex: Int = 0,
|
||||||
size: DpSize = DpSize(128.dp, 128.dp),
|
size: DpSize = DpSize(128.dp, 128.dp),
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import androidx.compose.ui.unit.LayoutDirection
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.util.fastForEach
|
import androidx.compose.ui.util.fastForEach
|
||||||
import dev.icerock.moko.resources.StringResource
|
import dev.icerock.moko.resources.StringResource
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import tachiyomi.presentation.core.components.ActionButton
|
import tachiyomi.presentation.core.components.ActionButton
|
||||||
import tachiyomi.presentation.core.components.material.padding
|
import tachiyomi.presentation.core.components.material.padding
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
@@ -39,7 +38,7 @@ data class EmptyScreenAction(
|
|||||||
fun EmptyScreen(
|
fun EmptyScreen(
|
||||||
stringRes: StringResource,
|
stringRes: StringResource,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
actions: ImmutableList<EmptyScreenAction>? = null,
|
actions: List<EmptyScreenAction>? = null,
|
||||||
) {
|
) {
|
||||||
EmptyScreen(
|
EmptyScreen(
|
||||||
message = stringResource(stringRes),
|
message = stringResource(stringRes),
|
||||||
@@ -52,7 +51,7 @@ fun EmptyScreen(
|
|||||||
fun EmptyScreen(
|
fun EmptyScreen(
|
||||||
message: String,
|
message: String,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
actions: ImmutableList<EmptyScreenAction>? = null,
|
actions: List<EmptyScreenAction>? = null,
|
||||||
) {
|
) {
|
||||||
val face = remember { getRandomErrorFace() }
|
val face = remember { getRandomErrorFace() }
|
||||||
Column(
|
Column(
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ dependencies {
|
|||||||
implementation(libs.androidx.glance.appWidget)
|
implementation(libs.androidx.glance.appWidget)
|
||||||
implementation(libs.material)
|
implementation(libs.material)
|
||||||
|
|
||||||
implementation(libs.kotlinx.collections.immutable)
|
|
||||||
|
|
||||||
implementation(libs.coil.core)
|
implementation(libs.coil.core)
|
||||||
|
|
||||||
api(libs.injekt)
|
api(libs.injekt)
|
||||||
|
|||||||
+1
-4
@@ -33,8 +33,6 @@ import coil3.size.Scale
|
|||||||
import coil3.transform.RoundedCornersTransformation
|
import coil3.transform.RoundedCornersTransformation
|
||||||
import eu.kanade.tachiyomi.core.security.SecurityPreferences
|
import eu.kanade.tachiyomi.core.security.SecurityPreferences
|
||||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
import tachiyomi.core.common.util.lang.withIOContext
|
import tachiyomi.core.common.util.lang.withIOContext
|
||||||
import tachiyomi.domain.manga.model.MangaCover
|
import tachiyomi.domain.manga.model.MangaCover
|
||||||
@@ -112,7 +110,7 @@ abstract class BaseUpdatesGridGlanceWidget(
|
|||||||
private suspend fun List<UpdatesWithRelations>.prepareData(
|
private suspend fun List<UpdatesWithRelations>.prepareData(
|
||||||
rowCount: Int,
|
rowCount: Int,
|
||||||
columnCount: Int,
|
columnCount: Int,
|
||||||
): ImmutableList<Pair<Long, Bitmap?>> {
|
): List<Pair<Long, Bitmap?>> {
|
||||||
// Resize to cover size
|
// Resize to cover size
|
||||||
val widthPx = CoverWidth.value.toInt().dpToPx
|
val widthPx = CoverWidth.value.toInt().dpToPx
|
||||||
val heightPx = CoverHeight.value.toInt().dpToPx
|
val heightPx = CoverHeight.value.toInt().dpToPx
|
||||||
@@ -150,7 +148,6 @@ abstract class BaseUpdatesGridGlanceWidget(
|
|||||||
?.toBitmap()
|
?.toBitmap()
|
||||||
Pair(updatesView.mangaId, bitmap)
|
Pair(updatesView.mangaId, bitmap)
|
||||||
}
|
}
|
||||||
.toImmutableList()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -21,7 +21,6 @@ import androidx.glance.layout.padding
|
|||||||
import androidx.glance.text.Text
|
import androidx.glance.text.Text
|
||||||
import androidx.glance.text.TextStyle
|
import androidx.glance.text.TextStyle
|
||||||
import androidx.glance.unit.ColorProvider
|
import androidx.glance.unit.ColorProvider
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
|
||||||
import tachiyomi.core.common.Constants
|
import tachiyomi.core.common.Constants
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
import tachiyomi.presentation.core.i18n.stringResource
|
import tachiyomi.presentation.core.i18n.stringResource
|
||||||
@@ -29,7 +28,7 @@ import tachiyomi.presentation.widget.util.calculateRowAndColumnCount
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun UpdatesWidget(
|
fun UpdatesWidget(
|
||||||
data: ImmutableList<Pair<Long, Bitmap?>>?,
|
data: List<Pair<Long, Bitmap?>>?,
|
||||||
contentColor: ColorProvider,
|
contentColor: ColorProvider,
|
||||||
topPadding: Dp,
|
topPadding: Dp,
|
||||||
bottomPadding: Dp,
|
bottomPadding: Dp,
|
||||||
|
|||||||
Reference in New Issue
Block a user