--- a/res/layout/contactlistcontact.xml Wed Dec 16 00:54:42 2009 +0100
+++ b/res/layout/contactlistcontact.xml Wed Dec 16 20:48:57 2009 +0100
@@ -1,25 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="horizontal" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:paddingLeft="10px"
- android:paddingRight="10px" android:paddingTop="8dip"
- android:paddingBottom="8dip" android:gravity="center_vertical">
- <ImageView android:id="@+id/contactliststatus"
- android:adjustViewBounds="true" android:layout_width="wrap_content"
- android:layout_height="wrap_content" android:gravity="center_vertical" />
- <LinearLayout android:orientation="vertical"
- android:layout_weight="1" android:layout_width="fill_parent"
- android:layout_height="wrap_content">
- <TextView android:id="@+id/contactlistpseudo"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:paddingLeft="16px" android:singleLine="true"
- android:maxLines="1" android:textColor="@color/white"
- android:textSize="18sp" android:textStyle="bold" />
- <TextView android:id="@+id/contactlistmsgperso"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:paddingLeft="16px" android:singleLine="true"
- android:maxLines="1" android:linksClickable="false" android:autoLink="all"
- android:scrollHorizontally="true" android:textColorLink="@color/white"
- android:textSize="12px" />
- </LinearLayout>
+ android:orientation="vertical" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:paddingLeft="10px"
+ android:paddingRight="10px" android:paddingTop="8dip"
+ android:paddingBottom="8dip" >
+ <TextView android:id="@+id/contactlistpseudo"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:maxLines="1" android:textColor="@color/white"
+ android:drawablePadding="12px"
+ android:textSize="18sp" android:textStyle="bold" />
+
+ <TextView android:id="@+id/contactlistmsgperso"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:paddingLeft="30px" android:singleLine="true"
+ android:maxLines="1" android:linksClickable="false" android:autoLink="all"
+ android:scrollHorizontally="true" android:textColorLink="@color/white"
+ android:textSize="12sp" />
</LinearLayout>
--- a/src/com/beem/project/beem/ui/ContactList.java Wed Dec 16 00:54:42 2009 +0100
+++ b/src/com/beem/project/beem/ui/ContactList.java Wed Dec 16 20:48:57 2009 +0100
@@ -81,6 +81,7 @@
import android.widget.TextView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
+import android.graphics.drawable.BitmapDrawable;
import com.beem.project.beem.R;
import com.beem.project.beem.service.Contact;
@@ -119,7 +120,7 @@
private SharedPreferences mSettings;
private final ServiceConnection mServConn = new BeemServiceConnection();
private BeemBroadcastReceiver mReceiver;
- private final Map<Integer, Bitmap> mIconsMap = new HashMap<Integer, Bitmap>();
+ private final Map<Integer, BitmapDrawable> mIconsMap = new HashMap<Integer, BitmapDrawable>();
private LayoutInflater mInflater;
/**
@@ -145,7 +146,7 @@
mReceiver = new BeemBroadcastReceiver(mServConn);
this.registerReceiver(mReceiver, new IntentFilter(BeemBroadcastReceiver.BEEM_CONNECTION_CLOSED));
- mInflater = LayoutInflater.from(this);
+ mInflater = getLayoutInflater();
prepareIconsStatus();
}
@@ -409,16 +410,16 @@
* Prepare Bitmap Map.
*/
private void prepareIconsStatus() {
- mIconsMap.put(Status.CONTACT_STATUS_AVAILABLE, BitmapFactory.decodeResource(getResources(),
- R.drawable.status_available));
- mIconsMap.put(Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT, BitmapFactory.decodeResource(getResources(),
- R.drawable.status_available));
- mIconsMap.put(Status.CONTACT_STATUS_AWAY, BitmapFactory.decodeResource(getResources(), R.drawable.status_away));
- mIconsMap.put(Status.CONTACT_STATUS_BUSY, BitmapFactory.decodeResource(getResources(), R.drawable.status_dnd));
- mIconsMap.put(Status.CONTACT_STATUS_DISCONNECT, BitmapFactory.decodeResource(getResources(),
- R.drawable.status_offline));
- mIconsMap.put(Status.CONTACT_STATUS_UNAVAILABLE, BitmapFactory.decodeResource(getResources(),
- R.drawable.status_requested));
+ mIconsMap.put(Status.CONTACT_STATUS_AVAILABLE, new BitmapDrawable(BitmapFactory.decodeResource(getResources(),
+ R.drawable.status_available)));
+ mIconsMap.put(Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT, new BitmapDrawable(BitmapFactory.decodeResource(getResources(),
+ R.drawable.status_available)));
+ mIconsMap.put(Status.CONTACT_STATUS_AWAY, new BitmapDrawable(BitmapFactory.decodeResource(getResources(), R.drawable.status_away)));
+ mIconsMap.put(Status.CONTACT_STATUS_BUSY, new BitmapDrawable(BitmapFactory.decodeResource(getResources(), R.drawable.status_dnd)));
+ mIconsMap.put(Status.CONTACT_STATUS_DISCONNECT, new BitmapDrawable(BitmapFactory.decodeResource(getResources(),
+ R.drawable.status_offline)));
+ mIconsMap.put(Status.CONTACT_STATUS_UNAVAILABLE, new BitmapDrawable(BitmapFactory.decodeResource(getResources(),
+ R.drawable.status_requested)));
}
/**
@@ -681,9 +682,8 @@
private void bindView(View view, Contact curContact) {
if (curContact != null) {
- ImageView imgV = (ImageView) view.findViewById(R.id.contactliststatus);
TextView v = (TextView) view.findViewById(R.id.contactlistpseudo);
- imgV.setImageBitmap(mIconsMap.get(curContact.getStatus()));
+ v.setCompoundDrawablesWithIntrinsicBounds(mIconsMap.get(curContact.getStatus()), null, null, null);
v.setText(curContact.getName());
v = (TextView) view.findViewById(R.id.contactlistmsgperso);
v.setText(curContact.getMsgState());