sort users in muc

This commit is contained in:
Daniel Gultsch 2015-02-07 12:29:32 +01:00
parent 00b2e30938
commit ae8c021c16

View file

@ -25,6 +25,8 @@ import android.widget.Toast;
import org.openintents.openpgp.util.OpenPgpUtils; import org.openintents.openpgp.util.OpenPgpUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List; import java.util.List;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
@ -431,9 +433,16 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
} }
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
membersView.removeAllViews(); membersView.removeAllViews();
for (final User user : mConversation.getMucOptions().getUsers()) { final ArrayList<User> users = new ArrayList<>();
View view = inflater.inflate(R.layout.contact, membersView, users.addAll(mConversation.getMucOptions().getUsers());
false); Collections.sort(users,new Comparator<User>() {
@Override
public int compare(User lhs, User rhs) {
return lhs.getName().compareToIgnoreCase(rhs.getName());
}
});
for (final User user : users) {
View view = inflater.inflate(R.layout.contact, membersView,false);
this.setListItemBackgroundOnView(view); this.setListItemBackgroundOnView(view);
view.setOnClickListener(new OnClickListener() { view.setOnClickListener(new OnClickListener() {
@Override @Override