IssueID #100
warnings en moins et debut de resolution du bug sur le chat qui est pas
notifier
--- a/src/com/beem/project/beem/BeemApplication.java Sat Apr 25 21:33:18 2009 +0200
+++ b/src/com/beem/project/beem/BeemApplication.java Sat May 16 22:59:02 2009 +0200
@@ -13,19 +13,15 @@
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
-import android.content.res.Resources;
import android.os.Handler;
import android.os.IBinder;
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;
/**
@@ -40,7 +36,6 @@
public static final String TAG = "BeemApplication";
private IXmppFacade mFacade;
private Context mApplicationContext;
- private Resources mPrivateResources;
private List<Message> mQueue = new LinkedList<Message>();
private boolean mIsConnected;
private IXmppConnection mConnection;
@@ -106,7 +101,7 @@
mBeemApp.mProgressDialog.setIcon(R.drawable.signal);
mBeemApp.mProgressDialog.setMessage("Connecting...");
mBeemApp.mApplicationContext = activity.getApplication();
- mBeemApp.mPrivateResources = activity.getResources();
+ activity.getResources();
mBeemApp.onCreate();
return mBeemApp;
}
--- a/src/com/beem/project/beem/BeemException.java Sat Apr 25 21:33:18 2009 +0200
+++ b/src/com/beem/project/beem/BeemException.java Sat May 16 22:59:02 2009 +0200
@@ -12,7 +12,11 @@
*/
public class BeemException extends Exception implements Parcelable {
- public static final Parcelable.Creator<BeemException> CREATOR = new Creator<BeemException>() {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5794514989326146456L;
+ public static final Parcelable.Creator<BeemException> CREATOR = new Creator<BeemException>() {
@Override
public BeemException[] newArray(int size) {
--- a/src/com/beem/project/beem/BeemService.java Sat Apr 25 21:33:18 2009 +0200
+++ b/src/com/beem/project/beem/BeemService.java Sat May 16 22:59:02 2009 +0200
@@ -5,9 +5,7 @@
import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.Roster.SubscriptionMode;
-import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.PacketFilter;
-import org.jivesoftware.smack.filter.PacketTypeFilter;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.proxy.ProxyInfo;
@@ -25,9 +23,7 @@
import com.beem.project.beem.service.XmppConnectionAdapter;
import com.beem.project.beem.service.XmppFacade;
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.SendIM;
import com.beem.project.beem.ui.Subscription;
/**
--- a/src/com/beem/project/beem/jingle/Caller.java Sat Apr 25 21:33:18 2009 +0200
+++ b/src/com/beem/project/beem/jingle/Caller.java Sat May 16 22:59:02 2009 +0200
@@ -75,7 +75,7 @@
final TransportCandidate localCandidate,
final JingleSession jingleSession) {
System.out.println("Session established");
- String name = localCandidate.getName();
+ //String name = localCandidate.getName();
String ip = localCandidate.getIp();
int port = localCandidate.getPort();
System.out
--- a/src/com/beem/project/beem/jingle/Receiver.java Sat Apr 25 21:33:18 2009 +0200
+++ b/src/com/beem/project/beem/jingle/Receiver.java Sat May 16 22:59:02 2009 +0200
@@ -18,7 +18,6 @@
import org.jivesoftware.smackx.jingle.media.PayloadType;
import org.jivesoftware.smackx.jingle.nat.BasicTransportManager;
import org.jivesoftware.smackx.jingle.nat.TransportCandidate;
-import org.jivesoftware.smackx.packet.DiscoverInfo;
public class Receiver {
--- a/src/com/beem/project/beem/service/BeemChatManager.java Sat Apr 25 21:33:18 2009 +0200
+++ b/src/com/beem/project/beem/service/BeemChatManager.java Sat May 16 22:59:02 2009 +0200
@@ -41,7 +41,7 @@
*/
public static final String TAG = "BeemChatManager";
private ChatManager mAdaptee;
- private Map<String, IChat> mChats = new HashMap<String, IChat>();
+ private Map<String, ChatAdapter> mChats = new HashMap<String, ChatAdapter>();
private ChatListener mChatListener = new ChatListener();
private RemoteCallbackList<IChatManagerListener> mRemoteChatCreationListeners = new RemoteCallbackList<IChatManagerListener>();
private RemoteCallbackList<IMessageListener> mRemoteMessageListeners = new RemoteCallbackList<IMessageListener>();
@@ -67,7 +67,7 @@
mRemoteMessageListeners.register(listener);
String key = StringUtils.parseBareAddress(jid);
if (mChats.containsKey(key)) {
- return mChats.get(key);
+ return (mChats.get(key));
}
// create the chat. the adaptee will be add automatically in the map
mAdaptee.createChat(key, mChatListener);
@@ -107,9 +107,11 @@
@Override
public void destroyChat(IChat chat) throws RemoteException {
// TODO gerer les resources egalement
+ Log.d(TAG, "destroy chat jid "+ chat.getParticipant().getJID());
+ ChatAdapter res = mChats.get(chat.getParticipant().getJID());
IChat c = mChats.remove(chat.getParticipant().getJID());
if (c == null)
- Log.w(TAG, "CA devrait pas 1!!");
+ Log.w(TAG, "CA devrait pas 1!!" + chat.getParticipant().getJID());
}
private IChat getChat(Chat chat) {
@@ -117,7 +119,7 @@
if (mChats.containsKey(key)) {
return mChats.get(key);
}
- IChat res = new ChatAdapter(chat);
+ ChatAdapter res = new ChatAdapter(chat);
mChats.put(key, res);
return res;
}
@@ -139,11 +141,15 @@
*/
@Override
public void chatCreated(Chat chat, boolean locally) {
+ Log.d(TAG,"new chat");
IChat newchat = getChat(chat);
if (!locally) {
// chat.addMessageListener(mChatListener);
+ Log.d(TAG, "new local chat");
notifyNewChat(newchat);
}
+ else
+ Log.d(TAG, "reuse local chat");
chat.addMessageListener(mChatListener);
final int n = mRemoteChatCreationListeners.beginBroadcast();
@@ -160,6 +166,9 @@
mRemoteChatCreationListeners.finishBroadcast();
}
+ /*
+ *
+ */
private void notifyNewChat(IChat chat) {
try {
String text = chat.getParticipant().getJID();
--- a/src/com/beem/project/beem/service/ChatAdapter.java Sat Apr 25 21:33:18 2009 +0200
+++ b/src/com/beem/project/beem/service/ChatAdapter.java Sat May 16 22:59:02 2009 +0200
@@ -19,6 +19,7 @@
private Contact mParticipant;
private String mState;
private StringBuffer mLastMessages;
+ private boolean isOpen;
/**
* Constructor.
@@ -88,4 +89,18 @@
mLastMessages.delete(0, mLastMessages.length());
}
+ /**
+ * @param isOpen the isOpen to set
+ */
+ public void setOpen(boolean isOpen) {
+ this.isOpen = isOpen;
+ }
+
+ /**
+ * @return the isOpen
+ */
+ public boolean isOpen() {
+ return isOpen;
+ }
+
}
--- a/src/com/beem/project/beem/ui/ChangeStatus.java Sat Apr 25 21:33:18 2009 +0200
+++ b/src/com/beem/project/beem/ui/ChangeStatus.java Sat May 16 22:59:02 2009 +0200
@@ -1,7 +1,6 @@
package com.beem.project.beem.ui;
import android.app.Activity;
-import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
--- a/src/com/beem/project/beem/ui/ContactListSettings.java Sat Apr 25 21:33:18 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactListSettings.java Sat May 16 22:59:02 2009 +0200
@@ -1,12 +1,8 @@
package com.beem.project.beem.ui;
import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
-import android.text.Layout;
-import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
@@ -15,7 +11,6 @@
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Spinner;
-import android.widget.TextView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.LinearLayout.LayoutParams;
--- a/src/com/beem/project/beem/ui/SendIM.java Sat Apr 25 21:33:18 2009 +0200
+++ b/src/com/beem/project/beem/ui/SendIM.java Sat May 16 22:59:02 2009 +0200
@@ -35,6 +35,7 @@
*/
public class SendIM extends Activity implements OnClickListener, OnKeyListener {
+ private static final String TAG = "SEND_IM";
private EditText mToSend;
private SendIMDialogSmiley mSmyDialog;
private SharedPreferences mSet;
@@ -135,11 +136,34 @@
});
}
+ @Override
+ protected void onPause() {
+ Log.d(TAG, "onPause");
+ if (mChatManager != null) {
+ try {
+ mChatManager.removeChatCreationListener(mChatManagerListener);
+ mChatManager.destroyChat(mChat);
+ } catch (RemoteException e) {
+ Log.e(TAG, "error on pause");
+ e.printStackTrace();
+ }
+ }
+ super.onPause();
+ }
@Override
protected void onStop() {
- // TODO Auto-generated method stub
super.onStop();
+ Log.d(TAG, "onStop");
+ if (mChatManager != null) {
+ try {
+ mChatManager.removeChatCreationListener(mChatManagerListener);
+ mChatManager.destroyChat(mChat);
+ } catch (RemoteException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
mBeemApplication.unbindBeemService();
}
--- a/src/com/beem/project/beem/ui/SendIMDialogSmiley.java Sat Apr 25 21:33:18 2009 +0200
+++ b/src/com/beem/project/beem/ui/SendIMDialogSmiley.java Sat May 16 22:59:02 2009 +0200
@@ -6,7 +6,7 @@
import android.content.SharedPreferences;
public class SendIMDialogSmiley extends Dialog {
- private SendIM mSendIM;
+ private SendIM mSendIM;
private SharedPreferences mSet;
public SendIMDialogSmiley(SendIM sendim, SharedPreferences settings) {