diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingPreviewMessageViewHolder.java b/app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingPreviewMessageViewHolder.java index b388ec90036..d9a83cb0c8b 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingPreviewMessageViewHolder.java +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingPreviewMessageViewHolder.java @@ -38,6 +38,7 @@ import com.nextcloud.talk.utils.TextMatchers; import java.util.HashMap; +import java.util.Objects; import androidx.annotation.NonNull; import androidx.core.content.ContextCompat; @@ -55,7 +56,7 @@ public IncomingPreviewMessageViewHolder(View itemView, Object payload) { public void onBind(@NonNull ChatMessage message) { super.onBind(message); if(!message.isVoiceMessage() - && !binding.messageCaption.getText().toString().equals("{file}") + && !Objects.equals(message.getMessage(), "{file}") ) { Spanned processedMessageText = null; if (viewThemeUtils != null ) { @@ -87,12 +88,14 @@ public void onBind(@NonNull ChatMessage message) { textSize = (float) (textSize * IncomingTextMessageViewHolder.TEXT_SIZE_MULTIPLIER); itemView.setSelected(true); } + binding.messageCaption.setVisibility(View.VISIBLE); binding.messageCaption.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); binding.messageCaption.setText(processedMessageText); binding.incomingPreviewMessageBubble.setBackgroundResource(R.drawable.shape_grouped_incoming_message); viewThemeUtils.talk.themeIncomingMessageBubble(binding.incomingPreviewMessageBubble, true, false); } else { binding.incomingPreviewMessageBubble.setBackground(null); + binding.messageCaption.setVisibility(View.GONE); } binding.messageAuthor.setText(message.getActorDisplayName()); binding.messageText.setTextColor(ContextCompat.getColor(binding.messageText.getContext(), diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingPreviewMessageViewHolder.java b/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingPreviewMessageViewHolder.java index 55b7acfb7c9..690104db226 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingPreviewMessageViewHolder.java +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingPreviewMessageViewHolder.java @@ -36,6 +36,7 @@ import com.nextcloud.talk.utils.TextMatchers; import java.util.HashMap; +import java.util.Objects; import androidx.annotation.NonNull; import androidx.core.content.ContextCompat; @@ -54,7 +55,7 @@ public OutcomingPreviewMessageViewHolder(View itemView) { public void onBind(@NonNull ChatMessage message) { super.onBind(message); if(!message.isVoiceMessage() - && !binding.messageCaption.getText().toString().equals("{file}") + && !Objects.equals(message.getMessage(), "{file}") ) { Spanned processedMessageText = null; if (viewThemeUtils != null) { @@ -86,12 +87,14 @@ public void onBind(@NonNull ChatMessage message) { textSize = (float)(textSize * IncomingTextMessageViewHolder.TEXT_SIZE_MULTIPLIER); itemView.setSelected(true); } + binding.messageCaption.setVisibility(View.VISIBLE); binding.messageCaption.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); binding.messageCaption.setText(processedMessageText); binding.outgoingPreviewMessageBubble.setBackgroundResource(R.drawable.shape_grouped_outcoming_message); viewThemeUtils.talk.themeOutgoingMessageBubble(binding.outgoingPreviewMessageBubble, true, false); } else { binding.outgoingPreviewMessageBubble.setBackground(null); + binding.messageCaption.setVisibility(View.GONE); } binding.messageText.setTextColor(ContextCompat.getColor(binding.messageText.getContext(), diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt index 51d80f24077..9f72102af3a 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt @@ -120,11 +120,6 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) : fileViewerUtils = FileViewerUtils(context!!, message.activeUser!!) val fileName = message.selectedIndividualHashMap!![KEY_NAME] - messageCaption.visibility = if (message.message != "{file}") { - View.VISIBLE - } else { - View.GONE - } messageText.text = fileName if (message.activeUser != null && diff --git a/app/src/main/res/layout/item_custom_incoming_preview_message.xml b/app/src/main/res/layout/item_custom_incoming_preview_message.xml index 6a03de2a5ec..76f5af9c98d 100644 --- a/app/src/main/res/layout/item_custom_incoming_preview_message.xml +++ b/app/src/main/res/layout/item_custom_incoming_preview_message.xml @@ -162,6 +162,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="2dp" + android:paddingHorizontal="@dimen/standard_half_padding" android:alpha="0.6" android:autoLink="none" android:textAlignment="viewStart" @@ -179,6 +180,7 @@ android:id="@id/messageTime" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:paddingHorizontal="@dimen/standard_half_padding" android:layout_alignParentEnd="true" android:layout_marginStart="8dp" android:layout_marginEnd="2dp" diff --git a/app/src/main/res/layout/item_custom_outcoming_preview_message.xml b/app/src/main/res/layout/item_custom_outcoming_preview_message.xml index 4b6dd2798a2..1380a2dfbb7 100644 --- a/app/src/main/res/layout/item_custom_outcoming_preview_message.xml +++ b/app/src/main/res/layout/item_custom_outcoming_preview_message.xml @@ -139,7 +139,7 @@ android:id="@id/messageText" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="2dp" + android:paddingHorizontal="@dimen/standard_half_padding" android:alpha="0.6" android:autoLink="none" android:textColor="@color/no_emphasis_text" @@ -156,6 +156,7 @@ android:id="@id/messageTime" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:paddingHorizontal="@dimen/standard_half_padding" android:layout_alignParentEnd="true" android:layout_marginStart="8dp" android:layout_marginEnd="2dp"