diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-08-05 13:00:06 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-08-05 13:00:06 +0200 |
commit | 08755e56a5bf861c97eefd545f629ac67a804275 (patch) | |
tree | c7f5ce044e860d328cd87d30e88d7092a9f581c8 /src/eu/siacs/conversations/entities | |
parent | 9aba9a4059bdc1c2f369585ef6faeada320529d2 (diff) |
show own avatar after publication. no persistancy yet
Diffstat (limited to '')
-rw-r--r-- | src/eu/siacs/conversations/entities/Account.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/eu/siacs/conversations/entities/Account.java b/src/eu/siacs/conversations/entities/Account.java index 2be03ab1..61b104c4 100644 --- a/src/eu/siacs/conversations/entities/Account.java +++ b/src/eu/siacs/conversations/entities/Account.java @@ -12,12 +12,15 @@ import org.json.JSONException; import org.json.JSONObject; import eu.siacs.conversations.crypto.OtrEngine; +import eu.siacs.conversations.persistance.FileBackend; import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.xmpp.XmppConnection; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.net.Uri; public class Account extends AbstractEntity{ @@ -58,6 +61,7 @@ public class Account extends AbstractEntity{ protected String resource = "mobile"; protected int status = -1; protected JSONObject keys = new JSONObject(); + protected String avatar; protected boolean online = false; @@ -322,6 +326,23 @@ public class Account extends AbstractEntity{ } public Bitmap getImage(Context context, int size) { - return UIHelper.getContactPicture(getJid(), size, context, false); + if (this.avatar!=null) { + Bitmap bm = BitmapFactory.decodeFile(FileBackend.getAvatarPath(context, avatar)); + if (bm==null) { + return UIHelper.getContactPicture(getJid(), size, context, false); + } else { + return bm; + } + } else { + return UIHelper.getContactPicture(getJid(), size, context, false); + } + } + + public void setAvatar(String filename) { + this.avatar = filename; + } + + public String getAvatar() { + return this.avatar; } } |