mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 06:15:12 +00:00
improve detekt and format kotlin code
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
500d651d69
commit
f17e892acd
@ -2722,12 +2722,12 @@ class ChatController(args: Bundle) :
|
||||
}
|
||||
|
||||
fun updateAdapterAfterSendReaction(message: ChatMessage, emoji: String) {
|
||||
if (message.reactions == null){
|
||||
if (message.reactions == null) {
|
||||
message.reactions = HashMap()
|
||||
}
|
||||
|
||||
var amount = message.reactions[emoji]
|
||||
if (amount == null){
|
||||
if (amount == null) {
|
||||
amount = 0
|
||||
}
|
||||
message.reactions[emoji] = amount + 1
|
||||
|
@ -61,7 +61,6 @@ class MessageActionsDialog(
|
||||
|
||||
private lateinit var popup: EmojiPopup
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
dialogMessageActionsBinding = DialogMessageActionsBinding.inflate(layoutInflater)
|
||||
@ -87,6 +86,11 @@ class MessageActionsDialog(
|
||||
BuildConfig.DEBUG
|
||||
)
|
||||
|
||||
initEmojiMore()
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun initEmojiMore() {
|
||||
dialogMessageActionsBinding.emojiMore.setOnTouchListener { v, event ->
|
||||
if (event.action == MotionEvent.ACTION_DOWN) {
|
||||
if (popup.isShowing) {
|
||||
@ -247,11 +251,12 @@ class MessageActionsDialog(
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.subscribe(object : Observer<GenericOverall> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
// unused atm
|
||||
}
|
||||
|
||||
override fun onNext(@NonNull genericOverall: GenericOverall) {
|
||||
val statusCode = genericOverall.ocs.meta.statusCode
|
||||
if (statusCode == 200 || statusCode == 201) {
|
||||
if (statusCode == HTTP_OK || statusCode == HTTP_CREATED) {
|
||||
chatController.updateAdapterAfterSendReaction(message, emoji)
|
||||
}
|
||||
}
|
||||
@ -270,5 +275,7 @@ class MessageActionsDialog(
|
||||
private const val TAG = "MessageActionsDialog"
|
||||
private const val ACTOR_LENGTH = 6
|
||||
private const val NO_PREVIOUS_MESSAGE_ID: Int = -1
|
||||
private const val HTTP_OK: Int = 200
|
||||
private const val HTTP_CREATED: Int = 201
|
||||
}
|
||||
}
|
||||
|
@ -138,6 +138,7 @@ class ShowReactionsDialog(
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.subscribe(object : Observer<ReactionsOverall> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
// unused atm
|
||||
}
|
||||
|
||||
override fun onNext(@NonNull reactionsOverall: ReactionsOverall) {
|
||||
@ -187,6 +188,7 @@ class ShowReactionsDialog(
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.subscribe(object : Observer<GenericOverall> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
// unused atm
|
||||
}
|
||||
|
||||
override fun onNext(@NonNull genericOverall: GenericOverall) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
build:
|
||||
maxIssues: 96
|
||||
maxIssues: 95
|
||||
weights:
|
||||
# complexity: 2
|
||||
# LongParameterList: 1
|
||||
|
Loading…
Reference in New Issue
Block a user