From 87d7929d142f7c5f1937e12d6fd32a43ab00740e Mon Sep 17 00:00:00 2001 From: Alan Viverette Date: Wed, 22 Jun 2011 17:11:07 -0700 Subject: Added text navigation gestures for keyboard touch exploration. Bug: 4905427 Change-Id: I9b44d65e4503e46ce71322a3c325c55d188e34a0 --- .../AccessibleInputMethodServiceProxy.java | 43 +++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java') diff --git a/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java b/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java index 7199550a9..89adc15f2 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java @@ -16,11 +16,15 @@ package com.android.inputmethod.accessibility; +import android.content.Context; import android.content.SharedPreferences; import android.inputmethodservice.InputMethodService; +import android.media.AudioManager; import android.os.Looper; import android.os.Message; +import android.os.Vibrator; import android.text.TextUtils; +import android.view.KeyEvent; import android.view.inputmethod.ExtractedText; import android.view.inputmethod.ExtractedTextRequest; @@ -38,8 +42,14 @@ public class AccessibleInputMethodServiceProxy implements AccessibleKeyboardActi */ private static final long DELAY_NO_HOVER_SELECTION = 250; - private InputMethodService mInputMethod; + /** + * Duration of the key click vibration in milliseconds. + */ + private static final long VIBRATE_KEY_CLICK = 50; + private InputMethodService mInputMethod; + private Vibrator mVibrator; + private AudioManager mAudioManager; private AccessibilityHandler mAccessibilityHandler; private static class AccessibilityHandler @@ -84,6 +94,8 @@ public class AccessibleInputMethodServiceProxy implements AccessibleKeyboardActi private void initInternal(InputMethodService inputMethod, SharedPreferences prefs) { mInputMethod = inputMethod; + mVibrator = (Vibrator) inputMethod.getSystemService(Context.VIBRATOR_SERVICE); + mAudioManager = (AudioManager) inputMethod.getSystemService(Context.AUDIO_SERVICE); mAccessibilityHandler = new AccessibilityHandler(this, inputMethod.getMainLooper()); } @@ -106,6 +118,35 @@ public class AccessibleInputMethodServiceProxy implements AccessibleKeyboardActi mAccessibilityHandler.postNoHoverSelection(); } + /** + * Handle flick gestures by mapping them to directional pad keys. + */ + @Override + public void onFlickGesture(int direction) { + final int keyEventCode; + + switch (direction) { + case FlickGestureDetector.FLICK_LEFT: + sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_LEFT); + break; + case FlickGestureDetector.FLICK_RIGHT: + sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_RIGHT); + break; + } + } + + /** + * Provide haptic feedback and send the specified keyCode to the input + * connection as a pair of down/up events. + * + * @param keyCode + */ + private void sendDownUpKeyEvents(int keyCode) { + mVibrator.vibrate(VIBRATE_KEY_CLICK); + mAudioManager.playSoundEffect(AudioManager.FX_KEY_CLICK); + mInputMethod.sendDownUpKeyEvents(keyCode); + } + /** * When Accessibility is turned on, notifies the user that they are not * currently hovering above a key. By default this will speak the currently -- cgit v1.2.3-83-g751a From 356d6871f115e64948fc0b069786299a008d802a Mon Sep 17 00:00:00 2001 From: Alan Viverette Date: Thu, 21 Jul 2011 10:44:57 -0700 Subject: Fixed accessibility navigation gesture sound volume Bug: 5061527 Change-Id: I88728f7368a55ae7e6ca2ce6cfed6af42ffa03df --- .../inputmethod/accessibility/AccessibleInputMethodServiceProxy.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java') diff --git a/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java b/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java index 89adc15f2..4ab9cb898 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java @@ -47,6 +47,8 @@ public class AccessibleInputMethodServiceProxy implements AccessibleKeyboardActi */ private static final long VIBRATE_KEY_CLICK = 50; + private static final float FX_VOLUME = -1.0f; + private InputMethodService mInputMethod; private Vibrator mVibrator; private AudioManager mAudioManager; @@ -143,7 +145,7 @@ public class AccessibleInputMethodServiceProxy implements AccessibleKeyboardActi */ private void sendDownUpKeyEvents(int keyCode) { mVibrator.vibrate(VIBRATE_KEY_CLICK); - mAudioManager.playSoundEffect(AudioManager.FX_KEY_CLICK); + mAudioManager.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD, FX_VOLUME); mInputMethod.sendDownUpKeyEvents(keyCode); } -- cgit v1.2.3-83-g751a From 2ac5988f84b5c38d313951a3d7faddebf5f25e04 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 15 Dec 2011 19:32:11 +0900 Subject: Cleanup unused variables and parameters Change-Id: Iad756a7a775c93f3344c6962e7b3456ef8339490 --- .../accessibility/AccessibilityUtils.java | 13 ++++++------- .../AccessibleInputMethodServiceProxy.java | 9 +++------ .../accessibility/AccessibleKeyboardViewProxy.java | 16 +++++++--------- .../accessibility/FlickGestureDetector.java | 1 - .../accessibility/KeyCodeDescriptionMapper.java | 7 +++---- .../inputmethod/keyboard/LatinKeyboardView.java | 8 +++----- .../src/com/android/inputmethod/latin/LatinIME.java | 6 +++--- .../android/inputmethod/latin/SettingsValues.java | 21 ++++++++++++--------- .../android/inputmethod/latin/SuggestionsView.java | 7 ------- .../inputmethod/latin/UserUnigramDictionary.java | 6 +++--- 10 files changed, 40 insertions(+), 54 deletions(-) (limited to 'java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java') diff --git a/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java b/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java index 1836f27b3..9caed00c9 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java @@ -17,7 +17,6 @@ package com.android.inputmethod.accessibility; import android.content.Context; -import android.content.SharedPreferences; import android.inputmethodservice.InputMethodService; import android.media.AudioManager; import android.os.SystemClock; @@ -55,15 +54,15 @@ public class AccessibilityUtils { */ private static final boolean ENABLE_ACCESSIBILITY = true; - public static void init(InputMethodService inputMethod, SharedPreferences prefs) { + public static void init(InputMethodService inputMethod) { if (!ENABLE_ACCESSIBILITY) return; // These only need to be initialized if the kill switch is off. - sInstance.initInternal(inputMethod, prefs); - KeyCodeDescriptionMapper.init(inputMethod, prefs); - AccessibleInputMethodServiceProxy.init(inputMethod, prefs); - AccessibleKeyboardViewProxy.init(inputMethod, prefs); + sInstance.initInternal(inputMethod); + KeyCodeDescriptionMapper.init(); + AccessibleInputMethodServiceProxy.init(inputMethod); + AccessibleKeyboardViewProxy.init(inputMethod); } public static AccessibilityUtils getInstance() { @@ -74,7 +73,7 @@ public class AccessibilityUtils { // This class is not publicly instantiable. } - private void initInternal(Context context, SharedPreferences prefs) { + private void initInternal(Context context) { mContext = context; mAccessibilityManager = (AccessibilityManager) context .getSystemService(Context.ACCESSIBILITY_SERVICE); diff --git a/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java b/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java index 4ab9cb898..d834dd10b 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java @@ -17,7 +17,6 @@ package com.android.inputmethod.accessibility; import android.content.Context; -import android.content.SharedPreferences; import android.inputmethodservice.InputMethodService; import android.media.AudioManager; import android.os.Looper; @@ -82,8 +81,8 @@ public class AccessibleInputMethodServiceProxy implements AccessibleKeyboardActi } } - public static void init(InputMethodService inputMethod, SharedPreferences prefs) { - sInstance.initInternal(inputMethod, prefs); + public static void init(InputMethodService inputMethod) { + sInstance.initInternal(inputMethod); } public static AccessibleInputMethodServiceProxy getInstance() { @@ -94,7 +93,7 @@ public class AccessibleInputMethodServiceProxy implements AccessibleKeyboardActi // Not publicly instantiable. } - private void initInternal(InputMethodService inputMethod, SharedPreferences prefs) { + private void initInternal(InputMethodService inputMethod) { mInputMethod = inputMethod; mVibrator = (Vibrator) inputMethod.getSystemService(Context.VIBRATOR_SERVICE); mAudioManager = (AudioManager) inputMethod.getSystemService(Context.AUDIO_SERVICE); @@ -125,8 +124,6 @@ public class AccessibleInputMethodServiceProxy implements AccessibleKeyboardActi */ @Override public void onFlickGesture(int direction) { - final int keyEventCode; - switch (direction) { case FlickGestureDetector.FLICK_LEFT: sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_LEFT); diff --git a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java index 4cb2f20b9..9141daaee 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java @@ -17,7 +17,6 @@ package com.android.inputmethod.accessibility; import android.content.Context; -import android.content.SharedPreferences; import android.graphics.Color; import android.graphics.Paint; import android.inputmethodservice.InputMethodService; @@ -43,8 +42,8 @@ public class AccessibleKeyboardViewProxy { private Key mLastHoverKey = null; - public static void init(InputMethodService inputMethod, SharedPreferences prefs) { - sInstance.initInternal(inputMethod, prefs); + public static void init(InputMethodService inputMethod) { + sInstance.initInternal(inputMethod); sInstance.mListener = AccessibleInputMethodServiceProxy.getInstance(); } @@ -60,7 +59,7 @@ public class AccessibleKeyboardViewProxy { // Not publicly instantiable. } - private void initInternal(InputMethodService inputMethod, SharedPreferences prefs) { + private void initInternal(InputMethodService inputMethod) { final Paint paint = new Paint(); paint.setTextAlign(Paint.Align.LEFT); paint.setTextSize(14.0f); @@ -71,8 +70,7 @@ public class AccessibleKeyboardViewProxy { mGestureDetector = new KeyboardFlickGestureDetector(inputMethod); } - public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event, - PointerTracker tracker) { + public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { if (mView == null) { Log.e(TAG, "No keyboard view set!"); return false; @@ -132,9 +130,9 @@ public class AccessibleKeyboardViewProxy { final Key key = tracker.getKeyOn(x, y); if (key != mLastHoverKey) { - fireKeyHoverEvent(tracker, mLastHoverKey, false); + fireKeyHoverEvent(mLastHoverKey, false); mLastHoverKey = key; - fireKeyHoverEvent(tracker, mLastHoverKey, true); + fireKeyHoverEvent(mLastHoverKey, true); } return true; @@ -143,7 +141,7 @@ public class AccessibleKeyboardViewProxy { return false; } - private void fireKeyHoverEvent(PointerTracker tracker, Key key, boolean entering) { + private void fireKeyHoverEvent(Key key, boolean entering) { if (mListener == null) { Log.e(TAG, "No accessible keyboard action listener set!"); return; diff --git a/java/src/com/android/inputmethod/accessibility/FlickGestureDetector.java b/java/src/com/android/inputmethod/accessibility/FlickGestureDetector.java index 9d99e3131..db12f76ad 100644 --- a/java/src/com/android/inputmethod/accessibility/FlickGestureDetector.java +++ b/java/src/com/android/inputmethod/accessibility/FlickGestureDetector.java @@ -126,7 +126,6 @@ public abstract class FlickGestureDetector { } final float distanceSquare = calculateDistanceSquare(mCachedHoverEnter, event); - final long timeout = event.getEventTime() - mCachedHoverEnter.getEventTime(); switch (event.getAction()) { case MotionEventCompatUtils.ACTION_HOVER_MOVE: diff --git a/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java b/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java index e01262c20..3d5ab05c3 100644 --- a/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java +++ b/java/src/com/android/inputmethod/accessibility/KeyCodeDescriptionMapper.java @@ -17,7 +17,6 @@ package com.android.inputmethod.accessibility; import android.content.Context; -import android.content.SharedPreferences; import android.text.TextUtils; import com.android.inputmethod.keyboard.Key; @@ -45,8 +44,8 @@ public class KeyCodeDescriptionMapper { // Map of shift-locked key codes to spoken description resource IDs private final HashMap mShiftLockedKeyCodeMap; - public static void init(Context context, SharedPreferences prefs) { - sInstance.initInternal(context, prefs); + public static void init() { + sInstance.initInternal(); } public static KeyCodeDescriptionMapper getInstance() { @@ -60,7 +59,7 @@ public class KeyCodeDescriptionMapper { mShiftLockedKeyCodeMap = new HashMap(); } - private void initInternal(Context context, SharedPreferences prefs) { + private void initInternal() { // Manual label substitutions for key labels with no string resource mKeyLabelMap.put(":-)", R.string.spoken_description_smiley); diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java index e56f2ea84..7f2c6c501 100644 --- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java @@ -206,7 +206,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke // Detected a double tap on shift key. If we are in the ignoring double tap // mode, it means we have already turned off caps lock in // {@link KeyboardSwitcher#onReleaseShift} . - onDoubleTapShiftKey(tracker, mKeyTimerHandler.isIgnoringDoubleTap()); + onDoubleTapShiftKey(mKeyTimerHandler.isIgnoringDoubleTap()); return true; } // Otherwise these events should not be handled as double tap. @@ -342,8 +342,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke return onLongPress(parentKey, tracker); } - private void onDoubleTapShiftKey(@SuppressWarnings("unused") PointerTracker tracker, - final boolean ignore) { + private void onDoubleTapShiftKey(final boolean ignore) { // When shift key is double tapped, the first tap is correctly processed as usual tap. And // the second tap is treated as this double tap event, so that we need not mark tracker // calling setAlreadyProcessed() nor remove the tracker from mPointerQueue. @@ -633,9 +632,8 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke @Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) { - final PointerTracker tracker = getPointerTracker(0); return AccessibleKeyboardViewProxy.getInstance().dispatchPopulateAccessibilityEvent( - event, tracker) || super.dispatchPopulateAccessibilityEvent(event); + event) || super.dispatchPopulateAccessibilityEvent(event); } return super.dispatchPopulateAccessibilityEvent(event); diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 98fea1b5b..943361c73 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -489,7 +489,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar InputMethodManagerCompatWrapper.init(this); SubtypeSwitcher.init(this); KeyboardSwitcher.init(this, prefs); - AccessibilityUtils.init(this, prefs); + AccessibilityUtils.init(this); super.onCreate(); @@ -758,7 +758,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar loadSettings(); updateCorrectionMode(); - updateSuggestionVisibility(mPrefs, mResources); + updateSuggestionVisibility(mResources); if (mSuggest != null && mSettingsValues.mAutoCorrectEnabled) { mSuggest.setAutoCorrectionThreshold(mSettingsValues.mAutoCorrectionThreshold); @@ -2415,7 +2415,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar ? Suggest.CORRECTION_FULL_BIGRAM : mCorrectionMode; } - private void updateSuggestionVisibility(final SharedPreferences prefs, final Resources res) { + private void updateSuggestionVisibility(final Resources res) { final String suggestionVisiblityStr = mSettingsValues.mShowSuggestionsSetting; for (int visibility : SUGGESTION_VISIBILITY_VALUE_ARRAY) { if (suggestionVisiblityStr.equals(res.getString(visibility))) { diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java index 0ad1c1529..651d90ca4 100644 --- a/java/src/com/android/inputmethod/latin/SettingsValues.java +++ b/java/src/com/android/inputmethod/latin/SettingsValues.java @@ -52,7 +52,9 @@ public class SettingsValues { private final String mVoiceMode; private final String mAutoCorrectionThresholdRawValue; public final String mShowSuggestionsSetting; + @SuppressWarnings("unused") // TODO: Use this private final boolean mUsabilityStudyMode; + @SuppressWarnings("unused") // TODO: Use this private final String mKeyPreviewPopupDismissDelayRawValue; public final boolean mUseContactsDict; // Suggestion: use bigrams to adjust scores of suggestions obtained from unigram dictionary @@ -60,7 +62,9 @@ public class SettingsValues { // Prediction: use bigrams to predict the next word when there is no input for it yet public final boolean mBigramPredictionEnabled; public final boolean mEnableSuggestionSpanInsertion; + @SuppressWarnings("unused") // TODO: Use this private final int mVibrationDurationSettingsRawValue; + @SuppressWarnings("unused") // TODO: Use this private final float mKeypressSoundVolumeRawValue; // Deduced settings @@ -111,12 +115,12 @@ public class SettingsValues { res.getString(R.string.auto_correction_threshold_mode_index_modest)); mShowSuggestionsSetting = prefs.getString(Settings.PREF_SHOW_SUGGESTIONS_SETTING, res.getString(R.string.prefs_suggestion_visibility_default_value)); - mUsabilityStudyMode = getUsabilityStudyMode(prefs, res); + mUsabilityStudyMode = getUsabilityStudyMode(prefs); mKeyPreviewPopupDismissDelayRawValue = prefs.getString( Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY, Integer.toString(res.getInteger(R.integer.config_delay_after_preview))); mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true); - mAutoCorrectEnabled = isAutoCorrectEnabled(prefs, res, mAutoCorrectionThresholdRawValue); + mAutoCorrectEnabled = isAutoCorrectEnabled(res, mAutoCorrectionThresholdRawValue); mBigramSuggestionEnabled = mAutoCorrectEnabled && isBigramSuggestionEnabled(prefs, res, mAutoCorrectEnabled); mBigramPredictionEnabled = mBigramSuggestionEnabled @@ -131,7 +135,7 @@ public class SettingsValues { mKeypressVibrationDuration = getCurrentVibrationDuration(prefs, res); mFxVolume = getCurrentKeypressSoundVolume(prefs, res); mKeyPreviewPopupDismissDelay = getKeyPreviewPopupDismissDelay(prefs, res); - mAutoCorrectionThreshold = getAutoCorrectionThreshold(prefs, res, + mAutoCorrectionThreshold = getAutoCorrectionThreshold(res, mAutoCorrectionThresholdRawValue); mVoiceKeyEnabled = mVoiceMode != null && !mVoiceMode.equals(voiceModeOff); mVoiceKeyOnMain = mVoiceMode != null && mVoiceMode.equals(voiceModeMain); @@ -202,8 +206,8 @@ public class SettingsValues { return mMagicSpaceSwappers.contains(String.valueOf((char)code)); } - private static boolean isAutoCorrectEnabled(final SharedPreferences sp, - final Resources resources, final String currentAutoCorrectionSetting) { + private static boolean isAutoCorrectEnabled(final Resources resources, + final String currentAutoCorrectionSetting) { final String autoCorrectionOff = resources.getString( R.string.auto_correction_threshold_mode_index_off); return !currentAutoCorrectionSetting.equals(autoCorrectionOff); @@ -244,8 +248,8 @@ public class SettingsValues { R.bool.config_default_bigram_prediction)); } - private static double getAutoCorrectionThreshold(final SharedPreferences sp, - final Resources resources, final String currentAutoCorrectionSetting) { + private static double getAutoCorrectionThreshold(final Resources resources, + final String currentAutoCorrectionSetting) { final String[] autoCorrectionThresholdValues = resources.getStringArray( R.array.auto_correction_threshold_values); // When autoCorrectionThreshold is greater than 1.0, it's like auto correction is off. @@ -321,8 +325,7 @@ public class SettingsValues { } // Likewise - public static boolean getUsabilityStudyMode(final SharedPreferences prefs, - final Resources res) { + public static boolean getUsabilityStudyMode(final SharedPreferences prefs) { // TODO: use mUsabilityStudyMode instead of reading it again here return prefs.getBoolean(Settings.PREF_USABILITY_STUDY_MODE, true); } diff --git a/java/src/com/android/inputmethod/latin/SuggestionsView.java b/java/src/com/android/inputmethod/latin/SuggestionsView.java index 10f5ec9db..883bb57f0 100644 --- a/java/src/com/android/inputmethod/latin/SuggestionsView.java +++ b/java/src/com/android/inputmethod/latin/SuggestionsView.java @@ -100,8 +100,6 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener, private static class UiHandler extends StaticInnerHandlerWrapper { private static final int MSG_HIDE_PREVIEW = 0; - private static final long DELAY_HIDE_PREVIEW = 1300; - public UiHandler(SuggestionsView outerInstance) { super(outerInstance); } @@ -116,11 +114,6 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener, } } - public void postHidePreview() { - cancelHidePreview(); - sendMessageDelayed(obtainMessage(MSG_HIDE_PREVIEW), DELAY_HIDE_PREVIEW); - } - public void cancelHidePreview() { removeMessages(MSG_HIDE_PREVIEW); } diff --git a/java/src/com/android/inputmethod/latin/UserUnigramDictionary.java b/java/src/com/android/inputmethod/latin/UserUnigramDictionary.java index 6af20c754..a7f57ae46 100644 --- a/java/src/com/android/inputmethod/latin/UserUnigramDictionary.java +++ b/java/src/com/android/inputmethod/latin/UserUnigramDictionary.java @@ -172,7 +172,7 @@ public class UserUnigramDictionary extends ExpandableDictionary { // Nothing pending? Return if (mPendingWrites.isEmpty()) return; // Create a background thread to write the pending entries - new UpdateDbTask(getContext(), sOpenHelper, mPendingWrites, mLocale).execute(); + new UpdateDbTask(sOpenHelper, mPendingWrites, mLocale).execute(); // Create a new map for writing new entries into while the old one is written to db mPendingWrites = new HashMap(); } @@ -227,8 +227,8 @@ public class UserUnigramDictionary extends ExpandableDictionary { private final DatabaseHelper mDbHelper; private final String mLocale; - public UpdateDbTask(@SuppressWarnings("unused") Context context, DatabaseHelper openHelper, - HashMap pendingWrites, String locale) { + public UpdateDbTask(DatabaseHelper openHelper, HashMap pendingWrites, + String locale) { mMap = pendingWrites; mLocale = locale; mDbHelper = openHelper; -- cgit v1.2.3-83-g751a From 16f74396828d84885e922ac0a7467e51616ae71d Mon Sep 17 00:00:00 2001 From: alanv Date: Mon, 30 Jan 2012 13:45:59 -0800 Subject: Removed unused "no item selected" notification & supporting code from keyboard accessibility. Change-Id: Ia6323ad0c1e2a0db5a2cf830e97765eddaa32cee --- .../AccessibleInputMethodServiceProxy.java | 87 ---------------------- .../AccessibleKeyboardActionListener.java | 18 ----- .../accessibility/AccessibleKeyboardViewProxy.java | 2 - 3 files changed, 107 deletions(-) (limited to 'java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java') diff --git a/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java b/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java index d834dd10b..961176bb8 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java @@ -19,28 +19,13 @@ package com.android.inputmethod.accessibility; import android.content.Context; import android.inputmethodservice.InputMethodService; import android.media.AudioManager; -import android.os.Looper; -import android.os.Message; import android.os.Vibrator; -import android.text.TextUtils; import android.view.KeyEvent; -import android.view.inputmethod.ExtractedText; -import android.view.inputmethod.ExtractedTextRequest; - -import com.android.inputmethod.latin.R; -import com.android.inputmethod.latin.StaticInnerHandlerWrapper; public class AccessibleInputMethodServiceProxy implements AccessibleKeyboardActionListener { private static final AccessibleInputMethodServiceProxy sInstance = new AccessibleInputMethodServiceProxy(); - /* - * Delay for the handler event that's fired when Accessibility is on and the - * user hovers outside of any valid keys. This is used to let the user know - * that if they lift their finger, nothing will be typed. - */ - private static final long DELAY_NO_HOVER_SELECTION = 250; - /** * Duration of the key click vibration in milliseconds. */ @@ -51,35 +36,6 @@ public class AccessibleInputMethodServiceProxy implements AccessibleKeyboardActi private InputMethodService mInputMethod; private Vibrator mVibrator; private AudioManager mAudioManager; - private AccessibilityHandler mAccessibilityHandler; - - private static class AccessibilityHandler - extends StaticInnerHandlerWrapper { - private static final int MSG_NO_HOVER_SELECTION = 0; - - public AccessibilityHandler(AccessibleInputMethodServiceProxy outerInstance, - Looper looper) { - super(outerInstance, looper); - } - - @Override - public void handleMessage(Message msg) { - switch (msg.what) { - case MSG_NO_HOVER_SELECTION: - getOuterInstance().notifyNoHoverSelection(); - break; - } - } - - public void postNoHoverSelection() { - removeMessages(MSG_NO_HOVER_SELECTION); - sendEmptyMessageDelayed(MSG_NO_HOVER_SELECTION, DELAY_NO_HOVER_SELECTION); - } - - public void cancelNoHoverSelection() { - removeMessages(MSG_NO_HOVER_SELECTION); - } - } public static void init(InputMethodService inputMethod) { sInstance.initInternal(inputMethod); @@ -97,26 +53,6 @@ public class AccessibleInputMethodServiceProxy implements AccessibleKeyboardActi mInputMethod = inputMethod; mVibrator = (Vibrator) inputMethod.getSystemService(Context.VIBRATOR_SERVICE); mAudioManager = (AudioManager) inputMethod.getSystemService(Context.AUDIO_SERVICE); - mAccessibilityHandler = new AccessibilityHandler(this, inputMethod.getMainLooper()); - } - - /** - * If touch exploration is enabled, cancels the event sent by - * {@link AccessibleInputMethodServiceProxy#onHoverExit(int)} because the - * user is currently hovering above a key. - */ - @Override - public void onHoverEnter(int primaryCode) { - mAccessibilityHandler.cancelNoHoverSelection(); - } - - /** - * If touch exploration is enabled, sends a delayed event to notify the user - * that they are not currently hovering above a key. - */ - @Override - public void onHoverExit(int primaryCode) { - mAccessibilityHandler.postNoHoverSelection(); } /** @@ -145,27 +81,4 @@ public class AccessibleInputMethodServiceProxy implements AccessibleKeyboardActi mAudioManager.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD, FX_VOLUME); mInputMethod.sendDownUpKeyEvents(keyCode); } - - /** - * When Accessibility is turned on, notifies the user that they are not - * currently hovering above a key. By default this will speak the currently - * entered text. - */ - private void notifyNoHoverSelection() { - final ExtractedText extracted = mInputMethod.getCurrentInputConnection().getExtractedText( - new ExtractedTextRequest(), 0); - - if (extracted == null) - return; - - final CharSequence text; - - if (TextUtils.isEmpty(extracted.text)) { - text = mInputMethod.getString(R.string.spoken_no_text_entered); - } else { - text = mInputMethod.getString(R.string.spoken_current_text_is, extracted.text); - } - - AccessibilityUtils.getInstance().speak(text); - } } diff --git a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardActionListener.java b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardActionListener.java index c1e92bec8..31d17d09f 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardActionListener.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardActionListener.java @@ -17,24 +17,6 @@ package com.android.inputmethod.accessibility; public interface AccessibleKeyboardActionListener { - /** - * Called when the user hovers inside a key. This is sent only when - * Accessibility is turned on. For keys that repeat, this is only called - * once. - * - * @param primaryCode the code of the key that was hovered over - */ - public void onHoverEnter(int primaryCode); - - /** - * Called when the user hovers outside a key. This is sent only when - * Accessibility is turned on. For keys that repeat, this is only called - * once. - * - * @param primaryCode the code of the key that was hovered over - */ - public void onHoverExit(int primaryCode); - /** * @param direction the direction of the flick gesture, one of *
    diff --git a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java index 9141daaee..f98359dc1 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java @@ -156,10 +156,8 @@ public class AccessibleKeyboardViewProxy { return; if (entering) { - mListener.onHoverEnter(key.mCode); mView.sendAccessibilityEvent(AccessibilityEventCompatUtils.TYPE_VIEW_HOVER_ENTER); } else { - mListener.onHoverExit(key.mCode); mView.sendAccessibilityEvent(AccessibilityEventCompatUtils.TYPE_VIEW_HOVER_EXIT); } } -- cgit v1.2.3-83-g751a From 34b2b5e694758390126ffa3b1c7d752cdde7a05c Mon Sep 17 00:00:00 2001 From: alanv Date: Tue, 8 May 2012 17:23:58 -0700 Subject: Remove accessibility gesture handlers from LatinIME. Bug: 6457558 Change-Id: If33ca6f026d4846ba79a701ef42c0112f5b0b488 --- .../accessibility/AccessibilityUtils.java | 1 - .../AccessibleInputMethodServiceProxy.java | 84 -------- .../AccessibleKeyboardActionListener.java | 30 --- .../accessibility/AccessibleKeyboardViewProxy.java | 39 ---- .../accessibility/FlickGestureDetector.java | 223 --------------------- 5 files changed, 377 deletions(-) delete mode 100644 java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java delete mode 100644 java/src/com/android/inputmethod/accessibility/AccessibleKeyboardActionListener.java delete mode 100644 java/src/com/android/inputmethod/accessibility/FlickGestureDetector.java (limited to 'java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java') diff --git a/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java b/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java index 667b109cb..2ea7d83e4 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java @@ -58,7 +58,6 @@ public class AccessibilityUtils { // These only need to be initialized if the kill switch is off. sInstance.initInternal(inputMethod); KeyCodeDescriptionMapper.init(); - AccessibleInputMethodServiceProxy.init(inputMethod); AccessibleKeyboardViewProxy.init(inputMethod); } diff --git a/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java b/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java deleted file mode 100644 index 961176bb8..000000000 --- a/java/src/com/android/inputmethod/accessibility/AccessibleInputMethodServiceProxy.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.inputmethod.accessibility; - -import android.content.Context; -import android.inputmethodservice.InputMethodService; -import android.media.AudioManager; -import android.os.Vibrator; -import android.view.KeyEvent; - -public class AccessibleInputMethodServiceProxy implements AccessibleKeyboardActionListener { - private static final AccessibleInputMethodServiceProxy sInstance = - new AccessibleInputMethodServiceProxy(); - - /** - * Duration of the key click vibration in milliseconds. - */ - private static final long VIBRATE_KEY_CLICK = 50; - - private static final float FX_VOLUME = -1.0f; - - private InputMethodService mInputMethod; - private Vibrator mVibrator; - private AudioManager mAudioManager; - - public static void init(InputMethodService inputMethod) { - sInstance.initInternal(inputMethod); - } - - public static AccessibleInputMethodServiceProxy getInstance() { - return sInstance; - } - - private AccessibleInputMethodServiceProxy() { - // Not publicly instantiable. - } - - private void initInternal(InputMethodService inputMethod) { - mInputMethod = inputMethod; - mVibrator = (Vibrator) inputMethod.getSystemService(Context.VIBRATOR_SERVICE); - mAudioManager = (AudioManager) inputMethod.getSystemService(Context.AUDIO_SERVICE); - } - - /** - * Handle flick gestures by mapping them to directional pad keys. - */ - @Override - public void onFlickGesture(int direction) { - switch (direction) { - case FlickGestureDetector.FLICK_LEFT: - sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_LEFT); - break; - case FlickGestureDetector.FLICK_RIGHT: - sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_RIGHT); - break; - } - } - - /** - * Provide haptic feedback and send the specified keyCode to the input - * connection as a pair of down/up events. - * - * @param keyCode - */ - private void sendDownUpKeyEvents(int keyCode) { - mVibrator.vibrate(VIBRATE_KEY_CLICK); - mAudioManager.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD, FX_VOLUME); - mInputMethod.sendDownUpKeyEvents(keyCode); - } -} diff --git a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardActionListener.java b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardActionListener.java deleted file mode 100644 index 31d17d09f..000000000 --- a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardActionListener.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.inputmethod.accessibility; - -public interface AccessibleKeyboardActionListener { - /** - * @param direction the direction of the flick gesture, one of - *
      - *
    • {@link FlickGestureDetector#FLICK_UP} - *
    • {@link FlickGestureDetector#FLICK_DOWN} - *
    • {@link FlickGestureDetector#FLICK_LEFT} - *
    • {@link FlickGestureDetector#FLICK_RIGHT} - *
    - */ - public void onFlickGesture(int direction); -} diff --git a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java index c85a5514e..ba814e390 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java @@ -17,8 +17,6 @@ package com.android.inputmethod.accessibility; import android.content.Context; -import android.graphics.Color; -import android.graphics.Paint; import android.inputmethodservice.InputMethodService; import android.support.v4.view.AccessibilityDelegateCompat; import android.support.v4.view.ViewCompat; @@ -38,16 +36,13 @@ public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat { private static final AccessibleKeyboardViewProxy sInstance = new AccessibleKeyboardViewProxy(); private InputMethodService mInputMethod; - private FlickGestureDetector mGestureDetector; private LatinKeyboardView mView; - private AccessibleKeyboardActionListener mListener; private AccessibilityEntityProvider mAccessibilityNodeProvider; private Key mLastHoverKey = null; public static void init(InputMethodService inputMethod) { sInstance.initInternal(inputMethod); - sInstance.mListener = AccessibleInputMethodServiceProxy.getInstance(); } public static AccessibleKeyboardViewProxy getInstance() { @@ -59,14 +54,7 @@ public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat { } private void initInternal(InputMethodService inputMethod) { - final Paint paint = new Paint(); - paint.setTextAlign(Paint.Align.LEFT); - paint.setTextSize(14.0f); - paint.setAntiAlias(true); - paint.setColor(Color.YELLOW); - mInputMethod = inputMethod; - mGestureDetector = new KeyboardFlickGestureDetector(inputMethod); } /** @@ -112,19 +100,6 @@ public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat { * @return {@code true} if the event is handled */ public boolean dispatchHoverEvent(MotionEvent event, PointerTracker tracker) { - if (mGestureDetector.onHoverEvent(event, this, tracker)) - return true; - - return onHoverEventInternal(event, tracker); - } - - /** - * Handles touch exploration events when Accessibility is turned on. - * - * @param event The touch exploration hover event. - * @return {@code true} if the event was handled - */ - /* package */boolean onHoverEventInternal(MotionEvent event, PointerTracker tracker) { final int x = (int) event.getX(); final int y = (int) event.getY(); final Key key = tracker.getKeyOn(x, y); @@ -214,20 +189,6 @@ public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat { mView.getParent().requestSendAccessibilityEvent(mView, event); } - private class KeyboardFlickGestureDetector extends FlickGestureDetector { - public KeyboardFlickGestureDetector(Context context) { - super(context); - } - - @Override - public boolean onFlick(MotionEvent e1, MotionEvent e2, int direction) { - if (mListener != null) { - mListener.onFlickGesture(direction); - } - return true; - } - } - /** * Notifies the user of changes in the keyboard shift state. */ diff --git a/java/src/com/android/inputmethod/accessibility/FlickGestureDetector.java b/java/src/com/android/inputmethod/accessibility/FlickGestureDetector.java deleted file mode 100644 index e8ec37600..000000000 --- a/java/src/com/android/inputmethod/accessibility/FlickGestureDetector.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.inputmethod.accessibility; - -import android.content.Context; -import android.os.Message; -import android.view.MotionEvent; -import android.view.ViewConfiguration; - -import com.android.inputmethod.keyboard.PointerTracker; -import com.android.inputmethod.latin.StaticInnerHandlerWrapper; - -/** - * Detects flick gestures within a stream of hover events. - *

    - * A flick gesture is defined as a stream of hover events with the following - * properties: - *

      - *
    • Begins with a {@link MotionEvent#ACTION_HOVER_ENTER} event - *
    • Contains any number of {@link MotionEvent#ACTION_HOVER_MOVE} - * events - *
    • Ends with a {@link MotionEvent#ACTION_HOVER_EXIT} event - *
    • Maximum duration of 250 milliseconds - *
    • Minimum distance between enter and exit points must be at least equal to - * scaled double tap slop (see - * {@link ViewConfiguration#getScaledDoubleTapSlop()}) - *
    - *

    - * Initial enter events are intercepted and cached until the stream fails to - * satisfy the constraints defined above, at which point the cached enter event - * is sent to its source {@link AccessibleKeyboardViewProxy} and subsequent move - * and exit events are ignored. - */ -public abstract class FlickGestureDetector { - public static final int FLICK_UP = 0; - public static final int FLICK_RIGHT = 1; - public static final int FLICK_LEFT = 2; - public static final int FLICK_DOWN = 3; - - private final FlickHandler mFlickHandler; - private final int mFlickRadiusSquare; - - private AccessibleKeyboardViewProxy mCachedView; - private PointerTracker mCachedTracker; - private MotionEvent mCachedHoverEnter; - - private static class FlickHandler extends StaticInnerHandlerWrapper { - private static final int MSG_FLICK_TIMEOUT = 1; - - /** The maximum duration of a flick gesture in milliseconds. */ - private static final int DELAY_FLICK_TIMEOUT = 250; - - public FlickHandler(FlickGestureDetector outerInstance) { - super(outerInstance); - } - - @Override - public void handleMessage(Message msg) { - final FlickGestureDetector gestureDetector = getOuterInstance(); - - switch (msg.what) { - case MSG_FLICK_TIMEOUT: - gestureDetector.clearFlick(true); - } - } - - public void startFlickTimeout() { - cancelFlickTimeout(); - sendEmptyMessageDelayed(MSG_FLICK_TIMEOUT, DELAY_FLICK_TIMEOUT); - } - - public void cancelFlickTimeout() { - removeMessages(MSG_FLICK_TIMEOUT); - } - } - - /** - * Creates a new flick gesture detector. - * - * @param context The parent context. - */ - public FlickGestureDetector(Context context) { - final int doubleTapSlop = ViewConfiguration.get(context).getScaledDoubleTapSlop(); - - mFlickHandler = new FlickHandler(this); - mFlickRadiusSquare = doubleTapSlop * doubleTapSlop; - } - - /** - * Processes motion events to detect flick gestures. - * - * @param event The current event. - * @param view The source of the event. - * @param tracker A pointer tracker for the event. - * @return {@code true} if the event was handled. - */ - public boolean onHoverEvent(MotionEvent event, AccessibleKeyboardViewProxy view, - PointerTracker tracker) { - // Always cache and consume the first hover event. - if (event.getAction() == MotionEvent.ACTION_HOVER_ENTER) { - mCachedView = view; - mCachedTracker = tracker; - mCachedHoverEnter = MotionEvent.obtain(event); - mFlickHandler.startFlickTimeout(); - return true; - } - - // Stop if the event has already been canceled. - if (mCachedHoverEnter == null) { - return false; - } - - final float distanceSquare = calculateDistanceSquare(mCachedHoverEnter, event); - - switch (event.getAction()) { - case MotionEvent.ACTION_HOVER_MOVE: - // Consume all valid move events before timeout. - return true; - case MotionEvent.ACTION_HOVER_EXIT: - // Ignore exit events outside the flick radius. - if (distanceSquare < mFlickRadiusSquare) { - clearFlick(true); - return false; - } else { - return dispatchFlick(mCachedHoverEnter, event); - } - default: - return false; - } - } - - /** - * Clears the cached flick information and optionally forwards the event to - * the source view's internal hover event handler. - * - * @param sendCachedEvent Set to {@code true} to forward the hover event to - * the source view. - */ - private void clearFlick(boolean sendCachedEvent) { - mFlickHandler.cancelFlickTimeout(); - - if (mCachedHoverEnter != null) { - if (sendCachedEvent) { - mCachedView.onHoverEventInternal(mCachedHoverEnter, mCachedTracker); - } - mCachedHoverEnter.recycle(); - mCachedHoverEnter = null; - } - - mCachedTracker = null; - mCachedView = null; - } - - /** - * Computes the direction of a flick gesture and forwards it to - * {@link #onFlick(MotionEvent, MotionEvent, int)} for handling. - * - * @param e1 The {@link MotionEvent#ACTION_HOVER_ENTER} event where the flick started. - * @param e2 The {@link MotionEvent#ACTION_HOVER_EXIT} event where the flick ended. - * @return {@code true} if the flick event was handled. - */ - private boolean dispatchFlick(MotionEvent e1, MotionEvent e2) { - clearFlick(false); - - final float dX = e2.getX() - e1.getX(); - final float dY = e2.getY() - e1.getY(); - final int direction; - - if (dY > dX) { - if (dY > -dX) { - direction = FLICK_DOWN; - } else { - direction = FLICK_LEFT; - } - } else { - if (dY > -dX) { - direction = FLICK_RIGHT; - } else { - direction = FLICK_UP; - } - } - - return onFlick(e1, e2, direction); - } - - private float calculateDistanceSquare(MotionEvent e1, MotionEvent e2) { - final float dX = e2.getX() - e1.getX(); - final float dY = e2.getY() - e1.getY(); - return (dX * dX) + (dY * dY); - } - - /** - * Handles a detected flick gesture. - * - * @param e1 The {@link MotionEventCompatUtils#ACTION_HOVER_ENTER} event - * where the flick started. - * @param e2 The {@link MotionEventCompatUtils#ACTION_HOVER_EXIT} event - * where the flick ended. - * @param direction The direction of the flick event, one of: - *

      - *
    • {@link #FLICK_UP} - *
    • {@link #FLICK_DOWN} - *
    • {@link #FLICK_LEFT} - *
    • {@link #FLICK_RIGHT} - *
    - * @return {@code true} if the flick event was handled. - */ - public abstract boolean onFlick(MotionEvent e1, MotionEvent e2, int direction); -} -- cgit v1.2.3-83-g751a