diff --git a/changelog.d/4735.bugfix b/changelog.d/4735.bugfix new file mode 100644 index 0000000000..cf6cca33fd --- /dev/null +++ b/changelog.d/4735.bugfix @@ -0,0 +1 @@ +Polls: unable to create a poll with more than 10 answers \ No newline at end of file diff --git a/vector/src/main/java/im/vector/app/features/poll/create/CreatePollFragment.kt b/vector/src/main/java/im/vector/app/features/poll/create/CreatePollFragment.kt index dc82579f15..3ea44562c5 100644 --- a/vector/src/main/java/im/vector/app/features/poll/create/CreatePollFragment.kt +++ b/vector/src/main/java/im/vector/app/features/poll/create/CreatePollFragment.kt @@ -28,6 +28,7 @@ import im.vector.app.R import im.vector.app.core.extensions.configureWith import im.vector.app.core.platform.VectorBaseFragment import im.vector.app.databinding.FragmentCreatePollBinding +import im.vector.app.features.poll.create.CreatePollViewModel.Companion.MAX_OPTIONS_COUNT import kotlinx.parcelize.Parcelize import javax.inject.Inject @@ -51,6 +52,7 @@ class CreatePollFragment @Inject constructor( vectorBaseActivity.setSupportActionBar(views.createPollToolbar) views.createPollRecyclerView.configureWith(controller, disableItemAnimation = true) + views.createPollRecyclerView.setItemViewCacheSize(MAX_OPTIONS_COUNT + 4) controller.callback = this views.createPollClose.debouncedClicks { diff --git a/vector/src/main/java/im/vector/app/features/poll/create/CreatePollViewModel.kt b/vector/src/main/java/im/vector/app/features/poll/create/CreatePollViewModel.kt index 81581b2179..b5e66ae682 100644 --- a/vector/src/main/java/im/vector/app/features/poll/create/CreatePollViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/poll/create/CreatePollViewModel.kt @@ -40,7 +40,7 @@ class CreatePollViewModel @AssistedInject constructor( companion object : MavericksViewModelFactory by hiltMavericksViewModelFactory() { const val MIN_OPTIONS_COUNT = 2 - private const val MAX_OPTIONS_COUNT = 20 + const val MAX_OPTIONS_COUNT = 20 } init {