From 6a5a75131eb0f675251d1786d9cc5d1807df3bd0 Mon Sep 17 00:00:00 2001 From: wch423 Date: Fri, 16 Jan 2026 17:44:34 +0100 Subject: [PATCH] Add indication for blocked contacts in user profile --- CHANGELOG.md | 1 + .../org/thoughtcrime/securesms/ProfileAdapter.java | 11 ++++++++--- src/main/res/drawable/contact_blocked_24.xml | 5 +++++ src/main/res/values/strings.xml | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 src/main/res/drawable/contact_blocked_24.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 8191306f1..3293e4ae2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Remove email address from user profile * Mark external links with " ↗" to make them clear * Make QR code larger on "Add Second Device" screen +* Add indication for blocked contacts in user profile * Fix: Show dialog if pasted QR codes are invalid * Fix: Refresh chat list when returning from conversation if selected profile changed * Update to core 2.36.0 diff --git a/src/main/java/org/thoughtcrime/securesms/ProfileAdapter.java b/src/main/java/org/thoughtcrime/securesms/ProfileAdapter.java index 4149ad2c4..c3d956e46 100644 --- a/src/main/java/org/thoughtcrime/securesms/ProfileAdapter.java +++ b/src/main/java/org/thoughtcrime/securesms/ProfileAdapter.java @@ -38,6 +38,7 @@ public class ProfileAdapter extends RecyclerView.Adapter public static final int ITEM_ALL_MEDIA_BUTTON = 30; public static final int ITEM_SEND_MESSAGE_BUTTON = 35; public static final int ITEM_LAST_SEEN = 40; + public static final int ITEM_BLOCKED = 43; public static final int ITEM_INTRODUCED_BY = 45; public static final int ITEM_HEADER = 53; public static final int ITEM_MEMBERS = 55; @@ -139,7 +140,7 @@ public class ProfileAdapter extends RecyclerView.Adapter } else if (viewType == ITEM_ALL_MEDIA_BUTTON || viewType == ITEM_SEND_MESSAGE_BUTTON) { final ProfileTextItem item = (ProfileTextItem)layoutInflater.inflate(R.layout.profile_text_item_button, parent, false); return new ViewHolder(item); - } else if (viewType == ITEM_LAST_SEEN || viewType == ITEM_INTRODUCED_BY) { + } else if (viewType == ITEM_LAST_SEEN || viewType == ITEM_INTRODUCED_BY || viewType == ITEM_BLOCKED) { final ProfileTextItem item = (ProfileTextItem)layoutInflater.inflate(R.layout.profile_text_item_small, parent, false); return new ViewHolder(item); } else { @@ -205,9 +206,9 @@ public class ProfileAdapter extends RecyclerView.Adapter else if(holder.itemView instanceof ProfileTextItem) { ProfileTextItem item = (ProfileTextItem) holder.itemView; item.setOnClickListener(view -> clickListener.onSettingsClicked(data.viewType)); - boolean tintIcon = data.viewType != ITEM_INTRODUCED_BY; + boolean tintIcon = data.viewType != ITEM_INTRODUCED_BY && data.viewType != ITEM_BLOCKED; item.set(data.label, data.icon, tintIcon); - if (data.viewType == ITEM_LAST_SEEN) { + if (data.viewType == ITEM_BLOCKED) { int padding = (int)((float)context.getResources().getDimensionPixelSize(R.dimen.contact_list_normal_padding) * 1.2); item.setPadding(item.getPaddingLeft(), item.getPaddingTop(), item.getPaddingRight(), padding); } else if (data.viewType == ITEM_INTRODUCED_BY) { @@ -302,6 +303,10 @@ public class ProfileAdapter extends RecyclerView.Adapter itemData.add(new ItemData(ITEM_LAST_SEEN, lastSeenTxt, 0)); } + if (dcContact != null && !isDeviceTalk && !isSelfTalk && dcContact.isBlocked()) { + itemData.add(new ItemData(ITEM_BLOCKED, context.getString(R.string.contact_blocked), R.drawable.contact_blocked_24)); + } + if (memberList!=null && !isInBroadcast && !isMailingList) { itemData.add(new ItemData(ITEM_DIVIDER, null, 0)); if (dcChat != null) { diff --git a/src/main/res/drawable/contact_blocked_24.xml b/src/main/res/drawable/contact_blocked_24.xml new file mode 100644 index 000000000..3368f8111 --- /dev/null +++ b/src/main/res/drawable/contact_blocked_24.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index fbc458b02..9f8b69db8 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -1002,6 +1002,7 @@ %1$s replied, waiting for being added to the group… Establishing connection, please wait… %1$s introduced. + This contact is blocked Introduced by %1$s Introduced by me