layout fix
CircularProgressIndicator was moved into the devices list.
This commit is contained in:
@@ -93,11 +93,7 @@ class MainActivity : ComponentActivity() {
|
||||
permissionLauncher.launch(permissionsToRequest)
|
||||
}
|
||||
|
||||
LaunchedEffect(key1 = bluetoothState.errorMessage) {
|
||||
bluetoothState.errorMessage?.let { message ->
|
||||
Toast.makeText(applicationContext, message, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(key1 = bluetoothState) {
|
||||
if (bluetoothState.isConnected) {
|
||||
Toast.makeText(applicationContext, "Подключение завершено", Toast.LENGTH_LONG)
|
||||
@@ -106,6 +102,14 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
|
||||
val navController = rememberNavController()
|
||||
|
||||
LaunchedEffect(key1 = bluetoothState.errorMessage) {
|
||||
bluetoothState.errorMessage?.let { message ->
|
||||
Toast.makeText(applicationContext, message, Toast.LENGTH_LONG).show()
|
||||
navController.navigate("scanner")
|
||||
}
|
||||
}
|
||||
|
||||
TestblueTheme {
|
||||
Surface(color = MaterialTheme.colorScheme.background) {
|
||||
PermissionsRequest(
|
||||
|
||||
@@ -64,14 +64,6 @@ fun BluetoothScannerScreen(
|
||||
}
|
||||
)
|
||||
|
||||
if (bluetoothState.scannedDevices.isEmpty() && bluetoothState.isDiscovering) {
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
CircularProgressIndicator(modifier = Modifier.align(Alignment.Center))
|
||||
}
|
||||
}
|
||||
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.padding(5.dp)
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.helible.pilot.components
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
@@ -73,12 +76,24 @@ fun DiscoveredDevicesList(
|
||||
)
|
||||
)
|
||||
}
|
||||
if(bluetoothState.pairedDevices.isEmpty() && !bluetoothState.isDiscovering) {
|
||||
item {
|
||||
Text(
|
||||
text = "Устройства поблизости не обнаружены.",
|
||||
modifier = Modifier.fillMaxSize()
|
||||
)
|
||||
if(bluetoothState.scannedDevices.isEmpty()) {
|
||||
if(bluetoothState.isDiscovering) {
|
||||
item {
|
||||
Column(modifier = Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
CircularProgressIndicator()
|
||||
Text(text = "Поиск устройств", modifier=Modifier.padding(10.dp))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
item {
|
||||
Text(
|
||||
text = "Устройства поблизости не обнаружены",
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(10.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user