mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-19 02:56:45 -06:00
Fix screens loading state (#589)
This commit is contained in:
parent
2f18d42c86
commit
bde810e031
@ -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)
|
||||
})
|
||||
}
|
||||
|
@ -229,7 +229,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/teacher_no_items"
|
||||
android:text="@string/school_no_info"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
@ -227,6 +227,7 @@
|
||||
|
||||
<!--School-->
|
||||
<string name="school_title">Szkoła</string>
|
||||
<string name="school_no_info">Brak informacji o szkole</string>
|
||||
<string name="school_name">Nazwa szkoły</string>
|
||||
<string name="school_address">Adres szkoły</string>
|
||||
<string name="school_telephone">Telefon</string>
|
||||
|
@ -213,6 +213,7 @@
|
||||
|
||||
<!--School-->
|
||||
<string name="school_title">School</string>
|
||||
<string name="school_no_info">No info about school</string>
|
||||
<string name="school_name">School name</string>
|
||||
<string name="school_address">School address</string>
|
||||
<string name="school_telephone">Telephone</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user