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);
}
Aggregations