Exemple #1
0
  public void removeFromList_internal(String listName, String dr, String fn) {
    // Log.d(TAG, "removeFromList_internal(" + listName + ", " + dr + ":" + fn  + ")");

    if (!m.containsKey(listName)) return;
    List<String[]> resultList = m.get(listName);
    for (int i = 0; i < resultList.size(); i++) {
      if (resultList.get(i)[0].equals(dr) && resultList.get(i)[1].equals(fn)) {
        resultList.remove(i);
        saveList(listName);
        return;
      }
    }
  }
Exemple #2
0
  public void addToList_internal(String listName, String dr, String fn, Boolean addToEnd) {
    // Log.d(TAG, "addToList_internal(" + listName + ", " + dr + ":" + fn  + ", " + addToEnd + ")");

    if (!m.containsKey(listName)) m.put(listName, new ArrayList<String[]>());
    List<String[]> resultList = m.get(listName);

    String[] entry = new String[] {dr, fn};
    for (int i = 0; i < resultList.size(); i++) {
      if (resultList.get(i)[0].equals(dr) && resultList.get(i)[1].equals(fn)) {
        resultList.remove(i);
        break;
      }
    }
    if (addToEnd) resultList.add(entry);
    else resultList.add(0, entry);
    saveList(listName);
  }