Fixed
Status Update
Comments
lp...@google.com <lp...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit dd000ea5e6eb3a8f07b869595ca62aa2fb781d12
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Mon Feb 22 19:42:13 2021
Fix for broken rememberSaveable { mutableStateOf(0) } with navigation-compose
Previously we were converting MutableState into a parcelable structure only for a direct child of the saving list. It was incorrect as SaveableStateHolder used in navigation is wrapping the state of the screen as a value into a Map. Now we will recursively iterate through List/Maps and covert all inner MutableState objects.
Fixes: 180042685
Fixes: 180701630
Test: new tests in ActivityRecreationTest
Relnote: Fix for broken rememberSaveable { mutableStateOf(0) } when used inside a destination of navigation-compose.
Change-Id: I1312b5b210dde32250945d164a2f3a1b574cb0a8
M compose/runtime/runtime-saveable/src/androidAndroidTest/AndroidManifest.xml
M compose/runtime/runtime-saveable/src/androidAndroidTest/kotlin/androidx/compose/runtime/saveable/ActivityRecreationTest.kt
M compose/runtime/runtime-saveable/src/commonMain/kotlin/androidx/compose/runtime/saveable/RememberSaveable.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/DisposableSaveableStateRegistry.android.kt
https://android-review.googlesource.com/1599261
Branch: androidx-main
commit dd000ea5e6eb3a8f07b869595ca62aa2fb781d12
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Mon Feb 22 19:42:13 2021
Fix for broken rememberSaveable { mutableStateOf(0) } with navigation-compose
Previously we were converting MutableState into a parcelable structure only for a direct child of the saving list. It was incorrect as SaveableStateHolder used in navigation is wrapping the state of the screen as a value into a Map. Now we will recursively iterate through List/Maps and covert all inner MutableState objects.
Fixes: 180042685
Fixes: 180701630
Test: new tests in ActivityRecreationTest
Relnote: Fix for broken rememberSaveable { mutableStateOf(0) } when used inside a destination of navigation-compose.
Change-Id: I1312b5b210dde32250945d164a2f3a1b574cb0a8
M compose/runtime/runtime-saveable/src/androidAndroidTest/AndroidManifest.xml
M compose/runtime/runtime-saveable/src/androidAndroidTest/kotlin/androidx/compose/runtime/saveable/ActivityRecreationTest.kt
M compose/runtime/runtime-saveable/src/commonMain/kotlin/androidx/compose/runtime/saveable/RememberSaveable.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/DisposableSaveableStateRegistry.android.kt
so...@gmail.com <so...@gmail.com> #3
Soh hoy nai kalpona Kori na komol sada Kalo
Description
When using a SummaryProvider with MultiSelectListPreference to display a summary of the currently selected items, SummaryProvider#provideSummary() is not called so the summary is not updated to represent the newly selected items. This is because notifyChanged() is not called from within setValues().
Comparison of code from ListPreference and MultiSelectListPreference
--- ListPreference ---
public void setValue(String value) {
// Always persist/notify the first time.
final boolean changed = !TextUtils.equals(mValue, value);
if (changed || !mValueSet) {
mValue = value;
mValueSet = true;
persistString(value);
if (changed) {
notifyChanged();
}
}
}
--- --- ---
--- MultiSelectListPreference ---
public void setValues(Set<String> values) {
mValues.clear();
mValues.addAll(values);
persistStringSet(values);
}
--- --- ---
Current workaround: subclass MultiSelectListPreference and override:
@Override
public void setValues(Set<String> values) {
super.setValues(values);
notifyChanged();
}