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 702278fe6..60112e2d7 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,6 +7,7 @@ import android.content.ClipboardManager import android.content.Context import android.content.Intent import android.graphics.Bitmap +import android.graphics.drawable.Drawable import android.os.Build import android.os.Bundle import android.view.* @@ -15,12 +16,10 @@ import androidx.core.content.pm.ShortcutInfoCompat import androidx.core.content.pm.ShortcutManagerCompat import androidx.core.graphics.drawable.IconCompat 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.RequestListener -import com.bumptech.glide.request.target.Target +import com.bumptech.glide.request.target.CustomTarget +import com.bumptech.glide.request.transition.Transition import com.jakewharton.rxbinding.support.v4.widget.refreshes import com.jakewharton.rxbinding.view.clicks import com.jakewharton.rxbinding.view.longClicks @@ -127,7 +126,6 @@ class MangaInfoController : NucleusController(), manga_cover.longClicks().subscribeUntilDestroy { copyToClipboard(view.context.getString(R.string.title), presenter.manga.title) } - } override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { @@ -488,18 +486,17 @@ class MangaInfoController : NucleusController(), 3 -> centerCrop().transform(MaskTransformation(R.drawable.mask_star)) } } - .listener(object : RequestListener { - override fun onResourceReady(resource: Bitmap, model: Any, target: Target, dataSource: DataSource, isFirstResource: Boolean): Boolean { + .into(object : CustomTarget(96, 96) { + override fun onResourceReady(resource: Bitmap, transition: Transition?) { createShortcut(resource) - return true } - override fun onLoadFailed(e: GlideException?, model: Any?, target: Target?, isFirstResource: Boolean): Boolean { + override fun onLoadFailed(errorDrawable: Drawable?) { activity?.toast(R.string.icon_creation_fail) - return true } + + override fun onLoadCleared(placeholder: Drawable?) { } }) - .submit() } /**