src/com/beem/project/beem/ui/ContactList.java
changeset 461 17300b201cf5
parent 451 63cffd88721d
child 465 cdfe45072e7d
--- a/src/com/beem/project/beem/ui/ContactList.java	Fri Oct 09 16:56:20 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java	Thu Oct 15 17:36:51 2009 +0200
@@ -16,6 +16,8 @@
 import android.content.IntentFilter;
 import android.content.ServiceConnection;
 import android.graphics.BitmapFactory;
+import android.graphics.Color;
+import android.graphics.Typeface;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.Handler;
@@ -530,62 +532,46 @@
 		Drawable imageDrawable = null;
 		switch (curContact.getStatus()) {
 		    case Status.CONTACT_STATUS_AVAILABLE:
-			imageDrawable = getResources().getDrawable(R.drawable.online);
-			v.setTextColor(getResources().getColor(R.color.white));
+			imageDrawable = getResources().getDrawable(R.drawable.status_available);
 			break;
 		    case Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT:
-			imageDrawable = getResources().getDrawable(R.drawable.chat);
+			imageDrawable = getResources().getDrawable(R.drawable.status_available);
 			break;
 		    case Status.CONTACT_STATUS_AWAY:
-			imageDrawable = getResources().getDrawable(R.drawable.away);
+			imageDrawable = getResources().getDrawable(R.drawable.status_away);
 			break;
 		    case Status.CONTACT_STATUS_BUSY:
-			imageDrawable = getResources().getDrawable(R.drawable.dnd);
+			imageDrawable = getResources().getDrawable(R.drawable.status_dnd);
 			break;
 		    case Status.CONTACT_STATUS_DISCONNECT:
-			imageDrawable = getResources().getDrawable(R.drawable.offline);
+			imageDrawable = getResources().getDrawable(R.drawable.status_offline);
 			break;
 		    case Status.CONTACT_STATUS_UNAVAILABLE:
-			imageDrawable = getResources().getDrawable(R.drawable.requested);
+			imageDrawable = getResources().getDrawable(R.drawable.status_requested);
 			break;
 		    default:
-			imageDrawable = getResources().getDrawable(R.drawable.error);
+			imageDrawable = getResources().getDrawable(R.drawable.status_error);
 			break;
 		}
 		imgV.setImageDrawable(imageDrawable);
 
 		String mContactName = curContact.getName();
-		if ("".equals(mContactName)) {
+		if (mContactName == null || "".equals(mContactName)) {
 		    mContactName = curContact.getJID();
 		    mContactName = StringUtils.parseName(mContactName);
 		    if ("".equals(mContactName))
 			mContactName = curContact.getJID();
 		}
 		v.setText(mContactName);
+		v.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
+		v.setTextColor(Color.WHITE);
+		v.setTextSize(14);
 
 		v = (TextView) view.findViewById(R.id.contactlistmsgperso);
 		if (v != null) {
 		    v.setText(curContact.getMsgState());
-		}
-
-		/*
-		 * Rajouter l'avatar du contact getAvatar() dans la classe imgV = (ImageView)
-		 * view.findViewById(R.id.contactlistavatar); if (imgV != null) { imageDrawable =
-		 * getResources().getDrawable(R.drawable.avatar); imgV.setImageDrawable(imageDrawable); }
-		 */
-
-		if (false) {
-		    imgV = (ImageView) view.findViewById(R.id.contactlistavatar);
-
-		    byte[] rawImg;
-		    try {
-			// TODO: le faire en asynchrone, car la ca bloque tout.
-			rawImg = mXmppFacade.getVcardAvatar(curContact.getJID());
-			if (rawImg != null)
-			    imgV.setImageBitmap(BitmapFactory.decodeByteArray(rawImg, 0, rawImg.length));
-		    } catch (RemoteException e) {
-			e.printStackTrace();
-		    }
+		    v.setTextColor(Color.WHITE);
+		    v.setTextSize(12);
 		}
 	    }
 	}
@@ -636,6 +622,9 @@
 	public View getView(int position, View convertView, ViewGroup parent) {
 	    TextView i = new TextView(mContext);
 	    i.setText(mListGroup.get(position));
+	    i.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
+	    i.setTextColor(Color.WHITE);
+	    i.setHighlightColor(Color.RED);
 	    return i;
 	}