Skip to content

Commit

Permalink
Priority collection from the sdcard synchronizer also
Browse files Browse the repository at this point in the history
  • Loading branch information
matburt committed Nov 4, 2010
1 parent c3a6bf1 commit 33c6176
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/com/matburt/mobileorg/SDCardSynchronizer.java
Expand Up @@ -159,7 +159,9 @@ public void pull() throws NotFoundException, ReportableError {
}
HashMap<String, String> masterList = this.getOrgFilesFromMaster(filebuffer);
ArrayList<ArrayList<String>> todoLists = this.getTodos(filebuffer);
ArrayList<ArrayList<String>> priorityLists = this.getPriorities(masterStr);
this.appdb.setTodoList(todoLists);
this.appdb.setPriorityList(priorityLists);

for (String key : masterList.keySet()) {
Log.d(LT, "Fetching: " + key + ": " + basePath + "/" + masterList.get(key));
Expand Down Expand Up @@ -229,4 +231,22 @@ private ArrayList<ArrayList<String>> getTodos(String master) {
return todoList;
}

private ArrayList<ArrayList<String>> getPriorities(String master) {
Pattern getPriorities = Pattern.compile("#\\+ALLPRIORITIES:\\s+([A-Z\\s]*)");
Matcher t = getPriorities.matcher(master);
ArrayList<ArrayList<String>> priorityList = new ArrayList<ArrayList<String>>();
while (t.find()) {
ArrayList<String> holding = new ArrayList<String>();
if (t.group(1) != null &&
t.group(1).length() > 0) {
String[] grouping = t.group(1).split("\\s+");
for (int jdx = 0; jdx < grouping.length; jdx++) {
holding.add(grouping[jdx].trim());
}
}
priorityList.add(holding);
}
return priorityList;
}

}

0 comments on commit 33c6176

Please sign in to comment.