Skip to content

Commit

Permalink
Feat: 졸업요건/성적 사항 빈 학기 클릭 시 모달창 구현 중... #21
Browse files Browse the repository at this point in the history
  • Loading branch information
dkyuuum committed Feb 16, 2024
1 parent 6b505a7 commit d09bfc1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -72,6 +72,7 @@ class AverageRVAdapter(private val viewModel: GradeViewModel) :
fun setData(data: List<GradesTotalDto>) {
dataList.clear()
dataList.addAll(data)
// viewModel.onSetNullCheckGrade(true)
repeat(8 - dataList.size) {
dataList.add(
GradesTotalDto(
Expand All @@ -82,8 +83,8 @@ class AverageRVAdapter(private val viewModel: GradeViewModel) :
"0"
)
)
viewModel.onSetNullCheckGrade(false)
}

notifyDataSetChanged()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ class GradeViewModel : ViewModel() {
val totalAverage: LiveData<Double>
get() = _totalAverage

private val _isNullCheckGrade: MutableLiveData<Boolean> = MutableLiveData()
val isNullCheckGrade: LiveData<Boolean>
get() = _isNullCheckGrade

val selectedSemesterGradeAndGrades: MediatorLiveData<Pair<String?, Map<String, GradesTotalDto>?>> = MediatorLiveData()

init {
Expand Down Expand Up @@ -138,4 +142,8 @@ class GradeViewModel : ViewModel() {
fun onSetTotalAverageGrade(totalAverageGrade: Double, totalNumber: Int) {
_totalAverage.postValue((totalAverageGrade/totalNumber))
}

fun onSetNullCheckGrade(flag: Boolean) {
_isNullCheckGrade.postValue(flag)
}
}
13 changes: 4 additions & 9 deletions app/src/main/res/layout/fragment_grad_condition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_register_content"
style="@style/MediumFont.15"
style="@style/MediumFont.13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
Expand All @@ -68,7 +68,7 @@

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_credit_content"
style="@style/MediumFont.15"
style="@style/MediumFont.13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="26dp"
Expand Down Expand Up @@ -100,7 +100,7 @@

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_point_content"
style="@style/MediumFont.15"
style="@style/MediumFont.13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="26dp"
Expand All @@ -123,7 +123,7 @@

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_score_content"
style="@style/MediumFont.15"
style="@style/MediumFont.13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="26dp"
Expand Down Expand Up @@ -217,7 +217,6 @@
android:layout_marginTop="56dp"
android:layout_marginEnd="27dp"
android:layout_marginBottom="56dp"
android:text="트랙1 이름"
android:textColor="@color/skyBlue" />

<androidx.appcompat.widget.AppCompatTextView
Expand All @@ -229,7 +228,6 @@
android:layout_marginTop="17dp"
android:layout_marginEnd="20dp"
android:lineSpacingExtra="5dp"
android:text="트랙1 내용"
android:textColor="@color/black"
app:layout_gravity="fill" />

Expand All @@ -255,7 +253,6 @@
android:layout_marginTop="56dp"
android:layout_marginEnd="27dp"
android:layout_marginBottom="56dp"
android:text="트랙2 이름"
android:textColor="@color/skyBlue" />

<androidx.appcompat.widget.AppCompatTextView
Expand All @@ -268,8 +265,6 @@
android:layout_marginEnd="20dp"
android:ellipsize="none"
android:lineSpacingExtra="5dp"
android:maxLines="5"
android:text="트랙2 내용"
android:textColor="@color/black"
app:layout_gravity="fill" />

Expand Down

0 comments on commit d09bfc1

Please sign in to comment.