[dev_arch_opt_3.0] 优化TextView频繁调用setText导致的频繁绘制问题; 优化状态栏上工控机相关状态的处理逻辑

This commit is contained in:
renwj
2023-03-14 16:02:27 +08:00
parent 7e3abc88e0
commit 33a2f2dfe4
8 changed files with 112 additions and 53 deletions

View File

@@ -39,16 +39,18 @@ val <T: View> T.lifecycleOwner: LifecycleOwner
init {
if (ViewCompat.isAttachedToWindow(this@lifecycleOwner)) {
lifecycle.let {
if (it.currentState.isAtLeast(Lifecycle.State.INITIALIZED)) {
it.currentState = Lifecycle.State.CREATED
}
post {
if (it.currentState.isAtLeast(Lifecycle.State.INITIALIZED)) {
it.currentState = Lifecycle.State.CREATED
}
if (it.currentState.isAtLeast(Lifecycle.State.CREATED)) {
it.currentState = Lifecycle.State.STARTED
}
if (it.currentState.isAtLeast(Lifecycle.State.CREATED)) {
it.currentState = Lifecycle.State.STARTED
}
if (it.currentState.isAtLeast(Lifecycle.State.STARTED)) {
it.currentState = Lifecycle.State.RESUMED
if (it.currentState.isAtLeast(Lifecycle.State.STARTED)) {
it.currentState = Lifecycle.State.RESUMED
}
}
}
}