# HG changeset patch
# User marseille
# Date 1240602092 -7200
# Node ID e9d73490be9b259149d0a227d0654af6b8d9ef01
# Parent 393009fc82657d009647c24d885bc84c20d28f3e# Parent ec2072a6089ad0f882df6c6fbed354d9bd901b1f
Ajout du message d'etat dans la contact list
diff -r ec2072a6089a -r e9d73490be9b AndroidManifest.xml
--- a/AndroidManifest.xml Fri Apr 24 21:20:06 2009 +0200
+++ b/AndroidManifest.xml Fri Apr 24 21:41:32 2009 +0200
@@ -2,7 +2,8 @@
-
+
@@ -31,5 +32,5 @@
-
+
diff -r ec2072a6089a -r e9d73490be9b res/drawable/away.png
Binary file res/drawable/away.png has changed
diff -r ec2072a6089a -r e9d73490be9b res/drawable/beem_contactlist_header_1.png
Binary file res/drawable/beem_contactlist_header_1.png has changed
diff -r ec2072a6089a -r e9d73490be9b res/drawable/buddie_robot.png
Binary file res/drawable/buddie_robot.png has changed
diff -r ec2072a6089a -r e9d73490be9b res/drawable/chat.png
Binary file res/drawable/chat.png has changed
diff -r ec2072a6089a -r e9d73490be9b res/drawable/connecting.png
Binary file res/drawable/connecting.png has changed
diff -r ec2072a6089a -r e9d73490be9b res/drawable/dnd.png
Binary file res/drawable/dnd.png has changed
diff -r ec2072a6089a -r e9d73490be9b res/drawable/error.png
Binary file res/drawable/error.png has changed
diff -r ec2072a6089a -r e9d73490be9b res/drawable/invisible.png
Binary file res/drawable/invisible.png has changed
diff -r ec2072a6089a -r e9d73490be9b res/drawable/logo.jpg
Binary file res/drawable/logo.jpg has changed
diff -r ec2072a6089a -r e9d73490be9b res/drawable/message.png
Binary file res/drawable/message.png has changed
diff -r ec2072a6089a -r e9d73490be9b res/drawable/notify_message.png
Binary file res/drawable/notify_message.png has changed
diff -r ec2072a6089a -r e9d73490be9b res/drawable/notify_signal.png
Binary file res/drawable/notify_signal.png has changed
diff -r ec2072a6089a -r e9d73490be9b res/drawable/online.png
Binary file res/drawable/online.png has changed
diff -r ec2072a6089a -r e9d73490be9b res/drawable/requested.png
Binary file res/drawable/requested.png has changed
diff -r ec2072a6089a -r e9d73490be9b res/drawable/scrollbar_vertical_thumb.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/drawable/scrollbar_vertical_thumb.xml Fri Apr 24 21:41:32 2009 +0200
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
diff -r ec2072a6089a -r e9d73490be9b res/drawable/scrollbar_vertical_track.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/res/drawable/scrollbar_vertical_track.xml Fri Apr 24 21:41:32 2009 +0200
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
diff -r ec2072a6089a -r e9d73490be9b res/drawable/signal.png
Binary file res/drawable/signal.png has changed
diff -r ec2072a6089a -r e9d73490be9b res/drawable/xmpp.jpg
Binary file res/drawable/xmpp.jpg has changed
diff -r ec2072a6089a -r e9d73490be9b res/drawable/xmpp.png
Binary file res/drawable/xmpp.png has changed
diff -r ec2072a6089a -r e9d73490be9b res/layout/contactlistcontact.xml
--- a/res/layout/contactlistcontact.xml Fri Apr 24 21:20:06 2009 +0200
+++ b/res/layout/contactlistcontact.xml Fri Apr 24 21:41:32 2009 +0200
@@ -5,12 +5,13 @@
android:layout_height="wrap_content"
android:paddingLeft="10px"
android:paddingRight="10px"
- android:background="@drawable/beem_sendim_header_1"
android:gravity="center_vertical" >
@@ -30,8 +31,11 @@
diff -r ec2072a6089a -r e9d73490be9b res/layout/contactlistgroup.xml
diff -r ec2072a6089a -r e9d73490be9b res/layout/contactlistsettings.xml
--- a/res/layout/contactlistsettings.xml Fri Apr 24 21:20:06 2009 +0200
+++ b/res/layout/contactlistsettings.xml Fri Apr 24 21:41:32 2009 +0200
@@ -2,90 +2,22 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r ec2072a6089a -r e9d73490be9b res/layout/sendim.xml
--- a/res/layout/sendim.xml Fri Apr 24 21:20:06 2009 +0200
+++ b/res/layout/sendim.xml Fri Apr 24 21:41:32 2009 +0200
@@ -7,31 +7,34 @@
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:paddingLeft="10px"
- android:paddingRight="10px"
- android:background="@drawable/beem_sendim_header_1"
android:gravity="center_vertical" >
-
+ />
+ android:paddingLeft="10sp" />
+ android:paddingLeft="15sp" />
@@ -76,6 +79,9 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/beem_sendim_textview"
+ android:scrollbarTrackVertical="@drawable/scrollbar_vertical_track"
+ android:scrollbarThumbVertical="@drawable/scrollbar_vertical_thumb"
+ android:scrollbarSize="12dip"
android:layout_weight="1">
-
-
+
+
diff -r ec2072a6089a -r e9d73490be9b res/values/strings.xml
--- a/res/values/strings.xml Fri Apr 24 21:20:06 2009 +0200
+++ b/res/values/strings.xml Fri Apr 24 21:41:32 2009 +0200
@@ -27,6 +27,7 @@
Jabber ID
login
password
+ service
port
proxy_host
proxy_port
@@ -64,5 +65,7 @@
Updating status
Nothing to change
+
+ You have got a new message
diff -r ec2072a6089a -r e9d73490be9b src/com/beem/project/beem/BeemApplication.java
--- a/src/com/beem/project/beem/BeemApplication.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/BeemApplication.java Fri Apr 24 21:41:32 2009 +0200
@@ -5,6 +5,7 @@
import java.util.LinkedList;
import java.util.List;
+
import android.app.Activity;
import android.app.Application;
import android.app.ProgressDialog;
@@ -18,9 +19,13 @@
import android.os.Message;
import android.os.RemoteException;
import android.util.Log;
+import android.widget.Toast;
+
import com.beem.project.beem.service.aidl.IBeemConnectionListener;
import com.beem.project.beem.service.aidl.IXmppConnection;
import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.ui.AddContact;
+import com.beem.project.beem.ui.ContactList;
import com.beem.project.beem.utils.Status;
/**
@@ -61,10 +66,10 @@
try {
mConnection = mFacade.createConnection();
if (!mConnection.isAuthentificated()) {
- mProgressDialog.show();
mConnection.addConnectionListener(mConnectionListener);
mApplicationContext.startService(BeemApplication.SERVICE_INTENT);
}else {
+ mProgressDialog.dismiss();
synchronized (mQueue) {
for (Message msg : mQueue) {
msg.sendToTarget();
@@ -111,6 +116,8 @@
*/
public synchronized void startBeemService() {
if (!mIsConnected) {
+ mProgressDialog.setMessage("Connecting...");
+ mProgressDialog.show();
// the connection will be made on service connect
mApplicationContext.bindService(BeemApplication.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
}
@@ -207,7 +214,6 @@
* Constructor.
*/
public ConnectionListener() {
-
}
/**
@@ -215,9 +221,7 @@
*/
@Override
public void connectionClosed() throws RemoteException {
- // TODO Auto-generated method stub
- Log.e("BeemApp", "test1");
-
+ Log.e(TAG, "Connection Close");
}
/**
@@ -252,8 +256,6 @@
*/
@Override
public void reconnectingIn(int seconds) throws RemoteException {
- // TODO Auto-generated method stub
- mProgressDialog.show();
}
/**
@@ -261,9 +263,6 @@
*/
@Override
public void reconnectionFailed() throws RemoteException {
- // TODO Auto-generated method stub
- Log.e("BeemApp", "test3");
-
}
/**
@@ -271,8 +270,6 @@
*/
@Override
public void reconnectionSuccessful() throws RemoteException {
- // TODO Auto-generated method stub
-
}
@Override
diff -r ec2072a6089a -r e9d73490be9b src/com/beem/project/beem/BeemService.java
--- a/src/com/beem/project/beem/BeemService.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/BeemService.java Fri Apr 24 21:41:32 2009 +0200
@@ -49,6 +49,7 @@
private String mLogin;
private String mPassword;
private String mHost;
+ private String mService;
private int mPort;
private ConnectionConfiguration mConnectionConfiguration;
private ProxyInfo mProxyInfo;
@@ -83,6 +84,7 @@
mPassword = mSettings.getString(getString(R.string.PreferencePasswordKey), "");
mHost = mSettings.getString(getString(R.string.PreferenceHostKey), "");
mPort = mSettings.getInt(getString(R.string.PreferencePortKey), 5222);
+ mService = mSettings.getString(getString(R.string.PreferenceService), "");
// TODO penser a commenter
// mHost = "10.0.2.2";
@@ -139,7 +141,7 @@
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, mPort, mProxyInfo);
+ mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort, mService, mProxyInfo);
} else {
mConnectionConfiguration = new ConnectionConfiguration(mHost, mPort);
}
diff -r ec2072a6089a -r e9d73490be9b src/com/beem/project/beem/service/BeemChatManager.java
--- a/src/com/beem/project/beem/service/BeemChatManager.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/service/BeemChatManager.java Fri Apr 24 21:41:32 2009 +0200
@@ -23,6 +23,7 @@
import android.util.Log;
import com.beem.project.beem.BeemService;
+import com.beem.project.beem.R;
import com.beem.project.beem.service.aidl.IChat;
import com.beem.project.beem.service.aidl.IChatManager;
import com.beem.project.beem.service.aidl.IChatManagerListener;
@@ -140,7 +141,7 @@
public void chatCreated(Chat chat, boolean locally) {
IChat newchat = getChat(chat);
if (!locally) {
- // chat.addMessageListener(mChatListener);
+ // chat.addMessageListener(mChatListener);
notifyNewChat(newchat);
}
chat.addMessageListener(mChatListener);
@@ -162,15 +163,15 @@
private void notifyNewChat(IChat chat) {
try {
String text = chat.getParticipant().getJID();
- Notification notif = new Notification(com.beem.project.beem.R.drawable.signal, text, System
+ Notification notif = new Notification(com.beem.project.beem.R.drawable.notify_message, text, System
.currentTimeMillis());
notif.defaults = Notification.DEFAULT_ALL;
notif.flags = Notification.FLAG_AUTO_CANCEL;
Intent intent = new Intent(mService, SendIM.class);
// TODO use prefix for name
intent.putExtra("contact", chat.getParticipant());
- notif.setLatestEventInfo(mService, text, "nouveau message", PendingIntent.getActivity(mService, 0,
- intent, PendingIntent.FLAG_ONE_SHOT));
+ notif.setLatestEventInfo(mService, text, mService.getString(R.string.BeemChatManagerNewMessage),
+ PendingIntent.getActivity(mService, 0, intent, PendingIntent.FLAG_ONE_SHOT));
int id = chat.hashCode();
mService.sendNotification(id, notif);
} catch (RemoteException e) {
diff -r ec2072a6089a -r e9d73490be9b src/com/beem/project/beem/service/Contact.java
--- a/src/com/beem/project/beem/service/Contact.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/service/Contact.java Fri Apr 24 21:41:32 2009 +0200
@@ -142,6 +142,7 @@
public void setStatus(Presence presence) {
Log.i(TAG,"PRESENCE");
mStatus = Status.getStatusFromPresence(presence);
+ mMsgState = presence.getStatus();
}
/**
diff -r ec2072a6089a -r e9d73490be9b src/com/beem/project/beem/service/RosterAdapter.java
--- a/src/com/beem/project/beem/service/RosterAdapter.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/service/RosterAdapter.java Fri Apr 24 21:41:32 2009 +0200
@@ -220,6 +220,7 @@
}
c.addRes(StringUtils.parseResource(presence.getFrom()));
c.setStatus(mAdaptee.getPresence(presence.getFrom()));
+ c.setMsgState(presence.getStatus());
/* redispatch vers les IBeemRosterListener */
final int n = mRemoteRosListeners.beginBroadcast();
diff -r ec2072a6089a -r e9d73490be9b src/com/beem/project/beem/service/XmppConnectionAdapter.java
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java Fri Apr 24 21:41:32 2009 +0200
@@ -88,7 +88,10 @@
return true;
} catch (XMPPException e) {
Log.e(TAG, "Error while connecting", e);
- mConListener.connectionFailed(e.getXMPPError().getMessage()); //
+ if (e.getXMPPError() != null)
+ mConListener.connectionFailed(e.getXMPPError().getMessage()); //
+ else
+ mConListener.connectionFailed("Error On Connection");
}
return false;
}
diff -r ec2072a6089a -r e9d73490be9b src/com/beem/project/beem/service/XmppFacade.java
--- a/src/com/beem/project/beem/service/XmppFacade.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppFacade.java Fri Apr 24 21:41:32 2009 +0200
@@ -97,7 +97,7 @@
Notification mStatusNotification;
String text = (msg == null ? "" : msg);
- mStatusNotification = new Notification(com.beem.project.beem.R.drawable.signal, text, System.currentTimeMillis());
+ mStatusNotification = new Notification(com.beem.project.beem.R.drawable.notify_signal, text, System.currentTimeMillis());
mStatusNotification.defaults = Notification.DEFAULT_ALL;
mStatusNotification.flags = Notification.FLAG_NO_CLEAR;
diff -r ec2072a6089a -r e9d73490be9b src/com/beem/project/beem/ui/ChangeStatus.java
--- a/src/com/beem/project/beem/ui/ChangeStatus.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/ui/ChangeStatus.java Fri Apr 24 21:41:32 2009 +0200
@@ -1,16 +1,14 @@
package com.beem.project.beem.ui;
import android.app.Activity;
-
+import android.content.Context;
import android.content.Intent;
-
-import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
-
import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
+import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
@@ -22,7 +20,6 @@
import com.beem.project.beem.BeemApplication;
import com.beem.project.beem.BeemService;
import com.beem.project.beem.R;
-
import com.beem.project.beem.service.aidl.IXmppFacade;
import com.beem.project.beem.utils.Status;
@@ -44,18 +41,20 @@
private static final int UNAVAILABLE_IDX = 4;
private SharedPreferences mSettings;
private ArrayAdapter mAdapter;
- private Context mContext = this;
private Toast mToast;
+ private static Integer nb = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.changestatus);
-
+
+ nb++;
+ Log.i("nb de oncreate changestatus", nb.toString());
// Beem Application specific
mHandler = new Handler();
mBeemApplication = BeemApplication.getApplication(this);
-
+
+ setContentView(R.layout.changestatus);
mStatusText = (TextView) findViewById(R.id.ChangeStatusText);
mOk = (Button) findViewById(R.id.ChangeStatusOk);
mClear = (Button) findViewById(R.id.ChangeStatusClear);
@@ -67,7 +66,7 @@
mAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, STATUS);
mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mSpinner.setAdapter(mAdapter);
- mToast = Toast.makeText(mContext, R.string.ChangeStatusOk, Toast.LENGTH_LONG);
+ mToast = Toast.makeText(this, R.string.ChangeStatusOk, Toast.LENGTH_LONG);
showSettings();
}
diff -r ec2072a6089a -r e9d73490be9b src/com/beem/project/beem/ui/ContactList.java
--- a/src/com/beem/project/beem/ui/ContactList.java Fri Apr 24 21:20:06 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Fri Apr 24 21:41:32 2009 +0200
@@ -42,8 +42,10 @@
private static final String CHILD = "CHILD";
private static final String GROUP = "GROUP";
private IXmppFacade mService = null;
+ private ExpandableListAdapter mAdapter;
private BeemApplication mBeemApplication;
private BeemRosterListener mRosterListener;
+ private SharedPreferences mSettings;
private IRoster mRoster;
@SuppressWarnings("unchecked")
@@ -60,9 +62,19 @@
@Override
protected void onCreate(Bundle saveBundle) {
super.onCreate(saveBundle);
+ mRosterListener = new BeemRosterListener();
+ mSettings = getSharedPreferences(getString(R.string.PreferenceFileName), MODE_PRIVATE);
mBeemApplication = BeemApplication.getApplication(this);
- mRosterListener = new BeemRosterListener();
- mBeemApplication.startBeemService();
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ if (!mBeemApplication.isConnected()) {
+ mBeemApplication = BeemApplication.getApplication(this);
+ mBeemApplication.startBeemService();
+ }
mBeemApplication.callWhenConnectedToServer(new Handler(), new Runnable() {
@Override
public void run() {
@@ -79,17 +91,10 @@
e.printStackTrace();
}
}
- callbackShowContactList();
+ if (mAdapter == null)
+ 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
@@ -153,25 +158,18 @@
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == PREFERENCECHANGED) {
if (resultCode == RESULT_OK) {
+ mAdapter = null;
+ setListAdapter(mAdapter);
mBeemApplication.stopBeemService();
- mBeemApplication.startBeemService();
}
}
}
- private boolean isStatusOK(int status) {
- if (status == Status.CONTACT_STATUS_AVAILABLE || status == Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT
- || status == Status.CONTACT_STATUS_AWAY || status == Status.CONTACT_STATUS_BUSY)
- return true;
- return false;
- }
-
private void showContactList(List listGroup, List listContact) {
- ExpandableListAdapter Adapter;
List