Skip to content
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

If content is not clickable . How can we close drawer while clicking content. I want both content not clickable and close drawer when content is clicked :D #40

Open
XeRrIc opened this issue Jan 16, 2018 · 5 comments

Comments

@XeRrIc
Copy link

XeRrIc commented Jan 16, 2018

No description provided.

@mccccccmike
Copy link

please help,i have the same issue

@skliba
Copy link

skliba commented Feb 19, 2018

@yarolegovich yeah, need the same behaviour implemented if possible. Would greately appreciate it.

To clarify, when the drawer is opened we don't want the content to fetch the clicks, we just want the click to close the drawer back. Like the normal navigation drawer behaviour.
Is that possible?

@surindersinghbindra
Copy link

surindersinghbindra commented Mar 1, 2018

add these lines to
newRoot.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { newRoot.closeMenu(); } return true; } });
https://github.com/yarolegovich/SlidingRootNav/blob/master/library/src/main/java/com/yarolegovich/slidingrootnav/SlidingRootNav.java
line number 191 and make
.withContentClickableWhenMenuOpened(false)

@riocallos
Copy link

Use this instead. The previous fix disabled the sliding gesture from the left side of the screen to open menu.

newRoot.setOnTouchListener(
new View.OnTouchListener() {
@OverRide public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
newRoot.closeMenu();
return true;
}
return false;
}
});

@ShanmugarajMuthukani
Copy link

Close side drawer when pressing out side
Added below line in MainActivity :

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
var slidingRootNav: SlidingRootNav = = SlidingRootNavBuilder(this)
.withToolbarMenuToggle(toolbar)
.withMenuOpened(false)
.withContentClickableWhenMenuOpened(false)
.withSavedState(savedInstanceState)
.withMenuLayout(R.layout.menu_left_drawer)
.inject()
}
override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
slidingRootNav!!.closeMenu() //
return super.dispatchTouchEvent(ev)
}

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

No branches or pull requests

6 participants