mirror of https://github.com/tasks/tasks
Add ScreenUnlockReceiver
parent
844a3a0ff8
commit
192351a4b8
@ -0,0 +1,19 @@
|
||||
package org.tasks.receivers
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import org.tasks.widget.AppWidgetManager
|
||||
import timber.log.Timber
|
||||
|
||||
class ScreenUnlockReceiver(private val appWidgetManager: AppWidgetManager) : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
when (intent.action) {
|
||||
Intent.ACTION_USER_PRESENT,
|
||||
Intent.ACTION_SCREEN_ON -> {
|
||||
Timber.d("refreshing widgets: ${intent.action}")
|
||||
appWidgetManager.updateWidgets()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue