use of com.owncloud.android.operations.RefreshFolderOperation in project android by nextcloud.
the class UploadListAdapter method refreshFolder.
private void refreshFolder(ItemViewHolder view, User user, OCFile folder, OnRemoteOperationListener listener) {
view.binding.uploadListItemLayout.setClickable(false);
view.binding.uploadStatus.setText(R.string.uploads_view_upload_status_fetching_server_version);
Context context = MainApp.getAppContext();
new RefreshFolderOperation(folder, clock.getCurrentTime(), false, false, true, storageManager, user, context).execute(user.toPlatformAccount(), context, (caller, result) -> {
view.binding.uploadListItemLayout.setClickable(true);
listener.onRemoteOperationFinish(caller, result);
}, parentActivity.getHandler());
}
use of com.owncloud.android.operations.RefreshFolderOperation in project android by nextcloud.
the class OCFileListAdapter method parseVirtuals.
private void parseVirtuals(List<Object> objects, SearchType searchType) {
VirtualFolderType type;
boolean onlyMedia = false;
switch(searchType) {
case FAVORITE_SEARCH:
type = VirtualFolderType.FAVORITE;
break;
case GALLERY_SEARCH:
type = VirtualFolderType.GALLERY;
onlyMedia = true;
int lastPosition = objects.size() - 1;
if (lastPosition < 0) {
lastTimestamp = -1;
break;
}
RemoteFile lastFile = (RemoteFile) objects.get(lastPosition);
lastTimestamp = lastFile.getModifiedTimestamp() / 1000;
break;
default:
type = VirtualFolderType.NONE;
break;
}
List<ContentValues> contentValues = new ArrayList<>();
for (Object remoteFile : objects) {
OCFile ocFile = FileStorageUtils.fillOCFile((RemoteFile) remoteFile);
FileStorageUtils.searchForLocalFileInDefaultPath(ocFile, user.getAccountName());
try {
ocFile = mStorageManager.saveFileWithParent(ocFile, activity);
if (SearchType.GALLERY_SEARCH != searchType) {
// also sync folder content
if (ocFile.isFolder()) {
long currentSyncTime = System.currentTimeMillis();
RemoteOperation refreshFolderOperation = new RefreshFolderOperation(ocFile, currentSyncTime, true, false, mStorageManager, user, activity);
refreshFolderOperation.execute(user.toPlatformAccount(), activity);
}
}
if (!onlyMedia || MimeTypeUtil.isImage(ocFile) || MimeTypeUtil.isVideo(ocFile)) {
mFiles.add(ocFile);
}
ContentValues cv = new ContentValues();
cv.put(ProviderMeta.ProviderTableMeta.VIRTUAL_TYPE, type.toString());
cv.put(ProviderMeta.ProviderTableMeta.VIRTUAL_OCFILE_ID, ocFile.getFileId());
contentValues.add(cv);
} catch (RemoteOperationFailedException e) {
Log_OC.e(TAG, "Error saving file with parent" + e.getMessage(), e);
}
}
preferences.setPhotoSearchTimestamp(System.currentTimeMillis());
mStorageManager.saveVirtuals(contentValues);
}
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, ignoreETag, getStorageManager(), getUser().orElseThrow(RuntimeException::new), getApplicationContext());
refreshFolderOperation.execute(getAccount(), this, null, null);
getListOfFilesFragment().setLoading(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, getStorageManager(), getUser().orElseThrow(RuntimeException::new), getApplicationContext());
syncFolderOp.execute(getAccount(), this, null, null);
}
Aggregations