Replaced EmojiPicker in MessageActionsDialog and CreateConversationDialog

Signed-off-by: Smarshal21 <lcb2021048@iiitl.ac.in>
This commit is contained in:
Smarshal21 2023-11-08 22:06:26 +05:30
parent ee601bb590
commit 33ff8c4276
9 changed files with 41 additions and 55 deletions

View file

@ -25,11 +25,11 @@ import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import androidx.emoji2.widget.EmojiTextView
import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding
import com.nextcloud.talk.models.json.chat.ChatMessage
import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.utils.DisplayUtils
import com.vanniktech.emoji.EmojiTextView
class Reaction {

View file

@ -35,9 +35,10 @@ import android.widget.TextView
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.content.ContextCompat
import androidx.core.graphics.drawable.DrawableCompat
import androidx.emoji2.widget.EmojiTextView
import com.nextcloud.talk.R
import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.vanniktech.emoji.EmojiTextView
class ReactionAnimator(
val context: Context,

View file

@ -25,13 +25,12 @@ package com.nextcloud.talk.ui.dialog
import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import androidx.emoji2.widget.EmojiTextView
import autodagger.AutoInjector
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
@ -49,10 +48,6 @@ import com.nextcloud.talk.models.json.chat.ChatMessage
import com.nextcloud.talk.repositories.reactions.ReactionsRepository
import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew
import com.vanniktech.emoji.EmojiPopup
import com.vanniktech.emoji.EmojiTextView
import com.vanniktech.emoji.installDisableKeyboardInput
import com.vanniktech.emoji.installForceSingleEmoji
import io.reactivex.Observer
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
@ -78,7 +73,7 @@ class MessageActionsDialog(
private lateinit var dialogMessageActionsBinding: DialogMessageActionsBinding
private lateinit var popup: EmojiPopup
// private lateinit var popup: EmojiPopup
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -146,28 +141,10 @@ class MessageActionsDialog(
true
}
popup = EmojiPopup(
rootView = dialogMessageActionsBinding.root,
editText = dialogMessageActionsBinding.emojiMore,
onEmojiPopupShownListener = {
dialogMessageActionsBinding.emojiMore.clearFocus()
dialogMessageActionsBinding.messageActions.visibility = View.GONE
},
onEmojiClickListener = {
popup.dismiss()
clickOnEmoji(message, it.unicode)
},
onEmojiPopupDismissListener = {
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)
dialogMessageActionsBinding.emojiMore.setOnClickListener { toggleEmojiPopup()}
dialogMessageActionsBinding.emojiPicker.setOnEmojiPickedListener(){
clickOnEmoji(message, it.emoji)
}
)
dialogMessageActionsBinding.emojiMore.installDisableKeyboardInput(popup)
dialogMessageActionsBinding.emojiMore.installForceSingleEmoji()
}
/*
@ -176,18 +153,9 @@ class MessageActionsDialog(
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
)
}
val imm: InputMethodManager = context?.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(dialogMessageActionsBinding.emojiMore.windowToken, 0)
dialogMessageActionsBinding.emojiPicker.visibility = View.VISIBLE
}
private fun initEmojiBar(hasChatPermission: Boolean) {
@ -431,6 +399,7 @@ class MessageActionsDialog(
}
}
companion object {
private val TAG = MessageActionsDialog::class.java.simpleName
private const val ACTOR_LENGTH = 6

View file

@ -26,6 +26,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import androidx.core.content.ContextCompat
import androidx.emoji2.widget.EmojiTextView
import autodagger.AutoInjector
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
@ -37,7 +38,6 @@ import com.nextcloud.talk.raisehand.viewmodel.RaiseHandViewModel
import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew
import com.nextcloud.talk.viewmodels.CallRecordingViewModel
import com.vanniktech.emoji.EmojiTextView
import javax.inject.Inject
@AutoInjector(NextcloudTalkApplication::class)

View file

@ -63,7 +63,6 @@ import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.utils.ApiUtils
import com.nextcloud.talk.utils.DisplayUtils
import com.nextcloud.talk.utils.database.user.CurrentUserProviderNew
import com.vanniktech.emoji.EmojiPopup
import io.reactivex.Observer
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
@ -106,7 +105,6 @@ class SetStatusDialogFragment : DialogFragment(), PredefinedStatusClickListener
private lateinit var adapter: PredefinedStatusListAdapter
private var clearAt: Long? = null
private lateinit var popup: EmojiPopup
@Inject
lateinit var ncApi: NcApi

View file

@ -48,6 +48,7 @@ import androidx.core.content.res.ResourcesCompat
import androidx.core.graphics.ColorUtils
import androidx.core.graphics.drawable.DrawableCompat
import androidx.core.view.ViewCompat
import androidx.emoji2.widget.EmojiTextView
import com.google.android.material.button.MaterialButton
import com.google.android.material.card.MaterialCardView
import com.google.android.material.materialswitch.MaterialSwitch
@ -62,7 +63,6 @@ import com.nextcloud.talk.ui.WaveformSeekBar
import com.nextcloud.talk.utils.DisplayUtils
import com.nextcloud.talk.utils.DrawableUtils
import com.nextcloud.talk.utils.message.MessageUtils
import com.vanniktech.emoji.EmojiTextView
import com.wooplr.spotlight.SpotlightView
import eu.davidea.flexibleadapter.utils.FlexibleUtils
import javax.inject.Inject

View file

@ -65,4 +65,13 @@
app:tint="@color/medium_emphasis_text"
tools:visibility="visible" />
<androidx.emoji2.emojipicker.EmojiPickerView
android:id="@+id/emoji_picker"
android:layout_width="match_parent"
android:layout_below="@id/text_input_layout"
android:visibility="gone"
android:layout_height="match_parent"
app:emojiGridColumns="9" />
</RelativeLayout>

View file

@ -26,6 +26,15 @@
android:orientation="vertical"
android:paddingBottom="@dimen/standard_half_padding">
<androidx.emoji2.emojipicker.EmojiPickerView
android:id="@+id/emoji_picker"
android:layout_width="match_parent"
android:visibility="gone"
android:layout_height="match_parent"
app:emojiGridColumns="9" />
<LinearLayout
android:id="@+id/emojiBar"
android:layout_width="match_parent"
@ -37,7 +46,7 @@
android:gravity="center_vertical"
android:orientation="horizontal">
<com.vanniktech.emoji.EmojiTextView
<androidx.emoji2.widget.EmojiTextView
android:id="@+id/emojiThumbsUp"
android:layout_width="@dimen/reaction_bottom_sheet_layout_size"
android:layout_height="@dimen/reaction_bottom_sheet_layout_size"
@ -48,7 +57,7 @@
android:text="@string/emoji_thumbsUp"
android:textSize="20sp" />
<com.vanniktech.emoji.EmojiTextView
<androidx.emoji2.widget.EmojiTextView
android:id="@+id/emojiThumbsDown"
android:layout_width="@dimen/reaction_bottom_sheet_layout_size"
android:layout_height="@dimen/reaction_bottom_sheet_layout_size"
@ -59,7 +68,7 @@
android:text="@string/emoji_thumbsDown"
android:textSize="20sp" />
<com.vanniktech.emoji.EmojiTextView
<androidx.emoji2.widget.EmojiTextView
android:id="@+id/emojiHeart"
android:layout_width="@dimen/reaction_bottom_sheet_layout_size"
android:layout_height="@dimen/reaction_bottom_sheet_layout_size"
@ -70,7 +79,7 @@
android:text="@string/default_emoji"
android:textSize="20sp" />
<com.vanniktech.emoji.EmojiTextView
<androidx.emoji2.widget.EmojiTextView
android:id="@+id/emojiLaugh"
android:layout_width="@dimen/reaction_bottom_sheet_layout_size"
android:layout_height="@dimen/reaction_bottom_sheet_layout_size"
@ -81,7 +90,7 @@
android:text="@string/emoji_heart"
android:textSize="20sp" />
<com.vanniktech.emoji.EmojiTextView
<androidx.emoji2.widget.EmojiTextView
android:id="@+id/emojiConfused"
android:layout_width="@dimen/reaction_bottom_sheet_layout_size"
android:layout_height="@dimen/reaction_bottom_sheet_layout_size"
@ -92,7 +101,7 @@
android:text="@string/emoji_confused"
android:textSize="20sp" />
<com.vanniktech.emoji.EmojiTextView
<androidx.emoji2.widget.EmojiTextView
android:id="@+id/emojiSad"
android:layout_width="@dimen/reaction_bottom_sheet_layout_size"
android:layout_height="@dimen/reaction_bottom_sheet_layout_size"
@ -103,7 +112,7 @@
android:text="@string/emoji_sad"
android:textSize="20sp" />
<com.vanniktech.emoji.EmojiEditText
<androidx.emoji2.widget.EmojiEditText
android:id="@+id/emojiMore"
android:layout_width="0dp"
android:layout_height="@dimen/activity_row_layout_height"

View file

@ -35,7 +35,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.vanniktech.emoji.EmojiEditText
<androidx.emoji2.widget.EmojiEditText
android:id="@+id/participant_status_emoji"
android:layout_width="22dp"
android:layout_height="wrap_content"