side bar modified

This commit is contained in:
moon 2026-06-10 20:17:33 +06:30
parent 7361078369
commit 211e633517
7 changed files with 245 additions and 74 deletions

View File

@ -6,15 +6,53 @@ import androidx.compose.animation.core.tween
import androidx.compose.foundation.Image
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.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.layout.width
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.*
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.Menu
import androidx.compose.material.icons.filled.Sync
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.DrawerValue
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
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.collectAsState
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
@ -23,6 +61,7 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.viewmodel.compose.viewModel
@ -54,7 +93,7 @@ fun DashboardScreen2(
deviceInfoViewModel.loadDeviceInfo()
}
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
val drawerState = rememberDrawerState(initialValue = DrawerValue.Open)
val scope = rememberCoroutineScope()
val mainHandler = remember { Handler(Looper.getMainLooper()) }
var showHostActionDialog by remember { mutableStateOf(false) }
@ -215,32 +254,96 @@ fun DashboardScreen2(
}
Spacer(modifier = Modifier.height(10.dp))
Text(
text = "Connection Settings",
fontWeight = FontWeight.Medium,
modifier = Modifier.padding(horizontal = 16.dp)
)
Item(
title = "Echo Test", subTitle = "Test Connection Status",
onClick = {
scope.launch { drawerState.close() }
openHostActionDialog("Echo Test")
},
leadingIcon = {
Icon(
painterResource(R.drawable.ic_up_down_arrow),
contentDescription = "icon",
tint = Color.LegacyRed
)
},
trailingIcon = {},
)
Item(
title = "Log-On", subTitle = "Log on to System",
onClick = {
scope.launch { drawerState.close() }
openHostActionDialog("Log-On")
},
leadingIcon = {
Icon(
painterResource(R.drawable.ic_lock),
contentDescription = "icon",
tint = Color.LegacyRed
)
},
trailingIcon = {},
)
Item(
title = "Log-Off", subTitle = "Log off from System",
onClick = {
scope.launch { drawerState.close() }
openHostActionDialog("Log-Off")
},
leadingIcon = {
Icon(
painterResource(R.drawable.ic_cancel_circle),
contentDescription = "icon",
tint = Color.LegacyRed
)
},
trailingIcon = {},
)
DrawerItem("Log-On", Icons.Default.Dashboard) {
scope.launch { drawerState.close() }
openHostActionDialog("Log-On")
}
DrawerItem("Echo Test", Icons.Default.Sync) {
scope.launch { drawerState.close() }
openHostActionDialog("Echo Test")
}
DrawerItem("Log-Off", Icons.Default.Dashboard) {
scope.launch { drawerState.close() }
openHostActionDialog("Log-Off")
}
Text(
text = "System Management",
fontWeight = FontWeight.Medium,
modifier = Modifier.padding(horizontal = 16.dp)
)
DrawerItem("Function", Icons.Default.Dashboard) {
scope.launch { drawerState.close() }
onNavigateFunctions()
}
DrawerItem("Version", Icons.Default.Dashboard) {
scope.launch { drawerState.close() }
onNavigateVersion()
}
Item(
title = "Functions", subTitle = "System Function Settings",
onClick = {
scope.launch { drawerState.close() }
onNavigateFunctions()
},
leadingIcon = {
Icon(
painterResource(R.drawable.ic_four_boxes),
contentDescription = "icon",
tint = Color.LegacyRed,
modifier = Modifier.size(16.dp)
)
},
trailingIcon = {},
)
Item(
title = "Version", subTitle = "View App Version Info",
onClick = {
scope.launch { drawerState.close() }
onNavigateVersion()
},
leadingIcon = {
Icon(
painterResource(R.drawable.ic_version),
contentDescription = "icon",
tint = Color.LegacyRed
)
},
trailingIcon = {},
)
}
}) {
Scaffold(
@ -597,3 +700,71 @@ fun PreviewDashboardScreen2() {
fun PreviewDashboardScreen3() {
DashboardScreen2()
}
@Preview
@Composable
fun PreviewItem() {
Item(
onClick = {},
title = "title",
subTitle = "sub-title"
)
}
@Composable
fun Item(
onClick: () -> Unit,
title: String,
subTitle: String,
leadingIcon: (@Composable () -> Unit)? = null,
trailingIcon: (@Composable () -> Unit)? = null,
) {
Button(
onClick = onClick,
colors = ButtonDefaults.buttonColors(
containerColor = Color.White,
contentColor = Color.Black
),
modifier = Modifier.fillMaxWidth()
) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween,
modifier = Modifier
.fillMaxWidth()
) {
// Square icon background
leadingIcon?.let {
Box(
contentAlignment = Alignment.Center,
modifier = Modifier
.size(40.dp)
.clip(RoundedCornerShape(16.dp)) // change to RectangleShape for sharp corners
.background(Color.LegacyRed.copy(alpha = 0.1f))
.padding(8.dp)
) {
it()
}
}
Spacer(modifier = Modifier.width(12.dp))
Column(
modifier = Modifier
.weight(1f)
.padding(horizontal = 8.dp)
) {
Text(text = title)
Text(
text = subTitle,
style = MaterialTheme.typography.bodySmall,
color = Color.Gray
)
}
trailingIcon?.invoke()
}
}
}

View File

@ -1,13 +1,11 @@
package com.mob.utsmyanmar.ui.functions
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
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.layout.width
@ -17,7 +15,6 @@ import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.ChevronRight
import androidx.compose.material.icons.filled.OnDeviceTraining
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ElevatedButton
import androidx.compose.material3.Icon
@ -30,15 +27,19 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.mob.utsmyanmar.R
import com.mob.utsmyanmar.ui.components.appbar.AppBar
import com.mob.utsmyanmar.ui.preview.P2Preview
import com.mob.utsmyanmar.ui.preview.P3Preview
import com.mob.utsmyanmar.ui.theme.Color
import com.mob.utsmyanmar.R
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation
@Composable
fun FunctionsScreen(
onBack: () -> Unit = {}
) {
val tmsAddress = SystemParamsOperation.getInstance().tmsAddress
Scaffold(
containerColor = Color.IvoryBeige,
topBar = {
@ -139,7 +140,7 @@ fun FunctionsScreen(
FunctionButton(
onClick = {},
title = "TMS Server Url",
subTitle = "Detail for bound hosts",
subTitle = tmsAddress,
leadingIcon = {
Icon(
modifier = Modifier.size(24.dp),
@ -232,4 +233,4 @@ fun PreviewFunctionButton() {
title = "title",
subTitle = "sub-title"
)
}
}

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="800dp"
android:height="800dp"
android:viewportWidth="32"
android:viewportHeight="32">
<path
android:pathData="M10.771,8.518c-1.144,0.215 -2.83,2.171 -2.086,2.915l4.573,4.571 -4.573,4.571c-0.915,0.915 1.829,3.656 2.744,2.742l4.573,-4.571 4.573,4.571c0.915,0.915 3.658,-1.829 2.744,-2.742l-4.573,-4.571 4.573,-4.571c0.915,-0.915 -1.829,-3.656 -2.744,-2.742l-4.573,4.571 -4.573,-4.571c-0.173,-0.171 -0.394,-0.223 -0.657,-0.173v0zM16,1c-8.285,0 -15,6.716 -15,15s6.715,15 15,15 15,-6.716 15,-15 -6.715,-15 -15,-15zM16,4.75c6.213,0 11.25,5.037 11.25,11.25s-5.037,11.25 -11.25,11.25 -11.25,-5.037 -11.25,-11.25c0.001,-6.213 5.037,-11.25 11.25,-11.25z"
android:fillColor="#000000"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="800dp"
android:height="800dp"
android:viewportWidth="512"
android:viewportHeight="512">
<path
android:pathData="M0,512h232.7V279.3H0V512zM0,232.7h232.7V0H0V232.7zM279.3,512H512V279.3H279.3V512zM279.3,0v232.7H512V0H279.3z"
android:fillColor="#000000"/>
</vector>

View File

@ -1,25 +1,9 @@
<!--
~ Copyright (C) 2026 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="11dp"
android:height="14dp"
android:viewportWidth="11"
android:viewportHeight="14">
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M1.306,13.716C0.947,13.716 0.64,13.588 0.384,13.333C0.128,13.077 0,12.77 0,12.41V5.878C0,5.519 0.128,5.212 0.384,4.956C0.64,4.701 0.948,4.573 1.306,4.572H1.959V3.266C1.959,2.362 2.278,1.592 2.915,0.956C3.552,0.319 4.322,0 5.225,0C6.128,-0 6.899,0.318 7.536,0.956C8.174,1.593 8.492,2.363 8.491,3.266V4.572H9.144C9.503,4.572 9.811,4.7 10.067,4.956C10.323,5.212 10.451,5.52 10.45,5.878V12.41C10.45,12.769 10.323,13.077 10.067,13.333C9.811,13.589 9.504,13.717 9.144,13.716H1.306ZM1.306,12.41H9.144V5.878H1.306V12.41ZM6.148,10.066C6.404,9.811 6.532,9.504 6.532,9.144C6.532,8.784 6.404,8.477 6.148,8.222C5.893,7.967 5.585,7.839 5.225,7.838C4.866,7.837 4.558,7.965 4.303,8.222C4.048,8.479 3.92,8.786 3.919,9.144C3.918,9.502 4.046,9.81 4.303,10.067C4.56,10.324 4.867,10.452 5.225,10.45C5.583,10.449 5.891,10.32 6.148,10.066ZM3.266,4.572H7.185V3.266C7.185,2.721 6.994,2.259 6.613,1.878C6.232,1.497 5.77,1.306 5.225,1.306C4.681,1.306 4.218,1.497 3.837,1.878C3.456,2.259 3.266,2.721 3.266,3.266V4.572Z"
android:fillColor="#6F0D1E"
android:fillAlpha="0.8"/>
android:pathData="M240,880q-33,0 -56.5,-23.5T160,800v-400q0,-33 23.5,-56.5T240,320h40v-80q0,-83 58.5,-141.5T480,40q83,0 141.5,58.5T680,240v80h40q33,0 56.5,23.5T800,400v400q0,33 -23.5,56.5T720,880L240,880ZM240,800h480v-400L240,400v400ZM536.5,656.5Q560,633 560,600t-23.5,-56.5Q513,520 480,520t-56.5,23.5Q400,567 400,600t23.5,56.5Q447,680 480,680t56.5,-23.5ZM360,320h240v-80q0,-50 -35,-85t-85,-35q-50,0 -85,35t-35,85v80ZM240,800v-400,400Z"
android:fillColor="#e3e3e3"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:pathData="M320,520v-287L217,336l-57,-56 200,-200 200,200 -57,56 -103,-103v287h-80ZM600,880 L400,680l57,-56 103,103v-287h80v287l103,-103 57,56L600,880Z"
android:fillColor="#e3e3e3"/>
</vector>

View File

@ -1,24 +1,12 @@
<!--
~ Copyright (C) 2026 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="12dp"
android:height="14dp"
android:viewportWidth="12"
android:viewportHeight="14">
android:width="800dp"
android:height="800dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M11.212,7.908C11.822,8.309 11.794,9.239 11.127,9.591L6.436,12.071C6.247,12.17 6.038,12.223 5.825,12.223C5.612,12.223 5.402,12.17 5.214,12.071L0.522,9.591C-0.144,9.238 -0.173,8.309 0.438,7.908L0.479,7.934L5.214,10.438C5.402,10.537 5.612,10.589 5.825,10.589C6.038,10.589 6.247,10.537 6.436,10.438L11.127,7.958C11.156,7.942 11.184,7.926 11.212,7.908ZM11.212,5.295C11.346,5.384 11.457,5.505 11.534,5.648C11.61,5.79 11.65,5.95 11.65,6.112C11.65,6.273 11.61,6.433 11.534,6.575C11.457,6.718 11.346,6.839 11.212,6.929L11.127,6.978L6.436,9.458C6.265,9.548 6.077,9.599 5.884,9.608C5.691,9.617 5.498,9.582 5.32,9.508L5.215,9.458L0.522,6.978C-0.144,6.625 -0.173,5.696 0.438,5.295L0.479,5.321L5.214,7.824C5.385,7.915 5.573,7.966 5.766,7.975C5.959,7.983 6.152,7.949 6.33,7.875L6.436,7.824L11.127,5.344C11.156,5.329 11.184,5.312 11.212,5.295ZM6.436,0.152L11.127,2.632C11.824,2.999 11.824,3.997 11.127,4.364L6.436,6.845C6.247,6.945 6.038,6.997 5.825,6.997C5.612,6.997 5.402,6.945 5.214,6.845L0.522,4.364C-0.174,3.996 -0.174,2.999 0.522,2.632L5.214,0.152C5.402,0.052 5.612,0 5.825,0C6.038,0 6.247,0.052 6.436,0.152Z"
android:fillColor="#6F0D1E"/>
android:pathData="M20.245,14.75C21.18,15.364 21.137,16.787 20.117,17.326L12.935,21.122C12.35,21.432 11.65,21.432 11.066,21.122L3.884,17.326C2.863,16.787 2.82,15.364 3.755,14.75L3.818,14.789L3.818,14.789L11.065,18.622C11.65,18.931 12.35,18.931 12.935,18.622L20.116,14.826C20.161,14.802 20.204,14.777 20.245,14.75ZM20.245,10.75C21.139,11.337 21.139,12.665 20.244,13.251L20.117,13.326L12.935,17.122C12.403,17.403 11.777,17.429 11.228,17.199L11.066,17.122L3.884,13.326C2.863,12.787 2.82,11.364 3.755,10.75L3.818,10.789L3.818,10.789L11.065,14.622C11.597,14.903 12.224,14.929 12.773,14.699L12.935,14.622L20.116,10.826C20.161,10.802 20.204,10.777 20.245,10.75ZM12.935,2.878L20.116,6.674C21.182,7.237 21.182,8.763 20.116,9.326L12.935,13.123C12.35,13.432 11.65,13.432 11.065,13.123L3.884,9.326C2.818,8.763 2.818,7.237 3.884,6.674L11.065,2.878C11.65,2.569 12.35,2.569 12.935,2.878Z"
android:strokeWidth="1"
android:fillColor="#09244B"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
</vector>