# HG changeset patch # User Jean-Manuel Da Silva # Date 1258413403 -3600 # Node ID 19ced4af7386f17fe967264be62134d9df2cc066 # Parent 88a19fcd70b3988ebd18d9faec4d0cab54688e1f Ajout de messages de debug pour l'activité Login et suppression d'un leak sur l'activité ContactLists. diff -r 88a19fcd70b3 -r 19ced4af7386 src/com/beem/project/beem/ui/ContactList.java --- a/src/com/beem/project/beem/ui/ContactList.java Mon Nov 16 02:00:06 2009 +0100 +++ b/src/com/beem/project/beem/ui/ContactList.java Tue Nov 17 00:16:43 2009 +0100 @@ -67,7 +67,7 @@ private SharedPreferences mSettings; private final ServiceConnection mServConn = new BeemServiceConnection(); private BeemBroadcastReceiver mReceiver; - private Map mIconsMap = new HashMap(); + private final Map mIconsMap = new HashMap(); private LayoutInflater mInflater; static { @@ -130,7 +130,6 @@ } } - @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); @@ -161,7 +160,6 @@ super.onStop(); if (mReceiver.isBinded()) unbindService(mServConn); - mReceiver.setBinded(false); } @Override @@ -311,7 +309,8 @@ R.drawable.status_available)); mIconsMap.put(Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT, BitmapFactory.decodeResource(getResources(), R.drawable.status_available)); - mIconsMap.put(Status.CONTACT_STATUS_AWAY, BitmapFactory.decodeResource(getResources(), R.drawable.status_away)); + mIconsMap + .put(Status.CONTACT_STATUS_AWAY, BitmapFactory.decodeResource(getResources(), R.drawable.status_away)); mIconsMap.put(Status.CONTACT_STATUS_BUSY, BitmapFactory.decodeResource(getResources(), R.drawable.status_dnd)); mIconsMap.put(Status.CONTACT_STATUS_DISCONNECT, BitmapFactory.decodeResource(getResources(), R.drawable.status_offline)); diff -r 88a19fcd70b3 -r 19ced4af7386 src/com/beem/project/beem/ui/Login.java --- a/src/com/beem/project/beem/ui/Login.java Mon Nov 16 02:00:06 2009 +0100 +++ b/src/com/beem/project/beem/ui/Login.java Tue Nov 17 00:16:43 2009 +0100 @@ -33,7 +33,7 @@ */ public class Login extends Activity { - private static final String TAG = "LOG_AS"; + private static final String TAG = "Login"; private static final int REQUEST_CODE = 1; private static final Intent SERVICE_INTENT = new Intent(); static { @@ -81,10 +81,11 @@ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - Log.d(TAG, "onCreate"); + Log.d(TAG, "BEGIN onCreate."); mSettings = PreferenceManager.getDefaultSharedPreferences(this); setContentView(R.layout.login); mProgressDialog = new ProgressDialog(this); + Log.d(TAG, "END onCreate."); } /** @@ -93,7 +94,7 @@ @Override protected void onStop() { super.onStop(); - Log.d(TAG, "onStop " + mIsConnectedService); + Log.d(TAG, "BEGIN onStop."); if (mIsConfigured && (mIsConnectedService || mXmppFacade != null)) { boolean isConnected = false; if (mXmppConnection != null) { @@ -109,6 +110,7 @@ } mXmppFacade = null; } + Log.d(TAG, "END onStop."); } /** @@ -117,9 +119,10 @@ @Override protected void onPause() { super.onPause(); - Log.d(TAG, "onPause"); + Log.d(TAG, "BEGIN onPause."); mConnectionHandler.removeCallbacks(mConnectionRunnable); mProgressDialog.dismiss(); + Log.d(TAG, "END onPause."); } /** @@ -128,7 +131,8 @@ @Override protected void onResume() { super.onResume(); - Log.d(TAG, "onResume"); + Log.d(TAG, "BEGIN onResume."); + Log.d(TAG, "END onResume."); } /** @@ -137,18 +141,19 @@ @Override public void onStart() { super.onStart(); - Log.d(TAG, "onStart " + mIsConnectedService); + Log.d(TAG, "BEGIN onStart."); mIsConfigured = mSettings.getBoolean("PreferenceIsConfigured", false); if (mIsConfigured && !mIsConnectedService) { try { Thread.sleep(1000); // HACK: Pour éviter de rebinder un service // pas encore arreter. } catch (InterruptedException e) { - e.printStackTrace(); + Log.e(TAG, e.getMessage()); } bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE); mIsConnectedService = true; } + Log.d(TAG, "END onStart."); } /** @@ -240,23 +245,27 @@ */ @Override public void connectionClosed() throws RemoteException { + Log.d(TAG, "BEGIN connectionClosed."); if (mXmppFacade != null) { launchReconnectionHandler(); mXmppFacade = null; } + Log.d(TAG, "END connectionClosed."); } @Override public void connectionClosedOnError() throws RemoteException { + Log.d(TAG, "BEGIN connectionClosedOnError."); if (mXmppFacade != null) { launchReconnectionHandler(); mXmppFacade = null; } + Log.d(TAG, "END connectionClosedOnError."); } @Override public void connectionFailed(String errorMsg) throws RemoteException { - Log.d(TAG, "CONNECTIONFAILLED"); + Log.d(TAG, "BEGIN connectionFailed."); if (mXmppFacade != null) { Login.this.unbindService(mServConn); Login.this.stopService(SERVICE_INTENT); @@ -266,6 +275,7 @@ dismissProgressDialog(); showToast(errorMsg); launchReconnectionHandler(); + Log.d(TAG, "END connectionFailed."); } /** @@ -313,12 +323,13 @@ @Override public void onConnect() throws RemoteException { + Log.d(TAG, "BEGIN onConnect."); dismissProgressDialog(); - Log.i(TAG, "Connected."); mXmppFacade.changeStatus(Status.CONTACT_STATUS_AVAILABLE, null); mRetry = 0; startActivity(new Intent(Login.this, ContactList.class)); finish(); + Log.d(TAG, "END onConnect."); } @Override @@ -346,7 +357,7 @@ @Override public void onServiceConnected(ComponentName name, IBinder service) { - Log.d(TAG, "service connected"); + Log.d(TAG, "BEGIN onServiceConnected."); mXmppFacade = IXmppFacade.Stub.asInterface(service); mIsConnectedService = true; try { @@ -366,15 +377,17 @@ finish(); } } catch (RemoteException e) { - Log.e(TAG, "REMOTE EXCEPTION $" + e.getMessage()); + Log.e(TAG, e.getMessage()); } + Log.d(TAG, "END onServiceConnected."); } @Override public void onServiceDisconnected(ComponentName name) { - Log.d(TAG, "service disconnected"); + Log.d(TAG, "BEGIN onServiceDisconnected."); mIsConnectedService = false; mXmppFacade = null; + Log.d(TAG, "END onServiceDisconnected."); } } }