mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
show conversation avatars in chat appbar
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
6152fa50fe
commit
dd4b797ef8
@ -755,6 +755,7 @@ class ChatActivity :
|
||||
downX = event.x
|
||||
showRecordAudioUi(true)
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_CANCEL -> {
|
||||
Log.d(TAG, "ACTION_CANCEL. same as for UP")
|
||||
if (!isVoiceRecordingInProgress || !isRecordAudioPermissionGranted()) {
|
||||
@ -765,6 +766,7 @@ class ChatActivity :
|
||||
showRecordAudioUi(false)
|
||||
binding?.messageInputView?.slideToCancelDescription?.x = sliderInitX
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_UP -> {
|
||||
Log.d(TAG, "ACTION_UP. stop recording??")
|
||||
if (!isVoiceRecordingInProgress || !isRecordAudioPermissionGranted()) {
|
||||
@ -791,6 +793,7 @@ class ChatActivity :
|
||||
|
||||
binding?.messageInputView?.slideToCancelDescription?.x = sliderInitX
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
Log.d(TAG, "ACTION_MOVE.")
|
||||
|
||||
@ -986,12 +989,22 @@ class ChatActivity :
|
||||
}
|
||||
|
||||
private fun loadAvatarForStatusBar() {
|
||||
if (isOneToOneConversation()) {
|
||||
val url = ApiUtils.getUrlForAvatar(
|
||||
conversationUser!!.baseUrl,
|
||||
currentConversation!!.name,
|
||||
true
|
||||
)
|
||||
if (isOneToOneConversation() || isGroupConversation() || isPublicConversation()) {
|
||||
var url = ""
|
||||
if (isOneToOneConversation()) {
|
||||
url = ApiUtils.getUrlForAvatar(
|
||||
conversationUser!!.baseUrl,
|
||||
currentConversation!!.name,
|
||||
true
|
||||
)
|
||||
} else if (isGroupConversation() || isPublicConversation()) {
|
||||
url = ApiUtils.getUrlForConversationAvatar(
|
||||
1,
|
||||
conversationUser!!.baseUrl,
|
||||
currentConversation!!.token
|
||||
)
|
||||
}
|
||||
|
||||
val target = object : Target {
|
||||
|
||||
private fun setIcon(drawable: Drawable?) {
|
||||
@ -1032,8 +1045,13 @@ class ChatActivity :
|
||||
}
|
||||
|
||||
fun isOneToOneConversation() = currentConversation != null && currentConversation?.type != null &&
|
||||
currentConversation?.type == Conversation.ConversationType
|
||||
.ROOM_TYPE_ONE_TO_ONE_CALL
|
||||
currentConversation?.type == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
|
||||
|
||||
private fun isGroupConversation() = currentConversation != null && currentConversation?.type != null &&
|
||||
currentConversation?.type == Conversation.ConversationType.ROOM_GROUP_CALL
|
||||
|
||||
private fun isPublicConversation() = currentConversation != null && currentConversation?.type != null &&
|
||||
currentConversation?.type == Conversation.ConversationType.ROOM_PUBLIC_CALL
|
||||
|
||||
private fun switchToRoom(token: String, startCallAfterRoomSwitch: Boolean, isVoiceOnlyCall: Boolean) {
|
||||
if (conversationUser != null) {
|
||||
@ -1585,6 +1603,7 @@ class ChatActivity :
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
REQUEST_CODE_CHOOSE_FILE -> {
|
||||
try {
|
||||
checkNotNull(intent)
|
||||
@ -1612,6 +1631,7 @@ class ChatActivity :
|
||||
1 -> context.resources?.getString(R.string.nc_upload_confirm_send_single)?.let {
|
||||
String.format(it, title.trim())
|
||||
}
|
||||
|
||||
else -> context.resources?.getString(R.string.nc_upload_confirm_send_multiple)?.let {
|
||||
String.format(it, title.trim())
|
||||
}
|
||||
@ -1651,6 +1671,7 @@ class ChatActivity :
|
||||
Log.e(javaClass.simpleName, "Something went wrong when trying to upload file", e)
|
||||
}
|
||||
}
|
||||
|
||||
REQUEST_CODE_SELECT_CONTACT -> {
|
||||
val contactUri = intent?.data ?: return
|
||||
val cursor: Cursor? = contentResolver!!.query(contactUri, null, null, null, null)
|
||||
@ -1670,6 +1691,7 @@ class ChatActivity :
|
||||
}
|
||||
cursor?.close()
|
||||
}
|
||||
|
||||
REQUEST_CODE_PICK_CAMERA -> {
|
||||
if (resultCode == RESULT_OK) {
|
||||
try {
|
||||
@ -1713,6 +1735,7 @@ class ChatActivity :
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
REQUEST_CODE_MESSAGE_SEARCH -> {
|
||||
val messageId = intent?.getStringExtra(MessageSearchActivity.RESULT_KEY_MESSAGE_ID)
|
||||
messageId?.let { id ->
|
||||
@ -2340,6 +2363,7 @@ class ChatActivity :
|
||||
pullChatMessages(true, setReadMarker, xChatLastCommonRead)
|
||||
}
|
||||
}
|
||||
|
||||
HTTP_CODE_PRECONDITION_FAILED -> {
|
||||
Log.d(TAG, "pullChatMessages - HTTP_CODE_PRECONDITION_FAILED.")
|
||||
|
||||
@ -2349,6 +2373,7 @@ class ChatActivity :
|
||||
pastPreconditionFailed = true
|
||||
}
|
||||
}
|
||||
|
||||
HTTP_CODE_OK -> {
|
||||
Log.d(TAG, "pullChatMessages - HTTP_CODE_OK.")
|
||||
|
||||
@ -2763,22 +2788,27 @@ class ChatActivity :
|
||||
startACall(false, false)
|
||||
true
|
||||
}
|
||||
|
||||
R.id.conversation_voice_call -> {
|
||||
startACall(true, false)
|
||||
true
|
||||
}
|
||||
|
||||
R.id.conversation_info -> {
|
||||
showConversationInfoScreen()
|
||||
true
|
||||
}
|
||||
|
||||
R.id.shared_items -> {
|
||||
showSharedItems()
|
||||
true
|
||||
}
|
||||
|
||||
R.id.conversation_search -> {
|
||||
startMessageSearch()
|
||||
true
|
||||
}
|
||||
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user