mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-25 03:11:10 +01:00
Utilize drawable instead of bitmap for transition.
This commit is contained in:
committed by
Greyson Parrelli
parent
6aa4ef95b5
commit
417db2341b
@@ -1,6 +1,6 @@
|
||||
package org.thoughtcrime.securesms.mediapreview
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.drawable.Drawable
|
||||
|
||||
/**
|
||||
* Stores the bitmap for a thumbnail we are animating from via a shared
|
||||
@@ -8,5 +8,5 @@ import android.graphics.Bitmap
|
||||
* receiving end.
|
||||
*/
|
||||
object MediaPreviewCache {
|
||||
var bitmap: Bitmap? = null
|
||||
var drawable: Drawable? = null
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class MediaPreviewV2Activity : PassphraseRequiredActivity(), VoiceNoteMediaContr
|
||||
override fun onCreate(savedInstanceState: Bundle?, ready: Boolean) {
|
||||
val args = MediaIntentFactory.requireArguments(intent.extras!!)
|
||||
|
||||
if (MediaPreviewCache.bitmap != null) {
|
||||
if (MediaPreviewCache.drawable != null) {
|
||||
val originalCorners = ShapeAppearanceModel.Builder()
|
||||
.setTopLeftCornerSize(args.sharedElementArgs.topLeft)
|
||||
.setTopRightCornerSize(args.sharedElementArgs.topRight)
|
||||
@@ -85,8 +85,8 @@ class MediaPreviewV2Activity : PassphraseRequiredActivity(), VoiceNoteMediaContr
|
||||
setContentView(R.layout.activity_mediapreview_v2)
|
||||
|
||||
transitionImageView = findViewById(R.id.transition_image_view)
|
||||
if (MediaPreviewCache.bitmap != null) {
|
||||
transitionImageView.setImageBitmap(MediaPreviewCache.bitmap)
|
||||
if (MediaPreviewCache.drawable != null) {
|
||||
transitionImageView.setImageDrawable(MediaPreviewCache.drawable)
|
||||
} else {
|
||||
transitionImageView.visibility = View.INVISIBLE
|
||||
viewModel.setIsInSharedAnimation(false)
|
||||
@@ -119,7 +119,7 @@ class MediaPreviewV2Activity : PassphraseRequiredActivity(), VoiceNoteMediaContr
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
MediaPreviewCache.bitmap = null
|
||||
MediaPreviewCache.drawable = null
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
Reference in New Issue
Block a user