# HG changeset patch
# User marseille@KungFuh
# Date 1238800956 -7200
# Node ID aa70a805da1760c776d72c02ddeea0efddbf3d4f
# Parent ff98ffba21f4a5490befd85b6256e95d82ef5907
Ajout de nombreux icones pour la gestion des status.
diff -r ff98ffba21f4 -r aa70a805da17 res/drawable/away.png
Binary file res/drawable/away.png has changed
diff -r ff98ffba21f4 -r aa70a805da17 res/drawable/chat.png
Binary file res/drawable/chat.png has changed
diff -r ff98ffba21f4 -r aa70a805da17 res/drawable/closed.png
Binary file res/drawable/closed.png has changed
diff -r ff98ffba21f4 -r aa70a805da17 res/drawable/connecting.png
Binary file res/drawable/connecting.png has changed
diff -r ff98ffba21f4 -r aa70a805da17 res/drawable/dnd.png
Binary file res/drawable/dnd.png has changed
diff -r ff98ffba21f4 -r aa70a805da17 res/drawable/error.png
Binary file res/drawable/error.png has changed
diff -r ff98ffba21f4 -r aa70a805da17 res/drawable/invisible.png
Binary file res/drawable/invisible.png has changed
diff -r ff98ffba21f4 -r aa70a805da17 res/drawable/message.png
Binary file res/drawable/message.png has changed
diff -r ff98ffba21f4 -r aa70a805da17 res/drawable/not_in_the_roster.png
Binary file res/drawable/not_in_the_roster.png has changed
diff -r ff98ffba21f4 -r aa70a805da17 res/drawable/offline.png
Binary file res/drawable/offline.png has changed
diff -r ff98ffba21f4 -r aa70a805da17 res/drawable/online.png
Binary file res/drawable/online.png has changed
diff -r ff98ffba21f4 -r aa70a805da17 res/drawable/requested.png
Binary file res/drawable/requested.png has changed
diff -r ff98ffba21f4 -r aa70a805da17 res/layout/contactlistcontact.xml
--- a/res/layout/contactlistcontact.xml Fri Apr 03 01:26:42 2009 +0200
+++ b/res/layout/contactlistcontact.xml Sat Apr 04 01:22:36 2009 +0200
@@ -2,25 +2,34 @@
-
+
+
-
-
+
+
-
-
+
+
\ No newline at end of file
diff -r ff98ffba21f4 -r aa70a805da17 src/com/beem/project/beem/ui/ContactList.java
--- a/src/com/beem/project/beem/ui/ContactList.java Fri Apr 03 01:26:42 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Sat Apr 04 01:22:36 2009 +0200
@@ -10,6 +10,7 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
+import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
@@ -21,6 +22,7 @@
import android.view.ViewGroup;
import android.widget.ExpandableListAdapter;
import android.widget.ExpandableListView;
+import android.widget.ImageView;
import android.widget.SimpleExpandableListAdapter;
import android.widget.TextView;
@@ -39,6 +41,7 @@
private BeemApplication mBeemApplication;
private ContactListDialogSettings mDialog;
+ @SuppressWarnings("unchecked")
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
@@ -46,7 +49,7 @@
Map child = (HashMap) parent
.getExpandableListAdapter().getChild(groupPosition,
childPosition);
- i.putExtra("contact", child.get("CHILD"));
+ i.putExtra("contact", child.values().toArray());
startActivity(i);
return true;
}
@@ -67,17 +70,15 @@
SharedPreferences sharedPreferences, String key) {
/*
* TODO : A faire apres listener nikita
- *
- mBeemApplication.stopBeemService();
- mBeemApplication.startBeemService();
- mBeemApplication.callWhenServiceConnected(mHandler,
- new Runnable() {
- @Override
- public void run() {
- callbackShowContactList();
- }
- });
- */
+ *
+ * mBeemApplication.stopBeemService();
+ * mBeemApplication.startBeemService();
+ * mBeemApplication.callWhenServiceConnected(mHandler,
+ * new Runnable() {
+ *
+ * @Override public void run() {
+ * callbackShowContactList(); } });
+ */
}
});
@@ -179,7 +180,8 @@
for (int j = 0; j < listContact.size(); ++j) {
Map curChildMap = new HashMap();
children.add(curChildMap);
- curChildMap.put("CHILD", listContact.get(j));
+ Contact c = listContact.get(j);
+ curChildMap.put("CHILD", c);
}
childData.add(children);
}
@@ -188,7 +190,8 @@
R.layout.contactlistgroup, new String[] { "GROUP" },
new int[] { R.id.textgroup }, childData,
R.layout.contactlistcontact, new String[] { "CHILD" },
- new int[] { R.id.textchild1, R.id.textchild2, R.id.avatar });
+ new int[] { R.id.contactliststatus, R.id.contactlistpseudo,
+ R.id.contactlistmsgperso, R.id.contactlistavatar });
setListAdapter(Adapter);
}
@@ -197,7 +200,7 @@
* within the layout of an Expandable Lists children (Implement
* getGroupView() to define the layout of parents)
*/
- public class ContactExpandableListAdapter extends
+ private class ContactExpandableListAdapter extends
SimpleExpandableListAdapter {
private List extends List extends Map>> mChildData;
@@ -235,25 +238,60 @@
private void bindView(View view, Map data, String[] from,
int[] to, int groupPosition, int childPosition) {
- TextView v = (TextView) view.findViewById(to[0]);
Contact c = (Contact) data.get(from[0]);
- if (v != null) {
- Log.i(TAG, c.getJID());
- v.setText(c.getJID());
+
+ if (c != null) {
+
+ ImageView imgV = (ImageView) view.findViewById(to[0]);
+ Drawable imageDrawable = null;
+ switch (c.getStatus()) {
+ case Contact.CONTACT_STATUS_AVAILABLE:
+ imageDrawable = (Drawable) getResources().getDrawable(
+ R.drawable.avatar);
+ case Contact.CONTACT_STATUS_AVAILABLE_FOR_CHAT:
+ imageDrawable = (Drawable) getResources().getDrawable(
+ R.drawable.chat);
+ case Contact.CONTACT_STATUS_AWAY:
+ imageDrawable = (Drawable) getResources().getDrawable(
+ R.drawable.away);
+ case Contact.CONTACT_STATUS_BUSY:
+ imageDrawable = (Drawable) getResources().getDrawable(
+ R.drawable.dnd);
+ case Contact.CONTACT_STATUS_DISCONNECT:
+ imageDrawable = (Drawable) getResources().getDrawable(
+ R.drawable.offline);
+ case Contact.CONTACT_STATUS_UNAVAILABLE:
+ imageDrawable = (Drawable) getResources().getDrawable(
+ R.drawable.requested);
+ default:
+ imageDrawable = (Drawable) getResources().getDrawable(
+ R.drawable.error);
+ }
+ imgV.setImageDrawable(imageDrawable);
+
+ TextView v = (TextView) view.findViewById(to[1]);
+ if (v != null) {
+ v.setText(c.getJID());
+ }
+ /*
+ * @TODO: Rajouter le message perso du contact v = (TextView)
+ */
+ v = (TextView) view.findViewById(to[2]);
+ if (v != null) {
+ v.setText(c.getMMsgState());
+ }
+
+ /*
+ * @TODO: Rajouter l'avatar du contact getAvatar() dans la
+ * classe
+ */
+ imgV = (ImageView) view.findViewById(to[3]);
+ if (imgV != null) {
+ imageDrawable = (Drawable) getResources().getDrawable(
+ R.drawable.avatar);
+ imgV.setImageDrawable(imageDrawable);
+ }
}
- /*
- * @TODO: Rajouter le message perso du contact v = (TextView)
- * view.findViewById(to[1]); if (v != null) { Log.i(TAG,
- * c.getJID()); v.setText(c.getJID()); }
- */
- /*
- * @TODO: Rajouter l'avatar du contact getAvatar() dans la classe
- * Contact ImageView imgV = (ImageView) view.findViewById(to[2]); if
- * (imgV != null) { Drawable avatar = (Drawable)
- * getResources().getDrawable( R.drawable.avatar);
- * imgV.setImageDrawable(avatar); }
- */
}
}
-
-}
+}
\ No newline at end of file