CustomView icon indicating copy to clipboard operation
CustomView copied to clipboard

the issue of SwipeMenu hard swipe and twitch swipe

Open SnowWindSaveYou opened this issue 7 years ago • 0 comments

Hello, i use your SwipeMenu in my school homework, it works well when i test on simulator, But when i use the real device to test it became very hard to use, it always twitch between open and close when i try to swipe it.

While, i discover it's just some numeric issue, This component can works well again after few adjustment in smoothScrollTo() use duration time 500 rather than 100 make in onTouchEvent() the condition of open action use if(getScrollX() >= getChildAt(1).getMeasuredWidth() / 10)

Also add one more condition of ACTION_CANCEL

case MotionEvent.ACTION_CANCEL:
                if (getScrollX() >= getChildAt(1).getMeasuredWidth() / 10) {
                    Log.d(TAG, "onTouchEvent: 1");
                    haveShowRight = true;
                    mSwipeMenu = this;
                    moveTo(getChildAt(1).getMeasuredWidth());
                }

Those measures can make the the component more sensitive to user actions and makes control more smoothly.

(学校作业对一个开源项目做出小贡献,想起年初踩的这个坑过来回复下,但是时间有点久远可能写的不怎么到位 = =|||,打开自己代码都不记得自己改了啥 )

SnowWindSaveYou avatar Oct 21 '18 11:10 SnowWindSaveYou