Created
July 27, 2020 06:25
-
-
Save rmyhal/223645f0dfb19ec153c4bdebc3960f17 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onBindViewHolder( | |
holder: FragmentViewHolder, | |
position: Int, | |
payloads: MutableList<Any> | |
) { | |
if (payloads.isNotEmpty()) { | |
val tag = "f" + holder.itemId | |
val fragment = activity.supportFragmentManager.findFragmentByTag(tag) | |
// safe check, but fragment should not be null here | |
if (fragment != null) { | |
(fragment as PagerFragment).setValue(items[position].value) | |
} else { | |
super.onBindViewHolder(holder, position, payloads) | |
} | |
} else { | |
super.onBindViewHolder(holder, position, payloads) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment