-
-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented Google EmojiPicker #3439
base: master
Are you sure you want to change the base?
Changes from 6 commits
ee601bb
33ff8c4
70e3ac3
ed3117b
d6ff39a
ec1108c
c173c70
ac030a2
f79db0b
348de75
895ad52
c4f3d88
2a2870f
1f9ad70
83402ab
b56d3eb
9eaa9bf
561fd03
09968e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,6 @@ import com.nextcloud.talk.models.json.chat.ReadStatus | |
import com.nextcloud.talk.ui.theme.ViewThemeUtils | ||
import com.nextcloud.talk.utils.ApiUtils | ||
import com.nextcloud.talk.utils.DateUtils | ||
import com.nextcloud.talk.utils.TextMatchers | ||
import com.nextcloud.talk.utils.message.MessageUtils | ||
import com.stfalcon.chatkit.messages.MessageHolders.OutcomingTextMessageViewHolder | ||
import javax.inject.Inject | ||
|
@@ -89,8 +88,7 @@ class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewH | |
|
||
val messageParameters = message.messageParameters | ||
if ( | ||
(messageParameters == null || messageParameters.size <= 0) && | ||
TextMatchers.isMessageWithSingleEmoticonOnly(message.text) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here as for incoming text messages |
||
(messageParameters == null || messageParameters.size <= 0) | ||
) { | ||
textSize = (textSize * TEXT_SIZE_MULTIPLIER).toFloat() | ||
layoutParams.isWrapBefore = true | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,6 +94,7 @@ import androidx.core.content.PermissionChecker.PERMISSION_GRANTED | |
import androidx.core.graphics.drawable.toBitmap | ||
import androidx.core.text.bold | ||
import androidx.core.widget.doAfterTextChanged | ||
import androidx.emoji2.emojipicker.EmojiPickerView | ||
import androidx.emoji2.text.EmojiCompat | ||
import androidx.emoji2.widget.EmojiTextView | ||
import androidx.fragment.app.DialogFragment | ||
|
@@ -237,7 +238,6 @@ import com.stfalcon.chatkit.messages.MessageHolders | |
import com.stfalcon.chatkit.messages.MessageHolders.ContentChecker | ||
import com.stfalcon.chatkit.messages.MessagesListAdapter | ||
import com.stfalcon.chatkit.utils.DateFormatter | ||
import com.vanniktech.emoji.EmojiPopup | ||
import io.reactivex.Observer | ||
import io.reactivex.android.schedulers.AndroidSchedulers | ||
import io.reactivex.disposables.Disposable | ||
|
@@ -322,7 +322,6 @@ class ChatActivity : | |
lateinit var roomId: String | ||
var voiceOnly: Boolean = true | ||
var isFirstMessagesProcessing = true | ||
private var emojiPopup: EmojiPopup? = null | ||
private lateinit var path: String | ||
|
||
var myFirstMessage: CharSequence? = null | ||
|
@@ -351,6 +350,7 @@ class ChatActivity : | |
private var voicePreviewObjectAnimator: ObjectAnimator? = null | ||
var mediaPlayer: MediaPlayer? = null | ||
lateinit var mediaPlayerHandler: Handler | ||
private var isEmojiPickerVisible = false | ||
private var currentlyPlayedVoiceMessage: ChatMessage? = null | ||
private lateinit var micInputAudioRecorder: AudioRecord | ||
private var micInputAudioRecordThread: Thread? = null | ||
|
@@ -452,7 +452,6 @@ class ChatActivity : | |
binding.progressBar.visibility = View.VISIBLE | ||
|
||
onBackPressedDispatcher.addCallback(this, onBackPressedCallback) | ||
|
||
initObservers() | ||
} | ||
|
||
|
@@ -644,7 +643,6 @@ class ChatActivity : | |
logConversationInfos("onResume") | ||
|
||
pullChatMessagesPending = false | ||
|
||
setupWebsocket() | ||
webSocketInstance?.getSignalingMessageReceiver()?.addListener(localParticipantMessageListener) | ||
webSocketInstance?.getSignalingMessageReceiver()?.addListener(conversationMessageListener) | ||
|
@@ -1429,30 +1427,18 @@ class ChatActivity : | |
private fun initSmileyKeyboardToggler() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the keyboard toggler is somehow broken with the new solution. It's now possible to show the emoji picker and the keyboard at the same timebelow it, which is a bit confusing. |
||
val smileyButton = binding.messageInputView.findViewById<ImageButton>(R.id.smileyButton) | ||
|
||
emojiPopup = binding.messageInputView.inputEditText?.let { | ||
EmojiPopup( | ||
rootView = binding.root, | ||
editText = it, | ||
onEmojiPopupShownListener = { | ||
if (resources != null) { | ||
smileyButton?.setImageDrawable( | ||
ContextCompat.getDrawable(context, R.drawable.ic_baseline_keyboard_24) | ||
) | ||
} | ||
}, | ||
onEmojiPopupDismissListener = { | ||
smileyButton?.setImageDrawable( | ||
ContextCompat.getDrawable(context, R.drawable.ic_insert_emoticon_black_24dp) | ||
) | ||
}, | ||
onEmojiClickListener = { | ||
binding.messageInputView.inputEditText?.editableText?.append(" ") | ||
} | ||
) | ||
} | ||
|
||
smileyButton?.setOnClickListener { | ||
emojiPopup?.toggle() | ||
|
||
if (!isEmojiPickerVisible) { | ||
binding.messageInputView.findViewById<FrameLayout>(R.id.emoji_picker).visibility = View.VISIBLE | ||
isEmojiPickerVisible = true | ||
} else { | ||
binding.messageInputView.findViewById<EmojiPickerView>(R.id.emoji_picker).visibility = View.GONE | ||
isEmojiPickerVisible = false | ||
} | ||
binding.messageInputView.findViewById<EmojiPickerView>(R.id.emoji_picker).setOnEmojiPickedListener() { | ||
binding.messageInputView.inputEditText.editableText?.append(it.emoji) | ||
} | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to check if the text contains a single emoji. If yes, the text size is increased.
By deleting this check, the text size of messages is always too huge.