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>()
|
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) {
|
override fun getItemViewType(position: Int) = when (position) {
|
||||||
0 -> ViewType.HEADER.id
|
0 -> ViewType.HEADER.id
|
||||||
|
@ -45,16 +45,17 @@ class GradeSummaryPresenter @Inject constructor(
|
|||||||
Status.LOADING -> Timber.i("Loading grade summary started")
|
Status.LOADING -> Timber.i("Loading grade summary started")
|
||||||
Status.SUCCESS -> {
|
Status.SUCCESS -> {
|
||||||
Timber.i("Loading grade summary result: Success")
|
Timber.i("Loading grade summary result: Success")
|
||||||
|
val items = createGradeSummaryItems(it.data!!)
|
||||||
view?.run {
|
view?.run {
|
||||||
showEmpty(it.data!!.isEmpty())
|
showEmpty(items.isEmpty())
|
||||||
showContent(it.data.isNotEmpty())
|
showContent(items.isNotEmpty())
|
||||||
showErrorView(false)
|
showErrorView(false)
|
||||||
updateData(createGradeSummaryItems(it.data))
|
updateData(items)
|
||||||
}
|
}
|
||||||
analytics.logEvent(
|
analytics.logEvent(
|
||||||
"load_data",
|
"load_data",
|
||||||
"type" to "grade_summary",
|
"type" to "grade_summary",
|
||||||
"items" to it.data!!.size
|
"items" to it.data.size
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Status.ERROR -> {
|
Status.ERROR -> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user