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

Add option to open/close backdrop via scrolling #10

Open
fonix232 opened this issue Feb 27, 2019 · 2 comments
Open

Add option to open/close backdrop via scrolling #10

fonix232 opened this issue Feb 27, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@fonix232
Copy link

While I realize that this is kind of antipattern (since Google said so), I think a great number of us would use a "pull to open" and "push to close" gesture bundled with NestedScrollView as content.

Right now my app uses a CollapsingToolbarLayout to achieve the same effect, but it's not the best as of now. I'd like to transition to a Backdrop implementation as it would fit my use case better.

The specific features I'm looking for:

  • By default, on first load, look like a regular toolbar/backdrop combo
  • On scroll down (pull down gesture), open backdrop
  • On scroll up, close backdrop (behaviour controlled with flags similar to CollapsingToolbarLayout)
  • On scroll up further, backdrop+toolbar behaviour controlled with flags similar to CollapsingToolbarLayout (especially the scroll and enterAlwaysCollapsed behaviours)

With these in mind, I'm thinking of the following scenarios:

  • User is on top of scrolled content, scrolls up (i.e. pulls down). The backdrop is opened fully (snap behaviour of CollapsingToolbarLayout)
  • User is on opened backdrop, scrolls down (i.e. pulls up). The backdrop is closed, previous state is restored
  • User is on top of scrolled content, scrolls down. Depending on the scroll flag, the visible Toolbar part of the backdrop is either hidden (scroll behaviour of Toolbar) or sticks to the top (default behaviour of the toolbar)
  • User is in middle of content, and scrolls up. Depending on scroll flag, the Toolbar either becomes visible (enterAlwaysCollapsed behaviour of Toolbar), or stays hidden (scroll behaviour of toolbar)
  • User is in middle of content, and Toolbar is visible. User pulls down Toolbar. The backdrop opens fully, but scroll state of content is retained
@pedromassango pedromassango added the enhancement New feature or request label Feb 27, 2019
@fonix232
Copy link
Author

@pedromassango how hard do you think this would be to implement? I've been looking into possible solutions (mainly looking at SwipeRefreshLayout and maybe possible behaviours of AppBarLayout), however the overscroll event seems to be hard to catch in a manner it is synchronizable with the expansion of the backdrop itself.

@clevermatem
Copy link

it's not recommended:
" Don't use the swipe gesture on the front layer to reveal the back layer"
because backlayout and frontlayout can both contain scrollviews:
https://material.io/components/backdrop#behavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants