package Ġio . ash dav ies . rx . rx tasks Ċ Ċ import Ġandroid . app . Activity Ċ import Ġcom . google . android . gms . tasks . Task Ċ import Ġio . reactivex . rx java 3 . core . Single Ċ import Ġio . reactivex . rx java 3 . core . Single Emitter Ċ import Ġjava . util . concurrent . Executor Ċ Ċ fun Ġ< T Ġ: ĠAny > ĠTask < T >. to Single (): ĠSingle < T > Ġ= Ġas Single Ġ{ Ġadd On Complete Listener ( Single Emitter Listener ( it )) Ġ} Ċ fun Ġ< T Ġ: ĠAny > ĠTask < T >. to Single ( executor : ĠExecutor ): ĠSingle < T > Ġ= Ġas Single Ġ{ Ġadd On Complete Listener ( executor , ĠSingle Emitter Listener ( it )) Ġ} Ċ fun Ġ< T Ġ: ĠAny > ĠTask < T >. to Single ( activity : ĠActivity ): ĠSingle < T > Ġ= Ġas Single Ġ{ Ġadd On Complete Listener ( activity , ĠSingle Emitter Listener ( it )) Ġ} Ċ Ċ private Ġfun Ġ< T Ġ: ĠAny > ĠTask < T >. as Single ( block : Ġ( Single Emitter < T >) Ġ-> ĠUnit ): ĠSingle < T > Ġ= Ġif Ġ( is Complete ) ĠSingle . from Callable (:: as Required ) Ġelse ĠSingle . create ( block ) Ċ