You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Different SpanSizeLookup's and ItemDecoration's(mostly margins for pre/post-lollipop CardViews) is pretty widespreaded business issue, and as long as these guys are the part of RecyclerView gang bang, we should cover them.
I'd like to contribute, as long as I definitely gonna use your lib.
As of ItemDecoration I'd suggest to build something like:
publicclassItemDecorationManagerextendsRecyclerView.ItemDecoration {
// ... similar stuff to what you got in AbsDelegationAdapter.class@OverridepublicvoidgetItemOffsets(RectoutRect, Viewview, RecyclerViewparent,
RecyclerView.Statestate) {
super.getItemOffsets(outRect, view, parent, state);
for (ItemDecorationDelegatedelegate : delegates) {
if(delegate.isForViewType(...)) delegate.decorate(....);
}
}
}
publicinterfaceItemDecorationDelegate<T> {
voiddecorate(RectoutRect, Viewview, RecyclerViewparent, RecyclerView.Statestate);
booleanisForViewType(Titem, intposition);
}
}
and then just:
ItemDecorationManagermanager = newItemDecorationManager();
manager.addDelegate(delegate1);
manager.addDelegate(delegate2);
manager.addDelegate(delegate3);
manager.addDelegate(delegate4);
recyclerView.addItemDecoration(manager); //or we can call it Wrapper
for SpanSizeLookup I'd follow the same approach.
The con of such approach is that we duplicate isForViewType(), so I'd suggest to decouple that logic.
I'd like to talk about the issue, pick the concept and then contribute!
Cheers!
The text was updated successfully, but these errors were encountered:
Hi,
I'm glad you want to contribute. Contribution is very welcome!
Regarding: ItemDecorationManager I thought about adding this too, but wasn't sure how to do that best. The question is: Since it's not the responsibility of an adapter does they really belong into this library?
For the SpanSizeLookup, I'm not sure whether or not a simple switch statement is enough (instead of SpanSizeManager and SpanSizeDelegate)
I played around in a forked branch and really really like that concept when we have adapter, decorator and spans size lookup built in library, cause now it feels complete. I'm not sure if this is an argument, but.. If there is no such API provided by your library means that people gonna have to implement it by their own or smbdy gonna have to make a SpanSizeLookup / ItemDecoration delegates libraries
Different
SpanSizeLookup's
andItemDecoration's
(mostly margins for pre/post-lollipopCardViews
) is pretty widespreaded business issue, and as long as these guys are the part ofRecyclerView
gang bang, we should cover them.I'd like to contribute, as long as I definitely gonna use your lib.
As of
ItemDecoration
I'd suggest to build something like:and then just:
for
SpanSizeLookup
I'd follow the same approach.The con of such approach is that we duplicate
isForViewType()
, so I'd suggest to decouple that logic.I'd like to talk about the issue, pick the concept and then contribute!
Cheers!
The text was updated successfully, but these errors were encountered: