Display a generated avatar icon rather than a single default.

If the contact doesn't have an image, render a color-coded
background and the first letter of the contact's name.

1) Don't display anything during recipient resolution.

2) Display a # icon in material gray for recipients with no name.

3) Display a material group icon in material gray for groups with
   no avatar icon set.

Closes #3104

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2015-05-04 11:36:18 -07:00
parent 356d9949b7
commit 41cad291f9
24 changed files with 342 additions and 422 deletions

View File

@@ -26,17 +26,15 @@
android:layout_marginBottom="6dp"
android:layout_marginRight="0dp">
<org.thoughtcrime.securesms.components.ForegroundImageView
<org.thoughtcrime.securesms.components.AvatarImageView
android:id="@+id/contact_photo"
android:foreground="@drawable/contact_photo_background"
android:layout_width="40dp"
android:layout_height="40dp"
app:riv_oval="true"
android:layout_marginRight="10dp"
android:layout_alignParentLeft="true"
android:cropToPadding="true"
android:contentDescription="@string/conversation_item_received__contact_photo_description"
android:scaleType="centerCrop" />
android:contentDescription="@string/conversation_item_received__contact_photo_description" />
<org.thoughtcrime.securesms.components.IncomingBubbleContainer
android:id="@+id/bubble"

View File

@@ -17,14 +17,12 @@
android:paddingRight="10dp"
android:visibility="visible">
<com.makeramen.RoundedImageView
<org.thoughtcrime.securesms.components.AvatarImageView
android:id="@+id/contact_photo_image"
android:foreground="@drawable/contact_photo_background"
android:layout_width="50dp"
android:layout_height="50dp"
app:riv_oval="true"
android:cropToPadding="true"
android:scaleType="centerCrop"
android:visibility="gone"
tools:src="@drawable/ic_contact_picture"
android:contentDescription="@string/conversation_list_item_view__contact_photo_image"
@@ -49,7 +47,8 @@
android:weightSum="1"
android:gravity="bottom">
<TextView android:id="@+id/from"
<org.thoughtcrime.securesms.components.FromTextView
android:id="@+id/from"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@@ -9,10 +9,9 @@
android:paddingLeft="10dp"
android:paddingRight="10dp">
<com.makeramen.RoundedImageView
<org.thoughtcrime.securesms.components.AvatarImageView
android:id="@+id/contact_photo_image"
android:foreground="@drawable/contact_photo_background"
app:riv_oval="true"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerVertical="true"
@@ -21,7 +20,6 @@
android:layout_marginBottom="3dp"
android:layout_marginRight="10dp"
android:cropToPadding="true"
android:scaleType="centerCrop"
tools:src="@drawable/ic_contact_picture"
android:contentDescription="@string/SingleContactSelectionActivity_contact_photo" />
@@ -38,7 +36,8 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:id="@+id/from"
<org.thoughtcrime.securesms.components.FromTextView
android:id="@+id/from"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"

View File

@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:paddingRight="25dip">
<com.makeramen.RoundedImageView
<ImageView
android:id="@+id/contact_photo_image"
android:layout_width="@dimen/contact_selection_photo_size"
android:layout_height="@dimen/contact_selection_photo_size"
@@ -15,7 +14,6 @@
android:layout_marginLeft="10dp"
android:cropToPadding="true"
android:scaleType="centerCrop"
app:riv_oval="true"
android:contentDescription="@string/SingleContactSelectionActivity_contact_photo" />
<TextView android:id="@+id/number"

View File

@@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.makeramen.RoundedImageView
<org.thoughtcrime.securesms.components.AvatarImageView
android:id="@+id/contact_photo_image"
android:foreground="@drawable/contact_photo_background"
android:layout_width="50dp"
@@ -17,8 +17,6 @@
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:cropToPadding="true"
android:scaleType="centerCrop"
app:riv_oval="true"
android:contentDescription="@string/SingleContactSelectionActivity_contact_photo" />
<LinearLayout
@@ -32,7 +30,8 @@
android:layout_toRightOf="@id/contact_photo_image"
android:orientation="vertical">
<TextView android:id="@+id/from"
<org.thoughtcrime.securesms.components.FromTextView
android:id="@+id/from"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="0dp"

View File

@@ -113,4 +113,5 @@
</declare-styleable>
<attr name="group_members_dialog_icon" format="reference"/>
</resources>