Fixed
Status Update
Comments
sa...@google.com <sa...@google.com>
za...@affirm.com <za...@affirm.com> #2
Thanks for taking this up! I just wanted to note that there is also a somewhat related ticket I created: https://issuetracker.google.com/issues/261314581
sa...@google.com <sa...@google.com>
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-main
commit 5d0416cba55005bed8347353ff8575c43181ce33
Author: sanura <sanura@google.com>
Date: Thu Dec 08 21:45:50 2022
Have ComponentDialog implement SavedStateRegistryOwner
Having ComponentDialog implement SavedStateRegistryOwner
to aid developers in using Jetpack Compose, which requires
components to be both a LifecycleOwner and
a SavedStateRegistryOwner.
RelNote: "`ComponentDialog` is now also a
`SavedStateRegistryOwner` and has access
to its own `SavedStateRegistry`."
Bug: 261162296
Test: ComponentDialogTest.savedState()
Change-Id: Idca172600df720d8b724e8bc6971b0d933864253
M activity/activity/api/current.txt
M activity/activity/api/public_plus_experimental_current.txt
M activity/activity/api/restricted_current.txt
M activity/activity/src/androidTest/java/androidx/activity/ComponentActivitySavedStateTest.kt
M activity/activity/src/androidTest/java/androidx/activity/ComponentDialogTest.kt
M activity/activity/src/main/java/androidx/activity/ComponentDialog.kt
https://android-review.googlesource.com/2336525
Branch: androidx-main
commit 5d0416cba55005bed8347353ff8575c43181ce33
Author: sanura <sanura@google.com>
Date: Thu Dec 08 21:45:50 2022
Have ComponentDialog implement SavedStateRegistryOwner
Having ComponentDialog implement SavedStateRegistryOwner
to aid developers in using Jetpack Compose, which requires
components to be both a LifecycleOwner and
a SavedStateRegistryOwner.
RelNote: "`ComponentDialog` is now also a
`SavedStateRegistryOwner` and has access
to its own `SavedStateRegistry`."
Bug: 261162296
Test: ComponentDialogTest.savedState()
Change-Id: Idca172600df720d8b724e8bc6971b0d933864253
M activity/activity/api/current.txt
M activity/activity/api/public_plus_experimental_current.txt
M activity/activity/api/restricted_current.txt
M activity/activity/src/androidTest/java/androidx/activity/ComponentActivitySavedStateTest.kt
M activity/activity/src/androidTest/java/androidx/activity/ComponentDialogTest.kt
M activity/activity/src/main/java/androidx/activity/ComponentDialog.kt
ap...@google.com <ap...@google.com> #4
Project: platform/frameworks/support
Branch: androidx-main
commit ef85e7e7f4e5742d9668f98c15be6b214b00e6f9
Author: sanura <sanura@google.com>
Date: Wed Jan 04 00:00:32 2023
Have ComponentDialog also set ViewTreeSavedStateRegistryOwner
Now that ComponentDialog is a SavedStateRegistryOwner,
it should also set it during its ViewTree initialization.
RelNote: "`ComponentDialog` now also sets the
`SavedStateRegistryOwner` for its ViewTree."
Bug: 261162296
Test: testViewTreeSavedStateRegistryOwner
Change-Id: I7346856b333933e03f5d3b0d380f5122b4856908
M activity/activity/src/androidTest/java/androidx/activity/ComponentDialogTest.kt
M activity/activity/src/main/java/androidx/activity/ComponentDialog.kt
https://android-review.googlesource.com/2374989
Branch: androidx-main
commit ef85e7e7f4e5742d9668f98c15be6b214b00e6f9
Author: sanura <sanura@google.com>
Date: Wed Jan 04 00:00:32 2023
Have ComponentDialog also set ViewTreeSavedStateRegistryOwner
Now that ComponentDialog is a SavedStateRegistryOwner,
it should also set it during its ViewTree initialization.
RelNote: "`ComponentDialog` now also sets the
`SavedStateRegistryOwner` for its ViewTree."
Bug: 261162296
Test: testViewTreeSavedStateRegistryOwner
Change-Id: I7346856b333933e03f5d3b0d380f5122b4856908
M activity/activity/src/androidTest/java/androidx/activity/ComponentDialogTest.kt
M activity/activity/src/main/java/androidx/activity/ComponentDialog.kt
za...@affirm.com <za...@affirm.com> #5
Great to see the progress on this! Just curious, in the other bug I linked I noted that AppcompatDialog which inherits from ComponentDialog doesn't call some methods on super which would trigger this new code, instead AppcompatDialog calls some delegate methods which don't reach ComponentDialog. Will that be addressed as well?
sa...@google.com <sa...@google.com> #6
re #5: Please use the other bug (
za...@affirm.com <za...@affirm.com> #7
Ah dang I am not a google employee so can't see that bug.
sa...@google.com <sa...@google.com> #9
My apologies. Public link is
na...@google.com <na...@google.com> #10
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.activity:activity:1.7.0-alpha03
Description
Component used: Activity
Version used: 1.7.0-alpha02
It would be really convenient if
ComponentDialog
, in addition to implementingLifecycleOwner
andOnBackPressedDispatcherOwner
, would also implementSavedStateRegistryOwner
.That
SavedStateRegistryOwner
should be plugged into theDialog
class'onSaveInstanceState
andonRestoreInstanceState
.This would make it much easier to use Jetpack Compose in a
ComponentDialog
, since Jetpack Compose requires both aLifecycleOwner
and aSavedStateRegistryOwner
attached to the Window via the ViewTree APIs.