-
Notifications
You must be signed in to change notification settings - Fork 45
android:defaultValue ignored when using PreferenceDataStore #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What do you mean by "doesn't work as expected"? Maybe the problems are related to this sentence in the documentation:
|
Oh it means that the default value passed is discarded and no default value is set. For example, the implementation of onSetInitialValue usually looks like this: (taken from
You see when restoreValue is true, defaultValue is discarded. |
Can't decide whether it's intentional or Google messed it up. Did you report it on the issue tracker? |
I reported but I'm too lazy to provide steps to reproduce for Google so they probably won't fix it. Another evidence that it's Google messing it up, have a look at the signature of
Why would anyone pass |
Reading the source code of androidx, I think this has been fixed. |
This is the decompiled Java code of
Preference.dispatchSetInitialValue
:Unfortunately
onSetInitialValue(true, defaultValue)
doesn't work as expected. Also persisted attribute is ignored when data store is active. I wonder if there's a way to fix this in this library.The text was updated successfully, but these errors were encountered: