Skip to content

Commit

Permalink
[REFACTOR] #125 : 출석 페이지 다이얼로그 완료 누를 시 키보드 숨기도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Feb 16, 2024
1 parent f03976b commit 4bcafca
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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,
Expand All @@ -42,6 +47,8 @@ internal fun AttendanceDialog(
onDismissRequest: () -> Unit,
onAttendanceCodeChanged: (String) -> Unit,
) {
val keyboardController = LocalSoftwareKeyboardController.current

Dialog(
onDismissRequest = onDismissRequest,
properties = DialogProperties(
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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,
Expand All @@ -42,6 +47,8 @@ internal fun AttendanceManagementDialog(
onDismissRequest: () -> Unit,
onAttendanceCodeChanged: (String) -> Unit,
) {
val keyboardController = LocalSoftwareKeyboardController.current

Dialog(
onDismissRequest = onDismissRequest,
properties = DialogProperties(
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 4bcafca

Please sign in to comment.