# HG changeset patch # User marseille@KungFuh # Date 1238095775 -3600 # Node ID a0baf41c24a146d75aba55e9918e7a84c7bb4649 # Parent c537c1ea363639a5012657e91af496f137eacfc1 Ajout de la partie de barbu. Mais c'est en dur. diff -r c537c1ea3636 -r a0baf41c24a1 AndroidManifest.xml --- a/AndroidManifest.xml Thu Mar 26 18:26:13 2009 +0100 +++ b/AndroidManifest.xml Thu Mar 26 20:29:35 2009 +0100 @@ -10,6 +10,7 @@ + diff -r c537c1ea3636 -r a0baf41c24a1 res/layout/contactlist.xml --- a/res/layout/contactlist.xml Thu Mar 26 18:26:13 2009 +0100 +++ b/res/layout/contactlist.xml Thu Mar 26 20:29:35 2009 +0100 @@ -10,10 +10,15 @@ android:layout_width="wrap_content" android:layout_height="wrap_content"/> - - + + diff -r c537c1ea3636 -r a0baf41c24a1 src/com/beem/project/beem/BeemService.java --- a/src/com/beem/project/beem/BeemService.java Thu Mar 26 18:26:13 2009 +0100 +++ b/src/com/beem/project/beem/BeemService.java Thu Mar 26 20:29:35 2009 +0100 @@ -1,3 +1,4 @@ + /** * */ diff -r c537c1ea3636 -r a0baf41c24a1 src/com/beem/project/beem/ui/ContactList.java --- a/src/com/beem/project/beem/ui/ContactList.java Thu Mar 26 18:26:13 2009 +0100 +++ b/src/com/beem/project/beem/ui/ContactList.java Thu Mar 26 20:29:35 2009 +0100 @@ -11,133 +11,84 @@ import android.content.ServiceConnection; import android.os.Bundle; import android.os.IBinder; -import android.os.RemoteException; -import android.util.Log; +import android.view.View; import android.widget.ExpandableListAdapter; +import android.widget.ExpandableListView; import android.widget.SimpleExpandableListAdapter; import com.beem.project.beem.BeemService; import com.beem.project.beem.R; -import com.beem.project.beem.service.Contact; -import com.beem.project.beem.service.aidl.IBeemConnectionListener; -import com.beem.project.beem.service.aidl.IRoster; -import com.beem.project.beem.service.aidl.IXMPPConnection; import com.beem.project.beem.service.aidl.IXMPPFacade; public class ContactList extends ExpandableListActivity { - private static final String TAG = "CONTACTLIST_ACT"; - private IXMPPFacade mService = null; @Override public void onCreate(Bundle saveBundle) { - super.onCreate(saveBundle); - bindService(new Intent(this, BeemService.class), mConnection, - BIND_AUTO_CREATE | BIND_DEBUG_UNBIND); + super.onCreate(saveBundle); + bindService(new Intent(this, BeemService.class), mConnection, + BIND_AUTO_CREATE | BIND_DEBUG_UNBIND); + showContactList(); } + @Override + public boolean onChildClick(ExpandableListView parent, + View v, int groupPosition, int childPosition, long id) { + startActivity(new Intent(this, SendIM.class)); + return true; + + }; + private void showContactList() { - ExpandableListAdapter Adapter; - - List> groupData = new ArrayList>(); - List>> childData = new ArrayList>>(); + ExpandableListAdapter Adapter; + + List> groupData = new ArrayList>(); + List>> childData = new ArrayList>>(); + + for (int i = 0; i < 2; i++) { + Map curGroupMap = new HashMap(); + groupData.add(curGroupMap); + curGroupMap.put("NAME", "Group " + i); - for (int i = 0; i < 2; i++) { - Map curGroupMap = new HashMap(); - groupData.add(curGroupMap); - curGroupMap.put("NAME", "Group " + i); - - List> children = new ArrayList>(); - for (int j = 0; j < 5; j++) { - Map curChildMap = new HashMap(); - children.add(curChildMap); - curChildMap.put("NAOME CHILD", "Child " + j); - } - childData.add(children); - } + List> children = new ArrayList>(); + for (int j = 0; j < 5; j++) { + Map curChildMap = new HashMap(); + children.add(curChildMap); + curChildMap.put("NAME CHILD", "Child " + j); + curChildMap.put("MSG", "Taper votre message perso"); + } + childData.add(children); + } - Adapter = new SimpleExpandableListAdapter(this, - groupData, R.layout.contactlistgroup, - new String[] {"NAME"}, new int[] {R.id.textgroup}, - childData, R.layout.contactlist, - new String[] {"NAME CHILD"}, new int[] {R.id.textchild}); - setListAdapter(Adapter); + Adapter = new SimpleExpandableListAdapter(this, groupData, + R.layout.contactlistgroup, new String[] { "NAME" }, + new int[] { R.id.textgroup }, childData, R.layout.contactlist, + new String[] { "NAME CHILD", "MSG" }, new int[] { + R.id.textchild1, R.id.textchild2 }); + setListAdapter(Adapter); } private ServiceConnection mConnection = new ServiceConnection() { - @Override - public void onServiceConnected(ComponentName name, IBinder service) { - mService = IXMPPFacade.Stub.asInterface(service); - try { - IXMPPConnection con = mService.createConnection(); - con.addConnectionListener(new TestConnectionListener()); - mService.connectSync(); - Log.i("BEEM", "Connected !!!"); - } catch (RemoteException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - /* - * mService.getGroupList(); mService.getContactList(); - */ - } + @Override + public void onServiceConnected(ComponentName name, IBinder service) { + mService = IXMPPFacade.Stub.asInterface(service); + /* + * mService.getGroupList(); mService.getContactList(); + */ + showContactList(); + } - @Override - public void onServiceDisconnected(ComponentName name) { - } + @Override + public void onServiceDisconnected(ComponentName name) { + } }; @Override public void onDestroy() { - super.onDestroy(); - unbindService(mConnection); + super.onDestroy(); + unbindService(mConnection); } - private class TestConnectionListener extends IBeemConnectionListener.Stub { - - @Override - public void connectionClosed() throws RemoteException { - // TODO Auto-generated method stub - - } - - @Override - public void connectionClosedOnError() throws RemoteException { - // TODO Auto-generated method stub - - } - - @Override - public void onConnect() throws RemoteException { - // TODO Auto-generated method stub - IRoster roster = mService.getRoster(); - for (Contact contact : roster.getContactList()) { - Log.v(TAG,"Contact name " + contact.getJID() ); - } - showContactList(); - } - - @Override - public void reconnectingIn(int seconds) throws RemoteException { - // TODO Auto-generated method stub - - } - - @Override - public void reconnectionFailed() throws RemoteException { - // TODO Auto-generated method stub - - } - - @Override - public void reconnectionSuccessful() throws RemoteException { - // TODO Auto-generated method stub - - } - - } - }