forked from geode-sdk/android-launcher
cancel vibration with 0
This commit is contained in:
1 file changed
+4
@@ -476,6 +476,10 @@ object GeodeUtils {
|
|||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun vibrate(ms: Long) {
|
fun vibrate(ms: Long) {
|
||||||
|
if (ms == 0L) {
|
||||||
|
getVibrator()?.cancel()
|
||||||
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
getVibrator()?.vibrate(VibrationEffect.createOneShot(ms, VibrationEffect.DEFAULT_AMPLITUDE))
|
getVibrator()?.vibrate(VibrationEffect.createOneShot(ms, VibrationEffect.DEFAULT_AMPLITUDE))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in new issue
Block a user