Skip to content

Commit 116ed09

Browse files
committed
add group topic indicators to chat list
1 parent 4f13b4d commit 116ed09

File tree

5 files changed

+38
-15
lines changed

5 files changed

+38
-15
lines changed

app/src/main/java/co/tinode/tindroid/ChatsAdapter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ static class ViewHolder extends RecyclerView.ViewHolder {
246246
ImageView online;
247247
ImageView deleted;
248248
ImageView channel;
249+
ImageView group;
249250
ImageView verified;
250251
ImageView staff;
251252
ImageView danger;
@@ -269,6 +270,7 @@ static class ViewHolder extends RecyclerView.ViewHolder {
269270
online = item.findViewById(R.id.online);
270271
deleted = item.findViewById(R.id.deleted);
271272
channel = item.findViewById(R.id.icon_channel);
273+
group = item.findViewById(R.id.icon_group);
272274
verified = item.findViewById(R.id.icon_verified);
273275
staff = item.findViewById(R.id.icon_staff);
274276
danger = item.findViewById(R.id.icon_danger);
@@ -333,6 +335,11 @@ void bind(int position, final ComTopic<VxCard> topic, Storage.Message msg, boole
333335
channel.setVisibility(View.VISIBLE);
334336
} else {
335337
channel.setVisibility(View.GONE);
338+
if (topic.isGrpType()) {
339+
group.setVisibility(View.VISIBLE);
340+
} else {
341+
group.setVisibility(View.GONE);
342+
}
336343
if (topic.isDeleted()) {
337344
online.setVisibility(View.GONE);
338345
} else {

app/src/main/java/co/tinode/tindroid/TopicInfoFragment.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -379,17 +379,22 @@ private void notifyContentChanged() {
379379
title.setText(R.string.placeholder_contact_title);
380380
title.setTypeface(null, Typeface.ITALIC);
381381
title.setTextIsSelectable(false);
382-
avatar.setImageResource(Topic.isP2PType(topicName) ?
382+
avatar.setImageResource(mTopic.isP2PType() ?
383383
R.drawable.ic_person_circle : R.drawable.ic_group_grey);
384384
descriptionWrapper.setVisibility(View.GONE);
385385
}
386386

387+
Drawable icon = null;
388+
387389
if (mTopic.hasChannelAccess()) {
388-
Drawable icon = AppCompatResources.getDrawable(activity, R.drawable.ic_channel);
389-
if (icon != null) {
390-
icon.setBounds(0, 0, 64, 64);
391-
title.setCompoundDrawables(null, null, icon, null);
392-
}
390+
icon = AppCompatResources.getDrawable(activity, R.drawable.ic_channel);
391+
} else if (mTopic.isGrpType()) {
392+
icon = AppCompatResources.getDrawable(activity, R.drawable.ic_group_2);
393+
}
394+
395+
if (icon != null) {
396+
icon.setBounds(0, 0, 64, 64);
397+
title.setCompoundDrawables(null, null, icon, null);
393398
} else {
394399
title.setCompoundDrawables(null, null, null, null);
395400
}

app/src/main/res/drawable-anydpi/ic_group_3.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24"
5+
android:viewportHeight="24">
6+
<path
7+
android:fillColor="#000"
8+
android:pathData="M9,13.75c-2.34,0 -7,1.17 -7,3.5L2,19h14v-1.75c0,-2.33 -4.66,-3.5 -7,-3.5zM4.34,17c0.84,-0.58 2.87,-1.25 4.66,-1.25s3.82,0.67 4.66,1.25L4.34,17zM9,12c1.93,0 3.5,-1.57 3.5,-3.5S10.93,5 9,5 5.5,6.57 5.5,8.5 7.07,12 9,12zM9,7c0.83,0 1.5,0.67 1.5,1.5S9.83,10 9,10s-1.5,-0.67 -1.5,-1.5S8.17,7 9,7zM16.04,13.81c1.16,0.84 1.96,1.96 1.96,3.44L18,19h4v-1.75c0,-2.02 -3.5,-3.17 -5.96,-3.44zM15,12c1.93,0 3.5,-1.57 3.5,-3.5S16.93,5 15,5c-0.54,0 -1.04,0.13 -1.5,0.35 0.63,0.89 1,1.98 1,3.15s-0.37,2.26 -1,3.15c0.46,0.22 0.96,0.35 1.5,0.35z" />
9+
</vector>

app/src/main/res/layout/contact.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@
7373
tools:ignore="RtlSymmetry"
7474
tools:text="Contact title" />
7575

76+
<androidx.appcompat.widget.AppCompatImageView
77+
android:id="@+id/icon_group"
78+
android:layout_width="20dp"
79+
android:layout_height="20dp"
80+
android:alpha="0.75"
81+
android:baseline="-2dp"
82+
android:contentDescription="@string/group"
83+
android:visibility="gone"
84+
app:srcCompat="@drawable/ic_group_2"
85+
app:tint="?android:attr/textColorSecondary" />
86+
7687
<androidx.appcompat.widget.AppCompatImageView
7788
android:id="@+id/icon_channel"
7889
android:layout_width="20dp"

0 commit comments

Comments
 (0)