AndroidTagGroup icon indicating copy to clipboard operation
AndroidTagGroup copied to clipboard

Scrolling Tag Touch Issue

Open cmrlp opened this issue 8 years ago • 3 comments

If a tag is clicked, while within a scroll view, and then that scroll view is scrolled, it will remain highlighted.

For example: if I am scrolling, and then I scroll by touching a tag and flicking upwards or downwards, then the tag will remain highlighted afterI have removed my finger.

cmrlp avatar Aug 21 '16 05:08 cmrlp

Same Issue I also getting.

coderaviverma avatar Aug 23 '16 14:08 coderaviverma

I find same issue now I write TagView onTouchEvent like this:

        @Override
        public boolean onTouchEvent(MotionEvent event) {
            if (mState == STATE_INPUT) {
                // The INPUT tag doesn't change background color on the touch event.
                return super.onTouchEvent(event);
            }

            switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN: {
                    getDrawingRect(mOutRect);
                    isPressed = true;
                    invalidatePaint();
-                    invalidate();
                    break;
                }
                case MotionEvent.ACTION_MOVE: {
                    if (!mOutRect.contains((int) event.getX(), (int) event.getY())) {
                        isPressed = false;
                        invalidatePaint();
-                        invalidate();
                    }
                    break;
                }
                case MotionEvent.ACTION_UP: {
                    isPressed = false;
                    invalidatePaint();
-                    invalidate();
+                    postInvalidate();
                    break;
                }
            }

kHRYSTAL avatar Nov 07 '16 06:11 kHRYSTAL

I have solved this issue. just add: case MotionEvent.ACTION_CANCEL: { // same as MotionEvent.ACTION_UP }

The reason is: When TagGroup within ScrollView, the TagView's MotionEvent.ACTION_MOVE and MotionEvent.ACTION_UP will be interrupted, then it's MotionEvent.ACTION_CANCEL will be Called, so we just need copy the code of MotionEvent.ACTION_UP to MotionEvent.ACTION_CANCEL.

This has solved my problem, hope worked for you too.

wpq2014 avatar Jul 19 '17 09:07 wpq2014