cymcsg / UltimateRecyclerView

A RecyclerView(advanced and flexible version of ListView in Android) with refreshing,loading more,animation and many other features.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

recode the core.

jjhesk opened this issue · comments

First of all, thanks to @cymcsg for your amazing bundle from other library and we have been fixing bugs so far and its been your sole effort for the majority. Here I want to give you a special thanks for our hard works. However, looking at the contribution rate. We dont see the popular of contributions from the crowds. For my view of points, it is still such an headache to look at the code in one single large file.
I think the recyclerview has been a maze for people to add their external efforts on combining their module.

Basically, there are

  1. too many hardcoded things
  2. not many generic type
  3. not able to add module easily.
    I have read from other libraries and found some interesting implementation yet will able to keep this library as lightweight. Maybe we can try some effort to make this library more adaptable for developer crowd. Please read up this libray and give me some suggestions. Here I will response to all the previous query for the adaptable module features #222
  • better control for the empty view to show or not
  • fix load more on grid layout issue

For this version of 0.4.0 we need to clear out all the most the popular issues from the previous posts.

  1. The first thing is the loadmore issue raised by all other developers.
  2. The second thing is the grid layout issues.

I agree with you.I really think the library should be more adaptable.
Would you like to be a collaborator of the project?

can u add me in the project? +1 you can branch out a portion for me to start making updates..

@jjhesk I have added you to the project.Hoping for your magical contribution~

started from this branch i will start digging into grid layout manager on the core code at this file

now i have done some works for the upgrades. =)
sample demonstration code
adapter for gridlayout manager
enhanced adapter for URV

#280 First is the load more issue which is now resolved
#284 Zero data to start at the beginning

Now this is the proper coding for enable load more on grid layout manager

     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 GridLayoutRVAdapter(getItems());
        mGridAdapter.setSpanColumns(columns);
        mGridLayoutManager = new BasicGridLayoutManager(this, columns, mGridAdapter);
        listuv.setLayoutManager(mGridLayoutManager);
        listuv.setHasFixedSize(true);
        listuv.setSaveEnabled(true);
        listuv.setClipToPadding(false);
        listuv.setAdapter(mGridAdapter);
        listuv.setItemAnimator(new DefaultItemAnimator());

        // 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.newListFromGen(2));
                        // listuv.disableLoadmore();
                        // listuv.disableLoadmore();
                    }
                }, 1000);
            }
        });

        listuv.enableLoadmore();

when you need to disable load more after done loading the items you can do this:

    public void loadMore(int itemsCount, int maxLastVisiblePosition) {
                //   Log.d(TAG, itemsCount + " :: " + itemsCount);
                f.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        mGridAdapter.insert( .... );
                        listuv.disableLoadmore();
                    }
                }, 1000);
            }
  • new feature to add for empty view control. it will enable the user to take control of when the empty view should be shown via api.
  • @cymcsg can you please do some testing on the scrolling? lets test it and see if it is stable on my branch then we can publish a release for the incremental version. Cheers!

Great work! Let's try to do some test and then release them.

just tested on linearlayout and i also fixed the defects from the load more. please do more load more testing...
sample apps are also updated.

Test code list

  • empty adapter at the beginning and using load more to add items into the RV for LINEAR layout manager - expect a loading spinner to show before
  • empty adapter at the beginning and using load more to add items into the RV for GRID layout manager - expect a loading spinner to show before (https://youtu.be/iTnIf-N8m1Y)
  • empty adapter at the beginning and using load more to add items into the RV for GRID layout manager - expect empty view to show
  • empty adapter at the beginning and using load more to add items into the RV for LINEAR layout manager - expect empty view to show

quick fix from zero data at the beginning. #284

Awesome work!

@cymcsg try to deploy from branch core-recode-redesign i think its ready for 0.4.0. the only thing is the swiplist demo and there are some errors behind. you might take a look of the code

Great work!
I have noticed that problem in SwipeListViewExampleActivity and some problem in the Mainactivity when I swipe the first item.

I do not have enough time to fix the bug in SwipeListViewExampleActivity in these days so I think it's a good idea to release 0.4.0 with this problem which will be fixed in next version.
Thank you for your great work.If you like we can also talk about something via Email.

@cymcsg yes i can take up your work and fix the possible bugs

should be fixed again.. on v0.5.0