# HG changeset patch # User Marseille # Date 1245770369 -7200 # Node ID ee754b3043a83515bcf3cfee359e5ba25209420b # Parent 5a07bf00b2f842f0ab5ee1444d8058edebe85c0b Suppression beemapplication + modif connection diff -r 5a07bf00b2f8 -r ee754b3043a8 AndroidManifest.xml --- 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 @@ - + diff -r 5a07bf00b2f8 -r ee754b3043a8 src/com/beem/project/beem/service/RosterAdapter.java --- 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(); } diff -r 5a07bf00b2f8 -r ee754b3043a8 src/com/beem/project/beem/service/XmppConnectionAdapter.java --- 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 diff -r 5a07bf00b2f8 -r ee754b3043a8 src/com/beem/project/beem/ui/ContactList.java --- 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 addresses) throws RemoteException { diff -r 5a07bf00b2f8 -r ee754b3043a8 src/com/beem/project/beem/ui/Login.java --- 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);