Search in sources :

Example 1 with SmoothScrollGridLayoutManager

use of eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager in project FlexibleAdapter by davideas.

the class FragmentExpandableSections method createNewGridLayoutManager.

@Override
protected GridLayoutManager createNewGridLayoutManager() {
    GridLayoutManager gridLayoutManager = new SmoothScrollGridLayoutManager(getActivity(), mColumnCount);
    gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

        @Override
        public int getSpanSize(int position) {
            // here, you should use them and not Layout integers
            switch(mAdapter.getItemViewType(position)) {
                case R.layout.recycler_scrollable_layout_item:
                case R.layout.recycler_scrollable_uls_item:
                case R.layout.recycler_header_item:
                case R.layout.recycler_expandable_header_item:
                case R.layout.recycler_expandable_item:
                    return mColumnCount;
                default:
                    return 1;
            }
        }
    });
    return gridLayoutManager;
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) SmoothScrollGridLayoutManager(eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager) SmoothScrollGridLayoutManager(eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager)

Example 2 with SmoothScrollGridLayoutManager

use of eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager in project FlexibleAdapter by davideas.

the class FragmentHeadersSections method createNewGridLayoutManager.

@Override
protected GridLayoutManager createNewGridLayoutManager() {
    GridLayoutManager gridLayoutManager = new SmoothScrollGridLayoutManager(getActivity(), mColumnCount);
    gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

        @Override
        public int getSpanSize(int position) {
            //noinspection ConstantConditions
            return mAdapter.getItem(position).getSpanSize(mColumnCount, position);
        }
    });
    return gridLayoutManager;
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) SmoothScrollGridLayoutManager(eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager) SmoothScrollGridLayoutManager(eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager)

Example 3 with SmoothScrollGridLayoutManager

use of eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager in project FlexibleAdapter by davideas.

the class FragmentOverall method createNewGridLayoutManager.

@Override
protected GridLayoutManager createNewGridLayoutManager() {
    mAdapter.setAnimationEntryStep(false);
    GridLayoutManager gridLayoutManager = new SmoothScrollGridLayoutManager(getActivity(), mColumnCount);
    gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

        @Override
        public int getSpanSize(int position) {
            // here, you should use them and not Layout integers
            switch(mAdapter.getItemViewType(position)) {
                case R.layout.recycler_scrollable_usecase_item:
                case R.layout.recycler_scrollable_layout_item:
                    return mColumnCount;
                default:
                    return 1;
            }
        }
    });
    return gridLayoutManager;
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) SmoothScrollGridLayoutManager(eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager) StaggeredGridLayoutManager(android.support.v7.widget.StaggeredGridLayoutManager) SmoothScrollGridLayoutManager(eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager)

Example 4 with SmoothScrollGridLayoutManager

use of eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager in project FlexibleAdapter by davideas.

the class FragmentEndlessScrolling method createNewGridLayoutManager.

@Override
protected GridLayoutManager createNewGridLayoutManager() {
    GridLayoutManager gridLayoutManager = new SmoothScrollGridLayoutManager(getActivity(), mColumnCount);
    gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

        @Override
        public int getSpanSize(int position) {
            // here, you should use them and not Layout integers
            switch(mAdapter.getItemViewType(position)) {
                case R.layout.recycler_scrollable_expandable_item:
                case R.layout.recycler_scrollable_header_item:
                case R.layout.recycler_scrollable_footer_item:
                case R.layout.recycler_scrollable_layout_item:
                case R.layout.recycler_scrollable_uls_item:
                case R.layout.progress_item:
                    return mColumnCount;
                default:
                    return 1;
            }
        }
    });
    return gridLayoutManager;
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) SmoothScrollGridLayoutManager(eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager) SmoothScrollGridLayoutManager(eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager)

Example 5 with SmoothScrollGridLayoutManager

use of eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager in project FlexibleAdapter by davideas.

the class FragmentExpandableMultiLevel method createNewGridLayoutManager.

@Override
protected GridLayoutManager createNewGridLayoutManager() {
    GridLayoutManager gridLayoutManager = new SmoothScrollGridLayoutManager(getActivity(), mColumnCount);
    gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

        @Override
        public int getSpanSize(int position) {
            // here, you should use them and not Layout integers
            switch(mAdapter.getItemViewType(position)) {
                case R.layout.recycler_scrollable_layout_item:
                case R.layout.recycler_scrollable_uls_item:
                case R.layout.recycler_header_item:
                case R.layout.recycler_expandable_header_item:
                case R.layout.recycler_expandable_item:
                    return mColumnCount;
                default:
                    return 1;
            }
        }
    });
    return gridLayoutManager;
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) SmoothScrollGridLayoutManager(eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager) SmoothScrollGridLayoutManager(eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager)

Aggregations

GridLayoutManager (android.support.v7.widget.GridLayoutManager)5 SmoothScrollGridLayoutManager (eu.davidea.flexibleadapter.common.SmoothScrollGridLayoutManager)5 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)1