package Ġcom . tom as zn aj da . p ulp fi ction . fullscreen Ċ Ċ import Ġcom . tom as zn aj da . p ulp fi ction . exception . Fullscreen Disabled Exception Ċ import Ġio . reactivex . Observable Ċ import Ġio . reactivex . subjects . Publish Subject Ċ Ċ class ĠFull screen Delegate Ġ{ ĊĠĠĠ Ġprivate Ġval Ġ_ state Changes Ġ= ĠPublish Subject . create < Fullscreen State >() ĊĠĠĠ Ġval Ġstate Changes : ĠObservable < Fullscreen State > Ġ= Ġ_ state Changes ĊĠĠĠ Ġvar Ġstate Ġ= ĠFull screen State . DISABLED ĊĠĠĠĠĠĠĠ Ġprivate Ġset ( value ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfield Ġ= Ġvalue ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ_ state Changes . onNext ( value ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġprivate Ġvar Ġenter Fullscreen Callback : Ġ(() Ġ-> ĠBoolean )? Ġ= Ġnull ĊĠĠĠ Ġprivate Ġvar Ġexit Fullscreen Callback : Ġ(() Ġ-> ĠBoolean )? Ġ= Ġnull ĊĊĠĠĠ Ġfun Ġenable ( enter Fullscreen Callback : Ġ() Ġ-> ĠBoolean , Ġexit Fullscreen Callback : Ġ() Ġ-> ĠBoolean ) Ġ{ ĊĠĠĠĠĠĠĠ Ġthis . enter Fullscreen Callback Ġ= Ġenter Fullscreen Callback ĊĠĠĠĠĠĠĠ Ġthis . exit Fullscreen Callback Ġ= Ġexit Fullscreen Callback ĊĠĠĠĠĠĠĠ Ġstate Ġ= ĠFull screen State . OFF ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdisable () Ġ{ ĊĠĠĠĠĠĠĠ Ġenter Fullscreen Callback Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġexit Fullscreen Callback Ġ= Ġnull ĊĠĠĠĠĠĠĠ Ġstate Ġ= ĠFull screen State . DISABLED ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġenter () Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( state Ġ== ĠFull screen State . DISABLED ) Ġthrow ĠFull screen Disabled Exception () ĊĠĠĠĠĠĠĠ Ġif Ġ( enter Fullscreen Callback ?. invoke () Ġ== Ġtrue ) Ġstate Ġ= ĠFull screen State . ON ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġexit () Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( state Ġ== ĠFull screen State . DISABLED ) Ġthrow ĠFull screen Disabled Exception () ĊĠĠĠĠĠĠĠ Ġif Ġ( exit Fullscreen Callback ?. invoke () Ġ== Ġtrue ) Ġstate Ġ= ĠFull screen State . OFF ĊĠĠĠ Ġ} Ċ }