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