--- a/src/com/beem/project/beem/ui/ContactList.java Thu Jun 18 11:30:23 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Thu Jun 18 11:53:00 2009 +0200
@@ -104,18 +104,32 @@
unbindService(mServConn);
}
- class ComparatorContactListByStatus<T> implements Comparator<T> {
+ class ComparatorContactListByName<T> implements Comparator<T> {
+
@Override
public int compare(T c1, T c2) {
- if (((Contact) c1).getStatus() < ((Contact) c2).getStatus())
+ return ((Contact) c1).getName().compareToIgnoreCase(((Contact) c2).getName());
+ }
+
+ }
+
+ class ComparatorContactListByStatusAndName<T> implements Comparator<T> {
+
+ @Override
+ public int compare(T c1, T c2) {
+ if (((Contact) c1).getStatus() < ((Contact) c2).getStatus()) {
return 1;
- return -1;
+ } else if (((Contact) c1).getStatus() > ((Contact) c2).getStatus()) {
+ return -1;
+ } else
+ return ((Contact) c1).getName().compareToIgnoreCase(((Contact) c2).getName());
}
}
private void buildContactList(List<Contact> listContact) {
- Collections.sort(listContact, new ComparatorContactListByStatus<Contact>());
+ Collections.sort(listContact, new ComparatorContactListByStatusAndName<Contact>());
+ // Collections.sort(listContact, new ComparatorContactListByName<Contact>());
mListContact = listContact;
for (Contact contact : listContact) {
for (String group : contact.getGroups()) {