Adjust UI theme
This commit is contained in:
+8
-1
@@ -5,8 +5,10 @@ import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.NavigationBar
|
||||
import androidx.compose.material3.NavigationBarItem
|
||||
import androidx.compose.material3.NavigationBarItemDefaults
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
@@ -14,6 +16,7 @@ import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.navigation.NavType
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
@@ -36,7 +39,6 @@ import com.digitoolsolutions.app.torquevaultkmp.screens.scanner.ScannerScreen
|
||||
import com.digitoolsolutions.app.torquevaultkmp.screens.scanner.ScannerViewModel
|
||||
import com.digitoolsolutions.app.torquevaultkmp.screens.settings.SettingDestination
|
||||
import com.digitoolsolutions.app.torquevaultkmp.screens.settings.SettingScreen
|
||||
import io.github.aakira.napier.Napier
|
||||
import org.jetbrains.compose.resources.painterResource
|
||||
import org.jetbrains.compose.resources.stringResource
|
||||
import org.koin.compose.viewmodel.koinViewModel
|
||||
@@ -111,6 +113,11 @@ fun MainScreen(
|
||||
},
|
||||
label = { Text(dest.label) },
|
||||
selected = currentDestination?.route == dest.route,
|
||||
colors = NavigationBarItemDefaults.colors(
|
||||
selectedIconColor = MaterialTheme.colorScheme.primary,
|
||||
selectedTextColor = MaterialTheme.colorScheme.primary,
|
||||
indicatorColor = Color.Transparent
|
||||
),
|
||||
onClick = {
|
||||
navController.navigate(dest.route) {
|
||||
popUpTo(navController.graph.startDestinationId) { saveState = true }
|
||||
|
||||
+3
-3
@@ -3,20 +3,20 @@ package com.digitoolsolutions.app.torquevaultkmp.screens.bluetooth.views
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.rounded.BluetoothDisabled
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import com.digitoolsolutions.app.torquevaultkmp.components.WarningView
|
||||
import org.jetbrains.compose.resources.painterResource
|
||||
import org.jetbrains.compose.resources.stringResource
|
||||
import torquevaultkmp.composeapp.generated.resources.Res
|
||||
import torquevaultkmp.composeapp.generated.resources.baseline_bluetooth_disabled_24
|
||||
import torquevaultkmp.composeapp.generated.resources.bluetooth_not_available_info
|
||||
import torquevaultkmp.composeapp.generated.resources.bluetooth_not_available_title
|
||||
|
||||
@Composable
|
||||
internal fun BluetoothNotAvailableView() {
|
||||
WarningView(
|
||||
painterResource = painterResource(Res.drawable.baseline_bluetooth_disabled_24),
|
||||
imageVector = Icons.Rounded.BluetoothDisabled,
|
||||
title = stringResource(Res.string.bluetooth_not_available_title),
|
||||
hint = stringResource(Res.string.bluetooth_not_available_info),
|
||||
modifier = Modifier
|
||||
|
||||
-1
@@ -29,7 +29,6 @@ import org.jetbrains.compose.resources.stringResource
|
||||
import torquevaultkmp.composeapp.generated.resources.Res
|
||||
import torquevaultkmp.composeapp.generated.resources.action_grant_permission
|
||||
import torquevaultkmp.composeapp.generated.resources.action_settings
|
||||
import torquevaultkmp.composeapp.generated.resources.baseline_bluetooth_disabled_24
|
||||
import torquevaultkmp.composeapp.generated.resources.bluetooth_permission_info
|
||||
import torquevaultkmp.composeapp.generated.resources.bluetooth_permission_title
|
||||
|
||||
|
||||
+12
-7
@@ -18,6 +18,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.FloatingActionButton
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.SnackbarHost
|
||||
import androidx.compose.material3.SnackbarHostState
|
||||
@@ -127,7 +128,7 @@ internal fun LogContent(
|
||||
Icon(
|
||||
Icons.Default.DeleteForever,
|
||||
contentDescription = "Delete all log",
|
||||
tint = Color.Red
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
IconButton(onClick = {showBottomSheet = true}){
|
||||
@@ -141,12 +142,16 @@ internal fun LogContent(
|
||||
)
|
||||
},
|
||||
floatingActionButton = {
|
||||
FloatingActionButton(onClick = {
|
||||
onRefresh()
|
||||
coroutineScope.launch {
|
||||
listState.animateScrollToItem(0)
|
||||
}
|
||||
}) {
|
||||
FloatingActionButton(
|
||||
onClick = {
|
||||
onRefresh()
|
||||
coroutineScope.launch {
|
||||
listState.animateScrollToItem(0)
|
||||
}
|
||||
},
|
||||
containerColor = MaterialTheme.colorScheme.primary,
|
||||
contentColor = MaterialTheme.colorScheme.onPrimary
|
||||
) {
|
||||
Icon(Icons.Rounded.KeyboardArrowUp, contentDescription = "Go to top")
|
||||
}
|
||||
},
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ fun ScannerScreen(
|
||||
contentPadding = PaddingValues(16.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
items(devices) { device ->
|
||||
items(devices, key = {it.identifier.toString()}) { device ->
|
||||
val deviceId = device.identifier.toString()
|
||||
val connectedDevice = connectedDevices[deviceId]
|
||||
val connectionState = connectedDevice?.state
|
||||
|
||||
+3
-4
@@ -112,7 +112,7 @@ class ScannerViewModel(
|
||||
stopCleanupJob()
|
||||
}
|
||||
.collect { advertisement ->
|
||||
if (_onlyWithName.value && advertisement.name == null) return@collect
|
||||
if (advertisement.name == null) return@collect
|
||||
val bleId: String = advertisement.identifier.toString()
|
||||
if(_autoConnect.value && isBonded(bleId)){
|
||||
connect(advertisement)
|
||||
@@ -147,9 +147,8 @@ class ScannerViewModel(
|
||||
}
|
||||
|
||||
private fun updateDeviceList() {
|
||||
_devices.value = advertisementMap.values
|
||||
.map { it.first }
|
||||
.sortedByDescending { it.rssi }
|
||||
_devices.value = advertisementMap.values.map { it.first }
|
||||
// .sortedByDescending { it.rssi } // Fix flicker
|
||||
}
|
||||
|
||||
fun stopScan() {
|
||||
|
||||
+5
-2
@@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.imePadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
@@ -192,7 +193,8 @@ fun SettingContent(
|
||||
snackbarHostState.showSnackbar(message)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
shape = RoundedCornerShape(8.dp)
|
||||
) {
|
||||
Text(stringResource(Res.string.save_settings))
|
||||
}
|
||||
@@ -201,7 +203,8 @@ fun SettingContent(
|
||||
onClick = {
|
||||
onLogout()
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
shape = RoundedCornerShape(8.dp)
|
||||
) {
|
||||
Text(stringResource(Res.string.logout))
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ val Purple40 = Color(0xFF6650a4)
|
||||
val PurpleGrey40 = Color(0xFF625b71)
|
||||
val Pink40 = Color(0xFF7D5260)
|
||||
|
||||
val AppBarColor = Color(0xFF00A9CE)
|
||||
val AppBarColor = Color(0xFFB2292E)
|
||||
val ColorError = Color(0xFFBA1B1B)
|
||||
val ColorWarning = Color(0xFFF1750B)
|
||||
val ColorSuccess = Color(0xFF008D45)
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ import com.digitoolsolutions.app.torquevaultkmp.theme.Typography
|
||||
//
|
||||
//)
|
||||
private val DarkColorScheme = darkColorScheme(
|
||||
primary = Color(0xFFB71C1C),
|
||||
primary = Color(0xFFB2292E),
|
||||
secondary = Color(0xFF424242),
|
||||
tertiary = Color(0xFFFFA000),
|
||||
background = Color(0xFF121212),
|
||||
@@ -40,7 +40,7 @@ private val DarkColorScheme = darkColorScheme(
|
||||
)
|
||||
|
||||
private val LightColorScheme = lightColorScheme(
|
||||
primary = Color(0xFFB71C1C),
|
||||
primary = Color(0xFFB2292E),
|
||||
secondary = Color(0xFF616161),
|
||||
tertiary = Color(0xFFFFC107),
|
||||
background = Color(0xFFFFFBFE),
|
||||
|
||||
Reference in New Issue
Block a user