fix code checks warnings

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-04-07 20:41:28 +02:00 committed by Marcel Hibbe
parent 2068faa80e
commit b4316ecaad
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B
2 changed files with 32 additions and 5 deletions

View file

@ -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 = ""
}
}
}

View file

@ -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