Skip to content

Commit

Permalink
Merge pull request #6068 from vector-im/dependabot/gradle/vanniktechE…
Browse files Browse the repository at this point in the history
…moji-0.12.0

Bump vanniktechEmoji from 0.9.0 to 0.12.0
  • Loading branch information
ouchadam authored May 24, 2022
2 parents a59b8bf + 2d351aa commit b4b2b97
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def mavericks = "2.6.1"
def glide = "4.13.2"
def bigImageViewer = "1.8.1"
def jjwt = "0.11.5"
def vanniktechEmoji = "0.9.0"
def vanniktechEmoji = "0.12.0"

// Testing
def mockk = "1.12.4"
Expand Down
4 changes: 2 additions & 2 deletions vector/src/main/java/im/vector/app/core/utils/Emoji.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package im.vector.app.core.utils

import com.vanniktech.emoji.EmojiUtils
import com.vanniktech.emoji.isOnlyEmojis

/**
* Test if a string contains emojis.
Expand All @@ -28,7 +28,7 @@ import com.vanniktech.emoji.EmojiUtils
*/
fun containsOnlyEmojis(str: String?): Boolean {
// Now rely on vanniktech library
return EmojiUtils.isOnlyEmojis(str)
return str.isOnlyEmojis()
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,31 +714,31 @@ class TimelineFragment @Inject constructor(
}

private fun createEmojiPopup(): EmojiPopup {
return EmojiPopup
.Builder
.fromRootView(views.rootConstraintLayout)
.setKeyboardAnimationStyle(R.style.emoji_fade_animation_style)
.setOnEmojiPopupShownListener {
return EmojiPopup(
rootView = views.rootConstraintLayout,
keyboardAnimationStyle = R.style.emoji_fade_animation_style,
onEmojiPopupShownListener = {
views.composerLayout.views.composerEmojiButton.apply {
contentDescription = getString(R.string.a11y_close_emoji_picker)
setImageResource(R.drawable.ic_keyboard)
}
}
.setOnEmojiPopupDismissListenerLifecycleAware {
},
onEmojiPopupDismissListener = lifecycleAwareDismissAction {
views.composerLayout.views.composerEmojiButton.apply {
contentDescription = getString(R.string.a11y_open_emoji_picker)
setImageResource(R.drawable.ic_insert_emoji)
}
}
.build(views.composerLayout.views.composerEditText)
},
editText = views.composerLayout.views.composerEditText
)
}

/**
* Ensure dismiss actions only trigger when the fragment is in the started state.
* EmojiPopup by default dismisses onViewDetachedFromWindow, this can cause race conditions with onDestroyView.
*/
private fun EmojiPopup.Builder.setOnEmojiPopupDismissListenerLifecycleAware(action: () -> Unit): EmojiPopup.Builder {
return setOnEmojiPopupDismissListener {
private fun lifecycleAwareDismissAction(action: () -> Unit): () -> Unit {
return {
if (lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED)) {
action()
}
Expand Down

0 comments on commit b4b2b97

Please sign in to comment.