kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
don't briefly pop up fields with "null" as content
rodzic
97b2b3c471
commit
d3a1107cd3
|
@ -574,6 +574,10 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||||
|
|
||||||
/// Setup the ui widgets unrelated to BLE scanning
|
/// Setup the ui widgets unrelated to BLE scanning
|
||||||
private fun initCommonUI() {
|
private fun initCommonUI() {
|
||||||
|
// We want to leave these visible in the IDE, but make sure they default to not visible until we have valid data
|
||||||
|
binding.positionBroadcastPeriodView.visibility = View.GONE
|
||||||
|
binding.lsSleepView.visibility = View.GONE
|
||||||
|
|
||||||
model.ownerName.observe(viewLifecycleOwner, { name ->
|
model.ownerName.observe(viewLifecycleOwner, { name ->
|
||||||
binding.usernameEditText.setText(name)
|
binding.usernameEditText.setText(name)
|
||||||
})
|
})
|
||||||
|
@ -587,8 +591,10 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||||
model.isConnected.observe(viewLifecycleOwner, Observer { connectionState ->
|
model.isConnected.observe(viewLifecycleOwner, Observer { connectionState ->
|
||||||
val connected = connectionState == MeshService.ConnectionState.CONNECTED
|
val connected = connectionState == MeshService.ConnectionState.CONNECTED
|
||||||
binding.usernameView.isEnabled = connected
|
binding.usernameView.isEnabled = connected
|
||||||
binding.positionBroadcastPeriodView.isEnabled = connected
|
|
||||||
binding.lsSleepView.isEnabled = connected
|
// Don't even show advanced fields until after we have a connection
|
||||||
|
binding.positionBroadcastPeriodView.visibility = if (connected) View.VISIBLE else View.GONE
|
||||||
|
binding.lsSleepView.visibility = if (connected) View.VISIBLE else View.GONE
|
||||||
|
|
||||||
if (connectionState == MeshService.ConnectionState.DISCONNECTED)
|
if (connectionState == MeshService.ConnectionState.DISCONNECTED)
|
||||||
model.ownerName.value = ""
|
model.ownerName.value = ""
|
||||||
|
|
Ładowanie…
Reference in New Issue