improve detekt and format kotlin code

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-04-07 00:15:18 +02:00 committed by Marcel Hibbe
parent 500d651d69
commit f17e892acd
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
4 changed files with 14 additions and 5 deletions

View File

@ -2722,12 +2722,12 @@ class ChatController(args: Bundle) :
} }
fun updateAdapterAfterSendReaction(message: ChatMessage, emoji: String) { fun updateAdapterAfterSendReaction(message: ChatMessage, emoji: String) {
if (message.reactions == null){ if (message.reactions == null) {
message.reactions = HashMap() message.reactions = HashMap()
} }
var amount = message.reactions[emoji] var amount = message.reactions[emoji]
if (amount == null){ if (amount == null) {
amount = 0 amount = 0
} }
message.reactions[emoji] = amount + 1 message.reactions[emoji] = amount + 1

View File

@ -61,7 +61,6 @@ class MessageActionsDialog(
private lateinit var popup: EmojiPopup private lateinit var popup: EmojiPopup
@SuppressLint("ClickableViewAccessibility")
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
dialogMessageActionsBinding = DialogMessageActionsBinding.inflate(layoutInflater) dialogMessageActionsBinding = DialogMessageActionsBinding.inflate(layoutInflater)
@ -87,6 +86,11 @@ class MessageActionsDialog(
BuildConfig.DEBUG BuildConfig.DEBUG
) )
initEmojiMore()
}
@SuppressLint("ClickableViewAccessibility")
private fun initEmojiMore() {
dialogMessageActionsBinding.emojiMore.setOnTouchListener { v, event -> dialogMessageActionsBinding.emojiMore.setOnTouchListener { v, event ->
if (event.action == MotionEvent.ACTION_DOWN) { if (event.action == MotionEvent.ACTION_DOWN) {
if (popup.isShowing) { if (popup.isShowing) {
@ -247,11 +251,12 @@ class MessageActionsDialog(
?.observeOn(AndroidSchedulers.mainThread()) ?.observeOn(AndroidSchedulers.mainThread())
?.subscribe(object : Observer<GenericOverall> { ?.subscribe(object : Observer<GenericOverall> {
override fun onSubscribe(d: Disposable) { override fun onSubscribe(d: Disposable) {
// unused atm
} }
override fun onNext(@NonNull genericOverall: GenericOverall) { override fun onNext(@NonNull genericOverall: GenericOverall) {
val statusCode = genericOverall.ocs.meta.statusCode val statusCode = genericOverall.ocs.meta.statusCode
if (statusCode == 200 || statusCode == 201) { if (statusCode == HTTP_OK || statusCode == HTTP_CREATED) {
chatController.updateAdapterAfterSendReaction(message, emoji) chatController.updateAdapterAfterSendReaction(message, emoji)
} }
} }
@ -270,5 +275,7 @@ class MessageActionsDialog(
private const val TAG = "MessageActionsDialog" private const val TAG = "MessageActionsDialog"
private const val ACTOR_LENGTH = 6 private const val ACTOR_LENGTH = 6
private const val NO_PREVIOUS_MESSAGE_ID: Int = -1 private const val NO_PREVIOUS_MESSAGE_ID: Int = -1
private const val HTTP_OK: Int = 200
private const val HTTP_CREATED: Int = 201
} }
} }

View File

@ -138,6 +138,7 @@ class ShowReactionsDialog(
?.observeOn(AndroidSchedulers.mainThread()) ?.observeOn(AndroidSchedulers.mainThread())
?.subscribe(object : Observer<ReactionsOverall> { ?.subscribe(object : Observer<ReactionsOverall> {
override fun onSubscribe(d: Disposable) { override fun onSubscribe(d: Disposable) {
// unused atm
} }
override fun onNext(@NonNull reactionsOverall: ReactionsOverall) { override fun onNext(@NonNull reactionsOverall: ReactionsOverall) {
@ -187,6 +188,7 @@ class ShowReactionsDialog(
?.observeOn(AndroidSchedulers.mainThread()) ?.observeOn(AndroidSchedulers.mainThread())
?.subscribe(object : Observer<GenericOverall> { ?.subscribe(object : Observer<GenericOverall> {
override fun onSubscribe(d: Disposable) { override fun onSubscribe(d: Disposable) {
// unused atm
} }
override fun onNext(@NonNull genericOverall: GenericOverall) { override fun onNext(@NonNull genericOverall: GenericOverall) {

View File

@ -1,5 +1,5 @@
build: build:
maxIssues: 96 maxIssues: 95
weights: weights:
# complexity: 2 # complexity: 2
# LongParameterList: 1 # LongParameterList: 1