关于frameworks下的NumberPicker.java中快速点击△&▽时消失的BUG

先看下我们测试人员提的bug票:

[MR1][Settings]The up&down icon(△&▽) disappear in the "Set date/time" screen

Change-Id: Ia5e914cd905d27baeccfa7d30b9f6eac9e00b041
TracID: 565
DESC: Press the up&down icon(△&▽) quickly (Use two fingers),The up&down icon(△&▽) disappear.
Analysis: Press up&down icon(△&▽) have a time interval,so you shouldn't be interrupt.
Solution: remove qbja2/frameworks/base/core/java/android/widget/NumberPicker.java "mShowInputControlsAnimator.cancel();"
NeedToVerify: 1
NeedToVerify: 1
CleanBuild:0

修改代码如下:















@Override
    public boolean onInterceptTouchEvent(MotionEvent event) {
        if (!isEnabled() || !mFlingable) {
            return false;
        }
        switch (event.getActionMasked()) {
            case MotionEvent.ACTION_DOWN:
                mLastMotionEventY = mLastDownEventY = event.getY();
                removeAllCallbacks();
                //mShowInputControlsAnimator.cancel(); 这里注释掉就解决了
                mBeginEditOnUpEvent = false;
                mAdjustScrollerOnUpEvent = true;
                if (mDrawSelectorWheel) {
                    boolean scrollersFinished = mFlingScroller.isFinished()
                            && mAdjustScroller.isFinished();
                    if (!scrollersFinished) {
                        mFlingScroller.forceFinished(true);
                        mAdjustScroller.forceFinished(true);
                        onScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
                    }
                    mBeginEditOnUpEvent = scrollersFinished;
                    mAdjustScrollerOnUpEvent = true;
                    hideInputControls();
                    return true;
                }
                if (isEventInViewHitRect(event, mInputText)
                        || (!mIncrementButton.isShown()
                                && isEventInViewHitRect(event, mIncrementButton))
                        || (!mDecrementButton.isShown()
                                && isEventInViewHitRect(event, mDecrementButton))) {
                    mAdjustScrollerOnUpEvent = false;
                    setDrawSelectorWheel(true);
                    hideInputControls();
                    return true;
                }
                break;
            case MotionEvent.ACTION_MOVE:
                float currentMoveY = event.getY();
                int deltaDownY = (int) Math.abs(currentMoveY - mLastDownEventY);
                if (deltaDownY > mTouchSlop) {
                    mBeginEditOnUpEvent = false;
                    onScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);
                    setDrawSelectorWheel(true);
                    hideInputControls();
                    return true;
                }
                break;
        }
        return false;
    }

































































































你可能感兴趣的:(关于frameworks下的NumberPicker.java中快速点击△&▽时消失的BUG)