From d27c7a6212e68b85818f62ffd2d4998268c20cba Mon Sep 17 00:00:00 2001 From: sowjanyakch Date: Mon, 5 Feb 2024 22:43:00 +0100 Subject: [PATCH] UI improvements --- .../messages/IncomingTextMessageViewHolder.kt | 9 - .../OutcomingTextMessageViewHolder.kt | 7 - .../java/com/nextcloud/talk/api/NcApi.java | 320 +++++++++++++----- .../com/nextcloud/talk/chat/ChatActivity.kt | 34 +- .../com/nextcloud/talk/ui/MessageInput.kt | 2 +- .../talk/ui/dialog/MessageActionsDialog.kt | 2 +- app/src/main/res/drawable/ic_check_24.xml | 27 +- app/src/main/res/values/strings.xml | 2 + 8 files changed, 296 insertions(+), 107 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingTextMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingTextMessageViewHolder.kt index 07d2412e7..4f1c494de 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingTextMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingTextMessageViewHolder.kt @@ -79,7 +79,6 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) : sharedApplication!!.componentApplication.inject(this) setAvatarAndAuthorOnMessageItem(message) - colorizeMessageBubble(message) itemView.isSelected = false @@ -114,14 +113,6 @@ class IncomingTextMessageViewHolder(itemView: View, payload: Any) : binding.messageText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize) binding.messageText.text = processedMessageText - if (message.parentMessage?.id != null && message.systemMessageType == ChatMessage.SystemMessageType - .MESSAGE_EDITED - ) { - binding.messageType.visibility = View.VISIBLE - } else { - binding.messageType.visibility = View.GONE - } - binding.messageTime.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp) // parent message handling diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingTextMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingTextMessageViewHolder.kt index 9142ee679..680af44a6 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingTextMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingTextMessageViewHolder.kt @@ -100,13 +100,6 @@ class OutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessageViewH setBubbleOnChatMessage(message) binding.messageText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize) - if (message.parentMessage?.id != null && message.systemMessageType == ChatMessage.SystemMessageType - .MESSAGE_EDITED - ) { - binding.messageType.visibility = View.VISIBLE - } else { - binding.messageType.visibility = View.GONE - } binding.messageTime.layoutParams = layoutParams viewThemeUtils.platform.colorTextView(binding.messageText, ColorRole.ON_SURFACE_VARIANT) binding.messageText.text = processedMessageText diff --git a/app/src/main/java/com/nextcloud/talk/api/NcApi.java b/app/src/main/java/com/nextcloud/talk/api/NcApi.java index a10b5add3..493067de2 100644 --- a/app/src/main/java/com/nextcloud/talk/api/NcApi.java +++ b/app/src/main/java/com/nextcloud/talk/api/NcApi.java @@ -24,7 +24,6 @@ package com.nextcloud.talk.api; import com.nextcloud.talk.models.json.capabilities.CapabilitiesOverall; -import com.nextcloud.talk.models.json.chat.ChatOCSSingleMessage; import com.nextcloud.talk.models.json.chat.ChatOverall; import com.nextcloud.talk.models.json.chat.ChatOverallSingleMessage; import com.nextcloud.talk.models.json.chat.ChatShareOverall; @@ -97,14 +96,19 @@ public interface NcApi { */ @GET - Observable getContactsWithSearchParam(@Header("Authorization") String authorization, @Url String url, @Nullable @Query("shareTypes[]") List listOfShareTypes, @QueryMap Map options); + Observable getContactsWithSearchParam(@Header("Authorization") String authorization, + @Url String url, + @Nullable @Query("shareTypes[]") List listOfShareTypes, + @QueryMap Map options); /* Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /room */ @GET - Observable getRooms(@Header("Authorization") String authorization, @Url String url, @Nullable @Query("includeStatus") Boolean includeStatus); + Observable getRooms(@Header("Authorization") String authorization, + @Url String url, + @Nullable @Query("includeStatus") Boolean includeStatus); /* Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /room/roomToken @@ -121,7 +125,9 @@ public interface NcApi { */ @POST - Observable createRoom(@Header("Authorization") String authorization, @Url String url, @QueryMap Map options); + Observable createRoom(@Header("Authorization") String authorization, + @Url String url, + @QueryMap Map options); /* QueryMap items are as follows: @@ -132,12 +138,16 @@ public interface NcApi { @FormUrlEncoded @PUT - Observable renameRoom(@Header("Authorization") String authorization, @Url String url, @Field("roomName") String roomName); + Observable renameRoom(@Header("Authorization") String authorization, + @Url String url, + @Field("roomName") String roomName); @FormUrlEncoded @PUT - Observable setConversationDescription(@Header("Authorization") String authorization, @Url String url, @Field("description") String description); + Observable setConversationDescription(@Header("Authorization") String authorization, + @Url String url, + @Field("description") String description); /* QueryMap items are as follows: @@ -146,32 +156,48 @@ public interface NcApi { Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /room/roomToken/participants */ @POST - Observable addParticipant(@Header("Authorization") String authorization, @Url String url, @QueryMap Map options); + Observable addParticipant(@Header("Authorization") String authorization, + @Url String url, + @QueryMap Map options); @POST - Observable resendParticipantInvitations(@Header("Authorization") String authorization, @Url String url); + Observable resendParticipantInvitations(@Header("Authorization") String authorization, + @Url String url); // also used for removing a guest from a conversation @Deprecated @DELETE - Observable removeParticipantFromConversation(@Header("Authorization") String authorization, @Url String url, @Query("participant") String participantId); + Observable removeParticipantFromConversation(@Header("Authorization") String authorization, + @Url String url, + @Query("participant") String participantId); @DELETE - Observable removeAttendeeFromConversation(@Header("Authorization") String authorization, @Url String url, @Query("attendeeId") Long attendeeId); + Observable removeAttendeeFromConversation(@Header("Authorization") String authorization, + @Url String url, + @Query("attendeeId") Long attendeeId); @Deprecated @POST - Observable promoteUserToModerator(@Header("Authorization") String authorization, @Url String url, @Query("participant") String participantId); + Observable promoteUserToModerator(@Header("Authorization") String authorization, + @Url String url, + @Query("participant") String participantId); @Deprecated @DELETE - Observable demoteModeratorToUser(@Header("Authorization") String authorization, @Url String url, @Query("participant") String participantId); + Observable demoteModeratorToUser(@Header("Authorization") String authorization, + @Url String url, + @Query("participant") String participantId); @POST - Observable promoteAttendeeToModerator(@Header("Authorization") String authorization, @Url String url, @Query("attendeeId") Long attendeeId); + Observable promoteAttendeeToModerator(@Header("Authorization") String authorization, + @Url String url, + @Query("attendeeId") Long attendeeId); @DELETE - Observable demoteAttendeeFromModerator(@Header("Authorization") String authorization, @Url String url, @Query("attendeeId") Long attendeeId); + Observable demoteAttendeeFromModerator(@Header("Authorization") String authorization, + @Url String url, + @Query("attendeeId") Long attendeeId); /* Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /room/roomToken/participants/self @@ -202,11 +228,15 @@ public interface NcApi { Observable getPeersForCall(@Header("Authorization") String authorization, @Url String url); @GET - Observable getPeersForCall(@Header("Authorization") String authorization, @Url String url, @QueryMap Map fields); + Observable getPeersForCall(@Header("Authorization") String authorization, + @Url String url, + @QueryMap Map fields); @FormUrlEncoded @POST - Observable joinRoom(@Nullable @Header("Authorization") String authorization, @Url String url, @Nullable @Field("password") String password); + Observable joinRoom(@Nullable @Header("Authorization") String authorization, + @Url String url, + @Nullable @Field("password") String password); @DELETE Observable leaveRoom(@Nullable @Header("Authorization") String authorization, @Url String url); @@ -217,7 +247,11 @@ public interface NcApi { @FormUrlEncoded @POST - Observable joinCall(@Nullable @Header("Authorization") String authorization, @Url String url, @Field("flags") Integer inCall, @Field("silent") Boolean callWithoutNotification, @Nullable @Field("recordingConsent") Boolean recordingConsent); + Observable joinCall(@Nullable @Header("Authorization") String authorization, + @Url String url, + @Field("flags") Integer inCall, + @Field("silent") Boolean callWithoutNotification, + @Nullable @Field("recordingConsent") Boolean recordingConsent); /* Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /call/callToken @@ -226,7 +260,8 @@ public interface NcApi { Observable leaveCall(@Nullable @Header("Authorization") String authorization, @Url String url); @GET - Observable getSignalingSettings(@Nullable @Header("Authorization") String authorization, @Url String url); + Observable getSignalingSettings(@Nullable @Header("Authorization") String authorization, + @Url String url); /* QueryMap items are as follows: @@ -236,13 +271,16 @@ public interface NcApi { */ @FormUrlEncoded @POST - Observable sendSignalingMessages(@Nullable @Header("Authorization") String authorization, @Url String url, @Field("messages") String messages); + Observable sendSignalingMessages(@Nullable @Header("Authorization") String authorization, + @Url String url, + @Field("messages") String messages); /* Server URL is: baseUrl + ocsApiVersion + spreedApiVersion + /signaling */ @GET - Observable pullSignalingMessages(@Nullable @Header("Authorization") String authorization, @Url String url); + Observable pullSignalingMessages(@Nullable @Header("Authorization") String authorization, + @Url String url); /* QueryMap items are as follows: @@ -260,7 +298,11 @@ public interface NcApi { @FormUrlEncoded @PUT - Observable setUserData(@Header("Authorization") String authorization, @Url String url, @Field("key") String key, @Field("value") String value); + Observable setUserData(@Header("Authorization") String authorization, + @Url String url, + @Field("key") String key, + @Field("value") String value); + /* Server URL is: baseUrl + /status.php @@ -280,14 +322,21 @@ public interface NcApi { */ @POST - Observable registerDeviceForNotificationsWithNextcloud(@Header("Authorization") String authorization, @Url String url, @QueryMap Map options); + Observable registerDeviceForNotificationsWithNextcloud( + @Header("Authorization") String authorization, + @Url String url, + @QueryMap Map options); @DELETE - Observable unregisterDeviceForNotificationsWithNextcloud(@Header("Authorization") String authorization, @Url String url); + Observable unregisterDeviceForNotificationsWithNextcloud( + @Header("Authorization") String authorization, + @Url String url); @FormUrlEncoded @POST - Observable registerDeviceForNotificationsWithPushProxy(@Url String url, @FieldMap Map fields); + Observable registerDeviceForNotificationsWithPushProxy(@Url String url, + @FieldMap Map fields); + /* QueryMap items are as follows: @@ -296,15 +345,20 @@ public interface NcApi { - "userPublicKey": "{{userPublicKey}}" */ @DELETE - Observable unregisterDeviceForNotificationsWithProxy(@Url String url, @QueryMap Map fields); + Observable unregisterDeviceForNotificationsWithProxy(@Url String url, + @QueryMap Map fields); @FormUrlEncoded @PUT - Observable setPassword(@Header("Authorization") String authorization, @Url String url, @Field("password") String password); + Observable setPassword(@Header("Authorization") String authorization, + @Url String url, + @Field("password") String password); @FormUrlEncoded @PUT - Observable> setPassword2(@Header("Authorization") String authorization, @Url String url, @Field("password") String password); + Observable> setPassword2(@Header("Authorization") String authorization, + @Url String url, + @Field("password") String password); @GET Observable getCapabilities(@Header("Authorization") String authorization, @Url String url); @@ -320,7 +374,9 @@ public interface NcApi { - "lastKnownMessageId", int, use one from X-Chat-Last-Given */ @GET - Observable> pullChatMessages(@Header("Authorization") String authorization, @Url String url, @QueryMap Map fields); + Observable> pullChatMessages(@Header("Authorization") String authorization, + @Url String url, + @QueryMap Map fields); /* Fieldmap items are as follows: @@ -330,70 +386,113 @@ public interface NcApi { @FormUrlEncoded @POST - Observable sendChatMessage(@Header("Authorization") String authorization, @Url String url, @Field("message") CharSequence message, @Field("actorDisplayName") String actorDisplayName, @Field("replyTo") Integer replyTo, @Field("silent") Boolean sendWithoutNotification); + Observable sendChatMessage(@Header("Authorization") String authorization, + @Url String url, + @Field("message") CharSequence message, + @Field("actorDisplayName") String actorDisplayName, + @Field("replyTo") Integer replyTo, + @Field("silent") Boolean sendWithoutNotification); @FormUrlEncoded @PUT - Observable editChatMessage(@Header("Authorization") String authorization, @Url String url, @Field( - "message") String message); + Observable editChatMessage(@Header("Authorization") String authorization, + @Url String url, + @Field("message") String message); @GET - Observable> getSharedItems(@Header("Authorization") String authorization, @Url String url, @Query("objectType") String objectType, @Nullable @Query("lastKnownMessageId") Integer lastKnownMessageId, @Nullable @Query("limit") Integer limit); + Observable> getSharedItems( + @Header("Authorization") String authorization, + @Url String url, + @Query("objectType") String objectType, + @Nullable @Query("lastKnownMessageId") Integer lastKnownMessageId, + @Nullable @Query("limit") Integer limit); @GET - Observable> getSharedItemsOverview(@Header("Authorization") String authorization, @Url String url, @Nullable @Query("limit") Integer limit); + Observable> getSharedItemsOverview(@Header("Authorization") String authorization, + @Url String url, + @Nullable @Query("limit") Integer limit); @GET - Observable getMentionAutocompleteSuggestions(@Header("Authorization") String authorization, @Url String url, @Query("search") String query, @Nullable @Query("limit") Integer limit, @QueryMap Map fields); + Observable getMentionAutocompleteSuggestions(@Header("Authorization") String authorization, + @Url String url, + @Query("search") String query, + @Nullable @Query("limit") Integer limit, + @QueryMap Map fields); // Url is: /api/{apiVersion}/room/{token}/pin @POST - Observable addConversationToFavorites(@Header("Authorization") String authorization, @Url String url); + Observable addConversationToFavorites(@Header("Authorization") String authorization, + @Url String url); // Url is: /api/{apiVersion}/room/{token}/favorites @DELETE - Observable removeConversationFromFavorites(@Header("Authorization") String authorization, @Url String url); + Observable removeConversationFromFavorites(@Header("Authorization") String authorization, + @Url String url); @GET - Observable getNcNotification(@Header("Authorization") String authorization, @Url String url); + Observable getNcNotification(@Header("Authorization") String authorization, + @Url String url); @FormUrlEncoded @POST - Observable setNotificationLevel(@Header("Authorization") String authorization, @Url String url, @Field("level") int level); + Observable setNotificationLevel(@Header("Authorization") String authorization, + @Url String url, + @Field("level") int level); @FormUrlEncoded @PUT - Observable setReadOnlyState(@Header("Authorization") String authorization, @Url String url, @Field("state") int state); + Observable setReadOnlyState(@Header("Authorization") String authorization, + @Url String url, + @Field("state") int state); @FormUrlEncoded @POST - Observable createRemoteShare(@Nullable @Header("Authorization") String authorization, @Url String url, @Field("path") String remotePath, @Field("shareWith") String roomToken, @Field("shareType") String shareType, @Field("talkMetaData") String talkMetaData); + Observable createRemoteShare(@Nullable @Header("Authorization") String authorization, + @Url String url, + @Field("path") String remotePath, + @Field("shareWith") String roomToken, + @Field("shareType") String shareType, + @Field("talkMetaData") String talkMetaData); @FormUrlEncoded @PUT - Observable setLobbyForConversation(@Header("Authorization") String authorization, @Url String url, @Field("state") Integer state, @Field("timer") Long timer); + Observable setLobbyForConversation(@Header("Authorization") String authorization, + @Url String url, + @Field("state") Integer state, + @Field("timer") Long timer); @POST - Observable setReadStatusPrivacy(@Header("Authorization") String authorization, @Url String url, @Body RequestBody body); + Observable setReadStatusPrivacy(@Header("Authorization") String authorization, + @Url String url, + @Body RequestBody body); @POST - Observable setTypingStatusPrivacy(@Header("Authorization") String authorization, @Url String url, @Body RequestBody body); + Observable setTypingStatusPrivacy(@Header("Authorization") String authorization, + @Url String url, + @Body RequestBody body); @POST - Observable searchContactsByPhoneNumber(@Header("Authorization") String authorization, @Url String url, @Body RequestBody search); + Observable searchContactsByPhoneNumber(@Header("Authorization") String authorization, + @Url String url, + @Body RequestBody search); @PUT - Observable> uploadFile(@Header("Authorization") String authorization, @Url String url, @Body RequestBody body); + Observable> uploadFile(@Header("Authorization") String authorization, + @Url String url, + @Body RequestBody body); @HEAD - Observable> checkIfFileExists(@Header("Authorization") String authorization, @Url String url); + Observable> checkIfFileExists(@Header("Authorization") String authorization, + @Url String url); @GET - Call downloadFile(@Header("Authorization") String authorization, @Url String url); + Call downloadFile(@Header("Authorization") String authorization, + @Url String url); @DELETE - Observable deleteChatMessage(@Header("Authorization") String authorization, @Url String url); + Observable deleteChatMessage(@Header("Authorization") String authorization, + @Url String url); @DELETE Observable deleteAvatar(@Header("Authorization") String authorization, @Url String url); @@ -404,28 +503,40 @@ public interface NcApi { @Multipart @POST - Observable uploadAvatar(@Header("Authorization") String authorization, @Url String url, @Part MultipartBody.Part attachment); + Observable uploadAvatar(@Header("Authorization") String authorization, + @Url String url, + @Part MultipartBody.Part attachment); @Multipart @POST - Observable uploadConversationAvatar(@Header("Authorization") String authorization, @Url String url, @Part MultipartBody.Part attachment); + Observable uploadConversationAvatar(@Header("Authorization") String authorization, + @Url String url, + @Part MultipartBody.Part attachment); @GET - Observable getEditableUserProfileFields(@Header("Authorization") String authorization, @Url String url); + Observable getEditableUserProfileFields(@Header("Authorization") String authorization, + @Url String url); @GET - Call downloadResizedImage(@Header("Authorization") String authorization, @Url String url); + Call downloadResizedImage(@Header("Authorization") String authorization, + @Url String url); @FormUrlEncoded @POST - Observable sendLocation(@Header("Authorization") String authorization, @Url String url, @Field("objectType") String objectType, @Field("objectId") String objectId, @Field("metaData") String metaData); + Observable sendLocation(@Header("Authorization") String authorization, + @Url String url, + @Field("objectType") String objectType, + @Field("objectId") String objectId, + @Field("metaData") String metaData); @DELETE Observable clearChatHistory(@Header("Authorization") String authorization, @Url String url); @FormUrlEncoded @POST - Observable notificationCalls(@Header("Authorization") String authorization, @Url String url, @Field("level") Integer level); + Observable notificationCalls(@Header("Authorization") String authorization, + @Url String url, + @Field("level") Integer level); @GET Observable hoverCard(@Header("Authorization") String authorization, @Url String url); @@ -433,7 +544,9 @@ public interface NcApi { // Url is: /api/{apiVersion}/chat/{token}/read @FormUrlEncoded @POST - Observable setChatReadMarker(@Header("Authorization") String authorization, @Url String url, @Field("lastReadMessage") int lastReadMessage); + Observable setChatReadMarker(@Header("Authorization") String authorization, + @Url String url, + @Field("lastReadMessage") int lastReadMessage); // Url is: /api/{apiVersion}/chat/{token}/read @DELETE @@ -461,62 +574,100 @@ public interface NcApi { @FormUrlEncoded @PUT - Observable setPredefinedStatusMessage(@Header("Authorization") String authorization, @Url String url, @Field("messageId") String selectedPredefinedMessageId, @Field("clearAt") Long clearAt); + Observable setPredefinedStatusMessage(@Header("Authorization") String authorization, + @Url String url, + @Field("messageId") String selectedPredefinedMessageId, + @Field("clearAt") Long clearAt); @FormUrlEncoded @PUT - Observable setCustomStatusMessage(@Header("Authorization") String authorization, @Url String url, @Field("statusIcon") String statusIcon, @Field("message") String message, @Field("clearAt") Long clearAt); + Observable setCustomStatusMessage(@Header("Authorization") String authorization, + @Url String url, + @Field("statusIcon") String statusIcon, + @Field("message") String message, + @Field("clearAt") Long clearAt); @FormUrlEncoded @PUT - Observable setStatusType(@Header("Authorization") String authorization, @Url String url, @Field("statusType") String statusType); + Observable setStatusType(@Header("Authorization") String authorization, + @Url String url, + @Field("statusType") String statusType); @POST - Observable sendReaction(@Header("Authorization") String authorization, @Url String url, @Query("reaction") String reaction); + Observable sendReaction(@Header("Authorization") String authorization, + @Url String url, + @Query("reaction") String reaction); @DELETE - Observable deleteReaction(@Header("Authorization") String authorization, @Url String url, @Query("reaction") String reaction); + Observable deleteReaction(@Header("Authorization") String authorization, + @Url String url, + @Query("reaction") String reaction); @GET - Observable getReactions(@Header("Authorization") String authorization, @Url String url, @Query("reaction") String reaction); + Observable getReactions(@Header("Authorization") String authorization, + @Url String url, + @Query("reaction") String reaction); @GET - Observable performUnifiedSearch(@Header("Authorization") String authorization, @Url String url, @Query("term") String term, @Query("from") String fromUrl, @Query("limit") Integer limit, @Query("cursor") Integer cursor); + Observable performUnifiedSearch(@Header("Authorization") String authorization, + @Url String url, + @Query("term") String term, + @Query("from") String fromUrl, + @Query("limit") Integer limit, + @Query("cursor") Integer cursor); @GET - Observable getPoll(@Header("Authorization") String authorization, @Url String url); + Observable getPoll(@Header("Authorization") String authorization, + @Url String url); @FormUrlEncoded @POST - Observable createPoll(@Header("Authorization") String authorization, @Url String url, @Query("question") String question, @Field("options[]") List options, @Query("resultMode") Integer resultMode, @Query("maxVotes") Integer maxVotes); + Observable createPoll(@Header("Authorization") String authorization, + @Url String url, + @Query("question") String question, + @Field("options[]") List options, + @Query("resultMode") Integer resultMode, + @Query("maxVotes") Integer maxVotes); @FormUrlEncoded @POST - Observable votePoll(@Header("Authorization") String authorization, @Url String url, @Field("optionIds[]") List optionIds); + Observable votePoll(@Header("Authorization") String authorization, + @Url String url, + @Field("optionIds[]") List optionIds); @DELETE - Observable closePoll(@Header("Authorization") String authorization, @Url String url); + Observable closePoll(@Header("Authorization") String authorization, + @Url String url); @FormUrlEncoded @POST - Observable setMessageExpiration(@Header("Authorization") String authorization, @Url String url, @Field("seconds") Integer seconds); + Observable setMessageExpiration(@Header("Authorization") String authorization, + @Url String url, + @Field("seconds") Integer seconds); @GET - Observable getOpenGraph(@Header("Authorization") String authorization, @Url String url, @Query("reference") String urlToFindPreviewFor); + Observable getOpenGraph(@Header("Authorization") String authorization, + @Url String url, + @Query("reference") String urlToFindPreviewFor); @FormUrlEncoded @POST - Observable startRecording(@Header("Authorization") String authorization, @Url String url, @Field("status") Integer status); + Observable startRecording(@Header("Authorization") String authorization, + @Url String url, + @Field("status") Integer status); @DELETE - Observable stopRecording(@Header("Authorization") String authorization, @Url String url); + Observable stopRecording(@Header("Authorization") String authorization, + @Url String url); @POST - Observable requestAssistance(@Header("Authorization") String authorization, @Url String url); + Observable requestAssistance(@Header("Authorization") String authorization, + @Url String url); @DELETE - Observable withdrawRequestAssistance(@Header("Authorization") String authorization, @Url String url); + Observable withdrawRequestAssistance(@Header("Authorization") String authorization, + @Url String url); @POST Observable sendCommonPostRequest(@Header("Authorization") String authorization, @Url String url); @@ -526,22 +677,33 @@ public interface NcApi { @POST - Observable translateMessage(@Header("Authorization") String authorization, @Url String url, @Query("text") String text, @Query("toLanguage") String toLanguage, @Nullable @Query("fromLanguage") String fromLanguage); + Observable translateMessage(@Header("Authorization") String authorization, + @Url String url, + @Query("text") String text, + @Query("toLanguage") String toLanguage, + @Nullable @Query("fromLanguage") String fromLanguage); @GET - Observable getLanguages(@Header("Authorization") String authorization, @Url String url); + Observable getLanguages(@Header("Authorization") String authorization, + @Url String url); @GET - Observable getReminder(@Header("Authorization") String authorization, @Url String url); + Observable getReminder(@Header("Authorization") String authorization, + @Url String url); @DELETE - Observable deleteReminder(@Header("Authorization") String authorization, @Url String url); + Observable deleteReminder(@Header("Authorization") String authorization, + @Url String url); @FormUrlEncoded @POST - Observable setReminder(@Header("Authorization") String authorization, @Url String url, @Field("timestamp") int timestamp); + Observable setReminder(@Header("Authorization") String authorization, + @Url String url, + @Field("timestamp") int timestamp); @FormUrlEncoded @PUT - Observable setRecordingConsent(@Header("Authorization") String authorization, @Url String url, @Field("recordingConsent") int recordingConsent); -} + Observable setRecordingConsent(@Header("Authorization") String authorization, + @Url String url, + @Field("recordingConsent") int recordingConsent); +} \ No newline at end of file diff --git a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt index a0aa39709..aaa3c5c56 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt @@ -835,6 +835,7 @@ class ChatActivity : binding.messageInputView.recordAudioButton.visibility = View.GONE binding.messageInputView.editMessageButton.visibility = View.VISIBLE binding.editView.editMessageView.visibility = View.VISIBLE + binding.messageInputView.attachmentButton.visibility = View.GONE } if (sharedText.isNotEmpty()) { @@ -885,7 +886,8 @@ class ChatActivity : conversationUser?.baseUrl, roomToken, message?.id - ), editedMessageText + ), + editedMessageText )?.subscribeOn(Schedulers.io()) ?.observeOn(AndroidSchedulers.mainThread()) ?.subscribe(object : Observer { @@ -894,6 +896,29 @@ class ChatActivity : } override fun onNext(messageEdited: ChatOverallSingleMessage) { + when (messageEdited.ocs?.meta?.statusCode) { + HTTP_BAD_REQUEST -> { + Snackbar.make( + binding.root, + getString(R.string.edit_error_24_hours_old_message), + Snackbar.LENGTH_LONG + ).show() + } + HTTP_FORBIDDEN -> { + Snackbar.make( + binding.root, + getString(R.string.conversation_is_read_only), + Snackbar.LENGTH_LONG + ).show() + } + HTTP_NOT_FOUND -> { + Snackbar.make( + binding.root, + "Conversation not found", + Snackbar.LENGTH_LONG + ).show() + } + } message.message = messageEdited.ocs?.data?.parentMessage?.text adapter?.update(message) adapter?.notifyDataSetChanged() @@ -901,11 +926,9 @@ class ChatActivity : } override fun onError(e: Throwable) { - } override fun onComplete() { - } }) } @@ -915,6 +938,7 @@ class ChatActivity : editableBehaviorSubject.onNext(false) binding.messageInputView.inputEditText.setText("") binding.editView.editMessageView.visibility = GONE + binding.messageInputView.attachmentButton.visibility = View.VISIBLE } private fun themeMessageInputView() { @@ -988,7 +1012,7 @@ class ChatActivity : ) adapter?.setLoadMoreListener(this) - adapter?.setDateHeadersFormatter {format(it)} + adapter?.setDateHeadersFormatter { format(it) } adapter?.setOnMessageViewLongClickListener { view, message -> onMessageViewLongClick(view, message) } adapter?.registerViewClickListener( R.id.playPauseBtn @@ -1084,7 +1108,6 @@ class ChatActivity : R.layout.item_system_message, this ) - messageHolders.registerContentType( CONTENT_TYPE_UNREAD_NOTICE_MESSAGE, UnreadNoticeMessageViewHolder::class.java, @@ -4333,7 +4356,6 @@ class ChatActivity : } private fun showMicrophoneButton(show: Boolean) { - if (show && CapabilitiesUtilNew.hasSpreedFeatureCapability(conversationUser, "voice-message-sharing")) { Log.d(TAG, "Microphone shown") binding.messageInputView.messageSendButton.visibility = View.GONE diff --git a/app/src/main/java/com/nextcloud/talk/ui/MessageInput.kt b/app/src/main/java/com/nextcloud/talk/ui/MessageInput.kt index f42a657d5..18def2f05 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/MessageInput.kt +++ b/app/src/main/java/com/nextcloud/talk/ui/MessageInput.kt @@ -43,7 +43,7 @@ class MessageInput : MessageInput { lateinit var sendVoiceRecording: ImageView lateinit var micInputCloud: MicInputCloud lateinit var playPauseBtn: MaterialButton - lateinit var editMessageButton:ImageButton + lateinit var editMessageButton: ImageButton lateinit var seekBar: SeekBar constructor(context: Context?) : super(context) { diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt index af44b342e..ae5b54af2 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt +++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt @@ -108,7 +108,7 @@ class MessageActionsDialog( hasUserActorId(message) && currentConversation?.type != ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL ) - initMenuEditMessage(CapabilitiesUtilNew.hasSpreedFeatureCapability(user, "edit-messages")) + initMenuEditMessage(CapabilitiesUtilNew.hasSpreedFeatureCapability(user, "edit-messages") && !message.isDeleted) initMenuDeleteMessage(showMessageDeletionButton) initMenuForwardMessage( ChatMessage.MessageType.REGULAR_TEXT_MESSAGE == message.getCalculateMessageType() && diff --git a/app/src/main/res/drawable/ic_check_24.xml b/app/src/main/res/drawable/ic_check_24.xml index 2501e9fd9..fef2c90e2 100644 --- a/app/src/main/res/drawable/ic_check_24.xml +++ b/app/src/main/res/drawable/ic_check_24.xml @@ -1,5 +1,24 @@ - - + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 66980875e..1a27d9d5d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -794,4 +794,6 @@ How to translate with transifex: Conversation is read Only Edit Message Text (edited) + Conversation not found +