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

@@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.jobs;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.util.Log;
import org.thoughtcrime.securesms.Release;
@@ -74,7 +75,7 @@ public class AvatarDownloadJob extends MasterSecretJob {
Recipient groupRecipient = RecipientFactory.getRecipientsFromString(context, GroupUtil.getEncodedId(groupId), true)
.getPrimaryRecipient();
groupRecipient.setContactPhoto(avatar);
groupRecipient.setContactPhoto(new BitmapDrawable(avatar));
}
} catch (InvalidMessageException | BitmapDecodingException | NonSuccessfulResponseCodeException e) {
Log.w(TAG, e);