The transition of a common ImageView element (between Activity) begins with an incorrect scaleType value

I found a problem with SimpleDraweeView fresco at the beginning. However, the problem remains after replacing with Android ImageView. So I can’t be sure if the problem is with Android or just a mural.

What is the problem

  • The first action has a redesigned view, and each view has an ImageView (or SimpleDraweeView). The required scale type is "centerCrop"
  • The second action has only one ImageView. Required scaleType is "fitCenter"

However, in my private project, as well as in the sample project.
https://github.com/JackFan-Z/ActivitySharedElementTransition
ImageView starts with scaleType "fitCenter", which is incorrect.

I tried to delay the transition of the common element and set a different scaleType of the common element to scaleback in the SharedElementCallback. But none of them work. Can someone help figure out what went wrong, or where to debug?

Screenshots of the problem

Screenshot of the first activity:
enter image description here

Transition Screenshot:
enter image description here

+6
source share
1 answer

As you saw in ImageView , this is a limitation for Android. However, I am making some changes to the types of the Fresco scale, and this will be possible to do as soon as I push my changes.

In short, instead of ScaleType being Enum (which is very inflexible), ScaleType changes as an interface that can be implemented for arbitrary scaling. This change has been planted domestically and will soon be transferred to GitHub.

In addition to the above, I am working on an implementation of InterpolatingScaleType, which simply interpolates between the two basic types of scale based on the interpolation value (0.0 - 1.0). A value of 0.0 returns the same transform as the base scaleType1, while a value of 1.0 returns the same transform as the base scaleType2. Between the values ​​there is a linear combination between them.

InterpolatingScaleType allows you to smoothly interpolate between two different types of scales that are convenient in animations, for example, when performing a transition to a view.

Once this is ready, I will update this answer.

EDIT:

@burzumrus was kind enough to provide the implementation you can find here on GitHub . There is also thread on this issue on the Fresco GitHub page.

+2
source

All Articles