package Ġcom . example . flutter _ screenshot _ events Ċ Ċ import Ġandroid . app . Activity Ċ import Ġandroid . content . Context Ċ import Ġandroid . view . WindowManager Ċ import Ġandroidx . annotation . NonNull Ċ Ċ import Ġio . flutter . embedding . engine . plugins . Flutter Plugin Ċ import Ġio . flutter . embedding . engine . plugins . activity . Activity Aware Ċ import Ġio . flutter . embedding . engine . plugins . activity . Activity Plugin Binding Ċ import Ġio . flutter . plugin . common . Event Channel Ċ import Ġio . flutter . plugin . common . MethodCall Ċ import Ġio . flutter . plugin . common . Method Channel Ċ import Ġio . flutter . plugin . common . Method Channel . MethodCall Handler Ċ import Ġio . flutter . plugin . common . Method Channel . Result Ċ Ċ /** ĠFlutter Screenshots Plugin Ġ*/ Ċ class ĠFlutter Screenshot Events Plugin Ġ: ĠFlutter Plugin , ĠMethod Call Handler , ĠActivity Aware { ĊĊĠ Ġprivate Ġlateinit Ġvar Ġchannel : ĠMethod Channel ĊĠ Ġprivate Ġlateinit Ġvar Ġactivity : ĠActivity ; ĊĠ Ġvar Ġdisable Screenshots : ĠBoolean Ġ= Ġfalse ĊĊĠ Ġoverride Ġfun Ġon Attached To Engine (@ NonNull Ġflutter Plugin Binding : ĠFlutter Plugin . Flutter Plugin Binding ) Ġ{ ĊĠĠĠ Ġchannel Ġ= ĠMethod Channel ( flutter Plugin Binding . binary Messenger , Ġ" flutter _ screenshots ") ĊĠĠĠ Ġchannel . set MethodCall Handler ( this ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġset Disable Screenshots Status ( disable : ĠBoolean ) Ġ{ ĊĠĠĠ Ġif Ġ( disable ) Ġ{ ĊĠĠĠĠĠ Ġactivity . window . set Flags ( WindowManager . LayoutParams . FLAG _ SECURE , ĠWindow Manager . LayoutParams . FLAG _ SECURE ); ĊĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠ Ġactivity . window . clear Flags ( WindowManager . LayoutParams . FLAG _ SECURE ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon MethodCall (@ NonNull Ġcall : ĠMethod Call , Ġ@ NonNull Ġresult : ĠResult ) Ġ{ ĊĠĠĠ Ġif Ġ( call . method Ġ== Ġ" disable Screenshots ") Ġ{ ĊĠĠĠĠĠ Ġvar Ġdisable Ġ= Ġcall . argument < Boolean >(" disable ") Ġ== Ġtrue ĊĠĠĠĠĠ Ġset Disable Screenshots Status ( disable ) ĊĠĠĠĠĠ Ġresult . success ("") ĊĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠ Ġresult . not Implemented () ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Detached From Engine (@ NonNull Ġbinding : ĠFlutter Plugin . Flutter Plugin Binding ) Ġ{ ĊĠĠĠ Ġchannel . set MethodCall Handler ( null ) ĊĠ Ġ} ĊĊĊĠ Ġoverride Ġfun Ġon Re attached To Activity For Config Changes ( binding : ĠActivity Plugin Binding ) Ġ{ ĊĠĠĠ Ġactivity Ġ= Ġbinding . activity ĊĠĠĠ Ġset Disable Screenshots Status ( this . disable Screenshots ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Detached From Activity () Ġ{ ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Attached To Activity ( binding : ĠActivity Plugin Binding ) Ġ{ ĊĠĠĠ Ġactivity Ġ= Ġbinding . activity ĊĠĠĠ Ġset Disable Screenshots Status ( this . disable Screenshots ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Detached From Activity For Config Changes () Ġ{ ĊĠ Ġ} Ċ Ċ } ĊĊ