mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
Add emoji keyboard, remove profile picture from composer.
This commit is contained in:
parent
a96cc19eb6
commit
e8862b3aaa
3 changed files with 25 additions and 7 deletions
|
@ -69,6 +69,7 @@ import com.airbnb.mvrx.withState
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import com.google.android.material.textfield.TextInputEditText
|
import com.google.android.material.textfield.TextInputEditText
|
||||||
import com.jakewharton.rxbinding3.widget.textChanges
|
import com.jakewharton.rxbinding3.widget.textChanges
|
||||||
|
import com.vanniktech.emoji.EmojiPopup
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.dialogs.ConfirmationDialogBuilder
|
import im.vector.app.core.dialogs.ConfirmationDialogBuilder
|
||||||
import im.vector.app.core.dialogs.GalleryOrCameraDialogHelper
|
import im.vector.app.core.dialogs.GalleryOrCameraDialogHelper
|
||||||
|
@ -296,6 +297,8 @@ class RoomDetailFragment @Inject constructor(
|
||||||
private var lockSendButton = false
|
private var lockSendButton = false
|
||||||
private val activeCallViewHolder = ActiveCallViewHolder()
|
private val activeCallViewHolder = ActiveCallViewHolder()
|
||||||
|
|
||||||
|
private lateinit var emojiPopup: EmojiPopup
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
sharedActionViewModel = activityViewModelProvider.get(MessageSharedActionViewModel::class.java)
|
sharedActionViewModel = activityViewModelProvider.get(MessageSharedActionViewModel::class.java)
|
||||||
|
@ -311,6 +314,7 @@ class RoomDetailFragment @Inject constructor(
|
||||||
setupActiveCallView()
|
setupActiveCallView()
|
||||||
setupJumpToBottomView()
|
setupJumpToBottomView()
|
||||||
setupConfBannerView()
|
setupConfBannerView()
|
||||||
|
setupEmojiPopup()
|
||||||
|
|
||||||
roomToolbarContentView.debouncedClicks {
|
roomToolbarContentView.debouncedClicks {
|
||||||
navigator.openRoomProfile(requireActivity(), roomDetailArgs.roomId)
|
navigator.openRoomProfile(requireActivity(), roomDetailArgs.roomId)
|
||||||
|
@ -478,6 +482,23 @@ class RoomDetailFragment @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setupEmojiPopup() {
|
||||||
|
EmojiPopup
|
||||||
|
.Builder
|
||||||
|
.fromRootView(rootConstraintLayout)
|
||||||
|
.setKeyboardAnimationStyle(R.style.emoji_fade_animation_style)
|
||||||
|
.setOnEmojiPopupShownListener { composerLayout.composerEmojiButton.setImageResource(R.drawable.ic_keyboard) }
|
||||||
|
.setOnEmojiPopupDismissListener { composerLayout.composerEmojiButton.setImageResource(R.drawable.ic_insert_emoji) }
|
||||||
|
.build(composerLayout.composerEditText)
|
||||||
|
.also {
|
||||||
|
emojiPopup = it
|
||||||
|
}
|
||||||
|
|
||||||
|
composerLayout.composerEmojiButton.debouncedClicks {
|
||||||
|
emojiPopup.toggle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun joinJitsiRoom(jitsiWidget: Widget, enableVideo: Boolean) {
|
private fun joinJitsiRoom(jitsiWidget: Widget, enableVideo: Boolean) {
|
||||||
navigator.openRoomWidget(requireContext(), roomDetailArgs.roomId, jitsiWidget, mapOf(JitsiCallViewModel.ENABLE_VIDEO_OPTION to enableVideo))
|
navigator.openRoomWidget(requireContext(), roomDetailArgs.roomId, jitsiWidget, mapOf(JitsiCallViewModel.ENABLE_VIDEO_OPTION to enableVideo))
|
||||||
}
|
}
|
||||||
|
@ -1211,9 +1232,6 @@ class RoomDetailFragment @Inject constructor(
|
||||||
scrollOnHighlightedEventCallback.timeline = roomDetailViewModel.timeline
|
scrollOnHighlightedEventCallback.timeline = roomDetailViewModel.timeline
|
||||||
timelineEventController.update(state)
|
timelineEventController.update(state)
|
||||||
inviteView.visibility = View.GONE
|
inviteView.visibility = View.GONE
|
||||||
val uid = session.myUserId
|
|
||||||
val meMember = state.myRoomMember()
|
|
||||||
avatarRenderer.render(MatrixItem.UserItem(uid, meMember?.displayName, meMember?.avatarUrl), composerLayout.composerAvatarImageView)
|
|
||||||
if (state.tombstoneEvent == null) {
|
if (state.tombstoneEvent == null) {
|
||||||
if (state.canSendMessage) {
|
if (state.canSendMessage) {
|
||||||
composerLayout.visibility = View.VISIBLE
|
composerLayout.visibility = View.VISIBLE
|
||||||
|
|
|
@ -24,16 +24,16 @@ import android.text.Editable
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.view.inputmethod.InputConnection
|
import android.view.inputmethod.InputConnection
|
||||||
import androidx.appcompat.widget.AppCompatEditText
|
|
||||||
import androidx.core.view.inputmethod.EditorInfoCompat
|
import androidx.core.view.inputmethod.EditorInfoCompat
|
||||||
import androidx.core.view.inputmethod.InputConnectionCompat
|
import androidx.core.view.inputmethod.InputConnectionCompat
|
||||||
|
import com.vanniktech.emoji.EmojiEditText
|
||||||
import im.vector.app.core.extensions.ooi
|
import im.vector.app.core.extensions.ooi
|
||||||
import im.vector.app.core.platform.SimpleTextWatcher
|
import im.vector.app.core.platform.SimpleTextWatcher
|
||||||
import im.vector.app.features.html.PillImageSpan
|
import im.vector.app.features.html.PillImageSpan
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
class ComposerEditText @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = android.R.attr.editTextStyle)
|
class ComposerEditText @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = android.R.attr.editTextStyle)
|
||||||
: AppCompatEditText(context, attrs, defStyleAttr) {
|
: EmojiEditText(context, attrs, defStyleAttr) {
|
||||||
|
|
||||||
interface Callback {
|
interface Callback {
|
||||||
fun onRichContentSelected(contentUri: Uri): Boolean
|
fun onRichContentSelected(contentUri: Uri): Boolean
|
||||||
|
|
|
@ -72,8 +72,8 @@ class TextComposerView @JvmOverloads constructor(context: Context, attrs: Attrib
|
||||||
@BindView(R.id.composerEditText)
|
@BindView(R.id.composerEditText)
|
||||||
lateinit var composerEditText: ComposerEditText
|
lateinit var composerEditText: ComposerEditText
|
||||||
|
|
||||||
@BindView(R.id.composer_avatar_view)
|
@BindView(R.id.composer_emoji)
|
||||||
lateinit var composerAvatarImageView: ImageView
|
lateinit var composerEmojiButton: ImageButton
|
||||||
|
|
||||||
@BindView(R.id.composer_shield)
|
@BindView(R.id.composer_shield)
|
||||||
lateinit var composerShieldImageView: ImageView
|
lateinit var composerShieldImageView: ImageView
|
||||||
|
|
Loading…
Reference in a new issue