Fixed Codacy errors

Signed-off-by: Smarshal21 <lcb2021048@iiitl.ac.in>
This commit is contained in:
Smarshal21 2023-11-14 14:23:57 +05:30
parent ec1108ccc4
commit c173c70bd7
3 changed files with 11 additions and 10 deletions

View file

@ -39,7 +39,6 @@ import androidx.emoji2.widget.EmojiTextView
import com.nextcloud.talk.R import com.nextcloud.talk.R
import com.nextcloud.talk.ui.theme.ViewThemeUtils import com.nextcloud.talk.ui.theme.ViewThemeUtils
class ReactionAnimator( class ReactionAnimator(
val context: Context, val context: Context,
private val startPointView: RelativeLayout, private val startPointView: RelativeLayout,
@ -63,7 +62,6 @@ class ReactionAnimator(
callReaction: CallReaction callReaction: CallReaction
) { ) {
val reactionWrapper = getReactionWrapperView(callReaction) val reactionWrapper = getReactionWrapperView(callReaction)
val params = RelativeLayout.LayoutParams( val params = RelativeLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT LinearLayout.LayoutParams.WRAP_CONTENT
@ -100,7 +98,6 @@ class ReactionAnimator(
val animatorWithFullAlpha = AnimatorSet() val animatorWithFullAlpha = AnimatorSet()
animatorWithFullAlpha.play(moveWithFullAlpha) animatorWithFullAlpha.play(moveWithFullAlpha)
animatorWithFullAlpha.addListener(object : AnimatorListenerAdapter() { animatorWithFullAlpha.addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) { override fun onAnimationEnd(animation: Animator) {
reactionsList.remove(callReaction) reactionsList.remove(callReaction)
@ -183,6 +180,7 @@ class ReactionAnimator(
private const val BOTTOM_MARGIN: Int = 5 private const val BOTTOM_MARGIN: Int = 5
} }
} }
data class CallReaction( data class CallReaction(
var emoji: String, var emoji: String,
var userName: String var userName: String

View file

@ -73,8 +73,6 @@ class MessageActionsDialog(
private lateinit var dialogMessageActionsBinding: DialogMessageActionsBinding private lateinit var dialogMessageActionsBinding: DialogMessageActionsBinding
// private lateinit var popup: EmojiPopup
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
NextcloudTalkApplication.sharedApplication?.componentApplication?.inject(this) NextcloudTalkApplication.sharedApplication?.componentApplication?.inject(this)
@ -141,8 +139,8 @@ class MessageActionsDialog(
true true
} }
dialogMessageActionsBinding.emojiMore.setOnClickListener { toggleEmojiPopup()} dialogMessageActionsBinding.emojiMore.setOnClickListener { toggleEmojiPopup() }
dialogMessageActionsBinding.emojiPicker.setOnEmojiPickedListener(){ dialogMessageActionsBinding.emojiPicker.setOnEmojiPickedListener() {
clickOnEmoji(message, it.emoji) clickOnEmoji(message, it.emoji)
} }
} }
@ -300,6 +298,7 @@ class MessageActionsDialog(
dialogMessageActionsBinding.menuTranslateMessage.visibility = getVisibility(visible) dialogMessageActionsBinding.menuTranslateMessage.visibility = getVisibility(visible)
} }
private fun initMenuShare(visible: Boolean) { private fun initMenuShare(visible: Boolean) {
if (visible) { if (visible) {
dialogMessageActionsBinding.menuShare.setOnClickListener { dialogMessageActionsBinding.menuShare.setOnClickListener {
@ -399,7 +398,6 @@ class MessageActionsDialog(
} }
} }
companion object { companion object {
private val TAG = MessageActionsDialog::class.java.simpleName private val TAG = MessageActionsDialog::class.java.simpleName
private const val ACTOR_LENGTH = 6 private const val ACTOR_LENGTH = 6

View file

@ -141,7 +141,9 @@ class SetStatusDialogFragment : DialogFragment(), PredefinedStatusClickListener
) )
predefinedStatusOverall.ocs?.data?.let { it1 -> predefinedStatusesList.addAll(it1) } predefinedStatusOverall.ocs?.data?.let { it1 -> predefinedStatusesList.addAll(it1) }
if (currentStatus?.messageIsPredefined == true && currentStatus?.messageId?.isNotEmpty() == true) { if (currentStatus?.messageIsPredefined == true &&
currentStatus?.messageId?.isNotEmpty() == true
) {
val messageId = currentStatus!!.messageId val messageId = currentStatus!!.messageId
selectedPredefinedStatus = predefinedStatusesList.firstOrNull { ps -> messageId == ps.id } selectedPredefinedStatus = predefinedStatusesList.firstOrNull { ps -> messageId == ps.id }
} }
@ -454,7 +456,10 @@ class SetStatusDialogFragment : DialogFragment(), PredefinedStatusClickListener
// The endpoint '/message/custom' expects a valid emoji as string or null // The endpoint '/message/custom' expects a valid emoji as string or null
val statusIcon = binding.emoji.text.toString().ifEmpty { null } val statusIcon = binding.emoji.text.toString().ifEmpty { null }
if (selectedPredefinedStatus == null || selectedPredefinedStatus!!.message != inputText || selectedPredefinedStatus!!.icon != binding.emoji.text.toString()) { if (selectedPredefinedStatus == null ||
selectedPredefinedStatus!!.message != inputText ||
selectedPredefinedStatus!!.icon != binding.emoji.text.toString()
) {
ncApi.setCustomStatusMessage( ncApi.setCustomStatusMessage(
credentials, ApiUtils.getUrlForSetCustomStatus(currentUser?.baseUrl), statusIcon, inputText, clearAt credentials, ApiUtils.getUrlForSetCustomStatus(currentUser?.baseUrl), statusIcon, inputText, clearAt
).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()) ).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())