diff options
author | Romain Guy <romainguy@android.com> | 2009-06-11 13:07:43 -0700 |
---|---|---|
committer | Romain Guy <romainguy@android.com> | 2009-06-11 13:07:43 -0700 |
commit | 6fefcf1f83ba05e898ea7164a68dcced657bb43e (patch) | |
tree | 023ebcac4bd4e8c34e859800bcbe90eefdb167a2 | |
parent | ae4f575911d0c17de8d687a8fa092b0aa8360243 (diff) | |
download | packages_apps_trebuchet-6fefcf1f83ba05e898ea7164a68dcced657bb43e.zip packages_apps_trebuchet-6fefcf1f83ba05e898ea7164a68dcced657bb43e.tar.gz packages_apps_trebuchet-6fefcf1f83ba05e898ea7164a68dcced657bb43e.tar.bz2 |
Change recognition matchin in Home to immediate mode.
Instead of waiting for Xms after a finger up event to start the recognition process,
do it right away on a finger up event. This provides immediate feedback.
-rw-r--r-- | res/layout/gestures_settings_item.xml | 2 | ||||
-rw-r--r-- | src/com/android/launcher/Launcher.java | 41 |
2 files changed, 32 insertions, 11 deletions
diff --git a/res/layout/gestures_settings_item.xml b/res/layout/gestures_settings_item.xml index 3c47cab..1563dfe 100644 --- a/res/layout/gestures_settings_item.xml +++ b/res/layout/gestures_settings_item.xml @@ -24,7 +24,7 @@ android:drawablePadding="12dip" android:paddingLeft="6dip" - android:paddingRight="2dip" + android:paddingRight="6dip" android:ellipsize="marquee" android:singleLine="true" diff --git a/src/com/android/launcher/Launcher.java b/src/com/android/launcher/Launcher.java index 88c411a..5131081 100644 --- a/src/com/android/launcher/Launcher.java +++ b/src/com/android/launcher/Launcher.java @@ -105,6 +105,8 @@ public final class Launcher extends Activity implements View.OnClickListener, On private static final boolean DEBUG_USER_INTERFACE = false; private static final boolean DEBUG_GESTURES = false; + private static final boolean CONFIG_GESTURES_IMMEDIATE_MODE = true; + private static final int WALLPAPER_SCREENS_SPAN = 2; private static final int MENU_GROUP_ADD = 1; @@ -585,7 +587,6 @@ public final class Launcher extends Activity implements View.OnClickListener, On mGesturesProcessor = new GesturesProcessor(); final GestureOverlayView overlay = mGesturesOverlay; - overlay.setFadeOffset(GesturesConstants.MATCH_DELAY); overlay.addOnGestureListener(mGesturesProcessor); overlay.getGesturePaint().setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY)); } @@ -2350,8 +2351,11 @@ public final class Launcher extends Activity implements View.OnClickListener, On } public void onGestureStarted(GestureOverlayView overlay, MotionEvent event) { - overlay.removeCallbacks(mMatcher); - resetGesturesNextPrompt(); + //noinspection PointlessBooleanExpression,ConstantConditions + if (!CONFIG_GESTURES_IMMEDIATE_MODE) { + overlay.removeCallbacks(mMatcher); + resetGesturesNextPrompt(); + } mGesturesAdd.setAlpha(128); mGesturesAdd.setEnabled(false); @@ -2364,13 +2368,22 @@ public final class Launcher extends Activity implements View.OnClickListener, On } public void onGestureEnded(GestureOverlayView overlay, MotionEvent event) { - overlay.removeCallbacks(mMatcher); - - mMatcher.gesture = overlay.getGesture(); - if (mMatcher.gesture.getLength() < GesturesConstants.LENGTH_THRESHOLD) { - overlay.clear(false); + if (CONFIG_GESTURES_IMMEDIATE_MODE) { + mMatcher.gesture = overlay.getGesture(); + if (mMatcher.gesture.getLength() < GesturesConstants.LENGTH_THRESHOLD) { + overlay.clear(false); + } else { + mMatcher.run(); + } } else { - overlay.postDelayed(mMatcher, GesturesConstants.MATCH_DELAY); + overlay.removeCallbacks(mMatcher); + + mMatcher.gesture = overlay.getGesture(); + if (mMatcher.gesture.getLength() < GesturesConstants.LENGTH_THRESHOLD) { + overlay.clear(false); + } else { + overlay.postDelayed(mMatcher, GesturesConstants.MATCH_DELAY); + } } } @@ -2407,12 +2420,20 @@ public final class Launcher extends Activity implements View.OnClickListener, On } private void updatePrompt(ApplicationInfo info) { + if (mGesturesAction.intent != null && + info.intent.toURI().equals(mGesturesAction.intent.toURI()) && + info.title.equals(((TextView) mGesturesPrompt.getCurrentView()).getText())) { + return; + } setGesturesNextPrompt(info.icon, info.title); mGesturesAction.intent = info.intent; } public void onGestureCancelled(GestureOverlayView overlay, MotionEvent event) { - overlay.removeCallbacks(mMatcher); + //noinspection PointlessBooleanExpression,ConstantConditions + if (!CONFIG_GESTURES_IMMEDIATE_MODE) { + overlay.removeCallbacks(mMatcher); + } } void addGesture(String name, Gesture gesture) { |