mirror of
https://github.com/nextcloud/talk-android
synced 2025-01-18 05:01:28 +00:00
avoid shimmer animations overlay with chat messages
The idea to show the progress bar (aka shimmer animation) was that it show not be shown at all if loading messages happens in less than a second (this was a better UX in my opinion). The idea was to hide the progress bar when ChatMessageStartState was triggered. However there can be moment when adapter is still empty after ChatMessageStartState and if in this moment the DELAY_TO_SHOW_PROGRESS_BAR is reached before the adapter is actually filled, the overlay happens. It could be a solution to move the hiding of the progress bar, however then special cases might have to be handled. For simplicity, the logic for DELAY_TO_SHOW_PROGRESS_BAR is removed. Progress bar is always shown without a delay so it wont be triggered on a later moment and can't overlay the chat. Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
779c1627aa
commit
20612c8543
@ -199,7 +199,6 @@ import io.reactivex.disposables.Disposable
|
|||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
import kotlinx.coroutines.flow.collect
|
import kotlinx.coroutines.flow.collect
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@ -449,12 +448,7 @@ class ChatActivity :
|
|||||||
messageInputViewModel = ViewModelProvider(this, viewModelFactory)[MessageInputViewModel::class.java]
|
messageInputViewModel = ViewModelProvider(this, viewModelFactory)[MessageInputViewModel::class.java]
|
||||||
messageInputViewModel.setData(chatViewModel.getChatRepository())
|
messageInputViewModel.setData(chatViewModel.getChatRepository())
|
||||||
|
|
||||||
this.lifecycleScope.launch {
|
binding.progressBar.visibility = View.VISIBLE
|
||||||
delay(DELAY_TO_SHOW_PROGRESS_BAR)
|
|
||||||
if (adapter?.isEmpty == true && networkMonitor.isOnline.value) {
|
|
||||||
binding.progressBar.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
onBackPressedDispatcher.addCallback(this, onBackPressedCallback)
|
||||||
|
|
||||||
@ -4060,7 +4054,6 @@ class ChatActivity :
|
|||||||
private const val CURRENT_AUDIO_POSITION_KEY = "CURRENT_AUDIO_POSITION"
|
private const val CURRENT_AUDIO_POSITION_KEY = "CURRENT_AUDIO_POSITION"
|
||||||
private const val CURRENT_AUDIO_WAS_PLAYING_KEY = "CURRENT_AUDIO_PLAYING"
|
private const val CURRENT_AUDIO_WAS_PLAYING_KEY = "CURRENT_AUDIO_PLAYING"
|
||||||
private const val RESUME_AUDIO_TAG = "RESUME_AUDIO_TAG"
|
private const val RESUME_AUDIO_TAG = "RESUME_AUDIO_TAG"
|
||||||
private const val DELAY_TO_SHOW_PROGRESS_BAR = 1000L
|
|
||||||
private const val FIVE_MINUTES_IN_SECONDS: Long = 300
|
private const val FIVE_MINUTES_IN_SECONDS: Long = 300
|
||||||
private const val ROOM_TYPE_ONE_TO_ONE = "1"
|
private const val ROOM_TYPE_ONE_TO_ONE = "1"
|
||||||
private const val ACTOR_TYPE = "users"
|
private const val ACTOR_TYPE = "users"
|
||||||
|
Loading…
Reference in New Issue
Block a user