-
Notifications
You must be signed in to change notification settings - Fork 35
/
LifeCycleActivity.kt
36 lines (29 loc) · 1.04 KB
/
LifeCycleActivity.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package luyao.util.ktx.ui
import android.os.Handler
import kotlinx.android.synthetic.main.activity_lifecycle.*
import luyao.ktx.R
import luyao.util.ktx.MainActivity
import luyao.util.ktx.base.BaseActivity
import luyao.util.ktx.ext.loge
import luyao.util.ktx.ext.toast
import luyao.util.ktx.core.lifecycle.KtxHandler
import luyao.util.ktx.core.lifecycle.KtxManager
/**
* Created by luyao
* on 2019/8/6 9:43
*/
class LifeCycleActivity : BaseActivity() {
override fun getLayoutResId() = R.layout.activity_lifecycle
override fun initView() {
myHandler.sendEmptyMessageDelayed(10, 5 * 1000)
}
override fun initData() {
currentActivityBt.setOnClickListener { KtxManager.currentActivity?.let { toast(it.localClassName) } }
finishMainBt.setOnClickListener { KtxManager.finishActivity(MainActivity::class.java) }
finishAllBt.setOnClickListener { KtxManager.finishAllActivity() }
}
private val myHandler = KtxHandler(this, Handler.Callback {
"receive from handler : ${it.what}".loge()
true
})
}