# HG changeset patch # User Da Risk # Date 1260992937 -3600 # Node ID 0536a2190b29e1dab363476ef0008f0a7fcec064 # Parent 67d1680588db41ad59c832b4a7c9b3c89e25759e simplify contactlist row layout diff -r 67d1680588db -r 0536a2190b29 res/layout/contactlistcontact.xml --- 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 @@ - - - - - + 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" > + + + diff -r 67d1680588db -r 0536a2190b29 src/com/beem/project/beem/ui/ContactList.java --- 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 mIconsMap = new HashMap(); + private final Map mIconsMap = new HashMap(); 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());