android.widget.Adapter#getViewTypeCount ( )源码实例Demo

下面列出了android.widget.Adapter#getViewTypeCount ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: RoMote   文件: SeparatedListAdapter.java
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;
}
 
@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;
}
 
源代码3 项目: padland   文件: SeparatedListAdapter.java
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;
}
 
@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;
}
 
源代码5 项目: BatteryFu   文件: SeparatedListAdapter.java
@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;
}
 
源代码6 项目: open-rmbt   文件: SectionListAdapter.java
@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;
}
 
源代码7 项目: RoMote   文件: SeparatedListAdapter.java
public int getViewTypeCount() {
    // assume that headers count as one, then total all sections
    int total = 1;
    for(Adapter adapter : this.sections.values())
        total += adapter.getViewTypeCount();
    return total;
}
 
@Override
public int getViewTypeCount()
{
    // assume that headers count as one, then total all sections
    int total = 1;
    for(Adapter adapter : this.sections.values())
        total += adapter.getViewTypeCount();
    return total;
}
 
源代码9 项目: padland   文件: SeparatedListAdapter.java
public int getViewTypeCount() {
    // assume that headers count as one, then total all sections
    int total = 1;
    for(Adapter adapter : this.sections.values())
        total += adapter.getViewTypeCount();
    return total;
}
 
@Override
public int getViewTypeCount() {
    // assume that headers count as one, then total all sections
    int total = 1;
    for (Adapter adapter : this.sections.values())
        total += adapter.getViewTypeCount();
    return total;
}
 
源代码11 项目: BatteryFu   文件: SeparatedListAdapter.java
@Override
public int getViewTypeCount() {
    // assume that headers count as one, and that there will be at least a itemViewType.
    // then total all sections
    int total = 2;
    for (Adapter adapter : this.sections.values())
        total += adapter.getViewTypeCount();
    return total;
}
 
源代码12 项目: open-rmbt   文件: SectionListAdapter.java
@Override
public int getViewTypeCount()
{
    int total = 1;
    
    for (final Adapter adapter : sectionMap.values())
        total += adapter.getViewTypeCount();
    
    return total;
}