-
-
Notifications
You must be signed in to change notification settings - Fork 45
Review for layouts, navigations, views, and some minor strings #3092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughThis update introduces a significant number of new Android UI layout resources and custom view classes, primarily to support new features related to "Connect" functionality, such as job management, messaging, delivery progress, and payment confirmation. Several new XML layout files define UI components for job cards, progress bars, chat interfaces, delivery and payment items, and navigation structures. Two new navigation graph XML resources are added for "connect" and "connect messaging" features, organizing the flow between various fragments and dialogs. Multiple new custom Android views are implemented, including Sequence Diagram(s)sequenceDiagram
participant User
participant MainActivity
participant NavHostFragment
participant ConnectJobsListsFragment
participant ConnectJobIntroFragment
participant ConnectLearningProgressFragment
participant ConnectDeliveryProgressFragment
participant ConnectDeliveryListFragment
participant ConnectMessageChannelListFragment
participant ConnectMessageFragment
participant ConnectMessageChannelConsentBottomSheet
User->>MainActivity: Launches app
MainActivity->>NavHostFragment: Loads navigation graph (connect or connect messaging)
NavHostFragment->>ConnectJobsListsFragment: Navigates to jobs list
User->>ConnectJobsListsFragment: Selects a job
ConnectJobsListsFragment->>ConnectJobIntroFragment: Navigates to job intro
User->>ConnectJobIntroFragment: Proceeds to learning
ConnectJobIntroFragment->>ConnectLearningProgressFragment: Navigates to learning progress
User->>ConnectLearningProgressFragment: Completes learning
ConnectLearningProgressFragment->>ConnectDeliveryProgressFragment: Navigates to delivery progress
User->>ConnectDeliveryProgressFragment: Views delivery list
ConnectDeliveryProgressFragment->>ConnectDeliveryListFragment: Navigates to delivery list
User->>MainActivity: Opens messaging
MainActivity->>NavHostFragment: Loads connect messaging graph
NavHostFragment->>ConnectMessageChannelListFragment: Navigates to channel list
User->>ConnectMessageChannelListFragment: Selects a channel
ConnectMessageChannelListFragment->>ConnectMessageChannelConsentBottomSheet: Opens consent dialog
User->>ConnectMessageChannelConsentBottomSheet: Accepts consent
ConnectMessageChannelConsentBottomSheet->>ConnectMessageFragment: Navigates to message fragment
Suggested labels
Suggested reviewers
Tip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
🛑 Comments failed to post (55)
app/src/org/commcare/views/connect/LinearProgressBar.java (3)
78-82: 🛠️ Refactor suggestion
Gradient functionality not implemented
The class prepares for gradient coloring with
setGradientColorsmethod andisGradientflag, but never actually uses this in the drawing code.Either implement the gradient functionality in
onDraw()or remove these properties and methods to avoid confusion.🤖 Prompt for AI Agents (early access)
In app/src/org/commcare/views/connect/LinearProgressBar.java around lines 78 to 82, the setGradientColors method and isGradient flag are set but the gradient drawing logic is missing in the onDraw() method. To fix this, implement the gradient drawing functionality inside onDraw() by checking if isGradient is true and then applying a gradient shader or paint accordingly. Alternatively, if gradient support is not needed, remove the setGradientColors method, the isGradient flag, and any related gradient properties to avoid confusion.
98-102:
⚠️ Potential issueType inconsistency in color handling
There's an inconsistency in how colors are handled.
backgroundColoris initialized as a resource ID (R.color.*), butsetBackgroundColortreats the parameter as a direct color value, not a resource ID.- public void setBackgroundColor(int color) { - this.backgroundColor = color; - backgroundPaint.setColor(color); + public void setBackgroundColor(int colorResId) { + this.backgroundColor = colorResId; + backgroundPaint.setColor(ContextCompat.getColor(getContext(), colorResId)); invalidate(); }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.public void setBackgroundColor(int colorResId) { this.backgroundColor = colorResId; backgroundPaint.setColor(ContextCompat.getColor(getContext(), colorResId)); invalidate(); }🤖 Prompt for AI Agents (early access)
In app/src/org/commcare/views/connect/LinearProgressBar.java around lines 98 to 102, the setBackgroundColor method incorrectly treats the input parameter as a direct color value while backgroundColor is initialized as a resource ID. To fix this, ensure that the parameter passed to setBackgroundColor is consistently handled as a resource ID and resolve it to an actual color value using the appropriate context method before setting it on backgroundPaint and backgroundColor.
64-71: 🛠️ Refactor suggestion
Corner radius implementation inconsistency
The code defines separate
startCornerRadiusandendCornerRadiusproperties, but usesstartCornerRadiusfor both parameters when drawing the background andendCornerRadiusfor the progress. This might not render as expected.- canvas.drawRoundRect(backgroundRect, startCornerRadius, startCornerRadius, backgroundPaint); + canvas.drawRoundRect(backgroundRect, startCornerRadius, endCornerRadius, backgroundPaint);Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents (early access)
In app/src/org/commcare/views/connect/LinearProgressBar.java around lines 64 to 71, the background rectangle uses startCornerRadius for both horizontal and vertical corner radii, while the progress rectangle uses endCornerRadius for both. To fix the inconsistency, ensure that the corner radius parameters match the intended corners for each rectangle, possibly by using startCornerRadius for the background's start corners and endCornerRadius for the progress's end corners, adjusting the drawRoundRect calls accordingly to reflect this.app/res/layout/screen_connect.xml (1)
13-14: 🛠️ Refactor suggestion
Use start/end constraints for RTL support
Replaceapp:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent"with
-app:layout_constraintLeft_toLeftOf="parent" -app:layout_constraintRight_toRightOf="parent" +app:layout_constraintStart_toStartOf="parent" +app:layout_constraintEnd_toEndOf="parent"to ensure proper RTL layout behavior.
🤖 Prompt for AI Agents (early access)
In app/res/layout/screen_connect.xml around lines 13 to 14, replace the attributes app:layout_constraintLeft_toLeftOf="parent" and app:layout_constraintRight_toRightOf="parent" with app:layout_constraintStart_toStartOf="parent" and app:layout_constraintEnd_toEndOf="parent" respectively to support proper RTL (right-to-left) layout behavior.app/res/layout/view_country_code_edittext.xml (1)
24-35:
⚠️ Potential issueExternalize the hint text and enforce digit-only input.
The hint
"00000000"is hardcoded and not localized. Move it tostrings.xml(e.g.,@string/phone_number_hint). Additionally, to restrict input to digits only, consider addingandroid:digits="0123456789"or using a custom input filter.Example diff:
- android:hint="00000000" + android:hint="@string/phone_number_hint" + android:digits="0123456789"🤖 Prompt for AI Agents (early access)
In app/res/layout/view_country_code_edittext.xml between lines 24 and 35, the EditText's hint is hardcoded as "00000000" which is not localized, and the input is not restricted to digits only. Move the hint text to strings.xml as a resource (e.g., @string/phone_number_hint) and update the hint attribute to reference this string resource. Also, add the attribute android:digits="0123456789" to restrict input to digits only.app/res/layout/view_job_card.xml (4)
16-26:
⚠️ Potential issueExternalize the hardcoded job title.
The job title
"Infant Child Vaccination By Rama"is hardcoded in the layout. Move this string tostrings.xmlto support localization and maintenance.🤖 Prompt for AI Agents (early access)
In app/res/layout/view_job_card.xml around lines 16 to 26, the TextView for the job title has a hardcoded string "Infant Child Vaccination By Rama". To support localization and easier maintenance, move this string to the strings.xml resource file by creating a string resource entry and then reference it in the TextView using the @string/ resource syntax instead of the hardcoded text attribute.
28-38:
⚠️ Potential issueExternalize the hardcoded job description.
The description
"Check vaccine status"should be placed instrings.xmlfor proper localization support.🤖 Prompt for AI Agents (early access)
In app/res/layout/view_job_card.xml around lines 28 to 38, the TextView for job description uses a hardcoded string "Check vaccine status". Move this string to the strings.xml resource file by creating an entry with an appropriate name, then replace the android:text attribute with a reference to this string resource using @string/your_string_name to enable localization support.
78-90:
⚠️ Potential issueExternalize the hardcoded end date text.
The text
"Complete Project by 01/31/2024"is not localized. Consider moving it tostrings.xmland parameterizing the date if needed.🤖 Prompt for AI Agents (early access)
In app/res/layout/view_job_card.xml around lines 78 to 90, the TextView has a hardcoded text "Complete Project by 01/31/2024" which is not localized. To fix this, move the text string to strings.xml as a string resource, optionally parameterizing the date using placeholders. Then update the TextView to reference this string resource using the @string syntax to enable localization and easier updates.
66-75:
⚠️ Potential issueExternalize the hardcoded job time.
The job time range
"8:00 AM - 5:00 PM"is hardcoded and should be localized viastrings.xml.🤖 Prompt for AI Agents (early access)
In app/res/layout/view_job_card.xml around lines 66 to 75, the TextView with id tv_job_time has a hardcoded text "8:00 AM - 5:00 PM". To fix this, remove the hardcoded string and replace it with a reference to a string resource defined in strings.xml. Add the job time range string to strings.xml for localization support, then update the TextView's android:text attribute to use this string resource.app/res/layout/dialog_payment_confirmation.xml (1)
15-22:
⚠️ Potential issueMissing contentDescription on the status icon.
For accessibility, add
android:contentDescription="@string/connect_payment_status_desc"or settools:ignore="ContentDescription"if the image is purely decorative.🤖 Prompt for AI Agents (early access)
In app/res/layout/dialog_payment_confirmation.xml around lines 15 to 22, the ImageView for the payment status icon is missing a contentDescription attribute, which is important for accessibility. Add android:contentDescription="@string/connect_payment_status_desc" to the ImageView element to provide a meaningful description for screen readers. If the image is purely decorative and does not convey information, instead add tools:ignore="ContentDescription" to suppress the accessibility warning.app/res/layout/view_progress_job_card.xml (1)
6-13: 🛠️ Refactor suggestion
Use wrap_content for CardView and ConstraintLayout heights
The CardView and its nested ConstraintLayout are set tomatch_parent, making the card fill its container entirely. Changing both towrap_contentwill size the card to its contents and avoid unwanted blank space.<androidx.cardview.widget.CardView android:id="@+id/rootJobCardView" - android:layout_width="match_parent" - android:layout_height="match_parent" + android:layout_width="match_parent" + android:layout_height="wrap_content" app:cardCornerRadius="15dp" app:cardElevation="10dp"> <androidx.constraintlayout.widget.ConstraintLayout - android:layout_width="match_parent" - android:layout_height="match_parent" + android:layout_width="match_parent" + android:layout_height="wrap_content" android:padding="16dp">📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.<androidx.cardview.widget.CardView android:id="@+id/rootJobCardView" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardCornerRadius="15dp" app:cardElevation="10dp"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp"> <!-- … other child views … --> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.cardview.widget.CardView>🤖 Prompt for AI Agents (early access)
In app/res/layout/view_progress_job_card.xml around lines 6 to 13, the CardView and the nested ConstraintLayout have their height set to match_parent, causing the card to fill the entire container and potentially create unwanted blank space. Change the android:layout_height attribute of both the CardView and the ConstraintLayout from match_parent to wrap_content to ensure the card sizes itself based on its content.app/res/layout/home_screen.xml (1)
84-87: 🛠️ Refactor suggestion
Use match_parent + fillViewport on NestedScrollView
NestedScrollViewwithwrap_contentheight will not scroll beyond the screen. Change tomatch_parentand addandroid:fillViewport="true"to ensure content fills the viewport and scrolls correctly.- <androidx.core.widget.NestedScrollView - android:layout_width="match_parent" - android:layout_height="wrap_content"> + <androidx.core.widget.NestedScrollView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fillViewport="true">🤖 Prompt for AI Agents (early access)
In app/res/layout/home_screen.xml around lines 84 to 87, the NestedScrollView uses android:layout_height="wrap_content", which prevents scrolling beyond the screen. Change android:layout_height to "match_parent" and add the attribute android:fillViewport="true" to ensure the content fills the viewport and scrolls properly.app/res/layout/connect_delivery_item.xml (1)
63-70: 🛠️ Refactor suggestion
Constrain or remove unused
delivery_item_statusview
Thedelivery_item_statusTextView has no layout constraints (it’s flagged withtools:ignore="MissingConstraints"). Either define its constraints or remove it until needed to prevent runtime layout issues.🤖 Prompt for AI Agents (early access)
In app/res/layout/connect_delivery_item.xml around lines 63 to 70, the TextView with id delivery_item_status lacks layout constraints and is marked with tools:ignore="MissingConstraints". To fix this, either add the necessary layout constraints to properly position this view within the layout or remove the TextView entirely if it is not currently needed, to avoid potential runtime layout problems.app/res/values-sw/strings.xml (3)
61-61:
⚠️ Potential issueCritical: Unbalanced quotation and stray characters.
The
about_dialogstring ends with\n\n\n\n"</string>. That embedded double-quote before the closing tag is invalid. Remove the stray"so the XML is well-formed.🤖 Prompt for AI Agents (early access)
In app/res/values-sw/strings.xml at line 61, the about_dialog string contains an invalid embedded double-quote character before the closing </string> tag. Remove this stray double-quote to ensure the XML is well-formed and the string resource is valid.
102-102:
⚠️ Potential issueCritical: Malformed format specifier and escaping.
The
clearanswer_confirmvalueOndoa jibu kwa \%s\"?"contains an escaped backslash, a stray backslash before%s, and an extra\"?. It should be something likeOndoa jibu kwa %s?. Please correct the placeholder and escape sequences.🤖 Prompt for AI Agents (early access)
In app/res/values-sw/strings.xml at line 102, the string value for clearanswer_confirm has incorrect escaping and a malformed format specifier with a backslash before %s and an extra escaped quote. Remove the backslash before %s and the unnecessary escaped quote, so the string reads correctly as Ondoa jibu kwa %s? without any extra escape characters.
42-42:
⚠️ Potential issueCritical: Duplicate quotation marks in string value.
The translation for
back_to_managerends with two double-quotes (Programu""), which will break XML parsing at build time. Please remove the extra quotation mark so the value readsRudi kwa Kidhibiti Programu.🤖 Prompt for AI Agents (early access)
In app/res/values-sw/strings.xml at line 42, the string value for "back_to_manager" contains duplicate double quotation marks at the end ("Programu""). Remove the extra quotation mark so the string value ends correctly as "Rudi kwa Kidhibiti Programu" to fix the XML parsing error.app/res/layout/fragment_connect_results_summary_list.xml (2)
45-53: 🛠️ Refactor suggestion
Improve accessibility for decorative icons.
Currently, both
ImageViews useandroid:contentDescription="@null"without marking them as purely decorative. To prevent screen readers from announcing them, add:android:importantForAccessibility="no"Alternatively, provide meaningful
contentDescriptionif the icons convey status.Also applies to: 98-106
🤖 Prompt for AI Agents (early access)
In app/res/layout/fragment_connect_results_summary_list.xml at lines 45-53 and 98-106, the ImageView elements have android:contentDescription="@null" but lack android:importantForAccessibility="no". To improve accessibility and prevent screen readers from announcing these decorative icons, add android:importantForAccessibility="no" to these ImageView tags. Alternatively, if the icons convey meaningful status, replace the null contentDescription with a descriptive text.
30-37: 🛠️ Refactor suggestion
Fix weight-based sizing in CardViews.
Using
android:layout_weight="1"withandroid:layout_width="match_parent"prevents weights from distributing space correctly. In a horizontalLinearLayout, child views should use0dpfor the weighted dimension.Apply this diff:
- <androidx.cardview.widget.CardView - android:layout_width="match_parent" - android:layout_weight="1" + <androidx.cardview.widget.CardView + android:layout_width="0dp" + android:layout_weight="1"Repeat for the second
CardView.Also applies to: 84-90
🤖 Prompt for AI Agents (early access)
In app/res/layout/fragment_connect_results_summary_list.xml at lines 30 to 37 and also lines 84 to 90, the CardView elements use android:layout_weight="1" together with android:layout_width="match_parent", which breaks proper weight distribution in a horizontal LinearLayout. To fix this, change android:layout_width from "match_parent" to "0dp" for these CardViews so that the weights correctly allocate space. Repeat this adjustment for the second CardView in both locations.app/res/values-ti/strings.xml (3)
46-48: 🛠️ Refactor suggestion
Address empty string resource values.
Multiple entries (e.g.,
remote_form_payload_url,about_dialog,root_namespace_error,manifest_tag_error,notification_channel_errors_description,notification_channel_user_session_description) have empty values. Either provide the translated text or remove them to fallback to default.Also applies to: 210-214, 279-281
🤖 Prompt for AI Agents (early access)
In app/res/values-ti/strings.xml at lines 46 to 48 and also at lines 210-214 and 279-281, several string resources have empty values. To fix this, either provide the appropriate translated text for each empty string resource or remove the empty entries entirely so the app will fallback to the default string values.
18-18:
⚠️ Potential issueFix newline escapes in warning string.
The sequence
...servicesn ቅጥዕታትn...uses literalninstead of\n. Update to:<string name="pre_multiple_apps_warning">መጠንቀቕታ፥ ... ግልጋሎታት\nቅጥዕታት\n...</string>🤖 Prompt for AI Agents (early access)
In app/res/values-ti/strings.xml at line 18, the warning string contains literal 'n' characters where newline escape sequences '\n' should be used. Replace the literal 'n' characters following "ግልጋሎታት" and "ቅጥዕታት" with proper newline escape sequences '\n' to correctly format the string with line breaks.
30-31:
⚠️ Potential issueCorrect unbalanced quotation marks.
The strings
back_to_managerandgo_to_managerend with"", causing malformed XML. Remove the extra quotes:- <string name="back_to_manager">ናብ ... ""</string> + <string name="back_to_manager">ናብ ...</string>Repeat for
go_to_manager.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.<string name="back_to_manager">ናብ ኣፕሊኬሽን ማናጀር ንመለስ</string> <string name="go_to_manager">ናብ ኣፕሊኬሽን ማናጀር ንኺድ</string>🤖 Prompt for AI Agents (early access)
In app/res/values-ti/strings.xml at lines 30 to 31, the string values for back_to_manager and go_to_manager have extra double quotation marks at the end, causing malformed XML. Remove the extra closing quotation marks from both string values so that each string is properly enclosed within a single pair of quotes.app/res/layout/fragment_connect_job_detail_bottom_sheet_dialog.xml (1)
40-46:
⚠️ Potential issueEnhance accessibility for close icon.
The close button
ImageViewusesandroid:contentDescription="@null". Either supply a description (e.g.,@string/close_dialog) or mark it decorative with:android:importantForAccessibility="no"🤖 Prompt for AI Agents (early access)
In app/res/layout/fragment_connect_job_detail_bottom_sheet_dialog.xml around lines 40 to 46, the ImageView for the close button has android:contentDescription="@null", which reduces accessibility. Fix this by either providing a meaningful contentDescription referencing a string resource like @string/close_dialog or, if the icon is purely decorative, add android:importantForAccessibility="no" to exclude it from accessibility services.app/res/layout/fragment_channel_consent_bottom_sheet.xml (3)
67-73: 🛠️ Refactor suggestion
Use
layout_alignParentStart/Endfor RTL support.Replace deprecated
layout_alignParentLeft/layout_alignParentRightwith start/end:- android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" - android:layout_alignParentRight="true" + android:layout_alignParentEnd="true"[test_requires_manual_change]
Also applies to: 79-86
🤖 Prompt for AI Agents (early access)
In app/res/layout/fragment_channel_consent_bottom_sheet.xml around lines 67 to 73 and also lines 79 to 86, replace the deprecated attribute layout_alignParentLeft with layout_alignParentStart and similarly replace layout_alignParentRight with layout_alignParentEnd to ensure proper RTL (right-to-left) language support. This change improves layout adaptability for different language directions.
57-61: 🛠️ Refactor suggestion
Replace deprecated
fill_parent.
fill_parentis deprecated in favor ofmatch_parent. Update:- android:layout_width="fill_parent" + android:layout_width="match_parent"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.<RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="match_parent" android:layout_height="wrap_content">🤖 Prompt for AI Agents (early access)
In app/res/layout/fragment_channel_consent_bottom_sheet.xml around lines 57 to 61, replace the deprecated attribute value "fill_parent" with "match_parent" for android:layout_width in the RelativeLayout element to adhere to current Android development standards.
5-9:
⚠️ Potential issueReplace
backgroundTintwithbackground.
android:backgroundTintonly tints an existing background. Use:- android:backgroundTint="@color/transparent" + android:background="@color/transparent"🤖 Prompt for AI Agents (early access)
In app/res/layout/fragment_channel_consent_bottom_sheet.xml between lines 5 and 9, replace the attribute android:backgroundTint="@color/transparent" with android:background="@color/transparent" because backgroundTint only tints an existing background, whereas background sets the actual background color.app/res/layout/fragment_connect_delivery_details.xml (2)
23-28:
⚠️ Potential issueFix
ConstraintLayoutheight inside a wrap_contentCardView.The inner
ConstraintLayout(lines 23–28) is set tomatch_parentheight while its parentCardViewiswrap_content. This can lead to unpredictable measurements or infinite size loops. Change it towrap_contentto respect the card’s intrinsic height.- <androidx.constraintlayout.widget.ConstraintLayout - android:id="@+id/connect_delivery_details_container" - android:layout_width="match_parent" - android:layout_height="match_parent" + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/connect_delivery_details_container" + android:layout_width="match_parent" + android:layout_height="wrap_content" android:background="@color/connect_dark_blue_color" android:padding="16dp">📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.<androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/connect_delivery_details_container" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/connect_dark_blue_color" android:padding="16dp">🤖 Prompt for AI Agents (early access)
In app/res/layout/fragment_connect_delivery_details.xml lines 23 to 28, the ConstraintLayout inside a CardView with wrap_content height is set to match_parent height, which can cause layout measurement issues. Change the ConstraintLayout's android:layout_height attribute from match_parent to wrap_content to ensure it respects the CardView's intrinsic height and avoids layout conflicts.
159-168: 🛠️ Refactor suggestion
Remove unsupported
orientationattribute onConstraintLayout.A
ConstraintLayoutdoes not support theandroid:orientationattribute (line 163). If you need a vertical stack, use aLinearLayoutor remove the attribute altogether for a pureConstraintLayout.- <androidx.constraintlayout.widget.ConstraintLayout - android:id="@+id/linearLayout" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:orientation="vertical" + <!-- Consider using LinearLayout if vertical stacking is needed --> + <androidx.constraintlayout.widget.ConstraintLayout + android:id="@+id/linearLayout" + android:layout_width="0dp" + android:layout_height="wrap_content"🤖 Prompt for AI Agents (early access)
In app/res/layout/fragment_connect_delivery_details.xml around lines 159 to 168, remove the unsupported android:orientation="vertical" attribute from the ConstraintLayout element, as ConstraintLayout does not support orientation. If vertical stacking is needed, replace ConstraintLayout with LinearLayout; otherwise, simply delete the orientation attribute to fix the issue.app/res/layout/fragment_connect_jobs_list.xml (1)
42-45:
⚠️ Potential issueRemove unsupported shadow attributes from
CardView.
android:shadowColor,android:shadowDx,android:shadowDy, andandroid:shadowRadius(lines 42–45) are not supported onandroidx.cardview.widget.CardViewand will be ignored. UsecardElevationandcardUseCompatPaddingfor shadows.- android:shadowColor="@color/connect_light_grey_transparent" - android:shadowDx="30" - android:shadowDy="30" - android:shadowRadius="50" + <!-- Shadow is handled by cardElevation -->🤖 Prompt for AI Agents (early access)
In app/res/layout/fragment_connect_jobs_list.xml lines 42 to 45, remove the unsupported attributes android:shadowColor, android:shadowDx, android:shadowDy, and android:shadowRadius from the CardView element. Instead, use the supported attributes cardElevation to set the shadow size and cardUseCompatPadding to adjust padding for shadows to achieve the desired shadow effect.app/res/layout/item_chat_right_view.xml (2)
52-59:
⚠️ Potential issueRename
tvUserNameand remove hard-coded timestamp.
tvUserName(lines 52–59) actually holds a timestamp, not a username, and contains"12:00 AM". Rename the ID (e.g.,tvTimestamp) and use a string resource ortools:textattribute.🤖 Prompt for AI Agents (early access)
In app/res/layout/item_chat_right_view.xml around lines 52 to 59, rename the TextView ID from tvUserName to tvTimestamp to reflect its purpose correctly. Remove the hard-coded text "12:00 AM" and replace it with a string resource reference or use the tools:text attribute for preview purposes only.
8-16:
⚠️ Potential issueReplace
RelativeLayout+ card attributes with a properCardView.The
RelativeLayout(lines 8–16) declaresapp:cardCornerRadiusandapp:cardElevation, which don’t apply. Wrap the content in aCardView(orMaterialCardView) instead of a plainRelativeLayoutto get rounded corners and shadows.🤖 Prompt for AI Agents (early access)
In app/res/layout/item_chat_right_view.xml around lines 8 to 16, replace the RelativeLayout element that incorrectly uses cardCornerRadius and cardElevation attributes with a CardView or MaterialCardView. Change the root or wrapping layout from RelativeLayout to CardView, move the layout attributes accordingly, and ensure the card-specific attributes like cardCornerRadius and cardElevation are applied to the CardView to enable proper rounded corners and shadows.app/res/layout/fragment_connect_delivery_list.xml (1)
44-51:
⚠️ Potential issueUse
dpinstead ofspfor padding values.The filter
RelativeLayout(lines 44–51) usesandroid:paddingHorizontal="16sp", but padding should usedp, as it affects layout size rather than font scaling.- android:paddingHorizontal="16sp" + android:paddingHorizontal="16dp"🤖 Prompt for AI Agents (early access)
In app/res/layout/fragment_connect_delivery_list.xml between lines 44 and 51, the RelativeLayout uses android:paddingHorizontal="16sp", but padding values should use dp units instead of sp. Change the paddingHorizontal attribute value from "16sp" to "16dp" to correctly specify padding size independent of font scaling.app/res/layout/connect_payment_item.xml (1)
23-32: 🛠️ Refactor suggestion
Improve accessibility with a meaningful content description.
The payment status icon is missing a meaningful content description, which is important for accessibility.
- android:contentDescription="@null" + android:contentDescription="@string/connect_payment_status_icon_description"🤖 Prompt for AI Agents (early access)
In app/res/layout/connect_payment_item.xml between lines 23 and 32, the ImageView for the payment status icon has its contentDescription set to null, which reduces accessibility. Replace android:contentDescription="@null" with a meaningful description that clearly conveys the icon's purpose, such as "Payment status transferred," to improve screen reader support.app/src/org/commcare/views/connect/CircleProgressBar.java (1)
97-103: 🛠️ Refactor suggestion
Use appropriate logging level instead of Log.e.
Error logging should be reserved for actual errors. For informational logging, use Log.d() or Log.v() instead.
- Log.e("CircleProgressBar", "Setting progress color to: " + color); + Log.d("CircleProgressBar", "Setting progress color to: " + color);🤖 Prompt for AI Agents (early access)
In app/src/org/commcare/views/connect/CircleProgressBar.java around lines 97 to 103, the method setProgressColor uses Log.e for logging an informational message about setting the progress color. Change the logging call from Log.e to Log.d or Log.v to use an appropriate logging level for informational messages instead of error logs.app/res/layout/item_login_connect_home_apps.xml (2)
85-94: 🛠️ Refactor suggestion
Add meaningful content description for download icon.
For better accessibility, provide a meaningful description for the download icon instead of using
@null.- android:contentDescription="@null" + android:contentDescription="@string/connect_download_icon_description"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.<ImageView android:id="@+id/imgDownload" android:layout_width="16dp" android:layout_height="16dp" android:layout_marginStart="16dp" - android:contentDescription="@null" + android:contentDescription="@string/connect_download_icon_description" android:src="@drawable/ic_connect_download_green" app:layout_constraintBottom_toBottomOf="@+id/llOpportunity" app:layout_constraintStart_toEndOf="@+id/progressBar" app:layout_constraintTop_toTopOf="@+id/llOpportunity"/>🤖 Prompt for AI Agents (early access)
In app/res/layout/item_login_connect_home_apps.xml around lines 85 to 94, the ImageView for the download icon has its contentDescription set to @null, which is not accessible. Replace the contentDescription="@null" with a meaningful string resource that describes the download icon, such as "Download" or a localized equivalent, to improve accessibility for screen readers.
2-20: 🛠️ Refactor suggestion
Remove ineffective shadow properties from CardView.
The shadow properties (
android:shadowColor,android:shadowDx,android:shadowDy,android:shadowRadius) do not affect CardView elements - they only work with TextView and related components. CardView has its own elevation and shadow handling throughapp:cardElevation.android:focusable="true" android:foreground="?android:attr/selectableItemBackground" - android:shadowColor="@color/connect_light_grey_transparent" - android:shadowDx="30" - android:shadowDy="30" - android:shadowRadius="50" app:cardBackgroundColor="@color/white"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/rootCardView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="16dp" android:layout_marginTop="8dp" android:layout_marginBottom="8dp" android:clickable="true" android:focusable="true" android:foreground="?android:attr/selectableItemBackground" app:cardBackgroundColor="@color/white" app:cardCornerRadius="12dp" app:cardElevation="5dp">🤖 Prompt for AI Agents (early access)
In app/res/layout/item_login_connect_home_apps.xml lines 2 to 20, remove the ineffective shadow properties android:shadowColor, android:shadowDx, android:shadowDy, and android:shadowRadius from the CardView element, as these attributes do not apply to CardView and only affect TextView and similar components. Use app:cardElevation to control shadows for CardView instead.app/res/layout-land/home_screen.xml (4)
149-154:
⚠️ Potential issueUse
wrap_contentfor RecyclerView height inside a nested scroll
Settingandroid:layout_height="match_parent"inside aNestedScrollViewcan cause measurement issues. Change towrap_contentso it expands only to its items’ height and allows smooth nested scrolling.🤖 Prompt for AI Agents (early access)
In app/res/layout-land/home_screen.xml around lines 149 to 154, the RecyclerView's layout_height is set to "match_parent" inside a NestedScrollView, which can cause measurement and scrolling issues. Change the android:layout_height attribute of the RecyclerView to "wrap_content" so it only expands to fit its items and enables smooth nested scrolling behavior.
103-113: 🛠️ Refactor suggestion
Avoid negative margins for overlapping cards
ThecvConnectMessageusesandroid:layout_marginTop="-35dp"to overlap the job card. Negative margins can lead to brittle layouts. Instead, position the warning card using proper constraints or adjust the parent padding so the overlap logic is clear and maintainable.🤖 Prompt for AI Agents (early access)
In app/res/layout-land/home_screen.xml between lines 103 and 113, the CardView with id cvConnectMessage uses a negative top margin (-35dp) to overlap the job card, which can cause fragile layouts. Remove the negative margin and instead use proper layout constraints or adjust the parent container's padding to achieve the desired overlap in a more stable and maintainable way.
40-42: 🛠️ Refactor suggestion
Constraints on
connect_alert_tilewon’t apply in a LinearLayout
Theapp:layout_constraintTop_toBottomOf="@id/connect_jobs_last_update"(and similar constraint attributes) on the<CardView>are ignored when it’s not inside aConstraintLayout. Either wrap this view in aConstraintLayoutor remove the unused constraint attributes.🤖 Prompt for AI Agents (early access)
In app/res/layout-land/home_screen.xml around lines 40 to 42, the CardView with id connect_alert_tile has constraint attributes like app:layout_constraintTop_toBottomOf which do not apply inside a LinearLayout. To fix this, either wrap the CardView inside a ConstraintLayout so the constraints work, or remove these constraint attributes if you want to keep the LinearLayout as the parent.
2-20:
⚠️ Potential issueRemove unsupported RelativeLayout attributes and adjust sizing on root LinearLayout
The root<LinearLayout>is usinglayout_alignParent*attributes andwrap_contentsizing, which are invalid or ineffective here. Consider changinglayout_width/layout_heighttomatch_parentand removingandroid:layout_alignParent*and left/right padding redundancies.Possible fix:
- <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentStart="true" - android:layout_alignParentLeft="true" - ... - android:paddingStart="@dimen/content_start" - android:paddingLeft="@dimen/content_start" - ...> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:padding="@dimen/content_start" + tools:viewBindingIgnore="true">Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents (early access)
In app/res/layout-land/home_screen.xml lines 2 to 20, the root LinearLayout incorrectly uses RelativeLayout-specific attributes like android:layout_alignParentStart/Left/Top/End/Right/Bottom, which are unsupported and ineffective here. Remove all these android:layout_alignParent* attributes, change android:layout_width and android:layout_height from wrap_content to match_parent to fill the parent container, and eliminate redundant paddingLeft and paddingRight attributes since paddingStart and paddingEnd already cover those.app/res/layout/fragment_connect_message.xml (1)
23-32:
⚠️ Potential issueAvoid fixed height for multi-line message input container
The<RelativeLayout>forcardMessageis set toandroid:layout_height="50dp", which may truncate text when the user enters multiple lines. Change towrap_contentso it grows with the content.🤖 Prompt for AI Agents (early access)
In app/res/layout/fragment_connect_message.xml between lines 23 and 32, the RelativeLayout with id cardMessage has a fixed height of 50dp, which can truncate multi-line text input. Change the android:layout_height attribute from "50dp" to "wrap_content" to allow the container to expand dynamically with the content.app/res/layout/connect_delivery_progress_item.xml (1)
34-43:
⚠️ Potential issueIncorrect
layout_weightusage – widths should be0dp
In the horizontalLinearLayout(linearLayout5), children withlayout_weight="1"should specifyandroid:layout_width="0dp", notmatch_parent, to distribute space evenly.🤖 Prompt for AI Agents (early access)
In app/res/layout/connect_delivery_progress_item.xml lines 34 to 43, the horizontal LinearLayout with id linearLayout5 has children using layout_weight="1" but their android:layout_width is set to match_parent. To fix this, change the android:layout_width of these children to 0dp so that the weights distribute the space evenly as intended.app/res/layout/fragment_connect_progress_delivery.xml (2)
157-166: 🛠️ Refactor suggestion
Use MaterialButton’s icon API instead of deprecated
android:drawableRight
You should replace:<com.google.android.material.button.MaterialButton ... android:drawableRight="@drawable/ic_connect_directory_sync" />with:
<com.google.android.material.button.MaterialButton ... app:icon="@drawable/ic_connect_directory_sync" app:iconGravity="textEnd" app:iconPadding="5dp" />This aligns with Material components best practices.
🤖 Prompt for AI Agents (early access)
In app/res/layout/fragment_connect_progress_delivery.xml lines 157 to 166, replace the deprecated android:drawableRight attribute on the MaterialButton with the recommended MaterialButton icon API by removing android:drawableRight and android:drawablePadding, then add app:icon="@drawable/ic_connect_directory_sync", app:iconGravity="textEnd", and app:iconPadding="5dp" attributes to properly set the icon following Material components best practices.
40-51:
⚠️ Potential issueRemove invalid ConstraintLayout attributes inside a LinearLayout
TheTextViewinsideconnect_progress_title_rowhasapp:layout_constraintStart_toStartOfand…_toTopOf, but its parent is aLinearLayout. Constraints only work inConstraintLayout. Either remove these or switch the parent toConstraintLayout.🤖 Prompt for AI Agents (early access)
In app/res/layout/fragment_connect_progress_delivery.xml between lines 40 and 51, the TextView inside connect_progress_title_row has ConstraintLayout attributes (app:layout_constraintStart_toStartOf and app:layout_constraintTop_toTopOf) but its parent is a LinearLayout, which does not support constraints. To fix this, either remove these constraint attributes from the TextView or change the parent layout from LinearLayout to ConstraintLayout to properly support these constraints.app/res/layout/fragment_connect_learning_progress.xml (2)
321-330:
⚠️ Potential issueUse
android:textinstead oftools:textfor runtime values
Both theconnect_learning_review_buttonandconnect_learning_buttonusetools:text, so they will appear blank at runtime. Change toandroid:text="@string/connect_learn_review"(and appropriate string) to display the labels.🤖 Prompt for AI Agents (early access)
In app/res/layout/fragment_connect_learning_progress.xml around lines 321 to 330, the buttons use tools:text attributes which only show text in the layout editor but not at runtime. Replace tools:text with android:text="@string/connect_learn_review" (or the appropriate string resource) on both connect_learning_review_button and connect_learning_button to ensure the text appears during app execution.
197-202:
⚠️ Potential issueRemove unsupported ConstraintLayout attributes on a child of
LinearLayout
Theconnect_learning_certificate_containerhasapp:layout_constraint*attributes, but its parent is aLinearLayout. These constraints won’t apply—either remove them or wrap in aConstraintLayout.🤖 Prompt for AI Agents (early access)
In app/res/layout/fragment_connect_learning_progress.xml around lines 197 to 202, the element with id connect_learning_certificate_container has app:layout_constraint* attributes but its parent is a LinearLayout, so these constraints have no effect. To fix this, remove all app:layout_constraint* attributes from this element or alternatively wrap this element inside a ConstraintLayout to make the constraints valid.app/res/layout/fragment_connect_delivery_progress.xml (1)
108-113: 🛠️ Refactor suggestion
Negative margins are brittle and hinder maintainability
android:layout_marginTop="-35dp"pulls the warning card upward, but negative margins often break on different screen sizes and RTL layouts. Prefer a proper stacking container (e.g.ConstraintLayoutwithapp:layout_constraintTop_toBottomOf="...") or adjust elevation/translation.🤖 Prompt for AI Agents (early access)
In app/res/layout/fragment_connect_delivery_progress.xml between lines 108 and 113, replace the negative top margin android:layout_marginTop="-35dp" with a more robust layout approach. Use a ConstraintLayout and set app:layout_constraintTop_toBottomOf to position the warning card below the referenced view instead of pulling it upward with negative margins. Alternatively, adjust elevation or translation properties to achieve the desired visual effect without using negative margins, ensuring better compatibility across screen sizes and RTL layouts.app/res/navigation/nav_graph_connect.xml (1)
21-38:
⚠️ Potential issueDuplicate action IDs cause IDE warnings & potential run-time clashes
action_connect_jobs_list_fragment_to_connect_downloading_fragmentand the suffixed…_fragment2both go to the same destination. If they serve different purposes, give each a meaningful ID; if not, drop the duplicate.- <action - android:id="@+id/action_connect_jobs_list_fragment_to_connect_downloading_fragment2" - app:destination="@id/connect_downloading_fragment" /> + <!-- Removed duplicate action id -->📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.<action android:id="@+id/action_connect_jobs_list_fragment_to_connect_job_intro_fragment" app:destination="@id/connect_job_intro_fragment" /> <action android:id="@+id/action_connect_jobs_list_fragment_to_connect_job_learning_progress_fragment" app:destination="@id/connect_job_learning_progress_fragment" /> <action android:id="@+id/action_connect_jobs_list_fragment_to_connect_job_delivery_details_fragment" app:destination="@id/connect_job_delivery_details_fragment" /> <action android:id="@+id/action_connect_jobs_list_fragment_to_connect_job_delivery_progress_fragment" app:destination="@id/connect_job_delivery_progress_fragment" /> <action android:id="@+id/action_connect_jobs_list_fragment_to_connect_downloading_fragment" app:destination="@id/connect_downloading_fragment" app:popUpTo="@id/connect_jobs_list_fragment" /> <!-- Removed duplicate action id -->🤖 Prompt for AI Agents (early access)
In app/res/navigation/nav_graph_connect.xml between lines 21 and 38, there are two actions with IDs action_connect_jobs_list_fragment_to_connect_downloading_fragment and action_connect_jobs_list_fragment_to_connect_downloading_fragment2 pointing to the same destination. To fix this, either remove the duplicate action if it is unnecessary or rename the second action to a meaningful unique ID if it serves a different purpose, ensuring no duplicate action IDs exist to avoid IDE warnings and runtime conflicts.app/src/org/commcare/views/ConnectPhoneInputView.java (1)
77-81:
⚠️ Potential issueFirst call to
setTextSizeis overwritten – usesetHintTextColoronly
etPhoneNumber.setTextSize(..., editTextHintSize);(line 78) is immediately overridden by the nextsetTextSizecall (line 80). The intent seems to be changing hint size, not text size.- etPhoneNumber.setTextSize(TypedValue.COMPLEX_UNIT_PX, editTextHintSize); + // keep text size unchanged here – only apply hint size + // Hint size is handled below via textAppearance or by leaving this line out📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.etPhoneNumber.setHintTextColor(editTextHintColor); // keep text size unchanged here – only apply hint size // Hint size is handled below via textAppearance or by leaving this line out etPhoneNumber.setTextColor(editTextColor); etPhoneNumber.setTextSize(TypedValue.COMPLEX_UNIT_PX, editTextSize);🤖 Prompt for AI Agents (early access)
In app/src/org/commcare/views/ConnectPhoneInputView.java around lines 77 to 81, the first call to setTextSize with editTextHintSize is immediately overwritten by the second call with editTextSize. To fix this, remove the first setTextSize call and instead apply the editTextHintSize to the hint text size property if available, or adjust the code to only set the actual text size once using editTextSize.app/src/org/commcare/views/connect/ConnectEditText.java (3)
187-198: 🛠️ Refactor suggestion
Null-check compound drawables before dereferencing
If the XML sets
drawableStartVisible="true"but omitseditTextDrawableStart,getCompoundDrawables()[0]isnull, producing an NPE when touching the field. Guard the lookup.- if (event.getX() <= getCompoundDrawables()[0].getBounds().width()) { + Drawable start = getCompoundDrawables()[0]; + if (start != null && event.getX() <= start.getBounds().width()) {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.if (drawableStartVisible && event.getAction() == MotionEvent.ACTION_UP) { - if (event.getX() <= getCompoundDrawables()[0].getBounds().width()) { + Drawable start = getCompoundDrawables()[0]; + if (start != null && event.getX() <= start.getBounds().width()) { if (onDrawableStartClickListener != null) { onDrawableStartClickListener.onDrawableStartClick(); } return true; } }🤖 Prompt for AI Agents (early access)
In app/src/org/commcare/views/connect/ConnectEditText.java around lines 187 to 198, the code dereferences getCompoundDrawables()[0] and getCompoundDrawables()[2] without null checks, which can cause a NullPointerException if the drawable is not set. Add null checks to ensure getCompoundDrawables()[0] and getCompoundDrawables()[2] are not null before accessing their bounds to prevent NPEs when drawableStartVisible or drawableEndVisible is true but the drawable is missing.
81-99: 🛠️ Refactor suggestion
Text & hint sizing use pixel values with SP unit API – leads to scaling bugs
setTextSize(textSize)interpretstextSizeas scaled-pixels because the 1-arg overload usesTypedValue.COMPLEX_UNIT_SP. SincetextSizeis already in PX (spToPx()), the text is enlarged twice on high-dpi devices. Use the 2-arg overload withCOMPLEX_UNIT_PX.- float textSize = a.getDimension(R.styleable.CustomEditText_editTextTextSize, spToPx(DEFAULT_TEXT_SIZE)); - setTextSize(textSize); + float textSize = a.getDimension(R.styleable.CustomEditText_editTextTextSize, spToPx(DEFAULT_TEXT_SIZE)); + setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);Also,
setHintTextSize()simply delegates tosetTextSize, so calling it changes both hint and actual text. Consider usingsetTextAppearanceorTextViewCompat.setAutoSizeTextTypeWithDefaultsto style hint separately.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.@@ app/src/org/commcare/views/connect/ConnectEditText.java:81-99 String text = a.getString(R.styleable.CustomEditText_editTextText); if (text != null) { setText(text); } - float textSize = a.getDimension(R.styleable.CustomEditText_editTextTextSize, spToPx(DEFAULT_TEXT_SIZE)); - setTextSize(textSize); + float textSize = a.getDimension(R.styleable.CustomEditText_editTextTextSize, spToPx(DEFAULT_TEXT_SIZE)); + setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); String hint = a.getString(R.styleable.CustomEditText_editTextHint); if (hint != null) { setHint(hint); } float hintSizeNew = a.getDimension(R.styleable.CustomEditText_editTextHintSize, hintSize); setHintTextSize(hintSizeNew); setBorder(borderWidth, cornerRadius, borderColor); setHintAttributes(hintColor, hintSize); setEditable(isEditable);🤖 Prompt for AI Agents (early access)
In app/src/org/commcare/views/connect/ConnectEditText.java around lines 81 to 99, the code calls setTextSize with a pixel value but uses the 1-argument overload that treats it as scaled pixels, causing double scaling on high-DPI devices. Fix this by using the 2-argument setTextSize method with COMPLEX_UNIT_PX to correctly apply pixel size. Additionally, since setHintTextSize delegates to setTextSize and affects both text and hint, refactor hint sizing to use setTextAppearance or TextViewCompat.setAutoSizeTextTypeWithDefaults to style the hint separately without impacting the main text size.
169-176:
⚠️ Potential issueNegative drawable bounds may clip icons
drawableEnd.setBounds(-paddingRight, 0, drawableWidth - paddingRight, drawableHeight)passes a negative left bound. Some OEM skins clip or ignore such bounds. Use positive bounds and rely onsetCompoundDrawablePaddingfor spacing.- drawableEnd.setBounds(-paddingRight, 0, drawableWidth - paddingRight, drawableHeight); + drawableEnd.setBounds(0, 0, drawableWidth, drawableHeight);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.drawableStart.setBounds(paddingLeft, 0, drawableWidth + paddingLeft, drawableHeight); drawableStart.setTint(tintColor); } if (drawableEnd != null && drawableEndVisible) { - drawableEnd.setBounds(-paddingRight, 0, drawableWidth - paddingRight, drawableHeight); + drawableEnd.setBounds(0, 0, drawableWidth, drawableHeight); drawableEnd.setTint(tintColor); }🤖 Prompt for AI Agents (early access)
In app/src/org/commcare/views/connect/ConnectEditText.java around lines 169 to 176, the drawableEnd's left bound is set to a negative value which can cause clipping issues on some OEM skins. To fix this, adjust the bounds to use only positive values by setting the left bound to 0 and the right bound to drawableWidth, then use setCompoundDrawablePadding to handle the spacing instead of negative bounds.app/res/values-fr/strings.xml (1)
164-164:
⚠️ Potential issueRemove stray quotes and correct accent.
The value currently is"Sélectioné: ".
- Remove the extra double quotes.
- Correct the accentuation: “Sélectionné : ” (with non-breaking space before colon).
- <string name="selected" tools:ignore="PrivateResource">"Sélectioné: "</string> + <string name="selected" tools:ignore="PrivateResource">Sélectionné : </string>🤖 Prompt for AI Agents (early access)
In app/res/values-fr/strings.xml at line 164, remove the stray double quotes surrounding the string value and correct the accentuation by changing "Sélectioné: " to "Sélectionné : " with a non-breaking space before the colon.app/res/values-pt/strings.xml (3)
42-42:
⚠️ Potential issueUnbalanced double-quote error.
There are two trailing quotes in:<string name="back_to_manager">Voltar ao Gerenciador de aplicativos""</string>This will break XML parsing. Remove the extra
":- ...aplicativos"" + ...aplicativos"🤖 Prompt for AI Agents (early access)
In app/res/values-pt/strings.xml at line 42, there is an unbalanced double-quote in the string value for "back_to_manager". Remove the extra trailing double-quote so the string ends with a single quote before the closing tag to fix the XML parsing error.
91-91:
⚠️ Potential issueIncorrect translation for ‘proceed’.
The currentAVANCEis Spanish. In Portuguese use “AVANÇAR” or “PROSSEGUIR”.🤖 Prompt for AI Agents (early access)
In app/res/values-pt/strings.xml at line 91, the translation for the string named "proceed" is incorrect as it uses the Spanish word "AVANCE". Replace "AVANCE" with the correct Portuguese translation, either "AVANÇAR" or "PROSSEGUIR", to accurately reflect the intended meaning.
101-101:
⚠️ Potential issueEnglish text not translated.
<string name="clearanswer_confirm">Remove the response to \%s\"?"</string>This must be translated into Portuguese and properly escaped.
🤖 Prompt for AI Agents (early access)
In app/res/values-pt/strings.xml at line 101, the string "clearanswer_confirm" is still in English and not translated to Portuguese. Translate the text into Portuguese while maintaining the placeholder %s and proper escaping of special characters like quotes and percent signs. Replace the English string with the correct Portuguese translation and ensure the formatting and escaping follow XML string resource conventions.
|
@coderabbitai full review please |
|
Tip For best results, initiate chat on the files or code changes. |
|
A summary of the edits CodeRabbit can apply:
A plan of each step that CodeRabbit will take in order to execute the edits for each file (with inline rough draft snippets): ✏️ app/res/layout-land/home_screen.xmlUpdate the root LinearLayout (around lines 2–20): android:layout_width="wrap_content"
android:layout_height="wrap_content"to android:layout_width="match_parent"
android:layout_height="match_parent"Remove all Add content descriptions for the non-textual interactive elements:
android:contentDescription="@string/connect_alert_tile_desc"
android:contentDescription="@string/connect_secondary_phone_icon_desc"Then, in res/values/strings.xml, add if missing: <string name="connect_alert_tile_desc">Connection alert tile</string>
<string name="connect_secondary_phone_icon_desc">Phone icon</string>Enforce a minimum 48×48 dp touch target on tappable buttons: android:layout_height="35dp"with android:layout_height="48dp"and add immediately after: android:minWidth="48dp"
android:minHeight="48dp"Validate text contrast for the warning message (TextView id="@+id/tvConnectMessage", lines 124–134): Review responsive behavior in landscape:
After applying all XML changes, run Android Studio’s Accessibility Scanner and Layout Validation tools to confirm:
✏️ app/res/navigation/nav_graph_connect_messaging.xmlEnsure the root element includes startDestination="@id/connectMessagingFragment" (or the correct entry fragment ID). If it’s missing, add it to define the launch destination of this graph. For each element, add or confirm android:label="@string/title_[fragment_id]" so that accessibility services announce the current screen. Example: android:label="@string/title_connect_messaging". Review every child: verify app:destination references a valid fragment ID. For actions that pass arguments, ensure there’s a corresponding with android:name, app:argType (e.g., string, integer), and android:defaultValue if appropriate. Run the Navigation Safe Args Gradle task (e.g., ./gradlew generateDebugNavigation) to regenerate navigation classes and confirm that your action and argument declarations match the generated code. ✏️ app/res/layout/connect_delivery_item.xmlLocate the ImageView with id imgDeliveryStatus (around line 19–24). Replace android:contentDescription="@null" with In the LinearLayout llDeliveryStatus (lines 10–16), update the width and height from 40dp to 48dp to meet the minimum touch target size: On the TextView delivery_item_name (lines 27–37), add attributes to prevent overflow on small screens: On the TextView delivery_item_reason (lines 40–52), likewise add: Remove the tools:ignore="MissingConstraints" from delivery_item_status (line 69) and add the following constraints so it lays out correctly when visible: ✏️ app/res/layout/connect_delivery_progress_item.xmlIn the CardView start tag (around lines 2–17), add a minimum height of 48dp to meet touch target accessibility guidelines. For example, immediately after android:layout_margin="10dp", insert: android:minHeight="48dp"For each LinearLayout with android:layout_weight="1" (at lines 48 and 104), change android:layout_width from "match_parent" to "0dp" so weight-based sizing functions correctly. Replace: android:layout_width="match_parent"
android:layout_weight="1"with: android:layout_width="0dp"
android:layout_weight="1"Replace each android:contentDescription="@null" on the ImageView elements (lines 60, 116, 163) with references to new string resources. For example, change: android:contentDescription="@null"to: android:contentDescription="@string/connect_thumb_up_desc"Then similarly use @string/connect_check_circle_desc for the second ImageView and @string/connect_arrow_forward_desc for the third. Run Android Lint’s accessibility checks (via Analyze → Inspect Code in Android Studio or ./gradlew lint) to verify that touch targets, text contrast, and content descriptions meet guidelines. Address any additional issues flagged for this layout. Test the updated layout in multiple screen sizes and orientations (e.g., phone vs. tablet, portrait vs. landscape) using the Layout Editor or on devices/emulators to confirm the UI remains responsive and accessible. ✏️ app/res/layout/connect_payment_item.xmlFor each ImageView currently using android:contentDescription="@null" (ids: imgPaymentStatusIcon, imgReceived, imgYellowDot, imgRevert), replace that attribute with a reference to a new string resource. For example, change: Update the confirm CardView to meet a 48dp minimum height and be fully interactive. Replace: Insert a ConstraintLayout Barrier before the CardView to keep the confirm button and revert-layout aligned without overlapping on narrow screens. Directly above the CardView, add: Replace the nested LinearLayout (id="linearLayout4") with a ConstraintLayout for better responsiveness. Change: Improve text contrast for secondary info (tv_payment_status and date). Since connect_grey (#A0A0A0) only meets a ~3:1 contrast ratio on white, switch these to a darker resource (for example, @color/connect_grey_dark with >=4.5:1 ratio). Update: Open Android Studio Layout Preview and validate connect_payment_item.xml on at least three screen sizes (small, normal, large) in portrait and landscape. Adjust margins or constraints to prevent truncation or overlap. Run a string resource consistency check across all locale folders to ensure desc_* entries (desc_payment_status_icon, desc_confirm_button, etc.) appear in every values-/strings.xml. If any are missing, add a placeholder translation and flag for localization. Add XML comments above each major section (accessibility, barrier usage, responsive container) explaining the change rationale for future maintainers. ✏️ app/res/layout/fragment_channel_consent_bottom_sheet.xmlAdd missing string resource for the ImageView content description. In app/src/main/res/values/strings.xml, add: Define the missing string keys for title, description, accept, and decline in base strings.xml and each locale. For example, in app/src/main/res/values/strings.xml: Ensure touch targets are at least 48dp for both buttons. On decline_button and accept_button, add: Update color resources references. Since connect_warning_color, connect_subtext, and connect_subtext_80 are not defined, either define them in colors.xml or switch to Android system colors. To define in app/src/main/res/values/colors.xml: Improve layout responsiveness. On the root LinearLayout (line 11), add: Run accessibility and layout validation: ✏️ app/res/layout/fragment_connect_delivery_details.xmlFor each ImageView whose contentDescription is set to "@null", replace the attribute as follows. If the icon is purely decorative, set android:contentDescription=""
android:importantForAccessibility="no"Otherwise reference a new string resource. For example, update the visits icon block to: <ImageView
android:id="@+id/connect_delivery_visits_icon"
android:layout_width="32dp"
android:layout_height="32dp"
android:contentDescription="@string/connect_delivery_visits_icon_desc"
android:importantForAccessibility="no"
android:src="@drawable/ic_connect_check_circle"
app:layout_constraintBottom_toBottomOf="@+id/connect_delivery_total_visits_text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/connect_delivery_total_visits_text" />And add these entries to your values/strings.xml (and their translations): <string name="connect_delivery_visits_icon_desc">Delivery visits icon</string>
<string name="connect_delivery_days_icon_desc">Delivery days icon</string>
<string name="connect_delivery_max_daily_icon_desc">Max daily deliveries icon</string>
<string name="connect_delivery_budget_icon_desc">Budget icon</string>Update the MaterialButton to meet the 48dp minimum touch target. Change its declaration to include minWidth, minHeight, and padding. For example: <com.google.android.material.button.MaterialButton
android:id="@+id/connect_delivery_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="48dp"
android:minHeight="48dp"
android:padding="12dp"
android:text="@string/connect_job_info_download"
android:backgroundTint="@color/white"
android:drawableRight="@drawable/ic_connect_arrow_forward_20px"
android:textColor="@color/cc_brand_color"
app:iconTint="@color/cc_brand_color"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />Modify the ConstraintLayout with id connect_delivery_details_container to wrap its content height for improved flexibility. Replace android:layout_height="match_parent"with android:layout_height="wrap_content"so that the card adapts to its content rather than filling the screen. In Android Studio’s Layout Preview, test the updated fragment on multiple device sizes and in both portrait and landscape. If the landscape rendering is suboptimal, create a new file at A summary of the context that CodeRabbit is considering across the codebase:
|
|
Closing in favor of #3093 where we are able to get code rabbit comments. |
Technical Summary
https://dimagi.atlassian.net/browse/CCCT-1087
Feature Flag
Its review process
Labels and Review