Integrate AboutLibraries to display open-source licenses in Settings#64
Integrate AboutLibraries to display open-source licenses in Settings#64
Conversation
…tings list item Co-authored-by: ricky9667 <55730003+ricky9667@users.noreply.github.com>
Co-authored-by: ricky9667 <55730003+ricky9667@users.noreply.github.com>
app/src/main/res/values/strings.xml
Outdated
| <string name="version">Version</string> | ||
| <string name="version_unknown">Unknown Version</string> | ||
| <string name="hush_keyboard_github">https://github.com/ricky9667/HushKeyboard</string> | ||
| <string name="libraries">Open-source libraries</string> |
Co-authored-by: ricky9667 <55730003+ricky9667@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR integrates the AboutLibraries library to automatically display a list of open-source dependencies and their licenses in the app's Settings screen, following established patterns from a related project (HushTimer).
Changes:
- Adds AboutLibraries plugin (v11.2.3) and compose-m3 dependency to display auto-generated license information
- Introduces new Libraries navigation route and screen with back navigation support
- Adds Libraries list item to Settings screen between Version and Donate options
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| gradle/libs.versions.toml | Adds AboutLibraries library version (11.2.3) and references for both plugin and compose dependency |
| build.gradle.kts | Applies AboutLibraries plugin at root level (with apply false) |
| app/build.gradle.kts | Applies AboutLibraries plugin and adds compose-m3 implementation dependency |
| app/src/main/res/values/strings.xml | Adds "Libraries" string resource |
| app/src/main/res/drawable/ic_library.xml | Adds book icon for Libraries menu item |
| app/src/main/java/com/rickyhu/hushkeyboard/settings/SettingsScreen.kt | Adds onLibrariesClick parameter and Libraries ListItem with click handling |
| app/src/main/java/com/rickyhu/hushkeyboard/main/Route.kt | Adds Libraries route to sealed Route interface |
| app/src/main/java/com/rickyhu/hushkeyboard/main/MainApp.kt | Wires Libraries screen navigation from Settings, with back button to pop stack |
| app/src/main/java/com/rickyhu/hushkeyboard/libraries/LibrariesScreen.kt | Creates new screen with TopAppBar and LibrariesContainer to display license information |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ListItem( | ||
| headlineContent = { Text(stringResource(R.string.libraries)) }, | ||
| leadingContent = { | ||
| Icon( | ||
| painter = painterResource(R.drawable.ic_library), | ||
| contentDescription = stringResource(R.string.libraries), | ||
| ) | ||
| }, | ||
| modifier = Modifier.clickable { onLibrariesClick() }, | ||
| ) |
There was a problem hiding this comment.
The Libraries list item should follow the established codebase pattern of using a generic composable like UrlLauncherListItem, SwitchListItem, or DropdownListItem. Currently, this directly uses ListItem with clickable modifier, which is inconsistent with the other items in SettingsContent (Version uses UrlLauncherListItem, switches use SwitchListItem, etc.).
Consider creating a NavigationListItem composable similar to UrlLauncherListItem that accepts a title, leading icon, and onClick callback. This would provide consistency with the existing UI component patterns and make the code more maintainable. The pattern should be:
- Create NavigationListItem.kt in settings/ui/
- Use it here instead of the raw ListItem + clickable
- This maintains the established convention of using generic composables for settings UI
| ListItem( | ||
| headlineContent = { Text(stringResource(R.string.libraries)) }, | ||
| leadingContent = { | ||
| Icon( | ||
| painter = painterResource(R.drawable.ic_library), | ||
| contentDescription = stringResource(R.string.libraries), | ||
| ) | ||
| }, | ||
| modifier = Modifier.clickable { onLibrariesClick() }, | ||
| ) |
There was a problem hiding this comment.
The new Libraries list item lacks test coverage. The existing test suite (SettingsScreenUiTest.kt) includes tests for all other interactive items in SettingsContent (theme dropdown, keyboard color, switches, version, etc.).
Add tests to verify:
- The Libraries item exists, is enabled, and has click action
- The onLibrariesClick callback is invoked when the item is clicked
This maintains consistency with the comprehensive test coverage pattern established for other settings UI elements.
| IconButton(onClick = onBackClick) { | ||
| Icon( | ||
| painter = painterResource(R.drawable.ic_return), | ||
| contentDescription = stringResource(R.string.libraries), |
There was a problem hiding this comment.
The content description for the back button should be more descriptive. Using "Libraries" as the content description for a back/return button is misleading for accessibility.
Consider using a more appropriate description like "Navigate back" or "Back" that accurately describes the action performed when the button is pressed, rather than repeating the screen title.
| contentDescription = stringResource(R.string.libraries), | |
| contentDescription = "Back", |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #64 +/- ##
==========================================
- Coverage 54.70% 53.76% -0.95%
==========================================
Files 39 40 +1
Lines 1148 1183 +35
Branches 82 83 +1
==========================================
+ Hits 628 636 +8
- Misses 489 516 +27
Partials 31 31 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
Integrates mikepenz/AboutLibraries to automatically generate and display a list of open-source dependencies with their licenses, following the same pattern used in HushTimer.
Dependency & plugin setup
com.mikepenz.aboutlibraries.plugin(11.2.3) to root and appbuild.gradle.ktscom.mikepenz:aboutlibraries-compose-m3dependency (Android variant auto-selected via KMP Gradle metadata)res/raw/aboutlibraries.jsonat build time;LibrariesContainerreads it automatically via Android contextNavigation
Route.Librariesto the sealedRouteinterfaceSettings → Librariesnavigation inMainAppUI
LibrariesScreenwith aTopAppBar(back button viaic_return) andLibrariesContainerListIteminSettingsContent(between Version and Donate), with a newic_librarybook iconSettingsScreenandSettingsContentgain anonLibrariesClick: () -> Unit = {}parameter — existing tests unaffectedHow to verify
Screenshots / Videos
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.