feat: Compose setup for project#21147
Open
criticalAY wants to merge 3 commits into
Open
Conversation
david-allison
approved these changes
May 26, 2026
david-allison
approved these changes
May 27, 2026
Adds the Kotlin Compose Compiler plugin to :AnkiDroid, pulls in Compose BOM 2026.04.01 with material3, ui-tooling, activity-compose and the lifecycle-compose pair, and opts in to ExperimentalMaterial3Api at the module level so screens don't need @OptIn annotations. The Compose Compiler attaches to every Kotlin compilation in the module, so testFixtures (which has no @composable code) needs the runtime on its compileOnly classpath to satisfy the plugin's version check. Also relaxes ktlint's function-naming rule for @composable functions so PascalCase composables don't trip the linter.
19 tasks
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.
Purpose / Description
Enable Jetpack Compose on the :AnkiDroid module so future screens can be built or migrated incrementally. This follows Google's I/O 2026 "Compose-First" direction. This PR is foundational it does not convert any existing user-facing screen.
Fixes
Approach
See commit 1 and then:
Added
com.ichi2.compose.theme.Themethat reads colors from the host Activity's XML theme via R.styleable.ComposeTheme and bridges each of the four AnkiDroid themes (Light, Plain, Dark, Black) into a Material 3 ColorScheme. Slots not declared by the XML fall back to Material 3 defaults; isLightTheme (inherited from Theme.Material3.{Light,Dark}) decides the base scheme.How Has This Been Tested?
Local build passed
Learning (optional, can help others)
Themes and Preview is a mess to handle for custom themes and it took me whole night to enable compose for Shared Deck screen
Checklist
Please, go through these checks before submitting the PR.