示例#1
0
 @Override
 public Object getItem(int position) {
   SectionAndItem<T> sectionAndItem = getSectionAndItem(position);
   return (sectionAndItem.getType() == SectionAndItem.Type.GRAPH_OBJECT)
       ? sectionAndItem.graphObject
       : null;
 }
示例#2
0
 @Override
 public int getSectionForPosition(int position) {
   SectionAndItem<T> sectionAndItem = getSectionAndItem(position);
   if (sectionAndItem != null && sectionAndItem.getType() != SectionAndItem.Type.ACTIVITY_CIRCLE) {
     return Math.max(
         0, Math.min(sectionKeys.indexOf(sectionAndItem.sectionKey), sectionKeys.size() - 1));
   }
   return 0;
 }
示例#3
0
 @Override
 public int getItemViewType(int position) {
   SectionAndItem<T> sectionAndItem = getSectionAndItem(position);
   switch (sectionAndItem.getType()) {
     case SECTION_HEADER:
       return HEADER_VIEW_TYPE;
     case GRAPH_OBJECT:
       return GRAPH_OBJECT_VIEW_TYPE;
     case ACTIVITY_CIRCLE:
       return ACTIVITY_CIRCLE_VIEW_TYPE;
     default:
       throw new FacebookException("Unexpected type of section and item.");
   }
 }
示例#4
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    SectionAndItem<T> sectionAndItem = getSectionAndItem(position);

    switch (sectionAndItem.getType()) {
      case SECTION_HEADER:
        return getSectionHeaderView(sectionAndItem.sectionKey, convertView, parent);
      case GRAPH_OBJECT:
        return getGraphObjectView(sectionAndItem.graphObject, convertView, parent);
      case ACTIVITY_CIRCLE:
        // If we get a request for this view, it means we need more data.
        assert cursor.areMoreObjectsAvailable() && (dataNeededListener != null);
        dataNeededListener.onDataNeeded();
        return getActivityCircleView(convertView, parent);
      default:
        throw new FacebookException("Unexpected type of section and item.");
    }
  }
示例#5
0
 @Override
 public boolean isEnabled(int position) {
   SectionAndItem<T> sectionAndItem = getSectionAndItem(position);
   return sectionAndItem.getType() == SectionAndItem.Type.GRAPH_OBJECT;
 }