Method ScaleGestureDetector.OnScaleGestureListener.onScaleEnd () misses

Update: I realized what was going on. See Comments.

I am trying to write a ViewSwitcher that passes all the gestures to its first child until it accepts a large-scale gesture; he then passes them on to the second child until that child is completely deleted when he returns to the first child. My subclass has a ScaleGestureDetector, and I made a very simple listener:

    protected class OnScaleModeSwitcher implements ScaleGestureDetector.OnScaleGestureListener
    {
        protected PageFlipSwitcher owner;

        public OnScaleModeSwitcher(PageFlipSwitcher newOwner)
        {
            super();
            owner = newOwner;
        }

        @Override
        public boolean onScale(ScaleGestureDetector detector) {
            return false;
        }

        @Override
        public boolean onScaleBegin(ScaleGestureDetector detector) {
            owner.onScaleBegin();
//returning false here causes the rest of the gesture to be ignored.
            return false;
        }

        @Override
        public void onScaleEnd(ScaleGestureDetector detector) {
            owner.onScaleEnd();
        }
    }

As you can see, all he does is take a reference to the owner object during construction, and then pass some events to methods in the owner class. However, the onScaleEnd () code is not reached by the code.

I know that onInterceptTouchEvent can be a little risky; I carefully followed the suggestions in the Android docs, and

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev)
    {
        onTouchEvent(ev);
        return false;
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev)
    {
//mode is the name of the ScaleGestureDetector
        mode.onTouchEvent(ev);

//this code just passes events to the children
//it seems to work OK
        if(zoomActive)
        {
            //ZoomSwitcher
            getChildAt(1).onTouchEvent(ev);
        }
        else
        {
            //Gallery
            getChildAt(0).onTouchEvent(ev);
        }
        return true;
    }

- , GestureDetector ACTION_UP:

Android: ,

, ? , onScaleEnd()?

EDIT:

: , false. Eclipse , , .

+5
1

ScaleGestureDetector, false onScaleBegin (...), . , MotionEvent, false, MotionEvents ACTION_UP, reset.

+7

All Articles