luizgrp / SectionedRecyclerViewAdapter

An Adapter that allows a RecyclerView to be split into Sections with headers and/or footers. Each Section can have its state controlled individually.
MIT License
1.68k stars 372 forks source link

Added empty state #41

Closed yccheok closed 7 years ago

yccheok commented 7 years ago

Sometimes, when there are no items in a section, there can be 2 possibilities.

  1. Loading error like internet problem. Hence, it makes sense to provide FAILED state. We can show an UI with retry button.

  2. But, it can also be, a valid EMPTY state. For instance, user doesn't save anything in Settings. Hence, it makes sense loader returns empty result from Settings. In that case, we need a different type of view. View for FAILED state is not suitable in this case.

p/s Or, when user explicitly remove all items from the Section. It make sense, to let caller have a choice, whether to switch the Section's state to EMPTY, when there is no content item in the Section.

luizgrp commented 7 years ago

Hi @yccheok,

Many thanks for this PR. I will accept all the changes proposed.

Please open 3 separate PRs so the changes can be reviewed individually. Please get the latest version of develop before adding your changes. These new PRs should be merged into develop and not master.

Do not add your changes to gradle and travis, they were updated/fixed in develop already by another PR.

I'm closing this one for now.

yccheok commented 7 years ago

Thanks. I will send another PR when I'm free to do so. Currently, I'm busy integrating your libraries into a production app...

luizgrp commented 7 years ago

No worries, take your time! Cheers

henriquenfaria commented 7 years ago

It would be really useful to have this change integrated in the next release!