Skip to content

Commit

Permalink
Update recent list
Browse files Browse the repository at this point in the history
  • Loading branch information
billthefarmer committed Oct 9, 2023
1 parent 0747b72 commit 12d177a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/main/java/org/billthefarmer/notes/Notes.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public class Notes extends Activity
public final static String JS_SCRIPT = "js/script.js";
public final static String TEXT_JAVASCRIPT = "text/javascript";

public final static String FOLDER = "Folder: ";
public final static String FOLDER = "Folder";
public final static String FILE_PROVIDER =
"org.billthefarmer.notes.fileprovider";

Expand Down Expand Up @@ -509,6 +509,10 @@ public boolean onPrepareOptionsMenu(Menu menu)
for (String path : pathMap.keySet())
{
File file = new File(path);
// Check it exists
if (!file.exists())
continue;

long last = file.lastModified();
list.add(last);
map.put(last, path);
Expand Down Expand Up @@ -2438,9 +2442,18 @@ private void savePath(String path)
// Get a list of files
List<Long> list = new ArrayList<>();
Map<Long, String> map = new HashMap<>();
for (String name : pathMap.keySet())
for (Iterator<String> iter = pathMap.keySet().iterator();
iter.hasNext();)
{
String name = iter.next();
File file = new File(name);
if (!file.exists())
{
iter.remove();
removeList.add(name);
continue;
}

list.add(file.lastModified());
map.put(file.lastModified(), name);
}
Expand Down

0 comments on commit 12d177a

Please sign in to comment.