From c7707dc50edb817652d4e850f4f0806ab05307df Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 11 May 2022 22:17:12 -0400 Subject: [PATCH] Minor cleanup --- renovate.json => .github/renovate.json | 3 ++- .../tachiyomi/ui/manga/AddDuplicateMangaDialog.kt | 9 ++------- .../eu/kanade/tachiyomi/ui/manga/MangaController.kt | 3 +-- .../eu/kanade/tachiyomi/util/system/ImageUtil.kt | 12 ++++++++---- gradle/libs.versions.toml | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) rename renovate.json => .github/renovate.json (76%) diff --git a/renovate.json b/.github/renovate.json similarity index 76% rename from renovate.json rename to .github/renovate.json index 8fe4caa0b..a1eec22be 100644 --- a/renovate.json +++ b/.github/renovate.json @@ -7,6 +7,7 @@ "androidx.core:core-splashscreen", "androidx.work:work-runtime-ktx", "info.android15.nucleus:nucleus-support-v7", - "info.android15.nucleus:nucleus" + "info.android15.nucleus:nucleus", + "com.google.guava:guava" ] } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/AddDuplicateMangaDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/AddDuplicateMangaDialog.kt index 27a06b4fe..58fbe282c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/AddDuplicateMangaDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/AddDuplicateMangaDialog.kt @@ -11,8 +11,7 @@ import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.pushController import uy.kohesive.injekt.injectLazy -class AddDuplicateMangaDialog(bundle: Bundle? = null) : DialogController(bundle) - where T : Controller, T : AddDuplicateMangaDialog.Listener { +class AddDuplicateMangaDialog(bundle: Bundle? = null) : DialogController(bundle) { private val sourceManager: SourceManager by injectLazy() @@ -20,7 +19,7 @@ class AddDuplicateMangaDialog(bundle: Bundle? = null) : DialogController(bund private lateinit var onAddToLibrary: () -> Unit constructor( - target: T, + target: Controller, libraryManga: Manga, onAddToLibrary: () -> Unit, ) : this() { @@ -46,8 +45,4 @@ class AddDuplicateMangaDialog(bundle: Bundle? = null) : DialogController(bund .setCancelable(true) .create() } - - interface Listener { - fun addToLibrary(newManga: Manga) - } } 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 cd9bb9ec5..961356cab 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 @@ -113,7 +113,6 @@ class MangaController : FlexibleAdapter.OnItemClickListener, FlexibleAdapter.OnItemLongClickListener, BaseChaptersAdapter.OnChapterClickListener, - AddDuplicateMangaDialog.Listener, ChangeMangaCoverDialog.Listener, ChangeMangaCategoriesDialog.Listener, DownloadCustomChaptersDialog.Listener, @@ -533,7 +532,7 @@ class MangaController : trackSheet?.show() } - override fun addToLibrary(newManga: Manga) { + private fun addToLibrary(newManga: Manga) { val categories = presenter.getCategories() val defaultCategoryId = preferences.defaultCategory() val defaultCategory = categories.find { it.id == defaultCategoryId } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt index 2a4978aee..c3d91e25f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt @@ -11,6 +11,7 @@ import android.graphics.drawable.ColorDrawable import android.graphics.drawable.Drawable import android.graphics.drawable.GradientDrawable import android.os.Build +import androidx.annotation.ColorInt import androidx.core.graphics.alpha import androidx.core.graphics.applyCanvas import androidx.core.graphics.blue @@ -446,19 +447,22 @@ object ImageUtil { ) } - private fun Int.isDark(): Boolean = + private fun @receiver:ColorInt Int.isDark(): Boolean = red < 40 && blue < 40 && green < 40 && alpha > 200 - private fun Int.isCloseTo(other: Int): Boolean = + private fun @receiver:ColorInt Int.isCloseTo(other: Int): Boolean = abs(red - other.red) < 30 && abs(green - other.green) < 30 && abs(blue - other.blue) < 30 - private fun Int.isWhite(): Boolean = + private fun @receiver:ColorInt Int.isWhite(): Boolean = red + blue + green > 740 /** * Used to check an image's dimensions without loading it in the memory. */ - private fun extractImageOptions(imageStream: InputStream, resetAfterExtraction: Boolean = true): BitmapFactory.Options { + private fun extractImageOptions( + imageStream: InputStream, + resetAfterExtraction: Boolean = true, + ): BitmapFactory.Options { imageStream.mark(imageStream.available() + 1) val imageBytes = imageStream.readBytes() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b462a7380..cb3fd794d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -80,7 +80,7 @@ flowbinding-viewpager = { module = "io.github.reactivecircus.flowbinding:flowbin logcat = "com.squareup.logcat:logcat:0.1" -acra-http = "ch.acra:acra-http:5.9.1" +acra-http = "ch.acra:acra-http:5.9.3" firebase-analytics = "com.google.firebase:firebase-analytics-ktx:21.0.0" aboutLibraries-gradle = { module = "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin", version.ref = "aboutlib_version" }