package Ġcom . fs bar ata . be haviors Ċ Ċ import Ġandroid . os . Bundle Ċ import Ġandroid . os . Parcelable Ċ import Ġcom . fs bar ata . be haviors . framework . Abstract Lifecycle Behavior Ċ Ċ class ĠSave InstanceState Behavior < T : ĠParcel able >( Ċĉ ĉ private Ġval Ġkey : ĠString , Ċĉ ĉ private Ġval Ġrestore able Provider : Ġ() Ġ-> ĠI Restore able < T > Ċ ) Ġ: ĠAbstract Lifecycle Behavior () Ġ{ ĊĊ ĉ constructor ( restore able : ĠI Restore able < T >) Ġ: Ġthis ({ Ġrestore able Ġ}) ĊĊ ĉ constructor ( key : ĠString , Ġrestore able : ĠI Restore able < T >) Ġ: Ġthis ( key , Ġ{ Ġrestore able Ġ}) ĊĊ ĉ constructor ( restore able Provider : Ġ() Ġ-> ĠI Restore able < T >) Ġ: Ġthis ("", Ġrestore able Provider ) ĊĊ ĉ interface ĠI Restore able < T : ĠParcel able > Ġ{ Ċĉ ĉ fun Ġsave State (): ĠT ĊĊĉ ĉ fun Ġrestore State ( state : ĠT ) Ċ ĉ } ĊĊ ĉ override Ġfun Ġon Save InstanceState ( out State : ĠBundle ) Ġ{ Ċĉ ĉ out State . put Parcelable ( key , Ġrestore able Provider (). save State ()) Ċ ĉ } ĊĊ ĉ override Ġfun Ġon Restore InstanceState ( savedInstanceState : ĠBundle ) Ġ{ Ċĉ ĉ ( savedInstanceState . get Parcelable ( key ) Ġas ĠT ?) Ċĉĉĉ ĉ ?. run Ġ{ Ġrestore able Provider (). restore State ( this ) Ġ} Ċ ĉ } Ċ } Ċ