L - listener that will be called with gesture events/updates.@UiThread public abstract class MultiFingerGesture<L> extends BaseGesture<L>
context, listener| 构造器和说明 |
|---|
MultiFingerGesture(android.content.Context context,
PalmapGesturesManager gesturesManager) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected boolean |
analyzeEvent(android.view.MotionEvent motionEvent) |
protected boolean |
analyzeMovement() |
protected boolean |
canExecute(int invokedGestureType) |
float |
getCurrentSpan(int firstPointerIndex,
int secondPointerIndex)
Returns the current distance between the two pointers forming the
gesture in progress.
|
float |
getCurrentSpanX(int firstPointerIndex,
int secondPointerIndex)
Returns current X distance between pointers in pixels.
|
float |
getCurrentSpanY(int firstPointerIndex,
int secondPointerIndex)
Returns current Y distance between pointers in pixels.
|
android.graphics.PointF |
getFocalPoint()
Returns a center point of this gesture.
|
int |
getPointersCount()
Returns the number of active pointers.
|
float |
getPreviousSpan(int firstPointerIndex,
int secondPointerIndex)
Returns the previous distance between the two pointers forming the
gesture in progress.
|
float |
getPreviousSpanX(int firstPointerIndex,
int secondPointerIndex)
Returns previous X distance between pointers in pixels.
|
float |
getPreviousSpanY(int firstPointerIndex,
int secondPointerIndex)
Returns previous Y distance between pointers in pixels.
|
protected int |
getRequiredPointersCount() |
float |
getSpanThreshold()
Get minimum span between any pair of finger that is required to pass motion events to this detector.
|
protected boolean |
isSloppyGesture()
Check if we have a sloppy gesture.
|
protected void |
reset() |
void |
setSpanThreshold(float spanThreshold)
Set minimum span in pixels between any pair of finger that is required to pass motion events to this detector.
|
void |
setSpanThresholdResource(int spanThresholdDimen)
Set minimum span in dp between any pair of finger that is required to pass motion events to this detector.
|
void |
setSpanThresholdResource(java.lang.String spanThresholdDimen)
Set minimum span in dp between any pair of finger that is required to pass motion events to this detector.
|
getCurrentEvent, getGestureDuration, getPreviousEvent, isEnabled, onTouchEvent, removeListener, setEnabled, setListenerpublic MultiFingerGesture(android.content.Context context,
PalmapGesturesManager gesturesManager)
protected boolean analyzeEvent(android.view.MotionEvent motionEvent)
analyzeEvent 在类中 BaseGesture<L>protected int getRequiredPointersCount()
protected boolean analyzeMovement()
protected boolean isSloppyGesture()
Thanks to Almer Thie (code.almeros.com).
protected boolean canExecute(int invokedGestureType)
canExecute 在类中 BaseGesture<L>protected void reset()
public float getCurrentSpan(int firstPointerIndex,
int secondPointerIndex)
Pointers are sorted by the time they were placed on the screen until lifted up.
This means that index 0 will reflect the oldest added, still active pointer
and index (getPointersCount() - 1) will reflect the latest added, still active pointer.
The order of parameters is irrelevant.
firstPointerIndex - one of pointers indexessecondPointerIndex - one of pointers indexespointerIdListpublic float getPreviousSpan(int firstPointerIndex,
int secondPointerIndex)
Pointers are sorted by the time they were placed on the screen until lifted up.
This means that index 0 will reflect the oldest added, still active pointer
and index (getPointersCount() - 1) will reflect the latest added, still active pointer.
The order of parameters is irrelevant.
firstPointerIndex - one of pointers indexessecondPointerIndex - one of pointers indexespointerIdListpublic float getCurrentSpanX(int firstPointerIndex,
int secondPointerIndex)
Pointers are sorted by the time they were placed on the screen until lifted up.
This means that index 0 will reflect the oldest added, still active pointer
and index (getPointersCount() - 1) will reflect the latest added, still active pointer.
The order of parameters is irrelevant.
firstPointerIndex - one of pointers indexessecondPointerIndex - one of pointers indexespointerIdListpublic float getCurrentSpanY(int firstPointerIndex,
int secondPointerIndex)
Pointers are sorted by the time they were placed on the screen until lifted up.
This means that index 0 will reflect the oldest added, still active pointer
and index (getPointersCount() - 1) will reflect the latest added, still active pointer.
The order of parameters is irrelevant.
firstPointerIndex - one of pointers indexessecondPointerIndex - one of pointers indexespointerIdListpublic float getPreviousSpanX(int firstPointerIndex,
int secondPointerIndex)
Pointers are sorted by the time they were placed on the screen until lifted up.
This means that index 0 will reflect the oldest added, still active pointer
and index (getPointersCount() - 1) will reflect the latest added, still active pointer.
The order of parameters is irrelevant.
firstPointerIndex - one of pointers indexessecondPointerIndex - one of pointers indexespointerIdListpublic float getPreviousSpanY(int firstPointerIndex,
int secondPointerIndex)
Pointers are sorted by the time they were placed on the screen until lifted up.
This means that index 0 will reflect the oldest added, still active pointer
and index (getPointersCount() - 1) will reflect the latest added, still active pointer.
The order of parameters is irrelevant.
firstPointerIndex - one of pointers indexessecondPointerIndex - one of pointers indexespointerIdListpublic int getPointersCount()
public android.graphics.PointF getFocalPoint()
public float getSpanThreshold()
public void setSpanThreshold(float spanThreshold)
We encourage to set those values from dimens to accommodate for various screen sizes.
spanThreshold - minimum spanpublic void setSpanThresholdResource(@DimenRes
int spanThresholdDimen)
spanThresholdDimen - minimum spanpublic void setSpanThresholdResource(java.lang.String spanThresholdDimen)
spanThresholdDimen - minimum span