-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shared element transition #22
Comments
Can you give us more details? What exactly did you try to do, and what happened instead? |
In the new android version, lollipop, we can use an ImageView as a shared element transition between activities. In that case the image make a smoth transition from one activity to the next one. When using the SimpleDraweeView it just disappear. The code to test it should be something like this: theme of the app: <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
</style> Activity1 Layout.xml: <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/image"
android:layout_width="@dimen/size_1"
android:layout_height="@dimen/size_1"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"/>
</RelativeLayout> Activity2 Layout.xml: <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/image"
android:layout_width="@dimen/size_2"
android:layout_height="@dimen/size_2"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:transitionName="image_transition"/>
</RelativeLayout> The code to start the second activity: Intent intent = new Intent(activity1, Activity2.class);
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(activity1, simpleDraweeView1, "image_transition");
activity1.startActivity(intent, options.toBundle()); This code should make a transition between the activities where the image moves and resizes from the top left corner of the activity 1 to the bottom right corner of the activity 2. I have tested a similar code loading images from the network and it does not display the animation. |
I think this is realted too #99 |
I suspect this has to do with attach/detach events that view gets when in transition. We'll have to investigate that. |
This is something I can confirm as well. Shared Element transitions seem to be broken on Fresco. It would be great if we could get this fixed, as this is a very important feature moving forward. |
Happened to me too. When setting transtitionName xml attr to SimpleDraweeView, setImageUri() method stopped working |
Any updates on this ? |
After the FadeDrawable finished animate real image, there is a log: maybe the changeCanvasOpacity cause the image not draw. |
Is the bug fixed? It's very significant for my project as well. :) |
package org.goodev.droidddle.drawee; import com.facebook.drawee.generic.GenericDraweeHierarchy; import android.content.Context; public class TranslateDraweeView extends SimpleDraweeView {
} |
@goodev there's not such a method to overwrite. |
@shumin0809 just add this method, this is a hide public method for the transition. |
I am seeing different, but still buggy behaviour with SharedElementTransitions. Don't know if this is the same, related, or separate issue. _Reproduction_
_Expected_ _Observed_ _Notes_ _Setup_ _Realisations_
|
@jorgemf - Doesn't your posted code need a matching transitionName attribute set in the Activity 1 layout? https://developer.android.com/training/material/animations.html
For my issue it might just be that I need to postpone the transition. I'll have a look at this today: |
I'm with the same problem. I using fresco 0.5.3 and SimpleDraweeView not load image with attr "android:transitionName". Anybody know outher solution using Fresco? |
@LuizGadao If you set a background you lose all the advantages of the library. I think it is pointless as you want it for images downloaded from internet. Not for static resources as a background. |
@jorgemf I agree with you. It is only a hack for do it work. |
Any news on this one? |
@LuizGadao can you post an example of your workaround XML? |
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed. |
Any news on this one? PS: |
Like as boxcounter said, Tra slateDraweeView doesn't work on HTC One M8, neither |
If you are using ChangeImageTransform Transition, then I think the share element transition fails because ChangeImageTransform is animating the ImageView's Matrix which I think its not support by default DraweeView. |
@burzumrus that's amazing! Thanks for implementing it. That's exactly what I had in mind with |
Summary: As mentioned in #22 ChangeImageTransform for DraweeViews is not working correctly, when ScaleType is changing during transition. This pull request resolve this issue by added custom DraweeTransition, which animates ScaleType transition correctly InterpolatingScaleType is changed by adding start and end values of parentBounds. In pervious version it used parameter parentBounds, which changing every animation frame and it caused wrong animation behaviour. Transition sample is changed due to use DraweeTransition. Also background was added in sample image, to show how animation works Closes #1225 Reviewed By: plamenko Differential Revision: D3322074 Pulled By: kirwan fbshipit-source-id: 1da6aee40b2e15d39bfc699e41488905fa2a08c0
@plamenko I am using fresco 0.12 and
The animation is working perfectly. But on return to first activity the image is disappearing |
Did anyone try these with fragment-to-fragment animations? Because it doesn't seem to work on v0.12. |
@Gericop and @ladia12 0.12 works well in my project in fragment-to-fragment animations. |
@sperochon I use replace and it's in a RecyclerView but it doesn't work (and honestly, it's surprising that it works for you, maybe you use a different version of RecyclerView? I use v24.1.1). I had to make a few changes in order to make the animations work:
Drawable drawable = draweeView.getTopLevelDrawable();
if (drawable != null) {
drawable.setBounds(0, 0, draweeView.getWidth(), draweeView.getHeight());
} This last piece of code is based on @aohayou's solution (because I couldn't make
|
@Gericop Here is a demo that it works fine. I've just commit it onto github. I tried to clean the code at maximum. Be careful: I used only 1 image in my recycler view because the transition name has to be different on each item of the recycler view in order to Fresco to work. So, to simplify, I used only 1 image with 1 transition name. Hope this help! |
@sperochon Try it with multiple images. This is completely wrong. The end view starts from a different position and the scale type has no effect whatsoever. I don't know how can you say for this that "it works fine" because it clearly doesn't. |
@Gericop I've just updated the code. I forgot to specify a different layout for the end fragment. Try again, please. |
@sperochon In API 23 emulator, it works fine. On my device (API 21) it doesn't. Also tested it in an API 21 emulator, it doesn't work there either. Edit: your demo only tests the default |
Unfortunately, you're right... I've tested it on my devices: |
@Gericop @sperochon I have written a blog post on medium about this. Please see if it helps. |
@ladia12 That post has nothing to do with the problem I was (we were) facing... Your blog entry is about inter-Activity transition, while my issue is related to inter-Fragment. Furthermore, the real bug is in how API 21 handles the |
Just for info: |
@ladia12 How did you resolve the issue of the original image disappearing when returning to the first activity? |
@dbrant I have the same issue, Have you find some way to resolve? |
See #1446 |
@ladia12 How did you resolve the issue of the original image disappearing when returning to the first activity? |
@ladia12 How did you resolve the issue of the original image disappearing when returning to the first activity? My original image is in recyclerview's viewholder |
I ended up using Picasso for the shared element transition. It wasn't fixed
in Fresco. So Picasso is lightweight and there isn'y any problem using it
alongwith Fresco.
…On Wed, Jun 19, 2019 at 5:11 PM bembem1011 ***@***.***> wrote:
@ladia12 <https://github.com/ladia12> How did you resolve the issue of
the original image disappearing when returning to the first activity? My
original image is in recyclerview's viewholder
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#22?email_source=notifications&email_token=AAXQ5WYUP5KBJYNBOZX7CCDP3ILM5A5CNFSM4A6ZMH32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYBSZCI#issuecomment-503524489>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAXQ5W5EXO5SV4R2PXVTG7LP3ILM5ANCNFSM4A6ZMH3Q>
.
|
Shared element transition doesn't seem to work.
Tested in a motorola device with android 5.0
The text was updated successfully, but these errors were encountered: