mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-09 13:59:48 +01:00
add reactions for previewMessageHolders
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
0b49f6fc65
commit
65fb284c6c
@ -56,16 +56,7 @@
|
|||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||||
<value>
|
<value>
|
||||||
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" static="false" />
|
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="PACKAGES_IMPORT_LAYOUT">
|
|
||||||
<value>
|
|
||||||
<package name="" alias="false" withSubpackages="true" />
|
|
||||||
<package name="java" alias="false" withSubpackages="true" />
|
|
||||||
<package name="javax" alias="false" withSubpackages="true" />
|
|
||||||
<package name="kotlin" alias="false" withSubpackages="true" />
|
|
||||||
<package name="" alias="true" withSubpackages="true" />
|
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
|
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
|
||||||
@ -212,8 +203,7 @@
|
|||||||
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
|
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
|
||||||
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||||
<indentOptions>
|
<indentOptions>
|
||||||
<option name="INDENT_SIZE" value="4" />
|
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
|
||||||
</indentOptions>
|
</indentOptions>
|
||||||
</codeStyleSettings>
|
</codeStyleSettings>
|
||||||
</code_scheme>
|
</code_scheme>
|
||||||
|
@ -27,6 +27,7 @@ import android.widget.ProgressBar;
|
|||||||
|
|
||||||
import com.facebook.drawee.view.SimpleDraweeView;
|
import com.facebook.drawee.view.SimpleDraweeView;
|
||||||
import com.nextcloud.talk.databinding.ItemCustomIncomingPreviewMessageBinding;
|
import com.nextcloud.talk.databinding.ItemCustomIncomingPreviewMessageBinding;
|
||||||
|
import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding;
|
||||||
|
|
||||||
import androidx.emoji.widget.EmojiTextView;
|
import androidx.emoji.widget.EmojiTextView;
|
||||||
|
|
||||||
@ -77,4 +78,7 @@ public class IncomingPreviewMessageViewHolder extends MagicPreviewMessageViewHol
|
|||||||
public ProgressBar getPreviewContactProgressBar() {
|
public ProgressBar getPreviewContactProgressBar() {
|
||||||
return binding.contactProgressBar;
|
return binding.contactProgressBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ReactionsInsideMessageBinding getReactionsBinding(){ return binding.reactions; }
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ import com.nextcloud.talk.application.NextcloudTalkApplication;
|
|||||||
import com.nextcloud.talk.components.filebrowser.models.BrowserFile;
|
import com.nextcloud.talk.components.filebrowser.models.BrowserFile;
|
||||||
import com.nextcloud.talk.components.filebrowser.models.DavResponse;
|
import com.nextcloud.talk.components.filebrowser.models.DavResponse;
|
||||||
import com.nextcloud.talk.components.filebrowser.webdav.ReadFilesystemOperation;
|
import com.nextcloud.talk.components.filebrowser.webdav.ReadFilesystemOperation;
|
||||||
|
import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding;
|
||||||
import com.nextcloud.talk.jobs.DownloadFileToCacheWorker;
|
import com.nextcloud.talk.jobs.DownloadFileToCacheWorker;
|
||||||
import com.nextcloud.talk.models.database.CapabilitiesUtil;
|
import com.nextcloud.talk.models.database.CapabilitiesUtil;
|
||||||
import com.nextcloud.talk.models.database.UserEntity;
|
import com.nextcloud.talk.models.database.UserEntity;
|
||||||
@ -111,8 +112,13 @@ public abstract class MagicPreviewMessageViewHolder extends MessageHolders.Incom
|
|||||||
|
|
||||||
ProgressBar progressBar;
|
ProgressBar progressBar;
|
||||||
|
|
||||||
|
ReactionsInsideMessageBinding reactionsBinding;
|
||||||
|
|
||||||
View clickView;
|
View clickView;
|
||||||
|
|
||||||
|
ReactionsInterface reactionsInterface;
|
||||||
|
PreviewMessageInterface previewMessageInterface;
|
||||||
|
|
||||||
public MagicPreviewMessageViewHolder(View itemView, Object payload) {
|
public MagicPreviewMessageViewHolder(View itemView, Object payload) {
|
||||||
super(itemView, payload);
|
super(itemView, payload);
|
||||||
NextcloudTalkApplication.Companion.getSharedApplication().getComponentApplication().inject(this);
|
NextcloudTalkApplication.Companion.getSharedApplication().getComponentApplication().inject(this);
|
||||||
@ -185,25 +191,30 @@ public abstract class MagicPreviewMessageViewHolder extends MessageHolders.Incom
|
|||||||
fetchFileInformation("/" + message.getSelectedIndividualHashMap().get(KEY_PATH), message.activeUser);
|
fetchFileInformation("/" + message.getSelectedIndividualHashMap().get(KEY_PATH), message.activeUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
String accountString =
|
if(message.activeUser != null && message.activeUser.getUsername() != null && message.activeUser.getBaseUrl() != null){
|
||||||
|
String accountString =
|
||||||
message.activeUser.getUsername() + "@" +
|
message.activeUser.getUsername() + "@" +
|
||||||
message.activeUser.getBaseUrl()
|
message.activeUser.getBaseUrl()
|
||||||
.replace("https://", "")
|
.replace("https://", "")
|
||||||
.replace("http://", "");
|
.replace("http://", "");
|
||||||
|
|
||||||
clickView.setOnClickListener(v -> {
|
clickView.setOnClickListener(v -> {
|
||||||
String mimetype = message.getSelectedIndividualHashMap().get(KEY_MIMETYPE);
|
String mimetype = message.getSelectedIndividualHashMap().get(KEY_MIMETYPE);
|
||||||
if (isSupportedForInternalViewer(mimetype) || canBeHandledByExternalApp(mimetype, fileName)) {
|
if (isSupportedForInternalViewer(mimetype) || canBeHandledByExternalApp(mimetype, fileName)) {
|
||||||
openOrDownloadFile(message);
|
openOrDownloadFile(message);
|
||||||
} else {
|
} else {
|
||||||
openFileInFilesApp(message, accountString);
|
openFileInFilesApp(message, accountString);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
clickView.setOnLongClickListener(l -> {
|
||||||
|
onMessageViewLongClick(message, accountString);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "failed to set click listener because activeUser, username or baseUrl were null");
|
||||||
|
}
|
||||||
|
|
||||||
clickView.setOnLongClickListener(l -> {
|
|
||||||
onMessageViewLongClick(message, accountString);
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
// check if download worker is already running
|
// check if download worker is already running
|
||||||
String fileId = message.getSelectedIndividualHashMap().get(KEY_ID);
|
String fileId = message.getSelectedIndividualHashMap().get(KEY_ID);
|
||||||
@ -246,8 +257,14 @@ public abstract class MagicPreviewMessageViewHolder extends MessageHolders.Incom
|
|||||||
}
|
}
|
||||||
|
|
||||||
itemView.setTag(REPLYABLE_VIEW_TAG, message.isReplyable());
|
itemView.setTag(REPLYABLE_VIEW_TAG, message.isReplyable());
|
||||||
}
|
|
||||||
|
|
||||||
|
reactionsBinding = getReactionsBinding();
|
||||||
|
new Reaction().showReactions(message, reactionsBinding, context);
|
||||||
|
|
||||||
|
reactionsBinding.reactionsEmojiWrapper.setOnClickListener(l -> {
|
||||||
|
reactionsInterface.onClickReactions(message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private Drawable getDrawableFromContactDetails(Context context, String base64) {
|
private Drawable getDrawableFromContactDetails(Context context, String base64) {
|
||||||
Drawable drawable = null;
|
Drawable drawable = null;
|
||||||
@ -283,6 +300,8 @@ public abstract class MagicPreviewMessageViewHolder extends MessageHolders.Incom
|
|||||||
|
|
||||||
public abstract ProgressBar getPreviewContactProgressBar();
|
public abstract ProgressBar getPreviewContactProgressBar();
|
||||||
|
|
||||||
|
public abstract ReactionsInsideMessageBinding getReactionsBinding();
|
||||||
|
|
||||||
private void openOrDownloadFile(ChatMessage message) {
|
private void openOrDownloadFile(ChatMessage message) {
|
||||||
String filename = message.getSelectedIndividualHashMap().get(KEY_NAME);
|
String filename = message.getSelectedIndividualHashMap().get(KEY_NAME);
|
||||||
String mimetype = message.getSelectedIndividualHashMap().get(KEY_MIMETYPE);
|
String mimetype = message.getSelectedIndividualHashMap().get(KEY_MIMETYPE);
|
||||||
@ -410,6 +429,7 @@ public abstract class MagicPreviewMessageViewHolder extends MessageHolders.Incom
|
|||||||
|
|
||||||
private void onMessageViewLongClick(ChatMessage message, String accountString) {
|
private void onMessageViewLongClick(ChatMessage message, String accountString) {
|
||||||
if (isSupportedForInternalViewer(message.getSelectedIndividualHashMap().get(KEY_MIMETYPE))) {
|
if (isSupportedForInternalViewer(message.getSelectedIndividualHashMap().get(KEY_MIMETYPE))) {
|
||||||
|
previewMessageInterface.onPreviewMessageLongClick(message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,4 +611,12 @@ public abstract class MagicPreviewMessageViewHolder extends MessageHolders.Incom
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void assignReactionInterface(ReactionsInterface reactionsInterface) {
|
||||||
|
this.reactionsInterface = reactionsInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assignPreviewMessageInterface(PreviewMessageInterface previewMessageInterface) {
|
||||||
|
this.previewMessageInterface = previewMessageInterface;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import android.widget.ProgressBar;
|
|||||||
|
|
||||||
import com.facebook.drawee.view.SimpleDraweeView;
|
import com.facebook.drawee.view.SimpleDraweeView;
|
||||||
import com.nextcloud.talk.databinding.ItemCustomOutcomingPreviewMessageBinding;
|
import com.nextcloud.talk.databinding.ItemCustomOutcomingPreviewMessageBinding;
|
||||||
|
import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding;
|
||||||
|
|
||||||
import androidx.emoji.widget.EmojiTextView;
|
import androidx.emoji.widget.EmojiTextView;
|
||||||
|
|
||||||
@ -77,4 +78,7 @@ public class OutcomingPreviewMessageViewHolder extends MagicPreviewMessageViewHo
|
|||||||
public ProgressBar getPreviewContactProgressBar() {
|
public ProgressBar getPreviewContactProgressBar() {
|
||||||
return binding.contactProgressBar;
|
return binding.contactProgressBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ReactionsInsideMessageBinding getReactionsBinding() { return binding.reactions; }
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.nextcloud.talk.adapters.messages
|
||||||
|
|
||||||
|
import com.nextcloud.talk.models.json.chat.ChatMessage
|
||||||
|
|
||||||
|
interface PreviewMessageInterface {
|
||||||
|
fun onPreviewMessageLongClick(chatMessage: ChatMessage)
|
||||||
|
}
|
@ -59,6 +59,9 @@ public class TalkMessagesListAdapter<M extends IMessage> extends MessagesListAda
|
|||||||
} else if (holder instanceof OutcomingVoiceMessageViewHolder) {
|
} else if (holder instanceof OutcomingVoiceMessageViewHolder) {
|
||||||
((OutcomingVoiceMessageViewHolder) holder).assignVoiceMessageInterface(chatController);
|
((OutcomingVoiceMessageViewHolder) holder).assignVoiceMessageInterface(chatController);
|
||||||
((OutcomingVoiceMessageViewHolder) holder).assignReactionInterface(chatController);
|
((OutcomingVoiceMessageViewHolder) holder).assignReactionInterface(chatController);
|
||||||
|
} else if (holder instanceof MagicPreviewMessageViewHolder) {
|
||||||
|
((MagicPreviewMessageViewHolder) holder).assignPreviewMessageInterface(chatController);
|
||||||
|
((MagicPreviewMessageViewHolder) holder).assignReactionInterface(chatController);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,6 +110,7 @@ import com.nextcloud.talk.adapters.messages.MagicUnreadNoticeMessageViewHolder
|
|||||||
import com.nextcloud.talk.adapters.messages.OutcomingLocationMessageViewHolder
|
import com.nextcloud.talk.adapters.messages.OutcomingLocationMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.OutcomingPreviewMessageViewHolder
|
import com.nextcloud.talk.adapters.messages.OutcomingPreviewMessageViewHolder
|
||||||
import com.nextcloud.talk.adapters.messages.OutcomingVoiceMessageViewHolder
|
import com.nextcloud.talk.adapters.messages.OutcomingVoiceMessageViewHolder
|
||||||
|
import com.nextcloud.talk.adapters.messages.PreviewMessageInterface
|
||||||
import com.nextcloud.talk.adapters.messages.ReactionsInterface
|
import com.nextcloud.talk.adapters.messages.ReactionsInterface
|
||||||
import com.nextcloud.talk.adapters.messages.TalkMessagesListAdapter
|
import com.nextcloud.talk.adapters.messages.TalkMessagesListAdapter
|
||||||
import com.nextcloud.talk.adapters.messages.VoiceMessageInterface
|
import com.nextcloud.talk.adapters.messages.VoiceMessageInterface
|
||||||
@ -206,7 +207,8 @@ class ChatController(args: Bundle) :
|
|||||||
MessagesListAdapter.OnMessageViewLongClickListener<IMessage>,
|
MessagesListAdapter.OnMessageViewLongClickListener<IMessage>,
|
||||||
ContentChecker<ChatMessage>,
|
ContentChecker<ChatMessage>,
|
||||||
VoiceMessageInterface,
|
VoiceMessageInterface,
|
||||||
ReactionsInterface {
|
ReactionsInterface,
|
||||||
|
PreviewMessageInterface {
|
||||||
|
|
||||||
private val binding: ControllerChatBinding by viewBinding(ControllerChatBinding::bind)
|
private val binding: ControllerChatBinding by viewBinding(ControllerChatBinding::bind)
|
||||||
|
|
||||||
@ -2431,6 +2433,14 @@ class ChatController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onMessageViewLongClick(view: View?, message: IMessage?) {
|
override fun onMessageViewLongClick(view: View?, message: IMessage?) {
|
||||||
|
openMessageActionsDialog(message)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPreviewMessageLongClick(chatMessage: ChatMessage) {
|
||||||
|
openMessageActionsDialog(chatMessage)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun openMessageActionsDialog(message: IMessage?) {
|
||||||
if (hasVisibleItems(message as ChatMessage)) {
|
if (hasVisibleItems(message as ChatMessage)) {
|
||||||
activity?.let {
|
activity?.let {
|
||||||
MessageActionsDialog(
|
MessageActionsDialog(
|
||||||
@ -2717,6 +2727,7 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
messageTemp.isOneToOneConversation =
|
messageTemp.isOneToOneConversation =
|
||||||
currentConversation?.type == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
|
currentConversation?.type == Conversation.ConversationType.ROOM_TYPE_ONE_TO_ONE_CALL
|
||||||
|
messageTemp.activeUser = conversationUser
|
||||||
|
|
||||||
adapter?.update(messageTemp)
|
adapter?.update(messageTemp)
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
package com.nextcloud.talk.models.json.chat;
|
package com.nextcloud.talk.models.json.chat;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonField;
|
import com.bluelinelabs.logansquare.annotation.JsonField;
|
||||||
import com.bluelinelabs.logansquare.annotation.JsonIgnore;
|
import com.bluelinelabs.logansquare.annotation.JsonIgnore;
|
||||||
@ -50,6 +51,8 @@ import kotlin.text.Charsets;
|
|||||||
@Parcel
|
@Parcel
|
||||||
@JsonObject
|
@JsonObject
|
||||||
public class ChatMessage implements MessageContentType, MessageContentType.Image {
|
public class ChatMessage implements MessageContentType, MessageContentType.Image {
|
||||||
|
private static String TAG = "ChatMessage";
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public boolean isGrouped;
|
public boolean isGrouped;
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@ -102,21 +105,21 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image
|
|||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
List<MessageType> messageTypesToIgnore = Arrays.asList(
|
List<MessageType> messageTypesToIgnore = Arrays.asList(
|
||||||
MessageType.REGULAR_TEXT_MESSAGE,
|
MessageType.REGULAR_TEXT_MESSAGE,
|
||||||
MessageType.SYSTEM_MESSAGE,
|
MessageType.SYSTEM_MESSAGE,
|
||||||
MessageType.SINGLE_LINK_VIDEO_MESSAGE,
|
MessageType.SINGLE_LINK_VIDEO_MESSAGE,
|
||||||
MessageType.SINGLE_LINK_AUDIO_MESSAGE,
|
MessageType.SINGLE_LINK_AUDIO_MESSAGE,
|
||||||
MessageType.SINGLE_LINK_MESSAGE,
|
MessageType.SINGLE_LINK_MESSAGE,
|
||||||
MessageType.SINGLE_NC_GEOLOCATION_MESSAGE,
|
MessageType.SINGLE_NC_GEOLOCATION_MESSAGE,
|
||||||
MessageType.VOICE_MESSAGE);
|
MessageType.VOICE_MESSAGE);
|
||||||
|
|
||||||
public boolean hasFileAttachment() {
|
public boolean hasFileAttachment() {
|
||||||
if (messageParameters != null && messageParameters.size() > 0) {
|
if (messageParameters != null && messageParameters.size() > 0) {
|
||||||
for (HashMap.Entry<String, HashMap<String, String>> entry : messageParameters.entrySet()) {
|
for (HashMap.Entry<String, HashMap<String, String>> entry : messageParameters.entrySet()) {
|
||||||
Map<String, String> individualHashMap = entry.getValue();
|
Map<String, String> individualHashMap = entry.getValue();
|
||||||
if(MessageDigest.isEqual(
|
if (MessageDigest.isEqual(
|
||||||
Objects.requireNonNull(individualHashMap.get("type")).getBytes(Charsets.UTF_8),
|
Objects.requireNonNull(individualHashMap.get("type")).getBytes(Charsets.UTF_8),
|
||||||
("file").getBytes(Charsets.UTF_8))) {
|
("file").getBytes(Charsets.UTF_8))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,9 +132,9 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image
|
|||||||
for (HashMap.Entry<String, HashMap<String, String>> entry : messageParameters.entrySet()) {
|
for (HashMap.Entry<String, HashMap<String, String>> entry : messageParameters.entrySet()) {
|
||||||
Map<String, String> individualHashMap = entry.getValue();
|
Map<String, String> individualHashMap = entry.getValue();
|
||||||
|
|
||||||
if(MessageDigest.isEqual(
|
if (MessageDigest.isEqual(
|
||||||
Objects.requireNonNull(individualHashMap.get("type")).getBytes(Charsets.UTF_8),
|
Objects.requireNonNull(individualHashMap.get("type")).getBytes(Charsets.UTF_8),
|
||||||
("geo-location").getBytes(Charsets.UTF_8))) {
|
("geo-location").getBytes(Charsets.UTF_8))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -146,13 +149,20 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image
|
|||||||
if (messageParameters != null && messageParameters.size() > 0) {
|
if (messageParameters != null && messageParameters.size() > 0) {
|
||||||
for (HashMap.Entry<String, HashMap<String, String>> entry : messageParameters.entrySet()) {
|
for (HashMap.Entry<String, HashMap<String, String>> entry : messageParameters.entrySet()) {
|
||||||
Map<String, String> individualHashMap = entry.getValue();
|
Map<String, String> individualHashMap = entry.getValue();
|
||||||
if(MessageDigest.isEqual(
|
if (MessageDigest.isEqual(
|
||||||
Objects.requireNonNull(individualHashMap.get("type")).getBytes(Charsets.UTF_8),
|
Objects.requireNonNull(individualHashMap.get("type")).getBytes(Charsets.UTF_8),
|
||||||
("file").getBytes(Charsets.UTF_8))) {
|
("file").getBytes(Charsets.UTF_8))) {
|
||||||
selectedIndividualHashMap = individualHashMap;
|
selectedIndividualHashMap = individualHashMap;
|
||||||
if(!isVoiceMessage()){
|
if (!isVoiceMessage()) {
|
||||||
return (ApiUtils.getUrlForFilePreviewWithFileId(getActiveUser().getBaseUrl(),
|
if (getActiveUser() != null && getActiveUser().getBaseUrl() != null) {
|
||||||
individualHashMap.get("id"), NextcloudTalkApplication.Companion.getSharedApplication().getResources().getDimensionPixelSize(R.dimen.maximum_file_preview_size)));
|
return (ApiUtils.getUrlForFilePreviewWithFileId(
|
||||||
|
getActiveUser().getBaseUrl(),
|
||||||
|
individualHashMap.get("id"),
|
||||||
|
NextcloudTalkApplication.Companion.getSharedApplication().getResources().getDimensionPixelSize(R.dimen.maximum_file_preview_size)));
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "getActiveUser() or getActiveUser().getBaseUrl() were null when trying to " +
|
||||||
|
"getImageUrl()");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -170,7 +180,7 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image
|
|||||||
return MessageType.SYSTEM_MESSAGE;
|
return MessageType.SYSTEM_MESSAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isVoiceMessage()){
|
if (isVoiceMessage()) {
|
||||||
return MessageType.VOICE_MESSAGE;
|
return MessageType.VOICE_MESSAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,20 +219,20 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image
|
|||||||
return getText();
|
return getText();
|
||||||
} else {
|
} else {
|
||||||
if (MessageType.SINGLE_LINK_GIPHY_MESSAGE == getMessageType()
|
if (MessageType.SINGLE_LINK_GIPHY_MESSAGE == getMessageType()
|
||||||
|| MessageType.SINGLE_LINK_TENOR_MESSAGE == getMessageType()
|
|| MessageType.SINGLE_LINK_TENOR_MESSAGE == getMessageType()
|
||||||
|| MessageType.SINGLE_LINK_GIF_MESSAGE == getMessageType()) {
|
|| MessageType.SINGLE_LINK_GIF_MESSAGE == getMessageType()) {
|
||||||
if (getActorId().equals(getActiveUser().getUserId())) {
|
if (getActorId().equals(getActiveUser().getUserId())) {
|
||||||
return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_a_gif_you));
|
return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_a_gif_you));
|
||||||
} else {
|
} else {
|
||||||
return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_a_gif),
|
return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_a_gif),
|
||||||
!TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest)));
|
!TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest)));
|
||||||
}
|
}
|
||||||
} else if (MessageType.SINGLE_NC_ATTACHMENT_MESSAGE == getMessageType()) {
|
} else if (MessageType.SINGLE_NC_ATTACHMENT_MESSAGE == getMessageType()) {
|
||||||
if (getActorId().equals(getActiveUser().getUserId())) {
|
if (getActorId().equals(getActiveUser().getUserId())) {
|
||||||
return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_an_attachment_you));
|
return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_an_attachment_you));
|
||||||
} else {
|
} else {
|
||||||
return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_an_attachment),
|
return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_an_attachment),
|
||||||
!TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest)));
|
!TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest)));
|
||||||
}
|
}
|
||||||
} else if (MessageType.SINGLE_NC_GEOLOCATION_MESSAGE == getMessageType()) {
|
} else if (MessageType.SINGLE_NC_GEOLOCATION_MESSAGE == getMessageType()) {
|
||||||
if (getActorId().equals(getActiveUser().getUserId())) {
|
if (getActorId().equals(getActiveUser().getUserId())) {
|
||||||
@ -250,21 +260,21 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image
|
|||||||
return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_an_audio_you));
|
return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_an_audio_you));
|
||||||
} else {
|
} else {
|
||||||
return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_an_audio),
|
return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_an_audio),
|
||||||
!TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest)));
|
!TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest)));
|
||||||
}
|
}
|
||||||
} else if (MessageType.SINGLE_LINK_VIDEO_MESSAGE == getMessageType()) {
|
} else if (MessageType.SINGLE_LINK_VIDEO_MESSAGE == getMessageType()) {
|
||||||
if (getActorId().equals(getActiveUser().getUserId())) {
|
if (getActorId().equals(getActiveUser().getUserId())) {
|
||||||
return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_a_video_you));
|
return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_a_video_you));
|
||||||
} else {
|
} else {
|
||||||
return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_a_video),
|
return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_a_video),
|
||||||
!TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest)));
|
!TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest)));
|
||||||
}
|
}
|
||||||
} else if (MessageType.SINGLE_LINK_IMAGE_MESSAGE == getMessageType()) {
|
} else if (MessageType.SINGLE_LINK_IMAGE_MESSAGE == getMessageType()) {
|
||||||
if (getActorId().equals(getActiveUser().getUserId())) {
|
if (getActorId().equals(getActiveUser().getUserId())) {
|
||||||
return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_an_image_you));
|
return (NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_sent_an_image_you));
|
||||||
} else {
|
} else {
|
||||||
return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_an_image),
|
return (String.format(NextcloudTalkApplication.Companion.getSharedApplication().getResources().getString(R.string.nc_sent_an_image),
|
||||||
!TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest)));
|
!TextUtils.isEmpty(getActorDisplayName()) ? getActorDisplayName() : NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -300,7 +310,7 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image
|
|||||||
true);
|
true);
|
||||||
} else {
|
} else {
|
||||||
String apiId =
|
String apiId =
|
||||||
NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest);
|
NextcloudTalkApplication.Companion.getSharedApplication().getString(R.string.nc_guest);
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(getActorDisplayName())) {
|
if (!TextUtils.isEmpty(getActorDisplayName())) {
|
||||||
apiId = getActorDisplayName();
|
apiId = getActorDisplayName();
|
||||||
@ -596,7 +606,7 @@ public class ChatMessage implements MessageContentType, MessageContentType.Image
|
|||||||
return "ChatMessage(isGrouped=" + this.isGrouped() + ", isOneToOneConversation=" + this.isOneToOneConversation() + ", activeUser=" + this.getActiveUser() + ", selectedIndividualHashMap=" + this.getSelectedIndividualHashMap() + ", isDeleted=" + this.isDeleted() + ", jsonMessageId=" + this.getJsonMessageId() + ", token=" + this.getToken() + ", actorType=" + this.getActorType() + ", actorId=" + this.getActorId() + ", actorDisplayName=" + this.getActorDisplayName() + ", timestamp=" + this.getTimestamp() + ", message=" + this.getMessage() + ", messageParameters=" + this.getMessageParameters() + ", systemMessageType=" + this.getSystemMessageType() + ", replyable=" + this.isReplyable() + ", parentMessage=" + this.getParentMessage() + ", readStatus=" + this.getReadStatus() + ", messageTypesToIgnore=" + this.getMessageTypesToIgnore() + ")";
|
return "ChatMessage(isGrouped=" + this.isGrouped() + ", isOneToOneConversation=" + this.isOneToOneConversation() + ", activeUser=" + this.getActiveUser() + ", selectedIndividualHashMap=" + this.getSelectedIndividualHashMap() + ", isDeleted=" + this.isDeleted() + ", jsonMessageId=" + this.getJsonMessageId() + ", token=" + this.getToken() + ", actorType=" + this.getActorType() + ", actorId=" + this.getActorId() + ", actorDisplayName=" + this.getActorDisplayName() + ", timestamp=" + this.getTimestamp() + ", message=" + this.getMessage() + ", messageParameters=" + this.getMessageParameters() + ", systemMessageType=" + this.getSystemMessageType() + ", replyable=" + this.isReplyable() + ", parentMessage=" + this.getParentMessage() + ", readStatus=" + this.getReadStatus() + ", messageTypesToIgnore=" + this.getMessageTypesToIgnore() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVoiceMessage(){
|
public boolean isVoiceMessage() {
|
||||||
return "voice-message".equals(messageType);
|
return "voice-message".equals(messageType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,6 +173,10 @@
|
|||||||
android:textColor="@color/warm_grey_four"
|
android:textColor="@color/warm_grey_four"
|
||||||
app:layout_alignSelf="center"
|
app:layout_alignSelf="center"
|
||||||
tools:text="12:38" />
|
tools:text="12:38" />
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/reactions"
|
||||||
|
layout="@layout/reactions_inside_message" />
|
||||||
</com.google.android.flexbox.FlexboxLayout>
|
</com.google.android.flexbox.FlexboxLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
@ -163,6 +163,10 @@
|
|||||||
android:textColor="@color/warm_grey_four"
|
android:textColor="@color/warm_grey_four"
|
||||||
app:layout_alignSelf="center"
|
app:layout_alignSelf="center"
|
||||||
tools:text="12:34" />
|
tools:text="12:34" />
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/reactions"
|
||||||
|
layout="@layout/reactions_inside_message" />
|
||||||
</com.google.android.flexbox.FlexboxLayout>
|
</com.google.android.flexbox.FlexboxLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user