Modification de la banner.
Mise en place d'un adapter pour avoir un effet de liste horizontale.
--- a/res/layout/contactlist.xml Thu Sep 17 19:10:55 2009 +0200
+++ b/res/layout/contactlist.xml Thu Sep 17 20:39:09 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/ui/ContactList.java Thu Sep 17 19:10:55 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Thu Sep 17 20:39:09 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;
@@ -64,6 +65,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
@@ -108,21 +118,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.
*/
@@ -201,27 +196,18 @@
* 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));
- }
+ /*
+ * 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)); }
+ */
}
/**
@@ -313,6 +299,9 @@
listView.setOnItemClickListener(new BeemContactListOnClick());
listView.setOnItemLongClickListener(new BeemContactListOnLongClick());
listView.setAdapter(mAdapter);
+ Gallery g = (Gallery) findViewById(R.id.gallery);
+ g.setAdapter(new ImageAdapter(this));
+
}
/**
@@ -566,6 +555,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 {