示例#1
0
  public void addToList(String listName, String fullName, Boolean addToEnd, String delimiter) {
    // Log.d(TAG, "addToList(" + listName + ", " + fullName + ", " + addToEnd + ", " + delimiter +
    // ")");

    if (delimiter.equals("/")) {
      if (fullName.endsWith("/" + DIR_TAG)) {
        fullName = fullName.substring(0, fullName.length() - DIR_TAG.length() - 1);
        File f = new File(fullName);
        if (!f.exists()) return;
        addToList_internal(listName, fullName, DIR_TAG, addToEnd);
      } else {
        File f = new File(fullName);
        if (!f.exists()) return;
        addToList_internal(listName, f.getParent(), f.getName(), addToEnd);
      }
    } else {
      int ind = fullName.indexOf(delimiter);
      if (ind < 0) return;
      if (ind + delimiter.length() >= fullName.length()) return;
      String dname = fullName.substring(0, ind);
      String fname = fullName.substring(ind + delimiter.length());
      if (listName.equals("history")) {
        // Special case - delimiter is not "/" but we need to check file existence anyway.
        // directory name is a full file name in such case. filename is a READ/NEW mark
        File f = new File(dname);
        if (!f.exists()) return;
        addToList_internal(listName, dname, fname, addToEnd);
      } else addToList_internal(listName, dname, fname, addToEnd);
    }
  }
示例#2
0
 // Add to list
 public void addToList(String listName, String dr, String fn, Boolean addToEnd) {
   // Log.d(TAG, "addToList(" + listName + ", " + dr + ":" + fn + ", " + addToEnd + ")");
   addToList_internal(listName, dr, fn, addToEnd);
 }