Merge branch 'feature/ons/poll' into feature/ons/poll_timeline
* feature/ons/poll: Hide poll icon from attachment type selector for now. Code review fixes. Lint fixes. Design review fixes.
This commit is contained in:
commit
94ae3c6dc0
|
@ -20,7 +20,6 @@ import org.matrix.android.sdk.api.session.content.ContentAttachmentData
|
|||
import org.matrix.android.sdk.api.session.events.model.Content
|
||||
import org.matrix.android.sdk.api.session.events.model.Event
|
||||
import org.matrix.android.sdk.api.session.room.model.message.MessageType
|
||||
import org.matrix.android.sdk.api.session.room.model.message.OptionItem
|
||||
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
||||
import org.matrix.android.sdk.api.util.Cancelable
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.matrix.android.sdk.api.session.room.model.message.MessageFileContent
|
|||
import org.matrix.android.sdk.api.session.room.model.message.MessageImageContent
|
||||
import org.matrix.android.sdk.api.session.room.model.message.MessageVideoContent
|
||||
import org.matrix.android.sdk.api.session.room.model.message.MessageWithAttachmentContent
|
||||
import org.matrix.android.sdk.api.session.room.model.message.OptionItem
|
||||
import org.matrix.android.sdk.api.session.room.model.message.getFileUrl
|
||||
import org.matrix.android.sdk.api.session.room.send.SendService
|
||||
import org.matrix.android.sdk.api.session.room.send.SendState
|
||||
|
|
|
@ -38,14 +38,11 @@ import org.matrix.android.sdk.api.session.room.model.message.MessageContentWithF
|
|||
import org.matrix.android.sdk.api.session.room.model.message.MessageFileContent
|
||||
import org.matrix.android.sdk.api.session.room.model.message.MessageFormat
|
||||
import org.matrix.android.sdk.api.session.room.model.message.MessageImageContent
|
||||
import org.matrix.android.sdk.api.session.room.model.message.MessageOptionsContent
|
||||
import org.matrix.android.sdk.api.session.room.model.message.MessagePollContent
|
||||
import org.matrix.android.sdk.api.session.room.model.message.MessagePollResponseContent
|
||||
import org.matrix.android.sdk.api.session.room.model.message.MessageTextContent
|
||||
import org.matrix.android.sdk.api.session.room.model.message.MessageType
|
||||
import org.matrix.android.sdk.api.session.room.model.message.MessageVideoContent
|
||||
import org.matrix.android.sdk.api.session.room.model.message.OPTION_TYPE_POLL
|
||||
import org.matrix.android.sdk.api.session.room.model.message.OptionItem
|
||||
import org.matrix.android.sdk.api.session.room.model.message.PollAnswer
|
||||
import org.matrix.android.sdk.api.session.room.model.message.PollCreationInfo
|
||||
import org.matrix.android.sdk.api.session.room.model.message.PollQuestion
|
||||
|
|
|
@ -26,7 +26,6 @@ import dagger.hilt.android.components.ActivityComponent
|
|||
import dagger.multibindings.IntoMap
|
||||
import im.vector.app.features.attachments.preview.AttachmentsPreviewFragment
|
||||
import im.vector.app.features.contactsbook.ContactsBookFragment
|
||||
import im.vector.app.features.poll.create.CreatePollFragment
|
||||
import im.vector.app.features.crypto.keysbackup.settings.KeysBackupSettingsFragment
|
||||
import im.vector.app.features.crypto.quads.SharedSecuredStorageKeyFragment
|
||||
import im.vector.app.features.crypto.quads.SharedSecuredStoragePassphraseFragment
|
||||
|
@ -95,6 +94,7 @@ import im.vector.app.features.login2.terms.LoginTermsFragment2
|
|||
import im.vector.app.features.matrixto.MatrixToRoomSpaceFragment
|
||||
import im.vector.app.features.matrixto.MatrixToUserFragment
|
||||
import im.vector.app.features.pin.PinFragment
|
||||
import im.vector.app.features.poll.create.CreatePollFragment
|
||||
import im.vector.app.features.qrcode.QrCodeScannerFragment
|
||||
import im.vector.app.features.reactions.EmojiChooserFragment
|
||||
import im.vector.app.features.reactions.EmojiSearchResultFragment
|
||||
|
|
|
@ -26,7 +26,6 @@ import im.vector.app.features.call.conference.JitsiCallViewModel
|
|||
import im.vector.app.features.call.transfer.CallTransferViewModel
|
||||
import im.vector.app.features.contactsbook.ContactsBookViewModel
|
||||
import im.vector.app.features.createdirect.CreateDirectRoomViewModel
|
||||
import im.vector.app.features.poll.create.CreatePollViewModel
|
||||
import im.vector.app.features.crypto.keysbackup.settings.KeysBackupSettingsViewModel
|
||||
import im.vector.app.features.crypto.quads.SharedSecureStorageViewModel
|
||||
import im.vector.app.features.crypto.recover.BootstrapSharedViewModel
|
||||
|
@ -55,6 +54,7 @@ import im.vector.app.features.login.LoginViewModel
|
|||
import im.vector.app.features.login2.LoginViewModel2
|
||||
import im.vector.app.features.login2.created.AccountCreatedViewModel
|
||||
import im.vector.app.features.matrixto.MatrixToBottomSheetViewModel
|
||||
import im.vector.app.features.poll.create.CreatePollViewModel
|
||||
import im.vector.app.features.rageshake.BugReportViewModel
|
||||
import im.vector.app.features.reactions.EmojiSearchResultViewModel
|
||||
import im.vector.app.features.room.RequireActiveMembershipViewModel
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package im.vector.app.features.form
|
||||
|
||||
import android.text.Editable
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.widget.ImageButton
|
||||
import com.airbnb.epoxy.EpoxyAttribute
|
||||
import com.airbnb.epoxy.EpoxyModelClass
|
||||
|
@ -70,12 +71,13 @@ abstract class FormEditTextWithDeleteItem : VectorEpoxyModel<FormEditTextWithDel
|
|||
holder.textInputEditText.setTextIfDifferent(value)
|
||||
|
||||
holder.textInputEditText.isEnabled = enabled
|
||||
if (singleLine) {
|
||||
holder.textInputEditText.setSingleLine()
|
||||
}
|
||||
imeOptions?.let {
|
||||
holder.textInputEditText.imeOptions = it
|
||||
}
|
||||
holder.textInputEditText.isSingleLine = singleLine
|
||||
|
||||
holder.textInputEditText.imeOptions =
|
||||
imeOptions ?: when (singleLine) {
|
||||
true -> EditorInfo.IME_ACTION_NEXT
|
||||
false -> EditorInfo.IME_ACTION_NONE
|
||||
}
|
||||
|
||||
holder.textInputEditText.addTextChangedListenerOnce(onTextChangeListener)
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ import org.matrix.android.sdk.api.session.room.model.PowerLevelsContent
|
|||
import org.matrix.android.sdk.api.session.room.model.RoomAvatarContent
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomMemberContent
|
||||
import org.matrix.android.sdk.api.session.room.model.message.MessageType
|
||||
import org.matrix.android.sdk.api.session.room.model.message.OptionItem
|
||||
import org.matrix.android.sdk.api.session.room.powerlevels.PowerLevelsHelper
|
||||
import org.matrix.android.sdk.api.session.room.send.UserDraft
|
||||
import org.matrix.android.sdk.api.session.room.timeline.getLastMessageContent
|
||||
|
|
|
@ -40,9 +40,6 @@ import im.vector.app.features.call.conference.JitsiCallViewModel
|
|||
import im.vector.app.features.call.conference.VectorJitsiActivity
|
||||
import im.vector.app.features.call.transfer.CallTransferActivity
|
||||
import im.vector.app.features.createdirect.CreateDirectRoomActivity
|
||||
import im.vector.app.features.poll.create.CreatePollActivity
|
||||
import im.vector.app.features.poll.create.CreatePollArgs
|
||||
import im.vector.app.features.poll.create.CreatePollViewModel
|
||||
import im.vector.app.features.crypto.keysbackup.settings.KeysBackupManageActivity
|
||||
import im.vector.app.features.crypto.keysbackup.setup.KeysBackupSetupActivity
|
||||
import im.vector.app.features.crypto.recover.BootstrapBottomSheet
|
||||
|
@ -67,6 +64,8 @@ import im.vector.app.features.media.VectorAttachmentViewerActivity
|
|||
import im.vector.app.features.pin.PinActivity
|
||||
import im.vector.app.features.pin.PinArgs
|
||||
import im.vector.app.features.pin.PinMode
|
||||
import im.vector.app.features.poll.create.CreatePollActivity
|
||||
import im.vector.app.features.poll.create.CreatePollArgs
|
||||
import im.vector.app.features.roomdirectory.RoomDirectoryActivity
|
||||
import im.vector.app.features.roomdirectory.RoomDirectoryData
|
||||
import im.vector.app.features.roomdirectory.createroom.CreateRoomActivity
|
||||
|
|
|
@ -20,10 +20,10 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.addFragment
|
||||
import im.vector.app.core.platform.SimpleFragmentActivity
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
||||
@AndroidEntryPoint
|
||||
class CreatePollActivity : SimpleFragmentActivity() {
|
||||
|
|
|
@ -52,11 +52,14 @@ class CreatePollController @Inject constructor(
|
|||
title(host.stringProvider.getString(R.string.create_poll_question_title))
|
||||
}
|
||||
|
||||
val questionImeAction = if (currentState.options.isEmpty()) EditorInfo.IME_ACTION_DONE else EditorInfo.IME_ACTION_NEXT
|
||||
|
||||
formEditTextItem {
|
||||
id("question")
|
||||
value(currentState.question)
|
||||
hint(host.stringProvider.getString(R.string.create_poll_question_hint))
|
||||
singleLine(false)
|
||||
singleLine(true)
|
||||
imeOptions(questionImeAction)
|
||||
maxLength(500)
|
||||
onTextChange {
|
||||
host.callback?.onQuestionChanged(it)
|
||||
|
@ -70,7 +73,7 @@ class CreatePollController @Inject constructor(
|
|||
}
|
||||
|
||||
currentState.options.forEachIndexed { index, option ->
|
||||
val imeOptions = if (index == currentState.options.size -1) EditorInfo.IME_ACTION_DONE else EditorInfo.IME_ACTION_NEXT
|
||||
val imeOptions = if (index == currentState.options.size - 1) EditorInfo.IME_ACTION_DONE else EditorInfo.IME_ACTION_NEXT
|
||||
formEditTextWithDeleteItem {
|
||||
id("option_$index")
|
||||
value(option)
|
||||
|
|
|
@ -50,7 +50,7 @@ class CreatePollFragment @Inject constructor(
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
vectorBaseActivity.setSupportActionBar(views.createPollToolbar)
|
||||
|
||||
views.createPollRecyclerView.configureWith(controller)
|
||||
views.createPollRecyclerView.configureWith(controller, disableItemAnimation = true)
|
||||
controller.callback = this
|
||||
|
||||
views.createPollClose.debouncedClicks {
|
||||
|
@ -92,6 +92,12 @@ class CreatePollFragment @Inject constructor(
|
|||
|
||||
override fun onAddOption() {
|
||||
viewModel.handle(CreatePollAction.OnAddOption)
|
||||
// Scroll to bottom to show "Add Option" button
|
||||
views.createPollRecyclerView.apply {
|
||||
postDelayed({
|
||||
smoothScrollToPosition(adapter?.itemCount?.minus(1) ?: 0)
|
||||
}, 100)
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleSuccess() {
|
||||
|
|
|
@ -30,4 +30,3 @@ data class CreatePollViewState(
|
|||
roomId = args.roomId
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@
|
|||
android:layout_margin="16dp"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible"
|
||||
android:visibility="gone"
|
||||
android:weightSum="3">
|
||||
|
||||
<LinearLayout
|
||||
|
|
Loading…
Reference in New Issue