package Ġme . s aket . inbox recyclerview Ċ Ċ import Ġandroid . os . Parcelable Ċ import Ġkotlinx . android . parcel . Parcel ize Ċ import Ġme . s aket . inbox recyclerview . Inbox RecyclerView . Expanded Item Ċ Ċ internal Ġclass ĠState Rest orer ( private Ġval Ġre cyclerView : ĠIn box RecyclerView ) Ġ{ ĊĊĠ Ġprivate Ġvar Ġitem To Restore : ĠEx pan ded Item Ġ= ĠEx pan ded Item . EMPTY ĊĊĠ Ġinternal Ġfun Ġsave ( out State : ĠParcel able ?): ĠParcel able Ġ{ ĊĠĠĠ Ġreturn ĠSaved State ( out State , Ġre cyclerView . expanded Item ) ĊĠ Ġ} ĊĊĠ Ġinternal Ġfun Ġrestore ( in State : ĠParcel able ): ĠParcel able ? Ġ{ ĊĠĠĠ Ġval Ġsaved State Ġ= Ġin State Ġas ĠSaved State ĊĠĠĠ Ġitem To Restore Ġ= Ġsaved State . expanded Item ĊĠĠĠ Ġrestore If Possible () ĊĠĠĠ Ġreturn Ġsaved State . super State ĊĠ Ġ} ĊĊĠ Ġinternal Ġfun Ġrestore If Possible () Ġ{ ĊĠĠĠ Ġval Ġadapter Ġ= Ġre cyclerView . adapter ĊĠĠĠ Ġval Ġpage Ġ= Ġre cyclerView . expand able Page ĊĊĠĠĠ Ġif Ġ( item To Restore . isEmpty (). not () Ġ&& Ġpage Ġ!= Ġnull Ġ&& Ġadapter Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠ Ġre cyclerView . expand Item ( item To Restore . adapter Id , Ġimmediate Ġ= Ġtrue ) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ Ċ @ Parcel ize Ċ private Ġdata Ġclass ĠSaved State ( ĊĠĠĠ Ġval Ġsuper State : ĠParcel able ?, ĊĠĠĠ Ġval Ġexpanded Item : ĠEx pan ded Item Ċ ) Ġ: ĠParcel able Ċ