@@ -7,12 +7,13 @@ import android.os.Bundle
7
7
import android.support.annotation.Keep
8
8
import android.view.View
9
9
import com.blankj.common.CommonTitleActivity
10
- import com.blankj.utilcode.pkg.R
11
10
import com.blankj.utilcode.util.BusUtils
11
+ import com.blankj.utilcode.util.LogUtils
12
12
import com.blankj.utilcode.util.Utils
13
13
import kotlinx.android.synthetic.main.activity_bus.*
14
14
import kotlin.random.Random
15
15
16
+
16
17
/* *
17
18
* ```
18
19
* author: Blankj
@@ -54,6 +55,11 @@ class BusActivity : CommonTitleActivity() {
54
55
})
55
56
}
56
57
58
+ @BusUtils.Bus (tag = " _PusNotifyData" , sticky = true , threadMode = BusUtils .ThreadMode .MAIN )
59
+ fun onPusNotifyData (pusNotifyData : PusNotifyData ) {
60
+ LogUtils .e(" haha" )
61
+ }
62
+
57
63
companion object {
58
64
const val TAG_BASIC_TYPE = " tag_basic_type"
59
65
const val TAG_BUS = " tag_bus"
@@ -67,13 +73,13 @@ class BusActivity : CommonTitleActivity() {
67
73
}
68
74
69
75
override fun bindTitle (): CharSequence {
70
- return getString(R .string.demo_bus)
76
+ return getString(com.blankj.utilcode.pkg. R .string.demo_bus)
71
77
}
72
78
73
79
override fun initData (bundle : Bundle ? ) {}
74
80
75
81
override fun bindLayout (): Int {
76
- return R .layout.activity_bus
82
+ return com.blankj.utilcode.pkg. R .layout.activity_bus
77
83
}
78
84
79
85
override fun initView (savedInstanceState : Bundle ? , contentView : View ? ) {
@@ -95,33 +101,33 @@ class BusActivity : CommonTitleActivity() {
95
101
96
102
override fun onDebouncingClick (view : View ) {
97
103
when (view.id) {
98
- R .id.busRegister -> {
104
+ com.blankj.utilcode.pkg. R .id.busRegister -> {
99
105
BusUtils .register(this )
100
106
}
101
- R .id.busUnregister -> {
107
+ com.blankj.utilcode.pkg. R .id.busUnregister -> {
102
108
BusUtils .unregister(this )
103
109
busAboutTv.text = " "
104
110
}
105
- R .id.busPost -> {
111
+ com.blankj.utilcode.pkg. R .id.busPost -> {
106
112
BusUtils .post(TAG_BUS , TAG_BUS )
107
113
}
108
- R .id.busPostBasicType -> {
114
+ com.blankj.utilcode.pkg. R .id.busPostBasicType -> {
109
115
BusUtils .post(TAG_BASIC_TYPE , Random (System .currentTimeMillis()).nextInt())
110
116
}
111
- R .id.busPostSticky -> {
117
+ com.blankj.utilcode.pkg. R .id.busPostSticky -> {
112
118
BusUtils .postSticky(TAG_STICKY_BUS , object : Callback {
113
119
override fun call (): String {
114
120
return TAG_STICKY_BUS
115
121
}
116
122
})
117
123
}
118
- R .id.busPost2IoThread -> {
124
+ com.blankj.utilcode.pkg. R .id.busPost2IoThread -> {
119
125
BusUtils .post(TAG_IO )
120
126
}
121
- R .id.busRemoveSticky -> {
127
+ com.blankj.utilcode.pkg. R .id.busRemoveSticky -> {
122
128
BusUtils .removeSticky(TAG_STICKY_BUS )
123
129
}
124
- R .id.busStartCompare -> {
130
+ com.blankj.utilcode.pkg. R .id.busStartCompare -> {
125
131
BusCompareActivity .start(this )
126
132
}
127
133
}
0 commit comments