Преглед изворни кода

add (edited) tag in incoming and outgoing messages layout

sowjanyakch пре 1 година
родитељ
комит
426c8823c5

+ 8 - 0
app/src/main/java/com/nextcloud/talk/adapters/messages/IncomingTextMessageViewHolder.kt

@@ -114,6 +114,14 @@ 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

+ 7 - 0
app/src/main/java/com/nextcloud/talk/adapters/messages/OutcomingTextMessageViewHolder.kt

@@ -100,6 +100,13 @@ 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

+ 14 - 1
app/src/main/res/layout/item_custom_incoming_text_message.xml

@@ -78,6 +78,19 @@
             app:layout_wrapBefore="true"
             tools:text="Talk to you later!" />
 
+        <TextView
+            android:id="@+id/messageType"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/messageText"
+            android:layout_marginStart="8dp"
+            android:text="@string/hint_edited_message"
+            app:layout_alignSelf="center"
+            app:layout_flexGrow="1"
+            app:layout_wrapBefore="false">
+
+        </TextView>
+
         <TextView
             android:id="@id/messageTime"
             android:layout_width="wrap_content"
@@ -98,4 +111,4 @@
             layout="@layout/reactions_inside_message" />
 
     </com.google.android.flexbox.FlexboxLayout>
-</RelativeLayout>
+</RelativeLayout>

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

@@ -57,6 +57,20 @@
             android:textIsSelectable="false"
             tools:text="Talk to you later!" />
 
+
+        <TextView
+            android:id="@+id/messageType"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/messageText"
+            android:layout_marginStart="8dp"
+            app:layout_alignSelf="center"
+            app:layout_flexGrow="1"
+            app:layout_wrapBefore="false"
+            android:text = "@string/hint_edited_message">
+
+        </TextView>
+
         <TextView
             android:id="@id/messageTime"
             android:layout_width="wrap_content"
@@ -72,6 +86,7 @@
             app:layout_wrapBefore="false"
             tools:text="10:35" />
 
+
         <ImageView
             android:id="@+id/checkMark"
             android:layout_width="wrap_content"

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -793,4 +793,5 @@ How to translate with transifex:
     <string name="edit_error_24_hours_old_message">Cannot Edit Messages older than 24 hours</string>
     <string name="conversation_is_read_only">Conversation is read Only</string>
     <string name="nc_edit_message_text">Edit Message Text</string>
+    <string name="hint_edited_message">(edited)</string>
 </resources>