From 26c5c9c839b1111c0de0e4a8f69d3ab59276d0c4 Mon Sep 17 00:00:00 2001 From: arkon Date: Tue, 7 Jan 2020 20:24:12 -0500 Subject: [PATCH] Replace usage of deprecated Glide SimpleTarget --- .../ui/manga/info/MangaInfoController.kt | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt index c3aae5921..7410e788e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt @@ -7,21 +7,20 @@ import android.content.ClipboardManager import android.content.Context import android.content.Intent import android.graphics.Bitmap -import android.graphics.drawable.Drawable -import android.net.Uri import android.os.Build import android.os.Bundle -import androidx.browser.customtabs.CustomTabsIntent +import android.view.* +import android.widget.Toast import androidx.core.content.pm.ShortcutInfoCompat import androidx.core.content.pm.ShortcutManagerCompat import androidx.core.graphics.drawable.IconCompat -import android.view.* -import android.widget.Toast import com.afollestad.materialdialogs.MaterialDialog +import com.bumptech.glide.load.DataSource import com.bumptech.glide.load.engine.DiskCacheStrategy +import com.bumptech.glide.load.engine.GlideException import com.bumptech.glide.load.resource.bitmap.RoundedCorners -import com.bumptech.glide.request.target.SimpleTarget -import com.bumptech.glide.request.transition.Transition +import com.bumptech.glide.request.RequestListener +import com.bumptech.glide.request.target.Target import com.jakewharton.rxbinding.support.v4.widget.refreshes import com.jakewharton.rxbinding.view.clicks import com.jakewharton.rxbinding.view.longClicks @@ -41,7 +40,6 @@ import eu.kanade.tachiyomi.ui.catalogue.global_search.CatalogueSearchController import eu.kanade.tachiyomi.ui.library.ChangeMangaCategoriesDialog import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.manga.MangaController -import eu.kanade.tachiyomi.util.getResourceColor import eu.kanade.tachiyomi.util.openInBrowser import eu.kanade.tachiyomi.util.snack import eu.kanade.tachiyomi.util.toast @@ -487,15 +485,18 @@ class MangaInfoController : NucleusController(), 3 -> centerCrop().transform(MaskTransformation(R.drawable.mask_star)) } } - .into(object : SimpleTarget(96, 96) { - override fun onResourceReady(resource: Bitmap, transition: Transition?) { + .listener(object : RequestListener { + override fun onResourceReady(resource: Bitmap, model: Any, target: Target, dataSource: DataSource, isFirstResource: Boolean): Boolean { createShortcut(resource) + return true } - override fun onLoadFailed(errorDrawable: Drawable?) { + override fun onLoadFailed(e: GlideException?, model: Any?, target: Target?, isFirstResource: Boolean): Boolean { activity?.toast(R.string.icon_creation_fail) + return true } }) + .submit() } /**