use of com.owncloud.android.ui.fragment.OCFileListFragment in project android by owncloud.
the class FileDisplayActivity method onBackPressed.
@Override
public void onBackPressed() {
boolean isFabOpen = isFabOpen();
boolean isDrawerOpen = isDrawerOpen();
/*
* BackPressed priority/hierarchy:
* 1. close drawer if opened
* 2. close FAB if open (only if drawer isn't open)
* 3. navigate up (only if drawer and FAB aren't open)
*/
if (isDrawerOpen && isFabOpen) {
// close drawer first
super.onBackPressed();
} else if (isDrawerOpen && !isFabOpen) {
// close drawer
super.onBackPressed();
} else if (!isDrawerOpen && isFabOpen) {
// close fab
getListOfFilesFragment().getFabMain().collapse();
} else {
// all closed
OCFileListFragment listOfFiles = getListOfFilesFragment();
if (mDualPane || getSecondFragment() == null) {
OCFile currentDir = getCurrentDir();
if (currentDir == null || currentDir.getParentId() == FileDataStorageManager.ROOT_PARENT_ID) {
finish();
return;
}
if (listOfFiles != null) {
// should never be null, indeed
listOfFiles.onBrowseUp();
}
}
if (listOfFiles != null) {
// should never be null, indeed
setFile(listOfFiles.getCurrentFile());
listOfFiles.listDirectory(false);
}
cleanSecondFragment();
}
}
use of com.owncloud.android.ui.fragment.OCFileListFragment in project android by owncloud.
the class FileDisplayActivity 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);
// TODO Enable when "On Device" is recovered ?
// listOfFiles.listDirectory(root, MainApp.getOnlyOnDevice());
setFile(listOfFiles.getCurrentFile());
startSyncFolderOperation(root, false);
}
cleanSecondFragment();
}
use of com.owncloud.android.ui.fragment.OCFileListFragment in project android by owncloud.
the class FolderPickerActivity method setBackgroundText.
/**
* Show a text message on screen view for notifying user if content is
* loading or folder is empty
*/
private void setBackgroundText() {
OCFileListFragment listFragment = getListOfFilesFragment();
if (listFragment != null) {
int message = R.string.file_list_loading;
if (!mSyncInProgress) {
// In case folder list is empty
message = R.string.file_list_empty_moving;
}
listFragment.setMessageForEmptyList(getString(message));
} else {
Log.e(TAG, "OCFileListFragment is null");
}
}
use of com.owncloud.android.ui.fragment.OCFileListFragment in project android by owncloud.
the class FolderPickerActivity method onAccountSet.
/**
* Called when the ownCloud {@link Account} associated to the Activity was just updated.
*/
@Override
protected void onAccountSet(boolean stateWasRecovered) {
super.onAccountSet(stateWasRecovered);
if (getAccount() != null) {
updateFileFromDB();
OCFile folder = getFile();
if (folder == null || !folder.isFolder()) {
// fall back to root folder
setFile(getStorageManager().getFileByPath(OCFile.ROOT_PATH));
folder = getFile();
}
if (!stateWasRecovered) {
OCFileListFragment listOfFolders = getListOfFilesFragment();
listOfFolders.listDirectory(folder);
startSyncFolderOperation(folder, false);
}
updateNavigationElementsInActionBar();
}
}
Aggregations