Loading java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +11 −18 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.inputmethod.keyboard.KeyboardLayoutSet.KeyboardLayoutSetExcep import com.android.inputmethod.keyboard.PointerTracker.TimerProxy; import com.android.inputmethod.keyboard.internal.KeyboardState; import com.android.inputmethod.latin.AudioAndHapticFeedbackManager; import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.InputView; import com.android.inputmethod.latin.LatinIME; import com.android.inputmethod.latin.LatinImeLogger; Loading Loading @@ -68,8 +69,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { new KeyboardTheme(5, R.style.KeyboardTheme_IceCreamSandwich), }; private final AudioAndHapticFeedbackManager mFeedbackManager = AudioAndHapticFeedbackManager.getInstance(); private SubtypeSwitcher mSubtypeSwitcher; private SharedPreferences mPrefs; Loading Loading @@ -151,7 +150,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { mKeyboardLayoutSet = builder.build(); try { mState.onLoadKeyboard(); mFeedbackManager.onSettingsChanged(settingsValues); } catch (KeyboardLayoutSetException e) { Log.w(TAG, "loading keyboard failed: " + e.mKeyboardId, e.getCause()); LatinImeLogger.logOnException(e.mKeyboardId.toString(), e.getCause()); Loading @@ -159,10 +157,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { } } public void onRingerModeChanged() { mFeedbackManager.onRingerModeChanged(); } public void saveKeyboardState() { if (getKeyboard() != null) { mState.onSaveKeyboardState(); Loading Loading @@ -217,9 +211,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { } public void onPressKey(final int code, final boolean isSinglePointer) { if (isVibrateAndSoundFeedbackRequired()) { mFeedbackManager.hapticAndAudioFeedback(code, mKeyboardView); } hapticAndAudioFeedback(code); mState.onPressKey(code, isSinglePointer, mLatinIME.getCurrentAutoCapsState()); } Loading Loading @@ -328,24 +320,25 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { } } // Implements {@link KeyboardState.SwitchActions}. @Override public void hapticAndAudioFeedback(final int code) { mFeedbackManager.hapticAndAudioFeedback(code, mKeyboardView); private void hapticAndAudioFeedback(final int code) { if (mKeyboardView == null || mKeyboardView.isInSlidingKeyInput()) { return; } AudioAndHapticFeedbackManager.getInstance().hapticAndAudioFeedback(code, mKeyboardView); } public void onLongPressTimeout(final int code) { mState.onLongPressTimeout(code); final Keyboard keyboard = getKeyboard(); if (keyboard != null && keyboard.mId.isAlphabetKeyboard() && code == Constants.CODE_SHIFT) { hapticAndAudioFeedback(code); } } public boolean isInMomentarySwitchState() { return mState.isInMomentarySwitchState(); } private boolean isVibrateAndSoundFeedbackRequired() { return mKeyboardView != null && !mKeyboardView.isInSlidingKeyInput(); } /** * Updates state machine to figure out when to automatically switch back to the previous mode. */ Loading java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +1 −1 Original line number Diff line number Diff line Loading @@ -1008,7 +1008,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack tracker.onLongPressed(); invokeCodeInput(embeddedCode); invokeReleaseKey(code); KeyboardSwitcher.getInstance().hapticAndAudioFeedback(code); AudioAndHapticFeedbackManager.getInstance().hapticAndAudioFeedback(code, this); return; } if (code == Constants.CODE_SPACE || code == Constants.CODE_LANGUAGE_SWITCH) { Loading java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +0 −2 Original line number Diff line number Diff line Loading @@ -58,7 +58,6 @@ public final class KeyboardState { public void cancelDoubleTapTimer(); public void startLongPressTimer(int code); public void cancelLongPressTimer(); public void hapticAndAudioFeedback(int code); } private final SwitchActions mSwitchActions; Loading Loading @@ -387,7 +386,6 @@ public final class KeyboardState { } if (mIsAlphabetMode && code == Constants.CODE_SHIFT) { mLongPressShiftLockFired = true; mSwitchActions.hapticAndAudioFeedback(code); } } Loading java/src/com/android/inputmethod/latin/LatinIME.java +2 −1 Original line number Diff line number Diff line Loading @@ -480,6 +480,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen final InputAttributes inputAttributes = new InputAttributes(getCurrentInputEditorInfo(), isFullscreenMode()); mSettings.loadSettings(locale, inputAttributes); AudioAndHapticFeedbackManager.getInstance().onSettingsChanged(mSettings.getCurrent()); // May need to reset the contacts dictionary depending on the user settings. resetContactsDictionary(null == mSuggest ? null : mSuggest.getContactsDictionary()); } Loading Loading @@ -2701,7 +2702,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) { mSubtypeSwitcher.onNetworkStateChanged(intent); } else if (action.equals(AudioManager.RINGER_MODE_CHANGED_ACTION)) { mKeyboardSwitcher.onRingerModeChanged(); AudioAndHapticFeedbackManager.getInstance().onRingerModeChanged(); } } }; Loading java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java +3 −1 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ import com.android.inputmethod.keyboard.KeyboardSwitcher; import com.android.inputmethod.keyboard.MainKeyboardView; import com.android.inputmethod.keyboard.MoreKeysPanel; import com.android.inputmethod.keyboard.ViewLayoutUtils; import com.android.inputmethod.latin.AudioAndHapticFeedbackManager; import com.android.inputmethod.latin.AutoCorrection; import com.android.inputmethod.latin.CollectionUtils; import com.android.inputmethod.latin.Constants; Loading Loading @@ -689,7 +690,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick @Override public boolean onLongClick(final View view) { KeyboardSwitcher.getInstance().hapticAndAudioFeedback(Constants.NOT_A_CODE); AudioAndHapticFeedbackManager.getInstance().hapticAndAudioFeedback( Constants.NOT_A_CODE, this); return showMoreSuggestions(); } Loading Loading
java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java +11 −18 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.inputmethod.keyboard.KeyboardLayoutSet.KeyboardLayoutSetExcep import com.android.inputmethod.keyboard.PointerTracker.TimerProxy; import com.android.inputmethod.keyboard.internal.KeyboardState; import com.android.inputmethod.latin.AudioAndHapticFeedbackManager; import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.InputView; import com.android.inputmethod.latin.LatinIME; import com.android.inputmethod.latin.LatinImeLogger; Loading Loading @@ -68,8 +69,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { new KeyboardTheme(5, R.style.KeyboardTheme_IceCreamSandwich), }; private final AudioAndHapticFeedbackManager mFeedbackManager = AudioAndHapticFeedbackManager.getInstance(); private SubtypeSwitcher mSubtypeSwitcher; private SharedPreferences mPrefs; Loading Loading @@ -151,7 +150,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { mKeyboardLayoutSet = builder.build(); try { mState.onLoadKeyboard(); mFeedbackManager.onSettingsChanged(settingsValues); } catch (KeyboardLayoutSetException e) { Log.w(TAG, "loading keyboard failed: " + e.mKeyboardId, e.getCause()); LatinImeLogger.logOnException(e.mKeyboardId.toString(), e.getCause()); Loading @@ -159,10 +157,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { } } public void onRingerModeChanged() { mFeedbackManager.onRingerModeChanged(); } public void saveKeyboardState() { if (getKeyboard() != null) { mState.onSaveKeyboardState(); Loading Loading @@ -217,9 +211,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { } public void onPressKey(final int code, final boolean isSinglePointer) { if (isVibrateAndSoundFeedbackRequired()) { mFeedbackManager.hapticAndAudioFeedback(code, mKeyboardView); } hapticAndAudioFeedback(code); mState.onPressKey(code, isSinglePointer, mLatinIME.getCurrentAutoCapsState()); } Loading Loading @@ -328,24 +320,25 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions { } } // Implements {@link KeyboardState.SwitchActions}. @Override public void hapticAndAudioFeedback(final int code) { mFeedbackManager.hapticAndAudioFeedback(code, mKeyboardView); private void hapticAndAudioFeedback(final int code) { if (mKeyboardView == null || mKeyboardView.isInSlidingKeyInput()) { return; } AudioAndHapticFeedbackManager.getInstance().hapticAndAudioFeedback(code, mKeyboardView); } public void onLongPressTimeout(final int code) { mState.onLongPressTimeout(code); final Keyboard keyboard = getKeyboard(); if (keyboard != null && keyboard.mId.isAlphabetKeyboard() && code == Constants.CODE_SHIFT) { hapticAndAudioFeedback(code); } } public boolean isInMomentarySwitchState() { return mState.isInMomentarySwitchState(); } private boolean isVibrateAndSoundFeedbackRequired() { return mKeyboardView != null && !mKeyboardView.isInSlidingKeyInput(); } /** * Updates state machine to figure out when to automatically switch back to the previous mode. */ Loading
java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +1 −1 Original line number Diff line number Diff line Loading @@ -1008,7 +1008,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack tracker.onLongPressed(); invokeCodeInput(embeddedCode); invokeReleaseKey(code); KeyboardSwitcher.getInstance().hapticAndAudioFeedback(code); AudioAndHapticFeedbackManager.getInstance().hapticAndAudioFeedback(code, this); return; } if (code == Constants.CODE_SPACE || code == Constants.CODE_LANGUAGE_SWITCH) { Loading
java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java +0 −2 Original line number Diff line number Diff line Loading @@ -58,7 +58,6 @@ public final class KeyboardState { public void cancelDoubleTapTimer(); public void startLongPressTimer(int code); public void cancelLongPressTimer(); public void hapticAndAudioFeedback(int code); } private final SwitchActions mSwitchActions; Loading Loading @@ -387,7 +386,6 @@ public final class KeyboardState { } if (mIsAlphabetMode && code == Constants.CODE_SHIFT) { mLongPressShiftLockFired = true; mSwitchActions.hapticAndAudioFeedback(code); } } Loading
java/src/com/android/inputmethod/latin/LatinIME.java +2 −1 Original line number Diff line number Diff line Loading @@ -480,6 +480,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen final InputAttributes inputAttributes = new InputAttributes(getCurrentInputEditorInfo(), isFullscreenMode()); mSettings.loadSettings(locale, inputAttributes); AudioAndHapticFeedbackManager.getInstance().onSettingsChanged(mSettings.getCurrent()); // May need to reset the contacts dictionary depending on the user settings. resetContactsDictionary(null == mSuggest ? null : mSuggest.getContactsDictionary()); } Loading Loading @@ -2701,7 +2702,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) { mSubtypeSwitcher.onNetworkStateChanged(intent); } else if (action.equals(AudioManager.RINGER_MODE_CHANGED_ACTION)) { mKeyboardSwitcher.onRingerModeChanged(); AudioAndHapticFeedbackManager.getInstance().onRingerModeChanged(); } } }; Loading
java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java +3 −1 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ import com.android.inputmethod.keyboard.KeyboardSwitcher; import com.android.inputmethod.keyboard.MainKeyboardView; import com.android.inputmethod.keyboard.MoreKeysPanel; import com.android.inputmethod.keyboard.ViewLayoutUtils; import com.android.inputmethod.latin.AudioAndHapticFeedbackManager; import com.android.inputmethod.latin.AutoCorrection; import com.android.inputmethod.latin.CollectionUtils; import com.android.inputmethod.latin.Constants; Loading Loading @@ -689,7 +690,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick @Override public boolean onLongClick(final View view) { KeyboardSwitcher.getInstance().hapticAndAudioFeedback(Constants.NOT_A_CODE); AudioAndHapticFeedbackManager.getInstance().hapticAndAudioFeedback( Constants.NOT_A_CODE, this); return showMoreSuggestions(); } Loading