summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2009-06-16 15:53:27 -0700
committerRomain Guy <romainguy@android.com>2009-06-16 15:53:27 -0700
commitb973eef289ee0315dbae147eccb1915d3ed08f43 (patch)
treeb30d57b468b976cc434c38c0f203c3475d2efa1c
parenta6061e043cb6056c303206c2c9870ae3758861f1 (diff)
downloadframeworks_base-b973eef289ee0315dbae147eccb1915d3ed08f43.zip
frameworks_base-b973eef289ee0315dbae147eccb1915d3ed08f43.tar.gz
frameworks_base-b973eef289ee0315dbae147eccb1915d3ed08f43.tar.bz2
Fixes #1899284 and #1899287. Give applications more control over the gesture's path.
This change adds new APIs to control the gesture's path by deciding whether the path should be drawn and by getting the ability to get the Path itself and draw it differently.
-rwxr-xr-xcore/java/android/gesture/GestureOverlayView.java36
1 files changed, 27 insertions, 9 deletions
diff --git a/core/java/android/gesture/GestureOverlayView.java b/core/java/android/gesture/GestureOverlayView.java
index fd6d850..14323b8 100755
--- a/core/java/android/gesture/GestureOverlayView.java
+++ b/core/java/android/gesture/GestureOverlayView.java
@@ -84,6 +84,7 @@ public class GestureOverlayView extends FrameLayout {
private final Rect mInvalidRect = new Rect();
private final Path mPath = new Path();
+ private boolean mGestureVisible;
private float mX;
private float mY;
@@ -274,14 +275,6 @@ public class GestureOverlayView extends FrameLayout {
return mCurrentGesture;
}
- public long getFadeOffset() {
- return mFadeOffset;
- }
-
- public void setFadeOffset(long fadeOffset) {
- mFadeOffset = fadeOffset;
- }
-
public void setGesture(Gesture gesture) {
if (mCurrentGesture != null) {
clear(false);
@@ -304,6 +297,31 @@ public class GestureOverlayView extends FrameLayout {
invalidate();
}
+ public Path getGesturePath() {
+ return mPath;
+ }
+
+ public Path getGesturePath(Path path) {
+ path.set(mPath);
+ return path;
+ }
+
+ public boolean isGestureVisible() {
+ return mGestureVisible;
+ }
+
+ public void setGestureVisible(boolean visible) {
+ mGestureVisible = visible;
+ }
+
+ public long getFadeOffset() {
+ return mFadeOffset;
+ }
+
+ public void setFadeOffset(long fadeOffset) {
+ mFadeOffset = fadeOffset;
+ }
+
public void addOnGestureListener(OnGestureListener listener) {
mOnGestureListeners.add(listener);
}
@@ -372,7 +390,7 @@ public class GestureOverlayView extends FrameLayout {
public void draw(Canvas canvas) {
super.draw(canvas);
- if (mCurrentGesture != null) {
+ if (mCurrentGesture != null && mGestureVisible) {
canvas.drawPath(mPath, mGesturePaint);
}
}