From 953f5fb0253879547a94f88231b36ce81a35b48e Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 5 Nov 2023 09:14:57 -0500 Subject: [PATCH] Lint fixes --- .../interactor/SyncChaptersWithSource.kt | 4 +++- .../presentation/browse/GlobalSearchScreen.kt | 4 +++- .../browse/components/BrowseSourceToolbar.kt | 6 ++++- .../presentation/category/CategoryScreen.kt | 4 +++- .../category/components/CategoryDialogs.kt | 20 ++++++++++++---- .../kanade/presentation/components/AppBar.kt | 6 ++++- .../library/LibrarySettingsDialog.kt | 12 ++++++++-- .../manga/ChapterSettingsDialog.kt | 3 ++- .../settings/screen/SettingsLibraryScreen.kt | 24 ++++++++++++------- .../settings/screen/SettingsReaderScreen.kt | 24 +++++++++---------- .../settings/screen/SettingsSearchScreen.kt | 6 ++++- .../settings/screen/debug/DebugInfoScreen.kt | 3 ++- .../tachiyomi/data/backup/BackupRestorer.kt | 8 ++++++- .../data/backup/models/BackupChapter.kt | 18 ++++++++++++-- .../data/backup/models/BackupTracking.kt | 15 +++++++++++- .../tachiyomi/data/download/DownloadCache.kt | 5 ++-- .../data/library/LibraryUpdateNotifier.kt | 7 ++++-- .../tachiyomi/data/track/BaseTracker.kt | 6 ++++- .../tachiyomi/data/track/kitsu/KitsuApi.kt | 4 +++- .../data/track/shikimori/ShikimoriApi.kt | 3 ++- .../extension/api/ExtensionGithubApi.kt | 5 +++- .../extension/util/ExtensionInstaller.kt | 5 +++- .../browse/extension/ExtensionsScreenModel.kt | 3 ++- .../tachiyomi/ui/manga/MangaScreenModel.kt | 11 +++++++-- .../tachiyomi/ui/reader/ReaderActivity.kt | 3 ++- .../ui/reader/viewer/ReaderPageImageView.kt | 8 ++++++- .../ui/reader/viewer/pager/PagerViewer.kt | 3 ++- .../tachiyomi/util/lang/DateExtensions.kt | 3 ++- .../util/system/NotificationExtensions.kt | 16 +++++++++++-- 29 files changed, 182 insertions(+), 57 deletions(-) diff --git a/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithSource.kt b/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithSource.kt index d233406f0e..fd878d5f8c 100644 --- a/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithSource.kt +++ b/app/src/main/java/eu/kanade/domain/chapter/interactor/SyncChaptersWithSource.kt @@ -116,7 +116,9 @@ class SyncChaptersWithSource( } else { if (shouldUpdateDbChapter.await(dbChapter, chapter)) { val shouldRenameChapter = downloadProvider.isChapterDirNameChanged(dbChapter, chapter) && - downloadManager.isChapterDownloaded(dbChapter.name, dbChapter.scanlator, manga.title, manga.source) + downloadManager.isChapterDownloaded( + dbChapter.name, dbChapter.scanlator, manga.title, manga.source, + ) if (shouldRenameChapter) { downloadManager.renameChapter(source, manga, dbChapter, chapter) diff --git a/app/src/main/java/eu/kanade/presentation/browse/GlobalSearchScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/GlobalSearchScreen.kt index 4df4179fe1..508bffe2d2 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/GlobalSearchScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/GlobalSearchScreen.kt @@ -74,7 +74,9 @@ internal fun GlobalSearchContent( items.forEach { (source, result) -> item(key = source.id) { GlobalSearchResultItem( - title = fromSourceId?.let { "▶ ${source.name}".takeIf { source.id == fromSourceId } } ?: source.name, + title = fromSourceId?.let { + "▶ ${source.name}".takeIf { source.id == fromSourceId } + } ?: source.name, subtitle = LocaleHelper.getDisplayName(source.lang), onClick = { onClickSource(source) }, ) { diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceToolbar.kt b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceToolbar.kt index ccea144a28..4ee222e22a 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceToolbar.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceToolbar.kt @@ -56,7 +56,11 @@ fun BrowseSourceToolbar( actions = listOfNotNull( AppBar.Action( title = stringResource(R.string.action_display_mode), - icon = if (displayMode == LibraryDisplayMode.List) Icons.Filled.ViewList else Icons.Filled.ViewModule, + icon = if (displayMode == LibraryDisplayMode.List) { + Icons.Filled.ViewList + } else { + Icons.Filled.ViewModule + }, onClick = { selectingDisplayMode = true }, ), if (isLocalSource) { diff --git a/app/src/main/java/eu/kanade/presentation/category/CategoryScreen.kt b/app/src/main/java/eu/kanade/presentation/category/CategoryScreen.kt index 485d3e4ff4..7d43278141 100644 --- a/app/src/main/java/eu/kanade/presentation/category/CategoryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/category/CategoryScreen.kt @@ -75,7 +75,9 @@ fun CategoryScreen( CategoryContent( categories = state.categories, lazyListState = lazyListState, - paddingValues = paddingValues + topSmallPaddingValues + PaddingValues(horizontal = MaterialTheme.padding.medium), + paddingValues = paddingValues + + topSmallPaddingValues + + PaddingValues(horizontal = MaterialTheme.padding.medium), onClickRename = onClickRename, onClickDelete = onClickDelete, onMoveUp = onClickMoveUp, diff --git a/app/src/main/java/eu/kanade/presentation/category/components/CategoryDialogs.kt b/app/src/main/java/eu/kanade/presentation/category/components/CategoryDialogs.kt index ad30e4e2d1..684fc7dad7 100644 --- a/app/src/main/java/eu/kanade/presentation/category/components/CategoryDialogs.kt +++ b/app/src/main/java/eu/kanade/presentation/category/components/CategoryDialogs.kt @@ -74,7 +74,11 @@ fun CategoryCreateDialog( onValueChange = { name = it }, label = { Text(text = stringResource(R.string.name)) }, supportingText = { - val msgRes = if (name.isNotEmpty() && nameAlreadyExists) R.string.error_category_exists else R.string.information_required_plain + val msgRes = if (name.isNotEmpty() && nameAlreadyExists) { + R.string.error_category_exists + } else { + R.string.information_required_plain + } Text(text = stringResource(msgRes)) }, isError = name.isNotEmpty() && nameAlreadyExists, @@ -134,7 +138,11 @@ fun CategoryRenameDialog( }, label = { Text(text = stringResource(R.string.name)) }, supportingText = { - val msgRes = if (valueHasChanged && nameAlreadyExists) R.string.error_category_exists else R.string.information_required_plain + val msgRes = if (valueHasChanged && nameAlreadyExists) { + R.string.error_category_exists + } else { + R.string.information_required_plain + } Text(text = stringResource(msgRes)) }, isError = valueHasChanged && nameAlreadyExists, @@ -257,8 +265,12 @@ fun ChangeCategoryDialog( onClick = { onDismissRequest() onConfirm( - selection.filter { it is CheckboxState.State.Checked || it is CheckboxState.TriState.Include }.map { it.value.id }, - selection.filter { it is CheckboxState.State.None || it is CheckboxState.TriState.None }.map { it.value.id }, + selection + .filter { it is CheckboxState.State.Checked || it is CheckboxState.TriState.Include } + .map { it.value.id }, + selection + .filter { it is CheckboxState.State.None || it is CheckboxState.TriState.None } + .map { it.value.id }, ) }, ) { diff --git a/app/src/main/java/eu/kanade/presentation/components/AppBar.kt b/app/src/main/java/eu/kanade/presentation/components/AppBar.kt index 7ccfae0bd8..96278f5062 100644 --- a/app/src/main/java/eu/kanade/presentation/components/AppBar.kt +++ b/app/src/main/java/eu/kanade/presentation/components/AppBar.kt @@ -370,7 +370,11 @@ fun SearchToolbar( @Composable fun UpIcon(navigationIcon: ImageVector? = null) { val icon = navigationIcon - ?: if (LocalLayoutDirection.current == LayoutDirection.Ltr) Icons.Outlined.ArrowBack else Icons.Outlined.ArrowForward + ?: if (LocalLayoutDirection.current == LayoutDirection.Ltr) { + Icons.Outlined.ArrowBack + } else { + Icons.Outlined.ArrowForward + } Icon( imageVector = icon, contentDescription = stringResource(R.string.abc_action_bar_up_description), diff --git a/app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt b/app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt index c977409406..4e0bd45d54 100644 --- a/app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/library/LibrarySettingsDialog.kt @@ -167,8 +167,16 @@ private fun ColumnScope.SortPage( onClick = { val isTogglingDirection = sortingMode == mode val direction = when { - isTogglingDirection -> if (sortDescending) LibrarySort.Direction.Ascending else LibrarySort.Direction.Descending - else -> if (sortDescending) LibrarySort.Direction.Descending else LibrarySort.Direction.Ascending + isTogglingDirection -> if (sortDescending) { + LibrarySort.Direction.Ascending + } else { + LibrarySort.Direction.Descending + } + else -> if (sortDescending) { + LibrarySort.Direction.Descending + } else { + LibrarySort.Direction.Ascending + } } screenModel.setSort(category, mode, direction) }, diff --git a/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt b/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt index dd4b29c723..7370a14491 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/ChapterSettingsDialog.kt @@ -83,7 +83,8 @@ fun ChapterSettingsDialog( 0 -> { FilterPage( downloadFilter = manga?.downloadedFilter ?: TriState.DISABLED, - onDownloadFilterChanged = onDownloadFilterChanged.takeUnless { manga?.forceDownloaded() == true }, + onDownloadFilterChanged = onDownloadFilterChanged + .takeUnless { manga?.forceDownloaded() == true }, unreadFilter = manga?.unreadFilter ?: TriState.DISABLED, onUnreadFilterChanged = onUnreadFilterChanged, bookmarkedFilter = manga?.bookmarkedFilter ?: TriState.DISABLED, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt index 6dc95d6b08..0f978b5738 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt @@ -225,20 +225,28 @@ object SettingsLibraryScreen : SearchableSettings { pref = libraryPreferences.swipeToStartAction(), title = stringResource(R.string.pref_chapter_swipe_start), entries = mapOf( - LibraryPreferences.ChapterSwipeAction.Disabled to stringResource(R.string.disabled), - 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.disabled), + 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.swipeToEndAction(), title = stringResource(R.string.pref_chapter_swipe_end), entries = mapOf( - LibraryPreferences.ChapterSwipeAction.Disabled to stringResource(R.string.disabled), - 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.disabled), + 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), ), ), ), diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt index 14e0fd9dfd..4d975200a1 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsReaderScreen.kt @@ -174,12 +174,12 @@ object SettingsReaderScreen : SearchableSettings { Preference.PreferenceItem.ListPreference( pref = readerPreferences.pagerNavInverted(), 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), - ), + entries = listOf( + ReaderPreferences.TappingInvertMode.NONE, + ReaderPreferences.TappingInvertMode.HORIZONTAL, + ReaderPreferences.TappingInvertMode.VERTICAL, + ReaderPreferences.TappingInvertMode.BOTH, + ).associateWith { stringResource(it.titleResId) }, enabled = navMode != 5, ), Preference.PreferenceItem.ListPreference( @@ -266,12 +266,12 @@ object SettingsReaderScreen : SearchableSettings { Preference.PreferenceItem.ListPreference( pref = readerPreferences.webtoonNavInverted(), 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), - ), + entries = listOf( + ReaderPreferences.TappingInvertMode.NONE, + ReaderPreferences.TappingInvertMode.HORIZONTAL, + ReaderPreferences.TappingInvertMode.VERTICAL, + ReaderPreferences.TappingInvertMode.BOTH, + ).associateWith { stringResource(it.titleResId) }, enabled = navMode != 5, ), Preference.PreferenceItem.SliderPreference( diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSearchScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSearchScreen.kt index b67ac38c51..adf184a9f8 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSearchScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsSearchScreen.kt @@ -202,7 +202,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, ) } diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/DebugInfoScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/DebugInfoScreen.kt index 0e3bcde93d..c37db1c6c7 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/DebugInfoScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/debug/DebugInfoScreen.kt @@ -78,7 +78,8 @@ class DebugInfoScreen : Screen() { value = when (result) { ProfileVerifier.CompilationStatus.RESULT_CODE_NO_PROFILE -> "No profile installed" ProfileVerifier.CompilationStatus.RESULT_CODE_COMPILED_WITH_PROFILE -> "Compiled" - ProfileVerifier.CompilationStatus.RESULT_CODE_COMPILED_WITH_PROFILE_NON_MATCHING -> "Compiled non-matching" + ProfileVerifier.CompilationStatus.RESULT_CODE_COMPILED_WITH_PROFILE_NON_MATCHING -> + "Compiled non-matching" ProfileVerifier.CompilationStatus.RESULT_CODE_ERROR_CACHE_FILE_EXISTS_BUT_CANNOT_BE_READ, ProfileVerifier.CompilationStatus.RESULT_CODE_ERROR_CANT_WRITE_PROFILE_VERIFICATION_RESULT_CACHE_FILE, ProfileVerifier.CompilationStatus.RESULT_CODE_ERROR_PACKAGE_NAME_DOES_NOT_EXIST, diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestorer.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestorer.kt index 54c153b33c..f78cdceca7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestorer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestorer.kt @@ -446,7 +446,13 @@ class BackupRestorer( return backupManga } - private suspend fun restoreExtras(manga: Manga, categories: List, history: List, tracks: List, backupCategories: List) { + private suspend fun restoreExtras( + manga: Manga, + categories: List, + history: List, + tracks: List, + backupCategories: List, + ) { restoreCategories(manga, categories, backupCategories) restoreHistory(history) restoreTracking(manga, tracks) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupChapter.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupChapter.kt index 6d8cba4e2d..567ca372cd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupChapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupChapter.kt @@ -39,7 +39,21 @@ data class BackupChapter( } } -val backupChapterMapper = { _: Long, _: Long, url: String, name: String, scanlator: String?, read: Boolean, bookmark: Boolean, lastPageRead: Long, chapterNumber: Double, source_order: Long, dateFetch: Long, dateUpload: Long, lastModifiedAt: Long -> +val backupChapterMapper = { + _: Long, + _: Long, + url: String, + name: String, + scanlator: String?, + read: Boolean, + bookmark: Boolean, + lastPageRead: Long, + chapterNumber: Double, + sourceOrder: Long, + dateFetch: Long, + dateUpload: Long, + lastModifiedAt: Long, + -> BackupChapter( url = url, name = name, @@ -50,7 +64,7 @@ val backupChapterMapper = { _: Long, _: Long, url: String, name: String, scanlat lastPageRead = lastPageRead, dateFetch = dateFetch, dateUpload = dateUpload, - sourceOrder = source_order, + sourceOrder = sourceOrder, lastModifiedAt = lastModifiedAt, ) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupTracking.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupTracking.kt index 0cbbf51a0e..b45b30ca28 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupTracking.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupTracking.kt @@ -54,7 +54,20 @@ data class BackupTracking( } val backupTrackMapper = { - _: Long, _: Long, syncId: Long, mediaId: Long, libraryId: Long?, title: String, lastChapterRead: Double, totalChapters: Long, status: Long, score: Double, remoteUrl: String, startDate: Long, finishDate: Long -> + _: Long, + _: Long, + syncId: Long, + mediaId: Long, + libraryId: Long?, + title: String, + lastChapterRead: Double, + totalChapters: Long, + status: Long, + score: Double, + remoteUrl: String, + startDate: Long, + finishDate: Long, + -> BackupTracking( syncId = syncId.toInt(), mediaId = mediaId, diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt index 018a55f1b9..ff11da580f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt @@ -358,9 +358,8 @@ class DownloadCache( // Folder of images it.isDirectory -> it.name // CBZ files - it.isFile && it.name?.endsWith(".cbz") == true -> it.name!!.substringBeforeLast( - ".cbz", - ) + it.isFile && it.name?.endsWith(".cbz") == true -> + it.name!!.substringBeforeLast(".cbz") // Anything else is irrelevant else -> null } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt index cc3a0d8d34..e590d7f4f7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt @@ -336,7 +336,9 @@ class LibraryUpdateNotifier(private val context: Context) { if (shouldTruncate) { // "Chapters 1, 2.5, 3, 4, 5 and 10 more" val remaining = displayableChapterNumbers.size - NOTIF_MAX_CHAPTERS - val joinedChapterNumbers = displayableChapterNumbers.take(NOTIF_MAX_CHAPTERS).joinToString(", ") + val joinedChapterNumbers = displayableChapterNumbers + .take(NOTIF_MAX_CHAPTERS) + .joinToString(", ") context.resources.getQuantityString( R.plurals.notification_chapters_multiple_and_more, remaining, @@ -371,7 +373,8 @@ class LibraryUpdateNotifier(private val context: Context) { } companion object { - const val HELP_WARNING_URL = "https://tachiyomi.org/docs/faq/library#why-am-i-warned-about-large-bulk-updates-and-downloads" + const val HELP_WARNING_URL = + "https://tachiyomi.org/docs/faq/library#why-am-i-warned-about-large-bulk-updates-and-downloads" } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/BaseTracker.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/BaseTracker.kt index 277638bc1d..5a57e25635 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/BaseTracker.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/BaseTracker.kt @@ -79,7 +79,11 @@ abstract class BaseTracker( } override suspend fun setRemoteLastChapterRead(track: Track, chapterNumber: Int) { - if (track.last_chapter_read == 0f && track.last_chapter_read < chapterNumber && track.status != getRereadingStatus()) { + if ( + track.last_chapter_read == 0f && + track.last_chapter_read < chapterNumber && + track.status != getRereadingStatus() + ) { track.status = getReadingStatus() } track.last_chapter_read = chapterNumber.toFloat() diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuApi.kt index 1764c02906..2d54b266be 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuApi.kt @@ -278,7 +278,9 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor) "https://AWQO5J657S-dsn.algolia.net/1/indexes/production_media/query/" private const val algoliaAppId = "AWQO5J657S" private const val algoliaFilter = - "&facetFilters=%5B%22kind%3Amanga%22%5D&attributesToRetrieve=%5B%22synopsis%22%2C%22canonicalTitle%22%2C%22chapterCount%22%2C%22posterImage%22%2C%22startDate%22%2C%22subtype%22%2C%22endDate%22%2C%20%22id%22%5D" + "&facetFilters=%5B%22kind%3Amanga%22%5D&attributesToRetrieve=" + + "%5B%22synopsis%22%2C%22canonicalTitle%22%2C%22chapterCount%22%2C%22" + + "posterImage%22%2C%22startDate%22%2C%22subtype%22%2C%22endDate%22%2C%20%22id%22%5D" fun mangaUrl(remoteId: Long): String { return baseMangaUrl + remoteId diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt index 8e90336078..8ae22f3c97 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt @@ -59,7 +59,8 @@ class ShikimoriApi( ).awaitSuccess() .parseAs() .let { - track.library_id = it["id"]!!.jsonPrimitive.long // save id of the entry for possible future delete request + // save id of the entry for possible future delete request + track.library_id = it["id"]!!.jsonPrimitive.long } track } diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt index 82d10cb76f..f2a1c25ed8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt @@ -71,7 +71,10 @@ internal class ExtensionGithubApi { } } - suspend fun checkForUpdates(context: Context, fromAvailableExtensionList: Boolean = false): List? { + suspend fun checkForUpdates( + context: Context, + fromAvailableExtensionList: Boolean = false, + ): List? { // Limit checks to once a day at most if (!fromAvailableExtensionList && Date().time < lastExtCheck.get() + 1.days.inWholeMilliseconds) { return null diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstaller.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstaller.kt index 01f212d8e5..ff384e56f1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstaller.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstaller.kt @@ -133,7 +133,10 @@ internal class ExtensionInstaller(private val context: Context) { emit(downloadStatus) // Stop polling when the download fails or finishes - if (downloadStatus == DownloadManager.STATUS_SUCCESSFUL || downloadStatus == DownloadManager.STATUS_FAILED) { + if ( + downloadStatus == DownloadManager.STATUS_SUCCESSFUL || + downloadStatus == DownloadManager.STATUS_FAILED + ) { return@flow } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsScreenModel.kt index 7bef3a4c1c..04a2b408d5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionsScreenModel.kt @@ -100,7 +100,8 @@ class ExtensionsScreenModel( .groupBy { it.lang } .toSortedMap(LocaleHelper.comparator) .map { (lang, exts) -> - ExtensionUiModel.Header.Text(LocaleHelper.getSourceDisplayName(lang, context)) to exts.map(extensionMapper(downloads)) + ExtensionUiModel.Header.Text(LocaleHelper.getSourceDisplayName(lang, context)) to + exts.map(extensionMapper(downloads)) } if (languagesWithExtensions.isNotEmpty()) { itemsGroups.putAll(languagesWithExtensions) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt index 37c4dab9b9..004414bc5d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt @@ -133,7 +133,8 @@ class MangaScreenModel( val dateFormat by mutableStateOf(UiPreferences.dateFormat(uiPreferences.dateFormat().get())) private val skipFiltered by readerPreferences.skipFiltered().asState(screenModelScope) - val isUpdateIntervalEnabled = LibraryPreferences.MANGA_OUTSIDE_RELEASE_PERIOD in libraryPreferences.autoUpdateMangaRestrictions().get() + val isUpdateIntervalEnabled = + LibraryPreferences.MANGA_OUTSIDE_RELEASE_PERIOD in libraryPreferences.autoUpdateMangaRestrictions().get() private val selectedPositions: Array = arrayOf(-1, -1) // first and last selected index in list private val selectedChapterIds: HashSet = HashSet() @@ -744,7 +745,13 @@ class MangaScreenModel( screenModelScope.launchNonCancellable { val manga = successState?.manga ?: return@launchNonCancellable val categories = getCategories.await(manga.id).map { it.id } - if (chapters.isEmpty() || !manga.shouldDownloadNewChapters(categories, downloadPreferences)) return@launchNonCancellable + if ( + chapters.isEmpty() || + !manga.shouldDownloadNewChapters(categories, downloadPreferences) + ) { + return@launchNonCancellable + } + downloadChapters(chapters) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 9580af393d..a9428213f9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -470,7 +470,8 @@ class ReaderActivity : BaseActivity() { } else { if (readerPreferences.fullscreen().get()) { windowInsetsController.hide(WindowInsetsCompat.Type.systemBars()) - windowInsetsController.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE + windowInsetsController.systemBarsBehavior = + WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderPageImageView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderPageImageView.kt index 02d4cce9e5..c60e404e71 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderPageImageView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/ReaderPageImageView.kt @@ -110,7 +110,13 @@ open class ReaderPageImageView @JvmOverloads constructor( } private fun SubsamplingScaleImageView.landscapeZoom(forward: Boolean) { - if (config != null && config!!.landscapeZoom && config!!.minimumScaleType == SCALE_TYPE_CENTER_INSIDE && sWidth > sHeight && scale == minScale) { + if ( + config != null && + config!!.landscapeZoom && + config!!.minimumScaleType == SCALE_TYPE_CENTER_INSIDE && + sWidth > sHeight && + scale == minScale + ) { handler?.postDelayed(500) { val point = when (config!!.zoomStartPosition) { ZoomStartPosition.LEFT -> if (forward) PointF(0F, 0F) else PointF(sWidth.toFloat(), 0F) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt index 71ec13ffb2..573ba1246b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewer.kt @@ -268,7 +268,8 @@ abstract class PagerViewer(val activity: ReaderActivity) : Viewer { * Sets the active [chapters] on this pager. */ private fun setChaptersInternal(chapters: ViewerChapters) { - val forceTransition = config.alwaysShowChapterTransition || adapter.items.getOrNull(pager.currentItem) is ChapterTransition + val forceTransition = config.alwaysShowChapterTransition || + adapter.items.getOrNull(pager.currentItem) is ChapterTransition adapter.setChapters(chapters, forceTransition) // Layout the pager once a chapter is being set diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/lang/DateExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/lang/DateExtensions.kt index e2f6836853..797890ef58 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/lang/DateExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/lang/DateExtensions.kt @@ -56,7 +56,8 @@ fun Date.toRelativeString( return dateFormat.format(this) } val now = Date() - val difference = now.timeWithOffset.floorNearest(MILLISECONDS_IN_DAY) - this.timeWithOffset.floorNearest(MILLISECONDS_IN_DAY) + val difference = now.timeWithOffset.floorNearest(MILLISECONDS_IN_DAY) - + this.timeWithOffset.floorNearest(MILLISECONDS_IN_DAY) val days = difference.floorDiv(MILLISECONDS_IN_DAY).toInt() return when { difference < 0 -> dateFormat.format(this) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/NotificationExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/NotificationExtensions.kt index 8038f6115b..7a72a5173c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/NotificationExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/NotificationExtensions.kt @@ -23,7 +23,13 @@ fun Context.notify(id: Int, channelId: String, block: (NotificationCompat.Builde } fun Context.notify(id: Int, notification: Notification) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && PermissionChecker.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PermissionChecker.PERMISSION_GRANTED) { + if ( + Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && + PermissionChecker.checkSelfPermission( + this, + Manifest.permission.POST_NOTIFICATIONS, + ) != PermissionChecker.PERMISSION_GRANTED + ) { return } @@ -31,7 +37,13 @@ fun Context.notify(id: Int, notification: Notification) { } fun Context.notify(notificationWithIdAndTags: List) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && PermissionChecker.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PermissionChecker.PERMISSION_GRANTED) { + if ( + Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && + PermissionChecker.checkSelfPermission( + this, + Manifest.permission.POST_NOTIFICATIONS, + ) != PermissionChecker.PERMISSION_GRANTED + ) { return }