mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-11 23:04:17 +01:00
add workaround to avoid emoji picker to take the full screen height
The toggleEmojiPopup method is a hacky workaround to avoid bug #1914 As the bug happens only for the very first time when the popup is opened, it is closed after some milliseconds and opened again. 200 milliseconds seems to be a good value to initialize the popup correctly with the desired size downside: there is even some flickering when opening the "more emojis" window Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
f7dcf58d3c
commit
2495c25f22
@ -23,6 +23,8 @@ package com.nextcloud.talk.ui.dialog
|
|||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@ -91,11 +93,18 @@ class MessageActionsDialog(
|
|||||||
initEmojiMore()
|
initEmojiMore()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
|
||||||
|
val behavior = BottomSheetBehavior.from(bottomSheet as View)
|
||||||
|
behavior.state = BottomSheetBehavior.STATE_EXPANDED
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
private fun initEmojiMore() {
|
private fun initEmojiMore() {
|
||||||
dialogMessageActionsBinding.emojiMore.setOnTouchListener { v, event ->
|
dialogMessageActionsBinding.emojiMore.setOnTouchListener { v, event ->
|
||||||
if (event.action == MotionEvent.ACTION_DOWN) {
|
if (event.action == MotionEvent.ACTION_DOWN) {
|
||||||
popup.toggle()
|
toggleEmojiPopup()
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
@ -123,6 +132,26 @@ class MessageActionsDialog(
|
|||||||
dialogMessageActionsBinding.emojiMore.forceSingleEmoji()
|
dialogMessageActionsBinding.emojiMore.forceSingleEmoji()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
This method is a hacky workaround to avoid bug #1914
|
||||||
|
As the bug happens only for the very first time when the popup is opened,
|
||||||
|
it is closed after some milliseconds and opened again.
|
||||||
|
*/
|
||||||
|
private fun toggleEmojiPopup() {
|
||||||
|
if (popup.isShowing) {
|
||||||
|
popup.dismiss()
|
||||||
|
} else {
|
||||||
|
popup.show()
|
||||||
|
Handler(Looper.getMainLooper()).postDelayed(
|
||||||
|
{
|
||||||
|
popup.dismiss()
|
||||||
|
popup.show()
|
||||||
|
},
|
||||||
|
200
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun initEmojiBar() {
|
private fun initEmojiBar() {
|
||||||
if (CapabilitiesUtil.hasSpreedFeatureCapability(user, "reactions")) {
|
if (CapabilitiesUtil.hasSpreedFeatureCapability(user, "reactions")) {
|
||||||
checkAndSetEmojiSelfReaction(dialogMessageActionsBinding.emojiThumbsUp)
|
checkAndSetEmojiSelfReaction(dialogMessageActionsBinding.emojiThumbsUp)
|
||||||
@ -231,13 +260,6 @@ class MessageActionsDialog(
|
|||||||
dialogMessageActionsBinding.menuCopyMessage.visibility = getVisibility(visible)
|
dialogMessageActionsBinding.menuCopyMessage.visibility = getVisibility(visible)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStart() {
|
|
||||||
super.onStart()
|
|
||||||
val bottomSheet = findViewById<View>(R.id.design_bottom_sheet)
|
|
||||||
val behavior = BottomSheetBehavior.from(bottomSheet as View)
|
|
||||||
behavior.state = BottomSheetBehavior.STATE_EXPANDED
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getVisibility(visible: Boolean): Int {
|
private fun getVisibility(visible: Boolean): Int {
|
||||||
return if (visible) {
|
return if (visible) {
|
||||||
View.VISIBLE
|
View.VISIBLE
|
||||||
|
Loading…
Reference in New Issue
Block a user