Suppression beemapplication + modif connection
authorMarseille
Tue, 23 Jun 2009 17:19:29 +0200
changeset 282 ee754b3043a8
parent 275 5a07bf00b2f8
child 283 ecd2cb5f618e
Suppression beemapplication + modif connection
AndroidManifest.xml
src/com/beem/project/beem/service/RosterAdapter.java
src/com/beem/project/beem/service/XmppConnectionAdapter.java
src/com/beem/project/beem/ui/ContactList.java
src/com/beem/project/beem/ui/Login.java
--- a/AndroidManifest.xml	Tue Jun 23 15:43:49 2009 +0200
+++ b/AndroidManifest.xml	Tue Jun 23 17:19:29 2009 +0200
@@ -2,8 +2,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 	package="com.beem.project.beem" android:versionCode="1"
 	android:versionName="1.0">
-	<application android:label="@string/app_name" android:name="BeemApplication"
-		android:icon="@drawable/signal" android:theme="@style/Theme.BEEM.Default">
+	<application android:label="@string/app_name" android:icon="@drawable/signal" android:theme="@style/Theme.BEEM.Default">
 		<activity android:name=".ui.Login" android:label="@string/app_name"
 			android:launchMode="singleTask">
 			<intent-filter>
--- a/src/com/beem/project/beem/service/RosterAdapter.java	Tue Jun 23 15:43:49 2009 +0200
+++ b/src/com/beem/project/beem/service/RosterAdapter.java	Tue Jun 23 17:19:29 2009 +0200
@@ -129,7 +129,11 @@
     public void deleteContact(Contact contact, String group) throws RemoteException {
 	mContacts.get(contact.getJID()).delGroup(group);
 	try {
-	    mAdaptee.getGroup(group).removeEntry(mAdaptee.getEntry(contact.getJID()));
+	    if (mAdaptee != null) {
+		RosterEntry entry = mAdaptee.getEntry(contact.getJID());
+		if (entry != null)
+		    mAdaptee.getGroup(group).removeEntry(entry);
+	    }
 	} catch (XMPPException e) {
 	    e.printStackTrace();
 	}
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Tue Jun 23 15:43:49 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Tue Jun 23 17:19:29 2009 +0200
@@ -113,7 +113,7 @@
 	try {
 	    try {
 		PrivacyListManager.getInstanceFor(mAdaptee);
-	    } catch (NullPointerException e){
+	    } catch (NullPointerException e) {
 		Log.e(TAG, "pas normal", e);
 	    }
 	    mAdaptee.connect();
@@ -130,7 +130,10 @@
 	    return true;
 	} catch (XMPPException e) {
 	    Log.e(TAG, "Error while connecting", e);
-	    mConListener.connectionFailed("Error On Connection");
+	    if (e.getXMPPError().getMessage() != null)
+		mConListener.connectionFailed(e.getXMPPError().getMessage());
+	    else
+		mConListener.connectionFailed("Error On Connection");
 	}
 	return false;
     }
@@ -171,7 +174,7 @@
 	Roster adap = mAdaptee.getRoster();
 	if (adap == null)
 	    return null;
-	mRoster = new RosterAdapter(adap);	
+	mRoster = new RosterAdapter(adap);
 	return mRoster;
     }
 
@@ -210,6 +213,7 @@
     private void triggerAsynchronousConnectEvent() {
 	mConListener.onConnect();
     }
+
     /**
      * @param mPrivacyList the mPrivacyList to set
      */
@@ -223,6 +227,7 @@
     public PrivacyListManagerAdapter getPrivacyList() {
 	return mPrivacyList;
     }
+
     /**
      * Listener for XMPP connection events. It will calls the remote listeners for connexion events.
      * @author darisk
--- a/src/com/beem/project/beem/ui/ContactList.java	Tue Jun 23 15:43:49 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java	Tue Jun 23 17:19:29 2009 +0200
@@ -94,6 +94,7 @@
 	if (requestCode == REQUEST_CODE) {
 	    if (resultCode == 69) {
 		stopService(new Intent(this, BeemService.class));
+		Log.e("CONTACTLIST", "STOPSERVICE");
 		finish();
 		startActivity(new Intent(this, Login.class));
 	    }
@@ -117,6 +118,7 @@
     @Override
     protected void onStop() {
 	super.onStop();
+	Log.e("CONTACTLIST", "UNBINDSERVICE");
 	unbindService(mServConn);
 	groupName.clear();
 	groupMap.clear();
@@ -208,10 +210,9 @@
 	    mHandler.post(new RunnableChange());
 	}
 
-	
 	/**
-	 * TODO: sur la suppression de contact, on passe tt le temps dans entries updated ...
-	 * probleme comment reconnaitre si on supprime ou ajoute un contact ....
+	 * TODO: sur la suppression de contact, on passe tt le temps dans entries updated ... probleme comment
+	 * reconnaitre si on supprime ou ajoute un contact ....
 	 */
 	@Override
 	public void onEntriesUpdated(List<String> addresses) throws RemoteException {
--- a/src/com/beem/project/beem/ui/Login.java	Tue Jun 23 15:43:49 2009 +0200
+++ b/src/com/beem/project/beem/ui/Login.java	Tue Jun 23 17:19:29 2009 +0200
@@ -59,7 +59,7 @@
     }
 
     /**
-     * {@inheritDoc}
+     * Create Login activity
      */
     @Override
     public void onCreate(Bundle savedInstanceState) {
@@ -80,7 +80,6 @@
 	    @Override
 	    public void onClick(View v) {
 		bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
-		Log.e("LOGIN", "bindService()");
 	    }
 
 	});
@@ -91,7 +90,6 @@
     protected void onDestroy() {
 	super.onDestroy();
 	if (mIsConnected) {
-	    Log.e("LOGIN", "unbindService()");
 	    unbindService(mServConn);
 	}
     }
@@ -102,7 +100,7 @@
     @Override
     public void onStart() {
 	super.onStart();
-	Log.e("Login", "bindService");
+	Log.e("LOGIN", "BINDSERVICE");
 	bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
     }
 
@@ -125,24 +123,29 @@
 
 	@Override
 	public void connectionClosed() throws RemoteException {
+	    /*
 	    mIsConnected = false;
-	    Log.e("Login", "CONNECTIONCLOSED");
 	    Login.this.unbindService(mServConn);
 	    Login.this.stopService(SERVICE_INTENT);
+	    */
+	    Log.e("Login", "CONNECTIONCLOSED");
 	}
 
 	@Override
 	public void connectionClosedOnError() throws RemoteException {
-	    if (mIsConnected) {
-		mIsConnected = false;
-		Login.this.unbindService(mServConn);
-		Login.this.stopService(SERVICE_INTENT);
-	    }
+	    /*
+	    mIsConnected = false;
+	    Login.this.unbindService(mServConn);
+	    Login.this.stopService(SERVICE_INTENT);
+	    */
+	    Log.e("Login", "CONNECTIONCLOSEONERROR");
 	}
 
 	@Override
 	public void connectionFailed(String errorMsg) throws RemoteException {
 	    mIsConnected = false;
+	    Login.this.unbindService(mServConn);
+	    Login.this.stopService(SERVICE_INTENT);
 	    connectionHandler.post(new ErrorRunnable(errorMsg));
 	    dismissProgressDialog();
 	    showToast(errorMsg);