Add font preview to font preference picker dialog#101
Open
RobinJ1995 wants to merge 1 commit into
Open
Conversation
The Appearance font picker is a ListPreference dialog whose rows were all drawn in the current app font. Render each option in the font it names (Ubuntu row in Ubuntu, Oxygen in Oxygen, OpenDyslexic in OpenDyslexic; System default stays the device font) so the user previews a font while choosing it. Adds FontListPreferenceDialogFragment, a frosted list-preference dialog that installs a custom single-choice adapter applying the per-option typeface, and routes the "font" preference to it. FontPreference gains typefaceFor(context, value) to resolve any option's typeface. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_017QpoubQoCriCnSKSB4Avxx
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.
Summary
Implemented a custom font preference dialog that previews each available font option in its own typeface, allowing users to see what each font looks like before selecting it.
Key Changes
New
FontListPreferenceDialogFragmentclass: Custom dialog fragment that extendsFrostedListPreferenceDialogFragmentand renders each font option in its corresponding typefaceArrayAdapterto apply the appropriateTypefaceto each list itemListPreferencebehavior)onDialogClosed()New
typefaceFor()method inFontPreference: Public utility function that resolves a typeface for any given font preference value, independent of the currently stored preferenceUpdated
PreferencesActivity.onDisplayPreferenceDialog(): Routes font preference dialogs to the newFontListPreferenceDialogFragmentwhile keeping other list preferences on the standardFrostedListPreferenceDialogFragmentImplementation Details
ListPreferenceDialogFragmentCompatselect-and-persist flow because the base class uses private fields that can't be accessedtypefaceFor()https://claude.ai/code/session_017QpoubQoCriCnSKSB4Avxx