mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 21:55:48 +03:00
Revert "Attempt to fix stuff"
This reverts commit 58b640a8c85f090c9d8b9fc8de342e95a708f7a0.
This commit is contained in:
parent
8bfdd0047c
commit
49c27b1464
2 changed files with 21 additions and 27 deletions
|
@ -92,7 +92,7 @@ public class FileAlterationMagicListener implements FileAlterationListener {
|
|||
}
|
||||
|
||||
public void onFileCreate(final File file, int delay) {
|
||||
if (file != null && !uploadMap.containsKey(file.getAbsolutePath())) {
|
||||
if (file != null) {
|
||||
uploadMap.put(file.getAbsolutePath(), null);
|
||||
|
||||
String mimetypeString = FileStorageUtils.getMimeTypeFromName(file.getAbsolutePath());
|
||||
|
|
|
@ -66,7 +66,6 @@ public class FileAlterationMagicObserver extends FileAlterationObserver implemen
|
|||
private FileFilter fileFilter;
|
||||
private Comparator<File> comparator;
|
||||
private SyncedFolder syncedFolder;
|
||||
private boolean isCheckRunning = false;
|
||||
|
||||
private static final FileEntry[] EMPTY_ENTRIES = new FileEntry[0];
|
||||
|
||||
|
@ -219,38 +218,33 @@ public class FileAlterationMagicObserver extends FileAlterationObserver implemen
|
|||
*/
|
||||
public void checkAndNotify() {
|
||||
|
||||
if (!isCheckRunning) {
|
||||
isCheckRunning = true;
|
||||
/* fire onStart() */
|
||||
for (final FileAlterationMagicListener listener : listeners) {
|
||||
listener.onStart(this);
|
||||
}
|
||||
for (final FileAlterationMagicListener listener : listeners) {
|
||||
listener.onStart(this);
|
||||
}
|
||||
|
||||
/* fire directory/file events */
|
||||
final File rootFile = rootEntry.getFile();
|
||||
if (rootFile.exists()) {
|
||||
checkAndNotify(rootEntry, rootEntry.getChildren(), listFiles(rootFile), 2000);
|
||||
} else if (rootEntry.isExists()) {
|
||||
try {
|
||||
// try to init once more
|
||||
init();
|
||||
if (rootEntry.getFile().exists()) {
|
||||
checkAndNotify(rootEntry, rootEntry.getChildren(), listFiles(rootEntry.getFile()), 2000);
|
||||
} else {
|
||||
checkAndNotify(rootEntry, rootEntry.getChildren(), FileUtils.EMPTY_FILE_ARRAY, 2000);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log_OC.d("FileAlterationMagicObserver", "Failed getting an observer to intialize " + e);
|
||||
final File rootFile = rootEntry.getFile();
|
||||
if (rootFile.exists()) {
|
||||
checkAndNotify(rootEntry, rootEntry.getChildren(), listFiles(rootFile), 2000);
|
||||
} else if (rootEntry.isExists()) {
|
||||
try {
|
||||
// try to init once more
|
||||
init();
|
||||
if (rootEntry.getFile().exists()) {
|
||||
checkAndNotify(rootEntry, rootEntry.getChildren(), listFiles(rootEntry.getFile()), 2000);
|
||||
} else {
|
||||
checkAndNotify(rootEntry, rootEntry.getChildren(), FileUtils.EMPTY_FILE_ARRAY, 2000);
|
||||
}
|
||||
} // else didn't exist and still doesn't
|
||||
} catch (Exception e) {
|
||||
Log_OC.d("FileAlterationMagicObserver", "Failed getting an observer to intialize " + e);
|
||||
checkAndNotify(rootEntry, rootEntry.getChildren(), FileUtils.EMPTY_FILE_ARRAY, 2000);
|
||||
}
|
||||
} // else didn't exist and still doesn't
|
||||
|
||||
/* fire onStop() */
|
||||
for (final FileAlterationMagicListener listener : listeners) {
|
||||
listener.onStop(this);
|
||||
}
|
||||
|
||||
isCheckRunning = false;
|
||||
for (final FileAlterationMagicListener listener : listeners) {
|
||||
listener.onStop(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue