mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-25 03:11:10 +01:00
Ensure we do not stage shared element transition view when opening media from a bubble.
This commit is contained in:
committed by
Greyson Parrelli
parent
bf611f3a56
commit
5c688289a5
@@ -42,8 +42,13 @@ object MediaIntentFactory {
|
||||
val allMediaInRail: Boolean = false,
|
||||
val sorting: MediaTable.Sorting,
|
||||
val isVideoGif: Boolean,
|
||||
val sharedElementArgs: SharedElementArgs = SharedElementArgs()
|
||||
) : Parcelable
|
||||
val sharedElementArgs: SharedElementArgs = SharedElementArgs(),
|
||||
val skipSharedElementTransition: Boolean
|
||||
) : Parcelable {
|
||||
fun skipSharedElementTransition(skipSharedElementTransition: Boolean): MediaPreviewArgs {
|
||||
return copy(skipSharedElementTransition = skipSharedElementTransition)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun requireArguments(bundle: Bundle): MediaPreviewArgs = bundle.getParcelableCompat(ARGS_KEY, MediaPreviewArgs::class.java)!!
|
||||
@@ -80,7 +85,8 @@ object MediaIntentFactory {
|
||||
12.dp.toFloat(),
|
||||
12.dp.toFloat(),
|
||||
12.dp.toFloat()
|
||||
)
|
||||
),
|
||||
skipSharedElementTransition = false
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class MediaPreviewV2Activity : PassphraseRequiredActivity(), VoiceNoteMediaContr
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?, ready: Boolean) {
|
||||
if (MediaPreviewCache.drawable != null) {
|
||||
if (MediaPreviewCache.drawable != null && !args.skipSharedElementTransition) {
|
||||
val originalCorners = ShapeAppearanceModel.Builder()
|
||||
.setTopLeftCornerSize(args.sharedElementArgs.topLeft)
|
||||
.setTopRightCornerSize(args.sharedElementArgs.topRight)
|
||||
@@ -90,7 +90,7 @@ class MediaPreviewV2Activity : PassphraseRequiredActivity(), VoiceNoteMediaContr
|
||||
|
||||
transitionImageView = findViewById(R.id.transition_image_view)
|
||||
val cacheDrawable = MediaPreviewCache.drawable
|
||||
if (cacheDrawable != null) {
|
||||
if (cacheDrawable != null && !args.skipSharedElementTransition) {
|
||||
val bounds = cacheDrawable.bounds
|
||||
val aspectRatio = bounds.width().toFloat() / bounds.height()
|
||||
val screenRatio = resources.displayMetrics.widthPixels.toFloat() / resources.displayMetrics.heightPixels
|
||||
|
||||
Reference in New Issue
Block a user