diff --git a/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/component/AttendanceDialog.kt b/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/component/AttendanceDialog.kt index 4536cc5d..f380d12c 100644 --- a/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/component/AttendanceDialog.kt +++ b/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/component/AttendanceDialog.kt @@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults @@ -18,11 +19,14 @@ import androidx.compose.material3.OutlinedTextFieldDefaults import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment +import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip +import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString +import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextDecoration @@ -34,6 +38,7 @@ import androidx.compose.ui.window.DialogProperties import com.wap.designsystem.WappTheme import com.wap.wapp.feature.attendance.R +@OptIn(ExperimentalComposeUiApi::class) @Composable internal fun AttendanceDialog( attendanceCode: String, @@ -42,6 +47,8 @@ internal fun AttendanceDialog( onDismissRequest: () -> Unit, onAttendanceCodeChanged: (String) -> Unit, ) { + val keyboardController = LocalSoftwareKeyboardController.current + Dialog( onDismissRequest = onDismissRequest, properties = DialogProperties( @@ -79,7 +86,11 @@ internal fun AttendanceDialog( value = attendanceCode, onValueChange = onAttendanceCodeChanged, textStyle = WappTheme.typography.titleRegular.copy(textAlign = TextAlign.Center), - keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), + keyboardOptions = KeyboardOptions( + keyboardType = KeyboardType.Number, + imeAction = ImeAction.Done, + ), + keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }), shape = RoundedCornerShape(8.dp), colors = OutlinedTextFieldDefaults.colors( focusedTextColor = WappTheme.colors.white, diff --git a/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/management/component/AttendanceManagementDialog.kt b/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/management/component/AttendanceManagementDialog.kt index 3dacc32e..f011a093 100644 --- a/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/management/component/AttendanceManagementDialog.kt +++ b/feature/attendance/src/main/java/com/wap/wapp/feature/attendance/management/component/AttendanceManagementDialog.kt @@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults @@ -18,11 +19,14 @@ import androidx.compose.material3.OutlinedTextFieldDefaults import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment +import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip +import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString +import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextDecoration @@ -34,6 +38,7 @@ import androidx.compose.ui.window.DialogProperties import com.wap.designsystem.WappTheme import com.wap.wapp.feature.attendance.R +@OptIn(ExperimentalComposeUiApi::class) @Composable internal fun AttendanceManagementDialog( attendanceCode: String, @@ -42,6 +47,8 @@ internal fun AttendanceManagementDialog( onDismissRequest: () -> Unit, onAttendanceCodeChanged: (String) -> Unit, ) { + val keyboardController = LocalSoftwareKeyboardController.current + Dialog( onDismissRequest = onDismissRequest, properties = DialogProperties( @@ -79,7 +86,11 @@ internal fun AttendanceManagementDialog( value = attendanceCode, onValueChange = onAttendanceCodeChanged, textStyle = WappTheme.typography.titleRegular.copy(textAlign = TextAlign.Center), - keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number), + keyboardOptions = KeyboardOptions( + keyboardType = KeyboardType.Number, + imeAction = ImeAction.Done, + ), + keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }), shape = RoundedCornerShape(8.dp), colors = OutlinedTextFieldDefaults.colors( focusedTextColor = WappTheme.colors.white,