Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Activity activity;
- Toolbar toolbar;
- public DrawerHelper(Activity activity, Toolbar toolbar) {
- this.activity = activity;
- this.toolbar = toolbar;
- }
- public void setDrawer() {
- Drawer result = new DrawerBuilder()
- .withActivity(activity)
- .withToolbar(toolbar)
- .withAccountHeader(getAccountHeader())
- .addDrawerItems(
- new SecondaryDrawerItem().withName("Transações").withIcon(GoogleMaterial.Icon.gmd_wb_sunny).withTag("transactions")
- )
- .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
- @Override
- public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
- switch (drawerItem.getTag().toString()) {
- case "transactions":
- ((MenuActivity)activity).replaceFragment(new ListFragment(), null, false);
- break;
- }
- return false;
- }
- })
- .build();
- }
- public AccountHeader getAccountHeader() {
- AccountHeader headerResult = new AccountHeaderBuilder()
- .withActivity(activity)
- .addProfiles(
- new ProfileDrawerItem().withName("Mike Penz").withEmail("mikepenz@gmail.com")
- )
- .withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() {
- @Override
- public boolean onProfileChanged(View view, IProfile profile, boolean currentProfile) {
- return false;
- }
- })
- .build();
- return headerResult;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement