Skip to content

LoopingLayoutManager not restoring LayoutRequest from Parcel correctly #67

@abcdefguan

Description

@abcdefguan
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions