From 7318f4f5dd86d23f18b5b137703fd9e6b516d5cb Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 8 Apr 2022 16:14:46 -0400 Subject: [PATCH] Remove some dead code --- .../sources/MigrationSourcesPresenter.kt | 10 ++-- .../globalsearch/GlobalSearchController.kt | 7 +-- .../globalsearch/GlobalSearchPresenter.kt | 4 +- .../tachiyomi/ui/manga/MangaPresenter.kt | 46 ------------------- 4 files changed, 8 insertions(+), 59 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesPresenter.kt index 5b65ae1d6..814cbfbfd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesPresenter.kt @@ -38,6 +38,10 @@ class MigrationSourcesPresenter( .subscribeLatestCache(MigrationSourcesController::setSources) } + fun requestSortUpdate() { + sortRelay.call(Unit) + } + private fun findSourcesWithManga(library: List): List { val header = SelectionHeader() return library @@ -51,7 +55,7 @@ class MigrationSourcesPresenter( .toList() } - fun sortFn(): java.util.Comparator { + private fun sortFn(): java.util.Comparator { val sort by lazy { preferences.migrationSortingMode().get() } @@ -75,8 +79,4 @@ class MigrationSourcesPresenter( MigrationSourcesController.DirectionSetting.DESCENDING -> Collections.reverseOrder(sortFn) } } - - fun requestSortUpdate() { - sortRelay.call(Unit) - } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt index 054540267..0c0a9ce44 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt @@ -28,7 +28,7 @@ import uy.kohesive.injekt.injectLazy */ open class GlobalSearchController( protected val initialQuery: String? = null, - protected val extensionFilter: String? = null, + private val extensionFilter: String? = null, ) : SearchableNucleusController(), GlobalSearchCardAdapter.OnMangaClickListener, GlobalSearchAdapter.OnTitleClickListener { @@ -55,11 +55,6 @@ open class GlobalSearchController( return presenter.query } - /** - * Create the [GlobalSearchPresenter] used in controller. - * - * @return instance of [GlobalSearchPresenter] - */ override fun createPresenter(): GlobalSearchPresenter { return GlobalSearchPresenter(initialQuery, extensionFilter) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchPresenter.kt index b22330e53..b6d9b6451 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchPresenter.kt @@ -35,8 +35,8 @@ import uy.kohesive.injekt.injectLazy * @param preferences manages the preference calls. */ open class GlobalSearchPresenter( - val initialQuery: String? = "", - val initialExtensionFilter: String? = null, + private val initialQuery: String? = "", + private val initialExtensionFilter: String? = null, val sourceManager: SourceManager = Injekt.get(), val db: DatabaseHelper = Injekt.get(), val preferences: PreferencesHelper = Injekt.get(), diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt index c4fd7c1eb..71c096a2e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt @@ -1,12 +1,8 @@ package eu.kanade.tachiyomi.ui.manga import android.content.Context -import android.graphics.Bitmap -import android.graphics.BitmapFactory import android.net.Uri import android.os.Bundle -import coil.imageLoader -import coil.memory.MemoryCache import com.jakewharton.rxrelay.PublishRelay import eu.kanade.tachiyomi.data.cache.CoverCache import eu.kanade.tachiyomi.data.database.DatabaseHelper @@ -295,48 +291,6 @@ class MangaPresenter( moveMangaToCategories(manga, listOfNotNull(category)) } - /** - * Get the manga cover as a Bitmap, either from the CoverCache (only works for library manga) - * or from the Coil ImageLoader cache. - * - * @param context the context used to get the Coil ImageLoader - * @param memoryCacheKey Coil MemoryCache.Key that points to the cover Bitmap cache location - * @return manga cover as Bitmap - */ - fun getCoverBitmap(context: Context, memoryCacheKey: MemoryCache.Key?): Bitmap { - var resultBitmap = coverBitmapFromCoverCache() - if (resultBitmap == null && memoryCacheKey != null) { - resultBitmap = coverBitmapFromImageLoader(context, memoryCacheKey) - } - - return resultBitmap ?: throw Exception("Cover not in cache") - } - - /** - * Attempt manga cover retrieval from the CoverCache. - * - * @return cover as Bitmap or null if CoverCache does not contain cover for manga - */ - private fun coverBitmapFromCoverCache(): Bitmap? { - val cover = coverCache.getCoverFile(manga) - return if (cover != null) { - BitmapFactory.decodeFile(cover.path) - } else { - null - } - } - - /** - * Attempt manga cover retrieval from the Coil ImageLoader memoryCache. - * - * @param context the context used to get the Coil ImageLoader - * @param memoryCacheKey Coil MemoryCache.Key that points to the cover Bitmap cache location - * @return cover as Bitmap or null if there is no thumbnail cached with the memoryCacheKey - */ - private fun coverBitmapFromImageLoader(context: Context, memoryCacheKey: MemoryCache.Key): Bitmap? { - return context.imageLoader.memoryCache?.get(memoryCacheKey)?.bitmap - } - /** * Save manga cover Bitmap to picture or temporary share directory. *