Search in sources :

Example 11 with OCFileListFragment

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();
    }
}
Also used : OCFile(com.owncloud.android.datamodel.OCFile) OCFileListFragment(com.owncloud.android.ui.fragment.OCFileListFragment)

Example 12 with OCFileListFragment

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();
}
Also used : OCFile(com.owncloud.android.datamodel.OCFile) OCFileListFragment(com.owncloud.android.ui.fragment.OCFileListFragment)

Example 13 with OCFileListFragment

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");
    }
}
Also used : OCFileListFragment(com.owncloud.android.ui.fragment.OCFileListFragment)

Example 14 with OCFileListFragment

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();
    }
}
Also used : OCFile(com.owncloud.android.datamodel.OCFile) OCFileListFragment(com.owncloud.android.ui.fragment.OCFileListFragment)

Aggregations

OCFileListFragment (com.owncloud.android.ui.fragment.OCFileListFragment)14 OCFile (com.owncloud.android.datamodel.OCFile)6 Fragment (android.support.v4.app.Fragment)3 FileFragment (com.owncloud.android.ui.fragment.FileFragment)3 FragmentTransaction (android.support.v4.app.FragmentTransaction)2 FileDetailFragment (com.owncloud.android.ui.fragment.FileDetailFragment)2 TaskRetainerFragment (com.owncloud.android.ui.fragment.TaskRetainerFragment)2 PreviewAudioFragment (com.owncloud.android.ui.preview.PreviewAudioFragment)2 PreviewImageFragment (com.owncloud.android.ui.preview.PreviewImageFragment)2 PreviewTextFragment (com.owncloud.android.ui.preview.PreviewTextFragment)2 PreviewVideoFragment (com.owncloud.android.ui.preview.PreviewVideoFragment)2 SuppressLint (android.annotation.SuppressLint)1 RefreshFolderOperation (com.owncloud.android.operations.RefreshFolderOperation)1 SyncOperation (com.owncloud.android.operations.common.SyncOperation)1 CreateFolderDialogFragment (com.owncloud.android.ui.dialog.CreateFolderDialogFragment)1