pull/32/head
parent
488df49270
commit
1ca339c194
@ -0,0 +1,36 @@ |
||||
package io.legado.app.receiver |
||||
|
||||
import android.content.BroadcastReceiver |
||||
import android.content.Context |
||||
import android.content.Intent |
||||
import android.content.IntentFilter |
||||
|
||||
|
||||
class TimeElectricityReceiver : BroadcastReceiver() { |
||||
|
||||
companion object { |
||||
|
||||
fun register(context: Context): TimeElectricityReceiver { |
||||
val receiver = TimeElectricityReceiver() |
||||
val filter = IntentFilter() |
||||
filter.addAction(Intent.ACTION_TIME_TICK) |
||||
filter.addAction(Intent.ACTION_BATTERY_CHANGED) |
||||
context.registerReceiver(receiver, filter) |
||||
return receiver |
||||
} |
||||
|
||||
} |
||||
|
||||
override fun onReceive(context: Context?, intent: Intent?) { |
||||
intent?.action?.let { |
||||
when (it) { |
||||
Intent.ACTION_TIME_TICK -> { |
||||
|
||||
} |
||||
Intent.ACTION_BATTERY_CHANGED -> { |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue