diff --git a/api/current.xml b/api/current.xml
index 80d6702b6e9c2..15506313fedb5 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -50084,6 +50084,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
mOnGesturePerformedListeners =
new ArrayList();
+ // TODO: Make this a list of WeakReferences
+ private final ArrayList mOnGesturingListeners =
+ new ArrayList();
private boolean mHandleGestureActions;
@@ -319,6 +322,18 @@ public class GestureOverlayView extends FrameLayout {
mHandleGestureActions = false;
}
+ public void addOnGesturingListener(OnGesturingListener listener) {
+ mOnGesturingListeners.add(listener);
+ }
+
+ public void removeOnGesturingListener(OnGesturingListener listener) {
+ mOnGesturingListeners.remove(listener);
+ }
+
+ public void removeAllOnGesturingListeners() {
+ mOnGesturingListeners.clear();
+ }
+
public boolean isGesturing() {
return mIsGesturing;
}
@@ -401,7 +416,7 @@ public class GestureOverlayView extends FrameLayout {
MotionEvent.ACTION_CANCEL, 0.0f, 0.0f, 0);
final ArrayList listeners = mOnGestureListeners;
- final int count = listeners.size();
+ int count = listeners.size();
for (int i = 0; i < count; i++) {
listeners.get(i).onGestureCancelled(this, event);
}
@@ -411,6 +426,12 @@ public class GestureOverlayView extends FrameLayout {
clear(false);
mIsGesturing = false;
mStrokeBuffer.clear();
+
+ final ArrayList otherListeners = mOnGesturingListeners;
+ count = otherListeners.size();
+ for (int i = 0; i < count; i++) {
+ otherListeners.get(i).onGesturingEnded(this);
+ }
}
@Override
@@ -577,6 +598,12 @@ public class GestureOverlayView extends FrameLayout {
mIsGesturing = true;
setCurrentColor(mCertainGestureColor);
+
+ final ArrayList listeners = mOnGesturingListeners;
+ int count = listeners.size();
+ for (int i = 0; i < count; i++) {
+ listeners.get(i).onGesturingStarted(this);
+ }
}
}
}
@@ -621,6 +648,12 @@ public class GestureOverlayView extends FrameLayout {
mStrokeBuffer.clear();
mIsGesturing = false;
+
+ final ArrayList listeners = mOnGesturingListeners;
+ int count = listeners.size();
+ for (int i = 0; i < count; i++) {
+ listeners.get(i).onGesturingEnded(this);
+ }
}
private void cancelGesture(MotionEvent event) {
@@ -635,12 +668,10 @@ public class GestureOverlayView extends FrameLayout {
}
private void fireOnGesturePerformed() {
- final ArrayList actionListeners =
- mOnGesturePerformedListeners;
+ final ArrayList actionListeners = mOnGesturePerformedListeners;
final int count = actionListeners.size();
for (int i = 0; i < count; i++) {
- actionListeners.get(i).onGesturePerformed(GestureOverlayView.this,
- mCurrentGesture);
+ actionListeners.get(i).onGesturePerformed(GestureOverlayView.this, mCurrentGesture);
}
}
@@ -683,6 +714,12 @@ public class GestureOverlayView extends FrameLayout {
}
}
+ public static interface OnGesturingListener {
+ void onGesturingStarted(GestureOverlayView overlay);
+
+ void onGesturingEnded(GestureOverlayView overlay);
+ }
+
public static interface OnGestureListener {
void onGestureStarted(GestureOverlayView overlay, MotionEvent event);