kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
Disable the "set default channel" button if already on the default channel
rodzic
8f32c39c5f
commit
10d6537972
|
@ -78,6 +78,10 @@ data class Channel(
|
|||
|
||||
return "#${name}-${suffix}"
|
||||
}
|
||||
|
||||
override fun equals(o: Any?): Boolean = (o is Channel)
|
||||
&& psk.toByteArray() contentEquals o.psk.toByteArray()
|
||||
&& name == o.name
|
||||
}
|
||||
|
||||
fun xorHash(b: ByteArray) = b.fold(0, { acc, x -> acc xor (x.toInt() and 0xff) })
|
|
@ -85,7 +85,7 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
|
|||
|
||||
// Only let buttons work if we are connected to the radio
|
||||
binding.shareButton.isEnabled = connected
|
||||
binding.resetButton.isEnabled = connected
|
||||
binding.resetButton.isEnabled = connected && Channel.defaultChannel != channel
|
||||
|
||||
binding.editableCheckbox.isChecked = false // start locked
|
||||
if (channel != null) {
|
||||
|
@ -185,7 +185,7 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
|
|||
.setNeutralButton(R.string.cancel) { _, _ ->
|
||||
setGUIfromModel() // throw away any edits
|
||||
}
|
||||
.setPositiveButton(getString(R.string.accept)) { _, _ ->
|
||||
.setPositiveButton(R.string.apply) { _, _ ->
|
||||
debug("Switching back to default channel")
|
||||
installSettings(Channel.defaultChannel.settings)
|
||||
}
|
||||
|
|
|
@ -101,4 +101,5 @@
|
|||
<string name="reset">Reset</string>
|
||||
<string name="are_you_shure_change_default">Are you sure you want to change to the default channel?</string>
|
||||
<string name="reset_to_defaults">Reset to defaults</string>
|
||||
<string name="apply">Apply</string>
|
||||
</resources>
|
||||
|
|
Ładowanie…
Reference in New Issue