Merge pull request #4893 from vector-im/feature/ons/fix_create_poll_recyclerview

Workaround to not to reuse poll option cells
This commit is contained in:
Benoit Marty 2022-01-11 10:00:16 +01:00 committed by GitHub
commit 008034895b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

1
changelog.d/4735.bugfix Normal file
View file

@ -0,0 +1 @@
Polls: unable to create a poll with more than 10 answers

View file

@ -28,6 +28,7 @@ import im.vector.app.R
import im.vector.app.core.extensions.configureWith import im.vector.app.core.extensions.configureWith
import im.vector.app.core.platform.VectorBaseFragment import im.vector.app.core.platform.VectorBaseFragment
import im.vector.app.databinding.FragmentCreatePollBinding import im.vector.app.databinding.FragmentCreatePollBinding
import im.vector.app.features.poll.create.CreatePollViewModel.Companion.MAX_OPTIONS_COUNT
import kotlinx.parcelize.Parcelize import kotlinx.parcelize.Parcelize
import javax.inject.Inject import javax.inject.Inject
@ -51,6 +52,7 @@ class CreatePollFragment @Inject constructor(
vectorBaseActivity.setSupportActionBar(views.createPollToolbar) vectorBaseActivity.setSupportActionBar(views.createPollToolbar)
views.createPollRecyclerView.configureWith(controller, disableItemAnimation = true) views.createPollRecyclerView.configureWith(controller, disableItemAnimation = true)
views.createPollRecyclerView.setItemViewCacheSize(MAX_OPTIONS_COUNT + 4)
controller.callback = this controller.callback = this
views.createPollClose.debouncedClicks { views.createPollClose.debouncedClicks {

View file

@ -40,7 +40,7 @@ class CreatePollViewModel @AssistedInject constructor(
companion object : MavericksViewModelFactory<CreatePollViewModel, CreatePollViewState> by hiltMavericksViewModelFactory() { companion object : MavericksViewModelFactory<CreatePollViewModel, CreatePollViewState> by hiltMavericksViewModelFactory() {
const val MIN_OPTIONS_COUNT = 2 const val MIN_OPTIONS_COUNT = 2
private const val MAX_OPTIONS_COUNT = 20 const val MAX_OPTIONS_COUNT = 20
} }
init { init {