-
Notifications
You must be signed in to change notification settings - Fork 6
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
Feedback Resolved #47
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request enhances the HomeActivity and related layout files. In HomeActivity.kt, new variables and methods are introduced to support an expandable navigation list with updated click handling and a refactored chat dialog that now accepts a URL. The activity’s initialization method is updated accordingly. In the XML layouts, the NavigationView is restructured to incorporate an ExpandableListView and repositioned footer, while the bottom sheet chat window layout is simplified with a new bottom close button and background updates. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant HA as HomeActivity
participant ELA as ExpandableNavigationListAdapter
participant CD as Chat Dialog
U->>HA: Launches HomeActivity
HA->>HA: initializeMenuData()
HA->>ELA: setupExpandableList()
U->>HA: Clicks on a menu group or child item
HA->>HA: handleNavigation(group, child)
alt Chat option selected
HA->>HA: displaychatdialog(url)
HA->>CD: Open chat dialog with specific URL
else Other navigation
HA->>Other: Navigate to target screen
end
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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.
Actionable comments posted: 2
🧹 Nitpick comments (6)
app/src/main/res/layout/activity_home.xml (1)
87-113
: Well-Structured Navigation Container
The new LinearLayout encapsulates the ExpandableListView and footer TextView in a clean, vertically oriented container. The use of:
• An ExpandableListView with a layout_height of “0dp” and layout_weight “1” ensures that it fills available space efficiently.
• A footer TextView that displays the version, with clear styling attributes.
One minor point for review: while the TextView uses “android:layout_gravity” with “bottom|center_horizontal”, in a vertical LinearLayout this property will only affect horizontal alignment and any extra space distribution relies mainly on the weighted view above. Consider verifying that this achieves the desired footer positioning on all targeted devices.app/src/main/java/org/piramalswasthya/sakhi/ui/home_activity/HomeActivity.kt (4)
261-287
: Method initializeMenuData: consider i18n for string literals.
Storing menu titles in the string resources might help with internationalization and consistent UI text management.
328-382
: Large when block in handleNavigation.
Consider mapping titles to actions more systematically (e.g., a dictionary or sealed classes) to reduce repetition and improve maintainability. Also note that the “Incentives” case body is empty.
402-457
: displaychatdialog: overall implementation is fine.
This bottom sheet approach with a WebView and close button works well. If users frequently open the chat, consider caching or pooling the instance to reduce reload overhead.
517-520
: removeClickListenerToHomepageActionBarTitle.
Consider merging this with the previous method by passing a boolean, e.g. setActionBarTitleClickable(enable: Boolean).app/src/main/res/layout/bottomsheet_chat_window.xml (1)
36-46
: New bottom close button might be hidden if tinted white on white.
Consider using a different tint or add a contrasting background behind the button so users can see it clearly.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
app/src/main/java/org/piramalswasthya/sakhi/ui/home_activity/HomeActivity.kt
(7 hunks)app/src/main/res/layout/activity_home.xml
(2 hunks)app/src/main/res/layout/bottomsheet_chat_window.xml
(2 hunks)
🔇 Additional comments (23)
app/src/main/res/layout/activity_home.xml (4)
2-3
: XML Initialization & Namespace Declarations
The DrawerLayout tag and its XML namespace definitions are correctly declared. No issues found here.
78-78
: Clarity in Inline Documentation
The added comment, “Navigation View with Header and ExpandableListView”, is clear and helps signal the upcoming changes.
79-86
: Enhanced NavigationView Configuration
The NavigationView has been updated by removing the static app:menu attribute and setting a header via app:headerLayout. This clearly aligns with the new design that leverages an ExpandableListView for dynamic navigation items.
83-83
: Potential Misuse of Layout Attribute
The attribute “android:layout_below” has been added on the NavigationView. Since NavigationView is a direct child of DrawerLayout (which does not interpret RelativeLayout parameters), this attribute may be ignored. Please verify if it’s achieving the intended positioning effect or if it should be removed.app/src/main/java/org/piramalswasthya/sakhi/ui/home_activity/HomeActivity.kt (18)
8-56
: No issues with new imports.
These imports look appropriate for the newly introduced classes and functionalities (expandable list, bottom sheet, etc.).
70-74
: New fields for chat support and navigation look good.
They’re clearly named, and late initialization is suitable here.
199-199
: Confirm whether secure window flag is intentionally disabled.
Re-enabling the FLAG_SECURE is usually recommended for production, to prevent screen capturing.
230-230
: Validate BuildConfig.CHAT_URL usage.
Ensure that the generated URL is safe from injection or unexpected parameters.
289-326
: Redundant data initialization in setupExpandableList.
Since initializeMenuData() appears again at line 291, verify no duplicate items are created.
384-389
: navigateActivity is unused or underutilized.
Check if it’s called anywhere or remove it for clarity.
458-471
: Double-check secure window code in onResume.
You’ve commented out the security flags again. Verify whether partial or full re-enablement is needed to protect sensitive data.
472-510
: setUpMenu with MenuProvider is straightforward.
This implementation effectively controls toolbar items dynamically. No immediate issues noted.
512-515
: addClickListenerToHomepageActionBarTitle is concise.
This is a clean extension for customizing the toolbar click.
523-527
: finishAndStartServiceLocationActivity is clear.
Using finish() and then starting the activity is a valid approach.
529-533
: setHomeMenuItemVisibility is fine.
This neatly updates the menu’s visible state.
534-539
: setUpFirstTimePullWorker triggers background tasks.
Confirm that each scheduled worker has proper error handling or retry logic, especially for slower networks.
541-562
: setUpNavHeader is properly populating user info.
The usage of Glide for profile pictures is fine. No issues noted.
564-577
: setUpActionBar is straightforward.
It sets up the NavController and the action bar with no immediate problems.
580-586
: updateActionBar is flexible.
Allows dynamic logo and optional title updates. Looks good.
588-592
: onBackPressed override.
Closing the drawer if open is a good UX approach.
594-597
: onDestroy is standard.
Nullifying the binding reference is a good cleanup practice.
599-604
: isDeviceRootedOrEmulator references external checks.
Ensure these checks remain accurate and up-to-date. Some advanced rooting/emulation methods might bypass them.app/src/main/res/layout/bottomsheet_chat_window.xml (1)
3-7
: Added app namespace & switched background to white.
No issues from a layout perspective. Just confirm that the white background is desired for the entire bottom sheet.
|
||
initializeMenuData() | ||
setupExpandableList() |
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.
🛠️ Refactor suggestion
Avoid calling initializeMenuData() multiple times.
The same method is also called at line 291 inside setupExpandableList(), potentially leading to duplicate or redundant data initialization. Consider removing one of the calls.
private fun logoutAlert() { | ||
AlertDialog.Builder(this) | ||
.setTitle("Logout") | ||
.setMessage("Are you sure you want to logout?") | ||
.setPositiveButton("Yes") { _, _ -> | ||
// Perform logout logic here | ||
Toast.makeText(this, "Logged out successfully", Toast.LENGTH_SHORT).show() | ||
} | ||
.setNegativeButton("Cancel", null) | ||
.show() | ||
} |
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.
🛠️ Refactor suggestion
logoutAlert naming conflict.
There is already a lazy property named logoutAlert at lines 140–160. Rename either the method or the property to avoid confusion.
📋 Description
JIRA ID:
Please provide a summary of the change and the motivation behind it. Include relevant context and details.
✅ Type of Change
ℹ️ Additional Information
Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.
Summary by CodeRabbit