correction d'un bug de status. Penser a decommenter le code dans ContactList
authorDa Risk <darisk972@gmail.com>
Thu, 23 Apr 2009 22:32:20 +0200
changeset 163 52e96a8a743d
parent 149 2faf7174aa03
child 164 ff0f63e92986
correction d'un bug de status. Penser a decommenter le code dans ContactList pour fixer le bug
AndroidManifest.xml
src/com/beem/project/beem/BeemApplication.java
src/com/beem/project/beem/BeemService.java
src/com/beem/project/beem/ui/ContactList.java
src/com/beem/project/beem/ui/ContactListSettings.java
--- a/AndroidManifest.xml	Thu Apr 23 17:18:49 2009 +0200
+++ b/AndroidManifest.xml	Thu Apr 23 22:32:20 2009 +0200
@@ -30,4 +30,5 @@
 	<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
 	<uses-permission android:name="com.beem.project.beem.BEEM_SERVICE"></uses-permission>
 	<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"></uses-permission>
+<uses-sdk android:minSdkVersion="2"></uses-sdk>
 </manifest> 
--- a/src/com/beem/project/beem/BeemApplication.java	Thu Apr 23 17:18:49 2009 +0200
+++ b/src/com/beem/project/beem/BeemApplication.java	Thu Apr 23 22:32:20 2009 +0200
@@ -98,7 +98,7 @@
 	mBeemApp.mActivity = activity;
 	mBeemApp.mProgressDialog = new ProgressDialog(activity);
 	mBeemApp.mProgressDialog.setTitle("Beem");
-	mBeemApp.mProgressDialog.setIcon(R.drawable.barthe_f);
+	mBeemApp.mProgressDialog.setIcon(R.drawable.signal);
 	mBeemApp.mProgressDialog.setMessage("Connecting...");
 	mBeemApp.mApplicationContext = activity.getApplication();
 	mBeemApp.mPrivateResources = activity.getResources();
--- a/src/com/beem/project/beem/BeemService.java	Thu Apr 23 17:18:49 2009 +0200
+++ b/src/com/beem/project/beem/BeemService.java	Thu Apr 23 22:32:20 2009 +0200
@@ -49,6 +49,7 @@
     private String mLogin;
     private String mPassword;
     private String mHost;
+    private int mPort;
     private ConnectionConfiguration mConnectionConfiguration;
     private ProxyInfo mProxyInfo;
     private boolean mUseProxy;
@@ -81,8 +82,10 @@
 	mLogin = mSettings.getString(getString(R.string.PreferenceLoginKey), "");
 	mPassword = mSettings.getString(getString(R.string.PreferencePasswordKey), "");
 	mHost = mSettings.getString(getString(R.string.PreferenceHostKey), "");
+	mPort = mSettings.getInt(getString(R.string.PreferencePortKey), 5222);
+	
 	// TODO penser a commenter
-	//mHost = "10.0.2.2";
+	// mHost = "10.0.2.2";
 	initConnectionConfig();
 	mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
 	mConnection = new XmppConnectionAdapter(mConnectionConfiguration, mLogin, mPassword, this);
@@ -136,9 +139,9 @@
 	    int pport =  mSettings.getInt(getString(R.string.PreferenceProxyPort), 1080);
 	    ProxyInfo.ProxyType type = ProxyType.valueOf(stype);
 	    mProxyInfo = new ProxyInfo(type, phost, pport, puser, ppass);
-	    mConnectionConfiguration = new ConnectionConfiguration(mHost, mProxyInfo);
+	    mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort, mProxyInfo);
 	} else {
-	    mConnectionConfiguration = new ConnectionConfiguration(mHost);
+	    mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort);
 	}
 	mConnectionConfiguration.setDebuggerEnabled(false);
 	mConnectionConfiguration.setSendPresence(true);
--- a/src/com/beem/project/beem/ui/ContactList.java	Thu Apr 23 17:18:49 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java	Thu Apr 23 22:32:20 2009 +0200
@@ -8,6 +8,7 @@
 import android.app.ExpandableListActivity;
 import android.content.Context;
 import android.content.Intent;
+import android.content.SharedPreferences;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.Bundle;
@@ -81,6 +82,14 @@
 		callbackShowContactList();
 	    }
 	});
+
+	// bug fixe temporaire des betises de marseille
+	/*
+	SharedPreferences mSettings = getSharedPreferences(getString(R.string.PreferenceFileName), MODE_PRIVATE);
+	SharedPreferences.Editor editor = mSettings.edit();
+	editor.putInt(getString(R.string.PreferencePortKey), 5222);
+	editor.commit();
+	 */
     }
 
     @Override
@@ -181,10 +190,9 @@
 	    childData.add(children);
 	}
 
-	Adapter = new ContactExpandableListAdapter(this, groupData, R.layout.contactlistgroup,
-	    new String[] { GROUP }, new int[] { R.id.textgroup }, childData, R.layout.contactlistcontact,
-	    new String[] { CHILD }, new int[] { R.id.contactliststatus, R.id.contactlistpseudo,
-		R.id.contactlistmsgperso, R.id.contactlistavatar });
+	Adapter = new ContactExpandableListAdapter(this, groupData, R.layout.contactlistgroup, new String[] { GROUP },
+	    new int[] { R.id.textgroup }, childData, R.layout.contactlistcontact, new String[] { CHILD }, new int[] {
+		R.id.contactliststatus, R.id.contactlistpseudo, R.id.contactlistmsgperso, R.id.contactlistavatar });
 	setListAdapter(Adapter);
     }
 
--- a/src/com/beem/project/beem/ui/ContactListSettings.java	Thu Apr 23 17:18:49 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactListSettings.java	Thu Apr 23 22:32:20 2009 +0200
@@ -100,8 +100,8 @@
 		editor.putString(getString(R.string.PreferenceHostKey), getWidgetText(R.id.host));
 		mIsChanged = true;
 	    }
-	    if (isChanged(R.id.port, R.string.PreferencePortKey)) {
-		editor.putString(getString(R.string.PreferencePortKey), getWidgetText(R.id.port));
+	    if (Integer.parseInt(getWidgetText(R.id.port)) != mSettings.getInt(getString(R.string.PreferencePortKey), 5222) ) {
+		editor.putInt(getString(R.string.PreferencePortKey), Integer.parseInt(getWidgetText(R.id.port)));
 		mIsChanged = true;
 	    }
 	    if (isChanged(R.id.userid, R.string.PreferenceLoginKey)) {
@@ -147,7 +147,7 @@
 	EditText e = (EditText) findViewById(R.id.host);
 	e.setText(getPreferenceString(R.string.PreferenceHostKey));
 	e = (EditText) findViewById(R.id.port);
-	e.setText(getPreferenceString(R.string.PreferencePortKey));
+	e.setText(String.valueOf(mSettings.getInt(getString(R.string.PreferencePortKey), 1080)));
 	e = (EditText) findViewById(R.id.userid);
 	e.setText(getPreferenceString(R.string.PreferenceLoginKey));
 	e = (EditText) findViewById(R.id.password);