Fixed
Status Update
Comments
ra...@google.com <ra...@google.com>
al...@google.com <al...@google.com>
sr...@google.com <sr...@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)
}
}
sr...@google.com <sr...@google.com>
yo...@gmail.com <yo...@gmail.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
xa...@google.com <xa...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit 561cb75bdf7e971f0ba2dec3cdc3286e1b415ecf
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Jan 16 23:53:00 2024
Add Fragment.content extension
Provides an easy integration for providing Compose content inside of a
Fragment that sets the ComposeView and ViewCompositionStrategy.
RelNote: "The new Fragment Compose module provides a Fragment.content
extension function to handle setting a Fragment's view in Compose."
Test: added test
Bug: 258046948
Change-Id: Ia166527918517593e94bcae239ff714df4dc00ad
M fragment/fragment-compose/api/current.txt
M fragment/fragment-compose/api/restricted_current.txt
M fragment/fragment-compose/build.gradle
A fragment/fragment-compose/src/androidTest/AndroidManifest.xml
A fragment/fragment-compose/src/androidTest/java/androidx/fragment/compose/FragmentTest.kt
A fragment/fragment-compose/src/androidTest/java/androidx/fragment/compose/test/TestActivity.kt
A fragment/fragment-compose/src/androidTest/res/layout/activity_main.xml
A fragment/fragment-compose/src/main/java/androidx/fragment/compose/Fragment.kt
https://android-review.googlesource.com/2911416
Branch: androidx-main
commit 561cb75bdf7e971f0ba2dec3cdc3286e1b415ecf
Author: Jeremy Woods <jbwoods@google.com>
Date: Tue Jan 16 23:53:00 2024
Add Fragment.content extension
Provides an easy integration for providing Compose content inside of a
Fragment that sets the ComposeView and ViewCompositionStrategy.
RelNote: "The new Fragment Compose module provides a Fragment.content
extension function to handle setting a Fragment's view in Compose."
Test: added test
Bug: 258046948
Change-Id: Ia166527918517593e94bcae239ff714df4dc00ad
M fragment/fragment-compose/api/current.txt
M fragment/fragment-compose/api/restricted_current.txt
M fragment/fragment-compose/build.gradle
A fragment/fragment-compose/src/androidTest/AndroidManifest.xml
A fragment/fragment-compose/src/androidTest/java/androidx/fragment/compose/FragmentTest.kt
A fragment/fragment-compose/src/androidTest/java/androidx/fragment/compose/test/TestActivity.kt
A fragment/fragment-compose/src/androidTest/res/layout/activity_main.xml
A fragment/fragment-compose/src/main/java/androidx/fragment/compose/Fragment.kt
il...@google.com <il...@google.com> #5
This has been fixed internally and will be available in the Fragment 1.7.0-alpha09
release.
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #6
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.wear.protolayout:protolayout-material-core:1.1.0-rc01
androidx.wear.tiles:tiles-tooling:1.3.0-rc01
androidx.wear.tiles:tiles-tooling-preview:1.3.0-rc01
Description
Android Gradle Plugin: 3.3.0-alpha07
Gradle: 4.9
Load the arch components Gihub browser sample app
Actual:
With stable AGP versions (e.g. 3.1.2 or 3.1.4), it fails to sync and forces you to use AGP 3.3a7 .
Expected:
preview AS builds should sync with any AGP stable version from at least the last 12 months.