Show progress bar while performing network operations

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2020-01-28 21:03:31 +01:00
parent 3367bd5253
commit 618bcf5790
No known key found for this signature in database
GPG Key ID: CDE0BBD2738C4CC0
2 changed files with 4 additions and 2 deletions

View File

@ -153,6 +153,7 @@ class ContactsView<T : Any>(private val bundle: Bundle? = null) : BaseView() {
operationState.observe(this@ContactsView) { operationState ->
when (operationState.operationState) {
ContactsViewOperationState.OK -> {
searchLayout?.searchProgressBar?.isVisible = true
val bundle = Bundle()
if (!hasToken || isNewGroupConversation) {
bundle.putString(BundleKeys.KEY_CONVERSATION_TOKEN, operationState.conversationToken)
@ -165,10 +166,11 @@ class ContactsView<T : Any>(private val bundle: Bundle? = null) : BaseView() {
}
}
ContactsViewOperationState.PROCESSING -> {
// show progress bar and disable everything
searchLayout?.searchProgressBar?.isVisible = true
}
ContactsViewOperationState.CONVERSATION_CREATION_FAILED -> {
// dunno what to do yet, an error message somewhere
searchLayout?.searchProgressBar?.isVisible = false
}
else -> {
// do nothing, we're waiting

View File

@ -284,7 +284,7 @@ class ConversationsListView : BaseView() {
return items
}
override fun onFloatingActionButtonClick() {
router?.pushController(
RouterTransaction.with(ContactsView<Any>())