package Ġcom . dsc vit . android . dev fest 1 8 . utils Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . view . LayoutInflater Ċ import Ġandroid . view . View Ċ import Ġandroid . view . ViewGroup Ċ import Ġandroid . widget . TextView Ċ import Ġcom . dsc vit . android . dev fest 1 8 . R Ċ import Ġorg . jetbrains . ank o . background Resource Ċ import Ġorg . jetbrains . ank o . textColor Ċ Ċ fun ĠViewGroup . inflate ( layout Res : ĠInt ): ĠView Ġ{ ĊĠĠĠ Ġreturn ĠLayoutInflater . from ( context ). inflate ( layout Res , Ġthis , Ġfalse ) Ċ } Ċ Ċ fun ĠString . get Res Id ( context : ĠContext ) Ġ= Ġcontext . resources . getIdentifier ( ĊĠĠĠĠĠĠĠ Ġthis , ĊĠĠĠĠĠĠĠ Ġ" drawable ", ĊĠĠĠĠĠĠĠ Ġcontext . packageName Ċ ) Ċ Ċ fun ĠString . get Colour Id ( context : ĠContext ) Ġ= Ġwhen ( this ) Ġ{ ĊĠĠĠ Ġ" yellow " Ġ-> Ġcontext . resources . getColor ( R . color . yellow ) ĊĠĠĠ Ġ" teal " Ġ-> Ġcontext . resources . getColor ( R . color . teal ) ĊĠĠĠ Ġ" indigo " Ġ-> Ġcontext . resources . getColor ( R . color . indigo ) ĊĠĠĠ Ġ" light _ blue " Ġ-> Ġcontext . resources . getColor ( R . color . light _ blue ) ĊĠĠĠ Ġ" orange " Ġ-> Ġcontext . resources . getColor ( R . color . orange ) ĊĠĠĠ Ġ" yellow _ 1 0 0 " Ġ-> Ġcontext . resources . getColor ( R . color . yellow _ 1 0 0 ) ĊĠĠĠ Ġ" green _ 1 0 0 " Ġ-> Ġcontext . resources . getColor ( R . color . green _ 1 0 0 ) ĊĠĠĠ Ġ" orange _ 1 0 0 " Ġ-> Ġcontext . resources . getColor ( R . color . orange _ 1 0 0 ) ĊĠĠĠ Ġ" blue _ 1 0 0 " Ġ-> Ġcontext . resources . getColor ( R . color . blue _ 1 0 0 ) ĊĠĠĠ Ġ" yellow _ 2 0 0 " Ġ-> Ġcontext . resources . getColor ( R . color . yellow _ 2 0 0 ) ĊĠĠĠ Ġ" green _ 2 0 0 " Ġ-> Ġcontext . resources . getColor ( R . color . green _ 2 0 0 ) ĊĠĠĠ Ġ" orange _ 2 0 0 " Ġ-> Ġcontext . resources . getColor ( R . color . orange _ 2 0 0 ) ĊĠĠĠ Ġ" blue _ 2 0 0 " Ġ-> Ġcontext . resources . getColor ( R . color . blue _ 2 0 0 ) ĊĠĠĠ Ġ" yellow _ 8 0 0 " Ġ-> Ġcontext . resources . getColor ( R . color . yellow _ 8 0 0 ) ĊĠĠĠ Ġ" green _ 8 0 0 " Ġ-> Ġcontext . resources . getColor ( R . color . green _ 8 0 0 ) ĊĠĠĠ Ġ" orange _ 8 0 0 " Ġ-> Ġcontext . resources . getColor ( R . color . orange _ 8 0 0 ) ĊĠĠĠ Ġ" blue _ 8 0 0 " Ġ-> Ġcontext . resources . getColor ( R . color . blue _ 8 0 0 ) ĊĠĠĠ Ġelse Ġ-> Ġcontext . resources . getColor ( R . color . indigo _ dark ) Ċ } Ċ Ċ fun ĠView . show () Ġ{ ĊĠĠĠ Ġthis . visibility Ġ= ĠView . VISIBLE Ċ } Ċ Ċ fun ĠView . hide () Ġ{ ĊĠĠĠ Ġthis . visibility Ġ= ĠView . GONE Ċ } Ċ Ċ fun ĠTextView . set Quiz Option Selected () Ġ{ ĊĠĠĠ Ġthis . setTextColor ( resources . getColor ( R . color . dark _ black )) ĊĠĠĠ Ġthis . background Resource Ġ= ĠR . drawable . bg _ quiz _ option _ selected Ċ } Ċ Ċ fun ĠTextView . reset Quiz Option Selected () Ġ{ ĊĠĠĠ Ġthis . setTextColor ( resources . getColor ( R . color . white )) ĊĠĠĠ Ġthis . background Resource Ġ= ĠR . drawable . bg _ quiz _ option Ċ } Ċ Ċ fun ĠTextView . set Correct Indication () Ġ{ ĊĠĠĠ Ġthis . setTextColor ( resources . getColor ( R . color . dark _ black )) ĊĠĠĠ Ġthis . background Resource Ġ= ĠR . drawable . bg _ quiz _ option _ correct Ċ } Ċ Ċ fun ĠTextView . set Wrong Indication () Ġ{ ĊĠĠĠ Ġthis . setTextColor ( resources . getColor ( R . color . white )) ĊĠĠĠ Ġthis . background Resource Ġ= ĠR . drawable . bg _ quiz _ option _ wrong Ċ }