-
Notifications
You must be signed in to change notification settings - Fork 213
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
Option dialog configuration fix #1266
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for noticing this issue and putting together this fix!
This generally looks good, I just think there are two issues that we need to address before we can merge it.
First, after rotation the device, it doesn't seem like tapping on the buttons is working for me.
Video
Screen.Recording.2023-09-22.at.4.09.59.PM.mov
Second, we need to make sure this code runs on older versions of Android (this is what I brought up in my other comment).
@RequiresApi(Build.VERSION_CODES.TIRAMISU) | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
savedInstanceState?.let { | ||
options.addAll(it.getParcelableArrayList(KEY_OPTIONS, OptionsDialogOption::class.java) ?: mutableListOf()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works fine on phones running Android 13, but any phones running older versions of Android will crash when they try to call the getParcelableArrayList
method that only exists on Android 13. We need to do a version check and call the appropriate method for both Android 13 and for earlier versions. I would suggest creating an extension method similar to what we did with getSerializableCompat.
@CalebKL Do you intend to work on this or should I close the PR? |
Description
This PR fixes optionDialog configuration bug by saving and retrieving the data as a Parcelable object.
Fixes #
#1220
Testing Instructions
Screenshots or Screencast
record.mp4
Checklist
./gradlew spotlessApply
to automatically apply formatting/linting)modules/services/localization/src/main/res/values/strings.xml
I have tested any UI changes...