petit debug sur le call et maj group
authorNikita Kozlov <nikita@beem-project.com>
Fri, 02 Oct 2009 14:56:42 +0200
changeset 436 13468f4c8f45
parent 435 fb1fff26e2ad
child 437 fbac93bba310
petit debug sur le call et maj group
res/layout/group_list.xml
src/com/beem/project/beem/BeemService.java
src/com/beem/project/beem/ui/ContactDialog.java
src/com/beem/project/beem/ui/GroupList.java
--- a/res/layout/group_list.xml	Fri Oct 02 12:07:48 2009 +0200
+++ b/res/layout/group_list.xml	Fri Oct 02 14:56:42 2009 +0200
@@ -1,20 +1,13 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical"
-    android:layout_width="fill_parent" 
-    android:layout_height="fill_parent"
-    android:paddingLeft="8dip"
-    android:paddingRight="8dip">
-    
-    <ListView android:id="@android:id/list"
-        android:layout_width="fill_parent" 
-        android:layout_height="0dip"
-        android:layout_weight="1"
-        android:stackFromBottom="true"
-        android:transcriptMode="normal"/>
-        
-    <EditText android:id="@+id/GroupListText"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:singleLine="true" />
-        
+	android:orientation="vertical" android:layout_width="fill_parent"
+	android:layout_height="fill_parent" android:paddingLeft="8dip"
+	android:paddingRight="8dip">
+
+	<ListView android:id="@android:id/list" android:layout_width="fill_parent"
+		android:layout_height="0dip" android:layout_weight="1"
+		android:stackFromBottom="true" android:transcriptMode="normal" />
+
+	<EditText android:id="@+id/GroupListText"
+		android:layout_width="fill_parent" android:layout_height="wrap_content"
+		android:singleLine="true" />
 </LinearLayout>
\ No newline at end of file
--- a/src/com/beem/project/beem/BeemService.java	Fri Oct 02 12:07:48 2009 +0200
+++ b/src/com/beem/project/beem/BeemService.java	Fri Oct 02 14:56:42 2009 +0200
@@ -137,8 +137,8 @@
 	mConnection = new XmppConnectionAdapter(mConnectionConfiguration, mLogin, mPassword, this);
 
 	Roster.setDefaultSubscriptionMode(SubscriptionMode.manual);
+	mJingle = new JingleService(mConnection.getAdaptee());
 	mBind = new XmppFacade(mConnection, this, mJingle);
-	mJingle = new JingleService(mConnection.getAdaptee());
     }
 
     /**
--- a/src/com/beem/project/beem/ui/ContactDialog.java	Fri Oct 02 12:07:48 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactDialog.java	Fri Oct 02 14:56:42 2009 +0200
@@ -12,7 +12,6 @@
 import android.view.View;
 import android.widget.Button;
 
-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.IXmppFacade;
@@ -23,10 +22,15 @@
  */
 public class ContactDialog extends Dialog {
 
+    private static final Intent SERVICE_INTENT = new Intent();
     private final Contact mContact;
     private final Context mContext;
     private IXmppFacade mXmppFacade;
     private final ServiceConnection mServConn = new BeemServiceConnection();
+    
+    static {
+	SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
+    }
 
     /**
      * Constructor.
@@ -47,15 +51,14 @@
 	button.setOnClickListener(new InfosListener());
 	button = (Button) findViewById(R.id.CDCall);
 	button.setOnClickListener(new CallListener());
-
-	mContext.bindService(new Intent(mContext, BeemService.class), mServConn, Service.BIND_AUTO_CREATE);
+	mContext.bindService(SERVICE_INTENT, mServConn, Service.BIND_AUTO_CREATE);
     }
 
     @Override
     public void dismiss() {
 	super.dismiss();
 	mContext.unbindService(mServConn);
-    }
+    }    
 
     /**
      * Event simple click on call button.
--- a/src/com/beem/project/beem/ui/GroupList.java	Fri Oct 02 12:07:48 2009 +0200
+++ b/src/com/beem/project/beem/ui/GroupList.java	Fri Oct 02 14:56:42 2009 +0200
@@ -8,8 +8,11 @@
 import android.os.Bundle;
 import android.os.IBinder;
 import android.os.RemoteException;
+import android.util.Log;
+import android.view.View;
 import android.widget.ArrayAdapter;
 import android.widget.ListView;
+import android.widget.TextView;
 
 import com.beem.project.beem.BeemService;
 import com.beem.project.beem.R;
@@ -35,6 +38,8 @@
 
     private Contact mContact;
 
+    private TextView mText;
+
     static {
 	SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
     }
@@ -50,20 +55,8 @@
 
 	listView.setItemsCanFocus(false);
 	listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
-    }
-
-    private void setAdapter(){
-	try {
-	    mGroups = new ArrayAdapter<String>(this,
-		android.R.layout.simple_list_item_multiple_choice, mRoster.getGroupsNames().toArray(new String[(mRoster.getGroupsNames().size())]));
-	    setListAdapter(mGroups);
-	    mContact = new Contact(mJID);
-	    for (String group : mContact.getGroups()) {
-		getListView().setItemChecked(mGroups.getPosition(group), true);
-	    }
-	} catch (RemoteException e) {
-	    e.printStackTrace();
-	}	
+	
+	mText = (TextView) findViewById(R.id.GroupListText);
     }
 
     /**
@@ -87,6 +80,24 @@
 	if (mReceiver.isBinded())
 	    unbindService(mServConn);
     }
+    
+    protected void onListItemClick(ListView l, View v, int position, long id) {
+	Log.d("GROUPLIST","CLICK");	
+    }
+    
+    private void setAdapter(){
+	try {
+	    mGroups = new ArrayAdapter<String>(this,
+		android.R.layout.simple_list_item_multiple_choice, mRoster.getGroupsNames().toArray(new String[(mRoster.getGroupsNames().size())]));
+	    setListAdapter(mGroups);
+	    mContact = mRoster.getContact(mJID);
+	    for (String group : mContact.getGroups()) {
+		getListView().setItemChecked(mGroups.getPosition(group), true);
+	    }
+	} catch (RemoteException e) {
+	    e.printStackTrace();
+	}	
+    }
 
     /**
      * The ServiceConnection used to connect to the Beem service.