Add group and community icons

This commit is contained in:
andrew 2023-07-21 10:26:39 +09:30
parent 9af6dc9265
commit 998d3cbec6
5 changed files with 48 additions and 15 deletions

View File

@ -50,16 +50,18 @@ class ConversationView : LinearLayout {
// region Updating
fun bind(thread: ThreadRecord, isTyping: Boolean, glide: GlideRequests) {
this.thread = thread
if (thread.isPinned) {
binding.conversationViewDisplayNameTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(
0,
0,
R.drawable.ic_pin,
0
)
} else {
binding.conversationViewDisplayNameTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, 0)
}
binding.conversationViewDisplayNameTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(
when {
thread.recipient.address.isClosedGroup -> R.drawable.ic_group_icon
thread.recipient.address.isOpenGroup -> R.drawable.ic_community
else -> 0
},
0,
if (thread.isPinned) R.drawable.ic_pin else 0,
0
)
binding.root.background = if (thread.unreadCount > 0) {
ContextCompat.getDrawable(context, R.drawable.conversation_unread_background)
} else {

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="14dp"
android:height="14dp"
android:viewportWidth="14"
android:viewportHeight="14">
<path
android:pathData="M8.047,0.145C8.047,0.145 8.023,0.14 8.014,0.135C7.58,0.047 7.128,0 6.667,0C6.205,0 5.753,0.047 5.319,0.135C5.291,0.135 5.268,0.149 5.245,0.154C2.252,0.811 0,3.478 0,6.667C0,10.345 2.993,13.333 6.667,13.333C10.34,13.333 13.333,10.34 13.333,6.667C13.338,3.464 11.063,0.783 8.047,0.145ZM7.133,12.382V10.289C7.711,10.252 8.256,10.172 8.774,10.061C8.368,11.184 7.888,11.986 7.674,12.312C7.497,12.345 7.315,12.368 7.133,12.382ZM5.646,12.308C5.436,11.986 4.97,11.217 4.569,10.126C5.128,10.228 5.674,10.284 6.2,10.298V12.378C6.014,12.364 5.827,12.336 5.646,12.303V12.308ZM6.2,0.956V3.035C5.655,3.049 5.091,3.105 4.513,3.217C4.783,2.499 5.152,1.767 5.65,1.03C5.832,0.998 6.014,0.974 6.2,0.96V0.956ZM7.669,1.026C8.182,1.79 8.564,2.545 8.834,3.287C8.303,3.17 7.734,3.086 7.133,3.049V0.956C7.315,0.97 7.492,0.993 7.669,1.026ZM12.382,6.2H10.312C10.298,5.683 10.247,5.147 10.144,4.601C11.226,5.002 11.995,5.464 12.308,5.674C12.34,5.846 12.364,6.023 12.378,6.2H12.382ZM9.408,6.2H7.138V3.953C7.86,4 8.531,4.121 9.142,4.28C9.305,4.942 9.389,5.585 9.408,6.2ZM6.205,3.939V6.2H3.921C3.944,5.566 4.028,4.909 4.2,4.228C4.89,4.051 5.562,3.963 6.205,3.939ZM3.012,6.2H0.956C0.97,6.023 0.993,5.851 1.026,5.678C1.753,5.184 2.48,4.816 3.189,4.55C3.082,5.114 3.026,5.669 3.012,6.205V6.2ZM0.956,7.133H3.026C3.063,7.725 3.147,8.284 3.259,8.811C2.527,8.541 1.776,8.163 1.021,7.655C0.993,7.483 0.97,7.31 0.951,7.133H0.956ZM3.93,7.133H6.2V9.394C5.576,9.375 4.923,9.287 4.252,9.119C4.093,8.513 3.972,7.846 3.925,7.133H3.93ZM7.133,9.38V7.133H9.389C9.347,7.828 9.231,8.476 9.077,9.068C8.485,9.221 7.827,9.338 7.128,9.38H7.133ZM10.298,7.133H12.382C12.368,7.31 12.345,7.487 12.312,7.66C11.991,7.874 11.193,8.354 10.075,8.76C10.182,8.247 10.261,7.706 10.298,7.133ZM11.93,4.392C11.408,4.126 10.718,3.818 9.897,3.566C9.692,2.872 9.403,2.159 9.012,1.441C10.312,2.028 11.361,3.082 11.93,4.392ZM4.303,1.45C3.93,2.135 3.65,2.816 3.445,3.483C2.783,3.688 2.112,3.963 1.431,4.336C2.005,3.058 3.03,2.028 4.303,1.445V1.45ZM1.427,8.993C2.14,9.385 2.844,9.678 3.534,9.883C3.786,10.699 4.093,11.394 4.359,11.916C3.054,11.338 2.005,10.294 1.427,8.993ZM8.956,11.925C9.231,11.385 9.548,10.657 9.809,9.795C10.667,9.534 11.389,9.221 11.93,8.946C11.352,10.275 10.284,11.343 8.956,11.925Z"
android:fillColor="#A1A2A1"/>
</vector>

View File

@ -0,0 +1,24 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="26dp"
android:height="14dp"
android:viewportWidth="26"
android:viewportHeight="14">
<path
android:pathData="M12.823,7.411C14.89,7.411 16.575,5.751 16.575,3.706C16.575,1.661 14.894,0 12.823,0C10.752,0 9.07,1.661 9.07,3.706C9.07,5.751 10.752,7.411 12.823,7.411ZM12.823,1.496C14.058,1.496 15.064,2.489 15.064,3.709C15.064,4.93 14.058,5.922 12.823,5.922C11.587,5.922 10.582,4.93 10.582,3.709C10.582,2.489 11.587,1.496 12.823,1.496Z"
android:fillColor="#A1A2A1"/>
<path
android:pathData="M12.823,8.628C9.887,8.628 7.405,10.184 6.607,12.315C6.422,12.807 6.777,13.334 7.31,13.334C7.639,13.334 7.915,13.121 8.028,12.815C8.606,11.262 10.533,10.121 12.823,10.121C15.113,10.121 17.041,11.266 17.619,12.815C17.732,13.117 18.008,13.334 18.337,13.334C18.869,13.334 19.225,12.807 19.039,12.315C18.242,10.184 15.759,8.628 12.823,8.628Z"
android:fillColor="#A1A2A1"/>
<path
android:pathData="M20.55,7.262C22.202,7.262 23.547,5.934 23.547,4.299C23.547,2.665 22.202,1.34 20.55,1.34C18.899,1.34 17.554,2.668 17.554,4.299C17.554,5.93 18.899,7.262 20.55,7.262ZM20.55,2.534C21.537,2.534 22.341,3.325 22.341,4.303C22.341,5.281 21.54,6.072 20.55,6.072C19.56,6.072 18.759,5.277 18.759,4.303C18.759,3.329 19.56,2.534 20.55,2.534Z"
android:fillColor="#A1A2A1"/>
<path
android:pathData="M5.012,7.262C6.664,7.262 8.009,5.934 8.009,4.299C8.009,2.665 6.664,1.34 5.012,1.34C3.361,1.34 2.016,2.668 2.016,4.299C2.016,5.93 3.361,7.262 5.012,7.262ZM5.012,2.534C5.998,2.534 6.803,3.325 6.803,4.303C6.803,5.281 6.002,6.072 5.012,6.072C4.022,6.072 3.221,5.277 3.221,4.303C3.221,3.329 4.022,2.534 5.012,2.534Z"
android:fillColor="#A1A2A1"/>
<path
android:pathData="M25.517,11.181C24.878,9.479 22.894,8.232 20.547,8.232C19.482,8.232 18.492,8.49 17.668,8.93C18.038,9.18 18.382,9.46 18.688,9.766C19.244,9.55 19.875,9.423 20.547,9.423C22.376,9.423 23.918,10.337 24.379,11.576C24.47,11.819 24.689,11.99 24.954,11.99C25.381,11.99 25.664,11.569 25.517,11.177V11.181Z"
android:fillColor="#A1A2A1"/>
<path
android:pathData="M7.937,8.96C7.102,8.505 6.097,8.236 5.009,8.236C2.662,8.236 0.678,9.483 0.039,11.184C-0.108,11.58 0.175,11.998 0.602,11.998C0.863,11.998 1.086,11.826 1.177,11.584C1.638,10.345 3.18,9.43 5.009,9.43C5.708,9.43 6.361,9.565 6.932,9.796C7.234,9.49 7.571,9.214 7.937,8.96Z"
android:fillColor="#A1A2A1"/>
</vector>

View File

@ -1,10 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:width="16dp"
android:height="16dp"
android:viewportWidth="122.879"
android:viewportHeight="122.867">
<path
android:fillColor="@android:color/white"
android:fillColor="?conversation_pinned_icon_color"
android:pathData="M83.88,0.451 L122.427,39a1.55,1.55 0,0 1,0 2.188l-13.128,13.125a1.546,1.546 0,0 1,-2.187 0l-3.732,-3.73 -17.303,17.3c3.882,14.621 0.095,30.857 -11.37,42.32 -0.266,0.268 -0.535,0.529 -0.808,0.787 -1.004,0.955 -0.843,0.949 -1.813,-0.021L47.597,86.48 0,122.867l36.399,-47.584L11.874,50.76c-0.978,-0.98 -0.896,-0.826 0.066,-1.837 0.24,-0.251 0.485,-0.503 0.734,-0.753C24.137,36.707 40.376,32.917 54.996,36.8l17.301,-17.3 -3.733,-3.732a1.553,1.553 0,0 1,0 -2.188L81.691,0.451a1.554,1.554 0,0 1,2.189 0z" />
</vector>

View File

@ -41,8 +41,8 @@
<TextView
android:id="@+id/conversationViewDisplayNameTextView"
android:contentDescription="@string/AccessibilityId_conversation_list_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/unreadCountIndicator"
app:layout_constraintTop_toTopOf="parent"
@ -57,7 +57,6 @@
android:textSize="@dimen/medium_font_size"
android:textStyle="bold"
android:textColor="?android:textColorPrimary"
app:drawableTint="?conversation_pinned_icon_color"
tools:drawableRight="@drawable/ic_pin"
tools:text="I'm a very long display name. What are you going to do about it?" />