android.widget.ExpandableListAdapter.getGroupCount()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中android.widget.ExpandableListAdapter.getGroupCount()方法的一些代码示例,展示了ExpandableListAdapter.getGroupCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExpandableListAdapter.getGroupCount()方法的具体详情如下:
包路径:android.widget.ExpandableListAdapter
类名称:ExpandableListAdapter
方法名:getGroupCount

ExpandableListAdapter.getGroupCount介绍

暂无

代码示例

代码示例来源:origin: androidquery/androidquery

public T expand(boolean expand){
  
  if(view instanceof ExpandableListView){
    
    ExpandableListView elv = (ExpandableListView) view;            
    ExpandableListAdapter ela = elv.getExpandableListAdapter();
    
    if(ela != null){
      
      int count = ela.getGroupCount();
      
      for(int i = 0; i < count; i++){
        if(expand){
          elv.expandGroup(i);
        }else{
          elv.collapseGroup(i);
        }
      }
      
    }
    
      
  }
  
  return self();
}

代码示例来源:origin: xiangzhihong/gpuImage

public int getCount() {
  /*
   * Total count for the list view is the number groups plus the 
   * number of children from currently expanded groups (a value we keep
   * cached in this class)
   */
  return mExpandableListAdapter.getGroupCount() + mTotalExpChildrenCount;
}

代码示例来源:origin: jclehner/rxdroid

public boolean isListEmpty()
{
  if(mAdapter != null)
    return mAdapter.getGroupCount() == 0;
  return true;
}

代码示例来源:origin: jclehner/rxdroid

public void collapseAll()
{
  mExpandAll = false;
  if(mList == null || mAdapter == null)
    return;
  for(int i = 0; i != mAdapter.getGroupCount(); ++i)
    mList.collapseGroup(i);
}

代码示例来源:origin: mttkay/calculon

public void hasGroups() {
  assertFalse("list view expected not to be empty, but it was", getAdapter().getGroupCount() > 0);
}

代码示例来源:origin: mttkay/calculon

public void hasGroups(int count) {
  int actual = getAdapter().getGroupCount();
  assertEquals("list group count mismatch:", count, actual);
}

代码示例来源:origin: jclehner/rxdroid

private boolean isAllCollapsed() {
  return mCollapsedCount == getListAdapter().getGroupCount();
}

代码示例来源:origin: gigabytedevelopers/FireFiles

private void restoreExpandedState(ArrayList<Long> expandedIds) {
  this.expandedIds = expandedIds;
  if (expandedIds != null) {
    ExpandableListView list = mList;
    ExpandableListAdapter adapter = mAdapter;
    if (adapter != null) {
      for (int i=0; i<adapter.getGroupCount(); i++) {
        long id = adapter.getGroupId(i);
        if (expandedIds.contains(id)) list.expandGroup(i);
      }
    }
  }
}

代码示例来源:origin: mttkay/calculon

public MultiViewAssertion groups() {
  ExpandableListAdapter adapter = getAdapter();
  int count = adapter.getGroupCount();
  List<View> views = new ArrayList<View>(count);
  for (int i = 0; i < count; i++) {
    views.add(adapter.getGroupView(i, false, null, listView));
  }
  return new MultiViewAssertion(testCase, activity, views);
}

代码示例来源:origin: jclehner/rxdroid

private void expandAllInternal(/*boolean animate*/)
  {
    for(int i = 0; i != mAdapter.getGroupCount(); ++i)
    {
      if(Version.SDK_IS_JELLYBEAN_OR_NEWER)
        mList.expandGroup(i /*, animate*/);
      else
        mList.expandGroup(i);
    }
  }
}

代码示例来源:origin: andresth/Kandroid

@Override
  public void onResume() {
    super.onResume();
    assert getView() != null : "ProjectInactiveTasksFragment: getView() returned null";
    ExpandableListView lv = (ExpandableListView) getView().findViewById(R.id.expandable_list);
    for (int i = 0; i < lv.getExpandableListAdapter().getGroupCount(); i++)
      lv.expandGroup(i);
  }
}

代码示例来源:origin: mttkay/calculon

public ViewAssertion lastGroup() {
  return group(getAdapter().getGroupCount() - 1);
}

代码示例来源:origin: andresth/Kandroid

@Override
  public void onResume() {
    super.onResume();
    assert getView() != null : "ProjectTaskFragment: getView() returned null";
    ExpandableListView lv = (ExpandableListView) getView().findViewById(R.id.expandable_list);
    for (int i = 0; i < lv.getExpandableListAdapter().getGroupCount(); i++)
      lv.expandGroup(i);
  }
}

代码示例来源:origin: andresth/Kandroid

@Override
  public void onResume() {
    super.onResume();
    assert getView() != null : "ProjectOverdueTasksFragment: getView() returned null";
    ExpandableListView lv = (ExpandableListView) getView().findViewById(R.id.expandable_list);
    for (int i = 0; i < lv.getExpandableListAdapter().getGroupCount(); i++)
      lv.expandGroup(i);
  }
}

代码示例来源:origin: it.tidalwave.bluebill/it-tidalwave-android-utilities

public void run()
       {
        final int groupCount = expandableListView.getExpandableListAdapter().getGroupCount();

        if (groupCount > 0)
         {
          for (int i = 0; i < groupCount - 1; i++)
           {
            expandableListView.collapseGroup(i);
           }

//                    logger.info(">>>> expanding group %s...", groupCount - 1);
          expandableListView.expandGroup(groupCount - 1);
         }
       }
     });

代码示例来源:origin: it.tidalwave.bluebill/it-tidalwave-android-utilities

public void run()
       {
        final int groupCount = expandableListView.getExpandableListAdapter().getGroupCount();

        if (groupCount > 0)
         {
          for (int i = 0; i < groupCount - 1; i++)
           {
            expandableListView.collapseGroup(i);
           }

//                    logger.info(">>>> expanding group %s...", groupCount - 1);
          expandableListView.expandGroup(groupCount - 1);
         }
       }
     });

代码示例来源:origin: VREMSoftwareDevelopment/WiFiAnalyzer

void update(@NonNull List<WiFiDetail> wiFiDetails, ExpandableListView expandableListView) {
  updateGroupBy();
  if (isGroupExpandable() && expandableListView != null) {
    int groupCount = expandableListView.getExpandableListAdapter().getGroupCount();
    for (int i = 0; i < groupCount; i++) {
      WiFiDetail wiFiDetail = getWiFiDetail(wiFiDetails, i);
      if (expanded.contains(getGroupExpandKey(wiFiDetail))) {
        expandableListView.expandGroup(i);
      } else {
        expandableListView.collapseGroup(i);
      }
    }
  }
}

代码示例来源:origin: mttkay/calculon

public ViewAssertion lastChild(int groupPosition) {
  return child(getAdapter().getGroupCount() - 1, getAdapter().getChildrenCount(groupPosition) - 1);
}

代码示例来源:origin: jclehner/rxdroid

private void updateListView(int flags)
{
  getArguments().putInt("flags", flags);
  gatherEventInfos(flags);
  setListAdapter(new Adapter());
  if(!Settings.getBoolean(Keys.LOG_IS_ALL_COLLAPSED, true))
    expandAll(false);
  else
    mCollapsedCount = getListAdapter().getGroupCount();
}

代码示例来源:origin: VREMSoftwareDevelopment/WiFiAnalyzer

@Test
public void testAfterUpdateWithGroupByChannel() {
  // setup
  List<WiFiDetail> wiFiDetails = withWiFiDetails();
  when(settings.getGroupBy()).thenReturn(GroupBy.CHANNEL);
  when(expandableListView.getExpandableListAdapter()).thenReturn(expandableListAdapter);
  when(expandableListAdapter.getGroupCount()).thenReturn(wiFiDetails.size());
  // execute
  fixture.update(wiFiDetails, expandableListView);
  // validate
  verify(settings).getGroupBy();
  verify(expandableListView).getExpandableListAdapter();
  verify(expandableListAdapter).getGroupCount();
  assertEquals(GroupBy.CHANNEL, fixture.getGroupBy());
}

相关文章