From f709e3280514fd8bc4e6df49a51e6e2719dbe68a Mon Sep 17 00:00:00 2001 From: kosyak Date: Mon, 5 Aug 2024 21:20:22 +0200 Subject: [PATCH] mark group chats with additional icon --- .../ui/adapter/ConversationAdapter.java | 10 +++++++ .../drawable/ic_group_selected_black_16.xml | 5 ++++ .../drawable/ic_group_selected_white_16.xml | 5 ++++ src/main/res/layout/conversation_list_row.xml | 26 ++++++++++++------- src/main/res/values/attrs.xml | 1 + src/main/res/values/strings.xml | 4 +-- src/main/res/values/themes.xml | 2 ++ 7 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 src/main/res/drawable/ic_group_selected_black_16.xml create mode 100644 src/main/res/drawable/ic_group_selected_white_16.xml diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java index 2f93401c5..993b1aa67 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -3,6 +3,7 @@ package eu.siacs.conversations.ui.adapter; import android.content.Context; import android.content.SharedPreferences; import android.graphics.Typeface; +import android.graphics.drawable.Drawable; import android.preference.PreferenceManager; import android.util.Pair; import android.view.LayoutInflater; @@ -12,6 +13,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.appcompat.content.res.AppCompatResources; import androidx.databinding.DataBindingUtil; import androidx.recyclerview.widget.RecyclerView; @@ -378,6 +380,14 @@ public class ConversationAdapter viewHolder.binding.conversationName.setTypeface(null, Typeface.BOLD); } + if (conversation.getMode() == Conversation.MODE_MULTI) { + int drId = activity.getThemeResource(R.attr.ic_group_16, R.drawable.ic_group_selected_black_16); + Drawable dr = AppCompatResources.getDrawable(activity, drId); + viewHolder.binding.conversationName.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, dr, null); + } else { + viewHolder.binding.conversationName.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, null, null); + } + if (draft != null) { viewHolder.binding.conversationLastmsgImg.setVisibility(View.GONE); viewHolder.binding.conversationLastmsg.setText(draft.getMessage()); diff --git a/src/main/res/drawable/ic_group_selected_black_16.xml b/src/main/res/drawable/ic_group_selected_black_16.xml new file mode 100644 index 000000000..dd1d73584 --- /dev/null +++ b/src/main/res/drawable/ic_group_selected_black_16.xml @@ -0,0 +1,5 @@ + + + diff --git a/src/main/res/drawable/ic_group_selected_white_16.xml b/src/main/res/drawable/ic_group_selected_white_16.xml new file mode 100644 index 000000000..4aaf044fd --- /dev/null +++ b/src/main/res/drawable/ic_group_selected_white_16.xml @@ -0,0 +1,5 @@ + + + diff --git a/src/main/res/layout/conversation_list_row.xml b/src/main/res/layout/conversation_list_row.xml index da0ca4990..e892d9c6e 100644 --- a/src/main/res/layout/conversation_list_row.xml +++ b/src/main/res/layout/conversation_list_row.xml @@ -33,23 +33,31 @@ android:layout_toRightOf="@+id/conversation_image" android:paddingLeft="@dimen/avatar_item_distance"> - + android:paddingRight="4dp"> + + + + diff --git a/src/main/res/values/attrs.xml b/src/main/res/values/attrs.xml index 6f0524747..19d4166c8 100644 --- a/src/main/res/values/attrs.xml +++ b/src/main/res/values/attrs.xml @@ -132,6 +132,7 @@ + diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index ea0d771a7..91879e43e 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -604,8 +604,8 @@ Use alternative navigation way via navigation bar on the bottom of the screen Avatars shape Allows you to select avatars shape globally - Green Background - Use green background for received messages + Accent Background + Use accent background for received messages Show full timestamps Always show full messages timestamps without "now", "1 min ago", etc Skip image editor diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml index 59f613037..8eb113795 100644 --- a/src/main/res/values/themes.xml +++ b/src/main/res/values/themes.xml @@ -151,6 +151,7 @@ @drawable/accounts_selected_black_24 @drawable/outline_group_black_24dp @drawable/ic_group_selected_black_24 + @drawable/ic_group_selected_black_16 @drawable/ic_notifications_black_24dp @@ -327,6 +328,7 @@ @drawable/accounts_selected_white_24 @drawable/outline_group_white_24 @drawable/ic_group_selected_white_24 + @drawable/ic_group_selected_white_16 @drawable/ic_notifications_white_24dp