mikepenz / MaterialDrawer

The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.
https://mikepenz.dev
Apache License 2.0
11.67k stars 2.05k forks source link

Mixed NavigationDrawerItem and PrimaryDrawerItem and onDrawerItemClickListener #2672

Closed francescogatto closed 3 years ago

francescogatto commented 3 years ago

Hi!

I'm having some troubles with onDrawerItemClickListener and Navigation Components. It works nice with NavigationDrawerItems, but what if i need to have a callback on a simple PrimaryDrawerItem? I tried to use slider?.onDrawerItemClickListener = { v, drawerItem, position -> with slider.setupWithNavController(findNavController(R.id.nav_host_fragment)) , but the last one disable the first one.

Thanks!

[ ] Used library version 8.1.7 [ ] Used support library version androidx [ ] Used gradle build tools version [ ] Used tooling / Android Studio version 4.1

francescogatto commented 3 years ago

I found a solution, i changed the method to accept a "FallBack" onDrawerItemClickListener.. like this: slider.setupWithNavController(findNavController(R.id.nav_host_fragment), fallBackListener!!)

mikepenz commented 3 years ago

good idea. would you like to open a PR with this improvement to the project?

francescogatto commented 3 years ago

Sure!

mikepenz commented 3 years ago

Closing this ticket for inactivity, that being said, we'd still love to improve this behavior.

francescogatto commented 3 years ago

Sorry for the late, i'm working on this and soon a pull request!

francescogatto commented 3 years ago

@mikepenz Pull request sent