forked from github/wulkanowy-mirror
Fix grade summary empty view (#941)
This commit is contained in:
parent
2ad1d086e0
commit
0f65af8958
@ -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
|
||||
|
@ -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 -> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user