diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 13f4826..b87499b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -43,8 +43,8 @@ android { dimension = "env" applicationIdSuffix = ".uat" versionNameSuffix = "-UAT" - versionCode = 10 - versionName = "2.8" + versionCode = 11 + versionName = "2.9" buildConfigField("String", "ENV", "\"UAT\"") resValue("string", "app_name", "MOB-UAT") } diff --git a/app/src/main/java/com/mob/utsmyanmar/ui/cardwaiting/CardWaitingScreen.kt b/app/src/main/java/com/mob/utsmyanmar/ui/cardwaiting/CardWaitingScreen.kt index 80bbca9..58e493c 100644 --- a/app/src/main/java/com/mob/utsmyanmar/ui/cardwaiting/CardWaitingScreen.kt +++ b/app/src/main/java/com/mob/utsmyanmar/ui/cardwaiting/CardWaitingScreen.kt @@ -2,6 +2,7 @@ package com.mob.utsmyanmar.ui.cardwaiting import androidx.activity.compose.BackHandler import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement @@ -38,7 +39,9 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.rotate +import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp @@ -134,33 +137,33 @@ private fun CardWaitingScreenContent( Text( text = "AMOUNT TO PAY", color = Color.Black, - style = MaterialTheme.typography.labelSmall + style = MaterialTheme.typography.titleMedium, ) Spacer(modifier = Modifier.height(6.dp)) - Row(verticalAlignment = Alignment.Bottom) { - Text( - text = amount, - color = Color.LegacyRed, - style = MaterialTheme.typography.displayMedium - ) +// Row(verticalAlignment = Alignment.Bottom) { + Text( + text = amount, + color = Color.LegacyRed, + style = MaterialTheme.typography.displayLarge + ) - Spacer(modifier = Modifier.width(6.dp)) + Spacer(modifier = Modifier.width(6.dp)) - Text( - text = "MMK", - color = Color.LegacyRed, - style = MaterialTheme.typography.labelSmall, - modifier = Modifier.padding(bottom = 6.dp) - ) - } + Text( + text = "MMK", + color = Color.LegacyRed, + style = MaterialTheme.typography.displaySmall.copy(fontWeight = FontWeight.Medium), + modifier = Modifier.padding(bottom = 6.dp) + ) +// } - Spacer(modifier = Modifier.height(32.dp)) +// Spacer(modifier = Modifier.height(32.dp)) ContactlessCircle(isLoading = uiState.isLoading) - Spacer(modifier = Modifier.height(24.dp)) +// Spacer(modifier = Modifier.height(24.dp)) Text( text = when { @@ -206,12 +209,9 @@ private fun CardWaitingScreenContent( ) } - Spacer(modifier = Modifier.height(12.dp)) - + Spacer(modifier = Modifier.height(10.dp)) InsertCardRow(onMockClick = onMockClick) - - Spacer(modifier = Modifier.height(18.dp)) - + Spacer(modifier = Modifier.height(10.dp)) Text( text = uiState.alertMessage, color = Color.Black, @@ -219,23 +219,13 @@ private fun CardWaitingScreenContent( textAlign = TextAlign.Center, lineHeight = 16.sp ) - - Spacer(modifier = Modifier.height(18.dp)) - -// StatusPanel(uiState = uiState) - + Spacer(modifier = Modifier.height(10.dp)) Spacer(modifier = Modifier.weight(1f)) - ManualEntryAction(onManualEntryClick = onManualEntryClick) - - Spacer(modifier = Modifier.height(18.dp)) - + Spacer(modifier = Modifier.height(10.dp)) CardLogoRow() - Spacer(modifier = Modifier.height(34.dp)) - PoweredByMob() - Spacer(modifier = Modifier.height(12.dp)) } } @@ -292,7 +282,7 @@ private fun CircleBorder( } @Composable -private fun InsertCardRow(onMockClick: ()->Unit) { +private fun InsertCardRow(onMockClick: () -> Unit) { Row( modifier = Modifier.height(44.dp), verticalAlignment = Alignment.CenterVertically @@ -301,7 +291,8 @@ private fun InsertCardRow(onMockClick: ()->Unit) { painter = painterResource(id = R.drawable.ic_insert_card), contentDescription = null, tint = Color.LegacyRed, - modifier = Modifier.size(28.dp) + modifier = Modifier + .size(28.dp) .clickable(onClick = onMockClick) ) @@ -395,13 +386,49 @@ private fun CardLogoRow() { .fillMaxWidth() .height(42.dp) .padding(horizontal = 14.dp), - horizontalArrangement = Arrangement.SpaceBetween, + horizontalArrangement = Arrangement.SpaceEvenly, verticalAlignment = Alignment.CenterVertically ) { - Text("VISA", style = MaterialTheme.typography.titleLarge) - Text("MC", style = MaterialTheme.typography.titleMedium) - Text("MPU", style = MaterialTheme.typography.titleLarge) - Text("UnionPay", style = MaterialTheme.typography.labelMedium) + CardLogo( + icon = painterResource(R.drawable.logo_visa), + name = "visa", + ) + CardLogo( + icon = painterResource(R.drawable.logo_master), + name = "master", + ) + CardLogo( + icon = painterResource(R.drawable.logo_mpu), + name = "master", + ) + CardLogo( + icon = painterResource(R.drawable.logo_union_pay), + name = "master", + ) + } + } +} + +@Composable +private fun CardLogo( + icon: Painter, + name: String, + modifier: Modifier = Modifier +) { + Surface( + modifier = modifier, + shape = RoundedCornerShape(4.dp), + color = Color.White + ) { + Box( + modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp), + contentAlignment = Alignment.Center + ) { + Image( + painter = icon, + contentDescription = name, + modifier = Modifier.height(30.dp) + ) } } } diff --git a/app/src/main/java/com/mob/utsmyanmar/ui/input_amount/InputAmountScreen.kt b/app/src/main/java/com/mob/utsmyanmar/ui/input_amount/InputAmountScreen.kt index 3e76294..4dddc7d 100644 --- a/app/src/main/java/com/mob/utsmyanmar/ui/input_amount/InputAmountScreen.kt +++ b/app/src/main/java/com/mob/utsmyanmar/ui/input_amount/InputAmountScreen.kt @@ -49,17 +49,23 @@ fun InputAmount( title: String = "Amount", onBackClick: () -> Unit = {}, onChargeClick: (String) -> Unit = {} -){ +) { var amount by remember { mutableStateOf("") } val prefixLabel = "MMK" val supportingText = "Enter the amount to continue" Scaffold( - topBar = { AppBar(title = "Amount", icon = Icons.AutoMirrored.Rounded.ArrowBack, onIconClick = onBackClick) }, + topBar = { + AppBar( + title = "Amount", + icon = Icons.AutoMirrored.Rounded.ArrowBack, + onIconClick = onBackClick + ) + }, containerColor = Color.IvoryBeige - ) {paddingValues -> - + ) { paddingValues -> + Column( modifier = Modifier .padding(paddingValues) @@ -72,9 +78,10 @@ fun InputAmount( modifier = Modifier .fillMaxSize() .weight(2f), - ){ + ) { Card( - modifier = Modifier.align(Alignment.CenterEnd) + modifier = Modifier + .align(Alignment.CenterEnd) .clickable(enabled = true) { amount = amount.dropLast(1) }, @@ -102,26 +109,28 @@ fun InputAmount( ) Spacer(modifier = Modifier.height(8.dp)) - Row( - modifier = Modifier.align(Alignment.CenterHorizontally), - verticalAlignment = Alignment.Bottom - ) { - if (prefixLabel.isNotBlank()) { - Text( - text = prefixLabel, - color = Color.LegacyRed, - style = MaterialTheme.typography.titleMedium.copy(fontWeight = FontWeight.Medium), - modifier = Modifier.padding(end = 10.dp, bottom = 6.dp) - ) - } +// Row( +// modifier = Modifier.align(Alignment.CenterHorizontally), +// verticalAlignment = Alignment.Bottom +// ) { + Text( + text = formatAmount(amount.ifEmpty { "0" }), + color = Color.LegacyRed, + style = MaterialTheme.typography.displayLarge + ) + if (prefixLabel.isNotBlank()) { Text( - text = formatAmount(amount.ifEmpty { "0" }), + text = prefixLabel, color = Color.LegacyRed, - style = MaterialTheme.typography.displayLarge + style = MaterialTheme.typography.displaySmall.copy(fontWeight = FontWeight.Medium), + modifier = Modifier.padding(end = 10.dp, bottom = 6.dp) ) } + +// } + Spacer(modifier = Modifier.height(14.dp)) Text( @@ -132,14 +141,14 @@ fun InputAmount( ) } } - + //second container Column( modifier = Modifier .fillMaxWidth() .weight(3f), verticalArrangement = Arrangement.Bottom - ){ + ) { NumericKeypad( keys = amountKeys, modifier = Modifier.fillMaxSize(), @@ -148,14 +157,14 @@ fun InputAmount( } ) } - + Spacer(Modifier.height(16.dp)) //third container Box( modifier = Modifier .fillMaxWidth() .weight(0.5f) - ){ + ) { Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(12.dp) @@ -178,7 +187,8 @@ fun InputAmount( onClick = { if (amount.isNotEmpty()) { onChargeClick(amount) - } }, + } + }, modifier = Modifier .weight(1f) .height(56.dp), @@ -191,14 +201,14 @@ fun InputAmount( disabledContentColor = Color.White ) ) { - Text( - text = "Next", - style = MaterialTheme.typography.titleSmall - ) + Text( + text = "Next", + style = MaterialTheme.typography.titleSmall + ) } } } - + } } } @@ -250,6 +260,6 @@ private fun formatAmount(value: String): String { @P2Preview @P3Preview @Composable -fun PreviewInputAmount(){ +fun PreviewInputAmount() { InputAmount(); } \ No newline at end of file diff --git a/app/src/main/java/com/mob/utsmyanmar/ui/print_receipt/PrintReceiptScreen.kt b/app/src/main/java/com/mob/utsmyanmar/ui/print_receipt/PrintReceiptScreen.kt index d73e96a..723bbfb 100644 --- a/app/src/main/java/com/mob/utsmyanmar/ui/print_receipt/PrintReceiptScreen.kt +++ b/app/src/main/java/com/mob/utsmyanmar/ui/print_receipt/PrintReceiptScreen.kt @@ -64,11 +64,10 @@ fun PrintReceiptScreen( val scope = rememberCoroutineScope() val receiptOffsetY = remember { Animatable(0f) } val animationDuration = 5000 - val isReprint = sharedViewModel.isReprint.value == true val merchant_copy_autoprint = true val customer_copy_autoprint = false - var currentCopy by remember { mutableStateOf(if (isReprint) ReceiptCopy.CUSTOMER else ReceiptCopy.MERCHANT) } - var nextCopy by remember { mutableStateOf(if (isReprint) ReceiptCopy.CUSTOMER else ReceiptCopy.CUSTOMER) } + var currentCopy by remember { mutableStateOf(ReceiptCopy.MERCHANT) } + var nextCopy by remember { mutableStateOf(ReceiptCopy.CUSTOMER) } var isPrinting by remember { mutableStateOf(false) } suspend fun animatePrint() { @@ -83,8 +82,11 @@ fun PrintReceiptScreen( ) } + fun isReprintMode() = sharedViewModel.isReprint.value == true + fun doPrint(copy: ReceiptCopy, onFinished: () -> Unit) { - val actualCopy = if (isReprint && copy == ReceiptCopy.MERCHANT) ReceiptCopy.CUSTOMER else copy + val reprint = isReprintMode() + val actualCopy = if (reprint && copy == ReceiptCopy.MERCHANT) ReceiptCopy.CUSTOMER else copy currentCopy = actualCopy sharedViewModel.setPrintStatus( if (actualCopy == ReceiptCopy.MERCHANT) PrintStatus.FIRST_PRINT else PrintStatus.SECOND_PRINT @@ -94,15 +96,21 @@ fun PrintReceiptScreen( isPrinting = true animatePrint() isPrinting = false - nextCopy = if (isReprint) ReceiptCopy.CUSTOMER + nextCopy = if (reprint) ReceiptCopy.CUSTOMER else if (actualCopy == ReceiptCopy.MERCHANT) ReceiptCopy.CUSTOMER else ReceiptCopy.MERCHANT onFinished() } } LaunchedEffect(Unit) { + val reprint = isReprintMode() + if (reprint) { + currentCopy = ReceiptCopy.CUSTOMER + nextCopy = ReceiptCopy.CUSTOMER + } + sharedViewModel.isReprint.value = false when { - merchant_copy_autoprint && !isReprint -> doPrint(ReceiptCopy.MERCHANT) { } + merchant_copy_autoprint && !reprint -> doPrint(ReceiptCopy.MERCHANT) { } customer_copy_autoprint -> doPrint(ReceiptCopy.CUSTOMER) { } } } diff --git a/app/src/main/res/drawable/logo_master.xml b/app/src/main/res/drawable/logo_master.xml new file mode 100644 index 0000000..7fc67b2 --- /dev/null +++ b/app/src/main/res/drawable/logo_master.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/app/src/main/res/drawable/logo_mpu.png b/app/src/main/res/drawable/logo_mpu.png new file mode 100644 index 0000000..04f7a07 Binary files /dev/null and b/app/src/main/res/drawable/logo_mpu.png differ diff --git a/app/src/main/res/drawable/logo_union_pay.xml b/app/src/main/res/drawable/logo_union_pay.xml new file mode 100644 index 0000000..ea4a862 --- /dev/null +++ b/app/src/main/res/drawable/logo_union_pay.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/app/src/main/res/drawable/logo_visa.xml b/app/src/main/res/drawable/logo_visa.xml new file mode 100644 index 0000000..8d5bcec --- /dev/null +++ b/app/src/main/res/drawable/logo_visa.xml @@ -0,0 +1,18 @@ + + + + + +