Merge.
authorVincent Veronis <veroni_v@epitech.net>
Thu, 24 Sep 2009 14:06:24 +0200
changeset 374 295cc30ae84a
parent 373 da35534975cd (diff)
parent 371 f2c9564a3cc7 (current diff)
child 376 76d505cbe7db
child 378 735a00bd56cb
Merge.
src/com/beem/project/beem/service/aidl/IBeemRosterListener.aidl
src/com/beem/project/beem/ui/ContactList.java
--- a/res/layout/contactlist.xml	Thu Sep 17 17:50:26 2009 +0200
+++ b/res/layout/contactlist.xml	Thu Sep 24 14:06:24 2009 +0200
@@ -3,21 +3,9 @@
 	android:layout_width="fill_parent" android:layout_height="fill_parent"
 	android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
 
-	<LinearLayout android:layout_width="fill_parent"
-		android:layout_height="wrap_content">
-		<Button android:id="@+id/contactlist_left" android:layout_width="wrap_content"
-			android:layout_height="wrap_content" android:text="Left"
-			android:layout_weight="1">
-		</Button>
-		<Button android:id="@+id/contactlist_group" android:layout_width="wrap_content"
-			android:layout_height="wrap_content" android:text="@string/contact_list_all_contact"
-			android:layout_weight="1">
-		</Button>
-		<Button android:id="@+id/contactlist_right" android:layout_width="wrap_content"
-			android:layout_height="wrap_content" android:text="Right"
-			android:layout_weight="1">
-		</Button>
-	</LinearLayout>
+	<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" />
 
 	<LinearLayout android:layout_width="fill_parent"
 		android:layout_height="fill_parent" android:orientation="horizontal">
--- a/src/com/beem/project/beem/service/aidl/IBeemRosterListener.aidl	Thu Sep 17 17:50:26 2009 +0200
+++ b/src/com/beem/project/beem/service/aidl/IBeemRosterListener.aidl	Thu Sep 24 14:06:24 2009 +0200
@@ -7,4 +7,5 @@
     void onEntriesUpdated(in List<String> addresses);
     void onEntriesDeleted(in List<String> addresses);
     void onPresenceChanged(in PresenceAdapter presence);
+    void onEntryDeleteFromGroup(in String group, in String jid);
 }
\ No newline at end of file
--- a/src/com/beem/project/beem/ui/ContactList.java	Thu Sep 17 17:50:26 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java	Thu Sep 24 14:06:24 2009 +0200
@@ -26,6 +26,7 @@
 import android.widget.AdapterView;
 import android.widget.BaseAdapter;
 import android.widget.Button;
+import android.widget.Gallery;
 import android.widget.ImageView;
 import android.widget.ListView;
 import android.widget.TextView;
@@ -65,6 +66,15 @@
 
     }
 
+    @Override
+    protected void onCreate(Bundle saveBundle) {
+	super.onCreate(saveBundle);
+	setContentView(R.layout.contactlist);
+	mAdapter = new BeemContactList(this);
+	mHandler = new Handler();
+
+    }
+
     /**
      * Callback for menu creation.
      * @param menu the menu created
@@ -109,21 +119,6 @@
 	}
     }
 
-    @Override
-    protected void onCreate(Bundle saveBundle) {
-	super.onCreate(saveBundle);
-	setContentView(R.layout.contactlist);
-	mAdapter = new BeemContactList(this);
-	Button b = (Button) findViewById(R.id.contactlist_group);
-	b.setOnClickListener(new OnClickGroupName());
-	b = (Button) findViewById(R.id.contactlist_left);
-	b.setOnClickListener(new OnClickLeft());
-	b = (Button) findViewById(R.id.contactlist_right);
-	b.setOnClickListener(new OnClickRight());
-	mHandler = new Handler();
-
-    }
-
     /**
      * Event on middle groupe name.
      */
@@ -155,13 +150,9 @@
 	@Override
 	public void onClick(View arg0) {
 	    mPosCurGroup--;
-	    if (mPosCurGroup < -1)
+	    if (mPosCurGroup < 0)
 		mPosCurGroup = mListGroup.size() - 1;
-	    Button b = (Button) findViewById(R.id.contactlist_group);
-	    if (mPosCurGroup == -1)
-		b.setText(R.string.contact_list_all_contact);
-	    else
-		b.setText(mListGroup.get(mPosCurGroup));
+	    buildBanner();
 	    try {
 		buildContactList(mRoster.getContactList(), mRoster.getGroupsNames());
 	    } catch (RemoteException e) {
@@ -192,11 +183,7 @@
 	    mPosCurGroup++;
 	    if (mPosCurGroup == mListGroup.size())
 		mPosCurGroup = -1;
-	    Button b = (Button) findViewById(R.id.contactlist_group);
-	    if (mPosCurGroup == -1)
-		b.setText(R.string.contact_list_all_contact);
-	    else
-		b.setText(mListGroup.get(mPosCurGroup));
+	    buildBanner();
 	    try {
 		buildContactList(mRoster.getContactList(), mRoster.getGroupsNames());
 	    } catch (RemoteException e) {
@@ -207,6 +194,24 @@
     }
 
     /**
+     * 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
@@ -290,13 +295,14 @@
 		}
 	    }
 	}
-
 	sortBeemContactList();
-
 	ListView listView = (ListView) findViewById(R.id.contactlist);
 	listView.setOnItemClickListener(new BeemContactListOnClick());
 	listView.setOnItemLongClickListener(new BeemContactListOnLongClick());
 	listView.setAdapter(mAdapter);
+	Gallery g = (Gallery) findViewById(R.id.gallery);
+	g.setAdapter(new ImageAdapter(this));
+
     }
 
     /**
@@ -472,6 +478,7 @@
 	public BeemContactList(final Context context) {
 	    mInflater = LayoutInflater.from(context);
 	}
+
 	/**
 	 * {@inheritDoc}
 	 */
@@ -479,6 +486,7 @@
 	public int getCount() {
 	    return mListContact.size();
 	}
+
 	/**
 	 * {@inheritDoc}
 	 */
@@ -486,6 +494,7 @@
 	public Object getItem(int position) {
 	    return position;
 	}
+
 	/**
 	 * {@inheritDoc}
 	 */
@@ -493,6 +502,7 @@
 	public long getItemId(int position) {
 	    return position;
 	}
+
 	/**
 	 * {@inheritDoc}
 	 */
@@ -569,6 +579,56 @@
     }
 
     /**
+     * Adapter banner list.
+     */
+    public class ImageAdapter extends BaseAdapter {
+	private Context mContext;
+
+	/**
+	 * Constructor.
+	 * @param c context activity.
+	 */
+	public ImageAdapter(final Context c) {
+	    mContext = c;
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public int getCount() {
+	    return mListGroup.size();
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public Object getItem(int position) {
+	    return position;
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public long getItemId(int position) {
+	    return position;
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public View getView(int position, View convertView, ViewGroup parent) {
+	    TextView i = new TextView(mContext);
+	    i.setText(mListGroup.get(position));
+	    return i;
+	}
+
+    }
+
+    /**
      * The service connection used to connect to the Beem service.
      */
     private class BeemServiceConnection implements ServiceConnection {