Search in sources :

Example 1 with UnifiedSearchFragment

use of com.owncloud.android.ui.fragment.UnifiedSearchFragment in project android by nextcloud.

the class FileDisplayActivity method performUnifiedSearch.

public void performUnifiedSearch(String query) {
    UnifiedSearchFragment unifiedSearchFragment = UnifiedSearchFragment.Companion.newInstance(query);
    setLeftFragment(unifiedSearchFragment);
}
Also used : UnifiedSearchFragment(com.owncloud.android.ui.fragment.UnifiedSearchFragment)

Example 2 with UnifiedSearchFragment

use of com.owncloud.android.ui.fragment.UnifiedSearchFragment 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)

Example 3 with UnifiedSearchFragment

use of com.owncloud.android.ui.fragment.UnifiedSearchFragment in project android by nextcloud.

the class FileDisplayActivity method setLeftFragment.

/**
 * Replaces the first fragment managed by the activity with the received as a parameter.
 *
 * @param fragment New Fragment to set.
 */
private void setLeftFragment(Fragment fragment) {
    if (searchView != null) {
        searchView.post(() -> searchView.setQuery(searchQuery, true));
    }
    setDrawerIndicatorEnabled(false);
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.addToBackStack(null);
    transaction.replace(R.id.left_fragment_container, fragment, TAG_LIST_OF_FILES);
    transaction.commit();
    if (fragment instanceof UnifiedSearchFragment) {
        showSortListGroup(false);
    } else {
        showSortListGroup(true);
    }
}
Also used : FragmentTransaction(androidx.fragment.app.FragmentTransaction) UnifiedSearchFragment(com.owncloud.android.ui.fragment.UnifiedSearchFragment)

Aggregations

UnifiedSearchFragment (com.owncloud.android.ui.fragment.UnifiedSearchFragment)3 SuppressLint (android.annotation.SuppressLint)1 FragmentTransaction (androidx.fragment.app.FragmentTransaction)1 OCFile (com.owncloud.android.datamodel.OCFile)1 FileDetailFragment (com.owncloud.android.ui.fragment.FileDetailFragment)1 FileFragment (com.owncloud.android.ui.fragment.FileFragment)1 OCFileListFragment (com.owncloud.android.ui.fragment.OCFileListFragment)1 PreviewMediaFragment (com.owncloud.android.ui.preview.PreviewMediaFragment)1 PreviewTextFileFragment (com.owncloud.android.ui.preview.PreviewTextFileFragment)1 PreviewPdfFragment (com.owncloud.android.ui.preview.pdf.PreviewPdfFragment)1