|
@@ -20,10 +20,6 @@
|
|
|
|
|
|
package com.owncloud.android.services.observer;
|
|
package com.owncloud.android.services.observer;
|
|
|
|
|
|
-import java.io.File;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.Map;
|
|
|
|
-
|
|
|
|
import android.accounts.Account;
|
|
import android.accounts.Account;
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
@@ -37,6 +33,10 @@ import com.owncloud.android.lib.common.utils.Log_OC;
|
|
import com.owncloud.android.operations.SynchronizeFileOperation;
|
|
import com.owncloud.android.operations.SynchronizeFileOperation;
|
|
import com.owncloud.android.ui.activity.ConflictsResolveActivity;
|
|
import com.owncloud.android.ui.activity.ConflictsResolveActivity;
|
|
|
|
|
|
|
|
+import java.io.File;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Observer watching a folder to request the synchronization of kept-in-sync files
|
|
* Observer watching a folder to request the synchronization of kept-in-sync files
|
|
* inside it.
|
|
* inside it.
|
|
@@ -111,17 +111,16 @@ public class FolderObserver extends FileObserver {
|
|
synchronized(mObservedChildren) {
|
|
synchronized(mObservedChildren) {
|
|
if (path != null && path.length() > 0 && mObservedChildren.containsKey(path)) {
|
|
if (path != null && path.length() > 0 && mObservedChildren.containsKey(path)) {
|
|
|
|
|
|
- if ( ((event & FileObserver.MODIFY) != 0) ||
|
|
|
|
|
|
+ if ( (((event & FileObserver.MODIFY) != 0) ||
|
|
((event & FileObserver.ATTRIB) != 0) ||
|
|
((event & FileObserver.ATTRIB) != 0) ||
|
|
- ((event & FileObserver.MOVED_TO) != 0) ) {
|
|
|
|
-
|
|
|
|
- if (mObservedChildren.get(path) != true) {
|
|
|
|
- mObservedChildren.put(path, Boolean.valueOf(true));
|
|
|
|
- }
|
|
|
|
|
|
+ ((event & FileObserver.MOVED_TO) != 0)) &&
|
|
|
|
+ !mObservedChildren.get(path)) {
|
|
|
|
+
|
|
|
|
+ mObservedChildren.put(path, Boolean.TRUE);
|
|
}
|
|
}
|
|
|
|
|
|
if ((event & FileObserver.CLOSE_WRITE) != 0 && mObservedChildren.get(path)) {
|
|
if ((event & FileObserver.CLOSE_WRITE) != 0 && mObservedChildren.get(path)) {
|
|
- mObservedChildren.put(path, Boolean.valueOf(false));
|
|
|
|
|
|
+ mObservedChildren.put(path, Boolean.FALSE);
|
|
shouldSynchronize = true;
|
|
shouldSynchronize = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -134,7 +133,6 @@ public class FolderObserver extends FileObserver {
|
|
(path == null || path.length() == 0)) {
|
|
(path == null || path.length() == 0)) {
|
|
Log_OC.d(TAG, "Stopping the observance on " + mPath);
|
|
Log_OC.d(TAG, "Stopping the observance on " + mPath);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -146,7 +144,7 @@ public class FolderObserver extends FileObserver {
|
|
public void startWatching(String fileName) {
|
|
public void startWatching(String fileName) {
|
|
synchronized (mObservedChildren) {
|
|
synchronized (mObservedChildren) {
|
|
if (!mObservedChildren.containsKey(fileName)) {
|
|
if (!mObservedChildren.containsKey(fileName)) {
|
|
- mObservedChildren.put(fileName, Boolean.valueOf(false));
|
|
|
|
|
|
+ mObservedChildren.put(fileName, Boolean.FALSE);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -212,5 +210,4 @@ public class FolderObserver extends FileObserver {
|
|
// or maybe just toast them;
|
|
// or maybe just toast them;
|
|
// or nothing, very strange fails
|
|
// or nothing, very strange fails
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|