Skip to content
This repository has been archived by the owner on Feb 20, 2021. It is now read-only.

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TUBB
Copy link

@TUBB TUBB commented Dec 17, 2015

So the SlidingLayer can include ViewPager.

@elmateo487
Copy link

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
Copy link

vincentsys commented Jul 7, 2016

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

My layout looks like:

  • SlidingLayer
    • Linearlayout
      • VerticalSeekBar

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
Copy link

vincentsys commented Jul 8, 2016

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;
        }
    });`

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants