Checkstyle
authorDa Risk <darisk972@gmail.com>
Tue, 17 Nov 2009 00:43:27 +0100
changeset 530 25f834f8c264
parent 527 d9e22d4c2bb2
child 531 e344b51f93ff
Checkstyle
src/com/beem/project/beem/service/XmppConnectionAdapter.java
src/com/beem/project/beem/service/XmppFacade.java
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Tue Nov 17 00:29:37 2009 +0100
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Tue Nov 17 00:43:27 2009 +0100
@@ -174,20 +174,23 @@
     @Override
     public void changeStatusAndPriority(int status, String msg, int priority) {
 	Presence pres = new Presence(Presence.Type.available);
+	String m;
 	if (msg != null)
-	    pres.setStatus(msg);
+	    m = msg;
 	else
-	    msg = "";
+	    m = "";
+	pres.setStatus(m);
 	Presence.Mode mode = Status.getPresenceModeFromStatus(status);
 	if (mode != null)
 	    pres.setMode(mode);
 	// Smack limit : Priority between -128 and 128
-	if (priority < -128) priority = -128;
-	if (priority > 128) priority = 128;
-	mPreviousPriority = priority;
-	pres.setPriority(priority);
+	int p = priority;
+	if (priority < -128) p = -128;
+	if (priority > 128) p = 128;
+	mPreviousPriority = p;
+	pres.setPriority(p);
 	mAdaptee.sendPacket(pres);
-	updateNotification(msg);
+	updateNotification(m);
     }
 
     /**
@@ -196,10 +199,12 @@
     @Override
     public void changeStatus(int status, String msg) {
 	Presence pres = new Presence(Presence.Type.available);
+	String m;
 	if (msg != null)
-	    pres.setStatus(msg);
+	    m = msg;
 	else
-	    msg = "";
+	    m = "";
+	pres.setStatus(m);
 	Presence.Mode mode = Status.getPresenceModeFromStatus(status);
 	if (mode != null)
 	    pres.setMode(mode);
@@ -208,6 +213,10 @@
 	updateNotification(msg);
     }
 
+    /**
+     * Update the notification for the Beem status.
+     * @param text the text to display.
+     */
     private void updateNotification(String text) {
  	Notification mStatusNotification;
 	mStatusNotification = new Notification(com.beem.project.beem.R.drawable.beem_status_icon, text, System
@@ -218,7 +227,7 @@
 	mStatusNotification.setLatestEventInfo(mService, "Beem Status", text, PendingIntent.getActivity(
 	    mService, 0, new Intent(mService, ChangeStatus.class), 0));
 	mService.sendNotification(BeemService.NOTIFICATION_STATUS_ID, mStatusNotification);
-   
+
     }
 
     /**
--- a/src/com/beem/project/beem/service/XmppFacade.java	Tue Nov 17 00:29:37 2009 +0100
+++ b/src/com/beem/project/beem/service/XmppFacade.java	Tue Nov 17 00:43:27 2009 +0100
@@ -4,9 +4,6 @@
 import org.jivesoftware.smack.packet.Presence;
 import org.jivesoftware.smackx.packet.VCard;
 
-import android.app.Notification;
-import android.app.PendingIntent;
-import android.content.Intent;
 import android.os.RemoteException;
 
 import com.beem.project.beem.BeemService;
@@ -16,9 +13,7 @@
 import com.beem.project.beem.service.aidl.IRoster;
 import com.beem.project.beem.service.aidl.IXmppConnection;
 import com.beem.project.beem.service.aidl.IXmppFacade;
-import com.beem.project.beem.ui.ChangeStatus;
 import com.beem.project.beem.utils.PresenceType;
-import com.beem.project.beem.utils.Status;
 
 /**
  * This class is a facade for the Beem Service.