Skip to content

Commit

Permalink
Merge pull request #107 from FOR-GRAD/21-졸업-요건-ui
Browse files Browse the repository at this point in the history
21 졸업 요건 UI
  • Loading branch information
dkyuuum authored Feb 20, 2024
2 parents 430b14b + aa806f0 commit 3f876e1
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ class CompletionStateFragment : Fragment() {
_binding = FragmentCompletionStateBinding.inflate(inflater, container, false)
viewModel.getCompletionInfo() // 사용자 개인별 이수 현황 조회 api

viewModel.completionInfo.observe(viewLifecycleOwner, Observer {
viewModel.completionInfo.observe(viewLifecycleOwner, Observer { it ->
val completionDtoMap: List<Map<String, List<String>>>? = it?.result?.completionDtoMap

val basicKeyList = listOf("필수교양(기초)", "필수(기초)교양", "필수교양")
/**
* 필수 교양 (기초)
*/
completionDtoMap?.firstOrNull { it.containsKey("필수교양(기초)") }?.get("필수교양(기초)")?.let { requiredBasicCourses1 ->
/* completionDtoMap?.firstOrNull { it.containsKey("필수교양(기초)") }?.get("필수교양(기초)")?.let { requiredBasicCourses1 ->
binding.tvBasic1.text = requiredBasicCourses1[0]
binding.tvBasic1Content.text = requiredBasicCourses1[1]
binding.tvBasic2.text = requiredBasicCourses1[2]
Expand All @@ -44,10 +44,29 @@ class CompletionStateFragment : Fragment() {
// binding.tvBasic5Content.text = requiredBasicCourses1[9]
// binding.tvBasic6.text = requiredBasicCourses1[10]
// binding.tvBasic6Content.text = requiredBasicCourses1[11]
}*/
val requiredBasicCourses = basicKeyList.mapNotNull { key ->
completionDtoMap?.firstOrNull { it.containsKey(key) }?.get(key)
}

if (requiredBasicCourses.isNotEmpty()) {
val requiredBasicCourses1 = requiredBasicCourses.first()
binding.tvBasic1.text = requiredBasicCourses1[0]
binding.tvBasic1Content.text = requiredBasicCourses1[1]

if (requiredBasicCourses1.size > 2) {
binding.tvBasic2.text = requiredBasicCourses1[2]
binding.tvBasic2Content.text = requiredBasicCourses1[3]
}

if (requiredBasicCourses1.size > 4) {
binding.tvBasic3.text = requiredBasicCourses1[4]
binding.tvBasic3Content.text = requiredBasicCourses1[5]
}
}

/**
* 필수 교양 (소양)
* 필수 교양 (소양) - 나단
*/
completionDtoMap?.firstOrNull { it.containsKey("필수교양(소양)") }?.get("필수교양(소양)")?.let { requiredBasicCourses2 ->
binding.tvSoyang1.text = requiredBasicCourses2[0]
Expand All @@ -57,6 +76,21 @@ class CompletionStateFragment : Fragment() {
binding.tvTotalScore.text = requiredBasicCourses2[5]
}

/**
* 필수 교양 (소양) - 준현
*/
/*
completionDtoMap?.firstOrNull { it.containsKey("토대교양") }?.get("토대교양")?.let { requiredBasicCourses2 ->
binding.tvSoyang1.text = requiredBasicCourses2[0]
binding.tvSoyang1Content.text = requiredBasicCourses2[1]
binding.tvSoyang2.text = requiredBasicCourses2[2]
binding.tvSoyang2Content.text = requiredBasicCourses2[3]
}
completionDtoMap?.firstOrNull { it.containsKey("소 계") }?.get("소 계")?.let {
binding.tvTotalScore.text = it[0]
}
*/

/**
* 트랙 1, 트랙 2
*/
Expand Down
13 changes: 2 additions & 11 deletions app/src/main/res/layout/fragment_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,11 @@
android:id="@+id/iv_home_notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="18dp"
android:layout_marginEnd="22dp"
android:src="@drawable/ic_notification_white_24"
app:layout_constraintBottom_toBottomOf="@+id/iv_home_logo"
app:layout_constraintEnd_toStartOf="@+id/iv_home_my_page"
app:layout_constraintTop_toTopOf="@+id/iv_home_logo" />

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_home_my_page"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="22dp"
android:src="@drawable/ic_my_page_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/iv_home_notification" />
app:layout_constraintTop_toTopOf="@+id/iv_home_logo" />

<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_home_hello"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

<androidx.appcompat.widget.AppCompatTextView
style="@style/MediumFont.12"
android:textColor="@color/black"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="17dp"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/fragment_setting_service_terms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<androidx.appcompat.widget.AppCompatTextView
style="@style/MediumFont.10"
android:layout_width="match_parent"
android:textColor="@color/black"
android:layout_height="match_parent"
android:layout_marginStart="17dp"
android:layout_marginEnd="17dp"
Expand Down

0 comments on commit 3f876e1

Please sign in to comment.