Search in sources :

Example 1 with CompressedExplorerAdapter

use of com.amaze.filemanager.adapters.CompressedExplorerAdapter in project AmazeFileManager by TeamAmaze.

the class CompressedExplorerFragment method createViews.

private void createViews(ArrayList<CompressedObjectParcelable> items, String dir) {
    if (compressedExplorerAdapter == null) {
        compressedExplorerAdapter = new CompressedExplorerAdapter(getActivity(), utilsProvider, items, this, decompressor);
        listView.setAdapter(compressedExplorerAdapter);
    } else {
        compressedExplorerAdapter.generateZip(items);
    }
    folder = 0;
    file = 0;
    for (CompressedObjectParcelable item : items) {
        if (item.type == CompressedObjectParcelable.TYPE_GOBACK)
            continue;
        if (item.directory)
            folder++;
        else
            file++;
    }
    stopAnims = true;
    if (!addheader) {
        listView.removeItemDecoration(dividerItemDecoration);
        // listView.removeItemDecoration(headersDecor);
        addheader = true;
    } else {
        dividerItemDecoration = new DividerItemDecoration(getActivity(), true, showDividers);
        listView.addItemDecoration(dividerItemDecoration);
        // headersDecor = new StickyRecyclerHeadersDecoration(compressedExplorerAdapter);
        // listView.addItemDecoration(headersDecor);
        addheader = false;
    }
    final FastScroller fastScroller = (FastScroller) rootView.findViewById(R.id.fastscroll);
    fastScroller.setRecyclerView(listView, 1);
    fastScroller.setPressedHandleColor(mainActivity.getColorPreference().getColor(ColorUsage.ACCENT));
    ((AppBarLayout) mToolbarContainer).addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
        fastScroller.updateHandlePosition(verticalOffset, 112);
    });
    listView.stopScroll();
    relativeDirectory = dir;
    updateBottomBar();
    swipeRefreshLayout.setRefreshing(false);
}
Also used : CompressedObjectParcelable(com.amaze.filemanager.adapters.data.CompressedObjectParcelable) FastScroller(com.amaze.filemanager.ui.views.FastScroller) AppBarLayout(android.support.design.widget.AppBarLayout) DividerItemDecoration(com.amaze.filemanager.ui.views.DividerItemDecoration) CompressedExplorerAdapter(com.amaze.filemanager.adapters.CompressedExplorerAdapter)

Aggregations

AppBarLayout (android.support.design.widget.AppBarLayout)1 CompressedExplorerAdapter (com.amaze.filemanager.adapters.CompressedExplorerAdapter)1 CompressedObjectParcelable (com.amaze.filemanager.adapters.data.CompressedObjectParcelable)1 DividerItemDecoration (com.amaze.filemanager.ui.views.DividerItemDecoration)1 FastScroller (com.amaze.filemanager.ui.views.FastScroller)1