fun taskStateChanged(@TASK_STATE taskState: Int, tag: Serializable?) { when (taskState) { TASK_STATE_PREPARE -> { iView.layoutLoadingVisibility(isContentEmpty()) iView.layoutContentVisibility(!isContentEmpty()) iView.layoutEmptyVisibility(false) iView.layoutLoadFailedVisibility(false) } TASK_STATE_SUCCESS -> { iView.layoutLoadingVisibility(false) if (isContentEmpty()) { iView.layoutEmptyVisibility(true) } else { iView.layoutContentVisibility(true) } } TASK_STATE_FAILED -> { if (isContentEmpty()) { iView.layoutEmptyVisibility(false) iView.layoutLoadingVisibility(false) iView.layoutLoadFailedVisibility(true) if (tag != null) { iView.setTextLoadFailed(tag.toString()) } } } TASK_STATE_FINISH -> {} } }
According to the task execution state to update the page display state .