mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 06:31:47 +01:00
Adding back option to save animated covers
This commit is contained in:
parent
d96365bd93
commit
06933c3612
@ -5,7 +5,6 @@ import android.animation.ValueAnimator
|
||||
import android.app.Dialog
|
||||
import android.graphics.Color
|
||||
import android.graphics.Rect
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Build
|
||||
import android.view.LayoutInflater
|
||||
@ -13,7 +12,6 @@ import android.view.View
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.animation.addListener
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.transition.ChangeBounds
|
||||
import androidx.transition.ChangeImageTransform
|
||||
import androidx.transition.TransitionManager
|
||||
@ -66,9 +64,6 @@ class FullCoverDialog(val controller: MangaDetailsController, drawable: Drawable
|
||||
.build()
|
||||
|
||||
expandedImageView.setImageDrawable(drawable)
|
||||
if (drawable !is BitmapDrawable) {
|
||||
binding.buttonContainer.isVisible = false
|
||||
}
|
||||
|
||||
val rect = Rect()
|
||||
thumbView.getGlobalVisibleRect(rect)
|
||||
|
@ -29,7 +29,6 @@ import androidx.palette.graphics.Palette
|
||||
import androidx.recyclerview.widget.ItemTouchHelper
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.Coil
|
||||
import coil.imageLoader
|
||||
import coil.request.ImageRequest
|
||||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
@ -924,15 +923,7 @@ class MangaDetailsController :
|
||||
|
||||
override fun prepareToShareManga() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
val request = ImageRequest.Builder(activity!!).data(manga).target(
|
||||
onError = {
|
||||
shareManga()
|
||||
},
|
||||
onSuccess = {
|
||||
presenter.shareManga((it as BitmapDrawable).bitmap)
|
||||
}
|
||||
).build()
|
||||
Coil.imageLoader(activity!!).enqueue(request)
|
||||
presenter.shareManga()
|
||||
} else {
|
||||
shareManga()
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ import eu.kanade.tachiyomi.util.system.ImageUtil
|
||||
import eu.kanade.tachiyomi.util.manga.MangaShortcutManager
|
||||
import eu.kanade.tachiyomi.util.system.executeOnIO
|
||||
import eu.kanade.tachiyomi.util.system.launchIO
|
||||
import eu.kanade.tachiyomi.util.system.withUIContext
|
||||
import eu.kanade.tachiyomi.widget.TriStateCheckBox
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@ -669,17 +670,18 @@ class MangaDetailsPresenter(
|
||||
}
|
||||
}
|
||||
|
||||
fun shareManga(cover: Bitmap) {
|
||||
fun shareManga() {
|
||||
val context = Injekt.get<Application>()
|
||||
|
||||
val destDir = File(context.cacheDir, "shared_image")
|
||||
|
||||
scope.launch(Dispatchers.IO) {
|
||||
scope.launchIO {
|
||||
destDir.deleteRecursively()
|
||||
try {
|
||||
val image = saveImage(cover, destDir, manga)
|
||||
if (image != null) controller.shareManga(image)
|
||||
else controller.shareManga()
|
||||
val file = saveCover(destDir)
|
||||
withUIContext {
|
||||
controller.shareManga(file)
|
||||
}
|
||||
} catch (e: java.lang.Exception) {
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user