BelooS / ChipsLayoutManager

ANDROID. ChipsLayoutManager (SpanLayoutManager, FlowLayoutManager). A custom layout manager for RecyclerView which mimicric TextView span behaviour, flow layouts behaviour with support of amazing recyclerView features
Apache License 2.0
3.25k stars 362 forks source link

java.lang.IllegalStateException #22

Closed hubcin closed 7 years ago

hubcin commented 7 years ago

java.lang.IllegalStateException: Observer com.beloo.widget.chipslayoutmanager.layouter.MeasureSupporter@6c0f5aa is already registered.

When I call setAdapter the second time for my RecyclerView which has ChipsLayoutManager, it will give me this error.

hubcin commented 7 years ago

I think you would have to remove the first line in function onAdapterChanged(), because when setAdapter of the RecyclerView called, the data observer is already registered. Didn't figure out why you explicitly registered it again, so if registering it is necessary in some circumstances, I think you may have to check if the data observer is registered or not before that.

BelooS commented 7 years ago

Yes, this issue goes into more deeper problem, coz in case changing adapters - measurer will listen for both of them with current implementation, which is really incorrect. Thanks again for nice feedback

BelooS commented 7 years ago

fixed in v0.3.5. Covered with functional test

hubcin commented 7 years ago

Yeah, it's perfectly done. Had to clean the project and rebuild it after changing to the newer version. Thanks for your efforts.

BelooS commented 7 years ago

np