ktlint format again

This commit is contained in:
LuftVerbot 2023-11-19 16:05:25 +01:00
parent 05f91245ac
commit ea2b7fe7c0
416 changed files with 2101 additions and 1791 deletions

View file

@ -1,6 +1,6 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.FileInputStream import java.io.FileInputStream
import java.util.Properties import java.util.Properties
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
id("com.android.application") id("com.android.application")
@ -110,7 +110,8 @@ android {
} }
packaging { packaging {
resources.excludes.addAll(listOf( resources.excludes.addAll(
listOf(
"META-INF/DEPENDENCIES", "META-INF/DEPENDENCIES",
"LICENSE.txt", "LICENSE.txt",
"META-INF/LICENSE", "META-INF/LICENSE",
@ -118,7 +119,8 @@ android {
"META-INF/README.md", "META-INF/README.md",
"META-INF/NOTICE", "META-INF/NOTICE",
"META-INF/*.kotlin_module", "META-INF/*.kotlin_module",
)) ),
)
} }
dependenciesInfo { dependenciesInfo {
@ -282,7 +284,7 @@ androidComponents {
// Disables standardBenchmark // Disables standardBenchmark
if (variantBuilder.buildType == "benchmark") { if (variantBuilder.buildType == "benchmark") {
variantBuilder.enable = variantBuilder.productFlavors.containsAll( variantBuilder.enable = variantBuilder.productFlavors.containsAll(
listOf("default" to "dev") listOf("default" to "dev"),
) )
} }
} }
@ -318,12 +320,12 @@ tasks {
kotlinOptions.freeCompilerArgs += listOf( kotlinOptions.freeCompilerArgs += listOf(
"-P", "-P",
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" + "plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" +
project.buildDir.absolutePath + "/compose_metrics" project.buildDir.absolutePath + "/compose_metrics",
) )
kotlinOptions.freeCompilerArgs += listOf( kotlinOptions.freeCompilerArgs += listOf(
"-P", "-P",
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" + "plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" +
project.buildDir.absolutePath + "/compose_metrics" project.buildDir.absolutePath + "/compose_metrics",
) )
} }
} }

View file

@ -78,7 +78,7 @@ private class BandwidthHeroDataSaver(preferences: SourcePreferences) : DataSaver
imageUrl imageUrl
} else { } else {
getUrl( getUrl(
imageUrl imageUrl,
) )
} }
imageUrl.contains(".gif", true) -> if (ignoreGif) imageUrl else getUrl(imageUrl) imageUrl.contains(".gif", true) -> if (ignoreGif) imageUrl else getUrl(imageUrl)
@ -110,7 +110,7 @@ private class WsrvNlDataSaver(preferences: SourcePreferences) : DataSaver {
imageUrl imageUrl
} else { } else {
getUrl( getUrl(
imageUrl imageUrl,
) )
} }
imageUrl.contains(".gif", true) -> if (ignoreGif) imageUrl else getUrl(imageUrl) imageUrl.contains(".gif", true) -> if (ignoreGif) imageUrl else getUrl(imageUrl)
@ -122,8 +122,9 @@ private class WsrvNlDataSaver(preferences: SourcePreferences) : DataSaver {
// Network Request sent to wsrv // Network Request sent to wsrv
return "https://wsrv.nl/?url=$imageUrl" + if (imageUrl.contains(".webp", true) || imageUrl.contains( return "https://wsrv.nl/?url=$imageUrl" + if (imageUrl.contains(".webp", true) || imageUrl.contains(
".gif", ".gif",
true true,
)) { )
) {
if (!format) { if (!format) {
// Preserve output image extension for animated images(.webp and .gif) // Preserve output image extension for animated images(.webp and .gif)
"&q=$quality&n=-1" "&q=$quality&n=-1"
@ -159,7 +160,7 @@ private class ReSmushItDataSaver(preferences: SourcePreferences) : DataSaver {
imageUrl imageUrl
} else { } else {
getUrl( getUrl(
imageUrl imageUrl,
) )
} }
imageUrl.contains(".gif", true) -> if (ignoreGif) imageUrl else getUrl(imageUrl) imageUrl.contains(".gif", true) -> if (ignoreGif) imageUrl else getUrl(imageUrl)

View file

@ -22,11 +22,11 @@ class BasePreferences(
fun acraEnabled() = preferenceStore.getBoolean( fun acraEnabled() = preferenceStore.getBoolean(
"acra.enable", "acra.enable",
isPreviewBuildType || isReleaseBuildType isPreviewBuildType || isReleaseBuildType,
) )
fun deviceHasPip() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && context.packageManager.hasSystemFeature( fun deviceHasPip() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && context.packageManager.hasSystemFeature(
PackageManager.FEATURE_PICTURE_IN_PICTURE PackageManager.FEATURE_PICTURE_IN_PICTURE,
) )
enum class ExtensionInstaller(@StringRes val titleResId: Int) { enum class ExtensionInstaller(@StringRes val titleResId: Int) {

View file

@ -1,9 +1,9 @@
package eu.kanade.domain.entries.anime.interactor package eu.kanade.domain.entries.anime.interactor
import kotlin.math.pow
import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.entries.anime.model.Anime
import tachiyomi.domain.entries.anime.model.AnimeUpdate import tachiyomi.domain.entries.anime.model.AnimeUpdate
import tachiyomi.domain.entries.anime.repository.AnimeRepository import tachiyomi.domain.entries.anime.repository.AnimeRepository
import kotlin.math.pow
class SetAnimeViewerFlags( class SetAnimeViewerFlags(
private val animeRepository: AnimeRepository, private val animeRepository: AnimeRepository,

View file

@ -3,8 +3,6 @@ package eu.kanade.domain.entries.anime.interactor
import eu.kanade.domain.entries.anime.model.hasCustomCover import eu.kanade.domain.entries.anime.model.hasCustomCover
import eu.kanade.tachiyomi.animesource.model.SAnime import eu.kanade.tachiyomi.animesource.model.SAnime
import eu.kanade.tachiyomi.data.cache.AnimeCoverCache import eu.kanade.tachiyomi.data.cache.AnimeCoverCache
import java.time.ZonedDateTime
import java.util.Date
import tachiyomi.domain.entries.anime.interactor.SetAnimeFetchInterval import tachiyomi.domain.entries.anime.interactor.SetAnimeFetchInterval
import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.entries.anime.model.Anime
import tachiyomi.domain.entries.anime.model.AnimeUpdate import tachiyomi.domain.entries.anime.model.AnimeUpdate
@ -12,6 +10,8 @@ import tachiyomi.domain.entries.anime.repository.AnimeRepository
import tachiyomi.source.local.entries.anime.isLocal import tachiyomi.source.local.entries.anime.isLocal
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.time.ZonedDateTime
import java.util.Date
class UpdateAnime( class UpdateAnime(
private val animeRepository: AnimeRepository, private val animeRepository: AnimeRepository,
@ -92,7 +92,7 @@ class UpdateAnime(
suspend fun awaitUpdateCoverLastModified(mangaId: Long): Boolean { suspend fun awaitUpdateCoverLastModified(mangaId: Long): Boolean {
return animeRepository.updateAnime( return animeRepository.updateAnime(
AnimeUpdate(id = mangaId, coverLastModified = Date().time) AnimeUpdate(id = mangaId, coverLastModified = Date().time),
) )
} }

View file

@ -3,8 +3,6 @@ package eu.kanade.domain.entries.manga.interactor
import eu.kanade.domain.entries.manga.model.hasCustomCover import eu.kanade.domain.entries.manga.model.hasCustomCover
import eu.kanade.tachiyomi.data.cache.MangaCoverCache import eu.kanade.tachiyomi.data.cache.MangaCoverCache
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import java.time.ZonedDateTime
import java.util.Date
import tachiyomi.domain.entries.manga.interactor.SetMangaFetchInterval import tachiyomi.domain.entries.manga.interactor.SetMangaFetchInterval
import tachiyomi.domain.entries.manga.model.Manga import tachiyomi.domain.entries.manga.model.Manga
import tachiyomi.domain.entries.manga.model.MangaUpdate import tachiyomi.domain.entries.manga.model.MangaUpdate
@ -12,6 +10,8 @@ import tachiyomi.domain.entries.manga.repository.MangaRepository
import tachiyomi.source.local.entries.manga.isLocal import tachiyomi.source.local.entries.manga.isLocal
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.time.ZonedDateTime
import java.util.Date
class UpdateManga( class UpdateManga(
private val mangaRepository: MangaRepository, private val mangaRepository: MangaRepository,
@ -92,7 +92,7 @@ class UpdateManga(
suspend fun awaitUpdateCoverLastModified(mangaId: Long): Boolean { suspend fun awaitUpdateCoverLastModified(mangaId: Long): Boolean {
return mangaRepository.updateManga( return mangaRepository.updateManga(
MangaUpdate(id = mangaId, coverLastModified = Date().time) MangaUpdate(id = mangaId, coverLastModified = Date().time),
) )
} }

View file

@ -9,10 +9,6 @@ import eu.kanade.tachiyomi.data.download.manga.MangaDownloadProvider
import eu.kanade.tachiyomi.source.MangaSource import eu.kanade.tachiyomi.source.MangaSource
import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.source.online.HttpSource
import java.lang.Long.max
import java.time.ZonedDateTime
import java.util.Date
import java.util.TreeSet
import tachiyomi.data.items.chapter.ChapterSanitizer import tachiyomi.data.items.chapter.ChapterSanitizer
import tachiyomi.domain.entries.manga.model.Manga import tachiyomi.domain.entries.manga.model.Manga
import tachiyomi.domain.items.chapter.interactor.GetChapterByMangaId import tachiyomi.domain.items.chapter.interactor.GetChapterByMangaId
@ -25,6 +21,10 @@ import tachiyomi.domain.items.chapter.repository.ChapterRepository
import tachiyomi.domain.items.chapter.service.ChapterRecognition import tachiyomi.domain.items.chapter.service.ChapterRecognition
import tachiyomi.source.local.entries.manga.isLocal import tachiyomi.source.local.entries.manga.isLocal
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.lang.Long.max
import java.time.ZonedDateTime
import java.util.Date
import java.util.TreeSet
class SyncChaptersWithSource( class SyncChaptersWithSource(
private val downloadManager: MangaDownloadManager, private val downloadManager: MangaDownloadManager,
@ -103,7 +103,7 @@ class SyncChaptersWithSource(
val chapterNumber = ChapterRecognition.parseChapterNumber( val chapterNumber = ChapterRecognition.parseChapterNumber(
manga.title, manga.title,
chapter.name, chapter.name,
chapter.chapterNumber chapter.chapterNumber,
) )
chapter = chapter.copy(chapterNumber = chapterNumber) chapter = chapter.copy(chapterNumber = chapterNumber)
@ -122,13 +122,13 @@ class SyncChaptersWithSource(
if (shouldUpdateDbChapter.await(dbChapter, chapter)) { if (shouldUpdateDbChapter.await(dbChapter, chapter)) {
val shouldRenameChapter = downloadProvider.isChapterDirNameChanged( val shouldRenameChapter = downloadProvider.isChapterDirNameChanged(
dbChapter, dbChapter,
chapter chapter,
) && ) &&
downloadManager.isChapterDownloaded( downloadManager.isChapterDownloaded(
dbChapter.name, dbChapter.name,
dbChapter.scanlator, dbChapter.scanlator,
manga.title, manga.title,
manga.source manga.source,
) )
if (shouldRenameChapter) { if (shouldRenameChapter) {

View file

@ -1,10 +1,10 @@
package eu.kanade.domain.items.chapter.model package eu.kanade.domain.items.chapter.model
import data.Chapters import data.Chapters
import eu.kanade.tachiyomi.data.database.models.manga.Chapter as DbChapter
import eu.kanade.tachiyomi.data.database.models.manga.ChapterImpl import eu.kanade.tachiyomi.data.database.models.manga.ChapterImpl
import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SChapter
import tachiyomi.domain.items.chapter.model.Chapter import tachiyomi.domain.items.chapter.model.Chapter
import eu.kanade.tachiyomi.data.database.models.manga.Chapter as DbChapter
// TODO: Remove when all deps are migrated // TODO: Remove when all deps are migrated
fun Chapter.toSChapter(): SChapter { fun Chapter.toSChapter(): SChapter {

View file

@ -27,7 +27,7 @@ fun List<Chapter>.applyFilters(manga: Manga, downloadManager: MangaDownloadManag
chapter.name, chapter.name,
chapter.scanlator, chapter.scanlator,
manga.title, manga.title,
manga.source manga.source,
) )
downloaded || isLocalManga downloaded || isLocalManga
} }

View file

@ -9,10 +9,6 @@ import eu.kanade.tachiyomi.animesource.model.SEpisode
import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource
import eu.kanade.tachiyomi.data.download.anime.AnimeDownloadManager import eu.kanade.tachiyomi.data.download.anime.AnimeDownloadManager
import eu.kanade.tachiyomi.data.download.anime.AnimeDownloadProvider import eu.kanade.tachiyomi.data.download.anime.AnimeDownloadProvider
import java.lang.Long.max
import java.time.ZonedDateTime
import java.util.Date
import java.util.TreeSet
import tachiyomi.data.items.episode.EpisodeSanitizer import tachiyomi.data.items.episode.EpisodeSanitizer
import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.entries.anime.model.Anime
import tachiyomi.domain.items.episode.interactor.GetEpisodeByAnimeId import tachiyomi.domain.items.episode.interactor.GetEpisodeByAnimeId
@ -25,6 +21,10 @@ import tachiyomi.domain.items.episode.repository.EpisodeRepository
import tachiyomi.domain.items.episode.service.EpisodeRecognition import tachiyomi.domain.items.episode.service.EpisodeRecognition
import tachiyomi.source.local.entries.anime.isLocal import tachiyomi.source.local.entries.anime.isLocal
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.lang.Long.max
import java.time.ZonedDateTime
import java.util.Date
import java.util.TreeSet
class SyncEpisodesWithSource( class SyncEpisodesWithSource(
private val downloadManager: AnimeDownloadManager, private val downloadManager: AnimeDownloadManager,
@ -103,7 +103,7 @@ class SyncEpisodesWithSource(
val episodeNumber = EpisodeRecognition.parseEpisodeNumber( val episodeNumber = EpisodeRecognition.parseEpisodeNumber(
anime.title, anime.title,
episode.name, episode.name,
episode.episodeNumber episode.episodeNumber,
) )
episode = episode.copy(episodeNumber = episodeNumber) episode = episode.copy(episodeNumber = episodeNumber)
@ -122,13 +122,13 @@ class SyncEpisodesWithSource(
if (shouldUpdateDbEpisode.await(dbEpisode, episode)) { if (shouldUpdateDbEpisode.await(dbEpisode, episode)) {
val shouldRenameEpisode = downloadProvider.isEpisodeDirNameChanged( val shouldRenameEpisode = downloadProvider.isEpisodeDirNameChanged(
dbEpisode, dbEpisode,
episode episode,
) && ) &&
downloadManager.isEpisodeDownloaded( downloadManager.isEpisodeDownloaded(
dbEpisode.name, dbEpisode.name,
dbEpisode.scanlator, dbEpisode.scanlator,
anime.title, anime.title,
anime.source anime.source,
) )
if (shouldRenameEpisode) { if (shouldRenameEpisode) {
@ -142,7 +142,7 @@ class SyncEpisodesWithSource(
) )
if (episode.dateUpload != 0L) { if (episode.dateUpload != 0L) {
toChangeEpisode = toChangeEpisode.copy( toChangeEpisode = toChangeEpisode.copy(
dateUpload = sourceEpisode.dateUpload dateUpload = sourceEpisode.dateUpload,
) )
} }
toChange.add(toChangeEpisode) toChange.add(toChangeEpisode)

View file

@ -2,9 +2,9 @@ package eu.kanade.domain.items.episode.model
import dataanime.Episodes import dataanime.Episodes
import eu.kanade.tachiyomi.animesource.model.SEpisode import eu.kanade.tachiyomi.animesource.model.SEpisode
import eu.kanade.tachiyomi.data.database.models.anime.Episode as DbEpisode
import eu.kanade.tachiyomi.data.database.models.anime.EpisodeImpl import eu.kanade.tachiyomi.data.database.models.anime.EpisodeImpl
import tachiyomi.domain.items.episode.model.Episode import tachiyomi.domain.items.episode.model.Episode
import eu.kanade.tachiyomi.data.database.models.anime.Episode as DbEpisode
// TODO: Remove when all deps are migrated // TODO: Remove when all deps are migrated
fun Episode.toSEpisode(): SEpisode { fun Episode.toSEpisode(): SEpisode {

View file

@ -27,7 +27,7 @@ fun List<Episode>.applyFilters(anime: Anime, downloadManager: AnimeDownloadManag
episode.name, episode.name,
episode.scanlator, episode.scanlator,
anime.title, anime.title,
anime.source anime.source,
) )
downloaded || isLocalAnime downloaded || isLocalAnime
} }

View file

@ -2,14 +2,14 @@ package eu.kanade.domain.source.anime.interactor
import eu.kanade.domain.source.service.SetMigrateSorting import eu.kanade.domain.source.service.SetMigrateSorting
import eu.kanade.domain.source.service.SourcePreferences import eu.kanade.domain.source.service.SourcePreferences
import java.text.Collator
import java.util.Collections
import java.util.Locale
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.combine
import tachiyomi.domain.source.anime.model.AnimeSource import tachiyomi.domain.source.anime.model.AnimeSource
import tachiyomi.domain.source.anime.repository.AnimeSourceRepository import tachiyomi.domain.source.anime.repository.AnimeSourceRepository
import tachiyomi.source.local.entries.anime.LocalAnimeSource import tachiyomi.source.local.entries.anime.LocalAnimeSource
import java.text.Collator
import java.util.Collections
import java.util.Locale
class GetAnimeSourcesWithFavoriteCount( class GetAnimeSourcesWithFavoriteCount(
private val repository: AnimeSourceRepository, private val repository: AnimeSourceRepository,
@ -44,7 +44,7 @@ class GetAnimeSourcesWithFavoriteCount(
b.first.isStub && a.first.isStub.not() -> 1 b.first.isStub && a.first.isStub.not() -> 1
else -> collator.compare( else -> collator.compare(
a.first.name.lowercase(locale), a.first.name.lowercase(locale),
b.first.name.lowercase(locale) b.first.name.lowercase(locale),
) )
} }
} }

View file

@ -2,11 +2,11 @@ package eu.kanade.domain.source.anime.interactor
import eu.kanade.domain.source.service.SourcePreferences import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.util.system.LocaleHelper import eu.kanade.tachiyomi.util.system.LocaleHelper
import java.util.SortedMap
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.combine
import tachiyomi.domain.source.anime.model.AnimeSource import tachiyomi.domain.source.anime.model.AnimeSource
import tachiyomi.domain.source.anime.repository.AnimeSourceRepository import tachiyomi.domain.source.anime.repository.AnimeSourceRepository
import java.util.SortedMap
class GetLanguagesWithAnimeSources( class GetLanguagesWithAnimeSources(
private val repository: AnimeSourceRepository, private val repository: AnimeSourceRepository,

View file

@ -25,7 +25,7 @@ class ToggleAnimeSource(
disabled.minus(transformedSourceIds) disabled.minus(transformedSourceIds)
} else { } else {
disabled.plus( disabled.plus(
transformedSourceIds transformedSourceIds,
) )
} }
} }

View file

@ -2,11 +2,11 @@ package eu.kanade.domain.source.manga.interactor
import eu.kanade.domain.source.service.SourcePreferences import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.util.system.LocaleHelper import eu.kanade.tachiyomi.util.system.LocaleHelper
import java.util.SortedMap
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.combine
import tachiyomi.domain.source.manga.model.Source import tachiyomi.domain.source.manga.model.Source
import tachiyomi.domain.source.manga.repository.MangaSourceRepository import tachiyomi.domain.source.manga.repository.MangaSourceRepository
import java.util.SortedMap
class GetLanguagesWithMangaSources( class GetLanguagesWithMangaSources(
private val repository: MangaSourceRepository, private val repository: MangaSourceRepository,

View file

@ -2,14 +2,14 @@ package eu.kanade.domain.source.manga.interactor
import eu.kanade.domain.source.service.SetMigrateSorting import eu.kanade.domain.source.service.SetMigrateSorting
import eu.kanade.domain.source.service.SourcePreferences import eu.kanade.domain.source.service.SourcePreferences
import java.text.Collator
import java.util.Collections
import java.util.Locale
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.combine
import tachiyomi.domain.source.manga.model.Source import tachiyomi.domain.source.manga.model.Source
import tachiyomi.domain.source.manga.repository.MangaSourceRepository import tachiyomi.domain.source.manga.repository.MangaSourceRepository
import tachiyomi.source.local.entries.manga.LocalMangaSource import tachiyomi.source.local.entries.manga.LocalMangaSource
import java.text.Collator
import java.util.Collections
import java.util.Locale
class GetMangaSourcesWithFavoriteCount( class GetMangaSourcesWithFavoriteCount(
private val repository: MangaSourceRepository, private val repository: MangaSourceRepository,
@ -44,7 +44,7 @@ class GetMangaSourcesWithFavoriteCount(
b.first.isStub && a.first.isStub.not() -> 1 b.first.isStub && a.first.isStub.not() -> 1
else -> collator.compare( else -> collator.compare(
a.first.name.lowercase(locale), a.first.name.lowercase(locale),
b.first.name.lowercase(locale) b.first.name.lowercase(locale),
) )
} }
} }

View file

@ -25,7 +25,7 @@ class ToggleMangaSource(
disabled.minus(transformedSourceIds) disabled.minus(transformedSourceIds)
} else { } else {
disabled.plus( disabled.plus(
transformedSourceIds transformedSourceIds,
) )
} }
} }

View file

@ -15,24 +15,24 @@ class SourcePreferences(
"pref_display_mode_catalogue", "pref_display_mode_catalogue",
LibraryDisplayMode.default, LibraryDisplayMode.default,
LibraryDisplayMode.Serializer::serialize, LibraryDisplayMode.Serializer::serialize,
LibraryDisplayMode.Serializer::deserialize LibraryDisplayMode.Serializer::deserialize,
) )
fun enabledLanguages() = preferenceStore.getStringSet( fun enabledLanguages() = preferenceStore.getStringSet(
"source_languages", "source_languages",
LocaleHelper.getDefaultEnabledLanguages() LocaleHelper.getDefaultEnabledLanguages(),
) )
fun showNsfwSource() = preferenceStore.getBoolean("show_nsfw_source", true) fun showNsfwSource() = preferenceStore.getBoolean("show_nsfw_source", true)
fun migrationSortingMode() = preferenceStore.getEnum( fun migrationSortingMode() = preferenceStore.getEnum(
"pref_migration_sorting", "pref_migration_sorting",
SetMigrateSorting.Mode.ALPHABETICAL SetMigrateSorting.Mode.ALPHABETICAL,
) )
fun migrationSortingDirection() = preferenceStore.getEnum( fun migrationSortingDirection() = preferenceStore.getEnum(
"pref_migration_direction", "pref_migration_direction",
SetMigrateSorting.Direction.ASCENDING SetMigrateSorting.Direction.ASCENDING,
) )
fun trustedSignatures() = preferenceStore.getStringSet("trusted_signatures", emptySet()) fun trustedSignatures() = preferenceStore.getStringSet("trusted_signatures", emptySet())
@ -53,12 +53,12 @@ class SourcePreferences(
fun hideInAnimeLibraryItems() = preferenceStore.getBoolean( fun hideInAnimeLibraryItems() = preferenceStore.getBoolean(
"browse_hide_in_anime_library_items", "browse_hide_in_anime_library_items",
false false,
) )
fun hideInMangaLibraryItems() = preferenceStore.getBoolean( fun hideInMangaLibraryItems() = preferenceStore.getBoolean(
"browse_hide_in_library_items", "browse_hide_in_library_items",
false false,
) )
// SY --> // SY -->
@ -81,7 +81,7 @@ class SourcePreferences(
fun dataSaverImageFormatJpeg() = preferenceStore.getBoolean( fun dataSaverImageFormatJpeg() = preferenceStore.getBoolean(
"data_saver_image_format_jpeg", "data_saver_image_format_jpeg",
false false,
) )
fun dataSaverServer() = preferenceStore.getString("data_saver_server", "") fun dataSaverServer() = preferenceStore.getString("data_saver_server", "")

View file

@ -36,7 +36,7 @@ class RefreshAnimeTracks(
syncEpisodeProgressWithTrack.await( syncEpisodeProgressWithTrack.await(
animeId, animeId,
track, track,
service.animeService service.animeService,
) )
} }
null null

View file

@ -1,7 +1,7 @@
package eu.kanade.domain.track.anime.model package eu.kanade.domain.track.anime.model
import eu.kanade.tachiyomi.data.database.models.anime.AnimeTrack as DbAnimeTrack
import tachiyomi.domain.track.anime.model.AnimeTrack import tachiyomi.domain.track.anime.model.AnimeTrack
import eu.kanade.tachiyomi.data.database.models.anime.AnimeTrack as DbAnimeTrack
fun AnimeTrack.copyPersonalFrom(other: AnimeTrack): AnimeTrack { fun AnimeTrack.copyPersonalFrom(other: AnimeTrack): AnimeTrack {
return this.copy( return this.copy(
@ -14,7 +14,7 @@ fun AnimeTrack.copyPersonalFrom(other: AnimeTrack): AnimeTrack {
} }
fun AnimeTrack.toDbTrack(): DbAnimeTrack = eu.kanade.tachiyomi.data.database.models.anime.AnimeTrack.create( fun AnimeTrack.toDbTrack(): DbAnimeTrack = eu.kanade.tachiyomi.data.database.models.anime.AnimeTrack.create(
syncId syncId,
).also { ).also {
it.id = id it.id = id
it.anime_id = animeId it.anime_id = animeId

View file

@ -12,8 +12,6 @@ import eu.kanade.domain.track.anime.model.toDbTrack
import eu.kanade.domain.track.anime.store.DelayedAnimeTrackingStore import eu.kanade.domain.track.anime.store.DelayedAnimeTrackingStore
import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.util.system.workManager import eu.kanade.tachiyomi.util.system.workManager
import kotlin.time.Duration.Companion.minutes
import kotlin.time.toJavaDuration
import logcat.LogPriority import logcat.LogPriority
import tachiyomi.core.util.lang.withIOContext import tachiyomi.core.util.lang.withIOContext
import tachiyomi.core.util.system.logcat import tachiyomi.core.util.system.logcat
@ -21,6 +19,8 @@ import tachiyomi.domain.track.anime.interactor.GetAnimeTracks
import tachiyomi.domain.track.anime.interactor.InsertAnimeTrack import tachiyomi.domain.track.anime.interactor.InsertAnimeTrack
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import kotlin.time.Duration.Companion.minutes
import kotlin.time.toJavaDuration
class DelayedAnimeTrackingUpdateJob(context: Context, workerParams: WorkerParameters) : class DelayedAnimeTrackingUpdateJob(context: Context, workerParams: WorkerParameters) :
CoroutineWorker(context, workerParams) { CoroutineWorker(context, workerParams) {

View file

@ -1,7 +1,7 @@
package eu.kanade.domain.track.manga.model package eu.kanade.domain.track.manga.model
import eu.kanade.tachiyomi.data.database.models.manga.MangaTrack as DbMangaTrack
import tachiyomi.domain.track.manga.model.MangaTrack import tachiyomi.domain.track.manga.model.MangaTrack
import eu.kanade.tachiyomi.data.database.models.manga.MangaTrack as DbMangaTrack
fun MangaTrack.copyPersonalFrom(other: MangaTrack): MangaTrack { fun MangaTrack.copyPersonalFrom(other: MangaTrack): MangaTrack {
return this.copy( return this.copy(
@ -14,7 +14,7 @@ fun MangaTrack.copyPersonalFrom(other: MangaTrack): MangaTrack {
} }
fun MangaTrack.toDbTrack(): DbMangaTrack = eu.kanade.tachiyomi.data.database.models.manga.MangaTrack.create( fun MangaTrack.toDbTrack(): DbMangaTrack = eu.kanade.tachiyomi.data.database.models.manga.MangaTrack.create(
syncId syncId,
).also { ).also {
it.id = id it.id = id
it.manga_id = mangaId it.manga_id = mangaId

View file

@ -12,8 +12,6 @@ import eu.kanade.domain.track.manga.model.toDbTrack
import eu.kanade.domain.track.manga.store.DelayedMangaTrackingStore import eu.kanade.domain.track.manga.store.DelayedMangaTrackingStore
import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.util.system.workManager import eu.kanade.tachiyomi.util.system.workManager
import kotlin.time.Duration.Companion.minutes
import kotlin.time.toJavaDuration
import logcat.LogPriority import logcat.LogPriority
import tachiyomi.core.util.lang.withIOContext import tachiyomi.core.util.lang.withIOContext
import tachiyomi.core.util.system.logcat import tachiyomi.core.util.system.logcat
@ -21,6 +19,8 @@ import tachiyomi.domain.track.manga.interactor.GetMangaTracks
import tachiyomi.domain.track.manga.interactor.InsertMangaTrack import tachiyomi.domain.track.manga.interactor.InsertMangaTrack
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import kotlin.time.Duration.Companion.minutes
import kotlin.time.toJavaDuration
class DelayedMangaTrackingUpdateJob(context: Context, workerParams: WorkerParameters) : class DelayedMangaTrackingUpdateJob(context: Context, workerParams: WorkerParameters) :
CoroutineWorker(context, workerParams) { CoroutineWorker(context, workerParams) {

View file

@ -27,7 +27,7 @@ class TrackPreferences(
fun showNextEpisodeAiringTime() = preferenceStore.getBoolean( fun showNextEpisodeAiringTime() = preferenceStore.getBoolean(
"show_next_episode_airing_time", "show_next_episode_airing_time",
true true,
) )
companion object { companion object {

View file

@ -6,11 +6,11 @@ import eu.kanade.domain.ui.model.TabletUiMode
import eu.kanade.domain.ui.model.ThemeMode import eu.kanade.domain.ui.model.ThemeMode
import eu.kanade.tachiyomi.util.system.DeviceUtil import eu.kanade.tachiyomi.util.system.DeviceUtil
import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable
import tachiyomi.core.preference.PreferenceStore
import tachiyomi.core.preference.getEnum
import java.text.DateFormat import java.text.DateFormat
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
import tachiyomi.core.preference.PreferenceStore
import tachiyomi.core.preference.getEnum
class UiPreferences( class UiPreferences(
private val preferenceStore: PreferenceStore, private val preferenceStore: PreferenceStore,

View file

@ -27,7 +27,7 @@ fun BaseBrowseItem(
) )
.padding( .padding(
horizontal = MaterialTheme.padding.medium, horizontal = MaterialTheme.padding.medium,
vertical = MaterialTheme.padding.small vertical = MaterialTheme.padding.small,
), ),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {

View file

@ -237,7 +237,7 @@ private fun DetailsHeader(
) )
val strippedPkgName = extension.pkgName.substringAfter( val strippedPkgName = extension.pkgName.substringAfter(
"eu.kanade.tachiyomi.animeextension." "eu.kanade.tachiyomi.animeextension.",
) )
Text( Text(

View file

@ -297,7 +297,7 @@ private fun AnimeExtensionItemContent(
Text( Text(
text = LocaleHelper.getSourceDisplayName( text = LocaleHelper.getSourceDisplayName(
extension.lang, extension.lang,
LocalContext.current LocalContext.current,
), ),
) )
} }

View file

@ -103,7 +103,7 @@ private fun AnimeSourceHeader(
modifier = modifier modifier = modifier
.padding( .padding(
horizontal = MaterialTheme.padding.medium, horizontal = MaterialTheme.padding.medium,
vertical = MaterialTheme.padding.small vertical = MaterialTheme.padding.small,
), ),
style = MaterialTheme.typography.header, style = MaterialTheme.typography.header,
) )
@ -151,7 +151,7 @@ private fun AnimeSourcePinButton(
MaterialTheme.colorScheme.primary MaterialTheme.colorScheme.primary
} else { } else {
MaterialTheme.colorScheme.onBackground.copy( MaterialTheme.colorScheme.onBackground.copy(
alpha = SecondaryItemAlpha alpha = SecondaryItemAlpha,
) )
} }
val description = if (isPinned) R.string.action_unpin else R.string.action_pin val description = if (isPinned) R.string.action_unpin else R.string.action_pin

View file

@ -104,11 +104,11 @@ private fun MigrateAnimeSourceList(
when (sortingMode) { when (sortingMode) {
SetMigrateSorting.Mode.ALPHABETICAL -> Icon( SetMigrateSorting.Mode.ALPHABETICAL -> Icon(
Icons.Outlined.SortByAlpha, Icons.Outlined.SortByAlpha,
contentDescription = stringResource(R.string.action_sort_alpha) contentDescription = stringResource(R.string.action_sort_alpha),
) )
SetMigrateSorting.Mode.TOTAL -> Icon( SetMigrateSorting.Mode.TOTAL -> Icon(
Icons.Outlined.Numbers, Icons.Outlined.Numbers,
contentDescription = stringResource(R.string.action_sort_count) contentDescription = stringResource(R.string.action_sort_count),
) )
} }
} }
@ -116,11 +116,11 @@ private fun MigrateAnimeSourceList(
when (sortingDirection) { when (sortingDirection) {
SetMigrateSorting.Direction.ASCENDING -> Icon( SetMigrateSorting.Direction.ASCENDING -> Icon(
Icons.Outlined.ArrowUpward, Icons.Outlined.ArrowUpward,
contentDescription = stringResource(R.string.action_asc) contentDescription = stringResource(R.string.action_asc),
) )
SetMigrateSorting.Direction.DESCENDING -> Icon( SetMigrateSorting.Direction.DESCENDING -> Icon(
Icons.Outlined.ArrowDownward, Icons.Outlined.ArrowDownward,
contentDescription = stringResource(R.string.action_desc) contentDescription = stringResource(R.string.action_desc),
) )
} }
} }

View file

@ -129,7 +129,7 @@ private fun AnimeExtension.getIcon(density: Int = DisplayMetrics.DENSITY_DEFAULT
value = try { value = try {
val appInfo = AnimeExtensionLoader.getAnimeExtensionPackageInfoFromPkgName( val appInfo = AnimeExtensionLoader.getAnimeExtensionPackageInfoFromPkgName(
context, context,
pkgName pkgName,
)!!.applicationInfo )!!.applicationInfo
val appResources = context.packageManager.getResourcesForApplication(appInfo) val appResources = context.packageManager.getResourcesForApplication(appInfo)
Result.Success( Result.Success(

View file

@ -298,7 +298,7 @@ private fun ExtensionItemContent(
Text( Text(
text = LocaleHelper.getSourceDisplayName( text = LocaleHelper.getSourceDisplayName(
extension.lang, extension.lang,
LocalContext.current LocalContext.current,
), ),
) )
} }

View file

@ -103,7 +103,7 @@ private fun SourceHeader(
modifier = modifier modifier = modifier
.padding( .padding(
horizontal = MaterialTheme.padding.medium, horizontal = MaterialTheme.padding.medium,
vertical = MaterialTheme.padding.small vertical = MaterialTheme.padding.small,
), ),
style = MaterialTheme.typography.header, style = MaterialTheme.typography.header,
) )
@ -151,7 +151,7 @@ private fun SourcePinButton(
MaterialTheme.colorScheme.primary MaterialTheme.colorScheme.primary
} else { } else {
MaterialTheme.colorScheme.onBackground.copy( MaterialTheme.colorScheme.onBackground.copy(
alpha = SecondaryItemAlpha alpha = SecondaryItemAlpha,
) )
} }
val description = if (isPinned) R.string.action_unpin else R.string.action_pin val description = if (isPinned) R.string.action_unpin else R.string.action_pin

View file

@ -104,11 +104,11 @@ private fun MigrateSourceList(
when (sortingMode) { when (sortingMode) {
SetMigrateSorting.Mode.ALPHABETICAL -> Icon( SetMigrateSorting.Mode.ALPHABETICAL -> Icon(
Icons.Outlined.SortByAlpha, Icons.Outlined.SortByAlpha,
contentDescription = stringResource(R.string.action_sort_alpha) contentDescription = stringResource(R.string.action_sort_alpha),
) )
SetMigrateSorting.Mode.TOTAL -> Icon( SetMigrateSorting.Mode.TOTAL -> Icon(
Icons.Outlined.Numbers, Icons.Outlined.Numbers,
contentDescription = stringResource(R.string.action_sort_count) contentDescription = stringResource(R.string.action_sort_count),
) )
} }
} }
@ -116,11 +116,11 @@ private fun MigrateSourceList(
when (sortingDirection) { when (sortingDirection) {
SetMigrateSorting.Direction.ASCENDING -> Icon( SetMigrateSorting.Direction.ASCENDING -> Icon(
Icons.Outlined.ArrowUpward, Icons.Outlined.ArrowUpward,
contentDescription = stringResource(R.string.action_asc) contentDescription = stringResource(R.string.action_asc),
) )
SetMigrateSorting.Direction.DESCENDING -> Icon( SetMigrateSorting.Direction.DESCENDING -> Icon(
Icons.Outlined.ArrowDownward, Icons.Outlined.ArrowDownward,
contentDescription = stringResource(R.string.action_desc) contentDescription = stringResource(R.string.action_desc),
) )
} }
} }

View file

@ -129,7 +129,7 @@ private fun MangaExtension.getIcon(density: Int = DisplayMetrics.DENSITY_DEFAULT
value = try { value = try {
val appInfo = MangaExtensionLoader.getMangaExtensionPackageInfoFromPkgName( val appInfo = MangaExtensionLoader.getMangaExtensionPackageInfoFromPkgName(
context, context,
pkgName pkgName,
)!!.applicationInfo )!!.applicationInfo
val appResources = context.packageManager.getResourcesForApplication(appInfo) val appResources = context.packageManager.getResourcesForApplication(appInfo)
Result.Success( Result.Success(

View file

@ -49,7 +49,7 @@ fun AnimeCategoryScreen(
categories = state.categories, categories = state.categories,
lazyListState = lazyListState, lazyListState = lazyListState,
paddingValues = contentPadding + topSmallPaddingValues + PaddingValues( paddingValues = contentPadding + topSmallPaddingValues + PaddingValues(
horizontal = MaterialTheme.padding.medium horizontal = MaterialTheme.padding.medium,
), ),
onClickRename = onClickRename, onClickRename = onClickRename,
onClickHide = onClickHide, onClickHide = onClickHide,

View file

@ -65,7 +65,7 @@ fun ChangeCategoryDialog(
TextButton(onClick = { TextButton(onClick = {
onDismissRequest() onDismissRequest()
onEditCategories() onEditCategories()
},) { }) {
Text(text = stringResource(R.string.action_edit)) Text(text = stringResource(R.string.action_edit))
} }
Spacer(modifier = Modifier.weight(1f)) Spacer(modifier = Modifier.weight(1f))

View file

@ -49,7 +49,7 @@ fun MangaCategoryScreen(
categories = state.categories, categories = state.categories,
lazyListState = lazyListState, lazyListState = lazyListState,
paddingValues = contentPadding + topSmallPaddingValues + PaddingValues( paddingValues = contentPadding + topSmallPaddingValues + PaddingValues(
horizontal = MaterialTheme.padding.medium horizontal = MaterialTheme.padding.medium,
), ),
onClickRename = onClickRename, onClickRename = onClickRename,
onClickHide = onClickHide, onClickHide = onClickHide,

View file

@ -15,9 +15,9 @@ import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import kotlin.time.Duration.Companion.seconds
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.model.Category
import kotlin.time.Duration.Companion.seconds
@Composable @Composable
fun CategoryCreateDialog( fun CategoryCreateDialog(
@ -146,7 +146,7 @@ fun CategoryDeleteDialog(
TextButton(onClick = { TextButton(onClick = {
onDelete() onDelete()
onDismissRequest() onDismissRequest()
},) { }) {
Text(text = stringResource(R.string.action_ok)) Text(text = stringResource(R.string.action_ok))
} }
}, },

View file

@ -235,7 +235,7 @@ fun AppBarActions(
Icon( Icon(
Icons.Outlined.MoreVert, Icons.Outlined.MoreVert,
contentDescription = stringResource( contentDescription = stringResource(
R.string.abc_action_menu_overflow_description R.string.abc_action_menu_overflow_description,
), ),
) )
} }
@ -327,9 +327,11 @@ fun SearchToolbar(
placeholder = { placeholder = {
Text( Text(
modifier = Modifier.secondaryItemAlpha(), modifier = Modifier.secondaryItemAlpha(),
text = (placeholderText ?: stringResource( text = (
R.string.action_search_hint placeholderText ?: stringResource(
)), R.string.action_search_hint,
)
),
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
style = MaterialTheme.typography.titleMedium.copy( style = MaterialTheme.typography.titleMedium.copy(

View file

@ -7,7 +7,6 @@ import androidx.compose.material.icons.outlined.ArrowLeft
import androidx.compose.material.icons.outlined.ArrowRight import androidx.compose.material.icons.outlined.ArrowRight
import androidx.compose.material.icons.outlined.RadioButtonChecked import androidx.compose.material.icons.outlined.RadioButtonChecked
import androidx.compose.material.icons.outlined.RadioButtonUnchecked import androidx.compose.material.icons.outlined.RadioButtonUnchecked
import androidx.compose.material3.DropdownMenu as ComposeDropdownMenu
import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
@ -24,6 +23,7 @@ import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.PopupProperties import androidx.compose.ui.window.PopupProperties
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import androidx.compose.material3.DropdownMenu as ComposeDropdownMenu
@Composable @Composable
fun DropdownMenu( fun DropdownMenu(

View file

@ -5,9 +5,9 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import eu.kanade.tachiyomi.util.lang.toRelativeString import eu.kanade.tachiyomi.util.lang.toRelativeString
import tachiyomi.presentation.core.components.ListGroupHeader
import java.text.DateFormat import java.text.DateFormat
import java.util.Date import java.util.Date
import tachiyomi.presentation.core.components.ListGroupHeader
@Composable @Composable
fun RelativeDateHeader( fun RelativeDateHeader(

View file

@ -63,10 +63,12 @@ fun TabbedDialog(
TabRow( TabRow(
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
selectedTabIndex = pagerState.currentPage, selectedTabIndex = pagerState.currentPage,
indicator = { TabIndicator( indicator = {
TabIndicator(
it[pagerState.currentPage], it[pagerState.currentPage],
pagerState.currentPageOffsetFraction pagerState.currentPageOffsetFraction,
) }, )
},
divider = {}, divider = {},
) { ) {
tabTitles.fastForEachIndexed { i, tab -> tabTitles.fastForEachIndexed { i, tab ->

View file

@ -98,10 +98,12 @@ fun TabbedScreen(
Tab( Tab(
selected = state.currentPage == index, selected = state.currentPage == index,
onClick = { scope.launch { state.animateScrollToPage(index) } }, onClick = { scope.launch { state.animateScrollToPage(index) } },
text = { TabText( text = {
TabText(
text = stringResource(tab.titleRes), text = stringResource(tab.titleRes),
badgeCount = tab.badgeNumber badgeCount = tab.badgeNumber,
) }, )
},
unselectedContentColor = MaterialTheme.colorScheme.onSurface, unselectedContentColor = MaterialTheme.colorScheme.onSurface,
) )
} }

View file

@ -35,7 +35,7 @@ fun CrashScreen(
headingText = stringResource(R.string.crash_screen_title), headingText = stringResource(R.string.crash_screen_title),
subtitleText = stringResource( subtitleText = stringResource(
R.string.crash_screen_description, R.string.crash_screen_description,
stringResource(R.string.app_name) stringResource(R.string.app_name),
), ),
acceptText = stringResource(R.string.pref_dump_crash_logs), acceptText = stringResource(R.string.pref_dump_crash_logs),
onAcceptClick = { onAcceptClick = {

View file

@ -56,13 +56,13 @@ import androidx.compose.ui.unit.dp
import eu.kanade.presentation.components.EntryDownloadDropdownMenu import eu.kanade.presentation.components.EntryDownloadDropdownMenu
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.player.settings.PlayerPreferences import eu.kanade.tachiyomi.ui.player.settings.PlayerPreferences
import kotlin.time.Duration.Companion.seconds
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import kotlin.time.Duration.Companion.seconds
@Composable @Composable
fun EntryBottomActionMenu( fun EntryBottomActionMenu(
@ -90,7 +90,7 @@ fun EntryBottomActionMenu(
modifier = modifier, modifier = modifier,
shape = MaterialTheme.shapes.large.copy( shape = MaterialTheme.shapes.large.copy(
bottomEnd = ZeroCornerSize, bottomEnd = ZeroCornerSize,
bottomStart = ZeroCornerSize bottomStart = ZeroCornerSize,
), ),
tonalElevation = 3.dp, tonalElevation = 3.dp,
) { ) {
@ -270,7 +270,7 @@ fun LibraryBottomActionMenu(
modifier = modifier, modifier = modifier,
shape = MaterialTheme.shapes.large.copy( shape = MaterialTheme.shapes.large.copy(
bottomEnd = ZeroCornerSize, bottomEnd = ZeroCornerSize,
bottomStart = ZeroCornerSize bottomStart = ZeroCornerSize,
), ),
tonalElevation = 3.dp, tonalElevation = 3.dp,
) { ) {

View file

@ -92,7 +92,7 @@ fun SetIntervalDialog(
TextButton(onClick = { TextButton(onClick = {
onValueChanged(selectedInterval) onValueChanged(selectedInterval)
onDismissRequest() onDismissRequest()
},) { }) {
Text(text = stringResource(R.string.action_ok)) Text(text = stringResource(R.string.action_ok))
} }
}, },

View file

@ -76,9 +76,6 @@ import eu.kanade.tachiyomi.ui.entries.anime.AnimeScreenModel
import eu.kanade.tachiyomi.ui.entries.anime.EpisodeItem import eu.kanade.tachiyomi.ui.entries.anime.EpisodeItem
import eu.kanade.tachiyomi.util.lang.toRelativeString import eu.kanade.tachiyomi.util.lang.toRelativeString
import eu.kanade.tachiyomi.util.system.copyToClipboard import eu.kanade.tachiyomi.util.system.copyToClipboard
import java.text.DateFormat
import java.util.Date
import java.util.concurrent.TimeUnit
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.entries.anime.model.Anime
import tachiyomi.domain.items.episode.model.Episode import tachiyomi.domain.items.episode.model.Episode
@ -92,6 +89,9 @@ import tachiyomi.presentation.core.components.material.PullRefresh
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.util.isScrolledToEnd import tachiyomi.presentation.core.util.isScrolledToEnd
import tachiyomi.presentation.core.util.isScrollingUp import tachiyomi.presentation.core.util.isScrollingUp
import java.text.DateFormat
import java.util.Date
import java.util.concurrent.TimeUnit
@Composable @Composable
fun AnimeScreen( fun AnimeScreen(
@ -651,10 +651,12 @@ fun AnimeScreenLargeImpl(
} }
Text(text = stringResource(id)) Text(text = stringResource(id))
}, },
icon = { Icon( icon = {
Icon(
imageVector = Icons.Filled.PlayArrow, imageVector = Icons.Filled.PlayArrow,
contentDescription = null contentDescription = null,
) }, )
},
onClick = onContinueWatching, onClick = onContinueWatching,
expanded = episodeListState.isScrollingUp() || episodeListState.isScrolledToEnd(), expanded = episodeListState.isScrollingUp() || episodeListState.isScrolledToEnd(),
) )
@ -886,12 +888,14 @@ private fun LazyListScope.sharedEpisodeItems(
onEpisodeItemClick( onEpisodeItemClick(
episodeItem = episodeItem, episodeItem = episodeItem,
episodes = episodes, episodes = episodes,
onToggleSelection = { onEpisodeSelected( onToggleSelection = {
onEpisodeSelected(
episodeItem, episodeItem,
!episodeItem.selected, !episodeItem.selected,
true, true,
false false,
) }, )
},
onEpisodeClicked = onEpisodeClicked, onEpisodeClicked = onEpisodeClicked,
) )
}, },

View file

@ -236,7 +236,7 @@ private fun VideoList(
listOf(episode), listOf(episode),
true, true,
it, it,
selectedVideo selectedVideo,
) )
} }
@ -254,7 +254,7 @@ private fun VideoList(
anime.id, anime.id,
episode.id, episode.id,
true, true,
selectedVideo selectedVideo,
) )
} }
}, },
@ -274,7 +274,10 @@ private fun VideoList(
ClickableRow( ClickableRow(
text = video.quality, text = video.quality,
icon = null, icon = null,
onClick = { selectedVideo = video; showAllQualities = false }, onClick = {
selectedVideo = video
showAllQualities = false
},
) )
} }
} }
@ -301,19 +304,28 @@ private fun QualityOptions(
ClickableRow( ClickableRow(
text = stringResource(R.string.action_start_download_internally), text = stringResource(R.string.action_start_download_internally),
icon = Icons.Outlined.Download, icon = Icons.Outlined.Download,
onClick = { onDownloadClicked(); closeMenu() }, onClick = {
onDownloadClicked()
closeMenu()
},
) )
ClickableRow( ClickableRow(
text = stringResource(R.string.action_start_download_externally), text = stringResource(R.string.action_start_download_externally),
icon = Icons.Outlined.SystemUpdateAlt, icon = Icons.Outlined.SystemUpdateAlt,
onClick = { onExtDownloadClicked(); closeMenu() }, onClick = {
onExtDownloadClicked()
closeMenu()
},
) )
ClickableRow( ClickableRow(
text = stringResource(R.string.action_play_externally), text = stringResource(R.string.action_play_externally),
icon = Icons.Outlined.OpenInNew, icon = Icons.Outlined.OpenInNew,
onClick = { onExtPlayerClicked(); closeMenu() }, onClick = {
onExtPlayerClicked()
closeMenu()
},
) )
} }
} }

View file

@ -123,7 +123,7 @@ fun AnimeCoverDialog(
Icon( Icon(
imageVector = Icons.Outlined.Edit, imageVector = Icons.Outlined.Edit,
contentDescription = stringResource( contentDescription = stringResource(
R.string.action_edit_cover R.string.action_edit_cover,
), ),
) )
} }

View file

@ -51,13 +51,13 @@ import androidx.compose.ui.unit.sp
import eu.kanade.presentation.entries.DotSeparatorText import eu.kanade.presentation.entries.DotSeparatorText
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.download.anime.model.AnimeDownload import eu.kanade.tachiyomi.data.download.anime.model.AnimeDownload
import kotlin.math.absoluteValue
import me.saket.swipe.SwipeableActionsBox import me.saket.swipe.SwipeableActionsBox
import me.saket.swipe.rememberSwipeableActionsState import me.saket.swipe.rememberSwipeableActionsState
import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.presentation.core.components.material.ReadItemAlpha import tachiyomi.presentation.core.components.material.ReadItemAlpha
import tachiyomi.presentation.core.components.material.SecondaryItemAlpha import tachiyomi.presentation.core.components.material.SecondaryItemAlpha
import tachiyomi.presentation.core.util.selectedBackground import tachiyomi.presentation.core.util.selectedBackground
import kotlin.math.absoluteValue
@Composable @Composable
fun AnimeEpisodeListItem( fun AnimeEpisodeListItem(
@ -157,11 +157,11 @@ fun AnimeEpisodeListItem(
Icon( Icon(
imageVector = Icons.Filled.Bookmark, imageVector = Icons.Filled.Bookmark,
contentDescription = stringResource( contentDescription = stringResource(
R.string.action_filter_bookmarked R.string.action_filter_bookmarked,
), ),
modifier = Modifier modifier = Modifier
.sizeIn( .sizeIn(
maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp } maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp },
), ),
tint = MaterialTheme.colorScheme.primary, tint = MaterialTheme.colorScheme.primary,
) )

View file

@ -81,13 +81,13 @@ import eu.kanade.presentation.entries.ItemCover
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.animesource.model.SAnime import eu.kanade.tachiyomi.animesource.model.SAnime
import eu.kanade.tachiyomi.util.system.copyToClipboard import eu.kanade.tachiyomi.util.system.copyToClipboard
import kotlin.math.absoluteValue
import kotlin.math.roundToInt
import tachiyomi.domain.entries.anime.model.Anime import tachiyomi.domain.entries.anime.model.Anime
import tachiyomi.presentation.core.components.material.TextButton import tachiyomi.presentation.core.components.material.TextButton
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.util.clickableNoIndication import tachiyomi.presentation.core.util.clickableNoIndication
import tachiyomi.presentation.core.util.secondaryItemAlpha import tachiyomi.presentation.core.util.secondaryItemAlpha
import kotlin.math.absoluteValue
import kotlin.math.roundToInt
private val whitespaceLineRegex = Regex("[\\r\\n]{2,}", setOf(RegexOption.MULTILINE)) private val whitespaceLineRegex = Regex("[\\r\\n]{2,}", setOf(RegexOption.MULTILINE))
@ -196,7 +196,7 @@ fun AnimeActionRow(
title = pluralStringResource( title = pluralStringResource(
id = R.plurals.day, id = R.plurals.day,
count = fetchInterval.absoluteValue, count = fetchInterval.absoluteValue,
fetchInterval.absoluteValue fetchInterval.absoluteValue,
), ),
icon = Icons.Default.HourglassEmpty, icon = Icons.Default.HourglassEmpty,
color = if (isUserIntervalMode) MaterialTheme.colorScheme.primary else defaultActionButtonColor, color = if (isUserIntervalMode) MaterialTheme.colorScheme.primary else defaultActionButtonColor,
@ -211,7 +211,7 @@ fun AnimeActionRow(
pluralStringResource( pluralStringResource(
id = R.plurals.num_trackers, id = R.plurals.num_trackers,
count = trackingCount, count = trackingCount,
trackingCount trackingCount,
) )
}, },
icon = if (trackingCount == 0) Icons.Outlined.Sync else Icons.Outlined.Done, icon = if (trackingCount == 0) Icons.Outlined.Sync else Icons.Outlined.Done,
@ -246,7 +246,7 @@ fun ExpandableAnimeDescription(
} }
val desc = val desc =
description.takeIf { !it.isNullOrBlank() } ?: stringResource( description.takeIf { !it.isNullOrBlank() } ?: stringResource(
R.string.description_placeholder R.string.description_placeholder,
) )
val trimmedDescription = remember(desc) { val trimmedDescription = remember(desc) {
desc desc
@ -426,7 +426,7 @@ private fun AnimeAndSourceTitlesLarge(
SAnime.COMPLETED.toLong() -> stringResource(R.string.completed) SAnime.COMPLETED.toLong() -> stringResource(R.string.completed)
SAnime.LICENSED.toLong() -> stringResource(R.string.licensed) SAnime.LICENSED.toLong() -> stringResource(R.string.licensed)
SAnime.PUBLISHING_FINISHED.toLong() -> stringResource( SAnime.PUBLISHING_FINISHED.toLong() -> stringResource(
R.string.publishing_finished R.string.publishing_finished,
) )
SAnime.CANCELLED.toLong() -> stringResource(R.string.cancelled) SAnime.CANCELLED.toLong() -> stringResource(R.string.cancelled)
SAnime.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus) SAnime.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus)
@ -561,7 +561,7 @@ private fun AnimeAndSourceTitlesSmall(
SAnime.COMPLETED.toLong() -> stringResource(R.string.completed) SAnime.COMPLETED.toLong() -> stringResource(R.string.completed)
SAnime.LICENSED.toLong() -> stringResource(R.string.licensed) SAnime.LICENSED.toLong() -> stringResource(R.string.licensed)
SAnime.PUBLISHING_FINISHED.toLong() -> stringResource( SAnime.PUBLISHING_FINISHED.toLong() -> stringResource(
R.string.publishing_finished R.string.publishing_finished,
) )
SAnime.CANCELLED.toLong() -> stringResource(R.string.cancelled) SAnime.CANCELLED.toLong() -> stringResource(R.string.cancelled)
SAnime.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus) SAnime.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus)
@ -627,7 +627,7 @@ private fun AnimeSummary(
) )
}.map { it.measure(constraints) } }.map { it.measure(constraints) }
expandedHeight = expandedPlaceable.maxByOrNull { it.height }?.height?.coerceAtLeast( expandedHeight = expandedPlaceable.maxByOrNull { it.height }?.height?.coerceAtLeast(
shrunkHeight shrunkHeight,
) ?: 0 ) ?: 0
val actualPlaceable = subcompose("description") { val actualPlaceable = subcompose("description") {
@ -652,11 +652,11 @@ private fun AnimeSummary(
Icon( Icon(
painter = rememberAnimatedVectorPainter(image, !expanded), painter = rememberAnimatedVectorPainter(image, !expanded),
contentDescription = stringResource( contentDescription = stringResource(
if (expanded) R.string.manga_info_collapse else R.string.manga_info_expand if (expanded) R.string.manga_info_collapse else R.string.manga_info_expand,
), ),
tint = MaterialTheme.colorScheme.onBackground, tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier.background( modifier = Modifier.background(
Brush.radialGradient(colors = colors.asReversed()) Brush.radialGradient(colors = colors.asReversed()),
), ),
) )
} }

View file

@ -71,8 +71,6 @@ import eu.kanade.tachiyomi.ui.entries.manga.ChapterItem
import eu.kanade.tachiyomi.ui.entries.manga.MangaScreenModel import eu.kanade.tachiyomi.ui.entries.manga.MangaScreenModel
import eu.kanade.tachiyomi.util.lang.toRelativeString import eu.kanade.tachiyomi.util.lang.toRelativeString
import eu.kanade.tachiyomi.util.system.copyToClipboard import eu.kanade.tachiyomi.util.system.copyToClipboard
import java.text.DateFormat
import java.util.Date
import tachiyomi.domain.entries.manga.model.Manga import tachiyomi.domain.entries.manga.model.Manga
import tachiyomi.domain.items.chapter.model.Chapter import tachiyomi.domain.items.chapter.model.Chapter
import tachiyomi.domain.items.service.missingItemsCount import tachiyomi.domain.items.service.missingItemsCount
@ -85,6 +83,8 @@ import tachiyomi.presentation.core.components.material.PullRefresh
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.util.isScrolledToEnd import tachiyomi.presentation.core.util.isScrolledToEnd
import tachiyomi.presentation.core.util.isScrollingUp import tachiyomi.presentation.core.util.isScrollingUp
import java.text.DateFormat
import java.util.Date
@Composable @Composable
fun MangaScreen( fun MangaScreen(
@ -593,10 +593,12 @@ fun MangaScreenLargeImpl(
} }
Text(text = stringResource(id)) Text(text = stringResource(id))
}, },
icon = { Icon( icon = {
Icon(
imageVector = Icons.Filled.PlayArrow, imageVector = Icons.Filled.PlayArrow,
contentDescription = null contentDescription = null,
) }, )
},
onClick = onContinueReading, onClick = onContinueReading,
expanded = chapterListState.isScrollingUp() || chapterListState.isScrolledToEnd(), expanded = chapterListState.isScrollingUp() || chapterListState.isScrolledToEnd(),
) )
@ -794,12 +796,14 @@ private fun LazyListScope.sharedChapterItems(
onChapterItemClick( onChapterItemClick(
chapterItem = chapterItem, chapterItem = chapterItem,
chapters = chapters, chapters = chapters,
onToggleSelection = { onChapterSelected( onToggleSelection = {
onChapterSelected(
chapterItem, chapterItem,
!chapterItem.selected, !chapterItem.selected,
true, true,
false false,
) }, )
},
onChapterClicked = onChapterClicked, onChapterClicked = onChapterClicked,
) )
}, },

View file

@ -50,13 +50,13 @@ import androidx.compose.ui.unit.sp
import eu.kanade.presentation.entries.DotSeparatorText import eu.kanade.presentation.entries.DotSeparatorText
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.download.manga.model.MangaDownload import eu.kanade.tachiyomi.data.download.manga.model.MangaDownload
import kotlin.math.absoluteValue
import me.saket.swipe.SwipeableActionsBox import me.saket.swipe.SwipeableActionsBox
import me.saket.swipe.rememberSwipeableActionsState import me.saket.swipe.rememberSwipeableActionsState
import tachiyomi.domain.library.service.LibraryPreferences import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.presentation.core.components.material.ReadItemAlpha import tachiyomi.presentation.core.components.material.ReadItemAlpha
import tachiyomi.presentation.core.components.material.SecondaryItemAlpha import tachiyomi.presentation.core.components.material.SecondaryItemAlpha
import tachiyomi.presentation.core.util.selectedBackground import tachiyomi.presentation.core.util.selectedBackground
import kotlin.math.absoluteValue
@Composable @Composable
fun MangaChapterListItem( fun MangaChapterListItem(
@ -156,11 +156,11 @@ fun MangaChapterListItem(
Icon( Icon(
imageVector = Icons.Filled.Bookmark, imageVector = Icons.Filled.Bookmark,
contentDescription = stringResource( contentDescription = stringResource(
R.string.action_filter_bookmarked R.string.action_filter_bookmarked,
), ),
modifier = Modifier modifier = Modifier
.sizeIn( .sizeIn(
maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp } maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp },
), ),
tint = MaterialTheme.colorScheme.primary, tint = MaterialTheme.colorScheme.primary,
) )

View file

@ -123,7 +123,7 @@ fun MangaCoverDialog(
Icon( Icon(
imageVector = Icons.Outlined.Edit, imageVector = Icons.Outlined.Edit,
contentDescription = stringResource( contentDescription = stringResource(
R.string.action_edit_cover R.string.action_edit_cover,
), ),
) )
} }

View file

@ -81,13 +81,13 @@ import eu.kanade.presentation.entries.ItemCover
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.util.system.copyToClipboard import eu.kanade.tachiyomi.util.system.copyToClipboard
import kotlin.math.absoluteValue
import kotlin.math.roundToInt
import tachiyomi.domain.entries.manga.model.Manga import tachiyomi.domain.entries.manga.model.Manga
import tachiyomi.presentation.core.components.material.TextButton import tachiyomi.presentation.core.components.material.TextButton
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.util.clickableNoIndication import tachiyomi.presentation.core.util.clickableNoIndication
import tachiyomi.presentation.core.util.secondaryItemAlpha import tachiyomi.presentation.core.util.secondaryItemAlpha
import kotlin.math.absoluteValue
import kotlin.math.roundToInt
private val whitespaceLineRegex = Regex("[\\r\\n]{2,}", setOf(RegexOption.MULTILINE)) private val whitespaceLineRegex = Regex("[\\r\\n]{2,}", setOf(RegexOption.MULTILINE))
@ -196,7 +196,7 @@ fun MangaActionRow(
title = pluralStringResource( title = pluralStringResource(
id = R.plurals.day, id = R.plurals.day,
count = fetchInterval.absoluteValue, count = fetchInterval.absoluteValue,
fetchInterval.absoluteValue fetchInterval.absoluteValue,
), ),
icon = Icons.Default.HourglassEmpty, icon = Icons.Default.HourglassEmpty,
color = if (isUserIntervalMode) MaterialTheme.colorScheme.primary else defaultActionButtonColor, color = if (isUserIntervalMode) MaterialTheme.colorScheme.primary else defaultActionButtonColor,
@ -211,7 +211,7 @@ fun MangaActionRow(
pluralStringResource( pluralStringResource(
id = R.plurals.num_trackers, id = R.plurals.num_trackers,
count = trackingCount, count = trackingCount,
trackingCount trackingCount,
) )
}, },
icon = if (trackingCount == 0) Icons.Outlined.Sync else Icons.Outlined.Done, icon = if (trackingCount == 0) Icons.Outlined.Sync else Icons.Outlined.Done,
@ -246,7 +246,7 @@ fun ExpandableMangaDescription(
} }
val desc = val desc =
description.takeIf { !it.isNullOrBlank() } ?: stringResource( description.takeIf { !it.isNullOrBlank() } ?: stringResource(
R.string.description_placeholder R.string.description_placeholder,
) )
val trimmedDescription = remember(desc) { val trimmedDescription = remember(desc) {
desc desc
@ -426,7 +426,7 @@ private fun MangaAndSourceTitlesLarge(
SManga.COMPLETED.toLong() -> stringResource(R.string.completed) SManga.COMPLETED.toLong() -> stringResource(R.string.completed)
SManga.LICENSED.toLong() -> stringResource(R.string.licensed) SManga.LICENSED.toLong() -> stringResource(R.string.licensed)
SManga.PUBLISHING_FINISHED.toLong() -> stringResource( SManga.PUBLISHING_FINISHED.toLong() -> stringResource(
R.string.publishing_finished R.string.publishing_finished,
) )
SManga.CANCELLED.toLong() -> stringResource(R.string.cancelled) SManga.CANCELLED.toLong() -> stringResource(R.string.cancelled)
SManga.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus) SManga.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus)
@ -561,7 +561,7 @@ private fun MangaAndSourceTitlesSmall(
SManga.COMPLETED.toLong() -> stringResource(R.string.completed) SManga.COMPLETED.toLong() -> stringResource(R.string.completed)
SManga.LICENSED.toLong() -> stringResource(R.string.licensed) SManga.LICENSED.toLong() -> stringResource(R.string.licensed)
SManga.PUBLISHING_FINISHED.toLong() -> stringResource( SManga.PUBLISHING_FINISHED.toLong() -> stringResource(
R.string.publishing_finished R.string.publishing_finished,
) )
SManga.CANCELLED.toLong() -> stringResource(R.string.cancelled) SManga.CANCELLED.toLong() -> stringResource(R.string.cancelled)
SManga.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus) SManga.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus)
@ -627,7 +627,7 @@ private fun MangaSummary(
) )
}.map { it.measure(constraints) } }.map { it.measure(constraints) }
expandedHeight = expandedPlaceable.maxByOrNull { it.height }?.height?.coerceAtLeast( expandedHeight = expandedPlaceable.maxByOrNull { it.height }?.height?.coerceAtLeast(
shrunkHeight shrunkHeight,
) ?: 0 ) ?: 0
val actualPlaceable = subcompose("description") { val actualPlaceable = subcompose("description") {
@ -652,11 +652,11 @@ private fun MangaSummary(
Icon( Icon(
painter = rememberAnimatedVectorPainter(image, !expanded), painter = rememberAnimatedVectorPainter(image, !expanded),
contentDescription = stringResource( contentDescription = stringResource(
if (expanded) R.string.manga_info_collapse else R.string.manga_info_expand if (expanded) R.string.manga_info_collapse else R.string.manga_info_expand,
), ),
tint = MaterialTheme.colorScheme.onBackground, tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier.background( modifier = Modifier.background(
Brush.radialGradient(colors = colors.asReversed()) Brush.radialGradient(colors = colors.asReversed()),
), ),
) )
} }

View file

@ -12,7 +12,7 @@ import eu.kanade.tachiyomi.util.storage.DiskUtil
@Composable @Composable
fun DiskUtil.RequestStoragePermission() { fun DiskUtil.RequestStoragePermission() {
val permissionState = rememberPermissionState( val permissionState = rememberPermissionState(
permission = Manifest.permission.WRITE_EXTERNAL_STORAGE permission = Manifest.permission.WRITE_EXTERNAL_STORAGE,
) )
LaunchedEffect(Unit) { LaunchedEffect(Unit) {
permissionState.launchPermissionRequest() permissionState.launchPermissionRequest()

View file

@ -64,7 +64,7 @@ fun HistoryDeleteDialog(
TextButton(onClick = { TextButton(onClick = {
onDelete(removeEverything) onDelete(removeEverything)
onDismissRequest() onDismissRequest()
},) { }) {
Text(text = stringResource(R.string.action_remove)) Text(text = stringResource(R.string.action_remove))
} }
}, },
@ -93,7 +93,7 @@ fun HistoryDeleteAllDialog(
TextButton(onClick = { TextButton(onClick = {
onDelete() onDelete()
onDismissRequest() onDismissRequest()
},) { }) {
Text(text = stringResource(R.string.action_ok)) Text(text = stringResource(R.string.action_ok))
} }
}, },

View file

@ -9,11 +9,11 @@ import eu.kanade.domain.ui.UiPreferences
import eu.kanade.presentation.components.RelativeDateHeader import eu.kanade.presentation.components.RelativeDateHeader
import eu.kanade.presentation.history.anime.AnimeHistoryItem import eu.kanade.presentation.history.anime.AnimeHistoryItem
import eu.kanade.presentation.history.anime.AnimeHistoryUiModel import eu.kanade.presentation.history.anime.AnimeHistoryUiModel
import java.text.DateFormat
import tachiyomi.domain.history.anime.model.AnimeHistoryWithRelations import tachiyomi.domain.history.anime.model.AnimeHistoryWithRelations
import tachiyomi.presentation.core.components.FastScrollLazyColumn import tachiyomi.presentation.core.components.FastScrollLazyColumn
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.text.DateFormat
@Composable @Composable
fun AnimeHistoryContent( fun AnimeHistoryContent(

View file

@ -43,7 +43,7 @@ fun AnimeHistoryItem(
.height(HISTORY_ITEM_HEIGHT) .height(HISTORY_ITEM_HEIGHT)
.padding( .padding(
horizontal = MaterialTheme.padding.medium, horizontal = MaterialTheme.padding.medium,
vertical = MaterialTheme.padding.small vertical = MaterialTheme.padding.small,
), ),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {

View file

@ -9,11 +9,11 @@ import androidx.compose.ui.Modifier
import eu.kanade.presentation.animehistory.components.AnimeHistoryContent import eu.kanade.presentation.animehistory.components.AnimeHistoryContent
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.history.anime.AnimeHistoryScreenModel import eu.kanade.tachiyomi.ui.history.anime.AnimeHistoryScreenModel
import java.util.Date
import tachiyomi.domain.history.anime.model.AnimeHistoryWithRelations import tachiyomi.domain.history.anime.model.AnimeHistoryWithRelations
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.LoadingScreen import tachiyomi.presentation.core.screens.LoadingScreen
import java.util.Date
@Composable @Composable
fun AnimeHistoryScreen( fun AnimeHistoryScreen(
@ -47,9 +47,11 @@ fun AnimeHistoryScreen(
contentPadding = contentPadding, contentPadding = contentPadding,
onClickCover = { history -> onClickCover(history.animeId) }, onClickCover = { history -> onClickCover(history.animeId) },
onClickResume = { history -> onClickResume(history.animeId, history.episodeId) }, onClickResume = { history -> onClickResume(history.animeId, history.episodeId) },
onClickDelete = { item -> onDialogChange( onClickDelete = { item ->
AnimeHistoryScreenModel.Dialog.Delete(item) onDialogChange(
) }, AnimeHistoryScreenModel.Dialog.Delete(item),
)
},
) )
} }
} }

View file

@ -7,11 +7,11 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import eu.kanade.domain.ui.UiPreferences import eu.kanade.domain.ui.UiPreferences
import eu.kanade.presentation.components.RelativeDateHeader import eu.kanade.presentation.components.RelativeDateHeader
import java.text.DateFormat
import tachiyomi.domain.history.manga.model.MangaHistoryWithRelations import tachiyomi.domain.history.manga.model.MangaHistoryWithRelations
import tachiyomi.presentation.core.components.FastScrollLazyColumn import tachiyomi.presentation.core.components.FastScrollLazyColumn
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.text.DateFormat
@Composable @Composable
fun MangaHistoryContent( fun MangaHistoryContent(

View file

@ -43,7 +43,7 @@ fun MangaHistoryItem(
.height(HISTORY_ITEM_HEIGHT) .height(HISTORY_ITEM_HEIGHT)
.padding( .padding(
horizontal = MaterialTheme.padding.medium, horizontal = MaterialTheme.padding.medium,
vertical = MaterialTheme.padding.small vertical = MaterialTheme.padding.small,
), ),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {

View file

@ -8,11 +8,11 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.history.manga.MangaHistoryScreenModel import eu.kanade.tachiyomi.ui.history.manga.MangaHistoryScreenModel
import java.util.Date
import tachiyomi.domain.history.manga.model.MangaHistoryWithRelations import tachiyomi.domain.history.manga.model.MangaHistoryWithRelations
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.LoadingScreen import tachiyomi.presentation.core.screens.LoadingScreen
import java.util.Date
@Composable @Composable
fun MangaHistoryScreen( fun MangaHistoryScreen(
@ -46,9 +46,11 @@ fun MangaHistoryScreen(
contentPadding = contentPadding, contentPadding = contentPadding,
onClickCover = { history -> onClickCover(history.mangaId) }, onClickCover = { history -> onClickCover(history.mangaId) },
onClickResume = { history -> onClickResume(history.mangaId, history.chapterId) }, onClickResume = { history -> onClickResume(history.mangaId, history.chapterId) },
onClickDelete = { item -> onDialogChange( onClickDelete = { item ->
MangaHistoryScreenModel.Dialog.Delete(item) onDialogChange(
) }, MangaHistoryScreenModel.Dialog.Delete(item),
)
},
) )
} }
} }

View file

@ -24,10 +24,12 @@ fun LibraryTabs(
ScrollableTabRow( ScrollableTabRow(
selectedTabIndex = pagerState.currentPage, selectedTabIndex = pagerState.currentPage,
edgePadding = 0.dp, edgePadding = 0.dp,
indicator = { TabIndicator( indicator = {
TabIndicator(
it[pagerState.currentPage], it[pagerState.currentPage],
pagerState.currentPageOffsetFraction pagerState.currentPageOffsetFraction,
) }, )
},
// TODO: use default when width is fixed upstream // TODO: use default when width is fixed upstream
// https://issuetracker.google.com/issues/242879624 // https://issuetracker.google.com/issues/242879624
divider = {}, divider = {},

View file

@ -18,13 +18,13 @@ import androidx.compose.ui.platform.LocalLayoutDirection
import eu.kanade.core.preference.PreferenceMutableState import eu.kanade.core.preference.PreferenceMutableState
import eu.kanade.presentation.library.LibraryTabs import eu.kanade.presentation.library.LibraryTabs
import eu.kanade.tachiyomi.ui.library.anime.AnimeLibraryItem import eu.kanade.tachiyomi.ui.library.anime.AnimeLibraryItem
import kotlin.time.Duration.Companion.seconds
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.model.Category
import tachiyomi.domain.library.anime.LibraryAnime import tachiyomi.domain.library.anime.LibraryAnime
import tachiyomi.domain.library.model.LibraryDisplayMode import tachiyomi.domain.library.model.LibraryDisplayMode
import tachiyomi.presentation.core.components.material.PullRefresh import tachiyomi.presentation.core.components.material.PullRefresh
import kotlin.time.Duration.Companion.seconds
@Composable @Composable
fun AnimeLibraryContent( fun AnimeLibraryContent(

View file

@ -116,7 +116,7 @@ private fun ColumnScope.FilterPage(
1 -> { 1 -> {
val service = trackServices[0] val service = trackServices[0]
val filterTracker by screenModel.libraryPreferences.filterTrackedAnime( val filterTracker by screenModel.libraryPreferences.filterTrackedAnime(
service.id.toInt() service.id.toInt(),
).collectAsState() ).collectAsState()
TriStateItem( TriStateItem(
label = stringResource(R.string.action_filter_tracked), label = stringResource(R.string.action_filter_tracked),
@ -128,7 +128,7 @@ private fun ColumnScope.FilterPage(
HeadingItem(R.string.action_filter_tracked) HeadingItem(R.string.action_filter_tracked)
trackServices.map { service -> trackServices.map { service ->
val filterTracker by screenModel.libraryPreferences.filterTrackedAnime( val filterTracker by screenModel.libraryPreferences.filterTrackedAnime(
service.id.toInt() service.id.toInt(),
).collectAsState() ).collectAsState()
TriStateItem( TriStateItem(
label = service.name, label = service.name,

View file

@ -18,13 +18,13 @@ import androidx.compose.ui.platform.LocalLayoutDirection
import eu.kanade.core.preference.PreferenceMutableState import eu.kanade.core.preference.PreferenceMutableState
import eu.kanade.presentation.library.LibraryTabs import eu.kanade.presentation.library.LibraryTabs
import eu.kanade.tachiyomi.ui.library.manga.MangaLibraryItem import eu.kanade.tachiyomi.ui.library.manga.MangaLibraryItem
import kotlin.time.Duration.Companion.seconds
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.model.Category
import tachiyomi.domain.library.manga.LibraryManga import tachiyomi.domain.library.manga.LibraryManga
import tachiyomi.domain.library.model.LibraryDisplayMode import tachiyomi.domain.library.model.LibraryDisplayMode
import tachiyomi.presentation.core.components.material.PullRefresh import tachiyomi.presentation.core.components.material.PullRefresh
import kotlin.time.Duration.Companion.seconds
@Composable @Composable
fun MangaLibraryContent( fun MangaLibraryContent(

View file

@ -116,7 +116,7 @@ private fun ColumnScope.FilterPage(
1 -> { 1 -> {
val service = trackServices[0] val service = trackServices[0]
val filterTracker by screenModel.libraryPreferences.filterTrackedManga( val filterTracker by screenModel.libraryPreferences.filterTrackedManga(
service.id.toInt() service.id.toInt(),
).collectAsState() ).collectAsState()
TriStateItem( TriStateItem(
label = stringResource(R.string.action_filter_tracked), label = stringResource(R.string.action_filter_tracked),
@ -128,7 +128,7 @@ private fun ColumnScope.FilterPage(
HeadingItem(R.string.action_filter_tracked) HeadingItem(R.string.action_filter_tracked)
trackServices.map { service -> trackServices.map { service ->
val filterTracker by screenModel.libraryPreferences.filterTrackedManga( val filterTracker by screenModel.libraryPreferences.filterTrackedManga(
service.id.toInt() service.id.toInt(),
).collectAsState() ).collectAsState()
TriStateItem( TriStateItem(
label = service.name, label = service.name,

View file

@ -63,7 +63,7 @@ fun MoreScreen(
Column( Column(
modifier = Modifier.windowInsetsPadding( modifier = Modifier.windowInsetsPadding(
WindowInsets.systemBars.only( WindowInsets.systemBars.only(
WindowInsetsSides.Top + WindowInsetsSides.Horizontal WindowInsetsSides.Top + WindowInsetsSides.Horizontal,
), ),
), ),
) { ) {
@ -72,7 +72,7 @@ fun MoreScreen(
textRes = R.string.fdroid_warning, textRes = R.string.fdroid_warning,
modifier = Modifier.clickable { modifier = Modifier.clickable {
uriHandler.openUri( uriHandler.openUri(
"https://aniyomi.org/help/faq/#how-do-i-migrate-from-the-f-droid-version" "https://aniyomi.org/help/faq/#how-do-i-migrate-from-the-f-droid-version",
) )
}, },
) )
@ -153,7 +153,7 @@ fun MoreScreen(
pluralStringResource( pluralStringResource(
id = R.plurals.download_queue_summary, id = R.plurals.download_queue_summary,
count = pending, count = pending,
pending pending,
) )
} }
}, },

View file

@ -74,7 +74,7 @@ sealed class Preference {
) : PreferenceItem<T>() { ) : PreferenceItem<T>() {
internal fun internalSet(newValue: Any) = pref.set(newValue as T) internal fun internalSet(newValue: Any) = pref.set(newValue as T)
internal suspend fun internalOnValueChanged(newValue: Any) = onValueChanged( internal suspend fun internalOnValueChanged(newValue: Any) = onValueChanged(
newValue as T newValue as T,
) )
@Composable @Composable

View file

@ -13,9 +13,9 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.fastForEachIndexed import androidx.compose.ui.util.fastForEachIndexed
import eu.kanade.presentation.more.settings.screen.SearchableSettings import eu.kanade.presentation.more.settings.screen.SearchableSettings
import eu.kanade.presentation.more.settings.widget.PreferenceGroupHeader import eu.kanade.presentation.more.settings.widget.PreferenceGroupHeader
import kotlin.time.Duration.Companion.seconds
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import tachiyomi.presentation.core.components.ScrollbarLazyColumn import tachiyomi.presentation.core.components.ScrollbarLazyColumn
import kotlin.time.Duration.Companion.seconds
/** /**
* Preference Screen composable which contains a list of [Preference] items * Preference Screen composable which contains a list of [Preference] items

View file

@ -31,9 +31,11 @@ fun getCategoriesLabel(
val includedItemsText = when { val includedItemsText = when {
// Some selected, but not all // Some selected, but not all
includedCategories.isNotEmpty() && includedCategories.size != allCategories.size -> includedCategories.joinToString { it.visualName( includedCategories.isNotEmpty() && includedCategories.size != allCategories.size -> includedCategories.joinToString {
context it.visualName(
) } context,
)
}
// All explicitly selected // All explicitly selected
includedCategories.size == allCategories.size -> stringResource(R.string.all) includedCategories.size == allCategories.size -> stringResource(R.string.all)
allExcluded -> stringResource(R.string.none) allExcluded -> stringResource(R.string.none)

View file

@ -62,7 +62,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 java.io.File
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import logcat.LogPriority import logcat.LogPriority
import okhttp3.Headers import okhttp3.Headers
@ -74,6 +73,7 @@ import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.presentation.core.util.collectAsState import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.io.File
object SettingsAdvancedScreen : SearchableSettings { object SettingsAdvancedScreen : SearchableSettings {
@ -176,7 +176,7 @@ object SettingsAdvancedScreen : SearchableSettings {
context.startActivity(intent) context.startActivity(intent)
} catch (e: ActivityNotFoundException) { } catch (e: ActivityNotFoundException) {
context.toast( context.toast(
R.string.battery_optimization_setting_activity_not_found R.string.battery_optimization_setting_activity_not_found,
) )
} }
} else { } else {
@ -214,7 +214,7 @@ object SettingsAdvancedScreen : SearchableSettings {
subtitle = stringResource( subtitle = stringResource(
R.string.used_cache_both, R.string.used_cache_both,
readableAnimeSize, readableAnimeSize,
readableSize readableSize,
), ),
onClick = { onClick = {
scope.launchNonCancellable { scope.launchNonCancellable {
@ -222,7 +222,7 @@ object SettingsAdvancedScreen : SearchableSettings {
val deletedFiles = chapterCache.clear() + episodeCache.clear() val deletedFiles = chapterCache.clear() + episodeCache.clear()
withUIContext { withUIContext {
context.toast( context.toast(
context.getString(R.string.cache_deleted, deletedFiles) context.getString(R.string.cache_deleted, deletedFiles),
) )
readableSizeSema++ readableSizeSema++
} }
@ -363,11 +363,11 @@ object SettingsAdvancedScreen : SearchableSettings {
onClick = { onClick = {
MangaLibraryUpdateJob.startNow( MangaLibraryUpdateJob.startNow(
context, context,
target = MangaLibraryUpdateJob.Target.COVERS target = MangaLibraryUpdateJob.Target.COVERS,
) )
AnimeLibraryUpdateJob.startNow( AnimeLibraryUpdateJob.startNow(
context, context,
target = AnimeLibraryUpdateJob.Target.COVERS target = AnimeLibraryUpdateJob.Target.COVERS,
) )
}, },
), ),
@ -378,11 +378,11 @@ object SettingsAdvancedScreen : SearchableSettings {
onClick = { onClick = {
MangaLibraryUpdateJob.startNow( MangaLibraryUpdateJob.startNow(
context, context,
target = MangaLibraryUpdateJob.Target.TRACKING target = MangaLibraryUpdateJob.Target.TRACKING,
) )
AnimeLibraryUpdateJob.startNow( AnimeLibraryUpdateJob.startNow(
context, context,
target = AnimeLibraryUpdateJob.Target.TRACKING target = AnimeLibraryUpdateJob.Target.TRACKING,
) )
}, },
), ),
@ -421,9 +421,11 @@ object SettingsAdvancedScreen : SearchableSettings {
AlertDialog( AlertDialog(
onDismissRequest = dismiss, onDismissRequest = dismiss,
title = { Text(text = stringResource(R.string.ext_installer_shizuku)) }, title = { Text(text = stringResource(R.string.ext_installer_shizuku)) },
text = { Text( text = {
text = stringResource(R.string.ext_installer_shizuku_unavailable_dialog) Text(
) }, text = stringResource(R.string.ext_installer_shizuku_unavailable_dialog),
)
},
dismissButton = { dismissButton = {
TextButton(onClick = dismiss) { TextButton(onClick = dismiss) {
Text(text = stringResource(R.string.action_cancel)) Text(text = stringResource(R.string.action_cancel))

View file

@ -26,7 +26,6 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.home.HomeScreen import eu.kanade.tachiyomi.ui.home.HomeScreen
import eu.kanade.tachiyomi.util.system.LocaleHelper import eu.kanade.tachiyomi.util.system.LocaleHelper
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
import java.util.Date
import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.drop import kotlinx.coroutines.flow.drop
import kotlinx.coroutines.flow.merge import kotlinx.coroutines.flow.merge
@ -35,6 +34,7 @@ import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.presentation.core.util.collectAsState import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.util.Date
object SettingsAppearanceScreen : SearchableSettings { object SettingsAppearanceScreen : SearchableSettings {
@ -122,9 +122,11 @@ object SettingsAppearanceScreen : SearchableSettings {
uiPreferences: UiPreferences, uiPreferences: UiPreferences,
): Preference.PreferenceGroup { ): Preference.PreferenceGroup {
val langs = remember { getLangs(context) } val langs = remember { getLangs(context) }
var currentLanguage by remember { mutableStateOf( var currentLanguage by remember {
AppCompatDelegate.getApplicationLocales().get(0)?.toLanguageTag() ?: "" mutableStateOf(
) } AppCompatDelegate.getApplicationLocales().get(0)?.toLanguageTag() ?: "",
)
}
val now = remember { Date().time } val now = remember { Date().time }
LaunchedEffect(currentLanguage) { LaunchedEffect(currentLanguage) {

View file

@ -199,12 +199,12 @@ object SettingsBackupScreen : SearchableSettings {
} }
if (!state.isScrolledToStart()) { if (!state.isScrolledToStart()) {
HorizontalDivider( HorizontalDivider(
modifier = Modifier.align(Alignment.TopCenter) modifier = Modifier.align(Alignment.TopCenter),
) )
} }
if (!state.isScrolledToEnd()) { if (!state.isScrolledToEnd()) {
HorizontalDivider( HorizontalDivider(
modifier = Modifier.align(Alignment.BottomCenter) modifier = Modifier.align(Alignment.BottomCenter),
) )
} }
} }
@ -291,7 +291,7 @@ object SettingsBackupScreen : SearchableSettings {
append(stringResource(R.string.backup_restore_content_full)) append(stringResource(R.string.backup_restore_content_full))
if (err.sources.isNotEmpty()) { if (err.sources.isNotEmpty()) {
append("\n\n").append( append("\n\n").append(
stringResource(R.string.backup_restore_missing_sources) stringResource(R.string.backup_restore_missing_sources),
) )
err.sources.joinTo( err.sources.joinTo(
this, this,
@ -301,7 +301,7 @@ object SettingsBackupScreen : SearchableSettings {
} }
if (err.trackers.isNotEmpty()) { if (err.trackers.isNotEmpty()) {
append("\n\n").append( append("\n\n").append(
stringResource(R.string.backup_restore_missing_trackers) stringResource(R.string.backup_restore_missing_trackers),
) )
err.trackers.joinTo( err.trackers.joinTo(
this, this,
@ -335,7 +335,7 @@ object SettingsBackupScreen : SearchableSettings {
val intent = super.createIntent(context, input) val intent = super.createIntent(context, input)
return Intent.createChooser( return Intent.createChooser(
intent, intent,
context.getString(R.string.file_select_backup) context.getString(R.string.file_select_backup),
) )
} }
}, },
@ -356,7 +356,7 @@ object SettingsBackupScreen : SearchableSettings {
error = MissingRestoreComponents( error = MissingRestoreComponents(
it, it,
results.missingSources, results.missingSources,
results.missingTrackers results.missingTrackers,
) )
} }
} }

View file

@ -53,7 +53,7 @@ object SettingsBrowseScreen : SearchableSettings {
}, },
), ),
Preference.PreferenceItem.InfoPreference( Preference.PreferenceItem.InfoPreference(
stringResource(R.string.parental_controls_info) stringResource(R.string.parental_controls_info),
), ),
), ),
), ),

View file

@ -24,7 +24,6 @@ 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 eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import java.io.File
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import tachiyomi.domain.category.anime.interactor.GetAnimeCategories import tachiyomi.domain.category.anime.interactor.GetAnimeCategories
import tachiyomi.domain.category.manga.interactor.GetMangaCategories import tachiyomi.domain.category.manga.interactor.GetMangaCategories
@ -33,6 +32,7 @@ import tachiyomi.domain.download.service.DownloadPreferences
import tachiyomi.presentation.core.util.collectAsState import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.io.File
object SettingsDownloadScreen : SearchableSettings { object SettingsDownloadScreen : SearchableSettings {
@ -45,11 +45,11 @@ object SettingsDownloadScreen : SearchableSettings {
override fun getPreferences(): List<Preference> { override fun getPreferences(): List<Preference> {
val getCategories = remember { Injekt.get<GetMangaCategories>() } val getCategories = remember { Injekt.get<GetMangaCategories>() }
val allCategories by getCategories.subscribe().collectAsState( val allCategories by getCategories.subscribe().collectAsState(
initial = runBlocking { getCategories.await() } initial = runBlocking { getCategories.await() },
) )
val getAnimeCategories = remember { Injekt.get<GetAnimeCategories>() } val getAnimeCategories = remember { Injekt.get<GetAnimeCategories>() }
val allAnimeCategories by getAnimeCategories.subscribe().collectAsState( val allAnimeCategories by getAnimeCategories.subscribe().collectAsState(
initial = runBlocking { getAnimeCategories.await() } initial = runBlocking { getAnimeCategories.await() },
) )
val downloadPreferences = remember { Injekt.get<DownloadPreferences>() } val downloadPreferences = remember { Injekt.get<DownloadPreferences>() }
@ -88,7 +88,7 @@ object SettingsDownloadScreen : SearchableSettings {
getDownloadAheadGroup(downloadPreferences = downloadPreferences), getDownloadAheadGroup(downloadPreferences = downloadPreferences),
getExternalDownloaderGroup( getExternalDownloaderGroup(
downloadPreferences = downloadPreferences, downloadPreferences = downloadPreferences,
basePreferences = basePreferences basePreferences = basePreferences,
), ),
) )
} }
@ -244,10 +244,10 @@ object SettingsDownloadScreen : SearchableSettings {
onDismissRequest = { showAnimeDialog = false }, onDismissRequest = { showAnimeDialog = false },
onValueChanged = { newIncluded, newExcluded -> onValueChanged = { newIncluded, newExcluded ->
downloadNewEpisodeCategoriesPref.set( downloadNewEpisodeCategoriesPref.set(
newIncluded.fastMap { it.id.toString() }.toSet() newIncluded.fastMap { it.id.toString() }.toSet(),
) )
downloadNewEpisodeCategoriesExcludePref.set( downloadNewEpisodeCategoriesExcludePref.set(
newExcluded.fastMap { it.id.toString() }.toSet() newExcluded.fastMap { it.id.toString() }.toSet(),
) )
showAnimeDialog = false showAnimeDialog = false
}, },
@ -274,10 +274,10 @@ object SettingsDownloadScreen : SearchableSettings {
onDismissRequest = { showDialog = false }, onDismissRequest = { showDialog = false },
onValueChanged = { newIncluded, newExcluded -> onValueChanged = { newIncluded, newExcluded ->
downloadNewChapterCategoriesPref.set( downloadNewChapterCategoriesPref.set(
newIncluded.fastMap { it.id.toString() }.toSet() newIncluded.fastMap { it.id.toString() }.toSet(),
) )
downloadNewChapterCategoriesExcludePref.set( downloadNewChapterCategoriesExcludePref.set(
newExcluded.fastMap { it.id.toString() }.toSet() newExcluded.fastMap { it.id.toString() }.toSet(),
) )
showDialog = false showDialog = false
}, },
@ -336,7 +336,7 @@ object SettingsDownloadScreen : SearchableSettings {
pluralStringResource( pluralStringResource(
id = R.plurals.next_unread_chapters, id = R.plurals.next_unread_chapters,
count = it, count = it,
it it,
) )
} }
}, },
@ -351,13 +351,13 @@ object SettingsDownloadScreen : SearchableSettings {
pluralStringResource( pluralStringResource(
id = R.plurals.next_unseen_episodes, id = R.plurals.next_unseen_episodes,
count = it, count = it,
it it,
) )
} }
}, },
), ),
Preference.PreferenceItem.InfoPreference( Preference.PreferenceItem.InfoPreference(
stringResource(R.string.download_ahead_info) stringResource(R.string.download_ahead_info),
), ),
), ),
) )
@ -366,7 +366,7 @@ object SettingsDownloadScreen : SearchableSettings {
@Composable @Composable
private fun getExternalDownloaderGroup( private fun getExternalDownloaderGroup(
downloadPreferences: DownloadPreferences, downloadPreferences: DownloadPreferences,
basePreferences: BasePreferences basePreferences: BasePreferences,
): Preference.PreferenceGroup { ): Preference.PreferenceGroup {
val useExternalDownloader = downloadPreferences.useExternalDownloader() val useExternalDownloader = downloadPreferences.useExternalDownloader()
val externalDownloaderPreference = downloadPreferences.externalDownloaderSelection() val externalDownloaderPreference = downloadPreferences.externalDownloaderSelection()

View file

@ -296,14 +296,14 @@ object SettingsLibraryScreen : SearchableSettings {
title = stringResource(R.string.pref_library_update_manga_restriction), title = stringResource(R.string.pref_library_update_manga_restriction),
entries = mapOf( entries = mapOf(
ENTRY_HAS_UNVIEWED to stringResource( ENTRY_HAS_UNVIEWED to stringResource(
R.string.pref_update_only_completely_read R.string.pref_update_only_completely_read,
), ),
ENTRY_NON_VIEWED to stringResource(R.string.pref_update_only_started), ENTRY_NON_VIEWED to stringResource(R.string.pref_update_only_started),
ENTRY_NON_COMPLETED to stringResource( ENTRY_NON_COMPLETED to stringResource(
R.string.pref_update_only_non_completed R.string.pref_update_only_non_completed,
), ),
ENTRY_OUTSIDE_RELEASE_PERIOD to stringResource( ENTRY_OUTSIDE_RELEASE_PERIOD to stringResource(
R.string.pref_update_only_in_release_period R.string.pref_update_only_in_release_period,
), ),
), ),
), ),
@ -327,16 +327,16 @@ object SettingsLibraryScreen : SearchableSettings {
title = stringResource(R.string.pref_chapter_swipe_start), title = stringResource(R.string.pref_chapter_swipe_start),
entries = mapOf( entries = mapOf(
LibraryPreferences.ChapterSwipeAction.Disabled to stringResource( LibraryPreferences.ChapterSwipeAction.Disabled to stringResource(
R.string.action_disable R.string.action_disable,
), ),
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to stringResource( LibraryPreferences.ChapterSwipeAction.ToggleBookmark to stringResource(
R.string.action_bookmark R.string.action_bookmark,
), ),
LibraryPreferences.ChapterSwipeAction.ToggleRead to stringResource( LibraryPreferences.ChapterSwipeAction.ToggleRead to stringResource(
R.string.action_mark_as_read R.string.action_mark_as_read,
), ),
LibraryPreferences.ChapterSwipeAction.Download to stringResource( LibraryPreferences.ChapterSwipeAction.Download to stringResource(
R.string.action_download R.string.action_download,
), ),
), ),
), ),
@ -345,16 +345,16 @@ object SettingsLibraryScreen : SearchableSettings {
title = stringResource(R.string.pref_chapter_swipe_end), title = stringResource(R.string.pref_chapter_swipe_end),
entries = mapOf( entries = mapOf(
LibraryPreferences.ChapterSwipeAction.Disabled to stringResource( LibraryPreferences.ChapterSwipeAction.Disabled to stringResource(
R.string.action_disable R.string.action_disable,
), ),
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to stringResource( LibraryPreferences.ChapterSwipeAction.ToggleBookmark to stringResource(
R.string.action_bookmark R.string.action_bookmark,
), ),
LibraryPreferences.ChapterSwipeAction.ToggleRead to stringResource( LibraryPreferences.ChapterSwipeAction.ToggleRead to stringResource(
R.string.action_mark_as_read R.string.action_mark_as_read,
), ),
LibraryPreferences.ChapterSwipeAction.Download to stringResource( LibraryPreferences.ChapterSwipeAction.Download to stringResource(
R.string.action_download R.string.action_download,
), ),
), ),
), ),
@ -374,16 +374,16 @@ object SettingsLibraryScreen : SearchableSettings {
title = stringResource(R.string.pref_episode_swipe_start), title = stringResource(R.string.pref_episode_swipe_start),
entries = mapOf( entries = mapOf(
LibraryPreferences.EpisodeSwipeAction.Disabled to stringResource( LibraryPreferences.EpisodeSwipeAction.Disabled to stringResource(
R.string.action_disable R.string.action_disable,
), ),
LibraryPreferences.EpisodeSwipeAction.ToggleBookmark to stringResource( LibraryPreferences.EpisodeSwipeAction.ToggleBookmark to stringResource(
R.string.action_bookmark_episode R.string.action_bookmark_episode,
), ),
LibraryPreferences.EpisodeSwipeAction.ToggleSeen to stringResource( LibraryPreferences.EpisodeSwipeAction.ToggleSeen to stringResource(
R.string.action_mark_as_seen R.string.action_mark_as_seen,
), ),
LibraryPreferences.EpisodeSwipeAction.Download to stringResource( LibraryPreferences.EpisodeSwipeAction.Download to stringResource(
R.string.action_download R.string.action_download,
), ),
), ),
), ),
@ -392,16 +392,16 @@ object SettingsLibraryScreen : SearchableSettings {
title = stringResource(R.string.pref_episode_swipe_end), title = stringResource(R.string.pref_episode_swipe_end),
entries = mapOf( entries = mapOf(
LibraryPreferences.EpisodeSwipeAction.Disabled to stringResource( LibraryPreferences.EpisodeSwipeAction.Disabled to stringResource(
R.string.action_disable R.string.action_disable,
), ),
LibraryPreferences.EpisodeSwipeAction.ToggleBookmark to stringResource( LibraryPreferences.EpisodeSwipeAction.ToggleBookmark to stringResource(
R.string.action_bookmark_episode R.string.action_bookmark_episode,
), ),
LibraryPreferences.EpisodeSwipeAction.ToggleSeen to stringResource( LibraryPreferences.EpisodeSwipeAction.ToggleSeen to stringResource(
R.string.action_mark_as_seen R.string.action_mark_as_seen,
), ),
LibraryPreferences.EpisodeSwipeAction.Download to stringResource( LibraryPreferences.EpisodeSwipeAction.Download to stringResource(
R.string.action_download R.string.action_download,
), ),
), ),
), ),

View file

@ -40,7 +40,6 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.core.graphics.ColorUtils import androidx.core.graphics.ColorUtils
import cafe.adriel.voyager.core.screen.Screen as VoyagerScreen
import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.Navigator import cafe.adriel.voyager.navigator.Navigator
import cafe.adriel.voyager.navigator.currentOrThrow import cafe.adriel.voyager.navigator.currentOrThrow
@ -53,6 +52,7 @@ import eu.kanade.presentation.util.LocalBackPress
import eu.kanade.presentation.util.Screen import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import cafe.adriel.voyager.core.screen.Screen as VoyagerScreen
object SettingsMainScreen : Screen() { object SettingsMainScreen : Screen() {
@Composable @Composable
@ -147,7 +147,7 @@ object SettingsMainScreen : Screen() {
.then( .then(
if (selected) { if (selected) {
Modifier.background( Modifier.background(
MaterialTheme.colorScheme.surfaceVariant MaterialTheme.colorScheme.surfaceVariant,
) )
} else { } else {
Modifier Modifier
@ -250,7 +250,7 @@ object SettingsMainScreen : Screen() {
subtitleRes = 0, subtitleRes = 0,
formatSubtitle = { formatSubtitle = {
"${stringResource(R.string.app_name)} ${AboutScreen.getVersionName( "${stringResource(R.string.app_name)} ${AboutScreen.getVersionName(
withBuildDate = false withBuildDate = false,
)}" )}"
}, },
icon = Icons.Outlined.Info, icon = Icons.Outlined.Info,

View file

@ -79,7 +79,7 @@ object SettingsPlayerScreen : SearchableSettings {
if (deviceSupportsPip) getPipGroup(playerPreferences = playerPreferences) else null, if (deviceSupportsPip) getPipGroup(playerPreferences = playerPreferences) else null,
getExternalPlayerGroup( getExternalPlayerGroup(
playerPreferences = playerPreferences, playerPreferences = playerPreferences,
basePreferences = basePreferences basePreferences = basePreferences,
), ),
) )
} }
@ -151,25 +151,25 @@ object SettingsPlayerScreen : SearchableSettings {
title = stringResource(R.string.pref_default_player_orientation), title = stringResource(R.string.pref_default_player_orientation),
entries = mapOf( entries = mapOf(
ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR to stringResource( ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR to stringResource(
R.string.rotation_free R.string.rotation_free,
), ),
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT to stringResource( ActivityInfo.SCREEN_ORIENTATION_PORTRAIT to stringResource(
R.string.rotation_portrait R.string.rotation_portrait,
), ),
ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT to stringResource( ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT to stringResource(
R.string.rotation_reverse_portrait R.string.rotation_reverse_portrait,
), ),
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE to stringResource( ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE to stringResource(
R.string.rotation_landscape R.string.rotation_landscape,
), ),
ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE to stringResource( ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE to stringResource(
R.string.rotation_reverse_landscape R.string.rotation_reverse_landscape,
), ),
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT to stringResource( ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT to stringResource(
R.string.rotation_sensor_portrait R.string.rotation_sensor_portrait,
), ),
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE to stringResource( ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE to stringResource(
R.string.rotation_sensor_landscape R.string.rotation_sensor_landscape,
), ),
), ),
), ),
@ -182,13 +182,13 @@ object SettingsPlayerScreen : SearchableSettings {
title = stringResource(R.string.pref_default_portrait_orientation), title = stringResource(R.string.pref_default_portrait_orientation),
entries = mapOf( entries = mapOf(
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT to stringResource( ActivityInfo.SCREEN_ORIENTATION_PORTRAIT to stringResource(
R.string.rotation_portrait R.string.rotation_portrait,
), ),
ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT to stringResource( ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT to stringResource(
R.string.rotation_reverse_portrait R.string.rotation_reverse_portrait,
), ),
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT to stringResource( ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT to stringResource(
R.string.rotation_sensor_portrait R.string.rotation_sensor_portrait,
), ),
), ),
), ),
@ -197,13 +197,13 @@ object SettingsPlayerScreen : SearchableSettings {
title = stringResource(R.string.pref_default_landscape_orientation), title = stringResource(R.string.pref_default_landscape_orientation),
entries = mapOf( entries = mapOf(
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE to stringResource( ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE to stringResource(
R.string.rotation_landscape R.string.rotation_landscape,
), ),
ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE to stringResource( ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE to stringResource(
R.string.rotation_reverse_landscape R.string.rotation_reverse_landscape,
), ),
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE to stringResource( ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE to stringResource(
R.string.rotation_sensor_landscape R.string.rotation_sensor_landscape,
), ),
), ),
), ),
@ -340,7 +340,7 @@ object SettingsPlayerScreen : SearchableSettings {
@Composable @Composable
private fun getExternalPlayerGroup( private fun getExternalPlayerGroup(
playerPreferences: PlayerPreferences, playerPreferences: PlayerPreferences,
basePreferences: BasePreferences basePreferences: BasePreferences,
): Preference.PreferenceGroup { ): Preference.PreferenceGroup {
val alwaysUseExternalPlayer = playerPreferences.alwaysUseExternalPlayer() val alwaysUseExternalPlayer = playerPreferences.alwaysUseExternalPlayer()
val externalPlayerPreference = playerPreferences.externalPlayerPreference() val externalPlayerPreference = playerPreferences.externalPlayerPreference()

View file

@ -14,10 +14,10 @@ import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType
import eu.kanade.tachiyomi.util.system.isReleaseBuildType import eu.kanade.tachiyomi.util.system.isReleaseBuildType
import java.text.NumberFormat
import tachiyomi.presentation.core.util.collectAsState import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.text.NumberFormat
object SettingsReaderScreen : SearchableSettings { object SettingsReaderScreen : SearchableSettings {
@ -177,13 +177,13 @@ object SettingsReaderScreen : SearchableSettings {
entries = mapOf( entries = mapOf(
ReaderPreferences.TappingInvertMode.NONE to stringResource(R.string.none), ReaderPreferences.TappingInvertMode.NONE to stringResource(R.string.none),
ReaderPreferences.TappingInvertMode.HORIZONTAL to stringResource( ReaderPreferences.TappingInvertMode.HORIZONTAL to stringResource(
R.string.tapping_inverted_horizontal R.string.tapping_inverted_horizontal,
), ),
ReaderPreferences.TappingInvertMode.VERTICAL to stringResource( ReaderPreferences.TappingInvertMode.VERTICAL to stringResource(
R.string.tapping_inverted_vertical R.string.tapping_inverted_vertical,
), ),
ReaderPreferences.TappingInvertMode.BOTH to stringResource( ReaderPreferences.TappingInvertMode.BOTH to stringResource(
R.string.tapping_inverted_both R.string.tapping_inverted_both,
), ),
), ),
enabled = navMode != 5, enabled = navMode != 5,
@ -275,13 +275,13 @@ object SettingsReaderScreen : SearchableSettings {
entries = mapOf( entries = mapOf(
ReaderPreferences.TappingInvertMode.NONE to stringResource(R.string.none), ReaderPreferences.TappingInvertMode.NONE to stringResource(R.string.none),
ReaderPreferences.TappingInvertMode.HORIZONTAL to stringResource( ReaderPreferences.TappingInvertMode.HORIZONTAL to stringResource(
R.string.tapping_inverted_horizontal R.string.tapping_inverted_horizontal,
), ),
ReaderPreferences.TappingInvertMode.VERTICAL to stringResource( ReaderPreferences.TappingInvertMode.VERTICAL to stringResource(
R.string.tapping_inverted_vertical R.string.tapping_inverted_vertical,
), ),
ReaderPreferences.TappingInvertMode.BOTH to stringResource( ReaderPreferences.TappingInvertMode.BOTH to stringResource(
R.string.tapping_inverted_both R.string.tapping_inverted_both,
), ),
), ),
enabled = navMode != 5, enabled = navMode != 5,
@ -302,16 +302,16 @@ object SettingsReaderScreen : SearchableSettings {
title = stringResource(R.string.pref_hide_threshold), title = stringResource(R.string.pref_hide_threshold),
entries = mapOf( entries = mapOf(
ReaderPreferences.ReaderHideThreshold.HIGHEST to stringResource( ReaderPreferences.ReaderHideThreshold.HIGHEST to stringResource(
R.string.pref_highest R.string.pref_highest,
), ),
ReaderPreferences.ReaderHideThreshold.HIGH to stringResource( ReaderPreferences.ReaderHideThreshold.HIGH to stringResource(
R.string.pref_high R.string.pref_high,
), ),
ReaderPreferences.ReaderHideThreshold.LOW to stringResource( ReaderPreferences.ReaderHideThreshold.LOW to stringResource(
R.string.pref_low R.string.pref_low,
), ),
ReaderPreferences.ReaderHideThreshold.LOWEST to stringResource( ReaderPreferences.ReaderHideThreshold.LOWEST to stringResource(
R.string.pref_lowest R.string.pref_lowest,
), ),
), ),
), ),

View file

@ -48,7 +48,6 @@ import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import cafe.adriel.voyager.core.screen.Screen as VoyagerScreen
import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.presentation.components.UpIcon import eu.kanade.presentation.components.UpIcon
@ -58,6 +57,7 @@ import eu.kanade.tachiyomi.R
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.util.runOnEnterKeyPressed import tachiyomi.presentation.core.util.runOnEnterKeyPressed
import cafe.adriel.voyager.core.screen.Screen as VoyagerScreen
class SettingsSearchScreen : Screen() { class SettingsSearchScreen : Screen() {
@Composable @Composable
@ -87,9 +87,11 @@ class SettingsSearchScreen : Screen() {
focusRequester.requestFocus() focusRequester.requestFocus()
} }
var textFieldValue by rememberSaveable(stateSaver = TextFieldValue.Saver) { mutableStateOf( var textFieldValue by rememberSaveable(stateSaver = TextFieldValue.Saver) {
TextFieldValue() mutableStateOf(
) } TextFieldValue(),
)
}
Scaffold( Scaffold(
topBar = { topBar = {
Column { Column {
@ -115,7 +117,7 @@ class SettingsSearchScreen : Screen() {
singleLine = true, singleLine = true,
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search), keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search),
keyboardActions = KeyboardActions( keyboardActions = KeyboardActions(
onSearch = { focusManager.clearFocus() } onSearch = { focusManager.clearFocus() },
), ),
cursorBrush = SolidColor(MaterialTheme.colorScheme.primary), cursorBrush = SolidColor(MaterialTheme.colorScheme.primary),
decorationBox = { decorationBox = {
@ -208,7 +210,7 @@ private fun SearchResult(
breadcrumbs = getLocalizedBreadcrumb( breadcrumbs = getLocalizedBreadcrumb(
path = settingsData.title, path = settingsData.title,
node = categoryTitle, node = categoryTitle,
isLtr = isLtr isLtr = isLtr,
), ),
highlightKey = p.title, highlightKey = p.title,
) )

View file

@ -57,7 +57,7 @@ object SettingsSecurityScreen : SearchableSettings {
else -> pluralStringResource( else -> pluralStringResource(
id = R.plurals.lock_after_mins, id = R.plurals.lock_after_mins,
count = it, count = it,
it it,
) )
} }
}, },

View file

@ -139,19 +139,23 @@ object SettingsTrackingScreen : SearchableSettings {
Preference.PreferenceItem.TrackingPreference( Preference.PreferenceItem.TrackingPreference(
title = trackManager.myAnimeList.name, title = trackManager.myAnimeList.name,
service = trackManager.myAnimeList, service = trackManager.myAnimeList,
login = { context.openInBrowser( login = {
context.openInBrowser(
MyAnimeListApi.authUrl(), MyAnimeListApi.authUrl(),
forceDefaultBrowser = true forceDefaultBrowser = true,
) }, )
},
logout = { dialog = LogoutDialog(trackManager.myAnimeList) }, logout = { dialog = LogoutDialog(trackManager.myAnimeList) },
), ),
Preference.PreferenceItem.TrackingPreference( Preference.PreferenceItem.TrackingPreference(
title = trackManager.aniList.name, title = trackManager.aniList.name,
service = trackManager.aniList, service = trackManager.aniList,
login = { context.openInBrowser( login = {
context.openInBrowser(
AnilistApi.authUrl(), AnilistApi.authUrl(),
forceDefaultBrowser = true forceDefaultBrowser = true,
) }, )
},
logout = { dialog = LogoutDialog(trackManager.aniList) }, logout = { dialog = LogoutDialog(trackManager.aniList) },
), ),
Preference.PreferenceItem.TrackingPreference( Preference.PreferenceItem.TrackingPreference(
@ -169,28 +173,34 @@ object SettingsTrackingScreen : SearchableSettings {
Preference.PreferenceItem.TrackingPreference( Preference.PreferenceItem.TrackingPreference(
title = trackManager.shikimori.name, title = trackManager.shikimori.name,
service = trackManager.shikimori, service = trackManager.shikimori,
login = { context.openInBrowser( login = {
context.openInBrowser(
ShikimoriApi.authUrl(), ShikimoriApi.authUrl(),
forceDefaultBrowser = true forceDefaultBrowser = true,
) }, )
},
logout = { dialog = LogoutDialog(trackManager.shikimori) }, logout = { dialog = LogoutDialog(trackManager.shikimori) },
), ),
Preference.PreferenceItem.TrackingPreference( Preference.PreferenceItem.TrackingPreference(
title = trackManager.simkl.name, title = trackManager.simkl.name,
service = trackManager.simkl, service = trackManager.simkl,
login = { context.openInBrowser( login = {
context.openInBrowser(
SimklApi.authUrl(), SimklApi.authUrl(),
forceDefaultBrowser = true forceDefaultBrowser = true,
) }, )
},
logout = { dialog = LogoutDialog(trackManager.simkl) }, logout = { dialog = LogoutDialog(trackManager.simkl) },
), ),
Preference.PreferenceItem.TrackingPreference( Preference.PreferenceItem.TrackingPreference(
title = trackManager.bangumi.name, title = trackManager.bangumi.name,
service = trackManager.bangumi, service = trackManager.bangumi,
login = { context.openInBrowser( login = {
context.openInBrowser(
BangumiApi.authUrl(), BangumiApi.authUrl(),
forceDefaultBrowser = true forceDefaultBrowser = true,
) }, )
},
logout = { dialog = LogoutDialog(trackManager.bangumi) }, logout = { dialog = LogoutDialog(trackManager.bangumi) },
), ),
Preference.PreferenceItem.InfoPreference(stringResource(R.string.tracking_info)), Preference.PreferenceItem.InfoPreference(stringResource(R.string.tracking_info)),

View file

@ -42,10 +42,6 @@ import eu.kanade.tachiyomi.util.CrashLogUtil
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.toast import eu.kanade.tachiyomi.util.system.toast
import java.text.DateFormat
import java.text.SimpleDateFormat
import java.util.Locale
import java.util.TimeZone
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import logcat.LogPriority import logcat.LogPriority
import tachiyomi.core.util.lang.withIOContext import tachiyomi.core.util.lang.withIOContext
@ -57,6 +53,10 @@ import tachiyomi.presentation.core.components.ScrollbarLazyColumn
import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.Scaffold
import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get import uy.kohesive.injekt.api.get
import java.text.DateFormat
import java.text.SimpleDateFormat
import java.util.Locale
import java.util.TimeZone
object AboutScreen : Screen() { object AboutScreen : Screen() {
@ -147,9 +147,11 @@ object AboutScreen : Screen() {
item { item {
TextPreferenceWidget( TextPreferenceWidget(
title = stringResource(R.string.help_translate), title = stringResource(R.string.help_translate),
onPreferenceClick = { uriHandler.openUri( onPreferenceClick = {
"https://aniyomi.org/help/contribution/#translation" uriHandler.openUri(
) }, "https://aniyomi.org/help/contribution/#translation",
)
},
) )
} }
@ -211,10 +213,14 @@ object AboutScreen : Screen() {
val updateChecker = AppUpdateChecker() val updateChecker = AppUpdateChecker()
withUIContext { withUIContext {
try { try {
when (val result = withIOContext { updateChecker.checkForUpdate( when (
val result = withIOContext {
updateChecker.checkForUpdate(
context, context,
forceCheck = true forceCheck = true,
) }) { )
}
) {
is GetApplicationRelease.Result.NewUpdate -> { is GetApplicationRelease.Result.NewUpdate -> {
onAvailableUpdate(result) onAvailableUpdate(result)
} }
@ -278,7 +284,7 @@ object AboutScreen : Screen() {
outputDf.timeZone = TimeZone.getDefault() outputDf.timeZone = TimeZone.getDefault()
buildTime!!.toDateTimestampString( buildTime!!.toDateTimestampString(
UiPreferences.dateFormat(Injekt.get<UiPreferences>().dateFormat().get()) UiPreferences.dateFormat(Injekt.get<UiPreferences>().dateFormat().get()),
) )
} catch (e: Exception) { } catch (e: Exception) {
BuildConfig.BUILD_TIME BuildConfig.BUILD_TIME

View file

@ -144,9 +144,11 @@ class ClearAnimeDatabaseScreen : Screen() {
source = sourceWithCount.source, source = sourceWithCount.source,
count = sourceWithCount.count, count = sourceWithCount.count,
isSelected = s.selection.contains(sourceWithCount.id), isSelected = s.selection.contains(sourceWithCount.id),
onClickSelect = { model.toggleSelection( onClickSelect = {
sourceWithCount.source model.toggleSelection(
) }, sourceWithCount.source,
)
},
) )
} }
} }
@ -208,7 +210,7 @@ class ClearAnimeDatabaseScreen : Screen() {
} }
private class ClearAnimeDatabaseScreenModel : StateScreenModel<ClearAnimeDatabaseScreenModel.State>( private class ClearAnimeDatabaseScreenModel : StateScreenModel<ClearAnimeDatabaseScreenModel.State>(
State.Loading State.Loading,
) { ) {
private val getSourcesWithNonLibraryAnime: GetAnimeSourcesWithNonLibraryAnime = Injekt.get() private val getSourcesWithNonLibraryAnime: GetAnimeSourcesWithNonLibraryAnime = Injekt.get()
private val database: AnimeDatabase = Injekt.get() private val database: AnimeDatabase = Injekt.get()

View file

@ -144,9 +144,11 @@ class ClearDatabaseScreen : Screen() {
source = sourceWithCount.source, source = sourceWithCount.source,
count = sourceWithCount.count, count = sourceWithCount.count,
isSelected = s.selection.contains(sourceWithCount.id), isSelected = s.selection.contains(sourceWithCount.id),
onClickSelect = { model.toggleSelection( onClickSelect = {
sourceWithCount.source model.toggleSelection(
) }, sourceWithCount.source,
)
},
) )
} }
} }
@ -208,7 +210,7 @@ class ClearDatabaseScreen : Screen() {
} }
private class ClearDatabaseScreenModel : StateScreenModel<ClearDatabaseScreenModel.State>( private class ClearDatabaseScreenModel : StateScreenModel<ClearDatabaseScreenModel.State>(
State.Loading State.Loading,
) { ) {
private val getSourcesWithNonLibraryManga: GetMangaSourcesWithNonLibraryManga = Injekt.get() private val getSourcesWithNonLibraryManga: GetMangaSourcesWithNonLibraryManga = Injekt.get()
private val database: Database = Injekt.get() private val database: Database = Injekt.get()

View file

@ -39,9 +39,11 @@ class BackupSchemaScreen : Screen() {
val context = LocalContext.current val context = LocalContext.current
val navigator = LocalNavigator.currentOrThrow val navigator = LocalNavigator.currentOrThrow
val schema = remember { ProtoBufSchemaGenerator.generateSchemaText( val schema = remember {
Backup.serializer().descriptor ProtoBufSchemaGenerator.generateSchemaText(
) } Backup.serializer().descriptor,
)
}
Scaffold( Scaffold(
topBar = { topBar = {

View file

@ -77,7 +77,7 @@ class WorkerInfoScreen : Screen() {
onClick = { onClick = {
context.copyToClipboard( context.copyToClipboard(
title, title,
enqueued + finished + running enqueued + finished + running,
) )
}, },
), ),
@ -130,8 +130,8 @@ class WorkerInfoScreen : Screen() {
WorkQuery.fromStates( WorkQuery.fromStates(
WorkInfo.State.SUCCEEDED, WorkInfo.State.SUCCEEDED,
WorkInfo.State.FAILED, WorkInfo.State.FAILED,
WorkInfo.State.CANCELLED WorkInfo.State.CANCELLED,
) ),
) )
.asFlow() .asFlow()
.map(::constructString) .map(::constructString)

View file

@ -32,8 +32,8 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import eu.kanade.presentation.more.settings.LocalPreferenceHighlighted import eu.kanade.presentation.more.settings.LocalPreferenceHighlighted
import eu.kanade.presentation.more.settings.LocalPreferenceMinHeight import eu.kanade.presentation.more.settings.LocalPreferenceMinHeight
import kotlin.time.Duration.Companion.seconds
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlin.time.Duration.Companion.seconds
@Composable @Composable
internal fun BasePreferenceWidget( internal fun BasePreferenceWidget(

View file

@ -71,12 +71,12 @@ fun <T> ListPreferenceWidget(
} }
if (!state.isScrolledToStart()) { if (!state.isScrolledToStart()) {
HorizontalDivider( HorizontalDivider(
modifier = Modifier.align(Alignment.TopCenter) modifier = Modifier.align(Alignment.TopCenter),
) )
} }
if (!state.isScrolledToEnd()) { if (!state.isScrolledToEnd()) {
HorizontalDivider( HorizontalDivider(
modifier = Modifier.align(Alignment.BottomCenter) modifier = Modifier.align(Alignment.BottomCenter),
) )
} }
} }

View file

@ -117,12 +117,12 @@ fun <T> TriStateListDialog(
if (!listState.isScrolledToStart()) { if (!listState.isScrolledToStart()) {
HorizontalDivider( HorizontalDivider(
modifier = Modifier.align(Alignment.TopCenter) modifier = Modifier.align(Alignment.TopCenter),
) )
} }
if (!listState.isScrolledToEnd()) { if (!listState.isScrolledToEnd()) {
HorizontalDivider( HorizontalDivider(
modifier = Modifier.align(Alignment.BottomCenter) modifier = Modifier.align(Alignment.BottomCenter),
) )
} }
} }

View file

@ -20,10 +20,10 @@ import eu.kanade.presentation.more.stats.components.StatsSection
import eu.kanade.presentation.more.stats.data.StatsData import eu.kanade.presentation.more.stats.data.StatsData
import eu.kanade.presentation.util.toDurationString import eu.kanade.presentation.util.toDurationString
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import tachiyomi.presentation.core.components.material.padding
import java.util.Locale import java.util.Locale
import kotlin.time.DurationUnit import kotlin.time.DurationUnit
import kotlin.time.toDuration import kotlin.time.toDuration
import tachiyomi.presentation.core.components.material.padding
@Composable @Composable
fun AnimeStatsScreenContent( fun AnimeStatsScreenContent(

View file

@ -20,10 +20,10 @@ import eu.kanade.presentation.more.stats.components.StatsSection
import eu.kanade.presentation.more.stats.data.StatsData import eu.kanade.presentation.more.stats.data.StatsData
import eu.kanade.presentation.util.toDurationString import eu.kanade.presentation.util.toDurationString
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import tachiyomi.presentation.core.components.material.padding
import java.util.Locale import java.util.Locale
import kotlin.time.DurationUnit import kotlin.time.DurationUnit
import kotlin.time.toDuration import kotlin.time.toDuration
import tachiyomi.presentation.core.components.material.padding
@Composable @Composable
fun MangaStatsScreenContent( fun MangaStatsScreenContent(

View file

@ -19,10 +19,10 @@ import androidx.compose.ui.tooling.preview.Devices
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import eu.kanade.presentation.util.isTabletUi import eu.kanade.presentation.util.isTabletUi
import kotlin.random.Random
import tachiyomi.domain.category.model.Category import tachiyomi.domain.category.model.Category
import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.screens.LoadingScreen import tachiyomi.presentation.core.screens.LoadingScreen
import kotlin.random.Random
@Composable @Composable
fun StorageScreenContent( fun StorageScreenContent(

View file

@ -55,7 +55,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickCropBorder) { IconButton(onClick = onClickCropBorder) {
Icon( Icon(
painter = painterResource( painter = painterResource(
if (cropEnabled) R.drawable.ic_crop_24dp else R.drawable.ic_crop_off_24dp if (cropEnabled) R.drawable.ic_crop_24dp else R.drawable.ic_crop_off_24dp,
), ),
contentDescription = stringResource(R.string.pref_crop_borders), contentDescription = stringResource(R.string.pref_crop_borders),
) )

View file

@ -78,7 +78,7 @@ fun ChapterNavigator(
Icon( Icon(
imageVector = Icons.Outlined.SkipPrevious, imageVector = Icons.Outlined.SkipPrevious,
contentDescription = stringResource( contentDescription = stringResource(
if (isRtl) R.string.action_next_chapter else R.string.action_previous_chapter if (isRtl) R.string.action_next_chapter else R.string.action_previous_chapter,
), ),
) )
} }
@ -131,7 +131,7 @@ fun ChapterNavigator(
Icon( Icon(
imageVector = Icons.Outlined.SkipNext, imageVector = Icons.Outlined.SkipNext,
contentDescription = stringResource( contentDescription = stringResource(
if (isRtl) R.string.action_previous_chapter else R.string.action_next_chapter if (isRtl) R.string.action_previous_chapter else R.string.action_next_chapter,
), ),
) )
} }

View file

@ -69,7 +69,7 @@ fun ChapterTransition(
fallbackLabel = stringResource(R.string.transition_no_previous), fallbackLabel = stringResource(R.string.transition_no_previous),
chapterGap = calculateChapterGap( chapterGap = calculateChapterGap(
currChapter.toDomainChapter(), currChapter.toDomainChapter(),
goingToChapter?.toDomainChapter() goingToChapter?.toDomainChapter(),
), ),
) )
} }
@ -84,7 +84,7 @@ fun ChapterTransition(
fallbackLabel = stringResource(R.string.transition_no_next), fallbackLabel = stringResource(R.string.transition_no_next),
chapterGap = calculateChapterGap( chapterGap = calculateChapterGap(
goingToChapter?.toDomainChapter(), goingToChapter?.toDomainChapter(),
currChapter.toDomainChapter() currChapter.toDomainChapter(),
), ),
) )
} }
@ -202,7 +202,7 @@ private fun ChapterGapWarning(
text = pluralStringResource( text = pluralStringResource(
R.plurals.missing_chapters_warning, R.plurals.missing_chapters_warning,
count = gapCount, count = gapCount,
gapCount gapCount,
), ),
style = MaterialTheme.typography.bodyMedium, style = MaterialTheme.typography.bodyMedium,
) )
@ -324,7 +324,7 @@ private fun TransitionTextPreview() {
ChapterTransition( ChapterTransition(
transition = ChapterTransition.Next( transition = ChapterTransition.Next(
ReaderChapter(FakeChapter), ReaderChapter(FakeChapter),
ReaderChapter(FakeChapter) ReaderChapter(FakeChapter),
), ),
currChapterDownloaded = false, currChapterDownloaded = false,
goingToChapterDownloaded = true, goingToChapterDownloaded = true,
@ -341,7 +341,7 @@ private fun TransitionTextLongTitlePreview() {
ChapterTransition( ChapterTransition(
transition = ChapterTransition.Next( transition = ChapterTransition.Next(
ReaderChapter(FakeChapterLongTitle), ReaderChapter(FakeChapterLongTitle),
ReaderChapter(FakeChapter) ReaderChapter(FakeChapter),
), ),
currChapterDownloaded = true, currChapterDownloaded = true,
goingToChapterDownloaded = true, goingToChapterDownloaded = true,
@ -358,7 +358,7 @@ private fun TransitionTextWithGapPreview() {
ChapterTransition( ChapterTransition(
transition = ChapterTransition.Next( transition = ChapterTransition.Next(
ReaderChapter(FakeChapter), ReaderChapter(FakeChapter),
ReaderChapter(FakeGapChapter) ReaderChapter(FakeGapChapter),
), ),
currChapterDownloaded = true, currChapterDownloaded = true,
goingToChapterDownloaded = false, goingToChapterDownloaded = false,

Some files were not shown because too many files have changed in this diff Show more