@@ -52,22 +52,26 @@ class GankApplication : Application() {
5252 }
5353}
5454
55- fun Context.activityRouter () = (this .applicationContext as GankApplication ).activityRouter
56- fun Context.broadcastRouter () = (this .applicationContext as GankApplication ).broadcastRouter
57- fun Context.gankIoService () = (this .applicationContext as GankApplication ).gankIoService
55+ val Context .activityRouter get () = (this .applicationContext as GankApplication ).activityRouter
56+ val Context .broadcastRouter get () = (this .applicationContext as GankApplication ).broadcastRouter
57+ val Context .gankIoService get () = (this .applicationContext as GankApplication ).gankIoService
5858
5959fun Context.registerLocalReceiver (
60- receiver : (Context ? , Intent ? ) -> Unit , intentFilter : IntentFilter ) {
61-
60+ receiver : BroadcastReceiver .(Context ? , Intent ? ) -> Unit ,
61+ intentFilter : IntentFilter
62+ ) {
6263 LocalBroadcastManager .getInstance(this )
6364 .registerReceiver(object : BroadcastReceiver () {
6465 override fun onReceive (context : Context ? , intent : Intent ? ) {
65- receiver.invoke(context, intent)
66+ receiver.invoke(this , context, intent)
6667 }
6768 }, intentFilter)
6869}
6970
70- fun Context.registerLocalReceiver (receiver : (Context ? , Intent ? ) -> Unit , vararg actions : String ) {
71+ fun Context.registerLocalReceiver (
72+ receiver : BroadcastReceiver .(Context ? , Intent ? ) -> Unit ,
73+ vararg actions : String
74+ ) {
7175 val intentFilter = IntentFilter ()
7276 actions.forEach {
7377 intentFilter.addAction(it)
0 commit comments