Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
91c44a1
[ui]: floating button 디자인 수정 (#34)
Nico1eKim Jul 10, 2025
5d6be30
[ui]: toggle button 디자인 수정 (#34)
Nico1eKim Jul 14, 2025
06f806e
[ui]: book page text field 컴포넌트 수정 (#34)
Nico1eKim Jul 14, 2025
a0abca0
[ui]: 기록 작성 화면 페이지 입력까지 완료 (#34)
Nico1eKim Jul 14, 2025
4bf2f4b
[chore]: 중복되는 string 교체 (#34)
Nico1eKim Jul 14, 2025
d192aeb
[ui]: 기본 textfield 컴포넌트 생성 (#34)
Nico1eKim Jul 14, 2025
8e5ac80
[ui]: 기록 작성 화면 의견 입력부분까지 완료 (#34)
Nico1eKim Jul 14, 2025
9055cba
[ui]: 기록 작성 화면 form 채워지면 완료 버튼 활성화시키기 (#34)
Nico1eKim Jul 14, 2025
da0fa14
[ui]: book page textfield unfocused text color 수정 (#34)
Nico1eKim Jul 14, 2025
02a69a2
[refactor]: 화면 input section들 컴포넌트로 분리 (#34)
Nico1eKim Jul 14, 2025
080de41
[refactor]: bordered text field text 받도록 수정 (#34)
Nico1eKim Jul 14, 2025
d161fc0
[refactor]: bordered text field 아이콘과 기능 요구사항에 맞게 수정 (#34)
Nico1eKim Jul 17, 2025
31d87f3
[refactor]: bordered text field focus됐을 때 테두리 굵어지는거 수정 (#34)
Nico1eKim Jul 17, 2025
b3f4240
[UI]: 투표 생성 부분 컴포넌트 생성 (#34)
Nico1eKim Jul 17, 2025
536e669
[UI]: focus 해제 로직 추가 (#34)
Nico1eKim Jul 17, 2025
1cc9795
[UI]: tooltip 디자인 수정 (#34)
Nico1eKim Jul 17, 2025
3f5993d
[UI]: 투표 생성 화면 완료 (#34)
Nico1eKim Jul 17, 2025
a5401d3
[refactor]: 총평 입력 가능할때만 toggle button enabled 상태로 변경 (#34)
Nico1eKim Jul 18, 2025
8fd64c5
Merge branch 'develop' of https://github.com/THIP-TextHip/THIP-Androi…
Nico1eKim Jul 18, 2025
8b340b8
[chore]: 삭제한 string 되돌리기 (#34)
Nico1eKim Jul 18, 2025
23b0e10
[UI]: 투표 생성 화면 완료 상태 추가 (#34)
Nico1eKim Jul 18, 2025
d5e5a89
[fix]: 투표 항목 수정 안되는 오류 해결 (#34)
Nico1eKim Jul 18, 2025
01c17d5
[fix]: 총평 toast message 색상 제대로 뜨게 수정 (#34)
Nico1eKim Jul 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fun ExpandableFloatingButton(
) {
Column(
modifier = Modifier
.padding(bottom = 94.dp, end = 20.dp)
.padding(bottom = 62.dp)
.width(184.dp)
.background(
color = colors.Black,
Expand Down Expand Up @@ -100,8 +100,7 @@ fun ExpandableFloatingButton(
contentColor = colors.NeonGreen,
shape = CircleShape,
modifier = Modifier
.padding(16.dp)
.size(56.dp)
.size(50.dp)
.border(width = 2.dp, color = colors.NeonGreen50, shape = CircleShape)
) {
Icon(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.texthip.thip.ui.common.buttons

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Icon
import androidx.compose.material3.Switch
Expand All @@ -22,20 +23,26 @@ import com.texthip.thip.ui.theme.ThipTheme.colors
@Composable
fun ToggleSwitchButton(
isChecked: Boolean,
enabled: Boolean = true,
onToggleChange: (Boolean) -> Unit
) {
//var isChecked by remember { mutableStateOf(true) }
Switch(
modifier = Modifier.padding(4.dp),
modifier = Modifier.height(30.dp),
checked = isChecked,
onCheckedChange = onToggleChange,
colors = SwitchDefaults.colors(
checkedThumbColor = colors.White,
disabledCheckedThumbColor = colors.White,
checkedTrackColor = colors.Purple,
disabledCheckedTrackColor = colors.Purple,
uncheckedThumbColor = colors.White,
disabledUncheckedThumbColor = colors.White,
uncheckedTrackColor = colors.DarkGrey,
disabledUncheckedTrackColor = colors.DarkGrey,
uncheckedBorderColor = Color.Transparent,
disabledUncheckedBorderColor = Color.Transparent,
),
enabled = enabled,
thumbContent = {
Icon(
painter = painterResource(R.drawable.ic_circle),
Expand Down

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기존 코드 수정이 됬네요 확인했습니다!

Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package com.texthip.thip.ui.common.forms


import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardOptions
Expand Down Expand Up @@ -41,79 +42,93 @@ import com.texthip.thip.ui.theme.ThipTheme.typography
@Composable
fun BookPageTextField(
modifier: Modifier = Modifier,
bookPage: Int
bookTotalPage: Int,
enabled: Boolean = true,
text: String,
onValueChange: (String) -> Unit,
) {
var text by rememberSaveable { mutableStateOf("") }
var isError by rememberSaveable { mutableStateOf(false) }
var errorMessageRes by rememberSaveable { mutableStateOf<Int?>(null) }
var errorMessageParam by rememberSaveable { mutableStateOf(0) }

Column {
OutlinedTextField(
value = text,
onValueChange = { newText: String ->
if (newText.isEmpty() || newText.all { it.isDigit() }) {
text = newText
onValueChange(newText)

if (newText.isNotEmpty()) {
val pageNum = newText.toInt()
isError = pageNum > bookPage
if (isError) {
errorMessageRes = R.string.error_page_over
errorMessageParam = bookPage
isError = pageNum > bookTotalPage
errorMessageRes = if (isError) {
R.string.error_page_over
} else {
errorMessageRes = null
null
}
} else {
isError = false
errorMessageRes = null
}
}
},
visualTransformation = SuffixTransformation(
suffix = "/${bookPage}p",
suffixColor = colors.Grey02
),
enabled = enabled,
visualTransformation = if (enabled) {
SuffixTransformation("/${bookTotalPage}p", colors.Grey02)
} else {
VisualTransformation.None
},
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
modifier = modifier.size(width = 320.dp, height = 48.dp),
modifier = modifier
.size(width = 320.dp, height = 48.dp)
.then(
if (isError)
Modifier.border(
width = 1.dp,
color = colors.Red,
shape = RoundedCornerShape(12.dp)
)
else Modifier
),
textStyle = typography.menu_r400_s14_h24.copy(lineHeight = 12.sp),
maxLines = 1,
shape = RoundedCornerShape(12.dp),
colors = TextFieldDefaults.colors(
focusedTextColor = colors.White,
focusedIndicatorColor = if (isError) colors.Red else Color.Transparent,
unfocusedIndicatorColor = if (isError) colors.Red else Color.Transparent,
focusedContainerColor = colors.Black,
unfocusedContainerColor = colors.Black,
cursorColor = colors.NeonGreen
unfocusedTextColor = colors.White,
disabledTextColor = colors.White,
focusedIndicatorColor = Color.Transparent,
unfocusedIndicatorColor = Color.Transparent,
disabledIndicatorColor = Color.Transparent,
focusedContainerColor = colors.DarkGrey02,
unfocusedContainerColor = colors.DarkGrey02,
disabledContainerColor = colors.DarkGrey02,
cursorColor = colors.NeonGreen,
),
trailingIcon = {
if (text.isNotEmpty()) {
Icon(
painter = painterResource(id = R.drawable.ic_x_circle_white),
contentDescription = "Clear text",
modifier = Modifier.clickable {
text = ""
Icon(
painter = painterResource(id = R.drawable.ic_x_circle_grey),
contentDescription = "Clear text",
Comment thread
rbqks529 marked this conversation as resolved.
modifier = Modifier.clickable {
if (text.isNotEmpty()) {
onValueChange("")
isError = false
errorMessageRes = null
},
tint = Color.Unspecified
)
} else {
Icon(
painter = painterResource(id = R.drawable.ic_x_circle),
contentDescription = "Clear text"
)
}
}
},
tint = Color.Unspecified
)
}
)

if (isError && errorMessageRes != null) {
Spacer(modifier = Modifier.height(4.dp))
Text(
text = stringResource(id = errorMessageRes!!, errorMessageParam),
color = colors.Red,
style = typography.menu_r400_s14_h24.copy(lineHeight = 12.sp)
)
Box(modifier = Modifier.height(22.dp)) {
if (isError && errorMessageRes != null) {
Text(
modifier = Modifier.padding(start = 4.dp, top = 8.dp),
text = stringResource(id = errorMessageRes!!),
color = colors.Red,
style = typography.menu_r400_s14_h24.copy(lineHeight = 12.sp)
)
}
}
}
}
Expand All @@ -135,6 +150,7 @@ class SuffixTransformation(
val offsetMapping = object : OffsetMapping {
override fun originalToTransformed(offset: Int): Int =
offset.coerceAtMost(original.length)

override fun transformedToOriginal(offset: Int): Int =
offset.coerceAtMost(original.length)
}
Expand All @@ -147,12 +163,18 @@ class SuffixTransformation(
@Composable
@Preview(showBackground = true, backgroundColor = 0xFF000000, widthDp = 360, heightDp = 200)
fun BookPageTextFieldPreviewEmpty() {
var text by rememberSaveable { mutableStateOf("") }

Box(
modifier = Modifier.size(width = 360.dp, height = 200.dp),
contentAlignment = Alignment.Center
) {
BookPageTextField(
bookPage = 456
bookTotalPage = 456,
text = text,
onValueChange = {
text = it
}
)
}
}
Loading