Hop petit commit pour que popop puisse debugger.
--- a/res/layout/contactlistcontact.xml Tue Apr 07 01:18:19 2009 +0200
+++ b/res/layout/contactlistcontact.xml Tue Apr 07 12:25:02 2009 +0200
@@ -6,7 +6,7 @@
android:gravity="center_vertical" >
<ImageView android:id="@+id/contactliststatus"
- android:layout_weight="5"
+ android:layout_weight="5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical" />
--- a/src/com/beem/project/beem/service/Contact.java Tue Apr 07 01:18:19 2009 +0200
+++ b/src/com/beem/project/beem/service/Contact.java Tue Apr 07 12:25:02 2009 +0200
@@ -52,7 +52,8 @@
/**
* Construct a contact from a parcel.
- * @param in parcel to use for construction
+ * @param in
+ * parcel to use for construction
*/
private Contact(final Parcel in) {
mID = in.readInt();
@@ -60,7 +61,7 @@
mJID = in.readString();
mMsgState = in.readString();
mRes = new ArrayList<String>();
- in.readStringList(mRes);
+ in.readStringList(mRes);
}
/**
@@ -93,7 +94,8 @@
/**
* Constructor.
- * @param jid JID of the contact
+ * @param jid
+ * JID of the contact
*/
public Contact(final String jid) {
mJID = jid;
@@ -110,7 +112,8 @@
}
/**
- * @param mid the mID to set
+ * @param mid
+ * the mID to set
*/
public void setID(int mid) {
mID = mid;
@@ -124,21 +127,23 @@
}
/**
- * @param status the mStatus to set
+ * @param status
+ * the mStatus to set
*/
public void setStatus(int status) {
mStatus = status;
}
/**
- * @param presence the presence containing status
+ * @param presence
+ * the presence containing status
*/
public void setStatus(Presence presence) {
- if (presence.getType().equals(Presence.Type.unavailable)) {
- Log.d(TAG, "Presence pas dispo");
- mStatus = Contact.CONTACT_STATUS_DISCONNECT;
- } else {
- Log.d(TAG,"Presence OK");
+ Log.i(TAG, "NIKITAAAA");
+ /* presence.isAvailable() !?!? */
+ if (presence.getType().equals(Presence.Type.available)) {
+ mStatus = Contact.CONTACT_STATUS_AVAILABLE;
+ Log.d(TAG, "Presence OK");
Mode mode = presence.getMode();
switch (mode) {
case available:
@@ -158,9 +163,12 @@
break;
default:
Log.e("RosterAdapter", "Status mode non gere");
- mStatus = Contact.CONTACT_STATUS_DISCONNECT;
- break;
+ mStatus = Contact.CONTACT_STATUS_AVAILABLE;
+ break;
}
+ } else {
+ Log.d(TAG, "Presence pas dispo");
+ mStatus = Contact.CONTACT_STATUS_DISCONNECT;
}
}
@@ -172,7 +180,8 @@
}
/**
- * @param msgState the mMsgState to set
+ * @param msgState
+ * the mMsgState to set
*/
public void setMMsgState(String msgState) {
mMsgState = msgState;
@@ -188,7 +197,8 @@
/**
* Set the Jabber ID of the contact.
- * @param mjid the jabber ID to set
+ * @param mjid
+ * the jabber ID to set
*/
public void setJID(String mjid) {
mJID = mjid;
@@ -204,7 +214,8 @@
}
/**
- * @param mRes the mRes to set
+ * @param mRes
+ * the mRes to set
*/
public void setMRes(List<String> mRes) {
this.mRes = mRes;
--- a/src/com/beem/project/beem/ui/ContactList.java Tue Apr 07 01:18:19 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Tue Apr 07 12:25:02 2009 +0200
@@ -13,6 +13,7 @@
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
+import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import android.view.Menu;
@@ -29,6 +30,8 @@
import com.beem.project.beem.BeemApplication;
import com.beem.project.beem.R;
import com.beem.project.beem.service.Contact;
+import com.beem.project.beem.service.PresenceAdapter;
+import com.beem.project.beem.service.aidl.IBeemRosterListener;
import com.beem.project.beem.service.aidl.IXmppFacade;
import com.beem.project.beem.service.aidl.IRoster;
@@ -40,6 +43,8 @@
private Handler mHandler;
private BeemApplication mBeemApplication;
private ContactListDialogSettings mDialog;
+ private BeemRosterListener mRosterListener;
+ private IRoster mRoster;
@SuppressWarnings("unchecked")
@Override
@@ -62,6 +67,7 @@
mSettings = getSharedPreferences(
getString(R.string.PreferenceFileName), MODE_PRIVATE);
mDialog = new ContactListDialogSettings(this, mSettings);
+ mRosterListener = new BeemRosterListener();
mSettings
.registerOnSharedPreferenceChangeListener(new OnSharedPreferenceChangeListener() {
@@ -81,7 +87,6 @@
*/
}
});
-
}
@Override
@@ -102,6 +107,14 @@
mBeemApplication.callWhenConnectedToServer(mHandler, new Runnable() {
@Override
public void run() {
+ mService = mBeemApplication.getXmppFacade();
+ try {
+ mRoster = mService.getRoster();
+ mRoster.addConnectionListener(mRosterListener);
+ Log.i(TAG, "ROSTERLISTENER OK");
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
callbackShowContactList();
}
});
@@ -111,17 +124,12 @@
/*
* @TODO: A ameliorer apres listener de nikita
*/
- mService = mBeemApplication.getXmppFacade();
- if (mService != null) {
+ if (mRoster != null)
try {
- IRoster r = mService.getRoster();
- if (r != null)
- showContactList(r.getGroupsNames(), r.getContactList());
+ showContactList(mRoster.getGroupsNames(), mRoster.getContactList());
} catch (RemoteException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
- }
- }
+ }
}
/**
@@ -245,25 +253,32 @@
switch (c.getStatus()) {
case Contact.CONTACT_STATUS_AVAILABLE:
imageDrawable = (Drawable) getResources().getDrawable(
- R.drawable.avatar);
+ R.drawable.online);
+ break;
case Contact.CONTACT_STATUS_AVAILABLE_FOR_CHAT:
imageDrawable = (Drawable) getResources().getDrawable(
R.drawable.chat);
+ break;
case Contact.CONTACT_STATUS_AWAY:
imageDrawable = (Drawable) getResources().getDrawable(
R.drawable.away);
+ break;
case Contact.CONTACT_STATUS_BUSY:
imageDrawable = (Drawable) getResources().getDrawable(
R.drawable.dnd);
+ break;
case Contact.CONTACT_STATUS_DISCONNECT:
imageDrawable = (Drawable) getResources().getDrawable(
R.drawable.offline);
+ break;
case Contact.CONTACT_STATUS_UNAVAILABLE:
imageDrawable = (Drawable) getResources().getDrawable(
R.drawable.requested);
+ break;
default:
imageDrawable = (Drawable) getResources().getDrawable(
R.drawable.error);
+ break;
}
imgV.setImageDrawable(imageDrawable);
@@ -292,4 +307,33 @@
}
}
}
+
+ private class BeemRosterListener extends IBeemRosterListener.Stub {
+
+ @Override
+ public void onEntriesAdded(List<String> addresses)
+ throws RemoteException {
+ Log.i(TAG, "ENTRIES ADDED");
+
+ }
+ @Override
+ public void onEntriesDeleted(List<String> addresses)
+ throws RemoteException {
+ Log.i(TAG, "ENTRIES DEL");
+
+ }
+ @Override
+ public void onEntriesUpdated(List<String> addresses)
+ throws RemoteException {
+ Log.i(TAG, "ENTRIES UPD");
+
+ }
+ @Override
+ public void onPresenceChanged(PresenceAdapter presence)
+ throws RemoteException {
+ Log.i(TAG, "PRESENCE CHANGED " + ((Contact) presence).getStatus());
+
+ }
+
+ }
}
\ No newline at end of file