From d09bfc15a6a9ca4ff3bb6e6d025e06fbf6065684 Mon Sep 17 00:00:00 2001 From: dkyuuum Date: Fri, 16 Feb 2024 14:23:21 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=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=EB=B9=88=20=ED=95=99?= =?UTF-8?q?=EA=B8=B0=20=ED=81=B4=EB=A6=AD=20=EC=8B=9C=20=EB=AA=A8=EB=8B=AC?= =?UTF-8?q?=EC=B0=BD=20=EA=B5=AC=ED=98=84=20=EC=A4=91...=20#21?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/ui/gradInfo/adapter/AverageRVAdapter.kt | 5 +++-- .../project/ui/gradInfo/viewmodel/GradeViewModel.kt | 8 ++++++++ app/src/main/res/layout/fragment_grad_condition.xml | 13 ++++--------- 3 files changed, 15 insertions(+), 11 deletions(-) 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 5fe96ce..b2bbc9c 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 @@ -46,7 +46,7 @@ class AverageRVAdapter(private val viewModel: GradeViewModel) : val grade = if (position % 2 == 0) position / 2 + 1 else (position + 1) / 2 // totalAverageGrade += Integer.parseInt(gradesTotalDto.averageGrade) - binding.tvSemesterContent1.text = "$grade - $semester" + binding.tvSemesterContent1.text = "$grade - $semester" binding.tvAverageGradeContent1.text = gradesTotalDto.averageGrade // viewModel.onSetTotalAverageGrade(totalAverageGrade, position+1) } @@ -72,6 +72,7 @@ class AverageRVAdapter(private val viewModel: GradeViewModel) : fun setData(data: List) { dataList.clear() dataList.addAll(data) +// viewModel.onSetNullCheckGrade(true) repeat(8 - dataList.size) { dataList.add( GradesTotalDto( @@ -82,8 +83,8 @@ class AverageRVAdapter(private val viewModel: GradeViewModel) : "0" ) ) + viewModel.onSetNullCheckGrade(false) } - notifyDataSetChanged() } diff --git a/app/src/main/java/umc/com/mobile/project/ui/gradInfo/viewmodel/GradeViewModel.kt b/app/src/main/java/umc/com/mobile/project/ui/gradInfo/viewmodel/GradeViewModel.kt index 44ff1dc..b016784 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/gradInfo/viewmodel/GradeViewModel.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/gradInfo/viewmodel/GradeViewModel.kt @@ -45,6 +45,10 @@ class GradeViewModel : ViewModel() { val totalAverage: LiveData get() = _totalAverage + private val _isNullCheckGrade: MutableLiveData = MutableLiveData() + val isNullCheckGrade: LiveData + get() = _isNullCheckGrade + val selectedSemesterGradeAndGrades: MediatorLiveData?>> = MediatorLiveData() init { @@ -138,4 +142,8 @@ class GradeViewModel : ViewModel() { fun onSetTotalAverageGrade(totalAverageGrade: Double, totalNumber: Int) { _totalAverage.postValue((totalAverageGrade/totalNumber)) } + + fun onSetNullCheckGrade(flag: Boolean) { + _isNullCheckGrade.postValue(flag) + } } \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_grad_condition.xml b/app/src/main/res/layout/fragment_grad_condition.xml index 70e33d3..058ffd1 100644 --- a/app/src/main/res/layout/fragment_grad_condition.xml +++ b/app/src/main/res/layout/fragment_grad_condition.xml @@ -56,7 +56,7 @@ @@ -255,7 +253,6 @@ android:layout_marginTop="56dp" android:layout_marginEnd="27dp" android:layout_marginBottom="56dp" - android:text="트랙2 이름" android:textColor="@color/skyBlue" />