mirror of
https://github.com/nextcloud/talk-android
synced 2025-08-03 10:05:28 +01: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
b1d6086684
commit
dc38904d01
@ -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)
|
||||
|
||||
@ -3712,5 +3718,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 New Issue
Block a user