ktlint format

This commit is contained in:
LuftVerbot 2023-11-19 15:37:56 +01:00
parent b1f728e54a
commit 6215528c9d
416 changed files with 4604 additions and 1402 deletions

View file

@ -1,6 +1,6 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.FileInputStream
import java.util.Properties
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("com.android.application")
@ -281,7 +281,9 @@ androidComponents {
beforeVariants { variantBuilder ->
// Disables standardBenchmark
if (variantBuilder.buildType == "benchmark") {
variantBuilder.enable = variantBuilder.productFlavors.containsAll(listOf("default" to "dev"))
variantBuilder.enable = variantBuilder.productFlavors.containsAll(
listOf("default" to "dev")
)
}
}
onVariants(selector().withFlavor("default" to "standard")) {

View file

@ -74,7 +74,13 @@ private class BandwidthHeroDataSaver(preferences: SourcePreferences) : DataSaver
override fun compress(imageUrl: String): String {
return if (dataSavedServer.isNotBlank() && !imageUrl.contains(dataSavedServer)) {
when {
imageUrl.contains(".jpeg", true) || imageUrl.contains(".jpg", true) -> if (ignoreJpg) imageUrl else getUrl(imageUrl)
imageUrl.contains(".jpeg", true) || imageUrl.contains(".jpg", true) -> if (ignoreJpg) {
imageUrl
} else {
getUrl(
imageUrl
)
}
imageUrl.contains(".gif", true) -> if (ignoreGif) imageUrl else getUrl(imageUrl)
else -> getUrl(imageUrl)
}
@ -100,7 +106,13 @@ private class WsrvNlDataSaver(preferences: SourcePreferences) : DataSaver {
override fun compress(imageUrl: String): String {
return when {
imageUrl.contains(".jpeg", true) || imageUrl.contains(".jpg", true) -> if (ignoreJpg) imageUrl else getUrl(imageUrl)
imageUrl.contains(".jpeg", true) || imageUrl.contains(".jpg", true) -> if (ignoreJpg) {
imageUrl
} else {
getUrl(
imageUrl
)
}
imageUrl.contains(".gif", true) -> if (ignoreGif) imageUrl else getUrl(imageUrl)
else -> getUrl(imageUrl)
}
@ -108,7 +120,10 @@ private class WsrvNlDataSaver(preferences: SourcePreferences) : DataSaver {
private fun getUrl(imageUrl: String): String {
// Network Request sent to wsrv
return "https://wsrv.nl/?url=$imageUrl" + if (imageUrl.contains(".webp", true) || imageUrl.contains(".gif", true)) {
return "https://wsrv.nl/?url=$imageUrl" + if (imageUrl.contains(".webp", true) || imageUrl.contains(
".gif",
true
)) {
if (!format) {
// Preserve output image extension for animated images(.webp and .gif)
"&q=$quality&n=-1"
@ -140,7 +155,13 @@ private class ReSmushItDataSaver(preferences: SourcePreferences) : DataSaver {
override fun compress(imageUrl: String): String {
return when {
imageUrl.contains(".jpeg", true) || imageUrl.contains(".jpg", true) -> if (ignoreJpg) imageUrl else getUrl(imageUrl)
imageUrl.contains(".jpeg", true) || imageUrl.contains(".jpg", true) -> if (ignoreJpg) {
imageUrl
} else {
getUrl(
imageUrl
)
}
imageUrl.contains(".gif", true) -> if (ignoreGif) imageUrl else getUrl(imageUrl)
else -> getUrl(imageUrl)
}

View file

@ -20,9 +20,14 @@ class BasePreferences(
fun extensionInstaller() = ExtensionInstallerPreference(context, preferenceStore)
fun acraEnabled() = preferenceStore.getBoolean("acra.enable", isPreviewBuildType || isReleaseBuildType)
fun acraEnabled() = preferenceStore.getBoolean(
"acra.enable",
isPreviewBuildType || isReleaseBuildType
)
fun deviceHasPip() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && context.packageManager.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)
fun deviceHasPip() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && context.packageManager.hasSystemFeature(
PackageManager.FEATURE_PICTURE_IN_PICTURE
)
enum class ExtensionInstaller(@StringRes val titleResId: Int) {
LEGACY(R.string.ext_installer_legacy),

View file

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

View file

@ -3,6 +3,8 @@ package eu.kanade.domain.entries.anime.interactor
import eu.kanade.domain.entries.anime.model.hasCustomCover
import eu.kanade.tachiyomi.animesource.model.SAnime
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.model.Anime
import tachiyomi.domain.entries.anime.model.AnimeUpdate
@ -10,8 +12,6 @@ import tachiyomi.domain.entries.anime.repository.AnimeRepository
import tachiyomi.source.local.entries.anime.isLocal
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.time.ZonedDateTime
import java.util.Date
class UpdateAnime(
private val animeRepository: AnimeRepository,
@ -91,7 +91,9 @@ class UpdateAnime(
}
suspend fun awaitUpdateCoverLastModified(mangaId: Long): Boolean {
return animeRepository.updateAnime(AnimeUpdate(id = mangaId, coverLastModified = Date().time))
return animeRepository.updateAnime(
AnimeUpdate(id = mangaId, coverLastModified = Date().time)
)
}
suspend fun awaitUpdateFavorite(animeId: Long, favorite: Boolean): Boolean {

View file

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

View file

@ -9,6 +9,10 @@ import eu.kanade.tachiyomi.data.download.manga.MangaDownloadProvider
import eu.kanade.tachiyomi.source.MangaSource
import eu.kanade.tachiyomi.source.model.SChapter
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.domain.entries.manga.model.Manga
import tachiyomi.domain.items.chapter.interactor.GetChapterByMangaId
@ -21,10 +25,6 @@ import tachiyomi.domain.items.chapter.repository.ChapterRepository
import tachiyomi.domain.items.chapter.service.ChapterRecognition
import tachiyomi.source.local.entries.manga.isLocal
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(
private val downloadManager: MangaDownloadManager,
@ -100,7 +100,11 @@ class SyncChaptersWithSource(
}
// Recognize chapter number for the chapter.
val chapterNumber = ChapterRecognition.parseChapterNumber(manga.title, chapter.name, chapter.chapterNumber)
val chapterNumber = ChapterRecognition.parseChapterNumber(
manga.title,
chapter.name,
chapter.chapterNumber
)
chapter = chapter.copy(chapterNumber = chapterNumber)
val dbChapter = dbChapters.find { it.url == chapter.url }
@ -116,8 +120,16 @@ class SyncChaptersWithSource(
toAdd.add(toAddChapter)
} else {
if (shouldUpdateDbChapter.await(dbChapter, chapter)) {
val shouldRenameChapter = downloadProvider.isChapterDirNameChanged(dbChapter, chapter) &&
downloadManager.isChapterDownloaded(dbChapter.name, dbChapter.scanlator, manga.title, manga.source)
val shouldRenameChapter = downloadProvider.isChapterDirNameChanged(
dbChapter,
chapter
) &&
downloadManager.isChapterDownloaded(
dbChapter.name,
dbChapter.scanlator,
manga.title,
manga.source
)
if (shouldRenameChapter) {
downloadManager.renameChapter(source, manga, dbChapter, chapter)

View file

@ -1,10 +1,10 @@
package eu.kanade.domain.items.chapter.model
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.source.model.SChapter
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
fun Chapter.toSChapter(): SChapter {

View file

@ -23,7 +23,12 @@ fun List<Chapter>.applyFilters(manga: Manga, downloadManager: MangaDownloadManag
.filter { chapter -> applyFilter(bookmarkedFilter) { chapter.bookmark } }
.filter { chapter ->
applyFilter(downloadedFilter) {
val downloaded = downloadManager.isChapterDownloaded(chapter.name, chapter.scanlator, manga.title, manga.source)
val downloaded = downloadManager.isChapterDownloaded(
chapter.name,
chapter.scanlator,
manga.title,
manga.source
)
downloaded || isLocalManga
}
}

View file

@ -9,6 +9,10 @@ import eu.kanade.tachiyomi.animesource.model.SEpisode
import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource
import eu.kanade.tachiyomi.data.download.anime.AnimeDownloadManager
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.domain.entries.anime.model.Anime
import tachiyomi.domain.items.episode.interactor.GetEpisodeByAnimeId
@ -21,10 +25,6 @@ import tachiyomi.domain.items.episode.repository.EpisodeRepository
import tachiyomi.domain.items.episode.service.EpisodeRecognition
import tachiyomi.source.local.entries.anime.isLocal
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(
private val downloadManager: AnimeDownloadManager,
@ -100,7 +100,11 @@ class SyncEpisodesWithSource(
}
// Recognize episode number for the episode.
val episodeNumber = EpisodeRecognition.parseEpisodeNumber(anime.title, episode.name, episode.episodeNumber)
val episodeNumber = EpisodeRecognition.parseEpisodeNumber(
anime.title,
episode.name,
episode.episodeNumber
)
episode = episode.copy(episodeNumber = episodeNumber)
val dbEpisode = dbEpisodes.find { it.url == episode.url }
@ -116,8 +120,16 @@ class SyncEpisodesWithSource(
toAdd.add(toAddEpisode)
} else {
if (shouldUpdateDbEpisode.await(dbEpisode, episode)) {
val shouldRenameEpisode = downloadProvider.isEpisodeDirNameChanged(dbEpisode, episode) &&
downloadManager.isEpisodeDownloaded(dbEpisode.name, dbEpisode.scanlator, anime.title, anime.source)
val shouldRenameEpisode = downloadProvider.isEpisodeDirNameChanged(
dbEpisode,
episode
) &&
downloadManager.isEpisodeDownloaded(
dbEpisode.name,
dbEpisode.scanlator,
anime.title,
anime.source
)
if (shouldRenameEpisode) {
downloadManager.renameEpisode(source, anime, dbEpisode, episode)
@ -129,7 +141,9 @@ class SyncEpisodesWithSource(
sourceOrder = episode.sourceOrder,
)
if (episode.dateUpload != 0L) {
toChangeEpisode = toChangeEpisode.copy(dateUpload = sourceEpisode.dateUpload)
toChangeEpisode = toChangeEpisode.copy(
dateUpload = sourceEpisode.dateUpload
)
}
toChange.add(toChangeEpisode)
}

View file

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

View file

@ -23,7 +23,12 @@ fun List<Episode>.applyFilters(anime: Anime, downloadManager: AnimeDownloadManag
.filter { episode -> applyFilter(bookmarkedFilter) { episode.bookmark } }
.filter { episode ->
applyFilter(downloadedFilter) {
val downloaded = downloadManager.isEpisodeDownloaded(episode.name, episode.scanlator, anime.title, anime.source)
val downloaded = downloadManager.isEpisodeDownloaded(
episode.name,
episode.scanlator,
anime.title,
anime.source
)
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.SourcePreferences
import java.text.Collator
import java.util.Collections
import java.util.Locale
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import tachiyomi.domain.source.anime.model.AnimeSource
import tachiyomi.domain.source.anime.repository.AnimeSourceRepository
import tachiyomi.source.local.entries.anime.LocalAnimeSource
import java.text.Collator
import java.util.Collections
import java.util.Locale
class GetAnimeSourcesWithFavoriteCount(
private val repository: AnimeSourceRepository,
@ -42,7 +42,10 @@ class GetAnimeSourcesWithFavoriteCount(
when {
a.first.isStub && b.first.isStub.not() -> -1
b.first.isStub && a.first.isStub.not() -> 1
else -> collator.compare(a.first.name.lowercase(locale), b.first.name.lowercase(locale))
else -> collator.compare(
a.first.name.lowercase(locale),
b.first.name.lowercase(locale)
)
}
}
SetMigrateSorting.Mode.TOTAL -> {

View file

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

View file

@ -21,7 +21,13 @@ class ToggleAnimeSource(
fun await(sourceIds: List<Long>, enable: Boolean) {
val transformedSourceIds = sourceIds.map { it.toString() }
preferences.disabledAnimeSources().getAndSet { disabled ->
if (enable) disabled.minus(transformedSourceIds) else disabled.plus(transformedSourceIds)
if (enable) {
disabled.minus(transformedSourceIds)
} else {
disabled.plus(
transformedSourceIds
)
}
}
}

View file

@ -2,11 +2,11 @@ package eu.kanade.domain.source.manga.interactor
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.util.system.LocaleHelper
import java.util.SortedMap
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import tachiyomi.domain.source.manga.model.Source
import tachiyomi.domain.source.manga.repository.MangaSourceRepository
import java.util.SortedMap
class GetLanguagesWithMangaSources(
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.SourcePreferences
import java.text.Collator
import java.util.Collections
import java.util.Locale
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import tachiyomi.domain.source.manga.model.Source
import tachiyomi.domain.source.manga.repository.MangaSourceRepository
import tachiyomi.source.local.entries.manga.LocalMangaSource
import java.text.Collator
import java.util.Collections
import java.util.Locale
class GetMangaSourcesWithFavoriteCount(
private val repository: MangaSourceRepository,
@ -42,7 +42,10 @@ class GetMangaSourcesWithFavoriteCount(
when {
a.first.isStub && b.first.isStub.not() -> -1
b.first.isStub && a.first.isStub.not() -> 1
else -> collator.compare(a.first.name.lowercase(locale), b.first.name.lowercase(locale))
else -> collator.compare(
a.first.name.lowercase(locale),
b.first.name.lowercase(locale)
)
}
}
SetMigrateSorting.Mode.TOTAL -> {

View file

@ -21,7 +21,13 @@ class ToggleMangaSource(
fun await(sourceIds: List<Long>, enable: Boolean) {
val transformedSourceIds = sourceIds.map { it.toString() }
preferences.disabledMangaSources().getAndSet { disabled ->
if (enable) disabled.minus(transformedSourceIds) else disabled.plus(transformedSourceIds)
if (enable) {
disabled.minus(transformedSourceIds)
} else {
disabled.plus(
transformedSourceIds
)
}
}
}

View file

@ -11,15 +11,29 @@ class SourcePreferences(
// Common options
fun sourceDisplayMode() = preferenceStore.getObject("pref_display_mode_catalogue", LibraryDisplayMode.default, LibraryDisplayMode.Serializer::serialize, LibraryDisplayMode.Serializer::deserialize)
fun sourceDisplayMode() = preferenceStore.getObject(
"pref_display_mode_catalogue",
LibraryDisplayMode.default,
LibraryDisplayMode.Serializer::serialize,
LibraryDisplayMode.Serializer::deserialize
)
fun enabledLanguages() = preferenceStore.getStringSet("source_languages", LocaleHelper.getDefaultEnabledLanguages())
fun enabledLanguages() = preferenceStore.getStringSet(
"source_languages",
LocaleHelper.getDefaultEnabledLanguages()
)
fun showNsfwSource() = preferenceStore.getBoolean("show_nsfw_source", true)
fun migrationSortingMode() = preferenceStore.getEnum("pref_migration_sorting", SetMigrateSorting.Mode.ALPHABETICAL)
fun migrationSortingMode() = preferenceStore.getEnum(
"pref_migration_sorting",
SetMigrateSorting.Mode.ALPHABETICAL
)
fun migrationSortingDirection() = preferenceStore.getEnum("pref_migration_direction", SetMigrateSorting.Direction.ASCENDING)
fun migrationSortingDirection() = preferenceStore.getEnum(
"pref_migration_direction",
SetMigrateSorting.Direction.ASCENDING
)
fun trustedSignatures() = preferenceStore.getStringSet("trusted_signatures", emptySet())
@ -37,9 +51,15 @@ class SourcePreferences(
fun animeExtensionUpdatesCount() = preferenceStore.getInt("animeext_updates_count", 0)
fun mangaExtensionUpdatesCount() = preferenceStore.getInt("ext_updates_count", 0)
fun hideInAnimeLibraryItems() = preferenceStore.getBoolean("browse_hide_in_anime_library_items", false)
fun hideInAnimeLibraryItems() = preferenceStore.getBoolean(
"browse_hide_in_anime_library_items",
false
)
fun hideInMangaLibraryItems() = preferenceStore.getBoolean("browse_hide_in_library_items", false)
fun hideInMangaLibraryItems() = preferenceStore.getBoolean(
"browse_hide_in_library_items",
false
)
// SY -->
@ -59,7 +79,10 @@ class SourcePreferences(
fun dataSaverImageQuality() = preferenceStore.getInt("data_saver_image_quality", 80)
fun dataSaverImageFormatJpeg() = preferenceStore.getBoolean("data_saver_image_format_jpeg", false)
fun dataSaverImageFormatJpeg() = preferenceStore.getBoolean(
"data_saver_image_format_jpeg",
false
)
fun dataSaverServer() = preferenceStore.getString("data_saver_server", "")

View file

@ -33,7 +33,11 @@ class RefreshAnimeTracks(
if (service?.isLoggedIn == true) {
val updatedTrack = service.animeService.refresh(track.toDbTrack())
insertTrack.await(updatedTrack.toDomainTrack()!!)
syncEpisodeProgressWithTrack.await(animeId, track, service.animeService)
syncEpisodeProgressWithTrack.await(
animeId,
track,
service.animeService
)
}
null
} catch (e: Throwable) {

View file

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

View file

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

View file

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

View file

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

View file

@ -25,7 +25,10 @@ class TrackPreferences(
fun trackOnAddingToLibrary() = preferenceStore.getBoolean("track_on_adding_to_library", true)
fun showNextEpisodeAiringTime() = preferenceStore.getBoolean("show_next_episode_airing_time", true)
fun showNextEpisodeAiringTime() = preferenceStore.getBoolean(
"show_next_episode_airing_time",
true
)
companion object {
fun trackUsername(syncId: Long) = "pref_mangasync_username_$syncId"

View file

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

View file

@ -25,7 +25,10 @@ fun BaseBrowseItem(
onClick = onClickItem,
onLongClick = onLongClickItem,
)
.padding(horizontal = MaterialTheme.padding.medium, vertical = MaterialTheme.padding.small),
.padding(
horizontal = MaterialTheme.padding.medium,
vertical = MaterialTheme.padding.small
),
verticalAlignment = Alignment.CenterVertically,
) {
icon()

View file

@ -236,7 +236,9 @@ private fun DetailsHeader(
textAlign = TextAlign.Center,
)
val strippedPkgName = extension.pkgName.substringAfter("eu.kanade.tachiyomi.animeextension.")
val strippedPkgName = extension.pkgName.substringAfter(
"eu.kanade.tachiyomi.animeextension."
)
Text(
text = strippedPkgName,

View file

@ -295,7 +295,10 @@ private fun AnimeExtensionItemContent(
ProvideTextStyle(value = MaterialTheme.typography.bodySmall) {
if (extension is AnimeExtension.Installed && extension.lang.isNotEmpty()) {
Text(
text = LocaleHelper.getSourceDisplayName(extension.lang, LocalContext.current),
text = LocaleHelper.getSourceDisplayName(
extension.lang,
LocalContext.current
),
)
}

View file

@ -101,7 +101,10 @@ private fun AnimeSourceHeader(
Text(
text = LocaleHelper.getSourceDisplayName(language, context),
modifier = modifier
.padding(horizontal = MaterialTheme.padding.medium, vertical = MaterialTheme.padding.small),
.padding(
horizontal = MaterialTheme.padding.medium,
vertical = MaterialTheme.padding.small
),
style = MaterialTheme.typography.header,
)
}
@ -144,7 +147,13 @@ private fun AnimeSourcePinButton(
onClick: () -> Unit,
) {
val icon = if (isPinned) Icons.Filled.PushPin else Icons.Outlined.PushPin
val tint = if (isPinned) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onBackground.copy(alpha = SecondaryItemAlpha)
val tint = if (isPinned) {
MaterialTheme.colorScheme.primary
} else {
MaterialTheme.colorScheme.onBackground.copy(
alpha = SecondaryItemAlpha
)
}
val description = if (isPinned) R.string.action_unpin else R.string.action_pin
IconButton(onClick = onClick) {
Icon(

View file

@ -102,14 +102,26 @@ private fun MigrateAnimeSourceList(
IconButton(onClick = onToggleSortingMode) {
when (sortingMode) {
SetMigrateSorting.Mode.ALPHABETICAL -> Icon(Icons.Outlined.SortByAlpha, contentDescription = stringResource(R.string.action_sort_alpha))
SetMigrateSorting.Mode.TOTAL -> Icon(Icons.Outlined.Numbers, contentDescription = stringResource(R.string.action_sort_count))
SetMigrateSorting.Mode.ALPHABETICAL -> Icon(
Icons.Outlined.SortByAlpha,
contentDescription = stringResource(R.string.action_sort_alpha)
)
SetMigrateSorting.Mode.TOTAL -> Icon(
Icons.Outlined.Numbers,
contentDescription = stringResource(R.string.action_sort_count)
)
}
}
IconButton(onClick = onToggleSortingDirection) {
when (sortingDirection) {
SetMigrateSorting.Direction.ASCENDING -> Icon(Icons.Outlined.ArrowUpward, contentDescription = stringResource(R.string.action_asc))
SetMigrateSorting.Direction.DESCENDING -> Icon(Icons.Outlined.ArrowDownward, contentDescription = stringResource(R.string.action_desc))
SetMigrateSorting.Direction.ASCENDING -> Icon(
Icons.Outlined.ArrowUpward,
contentDescription = stringResource(R.string.action_asc)
)
SetMigrateSorting.Direction.DESCENDING -> Icon(
Icons.Outlined.ArrowDownward,
contentDescription = stringResource(R.string.action_desc)
)
}
}
}

View file

@ -127,7 +127,10 @@ private fun AnimeExtension.getIcon(density: Int = DisplayMetrics.DENSITY_DEFAULT
return produceState<Result<ImageBitmap>>(initialValue = Result.Loading, this) {
withIOContext {
value = try {
val appInfo = AnimeExtensionLoader.getAnimeExtensionPackageInfoFromPkgName(context, pkgName)!!.applicationInfo
val appInfo = AnimeExtensionLoader.getAnimeExtensionPackageInfoFromPkgName(
context,
pkgName
)!!.applicationInfo
val appResources = context.packageManager.getResourcesForApplication(appInfo)
Result.Success(
appResources.getDrawableForDensity(appInfo.icon, density, null)!!

View file

@ -296,7 +296,10 @@ private fun ExtensionItemContent(
ProvideTextStyle(value = MaterialTheme.typography.bodySmall) {
if (extension is MangaExtension.Installed && extension.lang.isNotEmpty()) {
Text(
text = LocaleHelper.getSourceDisplayName(extension.lang, LocalContext.current),
text = LocaleHelper.getSourceDisplayName(
extension.lang,
LocalContext.current
),
)
}

View file

@ -101,7 +101,10 @@ private fun SourceHeader(
Text(
text = LocaleHelper.getSourceDisplayName(language, context),
modifier = modifier
.padding(horizontal = MaterialTheme.padding.medium, vertical = MaterialTheme.padding.small),
.padding(
horizontal = MaterialTheme.padding.medium,
vertical = MaterialTheme.padding.small
),
style = MaterialTheme.typography.header,
)
}
@ -144,7 +147,13 @@ private fun SourcePinButton(
onClick: () -> Unit,
) {
val icon = if (isPinned) Icons.Filled.PushPin else Icons.Outlined.PushPin
val tint = if (isPinned) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onBackground.copy(alpha = SecondaryItemAlpha)
val tint = if (isPinned) {
MaterialTheme.colorScheme.primary
} else {
MaterialTheme.colorScheme.onBackground.copy(
alpha = SecondaryItemAlpha
)
}
val description = if (isPinned) R.string.action_unpin else R.string.action_pin
IconButton(onClick = onClick) {
Icon(

View file

@ -102,14 +102,26 @@ private fun MigrateSourceList(
IconButton(onClick = onToggleSortingMode) {
when (sortingMode) {
SetMigrateSorting.Mode.ALPHABETICAL -> Icon(Icons.Outlined.SortByAlpha, contentDescription = stringResource(R.string.action_sort_alpha))
SetMigrateSorting.Mode.TOTAL -> Icon(Icons.Outlined.Numbers, contentDescription = stringResource(R.string.action_sort_count))
SetMigrateSorting.Mode.ALPHABETICAL -> Icon(
Icons.Outlined.SortByAlpha,
contentDescription = stringResource(R.string.action_sort_alpha)
)
SetMigrateSorting.Mode.TOTAL -> Icon(
Icons.Outlined.Numbers,
contentDescription = stringResource(R.string.action_sort_count)
)
}
}
IconButton(onClick = onToggleSortingDirection) {
when (sortingDirection) {
SetMigrateSorting.Direction.ASCENDING -> Icon(Icons.Outlined.ArrowUpward, contentDescription = stringResource(R.string.action_asc))
SetMigrateSorting.Direction.DESCENDING -> Icon(Icons.Outlined.ArrowDownward, contentDescription = stringResource(R.string.action_desc))
SetMigrateSorting.Direction.ASCENDING -> Icon(
Icons.Outlined.ArrowUpward,
contentDescription = stringResource(R.string.action_asc)
)
SetMigrateSorting.Direction.DESCENDING -> Icon(
Icons.Outlined.ArrowDownward,
contentDescription = stringResource(R.string.action_desc)
)
}
}
}

View file

@ -127,7 +127,10 @@ private fun MangaExtension.getIcon(density: Int = DisplayMetrics.DENSITY_DEFAULT
return produceState<Result<ImageBitmap>>(initialValue = Result.Loading, this) {
withIOContext {
value = try {
val appInfo = MangaExtensionLoader.getMangaExtensionPackageInfoFromPkgName(context, pkgName)!!.applicationInfo
val appInfo = MangaExtensionLoader.getMangaExtensionPackageInfoFromPkgName(
context,
pkgName
)!!.applicationInfo
val appResources = context.packageManager.getResourcesForApplication(appInfo)
Result.Success(
appResources.getDrawableForDensity(appInfo.icon, density, null)!!

View file

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

View file

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

View file

@ -15,9 +15,9 @@ import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.res.stringResource
import eu.kanade.tachiyomi.R
import kotlin.time.Duration.Companion.seconds
import kotlinx.coroutines.delay
import tachiyomi.domain.category.model.Category
import kotlin.time.Duration.Companion.seconds
@Composable
fun CategoryCreateDialog(

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -33,7 +33,10 @@ fun CrashScreen(
InfoScreen(
icon = Icons.Outlined.BugReport,
headingText = stringResource(R.string.crash_screen_title),
subtitleText = stringResource(R.string.crash_screen_description, stringResource(R.string.app_name)),
subtitleText = stringResource(
R.string.crash_screen_description,
stringResource(R.string.app_name)
),
acceptText = stringResource(R.string.pref_dump_crash_logs),
onAcceptClick = {
scope.launch {

View file

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

View file

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

View file

@ -231,7 +231,13 @@ private fun VideoList(
)
val downloadEpisode: (Boolean) -> Unit = {
downloadManager.downloadEpisodes(anime, listOf(episode), true, it, selectedVideo)
downloadManager.downloadEpisodes(
anime,
listOf(episode),
true,
it,
selectedVideo
)
}
QualityOptions(
@ -243,7 +249,13 @@ private fun VideoList(
},
onExtPlayerClicked = {
scope.launch {
MainActivity.startPlayerActivity(context, anime.id, episode.id, true, selectedVideo)
MainActivity.startPlayerActivity(
context,
anime.id,
episode.id,
true,
selectedVideo
)
}
},
)

View file

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

View file

@ -51,13 +51,13 @@ import androidx.compose.ui.unit.sp
import eu.kanade.presentation.entries.DotSeparatorText
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.download.anime.model.AnimeDownload
import kotlin.math.absoluteValue
import me.saket.swipe.SwipeableActionsBox
import me.saket.swipe.rememberSwipeableActionsState
import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.presentation.core.components.material.ReadItemAlpha
import tachiyomi.presentation.core.components.material.SecondaryItemAlpha
import tachiyomi.presentation.core.util.selectedBackground
import kotlin.math.absoluteValue
@Composable
fun AnimeEpisodeListItem(
@ -156,9 +156,13 @@ fun AnimeEpisodeListItem(
if (bookmark) {
Icon(
imageVector = Icons.Filled.Bookmark,
contentDescription = stringResource(R.string.action_filter_bookmarked),
contentDescription = stringResource(
R.string.action_filter_bookmarked
),
modifier = Modifier
.sizeIn(maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp }),
.sizeIn(
maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp }
),
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.animesource.model.SAnime
import eu.kanade.tachiyomi.util.system.copyToClipboard
import kotlin.math.absoluteValue
import kotlin.math.roundToInt
import tachiyomi.domain.entries.anime.model.Anime
import tachiyomi.presentation.core.components.material.TextButton
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.util.clickableNoIndication
import tachiyomi.presentation.core.util.secondaryItemAlpha
import kotlin.math.absoluteValue
import kotlin.math.roundToInt
private val whitespaceLineRegex = Regex("[\\r\\n]{2,}", setOf(RegexOption.MULTILINE))
@ -193,7 +193,11 @@ fun AnimeActionRow(
)
if (onEditIntervalClicked != null && fetchInterval != null) {
AnimeActionButton(
title = pluralStringResource(id = R.plurals.day, count = fetchInterval.absoluteValue, fetchInterval.absoluteValue),
title = pluralStringResource(
id = R.plurals.day,
count = fetchInterval.absoluteValue,
fetchInterval.absoluteValue
),
icon = Icons.Default.HourglassEmpty,
color = if (isUserIntervalMode) MaterialTheme.colorScheme.primary else defaultActionButtonColor,
onClick = onEditIntervalClicked,
@ -204,7 +208,11 @@ fun AnimeActionRow(
title = if (trackingCount == 0) {
stringResource(R.string.manga_tracking_tab)
} else {
pluralStringResource(id = R.plurals.num_trackers, count = trackingCount, trackingCount)
pluralStringResource(
id = R.plurals.num_trackers,
count = trackingCount,
trackingCount
)
},
icon = if (trackingCount == 0) Icons.Outlined.Sync else Icons.Outlined.Done,
color = if (trackingCount == 0) defaultActionButtonColor else MaterialTheme.colorScheme.primary,
@ -237,7 +245,9 @@ fun ExpandableAnimeDescription(
mutableStateOf(defaultExpandState)
}
val desc =
description.takeIf { !it.isNullOrBlank() } ?: stringResource(R.string.description_placeholder)
description.takeIf { !it.isNullOrBlank() } ?: stringResource(
R.string.description_placeholder
)
val trimmedDescription = remember(desc) {
desc
.replace(whitespaceLineRegex, "\n")
@ -415,7 +425,9 @@ private fun AnimeAndSourceTitlesLarge(
SAnime.ONGOING.toLong() -> stringResource(R.string.ongoing)
SAnime.COMPLETED.toLong() -> stringResource(R.string.completed)
SAnime.LICENSED.toLong() -> stringResource(R.string.licensed)
SAnime.PUBLISHING_FINISHED.toLong() -> stringResource(R.string.publishing_finished)
SAnime.PUBLISHING_FINISHED.toLong() -> stringResource(
R.string.publishing_finished
)
SAnime.CANCELLED.toLong() -> stringResource(R.string.cancelled)
SAnime.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus)
else -> stringResource(R.string.unknown)
@ -548,7 +560,9 @@ private fun AnimeAndSourceTitlesSmall(
SAnime.ONGOING.toLong() -> stringResource(R.string.ongoing)
SAnime.COMPLETED.toLong() -> stringResource(R.string.completed)
SAnime.LICENSED.toLong() -> stringResource(R.string.licensed)
SAnime.PUBLISHING_FINISHED.toLong() -> stringResource(R.string.publishing_finished)
SAnime.PUBLISHING_FINISHED.toLong() -> stringResource(
R.string.publishing_finished
)
SAnime.CANCELLED.toLong() -> stringResource(R.string.cancelled)
SAnime.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus)
else -> stringResource(R.string.unknown)
@ -612,7 +626,9 @@ private fun AnimeSummary(
style = MaterialTheme.typography.bodyMedium,
)
}.map { it.measure(constraints) }
expandedHeight = expandedPlaceable.maxByOrNull { it.height }?.height?.coerceAtLeast(shrunkHeight) ?: 0
expandedHeight = expandedPlaceable.maxByOrNull { it.height }?.height?.coerceAtLeast(
shrunkHeight
) ?: 0
val actualPlaceable = subcompose("description") {
SelectionContainer {
@ -635,9 +651,13 @@ private fun AnimeSummary(
val image = AnimatedImageVector.animatedVectorResource(R.drawable.anim_caret_down)
Icon(
painter = rememberAnimatedVectorPainter(image, !expanded),
contentDescription = stringResource(if (expanded) R.string.manga_info_collapse else R.string.manga_info_expand),
contentDescription = stringResource(
if (expanded) R.string.manga_info_collapse else R.string.manga_info_expand
),
tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier.background(Brush.radialGradient(colors = colors.asReversed())),
modifier = Modifier.background(
Brush.radialGradient(colors = colors.asReversed())
),
)
}
}.map { it.measure(Constraints.fixed(width = constraints.maxWidth, height = scrimHeight)) }

View file

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

View file

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

View file

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

View file

@ -81,13 +81,13 @@ import eu.kanade.presentation.entries.ItemCover
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.util.system.copyToClipboard
import kotlin.math.absoluteValue
import kotlin.math.roundToInt
import tachiyomi.domain.entries.manga.model.Manga
import tachiyomi.presentation.core.components.material.TextButton
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.util.clickableNoIndication
import tachiyomi.presentation.core.util.secondaryItemAlpha
import kotlin.math.absoluteValue
import kotlin.math.roundToInt
private val whitespaceLineRegex = Regex("[\\r\\n]{2,}", setOf(RegexOption.MULTILINE))
@ -193,7 +193,11 @@ fun MangaActionRow(
)
if (onEditIntervalClicked != null && fetchInterval != null) {
MangaActionButton(
title = pluralStringResource(id = R.plurals.day, count = fetchInterval.absoluteValue, fetchInterval.absoluteValue),
title = pluralStringResource(
id = R.plurals.day,
count = fetchInterval.absoluteValue,
fetchInterval.absoluteValue
),
icon = Icons.Default.HourglassEmpty,
color = if (isUserIntervalMode) MaterialTheme.colorScheme.primary else defaultActionButtonColor,
onClick = onEditIntervalClicked,
@ -204,7 +208,11 @@ fun MangaActionRow(
title = if (trackingCount == 0) {
stringResource(R.string.manga_tracking_tab)
} else {
pluralStringResource(id = R.plurals.num_trackers, count = trackingCount, trackingCount)
pluralStringResource(
id = R.plurals.num_trackers,
count = trackingCount,
trackingCount
)
},
icon = if (trackingCount == 0) Icons.Outlined.Sync else Icons.Outlined.Done,
color = if (trackingCount == 0) defaultActionButtonColor else MaterialTheme.colorScheme.primary,
@ -237,7 +245,9 @@ fun ExpandableMangaDescription(
mutableStateOf(defaultExpandState)
}
val desc =
description.takeIf { !it.isNullOrBlank() } ?: stringResource(R.string.description_placeholder)
description.takeIf { !it.isNullOrBlank() } ?: stringResource(
R.string.description_placeholder
)
val trimmedDescription = remember(desc) {
desc
.replace(whitespaceLineRegex, "\n")
@ -415,7 +425,9 @@ private fun MangaAndSourceTitlesLarge(
SManga.ONGOING.toLong() -> stringResource(R.string.ongoing)
SManga.COMPLETED.toLong() -> stringResource(R.string.completed)
SManga.LICENSED.toLong() -> stringResource(R.string.licensed)
SManga.PUBLISHING_FINISHED.toLong() -> stringResource(R.string.publishing_finished)
SManga.PUBLISHING_FINISHED.toLong() -> stringResource(
R.string.publishing_finished
)
SManga.CANCELLED.toLong() -> stringResource(R.string.cancelled)
SManga.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus)
else -> stringResource(R.string.unknown)
@ -548,7 +560,9 @@ private fun MangaAndSourceTitlesSmall(
SManga.ONGOING.toLong() -> stringResource(R.string.ongoing)
SManga.COMPLETED.toLong() -> stringResource(R.string.completed)
SManga.LICENSED.toLong() -> stringResource(R.string.licensed)
SManga.PUBLISHING_FINISHED.toLong() -> stringResource(R.string.publishing_finished)
SManga.PUBLISHING_FINISHED.toLong() -> stringResource(
R.string.publishing_finished
)
SManga.CANCELLED.toLong() -> stringResource(R.string.cancelled)
SManga.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus)
else -> stringResource(R.string.unknown)
@ -612,7 +626,9 @@ private fun MangaSummary(
style = MaterialTheme.typography.bodyMedium,
)
}.map { it.measure(constraints) }
expandedHeight = expandedPlaceable.maxByOrNull { it.height }?.height?.coerceAtLeast(shrunkHeight) ?: 0
expandedHeight = expandedPlaceable.maxByOrNull { it.height }?.height?.coerceAtLeast(
shrunkHeight
) ?: 0
val actualPlaceable = subcompose("description") {
SelectionContainer {
@ -635,9 +651,13 @@ private fun MangaSummary(
val image = AnimatedImageVector.animatedVectorResource(R.drawable.anim_caret_down)
Icon(
painter = rememberAnimatedVectorPainter(image, !expanded),
contentDescription = stringResource(if (expanded) R.string.manga_info_collapse else R.string.manga_info_expand),
contentDescription = stringResource(
if (expanded) R.string.manga_info_collapse else R.string.manga_info_expand
),
tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier.background(Brush.radialGradient(colors = colors.asReversed())),
modifier = Modifier.background(
Brush.radialGradient(colors = colors.asReversed())
),
)
}
}.map { it.measure(Constraints.fixed(width = constraints.maxWidth, height = scrimHeight)) }

View file

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

View file

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

View file

@ -41,7 +41,10 @@ fun AnimeHistoryItem(
modifier = modifier
.clickable(onClick = onClickResume)
.height(HISTORY_ITEM_HEIGHT)
.padding(horizontal = MaterialTheme.padding.medium, vertical = MaterialTheme.padding.small),
.padding(
horizontal = MaterialTheme.padding.medium,
vertical = MaterialTheme.padding.small
),
verticalAlignment = Alignment.CenterVertically,
) {
ItemCover.Book(

View file

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

View file

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

View file

@ -41,7 +41,10 @@ fun MangaHistoryItem(
modifier = modifier
.clickable(onClick = onClickResume)
.height(HISTORY_ITEM_HEIGHT)
.padding(horizontal = MaterialTheme.padding.medium, vertical = MaterialTheme.padding.small),
.padding(
horizontal = MaterialTheme.padding.medium,
vertical = MaterialTheme.padding.small
),
verticalAlignment = Alignment.CenterVertically,
) {
ItemCover.Book(

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -62,14 +62,18 @@ fun MoreScreen(
topBar = {
Column(
modifier = Modifier.windowInsetsPadding(
WindowInsets.systemBars.only(WindowInsetsSides.Top + WindowInsetsSides.Horizontal),
WindowInsets.systemBars.only(
WindowInsetsSides.Top + WindowInsetsSides.Horizontal
),
),
) {
if (isFDroid) {
WarningBanner(
textRes = R.string.fdroid_warning,
modifier = Modifier.clickable {
uriHandler.openUri("https://aniyomi.org/help/faq/#how-do-i-migrate-from-the-f-droid-version")
uriHandler.openUri(
"https://aniyomi.org/help/faq/#how-do-i-migrate-from-the-f-droid-version"
)
},
)
}
@ -146,7 +150,11 @@ fun MoreScreen(
}
is DownloadQueueState.Downloading -> {
val pending = downloadQueueState.pending
pluralStringResource(id = R.plurals.download_queue_summary, count = pending, pending)
pluralStringResource(
id = R.plurals.download_queue_summary,
count = pending,
pending
)
}
},
icon = Icons.Outlined.GetApp,

View file

@ -73,7 +73,9 @@ sealed class Preference {
val entries: Map<T, String>,
) : PreferenceItem<T>() {
internal fun internalSet(newValue: Any) = pref.set(newValue as T)
internal suspend fun internalOnValueChanged(newValue: Any) = onValueChanged(newValue as T)
internal suspend fun internalOnValueChanged(newValue: Any) = onValueChanged(
newValue as T
)
@Composable
internal fun internalSubtitleProvider(value: Any?, entries: Map<out Any?, String>) =

View file

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

View file

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

View file

@ -62,6 +62,7 @@ import eu.kanade.tachiyomi.util.system.isShizukuInstalled
import eu.kanade.tachiyomi.util.system.powerManager
import eu.kanade.tachiyomi.util.system.setDefaultSettings
import eu.kanade.tachiyomi.util.system.toast
import java.io.File
import kotlinx.coroutines.launch
import logcat.LogPriority
import okhttp3.Headers
@ -73,7 +74,6 @@ import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.io.File
object SettingsAdvancedScreen : SearchableSettings {
@ -175,7 +175,9 @@ object SettingsAdvancedScreen : SearchableSettings {
}
context.startActivity(intent)
} catch (e: ActivityNotFoundException) {
context.toast(R.string.battery_optimization_setting_activity_not_found)
context.toast(
R.string.battery_optimization_setting_activity_not_found
)
}
} else {
context.toast(R.string.battery_optimization_disabled)
@ -209,13 +211,19 @@ object SettingsAdvancedScreen : SearchableSettings {
preferenceItems = listOf(
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_clear_chapter_cache),
subtitle = stringResource(R.string.used_cache_both, readableAnimeSize, readableSize),
subtitle = stringResource(
R.string.used_cache_both,
readableAnimeSize,
readableSize
),
onClick = {
scope.launchNonCancellable {
try {
val deletedFiles = chapterCache.clear() + episodeCache.clear()
withUIContext {
context.toast(context.getString(R.string.cache_deleted, deletedFiles))
context.toast(
context.getString(R.string.cache_deleted, deletedFiles)
)
readableSizeSema++
}
} catch (e: Throwable) {
@ -353,8 +361,14 @@ object SettingsAdvancedScreen : SearchableSettings {
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_refresh_library_covers),
onClick = {
MangaLibraryUpdateJob.startNow(context, target = MangaLibraryUpdateJob.Target.COVERS)
AnimeLibraryUpdateJob.startNow(context, target = AnimeLibraryUpdateJob.Target.COVERS)
MangaLibraryUpdateJob.startNow(
context,
target = MangaLibraryUpdateJob.Target.COVERS
)
AnimeLibraryUpdateJob.startNow(
context,
target = AnimeLibraryUpdateJob.Target.COVERS
)
},
),
Preference.PreferenceItem.TextPreference(
@ -362,8 +376,14 @@ object SettingsAdvancedScreen : SearchableSettings {
subtitle = stringResource(R.string.pref_refresh_library_tracking_summary),
enabled = trackManager.hasLoggedServices(),
onClick = {
MangaLibraryUpdateJob.startNow(context, target = MangaLibraryUpdateJob.Target.TRACKING)
AnimeLibraryUpdateJob.startNow(context, target = AnimeLibraryUpdateJob.Target.TRACKING)
MangaLibraryUpdateJob.startNow(
context,
target = MangaLibraryUpdateJob.Target.TRACKING
)
AnimeLibraryUpdateJob.startNow(
context,
target = AnimeLibraryUpdateJob.Target.TRACKING
)
},
),
Preference.PreferenceItem.TextPreference(
@ -401,7 +421,9 @@ object SettingsAdvancedScreen : SearchableSettings {
AlertDialog(
onDismissRequest = dismiss,
title = { Text(text = stringResource(R.string.ext_installer_shizuku)) },
text = { Text(text = stringResource(R.string.ext_installer_shizuku_unavailable_dialog)) },
text = { Text(
text = stringResource(R.string.ext_installer_shizuku_unavailable_dialog)
) },
dismissButton = {
TextButton(onClick = dismiss) {
Text(text = stringResource(R.string.action_cancel))

View file

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

View file

@ -197,8 +197,16 @@ object SettingsBackupScreen : SearchableSettings {
}
}
}
if (!state.isScrolledToStart()) HorizontalDivider(modifier = Modifier.align(Alignment.TopCenter))
if (!state.isScrolledToEnd()) HorizontalDivider(modifier = Modifier.align(Alignment.BottomCenter))
if (!state.isScrolledToStart()) {
HorizontalDivider(
modifier = Modifier.align(Alignment.TopCenter)
)
}
if (!state.isScrolledToEnd()) {
HorizontalDivider(
modifier = Modifier.align(Alignment.BottomCenter)
)
}
}
},
dismissButton = {
@ -282,7 +290,9 @@ object SettingsBackupScreen : SearchableSettings {
val msg = buildString {
append(stringResource(R.string.backup_restore_content_full))
if (err.sources.isNotEmpty()) {
append("\n\n").append(stringResource(R.string.backup_restore_missing_sources))
append("\n\n").append(
stringResource(R.string.backup_restore_missing_sources)
)
err.sources.joinTo(
this,
separator = "\n- ",
@ -290,7 +300,9 @@ object SettingsBackupScreen : SearchableSettings {
)
}
if (err.trackers.isNotEmpty()) {
append("\n\n").append(stringResource(R.string.backup_restore_missing_trackers))
append("\n\n").append(
stringResource(R.string.backup_restore_missing_trackers)
)
err.trackers.joinTo(
this,
separator = "\n- ",
@ -321,7 +333,10 @@ object SettingsBackupScreen : SearchableSettings {
object : ActivityResultContracts.GetContent() {
override fun createIntent(context: Context, input: String): Intent {
val intent = super.createIntent(context, input)
return Intent.createChooser(intent, context.getString(R.string.file_select_backup))
return Intent.createChooser(
intent,
context.getString(R.string.file_select_backup)
)
}
},
) {
@ -338,7 +353,11 @@ object SettingsBackupScreen : SearchableSettings {
return@rememberLauncherForActivityResult
}
error = MissingRestoreComponents(it, results.missingSources, results.missingTrackers)
error = MissingRestoreComponents(
it,
results.missingSources,
results.missingTrackers
)
}
}

View file

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

View file

@ -24,6 +24,7 @@ import eu.kanade.presentation.category.visualName
import eu.kanade.presentation.more.settings.Preference
import eu.kanade.presentation.more.settings.widget.TriStateListDialog
import eu.kanade.tachiyomi.R
import java.io.File
import kotlinx.coroutines.runBlocking
import tachiyomi.domain.category.anime.interactor.GetAnimeCategories
import tachiyomi.domain.category.manga.interactor.GetMangaCategories
@ -32,7 +33,6 @@ import tachiyomi.domain.download.service.DownloadPreferences
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.io.File
object SettingsDownloadScreen : SearchableSettings {
@ -44,9 +44,13 @@ object SettingsDownloadScreen : SearchableSettings {
@Composable
override fun getPreferences(): List<Preference> {
val getCategories = remember { Injekt.get<GetMangaCategories>() }
val allCategories by getCategories.subscribe().collectAsState(initial = runBlocking { getCategories.await() })
val allCategories by getCategories.subscribe().collectAsState(
initial = runBlocking { getCategories.await() }
)
val getAnimeCategories = remember { Injekt.get<GetAnimeCategories>() }
val allAnimeCategories by getAnimeCategories.subscribe().collectAsState(initial = runBlocking { getAnimeCategories.await() })
val allAnimeCategories by getAnimeCategories.subscribe().collectAsState(
initial = runBlocking { getAnimeCategories.await() }
)
val downloadPreferences = remember { Injekt.get<DownloadPreferences>() }
val basePreferences = remember { Injekt.get<BasePreferences>() }
@ -82,7 +86,10 @@ object SettingsDownloadScreen : SearchableSettings {
allAnimeCategories = allAnimeCategories,
),
getDownloadAheadGroup(downloadPreferences = downloadPreferences),
getExternalDownloaderGroup(downloadPreferences = downloadPreferences, basePreferences = basePreferences),
getExternalDownloaderGroup(
downloadPreferences = downloadPreferences,
basePreferences = basePreferences
),
)
}
@ -236,8 +243,12 @@ object SettingsDownloadScreen : SearchableSettings {
itemLabel = { it.visualName },
onDismissRequest = { showAnimeDialog = false },
onValueChanged = { newIncluded, newExcluded ->
downloadNewEpisodeCategoriesPref.set(newIncluded.fastMap { it.id.toString() }.toSet())
downloadNewEpisodeCategoriesExcludePref.set(newExcluded.fastMap { it.id.toString() }.toSet())
downloadNewEpisodeCategoriesPref.set(
newIncluded.fastMap { it.id.toString() }.toSet()
)
downloadNewEpisodeCategoriesExcludePref.set(
newExcluded.fastMap { it.id.toString() }.toSet()
)
showAnimeDialog = false
},
)
@ -262,8 +273,12 @@ object SettingsDownloadScreen : SearchableSettings {
itemLabel = { it.visualName },
onDismissRequest = { showDialog = false },
onValueChanged = { newIncluded, newExcluded ->
downloadNewChapterCategoriesPref.set(newIncluded.fastMap { it.id.toString() }.toSet())
downloadNewChapterCategoriesExcludePref.set(newExcluded.fastMap { it.id.toString() }.toSet())
downloadNewChapterCategoriesPref.set(
newIncluded.fastMap { it.id.toString() }.toSet()
)
downloadNewChapterCategoriesExcludePref.set(
newExcluded.fastMap { it.id.toString() }.toSet()
)
showDialog = false
},
)
@ -318,7 +333,11 @@ object SettingsDownloadScreen : SearchableSettings {
if (it == 0) {
stringResource(R.string.disabled)
} else {
pluralStringResource(id = R.plurals.next_unread_chapters, count = it, it)
pluralStringResource(
id = R.plurals.next_unread_chapters,
count = it,
it
)
}
},
),
@ -329,17 +348,26 @@ object SettingsDownloadScreen : SearchableSettings {
if (it == 0) {
stringResource(R.string.disabled)
} else {
pluralStringResource(id = R.plurals.next_unseen_episodes, count = it, it)
pluralStringResource(
id = R.plurals.next_unseen_episodes,
count = it,
it
)
}
},
),
Preference.PreferenceItem.InfoPreference(stringResource(R.string.download_ahead_info)),
Preference.PreferenceItem.InfoPreference(
stringResource(R.string.download_ahead_info)
),
),
)
}
@Composable
private fun getExternalDownloaderGroup(downloadPreferences: DownloadPreferences, basePreferences: BasePreferences): Preference.PreferenceGroup {
private fun getExternalDownloaderGroup(
downloadPreferences: DownloadPreferences,
basePreferences: BasePreferences
): Preference.PreferenceGroup {
val useExternalDownloader = downloadPreferences.useExternalDownloader()
val externalDownloaderPreference = downloadPreferences.externalDownloaderSelection()

View file

@ -295,10 +295,16 @@ object SettingsLibraryScreen : SearchableSettings {
pref = libraryPreferences.autoUpdateItemRestrictions(),
title = stringResource(R.string.pref_library_update_manga_restriction),
entries = mapOf(
ENTRY_HAS_UNVIEWED to stringResource(R.string.pref_update_only_completely_read),
ENTRY_HAS_UNVIEWED to stringResource(
R.string.pref_update_only_completely_read
),
ENTRY_NON_VIEWED to stringResource(R.string.pref_update_only_started),
ENTRY_NON_COMPLETED to stringResource(R.string.pref_update_only_non_completed),
ENTRY_OUTSIDE_RELEASE_PERIOD to stringResource(R.string.pref_update_only_in_release_period),
ENTRY_NON_COMPLETED to stringResource(
R.string.pref_update_only_non_completed
),
ENTRY_OUTSIDE_RELEASE_PERIOD to stringResource(
R.string.pref_update_only_in_release_period
),
),
),
Preference.PreferenceItem.SwitchPreference(
@ -320,20 +326,36 @@ object SettingsLibraryScreen : SearchableSettings {
pref = libraryPreferences.swipeChapterStartAction(),
title = stringResource(R.string.pref_chapter_swipe_start),
entries = mapOf(
LibraryPreferences.ChapterSwipeAction.Disabled to stringResource(R.string.action_disable),
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to stringResource(R.string.action_bookmark),
LibraryPreferences.ChapterSwipeAction.ToggleRead to stringResource(R.string.action_mark_as_read),
LibraryPreferences.ChapterSwipeAction.Download to stringResource(R.string.action_download),
LibraryPreferences.ChapterSwipeAction.Disabled to stringResource(
R.string.action_disable
),
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to stringResource(
R.string.action_bookmark
),
LibraryPreferences.ChapterSwipeAction.ToggleRead to stringResource(
R.string.action_mark_as_read
),
LibraryPreferences.ChapterSwipeAction.Download to stringResource(
R.string.action_download
),
),
),
Preference.PreferenceItem.ListPreference(
pref = libraryPreferences.swipeChapterEndAction(),
title = stringResource(R.string.pref_chapter_swipe_end),
entries = mapOf(
LibraryPreferences.ChapterSwipeAction.Disabled to stringResource(R.string.action_disable),
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to stringResource(R.string.action_bookmark),
LibraryPreferences.ChapterSwipeAction.ToggleRead to stringResource(R.string.action_mark_as_read),
LibraryPreferences.ChapterSwipeAction.Download to stringResource(R.string.action_download),
LibraryPreferences.ChapterSwipeAction.Disabled to stringResource(
R.string.action_disable
),
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to stringResource(
R.string.action_bookmark
),
LibraryPreferences.ChapterSwipeAction.ToggleRead to stringResource(
R.string.action_mark_as_read
),
LibraryPreferences.ChapterSwipeAction.Download to stringResource(
R.string.action_download
),
),
),
),
@ -351,20 +373,36 @@ object SettingsLibraryScreen : SearchableSettings {
pref = libraryPreferences.swipeEpisodeStartAction(),
title = stringResource(R.string.pref_episode_swipe_start),
entries = mapOf(
LibraryPreferences.EpisodeSwipeAction.Disabled to stringResource(R.string.action_disable),
LibraryPreferences.EpisodeSwipeAction.ToggleBookmark to stringResource(R.string.action_bookmark_episode),
LibraryPreferences.EpisodeSwipeAction.ToggleSeen to stringResource(R.string.action_mark_as_seen),
LibraryPreferences.EpisodeSwipeAction.Download to stringResource(R.string.action_download),
LibraryPreferences.EpisodeSwipeAction.Disabled to stringResource(
R.string.action_disable
),
LibraryPreferences.EpisodeSwipeAction.ToggleBookmark to stringResource(
R.string.action_bookmark_episode
),
LibraryPreferences.EpisodeSwipeAction.ToggleSeen to stringResource(
R.string.action_mark_as_seen
),
LibraryPreferences.EpisodeSwipeAction.Download to stringResource(
R.string.action_download
),
),
),
Preference.PreferenceItem.ListPreference(
pref = libraryPreferences.swipeEpisodeEndAction(),
title = stringResource(R.string.pref_episode_swipe_end),
entries = mapOf(
LibraryPreferences.EpisodeSwipeAction.Disabled to stringResource(R.string.action_disable),
LibraryPreferences.EpisodeSwipeAction.ToggleBookmark to stringResource(R.string.action_bookmark_episode),
LibraryPreferences.EpisodeSwipeAction.ToggleSeen to stringResource(R.string.action_mark_as_seen),
LibraryPreferences.EpisodeSwipeAction.Download to stringResource(R.string.action_download),
LibraryPreferences.EpisodeSwipeAction.Disabled to stringResource(
R.string.action_disable
),
LibraryPreferences.EpisodeSwipeAction.ToggleBookmark to stringResource(
R.string.action_bookmark_episode
),
LibraryPreferences.EpisodeSwipeAction.ToggleSeen to stringResource(
R.string.action_mark_as_seen
),
LibraryPreferences.EpisodeSwipeAction.Download to stringResource(
R.string.action_download
),
),
),
),

View file

@ -40,6 +40,7 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
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.Navigator
import cafe.adriel.voyager.navigator.currentOrThrow
@ -52,7 +53,6 @@ import eu.kanade.presentation.util.LocalBackPress
import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.R
import tachiyomi.presentation.core.components.material.Scaffold
import cafe.adriel.voyager.core.screen.Screen as VoyagerScreen
object SettingsMainScreen : Screen() {
@Composable
@ -146,7 +146,9 @@ object SettingsMainScreen : Screen() {
.clip(RoundedCornerShape(24.dp))
.then(
if (selected) {
Modifier.background(MaterialTheme.colorScheme.surfaceVariant)
Modifier.background(
MaterialTheme.colorScheme.surfaceVariant
)
} else {
Modifier
},
@ -247,7 +249,9 @@ object SettingsMainScreen : Screen() {
titleRes = R.string.pref_category_about,
subtitleRes = 0,
formatSubtitle = {
"${stringResource(R.string.app_name)} ${AboutScreen.getVersionName(withBuildDate = false)}"
"${stringResource(R.string.app_name)} ${AboutScreen.getVersionName(
withBuildDate = false
)}"
},
icon = Icons.Outlined.Info,
screen = AboutScreen,

View file

@ -77,7 +77,10 @@ object SettingsPlayerScreen : SearchableSettings {
getOrientationGroup(playerPreferences = playerPreferences),
getSeekingGroup(playerPreferences = playerPreferences),
if (deviceSupportsPip) getPipGroup(playerPreferences = playerPreferences) else null,
getExternalPlayerGroup(playerPreferences = playerPreferences, basePreferences = basePreferences),
getExternalPlayerGroup(
playerPreferences = playerPreferences,
basePreferences = basePreferences
),
)
}
@ -147,13 +150,27 @@ object SettingsPlayerScreen : SearchableSettings {
pref = defaultPlayerOrientationType,
title = stringResource(R.string.pref_default_player_orientation),
entries = mapOf(
ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR to stringResource(R.string.rotation_free),
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT to stringResource(R.string.rotation_portrait),
ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT to stringResource(R.string.rotation_reverse_portrait),
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE to stringResource(R.string.rotation_landscape),
ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE to stringResource(R.string.rotation_reverse_landscape),
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT to stringResource(R.string.rotation_sensor_portrait),
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE to stringResource(R.string.rotation_sensor_landscape),
ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR to stringResource(
R.string.rotation_free
),
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT to stringResource(
R.string.rotation_portrait
),
ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT to stringResource(
R.string.rotation_reverse_portrait
),
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE to stringResource(
R.string.rotation_landscape
),
ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE to stringResource(
R.string.rotation_reverse_landscape
),
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT to stringResource(
R.string.rotation_sensor_portrait
),
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE to stringResource(
R.string.rotation_sensor_landscape
),
),
),
Preference.PreferenceItem.SwitchPreference(
@ -164,18 +181,30 @@ object SettingsPlayerScreen : SearchableSettings {
pref = defaultPlayerOrientationPortrait,
title = stringResource(R.string.pref_default_portrait_orientation),
entries = mapOf(
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT to stringResource(R.string.rotation_portrait),
ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT to stringResource(R.string.rotation_reverse_portrait),
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT to stringResource(R.string.rotation_sensor_portrait),
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT to stringResource(
R.string.rotation_portrait
),
ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT to stringResource(
R.string.rotation_reverse_portrait
),
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT to stringResource(
R.string.rotation_sensor_portrait
),
),
),
Preference.PreferenceItem.ListPreference(
pref = defaultPlayerOrientationLandscape,
title = stringResource(R.string.pref_default_landscape_orientation),
entries = mapOf(
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE to stringResource(R.string.rotation_landscape),
ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE to stringResource(R.string.rotation_reverse_landscape),
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE to stringResource(R.string.rotation_sensor_landscape),
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE to stringResource(
R.string.rotation_landscape
),
ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE to stringResource(
R.string.rotation_reverse_landscape
),
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE to stringResource(
R.string.rotation_sensor_landscape
),
),
),
),
@ -309,7 +338,10 @@ object SettingsPlayerScreen : SearchableSettings {
}
@Composable
private fun getExternalPlayerGroup(playerPreferences: PlayerPreferences, basePreferences: BasePreferences): Preference.PreferenceGroup {
private fun getExternalPlayerGroup(
playerPreferences: PlayerPreferences,
basePreferences: BasePreferences
): Preference.PreferenceGroup {
val alwaysUseExternalPlayer = playerPreferences.alwaysUseExternalPlayer()
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.ReadingModeType
import eu.kanade.tachiyomi.util.system.isReleaseBuildType
import java.text.NumberFormat
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.text.NumberFormat
object SettingsReaderScreen : SearchableSettings {
@ -176,9 +176,15 @@ object SettingsReaderScreen : SearchableSettings {
title = stringResource(R.string.pref_read_with_tapping_inverted),
entries = mapOf(
ReaderPreferences.TappingInvertMode.NONE to stringResource(R.string.none),
ReaderPreferences.TappingInvertMode.HORIZONTAL to stringResource(R.string.tapping_inverted_horizontal),
ReaderPreferences.TappingInvertMode.VERTICAL to stringResource(R.string.tapping_inverted_vertical),
ReaderPreferences.TappingInvertMode.BOTH to stringResource(R.string.tapping_inverted_both),
ReaderPreferences.TappingInvertMode.HORIZONTAL to stringResource(
R.string.tapping_inverted_horizontal
),
ReaderPreferences.TappingInvertMode.VERTICAL to stringResource(
R.string.tapping_inverted_vertical
),
ReaderPreferences.TappingInvertMode.BOTH to stringResource(
R.string.tapping_inverted_both
),
),
enabled = navMode != 5,
),
@ -268,9 +274,15 @@ object SettingsReaderScreen : SearchableSettings {
title = stringResource(R.string.pref_read_with_tapping_inverted),
entries = mapOf(
ReaderPreferences.TappingInvertMode.NONE to stringResource(R.string.none),
ReaderPreferences.TappingInvertMode.HORIZONTAL to stringResource(R.string.tapping_inverted_horizontal),
ReaderPreferences.TappingInvertMode.VERTICAL to stringResource(R.string.tapping_inverted_vertical),
ReaderPreferences.TappingInvertMode.BOTH to stringResource(R.string.tapping_inverted_both),
ReaderPreferences.TappingInvertMode.HORIZONTAL to stringResource(
R.string.tapping_inverted_horizontal
),
ReaderPreferences.TappingInvertMode.VERTICAL to stringResource(
R.string.tapping_inverted_vertical
),
ReaderPreferences.TappingInvertMode.BOTH to stringResource(
R.string.tapping_inverted_both
),
),
enabled = navMode != 5,
),
@ -289,10 +301,18 @@ object SettingsReaderScreen : SearchableSettings {
pref = readerPreferences.readerHideThreshold(),
title = stringResource(R.string.pref_hide_threshold),
entries = mapOf(
ReaderPreferences.ReaderHideThreshold.HIGHEST to stringResource(R.string.pref_highest),
ReaderPreferences.ReaderHideThreshold.HIGH to stringResource(R.string.pref_high),
ReaderPreferences.ReaderHideThreshold.LOW to stringResource(R.string.pref_low),
ReaderPreferences.ReaderHideThreshold.LOWEST to stringResource(R.string.pref_lowest),
ReaderPreferences.ReaderHideThreshold.HIGHEST to stringResource(
R.string.pref_highest
),
ReaderPreferences.ReaderHideThreshold.HIGH to stringResource(
R.string.pref_high
),
ReaderPreferences.ReaderHideThreshold.LOW to stringResource(
R.string.pref_low
),
ReaderPreferences.ReaderHideThreshold.LOWEST to stringResource(
R.string.pref_lowest
),
),
),
Preference.PreferenceItem.SwitchPreference(

View file

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

View file

@ -54,7 +54,11 @@ object SettingsSecurityScreen : SearchableSettings {
when (it) {
-1 -> stringResource(R.string.lock_never)
0 -> stringResource(R.string.lock_always)
else -> pluralStringResource(id = R.plurals.lock_after_mins, count = it, it)
else -> pluralStringResource(
id = R.plurals.lock_after_mins,
count = it,
it
)
}
},
onValueChanged = {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -75,7 +75,10 @@ class WorkerInfoScreen : Screen() {
title = stringResource(R.string.action_copy_to_clipboard),
icon = Icons.Default.ContentCopy,
onClick = {
context.copyToClipboard(title, enqueued + finished + running)
context.copyToClipboard(
title,
enqueued + finished + running
)
},
),
),
@ -123,7 +126,13 @@ class WorkerInfoScreen : Screen() {
private val workManager = context.workManager
val finished = workManager
.getWorkInfosLiveData(WorkQuery.fromStates(WorkInfo.State.SUCCEEDED, WorkInfo.State.FAILED, WorkInfo.State.CANCELLED))
.getWorkInfosLiveData(
WorkQuery.fromStates(
WorkInfo.State.SUCCEEDED,
WorkInfo.State.FAILED,
WorkInfo.State.CANCELLED
)
)
.asFlow()
.map(::constructString)
.stateIn(ioCoroutineScope, SharingStarted.WhileSubscribed(), "")

View file

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

View file

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

View file

@ -115,8 +115,16 @@ fun <T> TriStateListDialog(
}
}
if (!listState.isScrolledToStart()) HorizontalDivider(modifier = Modifier.align(Alignment.TopCenter))
if (!listState.isScrolledToEnd()) HorizontalDivider(modifier = Modifier.align(Alignment.BottomCenter))
if (!listState.isScrolledToStart()) {
HorizontalDivider(
modifier = Modifier.align(Alignment.TopCenter)
)
}
if (!listState.isScrolledToEnd()) {
HorizontalDivider(
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.util.toDurationString
import eu.kanade.tachiyomi.R
import tachiyomi.presentation.core.components.material.padding
import java.util.Locale
import kotlin.time.DurationUnit
import kotlin.time.toDuration
import tachiyomi.presentation.core.components.material.padding
@Composable
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.util.toDurationString
import eu.kanade.tachiyomi.R
import tachiyomi.presentation.core.components.material.padding
import java.util.Locale
import kotlin.time.DurationUnit
import kotlin.time.toDuration
import tachiyomi.presentation.core.components.material.padding
@Composable
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.unit.dp
import eu.kanade.presentation.util.isTabletUi
import kotlin.random.Random
import tachiyomi.domain.category.model.Category
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.screens.LoadingScreen
import kotlin.random.Random
@Composable
fun StorageScreenContent(

View file

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

View file

@ -77,7 +77,9 @@ fun ChapterNavigator(
) {
Icon(
imageVector = Icons.Outlined.SkipPrevious,
contentDescription = stringResource(if (isRtl) R.string.action_next_chapter else R.string.action_previous_chapter),
contentDescription = stringResource(
if (isRtl) R.string.action_next_chapter else R.string.action_previous_chapter
),
)
}
@ -128,7 +130,9 @@ fun ChapterNavigator(
) {
Icon(
imageVector = Icons.Outlined.SkipNext,
contentDescription = stringResource(if (isRtl) R.string.action_previous_chapter else R.string.action_next_chapter),
contentDescription = stringResource(
if (isRtl) R.string.action_previous_chapter else R.string.action_next_chapter
),
)
}
}

View file

@ -67,7 +67,10 @@ fun ChapterTransition(
bottomChapter = currChapter,
bottomChapterDownloaded = currChapterDownloaded,
fallbackLabel = stringResource(R.string.transition_no_previous),
chapterGap = calculateChapterGap(currChapter.toDomainChapter(), goingToChapter?.toDomainChapter()),
chapterGap = calculateChapterGap(
currChapter.toDomainChapter(),
goingToChapter?.toDomainChapter()
),
)
}
is ChapterTransition.Next -> {
@ -79,7 +82,10 @@ fun ChapterTransition(
bottomChapter = goingToChapter,
bottomChapterDownloaded = goingToChapterDownloaded,
fallbackLabel = stringResource(R.string.transition_no_next),
chapterGap = calculateChapterGap(goingToChapter?.toDomainChapter(), currChapter.toDomainChapter()),
chapterGap = calculateChapterGap(
goingToChapter?.toDomainChapter(),
currChapter.toDomainChapter()
),
)
}
}
@ -193,7 +199,11 @@ private fun ChapterGapWarning(
)
Text(
text = pluralStringResource(R.plurals.missing_chapters_warning, count = gapCount, gapCount),
text = pluralStringResource(
R.plurals.missing_chapters_warning,
count = gapCount,
gapCount
),
style = MaterialTheme.typography.bodyMedium,
)
}
@ -312,7 +322,10 @@ private fun TransitionTextPreview() {
TachiyomiTheme {
Surface(modifier = Modifier.padding(48.dp)) {
ChapterTransition(
transition = ChapterTransition.Next(ReaderChapter(FakeChapter), ReaderChapter(FakeChapter)),
transition = ChapterTransition.Next(
ReaderChapter(FakeChapter),
ReaderChapter(FakeChapter)
),
currChapterDownloaded = false,
goingToChapterDownloaded = true,
)
@ -326,7 +339,10 @@ private fun TransitionTextLongTitlePreview() {
TachiyomiTheme {
Surface(modifier = Modifier.padding(48.dp)) {
ChapterTransition(
transition = ChapterTransition.Next(ReaderChapter(FakeChapterLongTitle), ReaderChapter(FakeChapter)),
transition = ChapterTransition.Next(
ReaderChapter(FakeChapterLongTitle),
ReaderChapter(FakeChapter)
),
currChapterDownloaded = true,
goingToChapterDownloaded = true,
)
@ -340,7 +356,10 @@ private fun TransitionTextWithGapPreview() {
TachiyomiTheme {
Surface(modifier = Modifier.padding(48.dp)) {
ChapterTransition(
transition = ChapterTransition.Next(ReaderChapter(FakeChapter), ReaderChapter(FakeGapChapter)),
transition = ChapterTransition.Next(
ReaderChapter(FakeChapter),
ReaderChapter(FakeGapChapter)
),
currChapterDownloaded = true,
goingToChapterDownloaded = false,
)

View file

@ -30,7 +30,9 @@ fun OrientationModeSelectDialog(
onChange: (Int) -> Unit,
) {
val manga by screenModel.mangaFlow.collectAsState()
val orientationType = remember(manga) { OrientationType.fromPreference(manga?.orientationType?.toInt()) }
val orientationType = remember(manga) { OrientationType.fromPreference(
manga?.orientationType?.toInt()
) }
AdaptiveSheet(
onDismissRequest = onDismissRequest,

View file

@ -30,7 +30,9 @@ fun ReadingModeSelectDialog(
onChange: (Int) -> Unit,
) {
val manga by screenModel.mangaFlow.collectAsState()
val readingMode = remember(manga) { ReadingModeType.fromPreference(manga?.readingModeType?.toInt()) }
val readingMode = remember(manga) { ReadingModeType.fromPreference(
manga?.readingModeType?.toInt()
) }
AdaptiveSheet(
onDismissRequest = onDismissRequest,

View file

@ -17,12 +17,12 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType
import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonViewer
import eu.kanade.tachiyomi.util.system.isReleaseBuildType
import java.text.NumberFormat
import tachiyomi.presentation.core.components.CheckboxItem
import tachiyomi.presentation.core.components.HeadingItem
import tachiyomi.presentation.core.components.SettingsChipRow
import tachiyomi.presentation.core.components.SliderItem
import tachiyomi.presentation.core.util.collectAsState
import java.text.NumberFormat
private val readingModeOptions = ReadingModeType.entries.map { it.stringRes to it }
private val orientationTypeOptions = OrientationType.entries.map { it.stringRes to it }
@ -33,7 +33,9 @@ internal fun ColumnScope.ReadingModePage(screenModel: ReaderSettingsScreenModel)
HeadingItem(R.string.pref_category_for_this_series)
val manga by screenModel.mangaFlow.collectAsState()
val readingMode = remember(manga) { ReadingModeType.fromPreference(manga?.readingModeType?.toInt()) }
val readingMode = remember(manga) { ReadingModeType.fromPreference(
manga?.readingModeType?.toInt()
) }
SettingsChipRow(R.string.pref_category_reading_mode) {
readingModeOptions.map { (stringRes, it) ->
FilterChip(
@ -44,7 +46,9 @@ internal fun ColumnScope.ReadingModePage(screenModel: ReaderSettingsScreenModel)
}
}
val orientationType = remember(manga) { OrientationType.fromPreference(manga?.orientationType?.toInt()) }
val orientationType = remember(manga) { OrientationType.fromPreference(
manga?.orientationType?.toInt()
) }
SettingsChipRow(R.string.rotation_type) {
orientationTypeOptions.map { (stringRes, it) ->
FilterChip(

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