Skip to content

Commit

Permalink
fix: edge to edge padding bottom inclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
CraZyLegenD committed Jan 4, 2021
1 parent e4c1d04 commit 865143c
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ fun Context.vibrate(milliseconds: Long) {
}
}

/**
* Vibrate from context with milliseconds
*/
@RequiresPermission(allOf = [VIBRATE])
fun Context.vibrate(milliseconds: Long, effect: Int? = null) {
if (Build.VERSION.SDK_INT >= 26) {
(getSystemService(VIBRATOR_SERVICE) as Vibrator).vibrate(VibrationEffect.createOneShot(milliseconds,
effect ?: VibrationEffect.DEFAULT_AMPLITUDE))
} else {
(getSystemService(VIBRATOR_SERVICE) as Vibrator).vibrate(milliseconds)
}
}


/**
* Check whether device has Vibrator
Expand Down

0 comments on commit 865143c

Please sign in to comment.