use of android.os.VibrationEffect in project Gadgetbridge by Freeyourgadget.
the class FindPhoneActivity method vibrate.
private void vibrate() {
mVibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
long[] vibrationPattern = new long[] { 1000, 1000 };
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
VibrationEffect vibrationEffect = VibrationEffect.createWaveform(vibrationPattern, 0);
mVibrator.vibrate(vibrationEffect);
} else {
mVibrator.vibrate(vibrationPattern, 0);
}
}
use of android.os.VibrationEffect in project Signal-Android by WhisperSystems.
the class VibrateUtil method vibrateTick.
public static void vibrateTick(@NonNull Context context) {
Vibrator vibrator = ServiceUtil.getVibrator(context);
if (Build.VERSION.SDK_INT >= 26) {
VibrationEffect effect = VibrationEffect.createOneShot(TICK_LENGTH, 64);
vibrator.vibrate(effect);
} else {
vibrator.vibrate(TICK_LENGTH);
}
}
use of android.os.VibrationEffect in project Signal-Android by signalapp.
the class VibrateUtil method vibrateTick.
public static void vibrateTick(@NonNull Context context) {
Vibrator vibrator = ServiceUtil.getVibrator(context);
if (Build.VERSION.SDK_INT >= 26) {
VibrationEffect effect = VibrationEffect.createOneShot(TICK_LENGTH, 64);
vibrator.vibrate(effect);
} else {
vibrator.vibrate(TICK_LENGTH);
}
}
use of android.os.VibrationEffect in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class VibrationPreferenceFragment method playVibrationPreview.
/**
* Play a vibration effect with intensity just selected by user
*/
protected void playVibrationPreview() {
Vibrator vibrator = getContext().getSystemService(Vibrator.class);
VibrationEffect effect = VibrationEffect.get(VibrationEffect.EFFECT_CLICK);
AudioAttributes.Builder builder = new AudioAttributes.Builder();
builder.setUsage(getPreviewVibrationAudioAttributesUsage());
vibrator.vibrate(effect, builder.build());
}
use of android.os.VibrationEffect in project android_packages_apps_Settings by omnirom.
the class VibrationPreferenceFragment method playVibrationPreview.
/**
* Play a vibration effect with intensity just selected by user
*/
protected void playVibrationPreview() {
Vibrator vibrator = getContext().getSystemService(Vibrator.class);
VibrationEffect effect = VibrationEffect.get(VibrationEffect.EFFECT_CLICK);
AudioAttributes.Builder builder = new AudioAttributes.Builder();
builder.setUsage(getPreviewVibrationAudioAttributesUsage());
vibrator.vibrate(effect, builder.build());
}
Aggregations