--- a/src/com/beem/project/beem/service/Contact.java Mon Nov 01 23:57:34 2010 +0100
+++ b/src/com/beem/project/beem/service/Contact.java Tue Nov 02 00:46:12 2010 +0100
@@ -261,6 +261,11 @@
return mStatus;
}
+ /**
+ * Get the avatar id of the contact.
+ *
+ * @return the avatar id or null if there is not
+ */
public String getAvatarId() {
return mAvatarId;
}
@@ -293,6 +298,11 @@
mID = mid;
}
+ /**
+ * Set the avatar id of the contact.
+ *
+ * @param avatarId the avatar id
+ */
public void setAvatarId(String avatarId) {
mAvatarId = avatarId;
}
--- a/src/com/beem/project/beem/service/RosterAdapter.java Mon Nov 01 23:57:34 2010 +0100
+++ b/src/com/beem/project/beem/service/RosterAdapter.java Tue Nov 02 00:46:12 2010 +0100
@@ -66,7 +66,6 @@
import com.beem.project.beem.R;
import com.beem.project.beem.service.aidl.IBeemRosterListener;
import com.beem.project.beem.utils.Status;
-import com.beem.project.beem.smack.avatar.AvatarMetadataExtension;
import com.beem.project.beem.smack.avatar.AvatarMetadataExtension.Info;
import com.beem.project.beem.smack.avatar.AvatarManager;
import com.beem.project.beem.smack.avatar.AvatarListener;
@@ -100,6 +99,7 @@
* Constructor.
* @param roster The roster to adapt.
* @param context The context of the RosterAdapter.
+ * @param avatarMgr The AvatarManager of the connection
*/
public RosterAdapter(final Roster roster, final Context context, final AvatarManager avatarMgr) {
mAdaptee = roster;
@@ -398,7 +398,12 @@
*
*/
private class AvatarEventListener implements AvatarListener {
-
+
+ /**
+ * Constructor.
+ */
+ public AvatarEventListener() { }
+
@Override
public void onAvatarChange(String from, String avatarId, List<Info> avatarInfos) {
String bare = StringUtils.parseBareAddress(from);
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java Mon Nov 01 23:57:34 2010 +0100
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java Tue Nov 02 00:46:12 2010 +0100
@@ -323,6 +323,11 @@
changeStatusAndPriority(status, msg, mPreviousPriority);
}
+ /**
+ * Get the AvatarManager of this connection.
+ *
+ * @return the AvatarManager or null if there is not
+ */
public AvatarManager getAvatarManager() {
return mAvatarManager;
}
--- a/src/com/beem/project/beem/service/XmppFacade.java Mon Nov 01 23:57:34 2010 +0100
+++ b/src/com/beem/project/beem/service/XmppFacade.java Tue Nov 02 00:46:12 2010 +0100
@@ -43,9 +43,7 @@
*/
package com.beem.project.beem.service;
-import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Presence;
-import org.jivesoftware.smackx.packet.VCard;
import android.os.RemoteException;
--- a/src/com/beem/project/beem/smack/avatar/AvatarListener.java Mon Nov 01 23:57:34 2010 +0100
+++ b/src/com/beem/project/beem/smack/avatar/AvatarListener.java Tue Nov 02 00:46:12 2010 +0100
@@ -1,10 +1,64 @@
+/*
+ BEEM is a videoconference application on the Android Platform.
+
+ Copyright (C) 2009 by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ This file is part of BEEM.
+
+ BEEM is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ BEEM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with BEEM. If not, see <http://www.gnu.org/licenses/>.
+
+ Please send bug reports with examples or suggestions to
+ contact@beem-project.com or http://dev.beem-project.com/
+
+ Epitech, hereby disclaims all copyright interest in the program "Beem"
+ written by Frederic-Charles Barthelery,
+ Jean-Manuel Da Silva,
+ Nikita Kozlov,
+ Philippe Lago,
+ Jean Baptiste Vergely,
+ Vincent Veronis.
+
+ Nicolas Sadirac, November 26, 2009
+ President of Epitech.
+
+ Flavien Astraud, November 26, 2009
+ Head of the EIP Laboratory.
+
+*/
package com.beem.project.beem.smack.avatar;
import java.util.List;
import com.beem.project.beem.smack.avatar.AvatarMetadataExtension.Info;
+/**
+ * A listener for avatar changes event.
+ *
+ */
public interface AvatarListener {
+ /**
+ * Event which is fired when a contact change avatar.
+ *
+ * @param from the contact who change his avatar
+ * @param avatarId the new avatar id, may be null if the contact set no avatar
+ * @param avatarInfos the metadata infos of the avatar, may be empty if the contact set no avatar
+ */
void onAvatarChange(String from, String avatarId, List<Info> avatarInfos);
}
--- a/src/com/beem/project/beem/smack/avatar/AvatarManager.java Mon Nov 01 23:57:34 2010 +0100
+++ b/src/com/beem/project/beem/smack/avatar/AvatarManager.java Tue Nov 02 00:46:12 2010 +0100
@@ -74,6 +74,7 @@
* Create an AvatarManager.
*
* @param con the connection
+ * @param pepMgr the PepSubManager of the Connection
* @param cache the cache which will store the avatars
* @param autoDownload true to enable auto download of avatars
*/
@@ -101,12 +102,22 @@
}
}
+ /**
+ * Add an AvatarListener.
+ *
+ * @param listener the AvatarListener to add
+ */
public void addAvatarListener(AvatarListener listener) {
if (!mListeners.contains(listener))
mListeners.add(listener);
}
- public void removeAvatarListener(AvatarListener listener){
+ /**
+ * Remove an AvatarListener.
+ *
+ * @param listener the AvatarListener to remove
+ */
+ public void removeAvatarListener(AvatarListener listener) {
mListeners.remove(listener);
}
@@ -123,8 +134,15 @@
return available.get(0);
}
+ /**
+ * Fire the listeners for avatar change.
+ *
+ * @param from the jid of the contact
+ * @param avatarId the new avatar id
+ * @param avatarInfos the metadata infos of the avatar
+ */
private void fireListeners(String from, String avatarId, List<Info> avatarInfos) {
- for(AvatarListener l : mListeners)
+ for (AvatarListener l : mListeners)
l.onAvatarChange(from, avatarId, avatarInfos);
}
@@ -132,7 +150,9 @@
* Download an avatar.
*
* @param from The jid of the user
+ * @param avatarId the id of the avatar
* @param info the metadata information of the avatar to download
+ * @return true if the download was successfull
*/
public boolean downloadAvatar(String from, String avatarId, Info info) {
try {
@@ -161,7 +181,7 @@
@Override
public void eventReceived(String from, String node, List<Item> items) {
- if (!node.equals("urn:xmpp:avatar:metadata"))
+ if (!"urn:xmpp:avatar:metadata".equals(node))
return;
Item i = items.get(0);
if (i instanceof PayloadItem) {
--- a/src/com/beem/project/beem/ui/ContactList.java Mon Nov 01 23:57:34 2010 +0100
+++ b/src/com/beem/project/beem/ui/ContactList.java Tue Nov 02 00:46:12 2010 +0100
@@ -666,7 +666,6 @@
Drawable d = null;
try {
String avatarId = curContact.getAvatarId();
- Log.d(TAG, "Avatar id = " + avatarId );
byte[] avatar = mXmppFacade.getAvatar(avatarId);
if (avatar != null) {
ByteArrayInputStream in = new ByteArrayInputStream(avatar);