Some progress on auto-upload fixes

This commit is contained in:
Mario Danic 2017-02-06 13:21:04 +01:00
parent dcf99f8cb4
commit 9c39a6dfdc
2 changed files with 11 additions and 0 deletions

View file

@ -128,6 +128,7 @@ public class FileAlterationMagicListener implements FileAlterationListener {
if (fileRunnable.containsKey(file.getAbsolutePath())) {
handler.removeCallbacks(fileRunnable.get(file.getAbsolutePath()));
handler.postDelayed(fileRunnable.get(file.getAbsolutePath()), 500);
fileRunnable.remove(file.getAbsolutePath());
}
}
@ -135,6 +136,7 @@ public class FileAlterationMagicListener implements FileAlterationListener {
public void onFileDelete(File file) {
if (fileRunnable.containsKey(file.getAbsolutePath())) {
handler.removeCallbacks(fileRunnable.get(file.getAbsolutePath()));
fileRunnable.remove(file.getAbsolutePath());
}
}

View file

@ -138,6 +138,15 @@ public class SyncedFolderObserverService extends Service {
} else {
for(int i = 0; i < pairArrayList.size(); i++) {
SyncedFolder syncFolder = pairArrayList.get(i).getKey();
for(SyncedFolder syncedFolder : mProvider.getSyncedFolders()) {
if (syncFolder.getId() == syncedFolder.getId()) {
syncFolder = syncedFolder;
pairArrayList.set(i, new SerializablePair<SyncedFolder, FileEntry>(syncFolder,
pairArrayList.get(i).getValue()));
break;
}
}
FileAlterationMagicObserver observer = new FileAlterationMagicObserver(new File(
syncFolder.getLocalPath()), fileFilter);
observer.setRootEntry(pairArrayList.get(i).getValue());