-
-
Notifications
You must be signed in to change notification settings - Fork 45
- implement the nav drawer based on Controller #3287
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
| startAllowed = savedInstanceState.getBoolean("startAllowed"); | ||
| } | ||
|
|
||
| private void setupDrawerController() { |
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.
think we should still have a base activity that can contain this method along with the logic in onOptionsItemSelected
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.
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.
shubham1g5
left a comment
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.
changes for the correponding landscape layouts (layout-land) are missing.
| 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){} |
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.
can we add this instead in a BaseDrawerActivity ? I don't really want us to bulk the code in CommCareActivity without a good reason.
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.
| case COMMCARE_APPS: | ||
| protected void handleDrawerItemClick(BaseDrawerController.NavItemType itemType, String recordId) { | ||
| switch (itemType) { | ||
| case OPPORTUNITIES -> { /* handle */ } |
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.
can we also add the click handling now that the connect code is merged.
| } | ||
|
|
||
|
|
||
| protected void handleDrawerItemClick(BaseDrawerController.NavItemType navItemType, String recordId){} |
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.
we should move this to BaseDrawerActivity as well.
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.
| } | ||
| loadIntentAndInstanceState(savedInstanceState); | ||
| persistCommCareAppState(); | ||
| setupDrawerController(); |
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.
can this be called in onCreate or onPostCreate of BaseDrawerActivity` as well ?
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.
| import androidx.recyclerview.widget.RecyclerView | ||
| import org.commcare.dalvik.R | ||
|
|
||
| class DrawerViewRefs(rootView: View) { |
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.
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
…roid into pm_nav_design_change # Conflicts: # app/res/values-no/strings.xml
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