package Ġcom . p avel rek un . rek ado . services . utils Ċ Ċ import Ġandroid . app . Activity Manager Ċ import Ġandroid . graphics . Bitmap Factory Ċ import Ġandroid . util . Typed Value Ċ import Ġandroidx . core . content . Context Compat Ċ import Ġandroidx . preference . Preference Manager Ċ import Ġcom . p avel rek un . r ang . data . Night Mode Ċ import Ġcom . p avel rek un . r ang . data . Primary Color Ċ import Ġcom . p avel rek un . r ang . services . R ang Ċ import Ġcom . p avel rek un . rek ado . R Ċ import Ġcom . p avel rek un . rek ado . Re k ado Application Ċ import Ġcom . p avel rek un . rek ado . base . Base Activity ĊĊ Ċ object ĠDesign Utils Ġ{ ĊĊĠĠĠ Ġfun Ġset Night Theme () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpreferences Ġ= ĠPreference Manager . getDefault SharedPreferences ( Re k ado Application . instance . application Context ) ĊĠĠĠĠĠĠĠ Ġval Ġnight Mode Ġ= Ġpreferences . getString (" appearance _ night _ mode ", Ġ" enabled ") ĊĊĠĠĠĠĠĠĠ Ġwhen Ġ( night Mode ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" disabled " Ġ-> ĠR ang . config ( Re k ado Application . instance . application Context ). night Mode ( Night Mode . DAY ). o led Mode ( false ). apply () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" enabled " Ġ-> ĠR ang . config ( Re k ado Application . instance . application Context ). night Mode ( Night Mode . N IGHT ). o led Mode ( false ). apply () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" amo led " Ġ-> ĠR ang . config ( Re k ado Application . instance . application Context ). primary Color ( Primary Color . CAST RO _ O LED ). night Mode ( Night Mode . N IGHT ). o led Mode ( true ). apply () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġapply Color To Task Description ( activity : ĠBase Activity ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġbitmap Ġ= ĠBitmap Factory . decode Resource ( activity . resources , ĠR . mip map . ic _ launcher ) ĊĠĠĠĠĠĠĠ Ġval Ġtask Description Ġ= ĠActivity Manager . Task Description ( activity . getString ( R . string . app _ name ), Ġbitmap , ĠContext Compat . getColor ( activity , ĠR . color . color Background Primary )) ĊĠĠĠĠĠĠĠ Ġactivity . set Task Description ( task Description ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġconvert DP to PX ( dp : ĠInt ): ĠInt Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġresources Ġ= ĠRe k ado Application . instance . application Context . resources ĊĠĠĠĠĠĠĠ Ġreturn ĠTyped Value . apply Dimension ( Typed Value . COMPLEX _ UNIT _ DIP , Ġdp . toFloat (), Ġresources . display Metrics ). toInt () ĊĠĠĠ Ġ} Ċ Ċ }