public static int CHANGES_ONLY = CLOSE_WRITE;
- private static String TAG = "OwnCloudFileObserver";
+ private static String TAG = OwnCloudFileObserver.class.getSimpleName();
private String mPath;
private int mMask;
- DataStorageManager mStorage;
- Account mOCAccount;
- OCFile mFile;
- static Context mContext; // ISSUE 4: why is this static?
- List<FileObserverStatusListener> mListeners;
+ private DataStorageManager mStorage;
+ private Account mOCAccount;
+ private OCFile mFile;
+ private Context mContext;
+ private List<FileObserverStatusListener> mListeners;
public OwnCloudFileObserver(String path) {
this(path, ALL_EVENTS);
return;
}
WebdavClient wc = OwnCloudClientUtils.createOwnCloudClient(mOCAccount, mContext);
- SynchronizeFileOperation sfo = new SynchronizeFileOperation(mFile.getRemotePath(), mStorage, mOCAccount, mContext);
+ SynchronizeFileOperation sfo = new SynchronizeFileOperation(mFile.getRemotePath(), mStorage, mOCAccount);
RemoteOperationResult result = sfo.execute(wc);
if (result.getExtraData() == Boolean.TRUE) {
observer = mObservers.get(i);
if (observer.getPath().equals(path))
duplicate = true;
- observer.setContext(getBaseContext());
+ observer.setContext(getApplicationContext());
}
if (duplicate) return;
observer = new OwnCloudFileObserver(path, OwnCloudFileObserver.CHANGES_ONLY);
- observer.setContext(getBaseContext());
- Account account = AccountUtils.getCurrentOwnCloudAccount(getBaseContext());
+ observer.setContext(getApplicationContext());
+ Account account = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext());
observer.setAccount(account);
FileDataStorageManager storage =
new FileDataStorageManager(account, getContentResolver());
import org.apache.jackrabbit.webdav.client.methods.PropFindMethod;
import android.accounts.Account;
-import android.content.Context;
import android.util.Log;
import com.owncloud.android.datamodel.DataStorageManager;
public SynchronizeFileOperation(
String remotePath,
DataStorageManager dataStorageManager,
- Account account,
- Context context ) {
+ Account account) {
mRemotePath = remotePath;
mStorageManager = dataStorageManager;
mAccount = account;