microsoftarchive / android-sliding-layer-lib

Highly customizable SlidingLayer as you have seen in Wunderlist
http://wunderlist.com
Apache License 2.0
932 stars 277 forks source link

add horizontalDrag attr to disable or enable the layer horizontal drag #91

Open TUBB opened 8 years ago

TUBB commented 8 years ago

So the SlidingLayer can include ViewPager.

elmateo487 commented 8 years ago

This will allow you to put a view pager up there, and it wont trigger swipe issues. So I guess I am confused by this. You want to be able to turn that ability on or off? Then just set the onTouchListener again

        vpPager.setOnTouchListener(new View.OnTouchListener() {

            @Override
            public boolean onTouch(final View v, final MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    getSlidingLayer().requestDisallowInterceptTouchEvent(true);
                }
                return false;
            }
        });
vincentsys commented 8 years ago

@elmateo487 I am not sure if I understand it the right way.

My layout looks like:

Sometimes the SlidingLayer consumes the touch events preventing the onStopTrackingTouch for the SeekBars to work.

Do I need to handle the ACTION_UP event somehow to solve this?

vincentsys commented 8 years ago

I've just tried tested it with this layout `<com.wunderlist.slidinglayer.SlidingLayer android:id="@+id/slidingLayer" android:layout_width="@dimen/layer_width" android:layout_height="match_parent">

    <LinearLayout
        android:id="@+id/slidingLayerLinLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/Vincent_Dark"
        android:orientation="vertical">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Test" />

    </LinearLayout>
</com.wunderlist.slidinglayer.SlidingLayer>`

Even if I set the touchlistener to the LinearLayout and the requestDisallowInterceptTouchEvent to the sliding-layer, I am still able to swipe to close the sliding-layer!?

`mLinLayout.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(final View v, final MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
                mSlidingLayer.requestDisallowInterceptTouchEvent(true);
            }
            return false;
        }
    });`