umano / AndroidSlidingUpPanel

This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.
http://umano.me
Apache License 2.0
9.5k stars 2.27k forks source link

OnTouch event handling while menu is scrollable #489

Closed changxiangzhong closed 9 years ago

changxiangzhong commented 9 years ago

Hi,

I want to express my appreciate of your work, this is really amazing project.

Issue description

I'm using a sliding-down menu(a menu located at the top of the screen) as the following screen indicates - the red area is the menu, the orange area is the main-body of the layout. The sliding menu contains a ListView. You can find two screen shots at the end.

Now the current situation is
  1. if a gesture is regarded as a fling, the SlidingUpPanelLayout would intercept the events without negotiating with child ListView
  2. If a gesture is regarded as a scroll, the red ListView could receive the events in onTouchEvent.
    My requirement is
  3. as long as the Red ListView is not having scrolled to the bottom, all the onTouch event should be handled by the red ListView.
  4. When the list is at the bottom,
    • All the scrolling-up/fling-up gesture should be handled by the SlidingUpPanelLayout(because the listView is already at its bottom-most)
    • Otherwise, the ListView handles. it.
      Up menu collapsed:

collapsed

Up menu expanded:

expanded

Thank you in advance.

changxiangzhong commented 9 years ago

Update:

I was wrong about the onFling & onScroll.

It is the ViewDragHelper::checkTouchSlop determines who to handle the onTouch event. When it's scrolled very slow, the checkTouchSlop method would regard it as a "touch slop" and will NOT intercept the event, so that the ListView will have the opportunity to scroll. When the scrolling is relatively fast, it will intercept the touch event.

tokudu commented 9 years ago

Work in progress. Dupe of https://github.com/umano/AndroidSlidingUpPanel/issues/116