Conversation
…ptions array included more values than the new array has in newer versions, so this ListPreference extension checks for bounds to prevent IOBException and defaults to the system value
Collaborator
Generated by 🚫 Danger |
Collaborator
|
📲 You can test the changes from this Pull Request in Simplenote Android by scanning the QR code below to install the corresponding build.
|
zwarm
approved these changes
Oct 17, 2025
zwarm
left a comment
There was a problem hiding this comment.
I left a single comment with regards to getValue possibly being null. Otherwise the code looks good.
| ) : ListPreference(context, attrs, defStyleAttr, defStyleRes) { | ||
|
|
||
| override fun getSummary(): CharSequence? { | ||
| val value = getValue() |
There was a problem hiding this comment.
@mzorz - is there a change that getValueI() can return null? I'm can't tell if findIndexOfValue(value) handles that case.
Contributor
Author
There was a problem hiding this comment.
Great observation! exactly that case is handled in findIndexOfValue, so no worries 👍
Contributor
Author
|
Thank you for your review @zwarm ! 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1772
Fix
What was happening
ListPreference crashes on resume because a deprecated theme value stored in SharedPreferences is an invalid index for the newly shortened resource array.
User selects 'Auto' theme (value 2) before it was deprecated.
The user's preference is stored in SharedPreferences. In an older version, the theme options included 'Auto' which corresponded to a value that is now invalid or points to a different entry.
The 'Auto' theme was removed in commit c43d0ad. The array_theme_values for API 29+ now only contains 3 items (0, 1, 2), but the user's stored value might be 3 (System) or 2 (Auto, which is now System).
0 1 2Fix:
Added a workaround to comply with existing saved preference where the options array included more values than the new array has in newer versions, so this ListPreference extension checks for bounds to prevent IOBException and defaults to the system value
Test
go to Build -> Generate Signed App Bundle or APK, choose APK, then populate the fields with the secret store data in gradle.properties, or ping me for to DM you a signed APK.
In the following video I show you all 3 updates:
Screen.Recording.2025-10-17.at.7.11.36.PM.mov
Review
Release