mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-27 14:40:22 +00:00
Prevent flicker of user avatar in MyStories when moving between tabs.
This commit is contained in:
committed by
Greyson Parrelli
parent
35a9fddbb2
commit
d4d3124a90
@@ -0,0 +1,12 @@
|
||||
package org.thoughtcrime.securesms.stories.landing
|
||||
|
||||
/**
|
||||
* Global Landing page payloads. Currently the only "pulse" we send out
|
||||
* to ViewHolders is RESUMED.
|
||||
*/
|
||||
enum class LandingPayload {
|
||||
/**
|
||||
* Notifies view holders when the fragment is resumed.
|
||||
*/
|
||||
RESUMED
|
||||
}
|
||||
@@ -33,6 +33,10 @@ object MyStoriesItem {
|
||||
private val badgeView: BadgeImageView = itemView.findViewById(R.id.badge)
|
||||
|
||||
override fun bind(model: Model) {
|
||||
if (payload.contains(LandingPayload.RESUMED)) {
|
||||
return
|
||||
}
|
||||
|
||||
itemView.setOnClickListener { model.onClick() }
|
||||
thumbnail.setOnClickListener { model.onClickThumbnail() }
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ class StoriesLandingFragment : DSLSettingsFragment(layoutId = R.layout.stories_l
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
adapter.notifyItemRangeChanged(0, adapter.itemCount)
|
||||
adapter.notifyItemRangeChanged(0, adapter.itemCount, LandingPayload.RESUMED)
|
||||
}
|
||||
|
||||
override fun bindAdapter(adapter: DSLSettingsAdapter) {
|
||||
@@ -117,8 +117,10 @@ class StoriesLandingFragment : DSLSettingsFragment(layoutId = R.layout.stories_l
|
||||
}
|
||||
|
||||
viewModel.state.observe(viewLifecycleOwner) {
|
||||
adapter.submitList(getConfiguration(it).toMappingModelList())
|
||||
emptyNotice.visible = it.hasNoStories
|
||||
if (it.loadingState == StoriesLandingState.LoadingState.LOADED) {
|
||||
adapter.submitList(getConfiguration(it).toMappingModelList())
|
||||
emptyNotice.visible = it.hasNoStories
|
||||
}
|
||||
}
|
||||
|
||||
requireActivity().onBackPressedDispatcher.addCallback(
|
||||
|
||||
@@ -107,7 +107,7 @@ object StoriesLandingItem {
|
||||
presentDateOrStatus(model)
|
||||
setUpClickListeners(model)
|
||||
|
||||
if (payload.contains(STATUS_CHANGE)) {
|
||||
if (payload.contains(STATUS_CHANGE) || payload.contains(LandingPayload.RESUMED)) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user