use of com.owncloud.android.datamodel.FileDataStorageManager in project android by owncloud.
the class PreviewImageFragment method onFileMetadataChanged.
@Override
public void onFileMetadataChanged() {
FileDataStorageManager storageManager = mContainerActivity.getStorageManager();
if (storageManager != null) {
setFile(storageManager.getFileByPath(getFile().getRemotePath()));
}
getActivity().invalidateOptionsMenu();
}
use of com.owncloud.android.datamodel.FileDataStorageManager in project android by owncloud.
the class FileDetailFragment method updateFileDetails.
/**
* Updates the view with all relevant details about that file.
*
* @param forcedTransferring Flag signaling if the file should be considered as downloading or uploading,
* although {@link FileDownloaderBinder#isDownloading(Account, OCFile)} and
* {@link FileUploaderBinder#isUploading(Account, OCFile)} return false.
* @param refresh If 'true', try to refresh the whole file from the database
*/
private void updateFileDetails(boolean forcedTransferring, boolean refresh) {
if (readyToShow()) {
FileDataStorageManager storageManager = mContainerActivity.getStorageManager();
if (refresh && storageManager != null) {
setFile(storageManager.getFileByPath(getFile().getRemotePath()));
}
OCFile file = getFile();
// set file details
setFilename(file.getFileName());
setFiletype(file);
setFilesize(file.getFileLength());
setTimeModified(file.getModificationTimestamp());
// configure UI for depending upon local state of the file
FileDownloaderBinder downloaderBinder = mContainerActivity.getFileDownloaderBinder();
FileUploaderBinder uploaderBinder = mContainerActivity.getFileUploaderBinder();
if (forcedTransferring || (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file)) || (uploaderBinder != null && uploaderBinder.isUploading(mAccount, file))) {
setButtonsForTransferring();
} else if (file.isDown()) {
setButtonsForDown();
} else {
// TODO load default preview image; when the local file is removed, the preview
// remains there
setButtonsForRemote();
}
}
getView().invalidate();
}
use of com.owncloud.android.datamodel.FileDataStorageManager in project android by owncloud.
the class OCFileListFragment method listDirectory.
/**
* Lists the given directory on the view. When the input parameter is null,
* it will either refresh the last known directory. list the root
* if there never was a directory.
*
* @param directory File to be listed
*/
public void listDirectory(OCFile directory) /*, boolean onlyOnDevice*/
{
FileDataStorageManager storageManager = mContainerActivity.getStorageManager();
if (storageManager != null) {
// Check input parameters for null
if (directory == null) {
if (mFile != null) {
directory = mFile;
} else {
directory = storageManager.getFileByPath("/");
// no files, wait for sync
if (directory == null)
return;
}
}
// If that's not a directory -> List its parent
if (!directory.isFolder()) {
Log_OC.w(TAG, "You see, that is not a directory -> " + directory.toString());
directory = storageManager.getFileById(directory.getParentId());
}
// TODO Enable when "On Device" is recovered ?
mAdapter.swapDirectory(directory, storageManager);
if (mFile == null || !mFile.equals(directory)) {
mCurrentListView.setSelection(0);
}
mFile = directory;
updateLayout();
}
}
Aggregations