Prevent Chats icon from animating when returning from other activity.

fork-5.53.8
Nicholas 2022-09-22 09:04:58 -04:00 zatwierdzone przez Cody Henthorne
rodzic 0bf5f15cf9
commit cf3dd70600
2 zmienionych plików z 7 dodań i 4 usunięć

Wyświetl plik

@ -33,6 +33,7 @@ class ConversationListTabsFragment : Fragment(R.layout.conversation_list_tabs) {
private lateinit var chatsPill: ImageView
private lateinit var storiesPill: ImageView
private var shouldBeImmediate = true
private var pillAnimator: Animator? = null
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -63,9 +64,10 @@ class ConversationListTabsFragment : Fragment(R.layout.conversation_list_tabs) {
viewModel.onStoriesSelected()
}
update(viewModel.stateSnapshot, true)
viewModel.state.observe(viewLifecycleOwner) { update(it, false) }
viewModel.state.observe(viewLifecycleOwner) {
update(it, shouldBeImmediate)
shouldBeImmediate = false
}
}
private fun update(state: ConversationListTabsState, immediate: Boolean) {

Wyświetl plik

@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.stories.tabs
import androidx.lifecycle.LiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import io.reactivex.rxjava3.core.Observable
@ -15,7 +16,7 @@ class ConversationListTabsViewModel(repository: ConversationListTabRepository) :
private val store = Store(ConversationListTabsState())
val stateSnapshot: ConversationListTabsState = store.state
val state: LiveData<ConversationListTabsState> = store.stateLiveData
val state: LiveData<ConversationListTabsState> = Transformations.distinctUntilChanged(store.stateLiveData)
val disposables = CompositeDisposable()
private val internalTabClickEvents: Subject<ConversationListTab> = PublishSubject.create()