mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
applying api changes
This commit is contained in:
parent
271bc91303
commit
2d351aa60f
@ -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.
|
||||
@ -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()
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -706,31 +706,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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user