kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
improve settings tab UI
rodzic
277db36a46
commit
6071fec804
|
@ -1,6 +1,5 @@
|
||||||
package com.geeksville.mesh.ui
|
package com.geeksville.mesh.ui
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.bluetooth.BluetoothDevice
|
import android.bluetooth.BluetoothDevice
|
||||||
import android.companion.CompanionDeviceManager
|
import android.companion.CompanionDeviceManager
|
||||||
import android.content.*
|
import android.content.*
|
||||||
|
@ -62,8 +61,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||||
|
|
||||||
private val myActivity get() = requireActivity() as MainActivity
|
private val myActivity get() = requireActivity() as MainActivity
|
||||||
|
|
||||||
@SuppressLint("MissingPermission")
|
private val associationResultLauncher = registerForActivityResult(
|
||||||
val associationResultLauncher = registerForActivityResult(
|
|
||||||
ActivityResultContracts.StartIntentSenderForResult()
|
ActivityResultContracts.StartIntentSenderForResult()
|
||||||
) {
|
) {
|
||||||
it.data
|
it.data
|
||||||
|
@ -210,7 +208,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||||
spinner.isEnabled = true
|
spinner.isEnabled = true
|
||||||
|
|
||||||
// If actively connected possibly let the user update firmware
|
// If actively connected possibly let the user update firmware
|
||||||
refreshUpdateButton(region != ConfigProtos.Config.LoRaConfig.RegionCode.Unset)
|
refreshUpdateButton(model.isConnected())
|
||||||
|
|
||||||
// Update the status string (highest priority messages first)
|
// Update the status string (highest priority messages first)
|
||||||
val info = model.myNodeInfo.value
|
val info = model.myNodeInfo.value
|
||||||
|
@ -220,12 +218,9 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||||
(permissionsWarning != null) ->
|
(permissionsWarning != null) ->
|
||||||
statusText.text = permissionsWarning
|
statusText.text = permissionsWarning
|
||||||
|
|
||||||
region == ConfigProtos.Config.LoRaConfig.RegionCode.Unset ->
|
|
||||||
statusText.text = getString(R.string.must_set_region)
|
|
||||||
|
|
||||||
connected == MeshService.ConnectionState.CONNECTED -> {
|
connected == MeshService.ConnectionState.CONNECTED -> {
|
||||||
val fwStr = info?.firmwareString ?: "unknown"
|
statusText.text = if (region.number == 0) getString(R.string.must_set_region)
|
||||||
statusText.text = getString(R.string.connected_to).format(fwStr)
|
else getString(R.string.connected_to).format(info?.firmwareString ?: "unknown")
|
||||||
}
|
}
|
||||||
connected == MeshService.ConnectionState.DISCONNECTED ->
|
connected == MeshService.ConnectionState.DISCONNECTED ->
|
||||||
statusText.text = getString(R.string.not_connected)
|
statusText.text = getString(R.string.not_connected)
|
||||||
|
|
Ładowanie…
Reference in New Issue