mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-26 15:05:44 +03:00
delay progress bar
delay progress bar for one second before showing up for slow connection Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
c04871786e
commit
57cd3af904
1 changed files with 8 additions and 1 deletions
|
@ -183,6 +183,7 @@ import io.reactivex.Observer
|
|||
import io.reactivex.disposables.Disposable
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.collect
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.launch
|
||||
|
@ -416,7 +417,12 @@ class ChatActivity :
|
|||
|
||||
messageInputViewModel = ViewModelProvider(this, viewModelFactory)[MessageInputViewModel::class.java]
|
||||
|
||||
binding.progressBar.visibility = View.VISIBLE
|
||||
this.lifecycleScope.launch {
|
||||
delay(DELAY_TO_SHOW_PROGRESS_BAR)
|
||||
if (adapter?.isEmpty == true) {
|
||||
binding.progressBar.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
||||
|
||||
|
@ -3691,5 +3697,6 @@ class ChatActivity :
|
|||
private const val CURRENT_AUDIO_POSITION_KEY = "CURRENT_AUDIO_POSITION"
|
||||
private const val CURRENT_AUDIO_WAS_PLAYING_KEY = "CURRENT_AUDIO_PLAYING"
|
||||
private const val RESUME_AUDIO_TAG = "RESUME_AUDIO_TAG"
|
||||
private const val DELAY_TO_SHOW_PROGRESS_BAR = 1000L
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue