mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-24 21:58:34 +03:00
Merge pull request #1572 from Secozzi/tachimerge
Merge final tachi commits
This commit is contained in:
commit
42dc41d94e
54 changed files with 280 additions and 147 deletions
|
@ -38,6 +38,8 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import cafe.adriel.voyager.navigator.LocalNavigator
|
||||
import cafe.adriel.voyager.navigator.currentOrThrow
|
||||
import eu.kanade.core.util.fastDistinctBy
|
||||
import eu.kanade.presentation.browse.BaseBrowseItem
|
||||
import eu.kanade.presentation.browse.anime.components.AnimeExtensionIcon
|
||||
|
@ -45,6 +47,7 @@ import eu.kanade.presentation.browse.manga.ExtensionHeader
|
|||
import eu.kanade.presentation.browse.manga.ExtensionTrustDialog
|
||||
import eu.kanade.presentation.components.WarningBanner
|
||||
import eu.kanade.presentation.entries.components.DotSeparatorNoSpaceText
|
||||
import eu.kanade.presentation.more.settings.screen.browse.AnimeExtensionReposScreen
|
||||
import eu.kanade.presentation.util.rememberRequestPackageInstallsPermissionState
|
||||
import eu.kanade.tachiyomi.extension.InstallStep
|
||||
import eu.kanade.tachiyomi.extension.anime.model.AnimeExtension
|
||||
|
@ -52,6 +55,7 @@ import eu.kanade.tachiyomi.ui.browse.anime.extension.AnimeExtensionUiModel
|
|||
import eu.kanade.tachiyomi.ui.browse.anime.extension.AnimeExtensionsScreenModel
|
||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||
import eu.kanade.tachiyomi.util.system.launchRequestPackageInstallsPermission
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.presentation.core.components.FastScrollLazyColumn
|
||||
import tachiyomi.presentation.core.components.material.PullRefresh
|
||||
|
@ -59,6 +63,7 @@ import tachiyomi.presentation.core.components.material.padding
|
|||
import tachiyomi.presentation.core.components.material.topSmallPaddingValues
|
||||
import tachiyomi.presentation.core.i18n.stringResource
|
||||
import tachiyomi.presentation.core.screens.EmptyScreen
|
||||
import tachiyomi.presentation.core.screens.EmptyScreenAction
|
||||
import tachiyomi.presentation.core.screens.LoadingScreen
|
||||
import tachiyomi.presentation.core.util.plus
|
||||
import tachiyomi.presentation.core.util.secondaryItemAlpha
|
||||
|
@ -79,6 +84,8 @@ fun AnimeExtensionScreen(
|
|||
onClickUpdateAll: () -> Unit,
|
||||
onRefresh: () -> Unit,
|
||||
) {
|
||||
val navigator = LocalNavigator.currentOrThrow
|
||||
|
||||
PullRefresh(
|
||||
refreshing = state.isRefreshing,
|
||||
onRefresh = onRefresh,
|
||||
|
@ -95,6 +102,13 @@ fun AnimeExtensionScreen(
|
|||
EmptyScreen(
|
||||
stringRes = msg,
|
||||
modifier = Modifier.padding(contentPadding),
|
||||
actions = persistentListOf(
|
||||
EmptyScreenAction(
|
||||
stringRes = MR.strings.label_extension_repos,
|
||||
icon = Icons.Outlined.Settings,
|
||||
onClick = { navigator.push(AnimeExtensionReposScreen()) },
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
|
|
|
@ -40,12 +40,15 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import cafe.adriel.voyager.navigator.LocalNavigator
|
||||
import cafe.adriel.voyager.navigator.currentOrThrow
|
||||
import dev.icerock.moko.resources.StringResource
|
||||
import eu.kanade.core.util.fastDistinctBy
|
||||
import eu.kanade.presentation.browse.BaseBrowseItem
|
||||
import eu.kanade.presentation.browse.manga.components.MangaExtensionIcon
|
||||
import eu.kanade.presentation.components.WarningBanner
|
||||
import eu.kanade.presentation.entries.components.DotSeparatorNoSpaceText
|
||||
import eu.kanade.presentation.more.settings.screen.browse.MangaExtensionReposScreen
|
||||
import eu.kanade.presentation.util.rememberRequestPackageInstallsPermissionState
|
||||
import eu.kanade.tachiyomi.extension.InstallStep
|
||||
import eu.kanade.tachiyomi.extension.manga.model.MangaExtension
|
||||
|
@ -53,6 +56,7 @@ import eu.kanade.tachiyomi.ui.browse.manga.extension.MangaExtensionUiModel
|
|||
import eu.kanade.tachiyomi.ui.browse.manga.extension.MangaExtensionsScreenModel
|
||||
import eu.kanade.tachiyomi.util.system.LocaleHelper
|
||||
import eu.kanade.tachiyomi.util.system.launchRequestPackageInstallsPermission
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.presentation.core.components.FastScrollLazyColumn
|
||||
import tachiyomi.presentation.core.components.material.PullRefresh
|
||||
|
@ -60,6 +64,7 @@ import tachiyomi.presentation.core.components.material.padding
|
|||
import tachiyomi.presentation.core.components.material.topSmallPaddingValues
|
||||
import tachiyomi.presentation.core.i18n.stringResource
|
||||
import tachiyomi.presentation.core.screens.EmptyScreen
|
||||
import tachiyomi.presentation.core.screens.EmptyScreenAction
|
||||
import tachiyomi.presentation.core.screens.LoadingScreen
|
||||
import tachiyomi.presentation.core.theme.header
|
||||
import tachiyomi.presentation.core.util.plus
|
||||
|
@ -81,6 +86,8 @@ fun MangaExtensionScreen(
|
|||
onClickUpdateAll: () -> Unit,
|
||||
onRefresh: () -> Unit,
|
||||
) {
|
||||
val navigator = LocalNavigator.currentOrThrow
|
||||
|
||||
PullRefresh(
|
||||
refreshing = state.isRefreshing,
|
||||
onRefresh = onRefresh,
|
||||
|
@ -97,6 +104,13 @@ fun MangaExtensionScreen(
|
|||
EmptyScreen(
|
||||
stringRes = msg,
|
||||
modifier = Modifier.padding(contentPadding),
|
||||
actions = persistentListOf(
|
||||
EmptyScreenAction(
|
||||
stringRes = MR.strings.label_extension_repos,
|
||||
icon = Icons.Outlined.Settings,
|
||||
onClick = { navigator.push(MangaExtensionReposScreen()) },
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
|
|
|
@ -6,7 +6,7 @@ import androidx.compose.material.icons.outlined.Refresh
|
|||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.presentation.core.screens.EmptyScreen
|
||||
|
@ -15,7 +15,7 @@ import tachiyomi.presentation.core.screens.EmptyScreenAction
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun NoActionPreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface {
|
||||
EmptyScreen(
|
||||
stringRes = MR.strings.empty_screen,
|
||||
|
@ -27,7 +27,7 @@ private fun NoActionPreview() {
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun WithActionPreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface {
|
||||
EmptyScreen(
|
||||
stringRes = MR.strings.empty_screen,
|
||||
|
|
|
@ -133,7 +133,7 @@ data class TabContent(
|
|||
val titleRes: StringResource,
|
||||
val badgeNumber: Int? = null,
|
||||
val searchEnabled: Boolean = false,
|
||||
val actions: ImmutableList<AppBar.Action> = persistentListOf(),
|
||||
val actions: ImmutableList<AppBar.AppBarAction> = persistentListOf(),
|
||||
val content: @Composable (contentPadding: PaddingValues, snackbarHostState: SnackbarHostState) -> Unit,
|
||||
val numberTitle: Int = 0,
|
||||
val cancelAction: () -> Unit = {},
|
||||
|
|
|
@ -14,7 +14,7 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import eu.kanade.tachiyomi.util.CrashLogUtil
|
||||
import kotlinx.coroutines.launch
|
||||
import tachiyomi.i18n.MR
|
||||
|
@ -66,7 +66,7 @@ fun CrashScreen(
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun CrashScreenPreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
CrashScreen(exception = RuntimeException("Dummy")) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.presentation.core.components.material.padding
|
||||
import tachiyomi.presentation.core.i18n.pluralStringResource
|
||||
|
@ -44,7 +44,7 @@ fun MissingItemCountListItem(
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun Preview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface {
|
||||
MissingItemCountListItem(count = 42)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import androidx.compose.runtime.mutableStateOf
|
|||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.presentation.core.components.LabeledCheckbox
|
||||
import tachiyomi.presentation.core.components.material.padding
|
||||
|
@ -102,7 +102,7 @@ fun HistoryDeleteAllDialog(
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun HistoryDeleteDialogPreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
HistoryDeleteDialog(
|
||||
onDismissRequest = {},
|
||||
onDelete = {},
|
||||
|
|
|
@ -11,7 +11,7 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark
|
|||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import eu.kanade.presentation.components.relativeDateText
|
||||
import eu.kanade.presentation.history.anime.components.AnimeHistoryItem
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import eu.kanade.tachiyomi.ui.history.anime.AnimeHistoryScreenModel
|
||||
import tachiyomi.domain.history.anime.model.AnimeHistoryWithRelations
|
||||
import tachiyomi.i18n.MR
|
||||
|
@ -114,7 +114,7 @@ internal fun HistoryScreenPreviews(
|
|||
@PreviewParameter(AnimeHistoryScreenModelStateProvider::class)
|
||||
historyState: AnimeHistoryScreenModel.State,
|
||||
) {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
AnimeHistoryScreen(
|
||||
state = historyState,
|
||||
snackbarHostState = SnackbarHostState(),
|
||||
|
|
|
@ -23,7 +23,7 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark
|
|||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import eu.kanade.presentation.entries.components.ItemCover
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import eu.kanade.presentation.util.formatEpisodeNumber
|
||||
import eu.kanade.tachiyomi.util.lang.toTimestampString
|
||||
import tachiyomi.domain.history.anime.model.AnimeHistoryWithRelations
|
||||
|
@ -101,7 +101,7 @@ private fun HistoryItemPreviews(
|
|||
@PreviewParameter(AnimeHistoryWithRelationsProvider::class)
|
||||
historyWithRelations: AnimeHistoryWithRelations,
|
||||
) {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface {
|
||||
AnimeHistoryItem(
|
||||
history = historyWithRelations,
|
||||
|
|
|
@ -11,7 +11,7 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark
|
|||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import eu.kanade.presentation.components.relativeDateText
|
||||
import eu.kanade.presentation.history.manga.components.MangaHistoryItem
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import eu.kanade.tachiyomi.ui.history.manga.MangaHistoryScreenModel
|
||||
import tachiyomi.domain.history.manga.model.MangaHistoryWithRelations
|
||||
import tachiyomi.i18n.MR
|
||||
|
@ -114,7 +114,7 @@ internal fun HistoryScreenPreviews(
|
|||
@PreviewParameter(MangaHistoryScreenModelStateProvider::class)
|
||||
historyState: MangaHistoryScreenModel.State,
|
||||
) {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
MangaHistoryScreen(
|
||||
state = historyState,
|
||||
snackbarHostState = SnackbarHostState(),
|
||||
|
|
|
@ -23,7 +23,7 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark
|
|||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import eu.kanade.presentation.entries.components.ItemCover
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import eu.kanade.presentation.util.formatChapterNumber
|
||||
import eu.kanade.tachiyomi.util.lang.toTimestampString
|
||||
import tachiyomi.domain.history.manga.model.MangaHistoryWithRelations
|
||||
|
@ -101,7 +101,7 @@ internal fun HistoryItemPreviews(
|
|||
@PreviewParameter(MangaHistoryWithRelationsProvider::class)
|
||||
historyWithRelations: MangaHistoryWithRelations,
|
||||
) {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface {
|
||||
MangaHistoryItem(
|
||||
history = historyWithRelations,
|
||||
|
|
|
@ -6,7 +6,7 @@ import androidx.compose.material.icons.outlined.Folder
|
|||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import tachiyomi.presentation.core.components.Badge
|
||||
|
||||
@Composable
|
||||
|
@ -50,7 +50,7 @@ internal fun LanguageBadge(
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun BadgePreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Column {
|
||||
DownloadsBadge(count = 10)
|
||||
UnviewedBadge(count = 10)
|
||||
|
|
|
@ -19,7 +19,7 @@ import com.halilibo.richtext.markdown.Markdown
|
|||
import com.halilibo.richtext.ui.RichTextStyle
|
||||
import com.halilibo.richtext.ui.material3.RichText
|
||||
import com.halilibo.richtext.ui.string.RichTextStringStyle
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.presentation.core.components.material.padding
|
||||
import tachiyomi.presentation.core.i18n.stringResource
|
||||
|
@ -69,7 +69,7 @@ fun NewUpdateScreen(
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun NewUpdateScreenPreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
NewUpdateScreen(
|
||||
versionName = "v0.99.9",
|
||||
changelogInfo = """
|
||||
|
|
|
@ -13,7 +13,7 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.platform.LocalUriHandler
|
||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import androidx.compose.ui.unit.dp
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.presentation.core.components.material.padding
|
||||
import tachiyomi.presentation.core.i18n.stringResource
|
||||
|
@ -61,7 +61,7 @@ const val GETTING_STARTED_URL = "https://aniyomi.org/docs/guides/getting-started
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun GuidesStepPreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
GuidesStep(
|
||||
onRestoreBackup = {},
|
||||
).Content()
|
||||
|
|
|
@ -9,6 +9,7 @@ import androidx.compose.foundation.lazy.LazyColumn
|
|||
import androidx.compose.foundation.lazy.LazyListState
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.outlined.Label
|
||||
import androidx.compose.material.icons.outlined.ContentCopy
|
||||
import androidx.compose.material.icons.outlined.Delete
|
||||
import androidx.compose.material3.ElevatedCard
|
||||
import androidx.compose.material3.Icon
|
||||
|
@ -18,8 +19,12 @@ import androidx.compose.material3.Text
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||
import kotlinx.collections.immutable.ImmutableSet
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.presentation.core.components.material.padding
|
||||
import tachiyomi.presentation.core.i18n.stringResource
|
||||
|
||||
@Composable
|
||||
fun ExtensionReposContent(
|
||||
|
@ -53,6 +58,8 @@ private fun ExtensionRepoListItem(
|
|||
onDelete: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
|
||||
ElevatedCard(
|
||||
modifier = modifier,
|
||||
) {
|
||||
|
@ -74,8 +81,23 @@ private fun ExtensionRepoListItem(
|
|||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.End,
|
||||
) {
|
||||
IconButton(
|
||||
onClick = {
|
||||
val url = "$repo/index.min.json"
|
||||
context.copyToClipboard(url, url)
|
||||
},
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.ContentCopy,
|
||||
contentDescription = stringResource(MR.strings.action_copy_to_clipboard),
|
||||
)
|
||||
}
|
||||
|
||||
IconButton(onClick = onDelete) {
|
||||
Icon(imageVector = Icons.Outlined.Delete, contentDescription = null)
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Delete,
|
||||
contentDescription = stringResource(MR.strings.action_delete),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,15 +42,19 @@ import androidx.compose.ui.text.style.TextAlign
|
|||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.app.ActivityCompat
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.domain.ui.model.AppTheme
|
||||
import eu.kanade.presentation.entries.components.ItemCover
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||
import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable
|
||||
import tachiyomi.core.preference.InMemoryPreferenceStore
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.presentation.core.components.material.padding
|
||||
import tachiyomi.presentation.core.i18n.stringResource
|
||||
import tachiyomi.presentation.core.util.secondaryItemAlpha
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.fullType
|
||||
|
||||
@Composable
|
||||
internal fun AppThemePreferenceWidget(
|
||||
|
@ -258,7 +262,8 @@ fun AppThemePreviewItem(
|
|||
@Composable
|
||||
private fun AppThemesListPreview() {
|
||||
var appTheme by remember { mutableStateOf(AppTheme.DEFAULT) }
|
||||
TachiyomiTheme {
|
||||
Injekt.addSingleton(fullType<UiPreferences>(), UiPreferences(InMemoryPreferenceStore()))
|
||||
TachiyomiTheme(appTheme = appTheme) {
|
||||
Surface {
|
||||
AppThemesList(
|
||||
currentTheme = appTheme,
|
||||
|
|
|
@ -12,7 +12,7 @@ import androidx.compose.material3.Text
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.presentation.core.components.material.padding
|
||||
import tachiyomi.presentation.core.i18n.stringResource
|
||||
|
@ -43,7 +43,7 @@ internal fun InfoWidget(text: String) {
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun InfoWidgetPreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface {
|
||||
InfoWidget(text = stringResource(MR.strings.download_ahead_info))
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
|
||||
@Composable
|
||||
fun SwitchPreferenceWidget(
|
||||
|
@ -40,7 +40,7 @@ fun SwitchPreferenceWidget(
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun SwitchPreferenceWidgetPreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface {
|
||||
Column {
|
||||
SwitchPreferenceWidget(
|
||||
|
|
|
@ -13,7 +13,7 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import tachiyomi.presentation.core.util.secondaryItemAlpha
|
||||
|
||||
@Composable
|
||||
|
@ -62,7 +62,7 @@ fun TextPreferenceWidget(
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun TextPreferenceWidgetPreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface {
|
||||
Column {
|
||||
TextPreferenceWidget(
|
||||
|
|
|
@ -33,7 +33,7 @@ import androidx.compose.ui.text.style.TextOverflow
|
|||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import eu.kanade.tachiyomi.data.database.models.manga.toDomainChapter
|
||||
import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition
|
||||
import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter
|
||||
|
@ -310,7 +310,7 @@ private val FakeChapterLongTitle = previewChapter(
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun TransitionTextPreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface(modifier = Modifier.padding(48.dp)) {
|
||||
ChapterTransition(
|
||||
transition = ChapterTransition.Next(
|
||||
|
@ -327,7 +327,7 @@ private fun TransitionTextPreview() {
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun TransitionTextLongTitlePreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface(modifier = Modifier.padding(48.dp)) {
|
||||
ChapterTransition(
|
||||
transition = ChapterTransition.Next(
|
||||
|
@ -344,7 +344,7 @@ private fun TransitionTextLongTitlePreview() {
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun TransitionTextWithGapPreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface(modifier = Modifier.padding(48.dp)) {
|
||||
ChapterTransition(
|
||||
transition = ChapterTransition.Next(
|
||||
|
@ -361,7 +361,7 @@ private fun TransitionTextWithGapPreview() {
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun TransitionTextNoNextPreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface(modifier = Modifier.padding(48.dp)) {
|
||||
ChapterTransition(
|
||||
transition = ChapterTransition.Next(ReaderChapter(FakeChapter), null),
|
||||
|
@ -375,7 +375,7 @@ private fun TransitionTextNoNextPreview() {
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun TransitionTextNoPreviousPreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface(modifier = Modifier.padding(48.dp)) {
|
||||
ChapterTransition(
|
||||
transition = ChapterTransition.Prev(ReaderChapter(FakeChapter), null),
|
||||
|
|
|
@ -16,7 +16,7 @@ import dev.icerock.moko.resources.StringResource
|
|||
import eu.kanade.domain.entries.manga.model.readerOrientation
|
||||
import eu.kanade.presentation.components.AdaptiveSheet
|
||||
import eu.kanade.presentation.reader.components.ModeSelectionDialog
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation
|
||||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
|
||||
import tachiyomi.i18n.MR
|
||||
|
@ -85,7 +85,7 @@ private fun DialogContent(
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun DialogContentPreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface {
|
||||
Column {
|
||||
DialogContent(
|
||||
|
|
|
@ -12,7 +12,7 @@ import androidx.compose.ui.text.TextStyle
|
|||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import androidx.compose.ui.unit.sp
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
|
||||
@Composable
|
||||
fun PageIndicatorText(
|
||||
|
@ -52,7 +52,7 @@ fun PageIndicatorText(
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun PageIndicatorTextPreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface {
|
||||
PageIndicatorText(currentPage = 10, totalPages = 69)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import dev.icerock.moko.resources.StringResource
|
|||
import eu.kanade.domain.entries.manga.model.readingMode
|
||||
import eu.kanade.presentation.components.AdaptiveSheet
|
||||
import eu.kanade.presentation.reader.components.ModeSelectionDialog
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
|
||||
import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
|
||||
import tachiyomi.i18n.MR
|
||||
|
@ -83,7 +83,7 @@ private fun DialogContent(
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun DialogContentPreview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface {
|
||||
Column {
|
||||
DialogContent(
|
||||
|
|
|
@ -19,7 +19,7 @@ import androidx.compose.ui.Alignment
|
|||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import androidx.compose.ui.unit.dp
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.presentation.core.components.SettingsItemsPaddings
|
||||
import tachiyomi.presentation.core.components.material.padding
|
||||
|
@ -70,7 +70,7 @@ fun ModeSelectionDialog(
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun Preview() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface {
|
||||
Column {
|
||||
ModeSelectionDialog(
|
||||
|
|
|
@ -34,9 +34,30 @@ fun TachiyomiTheme(
|
|||
appTheme: AppTheme? = null,
|
||||
amoled: Boolean? = null,
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
val uiPreferences = Injekt.get<UiPreferences>()
|
||||
BaseTachiyomiTheme(
|
||||
appTheme = appTheme ?: uiPreferences.appTheme().get(),
|
||||
isAmoled = amoled ?: uiPreferences.themeDarkAmoled().get(),
|
||||
content = content,
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun TachiyomiPreviewTheme(
|
||||
appTheme: AppTheme = AppTheme.DEFAULT,
|
||||
isAmoled: Boolean = false,
|
||||
content: @Composable () -> Unit,
|
||||
) = BaseTachiyomiTheme(appTheme, isAmoled, content)
|
||||
|
||||
@Composable
|
||||
private fun BaseTachiyomiTheme(
|
||||
appTheme: AppTheme,
|
||||
isAmoled: Boolean,
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
MaterialTheme(
|
||||
colorScheme = getThemeColorScheme(appTheme, amoled),
|
||||
colorScheme = getThemeColorScheme(appTheme, isAmoled),
|
||||
content = content,
|
||||
)
|
||||
}
|
||||
|
@ -44,11 +65,11 @@ fun TachiyomiTheme(
|
|||
@Composable
|
||||
@ReadOnlyComposable
|
||||
private fun getThemeColorScheme(
|
||||
appTheme: AppTheme?,
|
||||
amoled: Boolean?,
|
||||
appTheme: AppTheme,
|
||||
isAmoled: Boolean,
|
||||
): ColorScheme {
|
||||
val uiPreferences = Injekt.get<UiPreferences>()
|
||||
val colorScheme = when (appTheme ?: uiPreferences.appTheme().get()) {
|
||||
val colorScheme = when (appTheme) {
|
||||
AppTheme.DEFAULT -> TachiyomiColorScheme
|
||||
AppTheme.MONET -> MonetColorScheme(LocalContext.current)
|
||||
AppTheme.CLOUDFLARE -> CloudflareColorScheme
|
||||
|
@ -71,6 +92,6 @@ private fun getThemeColorScheme(
|
|||
}
|
||||
return colorScheme.getColorScheme(
|
||||
isSystemInDarkTheme(),
|
||||
amoled ?: uiPreferences.themeDarkAmoled().get(),
|
||||
isAmoled,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import androidx.compose.ui.draw.clip
|
|||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import androidx.compose.ui.unit.dp
|
||||
import dev.icerock.moko.resources.StringResource
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentMapOf
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
|
@ -244,7 +244,7 @@ fun BaseSelector(
|
|||
@PreviewLightDark
|
||||
@Composable
|
||||
private fun TrackStatusSelectorPreviews() {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface {
|
||||
TrackStatusSelector(
|
||||
selection = 1,
|
||||
|
|
|
@ -34,7 +34,7 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark
|
|||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import dev.icerock.moko.resources.StringResource
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import eu.kanade.presentation.track.components.TrackLogoIcon
|
||||
import eu.kanade.presentation.track.manga.TrackDetailsItem
|
||||
import eu.kanade.presentation.track.manga.TrackInfoItemMenu
|
||||
|
@ -255,5 +255,5 @@ private fun TrackInfoDialogHomePreviews(
|
|||
@PreviewParameter(AnimeTrackInfoDialogHomePreviewProvider::class)
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
TachiyomiTheme { content() }
|
||||
TachiyomiPreviewTheme { content() }
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
|
|||
import androidx.compose.ui.unit.dp
|
||||
import eu.kanade.presentation.components.DropdownMenu
|
||||
import eu.kanade.presentation.entries.components.ItemCover
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import eu.kanade.tachiyomi.data.track.model.AnimeTrackSearch
|
||||
import eu.kanade.tachiyomi.util.system.openInBrowser
|
||||
import tachiyomi.i18n.MR
|
||||
|
@ -383,7 +383,7 @@ private fun TrackerSearchPreviews(
|
|||
@PreviewParameter(AnimeTrackerSearchPreviewProvider::class)
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface {
|
||||
content()
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import androidx.compose.ui.res.painterResource
|
|||
import androidx.compose.ui.tooling.preview.PreviewLightDark
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import eu.kanade.tachiyomi.data.track.Tracker
|
||||
import tachiyomi.presentation.core.util.clickableNoIndication
|
||||
|
||||
|
@ -49,7 +49,7 @@ private fun TrackLogoIconPreviews(
|
|||
@PreviewParameter(TrackLogoIconPreviewProvider::class)
|
||||
tracker: Tracker,
|
||||
) {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
TrackLogoIcon(
|
||||
tracker = tracker,
|
||||
onClick = null,
|
||||
|
|
|
@ -47,7 +47,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
|
|||
import androidx.compose.ui.unit.dp
|
||||
import dev.icerock.moko.resources.StringResource
|
||||
import eu.kanade.presentation.components.DropdownMenu
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import eu.kanade.presentation.track.components.TrackLogoIcon
|
||||
import eu.kanade.tachiyomi.data.track.Tracker
|
||||
import eu.kanade.tachiyomi.ui.entries.manga.track.MangaTrackItem
|
||||
|
@ -326,5 +326,5 @@ private fun TrackInfoDialogHomePreviews(
|
|||
@PreviewParameter(MangaTrackInfoDialogHomePreviewProvider::class)
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
TachiyomiTheme { content() }
|
||||
TachiyomiPreviewTheme { content() }
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
|
|||
import androidx.compose.ui.unit.dp
|
||||
import eu.kanade.presentation.components.DropdownMenu
|
||||
import eu.kanade.presentation.entries.components.ItemCover
|
||||
import eu.kanade.presentation.theme.TachiyomiTheme
|
||||
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
|
||||
import eu.kanade.tachiyomi.data.track.model.MangaTrackSearch
|
||||
import eu.kanade.tachiyomi.util.system.openInBrowser
|
||||
import tachiyomi.i18n.MR
|
||||
|
@ -383,7 +383,7 @@ private fun TrackerSearchPreviews(
|
|||
@PreviewParameter(MangaTrackerSearchPreviewProvider::class)
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
TachiyomiTheme {
|
||||
TachiyomiPreviewTheme {
|
||||
Surface {
|
||||
content()
|
||||
}
|
||||
|
|
|
@ -57,22 +57,24 @@ class AnimeRestorer(
|
|||
backupAnime: BackupAnime,
|
||||
backupCategories: List<BackupCategory>,
|
||||
) {
|
||||
val dbAnime = findExistingAnime(backupAnime)
|
||||
val anime = backupAnime.getAnimeImpl()
|
||||
val restoredAnime = if (dbAnime == null) {
|
||||
restoreNewAnime(anime)
|
||||
} else {
|
||||
restoreExistingAnime(anime, dbAnime)
|
||||
}
|
||||
handler.await(inTransaction = true) {
|
||||
val dbAnime = findExistingAnime(backupAnime)
|
||||
val anime = backupAnime.getAnimeImpl()
|
||||
val restoredAnime = if (dbAnime == null) {
|
||||
restoreNewAnime(anime)
|
||||
} else {
|
||||
restoreExistingAnime(anime, dbAnime)
|
||||
}
|
||||
|
||||
restoreAnimeDetails(
|
||||
anime = restoredAnime,
|
||||
episodes = backupAnime.episodes,
|
||||
categories = backupAnime.categories,
|
||||
backupCategories = backupCategories,
|
||||
history = backupAnime.history + backupAnime.brokenHistory.map { it.toBackupHistory() },
|
||||
tracks = backupAnime.tracking,
|
||||
)
|
||||
restoreAnimeDetails(
|
||||
anime = restoredAnime,
|
||||
episodes = backupAnime.episodes,
|
||||
categories = backupAnime.categories,
|
||||
backupCategories = backupCategories,
|
||||
history = backupAnime.history + backupAnime.brokenHistory.map { it.toBackupHistory() },
|
||||
tracks = backupAnime.tracking,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun findExistingAnime(backupAnime: BackupAnime): Anime? {
|
||||
|
|
|
@ -57,22 +57,24 @@ class MangaRestorer(
|
|||
backupManga: BackupManga,
|
||||
backupCategories: List<BackupCategory>,
|
||||
) {
|
||||
val dbManga = findExistingManga(backupManga)
|
||||
val manga = backupManga.getMangaImpl()
|
||||
val restoredManga = if (dbManga == null) {
|
||||
restoreNewManga(manga)
|
||||
} else {
|
||||
restoreExistingManga(manga, dbManga)
|
||||
}
|
||||
handler.await(inTransaction = true) {
|
||||
val dbManga = findExistingManga(backupManga)
|
||||
val manga = backupManga.getMangaImpl()
|
||||
val restoredManga = if (dbManga == null) {
|
||||
restoreNewManga(manga)
|
||||
} else {
|
||||
restoreExistingManga(manga, dbManga)
|
||||
}
|
||||
|
||||
restoreMangaDetails(
|
||||
manga = restoredManga,
|
||||
chapters = backupManga.chapters,
|
||||
categories = backupManga.categories,
|
||||
backupCategories = backupCategories,
|
||||
history = backupManga.history + backupManga.brokenHistory.map { it.toBackupHistory() },
|
||||
tracks = backupManga.tracking,
|
||||
)
|
||||
restoreMangaDetails(
|
||||
manga = restoredManga,
|
||||
chapters = backupManga.chapters,
|
||||
categories = backupManga.categories,
|
||||
backupCategories = backupCategories,
|
||||
history = backupManga.history + backupManga.brokenHistory.map { it.toBackupHistory() },
|
||||
tracks = backupManga.tracking,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun findExistingManga(backupManga: BackupManga): Manga? {
|
||||
|
|
|
@ -94,12 +94,15 @@ class AnimeDownloadCache(
|
|||
scope.launch {
|
||||
rootDownloadsDirLock.withLock {
|
||||
try {
|
||||
val diskCache = diskCacheFile.inputStream().use {
|
||||
ProtoBuf.decodeFromByteArray<RootDirectory>(it.readBytes())
|
||||
if (diskCacheFile.exists()) {
|
||||
val diskCache = diskCacheFile.inputStream().use {
|
||||
ProtoBuf.decodeFromByteArray<RootDirectory>(it.readBytes())
|
||||
}
|
||||
rootDownloadsDir = diskCache
|
||||
lastRenew = System.currentTimeMillis()
|
||||
}
|
||||
rootDownloadsDir = diskCache
|
||||
lastRenew = System.currentTimeMillis()
|
||||
} catch (e: Throwable) {
|
||||
logcat(LogPriority.ERROR, e) { "Failed to initialize disk cache" }
|
||||
diskCacheFile.delete()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,12 +105,15 @@ class MangaDownloadCache(
|
|||
scope.launch {
|
||||
rootDownloadsDirLock.withLock {
|
||||
try {
|
||||
val diskCache = diskCacheFile.inputStream().use {
|
||||
ProtoBuf.decodeFromByteArray<RootDirectory>(it.readBytes())
|
||||
if (diskCacheFile.exists()) {
|
||||
val diskCache = diskCacheFile.inputStream().use {
|
||||
ProtoBuf.decodeFromByteArray<RootDirectory>(it.readBytes())
|
||||
}
|
||||
rootDownloadsDir = diskCache
|
||||
lastRenew = System.currentTimeMillis()
|
||||
}
|
||||
rootDownloadsDir = diskCache
|
||||
lastRenew = System.currentTimeMillis()
|
||||
} catch (e: Throwable) {
|
||||
logcat(LogPriority.ERROR, e) { "Failed to initialize disk cache" }
|
||||
diskCacheFile.delete()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,18 +37,10 @@ internal class AnimeExtensionApi {
|
|||
|
||||
suspend fun findExtensions(): List<AnimeExtension.Available> {
|
||||
return withIOContext {
|
||||
val extensions = buildList {
|
||||
buildList {
|
||||
addAll(getExtensions(OFFICIAL_ANIYOMI_REPO_BASE_URL))
|
||||
sourcePreferences.animeExtensionRepos().get().map { addAll(getExtensions(it)) }
|
||||
}
|
||||
|
||||
// Sanity check - a small number of extensions probably means something broke
|
||||
// with the repo generator
|
||||
if (extensions.size < 50) {
|
||||
throw Exception()
|
||||
}
|
||||
|
||||
extensions
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,15 +36,7 @@ internal class MangaExtensionApi {
|
|||
|
||||
suspend fun findExtensions(): List<MangaExtension.Available> {
|
||||
return withIOContext {
|
||||
val extensions = sourcePreferences.mangaExtensionRepos().get().flatMap { getExtensions(it) }
|
||||
|
||||
// Sanity check - a small number of extensions probably means something broke
|
||||
// with the repo generator
|
||||
if (extensions.isEmpty()) {
|
||||
throw Exception()
|
||||
}
|
||||
|
||||
extensions
|
||||
sourcePreferences.mangaExtensionRepos().get().flatMap { getExtensions(it) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package eu.kanade.tachiyomi.ui.browse.anime.extension
|
||||
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Translate
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
|
@ -10,6 +8,7 @@ import cafe.adriel.voyager.navigator.currentOrThrow
|
|||
import eu.kanade.presentation.browse.anime.AnimeExtensionScreen
|
||||
import eu.kanade.presentation.components.AppBar
|
||||
import eu.kanade.presentation.components.TabContent
|
||||
import eu.kanade.presentation.more.settings.screen.browse.AnimeExtensionReposScreen
|
||||
import eu.kanade.tachiyomi.extension.anime.model.AnimeExtension
|
||||
import eu.kanade.tachiyomi.ui.browse.anime.extension.details.AnimeExtensionDetailsScreen
|
||||
import eu.kanade.tachiyomi.ui.webview.WebViewScreen
|
||||
|
@ -29,15 +28,18 @@ fun animeExtensionsTab(
|
|||
badgeNumber = state.updates.takeIf { it > 0 },
|
||||
searchEnabled = true,
|
||||
actions = persistentListOf(
|
||||
AppBar.Action(
|
||||
AppBar.OverflowAction(
|
||||
title = stringResource(MR.strings.action_filter),
|
||||
icon = Icons.Outlined.Translate,
|
||||
onClick = {
|
||||
navigator.push(
|
||||
eu.kanade.tachiyomi.ui.browse.anime.extension.AnimeExtensionFilterScreen(),
|
||||
AnimeExtensionFilterScreen(),
|
||||
)
|
||||
},
|
||||
),
|
||||
AppBar.OverflowAction(
|
||||
title = stringResource(MR.strings.label_extension_repos),
|
||||
onClick = { navigator.push(AnimeExtensionReposScreen()) },
|
||||
),
|
||||
),
|
||||
content = { contentPadding, _ ->
|
||||
AnimeExtensionScreen(
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package eu.kanade.tachiyomi.ui.browse.manga.extension
|
||||
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Translate
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
|
@ -10,6 +8,7 @@ import cafe.adriel.voyager.navigator.currentOrThrow
|
|||
import eu.kanade.presentation.browse.manga.MangaExtensionScreen
|
||||
import eu.kanade.presentation.components.AppBar
|
||||
import eu.kanade.presentation.components.TabContent
|
||||
import eu.kanade.presentation.more.settings.screen.browse.MangaExtensionReposScreen
|
||||
import eu.kanade.tachiyomi.extension.manga.model.MangaExtension
|
||||
import eu.kanade.tachiyomi.ui.browse.manga.extension.details.MangaExtensionDetailsScreen
|
||||
import eu.kanade.tachiyomi.ui.webview.WebViewScreen
|
||||
|
@ -29,11 +28,14 @@ fun mangaExtensionsTab(
|
|||
badgeNumber = state.updates.takeIf { it > 0 },
|
||||
searchEnabled = true,
|
||||
actions = persistentListOf(
|
||||
AppBar.Action(
|
||||
AppBar.OverflowAction(
|
||||
title = stringResource(MR.strings.action_filter),
|
||||
icon = Icons.Outlined.Translate,
|
||||
onClick = { navigator.push(MangaExtensionFilterScreen()) },
|
||||
),
|
||||
AppBar.OverflowAction(
|
||||
title = stringResource(MR.strings.label_extension_repos),
|
||||
onClick = { navigator.push(MangaExtensionReposScreen()) },
|
||||
),
|
||||
),
|
||||
content = { contentPadding, _ ->
|
||||
MangaExtensionScreen(
|
||||
|
|
|
@ -102,7 +102,14 @@ abstract class PagerViewer(val activity: ReaderActivity) : Viewer {
|
|||
},
|
||||
)
|
||||
pager.tapListener = { event ->
|
||||
val pos = PointF(event.x / pager.width, event.y / pager.height)
|
||||
val viewPosition = IntArray(2)
|
||||
pager.getLocationOnScreen(viewPosition)
|
||||
val viewPositionRelativeToWindow = IntArray(2)
|
||||
pager.getLocationInWindow(viewPositionRelativeToWindow)
|
||||
val pos = PointF(
|
||||
(event.rawX - viewPosition[0] + viewPositionRelativeToWindow[0]) / pager.width,
|
||||
(event.rawY - viewPosition[1] + viewPositionRelativeToWindow[1]) / pager.height,
|
||||
)
|
||||
when (config.navigator.getAction(pos)) {
|
||||
NavigationRegion.MENU -> activity.toggleMenu()
|
||||
NavigationRegion.NEXT -> moveToNext()
|
||||
|
|
|
@ -111,7 +111,14 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
|
|||
},
|
||||
)
|
||||
recycler.tapListener = { event ->
|
||||
val pos = PointF(event.y / recycler.width, event.y / recycler.height)
|
||||
val viewPosition = IntArray(2)
|
||||
recycler.getLocationOnScreen(viewPosition)
|
||||
val viewPositionRelativeToWindow = IntArray(2)
|
||||
recycler.getLocationInWindow(viewPositionRelativeToWindow)
|
||||
val pos = PointF(
|
||||
(event.rawX - viewPosition[0] + viewPositionRelativeToWindow[0]) / recycler.width,
|
||||
(event.rawY - viewPosition[1] + viewPositionRelativeToWindow[1]) / recycler.height,
|
||||
)
|
||||
when (config.navigator.getAction(pos)) {
|
||||
NavigationRegion.MENU -> activity.toggleMenu()
|
||||
NavigationRegion.NEXT, NavigationRegion.RIGHT -> scrollDown()
|
||||
|
|
|
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.network
|
|||
|
||||
import android.content.Context
|
||||
import eu.kanade.tachiyomi.network.interceptor.CloudflareInterceptor
|
||||
import eu.kanade.tachiyomi.network.interceptor.IgnoreGzipInterceptor
|
||||
import eu.kanade.tachiyomi.network.interceptor.UncaughtExceptionInterceptor
|
||||
import eu.kanade.tachiyomi.network.interceptor.UserAgentInterceptor
|
||||
import okhttp3.Cache
|
||||
|
@ -30,9 +31,10 @@ class NetworkHelper(
|
|||
maxSize = 5L * 1024 * 1024, // 5 MiB
|
||||
),
|
||||
)
|
||||
.addInterceptor(BrotliInterceptor)
|
||||
.addInterceptor(UncaughtExceptionInterceptor())
|
||||
.addInterceptor(UserAgentInterceptor(::defaultUserAgentProvider))
|
||||
.addNetworkInterceptor(IgnoreGzipInterceptor())
|
||||
.addNetworkInterceptor(BrotliInterceptor)
|
||||
|
||||
if (preferences.verboseLogging().get()) {
|
||||
val httpLoggingInterceptor = HttpLoggingInterceptor().apply {
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package eu.kanade.tachiyomi.network.interceptor
|
||||
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Response
|
||||
|
||||
/**
|
||||
* To use [okhttp3.brotli.BrotliInterceptor] as a network interceptor,
|
||||
* add [IgnoreGzipInterceptor] right before it.
|
||||
*
|
||||
* This nullifies the transparent gzip of [okhttp3.internal.http.BridgeInterceptor]
|
||||
* so gzip and Brotli are explicitly handled by the [okhttp3.brotli.BrotliInterceptor].
|
||||
*/
|
||||
class IgnoreGzipInterceptor : Interceptor {
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
var request = chain.request()
|
||||
if (request.header("Accept-Encoding") == "gzip") {
|
||||
request = request.newBuilder().removeHeader("Accept-Encoding").build()
|
||||
}
|
||||
return chain.proceed(request)
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
[versions]
|
||||
compiler = "1.5.7"
|
||||
compiler = "1.5.8"
|
||||
compose-bom = "2023.12.00-alpha04"
|
||||
accompanist = "0.33.2-alpha"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[versions]
|
||||
kotlin_version = "1.9.21"
|
||||
kotlin_version = "1.9.22"
|
||||
serialization_version = "1.6.2"
|
||||
xml_serialization_version = "0.86.3"
|
||||
|
||||
|
|
|
@ -316,7 +316,7 @@
|
|||
<string name="restoring_backup_error">Възстановяването неуспешно</string>
|
||||
<string name="restore_in_progress">Възстановяването е в процес</string>
|
||||
<string name="creating_backup_error">Съхраняването неуспешно</string>
|
||||
<string name="backup_in_progress">Копието вече се запазва</string>
|
||||
<string name="backup_in_progress">Архивирането вече е в ход</string>
|
||||
<string name="restore_duration">%02d мин, %02d сек</string>
|
||||
<string name="pref_webtoon_side_padding">Странично разстояние</string>
|
||||
<string name="pref_category_reading">Четене</string>
|
||||
|
@ -331,7 +331,7 @@
|
|||
<string name="lock_never">Никога</string>
|
||||
<string name="lock_always">Винаги</string>
|
||||
<string name="lock_when_idle">Заключи при неактивност</string>
|
||||
<string name="lock_with_biometrics">Изисквай отключване</string>
|
||||
<string name="lock_with_biometrics">Изискване на отключване</string>
|
||||
<string name="pref_category_security">Сигурност</string>
|
||||
<string name="pref_manage_notifications">Уведомления</string>
|
||||
<string name="theme_system">Система на абонаментите</string>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<item quantity="other">%d kategorioj</item>
|
||||
</plurals>
|
||||
<plurals name="manga_num_chapters">
|
||||
<item quantity="one">1 ĉapitro</item>
|
||||
<item quantity="one">%1$s ĉapitro</item>
|
||||
<item quantity="other">%1$s ĉapitroj</item>
|
||||
</plurals>
|
||||
<plurals name="notification_chapters_multiple_and_more">
|
||||
|
@ -33,7 +33,7 @@
|
|||
<item quantity="other">%d ŝanĝspuriloj</item>
|
||||
</plurals>
|
||||
<plurals name="download_queue_summary">
|
||||
<item quantity="one">1 restas</item>
|
||||
<item quantity="one">%1$s restas</item>
|
||||
<item quantity="other">%1$s restas</item>
|
||||
</plurals>
|
||||
<plurals name="restore_completed_message">
|
||||
|
@ -68,4 +68,20 @@
|
|||
<item quantity="one"/>
|
||||
<item quantity="other"/>
|
||||
</plurals>
|
||||
<plurals name="day">
|
||||
<item quantity="one">1 tago</item>
|
||||
<item quantity="other">%d tagoj</item>
|
||||
</plurals>
|
||||
<plurals name="download_amount">
|
||||
<item quantity="one">Sekva ĉapitro</item>
|
||||
<item quantity="other">Sekvaj %d ĉapitroj</item>
|
||||
</plurals>
|
||||
<plurals name="missing_chapters">
|
||||
<item quantity="one">Mankas %1$s ĉapitro</item>
|
||||
<item quantity="other">Mankas %1$s ĉapitroj</item>
|
||||
</plurals>
|
||||
<plurals name="next_unread_chapters">
|
||||
<item quantity="one">Sekva nelegita ĉapitro</item>
|
||||
<item quantity="other">Sekvaj %d nelegitaj ĉapitroj</item>
|
||||
</plurals>
|
||||
</resources>
|
|
@ -7,13 +7,13 @@
|
|||
<string name="label_settings">Agordoj</string>
|
||||
<string name="label_more">Pli</string>
|
||||
<string name="name">Nomo</string>
|
||||
<string name="information_no_recent">Neniuj ĝisdatigoj</string>
|
||||
<string name="information_no_recent">Neniuj lastatempaj ĝisdatigoj</string>
|
||||
<string name="information_no_downloads">Neniu elŝuto</string>
|
||||
<string name="label_help">Asistado</string>
|
||||
<string name="label_extension_info">Konektprogramaro Informaĵo</string>
|
||||
<string name="label_extension_info">Informoj de aldonaĵo</string>
|
||||
<string name="label_extensions">Aldonaĵoj</string>
|
||||
<string name="label_migration">Migri</string>
|
||||
<string name="label_backup">Arkivi kaj restaŭri</string>
|
||||
<string name="label_backup">Savkopii kaj restaŭri</string>
|
||||
<string name="website">Retejo</string>
|
||||
<string name="username">Uzantnomo</string>
|
||||
<string name="password">Pasvorto</string>
|
||||
|
@ -51,7 +51,7 @@
|
|||
<string name="manga">Biblioteka kontribuoj</string>
|
||||
<string name="categories">Kategorioj</string>
|
||||
<string name="information_empty_library">Via biblioteko malplenas</string>
|
||||
<string name="information_no_recent_manga">Neniu legita laste</string>
|
||||
<string name="information_no_recent_manga">Neniu legita lastatempe</string>
|
||||
<string name="hide_notification_content">Kaŝi enhavon de sciigoj</string>
|
||||
<string name="lock_never">Neniam</string>
|
||||
<string name="lock_always">Ĉiam</string>
|
||||
|
@ -345,7 +345,7 @@
|
|||
<string name="action_order_by_upload_date">Laŭ elŝuta dato</string>
|
||||
<string name="action_select_inverse">Elekti inverse</string>
|
||||
<string name="label_default">Defaŭlte</string>
|
||||
<string name="information_empty_category">Vi havas neniun kategorion. Tuŝeti la butonon kun plus por krei unu por organizi vian bibliotekon.</string>
|
||||
<string name="information_empty_category">Vi havas neniun kategorion. Tuŝeti la butonon kun plus, por krei unu kaj organizi vian bibliotekon.</string>
|
||||
<string name="channel_ext_updates">Kromaĵaj ĝisdatigoj</string>
|
||||
<string name="download_notifier_downloader_title">Elŝutilo</string>
|
||||
<string name="pref_category_for_this_series">Por ĉi-serion</string>
|
||||
|
|
|
@ -680,7 +680,7 @@
|
|||
<string name="pref_update_only_in_release_period">Fuori dal periodo di rilascio previsto</string>
|
||||
<string name="intervals_header">Intervalli</string>
|
||||
<string name="manga_display_interval_title">Stima ogni</string>
|
||||
<string name="action_filter_interval_custom">Intervallo di recupero personalizzato</string>
|
||||
<string name="action_filter_interval_custom">Intervallo di aggiornamento personalizzato</string>
|
||||
<string name="action_sort_next_updated">Prossimo aggiornamento previsto</string>
|
||||
<string name="manga_display_modified_interval_title">Imposta l\'aggiornamento ogni</string>
|
||||
<string name="skipped_reason_not_in_release_period">Saltato perché oggi non era previsto alcun rilascio</string>
|
||||
|
|
|
@ -45,4 +45,7 @@
|
|||
<plurals name="day">
|
||||
<item quantity="other">%d日</item>
|
||||
</plurals>
|
||||
<plurals name="num_repos">
|
||||
<item quantity="other">%dリポジトリ</item>
|
||||
</plurals>
|
||||
</resources>
|
|
@ -45,4 +45,7 @@
|
|||
<plurals name="day">
|
||||
<item quantity="other">%d hari</item>
|
||||
</plurals>
|
||||
<plurals name="num_repos">
|
||||
<item quantity="other">%d repositori</item>
|
||||
</plurals>
|
||||
</resources>
|
|
@ -683,11 +683,11 @@
|
|||
<string name="action_sort_next_updated">Próxima atualização esperada</string>
|
||||
<string name="manga_display_modified_interval_title">Definido para atualizar a cada</string>
|
||||
<string name="skipped_reason_not_in_release_period">Pulado, pois nenhum lançamento é esperado para hoje</string>
|
||||
<string name="delete_downloaded">Deletar dowloand</string>
|
||||
<string name="delete_downloaded">Apagar download</string>
|
||||
<string name="selected">Selecionado</string>
|
||||
<string name="not_selected">Não selecionado</string>
|
||||
<string name="action_menu_overflow_description">Mais opções</string>
|
||||
<string name="action_bar_up_description">Rolar para cima</string>
|
||||
<string name="action_bar_up_description">Navegar para cima</string>
|
||||
<string name="unlock_app_title">Desbloquear %s</string>
|
||||
<string name="label_data_storage">Dados e armazenamento</string>
|
||||
<string name="manga_categories">Categorias de Mangá</string>
|
||||
|
|
|
@ -533,7 +533,7 @@
|
|||
<string name="extension_api_error">Не удалось получить доступные расширения</string>
|
||||
<string name="privacy_policy">Политика конфиденциальности</string>
|
||||
<string name="pref_update_only_completely_read">Пропускать серии с непрочитанными главами</string>
|
||||
<string name="library_errors_help">Для помощи в исправлении ошибок библиотеки нажать %1$s</string>
|
||||
<string name="library_errors_help">Для помощи в исправлении ошибок библиотеки, нажмите %1$s</string>
|
||||
<string name="save_chapter_as_cbz">Сохранить как архив CBZ</string>
|
||||
<string name="cancelled">Отменено</string>
|
||||
<string name="on_hiatus">Перерыв</string>
|
||||
|
|
|
@ -160,7 +160,7 @@
|
|||
<string name="action_move_to_top_all_for_series">సిరీస్ పైన పెట్టండి</string>
|
||||
<string name="action_search_hint">అన్వేషించండి…</string>
|
||||
<string name="action_not_now">ఇప్పుడు కాదు</string>
|
||||
<string name="action_open_random_manga">"ఏదైనా తెరవండి"</string>
|
||||
<string name="action_open_random_manga">ఏదైనా తెరవండి</string>
|
||||
<string name="internal_error">అంతర్గత లోపం: మరింత సమాచారం కోసం క్రాష్ లాగ్లను తనిఖీ చేయండి</string>
|
||||
<string name="pref_appearance_summary">థీమ్, తేదీ మరియు సమయ ఆకృతి</string>
|
||||
<string name="channel_errors">లోపాలూ</string>
|
||||
|
|
Loading…
Reference in a new issue