[Multi-Profile] feat: add profile dialog in Compose#21328
Open
criticalAY wants to merge 8 commits into
Open
Conversation
Contributor
|
Important Maintainers: This PR contains Strings changes
|
Member
|
Could we add screenshot tests? |
ba4c12c to
ad9261b
Compare
Contributor
|
Snapshot diff report vs
All 1 changed screenshotsPreferencesScreenshotTest
|
criticalAY
commented
Jul 1, 2026
Compose counterpart of the View based AlertDialog.input helper: autofocus, confirm on keyboard Done, validation with inline errors and an optional character counter. Renders the card inline in previews because dialog windows don't show up in the static preview pane.
Compose FABs default to colorScheme.primaryContainer, which the theme bridge leaves at the Material3 baseline purple on purpose. Read the fab_normal attr into an AnkiDroidColors CompositionLocal, paired with onPrimary, the same pair every View FAB uses.
Extended FAB with the fab_normal tint baked in, so screens can't fall back to the baseline purple by forgetting the colors.
Strings in 01-core.xml must be translated before a language can be enabled, and the multi profile feature is still in development, so it shouldn't gate that. Resource lookup is by name, so references and any existing translations keep working.
Thin wrapper around TextInputDialog that validates input through ProfileName.validate, so the UI and the domain layer enforce the same rules. Not shown anywhere yet.
Holds the profile list and the add profile dialog visibility so both survive configuration changes. Profile creation, rename and deletion still need ProfileManager to be wired into the app.
Replaces the XML layout with a stateless Scaffold screen: top bar, profile list, AnkiDroidExtendedFab and the add profile dialog. The fragment becomes a thin ComposeView host, it has to stay a Fragment because preference_headers.xml launches it by class name. The hardcoded toolbar title moves to a string resource.
The RecyclerView adapter was never wired to the fragment and its row layout and circle drawable are replaced by the Compose ProfileRow.
ad9261b to
ec38372
Compare
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.
Note
Assisted-by: Claude Opus 4.8 to figure out why the views were broken
Purpose / Description
We agreed to use Compose for new screens and refactors instead of migrating existing components. The switch profiles screen was a good first candidate: it had very little View UI (a toolbar, an unused RecyclerView adapter and a FAB) and a stub add profile dialog. This PR moves the whole screen to Compose and sets up reusable pieces (input dialog, themed FAB, theme bridge additions) that future Compose screens can build on.
Fixes
Approach
See commits, I have kept them self-explanatory imo
How Has This Been Tested?
Unit test and each commit compiles and then test the dialog and fab being displayed on my Device (Pixel 10)
Learning (optional, can help others)
Checklist
Please, go through these checks before submitting the PR.