Merge pull request #1079 from mpretty-cyro/feature/read_status_updates

Added the updated delivery status UI
This commit is contained in:
Morgan Pretty 2023-01-24 14:20:56 +11:00 committed by GitHub
commit beabc1c686
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 65 additions and 34 deletions

View File

@ -192,7 +192,14 @@ class VisibleMessageView : LinearLayout {
binding.dateBreakTextView.isVisible = showDateBreak binding.dateBreakTextView.isVisible = showDateBreak
// Message status indicator // Message status indicator
if (message.isOutgoing) { if (message.isOutgoing) {
val (iconID, iconColor) = getMessageStatusImage(message) val (iconID, iconColor, textId) = getMessageStatusImage(message)
if (textId != null) {
binding.messageStatusTextView.setText(textId)
if (iconColor != null) {
binding.messageStatusTextView.setTextColor(iconColor)
}
}
if (iconID != null) { if (iconID != null) {
val drawable = ContextCompat.getDrawable(context, iconID)?.mutate() val drawable = ContextCompat.getDrawable(context, iconID)?.mutate()
if (iconColor != null) { if (iconColor != null) {
@ -202,9 +209,20 @@ class VisibleMessageView : LinearLayout {
} }
val lastMessageID = mmsSmsDb.getLastMessageID(message.threadId) val lastMessageID = mmsSmsDb.getLastMessageID(message.threadId)
binding.messageStatusImageView.isVisible = binding.messageStatusTextView.isVisible = (
!message.isSent || message.id == lastMessageID textId != null && (
!message.isSent ||
message.id == lastMessageID
)
)
binding.messageStatusImageView.isVisible = (
iconID != null && (
!message.isSent ||
message.id == lastMessageID
)
)
} else { } else {
binding.messageStatusTextView.isVisible = false
binding.messageStatusImageView.isVisible = false binding.messageStatusImageView.isVisible = false
} }
// Expiration timer // Expiration timer
@ -263,13 +281,17 @@ class VisibleMessageView : LinearLayout {
} }
} }
private fun getMessageStatusImage(message: MessageRecord): Pair<Int?,Int?> { private fun getMessageStatusImage(message: MessageRecord): Triple<Int?,Int?,Int?> {
return when { return when {
!message.isOutgoing -> null to null !message.isOutgoing -> Triple(null, null, null)
message.isFailed -> R.drawable.ic_error to resources.getColor(R.color.destructive, context.theme) message.isFailed ->
message.isPending -> R.drawable.ic_circle_dot_dot_dot to null Triple(R.drawable.ic_delivery_status_failed, resources.getColor(R.color.destructive, context.theme), R.string.delivery_status_failed)
message.isRead -> R.drawable.ic_filled_circle_check to null message.isPending ->
else -> R.drawable.ic_circle_check to null Triple(R.drawable.ic_delivery_status_sending, context.getColorFromAttr(R.attr.message_status_color), R.string.delivery_status_sending)
message.isRead ->
Triple(R.drawable.ic_delivery_status_read, context.getColorFromAttr(R.attr.message_status_color), R.string.delivery_status_read)
else ->
Triple(R.drawable.ic_delivery_status_sent, context.getColorFromAttr(R.attr.message_status_color), R.string.delivery_status_sent)
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 478 B

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 B

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 B

After

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 313 B

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 679 B

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 B

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 524 B

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1023 B

After

Width:  |  Height:  |  Size: 445 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 556 B

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 863 B

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 588 B

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 567 B

View File

@ -22,16 +22,11 @@
android:id="@+id/mainContainer" android:id="@+id/mainContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/small_spacing"
android:layout_marginEnd="@dimen/small_spacing"
android:gravity="bottom" android:gravity="bottom"
android:paddingBottom="@dimen/small_spacing"> android:paddingBottom="@dimen/small_spacing">
<View
android:id="@+id/startSpacing"
android:layout_width="8dp"
android:layout_height="1dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<include <include
android:id="@+id/profilePictureView" android:id="@+id/profilePictureView"
layout="@layout/view_profile_picture" layout="@layout/view_profile_picture"
@ -42,7 +37,7 @@
android:layout_gravity="center" android:layout_gravity="center"
app:layout_constraintEnd_toStartOf="@+id/messageInnerContainer" app:layout_constraintEnd_toStartOf="@+id/messageInnerContainer"
app:layout_constraintBottom_toBottomOf="@id/messageInnerContainer" app:layout_constraintBottom_toBottomOf="@id/messageInnerContainer"
app:layout_constraintStart_toEndOf="@+id/startSpacing" app:layout_constraintStart_toStartOf="parent"
tools:visibility="visible" /> tools:visibility="visible" />
<ImageView <ImageView
@ -78,8 +73,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="@+id/profilePictureView" app:layout_constraintBottom_toBottomOf="@+id/profilePictureView"
app:layout_constraintEnd_toStartOf="@+id/messageTimestampContainer"
app:layout_constraintStart_toEndOf="@+id/profilePictureView" app:layout_constraintStart_toEndOf="@+id/profilePictureView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/senderNameTextView"> app:layout_constraintTop_toBottomOf="@+id/senderNameTextView">
<include layout="@layout/view_visible_message_content" <include layout="@layout/view_visible_message_content"
@ -110,27 +105,32 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:visibility="gone"
app:layout_constraintEnd_toStartOf="@+id/messageTimestampContainer" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/messageInnerContainer" app:layout_constraintStart_toStartOf="@+id/messageInnerContainer"
app:layout_constraintTop_toBottomOf="@id/messageInnerContainer" /> app:layout_constraintTop_toBottomOf="@id/messageInnerContainer" />
<RelativeLayout <TextView
android:id="@+id/messageTimestampContainer" android:id="@+id/messageStatusTextView"
android:layout_width="@dimen/medium_spacing" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginBottom="1dp"
app:layout_constraintTop_toTopOf="@id/messageStatusImageView"
app:layout_constraintBottom_toBottomOf="@id/messageStatusImageView"
app:layout_constraintEnd_toStartOf="@id/messageStatusImageView"
android:textSize="@dimen/very_small_font_size"
android:textColor="@color/classic_dark_1"
tools:text="Sent" />
<ImageView
android:id="@+id/messageStatusImageView"
android:layout_width="12dp"
android:layout_height="12dp"
android:layout_marginTop="5dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/messageInnerContainer"> app:layout_constraintTop_toBottomOf="@+id/emojiReactionsView"
tools:tint="@color/classic_dark_1"
<ImageView android:src="@drawable/ic_delivery_status_sent" />
android:id="@+id/messageStatusImageView"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:padding="2dp"
android:src="@drawable/ic_delivery_status_sent" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -164,6 +164,7 @@
<attr name="message_received_text_color" format="color|reference" /> <attr name="message_received_text_color" format="color|reference" />
<attr name="message_sent_background_color" format="color|reference" /> <attr name="message_sent_background_color" format="color|reference" />
<attr name="message_sent_text_color" format="color|reference" /> <attr name="message_sent_text_color" format="color|reference" />
<attr name="message_status_color" format="color|reference" />
<attr name="input_bar_background" format="color|reference"/> <attr name="input_bar_background" format="color|reference"/>
<attr name="input_bar_text_hint" format="color|reference"/> <attr name="input_bar_text_hint" format="color|reference"/>
<attr name="input_bar_text_user" format="color|reference"/> <attr name="input_bar_text_user" format="color|reference"/>

View File

@ -866,4 +866,8 @@
<string name="new_conversation_dialog_close_button_content_description">Close Dialog</string> <string name="new_conversation_dialog_close_button_content_description">Close Dialog</string>
<string name="ErrorNotifier_migration">Database Upgrade Failed</string> <string name="ErrorNotifier_migration">Database Upgrade Failed</string>
<string name="ErrorNotifier_migration_downgrade">Please contact support to report the error.</string> <string name="ErrorNotifier_migration_downgrade">Please contact support to report the error.</string>
<string name="delivery_status_sending">Sending</string>
<string name="delivery_status_read">Read</string>
<string name="delivery_status_sent">Sent</string>
<string name="delivery_status_failed">Failed to send</string>
</resources> </resources>

View File

@ -370,6 +370,7 @@
<item name="message_received_text_color">@color/classic_dark_6</item> <item name="message_received_text_color">@color/classic_dark_6</item>
<item name="message_sent_background_color">?colorAccent</item> <item name="message_sent_background_color">?colorAccent</item>
<item name="message_sent_text_color">@color/classic_dark_0</item> <item name="message_sent_text_color">@color/classic_dark_0</item>
<item name="message_status_color">@color/classic_dark_5</item>
<item name="input_bar_background">@color/classic_dark_1</item> <item name="input_bar_background">@color/classic_dark_1</item>
<item name="input_bar_text_hint">@color/classic_dark_5</item> <item name="input_bar_text_hint">@color/classic_dark_5</item>
<item name="input_bar_text_user">@color/classic_dark_6</item> <item name="input_bar_text_user">@color/classic_dark_6</item>
@ -454,6 +455,7 @@
<item name="message_received_text_color">@color/classic_light_0</item> <item name="message_received_text_color">@color/classic_light_0</item>
<item name="message_sent_background_color">?colorAccent</item> <item name="message_sent_background_color">?colorAccent</item>
<item name="message_sent_text_color">@color/classic_light_0</item> <item name="message_sent_text_color">@color/classic_light_0</item>
<item name="message_status_color">@color/classic_light_1</item>
<item name="input_bar_background">@color/classic_light_6</item> <item name="input_bar_background">@color/classic_light_6</item>
<item name="input_bar_text_hint">@color/classic_light_1</item> <item name="input_bar_text_hint">@color/classic_light_1</item>
<item name="input_bar_text_user">@color/classic_light_0</item> <item name="input_bar_text_user">@color/classic_light_0</item>
@ -535,6 +537,7 @@
<item name="message_received_text_color">@color/ocean_dark_6</item> <item name="message_received_text_color">@color/ocean_dark_6</item>
<item name="message_sent_background_color">?colorAccent</item> <item name="message_sent_background_color">?colorAccent</item>
<item name="message_sent_text_color">@color/ocean_dark_0</item> <item name="message_sent_text_color">@color/ocean_dark_0</item>
<item name="message_status_color">@color/ocean_dark_5</item>
<item name="input_bar_background">@color/ocean_dark_1</item> <item name="input_bar_background">@color/ocean_dark_1</item>
<item name="input_bar_text_hint">@color/ocean_dark_5</item> <item name="input_bar_text_hint">@color/ocean_dark_5</item>
<item name="input_bar_text_user">@color/ocean_dark_6</item> <item name="input_bar_text_user">@color/ocean_dark_6</item>
@ -618,6 +621,7 @@
<item name="message_received_text_color">@color/ocean_light_0</item> <item name="message_received_text_color">@color/ocean_light_0</item>
<item name="message_sent_background_color">?colorAccent</item> <item name="message_sent_background_color">?colorAccent</item>
<item name="message_sent_text_color">@color/ocean_light_0</item> <item name="message_sent_text_color">@color/ocean_light_0</item>
<item name="message_status_color">@color/ocean_light_2</item>
<item name="input_bar_background">@color/ocean_light_6</item> <item name="input_bar_background">@color/ocean_light_6</item>
<item name="input_bar_text_hint">@color/ocean_light_1</item> <item name="input_bar_text_hint">@color/ocean_light_1</item>
<item name="input_bar_text_user">@color/ocean_light_0</item> <item name="input_bar_text_user">@color/ocean_light_0</item>