Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Another option is to provide a setContent
like API specifically for Fragments.
E.g., an extension like:
fun Fragment.content(content: @Composable () -> Unit): ComposeView {
return ComposeView(requireContext()).apply {
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
setContent(content)
}
}
which would let you write a Fragment like:
class ExampleFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
) = content {
// Write your @Composable content here
val viewModel: ExampleViewModel = viewModel()
// or extract it into a separate, testable method
ExampleComposable(viewModel)
}
}
il...@google.com <il...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit a066a43da39b518751bcbd5baed63decb657f3bb
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Jan 16 22:11:03 2024
Add Fragment Compose module in Androidx
Adding Fragment Compose module using the create_project.py script.
RelNote: n/a
Test: ./gradlew updateApi
Bug: 258046948
Change-Id: Ia35d149c8ab0d78331206accf53e25a717f97291
M docs-tip-of-tree/build.gradle
A fragment/fragment-compose/api/current.txt
A fragment/fragment-compose/api/res-current.txt
A fragment/fragment-compose/api/restricted_current.txt
A fragment/fragment-compose/build.gradle
A fragment/fragment-compose/src/main/java/androidx/fragment/androidx-fragment-fragment-compose-documentation.md
M settings.gradle
https://android-review.googlesource.com/2912225
Branch: androidx-main
commit a066a43da39b518751bcbd5baed63decb657f3bb
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Jan 16 22:11:03 2024
Add Fragment Compose module in Androidx
Adding Fragment Compose module using the create_project.py script.
RelNote: n/a
Test: ./gradlew updateApi
Bug: 258046948
Change-Id: Ia35d149c8ab0d78331206accf53e25a717f97291
M docs-tip-of-tree/build.gradle
A fragment/fragment-compose/api/current.txt
A fragment/fragment-compose/api/res-current.txt
A fragment/fragment-compose/api/restricted_current.txt
A fragment/fragment-compose/build.gradle
A fragment/fragment-compose/src/main/java/androidx/fragment/androidx-fragment-fragment-compose-documentation.md
M settings.gradle
Description
Version used: 1.0.0-rc01
From
Regarding this issue, as of 1.0.0-rc01, popEnterAnim works but popExitAnim doesn't. I was curious why, and noticed there is a small typo in the source code here:
it should be EXTRA_POP_EXIT_ANIM instead of EXTRA_POP_ENTER_ANIM.
Don't think that'll fix the issue, but it's still a small fix