mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-07-01 06:00:57 +02:00
parent
a2173abf61
commit
6fef198541
@ -42,22 +42,22 @@ fun BasicKeyboardButton(
|
|||||||
icon: ImageVector,
|
icon: ImageVector,
|
||||||
iconColor: Color,
|
iconColor: Color,
|
||||||
allowVibration: Boolean,
|
allowVibration: Boolean,
|
||||||
contentHeight: Float
|
contentHeight: Float,
|
||||||
) {
|
) {
|
||||||
val view = LocalView.current
|
val view = LocalView.current
|
||||||
val coroutineScope = rememberCoroutineScope()
|
val coroutineScope = rememberCoroutineScope()
|
||||||
|
fun vibrate() {
|
||||||
UnittoButton(
|
|
||||||
modifier = modifier,
|
|
||||||
onClick = {
|
|
||||||
onClick()
|
|
||||||
if (allowVibration) {
|
if (allowVibration) {
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP)
|
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
onLongClick = onLongClick,
|
|
||||||
|
UnittoButton(
|
||||||
|
modifier = modifier,
|
||||||
|
onClick = { onClick(); vibrate() },
|
||||||
|
onLongClick = if (onLongClick != null) { { onLongClick(); vibrate() } } else null,
|
||||||
containerColor = containerColor,
|
containerColor = containerColor,
|
||||||
contentPadding = PaddingValues()
|
contentPadding = PaddingValues()
|
||||||
) {
|
) {
|
||||||
@ -116,7 +116,7 @@ fun KeyboardButtonAdditional(
|
|||||||
icon: ImageVector,
|
icon: ImageVector,
|
||||||
allowVibration: Boolean,
|
allowVibration: Boolean,
|
||||||
onLongClick: (() -> Unit)? = null,
|
onLongClick: (() -> Unit)? = null,
|
||||||
onClick: () -> Unit
|
onClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
BasicKeyboardButton(
|
BasicKeyboardButton(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
@ -131,4 +131,5 @@ fun KeyboardButtonAdditional(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun isPortrait() = LocalConfiguration.current.orientation == Configuration.ORIENTATION_PORTRAIT
|
private fun isPortrait() =
|
||||||
|
LocalConfiguration.current.orientation == Configuration.ORIENTATION_PORTRAIT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user