package Ġcom . ro cb il low . core . u ikit . toast Ċ Ċ import Ġandroid . os . Build Ċ import Ġandroid . view . Gravity Ċ import Ġandroid . view . View Ċ import Ġandroid . view . WindowManager Ċ import Ġcom . ro cb il low . core . extension . are Notifications Enabled Ċ import Ġcom . ro cb il low . core . extension . can Draw Overlay s Ċ Ċ interface ĠToast Strategy Factory Ġ{ ĊĠ Ġfun Ġcreate (): ĠToast Strategy Ċ } Ċ Ċ internal Ġclass ĠToast Strategy Factory Impl ( private Ġval Ġbuilder : ĠToast Manager . Builder ) Ġ: ĊĠ ĠToast Strategy Factory Ġ{ ĊĊĠ Ġ@ Suppress (" DE PREC ATION ") ĊĠ Ġoverride Ġfun Ġcreate (): ĠToast Strategy Ġ{ ĊĠĠĠ Ġif Ġ( are Notifications Enabled () Ġand Ġis Custom System Toast Enabled ( builder )) Ġ{ ĊĠĠĠĠĠ Ġreturn ĠSystem Toast Strategy ( builder ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġif Ġ( Build . VERSION . SDK _ INT Ġ< ĠBuild . VERSION _ CODES . N _ MR 1 ) Ġ{ ĊĠĠĠĠĠ Ġreturn ĠWindow Manager Toast Strategy ( builder , ĠWindow Manager . LayoutParams . TYPE _ TO AST ) ĊĠĠĠ Ġ} Ġelse Ġif Ġ( can Draw Overlay s ()) Ġ{ ĊĠĠĠĠĠ Ġreturn Ġif Ġ( Build . VERSION . SDK _ INT Ġ>= ĠBuild . VERSION _ CODES . O ) Ġ{ ĊĠĠĠĠĠĠĠ ĠWindow Manager Toast Strategy ( builder , ĠWindow Manager . LayoutParams . TYPE _ APPLICATION _ OVER LAY ) ĊĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠ ĠWindow Manager Toast Strategy ( builder , ĠWindow Manager . LayoutParams . TYPE _ PHONE ) ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn ĠActivity Toast Strategy ( builder ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġis Custom System Toast Enabled ( builder : ĠToast Manager . Builder ): ĠBoolean Ġ{ ĊĠĠĠ Ġval Ġview : ĠView ? Ġ= Ġbuilder . view ĊĠĠĠ Ġval Ġgravity Ġ= Ġbuilder . gravity ĊĠĠĠ Ġval Ġis Not Custom Toast Ġ= Ġ( view Ġ== Ġnull ) Ġand Ġ( gravity Ġ== ĠGr avity . NO _ GR AV ITY ) ĊĠĠĠ Ġreturn Ġis Not Custom Toast Ġor Ġ( Build . VERSION . SDK _ INT Ġ< ĠBuild . VERSION _ CODES . R ) ĊĠ Ġ} Ċ }