com.zx.zxutils.views.ExpandableView.ZXExpandRecyclerHelper类的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(113)

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

ZXExpandRecyclerHelper介绍

暂无

代码示例

代码示例来源:origin: StannyBing/ZXUtils

public static ZXExpandRecyclerHelper getInstance(Context context) {
  ZXExpandRecyclerHelper zxExpandRecyclerHelper = new ZXExpandRecyclerHelper(context);
  return zxExpandRecyclerHelper;
}

代码示例来源:origin: StannyBing/ZXUtils

public ZXExpandRecyclerHelper setData(List<ZXExpandBean> dataList) {
  this.dataList = dataList;
  setIndex(this.dataList, 0);
  refresh(dataList);
  return this;
}

代码示例来源:origin: StannyBing/ZXUtils

recyclerHelper = ZXExpandRecyclerHelper.getInstance(this);
recyclerHelper.withRecycler(rvExpand)
    .showSelect(true, true)
    .setData(dataList)
    .setItemTextSizeSp(14)
    .setItemHeightDp(40)
    .setChildSelectWhenMenuSelect(true)
    .setMenuCanSelect(true)
    .setItemClickListener(new ZXExpandItemClickListener() {
      @Override
      public void onItemClick(ZXExpandBean expandBean, int showPosition) {
    .build();

代码示例来源:origin: StannyBing/ZXUtils

private void setShowById(List<ZXExpandBean> dataList, String id) {
  for (int i = 0; i < dataList.size(); i++) {
    if (id.equals(dataList.get(i).getId())) {
      dataList.get(i).setShowChild(!dataList.get(i).isShowChild());
      //如果关闭item,就关闭它的所有子集
      if (!dataList.get(i).isShowChild()) {
        closeChild(dataList.get(i));
      }
      return;
    }
    if (dataList.get(i).getChildList() != null && dataList.get(i).getChildList().size() > 0) {
      setShowById(dataList.get(i).getChildList(), id);
    }
  }
}

代码示例来源:origin: StannyBing/ZXUtils

private void refresh(List<ZXExpandBean> dataList) {
  for (int i = 0; i < dataList.size(); i++) {
    showList.add(dataList.get(i));
    if (dataList.get(i).getChildList() != null && dataList.get(i).getChildList().size() > 0 && dataList.get(i).isShowChild()) {
      refresh(dataList.get(i).getChildList());
    }
  }
}

代码示例来源:origin: StannyBing/ZXUtils

private void setIndex(List<ZXExpandBean> dataList, int index) {
  for (int i = 0; i < dataList.size(); i++) {
    dataList.get(i).setIndex(index);
    String uuid = UUID.randomUUID().toString();
    dataList.get(i).setId(uuid);
    dataList.get(i).setShowChild(false);
    if (dataList.get(i).getChildList() != null && dataList.get(i).getChildList().size() > 0) {
      int item = index + 1;
      setIndex(dataList.get(i).getChildList(), item);
    }
  }
}

代码示例来源:origin: StannyBing/ZXUtils

@Override
  public void onItemClick(ZXExpandBean expandBean, int showPosition) {
    ZXToastUtil.showToast(expandBean.getId());
    recyclerHelper.changeOpenStatus(showPosition);
  }
})

代码示例来源:origin: StannyBing/ZXUtils

private void closeChild(ZXExpandBean zxExpandBean) {
  if (zxExpandBean.getChildList() == null) {
    return;
  }
  for (int i = 0; i < zxExpandBean.getChildList().size(); i++) {
    zxExpandBean.getChildList().get(i).setShowChild(false);
    if (zxExpandBean.getChildList().get(i).getChildList() != null && zxExpandBean.getChildList().get(i).getChildList().size() > 0) {
      closeChild(zxExpandBean.getChildList().get(i));
    }
  }
}

相关文章