Skip to content

[Refactor] Create compose screen for PhotoTask Fragment#3548

Open
shobhitagarwal1612 wants to merge 14 commits intomasterfrom
compose-tasks-fragment
Open

[Refactor] Create compose screen for PhotoTask Fragment#3548
shobhitagarwal1612 wants to merge 14 commits intomasterfrom
compose-tasks-fragment

Conversation

@shobhitagarwal1612
Copy link
Member

@shobhitagarwal1612 shobhitagarwal1612 commented Feb 13, 2026

Fixes #3545

Things done:

  • Convert xml layout to compose for photo task fragment
  • Introduce dependency coil for loading images async in compose. This library has compatibility with KMP as well.
  • Remove unused glide dependency and related classes.

Before:

compose-photo-task-before.webm

After:

compose-photo-task-after.webm

@andreia-ferreira @gino-m PTAL?

…mpose using a new PhotoTaskScreen component.
This will be used for loading images asynchronously
* Create a new `UriImage` Composable that uses Coil's `AsyncImage` for efficient image loading.
* Replace the `AndroidView` and `ImageView` implementation in `PhotoTaskScreen` with the new `UriImage` component.
* Implement smart image scaling in `UriImage` to prevent memory issues when loading large images.
* Remove Glide dependency and version definition from `libs.versions.toml` and `app/build.gradle`.
* Delete `GlideDownsampleExifTest.kt` as image loading has been migrated to Coil.
@auto-assign auto-assign bot requested a review from sufyanAbbasi February 13, 2026 16:07
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 undertakes a significant refactoring of the PhotoTask Fragment, transitioning its user interface to Jetpack Compose. This modernization effort involves replacing traditional Android XML layouts with Composable functions, integrating the Coil library for efficient image handling within Compose, and consequently removing the legacy Glide image loading library and associated UI components. The change aims to improve the overall architecture and leverage the benefits of declarative UI.

Highlights

  • Jetpack Compose Migration: The PhotoTask Fragment's UI has been fully migrated from XML layouts and data binding to Jetpack Compose, enhancing maintainability and leveraging modern Android UI toolkit features.
  • Image Loading Library Transition: The image loading dependency has been switched from Glide to Coil, a Kotlin-first image loading library, specifically its Compose integration. This change includes adding the Coil Compose dependency and removing all Glide-related code and dependencies.
  • Code Cleanup and Simplification: Several unused XML layout files, drawable selectors, dimension resources, and style definitions related to the old PhotoTask UI and Glide integration have been removed, streamlining the codebase.

🧠 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
  • app/build.gradle
    • Replaced the Glide dependency with Coil Compose.
    • Added the Coil Compose version definition.
  • app/src/main/java/org/groundplatform/android/ui/common/BindingAdapters.kt
    • Removed Glide-specific imports and related binding adapter methods (bindUri, bindImageTint).
    • Removed bindGoogleSignOnButtonClick and associated imports.
  • app/src/main/java/org/groundplatform/android/ui/datacollection/components/UriImage.kt
    • Added a new Composable function UriImage for displaying images from a URI using Coil, including logic for target dimensions and error handling.
  • app/src/main/java/org/groundplatform/android/ui/datacollection/tasks/photo/PhotoTaskFragment.kt
    • Updated onCreateTaskBody to use createComposeView and render the new PhotoTaskScreen Composable.
    • Removed the import for PhotoTaskFragBinding.
  • app/src/main/java/org/groundplatform/android/ui/datacollection/tasks/photo/PhotoTaskScreen.kt
    • Added a new Composable screen PhotoTaskScreen to define the UI for the photo task, including a camera button and UriImage for displaying the captured photo.
  • app/src/main/res/drawable/task_light_green_btn_selector.xml
    • Removed the XML drawable selector for task buttons.
  • app/src/main/res/layout/photo_task.xml
    • Removed the XML layout file for the photo task image display.
  • app/src/main/res/layout/photo_task_frag.xml
    • Removed the XML layout file for the PhotoTask Fragment.
  • app/src/main/res/values-night/colors.xml
    • Removed the md_theme_on_surface_disabled color definition.
  • app/src/main/res/values/colors.xml
    • Removed the md_theme_on_surface_disabled color definition.
  • app/src/main/res/values/dimens.xml
    • Removed the task_value_top_padding dimension resource.
  • app/src/main/res/values/styles.xml
    • Removed TaskChipButton and TaskChipButton.LightGreen styles.
  • app/src/test/java/org/groundplatform/android/ui/common/GlideDownsampleExifTest.kt
    • Removed the test file specific to Glide's downsampling and EXIF handling.
  • app/src/test/java/org/groundplatform/android/ui/datacollection/components/UriImageTest.kt
    • Added a new test file UriImageTest to verify the functionality of the UriImage Composable using Coil.
  • app/src/test/java/org/groundplatform/android/ui/datacollection/tasks/photo/PhotoTaskFragmentTest.kt
    • Updated the test to use Compose testing APIs (onNodeWithText, performClick) instead of Espresso onView for interacting with the camera button.
  • gradle/libs.versions.toml
    • Added coilComposeVersion and coil-compose library alias.
    • Removed glideVersion and glide library alias.
Activity
  • The author, shobhitagarwal1612, has refactored the PhotoTask Fragment to use Jetpack Compose.
  • The PR introduces the Coil library for image loading, replacing Glide.
  • The author has provided 'Before' and 'After' video demonstrations of the changes.
  • The author has requested reviews from @andreia-ferreira and @gino-m.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a great step forward in modernizing the codebase by refactoring the PhotoTaskFragment to use Jetpack Compose. The migration from XML layouts to composable functions is well-executed, and the switch from Glide to Coil for image loading is a sensible choice. The related code, including tests and resource files, has been cleaned up effectively. I've identified one high-severity issue regarding a ViewModel initialization within a composable function that should be addressed to prevent performance degradation.

@shobhitagarwal1612
Copy link
Member Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a well-executed refactoring of the PhotoTaskFragment to Jetpack Compose. The conversion from XML layouts to Compose is clean, and the replacement of the Glide dependency with Coil for image loading is a great modernization step. The new UriImage composable is a good, reusable component, and the updates to the tests to cover the new implementation are thorough. I have one suggestion to make the new UriImage composable more robust.

@shobhitagarwal1612 shobhitagarwal1612 requested review from andreia-ferreira and gino-m and removed request for sufyanAbbasi February 13, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Photo Task

1 participant