diff options
| author | 2010-07-01 16:41:24 -0700 | |
|---|---|---|
| committer | 2010-07-01 16:41:24 -0700 | |
| commit | f60cf818896f2eef579c11f07bfdb9727be287a1 (patch) | |
| tree | 80c6767e794dd5d6675163258ae7004c24d54535 | |
| parent | 60b0c1dada455de304834a6d62ec0231da4c7b6c (diff) | |
Improve multitouch support so pointers other than 0 can change colors.
Change-Id: I4f9f71f70306cc4a3b11906ae47a5fa2e305fc3f
| -rw-r--r-- | libs/rs/java/Fountain/src/com/android/fountain/FountainView.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libs/rs/java/Fountain/src/com/android/fountain/FountainView.java b/libs/rs/java/Fountain/src/com/android/fountain/FountainView.java index 6082c1e878a7..c1411656b010 100644 --- a/libs/rs/java/Fountain/src/com/android/fountain/FountainView.java +++ b/libs/rs/java/Fountain/src/com/android/fountain/FountainView.java @@ -71,12 +71,16 @@ public class FountainView extends RSSurfaceView { @Override public boolean onTouchEvent(MotionEvent ev) { - int act = ev.getAction(); + int act = ev.getActionMasked(); if (act == ev.ACTION_UP) { - mRender.newTouchPosition(0, 0, 0, 0); + mRender.newTouchPosition(0, 0, 0, ev.getPointerId(0)); return false; + } else if (act == MotionEvent.ACTION_POINTER_UP) { + // only one pointer going up, we can get the index like this + int pointerIndex = ev.getActionIndex(); + int pointerId = ev.getPointerId(pointerIndex); + mRender.newTouchPosition(0, 0, 0, pointerId); } - int count = ev.getHistorySize(); int pcount = ev.getPointerCount(); |