use of com.owncloud.android.datamodel.OCFile in project android by owncloud.
the class FolderPickerActivity method browseToRoot.
public void browseToRoot() {
OCFileListFragment listOfFiles = getListOfFilesFragment();
if (listOfFiles != null) {
// should never be null, indeed
OCFile root = getStorageManager().getFileByPath(OCFile.ROOT_PATH);
listOfFiles.listDirectory(root);
setFile(listOfFiles.getCurrentFile());
updateNavigationElementsInActionBar();
startSyncFolderOperation(root, false);
}
}
use of com.owncloud.android.datamodel.OCFile in project android by owncloud.
the class PreviewAudioFragment method onStart.
@Override
public void onStart() {
super.onStart();
Timber.v("onStart");
OCFile file = getFile();
if (file != null && file.isDown()) {
bindMediaService();
}
mProgressController.startListeningProgressFor(getFile(), mAccount);
}
use of com.owncloud.android.datamodel.OCFile in project android by owncloud.
the class PreviewImagePagerAdapter method getItem.
public Fragment getItem(int i) {
OCFile file = mImageFiles.get(i);
Fragment fragment;
if (file.isDown()) {
fragment = PreviewImageFragment.newInstance(file, mAccount, mObsoletePositions.contains(i));
} else if (mDownloadErrors.contains(i)) {
fragment = FileDownloadFragment.newInstance(file, mAccount, true);
((FileDownloadFragment) fragment).setError(true);
mDownloadErrors.remove(i);
} else {
fragment = FileDownloadFragment.newInstance(file, mAccount, mObsoletePositions.contains(i));
}
mObsoletePositions.remove(i);
return fragment;
}
use of com.owncloud.android.datamodel.OCFile in project android by owncloud.
the class PreviewImageActivity method onPageSelected.
/**
* This method will be invoked when a new page becomes selected. Animation is not necessarily
* complete.
*
* @param position Position index of the new selected page
*/
@Override
public void onPageSelected(int position) {
Timber.d("onPageSelected %s", position);
if (getOperationsServiceBinder() != null) {
mSavedPosition = position;
mHasSavedPosition = true;
OCFile currentFile = mPreviewImagePagerAdapter.getFileAt(position);
updateActionBarTitle(currentFile.getFileName());
if (!mPreviewImagePagerAdapter.pendingErrorAt(position)) {
getFileOperationsHelper().syncFile(currentFile);
}
// Call to reset image zoom to initial state
((PreviewImagePagerAdapter) mViewPager.getAdapter()).resetZoom();
} else {
// too soon! ; selection of page (first image) was faster than binding of FileOperationsService;
// wait a bit!
final int fPosition = position;
getHandler().post(new Runnable() {
@Override
public void run() {
onPageSelected(fPosition);
}
});
}
}
use of com.owncloud.android.datamodel.OCFile in project android by owncloud.
the class PreviewImageActivity method onAccountSet.
@Override
protected void onAccountSet(boolean stateWasRecovered) {
super.onAccountSet(stateWasRecovered);
if (getAccount() != null) {
OCFile file = getFile();
// / Validate handled file (first image to preview)
if (file == null) {
throw new IllegalStateException("Instanced with a NULL OCFile");
}
if (!file.isImage()) {
throw new IllegalArgumentException("Non-image file passed as argument");
}
// Update file according to DB file, if it is possible
if (file.getFileId() > FileDataStorageManager.ROOT_PARENT_ID) {
file = getStorageManager().getFileById(file.getFileId());
}
if (file != null) {
// / Refresh the activity according to the Account and OCFile set
// reset after getting it fresh from storageManager
setFile(file);
updateActionBarTitle(getFile().getFileName());
initViewPager();
} else {
// handled file not in the current Account
finish();
}
}
}
Aggregations