瀏覽代碼

Bug fix of issue 2780
Signed-off-by: Julius Linus julius.linus@nextcloud.com

rapterjet2004 1 年之前
父節點
當前提交
8158eebb4f

+ 8 - 1
app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingPreviewMessageViewHolder.java

@@ -34,6 +34,7 @@ import com.nextcloud.talk.databinding.ItemCustomIncomingPreviewMessageBinding;
 import com.nextcloud.talk.databinding.ReactionsInsideMessageBinding;
 import com.nextcloud.talk.models.json.chat.ChatMessage;
 
+import androidx.annotation.NonNull;
 import androidx.core.content.ContextCompat;
 import androidx.emoji2.widget.EmojiTextView;
 
@@ -46,15 +47,17 @@ public class IncomingPreviewMessageViewHolder extends PreviewMessageViewHolder {
     }
 
     @Override
-    public void onBind(ChatMessage message) {
+    public void onBind(@NonNull ChatMessage message) {
         super.onBind(message);
 
+        binding.messageAuthor.setText(message.getActorDisplayName());
         binding.messageText.setTextColor(ContextCompat.getColor(binding.messageText.getContext(),
                                                                 R.color.no_emphasis_text));
         binding.messageTime.setTextColor(ContextCompat.getColor(binding.messageText.getContext(),
                                                                 R.color.no_emphasis_text));
     }
 
+    @NonNull
     @Override
     public EmojiTextView getMessageText() {
         return binding.messageText;
@@ -65,21 +68,25 @@ public class IncomingPreviewMessageViewHolder extends PreviewMessageViewHolder {
         return binding.progressBar;
     }
 
+    @NonNull
     @Override
     public View getPreviewContainer() {
         return binding.previewContainer;
     }
 
+    @NonNull
     @Override
     public MaterialCardView getPreviewContactContainer() {
         return binding.contactContainer;
     }
 
+    @NonNull
     @Override
     public ImageView getPreviewContactPhoto() {
         return binding.contactPhoto;
     }
 
+    @NonNull
     @Override
     public EmojiTextView getPreviewContactName() {
         return binding.contactName;

+ 15 - 0
app/src/main/res/layout/item_custom_incoming_preview_message.xml

@@ -52,6 +52,19 @@
         app:flexWrap="wrap"
         app:justifyContent="flex_end">
 
+        <androidx.emoji2.widget.EmojiTextView
+            android:id="@+id/messageAuthor"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="4dp"
+            android:alpha="0.6"
+            android:textAlignment="viewStart"
+            android:textColor="@color/no_emphasis_text"
+            android:textIsSelectable="false"
+            android:textSize="12sp"
+            tools:ignore="TextContrastCheck"
+            tools:text="Jane Doe" />
+
         <FrameLayout
             android:id="@+id/preview_container"
             android:layout_width="wrap_content"
@@ -160,6 +173,7 @@
             app:layout_alignSelf="flex_start"
             app:layout_flexGrow="1"
             app:layout_wrapBefore="true"
+            tools:ignore="TextContrastCheck"
             tools:text="A simple message" />
 
         <TextView
@@ -173,6 +187,7 @@
             android:gravity="end"
             android:textColor="@color/no_emphasis_text"
             app:layout_alignSelf="center"
+            tools:ignore="TextContrastCheck"
             tools:text="12:38" />
 
         <include