1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2024-09-20 04:39:09 -05:00

Fix screens loading state (#589)

This commit is contained in:
Mikołaj Pich 2019-11-17 01:07:43 +01:00 committed by GitHub
parent 2f18d42c86
commit bde810e031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 19 additions and 3 deletions

View File

@ -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 {

View File

@ -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)
})
}

View File

@ -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
}

View File

@ -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())
}
}))
}

View File

@ -10,6 +10,8 @@ interface SchoolView : BaseView, SchoolAndTeachersChildView {
fun updateData(data: School)
fun isViewEmpty(): Boolean
fun showEmpty(show: Boolean)
fun showProgress(show: Boolean)

View File

@ -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)
})
}

View File

@ -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>

View File

@ -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>

View File

@ -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>