Search in sources :

Example 6 with FileDetailFragment

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);
    }
}
Also used : OCFile(com.owncloud.android.datamodel.OCFile) ArrayList(java.util.ArrayList) FileDetailFragment(com.owncloud.android.ui.fragment.FileDetailFragment) OCFileListFragment(com.owncloud.android.ui.fragment.OCFileListFragment) UnifiedSearchFragment(com.owncloud.android.ui.fragment.UnifiedSearchFragment) Fragment(androidx.fragment.app.Fragment) TaskRetainerFragment(com.owncloud.android.ui.fragment.TaskRetainerFragment) FileFragment(com.owncloud.android.ui.fragment.FileFragment) PreviewTextStringFragment(com.owncloud.android.ui.preview.PreviewTextStringFragment) PreviewTextFragment(com.owncloud.android.ui.preview.PreviewTextFragment) PreviewTextFileFragment(com.owncloud.android.ui.preview.PreviewTextFileFragment) GalleryFragment(com.owncloud.android.ui.fragment.GalleryFragment) SortingOrderDialogFragment(com.owncloud.android.ui.dialog.SortingOrderDialogFragment) PreviewImageFragment(com.owncloud.android.ui.preview.PreviewImageFragment) PreviewMediaFragment(com.owncloud.android.ui.preview.PreviewMediaFragment) FileDetailFragment(com.owncloud.android.ui.fragment.FileDetailFragment) PreviewPdfFragment(com.owncloud.android.ui.preview.pdf.PreviewPdfFragment)

Example 7 with FileDetailFragment

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;
}
Also used : OCFile(com.owncloud.android.datamodel.OCFile) FileFragment(com.owncloud.android.ui.fragment.FileFragment) PreviewTextFileFragment(com.owncloud.android.ui.preview.PreviewTextFileFragment) PreviewMediaFragment(com.owncloud.android.ui.preview.PreviewMediaFragment) FileDetailFragment(com.owncloud.android.ui.fragment.FileDetailFragment) PreviewPdfFragment(com.owncloud.android.ui.preview.pdf.PreviewPdfFragment) OCFileListFragment(com.owncloud.android.ui.fragment.OCFileListFragment) UnifiedSearchFragment(com.owncloud.android.ui.fragment.UnifiedSearchFragment) SuppressLint(android.annotation.SuppressLint)

Aggregations

FileDetailFragment (com.owncloud.android.ui.fragment.FileDetailFragment)7 FileFragment (com.owncloud.android.ui.fragment.FileFragment)6 OCFile (com.owncloud.android.datamodel.OCFile)5 OCFileListFragment (com.owncloud.android.ui.fragment.OCFileListFragment)5 UnifiedSearchFragment (com.owncloud.android.ui.fragment.UnifiedSearchFragment)5 PreviewMediaFragment (com.owncloud.android.ui.preview.PreviewMediaFragment)5 PreviewTextFileFragment (com.owncloud.android.ui.preview.PreviewTextFileFragment)5 PreviewPdfFragment (com.owncloud.android.ui.preview.pdf.PreviewPdfFragment)5 Fragment (androidx.fragment.app.Fragment)4 SortingOrderDialogFragment (com.owncloud.android.ui.dialog.SortingOrderDialogFragment)4 GalleryFragment (com.owncloud.android.ui.fragment.GalleryFragment)4 TaskRetainerFragment (com.owncloud.android.ui.fragment.TaskRetainerFragment)4 PreviewImageFragment (com.owncloud.android.ui.preview.PreviewImageFragment)4 PreviewTextFragment (com.owncloud.android.ui.preview.PreviewTextFragment)4 PreviewTextStringFragment (com.owncloud.android.ui.preview.PreviewTextStringFragment)4 User (com.nextcloud.client.account.User)2 SuppressLint (android.annotation.SuppressLint)1 ArrayList (java.util.ArrayList)1