mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 14:27:24 +00:00
reformat code for 120 line length
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
14fc3c8146
commit
85fe560fc1
@ -3,8 +3,10 @@
|
|||||||
*
|
*
|
||||||
* @author Mario Danic
|
* @author Mario Danic
|
||||||
* @author Marcel Hibbe
|
* @author Marcel Hibbe
|
||||||
* Copyright (C) 2017-2019 Mario Danic <mario@lovelyhq.com>
|
* @author Andy Scherzinger
|
||||||
|
* Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
|
||||||
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
* Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
|
||||||
|
* Copyright (C) 2017-2019 Mario Danic <mario@lovelyhq.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -708,7 +710,10 @@ class ChatController(args: Bundle) :
|
|||||||
require(files.isNotEmpty())
|
require(files.isNotEmpty())
|
||||||
val data: Data = Data.Builder()
|
val data: Data = Data.Builder()
|
||||||
.putStringArray(UploadAndShareFilesWorker.DEVICE_SOURCEFILES, files.toTypedArray())
|
.putStringArray(UploadAndShareFilesWorker.DEVICE_SOURCEFILES, files.toTypedArray())
|
||||||
.putString(UploadAndShareFilesWorker.NC_TARGETPATH, CapabilitiesUtil.getAttachmentFolder(conversationUser))
|
.putString(
|
||||||
|
UploadAndShareFilesWorker.NC_TARGETPATH,
|
||||||
|
CapabilitiesUtil.getAttachmentFolder(conversationUser)
|
||||||
|
)
|
||||||
.putString(UploadAndShareFilesWorker.ROOM_TOKEN, roomToken)
|
.putString(UploadAndShareFilesWorker.ROOM_TOKEN, roomToken)
|
||||||
.build()
|
.build()
|
||||||
val uploadWorker: OneTimeWorkRequest = OneTimeWorkRequest.Builder(UploadAndShareFilesWorker::class.java)
|
val uploadWorker: OneTimeWorkRequest = OneTimeWorkRequest.Builder(UploadAndShareFilesWorker::class.java)
|
||||||
@ -1073,7 +1078,11 @@ class ChatController(args: Bundle) :
|
|||||||
val replyMessageId: Int? = view?.findViewById<RelativeLayout>(R.id.quotedChatMessageView)?.tag as Int?
|
val replyMessageId: Int? = view?.findViewById<RelativeLayout>(R.id.quotedChatMessageView)?.tag as Int?
|
||||||
sendMessage(
|
sendMessage(
|
||||||
editable,
|
editable,
|
||||||
if (view?.findViewById<RelativeLayout>(R.id.quotedChatMessageView)?.visibility == View.VISIBLE) replyMessageId else null
|
if (
|
||||||
|
view
|
||||||
|
?.findViewById<RelativeLayout>(R.id.quotedChatMessageView)
|
||||||
|
?.visibility == View.VISIBLE
|
||||||
|
) replyMessageId else null
|
||||||
)
|
)
|
||||||
cancelReply()
|
cancelReply()
|
||||||
}
|
}
|
||||||
@ -1546,7 +1555,9 @@ class ChatController(args: Bundle) :
|
|||||||
PopupMenu(
|
PopupMenu(
|
||||||
ContextThemeWrapper(view?.context, R.style.appActionBarPopupMenu),
|
ContextThemeWrapper(view?.context, R.style.appActionBarPopupMenu),
|
||||||
view,
|
view,
|
||||||
if (message?.user?.id == currentConversation?.actorType + "/" + currentConversation?.actorId) Gravity.END else Gravity.START
|
if (
|
||||||
|
message?.user?.id == currentConversation?.actorType + "/" + currentConversation?.actorId
|
||||||
|
) Gravity.END else Gravity.START
|
||||||
).apply {
|
).apply {
|
||||||
setOnMenuItemClickListener { item ->
|
setOnMenuItemClickListener { item ->
|
||||||
when (item?.itemId) {
|
when (item?.itemId) {
|
||||||
@ -1561,42 +1572,48 @@ class ChatController(args: Bundle) :
|
|||||||
R.id.action_reply_to_message -> {
|
R.id.action_reply_to_message -> {
|
||||||
val chatMessage = message as ChatMessage?
|
val chatMessage = message as ChatMessage?
|
||||||
chatMessage?.let {
|
chatMessage?.let {
|
||||||
binding?.messageInputView?.findViewById<ImageButton>(R.id.attachmentButton)?.visibility = View.GONE
|
binding?.messageInputView?.findViewById<ImageButton>(R.id.attachmentButton)?.visibility =
|
||||||
binding?.messageInputView?.findViewById<Space>(R.id.attachmentButtonSpace)?.visibility = View.GONE
|
View.GONE
|
||||||
|
binding?.messageInputView?.findViewById<Space>(R.id.attachmentButtonSpace)?.visibility =
|
||||||
|
View.GONE
|
||||||
binding?.messageInputView?.findViewById<ImageButton>(R.id.cancelReplyButton)?.visibility =
|
binding?.messageInputView?.findViewById<ImageButton>(R.id.cancelReplyButton)?.visibility =
|
||||||
View.VISIBLE
|
View.VISIBLE
|
||||||
binding?.messageInputView?.findViewById<EmojiTextView>(R.id.quotedMessage)?.maxLines = 2
|
|
||||||
binding?.messageInputView?.findViewById<EmojiTextView>(R.id.quotedMessage)?.ellipsize =
|
val quotedMessage = binding
|
||||||
TextUtils.TruncateAt.END
|
?.messageInputView
|
||||||
binding?.messageInputView?.findViewById<EmojiTextView>(R.id.quotedMessage)?.text = it.text
|
?.findViewById<EmojiTextView>(R.id.quotedMessage)
|
||||||
|
|
||||||
|
quotedMessage?.maxLines = 2
|
||||||
|
quotedMessage?.ellipsize = TextUtils.TruncateAt.END
|
||||||
|
quotedMessage?.text = it.text
|
||||||
binding?.messageInputView?.findViewById<EmojiTextView>(R.id.quotedMessageAuthor)?.text =
|
binding?.messageInputView?.findViewById<EmojiTextView>(R.id.quotedMessageAuthor)?.text =
|
||||||
it.actorDisplayName ?: context!!.getText(R.string.nc_nick_guest)
|
it.actorDisplayName ?: context!!.getText(R.string.nc_nick_guest)
|
||||||
|
|
||||||
conversationUser?.let { currentUser ->
|
conversationUser?.let { currentUser ->
|
||||||
|
val quotedMessageImage = binding
|
||||||
|
?.messageInputView
|
||||||
|
?.findViewById<ImageView>(R.id.quotedMessageImage)
|
||||||
chatMessage.imageUrl?.let { previewImageUrl ->
|
chatMessage.imageUrl?.let { previewImageUrl ->
|
||||||
binding?.messageInputView?.findViewById<ImageView>(R.id.quotedMessageImage)?.visibility =
|
quotedMessageImage?.visibility = View.VISIBLE
|
||||||
View.VISIBLE
|
|
||||||
|
|
||||||
val px = TypedValue.applyDimension(
|
val px = TypedValue.applyDimension(
|
||||||
TypedValue.COMPLEX_UNIT_DIP,
|
TypedValue.COMPLEX_UNIT_DIP,
|
||||||
96f,
|
96f,
|
||||||
resources?.displayMetrics
|
resources?.displayMetrics
|
||||||
)
|
)
|
||||||
binding?.messageInputView?.findViewById<ImageView>(R.id.quotedMessageImage)?.maxHeight =
|
|
||||||
px.toInt()
|
quotedMessageImage?.maxHeight = px.toInt()
|
||||||
val layoutParams =
|
val layoutParams = quotedMessageImage?.layoutParams as FlexboxLayout.LayoutParams
|
||||||
binding?.messageInputView?.findViewById<ImageView>(R.id.quotedMessageImage)?.layoutParams as FlexboxLayout.LayoutParams
|
|
||||||
layoutParams.flexGrow = 0f
|
layoutParams.flexGrow = 0f
|
||||||
binding?.messageInputView?.findViewById<ImageView>(R.id.quotedMessageImage)?.layoutParams =
|
quotedMessageImage?.layoutParams = layoutParams
|
||||||
layoutParams
|
quotedMessageImage?.load(previewImageUrl) {
|
||||||
binding?.messageInputView?.findViewById<ImageView>(R.id.quotedMessageImage)
|
addHeader("Authorization", credentials!!)
|
||||||
?.load(previewImageUrl) {
|
}
|
||||||
addHeader("Authorization", credentials!!)
|
|
||||||
}
|
|
||||||
} ?: run {
|
} ?: run {
|
||||||
binding?.messageInputView?.findViewById<ImageView>(R.id.quotedMessageImage)?.visibility =
|
binding
|
||||||
View.GONE
|
?.messageInputView
|
||||||
|
?.findViewById<ImageView>(R.id.quotedMessageImage)
|
||||||
|
?.visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1760,7 +1777,9 @@ class ChatController(args: Bundle) :
|
|||||||
if (message.hasFileAttachment()) return false
|
if (message.hasFileAttachment()) return false
|
||||||
|
|
||||||
val sixHoursInMillis = 6 * 3600 * 1000
|
val sixHoursInMillis = 6 * 3600 * 1000
|
||||||
val isOlderThanSixHours = message.createdAt?.before(Date(System.currentTimeMillis() - sixHoursInMillis)) == true
|
val isOlderThanSixHours = message
|
||||||
|
.createdAt
|
||||||
|
?.before(Date(System.currentTimeMillis() - sixHoursInMillis)) == true
|
||||||
if (isOlderThanSixHours) return false
|
if (isOlderThanSixHours) return false
|
||||||
|
|
||||||
val isUserAllowedByPrivileges = if (message.actorId == conversationUser.userId) {
|
val isUserAllowedByPrivileges = if (message.actorId == conversationUser.userId) {
|
||||||
|
Loading…
Reference in New Issue
Block a user