Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/FOR-GRAD/For-Grad-android i…
Browse files Browse the repository at this point in the history
…nto 21-졸업-요건-ui
  • Loading branch information
dkyuuum committed Feb 23, 2024
2 parents baf146e + 82339d3 commit ec994ee
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 43 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 @@ -31,12 +31,9 @@ class PlanSettingFragment : Fragment() {
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
// PlanTimeTabMainBinding을 인플레이트하여 루트 뷰를 가져옴
_binding = PlanTimeTabMainBinding.inflate(inflater, container, false)
val view = binding.root



// 탭 레이아웃 및 뷰페이저 초기화
initTabLayout()
initViewPager()
Expand All @@ -46,20 +43,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 @@ -74,7 +67,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 @@ -64,57 +64,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 @@ -33,6 +33,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 @@ -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
11 changes: 0 additions & 11 deletions app/src/main/res/layout/item_plan_time.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,5 @@
android:paddingBottom="7dp"
android:text="학점"
android:textColor="@color/black" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/delete_time_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
style="@style/MediumFont.13"
android:layout_weight="1"
android:text="삭제"
android:gravity="center"
android:paddingTop="12dp"
android:paddingBottom="7dp"
/>

</androidx.appcompat.widget.LinearLayoutCompat>

0 comments on commit ec994ee

Please sign in to comment.