Compare commits
2 Commits
feb6ea449f
...
6ddf0dda6c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ddf0dda6c | ||
|
|
ba24c60058 |
3
app/src/main/java/com/mob/utsmyanmar/AGENTS.md
Normal file
3
app/src/main/java/com/mob/utsmyanmar/AGENTS.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
## Working agreements
|
||||||
|
|
||||||
|
- use Scaffold and AppBar() in every main Screen
|
||||||
@ -1,12 +1,48 @@
|
|||||||
package com.mob.utsmyanmar.ui.amount
|
package com.mob.utsmyanmar.ui.amount
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.statusBarsPadding
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.ArrowBackIosNew
|
||||||
|
import androidx.compose.material.icons.rounded.Backspace
|
||||||
|
import androidx.compose.material.icons.rounded.KeyboardArrowLeft
|
||||||
|
import androidx.compose.material3.Button
|
||||||
|
import androidx.compose.material3.ButtonDefaults
|
||||||
|
import androidx.compose.material3.Card
|
||||||
|
import androidx.compose.material3.CardDefaults
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.IconButton
|
||||||
|
import androidx.compose.material3.Scaffold
|
||||||
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import com.mob.utsmyanmar.ui.components.NumericEntryScreen
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.shadow
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import com.mob.utsmyanmar.ui.components.appbar.AppBar
|
||||||
import com.mob.utsmyanmar.ui.preview.P2Preview
|
import com.mob.utsmyanmar.ui.preview.P2Preview
|
||||||
|
import com.mob.utsmyanmar.ui.theme.Color
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AmountScreen(
|
fun AmountScreen(
|
||||||
@ -16,7 +52,14 @@ fun AmountScreen(
|
|||||||
) {
|
) {
|
||||||
var amount by remember { mutableStateOf("") }
|
var amount by remember { mutableStateOf("") }
|
||||||
|
|
||||||
|
Scaffold(
|
||||||
|
topBar = {
|
||||||
|
AppBar(title = title, icon = Icons.Default.ArrowBackIosNew, onIconClick = onBackClick)
|
||||||
|
}
|
||||||
|
) { paddingValues ->
|
||||||
|
|
||||||
NumericEntryScreen(
|
NumericEntryScreen(
|
||||||
|
modifier = Modifier.padding(paddingValues),
|
||||||
title = title,
|
title = title,
|
||||||
prompt = "Enter $title",
|
prompt = "Enter $title",
|
||||||
displayValue = formatAmount(amount.ifEmpty { "0" }),
|
displayValue = formatAmount(amount.ifEmpty { "0" }),
|
||||||
@ -40,6 +83,215 @@ fun AmountScreen(
|
|||||||
canDelete = amount.isNotEmpty()
|
canDelete = amount.isNotEmpty()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun NumericEntryScreen(
|
||||||
|
title: String,
|
||||||
|
prompt: String,
|
||||||
|
displayValue: String,
|
||||||
|
supportingText: String,
|
||||||
|
confirmText: String,
|
||||||
|
onBackClick: () -> Unit,
|
||||||
|
onCancelClick: () -> Unit,
|
||||||
|
onConfirmClick: () -> Unit,
|
||||||
|
onKeyClick: (String) -> Unit,
|
||||||
|
onDeleteClick: () -> Unit,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
prefixLabel: String? = null,
|
||||||
|
errorMessage: String? = null,
|
||||||
|
confirmEnabled: Boolean = true,
|
||||||
|
canDelete: Boolean = true,
|
||||||
|
keys: List<List<String>> = listOf(
|
||||||
|
listOf("1", "2", "3"),
|
||||||
|
listOf("4", "5", "6"),
|
||||||
|
listOf("7", "8", "9"),
|
||||||
|
listOf(".", "0", "00")
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(Color.IvoryBeige)
|
||||||
|
.navigationBarsPadding()
|
||||||
|
.statusBarsPadding()
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(horizontal = 20.dp)
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = prompt,
|
||||||
|
color = Color.Gray,
|
||||||
|
fontSize = 11.sp,
|
||||||
|
modifier = Modifier.align(Alignment.CenterHorizontally)
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.align(Alignment.CenterHorizontally),
|
||||||
|
verticalAlignment = Alignment.Bottom
|
||||||
|
) {
|
||||||
|
if (!prefixLabel.isNullOrBlank()) {
|
||||||
|
Text(
|
||||||
|
text = prefixLabel,
|
||||||
|
color = Color.LegacyRed,
|
||||||
|
fontSize = 13.sp,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
|
modifier = Modifier.padding(end = 10.dp, bottom = 6.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = displayValue,
|
||||||
|
color = Color.LegacyRed,
|
||||||
|
fontSize = 32.sp,
|
||||||
|
fontWeight = FontWeight.Bold
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(12.dp))
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = supportingText,
|
||||||
|
color = if (errorMessage == null) Color.Gray else Color.Error,
|
||||||
|
fontSize = 11.sp,
|
||||||
|
modifier = Modifier.align(Alignment.CenterHorizontally)
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(80.dp))
|
||||||
|
|
||||||
|
NumericKeypad(
|
||||||
|
keys = keys,
|
||||||
|
onKeyClick = onKeyClick
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
|
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(12.dp)
|
||||||
|
) {
|
||||||
|
Button(
|
||||||
|
onClick = onCancelClick,
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.height(56.dp),
|
||||||
|
shape = RoundedCornerShape(8.dp),
|
||||||
|
colors = ButtonDefaults.buttonColors(
|
||||||
|
containerColor = Color.White,
|
||||||
|
contentColor = Color.LegacyRed
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Text("Cancel")
|
||||||
|
}
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = onConfirmClick,
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.height(56.dp),
|
||||||
|
enabled = confirmEnabled,
|
||||||
|
shape = RoundedCornerShape(8.dp),
|
||||||
|
colors = ButtonDefaults.buttonColors(
|
||||||
|
containerColor = Color.LegacyRed,
|
||||||
|
contentColor = Color.White,
|
||||||
|
disabledContainerColor = Color.LegacyRed.copy(alpha = 0.5f),
|
||||||
|
disabledContentColor = Color.White
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = confirmText,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
fontWeight = FontWeight.Medium
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(18.dp))
|
||||||
|
}
|
||||||
|
|
||||||
|
Card(
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.TopEnd)
|
||||||
|
.padding(top = 25.dp, end = 20.dp)
|
||||||
|
.clickable(enabled = canDelete) {
|
||||||
|
onDeleteClick()
|
||||||
|
},
|
||||||
|
shape = RoundedCornerShape(18.dp),
|
||||||
|
colors = CardDefaults.cardColors(containerColor = Color.White),
|
||||||
|
elevation = CardDefaults.cardElevation(defaultElevation = 6.dp)
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Rounded.Backspace,
|
||||||
|
contentDescription = "Delete",
|
||||||
|
tint = if (canDelete) Color.LegacyRed else Color.Gray,
|
||||||
|
modifier = Modifier.padding(horizontal = 14.dp, vertical = 12.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun NumericKeypad(
|
||||||
|
keys: List<List<String>>,
|
||||||
|
onKeyClick: (String) -> Unit
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
verticalArrangement = Arrangement.spacedBy(6.dp)
|
||||||
|
) {
|
||||||
|
keys.forEach { row ->
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(6.dp)
|
||||||
|
) {
|
||||||
|
row.forEach { key ->
|
||||||
|
KeypadButton(
|
||||||
|
text = key,
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
onClick = { onKeyClick(key) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun KeypadButton(
|
||||||
|
text: String,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
onClick: () -> Unit
|
||||||
|
) {
|
||||||
|
val enabled = text.isNotBlank()
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier = modifier
|
||||||
|
.height(66.dp)
|
||||||
|
.shadow(
|
||||||
|
elevation = 2.dp,
|
||||||
|
shape = RoundedCornerShape(8.dp),
|
||||||
|
clip = false
|
||||||
|
)
|
||||||
|
.background(
|
||||||
|
color = Color.White,
|
||||||
|
shape = RoundedCornerShape(8.dp)
|
||||||
|
)
|
||||||
|
.clickable(enabled = enabled) { onClick() },
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = text,
|
||||||
|
color = if (enabled) Color.LegacyRed else Color.White,
|
||||||
|
fontSize = 24.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
textAlign = TextAlign.Center
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun formatAmount(value: String): String {
|
private fun formatAmount(value: String): String {
|
||||||
val normalized = value.ifEmpty { "0" }
|
val normalized = value.ifEmpty { "0" }
|
||||||
@ -89,3 +341,23 @@ private fun appendAmountValue(current: String, value: String): String {
|
|||||||
fun PreviewAmountScreen() {
|
fun PreviewAmountScreen() {
|
||||||
AmountScreen { }
|
AmountScreen { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Preview(showBackground = true)
|
||||||
|
@Composable
|
||||||
|
private fun PreviewNumericEntryScreen() {
|
||||||
|
NumericEntryScreen(
|
||||||
|
title = "Amount",
|
||||||
|
prompt = "Enter Amount",
|
||||||
|
displayValue = "12,500",
|
||||||
|
supportingText = "Enter the amount to continue",
|
||||||
|
confirmText = "Next",
|
||||||
|
onBackClick = {},
|
||||||
|
onCancelClick = {},
|
||||||
|
onConfirmClick = {},
|
||||||
|
onKeyClick = {},
|
||||||
|
onDeleteClick = {},
|
||||||
|
prefixLabel = "MMK",
|
||||||
|
confirmEnabled = true,
|
||||||
|
canDelete = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@ -1,270 +0,0 @@
|
|||||||
package com.mob.utsmyanmar.ui.components
|
|
||||||
|
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.clickable
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
|
||||||
import androidx.compose.foundation.layout.Box
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.Row
|
|
||||||
import androidx.compose.foundation.layout.Spacer
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.height
|
|
||||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.foundation.layout.statusBarsPadding
|
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.material.icons.Icons
|
|
||||||
import androidx.compose.material.icons.rounded.Backspace
|
|
||||||
import androidx.compose.material.icons.rounded.KeyboardArrowLeft
|
|
||||||
import androidx.compose.material3.Button
|
|
||||||
import androidx.compose.material3.ButtonDefaults
|
|
||||||
import androidx.compose.material3.Card
|
|
||||||
import androidx.compose.material3.CardDefaults
|
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.IconButton
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.draw.shadow
|
|
||||||
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
|
|
||||||
import com.mob.utsmyanmar.ui.theme.Color
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun NumericEntryScreen(
|
|
||||||
title: String,
|
|
||||||
prompt: String,
|
|
||||||
displayValue: String,
|
|
||||||
supportingText: String,
|
|
||||||
confirmText: String,
|
|
||||||
onBackClick: () -> Unit,
|
|
||||||
onCancelClick: () -> Unit,
|
|
||||||
onConfirmClick: () -> Unit,
|
|
||||||
onKeyClick: (String) -> Unit,
|
|
||||||
onDeleteClick: () -> Unit,
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
prefixLabel: String? = null,
|
|
||||||
errorMessage: String? = null,
|
|
||||||
confirmEnabled: Boolean = true,
|
|
||||||
canDelete: Boolean = true,
|
|
||||||
keys: List<List<String>> = listOf(
|
|
||||||
listOf("1", "2", "3"),
|
|
||||||
listOf("4", "5", "6"),
|
|
||||||
listOf("7", "8", "9"),
|
|
||||||
listOf(".", "0", "00")
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
Box(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.background(Color.IvoryBeige)
|
|
||||||
.navigationBarsPadding()
|
|
||||||
.statusBarsPadding()
|
|
||||||
) {
|
|
||||||
Column(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.padding(horizontal = 20.dp)
|
|
||||||
) {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.height(56.dp),
|
|
||||||
contentAlignment = Alignment.Center
|
|
||||||
) {
|
|
||||||
IconButton(
|
|
||||||
onClick = onBackClick,
|
|
||||||
modifier = Modifier.align(Alignment.CenterStart)
|
|
||||||
) {
|
|
||||||
Icon(
|
|
||||||
imageVector = Icons.Rounded.KeyboardArrowLeft,
|
|
||||||
contentDescription = "Back",
|
|
||||||
tint = Color.LegacyRed
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = title,
|
|
||||||
color = Color.LegacyRed,
|
|
||||||
fontSize = 14.sp,
|
|
||||||
fontWeight = FontWeight.Bold
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(36.dp))
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = prompt,
|
|
||||||
color = Color.Gray,
|
|
||||||
fontSize = 11.sp,
|
|
||||||
modifier = Modifier.align(Alignment.CenterHorizontally)
|
|
||||||
)
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
|
||||||
|
|
||||||
Row(
|
|
||||||
modifier = Modifier.align(Alignment.CenterHorizontally),
|
|
||||||
verticalAlignment = Alignment.Bottom
|
|
||||||
) {
|
|
||||||
if (!prefixLabel.isNullOrBlank()) {
|
|
||||||
Text(
|
|
||||||
text = prefixLabel,
|
|
||||||
color = Color.LegacyRed,
|
|
||||||
fontSize = 13.sp,
|
|
||||||
fontWeight = FontWeight.Medium,
|
|
||||||
modifier = Modifier.padding(end = 10.dp, bottom = 6.dp)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = displayValue,
|
|
||||||
color = Color.LegacyRed,
|
|
||||||
fontSize = 32.sp,
|
|
||||||
fontWeight = FontWeight.Bold
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(12.dp))
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = supportingText,
|
|
||||||
color = if (errorMessage == null) Color.Gray else Color.Error,
|
|
||||||
fontSize = 11.sp,
|
|
||||||
modifier = Modifier.align(Alignment.CenterHorizontally)
|
|
||||||
)
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(28.dp))
|
|
||||||
|
|
||||||
NumericKeypad(
|
|
||||||
keys = keys,
|
|
||||||
onKeyClick = onKeyClick
|
|
||||||
)
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
|
||||||
|
|
||||||
Row(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(12.dp)
|
|
||||||
) {
|
|
||||||
Button(
|
|
||||||
onClick = onCancelClick,
|
|
||||||
modifier = Modifier
|
|
||||||
.weight(1f)
|
|
||||||
.height(56.dp),
|
|
||||||
shape = RoundedCornerShape(8.dp),
|
|
||||||
colors = ButtonDefaults.buttonColors(
|
|
||||||
containerColor = Color.White,
|
|
||||||
contentColor = Color.LegacyRed
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
Text("Cancel")
|
|
||||||
}
|
|
||||||
|
|
||||||
Button(
|
|
||||||
onClick = onConfirmClick,
|
|
||||||
modifier = Modifier
|
|
||||||
.weight(1f)
|
|
||||||
.height(56.dp),
|
|
||||||
enabled = confirmEnabled,
|
|
||||||
shape = RoundedCornerShape(8.dp),
|
|
||||||
colors = ButtonDefaults.buttonColors(
|
|
||||||
containerColor = Color.LegacyRed,
|
|
||||||
contentColor = Color.White,
|
|
||||||
disabledContainerColor = Color.LegacyRed.copy(alpha = 0.5f),
|
|
||||||
disabledContentColor = Color.White
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = confirmText,
|
|
||||||
fontSize = 14.sp,
|
|
||||||
fontWeight = FontWeight.Medium
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(18.dp))
|
|
||||||
}
|
|
||||||
|
|
||||||
Card(
|
|
||||||
modifier = Modifier
|
|
||||||
.align(Alignment.TopEnd)
|
|
||||||
.padding(top = 110.dp, end = 20.dp)
|
|
||||||
.clickable(enabled = canDelete) {
|
|
||||||
onDeleteClick()
|
|
||||||
},
|
|
||||||
shape = RoundedCornerShape(18.dp),
|
|
||||||
colors = CardDefaults.cardColors(containerColor = Color.White),
|
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 6.dp)
|
|
||||||
) {
|
|
||||||
Icon(
|
|
||||||
imageVector = Icons.Rounded.Backspace,
|
|
||||||
contentDescription = "Delete",
|
|
||||||
tint = if (canDelete) Color.LegacyRed else Color.Gray,
|
|
||||||
modifier = Modifier.padding(horizontal = 14.dp, vertical = 12.dp)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun NumericKeypad(
|
|
||||||
keys: List<List<String>>,
|
|
||||||
onKeyClick: (String) -> Unit
|
|
||||||
) {
|
|
||||||
Column(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
verticalArrangement = Arrangement.spacedBy(6.dp)
|
|
||||||
) {
|
|
||||||
keys.forEach { row ->
|
|
||||||
Row(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(6.dp)
|
|
||||||
) {
|
|
||||||
row.forEach { key ->
|
|
||||||
KeypadButton(
|
|
||||||
text = key,
|
|
||||||
modifier = Modifier.weight(1f),
|
|
||||||
onClick = { onKeyClick(key) }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun KeypadButton(
|
|
||||||
text: String,
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
onClick: () -> Unit
|
|
||||||
) {
|
|
||||||
val enabled = text.isNotBlank()
|
|
||||||
|
|
||||||
Box(
|
|
||||||
modifier = modifier
|
|
||||||
.height(66.dp)
|
|
||||||
.shadow(
|
|
||||||
elevation = 2.dp,
|
|
||||||
shape = RoundedCornerShape(8.dp),
|
|
||||||
clip = false
|
|
||||||
)
|
|
||||||
.background(
|
|
||||||
color = Color.White,
|
|
||||||
shape = RoundedCornerShape(8.dp)
|
|
||||||
)
|
|
||||||
.clickable(enabled = enabled) { onClick() },
|
|
||||||
contentAlignment = Alignment.Center
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = text,
|
|
||||||
color = if (enabled) Color.LegacyRed else Color.White,
|
|
||||||
fontSize = 24.sp,
|
|
||||||
fontWeight = FontWeight.Normal,
|
|
||||||
textAlign = TextAlign.Center
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -24,7 +24,7 @@ import com.mob.utsmyanmar.ui.print_receipt.PrintReceiptScreen
|
|||||||
import com.mob.utsmyanmar.ui.refund_rrn.InputRrnRoute
|
import com.mob.utsmyanmar.ui.refund_rrn.InputRrnRoute
|
||||||
import com.mob.utsmyanmar.ui.sign_on.SignOnResultScreen
|
import com.mob.utsmyanmar.ui.sign_on.SignOnResultScreen
|
||||||
import com.mob.utsmyanmar.ui.sign_on.SignOnRoute
|
import com.mob.utsmyanmar.ui.sign_on.SignOnRoute
|
||||||
import com.mob.utsmyanmar.ui.sending_to_host.SendingToHostRoute
|
import com.mob.utsmyanmar.ui.sending_to_host.ProcessingRoute
|
||||||
import com.mob.utsmyanmar.ui.settlement.SettlementScreen
|
import com.mob.utsmyanmar.ui.settlement.SettlementScreen
|
||||||
import com.mob.utsmyanmar.ui.transaction_result.TransactionResultRoute
|
import com.mob.utsmyanmar.ui.transaction_result.TransactionResultRoute
|
||||||
import com.mob.utsmyanmar.ui.sale_void.TranDetailPage
|
import com.mob.utsmyanmar.ui.sale_void.TranDetailPage
|
||||||
@ -118,7 +118,7 @@ fun AppNavGraph(
|
|||||||
onBack = { navController.popBackStack() },
|
onBack = { navController.popBackStack() },
|
||||||
onStartSettlement = {
|
onStartSettlement = {
|
||||||
sharedViewModel.transactionsType.value = com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType.SETTLEMENT
|
sharedViewModel.transactionsType.value = com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType.SETTLEMENT
|
||||||
navController.navigate(Routes.SendingToHost.route) {
|
navController.navigate(Routes.Processing.route) {
|
||||||
popUpTo(Routes.Settlement.route) {
|
popUpTo(Routes.Settlement.route) {
|
||||||
inclusive = true
|
inclusive = true
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ fun AppNavGraph(
|
|||||||
onProceedVoid = { payDetail ->
|
onProceedVoid = { payDetail ->
|
||||||
sharedViewModel.transactionsType.value = com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType.VOID
|
sharedViewModel.transactionsType.value = com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType.VOID
|
||||||
sharedViewModel.payDetail.value = payDetail
|
sharedViewModel.payDetail.value = payDetail
|
||||||
navController.navigate(Routes.SendingToHost.route) {
|
navController.navigate(Routes.Processing.route) {
|
||||||
popUpTo(Routes.VoidTranDetail.route) {
|
popUpTo(Routes.VoidTranDetail.route) {
|
||||||
inclusive = true
|
inclusive = true
|
||||||
}
|
}
|
||||||
@ -320,8 +320,8 @@ fun AppNavGraph(
|
|||||||
launchSingleTop = true
|
launchSingleTop = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onNavigateSendingToHost = {
|
onNavigateProcessing = {
|
||||||
navController.navigate(Routes.SendingToHost.route) {
|
navController.navigate(Routes.Processing.route) {
|
||||||
popUpTo(Routes.PinPad.route) {
|
popUpTo(Routes.PinPad.route) {
|
||||||
inclusive = true
|
inclusive = true
|
||||||
}
|
}
|
||||||
@ -338,8 +338,8 @@ fun AppNavGraph(
|
|||||||
InputRrnRoute(
|
InputRrnRoute(
|
||||||
sharedViewModel = sharedViewModel,
|
sharedViewModel = sharedViewModel,
|
||||||
onBack = { navController.popBackStack() },
|
onBack = { navController.popBackStack() },
|
||||||
onNavigateSendingToHost = {
|
onNavigateProcessing = {
|
||||||
navController.navigate(Routes.SendingToHost.route) {
|
navController.navigate(Routes.Processing.route) {
|
||||||
popUpTo(Routes.InputRrn.route) {
|
popUpTo(Routes.InputRrn.route) {
|
||||||
inclusive = true
|
inclusive = true
|
||||||
}
|
}
|
||||||
@ -349,14 +349,14 @@ fun AppNavGraph(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
composable(Routes.SendingToHost.route) {
|
composable(Routes.Processing.route) {
|
||||||
val sharedViewModel: SharedViewModel = hiltViewModel(activity)
|
val sharedViewModel: SharedViewModel = hiltViewModel(activity)
|
||||||
|
|
||||||
SendingToHostRoute(
|
ProcessingRoute(
|
||||||
sharedViewModel = sharedViewModel,
|
sharedViewModel = sharedViewModel,
|
||||||
onNavigateTransactionResult = {
|
onNavigateTransactionResult = {
|
||||||
navController.navigate(Routes.TransactionResult.route) {
|
navController.navigate(Routes.TransactionResult.route) {
|
||||||
popUpTo(Routes.SendingToHost.route) {
|
popUpTo(Routes.Processing.route) {
|
||||||
inclusive = true
|
inclusive = true
|
||||||
}
|
}
|
||||||
launchSingleTop = true
|
launchSingleTop = true
|
||||||
|
|||||||
@ -23,7 +23,7 @@ sealed class Routes(val route: String) {
|
|||||||
data object ProcessingCard : Routes("processing_card")
|
data object ProcessingCard : Routes("processing_card")
|
||||||
data object PinPad : Routes("pin_pad")
|
data object PinPad : Routes("pin_pad")
|
||||||
data object InputRrn : Routes("input_rrn")
|
data object InputRrn : Routes("input_rrn")
|
||||||
data object SendingToHost : Routes("sending_to_host")
|
data object Processing : Routes("processing")
|
||||||
data object TransactionResult : Routes("transaction_result")
|
data object TransactionResult : Routes("transaction_result")
|
||||||
data object PrintReceipt : Routes("print_receipt")
|
data object PrintReceipt : Routes("print_receipt")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ fun PinPadRoute(
|
|||||||
sharedViewModel: SharedViewModel,
|
sharedViewModel: SharedViewModel,
|
||||||
transProcessViewModel: TransProcessViewModel,
|
transProcessViewModel: TransProcessViewModel,
|
||||||
onNavigateInputRrn: () -> Unit,
|
onNavigateInputRrn: () -> Unit,
|
||||||
onNavigateSendingToHost: () -> Unit,
|
onNavigateProcessing: () -> Unit,
|
||||||
onBack: () -> Unit
|
onBack: () -> Unit
|
||||||
) {
|
) {
|
||||||
val pinText by pinPadViewModel.pinText.collectAsStateWithLifecycle()
|
val pinText by pinPadViewModel.pinText.collectAsStateWithLifecycle()
|
||||||
@ -41,7 +41,7 @@ fun PinPadRoute(
|
|||||||
if (sharedViewModel.transactionsType.value == TransactionsType.REFUND) {
|
if (sharedViewModel.transactionsType.value == TransactionsType.REFUND) {
|
||||||
onNavigateInputRrn()
|
onNavigateInputRrn()
|
||||||
} else {
|
} else {
|
||||||
onNavigateSendingToHost()
|
onNavigateProcessing()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import androidx.compose.runtime.getValue
|
|||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import com.mob.utsmyanmar.ui.components.NumericEntryScreen
|
import com.mob.utsmyanmar.ui.amount.NumericEntryScreen
|
||||||
import com.mob.utsmyanmar.viewmodel.SharedViewModel
|
import com.mob.utsmyanmar.viewmodel.SharedViewModel
|
||||||
import com.utsmyanmar.paylibs.utils.POSUtil
|
import com.utsmyanmar.paylibs.utils.POSUtil
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ private const val RRN_MAX_LENGTH = 12
|
|||||||
fun InputRrnRoute(
|
fun InputRrnRoute(
|
||||||
sharedViewModel: SharedViewModel,
|
sharedViewModel: SharedViewModel,
|
||||||
onBack: () -> Unit,
|
onBack: () -> Unit,
|
||||||
onNavigateSendingToHost: () -> Unit
|
onNavigateProcessing: () -> Unit
|
||||||
) {
|
) {
|
||||||
var rrn by rememberSaveable {
|
var rrn by rememberSaveable {
|
||||||
mutableStateOf(sharedViewModel.rrNNo.value.orEmpty())
|
mutableStateOf(sharedViewModel.rrNNo.value.orEmpty())
|
||||||
@ -42,7 +42,7 @@ fun InputRrnRoute(
|
|||||||
payDetail.referNo = trimmedRrn
|
payDetail.referNo = trimmedRrn
|
||||||
sharedViewModel.payDetail.value = payDetail
|
sharedViewModel.payDetail.value = payDetail
|
||||||
}
|
}
|
||||||
onNavigateSendingToHost()
|
onNavigateProcessing()
|
||||||
},
|
},
|
||||||
onKeyClick = { value ->
|
onKeyClick = { value ->
|
||||||
rrn = appendRrnValue(rrn, value)
|
rrn = appendRrnValue(rrn, value)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import kotlinx.coroutines.delay
|
|||||||
private const val MOCK_HOST_DELAY_MS = 2000L
|
private const val MOCK_HOST_DELAY_MS = 2000L
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SendingToHostRoute(
|
fun ProcessingRoute(
|
||||||
sharedViewModel: SharedViewModel,
|
sharedViewModel: SharedViewModel,
|
||||||
onNavigateTransactionResult: () -> Unit
|
onNavigateTransactionResult: () -> Unit
|
||||||
) {
|
) {
|
||||||
@ -18,5 +18,5 @@ fun SendingToHostRoute(
|
|||||||
onNavigateTransactionResult()
|
onNavigateTransactionResult()
|
||||||
}
|
}
|
||||||
|
|
||||||
SendingToHostScreen()
|
ProcessingScreen()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import com.mob.utsmyanmar.ui.theme.Primary
|
|||||||
import com.mob.utsmyanmar.ui.theme.White
|
import com.mob.utsmyanmar.ui.theme.White
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SendingToHostScreen() {
|
fun ProcessingScreen() {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
containerColor = White
|
containerColor = White
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
@ -57,7 +57,7 @@ fun SendingToHostScreen() {
|
|||||||
Spacer(modifier = Modifier.height(20.dp))
|
Spacer(modifier = Modifier.height(20.dp))
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "Sending Data",
|
text = "Processing",
|
||||||
color = White,
|
color = White,
|
||||||
fontSize = 24.sp,
|
fontSize = 24.sp,
|
||||||
fontWeight = FontWeight.Bold
|
fontWeight = FontWeight.Bold
|
||||||
@ -66,7 +66,7 @@ fun SendingToHostScreen() {
|
|||||||
Spacer(modifier = Modifier.height(10.dp))
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "Please wait while we send transaction data to host.",
|
text = "Please wait while your transaction is being processed.",
|
||||||
color = White,
|
color = White,
|
||||||
fontSize = 15.sp,
|
fontSize = 15.sp,
|
||||||
textAlign = TextAlign.Center
|
textAlign = TextAlign.Center
|
||||||
@ -77,7 +77,7 @@ fun SendingToHostScreen() {
|
|||||||
Spacer(modifier = Modifier.height(24.dp))
|
Spacer(modifier = Modifier.height(24.dp))
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "Mock host communication in progress.",
|
text = "Transaction processing in progress.",
|
||||||
color = Black,
|
color = Black,
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
textAlign = TextAlign.Center
|
textAlign = TextAlign.Center
|
||||||
|
|||||||
@ -347,12 +347,12 @@ public class ISOSocket {
|
|||||||
* If it is not secondary, go with primary
|
* If it is not secondary, go with primary
|
||||||
*/
|
*/
|
||||||
if (!isSwitchIp) {
|
if (!isSwitchIp) {
|
||||||
serverIP = getIp();
|
// serverIP = getIp();
|
||||||
serverPort = getPort();
|
// serverPort = getPort();
|
||||||
// serverIP = "posuat.myanmarorientalbank.com";
|
// serverIP = "posuat.myanmarorientalbank.com";
|
||||||
// serverPort = 5033;
|
// serverPort = 5033;
|
||||||
// serverIP = "10.255.255.195";
|
serverIP = "192.168.100.9";
|
||||||
// serverPort = 5555;
|
serverPort = 5001;
|
||||||
} else {
|
} else {
|
||||||
isSwitchIp = false;
|
isSwitchIp = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user