Compare commits

..

4 Commits

Author SHA1 Message Date
3b62743481 Better UI layout on the device screen 2024-01-27 23:14:26 +07:00
18bd21fba1 Global navigation was implemented 2024-01-02 22:05:23 +07:00
77a3b19b24 UI Previews
UI Previews was added for service dialogs
2024-01-02 20:25:49 +07:00
70cd547fb7 UI Previews
Preview for every UI component was added. More flexible DeviceItem component.
2024-01-02 20:17:25 +07:00
33 changed files with 382 additions and 179 deletions

View File

@@ -1,13 +1,11 @@
package com.helible.pilot package com.helible.pilot
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.*
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.junit.Assert.*
/** /**
* Instrumented test, which will execute on an Android device. * Instrumented test, which will execute on an Android device.
* *

View File

@@ -3,18 +3,34 @@
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<!-- Request legacy Bluetooth permissions on older devices. --> <!-- Request legacy Bluetooth permissions on older devices. -->
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30"/> <uses-permission
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30"/> android:name="android.permission.BLUETOOTH"
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" android:maxSdkVersion="30"/> android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" android:maxSdkVersion="30"/> <uses-permission
android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"
android:maxSdkVersion="30" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"
android:maxSdkVersion="30" />
<!-- Request Bluetooth permissions for API level 31+ --> <!-- Request Bluetooth permissions for API level 31+ -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" android:minSdkVersion="31" <uses-permission
android:usesPermissionFlags="neverForLocation" tools:targetApi="s" /> android:name="android.permission.BLUETOOTH_SCAN"
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" android:minSdkVersion="31" android:minSdkVersion="31"
android:usesPermissionFlags="neverForLocation" tools:targetApi="s" /> android:usesPermissionFlags="neverForLocation"
tools:targetApi="s" />
<uses-permission
android:name="android.permission.BLUETOOTH_CONNECT"
android:minSdkVersion="31"
android:usesPermissionFlags="neverForLocation"
tools:targetApi="s" />
<uses-feature android:name="android.hardware.bluetooth" android:required="true"/> <uses-feature
android:name="android.hardware.bluetooth"
android:required="true" />
<application <application
android:allowBackup="true" android:allowBackup="true"

View File

@@ -6,8 +6,10 @@ import android.widget.Toast
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity
import androidx.activity.compose.BackHandler import androidx.activity.compose.BackHandler
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
@@ -15,19 +17,19 @@ import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.compose.NavHost import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController import androidx.navigation.compose.rememberNavController
import com.helible.pilot.components.scannerScreen.BluetoothScannerScreen
import com.helible.pilot.components.deviceScreen.DeviceControlScreen import com.helible.pilot.components.deviceScreen.DeviceControlScreen
import com.helible.pilot.viewmodels.AppPreferences
import com.helible.pilot.viewmodels.SavedPreferencesImpl
import com.helible.pilot.components.deviceScreen.defaultDeviceActionsList import com.helible.pilot.components.deviceScreen.defaultDeviceActionsList
import com.helible.pilot.components.scannerScreen.ScannerScreen
import com.helible.pilot.permissions.PermissionsLauncher import com.helible.pilot.permissions.PermissionsLauncher
import com.helible.pilot.permissions.PermissionsRequest import com.helible.pilot.permissions.PermissionsRequest
import com.helible.pilot.permissions.RequestHardwareFeatures import com.helible.pilot.permissions.RequestHardwareFeatures
import com.helible.pilot.ui.theme.TestblueTheme import com.helible.pilot.ui.theme.TestblueTheme
import com.helible.pilot.viewmodels.AppPreferences
import com.helible.pilot.viewmodels.BluetoothViewModel import com.helible.pilot.viewmodels.BluetoothViewModel
import com.helible.pilot.viewmodels.BluetoothViewModelFactory import com.helible.pilot.viewmodels.BluetoothViewModelFactory
import com.helible.pilot.viewmodels.PermissionDialogViewModel import com.helible.pilot.viewmodels.PermissionDialogViewModel
import com.helible.pilot.viewmodels.PreferencesViewModel import com.helible.pilot.viewmodels.PreferencesViewModel
import com.helible.pilot.viewmodels.SavedPreferencesImpl
class MainActivity : ComponentActivity() { class MainActivity : ComponentActivity() {
@@ -101,7 +103,7 @@ class MainActivity : ComponentActivity() {
startDestination = "device" startDestination = "device"
) { ) {
composable("scanner") { composable("scanner") {
BluetoothScannerScreen( ScannerScreen(
bluetoothState = bluetoothState, bluetoothState = bluetoothState,
selectedDevice = selectedDevice, selectedDevice = selectedDevice,
startScan = { bluetoothViewModel.startScan() }, startScan = { bluetoothViewModel.startScan() },
@@ -139,34 +141,58 @@ class MainActivity : ComponentActivity() {
device device
) )
}, },
disconnectFromDevice = { bluetoothViewModel.disconnectFromDevice() }, disconnectFromDevice = {
preferencesViewModel.clearPreferences()
bluetoothViewModel.disconnectFromDevice()
},
deviceActionsList = defaultDeviceActionsList() deviceActionsList = defaultDeviceActionsList()
) )
if (preferencesViewModel.preferences != null) BackHandler {} if (preferencesViewModel.preferences != null) BackHandler {}
} }
composable("console") composable("console/{title}")
{ { backStackEntry ->
NotImplementedPage(
title = backStackEntry.arguments?.getString("title") ?: "null",
navigateBack = { navController.popBackStack() }
)
Button(onClick = { bluetoothViewModel.sendHelloWorld() }) {
Text("Click me!")
} }
composable("codeblocks")
{
} }
composable("imu_calibration") composable("codeblocks/{title}")
{ { backStackEntry ->
NotImplementedPage(
title = backStackEntry.arguments?.getString("title") ?: "null",
navigateBack = { navController.popBackStack() }
)
} }
composable("motor_test") composable("imu_calibration/{title}")
{ { backStackEntry ->
NotImplementedPage(
title = backStackEntry.arguments?.getString("title") ?: "null",
navigateBack = { navController.popBackStack() }
)
} }
composable("pid_settings") composable("motor_test/{title}")
{ { backStackEntry ->
NotImplementedPage(
title = backStackEntry.arguments?.getString("title") ?: "null",
navigateBack = { navController.popBackStack() }
)
} }
composable("reports") composable("pid_settings/{title}")
{ { backStackEntry ->
NotImplementedPage(
title = backStackEntry.arguments?.getString("title") ?: "null",
navigateBack = { navController.popBackStack() }
)
}
composable("reports/{title}")
{ backStackEntry ->
NotImplementedPage(
title = backStackEntry.arguments?.getString("title") ?: "null",
navigateBack = { navController.popBackStack() }
)
} }
} }
} }

View File

@@ -0,0 +1,21 @@
package com.helible.pilot
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.helible.pilot.components.BlankPage
@Composable
fun NotImplementedPage(title: String, navigateBack: () -> Unit) {
BlankPage(title = title, navigateBack = navigateBack) {
Column(modifier = Modifier
.fillMaxWidth()
.padding(10.dp)) {
Text(text = "Эта страница пока не готова и находится на стадии разработки")
}
}
}

View File

@@ -0,0 +1,59 @@
package com.helible.pilot.components
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
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.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
@Composable
fun BlankPage(title: String, navigateBack: () -> Unit, block: @Composable () -> Unit) {
Column(modifier = Modifier.fillMaxSize()) {
Row(verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.fillMaxWidth()
) {
IconButton(onClick = { navigateBack() }) {
Icon(
Icons.Default.ArrowBack,
tint = MaterialTheme.colorScheme.primary,
contentDescription = null
)
}
Text(
text = title,
fontSize = 18.sp,
fontWeight = FontWeight.ExtraBold,
modifier = Modifier.padding(horizontal = 10.dp, vertical = 8.dp)
)
}
block()
}
}
@Preview
@Composable
fun BlankPagePreview() {
Surface {
BlankPage(title = "Blank page", navigateBack = {}) {
Column(modifier = Modifier
.fillMaxWidth()
.padding(5.dp)) {
Text(text = "This page in development")
}
}
}
}

View File

@@ -6,8 +6,8 @@ import androidx.compose.material3.Divider
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.material3.TextButton import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
@Composable @Composable
fun RequiredHardwareFeatures( fun RequiredHardwareFeatures(
@@ -36,3 +36,16 @@ fun RequiredHardwareFeatures(
) )
} }
} }
@Preview
@Composable
fun RequiredHardwareFeaturesPreview() {
RequiredHardwareFeatures(
title = "Turn on Bluetooth",
description = "App requires Bluetooth turned on to continue",
confirmButtonText = "Turn on",
featureState = false,
requestFeature = {},
onDismissRequest = {}
)
}

View File

@@ -6,13 +6,14 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.material3.AlertDialog import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Divider import androidx.compose.material3.Divider
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@Composable @Composable
@@ -82,6 +83,16 @@ fun PermissionDialog(
) )
} }
@Preview
@Composable
fun PermissionDialogPreview() {
PermissionDialog(
LocationPermissionTextProvider(),
false,
{}, {}, {}, {}
)
}
interface PermissionTextProvider { interface PermissionTextProvider {
fun getDescription(isPermanentDeclined: Boolean): String fun getDescription(isPermanentDeclined: Boolean): String
} }

View File

@@ -5,15 +5,20 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
@Composable @Composable
fun Title(text: String, modifier: Modifier = Modifier) { fun Title(
text: String,
modifier: Modifier = Modifier,
fontSize: TextUnit = 23.sp,
) {
Text( Text(
text = text, text = text,
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
modifier = modifier, modifier = modifier,
fontSize = 23.sp, fontSize = fontSize,
fontWeight = FontWeight.ExtraBold fontWeight = FontWeight.ExtraBold
) )
} }

View File

@@ -32,7 +32,7 @@ import com.helible.pilot.viewmodels.AppPreferences
fun DeviceBadge( fun DeviceBadge(
bluetoothUiState: BluetoothUiState, bluetoothUiState: BluetoothUiState,
tryToReconnect: () -> Unit, tryToReconnect: () -> Unit,
getPreferences: () -> AppPreferences? getPreferences: () -> AppPreferences?,
) { ) {
ElevatedCard( ElevatedCard(
modifier = Modifier modifier = Modifier
@@ -91,6 +91,6 @@ fun DeviceBadgePreview() {
DeviceBadge( DeviceBadge(
bluetoothUiState = BluetoothUiState(isConnected = true), bluetoothUiState = BluetoothUiState(isConnected = true),
tryToReconnect = {}, tryToReconnect = {},
getPreferences = {AppPreferences("Helicopter", "AA:BB:CC:FF:DD")} getPreferences = { AppPreferences("Helicopter", "AA:BB:CC:FF:DD") }
) )
} }

View File

@@ -30,9 +30,8 @@ fun DeviceConnectionStatus(bluetoothState: BluetoothUiState) {
.requiredSize(Icons.Default.CheckCircle.defaultWidth) .requiredSize(Icons.Default.CheckCircle.defaultWidth)
.padding(2.dp) .padding(2.dp)
) )
Text ("На связи") Text("На связи")
} } else if (bluetoothState.errorMessage != null) {
else if (bluetoothState.errorMessage != null) {
Icon( Icon(
painter = painterResource(id = R.drawable.cancel), painter = painterResource(id = R.drawable.cancel),
contentDescription = null, contentDescription = null,
@@ -41,9 +40,8 @@ fun DeviceConnectionStatus(bluetoothState: BluetoothUiState) {
.requiredSize(R.drawable.cancel.dp) .requiredSize(R.drawable.cancel.dp)
.padding(2.dp) .padding(2.dp)
) )
Text ("Ошибка: ${bluetoothState.errorMessage}") Text("Ошибка: ${bluetoothState.errorMessage}")
} } else if (bluetoothState.isConnecting) {
else if (bluetoothState.isConnecting) {
Icon( Icon(
painter = painterResource(id = R.drawable.sync), painter = painterResource(id = R.drawable.sync),
contentDescription = null, contentDescription = null,
@@ -52,7 +50,7 @@ fun DeviceConnectionStatus(bluetoothState: BluetoothUiState) {
.requiredSize(R.drawable.sync.dp) .requiredSize(R.drawable.sync.dp)
.padding(2.dp) .padding(2.dp)
) )
Text ("Подключение...") Text("Подключение...")
} }
} }
} }

View File

@@ -1,20 +1,12 @@
package com.helible.pilot.components.deviceScreen package com.helible.pilot.components.deviceScreen
import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredSize
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Refresh
import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface import androidx.compose.material3.Surface
@@ -25,7 +17,6 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
@@ -46,7 +37,7 @@ fun DeviceControlScreen(
scannerPageName: String = "scanner", scannerPageName: String = "scanner",
) { ) {
LaunchedEffect(Unit) { LaunchedEffect(Unit) {
val preferences: AppPreferences? = getPreferences() val preferences = getPreferences()
if (preferences == null) { if (preferences == null) {
navigateToPage(scannerPageName) navigateToPage(scannerPageName)
} else { } else {
@@ -57,14 +48,14 @@ fun DeviceControlScreen(
LaunchedEffect(key1 = bluetoothUiState.isEnabled) { LaunchedEffect(key1 = bluetoothUiState.isEnabled) {
/* Trying to reconnect, when bluetooth is turned on */ /* Trying to reconnect, when bluetooth is turned on */
val preferences = getPreferences() val preferences = getPreferences()
if(preferences != null && bluetoothUiState.isEnabled) if (preferences != null && bluetoothUiState.isEnabled)
connectToDevice(preferences.deviceAddress) connectToDevice(preferences.deviceAddress)
} }
LaunchedEffect(key1 = bluetoothUiState.isLocationEnabled) { LaunchedEffect(key1 = bluetoothUiState.isLocationEnabled) {
/* Trying to reconnect, when location is turned on */ /* Trying to reconnect, when location is turned on */
val preferences = getPreferences() val preferences = getPreferences()
if(preferences != null && bluetoothUiState.isLocationEnabled) if (preferences != null && bluetoothUiState.isLocationEnabled)
connectToDevice(preferences.deviceAddress) connectToDevice(preferences.deviceAddress)
} }
@@ -82,7 +73,7 @@ fun DeviceControlScreen(
tryToReconnect = { tryToReconnect = {
/* Trying to reconnect, when error occurred */ /* Trying to reconnect, when error occurred */
val preferences = getPreferences() val preferences = getPreferences()
if(preferences != null) if (preferences != null)
connectToDevice(preferences.deviceAddress) connectToDevice(preferences.deviceAddress)
}, },
getPreferences = getPreferences getPreferences = getPreferences
@@ -90,13 +81,21 @@ fun DeviceControlScreen(
Column(modifier = Modifier.padding(horizontal = 3.dp)) { Column(modifier = Modifier.padding(horizontal = 3.dp)) {
for (section in deviceActionsList) { for (section in deviceActionsList) {
Text(section.key, Text(
section.key,
color = Color.Gray, color = Color.Gray,
fontWeight = FontWeight.Light, fontWeight = FontWeight.Light,
modifier = Modifier.padding(vertical = 15.dp, horizontal = 10.dp) modifier = Modifier.padding(vertical = 15.dp, horizontal = 10.dp)
) )
for (action in section.value) { for (action in section.value) {
TextButton(onClick = { /* TODO */}) { TextButton(
onClick = { navigateToPage(action.first + '/' + action.second.second) },
modifier = Modifier.fillMaxWidth()
) {
Row(modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(5.dp),
verticalAlignment = Alignment.CenterVertically
) {
Icon( Icon(
painter = painterResource(id = action.second.first.first), painter = painterResource(id = action.second.first.first),
tint = action.second.first.second, tint = action.second.first.second,
@@ -105,12 +104,12 @@ fun DeviceControlScreen(
) )
Text( Text(
text = action.second.second, text = action.second.second,
color = MaterialTheme.colorScheme.inverseSurface, color = MaterialTheme.colorScheme.inverseSurface
modifier = Modifier.padding(horizontal = 5.dp)
) )
} }
} }
} }
}
TextButton(onClick = { TextButton(onClick = {
disconnectFromDevice() disconnectFromDevice()

View File

@@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.material3.CardDefaults import androidx.compose.material3.CardDefaults
@@ -22,8 +21,9 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.helible.pilot.dataclasses.BluetoothDevice
import com.helible.pilot.R import com.helible.pilot.R
import com.helible.pilot.dataclasses.BluetoothDevice
@SuppressLint("MissingPermission") @SuppressLint("MissingPermission")
@Composable @Composable
@@ -44,7 +44,12 @@ fun DeviceItem(
) )
) { ) {
Row(modifier = Modifier.padding(8.dp)) { Row(modifier = Modifier.padding(8.dp)) {
Column(verticalArrangement = Arrangement.Center, modifier = Modifier.fillMaxHeight()) { Column(
verticalArrangement = Arrangement.Center,
modifier = Modifier
.fillMaxHeight()
.weight(1f, true)
) {
Text( Text(
text = deviceInfo.name, text = deviceInfo.name,
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Bold,
@@ -56,9 +61,10 @@ fun DeviceItem(
) )
} }
if (deviceInfo.isScanned) { if (deviceInfo.isScanned) {
Box(contentAlignment = Alignment.CenterEnd, modifier = Modifier.fillMaxSize()) { val icon = getSignalIconForRssiValue(deviceInfo.rssi)
Box(contentAlignment = Alignment.CenterEnd, modifier = Modifier.weight(0.3f)) {
Icon( Icon(
painterResource(id = getSignalIconForRssiValue(deviceInfo.rssi)), painterResource(id = icon),
contentDescription = null, contentDescription = null,
modifier = Modifier modifier = Modifier
.fillMaxHeight() .fillMaxHeight()
@@ -84,7 +90,7 @@ fun DeviceItemPreview() {
DeviceItem( DeviceItem(
BluetoothDevice("Helicopter", "AA:BB:CC:DD:FF", -90, true), BluetoothDevice("Helicopter", "AA:BB:CC:DD:FF", -90, true),
null, null,
{_ -> }, { _ -> },
modifier = Modifier.size(500.dp, 60.dp) modifier = Modifier.size(500.dp, 60.dp)
) )
} }

View File

@@ -7,16 +7,17 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.items
import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Surface
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import com.helible.pilot.components.scannerScreen.DeviceItem
import com.helible.pilot.dataclasses.BluetoothUiState
import com.helible.pilot.dataclasses.BluetoothDevice import com.helible.pilot.dataclasses.BluetoothDevice
import com.helible.pilot.dataclasses.BluetoothUiState
@Composable @Composable
fun DiscoveredDevicesList( fun DiscoveredDevicesList(
@@ -102,3 +103,26 @@ fun DiscoveredDevicesList(
} }
} }
} }
@Preview
@Composable
fun DiscoveredDevicesListPreview() {
val state = BluetoothUiState(
pairedBluetoothDevices = listOf(
BluetoothDevice("My car", "AA:BB:CC:DD:FF", -70, false),
BluetoothDevice("Speaker", "AA:BB:CC:DD:FF", -20, false),
BluetoothDevice("My TV", "AA:BB:CC:DD:FF", 10, false),
BluetoothDevice("My phone", "AA:BB:CC:DD:FF", -50, false),
BluetoothDevice("Mi Band 6", "AA:BB:CC:DD:FF", -100, false),
),
scannedBluetoothDevices = listOf(
BluetoothDevice("Watch", "AA:BB:CC:DD:FF", -10, true),
BluetoothDevice("Mi Cleaner", "AA:BB:CC:DD:FF", -90, true),
BluetoothDevice("My fridge", "AA:BB:CC:DD:FF", -100, true),
BluetoothDevice("Unknown device", "AA:BB:CC:DD:FF", -130, true)
)
)
Surface {
DiscoveredDevicesList(bluetoothState = state, selectedDevice = null, choiceDevice = {})
}
}

View File

@@ -18,17 +18,18 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.constraintlayout.compose.ConstraintLayout import androidx.constraintlayout.compose.ConstraintLayout
import androidx.constraintlayout.compose.Dimension import androidx.constraintlayout.compose.Dimension
import com.helible.pilot.components.Title import com.helible.pilot.components.Title
import com.helible.pilot.dataclasses.BluetoothUiState
import com.helible.pilot.dataclasses.BluetoothDevice import com.helible.pilot.dataclasses.BluetoothDevice
import com.helible.pilot.dataclasses.BluetoothUiState
@SuppressLint("MissingPermission") @SuppressLint("MissingPermission")
@Composable @Composable
fun BluetoothScannerScreen( fun ScannerScreen(
bluetoothState: BluetoothUiState, bluetoothState: BluetoothUiState,
selectedDevice: BluetoothDevice?, selectedDevice: BluetoothDevice?,
startScan: () -> Unit, startScan: () -> Unit,
@@ -107,3 +108,32 @@ fun BluetoothScannerScreen(
} }
} }
} }
@Preview
@Composable
fun ScannerScreenPreview() {
val state = BluetoothUiState(
pairedBluetoothDevices = listOf(
BluetoothDevice("My car", "AA:BB:CC:DD:FF", -70, false),
BluetoothDevice("Speaker", "AA:BB:CC:DD:FF", -20, false),
BluetoothDevice("My TV", "AA:BB:CC:DD:FF", 10, false),
BluetoothDevice("My phone", "AA:BB:CC:DD:FF", -50, false),
BluetoothDevice("Mi Band 6", "AA:BB:CC:DD:FF", -100, false),
),
scannedBluetoothDevices = listOf(
BluetoothDevice("Watch", "AA:BB:CC:DD:FF", -10, true),
BluetoothDevice("Mi Cleaner", "AA:BB:CC:DD:FF", -90, true),
BluetoothDevice("My fridge", "AA:BB:CC:DD:FF", -100, true),
BluetoothDevice("Unknown device", "AA:BB:CC:DD:FF", -130, true)
)
)
Surface {
ScannerScreen(
state,
state.scannedBluetoothDevices[1],
{}, {},
{ _ -> },
{},
)
}
}

View File

@@ -14,9 +14,9 @@ import android.os.Build
import android.util.Log import android.util.Log
import android.widget.Toast import android.widget.Toast
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity
import com.helible.pilot.BluetoothDataTransferService import com.helible.pilot.viewmodels.BluetoothDataTransferService
import com.helible.pilot.dataclasses.BluetoothDeviceDomain
import com.helible.pilot.KMessage import com.helible.pilot.KMessage
import com.helible.pilot.dataclasses.BluetoothDeviceDomain
import com.helible.pilot.receivers.BluetoothAdapterStateReceiver import com.helible.pilot.receivers.BluetoothAdapterStateReceiver
import com.helible.pilot.receivers.BluetoothStateReceiver import com.helible.pilot.receivers.BluetoothStateReceiver
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
@@ -40,7 +40,7 @@ import java.util.UUID
sealed interface ConnectionResult { sealed interface ConnectionResult {
object ConnectionEstablished : ConnectionResult object ConnectionEstablished : ConnectionResult
data class TransferSucceded(val message: KMessage) : ConnectionResult data class TransferSucceded(val message: String) : ConnectionResult
data class Error(val message: String) : ConnectionResult data class Error(val message: String) : ConnectionResult
} }
@@ -219,6 +219,7 @@ class AndroidBluetoothController(private val context: Context) : BluetoothContro
return flow {} return flow {}
} }
return flow { return flow {
Log.i("BluetoothController", "Connecting to device...")
currentClientSocket = currentClientSocket =
bluetoothAdapter.getRemoteDevice(device).createRfcommSocketToServiceRecord( bluetoothAdapter.getRemoteDevice(device).createRfcommSocketToServiceRecord(
UUID.fromString(SERVICE_UUID) UUID.fromString(SERVICE_UUID)
@@ -235,7 +236,9 @@ class AndroidBluetoothController(private val context: Context) : BluetoothContro
) )
} }
} catch (e: IOException) { } catch (e: IOException) {
closeConnection() socket.close()
currentClientSocket = null
Log.e("BluetoothController", e.toString())
emit(ConnectionResult.Error("Connection was interrupted")) emit(ConnectionResult.Error("Connection was interrupted"))
} }
} }
@@ -256,6 +259,7 @@ class AndroidBluetoothController(private val context: Context) : BluetoothContro
override fun closeConnection() { override fun closeConnection() {
currentClientSocket?.close() currentClientSocket?.close()
currentClientSocket = null currentClientSocket = null
Log.i("BluetoothController", "Connection closed")
} }
override fun onDestroy() { override fun onDestroy() {

View File

@@ -0,0 +1,9 @@
package com.helible.pilot.controllers
data class DeviceState(
val isHandshakeWaiting: Boolean = true,
val isIMUCalibrating: Boolean = false,
val flightMode: Boolean = false,
val batteryCharge: Int?,
val flightHeight: Float?
)

View File

@@ -1,13 +1,10 @@
package com.helible.pilot.receivers package com.helible.pilot.receivers
import android.annotation.SuppressLint
import android.bluetooth.BluetoothAdapter import android.bluetooth.BluetoothAdapter
import android.bluetooth.BluetoothDevice
import android.content.BroadcastReceiver import android.content.BroadcastReceiver
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.location.LocationManager import android.location.LocationManager
import android.os.Build
class BluetoothAdapterStateReceiver( class BluetoothAdapterStateReceiver(
private val onBluetoothEnabledChanged: (isBluetoothEnabled: Boolean) -> Unit, private val onBluetoothEnabledChanged: (isBluetoothEnabled: Boolean) -> Unit,

View File

@@ -1,6 +1,9 @@
package com.helible.pilot package com.helible.pilot.viewmodels
import android.bluetooth.BluetoothSocket import android.bluetooth.BluetoothSocket
import android.util.Log
import com.helible.pilot.KMessage
import com.helible.pilot.toKMessage
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flow
@@ -14,7 +17,7 @@ class TransferFailedException : IOException("Reading incoming data failed")
class BluetoothDataTransferService( class BluetoothDataTransferService(
private val socket: BluetoothSocket, private val socket: BluetoothSocket,
) { ) {
fun listenForIncomingMessages(): Flow<KMessage> { fun listenForIncomingMessages(): Flow<String> {
return flow { return flow {
if (!socket.isConnected) if (!socket.isConnected)
return@flow return@flow
@@ -25,11 +28,11 @@ class BluetoothDataTransferService(
} catch (e: IOException) { } catch (e: IOException) {
throw TransferFailedException() throw TransferFailedException()
} }
val strData: String = buffer.decodeToString(endIndex = byteCount)
emit( emit(
buffer.decodeToString( strData
endIndex = byteCount
).toKMessage()
) )
Log.i("BluetoothController", "Received: ${strData.dropLast(2)}")
} }
}.flowOn(Dispatchers.IO) }.flowOn(Dispatchers.IO)
} }

View File

@@ -2,12 +2,13 @@ package com.helible.pilot.viewmodels
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.helible.pilot.controllers.BluetoothController
import com.helible.pilot.controllers.ConnectionResult
import com.helible.pilot.dataclasses.AlarmStateMessage import com.helible.pilot.dataclasses.AlarmStateMessage
import com.helible.pilot.dataclasses.BluetoothDevice
import com.helible.pilot.dataclasses.BluetoothUiState import com.helible.pilot.dataclasses.BluetoothUiState
import com.helible.pilot.dataclasses.EmergStopMessage import com.helible.pilot.dataclasses.EmergStopMessage
import com.helible.pilot.dataclasses.RotorsSpeedMessage import com.helible.pilot.dataclasses.RotorsSpeedMessage
import com.helible.pilot.controllers.BluetoothController
import com.helible.pilot.controllers.ConnectionResult
import com.squareup.moshi.Moshi import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
@@ -24,7 +25,6 @@ import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.flow.update import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import com.helible.pilot.dataclasses.BluetoothDevice
class BluetoothViewModel( class BluetoothViewModel(
private val bluetoothController: BluetoothController, private val bluetoothController: BluetoothController,
@@ -94,7 +94,9 @@ class BluetoothViewModel(
} }
is ConnectionResult.TransferSucceded -> { is ConnectionResult.TransferSucceded -> {
TODO("Telemetry not implemented") _state.update { it.copy(
) }
} }
is ConnectionResult.Error -> { is ConnectionResult.Error -> {
@@ -108,14 +110,12 @@ class BluetoothViewModel(
} }
} }
} }
.catch { _ -> .catch { throwable ->
bluetoothController.closeConnection() bluetoothController.closeConnection()
_state.update { _state.update { it.copy(
it.copy(
isConnected = false, isConnected = false,
isConnecting = false isConnecting = false
) ) }
}
} }
.launchIn(viewModelScope) .launchIn(viewModelScope)
} }
@@ -123,7 +123,7 @@ class BluetoothViewModel(
private var deviceConnectionJob: Job? = null private var deviceConnectionJob: Job? = null
fun connectToDevice(device: String) { fun connectToDevice(device: String) {
if(_state.value.isConnected) { if (_state.value.isConnected and _state.value.isConnecting) {
return return
} }
_state.update { it.copy(isConnecting = true) } _state.update { it.copy(isConnecting = true) }
@@ -162,36 +162,12 @@ class BluetoothViewModel(
super.onCleared() super.onCleared()
} }
fun sendRotorsDutySpeed(rotorsState: RotorsSpeedMessage) { fun sendHelloWorld() {
viewModelScope.launch { viewModelScope.launch {
bluetoothController.trySendMessage( bluetoothController.trySendMessage(
rotorsStateMessegeAdapter.toJson(rotorsState).plus("\r").toByteArray() "{\"p1\": {\"p\": 1.5, \"i\": 1.5, \"d\": 1.5}}\n\r".toByteArray()
//"{\"p1\": [1.5, 1.5, 1.5]}\n\r".toByteArray()
) )
} }
} }
fun sendAlarmState(alarmStateMessage: AlarmStateMessage) {
viewModelScope.launch {
bluetoothController.trySendMessage(
alarmStateMessageAdapter.toJson(alarmStateMessage).plus("\r").toByteArray()
)
}
}
fun sendEmergStop() {
viewModelScope.launch {
bluetoothController.trySendMessage(
emergStopMessageAdapter.toJson(EmergStopMessage(true)).plus("\r").toByteArray()
)
}
}
fun sendR3Duty(r3: Int) {
viewModelScope.launch {
bluetoothController.trySendMessage(
"R3$r3\n\r".toByteArray()
)
delay(30)
}
}
} }

View File

@@ -6,5 +6,5 @@
android:tint="?android:colorPrimary"> android:tint="?android:colorPrimary">
<path <path
android:fillColor="@android:color/white" android:fillColor="@android:color/white"
android:pathData="M336,680L480,536L624,680L680,624L536,480L680,336L624,280L480,424L336,280L280,336L424,480L280,624L336,680ZM480,880Q397,880 324,848.5Q251,817 197,763Q143,709 111.5,636Q80,563 80,480Q80,397 111.5,324Q143,251 197,197Q251,143 324,111.5Q397,80 480,80Q563,80 636,111.5Q709,143 763,197Q817,251 848.5,324Q880,397 880,480Q880,563 848.5,636Q817,709 763,763Q709,817 636,848.5Q563,880 480,880ZM480,800Q614,800 707,707Q800,614 800,480Q800,346 707,253Q614,160 480,160Q346,160 253,253Q160,346 160,480Q160,614 253,707Q346,800 480,800ZM480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Z"/> android:pathData="M336,680L480,536L624,680L680,624L536,480L680,336L624,280L480,424L336,280L280,336L424,480L280,624L336,680ZM480,880Q397,880 324,848.5Q251,817 197,763Q143,709 111.5,636Q80,563 80,480Q80,397 111.5,324Q143,251 197,197Q251,143 324,111.5Q397,80 480,80Q563,80 636,111.5Q709,143 763,197Q817,251 848.5,324Q880,397 880,480Q880,563 848.5,636Q817,709 763,763Q709,817 636,848.5Q563,880 480,880ZM480,800Q614,800 707,707Q800,614 800,480Q800,346 707,253Q614,160 480,160Q346,160 253,253Q160,346 160,480Q160,614 253,707Q346,800 480,800ZM480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Z" />
</vector> </vector>

View File

@@ -6,5 +6,5 @@
android:tint="?android:colorPrimary"> android:tint="?android:colorPrimary">
<path <path
android:fillColor="@android:color/white" android:fillColor="@android:color/white"
android:pathData="M384,624L440,567L353,480L440,393L384,336L240,480L384,624ZM576,624L720,480L576,336L520,393L607,480L520,567L576,624ZM200,840Q167,840 143.5,816.5Q120,793 120,760L120,200Q120,167 143.5,143.5Q167,120 200,120L760,120Q793,120 816.5,143.5Q840,167 840,200L840,760Q840,793 816.5,816.5Q793,840 760,840L200,840ZM200,760L760,760Q760,760 760,760Q760,760 760,760L760,200Q760,200 760,200Q760,200 760,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760ZM200,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760L200,760Q200,760 200,760Q200,760 200,760L200,200Q200,200 200,200Q200,200 200,200Z"/> android:pathData="M384,624L440,567L353,480L440,393L384,336L240,480L384,624ZM576,624L720,480L576,336L520,393L607,480L520,567L576,624ZM200,840Q167,840 143.5,816.5Q120,793 120,760L120,200Q120,167 143.5,143.5Q167,120 200,120L760,120Q793,120 816.5,143.5Q840,167 840,200L840,760Q840,793 816.5,816.5Q793,840 760,840L200,840ZM200,760L760,760Q760,760 760,760Q760,760 760,760L760,200Q760,200 760,200Q760,200 760,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760ZM200,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760L200,760Q200,760 200,760Q200,760 200,760L200,200Q200,200 200,200Q200,200 200,200Z" />
</vector> </vector>

View File

@@ -6,5 +6,5 @@
android:tint="?android:colorPrimary"> android:tint="?android:colorPrimary">
<path <path
android:fillColor="@android:color/white" android:fillColor="@android:color/white"
android:pathData="M756,840L537,621L621,537L840,756L756,840ZM204,840L120,756L396,480L328,412L300,440L249,389L249,471L221,499L100,378L128,350L210,350L160,300L302,158Q322,138 345,129Q368,120 392,120Q416,120 439,129Q462,138 482,158L390,250L440,300L412,328L480,396L570,306Q566,295 563.5,283Q561,271 561,259Q561,200 601.5,159.5Q642,119 701,119Q716,119 729.5,122Q743,125 757,131L658,230L730,302L829,203Q836,217 838.5,230.5Q841,244 841,259Q841,318 800.5,358.5Q760,399 701,399Q689,399 677,397Q665,395 654,390L204,840Z"/> android:pathData="M756,840L537,621L621,537L840,756L756,840ZM204,840L120,756L396,480L328,412L300,440L249,389L249,471L221,499L100,378L128,350L210,350L160,300L302,158Q322,138 345,129Q368,120 392,120Q416,120 439,129Q462,138 482,158L390,250L440,300L412,328L480,396L570,306Q566,295 563.5,283Q561,271 561,259Q561,200 601.5,159.5Q642,119 701,119Q716,119 729.5,122Q743,125 757,131L658,230L730,302L829,203Q836,217 838.5,230.5Q841,244 841,259Q841,318 800.5,358.5Q760,399 701,399Q689,399 677,397Q665,395 654,390L204,840Z" />
</vector> </vector>

View File

@@ -6,5 +6,5 @@
android:tint="?android:colorPrimary"> android:tint="?android:colorPrimary">
<path <path
android:fillColor="@android:color/white" android:fillColor="@android:color/white"
android:pathData="M480,720Q580,720 650,650Q720,580 720,480Q720,380 650,310Q580,240 480,240Q380,240 310,310Q240,380 240,480Q240,580 310,650Q380,720 480,720ZM480,640Q414,640 367,593Q320,546 320,480Q320,414 367,367Q414,320 480,320Q546,320 593,367Q640,414 640,480Q640,546 593,593Q546,640 480,640ZM452,508Q463,519 480,519Q497,519 508,508L564,452Q575,441 575,424Q575,407 564,396Q553,385 536,385Q519,385 508,396L452,452Q441,463 441,480Q441,497 452,508ZM200,840Q167,840 143.5,816.5Q120,793 120,760L120,200Q120,167 143.5,143.5Q167,120 200,120L760,120Q793,120 816.5,143.5Q840,167 840,200L840,760Q840,793 816.5,816.5Q793,840 760,840L200,840ZM200,760L760,760Q760,760 760,760Q760,760 760,760L760,200Q760,200 760,200Q760,200 760,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760ZM200,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760L200,760Q200,760 200,760Q200,760 200,760L200,200Q200,200 200,200Q200,200 200,200Z"/> android:pathData="M480,720Q580,720 650,650Q720,580 720,480Q720,380 650,310Q580,240 480,240Q380,240 310,310Q240,380 240,480Q240,580 310,650Q380,720 480,720ZM480,640Q414,640 367,593Q320,546 320,480Q320,414 367,367Q414,320 480,320Q546,320 593,367Q640,414 640,480Q640,546 593,593Q546,640 480,640ZM452,508Q463,519 480,519Q497,519 508,508L564,452Q575,441 575,424Q575,407 564,396Q553,385 536,385Q519,385 508,396L452,452Q441,463 441,480Q441,497 452,508ZM200,840Q167,840 143.5,816.5Q120,793 120,760L120,200Q120,167 143.5,143.5Q167,120 200,120L760,120Q793,120 816.5,143.5Q840,167 840,200L840,760Q840,793 816.5,816.5Q793,840 760,840L200,840ZM200,760L760,760Q760,760 760,760Q760,760 760,760L760,200Q760,200 760,200Q760,200 760,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760ZM200,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760L200,760Q200,760 200,760Q200,760 200,760L200,200Q200,200 200,200Q200,200 200,200Z" />
</vector> </vector>

View File

@@ -6,5 +6,5 @@
android:tint="?android:colorPrimary"> android:tint="?android:colorPrimary">
<path <path
android:fillColor="@android:color/white" android:fillColor="@android:color/white"
android:pathData="M360,880L360,840Q360,808 384,786.5Q408,765 440,760L440,760L440,474Q418,466 401.5,451Q385,436 374,416L298,436Q262,444 229.5,430Q197,416 188,382L362,338Q370,297 400,270Q430,243 472,240L496,150Q506,115 534.5,94.5Q563,74 598,82L548,262Q573,278 586.5,304Q600,330 600,360Q600,373 597,385.5Q594,398 590,410L644,466Q669,492 673.5,527Q678,562 654,586L534,466Q531,469 527.5,470.5Q524,472 520,474L520,760L520,760Q552,765 576,786.5Q600,808 600,840L600,880L360,880ZM480,420Q505,420 522.5,402.5Q540,385 540,360Q540,335 522.5,317.5Q505,300 480,300Q455,300 437.5,317.5Q420,335 420,360Q420,385 437.5,402.5Q455,420 480,420Z"/> android:pathData="M360,880L360,840Q360,808 384,786.5Q408,765 440,760L440,760L440,474Q418,466 401.5,451Q385,436 374,416L298,436Q262,444 229.5,430Q197,416 188,382L362,338Q370,297 400,270Q430,243 472,240L496,150Q506,115 534.5,94.5Q563,74 598,82L548,262Q573,278 586.5,304Q600,330 600,360Q600,373 597,385.5Q594,398 590,410L644,466Q669,492 673.5,527Q678,562 654,586L534,466Q531,469 527.5,470.5Q524,472 520,474L520,760L520,760Q552,765 576,786.5Q600,808 600,840L600,880L360,880ZM480,420Q505,420 522.5,402.5Q540,385 540,360Q540,335 522.5,317.5Q505,300 480,300Q455,300 437.5,317.5Q420,335 420,360Q420,385 437.5,402.5Q455,420 480,420Z" />
</vector> </vector>

View File

@@ -6,5 +6,5 @@
android:tint="?android:colorPrimary"> android:tint="?android:colorPrimary">
<path <path
android:fillColor="@android:color/white" android:fillColor="@android:color/white"
android:pathData="M360,520L360,280L360,280Q260,280 190,350Q120,420 120,520L120,520L360,520ZM520,680L520,280L440,280L440,600L120,600L120,680Q120,680 120,680Q120,680 120,680L520,680ZM600,552L840,528L840,480L600,480L600,552ZM520,880L120,880L120,800L520,800L520,880ZM600,760L120,760Q87,760 63.5,736.5Q40,713 40,680L40,520Q40,386 133,293Q226,200 360,200L600,200L600,400L800,400L840,320L920,320L920,600L600,632L600,760ZM760,160L120,160L120,80L760,80L760,160ZM600,552L600,480L600,480L600,552L600,552ZM520,680L520,680Q520,680 520,680Q520,680 520,680L520,680L520,680L520,680L520,680L520,680Z"/> android:pathData="M360,520L360,280L360,280Q260,280 190,350Q120,420 120,520L120,520L360,520ZM520,680L520,280L440,280L440,600L120,600L120,680Q120,680 120,680Q120,680 120,680L520,680ZM600,552L840,528L840,480L600,480L600,552ZM520,880L120,880L120,800L520,800L520,880ZM600,760L120,760Q87,760 63.5,736.5Q40,713 40,680L40,520Q40,386 133,293Q226,200 360,200L600,200L600,400L800,400L840,320L920,320L920,600L600,632L600,760ZM760,160L120,160L120,80L760,80L760,160ZM600,552L600,480L600,480L600,552L600,552ZM520,680L520,680Q520,680 520,680Q520,680 520,680L520,680L520,680L520,680L520,680L520,680Z" />
</vector> </vector>

View File

@@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#000000" <vector android:height="24dp"
android:viewportHeight="24" android:viewportWidth="24" android:tint="#000000"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> android:viewportHeight="24"
<path android:fillColor="#FF000000" android:pathData="M17.6,11.48 L19.44,8.3a0.63,0.63 0,0 0,-1.09 -0.63l-1.88,3.24a11.43,11.43 0,0 0,-8.94 0L5.65,7.67a0.63,0.63 0,0 0,-1.09 0.63L6.4,11.48A10.81,10.81 0,0 0,1 20L23,20A10.81,10.81 0,0 0,17.6 11.48ZM7,17.25A1.25,1.25 0,1 1,8.25 16,1.25 1.25,0 0,1 7,17.25ZM17,17.25A1.25,1.25 0,1 1,18.25 16,1.25 1.25,0 0,1 17,17.25Z"/> android:viewportWidth="24"
android:width="24dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="#FF000000"
android:pathData="M17.6,11.48 L19.44,8.3a0.63,0.63 0,0 0,-1.09 -0.63l-1.88,3.24a11.43,11.43 0,0 0,-8.94 0L5.65,7.67a0.63,0.63 0,0 0,-1.09 0.63L6.4,11.48A10.81,10.81 0,0 0,1 20L23,20A10.81,10.81 0,0 0,17.6 11.48ZM7,17.25A1.25,1.25 0,1 1,8.25 16,1.25 1.25,0 0,1 7,17.25ZM17,17.25A1.25,1.25 0,1 1,18.25 16,1.25 1.25,0 0,1 17,17.25Z" />
</vector> </vector>

View File

@@ -6,5 +6,5 @@
android:tint="?android:colorPrimary"> android:tint="?android:colorPrimary">
<path <path
android:fillColor="@android:color/white" android:fillColor="@android:color/white"
android:pathData="M200,800L200,520L120,520L120,440L360,440L360,520L280,520L280,800L200,800ZM200,360L200,160L280,160L280,360L200,360ZM360,360L360,280L440,280L440,160L520,160L520,280L600,280L600,360L360,360ZM440,800L440,440L520,440L520,800L440,800ZM680,800L680,680L600,680L600,600L840,600L840,680L760,680L760,800L680,800ZM680,520L680,160L760,160L760,520L680,520Z"/> android:pathData="M200,800L200,520L120,520L120,440L360,440L360,520L280,520L280,800L200,800ZM200,360L200,160L280,160L280,360L200,360ZM360,360L360,280L440,280L440,160L520,160L520,280L600,280L600,360L360,360ZM440,800L440,440L520,440L520,800L440,800ZM680,800L680,680L600,680L600,600L840,600L840,680L760,680L760,800L680,800ZM680,520L680,160L760,160L760,520L680,520Z" />
</vector> </vector>

View File

@@ -6,5 +6,5 @@
android:tint="?android:colorPrimary"> android:tint="?android:colorPrimary">
<path <path
android:fillColor="@android:color/holo_orange_light" android:fillColor="@android:color/holo_orange_light"
android:pathData="M272,520L480,640Q480,640 480,640Q480,640 480,640L688,520L520,423L520,560L440,560L440,423L272,520ZM440,331L440,314Q396,301 368,264.5Q340,228 340,180Q340,122 381,81Q422,40 480,40Q538,40 579,81Q620,122 620,180Q620,228 592,264.5Q564,301 520,314L520,331L800,492Q819,503 829.5,521.5Q840,540 840,562L840,638Q840,660 829.5,678.5Q819,697 800,708L520,869Q501,880 480,880Q459,880 440,869L160,708Q141,697 130.5,678.5Q120,660 120,638L120,562Q120,540 130.5,521.5Q141,503 160,492L440,331ZM440,709L200,571L200,638Q200,638 200,638Q200,638 200,638L480,800Q480,800 480,800Q480,800 480,800L760,638Q760,638 760,638Q760,638 760,638L760,571L520,709Q501,720 480,720Q459,720 440,709ZM480,240Q505,240 522.5,222.5Q540,205 540,180Q540,155 522.5,137.5Q505,120 480,120Q455,120 437.5,137.5Q420,155 420,180Q420,205 437.5,222.5Q455,240 480,240ZM480,800Q480,800 480,800Q480,800 480,800L480,800L480,800Q480,800 480,800Q480,800 480,800L480,800Q480,800 480,800Q480,800 480,800L480,800Q480,800 480,800Q480,800 480,800L480,800L480,800Z"/> android:pathData="M272,520L480,640Q480,640 480,640Q480,640 480,640L688,520L520,423L520,560L440,560L440,423L272,520ZM440,331L440,314Q396,301 368,264.5Q340,228 340,180Q340,122 381,81Q422,40 480,40Q538,40 579,81Q620,122 620,180Q620,228 592,264.5Q564,301 520,314L520,331L800,492Q819,503 829.5,521.5Q840,540 840,562L840,638Q840,660 829.5,678.5Q819,697 800,708L520,869Q501,880 480,880Q459,880 440,869L160,708Q141,697 130.5,678.5Q120,660 120,638L120,562Q120,540 130.5,521.5Q141,503 160,492L440,331ZM440,709L200,571L200,638Q200,638 200,638Q200,638 200,638L480,800Q480,800 480,800Q480,800 480,800L760,638Q760,638 760,638Q760,638 760,638L760,571L520,709Q501,720 480,720Q459,720 440,709ZM480,240Q505,240 522.5,222.5Q540,205 540,180Q540,155 522.5,137.5Q505,120 480,120Q455,120 437.5,137.5Q420,155 420,180Q420,205 437.5,222.5Q455,240 480,240ZM480,800Q480,800 480,800Q480,800 480,800L480,800L480,800Q480,800 480,800Q480,800 480,800L480,800Q480,800 480,800Q480,800 480,800L480,800Q480,800 480,800Q480,800 480,800L480,800L480,800Z" />
</vector> </vector>

View File

@@ -7,5 +7,5 @@
android:autoMirrored="true"> android:autoMirrored="true">
<path <path
android:fillColor="@android:color/white" android:fillColor="@android:color/white"
android:pathData="M200,840Q167,840 143.5,816.5Q120,793 120,760L120,200Q120,167 143.5,143.5Q167,120 200,120L480,120L480,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760L480,760L480,840L200,840ZM640,680L585,622L687,520L360,520L360,440L687,440L585,338L640,280L840,480L640,680Z"/> android:pathData="M200,840Q167,840 143.5,816.5Q120,793 120,760L120,200Q120,167 143.5,143.5Q167,120 200,120L480,120L480,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760L480,760L480,840L200,840ZM640,680L585,622L687,520L360,520L360,440L687,440L585,338L640,280L840,480L640,680Z" />
</vector> </vector>

View File

@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="500" android:viewportHeight="500"> <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="500"
android:viewportHeight="500">
<path <path
android:fillColor="?android:colorPrimary" android:fillColor="?android:colorPrimary"
android:pathData="M 15 340 L 80 340 Q 95 340 95 355 L 95 485 Q 95 500 80 500 L 15 500 Q 0 500 0 485 L 0 355 Q 0 340 15 340 Z" /> android:pathData="M 15 340 L 80 340 Q 95 340 95 355 L 95 485 Q 95 500 80 500 L 15 500 Q 0 500 0 485 L 0 355 Q 0 340 15 340 Z" />

View File

@@ -6,5 +6,5 @@
android:tint="?android:colorPrimary"> android:tint="?android:colorPrimary">
<path <path
android:fillColor="@android:color/white" android:fillColor="@android:color/white"
android:pathData="M160,800L160,720L270,720L254,706Q202,660 181,601Q160,542 160,482Q160,371 226.5,284.5Q293,198 400,170L400,254Q328,280 284,342.5Q240,405 240,482Q240,527 257,569.5Q274,612 310,648L320,658L320,560L400,560L400,800L160,800ZM560,790L560,706Q632,680 676,617.5Q720,555 720,478Q720,433 703,390.5Q686,348 650,312L640,302L640,400L560,400L560,160L800,160L800,240L690,240L706,254Q755,303 777.5,360.5Q800,418 800,478Q800,589 733.5,675.5Q667,762 560,790Z"/> android:pathData="M160,800L160,720L270,720L254,706Q202,660 181,601Q160,542 160,482Q160,371 226.5,284.5Q293,198 400,170L400,254Q328,280 284,342.5Q240,405 240,482Q240,527 257,569.5Q274,612 310,648L320,658L320,560L400,560L400,800L160,800ZM560,790L560,706Q632,680 676,617.5Q720,555 720,478Q720,433 703,390.5Q686,348 650,312L640,302L640,400L560,400L560,160L800,160L800,240L690,240L706,254Q755,303 777.5,360.5Q800,418 800,478Q800,589 733.5,675.5Q667,762 560,790Z" />
</vector> </vector>

View File

@@ -6,5 +6,5 @@
android:tint="?android:colorPrimary"> android:tint="?android:colorPrimary">
<path <path
android:fillColor="@android:color/white" android:fillColor="@android:color/white"
android:pathData="M440,840L440,600L520,600L520,680L840,680L840,760L520,760L520,840L440,840ZM120,760L120,680L360,680L360,760L120,760ZM280,600L280,520L120,520L120,440L280,440L280,360L360,360L360,600L280,600ZM440,520L440,440L840,440L840,520L440,520ZM600,360L600,120L680,120L680,200L840,200L840,280L680,280L680,360L600,360ZM120,280L120,200L520,200L520,280L120,280Z"/> android:pathData="M440,840L440,600L520,600L520,680L840,680L840,760L520,760L520,840L440,840ZM120,760L120,680L360,680L360,760L120,760ZM280,600L280,520L120,520L120,440L280,440L280,360L360,360L360,600L280,600ZM440,520L440,440L840,440L840,520L440,520ZM600,360L600,120L680,120L680,200L840,200L840,280L680,280L680,360L600,360ZM120,280L120,200L520,200L520,280L120,280Z" />
</vector> </vector>

View File

@@ -1,9 +1,8 @@
package com.helible.pilot package com.helible.pilot
import org.junit.Assert.assertEquals
import org.junit.Test import org.junit.Test
import org.junit.Assert.*
/** /**
* Example local unit test, which will execute on the development machine (host). * Example local unit test, which will execute on the development machine (host).
* *