mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
Merge pull request #1942 from nextcloud/bugfix/1914/fixEmojiPickerHeight
add workaround to avoid emoji picker to take the full screen height
This commit is contained in:
commit
942a2c0bd9
@ -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()
|
||||||
|
},
|
||||||
|
DELAY
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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
|
||||||
@ -328,5 +350,6 @@ class MessageActionsDialog(
|
|||||||
private const val ACTOR_LENGTH = 6
|
private const val ACTOR_LENGTH = 6
|
||||||
private const val NO_PREVIOUS_MESSAGE_ID: Int = -1
|
private const val NO_PREVIOUS_MESSAGE_ID: Int = -1
|
||||||
private const val HTTP_CREATED: Int = 201
|
private const val HTTP_CREATED: Int = 201
|
||||||
|
private const val DELAY: Long = 200
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user