From cd3cb72b65d2f5f6ec038eb319717e21e3a1731e Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 10 Sep 2022 23:57:03 -0400 Subject: [PATCH] Bump dependencies + linting --- .../source/interactor/SetMigrateSorting.kt | 6 ++- .../browse/ExtensionDetailsScreen.kt | 4 +- .../presentation/components/MangaCover.kt | 7 ++- .../presentation/components/Scaffold.kt | 14 ++++-- .../components/VerticalFastScroller.kt | 16 +++++-- .../kanade/presentation/manga/MangaScreen.kt | 4 +- .../manga/MangaScreenConstants.kt | 2 +- .../manga/components/MangaInfoHeader.kt | 30 ++++++++----- .../eu/kanade/presentation/util/Scrollbar.kt | 20 ++++++--- .../java/eu/kanade/tachiyomi/Migrations.kt | 7 ++- .../data/backup/BackupFileValidator.kt | 7 ++- .../data/backup/models/BackupTracking.kt | 3 +- .../data/track/bangumi/BangumiInterceptor.kt | 44 +++++++++++-------- .../tachiyomi/data/track/komga/KomgaApi.kt | 7 ++- .../extension/api/ExtensionGithubApi.kt | 18 +++++--- .../util/ExtensionInstallReceiver.kt | 12 ++--- .../glance/UpdatesGridGlanceWidget.kt | 4 +- .../interceptor/RateLimitInterceptor.kt | 10 +++-- .../base/delegate/SecureActivityDelegate.kt | 2 +- .../migration/search/SearchPresenter.kt | 7 ++- .../tachiyomi/ui/library/LibraryPresenter.kt | 28 ++++++++---- .../tachiyomi/ui/manga/MangaController.kt | 3 +- .../ui/reader/loader/HttpPageLoader.kt | 4 +- .../ui/reader/setting/OrientationType.kt | 3 +- .../reader/viewer/pager/PagerViewerAdapter.kt | 3 +- .../tachiyomi/util/lang/RxCoroutineBridge.kt | 12 ++--- .../widget/ExtendedNavigationView.kt | 2 +- .../tachiyomi/widget/MaterialFastScroll.kt | 4 +- .../TachiyomiChangeHandlerFrameLayout.kt | 4 +- .../tachiyomi/widget/TachiyomiSearchView.kt | 4 +- gradle/androidx.versions.toml | 4 +- gradle/compose.versions.toml | 2 +- gradle/libs.versions.toml | 2 +- 33 files changed, 195 insertions(+), 104 deletions(-) diff --git a/app/src/main/java/eu/kanade/domain/source/interactor/SetMigrateSorting.kt b/app/src/main/java/eu/kanade/domain/source/interactor/SetMigrateSorting.kt index 2b74b61808..0b257a5d87 100644 --- a/app/src/main/java/eu/kanade/domain/source/interactor/SetMigrateSorting.kt +++ b/app/src/main/java/eu/kanade/domain/source/interactor/SetMigrateSorting.kt @@ -13,11 +13,13 @@ class SetMigrateSorting( enum class Mode { ALPHABETICAL, - TOTAL; + TOTAL, + ; } enum class Direction { ASCENDING, - DESCENDING; + DESCENDING, + ; } } diff --git a/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt index 10356878be..8ea7c6d1e1 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt @@ -338,7 +338,9 @@ private fun InfoText( val clickableModifier = if (onClick != null) { Modifier.clickable(interactionSource, indication = null) { onClick() } - } else Modifier + } else { + Modifier + } Column( modifier = modifier.then(clickableModifier), diff --git a/app/src/main/java/eu/kanade/presentation/components/MangaCover.kt b/app/src/main/java/eu/kanade/presentation/components/MangaCover.kt index 0b7765cef6..ab97e48e53 100644 --- a/app/src/main/java/eu/kanade/presentation/components/MangaCover.kt +++ b/app/src/main/java/eu/kanade/presentation/components/MangaCover.kt @@ -18,7 +18,8 @@ import eu.kanade.tachiyomi.R enum class MangaCover(val ratio: Float) { Square(1f / 1f), - Book(2f / 3f); + Book(2f / 3f), + ; @Composable operator fun invoke( @@ -42,7 +43,9 @@ enum class MangaCover(val ratio: Float) { role = Role.Button, onClick = onClick, ) - } else Modifier, + } else { + Modifier + }, ), contentScale = ContentScale.Crop, ) diff --git a/app/src/main/java/eu/kanade/presentation/components/Scaffold.kt b/app/src/main/java/eu/kanade/presentation/components/Scaffold.kt index 841113dc91..800405c3b3 100644 --- a/app/src/main/java/eu/kanade/presentation/components/Scaffold.kt +++ b/app/src/main/java/eu/kanade/presentation/components/Scaffold.kt @@ -220,12 +220,18 @@ private fun ScaffoldLayout( .asPaddingValues(this@SubcomposeLayout) val innerPadding = PaddingValues( top = - if (topBarHeight == 0) insets.calculateTopPadding() - else topBarHeight.toDp(), + if (topBarHeight == 0) { + insets.calculateTopPadding() + } else { + topBarHeight.toDp() + }, bottom = ( - if (bottomBarHeight == 0) insets.calculateBottomPadding() - else bottomBarHeight.toDp() + if (bottomBarHeight == 0) { + insets.calculateBottomPadding() + } else { + bottomBarHeight.toDp() + } ) + fabHeight.toDp(), start = insets.calculateLeftPadding((this@SubcomposeLayout).layoutDirection), end = insets.calculateRightPadding((this@SubcomposeLayout).layoutDirection), diff --git a/app/src/main/java/eu/kanade/presentation/components/VerticalFastScroller.kt b/app/src/main/java/eu/kanade/presentation/components/VerticalFastScroller.kt index c3e74c5c5b..06e762fb14 100644 --- a/app/src/main/java/eu/kanade/presentation/components/VerticalFastScroller.kt +++ b/app/src/main/java/eu/kanade/presentation/components/VerticalFastScroller.kt @@ -145,13 +145,17 @@ fun VerticalFastScroller( ) }, ) - } else Modifier, + } else { + Modifier + }, ) .then( // Exclude thumb from gesture area only when needed if (isThumbVisible && !isThumbDragged && !listState.isScrollInProgress) { Modifier.systemGestureExclusion() - } else Modifier, + } else { + Modifier + }, ) .height(ThumbLength) .padding(horizontal = 8.dp) @@ -321,13 +325,17 @@ fun VerticalGridFastScroller( ) }, ) - } else Modifier, + } else { + Modifier + }, ) .then( // Exclude thumb from gesture area only when needed if (isThumbVisible && !isThumbDragged && !state.isScrollInProgress) { Modifier.systemGestureExclusion() - } else Modifier, + } else { + Modifier + }, ) .height(ThumbLength) .padding(horizontal = 8.dp) diff --git a/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt b/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt index b0368a87d8..2f976bb480 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt @@ -673,7 +673,9 @@ private fun LazyListScope.sharedChapterItems( }, onDownloadClick = if (onDownloadChapter != null) { { onDownloadChapter(listOf(chapterItem), it) } - } else null, + } else { + null + }, ) } } diff --git a/app/src/main/java/eu/kanade/presentation/manga/MangaScreenConstants.kt b/app/src/main/java/eu/kanade/presentation/manga/MangaScreenConstants.kt index d86748824d..e98e85c545 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/MangaScreenConstants.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/MangaScreenConstants.kt @@ -6,7 +6,7 @@ enum class DownloadAction { NEXT_10_CHAPTERS, CUSTOM, UNREAD_CHAPTERS, - ALL_CHAPTERS + ALL_CHAPTERS, } enum class EditCoverAction { diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt index b51dc1cc6e..ce259acfbd 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt @@ -316,10 +316,12 @@ private fun MangaAndSourceTitlesLarge( .padding(top = 2.dp) .clickableNoIndication( onLongClick = { - if (!author.isNullOrBlank()) context.copyToClipboard( - author, - author, - ) + if (!author.isNullOrBlank()) { + context.copyToClipboard( + author, + author, + ) + } }, onClick = { if (!author.isNullOrBlank()) doSearch(author, true) }, ), @@ -428,10 +430,12 @@ private fun MangaAndSourceTitlesSmall( style = MaterialTheme.typography.titleLarge, modifier = Modifier.clickableNoIndication( onLongClick = { - if (title.isNotBlank()) context.copyToClipboard( - title, - title, - ) + if (title.isNotBlank()) { + context.copyToClipboard( + title, + title, + ) + } }, onClick = { if (title.isNotBlank()) doSearch(title, true) }, ), @@ -446,10 +450,12 @@ private fun MangaAndSourceTitlesSmall( .padding(top = 2.dp) .clickableNoIndication( onLongClick = { - if (!author.isNullOrBlank()) context.copyToClipboard( - author, - author, - ) + if (!author.isNullOrBlank()) { + context.copyToClipboard( + author, + author, + ) + } }, onClick = { if (!author.isNullOrBlank()) doSearch(author, true) }, ), diff --git a/app/src/main/java/eu/kanade/presentation/util/Scrollbar.kt b/app/src/main/java/eu/kanade/presentation/util/Scrollbar.kt index 5f2eef1260..3b1644f016 100644 --- a/app/src/main/java/eu/kanade/presentation/util/Scrollbar.kt +++ b/app/src/main/java/eu/kanade/presentation/util/Scrollbar.kt @@ -103,12 +103,16 @@ private fun Modifier.drawScrollbar( val estimatedItemSize = if (items.isEmpty()) 0f else itemsSize.toFloat() / items.size val totalSize = estimatedItemSize * layoutInfo.totalItemsCount val thumbSize = viewportSize / totalSize * viewportSize - val startOffset = if (items.isEmpty()) 0f else items - .first() - .run { - val startPadding = if (reverseDirection) layoutInfo.afterContentPadding else layoutInfo.beforeContentPadding - startPadding + ((estimatedItemSize * index - offset) / totalSize * viewportSize) - } + val startOffset = if (items.isEmpty()) { + 0f + } else { + items + .first() + .run { + val startPadding = if (reverseDirection) layoutInfo.afterContentPadding else layoutInfo.beforeContentPadding + startPadding + ((estimatedItemSize * index - offset) / totalSize * viewportSize) + } + } val drawScrollbar = onDrawScrollbar( orientation, reverseDirection, atEnd, showScrollbar, thickness, color, alpha, thumbSize, startOffset, positionOffset, @@ -202,7 +206,9 @@ private fun Modifier.drawScrollbar( val isLtr = LocalLayoutDirection.current == LayoutDirection.Ltr val reverseDirection = if (orientation == Orientation.Horizontal) { if (isLtr) reverseScrolling else !reverseScrolling - } else reverseScrolling + } else { + reverseScrolling + } val atEnd = if (orientation == Orientation.Vertical) isLtr else true val context = LocalContext.current diff --git a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt index 696ff7b2b6..752ea0d8c7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt @@ -111,8 +111,11 @@ object Migrations { // Migrate library filters to tri-state versions fun convertBooleanPrefToTriState(key: String): Int { val oldPrefValue = prefs.getBoolean(key, false) - return if (oldPrefValue) ExtendedNavigationView.Item.TriStateGroup.State.INCLUDE.value - else ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value + return if (oldPrefValue) { + ExtendedNavigationView.Item.TriStateGroup.State.INCLUDE.value + } else { + ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value + } } prefs.edit { putInt(PreferenceKeys.filterDownloaded, convertBooleanPrefToTriState("pref_filter_downloaded_key")) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupFileValidator.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupFileValidator.kt index af1f2cebd6..1181436224 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupFileValidator.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupFileValidator.kt @@ -44,8 +44,11 @@ class BackupFileValidator( .filter { sourceManager.get(it.key) == null } .values.map { val id = it.toLongOrNull() - if (id == null) it - else sourceManager.getOrStub(id).toString() + if (id == null) { + it + } else { + sourceManager.getOrStub(id).toString() + } } .distinct() .sorted() 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 a9cf7e57a9..d6a041a4d8 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 @@ -11,7 +11,8 @@ data class BackupTracking( @ProtoNumber(1) var syncId: Int, // LibraryId is not null in 1.x @ProtoNumber(2) var libraryId: Long, - @Deprecated("Use mediaId instead", level = DeprecationLevel.WARNING) @ProtoNumber(3) + @Deprecated("Use mediaId instead", level = DeprecationLevel.WARNING) + @ProtoNumber(3) var mediaIdInt: Int = 0, // trackingUrl is called mediaUrl in 1.x @ProtoNumber(4) var trackingUrl: String = "", diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiInterceptor.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiInterceptor.kt index 852198198e..8458a801ae 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiInterceptor.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/BangumiInterceptor.kt @@ -30,29 +30,37 @@ class BangumiInterceptor(val bangumi: Bangumi) : Interceptor { } } - val authRequest = if (originalRequest.method == "GET") originalRequest.newBuilder() - .header("User-Agent", "Tachiyomi") - .url( - originalRequest.url.newBuilder() - .addQueryParameter("access_token", currAuth.access_token).build(), - ) - .build() else originalRequest.newBuilder() - .post(addToken(currAuth.access_token, originalRequest.body as FormBody)) - .header("User-Agent", "Tachiyomi") - .build() + val authRequest = if (originalRequest.method == "GET") { + originalRequest.newBuilder() + .header("User-Agent", "Tachiyomi") + .url( + originalRequest.url.newBuilder() + .addQueryParameter("access_token", currAuth.access_token).build(), + ) + .build() + } else { + originalRequest.newBuilder() + .post(addToken(currAuth.access_token, originalRequest.body as FormBody)) + .header("User-Agent", "Tachiyomi") + .build() + } return chain.proceed(authRequest) } fun newAuth(oauth: OAuth?) { - this.oauth = if (oauth == null) null else OAuth( - oauth.access_token, - oauth.token_type, - System.currentTimeMillis() / 1000, - oauth.expires_in, - oauth.refresh_token, - this.oauth?.user_id, - ) + this.oauth = if (oauth == null) { + null + } else { + OAuth( + oauth.access_token, + oauth.token_type, + System.currentTimeMillis() / 1000, + oauth.expires_in, + oauth.refresh_token, + this.oauth?.user_id, + ) + } bangumi.saveToken(oauth) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/komga/KomgaApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/komga/KomgaApi.kt index 5292dac21e..b4fcd4e82d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/komga/KomgaApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/komga/KomgaApi.kt @@ -41,8 +41,11 @@ class KomgaApi(private val client: OkHttpClient) { val progress = client .newCall(GET("${url.replace("/api/v1/series/", "/api/v2/series/")}/read-progress/tachiyomi")) .await().let { - if (url.contains("/api/v1/series/")) it.parseAs() - else it.parseAs().toV2() + if (url.contains("/api/v1/series/")) { + it.parseAs() + } else { + it.parseAs().toV2() + } } track.apply { 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 acbf0d56cb..29e834f05c 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 @@ -29,14 +29,18 @@ internal class ExtensionGithubApi { suspend fun findExtensions(): List { return withIOContext { - val githubResponse = if (requiresFallbackSource) null else try { - networkService.client - .newCall(GET("${REPO_URL_PREFIX}index.min.json")) - .await() - } catch (e: Throwable) { - logcat(LogPriority.ERROR, e) { "Failed to get extensions from GitHub" } - requiresFallbackSource = true + val githubResponse = if (requiresFallbackSource) { null + } else { + try { + networkService.client + .newCall(GET("${REPO_URL_PREFIX}index.min.json")) + .await() + } catch (e: Throwable) { + logcat(LogPriority.ERROR, e) { "Failed to get extensions from GitHub" } + requiresFallbackSource = true + null + } } val response = githubResponse ?: run { diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt index cda790bc71..892bb58e9a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt @@ -50,11 +50,13 @@ internal class ExtensionInstallReceiver(private val listener: Listener) : when (intent.action) { Intent.ACTION_PACKAGE_ADDED -> { - if (!isReplacing(intent)) launchNow { - when (val result = getExtensionFromIntent(context, intent)) { - is LoadResult.Success -> listener.onExtensionInstalled(result.extension) - is LoadResult.Untrusted -> listener.onExtensionUntrusted(result.extension) - else -> {} + if (!isReplacing(intent)) { + launchNow { + when (val result = getExtensionFromIntent(context, intent)) { + is LoadResult.Success -> listener.onExtensionInstalled(result.extension) + is LoadResult.Untrusted -> listener.onExtensionUntrusted(result.extension) + else -> {} + } } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/glance/UpdatesGridGlanceWidget.kt b/app/src/main/java/eu/kanade/tachiyomi/glance/UpdatesGridGlanceWidget.kt index dba1ccd89b..fc100a948e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/glance/UpdatesGridGlanceWidget.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/glance/UpdatesGridGlanceWidget.kt @@ -238,7 +238,9 @@ class UpdatesGridGlanceWidget : GlanceAppWidget() { .let { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) { it.transformations(RoundedCornersTransformation(roundPx)) - } else it // Handled by system + } else { + it // Handled by system + } } .build() Pair(updatesView.mangaId, app.imageLoader.executeBlocking(request).drawable?.toBitmap()) diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/interceptor/RateLimitInterceptor.kt b/app/src/main/java/eu/kanade/tachiyomi/network/interceptor/RateLimitInterceptor.kt index 1d2e726a14..6b101e35e2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/interceptor/RateLimitInterceptor.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/interceptor/RateLimitInterceptor.kt @@ -74,10 +74,12 @@ internal class RateLimitInterceptor( throw IOException("Canceled") } else if (hasRemovedExpired) { break - } else try { // wait for the first entry to expire, or notified by cached response - (requestQueue as Object).wait(requestQueue.first - periodStart) - } catch (_: InterruptedException) { - continue + } else { + try { // wait for the first entry to expire, or notified by cached response + (requestQueue as Object).wait(requestQueue.first - periodStart) + } catch (_: InterruptedException) { + continue + } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/SecureActivityDelegate.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/SecureActivityDelegate.kt index 803cd232f4..537dcae232 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/SecureActivityDelegate.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/SecureActivityDelegate.kt @@ -50,7 +50,7 @@ private var lockState = LockState.INACTIVE private enum class LockState { INACTIVE, PENDING, - ACTIVE + ACTIVE, } class SecureActivityDelegateImpl : SecureActivityDelegate, DefaultLifecycleObserver { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt index 6a7c60395a..b1e8bec3f2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt @@ -167,8 +167,11 @@ class SearchPresenter( val service = enhancedServices .firstOrNull { it.isTrackFrom(updatedTrack, prevManga, prevSource) } - if (service != null) service.migrateTrack(updatedTrack, manga, source) - else updatedTrack + if (service != null) { + service.migrateTrack(updatedTrack, manga, source) + } else { + updatedTrack + } } insertTrack.awaitAll(tracks) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt index a9b14678a0..2ab3cc804f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt @@ -190,32 +190,44 @@ class LibraryPresenter( else -> downloadManager.getDownloadCount(item.manga.toDomainManga()!!) > 0 } - return@downloaded if (downloadedOnly || filterDownloaded == State.INCLUDE.value) isDownloaded - else !isDownloaded + return@downloaded if (downloadedOnly || filterDownloaded == State.INCLUDE.value) { + isDownloaded + } else { + !isDownloaded + } } val filterFnUnread: (LibraryItem) -> Boolean = unread@{ item -> if (filterUnread == State.IGNORE.value) return@unread true val isUnread = item.manga.unreadCount != 0 - return@unread if (filterUnread == State.INCLUDE.value) isUnread - else !isUnread + return@unread if (filterUnread == State.INCLUDE.value) { + isUnread + } else { + !isUnread + } } val filterFnStarted: (LibraryItem) -> Boolean = started@{ item -> if (filterStarted == State.IGNORE.value) return@started true val hasStarted = item.manga.hasStarted - return@started if (filterStarted == State.INCLUDE.value) hasStarted - else !hasStarted + return@started if (filterStarted == State.INCLUDE.value) { + hasStarted + } else { + !hasStarted + } } val filterFnCompleted: (LibraryItem) -> Boolean = completed@{ item -> if (filterCompleted == State.IGNORE.value) return@completed true val isCompleted = item.manga.status == SManga.COMPLETED - return@completed if (filterCompleted == State.INCLUDE.value) isCompleted - else !isCompleted + return@completed if (filterCompleted == State.INCLUDE.value) { + isCompleted + } else { + !isCompleted + } } val filterFnTracking: (LibraryItem) -> Boolean = tracking@{ item -> diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt index b3e0b0d34e..3693a5e2f8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt @@ -305,7 +305,8 @@ class MangaController : FullComposeController { previousController.search(query) } is UpdatesController, - is HistoryController, -> { + is HistoryController, + -> { // Manually navigate to LibraryController router.handleBack() (router.activity as MainActivity).setSelectedNavItem(R.id.nav_library) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt index 960f69daad..0046ec9588 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt @@ -151,7 +151,9 @@ class HttpPageLoader( .mapNotNull { if (it.status == Page.QUEUE) { PriorityPage(it, 0).apply { queue.offer(this) } - } else null + } else { + null + } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/OrientationType.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/OrientationType.kt index 9a1e69a4f3..0b1319b7d8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/OrientationType.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/setting/OrientationType.kt @@ -12,7 +12,8 @@ enum class OrientationType(val prefValue: Int, val flag: Int, @StringRes val str REVERSE_PORTRAIT(6, ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT, R.string.rotation_reverse_portrait, R.drawable.ic_stay_current_portrait_24dp, 0x00000030), LANDSCAPE(3, ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE, R.string.rotation_landscape, R.drawable.ic_stay_current_landscape_24dp, 0x00000018), LOCKED_PORTRAIT(4, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, R.string.rotation_force_portrait, R.drawable.ic_screen_lock_portrait_24dp, 0x00000020), - LOCKED_LANDSCAPE(5, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE, R.string.rotation_force_landscape, R.drawable.ic_screen_lock_landscape_24dp, 0x00000028); + LOCKED_LANDSCAPE(5, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE, R.string.rotation_force_landscape, R.drawable.ic_screen_lock_landscape_24dp, 0x00000028), + ; companion object { const val MASK = 0x00000038 diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt index c040001d78..1c7443e57d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerViewerAdapter.kt @@ -171,7 +171,8 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() { val placeAtIndex = when (viewer) { is L2RPagerViewer, - is VerticalPagerViewer, -> currentIndex + 1 + is VerticalPagerViewer, + -> currentIndex + 1 else -> currentIndex } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/lang/RxCoroutineBridge.kt b/app/src/main/java/eu/kanade/tachiyomi/util/lang/RxCoroutineBridge.kt index 391a9a14ef..ceef8a2e8f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/lang/RxCoroutineBridge.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/lang/RxCoroutineBridge.kt @@ -33,11 +33,13 @@ private suspend fun Observable.awaitOne(): T = suspendCancellableCoroutin } override fun onCompleted() { - if (cont.isActive) cont.resumeWithException( - IllegalStateException( - "Should have invoked onNext", - ), - ) + if (cont.isActive) { + cont.resumeWithException( + IllegalStateException( + "Should have invoked onNext", + ), + ) + } } override fun onError(e: Throwable) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/ExtendedNavigationView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/ExtendedNavigationView.kt index 1252909db0..294de85e9a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/ExtendedNavigationView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/ExtendedNavigationView.kt @@ -117,7 +117,7 @@ open class ExtendedNavigationView @JvmOverloads constructor( enum class State(val value: Int) { IGNORE(0), INCLUDE(1), - EXCLUDE(2) + EXCLUDE(2), } override fun getStateDrawable(context: Context): Drawable? { diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/MaterialFastScroll.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/MaterialFastScroll.kt index d2c21c8d66..29e9e43e37 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/MaterialFastScroll.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/MaterialFastScroll.kt @@ -46,7 +46,9 @@ class MaterialFastScroll @JvmOverloads constructor(context: Context, attrs: Attr } else { event.x > handle.width + ViewCompat.getPaddingStart(handle) } - ) return false + ) { + return false + } // end if (ignoreTouchesOutsideHandle && diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/TachiyomiChangeHandlerFrameLayout.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/TachiyomiChangeHandlerFrameLayout.kt index 9c8d123e39..2c63ffabfd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/TachiyomiChangeHandlerFrameLayout.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/TachiyomiChangeHandlerFrameLayout.kt @@ -39,7 +39,9 @@ class TachiyomiChangeHandlerFrameLayout( behavior.apply { shouldHeaderOverlap = overlapHeader } - } else null + } else { + null + } if (!enable) { // The behavior doesn't reset translationY when shouldHeaderOverlap is false translationY = 0F diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/TachiyomiSearchView.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/TachiyomiSearchView.kt index eeb3085b71..aa5e6705f3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/TachiyomiSearchView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/TachiyomiSearchView.kt @@ -48,7 +48,9 @@ class TachiyomiSearchView @JvmOverloads constructor( clearFocus() listener?.onQueryTextSubmit(query.toString()) true - } else false + } else { + false + } } } diff --git a/gradle/androidx.versions.toml b/gradle/androidx.versions.toml index 91da357268..8252e42ad6 100644 --- a/gradle/androidx.versions.toml +++ b/gradle/androidx.versions.toml @@ -4,11 +4,11 @@ lifecycle_version = "2.5.1" [libraries] annotation = "androidx.annotation:annotation:1.4.0" -appcompat = "androidx.appcompat:appcompat:1.6.0-beta01" +appcompat = "androidx.appcompat:appcompat:1.6.0-rc01" biometricktx = "androidx.biometric:biometric-ktx:1.2.0-alpha04" constraintlayout = "androidx.constraintlayout:constraintlayout:2.1.4" coordinatorlayout = "androidx.coordinatorlayout:coordinatorlayout:1.2.0" -corektx = "androidx.core:core-ktx:1.8.0" +corektx = "androidx.core:core-ktx:1.9.0" splashscreen = "androidx.core:core-splashscreen:1.0.0-alpha02" recyclerview = "androidx.recyclerview:recyclerview:1.3.0-beta02" viewpager = "androidx.viewpager:viewpager:1.1.0-alpha01" diff --git a/gradle/compose.versions.toml b/gradle/compose.versions.toml index bc2354c1c5..420a4a2b91 100644 --- a/gradle/compose.versions.toml +++ b/gradle/compose.versions.toml @@ -1,5 +1,5 @@ [versions] -compiler = "1.3.0-rc02" +compiler = "1.3.1" compose = "1.2.1" accompanist = "0.25.1" material3 = "1.0.0-beta01" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 85f62c2a04..791b18e326 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -103,5 +103,5 @@ conductor = ["conductor-core", "conductor-support-preference"] shizuku = ["shizuku-api", "shizuku-provider"] [plugins] -kotlinter = { id = "org.jmailen.kotlinter", version = "3.11.1" } +kotlinter = { id = "org.jmailen.kotlinter", version = "3.12.0" } versionsx = { id = "com.github.ben-manes.versions", version = "0.42.0" } \ No newline at end of file