Search in sources :

Example 26 with FileDisplayActivity

use of com.owncloud.android.ui.activity.FileDisplayActivity in project android by nextcloud.

the class OCFileListFragment method onActivityCreated.

/**
 * {@inheritDoc}
 */
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    Log_OC.i(TAG, "onActivityCreated() start");
    if (savedInstanceState != null) {
        mFile = savedInstanceState.getParcelable(KEY_FILE);
    }
    Bundle args = getArguments();
    mOnlyFoldersClickable = args != null && args.getBoolean(ARG_ONLY_FOLDERS_CLICKABLE, false);
    mFileSelectable = args != null && args.getBoolean(ARG_FILE_SELECTABLE, false);
    mLimitToMimeType = args != null ? args.getString(ARG_MIMETYPE, "") : "";
    boolean hideItemOptions = args != null && args.getBoolean(ARG_HIDE_ITEM_OPTIONS, false);
    mAdapter = new OCFileListAdapter(getActivity(), accountManager.getUser(), preferences, mContainerActivity, this, hideItemOptions, isGridViewPreferred(mFile));
    setRecyclerViewAdapter(mAdapter);
    mHideFab = args != null && args.getBoolean(ARG_HIDE_FAB, false);
    if (mHideFab) {
        setFabVisible(false);
    } else {
        setFabVisible(true);
        registerFabListener();
    }
    if (!searchFragment) {
        // do not touch search event if previously searched
        if (getArguments() == null) {
            searchEvent = null;
        } else {
            searchEvent = getArguments().getParcelable(OCFileListFragment.SEARCH_EVENT);
        }
    }
    prepareCurrentSearch(searchEvent);
    if (mSortButton != null) {
        mSortButton.setOnClickListener(v -> openSortingOrderDialogFragment(requireFragmentManager(), preferences.getSortOrderByFolder(mFile)));
    }
    if (mSwitchGridViewButton != null) {
        mSwitchGridViewButton.setOnClickListener(v -> {
            if (isGridEnabled()) {
                setListAsPreferred();
            } else {
                setGridAsPreferred();
            }
            setGridSwitchButton();
        });
    }
    setTitle();
    FragmentActivity fragmentActivity;
    if ((fragmentActivity = getActivity()) != null && fragmentActivity instanceof FileDisplayActivity) {
        FileDisplayActivity fileDisplayActivity = (FileDisplayActivity) fragmentActivity;
        fileDisplayActivity.updateActionBarTitleAndHomeButton(fileDisplayActivity.getCurrentDir());
    }
    listDirectory(false, false);
}
Also used : FragmentActivity(androidx.fragment.app.FragmentActivity) FileDisplayActivity(com.owncloud.android.ui.activity.FileDisplayActivity) Bundle(android.os.Bundle) OCFileListAdapter(com.owncloud.android.ui.adapter.OCFileListAdapter)

Aggregations

FileDisplayActivity (com.owncloud.android.ui.activity.FileDisplayActivity)26 OCFile (com.owncloud.android.datamodel.OCFile)11 Test (org.junit.Test)9 Intent (android.content.Intent)8 FolderPickerActivity (com.owncloud.android.ui.activity.FolderPickerActivity)7 Activity (android.app.Activity)4 FileDataStorageManager (com.owncloud.android.datamodel.FileDataStorageManager)4 OCCapability (com.owncloud.android.lib.resources.status.OCCapability)4 UploadFilesActivity (com.owncloud.android.ui.activity.UploadFilesActivity)4 ScreenshotTest (com.owncloud.android.utils.ScreenshotTest)4 View (android.view.View)3 FragmentActivity (androidx.fragment.app.FragmentActivity)3 User (com.nextcloud.client.account.User)3 ArrayList (java.util.ArrayList)3 Account (android.accounts.Account)2 AccountManager (android.accounts.AccountManager)2 Bundle (android.os.Bundle)2 Handler (android.os.Handler)2 MenuItem (android.view.MenuItem)2 AdapterView (android.widget.AdapterView)2