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

Fix grade summary empty view (#941)

This commit is contained in:
Mikołaj Pich 2020-09-01 23:57:56 +02:00 committed by GitHub
parent 2ad1d086e0
commit 0f65af8958
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -21,7 +21,7 @@ class GradeSummaryAdapter @Inject constructor() : RecyclerView.Adapter<RecyclerV
var items = emptyList<GradeSummary>()
override fun getItemCount() = items.size + 1
override fun getItemCount() = items.size + if (items.isNotEmpty()) 1 else 0
override fun getItemViewType(position: Int) = when (position) {
0 -> ViewType.HEADER.id

View File

@ -45,16 +45,17 @@ class GradeSummaryPresenter @Inject constructor(
Status.LOADING -> Timber.i("Loading grade summary started")
Status.SUCCESS -> {
Timber.i("Loading grade summary result: Success")
val items = createGradeSummaryItems(it.data!!)
view?.run {
showEmpty(it.data!!.isEmpty())
showContent(it.data.isNotEmpty())
showEmpty(items.isEmpty())
showContent(items.isNotEmpty())
showErrorView(false)
updateData(createGradeSummaryItems(it.data))
updateData(items)
}
analytics.logEvent(
"load_data",
"type" to "grade_summary",
"items" to it.data!!.size
"items" to it.data.size
)
}
Status.ERROR -> {