kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
added option to clean message history
rodzic
794434dc57
commit
4c7ef4bdd6
|
@ -846,6 +846,10 @@ class MainActivity : AppCompatActivity(), Logging,
|
|||
Toast.makeText(this, item.title, Toast.LENGTH_SHORT).show()
|
||||
return true
|
||||
}
|
||||
R.id.clear_history -> {
|
||||
model.messagesState.cleanMessages()
|
||||
return true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,12 @@ class MessagesState(private val ui: UIViewModel) : Logging {
|
|||
messages.value!! + m
|
||||
}
|
||||
|
||||
/// clean messages from our UI
|
||||
fun cleanMessages() {
|
||||
debug("cleaning messages")
|
||||
messages.value = emptyList()
|
||||
}
|
||||
|
||||
fun updateStatus(id: Int, status: MessageStatus) {
|
||||
// Super inefficent but this is rare
|
||||
debug("Handling message status change $id: $status")
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
android:tint="#FFFFFF"
|
||||
android:title="@string/disconnected"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/clear_history"
|
||||
android:title="Clear History"
|
||||
app:showAsAction="withText" />
|
||||
<item
|
||||
android:id="@+id/about"
|
||||
android:title="@string/about"
|
||||
|
|
Ładowanie…
Reference in New Issue