public AudioAndHapticFeedbackManager( final LatinIME latinIme, final SettingsValues settingsValues) { mSettingsValues = settingsValues; mVibratorUtils = VibratorUtils.getInstance(latinIme); mAudioManager = (AudioManager) latinIme.getSystemService(Context.AUDIO_SERVICE); mSoundOn = reevaluateIfSoundIsOn(); }
// TODO: make this private when LatinIME does not call it any more public void vibrate(final View viewToPerformHapticFeedbackOn) { if (!mSettingsValues.mVibrateOn) { return; } if (mSettingsValues.mKeypressVibrationDuration < 0) { // Go ahead with the system default if (viewToPerformHapticFeedbackOn != null) { viewToPerformHapticFeedbackOn.performHapticFeedback( HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); } } else if (mVibratorUtils != null) { mVibratorUtils.vibrate(mSettingsValues.mKeypressVibrationDuration); } }