ads screen added
This commit is contained in:
parent
72ecfbe4e7
commit
57dcd13c34
@ -73,6 +73,9 @@ dependencies {
|
||||
implementation(libs.androidx.compose.material.icons.extended)
|
||||
// splash screen
|
||||
implementation(libs.androidx.core.splashscreen)
|
||||
//image lib
|
||||
implementation("io.coil-kt.coil3:coil-compose:3.4.0")
|
||||
implementation("io.coil-kt.coil3:coil-network-okhttp:3.4.0")
|
||||
// local libs
|
||||
implementation(project(":baselib"))
|
||||
implementation(project(":mpulib"))
|
||||
|
||||
@ -3,6 +3,7 @@ package com.mob.utsmyanmar
|
||||
|
||||
import com.mob.utsmyanmar.utils.AppContextHolder
|
||||
import com.utsmyanmar.baselib.BaseApplication
|
||||
import com.utsmyanmar.paylibs.network.ISOSocket
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
|
||||
@HiltAndroidApp
|
||||
@ -11,6 +12,7 @@ class MyApplication : BaseApplication() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
AppContextHolder.init(this)
|
||||
ISOSocket.getInstance().initContext(this)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,419 +1,554 @@
|
||||
package com.mob.utsmyanmar.ui.dashboard
|
||||
|
||||
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
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.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.pager.HorizontalPager
|
||||
import androidx.compose.foundation.pager.rememberPagerState
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.*
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.BarChart
|
||||
import androidx.compose.material.icons.filled.Check
|
||||
import androidx.compose.material.icons.filled.ChevronRight
|
||||
import androidx.compose.material.icons.filled.Dashboard
|
||||
import androidx.compose.material.icons.filled.GridView
|
||||
import androidx.compose.material.icons.filled.History
|
||||
import androidx.compose.material.icons.filled.Link
|
||||
import androidx.compose.material.icons.filled.Menu
|
||||
import androidx.compose.material.icons.filled.PointOfSale
|
||||
import androidx.compose.material.icons.filled.QrCode
|
||||
import androidx.compose.material.icons.filled.Sync
|
||||
import androidx.compose.material.icons.filled.Wallet
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.CardDefaults
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.ModalDrawerSheet
|
||||
import androidx.compose.material3.ModalNavigationDrawer
|
||||
import androidx.compose.material3.NavigationDrawerItem
|
||||
import androidx.compose.material3.NavigationDrawerItemDefaults
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.VerticalDivider
|
||||
import androidx.compose.material3.rememberDrawerState
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import coil3.compose.AsyncImage
|
||||
import com.mob.utsmyanmar.ui.components.appbar.AppBar
|
||||
import com.mob.utsmyanmar.ui.preview.P2Preview
|
||||
import com.mob.utsmyanmar.ui.theme.Color
|
||||
import com.utsmyanmar.paylibs.sign_on.EchoTestProcess
|
||||
import com.utsmyanmar.paylibs.sign_on.SignOnListener
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@Composable
|
||||
fun DashboardScreen2(
|
||||
onNavigateAmount: (String) -> Unit = {},
|
||||
onNavigateSignOn: () -> Unit = {}
|
||||
) {
|
||||
Scaffold(
|
||||
containerColor = Color.IvoryBeige,
|
||||
topBar = {
|
||||
AppBar(title = "Dashboard")
|
||||
}
|
||||
) { paddingValues ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(paddingValues)
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 16.dp)
|
||||
) {
|
||||
Spacer(modifier = Modifier.height(0.dp))
|
||||
AdvertisingArea()
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
SummaryCard()
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
MenuGrid(
|
||||
onNavigateAmount = onNavigateAmount,
|
||||
onNavigateSignOn = onNavigateSignOn
|
||||
)
|
||||
Spacer(modifier = Modifier.height(18.dp))
|
||||
// RecentTransactionHeader()
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
// RecentTransactionList()
|
||||
}
|
||||
}
|
||||
}
|
||||
val drawerState = rememberDrawerState(initialValue = androidx.compose.material3.DrawerValue.Closed)
|
||||
val scope = rememberCoroutineScope()
|
||||
val mainHandler = remember { Handler(Looper.getMainLooper()) }
|
||||
var showHostActionDialog by remember { mutableStateOf(false) }
|
||||
var activeHostAction by remember { mutableStateOf("Log-On") }
|
||||
var isHostActionRunning by remember { mutableStateOf(false) }
|
||||
var dialogMessage by remember { mutableStateOf("") }
|
||||
|
||||
@Composable
|
||||
private fun AdvertisingArea() {
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
shape = RoundedCornerShape(0.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = Color.White),
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.height(170.dp) ) {
|
||||
|
||||
}
|
||||
}
|
||||
fun confirmationMessage(action: String) = "Do you want to start ${action.lowercase()}?"
|
||||
fun processingMessage(action: String) = "Sending ${action.lowercase()} request to host..."
|
||||
fun successMessage(action: String) = "$action success."
|
||||
fun failureMessage(action: String, resultCode: Int?) = "$action failed. Response code: ${resultCode ?: -1}"
|
||||
fun networkFailureMessage(action: String) = "Network error during $action."
|
||||
fun openHostActionDialog(action: String) {
|
||||
activeHostAction = action
|
||||
isHostActionRunning = false
|
||||
dialogMessage = confirmationMessage(action)
|
||||
showHostActionDialog = true
|
||||
}
|
||||
|
||||
|
||||
@Composable
|
||||
private fun SummaryCard() {
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
shape = RoundedCornerShape(16.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = Color.White),
|
||||
elevation = CardDefaults.cardElevation(4.dp)
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.weight(1f)
|
||||
) {
|
||||
SummaryItem(
|
||||
title = "Sales Today",
|
||||
value = "MMK 2,000,000",
|
||||
subtitle = "47 Transactions",
|
||||
icon = Icons.Default.BarChart,
|
||||
iconBg = Color.CrimsonRed
|
||||
if (showHostActionDialog) {
|
||||
AlertDialog(
|
||||
onDismissRequest = {
|
||||
if (!isHostActionRunning) {
|
||||
showHostActionDialog = false
|
||||
}
|
||||
},
|
||||
title = {
|
||||
Text(
|
||||
text = activeHostAction,
|
||||
color = Color.LegacyRed,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
text = {
|
||||
Text(text = dialogMessage)
|
||||
},
|
||||
confirmButton = {
|
||||
TextButton(
|
||||
onClick = {
|
||||
if (isHostActionRunning) return@TextButton
|
||||
|
||||
HorizontalDivider(color = Color.Gray, modifier = Modifier.padding(vertical = 6.dp, horizontal = 6.dp))
|
||||
if (dialogMessage != confirmationMessage(activeHostAction)) {
|
||||
showHostActionDialog = false
|
||||
dialogMessage = confirmationMessage(activeHostAction)
|
||||
return@TextButton
|
||||
}
|
||||
|
||||
SummaryItem(
|
||||
title = "Settlement",
|
||||
value = "Completed",
|
||||
subtitle = "Today 11:00 PM",
|
||||
icon = Icons.Default.Check,
|
||||
iconBg = Color.CrimsonRed
|
||||
)
|
||||
}
|
||||
isHostActionRunning = true
|
||||
dialogMessage = processingMessage(activeHostAction)
|
||||
|
||||
VerticalDivider(color = Color.Gray, modifier = Modifier.height(160.dp))
|
||||
val signOnProcess = EchoTestProcess.getInstance()
|
||||
val request = if (activeHostAction == "Log-Off") {
|
||||
signOnProcess.enqueueLogOff()
|
||||
} else {
|
||||
signOnProcess.enqueueLogOn()
|
||||
}
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.weight(0.75f)
|
||||
.padding(start = 18.dp),
|
||||
horizontalAlignment = Alignment.Start
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.Bottom
|
||||
request
|
||||
.startSignOn(object : SignOnListener {
|
||||
override fun onSuccessSignOn() {
|
||||
mainHandler.post {
|
||||
isHostActionRunning = false
|
||||
dialogMessage = successMessage(activeHostAction)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailureSignOn(resultCode: Int?) {
|
||||
mainHandler.post {
|
||||
isHostActionRunning = false
|
||||
mainHandler.post {
|
||||
isHostActionRunning = false
|
||||
dialogMessage = failureMessage(activeHostAction, resultCode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onNetworkFailSignOn(message: String?) {
|
||||
mainHandler.post {
|
||||
isHostActionRunning = false
|
||||
dialogMessage = message?.takeIf { it.isNotBlank() }
|
||||
?: networkFailureMessage(activeHostAction)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
) {
|
||||
Text(
|
||||
text = "Last Sync",
|
||||
fontSize = 12.sp,
|
||||
)
|
||||
// IconCircle(Icons.Default.Sync, Color.CrimsonRed)
|
||||
text = when {
|
||||
isHostActionRunning -> "Processing"
|
||||
dialogMessage == confirmationMessage(activeHostAction) -> "Start"
|
||||
else -> "Close"
|
||||
},
|
||||
color = Color.LegacyRed
|
||||
)
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
if (!isHostActionRunning) {
|
||||
TextButton(
|
||||
onClick = {
|
||||
showHostActionDialog = false
|
||||
dialogMessage = confirmationMessage(activeHostAction)
|
||||
}
|
||||
) {
|
||||
Text(text = "Cancel", color = Color.Gray)
|
||||
}
|
||||
}
|
||||
},
|
||||
containerColor = Color.White
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(Modifier.height(6.dp))
|
||||
ModalNavigationDrawer(
|
||||
drawerState = drawerState,
|
||||
drawerContent = {
|
||||
ModalDrawerSheet(
|
||||
modifier = Modifier.fillMaxWidth(0.78f),
|
||||
drawerContainerColor = Color.White,
|
||||
drawerShape = RoundedCornerShape(topEnd = 24.dp, bottomEnd = 24.dp)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(Color.LegacyRed)
|
||||
.padding(horizontal = 20.dp, vertical = 28.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "MOBPOS",
|
||||
color = Color.White,
|
||||
fontSize = 22.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Spacer(modifier = Modifier.height(6.dp))
|
||||
Text(
|
||||
text = "Quick navigation",
|
||||
color = Color.White.copy(alpha = 0.85f),
|
||||
fontSize = 13.sp
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
|
||||
DrawerItem("Log-On", Icons.Default.Dashboard) {
|
||||
scope.launch { drawerState.close() }
|
||||
openHostActionDialog("Log-On")
|
||||
}
|
||||
DrawerItem("Log-Off", Icons.Default.Dashboard) {
|
||||
scope.launch { drawerState.close() }
|
||||
openHostActionDialog("Log-Off")
|
||||
}
|
||||
DrawerItem("Sale", Icons.Default.PointOfSale) {
|
||||
scope.launch { drawerState.close() }
|
||||
onNavigateAmount("Sale")
|
||||
}
|
||||
DrawerItem("Sign On", Icons.Default.Link) {
|
||||
scope.launch { drawerState.close() }
|
||||
onNavigateSignOn()
|
||||
}
|
||||
DrawerItem("Settlement", Icons.Default.Wallet) {
|
||||
scope.launch { drawerState.close() }
|
||||
}
|
||||
DrawerItem("History", Icons.Default.History) {
|
||||
scope.launch { drawerState.close() }
|
||||
}
|
||||
}
|
||||
}
|
||||
) {
|
||||
Scaffold(
|
||||
containerColor = Color.IvoryBeige,
|
||||
topBar = {
|
||||
AppBar(
|
||||
title = "Dashboard",
|
||||
icon = Icons.Default.Menu,
|
||||
onIconClick = { scope.launch { drawerState.open() } }
|
||||
)
|
||||
}
|
||||
) { paddingValues ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(paddingValues)
|
||||
.fillMaxSize()
|
||||
// .padding(horizontal = 16.dp)
|
||||
) {
|
||||
AdvertisingArea()
|
||||
SummaryCard()
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
MenuGrid(
|
||||
onNavigateAmount = onNavigateAmount,
|
||||
onNavigateSignOn = onNavigateSignOn
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun DrawerItem(
|
||||
title: String,
|
||||
icon: ImageVector,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
NavigationDrawerItem(
|
||||
label = {
|
||||
Text(
|
||||
text = "5 mins ago",
|
||||
fontSize = 18.sp,
|
||||
color = Color.LegacyRed,
|
||||
fontWeight = FontWeight.SemiBold
|
||||
text = title,
|
||||
fontWeight = FontWeight.Medium
|
||||
)
|
||||
},
|
||||
selected = false,
|
||||
onClick = onClick,
|
||||
icon = {
|
||||
Icon(
|
||||
imageVector = icon,
|
||||
contentDescription = title
|
||||
)
|
||||
},
|
||||
modifier = Modifier.padding(horizontal = 12.dp, vertical = 2.dp),
|
||||
colors = NavigationDrawerItemDefaults.colors(
|
||||
unselectedContainerColor = androidx.compose.ui.graphics.Color.Transparent,
|
||||
unselectedIconColor = Color.LegacyRed,
|
||||
unselectedTextColor = Color.Black
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AdvertisingArea() {
|
||||
|
||||
val imageArray = listOf(
|
||||
"https://i.ytimg.com/vi/eRUVxGRp1Ms/maxresdefault.jpg",
|
||||
"https://sunmi.ua/wp-content/themes/yootheme/cache/04/p6-3-en-04a68bb5.jpeg",
|
||||
"https://mma.prnewswire.com/media/2080956/SUNMI_3rd_generation_products_T3_PRO_series_V3_MIX.jpg?p=facebook"
|
||||
);
|
||||
val pageState = rememberPagerState(pageCount = {imageArray.size})
|
||||
|
||||
LaunchedEffect(pageState) {
|
||||
while (true){
|
||||
delay(10000)
|
||||
val nextPage = (pageState.currentPage + 1) % imageArray.size;
|
||||
|
||||
pageState.animateScrollToPage(
|
||||
page = nextPage,
|
||||
animationSpec = tween(durationMillis = 700)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth().height(170.dp),
|
||||
shape = RoundedCornerShape(0.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = Color.White),
|
||||
) {
|
||||
HorizontalPager(
|
||||
state = pageState,
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
) { page ->
|
||||
AsyncImage(
|
||||
model = imageArray[page],
|
||||
contentDescription = "ads images",
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentScale = ContentScale.Crop
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SummaryItem(
|
||||
title: String,
|
||||
value: String,
|
||||
subtitle: String,
|
||||
icon: ImageVector,
|
||||
iconBg: androidx.compose.ui.graphics.Color
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.Top,
|
||||
modifier = Modifier.padding(6.dp)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.weight(1f),
|
||||
@Composable
|
||||
private fun SummaryCard() {
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp),
|
||||
shape = RoundedCornerShape(16.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = Color.White),
|
||||
elevation = CardDefaults.cardElevation(4.dp)
|
||||
) {
|
||||
Text(title, fontSize = 12.sp)
|
||||
Text(
|
||||
value,
|
||||
fontSize = 14.sp,
|
||||
color = Color.LegacyRed,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Text(subtitle, fontSize = 12.sp)
|
||||
}
|
||||
// IconCircle(icon, iconBg)
|
||||
}
|
||||
}
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Column(modifier = Modifier.weight(1f)) {
|
||||
SummaryItem(
|
||||
title = "Sales Today",
|
||||
value = "MMK 2,000,000",
|
||||
subtitle = "47 Transactions",
|
||||
icon = Icons.Default.BarChart,
|
||||
iconBg = Color.CrimsonRed
|
||||
)
|
||||
|
||||
@Composable
|
||||
private fun MenuGrid(
|
||||
onNavigateAmount: (String) -> Unit,
|
||||
onNavigateSignOn: () -> Unit
|
||||
) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp)
|
||||
) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
MenuCard(
|
||||
title = "Sale",
|
||||
icon = Icons.Default.PointOfSale,
|
||||
modifier = Modifier.weight(1f),
|
||||
onClick = { onNavigateAmount("Sale") }
|
||||
)
|
||||
MenuCard("MMQR", Icons.Default.QrCode, Modifier.weight(1f))
|
||||
MenuCard("History", Icons.Default.History, Modifier.weight(1f))
|
||||
}
|
||||
HorizontalDivider(
|
||||
color = Color.Gray,
|
||||
modifier = Modifier.padding(vertical = 6.dp, horizontal = 6.dp)
|
||||
)
|
||||
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
MenuCard(
|
||||
"Sign On",
|
||||
Icons.Default.Link,
|
||||
Modifier.weight(1f),
|
||||
onClick = onNavigateSignOn
|
||||
)
|
||||
MenuCard("Settlement", Icons.Default.Wallet, Modifier.weight(1f))
|
||||
MenuCard("See More", Icons.Default.GridView, Modifier.weight(1f))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun MenuCard(
|
||||
title: String,
|
||||
icon: ImageVector,
|
||||
modifier: Modifier = Modifier,
|
||||
onClick: (() -> Unit)? = null
|
||||
) {
|
||||
Card(
|
||||
modifier = modifier
|
||||
.height(100.dp)
|
||||
.then(
|
||||
if (onClick != null) {
|
||||
Modifier.clickable(onClick = onClick)
|
||||
} else {
|
||||
Modifier
|
||||
SummaryItem(
|
||||
title = "Settlement",
|
||||
value = "Completed",
|
||||
subtitle = "Today 11:00 PM",
|
||||
icon = Icons.Default.Check,
|
||||
iconBg = Color.CrimsonRed
|
||||
)
|
||||
}
|
||||
),
|
||||
shape = RoundedCornerShape(14.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = Color.White),
|
||||
elevation = CardDefaults.cardElevation(5.dp)
|
||||
|
||||
VerticalDivider(color = Color.Gray, modifier = Modifier.height(160.dp))
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.weight(0.75f)
|
||||
.padding(start = 18.dp),
|
||||
horizontalAlignment = Alignment.Start
|
||||
) {
|
||||
Row(verticalAlignment = Alignment.Bottom) {
|
||||
Text(
|
||||
text = "Last Sync",
|
||||
fontSize = 12.sp
|
||||
)
|
||||
IconCircle(Icons.Default.Sync, Color.CrimsonRed)
|
||||
}
|
||||
|
||||
Spacer(Modifier.height(6.dp))
|
||||
|
||||
Text(
|
||||
text = "5 mins ago",
|
||||
fontSize = 18.sp,
|
||||
color = Color.LegacyRed,
|
||||
fontWeight = FontWeight.SemiBold
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SummaryItem(
|
||||
title: String,
|
||||
value: String,
|
||||
subtitle: String,
|
||||
icon: ImageVector,
|
||||
iconBg: androidx.compose.ui.graphics.Color
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.Top,
|
||||
modifier = Modifier.padding(6.dp)
|
||||
) {
|
||||
Column(modifier = Modifier.weight(1f)) {
|
||||
Text(title, fontSize = 12.sp)
|
||||
Text(
|
||||
value,
|
||||
fontSize = 14.sp,
|
||||
color = Color.LegacyRed,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Text(subtitle, fontSize = 12.sp)
|
||||
}
|
||||
IconCircle(icon, iconBg)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun IconCircle(
|
||||
icon: ImageVector,
|
||||
color: androidx.compose.ui.graphics.Color
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(6.dp)
|
||||
.size(38.dp)
|
||||
.clip(CircleShape)
|
||||
.background(color.copy(alpha = 0.1f)),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Column {
|
||||
Icon(
|
||||
imageVector = icon,
|
||||
contentDescription = title,
|
||||
tint = Color.LegacyRed,
|
||||
modifier = Modifier.size(50.dp)
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text(
|
||||
text = title,
|
||||
fontSize = 12.sp,
|
||||
color = Color.Black,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
maxLines = 1,
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
Icon(
|
||||
imageVector = Icons.Default.ChevronRight,
|
||||
contentDescription = null,
|
||||
tint = Color.LegacyRed,
|
||||
modifier = Modifier
|
||||
.size(28.dp)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Icon(
|
||||
imageVector = icon,
|
||||
contentDescription = null,
|
||||
tint = color,
|
||||
modifier = Modifier.size(22.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
//@Composable
|
||||
//private fun RecentTransactionHeader() {
|
||||
// Row(
|
||||
// modifier = Modifier.fillMaxWidth(),
|
||||
// verticalAlignment = Alignment.CenterVertically
|
||||
// ) {
|
||||
// Text(
|
||||
// text = "Recent Transactions",
|
||||
// color = Color.LegacyRed,
|
||||
// fontSize = 16.sp,
|
||||
// fontWeight = FontWeight.SemiBold,
|
||||
// modifier = Modifier.weight(1f)
|
||||
// )
|
||||
//
|
||||
// Text(
|
||||
// text = "View All",
|
||||
// color = Color.LegacyRed,
|
||||
// fontSize = 14.sp
|
||||
// )
|
||||
//
|
||||
// Icon(
|
||||
// imageVector = Icons.Default.ChevronRight,
|
||||
// contentDescription = null,
|
||||
// tint = Color.LegacyRed
|
||||
// )
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//@Composable
|
||||
//private fun RecentTransactionList() {
|
||||
// Card(
|
||||
// modifier = Modifier.fillMaxWidth(),
|
||||
// shape = RoundedCornerShape(14.dp),
|
||||
// colors = CardDefaults.cardColors(containerColor = Color.White),
|
||||
// elevation = CardDefaults.cardElevation(2.dp)
|
||||
// ) {
|
||||
// Column {
|
||||
// TransactionRow(
|
||||
// iconText = "VISA",
|
||||
// time = "4:12 PM",
|
||||
// type = "Card Payment",
|
||||
// amount = "MMK 100,000",
|
||||
// status = "Success",
|
||||
// statusColor = Color.LegacyRed,
|
||||
// statusTextColor = Color.LegacyRed
|
||||
// )
|
||||
//
|
||||
// Divider(color = Color.LegacyRed)
|
||||
//
|
||||
// TransactionRow(
|
||||
// iconText = "MMQR",
|
||||
// time = "8:43 AM",
|
||||
// type = "MMQR",
|
||||
// amount = "MMK 50,000",
|
||||
// status = "Success",
|
||||
// statusColor = Color.LegacyRed,
|
||||
// statusTextColor = Color.LegacyRed
|
||||
// )
|
||||
//
|
||||
// Divider(color = Color.LegacyRed)
|
||||
//
|
||||
// TransactionRow(
|
||||
// iconText = "MC",
|
||||
// time = "9:10 PM",
|
||||
// type = "Card Payment",
|
||||
// amount = "MMK 150,000",
|
||||
// status = "Failed",
|
||||
// statusColor = Color.LegacyRed,
|
||||
// statusTextColor = Color.LegacyRed
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//@Composable
|
||||
//private fun TransactionRow(
|
||||
// iconText: String,
|
||||
// time: String,
|
||||
// type: String,
|
||||
// amount: String,
|
||||
// status: String,
|
||||
// statusColor: androidx.compose.ui.graphics.Color,
|
||||
// statusTextColor: androidx.compose.ui.graphics.Color
|
||||
//) {
|
||||
// Row(
|
||||
// modifier = Modifier
|
||||
// .fillMaxWidth()
|
||||
// .height(62.dp)
|
||||
// .padding(horizontal = 14.dp),
|
||||
// verticalAlignment = Alignment.CenterVertically
|
||||
// ) {
|
||||
// Text(
|
||||
// text = iconText,
|
||||
// color = Color.LegacyRed,
|
||||
// fontWeight = FontWeight.Bold,
|
||||
// fontSize = 20.sp,
|
||||
// modifier = Modifier.width(70.dp)
|
||||
// )
|
||||
//
|
||||
// Column(modifier = Modifier.weight(1f)) {
|
||||
// Text(time, fontSize = 12.sp, color = Color.Black)
|
||||
// Text(type, fontSize = 12.sp, color = Color.Gray)
|
||||
// }
|
||||
//
|
||||
// Text(
|
||||
// text = amount,
|
||||
// fontSize = 12.sp,
|
||||
// color = Color.Black,
|
||||
// modifier = Modifier.width(90.dp)
|
||||
// )
|
||||
//
|
||||
// Box(
|
||||
// modifier = Modifier
|
||||
// .clip(RoundedCornerShape(8.dp))
|
||||
// .padding(horizontal = 10.dp, vertical = 5.dp)
|
||||
// ) {
|
||||
// Text(
|
||||
// text = status,
|
||||
// fontSize = 12.sp,
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// Icon(
|
||||
// imageVector = Icons.Default.ChevronRight,
|
||||
// contentDescription = null,
|
||||
// tint = Color.LegacyRed,
|
||||
// modifier = Modifier.size(26.dp)
|
||||
// )
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//@Composable
|
||||
//private fun IconCircle(
|
||||
// icon: ImageVector,
|
||||
// color: androidx.compose.ui.graphics.Color
|
||||
//) {
|
||||
// Box(
|
||||
// modifier = Modifier
|
||||
// .size(38.dp)
|
||||
// .clip(CircleShape)
|
||||
// .background(color.copy(alpha = 0.1f)),
|
||||
// contentAlignment = Alignment.Center
|
||||
// ) {
|
||||
// Icon(
|
||||
// imageVector = icon,
|
||||
// contentDescription = null,
|
||||
// tint = color,
|
||||
// modifier = Modifier.size(22.dp)
|
||||
// )
|
||||
// }
|
||||
//}
|
||||
|
||||
@P2Preview
|
||||
@Composable
|
||||
fun PreviewDashboardScreen2() {
|
||||
DashboardScreen2()
|
||||
}
|
||||
@Composable
|
||||
private fun MenuGrid(
|
||||
onNavigateAmount: (String) -> Unit,
|
||||
onNavigateSignOn: () -> Unit
|
||||
) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp),
|
||||
modifier = Modifier.padding(horizontal = 16.dp)
|
||||
) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
MenuCard(
|
||||
title = "Sale",
|
||||
icon = Icons.Default.PointOfSale,
|
||||
modifier = Modifier.weight(1f),
|
||||
onClick = { onNavigateAmount("Sale") }
|
||||
)
|
||||
MenuCard("MMQR", Icons.Default.QrCode, Modifier.weight(1f))
|
||||
MenuCard("History", Icons.Default.History, Modifier.weight(1f))
|
||||
}
|
||||
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||
MenuCard(
|
||||
"Sign On",
|
||||
Icons.Default.Link,
|
||||
Modifier.weight(1f),
|
||||
onClick = onNavigateSignOn
|
||||
)
|
||||
MenuCard("Settlement", Icons.Default.Wallet, Modifier.weight(1f))
|
||||
MenuCard("See More", Icons.Default.GridView, Modifier.weight(1f))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun MenuCard(
|
||||
title: String,
|
||||
icon: ImageVector,
|
||||
modifier: Modifier = Modifier,
|
||||
onClick: (() -> Unit)? = null
|
||||
) {
|
||||
Card(
|
||||
modifier = modifier
|
||||
.height(100.dp)
|
||||
.then(
|
||||
if (onClick != null) {
|
||||
Modifier.clickable(onClick = onClick)
|
||||
} else {
|
||||
Modifier
|
||||
}
|
||||
),
|
||||
shape = RoundedCornerShape(14.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = Color.White),
|
||||
elevation = CardDefaults.cardElevation(5.dp)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(6.dp)
|
||||
) {
|
||||
Column {
|
||||
Icon(
|
||||
imageVector = icon,
|
||||
contentDescription = title,
|
||||
tint = Color.LegacyRed,
|
||||
modifier = Modifier.size(50.dp)
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text(
|
||||
text = title,
|
||||
fontSize = 12.sp,
|
||||
color = Color.Black,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
maxLines = 1,
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
Icon(
|
||||
imageVector = Icons.Default.ChevronRight,
|
||||
contentDescription = null,
|
||||
tint = Color.LegacyRed,
|
||||
modifier = Modifier.size(28.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@P2Preview
|
||||
@Composable
|
||||
fun PreviewDashboardScreen2() {
|
||||
DashboardScreen2()
|
||||
}
|
||||
|
||||
@ -349,6 +349,10 @@ public class ISOSocket {
|
||||
if (!isSwitchIp) {
|
||||
serverIP = getIp();
|
||||
serverPort = getPort();
|
||||
// serverIP = "posuat.myanmarorientalbank.com";
|
||||
// serverPort = 5033;
|
||||
// serverIP = "10.255.255.195";
|
||||
// serverPort = 5555;
|
||||
} else {
|
||||
isSwitchIp = false;
|
||||
}
|
||||
|
||||
@ -47,8 +47,7 @@ public class EchoTestProcess {
|
||||
private EchoTestProcess() {
|
||||
tradeData = Params.newTrade(true);
|
||||
payDetail = tradeData.getPayDetail();
|
||||
isoMsgX = new ISOMsgX.ISOMsgXBuilder(ISOVersion.VERSION_1993, ISOMode.BOTH_HEADER_TPDU,HostName.BPC)
|
||||
.build();
|
||||
isoMsgX = new ISOMsgX.ISOMsgXBuilder(ISOVersion.VERSION_1993, ISOMode.BOTH_HEADER_TPDU,HostName.BPC).build();
|
||||
}
|
||||
|
||||
public StartSignOn enqueue(boolean isSecondary) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user