oak.util
Class ScaleGestureDetector.SimpleOnScaleGestureListener

java.lang.Object
  extended by oak.util.ScaleGestureDetector.SimpleOnScaleGestureListener
All Implemented Interfaces:
ScaleGestureDetector.OnScaleGestureListener
Enclosing class:
ScaleGestureDetector

public static class ScaleGestureDetector.SimpleOnScaleGestureListener
extends Object
implements ScaleGestureDetector.OnScaleGestureListener

A convenience class to extend when you only want to listen for a subset of scaling-related events. This implements all methods in ScaleGestureDetector.OnScaleGestureListener but does nothing. ScaleGestureDetector.OnScaleGestureListener.onScale(ScaleGestureDetector) returns false so that a subclass can retrieve the accumulated scale factor in an overridden onScaleEnd. ScaleGestureDetector.OnScaleGestureListener.onScaleBegin(ScaleGestureDetector) returns true.


Constructor Summary
ScaleGestureDetector.SimpleOnScaleGestureListener()
           
 
Method Summary
 boolean onScale(ScaleGestureDetector detector)
          Responds to scaling events for a gesture in progress.
 boolean onScaleBegin(ScaleGestureDetector detector)
          Responds to the beginning of a scaling gesture.
 void onScaleEnd(ScaleGestureDetector detector)
          Responds to the end of a scale gesture.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScaleGestureDetector.SimpleOnScaleGestureListener

public ScaleGestureDetector.SimpleOnScaleGestureListener()
Method Detail

onScale

public boolean onScale(ScaleGestureDetector detector)
Description copied from interface: ScaleGestureDetector.OnScaleGestureListener
Responds to scaling events for a gesture in progress. Reported by pointer motion.

Specified by:
onScale in interface ScaleGestureDetector.OnScaleGestureListener
Parameters:
detector - The detector reporting the event - use this to retrieve extended info about event state.
Returns:
Whether or not the detector should consider this event as handled. If an event was not handled, the detector will continue to accumulate movement until an event is handled. This can be useful if an application, for example, only wants to update scaling factors if the change is greater than 0.01.

onScaleBegin

public boolean onScaleBegin(ScaleGestureDetector detector)
Description copied from interface: ScaleGestureDetector.OnScaleGestureListener
Responds to the beginning of a scaling gesture. Reported by new pointers going down.

Specified by:
onScaleBegin in interface ScaleGestureDetector.OnScaleGestureListener
Parameters:
detector - The detector reporting the event - use this to retrieve extended info about event state.
Returns:
Whether or not the detector should continue recognizing this gesture. For example, if a gesture is beginning with a focal point outside of a region where it makes sense, onScaleBegin() may return false to ignore the rest of the gesture.

onScaleEnd

public void onScaleEnd(ScaleGestureDetector detector)
Description copied from interface: ScaleGestureDetector.OnScaleGestureListener
Responds to the end of a scale gesture. Reported by existing pointers going up. Once a scale has ended, ScaleGestureDetector.getFocusX() and ScaleGestureDetector.getFocusY() will return the location of the pointer remaining on the screen.

Specified by:
onScaleEnd in interface ScaleGestureDetector.OnScaleGestureListener
Parameters:
detector - The detector reporting the event - use this to retrieve extended info about event state.


Copyright © 2011-2014. All Rights Reserved.