asdsolutions-os / duo-navigation-drawer

A flexible, easy to use, unique drawer library for your Android project.
http://psdcompany.nl/
Apache License 2.0
1.1k stars 191 forks source link

how to detect when duo-navigation-drawer is opened (listener) ? #31

Closed sbouiachref closed 5 years ago

sbouiachref commented 5 years ago

anyone have a response pls

potalexander commented 5 years ago

You can set your own drawerListener to the drawerLayout: drawerLayout.setDrawerListener(drawerToggle);

sbouiachref commented 5 years ago

I dont understand, can you explain to me how can I add this listener !! . also have you an example using this library ? Thanks

potalexander commented 5 years ago

Copied from the Android documentation:

drawerLayout.setDrawerListener(new DrawerLayout.DrawerListener() {
    @Override
    public void onDrawerSlide(View drawerView, float slideOffset) {
        // Respond when the drawer's position changes
    }

    @Override
    public void onDrawerOpened(View drawerView) {
        // Respond when the drawer is opened
    }

    @Override
    public void onDrawerClosed(View drawerView) {
        // Respond when the drawer is closed
    }

    @Override
    public void onDrawerStateChanged(int newState) {
        // Respond when the drawer motion state changes
    }
});

More information regarding the DrawerListener: https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.DrawerListener