use of com.owncloud.android.ui.fragment.GalleryFragment in project android by nextcloud.
the class GallerySearchTask method doInBackground.
@Override
protected GallerySearchTask.Result doInBackground(Void... voids) {
if (photoFragmentWeakReference.get() == null) {
return new Result(false, false, -1);
}
GalleryFragment photoFragment = photoFragmentWeakReference.get();
if (isCancelled()) {
return new Result(false, false, -1);
} else {
OCCapability ocCapability = storageManager.getCapability(user.getAccountName());
SearchRemoteOperation searchRemoteOperation = new SearchRemoteOperation("", SearchRemoteOperation.SearchType.GALLERY_SEARCH, false, ocCapability);
searchRemoteOperation.setLimit(limit);
searchRemoteOperation.setStartDate(startDate);
searchRemoteOperation.setEndDate(endDate);
if (photoFragment.getContext() != null) {
Log_OC.d(this, "Start gallery search with " + new Date(startDate * 1000L) + " - " + new Date(endDate * 1000L) + " with limit: " + limit);
RemoteOperationResult result = searchRemoteOperation.execute(user.toPlatformAccount(), photoFragment.getContext());
boolean emptySearch = parseMedia(startDate, endDate, result.getData());
long lastTimeStamp = findLastTimestamp(result.getData());
photoFragment.getAdapter().showAllGalleryItems(storageManager);
return new Result(result.isSuccess(), emptySearch, lastTimeStamp);
} else {
return new Result(false, false, -1);
}
}
}
use of com.owncloud.android.ui.fragment.GalleryFragment in project android by nextcloud.
the class FileDisplayActivity method onRemoveFileOperationFinish.
/**
* Updates the view associated to the activity after the finish of an operation trying to remove a file.
*
* @param operation Removal operation performed.
* @param result Result of the removal.
*/
private void onRemoveFileOperationFinish(RemoveFileOperation operation, RemoteOperationResult result) {
if (!operation.isInBackground()) {
DisplayUtils.showSnackMessage(this, ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()));
}
if (result.isSuccess()) {
OCFile removedFile = operation.getFile();
tryStopPlaying(removedFile);
Fragment leftFragment = getLeftFragment();
// check if file is still available, if so do nothing
boolean fileAvailable = getStorageManager().fileExists(removedFile.getFileId());
if (leftFragment instanceof FileFragment && !fileAvailable && removedFile.equals(((FileFragment) leftFragment).getFile())) {
if (leftFragment instanceof PreviewMediaFragment) {
((PreviewMediaFragment) leftFragment).stopPreview(true);
}
setFile(getStorageManager().getFileById(removedFile.getParentId()));
cleanSecondFragment();
}
OCFile parentFile = getStorageManager().getFileById(removedFile.getParentId());
if (parentFile != null && parentFile.equals(getCurrentDir())) {
updateListOfFilesFragment(false);
} else if (getLeftFragment() instanceof GalleryFragment) {
((GalleryFragment) getLeftFragment()).onRefresh();
}
supportInvalidateOptionsMenu();
} else {
if (result.isSslRecoverableException()) {
mLastSslUntrustedServerResult = result;
showUntrustedCertDialog(mLastSslUntrustedServerResult);
}
}
}
Aggregations