Skip to content

Commit

Permalink
Fix: 향후 계획 학년학기 ui 갱신 #50
Browse files Browse the repository at this point in the history
  • Loading branch information
dkyuuum committed Feb 21, 2024
1 parent ffb3b5c commit 48d00a4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class HomeFragment : Fragment() {
setupHomeInfoRetrofit() // 홈 화면 ui 연결

binding.cvHomeProfile.setOnClickListener {
binding.ivHomeProfile.setImageResource(R.drawable.ic_user_profile)
// binding.ivHomeProfile.setImageResource(R.drawable.ic_user_profile)
}

return binding.root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@ class PlanSettingFragment : Fragment() {
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
// PlanTimeTabMainBinding을 인플레이트하여 루트 뷰를 가져옴
_binding = PlanTimeTabMainBinding.inflate(inflater, container, false)
val view = binding.root



// 탭 레이아웃 및 뷰페이저 초기화
initTabLayout()
initViewPager()
Expand All @@ -44,20 +41,16 @@ class PlanSettingFragment : Fragment() {
}

return view


}


private fun initTabLayout() {

val tabTitle = arrayOf("시간표", "자격증", "자유")


viewPager = binding.viewPagerTimeTabMain
tabLayout = binding.tabLayoutPlanTime


val adapter = PlanVPAdapter(this)

adapter.addFragment(PlanTimeFragment())
Expand All @@ -72,7 +65,6 @@ class PlanSettingFragment : Fragment() {
}

private fun initViewPager() {

binding.viewPagerTimeTabMain.isUserInputEnabled = false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class PlanTimeAdapter(private var addnewtime: List<Any> = ArrayList()): ListAdap

fun updateTimeList(addnewtime: ArrayList<TimeInfoResponse>) {
submitList(addnewtime)
notifyDataSetChanged()
}

class UpTimeResultDiffCallback : DiffUtil.ItemCallback<TimeInfoResponse>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,57 +62,41 @@ class PlanTimetableFragment : Fragment() {
viewModel.setGradeAndSemester(1, 1)
viewModel.getTimeInfo(1, 1)
Log.d("selected Item",selectedItem)


}

"1학년 2학기" -> {
viewModel.setGradeAndSemester(1, 2)
viewModel.getTimeInfo(1, 2)


}

"2학년 1학기" -> {
viewModel.setGradeAndSemester(2, 1)
viewModel.getTimeInfo(2, 1)


}

"2학년 2학기" -> {
viewModel.setGradeAndSemester(2, 2)
viewModel.getTimeInfo(2, 2)


}

"3학년 1학기" -> {
viewModel.setGradeAndSemester(3, 1)
viewModel.getTimeInfo(3, 1)


}

"3학년 2학기" -> {
viewModel.setGradeAndSemester(3, 2)
// viewModel.getTimeInfo(3, 2)


viewModel.getTimeInfo(3, 2)
}

"4학년 1학기" -> {
viewModel.setGradeAndSemester(4, 1)
// viewModel.getTimeInfo(4, 1)


viewModel.getTimeInfo(4, 1)
}

"4학년 2학기" -> {
viewModel.setGradeAndSemester(4, 2)
// viewModel.getTimeInfo(4, 2)


viewModel.getTimeInfo(4, 2)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@
val addTimeResponse: MutableLiveData<AddTimeResponse?> = _addTimeResponse

fun addTime(request: AddTimeRequest) {

planApiService.addTime(request).enqueue(object : Callback<AddTimeResponse> {
override fun onResponse(call: Call<AddTimeResponse>, response: Response<AddTimeResponse>) {
if (response.isSuccessful) {
Expand All @@ -201,7 +200,6 @@
fun sendAddTimeRequest() {
val currentSelectedSubjects = _selectedTimeResults.value ?: return


val grade = _grade.value
val semester = _semester.value
if (grade == null || semester == null) {
Expand Down Expand Up @@ -477,7 +475,9 @@
}



/**
* 시간표 조회하기
*/
fun getTimeInfo(grade:Int, semester:Int) {
planApiService.getUptime(grade,semester).enqueue(object : Callback<UpTimeResponse> {
override fun onResponse(
Expand All @@ -494,7 +494,6 @@
_selectedTimeResults.value = itemList

Log.d("PlanUpTime1", "TimeInfoResponse: $timeList")

Log.d("PlanUpTime", "${response.body()}")
} else {
Log.d("PlanUpTime", "${response.body()}")
Expand Down

0 comments on commit 48d00a4

Please sign in to comment.