mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 14:27:24 +00:00
show emoji picker to send reaction (buggy)
emoji picker SOMETIMES opens in full height. this is a bug inside the emoji picker lib, see https://github.com/vanniktech/Emoji/issues/474 Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
f4ab037a44
commit
4670854848
@ -20,10 +20,14 @@
|
||||
|
||||
package com.nextcloud.talk.ui.dialog
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import androidx.annotation.NonNull
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
@ -38,6 +42,7 @@ import com.nextcloud.talk.models.json.chat.ChatMessage
|
||||
import com.nextcloud.talk.models.json.conversations.Conversation
|
||||
import com.nextcloud.talk.models.json.generic.GenericOverall
|
||||
import com.nextcloud.talk.utils.ApiUtils
|
||||
import com.vanniktech.emoji.EmojiPopup
|
||||
import io.reactivex.Observer
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
@ -50,10 +55,13 @@ class MessageActionsDialog(
|
||||
private val currentConversation: Conversation?,
|
||||
private val showMessageDeletionButton: Boolean,
|
||||
private val ncApi: NcApi
|
||||
) : BottomSheetDialog(chatController.activity!!) {
|
||||
) : BottomSheetDialog(chatController.activity!!, R.style.BottomSheetDialogThemeNoFloating) {
|
||||
|
||||
private lateinit var dialogMessageActionsBinding: DialogMessageActionsBinding
|
||||
|
||||
private lateinit var popup: EmojiPopup
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
dialogMessageActionsBinding = DialogMessageActionsBinding.inflate(layoutInflater)
|
||||
@ -78,6 +86,39 @@ class MessageActionsDialog(
|
||||
ChatMessage.MessageType.SYSTEM_MESSAGE != message.getMessageType() &&
|
||||
BuildConfig.DEBUG
|
||||
)
|
||||
|
||||
dialogMessageActionsBinding.emojiMore.setOnTouchListener { v, event ->
|
||||
if (event.action == MotionEvent.ACTION_DOWN) {
|
||||
if (popup.isShowing) {
|
||||
popup.dismiss()
|
||||
} else {
|
||||
popup.show()
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
popup = EmojiPopup.Builder
|
||||
.fromRootView(dialogMessageActionsBinding.root)
|
||||
.setOnEmojiPopupShownListener {
|
||||
dialogMessageActionsBinding.emojiMore.clearFocus()
|
||||
dialogMessageActionsBinding.messageActions.visibility = View.GONE
|
||||
}
|
||||
.setOnEmojiClickListener { _, imageView ->
|
||||
popup.dismiss()
|
||||
sendReaction(message, imageView.unicode)
|
||||
}
|
||||
.setOnEmojiPopupDismissListener {
|
||||
dialogMessageActionsBinding.emojiMore.clearFocus()
|
||||
dialogMessageActionsBinding.messageActions.visibility = View.VISIBLE
|
||||
|
||||
val imm: InputMethodManager = context?.getSystemService(Context.INPUT_METHOD_SERVICE) as
|
||||
InputMethodManager
|
||||
imm.hideSoftInputFromWindow(dialogMessageActionsBinding.emojiMore.windowToken, 0)
|
||||
}
|
||||
.build(dialogMessageActionsBinding.emojiMore)
|
||||
dialogMessageActionsBinding.emojiMore.disableKeyboardInput(popup)
|
||||
dialogMessageActionsBinding.emojiMore.forceSingleEmoji()
|
||||
}
|
||||
|
||||
private fun initEmojiBar() {
|
||||
|
@ -95,203 +95,209 @@
|
||||
android:text="@string/emoji_sad"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
<com.vanniktech.emoji.EmojiEditText
|
||||
android:id="@+id/emojiMore"
|
||||
style="@style/Widget.AppTheme.Button.IconButton"
|
||||
android:layout_width="@dimen/activity_row_layout_height"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/activity_row_layout_height"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/emoji_more"
|
||||
app:elevation="0dp"
|
||||
app:icon="@drawable/ic_dots_horizontal"
|
||||
app:iconGravity="textStart"
|
||||
app:iconSize="24dp"
|
||||
app:iconTint="@color/high_emphasis_text" />
|
||||
android:background="@android:color/transparent"
|
||||
android:drawableStart="@drawable/ic_dots_horizontal"
|
||||
android:layout_marginStart="10dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/menu_copy_message"
|
||||
android:id="@+id/message_actions"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_item_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/menu_icon_copy_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_content_copy"
|
||||
app:tint="@color/high_emphasis_menu_icon" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/menu_text_copy_message"
|
||||
<LinearLayout
|
||||
android:id="@+id/menu_copy_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="@dimen/standard_double_padding"
|
||||
android:paddingEnd="@dimen/zero"
|
||||
android:text="@string/nc_copy_message"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/high_emphasis_text"
|
||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||
android:layout_height="@dimen/bottom_sheet_item_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/menu_icon_copy_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_content_copy"
|
||||
app:tint="@color/high_emphasis_menu_icon" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/menu_mark_as_unread"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_item_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/menu_text_copy_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="@dimen/standard_double_padding"
|
||||
android:paddingEnd="@dimen/zero"
|
||||
android:text="@string/nc_copy_message"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/high_emphasis_text"
|
||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/menu_icon_mark_as_unread"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_eye_off"
|
||||
app:tint="@color/high_emphasis_menu_icon" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/menu_text_mark_as_unread"
|
||||
<LinearLayout
|
||||
android:id="@+id/menu_mark_as_unread"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="@dimen/standard_double_padding"
|
||||
android:paddingEnd="@dimen/zero"
|
||||
android:text="@string/nc_mark_as_unread"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/high_emphasis_text"
|
||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||
android:layout_height="@dimen/bottom_sheet_item_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/menu_icon_mark_as_unread"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_eye_off"
|
||||
app:tint="@color/high_emphasis_menu_icon" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/menu_forward_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_item_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/menu_text_mark_as_unread"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="@dimen/standard_double_padding"
|
||||
android:paddingEnd="@dimen/zero"
|
||||
android:text="@string/nc_mark_as_unread"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/high_emphasis_text"
|
||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/menu_icon_forward_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_share_action"
|
||||
app:tint="@color/high_emphasis_menu_icon" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/menu_text_forward_message"
|
||||
<LinearLayout
|
||||
android:id="@+id/menu_forward_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="@dimen/standard_double_padding"
|
||||
android:paddingEnd="@dimen/zero"
|
||||
android:text="@string/nc_forward_message"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/high_emphasis_text"
|
||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||
android:layout_height="@dimen/bottom_sheet_item_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/menu_icon_forward_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_share_action"
|
||||
app:tint="@color/high_emphasis_menu_icon" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/menu_reply_to_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_item_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/menu_text_forward_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="@dimen/standard_double_padding"
|
||||
android:paddingEnd="@dimen/zero"
|
||||
android:text="@string/nc_forward_message"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/high_emphasis_text"
|
||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/menu_icon_reply_to_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_reply"
|
||||
app:tint="@color/high_emphasis_menu_icon" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/menu_text_reply_to_message"
|
||||
<LinearLayout
|
||||
android:id="@+id/menu_reply_to_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="@dimen/standard_double_padding"
|
||||
android:paddingEnd="@dimen/zero"
|
||||
android:text="@string/nc_reply"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/high_emphasis_text"
|
||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||
android:layout_height="@dimen/bottom_sheet_item_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/menu_icon_reply_to_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_reply"
|
||||
app:tint="@color/high_emphasis_menu_icon" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/menu_reply_privately"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_item_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/menu_text_reply_to_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="@dimen/standard_double_padding"
|
||||
android:paddingEnd="@dimen/zero"
|
||||
android:text="@string/nc_reply"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/high_emphasis_text"
|
||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/menu_icon_reply_privately"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_reply"
|
||||
app:tint="@color/high_emphasis_menu_icon" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/menu_text_reply_privately"
|
||||
<LinearLayout
|
||||
android:id="@+id/menu_reply_privately"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="@dimen/standard_double_padding"
|
||||
android:paddingEnd="@dimen/zero"
|
||||
android:text="@string/nc_reply_privately"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/high_emphasis_text"
|
||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||
android:layout_height="@dimen/bottom_sheet_item_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/menu_icon_reply_privately"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_reply"
|
||||
app:tint="@color/high_emphasis_menu_icon" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/menu_delete_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_item_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/menu_text_reply_privately"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="@dimen/standard_double_padding"
|
||||
android:paddingEnd="@dimen/zero"
|
||||
android:text="@string/nc_reply_privately"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/high_emphasis_text"
|
||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/menu_icon_delete_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_delete"
|
||||
app:tint="@color/high_emphasis_menu_icon" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/menu_text_delete_message"
|
||||
<LinearLayout
|
||||
android:id="@+id/menu_delete_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="@dimen/standard_double_padding"
|
||||
android:paddingEnd="@dimen/zero"
|
||||
android:text="@string/nc_delete_message"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/high_emphasis_text"
|
||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||
android:layout_height="@dimen/bottom_sheet_item_height"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/menu_icon_delete_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:src="@drawable/ic_delete"
|
||||
app:tint="@color/high_emphasis_menu_icon" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/menu_text_delete_message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:paddingStart="@dimen/standard_double_padding"
|
||||
android:paddingEnd="@dimen/zero"
|
||||
android:text="@string/nc_delete_message"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/high_emphasis_text"
|
||||
android:textSize="@dimen/bottom_sheet_text_size" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user