Fixed
Status Update
Comments
my...@gmail.com <my...@gmail.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)
}
}
se...@google.com <se...@google.com>
jb...@google.com <jb...@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
my...@gmail.com <my...@gmail.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
jb...@google.com <jb...@google.com> #5
This has been fixed internally and will be available in the Fragment 1.7.0-alpha09
release.
my...@gmail.com <my...@gmail.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
jb...@google.com <jb...@google.com> #7
Still couldn't make see in the app. But was able to reproduce based on the class throwing the error and get a fix.
ap...@google.com <ap...@google.com> #8
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 236cdbe9c248e30d0120e5c23933b74581ae9198
Author: Jeremy Woods <jbwoods@google.com>
Date: Thu Jul 09 11:00:56 2020
Fix NullSafeMutableLiveData resolve error
When attempting to assign a MutableList to a MutableLiveData value, the
lint rule can fail to resolve a DOT_EXPRESSION and throw an error.
We should add null checks to avoid the error.
Test: Added NonNullableMutableLiveData test
Bug: 159987480
Change-Id: Ie3136bdd5362e7aa699a2b0b2f42caac03ed5217
M lifecycle/lifecycle-livedata-core-ktx-lint/build.gradle
M lifecycle/lifecycle-livedata-core-ktx-lint/src/main/java/androidx/lifecycle/lint/NonNullableMutableLiveDataDetector.kt
M lifecycle/lifecycle-livedata-core-ktx-lint/src/test/java/androidx/lifecycle/lint/NonNullableMutableLiveDataDetectorTest.kt
https://android-review.googlesource.com/1358935
Branch: androidx-master-dev
commit 236cdbe9c248e30d0120e5c23933b74581ae9198
Author: Jeremy Woods <jbwoods@google.com>
Date: Thu Jul 09 11:00:56 2020
Fix NullSafeMutableLiveData resolve error
When attempting to assign a MutableList to a MutableLiveData value, the
lint rule can fail to resolve a DOT_EXPRESSION and throw an error.
We should add null checks to avoid the error.
Test: Added NonNullableMutableLiveData test
Bug: 159987480
Change-Id: Ie3136bdd5362e7aa699a2b0b2f42caac03ed5217
M lifecycle/lifecycle-livedata-core-ktx-lint/build.gradle
M lifecycle/lifecycle-livedata-core-ktx-lint/src/main/java/androidx/lifecycle/lint/NonNullableMutableLiveDataDetector.kt
M lifecycle/lifecycle-livedata-core-ktx-lint/src/test/java/androidx/lifecycle/lint/NonNullableMutableLiveDataDetectorTest.kt
jb...@google.com <jb...@google.com> #9
This has been fixed internally and will be available in the Lifecycle 2.3.0-alpha06 release.
my...@gmail.com <my...@gmail.com> #10
Hi the error at line 133 seems resolved in alpha06 but the error at line 105 is still there.
b9...@gmail.com <b9...@gmail.com> #11
My lint check passed in 2.3.0-alpha05 but failed in 2.3.0-alpha06 with this same error: `Message: org.jetbrains.kotlin.asJava.elements.KtLightMethodImpl cannot be cast to com.intellij.psi.PsiVariable`
jb...@google.com <jb...@google.com> #12
please file a new bug with a minimal sample project.
Description
Component & version used:
Devices/Android versions reproduced on: N/A
Source code:https://github.com/Mygod/VPNHotspot/commit/cc14f607ef48bba755350e68bef68c0f256377fd
Circle CI build:https://app.circleci.com/pipelines/github/Mygod/VPNHotspot/92/workflows/6676d5ec-59eb-4353-845a-4a398c53d90f/jobs/459/steps (should be accessible with any account)
Relevant part of compiler output: