pas mal de cleannance et aussi du debug sur les decos
authorNikita Kozlov <nikita@beem-project.com>
Sat, 26 Sep 2009 01:15:19 +0200
changeset 402 4684a42ae0ad
parent 401 551bc80197f5 (diff)
parent 400 6aeddf8aa255 (current diff)
child 403 ae8dfe45b0c9
child 404 3c8ca2a1a327
pas mal de cleannance et aussi du debug sur les decos
res/values-en/strings.xml
res/values-fr/arrays.xml
res/values-fr/strings.xml
src/com/beem/project/beem/BeemService.java
src/com/beem/project/beem/service/RosterAdapter.java
src/com/beem/project/beem/service/XmppConnectionAdapter.java
src/com/beem/project/beem/service/XmppFacade.java
src/com/beem/project/beem/ui/ChangeStatus.java
src/com/beem/project/beem/ui/ContactList.java
src/com/beem/project/beem/ui/EditSettings.java
src/com/beem/project/beem/ui/Login.java
src/com/beem/project/beem/utils/BeemBroadcastReceiver.java
--- a/res/values-en/arrays.xml	Fri Sep 25 19:01:30 2009 +0200
+++ b/res/values-en/arrays.xml	Sat Sep 26 01:15:19 2009 +0200
@@ -5,4 +5,12 @@
 		<item>SOCKS4</item>
 		<item>SOCKS5</item>
 	</string-array>
+	<string-array name="status_types">
+		<item name="AvailableForChat">Available for chat</item>
+		<item name="Available">Available</item>
+		<item name="Busy">Busy</item>
+		<item name="Away">Away</item>
+		<item name="Unavailable">Unavailable</item>
+		<item name="Disconnected">Disconnected</item>
+	</string-array>
 </resources>
--- a/res/values-en/strings.xml	Fri Sep 25 19:01:30 2009 +0200
+++ b/res/values-en/strings.xml	Sat Sep 26 01:15:19 2009 +0200
@@ -95,6 +95,10 @@
 	<!--  BeemBroadcastReceiver class -->
 	<string name="BeemBroadcastReceiverDisconnect">You have been disconnected</string>
 	
+	<!--  XmppConnectionAdapter class -->
+	<string name="AcceptContactRequest">Accept contact request</string>
+	<string name="AcceptContactRequestFrom">Accept contact request from </string>
+	
     <!--
     	Services
     -->
--- a/res/values-fr/arrays.xml	Fri Sep 25 19:01:30 2009 +0200
+++ b/res/values-fr/arrays.xml	Sat Sep 26 01:15:19 2009 +0200
@@ -5,4 +5,12 @@
 		<item>SOCKS4</item>
 		<item>SOCKS5</item>
 	</string-array>
+	<string-array name="status_types">
+		<item>Disponnible pour discuter</item>
+		<item>Disponnible</item>
+		<item>Occupé</item>
+		<item>Absent</item>
+		<item>Indisponnible</item>
+		<item>Déconnecté</item>
+	</string-array>
 </resources>
--- a/res/values-fr/strings.xml	Fri Sep 25 19:01:30 2009 +0200
+++ b/res/values-fr/strings.xml	Sat Sep 26 01:15:19 2009 +0200
@@ -93,6 +93,10 @@
 	<!--  BeemBroadcastReceiver class -->
 	<string name="BeemBroadcastReceiverDisconnect">Vous avez été déconnecté</string>
 	
+	<!--  XmppConnectionAdapter class -->
+	<string name="AcceptContactRequest">Accept contact request</string>
+	<string name="AcceptContactRequestFrom">Accept contact request from </string>
+	
     <!--
     	Services
     -->
--- a/src/com/beem/project/beem/BeemService.java	Fri Sep 25 19:01:30 2009 +0200
+++ b/src/com/beem/project/beem/BeemService.java	Sat Sep 26 01:15:19 2009 +0200
@@ -58,14 +58,6 @@
     }
 
     /**
-     * Close the connection to the xmpp server.
-     */
-    private void closeConnection() {
-	if (mConnection != null)
-	    mConnection.disconnect();
-    }
-
-    /**
      * Initialise la configuration de la connexion.
      */
     private void initConnectionConfig() {
@@ -107,7 +99,7 @@
 	Log.e("BEEMSERVICE", "ONBIND()");
 	return mBind;
     }
-    
+
     /**
      * {@inheritDoc}
      */
@@ -133,7 +125,7 @@
 	initConnectionConfig();
 	mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
 	mConnection = new XmppConnectionAdapter(mConnectionConfiguration, mLogin, mPassword, this);
-	
+
 	Roster.setDefaultSubscriptionMode(SubscriptionMode.manual);
 	mBind = new XmppFacade(mConnection, this, mJingle);
 	mJingle = new JingleService(mConnection.getAdaptee());
@@ -145,9 +137,8 @@
     @Override
     public void onDestroy() {
 	super.onDestroy();
-	closeConnection();
 	mNotificationManager.cancel(NOTIFICATION_STATUS_ID);
-	Log.e("BEEEMSERVICE", "ONDESTROY");
+	Log.d("BEEEMSERVICE", "ONDESTROY");
     }
 
     /**
@@ -181,7 +172,11 @@
 	edit.commit();
     }
 
+    /**
+     * init jingle from XmppConnectionAdapter.
+     * @param adaptee XmppConntection used for jingle.
+     */
     public void initJingle(XMPPConnection adaptee) {
-	mJingle.initWhenConntected(adaptee);	
+	mJingle.initWhenConntected(adaptee);
     }
 }
--- a/src/com/beem/project/beem/service/RosterAdapter.java	Fri Sep 25 19:01:30 2009 +0200
+++ b/src/com/beem/project/beem/service/RosterAdapter.java	Sat Sep 26 01:15:19 2009 +0200
@@ -294,7 +294,7 @@
 		} catch (RemoteException e) {
 		    // The RemoteCallbackList will take care of removing the
 		    // dead listeners.
-		    Log.w(TAG, "Error while updating roster entries", e);
+		    Log.w(TAG, "Error while updating roster presence entries", e);
 		}
 	    }
 	    mRemoteRosListeners.finishBroadcast();
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Fri Sep 25 19:01:30 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Sat Sep 26 01:15:19 2009 +0200
@@ -21,6 +21,7 @@
 import android.os.RemoteException;
 import android.util.Log;
 
+import com.beem.project.beem.R;
 import com.beem.project.beem.BeemService;
 import com.beem.project.beem.service.aidl.IBeemConnectionListener;
 import com.beem.project.beem.service.aidl.IChatManager;
@@ -34,8 +35,11 @@
  */
 public class XmppConnectionAdapter extends IXmppConnection.Stub {
 
+    /**
+     * Beem connection closed Intent name.
+     */
+    public static final String BEEM_CONNECTION_CLOSED = "BeemConnectionClosed";
     private static final String TAG = "XMPPConnectionAdapter";
-    public static final String BEEM_CONNECTION_CLOSED = "BeemConnectionClosed";
     private XMPPConnection mAdaptee;
     private IChatManager mChatManager;
     private String mLogin;
@@ -109,7 +113,7 @@
 		try {
 		    connectSync();
 		} catch (RemoteException e) {
-		    Log.e(TAG, "Error while connecting", e);
+		    Log.e(TAG, "Error while connecting asynchronously", e);
 		}
 	    }
 	});
@@ -135,11 +139,11 @@
 	    triggerAsynchronousConnectEvent();
 	    //Priority between -128 and 128
 	    Presence p = new Presence(Presence.Type.available, "Beem : http://www.beem-project.com",
-		    128, Presence.Mode.available);
+		128, Presence.Mode.available);
 	    mAdaptee.sendPacket(p);
 	    return true;
 	} catch (XMPPException e) {
-	    Log.e(TAG, "Error while connecting", e);
+	    Log.d(TAG, "Error while connecting", e);
 	    if (e.getXMPPError() != null && e.getXMPPError().getMessage() != null)
 		mConListener.connectionFailed(e.getXMPPError().getMessage());
 	    else
@@ -234,10 +238,10 @@
 
     /**
      * Set the privacy list to use.
-     * @param mPrivacyList the mPrivacyList to set
+     * @param privacyList the mPrivacyList to set
      */
-    public void setPrivacyList(PrivacyListManagerAdapter PrivacyList) {
-	this.mPrivacyList = PrivacyList;
+    public void setPrivacyList(PrivacyListManagerAdapter privacyList) {
+	this.mPrivacyList = privacyList;
     }
 
     /**
@@ -249,13 +253,11 @@
     }
 
     /**
-     * Listener for XMPP connection events. It will calls the remote listeners for connexion events.
+     * Listener for XMPP connection events. It will calls the remote listeners for connection events.
      * @author darisk
      */
     private class ConnexionListenerAdapter implements ConnectionListener {
 
-	
-
 	/**
 	 * Defaut constructor.
 	 */
@@ -267,24 +269,9 @@
 	 */
 	@Override
 	public void connectionClosed() {
+	    Log.d(TAG, "closing connection");
 	    mRoster = null;
-
-	    /*final int n = mRemoteConnListeners.beginBroadcast();
-
-	    for (int i = 0; i < n; i++) {
-		IBeemConnectionListener listener = mRemoteConnListeners.getBroadcastItem(i);
-		try {
-		    if (listener != null)
-			listener.connectionClosed();
-		} catch (RemoteException e) {
-		    // The RemoteCallbackList will take care of removing the
-		    // dead listeners.
-		    Log.w(TAG, "Error while triggering remote connection listeners", e);
-		}
-	    }
-	    mRemoteConnListeners.finishBroadcast();*/
-	    Intent closedIntent = new Intent(BEEM_CONNECTION_CLOSED);
-	    mService.sendBroadcast(closedIntent);
+	    mService.sendBroadcast(new Intent(BEEM_CONNECTION_CLOSED));
 	    mService.stopSelf();
 	}
 
@@ -293,6 +280,7 @@
 	 */
 	@Override
 	public void connectionClosedOnError(Exception arg0) {
+	    Log.d(TAG, "connectionClosedOnError");
 	    mRoster = null;
 	    final int n = mRemoteConnListeners.beginBroadcast();
 
@@ -310,8 +298,12 @@
 	    mRemoteConnListeners.finishBroadcast();
 	}
 
+	/**
+	 * Connection failed callback.
+	 * @param errorMsg smack failure message
+	 */
 	public void connectionFailed(String errorMsg) {
-	    Log.i(TAG, "Connection Failed");
+	    Log.d(TAG, "Connection Failed");
 	    final int n = mRemoteConnListeners.beginBroadcast();
 
 	    for (int i = 0; i < n; i++) {
@@ -326,6 +318,7 @@
 		}
 	    }
 	    mRemoteConnListeners.finishBroadcast();
+	    //mService.stopSelf();
 	}
 
 	/**
@@ -351,12 +344,12 @@
 		public void processPacket(Packet packet) {
 		    String from = packet.getFrom();
 		    Notification notif = new Notification(com.beem.project.beem.R.drawable.signal,
-			"Demande d'ajout", System.currentTimeMillis());
+			mService.getString(R.string.AcceptContactRequest), System.currentTimeMillis());
 		    notif.defaults = Notification.DEFAULT_ALL;
 		    notif.flags = Notification.FLAG_AUTO_CANCEL;
 		    Intent intent = new Intent(mService, Subscription.class);
 		    intent.putExtra("from", from);
-		    notif.setLatestEventInfo(mService, from, "demande d'ajout de " + from,
+		    notif.setLatestEventInfo(mService, from, mService.getString(R.string.AcceptContactRequestFrom) + from,
 			PendingIntent.getActivity(mService, 0, intent, PendingIntent.FLAG_ONE_SHOT));
 		    int id = packet.hashCode();
 		    mService.sendNotification(id, notif);
@@ -387,6 +380,7 @@
 	 */
 	@Override
 	public void reconnectingIn(int arg0) {
+	    Log.d(TAG, "reconnectingIn");
 	    final int n = mRemoteConnListeners.beginBroadcast();
 
 	    for (int i = 0; i < n; i++) {
@@ -408,6 +402,7 @@
 	 */
 	@Override
 	public void reconnectionFailed(Exception arg0) {
+	    Log.d(TAG, "reconnectionFailed");
 	    final int r = mRemoteConnListeners.beginBroadcast();
 
 	    for (int i = 0; i < r; i++) {
@@ -429,6 +424,7 @@
 	 */
 	@Override
 	public void reconnectionSuccessful() {
+	    Log.d(TAG, "reconnectionSuccessful");
 	    PacketFilter filter = new PacketFilter() {
 
 		@Override
@@ -448,12 +444,13 @@
 		public void processPacket(Packet packet) {
 		    String from = packet.getFrom();
 		    Notification notif = new Notification(com.beem.project.beem.R.drawable.signal,
-			"Demande d'ajout", System.currentTimeMillis());
+			mService.getString(R.string.AcceptContactRequest), System.currentTimeMillis());
 		    notif.defaults = Notification.DEFAULT_ALL;
 		    notif.flags = Notification.FLAG_AUTO_CANCEL;
 		    Intent intent = new Intent(mService, Subscription.class);
 		    intent.putExtra("from", from);
-		    notif.setLatestEventInfo(mService, from, "demande d'ajout de " + from,
+		    notif.setLatestEventInfo(mService, from,
+			mService.getString(R.string.AcceptContactRequestFrom) + from,
 			PendingIntent.getActivity(mService, 0, intent, PendingIntent.FLAG_ONE_SHOT));
 		    int id = packet.hashCode();
 		    mService.sendNotification(id, notif);
--- a/src/com/beem/project/beem/service/XmppFacade.java	Fri Sep 25 19:01:30 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppFacade.java	Sat Sep 26 01:15:19 2009 +0200
@@ -15,6 +15,7 @@
 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.
@@ -46,7 +47,7 @@
 	Presence pres = new Presence(Presence.Type.available);
 	if (msg != null)
 	    pres.setStatus(msg);
-	Presence.Mode mode = com.beem.project.beem.utils.Status.getPresenceModeFromStatus(status);
+	Presence.Mode mode = Status.getPresenceModeFromStatus(status);
 	if (mode != null)
 	    pres.setMode(mode);
 	mConnexion.getAdaptee().sendPacket(pres);
--- a/src/com/beem/project/beem/ui/ChangeStatus.java	Fri Sep 25 19:01:30 2009 +0200
+++ b/src/com/beem/project/beem/ui/ChangeStatus.java	Sat Sep 26 01:15:19 2009 +0200
@@ -26,68 +26,81 @@
 import com.beem.project.beem.utils.BeemBroadcastReceiver;
 import com.beem.project.beem.utils.Status;
 
+/**
+ * This Activity is used to change the status.
+ * @author nikita
+ */
 public class ChangeStatus extends Activity {
 
-    private TextView mStatusText;
-    private Toast mToast;
-    private Button mOk;
-    private Button mClear;
-    private Spinner mSpinner;
-    
-    private static final String[] STATUS = { "Available for chat", "Available", "Busy", "Away", "Unavailable",
-	"Disconnected" };
-    private static final int DISCONNECTED_IDX = 5;
-    private static final int AVAILABLE_FOR_CHAT_IDX = 0;
-    private static final int AVAILABLE_IDX = 1;
-    private static final int BUSY_IDX = 2;
-    private static final int AWAY_IDX = 3;
-    private static final int UNAVAILABLE_IDX = 4;
-    
-    private SharedPreferences mSettings;
-    private ArrayAdapter<String> mAdapter;
-    private IXmppFacade mXmppFacade = null;
-    private final ServiceConnection mServConn = new BeemServiceConnection();
-    private final OnClickListener mOnClickOk = new MyOnClickListener();    
-    private BroadcastReceiver mReceiver;
-
     private static final Intent SERVICE_INTENT = new Intent();
     static {
 	SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
     }
 
+    private static final int AVAILABLE_FOR_CHAT_IDX = 0;
+    private static final int AVAILABLE_IDX = 1;
+    private static final int BUSY_IDX = 2;
+    private static final int AWAY_IDX = 3;
+    private static final int UNAVAILABLE_IDX = 4;
+    private static final int DISCONNECTED_IDX = 5;
+    private TextView mStatusText;
+    private Toast mToast;
+    private Button mOk;
+    private Button mClear;
+    private Spinner mSpinner;
+
+    private SharedPreferences mSettings;
+    private ArrayAdapter<CharSequence> mAdapter;
+    private IXmppFacade mXmppFacade;
+    private final ServiceConnection mServConn = new BeemServiceConnection();
+    private final OnClickListener mOnClickOk = new MyOnClickListener();
+    private BroadcastReceiver mReceiver;
+
+    /**
+     * constructor.
+     */
+    public ChangeStatus() {
+    }
+
+    /**
+     * Return the status index from status the settings.
+     * @return the status index from status the settings.
+     */
     private int getPreferenceStatusIndex() {
 	return mSettings.getInt(getString(R.string.PreferenceStatus), 0);
     }
 
+    /**
+     * Return the status text from status the settings.
+     * @param id status text id.
+     * @return the status text from status the settings.
+     */
     private String getPreferenceString(int id) {
 	return mSettings.getString(getString(id), "");
     }
 
+    /**
+     * convert status text to.
+     * @param item selected item text.
+     * @return item position in the array.
+     */
     private int getStatusForService(String item) {
-	int res = Status.CONTACT_STATUS_AVAILABLE;
-	for (int i = 0; i < ChangeStatus.STATUS.length; i++) {
-	    String str = ChangeStatus.STATUS[i];
-	    if (str.equals(item)) {
-		switch (i) {
-		    case ChangeStatus.DISCONNECTED_IDX:
-			return Status.CONTACT_STATUS_DISCONNECT;
-		    case ChangeStatus.AVAILABLE_FOR_CHAT_IDX:
-			return Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT;
-		    case ChangeStatus.AVAILABLE_IDX:
-			return Status.CONTACT_STATUS_AVAILABLE;
-		    case ChangeStatus.AWAY_IDX:
-			return Status.CONTACT_STATUS_AWAY;
-		    case ChangeStatus.BUSY_IDX:
-			return Status.CONTACT_STATUS_BUSY;
-		    case ChangeStatus.UNAVAILABLE_IDX:
-			return Status.CONTACT_STATUS_UNAVAILABLE;
-		    default:
-			res = Status.CONTACT_STATUS_AVAILABLE;
-			break;
-		}
-	    }
+	switch (mAdapter.getPosition(item)) {
+	    case ChangeStatus.DISCONNECTED_IDX:
+		return Status.CONTACT_STATUS_DISCONNECT;
+	    case ChangeStatus.AVAILABLE_FOR_CHAT_IDX:
+		return Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT;
+	    case ChangeStatus.AVAILABLE_IDX:
+		return Status.CONTACT_STATUS_AVAILABLE;
+	    case ChangeStatus.AWAY_IDX:
+		return Status.CONTACT_STATUS_AWAY;
+	    case ChangeStatus.BUSY_IDX:
+		return Status.CONTACT_STATUS_BUSY;
+	    case ChangeStatus.UNAVAILABLE_IDX:
+		return Status.CONTACT_STATUS_UNAVAILABLE;
+	    default:
+		return Status.CONTACT_STATUS_AVAILABLE;
 	}
-	return res;
     }
 
     /**
@@ -106,12 +119,13 @@
 	mSettings = getSharedPreferences(getString(R.string.settings_filename), MODE_PRIVATE);
 
 	mSpinner = (Spinner) findViewById(R.id.ChangeStatusSpinner);
-	mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, STATUS);
+	mAdapter = ArrayAdapter.createFromResource(this, R.array.status_types, android.R.layout.simple_spinner_item);
 	mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
 	mSpinner.setAdapter(mAdapter);
 	mToast = Toast.makeText(this, R.string.ChangeStatusOk, Toast.LENGTH_LONG);
 	mReceiver = new BeemBroadcastReceiver();
-	showSettings();
+	mStatusText.setText(getPreferenceString(R.string.PreferenceStatusText));
+	mSpinner.setSelection(getPreferenceStatusIndex());
     }
 
     /**
@@ -132,7 +146,7 @@
 	bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
 	this.registerReceiver(mReceiver, new IntentFilter(XmppConnectionAdapter.BEEM_CONNECTION_CLOSED));
     }
-    
+
     /**
      * {@inheritDoc}
      */
@@ -142,30 +156,52 @@
 	this.unregisterReceiver(mReceiver);
     }
 
-    private void showSettings() {
-	mStatusText.setText(getPreferenceString(R.string.PreferenceStatusText));
-	mSpinner.setSelection(getPreferenceStatusIndex());
-    }
-
+    /**
+     * connection to service.
+     * @author nikita
+     */
     private class BeemServiceConnection implements ServiceConnection {
 
+	/**
+	 * constructor.
+	 */
+	public BeemServiceConnection() {
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onServiceConnected(ComponentName name, IBinder service) {
 	    mXmppFacade = IXmppFacade.Stub.asInterface(service);
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
 	@Override
 	public void onServiceDisconnected(ComponentName name) {
 	    mXmppFacade = null;
 	}
     }
 
+    /**
+     * User have clicked on ok.
+     * @author nikita
+     */
     private class MyOnClickListener implements OnClickListener {
 
+	/**
+	 * constructor.
+	 */
+	public MyOnClickListener() {
+	}
+
 	@Override
 	public void onClick(View v) {
 	    if (v == mOk) {
-		if (textHasChanged() || statusHasChanged()) {
+		if (!mStatusText.getText().toString().equals(getPreferenceString(R.string.PreferenceStatusText))
+		    || getPreferenceStatusIndex() != mSpinner.getSelectedItemPosition()) {
 		    String msg = mStatusText.getText().toString();
 		    int status = getStatusForService((String) mSpinner.getSelectedItem());
 		    Editor edit = mSettings.edit();
@@ -178,9 +214,6 @@
 			try {
 			    mXmppFacade.changeStatus(status, msg.toString());
 			} catch (RemoteException e) {
-			    // TODO
-			    // Auto-generated
-			    // catch block
 			    e.printStackTrace();
 			}
 			mToast.show();
@@ -191,12 +224,5 @@
 		mStatusText.setText(null);
 	    }
 	}
-	private boolean statusHasChanged() {
-	    return (mSettings.getInt(getString(R.string.PreferenceStatus), 0) != mSpinner.getSelectedItemPosition());
-	}
-
-	private boolean textHasChanged() {
-	    return (!mStatusText.getText().toString().equals(getPreferenceString(R.string.PreferenceStatusText)));
-	}
     }
 }
--- a/src/com/beem/project/beem/ui/ContactList.java	Fri Sep 25 19:01:30 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java	Sat Sep 26 01:15:19 2009 +0200
@@ -21,7 +21,6 @@
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.RemoteException;
-import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuInflater;
--- a/src/com/beem/project/beem/ui/EditSettings.java	Fri Sep 25 19:01:30 2009 +0200
+++ b/src/com/beem/project/beem/ui/EditSettings.java	Sat Sep 26 01:15:19 2009 +0200
@@ -393,6 +393,7 @@
 		return true;
 	    case R.id.settings_menu_login:
 		setResult(69);
+		this.stopService(SERVICE_INTENT);
 		finish();
 		return true;
 	    default:
@@ -547,7 +548,7 @@
 	    Log.i(getString(R.string.edit_settings_tag), LOG_MSG_SETTINGS_SAVED);
 	}
     }
-    
+
     private class BeemBroadcastReceiver extends BroadcastReceiver {
 	@Override
 	public void onReceive(Context context, Intent intent) {
--- a/src/com/beem/project/beem/ui/Login.java	Fri Sep 25 19:01:30 2009 +0200
+++ b/src/com/beem/project/beem/ui/Login.java	Sat Sep 26 01:15:19 2009 +0200
@@ -143,31 +143,6 @@
 	}
 
 	/**
-	 * Runnable to display error message.
-	 */
-	private class ErrorRunnable implements Runnable {
-
-	    private final String mErrorMsg;
-
-	    /**
-	     * Constructor.
-	     * @param errorMsg The message to display.
-	     */
-	    public ErrorRunnable(final String errorMsg) {
-		mErrorMsg = errorMsg;
-	    }
-
-	    /**
-	     * {@inheritDoc}
-	     */
-	    @Override
-	    public void run() {
-		mProgressDialog.setMessage(mErrorMsg);
-	    }
-
-	}
-
-	/**
 	 * {@inheritDoc}
 	 */
 	@Override
@@ -184,14 +159,13 @@
 
 	@Override
 	public void connectionFailed(String errorMsg) throws RemoteException {
-	    Log.e("Login", "CONNECTIONFAILLED");
+	    Log.d(TAG, "CONNECTIONFAILLED");
 	    mIsConnected = false;
 	    if (mXmppFacade != null) {
 		Login.this.unbindService(mServConn);
 		Login.this.stopService(SERVICE_INTENT);
 		mXmppFacade = null;
 	    }
-	    mConnectionHandler.post(new ErrorRunnable(errorMsg));
 	    dismissProgressDialog();
 	    showToast(errorMsg);
 	}
@@ -234,7 +208,7 @@
 	public void onConnect() throws RemoteException {
 	    mIsConnected = true;
 	    dismissProgressDialog();
-	    Log.i(getString(R.string.login_tag), "Connected.");
+	    Log.i(TAG, "Connected.");
 	    mXmppFacade.changeStatus(Status.CONTACT_STATUS_AVAILABLE, null);
 	    startActivity(new Intent(Login.this, ContactList.class));
 	    finish();
@@ -292,14 +266,15 @@
 		    finish();
 		}
 	    } catch (RemoteException e) {
-		Log.e(getString(R.string.login_tag), "REMOTE EXCEPTION $" + e.getMessage());
+		Log.e(TAG, "REMOTE EXCEPTION $" + e.getMessage());
 	    }
 	}
 
 	@Override
 	public void onServiceDisconnected(ComponentName name) {
+	    Log.d(TAG, "service disconnected");
 	    mIsConnected = false;
 	    mXmppFacade = null;
 	}
-    }    
+    }
 }
--- a/src/com/beem/project/beem/utils/BeemBroadcastReceiver.java	Fri Sep 25 19:01:30 2009 +0200
+++ b/src/com/beem/project/beem/utils/BeemBroadcastReceiver.java	Sat Sep 26 01:15:19 2009 +0200
@@ -1,20 +1,26 @@
 package com.beem.project.beem.utils;
 
-import com.beem.project.beem.R;
-import com.beem.project.beem.ui.Login;
-
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.widget.Toast;
 
+import com.beem.project.beem.R;
+import com.beem.project.beem.ui.Login;
+
 /**
+ * Manage broadcast disconnect intent.
  * @author nikita
- *
  */
 public class BeemBroadcastReceiver extends BroadcastReceiver {
 
     /**
+     * constructor.
+     */
+    public BeemBroadcastReceiver() {
+    }
+
+    /**
      * {@inheritDoc}
      */
     @Override