From 4f24794001fb6e4fc8de4dae9c723ea69f2b7b14 Mon Sep 17 00:00:00 2001 From: geeksville Date: Sun, 19 Apr 2020 16:24:47 -0700 Subject: [PATCH] wix warnings --- .../main/java/com/geeksville/mesh/MainActivity.kt | 13 ++++++------- .../main/java/com/geeksville/mesh/model/Channel.kt | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/MainActivity.kt b/app/src/main/java/com/geeksville/mesh/MainActivity.kt index 59594790e..6eedc96f5 100644 --- a/app/src/main/java/com/geeksville/mesh/MainActivity.kt +++ b/app/src/main/java/com/geeksville/mesh/MainActivity.kt @@ -359,6 +359,7 @@ class MainActivity : AppCompatActivity(), Logging, MeshService.ConnectionState.CONNECTED -> R.drawable.cloud_on MeshService.ConnectionState.DEVICE_SLEEP -> R.drawable.ic_twotone_cloud_upload_24 MeshService.ConnectionState.DISCONNECTED -> R.drawable.cloud_off + else -> R.drawable.cloud_off } connectStatusImage.setImageDrawable(getDrawable(image)) @@ -386,7 +387,7 @@ class MainActivity : AppCompatActivity(), Logging, requestedChannelUrl = appLinkData // if the device is connected already, process it now - if (model.isConnected == MeshService.ConnectionState.CONNECTED) + if (model.isConnected.value == MeshService.ConnectionState.CONNECTED) perhapsChangeChannel() // We now wait for the device to connect, once connected, we ask the user if they want to switch to the new channel @@ -423,7 +424,7 @@ class MainActivity : AppCompatActivity(), Logging, Activity.RESULT_OK -> { // User has chosen to pair with the Bluetooth device. val device: BluetoothDevice = - data!!.getParcelableExtra(CompanionDeviceManager.EXTRA_DEVICE) + data?.getParcelableExtra(CompanionDeviceManager.EXTRA_DEVICE)!! debug("Received BLE pairing ${device.address}") if (device.bondState != BluetoothDevice.BOND_BONDED) { device.createBond() @@ -647,11 +648,9 @@ class MainActivity : AppCompatActivity(), Logging, // If we have received the service, and hence registered with // it, then now is the time to unregister. // if we never connected, do nothing - mesh?.let { - debug("Unbinding from mesh service!") - it.close() - model.meshService = null - } + debug("Unbinding from mesh service!") + mesh.close() + model.meshService = null } override fun onStop() { diff --git a/app/src/main/java/com/geeksville/mesh/model/Channel.kt b/app/src/main/java/com/geeksville/mesh/model/Channel.kt index 0209b2795..68a3e9f69 100644 --- a/app/src/main/java/com/geeksville/mesh/model/Channel.kt +++ b/app/src/main/java/com/geeksville/mesh/model/Channel.kt @@ -47,7 +47,7 @@ data class Channel( fun getChannelUrl(): Uri { // If we have a valid radio config use it, othterwise use whatever we have saved in the prefs - val channelBytes = settings?.toByteArray() ?: ByteArray(0) // if unset just use empty + val channelBytes = settings.toByteArray() ?: ByteArray(0) // if unset just use empty val enc = Base64.encodeToString(channelBytes, base64Flags) return Uri.parse("$prefix$enc")