Status Update
Comments
jb...@google.com <jb...@google.com> #2
Jeremy, is this still an issue? I think the problem was that you had two transitions targeting the same View for the same action (e.g. two Slide() transitions).
dn...@google.com <dn...@google.com> #3
I have a similar issue with plain AnimatorSet:
set.start()
set.pause()
set.setCurrentPlayTime(100)
set.setCurrentPlayTime(0)
set.setCurrentPlayTime(100)
set.resume()
doesn't play animation in resume().
jb...@google.com <jb...@google.com> #4
Should clarify that if I filter out setCurrentPlayTime(0)
(or replace it with setCurrentPlayTime(1)
) it works well.
Also even with setCurrentPlayTime(0)
, onAnimationEnd
is notified with correct delay (as if the animation has played).
th...@outlook.com <th...@outlook.com> #5
@
I think that is intended for Animator. If you set the currentPlayTime
to 0 or the total duration the animator completes. We do some
th...@outlook.com <th...@outlook.com> #6
Did some investigation on the Fragment side and it seems like the merged transition is targeting correctly.
Exiting Transition: Slide@aa9288e: tgts(android.widget.LinearLayout{f9add3d})
>>>>> ExitingViews <<<<<
View: android.widget.LinearLayout{f9add3d}
Entering Transition: Slide@35b8af: tgts(android.widget.LinearLayout{b7f24bc})
>>>>> EnteringViews <<<<<
View: android.widget.LinearLayout{b7f24bc}
Final merged transition: TransitionSet@7bc1c45:
TransitionSet@e133f9a:
Slide@aa9288e: tgts(android.widget.LinearLayout{f9add3d})
Slide@35b8af: tgts(android.widget.LinearLayout{b7f24bc})
merged transition passed to controlDelayedTransition: TransitionSet@7bc1c45:
TransitionSet@e133f9a:
Slide@aa9288e: tgts(android.widget.LinearLayout{f9add3d})
Slide@35b8af: tgts(android.widget.LinearLayout{b7f24bc})
Still digging.
il...@google.com <il...@google.com> #7
Branch: androidx-main
commit 567b7459329d1ec8d27a8c6fe1c4a86442065d7d
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Sep 26 20:06:54 2023
Add additional logging for transitions
Adding more debug logging in transitions to track the entering and
exiting transitions as well as the final merged transition and its
targets.
Test: added logging
Bug: 300157785
Change-Id: I0d9ad72b865422493c6c895ddb6115abf85eed16
M fragment/fragment/src/main/java/androidx/fragment/app/DefaultSpecialEffectsController.kt
th...@outlook.com <th...@outlook.com> #8
So I have isolated this outside of fragment into something much simpler and I think it breaks down when it comes to the adding and removing of Views with animateToStart.
The attached sample is a simple add that goes between two screens BLUE
and GREEN
. It has code for both the 1.5.0-alpha03
and 1.5.0-alpha04
versions, but I think alpha04 is currently broken in another way so I will upload the alpha03 version here.
This is integrated with predictive back similar to how fragment is, so upon cancelling we call animateToStart
, then we do a beginDelayedTransition
on a 0
duration Fade()
and we reverse the view visibility back to what it was prior to starting the transition.
If you only do visibility, cancel always works the view never goes away, it is wonderful, but when you do adding and removing views like we need to in fragment it fails.
First the code for beginDelayedTransition goes from this:
TransitionManager.beginDelayedTransition(container, Fade().apply {
duration = 0
})
reverseViews()
to this:
TransitionManager.beginDelayedTransition(container, Fade().apply {
duration = 0
addListener(onEnd = {
reverseViews()
blueScreen.visibility = View.VISIBLE
greenScreen.visibility = View.VISIBLE
})
})
reverseViews(useVisibility = true)
We need to make this change because after the animateToStart()
view is still parented by the overlay, so we call reverseViews(useVisibility = true)
to only change the visibility and then once the transition finishes we can call reverseViews()
to parent the view properly, then we make both views visible again.
From our perspective after the 0
duration transition our views are back in the proper state, but they do not transition properly after a cancel.
If the app is doing this wrong and we can make the appropriate fixes, doing the same in fragment should resolve this. There is logging available that shows the state of the views when we start the transition.
jb...@google.com <jb...@google.com> #9
The API has changed since that project was created in a way that makes the API more robust. I'm hoping that has fixed this...
th...@outlook.com <th...@outlook.com> #10
There appears to be a problem with the order of operations. I'm going to look into fixing that.
jb...@google.com <jb...@google.com>
il...@google.com <il...@google.com> #11
Branch: androidx-main
commit e57dd5f9ac6cbb8cf83b221e2d5b3fbd3e88ce6b
Author: George Mount <mount@google.com>
Date: Thu Nov 09 14:33:53 2023
Fix animateToStart with Slide.
Fixes: 300157785
Slide was not repositioning the View to its proper
translation after animating it to the start position.
This fixes that so that it is moved.
Test: new test
Change-Id: I698f4dbcef46304f9aa545847d205f7b70c80d63
M transition/transition/src/androidTest/java/androidx/transition/SlideEdgeTest.java
M transition/transition/src/androidTest/java/androidx/transition/TranslationAnimationCreatorTest.java
M transition/transition/src/main/java/androidx/transition/TranslationAnimationCreator.java
jb...@google.com <jb...@google.com>
ap...@google.com <ap...@google.com> #12
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.transition:transition:1.5.0-alpha05
jb...@google.com <jb...@google.com> #13
This has been fixed internally and will be available in the Fragment 1.7.0-beta01
release.
th...@outlook.com <th...@outlook.com> #14
Thank you for your work.
Are the changes mentioned in
FATAL EXCEPTION: main
Process: com.example.pbfragmentsharedelement, PID: 3103
java.lang.IllegalStateException: setCurrentPlayTimeMillis() called after animation has been started
at androidx.transition.Transition$SeekController.setCurrentPlayTimeMillis(Transition.java:2778)
at androidx.transition.FragmentTransitionSupport.setCurrentPlayTime(FragmentTransitionSupport.java:265)
at androidx.fragment.app.DefaultSpecialEffectsController$TransitionEffect.onProgress(DefaultSpecialEffectsController.kt:798)
at androidx.fragment.app.SpecialEffectsController.processProgress(SpecialEffectsController.kt:441)
at androidx.fragment.app.FragmentManager$1.handleOnBackProgressed(FragmentManager.java:513)
at androidx.activity.OnBackPressedDispatcher.onBackProgressed(OnBackPressedDispatcher.kt:255)
at androidx.activity.OnBackPressedDispatcher.access$onBackProgressed(OnBackPressedDispatcher.kt:63)
at androidx.activity.OnBackPressedDispatcher$2.invoke(OnBackPressedDispatcher.kt:129)
at androidx.activity.OnBackPressedDispatcher$2.invoke(OnBackPressedDispatcher.kt:127)
at androidx.activity.OnBackPressedDispatcher$Api34Impl$createOnBackAnimationCallback$1.onBackProgressed(OnBackPressedDispatcher.kt:388)
at android.window.WindowOnBackInvokedDispatcher$OnBackInvokedCallbackWrapper.lambda$onBackStarted$0(WindowOnBackInvokedDispatcher.java:329)
at android.window.WindowOnBackInvokedDispatcher$OnBackInvokedCallbackWrapper$$ExternalSyntheticLambda5.onProgressUpdate(Unknown Source:2)
at android.window.BackProgressAnimator.updateProgressValue(BackProgressAnimator.java:161)
at android.window.BackProgressAnimator.-$$Nest$mupdateProgressValue(Unknown Source:0)
at android.window.BackProgressAnimator$1.setValue(BackProgressAnimator.java:61)
at android.window.BackProgressAnimator$1.setValue(BackProgressAnimator.java:57)
at com.android.internal.dynamicanimation.animation.DynamicAnimation.setPropertyValue(DynamicAnimation.java:731)
at com.android.internal.dynamicanimation.animation.DynamicAnimation.doAnimationFrame(DynamicAnimation.java:687)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:344)
at android.animation.AnimationHandler.-$$Nest$mdoAnimationFrame(Unknown Source:0)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:87)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1341)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1352)
at android.view.Choreographer.doCallbacks(Choreographer.java:952)
at android.view.Choreographer.doFrame(Choreographer.java:878)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1326)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8248)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
jb...@google.com <jb...@google.com> #15
If you used a snapshot from this morning it should be fixed. Are you doing the same thing in these 3 cases and seeing different results? Could you further explain how you get these 3 cases?
th...@outlook.com <th...@outlook.com> #16
I did use the very latest snapshot version from this morning.
There are 2 different ways to trigger an issue and both issues trigger the same leak from
The first issue, leading to the crash in the stacktrace in
Press the button to open the second fragment and interrupt the opening animation by performing the back gesture (without seeking).
Press the second fragment button again before the closing animation is finished and interrupt the opening animation again using the back gesture.
The second issue, to get into an undefined state, is to:
Press the button to open the second fragment.
Press the back button in the toolbar at the time the opening animation is finishing.
The timing has to be just right but the issue can be triggered fairly consistently.
Both issues can be experienced using the project attached to
jb...@google.com <jb...@google.com> #18
I am closing this as I have not been able to reliably produce any of the mentioned errors with the latest library versions and this bug was about providing support for shared elements, which did. I did see a case where if you use system back to interrupt, that the transition didn't finish, but I couldn't reproduce that either.
If you can provide an app that reproduces this case reliably please file a new bug.
th...@outlook.com <th...@outlook.com> #19
The last issue with predictive back I've come across was fixed in fragment-1.8.5. Thanks for the fixes.
Description
Component used: Fragment
After the release of Android 14 brought predictive back, Material Components added support for Material Motion Transitions . Unfortunately the shared element transition that would bring the coolest effects does not yet work, because the Fragment library does not support predictive back with this type of transition.
This is where I would like to request predictive back support for the shared element transition in the AndroidX Fragment library.
Ref:https://github.com/material-components/material-components-android/issues/3619#issuecomment-1883473193