Status Update
Comments
ap...@google.com <ap...@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).
ap...@google.com <ap...@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().
ap...@google.com <ap...@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).
ap...@google.com <ap...@google.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
ap...@google.com <ap...@google.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.
ap...@google.com <ap...@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
ap...@google.com <ap...@google.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.
ap...@google.com <ap...@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...
ap...@google.com <ap...@google.com> #10
There appears to be a problem with the order of operations. I'm going to look into fixing that.
ap...@google.com <ap...@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
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
ap...@google.com <ap...@google.com> #13
Branch: androidx-main
commit 27355f7c30e816f6636928caeef29d473b896e28
Author: Sanura N'Jaka <sanura@google.com>
Date: Wed Aug 24 22:41:48 2022
Add project dependency constraint between lifecycle-viewmodel-savedstate and lifecycle-livedata-core
Added bi-directional project version constraint between
lifecycle-viewmodel-savedstate and lifecycle-livedata-core.
If both artifacts are in the dependency tree, their versions
should match. This will now be enforced by gradle automatically
bumping up either version to meet constraint.
Test: N/A
Fixes: 242871265
Change-Id: I94cc3ddd0f86033653c1477cf3f8ad8a1d93adae
M lifecycle/lifecycle-livedata-core/build.gradle
M lifecycle/lifecycle-viewmodel-savedstate/build.gradle
ap...@google.com <ap...@google.com> #14
Branch: androidx-main
commit 0598f5400a797fc9e31858e0d8a1b575ad7158a7
Author: Sanura N'Jaka <sanura@google.com>
Date: Thu Aug 18 18:28:20 2022
Add project dependency constraint between lifecycle-viewmodel-savedstate and lifecycle-viewmodel-compose
Added bi-directional project version constraint between
lifecycle-viewmodel-savedstate and lifecycle-viewmodel-compose.
If both artifacts are in the dependency tree, their versions
should match. This will now be enforced by gradle automatically
bumping up either version to meet constraint.
Test: N/A
Bug: 242871265
Change-Id: I2810d3afbe0cb8e8e387d1bc64eb3c698285d471
M lifecycle/lifecycle-viewmodel-savedstate/build.gradle
M lifecycle/lifecycle-viewmodel-compose/build.gradle
na...@google.com <na...@google.com> #15
This bug was linked in a change in the following release(s):
androidx.lifecycle:lifecycle-common:2.6.0-alpha02
androidx.lifecycle:lifecycle-livedata:2.6.0-alpha02
androidx.lifecycle:lifecycle-livedata-core:2.6.0-alpha02
androidx.lifecycle:lifecycle-livedata-core-ktx:2.6.0-alpha02
androidx.lifecycle:lifecycle-livedata-ktx:2.6.0-alpha02
androidx.lifecycle:lifecycle-reactivestreams:2.6.0-alpha02
androidx.lifecycle:lifecycle-reactivestreams-ktx:2.6.0-alpha02
androidx.lifecycle:lifecycle-runtime:2.6.0-alpha02
androidx.lifecycle:lifecycle-runtime-compose:2.6.0-alpha02
androidx.lifecycle:lifecycle-runtime-ktx:2.6.0-alpha02
androidx.lifecycle:lifecycle-runtime-testing:2.6.0-alpha02
androidx.lifecycle:lifecycle-viewmodel:2.6.0-alpha02
androidx.lifecycle:lifecycle-viewmodel-compose:2.6.0-alpha02
androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.0-alpha02
androidx.lifecycle:lifecycle-viewmodel-savedstate:2.6.0-alpha02
da...@google.com <da...@google.com> #16
This release seems to have conflicting artifacts in the classpath. When both:
androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.0-alpha02
androidx-lifecycle:lifecycle-livedata-ktx:2.6.0-alpha02
are added as dependencies, the following error pops up:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':sync:sync-test:checkProdDebugAndroidTestDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class androidx.lifecycle.ViewModelLazy found in modules lifecycle-viewmodel-2.6.0-alpha02-runtime (androidx.lifecycle:lifecycle-viewmodel:2.6.0-alpha02) and lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1)
Duplicate class androidx.lifecycle.ViewTreeViewModelKt found in modules lifecycle-viewmodel-2.6.0-alpha02-runtime (androidx.lifecycle:lifecycle-viewmodel:2.6.0-alpha02) and lifecycle-viewmodel-ktx-2.3.1-runtime (androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1)
Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
Downgrading to 2.6.0-alpha01
fixes this.
sa...@google.com <sa...@google.com> #17
As an update to the above comment from TJ, this issue has been fixed and will be available in Lifecycle 2.6.0-alpha03.
na...@google.com <na...@google.com> #18
The following release(s) address this bug:
androidx.lifecycle:lifecycle-runtime:2.6.0-alpha03
androidx.lifecycle:lifecycle-runtime-compose:2.6.0-alpha03
androidx.lifecycle:lifecycle-viewmodel-compose:2.6.0-alpha03
androidx.lifecycle:lifecycle-viewmodel-savedstate:2.6.0-alpha03
Description
Component used: Lifecycle
Version used: 2.6.0-alpha01
Until feature requests such as b/146802533 are released, Gradle does not do any enforcement that Lifecycle artifacts are of the same version (i.e., you could mix and match
lifecycle-common:2.6.0-alpha01
withlifecycle-runtime:2.5.1
).Gradle supports constraints , which ensure that upgrading a transitive dependency will also upgrade other dependencies.
We should manually add two way constraints, similarly to what was done for Paging in b/235256201 , to the various lifecycle artifacts, which will help Gradle enforce the same version policy we intend.
The pairs of artifacts we should add constraints to should match the dependencies we have right now, which should mean the list looks something like: