From 8e8b1577cdc165c1c83491ce65e9f14261313cd0 Mon Sep 17 00:00:00 2001 From: Jan Seeger Date: Mon, 16 Dec 2024 17:03:36 +0100 Subject: [PATCH] Add Vibrator convenience wrapper --- .../de/sipgate/dachlatten/datetime/VibratorExt.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 dachlatten-datetime-android/src/main/kotlin/de/sipgate/dachlatten/datetime/VibratorExt.kt diff --git a/dachlatten-datetime-android/src/main/kotlin/de/sipgate/dachlatten/datetime/VibratorExt.kt b/dachlatten-datetime-android/src/main/kotlin/de/sipgate/dachlatten/datetime/VibratorExt.kt new file mode 100644 index 0000000..e4bffb0 --- /dev/null +++ b/dachlatten-datetime-android/src/main/kotlin/de/sipgate/dachlatten/datetime/VibratorExt.kt @@ -0,0 +1,13 @@ +package de.sipgate.dachlatten.datetime + +import android.Manifest +import android.os.Vibrator +import androidx.annotation.RequiresPermission +import kotlin.time.Duration + +@Suppress("unused") +@RequiresPermission(Manifest.permission.VIBRATE) +fun Vibrator.vibrate(duration: Duration) { + @Suppress("DEPRECATION") + vibrate(duration.inWholeMilliseconds) +}