# HG changeset patch # User Vincent Veronis # Date 1253207455 -7200 # Node ID 0a00323e7e5bc8fa80a1baac74ce2baefebbab6a # Parent c90f06cae09edcc58d490bcbc2a13734ea4248ac Defilement des boutons dans la banniere. diff -r c90f06cae09e -r 0a00323e7e5b src/com/beem/project/beem/ui/ContactList.java --- a/src/com/beem/project/beem/ui/ContactList.java Thu Sep 17 17:20:08 2009 +0200 +++ b/src/com/beem/project/beem/ui/ContactList.java Thu Sep 17 19:10:55 2009 +0200 @@ -154,13 +154,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) { @@ -191,11 +187,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) { @@ -206,6 +198,33 @@ } /** + * 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 @@ -289,9 +308,7 @@ } } } - sortBeemContactList(); - ListView listView = (ListView) findViewById(R.id.contactlist); listView.setOnItemClickListener(new BeemContactListOnClick()); listView.setOnItemLongClickListener(new BeemContactListOnLongClick()); @@ -448,6 +465,7 @@ public BeemContactList(final Context context) { mInflater = LayoutInflater.from(context); } + /** * {@inheritDoc} */ @@ -455,6 +473,7 @@ public int getCount() { return mListContact.size(); } + /** * {@inheritDoc} */ @@ -462,6 +481,7 @@ public Object getItem(int position) { return position; } + /** * {@inheritDoc} */ @@ -469,6 +489,7 @@ public long getItemId(int position) { return position; } + /** * {@inheritDoc} */