From f737018548fad22c8d25aaeb887103cbc6f92fca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Sun, 24 May 2020 19:33:04 +0200 Subject: [PATCH] Add debug statements to get/update methods in grade details adapter (#827) --- .../ui/modules/grade/GradePresenter.kt | 1 + .../grade/details/GradeDetailsAdapter.kt | 19 +++++++++++++++++-- .../grade/details/GradeDetailsPresenter.kt | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradePresenter.kt index 78885ebd..ec66e2bd 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradePresenter.kt @@ -133,6 +133,7 @@ class GradePresenter @Inject constructor( } private fun loadChild(index: Int, forceRefresh: Boolean = false) { + Timber.d("Load grade tab child. Selected semester: $selectedIndex, semesters: ${semesters.joinToString { it.semesterName.toString() }}") semesters.first { it.semesterName == selectedIndex }.semesterId.also { if (forceRefresh || loadedSemesterId[index] != it) { Timber.i("Load grade child view index: $index") diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsAdapter.kt index 7adab547..d5e05f3b 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsAdapter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsAdapter.kt @@ -14,6 +14,7 @@ import io.github.wulkanowy.databinding.ItemGradeDetailsBinding import io.github.wulkanowy.ui.base.BaseExpandableAdapter import io.github.wulkanowy.utils.getBackgroundColor import io.github.wulkanowy.utils.toFormattedString +import timber.log.Timber import javax.inject.Inject class GradeDetailsAdapter @Inject constructor() : BaseExpandableAdapter() { @@ -38,12 +39,26 @@ class GradeDetailsAdapter @Inject constructor() : BaseExpandableAdapter 1) { + Timber.e("Header with subject $subject found ${candidates.size} times! Items: $candidates, expanded: $expandedPosition") + } + + return candidates.first() } fun updateHeaderItem(item: GradeDetailsItem) { @@ -92,7 +107,7 @@ class GradeDetailsAdapter @Inject constructor() : BaseExpandableAdapter bindItemViewHolder( binding = holder.binding, grade = items[position].value as Grade, - position = position + position = holder.adapterPosition ) } } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt index 2212bfd6..b674bf77 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/details/GradeDetailsPresenter.kt @@ -43,7 +43,7 @@ class GradeDetailsPresenter @Inject constructor( } fun onGradeItemSelected(grade: Grade, position: Int) { - Timber.i("Select grade item ${grade.id}") + Timber.i("Select grade item ${grade.id}, position: $position") view?.apply { showGradeDialog(grade, preferencesRepository.gradeColorTheme) if (!grade.isRead) {