Bundle pour debug avec nikita.
authorVincent Veronis <veroni_v@epitech.net>
Thu, 24 Sep 2009 23:54:11 +0200
changeset 381 166db9c93335
parent 379 5f82c315ebd9 (diff)
parent 380 9416b5711edd (current diff)
child 382 be426243b24f
Bundle pour debug avec nikita.
src/com/beem/project/beem/BeemService.java
src/com/beem/project/beem/jingle/JingleService.java
src/com/beem/project/beem/service/XmppConnectionAdapter.java
src/com/beem/project/beem/ui/ContactList.java
--- a/res/layout/contactlist.xml	Thu Sep 24 19:38:56 2009 +0200
+++ b/res/layout/contactlist.xml	Thu Sep 24 23:54:11 2009 +0200
@@ -5,7 +5,7 @@
 
 	<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
 		android:id="@+id/gallery" android:layout_width="fill_parent"
-		android:layout_height="wrap_content" android:spacing="10px" />
+		android:layout_height="wrap_content" android:spacing="50px" />
 
 	<LinearLayout android:layout_width="fill_parent"
 		android:layout_height="fill_parent" android:orientation="horizontal">
@@ -13,5 +13,4 @@
 			android:layout_height="fill_parent" />
 	</LinearLayout>
 
-
 </LinearLayout>
--- a/src/com/beem/project/beem/BeemService.java	Thu Sep 24 19:38:56 2009 +0200
+++ b/src/com/beem/project/beem/BeemService.java	Thu Sep 24 23:54:11 2009 +0200
@@ -2,6 +2,7 @@
 
 import org.jivesoftware.smack.ConnectionConfiguration;
 import org.jivesoftware.smack.Roster;
+import org.jivesoftware.smack.XMPPConnection;
 import org.jivesoftware.smack.ConnectionConfiguration.SecurityMode;
 import org.jivesoftware.smack.Roster.SubscriptionMode;
 import org.jivesoftware.smack.proxy.ProxyInfo;
@@ -132,9 +133,10 @@
 	initConnectionConfig();
 	mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
 	mConnection = new XmppConnectionAdapter(mConnectionConfiguration, mLogin, mPassword, this);
-	mJingle = new JingleService(mConnection.getAdaptee());
+	
 	Roster.setDefaultSubscriptionMode(SubscriptionMode.manual);
 	mBind = new XmppFacade(mConnection, this, mJingle);
+	mJingle = new JingleService(mConnection.getAdaptee());
     }
 
     /**
@@ -179,4 +181,9 @@
 	edit.commit();
     }
 
+    public void initJingle(XMPPConnection adaptee) {
+	mJingle.initWhenConntected(adaptee);
+	
+    }
+
 }
--- a/src/com/beem/project/beem/jingle/JingleService.java	Thu Sep 24 19:38:56 2009 +0200
+++ b/src/com/beem/project/beem/jingle/JingleService.java	Thu Sep 24 23:54:11 2009 +0200
@@ -40,8 +40,8 @@
 
 	mMediaManagers = new ArrayList<JingleMediaManager>();
 	mMediaManagers.add(new MicrophoneRTPManager(bt));
-	mJingleManager = new JingleManager(xmppConnection, mMediaManagers);
-	mJingleManager.addJingleSessionRequestListener(new BeemJingleSessionRequestListener());
+	//mJingleManager = new JingleManager(xmppConnection, mMediaManagers);
+	//mJingleManager.addJingleSessionRequestListener(new BeemJingleSessionRequestListener());
 
     }
 
--- a/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Thu Sep 24 19:38:56 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppConnectionAdapter.java	Thu Sep 24 23:54:11 2009 +0200
@@ -363,6 +363,7 @@
 	    }, filter);
 
 	    mService.resetStatus();
+	    mService.initJingle(mAdaptee);
 
 	    final int n = mRemoteConnListeners.beginBroadcast();
 
--- a/src/com/beem/project/beem/ui/ContactList.java	Thu Sep 24 19:38:56 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java	Thu Sep 24 23:54:11 2009 +0200
@@ -3,6 +3,7 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Map;
 
 import org.jivesoftware.smack.util.StringUtils;
 
@@ -55,7 +56,7 @@
     private IRoster mRoster;
     private List<Contact> mListContact;
     private List<String> mListGroup;
-    private int mPosCurGroup = -1;
+    private Map<String, List<Contact>> mContactOnGroup;
     private Handler mHandler;
     private IXmppFacade mXmppFacade;
     private final ServiceConnection mServConn = new BeemServiceConnection();
@@ -122,98 +123,6 @@
     }
 
     /**
-     * Event on middle groupe name.
-     */
-    private class OnClickGroupName implements View.OnClickListener {
-	/**
-	 * Constructor.
-	 */
-	public OnClickGroupName() {
-
-	}
-
-	@Override
-	public void onClick(View arg0) {
-
-	}
-    }
-
-    /**
-     * Event on left groupe name.
-     */
-    private class OnClickLeft implements View.OnClickListener {
-	/**
-	 * Constructor.
-	 */
-	public OnClickLeft() {
-
-	}
-
-	@Override
-	public void onClick(View arg0) {
-	    mPosCurGroup--;
-	    if (mPosCurGroup < 0)
-		mPosCurGroup = mListGroup.size() - 1;
-	    buildBanner();
-	    try {
-		buildContactList(mRoster.getContactList(), mRoster.getGroupsNames());
-	    } catch (RemoteException e) {
-		e.printStackTrace();
-	    }
-	    mAdapter.notifyDataSetChanged();
-	    mAdapter.notifyDataSetChanged();
-	}
-    }
-
-    /**
-     * Event on right groupe name.
-     */
-    private class OnClickRight implements View.OnClickListener {
-
-	/**
-	 * Constructor.
-	 */
-	public OnClickRight() {
-
-	}
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public void onClick(View v) {
-	    mPosCurGroup++;
-	    if (mPosCurGroup == mListGroup.size())
-		mPosCurGroup = -1;
-	    buildBanner();
-	    try {
-		buildContactList(mRoster.getContactList(), mRoster.getGroupsNames());
-	    } catch (RemoteException e) {
-		e.printStackTrace();
-	    }
-	    mAdapter.notifyDataSetChanged();
-	}
-    }
-
-    /**
-     * Build Banner button.
-     */
-    protected void buildBanner() {
-	/*
-	 * Button bmid = (Button) findViewById(R.id.contactlist_group); Button bleft = (Button)
-	 * findViewById(R.id.contactlist_left); Button bright = (Button) findViewById(R.id.contactlist_right); if
-	 * (mPosCurGroup == -1) { bleft.setText(mListGroup.get(mListGroup.size() - 1));
-	 * bmid.setText(R.string.contact_list_all_contact); bright.setText(mListGroup.get(mPosCurGroup + 1)); } else if
-	 * (mPosCurGroup == 0) { bleft.setText(R.string.contact_list_all_contact);
-	 * bmid.setText(mListGroup.get(mPosCurGroup)); bright.setText(mListGroup.get(mPosCurGroup + 1)); } else if
-	 * (mPosCurGroup == mListGroup.size() -1 ) { bleft.setText(mListGroup.get(mPosCurGroup - 1));
-	 * bmid.setText(mListGroup.get(mPosCurGroup)); bmid.setText(R.string.contact_list_all_contact); } else {
-	 * bleft.setText(mListGroup.get(mPosCurGroup - 1)); bmid.setText(mListGroup.get(mPosCurGroup));
-	 * bright.setText(mListGroup.get(mPosCurGroup + 1)); }
-	 */
-    }
-
-    /**
      * {@inheritDoc}
      */
     @Override
@@ -287,14 +196,9 @@
 	Collections.sort(mListGroup);
 	if (mListContact != null)
 	    mListContact.clear();
-	if (mPosCurGroup == -1)
-	    mListContact = listContact;
-	else {
-	    String curGroup = mListGroup.get(mPosCurGroup);
-	    for (Contact c : listContact) {
-		if (c.getGroups().contains(curGroup)) {
-		    mListContact.add(c);
-		}
+	for (Contact c : listContact) {
+	    if (c.getGroups().contains(listGroup.get(0))) {
+		mListContact.add(c);
 	    }
 	}
 	sortBeemContactList();
@@ -303,8 +207,8 @@
 	listView.setOnItemLongClickListener(new BeemContactListOnLongClick());
 	listView.setAdapter(mAdapter);
 	Gallery g = (Gallery) findViewById(R.id.gallery);
-	g.setAdapter(new ImageAdapter(this));
-
+	g.setOnItemClickListener(new OnSelectedGroupName());
+	g.setAdapter(new BeemBanner(this));
     }
 
     /**
@@ -355,6 +259,19 @@
     }
 
     /**
+     * Event on middle groupe name.
+     */
+    private class OnSelectedGroupName implements OnItemClickListener {
+
+	@Override
+	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
+	    /*
+	     * TODO: Afficher la liste selon le group
+	     */
+	}
+    }
+
+    /**
      * Sort the contact list.
      */
     private void sortBeemContactList() {
@@ -430,17 +347,28 @@
 	}
 
 	@Override
+<<<<<<< local
+	public void onEntryDeleteFromGroup(String group, String jid) throws RemoteException {
+=======
 	public void onEntryDeleteFromGroup(String group, String jid)
 	throws RemoteException {
+>>>>>>> other
 	    // TODO Auto-generated method stub
+<<<<<<< local
+=======
 
+>>>>>>> other
 	}
+<<<<<<< local
+
+=======
+>>>>>>> other
 	/**
 	 * {@inheritDoc}
 	 */
 	@Override
 	public void onPresenceChanged(PresenceAdapter presence) throws RemoteException {
-	    //TODO gerer la presence au niveau de chaque ressources ?
+	    // TODO gerer la presence au niveau de chaque ressources ?
 	    String from = presence.getFrom();
 	    boolean resfound = false;
 	    for (Contact curContact : mListContact) {
@@ -454,17 +382,22 @@
 		    }
 		    curContact.setStatus(mRoster.getPresence(StringUtils.parseBareAddress(presence.getFrom())));
 		    int status = presence.getStatus();
-		    if (!resfound &&  (status != Status.CONTACT_STATUS_DISCONNECT && status != Status.CONTACT_STATUS_UNAVAILABLE))
+		    if (!resfound
+			&& (status != Status.CONTACT_STATUS_DISCONNECT && status != Status.CONTACT_STATUS_UNAVAILABLE))
 			curContact.addRes(pres);
-		    else if (resfound && (status == Status.CONTACT_STATUS_DISCONNECT && status == Status.CONTACT_STATUS_UNAVAILABLE))
+		    else if (resfound
+			&& (status == Status.CONTACT_STATUS_DISCONNECT && status == Status.CONTACT_STATUS_UNAVAILABLE))
 			curContact.delRes(pres);
 		    mHandler.post(new RunnableChange());
 		    return;
 		}
 	    }
 	}
+<<<<<<< local
+=======
 
 
+>>>>>>> other
     }
 
     /**
@@ -583,14 +516,14 @@
     /**
      * Adapter banner list.
      */
-    public class ImageAdapter extends BaseAdapter {
+    public class BeemBanner extends BaseAdapter {
 	private Context mContext;
 
 	/**
 	 * Constructor.
 	 * @param c context activity.
 	 */
-	public ImageAdapter(final Context c) {
+	public BeemBanner(final Context c) {
 	    mContext = c;
 	}