pedrovgs / DraggablePanel

Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube graphic component.
Apache License 2.0
2.99k stars 605 forks source link

Question about touch to another view #69

Closed 0xcra5hs closed 9 years ago

0xcra5hs commented 9 years ago

Hi pedrovgs, I have the question about touch to another view.

I using Draggable View. In fragment, i have a seekbar. My problem is : "When i seek to seekbar, draggable view is scaled too".

Plz, help me. Thank u so much.

ppamorim commented 9 years ago

You need to disable the touch listener of the DraggablePanel. I think this library has a method to do that.

0xcra5hs commented 9 years ago

sorry, i can't find that method in DraggableView

0xcra5hs commented 9 years ago

can you make snippet code for me, thanks u

0xcra5hs commented 9 years ago

thanks for support, i do solved problem.

In draggable view, declare : private boolean isDisableDraggableView = false;

@Override public boolean onInterceptTouchEvent(MotionEvent ev) { if(isDisableDraggableView) return false; // -> add to this if (!isEnabled()) { return false; } }

@Override public boolean onTouchEvent(MotionEvent ev) { if(isDisableDraggableView) return false; // -> add to this int actionMasked = MotionEventCompat.getActionMasked(ev); }

and in my fragment, solved:

skProgress.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int action = event.getAction(); switch (action){ case MotionEvent.ACTION_DOWN: draggableView.setIsDisableDraggableView(true); draggableView.setEnable(false); break; case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: draggableView.setIsDisableDraggableView(false); draggableView.setEnable(true); break; } return false; } });

Tkz u and close my issue :)

pedrovgs commented 9 years ago

@DuongNTdev I've seen this patch in other issue and I've already asked you about a pull request so I'm going to close this one. Can you review your code and send me a PR with the changes?

Thanks!