Java Code Examples for android.widget.Adapter#getItemViewType()
The following examples show how to use
android.widget.Adapter#getItemViewType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SeparatedListAdapter.java From RoMote with Apache License 2.0 | 6 votes |
public int getItemViewType(int position) { int type = 1; for(Object section : this.sections.keySet()) { Adapter adapter = sections.get(section); int size = adapter.getCount() + 1; // check if position inside this section if(position == 0) return TYPE_SECTION_HEADER; if(position < size) return type + adapter.getItemViewType(position - 1); // otherwise jump into next section position -= size; type += adapter.getViewTypeCount(); } return -1; }
Example 2
Source File: SeparatedListAdapter.java From sensordatacollector with GNU General Public License v2.0 | 6 votes |
@Override public int getItemViewType(int position) { int type = 1; for(String section : this.sections.keySet()) { Adapter adapter = sections.get(section); int size = adapter.getCount() + 1; // check if position inside this section if(position == 0) return TYPE_SECTION_HEADER; if(position < size) return type + adapter.getItemViewType(position - 1); // otherwise jump into next section position -= size; type += adapter.getViewTypeCount(); } return -1; }
Example 3
Source File: SeparatedListAdapter.java From padland with Apache License 2.0 | 6 votes |
public int getItemViewType(int position) { int type = 1; for(Object section : this.sections.keySet()) { Adapter adapter = sections.get(section); int size = adapter.getCount() + 1; // check if position inside this section if(position == 0) return TYPE_SECTION_HEADER; if(position < size) return type + adapter.getItemViewType(position - 1); // otherwise jump into next section position -= size; type += adapter.getViewTypeCount(); } return -1; }
Example 4
Source File: SeparatedListAdapter.java From Makeblock-App-For-Android with MIT License | 6 votes |
@Override public int getItemViewType(int position) { int type = 1; for (Object section : this.sections.keySet()) { Adapter adapter = sections.get(section); int size = adapter.getCount() + 1; // check if position inside this section if (position == 0) return TYPE_SECTION_HEADER; if (position < size) return type + adapter.getItemViewType(position - 1); // otherwise jump into next section position -= size; type += adapter.getViewTypeCount(); } return -1; }
Example 5
Source File: SeparatedListAdapter.java From BatteryFu with GNU General Public License v2.0 | 6 votes |
@Override public int getItemViewType(int position) { int type = 1; for (int i = 0; i < headers.getCount(); i++) { String section = headers.getItem(i); Adapter adapter = sections.get(section); int size = adapter.getCount() + 1; // check if position inside this section if (position == 0) return TYPE_SECTION_HEADER; if (position < size) return type + adapter.getItemViewType(position - 1); // otherwise jump into next section position -= size; type += adapter.getViewTypeCount(); } return -1; }
Example 6
Source File: SectionListAdapter.java From open-rmbt with Apache License 2.0 | 6 votes |
@Override public int getItemViewType(int position) { int type = 1; for (final Object section : sectionMap.keySet()) { final Adapter adapter = sectionMap.get(section); final int size = adapter.getCount() + (hasSectionHeader ? 1 : 0); if (position == 0 && hasSectionHeader) return TYPE_SECTION_HEADER; if (position < size) return type + adapter.getItemViewType(position - 1); position -= size; type += adapter.getViewTypeCount(); } return -1; }