Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b10f73a6 authored by tibbi's avatar tibbi
Browse files

use the context instead of activity at some context extensions

parent 86286685
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -12,12 +12,12 @@ import com.simplemobiletools.flashlight.helpers.IS_ENABLED
import com.simplemobiletools.flashlight.helpers.MyWidgetProvider
import com.simplemobiletools.flashlight.helpers.TOGGLE_WIDGET_UI

val Context.config: Config get() = Config.newInstance(this)
val Context.config: Config get() = Config.newInstance(applicationContext)

fun Context.updateWidgets(isEnabled: Boolean) {
    val widgetsCnt = AppWidgetManager.getInstance(this).getAppWidgetIds(ComponentName(this, MyWidgetProvider::class.java))
    val widgetsCnt = AppWidgetManager.getInstance(applicationContext).getAppWidgetIds(ComponentName(applicationContext, MyWidgetProvider::class.java))
    if (widgetsCnt.isNotEmpty()) {
        Intent(this, MyWidgetProvider::class.java).apply {
        Intent(applicationContext, MyWidgetProvider::class.java).apply {
            action = TOGGLE_WIDGET_UI
            putExtra(IS_ENABLED, isEnabled)
            sendBroadcast(this)