diff options
author | Romain Guy <romainguy@android.com> | 2009-05-21 16:23:21 -0700 |
---|---|---|
committer | Romain Guy <romainguy@android.com> | 2009-05-21 18:12:56 -0700 |
commit | db567c390bd56c05614eaa83c02dbb99f97ad9cc (patch) | |
tree | 86399406ca7a53c3d902b3863bf7a944cb7c5c3f /tests/sketch/src/com/android/gesture/example | |
parent | 384bfa270cdcb5dc3bc9ec396b783e25eb2d9b4d (diff) | |
download | frameworks_base-db567c390bd56c05614eaa83c02dbb99f97ad9cc.zip frameworks_base-db567c390bd56c05614eaa83c02dbb99f97ad9cc.tar.gz frameworks_base-db567c390bd56c05614eaa83c02dbb99f97ad9cc.tar.bz2 |
Move the Gestures API to the framework in android.gesture.
Diffstat (limited to 'tests/sketch/src/com/android/gesture/example')
3 files changed, 28 insertions, 30 deletions
diff --git a/tests/sketch/src/com/android/gesture/example/ContactListGestureOverlay.java b/tests/sketch/src/com/android/gesture/example/ContactListGestureOverlay.java index 6eb2f23..eda4224 100644 --- a/tests/sketch/src/com/android/gesture/example/ContactListGestureOverlay.java +++ b/tests/sketch/src/com/android/gesture/example/ContactListGestureOverlay.java @@ -30,12 +30,11 @@ import android.view.Window; import android.widget.AdapterView; import android.widget.ListView; -import com.android.gesture.Gesture; -import com.android.gesture.GestureActionListener; -import com.android.gesture.GestureOverlay; -import com.android.gesture.LetterRecognizer; -import com.android.gesture.Prediction; -import com.android.gesture.TouchThroughGesturing; +import android.gesture.Gesture; +import android.gesture.GestureOverlayView; +import android.gesture.LetterRecognizer; +import android.gesture.Prediction; +import android.gesture.TouchThroughGestureListener; import java.util.ArrayList; @@ -52,7 +51,7 @@ public class ContactListGestureOverlay extends Activity { private ContactAdapter mContactAdapter; - private TouchThroughGesturing mGestureProcessor; + private TouchThroughGestureListener mGestureProcessor; private LetterRecognizer mRecognizer; @@ -67,7 +66,7 @@ public class ContactListGestureOverlay extends Activity { setProgressBarIndeterminateVisibility(true); // create a letter recognizer - mRecognizer = LetterRecognizer.getLetterRecognizer(this, LetterRecognizer.LATIN_LOWERCASE); + mRecognizer = LetterRecognizer.getLetterRecognizer(this, LetterRecognizer.RECOGNIZER_LATIN_LOWERCASE); // load the contact list mContactList = (ListView) findViewById(R.id.list); @@ -95,11 +94,11 @@ public class ContactListGestureOverlay extends Activity { setProgressBarIndeterminateVisibility(false); // add a gesture overlay on top of the ListView - GestureOverlay overlay = new GestureOverlay(this); - mGestureProcessor = new TouchThroughGesturing(mContactList); - mGestureProcessor.setGestureType(TouchThroughGesturing.MULTIPLE_STROKE); - mGestureProcessor.addGestureActionListener(new GestureActionListener() { - public void onGesturePerformed(GestureOverlay overlay, Gesture gesture) { + GestureOverlayView overlay = new GestureOverlayView(this); + mGestureProcessor = new TouchThroughGestureListener(mContactList); + mGestureProcessor.setGestureType(TouchThroughGestureListener.MULTIPLE_STROKE); + mGestureProcessor.addOnGestureActionListener(new TouchThroughGestureListener.OnGesturePerformedListener() { + public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) { ArrayList<Prediction> predictions = mRecognizer.recognize(gesture); if (!predictions.isEmpty()) { Log.v(LOGTAG, "1st Prediction : " + predictions.get(0).name); @@ -112,7 +111,7 @@ public class ContactListGestureOverlay extends Activity { } } }); - overlay.addGestureListener(mGestureProcessor); + overlay.addOnGestureListener(mGestureProcessor); ViewGroup.LayoutParams params = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT); this.addContentView(overlay, params); diff --git a/tests/sketch/src/com/android/gesture/example/GestureEntry.java b/tests/sketch/src/com/android/gesture/example/GestureEntry.java index 53ba481..200f89f 100644 --- a/tests/sketch/src/com/android/gesture/example/GestureEntry.java +++ b/tests/sketch/src/com/android/gesture/example/GestureEntry.java @@ -34,12 +34,11 @@ import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.Spinner; import android.widget.AdapterView.OnItemSelectedListener; +import android.gesture.Gesture; -import com.android.gesture.Gesture; -import com.android.gesture.GestureLibrary; -import com.android.gesture.GestureListener; -import com.android.gesture.GestureOverlay; -import com.android.gesture.Prediction; +import android.gesture.GestureLibrary; +import android.gesture.GestureOverlayView; +import android.gesture.Prediction; import java.io.File; import java.util.ArrayList; @@ -57,7 +56,7 @@ public class GestureEntry extends Activity { private static final int VIEW_ID = Menu.FIRST + 1; - private GestureOverlay mGesturePad; + private GestureOverlayView mGesturePad; private Spinner mRecognitionResult; @@ -96,17 +95,17 @@ public class GestureEntry extends Activity { }); // create the area for drawing a gesture - mGesturePad = (GestureOverlay) findViewById(R.id.drawingpad); + mGesturePad = (GestureOverlayView) findViewById(R.id.drawingpad); mGesturePad.setBackgroundColor(Color.BLACK); - mGesturePad.addGestureListener(new GestureListener() { - public void onFinishGesture(GestureOverlay overlay, MotionEvent event) { + mGesturePad.addOnGestureListener(new GestureOverlayView.OnGestureListener() { + public void onGestureEnded(GestureOverlayView overlay, MotionEvent event) { recognize(overlay.getCurrentGesture()); } - public void onGesture(GestureOverlay overlay, MotionEvent event) { + public void onGesture(GestureOverlayView overlay, MotionEvent event) { } - public void onStartGesture(GestureOverlay overlay, MotionEvent event) { + public void onGestureStarted(GestureOverlayView overlay, MotionEvent event) { overlay.clear(false); } }); diff --git a/tests/sketch/src/com/android/gesture/example/GestureLibViewer.java b/tests/sketch/src/com/android/gesture/example/GestureLibViewer.java index ca54110..aa07e7b 100755 --- a/tests/sketch/src/com/android/gesture/example/GestureLibViewer.java +++ b/tests/sketch/src/com/android/gesture/example/GestureLibViewer.java @@ -26,10 +26,10 @@ import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.Spinner; import android.widget.AdapterView.OnItemSelectedListener; +import android.gesture.Gesture; -import com.android.gesture.Gesture; -import com.android.gesture.GestureLibrary; -import com.android.gesture.GestureOverlay; +import android.gesture.GestureLibrary; +import android.gesture.GestureOverlayView; import java.util.ArrayList; import java.util.Collections; @@ -41,7 +41,7 @@ import java.util.Collections; public class GestureLibViewer extends Activity { - private GestureOverlay mGesturePad; + private GestureOverlayView mGesturePad; private Spinner mGestureCategory; @@ -90,7 +90,7 @@ public class GestureLibViewer extends Activity { setContentView(R.layout.gestureviewer); // create the area for drawing a gesture - mGesturePad = (GestureOverlay) findViewById(R.id.drawingpad); + mGesturePad = (GestureOverlayView) findViewById(R.id.drawingpad); mGesturePad.setEnabled(false); // init the gesture library |