mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-12-18 06:32:08 +03:00
Migrate Java parts to Kotlin
Also fixing some detekt issues. Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
parent
6f5492bf74
commit
26c2c0065b
2 changed files with 34 additions and 32 deletions
|
@ -102,23 +102,7 @@ class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewH
|
|||
binding.messageQuote.quotedChatMessageView.visibility = View.GONE
|
||||
}
|
||||
|
||||
val readStatusDrawableInt = when (message.readStatus) {
|
||||
ReadStatus.READ -> R.drawable.ic_check_all
|
||||
ReadStatus.SENT -> R.drawable.ic_check
|
||||
ReadStatus.SENDING -> R.drawable.ic_sending
|
||||
ReadStatus.FAILED -> R.drawable.ic_warning_white
|
||||
else -> null
|
||||
}
|
||||
|
||||
val readStatusContentDescriptionString = when (message.readStatus) {
|
||||
ReadStatus.READ -> context?.resources?.getString(R.string.nc_message_read)
|
||||
ReadStatus.SENT -> context?.resources?.getString(R.string.nc_message_sent)
|
||||
ReadStatus.SENDING -> context?.resources?.getString(R.string.nc_message_sending)
|
||||
ReadStatus.FAILED -> context?.resources?.getString(R.string.nc_message_send_error)
|
||||
else -> null
|
||||
}
|
||||
|
||||
readStatusDrawableInt?.let { drawableInt ->
|
||||
readStatusDrawableInt(message)?.let { drawableInt ->
|
||||
ResourcesCompat.getDrawable(context!!.resources, drawableInt, null)?.let {
|
||||
binding.checkMark.setImageDrawable(it)
|
||||
binding.checkMark.setColorFilter(
|
||||
|
@ -127,7 +111,7 @@ class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewH
|
|||
}
|
||||
}
|
||||
|
||||
binding.checkMark.setContentDescription(readStatusContentDescriptionString)
|
||||
binding.checkMark.setContentDescription(readStatusContentDescriptionString(message))
|
||||
|
||||
itemView.setTag(MessageSwipeCallback.REPLYABLE_VIEW_TAG, message.replyable)
|
||||
|
||||
|
@ -150,6 +134,24 @@ class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewH
|
|||
commonMessageInterface.onClickReaction(chatMessage, emoji)
|
||||
}
|
||||
|
||||
private fun readStatusContentDescriptionString(message: ChatMessage) =
|
||||
when (message.readStatus) {
|
||||
ReadStatus.READ -> context?.resources?.getString(R.string.nc_message_read)
|
||||
ReadStatus.SENT -> context?.resources?.getString(R.string.nc_message_sent)
|
||||
ReadStatus.SENDING -> context?.resources?.getString(R.string.nc_message_sending)
|
||||
ReadStatus.FAILED -> context?.resources?.getString(R.string.nc_message_send_error)
|
||||
else -> null
|
||||
}
|
||||
|
||||
private fun readStatusDrawableInt(message: ChatMessage) =
|
||||
when (message.readStatus) {
|
||||
ReadStatus.READ -> R.drawable.ic_check_all
|
||||
ReadStatus.SENT -> R.drawable.ic_check
|
||||
ReadStatus.SENDING -> R.drawable.ic_sending
|
||||
ReadStatus.FAILED -> R.drawable.ic_warning_white
|
||||
else -> null
|
||||
}
|
||||
|
||||
private fun processParentMessage(message: ChatMessage) {
|
||||
val parentChatMessage = message.parentMessage
|
||||
val textColor = viewThemeUtils.getScheme(binding.messageQuote.quotedMessage.context).onSurfaceVariant
|
||||
|
|
|
@ -2128,7 +2128,6 @@ class ChatController(args: Bundle) :
|
|||
messObj.timestamp = tsLong
|
||||
messObj.jsonMessageId = 0 - tsLong.toInt()
|
||||
|
||||
|
||||
messObj.readStatus = ReadStatus.SENDING
|
||||
|
||||
if (conversationUser!!.userId != "?") {
|
||||
|
@ -3046,11 +3045,12 @@ class ChatController(args: Bundle) :
|
|||
fun replyPrivately(message: IMessage?) {
|
||||
val apiVersion =
|
||||
ApiUtils.getConversationApiVersion(
|
||||
conversationUser, intArrayOf(
|
||||
ApiUtils.APIv4,
|
||||
1
|
||||
)
|
||||
)
|
||||
conversationUser,
|
||||
intArrayOf(
|
||||
ApiUtils.APIv4,
|
||||
1
|
||||
)
|
||||
)
|
||||
val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(
|
||||
apiVersion,
|
||||
conversationUser?.baseUrl,
|
||||
|
@ -3108,20 +3108,20 @@ class ChatController(args: Bundle) :
|
|||
)
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
Log.e(TAG, e.message, e)
|
||||
}
|
||||
override fun onError(e: Throwable) {
|
||||
Log.e(TAG, e.message, e)
|
||||
}
|
||||
|
||||
override fun onComplete() {// unused atm
|
||||
override fun onComplete() { // unused atm
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
Log.e(TAG, e.message, e)
|
||||
}
|
||||
override fun onError(e: Throwable) {
|
||||
Log.e(TAG, e.message, e)
|
||||
}
|
||||
|
||||
override fun onComplete() {
|
||||
override fun onComplete() {
|
||||
// unused atm
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue