Add method to TouchPointManager to check for valid point.
When a point is initialized, its value is (0,0), since it is highly
unlikely a user will touch at that exact point, we define a valid point
as any point that is not (0,0).
Bug: 17124195
Change-Id: Iba3adfa862f262ac2b753815594b54441d997320
diff --git a/src/com/android/contacts/common/interactions/TouchPointManager.java b/src/com/android/contacts/common/interactions/TouchPointManager.java
index a6cc1b8..4c38e22 100644
--- a/src/com/android/contacts/common/interactions/TouchPointManager.java
+++ b/src/com/android/contacts/common/interactions/TouchPointManager.java
@@ -31,4 +31,16 @@
public void setPoint(int x, int y) {
mPoint.set(x, y);
}
+
+ /**
+ * When a point is initialized, its value is (0,0). Since it is highly unlikely a user will
+ * touch at that exact point, if the point in TouchPointManager is (0,0), it is safe to assume
+ * that the TouchPointManager has not yet collected a touch.
+ *
+ * @return True if there is a valid point saved. Define a valid point as any point that is
+ * not (0,0).
+ */
+ public boolean hasValidPoint() {
+ return mPoint.x != 0 || mPoint.y != 0;
+ }
}