Search in sources :

Example 1 with FileListListAdapter

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

the class OCFileListFragment method updateListOfFiles.

private void updateListOfFiles(FileListOption fileListOption) {
    boolean justFolders = isShowingJustFolders();
    setFooterEnabled(!justFolders);
    boolean folderPicker = isPickingAFolder();
    mFileListAdapter = new FileListListAdapter(justFolders, fileListOption.isAvailableOffline(), fileListOption.isSharedByLink(), folderPicker, getActivity(), mContainerActivity);
    setListAdapter(mFileListAdapter);
    mHideFab = !fileListOption.isAllFiles() || folderPicker;
    if (mHideFab) {
        setFabEnabled(false);
    } else {
        setFabEnabled(true);
        registerFabListeners();
        // detect if a mini FAB has ever been clicked
        final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
        if (prefs.getLong(KEY_FAB_EVER_CLICKED, 0) > 0) {
            miniFabClicked = true;
        }
        // add labels to the min FABs when none of them has ever been clicked on
        if (!miniFabClicked) {
            setFabLabels();
        } else {
            removeFabLabels();
        }
    }
    // Allow or disallow touches with other visible windows
    CoordinatorLayout coordinatorLayout = requireActivity().findViewById(R.id.coordinator_layout);
    coordinatorLayout.setFilterTouchesWhenObscured(PreferenceUtils.shouldDisallowTouchesWithOtherVisibleWindows(getContext()));
}
Also used : CoordinatorLayout(androidx.coordinatorlayout.widget.CoordinatorLayout) SharedPreferences(android.content.SharedPreferences) FileListListAdapter(com.owncloud.android.ui.adapter.FileListListAdapter)

Example 2 with FileListListAdapter

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

the class OCFileListFragment method onActivityCreated.

/**
     * {@inheritDoc}
     */
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    Log_OC.e(TAG, "onActivityCreated() start");
    if (savedInstanceState != null) {
        mFile = savedInstanceState.getParcelable(KEY_FILE);
    }
    boolean justFolders = isShowingJustFolders();
    setFooterEnabled(!justFolders);
    mAdapter = new FileListListAdapter(justFolders, getActivity(), mContainerActivity);
    setListAdapter(mAdapter);
    Bundle args = getArguments();
    mHideFab = (args != null) && args.getBoolean(ARG_HIDE_FAB, false);
    if (mHideFab) {
        setFabEnabled(false);
    } else {
        setFabEnabled(true);
        registerFabListeners();
        // detect if a mini FAB has ever been clicked
        final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
        if (prefs.getLong(KEY_FAB_EVER_CLICKED, 0) > 0) {
            miniFabClicked = true;
        }
        // add labels to the min FABs when none of them has ever been clicked on
        if (!miniFabClicked) {
            setFabLabels();
        } else {
            removeFabLabels();
        }
    }
}
Also used : SharedPreferences(android.content.SharedPreferences) Bundle(android.os.Bundle) FileListListAdapter(com.owncloud.android.ui.adapter.FileListListAdapter)

Aggregations

SharedPreferences (android.content.SharedPreferences)2 FileListListAdapter (com.owncloud.android.ui.adapter.FileListListAdapter)2 Bundle (android.os.Bundle)1 CoordinatorLayout (androidx.coordinatorlayout.widget.CoordinatorLayout)1