Skip to content

Commit 7a5ccd2

Browse files
committed
[NDGL-122] fix: 여행 도구 환율 계산기 아이콘 변경 및 편집 활성, 비활성 영역 구분
1 parent 31e3ddf commit 7a5ccd2

3 files changed

Lines changed: 64 additions & 25 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24"
5+
android:viewportHeight="24">
6+
<path
7+
android:pathData="M6.53,16.47C6.388,16.337 6.2,16.265 6.005,16.269C5.811,16.272 5.626,16.351 5.488,16.488C5.351,16.626 5.272,16.811 5.269,17.005C5.265,17.2 5.337,17.388 5.47,17.53L7.47,19.53C7.61,19.67 7.801,19.749 8,19.749C8.199,19.749 8.389,19.67 8.53,19.53L10.53,17.53C10.604,17.461 10.663,17.378 10.704,17.287C10.745,17.194 10.767,17.095 10.768,16.994C10.77,16.894 10.752,16.794 10.714,16.7C10.676,16.607 10.62,16.522 10.549,16.451C10.478,16.38 10.393,16.323 10.299,16.286C10.206,16.248 10.106,16.23 10.005,16.231C9.905,16.233 9.805,16.255 9.713,16.296C9.621,16.337 9.539,16.396 9.47,16.47L8.75,17.19V7C8.75,6.801 8.671,6.61 8.53,6.47C8.39,6.329 8.199,6.25 8,6.25C7.801,6.25 7.61,6.329 7.47,6.47C7.329,6.61 7.25,6.801 7.25,7V17.19L6.53,16.47ZM13.47,7.53C13.611,7.67 13.801,7.749 14,7.749C14.199,7.749 14.389,7.67 14.53,7.53L15.25,6.81V17C15.25,17.199 15.329,17.39 15.469,17.53C15.61,17.671 15.801,17.75 16,17.75C16.199,17.75 16.389,17.671 16.53,17.53C16.671,17.39 16.75,17.199 16.75,17V6.81L17.47,7.53C17.538,7.604 17.621,7.663 17.713,7.704C17.805,7.745 17.905,7.767 18.005,7.769C18.106,7.77 18.206,7.752 18.299,7.714C18.393,7.676 18.478,7.62 18.549,7.549C18.62,7.478 18.676,7.393 18.714,7.3C18.752,7.206 18.77,7.106 18.768,7.005C18.767,6.905 18.745,6.805 18.704,6.713C18.663,6.621 18.604,6.539 18.53,6.47L16.53,4.47C16.389,4.329 16.199,4.251 16,4.251C15.801,4.251 15.611,4.329 15.47,4.47L13.47,6.47C13.329,6.611 13.25,6.801 13.25,7C13.25,7.199 13.329,7.389 13.47,7.53Z"
8+
android:fillColor="#000000"/>
9+
</vector>

feature/travel-helper/src/main/java/com/yapp/ndgl/feature/travelhelper/main/CurrencyCalculatorSection.kt

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import androidx.compose.ui.text.input.TransformedText
4141
import androidx.compose.ui.text.input.VisualTransformation
4242
import androidx.compose.ui.text.style.TextAlign
4343
import androidx.compose.ui.text.style.TextOverflow
44+
import androidx.compose.ui.tooling.preview.Preview
4445
import androidx.compose.ui.unit.dp
4546
import com.yapp.ndgl.core.ui.theme.NDGLTheme
4647
import com.yapp.ndgl.feature.travelhelper.R
@@ -113,7 +114,7 @@ internal fun CurrencyCalculatorSection(
113114
contentAlignment = Alignment.Center,
114115
) {
115116
Icon(
116-
imageVector = ImageVector.vectorResource(R.drawable.ic_24_updown),
117+
imageVector = ImageVector.vectorResource(CoreR.drawable.ic_24_change),
117118
contentDescription = null,
118119
modifier = Modifier.size(24.dp),
119120
tint = NDGLTheme.colors.black900,
@@ -173,7 +174,7 @@ private fun CurrencyCard(
173174
) {
174175
ForeignCurrencyLeft(
175176
modifier = Modifier.wrapContentWidth(),
176-
showCurrencySelector = isEditable,
177+
isEditable = isEditable,
177178
flagEmoji = flagEmoji,
178179
currencyName = currencyName,
179180
currencyCode = currencyCode,
@@ -194,7 +195,7 @@ private fun CurrencyCard(
194195
@Composable
195196
private fun ForeignCurrencyLeft(
196197
modifier: Modifier,
197-
showCurrencySelector: Boolean,
198+
isEditable: Boolean,
198199
flagEmoji: String,
199200
currencyName: String,
200201
currencyCode: String,
@@ -211,7 +212,7 @@ private fun ForeignCurrencyLeft(
211212
shape = RoundedCornerShape(topStart = 4.dp, bottomStart = 4.dp),
212213
)
213214
.then(
214-
if (showCurrencySelector) {
215+
if (isEditable) {
215216
Modifier.clickable(
216217
interactionSource = null,
217218
indication = ripple(),
@@ -241,20 +242,20 @@ private fun ForeignCurrencyLeft(
241242
Text(
242243
text = currencyName,
243244
modifier = Modifier.fillMaxWidth(),
244-
color = NDGLTheme.colors.black800,
245+
color = if (isEditable) NDGLTheme.colors.black800 else NDGLTheme.colors.black500,
245246
overflow = TextOverflow.Ellipsis,
246247
maxLines = 1,
247248
style = NDGLTheme.typography.bodyLgSemiBold,
248249
)
249250
Text(
250251
text = currencyCode,
251252
modifier = Modifier.fillMaxWidth(),
252-
color = NDGLTheme.colors.black400,
253+
color = if (isEditable) NDGLTheme.colors.black400 else NDGLTheme.colors.black300,
253254
style = NDGLTheme.typography.bodyMdMedium,
254255
)
255256
}
256257
}
257-
if (showCurrencySelector) {
258+
if (isEditable) {
258259
Icon(
259260
imageVector = ImageVector.vectorResource(CoreR.drawable.ic_24_chevron_down),
260261
contentDescription = null,
@@ -265,7 +266,7 @@ private fun ForeignCurrencyLeft(
265266
Box(modifier = Modifier.size(24.dp))
266267
}
267268
}
268-
if (showCurrencySelector) {
269+
if (isEditable) {
269270
DropdownMenu(
270271
expanded = expanded,
271272
onDismissRequest = { expanded = false },
@@ -352,10 +353,17 @@ private fun ForeignCurrencyRight(
352353
onValueChange = onInputChange,
353354
modifier = Modifier.fillMaxWidth(),
354355
readOnly = isEditable.not(),
355-
textStyle = NDGLTheme.typography.bodyLgSemiBold.copy(
356-
color = NDGLTheme.colors.black800,
357-
textAlign = TextAlign.End,
358-
),
356+
textStyle = if (isEditable) {
357+
NDGLTheme.typography.bodyLgSemiBold.copy(
358+
color = NDGLTheme.colors.green500,
359+
textAlign = TextAlign.End,
360+
)
361+
} else {
362+
NDGLTheme.typography.bodyLgMedium.copy(
363+
color = NDGLTheme.colors.black500,
364+
textAlign = TextAlign.End,
365+
)
366+
},
359367
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal),
360368
singleLine = true,
361369
cursorBrush = SolidColor(NDGLTheme.colors.green500),
@@ -389,7 +397,7 @@ private fun ForeignCurrencyRight(
389397
Text(
390398
text = "$displayInput $currencyLabel",
391399
modifier = Modifier.fillMaxWidth(),
392-
color = NDGLTheme.colors.black400,
400+
color = if (isEditable) NDGLTheme.colors.black400 else NDGLTheme.colors.black300,
393401
textAlign = TextAlign.End,
394402
overflow = TextOverflow.Ellipsis,
395403
maxLines = 1,
@@ -437,3 +445,37 @@ private class ThousandSeparatorTransformation : VisualTransformation {
437445
return TransformedText(AnnotatedString(formatted), offsetMapping)
438446
}
439447
}
448+
449+
@Preview(showBackground = true)
450+
@Composable
451+
private fun CurrencyCalculatorSectionPreview() {
452+
NDGLTheme {
453+
CurrencyCalculatorSection(
454+
exchangeRateInfo = ExchangeRateInfo(
455+
topCurrency = TravelHelperState.CurrencyInfo(
456+
currencyCode = "JPY",
457+
currencyLabel = "",
458+
countryName = "일본",
459+
flagEmoji = "\uD83C\uDDEF\uD83C\uDDF5",
460+
),
461+
bottomCurrency = TravelHelperState.CurrencyInfo(
462+
currencyCode = "KRW",
463+
currencyLabel = "",
464+
countryName = "대한민국",
465+
flagEmoji = "\uD83C\uDDF0\uD83C\uDDF7",
466+
),
467+
rate = 9.5,
468+
rateDate = java.time.LocalDate.of(2025, 1, 1),
469+
),
470+
currencyInput = "1000",
471+
convertedAmount = 9500.0,
472+
availableCurrencies = persistentListOf(
473+
CurrencyOption(currencyCode = "JPY", countryName = "일본"),
474+
CurrencyOption(currencyCode = "KRW", countryName = "대한민국"),
475+
),
476+
onInputChange = {},
477+
onSwap = {},
478+
onCurrencySelect = {},
479+
)
480+
}
481+
}

feature/travel-helper/src/main/res/drawable/ic_24_updown.xml

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)