forked from github/wulkanowy-mirror
Fix screens loading state (#589)
This commit is contained in:
@ -52,6 +52,7 @@ class AttendanceSummaryPresenter @Inject constructor(
|
||||
showContent(false)
|
||||
showProgress(true)
|
||||
enableSwipe(false)
|
||||
showEmpty(false)
|
||||
clearView()
|
||||
}
|
||||
(subjects.singleOrNull { it.name == name }?.realId ?: -1).let {
|
||||
|
@ -55,6 +55,7 @@ class MobileDevicePresenter @Inject constructor(
|
||||
analytics.logEvent("load_devices", "items" to it.size, "force_refresh" to forceRefresh)
|
||||
}) {
|
||||
Timber.i("Loading mobile devices result: An exception occurred")
|
||||
view?.run { showEmpty(isViewEmpty) }
|
||||
errorHandler.dispatch(it)
|
||||
})
|
||||
}
|
||||
|
@ -52,6 +52,11 @@ class SchoolFragment : BaseFragment(), SchoolView, MainView.TitledView, SchoolAn
|
||||
schoolPedagogue.text = data.pedagogue
|
||||
}
|
||||
|
||||
|
||||
override fun isViewEmpty(): Boolean {
|
||||
return schoolName.text.isBlank()
|
||||
}
|
||||
|
||||
override fun showEmpty(show: Boolean) {
|
||||
schoolEmpty.visibility = if (show) View.VISIBLE else View.GONE
|
||||
}
|
||||
|
@ -72,12 +72,16 @@ class SchoolPresenter @Inject constructor(
|
||||
analytics.logEvent("load_school", "force_refresh" to forceRefresh)
|
||||
}, {
|
||||
Timber.i("Loading school result: An exception occurred")
|
||||
view?.run {
|
||||
showContent(!isViewEmpty())
|
||||
showEmpty(isViewEmpty())
|
||||
}
|
||||
errorHandler.dispatch(it)
|
||||
}, {
|
||||
Timber.i("Loading school result: No school info found")
|
||||
view?.run {
|
||||
showContent(false)
|
||||
showEmpty(true)
|
||||
showContent(!isViewEmpty())
|
||||
showEmpty(isViewEmpty())
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ interface SchoolView : BaseView, SchoolAndTeachersChildView {
|
||||
|
||||
fun updateData(data: School)
|
||||
|
||||
fun isViewEmpty(): Boolean
|
||||
|
||||
fun showEmpty(show: Boolean)
|
||||
|
||||
fun showProgress(show: Boolean)
|
||||
|
@ -60,6 +60,7 @@ class TeacherPresenter @Inject constructor(
|
||||
analytics.logEvent("load_teachers", "items" to it.size, "force_refresh" to forceRefresh)
|
||||
}) {
|
||||
Timber.i("Loading teachers result: An exception occurred")
|
||||
view?.run { showEmpty(isViewEmpty) }
|
||||
errorHandler.dispatch(it)
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user