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.
|
/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.
# Conflicts: # app/src/test/java/org/groundplatform/android/ui/settings/SettingsFragmentTest.kt
|
@andreia-ferreira PTAL? I've updated the screencast in the description as well. |
andreia-ferreira
left a comment
There was a problem hiding this comment.
awesome stuff 🚀 only a minor suggestion
…ngsViewModel.kt Co-authored-by: Andreia Ferreira <51242456+andreia-ferreira@users.noreply.github.com>
* Migrate SettingsActivity to compose * Migrate SettingsFragment.kt to compose * Update unit tests * Remove unused strings * Decouple data layer from SettingsViewModel
* Add a conditional to e2e test The CompleteAllTaskTypesTest didn't cover conditional logic. Added a conditional question to the test survey and added tests for it in order to prevent regressions Closes #3481 * Reformat code * Refactor to remove conditional test logic * Refactor to seperate responsibility, move conditional test logic to DataCollectionRobot and add a reusable method to AndroidTestDriver * Bump com.google.firebase:firebase-bom from 34.9.0 to 34.10.0 (#3582) Bumps com.google.firebase:firebase-bom from 34.9.0 to 34.10.0. --- updated-dependencies: - dependency-name: com.google.firebase:firebase-bom dependency-version: 34.10.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Refactor settings screen to compose (#3574) * Migrate SettingsActivity to compose * Migrate SettingsFragment.kt to compose * Update unit tests * Remove unused strings * Decouple data layer from SettingsViewModel * Exclude Compose previews from Jacoco reports (#3584) * Refactor show sign out confirmation dialogs (#3583) * Bump org.mockito:mockito-bom from 5.21.0 to 5.22.0 (#3586) Bumps [org.mockito:mockito-bom](https://github.com/mockito/mockito) from 5.21.0 to 5.22.0. - [Release notes](https://github.com/mockito/mockito/releases) - [Commits](mockito/mockito@v5.21.0...v5.22.0) --- updated-dependencies: - dependency-name: org.mockito:mockito-bom dependency-version: 5.22.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Rename variable to have a more conventional name * Create MultipleChoiceType sealed class to represent the kind of multiple choice questions being handled, Refactor DataCollectionRobot to use the new sealed class * Refactor to rename test constants to more descriptive names to give context about the tests * Reformat code to pass a code format check * Refactor to make constant names descriptive --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Nsubuga <nsubugahassan@gmail.com> Co-authored-by: Andreia Ferreira <51242456+andreia-ferreira@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shobhit Agarwal <ashobhit@google.com>
Fixes #3573
Before:
settings-activity-compose-before.webm
After:
Screen_recording_20260227_102932.webm
@andreia-ferreira PTAL?