diff options
author | Romain Guy <romainguy@android.com> | 2009-05-24 18:40:45 -0700 |
---|---|---|
committer | Romain Guy <romainguy@android.com> | 2009-05-24 23:45:03 -0700 |
commit | 82f3495b146b267f3786997752cef25310176349 (patch) | |
tree | 1821c5b8731028212250ec07fe209a0804a0e53f /tests/sketch/src/com/android/gesture/example/GestureEntry.java | |
parent | d9a874a4cb8e82ae64c1698bd71ced8d87bbc5cd (diff) | |
download | frameworks_base-82f3495b146b267f3786997752cef25310176349.zip frameworks_base-82f3495b146b267f3786997752cef25310176349.tar.gz frameworks_base-82f3495b146b267f3786997752cef25310176349.tar.bz2 |
Cleanup Gestures API and make it easier to use in 3rd party apps. Also fix the events processing in the gestures overlay mechanism. Give better control of the various properties of the overlay through XML attributes.
Diffstat (limited to 'tests/sketch/src/com/android/gesture/example/GestureEntry.java')
-rw-r--r-- | tests/sketch/src/com/android/gesture/example/GestureEntry.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/sketch/src/com/android/gesture/example/GestureEntry.java b/tests/sketch/src/com/android/gesture/example/GestureEntry.java index bc2503c..3f86ed4 100644 --- a/tests/sketch/src/com/android/gesture/example/GestureEntry.java +++ b/tests/sketch/src/com/android/gesture/example/GestureEntry.java @@ -47,8 +47,9 @@ public class GestureEntry extends Activity { private static final String PARCEL_KEY = "gesture"; - static final String GESTURE_FILE_NAME = Environment.getExternalStorageDirectory().getAbsolutePath() - + File.separator + "demo_library.gestures"; + static final String GESTURE_FILE_NAME = + Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + + "demo_library.gestures"; private static final int DIALOG_NEW_ENTRY = 1; @@ -82,7 +83,7 @@ public class GestureEntry extends Activity { // correct the recognition result by adding the new example if (!mChangedByRecognizer) { mGestureLibrary.addGesture(parent.getSelectedItem().toString(), mGesturePad - .getCurrentGesture()); + .getGesture()); } else { mChangedByRecognizer = false; } @@ -99,7 +100,7 @@ public class GestureEntry extends Activity { mGesturePad.setBackgroundColor(Color.BLACK); mGesturePad.addOnGestureListener(new GestureOverlayView.OnGestureListener() { public void onGestureEnded(GestureOverlayView overlay, MotionEvent event) { - recognize(overlay.getCurrentGesture()); + recognize(overlay.getGesture()); } public void onGesture(GestureOverlayView overlay, MotionEvent event) { @@ -116,7 +117,7 @@ public class GestureEntry extends Activity { if (savedInstanceState != null) { Gesture gesture = (Gesture) savedInstanceState.getParcelable(PARCEL_KEY); if (gesture != null) { - mGesturePad.setCurrentGesture(gesture); + mGesturePad.setGesture(gesture); } } } @@ -133,7 +134,7 @@ public class GestureEntry extends Activity { .findViewById(R.id.gesturename_edit); String text = edittext.getText().toString().trim(); if (text.length() > 0) { - mGestureLibrary.addGesture(text, mGesturePad.getCurrentGesture()); + mGestureLibrary.addGesture(text, mGesturePad.getGesture()); } } }).setNegativeButton(R.string.newgesture_dialog_cancel, @@ -157,7 +158,7 @@ public class GestureEntry extends Activity { public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case NEW_ID: - if (mGesturePad.getCurrentGesture() != null) { + if (mGesturePad.getGesture() != null) { showDialog(DIALOG_NEW_ENTRY); } break; @@ -190,7 +191,7 @@ public class GestureEntry extends Activity { @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); - Gesture gesture = mGesturePad.getCurrentGesture(); + Gesture gesture = mGesturePad.getGesture(); if (gesture != null) { outState.putParcelable(PARCEL_KEY, gesture); } |