added option to clean message history

pull/85/head
Yura R 2020-07-03 20:55:18 +03:00
rodzic 794434dc57
commit 4c7ef4bdd6
3 zmienionych plików z 14 dodań i 0 usunięć

Wyświetl plik

@ -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)
}
}

Wyświetl plik

@ -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")

Wyświetl plik

@ -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"