From 6c775e210d42594ba77e3d5b9dca41f62ef93b5f Mon Sep 17 00:00:00 2001 From: dkyuuum Date: Sun, 18 Feb 2024 15:38:35 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=A1=B8=EC=97=85=EC=9A=94=EA=B1=B4/?= =?UTF-8?q?=EC=84=B1=EC=A0=81=20=EC=82=AC=ED=95=AD=20=ED=83=AD=20=EB=AA=A8?= =?UTF-8?q?=EB=8B=AC=20=EB=B2=84=EA=B7=B8=20=EC=9E=AC=EC=88=98=EC=A0=95=20?= =?UTF-8?q?#21?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/ui/gradInfo/GradeFragment.kt | 3 ++- .../ui/gradInfo/adapter/AverageRVAdapter.kt | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/umc/com/mobile/project/ui/gradInfo/GradeFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/gradInfo/GradeFragment.kt index bfaa463..e220534 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/gradInfo/GradeFragment.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/gradInfo/GradeFragment.kt @@ -103,6 +103,7 @@ class GradeFragment : Fragment() { Handler().postDelayed({ alertDialog.dismiss() - }, 2000) + viewModel.onSetNullCheckGrade(false) + }, 1000) } } diff --git a/app/src/main/java/umc/com/mobile/project/ui/gradInfo/adapter/AverageRVAdapter.kt b/app/src/main/java/umc/com/mobile/project/ui/gradInfo/adapter/AverageRVAdapter.kt index 0794d8f..59f39ee 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/gradInfo/adapter/AverageRVAdapter.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/gradInfo/adapter/AverageRVAdapter.kt @@ -21,20 +21,24 @@ class AverageRVAdapter(private val viewModel: GradeViewModel) : binding.root.setOnClickListener { val position = adapterPosition if (position != RecyclerView.NO_POSITION) { - val semester = "${position + 1} 학기" - val semesterGrade = "${position + 1} 학기 성적" - viewModel.onSemesterItemClick(semester) - viewModel.onSemesterGradeItemClick(semesterGrade) - - if (dataList[position].averageGrade == "0.0") { - viewModel.onSetNullCheckGrade(true) - } else { - viewModel.onSetNullCheckGrade(false) - } + handleItemClick(position) } } } + private fun handleItemClick(position: Int) { + val semester = "${position + 1} 학기" + val semesterGrade = "${position + 1} 학기 성적" + viewModel.onSemesterItemClick(semester) + viewModel.onSemesterGradeItemClick(semesterGrade) + + if (dataList[position].averageGrade == "0.0") { + viewModel.onSetNullCheckGrade(true) + } else { + viewModel.onSetNullCheckGrade(false) + } + } + fun bind(gradesTotalDto: GradesTotalDto, position: Int) { val semester = if (position % 2 == 0) { 1 @@ -85,5 +89,4 @@ class AverageRVAdapter(private val viewModel: GradeViewModel) : } - }