use of com.owncloud.android.operations.RefreshFolderOperation in project android by owncloud.
the class FolderPickerActivity method startSyncFolderOperation.
public void startSyncFolderOperation(OCFile folder, boolean ignoreETag) {
mSyncInProgress = true;
// perform folder synchronization
SyncOperation synchFolderOp = new RefreshFolderOperation(folder, ignoreETag, getAccount(), getApplicationContext());
synchFolderOp.execute(getStorageManager(), this, null, null);
OCFileListFragment fileListFragment = getListOfFilesFragment();
if (fileListFragment != null) {
fileListFragment.setProgressBarAsIndeterminate(true);
}
setBackgroundText();
}
use of com.owncloud.android.operations.RefreshFolderOperation in project android by nextcloud.
the class FolderPickerActivity method startSyncFolderOperation.
public void startSyncFolderOperation(OCFile folder, boolean ignoreETag) {
long currentSyncTime = System.currentTimeMillis();
mSyncInProgress = true;
// perform folder synchronization
RemoteOperation refreshFolderOperation = new RefreshFolderOperation(folder, currentSyncTime, false, getFileOperationsHelper().isSharedSupported(), ignoreETag, getStorageManager(), getAccount(), getApplicationContext());
refreshFolderOperation.execute(getAccount(), this, null, null);
setIndeterminate(true);
setBackgroundText();
}
use of com.owncloud.android.operations.RefreshFolderOperation in project android by nextcloud.
the class ReceiveExternalFilesActivity method startSyncFolderOperation.
private void startSyncFolderOperation(OCFile folder) {
long currentSyncTime = System.currentTimeMillis();
mSyncInProgress = true;
// perform folder synchronization
RemoteOperation syncFolderOp = new RefreshFolderOperation(folder, currentSyncTime, false, false, false, getStorageManager(), getAccount(), getApplicationContext());
syncFolderOp.execute(getAccount(), this, null, null);
}
use of com.owncloud.android.operations.RefreshFolderOperation in project android by nextcloud.
the class ContactsBackupFragment method refreshBackupFolder.
private void refreshBackupFolder(final String backupFolderPath, final ContactsPreferenceActivity contactsPreferenceActivity) {
AsyncTask<String, Integer, Boolean> task = new AsyncTask<String, Integer, Boolean>() {
@Override
protected Boolean doInBackground(String... path) {
FileDataStorageManager storageManager = new FileDataStorageManager(account, contactsPreferenceActivity.getContentResolver());
OCFile folder = storageManager.getFileByPath(path[0]);
if (folder != null) {
RefreshFolderOperation operation = new RefreshFolderOperation(folder, System.currentTimeMillis(), false, false, false, storageManager, account, getContext());
RemoteOperationResult result = operation.execute(account, getContext());
return result.isSuccess();
} else {
return false;
}
}
@Override
protected void onPostExecute(Boolean result) {
if (result) {
OCFile backupFolder = contactsPreferenceActivity.getStorageManager().getFileByPath(backupFolderPath);
List<OCFile> backupFiles = contactsPreferenceActivity.getStorageManager().getFolderContent(backupFolder, false);
if (backupFiles == null || backupFiles.size() == 0) {
contactsDatePickerBtn.setVisibility(View.GONE);
} else {
contactsDatePickerBtn.setVisibility(View.VISIBLE);
}
}
}
};
task.execute(backupFolderPath);
}
use of com.owncloud.android.operations.RefreshFolderOperation in project android by nextcloud.
the class FileSyncAdapter method synchronizeFolder.
/**
* Synchronizes the list of files contained in a folder identified with its remote path.
*
* Fetches the list and properties of the files contained in the given folder, including their
* properties, and updates the local database with them.
*
* Enters in the child folders to synchronize their contents also, following a recursive
* depth first strategy.
*
* @param folder Folder to synchronize.
*/
private void synchronizeFolder(OCFile folder) {
if (mFailedResultsCounter > MAX_FAILED_RESULTS || isFinisher(mLastFailedResult)) {
return;
}
// folder synchronization
RefreshFolderOperation synchFolderOp = new RefreshFolderOperation(folder, mCurrentSyncTime, true, mIsShareSupported, false, getStorageManager(), getAccount(), getContext());
RemoteOperationResult result = synchFolderOp.execute(getClient());
// synchronized folder -> notice to UI - ALWAYS, although !result.isSuccess
sendLocalBroadcast(EVENT_FULL_SYNC_FOLDER_CONTENTS_SYNCED, folder.getRemotePath(), result);
// check the result of synchronizing the folder
if (result.isSuccess() || result.getCode() == ResultCode.SYNC_CONFLICT) {
if (result.getCode() == ResultCode.SYNC_CONFLICT) {
mConflictsFound += synchFolderOp.getConflictsFound();
mFailsInFavouritesFound += synchFolderOp.getFailsInKeptInSyncFound();
}
if (synchFolderOp.getForgottenLocalFiles().size() > 0) {
mForgottenLocalFiles.putAll(synchFolderOp.getForgottenLocalFiles());
}
if (result.isSuccess()) {
// synchronize children folders
List<OCFile> children = synchFolderOp.getChildren();
// beware of the 'hidden' recursion here!
syncChildren(children);
}
} else if (result.getCode() != ResultCode.FILE_NOT_FOUND) {
// in failures, the statistics for the global result are updated
if (RemoteOperationResult.ResultCode.UNAUTHORIZED.equals(result.getCode())) {
mSyncResult.stats.numAuthExceptions++;
} else if (result.getException() instanceof DavException) {
mSyncResult.stats.numParseExceptions++;
} else if (result.getException() instanceof IOException) {
mSyncResult.stats.numIoExceptions++;
}
mFailedResultsCounter++;
mLastFailedResult = result;
}
// else, ResultCode.FILE_NOT_FOUND is ignored, remote folder was
// removed from other thread or other client during the synchronization,
// before this thread fetched its contents
}
Aggregations