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
Support for CoordinatorLayout added #96
Conversation
…ollBar class. This way, the MaterialScrollBar can keep it's package internal visibility and still people can use a public custom interface for both scroll bars * added a setEnabled function to disable the need to force a RecyclerView to be attached to the scroll bar
* don't consume the touch if setDraggableFromAnywhere is false + the wrong region is touched in ondown touch event
I'll take a look. This may be included in 12.5.0 so I'll hold off on releasing the version on github until I decide on that. |
Can you give me an example layout file to test out how this works? I'm having a hard time understanding when you'd need a scroll bar as a direct child of a coordinator. |
I can give you an example tomorrow.... But you need it as direct child if you want to attach it to some custom behaviour. Like pushing the recycler view and the scroll bar down when a top view expands or pushing them up if a bottom view appears. And you can't put the recycler view inside a relative layout with the scroll bar because then the coordinator can't react with the default scrolling view behaviour to scrolls in the recycler view. And additionally for full coordinator layout support we probably most of the time need some custom behaviour for the scroll bar... because now scrolling with the scroll bar does not have the scrolling effects that scrolling with the fast scroller have (showing and hiding views for example) |
Do you really need an example? I've not yet written any custom behaviour. But in my case I have a search bar on top and a T9 keyboard on bottom. both views show up on scroll up and hide on scroll down, so the recyclerviews bounds change accordingly. The same should happen with the scrollbar.... |
I haven't really used coordinator layouts that much so it may just be that I don't know what I'm doing, but I can't get the bar to right-align without making it the child of a relative/constraint layout. |
Here's the usage example with the scroll bar on the right:
Those two lines are important to place the scroll bar inside a
|
I'm going to edit this a bit and integrate it. Thanks for the help! |
After looking at everything it looks like we made need to do a larger refactor in order to make things work elegantly. When I get some time (hopefully this month) I'll get to work on that. The problem is |
Wait, actually, I take most of that back. Why do we even need to know about the parent in the first place? All of the subviews are being added to the bar itself which is a relative layout. It should be parent agnostic. |
Sadly the
MaterialScrollBar
sets up the LayoutParams of it's sub views before the it's layed out, this means, I can't check if theMaterialScrollBar
is placed in aCoordinatorLayout
. Therefore I had to add a xml attributemsb_placedInCoordinator
. Based on this, theMaterialScrollBar
can createRelativeLayout
params orCoordinatorLayout
params...