From c173c70bd731215a7d50ff67c7dd65d77adf5c9f Mon Sep 17 00:00:00 2001 From: Smarshal21 Date: Tue, 14 Nov 2023 14:23:57 +0530 Subject: [PATCH] Fixed Codacy errors Signed-off-by: Smarshal21 --- .../java/com/nextcloud/talk/call/ReactionAnimator.kt | 4 +--- .../com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt | 8 +++----- .../nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt | 9 +++++++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/call/ReactionAnimator.kt b/app/src/main/java/com/nextcloud/talk/call/ReactionAnimator.kt index 3db27ece3b..336cbced21 100644 --- a/app/src/main/java/com/nextcloud/talk/call/ReactionAnimator.kt +++ b/app/src/main/java/com/nextcloud/talk/call/ReactionAnimator.kt @@ -39,7 +39,6 @@ import androidx.emoji2.widget.EmojiTextView import com.nextcloud.talk.R import com.nextcloud.talk.ui.theme.ViewThemeUtils - class ReactionAnimator( val context: Context, private val startPointView: RelativeLayout, @@ -63,7 +62,6 @@ class ReactionAnimator( callReaction: CallReaction ) { val reactionWrapper = getReactionWrapperView(callReaction) - val params = RelativeLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT @@ -100,7 +98,6 @@ class ReactionAnimator( val animatorWithFullAlpha = AnimatorSet() animatorWithFullAlpha.play(moveWithFullAlpha) - animatorWithFullAlpha.addListener(object : AnimatorListenerAdapter() { override fun onAnimationEnd(animation: Animator) { reactionsList.remove(callReaction) @@ -183,6 +180,7 @@ class ReactionAnimator( private const val BOTTOM_MARGIN: Int = 5 } } + data class CallReaction( var emoji: String, var userName: String diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt index 38d1ebea19..1280283649 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt +++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt @@ -73,8 +73,6 @@ class MessageActionsDialog( private lateinit var dialogMessageActionsBinding: DialogMessageActionsBinding - // private lateinit var popup: EmojiPopup - override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) NextcloudTalkApplication.sharedApplication?.componentApplication?.inject(this) @@ -141,8 +139,8 @@ class MessageActionsDialog( true } - dialogMessageActionsBinding.emojiMore.setOnClickListener { toggleEmojiPopup()} - dialogMessageActionsBinding.emojiPicker.setOnEmojiPickedListener(){ + dialogMessageActionsBinding.emojiMore.setOnClickListener { toggleEmojiPopup() } + dialogMessageActionsBinding.emojiPicker.setOnEmojiPickedListener() { clickOnEmoji(message, it.emoji) } } @@ -300,6 +298,7 @@ class MessageActionsDialog( dialogMessageActionsBinding.menuTranslateMessage.visibility = getVisibility(visible) } + private fun initMenuShare(visible: Boolean) { if (visible) { dialogMessageActionsBinding.menuShare.setOnClickListener { @@ -399,7 +398,6 @@ class MessageActionsDialog( } } - companion object { private val TAG = MessageActionsDialog::class.java.simpleName private const val ACTOR_LENGTH = 6 diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt index 51fa074c9b..734306f822 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt +++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt @@ -141,7 +141,9 @@ class SetStatusDialogFragment : DialogFragment(), PredefinedStatusClickListener ) 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 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 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( credentials, ApiUtils.getUrlForSetCustomStatus(currentUser?.baseUrl), statusIcon, inputText, clearAt ).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())