-
Notifications
You must be signed in to change notification settings - Fork 18
Description
- Device:
- OS Version:
- Project Version:
🐛 Describe
LayoutRequest doesn't correctly restore hasBeenInitialized correctly when parceled, then unparceled. When parceled again, it crashes to "LayoutRequest has not been initialized"
LoopingLayoutManager:1180
public constructor(parcel: Parcel) : this() { anchorIndex = parcel.readInt() scrollOffset = parcel.readInt() adapterDirection = parcel.readInt() }
This code doesn't restore hasBeenInitialized unlike the other constructor. So if you restore it from the constructor above, then try to Parcel it again, hasBeenInitialized will be false and there will be a crash
You can fix this by adding hasBeenInitialized to the Parcel
🐌 Steps to reproduce
Create fragment X that has the looping layout manager
Go to fragment Y that doesn't have the looping layout manager and startActivityForResult to activity Z. Hope that onSaveInstanceState triggers here
Go back to fragment Y. Hope that onRestoreInstanceState triggers here
Go back to activity Z. Crashes.
🦋 Expected behavior
No crash
🪲 Other info
🐝 Requested assignment
I'm just reporting this problem. I don't want to fix it.