Correct random option
This commit is contained in:
@ -28,8 +28,6 @@ import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import de.luh.hci.mi.vibrationpattern.ui.theme.VibrationPatternTheme
|
||||
import kotlin.random.Random
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
private lateinit var vibrator: Vibrator
|
||||
|
||||
@ -90,14 +88,7 @@ class MainActivity : ComponentActivity() {
|
||||
|
||||
Spacer(modifier = Modifier.height(20.dp))
|
||||
Button(
|
||||
onClick = {
|
||||
vibrator.vibrate(
|
||||
VibrationEffect.createWaveform(
|
||||
LongArray(Random.Default.nextInt(2,10)){
|
||||
Random.Default.nextLong(100, 2000)},
|
||||
1))
|
||||
isVibrating = true
|
||||
},
|
||||
onClick = { vibrator.vibrate(vibes.random()); isVibrating = true },
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Text("Random")
|
||||
@ -164,9 +155,11 @@ class MainActivity : ComponentActivity() {
|
||||
private val CHILL = VibrationEffect.createWaveform(
|
||||
longArrayOf(
|
||||
0, 100, 50, 150, 1600
|
||||
), intArrayOf(
|
||||
0, 50, 0, 150, 0
|
||||
), 1
|
||||
)
|
||||
private val vibes = arrayOf(HEART, SOS, WALTZ)
|
||||
private val vibes = arrayOf(HEART, SOS, WALTZ, ANGRY, CHILL)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user