mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-21 21:57:19 +00:00
Use contact photo placeholders
This commit is contained in:
parent
29248811f7
commit
8d99da214b
1 changed files with 13 additions and 10 deletions
|
@ -355,8 +355,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avatars || identicons) {
|
if (avatars || identicons) {
|
||||||
ivAvatar.setVisibility(compact ? View.GONE : View.INVISIBLE);
|
|
||||||
|
|
||||||
Bundle aargs = new Bundle();
|
Bundle aargs = new Bundle();
|
||||||
aargs.putLong("id", message.id);
|
aargs.putLong("id", message.id);
|
||||||
aargs.putString("uri", message.avatar);
|
aargs.putString("uri", message.avatar);
|
||||||
|
@ -366,6 +364,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
ivAvatar.setTag(message.id);
|
ivAvatar.setTag(message.id);
|
||||||
|
|
||||||
new SimpleTask<Drawable>() {
|
new SimpleTask<Drawable>() {
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute(Bundle args) {
|
||||||
|
ivAvatar.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Drawable onExecute(Context context, Bundle args) {
|
protected Drawable onExecute(Context context, Bundle args) {
|
||||||
String uri = args.getString("uri");
|
String uri = args.getString("uri");
|
||||||
|
@ -380,24 +383,24 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
}
|
}
|
||||||
|
|
||||||
String from = args.getString("from");
|
String from = args.getString("from");
|
||||||
if (identicons && !outgoing && from != null) {
|
if (identicons && !outgoing && from != null)
|
||||||
return new BitmapDrawable(
|
return new BitmapDrawable(
|
||||||
context.getResources(),
|
context.getResources(),
|
||||||
Identicon.generate(from, dp24, 5, "light".equals(theme)));
|
Identicon.generate(from, dp24, 5, "light".equals(theme)));
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onExecuted(Bundle args, Drawable avatar) {
|
protected void onExecuted(Bundle args, Drawable avatar) {
|
||||||
if (avatar != null) {
|
if ((long) ivAvatar.getTag() == args.getLong("id")) {
|
||||||
if ((long) ivAvatar.getTag() == args.getLong("id")) {
|
if (avatar == null && !outgoing)
|
||||||
|
ivAvatar.setImageResource(R.drawable.baseline_person_24);
|
||||||
|
else
|
||||||
ivAvatar.setImageDrawable(avatar);
|
ivAvatar.setImageDrawable(avatar);
|
||||||
ivAvatar.setVisibility(View.VISIBLE);
|
ivAvatar.setVisibility(View.VISIBLE);
|
||||||
} else
|
} else
|
||||||
Log.i("Skipping avatar");
|
Log.i("Skipping avatar");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue