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

Better support Android Annotations #5

Closed acr92 closed 8 years ago

acr92 commented 8 years ago

Hello,

I want to use your library in conjunction with Android Annotations. More specifically, this part: https://github.com/excilys/androidannotations/wiki/Adapters-and-lists

While it will probably work fine already, I would have to inflate the view twice, potentionally wasting memory and resources during app initialization (something I'd like to avoid).

The view would first be inflated in: https://github.com/luizgrp/SectionedRecyclerViewAdapter/blob/2d852886a244c29fa1da8ed2a1753731fc8b0055/library/src/main/java/io/github/luizgrp/sectionedrecyclerviewadapter/SectionedRecyclerViewAdapter.java#L72

and then here:

    @Override
    protected PersonItemView onCreateItemView(ViewGroup parent, int viewType) {
        return PersonItemView_.build(context);
    }

If I, somehow, could tell SectionedRecyclerViewAdapter to not call inflate, then everything should work perfectly. E.g. by setting resource ID to -1, or by calling some function assigning a boolean value.

luizgrp commented 8 years ago

Hi @Blystad,

Thanks for your very detailed comment.

Just for further clarification, are you making your PersonAdapter extend SectionedRecyclerViewAdapter?