--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/drawable/status_icon.xml Mon May 24 18:57:37 2010 +0200
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Level list drawable for status icon
+ See src/com/beem/project/beem/utils/Status.java
+ for level values
+-->
+<level-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:maxLevel="100" android:drawable="@android:drawable/presence_offline" />
+ <item android:maxLevel="200" android:drawable="@drawable/status_requested" />
+ <item android:maxLevel="300" android:drawable="@android:drawable/presence_away" />
+ <item android:maxLevel="400" android:drawable="@android:drawable/presence_busy" />
+ <item android:maxLevel="600" android:drawable="@android:drawable/presence_online" />
+ </level-list>
--- a/res/layout/chat.xml Wed May 19 20:10:41 2010 +0200
+++ b/res/layout/chat.xml Mon May 24 18:57:37 2010 +0200
@@ -7,6 +7,7 @@
android:orientation="horizontal" android:gravity="center_vertical"
android:background="#222222" android:padding="4px">
<ImageView android:id="@+id/chat_contact_status_icon"
+ android:src="@drawable/status_icon"
android:adjustViewBounds="true" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:gravity="center_vertical" />
<LinearLayout android:orientation="vertical"
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java Wed May 19 20:10:41 2010 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java Mon May 24 18:57:37 2010 +0200
@@ -204,6 +204,8 @@
public boolean login() throws RemoteException {
if (mAdaptee.isAuthenticated())
return true;
+ if (!mAdaptee.isConnected())
+ return false;
try {
mAdaptee.login(mLogin, mPassword, mResource);
mChatManager = new BeemChatManager(mAdaptee.getChatManager(), mService);
--- a/src/com/beem/project/beem/ui/Chat.java Wed May 19 20:10:41 2010 +0200
+++ b/src/com/beem/project/beem/ui/Chat.java Mon May 24 18:57:37 2010 +0200
@@ -59,6 +59,7 @@
import android.content.ServiceConnection;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
+import android.graphics.drawable.LevelListDrawable;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
@@ -590,7 +591,7 @@
* Update the contact status icon.
*/
private void updateContactStatusIcon() {
- mContactStatusIcon.setImageBitmap(mStatusIconsMap.get(mContact.getStatus()));
+ mContactStatusIcon.setImageLevel(mContact.getStatus());
}
/**
--- a/src/com/beem/project/beem/ui/ContactList.java Wed May 19 20:10:41 2010 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Mon May 24 18:57:37 2010 +0200
@@ -60,6 +60,7 @@
import android.content.SharedPreferences;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.LevelListDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@@ -697,7 +698,9 @@
if (curContact != null) {
TextView v = (TextView) view.findViewById(R.id.contactlistpseudo);
- v.setCompoundDrawablesWithIntrinsicBounds(mIconsMap.get(curContact.getStatus()), null, null, null);
+ LevelListDrawable mStatusDrawable = (LevelListDrawable) getResources().getDrawable(R.drawable.status_icon);
+ mStatusDrawable.setLevel(curContact.getStatus());
+ v.setCompoundDrawablesWithIntrinsicBounds(mStatusDrawable, null, null, null);
v.setText(curContact.getName());
v = (TextView) view.findViewById(R.id.contactlistmsgperso);
v.setText(curContact.getMsgState());