Skip to content

Conversation

@pm-dimagi
Copy link
Contributor

Product Description

Made changes for the BaseDrawer activity to BaseDrawerController so that there will no need of extending the activity we can directly plugin that in the calling activity

Technical Summary

Feature Flag

Safety Assurance

Safety story

Automated test coverage

QA Plan

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

@pm-dimagi pm-dimagi requested a review from shubham1g5 August 6, 2025 12:05
startAllowed = savedInstanceState.getBoolean("startAllowed");
}

private void setupDrawerController() {
Copy link
Contributor

@shubham1g5 shubham1g5 Aug 7, 2025

Choose a reason for hiding this comment

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

think we should still have a base activity that can contain this method along with the logic in onOptionsItemSelected

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@shubham1g5 shubham1g5 left a comment

Choose a reason for hiding this comment

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

changes for the correponding landscape layouts (layout-land) are missing.

@pm-dimagi pm-dimagi requested a review from shubham1g5 August 7, 2025 10:43
Comment on lines 1001 to 1022
protected void setupDrawerController() {
PersonalIdManager personalIdManager = PersonalIdManager.getInstance();
personalIdManager.init(this);
if (personalIdManager.isloggedIn()) {
View rootView = findViewById(android.R.id.content);
DrawerViewRefs drawerRefs = new DrawerViewRefs(rootView);
drawerController = new BaseDrawerController(
this,
drawerRefs,
new Function2<BaseDrawerController.NavItemType, String, Unit>() {
@Override
public Unit invoke(BaseDrawerController.NavItemType navItemType, String recordId) {
handleDrawerItemClick(navItemType, recordId);
return Unit.INSTANCE;
}
}
);
drawerController.setupDrawer();
}
}

protected void handleDrawerItemClick(BaseDrawerController.NavItemType navItemType, String recordId){}
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add this instead in a BaseDrawerActivity ? I don't really want us to bulk the code in CommCareActivity without a good reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

case COMMCARE_APPS:
protected void handleDrawerItemClick(BaseDrawerController.NavItemType itemType, String recordId) {
switch (itemType) {
case OPPORTUNITIES -> { /* handle */ }
Copy link
Contributor

Choose a reason for hiding this comment

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

can we also add the click handling now that the connect code is merged.

}


protected void handleDrawerItemClick(BaseDrawerController.NavItemType navItemType, String recordId){}
Copy link
Contributor

Choose a reason for hiding this comment

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

we should move this to BaseDrawerActivity as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

}
loadIntentAndInstanceState(savedInstanceState);
persistCommCareAppState();
setupDrawerController();
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be called in onCreate or onPostCreate of BaseDrawerActivity` as well ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

import androidx.recyclerview.widget.RecyclerView
import org.commcare.dalvik.R

class DrawerViewRefs(rootView: View) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nice abstraction.

…nto pm_nav_design_change

# Conflicts:
#	app/res/values-lt/strings.xml
#	app/res/values-no/strings.xml
#	app/src/org/commcare/activities/StandardHomeActivity.java
@pm-dimagi pm-dimagi requested a review from shubham1g5 August 8, 2025 04:34
…roid into pm_nav_design_change

# Conflicts:
#	app/res/values-no/strings.xml
@pm-dimagi pm-dimagi merged commit eb3085c into pm_CCCT-1515 Aug 8, 2025
1 check passed
@pm-dimagi pm-dimagi deleted the pm_nav_design_change branch August 8, 2025 05:02
@OrangeAndGreen OrangeAndGreen added this to the 2.59 milestone Aug 11, 2025
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.

4 participants