Fix smart background for real this time, fix issues with theme not changing

This commit is contained in:
Jobobby04
2020-10-29 00:37:07 -04:00
parent 4881571293
commit 406b5a89c8
6 changed files with 26 additions and 35 deletions
@@ -5,20 +5,22 @@ import android.content.ClipboardManager
import android.content.Context
import android.content.res.Configuration
import android.net.wifi.WifiManager
import androidx.core.content.getSystemService
/**
* Property to get the wifi manager from the context.
*/
val Context.wifiManager: WifiManager
get() = applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager
get() = applicationContext.getSystemService()!!
val Context.clipboardManager: ClipboardManager
get() = applicationContext.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
get() = applicationContext.getSystemService()!!
val Context.jobScheduler: JobScheduler
get() = applicationContext.getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler
get() = applicationContext.getSystemService()!!
fun Context.isInNightMode(): Boolean {
val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
return currentNightMode == Configuration.UI_MODE_NIGHT_YES
}
val Context.isInNightMode: Boolean
get() {
val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
return currentNightMode == Configuration.UI_MODE_NIGHT_YES
}