Skip to content

Conversation

@OrangeAndGreen
Copy link
Contributor

https://dimagi.atlassian.net/browse/CCCT-729
cross-request: dimagi/commcare-core#1455

Product Description

Replaced complex scrolling in the delivery progress page with simple whole page scrolling. The previous implementation tried to have the top cards scroll away separately than the bottom sections of the page, but users found the experience confusing.

Technical Summary

Replaced the more complex UI elements that supported the additional scrolling behavior with one big NestedScrollView.

Feature Flag

Connect

Safety Assurance

Safety story

Tested manually by scrolling the page from various points with my finger and verifying that it always worked as expected.

Automated test coverage

No automated tests for Connect yet.

QA Plan

Scrolling on the page should not do anything fancy, just scroll all the contents up and down together.

Labels and Review

  • Do we need to enhance the manual QA test coverage ? If yes, the "QA Note" label is set correctly
  • Does the PR introduce any major changes worth communicating ? If yes, the "Release Note" label is set and a "Release Note" is specified in PR description.
  • Risk label is set correctly
  • The set of people pinged as reviewers is appropriate for the level of risk of the change

@coderabbitai
Copy link

coderabbitai bot commented Apr 1, 2025

📝 Walkthrough

Walkthrough

The pull request refactors the XML layout for the delivery progress screen. The root element is changed from a CoordinatorLayout to a NestedScrollView, and the AppBarLayout and CollapsingToolbarLayout have been removed. A new LinearLayout is introduced as the main container, which now houses an ImageView (refresh icon) and a TextView (last update), both initially set to be invisible, along with a new CardView enclosing a ConstraintLayout for payment confirmation buttons. Additionally, the previously used CardView for delivery alert has been replaced with one that includes a ConnectMediumTextView for messages. An <include> tag is now used to reference an external layout (view_job_card), and the ViewPager2 component has been repositioned within the LinearLayout.

Possibly related PRs

Suggested reviewers

  • pm-dimagi
  • shubham1g5

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
app/res/layout/fragment_connect_delivery_progress.xml (3)

14-18: Nested LinearLayout with White Background
A secondary LinearLayout with a vertical orientation and a hardcoded white background (#fff) is used to group early UI elements. Consider using a color resource instead of a hex value for improved consistency and maintainability.


35-47: Payment Confirmation CardView Setup
A CardView (with the ID connect_delivery_progress_alert_tile) is created to enclose payment confirmation elements. The layout margins, corner radius, and elevation are set to create a distinct visual section.

Note: Verify if the ID naming aligns with the updated design; according to the design objectives, consider if a renaming (e.g., to cvConnectMessage) is needed for clarity.


49-102: ConstraintLayout for Payment Confirmation Elements
Within the CardView, a ConstraintLayout organizes an icon, a label, and two RoundedButton components (for “yes” and “no” actions).

  • RoundedButton Text Size Concern: Both buttons use app:roundButtonTextSize="5.0sp" while also setting android:textSize="18sp". This discrepancy may result in an unexpectedly small display if the custom attribute drives the actual text size in the custom view. Please verify that the intended design is achieved.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b5da6ff and 8be1f87.

📒 Files selected for processing (1)
  • app/res/layout/fragment_connect_delivery_progress.xml (2 hunks)
🔇 Additional comments (7)
app/res/layout/fragment_connect_delivery_progress.xml (7)

2-7: Simplified Root Element and Viewport Setting
The root element has been changed from a CoordinatorLayout to a NestedScrollView with android:fillViewport="true". This simplifies the scrolling behavior by ensuring the entire content scrolls together and fills the viewport.


9-12: Added Primary LinearLayout Container
A new LinearLayout is introduced as a direct child of the NestedScrollView. This container helps in grouping all child elements for unified scrolling.


20-26: Refresh Icon ImageView Added
An ImageView for the refresh icon is added with accessibility support (using android:contentDescription) and is initially hidden (android:visibility="gone"). This is appropriate for scenarios where the refresh action is conditionally displayed.


28-33: Last Update TextView Established
A TextView to display the last update information has been included and is also initially hidden. The top margin (3dp) ensures appropriate spacing.


105-117: Connect Message CardView with Negative Margin
A new RelativeLayout segment contains a CardView with the ID cvConnectMessage, which is meant to display connection-related messages. Notice the negative top margin of -35dp on this CardView—this appears to be used to create an overlapping visual effect. Please confirm that this negative margin is intentional and yields the desired UI effect.


144-152: Include Tag for Job Card Layout
An <include> tag brings in an external layout (view_job_card) with consistent margin settings. This approach promotes reusability and keeps the layout modular.


176-179: ViewPager2 Update
The ViewPager2 component is now nested directly within the primary LinearLayout with its height set to wrap_content. Ensure that this setup provides adequate space for the dynamic content within the pager.

Comment on lines 122 to 140
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="2dp"
android:layout_marginEnd="5dp"
android:visibility="visible"
app:layout_constraintTop_toBottomOf="@id/connect_delivery_refresh">

<ImageView
android:id="@+id/connect_payment_confirm_icon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:orientation="horizontal"
android:paddingStart="15dp"
android:paddingTop="35dp"
android:paddingEnd="15dp">

<org.commcare.views.connect.connecttextview.ConnectMediumTextView
android:id="@+id/tvConnectMessage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/monetary_support"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginEnd="10dp"
android:text="@string/connect_job_tile_daily_limit_description"
android:textColor="@color/connect_warning_color"
android:textSize="14sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

Potential Constraint Issue in ConnectMediumTextView
Within the ConstraintLayout of the cvConnectMessage CardView, the ConnectMediumTextView is defined with android:layout_width="0dp" and has a start constraint but no corresponding end constraint. For a view with a 0dp width (i.e., match constraints), it is typical to define both start and end constraints to determine its width. Consider adding an end constraint (for example, app:layout_constraintEnd_toEndOf="parent") or adjusting the width value appropriately to ensure proper layout behavior.

android:paddingTop="35dp"
android:paddingEnd="15dp">

<org.commcare.views.connect.connecttextview.ConnectMediumTextView
Copy link
Contributor

Choose a reason for hiding this comment

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

we are not using connect mediumtextview insted of that normal textview with textstyle bold

Copy link
Contributor Author

Choose a reason for hiding this comment

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

app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>

<org.commcare.views.connect.connecttextview.ConnectRegularTextView
Copy link
Contributor

Choose a reason for hiding this comment

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

we are not using connectregualartextview insted of that normal textview with textstyle normal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@OrangeAndGreen OrangeAndGreen merged commit c5fea23 into connect_qa Apr 2, 2025
1 of 2 checks passed
@OrangeAndGreen OrangeAndGreen deleted the dv/delivery_progress_scrolling_fix branch April 2, 2025 11:35
@coderabbitai coderabbitai bot mentioned this pull request Jun 16, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants