forked from upstream-mirrors/quik
Use icon instead of question mark for avatars
This commit is contained in:
@@ -44,11 +44,16 @@ class AvatarView(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : Fr
|
||||
}
|
||||
|
||||
private fun updateView() {
|
||||
photo.setImageDrawable(null)
|
||||
initial.text = "?"
|
||||
if (contact?.name.orEmpty().isNotEmpty()) {
|
||||
initial.text = contact?.name?.substring(0, 1)
|
||||
icon.visibility = GONE
|
||||
} else {
|
||||
initial.text = null
|
||||
icon.visibility = VISIBLE
|
||||
}
|
||||
|
||||
photo.setImageDrawable(null)
|
||||
contact?.let { contact ->
|
||||
initial.text = if (contact.name.isNotEmpty()) contact.name.substring(0, 1) else "?"
|
||||
GlideApp.with(photo).load(PhoneNumberUtils.stripSeparators(contact.address)).into(photo)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v2h16v-2c0,-2.66 -5.33,-4 -8,-4z"/>
|
||||
</vector>
|
||||
@@ -4,6 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:background="@color/tools_theme"
|
||||
tools:parentTag="com.moez.QKSMS.presentation.view.AvatarView">
|
||||
|
||||
<TextView
|
||||
@@ -14,8 +15,17 @@
|
||||
android:gravity="center"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="@color/textPrimaryLight"
|
||||
android:textSize="20sp"
|
||||
tools:text="M" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/ic_person_black_24dp"
|
||||
android:tint="@color/white" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/photo"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
Reference in New Issue
Block a user