diff --git a/app/src/main/java/umc/com/mobile/project/ui/gradInfo/CompletionStateFragment.kt b/app/src/main/java/umc/com/mobile/project/ui/gradInfo/CompletionStateFragment.kt index 675c6d0..a7805d8 100644 --- a/app/src/main/java/umc/com/mobile/project/ui/gradInfo/CompletionStateFragment.kt +++ b/app/src/main/java/umc/com/mobile/project/ui/gradInfo/CompletionStateFragment.kt @@ -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>>? = 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] @@ -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] @@ -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 */ diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index f2c0a06..fc275bd 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -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" /> - - + app:layout_constraintTop_toTopOf="@+id/iv_home_logo" />