Fixed
Status Update
Comments
da...@google.com <da...@google.com>
jo...@onsalesit.com <jo...@onsalesit.com> #2
hmm room builder cannot take converters because we need them at compile time BUT we can receive a converter factory instead of initializing them ourselves.
Then one can write a type converter producer similar to view models .
https://github.com/googlesamples/android-architecture-components/blob/master/GithubBrowserSample/app/src/main/java/com/android/example/github/viewmodel/GithubViewModelFactory.kt
Then one can write a type converter producer similar to view models .
da...@google.com <da...@google.com> #3
Yes, that would be very much appreciated!
Description
In Room 2.3.0-alpha04 built-in enum support was added via a enum to string type converter. If a user already has a type converter Room should prioritize using user defined converters but there is a bug where if a one-way out converter (from Cursor to Enum) is defined, Room might incorrectly use the built-in one causing issues. This bug track such problem
It was fixed byhttps://android-review.googlesource.com/c/platform/frameworks/support/+/1524200 , but didn't make it into the 2.3.0-alpha04 release but instead it will be available in the next upcoming release.
As a workaround and one can define a method, for the one-way write converter which will make Room effectively making a two-way converter for the Enum which Room will correctly priortize over the built-in one.