fix: make icon/folder rename dialog follow system light/dark theme#413
Open
MiMoHo wants to merge 1 commit into
Open
fix: make icon/folder rename dialog follow system light/dark theme#413MiMoHo wants to merge 1 commit into
MiMoHo wants to merge 1 commit into
Conversation
MainActivity uses the forced-dark LauncherTheme so it can draw over the wallpaper. The rename dialog inherited that context, so under dynamic theming the Material dialog surface stayed dark even in light mode, rendering the dark getProperTextColor() text unreadable on a dark background. Build the dialog from a ContextThemeWrapper carrying the proper day/night theme (getThemeId()) in the dynamic-theme path, mirroring the existing getPopupMenuTheme() precedent, so the dialog surface tracks the system mode. The non-dynamic path is left unchanged. Closes FossifyOrg#198
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.
Type of change(s)
What changed and why
The folder/icon rename dialog showed dark text on a dark background in light system mode (dark mode was fine), making it unreadable.
Root cause is a dialog surface/text-color mismatch, not a hardcoded text color:
MainActivity(which opens the rename dialog) is declared withandroid:theme="@style/LauncherTheme", whose parent isTheme.Material3.Dark.NoActionBar— a forced-dark theme so the launcher can draw a transparent window over the wallpaper.MainActivity.onCreatealso setsuseDynamicTheme = false, soBaseSimpleActivitynever callssetTheme(getThemeId(...))to switch to a light theme. The activity theme is therefore dark regardless of system mode.isDynamicTheme()defaults to true, so commons'getAlertDialogBuilder()returnsMaterialAlertDialogBuilder(activity), inheriting that forced-dark context.LauncherThemedoes not definematerialAlertDialogTheme/colorSurface, so the dialog surface stays the default Material3 dark surface even in light mode.getProperTextColor()(you_neutral_text_color), which is dark in day / light in night. Light mode therefore renders dark text on a dark surface = unreadable; dark mode renders light text on dark = fine.Fix: in the dynamic-theme path, build the dialog from a
ContextThemeWrappercarrying the proper day/night theme (activity.getThemeId()), so the Material dialog surface follows the system light/dark mode. This mirrors the precedentMainActivityalready uses for its popup menu (ContextThemeWrapper(this, getPopupMenuTheme())).getThemeId()resolves toAppTheme.Base.System.Lightin light mode /AppTheme.Base.Systemin dark mode, both of which setmaterialAlertDialogThemeandcolorSurface=you_dialog_background_color(day/night). The non-dynamic path is left byte-for-byte identical (it already sets an explicit window background and renders correctly).MaterialAlertDialogBuildersubclassesandroidx.appcompat.app.AlertDialog.Builder, sosetupDialogStuff(view, this, ...)still type-checks.Tests performed
Built the
fossDebugvariant and verified on an Android 15 (API 35) emulator:Set Fossify as home app; forced light mode; long-pressed Phone icon -> Rename. Dialog shows light surface with dark readable 'Phone' text (fixed). Forced dark mode, reopened Rename -> dark surface with light readable text (not regressed).
Also confirmed
detekt,lint, unit tests and the build all pass locally (CI-equivalent).Closes the following issue(s)
Checklist
CHANGELOG.md(if applicable).Coded with Opus 4.8 ultracode.