From 21061d5348b8298a4ea86e5d8b9f4d0f297432dd Mon Sep 17 00:00:00 2001 From: xuxiuxi <xuxiuxi@454eff88-639b-444f-9e54-f578c98de674> Date: 星期四, 06 四月 2017 15:36:06 +0800 Subject: [PATCH] --- VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/adapter/PhoneCallFragment.java | 50 +++++++++----------------------------------------- 1 files changed, 9 insertions(+), 41 deletions(-) diff --git a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/adapter/PhoneCallFragment.java b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/adapter/PhoneCallFragment.java index ea8a568..0201f9e 100644 --- a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/adapter/PhoneCallFragment.java +++ b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/adapter/PhoneCallFragment.java @@ -31,11 +31,16 @@ @Override public int[] getItemLayouts() { - return new int[]{R.layout.fragment_phone_call_left_row}; + return new int[]{R.layout.fragment_phone_call_left_row, R.layout.fragment_phone_call_left_first_letter_row}; } @Override public void onBindRecycleViewHolder(EasyRecyclerViewHolder viewHolder, int position) { + if (!(getItem(position) instanceof PhoneCallQueryItem)) { + TextView fragment_phone_call_left_row_first_letter_name = viewHolder.findViewById(R.id.fragment_phone_call_left_row_first_letter_name); + fragment_phone_call_left_row_first_letter_name.setText(getItem(position)+"".toUpperCase()); + return; + } TextView fragment_phone_call_left_row_name = viewHolder.findViewById(R.id.fragment_phone_call_left_row_name); TextView fragment_phone_call_left_row_dept = viewHolder.findViewById(R.id.fragment_phone_call_left_interviewee_row_dept); if (isSortByDept) { @@ -62,51 +67,14 @@ @Override public int getRecycleViewItemType(int position) { + if (!(getItem(position) instanceof PhoneCallQueryItem)) { + return 1; + } return 0; } public void setSortByDept(boolean isSortByDept) { this.isSortByDept = isSortByDept; - } - } - - public class AlphabeticalAdapter extends ArrayAdapter<String> implements SectionIndexer - { - private HashMap<String, Integer> alphaIndexer; - private String[] sections; - - public AlphabeticalAdapter(Context c, int resource, List<String> data) - { - super(c, resource, data); - alphaIndexer = new HashMap<String, Integer>(); - for (int i = 0; i < data.size(); i++) - { - String s = data.get(i).substring(0, 1).toUpperCase(); - if (!alphaIndexer.containsKey(s)) - alphaIndexer.put(s, i); - } - - Set<String> sectionLetters = alphaIndexer.keySet(); - ArrayList<String> sectionList = new ArrayList<String>(sectionLetters); - Collections.sort(sectionList); - sections = new String[sectionList.size()]; - for (int i = 0; i < sectionList.size(); i++) - sections[i] = sectionList.get(i); - } - - public int getPositionForSection(int section) - { - return alphaIndexer.get(sections[section]); - } - - public int getSectionForPosition(int position) - { - return 1; - } - - public Object[] getSections() - { - return sections; } } -- Gitblit v1.8.0