package Ġcom . ny tro tech . color _ picker _ camera Ċ Ċ import Ġandroid . app . Activity Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroid . os . Build Ċ import Ġandroid . util . Log Ċ import Ġandroid . widget . Toast Ċ import Ġandroidx . annotation . NonNull Ċ Ċ import Ġcom . ny tro tech . color _ picker _ camera . Camera Activity Ċ Ċ 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 . 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 Ċ import Ġio . flutter . plugin . common . Plugin Registry . Registrar Ċ Ċ /** ĠColor Picker Camera Plugin Ġ*/ Ċ class ĠColor Picker Camera Plugin : ĠFlutter Plugin , ĠMethod Call Handler Ġ, ĠActivity Aware , Ġio . flutter . plugin . common . Plugin Registry . Activity Result Listener Ġ{ ĊĊĊĠ Ġprivate Ġlateinit Ġvar Ġchannel : ĠMethod Channel ĊĠ Ġprivate Ġlateinit Ġvar Ġf : ĠFlutter Plugin . Flutter Plugin Binding ĊĠ Ġvar ĠCHAN NEL Ġ= Ġ" color _ picker _ camera " ĊĊĠ Ġprivate Ġvar Ġpending Result : ĠResult ? Ġ= Ġnull ĊĠ Ġprivate Ġlateinit Ġvar Ġcontext : ĠContext ĊĠ Ġprivate Ġlateinit Ġvar Ġactivity : ĠActivity ĊĠ Ġoverride Ġfun Ġon Attached To Engine (@ NonNull Ġflutter Plugin Binding : ĠFlutter Plugin . Flutter Plugin Binding ) Ġ{ ĊĠĠĠ Ġf Ġ= Ġflutter Plugin Binding ĊĊĊĠĠĠ Ġchannel Ġ= ĠMethod Channel ( flutter Plugin Binding . binary Messenger , ĠCHAN NEL ) ĊĠĠĠ Ġchannel . set MethodCall Handler ( this ) ĊĠĠĠ Ġcontext Ġ= Ġflutter Plugin Binding . application Context ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon MethodCall (@ NonNull Ġcall : ĠMethod Call , Ġ@ NonNull Ġresult : ĠResult ) Ġ{ ĊĠĠĠ Ġif Ġ( call . method Ġ== Ġ" get Platform Version ") Ġ{ ĊĠĠĠĠĠ Ġresult . success (" Android Ġ${ Build . VERSION . RELEASE }") ĊĠĠĠ Ġ} Ġelse Ġif Ġ( call . method Ġ== Ġ" start New Activity ") Ġ{ ĊĊĊĠĠĠĠĠ Ġpending Result Ġ= Ġresult ĊĠĠĠĠĠ Ġval Ġintent Ġ= ĠIntent ( f . application Context , ĠCamera Activity :: class . java ) ĊĠĠĠĠĠ Ġactivity !!. startActivity For Result ( intent , Ġ 6 6 6 ) ĊĠĠĠ Ġ} Ġ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 Detached From Activity () Ġ{ ĊĠĠĠ ĠTODO (" Not Ġyet Ġimplemented ") ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Re attached To Activity For Config Changes ( binding : ĠActivity Plugin Binding ) Ġ{ ĊĠĠĠ ĠTODO (" Not Ġyet Ġimplemented ") ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Attached To Activity ( binding : ĠActivity Plugin Binding ) Ġ{ ĊĠĠĠ Ġactivity Ġ= Ġbinding . activity ; ĊĠĠĠ Ġbinding . add Activity Result Listener ( this ); ĊĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Detached From Activity For Config Changes () Ġ{ ĊĠĠĠ ĠTODO (" Not Ġyet Ġimplemented ") ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġon Activity Result ( request Code : ĠInt , ĠresultCode : ĠInt , Ġdata : ĠIntent ?): ĠBoolean Ġ{ ĊĠĠĠ Ġif Ġ( result Code Ġ=== ĠActivity . RESULT _ OK ) Ġ{ ĊĊĠĠĠĠĠ ĠLog . i (" Activity Result ", Ġ" on Activity ĠRE s ult ") ĊĊĊĠĠĠĠĠ Ġvar Ġimage Ġ= Ġdata ?. getString Extra (" image ") ĊĠĠĠĠĠ Ġvar Ġcolor Ġ= Ġdata ?. getString Extra (" color Code ") ĊĊĠĠĠĠĠ Ġvar Ġmy Color = color ?. replace ("# "," 0 xff ") ĊĊĊĠĠĠĠĠ Ġpending Result !!. success ( my Color ) ĊĠĠĠĠĠ Ġreturn Ġtrue ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġfalse ĊĊĊĠ Ġ} Ċ } Ċ