Explorar o código

fix code checks warnings

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger %!s(int64=3) %!d(string=hai) anos
pai
achega
b4316ecaad

+ 25 - 2
app/src/main/java/com/nextcloud/talk/adapters/messages/Reaction.kt

@@ -1,3 +1,26 @@
+/*
+ * Nextcloud Talk application
+ *
+ * @author Marcel Hibbe
+ * Copyright (C) 2022 Marcel Hibbe (dev@mhibbe.de)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Parts related to account import were either copied from or inspired by the great work done by David Luhmer at:
+ * https://github.com/nextcloud/ownCloud-Account-Importer
+ */
+
 package com.nextcloud.talk.adapters.messages
 
 import android.content.Context
@@ -53,6 +76,6 @@ class Reaction {
         const val MAX_EMOJIS_TO_DISPLAY = 4
         const val EMOJI_START_MARGIN: Float = 2F
         const val EMOJI_END_MARGIN: Float = 8F
-        const val EMOJI_MORE = "..."
+        const val EMOJI_MORE = ""
     }
-}
+}

+ 7 - 3
app/src/main/java/com/nextcloud/talk/ui/dialog/ShowReactionsDialog.kt

@@ -70,7 +70,7 @@ class ShowReactionsDialog(
 
     private var adapter: ReactionsAdapter? = null
 
-    private val TAG_ALL: String? = null
+    private val tagAll: String? = null
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
@@ -103,7 +103,7 @@ class ShowReactionsDialog(
             val tab: TabLayout.Tab = binding.emojiReactionsTabs.newTab() // Create a new Tab names "First Tab"
 
             val itemBinding = ItemReactionsTabBinding.inflate(layoutInflater)
-            itemBinding.reactionTab.tag = TAG_ALL
+            itemBinding.reactionTab.tag = tagAll
             itemBinding.reactionIcon.text = context.getString(R.string.reactions_tab_all)
             itemBinding.reactionCount.text = reactionsTotal.toString()
             tab.customView = itemBinding.root
@@ -127,7 +127,7 @@ class ShowReactionsDialog(
                 }
             })
 
-            updateParticipantsForEmoji(chatMessage, TAG_ALL)
+            updateParticipantsForEmoji(chatMessage, tagAll)
         }
         adapter?.notifyDataSetChanged()
     }
@@ -228,6 +228,7 @@ class ShowReactionsDialog(
     }
 
     class ReactionComparator(val activeUser: String?) : Comparator<ReactionItem> {
+        @Suppress("ReturnCount")
         override fun compare(reactionItem1: ReactionItem?, reactionItem2: ReactionItem?): Int {
             // sort by emoji, own account, display-name, timestamp, actor-id
 
@@ -294,6 +295,7 @@ class ShowReactionsDialog(
             return 0
         }
 
+        @Suppress("ReturnCount")
         fun compareOwnAccount(activeUser: String?, actorId1: String?, actorId2: String?): Int {
             val reactionVote1Active = activeUser == actorId1
             val reactionVote2Active = activeUser == actorId2
@@ -317,6 +319,7 @@ class ShowReactionsDialog(
         }
 
         internal class StringComparator : Comparator<String?> {
+            @Suppress("ReturnCount")
             override fun compare(obj1: String?, obj2: String?): Int {
                 if (obj1 === obj2) {
                     return 0
@@ -331,6 +334,7 @@ class ShowReactionsDialog(
         }
 
         internal class LongComparator : Comparator<Long?> {
+            @Suppress("ReturnCount")
             override fun compare(obj1: Long?, obj2: Long?): Int {
                 if (obj1 === obj2) {
                     return 0