mark group chats with additional icon

This commit is contained in:
kosyak 2024-08-05 21:20:22 +02:00
parent 2b2ecbb44e
commit f709e32805
7 changed files with 42 additions and 11 deletions

View file

@ -3,6 +3,7 @@ package eu.siacs.conversations.ui.adapter;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Pair; import android.util.Pair;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -12,6 +13,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.databinding.DataBindingUtil; import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -378,6 +380,14 @@ public class ConversationAdapter
viewHolder.binding.conversationName.setTypeface(null, Typeface.BOLD); 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) { if (draft != null) {
viewHolder.binding.conversationLastmsgImg.setVisibility(View.GONE); viewHolder.binding.conversationLastmsgImg.setVisibility(View.GONE);
viewHolder.binding.conversationLastmsg.setText(draft.getMessage()); viewHolder.binding.conversationLastmsg.setText(draft.getMessage());

View file

@ -0,0 +1,5 @@
<vector android:height="16dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M16,11c1.66,0 2.99,-1.34 2.99,-3S17.66,5 16,5c-1.66,0 -3,1.34 -3,3s1.34,3 3,3zM8,11c1.66,0 2.99,-1.34 2.99,-3S9.66,5 8,5C6.34,5 5,6.34 5,8s1.34,3 3,3zM8,13c-2.33,0 -7,1.17 -7,3.5L1,19h14v-2.5c0,-2.33 -4.67,-3.5 -7,-3.5zM16,13c-0.29,0 -0.62,0.02 -0.97,0.05 1.16,0.84 1.97,1.97 1.97,3.45L17,19h6v-2.5c0,-2.33 -4.67,-3.5 -7,-3.5z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="16dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="16dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M16,11c1.66,0 2.99,-1.34 2.99,-3S17.66,5 16,5c-1.66,0 -3,1.34 -3,3s1.34,3 3,3zM8,11c1.66,0 2.99,-1.34 2.99,-3S9.66,5 8,5C6.34,5 5,6.34 5,8s1.34,3 3,3zM8,13c-2.33,0 -7,1.17 -7,3.5L1,19h14v-2.5c0,-2.33 -4.67,-3.5 -7,-3.5zM16,13c-0.29,0 -0.62,0.02 -0.97,0.05 1.16,0.84 1.97,1.97 1.97,3.45L17,19h6v-2.5c0,-2.33 -4.67,-3.5 -7,-3.5z"/>
</vector>

View file

@ -33,23 +33,31 @@
android:layout_toRightOf="@+id/conversation_image" android:layout_toRightOf="@+id/conversation_image"
android:paddingLeft="@dimen/avatar_item_distance"> android:paddingLeft="@dimen/avatar_item_distance">
<TextView <FrameLayout
android:id="@+id/conversation_name" android:id="@+id/conversation_name_wrapper"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignLeft="@+id/conversation_lastwrapper" android:layout_alignLeft="@+id/conversation_lastwrapper"
android:layout_toLeftOf="@+id/conversation_lastupdate" android:layout_toLeftOf="@+id/conversation_lastupdate"
android:paddingRight="4dp" android:paddingRight="4dp">
android:maxLines="1"
android:ellipsize="end" <TextView
android:fontFamily="sans-serif-medium" android:id="@+id/conversation_name"
android:textAppearance="@style/TextAppearance.Conversations.Subhead" /> android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawablePadding="4dp"
android:maxLines="1"
android:ellipsize="end"
android:fontFamily="sans-serif-medium"
android:textAppearance="@style/TextAppearance.Conversations.Subhead" />
</FrameLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/conversation_lastwrapper" android:id="@+id/conversation_lastwrapper"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/conversation_name" android:layout_below="@id/conversation_name_wrapper"
android:layout_marginTop="4dp"> android:layout_marginTop="4dp">
<TextView <TextView
@ -135,7 +143,7 @@
android:id="@+id/conversation_lastupdate" android:id="@+id/conversation_lastupdate"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/conversation_name" android:layout_alignBaseline="@+id/conversation_name_wrapper"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:gravity="right" android:gravity="right"
android:textAppearance="@style/TextAppearance.Conversations.Caption" /> android:textAppearance="@style/TextAppearance.Conversations.Caption" />

View file

@ -132,6 +132,7 @@
<attr name="ic_accounts_selected" format="reference" /> <attr name="ic_accounts_selected" format="reference" />
<attr name="ic_group_unselected" format="reference" /> <attr name="ic_group_unselected" format="reference" />
<attr name="ic_group_selected" format="reference" /> <attr name="ic_group_selected" format="reference" />
<attr name="ic_group_16" format="reference" />
<attr name="dialog_horizontal_padding" format="dimension" /> <attr name="dialog_horizontal_padding" format="dimension" />
<attr name="dialog_vertical_padding" format="dimension" /> <attr name="dialog_vertical_padding" format="dimension" />

View file

@ -604,8 +604,8 @@
<string name="pref_show_navigation_bar_summary">Use alternative navigation way via navigation bar on the bottom of the screen</string> <string name="pref_show_navigation_bar_summary">Use alternative navigation way via navigation bar on the bottom of the screen</string>
<string name="pref_avatars_shape">Avatars shape</string> <string name="pref_avatars_shape">Avatars shape</string>
<string name="pref_avatar_shape_summary">Allows you to select avatars shape globally</string> <string name="pref_avatar_shape_summary">Allows you to select avatars shape globally</string>
<string name="pref_use_green_background">Green Background</string> <string name="pref_use_green_background">Accent Background</string>
<string name="pref_use_green_background_summary">Use green background for received messages</string> <string name="pref_use_green_background_summary">Use accent background for received messages</string>
<string name="pref_always_show_full_timestamps">Show full timestamps</string> <string name="pref_always_show_full_timestamps">Show full timestamps</string>
<string name="pref_always_show_full_timestamps_summary">Always show full messages timestamps without "now", "1 min ago", etc</string> <string name="pref_always_show_full_timestamps_summary">Always show full messages timestamps without "now", "1 min ago", etc</string>
<string name="pref_skip_image_editor_screen">Skip image editor</string> <string name="pref_skip_image_editor_screen">Skip image editor</string>

View file

@ -151,6 +151,7 @@
<item name="ic_accounts_selected" type="reference">@drawable/accounts_selected_black_24</item> <item name="ic_accounts_selected" type="reference">@drawable/accounts_selected_black_24</item>
<item name="ic_group_unselected" type="reference">@drawable/outline_group_black_24dp</item> <item name="ic_group_unselected" type="reference">@drawable/outline_group_black_24dp</item>
<item name="ic_group_selected" type="reference">@drawable/ic_group_selected_black_24</item> <item name="ic_group_selected" type="reference">@drawable/ic_group_selected_black_24</item>
<item name="ic_group_16" type="reference">@drawable/ic_group_selected_black_16</item>
<item name="icon_notifications" type="reference">@drawable/ic_notifications_black_24dp <item name="icon_notifications" type="reference">@drawable/ic_notifications_black_24dp
</item> </item>
@ -327,6 +328,7 @@
<item name="ic_accounts_selected" type="reference">@drawable/accounts_selected_white_24</item> <item name="ic_accounts_selected" type="reference">@drawable/accounts_selected_white_24</item>
<item name="ic_group_unselected" type="reference">@drawable/outline_group_white_24</item> <item name="ic_group_unselected" type="reference">@drawable/outline_group_white_24</item>
<item name="ic_group_selected" type="reference">@drawable/ic_group_selected_white_24</item> <item name="ic_group_selected" type="reference">@drawable/ic_group_selected_white_24</item>
<item name="ic_group_16" type="reference">@drawable/ic_group_selected_white_16</item>
<item name="icon_notifications" type="reference">@drawable/ic_notifications_white_24dp <item name="icon_notifications" type="reference">@drawable/ic_notifications_white_24dp
</item> </item>