use of com.owncloud.android.ui.fragment.FileDetailFragment in project android by nextcloud.
the class FileDisplayActivity method onRestoreFileVersionOperationFinish.
private void onRestoreFileVersionOperationFinish(RemoteOperationResult result) {
if (result.isSuccess()) {
OCFile file = getFile();
// delete old local copy
if (file.isDown()) {
List<OCFile> list = new ArrayList<>();
list.add(file);
getFileOperationsHelper().removeFiles(list, true, true);
// download new version, only if file was previously download
getFileOperationsHelper().syncFile(file);
}
OCFile parent = getStorageManager().getFileById(file.getParentId());
startSyncFolderOperation(parent, true, true);
Fragment leftFragment = getLeftFragment();
if (leftFragment instanceof FileDetailFragment) {
FileDetailFragment fileDetailFragment = (FileDetailFragment) leftFragment;
fileDetailFragment.getFileDetailActivitiesFragment().reload();
}
DisplayUtils.showSnackMessage(this, R.string.file_version_restored_successfully);
} else {
DisplayUtils.showSnackMessage(this, R.string.file_version_restored_error);
}
}
use of com.owncloud.android.ui.fragment.FileDetailFragment in project android by nextcloud.
the class FileDisplayActivity method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
boolean retval = true;
int itemId = item.getItemId();
if (itemId == android.R.id.home) {
FileFragment second = getSecondFragment();
OCFile currentDir = getCurrentDir();
if (isDrawerOpen()) {
closeDrawer();
} else if (currentDir != null && currentDir.getParentId() != 0 || second != null && second.getFile() != null || isSearchOpen()) {
onBackPressed();
} else if (getLeftFragment() instanceof FileDetailFragment || getLeftFragment() instanceof PreviewMediaFragment || getLeftFragment() instanceof UnifiedSearchFragment || getLeftFragment() instanceof PreviewPdfFragment) {
onBackPressed();
} else {
openDrawer();
}
} else if (itemId == R.id.action_select_all) {
OCFileListFragment fragment = getListOfFilesFragment();
if (fragment != null) {
fragment.selectAllFiles(true);
}
} else {
retval = super.onOptionsItemSelected(item);
}
return retval;
}
Aggregations