faberNovel / stateful-layout

Android StatefulLayout
Apache License 2.0
10 stars 4 forks source link

Remove state duplicates in view hierarchy #53

Closed sjcqs closed 4 years ago

sjcqs commented 4 years ago

Duplicates #39 Fixes #52

Declaring two states with the same id was properly erasing the first declared state from the 'states' table of StatefulLayout, but it was not removing its view from the view hierarchy

On my project, I was overloading stateError and I had this crash because of the duplicate :

Wrong state class, expecting View State but received class com.google.android.material.button.MaterialButton$SavedState instead.
This usually happens when two views of different type have the same id in the same hierarchy. 
This view's id is id/stateErrorRetryButton. 
Make sure other views do not use the same id.