Search in sources :

Example 1 with BasicGridLayoutManager

use of com.marshalchen.ultimaterecyclerview.grid.BasicGridLayoutManager in project UltimateRecyclerView by cymcsg.

the class GridLayoutRVTest method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(getMainLayout());
    mToolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(true);
    listuv = (UltimateRecyclerView) findViewById(R.id.ultimate_recycler_view);
    mGridAdapter = new GridJRAdapter(getJRList());
    mGridAdapter.setSpanColumns(columns);
    mGridLayoutManager = new BasicGridLayoutManager(this, columns, mGridAdapter);
    listuv.setLayoutManager(mGridLayoutManager);
    listuv.setHasFixedSize(true);
    listuv.setSaveEnabled(true);
    listuv.setClipToPadding(false);
    // mGridAdapter.setCustomLoadMoreView(LayoutInflater.from(this).inflate(R.layout.custom_bottom_progressbar, null));
    listuv.setNormalHeader(setupHeaderView());
    final Handler f = new Handler();
    listuv.setOnLoadMoreListener(new UltimateRecyclerView.OnLoadMoreListener() {

        @Override
        public void loadMore(int itemsCount, int maxLastVisiblePosition) {
            // Log.d(TAG, itemsCount + " :: " + itemsCount);
            f.postDelayed(new Runnable() {

                @Override
                public void run() {
                    mGridAdapter.insert(SampleDataboxset.genJRList(5));
                    afterAdd();
                }
            }, 2000);
        }
    });
    // listuv.enableLoadmore();
    // listuv.disableLoadmore();
    listuv.setLoadMoreView(R.layout.custom_bottom_progressbar);
    listuv.setAdapter(mGridAdapter);
    listuv.setItemAnimator(new DefaultItemAnimator());
    harness_control();
}
Also used : BasicGridLayoutManager(com.marshalchen.ultimaterecyclerview.grid.BasicGridLayoutManager) UltimateRecyclerView(com.marshalchen.ultimaterecyclerview.UltimateRecyclerView) Handler(android.os.Handler) DefaultItemAnimator(androidx.recyclerview.widget.DefaultItemAnimator)

Aggregations

Handler (android.os.Handler)1 DefaultItemAnimator (androidx.recyclerview.widget.DefaultItemAnimator)1 UltimateRecyclerView (com.marshalchen.ultimaterecyclerview.UltimateRecyclerView)1 BasicGridLayoutManager (com.marshalchen.ultimaterecyclerview.grid.BasicGridLayoutManager)1