use of com.owncloud.android.ui.activity.FileDisplayActivity in project android by nextcloud.
the class PreviewMediaFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
Log_OC.v(TAG, "onCreateView");
binding = FragmentPreviewMediaBinding.inflate(inflater, container, false);
View view = binding.getRoot();
emptyListView = binding.emptyView.emptyListView;
if (getActivity() instanceof FileDisplayActivity) {
((FileDisplayActivity) getActivity()).configureToolbarForMediaPreview(getFile());
}
setLoadingView();
return view;
}
use of com.owncloud.android.ui.activity.FileDisplayActivity in project android by nextcloud.
the class PreviewTextFragment method performSearch.
private void performSearch(final String query, int delay) {
handler.removeCallbacksAndMessages(null);
if (originalText != null) {
if (getActivity() instanceof FileDisplayActivity) {
FileDisplayActivity fileDisplayActivity = (FileDisplayActivity) getActivity();
fileDisplayActivity.setSearchQuery(query);
}
handler.postDelayed(() -> markText(query), delay);
}
if (delay == 0 && searchView != null) {
searchView.clearFocus();
}
}
use of com.owncloud.android.ui.activity.FileDisplayActivity in project android by nextcloud.
the class OCFileListFragment method onFileActionChosen.
/**
* Start the appropriate action(s) on the currently selected files given menu selected by the user.
*
* @param item MenuItem selected by the user
* @param checkedFiles List of files selected by the user on which the action should be performed
* @return 'true' if the menu selection started any action, 'false' otherwise.
*/
public boolean onFileActionChosen(MenuItem item, Set<OCFile> checkedFiles) {
if (checkedFiles.isEmpty()) {
return false;
}
if (checkedFiles.size() == SINGLE_SELECTION) {
// / action only possible on a single file
OCFile singleFile = checkedFiles.iterator().next();
int itemId = item.getItemId();
if (itemId == R.id.action_send_share_file) {
mContainerActivity.getFileOperationsHelper().sendShareFile(singleFile);
return true;
} else if (itemId == R.id.action_open_file_with) {
mContainerActivity.getFileOperationsHelper().openFile(singleFile);
return true;
} else if (itemId == R.id.action_stream_media) {
mContainerActivity.getFileOperationsHelper().streamMediaFile(singleFile);
return true;
} else if (itemId == R.id.action_edit) {
// should not be necessary, as menu item is filtered, but better play safe
if (FileMenuFilter.isEditorAvailable(requireContext().getContentResolver(), accountManager.getUser(), singleFile.getMimeType())) {
mContainerActivity.getFileOperationsHelper().openFileWithTextEditor(singleFile, getContext());
} else {
mContainerActivity.getFileOperationsHelper().openFileAsRichDocument(singleFile, getContext());
}
return true;
} else if (itemId == R.id.action_rename_file) {
RenameFileDialogFragment dialog = RenameFileDialogFragment.newInstance(singleFile);
dialog.show(getFragmentManager(), FileDetailFragment.FTAG_RENAME_FILE);
return true;
} else if (itemId == R.id.action_see_details) {
if (mActiveActionMode != null) {
mActiveActionMode.finish();
}
mContainerActivity.showDetails(singleFile);
mContainerActivity.showSortListGroup(false);
return true;
} else if (itemId == R.id.action_set_as_wallpaper) {
mContainerActivity.getFileOperationsHelper().setPictureAs(singleFile, getView());
return true;
} else if (itemId == R.id.action_encrypted) {
mContainerActivity.getFileOperationsHelper().toggleEncryption(singleFile, true);
return true;
} else if (itemId == R.id.action_unset_encrypted) {
mContainerActivity.getFileOperationsHelper().toggleEncryption(singleFile, false);
return true;
}
}
// / actions possible on a batch of files
int itemId = item.getItemId();
if (itemId == R.id.action_remove_file) {
RemoveFilesDialogFragment dialog = RemoveFilesDialogFragment.newInstance(new ArrayList<>(checkedFiles), mActiveActionMode);
dialog.show(getFragmentManager(), ConfirmationDialogFragment.FTAG_CONFIRMATION);
return true;
} else if (itemId == R.id.action_download_file || itemId == R.id.action_sync_file) {
syncAndCheckFiles(checkedFiles);
exitSelectionMode();
return true;
} else if (itemId == R.id.action_cancel_sync) {
((FileDisplayActivity) mContainerActivity).cancelTransference(checkedFiles);
return true;
} else if (itemId == R.id.action_favorite) {
mContainerActivity.getFileOperationsHelper().toggleFavoriteFiles(checkedFiles, true);
return true;
} else if (itemId == R.id.action_unset_favorite) {
mContainerActivity.getFileOperationsHelper().toggleFavoriteFiles(checkedFiles, false);
return true;
} else if (itemId == R.id.action_move) {
Intent action = new Intent(getActivity(), FolderPickerActivity.class);
action.putParcelableArrayListExtra(FolderPickerActivity.EXTRA_FILES, new ArrayList<>(checkedFiles));
action.putExtra(FolderPickerActivity.EXTRA_CURRENT_FOLDER, mFile);
action.putExtra(FolderPickerActivity.EXTRA_ACTION, FolderPickerActivity.MOVE);
getActivity().startActivityForResult(action, FileDisplayActivity.REQUEST_CODE__MOVE_FILES);
return true;
} else if (itemId == R.id.action_copy) {
Intent action = new Intent(getActivity(), FolderPickerActivity.class);
action.putParcelableArrayListExtra(FolderPickerActivity.EXTRA_FILES, new ArrayList<>(checkedFiles));
action.putExtra(FolderPickerActivity.EXTRA_CURRENT_FOLDER, mFile);
action.putExtra(FolderPickerActivity.EXTRA_ACTION, FolderPickerActivity.COPY);
getActivity().startActivityForResult(action, FileDisplayActivity.REQUEST_CODE__COPY_FILES);
return true;
} else if (itemId == R.id.action_select_all_action_menu) {
selectAllFiles(true);
return true;
} else if (itemId == R.id.action_deselect_all_action_menu) {
selectAllFiles(false);
return true;
} else if (itemId == R.id.action_send_file) {
mContainerActivity.getFileOperationsHelper().sendFiles(checkedFiles);
return true;
}
return false;
}
use of com.owncloud.android.ui.activity.FileDisplayActivity in project android by nextcloud.
the class ExtendedListFragment method performSearch.
public void performSearch(final String query, boolean isBackPressed) {
handler.removeCallbacksAndMessages(null);
RecyclerView.Adapter adapter = getRecyclerView().getAdapter();
Activity activity = getActivity();
if (activity != null) {
if (activity instanceof FileDisplayActivity) {
if (isBackPressed && TextUtils.isEmpty(query)) {
FileDisplayActivity fileDisplayActivity = (FileDisplayActivity) activity;
fileDisplayActivity.resetSearchView();
fileDisplayActivity.updateListOfFilesFragment(true);
} else {
handler.post(() -> {
if (adapter instanceof OCFileListAdapter) {
if (accountManager.getUser().getServer().getVersion().isNewerOrEqual(OwnCloudVersion.nextcloud_20)) {
((FileDisplayActivity) activity).performUnifiedSearch(query);
} else {
EventBus.getDefault().post(new SearchEvent(query, SearchRemoteOperation.SearchType.FILE_SEARCH));
}
} else if (adapter instanceof LocalFileListAdapter) {
LocalFileListAdapter localFileListAdapter = (LocalFileListAdapter) adapter;
localFileListAdapter.filter(query);
}
});
if (searchView != null) {
searchView.clearFocus();
}
}
} else if (activity instanceof UploadFilesActivity) {
LocalFileListAdapter localFileListAdapter = (LocalFileListAdapter) adapter;
localFileListAdapter.filter(query);
((UploadFilesActivity) activity).showToolbarSpinner();
} else if (activity instanceof FolderPickerActivity) {
((FolderPickerActivity) activity).refreshListOfFilesFragment(true);
}
}
}
use of com.owncloud.android.ui.activity.FileDisplayActivity in project android by nextcloud.
the class GalleryFragment method onResume.
@Override
public void onResume() {
super.onResume();
setLoading(photoSearchQueryRunning);
final FragmentActivity activity = getActivity();
if (activity instanceof FileDisplayActivity) {
FileDisplayActivity fileDisplayActivity = ((FileDisplayActivity) activity);
fileDisplayActivity.updateActionBarTitleAndHomeButtonByString(getString(R.string.drawer_item_gallery));
fileDisplayActivity.setMainFabVisible(false);
}
}
Aggregations