Search in sources :

Example 1 with LocalFileListAdapter

use of com.owncloud.android.ui.adapter.LocalFileListAdapter in project android by nextcloud.

the class LocalFileListFragment method onActivityCreated.

/**
 * {@inheritDoc}
 */
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    Log_OC.i(TAG, "onActivityCreated() start");
    super.onActivityCreated(savedInstanceState);
    mAdapter = new LocalFileListAdapter(mContainerActivity.isFolderPickerMode(), mContainerActivity.getInitialDirectory(), this, preferences, getActivity());
    setRecyclerViewAdapter(mAdapter);
    listDirectory(mContainerActivity.getInitialDirectory());
    mSortButton.setOnClickListener(v -> {
        FileSortOrder sortOrder = preferences.getSortOrderByType(FileSortOrder.Type.localFileListView);
        openSortingOrderDialogFragment(requireFragmentManager(), sortOrder);
    });
    FileSortOrder sortOrder = preferences.getSortOrderByType(FileSortOrder.Type.localFileListView);
    mSortButton.setText(DisplayUtils.getSortOrderStringId(sortOrder));
    setGridSwitchButton();
    mSwitchGridViewButton.setOnClickListener(v -> {
        if (isGridEnabled()) {
            switchToListView();
        } else {
            switchToGridView();
        }
        setGridSwitchButton();
    });
    Log_OC.i(TAG, "onActivityCreated() stop");
}
Also used : LocalFileListAdapter(com.owncloud.android.ui.adapter.LocalFileListAdapter) FileSortOrder(com.owncloud.android.utils.FileSortOrder)

Example 2 with LocalFileListAdapter

use of com.owncloud.android.ui.adapter.LocalFileListAdapter 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);
        }
    }
}
Also used : FileDisplayActivity(com.owncloud.android.ui.activity.FileDisplayActivity) FolderPickerActivity(com.owncloud.android.ui.activity.FolderPickerActivity) UploadFilesActivity(com.owncloud.android.ui.activity.UploadFilesActivity) FolderPickerActivity(com.owncloud.android.ui.activity.FolderPickerActivity) FileDisplayActivity(com.owncloud.android.ui.activity.FileDisplayActivity) Activity(android.app.Activity) RecyclerView(androidx.recyclerview.widget.RecyclerView) EmptyRecyclerView(com.owncloud.android.ui.EmptyRecyclerView) SearchEvent(com.owncloud.android.ui.events.SearchEvent) LocalFileListAdapter(com.owncloud.android.ui.adapter.LocalFileListAdapter) UploadFilesActivity(com.owncloud.android.ui.activity.UploadFilesActivity) OCFileListAdapter(com.owncloud.android.ui.adapter.OCFileListAdapter)

Example 3 with LocalFileListAdapter

use of com.owncloud.android.ui.adapter.LocalFileListAdapter in project android by owncloud.

the class LocalFileListFragment method onActivityCreated.

/**
     * {@inheritDoc}
     */
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    Log_OC.i(TAG, "onActivityCreated() start");
    super.onActivityCreated(savedInstanceState);
    mDirectory = mContainerActivity.getCurrentFolder();
    mAdapter = new LocalFileListAdapter(mDirectory, isShowingJustFolders(), getActivity());
    setListAdapter(mAdapter);
    Log_OC.i(TAG, "onActivityCreated() stop");
}
Also used : LocalFileListAdapter(com.owncloud.android.ui.adapter.LocalFileListAdapter)

Aggregations

LocalFileListAdapter (com.owncloud.android.ui.adapter.LocalFileListAdapter)3 Activity (android.app.Activity)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 EmptyRecyclerView (com.owncloud.android.ui.EmptyRecyclerView)1 FileDisplayActivity (com.owncloud.android.ui.activity.FileDisplayActivity)1 FolderPickerActivity (com.owncloud.android.ui.activity.FolderPickerActivity)1 UploadFilesActivity (com.owncloud.android.ui.activity.UploadFilesActivity)1 OCFileListAdapter (com.owncloud.android.ui.adapter.OCFileListAdapter)1 SearchEvent (com.owncloud.android.ui.events.SearchEvent)1 FileSortOrder (com.owncloud.android.utils.FileSortOrder)1