Search in sources :

Example 6 with Friend

use of com.rongseal.bean.Friend in project SeaStar by 13120241790.

the class StartDiscussionActivity method filterData.

/**
     * 根据输入框中的值来过滤数据并更新ListView
     *
     * @param filterStr
     */
private void filterData(String filterStr) {
    List<Friend> filterDateList = new ArrayList<Friend>();
    if (TextUtils.isEmpty(filterStr)) {
        filterDateList = SourceDateList;
    } else {
        filterDateList.clear();
        for (Friend friendModel : SourceDateList) {
            String name = friendModel.getName();
            if (name.indexOf(filterStr.toString()) != -1 || characterParser.getSelling(name).startsWith(filterStr.toString())) {
                filterDateList.add(friendModel);
            }
        }
    }
    // 根据a-z进行排序
    Collections.sort(filterDateList, pinyinComparator);
    adapter.updateListView(filterDateList);
}
Also used : Friend(com.rongseal.bean.Friend) ArrayList(java.util.ArrayList)

Aggregations

Friend (com.rongseal.bean.Friend)6 ArrayList (java.util.ArrayList)4 Editable (android.text.Editable)1 TextWatcher (android.text.TextWatcher)1 FriendAdapter (com.rongseal.adapter.FriendAdapter)1 SideBar (com.rongseal.pinyin.SideBar)1