Pfiou ...
Correciton de bug trouve lors de la connection et reconnection etc.
--- a/res/layout/login.xml Tue Jun 23 17:19:29 2009 +0200
+++ b/res/layout/login.xml Tue Jun 23 18:32:23 2009 +0200
@@ -4,6 +4,9 @@
android:layout_height="fill_parent">
<ImageView android:id="@+id/log_as_logo" android:src="@drawable/logo"
android:layout_width="fill_parent" android:layout_height="wrap_content" />
+ <TextView android:id="@+id/log_as_msg" android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:text="salut"
+ android:gravity="center_vertical" />
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:gravity="bottom">
--- a/src/com/beem/project/beem/BeemService.java Tue Jun 23 17:19:29 2009 +0200
+++ b/src/com/beem/project/beem/BeemService.java Tue Jun 23 18:32:23 2009 +0200
@@ -245,7 +245,6 @@
@Override
public void onDestroy() {
super.onDestroy();
- Log.e("BEEEMSERVICE", "ONDESTROY");
closeConnection();
mNotificationManager.cancel(NOTIFICATION_STATUS_ID);
Log.e("BEEEMSERVICE", "ONDESTROY");
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java Tue Jun 23 17:19:29 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java Tue Jun 23 18:32:23 2009 +0200
@@ -130,7 +130,7 @@
return true;
} catch (XMPPException e) {
Log.e(TAG, "Error while connecting", e);
- if (e.getXMPPError().getMessage() != null)
+ if (e.getXMPPError() != null && e.getXMPPError().getMessage() != null)
mConListener.connectionFailed(e.getXMPPError().getMessage());
else
mConListener.connectionFailed("Error On Connection");
--- a/src/com/beem/project/beem/ui/Login.java Tue Jun 23 17:19:29 2009 +0200
+++ b/src/com/beem/project/beem/ui/Login.java Tue Jun 23 18:32:23 2009 +0200
@@ -17,6 +17,7 @@
import android.widget.Button;
import android.widget.Toast;
+import com.beem.project.beem.BeemService;
import com.beem.project.beem.R;
import com.beem.project.beem.service.aidl.IBeemConnectionListener;
import com.beem.project.beem.service.aidl.IXmppConnection;
@@ -89,7 +90,7 @@
@Override
protected void onDestroy() {
super.onDestroy();
- if (mIsConnected) {
+ if (mIsConnected || xmppFacade == null) {
unbindService(mServConn);
}
}
@@ -123,28 +124,19 @@
@Override
public void connectionClosed() throws RemoteException {
- /*
- mIsConnected = false;
- Login.this.unbindService(mServConn);
- Login.this.stopService(SERVICE_INTENT);
- */
Log.e("Login", "CONNECTIONCLOSED");
}
@Override
public void connectionClosedOnError() throws RemoteException {
- /*
- 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);
+ if(xmppFacade != null)
+ Login.this.unbindService(mServConn);
Login.this.stopService(SERVICE_INTENT);
connectionHandler.post(new ErrorRunnable(errorMsg));
dismissProgressDialog();
@@ -155,7 +147,7 @@
connectionHandler.post(new Runnable() {
@Override
public void run() {
- Toast.makeText(Login.this, errorMsg, Toast.LENGTH_SHORT).show();
+ Toast.makeText(Login.this, errorMsg, Toast.LENGTH_LONG).show();
}
});
}
@@ -182,6 +174,7 @@
@Override
public void reconnectingIn(int seconds) throws RemoteException {
+ mIsConnected = true;
}
@@ -201,6 +194,7 @@
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
+ mIsConnected = true;
xmppFacade = IXmppFacade.Stub.asInterface(service);
try {
xmppConnection = xmppFacade.createConnection();
@@ -216,7 +210,6 @@
});
Login.this.startService(Login.SERVICE_INTENT);
} else {
- mIsConnected = true;
startActivity(new Intent(Login.this, ContactList.class));
finish();
}
@@ -227,8 +220,8 @@
@Override
public void onServiceDisconnected(ComponentName name) {
+ mIsConnected = false;
xmppFacade = null;
- mIsConnected = false;
}
}