Skip to content
This repository has been archived by the owner on Feb 19, 2023. It is now read-only.

Helps in creating live, auto-updated RecyclerViews based on data from GreenDAO.

License

Notifications You must be signed in to change notification settings

Miha-x64/LiveLists4GreenDAO

Repository files navigation

LiveLists4GreenDAO

Helps in creating live, auto-updated RecyclerViews based on data from GreenDAO.

What's new

  • Using stable IDs

  • New abstraction LiveList and its implementation GreenLiveList

  • LiveAdapter accepts LiveList which encapsulates both LiveDataLayer and Query;

  • you can change query via LiveAdapter.changeList(LiveList), argument must be of same type (GreenLiveList) and must be hosted on the same data layer, only query may be changed;

  • multi-thread crash fix;

  • entities must implement new onDelete method which is expected to null out their primary key;

  • it's able to notify a data layer about any changes: there are saved() and removed() methods in LiveDataLayer

Sample usage of LiveAdapter:

recycler.setAdapter(
        new LiveAdapter<Item, ItemHolder>(new GreenLiveList(dataaLayer, app.getItemDao().queryBuilder().build())) {
            @Override public ItemHolder onCreateViewHolder(ViewGroup parent, int viewType) {
                return new ItemHolder(getLayoutInflater()
                        .inflate(android.R.layout.simple_list_item_1, parent, false));
            }
        });

Depends on another my project, Blitz!, which provides collections of longs. Still not published on any Maven repo, so you may clone that project in order to try out this one.

Adding via Gradle:

    compile project(':greenLiveLists') // GreenLiveList
    compile project(':liveListsAndroid') // LiveAdapter

About

Helps in creating live, auto-updated RecyclerViews based on data from GreenDAO.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages