--- a/project.properties Tue May 08 18:41:02 2012 +0200
+++ b/project.properties Wed May 09 14:38:23 2012 +0200
@@ -8,4 +8,4 @@
# project structure.
# Project target.
-target=android-15
+target=android-7
Binary file res/drawable/beem_status_icon_available.png has changed
Binary file res/drawable/beem_status_icon_away.png has changed
Binary file res/drawable/beem_status_icon_busy.png has changed
Binary file res/drawable/beem_status_icon_gray.png has changed
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java Tue May 08 18:41:02 2012 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java Wed May 09 14:38:23 2012 +0200
@@ -328,7 +328,7 @@
mPreviousPriority = p;
pres.setPriority(p);
mAdaptee.sendPacket(pres);
- updateNotification(m);
+ updateNotification(Status.getStatusFromPresence(pres), m);
}
/**
@@ -368,10 +368,9 @@
* Update the notification for the Beem status.
* @param text the text to display.
*/
- private void updateNotification(String text) {
+ private void updateNotification(int status, String text) {
Notification mStatusNotification;
- mStatusNotification = new Notification(com.beem.project.beem.R.drawable.beem_status_icon, text, System
- .currentTimeMillis());
+ mStatusNotification = new Notification(Status.getIconBarFromStatus(status), text, System.currentTimeMillis());
mStatusNotification.defaults = Notification.DEFAULT_LIGHTS;
mStatusNotification.flags = Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT;
@@ -684,6 +683,8 @@
intent, PendingIntent.FLAG_ONE_SHOT));
int id = packet.hashCode();
mService.sendNotification(id, notif);
+ Presence p = (Presence) packet;
+ updateNotification(Status.getStatusFromPresence(p), p.getStatus());
}
}, filter);
--- a/src/com/beem/project/beem/utils/Status.java Tue May 08 18:41:02 2012 +0200
+++ b/src/com/beem/project/beem/utils/Status.java Wed May 09 14:38:23 2012 +0200
@@ -46,6 +46,8 @@
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.Presence.Mode;
+import com.beem.project.beem.R;
+
/**
* Utility class to deal with status and presence value.
* @author marseille
@@ -153,4 +155,27 @@
return status != Status.CONTACT_STATUS_DISCONNECT;
}
+ public static int getIconBarFromStatus(final int status) {
+ int icon = R.drawable.beem_status_icon;
+ switch (status) {
+ case Status.CONTACT_STATUS_AVAILABLE:
+ icon = R.drawable.beem_status_icon_available;
+ break;
+ case Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT:
+ icon = R.drawable.beem_status_icon_available;
+ break;
+ case Status.CONTACT_STATUS_AWAY:
+ icon = R.drawable.beem_status_icon_away;
+ break;
+ case Status.CONTACT_STATUS_BUSY:
+ icon = R.drawable.beem_status_icon_busy;
+ break;
+ case Status.CONTACT_STATUS_UNAVAILABLE:
+ icon = R.drawable.beem_status_icon_gray;
+ break;
+ default:
+ icon = R.drawable.beem_status_icon;
+ }
+ return icon;
+ }
}