Status Update
Comments
mg...@google.com <mg...@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 ac869c99d561c43b5235bf58a35b859bb36e326f
Author: Marcello Galhardo <mgalhardo@google.com>
Date: Wed Mar 20 11:33:41 2024
Move `LocalViewModelStoreOwner` to common in `viewmodel-compose`
Test: N/A
Bug: 330323282
Change-Id: I3561ea2d7e70ee2741bdbefdd6c1625413994aeb
M lifecycle/lifecycle-viewmodel-compose/src/androidMain/kotlin/androidx/lifecycle/viewmodel/compose/LocalViewModelStoreOwner.android.kt
A lifecycle/lifecycle-viewmodel-compose/src/commonMain/kotlin/androidx/lifecycle/viewmodel/compose/LocalViewModelStoreOwner.kt
A lifecycle/lifecycle-viewmodel-compose/src/desktopMain/kotlin/androidx/lifecycle/viewmodel/compose/LocalViewModelStoreOwner.desktop.kt
ap...@google.com <ap...@google.com> #14
Branch: androidx-main
commit 358101c3e4ee1dd87464c1aec84de41309f706ac
Author: Marcello Galhardo <mgalhardo@google.com>
Date: Wed Mar 20 11:22:15 2024
Rename source from `viewmodel-compose` to follow KMP convention
Test: N/A
Bug: 330323282
Change-Id: I688e85f81215bcc9bd05829e1ea2f78fb09c4c50
M lifecycle/lifecycle-viewmodel-compose/src/androidInstrumentedTest/kotlin/androidx/lifecycle/viewmodel/compose/SavedStateHandleSaverTest.android.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidInstrumentedTest/kotlin/androidx/lifecycle/viewmodel/compose/TestViewModelClasses.android.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidInstrumentedTest/kotlin/androidx/lifecycle/viewmodel/compose/ViewModelInAppCompatActivityTest.android.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidInstrumentedTest/kotlin/androidx/lifecycle/viewmodel/compose/ViewModelInComponentActivityTest.android.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidInstrumentedTest/kotlin/androidx/lifecycle/viewmodel/compose/ViewModelInFragmentTest.android.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidInstrumentedTest/kotlin/androidx/lifecycle/viewmodel/compose/ViewModelTest.android.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidMain/kotlin/androidx/lifecycle/viewmodel/compose/LocalViewModelStoreOwner.android.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidMain/kotlin/androidx/lifecycle/viewmodel/compose/SavedStateHandleSaveableApi.android.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidMain/kotlin/androidx/lifecycle/viewmodel/compose/SavedStateHandleSaver.android.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidMain/kotlin/androidx/lifecycle/viewmodel/compose/ViewModel.android.kt
ap...@google.com <ap...@google.com> #15
Branch: androidx-main
commit b7acab4368186972bb3138c45628cabc971b6fe2
Author: Marcello Galhardo <mgalhardo@google.com>
Date: Wed Mar 20 11:24:42 2024
Update Compose UI and Runtime to 1.6.0 in `viewmodel-compose`
* Required to use the `Composable` annotation from the common source set.
Test: N/A
Bug: 330323282
Change-Id: I664449a501ef1d274b91cb3ad196cf5802d5f74b
M lifecycle/lifecycle-viewmodel-compose/build.gradle
ap...@google.com <ap...@google.com> #16
Branch: androidx-main
commit 87fc3ece00231d3310d3f08746b6890c908722e0
Author: Marcello Galhardo <mgalhardo@google.com>
Date: Wed Mar 27 14:53:26 2024
Fix corrupt serialized resolution result in `viewmodel-compose`
* Converting `lifecycle-viewmodel-compose` to Kotlin Multiplatform, and transitively depending on `lifecycle-livedata-core` triggered a bug in Gradle (
* Directly adding `lifecycle-livedata-core` to `androidMain` allowed us to workaround the issue.
Test: `./gradlew :lifecycle:lifecycle-viewmodel-compose:compileCommonMainKotlinMetadata -Pandroidx.constraints=true`
Bug: 330323282
Change-Id: I0eb4c79efeb65e049f51706c6dcefce0d1ab83a4
M lifecycle/lifecycle-viewmodel-compose/build.gradle
ap...@google.com <ap...@google.com> #17
Branch: androidx-main
commit fc493abaa7ecb38655922406691d1454f084b6ec
Author: Marcello Galhardo <mgalhardo@google.com>
Date: Wed Mar 27 14:57:55 2024
Align all `implementation` declarations in `viewmodel-compose`
Test: N/A
Bug: 330323282
Change-Id: Ice8418438e70d633b59ae52cf3071d7b8c70e863
M lifecycle/lifecycle-viewmodel-compose/build.gradle
ap...@google.com <ap...@google.com> #18
Branch: androidx-main
commit 7a8b0a8f054a488f1fa3762269b3c812d5c8fbf1
Author: Marcello Galhardo <mgalhardo@google.com>
Date: Wed Mar 20 11:26:09 2024
Move dependencies to `commonMain` in `viewmodel-compose`
Test: N/A
Bug: 330323282
Change-Id: Icdf9d69a73de2ffc780355b2a84f21387ec4550c
M lifecycle/lifecycle-viewmodel-compose/build.gradle
ap...@google.com <ap...@google.com> #19
Branch: androidx-main
commit 923f14b702f2b1cd7c2e1a626a3320737ea88e3a
Author: Marcello Galhardo <mgalhardo@google.com>
Date: Wed Mar 20 11:39:47 2024
Add `KClass` method variants in `viewmodel-compose`
RelNote: "Composable `viewModel` functions now accept a `KClass` for Multiplatform compatibility. The `Class` variants are kept for Android compatibility."
Test: N/A
Bug: 330323282
Change-Id: I309315a069205acd87f7752d31c8a91ffc5ffbe7
M lifecycle/lifecycle-viewmodel-compose/api/current.txt
M lifecycle/lifecycle-viewmodel-compose/api/restricted_current.txt
M lifecycle/lifecycle-viewmodel-compose/src/androidMain/kotlin/androidx/lifecycle/viewmodel/compose/ViewModel.android.kt
ap...@google.com <ap...@google.com> #20
Branch: androidx-main
commit ee955583f497b4c4ed60b95703282db85319534a
Author: Marcello Galhardo <mgalhardo@google.com>
Date: Wed Mar 20 11:18:32 2024
Configure KMP in `viewmodel-compose`
* Setup the build scripts.
* Setup folder hierarchy.
Test: N/A
Bug: 330323282
Change-Id: I7461c27e0e90774c5391b971bfd3e58772cc0c9e
M docs-tip-of-tree/build.gradle
M lifecycle/lifecycle-viewmodel-compose/build.gradle
M lifecycle/lifecycle-viewmodel-compose/src/androidInstrumentedTest/AndroidManifest.xml
M lifecycle/lifecycle-viewmodel-compose/src/androidInstrumentedTest/kotlin/androidx/lifecycle/viewmodel/compose/SavedStateHandleSaverTest.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidInstrumentedTest/kotlin/androidx/lifecycle/viewmodel/compose/TestViewModelClasses.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidInstrumentedTest/kotlin/androidx/lifecycle/viewmodel/compose/ViewModelInAppCompatActivityTest.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidInstrumentedTest/kotlin/androidx/lifecycle/viewmodel/compose/ViewModelInComponentActivityTest.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidInstrumentedTest/kotlin/androidx/lifecycle/viewmodel/compose/ViewModelInFragmentTest.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidInstrumentedTest/kotlin/androidx/lifecycle/viewmodel/compose/ViewModelTest.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidMain/kotlin/androidx/lifecycle/viewmodel/compose/LocalViewModelStoreOwner.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidMain/kotlin/androidx/lifecycle/viewmodel/compose/SavedStateHandleSaveableApi.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidMain/kotlin/androidx/lifecycle/viewmodel/compose/SavedStateHandleSaver.kt
M lifecycle/lifecycle-viewmodel-compose/src/androidMain/kotlin/androidx/lifecycle/viewmodel/compose/ViewModel.kt
ap...@google.com <ap...@google.com> #21
Branch: androidx-main
commit 7a8b46834cd8070ef519ac1d118115bcb62924ad
Author: Marcello Galhardo <mgalhardo@google.com>
Date: Wed Mar 20 11:44:25 2024
Move `ViewModel.kt` to common in `viewmodel-compose`
Test: N/A
Bug: 330323282
Change-Id: I88d7c2a876b7469f301870a139b733c9db15cb8d
M lifecycle/lifecycle-viewmodel-compose/src/androidMain/kotlin/androidx/lifecycle/viewmodel/compose/ViewModel.android.kt
A lifecycle/lifecycle-viewmodel-compose/src/commonMain/kotlin/androidx/lifecycle/viewmodel/compose/ViewModel.kt
ap...@google.com <ap...@google.com> #22
Branch: androidx-main
commit 22bf2247c81917a7d8e08d5d58e1a1b82c4fd6d9
Author: Marcello Galhardo <mgalhardo@google.com>
Date: Wed Mar 20 11:36:08 2024
Add `factory` param to KDocs in `viewmodel-compose`
* Required for moving from `docs` to `kmpDocs`.
* Fixes `UnknownLine` Missing `@param` tag for parameter `factory` in DFunction `viewModel`
Test: N/A
Bug: 330323282
Change-Id: Iea301a001d6e47e038aa1e03cb5bc8e5c3b28bc2
M lifecycle/lifecycle-viewmodel-compose/src/androidMain/kotlin/androidx/lifecycle/viewmodel/compose/ViewModel.android.kt
ap...@google.com <ap...@google.com> #23
Branch: androidx-main
commit 8c39ccf27d8a9656c2d22a464a9863e9af2e293e
Author: Marcello Galhardo <mgalhardo@google.com>
Date: Wed Mar 27 17:17:46 2024
Set LiveData to `compile` in `viewmodel-compose`
* Replace `implementation(projectOrArtifact(":lifecycle:lifecycle-livedata-core"))` by `compileOnly(projectOrArtifact(":lifecycle:lifecycle-livedata-core"))`
Test: `./gradlew :lifecycle:lifecycle-viewmodel-compose:compileCommonMainKotlinMetadata -Pandroidx.constraints=true`
Bug: 330323282
Change-Id: I1e3c65fb268b91ae489650995caa3cd33a452f57
M lifecycle/lifecycle-viewmodel-compose/build.gradle
Description
Now that b/214568825 ), we should follow-up migrating
lifecycle-viewmodel
has been migrated to Kotlin Multiplatform (seelifecycle-viewmodel-compose
too.