Refactor settings screen to compose#3574
Conversation
* Type Safety: Introduced a private Option data class to map resource arrays, ensuring label/value pairs are handled safely. * Accessibility: Added Role.Button to SettingsItem. Added Role.Switch and toggleable semantics to SettingsSwitchItem rows. Ensured SettingsDialogItem uses Role.Button.
…d of manual refreshes.
Summary of ChangesHello @shobhitagarwal1612, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request modernizes the application's settings interface by migrating it from a traditional Android View system (Fragments and XML) to Jetpack Compose. This transition enhances the UI's maintainability and responsiveness, and integrates a more reactive data flow for user preferences using Kotlin Flows. The change also simplifies the ViewModel layer by leveraging direct interaction with the repository for settings management. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the settings screen to use Jetpack Compose, replacing the old PreferenceFragmentCompat implementation. It introduces new Flow-based properties in LocalValueStore and UserRepository to observe changes in user settings, which is a good move towards reactive programming. The SettingsActivity is updated to use setContent for Compose, and the old SettingsFragment and its associated layout/XML files are removed. The SettingsViewModel is also updated to use the UserRepository directly, simplifying the data flow. Overall, this is a significant and positive refactoring that modernizes the settings UI.
app/src/main/java/org/groundplatform/android/ui/settings/SettingsScreen.kt
Show resolved
Hide resolved
|
/gemini review |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request is a great initiative to refactor the settings screen to Jetpack Compose, which improves the codebase's modernity and maintainability. The reactive data flow from LocalValueStore up to the SettingsViewModel and SettingsScreen is well-implemented using Kotlin Flows. I've left a couple of suggestions: one to reduce some code duplication in LocalValueStore, and another regarding the addition of UI tests for the new composable screen, as per the repository's contribution guidelines.
app/src/main/java/org/groundplatform/android/data/local/LocalValueStore.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/groundplatform/android/ui/settings/SettingsScreen.kt
Show resolved
Hide resolved
# Conflicts: # app/src/test/java/org/groundplatform/android/ui/settings/SettingsFragmentTest.kt
Fixes #3573
Before:
settings-activity-compose-before.webm
After: (Removed icons after recording screencast)
settings-activity-compose-after.webm
@andreia-ferreira PTAL?