Пример #1
0
  /**
   * Show dialog with given reference selected
   *
   * @param selectedRef
   */
  public void show(Reference selectedRef) {
    if (refs == null || refs.isEmpty()) {
      load(selectedRef);
      return;
    }

    final ArrayList<Reference> refList = new ArrayList<>(refs.values());
    int checked = -1;
    if (selectedRef != null) {
      String ref = selectedRef.getRef();
      for (int i = 0; i < refList.size(); i++) {
        String candidate = refList.get(i).getRef();
        if (ref.equals(candidate)) {
          checked = i;
          break;
        } else if (ref.equals(RefUtils.getName(candidate))) {
          checked = i;
          break;
        }
      }
    }

    RefDialogFragment.show(
        activity, requestCode, activity.getString(R.string.select_ref), null, refList, checked);
  }
Пример #2
0
  /**
   * Create tree with branch
   *
   * @param tree
   * @param reference
   */
  public FullTree(final Tree tree, final Reference reference) {
    this.tree = tree;
    this.reference = reference;
    this.branch = RefUtils.getName(reference);

    root = new Folder();
    List<TreeEntry> entries = tree.getTree();
    if (entries != null && !entries.isEmpty()) for (TreeEntry entry : entries) root.add(entry);
  }