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);
}
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;
}
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);
}
}
Aggregations