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();
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.onTouchEvent(ev);
if(zoomActive)
{
getChildAt(1).onTouchEvent(ev);
}
else
{
getChildAt(0).onTouchEvent(ev);
}
return true;
}
- , GestureDetector ACTION_UP:
Android: ,
, ? , onScaleEnd()?
EDIT:
: , false. Eclipse , , .