gpt4 book ai didi

com.koolearn.android.kooreader.ZLTreeAdapter类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 12:19:14 30 4
gpt4 key购买 nike

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

ZLTreeAdapter介绍

暂无

代码示例

代码示例来源:origin: Jiangzqts/EpubRead

private int getCount(ZLTree<?> tree) {
  int count = 1;
  if (isOpen(tree)) {
    for (ZLTree<?> subtree : tree.subtrees()) {
      count += getCount(subtree);
    }
  }
  return count;
}

代码示例来源:origin: Jiangzqts/EpubRead

public final void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  runTreeItem(getItem(position));
}

代码示例来源:origin: ydcx/KooReader

public final long getItemId(int position) {
  return indexByPosition(position + 1, Root);
}

代码示例来源:origin: ydcx/KooReader

public final void expandOrCollapseTree(ZLTree<?> tree) {
  if (!tree.hasChildren()) {
    return;
  }
  if (isOpen(tree)) {
    myOpenItems.remove(tree);
  } else {
    myOpenItems.add(tree);
  }
  notifyDataSetChanged();
}

代码示例来源:origin: Jiangzqts/EpubRead

private final int indexByPosition(int position, ZLTree<?> tree) {
  if (position == 0) {
    return 0;
  }
  --position;
  int index = 1;
  for (ZLTree<?> subtree : tree.subtrees()) {
    int count = getCount(subtree);
    if (count <= position) {
      position -= count;
      index += subtree.getSize();
    } else {
      return index + indexByPosition(position, subtree);
    }
  }
  throw new RuntimeException("That's impossible!!!");
}

代码示例来源:origin: Jiangzqts/EpubRead

public final void selectItem(ZLTree<?> tree) {
  if (tree == null) {
    return;
  }
  openTree(tree.Parent);
  int index = 0;
  while (true) {
    ZLTree<?> parent = tree.Parent;
    if (parent == null) {
      break;
    }
    for (ZLTree<?> sibling : parent.subtrees()) {
      if (sibling == tree) {
        break;
      }
      index += getCount(sibling);
    }
    tree = parent;
    ++index;
  }
  if (index > 0) {
    myParent.setSelection(index - 1);
  }
  myParent.invalidateViews();
}

代码示例来源:origin: Jiangzqts/EpubRead

protected boolean runTreeItem(ZLTree<?> tree) {
  if (!tree.hasChildren()) {
    return false;
  }
  expandOrCollapseTree(tree);
  return true;
}

代码示例来源:origin: ydcx/KooReader

@Override
  protected boolean runTreeItem(ZLTree<?> tree) {
    if (super.runTreeItem(tree)) {
      return true;
    }
    openBookText((TOCTree) tree);
    return true;
  }
}

代码示例来源:origin: Jiangzqts/EpubRead

public final int getCount() {
  return getCount(Root) - 1;
}

代码示例来源:origin: Jiangzqts/EpubRead

public final void expandOrCollapseTree(ZLTree<?> tree) {
  if (!tree.hasChildren()) {
    return;
  }
  if (isOpen(tree)) {
    myOpenItems.remove(tree);
  } else {
    myOpenItems.add(tree);
  }
  notifyDataSetChanged();
}

代码示例来源:origin: ydcx/KooReader

private final int indexByPosition(int position, ZLTree<?> tree) {
  if (position == 0) {
    return 0;
  }
  --position;
  int index = 1;
  for (ZLTree<?> subtree : tree.subtrees()) {
    int count = getCount(subtree);
    if (count <= position) {
      position -= count;
      index += subtree.getSize();
    } else {
      return index + indexByPosition(position, subtree);
    }
  }
  throw new RuntimeException("That's impossible!!!");
}

代码示例来源:origin: ydcx/KooReader

public final void selectItem(ZLTree<?> tree) {
  if (tree == null) {
    return;
  }
  openTree(tree.Parent);
  int index = 0;
  while (true) {
    ZLTree<?> parent = tree.Parent;
    if (parent == null) {
      break;
    }
    for (ZLTree<?> sibling : parent.subtrees()) {
      if (sibling == tree) {
        break;
      }
      index += getCount(sibling);
    }
    tree = parent;
    ++index;
  }
  if (index > 0) {
    myParent.setSelection(index - 1);
  }
  myParent.invalidateViews();
}

代码示例来源:origin: ydcx/KooReader

protected boolean runTreeItem(ZLTree<?> tree) {
  if (!tree.hasChildren()) {
    return false;
  }
  expandOrCollapseTree(tree);
  return true;
}

代码示例来源:origin: Jiangzqts/EpubRead

@Override
  protected boolean runTreeItem(ZLTree<?> tree) {
    if (super.runTreeItem(tree)) {
      return true;
    }
    openBookText((TOCTree) tree);
    return true;
  }
}

代码示例来源:origin: ydcx/KooReader

public final int getCount() {
  return getCount(Root) - 1;
}

代码示例来源:origin: ydcx/KooReader

private int getCount(ZLTree<?> tree) {
  int count = 1;
  if (isOpen(tree)) {
    for (ZLTree<?> subtree : tree.subtrees()) {
      count += getCount(subtree);
    }
  }
  return count;
}

代码示例来源:origin: ydcx/KooReader

public final void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  runTreeItem(getItem(position));
}

代码示例来源:origin: Jiangzqts/EpubRead

public final long getItemId(int position) {
  return indexByPosition(position + 1, Root);
}

代码示例来源:origin: Jiangzqts/EpubRead

public final ZLTree<?> getItem(int position) {
  final int index = indexByPosition(position + 1, Root) - 1;
  ZLTree<?> item = myItems[index];
  if (item == null) {
    item = Root.getTreeByParagraphNumber(index + 1);
    myItems[index] = item;
  }
  return item;
}

代码示例来源:origin: ydcx/KooReader

public final ZLTree<?> getItem(int position) {
  final int index = indexByPosition(position + 1, Root) - 1;
  ZLTree<?> item = myItems[index];
  if (item == null) {
    item = Root.getTreeByParagraphNumber(index + 1);
    myItems[index] = item;
  }
  return item;
}

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com